bkui-vue 0.0.2-beta.75 → 0.0.2-beta.77

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 (170) hide show
  1. package/lib/affix/index.js +1 -319
  2. package/lib/alert/index.js +1 -215
  3. package/lib/animate-number/index.js +1 -155
  4. package/lib/backtop/index.js +1 -188
  5. package/lib/badge/index.js +1 -236
  6. package/lib/breadcrumb/index.js +1 -309
  7. package/lib/button/index.js +1 -321
  8. package/lib/card/index.js +1 -274
  9. package/lib/cascader/index.js +2 -2019
  10. package/lib/cascader/index.js.LICENSE.txt +1 -0
  11. package/lib/checkbox/index.js +1 -542
  12. package/lib/code-diff/index.js +1 -5501
  13. package/lib/collapse/index.js +1 -518
  14. package/lib/collapse-transition/index.js +1 -178
  15. package/lib/color-picker/index.js +1 -2662
  16. package/lib/components.js +1 -530
  17. package/lib/config-provider/index.js +1 -317
  18. package/lib/container/index.js +1 -343
  19. package/lib/date-picker/index.js +1 -5481
  20. package/lib/dialog/index.js +2 -1266
  21. package/lib/dialog/index.js.LICENSE.txt +1 -0
  22. package/lib/directives/index.js +2 -1335
  23. package/lib/directives/index.js.LICENSE.txt +14 -0
  24. package/lib/dist.index.js +1 -87
  25. package/lib/divider/index.js +1 -169
  26. package/lib/dropdown/index.js +1 -369
  27. package/lib/exception/index.js +1 -385
  28. package/lib/fixed-navbar/index.js +1 -154
  29. package/lib/form/index.js +1 -918
  30. package/lib/hooks.js +1 -73
  31. package/lib/icon/angle-double-down-line.js +1 -481
  32. package/lib/icon/angle-double-left-line.js +1 -481
  33. package/lib/icon/angle-double-left.js +1 -481
  34. package/lib/icon/angle-double-right-line.js +1 -481
  35. package/lib/icon/angle-double-right.js +1 -481
  36. package/lib/icon/angle-double-up-line.js +1 -481
  37. package/lib/icon/angle-down-fill.js +1 -481
  38. package/lib/icon/angle-down-line.js +1 -481
  39. package/lib/icon/angle-down.js +1 -481
  40. package/lib/icon/angle-left.js +1 -481
  41. package/lib/icon/angle-right.js +1 -481
  42. package/lib/icon/angle-up-fill.js +1 -481
  43. package/lib/icon/angle-up.js +1 -481
  44. package/lib/icon/archive-fill.js +1 -481
  45. package/lib/icon/arrows-left.js +1 -481
  46. package/lib/icon/arrows-right.js +1 -481
  47. package/lib/icon/assistant.js +1 -481
  48. package/lib/icon/audio-fill.js +1 -481
  49. package/lib/icon/bk.js +1 -481
  50. package/lib/icon/circle.js +1 -481
  51. package/lib/icon/close-line.js +1 -481
  52. package/lib/icon/close.js +1 -481
  53. package/lib/icon/code.js +1 -481
  54. package/lib/icon/cog-shape.js +1 -481
  55. package/lib/icon/collapse-left.js +1 -481
  56. package/lib/icon/copy-shape.js +1 -481
  57. package/lib/icon/copy.js +1 -481
  58. package/lib/icon/data-shape.js +1 -481
  59. package/lib/icon/del.js +1 -481
  60. package/lib/icon/doc-fill.js +1 -481
  61. package/lib/icon/done.js +1 -481
  62. package/lib/icon/down-shape.js +1 -481
  63. package/lib/icon/down-small.js +1 -481
  64. package/lib/icon/edit-line.js +1 -481
  65. package/lib/icon/ellipsis.js +1 -481
  66. package/lib/icon/enlarge-line.js +1 -481
  67. package/lib/icon/error.js +1 -481
  68. package/lib/icon/excel-fill.js +1 -481
  69. package/lib/icon/exclamation-circle-shape.js +1 -481
  70. package/lib/icon/eye.js +1 -481
  71. package/lib/icon/filliscreen-line.js +1 -481
  72. package/lib/icon/fix-line.js +1 -481
  73. package/lib/icon/fix-shape.js +1 -481
  74. package/lib/icon/folder-open.js +1 -481
  75. package/lib/icon/folder-shape-open.js +1 -481
  76. package/lib/icon/folder-shape.js +1 -481
  77. package/lib/icon/folder.js +1 -481
  78. package/lib/icon/funnel.js +1 -481
  79. package/lib/icon/help-document-fill.js +1 -481
  80. package/lib/icon/help-fill.js +1 -481
  81. package/lib/icon/help.js +1 -481
  82. package/lib/icon/image-fill.js +1 -527
  83. package/lib/icon/img-error.js +1 -527
  84. package/lib/icon/img-placehoulder.js +1 -527
  85. package/lib/icon/index.js +1 -2367
  86. package/lib/icon/info-line.js +1 -527
  87. package/lib/icon/info.js +1 -527
  88. package/lib/icon/left-shape.js +1 -527
  89. package/lib/icon/left-turn-line.js +1 -527
  90. package/lib/icon/narrow-line.js +1 -527
  91. package/lib/icon/original.js +1 -527
  92. package/lib/icon/pdf-fill.js +1 -527
  93. package/lib/icon/play-shape.js +1 -527
  94. package/lib/icon/plus.js +1 -527
  95. package/lib/icon/ppt-fill.js +1 -527
  96. package/lib/icon/qq.js +1 -527
  97. package/lib/icon/right-shape.js +1 -527
  98. package/lib/icon/right-turn-line.js +1 -527
  99. package/lib/icon/search.js +1 -527
  100. package/lib/icon/share.js +1 -527
  101. package/lib/icon/spinner.js +1 -527
  102. package/lib/icon/success.js +1 -527
  103. package/lib/icon/switcher-loading.js +1 -527
  104. package/lib/icon/text-file.js +1 -527
  105. package/lib/icon/text-fill.js +1 -527
  106. package/lib/icon/transfer.js +1 -527
  107. package/lib/icon/tree-application-shape.js +1 -527
  108. package/lib/icon/unfull-screen.js +1 -527
  109. package/lib/icon/unvisible.js +1 -527
  110. package/lib/icon/up-shape.js +1 -527
  111. package/lib/icon/upload.js +1 -527
  112. package/lib/icon/video-fill.js +1 -527
  113. package/lib/icon/warn.js +1 -527
  114. package/lib/icon/weixin-pro.js +1 -527
  115. package/lib/icon/weixin.js +1 -527
  116. package/lib/image/index.js +1 -593
  117. package/lib/index.js +1 -97
  118. package/lib/info-box/index.js +2 -1456
  119. package/lib/info-box/index.js.LICENSE.txt +1 -0
  120. package/lib/input/index.js +2 -1528
  121. package/lib/input/index.js.LICENSE.txt +1 -0
  122. package/lib/link/index.js +1 -160
  123. package/lib/loading/index.js +1 -379
  124. package/lib/locale/index.js +1 -465
  125. package/lib/menu/index.js +1 -725
  126. package/lib/message/index.js +2 -1790
  127. package/lib/message/index.js.LICENSE.txt +6 -0
  128. package/lib/modal/index.js +1 -337
  129. package/lib/navigation/index.js +1 -367
  130. package/lib/notify/index.js +1 -394
  131. package/lib/overflow-title/index.js +1 -485
  132. package/lib/pagination/index.js +1 -880
  133. package/lib/plugin-popover/index.js +1 -4067
  134. package/lib/plugins/index.js +1 -63
  135. package/lib/pop-confirm/index.js +1 -273
  136. package/lib/popover/index.js +1 -4075
  137. package/lib/popover2/index.js +1 -107
  138. package/lib/preset.js +1 -93
  139. package/lib/process/index.js +2 -1099
  140. package/lib/process/index.js.LICENSE.txt +1 -0
  141. package/lib/progress/index.js +1 -428
  142. package/lib/radio/index.js +1 -627
  143. package/lib/rate/index.js +1 -338
  144. package/lib/resize-layout/index.js +1 -430
  145. package/lib/search-select/index.js +2 -3036
  146. package/lib/search-select/index.js.LICENSE.txt +1 -0
  147. package/lib/select/index.js +2 -2571
  148. package/lib/select/index.js.LICENSE.txt +1 -0
  149. package/lib/shared/index.js +1 -2865
  150. package/lib/sideslider/index.js +2 -1005
  151. package/lib/sideslider/index.js.LICENSE.txt +1 -0
  152. package/lib/slider/index.js +2 -1629
  153. package/lib/slider/index.js.LICENSE.txt +1 -0
  154. package/lib/steps/index.js +2 -1163
  155. package/lib/steps/index.js.LICENSE.txt +1 -0
  156. package/lib/swiper/index.js +1 -336
  157. package/lib/switcher/index.js +1 -277
  158. package/lib/tab/index.js +1 -859
  159. package/lib/table/index.js +1 -6568
  160. package/lib/table-column/index.js +1 -730
  161. package/lib/tag/index.js +1 -233
  162. package/lib/tag-input/index.js +1 -1652
  163. package/lib/time-picker/index.js +1 -71
  164. package/lib/timeline/index.js +1 -242
  165. package/lib/transfer/index.js +1 -673
  166. package/lib/tree/index.js +1 -2625
  167. package/lib/upload/index.js +2 -3193
  168. package/lib/upload/index.js.LICENSE.txt +1 -0
  169. package/lib/virtual-render/index.js +1 -748
  170. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
