evui 2.0.8 → 2.1.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.
Files changed (193) hide show
  1. package/dist/{adac9fa4f723f9d2cb5b6640517114a9.png → 0b8d1200e71cae8d747dce4e69c4efb6.png} +0 -0
  2. package/dist/1.css +4 -0
  3. package/dist/1.css.map +1 -0
  4. package/dist/1.evui.min.js +2 -0
  5. package/dist/1.evui.min.js.map +1 -0
  6. package/dist/1ba679c05036b34bf359aa2e6c450faa.ttf +0 -0
  7. package/dist/2.css +4 -0
  8. package/dist/2.css.map +1 -0
  9. package/dist/2.evui.min.js +2 -0
  10. package/dist/2.evui.min.js.map +1 -0
  11. package/dist/{e8c322de9658cbeb8a774b6624167c2c.woff2 → 278156e41e0ad908cf7f841b17130502.woff2} +0 -0
  12. package/dist/3.evui.min.js +2 -0
  13. package/dist/3.evui.min.js.map +1 -0
  14. package/dist/32be89b11725274cd3e801192ba88361.ttf +0 -0
  15. package/dist/{0ab54153eeeca0ce03978cc463b257f7.woff2 → 38c6d8bab26db77d8c806813e1497763.woff2} +0 -0
  16. package/dist/4.evui.min.js +2 -0
  17. package/dist/4.evui.min.js.map +1 -0
  18. package/dist/{faff92145777a3cbaf8e7367b4807987.woff → 425399f81e4ce7cbd967685402ba0260.woff} +0 -0
  19. package/dist/4730076470a665bbc7b783c56d29a72e.svg +261 -0
  20. package/dist/52e9a7f6ff3af5ad261e5292d07ebdca.eot +0 -0
  21. package/dist/{ad97afd3337e8cda302d10ff5a4026b8.ttf → 5367103510b27b78482794590e1ce3b0.ttf} +0 -0
  22. package/dist/{65363c4d55617bbeb57d8ce6dcd46099.svg → 57e963e3d6dd0a9cf05150b40eebf69b.svg} +0 -0
  23. package/dist/{c5ebe0b32dc1b5cc449a76c4204d13bb.ttf → 65a2fb6d9aaa164b41a039302093995b.ttf} +0 -0
  24. package/dist/{cd6c777f1945164224dee082abaea03a.woff2 → 687a4990ea22bb1a49d469a5d9319790.woff2} +0 -0
  25. package/dist/{7583da5c07275cd5eb364507616f998f.ttf → 6c1d906bf5ba48676f65b2d65e935e1a.ttf} +0 -0
  26. package/dist/6dafca5a4f1e31f2bdf11939b24ff422.ttf +0 -0
  27. package/dist/{701ae6abd4719e9c2ada3535a497b341.eot → 752905fa5edf21fc52a10a0c1ca9c7a4.eot} +0 -0
  28. package/dist/76c05d80dda67cdc5d03f345b7bd063f.ttf +0 -0
  29. package/dist/{b551b554a67e86a840bc80cbb8066c30.svg → 7d62eb50e7bb05eedb2a4656f7fe8f3b.svg} +0 -0
  30. package/dist/{8e3c7f5520f5ae906c6cf6d7f3ddcd19.eot → a01e3f2d6c83dc3aee175e2482b3f777.eot} +0 -0
  31. package/dist/{448f2aaa315fa9dce7b2cf6ce31caed6.svg → b30fd8419d7e6d5918856c7531d33482.svg} +0 -0
  32. package/dist/c57dd55fa982e8940f69ca1d69a8a999.woff +0 -0
  33. package/dist/{b87b9ba532ace76ae9f6edfe9f72ded2.ttf → c656b8caa454ed19b9a2ef7f4f5b8fea.ttf} +0 -0
  34. package/dist/{a046592bac8f2fd96e994733faf3858c.woff → cac87dc00c87a5d74711d0276713808a.woff} +0 -0
  35. package/dist/{13db00b7a34fee4d819ab7f9838cc428.eot → d68fa3e67dbb653a13cec44b1bcabcfe.eot} +0 -0
  36. package/dist/{ef60a4f6c25ef7f39f2d25a748dbecfe.woff → ddae9b1ba9b0b42f58809904b0b21349.woff} +0 -0
  37. package/dist/evui.min.js +12 -59485
  38. package/dist/evui.min.js.gz +0 -0
  39. package/dist/evui.min.js.map +1 -1
  40. package/dist/main.css +85 -0
  41. package/dist/main.css.gz +0 -0
  42. package/dist/main.css.map +1 -0
  43. package/package.json +58 -89
  44. package/src/common/emitter.js +20 -0
  45. package/src/common/utils.debounce.js +223 -0
  46. package/src/common/utils.js +51 -17
  47. package/src/common/utils.throttle.js +83 -0
  48. package/src/common/utils.tree.js +18 -0
  49. package/src/components/button/button.vue +316 -241
  50. package/src/components/chart/chart.core.js +699 -0
  51. package/src/components/chart/chart.vue +200 -204
  52. package/src/components/chart/element/element.bar.js +311 -0
  53. package/src/components/chart/element/element.bar.time.js +115 -0
  54. package/src/components/chart/element/element.line.js +288 -0
  55. package/src/components/chart/element/element.pie.js +86 -0
  56. package/src/components/chart/element/element.scatter.js +83 -0
  57. package/src/components/chart/element/element.tip.js +356 -0
  58. package/src/components/chart/helpers/helpers.canvas.js +237 -0
  59. package/src/components/chart/helpers/helpers.constant.js +138 -0
  60. package/src/components/chart/helpers/helpers.util.js +154 -0
  61. package/src/components/chart/index.js +0 -1
  62. package/src/components/chart/model/index.js +4 -0
  63. package/src/components/chart/model/model.series.js +86 -0
  64. package/src/components/chart/model/model.store.js +559 -0
  65. package/src/components/chart/plugins/plugins.interaction.js +324 -0
  66. package/src/components/chart/plugins/plugins.legend.js +589 -0
  67. package/src/components/chart/plugins/plugins.pie.js +179 -0
  68. package/src/components/chart/plugins/plugins.title.js +56 -0
  69. package/src/components/chart/plugins/plugins.tooltip.js +384 -0
  70. package/src/components/chart/scale/scale.js +272 -0
  71. package/src/components/chart/scale/scale.linear.js +30 -0
  72. package/src/components/chart/scale/scale.logarithmic.js +120 -0
  73. package/src/components/chart/scale/scale.step.js +197 -0
  74. package/src/components/chart/scale/scale.time.category.js +204 -0
  75. package/src/components/chart/scale/scale.time.js +40 -0
  76. package/src/components/checkbox/checkbox-group.vue +31 -12
  77. package/src/components/checkbox/checkbox.vue +269 -19
  78. package/src/components/codeview/code.vue +42 -29
  79. package/src/components/contextmenu/contextmenu.child.vue +79 -0
  80. package/src/components/contextmenu/contextmenu.vue +276 -0
  81. package/src/components/contextmenu/contextmenu.wrap.vue +189 -0
  82. package/src/components/contextmenu/index.js +3 -0
  83. package/src/components/datepicker/calendar.core.js +604 -510
  84. package/src/components/datepicker/calendar.vue +0 -3
  85. package/src/components/datepicker/datepicker.vue +73 -14
  86. package/src/components/datepicker/index.js +5 -1
  87. package/src/components/grid/grid.filter.vue +290 -0
  88. package/src/components/grid/grid.filter.window.vue +411 -0
  89. package/src/components/grid/grid.render.vue +45 -0
  90. package/src/components/grid/grid.vue +1338 -0
  91. package/src/components/icon/icon.vue +22 -7
  92. package/src/components/input/input.number.vue +309 -277
  93. package/src/components/label/label.vue +2 -2
  94. package/src/components/loadingmask/loadingmask.vue +52 -63
  95. package/src/components/loginfield/index.js +3 -0
  96. package/src/components/loginfield/loginfield.vue +339 -0
  97. package/src/components/markdown/index.js +3 -0
  98. package/src/components/markdown/markdown.vue +1001 -0
  99. package/src/components/menu/index.js +1 -3
  100. package/src/components/menu/menu.nav.item.vue +115 -0
  101. package/src/components/menu/menu.nav.sub.vue +42 -0
  102. package/src/components/menu/menu.nav.vue +71 -98
  103. package/src/components/message/index.js +3 -0
  104. package/src/components/message/message.js +63 -0
  105. package/src/components/message/message.vue +191 -0
  106. package/src/components/message-box/index.js +3 -0
  107. package/src/components/message-box/message-box.js +31 -0
  108. package/src/components/message-box/message-box.vue +298 -0
  109. package/src/components/notification/index.js +3 -0
  110. package/src/components/notification/notification.js +75 -0
  111. package/src/components/notification/notification.vue +242 -0
  112. package/src/components/radio/radio-group.vue +12 -2
  113. package/src/components/radio/radio.vue +186 -25
  114. package/src/components/selectbox/dropdown.vue +96 -39
  115. package/src/components/selectbox/listbox.vue +68 -29
  116. package/src/components/selectbox/option.vue +1 -1
  117. package/src/components/selectbox/selectbox.vue +445 -245
  118. package/src/components/slider/slider-tooltip.vue +7 -7
  119. package/src/components/slider/slider.vue +20 -25
  120. package/src/components/splitter/index.js +3 -0
  121. package/src/components/splitter/splitter.vue +294 -0
  122. package/src/components/table/table.black.css +1 -1
  123. package/src/components/table/table.filter.lite.vue +8 -8
  124. package/src/components/table/table.filter.vue +1 -1
  125. package/src/components/table/table.grey.css +5 -6
  126. package/src/components/table/table.navy.css +1 -1
  127. package/src/components/table/table.vue +60 -55
  128. package/src/components/tabs/tab-panel.vue +19 -5
  129. package/src/components/tabs/tabs.vue +182 -87
  130. package/src/components/textfield/textfield.vue +140 -80
  131. package/src/components/timepicker/index.js +2 -2
  132. package/src/components/timepicker/spinner.vue +15 -17
  133. package/src/components/timepicker/timepicker.vue +98 -53
  134. package/src/components/toggle/toggle.vue +206 -158
  135. package/src/components/tree/index.js +2 -6
  136. package/src/components/tree/render.js +17 -0
  137. package/src/components/tree/tree-node.vue +214 -0
  138. package/src/components/tree/tree.vue +296 -0
  139. package/src/components/tree-table/index.js +7 -0
  140. package/src/components/{tree → tree-table}/tree.table.black.css +0 -0
  141. package/src/components/{tree → tree-table}/tree.table.grey.css +12 -12
  142. package/src/components/{tree → tree-table}/tree.table.vue +151 -95
  143. package/src/components/tree-table/tree.util.js +119 -0
  144. package/src/components/window/window.vue +238 -183
  145. package/src/index.js +29 -12
  146. package/src/styles/base/base.scss +50 -0
  147. package/src/styles/base/index.scss +1 -0
  148. package/src/styles/default.scss +5 -0
  149. package/src/styles/{codemirror.css → lib/codemirror.css} +0 -0
  150. package/src/styles/{all.css → lib/fontawesome.css} +1 -1
  151. package/src/styles/lib/icon.css +792 -0
  152. package/src/styles/themes/index.scss +2 -0
  153. package/src/styles/themes/mixin.scss +33 -0
  154. package/src/styles/themes/variables.scss +206 -0
  155. package/src/styles/utils/colors.scss +222 -0
  156. package/src/styles/utils/index.scss +2 -0
  157. package/src/styles/utils/mixins.scss +34 -0
  158. package/src/styles/utils/variables.scss +27 -0
  159. package/src/webfonts/EVUI.eot +0 -0
  160. package/src/webfonts/EVUI.svg +251 -173
  161. package/src/webfonts/EVUI.ttf +0 -0
  162. package/src/webfonts/EVUI.woff +0 -0
  163. package/src/webfonts/Roboto-Bold.ttf +0 -0
  164. package/src/webfonts/Roboto-Medium.ttf +0 -0
  165. package/src/webfonts/Roboto-Regular.ttf +0 -0
  166. package/dist/3c9453211570a4ede66a4b4954a32bbb.ttf +0 -0
  167. package/dist/8634884f932627fc43782e6963b64ccd.svg +0 -183
  168. package/dist/b9e64d9b5fa6b500eb5df6fa980d3e5b.eot +0 -0
  169. package/dist/f0ac0c8b3c9cd3ef9002749985ae546f.woff +0 -0
  170. package/src/components/chart/charts/chart.bar.js +0 -334
  171. package/src/components/chart/charts/chart.base.js +0 -1075
  172. package/src/components/chart/charts/chart.line.js +0 -262
  173. package/src/components/chart/charts/chart.pie.js +0 -383
  174. package/src/components/chart/charts/chart.scatter.js +0 -349
  175. package/src/components/chart/charts/chart.sunburst.js +0 -193
  176. package/src/components/chart/core/axis/axis.js +0 -217
  177. package/src/components/chart/core/axis/axis.scale.auto.js +0 -69
  178. package/src/components/chart/core/axis/axis.scale.fixed.js +0 -65
  179. package/src/components/chart/core/axis/axis.scale.steps.js +0 -149
  180. package/src/components/chart/core/core.constant.js +0 -91
  181. package/src/components/chart/core/core.legend.js +0 -473
  182. package/src/components/chart/core/core.util.js +0 -66
  183. package/src/components/chart/core/data/data.js +0 -412
  184. package/src/components/chart/core/data/data.pie.js +0 -70
  185. package/src/components/chart/core/data/data.stack.js +0 -222
  186. package/src/components/chart/core/data/data.sunburst.js +0 -172
  187. package/src/components/menu/menu.context.children.vue +0 -201
  188. package/src/components/menu/menu.context.vue +0 -144
  189. package/src/components/tabs/jun/tab.vue +0 -123
  190. package/src/components/tabs/jun/tabs.vue +0 -484
  191. package/src/components/tree/tree.util.js +0 -39
  192. package/src/styles/evui.css +0 -386
  193. package/src/styles/icon.css +0 -557
