@elementor/editor-editing-panel 4.4.0-1121 → 4.4.0-1122
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 +66 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +25 -25
- package/src/controls-registry/element-controls/accordion-items-control/accordion-items-control.tsx +4 -1
- package/src/controls-registry/element-controls/accordion-items-control/use-actions.ts +12 -3
- package/src/controls-registry/element-controls/accordion-items-control/use-show-icon-write-through.ts +72 -0
package/dist/index.mjs
CHANGED
|
@@ -6055,7 +6055,7 @@ var getNextItemNumber = (existingTitles) => {
|
|
|
6055
6055
|
}
|
|
6056
6056
|
return next;
|
|
6057
6057
|
};
|
|
6058
|
-
var buildItemModel = (position, showIcon) => {
|
|
6058
|
+
var buildItemModel = (position, showIcon, differentOpenIcon) => {
|
|
6059
6059
|
const numberedTitle = getItemTitle(position);
|
|
6060
6060
|
return {
|
|
6061
6061
|
elType: ACCORDION_ITEM_ELEMENT_TYPE,
|
|
@@ -6070,7 +6070,10 @@ var buildItemModel = (position, showIcon) => {
|
|
|
6070
6070
|
// has already turned Show Icon off, a newly added item must start with its icon hidden
|
|
6071
6071
|
// too, not re-show one just because the item itself is brand new. See the comment on
|
|
6072
6072
|
// the mirrored prop in `Atomic_Accordion_Item_Header` for why this duplication exists.
|
|
6073
|
-
settings: {
|
|
6073
|
+
settings: {
|
|
6074
|
+
show_icon: booleanPropTypeUtil2.create(showIcon),
|
|
6075
|
+
different_open_icon: booleanPropTypeUtil2.create(differentOpenIcon)
|
|
6076
|
+
},
|
|
6074
6077
|
elements: [
|
|
6075
6078
|
{
|
|
6076
6079
|
elType: ACCORDION_ITEM_TITLE_ELEMENT_TYPE,
|
|
@@ -6116,7 +6119,8 @@ var useActions = () => {
|
|
|
6116
6119
|
accordionId,
|
|
6117
6120
|
existingTitles,
|
|
6118
6121
|
items: items3,
|
|
6119
|
-
showIcon
|
|
6122
|
+
showIcon,
|
|
6123
|
+
differentOpenIcon = false
|
|
6120
6124
|
}) => {
|
|
6121
6125
|
const accordion = getContainer2(accordionId);
|
|
6122
6126
|
if (!accordion) {
|
|
@@ -6138,7 +6142,11 @@ var useActions = () => {
|
|
|
6138
6142
|
// *existing* element out of the document, not for describing one to create. A single
|
|
6139
6143
|
// cast is enough (the two types overlap enough for TS to allow it directly); no
|
|
6140
6144
|
// `unknown` escape hatch needed.
|
|
6141
|
-
model: buildItemModel(
|
|
6145
|
+
model: buildItemModel(
|
|
6146
|
+
position,
|
|
6147
|
+
showIcon,
|
|
6148
|
+
differentOpenIcon
|
|
6149
|
+
)
|
|
6142
6150
|
}
|
|
6143
6151
|
]
|
|
6144
6152
|
});
|
|
@@ -6253,6 +6261,56 @@ function getAccordionHeaderIds(accordionId) {
|
|
|
6253
6261
|
).filter((header) => Boolean(header));
|
|
6254
6262
|
return headerContainers.map((header) => header.id);
|
|
6255
6263
|
}
|
|
6264
|
+
var cascadeDifferentOpenIconToHeaders = undoable5(
|
|
6265
|
+
{
|
|
6266
|
+
do: ({ accordionId, differentOpenIcon }) => {
|
|
6267
|
+
const headerIds = getAccordionHeaderIds(accordionId);
|
|
6268
|
+
const previous = Object.fromEntries(
|
|
6269
|
+
headerIds.map(
|
|
6270
|
+
(headerId) => [
|
|
6271
|
+
headerId,
|
|
6272
|
+
getElementSettings2(headerId, [
|
|
6273
|
+
"different_open_icon"
|
|
6274
|
+
]).different_open_icon
|
|
6275
|
+
]
|
|
6276
|
+
)
|
|
6277
|
+
);
|
|
6278
|
+
headerIds.forEach((headerId) => {
|
|
6279
|
+
updateElementSettings4({
|
|
6280
|
+
id: headerId,
|
|
6281
|
+
props: { different_open_icon: booleanPropTypeUtil3.create(differentOpenIcon) },
|
|
6282
|
+
withHistory: false
|
|
6283
|
+
});
|
|
6284
|
+
});
|
|
6285
|
+
return { previous };
|
|
6286
|
+
},
|
|
6287
|
+
undo: (_payload, { previous }) => {
|
|
6288
|
+
Object.entries(previous).forEach(([headerId, previousValue]) => {
|
|
6289
|
+
updateElementSettings4({
|
|
6290
|
+
id: headerId,
|
|
6291
|
+
props: { different_open_icon: previousValue ?? null },
|
|
6292
|
+
withHistory: false
|
|
6293
|
+
});
|
|
6294
|
+
});
|
|
6295
|
+
}
|
|
6296
|
+
},
|
|
6297
|
+
{
|
|
6298
|
+
title: __70("Accordion", "elementor"),
|
|
6299
|
+
subtitle: __70("Different icon when open", "elementor"),
|
|
6300
|
+
debounce: { wait: HISTORY_DEBOUNCE_WAIT }
|
|
6301
|
+
}
|
|
6302
|
+
);
|
|
6303
|
+
function useDifferentOpenIconWriteThrough(accordionId, differentOpenIcon) {
|
|
6304
|
+
const previousRef = useRef20(null);
|
|
6305
|
+
useEffect9(() => {
|
|
6306
|
+
const previous = previousRef.current;
|
|
6307
|
+
previousRef.current = { accordionId, differentOpenIcon };
|
|
6308
|
+
if (!previous || previous.accordionId !== accordionId || previous.differentOpenIcon === differentOpenIcon) {
|
|
6309
|
+
return;
|
|
6310
|
+
}
|
|
6311
|
+
cascadeDifferentOpenIconToHeaders({ accordionId, differentOpenIcon });
|
|
6312
|
+
}, [accordionId, differentOpenIcon]);
|
|
6313
|
+
}
|
|
6256
6314
|
function useShowIconWriteThrough(accordionId, showIcon) {
|
|
6257
6315
|
const previousRef = useRef20(null);
|
|
6258
6316
|
useEffect9(() => {
|
|
@@ -6275,7 +6333,9 @@ var AccordionItemsControl = ({ label }) => {
|
|
|
6275
6333
|
{ includeSelfAsParent: true }
|
|
6276
6334
|
);
|
|
6277
6335
|
const showIcon = booleanPropTypeUtil4.extract(settings.show_icon) ?? true;
|
|
6336
|
+
const differentOpenIcon = booleanPropTypeUtil4.extract(settings.different_open_icon) ?? false;
|
|
6278
6337
|
useShowIconWriteThrough(element.id, showIcon);
|
|
6338
|
+
useDifferentOpenIconWriteThrough(element.id, differentOpenIcon);
|
|
6279
6339
|
const repeaterValues = items3.map((item, index) => {
|
|
6280
6340
|
return {
|
|
6281
6341
|
id: item.id,
|
|
@@ -6291,7 +6351,8 @@ var AccordionItemsControl = ({ label }) => {
|
|
|
6291
6351
|
// see `getNextItemNumber`.
|
|
6292
6352
|
existingTitles: repeaterValues.map(({ title }) => title),
|
|
6293
6353
|
items: meta.action.payload,
|
|
6294
|
-
showIcon
|
|
6354
|
+
showIcon,
|
|
6355
|
+
differentOpenIcon
|
|
6295
6356
|
});
|
|
6296
6357
|
}
|
|
6297
6358
|
if (meta?.action?.type === "remove") {
|