@plasmicpkgs/antd 2.0.19 → 2.0.21
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 -0
- package/dist/antd.esm.js +703 -616
- package/dist/antd.esm.js.map +1 -1
- package/dist/customControls.d.ts +17 -17
- package/dist/index.d.ts +16 -16
- package/dist/index.js +2352 -5
- package/dist/index.js.map +1 -0
- package/dist/registerButton.d.ts +5 -5
- package/dist/registerCarousel.d.ts +5 -5
- package/dist/registerCheckbox.d.ts +8 -8
- package/dist/registerCollapse.d.ts +14 -14
- package/dist/registerDropdown.d.ts +11 -11
- package/dist/registerInput.d.ts +14 -14
- package/dist/registerMenu.d.ts +15 -15
- package/dist/registerOption.d.ts +8 -8
- package/dist/registerRate.d.ts +5 -5
- package/dist/registerSelect.d.ts +8 -8
- package/dist/registerSlider.d.ts +19 -19
- package/dist/registerSwitch.d.ts +5 -5
- package/dist/registerTable.d.ts +30 -30
- package/dist/registerTabs.d.ts +14 -13
- package/dist/registerable.d.ts +4 -4
- package/package.json +10 -9
- package/skinny/customControls-fb0b7e5f.js +22 -0
- package/skinny/{customControls-ff79afdf.js.map → customControls-fb0b7e5f.js.map} +1 -1
- package/skinny/customControls.d.ts +17 -17
- package/skinny/registerButton.d.ts +5 -5
- package/skinny/registerButton.js +80 -81
- package/skinny/registerButton.js.map +1 -1
- package/skinny/registerCarousel.d.ts +5 -5
- package/skinny/registerCarousel.js +66 -67
- package/skinny/registerCarousel.js.map +1 -1
- package/skinny/registerCheckbox.d.ts +8 -8
- package/skinny/registerCheckbox.js +125 -121
- package/skinny/registerCheckbox.js.map +1 -1
- package/skinny/registerCollapse.d.ts +14 -14
- package/skinny/registerCollapse.js +174 -153
- package/skinny/registerCollapse.js.map +1 -1
- package/skinny/registerDropdown.d.ts +11 -11
- package/skinny/registerDropdown.js +175 -171
- package/skinny/registerDropdown.js.map +1 -1
- package/skinny/registerInput.d.ts +14 -14
- package/skinny/registerInput.js +362 -312
- package/skinny/registerInput.js.map +1 -1
- package/skinny/registerMenu.d.ts +15 -15
- package/skinny/registerMenu.js +275 -298
- package/skinny/registerMenu.js.map +1 -1
- package/skinny/registerOption.d.ts +8 -8
- package/skinny/registerOption.js +73 -81
- package/skinny/registerOption.js.map +1 -1
- package/skinny/registerRate.d.ts +5 -5
- package/skinny/registerRate.js +66 -0
- package/skinny/registerRate.js.map +1 -0
- package/skinny/registerSelect.d.ts +8 -8
- package/skinny/registerSelect.js +129 -130
- package/skinny/registerSelect.js.map +1 -1
- package/skinny/registerSlider.d.ts +19 -19
- package/skinny/registerSlider.js +132 -104
- package/skinny/registerSlider.js.map +1 -1
- package/skinny/registerSwitch.d.ts +5 -5
- package/skinny/registerSwitch.js +55 -56
- package/skinny/registerSwitch.js.map +1 -1
- package/skinny/registerTable.d.ts +30 -30
- package/skinny/registerTable.js +202 -183
- package/skinny/registerTable.js.map +1 -1
- package/skinny/registerTabs.d.ts +14 -13
- package/skinny/registerTabs.js +344 -311
- package/skinny/registerTabs.js.map +1 -1
- package/skinny/registerable.d.ts +4 -4
- package/skinny/registerable.js +3 -0
- package/skinny/registerable.js.map +1 -0
- package/dist/antd.cjs.development.js +0 -2243
- package/dist/antd.cjs.development.js.map +0 -1
- package/dist/antd.cjs.production.min.js +0 -2
- package/dist/antd.cjs.production.min.js.map +0 -1
- package/skinny/customControls-ff79afdf.js +0 -27
- package/skinny/index.d.ts +0 -16
- package/skinny/tslib.es6-b92c4a81.js +0 -59
- package/skinny/tslib.es6-b92c4a81.js.map +0 -1
package/skinny/registerTabs.js
CHANGED
|
@@ -1,323 +1,356 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var tslib_es6 = require('./tslib.es6-b92c4a81.js');
|
|
4
3
|
var registerComponent = require('@plasmicapp/host/registerComponent');
|
|
5
4
|
var antd = require('antd');
|
|
6
5
|
var AntdTabs = require('antd/lib/tabs');
|
|
7
|
-
var rcTabs = require('rc-tabs');
|
|
8
6
|
var React = require('react');
|
|
9
|
-
var customControls = require('./customControls-
|
|
7
|
+
var customControls = require('./customControls-fb0b7e5f.js');
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
|
|
11
|
+
var registerComponent__default = /*#__PURE__*/_interopDefault(registerComponent);
|
|
12
|
+
var AntdTabs__default = /*#__PURE__*/_interopDefault(AntdTabs);
|
|
13
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
14
|
+
|
|
15
|
+
var __defProp = Object.defineProperty;
|
|
16
|
+
var __defProps = Object.defineProperties;
|
|
17
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
18
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
19
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
20
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
21
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
22
|
+
var __spreadValues = (a, b) => {
|
|
23
|
+
for (var prop in b || (b = {}))
|
|
24
|
+
if (__hasOwnProp.call(b, prop))
|
|
25
|
+
__defNormalProp(a, prop, b[prop]);
|
|
26
|
+
if (__getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
28
|
+
if (__propIsEnum.call(b, prop))
|
|
29
|
+
__defNormalProp(a, prop, b[prop]);
|
|
30
|
+
}
|
|
31
|
+
return a;
|
|
32
|
+
};
|
|
33
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
34
|
+
var __objRest = (source, exclude) => {
|
|
35
|
+
var target = {};
|
|
36
|
+
for (var prop in source)
|
|
37
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
38
|
+
target[prop] = source[prop];
|
|
39
|
+
if (source != null && __getOwnPropSymbols)
|
|
40
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
41
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
42
|
+
target[prop] = source[prop];
|
|
43
|
+
}
|
|
44
|
+
return target;
|
|
45
|
+
};
|
|
46
|
+
const TabPane = AntdTabs__default.default.TabPane;
|
|
47
|
+
const tabPaneMeta = {
|
|
48
|
+
name: "AntdTabPane",
|
|
49
|
+
displayName: "Antd Tab Pane",
|
|
50
|
+
props: {
|
|
51
|
+
tab: {
|
|
52
|
+
type: "slot",
|
|
53
|
+
defaultValue: [
|
|
54
|
+
{
|
|
55
|
+
type: "text",
|
|
56
|
+
value: "Tab"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
key: {
|
|
61
|
+
type: "string",
|
|
62
|
+
description: "Unique TabPane's key",
|
|
63
|
+
defaultValue: "tabPaneKey"
|
|
64
|
+
},
|
|
65
|
+
closable: {
|
|
66
|
+
type: "boolean",
|
|
67
|
+
description: "Wether the tab can be closed or not. Only works for editable tabs",
|
|
68
|
+
defaultValueHint: true
|
|
69
|
+
},
|
|
70
|
+
disabled: {
|
|
71
|
+
type: "boolean",
|
|
72
|
+
description: "Disabled state of tab",
|
|
73
|
+
defaultValueHint: false
|
|
74
|
+
},
|
|
75
|
+
forceRender: {
|
|
76
|
+
type: "boolean",
|
|
77
|
+
description: "Forced render of content in tabs, not lazy render after clicking on tabs",
|
|
78
|
+
defaultValueHint: false
|
|
79
|
+
},
|
|
80
|
+
closeIcon: {
|
|
81
|
+
type: "slot",
|
|
82
|
+
hidePlaceholder: true
|
|
83
|
+
},
|
|
84
|
+
children: {
|
|
85
|
+
type: "slot",
|
|
86
|
+
defaultValue: [
|
|
87
|
+
{
|
|
88
|
+
type: "text",
|
|
89
|
+
value: "Tab Content"
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
parentComponentName: "AntdTabs",
|
|
95
|
+
importPath: "@plasmicpkgs/antd/skinny/registerTabs",
|
|
96
|
+
importName: "TabPane"
|
|
97
|
+
};
|
|
98
|
+
function registerTabPane(loader, customTabPaneMeta) {
|
|
99
|
+
const doRegisterComponent = (...args) => loader ? loader.registerComponent(...args) : registerComponent__default.default(...args);
|
|
100
|
+
doRegisterComponent(TabPane, customTabPaneMeta != null ? customTabPaneMeta : tabPaneMeta);
|
|
101
|
+
}
|
|
102
|
+
function Tabs(props) {
|
|
103
|
+
const _a = props, {
|
|
104
|
+
leftTabBarExtraContent,
|
|
105
|
+
rightTabBarExtraContent
|
|
106
|
+
} = _a, otherProps = __objRest(_a, [
|
|
107
|
+
"leftTabBarExtraContent",
|
|
108
|
+
"rightTabBarExtraContent"
|
|
109
|
+
]);
|
|
110
|
+
return /* @__PURE__ */ React__default.default.createElement(AntdTabs__default.default, __spreadProps(__spreadValues({}, otherProps), {
|
|
111
|
+
tabBarExtraContent: {
|
|
112
|
+
left: leftTabBarExtraContent,
|
|
113
|
+
right: rightTabBarExtraContent
|
|
114
|
+
}
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
function NavigateTabs({ componentProps, studioOps }) {
|
|
118
|
+
const tabPanes = [];
|
|
119
|
+
customControls.traverseReactEltTree(componentProps.children, (elt) => {
|
|
120
|
+
if ((elt == null ? void 0 : elt.type) === TabPane && typeof (elt == null ? void 0 : elt.key) === "string") {
|
|
121
|
+
tabPanes.push(elt.key);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
const activeKey = componentProps.activeKey;
|
|
125
|
+
const currTabPos = activeKey ? tabPanes.findIndex((tabKey) => {
|
|
126
|
+
return tabKey === activeKey;
|
|
127
|
+
}) : 0;
|
|
128
|
+
return /* @__PURE__ */ React__default.default.createElement("div", {
|
|
129
|
+
style: {
|
|
130
|
+
width: "100%",
|
|
131
|
+
display: "flex",
|
|
132
|
+
flexDirection: "row",
|
|
133
|
+
gap: "10px",
|
|
134
|
+
justifyContent: "space-between"
|
|
135
|
+
}
|
|
136
|
+
}, /* @__PURE__ */ React__default.default.createElement(antd.Button, {
|
|
137
|
+
style: { width: "100%" },
|
|
138
|
+
onClick: () => {
|
|
139
|
+
if (tabPanes.length > 0) {
|
|
140
|
+
const prevTabPos = (currTabPos - 1 + tabPanes.length) % tabPanes.length;
|
|
141
|
+
studioOps.updateProps({ activeKey: tabPanes[prevTabPos] });
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}, "Prev tab"), /* @__PURE__ */ React__default.default.createElement(antd.Button, {
|
|
145
|
+
style: { width: "100%" },
|
|
146
|
+
onClick: () => {
|
|
147
|
+
if (tabPanes.length > 0) {
|
|
148
|
+
const nextTabPos = (currTabPos + 1) % tabPanes.length;
|
|
149
|
+
studioOps.updateProps({ activeKey: tabPanes[nextTabPos] });
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}, "Next tab"));
|
|
153
|
+
}
|
|
154
|
+
function OutlineMessage() {
|
|
155
|
+
return /* @__PURE__ */ React__default.default.createElement("div", null, "* To re-arrange tab panes, use the Outline panel");
|
|
156
|
+
}
|
|
157
|
+
const tabsMeta = {
|
|
158
|
+
name: "AntdTabs",
|
|
159
|
+
displayName: "Antd Tabs",
|
|
160
|
+
props: {
|
|
161
|
+
type: {
|
|
162
|
+
type: "choice",
|
|
163
|
+
options: ["line", "card", "editable-card"],
|
|
164
|
+
defaultValueHint: "line",
|
|
165
|
+
description: "Basic style of tabs"
|
|
166
|
+
},
|
|
167
|
+
addIcon: {
|
|
168
|
+
type: "slot",
|
|
169
|
+
hidePlaceholder: true
|
|
170
|
+
},
|
|
171
|
+
animated: {
|
|
172
|
+
type: "object",
|
|
173
|
+
hidden: (props) => props.tabPosition !== "top" && !!props.tabPosition,
|
|
174
|
+
defaultValueHint: { inkBar: true, tabPane: false },
|
|
175
|
+
description: "Whether to change tabs with animation. Can be either a boolean or specify for inkBar and tabPane"
|
|
176
|
+
},
|
|
177
|
+
hideAdd: {
|
|
178
|
+
type: "boolean",
|
|
179
|
+
hidden: (props) => props.type !== "editable-card",
|
|
180
|
+
defaultValueHint: false,
|
|
181
|
+
description: "Hide plus icon or not"
|
|
182
|
+
},
|
|
183
|
+
moreIcon: {
|
|
184
|
+
type: "slot",
|
|
185
|
+
hidePlaceholder: true
|
|
186
|
+
},
|
|
187
|
+
size: {
|
|
188
|
+
type: "choice",
|
|
189
|
+
options: ["large", "default", "small"],
|
|
190
|
+
defaultValueHint: "default",
|
|
191
|
+
description: "Preset tab bar size"
|
|
192
|
+
},
|
|
193
|
+
tabPosition: {
|
|
194
|
+
type: "choice",
|
|
195
|
+
options: ["top", "right", "bottom", "left"],
|
|
196
|
+
defaultValueHint: "top",
|
|
197
|
+
description: "Position of tabs"
|
|
198
|
+
},
|
|
199
|
+
tabBarGutter: {
|
|
200
|
+
type: "number",
|
|
201
|
+
description: "The gap between tabs"
|
|
202
|
+
},
|
|
203
|
+
centered: {
|
|
204
|
+
type: "boolean",
|
|
205
|
+
description: "Centers tabs",
|
|
206
|
+
defaultValueHint: false
|
|
207
|
+
},
|
|
208
|
+
leftTabBarExtraContent: {
|
|
209
|
+
type: "slot",
|
|
210
|
+
hidePlaceholder: true
|
|
211
|
+
},
|
|
212
|
+
rightTabBarExtraContent: {
|
|
213
|
+
type: "slot",
|
|
214
|
+
hidePlaceholder: true
|
|
215
|
+
},
|
|
216
|
+
tabBarStyle: {
|
|
217
|
+
type: "object",
|
|
218
|
+
description: "CSS for the Tab Bar style"
|
|
219
|
+
},
|
|
220
|
+
activeKey: {
|
|
221
|
+
type: "choice",
|
|
222
|
+
editOnly: true,
|
|
223
|
+
uncontrolledProp: "defaultActiveKey",
|
|
224
|
+
description: "Initial active TabPane's key",
|
|
225
|
+
options: (props) => {
|
|
226
|
+
const options = /* @__PURE__ */ new Set();
|
|
227
|
+
customControls.traverseReactEltTree(props.children, (elt) => {
|
|
228
|
+
if ((elt == null ? void 0 : elt.type) === TabPane && typeof (elt == null ? void 0 : elt.key) === "string") {
|
|
229
|
+
options.add(elt.key);
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
return Array.from(options.keys());
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
children: {
|
|
236
|
+
type: "slot",
|
|
237
|
+
allowedComponents: ["AntdTabPane"],
|
|
238
|
+
defaultValue: [
|
|
239
|
+
{
|
|
240
|
+
type: "component",
|
|
241
|
+
name: "AntdTabPane",
|
|
242
|
+
props: {
|
|
243
|
+
key: "1",
|
|
244
|
+
tab: [
|
|
245
|
+
{
|
|
246
|
+
type: "text",
|
|
247
|
+
value: "Tab"
|
|
248
|
+
}
|
|
249
|
+
],
|
|
250
|
+
children: [
|
|
251
|
+
{
|
|
252
|
+
type: "text",
|
|
253
|
+
value: "Tab content"
|
|
254
|
+
}
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
type: "component",
|
|
260
|
+
name: "AntdTabPane",
|
|
261
|
+
props: {
|
|
262
|
+
key: "2",
|
|
263
|
+
tab: [
|
|
264
|
+
{
|
|
265
|
+
type: "text",
|
|
266
|
+
value: "Tab"
|
|
267
|
+
}
|
|
268
|
+
],
|
|
269
|
+
children: [
|
|
270
|
+
{
|
|
271
|
+
type: "text",
|
|
272
|
+
value: "Tab content"
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
]
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
actions: [
|
|
281
|
+
{
|
|
282
|
+
type: "custom-action",
|
|
283
|
+
control: NavigateTabs
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
type: "button-action",
|
|
287
|
+
label: "Add new tab",
|
|
288
|
+
onClick: ({ componentProps, studioOps }) => {
|
|
289
|
+
const generateNewKey = () => {
|
|
290
|
+
let keysSet = /* @__PURE__ */ new Set();
|
|
291
|
+
customControls.traverseReactEltTree(componentProps.children, (elt) => {
|
|
292
|
+
if ((elt == null ? void 0 : elt.type) === TabPane && typeof (elt == null ? void 0 : elt.key) === "string") {
|
|
293
|
+
keysSet.add(elt.key);
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
for (let keyCandidate = 1; keyCandidate <= keysSet.size + 1; keyCandidate++) {
|
|
297
|
+
const strKey = keyCandidate.toString();
|
|
298
|
+
if (!keysSet.has(strKey)) {
|
|
299
|
+
return strKey;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return void 0;
|
|
303
|
+
};
|
|
304
|
+
const tabKey = generateNewKey();
|
|
305
|
+
studioOps.appendToSlot({
|
|
306
|
+
type: "component",
|
|
307
|
+
name: "AntdTabPane",
|
|
308
|
+
props: {
|
|
309
|
+
key: tabKey
|
|
310
|
+
}
|
|
311
|
+
}, "children");
|
|
312
|
+
studioOps.updateProps({ activeKey: tabKey });
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
type: "button-action",
|
|
317
|
+
label: "Delete current tab",
|
|
318
|
+
onClick: ({ componentProps, studioOps }) => {
|
|
319
|
+
if (componentProps.activeKey) {
|
|
320
|
+
const tabPanes = [];
|
|
321
|
+
customControls.traverseReactEltTree(componentProps.children, (elt) => {
|
|
322
|
+
if ((elt == null ? void 0 : elt.type) === TabPane && typeof (elt == null ? void 0 : elt.key) === "string") {
|
|
323
|
+
tabPanes.push(elt.key);
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
const activeKey = componentProps.activeKey;
|
|
327
|
+
const currTabPos = tabPanes.findIndex((tabKey) => {
|
|
328
|
+
return tabKey === activeKey;
|
|
329
|
+
});
|
|
330
|
+
if (currTabPos !== -1) {
|
|
331
|
+
studioOps.removeFromSlotAt(currTabPos, "children");
|
|
332
|
+
if (tabPanes.length - 1 > 0) {
|
|
333
|
+
const prevTabPos = (currTabPos - 1 + tabPanes.length) % tabPanes.length;
|
|
334
|
+
studioOps.updateProps({ activeKey: tabPanes[prevTabPos] });
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
type: "custom-action",
|
|
342
|
+
control: OutlineMessage
|
|
343
|
+
}
|
|
344
|
+
],
|
|
345
|
+
importPath: "@plasmicpkgs/antd/skinny/registerTabs",
|
|
346
|
+
importName: "Tabs"
|
|
347
|
+
};
|
|
348
|
+
function registerTabs(loader, customTabsMeta) {
|
|
349
|
+
const doRegisterComponent = (...args) => loader ? loader.registerComponent(...args) : registerComponent__default.default(...args);
|
|
350
|
+
doRegisterComponent(Tabs, customTabsMeta != null ? customTabsMeta : tabsMeta);
|
|
319
351
|
}
|
|
320
352
|
|
|
353
|
+
exports.TabPane = TabPane;
|
|
321
354
|
exports.Tabs = Tabs;
|
|
322
355
|
exports.registerTabPane = registerTabPane;
|
|
323
356
|
exports.registerTabs = registerTabs;
|