@peng_kai/kit 0.1.11 → 0.1.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.
@@ -7,7 +7,7 @@ const $actions = ref<HTMLDivElement>();
7
7
  </script>
8
8
 
9
9
  <template>
10
- <ACard :bordered="false" size="small" class="my-3 relative">
10
+ <ACard size="small" class="my-3 relative">
11
11
  <template #title>
12
12
  <div class="flex items-center min-h-10">
13
13
  <div class="title">
@@ -3,6 +3,11 @@ import { computed } from 'vue';
3
3
  import bigNumber from 'bignumber.js';
4
4
  import isNil from 'lodash-es/isNil';
5
5
 
6
+ export const config = {
7
+ aboveColor: '#52c41a',
8
+ belowColor: '#ff4d4f',
9
+ };
10
+
6
11
  /**
7
12
  * 当 symbol 为以下值时,使用预设的 Logo
8
13
  */
@@ -64,7 +69,7 @@ const amountColor = computed(() => {
64
69
  if (!props.colorful || (Number.isNaN(num) ? true : num === 0))
65
70
  return '';
66
71
 
67
- return num > 0 ? '#52c41a' : (num < 0 ? '#ff4d4f' : '#000');
72
+ return num > 0 ? config.aboveColor : (num < 0 ? config.belowColor : '');
68
73
  });
69
74
  const symbol = computed(() => presetSymbols[props.symbol!] ?? props.symbol ?? '');
70
75
  </script>
@@ -75,10 +80,9 @@ const symbol = computed(() => presetSymbols[props.symbol!] ?? props.symbol ?? ''
75
80
  <span v-if="props.approx" class="color-$amount-color">≈</span>
76
81
 
77
82
  <!-- 符号 -->
78
- <img
79
- v-if="symbol.startsWith('http')" class="symbol-logo" :src="symbol"
80
- :alt="props.unit"
81
- > <!-- 图片Logo -->
83
+ <img v-if="symbol.startsWith('http')" class="symbol-logo" :src="symbol">
84
+
85
+ <!-- 图片Logo -->
82
86
  <span v-else class="color-$amount-color">{{ symbol }}</span> <!-- 文本Logo,如法定币种符号(¥、$) -->
83
87
 
84
88
  <!-- 金额 -->
@@ -56,6 +56,10 @@
56
56
  // --max-body-height: ;
57
57
  // --body-height: ;
58
58
 
59
+ @media bp-lt-mobilel {
60
+ --padding-size: 16px;
61
+ }
62
+
59
63
  .ant-modal-content {
60
64
  padding: 0;
61
65
  }
@@ -67,6 +71,10 @@
67
71
  padding: 0 var(--padding-size);
68
72
  border-bottom: 1px solid var(--antd-colorBorderSecondary);
69
73
  margin: 0;
74
+
75
+ @media bp-lt-mobilel {
76
+ min-height: 51px;
77
+ }
70
78
  }
71
79
 