@@ -0,0 +1,204 @@
1
+ import moment from 'moment';
2
+ import { TIME_INTERVALS } from '../helpers/helpers.constant';
3
+ import Scale from './scale';
4
+ import Util from '../helpers/helpers.util';
5
+
6
+ class TimeCategoryScale extends Scale {
7
+ constructor(type, opt, ctx, labels) {
8
+ super(type, opt, ctx);
9
+ this.labels = labels;
10
+ }
11
+
12
+ /**
13
+ * Transforming label by designated format
14
+ * @param {number} value label value
15
+ *
16
+ * @returns {string} formatted label
17
+ */
18
+ getLabelFormat(value) {
19
+ return moment(value).format(this.timeFormat);
20
+ }
21
+
22
+ /**
23
+ * Calculate interval
24
+ * @param {object} range range information
25
+ *
26
+ * @returns {number} interval
27
+ */
28
+ getInterval(range) {
29
+ const max = range.maxValue;
30
+ const min = range.minValue;
31
+ const step = range.maxSteps;
32
+
33
+ if (this.interval) {
34
+ if (typeof this.interval === 'string') {
35
+ return TIME_INTERVALS[this.interval].size;
36
+ } else if (typeof this.interval === 'object') {
37
+ return this.interval.time * TIME_INTERVALS[this.interval.unit].size;
38
+ } else if (typeof this.interval === 'number') {
39
+ return this.interval;
40
+ }
41
+ }
42
+ return Math.ceil((max - min) / step);
43
+ }
44
+
45
+ /**
46
+ * With range information, calculate how many labels in axis
47
+ * @param {object} range min/max information
48
+ *
49
+ * @returns {object} steps, interval, min/max graph value
50
+ */
51
+ calculateSteps(range) {
52
+ const { maxValue, minValue, maxSteps } = range;
53
+ const rawInterval = this.getInterval(range);
54
+
55
+ let interval = rawInterval;
56
+ let increase = minValue;
57
+ let numberOfSteps;
58
+
59
+ while (increase < maxValue) {
60
+ increase += interval;
61
+ }
62
+
63
+ const graphMax = increase > maxValue ? maxValue : increase;
64
+ const graphMin = minValue;
65
+ const graphRange = graphMax - graphMin;
66
+
67
+ numberOfSteps = Math.round(graphRange / interval) + 1;
68
+ const oriSteps = numberOfSteps;
69
+
70
+ if (maxValue === 1) {
71
+ interval = 0.2;
72
+ numberOfSteps = 5;
73
+ }
74
+
75
+ while (numberOfSteps > maxSteps) {
76
+ interval *= 2;
77
+ numberOfSteps = Math.round(graphRange / interval);
78
+ interval = Math.ceil(graphRange / numberOfSteps);
79
+ }
80
+
81
+ if (graphMax - graphMin > (numberOfSteps * interval)) {
82
+ interval = Math.ceil((graphMax - graphMin) / numberOfSteps);
83
+ }
84
+
85
+
86
+ return {
87
+ steps: numberOfSteps,
88
+ oriSteps,
89
+ interval,
90
+ rawInterval,
91
+ graphMin,
92
+ graphMax,
93
+ };
94
+ }
95
+
96
+ /**
97
+ * Draw axis
98
+ * @param {object} chartRect min/max information
99
+ * @param {object} labelOffset label offset information
100
+ * @param {object} stepInfo label steps information
101
+ *
102
+ * @returns {undefined}
103
+ */
104
+ draw(chartRect, labelOffset, stepInfo) {
105
+ const ctx = this.ctx;
106
+ const labels = this.labels;
107
+ const aPos = {
108
+ x1: chartRect.x1 + labelOffset.left,
109
+ x2: chartRect.x2 - labelOffset.right,
110
+ y1: chartRect.y1 + labelOffset.top,
111
+ y2: chartRect.y2 - labelOffset.bottom,
112
+ };
113
+
114
+ const steps = stepInfo.steps;
115
+ const axisMin = stepInfo.graphMin;
116
+ const axisMax = stepInfo.graphMax;
117
+ const stepValue = stepInfo.rawInterval;
118
+ const oriSteps = stepInfo.oriSteps;
119
+ const count = Math.round(oriSteps / steps);
120
+
121
+ let startPoint = aPos[this.units.rectStart];
122
+ const endPoint = aPos[this.units.rectEnd];
123
+ const offsetPoint = aPos[this.units.rectOffset(this.position)];
124
+ const offsetCounterPoint = aPos[this.units.rectOffsetCounter(this.position)];
125
+
126
+ // label font 설정
127
+ ctx.font = Util.getLabelStyle(this.labelStyle);
128
+
129
+ if (this.type === 'x') {
130
+ ctx.textAlign = 'center';
131
+ ctx.textBaseline = this.position === 'top' ? 'bottom' : 'top';
132
+ } else {
133
+ ctx.textAlign = this.position === 'left' ? 'right' : 'left';
134
+ ctx.textBaseline = 'middle';
135
+ }
136
+
137
+ ctx.fillStyle = this.labelStyle.color;
138
+ ctx.lineWidth = 1;
139
+ const aliasPixel = Util.aliasPixel(ctx.lineWidth);
140
+
141
+ ctx.beginPath();
142
+ ctx.strokeStyle = this.axisLineColor;
143
+ if (this.type === 'x') {
144
+ ctx.moveTo(startPoint, offsetPoint + aliasPixel);
145
+ ctx.lineTo(endPoint, offsetPoint + aliasPixel);
146
+ } else {
147
+ ctx.moveTo(offsetPoint + aliasPixel, startPoint);
148
+ ctx.lineTo(offsetPoint + aliasPixel, endPoint);
149
+ }
150
+ ctx.stroke();
151
+ ctx.closePath();
152
+
153
+ if (steps === 0 || axisMin === null) {
154
+ return;
155
+ }
156
+
157
+ const graphGap = (endPoint - startPoint) / (labels.length || 1);
158
+ if (this.categoryMode) {
159
+ startPoint += Math.ceil(graphGap / 2) - 2;
160
+ }
161
+
162
+ const ticks = [];
163
+ let labelCenter = null;
164
+ let linePosition = null;
165
+
166
+ ctx.beginPath();
167
+ ctx.strokeStyle = this.gridLineColor;
168
+
169
+ let labelText;
170
+ for (let ix = 0; ix < oriSteps; ix += count) {
171
+ ticks[ix] = axisMin + (ix * stepValue);
172
+
173
+ labelCenter = Math.round(startPoint + (graphGap * ix));
174
+ linePosition = labelCenter + aliasPixel;
175
+ labelText = this.getLabelFormat(Math.min(axisMax, ticks[ix]));
176
+
177
+ let labelPoint;
178
+
179
+ if (this.type === 'x') {
180
+ labelPoint = this.position === 'top' ? offsetPoint - 10 : offsetPoint + 10;
181
+ ctx.fillText(labelText, labelCenter, labelPoint);
182
+
183
+ if ((ix !== 0 && ix < oriSteps && this.showGrid)) {
184
+ ctx.moveTo(linePosition, offsetPoint);
185
+ ctx.lineTo(linePosition, offsetCounterPoint);
186
+ }
187
+ } else {
188
+ labelPoint = this.position === 'left' ? offsetPoint - 10 : offsetPoint + 10;
189
+ ctx.fillText(labelText, labelPoint, labelCenter);
190
+
191
+ if ((ix !== 0 && ix < oriSteps && this.showGrid)) {
192
+ ctx.moveTo(offsetPoint, linePosition);
193
+ ctx.lineTo(offsetCounterPoint, linePosition);
194
+ }
195
+ }
196
+
197
+ ctx.stroke();
198
+ }
199
+
200
+ ctx.closePath();
201
+ }
202
+ }
203
+
204
+ export default TimeCategoryScale;
@@ -0,0 +1,40 @@
1
+ import moment from 'moment';
2
+ import { TIME_INTERVALS } from '../helpers/helpers.constant';
3
+ import Scale from './scale';
4
+
5
+ class TimeScale extends Scale {
6
+ /**
7
+ * Transforming label by designated format
8
+ * @param {number} value label value
9
+ *
10
+ * @returns {string} formatted label
11
+ */
12
+ getLabelFormat(value) {
13
+ return moment(value).format(this.timeFormat);
14
+ }
15
+
16
+ /**
17
+ * Calculate interval
18
+ * @param {object} range range information
19
+ *
20
+ * @returns {number} interval
21
+ */
22
+ getInterval(range) {
23
+ const max = range.maxValue;
24
+ const min = range.minValue;
25
+ const step = range.maxSteps;
26
+
27
+ if (this.interval) {
28
+ if (typeof this.interval === 'string') {
29
+ return TIME_INTERVALS[this.interval].size;
30
+ } else if (typeof this.interval === 'object') {
31
+ return this.interval.time * TIME_INTERVALS[this.interval.unit].size;
32
+ } else if (typeof this.interval === 'number') {
33
+ return this.interval;
34
+ }
35
+ }
36
+ return Math.ceil((max - min) / step);
37
+ }
38
+ }
39
+
40
+ export default TimeScale;
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div>
3
- <slot/>
3
+ <slot />
4
4
  </div>
