@peng_kai/kit 0.1.11 → 0.1.12
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,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 ?
|
|
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>
|
|
@@ -78,7 +83,9 @@ const symbol = computed(() => presetSymbols[props.symbol!] ?? props.symbol ?? ''
|
|
|
78
83
|
<img
|
|
79
84
|
v-if="symbol.startsWith('http')" class="symbol-logo" :src="symbol"
|
|
80
85
|
:alt="props.unit"
|
|
81
|
-
>
|
|
86
|
+
>
|
|
87
|
+
|
|
88
|
+
<!-- 图片Logo -->
|
|
82
89
|
<span v-else class="color-$amount-color">{{ symbol }}</span> <!-- 文本Logo,如法定币种符号(¥、$) -->
|
|
83
90
|
|
|
84
91
|
<!-- 金额 -->
|
package/admin/styles/index.scss
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
<script
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
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> 
|
|
53
|
+
<span> - </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';
|
|
@@ -48,8 +48,19 @@ export function useAntdModal<Comp extends Component>(
|
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
const PresetComponent = defineComponent({
|
|
51
|
+
setup() {
|
|
52
|
+
const hidden = ref(false);
|
|
53
|
+
|
|
54
|
+
watch(() => _modalProps.open, (open) => {
|
|
55
|
+
if (open)
|
|
56
|
+
hidden.value = false;
|
|
57
|
+
else
|
|
58
|
+
setTimeout(() => hidden.value = true, 500);
|
|
59
|
+
});
|
|
60
|
+
return { hidden };
|
|
61
|
+
},
|
|
51
62
|
render() {
|
|
52
|
-
return createVNode(AntModal, _modalProps, {
|
|
63
|
+
return createVNode(this.hidden ? 'div' : AntModal, _modalProps, {
|
|
53
64
|
[modalSlotName]: () => createVNode(_comp.is, compProps as any),
|
|
54
65
|
});
|
|
55
66
|
},
|