@lvce-editor/activity-bar-worker 1.15.0 → 1.17.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 +39 -26
- package/package.json +1 -1
|
@@ -1179,12 +1179,12 @@ const handleClickOther = async (state, x, y, viewletId) => {
|
|
|
1179
1179
|
if (sideBarVisible) {
|
|
1180
1180
|
if (currentViewletId === viewletId) {
|
|
1181
1181
|
await hide();
|
|
1182
|
-
|
|
1183
|
-
await show(sideBarVisible, viewletId);
|
|
1182
|
+
return state;
|
|
1184
1183
|
}
|
|
1185
|
-
|
|
1186
|
-
|
|
1184
|
+
await show(sideBarVisible, viewletId);
|
|
1185
|
+
return state;
|
|
1187
1186
|
}
|
|
1187
|
+
await show(sideBarVisible, currentViewletId);
|
|
1188
1188
|
return state;
|
|
1189
1189
|
};
|
|
1190
1190
|
|
|
@@ -1234,14 +1234,6 @@ const handleResize = state => {
|
|
|
1234
1234
|
return state;
|
|
1235
1235
|
};
|
|
1236
1236
|
|
|
1237
|
-
const handleSideBarHidden = state => {
|
|
1238
|
-
return {
|
|
1239
|
-
...state,
|
|
1240
|
-
focusedIndex: -1,
|
|
1241
|
-
selectedIndex: -1
|
|
1242
|
-
};
|
|
1243
|
-
};
|
|
1244
|
-
|
|
1245
1237
|
const Tab = 1;
|
|
1246
1238
|
const Button = 1 << 1;
|
|
1247
1239
|
const Progress = 1 << 2;
|
|
@@ -1250,6 +1242,27 @@ const Selected = 1 << 4;
|
|
|
1250
1242
|
const Focused = 1 << 5;
|
|
1251
1243
|
const MarginTop = 1 << 6;
|
|
1252
1244
|
|
|
1245
|
+
const setFlag = (item, flag, enabled) => {
|
|
1246
|
+
return {
|
|
1247
|
+
...item,
|
|
1248
|
+
flags: enabled ? item.flags | flag : item.flags & ~flag
|
|
1249
|
+
};
|
|
1250
|
+
};
|
|
1251
|
+
|
|
1252
|
+
const handleSideBarHidden = state => {
|
|
1253
|
+
const itemsCleared = state.activityBarItems.map(item => {
|
|
1254
|
+
const withoutSelected = setFlag(item, Selected, false);
|
|
1255
|
+
return setFlag(withoutSelected, Focused, false);
|
|
1256
|
+
});
|
|
1257
|
+
return {
|
|
1258
|
+
...state,
|
|
1259
|
+
activityBarItems: itemsCleared,
|
|
1260
|
+
focusedIndex: -1,
|
|
1261
|
+
selectedIndex: -1,
|
|
1262
|
+
sideBarVisible: false
|
|
1263
|
+
};
|
|
1264
|
+
};
|
|
1265
|
+
|
|
1253
1266
|
const findIndex = (activityBarItems, id) => {
|
|
1254
1267
|
for (let i = 0; i < activityBarItems.length; i++) {
|
|
1255
1268
|
if (activityBarItems[i].id === id) {
|
|
@@ -1259,30 +1272,25 @@ const findIndex = (activityBarItems, id) => {
|
|
|
1259
1272
|
return -1;
|
|
1260
1273
|
};
|
|
1261
1274
|
|
|
1262
|
-
const
|
|
1263
|
-
return {
|
|
1264
|
-
...item,
|
|
1265
|
-
flags: enabled ? item.flags | flag : item.flags & ~flag
|
|
1266
|
-
};
|
|
1267
|
-
};
|
|
1268
|
-
|
|
1269
|
-
const getNewItems = (items, selectedIndex) => {
|
|
1275
|
+
const markSelected = (items, selectedIndex) => {
|
|
1270
1276
|
return items.map((item, index) => {
|
|
1271
1277
|
const isSelected = index === selectedIndex;
|
|
1272
1278
|
return setFlag(item, Selected, isSelected);
|
|
1273
1279
|
});
|
|
1274
1280
|
};
|
|
1281
|
+
|
|
1275
1282
|
const handleSideBarViewletChange = (state, id, ...args) => {
|
|
1276
1283
|
const {
|
|
1277
1284
|
activityBarItems
|
|
1278
1285
|
} = state;
|
|
1279
1286
|
const index = findIndex(activityBarItems, id);
|
|
1280
|
-
const newActivityBarItems =
|
|
1287
|
+
const newActivityBarItems = markSelected(activityBarItems, index);
|
|
1281
1288
|
return {
|
|
1282
1289
|
...state,
|
|
1283
1290
|
selectedIndex: index,
|
|
1284
1291
|
currentViewletId: id,
|
|
1285
|
-
activityBarItems: newActivityBarItems
|
|
1292
|
+
activityBarItems: newActivityBarItems,
|
|
1293
|
+
sideBarVisible: true
|
|
1286
1294
|
};
|
|
1287
1295
|
};
|
|
1288
1296
|
|
|
@@ -1387,11 +1395,14 @@ const getActivityBarItems = () => {
|
|
|
1387
1395
|
|
|
1388
1396
|
const loadContent = async (state, savedState) => {
|
|
1389
1397
|
const items = getActivityBarItems();
|
|
1398
|
+
const explorerIndex = 0;
|
|
1399
|
+
const itemsWithSelected = markSelected(items, explorerIndex);
|
|
1390
1400
|
return {
|
|
1391
1401
|
...state,
|
|
1392
|
-
activityBarItems:
|
|
1402
|
+
activityBarItems: itemsWithSelected,
|
|
1393
1403
|
sideBarVisible: true,
|
|
1394
|
-
currentViewletId: Explorer
|
|
1404
|
+
currentViewletId: Explorer,
|
|
1405
|
+
selectedIndex: explorerIndex
|
|
1395
1406
|
};
|
|
1396
1407
|
};
|
|
1397
1408
|
|
|
@@ -1628,10 +1639,12 @@ const renderEventListeners = () => {
|
|
|
1628
1639
|
|
|
1629
1640
|
const saveState = state => {
|
|
1630
1641
|
const {
|
|
1631
|
-
uid
|
|
1642
|
+
uid,
|
|
1643
|
+
currentViewletId
|
|
1632
1644
|
} = state;
|
|
1633
1645
|
return {
|
|
1634
|
-
uid
|
|
1646
|
+
uid,
|
|
1647
|
+
currentViewletId
|
|
1635
1648
|
};
|
|
1636
1649
|
};
|
|
1637
1650
|
|