evui 3.1.42 → 3.1.46

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.1.42",
3
+ "version": "3.1.46",
4
4
  "description": "A EXEM Library project",
5
5
  "author": "exem <dev_client@ex-em.com>",
6
6
  "license": "MIT",
@@ -85,7 +85,7 @@
85
85
 
86
86
  await watch(() => props.data, (chartData) => {
87
87
  const newData = getNormalizedData(chartData);
88
- const isUpdateSeries = !isEqual(newData.series, evChart.data.series);
88
+ const isUpdateSeries = !isEqual(newData, evChart.data);
89
89
  evChart.data = cloneDeep(newData);
90
90
  evChart.update({
91
91
  updateSeries: isUpdateSeries,
@@ -151,6 +151,7 @@ class Bar {
151
151
  this.drawBar({
152
152
  ctx,
153
153
  positions: { x, y, w, h },
154
+ isTop: item.isTop,
154
155
  });
155
156
 
156
157
  if (showValue.use) {
@@ -212,6 +213,7 @@ class Bar {
212
213
  this.drawBar({
213
214
  ctx,
214
215
  positions: { x, y, w, h: this.isHorizontal ? -h : h },
216
+ isTop: item.data.isTop,
215
217
  });
216
218
 
217
219
  if (showValue.use) {
@@ -409,7 +411,7 @@ class Bar {
409
411
  ctx.restore();
410
412
  }
411
413
 
412
- drawBar({ ctx, positions }) {
414
+ drawBar({ ctx, positions, isTop }) {
413
415
  const isHorizontal = this.isHorizontal;
414
416
  const isStackBar = 'stackIndex' in this;
415
417
  const isBorderRadius = this.borderRadius && this.borderRadius > 0;
@@ -421,7 +423,7 @@ class Bar {
421
423
  return;
422
424
  }
423
425
 
424
- if (isBorderRadius && !isStackBar) {
426
+ if (isBorderRadius && (isStackBar && isTop)) {
425
427
  try {
426
428
  this.drawRoundedRect(ctx, positions);
427
429
  } catch (e) {
@@ -12,7 +12,7 @@ export default {
12
12
  * @returns {any} position
13
13
  */
14
14
  calculateX(value, min, max, area, startPoint = 0) {
15
- if (value === null) {
15
+ if (value === null || value === undefined) {
16
16
  return null;
17
17
  }
18
18
 
@@ -35,7 +35,7 @@ export default {
35
35
  * @returns {any} position
36
36
  */
37
37
  calculateSubX(value, min, max, area, startPoint = 0) {
38
- if (value === null) {
38
+ if (value === null || value === undefined) {
39
39
  return null;
40
40
  }
41
41
 
@@ -56,7 +56,7 @@ export default {
56
56
  calculateY(value, min, max, area, startPoint = 0) {
57
57
  let calcY;
58
58
 
59
- if (value === null) {
59
+ if (value === null || value === undefined) {
60
60
  return null;
61
61
  }
62
62
 
@@ -26,7 +26,7 @@ const modules = {
26
26
 
27
27
  if (series && sData) {
28
28
  if (series.isExistGrp && series.stackIndex) {
29
- series.data = this.addSeriesStackDS(sData, label, series.bsIds, series.stackIndex);
29
+ series.data = this.addSeriesStackDS(sData, label, series);
30
30
  } else {
31
31
  series.data = this.addSeriesDS(sData, label);
32
32
  }
@@ -173,12 +173,12 @@ const modules = {
173
173
  * Take data and label to create stack data for each series
174
174
  * @param {object} data chart series info
175
175
  * @param {object} label chart label
176
- * @param {array} bsIds stacked base data ID List
177
- * @param {number} sIdx series ordered index
176
+ * @param {object} series series Information
178
177
  *
179
178
  * @returns {array} data for each series
180
179
  */
181
- addSeriesStackDS(data, label, bsIds, sIdx = 0) {
180
+ addSeriesStackDS(data, label, series) {
181
+ const bsIds = series.bsIds; // stacked base data ID List
182
182
  const isHorizontal = this.options.horizontal;
183
183
  const sdata = [];
184
184
 
@@ -201,6 +201,8 @@ const modules = {
201
201
  };
202
202
 
203
203
  data.forEach((curr, index) => {
204
+ const { stackIndex, show: isShowSeries } = series;
205
+ const isTop = true; // is top position on stack (Stacked or not, default is true)
204
206
  const baseIndex = bsIds.length - 1 < 0 ? 0 : bsIds.length - 1;
205
207
  let bdata = getBaseDataPosition(baseIndex, index); // base(previous) series data
206
208
  let odata = curr; // current series original data
@@ -214,7 +216,7 @@ const modules = {
214
216
  }
215
217
 
216
218
  const oData = odata?.value ?? odata;
217
- if (sIdx > 0) {
219
+ if (stackIndex > 0) {
218
220
  if (oData != null) {
219
221
  gdata = bdata + oData;
220
222
  } else {
@@ -226,7 +228,14 @@ const modules = {
226
228
  gdata = oData;
227
229
  }
228
230
 
229
- sdata.push(this.addData(gdata, ldata, odata, bdata));
231
+ if (gdata && isShowSeries) {
232
+ for (let idx = baseIndex; idx > -1; idx--) {
233
+ const prevSeriesData = this.seriesList[bsIds[idx]];
234
+ prevSeriesData.data[index].isTop = false;
235
+ }
236
+ }
237
+
238
+ sdata.push(this.addData(gdata, ldata, odata, bdata, isTop));
230
239
  }
231
240
  });
232
241
 
@@ -267,10 +276,11 @@ const modules = {
267
276
  * @param {object} ldata label data (x-axis value for vertical chart)
268
277
  * @param {object} odata original data (without stacked value)
269
278
  * @param {object} bdata base data (stacked value)
279
+ * @param {boolean} isTop is top position on stack (Stacked or not, default is true)
270
280
 
271
281
  * @returns {object} data for each graph point
272
282
  */
273
- addData(gdata, ldata, odata = null, bdata = null) {
283
+ addData(gdata, ldata, odata = null, bdata = null, isTop = true) {
274
284
  let data;
275
285
  const gdataValue = gdata?.value ?? gdata;
276
286
  const odataValue = odata?.value ?? odata;
@@ -287,6 +297,7 @@ const modules = {
287
297
  data.w = null;
288
298
  data.h = null;
289
299
  data.dataColor = dataColor || null;
300
+ data.isTop = isTop;
290
301
 
291
302
  return data;
292
303
  },
@@ -23,7 +23,10 @@
23
23
  />
24
24
  </template>
25
25
  <template v-else>
26
- <div class="ev-date-picker-tag-wrapper">
26
+ <div
27
+ class="ev-date-picker-tag-wrapper"
28
+ @click="clickSelectInput"
29
+ >
27
30
  <span class="ev-date-picker-prefix-icon">
28
31
  <i class="ev-icon-calendar" />
29
32
  </span>
@@ -33,7 +36,6 @@
33
36
  readonly
34
37
  :placeholder="$props.placeholder"
35
38
  :disabled="$props.disabled"
36
- @click="clickSelectInput"
37
39
  />
38
40
  <template
39
41
  v-if="$props.mode === 'dateMulti'
@@ -196,6 +198,19 @@ export default {
196
198
  shortcuts: {
197
199
  type: Array,
198
200
  default: () => [],
201
+ validator: (value) => {
202
+ if (!value.length) {
203
+ return true;
204
+ }
205
+ return value.every(({ shortcutDate }) => {
206
+ if (typeof shortcutDate !== 'function') {
207
+ return false;
208
+ }
209
+ const date = shortcutDate();
210
+ return (Array.isArray(date) && date.every(d => d instanceof Date) && date[0] <= date[1])
211
+ || (typeof date === 'object' && date instanceof Date);
212
+ });
213
+ },
199
214
  },
200
215
  },
201
216
  emits: {
@@ -355,6 +370,7 @@ export default {
355
370
 
356
371
  &.num {
357
372
  padding-right: 8px;
373
+ cursor: pointer;
358
374
  }
359
375
 
360
376
  .ev-tag-suffix {
@@ -279,22 +279,6 @@ export const useShortcuts = (param) => {
279
279
  return `${formatDate(dateTimeValue)} ${lpadToTwoDigits(hour)}:${lpadToTwoDigits(min)}:${lpadToTwoDigits(sec)}`;
280
280
  };
281
281
 
282
- /**
283
- * 시, 분, 초를 원하는 값으로 변환
284
- * @param targetDate
285
- * @param hour
286
- * @param min
287
- * @param sec
288
- * @returns {Date}
289
- */
290
- const getChangedDateTime = (targetDate, hour, min, sec) => {
291
- const dateTimeValue = new Date(targetDate);
292
- dateTimeValue.setHours(hour);
293
- dateTimeValue.setMinutes(min);
294
- dateTimeValue.setSeconds(sec);
295
- return dateTimeValue;
296
- };
297
-
298
282
  /**
299
283
  * 초기 shortcut 세팅
300
284
  * 해당하는 날짜면 active
@@ -349,18 +333,21 @@ export const useShortcuts = (param) => {
349
333
  }
350
334
 
351
335
  const shortcutDate = targetShortcut.shortcutDate;
336
+ const timeFormat = props.options?.timeFormat;
352
337
 
353
338
  if (isRange) {
354
339
  const [fromDate, toDate] = shortcutDate();
355
340
  if (props.mode === 'dateTimeRange') {
356
- const from = getChangedDateTime(fromDate, 0, 0, 0);
357
- const to = getChangedDateTime(toDate, 0, 0, 0);
358
- const [fromTimeFormat, toTimeFormat] = props.options?.timeFormat;
359
-
360
- mv.value = [
361
- getChangedValueByTimeFormat(fromTimeFormat, formatDateTime(from)),
362
- getChangedValueByTimeFormat(toTimeFormat, formatDateTime(to)),
363
- ];
341
+ if (timeFormat?.length) {
342
+ const [fromTimeFormat, toTimeFormat] = timeFormat;
343
+
344
+ mv.value = [
345
+ getChangedValueByTimeFormat(fromTimeFormat, formatDateTime(fromDate)),
346
+ getChangedValueByTimeFormat(toTimeFormat, formatDateTime(toDate)),
347
+ ];
348
+ } else {
349
+ mv.value = [formatDateTime(fromDate), formatDateTime(toDate)];
350
+ }
364
351
  } else {
365
352
  mv.value = [formatDate(fromDate), formatDate(toDate)];
366
353
  }
@@ -368,12 +355,13 @@ export const useShortcuts = (param) => {
368
355
  const sDate = shortcutDate();
369
356
  mv.value = props.mode === 'dateTime'
370
357
  ? getChangedValueByTimeFormat(
371
- props.options?.timeFormat,
372
- formatDateTime(getChangedDateTime(sDate, 0, 0, 0)))
358
+ timeFormat,
359
+ formatDateTime(sDate))
373
360
  : formatDate(sDate);
374
361
  }
375
362
 
376
363
  clearShortcuts();
364
+ activeShortcut(targetKey);
377
365
  };
378
366
 
379
367
  watch(