72
80
  .ant-modal-body {
@@ -95,10 +103,14 @@
95
103
  // 抽屉的基本款样式
96
104
  .ant-drawer.antd-cover__basic-drawer {
97
105
  --padding-size: 22px;
98
-
106
+
99
107
  // --min-body-height: ;
100
108
  // --max-body-height: ;
101
109
  // --body-height: ;
110
+
111
+ @media bp-lt-mobilel {
112
+ --padding-size: 16px;
113
+ }
102
114
 
103
115
  .ant-drawer-content {
104
116
  padding: 0;
@@ -120,6 +132,10 @@
120
132
  padding: 0 var(--padding-size);
121
133
  margin: 0;
122
134
  border-bottom: 1px solid var(--antd-colorBorderSecondary);
135
+
136
+ @media bp-lt-mobilel {
137
+ min-height: 51px;
138
+ }
123
139
  }
124
140
 
125
141
  .ant-drawer-body {
@@ -28,3 +28,7 @@
28
28
  :root {
29
29
  font-family: var(--antd-fontFamily);
30
30
  }
31
+
32
+ :root.dark {
33
+ color-scheme: dark;
34
+ }
@@ -1,10 +1,13 @@
1
- <script setup lang="ts">
1
+ <script lang="ts">
2
2
  import { computed } from 'vue';
3
3
  import { InputNumber as AInputNumber, Form } from 'ant-design-vue';
4
+ </script>
4
5
 
6
+ <script setup lang="ts">
5
7
  const props = withDefaults(
6
8
  defineProps<{
7
- value: [number, number]
9
+ value: [number | undefined, number | undefined]
10
+ placeholder?: [string, string]
8
11
  min?: number
9
12
  max?: number
10
13
  }>(),
@@ -14,7 +17,7 @@ const props = withDefaults(
14
17
  },
15
18
  );
16
19
  const emits = defineEmits<{
17
- (e: 'update:value', value: [number, number]): void
20
+ (e: 'update:value', value: typeof props.value): void
18
21
  }>();
19
22
 
20
23
  const formItemContext = Form.useInjectFormItemContext();
@@ -23,8 +26,7 @@ const minValue = computed({
23
26
  return props.value[0];
24
27
  },
25
28
  set(value) {
26
- emits('update:value', [value, props.value[1]]);
27
- formItemContext.onFieldChange();
29
+ updateValue(value, maxValue.value);
28
30
  },
29
31
  });
30
32
  const maxValue = computed({
@@ -32,22 +34,26 @@ const maxValue = computed({
32
34
  return props.value[1];
33
35
  },
34
36
  set(value) {
35
- emits('update:value', [props.value[0], value]);
36
- formItemContext.onFieldChange();
37
+ updateValue(minValue.value, value);
37
38
  },
38
39
  });
40
+
41
+ function updateValue(...args: typeof props.value) {
42
+ emits('update:value', args.sort());
43
+ formItemContext.onFieldChange();
44
+ }
39
45
  </script>
40
46
 
41
47
  <template>
42
48
  <div class="flex items-center">
43
49
  <AInputNumber
44
50
  v-model:value="minValue" class="w-full" :min="props.min"
45
- :max="props.max"
51
+ :max="props.max" :placeholder="props.placeholder?.[0]"
46
52
  />
47
- <span>&nbsp;~&nbsp;</span>
53
+ <span>&nbsp;-&nbsp;</span>
48
54
  <AInputNumber
49
55
  v-model:value="maxValue" class="w-full" :min="props.min"
50
- :max="props.max"
56
+ :max="props.max" :placeholder="props.placeholder?.[1]"
51
57
  />
52
58
  </div>
53
59
  </template>
@@ -1,5 +1,5 @@
1
1
  import { Modal as AntModal } from 'ant-design-vue';
2
- import { createVNode, defineComponent, isProxy, reactive, toRef, toRefs } from 'vue';
2
+ import { createVNode, defineComponent, h, isProxy, reactive, ref, toRef, toRefs, watch } from 'vue';
3
3
  import type { Component } from 'vue';
4
4
  import type { ModalProps } from 'ant-design-vue';
5
5
  import type { ComponentProps } from 'vue-component-type-helpers';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@peng_kai/kit",
3
3
  "type": "module",
4
- "version": "0.1.11",
4
+ "version": "0.1.13",
5
5
  "description": "",
6
6
  "author": "",
7
7
  "license": "ISC",
@@ -12,7 +12,7 @@ export function formatPaging(): Parameters<AxiosInterceptorManager<any>['use']>
12
12
  return resp;
13
13
 
14
14
  if (result.pagination) {
15
- const originData = result.data;
15
+ const originData = result?.data ?? {};
16
16
  result.data = originData.list ? { ...originData } : { list: originData };
17
17
  result.data.pagination = result.pagination;
18
18