@lvce-editor/find-widget-worker 2.5.0 → 2.6.0
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/findWidgetWorkerMain.js +21 -7
- package/package.json +1 -1
|
@@ -2343,6 +2343,7 @@ const SearchFieldButton = 'SearchFieldButton';
|
|
|
2343
2343
|
const SearchFieldButtonChecked = 'SearchFieldButtonChecked';
|
|
2344
2344
|
const SearchFieldButtons = 'SearchFieldButtons';
|
|
2345
2345
|
const SearchFieldError = 'SearchFieldError';
|
|
2346
|
+
const SearchFieldFocused = 'SearchFieldFocused';
|
|
2346
2347
|
const SearchToggleButton = 'SearchToggleButton';
|
|
2347
2348
|
const SearchToggleButtonExpanded = 'SearchToggleButtonExpanded';
|
|
2348
2349
|
const Viewlet = 'Viewlet';
|
|
@@ -2453,8 +2454,17 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
|
|
|
2453
2454
|
return dom;
|
|
2454
2455
|
};
|
|
2455
2456
|
|
|
2456
|
-
const
|
|
2457
|
-
|
|
2457
|
+
const getExtraClassName = (hasError, inputFocused) => {
|
|
2458
|
+
if (hasError) {
|
|
2459
|
+
return SearchFieldError;
|
|
2460
|
+
}
|
|
2461
|
+
if (inputFocused) {
|
|
2462
|
+
return SearchFieldFocused;
|
|
2463
|
+
}
|
|
2464
|
+
return '';
|
|
2465
|
+
};
|
|
2466
|
+
const getFindWidgetFindVirtualDom = (matchCountText, buttons, fieldButtons, matchCount, hasValue, hasError, inputFocused) => {
|
|
2467
|
+
const extraClassName = getExtraClassName(hasError, inputFocused);
|
|
2458
2468
|
return [{
|
|
2459
2469
|
type: Div,
|
|
2460
2470
|
className: FindWidgetFind,
|
|
@@ -2466,15 +2476,16 @@ const getFindWidgetFindVirtualDom = (matchCountText, buttons, fieldButtons, matc
|
|
|
2466
2476
|
}, ...getMatchCountVirtualDom(matchCountText, matchCount, hasValue), ...buttons.flatMap(getIconButtonVirtualDom)];
|
|
2467
2477
|
};
|
|
2468
2478
|
|
|
2469
|
-
const getFindWidgetReplaceVirtualDom = (replaceExpanded, replaceButtons, replaceFieldButtons) => {
|
|
2479
|
+
const getFindWidgetReplaceVirtualDom = (replaceExpanded, replaceButtons, replaceFieldButtons, replaceInputFocused) => {
|
|
2470
2480
|
if (!replaceExpanded) {
|
|
2471
2481
|
return [];
|
|
2472
2482
|
}
|
|
2483
|
+
const extraClassName = replaceInputFocused ? SearchFieldFocused : '';
|
|
2473
2484
|
return [{
|
|
2474
2485
|
type: Div,
|
|
2475
2486
|
className: FindWidgetReplace,
|
|
2476
2487
|
childCount: 1 + replaceButtons.length
|
|
2477
|
-
}, ...getSearchFieldVirtualDom(ReplaceValue, replace(), HandleReplaceInput, [], [], HandleReplaceFocus,
|
|
2488
|
+
}, ...getSearchFieldVirtualDom(ReplaceValue, replace(), HandleReplaceInput, [], [], HandleReplaceFocus, extraClassName), ...replaceButtons.flatMap(getIconButtonVirtualDom)];
|
|
2478
2489
|
};
|
|
2479
2490
|
|
|
2480
2491
|
const getResizerVirtualDom = () => {
|
|
@@ -2516,12 +2527,12 @@ const parentNode = {
|
|
|
2516
2527
|
childCount: 3,
|
|
2517
2528
|
role: Group
|
|
2518
2529
|
};
|
|
2519
|
-
const getFindWidgetVirtualDom = (matchCountText, replaceExpanded, findButtons, findFieldButtons, replaceButtons, replaceFieldButtons, matchCount, value, hasError) => {
|
|
2530
|
+
const getFindWidgetVirtualDom = (matchCountText, replaceExpanded, findButtons, findFieldButtons, replaceButtons, replaceFieldButtons, matchCount, value, hasError, inputFocused, replaceInputFocused) => {
|
|
2520
2531
|
return [parentNode, ...getResizerVirtualDom(), ...getSearchToggleButtonVirtualDom(replaceExpanded, 'handleClickToggleReplace'), {
|
|
2521
2532
|
type: Div,
|
|
2522
2533
|
className: FindWidgetRight,
|
|
2523
2534
|
childCount: replaceExpanded ? 2 : 1
|
|
2524
|
-
}, ...getFindWidgetFindVirtualDom(matchCountText, findButtons, findFieldButtons, matchCount, Boolean(value), hasError), ...getFindWidgetReplaceVirtualDom(replaceExpanded, replaceButtons)];
|
|
2535
|
+
}, ...getFindWidgetFindVirtualDom(matchCountText, findButtons, findFieldButtons, matchCount, Boolean(value), hasError, inputFocused), ...getFindWidgetReplaceVirtualDom(replaceExpanded, replaceButtons, replaceFieldButtons, replaceInputFocused)];
|
|
2525
2536
|
};
|
|
2526
2537
|
|
|
2527
2538
|
const getMatchCountText = (matchIndex, matchCount) => {
|
|
@@ -2533,6 +2544,7 @@ const getMatchCountText = (matchIndex, matchCount) => {
|
|
|
2533
2544
|
|
|
2534
2545
|
const renderContent = (oldState, newState) => {
|
|
2535
2546
|
const {
|
|
2547
|
+
focus,
|
|
2536
2548
|
uid,
|
|
2537
2549
|
matchCount,
|
|
2538
2550
|
value,
|
|
@@ -2555,7 +2567,9 @@ const renderContent = (oldState, newState) => {
|
|
|
2555
2567
|
replaceFieldButtons
|
|
2556
2568
|
} = getFindWidgetButtons(findButtonsEnabled, replaceButtonsEnabled, matchCase, matchWholeWord, useRegularExpression, preserveCase);
|
|
2557
2569
|
const hasError = Boolean(inputErrorMessage);
|
|
2558
|
-
const
|
|
2570
|
+
const inputFocused = focus === FocusSearchInput;
|
|
2571
|
+
const replaceInputFocused = focus === FocusSearchReplaceInput;
|
|
2572
|
+
const dom = getFindWidgetVirtualDom(matchCountText, replaceExpanded, findButtons, findFieldButtons, replaceButtons, replaceFieldButtons, matchCount, value, hasError, inputFocused, replaceInputFocused);
|
|
2559
2573
|
return [SetDom2, uid, dom];
|
|
2560
2574
|
};
|
|
2561
2575
|
|