goodteditor-ui 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/.eslintrc.js +7 -7
  2. package/.idea/codeStyles/Project.xml +51 -0
  3. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  4. package/.idea/goodt-ui.iml +12 -0
  5. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  6. package/.idea/modules.xml +8 -0
  7. package/.idea/vcs.xml +6 -0
  8. package/.prettierrc +14 -14
  9. package/README.md +35 -35
  10. package/babel.config.js +5 -5
  11. package/index.js +51 -49
  12. package/jsconfig.json +13 -13
  13. package/package.json +57 -57
  14. package/src/App.vue +36 -36
  15. package/src/components/ui/Avatar.md +68 -0
  16. package/src/components/ui/Avatar.vue +177 -0
  17. package/src/components/ui/Badge.md +20 -20
  18. package/src/components/ui/Badge.vue +75 -75
  19. package/src/components/ui/Collapse.md +90 -90
  20. package/src/components/ui/Collapse.vue +86 -86
  21. package/src/components/ui/ColorPicker/Alpha.vue +114 -114
  22. package/src/components/ui/ColorPicker/Colors.vue +117 -117
  23. package/src/components/ui/ColorPicker/Hue.vue +113 -113
  24. package/src/components/ui/ColorPicker/Preview.vue +55 -55
  25. package/src/components/ui/ColorPicker/Saturation.vue +123 -123
  26. package/src/components/ui/ColorPicker/mixin.js +105 -105
  27. package/src/components/ui/ColorPicker.md +17 -17
  28. package/src/components/ui/ColorPicker.vue +314 -314
  29. package/src/components/ui/Datalist.md +41 -41
  30. package/src/components/ui/Datalist.vue +157 -157
  31. package/src/components/ui/DatePicker.md +168 -168
  32. package/src/components/ui/DatePicker.vue +527 -527
  33. package/src/components/ui/FileSelector.md +105 -105
  34. package/src/components/ui/FileSelector.vue +82 -82
  35. package/src/components/ui/Grid.md +130 -130
  36. package/src/components/ui/Grid.vue +92 -92
  37. package/src/components/ui/Image.md +59 -59
  38. package/src/components/ui/Image.vue +57 -57
  39. package/src/components/ui/InputAutocomplete.md +115 -115
  40. package/src/components/ui/InputAutocomplete.vue +341 -341
  41. package/src/components/ui/InputColorPicker.md +51 -51
  42. package/src/components/ui/InputColorPicker.vue +151 -151
  43. package/src/components/ui/InputDatePicker.md +121 -121
  44. package/src/components/ui/InputDatePicker.vue +310 -310
  45. package/src/components/ui/InputTags.md +51 -51
  46. package/src/components/ui/InputTags.vue +184 -184
  47. package/src/components/ui/InputTimePicker.md +25 -25
  48. package/src/components/ui/InputTimePicker.vue +253 -253
  49. package/src/components/ui/InputUnits.md +20 -20
  50. package/src/components/ui/InputUnits.vue +257 -257
  51. package/src/components/ui/Lazy.md +37 -37
  52. package/src/components/ui/Lazy.vue +92 -92
  53. package/src/components/ui/Pagination.md +74 -74
  54. package/src/components/ui/Pagination.vue +138 -138
  55. package/src/components/ui/Paginator.md +34 -34
  56. package/src/components/ui/Paginator.vue +83 -83
  57. package/src/components/ui/Popover.md +34 -34
  58. package/src/components/ui/Popover.vue +209 -209
  59. package/src/components/ui/Popup.md +59 -59
  60. package/src/components/ui/Popup.vue +150 -150
  61. package/src/components/ui/ResponsiveContainer.md +58 -58
  62. package/src/components/ui/ResponsiveContainer.vue +99 -99
  63. package/src/components/ui/Select.md +187 -187
  64. package/src/components/ui/Select.vue +420 -420
  65. package/src/components/ui/TimePicker.md +50 -50
  66. package/src/components/ui/TimePicker.vue +252 -252
  67. package/src/components/ui/Tooltip.md +52 -52
  68. package/src/components/ui/Tooltip.vue +113 -113
  69. package/src/components/ui/utils/FormComponent.js +107 -107
  70. package/src/components/ui/utils/Helpers.js +61 -61
  71. package/src/components/ui/utils/WithPopover.js +81 -81
  72. package/src/main.js +8 -8
  73. package/styleguide.config.js +37 -37
  74. package/vue.config.js +8 -8
  75. package/dist/js.png +0 -0
