@elementor/editor-controls 4.1.0-731 → 4.1.0-733
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.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +29 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/repeater/repeater.tsx +29 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-controls",
|
|
3
3
|
"description": "This package contains the controls model and utils for the Elementor editor",
|
|
4
|
-
"version": "4.1.0-
|
|
4
|
+
"version": "4.1.0-733",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -40,22 +40,22 @@
|
|
|
40
40
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@elementor/editor-current-user": "4.1.0-
|
|
44
|
-
"@elementor/editor-elements": "4.1.0-
|
|
45
|
-
"@elementor/editor-props": "4.1.0-
|
|
46
|
-
"@elementor/editor-responsive": "4.1.0-
|
|
47
|
-
"@elementor/editor-ui": "4.1.0-
|
|
48
|
-
"@elementor/editor-v1-adapters": "4.1.0-
|
|
49
|
-
"@elementor/env": "4.1.0-
|
|
50
|
-
"@elementor/http-client": "4.1.0-
|
|
43
|
+
"@elementor/editor-current-user": "4.1.0-733",
|
|
44
|
+
"@elementor/editor-elements": "4.1.0-733",
|
|
45
|
+
"@elementor/editor-props": "4.1.0-733",
|
|
46
|
+
"@elementor/editor-responsive": "4.1.0-733",
|
|
47
|
+
"@elementor/editor-ui": "4.1.0-733",
|
|
48
|
+
"@elementor/editor-v1-adapters": "4.1.0-733",
|
|
49
|
+
"@elementor/env": "4.1.0-733",
|
|
50
|
+
"@elementor/http-client": "4.1.0-733",
|
|
51
51
|
"@elementor/icons": "^1.68.0",
|
|
52
|
-
"@elementor/locations": "4.1.0-
|
|
53
|
-
"@elementor/events": "4.1.0-
|
|
54
|
-
"@elementor/query": "4.1.0-
|
|
55
|
-
"@elementor/session": "4.1.0-
|
|
52
|
+
"@elementor/locations": "4.1.0-733",
|
|
53
|
+
"@elementor/events": "4.1.0-733",
|
|
54
|
+
"@elementor/query": "4.1.0-733",
|
|
55
|
+
"@elementor/session": "4.1.0-733",
|
|
56
56
|
"@elementor/ui": "1.36.17",
|
|
57
|
-
"@elementor/utils": "4.1.0-
|
|
58
|
-
"@elementor/wp-media": "4.1.0-
|
|
57
|
+
"@elementor/utils": "4.1.0-733",
|
|
58
|
+
"@elementor/wp-media": "4.1.0-733",
|
|
59
59
|
"@wordpress/i18n": "^5.13.0",
|
|
60
60
|
"@monaco-editor/react": "^4.7.0",
|
|
61
61
|
"dayjs": "^1.11.18",
|
|
@@ -79,6 +79,8 @@ type BaseItemSettings< T > = {
|
|
|
79
79
|
Icon: React.ComponentType< { value: T } >;
|
|
80
80
|
Content: RepeaterItemContent< T >;
|
|
81
81
|
actions?: ( value: T ) => React.ReactNode;
|
|
82
|
+
onPopoverOpen?: ( value: T ) => void;
|
|
83
|
+
onPopoverClose?: () => void;
|
|
82
84
|
};
|
|
83
85
|
|
|
84
86
|
type SortableItemSettings< T > = BaseItemSettings< T > & {
|
|
@@ -273,6 +275,8 @@ export const Repeater = < T, >( {
|
|
|
273
275
|
toggleDisableItem={ () => toggleDisableRepeaterItem( index ) }
|
|
274
276
|
openOnMount={ openOnAdd && openItem === index }
|
|
275
277
|
onOpen={ () => setOpenItem( EMPTY_OPEN_ITEM ) }
|
|
278
|
+
onPopoverOpen={ itemSettings.onPopoverOpen }
|
|
279
|
+
onPopoverClose={ itemSettings.onPopoverClose }
|
|
276
280
|
showDuplicate={ showDuplicate }
|
|
277
281
|
showToggle={ showToggle }
|
|
278
282
|
showRemove={ showRemove }
|
|
@@ -307,6 +311,8 @@ type RepeaterItemProps< T > = {
|
|
|
307
311
|
children: ( props: Pick< RepeaterItemContentProps< T >, 'anchorEl' > ) => React.ReactNode;
|
|
308
312
|
openOnMount: boolean;
|
|
309
313
|
onOpen: () => void;
|
|
314
|
+
onPopoverOpen?: ( value: T ) => void;
|
|
315
|
+
onPopoverClose?: () => void;
|
|
310
316
|
showDuplicate: boolean;
|
|
311
317
|
showToggle: boolean;
|
|
312
318
|
showRemove: boolean;
|
|
@@ -325,6 +331,8 @@ const RepeaterItem = < T, >( {
|
|
|
325
331
|
toggleDisableItem,
|
|
326
332
|
openOnMount,
|
|
327
333
|
onOpen,
|
|
334
|
+
onPopoverOpen,
|
|
335
|
+
onPopoverClose,
|
|
328
336
|
showDuplicate,
|
|
329
337
|
showToggle,
|
|
330
338
|
showRemove,
|
|
@@ -332,7 +340,11 @@ const RepeaterItem = < T, >( {
|
|
|
332
340
|
actions,
|
|
333
341
|
value,
|
|
334
342
|
}: RepeaterItemProps< T > ) => {
|
|
335
|
-
const { popoverState, popoverProps, ref, setRef } = usePopover( openOnMount,
|
|
343
|
+
const { popoverState, popoverProps, ref, setRef } = usePopover( openOnMount, () => {
|
|
344
|
+
onOpen();
|
|
345
|
+
onPopoverOpen?.( value );
|
|
346
|
+
} );
|
|
347
|
+
const triggerProps = bindTrigger( popoverState );
|
|
336
348
|
|
|
337
349
|
const duplicateLabel = __( 'Duplicate', 'elementor' );
|
|
338
350
|
const toggleLabel = propDisabled ? __( 'Show', 'elementor' ) : __( 'Hide', 'elementor' );
|
|
@@ -345,7 +357,13 @@ const RepeaterItem = < T, >( {
|
|
|
345
357
|
label={ label }
|
|
346
358
|
ref={ setRef }
|
|
347
359
|
aria-label={ __( 'Open item', 'elementor' ) }
|
|
348
|
-
{ ...
|
|
360
|
+
{ ...triggerProps }
|
|
361
|
+
onClick={ ( e: React.MouseEvent< HTMLElement > ) => {
|
|
362
|
+
triggerProps.onClick( e );
|
|
363
|
+
if ( ! popoverState.isOpen ) {
|
|
364
|
+
onPopoverOpen?.( value );
|
|
365
|
+
}
|
|
366
|
+
} }
|
|
349
367
|
startIcon={ startIcon }
|
|
350
368
|
actions={
|
|
351
369
|
<>
|
|
@@ -374,7 +392,15 @@ const RepeaterItem = < T, >( {
|
|
|
374
392
|
</>
|
|
375
393
|
}
|
|
376
394
|
/>
|
|
377
|
-
<RepeaterPopover
|
|
395
|
+
<RepeaterPopover
|
|
396
|
+
width={ ref?.getBoundingClientRect().width }
|
|
397
|
+
{ ...popoverProps }
|
|
398
|
+
onClose={ () => {
|
|
399
|
+
popoverProps.onClose?.();
|
|
400
|
+
onPopoverClose?.();
|
|
401
|
+
} }
|
|
402
|
+
anchorEl={ ref }
|
|
403
|
+
>
|
|
378
404
|
<Box>{ children( { anchorEl: ref } ) }</Box>
|
|
379
405
|
</RepeaterPopover>
|
|
380
406
|
</>
|