@lvce-editor/settings-view 2.28.0 → 2.29.1
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/settingsViewWorkerMain.js +114 -42
- package/package.json +1 -1
|
@@ -1379,10 +1379,13 @@ const terminate = () => {
|
|
|
1379
1379
|
};
|
|
1380
1380
|
|
|
1381
1381
|
const computeScrollBar = (height, totalItemCount, itemHeight, scrollOffset, scrollBarMinHeight) => {
|
|
1382
|
-
const
|
|
1383
|
-
const
|
|
1384
|
-
const
|
|
1385
|
-
const
|
|
1382
|
+
const safeHeight = Math.max(0, height);
|
|
1383
|
+
const safeItemHeight = Math.max(0, itemHeight);
|
|
1384
|
+
const totalHeight = totalItemCount * safeItemHeight;
|
|
1385
|
+
const scrollable = Math.max(0, totalHeight - safeHeight);
|
|
1386
|
+
const thumbTrack = safeHeight;
|
|
1387
|
+
const proportionalThumbHeight = totalHeight > 0 ? Math.floor(safeHeight / Math.max(totalHeight, 1) * safeHeight) : safeHeight;
|
|
1388
|
+
const thumbHeight = totalHeight > 0 ? Math.min(safeHeight, Math.max(scrollBarMinHeight, proportionalThumbHeight)) : safeHeight;
|
|
1386
1389
|
const thumbMaxTop = Math.max(0, thumbTrack - thumbHeight);
|
|
1387
1390
|
const thumbTop = scrollable > 0 ? Math.min(thumbMaxTop, Math.floor(scrollOffset / scrollable * thumbMaxTop)) : 0;
|
|
1388
1391
|
return {
|
|
@@ -1394,8 +1397,9 @@ const computeScrollBar = (height, totalItemCount, itemHeight, scrollOffset, scro
|
|
|
1394
1397
|
const computeVisibleItems = (items, height, scrollOffset, itemHeight) => {
|
|
1395
1398
|
const safeItemHeight = itemHeight <= 0 ? 1 : itemHeight;
|
|
1396
1399
|
const totalItems = items.length;
|
|
1397
|
-
const
|
|
1398
|
-
const
|
|
1400
|
+
const safeHeight = Math.max(0, height);
|
|
1401
|
+
const minLineY = Math.max(0, Math.floor(Math.max(0, scrollOffset) / safeItemHeight));
|
|
1402
|
+
const itemsPerViewport = Math.max(1, Math.ceil(safeHeight / safeItemHeight) + 1);
|
|
1399
1403
|
const maxLineY = Math.min(totalItems, minLineY + itemsPerViewport);
|
|
1400
1404
|
const visibleItems = items.slice(minLineY, maxLineY);
|
|
1401
1405
|
return {
|
|
@@ -1476,6 +1480,13 @@ const getFilteredItems = (items, tabs, searchValue, modifiedSettings, preference
|
|
|
1476
1480
|
return parsedQuery.modified ? validated.filter(item => item.modified) : validated;
|
|
1477
1481
|
};
|
|
1478
1482
|
|
|
1483
|
+
// The worker receives the height of the complete settings view. Account for
|
|
1484
|
+
// the search header, content padding, and content heading before measuring rows.
|
|
1485
|
+
const settingsContentChromeHeight = 114;
|
|
1486
|
+
const getSettingsViewportHeight = height => {
|
|
1487
|
+
return Math.max(0, height - settingsContentChromeHeight);
|
|
1488
|
+
};
|
|
1489
|
+
|
|
1479
1490
|
const User = 1;
|
|
1480
1491
|
const Script = 2;
|
|
1481
1492
|
|
|
@@ -1491,6 +1502,7 @@ const clear$1 = state => {
|
|
|
1491
1502
|
scrollBarMinHeight,
|
|
1492
1503
|
tabs
|
|
1493
1504
|
} = state;
|
|
1505
|
+
const viewportHeight = getSettingsViewportHeight(height);
|
|
1494
1506
|
const newSearchValue = '';
|
|
1495
1507
|
const filteredItems = getFilteredItems(items, tabs, newSearchValue, modifiedSettings, preferences);
|
|
1496
1508
|
const nextScrollOffset = 0;
|
|
@@ -1498,11 +1510,11 @@ const clear$1 = state => {
|
|
|
1498
1510
|
maxLineY,
|
|
1499
1511
|
minLineY,
|
|
1500
1512
|
visibleItems
|
|
1501
|
-
} = computeVisibleItems(filteredItems,
|
|
1513
|
+
} = computeVisibleItems(filteredItems, viewportHeight, nextScrollOffset, itemHeight);
|
|
1502
1514
|
const {
|
|
1503
1515
|
thumbHeight,
|
|
1504
1516
|
thumbTop
|
|
1505
|
-
} = computeScrollBar(
|
|
1517
|
+
} = computeScrollBar(viewportHeight, filteredItems.length, itemHeight, nextScrollOffset, scrollBarMinHeight);
|
|
1506
1518
|
return {
|
|
1507
1519
|
...state,
|
|
1508
1520
|
deltaY: 0,
|
|
@@ -1578,7 +1590,7 @@ const create$1 = (id, uri, x, y, width, height) => {
|
|
|
1578
1590
|
};
|
|
1579
1591
|
|
|
1580
1592
|
const isEqual$4 = (oldState, newState) => {
|
|
1581
|
-
return oldState.sideBarWidth === newState.sideBarWidth && oldState.scrollBarThumbHeight === newState.scrollBarThumbHeight && oldState.scrollBarThumbTop === newState.scrollBarThumbTop;
|
|
1593
|
+
return oldState.sideBarWidth === newState.sideBarWidth && oldState.filteredItems.length === newState.filteredItems.length && oldState.itemHeight === newState.itemHeight && oldState.scrollOffset === newState.scrollOffset && oldState.scrollBarThumbHeight === newState.scrollBarThumbHeight && oldState.scrollBarThumbTop === newState.scrollBarThumbTop;
|
|
1582
1594
|
};
|
|
1583
1595
|
|
|
1584
1596
|
const isEqual$3 = (oldState, newState) => {
|
|
@@ -1698,6 +1710,7 @@ const handleInput = (state, value, inputSource = User) => {
|
|
|
1698
1710
|
preferences,
|
|
1699
1711
|
tabs
|
|
1700
1712
|
} = state;
|
|
1713
|
+
const viewportHeight = getSettingsViewportHeight(height);
|
|
1701
1714
|
const filteredItems = getFilteredItems(items, tabs, value, modifiedSettings, preferences);
|
|
1702
1715
|
// Reset scroll when filter value changes so the user sees results from the top
|
|
1703
1716
|
const nextScrollOffset = 0;
|
|
@@ -1705,14 +1718,14 @@ const handleInput = (state, value, inputSource = User) => {
|
|
|
1705
1718
|
maxLineY,
|
|
1706
1719
|
minLineY,
|
|
1707
1720
|
visibleItems
|
|
1708
|
-
} = computeVisibleItems(filteredItems,
|
|
1721
|
+
} = computeVisibleItems(filteredItems, viewportHeight, nextScrollOffset, itemHeight);
|
|
1709
1722
|
const {
|
|
1710
1723
|
scrollBarMinHeight
|
|
1711
1724
|
} = state;
|
|
1712
1725
|
const {
|
|
1713
1726
|
thumbHeight,
|
|
1714
1727
|
thumbTop
|
|
1715
|
-
} = computeScrollBar(
|
|
1728
|
+
} = computeScrollBar(viewportHeight, filteredItems.length, itemHeight, nextScrollOffset, scrollBarMinHeight);
|
|
1716
1729
|
const {
|
|
1717
1730
|
newHistory,
|
|
1718
1731
|
newHistoryIndex
|
|
@@ -2431,6 +2444,7 @@ const VirtualDomElements = {
|
|
|
2431
2444
|
const ClientX = 'event.clientX';
|
|
2432
2445
|
const ClientY = 'event.clientY';
|
|
2433
2446
|
const DeltaY = 'event.deltaY';
|
|
2447
|
+
const TargetChecked = 'event.target.checked';
|
|
2434
2448
|
const TargetName = 'event.target.name';
|
|
2435
2449
|
const TargetValue = 'event.target.value';
|
|
2436
2450
|
|
|
@@ -2761,20 +2775,23 @@ const handleClickTab = (state, name = '') => {
|
|
|
2761
2775
|
searchValue,
|
|
2762
2776
|
tabs
|
|
2763
2777
|
} = state;
|
|
2778
|
+
const viewportHeight = getSettingsViewportHeight(height);
|
|
2764
2779
|
const updatedTabs = getUpdatedTabs(tabs, name);
|
|
2765
2780
|
const filteredItems = getFilteredItems(items, updatedTabs, searchValue, modifiedSettings, preferences);
|
|
2781
|
+
const maxScrollable = Math.max(0, filteredItems.length * itemHeight - viewportHeight);
|
|
2782
|
+
const nextScrollOffset = Math.min(Math.max(0, scrollOffset), maxScrollable);
|
|
2766
2783
|
const {
|
|
2767
2784
|
maxLineY,
|
|
2768
2785
|
minLineY,
|
|
2769
2786
|
visibleItems
|
|
2770
|
-
} = computeVisibleItems(filteredItems,
|
|
2787
|
+
} = computeVisibleItems(filteredItems, viewportHeight, nextScrollOffset, itemHeight);
|
|
2771
2788
|
const {
|
|
2772
2789
|
scrollBarMinHeight
|
|
2773
2790
|
} = state;
|
|
2774
2791
|
const {
|
|
2775
2792
|
thumbHeight,
|
|
2776
2793
|
thumbTop
|
|
2777
|
-
} = computeScrollBar(
|
|
2794
|
+
} = computeScrollBar(viewportHeight, filteredItems.length, itemHeight, nextScrollOffset, scrollBarMinHeight);
|
|
2778
2795
|
return {
|
|
2779
2796
|
...state,
|
|
2780
2797
|
filteredItems,
|
|
@@ -2782,6 +2799,7 @@ const handleClickTab = (state, name = '') => {
|
|
|
2782
2799
|
minLineY,
|
|
2783
2800
|
scrollBarThumbHeight: thumbHeight,
|
|
2784
2801
|
scrollBarThumbTop: thumbTop,
|
|
2802
|
+
scrollOffset: nextScrollOffset,
|
|
2785
2803
|
tabs: updatedTabs,
|
|
2786
2804
|
visibleItems
|
|
2787
2805
|
};
|
|
@@ -2989,6 +3007,7 @@ const handleWheel = (state, eventDeltaY, inputSource = User) => {
|
|
|
2989
3007
|
height,
|
|
2990
3008
|
itemHeight = 1
|
|
2991
3009
|
} = state;
|
|
3010
|
+
const viewportHeight = getSettingsViewportHeight(height);
|
|
2992
3011
|
const itemCount = filteredItems.length;
|
|
2993
3012
|
const stepLimit = itemCount === 0 ? 10 : Infinity;
|
|
2994
3013
|
const limitedEventDelta = Math.max(-stepLimit, Math.min(stepLimit, eventDeltaY));
|
|
@@ -2996,21 +3015,21 @@ const handleWheel = (state, eventDeltaY, inputSource = User) => {
|
|
|
2996
3015
|
// Prevent scrolling beyond the available content height. If content is smaller
|
|
2997
3016
|
// than the viewport, the maximum scroll is zero.
|
|
2998
3017
|
const totalContentHeight = itemCount * itemHeight;
|
|
2999
|
-
const maxScrollable = Math.max(0, totalContentHeight -
|
|
3018
|
+
const maxScrollable = Math.max(0, totalContentHeight - viewportHeight);
|
|
3000
3019
|
const clampedDeltaY = clamp(total, 0, maxScrollable);
|
|
3001
3020
|
const scrollOffset = clampedDeltaY;
|
|
3002
3021
|
const {
|
|
3003
3022
|
maxLineY,
|
|
3004
3023
|
minLineY,
|
|
3005
3024
|
visibleItems
|
|
3006
|
-
} = computeVisibleItems(filteredItems,
|
|
3025
|
+
} = computeVisibleItems(filteredItems, viewportHeight, scrollOffset, itemHeight);
|
|
3007
3026
|
const {
|
|
3008
3027
|
scrollBarMinHeight
|
|
3009
3028
|
} = state;
|
|
3010
3029
|
const {
|
|
3011
3030
|
thumbHeight,
|
|
3012
3031
|
thumbTop
|
|
3013
|
-
} = computeScrollBar(
|
|
3032
|
+
} = computeScrollBar(viewportHeight, filteredItems.length, itemHeight, scrollOffset, scrollBarMinHeight);
|
|
3014
3033
|
return {
|
|
3015
3034
|
...state,
|
|
3016
3035
|
deltaY: clampedDeltaY,
|
|
@@ -3193,18 +3212,21 @@ const loadContent = async (state, savedState) => {
|
|
|
3193
3212
|
height,
|
|
3194
3213
|
itemHeight
|
|
3195
3214
|
} = state;
|
|
3215
|
+
const viewportHeight = getSettingsViewportHeight(height);
|
|
3216
|
+
const maxScrollable = Math.max(0, filteredItems.length * itemHeight - viewportHeight);
|
|
3217
|
+
const nextScrollOffset = Math.min(Math.max(0, scrollOffset), maxScrollable);
|
|
3196
3218
|
const {
|
|
3197
3219
|
maxLineY,
|
|
3198
3220
|
minLineY,
|
|
3199
3221
|
visibleItems
|
|
3200
|
-
} = computeVisibleItems(filteredItems,
|
|
3222
|
+
} = computeVisibleItems(filteredItems, viewportHeight, nextScrollOffset, itemHeight);
|
|
3201
3223
|
const {
|
|
3202
3224
|
scrollBarMinHeight
|
|
3203
3225
|
} = state;
|
|
3204
3226
|
const {
|
|
3205
3227
|
thumbHeight,
|
|
3206
3228
|
thumbTop
|
|
3207
|
-
} = computeScrollBar(
|
|
3229
|
+
} = computeScrollBar(viewportHeight, filteredItems.length, itemHeight, nextScrollOffset, scrollBarMinHeight);
|
|
3208
3230
|
return {
|
|
3209
3231
|
...state,
|
|
3210
3232
|
filteredItems,
|
|
@@ -3219,7 +3241,7 @@ const loadContent = async (state, savedState) => {
|
|
|
3219
3241
|
schemaErrors,
|
|
3220
3242
|
scrollBarThumbHeight: thumbHeight,
|
|
3221
3243
|
scrollBarThumbTop: thumbTop,
|
|
3222
|
-
scrollOffset,
|
|
3244
|
+
scrollOffset: nextScrollOffset,
|
|
3223
3245
|
searchValue,
|
|
3224
3246
|
sideBarWidth,
|
|
3225
3247
|
tabs: newTabs,
|
|
@@ -3227,13 +3249,17 @@ const loadContent = async (state, savedState) => {
|
|
|
3227
3249
|
};
|
|
3228
3250
|
};
|
|
3229
3251
|
|
|
3230
|
-
const getCss = (sideBarWidth, scrollBarThumbHeight, scrollBarThumbTop) => {
|
|
3252
|
+
const getCss = (sideBarWidth, scrollBarThumbHeight, scrollBarThumbTop, itemHeight, totalItemCount, scrollOffset) => {
|
|
3231
3253
|
const rounded = Math.round(sideBarWidth);
|
|
3254
|
+
const settingsLayoutCss = typeof itemHeight === 'number' && typeof totalItemCount === 'number' && typeof scrollOffset === 'number' ? `
|
|
3255
|
+
--SettingsItemHeight: ${itemHeight}px;
|
|
3256
|
+
--SettingsItemsHeight: ${itemHeight * totalItemCount}px;
|
|
3257
|
+
--SettingsItemsTranslateY: ${-scrollOffset}px;` : '';
|
|
3232
3258
|
return `
|
|
3233
3259
|
.Settings {
|
|
3234
3260
|
--SettingsSideBarWidth: ${rounded}px;
|
|
3235
3261
|
--ScrollBarThumbHeight: ${scrollBarThumbHeight}px;
|
|
3236
|
-
--ScrollBarThumbTop: ${scrollBarThumbTop}px
|
|
3262
|
+
--ScrollBarThumbTop: ${scrollBarThumbTop}px;${settingsLayoutCss}
|
|
3237
3263
|
}
|
|
3238
3264
|
|
|
3239
3265
|
.SettingsSideBar{
|
|
@@ -3244,12 +3270,15 @@ const getCss = (sideBarWidth, scrollBarThumbHeight, scrollBarThumbTop) => {
|
|
|
3244
3270
|
|
|
3245
3271
|
const renderCss = (oldState, newState) => {
|
|
3246
3272
|
const {
|
|
3273
|
+
filteredItems,
|
|
3247
3274
|
id,
|
|
3275
|
+
itemHeight,
|
|
3248
3276
|
scrollBarThumbHeight,
|
|
3249
3277
|
scrollBarThumbTop,
|
|
3278
|
+
scrollOffset,
|
|
3250
3279
|
sideBarWidth
|
|
3251
3280
|
} = newState;
|
|
3252
|
-
const css = getCss(sideBarWidth, scrollBarThumbHeight, scrollBarThumbTop);
|
|
3281
|
+
const css = getCss(sideBarWidth, scrollBarThumbHeight, scrollBarThumbTop, itemHeight, filteredItems.length, scrollOffset);
|
|
3253
3282
|
return [SetCss, id, css];
|
|
3254
3283
|
};
|
|
3255
3284
|
|
|
@@ -3297,6 +3326,7 @@ const SettingsItem = 'SettingsItem';
|
|
|
3297
3326
|
const SettingsItemCheckBox = 'SettingsItemCheckBox';
|
|
3298
3327
|
const SettingsItemHeading = 'SettingsItemHeading';
|
|
3299
3328
|
const SettingsItems = 'SettingsItems';
|
|
3329
|
+
const SettingsItemsSpacer = 'SettingsItemsSpacer';
|
|
3300
3330
|
const SettingsItemWrapper = 'SettingsItemWrapper';
|
|
3301
3331
|
const SettingsMain = 'SettingsMain';
|
|
3302
3332
|
const SettingsNoResults = 'SettingsNoResults';
|
|
@@ -3310,6 +3340,7 @@ const SettingsSideBar = 'SettingsSideBar';
|
|
|
3310
3340
|
const SettingsTabs = 'SettingsTabs';
|
|
3311
3341
|
const Tab = 'Tab';
|
|
3312
3342
|
const TabSelected = 'TabSelected';
|
|
3343
|
+
const Toggle = 'Toggle';
|
|
3313
3344
|
|
|
3314
3345
|
const getFilteredSchemaErrors = (errors, searchValue) => {
|
|
3315
3346
|
const search = searchValue.trim().toLowerCase();
|
|
@@ -3553,12 +3584,14 @@ const getItemArrayVirtualDom = item => {
|
|
|
3553
3584
|
};
|
|
3554
3585
|
|
|
3555
3586
|
const errorCheckBoxClassName = mergeClassNames(CheckBox, InputBoxError);
|
|
3587
|
+
const errorToggleClassName = mergeClassNames(Toggle, InputBoxError);
|
|
3588
|
+
const settingUseToggles = 'settings.useToggles';
|
|
3556
3589
|
const checkBoxWrapperNode = {
|
|
3557
3590
|
childCount: 2,
|
|
3558
3591
|
className: SettingsItemCheckBox,
|
|
3559
3592
|
type: Div
|
|
3560
3593
|
};
|
|
3561
|
-
const getItemCheckBoxVirtualDom = item => {
|
|
3594
|
+
const getItemCheckBoxVirtualDom = (item, preferences = {}) => {
|
|
3562
3595
|
const {
|
|
3563
3596
|
description,
|
|
3564
3597
|
errorMessage,
|
|
@@ -3569,9 +3602,14 @@ const getItemCheckBoxVirtualDom = item => {
|
|
|
3569
3602
|
value
|
|
3570
3603
|
} = item;
|
|
3571
3604
|
const domId = getInputId(id);
|
|
3572
|
-
const
|
|
3605
|
+
const useToggles = preferences[settingUseToggles] !== false && preferences[settingUseToggles] !== 'false';
|
|
3606
|
+
let checkBoxClassName = useToggles ? Toggle : CheckBox;
|
|
3607
|
+
if (hasError) {
|
|
3608
|
+
checkBoxClassName = useToggles ? errorToggleClassName : errorCheckBoxClassName;
|
|
3609
|
+
}
|
|
3573
3610
|
const errorChildCount = hasError ? 1 : 0;
|
|
3574
|
-
const
|
|
3611
|
+
const currentValue = preferences[id] ?? value;
|
|
3612
|
+
const isChecked = currentValue === true || currentValue === 'true';
|
|
3575
3613
|
return [{
|
|
3576
3614
|
childCount: 2 + errorChildCount,
|
|
3577
3615
|
className: SettingsItem,
|
|
@@ -3819,12 +3857,12 @@ const getItemRender = type => {
|
|
|
3819
3857
|
}
|
|
3820
3858
|
};
|
|
3821
3859
|
|
|
3822
|
-
const getItemVirtualDom = item => {
|
|
3860
|
+
const getItemVirtualDom = (item, preferences) => {
|
|
3823
3861
|
const fn = getItemRender(item.type);
|
|
3824
|
-
return fn(item);
|
|
3862
|
+
return fn(item, preferences);
|
|
3825
3863
|
};
|
|
3826
3864
|
|
|
3827
|
-
const settingsItemsNode = {
|
|
3865
|
+
const settingsItemsNode$1 = {
|
|
3828
3866
|
childCount: 1,
|
|
3829
3867
|
className: SettingsItems,
|
|
3830
3868
|
onContextMenu: HandleContextMenu,
|
|
@@ -3836,19 +3874,47 @@ const noResultsNode = {
|
|
|
3836
3874
|
type: P
|
|
3837
3875
|
};
|
|
3838
3876
|
const getSettingsNoResultsDom = searchValue => {
|
|
3839
|
-
return [settingsItemsNode, noResultsNode, text(noSettingsMatching(searchValue))];
|
|
3877
|
+
return [settingsItemsNode$1, noResultsNode, text(noSettingsMatching(searchValue))];
|
|
3840
3878
|
};
|
|
3841
3879
|
|
|
3842
|
-
const
|
|
3880
|
+
const getSpacerDom = height => {
|
|
3881
|
+
return [{
|
|
3882
|
+
childCount: 0,
|
|
3883
|
+
className: SettingsItemsSpacer,
|
|
3884
|
+
height: `${height}px;`,
|
|
3885
|
+
type: Div
|
|
3886
|
+
}];
|
|
3887
|
+
};
|
|
3888
|
+
|
|
3889
|
+
const settingsItemsNode = {
|
|
3890
|
+
childCount: 0,
|
|
3891
|
+
className: SettingsItems,
|
|
3892
|
+
onContextMenu: HandleContextMenu,
|
|
3893
|
+
type: Div
|
|
3894
|
+
};
|
|
3895
|
+
const getSettingsItemsChildren = (items, preferences, topSpacerHeight, bottomSpacerHeight) => {
|
|
3896
|
+
const children = items.flatMap(item => getItemVirtualDom(item, preferences));
|
|
3897
|
+
if (topSpacerHeight !== 0) {
|
|
3898
|
+
children.unshift(...getSpacerDom(topSpacerHeight));
|
|
3899
|
+
}
|
|
3900
|
+
if (bottomSpacerHeight !== 0) {
|
|
3901
|
+
children.push(...getSpacerDom(bottomSpacerHeight));
|
|
3902
|
+
}
|
|
3903
|
+
return children;
|
|
3904
|
+
};
|
|
3905
|
+
const getSettingsItemsDom = (items, searchValue, preferences = {}, topSpacerHeight = 0, bottomSpacerHeight = 0) => {
|
|
3843
3906
|
if (items.length === 0 && searchValue && searchValue.trim()) {
|
|
3844
3907
|
return getSettingsNoResultsDom(searchValue);
|
|
3845
3908
|
}
|
|
3909
|
+
if (items.length === 0) {
|
|
3910
|
+
return [settingsItemsNode];
|
|
3911
|
+
}
|
|
3912
|
+
const hasVirtualSpacers = topSpacerHeight !== 0 || bottomSpacerHeight !== 0;
|
|
3913
|
+
const childCount = items.length + (hasVirtualSpacers ? 2 : 0);
|
|
3846
3914
|
return [{
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
type: Div
|
|
3851
|
-
}, ...items.flatMap(getItemVirtualDom)];
|
|
3915
|
+
...settingsItemsNode,
|
|
3916
|
+
childCount
|
|
3917
|
+
}, ...getSettingsItemsChildren(items, preferences, topSpacerHeight, bottomSpacerHeight)];
|
|
3852
3918
|
};
|
|
3853
3919
|
|
|
3854
3920
|
const settingsContentNode = {
|
|
@@ -3862,10 +3928,10 @@ const settingsItemWrapperNode = {
|
|
|
3862
3928
|
className: SettingsItemWrapper,
|
|
3863
3929
|
type: Div
|
|
3864
3930
|
};
|
|
3865
|
-
const getSettingsContentDom = (visibleItems, tabs, searchValue, showScrollBar, schemaErrors = []) => {
|
|
3931
|
+
const getSettingsContentDom = (visibleItems, tabs, searchValue, showScrollBar, schemaErrors = [], preferences = {}, topSpacerHeight = 0, bottomSpacerHeight = 0) => {
|
|
3866
3932
|
const selectedTab = tabs.find(tab => tab.selected);
|
|
3867
3933
|
const headerText = selectedTab ? selectedTab.label : settingsContent();
|
|
3868
|
-
return [settingsContentNode, ...getContentHeadingDom(headerText), settingsItemWrapperNode, ...(selectedTab?.id === SchemaErrorsTab ? getSchemaErrorsDom(schemaErrors) : getSettingsItemsDom(visibleItems, searchValue)), ...getScrollBarDom(showScrollBar)];
|
|
3934
|
+
return [settingsContentNode, ...getContentHeadingDom(headerText), settingsItemWrapperNode, ...(selectedTab?.id === SchemaErrorsTab ? getSchemaErrorsDom(schemaErrors) : getSettingsItemsDom(visibleItems, searchValue, preferences, topSpacerHeight, bottomSpacerHeight)), ...getScrollBarDom(showScrollBar)];
|
|
3869
3935
|
};
|
|
3870
3936
|
|
|
3871
3937
|
const selectedTabClassName = mergeClassNames(Tab, TabSelected);
|
|
@@ -3910,10 +3976,11 @@ const settingsMainNode = {
|
|
|
3910
3976
|
className: SettingsMain,
|
|
3911
3977
|
type: Div
|
|
3912
3978
|
};
|
|
3913
|
-
const getSettingsMainDom = (tabs, visibleItems, totalItemCount, searchValue, height, itemHeight, schemaErrors = []) => {
|
|
3979
|
+
const getSettingsMainDom = (tabs, visibleItems, totalItemCount, searchValue, height, itemHeight, minLineY, maxLineY, schemaErrors = [], preferences = {}) => {
|
|
3980
|
+
const viewportHeight = getSettingsViewportHeight(height);
|
|
3914
3981
|
const totalHeight = totalItemCount * itemHeight;
|
|
3915
|
-
const showScrollBar = totalHeight >
|
|
3916
|
-
return [settingsMainNode, ...getSettingsSideBarDom(tabs), ...getResizerVirtualDom(), ...getSettingsContentDom(visibleItems, tabs, searchValue, showScrollBar, schemaErrors)];
|
|
3982
|
+
const showScrollBar = totalHeight > viewportHeight;
|
|
3983
|
+
return [settingsMainNode, ...getSettingsSideBarDom(tabs), ...getResizerVirtualDom(), ...getSettingsContentDom(visibleItems, tabs, searchValue, showScrollBar, schemaErrors, preferences, minLineY * itemHeight, Math.max(0, totalHeight - maxLineY * itemHeight))];
|
|
3917
3984
|
};
|
|
3918
3985
|
|
|
3919
3986
|
const parentNode = {
|
|
@@ -3932,6 +3999,7 @@ const getSettingsDom = state => {
|
|
|
3932
3999
|
filteredItems,
|
|
3933
4000
|
height,
|
|
3934
4001
|
itemHeight,
|
|
4002
|
+
preferences,
|
|
3935
4003
|
schemaErrors = [],
|
|
3936
4004
|
searchValue,
|
|
3937
4005
|
tabs,
|
|
@@ -3941,7 +4009,11 @@ const getSettingsDom = state => {
|
|
|
3941
4009
|
const hasSearchValue = searchValue.trim().length > 0;
|
|
3942
4010
|
const filteredSchemaErrors = getFilteredSchemaErrors(schemaErrors, searchValue);
|
|
3943
4011
|
const filteredItemsCount = getFilteredItemsCount(isSchemaErrorsTab, filteredSchemaErrors.length, filteredItems.length);
|
|
3944
|
-
const
|
|
4012
|
+
const {
|
|
4013
|
+
maxLineY,
|
|
4014
|
+
minLineY
|
|
4015
|
+
} = state;
|
|
4016
|
+
const mainDom = getSettingsMainDom(tabs, visibleItems, filteredItemsCount, searchValue, height, itemHeight, minLineY, maxLineY, filteredSchemaErrors, preferences);
|
|
3945
4017
|
return [parentNode, ...getSettingsHeaderDom(filteredItemsCount, hasSearchValue), ...mainDom];
|
|
3946
4018
|
};
|
|
3947
4019
|
|
|
@@ -4053,7 +4125,7 @@ const renderEventListeners = () => {
|
|
|
4053
4125
|
params: ['handleSettingInput', TargetName, TargetValue]
|
|
4054
4126
|
}, {
|
|
4055
4127
|
name: HandleSettingChecked,
|
|
4056
|
-
params: ['handleSettingChecked', TargetName,
|
|
4128
|
+
params: ['handleSettingChecked', TargetName, TargetChecked]
|
|
4057
4129
|
},
|
|
4058
4130
|
// {
|
|
4059
4131
|
// name: DomEventListenerFunctions.HandleScroll,
|