@lvce-editor/output-view 2.23.0 → 2.24.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/outputViewWorkerMain.js +287 -20
- package/package.json +1 -1
|
@@ -1442,6 +1442,10 @@ const Error$1 = 'Error';
|
|
|
1442
1442
|
const Line = 'Line';
|
|
1443
1443
|
const OutputRepeatCount = 'OutputRepeatCount';
|
|
1444
1444
|
const OutputSourceLink = 'OutputSourceLink';
|
|
1445
|
+
const ScrollBar = 'ScrollBar';
|
|
1446
|
+
const ScrollBarSmall = 'ScrollBarSmall';
|
|
1447
|
+
const ScrollBarThumb = 'ScrollBarThumb';
|
|
1448
|
+
const ScrollBarThumbActive = 'ScrollBarThumbActive';
|
|
1445
1449
|
|
|
1446
1450
|
const RE_URL = /(?:https?:\/\/|file:\/\/|lvce(?:-oss)?:\/\/)\S+/;
|
|
1447
1451
|
const trailingPunctuation = '!),.;?]}';
|
|
@@ -1659,14 +1663,18 @@ const create = (id, uri, x, y, width, height, platform, parentId) => {
|
|
|
1659
1663
|
const state = {
|
|
1660
1664
|
buttons: [],
|
|
1661
1665
|
collapsedUris: [],
|
|
1666
|
+
deltaY: 0,
|
|
1662
1667
|
error: '',
|
|
1663
1668
|
errorCode: 0,
|
|
1664
1669
|
filteredItems: [],
|
|
1665
1670
|
filterValue: '',
|
|
1671
|
+
finalDeltaY: 0,
|
|
1666
1672
|
focusedIndex: -2,
|
|
1673
|
+
followOutput: true,
|
|
1674
|
+
handleOffset: 0,
|
|
1667
1675
|
height,
|
|
1668
1676
|
inputSource: User,
|
|
1669
|
-
itemHeight:
|
|
1677
|
+
itemHeight: 18,
|
|
1670
1678
|
listItems: [],
|
|
1671
1679
|
logLevel: 0,
|
|
1672
1680
|
maxLineY: 0,
|
|
@@ -1675,6 +1683,8 @@ const create = (id, uri, x, y, width, height, platform, parentId) => {
|
|
|
1675
1683
|
options: [],
|
|
1676
1684
|
parentId,
|
|
1677
1685
|
platform,
|
|
1686
|
+
scrollBarActive: false,
|
|
1687
|
+
scrollBarHeight: 0,
|
|
1678
1688
|
scrollLockEnabled: false,
|
|
1679
1689
|
selectedOption: '',
|
|
1680
1690
|
smallWidthBreakPoint: 650,
|
|
@@ -1694,19 +1704,20 @@ const isEqual$2 = (oldState, newState) => {
|
|
|
1694
1704
|
};
|
|
1695
1705
|
|
|
1696
1706
|
const isEqual$1 = (oldState, newState) => {
|
|
1697
|
-
return oldState.selectedOption === newState.selectedOption && oldState.listItems === newState.listItems && oldState.filteredItems === newState.filteredItems;
|
|
1707
|
+
return oldState.deltaY === newState.deltaY && oldState.height === newState.height && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.scrollBarHeight === newState.scrollBarHeight && oldState.scrollBarActive === newState.scrollBarActive && oldState.error === newState.error && oldState.errorCode === newState.errorCode && oldState.selectedOption === newState.selectedOption && oldState.listItems === newState.listItems && oldState.filteredItems === newState.filteredItems;
|
|
1698
1708
|
};
|
|
1699
1709
|
|
|
1700
1710
|
const isEqual = (oldState, newState) => {
|
|
1701
1711
|
return oldState.selectedOption === newState.selectedOption;
|
|
1702
1712
|
};
|
|
1703
1713
|
|
|
1714
|
+
const RenderCss = 4;
|
|
1704
1715
|
const RenderItems = 1;
|
|
1705
1716
|
const RenderFilterValue = 2;
|
|
1706
1717
|
const RenderSelectedItem = 3;
|
|
1707
1718
|
|
|
1708
|
-
const modules = [isEqual$1, isEqual$2, isEqual];
|
|
1709
|
-
const numbers = [RenderItems, RenderFilterValue, RenderSelectedItem];
|
|
1719
|
+
const modules = [isEqual$1, isEqual$1, isEqual$2, isEqual];
|
|
1720
|
+
const numbers = [RenderCss, RenderItems, RenderFilterValue, RenderSelectedItem];
|
|
1710
1721
|
|
|
1711
1722
|
const diff = (oldState, newState) => {
|
|
1712
1723
|
const diffResult = [];
|
|
@@ -1719,12 +1730,46 @@ const diff = (oldState, newState) => {
|
|
|
1719
1730
|
return diffResult;
|
|
1720
1731
|
};
|
|
1721
1732
|
|
|
1733
|
+
const updateVirtualList = (state, requestedDeltaY) => {
|
|
1734
|
+
const {
|
|
1735
|
+
deltaY: currentDeltaY,
|
|
1736
|
+
filteredItems,
|
|
1737
|
+
followOutput,
|
|
1738
|
+
height,
|
|
1739
|
+
itemHeight,
|
|
1740
|
+
scrollLockEnabled
|
|
1741
|
+
} = state;
|
|
1742
|
+
const listHeight = Math.max(0, height);
|
|
1743
|
+
const contentHeight = filteredItems.length * itemHeight;
|
|
1744
|
+
const finalDeltaY = Math.max(0, contentHeight - listHeight);
|
|
1745
|
+
const requested = requestedDeltaY ?? (followOutput && !scrollLockEnabled ? finalDeltaY : currentDeltaY);
|
|
1746
|
+
const deltaY = Math.max(0, Math.min(Number.isFinite(requested) ? requested : 0, finalDeltaY));
|
|
1747
|
+
const minLineY = itemHeight > 0 ? Math.floor(deltaY / itemHeight) : 0;
|
|
1748
|
+
const maxLineY = itemHeight > 0 && listHeight > 0 ? Math.min(filteredItems.length, Math.ceil((deltaY + listHeight) / itemHeight)) : minLineY;
|
|
1749
|
+
const scrollBarHeight = finalDeltaY > 0 && listHeight > 0 ? Math.min(listHeight, Math.max(20, listHeight ** 2 / contentHeight)) : 0;
|
|
1750
|
+
return {
|
|
1751
|
+
...state,
|
|
1752
|
+
deltaY,
|
|
1753
|
+
finalDeltaY,
|
|
1754
|
+
maxLineY,
|
|
1755
|
+
minLineY,
|
|
1756
|
+
scrollBarHeight
|
|
1757
|
+
};
|
|
1758
|
+
};
|
|
1759
|
+
|
|
1722
1760
|
const diff2 = uid => {
|
|
1723
1761
|
const {
|
|
1724
1762
|
newState,
|
|
1725
1763
|
oldState
|
|
1726
1764
|
} = get(uid);
|
|
1727
|
-
const
|
|
1765
|
+
const reset = oldState.selectedOption !== newState.selectedOption || oldState.filterValue !== newState.filterValue;
|
|
1766
|
+
const updatedState = updateVirtualList(reset ? {
|
|
1767
|
+
...newState,
|
|
1768
|
+
deltaY: 0,
|
|
1769
|
+
followOutput: true
|
|
1770
|
+
} : newState);
|
|
1771
|
+
set$1(uid, oldState, updatedState);
|
|
1772
|
+
const diffResult = diff(oldState, updatedState);
|
|
1728
1773
|
return diffResult;
|
|
1729
1774
|
};
|
|
1730
1775
|
|
|
@@ -1737,6 +1782,7 @@ const disableScrollLock = async state => {
|
|
|
1737
1782
|
}
|
|
1738
1783
|
return {
|
|
1739
1784
|
...state,
|
|
1785
|
+
followOutput: true,
|
|
1740
1786
|
scrollLockEnabled: false
|
|
1741
1787
|
};
|
|
1742
1788
|
};
|
|
@@ -1881,6 +1927,39 @@ const handleFilterInput = async (state, value, inputSource = User) => {
|
|
|
1881
1927
|
};
|
|
1882
1928
|
};
|
|
1883
1929
|
|
|
1930
|
+
const setDeltaY = (state, deltaY) => {
|
|
1931
|
+
const newState = updateVirtualList(state, deltaY);
|
|
1932
|
+
return {
|
|
1933
|
+
...newState,
|
|
1934
|
+
followOutput: newState.deltaY === newState.finalDeltaY
|
|
1935
|
+
};
|
|
1936
|
+
};
|
|
1937
|
+
|
|
1938
|
+
const handleKeyDown = (state, key) => {
|
|
1939
|
+
const {
|
|
1940
|
+
deltaY,
|
|
1941
|
+
finalDeltaY,
|
|
1942
|
+
height,
|
|
1943
|
+
itemHeight
|
|
1944
|
+
} = state;
|
|
1945
|
+
switch (key) {
|
|
1946
|
+
case 'ArrowDown':
|
|
1947
|
+
return setDeltaY(state, deltaY + itemHeight);
|
|
1948
|
+
case 'ArrowUp':
|
|
1949
|
+
return setDeltaY(state, deltaY - itemHeight);
|
|
1950
|
+
case 'End':
|
|
1951
|
+
return setDeltaY(state, finalDeltaY);
|
|
1952
|
+
case 'Home':
|
|
1953
|
+
return setDeltaY(state, 0);
|
|
1954
|
+
case 'PageDown':
|
|
1955
|
+
return setDeltaY(state, deltaY + height);
|
|
1956
|
+
case 'PageUp':
|
|
1957
|
+
return setDeltaY(state, deltaY - height);
|
|
1958
|
+
default:
|
|
1959
|
+
return state;
|
|
1960
|
+
}
|
|
1961
|
+
};
|
|
1962
|
+
|
|
1884
1963
|
const state = {
|
|
1885
1964
|
connected: false
|
|
1886
1965
|
};
|
|
@@ -1918,6 +1997,69 @@ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess =
|
|
|
1918
1997
|
}
|
|
1919
1998
|
};
|
|
1920
1999
|
|
|
2000
|
+
const handleScrollBarCaptureLost = state => {
|
|
2001
|
+
return {
|
|
2002
|
+
...state,
|
|
2003
|
+
scrollBarActive: false
|
|
2004
|
+
};
|
|
2005
|
+
};
|
|
2006
|
+
|
|
2007
|
+
const getScrollBarTop = state => {
|
|
2008
|
+
const {
|
|
2009
|
+
deltaY,
|
|
2010
|
+
finalDeltaY,
|
|
2011
|
+
height,
|
|
2012
|
+
scrollBarHeight
|
|
2013
|
+
} = state;
|
|
2014
|
+
return finalDeltaY > 0 ? deltaY / finalDeltaY * (height - scrollBarHeight) : 0;
|
|
2015
|
+
};
|
|
2016
|
+
|
|
2017
|
+
const handleScrollBarClick = (state, eventY) => {
|
|
2018
|
+
const {
|
|
2019
|
+
finalDeltaY,
|
|
2020
|
+
height,
|
|
2021
|
+
scrollBarHeight,
|
|
2022
|
+
y
|
|
2023
|
+
} = state;
|
|
2024
|
+
if (scrollBarHeight <= 0) {
|
|
2025
|
+
return state;
|
|
2026
|
+
}
|
|
2027
|
+
const relativeY = eventY - y;
|
|
2028
|
+
const offset = relativeY - getScrollBarTop(state);
|
|
2029
|
+
if (offset >= 0 && offset < scrollBarHeight) {
|
|
2030
|
+
return {
|
|
2031
|
+
...state,
|
|
2032
|
+
handleOffset: offset,
|
|
2033
|
+
scrollBarActive: true
|
|
2034
|
+
};
|
|
2035
|
+
}
|
|
2036
|
+
const handleOffset = scrollBarHeight / 2;
|
|
2037
|
+
const trackHeight = height - scrollBarHeight;
|
|
2038
|
+
const deltaY = trackHeight > 0 ? (relativeY - handleOffset) / trackHeight * finalDeltaY : 0;
|
|
2039
|
+
return {
|
|
2040
|
+
...setDeltaY(state, deltaY),
|
|
2041
|
+
handleOffset,
|
|
2042
|
+
scrollBarActive: true
|
|
2043
|
+
};
|
|
2044
|
+
};
|
|
2045
|
+
|
|
2046
|
+
const handleScrollBarMove = (state, eventY) => {
|
|
2047
|
+
const {
|
|
2048
|
+
finalDeltaY,
|
|
2049
|
+
handleOffset,
|
|
2050
|
+
height,
|
|
2051
|
+
scrollBarActive,
|
|
2052
|
+
scrollBarHeight,
|
|
2053
|
+
y
|
|
2054
|
+
} = state;
|
|
2055
|
+
if (!scrollBarActive) {
|
|
2056
|
+
return state;
|
|
2057
|
+
}
|
|
2058
|
+
const trackHeight = height - scrollBarHeight;
|
|
2059
|
+
const deltaY = trackHeight > 0 ? (eventY - y - handleOffset) / trackHeight * finalDeltaY : 0;
|
|
2060
|
+
return setDeltaY(state, deltaY);
|
|
2061
|
+
};
|
|
2062
|
+
|
|
1921
2063
|
const createWatchId = () => {
|
|
1922
2064
|
const watchId = Math.random();
|
|
1923
2065
|
return watchId;
|
|
@@ -2016,6 +2158,21 @@ const handleSourceLinkClick = async (state, uri, lineNumber, columnNumber) => {
|
|
|
2016
2158
|
return state;
|
|
2017
2159
|
};
|
|
2018
2160
|
|
|
2161
|
+
const handleWheel = (state, deltaMode, deltaY) => {
|
|
2162
|
+
const {
|
|
2163
|
+
deltaY: currentDeltaY,
|
|
2164
|
+
height,
|
|
2165
|
+
itemHeight
|
|
2166
|
+
} = state;
|
|
2167
|
+
let multiplier = 1;
|
|
2168
|
+
if (deltaMode === 1) {
|
|
2169
|
+
multiplier = itemHeight;
|
|
2170
|
+
} else if (deltaMode === 2) {
|
|
2171
|
+
multiplier = height;
|
|
2172
|
+
}
|
|
2173
|
+
return setDeltaY(state, currentDeltaY + deltaY * multiplier);
|
|
2174
|
+
};
|
|
2175
|
+
|
|
2019
2176
|
const createExtensionManagementWorkerRpc = async () => {
|
|
2020
2177
|
const rpc = await create$4({
|
|
2021
2178
|
commandMap: {},
|
|
@@ -2117,6 +2274,20 @@ const loadButtons = () => {
|
|
|
2117
2274
|
}];
|
|
2118
2275
|
};
|
|
2119
2276
|
|
|
2277
|
+
const getExtensionDetailOptions = async () => {
|
|
2278
|
+
const uri = 'memfs:///extension-detail-output.txt';
|
|
2279
|
+
try {
|
|
2280
|
+
await readFile(uri);
|
|
2281
|
+
return [{
|
|
2282
|
+
id: 'ExtensionDetail',
|
|
2283
|
+
label: 'Extension Detail',
|
|
2284
|
+
uri
|
|
2285
|
+
}];
|
|
2286
|
+
} catch {
|
|
2287
|
+
return [];
|
|
2288
|
+
}
|
|
2289
|
+
};
|
|
2290
|
+
|
|
2120
2291
|
const error = error => {
|
|
2121
2292
|
console.error(error);
|
|
2122
2293
|
};
|
|
@@ -2170,8 +2341,9 @@ const getWindowLogUri = async logsFolderUri => {
|
|
|
2170
2341
|
|
|
2171
2342
|
const loadOptions = async platform => {
|
|
2172
2343
|
const extensionOptions = await getExtensionOptions();
|
|
2344
|
+
const detailOptions = await getExtensionDetailOptions();
|
|
2173
2345
|
if (platform === Web) {
|
|
2174
|
-
return extensionOptions;
|
|
2346
|
+
return [...detailOptions, ...extensionOptions];
|
|
2175
2347
|
}
|
|
2176
2348
|
const logsFolderUri = await getLogsDir();
|
|
2177
2349
|
const windowLogUri = platform === Electron ? await getWindowLogUri(logsFolderUri) : `${logsFolderUri}/log-window.txt`;
|
|
@@ -2187,7 +2359,7 @@ const loadOptions = async platform => {
|
|
|
2187
2359
|
id: Window,
|
|
2188
2360
|
label: 'Window',
|
|
2189
2361
|
uri: windowLogUri
|
|
2190
|
-
}, ...extensionOptions];
|
|
2362
|
+
}, ...detailOptions, ...extensionOptions];
|
|
2191
2363
|
};
|
|
2192
2364
|
|
|
2193
2365
|
const getSavedFilterValue = savedState => {
|
|
@@ -2234,6 +2406,7 @@ const getMatchingOpen = (options, id) => {
|
|
|
2234
2406
|
const loadContent = async (state, savedState) => {
|
|
2235
2407
|
const {
|
|
2236
2408
|
platform,
|
|
2409
|
+
uri: requestedChannel,
|
|
2237
2410
|
watchId
|
|
2238
2411
|
} = state;
|
|
2239
2412
|
const collapsedUris = getSavedCollapsedUris(savedState);
|
|
@@ -2242,7 +2415,7 @@ const loadContent = async (state, savedState) => {
|
|
|
2242
2415
|
scrollLockEnabled,
|
|
2243
2416
|
selectedOption
|
|
2244
2417
|
} = restoreState(savedState);
|
|
2245
|
-
const selectedId = getSelectedItem(selectedOption, platform);
|
|
2418
|
+
const selectedId = getSelectedItem(requestedChannel || selectedOption, platform);
|
|
2246
2419
|
const options = await loadOptions(platform);
|
|
2247
2420
|
const option = getMatchingOpen(options, selectedId);
|
|
2248
2421
|
if (!option) {
|
|
@@ -2272,7 +2445,7 @@ const loadContent = async (state, savedState) => {
|
|
|
2272
2445
|
listItems: lines,
|
|
2273
2446
|
options,
|
|
2274
2447
|
scrollLockEnabled,
|
|
2275
|
-
selectedOption:
|
|
2448
|
+
selectedOption: option.id,
|
|
2276
2449
|
watchId: newWatchId
|
|
2277
2450
|
};
|
|
2278
2451
|
};
|
|
@@ -2313,6 +2486,43 @@ const refresh = async state => {
|
|
|
2313
2486
|
};
|
|
2314
2487
|
};
|
|
2315
2488
|
|
|
2489
|
+
const renderCss = (oldState, newState) => {
|
|
2490
|
+
const {
|
|
2491
|
+
deltaY,
|
|
2492
|
+
itemHeight,
|
|
2493
|
+
minLineY,
|
|
2494
|
+
scrollBarHeight,
|
|
2495
|
+
uid
|
|
2496
|
+
} = newState;
|
|
2497
|
+
const offset = minLineY * itemHeight - deltaY;
|
|
2498
|
+
const css = `.Output {
|
|
2499
|
+
position: relative;
|
|
2500
|
+
overflow: hidden;
|
|
2501
|
+
}
|
|
2502
|
+
.OutputContent {
|
|
2503
|
+
overflow-x: auto;
|
|
2504
|
+
overflow-y: hidden;
|
|
2505
|
+
scrollbar-width: none;
|
|
2506
|
+
padding-right: ${scrollBarHeight > 0 ? 14 : 0}px;
|
|
2507
|
+
}
|
|
2508
|
+
.OutputContent::-webkit-scrollbar {
|
|
2509
|
+
display: none;
|
|
2510
|
+
}
|
|
2511
|
+
.Output .Line {
|
|
2512
|
+
height: ${itemHeight}px;
|
|
2513
|
+
min-height: ${itemHeight}px;
|
|
2514
|
+
line-height: ${itemHeight}px;
|
|
2515
|
+
}
|
|
2516
|
+
.Output .Line:first-child {
|
|
2517
|
+
margin-top: ${offset}px;
|
|
2518
|
+
}
|
|
2519
|
+
.Output .ScrollBarThumb {
|
|
2520
|
+
height: ${scrollBarHeight}px;
|
|
2521
|
+
translate: 0 ${getScrollBarTop(newState)}px;
|
|
2522
|
+
}`;
|
|
2523
|
+
return ['Viewlet.setCss', uid, css];
|
|
2524
|
+
};
|
|
2525
|
+
|
|
2316
2526
|
const renderFilterValue = (oldState, newState) => {
|
|
2317
2527
|
return ['Viewlet.setValueByName', newState.uid, Filter$1, newState.filterValue];
|
|
2318
2528
|
};
|
|
@@ -2325,6 +2535,11 @@ const HandlePointerDown = 'handlePointerDown';
|
|
|
2325
2535
|
const HandleSelect = 'handleSelect';
|
|
2326
2536
|
const HandleButtonClick = 'handleButtonClick';
|
|
2327
2537
|
const HandleSourceLinkClick = 'handleSourceLinkClick';
|
|
2538
|
+
const HandleWheel = 'handleWheel';
|
|
2539
|
+
const HandleKeyDown = 'handleKeyDown';
|
|
2540
|
+
const HandleScrollBarPointerDown = 'handleScrollBarPointerDown';
|
|
2541
|
+
const HandleScrollBarMove = 'handleScrollBarMove';
|
|
2542
|
+
const HandleScrollBarPointerCaptureLost = 'handleScrollBarPointerCaptureLost';
|
|
2328
2543
|
|
|
2329
2544
|
const noNodes = [];
|
|
2330
2545
|
const repeatCountNode = {
|
|
@@ -2409,6 +2624,8 @@ const getContentDom = (lines, error) => {
|
|
|
2409
2624
|
return [{
|
|
2410
2625
|
childCount: lines.length,
|
|
2411
2626
|
className: OutputContent,
|
|
2627
|
+
onKeyDown: HandleKeyDown,
|
|
2628
|
+
onWheel: HandleWheel,
|
|
2412
2629
|
role: Log,
|
|
2413
2630
|
tabIndex: Focusable,
|
|
2414
2631
|
type: Div
|
|
@@ -2443,17 +2660,38 @@ const getErrorDom = (errorCode, error) => {
|
|
|
2443
2660
|
return [errorNode, text(error)];
|
|
2444
2661
|
};
|
|
2445
2662
|
|
|
2663
|
+
const scrollBarNode = {
|
|
2664
|
+
childCount: 1,
|
|
2665
|
+
className: mergeClassNames(ScrollBar, ScrollBarSmall),
|
|
2666
|
+
onPointerDown: HandleScrollBarPointerDown,
|
|
2667
|
+
type: Div
|
|
2668
|
+
};
|
|
2669
|
+
const getScrollBarVirtualDom = (scrollBarHeight, scrollBarActive) => {
|
|
2670
|
+
if (scrollBarHeight <= 0) {
|
|
2671
|
+
return [];
|
|
2672
|
+
}
|
|
2673
|
+
return [scrollBarNode, {
|
|
2674
|
+
childCount: 0,
|
|
2675
|
+
className: mergeClassNames(ScrollBarThumb, scrollBarActive ? ScrollBarThumbActive : ''),
|
|
2676
|
+
type: Div
|
|
2677
|
+
}];
|
|
2678
|
+
};
|
|
2679
|
+
|
|
2446
2680
|
const outputNode = {
|
|
2447
2681
|
childCount: 1,
|
|
2448
2682
|
className: mergeClassNames(Viewlet, Output$1),
|
|
2449
2683
|
type: Div
|
|
2450
2684
|
};
|
|
2451
|
-
const getOutputVirtualDom = (lines, errorCode, error) => {
|
|
2452
|
-
|
|
2685
|
+
const getOutputVirtualDom = (lines, errorCode, error, scrollBarHeight = 0, scrollBarActive = false) => {
|
|
2686
|
+
const scrollBarDom = error ? [] : getScrollBarVirtualDom(scrollBarHeight, scrollBarActive);
|
|
2687
|
+
return [{
|
|
2688
|
+
...outputNode,
|
|
2689
|
+
childCount: scrollBarDom.length > 0 ? 2 : 1
|
|
2690
|
+
}, ...getContentDom(lines, error), ...getErrorDom(errorCode, error), ...scrollBarDom];
|
|
2453
2691
|
};
|
|
2454
2692
|
|
|
2455
2693
|
const renderItems = (oldState, newState) => {
|
|
2456
|
-
const dom = getOutputVirtualDom(newState.filteredItems, newState.errorCode, newState.error);
|
|
2694
|
+
const dom = getOutputVirtualDom(newState.filteredItems.slice(newState.minLineY, newState.maxLineY), newState.errorCode, newState.error, newState.scrollBarHeight, newState.scrollBarActive);
|
|
2457
2695
|
return ['Viewlet.setDom2', newState.uid, dom];
|
|
2458
2696
|
};
|
|
2459
2697
|
|
|
@@ -2465,6 +2703,8 @@ const renderSelectedItem = (oldState, newState) => {
|
|
|
2465
2703
|
|
|
2466
2704
|
const getRenderer = diffType => {
|
|
2467
2705
|
switch (diffType) {
|
|
2706
|
+
case RenderCss:
|
|
2707
|
+
return renderCss;
|
|
2468
2708
|
case RenderFilterValue:
|
|
2469
2709
|
return renderFilterValue;
|
|
2470
2710
|
case RenderItems:
|
|
@@ -2544,7 +2784,7 @@ const getFilterVirtualDom = () => {
|
|
|
2544
2784
|
}];
|
|
2545
2785
|
};
|
|
2546
2786
|
|
|
2547
|
-
const getOptionVirtualDom = option => {
|
|
2787
|
+
const getOptionVirtualDom = (option, selected = false) => {
|
|
2548
2788
|
const {
|
|
2549
2789
|
id,
|
|
2550
2790
|
label
|
|
@@ -2552,19 +2792,20 @@ const getOptionVirtualDom = option => {
|
|
|
2552
2792
|
return [{
|
|
2553
2793
|
childCount: 1,
|
|
2554
2794
|
className: Option,
|
|
2795
|
+
selected,
|
|
2555
2796
|
type: Option$1,
|
|
2556
2797
|
value: id
|
|
2557
2798
|
}, text(label)];
|
|
2558
2799
|
};
|
|
2559
2800
|
|
|
2560
|
-
const getSelectVirtualDom = options => {
|
|
2801
|
+
const getSelectVirtualDom = (options, selectedOption = '') => {
|
|
2561
2802
|
return [{
|
|
2562
2803
|
childCount: options.length,
|
|
2563
2804
|
className: Select,
|
|
2564
2805
|
name: Output,
|
|
2565
2806
|
onChange: HandleSelect,
|
|
2566
2807
|
type: Select$1
|
|
2567
|
-
}, ...options.flatMap(getOptionVirtualDom)];
|
|
2808
|
+
}, ...options.flatMap(option => getOptionVirtualDom(option, option.id === selectedOption))];
|
|
2568
2809
|
};
|
|
2569
2810
|
|
|
2570
2811
|
const getChildCount = buttonsLength => {
|
|
@@ -2572,27 +2813,47 @@ const getChildCount = buttonsLength => {
|
|
|
2572
2813
|
const filterCount = 1;
|
|
2573
2814
|
return buttonsLength + filterCount + selectLength;
|
|
2574
2815
|
};
|
|
2575
|
-
const getActionsVirtualDom = (options, buttons) => {
|
|
2816
|
+
const getActionsVirtualDom = (options, buttons, selectedOption = '') => {
|
|
2576
2817
|
const childCount = getChildCount(buttons.length);
|
|
2577
2818
|
return [{
|
|
2578
2819
|
childCount,
|
|
2579
2820
|
className: Actions,
|
|
2580
2821
|
role: ToolBar,
|
|
2581
2822
|
type: Div
|
|
2582
|
-
}, ...getFilterVirtualDom(), ...getSelectVirtualDom(options), ...getActionButtonsVirtualDom(buttons)];
|
|
2823
|
+
}, ...getFilterVirtualDom(), ...getSelectVirtualDom(options, selectedOption), ...getActionButtonsVirtualDom(buttons)];
|
|
2583
2824
|
};
|
|
2584
2825
|
|
|
2585
2826
|
const renderActions = state => {
|
|
2586
2827
|
const {
|
|
2587
2828
|
buttons,
|
|
2588
|
-
options
|
|
2829
|
+
options,
|
|
2830
|
+
selectedOption
|
|
2589
2831
|
} = state;
|
|
2590
|
-
const dom = getActionsVirtualDom(options, buttons);
|
|
2832
|
+
const dom = getActionsVirtualDom(options, buttons, selectedOption);
|
|
2591
2833
|
return dom;
|
|
2592
2834
|
};
|
|
2593
2835
|
|
|
2594
2836
|
const renderEventListeners = () => {
|
|
2595
2837
|
return [{
|
|
2838
|
+
name: HandleWheel,
|
|
2839
|
+
params: ['handleWheel', 'event.deltaMode', 'event.deltaY'],
|
|
2840
|
+
passive: true
|
|
2841
|
+
}, {
|
|
2842
|
+
name: HandleKeyDown,
|
|
2843
|
+
params: ['handleKeyDown', 'event.key']
|
|
2844
|
+
}, {
|
|
2845
|
+
name: HandleScrollBarPointerDown,
|
|
2846
|
+
params: ['handleScrollBarClick', 'event.clientY'],
|
|
2847
|
+
preventDefault: true,
|
|
2848
|
+
stopPropagation: true,
|
|
2849
|
+
trackPointerEvents: [HandleScrollBarMove, HandleScrollBarPointerCaptureLost]
|
|
2850
|
+
}, {
|
|
2851
|
+
name: HandleScrollBarMove,
|
|
2852
|
+
params: ['handleScrollBarMove', 'event.clientY']
|
|
2853
|
+
}, {
|
|
2854
|
+
name: HandleScrollBarPointerCaptureLost,
|
|
2855
|
+
params: ['handleScrollBarCaptureLost']
|
|
2856
|
+
}, {
|
|
2596
2857
|
name: HandleBlur,
|
|
2597
2858
|
params: ['handleBlur']
|
|
2598
2859
|
}, {
|
|
@@ -2703,9 +2964,14 @@ const commandMap = {
|
|
|
2703
2964
|
'Output.handleData': wrapCommand(handleData),
|
|
2704
2965
|
'Output.handleError': wrapCommand(handleError),
|
|
2705
2966
|
'Output.handleFilterInput': wrapCommand(handleFilterInput),
|
|
2967
|
+
'Output.handleKeyDown': wrapCommand(handleKeyDown),
|
|
2706
2968
|
'Output.handleMessagePort': handleDirectMessagePort,
|
|
2969
|
+
'Output.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
|
|
2970
|
+
'Output.handleScrollBarClick': wrapCommand(handleScrollBarClick),
|
|
2971
|
+
'Output.handleScrollBarMove': wrapCommand(handleScrollBarMove),
|
|
2707
2972
|
'Output.handleSelect': wrapCommand(handleSelect),
|
|
2708
2973
|
'Output.handleSourceLinkClick': wrapCommand(handleSourceLinkClick),
|
|
2974
|
+
'Output.handleWheel': wrapCommand(handleWheel),
|
|
2709
2975
|
'Output.initialize': initialize,
|
|
2710
2976
|
'Output.loadContent2': wrapCommand(loadContent),
|
|
2711
2977
|
'Output.openFindWidget': wrapCommand(openFindWidget),
|
|
@@ -2713,10 +2979,11 @@ const commandMap = {
|
|
|
2713
2979
|
'Output.render2': render2,
|
|
2714
2980
|
'Output.renderActions': wrapGetter(renderActions),
|
|
2715
2981
|
'Output.renderEventListeners': renderEventListeners,
|
|
2716
|
-
'Output.resize': resize,
|
|
2982
|
+
'Output.resize': wrapCommand(resize),
|
|
2717
2983
|
'Output.saveAs': wrapCommand(saveOutputAs),
|
|
2718
2984
|
'Output.saveState': wrapGetter(saveState),
|
|
2719
2985
|
'Output.selectChannel': wrapCommand(selectChannel),
|
|
2986
|
+
'Output.setDeltaY': wrapCommand(setDeltaY),
|
|
2720
2987
|
'Output.setLogLevel': setLogLevel,
|
|
2721
2988
|
'Output.setOutputChannel': wrapCommand(setOutputChannel),
|
|
2722
2989
|
'Output.terminate': terminate
|