evui 3.4.88 → 3.4.89

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evui",
3
- "version": "3.4.88",
3
+ "version": "3.4.89",
4
4
  "description": "A EXEM Library project",
5
5
  "author": "exem <dev_client@ex-em.com>",
6
6
  "license": "MIT",
@@ -77,7 +77,7 @@ class Line {
77
77
  const mainColorOpacity = getOpacity(mainColor);
78
78
  const pointFillColor = this.pointFill;
79
79
  const pointFillColorOpacity = getOpacity(pointFillColor);
80
- const fillOpacity = getOpacity(mainColor) * this.fillOpacity;
80
+ const fillOpacity = this.fillOpacity;
81
81
  const lineWidth = this.lineWidth * extent.lineWidth;
82
82
 
83
83
  ctx.beginPath();
@@ -163,7 +163,7 @@ class Line {
163
163
  if (this.fill && this.data.length) {
164
164
  ctx.beginPath();
165
165
 
166
- const fillColor = Util.colorStringToRgba(mainColor, fillOpacity);
166
+ const fillColor = Util.colorStringToRgba(this.fillColor || mainColor, fillOpacity);
167
167
  if (this.fill?.gradient) {
168
168
  let maxValueYPos = this.data[0].yp;
169
169
  let minValueYBottomPos = this.data[0].y;
@@ -283,7 +283,7 @@ class Line {
283
283
  const { xp, yp, o } = gdata;
284
284
 
285
285
  ctx.save();
286
- if (xp !== null && yp !== null && o !== this.passingValue) {
286
+ if (xp !== null && yp !== null && o !== this.passingValue && this.pointHighlight) {
287
287
  ctx.strokeStyle = Util.colorStringToRgba(this.color, 0);
288
288
  ctx.fillStyle = Util.colorStringToRgba(this.color, this.highlight.maxShadowOpacity);
289
289
  Canvas.drawPoint(ctx, this.pointStyle, this.highlight.maxShadowSize, xp, yp);
@@ -37,6 +37,7 @@ export const LINE_OPTION = {
37
37
  xAxisIndex: 0,
38
38
  yAxisIndex: 0,
39
39
  point: true,
40
+ pointHighlight: true,
40
41
  pointSize: 3,
41
42
  pointStyle: '',
42
43
  lineWidth: 2,
@@ -26,8 +26,8 @@
26
26
  :placeholder="placeholder"
27
27
  :disabled="disabled"
28
28
  :readonly="readonly"
29
- :maxlength="maxLength"
30
29
  :autocomplete="autocomplete"
30
+ :maxlength="maxUnit === 'byte' ? null : maxLength"
31
31
  @focus="focusInput"
32
32
  @blur="blurInput"
33
33
  @input="inputMv"
@@ -42,8 +42,8 @@
42
42
  :placeholder="placeholder"
43
43
  :disabled="disabled"
44
44
  :readonly="readonly"
45
- :maxlength="maxLength"
46
45
  :autocomplete="autocomplete"
46
+ :maxlength="maxUnit === 'byte' ? null : maxLength"
47
47
  @focus="focusInput"
48
48
  @blur="blurInput"
49
49
  @input="inputMv"
@@ -95,15 +95,16 @@
95
95
  <div
96
96
  v-if="maxLength && showMaxLength"
97
97
  class="ev-text-field-maxlength"
98
- :class="{ max: mv?.length > maxLength }"
98
+ :class="{ max: currentLength > maxLength }"
99
99
  >
100
- <span class="curr-length">{{ mv ? mv.length : 0 }}</span> / {{ maxLength }}
100
+ <span class="curr-length">{{ currentLength }}</span> / {{ maxLength
101
+ }}{{ maxUnit === 'byte' ? ' Bytes' : '' }}
101
102
  </div>
102
103
  </div>
103
104
  </template>
104
105
 
105
106
  <script>
106
- import { ref, computed, nextTick } from 'vue';
107
+ import { ref, computed } from 'vue';
107
108
 
108
109
  export default {
109
110
  name: 'EvTextField',
@@ -140,6 +141,10 @@ export default {
140
141
  type: Number,
141
142
  default: null,
142
143
  },
144
+ maxUnit: {
145
+ type: String,
146
+ default: 'count',
147
+ },
143
148
  showMaxLength: {
144
149
  type: Boolean,
145
150
  default: false,
@@ -206,19 +211,31 @@ export default {
206
211
  const blurInput = (e) => {
207
212
  emit('blur', e);
208
213
  };
214
+
215
+ const getByteLength = text => new TextEncoder().encode(text).length;
216
+
217
+ const currentLength = computed(() =>
218
+ (props.maxUnit === 'byte'
219
+ ? getByteLength(mv.value || '')
220
+ : (mv.value || '').length),
221
+ );
222
+
209
223
  const inputMv = (e) => {
210
- const inputValue = e.target.value;
211
- if (mv.value !== inputValue) {
212
- mv.value = inputValue;
224
+ let value = e.target.value;
225
+
226
+ if (props.maxLength && props.maxUnit === 'byte') {
227
+ while (getByteLength(value) > props.maxLength) {
228
+ value = value.slice(0, -1);
229
+ }
230
+ e.target.value = value;
213
231
  }
214
- nextTick(() => {
215
- emit('input', mv.value, e);
216
- });
217
- };
218
- const changeMv = (e) => {
219
- emit('change', mv.value, e);
232
+
233
+ mv.value = value;
234
+ emit('input', value, e);
220
235
  };
221
236
 
237
+ const changeMv = e => emit('change', mv.value, e);
238
+
222
239
  return {
223
240
  mv,
224
241
  inputType,
@@ -231,6 +248,7 @@ export default {
231
248
  blurInput,
232
249
  inputMv,
233
250
  changeMv,
251
+ currentLength,
234
252
  };
235
253
  },
236
254
  };