@lvce-editor/panel-worker 1.4.0 → 1.5.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/panelWorkerMain.js +54 -18
- package/package.json +1 -1
package/dist/panelWorkerMain.js
CHANGED
|
@@ -1091,7 +1091,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
1091
1091
|
};
|
|
1092
1092
|
|
|
1093
1093
|
const isEqual = (oldState, newState) => {
|
|
1094
|
-
return oldState.assetDir === newState.assetDir && oldState.initial === newState.initial && oldState.currentViewletId === newState.currentViewletId;
|
|
1094
|
+
return oldState.assetDir === newState.assetDir && oldState.initial === newState.initial && oldState.currentViewletId === newState.currentViewletId && oldState.selectedIndex === newState.selectedIndex && oldState.views === newState.views;
|
|
1095
1095
|
};
|
|
1096
1096
|
|
|
1097
1097
|
const RenderItems = 4;
|
|
@@ -1129,6 +1129,10 @@ const handleClickMaximize = async state => {
|
|
|
1129
1129
|
return state;
|
|
1130
1130
|
};
|
|
1131
1131
|
|
|
1132
|
+
const handleBlur = async state => {
|
|
1133
|
+
return state;
|
|
1134
|
+
};
|
|
1135
|
+
|
|
1132
1136
|
const handleFilterInput = async (state, value) => {
|
|
1133
1137
|
object(state);
|
|
1134
1138
|
string(value);
|
|
@@ -1528,12 +1532,25 @@ const diffTree = (oldNodes, newNodes) => {
|
|
|
1528
1532
|
return removeTrailingNavigationPatches(patches);
|
|
1529
1533
|
};
|
|
1530
1534
|
|
|
1535
|
+
const Badge = 'Badge';
|
|
1536
|
+
const PanelTab = 'PanelTab';
|
|
1537
|
+
const PanelTabSelected = 'PanelTabSelected';
|
|
1538
|
+
const Panel = 'Panel';
|
|
1539
|
+
const PanelHeader = 'PanelHeader';
|
|
1540
|
+
const PanelTabs = 'PanelTabs';
|
|
1541
|
+
const PanelToolBar = 'PanelToolBar';
|
|
1542
|
+
const IconButton = 'IconButton';
|
|
1543
|
+
const MaskIcon = 'MaskIcon';
|
|
1544
|
+
const MaskIconChevronUp = 'MaskIconChevronUp';
|
|
1545
|
+
const MaskIconClose = 'MaskIconClose';
|
|
1546
|
+
const Actions = 'Actions';
|
|
1547
|
+
|
|
1531
1548
|
const getActionsDom = newState => {
|
|
1532
1549
|
const actions = newState.actionsUid || -1;
|
|
1533
1550
|
if (actions === -1) {
|
|
1534
1551
|
return [{
|
|
1535
1552
|
childCount: 0,
|
|
1536
|
-
className:
|
|
1553
|
+
className: Actions,
|
|
1537
1554
|
role: 'toolbar',
|
|
1538
1555
|
type: Div
|
|
1539
1556
|
}];
|
|
@@ -1548,41 +1565,59 @@ const HandleClickClose = 'handleClickClose';
|
|
|
1548
1565
|
const HandleClickMaximize = 'handleClickMaximize';
|
|
1549
1566
|
const HandleClickSelectTab = 'HandleClickSelectTab';
|
|
1550
1567
|
|
|
1568
|
+
const emptyObject = {};
|
|
1569
|
+
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
|
1570
|
+
const i18nString = (key, placeholders = emptyObject) => {
|
|
1571
|
+
if (placeholders === emptyObject) {
|
|
1572
|
+
return key;
|
|
1573
|
+
}
|
|
1574
|
+
const replacer = (match, rest) => {
|
|
1575
|
+
return placeholders[rest];
|
|
1576
|
+
};
|
|
1577
|
+
return key.replaceAll(RE_PLACEHOLDER, replacer);
|
|
1578
|
+
};
|
|
1579
|
+
|
|
1580
|
+
const Maximize = 'Maximize';
|
|
1581
|
+
const Close = 'Close';
|
|
1582
|
+
|
|
1583
|
+
const maximize = () => {
|
|
1584
|
+
return i18nString(Maximize);
|
|
1585
|
+
};
|
|
1586
|
+
const close = () => {
|
|
1587
|
+
return i18nString(Close);
|
|
1588
|
+
};
|
|
1589
|
+
|
|
1551
1590
|
const getGlobalActionsDom = () => {
|
|
1552
1591
|
return [{
|
|
1553
1592
|
childCount: 2,
|
|
1554
|
-
className:
|
|
1593
|
+
className: PanelToolBar,
|
|
1555
1594
|
role: 'toolbar',
|
|
1556
1595
|
type: Div
|
|
1557
1596
|
}, {
|
|
1558
|
-
ariaLabel:
|
|
1597
|
+
ariaLabel: maximize(),
|
|
1559
1598
|
childCount: 1,
|
|
1560
|
-
className:
|
|
1599
|
+
className: IconButton,
|
|
1561
1600
|
onClick: HandleClickMaximize,
|
|
1562
|
-
|
|
1601
|
+
title: maximize(),
|
|
1563
1602
|
type: Button
|
|
1564
1603
|
}, {
|
|
1565
1604
|
childCount: 0,
|
|
1566
|
-
className:
|
|
1605
|
+
className: `${MaskIcon} ${MaskIconChevronUp}`,
|
|
1567
1606
|
type: Div
|
|
1568
1607
|
}, {
|
|
1569
|
-
ariaLabel:
|
|
1608
|
+
ariaLabel: close(),
|
|
1570
1609
|
childCount: 1,
|
|
1571
|
-
className:
|
|
1610
|
+
className: IconButton,
|
|
1572
1611
|
onClick: HandleClickClose,
|
|
1573
|
-
|
|
1612
|
+
title: close(),
|
|
1574
1613
|
type: Button
|
|
1575
1614
|
}, {
|
|
1576
1615
|
childCount: 0,
|
|
1577
|
-
className:
|
|
1616
|
+
className: `${MaskIcon} ${MaskIconClose}`,
|
|
1578
1617
|
type: Div
|
|
1579
1618
|
}];
|
|
1580
1619
|
};
|
|
1581
1620
|
|
|
1582
|
-
const Badge = 'Badge';
|
|
1583
|
-
const PanelTab = 'PanelTab';
|
|
1584
|
-
const PanelTabSelected = 'PanelTabSelected';
|
|
1585
|
-
|
|
1586
1621
|
const createPanelTab = (tab, badgeCount, isSelected, index) => {
|
|
1587
1622
|
const label = tab;
|
|
1588
1623
|
let className = PanelTab;
|
|
@@ -1627,15 +1662,15 @@ const getPanelDom = newState => {
|
|
|
1627
1662
|
const tabsDom = getPanelTabsVirtualDom(newState.views, newState.selectedIndex, newState.badgeCounts);
|
|
1628
1663
|
return [{
|
|
1629
1664
|
childCount: 2,
|
|
1630
|
-
className:
|
|
1665
|
+
className: Panel,
|
|
1631
1666
|
type: Div
|
|
1632
1667
|
}, {
|
|
1633
1668
|
childCount: 3,
|
|
1634
|
-
className:
|
|
1669
|
+
className: PanelHeader,
|
|
1635
1670
|
type: Div
|
|
1636
1671
|
}, {
|
|
1637
1672
|
childCount: newState.views.length,
|
|
1638
|
-
className:
|
|
1673
|
+
className: PanelTabs,
|
|
1639
1674
|
type: Div
|
|
1640
1675
|
}, ...tabsDom, ...getActionsDom(newState), ...getGlobalActionsDom(), {
|
|
1641
1676
|
type: Reference,
|
|
@@ -1743,6 +1778,7 @@ const commandMap = {
|
|
|
1743
1778
|
'Panel.create': create,
|
|
1744
1779
|
'Panel.diff2': diff2,
|
|
1745
1780
|
'Panel.getCommandIds': getCommandIds,
|
|
1781
|
+
'Panel.handleBlur': wrapCommand(handleBlur),
|
|
1746
1782
|
'Panel.handleClickClose': wrapCommand(handleClickClose),
|
|
1747
1783
|
'Panel.handleClickMaximize': wrapCommand(handleClickMaximize),
|
|
1748
1784
|
'Panel.handleFilterInput': wrapCommand(handleFilterInput),
|