@lvce-editor/activity-bar-worker 1.15.0 → 1.16.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 +20 -14
- package/package.json +1 -1
|
@@ -1242,14 +1242,6 @@ const handleSideBarHidden = state => {
|
|
|
1242
1242
|
};
|
|
1243
1243
|
};
|
|
1244
1244
|
|
|
1245
|
-
const Tab = 1;
|
|
1246
|
-
const Button = 1 << 1;
|
|
1247
|
-
const Progress = 1 << 2;
|
|
1248
|
-
const Enabled = 1 << 3;
|
|
1249
|
-
const Selected = 1 << 4;
|
|
1250
|
-
const Focused = 1 << 5;
|
|
1251
|
-
const MarginTop = 1 << 6;
|
|
1252
|
-
|
|
1253
1245
|
const findIndex = (activityBarItems, id) => {
|
|
1254
1246
|
for (let i = 0; i < activityBarItems.length; i++) {
|
|
1255
1247
|
if (activityBarItems[i].id === id) {
|
|
@@ -1259,6 +1251,14 @@ const findIndex = (activityBarItems, id) => {
|
|
|
1259
1251
|
return -1;
|
|
1260
1252
|
};
|
|
1261
1253
|
|
|
1254
|
+
const Tab = 1;
|
|
1255
|
+
const Button = 1 << 1;
|
|
1256
|
+
const Progress = 1 << 2;
|
|
1257
|
+
const Enabled = 1 << 3;
|
|
1258
|
+
const Selected = 1 << 4;
|
|
1259
|
+
const Focused = 1 << 5;
|
|
1260
|
+
const MarginTop = 1 << 6;
|
|
1261
|
+
|
|
1262
1262
|
const setFlag = (item, flag, enabled) => {
|
|
1263
1263
|
return {
|
|
1264
1264
|
...item,
|
|
@@ -1266,18 +1266,19 @@ const setFlag = (item, flag, enabled) => {
|
|
|
1266
1266
|
};
|
|
1267
1267
|
};
|
|
1268
1268
|
|
|
1269
|
-
const
|
|
1269
|
+
const markSelected = (items, selectedIndex) => {
|
|
1270
1270
|
return items.map((item, index) => {
|
|
1271
1271
|
const isSelected = index === selectedIndex;
|
|
1272
1272
|
return setFlag(item, Selected, isSelected);
|
|
1273
1273
|
});
|
|
1274
1274
|
};
|
|
1275
|
+
|
|
1275
1276
|
const handleSideBarViewletChange = (state, id, ...args) => {
|
|
1276
1277
|
const {
|
|
1277
1278
|
activityBarItems
|
|
1278
1279
|
} = state;
|
|
1279
1280
|
const index = findIndex(activityBarItems, id);
|
|
1280
|
-
const newActivityBarItems =
|
|
1281
|
+
const newActivityBarItems = markSelected(activityBarItems, index);
|
|
1281
1282
|
return {
|
|
1282
1283
|
...state,
|
|
1283
1284
|
selectedIndex: index,
|
|
@@ -1387,11 +1388,14 @@ const getActivityBarItems = () => {
|
|
|
1387
1388
|
|
|
1388
1389
|
const loadContent = async (state, savedState) => {
|
|
1389
1390
|
const items = getActivityBarItems();
|
|
1391
|
+
const explorerIndex = 0;
|
|
1392
|
+
const itemsWithSelected = markSelected(items, explorerIndex);
|
|
1390
1393
|
return {
|
|
1391
1394
|
...state,
|
|
1392
|
-
activityBarItems:
|
|
1395
|
+
activityBarItems: itemsWithSelected,
|
|
1393
1396
|
sideBarVisible: true,
|
|
1394
|
-
currentViewletId: Explorer
|
|
1397
|
+
currentViewletId: Explorer,
|
|
1398
|
+
selectedIndex: explorerIndex
|
|
1395
1399
|
};
|
|
1396
1400
|
};
|
|
1397
1401
|
|
|
@@ -1628,10 +1632,12 @@ const renderEventListeners = () => {
|
|
|
1628
1632
|
|
|
1629
1633
|
const saveState = state => {
|
|
1630
1634
|
const {
|
|
1631
|
-
uid
|
|
1635
|
+
uid,
|
|
1636
|
+
currentViewletId
|
|
1632
1637
|
} = state;
|
|
1633
1638
|
return {
|
|
1634
|
-
uid
|
|
1639
|
+
uid,
|
|
1640
|
+
currentViewletId
|
|
1635
1641
|
};
|
|
1636
1642
|
};
|
|
1637
1643
|
|