5
5
  </template>
6
6
 
@@ -13,6 +13,18 @@
13
13
  return [];
14
14
  },
15
15
  },
16
+ size: {
17
+ type: String,
18
+ default() {
19
+ return '';
20
+ },
21
+ },
22
+ type: {
23
+ type: String,
24
+ default() {
25
+ return '';
26
+ },
27
+ },
16
28
  },
17
29
  data() {
18
30
  return {
@@ -29,26 +41,33 @@
29
41
  },
30
42
  mounted() {
31
43
  this.initValue();
32
- const bindValue = this.bindValue;
33
- this.$on('change-event', (e) => {
34
- const targetValue = e.target.value;
35
- if (e.currentTarget.checked && bindValue.indexOf(targetValue) === -1) {
36
- bindValue.push(targetValue);
37
- } else if (!e.currentTarget.checked && bindValue.indexOf(targetValue) > -1) {
38
- bindValue.splice(bindValue.indexOf(targetValue), 1);
39
- }
40
- this.$parent.$emit('input', bindValue);
41
- });
44
+ this.$on('on-change', this.onChange);
45
+ },
46
+ beforeDestroy() {
47
+ this.$off('on-change', this.onChange);
42
48
  },
43
49
  methods: {
44
50
  initValue(array) {
45
51
  if (this.$children && this.$children instanceof Array) {
52
+ const self = this;
46
53
  this.$children.forEach((c) => {
47
54
  const child = c;
48
- child.bindValue = array || this.value;
55
+ child.bindValue = array || self.value;
56
+ child.bindSize = self.size;
57
+ child.bindType = self.type;
49
58
  });
50
59
  }
51
60
  },
61
+ onChange(e) {
62
+ const bindValue = this.bindValue;
63
+ const targetValue = e.target.value;
64
+ if (e.currentTarget.checked && bindValue.indexOf(targetValue) === -1) {
65
+ bindValue.push(targetValue);
66
+ } else if (!e.currentTarget.checked && bindValue.indexOf(targetValue) > -1) {
67
+ bindValue.splice(bindValue.indexOf(targetValue), 1);
68
+ }
69
+ this.$parent.$emit('input', bindValue);
70
+ },
52
71
  },
53
72
  };
