@plasmicpkgs/antd 2.0.5 → 2.0.7

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