@plasmicpkgs/antd 0.0.78 → 0.0.81
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/antd.cjs.development.js +94 -33
- package/dist/antd.cjs.development.js.map +1 -1
- package/dist/antd.cjs.production.min.js +1 -1
- package/dist/antd.cjs.production.min.js.map +1 -1
- package/dist/antd.esm.js +95 -34
- package/dist/antd.esm.js.map +1 -1
- package/package.json +3 -3
- package/skinny/registerTabs.js +74 -23
- package/skinny/registerTabs.js.map +1 -1
package/dist/antd.esm.js
CHANGED
|
@@ -22,7 +22,7 @@ import { Option, OptGroup } from 'rc-select';
|
|
|
22
22
|
import Select from 'antd/lib/select';
|
|
23
23
|
import AntdSlider from 'antd/lib/slider';
|
|
24
24
|
import Switch from 'antd/lib/switch';
|
|
25
|
-
import {
|
|
25
|
+
import { Button as Button$1 } from 'antd';
|
|
26
26
|
import AntdTabs from 'antd/lib/tabs';
|
|
27
27
|
import { TabPane } from 'rc-tabs';
|
|
28
28
|
|
|
@@ -1703,25 +1703,19 @@ function Tabs(props) {
|
|
|
1703
1703
|
}));
|
|
1704
1704
|
}
|
|
1705
1705
|
|
|
1706
|
-
function
|
|
1707
|
-
var
|
|
1708
|
-
|
|
1709
|
-
var
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
var appendNewTab = function appendNewTab(tabKey) {
|
|
1714
|
-
if (tabKey !== "") {
|
|
1715
|
-
studioOps.appendToSlot({
|
|
1716
|
-
type: "component",
|
|
1717
|
-
name: "AntdTabPane",
|
|
1718
|
-
props: {
|
|
1719
|
-
key: tabKey
|
|
1720
|
-
}
|
|
1721
|
-
}, "children");
|
|
1706
|
+
function NavigateTabs(_ref) {
|
|
1707
|
+
var componentProps = _ref.componentProps,
|
|
1708
|
+
studioOps = _ref.studioOps;
|
|
1709
|
+
var tabPanes = [];
|
|
1710
|
+
traverseReactEltTree(componentProps.children, function (elt) {
|
|
1711
|
+
if ((elt == null ? void 0 : elt.type) === TabPane && typeof (elt == null ? void 0 : elt.key) === "string") {
|
|
1712
|
+
tabPanes.push(elt.key);
|
|
1722
1713
|
}
|
|
1723
|
-
};
|
|
1724
|
-
|
|
1714
|
+
});
|
|
1715
|
+
var activeKey = componentProps.activeKey;
|
|
1716
|
+
var currTabPos = activeKey ? tabPanes.findIndex(function (tabKey) {
|
|
1717
|
+
return tabKey === activeKey;
|
|
1718
|
+
}) : 0;
|
|
1725
1719
|
return React.createElement("div", {
|
|
1726
1720
|
style: {
|
|
1727
1721
|
width: "100%",
|
|
@@ -1730,18 +1724,35 @@ function AddTab(_ref) {
|
|
|
1730
1724
|
gap: "10px",
|
|
1731
1725
|
justifyContent: "space-between"
|
|
1732
1726
|
}
|
|
1733
|
-
}, React.createElement(
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
return setTabKey(e.target.value);
|
|
1727
|
+
}, React.createElement(Button$1, {
|
|
1728
|
+
style: {
|
|
1729
|
+
width: "100%"
|
|
1737
1730
|
},
|
|
1738
|
-
value: tabKey
|
|
1739
|
-
}), React.createElement(Button$1, {
|
|
1740
1731
|
onClick: function onClick() {
|
|
1741
|
-
|
|
1742
|
-
|
|
1732
|
+
if (tabPanes.length > 0) {
|
|
1733
|
+
var prevTabPos = (currTabPos - 1 + tabPanes.length) % tabPanes.length;
|
|
1734
|
+
studioOps.updateProps({
|
|
1735
|
+
activeKey: tabPanes[prevTabPos]
|
|
1736
|
+
});
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
}, "Prev tab"), React.createElement(Button$1, {
|
|
1740
|
+
style: {
|
|
1741
|
+
width: "100%"
|
|
1742
|
+
},
|
|
1743
|
+
onClick: function onClick() {
|
|
1744
|
+
if (tabPanes.length > 0) {
|
|
1745
|
+
var nextTabPos = (currTabPos + 1) % tabPanes.length;
|
|
1746
|
+
studioOps.updateProps({
|
|
1747
|
+
activeKey: tabPanes[nextTabPos]
|
|
1748
|
+
});
|
|
1749
|
+
}
|
|
1743
1750
|
}
|
|
1744
|
-
}, "
|
|
1751
|
+
}, "Next tab"));
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
function OutlineMessage() {
|
|
1755
|
+
return React.createElement("div", null, "* To re-arrange tab panes, use the Outline panel");
|
|
1745
1756
|
}
|
|
1746
1757
|
|
|
1747
1758
|
var tabsMeta = {
|
|
@@ -1849,14 +1860,53 @@ var tabsMeta = {
|
|
|
1849
1860
|
},
|
|
1850
1861
|
actions: [{
|
|
1851
1862
|
type: "custom-action",
|
|
1852
|
-
control:
|
|
1863
|
+
control: NavigateTabs
|
|
1853
1864
|
}, {
|
|
1854
1865
|
type: "button-action",
|
|
1855
|
-
label: "
|
|
1866
|
+
label: "Add new tab",
|
|
1856
1867
|
onClick: function onClick(_ref2) {
|
|
1857
1868
|
var componentProps = _ref2.componentProps,
|
|
1858
1869
|
studioOps = _ref2.studioOps;
|
|
1859
1870
|
|
|
1871
|
+
// Get the first positive integer that isn't already a key
|
|
1872
|
+
var generateNewKey = function generateNewKey() {
|
|
1873
|
+
var keysSet = new Set();
|
|
1874
|
+
traverseReactEltTree(componentProps.children, function (elt) {
|
|
1875
|
+
if ((elt == null ? void 0 : elt.type) === TabPane && typeof (elt == null ? void 0 : elt.key) === "string") {
|
|
1876
|
+
keysSet.add(elt.key);
|
|
1877
|
+
}
|
|
1878
|
+
});
|
|
1879
|
+
|
|
1880
|
+
for (var keyCandidate = 1; keyCandidate <= keysSet.size + 1; keyCandidate++) {
|
|
1881
|
+
var strKey = keyCandidate.toString();
|
|
1882
|
+
|
|
1883
|
+
if (!keysSet.has(strKey)) {
|
|
1884
|
+
return strKey;
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
return undefined;
|
|
1889
|
+
};
|
|
1890
|
+
|
|
1891
|
+
var tabKey = generateNewKey();
|
|
1892
|
+
studioOps.appendToSlot({
|
|
1893
|
+
type: "component",
|
|
1894
|
+
name: "AntdTabPane",
|
|
1895
|
+
props: {
|
|
1896
|
+
key: tabKey
|
|
1897
|
+
}
|
|
1898
|
+
}, "children");
|
|
1899
|
+
studioOps.updateProps({
|
|
1900
|
+
activeKey: tabKey
|
|
1901
|
+
});
|
|
1902
|
+
}
|
|
1903
|
+
}, {
|
|
1904
|
+
type: "button-action",
|
|
1905
|
+
label: "Delete current tab",
|
|
1906
|
+
onClick: function onClick(_ref3) {
|
|
1907
|
+
var componentProps = _ref3.componentProps,
|
|
1908
|
+
studioOps = _ref3.studioOps;
|
|
1909
|
+
|
|
1860
1910
|
if (componentProps.activeKey) {
|
|
1861
1911
|
var tabPanes = [];
|
|
1862
1912
|
traverseReactEltTree(componentProps.children, function (elt) {
|
|
@@ -1864,15 +1914,26 @@ var tabsMeta = {
|
|
|
1864
1914
|
tabPanes.push(elt.key);
|
|
1865
1915
|
}
|
|
1866
1916
|
});
|
|
1867
|
-
var
|
|
1868
|
-
|
|
1917
|
+
var activeKey = componentProps.activeKey;
|
|
1918
|
+
var currTabPos = tabPanes.findIndex(function (tabKey) {
|
|
1919
|
+
return tabKey === activeKey;
|
|
1869
1920
|
});
|
|
1870
1921
|
|
|
1871
|
-
if (
|
|
1872
|
-
studioOps.removeFromSlotAt(
|
|
1922
|
+
if (currTabPos !== -1) {
|
|
1923
|
+
studioOps.removeFromSlotAt(currTabPos, "children");
|
|
1924
|
+
|
|
1925
|
+
if (tabPanes.length - 1 > 0) {
|
|
1926
|
+
var prevTabPos = (currTabPos - 1 + tabPanes.length) % tabPanes.length;
|
|
1927
|
+
studioOps.updateProps({
|
|
1928
|
+
activeKey: tabPanes[prevTabPos]
|
|
1929
|
+
});
|
|
1930
|
+
}
|
|
1873
1931
|
}
|
|
1874
1932
|
}
|
|
1875
1933
|
}
|
|
1934
|
+
}, {
|
|
1935
|
+
type: "custom-action",
|
|
1936
|
+
control: OutlineMessage
|
|
1876
1937
|
}],
|
|
1877
1938
|
importPath: "@plasmicpkgs/antd/skinny/registerTabs",
|
|
1878
1939
|
importName: "Tabs"
|