54
73
  </script>
@@ -1,31 +1,36 @@
1
1
  <template>
2
- <label
3
- :for="`${checkboxId}_${value}`"
4
- :class="{ disabled: disabled }"
5
- class="ev-checkbox-label"
2
+ <div
3
+ :class="[{ disabled: disabled }, dataSize]"
4
+ class="ev-checkbox"
6
5
  >
7
6
  <input
8
7
  v-if="!isGroup"
9
8
  :id="`${checkboxId}_${value}`"
9
+ v-model="bindValue"
10
10
  :value="value"
11
11
  :disabled="disabled"
12
- v-model="bindValue"
13
12
  type="checkbox"
14
13
  class="ev-checkbox-input"
15
14
  @change="change"
15
+ @click="click"
16
16
  >
17
17
  <input
18
18
  v-else
19
19
  :id="`${checkboxId}_${value}`"
20
+ v-model="groupBindValue"
20
21
  :value="value"
21
22
  :disabled="disabled"
22
- v-model="groupBindValue"
23
23
  type="checkbox"
24
24
  class="ev-checkbox-input group"
25
25
  @change="change"
26
26
  >
27
- <slot/>
28
- </label>
27
+ <label
28
+ :for="`${checkboxId}_${value}`"
29
+ :class="checkboxClasses"
30
+ >
31
+ <slot />
32
+ </label>
33
+ </div>
29
34
  </template>
