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