@peng_kai/kit 0.3.0-beta.27 → 0.3.0-beta.29

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.
@@ -3,14 +3,14 @@ import dayjs, { type Dayjs } from '../../../libs/dayjs';
3
3
  import { type ComponentProps } from 'vue-component-type-helpers'
4
4
 
5
5
  export const antdRangePickerPresets = [
6
- { label: '今天', key: 'today', value: [dayjs().startOf('day'), dayjs().endOf('day')] },
7
- { label: '昨天', key: 'yesterday', value: [dayjs().subtract(1, 'day').startOf('day'), dayjs().subtract(1, 'day').endOf('day')] },
8
- { label: '本月', key: 'thisMonth', value: [dayjs().startOf('month'), dayjs().endOf('month')] },
9
- { label: '上个月', key: 'lastMonth', value: [dayjs().subtract(1, 'month').startOf('month'), dayjs().subtract(1, 'month').endOf('month')] },
10
- { label: '近3个月', key: 'last3months', value: [dayjs().subtract(2, 'month').startOf('month'), dayjs().endOf('month')] },
11
- { label: '近半年', key: 'last6months', value: [dayjs().subtract(5, 'month').startOf('month'), dayjs().endOf('month')] },
12
- { label: '今年', key: 'thisMonth', value: [dayjs().startOf('year'), dayjs().endOf('month')] },
13
- ] as { label: string; key: string; value: [Dayjs, Dayjs] }[]
6
+ { label: '今天', key: 'today', get value() {return [dayjs().startOf('day'), dayjs().endOf('day')] } },
7
+ { label: '昨天', key: 'yesterday', get value() { return [dayjs().subtract(1, 'day').startOf('day'), dayjs().subtract(1, 'day').endOf('day')] } },
8
+ { label: '本月', key: 'thisMonth', get value() { return [dayjs().startOf('month'), dayjs().endOf('month')] } },
9
+ { label: '上个月', key: 'lastMonth', get value() { return [dayjs().subtract(1, 'month').startOf('month'), dayjs().subtract(1, 'month').endOf('month')] } },
10
+ { label: '近3个月', key: 'last3months', get value() { return [dayjs().subtract(2, 'month').startOf('month'), dayjs().endOf('month')] } },
11
+ { label: '近半年', key: 'last6months', get value() { return [dayjs().subtract(5, 'month').startOf('month'), dayjs().endOf('month')] } },
12
+ { label: '今年', key: 'thisYear', get value() { return [dayjs().startOf('year'), dayjs().endOf('month')] } },
13
+ ] as unknown as { label: string; key: string; value: [Dayjs, Dayjs] }[]
14
14
 
15
15
  export const antdRangePickerShowTimeProps: ComponentProps<typeof RangePicker> = {
16
16
  presets: antdRangePickerPresets,
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { useIntervalFn } from '@vueuse/core';
2
+ import { useEventListener, useIntervalFn } from '@vueuse/core';
3
3
  import { Empty, Dropdown, Badge, Menu, MenuItem } from 'ant-design-vue';
4
4
  import { type UseQueryReturnType } from '@tanstack/vue-query'
5
5
  import { watch, ref, computed } from 'vue'
@@ -8,6 +8,7 @@ import { useRouter } from 'vue-router';
8
8
  import audioURL from './y682.mp3?url';
9
9
 
10
10
  const noticeAudio = new Audio(audioURL);
11
+ noticeAudio.muted = true;
11
12
  noticeAudio.src = audioURL;
12
13
  document.body.append(noticeAudio);
13
14
 
@@ -50,6 +51,9 @@ function operate(notice: TNotice) {
50
51
  // watch(noticeNum, (num = 0, oldNum = 0) => {
51
52
  // num > oldNum && noticeAudio.play();
52
53
  // }, { immediate: true });
54
+ useEventListener(document, 'click', () => {
55
+ noticeAudio.muted = false;
56
+ });
53
57
 
54
58
  useIntervalFn(() => {
55
59
  const num = noticeNum.value;
@@ -1,5 +1,5 @@
1
1
  import { Modal as AntModal } from 'ant-design-vue';
2
- import { tryOnBeforeUnmount } from '@vueuse/core';
2
+ import { tryOnBeforeUnmount, tryOnMounted } from '@vueuse/core';
3
3
  import { createVNode, defineComponent, isProxy, onDeactivated, onMounted, reactive, toRef, toRefs } from 'vue';
4
4
  import type { Component } from 'vue';
5
5
  import type { ModalProps } from 'ant-design-vue';
@@ -128,7 +128,7 @@ export function useAntdModal<Comp extends Component>(
128
128
  (compProps as any).onConfirm = onConfirm;
129
129
 
130
130
  tryOnBeforeUnmount(_onClose);
131
- onDeactivated(_onClose);
131
+ tryOnMounted(() => onDeactivated(_onClose));
132
132
 
133
133
  return {
134
134
  PresetComponent,
package/libs/dayjs.ts CHANGED
@@ -12,7 +12,7 @@ import advancedFormat from 'dayjs/esm/plugin/advancedFormat';
12
12
  import customParseFormat from 'dayjs/esm/plugin/customParseFormat';
13
13
  import updateLocale from 'dayjs/esm/plugin/updateLocale';
14
14
  import isBetween from 'dayjs/esm/plugin/isBetween';
15
- import 'dayjs/esm/locale/zh';
15
+ import 'dayjs/esm/locale/zh-cn';
16
16
  import 'dayjs/esm/locale/en';
17
17
 
18
18
  export type { Dayjs, PluginFunc, UnitType, UnitTypeLong, UnitTypeLongPlural, UnitTypeShort, QUnitType, ConfigType, ConfigTypeMap, OpUnitType, OptionType, ManipulateType } from 'dayjs';
@@ -30,4 +30,4 @@ dayjs.extend(advancedFormat);
30
30
  dayjs.extend(customParseFormat);
31
31
  dayjs.extend(updateLocale);
32
32
  dayjs.extend(isBetween);
33
- dayjs.locale('zh');
33
+ dayjs.locale('zh-cn');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@peng_kai/kit",
3
3
  "type": "module",
4
- "version": "0.3.0-beta.27",
4
+ "version": "0.3.0-beta.29",
5
5
  "description": "",
6
6
  "author": "",
7
7
  "license": "ISC",