30
35
 
31
36
  <script>
@@ -35,8 +40,8 @@
35
40
  },
36
41
  props: {
37
42
  value: {
38
- type: String,
39
- default: '',
43
+ type: [String, Number],
44
+ default: null,
40
45
  },
41
46
  disabled: {
42
47
  type: Boolean,
@@ -46,12 +51,31 @@
46
51
  type: [Boolean, Array],
47
52
  default: null,
48
53
  },
54
+ size: {
55
+ type: String,
56
+ default: '',
57
+ },
58
+ type: {
59
+ type: String,
60
+ default: '',
61
+ },
62
+ afterType: {
63
+ type: String,
64
+ default: '',
65
+ },
66
+ // afterType: 'minus'랑 동일 속성으로 추후 afterType 삭제 필요
67
+ indeterminate: {
68
+ type: Boolean,
69
+ default: false,
70
+ },
49
71
  },
50
72
  data() {
51
73
  return {
52
74
  checkboxId: this._uid,
53
75
  isGroup: false, // group태그가 존재하는 경우 true
54
76
  groupBindValue: [],
77
+ dataSize: this.size,
78
+ dataType: this.type,
55
79
  };
56
80
  },
57
81
  computed: {
@@ -63,6 +87,33 @@
63
87
  this.groupBindValue = list;
64
88
  },
