@tdesign/uniapp 0.0.1-alpha.1 → 0.7.1
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/CHANGELOG.md +213 -0
- package/LICENSE +9 -0
- package/README.md +144 -0
- package/dist/action-sheet/README.en-US.md +60 -0
- package/dist/action-sheet/README.md +131 -0
- package/dist/action-sheet/action-sheet.css +162 -0
- package/dist/action-sheet/action-sheet.vue +367 -0
- package/dist/action-sheet/computed.js +29 -0
- package/dist/action-sheet/index.d.ts +11 -0
- package/dist/action-sheet/index.js +13 -0
- package/dist/action-sheet/props.ts +86 -0
- package/dist/action-sheet/show.d.ts +28 -0
- package/dist/action-sheet/show.js +33 -0
- package/dist/action-sheet/type.ts +93 -0
- package/dist/avatar/README.en-US.md +102 -0
- package/dist/avatar/README.md +152 -0
- package/dist/avatar/avatar.css +77 -0
- package/dist/avatar/avatar.vue +200 -0
- package/dist/avatar/computed.js +30 -0
- package/dist/avatar/props.ts +54 -0
- package/dist/avatar/type.ts +58 -0
- package/dist/avatar-group/avatar-group.css +187 -0
- package/dist/avatar-group/avatar-group.vue +121 -0
- package/dist/avatar-group/props.ts +44 -0
- package/dist/avatar-group/type.ts +38 -0
- package/dist/back-top/README.en-US.md +49 -0
- package/dist/back-top/README.md +67 -0
- package/dist/back-top/back-top.css +65 -0
- package/dist/back-top/back-top.vue +122 -0
- package/dist/back-top/props.ts +48 -0
- package/dist/back-top/type.ts +42 -0
- package/dist/badge/README.en-US.md +54 -0
- package/dist/badge/README.md +85 -0
- package/dist/badge/badge.css +140 -0
- package/dist/badge/badge.vue +134 -0
- package/dist/badge/computed.js +63 -0
- package/dist/badge/props.ts +55 -0
- package/dist/badge/type.ts +60 -0
- package/dist/button/README.en-US.md +241 -0
- package/dist/button/README.md +232 -0
- package/dist/button/button.css +514 -0
- package/dist/button/button.vue +247 -0
- package/dist/button/props.ts +221 -0
- package/dist/button/type.ts +206 -0
- package/dist/calendar/README.en-US.md +63 -0
- package/dist/calendar/README.md +113 -0
- package/dist/calendar/calendar-header.props.js +42 -0
- package/dist/calendar/calendar-header.vue +98 -0
- package/dist/calendar/calendar.css +205 -0
- package/dist/calendar/calendar.vue +454 -0
- package/dist/calendar/computed.js +42 -0
- package/dist/calendar/props.ts +113 -0
- package/dist/calendar/template.props.js +57 -0
- package/dist/calendar/template.vue +261 -0
- package/dist/calendar/type.ts +141 -0
- package/dist/calendar/utils.js +16 -0
- package/dist/cascader/README.en-US.md +56 -0
- package/dist/cascader/README.md +96 -0
- package/dist/cascader/cascader.css +102 -0
- package/dist/cascader/cascader.vue +523 -0
- package/dist/cascader/props.ts +73 -0
- package/dist/cascader/type.ts +77 -0
- package/dist/cell/README.en-US.md +116 -0
- package/dist/cell/README.md +147 -0
- package/dist/cell/cell.css +94 -0
- package/dist/cell/cell.vue +260 -0
- package/dist/cell/props.ts +87 -0
- package/dist/cell/type.ts +82 -0
- package/dist/cell-group/cell-group.css +44 -0
- package/dist/cell-group/cell-group.vue +69 -0
- package/dist/cell-group/props.ts +25 -0
- package/dist/cell-group/type.ts +23 -0
- package/dist/check-tag/check-tag.css +197 -0
- package/dist/check-tag/check-tag.vue +149 -0
- package/dist/check-tag/props.ts +67 -0
- package/dist/check-tag/type.ts +63 -0
- package/dist/checkbox/README.en-US.md +103 -0
- package/dist/checkbox/README.md +158 -0
- package/dist/checkbox/checkbox.css +174 -0
- package/dist/checkbox/checkbox.vue +238 -0
- package/dist/checkbox/props.ts +90 -0
- package/dist/checkbox/type.ts +96 -0
- package/dist/checkbox-group/checkbox-group.css +0 -0
- package/dist/checkbox-group/checkbox-group.vue +261 -0
- package/dist/checkbox-group/props.ts +58 -0
- package/dist/checkbox-group/type.ts +72 -0
- package/dist/col/README.en-US.md +31 -0
- package/dist/col/README.md +60 -0
- package/dist/col/col.css +149 -0
- package/dist/col/col.vue +58 -0
- package/dist/col/computed.js +14 -0
- package/dist/col/props.ts +16 -0
- package/dist/col/type.ts +16 -0
- package/dist/collapse/README.en-US.md +82 -0
- package/dist/collapse/README.md +119 -0
- package/dist/collapse/collapse.css +5 -0
- package/dist/collapse/collapse.vue +119 -0
- package/dist/collapse/props.ts +42 -0
- package/dist/collapse/type.ts +46 -0
- package/dist/collapse-panel/collapse-panel.css +154 -0
- package/dist/collapse-panel/collapse-panel.vue +238 -0
- package/dist/collapse-panel/props.ts +48 -0
- package/dist/collapse-panel/type.ts +41 -0
- package/dist/color-picker/README.en-US.md +62 -0
- package/dist/color-picker/README.md +110 -0
- package/dist/color-picker/color-picker.css +271 -0
- package/dist/color-picker/color-picker.vue +501 -0
- package/dist/color-picker/constants.ts +26 -0
- package/dist/color-picker/props.ts +75 -0
- package/dist/color-picker/template.props.js +58 -0
- package/dist/color-picker/template.vue +198 -0
- package/dist/color-picker/type.ts +96 -0
- package/dist/color-picker/utils.js +1 -0
- package/dist/common/bus.js +84 -0
- package/dist/common/canvas/index.js +53 -0
- package/dist/common/common.ts +173 -0
- package/dist/common/config.js +9 -0
- package/dist/common/dom/index.js +1 -0
- package/dist/common/dom/select-component.js +26 -0
- package/dist/common/event/dynamic.js +10 -0
- package/dist/common/functional/mixin.js +51 -0
- package/dist/common/relation/index.js +6 -0
- package/dist/common/relation/parent-map.js +26 -0
- package/dist/common/relation/relation.js +213 -0
- package/dist/common/route.js +13 -0
- package/dist/common/runtime/index.js +5 -0
- package/dist/common/runtime/relation.js +0 -0
- package/dist/common/runtime/wxs-polyfill.js +16 -0
- package/dist/common/shared/calendar/index.js +128 -0
- package/dist/common/shared/calendar/type.ts +14 -0
- package/dist/common/shared/color-picker/cmyk.js +78 -0
- package/dist/common/shared/color-picker/color.js +428 -0
- package/dist/common/shared/color-picker/gradient.js +180 -0
- package/dist/common/shared/color-picker/index.js +3 -0
- package/dist/common/shared/date.js +46 -0
- package/dist/common/shared/qrcode/qrcodegen.js +884 -0
- package/dist/common/shared/qrcode/utils.js +124 -0
- package/dist/common/src/control.js +66 -0
- package/dist/common/src/flatTool.js +99 -0
- package/dist/common/src/index.js +4 -0
- package/dist/common/src/instantiationDecorator.js +259 -0
- package/dist/common/src/superComponent.js +5 -0
- package/dist/common/style/_variables.less +232 -0
- package/dist/common/style/base.less +4 -0
- package/dist/common/style/icons.css +0 -0
- package/dist/common/style/index.css +13 -0
- package/dist/common/style/mixins/_border.less +34 -0
- package/dist/common/style/mixins/_clearfix.less +7 -0
- package/dist/common/style/mixins/_cursor.less +6 -0
- package/dist/common/style/mixins/_ellipsis.less +15 -0
- package/dist/common/style/mixins/_hairline.less +55 -0
- package/dist/common/style/mixins/_index.less +6 -0
- package/dist/common/style/mixins/_other.less +14 -0
- package/dist/common/style/theme/index.css +471 -0
- package/dist/common/style/theme/index.less +11 -0
- package/dist/common/style/theme/raw/_components.less +30 -0
- package/dist/common/style/theme/raw/_dark.less +178 -0
- package/dist/common/style/theme/raw/_font.less +90 -0
- package/dist/common/style/theme/raw/_light.less +182 -0
- package/dist/common/style/theme/raw/_radius.less +10 -0
- package/dist/common/style/theme/raw/_spacer.less +11 -0
- package/dist/common/style/utilities/index.css +13 -0
- package/dist/common/utils.js +358 -0
- package/dist/common/utils.wxs.js +139 -0
- package/dist/common/validator.js +38 -0
- package/dist/common/version.js +66 -0
- package/dist/common/wechat.js +22 -0
- package/dist/count-down/README.en-US.md +50 -0
- package/dist/count-down/README.md +76 -0
- package/dist/count-down/computed.js +3 -0
- package/dist/count-down/count-down.css +110 -0
- package/dist/count-down/count-down.vue +166 -0
- package/dist/count-down/props.ts +62 -0
- package/dist/count-down/type.ts +64 -0
- package/dist/count-down/utils.js +72 -0
- package/dist/date-time-picker/README.en-US.md +61 -0
- package/dist/date-time-picker/README.md +105 -0
- package/dist/date-time-picker/date-time-picker.css +4 -0
- package/dist/date-time-picker/date-time-picker.vue +570 -0
- package/dist/date-time-picker/locale/dayjs.js +81 -0
- package/dist/date-time-picker/locale/en.js +12 -0
- package/dist/date-time-picker/locale/ja.js +12 -0
- package/dist/date-time-picker/locale/ko.js +12 -0
- package/dist/date-time-picker/locale/ru.js +12 -0
- package/dist/date-time-picker/locale/tc.js +12 -0
- package/dist/date-time-picker/locale/zh.js +12 -0
- package/dist/date-time-picker/props.ts +114 -0
- package/dist/date-time-picker/type.ts +134 -0
- package/dist/demo/demo.vue +97 -0
- package/dist/demo/index.css +46 -0
- package/dist/demo-header/demo-header.vue +60 -0
- package/dist/demo-header/index.css +0 -0
- package/dist/demo-navbar/demo-navbar.vue +42 -0
- package/dist/dialog/README.en-US.md +69 -0
- package/dist/dialog/README.md +120 -0
- package/dist/dialog/computed.js +15 -0
- package/dist/dialog/dialog.css +102 -0
- package/dist/dialog/dialog.vue +422 -0
- package/dist/dialog/index.d.ts +42 -0
- package/dist/dialog/index.js +90 -0
- package/dist/dialog/props.ts +94 -0
- package/dist/dialog/type.ts +97 -0
- package/dist/divider/README.en-US.md +40 -0
- package/dist/divider/README.md +64 -0
- package/dist/divider/divider.css +56 -0
- package/dist/divider/divider.vue +79 -0
- package/dist/divider/props.ts +33 -0
- package/dist/divider/type.ts +27 -0
- package/dist/draggable/draggable.css +16 -0
- package/dist/draggable/draggable.vue +92 -0
- package/dist/draggable/props.js +19 -0
- package/dist/drawer/README.en-US.md +54 -0
- package/dist/drawer/README.md +80 -0
- package/dist/drawer/drawer.css +62 -0
- package/dist/drawer/drawer.vue +144 -0
- package/dist/drawer/props.ts +72 -0
- package/dist/drawer/type.ts +81 -0
- package/dist/dropdown-item/computed.js +6 -0
- package/dist/dropdown-item/dropdown-item.css +97 -0
- package/dist/dropdown-item/dropdown-item.vue +403 -0
- package/dist/dropdown-item/props.ts +71 -0
- package/dist/dropdown-item/type.ts +76 -0
- package/dist/dropdown-menu/README.en-US.md +95 -0
- package/dist/dropdown-menu/README.md +125 -0
- package/dist/dropdown-menu/dropdown-menu.css +59 -0
- package/dist/dropdown-menu/dropdown-menu.vue +188 -0
- package/dist/dropdown-menu/props.ts +44 -0
- package/dist/dropdown-menu/type.ts +41 -0
- package/dist/empty/README.en-US.md +39 -0
- package/dist/empty/README.md +69 -0
- package/dist/empty/empty.css +21 -0
- package/dist/empty/empty.vue +140 -0
- package/dist/empty/props.ts +20 -0
- package/dist/empty/type.ts +20 -0
- package/dist/fab/README.en-US.md +37 -0
- package/dist/fab/README.md +81 -0
- package/dist/fab/fab.css +9 -0
- package/dist/fab/fab.vue +238 -0
- package/dist/fab/props.ts +54 -0
- package/dist/fab/type.ts +57 -0
- package/dist/footer/README.en-US.md +33 -0
- package/dist/footer/README.md +61 -0
- package/dist/footer/footer.css +47 -0
- package/dist/footer/footer.vue +117 -0
- package/dist/footer/props.ts +23 -0
- package/dist/footer/type.ts +34 -0
- package/dist/form/README.en-US.md +137 -0
- package/dist/form/README.md +146 -0
- package/dist/form/form-item-props.ts +56 -0
- package/dist/form/form.css +169 -0
- package/dist/form/form.vue +287 -0
- package/dist/form/props.ts +109 -0
- package/dist/form/type.ts +387 -0
- package/dist/form-item/README.en-US.md +37 -0
- package/dist/form-item/README.md +37 -0
- package/dist/form-item/form-item.css +120 -0
- package/dist/form-item/form-item.vue +396 -0
- package/dist/form-item/form-model.ts +198 -0
- package/dist/form-item/props.ts +64 -0
- package/dist/form-item/type.ts +7 -0
- package/dist/grid/README.en-US.md +92 -0
- package/dist/grid/README.md +143 -0
- package/dist/grid/grid.css +13 -0
- package/dist/grid/grid.vue +94 -0
- package/dist/grid/props.ts +43 -0
- package/dist/grid/type.ts +43 -0
- package/dist/grid-item/README.en-US.md +65 -0
- package/dist/grid-item/README.md +65 -0
- package/dist/grid-item/grid-item.css +103 -0
- package/dist/grid-item/grid-item.vue +292 -0
- package/dist/grid-item/props.ts +63 -0
- package/dist/grid-item/type.ts +56 -0
- package/dist/guide/README.en-US.md +103 -0
- package/dist/guide/README.md +140 -0
- package/dist/guide/content.vue +325 -0
- package/dist/guide/guide.css +64 -0
- package/dist/guide/guide.vue +534 -0
- package/dist/guide/props.ts +98 -0
- package/dist/guide/type.ts +174 -0
- package/dist/icon/README.en-US.md +32 -0
- package/dist/icon/README.md +109 -0
- package/dist/icon/icon.css +7073 -0
- package/dist/icon/icon.vue +121 -0
- package/dist/icon/props.ts +35 -0
- package/dist/icon/type.ts +32 -0
- package/dist/image/README.en-US.md +51 -0
- package/dist/image/README.md +86 -0
- package/dist/image/image.css +44 -0
- package/dist/image/image.vue +207 -0
- package/dist/image/props.ts +71 -0
- package/dist/image/type.ts +85 -0
- package/dist/image-viewer/README.en-US.md +49 -0
- package/dist/image-viewer/README.md +78 -0
- package/dist/image-viewer/computed.js +4 -0
- package/dist/image-viewer/image-viewer.css +75 -0
- package/dist/image-viewer/image-viewer.vue +317 -0
- package/dist/image-viewer/props.ts +69 -0
- package/dist/image-viewer/type.ts +76 -0
- package/dist/indexes/README.en-US.md +76 -0
- package/dist/indexes/README.md +105 -0
- package/dist/indexes/computed.js +4 -0
- package/dist/indexes/indexes-anchor-props.ts +12 -0
- package/dist/indexes/indexes.css +50 -0
- package/dist/indexes/indexes.vue +371 -0
- package/dist/indexes/props.ts +40 -0
- package/dist/indexes/type.ts +38 -0
- package/dist/indexes-anchor/README.en-US.md +24 -0
- package/dist/indexes-anchor/README.md +28 -0
- package/dist/indexes-anchor/indexes-anchor.css +49 -0
- package/dist/indexes-anchor/indexes-anchor.vue +73 -0
- package/dist/indexes-anchor/props.ts +12 -0
- package/dist/indexes-anchor/type.ts +12 -0
- package/dist/input/README.en-US.md +121 -0
- package/dist/input/README.md +190 -0
- package/dist/input/computed.js +13 -0
- package/dist/input/input.css +161 -0
- package/dist/input/input.vue +407 -0
- package/dist/input/props.ts +247 -0
- package/dist/input/type.ts +237 -0
- package/dist/input/utils.js +38 -0
- package/dist/link/README.en-US.md +67 -0
- package/dist/link/README.md +115 -0
- package/dist/link/link.css +118 -0
- package/dist/link/link.vue +175 -0
- package/dist/link/props.ts +65 -0
- package/dist/link/type.ts +62 -0
- package/dist/loading/README.en-US.md +49 -0
- package/dist/loading/README.md +96 -0
- package/dist/loading/loading.css +203 -0
- package/dist/loading/loading.vue +157 -0
- package/dist/loading/props.ts +68 -0
- package/dist/loading/type.ts +70 -0
- package/dist/message/README.en-US.md +69 -0
- package/dist/message/README.md +105 -0
- package/dist/message/config.js +10 -0
- package/dist/message/index.d.ts +17 -0
- package/dist/message/index.js +39 -0
- package/dist/message/message.css +0 -0
- package/dist/message/message.interface.ts +30 -0
- package/dist/message/message.vue +275 -0
- package/dist/message/props.ts +101 -0
- package/dist/message/type.ts +101 -0
- package/dist/message-item/computed.js +23 -0
- package/dist/message-item/index.js +40 -0
- package/dist/message-item/message-item.css +63 -0
- package/dist/message-item/message-item.vue +353 -0
- package/dist/mixins/page-scroll.js +115 -0
- package/dist/mixins/skyline.js +12 -0
- package/dist/mixins/theme-change.js +16 -0
- package/dist/mixins/touch.js +29 -0
- package/dist/mixins/transition.js +133 -0
- package/dist/mixins/using-custom-navbar.js +38 -0
- package/dist/navbar/README.en-US.md +76 -0
- package/dist/navbar/README.md +121 -0
- package/dist/navbar/navbar.css +106 -0
- package/dist/navbar/navbar.vue +293 -0
- package/dist/navbar/props.ts +75 -0
- package/dist/navbar/type.ts +76 -0
- package/dist/notice-bar/README.en-US.md +62 -0
- package/dist/notice-bar/README.md +116 -0
- package/dist/notice-bar/notice-bar.css +75 -0
- package/dist/notice-bar/notice-bar.vue +326 -0
- package/dist/notice-bar/props.ts +71 -0
- package/dist/notice-bar/type.ts +71 -0
- package/dist/npm/dayjs/esm/constant.js +25 -0
- package/dist/npm/dayjs/esm/index.js +541 -0
- package/dist/npm/dayjs/esm/locale/en.js +12 -0
- package/dist/npm/dayjs/esm/locale/ja.js +45 -0
- package/dist/npm/dayjs/esm/locale/ko.js +45 -0
- package/dist/npm/dayjs/esm/locale/ru.js +99 -0
- package/dist/npm/dayjs/esm/locale/zh-cn.js +67 -0
- package/dist/npm/dayjs/esm/locale/zh-tw.js +65 -0
- package/dist/npm/dayjs/esm/plugin/localeData/index.js +114 -0
- package/dist/npm/dayjs/esm/plugin/localizedFormat/index.js +20 -0
- package/dist/npm/dayjs/esm/plugin/localizedFormat/utils.js +20 -0
- package/dist/npm/dayjs/esm/utils.js +58 -0
- package/dist/npm/tinycolor2/esm/tinycolor.js +1180 -0
- package/dist/overlay/README.en-US.md +34 -0
- package/dist/overlay/README.md +54 -0
- package/dist/overlay/overlay.css +17 -0
- package/dist/overlay/overlay.vue +105 -0
- package/dist/overlay/props.ts +37 -0
- package/dist/overlay/type.ts +42 -0
- package/dist/picker/README.en-US.md +77 -0
- package/dist/picker/README.md +112 -0
- package/dist/picker/picker.css +71 -0
- package/dist/picker/picker.vue +315 -0
- package/dist/picker/props.ts +95 -0
- package/dist/picker/type.ts +114 -0
- package/dist/picker-item/README.en-US.md +25 -0
- package/dist/picker-item/README.md +25 -0
- package/dist/picker-item/picker-item.css +32 -0
- package/dist/picker-item/picker-item.vue +446 -0
- package/dist/picker-item/props.ts +18 -0
- package/dist/picker-item/type.ts +23 -0
- package/dist/popover/README.en-US.md +55 -0
- package/dist/popover/README.md +85 -0
- package/dist/popover/popover.css +271 -0
- package/dist/popover/popover.vue +352 -0
- package/dist/popover/props.ts +58 -0
- package/dist/popover/type.ts +61 -0
- package/dist/popup/README.en-US.md +53 -0
- package/dist/popup/README.md +82 -0
- package/dist/popup/computed.js +14 -0
- package/dist/popup/popup.css +80 -0
- package/dist/popup/popup.vue +141 -0
- package/dist/popup/props.ts +67 -0
- package/dist/popup/type.ts +72 -0
- package/dist/progress/README.en-US.md +52 -0
- package/dist/progress/README.md +87 -0
- package/dist/progress/computed.js +81 -0
- package/dist/progress/progress.css +136 -0
- package/dist/progress/progress.vue +259 -0
- package/dist/progress/props.ts +55 -0
- package/dist/progress/type.ts +50 -0
- package/dist/progress/utils.js +19 -0
- package/dist/pull-down-refresh/README.en-US.md +60 -0
- package/dist/pull-down-refresh/README.md +83 -0
- package/dist/pull-down-refresh/props.ts +112 -0
- package/dist/pull-down-refresh/pull-down-refresh.css +29 -0
- package/dist/pull-down-refresh/pull-down-refresh.vue +366 -0
- package/dist/pull-down-refresh/type.ts +118 -0
- package/dist/qrcode/README.en-US.md +40 -0
- package/dist/qrcode/README.md +97 -0
- package/dist/qrcode/components/qrcode-canvas/props.ts +48 -0
- package/dist/qrcode/components/qrcode-canvas/qrcode-canvas.css +7 -0
- package/dist/qrcode/components/qrcode-canvas/qrcode-canvas.vue +413 -0
- package/dist/qrcode/components/qrcode-status/props.ts +22 -0
- package/dist/qrcode/components/qrcode-status/qrcode-status.css +25 -0
- package/dist/qrcode/components/qrcode-status/qrcode-status.vue +94 -0
- package/dist/qrcode/components/qrcode-status/type.ts +25 -0
- package/dist/qrcode/hooks/useQRCode.js +25 -0
- package/dist/qrcode/props.ts +66 -0
- package/dist/qrcode/qrcode.css +31 -0
- package/dist/qrcode/qrcode.vue +144 -0
- package/dist/qrcode/type.ts +66 -0
- package/dist/radio/README.en-US.md +104 -0
- package/dist/radio/README.md +148 -0
- package/dist/radio/props.ts +86 -0
- package/dist/radio/radio.css +177 -0
- package/dist/radio/radio.vue +227 -0
- package/dist/radio/type.ts +89 -0
- package/dist/radio-group/props.ts +68 -0
- package/dist/radio-group/radio-group.css +0 -0
- package/dist/radio-group/radio-group.vue +205 -0
- package/dist/radio-group/type.ts +79 -0
- package/dist/rate/README.en-US.md +50 -0
- package/dist/rate/README.md +107 -0
- package/dist/rate/computed.js +66 -0
- package/dist/rate/props.ts +85 -0
- package/dist/rate/rate.css +81 -0
- package/dist/rate/rate.vue +276 -0
- package/dist/rate/type.ts +79 -0
- package/dist/result/README.en-US.md +47 -0
- package/dist/result/README.md +88 -0
- package/dist/result/props.ts +36 -0
- package/dist/result/result.css +35 -0
- package/dist/result/result.vue +128 -0
- package/dist/result/type.ts +31 -0
- package/dist/row/computed.js +13 -0
- package/dist/row/props.ts +12 -0
- package/dist/row/row.css +6 -0
- package/dist/row/row.vue +63 -0
- package/dist/row/type.ts +12 -0
- package/dist/script/postinstall.js +46 -0
- package/dist/scroll-view/scroll-view.css +0 -0
- package/dist/scroll-view/scroll-view.vue +52 -0
- package/dist/search/README.en-US.md +88 -0
- package/dist/search/README.md +126 -0
- package/dist/search/computed.js +3 -0
- package/dist/search/props.ts +171 -0
- package/dist/search/search.css +75 -0
- package/dist/search/search.vue +292 -0
- package/dist/search/type.ts +165 -0
- package/dist/side-bar/README.en-US.md +58 -0
- package/dist/side-bar/README.md +89 -0
- package/dist/side-bar/props.ts +26 -0
- package/dist/side-bar/side-bar-item-props.ts +27 -0
- package/dist/side-bar/side-bar.css +14 -0
- package/dist/side-bar/side-bar.vue +84 -0
- package/dist/side-bar/type.ts +24 -0
- package/dist/side-bar-item/props.ts +27 -0
- package/dist/side-bar-item/side-bar-item.css +66 -0
- package/dist/side-bar-item/side-bar-item.vue +168 -0
- package/dist/side-bar-item/type.ts +32 -0
- package/dist/skeleton/README.en-US.md +44 -0
- package/dist/skeleton/README.md +82 -0
- package/dist/skeleton/props.ts +41 -0
- package/dist/skeleton/skeleton.css +77 -0
- package/dist/skeleton/skeleton.vue +211 -0
- package/dist/skeleton/type.ts +44 -0
- package/dist/slider/README.en-US.md +63 -0
- package/dist/slider/README.md +127 -0
- package/dist/slider/computed.js +9 -0
- package/dist/slider/props.ts +79 -0
- package/dist/slider/slider.css +239 -0
- package/dist/slider/slider.vue +719 -0
- package/dist/slider/tool.js +43 -0
- package/dist/slider/type.ts +81 -0
- package/dist/step-item/computed.js +4 -0
- package/dist/step-item/props.ts +36 -0
- package/dist/step-item/step-item.css +182 -0
- package/dist/step-item/step-item.vue +175 -0
- package/dist/step-item/type.ts +33 -0
- package/dist/stepper/README.en-US.md +49 -0
- package/dist/stepper/README.md +90 -0
- package/dist/stepper/props.ts +88 -0
- package/dist/stepper/stepper.css +105 -0
- package/dist/stepper/stepper.vue +223 -0
- package/dist/stepper/type.ts +79 -0
- package/dist/steps/README.en-US.md +99 -0
- package/dist/steps/README.md +157 -0
- package/dist/steps/props.ts +63 -0
- package/dist/steps/steps.css +19 -0
- package/dist/steps/steps.vue +122 -0
- package/dist/steps/type.ts +44 -0
- package/dist/sticky/README.en-US.md +32 -0
- package/dist/sticky/README.md +66 -0
- package/dist/sticky/props.ts +30 -0
- package/dist/sticky/sticky.css +3 -0
- package/dist/sticky/sticky.vue +144 -0
- package/dist/sticky/type.ts +31 -0
- package/dist/swipe-cell/README.en-US.md +29 -0
- package/dist/swipe-cell/README.md +66 -0
- package/dist/swipe-cell/computed.js +166 -0
- package/dist/swipe-cell/props.ts +39 -0
- package/dist/swipe-cell/swipe-cell.css +31 -0
- package/dist/swipe-cell/swipe-cell.vue +245 -0
- package/dist/swipe-cell/type.ts +48 -0
- package/dist/swiper/README.en-US.md +89 -0
- package/dist/swiper/README.md +139 -0
- package/dist/swiper/computed.js +29 -0
- package/dist/swiper/props.ts +117 -0
- package/dist/swiper/swiper.css +21 -0
- package/dist/swiper/swiper.vue +193 -0
- package/dist/swiper/type.ts +112 -0
- package/dist/swiper-nav/props.ts +49 -0
- package/dist/swiper-nav/swiper-nav.css +130 -0
- package/dist/swiper-nav/swiper-nav.vue +93 -0
- package/dist/swiper-nav/type.ts +45 -0
- package/dist/switch/README.en-US.md +70 -0
- package/dist/switch/README.md +104 -0
- package/dist/switch/props.ts +53 -0
- package/dist/switch/switch.css +123 -0
- package/dist/switch/switch.vue +122 -0
- package/dist/switch/type.ts +51 -0
- package/dist/tab-bar/README.en-US.md +58 -0
- package/dist/tab-bar/README.md +104 -0
- package/dist/tab-bar/props.ts +62 -0
- package/dist/tab-bar/tab-bar.css +42 -0
- package/dist/tab-bar/tab-bar.vue +141 -0
- package/dist/tab-bar/type.ts +56 -0
- package/dist/tab-bar-item/props.ts +25 -0
- package/dist/tab-bar-item/tab-bar-item.css +117 -0
- package/dist/tab-bar-item/tab-bar-item.vue +222 -0
- package/dist/tab-bar-item/type.ts +32 -0
- package/dist/tab-panel/props.ts +34 -0
- package/dist/tab-panel/tab-panel.css +15 -0
- package/dist/tab-panel/tab-panel.vue +100 -0
- package/dist/tab-panel/type.ts +42 -0
- package/dist/tabs/README.en-US.md +89 -0
- package/dist/tabs/README.md +198 -0
- package/dist/tabs/computed.js +26 -0
- package/dist/tabs/props.ts +80 -0
- package/dist/tabs/tabs.css +183 -0
- package/dist/tabs/tabs.vue +494 -0
- package/dist/tabs/type.ts +77 -0
- package/dist/tag/README.en-US.md +113 -0
- package/dist/tag/README.md +151 -0
- package/dist/tag/props.ts +70 -0
- package/dist/tag/tag.css +208 -0
- package/dist/tag/tag.vue +161 -0
- package/dist/tag/type.ts +54 -0
- package/dist/tdesign-uniapp/tdesign-uniapp.vue +11 -0
- package/dist/textarea/README.en-US.md +78 -0
- package/dist/textarea/README.md +132 -0
- package/dist/textarea/computed.js +14 -0
- package/dist/textarea/props.ts +152 -0
- package/dist/textarea/textarea.css +67 -0
- package/dist/textarea/textarea.vue +227 -0
- package/dist/textarea/type.ts +167 -0
- package/dist/toast/README.en-US.md +51 -0
- package/dist/toast/README.md +78 -0
- package/dist/toast/index.d.ts +20 -0
- package/dist/toast/index.js +27 -0
- package/dist/toast/props.ts +68 -0
- package/dist/toast/toast.css +73 -0
- package/dist/toast/toast.vue +213 -0
- package/dist/toast/type.ts +64 -0
- package/dist/transition/README.en-US.md +13 -0
- package/dist/transition/README.md +45 -0
- package/dist/transition/props.js +22 -0
- package/dist/transition/transition.css +14 -0
- package/dist/transition/transition.vue +51 -0
- package/dist/tree-select/README.en-US.md +48 -0
- package/dist/tree-select/README.md +78 -0
- package/dist/tree-select/computed.js +6 -0
- package/dist/tree-select/props.ts +42 -0
- package/dist/tree-select/tree-select.css +44 -0
- package/dist/tree-select/tree-select.vue +319 -0
- package/dist/tree-select/type.ts +49 -0
- package/dist/types/action-sheet.d.ts +7 -0
- package/dist/types/avatar-group.d.ts +7 -0
- package/dist/types/avatar.d.ts +7 -0
- package/dist/types/back-top.d.ts +7 -0
- package/dist/types/badge.d.ts +7 -0
- package/dist/types/button.d.ts +7 -0
- package/dist/types/calendar.d.ts +7 -0
- package/dist/types/cascader.d.ts +7 -0
- package/dist/types/cell-group.d.ts +7 -0
- package/dist/types/cell.d.ts +7 -0
- package/dist/types/check-tag.d.ts +7 -0
- package/dist/types/checkbox-group.d.ts +7 -0
- package/dist/types/checkbox.d.ts +7 -0
- package/dist/types/col.d.ts +7 -0
- package/dist/types/collapse-panel.d.ts +7 -0
- package/dist/types/collapse.d.ts +7 -0
- package/dist/types/color-picker.d.ts +7 -0
- package/dist/types/count-down.d.ts +7 -0
- package/dist/types/date-time-picker.d.ts +7 -0
- package/dist/types/dialog.d.ts +7 -0
- package/dist/types/divider.d.ts +7 -0
- package/dist/types/drawer.d.ts +7 -0
- package/dist/types/dropdown-item.d.ts +7 -0
- package/dist/types/dropdown-menu.d.ts +7 -0
- package/dist/types/empty.d.ts +7 -0
- package/dist/types/fab.d.ts +7 -0
- package/dist/types/footer.d.ts +7 -0
- package/dist/types/form-item.d.ts +7 -0
- package/dist/types/form.d.ts +7 -0
- package/dist/types/grid-item.d.ts +7 -0
- package/dist/types/grid.d.ts +7 -0
- package/dist/types/guide.d.ts +7 -0
- package/dist/types/icon.d.ts +7 -0
- package/dist/types/image-viewer.d.ts +7 -0
- package/dist/types/image.d.ts +7 -0
- package/dist/types/index.d.ts +77 -0
- package/dist/types/indexes-anchor.d.ts +7 -0
- package/dist/types/indexes.d.ts +7 -0
- package/dist/types/input.d.ts +7 -0
- package/dist/types/link.d.ts +7 -0
- package/dist/types/loading.d.ts +7 -0
- package/dist/types/message.d.ts +7 -0
- package/dist/types/navbar.d.ts +7 -0
- package/dist/types/notice-bar.d.ts +7 -0
- package/dist/types/overlay.d.ts +7 -0
- package/dist/types/picker-item.d.ts +7 -0
- package/dist/types/picker.d.ts +7 -0
- package/dist/types/popup.d.ts +7 -0
- package/dist/types/progress.d.ts +7 -0
- package/dist/types/pull-down-refresh.d.ts +7 -0
- package/dist/types/qrcode.d.ts +7 -0
- package/dist/types/radio-group.d.ts +7 -0
- package/dist/types/radio.d.ts +7 -0
- package/dist/types/rate.d.ts +7 -0
- package/dist/types/result.d.ts +7 -0
- package/dist/types/row.d.ts +7 -0
- package/dist/types/search.d.ts +7 -0
- package/dist/types/side-bar-item.d.ts +7 -0
- package/dist/types/side-bar.d.ts +7 -0
- package/dist/types/skeleton.d.ts +7 -0
- package/dist/types/slider.d.ts +7 -0
- package/dist/types/step-item.d.ts +7 -0
- package/dist/types/stepper.d.ts +7 -0
- package/dist/types/steps.d.ts +7 -0
- package/dist/types/sticky.d.ts +7 -0
- package/dist/types/swipe-cell.d.ts +7 -0
- package/dist/types/swiper-nav.d.ts +7 -0
- package/dist/types/swiper.d.ts +7 -0
- package/dist/types/switch.d.ts +7 -0
- package/dist/types/tab-bar-item.d.ts +7 -0
- package/dist/types/tab-bar.d.ts +7 -0
- package/dist/types/tab-panel.d.ts +7 -0
- package/dist/types/tabs.d.ts +7 -0
- package/dist/types/tag.d.ts +7 -0
- package/dist/types/textarea.d.ts +7 -0
- package/dist/types/toast.d.ts +7 -0
- package/dist/types/tree-select.d.ts +7 -0
- package/dist/types/upload.d.ts +7 -0
- package/dist/types/watermark.d.ts +7 -0
- package/dist/upload/README.en-US.md +63 -0
- package/dist/upload/README.md +116 -0
- package/dist/upload/drag.computed.js +227 -0
- package/dist/upload/props.ts +136 -0
- package/dist/upload/type.ts +197 -0
- package/dist/upload/upload.computed.js +13 -0
- package/dist/upload/upload.css +116 -0
- package/dist/upload/upload.vue +887 -0
- package/dist/watermark/README.en-US.md +63 -0
- package/dist/watermark/README.md +115 -0
- package/dist/watermark/props.ts +82 -0
- package/dist/watermark/type.ts +121 -0
- package/dist/watermark/utils/generateBase64Url.js +360 -0
- package/dist/watermark/utils/randomMovingStyle.js +27 -0
- package/dist/watermark/watermark.css +28 -0
- package/dist/watermark/watermark.vue +200 -0
- package/global.d.ts +84 -0
- package/package.json +505 -7
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="classPrefix + '__root'">
|
|
3
|
+
<t-popup
|
|
4
|
+
v-if="usePopup"
|
|
5
|
+
:visible="dataVisible"
|
|
6
|
+
:using-custom-navbar="(popupProps && popupProps.usingCustomNavbar) || false"
|
|
7
|
+
:custom-navbar-height="popupProps && popupProps.customNavbarHeight"
|
|
8
|
+
:show-overlay="(popupProps && popupProps.showOverlay) || true"
|
|
9
|
+
:z-index="(popupProps && popupProps.zIndex) || 11500"
|
|
10
|
+
:overlay-props="(popupProps && popupProps.overlayProps) || defaultOverlayProps"
|
|
11
|
+
placement="bottom"
|
|
12
|
+
@visible-change="onVisibleChange"
|
|
13
|
+
>
|
|
14
|
+
<slot name="header" />
|
|
15
|
+
|
|
16
|
+
<!-- 防止转成 px 后,尺寸没铺满 -->
|
|
17
|
+
<!-- 750rpx => 100% -->
|
|
18
|
+
<TemplateVue
|
|
19
|
+
ref="templateVue"
|
|
20
|
+
:class-prefix="classPrefix"
|
|
21
|
+
:custom-style="tools._style(['width: 100%', customStyle])"
|
|
22
|
+
:is-multiple="isMultiple"
|
|
23
|
+
:type="type"
|
|
24
|
+
:slider-info="sliderInfo"
|
|
25
|
+
:saturation-thumb-style="saturationThumbStyle"
|
|
26
|
+
:hue-slider-style="hueSliderStyle"
|
|
27
|
+
:enable-alpha="enableAlpha"
|
|
28
|
+
:alpha-slider-style="alphaSliderStyle"
|
|
29
|
+
:show-primary-color-preview="showPrimaryColorPreview"
|
|
30
|
+
:preview-color="previewColor"
|
|
31
|
+
:format-list="formatList"
|
|
32
|
+
:inner-swatch-list="innerSwatchList"
|
|
33
|
+
:format="format"
|
|
34
|
+
@onTouchStart="onTouchStart"
|
|
35
|
+
@onTouchMove="onTouchMove"
|
|
36
|
+
@onTouchEnd="onTouchEnd"
|
|
37
|
+
@clickSwatch="clickSwatch"
|
|
38
|
+
/>
|
|
39
|
+
<slot name="footer" />
|
|
40
|
+
</t-popup>
|
|
41
|
+
<block v-else>
|
|
42
|
+
<TemplateVue
|
|
43
|
+
ref="templateVue"
|
|
44
|
+
:class-prefix="classPrefix"
|
|
45
|
+
:custom-style="tools._style([customStyle])"
|
|
46
|
+
:is-multiple="isMultiple"
|
|
47
|
+
:type="type"
|
|
48
|
+
:slider-info="sliderInfo"
|
|
49
|
+
:saturation-thumb-style="saturationThumbStyle"
|
|
50
|
+
:hue-slider-style="hueSliderStyle"
|
|
51
|
+
:enable-alpha="enableAlpha"
|
|
52
|
+
:alpha-slider-style="alphaSliderStyle"
|
|
53
|
+
:show-primary-color-preview="showPrimaryColorPreview"
|
|
54
|
+
:preview-color="previewColor"
|
|
55
|
+
:format-list="formatList"
|
|
56
|
+
:inner-swatch-list="innerSwatchList"
|
|
57
|
+
:format="format"
|
|
58
|
+
@onTouchStart="onTouchStart"
|
|
59
|
+
@onTouchMove="onTouchMove"
|
|
60
|
+
@onTouchEnd="onTouchEnd"
|
|
61
|
+
@clickSwatch="clickSwatch"
|
|
62
|
+
/>
|
|
63
|
+
</block>
|
|
64
|
+
</view>
|
|
65
|
+
</template>
|
|
66
|
+
<script>
|
|
67
|
+
import TPopup from '../popup/popup';
|
|
68
|
+
import { uniComponent } from '../common/src/index';
|
|
69
|
+
import { prefix } from '../common/config';
|
|
70
|
+
import props from './props';
|
|
71
|
+
import {
|
|
72
|
+
SATURATION_PANEL_DEFAULT_HEIGHT,
|
|
73
|
+
SATURATION_PANEL_DEFAULT_WIDTH,
|
|
74
|
+
SLIDER_DEFAULT_WIDTH,
|
|
75
|
+
DEFAULT_COLOR,
|
|
76
|
+
ALPHA_MAX,
|
|
77
|
+
HUE_MAX,
|
|
78
|
+
DEFAULT_SYSTEM_SWATCH_COLORS,
|
|
79
|
+
} from './constants';
|
|
80
|
+
import { debounce, nextTick } from '../common/utils';
|
|
81
|
+
import { Color, getColorObject } from './utils';
|
|
82
|
+
import TemplateVue from './template.vue';
|
|
83
|
+
|
|
84
|
+
import tools from '../common/utils.wxs';
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
const name = `${prefix}-color-picker`;
|
|
88
|
+
|
|
89
|
+
const getCoordinate = (e, react, isFixed) => {
|
|
90
|
+
const { pageX, pageY, clientY } = e.changedTouches[0] || {};
|
|
91
|
+
|
|
92
|
+
const offsetY = isFixed ? react.top : e.currentTarget?.offsetTop;
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
x: Math.min(Math.max(0, pageX - react.left), react.width),
|
|
96
|
+
y: Math.min(Math.max(0, (isFixed ? clientY : pageY) - offsetY), react.height),
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const getFormatList = (format, color) => {
|
|
101
|
+
const FORMAT_MAP = {
|
|
102
|
+
HSV: Object.values(color.getHsva()),
|
|
103
|
+
HSVA: Object.values(color.getHsva()),
|
|
104
|
+
|
|
105
|
+
HSL: Object.values(color.getHsla()),
|
|
106
|
+
HSLA: Object.values(color.getHsla()),
|
|
107
|
+
HSB: Object.values(color.getHsla()),
|
|
108
|
+
|
|
109
|
+
RGB: Object.values(color.getRgba()),
|
|
110
|
+
RGBA: Object.values(color.getRgba()),
|
|
111
|
+
CMYK: [...Object.values(color.getCmyk()), 0],
|
|
112
|
+
|
|
113
|
+
CSS: [color.css, 0],
|
|
114
|
+
HEX: [color.hex, 0],
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const cur = FORMAT_MAP[format];
|
|
118
|
+
if (cur) {
|
|
119
|
+
return [...cur.slice(0, cur.length - 1), `${Math.round(color.alpha * 100)}%`];
|
|
120
|
+
}
|
|
121
|
+
return FORMAT_MAP.RGB;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const genSwatchList = (prop) => {
|
|
125
|
+
if (prop === undefined) {
|
|
126
|
+
return DEFAULT_SYSTEM_SWATCH_COLORS;
|
|
127
|
+
}
|
|
128
|
+
if (!prop || !prop.length) {
|
|
129
|
+
return [];
|
|
130
|
+
}
|
|
131
|
+
return prop;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export default uniComponent({
|
|
135
|
+
name,
|
|
136
|
+
options: {
|
|
137
|
+
styleIsolation: 'shared',
|
|
138
|
+
},
|
|
139
|
+
components: {
|
|
140
|
+
TPopup,
|
|
141
|
+
TemplateVue,
|
|
142
|
+
},
|
|
143
|
+
props: {
|
|
144
|
+
...props,
|
|
145
|
+
},
|
|
146
|
+
emits: [
|
|
147
|
+
'palette-bar-change',
|
|
148
|
+
'close',
|
|
149
|
+
'change',
|
|
150
|
+
'update:visible',
|
|
151
|
+
],
|
|
152
|
+
data() {
|
|
153
|
+
return {
|
|
154
|
+
prefix,
|
|
155
|
+
classPrefix: name,
|
|
156
|
+
panelRect: {
|
|
157
|
+
width: SATURATION_PANEL_DEFAULT_WIDTH,
|
|
158
|
+
height: SATURATION_PANEL_DEFAULT_HEIGHT,
|
|
159
|
+
},
|
|
160
|
+
sliderRect: {
|
|
161
|
+
width: SLIDER_DEFAULT_WIDTH,
|
|
162
|
+
left: 0,
|
|
163
|
+
},
|
|
164
|
+
saturationInfo: {
|
|
165
|
+
saturation: 0,
|
|
166
|
+
value: 0,
|
|
167
|
+
},
|
|
168
|
+
saturationThumbStyle: {
|
|
169
|
+
left: 0,
|
|
170
|
+
top: 0,
|
|
171
|
+
},
|
|
172
|
+
sliderInfo: {
|
|
173
|
+
value: 0, // hue
|
|
174
|
+
},
|
|
175
|
+
hueSliderStyle: {
|
|
176
|
+
left: 0,
|
|
177
|
+
},
|
|
178
|
+
alphaSliderStyle: {
|
|
179
|
+
left: 0,
|
|
180
|
+
},
|
|
181
|
+
innerValue: props.defaultValue.default || props.value.default,
|
|
182
|
+
showPrimaryColorPreview: false,
|
|
183
|
+
previewColor: props.defaultValue.default || props.value.default,
|
|
184
|
+
formatList: [],
|
|
185
|
+
innerSwatchList: genSwatchList(props.swatchColors.default),
|
|
186
|
+
isMultiple: props.type.default === 'multiple',
|
|
187
|
+
defaultOverlayProps: {},
|
|
188
|
+
tools,
|
|
189
|
+
color: {},
|
|
190
|
+
dataVisible: this.visible,
|
|
191
|
+
};
|
|
192
|
+
},
|
|
193
|
+
watch: {
|
|
194
|
+
format: {
|
|
195
|
+
handler() {
|
|
196
|
+
this.setCoreStyle();
|
|
197
|
+
},
|
|
198
|
+
deep: true,
|
|
199
|
+
},
|
|
200
|
+
swatchColors: {
|
|
201
|
+
handler(value) {
|
|
202
|
+
this.innerSwatchList = genSwatchList(value);
|
|
203
|
+
},
|
|
204
|
+
immediate: true,
|
|
205
|
+
},
|
|
206
|
+
type: {
|
|
207
|
+
handler(value) {
|
|
208
|
+
this.isMultiple = value === 'multiple';
|
|
209
|
+
},
|
|
210
|
+
immediate: true,
|
|
211
|
+
},
|
|
212
|
+
visible: {
|
|
213
|
+
handler(v) {
|
|
214
|
+
this.dataVisible = v;
|
|
215
|
+
},
|
|
216
|
+
immediate: true,
|
|
217
|
+
},
|
|
218
|
+
usePopup: 'onWatchPopupVisible',
|
|
219
|
+
dataVisible: 'onWatchPopupVisible',
|
|
220
|
+
|
|
221
|
+
value(v) {
|
|
222
|
+
if (v) {
|
|
223
|
+
this.init();
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
created() {
|
|
228
|
+
this.color = new Color(props.defaultValue.default || props.value.default || DEFAULT_COLOR);
|
|
229
|
+
this.formatList = getFormatList(props.format.default, this.color);
|
|
230
|
+
},
|
|
231
|
+
mounted() {
|
|
232
|
+
setTimeout(() => {
|
|
233
|
+
this.init();
|
|
234
|
+
}, 33);
|
|
235
|
+
this.debouncedUpdateEleRect = debounce(e => this.updateEleRect(e), 150);
|
|
236
|
+
},
|
|
237
|
+
beforeUnMount() {
|
|
238
|
+
clearTimeout(this.timer);
|
|
239
|
+
},
|
|
240
|
+
methods: {
|
|
241
|
+
init() {
|
|
242
|
+
const { value, defaultValue } = this;
|
|
243
|
+
const innerValue = value || defaultValue;
|
|
244
|
+
if (innerValue) {
|
|
245
|
+
this.innerValue = innerValue;
|
|
246
|
+
}
|
|
247
|
+
this.color = new Color(innerValue || DEFAULT_COLOR);
|
|
248
|
+
this.updateColor();
|
|
249
|
+
this.getEleReact();
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
updateEleRect(e) {
|
|
253
|
+
if (!e) return;
|
|
254
|
+
|
|
255
|
+
const { scrollTop } = e.detail;
|
|
256
|
+
const { width, height, left, initTop } = this.panelRect;
|
|
257
|
+
this.panelRect = {
|
|
258
|
+
width,
|
|
259
|
+
height,
|
|
260
|
+
left,
|
|
261
|
+
top: initTop - scrollTop,
|
|
262
|
+
initTop,
|
|
263
|
+
};
|
|
264
|
+
},
|
|
265
|
+
|
|
266
|
+
getEleReact() {
|
|
267
|
+
const saturationSelector = `.${name}__saturation`;
|
|
268
|
+
const sliderSelector = `.${name}__slider`;
|
|
269
|
+
// }
|
|
270
|
+
if (!this.$refs.templateVue) return;
|
|
271
|
+
|
|
272
|
+
Promise.all([
|
|
273
|
+
this.$refs.templateVue.getRect(saturationSelector),
|
|
274
|
+
this.$refs.templateVue.getRect(sliderSelector),
|
|
275
|
+
])
|
|
276
|
+
.then(([saturationRect, sliderRect]) => {
|
|
277
|
+
this.panelRect = {
|
|
278
|
+
width: saturationRect.width || SATURATION_PANEL_DEFAULT_WIDTH,
|
|
279
|
+
height: saturationRect.height || SATURATION_PANEL_DEFAULT_HEIGHT,
|
|
280
|
+
left: saturationRect.left || 0,
|
|
281
|
+
top: saturationRect.top || 0,
|
|
282
|
+
initTop: saturationRect.top || 0,
|
|
283
|
+
};
|
|
284
|
+
this.sliderRect = {
|
|
285
|
+
left: sliderRect.left || 0,
|
|
286
|
+
width: sliderRect.width || SLIDER_DEFAULT_WIDTH,
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
setTimeout(() => {
|
|
290
|
+
this.setCoreStyle();
|
|
291
|
+
}, 33);
|
|
292
|
+
})
|
|
293
|
+
.catch(() => {
|
|
294
|
+
});
|
|
295
|
+
},
|
|
296
|
+
|
|
297
|
+
clickSwatch(e) {
|
|
298
|
+
const swatch = e.currentTarget.dataset.value;
|
|
299
|
+
this.color.update(swatch);
|
|
300
|
+
this.emitColorChange('preset');
|
|
301
|
+
this.setCoreStyle();
|
|
302
|
+
},
|
|
303
|
+
|
|
304
|
+
setCoreStyle() {
|
|
305
|
+
this.sliderInfo = {
|
|
306
|
+
value: this.color.hue,
|
|
307
|
+
};
|
|
308
|
+
this.hueSliderStyle = this.getSliderThumbStyle({ value: this.color.hue, maxValue: HUE_MAX });
|
|
309
|
+
this.alphaSliderStyle = this.getSliderThumbStyle({ value: this.color.alpha * 100, maxValue: ALPHA_MAX });
|
|
310
|
+
this.saturationInfo = {
|
|
311
|
+
saturation: this.color.saturation,
|
|
312
|
+
value: this.color.value,
|
|
313
|
+
};
|
|
314
|
+
this.saturationThumbStyle = this.getSaturationThumbStyle({
|
|
315
|
+
saturation: this.color.saturation,
|
|
316
|
+
value: this.color.value,
|
|
317
|
+
});
|
|
318
|
+
this.previewColor = this.color.rgba;
|
|
319
|
+
this.formatList = getFormatList(this.format, this.color);
|
|
320
|
+
},
|
|
321
|
+
|
|
322
|
+
emitColorChange(trigger) {
|
|
323
|
+
this.innerValue = this.formatValue();
|
|
324
|
+
|
|
325
|
+
this.$emit('change', {
|
|
326
|
+
value: this.formatValue(),
|
|
327
|
+
context: {
|
|
328
|
+
trigger,
|
|
329
|
+
color: getColorObject(this.color),
|
|
330
|
+
},
|
|
331
|
+
});
|
|
332
|
+
},
|
|
333
|
+
|
|
334
|
+
defaultEmptyColor() {
|
|
335
|
+
return DEFAULT_COLOR;
|
|
336
|
+
},
|
|
337
|
+
|
|
338
|
+
updateColor() {
|
|
339
|
+
const result = this.innerValue || this.defaultEmptyColor();
|
|
340
|
+
this.color.update(result);
|
|
341
|
+
},
|
|
342
|
+
|
|
343
|
+
getSaturationAndValueByCoordinate(coordinate) {
|
|
344
|
+
const { width, height } = this.panelRect;
|
|
345
|
+
const { x, y } = coordinate;
|
|
346
|
+
let saturation = x / width;
|
|
347
|
+
let value = 1 - y / height;
|
|
348
|
+
saturation = Math.min(1, Math.max(0, saturation));
|
|
349
|
+
value = Math.min(1, Math.max(0, value));
|
|
350
|
+
|
|
351
|
+
return {
|
|
352
|
+
saturation,
|
|
353
|
+
value,
|
|
354
|
+
};
|
|
355
|
+
},
|
|
356
|
+
|
|
357
|
+
getSaturationThumbStyle({ saturation, value }) {
|
|
358
|
+
const { width, height } = this.panelRect;
|
|
359
|
+
const top = Math.round((1 - value) * height);
|
|
360
|
+
const left = Math.round(saturation * width);
|
|
361
|
+
return {
|
|
362
|
+
color: this.color.rgb,
|
|
363
|
+
left: `${left}px`,
|
|
364
|
+
top: `${top}px`,
|
|
365
|
+
};
|
|
366
|
+
},
|
|
367
|
+
|
|
368
|
+
getSliderThumbStyle({ value, maxValue }) {
|
|
369
|
+
const { width } = this.sliderRect;
|
|
370
|
+
if (!width) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
const left = Math.round((value / maxValue) * 100);
|
|
374
|
+
return {
|
|
375
|
+
left: `${left}%`,
|
|
376
|
+
color: this.color.rgb,
|
|
377
|
+
};
|
|
378
|
+
},
|
|
379
|
+
|
|
380
|
+
onChangeSaturation({ saturation, value }) {
|
|
381
|
+
const { saturation: sat, value: val } = this.color;
|
|
382
|
+
let changeTrigger = 'palette-saturation-brightness';
|
|
383
|
+
if (value !== val && saturation !== sat) {
|
|
384
|
+
this.color.saturation = saturation;
|
|
385
|
+
this.color.value = value;
|
|
386
|
+
changeTrigger = 'palette-saturation-brightness';
|
|
387
|
+
} else if (saturation !== sat) {
|
|
388
|
+
this.color.saturation = saturation;
|
|
389
|
+
changeTrigger = 'palette-saturation';
|
|
390
|
+
} else if (value !== val) {
|
|
391
|
+
this.color.value = value;
|
|
392
|
+
changeTrigger = 'palette-brightness';
|
|
393
|
+
} else {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
this.$emit('palette-bar-change', {
|
|
398
|
+
color: getColorObject(this.color),
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
this.emitColorChange(changeTrigger);
|
|
402
|
+
this.setCoreStyle();
|
|
403
|
+
},
|
|
404
|
+
|
|
405
|
+
formatValue() {
|
|
406
|
+
return this.color.getFormatsColorMap()[this.format] || this.color.css;
|
|
407
|
+
},
|
|
408
|
+
|
|
409
|
+
onChangeSlider({ value, isAlpha }) {
|
|
410
|
+
if (isAlpha) {
|
|
411
|
+
this.color.alpha = value / 100;
|
|
412
|
+
} else {
|
|
413
|
+
this.color.hue = value;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
this.emitColorChange(isAlpha ? 'palette-alpha-bar' : 'palette-hue-bar');
|
|
417
|
+
|
|
418
|
+
this.setCoreStyle();
|
|
419
|
+
},
|
|
420
|
+
|
|
421
|
+
handleSaturationDrag(e) {
|
|
422
|
+
const { usePopup, fixed } = this;
|
|
423
|
+
const coordinate = getCoordinate(e, this.panelRect, usePopup || fixed);
|
|
424
|
+
const { saturation, value } = this.getSaturationAndValueByCoordinate(coordinate);
|
|
425
|
+
this.onChangeSaturation({ saturation, value });
|
|
426
|
+
},
|
|
427
|
+
|
|
428
|
+
handleSliderDrag(e, isAlpha = false) {
|
|
429
|
+
const { width } = this.sliderRect;
|
|
430
|
+
const coordinate = getCoordinate(e, this.sliderRect);
|
|
431
|
+
const { x } = coordinate;
|
|
432
|
+
const maxValue = isAlpha ? ALPHA_MAX : HUE_MAX;
|
|
433
|
+
|
|
434
|
+
let value = Math.round((x / width) * maxValue * 100) / 100;
|
|
435
|
+
if (value < 0) value = 0;
|
|
436
|
+
if (value > maxValue) value = maxValue;
|
|
437
|
+
this.onChangeSlider({ value, isAlpha });
|
|
438
|
+
},
|
|
439
|
+
|
|
440
|
+
handleDiffDrag(e) {
|
|
441
|
+
const dragType = e.target.dataset.type || e.currentTarget.dataset.type;
|
|
442
|
+
switch (dragType) {
|
|
443
|
+
case 'saturation':
|
|
444
|
+
this.handleSaturationDrag(e);
|
|
445
|
+
break;
|
|
446
|
+
case 'hue-slider':
|
|
447
|
+
this.handleSliderDrag(e);
|
|
448
|
+
break;
|
|
449
|
+
case 'alpha-slider':
|
|
450
|
+
this.handleSliderDrag(e, true);
|
|
451
|
+
break;
|
|
452
|
+
default:
|
|
453
|
+
break;
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
|
|
457
|
+
onTouchStart(e) {
|
|
458
|
+
this.handleDiffDrag(e);
|
|
459
|
+
},
|
|
460
|
+
|
|
461
|
+
onTouchMove(e) {
|
|
462
|
+
this.handleDiffDrag(e);
|
|
463
|
+
},
|
|
464
|
+
|
|
465
|
+
onTouchEnd(e) {
|
|
466
|
+
nextTick().then(() => {
|
|
467
|
+
this.handleDiffDrag(e);
|
|
468
|
+
});
|
|
469
|
+
},
|
|
470
|
+
|
|
471
|
+
close(trigger) {
|
|
472
|
+
if (this.autoClose) {
|
|
473
|
+
this.dataVisible = false;
|
|
474
|
+
this.$emit('update:visible', false);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
this.$emit('close', { trigger });
|
|
478
|
+
},
|
|
479
|
+
|
|
480
|
+
onVisibleChange() {
|
|
481
|
+
this.close('overlay');
|
|
482
|
+
},
|
|
483
|
+
|
|
484
|
+
onWatchPopupVisible() {
|
|
485
|
+
if (this.timer) {
|
|
486
|
+
clearTimeout(this.timer);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
if (this.usePopup && this.dataVisible) {
|
|
490
|
+
this.timer = setTimeout(() => {
|
|
491
|
+
this.getEleReact();
|
|
492
|
+
}, 350); // popup 的 transition-duration 为 300ms,为保证 popup 已渲染完毕,故使用 350ms
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
},
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
</script>
|
|
499
|
+
<style scoped>
|
|
500
|
+
@import './color-picker.css';
|
|
501
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** 常量 */
|
|
2
|
+
|
|
3
|
+
// 默认颜色
|
|
4
|
+
export const DEFAULT_COLOR = '#001F97';
|
|
5
|
+
|
|
6
|
+
// 默认系统色彩
|
|
7
|
+
export const DEFAULT_SYSTEM_SWATCH_COLORS = [
|
|
8
|
+
'#F2F3FF',
|
|
9
|
+
'#D9E1FF',
|
|
10
|
+
'#B5C7FF',
|
|
11
|
+
'#8EABFF',
|
|
12
|
+
'#618DFF',
|
|
13
|
+
'#366EF4',
|
|
14
|
+
'#0052D9',
|
|
15
|
+
'#003CAB',
|
|
16
|
+
'#002A7C',
|
|
17
|
+
'#001A57',
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
// saturation-panel default rect
|
|
21
|
+
export const SATURATION_PANEL_DEFAULT_WIDTH = 343;
|
|
22
|
+
export const SATURATION_PANEL_DEFAULT_HEIGHT = 144;
|
|
23
|
+
export const SLIDER_DEFAULT_WIDTH = 303;
|
|
24
|
+
|
|
25
|
+
export const HUE_MAX = 360;
|
|
26
|
+
export const ALPHA_MAX = 100;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
|
|
5
|
+
* */
|
|
6
|
+
|
|
7
|
+
import type { TdColorPickerProps } from './type';
|
|
8
|
+
export default {
|
|
9
|
+
/** 自动关闭。在点击遮罩层时自动关闭,不需要手动设置 visible */
|
|
10
|
+
autoClose: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: true,
|
|
13
|
+
},
|
|
14
|
+
/** 是否开启透明通道 */
|
|
15
|
+
enableAlpha: Boolean,
|
|
16
|
+
/** 如果 color-picker 是在一个 `position:fixed` 的区域,需要显式指定属性 fixed 为 true */
|
|
17
|
+
fixed: Boolean,
|
|
18
|
+
/** 格式化色值。`enableAlpha` 为真时,`HEX8/RGBA/HSLA/HSVA` 有效 */
|
|
19
|
+
format: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: 'RGB' as TdColorPickerProps['format'],
|
|
22
|
+
validator(val: TdColorPickerProps['format']): boolean {
|
|
23
|
+
if (!val) return true;
|
|
24
|
+
return ['HEX', 'HEX8', 'RGB', 'RGBA', 'HSL', 'HSLA', 'HSV', 'HSVA', 'CMYK', 'CSS'].includes(val);
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
/** 透传 Popup 组件全部属性 */
|
|
28
|
+
popupProps: {
|
|
29
|
+
type: Object,
|
|
30
|
+
default: () => ({}),
|
|
31
|
+
},
|
|
32
|
+
/** 系统预设的颜色样例,值为 `null` 或 `[]` 则不显示系统色,值为 `undefined` 会显示组件内置的系统默认色 */
|
|
33
|
+
swatchColors: {
|
|
34
|
+
type: Array,
|
|
35
|
+
default: undefined as TdColorPickerProps['swatchColors'],
|
|
36
|
+
},
|
|
37
|
+
/** 颜色选择器类型。(base 表示仅展示系统预设内容; multiple 表示展示色板和系统预设内容 */
|
|
38
|
+
type: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: 'base' as TdColorPickerProps['type'],
|
|
41
|
+
validator(val: TdColorPickerProps['type']): boolean {
|
|
42
|
+
if (!val) return true;
|
|
43
|
+
return ['base', 'multiple'].includes(val);
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
/** 是否使用弹出层包裹颜色选择器 */
|
|
47
|
+
usePopup: Boolean,
|
|
48
|
+
/** 色值 */
|
|
49
|
+
value: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: '',
|
|
52
|
+
},
|
|
53
|
+
/** 色值,非受控属性 */
|
|
54
|
+
defaultValue: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: '',
|
|
57
|
+
},
|
|
58
|
+
/** 是否显示颜色选择器。`usePopup` 为 true 时有效 */
|
|
59
|
+
visible: Boolean,
|
|
60
|
+
/** 选中的色值发生变化时触发,第一个参数 `value` 表示新色值,`context.color` 表示当前调色板控制器的色值,`context.trigger` 表示触发颜色变化的来源 */
|
|
61
|
+
onChange: {
|
|
62
|
+
type: Function,
|
|
63
|
+
default: () => ({}),
|
|
64
|
+
},
|
|
65
|
+
/** 关闭按钮时触发 */
|
|
66
|
+
onClose: {
|
|
67
|
+
type: Function,
|
|
68
|
+
default: () => ({}),
|
|
69
|
+
},
|
|
70
|
+
/** 调色板控制器的值变化时触发,`context.color` 指调色板控制器的值 */
|
|
71
|
+
onPaletteBarChange: {
|
|
72
|
+
type: Function,
|
|
73
|
+
default: () => ({}),
|
|
74
|
+
},
|
|
75
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
classPrefix: {
|
|
3
|
+
type: String,
|
|
4
|
+
default: '',
|
|
5
|
+
},
|
|
6
|
+
customStyle: {
|
|
7
|
+
type: [String, Object],
|
|
8
|
+
default: '',
|
|
9
|
+
},
|
|
10
|
+
isMultiple: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: false,
|
|
13
|
+
},
|
|
14
|
+
type: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: '',
|
|
17
|
+
},
|
|
18
|
+
sliderInfo: {
|
|
19
|
+
type: Object,
|
|
20
|
+
default: () => ({}),
|
|
21
|
+
},
|
|
22
|
+
saturationThumbStyle: {
|
|
23
|
+
type: [String, Object],
|
|
24
|
+
default: '',
|
|
25
|
+
},
|
|
26
|
+
hueSliderStyle: {
|
|
27
|
+
type: [String, Object],
|
|
28
|
+
default: '',
|
|
29
|
+
},
|
|
30
|
+
enableAlpha: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false,
|
|
33
|
+
},
|
|
34
|
+
alphaSliderStyle: {
|
|
35
|
+
type: [String, Object],
|
|
36
|
+
default: '',
|
|
37
|
+
},
|
|
38
|
+
showPrimaryColorPreview: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: false,
|
|
41
|
+
},
|
|
42
|
+
previewColor: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: '',
|
|
45
|
+
},
|
|
46
|
+
formatList: {
|
|
47
|
+
type: Array,
|
|
48
|
+
default: () => ([]),
|
|
49
|
+
},
|
|
50
|
+
innerSwatchList: {
|
|
51
|
+
type: Array,
|
|
52
|
+
default: () => ([]),
|
|
53
|
+
},
|
|
54
|
+
format: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: 'RGB',
|
|
57
|
+
},
|
|
58
|
+
};
|