bkui-vue 0.0.2-beta.37 → 0.0.2-beta.38

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