goodteditor-ui 1.0.9 → 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 -47
  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 -0
  62. package/src/components/ui/ResponsiveContainer.vue +99 -0
  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,105 +1,105 @@
1
- export default {
2
- methods: {
3
- setColorValue(color) {
4
- let rgba = { r: 0, g: 0, b: 0, a: 1 };
5
- if (/#/.test(color)) {
6
- rgba = this.hex2rgb(color);
7
- } else if (/rgb/.test(color)) {
8
- rgba = this.rgb2rgba(color);
9
- } else if (typeof color === 'string') {
10
- rgba = this.rgb2rgba(`rgba(${color})`);
11
- } else if (Object.prototype.toString.call(color) === '[object Object]') {
12
- rgba = color;
13
- }
14
- let fix = c => (c < 0 ? 0 : c > 255 ? 255 : c);
15
- ['r', 'g', 'b'].forEach(c => (rgba[c] = fix(rgba[c])));
16
- const { r, g, b, a } = rgba;
17
- const { h, s, v } = this.rgb2hsv(rgba);
18
- return {
19
- r,
20
- g,
21
- b,
22
- a: a === undefined ? 1 : a,
23
- h,
24
- s,
25
- v,
26
- };
27
- },
28
- createAlphaSquare(size) {
29
- const canvas = document.createElement('canvas');
30
- const ctx = canvas.getContext('2d');
31
- const doubleSize = size * 2;
32
- canvas.width = doubleSize;
33
- canvas.height = doubleSize;
34
-
35
- ctx.fillStyle = '#ffffff';
36
- ctx.fillRect(0, 0, doubleSize, doubleSize);
37
- ctx.fillStyle = '#ccd5db';
38
- ctx.fillRect(0, 0, size, size);
39
- ctx.fillRect(size, size, size, size);
40
-
41
- return canvas;
42
- },
43
- createLinearGradient(direction, ctx, width, height, color1, color2) {
44
- const isL = direction === 'l';
45
- const gradient = ctx.createLinearGradient(0, 0, isL ? width : 0, isL ? 0 : height);
46
- gradient.addColorStop(0.01, color1);
47
- gradient.addColorStop(0.99, color2);
48
- ctx.fillStyle = gradient;
49
- ctx.fillRect(0, 0, width, height);
50
- },
51
- rgb2hex({ r, g, b }, toUpper) {
52
- const change = val => ('0' + Number(val).toString(16)).slice(-2);
53
- const color = `#${change(r)}${change(g)}${change(b)}`;
54
- return toUpper ? color.toUpperCase() : color;
55
- },
56
- hex2rgb(hex) {
57
- hex = hex.slice(1);
58
- const change = val => parseInt(val, 16) || 0;
59
- return {
60
- r: change(hex.slice(0, 2)),
61
- g: change(hex.slice(2, 4)),
62
- b: change(hex.slice(4, 6)),
63
- };
64
- },
65
- rgb2rgba(rgba) {
66
- if (typeof rgba === 'string') {
67
- rgba = (/rgba?\((.*?)\)/.exec(rgba) || ['', '0,0,0,1'])[1].split(',');
68
- return {
69
- r: Number(rgba[0]) || 0,
70
- g: Number(rgba[1]) || 0,
71
- b: Number(rgba[2]) || 0,
72
- a: Number(rgba[3] ? rgba[3] : 1),
73
- };
74
- } else {
75
- return rgba;
76
- }
77
- },
78
- rgb2hsv({ r, g, b }) {
79
- r = r / 255;
80
- g = g / 255;
81
- b = b / 255;
82
- const max = Math.max(r, g, b);
83
- const min = Math.min(r, g, b);
84
- const delta = max - min;
85
- let h = 0;
86
- if (max === min) {
87
- h = 0;
88
- } else if (max === r) {
89
- if (g >= b) {
90
- h = (60 * (g - b)) / delta;
91
- } else {
92
- h = (60 * (g - b)) / delta + 360;
93
- }
94
- } else if (max === g) {
95
- h = (60 * (b - r)) / delta + 120;
96
- } else if (max === b) {
97
- h = (60 * (r - g)) / delta + 240;
98
- }
99
- h = Math.floor(h);
100
- let s = parseFloat((max === 0 ? 0 : 1 - min / max).toFixed(2));
101
- let v = parseFloat(max.toFixed(2));
102
- return { h, s, v };
103
- },
104
- },
105
- };
1
+ export default {
2
+ methods: {
3
+ setColorValue(color) {
4
+ let rgba = { r: 0, g: 0, b: 0, a: 1 };
5
+ if (/#/.test(color)) {
6
+ rgba = this.hex2rgb(color);
7
+ } else if (/rgb/.test(color)) {
8
+ rgba = this.rgb2rgba(color);
9
+ } else if (typeof color === 'string') {
10
+ rgba = this.rgb2rgba(`rgba(${color})`);
11
+ } else if (Object.prototype.toString.call(color) === '[object Object]') {
12
+ rgba = color;
13
+ }
14
+ let fix = c => (c < 0 ? 0 : c > 255 ? 255 : c);
15
+ ['r', 'g', 'b'].forEach(c => (rgba[c] = fix(rgba[c])));
16
+ const { r, g, b, a } = rgba;
17
+ const { h, s, v } = this.rgb2hsv(rgba);
18
+ return {
19
+ r,
20
+ g,
21
+ b,
22
+ a: a === undefined ? 1 : a,
23
+ h,
24
+ s,
25
+ v,
26
+ };
27
+ },
28
+ createAlphaSquare(size) {
29
+ const canvas = document.createElement('canvas');
30
+ const ctx = canvas.getContext('2d');
31
+ const doubleSize = size * 2;
32
+ canvas.width = doubleSize;
33
+ canvas.height = doubleSize;
34
+
35
+ ctx.fillStyle = '#ffffff';
36
+ ctx.fillRect(0, 0, doubleSize, doubleSize);
37
+ ctx.fillStyle = '#ccd5db';
38
+ ctx.fillRect(0, 0, size, size);
39
+ ctx.fillRect(size, size, size, size);
40
+
41
+ return canvas;
42
+ },
43
+ createLinearGradient(direction, ctx, width, height, color1, color2) {
44
+ const isL = direction === 'l';
45
+ const gradient = ctx.createLinearGradient(0, 0, isL ? width : 0, isL ? 0 : height);
46
+ gradient.addColorStop(0.01, color1);
47
+ gradient.addColorStop(0.99, color2);
48
+ ctx.fillStyle = gradient;
49
+ ctx.fillRect(0, 0, width, height);
50
+ },
51
+ rgb2hex({ r, g, b }, toUpper) {
52
+ const change = val => ('0' + Number(val).toString(16)).slice(-2);
53
+ const color = `#${change(r)}${change(g)}${change(b)}`;
54
+ return toUpper ? color.toUpperCase() : color;
55
+ },
56
+ hex2rgb(hex) {
57
+ hex = hex.slice(1);
58
+ const change = val => parseInt(val, 16) || 0;
59
+ return {
60
+ r: change(hex.slice(0, 2)),
61
+ g: change(hex.slice(2, 4)),
62
+ b: change(hex.slice(4, 6)),
63
+ };
64
+ },
65
+ rgb2rgba(rgba) {
66
+ if (typeof rgba === 'string') {
67
+ rgba = (/rgba?\((.*?)\)/.exec(rgba) || ['', '0,0,0,1'])[1].split(',');
68
+ return {
69
+ r: Number(rgba[0]) || 0,
70
+ g: Number(rgba[1]) || 0,
71
+ b: Number(rgba[2]) || 0,
72
+ a: Number(rgba[3] ? rgba[3] : 1),
73
+ };
74
+ } else {
75
+ return rgba;
76
+ }
77
+ },
78
+ rgb2hsv({ r, g, b }) {
79
+ r = r / 255;
80
+ g = g / 255;
81
+ b = b / 255;
82
+ const max = Math.max(r, g, b);
83
+ const min = Math.min(r, g, b);
84
+ const delta = max - min;
85
+ let h = 0;
86
+ if (max === min) {
87
+ h = 0;
88
+ } else if (max === r) {
89
+ if (g >= b) {
90
+ h = (60 * (g - b)) / delta;
91
+ } else {
92
+ h = (60 * (g - b)) / delta + 360;
93
+ }
94
+ } else if (max === g) {
95
+ h = (60 * (b - r)) / delta + 120;
96
+ } else if (max === b) {
97
+ h = (60 * (r - g)) / delta + 240;
98
+ }
99
+ h = Math.floor(h);
100
+ let s = parseFloat((max === 0 ? 0 : 1 - min / max).toFixed(2));
101
+ let v = parseFloat(max.toFixed(2));
102
+ return { h, s, v };
103
+ },
104
+ },
105
+ };
@@ -1,17 +1,17 @@
1
- ```vue
2
- <template>
3
- <div class="pad-l5">
4
- <p>model: {{ model }}</p>
5
- <color-picker v-model="model"></color-picker>
6
- </div>
7
- </template>
8
- <script>
9
- export default {
10
- data() {
11
- return {
12
- model: '#ff00ff',
13
- };
14
- },
15
- };
16
- </script>
17
- ```
1
+ ```vue
2
+ <template>
3
+ <div class="pad-l5">
4
+ <p>model: {{ model }}</p>
5
+ <color-picker v-model="model"></color-picker>
6
+ </div>
7
+ </template>
8
+ <script>
9
+ export default {
10
+ data() {
11
+ return {
12
+ model: '#ff00ff',
13
+ };
14
+ },
15
+ };
16
+ </script>
17
+ ```