@peng_kai/kit 0.2.36 → 0.2.38

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.
@@ -38,14 +38,22 @@ const text = computed(() => {
38
38
 
39
39
  return props.utc ? ts.utc().format(props.template) : ts.format(props.template);
40
40
  });
41
+
42
+ window.dayjs = dayjs;
41
43
  </script>
42
44
 
43
45
  <template>
44
46
  <ATooltip destroyTooltipOnHide>
45
47
  <template v-if="timestamp" #title>
46
48
  <div>{{ dayjs(timestamp).fromNow?.() }}</div>
47
- <div><span class="inline-block w-2em">本地</span> {{ dayjs(timestamp).format('YYYY-MM-DD HH:mm:ss') }}</div>
48
- <div><span class="inline-block w-2em">UTC</span> {{ dayjs(timestamp).utc().format('YYYY-MM-DD HH:mm:ss') }}</div>
49
+ <div>
50
+ {{ dayjs(timestamp).format('YYYY-MM-DD HH:mm:ss') }}
51
+ <span class="op-50">本地</span>
52
+ </div>
53
+ <div v-if="dayjs().utc">
54
+ {{ dayjs(timestamp).utc?.().format('YYYY-MM-DD HH:mm:ss') }}
55
+ <span class="op-50">UTC</span>
56
+ </div>
49
57
  </template>
50
58
  <span v-bind="$attrs" class="text">{{ text }}</span>
51
59
  </ATooltip>
package/libs/dayjs.ts CHANGED
@@ -8,12 +8,12 @@ import tz from 'dayjs/esm/plugin/timezone';
8
8
  import 'dayjs/esm/locale/zh';
9
9
  import 'dayjs/esm/locale/en';
10
10
 
11
- export type { Dayjs, PluginFunc, UnitType, UnitTypeLong, UnitTypeLongPlural, UnitTypeShort, QUnitType, ConfigType, ConfigTypeMap, OpUnitType, OptionType, ManipulateType } from 'dayjs';
12
- export default dayjs;
13
-
14
11
  dayjs.locale('zh');
15
12
  dayjs.extend(relativeTime);
16
13
  dayjs.extend(weekday);
17
14
  dayjs.extend(localeData);
18
15
  dayjs.extend(utc);
19
16
  dayjs.extend(tz);
17
+
18
+ export type { Dayjs, PluginFunc, UnitType, UnitTypeLong, UnitTypeLongPlural, UnitTypeShort, QUnitType, ConfigType, ConfigTypeMap, OpUnitType, OptionType, ManipulateType } from 'dayjs';
19
+ export default dayjs;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@peng_kai/kit",
3
3
  "type": "module",
4
- "version": "0.2.36",
4
+ "version": "0.2.38",
5
5
  "description": "",
6
6
  "author": "",
7
7
  "license": "ISC",
package/utils/date.ts CHANGED
@@ -29,7 +29,7 @@ export function endOfDay(day: dayjs.ConfigType) {
29
29
  */
30
30
  export function rangeOf<F extends string>(
31
31
  range: [dayjs.ConfigType, dayjs.ConfigType],
32
- fields: [F, F],
32
+ fields: [F, F] = ['start_time', 'end_time'] as [F, F],
33
33
  unit: dayjs.OpUnitType = 'day',
34
34
  utc = true,
35
35
  ) {
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { useResizeObserver } from '@vueuse/core';
2
+ import { useEventListener, useResizeObserver } from '@vueuse/core';
3
3
  import * as echarts from 'echarts';
4
4
  import { ref, shallowRef, toRef, watchEffect } from 'vue';
5
5
  import { useIsDark } from '../../../hooks/useIsDark';
@@ -33,17 +33,23 @@ watchEffect(() => {
33
33
  * 考虑到性能问题,所以当尺寸变化时隐藏图表,避免浏览器反复绘制。
34
34
  */
35
35
  let sizeResponsiveTimer = 0;
36
- useResizeObserver(toRef(() => $chartEle.value?.parentElement), () => {
36
+ function resetHanlder() {
37
+ // $chartEle.value && ($chartEle.value.hidden = true);
37
38
  $chartEle.value?.style.setProperty('width', '0px');
38
39
  $chartEle.value?.style.setProperty('overflow', 'hidden');
40
+ $chartEle.value?.style.setProperty('visibility', 'hidden');
39
41
  clearTimeout(sizeResponsiveTimer);
40
42
 
41
43
  sizeResponsiveTimer = window.setTimeout(() => {
42
44
  $chartEle.value?.style.removeProperty('width');
43
45
  $chartEle.value?.style.removeProperty('overflow');
46
+ $chartEle.value?.style.removeProperty('visibility');
47
+ // $chartEle.value && ($chartEle.value.hidden = false);
44
48
  echartInst.value?.resize({ width: 'auto' });
45
- }, 200);
46
- });
49
+ }, 100);
50
+ }
51
+ useResizeObserver(toRef(() => $chartEle.value?.parentElement), resetHanlder);
52
+ useEventListener(window, 'resize', resetHanlder);
47
53
  </script>
48
54
 
49
55
  <template>