@elementor/editor-components 4.4.0-1136 → 4.4.0-1138
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 +47 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +23 -23
- package/src/components/instance-editing-panel/override-prop-control.tsx +28 -2
- package/src/components/instance-editing-panel/override-props-group-constants.ts +1 -0
- package/src/components/instance-editing-panel/override-props-group.tsx +6 -2
package/dist/index.mjs
CHANGED
|
@@ -396,8 +396,8 @@ var componentOverridableTransformer = createTransformer2(
|
|
|
396
396
|
}
|
|
397
397
|
);
|
|
398
398
|
function normalizeOriginValue(originValue) {
|
|
399
|
-
const
|
|
400
|
-
return
|
|
399
|
+
const isEmpty2 = !!originValue && Object.keys(originValue).length === 0;
|
|
400
|
+
return isEmpty2 ? null : originValue;
|
|
401
401
|
}
|
|
402
402
|
function transformOverride(originValue, options, overrideValue) {
|
|
403
403
|
const transformer = settingsTransformersRegistry.get("override");
|
|
@@ -654,8 +654,8 @@ function ComponentsList() {
|
|
|
654
654
|
if (isLoading) {
|
|
655
655
|
return /* @__PURE__ */ React5.createElement(LoadingComponents, null);
|
|
656
656
|
}
|
|
657
|
-
const
|
|
658
|
-
if (
|
|
657
|
+
const isEmpty2 = !components?.length;
|
|
658
|
+
if (isEmpty2) {
|
|
659
659
|
if (searchValue.length) {
|
|
660
660
|
return /* @__PURE__ */ React5.createElement(EmptySearchResult, null);
|
|
661
661
|
}
|
|
@@ -1580,6 +1580,9 @@ import {
|
|
|
1580
1580
|
SettingsField,
|
|
1581
1581
|
useElement as useElement2
|
|
1582
1582
|
} from "@elementor/editor-editing-panel";
|
|
1583
|
+
import {
|
|
1584
|
+
isEmpty
|
|
1585
|
+
} from "@elementor/editor-props";
|
|
1583
1586
|
import { Box as Box8 } from "@elementor/ui";
|
|
1584
1587
|
|
|
1585
1588
|
// src/hooks/use-controls-by-widget-type.ts
|
|
@@ -2188,6 +2191,7 @@ function OverrideControl({ overridableProp }) {
|
|
|
2188
2191
|
overridableProp.originPropFields ?? overridableProp,
|
|
2189
2192
|
overridableProp.label
|
|
2190
2193
|
);
|
|
2194
|
+
const effectiveControlProps = hasInheritedValue(resolvedBaseValue) ? omitPlaceholder(controlProps) : controlProps;
|
|
2191
2195
|
const propTypeSchema = createTopLevelObjectType({
|
|
2192
2196
|
schema: { [overridableProp.overrideKey]: propType }
|
|
2193
2197
|
});
|
|
@@ -2253,7 +2257,7 @@ function OverrideControl({ overridableProp }) {
|
|
|
2253
2257
|
baseValue,
|
|
2254
2258
|
isDisabled
|
|
2255
2259
|
},
|
|
2256
|
-
/* @__PURE__ */ React19.createElement(PropKeyProvider, { bind: overridableProp.overrideKey }, /* @__PURE__ */ React19.createElement(ControlReplacementsProvider, { replacements: controlReplacements }, /* @__PURE__ */ React19.createElement(Box8, { mb: 1.5 }, /* @__PURE__ */ React19.createElement(ControlTypeContainer, { layout }, layout !== "custom" && /* @__PURE__ */ React19.createElement(ControlLabel, null, overridableProp.label), /* @__PURE__ */ React19.createElement(OriginalControl, { control, controlProps })))))
|
|
2260
|
+
/* @__PURE__ */ React19.createElement(PropKeyProvider, { bind: overridableProp.overrideKey }, /* @__PURE__ */ React19.createElement(ControlReplacementsProvider, { replacements: controlReplacements }, /* @__PURE__ */ React19.createElement(Box8, { mb: 1.5 }, /* @__PURE__ */ React19.createElement(ControlTypeContainer, { layout }, layout !== "custom" && /* @__PURE__ */ React19.createElement(ControlLabel, null, overridableProp.label), /* @__PURE__ */ React19.createElement(OriginalControl, { control, controlProps: effectiveControlProps })))))
|
|
2257
2261
|
)
|
|
2258
2262
|
)
|
|
2259
2263
|
);
|
|
@@ -2267,6 +2271,13 @@ function resolveOverrideValues(overrideValue, resolvedOriginValues, propKey) {
|
|
|
2267
2271
|
const baseValue = overrideValue || isInheritedDynamic ? null : inheritedValue;
|
|
2268
2272
|
return { propValue, baseValue };
|
|
2269
2273
|
}
|
|
2274
|
+
function hasInheritedValue(baseValue) {
|
|
2275
|
+
return !!baseValue && !isEmpty(baseValue);
|
|
2276
|
+
}
|
|
2277
|
+
function omitPlaceholder(controlProps) {
|
|
2278
|
+
const { placeholder: _placeholder, ...rest } = controlProps;
|
|
2279
|
+
return rest;
|
|
2280
|
+
}
|
|
2270
2281
|
function getTempNewValueForDynamicProp(propType, propValue, newPropValue) {
|
|
2271
2282
|
const isRemovingOverride = newPropValue === null;
|
|
2272
2283
|
if (isRemovingOverride && isDynamicPropValue(propValue)) {
|
|
@@ -2347,6 +2358,9 @@ function isValidOverride(overridableProps, override) {
|
|
|
2347
2358
|
return !!overridableProps.props[overridableKey];
|
|
2348
2359
|
}
|
|
2349
2360
|
|
|
2361
|
+
// src/components/instance-editing-panel/override-props-group-constants.ts
|
|
2362
|
+
var OVERRIDE_PROPS_GROUP_CONTENT_CLASS = "e-override-props-group__content";
|
|
2363
|
+
|
|
2350
2364
|
// src/components/instance-editing-panel/override-props-group.tsx
|
|
2351
2365
|
function OverridePropsGroup({ group }) {
|
|
2352
2366
|
const [isOpen, setIsOpen] = useStateByElement(group.id, true);
|
|
@@ -2357,31 +2371,39 @@ function OverridePropsGroup({ group }) {
|
|
|
2357
2371
|
const labelId = `label-${id}`;
|
|
2358
2372
|
const contentId = `content-${id}`;
|
|
2359
2373
|
const title = group.label;
|
|
2360
|
-
return /* @__PURE__ */ React20.createElement(
|
|
2361
|
-
|
|
2374
|
+
return /* @__PURE__ */ React20.createElement(
|
|
2375
|
+
Box9,
|
|
2362
2376
|
{
|
|
2363
|
-
id: labelId,
|
|
2364
|
-
"aria-controls": contentId,
|
|
2365
2377
|
"aria-label": `${title} section`,
|
|
2366
|
-
|
|
2367
|
-
p: 0,
|
|
2368
|
-
sx: { "&:hover": { backgroundColor: "transparent" } }
|
|
2378
|
+
sx: { [`&:has(.${OVERRIDE_PROPS_GROUP_CONTENT_CLASS}:empty)`]: { display: "none" } }
|
|
2369
2379
|
},
|
|
2370
|
-
/* @__PURE__ */ React20.createElement(
|
|
2371
|
-
|
|
2380
|
+
/* @__PURE__ */ React20.createElement(
|
|
2381
|
+
ListItemButton2,
|
|
2372
2382
|
{
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2383
|
+
id: labelId,
|
|
2384
|
+
"aria-controls": contentId,
|
|
2385
|
+
"aria-label": `${title} section`,
|
|
2386
|
+
onClick: handleClick,
|
|
2387
|
+
p: 0,
|
|
2388
|
+
sx: { "&:hover": { backgroundColor: "transparent" } }
|
|
2389
|
+
},
|
|
2390
|
+
/* @__PURE__ */ React20.createElement(Stack9, { direction: "row", alignItems: "center", justifyItems: "start", flexGrow: 1, gap: 0.5 }, /* @__PURE__ */ React20.createElement(
|
|
2391
|
+
ListItemText,
|
|
2392
|
+
{
|
|
2393
|
+
secondary: title,
|
|
2394
|
+
secondaryTypographyProps: { color: "text.primary", variant: "caption", fontWeight: "bold" },
|
|
2395
|
+
sx: { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 }
|
|
2396
|
+
}
|
|
2397
|
+
)),
|
|
2398
|
+
/* @__PURE__ */ React20.createElement(CollapseIcon, { open: isOpen, color: "secondary", fontSize: "tiny" })
|
|
2399
|
+
),
|
|
2400
|
+
/* @__PURE__ */ React20.createElement(Collapse, { id: contentId, "aria-labelledby": labelId, in: isOpen, timeout: "auto" }, /* @__PURE__ */ React20.createElement(Stack9, { className: OVERRIDE_PROPS_GROUP_CONTENT_CLASS, direction: "column", gap: 1, p: 2 }, group.props.map((overrideKey) => /* @__PURE__ */ React20.createElement(OverridePropControl, { key: overrideKey, overrideKey }))))
|
|
2401
|
+
);
|
|
2380
2402
|
}
|
|
2381
2403
|
|
|
2382
2404
|
// src/components/instance-editing-panel/instance-panel-body.tsx
|
|
2383
|
-
function InstancePanelBody({ groups, isEmpty, emptyState, componentInstanceId }) {
|
|
2384
|
-
return /* @__PURE__ */ React21.createElement(PanelBody, null, /* @__PURE__ */ React21.createElement(ControlAdornmentsProvider, { items: getFieldIndicators("settings") },
|
|
2405
|
+
function InstancePanelBody({ groups, isEmpty: isEmpty2, emptyState, componentInstanceId }) {
|
|
2406
|
+
return /* @__PURE__ */ React21.createElement(PanelBody, null, /* @__PURE__ */ React21.createElement(ControlAdornmentsProvider, { items: getFieldIndicators("settings") }, isEmpty2 ? emptyState : /* @__PURE__ */ React21.createElement(Stack10, { direction: "column", alignItems: "stretch" }, groups.map((group) => /* @__PURE__ */ React21.createElement(React21.Fragment, { key: group.id + componentInstanceId }, /* @__PURE__ */ React21.createElement(OverridePropsGroup, { group }), /* @__PURE__ */ React21.createElement(Divider2, null))))));
|
|
2385
2407
|
}
|
|
2386
2408
|
|
|
2387
2409
|
// src/components/instance-editing-panel/use-instance-panel-data.ts
|
|
@@ -2441,8 +2463,8 @@ function useInstancePanelData() {
|
|
|
2441
2463
|
}
|
|
2442
2464
|
const isNonEmptyGroup = (group) => group !== null && group.props.length > 0;
|
|
2443
2465
|
const groups = overridableProps.groups.order.map((groupId) => overridableProps.groups.items[groupId] ?? null).filter(isNonEmptyGroup);
|
|
2444
|
-
const
|
|
2445
|
-
return { componentId, component, overrides, overridableProps, groups, isEmpty, componentInstanceId };
|
|
2466
|
+
const isEmpty2 = groups.length === 0 || Object.keys(overridableProps.props).length === 0;
|
|
2467
|
+
return { componentId, component, overrides, overridableProps, groups, isEmpty: isEmpty2, componentInstanceId };
|
|
2446
2468
|
}
|
|
2447
2469
|
function useComponentInstanceSettings() {
|
|
2448
2470
|
const { element, settings } = useElement3();
|
|
@@ -2457,7 +2479,7 @@ function InstanceEditingPanel() {
|
|
|
2457
2479
|
if (!data) {
|
|
2458
2480
|
return null;
|
|
2459
2481
|
}
|
|
2460
|
-
const { componentId, component, overrides, overridableProps, groups, isEmpty, componentInstanceId } = data;
|
|
2482
|
+
const { componentId, component, overrides, overridableProps, groups, isEmpty: isEmpty2, componentInstanceId } = data;
|
|
2461
2483
|
const panelTitle = __12("Edit %s", "elementor").replace("%s", component.name);
|
|
2462
2484
|
const actions = /* @__PURE__ */ React22.createElement(Stack11, { direction: "row", gap: 0.5 }, /* @__PURE__ */ React22.createElement(DetachAction, { componentInstanceId, componentId }), canEdit && /* @__PURE__ */ React22.createElement(EditComponentAction, { disabled: true, label: panelTitle, icon: PencilIcon2 }));
|
|
2463
2485
|
return /* @__PURE__ */ React22.createElement(Box10, { "data-testid": "instance-editing-panel", sx: { display: "flex", flexDirection: "column", height: "100%" } }, /* @__PURE__ */ React22.createElement(
|
|
@@ -2472,7 +2494,7 @@ function InstanceEditingPanel() {
|
|
|
2472
2494
|
InstancePanelBody,
|
|
2473
2495
|
{
|
|
2474
2496
|
groups,
|
|
2475
|
-
isEmpty,
|
|
2497
|
+
isEmpty: isEmpty2,
|
|
2476
2498
|
emptyState: /* @__PURE__ */ React22.createElement(EmptyState2, null),
|
|
2477
2499
|
componentInstanceId
|
|
2478
2500
|
}
|