@plasmicpkgs/antd5 0.0.115 → 0.0.118
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/.tsbuildinfo +1 -1
- package/dist/antd.esm.js +1544 -660
- package/dist/antd.esm.js.map +1 -1
- package/dist/index.js +1544 -659
- package/dist/index.js.map +1 -1
- package/dist/registerCollapse.d.ts +28 -17
- package/dist/registerDatePicker.d.ts +1 -0
- package/dist/registerDrawer.d.ts +1 -0
- package/dist/registerDropdown.d.ts +1 -0
- package/dist/registerModal.d.ts +2 -0
- package/dist/registerPopover.d.ts +8 -0
- package/dist/registerTabs.d.ts +27 -0
- package/dist/registerTree.d.ts +2 -2
- package/package.json +2 -2
- package/skinny/registerCollapse.cjs.js +251 -157
- package/skinny/registerCollapse.cjs.js.map +1 -1
- package/skinny/registerCollapse.d.ts +28 -17
- package/skinny/registerCollapse.esm.js +243 -153
- package/skinny/registerCollapse.esm.js.map +1 -1
- package/skinny/registerDatePicker.cjs.js +47 -2
- package/skinny/registerDatePicker.cjs.js.map +1 -1
- package/skinny/registerDatePicker.d.ts +1 -0
- package/skinny/registerDatePicker.esm.js +47 -2
- package/skinny/registerDatePicker.esm.js.map +1 -1
- package/skinny/registerDrawer.cjs.js +63 -6
- package/skinny/registerDrawer.cjs.js.map +1 -1
- package/skinny/registerDrawer.d.ts +1 -0
- package/skinny/registerDrawer.esm.js +63 -6
- package/skinny/registerDrawer.esm.js.map +1 -1
- package/skinny/registerDropdown.cjs.js +41 -3
- package/skinny/registerDropdown.cjs.js.map +1 -1
- package/skinny/registerDropdown.d.ts +1 -0
- package/skinny/registerDropdown.esm.js +41 -3
- package/skinny/registerDropdown.esm.js.map +1 -1
- package/skinny/registerForm.cjs.js.map +1 -1
- package/skinny/registerForm.esm.js.map +1 -1
- package/skinny/registerMenu.cjs.js +23 -0
- package/skinny/registerMenu.cjs.js.map +1 -1
- package/skinny/registerMenu.esm.js +23 -0
- package/skinny/registerMenu.esm.js.map +1 -1
- package/skinny/registerModal.cjs.js +30 -9
- package/skinny/registerModal.cjs.js.map +1 -1
- package/skinny/registerModal.d.ts +2 -0
- package/skinny/registerModal.esm.js +30 -9
- package/skinny/registerModal.esm.js.map +1 -1
- package/skinny/registerPopover.cjs.js +176 -0
- package/skinny/registerPopover.cjs.js.map +1 -0
- package/skinny/registerPopover.d.ts +8 -0
- package/skinny/registerPopover.esm.js +169 -0
- package/skinny/registerPopover.esm.js.map +1 -0
- package/skinny/registerTabs.cjs.js +461 -0
- package/skinny/registerTabs.cjs.js.map +1 -0
- package/skinny/registerTabs.d.ts +27 -0
- package/skinny/registerTabs.esm.js +451 -0
- package/skinny/registerTabs.esm.js.map +1 -0
- package/skinny/registerTooltip.cjs.js +4 -0
- package/skinny/registerTooltip.cjs.js.map +1 -1
- package/skinny/registerTooltip.esm.js +4 -0
- package/skinny/registerTooltip.esm.js.map +1 -1
- package/skinny/registerTree.cjs.js.map +1 -1
- package/skinny/registerTree.d.ts +2 -2
- package/skinny/registerTree.esm.js.map +1 -1
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Popover } from 'antd';
|
|
3
|
+
import { r as registerComponentHelper } from './utils-94ad8c63.esm.js';
|
|
4
|
+
import '@plasmicapp/host/registerComponent';
|
|
5
|
+
import '@plasmicapp/host/registerGlobalContext';
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
function AntdPopover(props) {
|
|
36
|
+
const _a = props, { overlayClassName, popoverScopeClassName, contentText, content } = _a, rest = __objRest(_a, ["overlayClassName", "popoverScopeClassName", "contentText", "content"]);
|
|
37
|
+
return /* @__PURE__ */ React.createElement(
|
|
38
|
+
Popover,
|
|
39
|
+
__spreadValues({
|
|
40
|
+
content: content || contentText,
|
|
41
|
+
overlayClassName: `${overlayClassName} ${popoverScopeClassName}`
|
|
42
|
+
}, rest)
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
function registerPopover(loader) {
|
|
46
|
+
registerComponentHelper(loader, AntdPopover, {
|
|
47
|
+
name: "plasmic-antd5-popover",
|
|
48
|
+
displayName: "Popover",
|
|
49
|
+
isAttachment: true,
|
|
50
|
+
props: {
|
|
51
|
+
open: {
|
|
52
|
+
type: "boolean",
|
|
53
|
+
editOnly: true,
|
|
54
|
+
uncontrolledProp: "defaultOpen",
|
|
55
|
+
description: "Default open state of the popover"
|
|
56
|
+
},
|
|
57
|
+
arrow: {
|
|
58
|
+
type: "boolean",
|
|
59
|
+
defaultValue: true,
|
|
60
|
+
advanced: true
|
|
61
|
+
},
|
|
62
|
+
children: {
|
|
63
|
+
type: "slot",
|
|
64
|
+
defaultValue: "This text element is wrapped in a Popover component",
|
|
65
|
+
mergeWithParent: true
|
|
66
|
+
},
|
|
67
|
+
popoverScopeClassName: {
|
|
68
|
+
type: "styleScopeClass",
|
|
69
|
+
scopeName: "popover"
|
|
70
|
+
},
|
|
71
|
+
popoverContentClassName: {
|
|
72
|
+
type: "class",
|
|
73
|
+
displayName: "Popover content",
|
|
74
|
+
selectors: [
|
|
75
|
+
{
|
|
76
|
+
selector: ":popover.ant-popover .ant-popover-inner",
|
|
77
|
+
label: "Base"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
overlayClassName: {
|
|
82
|
+
type: "class",
|
|
83
|
+
displayName: "Overlay"
|
|
84
|
+
},
|
|
85
|
+
content: {
|
|
86
|
+
type: "slot",
|
|
87
|
+
displayName: "Popover contents",
|
|
88
|
+
defaultValue: "Popover contents",
|
|
89
|
+
hidePlaceholder: true
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* NOTE: contentText ensures that the popover shows as a custom behaviour without modifications
|
|
93
|
+
* (when a random element is given a custom behaviour of Popover, the props of type "slot" do not receive any default value.
|
|
94
|
+
* Therefore we use the contentText which has a string default value, so that the popover shows with at least something)
|
|
95
|
+
* */
|
|
96
|
+
contentText: {
|
|
97
|
+
type: "string",
|
|
98
|
+
displayName: "Popover contents",
|
|
99
|
+
description: "What gets shown inside the popover on hover",
|
|
100
|
+
defaultValue: "Popover contents"
|
|
101
|
+
},
|
|
102
|
+
title: {
|
|
103
|
+
type: "slot",
|
|
104
|
+
displayName: "Popover title",
|
|
105
|
+
hidePlaceholder: true,
|
|
106
|
+
defaultValue: "Popover title"
|
|
107
|
+
},
|
|
108
|
+
color: {
|
|
109
|
+
type: "color",
|
|
110
|
+
description: "Popover fill color"
|
|
111
|
+
},
|
|
112
|
+
trigger: {
|
|
113
|
+
type: "choice",
|
|
114
|
+
options: ["hover", "focus", "click"],
|
|
115
|
+
defaultValueHint: "hover",
|
|
116
|
+
advanced: true
|
|
117
|
+
},
|
|
118
|
+
placement: {
|
|
119
|
+
type: "choice",
|
|
120
|
+
options: [
|
|
121
|
+
"topLeft",
|
|
122
|
+
"top",
|
|
123
|
+
"topRight",
|
|
124
|
+
"leftTop",
|
|
125
|
+
"left",
|
|
126
|
+
"leftBottom",
|
|
127
|
+
"rightTop",
|
|
128
|
+
"right",
|
|
129
|
+
"rightBottom",
|
|
130
|
+
"bottomLeft",
|
|
131
|
+
"bottom",
|
|
132
|
+
"bottomRight"
|
|
133
|
+
],
|
|
134
|
+
description: "Default placement of popover",
|
|
135
|
+
defaultValueHint: "top"
|
|
136
|
+
},
|
|
137
|
+
mouseEnterDelay: {
|
|
138
|
+
type: "number",
|
|
139
|
+
description: "Delay in seconds, before popover is shown on mouse enter",
|
|
140
|
+
defaultValue: 0,
|
|
141
|
+
advanced: true
|
|
142
|
+
},
|
|
143
|
+
mouseLeaveDelay: {
|
|
144
|
+
type: "number",
|
|
145
|
+
description: "Delay in seconds, before popover is hidden on mouse leave",
|
|
146
|
+
defaultValue: 0,
|
|
147
|
+
advanced: true
|
|
148
|
+
},
|
|
149
|
+
onOpenChange: {
|
|
150
|
+
type: "eventHandler",
|
|
151
|
+
argTypes: [{ name: "open", type: "boolean" }],
|
|
152
|
+
advanced: true
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
states: {
|
|
156
|
+
open: {
|
|
157
|
+
type: "writable",
|
|
158
|
+
valueProp: "open",
|
|
159
|
+
onChangeProp: "onOpenChange",
|
|
160
|
+
variableType: "boolean"
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerPopover",
|
|
164
|
+
importName: "AntdPopover"
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export { AntdPopover, registerPopover };
|
|
169
|
+
//# sourceMappingURL=registerPopover.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerPopover.esm.js","sources":["../src/registerPopover.tsx"],"sourcesContent":["import React from \"react\";\nimport { Popover } from \"antd\";\nimport { Registerable, registerComponentHelper } from \"./utils\";\n\nexport function AntdPopover(\n props: React.ComponentProps<typeof Popover> & {\n popoverScopeClassName?: string;\n contentText?: string\n }\n) {\n const { overlayClassName, popoverScopeClassName, contentText, content, ...rest } = props;\n return (\n <Popover\n content={content || contentText}\n overlayClassName={`${overlayClassName} ${popoverScopeClassName}`}\n {...rest}\n />\n );\n}\n\nexport function registerPopover(loader?: Registerable) {\n registerComponentHelper(loader, AntdPopover, {\n name: \"plasmic-antd5-popover\",\n displayName: \"Popover\",\n isAttachment: true,\n props: {\n open: {\n type: \"boolean\",\n editOnly: true,\n uncontrolledProp: \"defaultOpen\",\n description: \"Default open state of the popover\",\n },\n arrow: {\n type: \"boolean\",\n defaultValue: true,\n advanced: true,\n },\n children: {\n type: \"slot\",\n defaultValue: \"This text element is wrapped in a Popover component\",\n mergeWithParent: true,\n } as any,\n popoverScopeClassName: {\n type: \"styleScopeClass\",\n scopeName: \"popover\",\n } as any,\n popoverContentClassName: {\n type: \"class\",\n displayName: \"Popover content\",\n selectors: [\n {\n selector: \":popover.ant-popover .ant-popover-inner\",\n label: \"Base\",\n },\n ],\n },\n overlayClassName: {\n type: \"class\",\n displayName: \"Overlay\",\n },\n content: {\n type: \"slot\",\n displayName: \"Popover contents\",\n defaultValue: \"Popover contents\",\n hidePlaceholder: true,\n },\n /**\n * NOTE: contentText ensures that the popover shows as a custom behaviour without modifications \n * (when a random element is given a custom behaviour of Popover, the props of type \"slot\" do not receive any default value.\n * Therefore we use the contentText which has a string default value, so that the popover shows with at least something)\n * */ \n contentText: {\n type: \"string\",\n displayName: \"Popover contents\",\n description: \"What gets shown inside the popover on hover\",\n defaultValue: \"Popover contents\",\n },\n title: {\n type: \"slot\",\n displayName: \"Popover title\",\n hidePlaceholder: true,\n defaultValue: \"Popover title\",\n },\n color: {\n type: \"color\",\n description: \"Popover fill color\",\n },\n trigger: {\n type: \"choice\",\n options: [\"hover\", \"focus\", \"click\"],\n defaultValueHint: \"hover\",\n advanced: true,\n },\n placement: {\n type: \"choice\",\n options: [\n \"topLeft\",\n \"top\",\n \"topRight\",\n \"leftTop\",\n \"left\",\n \"leftBottom\",\n \"rightTop\",\n \"right\",\n \"rightBottom\",\n \"bottomLeft\",\n \"bottom\",\n \"bottomRight\",\n ],\n description: \"Default placement of popover\",\n defaultValueHint: \"top\",\n },\n mouseEnterDelay: {\n type: \"number\",\n description: \"Delay in seconds, before popover is shown on mouse enter\",\n defaultValue: 0,\n advanced: true,\n },\n mouseLeaveDelay: {\n type: \"number\",\n description:\n \"Delay in seconds, before popover is hidden on mouse leave\",\n defaultValue: 0,\n advanced: true,\n },\n onOpenChange: {\n type: \"eventHandler\",\n argTypes: [{ name: \"open\", type: \"boolean\" }],\n advanced: true,\n },\n },\n states: {\n open: {\n type: \"writable\",\n valueProp: \"open\",\n onChangeProp: \"onOpenChange\",\n variableType: \"boolean\",\n },\n },\n importPath: \"@plasmicpkgs/antd5/skinny/registerPopover\",\n importName: \"AntdPopover\",\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,SAAS,YACd,KAIA,EAAA;AACA,EAAA,MAAmF,EAA3E,GAAA,KAAA,EAAA,EAAA,gBAAA,EAAkB,qBAAuB,EAAA,WAAA,EAAa,OAVhE,EAAA,GAUqF,EAAT,EAAA,IAAA,GAAA,SAAA,CAAS,EAAT,EAAA,CAAlE,kBAAkB,EAAA,uBAAA,EAAuB,aAAa,EAAA,SAAA,CAAA,CAAA,CAAA;AAC9D,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,OAAA;AAAA,IAAA,cAAA,CAAA;AAAA,MACG,SAAS,OAAW,IAAA,WAAA;AAAA,MACpB,gBAAA,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ACN,WACE,EAAA,2DAAA;AAAA,QACF,YAAc,EAAA,CAAA;AAAA,QACd,QAAU,EAAA,IAAA;AAAA,OACZ;AAAA,MACA,YAAc,EAAA;AAAA,QACZ,IAAM,EAAA,cAAA;AAAA,QACN,UAAU,CAAC,EAAE,MAAM,MAAQ,EAAA,IAAA,EAAM,WAAW,CAAA;AAAA,QAC5C,QAAU,EAAA,IAAA;AAAA,OACZ;AAAA,KACF;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,IAAM,EAAA;AAAA,QACJ,IAAM,EAAA,UAAA;AAAA,QACN,SAAW,EAAA,MAAA;AAAA,QACX,YAAc,EAAA,cAAA;AAAA,QACd,YAAc,EAAA,SAAA;AAAA,OAChB;AAAA,KACF;AAAA,IACA,UAAY,EAAA,2CAAA;AAAA,IACZ,UAAY,EAAA,aAAA;AAAA,GACb,CAAA,CAAA;AACH;;;;"}
|
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var antd = require('antd');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var utils = require('./utils-833cc295.cjs.js');
|
|
6
|
+
require('@plasmicapp/host/registerComponent');
|
|
7
|
+
require('@plasmicapp/host/registerGlobalContext');
|
|
8
|
+
|
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
|
|
11
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
12
|
+
|
|
13
|
+
var __defProp = Object.defineProperty;
|
|
14
|
+
var __defProps = Object.defineProperties;
|
|
15
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
16
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
17
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
18
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
19
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
20
|
+
var __spreadValues = (a, b) => {
|
|
21
|
+
for (var prop in b || (b = {}))
|
|
22
|
+
if (__hasOwnProp.call(b, prop))
|
|
23
|
+
__defNormalProp(a, prop, b[prop]);
|
|
24
|
+
if (__getOwnPropSymbols)
|
|
25
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
26
|
+
if (__propIsEnum.call(b, prop))
|
|
27
|
+
__defNormalProp(a, prop, b[prop]);
|
|
28
|
+
}
|
|
29
|
+
return a;
|
|
30
|
+
};
|
|
31
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
32
|
+
var __objRest = (source, exclude) => {
|
|
33
|
+
var target = {};
|
|
34
|
+
for (var prop in source)
|
|
35
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
36
|
+
target[prop] = source[prop];
|
|
37
|
+
if (source != null && __getOwnPropSymbols)
|
|
38
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
39
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
40
|
+
target[prop] = source[prop];
|
|
41
|
+
}
|
|
42
|
+
return target;
|
|
43
|
+
};
|
|
44
|
+
const tabsComponentName = "plasmic-antd5-tabs";
|
|
45
|
+
const tabItemComponentName = "plasmic-antd5-tab-item";
|
|
46
|
+
const AntdTabItem = ({ children }) => {
|
|
47
|
+
return /* @__PURE__ */ React__default.default.createElement("div", null, children);
|
|
48
|
+
};
|
|
49
|
+
function getTabItems(items) {
|
|
50
|
+
var _a;
|
|
51
|
+
if ((items == null ? void 0 : items.type) === AntdTabItem) {
|
|
52
|
+
return [items];
|
|
53
|
+
}
|
|
54
|
+
if (Array.isArray((_a = items == null ? void 0 : items.props) == null ? void 0 : _a.children)) {
|
|
55
|
+
return items.props.children.filter((item) => item.type === AntdTabItem);
|
|
56
|
+
}
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
function AntdTabs(props) {
|
|
60
|
+
const _a = props, {
|
|
61
|
+
items: itemsRaw,
|
|
62
|
+
animated,
|
|
63
|
+
animateTabBar,
|
|
64
|
+
animateTabContent,
|
|
65
|
+
tabBarExtraContentLeft,
|
|
66
|
+
tabBarExtraContentRight,
|
|
67
|
+
sticky,
|
|
68
|
+
stickyOffset,
|
|
69
|
+
tabBarBackground,
|
|
70
|
+
className,
|
|
71
|
+
tabPosition,
|
|
72
|
+
tabsScopeClassName,
|
|
73
|
+
tabsDropdownScopeClassName
|
|
74
|
+
} = _a, rest = __objRest(_a, [
|
|
75
|
+
"items",
|
|
76
|
+
"animated",
|
|
77
|
+
"animateTabBar",
|
|
78
|
+
"animateTabContent",
|
|
79
|
+
"tabBarExtraContentLeft",
|
|
80
|
+
"tabBarExtraContentRight",
|
|
81
|
+
"sticky",
|
|
82
|
+
"stickyOffset",
|
|
83
|
+
"tabBarBackground",
|
|
84
|
+
"className",
|
|
85
|
+
"tabPosition",
|
|
86
|
+
"tabsScopeClassName",
|
|
87
|
+
"tabsDropdownScopeClassName"
|
|
88
|
+
]);
|
|
89
|
+
const animationProp = React.useMemo(
|
|
90
|
+
() => animated ? {
|
|
91
|
+
inkBar: animateTabBar,
|
|
92
|
+
tabPane: animateTabContent
|
|
93
|
+
} : false,
|
|
94
|
+
[animateTabBar, animateTabContent, animated]
|
|
95
|
+
);
|
|
96
|
+
const items = React.useMemo(() => {
|
|
97
|
+
if (!React__default.default.isValidElement(itemsRaw))
|
|
98
|
+
return [];
|
|
99
|
+
const tabItems = getTabItems(itemsRaw);
|
|
100
|
+
return tabItems.map((currentItem) => {
|
|
101
|
+
if (!React__default.default.isValidElement(currentItem) || !React__default.default.isValidElement(currentItem.props.children)) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
return __spreadProps(__spreadValues({}, currentItem.props), {
|
|
105
|
+
key: currentItem.key,
|
|
106
|
+
children: /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, currentItem.props.children)
|
|
107
|
+
});
|
|
108
|
+
}).filter((i) => i != null);
|
|
109
|
+
}, [itemsRaw]);
|
|
110
|
+
return /* @__PURE__ */ React__default.default.createElement(
|
|
111
|
+
antd.Tabs,
|
|
112
|
+
__spreadValues({
|
|
113
|
+
className: `${className} ${tabsScopeClassName}`,
|
|
114
|
+
popupClassName: tabsDropdownScopeClassName,
|
|
115
|
+
tabBarExtraContent: {
|
|
116
|
+
left: /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, tabBarExtraContentLeft),
|
|
117
|
+
right: /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, tabBarExtraContentRight)
|
|
118
|
+
},
|
|
119
|
+
tabPosition,
|
|
120
|
+
renderTabBar: sticky && tabPosition === "top" ? (props2, DefaultTabBar) => /* @__PURE__ */ React__default.default.createElement(
|
|
121
|
+
"div",
|
|
122
|
+
{
|
|
123
|
+
style: {
|
|
124
|
+
zIndex: 1,
|
|
125
|
+
position: "sticky",
|
|
126
|
+
top: stickyOffset || 0
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
/* @__PURE__ */ React__default.default.createElement(
|
|
130
|
+
DefaultTabBar,
|
|
131
|
+
__spreadProps(__spreadValues({}, props2), {
|
|
132
|
+
style: { backgroundColor: tabBarBackground }
|
|
133
|
+
})
|
|
134
|
+
)
|
|
135
|
+
) : void 0,
|
|
136
|
+
animated: animationProp,
|
|
137
|
+
items
|
|
138
|
+
}, rest)
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
function OutlineMessage() {
|
|
142
|
+
return /* @__PURE__ */ React__default.default.createElement("div", null, "* To re-arrange tab panes, use the Outline panel");
|
|
143
|
+
}
|
|
144
|
+
function getActiveKeyOptions(props) {
|
|
145
|
+
const options = /* @__PURE__ */ new Set();
|
|
146
|
+
utils.traverseReactEltTree(getTabItems(props.items), (elt) => {
|
|
147
|
+
if ((elt == null ? void 0 : elt.type) === AntdTabItem && typeof (elt == null ? void 0 : elt.key) === "string") {
|
|
148
|
+
options.add(elt.key);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
return Array.from(options.keys());
|
|
152
|
+
}
|
|
153
|
+
function registerTabs(loader) {
|
|
154
|
+
utils.registerComponentHelper(loader, AntdTabs, {
|
|
155
|
+
name: tabsComponentName,
|
|
156
|
+
displayName: "Tabs",
|
|
157
|
+
defaultStyles: {
|
|
158
|
+
width: "stretch",
|
|
159
|
+
overflow: "scroll"
|
|
160
|
+
},
|
|
161
|
+
props: {
|
|
162
|
+
activeKey: {
|
|
163
|
+
editOnly: true,
|
|
164
|
+
displayName: "Active tab key",
|
|
165
|
+
uncontrolledProp: "defaultActiveKey",
|
|
166
|
+
type: "choice",
|
|
167
|
+
description: `Initial active tab's key`,
|
|
168
|
+
options: getActiveKeyOptions
|
|
169
|
+
},
|
|
170
|
+
animated: {
|
|
171
|
+
type: "boolean",
|
|
172
|
+
defaultValue: true,
|
|
173
|
+
description: "Change tabs with animation"
|
|
174
|
+
},
|
|
175
|
+
animateTabBar: {
|
|
176
|
+
type: "boolean",
|
|
177
|
+
defaultValue: true,
|
|
178
|
+
description: "Animate the tab bar when switching tabs",
|
|
179
|
+
hidden: (ps) => !ps.animated
|
|
180
|
+
},
|
|
181
|
+
animateTabContent: {
|
|
182
|
+
type: "boolean",
|
|
183
|
+
defaultValue: false,
|
|
184
|
+
description: "Fade-in tab content when switching tabs",
|
|
185
|
+
hidden: (ps) => !ps.animated
|
|
186
|
+
},
|
|
187
|
+
centered: {
|
|
188
|
+
type: "boolean",
|
|
189
|
+
description: "Center-align the tab bar"
|
|
190
|
+
},
|
|
191
|
+
type: {
|
|
192
|
+
type: "choice",
|
|
193
|
+
defaultValueHint: "line",
|
|
194
|
+
options: ["line", "card"],
|
|
195
|
+
description: "Basic style of tabs"
|
|
196
|
+
},
|
|
197
|
+
items: __spreadProps(__spreadValues({
|
|
198
|
+
type: "slot",
|
|
199
|
+
hidePlaceholder: true,
|
|
200
|
+
allowedComponents: [tabItemComponentName]
|
|
201
|
+
}, { mergeWithParent: true }), {
|
|
202
|
+
// to make the tab items selectable from the components outline pane in Plasmic Studio.
|
|
203
|
+
defaultValue: [
|
|
204
|
+
{
|
|
205
|
+
type: "component",
|
|
206
|
+
name: tabItemComponentName,
|
|
207
|
+
props: {
|
|
208
|
+
key: "1",
|
|
209
|
+
label: {
|
|
210
|
+
type: "text",
|
|
211
|
+
value: "First Item"
|
|
212
|
+
},
|
|
213
|
+
children: {
|
|
214
|
+
type: "text",
|
|
215
|
+
value: "First Children"
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
type: "component",
|
|
221
|
+
name: tabItemComponentName,
|
|
222
|
+
props: {
|
|
223
|
+
key: "2",
|
|
224
|
+
label: {
|
|
225
|
+
type: "text",
|
|
226
|
+
value: "Second Item"
|
|
227
|
+
},
|
|
228
|
+
children: {
|
|
229
|
+
type: "text",
|
|
230
|
+
value: "Second Children"
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
}),
|
|
236
|
+
size: {
|
|
237
|
+
type: "choice",
|
|
238
|
+
defaultValueHint: "middle",
|
|
239
|
+
options: ["large", "middle", "small"],
|
|
240
|
+
description: "Preset tab bar size"
|
|
241
|
+
},
|
|
242
|
+
tabBarExtraContentLeft: {
|
|
243
|
+
type: "slot",
|
|
244
|
+
displayName: "Extra content on left side",
|
|
245
|
+
hidePlaceholder: true
|
|
246
|
+
},
|
|
247
|
+
tabBarExtraContentRight: {
|
|
248
|
+
type: "slot",
|
|
249
|
+
displayName: "Extra content on right side",
|
|
250
|
+
hidePlaceholder: true
|
|
251
|
+
},
|
|
252
|
+
tabBarGutter: {
|
|
253
|
+
type: "number",
|
|
254
|
+
displayName: "Tab gap",
|
|
255
|
+
description: "Gap (in pixels) between tabs",
|
|
256
|
+
advanced: true
|
|
257
|
+
},
|
|
258
|
+
tabPosition: {
|
|
259
|
+
type: "choice",
|
|
260
|
+
defaultValueHint: "top",
|
|
261
|
+
options: ["top", "right", "bottom", "left"],
|
|
262
|
+
description: "Position of tabs"
|
|
263
|
+
},
|
|
264
|
+
destroyInactiveTabPane: {
|
|
265
|
+
type: "boolean",
|
|
266
|
+
description: `Destroy/Unmount inactive tab pane when changing tab`,
|
|
267
|
+
advanced: true
|
|
268
|
+
},
|
|
269
|
+
sticky: {
|
|
270
|
+
type: "boolean",
|
|
271
|
+
advanced: true,
|
|
272
|
+
description: "Stick tab bar to the top of the page when scrolling.",
|
|
273
|
+
defaultValue: false,
|
|
274
|
+
hidden: (ps) => ps.tabPosition !== "top"
|
|
275
|
+
},
|
|
276
|
+
stickyOffset: {
|
|
277
|
+
type: "number",
|
|
278
|
+
advanced: true,
|
|
279
|
+
description: "Distance (in pixels) between the sticky tab bar and the top of the page as you scroll.",
|
|
280
|
+
hidden: (ps) => ps.tabPosition !== "top" || !ps.sticky
|
|
281
|
+
},
|
|
282
|
+
tabBarBackground: {
|
|
283
|
+
type: "color",
|
|
284
|
+
advanced: true,
|
|
285
|
+
defaultValue: "#FFF",
|
|
286
|
+
hidden: (ps) => ps.tabPosition !== "top" || !ps.sticky
|
|
287
|
+
},
|
|
288
|
+
tabsScopeClassName: {
|
|
289
|
+
type: "styleScopeClass",
|
|
290
|
+
scopeName: "tabs"
|
|
291
|
+
},
|
|
292
|
+
tabBarClassName: {
|
|
293
|
+
type: "class",
|
|
294
|
+
displayName: "Tab bar",
|
|
295
|
+
selectors: [
|
|
296
|
+
{
|
|
297
|
+
selector: ":tabs.ant-tabs .ant-tabs-nav",
|
|
298
|
+
label: "Base"
|
|
299
|
+
}
|
|
300
|
+
]
|
|
301
|
+
},
|
|
302
|
+
tabsDropdownScopeClassName: {
|
|
303
|
+
type: "styleScopeClass",
|
|
304
|
+
scopeName: "tabsDropdown"
|
|
305
|
+
},
|
|
306
|
+
tabsDropdownClassName: {
|
|
307
|
+
type: "class",
|
|
308
|
+
displayName: "Overflow tabs menu",
|
|
309
|
+
selectors: [
|
|
310
|
+
{
|
|
311
|
+
selector: ":tabsDropdown.ant-tabs-dropdown .ant-tabs-dropdown-menu",
|
|
312
|
+
label: "Base"
|
|
313
|
+
}
|
|
314
|
+
]
|
|
315
|
+
},
|
|
316
|
+
onChange: {
|
|
317
|
+
type: "eventHandler",
|
|
318
|
+
advanced: true,
|
|
319
|
+
argTypes: [{ name: "activeKey", type: "string" }]
|
|
320
|
+
},
|
|
321
|
+
onTabClick: {
|
|
322
|
+
type: "eventHandler",
|
|
323
|
+
advanced: true,
|
|
324
|
+
argTypes: [
|
|
325
|
+
{ name: "tabKey", type: "string" },
|
|
326
|
+
{ name: "mouseEvent", type: "object" }
|
|
327
|
+
]
|
|
328
|
+
},
|
|
329
|
+
onTabScroll: {
|
|
330
|
+
type: "eventHandler",
|
|
331
|
+
advanced: true,
|
|
332
|
+
argTypes: [{ name: "scrollInfo", type: "object" }]
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
states: {
|
|
336
|
+
activeKey: {
|
|
337
|
+
type: "writable",
|
|
338
|
+
valueProp: "activeKey",
|
|
339
|
+
onChangeProp: "onChange",
|
|
340
|
+
variableType: "text"
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
actions: [
|
|
344
|
+
// {
|
|
345
|
+
// type: "custom-action",
|
|
346
|
+
// control: NavigateTabs,
|
|
347
|
+
// },
|
|
348
|
+
{
|
|
349
|
+
type: "button-action",
|
|
350
|
+
label: "Add new tab",
|
|
351
|
+
onClick: ({ componentProps, studioOps }) => {
|
|
352
|
+
const generateNewKey = () => {
|
|
353
|
+
const keysSet = /* @__PURE__ */ new Set();
|
|
354
|
+
utils.traverseReactEltTree(getTabItems(componentProps.items), (elt) => {
|
|
355
|
+
if ((elt == null ? void 0 : elt.type) === AntdTabItem && typeof (elt == null ? void 0 : elt.key) === "string") {
|
|
356
|
+
keysSet.add(elt.key);
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
for (let keyCandidate = 1; keyCandidate <= keysSet.size + 1; keyCandidate++) {
|
|
360
|
+
const strKey = keyCandidate.toString();
|
|
361
|
+
if (!keysSet.has(strKey)) {
|
|
362
|
+
return strKey;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return void 0;
|
|
366
|
+
};
|
|
367
|
+
const tabKey = generateNewKey();
|
|
368
|
+
studioOps.appendToSlot(
|
|
369
|
+
{
|
|
370
|
+
type: "component",
|
|
371
|
+
name: tabItemComponentName,
|
|
372
|
+
props: {
|
|
373
|
+
key: tabKey,
|
|
374
|
+
label: {
|
|
375
|
+
type: "text",
|
|
376
|
+
value: `Tab Label ${tabKey}`
|
|
377
|
+
},
|
|
378
|
+
children: {
|
|
379
|
+
type: "text",
|
|
380
|
+
value: `Tab Children ${tabKey}`
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
"items"
|
|
385
|
+
);
|
|
386
|
+
studioOps.updateProps({ activeKey: tabKey });
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
type: "button-action",
|
|
391
|
+
label: "Delete current tab",
|
|
392
|
+
onClick: ({ componentProps, studioOps }) => {
|
|
393
|
+
if (componentProps.activeKey) {
|
|
394
|
+
const tabPanes = [];
|
|
395
|
+
utils.traverseReactEltTree(getTabItems(componentProps.items), (elt) => {
|
|
396
|
+
if ((elt == null ? void 0 : elt.type) === AntdTabItem && typeof (elt == null ? void 0 : elt.key) === "string") {
|
|
397
|
+
tabPanes.push(elt.key);
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
const activeKey = componentProps.activeKey;
|
|
401
|
+
const currTabPos = tabPanes.findIndex((tabKey) => {
|
|
402
|
+
return tabKey === activeKey;
|
|
403
|
+
});
|
|
404
|
+
if (currTabPos !== -1) {
|
|
405
|
+
studioOps.removeFromSlotAt(currTabPos, "items");
|
|
406
|
+
if (tabPanes.length - 1 > 0) {
|
|
407
|
+
const prevTabPos = (currTabPos - 1 + tabPanes.length) % tabPanes.length;
|
|
408
|
+
studioOps.updateProps({ activeKey: tabPanes[prevTabPos] });
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
type: "custom-action",
|
|
416
|
+
control: OutlineMessage
|
|
417
|
+
}
|
|
418
|
+
],
|
|
419
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerTabs",
|
|
420
|
+
importName: "AntdTabs"
|
|
421
|
+
});
|
|
422
|
+
utils.registerComponentHelper(loader, AntdTabItem, {
|
|
423
|
+
name: tabItemComponentName,
|
|
424
|
+
displayName: "Tab Item",
|
|
425
|
+
props: {
|
|
426
|
+
disabled: {
|
|
427
|
+
type: "boolean",
|
|
428
|
+
description: "Disable this tab"
|
|
429
|
+
},
|
|
430
|
+
forceRender: {
|
|
431
|
+
type: "boolean",
|
|
432
|
+
description: `Force render of content in the tab, not lazy render after clicking on the tab`,
|
|
433
|
+
advanced: true
|
|
434
|
+
},
|
|
435
|
+
key: {
|
|
436
|
+
type: "string",
|
|
437
|
+
description: `Unique identifier for this tab`,
|
|
438
|
+
displayName: "Tab key"
|
|
439
|
+
},
|
|
440
|
+
label: {
|
|
441
|
+
type: "slot",
|
|
442
|
+
displayName: "Tab title",
|
|
443
|
+
defaultValue: "Tab"
|
|
444
|
+
},
|
|
445
|
+
children: {
|
|
446
|
+
type: "slot",
|
|
447
|
+
hidePlaceholder: true
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerTabs",
|
|
451
|
+
importName: "AntdTabItem",
|
|
452
|
+
parentComponentName: tabsComponentName
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
exports.AntdTabItem = AntdTabItem;
|
|
457
|
+
exports.AntdTabs = AntdTabs;
|
|
458
|
+
exports.registerTabs = registerTabs;
|
|
459
|
+
exports.tabItemComponentName = tabItemComponentName;
|
|
460
|
+
exports.tabsComponentName = tabsComponentName;
|
|
461
|
+
//# sourceMappingURL=registerTabs.cjs.js.map
|