65
89
  },
90
+ bindSize: {
91
+ get() {
92
+ return this.size;
93
+ },
94
+ set(size) {
95
+ this.dataSize = size;
96
+ },
97
+ },
98
+ bindType: {
99
+ get() {
100
+ return this.type;
101
+ },
102
+ set(size) {
103
+ this.dataType = size;
104
+ },
105
+ },
106
+ checkboxClasses() {
107
+ return [
108
+ 'ev-checkbox-label',
109
+ this.dataSize,
110
+ this.dataType,
111
+ this.afterType,
112
+ {
113
+ indeterminate: this.indeterminate,
114
+ },
115
+ ];
116
+ },
66
117
  },
67
118
  created() {
68
119
  this.isGroup = this.$parent.$options.componentName === 'CheckboxGroup';
@@ -70,29 +121,228 @@
70
121
  methods: {
71
122
  change(e) {
72
123
  if (this.isGroup) {
73
- this.$parent.$emit('change-event', e);
124
+ this.$parent.$emit('on-change', e);
125
+ } else {
126
+ this.$emit('input', e.target.checked);
127
+ this.$emit('on-change', e);
128
+ }
129
+ },
130
+ click(e) {
131
+ if (this.isGroup) {
132
+ this.$parent.$emit('on-click', e);
74
133
  } else {
75
- this.$emit('change-event', e);
76
134
  this.$emit('input', e.target.checked);
135
+ this.$emit('on-click', e);
77
136
  }
78
137
  },
79
138
  },
80
139
  };
