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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/dist/index.cjs.js +36 -36
  2. package/dist/index.esm.js +33 -3
  3. package/dist/index.umd.js +35 -35
  4. package/dist/style.css +1 -1
  5. package/dist/style.variable.css +1 -1
  6. package/lib/affix/index.js +1 -353
  7. package/lib/alert/index.js +1 -251
  8. package/lib/animate-number/index.js +1 -226
  9. package/lib/backtop/index.js +1 -260
  10. package/lib/badge/index.js +1 -274
  11. package/lib/breadcrumb/index.js +1 -329
  12. package/lib/button/index.js +1 -371
  13. package/lib/card/index.js +1 -326
  14. package/lib/cascader/index.js +1 -2168
  15. package/lib/checkbox/index.js +1 -571
  16. package/lib/code-diff/index.js +1 -5520
  17. package/lib/collapse/index.js +1 -698
  18. package/lib/color-picker/index.js +1 -2816
  19. package/lib/components.js +1 -759
  20. package/lib/container/index.js +1 -369
  21. package/lib/date-picker/index.js +1 -5601
  22. package/lib/dialog/index.js +1 -545
  23. package/lib/directives/index.js +2 -1427
  24. package/lib/directives/index.js.LICENSE.txt +14 -0
  25. package/lib/dist.index.js +1 -166
  26. package/lib/divider/index.js +1 -512
  27. package/lib/dropdown/index.js +1 -414
  28. package/lib/exception/index.js +1 -405
  29. package/lib/fixed-navbar/index.js +1 -214
  30. package/lib/form/index.js +1 -986
  31. package/lib/icon/angle-double-down-line.js +1 -426
  32. package/lib/icon/angle-double-left-line.js +1 -426
  33. package/lib/icon/angle-double-left.js +1 -426
  34. package/lib/icon/angle-double-right-line.js +1 -426
  35. package/lib/icon/angle-double-right.js +1 -426
  36. package/lib/icon/angle-double-up-line.js +1 -426
  37. package/lib/icon/angle-down-fill.js +1 -426
  38. package/lib/icon/angle-down-line.js +1 -426
  39. package/lib/icon/angle-down.js +1 -426
  40. package/lib/icon/angle-left.js +1 -426
  41. package/lib/icon/angle-right.js +1 -426
  42. package/lib/icon/angle-up-fill.js +1 -426
  43. package/lib/icon/angle-up.js +1 -426
  44. package/lib/icon/archive-fill.js +1 -426
  45. package/lib/icon/arrows-left.js +1 -426
  46. package/lib/icon/arrows-right.js +1 -426
  47. package/lib/icon/audio-fill.js +1 -426
  48. package/lib/icon/bk.js +1 -426
  49. package/lib/icon/circle.js +1 -426
  50. package/lib/icon/close-line.js +1 -426
  51. package/lib/icon/close.js +1 -426
  52. package/lib/icon/code.js +1 -426
  53. package/lib/icon/cog-shape.js +1 -426
  54. package/lib/icon/collapse-left.js +1 -426
  55. package/lib/icon/copy.js +1 -426
  56. package/lib/icon/data-shape.js +1 -426
  57. package/lib/icon/del.js +1 -426
  58. package/lib/icon/doc-fill.js +1 -426
  59. package/lib/icon/done.js +1 -426
  60. package/lib/icon/down-shape.js +1 -426
  61. package/lib/icon/down-small.js +1 -426
  62. package/lib/icon/edit-line.js +1 -426
  63. package/lib/icon/ellipsis.js +1 -426
  64. package/lib/icon/enlarge-line.js +1 -426
  65. package/lib/icon/error.js +1 -426
  66. package/lib/icon/excel-fill.js +1 -426
  67. package/lib/icon/exclamation-circle-shape.js +1 -426
  68. package/lib/icon/eye.js +1 -426
  69. package/lib/icon/filliscreen-line.js +1 -426
  70. package/lib/icon/folder-open.js +1 -426
  71. package/lib/icon/folder-shape-open.js +1 -426
  72. package/lib/icon/folder-shape.js +1 -426
  73. package/lib/icon/folder.js +1 -426
  74. package/lib/icon/funnel.js +1 -426
  75. package/lib/icon/help-document-fill.js +1 -426
  76. package/lib/icon/help-fill.js +1 -426
  77. package/lib/icon/help.js +1 -426
  78. package/lib/icon/image-fill.js +1 -426
  79. package/lib/icon/img-placehoulder.js +1 -448
  80. package/lib/icon/index.js +1 -2275
  81. package/lib/icon/info-line.js +1 -448
  82. package/lib/icon/info.js +1 -448
  83. package/lib/icon/left-shape.js +1 -448
  84. package/lib/icon/left-turn-line.js +1 -448
  85. package/lib/icon/narrow-line.js +1 -448
  86. package/lib/icon/original.js +1 -448
  87. package/lib/icon/pdf-fill.js +1 -448
  88. package/lib/icon/play-shape.js +1 -448
  89. package/lib/icon/plus.js +1 -448
  90. package/lib/icon/ppt-fill.js +1 -448
  91. package/lib/icon/qq.js +1 -448
  92. package/lib/icon/right-shape.js +1 -448
  93. package/lib/icon/right-turn-line.js +1 -448
  94. package/lib/icon/search.js +1 -448
  95. package/lib/icon/share.js +1 -448
  96. package/lib/icon/spinner.js +1 -448
  97. package/lib/icon/success.js +1 -448
  98. package/lib/icon/switcher-loading.js +1 -448
  99. package/lib/icon/text-file.js +1 -448
  100. package/lib/icon/text-fill.js +1 -448
  101. package/lib/icon/transfer.js +1 -448
  102. package/lib/icon/tree-application-shape.js +1 -448
  103. package/lib/icon/unfull-screen.js +1 -448
  104. package/lib/icon/unvisible.js +1 -448
  105. package/lib/icon/up-shape.js +1 -448
  106. package/lib/icon/upload.js +1 -448
  107. package/lib/icon/video-fill.js +1 -448
  108. package/lib/icon/warn.js +1 -448
  109. package/lib/icon/weixin.js +1 -448
  110. package/lib/image/index.js +1 -873
  111. package/lib/index.js +1 -169
  112. package/lib/info-box/index.js +1 -1784
  113. package/lib/input/index.js +1 -846
  114. package/lib/link/index.js +1 -226
  115. package/lib/loading/index.js +1 -309
  116. package/lib/menu/index.js +1 -796
  117. package/lib/message/index.js +1 -401
  118. package/lib/modal/index.js +1 -395
  119. package/lib/navigation/index.js +1 -431
  120. package/lib/notify/index.js +1 -430
  121. package/lib/overflow-title/index.js +1 -512
  122. package/lib/pagination/index.js +1 -1026
  123. package/lib/plugin-popover/index.js +1 -2581
  124. package/lib/plugins/index.js +1 -130
  125. package/lib/popover/index.js +1 -2587
  126. package/lib/popover2/index.js +1 -172
  127. package/lib/preset.js +1 -129
  128. package/lib/process/index.js +1 -1417
  129. package/lib/progress/index.js +1 -479
  130. package/lib/radio/index.js +1 -649
  131. package/lib/rate/index.js +1 -358
  132. package/lib/resize-layout/index.js +1 -495
  133. package/lib/search-select/index.js +1 -3388
  134. package/lib/search-select/search-select.css +1 -1
  135. package/lib/search-select/search-select.less +1 -1
  136. package/lib/search-select/search-select.variable.css +1 -1
  137. package/lib/select/index.js +1 -2819
  138. package/lib/shared/index.js +1 -2813
  139. package/lib/sideslider/index.js +1 -1362
  140. package/lib/slider/index.js +1 -2060
  141. package/lib/steps/index.js +1 -1504
  142. package/lib/swiper/index.js +1 -374
  143. package/lib/switcher/index.js +1 -308
  144. package/lib/tab/index.js +1 -919
  145. package/lib/table/index.js +1 -6635
  146. package/lib/table-column/index.js +1 -737
  147. package/lib/tag/index.js +1 -278
  148. package/lib/tag-input/index.js +1 -1897
  149. package/lib/time-picker/index.js +1 -142
  150. package/lib/timeline/index.js +1 -315
  151. package/lib/transfer/index.js +1 -658
  152. package/lib/tree/index.js +1 -2917
  153. package/lib/upload/index.js +1 -3735
  154. package/lib/virtual-render/index.js +1 -825
  155. package/package.json +2 -1