@@ -1,336 +1 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__ from "../shared";
2
- import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "vue";
3
- import * as __WEBPACK_EXTERNAL_MODULE__config_provider_9d0186d9__ from "../config-provider";
4
- /******/ // The require scope
5
- /******/ var __webpack_require__ = {};
6
- /******/
7
- /************************************************************************/
8
- /******/ /* webpack/runtime/define property getters */
9
- /******/ (() => {
10
- /******/ // define getter functions for harmony exports
11
- /******/ __webpack_require__.d = (exports, definition) => {
12
- /******/ for(var key in definition) {
13
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
14
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
15
- /******/ }
16
- /******/ }
17
- /******/ };
18
- /******/ })();
19
- /******/
20
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
21
- /******/ (() => {
22
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
23
- /******/ })();
24
- /******/
25
- /************************************************************************/
26
- var __webpack_exports__ = {};
27
-
28
- // EXPORTS
29
- __webpack_require__.d(__webpack_exports__, {
30
- Z: () => (/* binding */ src)
31
- });
32
-
33
- ;// CONCATENATED MODULE: external "../shared"
34
- var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
35
- var y = x => () => x
36
- const external_shared_namespaceObject = x({ ["PropTypes"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.PropTypes, ["withInstall"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.withInstall });
37
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/typeof.js
38
- function _typeof(obj) {
39
- "@babel/helpers - typeof";
40
-
41
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
42
- return typeof obj;
43
- } : function (obj) {
44
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
45
- }, _typeof(obj);
46
- }
47
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
48
-
49
- function _toPrimitive(input, hint) {
50
- if (_typeof(input) !== "object" || input === null) return input;
51
- var prim = input[Symbol.toPrimitive];
52
- if (prim !== undefined) {
53
- var res = prim.call(input, hint || "default");
54
- if (_typeof(res) !== "object") return res;
55
- throw new TypeError("@@toPrimitive must return a primitive value.");
56
- }
57
- return (hint === "string" ? String : Number)(input);
58
- }
59
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
60
-
61
-
62
- function _toPropertyKey(arg) {
63
- var key = _toPrimitive(arg, "string");
64
- return _typeof(key) === "symbol" ? key : String(key);
65
- }
66
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
67
-
68
- function _defineProperty(obj, key, value) {
69
- key = _toPropertyKey(key);
70
- if (key in obj) {
71
- Object.defineProperty(obj, key, {
72
- value: value,
73
- enumerable: true,
74
- configurable: true,
75
- writable: true
76
- });
77
- } else {
78
- obj[key] = value;
79
- }
80
- return obj;
81
- }
82
- ;// CONCATENATED MODULE: external "vue"
83
- var external_vue_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
84
- var external_vue_y = x => () => x
85
- const external_vue_namespaceObject = external_vue_x({ ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["onBeforeUnmount"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onBeforeUnmount, ["onMounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onMounted, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["toRefs"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.toRefs, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch });
86
- ;// CONCATENATED MODULE: external "../config-provider"
87
- var external_config_provider_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
88
- var external_config_provider_y = x => () => x
89
- const external_config_provider_namespaceObject = external_config_provider_x({ ["usePrefix"]: () => __WEBPACK_EXTERNAL_MODULE__config_provider_9d0186d9__.usePrefix });
90
- ;// CONCATENATED MODULE: ../../packages/swiper/src/swiper.tsx
91
-
92
-
93
- /*
94
- * Tencent is pleased to support the open source community by making
95
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
96
- *
97
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
98
- *
99
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
100
- *
101
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
102
- *
103
- * ---------------------------------------------------
104
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
105
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
106
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
107
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
108
- *
109
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
110
- * the Software.
111
- *
112
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
113
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
114
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
115
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
116
- * IN THE SOFTWARE.
117
- */
118
-
119
-
120
-
121
- /* harmony default export */ const swiper = ((0,external_vue_namespaceObject.defineComponent)({
122
- name: 'Swiper',
123
- props: {
124
- isLoop: external_shared_namespaceObject.PropTypes.bool.def(true),
125
- loopTime: external_shared_namespaceObject.PropTypes.number.def(8000),
126
- pics: external_shared_namespaceObject.PropTypes.array.def([]),
127
- list: external_shared_namespaceObject.PropTypes.array.def([]),
128
- height: external_shared_namespaceObject.PropTypes.number,
129
- width: external_shared_namespaceObject.PropTypes.number
130
- },
131
- emits: ['index-change'],
132
- setup: function setup(props, _ref) {
133
- var emit = _ref.emit,
134
- slots = _ref.slots;
135
- // 属性
136
- var _toRefs = (0,external_vue_namespaceObject.toRefs)(props),
137
- isLoop = _toRefs.isLoop,
138
- loopTime = _toRefs.loopTime,
139
- pics = _toRefs.pics,
140
- list = _toRefs.list,
141
- height = _toRefs.height,
142
- width = _toRefs.width;
143
- // 声明变量
144
- var swiperRef = (0,external_vue_namespaceObject.ref)();
145
- var swiperIndex = (0,external_vue_namespaceObject.ref)(0);
146
- var renderWidth = (0,external_vue_namespaceObject.ref)(0);
147
- var renderHeight = (0,external_vue_namespaceObject.ref)(0);
148
- var loopId = (0,external_vue_namespaceObject.ref)(0);
149
- var resizeObserver;
150
- var _usePrefix = (0,external_config_provider_namespaceObject.usePrefix)(),
151
- resolveClassName = _usePrefix.resolveClassName;
152
- // 计算属性
153
- var computedRenderDataList = (0,external_vue_namespaceObject.computed)(function () {
154
- var _a;
155
- return ((_a = list.value) === null || _a === void 0 ? void 0 : _a.length) > 0 ? list.value : pics.value;
156
- });
157
- var computedSwiperTranslateStyle = (0,external_vue_namespaceObject.computed)(function () {
158
- return {
159
- width: "".concat(renderWidth.value * computedRenderDataList.value.length, "px"),
160
- transform: "translateX(-".concat(renderWidth.value * swiperIndex.value, "px)")
161
- };
162
- });
163
- var computedSwiperRenderStyle = (0,external_vue_namespaceObject.computed)(function () {
164
- return {
165
- width: "".concat(renderWidth.value, "px"),
166
- height: "".concat(renderHeight.value, "px")
167
- };
168
- });
169
- // 方法
170
- var changeIndex = function changeIndex(index) {
171
- var showIndex = index;
172
- // 边界处理
173
- if (index >= computedRenderDataList.value.length) {
174
- showIndex = 0;
175
- }
176
- if (index < 0) {
177
- showIndex = computedRenderDataList.value.length - 1;
178
- }
179
- swiperIndex.value = showIndex;
180
- emit('index-change', showIndex);
181
- };
182
- var goToLink = function goToLink(link) {
183
- if (!link) return;
184
- window.open(link, '_blank');
185
- };
186
- var getRenderItemClass = function getRenderItemClass(renderData) {
187
- return ["".concat(resolveClassName('swiper-img')), _defineProperty({}, "".concat(resolveClassName('swiper-link')), renderData.link), renderData["class"]];
188
- };
189
- var getRenderItemStyle = function getRenderItemStyle(renderData) {
190
- return {
191
- 'background-image': "url(".concat(renderData.url, ")"),
192
- 'background-color': renderData.color
193
- };
194
- };
195
- var getRenderIndexStyle = function getRenderIndexStyle(index) {
196
- return _defineProperty({}, "".concat(resolveClassName('current-index')), swiperIndex.value === index);
197
- };
198
- var startLoop = function startLoop() {
199
- if (isLoop.value) {
200
- loopId.value = window.setTimeout(function () {
201
- changeIndex(swiperIndex.value + 1);
202
- startLoop();
203
- }, loopTime.value);
204
- }
205
- };
206
- var endLoop = function endLoop() {
207
- window.clearTimeout(loopId.value);
208
- };
209
- // 如果没有传递高宽属性,组件的高宽需要随着父元素的变化而变化
210
- var watchParentSizeChange = function watchParentSizeChange() {
211
- var _a;
212
- var parentEle = (_a = swiperRef.value) === null || _a === void 0 ? void 0 : _a.parentElement;
213
- if (!parentEle || !window.ResizeObserver) {
214
- return;
215
- }
216
- resizeObserver = new ResizeObserver(function () {
217
- calcSize();
218
- });
219
- resizeObserver.observe(parentEle);
220
- };
221
- var endWatchParentSizeChange = function endWatchParentSizeChange() {
222
- var _a;
223
- (_a = resizeObserver.disconnect) === null || _a === void 0 ? void 0 : _a.call(resizeObserver);
224
- };
225
- var getElementSize = function getElementSize(node) {
226
- if (node === undefined) {
227
- return {
228
- height: 0,
229
- width: 0
230
- };
231
- }
232
- var computedStyle = getComputedStyle(node);
233
- var width = node.clientWidth - parseFloat(computedStyle.paddingTop) - parseFloat(computedStyle.paddingBottom);
234
- var height = node.clientHeight - parseFloat(computedStyle.paddingLeft) - parseFloat(computedStyle.paddingRight);
235
- return {
236
- height: height,
237
- width: width
238
- };
239
- };
240
- // 计算组件的高宽 & 宽度
241
- var calcSize = function calcSize() {
242
- var _a;
243
- var swiperParentSize = getElementSize((_a = swiperRef.value) === null || _a === void 0 ? void 0 : _a.parentElement);
244
- renderWidth.value = +width.value > 0 ? width.value : swiperParentSize.width;
245
- renderHeight.value = +height.value > 0 ? height.value : swiperParentSize.height;
246
- };
247
- (0,external_vue_namespaceObject.watch)([height, width], calcSize);
248
- (0,external_vue_namespaceObject.onMounted)(function () {
249
- calcSize();
250
- startLoop();
251
- watchParentSizeChange();
252
- });
253
- (0,external_vue_namespaceObject.onBeforeUnmount)(function () {
254
- endLoop();
255
- endWatchParentSizeChange();
256
- });
257
- // render
258
- return function () {
259
- return (0,external_vue_namespaceObject.createVNode)("section", {
260
- "class": "".concat(resolveClassName('swiper-home')),
261
- "ref": swiperRef,
262
- "style": computedSwiperRenderStyle.value
263
- }, [(0,external_vue_namespaceObject.createVNode)("hgroup", {
264
- "style": computedSwiperTranslateStyle.value,
265
- "class": "".concat(resolveClassName('transition'), " ").concat(resolveClassName('swiper-main'))
266
- }, [computedRenderDataList.value.map(function (renderData) {
267
- var _a, _b;
268
- return (0,external_vue_namespaceObject.createVNode)("h3", {
269
- "class": "".concat(resolveClassName('swiper-card')),
270
- "style": computedSwiperRenderStyle.value
271
- }, [(_b = (_a = slots["default"]) === null || _a === void 0 ? void 0 : _a.call(slots, renderData)) !== null && _b !== void 0 ? _b : (0,external_vue_namespaceObject.createVNode)("span", {
272
- "class": getRenderItemClass(renderData),
273
- "style": getRenderItemStyle(renderData),
274
- "onClick": function onClick() {
275
- return goToLink(renderData.link);
276
- }
277
- }, null)]);
278
- })]), (0,external_vue_namespaceObject.createVNode)("ul", {
279
- "class": "".concat(resolveClassName('swiper-index'))
280
- }, [computedRenderDataList.value.map(function (_, index) {
281
- return (0,external_vue_namespaceObject.createVNode)("li", {
282
- "class": getRenderIndexStyle(index),
283
- "onMouseover": function onMouseover() {
284
- return changeIndex(index);
285
- }
286
- }, null);
287
- })]), (0,external_vue_namespaceObject.createVNode)("span", {
288
- "class": "".concat(resolveClassName('swiper-nav'), " ").concat(resolveClassName('nav-prev')),
289
- "onClick": function onClick() {
290
- return changeIndex(swiperIndex.value - 1);
291
- }
292
- }, [(0,external_vue_namespaceObject.createVNode)("i", {
293
- "class": "".concat(resolveClassName('swiper-nav-icon'))
294
- }, null)]), (0,external_vue_namespaceObject.createVNode)("span", {
295
- "class": "".concat(resolveClassName('swiper-nav'), " ").concat(resolveClassName('nav-next')),
296
- "onClick": function onClick() {
297
- return changeIndex(swiperIndex.value + 1);
298
- }
299
- }, [(0,external_vue_namespaceObject.createVNode)("i", {
300
- "class": "".concat(resolveClassName('swiper-nav-icon'))
301
- }, null)])]);
302
- };
303
- }
304
- }));
305
- ;// CONCATENATED MODULE: ../../packages/swiper/src/index.ts
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
- var BkSwiper = (0,external_shared_namespaceObject.withInstall)(swiper);
334
- /* harmony default export */ const src = (BkSwiper);
335
- var __webpack_exports__default = __webpack_exports__.Z;
336
- export { __webpack_exports__default as default };
1
+ import*as e from"../shared";import*as n from"vue";import*as t from"../config-provider";var o={d:(e,n)=>{for(var t in n)o.o(n,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n)},r={};o.d(r,{Z:()=>d});const a=(i={PropTypes:()=>e.PropTypes,withInstall:()=>e.withInstall},u={},o.d(u,i),u);var i,u;function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function c(e,n,t){return(n=function(e){var n=function(e,n){if("object"!==l(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!==l(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===l(n)?n:String(n)}(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}const s=(e=>{var n={};return o.d(n,e),n})({computed:()=>n.computed,createVNode:()=>n.createVNode,defineComponent:()=>n.defineComponent,onBeforeUnmount:()=>n.onBeforeUnmount,onMounted:()=>n.onMounted,ref:()=>n.ref,toRefs:()=>n.toRefs,watch:()=>n.watch}),p=(e=>{var n={};return o.d(n,e),n})({usePrefix:()=>t.usePrefix}),v=(0,s.defineComponent)({name:"Swiper",props:{isLoop:a.PropTypes.bool.def(!0),loopTime:a.PropTypes.number.def(8e3),pics:a.PropTypes.array.def([]),list:a.PropTypes.array.def([]),height:a.PropTypes.number,width:a.PropTypes.number},emits:["index-change"],setup:function(e,n){var t,o=n.emit,r=n.slots,a=(0,s.toRefs)(e),i=a.isLoop,u=a.loopTime,l=a.pics,v=a.list,d=a.height,f=a.width,m=(0,s.ref)(),h=(0,s.ref)(0),w=(0,s.ref)(0),y=(0,s.ref)(0),g=(0,s.ref)(0),b=(0,p.usePrefix)().resolveClassName,P=(0,s.computed)((function(){var e;return(null===(e=v.value)||void 0===e?void 0:e.length)>0?v.value:l.value})),T=(0,s.computed)((function(){return{width:"".concat(w.value*P.value.length,"px"),transform:"translateX(-".concat(w.value*h.value,"px)")}})),x=(0,s.computed)((function(){return{width:"".concat(w.value,"px"),height:"".concat(y.value,"px")}})),N=function(e){var n=e;e>=P.value.length&&(n=0),e<0&&(n=P.value.length-1),h.value=n,o("index-change",n)},V=function(e){return["".concat(b("swiper-img")),c({},"".concat(b("swiper-link")),e.link),e.class]},S=function(e){return{"background-image":"url(".concat(e.url,")"),"background-color":e.color}},k=function(e){return c({},"".concat(b("current-index")),h.value===e)},C=function e(){i.value&&(g.value=window.setTimeout((function(){N(h.value+1),e()}),u.value))},O=function(){var e,n=function(e){if(void 0===e)return{height:0,width:0};var n=getComputedStyle(e),t=e.clientWidth-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom);return{height:e.clientHeight-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight),width:t}}(null===(e=m.value)||void 0===e?void 0:e.parentElement);w.value=+f.value>0?f.value:n.width,y.value=+d.value>0?d.value:n.height};return(0,s.watch)([d,f],O),(0,s.onMounted)((function(){var e,n;O(),C(),(n=null===(e=m.value)||void 0===e?void 0:e.parentElement)&&window.ResizeObserver&&(t=new ResizeObserver((function(){O()}))).observe(n)})),(0,s.onBeforeUnmount)((function(){var e;window.clearTimeout(g.value),null===(e=t.disconnect)||void 0===e||e.call(t)})),function(){return(0,s.createVNode)("section",{class:"".concat(b("swiper-home")),ref:m,style:x.value},[(0,s.createVNode)("hgroup",{style:T.value,class:"".concat(b("transition")," ").concat(b("swiper-main"))},[P.value.map((function(e){var n,t;return(0,s.createVNode)("h3",{class:"".concat(b("swiper-card")),style:x.value},[null!==(t=null===(n=r.default)||void 0===n?void 0:n.call(r,e))&&void 0!==t?t:(0,s.createVNode)("span",{class:V(e),style:S(e),onClick:function(){var n;(n=e.link)&&window.open(n,"_blank")}},null)])}))]),(0,s.createVNode)("ul",{class:"".concat(b("swiper-index"))},[P.value.map((function(e,n){return(0,s.createVNode)("li",{class:k(n),onMouseover:function(){return N(n)}},null)}))]),(0,s.createVNode)("span",{class:"".concat(b("swiper-nav")," ").concat(b("nav-prev")),onClick:function(){return N(h.value-1)}},[(0,s.createVNode)("i",{class:"".concat(b("swiper-nav-icon"))},null)]),(0,s.createVNode)("span",{class:"".concat(b("swiper-nav")," ").concat(b("nav-next")),onClick:function(){return N(h.value+1)}},[(0,s.createVNode)("i",{class:"".concat(b("swiper-nav-icon"))},null)])])}}}),d=(0,a.withInstall)(v);var f=r.Z;export{f as default};
@@ -1,277 +1 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__ from "../shared";
2
- import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "vue";
3
- import * as __WEBPACK_EXTERNAL_MODULE__config_provider_9d0186d9__ from "../config-provider";
4
- import * as __WEBPACK_EXTERNAL_MODULE__icon_85385c3e__ from "../icon";
5
- /******/ // The require scope
6
- /******/ var __webpack_require__ = {};
7
- /******/
8
- /************************************************************************/
9
- /******/ /* webpack/runtime/define property getters */
10
- /******/ (() => {
11
- /******/ // define getter functions for harmony exports
12
- /******/ __webpack_require__.d = (exports, definition) => {
13
- /******/ for(var key in definition) {
14
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
15
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
16
- /******/ }
17
- /******/ }
18
- /******/ };
19
- /******/ })();
20
- /******/
21
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
22
- /******/ (() => {
23
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
24
- /******/ })();
25
- /******/
26
- /************************************************************************/
27
- var __webpack_exports__ = {};
28
-
29
- // EXPORTS
30
- __webpack_require__.d(__webpack_exports__, {
31
- Z: () => (/* binding */ src)
32
- });
33
-
34
- ;// CONCATENATED MODULE: external "../shared"
35
- var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
36
- var y = x => () => x
37
- const external_shared_namespaceObject = x({ ["PropTypes"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.PropTypes, ["SwitcherThemeType"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.SwitcherThemeType, ["useFormItem"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.useFormItem, ["withInstall"]: () => __WEBPACK_EXTERNAL_MODULE__shared_65459f0a__.withInstall });
38
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/typeof.js
39
- function _typeof(obj) {
40
- "@babel/helpers - typeof";
41
-
42
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
43
- return typeof obj;
44
- } : function (obj) {
45
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
46
- }, _typeof(obj);
47
- }
48
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
49
-
50
- function _toPrimitive(input, hint) {
51
- if (_typeof(input) !== "object" || input === null) return input;
52
- var prim = input[Symbol.toPrimitive];
53
- if (prim !== undefined) {
54
- var res = prim.call(input, hint || "default");
55
- if (_typeof(res) !== "object") return res;
56
- throw new TypeError("@@toPrimitive must return a primitive value.");
57
- }
58
- return (hint === "string" ? String : Number)(input);
59
- }
60
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
61
-
62
-
63
- function _toPropertyKey(arg) {
64
- var key = _toPrimitive(arg, "string");
65
- return _typeof(key) === "symbol" ? key : String(key);
66
- }
67
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
68
-
69
- function _defineProperty(obj, key, value) {
70
- key = _toPropertyKey(key);
71
- if (key in obj) {
72
- Object.defineProperty(obj, key, {
73
- value: value,
74
- enumerable: true,
75
- configurable: true,
76
- writable: true
77
- });
78
- } else {
79
- obj[key] = value;
80
- }
81
- return obj;
82
- }
83
- ;// CONCATENATED MODULE: external "vue"
84
- var external_vue_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
85
- var external_vue_y = x => () => x
86
- const external_vue_namespaceObject = external_vue_x({ ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch });
87
- ;// CONCATENATED MODULE: external "../config-provider"
88
- var external_config_provider_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
89
- var external_config_provider_y = x => () => x
90
- const external_config_provider_namespaceObject = external_config_provider_x({ ["usePrefix"]: () => __WEBPACK_EXTERNAL_MODULE__config_provider_9d0186d9__.usePrefix });
91
- ;// CONCATENATED MODULE: external "../icon"
92
- var external_icon_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
93
- var external_icon_y = x => () => x
94
- const external_icon_namespaceObject = external_icon_x({ ["SwitcherLoading"]: () => __WEBPACK_EXTERNAL_MODULE__icon_85385c3e__.SwitcherLoading });
95
- ;// CONCATENATED MODULE: ../../packages/switcher/src/switcher.tsx
96
-
97
- var _switcherEmitEventsTy;
98
-
99
- /*
100
- * Tencent is pleased to support the open source community by making
101
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
102
- *
103
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
104
- *
105
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
106
- *
107
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
108
- *
109
- * ---------------------------------------------------
110
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
111
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
112
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
113
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
114
- *
115
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
116
- * the Software.
117
- *
118
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
119
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
120
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
121
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
122
- * IN THE SOFTWARE.
123
- */
124
-
125
-
126
-
127
-
128
- var switcherType = {
129
- theme: (0,external_shared_namespaceObject.SwitcherThemeType)(),
130
- size: external_shared_namespaceObject.PropTypes.size(),
131
- disabled: external_shared_namespaceObject.PropTypes.bool,
132
- showText: external_shared_namespaceObject.PropTypes.bool,
133
- isOutline: external_shared_namespaceObject.PropTypes.bool,
134
- onText: external_shared_namespaceObject.PropTypes.string.def('ON'),
135
- offText: external_shared_namespaceObject.PropTypes.string.def('OFF'),
136
- isSquare: external_shared_namespaceObject.PropTypes.bool,
137
- extCls: external_shared_namespaceObject.PropTypes.string,
138
- beforeChange: external_shared_namespaceObject.PropTypes.func.def(undefined),
139
- trueValue: external_shared_namespaceObject.PropTypes.oneOfType([external_shared_namespaceObject.PropTypes.string, external_shared_namespaceObject.PropTypes.number, external_shared_namespaceObject.PropTypes.bool]).def(true),
140
- falseValue: external_shared_namespaceObject.PropTypes.oneOfType([external_shared_namespaceObject.PropTypes.string, external_shared_namespaceObject.PropTypes.number, external_shared_namespaceObject.PropTypes.bool]).def(false),
141
- value: external_shared_namespaceObject.PropTypes.oneOfType([external_shared_namespaceObject.PropTypes.string, external_shared_namespaceObject.PropTypes.number, external_shared_namespaceObject.PropTypes.bool]).def(false),
142
- modelValue: external_shared_namespaceObject.PropTypes.oneOfType([external_shared_namespaceObject.PropTypes.string, external_shared_namespaceObject.PropTypes.number, external_shared_namespaceObject.PropTypes.bool]).def(false),
143
- withValidate: external_shared_namespaceObject.PropTypes.bool.def(true)
144
- };
145
- var EVENTS;
146
- (function (EVENTS) {
147
- EVENTS["UPDATE"] = "update:modelValue";
148
- EVENTS["CHANGE"] = "change";
149
- })(EVENTS || (EVENTS = {}));
150
- function EventFunction(value) {
151
- return value;
152
- }
153
- function ChangeFunction(value) {
154
- return !!value;
155
- }
156
- var switcherEmitEventsType = (_switcherEmitEventsTy = {}, _defineProperty(_switcherEmitEventsTy, EVENTS.UPDATE, EventFunction), _defineProperty(_switcherEmitEventsTy, EVENTS.CHANGE, ChangeFunction), _switcherEmitEventsTy);
157
- /* harmony default export */ const switcher = ((0,external_vue_namespaceObject.defineComponent)({
158
- name: 'Switcher',
159
- props: switcherType,
160
- emits: switcherEmitEventsType,
161
- setup: function setup(props, _ref) {
162
- var emit = _ref.emit;
163
- var formItem = (0,external_shared_namespaceObject.useFormItem)();
164
- var _usePrefix = (0,external_config_provider_namespaceObject.usePrefix)(),
165
- resolveClassName = _usePrefix.resolveClassName;
166
- var isLoading = (0,external_vue_namespaceObject.ref)(false);
167
- var isChecked = (0,external_vue_namespaceObject.computed)(function () {
168
- return props.trueValue === localValue.value;
169
- });
170
- var isModelValue = (0,external_vue_namespaceObject.ref)(props.modelValue !== false);
171
- var localValue = (0,external_vue_namespaceObject.computed)(function () {
172
- return isModelValue.value ? props.modelValue : props.value;
173
- });
174
- var classObject = (0,external_vue_namespaceObject.computed)(function () {
175
- var _cls;
176
- var cls = (_cls = {}, _defineProperty(_cls, props.extCls, !!props.extCls), _defineProperty(_cls, "".concat(resolveClassName('switcher')), true), _defineProperty(_cls, "".concat(resolveClassName('switcher-outline')), props.isOutline), _defineProperty(_cls, "".concat(resolveClassName('switcher-square')), props.isSquare), _defineProperty(_cls, 'show-label', props.showText), _defineProperty(_cls, 'is-disabled', props.disabled), _defineProperty(_cls, 'is-checked', isChecked.value), _defineProperty(_cls, 'is-unchecked', !isChecked.value), _defineProperty(_cls, 'is-loading', isLoading.value), _defineProperty(_cls, "".concat(resolveClassName('primary')), props.theme === 'primary'), _cls);
177
- // 显示文本则size无效,使用固定尺寸
178
- if (props.size && !props.showText) {
179
- var sizeStr = "".concat(resolveClassName("switcher-".concat(props.size)));
180
- cls[sizeStr] = true;
181
- }
182
- return cls;
183
- });
184
- (0,external_vue_namespaceObject.watch)(function () {
185
- return props.modelValue;
186
- }, function () {
187
- var _a;
188
- isModelValue.value = true;
189
- if (props.withValidate) {
190
- (_a = formItem === null || formItem === void 0 ? void 0 : formItem.validate) === null || _a === void 0 ? void 0 : _a.call(formItem, 'change');
191
- }
192
- });
193
- (0,external_vue_namespaceObject.watch)(function () {
194
- return props.value;
195
- }, function () {
196
- isModelValue.value = false;
197
- });
198
- var handleChange = function handleChange(event) {
199
- event.stopPropagation();
200
- event.preventDefault();
201
- if (props.disabled || isLoading.value) {
202
- return;
203
- }
204
- var lastValue = isChecked.value ? props.falseValue : props.trueValue;
205
- var lastChecked = !isChecked.value;
206
- var trigger = function trigger() {
207
- emit(EVENTS.UPDATE, lastValue);
208
- emit(EVENTS.CHANGE, lastChecked);
209
- };
210
- var goodJob = true;
211
- if (typeof props.beforeChange === 'function') {
212
- goodJob = props.beforeChange(lastValue);
213
- if (typeof goodJob.then === 'function') {
214
- isLoading.value = true;
215
- return goodJob.then(function () {
216
- trigger();
217
- })["finally"](function () {
218
- isLoading.value = false;
219
- });
220
- }
221
- }
222
- if (goodJob) {
223
- trigger();
224
- }
225
- };
226
- var handleKeydown = function handleKeydown(e) {
227
- // Enter 键盘事件可触发开关切换
228
- if (e.code === 'Enter' || e.key === 'Enter' || e.keyCode === 13) {
229
- handleChange(e);
230
- }
231
- };
232
- return function () {
233
- return (0,external_vue_namespaceObject.createVNode)("div", {
234
- "class": classObject.value,
235
- "onClick": handleChange,
236
- "tabindex": "0",
237
- "onKeydown": handleKeydown
238
- }, [isLoading.value ? (0,external_vue_namespaceObject.createVNode)(external_icon_namespaceObject.SwitcherLoading, {
239
- "class": "".concat(resolveClassName('switcher-loading'))
240
- }, null) : '', props.showText ? (0,external_vue_namespaceObject.createVNode)("span", {
241
- "class": "switcher-text"
242
- }, [isChecked.value ? props.onText : props.offText]) : '']);
243
- };
244
- }
245
- }));
246
- ;// CONCATENATED MODULE: ../../packages/switcher/src/index.ts
247
- /*
248
- * Tencent is pleased to support the open source community by making
249
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
250
- *
251
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
252
- *
253
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
254
- *
255
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
256
- *
257
- * ---------------------------------------------------
258
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
259
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
260
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
261
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
262
- *
263
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
264
- * the Software.
265
- *
266
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
267
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
268
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
269
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
270
- * IN THE SOFTWARE.
271
- */
272
-
273
-
274
- var BkSwitcher = (0,external_shared_namespaceObject.withInstall)(switcher);
275
- /* harmony default export */ const src = (BkSwitcher);
276
- var __webpack_exports__default = __webpack_exports__.Z;
277
- export { __webpack_exports__default as default };
1
+ import*as e from"../shared";import*as o from"vue";import*as r from"../config-provider";import*as t from"../icon";var n={d:(e,o)=>{for(var r in o)n.o(o,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o)},i={};n.d(i,{Z:()=>b});const a=(u={PropTypes:()=>e.PropTypes,SwitcherThemeType:()=>e.SwitcherThemeType,useFormItem:()=>e.useFormItem,withInstall:()=>e.withInstall},s={},n.d(s,u),s);var u,s;function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function p(e,o,r){return(o=function(e){var o=function(e,o){if("object"!==l(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var t=r.call(e,"string");if("object"!==l(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===l(o)?o:String(o)}(o))in e?Object.defineProperty(e,o,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[o]=r,e}const c=(e=>{var o={};return n.d(o,e),o})({computed:()=>o.computed,createVNode:()=>o.createVNode,defineComponent:()=>o.defineComponent,ref:()=>o.ref,watch:()=>o.watch}),f=(e=>{var o={};return n.d(o,e),o})({usePrefix:()=>r.usePrefix}),d=(e=>{var o={};return n.d(o,e),o})({SwitcherLoading:()=>t.SwitcherLoading});var y,m,v={theme:(0,a.SwitcherThemeType)(),size:a.PropTypes.size(),disabled:a.PropTypes.bool,showText:a.PropTypes.bool,isOutline:a.PropTypes.bool,onText:a.PropTypes.string.def("ON"),offText:a.PropTypes.string.def("OFF"),isSquare:a.PropTypes.bool,extCls:a.PropTypes.string,beforeChange:a.PropTypes.func.def(void 0),trueValue:a.PropTypes.oneOfType([a.PropTypes.string,a.PropTypes.number,a.PropTypes.bool]).def(!0),falseValue:a.PropTypes.oneOfType([a.PropTypes.string,a.PropTypes.number,a.PropTypes.bool]).def(!1),value:a.PropTypes.oneOfType([a.PropTypes.string,a.PropTypes.number,a.PropTypes.bool]).def(!1),modelValue:a.PropTypes.oneOfType([a.PropTypes.string,a.PropTypes.number,a.PropTypes.bool]).def(!1),withValidate:a.PropTypes.bool.def(!0)};!function(e){e.UPDATE="update:modelValue",e.CHANGE="change"}(m||(m={}));var T=(p(y={},m.UPDATE,(function(e){return e})),p(y,m.CHANGE,(function(e){return!!e})),y);const h=(0,c.defineComponent)({name:"Switcher",props:v,emits:T,setup:function(e,o){var r=o.emit,t=(0,a.useFormItem)(),n=(0,f.usePrefix)().resolveClassName,i=(0,c.ref)(!1),u=(0,c.computed)((function(){return e.trueValue===l.value})),s=(0,c.ref)(!1!==e.modelValue),l=(0,c.computed)((function(){return s.value?e.modelValue:e.value})),y=(0,c.computed)((function(){var o,r=(p(o={},e.extCls,!!e.extCls),p(o,"".concat(n("switcher")),!0),p(o,"".concat(n("switcher-outline")),e.isOutline),p(o,"".concat(n("switcher-square")),e.isSquare),p(o,"show-label",e.showText),p(o,"is-disabled",e.disabled),p(o,"is-checked",u.value),p(o,"is-unchecked",!u.value),p(o,"is-loading",i.value),p(o,"".concat(n("primary")),"primary"===e.theme),o);return e.size&&!e.showText&&(r["".concat(n("switcher-".concat(e.size)))]=!0),r}));(0,c.watch)((function(){return e.modelValue}),(function(){var o;s.value=!0,e.withValidate&&(null===(o=null==t?void 0:t.validate)||void 0===o||o.call(t,"change"))})),(0,c.watch)((function(){return e.value}),(function(){s.value=!1}));var v=function(o){if(o.stopPropagation(),o.preventDefault(),!e.disabled&&!i.value){var t=u.value?e.falseValue:e.trueValue,n=!u.value,a=function(){r(m.UPDATE,t),r(m.CHANGE,n)},s=!0;if("function"==typeof e.beforeChange&&"function"==typeof(s=e.beforeChange(t)).then)return i.value=!0,s.then((function(){a()})).finally((function(){i.value=!1}));s&&a()}},T=function(e){"Enter"!==e.code&&"Enter"!==e.key&&13!==e.keyCode||v(e)};return function(){return(0,c.createVNode)("div",{class:y.value,onClick:v,tabindex:"0",onKeydown:T},[i.value?(0,c.createVNode)(d.SwitcherLoading,{class:"".concat(n("switcher-loading"))},null):"",e.showText?(0,c.createVNode)("span",{class:"switcher-text"},[u.value?e.onText:e.offText]):""])}}}),b=(0,a.withInstall)(h);var P=i.Z;export{P as default};