bkui-vue 0.0.1-beta.393 → 0.0.1-beta.394

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 (155) hide show
  1. package/dist/index.cjs.js +36 -36
  2. package/dist/index.esm.js +33 -3
  3. package/dist/index.umd.js +35 -35
  4. package/dist/style.css +1 -1
  5. package/dist/style.variable.css +1 -1
  6. package/lib/affix/index.js +1 -353
  7. package/lib/alert/index.js +1 -251
  8. package/lib/animate-number/index.js +1 -226
  9. package/lib/backtop/index.js +1 -260
  10. package/lib/badge/index.js +1 -274
  11. package/lib/breadcrumb/index.js +1 -329
  12. package/lib/button/index.js +1 -371
  13. package/lib/card/index.js +1 -326
  14. package/lib/cascader/index.js +1 -2168
  15. package/lib/checkbox/index.js +1 -571
  16. package/lib/code-diff/index.js +1 -5520
  17. package/lib/collapse/index.js +1 -698
  18. package/lib/color-picker/index.js +1 -2816
  19. package/lib/components.js +1 -759
  20. package/lib/container/index.js +1 -369
  21. package/lib/date-picker/index.js +1 -5601
  22. package/lib/dialog/index.js +1 -545
  23. package/lib/directives/index.js +2 -1427
  24. package/lib/directives/index.js.LICENSE.txt +14 -0
  25. package/lib/dist.index.js +1 -166
  26. package/lib/divider/index.js +1 -512
  27. package/lib/dropdown/index.js +1 -414
  28. package/lib/exception/index.js +1 -405
  29. package/lib/fixed-navbar/index.js +1 -214
  30. package/lib/form/index.js +1 -986
  31. package/lib/icon/angle-double-down-line.js +1 -426
  32. package/lib/icon/angle-double-left-line.js +1 -426
  33. package/lib/icon/angle-double-left.js +1 -426
  34. package/lib/icon/angle-double-right-line.js +1 -426
  35. package/lib/icon/angle-double-right.js +1 -426
  36. package/lib/icon/angle-double-up-line.js +1 -426
  37. package/lib/icon/angle-down-fill.js +1 -426
  38. package/lib/icon/angle-down-line.js +1 -426
  39. package/lib/icon/angle-down.js +1 -426
  40. package/lib/icon/angle-left.js +1 -426
  41. package/lib/icon/angle-right.js +1 -426
  42. package/lib/icon/angle-up-fill.js +1 -426
  43. package/lib/icon/angle-up.js +1 -426
  44. package/lib/icon/archive-fill.js +1 -426
  45. package/lib/icon/arrows-left.js +1 -426
  46. package/lib/icon/arrows-right.js +1 -426
  47. package/lib/icon/audio-fill.js +1 -426
  48. package/lib/icon/bk.js +1 -426
  49. package/lib/icon/circle.js +1 -426
  50. package/lib/icon/close-line.js +1 -426
  51. package/lib/icon/close.js +1 -426
  52. package/lib/icon/code.js +1 -426
  53. package/lib/icon/cog-shape.js +1 -426
  54. package/lib/icon/collapse-left.js +1 -426
  55. package/lib/icon/copy.js +1 -426
  56. package/lib/icon/data-shape.js +1 -426
  57. package/lib/icon/del.js +1 -426
  58. package/lib/icon/doc-fill.js +1 -426
  59. package/lib/icon/done.js +1 -426
  60. package/lib/icon/down-shape.js +1 -426
  61. package/lib/icon/down-small.js +1 -426
  62. package/lib/icon/edit-line.js +1 -426
  63. package/lib/icon/ellipsis.js +1 -426
  64. package/lib/icon/enlarge-line.js +1 -426
  65. package/lib/icon/error.js +1 -426
  66. package/lib/icon/excel-fill.js +1 -426
  67. package/lib/icon/exclamation-circle-shape.js +1 -426
  68. package/lib/icon/eye.js +1 -426
  69. package/lib/icon/filliscreen-line.js +1 -426
  70. package/lib/icon/folder-open.js +1 -426
  71. package/lib/icon/folder-shape-open.js +1 -426
  72. package/lib/icon/folder-shape.js +1 -426
  73. package/lib/icon/folder.js +1 -426
  74. package/lib/icon/funnel.js +1 -426
  75. package/lib/icon/help-document-fill.js +1 -426
  76. package/lib/icon/help-fill.js +1 -426
  77. package/lib/icon/help.js +1 -426
  78. package/lib/icon/image-fill.js +1 -426
  79. package/lib/icon/img-placehoulder.js +1 -448
  80. package/lib/icon/index.js +1 -2275
  81. package/lib/icon/info-line.js +1 -448
  82. package/lib/icon/info.js +1 -448
  83. package/lib/icon/left-shape.js +1 -448
  84. package/lib/icon/left-turn-line.js +1 -448
  85. package/lib/icon/narrow-line.js +1 -448
  86. package/lib/icon/original.js +1 -448
  87. package/lib/icon/pdf-fill.js +1 -448
  88. package/lib/icon/play-shape.js +1 -448
  89. package/lib/icon/plus.js +1 -448
  90. package/lib/icon/ppt-fill.js +1 -448
  91. package/lib/icon/qq.js +1 -448
  92. package/lib/icon/right-shape.js +1 -448
  93. package/lib/icon/right-turn-line.js +1 -448
  94. package/lib/icon/search.js +1 -448
  95. package/lib/icon/share.js +1 -448
  96. package/lib/icon/spinner.js +1 -448
  97. package/lib/icon/success.js +1 -448
  98. package/lib/icon/switcher-loading.js +1 -448
  99. package/lib/icon/text-file.js +1 -448
  100. package/lib/icon/text-fill.js +1 -448
  101. package/lib/icon/transfer.js +1 -448
  102. package/lib/icon/tree-application-shape.js +1 -448
  103. package/lib/icon/unfull-screen.js +1 -448
  104. package/lib/icon/unvisible.js +1 -448
  105. package/lib/icon/up-shape.js +1 -448
  106. package/lib/icon/upload.js +1 -448
  107. package/lib/icon/video-fill.js +1 -448
  108. package/lib/icon/warn.js +1 -448
  109. package/lib/icon/weixin.js +1 -448
  110. package/lib/image/index.js +1 -873
  111. package/lib/index.js +1 -169
  112. package/lib/info-box/index.js +1 -1784
  113. package/lib/input/index.js +1 -846
  114. package/lib/link/index.js +1 -226
  115. package/lib/loading/index.js +1 -309
  116. package/lib/menu/index.js +1 -796
  117. package/lib/message/index.js +1 -401
  118. package/lib/modal/index.js +1 -395
  119. package/lib/navigation/index.js +1 -431
  120. package/lib/notify/index.js +1 -430
  121. package/lib/overflow-title/index.js +1 -512
  122. package/lib/pagination/index.js +1 -1026
  123. package/lib/plugin-popover/index.js +1 -2581
  124. package/lib/plugins/index.js +1 -130
  125. package/lib/popover/index.js +1 -2587
  126. package/lib/popover2/index.js +1 -172
  127. package/lib/preset.js +1 -129
  128. package/lib/process/index.js +1 -1417
  129. package/lib/progress/index.js +1 -479
  130. package/lib/radio/index.js +1 -649
  131. package/lib/rate/index.js +1 -358
  132. package/lib/resize-layout/index.js +1 -495
  133. package/lib/search-select/index.js +1 -3388
  134. package/lib/search-select/search-select.css +1 -1
  135. package/lib/search-select/search-select.less +1 -1
  136. package/lib/search-select/search-select.variable.css +1 -1
  137. package/lib/select/index.js +1 -2819
  138. package/lib/shared/index.js +1 -2813
  139. package/lib/sideslider/index.js +1 -1362
  140. package/lib/slider/index.js +1 -2060
  141. package/lib/steps/index.js +1 -1504
  142. package/lib/swiper/index.js +1 -374
  143. package/lib/switcher/index.js +1 -308
  144. package/lib/tab/index.js +1 -919
  145. package/lib/table/index.js +1 -6635
  146. package/lib/table-column/index.js +1 -737
  147. package/lib/tag/index.js +1 -278
  148. package/lib/tag-input/index.js +1 -1897
  149. package/lib/time-picker/index.js +1 -142
  150. package/lib/timeline/index.js +1 -315
  151. package/lib/transfer/index.js +1 -658
  152. package/lib/tree/index.js +1 -2917
  153. package/lib/upload/index.js +1 -3735
  154. package/lib/virtual-render/index.js +1 -825
  155. package/package.json +2 -1
