@lvce-editor/activity-bar-worker 1.26.0 → 1.27.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/activityBarWorkerMain.js +26 -18
- package/package.json +1 -1
|
@@ -1025,17 +1025,15 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0) =>
|
|
|
1025
1025
|
itemHeight: 48,
|
|
1026
1026
|
updateState: '',
|
|
1027
1027
|
updateProgress: 0,
|
|
1028
|
-
filteredItems: []
|
|
1028
|
+
filteredItems: [],
|
|
1029
|
+
numberOfVisibleItems: 0
|
|
1029
1030
|
};
|
|
1030
1031
|
set(id, state, state);
|
|
1031
1032
|
return state;
|
|
1032
1033
|
};
|
|
1033
1034
|
|
|
1034
1035
|
const isEqual$2 = (oldState, newState) => {
|
|
1035
|
-
|
|
1036
|
-
// maybe only when items change, and even then not
|
|
1037
|
-
// always, but only when it affects the css
|
|
1038
|
-
return false;
|
|
1036
|
+
return oldState.itemHeight === newState.itemHeight;
|
|
1039
1037
|
};
|
|
1040
1038
|
|
|
1041
1039
|
const isEqual$1 = (oldState, newState) => {
|
|
@@ -1043,7 +1041,7 @@ const isEqual$1 = (oldState, newState) => {
|
|
|
1043
1041
|
};
|
|
1044
1042
|
|
|
1045
1043
|
const isEqual = (oldState, newState) => {
|
|
1046
|
-
return oldState.
|
|
1044
|
+
return oldState.activityBarItems === newState.activityBarItems && oldState.filteredItems === newState.filteredItems && oldState.focusedIndex === newState.focusedIndex && oldState.updateProgress === newState.updateProgress && oldState.updateState === newState.updateState;
|
|
1047
1045
|
};
|
|
1048
1046
|
|
|
1049
1047
|
const RenderItems = 4;
|
|
@@ -1206,9 +1204,9 @@ const handleClickIndex = async (state, button, index, x, y) => {
|
|
|
1206
1204
|
return state;
|
|
1207
1205
|
}
|
|
1208
1206
|
const {
|
|
1209
|
-
|
|
1207
|
+
filteredItems
|
|
1210
1208
|
} = state;
|
|
1211
|
-
const item =
|
|
1209
|
+
const item = filteredItems[index];
|
|
1212
1210
|
const viewletId = item.id;
|
|
1213
1211
|
switch (viewletId) {
|
|
1214
1212
|
case 'Settings':
|
|
@@ -1222,11 +1220,11 @@ const handleClickIndex = async (state, button, index, x, y) => {
|
|
|
1222
1220
|
|
|
1223
1221
|
const handleClick = async (state, button, eventX, eventY) => {
|
|
1224
1222
|
const {
|
|
1225
|
-
|
|
1223
|
+
filteredItems,
|
|
1226
1224
|
itemHeight,
|
|
1227
1225
|
y
|
|
1228
1226
|
} = state;
|
|
1229
|
-
const index = getIndexFromPosition(y, eventX, eventY, itemHeight,
|
|
1227
|
+
const index = getIndexFromPosition(y, eventX, eventY, itemHeight, filteredItems.length);
|
|
1230
1228
|
return handleClickIndex(state, button, index, eventX, eventY);
|
|
1231
1229
|
};
|
|
1232
1230
|
|
|
@@ -1385,15 +1383,19 @@ const markSelected = (items, selectedIndex) => {
|
|
|
1385
1383
|
|
|
1386
1384
|
const handleSideBarViewletChange = (state, id, ...args) => {
|
|
1387
1385
|
const {
|
|
1388
|
-
activityBarItems
|
|
1386
|
+
activityBarItems,
|
|
1387
|
+
height,
|
|
1388
|
+
itemHeight
|
|
1389
1389
|
} = state;
|
|
1390
1390
|
const index = findIndex(activityBarItems, id);
|
|
1391
1391
|
const newActivityBarItems = markSelected(activityBarItems, index);
|
|
1392
|
+
const filteredItems = getFilteredActivityBarItems(newActivityBarItems, height, itemHeight);
|
|
1392
1393
|
return {
|
|
1393
1394
|
...state,
|
|
1394
1395
|
selectedIndex: index,
|
|
1395
1396
|
currentViewletId: id,
|
|
1396
1397
|
activityBarItems: newActivityBarItems,
|
|
1398
|
+
filteredItems,
|
|
1397
1399
|
sideBarVisible: true
|
|
1398
1400
|
};
|
|
1399
1401
|
};
|
|
@@ -1425,14 +1427,14 @@ const getNewItems = (items, state) => {
|
|
|
1425
1427
|
};
|
|
1426
1428
|
const handleUpdateStateChange = async (state, config) => {
|
|
1427
1429
|
const {
|
|
1428
|
-
|
|
1430
|
+
filteredItems
|
|
1429
1431
|
} = state;
|
|
1430
|
-
const newItems = getNewItems(
|
|
1432
|
+
const newItems = getNewItems(filteredItems, config.state);
|
|
1431
1433
|
return {
|
|
1432
1434
|
...state,
|
|
1433
1435
|
updateState: config.state,
|
|
1434
1436
|
updateProgress: config.progress,
|
|
1435
|
-
|
|
1437
|
+
filteredItems: newItems
|
|
1436
1438
|
};
|
|
1437
1439
|
};
|
|
1438
1440
|
|
|
@@ -1487,15 +1489,21 @@ const getActivityBarItems = () => {
|
|
|
1487
1489
|
};
|
|
1488
1490
|
|
|
1489
1491
|
const loadContent = async (state, savedState) => {
|
|
1492
|
+
const {
|
|
1493
|
+
itemHeight,
|
|
1494
|
+
height
|
|
1495
|
+
} = state;
|
|
1490
1496
|
const items = getActivityBarItems();
|
|
1491
1497
|
const explorerIndex = 0;
|
|
1492
1498
|
const itemsWithSelected = markSelected(items, explorerIndex);
|
|
1499
|
+
const filteredItems = getFilteredActivityBarItems(itemsWithSelected, height, itemHeight);
|
|
1493
1500
|
return {
|
|
1494
1501
|
...state,
|
|
1495
1502
|
activityBarItems: itemsWithSelected,
|
|
1496
|
-
sideBarVisible: true,
|
|
1497
1503
|
currentViewletId: Explorer,
|
|
1498
|
-
|
|
1504
|
+
filteredItems,
|
|
1505
|
+
selectedIndex: explorerIndex,
|
|
1506
|
+
sideBarVisible: true
|
|
1499
1507
|
};
|
|
1500
1508
|
};
|
|
1501
1509
|
|
|
@@ -1742,9 +1750,9 @@ const getActivityBarVirtualDom = visibleItems => {
|
|
|
1742
1750
|
const renderItems = (oldState, newState) => {
|
|
1743
1751
|
const {
|
|
1744
1752
|
uid,
|
|
1745
|
-
|
|
1753
|
+
filteredItems
|
|
1746
1754
|
} = newState;
|
|
1747
|
-
const dom = getActivityBarVirtualDom(
|
|
1755
|
+
const dom = getActivityBarVirtualDom(filteredItems);
|
|
1748
1756
|
return [SetDom2, uid, dom];
|
|
1749
1757
|
};
|
|
1750
1758
|
|