@@ -1,308 +1 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory(require("../shared"), require("vue"), require("../icon"));
4
- else if(typeof define === 'function' && define.amd)
5
- define(["../shared", "vue", "../icon"], factory);
6
- else {
7
- var a = typeof exports === 'object' ? factory(require("../shared"), require("vue"), require("../icon")) : factory(root["../shared"], root["vue"], root["../icon"]);
8
- for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
9
- }
10
- })(self, (__WEBPACK_EXTERNAL_MODULE__4212__, __WEBPACK_EXTERNAL_MODULE__748__, __WEBPACK_EXTERNAL_MODULE__6870__) => {
11
- return /******/ (() => { // webpackBootstrap
12
- /******/ "use strict";
13
- /******/ var __webpack_modules__ = ({
14
-
15
- /***/ 6870:
16
- /***/ ((module) => {
17
-
18
- module.exports = __WEBPACK_EXTERNAL_MODULE__6870__;
19
-
20
- /***/ }),
21
-
22
- /***/ 4212:
23
- /***/ ((module) => {
24
-
25
- module.exports = __WEBPACK_EXTERNAL_MODULE__4212__;
26
-
27
- /***/ }),
28
-
29
- /***/ 748:
30
- /***/ ((module) => {
31
-
32
- module.exports = __WEBPACK_EXTERNAL_MODULE__748__;
33
-
34
- /***/ })
35
-
36
- /******/ });
37
- /************************************************************************/
38
- /******/ // The module cache
39
- /******/ var __webpack_module_cache__ = {};
40
- /******/
41
- /******/ // The require function
42
- /******/ function __webpack_require__(moduleId) {
43
- /******/ // Check if module is in cache
44
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
45
- /******/ if (cachedModule !== undefined) {
46
- /******/ return cachedModule.exports;
47
- /******/ }
48
- /******/ // Create a new module (and put it into the cache)
49
- /******/ var module = __webpack_module_cache__[moduleId] = {
50
- /******/ // no module.id needed
51
- /******/ // no module.loaded needed
52
- /******/ exports: {}
53
- /******/ };
54
- /******/
55
- /******/ // Execute the module function
56
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
57
- /******/
58
- /******/ // Return the exports of the module
59
- /******/ return module.exports;
60
- /******/ }
61
- /******/
62
- /************************************************************************/
63
- /******/ /* webpack/runtime/define property getters */
64
- /******/ (() => {
65
- /******/ // define getter functions for harmony exports
66
- /******/ __webpack_require__.d = (exports, definition) => {
67
- /******/ for(var key in definition) {
68
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
69
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
70
- /******/ }
71
- /******/ }
72
- /******/ };
73
- /******/ })();
74
- /******/
75
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
76
- /******/ (() => {
77
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
78
- /******/ })();
79
- /******/
80
- /******/ /* webpack/runtime/make namespace object */
81
- /******/ (() => {
82
- /******/ // define __esModule on exports
83
- /******/ __webpack_require__.r = (exports) => {
84
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
85
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
86
- /******/ }
87
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
88
- /******/ };
89
- /******/ })();
90
- /******/
91
- /************************************************************************/
92
- var __webpack_exports__ = {};
93
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
94
- (() => {
95
- // ESM COMPAT FLAG
96
- __webpack_require__.r(__webpack_exports__);
97
-
98
- // EXPORTS
99
- __webpack_require__.d(__webpack_exports__, {
100
- "default": () => (/* binding */ src)
101
- });
102
-
103
- // EXTERNAL MODULE: external "../shared"
104
- var external_shared_ = __webpack_require__(4212);
105
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
106
- function _defineProperty(obj, key, value) {
107
- if (key in obj) {
108
- Object.defineProperty(obj, key, {
109
- value: value,
110
- enumerable: true,
111
- configurable: true,
112
- writable: true
113
- });
114
- } else {
115
- obj[key] = value;
116
- }
117
-
118
- return obj;
119
- }
120
- // EXTERNAL MODULE: external "vue"
121
- var external_vue_ = __webpack_require__(748);
122
- // EXTERNAL MODULE: external "../icon"
123
- var external_icon_ = __webpack_require__(6870);
124
- ;// CONCATENATED MODULE: ../../packages/switcher/src/switcher.tsx
125
-
126
-
127
-
128
- /*
129
- * Tencent is pleased to support the open source community by making
130
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
131
- *
132
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
133
- *
134
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
135
- *
136
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
137
- *
138
- * ---------------------------------------------------
139
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
140
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
141
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
142
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
143
- *
144
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
145
- * the Software.
146
- *
147
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
148
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
149
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
150
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
151
- * IN THE SOFTWARE.
152
- */
153
-
154
-
155
-
156
- /* harmony default export */ const switcher = ((0,external_vue_.defineComponent)({
157
- name: 'Switcher',
158
- props: {
159
- theme: external_shared_.PropTypes.theme(),
160
- size: external_shared_.PropTypes.size(),
161
- disabled: external_shared_.PropTypes.bool,
162
- showText: external_shared_.PropTypes.bool,
163
- isOutline: external_shared_.PropTypes.bool,
164
- onText: external_shared_.PropTypes.string.def('ON'),
165
- offText: external_shared_.PropTypes.string.def('OFF'),
166
- isSquare: external_shared_.PropTypes.bool,
167
- extCls: external_shared_.PropTypes.string,
168
- beforeChange: external_shared_.PropTypes.func.def(undefined),
169
- trueValue: external_shared_.PropTypes.oneOfType([external_shared_.PropTypes.string, external_shared_.PropTypes.number, external_shared_.PropTypes.bool]).def(true),
170
- falseValue: external_shared_.PropTypes.oneOfType([external_shared_.PropTypes.string, external_shared_.PropTypes.number, external_shared_.PropTypes.bool]).def(false),
171
- value: external_shared_.PropTypes.oneOfType([external_shared_.PropTypes.string, external_shared_.PropTypes.number, external_shared_.PropTypes.bool]).def(false),
172
- modelValue: external_shared_.PropTypes.oneOfType([external_shared_.PropTypes.string, external_shared_.PropTypes.number, external_shared_.PropTypes.bool]).def(false),
173
- withValidate: external_shared_.PropTypes.bool.def(true)
174
- },
175
- emits: ['update:modelValue', 'change'],
176
- setup: function setup(props, _ref) {
177
- var emit = _ref.emit;
178
- var formItem = (0,external_shared_.useFormItem)();
179
- var isLoading = (0,external_vue_.ref)(false);
180
- var isChecked = (0,external_vue_.computed)(function () {
181
- return props.trueValue === localValue.value;
182
- });
183
- var isModelValue = (0,external_vue_.ref)(props.modelValue !== false);
184
- var localValue = (0,external_vue_.computed)(function () {
185
- return isModelValue.value ? props.modelValue : props.value;
186
- });
187
- var classObject = (0,external_vue_.computed)(function () {
188
- var _cls;
189
-
190
- var cls = (_cls = {}, _defineProperty(_cls, props.extCls, !!props.extCls), _defineProperty(_cls, 'bk-switcher', true), _defineProperty(_cls, 'bk-switcher-outline', props.isOutline), _defineProperty(_cls, 'bk-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, 'bk-primary', props.theme === 'primary'), _cls); // 显示文本则size无效,使用固定尺寸
191
-
192
- if (props.size && !props.showText) {
193
- var sizeStr = "bk-switcher-".concat(props.size);
194
- cls[sizeStr] = true;
195
- }
196
-
197
- return cls;
198
- });
199
- (0,external_vue_.watch)(function () {
200
- return props.modelValue;
201
- }, function () {
202
- var _a;
203
-
204
- isModelValue.value = true;
205
-
206
- if (props.withValidate) {
207
- (_a = formItem === null || formItem === void 0 ? void 0 : formItem.validate) === null || _a === void 0 ? void 0 : _a.call(formItem, 'change');
208
- }
209
- });
210
- (0,external_vue_.watch)(function () {
211
- return props.value;
212
- }, function () {
213
- isModelValue.value = false;
214
- });
215
-
216
- var handleChange = function handleChange(event) {
217
- event.stopPropagation();
218
- event.preventDefault();
219
-
220
- if (props.disabled || isLoading.value) {
221
- return;
222
- }
223
-
224
- var lastValue = isChecked.value ? props.falseValue : props.trueValue;
225
- var lastChecked = !isChecked.value;
226
-
227
- var trigger = function trigger() {
228
- emit('update:modelValue', lastValue);
229
- emit('change', lastChecked);
230
- };
231
-
232
- var goodJob = true;
233
-
234
- if (typeof props.beforeChange === 'function') {
235
- goodJob = props.beforeChange(lastValue);
236
-
237
- if (typeof goodJob.then === 'function') {
238
- isLoading.value = true;
239
- return goodJob.then(function () {
240
- trigger();
241
- })["finally"](function () {
242
- isLoading.value = false;
243
- });
244
- }
245
- }
246
-
247
- if (goodJob) {
248
- trigger();
249
- }
250
- };
251
-
252
- var handleKeydown = function handleKeydown(e) {
253
- // Enter 键盘事件可触发开关切换
254
- if (e.code === 'Enter' || e.key === 'Enter' || e.keyCode === 13) {
255
- handleChange(e);
256
- }
257
- };
258
-
259
- return function () {
260
- return (0,external_vue_.createVNode)("div", {
261
- "class": classObject.value,
262
- "onClick": handleChange,
263
- "tabindex": "0",
264
- "onKeydown": handleKeydown
265
- }, [isLoading.value ? (0,external_vue_.createVNode)(external_icon_.SwitcherLoading, {
266
- "class": "bk-switcher-loading"
267
- }, null) : '', props.showText ? (0,external_vue_.createVNode)("span", {
268
- "class": "switcher-text"
269
- }, [isChecked.value ? props.onText : props.offText]) : '']);
270
- };
271
- }
272
- }));
273
- ;// CONCATENATED MODULE: ../../packages/switcher/src/index.ts
274
- /*
275
- * Tencent is pleased to support the open source community by making
276
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
277
- *
278
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
279
- *
280
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
281
- *
282
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
283
- *
284
- * ---------------------------------------------------
285
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
286
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
287
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
288
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
289
- *
290
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
291
- * the Software.
292
- *
293
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
294
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
295
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
296
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
297
- * IN THE SOFTWARE.
298
- */
299
-
300
-
301
- var BkSwitcher = (0,external_shared_.withInstall)(switcher);
302
- /* harmony default export */ const src = (BkSwitcher);
303
- })();
304
-
305
- /******/ return __webpack_exports__;
306
- /******/ })()
307
- ;
308
- });
1
+ !function(e,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o(require("../shared"),require("vue"),require("../icon"));else if("function"==typeof define&&define.amd)define(["../shared","vue","../icon"],o);else{var r="object"==typeof exports?o(require("../shared"),require("vue"),require("../icon")):o(e["../shared"],e.vue,e["../icon"]);for(var t in r)("object"==typeof exports?exports:e)[t]=r[t]}}(self,((e,o,r)=>(()=>{"use strict";var t={6870:e=>{e.exports=r},4212:o=>{o.exports=e},748:e=>{e.exports=o}},n={};function u(e){var o=n[e];if(void 0!==o)return o.exports;var r=n[e]={exports:{}};return t[e](r,r.exports,u),r.exports}u.d=(e,o)=>{for(var r in o)u.o(o,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},u.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{u.r(i),u.d(i,{default:()=>a});var e=u(4212);function o(e,o,r){return o in e?Object.defineProperty(e,o,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[o]=r,e}var r=u(748),t=u(6870);const n=(0,r.defineComponent)({name:"Switcher",props:{theme:e.PropTypes.theme(),size:e.PropTypes.size(),disabled:e.PropTypes.bool,showText:e.PropTypes.bool,isOutline:e.PropTypes.bool,onText:e.PropTypes.string.def("ON"),offText:e.PropTypes.string.def("OFF"),isSquare:e.PropTypes.bool,extCls:e.PropTypes.string,beforeChange:e.PropTypes.func.def(void 0),trueValue:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.number,e.PropTypes.bool]).def(!0),falseValue:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.number,e.PropTypes.bool]).def(!1),value:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.number,e.PropTypes.bool]).def(!1),modelValue:e.PropTypes.oneOfType([e.PropTypes.string,e.PropTypes.number,e.PropTypes.bool]).def(!1),withValidate:e.PropTypes.bool.def(!0)},emits:["update:modelValue","change"],setup:function(n,u){var i=u.emit,a=(0,e.useFormItem)(),s=(0,r.ref)(!1),l=(0,r.computed)((function(){return n.trueValue===f.value})),p=(0,r.ref)(!1!==n.modelValue),f=(0,r.computed)((function(){return p.value?n.modelValue:n.value})),c=(0,r.computed)((function(){var e,r=(o(e={},n.extCls,!!n.extCls),o(e,"bk-switcher",!0),o(e,"bk-switcher-outline",n.isOutline),o(e,"bk-switcher-square",n.isSquare),o(e,"show-label",n.showText),o(e,"is-disabled",n.disabled),o(e,"is-checked",l.value),o(e,"is-unchecked",!l.value),o(e,"is-loading",s.value),o(e,"bk-primary","primary"===n.theme),e);return n.size&&!n.showText&&(r["bk-switcher-".concat(n.size)]=!0),r}));(0,r.watch)((function(){return n.modelValue}),(function(){var e;p.value=!0,n.withValidate&&(null===(e=null==a?void 0:a.validate)||void 0===e||e.call(a,"change"))})),(0,r.watch)((function(){return n.value}),(function(){p.value=!1}));var d=function(e){if(e.stopPropagation(),e.preventDefault(),!n.disabled&&!s.value){var o=l.value?n.falseValue:n.trueValue,r=!l.value,t=function(){i("update:modelValue",o),i("change",r)},u=!0;if("function"==typeof n.beforeChange&&"function"==typeof(u=n.beforeChange(o)).then)return s.value=!0,u.then((function(){t()})).finally((function(){s.value=!1}));u&&t()}},y=function(e){"Enter"!==e.code&&"Enter"!==e.key&&13!==e.keyCode||d(e)};return function(){return(0,r.createVNode)("div",{class:c.value,onClick:d,tabindex:"0",onKeydown:y},[s.value?(0,r.createVNode)(t.SwitcherLoading,{class:"bk-switcher-loading"},null):"",n.showText?(0,r.createVNode)("span",{class:"switcher-text"},[l.value?n.onText:n.offText]):""])}}}),a=(0,e.withInstall)(n)})(),i})()));