package/lib/tab/index.js CHANGED
@@ -1,919 +1 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory(require("../shared"), require("vue"), require("vue-types"), require("../icon/"));
4
- else if(typeof define === 'function' && define.amd)
5
- define(["../shared", "vue", "vue-types", "../icon/"], factory);
6
- else {
7
- var a = typeof exports === 'object' ? factory(require("../shared"), require("vue"), require("vue-types"), require("../icon/")) : factory(root["../shared"], root["vue"], root["vue-types"], root["../icon/"]);
8
- for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
9
- }
10
- })(self, (__WEBPACK_EXTERNAL_MODULE__4212__, __WEBPACK_EXTERNAL_MODULE__748__, __WEBPACK_EXTERNAL_MODULE__210__, __WEBPACK_EXTERNAL_MODULE__7685__) => {
11
- return /******/ (() => { // webpackBootstrap
12
- /******/ "use strict";
13
- /******/ var __webpack_modules__ = ({
14
-
15
- /***/ 7685:
16
- /***/ ((module) => {
17
-
18
- module.exports = __WEBPACK_EXTERNAL_MODULE__7685__;
19
-
20
- /***/ }),
21
-
22
- /***/ 4212:
23
- /***/ ((module) => {
24
-
25
- module.exports = __WEBPACK_EXTERNAL_MODULE__4212__;
26
-
27
- /***/ }),
28
-
29
- /***/ 748:
30
- /***/ ((module) => {
31
-
32
- module.exports = __WEBPACK_EXTERNAL_MODULE__748__;
33
-
34
- /***/ }),
35
-
36
- /***/ 210:
37
- /***/ ((module) => {
38
-
39
- module.exports = __WEBPACK_EXTERNAL_MODULE__210__;
40
-
41
- /***/ })
42
-
43
- /******/ });
44
- /************************************************************************/
45
- /******/ // The module cache
46
- /******/ var __webpack_module_cache__ = {};
47
- /******/
48
- /******/ // The require function
49
- /******/ function __webpack_require__(moduleId) {
50
- /******/ // Check if module is in cache
51
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
52
- /******/ if (cachedModule !== undefined) {
53
- /******/ return cachedModule.exports;
54
- /******/ }
55
- /******/ // Create a new module (and put it into the cache)
56
- /******/ var module = __webpack_module_cache__[moduleId] = {
57
- /******/ // no module.id needed
58
- /******/ // no module.loaded needed
59
- /******/ exports: {}
60
- /******/ };
61
- /******/
62
- /******/ // Execute the module function
63
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
64
- /******/
65
- /******/ // Return the exports of the module
66
- /******/ return module.exports;
67
- /******/ }
68
- /******/
69
- /************************************************************************/
70
- /******/ /* webpack/runtime/define property getters */
71
- /******/ (() => {
72
- /******/ // define getter functions for harmony exports
73
- /******/ __webpack_require__.d = (exports, definition) => {
74
- /******/ for(var key in definition) {
75
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
76
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
77
- /******/ }
78
- /******/ }
79
- /******/ };
80
- /******/ })();
81
- /******/
82
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
83
- /******/ (() => {
84
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
85
- /******/ })();
86
- /******/
87
- /******/ /* webpack/runtime/make namespace object */
88
- /******/ (() => {
89
- /******/ // define __esModule on exports
90
- /******/ __webpack_require__.r = (exports) => {
91
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
92
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
93
- /******/ }
94
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
95
- /******/ };
96
- /******/ })();
97
- /******/
98
- /************************************************************************/
99
- var __webpack_exports__ = {};
100
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
101
- (() => {
102
- // ESM COMPAT FLAG
103
- __webpack_require__.r(__webpack_exports__);
104
-
105
- // EXPORTS
106
- __webpack_require__.d(__webpack_exports__, {
107
- "BkTab": () => (/* binding */ BkTab),
108
- "BkTabPanel": () => (/* reexport */ tab_panel),
109
- "default": () => (/* binding */ src)
110
- });
111
-
112
- // EXTERNAL MODULE: external "../shared"
113
- var external_shared_ = __webpack_require__(4212);
114
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
115
- function _arrayLikeToArray(arr, len) {
116
- if (len == null || len > arr.length) len = arr.length;
117
-
118
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
119
- arr2[i] = arr[i];
120
- }
121
-
122
- return arr2;
123
- }
124
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
125
-
126
- function _arrayWithoutHoles(arr) {
127
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
128
- }
129
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/iterableToArray.js
130
- function _iterableToArray(iter) {
131
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
132
- }
133
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
134
-
135
- function _unsupportedIterableToArray(o, minLen) {
136
- if (!o) return;
137
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
138
- var n = Object.prototype.toString.call(o).slice(8, -1);
139
- if (n === "Object" && o.constructor) n = o.constructor.name;
140
- if (n === "Map" || n === "Set") return Array.from(o);
141
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
142
- }
143
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
144
- function _nonIterableSpread() {
145
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
146
- }
147
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
148
-
149
-
150
-
151
-
152
- function _toConsumableArray(arr) {
153
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
154
- }
155
- // EXTERNAL MODULE: external "vue"
156
- var external_vue_ = __webpack_require__(748);
157
- // EXTERNAL MODULE: external "vue-types"
158
- var external_vue_types_ = __webpack_require__(210);
159
- ;// CONCATENATED MODULE: ../../packages/tab/src/props.ts
160
-
161
-
162
- var TabTypeEnum;
163
-
164
- (function (TabTypeEnum) {
165
- TabTypeEnum["CARD"] = "card";
166
- TabTypeEnum["BORDER_CARD"] = "border-card";
167
- TabTypeEnum["UNBORDER_CARD"] = "unborder-card";
168
- TabTypeEnum["CARD_TAB"] = "card-tab";
169
- })(TabTypeEnum || (TabTypeEnum = {}));
170
-
171
- var PositionEnum;
172
-
173
- (function (PositionEnum) {
174
- PositionEnum["LEFT"] = "left";
175
- PositionEnum["RIGHT"] = "right";
176
- PositionEnum["TOP"] = "top";
177
- })(PositionEnum || (PositionEnum = {}));
178
-
179
- var tabPositionType = (0,external_vue_types_.toType)('position', {}).def(PositionEnum.TOP);
180
- var SortTypeEnum;
181
-
182
- (function (SortTypeEnum) {
183
- SortTypeEnum["REPLACE"] = "replace";
184
- SortTypeEnum["INSERT"] = "insert";
185
- })(SortTypeEnum || (SortTypeEnum = {}));
186
-
187
- var sortTypeUnion = (0,external_vue_types_.toType)('sortType', {}).def(SortTypeEnum.REPLACE);
188
- var tabNavEventProps = {
189
- tabAdd: {
190
- type: Function,
191
- "default": function _default() {
192
- return {};
193
- }
194
- },
195
- tabChange: {
196
- type: Function,
197
- "default": function _default(name) {
198
- return name;
199
- }
200
- },
201
- tabRemove: {
202
- type: Function,
203
- "default": function _default(name) {
204
- return name;
205
- }
206
- },
207
- tabSort: {
208
- type: Function,
209
- "default": function _default() {
210
- return {};
211
- } // default: (dragTabIndex: number, dropTabIndex: number, sortType: string):
212
- // {dragTabIndex: number, dropTabIndex: number, sortType: string} => ({ dragTabIndex, dropTabIndex, sortType }),
213
-
214
- },
215
- tabDrag: {
216
- type: Function,
217
- "default": function _default() {
218
- return {};
219
- }
220
- }
221
- };
222
- var tabEventProps = {
223
- add: {
224
- type: Function,
225
- "default": function _default() {
226
- return {};
227
- }
228
- },
229
- change: {
230
- type: Function,
231
- "default": function _default() {
232
- return {};
233
- }
234
- },
235
- remove: {
236
- type: Function,
237
- "default": function _default() {
238
- return {};
239
- }
240
- },
241
- sort: {
242
- type: Function,
243
- "default": function _default() {
244
- return {};
245
- }
246
- },
247
- drag: {
248
- type: Function,
249
- "default": function _default() {
250
- return {};
251
- }
252
- } // ...TabNavEventProps,
253
-
254
- };
255
- var tabProps = {
256
- active: external_shared_.PropTypes.oneOfType([external_shared_.PropTypes.number, external_shared_.PropTypes.string]).def(''),
257
- type: (0,external_vue_types_.toType)('type', {}).def(TabTypeEnum.BORDER_CARD),
258
- tabPosition: tabPositionType,
259
- closable: Boolean,
260
- addable: Boolean,
261
- sortable: Boolean,
262
- sortType: sortTypeUnion,
263
- labelHeight: external_shared_.PropTypes.number.def(50),
264
- scrollStep: external_shared_.PropTypes.number.def(200),
265
- extCls: external_shared_.PropTypes.string.def(''),
266
- validateActive: external_shared_.PropTypes.bool.def(true),
267
- showHeader: external_shared_.PropTypes.bool.def(true),
268
- changeOnHover: external_shared_.PropTypes.bool.def(false),
269
- changeOnHoverDelay: external_shared_.PropTypes.number.def(1000)
270
- };
271
- var tabNavProps = Object.assign({
272
- active: external_shared_.PropTypes.oneOfType([external_shared_.PropTypes.number, external_shared_.PropTypes.string]).def(''),
273
- // panels: PropTypes.arrayOf(PropTypes.any).def([]),
274
- panels: {
275
- type: Array,
276
- "default": function _default() {
277
- return [];
278
- }
279
- },
280
- tabPosition: tabPositionType,
281
- closable: Boolean,
282
- addable: Boolean,
283
- sortable: Boolean,
284
- sortType: sortTypeUnion,
285
- labelHeight: external_shared_.PropTypes.number.def(50),
286
- scrollStep: external_shared_.PropTypes.number.def(200),
287
- validateActive: external_shared_.PropTypes.bool.def(true),
288
- changeOnHover: external_shared_.PropTypes.bool.def(false),
289
- changeOnHoverDelay: external_shared_.PropTypes.number.def(1000)
290
- }, tabNavEventProps);
291
- var tabPanelProps = {
292
- name: external_shared_.PropTypes.oneOfType([external_shared_.PropTypes.number, external_shared_.PropTypes.string]).def(''),
293
- label: external_shared_.PropTypes.string || external_shared_.PropTypes.func,
294
- closable: external_shared_.PropTypes.bool,
295
- visible: external_shared_.PropTypes.bool.def(true),
296
- disabled: external_shared_.PropTypes.bool,
297
- sortable: external_shared_.PropTypes.bool,
298
- renderDirective: (0,external_shared_.renderDirectiveType)(),
299
- panel: external_shared_.PropTypes.string || external_shared_.PropTypes.func
300
- };
301
- // EXTERNAL MODULE: external "../icon/"
302
- var _ = __webpack_require__(7685);
303
- ;// CONCATENATED MODULE: ../../packages/tab/src/tab-nav.tsx
304
-
305
-
306
- /*
307
- * Tencent is pleased to support the open source community by making
308
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
309
- *
310
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
311
- *
312
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
313
- *
314
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
315
- *
316
- * ---------------------------------------------------
317
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
318
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
319
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
320
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
321
- *
322
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
323
- * the Software.
324
- *
325
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
326
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
327
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
328
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
329
- * IN THE SOFTWARE.
330
- */
331
-
332
-
333
-
334
-
335
- /* harmony default export */ const tab_nav = ((0,external_vue_.defineComponent)({
336
- name: 'TabNav',
337
- props: tabNavProps,
338
- setup: function setup(props) {
339
- var navs = (0,external_vue_.computed)(function () {
340
- if (!Array.isArray(props.panels) || !props.panels.length) {
341
- return [];
342
- }
343
-
344
- var list = [];
345
- var hasFindActive = false;
346
- props.panels.filter(function (item, index) {
347
- if (!item.props) {
348
- return null;
349
- }
350
-
351
- var _item$props = item.props,
352
- name = _item$props.name,
353
- label = _item$props.label,
354
- closable = _item$props.closable,
355
- visible = _item$props.visible,
356
- disabled = _item$props.disabled,
357
- sortable = _item$props.sortable;
358
-
359
- if (!visible) {
360
- return false;
361
- }
362
-
363
- if (props.active === name) {
364
- hasFindActive = true;
365
- }
366
-
367
- var renderLabel = function renderLabel(label) {
368
- if (item.slots.label) {
369
- return (0,external_vue_.h)(item.slots.label);
370
- }
371
-
372
- if ([undefined, ''].includes(label)) {
373
- return "\u9009\u9879\u5361".concat(index + 1);
374
- }
375
-
376
- if (typeof label === 'string') {
377
- return label;
378
- }
379
-
380
- if (typeof label === 'function') {
381
- return (0,external_vue_.h)(label);
382
- }
383
-
384
- return label;
385
- };
386
-
387
- list.push({
388
- name: name,
389
- closable: closable,
390
- visible: visible,
391
- disabled: disabled,
392
- sortable: sortable,
393
- tabLabel: renderLabel(label)
394
- });
395
- return true;
396
- });
397
-
398
- if (!hasFindActive && props.validateActive) {
399
- props.panels[0].props && props.tabChange(props.panels[0].props.name);
400
- }
401
-
402
- return list;
403
- });
404
- var dragenterIndex = (0,external_vue_.ref)(-1);
405
- var dragStartIndex = (0,external_vue_.ref)(-1);
406
- var draggingEle = (0,external_vue_.ref)('');
407
-
408
- var distinctRoots = function distinctRoots(el1, el2) {
409
- return el1 === el2;
410
- };
411
-
412
- var methods = {
413
- /**
414
- * @description 判断拖动的元素是否是在同一个tab。
415
- * 使用guid,相比 el1.parentNode === el2.parentNode 判断,性能要高
416
- * @param e {event} 触发的元素
417
- * @return {boolean}
418
- */
419
- handleTabAdd: function handleTabAdd(e) {
420
- props.tabAdd(e);
421
- },
422
- dragstart: function dragstart(index, $event) {
423
- dragStartIndex.value = index;
424
- draggingEle.value = props.guid; // 拖动鼠标效果
425
-
426
- Object.assign($event.dataTransfer, {
427
- effectAllowed: 'move'
428
- }); // $event.dataTransfer.setData('text/plain', index)
429
-
430
- props.tabDrag(index, $event);
431
- },
432
- dragenter: function dragenter(index) {
433
- // 缓存目标元素索引,方便添加样式
434
- if (distinctRoots(draggingEle.value, props.guid)) {
435
- dragenterIndex.value = index;
436
- }
437
- },
438
- dragend: function dragend() {
439
- dragenterIndex.value = -1;
440
- dragStartIndex.value = -1;
441
- draggingEle.value = null;
442
- },
443
- drop: function drop(index, sortType) {
444
- // 不是同一个tab,返回——暂时不支持跨tab拖动
445
- if (!distinctRoots(draggingEle.value, props.guid)) {
446
- return false;
447
- }
448
-
449
- props.tabSort(dragStartIndex.value, index, sortType);
450
- },
451
- handleTabChange: function handleTabChange(name) {
452
- props.tabChange(name);
453
- },
454
- handleTabRemove: function handleTabRemove(index, panel) {
455
- props.tabRemove(index, panel);
456
- }
457
- };
458
- return Object.assign(Object.assign({}, methods), {
459
- navs: navs,
460
- dragenterIndex: dragenterIndex,
461
- dragStartIndex: dragStartIndex,
462
- draggingEle: draggingEle,
463
- guid: Math.random().toString(16).substr(4) + Math.random().toString(16).substr(4)
464
- });
465
- },
466
- render: function render() {
467
- var _this = this;
468
-
469
- var active = this.active,
470
- closable = this.closable,
471
- addable = this.addable,
472
- sortable = this.sortable,
473
- sortType = this.sortType,
474
- labelHeight = this.labelHeight,
475
- dragstart = this.dragstart,
476
- dragenter = this.dragenter,
477
- dragend = this.dragend,
478
- drop = this.drop;
479
-
480
- var renderNavs = function renderNavs() {
481
- return _this.navs.map(function (item, index) {
482
- if (!item) {
483
- return null;
484
- }
485
-
486
- var name = item.name,
487
- disabled = item.disabled,
488
- tabLabel = item.tabLabel;
489
-
490
- var getNavItemClass = function getNavItemClass() {
491
- var classNames = [(0,external_shared_.resolveClassName)('tab-header-item')];
492
-
493
- if (disabled) {
494
- classNames.push((0,external_shared_.resolveClassName)('tab-header--disabled'));
495
- }
496
-
497
- if (active === name) {
498
- classNames.push((0,external_shared_.resolveClassName)('tab-header--active'));
499
- }
500
-
501
- return classNames.join(' ');
502
- }; // const getValue = (value, value2) => (typeof value === 'boolean' ? value : value2);
503
-
504
-
505
- var getValue = function getValue(curentValue, parentValue) {
506
- return curentValue || parentValue;
507
- };
508
-
509
- return (0,external_vue_.createVNode)("div", {
510
- "key": name,
511
- "onClick": function onClick() {
512
- return _this.handleTabChange(name);
513
- },
514
- "draggable": getValue(item.sortable, sortable),
515
- "onDragstart": function onDragstart(e) {
516
- return dragstart(index, e);
517
- },
518
- "onDragenter": function onDragenter(e) {
519
- e.preventDefault();
520
- dragenter(index);
521
- },
522
- "onDragleave": function onDragleave(e) {
523
- e.preventDefault();
524
- },
525
- "onDragover": function onDragover(e) {
526
- e.preventDefault();
527
- },
528
- "onDragend": function onDragend(e) {
529
- e.preventDefault();
530
- dragend();
531
- },
532
- "onDrop": function onDrop(e) {
533
- e.preventDefault();
534
- drop(index, sortType);
535
- },
536
- "class": getNavItemClass()
537
- }, [(0,external_vue_.createVNode)("div", null, [tabLabel]), getValue(item.closable, closable) && (0,external_vue_.createVNode)(_.Close, {
538
- "class": (0,external_shared_.resolveClassName)('tab-header-item-close'),
539
- "onClick": function onClick() {
540
- return _this.handleTabRemove(index, item);
541
- }
542
- }, null)]);
543
- });
544
- };
545
-
546
- var renderSlot = function renderSlot() {
547
- var _a, _b;
548
-
549
- var list = [];
550
-
551
- if (typeof _this.$slots.add === 'function') {
552
- list.push((_b = (_a = _this.$slots).add) === null || _b === void 0 ? void 0 : _b.call(_a, external_vue_.h));
553
- } else if (addable) {
554
- list.push((0,external_vue_.createVNode)("div", {
555
- "onClick": _this.handleTabAdd
556
- }, [(0,external_vue_.createVNode)(_.Plus, {
557
- "style": "display:flex;",
558
- "width": 26,
559
- "height": 26
560
- }, null)]));
561
- }
562
-
563
- if (list.length) {
564
- return (0,external_vue_.createVNode)("div", {
565
- "class": (0,external_shared_.resolveClassName)('tab-header-operation')
566
- }, [list.map(function (item, index) {
567
- return (0,external_vue_.createVNode)("div", {
568
- "class": (0,external_shared_.resolveClassName)('tab-header-item'),
569
- "key": index
570
- }, [item]);
571
- })]);
572
- }
573
-
574
- return null;
575
- };
576
-
577
- return (0,external_vue_.createVNode)("div", {
578
- "style": {
579
- lineHeight: "".concat(labelHeight, "px")
580
- },
581
- "class": (0,external_shared_.resolveClassName)('tab-header')
582
- }, [(0,external_vue_.createVNode)("div", {
583
- "class": (0,external_shared_.resolveClassName)('tab-header-nav')
584
- }, [renderNavs()]), renderSlot(), typeof this.$slots.setting === 'function' && (0,external_vue_.createVNode)("div", {
585
- "class": (0,external_shared_.resolveClassName)('tab-header-setting')
586
- }, [this.$slots.setting()])]);
587
- }
588
- }));
589
- ;// CONCATENATED MODULE: ../../packages/tab/src/tab.tsx
590
-
591
-
592
-
593
- /*
594
- * Tencent is pleased to support the open source community by making
595
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
596
- *
597
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
598
- *
599
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
600
- *
601
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
602
- *
603
- * ---------------------------------------------------
604
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
605
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
606
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
607
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
608
- *
609
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
610
- * the Software.
611
- *
612
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
613
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
614
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
615
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
616
- * IN THE SOFTWARE.
617
- */
618
-
619
-
620
-
621
-
622
- /* harmony default export */ const tab = ((0,external_vue_.defineComponent)({
623
- name: 'Tab',
624
- components: {
625
- TabNav: tab_nav
626
- },
627
- props: tabProps,
628
- emits: [// 兼容老方法
629
- 'add-panel', 'tab-change', 'remove-panel', 'sort-change', 'on-drag-tab', // 新方法
630
- 'add', 'change', 'remove', 'update:active', 'sort', 'drag'],
631
- setup: function setup(_props, _ref) {
632
- var slots = _ref.slots,
633
- emit = _ref.emit;
634
- var isMounted = (0,external_vue_.ref)(false);
635
- var panels = (0,external_vue_.ref)([]);
636
- var instance = (0,external_vue_.getCurrentInstance)(); // 动态插入tabPanel
637
-
638
- var getPaneInstanceFromSlot = function getPaneInstanceFromSlot(vnode) {
639
- var panelInstanceList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
640
- var children = vnode.children;
641
- (children || []).forEach(function (node) {
642
- var type = node.type;
643
- type = type.name || type;
644
-
645
- if (type === 'TabPanel' && node.component) {
646
- panelInstanceList.push(node.component);
647
- } else if (type === external_vue_.Fragment || type === 'template') {
648
- getPaneInstanceFromSlot(node, panelInstanceList);
649
- }
650
- });
651
- return panelInstanceList;
652
- };
653
-
654
- var setPanelInstances = function setPanelInstances() {
655
- if (slots["default"]) {
656
- var children = instance.subTree.children[1].children;
657
- if (!children) return;
658
- var content = children[0];
659
- var panelInstanceList = getPaneInstanceFromSlot(content);
660
- var isChanged = panelInstanceList.length !== panels.value.length;
661
-
662
- if (isChanged) {
663
- panels.value = panelInstanceList;
664
- }
665
- }
666
- };
667
-
668
- (0,external_vue_.onMounted)(function () {
669
- setPanelInstances();
670
- isMounted.value = true;
671
- });
672
- (0,external_vue_.onUpdated)(function () {
673
- setPanelInstances();
674
- });
675
- var methods = {
676
- tabAdd: function tabAdd(e) {
677
- emit('add', {
678
- e: e
679
- });
680
- emit('add-panel', {
681
- e: e
682
- });
683
- },
684
- tabChange: function tabChange(name) {
685
- // emit('xxx') 会调用onXxx函数, 所以不必在主动调用onXxx函数了
686
- emit('change', name);
687
- emit('tab-change', name);
688
- emit('update:active', name);
689
- },
690
- tabRemove: function tabRemove(index, panel) {
691
- // emit('xxx') 会调用onXxx函数, 所以不必在主动调用onXxx函数了
692
- emit('remove', index, panel);
693
- emit('remove-panel', index, panel);
694
- },
695
- tabSort: function tabSort(dragTabIndex, dropTabIndex, sortType) {
696
- var list = panels.value; // 如果是插队模式
697
-
698
- if (sortType === SortTypeEnum.INSERT) {
699
- if (dragTabIndex < dropTabIndex) {
700
- list.splice(dropTabIndex + 1, 0, panels[dragTabIndex]);
701
- list.splice(dragTabIndex, 1);
702
- } else if (dragTabIndex > dropTabIndex) {
703
- list.splice(dropTabIndex, 0, panels[dragTabIndex]);
704
- list.splice(dragTabIndex + 1, 1);
705
- } else {
706
- return false;
707
- }
708
- } else {
709
- var swap = list[dropTabIndex];
710
- list[dropTabIndex] = list[dragTabIndex];
711
- list[dragTabIndex] = swap;
712
- }
713
-
714
- panels.value = _toConsumableArray(list); // emit('xxx') 会调用onXxx函数, 所以不必在主动调用onXxx函数了
715
-
716
- emit('sort', dragTabIndex, dropTabIndex, sortType);
717
- emit('sort-change', dragTabIndex, dropTabIndex, sortType);
718
- },
719
- tabDrag: function tabDrag(dragTabIndex, dragEvent) {
720
- // emit('xxx') 会调用onXxx函数, 所以不必在主动调用onXxx函数了
721
- emit('drag', dragTabIndex, dragEvent);
722
- emit('on-drag-tab', dragTabIndex, dragEvent);
723
- }
724
- };
725
- return Object.assign(Object.assign({}, methods), {
726
- isMounted: isMounted,
727
- panels: panels
728
- });
729
- },
730
- render: function render() {
731
- var _this = this;
732
-
733
- var _a, _b;
734
-
735
- var getTabBoxClass = function getTabBoxClass() {
736
- var arr = [(0,external_shared_.resolveClassName)('tab'), _this.extCls];
737
-
738
- if (_this.tabPosition === PositionEnum.TOP) {
739
- arr.push((0,external_shared_.resolveClassName)("tab--".concat(_this.tabPosition)), (0,external_shared_.resolveClassName)("tab--".concat(_this.type)));
740
- } else {
741
- arr.push((0,external_shared_.resolveClassName)("tab--".concat(_this.tabPosition)));
742
-
743
- if (_this.type === TabTypeEnum.CARD_TAB) {
744
- arr.push((0,external_shared_.resolveClassName)('tab--vertical-tab'));
745
- }
746
- }
747
-
748
- return arr;
749
- };
750
-
751
- var getTabHeader = function getTabHeader() {
752
- var panels = _this.panels,
753
- active = _this.active,
754
- type = _this.type,
755
- closable = _this.closable,
756
- addable = _this.addable,
757
- sortable = _this.sortable,
758
- sortType = _this.sortType,
759
- labelHeight = _this.labelHeight,
760
- scrollStep = _this.scrollStep,
761
- validateActive = _this.validateActive,
762
- changeOnHover = _this.changeOnHover,
763
- changeOnHoverDelay = _this.changeOnHoverDelay,
764
- tabPosition = _this.tabPosition,
765
- tabAdd = _this.tabAdd,
766
- tabChange = _this.tabChange,
767
- tabRemove = _this.tabRemove,
768
- tabSort = _this.tabSort,
769
- tabDrag = _this.tabDrag;
770
- var props = {
771
- panels: panels,
772
- active: active,
773
- type: type,
774
- closable: closable,
775
- addable: addable,
776
- sortable: sortable,
777
- sortType: sortType,
778
- labelHeight: labelHeight,
779
- scrollStep: scrollStep,
780
- validateActive: validateActive,
781
- changeOnHover: changeOnHover,
782
- changeOnHoverDelay: changeOnHoverDelay,
783
- tabPosition: tabPosition,
784
- // function
785
- tabAdd: tabAdd,
786
- tabChange: tabChange,
787
- tabRemove: tabRemove,
788
- tabSort: tabSort,
789
- tabDrag: tabDrag
790
- };
791
-
792
- if (!panels || !Array.isArray(panels)) {
793
- return null;
794
- }
795
-
796
- return (0,external_vue_.createVNode)(tab_nav, props, _this.$slots);
797
- };
798
-
799
- return (0,external_vue_.createVNode)("div", {
800
- "class": getTabBoxClass()
801
- }, [getTabHeader(), (0,external_vue_.createVNode)("div", {
802
- "class": (0,external_shared_.resolveClassName)('tab-content')
803
- }, [(_b = (_a = this.$slots)["default"]) === null || _b === void 0 ? void 0 : _b.call(_a)])]);
804
- }
805
- }));
806
- ;// CONCATENATED MODULE: ../../packages/tab/src/tab-panel.tsx
807
-
808
-
809
- /*
810
- * Tencent is pleased to support the open source community by making
811
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
812
- *
813
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
814
- *
815
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
816
- *
817
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
818
- *
819
- * ---------------------------------------------------
820
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
821
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
822
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
823
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
824
- *
825
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
826
- * the Software.
827
- *
828
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
829
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
830
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
831
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
832
- * IN THE SOFTWARE.
833
- */
834
-
835
-
836
-
837
- /* harmony default export */ const tab_panel = ((0,external_vue_.defineComponent)({
838
- name: 'TabPanel',
839
- props: tabPanelProps,
840
- render: function render() {
841
- var _this = this;
842
-
843
- var active = this.name === this.$parent.active;
844
-
845
- var getContent = function getContent() {
846
- // 不渲染
847
- if (!_this.visible || _this.renderDirective === 'if' && !active) {
848
- return null;
849
- }
850
-
851
- if (typeof _this.panel === 'function') {
852
- return _this.panel(external_vue_.h);
853
- }
854
-
855
- if (typeof _this.$slots["default"] === 'function') {
856
- return _this.$slots["default"](null);
857
- }
858
-
859
- if (typeof _this.$slots.panel === 'function') {
860
- return _this.$slots.panel(null);
861
- }
862
-
863
- return null;
864
- };
865
-
866
- return (0,external_vue_.withDirectives)((0,external_vue_.createVNode)("div", {
867
- "ref": 'content',
868
- "class": (0,external_shared_.resolveClassName)('tab-panel')
869
- }, [getContent()]), [[external_vue_.vShow, active]]);
870
- }
871
- }));
872
- ;// CONCATENATED MODULE: ../../packages/tab/src/index.ts
873
- /*
874
- * Tencent is pleased to support the open source community by making
875
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
876
- *
877
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
878
- *
879
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
880
- *
881
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
882
- *
883
- * ---------------------------------------------------
884
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
885
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
886
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
887
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
888
- *
889
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
890
- * the Software.
891
- *
892
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
893
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
894
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
895
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
896
- * IN THE SOFTWARE.
897
- */
898
-
899
- /* import { withInstall } from '@bkui-vue/shared';
900
- const BkTab = withInstall(Tab);
901
- const BkTabPanel = withInstall(TabPanel);
902
- export {
903
- BkTab,
904
- BkTabPanel,
905
- };*/
906
-
907
-
908
-
909
- var BkTab = (0,external_shared_.withInstallProps)(tab, {
910
- TabPanel: tab_panel
911
- });
912
-
913
- /* harmony default export */ const src = (BkTab);
914
- })();
915
-
916
- /******/ return __webpack_exports__;
917
- /******/ })()
918
- ;
919
- });
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("vue-types"),require("../icon/"));else if("function"==typeof define&&define.amd)define(["../shared","vue","vue-types","../icon/"],t);else{var a="object"==typeof exports?t(require("../shared"),require("vue"),require("vue-types"),require("../icon/")):t(e["../shared"],e.vue,e["vue-types"],e["../icon/"]);for(var r in a)("object"==typeof exports?exports:e)[r]=a[r]}}(self,((e,t,a,r)=>(()=>{"use strict";var n={7685:e=>{e.exports=r},4212:t=>{t.exports=e},748:e=>{e.exports=t},210:e=>{e.exports=a}},o={};function s(e){var t=o[e];if(void 0!==t)return t.exports;var a=o[e]={exports:{}};return n[e](a,a.exports,s),a.exports}s.d=(e,t)=>{for(var a in t)s.o(t,a)&&!s.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return(()=>{s.r(l),s.d(l,{BkTab:()=>m,BkTabPanel:()=>g,default:()=>T});var e=s(4212);function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,r=new Array(t);a<t;a++)r[a]=e[a];return r}var a,r,n=s(748),o=s(210);!function(e){e.CARD="card",e.BORDER_CARD="border-card",e.UNBORDER_CARD="unborder-card",e.CARD_TAB="card-tab"}(a||(a={})),function(e){e.LEFT="left",e.RIGHT="right",e.TOP="top"}(r||(r={}));var i,u=(0,o.toType)("position",{}).def(r.TOP);!function(e){e.REPLACE="replace",e.INSERT="insert"}(i||(i={}));var d=(0,o.toType)("sortType",{}).def(i.REPLACE),p={tabAdd:{type:Function,default:function(){return{}}},tabChange:{type:Function,default:function(e){return e}},tabRemove:{type:Function,default:function(e){return e}},tabSort:{type:Function,default:function(){return{}}},tabDrag:{type:Function,default:function(){return{}}}},c={active:e.PropTypes.oneOfType([e.PropTypes.number,e.PropTypes.string]).def(""),type:(0,o.toType)("type",{}).def(a.BORDER_CARD),tabPosition:u,closable:Boolean,addable:Boolean,sortable:Boolean,sortType:d,labelHeight:e.PropTypes.number.def(50),scrollStep:e.PropTypes.number.def(200),extCls:e.PropTypes.string.def(""),validateActive:e.PropTypes.bool.def(!0),showHeader:e.PropTypes.bool.def(!0),changeOnHover:e.PropTypes.bool.def(!1),changeOnHoverDelay:e.PropTypes.number.def(1e3)},b=Object.assign({active:e.PropTypes.oneOfType([e.PropTypes.number,e.PropTypes.string]).def(""),panels:{type:Array,default:function(){return[]}},tabPosition:u,closable:Boolean,addable:Boolean,sortable:Boolean,sortType:d,labelHeight:e.PropTypes.number.def(50),scrollStep:e.PropTypes.number.def(200),validateActive:e.PropTypes.bool.def(!0),changeOnHover:e.PropTypes.bool.def(!1),changeOnHoverDelay:e.PropTypes.number.def(1e3)},p),f={name:e.PropTypes.oneOfType([e.PropTypes.number,e.PropTypes.string]).def(""),label:e.PropTypes.string||e.PropTypes.func,closable:e.PropTypes.bool,visible:e.PropTypes.bool.def(!0),disabled:e.PropTypes.bool,sortable:e.PropTypes.bool,renderDirective:(0,e.renderDirectiveType)(),panel:e.PropTypes.string||e.PropTypes.func},v=s(7685);const y=(0,n.defineComponent)({name:"TabNav",props:b,setup:function(e){var t=(0,n.computed)((function(){if(!Array.isArray(e.panels)||!e.panels.length)return[];var t=[],a=!1;return e.panels.filter((function(r,o){if(!r.props)return null;var s=r.props,l=s.name,i=s.label,u=s.closable,d=s.visible,p=s.disabled,c=s.sortable;return!!d&&(e.active===l&&(a=!0),t.push({name:l,closable:u,visible:d,disabled:p,sortable:c,tabLabel:function(e){return r.slots.label?(0,n.h)(r.slots.label):[void 0,""].includes(e)?"选项卡".concat(o+1):"string"==typeof e?e:"function"==typeof e?(0,n.h)(e):e}(i)}),!0)})),!a&&e.validateActive&&e.panels[0].props&&e.tabChange(e.panels[0].props.name),t})),a=(0,n.ref)(-1),r=(0,n.ref)(-1),o=(0,n.ref)(""),s=function(e,t){return e===t},l={handleTabAdd:function(t){e.tabAdd(t)},dragstart:function(t,a){r.value=t,o.value=e.guid,Object.assign(a.dataTransfer,{effectAllowed:"move"}),e.tabDrag(t,a)},dragenter:function(t){s(o.value,e.guid)&&(a.value=t)},dragend:function(){a.value=-1,r.value=-1,o.value=null},drop:function(t,a){if(!s(o.value,e.guid))return!1;e.tabSort(r.value,t,a)},handleTabChange:function(t){e.tabChange(t)},handleTabRemove:function(t,a){e.tabRemove(t,a)}};return Object.assign(Object.assign({},l),{navs:t,dragenterIndex:a,dragStartIndex:r,draggingEle:o,guid:Math.random().toString(16).substr(4)+Math.random().toString(16).substr(4)})},render:function(){var t,a,r,o=this,s=this.active,l=this.closable,i=this.addable,u=this.sortable,d=this.sortType,p=this.labelHeight,c=this.dragstart,b=this.dragenter,f=this.dragend,y=this.drop;return(0,n.createVNode)("div",{style:{lineHeight:"".concat(p,"px")},class:(0,e.resolveClassName)("tab-header")},[(0,n.createVNode)("div",{class:(0,e.resolveClassName)("tab-header-nav")},[o.navs.map((function(t,a){if(!t)return null;var r,i=t.name,p=t.disabled,h=t.tabLabel,g=function(e,t){return e||t};return(0,n.createVNode)("div",{key:i,onClick:function(){return o.handleTabChange(i)},draggable:g(t.sortable,u),onDragstart:function(e){return c(a,e)},onDragenter:function(e){e.preventDefault(),b(a)},onDragleave:function(e){e.preventDefault()},onDragover:function(e){e.preventDefault()},onDragend:function(e){e.preventDefault(),f()},onDrop:function(e){e.preventDefault(),y(a,d)},class:(r=[(0,e.resolveClassName)("tab-header-item")],p&&r.push((0,e.resolveClassName)("tab-header--disabled")),s===i&&r.push((0,e.resolveClassName)("tab-header--active")),r.join(" "))},[(0,n.createVNode)("div",null,[h]),g(t.closable,l)&&(0,n.createVNode)(v.Close,{class:(0,e.resolveClassName)("tab-header-item-close"),onClick:function(){return o.handleTabRemove(a,t)}},null)])}))]),(r=[],"function"==typeof o.$slots.add?r.push(null===(a=(t=o.$slots).add)||void 0===a?void 0:a.call(t,n.h)):i&&r.push((0,n.createVNode)("div",{onClick:o.handleTabAdd},[(0,n.createVNode)(v.Plus,{style:"display:flex;",width:26,height:26},null)])),r.length?(0,n.createVNode)("div",{class:(0,e.resolveClassName)("tab-header-operation")},[r.map((function(t,a){return(0,n.createVNode)("div",{class:(0,e.resolveClassName)("tab-header-item"),key:a},[t])}))]):null),"function"==typeof this.$slots.setting&&(0,n.createVNode)("div",{class:(0,e.resolveClassName)("tab-header-setting")},[this.$slots.setting()])])}}),h=(0,n.defineComponent)({name:"Tab",components:{TabNav:y},props:c,emits:["add-panel","tab-change","remove-panel","sort-change","on-drag-tab","add","change","remove","update:active","sort","drag"],setup:function(e,a){var r=a.slots,o=a.emit,s=(0,n.ref)(!1),l=(0,n.ref)([]),u=(0,n.getCurrentInstance)(),d=function e(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=t.children;return(r||[]).forEach((function(t){var r=t.type;"TabPanel"===(r=r.name||r)&&t.component?a.push(t.component):r!==n.Fragment&&"template"!==r||e(t,a)})),a},p=function(){if(r.default){var e=u.subTree.children[1].children;if(!e)return;var t=e[0],a=d(t);a.length!==l.value.length&&(l.value=a)}};(0,n.onMounted)((function(){p(),s.value=!0})),(0,n.onUpdated)((function(){p()}));var c={tabAdd:function(e){o("add",{e}),o("add-panel",{e})},tabChange:function(e){o("change",e),o("tab-change",e),o("update:active",e)},tabRemove:function(e,t){o("remove",e,t),o("remove-panel",e,t)},tabSort:function(e,a,r){var n,s=l.value;if(r===i.INSERT)if(e<a)s.splice(a+1,0,l[e]),s.splice(e,1);else{if(!(e>a))return!1;s.splice(a,0,l[e]),s.splice(e+1,1)}else{var u=s[a];s[a]=s[e],s[e]=u}l.value=function(e){if(Array.isArray(e))return t(e)}(n=s)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||function(e,a){if(e){if("string"==typeof e)return t(e,a);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,a):void 0}}(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o("sort",e,a,r),o("sort-change",e,a,r)},tabDrag:function(e,t){o("drag",e,t),o("on-drag-tab",e,t)}};return Object.assign(Object.assign({},c),{isMounted:s,panels:l})},render:function(){var t,o,s,l,i,u=this;return(0,n.createVNode)("div",{class:(i=[(0,e.resolveClassName)("tab"),u.extCls],u.tabPosition===r.TOP?i.push((0,e.resolveClassName)("tab--".concat(u.tabPosition)),(0,e.resolveClassName)("tab--".concat(u.type))):(i.push((0,e.resolveClassName)("tab--".concat(u.tabPosition))),u.type===a.CARD_TAB&&i.push((0,e.resolveClassName)("tab--vertical-tab"))),i)},[(s=u.panels,l={panels:s,active:u.active,type:u.type,closable:u.closable,addable:u.addable,sortable:u.sortable,sortType:u.sortType,labelHeight:u.labelHeight,scrollStep:u.scrollStep,validateActive:u.validateActive,changeOnHover:u.changeOnHover,changeOnHoverDelay:u.changeOnHoverDelay,tabPosition:u.tabPosition,tabAdd:u.tabAdd,tabChange:u.tabChange,tabRemove:u.tabRemove,tabSort:u.tabSort,tabDrag:u.tabDrag},s&&Array.isArray(s)?(0,n.createVNode)(y,l,u.$slots):null),(0,n.createVNode)("div",{class:(0,e.resolveClassName)("tab-content")},[null===(o=(t=this.$slots).default)||void 0===o?void 0:o.call(t)])])}}),g=(0,n.defineComponent)({name:"TabPanel",props:f,render:function(){var t=this,a=this.name===this.$parent.active;return(0,n.withDirectives)((0,n.createVNode)("div",{ref:"content",class:(0,e.resolveClassName)("tab-panel")},[!t.visible||"if"===t.renderDirective&&!a?null:"function"==typeof t.panel?t.panel(n.h):"function"==typeof t.$slots.default?t.$slots.default(null):"function"==typeof t.$slots.panel?t.$slots.panel(null):null]),[[n.vShow,a]])}});var m=(0,e.withInstallProps)(h,{TabPanel:g});const T=m})(),l})()));