81
140
  </script>
82
141
 
83
- <style scoped>
84
- .ev-checkbox-label {
85
- vertical-align: middle;
142
+ <style lang="scss">
143
+ @import '~@/styles/default';
144
+
145
+ .ev-checkbox {
146
+ height: 19px;
147
+ line-height: 19px;
86
148
  float: left;
87
149
  user-select: none;
88
- cursor: pointer;
150
+ font-size: $font-size-base;
151
+
152
+ &.small {
153
+ height: 16px;
154
+ line-height: 16px;
155
+ }
89
156
  }
90
- .ev-checkbox-label.disabled {
91
- color: #C0C4CC;
92
- cursor: not-allowed;
157
+
158
+ .ev-checkbox-label {
159
+ position: relative;
160
+ display: inline-flex;
161
+ height: 100%;
162
+ padding-left: 25px;
163
+ cursor: pointer;
164
+
165
+ @include evThemify() {
166
+ color: evThemed('checkbox');
167
+ }
168
+
169
+ &:before {
170
+ position: absolute;
171
+ top: 50%;
172
+ left: 2px;
173
+ width: 16px;
174
+ height: 16px;
175
+ background-color: transparent;
176
+ border-radius: 50%;
177
+ text-align: center;
178
+ transform: translateY(-50%);
179
+ content: '';
180
+
181
+ @include evThemify() {
182
+ border: $border-solid evThemed('checkbox-border');
183
+ }
184
+ }
185
+
186
+ &:after {
187
+ display: block;
188
+ content: '';
189
+ }
190
+
191
+ /* unchecked -- type: small */
192
+ &.small {
193
+ padding-left: 23px;
194
+
195
+ &:before {
196
+ width: 12px;
197
+ height: 12px;
198
+ }
199
+ }
200
+
201
+ /* unchecked -- type: square */
202
+ &.square:before {
203
+ border-radius: 0;
204
+ }
205
+ &.indeterminate:before {
206
+ @include evThemify() {
207
+ border-color: evThemed('color-primary');
208
+ }
209
+ }
210
+
211
+ &.indeterminate:after {
212
+ left: 5px;
213
+ width: 12px;
214
+ height: 4px;
215
+ border-radius: 0;
216
+ }
217
+ &.small.indeterminate:after {
218
+ width: 8px;
219
+ height: 2px;
220
+ display: block;
221
+ position: absolute;
222
+ top: 50%;
223
+ transform: translateY(-50%);
224
+ @include evThemify() {
225
+ background-color: evThemed('color-primary');
226
+ }
227
+ }
93
228
  }
229
+
94
230
  .ev-checkbox-input {
231
+ position: absolute;
232
+ width: 1px;
233
+ height: 1px;
234
+ padding: 0;
235
+ border: 0;
95
236
  vertical-align: middle;
237
+ overflow: hidden;
96
238
  cursor: inherit;
239
+ clip: rect(0, 0, 0, 0);
240
+
241
+ /* checked */
242
+ &:checked + .ev-checkbox-label:before {
243
+ @include evThemify() {
244
+ border-color: evThemed('color-primary');
245
+ }
246
+ }
247
+
248
+ &:checked + .ev-checkbox-label:after {
249
+ content: '';
250
+ display: block;
251
+ position: absolute;
252
+ top: 50%;
253
+ left: 7px;
254
+ width: 8px;
255
+ height: 8px;
256
+ border-radius: 100%;
257
+ transform: translateY(-50%);
258
+
259
+ @include evThemify() {
260
+ background-color: evThemed('color-primary');
261
+ }
262
+ }
263
+
264
+ /* checked -- type: check */
265
+ &:checked + .ev-checkbox-label.check:before {
266
+ @include evThemify() {
267
+ background-color: evThemed('color-primary');
268
+ }
269
+ }
270
+
271
+ &:checked + .ev-checkbox-label.check:after {
272
+ position: absolute;
273
+ top: 4px;
274
+ left: 8px;
275
+ width: 5px;
276
+ height: 8px;
277
+ border: solid $color-white;
278
+ border-radius: 0;
279
+ border-width: 0 1px 1px 0;
280
+ transform: rotate(45deg);
281
+ content: '';
282
+ }
283
+
284
+ /* checked -- type: square */
285
+ &:checked + .ev-checkbox-label.square:after {
286
+ border-radius: 0;
287
+ }
288
+
289
+ /* checked -- type: small */
290
+ &:checked + .ev-checkbox-label.small:after {
291
+ left: 6px;
292
+ width: 6px;
293
+ height: 6px;
294
+ }
295
+
296
+ /* checked -- type: minus */
297
+ &:checked + .ev-checkbox-label.minus:after {
298
+ left: 5px;
299
+ width: 12px;
300
+ height: 4px;
301
+ border-radius: 0;
302
+ }
303
+
304
+ /* checked -- type: minus + small */
305
+ &:checked + .ev-checkbox-label.minus.small:after {
306
+ width: 8px;
307
+ height: 2px;
308
+ }
309
+
310
+ /* checked -- type: check + small */
311
+ &:checked + .ev-checkbox-label.check.small:after {
312
+ top: 3px;
313
+ left: 6px;
314
+ width: 4px;
315
+ height: 6px;
316
+ background: none;
317
+ }
318
+ }
319
+
320
+
321
+ /* disabled */
322
+ .disabled {
323
+ .ev-checkbox-label {
324
+ cursor: not-allowed;
325
+
326
+ @include evThemify() {
327
+ color: evThemed('checkbox-disabled');
328
+ }
329
+
330
+ &:before {
331
+ border: $border-solid $color-not-allow;
332
+ }
333
+ }
334
+
335
+ .ev-checkbox-input:checked + .ev-checkbox-label:before {
336
+ border-color: $color-not-allow;
337
+ }
338
+
339
+ .ev-checkbox-input:checked + .ev-checkbox-label:after {
340
+ background-color: $color-not-allow;
341
+ }
342
+
343
+ /* checked -- type: check */
344
+ .ev-checkbox-input:checked + .ev-checkbox-label.check:before {
345
+ background-color: $color-not-allow;
346
+ }
97
347
  }
98
348
  </style>