Commit 51c0ab1abf8ed0f140d2ee79dda5c6d04a46be70
1 parent
51648b0d
refactor: update color picker to support alpha
zh: 更新颜色选择器来支持透明度选择
Showing
7 changed files
with
77 additions
and
19 deletions
front-end/h5/babel.config.js
front-end/h5/package.json
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | "animate.css": "^3.7.2", | 19 | "animate.css": "^3.7.2", |
| 20 | "ant-design-vue": "^1.3.14", | 20 | "ant-design-vue": "^1.3.14", |
| 21 | "core-js": "^2.6.5", | 21 | "core-js": "^2.6.5", |
| 22 | - "element-ui": "^2.9.1", | 22 | + "element-ui": "^2.13.0", |
| 23 | "font-awesome": "4.7.0", | 23 | "font-awesome": "4.7.0", |
| 24 | "html2canvas": "^1.0.0-rc.3", | 24 | "html2canvas": "^1.0.0-rc.3", |
| 25 | "medium-editor": "^5.23.3", | 25 | "medium-editor": "^5.23.3", |
| @@ -39,7 +39,6 @@ | @@ -39,7 +39,6 @@ | ||
| 39 | "vuex": "^3.0.1" | 39 | "vuex": "^3.0.1" |
| 40 | }, | 40 | }, |
| 41 | "devDependencies": { | 41 | "devDependencies": { |
| 42 | - "dart-sass": "^1.23.7", | ||
| 43 | "@vue/cli-plugin-babel": "^3.8.0", | 42 | "@vue/cli-plugin-babel": "^3.8.0", |
| 44 | "@vue/cli-plugin-eslint": "^3.8.0", | 43 | "@vue/cli-plugin-eslint": "^3.8.0", |
| 45 | "@vue/cli-plugin-pwa": "^3.8.0", | 44 | "@vue/cli-plugin-pwa": "^3.8.0", |
| @@ -50,6 +49,8 @@ | @@ -50,6 +49,8 @@ | ||
| 50 | "babel-core": "7.0.0-bridge.0", | 49 | "babel-core": "7.0.0-bridge.0", |
| 51 | "babel-eslint": "^10.0.1", | 50 | "babel-eslint": "^10.0.1", |
| 52 | "babel-jest": "^23.6.0", | 51 | "babel-jest": "^23.6.0", |
| 52 | + "babel-plugin-component": "^1.1.1", | ||
| 53 | + "dart-sass": "^1.23.7", | ||
| 53 | "eslint": "^5.16.0", | 54 | "eslint": "^5.16.0", |
| 54 | "eslint-plugin-vue": "^5.0.0", | 55 | "eslint-plugin-vue": "^5.0.0", |
| 55 | "sass": "^1.18.0", | 56 | "sass": "^1.18.0", |
front-end/h5/src/components/core/models/element.js
| @@ -12,7 +12,7 @@ const defaultStyle = { | @@ -12,7 +12,7 @@ const defaultStyle = { | ||
| 12 | zindex: 1, | 12 | zindex: 1, |
| 13 | textAlign: 'center', | 13 | textAlign: 'center', |
| 14 | color: '#000000', | 14 | color: '#000000', |
| 15 | - backgroundColor: '#ffffff', | 15 | + backgroundColor: 'rgba(255, 255, 255, 0)', |
| 16 | fontSize: 14 | 16 | fontSize: 14 |
| 17 | } | 17 | } |
| 18 | 18 |
front-end/h5/src/components/plugins/common/props.js
| @@ -31,12 +31,13 @@ export default { | @@ -31,12 +31,13 @@ export default { | ||
| 31 | }, | 31 | }, |
| 32 | backgroundColor: { | 32 | backgroundColor: { |
| 33 | type: String, | 33 | type: String, |
| 34 | - default: '#ffffff', | 34 | + default: 'rgba(255, 255, 255, 0.2)', |
| 35 | editor: { | 35 | editor: { |
| 36 | - type: 'a-input', // lbs-color-picker | 36 | + type: 'el-color-picker', |
| 37 | label: '背景颜色', | 37 | label: '背景颜色', |
| 38 | prop: { | 38 | prop: { |
| 39 | - type: 'color' | 39 | + size: 'mini', |
| 40 | + showAlpha: true | ||
| 40 | }, | 41 | }, |
| 41 | require: true | 42 | require: true |
| 42 | } | 43 | } |
| @@ -48,11 +49,12 @@ export default { | @@ -48,11 +49,12 @@ export default { | ||
| 48 | // The value of an <input> element of type color is always a DOMString which contains a 7-character string specifying an RGB color in hexadecimal format. | 49 | // The value of an <input> element of type color is always a DOMString which contains a 7-character string specifying an RGB color in hexadecimal format. |
| 49 | default: '#000000', | 50 | default: '#000000', |
| 50 | editor: { | 51 | editor: { |
| 51 | - type: 'a-input', | 52 | + type: 'el-color-picker', |
| 52 | label: '文字颜色', | 53 | label: '文字颜色', |
| 53 | // !#zh 为编辑组件指定 prop | 54 | // !#zh 为编辑组件指定 prop |
| 54 | prop: { | 55 | prop: { |
| 55 | - type: 'color' | 56 | + size: 'mini', |
| 57 | + showAlpha: true | ||
| 56 | }, | 58 | }, |
| 57 | require: true | 59 | require: true |
| 58 | } | 60 | } |
| @@ -117,10 +119,11 @@ export default { | @@ -117,10 +119,11 @@ export default { | ||
| 117 | type: String, | 119 | type: String, |
| 118 | default: '#ced4da', | 120 | default: '#ced4da', |
| 119 | editor: { | 121 | editor: { |
| 120 | - type: 'a-input', // lbs-color-picker | 122 | + type: 'el-color-picker', |
| 121 | label: '边框颜色', | 123 | label: '边框颜色', |
| 122 | prop: { | 124 | prop: { |
| 123 | - type: 'color' | 125 | + size: 'mini', |
| 126 | + showAlpha: true | ||
| 124 | }, | 127 | }, |
| 125 | require: true | 128 | require: true |
| 126 | } | 129 | } |
front-end/h5/src/components/plugins/lbp-background.js
| 1 | +/* | ||
| 2 | + * @Author: ly525 | ||
| 3 | + * @Date: 2019-11-24 18:51:58 | ||
| 4 | + * @LastEditors: ly525 | ||
| 5 | + * @LastEditTime: 2019-11-30 23:02:31 | ||
| 6 | + * @FilePath: /luban-h5/front-end/h5/src/components/plugins/lbp-background.js | ||
| 7 | + * @Github: https://github.com/ly525/luban-h5 | ||
| 8 | + * @Description: luban-h5 background image/color component/plugin | ||
| 9 | + * @Copyright 2018 - 2019 luban-h5. All Rights Reserved | ||
| 10 | + */ | ||
| 1 | export default { | 11 | export default { |
| 2 | name: 'lbp-background', | 12 | name: 'lbp-background', |
| 3 | render () { | 13 | render () { |
| @@ -46,12 +56,13 @@ export default { | @@ -46,12 +56,13 @@ export default { | ||
| 46 | // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/color#Value | 56 | // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/color#Value |
| 47 | // The value of an <input> element of type color is always a DOMString which contains a 7-character string specifying an RGB color in hexadecimal format. | 57 | // The value of an <input> element of type color is always a DOMString which contains a 7-character string specifying an RGB color in hexadecimal format. |
| 48 | 58 | ||
| 49 | - default: '#ffffff', | 59 | + default: 'rgba(255, 255, 255, 0.2)', |
| 50 | editor: { | 60 | editor: { |
| 51 | - type: 'a-input', // lbs-color-picker | 61 | + type: 'el-color-picker', |
| 52 | label: '背景颜色', | 62 | label: '背景颜色', |
| 53 | prop: { | 63 | prop: { |
| 54 | - type: 'color' | 64 | + size: 'mini', |
| 65 | + showAlpha: true | ||
| 55 | }, | 66 | }, |
| 56 | require: true | 67 | require: true |
| 57 | } | 68 | } |
front-end/h5/src/main.js
| @@ -5,6 +5,7 @@ import store from './store/' | @@ -5,6 +5,7 @@ import store from './store/' | ||
| 5 | import i18n from './locales' | 5 | import i18n from './locales' |
| 6 | // import './registerServiceWorker' | 6 | // import './registerServiceWorker' |
| 7 | // import ElementUI from 'element-ui' | 7 | // import ElementUI from 'element-ui' |
| 8 | +import { ColorPicker, Button } from 'element-ui' | ||
| 8 | import Antd from 'ant-design-vue' | 9 | import Antd from 'ant-design-vue' |
| 9 | 10 | ||
| 10 | // import 'element-ui/lib/theme-chalk/index.css' | 11 | // import 'element-ui/lib/theme-chalk/index.css' |
| @@ -16,7 +17,15 @@ import vClickOutside from 'v-click-outside' | @@ -16,7 +17,15 @@ import vClickOutside from 'v-click-outside' | ||
| 16 | Vue.config.productionTip = false | 17 | Vue.config.productionTip = false |
| 17 | Vue.use(Antd) | 18 | Vue.use(Antd) |
| 18 | Vue.use(vClickOutside) | 19 | Vue.use(vClickOutside) |
| 19 | -// Vue.use(ElementUI) | 20 | + |
| 21 | +/** | ||
| 22 | + * #!en import element-ui color picker for bgcolor、color, because a-input(ant-design-vue) component do not support alpha | ||
| 23 | + * #!zh 引入 element-ui 颜色选择器,因为 ant-design-vue 没有提供颜色选择器,默认的 <a-input type="color" /> 不支持选择透明度 | ||
| 24 | + * | ||
| 25 | + * https://github.com/ly525/luban-h5/issues/105 | ||
| 26 | + */ | ||
| 27 | +Vue.component(Button.name, Button) | ||
| 28 | +Vue.component(ColorPicker.name, ColorPicker) | ||
| 20 | 29 | ||
| 21 | new Vue({ | 30 | new Vue({ |
| 22 | router, | 31 | router, |
front-end/h5/yarn.lock
| @@ -142,6 +142,14 @@ | @@ -142,6 +142,14 @@ | ||
| 142 | dependencies: | 142 | dependencies: |
| 143 | "@babel/types" "^7.5.5" | 143 | "@babel/types" "^7.5.5" |
| 144 | 144 | ||
| 145 | +"@babel/helper-module-imports@7.0.0-beta.35": | ||
| 146 | + version "7.0.0-beta.35" | ||
| 147 | + resolved "https://registry.npm.taobao.org/@babel/helper-module-imports/download/@babel/helper-module-imports-7.0.0-beta.35.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fhelper-module-imports%2Fdownload%2F%40babel%2Fhelper-module-imports-7.0.0-beta.35.tgz#308e350e731752cdb4d0f058df1d704925c64e0a" | ||
| 148 | + integrity sha1-MI41DnMXUs200PBY3x1wSSXGTgo= | ||
| 149 | + dependencies: | ||
| 150 | + "@babel/types" "7.0.0-beta.35" | ||
| 151 | + lodash "^4.2.0" | ||
| 152 | + | ||
| 145 | "@babel/helper-module-imports@^7.0.0": | 153 | "@babel/helper-module-imports@^7.0.0": |
| 146 | version "7.0.0" | 154 | version "7.0.0" |
| 147 | resolved "https://registry.npm.taobao.org/@babel/helper-module-imports/download/@babel/helper-module-imports-7.0.0.tgz#96081b7111e486da4d2cd971ad1a4fe216cc2e3d" | 155 | resolved "https://registry.npm.taobao.org/@babel/helper-module-imports/download/@babel/helper-module-imports-7.0.0.tgz#96081b7111e486da4d2cd971ad1a4fe216cc2e3d" |
| @@ -687,6 +695,15 @@ | @@ -687,6 +695,15 @@ | ||
| 687 | globals "^11.1.0" | 695 | globals "^11.1.0" |
| 688 | lodash "^4.17.13" | 696 | lodash "^4.17.13" |
| 689 | 697 | ||
| 698 | +"@babel/types@7.0.0-beta.35": | ||
| 699 | + version "7.0.0-beta.35" | ||
| 700 | + resolved "https://registry.npm.taobao.org/@babel/types/download/@babel/types-7.0.0-beta.35.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Ftypes%2Fdownload%2F%40babel%2Ftypes-7.0.0-beta.35.tgz#cf933a9a9a38484ca724b335b88d83726d5ab960" | ||
| 701 | + integrity sha1-z5M6mpo4SEynJLM1uI2Dcm1auWA= | ||
| 702 | + dependencies: | ||
| 703 | + esutils "^2.0.2" | ||
| 704 | + lodash "^4.2.0" | ||
| 705 | + to-fast-properties "^2.0.0" | ||
| 706 | + | ||
| 690 | "@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.4.4", "@babel/types@^7.5.5", "@babel/types@^7.6.0", "@babel/types@^7.6.3": | 707 | "@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.4.4", "@babel/types@^7.5.5", "@babel/types@^7.6.0", "@babel/types@^7.6.3": |
| 691 | version "7.6.3" | 708 | version "7.6.3" |
| 692 | resolved "https://registry.npm.taobao.org/@babel/types/download/@babel/types-7.6.3.tgz#3f07d96f854f98e2fbd45c64b0cb942d11e8ba09" | 709 | resolved "https://registry.npm.taobao.org/@babel/types/download/@babel/types-7.6.3.tgz#3f07d96f854f98e2fbd45c64b0cb942d11e8ba09" |
| @@ -1932,6 +1949,13 @@ babel-messages@^6.23.0: | @@ -1932,6 +1949,13 @@ babel-messages@^6.23.0: | ||
| 1932 | dependencies: | 1949 | dependencies: |
| 1933 | babel-runtime "^6.22.0" | 1950 | babel-runtime "^6.22.0" |
| 1934 | 1951 | ||
| 1952 | +babel-plugin-component@^1.1.1: | ||
| 1953 | + version "1.1.1" | ||
| 1954 | + resolved "https://registry.npm.taobao.org/babel-plugin-component/download/babel-plugin-component-1.1.1.tgz#9b023a23ff5c9aae0fd56c5a18b9cab8c4d45eea" | ||
| 1955 | + integrity sha1-mwI6I/9cmq4P1WxaGLnKuMTUXuo= | ||
| 1956 | + dependencies: | ||
| 1957 | + "@babel/helper-module-imports" "7.0.0-beta.35" | ||
| 1958 | + | ||
| 1935 | babel-plugin-dynamic-import-node@^2.2.0, babel-plugin-dynamic-import-node@^2.3.0: | 1959 | babel-plugin-dynamic-import-node@^2.2.0, babel-plugin-dynamic-import-node@^2.3.0: |
| 1936 | version "2.3.0" | 1960 | version "2.3.0" |
| 1937 | resolved "https://registry.npm.taobao.org/babel-plugin-dynamic-import-node/download/babel-plugin-dynamic-import-node-2.3.0.tgz#f00f507bdaa3c3e3ff6e7e5e98d90a7acab96f7f" | 1961 | resolved "https://registry.npm.taobao.org/babel-plugin-dynamic-import-node/download/babel-plugin-dynamic-import-node-2.3.0.tgz#f00f507bdaa3c3e3ff6e7e5e98d90a7acab96f7f" |
| @@ -3971,10 +3995,10 @@ electron-to-chromium@^1.3.295: | @@ -3971,10 +3995,10 @@ electron-to-chromium@^1.3.295: | ||
| 3971 | resolved "https://registry.npm.taobao.org/electron-to-chromium/download/electron-to-chromium-1.3.302.tgz?cache=0&sync_timestamp=1572711562817&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Felectron-to-chromium%2Fdownload%2Felectron-to-chromium-1.3.302.tgz#4c7ba3d56166507a56f7eb603fdde1ed701f5ac8" | 3995 | resolved "https://registry.npm.taobao.org/electron-to-chromium/download/electron-to-chromium-1.3.302.tgz?cache=0&sync_timestamp=1572711562817&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Felectron-to-chromium%2Fdownload%2Felectron-to-chromium-1.3.302.tgz#4c7ba3d56166507a56f7eb603fdde1ed701f5ac8" |
| 3972 | integrity sha1-THuj1WFmUHpW9+tgP93h7XAfWsg= | 3996 | integrity sha1-THuj1WFmUHpW9+tgP93h7XAfWsg= |
| 3973 | 3997 | ||
| 3974 | -element-ui@^2.9.1: | ||
| 3975 | - version "2.12.0" | ||
| 3976 | - resolved "https://registry.npm.taobao.org/element-ui/download/element-ui-2.12.0.tgz#a893bc11ae4f7dbb7e9d541606f23e643f131ee4" | ||
| 3977 | - integrity sha1-qJO8Ea5Pfbt+nVQWBvI+ZD8THuQ= | 3998 | +element-ui@^2.13.0: |
| 3999 | + version "2.13.0" | ||
| 4000 | + resolved "https://registry.npm.taobao.org/element-ui/download/element-ui-2.13.0.tgz#f6bb04e5b0a76ea5f62466044b774407ba4ebd2d" | ||
| 4001 | + integrity sha1-9rsE5bCnbqX2JGYES3dEB7pOvS0= | ||
| 3978 | dependencies: | 4002 | dependencies: |
| 3979 | async-validator "~1.8.1" | 4003 | async-validator "~1.8.1" |
| 3980 | babel-helper-vue-jsx-merge-props "^2.0.0" | 4004 | babel-helper-vue-jsx-merge-props "^2.0.0" |
| @@ -7065,7 +7089,7 @@ lodash.uniq@^4.5.0: | @@ -7065,7 +7089,7 @@ lodash.uniq@^4.5.0: | ||
| 7065 | resolved "https://registry.npm.taobao.org/lodash.uniq/download/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" | 7089 | resolved "https://registry.npm.taobao.org/lodash.uniq/download/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" |
| 7066 | integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= | 7090 | integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= |
| 7067 | 7091 | ||
| 7068 | -lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0: | 7092 | +lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0, lodash@^4.3.0: |
| 7069 | version "4.17.15" | 7093 | version "4.17.15" |
| 7070 | resolved "https://registry.npm.taobao.org/lodash/download/lodash-4.17.15.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" | 7094 | resolved "https://registry.npm.taobao.org/lodash/download/lodash-4.17.15.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" |
| 7071 | integrity sha1-tEf2ZwoEVbv+7dETku/zMOoJdUg= | 7095 | integrity sha1-tEf2ZwoEVbv+7dETku/zMOoJdUg= |