@@ -106,18 +106,13 @@ export default {
106
106
// eslint-disable-next-line no-unreachable
107
107
return false ;
108
108
});
109
- const forceOpenInEditor = computed (() => {
110
- /* wwEditor:start */
111
- return props .wwEditorState .sidepanelContent .forceOpenInEditor ;
112
- /* wwEditor:end */
113
- return false ;
114
- });
109
+ const forceOpenInEditor = ref (false );
115
110
116
111
const appDivRef = shallowRef (wwLib .getFrontDocument ().querySelector (' #app' ));
117
112
118
113
const selectType = computed (() => props .content .selectType );
119
114
const initValue = computed (() =>
120
- selectType .value === ' single' ? props .content .initValueSingle ?? null : props .content .initValueMulti || []
115
+ selectType .value === ' single' ? ( props .content .initValueSingle ?? null ) : props .content .initValueMulti || []
121
116
);
122
117
const { value: variableValue , setValue } = wwLib .wwVariable .useComponentVariable ({
123
118
uid: props .uid ,
@@ -281,7 +276,7 @@ export default {
281
276
}
282
277
} else {
283
278
const currentValue = Array .isArray (variableValue .value ) ? [... variableValue .value ] : [];
284
-
279
+
285
280
// Find the index with proper object comparison if needed
286
281
let valueIndex = - 1 ;
287
282
if (typeof value === ' object' && value !== null ) {
@@ -321,7 +316,7 @@ export default {
321
316
shouldCloseDropdown .value = false ;
322
317
323
318
const currentValue = Array .isArray (variableValue .value ) ? [... variableValue .value ] : [];
324
-
319
+
325
320
// Find index using the utility function
326
321
const valueIndex = findValueIndex (currentValue, valueToRemove);
327
322
@@ -440,7 +435,7 @@ export default {
440
435
option,
441
436
])
442
437
);
443
-
438
+
444
439
// Format option for display
445
440
const formatOption = opt => ({
446
441
value: resolveMappingFormula (toValue (mappingValue), opt) ?? opt .value ,
@@ -450,33 +445,31 @@ export default {
450
445
});
451
446
452
447
// Find option by value using the utility function
453
- const findOptionByValue = ( value ) => {
448
+ const findOptionByValue = value => {
454
449
// Use the utility function to find an entry with matching key
455
- const entry = Array .from (_optionsMap .entries ()).find (([key , _ ]) =>
456
- areValuesEqual (key, value)
457
- );
450
+ const entry = Array .from (_optionsMap .entries ()).find (([key , _ ]) => areValuesEqual (key, value));
458
451
return entry ? entry[1 ] : null ;
459
452
};
460
-
453
+
461
454
// Handle single select
462
455
if (selectType .value === ' single' ) {
463
456
const option = findOptionByValue (variableValue .value );
464
457
return option ? formatOption (option) : null ;
465
- }
458
+ }
466
459
// Handle multiple select
467
460
else {
468
461
const selectedValues = Array .isArray (variableValue .value ) ? variableValue .value : [];
469
462
return selectedValues .map (value => {
470
463
const option = findOptionByValue (value);
471
-
464
+
472
465
if (! option) {
473
466
return {
474
467
value,
475
468
isInOptions: false ,
476
469
info: ' This value is not in the defined options' ,
477
470
};
478
471
}
479
-
472
+
480
473
return formatOption (option);
481
474
});
482
475
}
@@ -500,19 +493,25 @@ export default {
500
493
501
494
// Initialize passive event support detection
502
495
try {
503
- window .addEventListener (" test" , null , Object .defineProperty ({}, ' passive' , {
504
- get : function () { supportsPassive = true ; }
505
- }));
506
- } catch (e) {}
496
+ window .addEventListener (
497
+ ' test' ,
498
+ null ,
499
+ Object .defineProperty ({}, ' passive' , {
500
+ get : function () {
501
+ supportsPassive = true ;
502
+ },
503
+ })
504
+ );
505
+ } catch (e) {}
507
506
508
507
wheelOpt = supportsPassive ? { passive: false } : false ;
509
508
wheelEvent = ' onwheel' in document .createElement (' div' ) ? ' wheel' : ' mousewheel' ;
510
509
511
- const preventDefault = ( e ) => {
510
+ const preventDefault = e => {
512
511
e .preventDefault ();
513
512
};
514
513
515
- const preventDefaultForScrollKeys = ( e ) => {
514
+ const preventDefaultForScrollKeys = e => {
516
515
const keys = { 37 : 1 , 38 : 1 , 39 : 1 , 40 : 1 };
517
516
if (keys[e .keyCode ]) {
518
517
preventDefault (e);
@@ -865,6 +864,9 @@ export default {
865
864
this .resetLastTriggerComponentAction ();
866
865
this .resetSearch ();
867
866
},
867
+ toggleForceOpenInEditor () {
868
+ this .forceOpenInEditor = ! this .forceOpenInEditor ;
869
+ },
868
870
},
869
871
};
870
872
< / script>
0 commit comments