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
@@ -1,2735 +1 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory(require("../shared"), require("vue"), require("vue-types"), require("../config-provider"), require("../directives"), require("../icon"));
4
- else if(typeof define === 'function' && define.amd)
5
- define(["../shared", "vue", "vue-types", "../config-provider", "../directives", "../icon"], factory);
6
- else {
7
- var a = typeof exports === 'object' ? factory(require("../shared"), require("vue"), require("vue-types"), require("../config-provider"), require("../directives"), require("../icon")) : factory(root["../shared"], root["vue"], root["vue-types"], 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__748__, __WEBPACK_EXTERNAL_MODULE__210__, __WEBPACK_EXTERNAL_MODULE__2717__, __WEBPACK_EXTERNAL_MODULE__4061__, __WEBPACK_EXTERNAL_MODULE__6870__) => {
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
- /***/ 6870:
30
- /***/ ((module) => {
31
-
32
- module.exports = __WEBPACK_EXTERNAL_MODULE__6870__;
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
- "default": () => (/* binding */ src)
122
- });
123
-
124
- // EXTERNAL MODULE: external "../shared"
125
- var external_shared_ = __webpack_require__(4212);
126
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/typeof.js
127
- function _typeof(obj) {
128
- "@babel/helpers - typeof";
129
-
130
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
131
- return typeof obj;
132
- } : function (obj) {
133
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
134
- }, _typeof(obj);
135
- }
136
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
137
-
138
- function _toPrimitive(input, hint) {
139
- if (_typeof(input) !== "object" || input === null) return input;
140
- var prim = input[Symbol.toPrimitive];
141
- if (prim !== undefined) {
142
- var res = prim.call(input, hint || "default");
143
- if (_typeof(res) !== "object") return res;
144
- throw new TypeError("@@toPrimitive must return a primitive value.");
145
- }
146
- return (hint === "string" ? String : Number)(input);
147
- }
148
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
149
-
150
-
151
- function _toPropertyKey(arg) {
152
- var key = _toPrimitive(arg, "string");
153
- return _typeof(key) === "symbol" ? key : String(key);
154
- }
155
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
156
-
157
- function _defineProperty(obj, key, value) {
158
- key = _toPropertyKey(key);
159
- if (key in obj) {
160
- Object.defineProperty(obj, key, {
161
- value: value,
162
- enumerable: true,
163
- configurable: true,
164
- writable: true
165
- });
166
- } else {
167
- obj[key] = value;
168
- }
169
- return obj;
170
- }
171
- // EXTERNAL MODULE: external "vue"
172
- var external_vue_ = __webpack_require__(748);
173
- ;// CONCATENATED MODULE: ../../node_modules/tinycolor2/esm/tinycolor.js
174
- // This file is autogenerated. It's used to publish ESM to npm.
175
- function tinycolor_typeof(obj) {
176
- "@babel/helpers - typeof";
177
-
178
- return tinycolor_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
179
- return typeof obj;
180
- } : function (obj) {
181
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
182
- }, tinycolor_typeof(obj);
183
- }
184
-
185
- // https://github.com/bgrins/TinyColor
186
- // Brian Grinstead, MIT License
187
-
188
- var trimLeft = /^\s+/;
189
- var trimRight = /\s+$/;
190
- function tinycolor(color, opts) {
191
- color = color ? color : "";
192
- opts = opts || {};
193
-
194
- // If input is already a tinycolor, return itself
195
- if (color instanceof tinycolor) {
196
- return color;
197
- }
198
- // If we are called as a function, call using new instead
199
- if (!(this instanceof tinycolor)) {
200
- return new tinycolor(color, opts);
201
- }
202
- var rgb = inputToRGB(color);
203
- this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
204
- this._gradientType = opts.gradientType;
205
-
206
- // Don't let the range of [0,255] come back in [0,1].
207
- // Potentially lose a little bit of precision here, but will fix issues where
208
- // .5 gets interpreted as half of the total, instead of half of 1
209
- // If it was supposed to be 128, this was already taken care of by `inputToRgb`
210
- if (this._r < 1) this._r = Math.round(this._r);
211
- if (this._g < 1) this._g = Math.round(this._g);
212
- if (this._b < 1) this._b = Math.round(this._b);
213
- this._ok = rgb.ok;
214
- }
215
- tinycolor.prototype = {
216
- isDark: function isDark() {
217
- return this.getBrightness() < 128;
218
- },
219
- isLight: function isLight() {
220
- return !this.isDark();
221
- },
222
- isValid: function isValid() {
223
- return this._ok;
224
- },
225
- getOriginalInput: function getOriginalInput() {
226
- return this._originalInput;
227
- },
228
- getFormat: function getFormat() {
229
- return this._format;
230
- },
231
- getAlpha: function getAlpha() {
232
- return this._a;
233
- },
234
- getBrightness: function getBrightness() {
235
- //http://www.w3.org/TR/AERT#color-contrast
236
- var rgb = this.toRgb();
237
- return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
238
- },
239
- getLuminance: function getLuminance() {
240
- //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
241
- var rgb = this.toRgb();
242
- var RsRGB, GsRGB, BsRGB, R, G, B;
243
- RsRGB = rgb.r / 255;
244
- GsRGB = rgb.g / 255;
245
- BsRGB = rgb.b / 255;
246
- if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
247
- if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
248
- if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
249
- return 0.2126 * R + 0.7152 * G + 0.0722 * B;
250
- },
251
- setAlpha: function setAlpha(value) {
252
- this._a = boundAlpha(value);
253
- this._roundA = Math.round(100 * this._a) / 100;
254
- return this;
255
- },
256
- toHsv: function toHsv() {
257
- var hsv = rgbToHsv(this._r, this._g, this._b);
258
- return {
259
- h: hsv.h * 360,
260
- s: hsv.s,
261
- v: hsv.v,
262
- a: this._a
263
- };
264
- },
265
- toHsvString: function toHsvString() {
266
- var hsv = rgbToHsv(this._r, this._g, this._b);
267
- var h = Math.round(hsv.h * 360),
268
- s = Math.round(hsv.s * 100),
269
- v = Math.round(hsv.v * 100);
270
- return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
271
- },
272
- toHsl: function toHsl() {
273
- var hsl = rgbToHsl(this._r, this._g, this._b);
274
- return {
275
- h: hsl.h * 360,
276
- s: hsl.s,
277
- l: hsl.l,
278
- a: this._a
279
- };
280
- },
281
- toHslString: function toHslString() {
282
- var hsl = rgbToHsl(this._r, this._g, this._b);
283
- var h = Math.round(hsl.h * 360),
284
- s = Math.round(hsl.s * 100),
285
- l = Math.round(hsl.l * 100);
286
- return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
287
- },
288
- toHex: function toHex(allow3Char) {
289
- return rgbToHex(this._r, this._g, this._b, allow3Char);
290
- },
291
- toHexString: function toHexString(allow3Char) {
292
- return "#" + this.toHex(allow3Char);
293
- },
294
- toHex8: function toHex8(allow4Char) {
295
- return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
296
- },
297
- toHex8String: function toHex8String(allow4Char) {
298
- return "#" + this.toHex8(allow4Char);
299
- },
300
- toRgb: function toRgb() {
301
- return {
302
- r: Math.round(this._r),
303
- g: Math.round(this._g),
304
- b: Math.round(this._b),
305
- a: this._a
306
- };
307
- },
308
- toRgbString: function toRgbString() {
309
- return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
310
- },
311
- toPercentageRgb: function toPercentageRgb() {
312
- return {
313
- r: Math.round(bound01(this._r, 255) * 100) + "%",
314
- g: Math.round(bound01(this._g, 255) * 100) + "%",
315
- b: Math.round(bound01(this._b, 255) * 100) + "%",
316
- a: this._a
317
- };
318
- },
319
- toPercentageRgbString: function toPercentageRgbString() {
320
- return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
321
- },
322
- toName: function toName() {
323
- if (this._a === 0) {
324
- return "transparent";
325
- }
326
- if (this._a < 1) {
327
- return false;
328
- }
329
- return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
330
- },
331
- toFilter: function toFilter(secondColor) {
332
- var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
333
- var secondHex8String = hex8String;
334
- var gradientType = this._gradientType ? "GradientType = 1, " : "";
335
- if (secondColor) {
336
- var s = tinycolor(secondColor);
337
- secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
338
- }
339
- return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
340
- },
341
- toString: function toString(format) {
342
- var formatSet = !!format;
343
- format = format || this._format;
344
- var formattedString = false;
345
- var hasAlpha = this._a < 1 && this._a >= 0;
346
- var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
347
- if (needsAlphaFormat) {
348
- // Special case for "transparent", all other non-alpha formats
349
- // will return rgba when there is transparency.
350
- if (format === "name" && this._a === 0) {
351
- return this.toName();
352
- }
353
- return this.toRgbString();
354
- }
355
- if (format === "rgb") {
356
- formattedString = this.toRgbString();
357
- }
358
- if (format === "prgb") {
359
- formattedString = this.toPercentageRgbString();
360
- }
361
- if (format === "hex" || format === "hex6") {
362
- formattedString = this.toHexString();
363
- }
364
- if (format === "hex3") {
365
- formattedString = this.toHexString(true);
366
- }
367
- if (format === "hex4") {
368
- formattedString = this.toHex8String(true);
369
- }
370
- if (format === "hex8") {
371
- formattedString = this.toHex8String();
372
- }
373
- if (format === "name") {
374
- formattedString = this.toName();
375
- }
376
- if (format === "hsl") {
377
- formattedString = this.toHslString();
378
- }
379
- if (format === "hsv") {
380
- formattedString = this.toHsvString();
381
- }
382
- return formattedString || this.toHexString();
383
- },
384
- clone: function clone() {
385
- return tinycolor(this.toString());
386
- },
387
- _applyModification: function _applyModification(fn, args) {
388
- var color = fn.apply(null, [this].concat([].slice.call(args)));
389
- this._r = color._r;
390
- this._g = color._g;
391
- this._b = color._b;
392
- this.setAlpha(color._a);
393
- return this;
394
- },
395
- lighten: function lighten() {
396
- return this._applyModification(_lighten, arguments);
397
- },
398
- brighten: function brighten() {
399
- return this._applyModification(_brighten, arguments);
400
- },
401
- darken: function darken() {
402
- return this._applyModification(_darken, arguments);
403
- },
404
- desaturate: function desaturate() {
405
- return this._applyModification(_desaturate, arguments);
406
- },
407
- saturate: function saturate() {
408
- return this._applyModification(_saturate, arguments);
409
- },
410
- greyscale: function greyscale() {
411
- return this._applyModification(_greyscale, arguments);
412
- },
413
- spin: function spin() {
414
- return this._applyModification(_spin, arguments);
415
- },
416
- _applyCombination: function _applyCombination(fn, args) {
417
- return fn.apply(null, [this].concat([].slice.call(args)));
418
- },
419
- analogous: function analogous() {
420
- return this._applyCombination(_analogous, arguments);
421
- },
422
- complement: function complement() {
423
- return this._applyCombination(_complement, arguments);
424
- },
425
- monochromatic: function monochromatic() {
426
- return this._applyCombination(_monochromatic, arguments);
427
- },
428
- splitcomplement: function splitcomplement() {
429
- return this._applyCombination(_splitcomplement, arguments);
430
- },
431
- // Disabled until https://github.com/bgrins/TinyColor/issues/254
432
- // polyad: function (number) {
433
- // return this._applyCombination(polyad, [number]);
434
- // },
435
- triad: function triad() {
436
- return this._applyCombination(polyad, [3]);
437
- },
438
- tetrad: function tetrad() {
439
- return this._applyCombination(polyad, [4]);
440
- }
441
- };
442
-
443
- // If input is an object, force 1 into "1.0" to handle ratios properly
444
- // String input requires "1.0" as input, so 1 will be treated as 1
445
- tinycolor.fromRatio = function (color, opts) {
446
- if (tinycolor_typeof(color) == "object") {
447
- var newColor = {};
448
- for (var i in color) {
449
- if (color.hasOwnProperty(i)) {
450
- if (i === "a") {
451
- newColor[i] = color[i];
452
- } else {
453
- newColor[i] = convertToPercentage(color[i]);
454
- }
455
- }
456
- }
457
- color = newColor;
458
- }
459
- return tinycolor(color, opts);
460
- };
461
-
462
- // Given a string or object, convert that input to RGB
463
- // Possible string inputs:
464
- //
465
- // "red"
466
- // "#f00" or "f00"
467
- // "#ff0000" or "ff0000"
468
- // "#ff000000" or "ff000000"
469
- // "rgb 255 0 0" or "rgb (255, 0, 0)"
470
- // "rgb 1.0 0 0" or "rgb (1, 0, 0)"
471
- // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
472
- // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
473
- // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
474
- // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
475
- // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
476
- //
477
- function inputToRGB(color) {
478
- var rgb = {
479
- r: 0,
480
- g: 0,
481
- b: 0
482
- };
483
- var a = 1;
484
- var s = null;
485
- var v = null;
486
- var l = null;
487
- var ok = false;
488
- var format = false;
489
- if (typeof color == "string") {
490
- color = stringInputToObject(color);
491
- }
492
- if (tinycolor_typeof(color) == "object") {
493
- if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
494
- rgb = rgbToRgb(color.r, color.g, color.b);
495
- ok = true;
496
- format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
497
- } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
498
- s = convertToPercentage(color.s);
499
- v = convertToPercentage(color.v);
500
- rgb = hsvToRgb(color.h, s, v);
501
- ok = true;
502
- format = "hsv";
503
- } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
504
- s = convertToPercentage(color.s);
505
- l = convertToPercentage(color.l);
506
- rgb = hslToRgb(color.h, s, l);
507
- ok = true;
508
- format = "hsl";
509
- }
510
- if (color.hasOwnProperty("a")) {
511
- a = color.a;
512
- }
513
- }
514
- a = boundAlpha(a);
515
- return {
516
- ok: ok,
517
- format: color.format || format,
518
- r: Math.min(255, Math.max(rgb.r, 0)),
519
- g: Math.min(255, Math.max(rgb.g, 0)),
520
- b: Math.min(255, Math.max(rgb.b, 0)),
521
- a: a
522
- };
523
- }
524
-
525
- // Conversion Functions
526
- // --------------------
527
-
528
- // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
529
- // <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
530
-
531
- // `rgbToRgb`
532
- // Handle bounds / percentage checking to conform to CSS color spec
533
- // <http://www.w3.org/TR/css3-color/>
534
- // *Assumes:* r, g, b in [0, 255] or [0, 1]
535
- // *Returns:* { r, g, b } in [0, 255]
536
- function rgbToRgb(r, g, b) {
537
- return {
538
- r: bound01(r, 255) * 255,
539
- g: bound01(g, 255) * 255,
540
- b: bound01(b, 255) * 255
541
- };
542
- }
543
-
544
- // `rgbToHsl`
545
- // Converts an RGB color value to HSL.
546
- // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
547
- // *Returns:* { h, s, l } in [0,1]
548
- function rgbToHsl(r, g, b) {
549
- r = bound01(r, 255);
550
- g = bound01(g, 255);
551
- b = bound01(b, 255);
552
- var max = Math.max(r, g, b),
553
- min = Math.min(r, g, b);
554
- var h,
555
- s,
556
- l = (max + min) / 2;
557
- if (max == min) {
558
- h = s = 0; // achromatic
559
- } else {
560
- var d = max - min;
561
- s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
562
- switch (max) {
563
- case r:
564
- h = (g - b) / d + (g < b ? 6 : 0);
565
- break;
566
- case g:
567
- h = (b - r) / d + 2;
568
- break;
569
- case b:
570
- h = (r - g) / d + 4;
571
- break;
572
- }
573
- h /= 6;
574
- }
575
- return {
576
- h: h,
577
- s: s,
578
- l: l
579
- };
580
- }
581
-
582
- // `hslToRgb`
583
- // Converts an HSL color value to RGB.
584
- // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
585
- // *Returns:* { r, g, b } in the set [0, 255]
586
- function hslToRgb(h, s, l) {
587
- var r, g, b;
588
- h = bound01(h, 360);
589
- s = bound01(s, 100);
590
- l = bound01(l, 100);
591
- function hue2rgb(p, q, t) {
592
- if (t < 0) t += 1;
593
- if (t > 1) t -= 1;
594
- if (t < 1 / 6) return p + (q - p) * 6 * t;
595
- if (t < 1 / 2) return q;
596
- if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
597
- return p;
598
- }
599
- if (s === 0) {
600
- r = g = b = l; // achromatic
601
- } else {
602
- var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
603
- var p = 2 * l - q;
604
- r = hue2rgb(p, q, h + 1 / 3);
605
- g = hue2rgb(p, q, h);
606
- b = hue2rgb(p, q, h - 1 / 3);
607
- }
608
- return {
609
- r: r * 255,
610
- g: g * 255,
611
- b: b * 255
612
- };
613
- }
614
-
615
- // `rgbToHsv`
616
- // Converts an RGB color value to HSV
617
- // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
618
- // *Returns:* { h, s, v } in [0,1]
619
- function rgbToHsv(r, g, b) {
620
- r = bound01(r, 255);
621
- g = bound01(g, 255);
622
- b = bound01(b, 255);
623
- var max = Math.max(r, g, b),
624
- min = Math.min(r, g, b);
625
- var h,
626
- s,
627
- v = max;
628
- var d = max - min;
629
- s = max === 0 ? 0 : d / max;
630
- if (max == min) {
631
- h = 0; // achromatic
632
- } else {
633
- switch (max) {
634
- case r:
635
- h = (g - b) / d + (g < b ? 6 : 0);
636
- break;
637
- case g:
638
- h = (b - r) / d + 2;
639
- break;
640
- case b:
641
- h = (r - g) / d + 4;
642
- break;
643
- }
644
- h /= 6;
645
- }
646
- return {
647
- h: h,
648
- s: s,
649
- v: v
650
- };
651
- }
652
-
653
- // `hsvToRgb`
654
- // Converts an HSV color value to RGB.
655
- // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
656
- // *Returns:* { r, g, b } in the set [0, 255]
657
- function hsvToRgb(h, s, v) {
658
- h = bound01(h, 360) * 6;
659
- s = bound01(s, 100);
660
- v = bound01(v, 100);
661
- var i = Math.floor(h),
662
- f = h - i,
663
- p = v * (1 - s),
664
- q = v * (1 - f * s),
665
- t = v * (1 - (1 - f) * s),
666
- mod = i % 6,
667
- r = [v, q, p, p, t, v][mod],
668
- g = [t, v, v, q, p, p][mod],
669
- b = [p, p, t, v, v, q][mod];
670
- return {
671
- r: r * 255,
672
- g: g * 255,
673
- b: b * 255
674
- };
675
- }
676
-
677
- // `rgbToHex`
678
- // Converts an RGB color to hex
679
- // Assumes r, g, and b are contained in the set [0, 255]
680
- // Returns a 3 or 6 character hex
681
- function rgbToHex(r, g, b, allow3Char) {
682
- var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
683
-
684
- // Return a 3 character hex if possible
685
- if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
686
- return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
687
- }
688
- return hex.join("");
689
- }
690
-
691
- // `rgbaToHex`
692
- // Converts an RGBA color plus alpha transparency to hex
693
- // Assumes r, g, b are contained in the set [0, 255] and
694
- // a in [0, 1]. Returns a 4 or 8 character rgba hex
695
- function rgbaToHex(r, g, b, a, allow4Char) {
696
- var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
697
-
698
- // Return a 4 character hex if possible
699
- if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
700
- return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
701
- }
702
- return hex.join("");
703
- }
704
-
705
- // `rgbaToArgbHex`
706
- // Converts an RGBA color to an ARGB Hex8 string
707
- // Rarely used, but required for "toFilter()"
708
- function rgbaToArgbHex(r, g, b, a) {
709
- var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
710
- return hex.join("");
711
- }
712
-
713
- // `equals`
714
- // Can be called with any tinycolor input
715
- tinycolor.equals = function (color1, color2) {
716
- if (!color1 || !color2) return false;
717
- return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
718
- };
719
- tinycolor.random = function () {
720
- return tinycolor.fromRatio({
721
- r: Math.random(),
722
- g: Math.random(),
723
- b: Math.random()
724
- });
725
- };
726
-
727
- // Modification Functions
728
- // ----------------------
729
- // Thanks to less.js for some of the basics here
730
- // <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
731
-
732
- function _desaturate(color, amount) {
733
- amount = amount === 0 ? 0 : amount || 10;
734
- var hsl = tinycolor(color).toHsl();
735
- hsl.s -= amount / 100;
736
- hsl.s = clamp01(hsl.s);
737
- return tinycolor(hsl);
738
- }
739
- function _saturate(color, amount) {
740
- amount = amount === 0 ? 0 : amount || 10;
741
- var hsl = tinycolor(color).toHsl();
742
- hsl.s += amount / 100;
743
- hsl.s = clamp01(hsl.s);
744
- return tinycolor(hsl);
745
- }
746
- function _greyscale(color) {
747
- return tinycolor(color).desaturate(100);
748
- }
749
- function _lighten(color, amount) {
750
- amount = amount === 0 ? 0 : amount || 10;
751
- var hsl = tinycolor(color).toHsl();
752
- hsl.l += amount / 100;
753
- hsl.l = clamp01(hsl.l);
754
- return tinycolor(hsl);
755
- }
756
- function _brighten(color, amount) {
757
- amount = amount === 0 ? 0 : amount || 10;
758
- var rgb = tinycolor(color).toRgb();
759
- rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
760
- rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
761
- rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
762
- return tinycolor(rgb);
763
- }
764
- function _darken(color, amount) {
765
- amount = amount === 0 ? 0 : amount || 10;
766
- var hsl = tinycolor(color).toHsl();
767
- hsl.l -= amount / 100;
768
- hsl.l = clamp01(hsl.l);
769
- return tinycolor(hsl);
770
- }
771
-
772
- // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
773
- // Values outside of this range will be wrapped into this range.
774
- function _spin(color, amount) {
775
- var hsl = tinycolor(color).toHsl();
776
- var hue = (hsl.h + amount) % 360;
777
- hsl.h = hue < 0 ? 360 + hue : hue;
778
- return tinycolor(hsl);
779
- }
780
-
781
- // Combination Functions
782
- // ---------------------
783
- // Thanks to jQuery xColor for some of the ideas behind these
784
- // <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
785
-
786
- function _complement(color) {
787
- var hsl = tinycolor(color).toHsl();
788
- hsl.h = (hsl.h + 180) % 360;
789
- return tinycolor(hsl);
790
- }
791
- function polyad(color, number) {
792
- if (isNaN(number) || number <= 0) {
793
- throw new Error("Argument to polyad must be a positive number");
794
- }
795
- var hsl = tinycolor(color).toHsl();
796
- var result = [tinycolor(color)];
797
- var step = 360 / number;
798
- for (var i = 1; i < number; i++) {
799
- result.push(tinycolor({
800
- h: (hsl.h + i * step) % 360,
801
- s: hsl.s,
802
- l: hsl.l
803
- }));
804
- }
805
- return result;
806
- }
807
- function _splitcomplement(color) {
808
- var hsl = tinycolor(color).toHsl();
809
- var h = hsl.h;
810
- return [tinycolor(color), tinycolor({
811
- h: (h + 72) % 360,
812
- s: hsl.s,
813
- l: hsl.l
814
- }), tinycolor({
815
- h: (h + 216) % 360,
816
- s: hsl.s,
817
- l: hsl.l
818
- })];
819
- }
820
- function _analogous(color, results, slices) {
821
- results = results || 6;
822
- slices = slices || 30;
823
- var hsl = tinycolor(color).toHsl();
824
- var part = 360 / slices;
825
- var ret = [tinycolor(color)];
826
- for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {
827
- hsl.h = (hsl.h + part) % 360;
828
- ret.push(tinycolor(hsl));
829
- }
830
- return ret;
831
- }
832
- function _monochromatic(color, results) {
833
- results = results || 6;
834
- var hsv = tinycolor(color).toHsv();
835
- var h = hsv.h,
836
- s = hsv.s,
837
- v = hsv.v;
838
- var ret = [];
839
- var modification = 1 / results;
840
- while (results--) {
841
- ret.push(tinycolor({
842
- h: h,
843
- s: s,
844
- v: v
845
- }));
846
- v = (v + modification) % 1;
847
- }
848
- return ret;
849
- }
850
-
851
- // Utility Functions
852
- // ---------------------
853
-
854
- tinycolor.mix = function (color1, color2, amount) {
855
- amount = amount === 0 ? 0 : amount || 50;
856
- var rgb1 = tinycolor(color1).toRgb();
857
- var rgb2 = tinycolor(color2).toRgb();
858
- var p = amount / 100;
859
- var rgba = {
860
- r: (rgb2.r - rgb1.r) * p + rgb1.r,
861
- g: (rgb2.g - rgb1.g) * p + rgb1.g,
862
- b: (rgb2.b - rgb1.b) * p + rgb1.b,
863
- a: (rgb2.a - rgb1.a) * p + rgb1.a
864
- };
865
- return tinycolor(rgba);
866
- };
867
-
868
- // Readability Functions
869
- // ---------------------
870
- // <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
871
-
872
- // `contrast`
873
- // Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
874
- tinycolor.readability = function (color1, color2) {
875
- var c1 = tinycolor(color1);
876
- var c2 = tinycolor(color2);
877
- return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
878
- };
879
-
880
- // `isReadable`
881
- // Ensure that foreground and background color combinations meet WCAG2 guidelines.
882
- // The third argument is an optional Object.
883
- // the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA';
884
- // the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'.
885
- // If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.
886
-
887
- // *Example*
888
- // tinycolor.isReadable("#000", "#111") => false
889
- // tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false
890
- tinycolor.isReadable = function (color1, color2, wcag2) {
891
- var readability = tinycolor.readability(color1, color2);
892
- var wcag2Parms, out;
893
- out = false;
894
- wcag2Parms = validateWCAG2Parms(wcag2);
895
- switch (wcag2Parms.level + wcag2Parms.size) {
896
- case "AAsmall":
897
- case "AAAlarge":
898
- out = readability >= 4.5;
899
- break;
900
- case "AAlarge":
901
- out = readability >= 3;
902
- break;
903
- case "AAAsmall":
904
- out = readability >= 7;
905
- break;
906
- }
907
- return out;
908
- };
909
-
910
- // `mostReadable`
911
- // Given a base color and a list of possible foreground or background
912
- // colors for that base, returns the most readable color.
913
- // Optionally returns Black or White if the most readable color is unreadable.
914
- // *Example*
915
- // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255"
916
- // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff"
917
- // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3"
918
- // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"
919
- tinycolor.mostReadable = function (baseColor, colorList, args) {
920
- var bestColor = null;
921
- var bestScore = 0;
922
- var readability;
923
- var includeFallbackColors, level, size;
924
- args = args || {};
925
- includeFallbackColors = args.includeFallbackColors;
926
- level = args.level;
927
- size = args.size;
928
- for (var i = 0; i < colorList.length; i++) {
929
- readability = tinycolor.readability(baseColor, colorList[i]);
930
- if (readability > bestScore) {
931
- bestScore = readability;
932
- bestColor = tinycolor(colorList[i]);
933
- }
934
- }
935
- if (tinycolor.isReadable(baseColor, bestColor, {
936
- level: level,
937
- size: size
938
- }) || !includeFallbackColors) {
939
- return bestColor;
940
- } else {
941
- args.includeFallbackColors = false;
942
- return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
943
- }
944
- };
945
-
946
- // Big List of Colors
947
- // ------------------
948
- // <https://www.w3.org/TR/css-color-4/#named-colors>
949
- var names = tinycolor.names = {
950
- aliceblue: "f0f8ff",
951
- antiquewhite: "faebd7",
952
- aqua: "0ff",
953
- aquamarine: "7fffd4",
954
- azure: "f0ffff",
955
- beige: "f5f5dc",
956
- bisque: "ffe4c4",
957
- black: "000",
958
- blanchedalmond: "ffebcd",
959
- blue: "00f",
960
- blueviolet: "8a2be2",
961
- brown: "a52a2a",
962
- burlywood: "deb887",
963
- burntsienna: "ea7e5d",
964
- cadetblue: "5f9ea0",
965
- chartreuse: "7fff00",
966
- chocolate: "d2691e",
967
- coral: "ff7f50",
968
- cornflowerblue: "6495ed",
969
- cornsilk: "fff8dc",
970
- crimson: "dc143c",
971
- cyan: "0ff",
972
- darkblue: "00008b",
973
- darkcyan: "008b8b",
974
- darkgoldenrod: "b8860b",
975
- darkgray: "a9a9a9",
976
- darkgreen: "006400",
977
- darkgrey: "a9a9a9",
978
- darkkhaki: "bdb76b",
979
- darkmagenta: "8b008b",
980
- darkolivegreen: "556b2f",
981
- darkorange: "ff8c00",
982
- darkorchid: "9932cc",
983
- darkred: "8b0000",
984
- darksalmon: "e9967a",
985
- darkseagreen: "8fbc8f",
986
- darkslateblue: "483d8b",
987
- darkslategray: "2f4f4f",
988
- darkslategrey: "2f4f4f",
989
- darkturquoise: "00ced1",
990
- darkviolet: "9400d3",
991
- deeppink: "ff1493",
992
- deepskyblue: "00bfff",
993
- dimgray: "696969",
994
- dimgrey: "696969",
995
- dodgerblue: "1e90ff",
996
- firebrick: "b22222",
997
- floralwhite: "fffaf0",
998
- forestgreen: "228b22",
999
- fuchsia: "f0f",
1000
- gainsboro: "dcdcdc",
1001
- ghostwhite: "f8f8ff",
1002
- gold: "ffd700",
1003
- goldenrod: "daa520",
1004
- gray: "808080",
1005
- green: "008000",
1006
- greenyellow: "adff2f",
1007
- grey: "808080",
1008
- honeydew: "f0fff0",
1009
- hotpink: "ff69b4",
1010
- indianred: "cd5c5c",
1011
- indigo: "4b0082",
1012
- ivory: "fffff0",
1013
- khaki: "f0e68c",
1014
- lavender: "e6e6fa",
1015
- lavenderblush: "fff0f5",
1016
- lawngreen: "7cfc00",
1017
- lemonchiffon: "fffacd",
1018
- lightblue: "add8e6",
1019
- lightcoral: "f08080",
1020
- lightcyan: "e0ffff",
1021
- lightgoldenrodyellow: "fafad2",
1022
- lightgray: "d3d3d3",
1023
- lightgreen: "90ee90",
1024
- lightgrey: "d3d3d3",
1025
- lightpink: "ffb6c1",
1026
- lightsalmon: "ffa07a",
1027
- lightseagreen: "20b2aa",
1028
- lightskyblue: "87cefa",
1029
- lightslategray: "789",
1030
- lightslategrey: "789",
1031
- lightsteelblue: "b0c4de",
1032
- lightyellow: "ffffe0",
1033
- lime: "0f0",
1034
- limegreen: "32cd32",
1035
- linen: "faf0e6",
1036
- magenta: "f0f",
1037
- maroon: "800000",
1038
- mediumaquamarine: "66cdaa",
1039
- mediumblue: "0000cd",
1040
- mediumorchid: "ba55d3",
1041
- mediumpurple: "9370db",
1042
- mediumseagreen: "3cb371",
1043
- mediumslateblue: "7b68ee",
1044
- mediumspringgreen: "00fa9a",
1045
- mediumturquoise: "48d1cc",
1046
- mediumvioletred: "c71585",
1047
- midnightblue: "191970",
1048
- mintcream: "f5fffa",
1049
- mistyrose: "ffe4e1",
1050
- moccasin: "ffe4b5",
1051
- navajowhite: "ffdead",
1052
- navy: "000080",
1053
- oldlace: "fdf5e6",
1054
- olive: "808000",
1055
- olivedrab: "6b8e23",
1056
- orange: "ffa500",
1057
- orangered: "ff4500",
1058
- orchid: "da70d6",
1059
- palegoldenrod: "eee8aa",
1060
- palegreen: "98fb98",
1061
- paleturquoise: "afeeee",
1062
- palevioletred: "db7093",
1063
- papayawhip: "ffefd5",
1064
- peachpuff: "ffdab9",
1065
- peru: "cd853f",
1066
- pink: "ffc0cb",
1067
- plum: "dda0dd",
1068
- powderblue: "b0e0e6",
1069
- purple: "800080",
1070
- rebeccapurple: "663399",
1071
- red: "f00",
1072
- rosybrown: "bc8f8f",
1073
- royalblue: "4169e1",
1074
- saddlebrown: "8b4513",
1075
- salmon: "fa8072",
1076
- sandybrown: "f4a460",
1077
- seagreen: "2e8b57",
1078
- seashell: "fff5ee",
1079
- sienna: "a0522d",
1080
- silver: "c0c0c0",
1081
- skyblue: "87ceeb",
1082
- slateblue: "6a5acd",
1083
- slategray: "708090",
1084
- slategrey: "708090",
1085
- snow: "fffafa",
1086
- springgreen: "00ff7f",
1087
- steelblue: "4682b4",
1088
- tan: "d2b48c",
1089
- teal: "008080",
1090
- thistle: "d8bfd8",
1091
- tomato: "ff6347",
1092
- turquoise: "40e0d0",
1093
- violet: "ee82ee",
1094
- wheat: "f5deb3",
1095
- white: "fff",
1096
- whitesmoke: "f5f5f5",
1097
- yellow: "ff0",
1098
- yellowgreen: "9acd32"
1099
- };
1100
-
1101
- // Make it easy to access colors via `hexNames[hex]`
1102
- var hexNames = tinycolor.hexNames = flip(names);
1103
-
1104
- // Utilities
1105
- // ---------
1106
-
1107
- // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
1108
- function flip(o) {
1109
- var flipped = {};
1110
- for (var i in o) {
1111
- if (o.hasOwnProperty(i)) {
1112
- flipped[o[i]] = i;
1113
- }
1114
- }
1115
- return flipped;
1116
- }
1117
-
1118
- // Return a valid alpha value [0,1] with all invalid values being set to 1
1119
- function boundAlpha(a) {
1120
- a = parseFloat(a);
1121
- if (isNaN(a) || a < 0 || a > 1) {
1122
- a = 1;
1123
- }
1124
- return a;
1125
- }
1126
-
1127
- // Take input from [0, n] and return it as [0, 1]
1128
- function bound01(n, max) {
1129
- if (isOnePointZero(n)) n = "100%";
1130
- var processPercent = isPercentage(n);
1131
- n = Math.min(max, Math.max(0, parseFloat(n)));
1132
-
1133
- // Automatically convert percentage into number
1134
- if (processPercent) {
1135
- n = parseInt(n * max, 10) / 100;
1136
- }
1137
-
1138
- // Handle floating point rounding errors
1139
- if (Math.abs(n - max) < 0.000001) {
1140
- return 1;
1141
- }
1142
-
1143
- // Convert into [0, 1] range if it isn't already
1144
- return n % max / parseFloat(max);
1145
- }
1146
-
1147
- // Force a number between 0 and 1
1148
- function clamp01(val) {
1149
- return Math.min(1, Math.max(0, val));
1150
- }
1151
-
1152
- // Parse a base-16 hex value into a base-10 integer
1153
- function parseIntFromHex(val) {
1154
- return parseInt(val, 16);
1155
- }
1156
-
1157
- // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
1158
- // <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
1159
- function isOnePointZero(n) {
1160
- return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1;
1161
- }
1162
-
1163
- // Check to see if string passed in is a percentage
1164
- function isPercentage(n) {
1165
- return typeof n === "string" && n.indexOf("%") != -1;
1166
- }
1167
-
1168
- // Force a hex value to have 2 characters
1169
- function pad2(c) {
1170
- return c.length == 1 ? "0" + c : "" + c;
1171
- }
1172
-
1173
- // Replace a decimal with it's percentage value
1174
- function convertToPercentage(n) {
1175
- if (n <= 1) {
1176
- n = n * 100 + "%";
1177
- }
1178
- return n;
1179
- }
1180
-
1181
- // Converts a decimal to a hex value
1182
- function convertDecimalToHex(d) {
1183
- return Math.round(parseFloat(d) * 255).toString(16);
1184
- }
1185
- // Converts a hex value to a decimal
1186
- function convertHexToDecimal(h) {
1187
- return parseIntFromHex(h) / 255;
1188
- }
1189
- var matchers = function () {
1190
- // <http://www.w3.org/TR/css3-values/#integers>
1191
- var CSS_INTEGER = "[-\\+]?\\d+%?";
1192
-
1193
- // <http://www.w3.org/TR/css3-values/#number-value>
1194
- var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
1195
-
1196
- // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
1197
- var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
1198
-
1199
- // Actual matching.
1200
- // Parentheses and commas are optional, but not required.
1201
- // Whitespace can take the place of commas or opening paren
1202
- var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
1203
- var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
1204
- return {
1205
- CSS_UNIT: new RegExp(CSS_UNIT),
1206
- rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
1207
- rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
1208
- hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
1209
- hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
1210
- hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
1211
- hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
1212
- hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
1213
- hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
1214
- hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
1215
- hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
1216
- };
1217
- }();
1218
-
1219
- // `isValidCSSUnit`
1220
- // Take in a single string / number and check to see if it looks like a CSS unit
1221
- // (see `matchers` above for definition).
1222
- function isValidCSSUnit(color) {
1223
- return !!matchers.CSS_UNIT.exec(color);
1224
- }
1225
-
1226
- // `stringInputToObject`
1227
- // Permissive string parsing. Take in a number of formats, and output an object
1228
- // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
1229
- function stringInputToObject(color) {
1230
- color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
1231
- var named = false;
1232
- if (names[color]) {
1233
- color = names[color];
1234
- named = true;
1235
- } else if (color == "transparent") {
1236
- return {
1237
- r: 0,
1238
- g: 0,
1239
- b: 0,
1240
- a: 0,
1241
- format: "name"
1242
- };
1243
- }
1244
-
1245
- // Try to match string input using regular expressions.
1246
- // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
1247
- // Just return an object and let the conversion functions handle that.
1248
- // This way the result will be the same whether the tinycolor is initialized with string or object.
1249
- var match;
1250
- if (match = matchers.rgb.exec(color)) {
1251
- return {
1252
- r: match[1],
1253
- g: match[2],
1254
- b: match[3]
1255
- };
1256
- }
1257
- if (match = matchers.rgba.exec(color)) {
1258
- return {
1259
- r: match[1],
1260
- g: match[2],
1261
- b: match[3],
1262
- a: match[4]
1263
- };
1264
- }
1265
- if (match = matchers.hsl.exec(color)) {
1266
- return {
1267
- h: match[1],
1268
- s: match[2],
1269
- l: match[3]
1270
- };
1271
- }
1272
- if (match = matchers.hsla.exec(color)) {
1273
- return {
1274
- h: match[1],
1275
- s: match[2],
1276
- l: match[3],
1277
- a: match[4]
1278
- };
1279
- }
1280
- if (match = matchers.hsv.exec(color)) {
1281
- return {
1282
- h: match[1],
1283
- s: match[2],
1284
- v: match[3]
1285
- };
1286
- }
1287
- if (match = matchers.hsva.exec(color)) {
1288
- return {
1289
- h: match[1],
1290
- s: match[2],
1291
- v: match[3],
1292
- a: match[4]
1293
- };
1294
- }
1295
- if (match = matchers.hex8.exec(color)) {
1296
- return {
1297
- r: parseIntFromHex(match[1]),
1298
- g: parseIntFromHex(match[2]),
1299
- b: parseIntFromHex(match[3]),
1300
- a: convertHexToDecimal(match[4]),
1301
- format: named ? "name" : "hex8"
1302
- };
1303
- }
1304
- if (match = matchers.hex6.exec(color)) {
1305
- return {
1306
- r: parseIntFromHex(match[1]),
1307
- g: parseIntFromHex(match[2]),
1308
- b: parseIntFromHex(match[3]),
1309
- format: named ? "name" : "hex"
1310
- };
1311
- }
1312
- if (match = matchers.hex4.exec(color)) {
1313
- return {
1314
- r: parseIntFromHex(match[1] + "" + match[1]),
1315
- g: parseIntFromHex(match[2] + "" + match[2]),
1316
- b: parseIntFromHex(match[3] + "" + match[3]),
1317
- a: convertHexToDecimal(match[4] + "" + match[4]),
1318
- format: named ? "name" : "hex8"
1319
- };
1320
- }
1321
- if (match = matchers.hex3.exec(color)) {
1322
- return {
1323
- r: parseIntFromHex(match[1] + "" + match[1]),
1324
- g: parseIntFromHex(match[2] + "" + match[2]),
1325
- b: parseIntFromHex(match[3] + "" + match[3]),
1326
- format: named ? "name" : "hex"
1327
- };
1328
- }
1329
- return false;
1330
- }
1331
- function validateWCAG2Parms(parms) {
1332
- // return valid WCAG2 parms for isReadable.
1333
- // If input parms are invalid, return {"level":"AA", "size":"small"}
1334
- var level, size;
1335
- parms = parms || {
1336
- level: "AA",
1337
- size: "small"
1338
- };
1339
- level = (parms.level || "AA").toUpperCase();
1340
- size = (parms.size || "small").toLowerCase();
1341
- if (level !== "AA" && level !== "AAA") {
1342
- level = "AA";
1343
- }
1344
- if (size !== "small" && size !== "large") {
1345
- size = "small";
1346
- }
1347
- return {
1348
- level: level,
1349
- size: size
1350
- };
1351
- }
1352
-
1353
-
1354
-
1355
- // EXTERNAL MODULE: external "vue-types"
1356
- var external_vue_types_ = __webpack_require__(210);
1357
- // EXTERNAL MODULE: external "../config-provider"
1358
- var external_config_provider_ = __webpack_require__(2717);
1359
- // EXTERNAL MODULE: external "../directives"
1360
- var external_directives_ = __webpack_require__(4061);
1361
- // EXTERNAL MODULE: external "../icon"
1362
- var external_icon_ = __webpack_require__(6870);
1363
- ;// CONCATENATED MODULE: ../../packages/date-picker/src/base/picker-dropdown.tsx
1364
-
1365
- /*
1366
- * Tencent is pleased to support the open source community by making
1367
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
1368
- *
1369
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1370
- *
1371
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
1372
- *
1373
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
1374
- *
1375
- * ---------------------------------------------------
1376
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
1377
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
1378
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
1379
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1380
- *
1381
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
1382
- * the Software.
1383
- *
1384
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
1385
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1386
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
1387
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1388
- * IN THE SOFTWARE.
1389
- */
1390
-
1391
-
1392
-
1393
- var pickerDropdownProps = {
1394
- placement: {
1395
- type: String,
1396
- "default": 'bottom-start',
1397
- validator: function validator(value) {
1398
- var validList = ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'];
1399
- if (validList.indexOf(value) < 0) {
1400
- console.error("placement property is not valid: '".concat(value, "'"));
1401
- return false;
1402
- }
1403
- return true;
1404
- }
1405
- },
1406
- className: {
1407
- type: String
1408
- },
1409
- extPopoverCls: {
1410
- type: String
1411
- },
1412
- appendToBody: {
1413
- type: Boolean
1414
- },
1415
- triggerRef: {
1416
- type: Object
1417
- },
1418
- onClick: Function
1419
- };
1420
- /* harmony default export */ const picker_dropdown = ((0,external_vue_.defineComponent)({
1421
- props: pickerDropdownProps,
1422
- emits: ['changeVisible'],
1423
- setup: function setup(props, _ref) {
1424
- var emit = _ref.emit;
1425
- var popoverInstance = Object.create(null);
1426
- var refContentRef = (0,external_vue_.ref)(null);
1427
- (0,external_vue_.onMounted)(function () {
1428
- updateDropdown();
1429
- });
1430
- (0,external_vue_.onBeforeUnmount)(function () {
1431
- destoryDropdown();
1432
- });
1433
- // const resetTransformOrigin = (state) => {
1434
- // if (popoverInstance && Object.keys(popoverInstance).length !== 0) {
1435
- // const dataPopperPlacement = state.attributes.popper['data-popper-placement'] as string;
1436
- // const arr = dataPopperPlacement.split('-');
1437
- // const placementStart = arr[0];
1438
- // const placementEnd = arr[1];
1439
- // const leftOrRight = dataPopperPlacement === 'left' || dataPopperPlacement === 'right';
1440
- // if (!leftOrRight) {
1441
- // state.styles.popper.transformOrigin = placementStart === 'bottom'
1442
- // || (placementStart !== 'top' && placementEnd === 'start')
1443
- // ? 'center top'
1444
- // : 'center bottom';
1445
- // }
1446
- // }
1447
- // };
1448
- var forceUpdate = function forceUpdate() {
1449
- var _a;
1450
- if (popoverInstance) {
1451
- (_a = popoverInstance === null || popoverInstance === void 0 ? void 0 : popoverInstance.forceUpdate) === null || _a === void 0 ? void 0 : _a.call(popoverInstance);
1452
- }
1453
- };
1454
- var destoryDropdown = function destoryDropdown() {
1455
- if (popoverInstance && Object.keys(popoverInstance).length !== 0) {
1456
- var instance = popoverInstance;
1457
- instance.isShow && instance.hide();
1458
- instance.destroy();
1459
- popoverInstance = null;
1460
- emit('changeVisible', false);
1461
- }
1462
- };
1463
- // const transforms = {
1464
- // top: 'bottom center',
1465
- // 'top-start': 'bottom left',
1466
- // 'top-end': 'bottom right',
1467
- // bottom: 'top center',
1468
- // 'bottom-start': 'top left',
1469
- // 'bottom-end': 'top right',
1470
- // left: 'right center',
1471
- // 'left-start': 'right top',
1472
- // 'left-end': 'right bottom',
1473
- // right: 'left center',
1474
- // 'right-start': 'left top',
1475
- // 'right-end': 'left bottom',
1476
- // };
1477
- // const toTransformOrigin = (placement: Placement) => transforms[placement];
1478
- // const toVar = (value: string, fallback?: string) => ({
1479
- // var: value,
1480
- // varRef: fallback ? `var(${value}, ${fallback})` : `var(${value})`,
1481
- // });
1482
- // const cssVars = {
1483
- // arrowShadowColor: toVar('--popper-arrow-shadow-color'),
1484
- // arrowSize: toVar('--popper-arrow-size', '8px'),
1485
- // arrowSizeHalf: toVar('--popper-arrow-size-half'),
1486
- // arrowBg: toVar('--popper-arrow-bg'),
1487
- // transformOrigin: toVar('--popper-transform-origin'),
1488
- // arrowOffset: toVar('--popper-arrow-offset'),
1489
- // } as const;
1490
- // const setTransformOrigin = (state: State) => {
1491
- // state.elements.popper.style.setProperty(
1492
- // cssVars.transformOrigin.var,
1493
- // toTransformOrigin(state.placement),
1494
- // );
1495
- // };
1496
- // const transformOrigin: Modifier<'transformOrigin', any> = {
1497
- // name: 'transformOrigin',
1498
- // enabled: true,
1499
- // phase: 'write',
1500
- // fn: ({ state }) => {
1501
- // setTransformOrigin(state);
1502
- // },
1503
- // effect: ({ state }) => () => {
1504
- // setTransformOrigin(state);
1505
- // },
1506
- // };
1507
- // const matchWidth: Modifier<'matchWidth', any> = {
1508
- // name: 'matchWidth',
1509
- // enabled: true,
1510
- // phase: 'beforeWrite',
1511
- // requires: ['computeStyles'],
1512
- // fn: ({ state }) => {
1513
- // state.styles.popper.width = `${state.rects.reference.width + 1}px`;
1514
- // },
1515
- // effect: ({ state }) => () => {
1516
- // const reference = state.elements.reference as HTMLElement;
1517
- // state.elements.popper.style.width = `${reference.offsetWidth}px`;
1518
- // },
1519
- // };
1520
- var updateDropdown = function updateDropdown() {
1521
- if (popoverInstance && Object.keys(popoverInstance).length !== 0) {
1522
- (0,external_vue_.nextTick)(function () {
1523
- popoverInstance.update();
1524
- });
1525
- } else {
1526
- (0,external_vue_.nextTick)(function () {
1527
- popoverInstance = new external_shared_.BKPopover(props.triggerRef, refContentRef.value, {
1528
- placement: props.placement,
1529
- trigger: 'manual',
1530
- modifiers: [
1531
- // matchWidth,
1532
- // transformOrigin,
1533
- {
1534
- name: 'computeStyles',
1535
- options: {
1536
- adaptive: false,
1537
- gpuAcceleration: false
1538
- }
1539
- }, {
1540
- name: 'offset',
1541
- options: {
1542
- offset: [0, 4]
1543
- }
1544
- }
1545
- // {
1546
- // name: 'preventOverflow',
1547
- // options: {
1548
- // // boundariesElement: 'window',
1549
- // padding: {
1550
- // top: 2,
1551
- // bottom: 2,
1552
- // left: 5,
1553
- // right: 5,
1554
- // },
1555
- // },
1556
- // },
1557
- // {
1558
- // name: 'flip',
1559
- // options: {
1560
- // padding: 5,
1561
- // rootBoundary: 'document',
1562
- // },
1563
- // },
1564
- // {
1565
- // name: 'onUpdate',
1566
- // enabled: true,
1567
- // phase: 'afterWrite',
1568
- // fn({ state }) {
1569
- // resetTransformOrigin(state);
1570
- // },
1571
- // },
1572
- ]
1573
- // onFirstUpdate: () => {
1574
- // resetTransformOrigin(popoverInstance.instance.state);
1575
- // },
1576
- });
1577
- // popoverInstance.update();
1578
- });
1579
- }
1580
- };
1581
-
1582
- var styles = (0,external_vue_.computed)(function () {
1583
- var style = {};
1584
- if (props.appendToBody) {
1585
- style['z-index'] = 1060 + external_shared_.bkZIndexManager.getModalNextIndex();
1586
- }
1587
- return style;
1588
- });
1589
- var state = (0,external_vue_.reactive)({
1590
- styles: styles
1591
- });
1592
- var _usePrefix = (0,external_config_provider_.usePrefix)(),
1593
- resolveClassName = _usePrefix.resolveClassName;
1594
- return Object.assign(Object.assign({}, (0,external_vue_.toRefs)(state)), {
1595
- refContentRef: refContentRef,
1596
- forceUpdate: forceUpdate,
1597
- updateDropdown: updateDropdown,
1598
- destoryDropdown: destoryDropdown,
1599
- resolveClassName: resolveClassName
1600
- });
1601
- },
1602
- render: function render() {
1603
- var _a, _b, _c;
1604
- return (0,external_vue_.createVNode)("div", {
1605
- "ref": "refContentRef",
1606
- "class": [this.resolveClassName('date-picker-dropdown'), this.className, this.extPopoverCls],
1607
- "style": this.styles,
1608
- "onClick": this.onClick
1609
- }, [(_c = (_b = (_a = this.$slots)["default"]) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : '']);
1610
- }
1611
- }));
1612
- ;// CONCATENATED MODULE: ../../packages/color-picker/src/components/input-container.tsx
1613
-
1614
- /*
1615
- * Tencent is pleased to support the open source community by making
1616
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
1617
- *
1618
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1619
- *
1620
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
1621
- *
1622
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
1623
- *
1624
- * ---------------------------------------------------
1625
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
1626
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
1627
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
1628
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1629
- *
1630
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
1631
- * the Software.
1632
- *
1633
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
1634
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1635
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
1636
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1637
- * IN THE SOFTWARE.
1638
- */
1639
-
1640
-
1641
-
1642
- var inputContainerProps = {
1643
- info: external_shared_.PropTypes.object.isRequired
1644
- };
1645
- /* harmony default export */ const input_container = ((0,external_vue_.defineComponent)({
1646
- props: inputContainerProps,
1647
- emits: ['tab', 'input'],
1648
- setup: function setup(props, _ref) {
1649
- var emit = _ref.emit;
1650
- var handleTab = function handleTab(e) {
1651
- if (props.info.key === 'a') {
1652
- emit('tab', e);
1653
- }
1654
- };
1655
- var handleInput = function handleInput(e) {
1656
- var key = props.info.key;
1657
- var value = e.target.value;
1658
- emit('input', key, value);
1659
- };
1660
- var _usePrefix = (0,external_config_provider_.usePrefix)(),
1661
- resolveClassName = _usePrefix.resolveClassName;
1662
- var colorPickerCls = (0,external_vue_.computed)(function () {
1663
- return (0,external_shared_.classes)({
1664
- error: props.info.error
1665
- }, "".concat(resolveClassName('color-picker-input-value')));
1666
- });
1667
- return function () {
1668
- return (0,external_vue_.createVNode)("div", {
1669
- "class": "".concat(resolveClassName('color-picker-input-part'))
1670
- }, [(0,external_vue_.createVNode)("input", {
1671
- "type": props.info.name === 'HEX' ? 'text' : 'number',
1672
- "class": colorPickerCls.value,
1673
- "value": props.info.value,
1674
- "onKeydown": handleTab,
1675
- "onInput": handleInput
1676
- }, null), (0,external_vue_.createVNode)("span", {
1677
- "class": "".concat(resolveClassName('color-picker-input-text'))
1678
- }, [props.info.name])]);
1679
- };
1680
- }
1681
- }));
1682
- ;// CONCATENATED MODULE: ../../packages/color-picker/src/components/color-input.tsx
1683
-
1684
- /*
1685
- * Tencent is pleased to support the open source community by making
1686
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
1687
- *
1688
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1689
- *
1690
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
1691
- *
1692
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
1693
- *
1694
- * ---------------------------------------------------
1695
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
1696
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
1697
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
1698
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1699
- *
1700
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
1701
- * the Software.
1702
- *
1703
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
1704
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1705
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
1706
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1707
- * IN THE SOFTWARE.
1708
- */
1709
-
1710
-
1711
-
1712
-
1713
-
1714
- var colorPickerProps = {
1715
- colorObj: external_shared_.PropTypes.object.isRequired
1716
- };
1717
- /* harmony default export */ const color_input = ((0,external_vue_.defineComponent)({
1718
- name: 'ColorPicker',
1719
- props: colorPickerProps,
1720
- emits: ['change', 'tab'],
1721
- setup: function setup(props, _ref) {
1722
- var emit = _ref.emit;
1723
- var hex = (0,external_vue_.reactive)({
1724
- key: 'hex',
1725
- name: 'HEX',
1726
- value: props.colorObj.hex,
1727
- error: false
1728
- });
1729
- var r = (0,external_vue_.reactive)({
1730
- key: 'r',
1731
- name: 'R',
1732
- value: props.colorObj.rgba.r.toString(),
1733
- error: false
1734
- });
1735
- var g = (0,external_vue_.reactive)({
1736
- key: 'g',
1737
- name: 'G',
1738
- value: props.colorObj.rgba.g.toString(),
1739
- error: false
1740
- });
1741
- var b = (0,external_vue_.reactive)({
1742
- key: 'b',
1743
- name: 'B',
1744
- value: props.colorObj.rgba.b.toString(),
1745
- error: false
1746
- });
1747
- var a = (0,external_vue_.reactive)({
1748
- key: 'a',
1749
- name: 'Alpha',
1750
- value: props.colorObj.rgba.a.toString(),
1751
- error: false
1752
- });
1753
- (0,external_vue_.watch)(function () {
1754
- return props.colorObj;
1755
- }, function (val) {
1756
- if (tinycolor(val.hex).toString() !== tinycolor(hex.value).toString()) {
1757
- // 只有 hex 代表的颜色不同才同步,像这种手动输入了 #fEF 等价于 #ffeeff 就不同步
1758
- hex.value = val.hex;
1759
- }
1760
- r.value = val.rgba.r.toString();
1761
- g.value = val.rgba.g.toString();
1762
- b.value = val.rgba.b.toString();
1763
- a.value = val.rgba.a.toString();
1764
- // 每次变化时校验以更新存在的错误
1765
- validate();
1766
- }, {
1767
- deep: true
1768
- });
1769
- // 最后的 alpha 表单 tab 事件
1770
- var handleAlphaTab = function handleAlphaTab(e) {
1771
- emit('tab', e);
1772
- };
1773
- /**
1774
- * 处理手动输入颜色
1775
- * @param {String} key
1776
- * @param {String} value
1777
- */
1778
- var handleInput = function handleInput(key, value) {
1779
- var colorList = {
1780
- r: r,
1781
- g: g,
1782
- b: b,
1783
- a: a,
1784
- hex: hex
1785
- };
1786
- colorList[key].value = value;
1787
- if (validate()) {
1788
- var colorStr = key === 'hex' ? hex.value : "rgba(".concat(r.value, ", ").concat(g.value, ", ").concat(b.value, ", ").concat(a.value, ")");
1789
- emit('change', colorStr);
1790
- }
1791
- };
1792
- // 判断表单输入值是否合法
1793
- var validate = function validate() {
1794
- var result = true;
1795
- // hex
1796
- if (hex.value.startsWith('#') && (hex.value.length === 4 || hex.value.length === 7) && !hex.value.slice(1).match(/[^0-9a-fA-F]/)) {
1797
- hex.error = false;
1798
- } else {
1799
- hex.error = true;
1800
- result = false;
1801
- }
1802
- // a
1803
- if (a.value !== '' && a.value >= 0 && a.value <= 1) {
1804
- a.error = false;
1805
- } else {
1806
- a.error = true;
1807
- result = false;
1808
- }
1809
- // r g b
1810
- for (var _i = 0, _arr = [r, g, b]; _i < _arr.length; _i++) {
1811
- var colorInfo = _arr[_i];
1812
- var value = colorInfo.value;
1813
- if (value !== '' && value >= 0 && value <= 255) {
1814
- colorInfo.error = false;
1815
- } else {
1816
- colorInfo.error = true;
1817
- result = false;
1818
- }
1819
- }
1820
- return result;
1821
- };
1822
- var _usePrefix = (0,external_config_provider_.usePrefix)(),
1823
- resolveClassName = _usePrefix.resolveClassName;
1824
- return function () {
1825
- return (0,external_vue_.createVNode)("div", {
1826
- "class": "".concat(resolveClassName('color-picker-input'))
1827
- }, [(0,external_vue_.createVNode)("div", {
1828
- "class": "".concat(resolveClassName('color-picker-input-hex'))
1829
- }, [(0,external_vue_.createVNode)(input_container, {
1830
- "info": hex,
1831
- "onInput": handleInput
1832
- }, null)]), (0,external_vue_.createVNode)("div", {
1833
- "class": "".concat(resolveClassName('color-picker-input-rgba'))
1834
- }, [(0,external_vue_.createVNode)(input_container, {
1835
- "info": r,
1836
- "onInput": handleInput
1837
- }, null), (0,external_vue_.createVNode)(input_container, {
1838
- "info": g,
1839
- "onInput": handleInput
1840
- }, null), (0,external_vue_.createVNode)(input_container, {
1841
- "info": b,
1842
- "onInput": handleInput
1843
- }, null), (0,external_vue_.createVNode)(input_container, {
1844
- "info": a,
1845
- "onInput": handleInput,
1846
- "onTab": handleAlphaTab
1847
- }, null)])]);
1848
- };
1849
- }
1850
- }));
1851
- ;// CONCATENATED MODULE: ../../packages/color-picker/src/utils.ts
1852
- /*
1853
- * Tencent is pleased to support the open source community by making
1854
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
1855
- *
1856
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1857
- *
1858
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
1859
- *
1860
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
1861
- *
1862
- * ---------------------------------------------------
1863
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
1864
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
1865
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
1866
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1867
- *
1868
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
1869
- * the Software.
1870
- *
1871
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
1872
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1873
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
1874
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1875
- * IN THE SOFTWARE.
1876
- */
1877
-
1878
- /**
1879
- * 根据饱和度面板、色值面板或普通色值标准化颜色信息
1880
- * @param {String|Object} colorParam - 色值信息
1881
- * @param {String} colorParam.h - 色相
1882
- * @param {String} colorParam.s - 饱和度
1883
- * @param {String} [colorParam.l] - 亮度
1884
- * @param {String} [colorParam.v] - 明度
1885
- * @param {String} colorParam.a - 透明度
1886
- * @returns {Object} - 转化后的色值对象
1887
- */
1888
- var formatColor = function formatColor(colorParam) {
1889
- var colorValue = colorParam;
1890
- if (colorParam === '') {
1891
- colorValue = '#FFFFFF';
1892
- }
1893
- // 如果参数不合法会返回黑色#000相关信息
1894
- var tinyColor = tinycolor(colorParam);
1895
- var hsl = tinyColor.toHsl();
1896
- var hsv = tinyColor.toHsv();
1897
- // 因为饱和度为0时,颜色不受色相值影响,色相会置零,但是这里需要在面板中保存色相值
1898
- if (hsl.s === 0) {
1899
- hsl.h = colorValue.h || 0;
1900
- hsv.h = colorValue.h || 0;
1901
- }
1902
- // when the hsv.v is less than 0.0164 (base on test)
1903
- // because of possible loss of precision
1904
- // the result of hue and saturation would be miscalculated
1905
- if (hsv.v < 0.0164) {
1906
- hsv.h = colorValue.h || 0;
1907
- hsv.s = colorValue.s || 0;
1908
- }
1909
- if (hsl.l < 0.01) {
1910
- hsl.h = colorValue.h || 0;
1911
- hsl.s = colorValue.s || 0;
1912
- }
1913
- return {
1914
- hsl: hsl,
1915
- hsv: hsv,
1916
- hex: tinyColor.toHexString().toUpperCase(),
1917
- rgba: tinyColor.toRgb()
1918
- };
1919
- };
1920
- /**
1921
- * 返回指定闭区间数值
1922
- * @param {Number} value
1923
- * @param {Number} min
1924
- * @param {Number} max
1925
- * @returns {Number}
1926
- */
1927
- var clamp = function clamp(value, min, max) {
1928
- if (value < min) {
1929
- return min;
1930
- }
1931
- if (value > max) {
1932
- return max;
1933
- }
1934
- return value;
1935
- };
1936
- /**
1937
- * 移动端获取事件位置
1938
- * @param {Object} e
1939
- * @param {String} prop
1940
- * @returns {Number}
1941
- */
1942
- var getTouches = function getTouches(e, prop) {
1943
- return e.touches ? e.touches[0][prop] : 0;
1944
- };
1945
- /**
1946
- * 转化 rgba 色值字符串
1947
- * @param {Object} rgba
1948
- * @returns {String}
1949
- */
1950
- var toRGBAString = function toRGBAString(rgba) {
1951
- var r = rgba.r,
1952
- g = rgba.g,
1953
- b = rgba.b,
1954
- a = rgba.a;
1955
- return "rgba(".concat([r, g, b, a].join(','), ")");
1956
- };
1957
- ;// CONCATENATED MODULE: ../../packages/color-picker/src/components/hue-slider.tsx
1958
-
1959
- /*
1960
- * Tencent is pleased to support the open source community by making
1961
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
1962
- *
1963
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1964
- *
1965
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
1966
- *
1967
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
1968
- *
1969
- * ---------------------------------------------------
1970
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
1971
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
1972
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
1973
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1974
- *
1975
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
1976
- * the Software.
1977
- *
1978
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
1979
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1980
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
1981
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1982
- * IN THE SOFTWARE.
1983
- */
1984
-
1985
-
1986
-
1987
-
1988
- var hue_slider_colorPickerProps = {
1989
- colorObj: external_shared_.PropTypes.object.isRequired
1990
- };
1991
- /* harmony default export */ const hue_slider = ((0,external_vue_.defineComponent)({
1992
- name: 'ColorPicker',
1993
- props: hue_slider_colorPickerProps,
1994
- emits: ['change'],
1995
- setup: function setup(props, _ref) {
1996
- var emit = _ref.emit;
1997
- var containerRef = (0,external_vue_.ref)(null);
1998
- var pointerStyle = (0,external_vue_.computed)(function () {
1999
- return {
2000
- left: "".concat(props.colorObj.hsv.h / 360 * 100, "%")
2001
- };
2002
- });
2003
- var handleArrowKeydown = function handleArrowKeydown(e) {
2004
- var clientWidth = containerRef.value.clientWidth;
2005
- var left = props.colorObj.hsv.h / 360 * clientWidth;
2006
- var step = 2;
2007
- var hugeStep = 10;
2008
- switch (e.code) {
2009
- case 'ArrowLeft':
2010
- e.preventDefault();
2011
- left = clamp(left - step, 0, clientWidth);
2012
- break;
2013
- case 'ArrowRight':
2014
- e.preventDefault();
2015
- left = clamp(left + step, 0, clientWidth);
2016
- break;
2017
- case 'ArrowUp':
2018
- e.preventDefault();
2019
- left = clamp(left - hugeStep, 0, clientWidth);
2020
- break;
2021
- case 'ArrowDown':
2022
- e.preventDefault();
2023
- left = clamp(left + hugeStep, 0, clientWidth);
2024
- break;
2025
- default:
2026
- return;
2027
- }
2028
- handlePointChange(null, left);
2029
- };
2030
- var handleMouseDown = function handleMouseDown(e) {
2031
- containerRef.value.focus();
2032
- handlePointChange(e);
2033
- window.addEventListener('mousemove', handlePointChange, {
2034
- passive: true
2035
- });
2036
- window.addEventListener('mouseup', handleMouseUp);
2037
- };
2038
- var handleMouseUp = function handleMouseUp() {
2039
- window.removeEventListener('mousemove', handlePointChange);
2040
- window.removeEventListener('mouseup', handleMouseUp);
2041
- };
2042
- /**
2043
- * 色相面板变化
2044
- * @param {MouseEvent|null} e - 鼠标滑动事件
2045
- * @param {Number} [appointedLeft] - 键盘事件对应坐标,如果有就优先使用
2046
- */
2047
- var handlePointChange = function handlePointChange(e, appointedLeft) {
2048
- var clientWidth = containerRef.value.clientWidth;
2049
- var left = appointedLeft !== undefined ? appointedLeft : getLeft(e);
2050
- changeColor(left / clientWidth);
2051
- };
2052
- var getLeft = function getLeft(e) {
2053
- var xOffset = containerRef.value.getBoundingClientRect().left + window.pageXOffset;
2054
- var pageX = e.pageX || getTouches(e, 'PageX');
2055
- return clamp(pageX - xOffset, 0, containerRef.value.clientWidth);
2056
- };
2057
- var changeColor = function changeColor(ratio) {
2058
- var _props$colorObj$hsl = props.colorObj.hsl,
2059
- h = _props$colorObj$hsl.h,
2060
- s = _props$colorObj$hsl.s,
2061
- l = _props$colorObj$hsl.l,
2062
- a = _props$colorObj$hsl.a;
2063
- var newHue = ratio * 360;
2064
- if (h !== newHue) {
2065
- emit('change', {
2066
- h: newHue,
2067
- s: s,
2068
- l: l,
2069
- a: a
2070
- });
2071
- }
2072
- };
2073
- var _usePrefix = (0,external_config_provider_.usePrefix)(),
2074
- resolveClassName = _usePrefix.resolveClassName;
2075
- return function () {
2076
- return (0,external_vue_.createVNode)("div", {
2077
- "ref": containerRef,
2078
- "tabindex": "0",
2079
- "class": "".concat(resolveClassName('color-picker-hue')),
2080
- "onKeydown": handleArrowKeydown,
2081
- "onMousedown": function onMousedown(e) {
2082
- e.stopPropagation();
2083
- e.preventDefault();
2084
- handleMouseDown(e);
2085
- }
2086
- }, [(0,external_vue_.createVNode)("div", {
2087
- "class": "".concat(resolveClassName('color-picker-hue-pointer')),
2088
- "style": pointerStyle.value
2089
- }, [(0,external_vue_.createVNode)("div", {
2090
- "class": "".concat(resolveClassName('color-picker-hue-rectangle'))
2091
- }, null)])]);
2092
- };
2093
- }
2094
- }));
2095
- ;// CONCATENATED MODULE: ../../packages/color-picker/src/components/recommend-colors.tsx
2096
-
2097
-
2098
- /*
2099
- * Tencent is pleased to support the open source community by making
2100
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
2101
- *
2102
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
2103
- *
2104
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
2105
- *
2106
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
2107
- *
2108
- * ---------------------------------------------------
2109
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
2110
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
2111
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
2112
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2113
- *
2114
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
2115
- * the Software.
2116
- *
2117
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
2118
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2119
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
2120
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2121
- * IN THE SOFTWARE.
2122
- */
2123
-
2124
-
2125
-
2126
-
2127
-
2128
- var recommend_colors_colorPickerProps = {
2129
- colorObj: external_shared_.PropTypes.object.isRequired,
2130
- recommend: external_shared_.PropTypes.oneOfType([external_shared_.PropTypes.array.def(function () {
2131
- return [];
2132
- }), external_shared_.PropTypes.bool.def(true)]).isRequired
2133
- };
2134
- /* harmony default export */ const recommend_colors = ((0,external_vue_.defineComponent)({
2135
- props: recommend_colors_colorPickerProps,
2136
- emits: ['change', 'tab'],
2137
- setup: function setup(props, _ref) {
2138
- var emit = _ref.emit;
2139
- var isFocused = (0,external_vue_.ref)(false);
2140
- var selectedIndex = (0,external_vue_.ref)(-1);
2141
- var selectedColor = (0,external_vue_.ref)(null);
2142
- (0,external_vue_.watch)(function () {
2143
- return props.colorObj;
2144
- }, function () {
2145
- // 每次在外部修改颜色后预设面板都会取消预设选择的样式,即便预设和当前色一样
2146
- // 预设里面修改颜色会在 $nextTick 恢复状态
2147
- selectedIndex.value = -1;
2148
- selectedColor.value = null;
2149
- }, {
2150
- deep: true
2151
- });
2152
- var colors = (0,external_vue_.computed)(function () {
2153
- return getColorsFromRecommend(props.recommend);
2154
- });
2155
- var _usePrefix = (0,external_config_provider_.usePrefix)(),
2156
- resolveClassName = _usePrefix.resolveClassName;
2157
- var getColorClass = function getColorClass(color, index) {
2158
- var _classes;
2159
- return (0,external_shared_.classes)((_classes = {}, _defineProperty(_classes, "".concat(resolveClassName('color-picker-empty')), color === ''), _defineProperty(_classes, "".concat(resolveClassName('color-picker-recommend-selected-color')), isFocused.value && selectedIndex.value === index), _classes), "".concat(resolveClassName('color-picker-recommend-color')));
2160
- };
2161
- var handleKeydown = function handleKeydown(e) {
2162
- if (e.code === 'Tab') {
2163
- emit('tab', e);
2164
- } else {
2165
- var index = 0;
2166
- var rowNum = 10; // 每行展示的颜色块个数,和样式相关联
2167
- var max = colors.value.length - 1;
2168
- switch (e.code) {
2169
- case 'ArrowLeft':
2170
- e.preventDefault();
2171
- index = clamp(selectedIndex.value - 1, 0, max);
2172
- break;
2173
- case 'ArrowRight':
2174
- e.preventDefault();
2175
- index = clamp(selectedIndex.value + 1, 0, max);
2176
- break;
2177
- case 'ArrowUp':
2178
- e.preventDefault();
2179
- index = clamp(selectedIndex.value - rowNum, 0, max);
2180
- break;
2181
- case 'ArrowDown':
2182
- e.preventDefault();
2183
- index = clamp(selectedIndex.value + rowNum, 0, max);
2184
- break;
2185
- default:
2186
- return;
2187
- }
2188
- selectColor(index);
2189
- }
2190
- };
2191
- var selectColor = function selectColor(index) {
2192
- var color = colors.value[index];
2193
- emit('change', color);
2194
- // 预设里面修改颜色不重置状态(恢复状态)
2195
- (0,external_vue_.nextTick)(function () {
2196
- selectedIndex.value = index;
2197
- selectedColor.value = color;
2198
- });
2199
- };
2200
- /**
2201
- * 校验、处理预设值
2202
- * @param {Boolean|String[]} recommend
2203
- * @returns {String[]}
2204
- */
2205
- var getColorsFromRecommend = function getColorsFromRecommend(recommend) {
2206
- if (recommend === true) {
2207
- return ['', '#ff4500', '#ff8c00', '#ffd700', '#90ee90', '#ddffff', '#00ced1', '#3a84ff', '#a933f5', '#db7093', '#000000', '#494949', '#9B9B9B', '#ffffff'];
2208
- }
2209
- if (Array.isArray(recommend)) {
2210
- // 如果预设值是无效的,这里按空字符串处理以显示提示用户,应该输入正确的色值
2211
- return recommend.map(function (color) {
2212
- return tinycolor(color).isValid() ? color : '';
2213
- });
2214
- }
2215
- };
2216
- return function () {
2217
- return (0,external_vue_.createVNode)("div", {
2218
- "tabindex": "0",
2219
- "class": "".concat(resolveClassName('color-picker-recommend'), " "),
2220
- "onFocus": function onFocus() {
2221
- return isFocused.value = true;
2222
- },
2223
- "onBlur": function onBlur() {
2224
- return isFocused.value = false;
2225
- },
2226
- "onKeydown": handleKeydown
2227
- }, [colors.value.map(function (color, index) {
2228
- return (0,external_vue_.createVNode)("div", {
2229
- "style": "background: ".concat(color || '#fff'),
2230
- "class": getColorClass(color, index),
2231
- "onClick": function onClick() {
2232
- return selectColor(index);
2233
- }
2234
- }, [selectedIndex.value === index ? (0,external_vue_.createVNode)("div", {
2235
- "class": "".concat(resolveClassName('color-picker-pointer'))
2236
- }, [(0,external_vue_.createVNode)("div", {
2237
- "class": "".concat(resolveClassName('color-picker-circle'))
2238
- }, null)]) : undefined]);
2239
- })]);
2240
- };
2241
- }
2242
- }));
2243
- ;// CONCATENATED MODULE: ../../packages/color-picker/src/components/saturation-panel.tsx
2244
-
2245
- /*
2246
- * Tencent is pleased to support the open source community by making
2247
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
2248
- *
2249
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
2250
- *
2251
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
2252
- *
2253
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
2254
- *
2255
- * ---------------------------------------------------
2256
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
2257
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
2258
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
2259
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2260
- *
2261
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
2262
- * the Software.
2263
- *
2264
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
2265
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2266
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
2267
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2268
- * IN THE SOFTWARE.
2269
- */
2270
-
2271
-
2272
-
2273
-
2274
- var saturation_panel_colorPickerProps = {
2275
- colorObj: external_shared_.PropTypes.object.isRequired
2276
- };
2277
- /* harmony default export */ const saturation_panel = ((0,external_vue_.defineComponent)({
2278
- props: saturation_panel_colorPickerProps,
2279
- emits: ['change'],
2280
- setup: function setup(props, _ref) {
2281
- var emit = _ref.emit;
2282
- var containerRef = (0,external_vue_.ref)(null);
2283
- var backgroundStyle = (0,external_vue_.computed)(function () {
2284
- return {
2285
- background: "hsl(".concat(props.colorObj.hsv.h, ", 100%, 50%)")
2286
- };
2287
- });
2288
- var pointerStyle = (0,external_vue_.computed)(function () {
2289
- return {
2290
- top: "".concat((1 - props.colorObj.hsv.v) * 100, "%"),
2291
- left: "".concat(props.colorObj.hsv.s * 100, "%")
2292
- };
2293
- });
2294
- var handleMouseDown = function handleMouseDown(e) {
2295
- containerRef.value.focus();
2296
- handlePointChange(e);
2297
- window.addEventListener('mousemove', handlePointChange, {
2298
- passive: true
2299
- });
2300
- window.addEventListener('mouseup', handleMouseUp);
2301
- };
2302
- var handleMouseUp = function handleMouseUp() {
2303
- window.removeEventListener('mousemove', handlePointChange);
2304
- window.removeEventListener('mouseup', handleMouseUp);
2305
- };
2306
- var handleArrowKeydown = function handleArrowKeydown(e) {
2307
- var _containerRef$value = containerRef.value,
2308
- clientWidth = _containerRef$value.clientWidth,
2309
- clientHeight = _containerRef$value.clientHeight;
2310
- var left = props.colorObj.hsv.s * clientWidth;
2311
- var top = (1 - props.colorObj.hsv.v) * clientHeight;
2312
- var step = 10;
2313
- switch (e.code) {
2314
- case 'ArrowLeft':
2315
- e.preventDefault();
2316
- left = clamp(left - step, 0, clientWidth);
2317
- break;
2318
- case 'ArrowRight':
2319
- e.preventDefault();
2320
- left = clamp(left + step, 0, clientWidth);
2321
- break;
2322
- case 'ArrowUp':
2323
- e.preventDefault();
2324
- top = clamp(top - step, 0, clientHeight);
2325
- break;
2326
- case 'ArrowDown':
2327
- e.preventDefault();
2328
- top = clamp(top + step, 0, clientHeight);
2329
- break;
2330
- default:
2331
- return;
2332
- }
2333
- handlePointChange(null, left, top);
2334
- };
2335
- /**
2336
- * 饱和度面板变化
2337
- * @param {MouseEvent|null} e - 鼠标滑动事件
2338
- * @param {Number} [appointedLeft] - 键盘事件对应坐标,如果有就优先使用
2339
- * @param {Number} [appointedTop] - 键盘事件对应坐标,如果有就优先使用
2340
- */
2341
- var handlePointChange = function handlePointChange(e, appointedLeft, appointedTop) {
2342
- var _containerRef$value2 = containerRef.value,
2343
- clientWidth = _containerRef$value2.clientWidth,
2344
- clientHeight = _containerRef$value2.clientHeight;
2345
- var left = appointedLeft !== undefined ? appointedLeft : getLeft(e);
2346
- var top = appointedTop !== undefined ? appointedTop : getTop(e);
2347
- var saturation = left / clientWidth;
2348
- var bright = 1 - top / clientHeight;
2349
- changeColor(props.colorObj.hsv.h, saturation, bright, props.colorObj.hsv.a);
2350
- };
2351
- var getLeft = function getLeft(e) {
2352
- var xOffset = containerRef.value.getBoundingClientRect().left + window.pageXOffset;
2353
- var pageX = e.pageX || getTouches(e, 'PageX');
2354
- return clamp(pageX - xOffset, 0, containerRef.value.clientWidth);
2355
- };
2356
- var getTop = function getTop(e) {
2357
- var yOffset = containerRef.value.getBoundingClientRect().top + window.pageYOffset;
2358
- var pageY = e.pageY || getTouches(e, 'PageY');
2359
- return clamp(pageY - yOffset, 0, containerRef.value.clientHeight);
2360
- };
2361
- var changeColor = function changeColor(h, s, v, a) {
2362
- emit('change', {
2363
- h: h,
2364
- s: s,
2365
- v: v,
2366
- a: a
2367
- });
2368
- };
2369
- var _usePrefix = (0,external_config_provider_.usePrefix)(),
2370
- resolveClassName = _usePrefix.resolveClassName;
2371
- return function () {
2372
- return (0,external_vue_.createVNode)("div", {
2373
- "ref": containerRef,
2374
- "tabindex": "0",
2375
- "class": "".concat(resolveClassName('color-picker-saturation')),
2376
- "style": backgroundStyle.value,
2377
- "onKeydown": handleArrowKeydown,
2378
- "onMousedown": function onMousedown(e) {
2379
- e.stopPropagation();
2380
- handleMouseDown(e);
2381
- }
2382
- }, [(0,external_vue_.createVNode)("div", {
2383
- "class": "".concat(resolveClassName('color-picker-saturation-white'))
2384
- }, null), (0,external_vue_.createVNode)("div", {
2385
- "class": "".concat(resolveClassName('color-picker-saturation-black'))
2386
- }, null), (0,external_vue_.createVNode)("div", {
2387
- "class": "".concat(resolveClassName('color-picker-pointer')),
2388
- "style": pointerStyle.value
2389
- }, [(0,external_vue_.createVNode)("div", {
2390
- "class": "".concat(resolveClassName('color-picker-circle'))
2391
- }, null)])]);
2392
- };
2393
- }
2394
- }));
2395
- ;// CONCATENATED MODULE: ../../packages/color-picker/src/color-picker.tsx
2396
-
2397
-
2398
- /*
2399
- * Tencent is pleased to support the open source community by making
2400
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
2401
- *
2402
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
2403
- *
2404
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
2405
- *
2406
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
2407
- *
2408
- * ---------------------------------------------------
2409
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
2410
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
2411
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
2412
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2413
- *
2414
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
2415
- * the Software.
2416
- *
2417
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
2418
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2419
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
2420
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2421
- * IN THE SOFTWARE.
2422
- */
2423
-
2424
-
2425
-
2426
-
2427
-
2428
-
2429
-
2430
-
2431
-
2432
-
2433
-
2434
-
2435
-
2436
- var ColorPickSizeEnum;
2437
- (function (ColorPickSizeEnum) {
2438
- ColorPickSizeEnum["UNKNOWN"] = "";
2439
- ColorPickSizeEnum["SMALL"] = "small";
2440
- ColorPickSizeEnum["LARGE"] = "large";
2441
- })(ColorPickSizeEnum || (ColorPickSizeEnum = {}));
2442
- var color_picker_colorPickerProps = {
2443
- modelValue: external_shared_.PropTypes.string.def(''),
2444
- disabled: external_shared_.PropTypes.bool.def(false),
2445
- readonly: external_shared_.PropTypes.bool.def(false),
2446
- transfer: external_shared_.PropTypes.bool.def(false),
2447
- size: (0,external_vue_types_.toType)('colorPickSize', {}).def(ColorPickSizeEnum.UNKNOWN),
2448
- showValue: external_shared_.PropTypes.bool.def(true),
2449
- // true 展示组件内置预设值
2450
- // false 不展示预设值
2451
- // 数组 自定义预设值
2452
- recommend: external_shared_.PropTypes.oneOfType([external_shared_.PropTypes.array.def(function () {
2453
- return [];
2454
- }), external_shared_.PropTypes.bool.def(true)]).def(true),
2455
- extCls: external_shared_.PropTypes.string.def(''),
2456
- withValidate: external_shared_.PropTypes.bool.def(true)
2457
- };
2458
- var whiteColorObj = formatColor('#FFFFFF');
2459
- /* harmony default export */ const color_picker = ((0,external_vue_.defineComponent)({
2460
- name: 'ColorPicker',
2461
- directives: {
2462
- clickoutside: external_directives_.clickoutside
2463
- },
2464
- props: color_picker_colorPickerProps,
2465
- emits: ['update:modelValue', 'change'],
2466
- setup: function setup(props, _ref) {
2467
- var emit = _ref.emit,
2468
- slots = _ref.slots;
2469
- var formItem = (0,external_shared_.useFormItem)();
2470
- var showDropdown = (0,external_vue_.ref)(false);
2471
- // 当前颜色的色值,如果为空字符串显示:默认白色背景 + 中间一个叉
2472
- var colorStr = (0,external_vue_.ref)('');
2473
- // 储存当前颜色的相关信息
2474
- var colorObj = (0,external_vue_.reactive)(JSON.parse(JSON.stringify(whiteColorObj)));
2475
- var dropRef = (0,external_vue_.ref)(null);
2476
- var saturationPanelRef = (0,external_vue_.ref)(null);
2477
- var referenceRef = (0,external_vue_.ref)(null);
2478
- var _usePrefix = (0,external_config_provider_.usePrefix)(),
2479
- resolveClassName = _usePrefix.resolveClassName;
2480
- var colorPickerCls = (0,external_vue_.computed)(function () {
2481
- var _classes;
2482
- return (0,external_shared_.classes)((_classes = {}, _defineProperty(_classes, "".concat(resolveClassName("color-picker-".concat(props.size))), props.size), _defineProperty(_classes, "".concat(resolveClassName('color-picker-show-dropdown')), showDropdown.value), _defineProperty(_classes, "".concat(resolveClassName('color-picker-show-value')), props.showValue), _defineProperty(_classes, "".concat(resolveClassName('color-picker-disabled')), props.disabled || props.readonly), _classes), "".concat(resolveClassName('color-picker'), " ").concat(props.extCls));
2483
- });
2484
- // 是否渲染预设值
2485
- var isRenderRecommend = (0,external_vue_.computed)(function () {
2486
- return Boolean(props.recommend === true || Array.isArray(props.recommend) && props.recommend.length);
2487
- });
2488
- (0,external_vue_.onBeforeMount)(function () {
2489
- // 1. 组件初始化时,如果计算的色值和传入的值不一样,显示计算的色值
2490
- changeColorFromProps({
2491
- isCreated: true
2492
- });
2493
- });
2494
- (0,external_vue_.watch)(function () {
2495
- return props.modelValue;
2496
- }, function () {
2497
- var _a;
2498
- // 2. 如果组件绑定值被外部修改,自动根据绑定至更新组件色值
2499
- changeColorFromProps();
2500
- if (props.withValidate) {
2501
- (_a = formItem === null || formItem === void 0 ? void 0 : formItem.validate) === null || _a === void 0 ? void 0 : _a.call(formItem, 'change');
2502
- }
2503
- });
2504
- var handleTriggerKeydown = function handleTriggerKeydown(e) {
2505
- if (e.code === 'Enter' || e.code === 'NumpadEnter') {
2506
- toggleDropdown();
2507
- } else if (e.code === 'Escape') {
2508
- closeDropdown();
2509
- }
2510
- };
2511
- var handleDropdownKeydown = function handleDropdownKeydown(e) {
2512
- if (props.transfer) {
2513
- handleTriggerKeydown(e);
2514
- }
2515
- };
2516
- var toggleDropdown = function toggleDropdown() {
2517
- if (props.disabled || props.readonly) {
2518
- return;
2519
- }
2520
- showDropdown.value ? closeDropdown() : openDropdown();
2521
- };
2522
- // 如果未开启预设则此 tab 事件为颜色选择器最后一个表单 tab 事件,重新聚焦于饱和度面板
2523
- var handleTabInput = function handleTabInput(e) {
2524
- if (!isRenderRecommend.value) {
2525
- e.preventDefault();
2526
- saturationPanelRef.value.$el.focus();
2527
- }
2528
- };
2529
- // 颜色选择器最后一个表单 tab 事件,重新聚焦于饱和度面板
2530
- var handleTabRecommend = function handleTabRecommend(e) {
2531
- e.preventDefault();
2532
- saturationPanelRef.value.$el.focus();
2533
- };
2534
- var openDropdown = function openDropdown() {
2535
- var _a;
2536
- showDropdown.value = true;
2537
- (_a = dropRef.value) === null || _a === void 0 ? void 0 : _a.updateDropdown();
2538
- // 展开后默认聚焦于 HEX 输入框,setTimeout 等 transfer 出现
2539
- setTimeout(function () {
2540
- var hexInput = dropRef.value.$el.querySelector(".".concat(resolveClassName('color-picker-input-hex'), " .").concat(resolveClassName('color-picker-input-value')));
2541
- hexInput.select();
2542
- }, 100);
2543
- };
2544
- var closeDropdown = function closeDropdown() {
2545
- var _a;
2546
- if (showDropdown.value) {
2547
- (0,external_vue_.nextTick)(function () {
2548
- return referenceRef.value.focus();
2549
- });
2550
- showDropdown.value = false;
2551
- (_a = dropRef.value) === null || _a === void 0 ? void 0 : _a.destoryDropdown();
2552
- // 3. 关闭组件时如果绑定值与组件内部选择的值不一致(比如既没有使用 v-model 也没有监听 change 事件)显示绑定值
2553
- changeColorFromProps();
2554
- }
2555
- };
2556
- /**
2557
- * created 时、props.value 变化时、每次关闭组件时调用
2558
- * @param {Object} option
2559
- * @param {Boolean} [option.isCreated = false] - 是否是实例创建完成后的第一次调用
2560
- */
2561
- var changeColorFromProps = function changeColorFromProps() {
2562
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2563
- _ref2$isCreated = _ref2.isCreated,
2564
- isCreated = _ref2$isCreated === void 0 ? false : _ref2$isCreated;
2565
- // 空字符串为默认值且合法
2566
- if (props.modelValue === '') {
2567
- // 颜色选择器有色值,用户手动修改为空字符串;或用户关闭组件时绑定的value为空字符串(没有使用组件传递的值)
2568
- if (colorStr.value !== '') {
2569
- colorStr.value = '';
2570
- Object.assign(colorObj, whiteColorObj);
2571
- emit('update:modelValue', colorStr.value);
2572
- }
2573
- return;
2574
- }
2575
- // 根据 props 计算色值
2576
- var propsColorObj = formatColor(props.modelValue);
2577
- var propsColorStr = propsColorObj.rgba.a === 1 ? propsColorObj.hex : toRGBAString(propsColorObj.rgba);
2578
- // 根据 props 计算的色值和组件内部色值不一致,有几种情况
2579
- if (propsColorStr !== colorStr.value) {
2580
- // 传入的值是否是合法的色值
2581
- var isValid = tinycolor(props.modelValue).isValid();
2582
- // 实例挂载之前
2583
- if (isCreated) {
2584
- // 传入了非法的色值,按空字符串处理并触发 change 事件
2585
- if (!isValid) {
2586
- Object.assign(colorObj, whiteColorObj);
2587
- emit('change', '');
2588
- } else {
2589
- // 到了这里,说明传入的色值已经计算出来了,是合法的,但可能存在格式上的偏差,如用户传入 #fff 计算得 #FFFFFF
2590
- colorStr.value = propsColorStr.toLowerCase() === props.modelValue.toLowerCase() ? props.modelValue // 如果只是大小写不一致,显示用户传入的字符
2591
- : propsColorStr; // 其它格式上的不一致,以本组件计算值为准
2592
- Object.assign(colorObj, propsColorObj);
2593
- }
2594
- } else {
2595
- // 实例挂载之后
2596
- // 用户在实例挂载之后在组件外面修改色值 组件内部只是跟着 props 变化色值 并不触发 change 事件
2597
- if (!isValid) {
2598
- colorStr.value = '';
2599
- Object.assign(colorObj, whiteColorObj);
2600
- } else if (propsColorStr.toLowerCase() !== colorStr.value.toLowerCase()) {
2601
- // 如果只是外部传入的值和当前组件显示的的值大小写不一致,不作处理
2602
- // 比如 this.value === '#ffffff',计算值为 '#FFFFFF',不进行下面的处理直接显示 '#ffffff'
2603
- // 反之显示内部计算值:
2604
- Object.assign(colorObj, propsColorObj);
2605
- colorStr.value = propsColorStr;
2606
- }
2607
- }
2608
- }
2609
- };
2610
- /**
2611
- * 组件内部选择颜色处理
2612
- * @param {String|Object} val - hex,rgba,hsla,hsva
2613
- */
2614
- var handleColorChange = function handleColorChange(val) {
2615
- // 组件内拿到的色值都是合法的,空字符串特殊处理
2616
- if (val === '') {
2617
- colorStr.value = '';
2618
- Object.assign(colorObj, whiteColorObj);
2619
- emit('update:modelValue', '');
2620
- emit('change', '');
2621
- return;
2622
- }
2623
- var handleColorObj = formatColor(val);
2624
- var handleColorStr = handleColorObj.rgba.a === 1 ? handleColorObj.hex : toRGBAString(handleColorObj.rgba);
2625
- colorStr.value = handleColorStr;
2626
- Object.assign(colorObj, handleColorObj);
2627
- emit('update:modelValue', colorStr.value);
2628
- emit('change', handleColorStr);
2629
- };
2630
- var hideDropDown = function hideDropDown() {
2631
- showDropdown.value = false;
2632
- };
2633
- return function () {
2634
- return (0,external_vue_.withDirectives)((0,external_vue_.createVNode)("div", {
2635
- "ref": referenceRef,
2636
- "tabindex": "0",
2637
- "class": colorPickerCls.value,
2638
- "onKeydown": handleTriggerKeydown,
2639
- "onClick": toggleDropdown
2640
- }, [typeof slots.trigger === 'function' ? slots.trigger({
2641
- value: colorStr.value,
2642
- isShowDropdown: showDropdown.value
2643
- }) : (0,external_vue_.createVNode)(external_vue_.Fragment, null, [(0,external_vue_.createVNode)("div", {
2644
- "class": "".concat(resolveClassName('color-picker-color'))
2645
- }, [(0,external_vue_.createVNode)("span", {
2646
- "class": "".concat(resolveClassName('color-picker-color-square'), " ").concat(!colorStr.value && "".concat(resolveClassName('color-picker-empty'))),
2647
- "style": "background: ".concat(colorStr.value || '#FFF')
2648
- }, null)]), props.showValue ? (0,external_vue_.createVNode)("div", {
2649
- "class": "".concat(resolveClassName('color-picker-text'))
2650
- }, [(0,external_vue_.createVNode)("span", null, [colorStr.value])]) : undefined, (0,external_vue_.createVNode)("div", {
2651
- "class": "".concat(resolveClassName('color-picker-icon'))
2652
- }, [(0,external_vue_.createVNode)(external_icon_.AngleUp, {
2653
- "class": "icon-angle-down"
2654
- }, null)])]), (0,external_vue_.createVNode)(external_vue_.Transition, {
2655
- "name": "bk-fade-down-transition"
2656
- }, {
2657
- "default": function _default() {
2658
- return [(0,external_vue_.withDirectives)((0,external_vue_.createVNode)(picker_dropdown, {
2659
- "ref": dropRef,
2660
- "triggerRef": referenceRef.value
2661
- }, {
2662
- "default": function _default() {
2663
- return [(0,external_vue_.createVNode)("div", {
2664
- "class": "".concat(resolveClassName('color-dropdown-container'))
2665
- }, [(0,external_vue_.createVNode)("div", {
2666
- "class": "".concat(resolveClassName('color-picker-dropdown')),
2667
- "onClick": function onClick(e) {
2668
- e.stopPropagation();
2669
- },
2670
- "onMousedown": function onMousedown(e) {
2671
- e.stopPropagation();
2672
- },
2673
- "onKeydown": handleDropdownKeydown
2674
- }, [(0,external_vue_.createVNode)(saturation_panel, {
2675
- "ref": saturationPanelRef,
2676
- "colorObj": colorObj,
2677
- "onChange": handleColorChange
2678
- }, null), (0,external_vue_.createVNode)(hue_slider, {
2679
- "colorObj": colorObj,
2680
- "onChange": handleColorChange
2681
- }, null), (0,external_vue_.createVNode)(color_input, {
2682
- "colorObj": colorObj,
2683
- "onTab": handleTabInput,
2684
- "onChange": handleColorChange
2685
- }, null), isRenderRecommend.value ? (0,external_vue_.createVNode)("div", {
2686
- "class": "".concat(resolveClassName('color-picker-recommend-container'))
2687
- }, [(0,external_vue_.createVNode)(recommend_colors, {
2688
- "colorObj": colorObj,
2689
- "recommend": props.recommend,
2690
- "onTab": handleTabRecommend,
2691
- "onChange": handleColorChange
2692
- }, null)]) : undefined])])];
2693
- }
2694
- }), [[external_vue_.vShow, showDropdown.value]])];
2695
- }
2696
- })]), [[(0,external_vue_.resolveDirective)("clickoutside"), hideDropDown]]);
2697
- };
2698
- }
2699
- }));
2700
- ;// CONCATENATED MODULE: ../../packages/color-picker/src/index.ts
2701
- /*
2702
- * Tencent is pleased to support the open source community by making
2703
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
2704
- *
2705
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
2706
- *
2707
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
2708
- *
2709
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
2710
- *
2711
- * ---------------------------------------------------
2712
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
2713
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
2714
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
2715
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2716
- *
2717
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
2718
- * the Software.
2719
- *
2720
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
2721
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2722
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
2723
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2724
- * IN THE SOFTWARE.
2725
- */
2726
-
2727
-
2728
- var BkColorPicker = (0,external_shared_.withInstall)(color_picker);
2729
- /* harmony default export */ const src = (BkColorPicker);
2730
- })();
2731
-
2732
- /******/ return __webpack_exports__;
2733
- /******/ })()
2734
- ;
2735
- });
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("../shared"),require("vue"),require("vue-types"),require("../config-provider"),require("../directives"),require("../icon"));else if("function"==typeof define&&define.amd)define(["../shared","vue","vue-types","../config-provider","../directives","../icon"],t);else{var r="object"==typeof exports?t(require("../shared"),require("vue"),require("vue-types"),require("../config-provider"),require("../directives"),require("../icon")):t(e["../shared"],e.vue,e["vue-types"],e["../config-provider"],e["../directives"],e["../icon"]);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,((e,t,r,n,o,a)=>(()=>{"use strict";var i={2717:e=>{e.exports=n},4061:e=>{e.exports=o},6870:e=>{e.exports=a},4212:t=>{t.exports=e},748:e=>{e.exports=t},210:e=>{e.exports=r}},c={};function u(e){var t=c[e];if(void 0!==t)return t.exports;var r=c[e]={exports:{}};return i[e](r,r.exports,u),r.exports}u.d=(e,t)=>{for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};return(()=>{u.r(l),u.d(l,{default:()=>fe});var e=u(4212);function t(e){return t="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},t(e)}function r(e,r,n){return(r=function(e){var r=function(e,r){if("object"!==t(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===t(r)?r:String(r)}(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var n=u(748);function o(e){return o="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},o(e)}var a=/^\s+/,i=/\s+$/;function c(e,t){if(t=t||{},(e=e||"")instanceof c)return e;if(!(this instanceof c))return new c(e,t);var r=function(e){var t,r,n,c={r:0,g:0,b:0},u=1,l=null,s=null,f=null,d=!1,h=!1;return"string"==typeof e&&(e=function(e){e=e.replace(a,"").replace(i,"").toLowerCase();var t,r=!1;if(S[e])e=S[e],r=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};return(t=L.rgb.exec(e))?{r:t[1],g:t[2],b:t[3]}:(t=L.rgba.exec(e))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=L.hsl.exec(e))?{h:t[1],s:t[2],l:t[3]}:(t=L.hsla.exec(e))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=L.hsv.exec(e))?{h:t[1],s:t[2],v:t[3]}:(t=L.hsva.exec(e))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=L.hex8.exec(e))?{r:O(t[1]),g:O(t[2]),b:O(t[3]),a:T(t[4]),format:r?"name":"hex8"}:(t=L.hex6.exec(e))?{r:O(t[1]),g:O(t[2]),b:O(t[3]),format:r?"name":"hex"}:(t=L.hex4.exec(e))?{r:O(t[1]+""+t[1]),g:O(t[2]+""+t[2]),b:O(t[3]+""+t[3]),a:T(t[4]+""+t[4]),format:r?"name":"hex8"}:!!(t=L.hex3.exec(e))&&{r:O(t[1]+""+t[1]),g:O(t[2]+""+t[2]),b:O(t[3]+""+t[3]),format:r?"name":"hex"}}(e)),"object"==o(e)&&(E(e.r)&&E(e.g)&&E(e.b)?(t=e.r,r=e.g,n=e.b,c={r:255*j(t,255),g:255*j(r,255),b:255*j(n,255)},d=!0,h="%"===String(e.r).substr(-1)?"prgb":"rgb"):E(e.h)&&E(e.s)&&E(e.v)?(l=R(e.s),s=R(e.v),c=function(e,t,r){e=6*j(e,360),t=j(t,100),r=j(r,100);var n=Math.floor(e),o=e-n,a=r*(1-t),i=r*(1-o*t),c=r*(1-(1-o)*t),u=n%6;return{r:255*[r,i,a,a,c,r][u],g:255*[c,r,r,i,a,a][u],b:255*[a,a,c,r,r,i][u]}}(e.h,l,s),d=!0,h="hsv"):E(e.h)&&E(e.s)&&E(e.l)&&(l=R(e.s),f=R(e.l),c=function(e,t,r){var n,o,a;function i(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}if(e=j(e,360),t=j(t,100),r=j(r,100),0===t)n=o=a=r;else{var c=r<.5?r*(1+t):r+t-r*t,u=2*r-c;n=i(u,c,e+1/3),o=i(u,c,e),a=i(u,c,e-1/3)}return{r:255*n,g:255*o,b:255*a}}(e.h,l,f),d=!0,h="hsl"),e.hasOwnProperty("a")&&(u=e.a)),u=V(u),{ok:d,format:e.format||h,r:Math.min(255,Math.max(c.r,0)),g:Math.min(255,Math.max(c.g,0)),b:Math.min(255,Math.max(c.b,0)),a:u}}(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||r.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}function s(e,t,r){e=j(e,255),t=j(t,255),r=j(r,255);var n,o,a=Math.max(e,t,r),i=Math.min(e,t,r),c=(a+i)/2;if(a==i)n=o=0;else{var u=a-i;switch(o=c>.5?u/(2-a-i):u/(a+i),a){case e:n=(t-r)/u+(t<r?6:0);break;case t:n=(r-e)/u+2;break;case r:n=(e-t)/u+4}n/=6}return{h:n,s:o,l:c}}function f(e,t,r){e=j(e,255),t=j(t,255),r=j(r,255);var n,o,a=Math.max(e,t,r),i=Math.min(e,t,r),c=a,u=a-i;if(o=0===a?0:u/a,a==i)n=0;else{switch(a){case e:n=(t-r)/u+(t<r?6:0);break;case t:n=(r-e)/u+2;break;case r:n=(e-t)/u+4}n/=6}return{h:n,s:o,v:c}}function d(e,t,r,n){var o=[P(Math.round(e).toString(16)),P(Math.round(t).toString(16)),P(Math.round(r).toString(16))];return n&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0):o.join("")}function h(e,t,r,n){return[P(F(n)),P(Math.round(e).toString(16)),P(Math.round(t).toString(16)),P(Math.round(r).toString(16))].join("")}function p(e,t){t=0===t?0:t||10;var r=c(e).toHsl();return r.s-=t/100,r.s=C(r.s),c(r)}function v(e,t){t=0===t?0:t||10;var r=c(e).toHsl();return r.s+=t/100,r.s=C(r.s),c(r)}function g(e){return c(e).desaturate(100)}function b(e,t){t=0===t?0:t||10;var r=c(e).toHsl();return r.l+=t/100,r.l=C(r.l),c(r)}function m(e,t){t=0===t?0:t||10;var r=c(e).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(-t/100*255))),r.g=Math.max(0,Math.min(255,r.g-Math.round(-t/100*255))),r.b=Math.max(0,Math.min(255,r.b-Math.round(-t/100*255))),c(r)}function y(e,t){t=0===t?0:t||10;var r=c(e).toHsl();return r.l-=t/100,r.l=C(r.l),c(r)}function w(e,t){var r=c(e).toHsl(),n=(r.h+t)%360;return r.h=n<0?360+n:n,c(r)}function k(e){var t=c(e).toHsl();return t.h=(t.h+180)%360,c(t)}function x(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var r=c(e).toHsl(),n=[c(e)],o=360/t,a=1;a<t;a++)n.push(c({h:(r.h+a*o)%360,s:r.s,l:r.l}));return n}function _(e){var t=c(e).toHsl(),r=t.h;return[c(e),c({h:(r+72)%360,s:t.s,l:t.l}),c({h:(r+216)%360,s:t.s,l:t.l})]}function M(e,t,r){t=t||6,r=r||30;var n=c(e).toHsl(),o=360/r,a=[c(e)];for(n.h=(n.h-(o*t>>1)+720)%360;--t;)n.h=(n.h+o)%360,a.push(c(n));return a}function A(e,t){t=t||6;for(var r=c(e).toHsv(),n=r.h,o=r.s,a=r.v,i=[],u=1/t;t--;)i.push(c({h:n,s:o,v:a})),a=(a+u)%1;return i}c.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var e,t,r,n=this.toRgb();return e=n.r/255,t=n.g/255,r=n.b/255,.2126*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.7152*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))},setAlpha:function(e){return this._a=V(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=f(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=f(this._r,this._g,this._b),t=Math.round(360*e.h),r=Math.round(100*e.s),n=Math.round(100*e.v);return 1==this._a?"hsv("+t+", "+r+"%, "+n+"%)":"hsva("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var e=s(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=s(this._r,this._g,this._b),t=Math.round(360*e.h),r=Math.round(100*e.s),n=Math.round(100*e.l);return 1==this._a?"hsl("+t+", "+r+"%, "+n+"%)":"hsla("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(e){return d(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return function(e,t,r,n,o){var a=[P(Math.round(e).toString(16)),P(Math.round(t).toString(16)),P(Math.round(r).toString(16)),P(F(n))];return o&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*j(this._r,255))+"%",g:Math.round(100*j(this._g,255))+"%",b:Math.round(100*j(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*j(this._r,255))+"%, "+Math.round(100*j(this._g,255))+"%, "+Math.round(100*j(this._b,255))+"%)":"rgba("+Math.round(100*j(this._r,255))+"%, "+Math.round(100*j(this._g,255))+"%, "+Math.round(100*j(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(N[d(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+h(this._r,this._g,this._b,this._a),r=t,n=this._gradientType?"GradientType = 1, ":"";if(e){var o=c(e);r="#"+h(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+t+",endColorstr="+r+")"},toString:function(e){var t=!!e;e=e||this._format;var r=!1,n=this._a<1&&this._a>=0;return t||!n||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"hex4"!==e&&"hex8"!==e&&"name"!==e?("rgb"===e&&(r=this.toRgbString()),"prgb"===e&&(r=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(r=this.toHexString()),"hex3"===e&&(r=this.toHexString(!0)),"hex4"===e&&(r=this.toHex8String(!0)),"hex8"===e&&(r=this.toHex8String()),"name"===e&&(r=this.toName()),"hsl"===e&&(r=this.toHslString()),"hsv"===e&&(r=this.toHsvString()),r||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},clone:function(){return c(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(b,arguments)},brighten:function(){return this._applyModification(m,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(p,arguments)},saturate:function(){return this._applyModification(v,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(w,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(M,arguments)},complement:function(){return this._applyCombination(k,arguments)},monochromatic:function(){return this._applyCombination(A,arguments)},splitcomplement:function(){return this._applyCombination(_,arguments)},triad:function(){return this._applyCombination(x,[3])},tetrad:function(){return this._applyCombination(x,[4])}},c.fromRatio=function(e,t){if("object"==o(e)){var r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]="a"===n?e[n]:R(e[n]));e=r}return c(e,t)},c.equals=function(e,t){return!(!e||!t)&&c(e).toRgbString()==c(t).toRgbString()},c.random=function(){return c.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},c.mix=function(e,t,r){r=0===r?0:r||50;var n=c(e).toRgb(),o=c(t).toRgb(),a=r/100;return c({r:(o.r-n.r)*a+n.r,g:(o.g-n.g)*a+n.g,b:(o.b-n.b)*a+n.b,a:(o.a-n.a)*a+n.a})},c.readability=function(e,t){var r=c(e),n=c(t);return(Math.max(r.getLuminance(),n.getLuminance())+.05)/(Math.min(r.getLuminance(),n.getLuminance())+.05)},c.isReadable=function(e,t,r){var n,o,a,i,u,l=c.readability(e,t);switch(o=!1,(a=r,"AA"!==(i=((a=a||{level:"AA",size:"small"}).level||"AA").toUpperCase())&&"AAA"!==i&&(i="AA"),"small"!==(u=(a.size||"small").toLowerCase())&&"large"!==u&&(u="small"),n={level:i,size:u}).level+n.size){case"AAsmall":case"AAAlarge":o=l>=4.5;break;case"AAlarge":o=l>=3;break;case"AAAsmall":o=l>=7}return o},c.mostReadable=function(e,t,r){var n,o,a,i,u=null,l=0;o=(r=r||{}).includeFallbackColors,a=r.level,i=r.size;for(var s=0;s<t.length;s++)(n=c.readability(e,t[s]))>l&&(l=n,u=c(t[s]));return c.isReadable(e,u,{level:a,size:i})||!o?u:(r.includeFallbackColors=!1,c.mostReadable(e,["#fff","#000"],r))};var S=c.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},N=c.hexNames=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}(S);function V(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function j(e,t){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var r=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(e);return e=Math.min(t,Math.max(0,parseFloat(e))),r&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function C(e){return Math.min(1,Math.max(0,e))}function O(e){return parseInt(e,16)}function P(e){return 1==e.length?"0"+e:""+e}function R(e){return e<=1&&(e=100*e+"%"),e}function F(e){return Math.round(255*parseFloat(e)).toString(16)}function T(e){return O(e)/255}var H,q,D,L=(q="[\\s|\\(]+("+(H="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+H+")[,|\\s]+("+H+")\\s*\\)?",D="[\\s|\\(]+("+H+")[,|\\s]+("+H+")[,|\\s]+("+H+")[,|\\s]+("+H+")\\s*\\)?",{CSS_UNIT:new RegExp(H),rgb:new RegExp("rgb"+q),rgba:new RegExp("rgba"+D),hsl:new RegExp("hsl"+q),hsla:new RegExp("hsla"+D),hsv:new RegExp("hsv"+q),hsva:new RegExp("hsva"+D),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function E(e){return!!L.CSS_UNIT.exec(e)}var I=u(210),B=u(2717),U=u(4061),z=u(6870),K={placement:{type:String,default:"bottom-start",validator:function(e){return!(["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"].indexOf(e)<0&&(console.error("placement property is not valid: '".concat(e,"'")),1))}},className:{type:String},extPopoverCls:{type:String},appendToBody:{type:Boolean},triggerRef:{type:Object},onClick:Function};const W=(0,n.defineComponent)({props:K,emits:["changeVisible"],setup:function(t,r){var o=r.emit,a=Object.create(null),i=(0,n.ref)(null);(0,n.onMounted)((function(){u()})),(0,n.onBeforeUnmount)((function(){c()}));var c=function(){if(a&&0!==Object.keys(a).length){var e=a;e.isShow&&e.hide(),e.destroy(),a=null,o("changeVisible",!1)}},u=function(){a&&0!==Object.keys(a).length?(0,n.nextTick)((function(){a.update()})):(0,n.nextTick)((function(){a=new e.BKPopover(t.triggerRef,i.value,{placement:t.placement,trigger:"manual",modifiers:[{name:"computeStyles",options:{adaptive:!1,gpuAcceleration:!1}},{name:"offset",options:{offset:[0,4]}}]})}))},l=(0,n.computed)((function(){var r={};return t.appendToBody&&(r["z-index"]=1060+e.bkZIndexManager.getModalNextIndex()),r})),s=(0,n.reactive)({styles:l}),f=(0,B.usePrefix)().resolveClassName;return Object.assign(Object.assign({},(0,n.toRefs)(s)),{refContentRef:i,forceUpdate:function(){var e;a&&(null===(e=null==a?void 0:a.forceUpdate)||void 0===e||e.call(a))},updateDropdown:u,destoryDropdown:c,resolveClassName:f})},render:function(){var e,t,r;return(0,n.createVNode)("div",{ref:"refContentRef",class:[this.resolveClassName("date-picker-dropdown"),this.className,this.extPopoverCls],style:this.styles,onClick:this.onClick},[null!==(r=null===(t=(e=this.$slots).default)||void 0===t?void 0:t.call(e))&&void 0!==r?r:""])}});var X={info:e.PropTypes.object.isRequired};const $=(0,n.defineComponent)({props:X,emits:["tab","input"],setup:function(t,r){var o=r.emit,a=function(e){"a"===t.info.key&&o("tab",e)},i=function(e){var r=t.info.key,n=e.target.value;o("input",r,n)},c=(0,B.usePrefix)().resolveClassName,u=(0,n.computed)((function(){return(0,e.classes)({error:t.info.error},"".concat(c("color-picker-input-value")))}));return function(){return(0,n.createVNode)("div",{class:"".concat(c("color-picker-input-part"))},[(0,n.createVNode)("input",{type:"HEX"===t.info.name?"text":"number",class:u.value,value:t.info.value,onKeydown:a,onInput:i},null),(0,n.createVNode)("span",{class:"".concat(c("color-picker-input-text"))},[t.info.name])])}}});var G={colorObj:e.PropTypes.object.isRequired};const Y=(0,n.defineComponent)({name:"ColorPicker",props:G,emits:["change","tab"],setup:function(e,t){var r=t.emit,o=(0,n.reactive)({key:"hex",name:"HEX",value:e.colorObj.hex,error:!1}),a=(0,n.reactive)({key:"r",name:"R",value:e.colorObj.rgba.r.toString(),error:!1}),i=(0,n.reactive)({key:"g",name:"G",value:e.colorObj.rgba.g.toString(),error:!1}),u=(0,n.reactive)({key:"b",name:"B",value:e.colorObj.rgba.b.toString(),error:!1}),l=(0,n.reactive)({key:"a",name:"Alpha",value:e.colorObj.rgba.a.toString(),error:!1});(0,n.watch)((function(){return e.colorObj}),(function(e){c(e.hex).toString()!==c(o.value).toString()&&(o.value=e.hex),a.value=e.rgba.r.toString(),i.value=e.rgba.g.toString(),u.value=e.rgba.b.toString(),l.value=e.rgba.a.toString(),d()}),{deep:!0});var s=function(e){r("tab",e)},f=function(e,t){if({r:a,g:i,b:u,a:l,hex:o}[e].value=t,d()){var n="hex"===e?o.value:"rgba(".concat(a.value,", ").concat(i.value,", ").concat(u.value,", ").concat(l.value,")");r("change",n)}},d=function(){var e=!0;!o.value.startsWith("#")||4!==o.value.length&&7!==o.value.length||o.value.slice(1).match(/[^0-9a-fA-F]/)?(o.error=!0,e=!1):o.error=!1,""!==l.value&&l.value>=0&&l.value<=1?l.error=!1:(l.error=!0,e=!1);for(var t=0,r=[a,i,u];t<r.length;t++){var n=r[t],c=n.value;""!==c&&c>=0&&c<=255?n.error=!1:(n.error=!0,e=!1)}return e},h=(0,B.usePrefix)().resolveClassName;return function(){return(0,n.createVNode)("div",{class:"".concat(h("color-picker-input"))},[(0,n.createVNode)("div",{class:"".concat(h("color-picker-input-hex"))},[(0,n.createVNode)($,{info:o,onInput:f},null)]),(0,n.createVNode)("div",{class:"".concat(h("color-picker-input-rgba"))},[(0,n.createVNode)($,{info:a,onInput:f},null),(0,n.createVNode)($,{info:i,onInput:f},null),(0,n.createVNode)($,{info:u,onInput:f},null),(0,n.createVNode)($,{info:l,onInput:f,onTab:s},null)])])}}});var J=function(e){var t=e;""===e&&(t="#FFFFFF");var r=c(e),n=r.toHsl(),o=r.toHsv();return 0===n.s&&(n.h=t.h||0,o.h=t.h||0),o.v<.0164&&(o.h=t.h||0,o.s=t.s||0),n.l<.01&&(n.h=t.h||0,n.s=t.s||0),{hsl:n,hsv:o,hex:r.toHexString().toUpperCase(),rgba:r.toRgb()}},Z=function(e,t,r){return e<t?t:e>r?r:e},Q=function(e,t){return e.touches?e.touches[0][t]:0},ee=function(e){var t=e.r,r=e.g,n=e.b,o=e.a;return"rgba(".concat([t,r,n,o].join(","),")")},te={colorObj:e.PropTypes.object.isRequired};const re=(0,n.defineComponent)({name:"ColorPicker",props:te,emits:["change"],setup:function(e,t){var r=t.emit,o=(0,n.ref)(null),a=(0,n.computed)((function(){return{left:"".concat(e.colorObj.hsv.h/360*100,"%")}})),i=function(t){var r=o.value.clientWidth,n=e.colorObj.hsv.h/360*r;switch(t.code){case"ArrowLeft":t.preventDefault(),n=Z(n-2,0,r);break;case"ArrowRight":t.preventDefault(),n=Z(n+2,0,r);break;case"ArrowUp":t.preventDefault(),n=Z(n-10,0,r);break;case"ArrowDown":t.preventDefault(),n=Z(n+10,0,r);break;default:return}u(null,n)},c=function e(){window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",e)},u=function(e,t){var r=o.value.clientWidth,n=void 0!==t?t:l(e);s(n/r)},l=function(e){var t=o.value.getBoundingClientRect().left+window.pageXOffset,r=e.pageX||Q(e,"PageX");return Z(r-t,0,o.value.clientWidth)},s=function(t){var n=e.colorObj.hsl,o=n.h,a=n.s,i=n.l,c=n.a,u=360*t;o!==u&&r("change",{h:u,s:a,l:i,a:c})},f=(0,B.usePrefix)().resolveClassName;return function(){return(0,n.createVNode)("div",{ref:o,tabindex:"0",class:"".concat(f("color-picker-hue")),onKeydown:i,onMousedown:function(e){e.stopPropagation(),e.preventDefault(),function(e){o.value.focus(),u(e),window.addEventListener("mousemove",u,{passive:!0}),window.addEventListener("mouseup",c)}(e)}},[(0,n.createVNode)("div",{class:"".concat(f("color-picker-hue-pointer")),style:a.value},[(0,n.createVNode)("div",{class:"".concat(f("color-picker-hue-rectangle"))},null)])])}}});var ne={colorObj:e.PropTypes.object.isRequired,recommend:e.PropTypes.oneOfType([e.PropTypes.array.def((function(){return[]})),e.PropTypes.bool.def(!0)]).isRequired};const oe=(0,n.defineComponent)({props:ne,emits:["change","tab"],setup:function(t,o){var a=o.emit,i=(0,n.ref)(!1),u=(0,n.ref)(-1),l=(0,n.ref)(null);(0,n.watch)((function(){return t.colorObj}),(function(){u.value=-1,l.value=null}),{deep:!0});var s=(0,n.computed)((function(){return v(t.recommend)})),f=(0,B.usePrefix)().resolveClassName,d=function(t,n){var o;return(0,e.classes)((r(o={},"".concat(f("color-picker-empty")),""===t),r(o,"".concat(f("color-picker-recommend-selected-color")),i.value&&u.value===n),o),"".concat(f("color-picker-recommend-color")))},h=function(e){if("Tab"===e.code)a("tab",e);else{var t=0,r=s.value.length-1;switch(e.code){case"ArrowLeft":e.preventDefault(),t=Z(u.value-1,0,r);break;case"ArrowRight":e.preventDefault(),t=Z(u.value+1,0,r);break;case"ArrowUp":e.preventDefault(),t=Z(u.value-10,0,r);break;case"ArrowDown":e.preventDefault(),t=Z(u.value+10,0,r);break;default:return}p(t)}},p=function(e){var t=s.value[e];a("change",t),(0,n.nextTick)((function(){u.value=e,l.value=t}))},v=function(e){return!0===e?["","#ff4500","#ff8c00","#ffd700","#90ee90","#ddffff","#00ced1","#3a84ff","#a933f5","#db7093","#000000","#494949","#9B9B9B","#ffffff"]:Array.isArray(e)?e.map((function(e){return c(e).isValid()?e:""})):void 0};return function(){return(0,n.createVNode)("div",{tabindex:"0",class:"".concat(f("color-picker-recommend")," "),onFocus:function(){return i.value=!0},onBlur:function(){return i.value=!1},onKeydown:h},[s.value.map((function(e,t){return(0,n.createVNode)("div",{style:"background: ".concat(e||"#fff"),class:d(e,t),onClick:function(){return p(t)}},[u.value===t?(0,n.createVNode)("div",{class:"".concat(f("color-picker-pointer"))},[(0,n.createVNode)("div",{class:"".concat(f("color-picker-circle"))},null)]):void 0])}))])}}});var ae={colorObj:e.PropTypes.object.isRequired};const ie=(0,n.defineComponent)({props:ae,emits:["change"],setup:function(e,t){var r=t.emit,o=(0,n.ref)(null),a=(0,n.computed)((function(){return{background:"hsl(".concat(e.colorObj.hsv.h,", 100%, 50%)")}})),i=(0,n.computed)((function(){return{top:"".concat(100*(1-e.colorObj.hsv.v),"%"),left:"".concat(100*e.colorObj.hsv.s,"%")}})),c=function e(){window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",e)},u=function(t){var r=o.value,n=r.clientWidth,a=r.clientHeight,i=e.colorObj.hsv.s*n,c=(1-e.colorObj.hsv.v)*a;switch(t.code){case"ArrowLeft":t.preventDefault(),i=Z(i-10,0,n);break;case"ArrowRight":t.preventDefault(),i=Z(i+10,0,n);break;case"ArrowUp":t.preventDefault(),c=Z(c-10,0,a);break;case"ArrowDown":t.preventDefault(),c=Z(c+10,0,a);break;default:return}l(null,i,c)},l=function(t,r,n){var a=o.value,i=a.clientWidth,c=a.clientHeight,u=(void 0!==r?r:s(t))/i,l=1-(void 0!==n?n:f(t))/c;d(e.colorObj.hsv.h,u,l,e.colorObj.hsv.a)},s=function(e){var t=o.value.getBoundingClientRect().left+window.pageXOffset,r=e.pageX||Q(e,"PageX");return Z(r-t,0,o.value.clientWidth)},f=function(e){var t=o.value.getBoundingClientRect().top+window.pageYOffset,r=e.pageY||Q(e,"PageY");return Z(r-t,0,o.value.clientHeight)},d=function(e,t,n,o){r("change",{h:e,s:t,v:n,a:o})},h=(0,B.usePrefix)().resolveClassName;return function(){return(0,n.createVNode)("div",{ref:o,tabindex:"0",class:"".concat(h("color-picker-saturation")),style:a.value,onKeydown:u,onMousedown:function(e){e.stopPropagation(),function(e){o.value.focus(),l(e),window.addEventListener("mousemove",l,{passive:!0}),window.addEventListener("mouseup",c)}(e)}},[(0,n.createVNode)("div",{class:"".concat(h("color-picker-saturation-white"))},null),(0,n.createVNode)("div",{class:"".concat(h("color-picker-saturation-black"))},null),(0,n.createVNode)("div",{class:"".concat(h("color-picker-pointer")),style:i.value},[(0,n.createVNode)("div",{class:"".concat(h("color-picker-circle"))},null)])])}}});var ce;!function(e){e.UNKNOWN="",e.SMALL="small",e.LARGE="large"}(ce||(ce={}));var ue={modelValue:e.PropTypes.string.def(""),disabled:e.PropTypes.bool.def(!1),readonly:e.PropTypes.bool.def(!1),transfer:e.PropTypes.bool.def(!1),size:(0,I.toType)("colorPickSize",{}).def(ce.UNKNOWN),showValue:e.PropTypes.bool.def(!0),recommend:e.PropTypes.oneOfType([e.PropTypes.array.def((function(){return[]})),e.PropTypes.bool.def(!0)]).def(!0),extCls:e.PropTypes.string.def(""),withValidate:e.PropTypes.bool.def(!0)},le=J("#FFFFFF");const se=(0,n.defineComponent)({name:"ColorPicker",directives:{clickoutside:U.clickoutside},props:ue,emits:["update:modelValue","change"],setup:function(t,o){var a=o.emit,i=o.slots,u=(0,e.useFormItem)(),l=(0,n.ref)(!1),s=(0,n.ref)(""),f=(0,n.reactive)(JSON.parse(JSON.stringify(le))),d=(0,n.ref)(null),h=(0,n.ref)(null),p=(0,n.ref)(null),v=(0,B.usePrefix)().resolveClassName,g=(0,n.computed)((function(){var n;return(0,e.classes)((r(n={},"".concat(v("color-picker-".concat(t.size))),t.size),r(n,"".concat(v("color-picker-show-dropdown")),l.value),r(n,"".concat(v("color-picker-show-value")),t.showValue),r(n,"".concat(v("color-picker-disabled")),t.disabled||t.readonly),n),"".concat(v("color-picker")," ").concat(t.extCls))})),b=(0,n.computed)((function(){return Boolean(!0===t.recommend||Array.isArray(t.recommend)&&t.recommend.length)}));(0,n.onBeforeMount)((function(){A({isCreated:!0})})),(0,n.watch)((function(){return t.modelValue}),(function(){var e;A(),t.withValidate&&(null===(e=null==u?void 0:u.validate)||void 0===e||e.call(u,"change"))}));var m=function(e){"Enter"===e.code||"NumpadEnter"===e.code?w():"Escape"===e.code&&M()},y=function(e){t.transfer&&m(e)},w=function(){t.disabled||t.readonly||(l.value?M():_())},k=function(e){b.value||(e.preventDefault(),h.value.$el.focus())},x=function(e){e.preventDefault(),h.value.$el.focus()},_=function(){var e;l.value=!0,null===(e=d.value)||void 0===e||e.updateDropdown(),setTimeout((function(){d.value.$el.querySelector(".".concat(v("color-picker-input-hex")," .").concat(v("color-picker-input-value"))).select()}),100)},M=function(){var e;l.value&&((0,n.nextTick)((function(){return p.value.focus()})),l.value=!1,null===(e=d.value)||void 0===e||e.destoryDropdown(),A())},A=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).isCreated,r=void 0!==e&&e;if(""!==t.modelValue){var n=J(t.modelValue),o=1===n.rgba.a?n.hex:ee(n.rgba);if(o!==s.value){var i=c(t.modelValue).isValid();r?i?(s.value=o.toLowerCase()===t.modelValue.toLowerCase()?t.modelValue:o,Object.assign(f,n)):(Object.assign(f,le),a("change","")):i?o.toLowerCase()!==s.value.toLowerCase()&&(Object.assign(f,n),s.value=o):(s.value="",Object.assign(f,le))}}else""!==s.value&&(s.value="",Object.assign(f,le),a("update:modelValue",s.value))},S=function(e){if(""===e)return s.value="",Object.assign(f,le),a("update:modelValue",""),void a("change","");var t=J(e),r=1===t.rgba.a?t.hex:ee(t.rgba);s.value=r,Object.assign(f,t),a("update:modelValue",s.value),a("change",r)},N=function(){l.value=!1};return function(){return(0,n.withDirectives)((0,n.createVNode)("div",{ref:p,tabindex:"0",class:g.value,onKeydown:m,onClick:w},["function"==typeof i.trigger?i.trigger({value:s.value,isShowDropdown:l.value}):(0,n.createVNode)(n.Fragment,null,[(0,n.createVNode)("div",{class:"".concat(v("color-picker-color"))},[(0,n.createVNode)("span",{class:"".concat(v("color-picker-color-square")," ").concat(!s.value&&"".concat(v("color-picker-empty"))),style:"background: ".concat(s.value||"#FFF")},null)]),t.showValue?(0,n.createVNode)("div",{class:"".concat(v("color-picker-text"))},[(0,n.createVNode)("span",null,[s.value])]):void 0,(0,n.createVNode)("div",{class:"".concat(v("color-picker-icon"))},[(0,n.createVNode)(z.AngleUp,{class:"icon-angle-down"},null)])]),(0,n.createVNode)(n.Transition,{name:"bk-fade-down-transition"},{default:function(){return[(0,n.withDirectives)((0,n.createVNode)(W,{ref:d,triggerRef:p.value},{default:function(){return[(0,n.createVNode)("div",{class:"".concat(v("color-dropdown-container"))},[(0,n.createVNode)("div",{class:"".concat(v("color-picker-dropdown")),onClick:function(e){e.stopPropagation()},onMousedown:function(e){e.stopPropagation()},onKeydown:y},[(0,n.createVNode)(ie,{ref:h,colorObj:f,onChange:S},null),(0,n.createVNode)(re,{colorObj:f,onChange:S},null),(0,n.createVNode)(Y,{colorObj:f,onTab:k,onChange:S},null),b.value?(0,n.createVNode)("div",{class:"".concat(v("color-picker-recommend-container"))},[(0,n.createVNode)(oe,{colorObj:f,recommend:t.recommend,onTab:x,onChange:S},null)]):void 0])])]}}),[[n.vShow,l.value]])]}})]),[[(0,n.resolveDirective)("clickoutside"),N]])}}}),fe=(0,e.withInstall)(se)})(),l})()));