@lvce-editor/panel-worker 1.5.0 → 1.6.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.
@@ -886,6 +886,7 @@ const create$3 = async ({
886
886
  };
887
887
 
888
888
  const Tab = 'tab';
889
+ const ToolBar = 'toolbar';
889
890
 
890
891
  const Button = 1;
891
892
  const Div = 4;
@@ -1080,6 +1081,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
1080
1081
  initial: true,
1081
1082
  platform,
1082
1083
  selectedIndex: -1,
1084
+ tabs: [],
1083
1085
  uid,
1084
1086
  views: [],
1085
1087
  warningCount: 0,
@@ -1126,6 +1128,7 @@ const handleClickClose = async state => {
1126
1128
  };
1127
1129
 
1128
1130
  const handleClickMaximize = async state => {
1131
+ await invoke('Layout.maximizePanel');
1129
1132
  return state;
1130
1133
  };
1131
1134
 
@@ -1551,7 +1554,7 @@ const getActionsDom = newState => {
1551
1554
  return [{
1552
1555
  childCount: 0,
1553
1556
  className: Actions,
1554
- role: 'toolbar',
1557
+ role: ToolBar,
1555
1558
  type: Div
1556
1559
  }];
1557
1560
  }
@@ -1618,21 +1621,26 @@ const getGlobalActionsDom = () => {
1618
1621
  }];
1619
1622
  };
1620
1623
 
1621
- const createPanelTab = (tab, badgeCount, isSelected, index) => {
1622
- const label = tab;
1624
+ const getTabClassName = isSelected => {
1623
1625
  let className = PanelTab;
1624
1626
  if (isSelected) {
1625
1627
  className += ' ' + PanelTabSelected;
1626
1628
  }
1629
+ return className;
1630
+ };
1631
+ const createPanelTab = (tab, badgeCount, isSelected, index) => {
1632
+ const label = tab;
1633
+ const className = getTabClassName(isSelected);
1627
1634
  const childCount = badgeCount ? 2 : 1;
1628
1635
  const tabDom = {
1629
1636
  ariaSelected: isSelected,
1630
1637
  childCount,
1631
1638
  className,
1632
1639
  'data-index': index,
1640
+ name: tab,
1633
1641
  onClick: HandleClickSelectTab,
1634
1642
  role: Tab,
1635
- type: Div
1643
+ type: Button
1636
1644
  };
1637
1645
  const dom = [tabDom, text(label)];
1638
1646
  if (badgeCount) {
@@ -1644,6 +1652,7 @@ const createPanelTab = (tab, badgeCount, isSelected, index) => {
1644
1652
  }
1645
1653
  return dom;
1646
1654
  };
1655
+
1647
1656
  const getPanelTabsVirtualDom = (tabs, selectedIndex, badgeCounts) => {
1648
1657
  const dom = [];
1649
1658
  for (let i = 0; i < tabs.length; i++) {
@@ -1655,16 +1664,9 @@ const getPanelTabsVirtualDom = (tabs, selectedIndex, badgeCounts) => {
1655
1664
  return dom;
1656
1665
  };
1657
1666
 
1658
- const getPanelDom = newState => {
1659
- const {
1660
- childUid
1661
- } = newState;
1667
+ const getPanelHeaderDom = newState => {
1662
1668
  const tabsDom = getPanelTabsVirtualDom(newState.views, newState.selectedIndex, newState.badgeCounts);
1663
1669
  return [{
1664
- childCount: 2,
1665
- className: Panel,
1666
- type: Div
1667
- }, {
1668
1670
  childCount: 3,
1669
1671
  className: PanelHeader,
1670
1672
  type: Div
@@ -1672,7 +1674,18 @@ const getPanelDom = newState => {
1672
1674
  childCount: newState.views.length,
1673
1675
  className: PanelTabs,
1674
1676
  type: Div
1675
- }, ...tabsDom, ...getActionsDom(newState), ...getGlobalActionsDom(), {
1677
+ }, ...tabsDom, ...getActionsDom(newState), ...getGlobalActionsDom()];
1678
+ };
1679
+
1680
+ const getPanelDom = newState => {
1681
+ const {
1682
+ childUid
1683
+ } = newState;
1684
+ return [{
1685
+ childCount: 2,
1686
+ className: Panel,
1687
+ type: Div
1688
+ }, ...getPanelHeaderDom(newState), {
1676
1689
  type: Reference,
1677
1690
  uid: childUid
1678
1691
  }];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/panel-worker",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Panel Worker",
5
5
  "repository": {
6
6
  "type": "git",