@@ -1,113 +1,113 @@
1
- <template>
2
- <div class="ui-color-picker-hue" @mousedown.prevent.stop="selectHue">
3
- <canvas ref="canvasHue" />
4
- <div class="slide" :style="slideHueStyle" />
5
- </div>
6
- </template>
7
- <style lang="less" scoped>
8
- .ui-color-picker-hue {
9
- position: relative;
10
- cursor: pointer;
11
- .slide {
12
- position: absolute;
13
- left: 0;
14
- top: 100px;
15
- width: 100%;
16
- height: 4px;
17
- background: #fff;
18
- box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.3);
19
- pointer-events: none;
20
- }
21
- }
22
- </style>
23
- <script>
24
- export default {
25
- props: {
26
- hsv: {
27
- type: Object,
28
- default: null,
29
- },
30
- width: {
31
- type: Number,
32
- default: 15,
33
- },
34
- height: {
35
- type: Number,
36
- default: 152,
37
- },
38
- },
39
- data() {
40
- return {
41
- slideHueStyle: {},
42
- };
43
- },
44
- // 不能监听,否则操作saturation时,这里的slide会抖动
45
- // watch: {
46
- // 'hsv.h'() {
47
- // this.renderSlide()
48
- // }
49
- // },
50
- mounted() {
51
- this.renderColor();
52
- this.renderSlide();
53
- },
54
- methods: {
55
- renderColor() {
56
- const canvas = this.$refs.canvasHue;
57
- const width = this.width;
58
- const height = this.height;
59
- const ctx = canvas.getContext('2d');
60
- canvas.width = width;
61
- canvas.height = height;
62
-
63
- const gradient = ctx.createLinearGradient(0, 0, 0, height);
64
- gradient.addColorStop(0, '#FF0000'); // 红
65
- gradient.addColorStop(0.17 * 1, '#FF00FF'); // 紫
66
- gradient.addColorStop(0.17 * 2, '#0000FF'); // 蓝
67
- gradient.addColorStop(0.17 * 3, '#00FFFF'); // 青
68
- gradient.addColorStop(0.17 * 4, '#00FF00'); // 绿
69
- gradient.addColorStop(0.17 * 5, '#FFFF00'); // 黄
70
- gradient.addColorStop(1, '#FF0000'); // 红
71
- ctx.fillStyle = gradient;
72
- ctx.fillRect(0, 0, width, height);
73
- },
74
- renderSlide() {
75
- this.slideHueStyle = {
76
- top: (1 - this.hsv.h / 360) * this.height - 2 + 'px',
77
- };
78
- },
79
- selectHue(e) {
80
- const { top: hueTop } = this.$el.getBoundingClientRect();
81
- const ctx = e.target.getContext('2d');
82
-
83
- const mousemove = e => {
84
- let y = e.clientY - hueTop;
85
-
86
- if (y < 0) {
87
- y = 0;
88
- }
89
- if (y > this.height) {
90
- y = this.height;
91
- }
92
-
93
- this.slideHueStyle = {
94
- top: y - 2 + 'px',
95
- };
96
- const imgData = ctx.getImageData(0, Math.min(y, this.height - 1), 1, 1);
97
- const [r, g, b] = imgData.data;
98
- this.$emit('selectHue', { r, g, b });
99
- };
100
-
101
- mousemove(e);
102
-
103
- const mouseup = () => {
104
- document.removeEventListener('mousemove', mousemove);
105
- document.removeEventListener('mouseup', mouseup);
106
- };
107
-
108
- document.addEventListener('mousemove', mousemove);
109
- document.addEventListener('mouseup', mouseup);
110
- },
111
- },
112
- };
113
- </script>
1
+ <template>
2
+ <div class="ui-color-picker-hue" @mousedown.prevent.stop="selectHue">
3
+ <canvas ref="canvasHue" />
4
+ <div class="slide" :style="slideHueStyle" />
5
+ </div>
6
+ </template>
7
+ <style lang="less" scoped>
8
+ .ui-color-picker-hue {
9
+ position: relative;
10
+ cursor: pointer;
11
+ .slide {
12
+ position: absolute;
13
+ left: 0;
14
+ top: 100px;
15
+ width: 100%;
16
+ height: 4px;
17
+ background: #fff;
18
+ box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.3);
19
+ pointer-events: none;
20
+ }
21
+ }
22
+ </style>
23
+ <script>
24
+ export default {
25
+ props: {
26
+ hsv: {
27
+ type: Object,
28
+ default: null,
29
+ },
30
+ width: {
31
+ type: Number,
32
+ default: 15,
33
+ },
34
+ height: {
35
+ type: Number,
36
+ default: 152,
37
+ },
38
+ },
39
+ data() {
40
+ return {
41
+ slideHueStyle: {},
42
+ };
43
+ },
44
+ // 不能监听,否则操作saturation时,这里的slide会抖动
45
+ // watch: {
46
+ // 'hsv.h'() {
47
+ // this.renderSlide()
48
+ // }
49
+ // },
50
+ mounted() {
51
+ this.renderColor();
52
+ this.renderSlide();
53
+ },
54
+ methods: {
55
+ renderColor() {
56
+ const canvas = this.$refs.canvasHue;
57
+ const width = this.width;
58
+ const height = this.height;
59
+ const ctx = canvas.getContext('2d');
60
+ canvas.width = width;
61
+ canvas.height = height;
62
+
63
+ const gradient = ctx.createLinearGradient(0, 0, 0, height);
64
+ gradient.addColorStop(0, '#FF0000'); // 红
65
+ gradient.addColorStop(0.17 * 1, '#FF00FF'); // 紫
66
+ gradient.addColorStop(0.17 * 2, '#0000FF'); // 蓝
67
+ gradient.addColorStop(0.17 * 3, '#00FFFF'); // 青
68
+ gradient.addColorStop(0.17 * 4, '#00FF00'); // 绿
69
+ gradient.addColorStop(0.17 * 5, '#FFFF00'); // 黄
70
+ gradient.addColorStop(1, '#FF0000'); // 红
71
+ ctx.fillStyle = gradient;
72
+ ctx.fillRect(0, 0, width, height);
73
+ },
74
+ renderSlide() {
75
+ this.slideHueStyle = {
76
+ top: (1 - this.hsv.h / 360) * this.height - 2 + 'px',
77
+ };
78
+ },
79
+ selectHue(e) {
80
+ const { top: hueTop } = this.$el.getBoundingClientRect();
81
+ const ctx = e.target.getContext('2d');
82
+
83
+ const mousemove = e => {
84
+ let y = e.clientY - hueTop;
85
+
86
+ if (y < 0) {
87
+ y = 0;
88
+ }
89
+ if (y > this.height) {
90
+ y = this.height;
91
+ }
92
+
93
+ this.slideHueStyle = {
94
+ top: y - 2 + 'px',
95
+ };
96
+ const imgData = ctx.getImageData(0, Math.min(y, this.height - 1), 1, 1);
97
+ const [r, g, b] = imgData.data;
98
+ this.$emit('selectHue', { r, g, b });
99
+ };
100
+
101
+ mousemove(e);
102
+
103
+ const mouseup = () => {
104
+ document.removeEventListener('mousemove', mousemove);
105
+ document.removeEventListener('mouseup', mouseup);
106
+ };
107
+
108
+ document.addEventListener('mousemove', mousemove);
109
+ document.addEventListener('mouseup', mouseup);
110
+ },
111
+ },
112
+ };
113
+ </script>
@@ -1,55 +1,55 @@
1
- <template>
2
- <canvas />
3
- </template>
4
- <script>
5
- import mixin from './mixin';
6
- export default {
7
- mixins: [mixin],
8
- props: {
9
- color: {
10
- type: String,
11
- default: '#000000'
12
- },
13
- width: {
14
- type: Number,
15
- default: 100
16
- },
17
- height: {
18
- type: Number,
19
- default: 30
20
- }
21
- },
22
- data() {
23
- return {
24
- alphaSize: 5
25
- };
26
- },
27
- watch: {
28
- color() {
29
- this.renderColor();
30
- }
31
- },
32
- mounted() {
33
- this.renderColor();
34
- },
35
- methods: {
36
- renderColor() {
37
- const canvas = this.$el;
38
- const width = this.width;
39
- const height = this.height;
40
- const size = this.alphaSize;
41
- const canvasSquare = this.createAlphaSquare(size);
42
-
43
- const ctx = canvas.getContext('2d');
44
- canvas.width = width;
45
- canvas.height = height;
46
-
47
- ctx.fillStyle = ctx.createPattern(canvasSquare, 'repeat');
48
- ctx.fillRect(0, 0, width, height);
49
-
50
- ctx.fillStyle = this.color;
51
- ctx.fillRect(0, 0, width, height);
52
- }
53
- }
54
- };
55
- </script>
1
+ <template>
2
+ <canvas />
3
+ </template>
4
+ <script>
5
+ import mixin from './mixin';
6
+ export default {
7
+ mixins: [mixin],
8
+ props: {
9
+ color: {
10
+ type: String,
11
+ default: '#000000'
12
+ },
13
+ width: {
14
+ type: Number,
15
+ default: 100
16
+ },
17
+ height: {
18
+ type: Number,
19
+ default: 30
20
+ }
21
+ },
22
+ data() {
23
+ return {
24
+ alphaSize: 5
25
+ };
26
+ },
27
+ watch: {
28
+ color() {
29
+ this.renderColor();
30
+ }
31
+ },
32
+ mounted() {
33
+ this.renderColor();
34
+ },
35
+ methods: {
36
+ renderColor() {
37
+ const canvas = this.$el;
38
+ const width = this.width;
39
+ const height = this.height;
40
+ const size = this.alphaSize;
41
+ const canvasSquare = this.createAlphaSquare(size);
42
+
43
+ const ctx = canvas.getContext('2d');
44
+ canvas.width = width;
45
+ canvas.height = height;
46
+
47
+ ctx.fillStyle = ctx.createPattern(canvasSquare, 'repeat');
48
+ ctx.fillRect(0, 0, width, height);
49
+
50
+ ctx.fillStyle = this.color;
51
+ ctx.fillRect(0, 0, width, height);
52
+ }
53
+ }
54
+ };
55
+ </script>
@@ -1,123 +1,123 @@
1
- <template>
2
- <div class="ui-color-picker-saturation" @mousedown.prevent.stop="selectSaturation">
3
- <canvas ref="canvasSaturation" />
4
- <div class="slide" :style="slideSaturationStyle" />
5
- </div>
6
- </template>
7
- <style lang="less" scoped>
8
- .ui-color-picker-saturation {
9
- position: relative;
10
- cursor: pointer;
11
- .slide {
12
- position: absolute;
13
- left: 100px;
14
- top: 0;
15
- width: 10px;
16
- height: 10px;
17
- border-radius: 50%;
18
- border: 1px solid #fff;
19
- box-shadow: 0 0 1px 1px rgba(0, 0, 0, 0.3);
20
- pointer-events: none;
21
- }
22
- }
23
- </style>
24
- <script>
25
- import mixin from './mixin';
26
- export default {
27
- mixins: [mixin],
28
- props: {
29
- color: {
30
- type: String,
31
- default: '#000000',
32
- },
33
- hsv: {
34
- type: Object,
35
- default: null,
36
- },
37
- size: {
38
- type: Number,
39
- default: 150,
40
- },
41
- },
42
- data() {
43
- return {
44
- slideSaturationStyle: {},
45
- };
46
- },
47
- created() {
48
- this._color = { r: 0, g: 0, b: 0 };
49
- },
50
- mounted() {
51
- this.renderColor();
52
- this.renderSlide();
53
- },
54
- methods: {
55
- renderColor() {
56
- const canvas = this.$refs.canvasSaturation;
57
- const size = this.size;
58
- const ctx = canvas.getContext('2d');
59
- canvas.width = size;
60
- canvas.height = size;
61
-
62
- ctx.fillStyle = this.color;
63
- ctx.fillRect(0, 0, size, size);
64
-
65
- this.createLinearGradient('l', ctx, size, size, '#FFFFFF', 'rgba(255,255,255,0)');
66
- this.createLinearGradient('p', ctx, size, size, 'rgba(0,0,0,0)', '#000000');
67
- },
68
- renderSlide() {
69
- this.slideSaturationStyle = {
70
- left: this.hsv.s * this.size - 5 + 'px',
71
- top: (1 - this.hsv.v) * this.size - 5 + 'px',
72
- };
73
- },
74
- selectSaturation(e) {
75
- const { top: saturationTop, left: saturationLeft } = this.$el.getBoundingClientRect();
76
- const ctx = e.target.getContext('2d');
77
-
78
- const mousemove = e => {
79
- let x = e.clientX - saturationLeft;
80
- let y = e.clientY - saturationTop;
81
-
82
- if (x < 0) {
83
- x = 0;
84
- }
85
- if (y < 0) {
86
- y = 0;
87
- }
88
- if (x > this.size) {
89
- x = this.size;
90
- }
91
- if (y > this.size) {
92
- y = this.size;
93
- }
94
-
95
- this.slideSaturationStyle = {
96
- left: x - 5 + 'px',
97
- top: y - 5 + 'px',
98
- };
99
- const imgData = ctx.getImageData(
100
- Math.min(x, this.size - 1),
101
- Math.min(y, this.size - 1),
102
- 1,
103
- 1
104
- );
105
- const [r, g, b] = imgData.data;
106
- this._color = { r, g, b };
107
- this.$emit('changeSaturation', this._color);
108
- };
109
-
110
- mousemove(e);
111
-
112
- const mouseup = () => {
113
- document.removeEventListener('mousemove', mousemove);
114
- document.removeEventListener('mouseup', mouseup);
115
- this.$emit('selectSaturation', this._color);
116
- };
117
-
118
- document.addEventListener('mousemove', mousemove);
119
- document.addEventListener('mouseup', mouseup);
120
- },
121
- },
122
- };
123
- </script>
1
+ <template>
2
+ <div class="ui-color-picker-saturation" @mousedown.prevent.stop="selectSaturation">
3
+ <canvas ref="canvasSaturation" />
4
+ <div class="slide" :style="slideSaturationStyle" />
5
+ </div>
6
+ </template>
7
+ <style lang="less" scoped>
8
+ .ui-color-picker-saturation {
9
+ position: relative;
10
+ cursor: pointer;
11
+ .slide {
12
+ position: absolute;
13
+ left: 100px;
14
+ top: 0;
15
+ width: 10px;
16
+ height: 10px;
17
+ border-radius: 50%;
18
+ border: 1px solid #fff;
19
+ box-shadow: 0 0 1px 1px rgba(0, 0, 0, 0.3);
20
+ pointer-events: none;
21
+ }
22
+ }
23
+ </style>
24
+ <script>
25
+ import mixin from './mixin';
26
+ export default {
27
+ mixins: [mixin],
28
+ props: {
29
+ color: {
30
+ type: String,
31
+ default: '#000000',
32
+ },
33
+ hsv: {
34
+ type: Object,
35
+ default: null,
36
+ },
37
+ size: {
38
+ type: Number,
39
+ default: 150,
40
+ },
41
+ },
42
+ data() {
43
+ return {
44
+ slideSaturationStyle: {},
45
+ };
46
+ },
47
+ created() {
48
+ this._color = { r: 0, g: 0, b: 0 };
49
+ },
50
+ mounted() {
51
+ this.renderColor();
52
+ this.renderSlide();
53
+ },
54
+ methods: {
55
+ renderColor() {
56
+ const canvas = this.$refs.canvasSaturation;
57
+ const size = this.size;
58
+ const ctx = canvas.getContext('2d');
59
+ canvas.width = size;
60
+ canvas.height = size;
61
+
62
+ ctx.fillStyle = this.color;
63
+ ctx.fillRect(0, 0, size, size);
64
+
65
+ this.createLinearGradient('l', ctx, size, size, '#FFFFFF', 'rgba(255,255,255,0)');
66
+ this.createLinearGradient('p', ctx, size, size, 'rgba(0,0,0,0)', '#000000');
67
+ },
68
+ renderSlide() {
69
+ this.slideSaturationStyle = {
70
+ left: this.hsv.s * this.size - 5 + 'px',
71
+ top: (1 - this.hsv.v) * this.size - 5 + 'px',
72
+ };
73
+ },
74
+ selectSaturation(e) {
75
+ const { top: saturationTop, left: saturationLeft } = this.$el.getBoundingClientRect();
76
+ const ctx = e.target.getContext('2d');
77
+
78
+ const mousemove = e => {
79
+ let x = e.clientX - saturationLeft;
80
+ let y = e.clientY - saturationTop;
81
+
82
+ if (x < 0) {
83
+ x = 0;
84
+ }
85
+ if (y < 0) {
86
+ y = 0;
87
+ }
88
+ if (x > this.size) {
89
+ x = this.size;
90
+ }
91
+ if (y > this.size) {
92
+ y = this.size;
93
+ }
94
+
95
+ this.slideSaturationStyle = {
96
+ left: x - 5 + 'px',
97
+ top: y - 5 + 'px',
98
+ };
99
+ const imgData = ctx.getImageData(
100
+ Math.min(x, this.size - 1),
101
+ Math.min(y, this.size - 1),
102
+ 1,
103
+ 1
104
+ );
105
+ const [r, g, b] = imgData.data;
106
+ this._color = { r, g, b };
107
+ this.$emit('changeSaturation', this._color);
108
+ };
109
+
110
+ mousemove(e);
111
+
112
+ const mouseup = () => {
113
+ document.removeEventListener('mousemove', mousemove);
114
+ document.removeEventListener('mouseup', mouseup);
115
+ this.$emit('selectSaturation', this._color);
116
+ };
117
+
118
+ document.addEventListener('mousemove', mousemove);
119
+ document.addEventListener('mouseup', mouseup);
120
+ },
121
+ },
122
+ };
123
+ </script>