@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "4.2.0-
|
|
3
|
+
"version": "4.2.0-874",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -39,31 +39,31 @@
|
|
|
39
39
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@elementor/editor": "4.2.0-
|
|
43
|
-
"@elementor/editor-canvas": "4.2.0-
|
|
44
|
-
"@elementor/editor-controls": "4.2.0-
|
|
45
|
-
"@elementor/editor-documents": "4.2.0-
|
|
46
|
-
"@elementor/editor-elements": "4.2.0-
|
|
47
|
-
"@elementor/editor-interactions": "4.2.0-
|
|
48
|
-
"@elementor/editor-notifications": "4.2.0-
|
|
49
|
-
"@elementor/editor-panels": "4.2.0-
|
|
50
|
-
"@elementor/editor-props": "4.2.0-
|
|
51
|
-
"@elementor/editor-responsive": "4.2.0-
|
|
52
|
-
"@elementor/editor-styles": "4.2.0-
|
|
53
|
-
"@elementor/editor-styles-repository": "4.2.0-
|
|
54
|
-
"@elementor/editor-ui": "4.2.0-
|
|
55
|
-
"@elementor/editor-v1-adapters": "4.2.0-
|
|
56
|
-
"@elementor/http-client": "4.2.0-
|
|
42
|
+
"@elementor/editor": "4.2.0-874",
|
|
43
|
+
"@elementor/editor-canvas": "4.2.0-874",
|
|
44
|
+
"@elementor/editor-controls": "4.2.0-874",
|
|
45
|
+
"@elementor/editor-documents": "4.2.0-874",
|
|
46
|
+
"@elementor/editor-elements": "4.2.0-874",
|
|
47
|
+
"@elementor/editor-interactions": "4.2.0-874",
|
|
48
|
+
"@elementor/editor-notifications": "4.2.0-874",
|
|
49
|
+
"@elementor/editor-panels": "4.2.0-874",
|
|
50
|
+
"@elementor/editor-props": "4.2.0-874",
|
|
51
|
+
"@elementor/editor-responsive": "4.2.0-874",
|
|
52
|
+
"@elementor/editor-styles": "4.2.0-874",
|
|
53
|
+
"@elementor/editor-styles-repository": "4.2.0-874",
|
|
54
|
+
"@elementor/editor-ui": "4.2.0-874",
|
|
55
|
+
"@elementor/editor-v1-adapters": "4.2.0-874",
|
|
56
|
+
"@elementor/http-client": "4.2.0-874",
|
|
57
57
|
"@elementor/icons": "~1.75.1",
|
|
58
|
-
"@elementor/editor-variables": "4.2.0-
|
|
59
|
-
"@elementor/locations": "4.2.0-
|
|
60
|
-
"@elementor/menus": "4.2.0-
|
|
61
|
-
"@elementor/query": "4.2.0-
|
|
62
|
-
"@elementor/schema": "4.2.0-
|
|
63
|
-
"@elementor/session": "4.2.0-
|
|
58
|
+
"@elementor/editor-variables": "4.2.0-874",
|
|
59
|
+
"@elementor/locations": "4.2.0-874",
|
|
60
|
+
"@elementor/menus": "4.2.0-874",
|
|
61
|
+
"@elementor/query": "4.2.0-874",
|
|
62
|
+
"@elementor/schema": "4.2.0-874",
|
|
63
|
+
"@elementor/session": "4.2.0-874",
|
|
64
64
|
"@elementor/ui": "1.37.5",
|
|
65
|
-
"@elementor/utils": "4.2.0-
|
|
66
|
-
"@elementor/wp-media": "4.2.0-
|
|
65
|
+
"@elementor/utils": "4.2.0-874",
|
|
66
|
+
"@elementor/wp-media": "4.2.0-874",
|
|
67
67
|
"@wordpress/i18n": "^5.13.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type Control, type ControlItem, type Element, type ElementControl } from '@elementor/editor-elements';
|
|
3
|
+
import { type Props, type PropsSchema } from '@elementor/editor-props';
|
|
3
4
|
import { SessionStorageProvider } from '@elementor/session';
|
|
4
5
|
|
|
5
6
|
import { useElement } from '../contexts/element-context';
|
|
6
7
|
import { useDefaultPanelSettings } from '../hooks/use-default-panel-settings';
|
|
8
|
+
import { extractDependencyEffect } from '../utils/prop-dependency-utils';
|
|
7
9
|
import { Section } from './section';
|
|
8
10
|
import { SectionsList } from './sections-list';
|
|
9
11
|
import { SettingsControl } from './settings-control';
|
|
10
12
|
|
|
11
13
|
export const SettingsTab = () => {
|
|
12
|
-
const { elementType, element } = useElement();
|
|
14
|
+
const { elementType, element, settings } = useElement();
|
|
13
15
|
const settingsDefault = useDefaultPanelSettings();
|
|
16
|
+
const currentSettings = settings as Props;
|
|
14
17
|
|
|
15
18
|
const isDefaultExpanded = ( sectionId: string ) =>
|
|
16
19
|
settingsDefault.defaultSectionsExpanded.settings?.includes( sectionId );
|
|
@@ -26,20 +29,24 @@ export const SettingsTab = () => {
|
|
|
26
29
|
const { type, value } = control;
|
|
27
30
|
|
|
28
31
|
if ( type === 'section' ) {
|
|
32
|
+
const sectionItems = renderSectionItems( {
|
|
33
|
+
items: value.items,
|
|
34
|
+
element,
|
|
35
|
+
propsSchema: elementType.propsSchema,
|
|
36
|
+
settings: currentSettings,
|
|
37
|
+
} );
|
|
38
|
+
|
|
39
|
+
if ( ! sectionItems.length ) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
|
|
29
43
|
return (
|
|
30
44
|
<Section
|
|
31
45
|
title={ value.label }
|
|
32
46
|
key={ type + '.' + index }
|
|
33
47
|
defaultExpanded={ isDefaultExpanded( value.label ) }
|
|
34
48
|
>
|
|
35
|
-
{
|
|
36
|
-
if ( isControl( item ) ) {
|
|
37
|
-
return <SettingsControl key={ getKey( item, element ) } control={ item } />;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// TODO: Handle 2nd level sections
|
|
41
|
-
return null;
|
|
42
|
-
} ) }
|
|
49
|
+
{ sectionItems }
|
|
43
50
|
</Section>
|
|
44
51
|
);
|
|
45
52
|
}
|
|
@@ -62,3 +69,36 @@ function getKey( control: Control | ElementControl, element: Element ) {
|
|
|
62
69
|
function isControl( control: ControlItem ): control is Control | ElementControl {
|
|
63
70
|
return control.type === 'control' || control.type === 'element-control';
|
|
64
71
|
}
|
|
72
|
+
|
|
73
|
+
function renderSectionItems( {
|
|
74
|
+
items,
|
|
75
|
+
element,
|
|
76
|
+
propsSchema,
|
|
77
|
+
settings,
|
|
78
|
+
}: {
|
|
79
|
+
items?: ControlItem[];
|
|
80
|
+
element: Element;
|
|
81
|
+
propsSchema: PropsSchema;
|
|
82
|
+
settings: Props;
|
|
83
|
+
} ) {
|
|
84
|
+
return (
|
|
85
|
+
items?.flatMap( ( item ) => {
|
|
86
|
+
if ( ! isControl( item ) ) {
|
|
87
|
+
// TODO: Handle 2nd level sections
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if ( item.type === 'control' && isControlHiddenByDependencies( item, propsSchema, settings ) ) {
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return [ <SettingsControl key={ getKey( item, element ) } control={ item } /> ];
|
|
96
|
+
} ) ?? []
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function isControlHiddenByDependencies( control: Control, propsSchema: PropsSchema, settings: Props ) {
|
|
101
|
+
const { isHidden } = extractDependencyEffect( control.value.bind, propsSchema, settings );
|
|
102
|
+
|
|
103
|
+
return isHidden;
|
|
104
|
+
}
|