@tendaui/react 1.1.1 → 1.1.3
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/es/_chunks/{dep-D7LanWes.js → dep-4LYjB3c6.js} +3 -18
- package/es/_chunks/dep-4LYjB3c6.js.map +1 -0
- package/es/_chunks/dep-5U9UjDaf.js +345 -0
- package/es/_chunks/dep-5U9UjDaf.js.map +1 -0
- package/es/_chunks/{dep-B7HmDtze.js → dep-B4_O1Vgv.js} +2 -2
- package/es/_chunks/{dep-B7HmDtze.js.map → dep-B4_O1Vgv.js.map} +1 -1
- package/es/_chunks/dep-BP0-apUT.js.map +1 -1
- package/es/_chunks/dep-BRbJGDI9.js +7 -0
- package/es/_chunks/dep-BRbJGDI9.js.map +1 -0
- package/es/_chunks/{dep-EcrDKDlu.js → dep-BYlJzn45.js} +10 -9
- package/es/_chunks/dep-BYlJzn45.js.map +1 -0
- package/es/_chunks/dep-BbeHB7S3.js +116 -0
- package/es/_chunks/dep-BbeHB7S3.js.map +1 -0
- package/es/_chunks/{dep-DB5wmwh1.js → dep-Bjfn7Zv_.js} +2 -2
- package/es/_chunks/{dep-DB5wmwh1.js.map → dep-Bjfn7Zv_.js.map} +1 -1
- package/es/_chunks/{dep-C36au4Ip.js → dep-BuIAffJt.js} +2 -2
- package/es/_chunks/{dep-C36au4Ip.js.map → dep-BuIAffJt.js.map} +1 -1
- package/es/_chunks/{dep-bWaVq_y3.js → dep-ByzdZjUR.js} +2 -2
- package/es/_chunks/dep-ByzdZjUR.js.map +1 -0
- package/es/_chunks/dep-CD_4-1Xb.js +103 -0
- package/es/_chunks/dep-CD_4-1Xb.js.map +1 -0
- package/es/_chunks/{dep-Dk2xX8lh.js → dep-CJCt0IS0.js} +5 -212
- package/es/_chunks/dep-CJCt0IS0.js.map +1 -0
- package/es/_chunks/dep-CMPsNAXF.js +52 -0
- package/es/_chunks/dep-CMPsNAXF.js.map +1 -0
- package/es/_chunks/dep-COy5g3FT.js +512 -0
- package/es/_chunks/dep-COy5g3FT.js.map +1 -0
- package/es/_chunks/{dep-CoIiHOgo.js → dep-CRURwzDj.js} +3 -3
- package/es/_chunks/{dep-CoIiHOgo.js.map → dep-CRURwzDj.js.map} +1 -1
- package/es/_chunks/dep-C_wPqvpm.js +36 -0
- package/es/_chunks/dep-C_wPqvpm.js.map +1 -0
- package/es/_chunks/dep-Ccktr_jk.js +33 -0
- package/es/_chunks/dep-Ccktr_jk.js.map +1 -0
- package/es/_chunks/dep-Chz4ZJCb.js +20 -0
- package/es/_chunks/dep-Chz4ZJCb.js.map +1 -0
- package/es/_chunks/dep-CkmtEv0Y.js +55 -0
- package/es/_chunks/dep-CkmtEv0Y.js.map +1 -0
- package/es/_chunks/dep-DJmE940f.js +764 -0
- package/es/_chunks/dep-DJmE940f.js.map +1 -0
- package/es/_chunks/{dep-DHWwZ2Nj.js → dep-DQ6kXoi8.js} +2 -2
- package/es/_chunks/{dep-DHWwZ2Nj.js.map → dep-DQ6kXoi8.js.map} +1 -1
- package/es/_chunks/{dep-0QH2Ee4R.js → dep-DRwijJcv.js} +5 -5
- package/es/_chunks/dep-DRwijJcv.js.map +1 -0
- package/es/_chunks/dep-DTlQ2dCA.js +46 -0
- package/es/_chunks/dep-DTlQ2dCA.js.map +1 -0
- package/es/_chunks/dep-DURB9x8g.js +170 -0
- package/es/_chunks/dep-DURB9x8g.js.map +1 -0
- package/es/_chunks/{dep-DZ_0EvBk.js → dep-DX65P8M9.js} +4 -45
- package/es/_chunks/dep-DX65P8M9.js.map +1 -0
- package/es/_chunks/{dep-BH5n5r1M.js → dep-DbVHGoUC.js} +2 -2
- package/es/_chunks/dep-DbVHGoUC.js.map +1 -0
- package/es/_chunks/dep-Dlppf0JU.js +214 -0
- package/es/_chunks/dep-Dlppf0JU.js.map +1 -0
- package/es/_chunks/dep-Dr5wkz0z.js +266 -0
- package/es/_chunks/dep-Dr5wkz0z.js.map +1 -0
- package/es/_chunks/dep-DwWrhxkd.js.map +1 -1
- package/es/_chunks/dep-Tshfumgl.js +31 -0
- package/es/_chunks/dep-Tshfumgl.js.map +1 -0
- package/es/_chunks/{dep-u1x3x6MJ.js → dep-gy8uvBaS.js} +2 -2
- package/es/_chunks/{dep-u1x3x6MJ.js.map → dep-gy8uvBaS.js.map} +1 -1
- package/es/_chunks/dep-oUgTcXgm.js +11 -0
- package/es/_chunks/dep-oUgTcXgm.js.map +1 -0
- package/es/_chunks/dep-zOZQ0R9g.js +1181 -0
- package/es/_chunks/dep-zOZQ0R9g.js.map +1 -0
- package/es/alert/Alert.d.ts +7 -0
- package/es/alert/Alert.js +4 -3
- package/es/alert/Alert.js.map +1 -1
- package/es/alert/defaultProps.d.ts +2 -0
- package/es/alert/index.d.ts +5 -0
- package/es/alert/index.js +4 -3
- package/es/alert/index.js.map +1 -1
- package/es/alert/style/css.d.ts +1 -0
- package/es/alert/style/index.d.ts +1 -0
- package/es/alert/type.d.ts +45 -0
- package/es/badge/Badge.d.ts +7 -0
- package/es/badge/Badge.js +3 -2
- package/es/badge/Badge.js.map +1 -1
- package/es/badge/defaultProps.d.ts +2 -0
- package/es/badge/index.d.ts +5 -0
- package/es/badge/index.js +3 -2
- package/es/badge/index.js.map +1 -1
- package/es/badge/style/css.d.ts +1 -0
- package/es/badge/style/index.d.ts +1 -0
- package/es/badge/type.d.ts +50 -0
- package/es/button/Button.d.ts +6 -0
- package/es/button/Button.js +7 -5
- package/es/button/Button.js.map +1 -1
- package/es/button/_example/base.js +171 -0
- package/es/button/_example/base.js.map +1 -0
- package/es/button/_example/icon.js +181 -0
- package/es/button/_example/icon.js.map +1 -0
- package/es/button/defaultProps.d.ts +2 -0
- package/es/button/index.d.ts +5 -0
- package/es/button/index.js +7 -5
- package/es/button/index.js.map +1 -1
- package/es/button/style/css.d.ts +1 -0
- package/es/button/style/index.d.ts +1 -0
- package/es/button/type.d.ts +81 -0
- package/es/checkbox/Checkbox.d.ts +10 -0
- package/es/checkbox/Checkbox.js +5 -4
- package/es/checkbox/Checkbox.js.map +1 -1
- package/es/checkbox/CheckboxGroup.d.ts +14 -0
- package/es/checkbox/CheckboxGroup.js +5 -4
- package/es/checkbox/CheckboxGroup.js.map +1 -1
- package/es/checkbox/defaultProps.d.ts +3 -0
- package/es/checkbox/index.d.ts +11 -0
- package/es/checkbox/index.js +5 -4
- package/es/checkbox/index.js.map +1 -1
- package/es/checkbox/style/css.d.ts +1 -0
- package/es/checkbox/style/index.d.ts +1 -0
- package/es/checkbox/type.d.ts +115 -0
- package/es/color-picker/ColorPickPanel.d.ts +4 -0
- package/es/color-picker/ColorPickPanel.js +44 -0
- package/es/color-picker/ColorPickPanel.js.map +1 -0
- package/es/color-picker/ColorPicker.d.ts +4 -0
- package/es/color-picker/ColorPicker.js +118 -0
- package/es/color-picker/ColorPicker.js.map +1 -0
- package/es/color-picker/components/panel/alpha.d.ts +4 -0
- package/es/color-picker/components/panel/alpha.js +44 -0
- package/es/color-picker/components/panel/alpha.js.map +1 -0
- package/es/color-picker/components/panel/format/index.d.ts +10 -0
- package/es/color-picker/components/panel/format/index.js +128 -0
- package/es/color-picker/components/panel/format/index.js.map +1 -0
- package/es/color-picker/components/panel/format/inputs.d.ts +4 -0
- package/es/color-picker/components/panel/format/inputs.js +147 -0
- package/es/color-picker/components/panel/format/inputs.js.map +1 -0
- package/es/color-picker/components/panel/header.d.ts +13 -0
- package/es/color-picker/components/panel/header.js +60 -0
- package/es/color-picker/components/panel/header.js.map +1 -0
- package/es/color-picker/components/panel/hue.d.ts +4 -0
- package/es/color-picker/components/panel/hue.js +33 -0
- package/es/color-picker/components/panel/hue.js.map +1 -0
- package/es/color-picker/components/panel/index.d.ts +4 -0
- package/es/color-picker/components/panel/index.js +32 -0
- package/es/color-picker/components/panel/index.js.map +1 -0
- package/es/color-picker/components/panel/saturation.d.ts +4 -0
- package/es/color-picker/components/panel/saturation.js +101 -0
- package/es/color-picker/components/panel/saturation.js.map +1 -0
- package/es/color-picker/components/panel/slider.d.ts +11 -0
- package/es/color-picker/components/panel/slider.js +121 -0
- package/es/color-picker/components/panel/slider.js.map +1 -0
- package/es/color-picker/components/panel/swatches.d.ts +11 -0
- package/es/color-picker/components/panel/swatches.js +100 -0
- package/es/color-picker/components/panel/swatches.js.map +1 -0
- package/es/color-picker/components/trigger.d.ts +9 -0
- package/es/color-picker/components/trigger.js +73 -0
- package/es/color-picker/components/trigger.js.map +1 -0
- package/es/color-picker/defaultProps.d.ts +2 -0
- package/es/color-picker/helpers.d.ts +5 -0
- package/es/color-picker/hooks/useClassNames.d.ts +2 -0
- package/es/color-picker/hooks/useStyles.d.ts +14 -0
- package/es/color-picker/index.d.ts +6 -0
- package/es/color-picker/index.js +62 -0
- package/es/color-picker/index.js.map +1 -0
- package/es/color-picker/style/index.css +597 -0
- package/es/color-picker/style/index.d.ts +1 -0
- package/es/color-picker/style/index.js +2 -0
- package/es/color-picker/style/index.js.map +1 -0
- package/es/color-picker/type.d.ts +135 -0
- package/es/color-picker/utils/color-picker/cmyk.d.ts +27 -0
- package/es/color-picker/utils/color-picker/color.d.ts +144 -0
- package/es/color-picker/utils/color-picker/constants.d.ts +30 -0
- package/es/color-picker/utils/color-picker/draggable.d.ts +23 -0
- package/es/color-picker/utils/color-picker/format.d.ts +64 -0
- package/es/color-picker/utils/color-picker/gradient.d.ts +22 -0
- package/es/color-picker/utils/color-picker/index.d.ts +7 -0
- package/es/color-picker/utils/color-picker/index.js +147 -0
- package/es/color-picker/utils/color-picker/index.js.map +1 -0
- package/es/color-picker/utils/color-picker/types.d.ts +28 -0
- package/es/common/Check.d.ts +22 -0
- package/es/common/Check.js +4 -3
- package/es/common/Check.js.map +1 -1
- package/es/common/FakeArrow.d.ts +9 -0
- package/es/common/FakeArrow.js +3 -2
- package/es/common/FakeArrow.js.map +1 -1
- package/es/common/PluginContainer.d.ts +9 -0
- package/es/common/PluginContainer.js +2 -1
- package/es/common/PluginContainer.js.map +1 -1
- package/es/common/Portal.d.ts +16 -0
- package/es/common/Portal.js +6 -3
- package/es/common/Portal.js.map +1 -1
- package/es/common/observe.d.ts +1 -0
- package/es/common.d.ts +81 -0
- package/es/config-provider/ConfigContext.d.ts +13 -0
- package/es/config-provider/ConfigContext.js +5 -16
- package/es/config-provider/ConfigContext.js.map +1 -1
- package/es/config-provider/ConfigProvider.d.ts +25 -0
- package/es/config-provider/ConfigProvider.js +2 -1
- package/es/config-provider/ConfigProvider.js.map +1 -1
- package/es/config-provider/index.d.ts +7 -0
- package/es/config-provider/index.js +2 -1
- package/es/config-provider/index.js.map +1 -1
- package/es/config-provider/type.d.ts +1029 -0
- package/es/dialog/Dialog.d.ts +8 -0
- package/es/dialog/Dialog.js +12 -149
- package/es/dialog/Dialog.js.map +1 -1
- package/es/dialog/DialogCard.d.ts +8 -0
- package/es/dialog/DialogCard.js +9 -7
- package/es/dialog/DialogCard.js.map +1 -1
- package/es/dialog/defaultProps.d.ts +6 -0
- package/es/dialog/hooks/useDialogDrag.d.ts +7 -0
- package/es/dialog/hooks/useDialogEsc.d.ts +3 -0
- package/es/dialog/hooks/useDialogPosition.d.ts +2 -0
- package/es/dialog/hooks/useLockStyle.d.ts +2 -0
- package/es/dialog/index.d.ts +8 -0
- package/es/dialog/index.js +12 -8
- package/es/dialog/index.js.map +1 -1
- package/es/dialog/plugin.d.ts +6 -0
- package/es/dialog/plugin.js +15 -10
- package/es/dialog/plugin.js.map +1 -1
- package/es/dialog/style/css.d.ts +1 -0
- package/es/dialog/style/index.d.ts +1 -0
- package/es/dialog/type.d.ts +227 -0
- package/es/dialog/utils.d.ts +1 -0
- package/es/drawer/Drawer.d.ts +11 -0
- package/es/drawer/Drawer.js +458 -0
- package/es/drawer/Drawer.js.map +1 -0
- package/es/drawer/defaultProps.d.ts +2 -0
- package/es/drawer/hooks/useDrag.d.ts +8 -0
- package/es/drawer/hooks/useLockStyle.d.ts +1 -0
- package/es/drawer/index.d.ts +4 -0
- package/es/drawer/index.js +39 -0
- package/es/drawer/index.js.map +1 -0
- package/es/drawer/style/css.d.ts +1 -0
- package/es/drawer/style/css.js +1 -0
- package/es/drawer/style/index.css +231 -0
- package/es/drawer/style/index.d.ts +1 -0
- package/es/drawer/style/index.js +2 -0
- package/es/drawer/style/index.js.map +1 -0
- package/es/drawer/type.d.ts +199 -0
- package/es/drawer/utils/index.d.ts +23 -0
- package/es/drawer/utils/index.js +46 -0
- package/es/drawer/utils/index.js.map +1 -0
- package/es/fireworks/Fireworks.d.ts +7 -0
- package/es/fireworks/Fireworks.js +139 -0
- package/es/fireworks/Fireworks.js.map +1 -0
- package/es/fireworks/index.d.ts +5 -0
- package/es/fireworks/index.js +16 -0
- package/es/fireworks/index.js.map +1 -0
- package/es/fireworks/style/css.d.ts +1 -0
- package/es/fireworks/style/css.js +2 -0
- package/es/fireworks/style/index.css +121 -0
- package/es/fireworks/style/index.d.ts +1 -0
- package/es/fireworks/style/index.js +2 -0
- package/es/fireworks/style/index.js.map +1 -0
- package/es/fireworks/type.d.ts +69 -0
- package/es/form/Form.d.ts +8 -0
- package/es/form/Form.js +14 -10
- package/es/form/Form.js.map +1 -1
- package/es/form/FormContext.d.ts +59 -0
- package/es/form/FormItem.d.ts +23 -0
- package/es/form/FormItem.js +14 -10
- package/es/form/FormItem.js.map +1 -1
- package/es/form/FormList.d.ts +4 -0
- package/es/form/FormList.js +2 -1
- package/es/form/FormList.js.map +1 -1
- package/es/form/const.d.ts +6 -0
- package/es/form/defaultProps.d.ts +3 -0
- package/es/form/easing.d.ts +2 -0
- package/es/form/formModel.d.ts +37 -0
- package/es/form/hooks/interface.d.ts +16 -0
- package/es/form/hooks/useForm.d.ts +3 -0
- package/es/form/hooks/useFormItemInitialData.d.ts +9 -0
- package/es/form/hooks/useFormItemStyle.d.ts +10 -0
- package/es/form/hooks/useFormItemStyle.js +4 -3
- package/es/form/hooks/useFormItemStyle.js.map +1 -1
- package/es/form/hooks/useInstance.d.ts +16 -0
- package/es/form/hooks/useInstance.js +5 -4
- package/es/form/hooks/useInstance.js.map +1 -1
- package/es/form/hooks/useWatch.d.ts +3 -0
- package/es/form/index.d.ts +7 -0
- package/es/form/index.js +14 -10
- package/es/form/index.js.map +1 -1
- package/es/form/scroll.d.ts +39 -0
- package/es/form/style/css.d.ts +1 -0
- package/es/form/style/index.d.ts +1 -0
- package/es/form/type.d.ts +486 -0
- package/es/form/utils/index.d.ts +5 -0
- package/es/global-config/default-config.d.ts +84 -0
- package/es/global-config/locale/ar_KW.d.ts +239 -0
- package/es/global-config/locale/en_US.d.ts +263 -0
- package/es/global-config/locale/it_IT.d.ts +263 -0
- package/es/global-config/locale/ja_JP.d.ts +263 -0
- package/es/global-config/locale/ko_KR.d.ts +263 -0
- package/es/global-config/locale/ru_RU.d.ts +263 -0
- package/es/global-config/locale/zh_CN.d.ts +263 -0
- package/es/global-config/locale/zh_TW.d.ts +263 -0
- package/es/global-config/mobile/default-config.d.ts +7 -0
- package/es/global-config/mobile/locale/ar_KW.d.ts +98 -0
- package/es/global-config/mobile/locale/en_US.d.ts +99 -0
- package/es/global-config/mobile/locale/it_IT.d.ts +99 -0
- package/es/global-config/mobile/locale/ja_JP.d.ts +99 -0
- package/es/global-config/mobile/locale/ko_KR.d.ts +99 -0
- package/es/global-config/mobile/locale/ru_RU.d.ts +99 -0
- package/es/global-config/mobile/locale/zh_CN.d.ts +99 -0
- package/es/global-config/mobile/locale/zh_TW.d.ts +99 -0
- package/es/global-config/t.d.ts +25 -0
- package/es/hooks/useAttach.d.ts +10 -0
- package/es/hooks/useCommonClassName.d.ts +54 -0
- package/es/hooks/useConfig.d.ts +2 -0
- package/es/hooks/useControlled.d.ts +9 -0
- package/es/hooks/useDeepEffect.d.ts +7 -0
- package/es/hooks/useDefaultProps.d.ts +1 -0
- package/es/hooks/useDomCallback.d.ts +1 -0
- package/es/hooks/useDomRefCallback.d.ts +1 -0
- package/es/hooks/useDragSorter.d.ts +28 -0
- package/es/hooks/useEventCallback.d.ts +9 -0
- package/es/hooks/useGlobalConfig.d.ts +1 -0
- package/es/hooks/useGlobalIcon.d.ts +5 -0
- package/es/hooks/useLastest.d.ts +2 -0
- package/es/hooks/useLayoutEffect.d.ts +3 -0
- package/es/hooks/useMouseEvent.d.ts +25 -0
- package/es/hooks/useMutationObserver.d.ts +4 -0
- package/es/hooks/usePopper.d.ts +19 -0
- package/es/hooks/useResizeObserve.d.ts +1 -0
- package/es/hooks/useRipple.d.ts +0 -0
- package/es/hooks/useSetState.d.ts +7 -0
- package/es/hooks/useVirtualScroll.d.ts +30 -0
- package/es/hooks/useWindowSize.d.ts +6 -0
- package/es/index.d.ts +25 -0
- package/es/index.js +68 -14
- package/es/index.js.map +1 -1
- package/es/input/Input.d.ts +16 -0
- package/es/input/Input.js +5 -5
- package/es/input/Input.js.map +1 -1
- package/es/input/InputGroup.d.ts +10 -0
- package/es/input/defaultProps.d.ts +17 -0
- package/es/input/index.d.ts +6 -0
- package/es/input/index.js +5 -3
- package/es/input/index.js.map +1 -1
- package/es/input/style/css.d.ts +1 -0
- package/es/input/style/index.d.ts +1 -0
- package/es/input/type.d.ts +237 -0
- package/es/input-number/InputNumber.d.ts +17 -0
- package/es/input-number/InputNumber.js +139 -0
- package/es/input-number/InputNumber.js.map +1 -0
- package/es/input-number/defaultProps.d.ts +2 -0
- package/es/input-number/index.d.ts +5 -0
- package/es/input-number/index.js +43 -0
- package/es/input-number/index.js.map +1 -0
- package/es/input-number/style/css.d.ts +1 -0
- package/es/input-number/style/css.js +1 -0
- package/es/input-number/style/index.css +331 -0
- package/es/input-number/style/index.d.ts +1 -0
- package/es/input-number/style/index.js +2 -0
- package/es/input-number/style/index.js.map +1 -0
- package/es/input-number/type.d.ts +156 -0
- package/es/input-number/useInputNumber.d.ts +51 -0
- package/es/input-number/useInputNumber.js +809 -0
- package/es/input-number/useInputNumber.js.map +1 -0
- package/es/ip-input/IPInput.d.ts +5 -0
- package/es/ip-input/IPInput.js +16 -0
- package/es/ip-input/IPInput.js.map +1 -0
- package/es/ip-input/defaultProps.d.ts +2 -0
- package/es/ip-input/index.d.ts +3 -0
- package/es/ip-input/index.js +16 -0
- package/es/ip-input/index.js.map +1 -0
- package/es/ip-input/style/index.css +323 -0
- package/es/ip-input/style/index.d.ts +1 -0
- package/es/ip-input/style/index.js +2 -0
- package/es/ip-input/style/index.js.map +1 -0
- package/es/ip-input/type.d.ts +113 -0
- package/es/ip-input/utils.d.ts +35 -0
- package/es/layout/Aside.d.ts +11 -0
- package/es/layout/Aside.js +41 -0
- package/es/layout/Aside.js.map +1 -0
- package/es/layout/Layout.d.ts +26 -0
- package/es/layout/Layout.js +106 -0
- package/es/layout/Layout.js.map +1 -0
- package/es/layout/defaultProps.d.ts +5 -0
- package/es/layout/index.d.ts +10 -0
- package/es/layout/index.js +19 -0
- package/es/layout/index.js.map +1 -0
- package/es/layout/style/index.css +56 -0
- package/es/layout/style/index.d.ts +1 -0
- package/es/layout/style/index.js +2 -0
- package/es/layout/style/index.js.map +1 -0
- package/es/layout/type.d.ts +38 -0
- package/es/list/List.d.ts +17 -0
- package/es/list/List.js +217 -0
- package/es/list/List.js.map +1 -0
- package/es/list/ListItem.d.ts +15 -0
- package/es/list/ListItem.js +31 -0
- package/es/list/ListItem.js.map +1 -0
- package/es/list/ListItemMeta.d.ts +10 -0
- package/es/list/ListItemMeta.js +45 -0
- package/es/list/ListItemMeta.js.map +1 -0
- package/es/list/defaultProps.d.ts +7 -0
- package/es/list/hooks/useListVirtualScroll.d.ts +24 -0
- package/es/list/index.d.ts +10 -0
- package/es/list/index.js +40 -0
- package/es/list/index.js.map +1 -0
- package/es/list/style/css.d.ts +1 -0
- package/es/list/style/css.js +1 -0
- package/es/list/style/index.css +172 -0
- package/es/list/style/index.d.ts +1 -0
- package/es/list/style/index.js +2 -0
- package/es/list/style/index.js.map +1 -0
- package/es/list/type.d.ts +92 -0
- package/es/loading/Gradient.d.ts +6 -0
- package/es/loading/Gradient.js +4 -3
- package/es/loading/Gradient.js.map +1 -1
- package/es/loading/Loading.d.ts +7 -0
- package/es/loading/Loading.js +7 -5
- package/es/loading/Loading.js.map +1 -1
- package/es/loading/circleAdapter.d.ts +1 -0
- package/es/loading/defaultProps.d.ts +2 -0
- package/es/loading/index.d.ts +5 -0
- package/es/loading/index.js +7 -5
- package/es/loading/index.js.map +1 -1
- package/es/loading/style/css.d.ts +1 -0
- package/es/loading/style/index.d.ts +1 -0
- package/es/loading/type.d.ts +68 -0
- package/es/loading/utils/setStyle.d.ts +7 -0
- package/es/locale/LocalReceiver.d.ts +6 -0
- package/es/locale/ar_KW.d.ts +3 -0
- package/es/locale/en_US.d.ts +3 -0
- package/es/locale/it_IT.d.ts +3 -0
- package/es/locale/ja_JP.d.ts +3 -0
- package/es/locale/ko_KR.d.ts +3 -0
- package/es/locale/ru_RU.d.ts +3 -0
- package/es/locale/zh_CN.d.ts +3 -0
- package/es/locale/zh_TW.d.ts +3 -0
- package/es/myform/index.d.ts +0 -0
- package/es/notification/Notify.d.ts +11 -0
- package/es/notification/NotifyContainer.d.ts +13 -0
- package/es/notification/NotifyContainer.js +3 -2
- package/es/notification/NotifyContainer.js.map +1 -1
- package/es/notification/NotifyContext.d.ts +23 -0
- package/es/notification/NotifyContext.js +3 -2
- package/es/notification/NotifyContext.js.map +1 -1
- package/es/notification/NotifyItem.d.ts +4 -0
- package/es/notification/NotifyItem.js +3 -2
- package/es/notification/NotifyItem.js.map +1 -1
- package/es/notification/index.d.ts +3 -0
- package/es/notification/index.js +3 -2
- package/es/notification/index.js.map +1 -1
- package/es/notification/style/css.d.ts +1 -0
- package/es/notification/style/index.d.ts +1 -0
- package/es/notification/type.d.ts +22 -0
- package/es/popup/Popup.d.ts +21 -0
- package/es/popup/Popup.js +36 -100
- package/es/popup/Popup.js.map +1 -1
- package/es/popup/defaultProps.d.ts +5 -0
- package/es/popup/hooks/useTrigger.d.ts +20 -0
- package/es/popup/index.d.ts +5 -0
- package/es/popup/index.js +8 -4
- package/es/popup/index.js.map +1 -1
- package/es/popup/style/css.d.ts +1 -0
- package/es/popup/style/index.d.ts +1 -0
- package/es/popup/type.d.ts +109 -0
- package/es/portal/Portal.d.ts +16 -0
- package/es/portal/Portal.js +2 -1
- package/es/portal/Portal.js.map +1 -1
- package/es/portal/index.d.ts +1 -0
- package/es/portal/index.js +2 -1
- package/es/portal/index.js.map +1 -1
- package/es/radio/Radio.d.ts +8 -0
- package/es/radio/Radio.js +22 -0
- package/es/radio/Radio.js.map +1 -0
- package/es/radio/RadioGroup.d.ts +14 -0
- package/es/radio/RadioGroup.js +22 -0
- package/es/radio/RadioGroup.js.map +1 -0
- package/es/radio/defaultProps.d.ts +3 -0
- package/es/radio/index.d.ts +10 -0
- package/es/radio/index.js +28 -0
- package/es/radio/index.js.map +1 -0
- package/es/radio/style/css.d.ts +0 -0
- package/es/radio/style/css.js +0 -0
- package/es/radio/style/index.css +333 -0
- package/es/radio/style/index.d.ts +1 -0
- package/es/radio/style/index.js +2 -0
- package/es/radio/style/index.js.map +1 -0
- package/es/radio/type.d.ts +117 -0
- package/es/radio/useKeyboard.d.ts +4 -0
- package/es/select/Option.d.ts +24 -0
- package/es/select/Option.js +3 -2
- package/es/select/Option.js.map +1 -1
- package/es/select/OptionGroup.d.ts +7 -0
- package/es/select/OptionGroup.js +4 -3
- package/es/select/OptionGroup.js.map +1 -1
- package/es/select/PopupContent.d.ts +24 -0
- package/es/select/PopupContent.js +6 -4
- package/es/select/PopupContent.js.map +1 -1
- package/es/select/Select.d.ts +13 -0
- package/es/select/Select.js +21 -12
- package/es/select/Select.js.map +1 -1
- package/es/select/defaultProps.d.ts +4 -0
- package/es/select/hooks/useOptions.d.ts +16 -0
- package/es/select/hooks/usePanelVirtualScroll.d.ts +24 -0
- package/es/select/index.d.ts +8 -0
- package/es/select/index.js +14 -8
- package/es/select/index.js.map +1 -1
- package/es/select/style/css.d.ts +1 -0
- package/es/select/style/index.d.ts +1 -0
- package/es/select/type.d.ts +344 -0
- package/es/select/utils/helper.d.ts +18 -0
- package/es/select-input/SelectInput.d.ts +11 -0
- package/es/select-input/SelectInput.js +10 -5
- package/es/select-input/SelectInput.js.map +1 -1
- package/es/select-input/defaultProps.d.ts +2 -0
- package/es/select-input/hook/useMultiple.d.ts +23 -0
- package/es/select-input/hook/useMultiple.js +7 -4
- package/es/select-input/hook/useMultiple.js.map +1 -1
- package/es/select-input/hook/useOverlayInnerStyle.d.ts +11 -0
- package/es/select-input/hook/useSingle.d.ts +16 -0
- package/es/select-input/hook/useSingle.js +5 -3
- package/es/select-input/hook/useSingle.js.map +1 -1
- package/es/select-input/index.d.ts +5 -0
- package/es/select-input/index.js +10 -5
- package/es/select-input/index.js.map +1 -1
- package/es/select-input/interface.d.ts +17 -0
- package/es/select-input/style/css.d.ts +1 -0
- package/es/select-input/style/index.d.ts +1 -0
- package/es/select-input/type.d.ts +243 -0
- package/es/slider/Slider.d.ts +7 -0
- package/es/slider/Slider.js +668 -0
- package/es/slider/Slider.js.map +1 -0
- package/es/slider/SliderHandleButton.d.ts +11 -0
- package/es/slider/SliderHandleButton.js +48 -0
- package/es/slider/SliderHandleButton.js.map +1 -0
- package/es/slider/defaultProps.d.ts +5 -0
- package/es/slider/index.d.ts +5 -0
- package/es/slider/index.js +46 -0
- package/es/slider/index.js.map +1 -0
- package/es/slider/style/css.d.ts +1 -0
- package/es/slider/style/css.js +1 -0
- package/es/slider/style/index.css +252 -0
- package/es/slider/style/index.d.ts +1 -0
- package/es/slider/style/index.js +2 -0
- package/es/slider/style/index.js.map +1 -0
- package/es/slider/type.d.ts +78 -0
- package/es/space/defaultProps.d.ts +0 -0
- package/es/space/index.d.ts +0 -0
- package/es/space/type.d.ts +0 -0
- package/es/style/index.css +24 -34
- package/es/style/index.d.ts +1 -0
- package/es/switch/Switch.d.ts +9 -0
- package/es/switch/Switch.js +9 -47
- package/es/switch/Switch.js.map +1 -1
- package/es/switch/defaultProps.d.ts +2 -0
- package/es/switch/index.d.ts +4 -0
- package/es/switch/index.js +8 -5
- package/es/switch/index.js.map +1 -1
- package/es/switch/style/css.d.ts +1 -0
- package/es/switch/style/index.d.ts +1 -0
- package/es/switch/type.d.ts +48 -0
- package/es/tab/TabBar.d.ts +9 -0
- package/es/tab/TabBar.js +109 -0
- package/es/tab/TabBar.js.map +1 -0
- package/es/tab/TabNav.d.ts +10 -0
- package/es/tab/TabNav.js +123 -0
- package/es/tab/TabNav.js.map +1 -0
- package/es/tab/TabNavItem.d.ts +15 -0
- package/es/tab/TabNavItem.js +65 -0
- package/es/tab/TabNavItem.js.map +1 -0
- package/es/tab/TabPanel.d.ts +9 -0
- package/es/tab/TabPanel.js +11 -0
- package/es/tab/TabPanel.js.map +1 -0
- package/es/tab/Tabs.d.ts +10 -0
- package/es/tab/Tabs.js +95 -0
- package/es/tab/Tabs.js.map +1 -0
- package/es/tab/defaultProps.d.ts +3 -0
- package/es/tab/index.d.ts +8 -0
- package/es/tab/index.js +31 -0
- package/es/tab/index.js.map +1 -0
- package/es/tab/style/index.css +159 -0
- package/es/tab/style/index.d.ts +1 -0
- package/es/tab/style/index.js +2 -0
- package/es/tab/style/index.js.map +1 -0
- package/es/tab/type.d.ts +130 -0
- package/es/tab/useTabClass.d.ts +8 -0
- package/es/table/Cell.d.ts +18 -0
- package/es/table/Cell.js +73 -0
- package/es/table/Cell.js.map +1 -0
- package/es/table/TBody.d.ts +28 -0
- package/es/table/TBody.js +70 -0
- package/es/table/TBody.js.map +1 -0
- package/es/table/THead.d.ts +10 -0
- package/es/table/THead.js +56 -0
- package/es/table/THead.js.map +1 -0
- package/es/table/TR.d.ts +28 -0
- package/es/table/TR.js +76 -0
- package/es/table/TR.js.map +1 -0
- package/es/table/Table.d.ts +6 -0
- package/es/table/Table.js +98 -0
- package/es/table/Table.js.map +1 -0
- package/es/table/defaultProps.d.ts +2 -0
- package/es/table/hooks/index.d.ts +4 -0
- package/es/table/hooks/index.js +98 -0
- package/es/table/hooks/index.js.map +1 -0
- package/es/table/hooks/useTableClassName.d.ts +26 -0
- package/es/table/hooks/useTableStyle.d.ts +11 -0
- package/es/table/index.d.ts +5 -0
- package/es/table/index.js +22 -0
- package/es/table/index.js.map +1 -0
- package/es/table/style/css.d.ts +1 -0
- package/es/table/style/css.js +1 -0
- package/es/table/style/index.css +139 -0
- package/es/table/style/index.d.ts +1 -0
- package/es/table/style/index.js +2 -0
- package/es/table/style/index.js.map +1 -0
- package/es/table/type.d.ts +195 -0
- package/es/tag/Tag.d.ts +14 -0
- package/es/tag/Tag.js +5 -1182
- package/es/tag/Tag.js.map +1 -1
- package/es/tag/defaultProps.d.ts +7 -0
- package/es/tag/index.d.ts +4 -0
- package/es/tag/index.js +5 -3
- package/es/tag/index.js.map +1 -1
- package/es/tag/style/css.d.ts +1 -0
- package/es/tag/style/index.d.ts +1 -0
- package/es/tag/type.d.ts +169 -0
- package/es/tag-input/TagInput.d.ts +9 -0
- package/es/tag-input/TagInput.js +7 -4
- package/es/tag-input/TagInput.js.map +1 -1
- package/es/tag-input/defaultProps.d.ts +2 -0
- package/es/tag-input/hooks/useHover.d.ts +17 -0
- package/es/tag-input/hooks/useTagList.d.ts +30 -0
- package/es/tag-input/hooks/useTagList.js +5 -3
- package/es/tag-input/hooks/useTagList.js.map +1 -1
- package/es/tag-input/hooks/useTagScroll.d.ts +25 -0
- package/es/tag-input/index.d.ts +5 -0
- package/es/tag-input/index.js +7 -4
- package/es/tag-input/index.js.map +1 -1
- package/es/tag-input/style/css.d.ts +1 -0
- package/es/tag-input/style/index.d.ts +1 -0
- package/es/tag-input/type.d.ts +235 -0
- package/es/tag-input/useTagList.d.ts +30 -0
- package/es/tag-input/useTagList.js +5 -3
- package/es/tag-input/useTagList.js.map +1 -1
- package/es/utils/composeRefs.d.ts +2 -0
- package/es/utils/dom.d.ts +7 -0
- package/es/utils/forwardRefWithStatics.d.ts +2 -0
- package/es/utils/getScrollbarWidth.d.ts +6 -0
- package/es/utils/helper.d.ts +46 -0
- package/es/utils/input-number/large-number.d.ts +85 -0
- package/es/utils/input-number/number.d.ts +81 -0
- package/es/utils/isFragment.d.ts +4 -0
- package/es/utils/listener.d.ts +4 -0
- package/es/utils/log/index.d.ts +2 -0
- package/es/utils/log/index.js +27 -0
- package/es/utils/log/index.js.map +1 -0
- package/es/utils/log/log.d.ts +3 -0
- package/es/utils/log/types.d.ts +8 -0
- package/es/utils/noop.d.ts +2 -0
- package/es/utils/number.d.ts +7 -0
- package/es/utils/parentTNode.d.ts +10 -0
- package/es/utils/parseTNode.d.ts +10 -0
- package/es/utils/react-render.d.ts +16 -0
- package/es/utils/ref.d.ts +1 -0
- package/es/utils/refs.d.ts +13 -0
- package/es/utils/scroll.d.ts +3 -0
- package/es/utils/style.d.ts +4 -0
- package/es/utils/transition.d.ts +20 -0
- package/package.json +59 -59
- package/LICENSE +0 -21
- package/es/_chunks/dep-0QH2Ee4R.js.map +0 -1
- package/es/_chunks/dep-BH5n5r1M.js.map +0 -1
- package/es/_chunks/dep-D7LanWes.js.map +0 -1
- package/es/_chunks/dep-DZ_0EvBk.js.map +0 -1
- package/es/_chunks/dep-Dk2xX8lh.js.map +0 -1
- package/es/_chunks/dep-EcrDKDlu.js.map +0 -1
- package/es/_chunks/dep-bWaVq_y3.js.map +0 -1
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { MouseEvent } from "react";
|
|
2
|
+
import { StyledProps } from "../common";
|
|
3
|
+
import { InputProps } from "../input";
|
|
4
|
+
import { PopupProps } from "../popup";
|
|
5
|
+
import { SelectInputProps } from "../select-input";
|
|
6
|
+
import type { Color } from "./utils/color-picker/color";
|
|
7
|
+
export interface TdColorPickerProps {
|
|
8
|
+
/**
|
|
9
|
+
* 无边框模式
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
borderless?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* 是否可清空
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
clearable?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* 是否禁用组件
|
|
20
|
+
*/
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 是否开启透明通道
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
enableAlpha?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* 是否允许开启通过点击渐变轴增加渐变梯度,默认开启,关闭时只会存在起始和结束两个颜色
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
31
|
+
enableMultipleGradient?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* 格式化色值。`enableAlpha` 为真时,`HEX8/RGBA/HSLA/HSVA` 有效
|
|
34
|
+
* @default RGB
|
|
35
|
+
*/
|
|
36
|
+
format?: "HEX" | "HEX8" | "RGB" | "RGBA" | "HSL" | "HSLA" | "HSV" | "HSVA" | "CMYK" | "CSS";
|
|
37
|
+
/**
|
|
38
|
+
* 透传 Input 输入框组件全部属性
|
|
39
|
+
*/
|
|
40
|
+
inputProps?: InputProps;
|
|
41
|
+
/**
|
|
42
|
+
* 透传 Popup 组件全部属性,如 `placement` `overlayStyle` `overlayClassName` `trigger`等
|
|
43
|
+
*/
|
|
44
|
+
popupProps?: PopupProps;
|
|
45
|
+
/**
|
|
46
|
+
* 最近使用的颜色。值为 [] 表示以组件内部的“最近使用颜色”为准,值长度大于 0 则以该值为准显示“最近使用颜色”。值为 false 或 null 则完全不显示“最近使用颜色”
|
|
47
|
+
* @default []
|
|
48
|
+
*/
|
|
49
|
+
recentColors?: Array<string> | boolean | null;
|
|
50
|
+
/**
|
|
51
|
+
* 最近使用的颜色。值为 [] 表示以组件内部的“最近使用颜色”为准,值长度大于 0 则以该值为准显示“最近使用颜色”。值为 false 或 null 则完全不显示“最近使用颜色”,非受控属性
|
|
52
|
+
* @default []
|
|
53
|
+
*/
|
|
54
|
+
defaultRecentColors?: Array<string> | boolean | null;
|
|
55
|
+
/**
|
|
56
|
+
* 透传 SelectInputProps 筛选器输入框组件全部属性
|
|
57
|
+
*/
|
|
58
|
+
selectInputProps?: SelectInputProps;
|
|
59
|
+
/**
|
|
60
|
+
* 是否展示颜色选择条右侧的颜色预览区域
|
|
61
|
+
* @default true
|
|
62
|
+
*/
|
|
63
|
+
showPrimaryColorPreview?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* 系统预设的颜色样例,值为 `null` 或 `[]` 则不显示系统色,值为 `undefined` 会显示组件内置的系统默认色
|
|
66
|
+
*/
|
|
67
|
+
swatchColors?: Array<string> | null | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* 色值
|
|
70
|
+
* @default ''
|
|
71
|
+
*/
|
|
72
|
+
value?: string;
|
|
73
|
+
/**
|
|
74
|
+
* 色值,非受控属性
|
|
75
|
+
* @default ''
|
|
76
|
+
*/
|
|
77
|
+
defaultValue?: string;
|
|
78
|
+
/**
|
|
79
|
+
* 选中的色值发生变化时触发,第一个参数 `value` 表示新色值,`context.color` 表示当前调色板控制器的色值,`context.trigger` 表示触发颜色变化的来源
|
|
80
|
+
*/
|
|
81
|
+
onChange?: (value: string, context: {
|
|
82
|
+
color: ColorObject;
|
|
83
|
+
trigger: ColorPickerChangeTrigger;
|
|
84
|
+
}) => void;
|
|
85
|
+
/**
|
|
86
|
+
* 清空按钮点击时触发
|
|
87
|
+
*/
|
|
88
|
+
onClear?: (context: {
|
|
89
|
+
e: MouseEvent<SVGElement>;
|
|
90
|
+
}) => void;
|
|
91
|
+
/**
|
|
92
|
+
* 调色板控制器的值变化时触发,`context.color` 指调色板控制器的值
|
|
93
|
+
*/
|
|
94
|
+
onPaletteBarChange?: (context: {
|
|
95
|
+
color: ColorObject;
|
|
96
|
+
}) => void;
|
|
97
|
+
/**
|
|
98
|
+
* 最近使用颜色发生变化时触发
|
|
99
|
+
*/
|
|
100
|
+
onRecentColorsChange?: (value: Array<string>) => void;
|
|
101
|
+
}
|
|
102
|
+
export type ColorPickerChangeTrigger = "palette-saturation-brightness" | "palette-saturation" | "palette-brightness" | "palette-hue-bar" | "palette-alpha-bar" | "input" | "preset" | "recent";
|
|
103
|
+
export interface ColorObject {
|
|
104
|
+
alpha: number;
|
|
105
|
+
css: string;
|
|
106
|
+
hex: string;
|
|
107
|
+
hex8: string;
|
|
108
|
+
hsl: string;
|
|
109
|
+
hsla: string;
|
|
110
|
+
hsv: string;
|
|
111
|
+
hsva: string;
|
|
112
|
+
rgb: string;
|
|
113
|
+
rgba: string;
|
|
114
|
+
saturation: number;
|
|
115
|
+
value: number;
|
|
116
|
+
isGradient: boolean;
|
|
117
|
+
linearGradient?: string;
|
|
118
|
+
}
|
|
119
|
+
export interface ColorPickerProps extends TdColorPickerProps, StyledProps {
|
|
120
|
+
}
|
|
121
|
+
export interface TdColorContext {
|
|
122
|
+
color: ColorObject;
|
|
123
|
+
trigger: ColorPickerChangeTrigger;
|
|
124
|
+
}
|
|
125
|
+
export type TdColorSaturationData = {
|
|
126
|
+
saturation: number;
|
|
127
|
+
value: number;
|
|
128
|
+
};
|
|
129
|
+
export interface TdColorBaseProps {
|
|
130
|
+
disabled: boolean;
|
|
131
|
+
color: Color;
|
|
132
|
+
onChange?: (options?: any) => void;
|
|
133
|
+
baseClassName: string;
|
|
134
|
+
}
|
|
135
|
+
export type TdColorModes = keyof typeof import("./utils/color-picker/constants").COLOR_MODES;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* rgb 转 cmyk
|
|
3
|
+
* @param red
|
|
4
|
+
* @param green
|
|
5
|
+
* @param blue
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare const rgb2cmyk: (red: number, green: number, blue: number) => number[];
|
|
9
|
+
/**
|
|
10
|
+
* cmyk 转 rgb
|
|
11
|
+
* @param cyan
|
|
12
|
+
* @param magenta
|
|
13
|
+
* @param yellow
|
|
14
|
+
* @param black
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
export declare const cmyk2rgb: (cyan: number, magenta: number, yellow: number, black: number) => {
|
|
18
|
+
r: number;
|
|
19
|
+
g: number;
|
|
20
|
+
b: number;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* 输入色转rgb
|
|
24
|
+
* @param input
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
export declare const cmykInputToColor: (input: string) => string;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import tinyColor from "tinycolor2";
|
|
2
|
+
import { GradientColorPoint, GradientColors } from "./gradient";
|
|
3
|
+
import type { ColorFormat } from "./types";
|
|
4
|
+
export interface ColorObject {
|
|
5
|
+
alpha: number;
|
|
6
|
+
css: string;
|
|
7
|
+
hex: string;
|
|
8
|
+
hex8: string;
|
|
9
|
+
hsl: string;
|
|
10
|
+
hsla: string;
|
|
11
|
+
hsv: string;
|
|
12
|
+
hsva: string;
|
|
13
|
+
rgb: string;
|
|
14
|
+
rgba: string;
|
|
15
|
+
saturation: number;
|
|
16
|
+
value: number;
|
|
17
|
+
isGradient: boolean;
|
|
18
|
+
linearGradient?: string;
|
|
19
|
+
}
|
|
20
|
+
interface ColorStates {
|
|
21
|
+
s: number;
|
|
22
|
+
v: number;
|
|
23
|
+
h: number;
|
|
24
|
+
a: number;
|
|
25
|
+
}
|
|
26
|
+
interface GradientStates {
|
|
27
|
+
colors: GradientColorPoint[];
|
|
28
|
+
degree: number;
|
|
29
|
+
selectedId: string;
|
|
30
|
+
css?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 将渐变对象转换成字符串
|
|
34
|
+
*/
|
|
35
|
+
export declare const gradientColors2string: (object: GradientColors) => string;
|
|
36
|
+
/**
|
|
37
|
+
* 去除颜色的透明度
|
|
38
|
+
*/
|
|
39
|
+
export declare const getColorWithoutAlpha: (color: string) => string;
|
|
40
|
+
export declare const genId: () => string;
|
|
41
|
+
/**
|
|
42
|
+
* 生成一个渐变颜色
|
|
43
|
+
* @param left
|
|
44
|
+
* @param color
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
export declare const genGradientPoint: (left: number, color: string, id?: string) => GradientColorPoint;
|
|
48
|
+
export declare class Color {
|
|
49
|
+
states: ColorStates;
|
|
50
|
+
originColor: string;
|
|
51
|
+
isGradient: boolean;
|
|
52
|
+
gradientStates: GradientStates;
|
|
53
|
+
constructor(input: string);
|
|
54
|
+
update(input: string): void;
|
|
55
|
+
get saturation(): number;
|
|
56
|
+
set saturation(value: number);
|
|
57
|
+
get value(): number;
|
|
58
|
+
set value(value: number);
|
|
59
|
+
get hue(): number;
|
|
60
|
+
set hue(value: number);
|
|
61
|
+
get alpha(): number;
|
|
62
|
+
set alpha(value: number);
|
|
63
|
+
get rgb(): string;
|
|
64
|
+
get rgba(): string;
|
|
65
|
+
get hsv(): string;
|
|
66
|
+
get hsva(): string;
|
|
67
|
+
get hsl(): string;
|
|
68
|
+
get hsla(): string;
|
|
69
|
+
get hex(): string;
|
|
70
|
+
get hex8(): string;
|
|
71
|
+
get cmyk(): string;
|
|
72
|
+
get css(): string;
|
|
73
|
+
get linearGradient(): string;
|
|
74
|
+
get gradientColors(): GradientColorPoint[];
|
|
75
|
+
set gradientColors(colors: GradientColorPoint[]);
|
|
76
|
+
get gradientSelectedId(): string;
|
|
77
|
+
set gradientSelectedId(id: string);
|
|
78
|
+
get gradientDegree(): number;
|
|
79
|
+
set gradientDegree(degree: number);
|
|
80
|
+
get gradientSelectedPoint(): GradientColorPoint;
|
|
81
|
+
getFormatsColorMap(): {
|
|
82
|
+
HEX: string;
|
|
83
|
+
CMYK: string;
|
|
84
|
+
RGB: string;
|
|
85
|
+
RGBA: string;
|
|
86
|
+
HSL: string;
|
|
87
|
+
HSLA: string;
|
|
88
|
+
HSV: string;
|
|
89
|
+
HSVA: string;
|
|
90
|
+
CSS: string;
|
|
91
|
+
HEX8: string;
|
|
92
|
+
};
|
|
93
|
+
getFormattedColor(format: ColorFormat, enableAlpha: boolean): string;
|
|
94
|
+
updateCurrentGradientColor(): false | this;
|
|
95
|
+
updateStates(input: string): void;
|
|
96
|
+
getRgba(): {
|
|
97
|
+
r: number;
|
|
98
|
+
g: number;
|
|
99
|
+
b: number;
|
|
100
|
+
a: number;
|
|
101
|
+
};
|
|
102
|
+
getCmyk(): {
|
|
103
|
+
c: number;
|
|
104
|
+
m: number;
|
|
105
|
+
y: number;
|
|
106
|
+
k: number;
|
|
107
|
+
};
|
|
108
|
+
getHsva(): tinyColor.ColorFormats.HSVA;
|
|
109
|
+
getHsla(): tinyColor.ColorFormats.HSLA;
|
|
110
|
+
/**
|
|
111
|
+
* 判断输入色是否与当前色相同
|
|
112
|
+
*/
|
|
113
|
+
equals(color: string): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* 校验输入色是否是一个有效颜色
|
|
116
|
+
* @param color
|
|
117
|
+
* @returns
|
|
118
|
+
*/
|
|
119
|
+
static isValid(color: string): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* 对象转颜色字符串
|
|
122
|
+
*/
|
|
123
|
+
static object2color(object: any, format: ColorFormat): string;
|
|
124
|
+
/**
|
|
125
|
+
* 是否是渐变色
|
|
126
|
+
* @param input
|
|
127
|
+
* @returns
|
|
128
|
+
*/
|
|
129
|
+
static isGradientColor: (input: string) => boolean;
|
|
130
|
+
/**
|
|
131
|
+
* 比较两个颜色是否相同
|
|
132
|
+
* @param color1
|
|
133
|
+
* @param color2
|
|
134
|
+
* @returns
|
|
135
|
+
*/
|
|
136
|
+
static compare: (color1: string, color2: string) => boolean;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* 获取对外输出的color对象
|
|
140
|
+
* @param color
|
|
141
|
+
* @returns
|
|
142
|
+
*/
|
|
143
|
+
export declare const getColorObject: (color: Color) => ColorObject | null;
|
|
144
|
+
export default Color;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { BasicColorFormat, ColorInputProp } from "./types";
|
|
2
|
+
export declare const TD_COLOR_USED_COLORS_MAX_SIZE = 100;
|
|
3
|
+
export declare const COLOR_MODES: {
|
|
4
|
+
monochrome: string;
|
|
5
|
+
"linear-gradient": string;
|
|
6
|
+
};
|
|
7
|
+
export declare const DEFAULT_COLOR = "#001F97";
|
|
8
|
+
export declare const DEFAULT_LINEAR_GRADIENT = "linear-gradient(90deg, rgba(241,29,0,1) 0%, rgba(73,106,220,1) 100%);";
|
|
9
|
+
export declare const DEFAULT_SYSTEM_SWATCH_COLORS: string[];
|
|
10
|
+
/**
|
|
11
|
+
* 非透明色格式化类型
|
|
12
|
+
*/
|
|
13
|
+
export declare const FORMATS: readonly ["HEX", "RGB", "HSL", "HSV", "CMYK", "CSS"];
|
|
14
|
+
/**
|
|
15
|
+
* 透明色格式化类型映射
|
|
16
|
+
*/
|
|
17
|
+
export declare const ALPHA_FORMAT_MAP: {
|
|
18
|
+
readonly HEX: "HEX8";
|
|
19
|
+
readonly RGB: "RGBA";
|
|
20
|
+
readonly HSL: "HSLA";
|
|
21
|
+
readonly HSV: "HSVA";
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* 不同格式对应的输入框
|
|
25
|
+
*/
|
|
26
|
+
export declare const COLOR_FORMAT_INPUTS: Record<BasicColorFormat, ColorInputProp[]>;
|
|
27
|
+
export declare const SATURATION_PANEL_DEFAULT_WIDTH = 230;
|
|
28
|
+
export declare const SATURATION_PANEL_DEFAULT_HEIGHT = 168;
|
|
29
|
+
export declare const SLIDER_DEFAULT_WIDTH = 186;
|
|
30
|
+
export declare const GRADIENT_SLIDER_DEFAULT_WIDTH = 176;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface Coordinate {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
}
|
|
5
|
+
export type DraggableEvent = MouseEvent;
|
|
6
|
+
interface DraggableCallback {
|
|
7
|
+
(coordinate: Coordinate, event?: DraggableEvent): void;
|
|
8
|
+
}
|
|
9
|
+
export interface DraggableProps {
|
|
10
|
+
start?: DraggableCallback;
|
|
11
|
+
drag?: DraggableCallback;
|
|
12
|
+
end?: DraggableCallback;
|
|
13
|
+
}
|
|
14
|
+
export declare class Draggable {
|
|
15
|
+
#private;
|
|
16
|
+
private dragging;
|
|
17
|
+
private $el;
|
|
18
|
+
private props;
|
|
19
|
+
private handles;
|
|
20
|
+
constructor(el: HTMLElement, options?: DraggableProps);
|
|
21
|
+
destroy(): void;
|
|
22
|
+
}
|
|
23
|
+
export default Draggable;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import Color from './color';
|
|
2
|
+
import type { ColorFormat } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* 兜底处理用户传入的格式,例如:
|
|
5
|
+
* - 传入 `RGB`, 但 `enableAlpha` ,则返回 `RGBA`
|
|
6
|
+
*/
|
|
7
|
+
export declare const initColorFormat: (format: ColorFormat, enableAlpha: boolean) => ColorFormat;
|
|
8
|
+
/**
|
|
9
|
+
* 获取不同格式的输入输出值
|
|
10
|
+
* - encode:将字符串转换为单独的颜色值,例如 `{r: 255, g: 255, b: 255}`
|
|
11
|
+
* - decode:获取完整的颜色字符串,例如 `rgb(255, 255, 255)`
|
|
12
|
+
*/
|
|
13
|
+
export declare const getColorFormatMap: (color: Color, type: "encode" | "decode") => {
|
|
14
|
+
HEX: string;
|
|
15
|
+
CMYK: string;
|
|
16
|
+
RGB: string;
|
|
17
|
+
RGBA: string;
|
|
18
|
+
HSL: string;
|
|
19
|
+
HSLA: string;
|
|
20
|
+
HSV: string;
|
|
21
|
+
HSVA: string;
|
|
22
|
+
CSS: string;
|
|
23
|
+
HEX8: string;
|
|
24
|
+
} | {
|
|
25
|
+
HSV: import("tinycolor2").ColorFormats.HSVA;
|
|
26
|
+
HSVA: import("tinycolor2").ColorFormats.HSVA;
|
|
27
|
+
HSL: import("tinycolor2").ColorFormats.HSLA;
|
|
28
|
+
HSLA: import("tinycolor2").ColorFormats.HSLA;
|
|
29
|
+
RGB: {
|
|
30
|
+
r: number;
|
|
31
|
+
g: number;
|
|
32
|
+
b: number;
|
|
33
|
+
a: number;
|
|
34
|
+
};
|
|
35
|
+
RGBA: {
|
|
36
|
+
r: number;
|
|
37
|
+
g: number;
|
|
38
|
+
b: number;
|
|
39
|
+
a: number;
|
|
40
|
+
};
|
|
41
|
+
CMYK: {
|
|
42
|
+
c: number;
|
|
43
|
+
m: number;
|
|
44
|
+
y: number;
|
|
45
|
+
k: number;
|
|
46
|
+
};
|
|
47
|
+
CSS: {
|
|
48
|
+
css: string;
|
|
49
|
+
};
|
|
50
|
+
HEX: {
|
|
51
|
+
hex: string;
|
|
52
|
+
};
|
|
53
|
+
HEX8: {
|
|
54
|
+
hex: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* 获取下拉框的格式选项
|
|
59
|
+
*/
|
|
60
|
+
export declare const getColorFormatOptions: (enableAlpha: boolean) => readonly ["HEX", "RGB", "HSL", "HSV", "CMYK", "CSS"] | ("HEX" | "RGB" | "HSL" | "HSV" | "CMYK" | "CSS" | "HEX8" | "RGBA" | "HSLA" | "HSVA")[];
|
|
61
|
+
/**
|
|
62
|
+
* 获取当前格式的输入框配置
|
|
63
|
+
*/
|
|
64
|
+
export declare const getColorFormatInputs: (format: ColorFormat, enableAlpha: boolean) => import("./types").ColorInputProp[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface GradientColorPoint {
|
|
2
|
+
id?: string;
|
|
3
|
+
color?: string;
|
|
4
|
+
left?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface GradientColors {
|
|
7
|
+
points: GradientColorPoint[];
|
|
8
|
+
degree: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 验证是否是渐变字符串
|
|
12
|
+
* @param input
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare const isGradientColor: (input: string) => null | RegExpExecArray;
|
|
16
|
+
/**
|
|
17
|
+
* 解析渐变字符串为 GradientColors 对象
|
|
18
|
+
* @param input
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
export declare const parseGradientString: (input: string) => GradientColors | false;
|
|
22
|
+
export default parseGradientString;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { A as ALPHA_FORMAT_MAP, F as FORMATS, b as COLOR_FORMAT_INPUTS } from '../../../_chunks/dep-DJmE940f.js';
|
|
2
|
+
export { j as COLOR_MODES, C as Color, D as DEFAULT_COLOR, k as DEFAULT_LINEAR_GRADIENT, a as DEFAULT_SYSTEM_SWATCH_COLORS, G as GRADIENT_SLIDER_DEFAULT_WIDTH, l as SATURATION_PANEL_DEFAULT_HEIGHT, S as SATURATION_PANEL_DEFAULT_WIDTH, m as SLIDER_DEFAULT_WIDTH, T as TD_COLOR_USED_COLORS_MAX_SIZE, c as cmyk2rgb, d as cmykInputToColor, i as genGradientPoint, h as genId, g as getColorObject, f as getColorWithoutAlpha, e as gradientColors2string, n as isGradientColor, p as parseGradientString, r as rgb2cmyk } from '../../../_chunks/dep-DJmE940f.js';
|
|
3
|
+
import { a as _classCallCheck, _ as _createClass } from '../../../_chunks/dep-Chz4ZJCb.js';
|
|
4
|
+
import { _ as _defineProperty } from '../../../_chunks/dep-Cwish4GD.js';
|
|
5
|
+
import { _ as _toConsumableArray } from '../../../_chunks/dep-CgyDw_YI.js';
|
|
6
|
+
import '../../../_chunks/dep-CzLhKWCf.js';
|
|
7
|
+
import '../../../_chunks/dep-zOZQ0R9g.js';
|
|
8
|
+
import 'lodash-es';
|
|
9
|
+
import '../../../_chunks/dep-D-UKOauR.js';
|
|
10
|
+
|
|
11
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
+
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
|
14
|
+
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
|
15
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
16
|
+
var defaultsOptions = {
|
|
17
|
+
start: function start(coordinate, event) {},
|
|
18
|
+
drag: function drag(coordinate, event) {},
|
|
19
|
+
end: function end(coordinate, event) {}
|
|
20
|
+
};
|
|
21
|
+
var _Draggable_brand = /*#__PURE__*/new WeakSet();
|
|
22
|
+
var Draggable = /*#__PURE__*/function () {
|
|
23
|
+
function Draggable(el, options) {
|
|
24
|
+
_classCallCheck(this, Draggable);
|
|
25
|
+
_classPrivateMethodInitSpec(this, _Draggable_brand);
|
|
26
|
+
_defineProperty(this, "dragging", false);
|
|
27
|
+
this.$el = el;
|
|
28
|
+
this.props = _objectSpread(_objectSpread({}, defaultsOptions), options);
|
|
29
|
+
this.handles = {
|
|
30
|
+
start: _assertClassBrand(_Draggable_brand, this, _dragStart).bind(this),
|
|
31
|
+
drag: _assertClassBrand(_Draggable_brand, this, _drag).bind(this),
|
|
32
|
+
end: _assertClassBrand(_Draggable_brand, this, _dragEnd).bind(this)
|
|
33
|
+
};
|
|
34
|
+
this.$el.addEventListener("mousedown", this.handles.start, false);
|
|
35
|
+
}
|
|
36
|
+
return _createClass(Draggable, [{
|
|
37
|
+
key: "destroy",
|
|
38
|
+
value: function destroy() {
|
|
39
|
+
this.$el.removeEventListener("mousedown", this.handles.start, false);
|
|
40
|
+
window.removeEventListener("mousemove", this.handles.drag, false);
|
|
41
|
+
window.removeEventListener("mouseup", this.handles.end, false);
|
|
42
|
+
window.removeEventListener("contextmenu", this.handles.end, false);
|
|
43
|
+
}
|
|
44
|
+
}]);
|
|
45
|
+
}();
|
|
46
|
+
function _dragStart(event) {
|
|
47
|
+
if (this.dragging) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
window.addEventListener("mousemove", this.handles.drag, false);
|
|
51
|
+
window.addEventListener("mouseup", this.handles.end, false);
|
|
52
|
+
window.addEventListener("contextmenu", this.handles.end, false);
|
|
53
|
+
this.dragging = true;
|
|
54
|
+
this.props.start(_assertClassBrand(_Draggable_brand, this, _getCoordinate).call(this, event), event);
|
|
55
|
+
}
|
|
56
|
+
function _drag(event) {
|
|
57
|
+
if (!this.dragging) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
this.props.drag(_assertClassBrand(_Draggable_brand, this, _getCoordinate).call(this, event), event);
|
|
61
|
+
}
|
|
62
|
+
function _dragEnd(event) {
|
|
63
|
+
var _this = this;
|
|
64
|
+
setTimeout(function () {
|
|
65
|
+
_this.dragging = false;
|
|
66
|
+
_this.props.end(_assertClassBrand(_Draggable_brand, _this, _getCoordinate).call(_this, event), event);
|
|
67
|
+
}, 0);
|
|
68
|
+
window.removeEventListener("mousemove", this.handles.drag, false);
|
|
69
|
+
window.removeEventListener("mouseup", this.handles.end, false);
|
|
70
|
+
window.removeEventListener("contextmenu", this.handles.end, false);
|
|
71
|
+
}
|
|
72
|
+
function _getCoordinate(event) {
|
|
73
|
+
var rect = this.$el.getBoundingClientRect();
|
|
74
|
+
var mouseEvent = event;
|
|
75
|
+
var left = mouseEvent.clientX - rect.left;
|
|
76
|
+
var top = mouseEvent.clientY - rect.top;
|
|
77
|
+
return {
|
|
78
|
+
y: Math.min(Math.max(0, top), rect.height),
|
|
79
|
+
x: Math.min(Math.max(0, left), rect.width)
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
var initColorFormat = function initColorFormat(format, enableAlpha) {
|
|
84
|
+
if (enableAlpha && format in ALPHA_FORMAT_MAP) {
|
|
85
|
+
return format in ALPHA_FORMAT_MAP ? ALPHA_FORMAT_MAP[format] : format;
|
|
86
|
+
}
|
|
87
|
+
return format;
|
|
88
|
+
};
|
|
89
|
+
var getColorFormatMap = function getColorFormatMap(color, type) {
|
|
90
|
+
if (type === "encode") {
|
|
91
|
+
return {
|
|
92
|
+
HSV: color.getHsva(),
|
|
93
|
+
HSVA: color.getHsva(),
|
|
94
|
+
HSL: color.getHsla(),
|
|
95
|
+
HSLA: color.getHsla(),
|
|
96
|
+
RGB: color.getRgba(),
|
|
97
|
+
RGBA: color.getRgba(),
|
|
98
|
+
CMYK: color.getCmyk(),
|
|
99
|
+
CSS: {
|
|
100
|
+
css: color.css
|
|
101
|
+
},
|
|
102
|
+
HEX: {
|
|
103
|
+
hex: color.hex
|
|
104
|
+
},
|
|
105
|
+
HEX8: {
|
|
106
|
+
hex: color.hex8
|
|
107
|
+
// 为了减少转换 hex8 的 key 也对应 hex
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
return color.getFormatsColorMap();
|
|
112
|
+
};
|
|
113
|
+
var getColorFormatOptions = function getColorFormatOptions(enableAlpha) {
|
|
114
|
+
return enableAlpha ? FORMATS.map(function (item) {
|
|
115
|
+
return item in ALPHA_FORMAT_MAP ? ALPHA_FORMAT_MAP[item] : item;
|
|
116
|
+
}) : FORMATS;
|
|
117
|
+
};
|
|
118
|
+
var getColorFormatInputs = function getColorFormatInputs() {
|
|
119
|
+
var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "RGB";
|
|
120
|
+
var enableAlpha = arguments.length > 1 ? arguments[1] : undefined;
|
|
121
|
+
var finalFormat;
|
|
122
|
+
if (enableAlpha) {
|
|
123
|
+
finalFormat = Object.keys(ALPHA_FORMAT_MAP).find(function (key) {
|
|
124
|
+
return key in ALPHA_FORMAT_MAP && ALPHA_FORMAT_MAP[key] === format;
|
|
125
|
+
}) || format;
|
|
126
|
+
} else {
|
|
127
|
+
finalFormat = format;
|
|
128
|
+
}
|
|
129
|
+
if (!COLOR_FORMAT_INPUTS[finalFormat]) return [];
|
|
130
|
+
var configs = _toConsumableArray(COLOR_FORMAT_INPUTS[finalFormat]);
|
|
131
|
+
if (enableAlpha && format !== "CMYK") {
|
|
132
|
+
configs.push({
|
|
133
|
+
type: "inputNumber",
|
|
134
|
+
key: "a",
|
|
135
|
+
min: 0,
|
|
136
|
+
max: 100,
|
|
137
|
+
format: function format(value) {
|
|
138
|
+
return "".concat(value, "%");
|
|
139
|
+
},
|
|
140
|
+
flex: 1.15
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
return configs;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export { ALPHA_FORMAT_MAP, COLOR_FORMAT_INPUTS, Draggable, FORMATS, getColorFormatInputs, getColorFormatMap, getColorFormatOptions, initColorFormat };
|
|
147
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../components/color-picker/utils/color-picker/draggable.ts","../../../../../components/color-picker/utils/color-picker/format.ts"],"sourcesContent":["/* eslint-disable no-use-before-define */\r\nexport interface Coordinate {\r\n x: number;\r\n y: number;\r\n}\r\n\r\nexport type DraggableEvent = MouseEvent;\r\n\r\ninterface DraggableCallback {\r\n (coordinate: Coordinate, event?: DraggableEvent): void;\r\n}\r\n\r\nexport interface DraggableProps {\r\n start?: DraggableCallback;\r\n drag?: DraggableCallback;\r\n end?: DraggableCallback;\r\n}\r\n\r\ninterface DraggableHandles {\r\n start: (event: DraggableEvent) => void;\r\n drag: (event: DraggableEvent) => void;\r\n end: (event: DraggableEvent) => void;\r\n}\r\n\r\n// 配置项\r\nconst defaultsOptions: DraggableProps = {\r\n start: (coordinate: Coordinate, event: DraggableEvent) => {},\r\n drag: (coordinate: Coordinate, event: DraggableEvent) => {},\r\n end: (coordinate: Coordinate, event: DraggableEvent) => {},\r\n};\r\n\r\nexport class Draggable {\r\n private dragging = false;\r\n\r\n private $el: HTMLElement;\r\n\r\n private props: DraggableProps;\r\n\r\n private handles: DraggableHandles;\r\n\r\n constructor(el: HTMLElement, options?: DraggableProps) {\r\n this.$el = el;\r\n this.props = { ...defaultsOptions, ...options };\r\n this.handles = {\r\n start: this.#dragStart.bind(this),\r\n drag: this.#drag.bind(this),\r\n end: this.#dragEnd.bind(this),\r\n };\r\n this.$el.addEventListener('mousedown', this.handles.start, false);\r\n }\r\n\r\n #dragStart(event: DraggableEvent) {\r\n if (this.dragging) {\r\n return;\r\n }\r\n // event.preventDefault();\r\n window.addEventListener('mousemove', this.handles.drag, false);\r\n window.addEventListener('mouseup', this.handles.end, false);\r\n window.addEventListener('contextmenu', this.handles.end, false);\r\n this.dragging = true;\r\n this.props.start(this.#getCoordinate(event), event);\r\n }\r\n\r\n #drag(event: DraggableEvent) {\r\n if (!this.dragging) {\r\n return;\r\n }\r\n this.props.drag(this.#getCoordinate(event), event);\r\n }\r\n\r\n #dragEnd(event: DraggableEvent) {\r\n setTimeout(() => {\r\n this.dragging = false;\r\n this.props.end(this.#getCoordinate(event), event);\r\n }, 0);\r\n window.removeEventListener('mousemove', this.handles.drag, false);\r\n window.removeEventListener('mouseup', this.handles.end, false);\r\n window.removeEventListener('contextmenu', this.handles.end, false);\r\n }\r\n\r\n #getCoordinate(event: DraggableEvent) {\r\n const rect = this.$el.getBoundingClientRect();\r\n const mouseEvent = event;\r\n const left = mouseEvent.clientX - rect.left;\r\n const top = mouseEvent.clientY - rect.top;\r\n return {\r\n y: Math.min(Math.max(0, top), rect.height),\r\n x: Math.min(Math.max(0, left), rect.width),\r\n };\r\n }\r\n\r\n destroy() {\r\n this.$el.removeEventListener('mousedown', this.handles.start, false);\r\n window.removeEventListener('mousemove', this.handles.drag, false);\r\n window.removeEventListener('mouseup', this.handles.end, false);\r\n window.removeEventListener('contextmenu', this.handles.end, false);\r\n }\r\n}\r\n\r\nexport default Draggable;\r\n","import Color from './color';\r\nimport { ALPHA_FORMAT_MAP, COLOR_FORMAT_INPUTS, FORMATS } from './constants';\r\nimport type { AlphaConvertibleFormat, BasicColorFormat, ColorFormat } from './types';\r\n\r\n/**\r\n * 兜底处理用户传入的格式,例如:\r\n * - 传入 `RGB`, 但 `enableAlpha` ,则返回 `RGBA`\r\n */\r\nexport const initColorFormat = (format: ColorFormat, enableAlpha: boolean) => {\r\n if (enableAlpha && format in ALPHA_FORMAT_MAP) {\r\n return format in ALPHA_FORMAT_MAP ? ALPHA_FORMAT_MAP[format as AlphaConvertibleFormat] : format;\r\n }\r\n return format as BasicColorFormat;\r\n};\r\n\r\n/**\r\n * 获取不同格式的输入输出值\r\n * - encode:将字符串转换为单独的颜色值,例如 `{r: 255, g: 255, b: 255}`\r\n * - decode:获取完整的颜色字符串,例如 `rgb(255, 255, 255)`\r\n */\r\nexport const getColorFormatMap = (color: Color, type: 'encode' | 'decode') => {\r\n if (type === 'encode') {\r\n return {\r\n HSV: color.getHsva(),\r\n HSVA: color.getHsva(),\r\n HSL: color.getHsla(),\r\n HSLA: color.getHsla(),\r\n RGB: color.getRgba(),\r\n RGBA: color.getRgba(),\r\n CMYK: color.getCmyk(),\r\n CSS: {\r\n css: color.css,\r\n },\r\n HEX: {\r\n hex: color.hex,\r\n },\r\n HEX8: {\r\n hex: color.hex8, // 为了减少转换 hex8 的 key 也对应 hex\r\n },\r\n };\r\n }\r\n\r\n // decode\r\n return color.getFormatsColorMap();\r\n};\r\n\r\n/**\r\n * 获取下拉框的格式选项\r\n */\r\nexport const getColorFormatOptions = (enableAlpha: boolean) => (\r\n enableAlpha\r\n ? FORMATS.map((item) => (item in ALPHA_FORMAT_MAP ? ALPHA_FORMAT_MAP[item as AlphaConvertibleFormat] : item))\r\n : FORMATS\r\n);\r\n\r\n/**\r\n * 获取当前格式的输入框配置\r\n */\r\nexport const getColorFormatInputs = (\r\n format: ColorFormat = 'RGB',\r\n enableAlpha: boolean\r\n) => {\r\n let finalFormat;\r\n\r\n /* 为了减少 `ALPHA_FORMAT_MAP` 中的重复代码\r\n `RGBA/HEX8/HSLA/HSVA` 会被转换为 `RGB/HEX/HSL/HSV` 后再匹配\r\n 但在下一步会 push 一个代表透明度的输入框 */\r\n if (enableAlpha) {\r\n finalFormat = Object.keys(ALPHA_FORMAT_MAP).find(\r\n (key) => key in ALPHA_FORMAT_MAP && ALPHA_FORMAT_MAP[key as AlphaConvertibleFormat] === format\r\n ) || format;\r\n } else {\r\n finalFormat = format;\r\n }\r\n\r\n if (!COLOR_FORMAT_INPUTS[finalFormat as BasicColorFormat]) return [];\r\n\r\n const configs = [\r\n ...(COLOR_FORMAT_INPUTS[finalFormat as BasicColorFormat]),\r\n ];\r\n\r\n // CMYK 格式不支持透明度\r\n if (enableAlpha && format !== 'CMYK') {\r\n configs.push({\r\n type: 'inputNumber',\r\n key: 'a',\r\n min: 0,\r\n max: 100,\r\n format: (value: number) => `${value}%`,\r\n flex: 1.15,\r\n });\r\n }\r\n\r\n return configs;\r\n};\r\n"],"names":["defaultsOptions","start","coordinate","event","drag","end","_Draggable_brand","WeakSet","Draggable","el","options","_classCallCheck","_classPrivateMethodInitSpec","_defineProperty","$el","props","_objectSpread","handles","_assertClassBrand","_dragStart","bind","_drag","_dragEnd","addEventListener","_createClass","key","value","destroy","removeEventListener","window","dragging","_getCoordinate","call","_this","setTimeout","rect","getBoundingClientRect","mouseEvent","left","clientX","top","clientY","y","Math","min","max","height","x","width","initColorFormat","format","enableAlpha","ALPHA_FORMAT_MAP","getColorFormatMap","color","type","HSV","getHsva","HSVA","HSL","getHsla","HSLA","RGB","getRgba","RGBA","CMYK","getCmyk","CSS","css","HEX","hex","HEX8","hex8","getFormatsColorMap","getColorFormatOptions","FORMATS","map","item","getColorFormatInputs","arguments","length","undefined","finalFormat","Object","keys","find","COLOR_FORMAT_INPUTS","configs","_toConsumableArray","push","concat","flex"],"mappings":";;;;;;;;;;;;;;;AAyBA,IAAMA,eAAA,GAAkC;EACtCC,KAAA,EAAO,SAAPA,KAAAA,CAAQC,UAAA,EAAwBC,KAAA,EAA0B,CAAC,CAAA;EAC3DC,IAAA,EAAM,SAANA,IAAAA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
1
|
+
import { ALPHA_FORMAT_MAP, FORMATS } from './constants';
|
|
2
|
+
/**
|
|
3
|
+
* 非透明色类型
|
|
4
|
+
*/
|
|
5
|
+
export type BasicColorFormat = typeof FORMATS[number];
|
|
6
|
+
/**
|
|
7
|
+
* 支持转为透明格式的非透明色类型
|
|
8
|
+
*/
|
|
9
|
+
export type AlphaConvertibleFormat = keyof typeof ALPHA_FORMAT_MAP;
|
|
10
|
+
/**
|
|
11
|
+
* 透明色类型
|
|
12
|
+
*/
|
|
13
|
+
export type AlphaColorFormat = typeof ALPHA_FORMAT_MAP[AlphaConvertibleFormat];
|
|
14
|
+
/**
|
|
15
|
+
* 完整的颜色格式类型
|
|
16
|
+
*/
|
|
17
|
+
export type ColorFormat = BasicColorFormat | AlphaColorFormat;
|
|
18
|
+
/**
|
|
19
|
+
* 不同颜色格式对应的输入框配置
|
|
20
|
+
*/
|
|
21
|
+
export interface ColorInputProp {
|
|
22
|
+
key: string;
|
|
23
|
+
min?: number;
|
|
24
|
+
max?: number;
|
|
25
|
+
type: 'input' | 'inputNumber';
|
|
26
|
+
flex?: number;
|
|
27
|
+
format?: Function;
|
|
28
|
+
}
|