@mptw/skylens-ui 1.4.11 → 1.4.13

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.
@@ -16,7 +16,7 @@
16
16
  slot(name='invalid-feedback') {{ invalidFeedback }}
17
17
  ClientOnly
18
18
  Teleport(to="body")
19
- .select-options(ref='optionList', :style="`min-width: ${popupMaxWidth}px`")
19
+ .select-options(ref='optionList', :class='{ "select-options--sm": size === "sm", "select-options--xs": size === "xs" }', :style="`min-width: ${popupMaxWidth}px`")
20
20
  .options-header(v-if='withSearch')
21
21
  SLSearchInput(
22
22
  v-model='search',
@@ -59,7 +59,7 @@ export default defineComponent({
59
59
  size: {
60
60
  type: String,
61
61
  default: "",
62
- validator: (val: string) => ["", "sm"].includes(val),
62
+ validator: (val: string) => ["", "sm", "xs"].includes(val),
63
63
  },
64
64
  modelValue: {
65
65
  type: [Number, String, Object, Array] as PropType<any>,
@@ -465,16 +465,16 @@ export default defineComponent({
465
465
  .form-control
466
466
  @apply flex-grow
467
467
 
468
+ &.custom-select-xs
469
+ .form-control
470
+ label
471
+ @apply py-px s('px-0.75') text-xs
472
+
468
473
  &.custom-select-sm
469
474
  .form-control
470
475
  label
471
476
  @apply s("py-0.75") text-sm
472
477
 
473
- .select-options
474
- .option-list
475
- .option-button
476
- @apply py-1 text-sm
477
-
478
478
  &.disabled, &.readonly
479
479
  .form-control
480
480
  label
@@ -517,6 +517,16 @@ export default defineComponent({
517
517
  .select-options
518
518
  @apply flex flex-col z-60 absolute invisible border border-primary-light rounded bg-white overflow-hidden pointer-events-none
519
519
 
520
+ &.select-options--xs
521
+ .option-list
522
+ .option-button
523
+ @apply py-1 text-xs
524
+
525
+ &.select-options--sm
526
+ .option-list
527
+ .option-button
528
+ @apply py-1 text-sm
529
+
520
530
  &[data-show]
521
531
  @apply visible pointer-events-auto
522
532
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mptw/skylens-ui",
3
3
  "type": "module",
4
- "version": "1.4.11",
4
+ "version": "1.4.13",
5
5
  "main": "./nuxt.config.ts",
6
6
  "scripts": {
7
7
  "dev": "nuxi dev .playground",
package/utils/index.ts CHANGED
@@ -138,9 +138,9 @@ export const hexToRgba = (hex: string, opacity: number) => {
138
138
  const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
139
139
  return result
140
140
  ? `rgba(${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(
141
- result[3],
142
- 16
143
- )}, ${opacity})`
141
+ result[3],
142
+ 16
143
+ )}, ${opacity})`
144
144
  : `rgba(255, 255, 255, 0)`;
145
145
  };
146
146
 
@@ -233,8 +233,8 @@ export const getBarChartGridTop = (maxValue: number, showLabel = true) => {
233
233
  30 +
234
234
  (showLabel
235
235
  ? Number(maxValue).toLocaleString().length *
236
- 8 *
237
- Math.sin((30 / 180) * Math.PI)
236
+ 8 *
237
+ Math.sin((30 / 180) * Math.PI)
238
238
  : 0)
239
239
  );
240
240
  };
@@ -250,8 +250,8 @@ export const getBarChartBarLabelHeight = (maxValue: string | number, showLabel =
250
250
  16 +
251
251
  (showLabel
252
252
  ? Number(maxValue).toLocaleString().length *
253
- 8 *
254
- Math.sin((30 / 180) * Math.PI)
253
+ 8 *
254
+ Math.sin((30 / 180) * Math.PI)
255
255
  : 0)
256
256
  );
257
257
  };
@@ -286,11 +286,11 @@ export const getDayDatesMatchWeekDay = (dateRange1: IDateRange, dateRange2: IDat
286
286
  const weekDayDiff = weekDayOfRange1Start - weekDayOfRange2Start;
287
287
 
288
288
  if (
289
- (weekDayDiff > 0 && weekDayDiff <= 3)
290
- || (weekDayDiff < -3)
291
- ) {
292
- const iteratorTimes = weekDayDiff > 0 ? weekDayDiff : (weekDayDiff + 7);
293
- for(let i = 0; i < iteratorTimes; i += 1) {
289
+ (weekDayDiff > 0 && weekDayDiff <= 3)
290
+ || (weekDayDiff < -3)
291
+ ) {
292
+ const iteratorTimes = weekDayDiff > 0 ? weekDayDiff : (weekDayDiff + 7);
293
+ for (let i = 0; i < iteratorTimes; i += 1) {
294
294
  const day = addDays(dateRange2.start, i);
295
295
  dayDates.push({
296
296
  date: formatDate(day, 'yyyy/MM/dd'),
@@ -301,7 +301,7 @@ export const getDayDatesMatchWeekDay = (dateRange1: IDateRange, dateRange2: IDat
301
301
  }
302
302
 
303
303
  const daysOfLastMonth = differenceInCalendarDays(dateRange1.end, dateRange1.start) + 1;
304
- for(let i = 0; i < daysOfLastMonth; i += 1) {
304
+ for (let i = 0; i < daysOfLastMonth; i += 1) {
305
305
  const day = addDays(dateRange1.start, i);
306
306
  dayDates.push({
307
307
  date: formatDate(day, 'yyyy/MM/dd'),
@@ -312,7 +312,7 @@ export const getDayDatesMatchWeekDay = (dateRange1: IDateRange, dateRange2: IDat
312
312
 
313
313
  const overMonth1Days = getDate(dateRange2.end) - getDate(dateRange1.end) - (7 - Math.abs(weekDayDiff));
314
314
  if (overMonth1Days > 0) {
315
- for(let j = overMonth1Days; j > 0; j -= 1) {
315
+ for (let j = overMonth1Days; j > 0; j -= 1) {
316
316
  const day = subDays(dateRange2.end, j);
317
317
  dayDates.push({
318
318
  date: formatDate(day, 'yyyy/MM/dd'),
@@ -327,7 +327,7 @@ export const getDayDatesMatchWeekDay = (dateRange1: IDateRange, dateRange2: IDat
327
327
  }
328
328
 
329
329
  export const translateDayToLocale = (day: number) => {
330
- switch(day) {
330
+ switch (day) {
331
331
  case 0:
332
332
  return '日';
333
333
  case 1:
@@ -402,11 +402,11 @@ export const downloadBlob = (data: ExcelJS.Buffer, fileName: string, mimeType: s
402
402
  };
403
403
 
404
404
  export const isDateRangesEqual = (dateRange1: IDateRange, dateRange2: IDateRange) => {
405
- return getYear(dateRange1.start) === getYear(dateRange2.start) &&
406
- getMonth(dateRange1.start) === getMonth(dateRange2.start) &&
407
- getDate(dateRange1.start) === getDate(dateRange2.start) &&
408
- getYear(dateRange1.end) === getYear(dateRange2.end) &&
409
- getMonth(dateRange1.end) === getMonth(dateRange2.end) &&
405
+ return getYear(dateRange1.start) === getYear(dateRange2.start) &&
406
+ getMonth(dateRange1.start) === getMonth(dateRange2.start) &&
407
+ getDate(dateRange1.start) === getDate(dateRange2.start) &&
408
+ getYear(dateRange1.end) === getYear(dateRange2.end) &&
409
+ getMonth(dateRange1.end) === getMonth(dateRange2.end) &&
410
410
  getDate(dateRange1.end) === getDate(dateRange2.end);
411
411
  }
412
412
 
@@ -472,7 +472,16 @@ export const ga4ev = ({ category, action, label, value, cb }: {
472
472
  data.eventCallback = cb;
473
473
  }
474
474
 
475
- window.dataLayer?.push(data);
475
+ const eventParams: any = {
476
+ action,
477
+ value,
478
+ };
479
+
480
+ if (cb) {
481
+ eventParams.event_callback = cb;
482
+ }
483
+
484
+ window.dataLayer?.push('event', label, eventParams);
476
485
  }
477
486
  };
478
487
 
@@ -543,14 +552,14 @@ export const waitForTime = (ms: number) => {
543
552
  }
544
553
 
545
554
  export const waitForever = () => {
546
- return new Promise(r => {});
555
+ return new Promise(r => { });
547
556
  }
548
557
 
549
558
  export const waitFor = async (condition: () => boolean, pollInterval = 50, timeoutAfter: number) => {
550
559
  const startTime = Date.now();
551
560
 
552
- while(true) {
553
- if (typeof(timeoutAfter) === 'number' && Date.now() > startTime + timeoutAfter) {
561
+ while (true) {
562
+ if (typeof (timeoutAfter) === 'number' && Date.now() > startTime + timeoutAfter) {
554
563
  throw 'Condition not met before timeout';
555
564
  }
556
565