@didaoktv/didaoui-uniapp 1.0.0 → 1.2.0
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.
- package/README.md +16 -7
- package/components/dd-action-sheet/dd-action-sheet.vue +3 -3
- package/components/dd-album/album.js +19 -0
- package/components/dd-album/dd-album.vue +345 -0
- package/components/dd-album/props.js +89 -0
- package/components/dd-avatar/avatar.js +19 -0
- package/components/dd-avatar/dd-avatar.vue +172 -160
- package/components/dd-avatar/props.js +84 -0
- package/components/dd-avatar-group/avatarGroup.js +14 -0
- package/components/dd-avatar-group/dd-avatar-group.vue +110 -0
- package/components/dd-avatar-group/props.js +57 -0
- package/components/dd-badge/dd-badge.vue +2 -2
- package/components/dd-barcode/dd-barcode.vue +1030 -0
- package/components/dd-bill-detail/dd-bill-detail.vue +265 -0
- package/components/dd-button/dd-button.vue +17 -17
- package/components/dd-calendar/dd-calendar.vue +357 -0
- package/components/dd-canvas/dd-canvas.vue +1088 -0
- package/components/dd-capsule-button/dd-capsule-button.vue +6 -6
- package/components/dd-car-keyboard/carKeyboard.js +6 -0
- package/components/dd-car-keyboard/dd-car-keyboard.vue +315 -0
- package/components/dd-car-keyboard/props.js +19 -0
- package/components/dd-cascader/dd-cascader.vue +405 -0
- package/components/dd-cell/dd-cell.vue +50 -23
- package/components/dd-cell-group/dd-cell-group.vue +32 -25
- package/components/dd-champion-card/dd-champion-card.vue +4 -4
- package/components/dd-checkbox/dd-checkbox.vue +30 -39
- package/components/dd-checkbox-group/dd-checkbox-group.vue +67 -0
- package/components/dd-copy/dd-copy.vue +74 -0
- package/components/dd-coupon/dd-coupon.vue +368 -0
- package/components/dd-cropper/dd-cropper.vue +1297 -0
- package/components/dd-dialog/dd-dialog.vue +1 -1
- package/components/dd-divider/dd-divider.vue +3 -3
- package/components/dd-dropdown-item/dd-dropdown-item.vue +5 -5
- package/components/dd-empty-state/dd-empty-state.vue +1 -1
- package/components/dd-field/dd-field.vue +531 -106
- package/components/dd-form/dd-form.vue +116 -0
- package/components/dd-form/rules.ts +84 -0
- package/components/dd-goods-sku/dd-goods-sku.vue +434 -0
- package/components/dd-icon/dd-icon.vue +2 -2
- package/components/dd-image/dd-image.vue +4 -4
- package/components/dd-input/dd-input.vue +5 -5
- package/components/dd-keyboard/dd-keyboard.vue +178 -0
- package/components/dd-keyboard/keyboard.js +22 -0
- package/components/dd-keyboard/props.js +89 -0
- package/components/dd-link/dd-link.vue +87 -0
- package/components/dd-link/link.js +18 -0
- package/components/dd-link/props.js +44 -0
- package/components/dd-list-cell/dd-list-cell.vue +4 -4
- package/components/dd-loading/dd-loading.vue +1 -1
- package/components/dd-loadmore/dd-loadmore.vue +2 -2
- package/components/dd-markdown/dd-markdown.vue +344 -0
- package/components/dd-markdown/marked.esm.mjs +7 -0
- package/components/dd-mini-program-navbar/dd-mini-program-navbar.vue +9 -9
- package/components/dd-navigation/dd-navigation.vue +5 -5
- package/components/dd-number-keyboard/dd-number-keyboard.vue +200 -0
- package/components/dd-number-keyboard/numberKeyboard.js +8 -0
- package/components/dd-number-keyboard/props.js +24 -0
- package/components/dd-parse/dd-parse.vue +534 -0
- package/components/dd-parse/node/handler.wxs +26 -0
- package/components/dd-parse/node/node.vue +603 -0
- package/components/dd-parse/parse.js +13 -0
- package/components/dd-parse/parser.js +1400 -0
- package/components/dd-parse/props.js +57 -0
- package/components/dd-popover/dd-popover.vue +10 -10
- package/components/dd-popover-item/dd-popover-item.vue +3 -3
- package/components/dd-popup/dd-popup.vue +5 -5
- package/components/dd-poster/dd-poster.vue +695 -0
- package/components/dd-progress/dd-progress.vue +3 -3
- package/components/dd-pull-refresh/dd-pull-refresh.vue +3 -3
- package/components/dd-qrcode/dd-qrcode.vue +509 -0
- package/components/dd-qrcode/qrcode.js +1283 -0
- package/components/dd-radio/dd-radio.vue +19 -20
- package/components/dd-radio-group/dd-radio-group.vue +53 -0
- package/components/dd-rate/dd-rate.vue +1 -1
- package/components/dd-room-card/dd-room-card.vue +3 -3
- package/components/dd-search-bar/dd-search-bar.vue +8 -8
- package/components/dd-segmented-tab/dd-segmented-tab.vue +6 -6
- package/components/dd-signature/dd-signature.vue +513 -0
- package/components/dd-skeleton/dd-skeleton.vue +1 -1
- package/components/dd-slider/dd-slider.vue +4 -4
- package/components/dd-stat-card/dd-stat-card.vue +5 -5
- package/components/dd-step/dd-step.vue +11 -11
- package/components/dd-stepper/dd-stepper.vue +6 -6
- package/components/dd-swipe-action/dd-swipe-action.vue +1 -1
- package/components/dd-swipeable-tab/dd-swipeable-tab.vue +1 -1
- package/components/dd-tabbar-item/dd-tabbar-item.vue +8 -8
- package/components/dd-tag/dd-tag.vue +17 -1
- package/components/dd-text/dd-text.vue +250 -0
- package/components/dd-text/props.js +120 -0
- package/components/dd-text/text.js +30 -0
- package/components/dd-text/value.js +87 -0
- package/components/dd-toast/dd-toast.vue +2 -2
- package/components/dd-upload/dd-upload.vue +4 -4
- package/components/dd-workorder-card/dd-workorder-card.vue +237 -0
- package/index.ts +50 -9
- package/libs/config/color.js +16 -0
- package/libs/config/config.js +25 -0
- package/libs/config/props.js +185 -0
- package/libs/config/zIndex.js +20 -0
- package/libs/function/digit.js +167 -0
- package/libs/function/index.js +932 -0
- package/libs/function/test.js +327 -0
- package/libs/i18n/index.d.ts +2 -0
- package/libs/i18n/index.js +89 -0
- package/libs/i18n/locales/zh-Hans.js +86 -0
- package/libs/mixin/button.js +18 -0
- package/libs/mixin/mixin.js +44 -0
- package/libs/mixin/mpMixin.js +13 -0
- package/libs/mixin/openType.js +27 -0
- package/libs/utils.ts +462 -0
- package/libs/vue.js +3 -0
- package/package.json +1 -1
- package/scss/_dd-shared.scss +40 -0
- package/scss/_variables.scss +4 -1
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="dd-keyboard"
|
|
4
|
+
@touchmove.stop.prevent="noop"
|
|
5
|
+
>
|
|
6
|
+
<view
|
|
7
|
+
class="dd-keyboard__button-wrapper"
|
|
8
|
+
v-for="(item, index) in numList"
|
|
9
|
+
:key="index"
|
|
10
|
+
>
|
|
11
|
+
<view
|
|
12
|
+
class="dd-keyboard__button-wrapper__button"
|
|
13
|
+
:style="[itemStyle(index)]"
|
|
14
|
+
@tap="keyboardClick(item)"
|
|
15
|
+
hover-class="dd-keyboard-hover"
|
|
16
|
+
:hover-stay-time="200"
|
|
17
|
+
>
|
|
18
|
+
<text class="dd-keyboard__button-wrapper__button__text">{{ item }}</text>
|
|
19
|
+
</view>
|
|
20
|
+
</view>
|
|
21
|
+
<view
|
|
22
|
+
class="dd-keyboard__button-wrapper"
|
|
23
|
+
>
|
|
24
|
+
<view
|
|
25
|
+
class="dd-keyboard__button-wrapper__button dd-keyboard__button-wrapper__button--gray"
|
|
26
|
+
hover-class="dd-keyboard-hover"
|
|
27
|
+
:hover-stay-time="200"
|
|
28
|
+
@touchstart.stop="backspaceClick"
|
|
29
|
+
@touchend="clearTimer"
|
|
30
|
+
>
|
|
31
|
+
<dd-icon
|
|
32
|
+
name="backspace"
|
|
33
|
+
size="28"
|
|
34
|
+
></dd-icon>
|
|
35
|
+
</view>
|
|
36
|
+
</view>
|
|
37
|
+
</view>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script>
|
|
41
|
+
import { props } from './props';
|
|
42
|
+
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
43
|
+
import { mixin } from '../../libs/mixin/mixin';
|
|
44
|
+
import { randomArray } from '../../libs/function/index';
|
|
45
|
+
/**
|
|
46
|
+
* keyboard 键盘组件
|
|
47
|
+
* @description
|
|
48
|
+
* @tutorial
|
|
49
|
+
* @property {String} mode 键盘的类型,number-数字键盘,card-身份证键盘
|
|
50
|
+
* @property {Boolean} dotDisabled 是否显示键盘的"."符号
|
|
51
|
+
* @property {Boolean} random 是否打乱键盘按键的顺序
|
|
52
|
+
* @event {Function} change 点击键盘触发
|
|
53
|
+
* @event {Function} backspace 点击退格键触发
|
|
54
|
+
* @example
|
|
55
|
+
*/
|
|
56
|
+
export default {
|
|
57
|
+
name: 'dd-number-keyboard',
|
|
58
|
+
mixins: [mpMixin, mixin, props],
|
|
59
|
+
data() {
|
|
60
|
+
return {
|
|
61
|
+
backspace: 'backspace', // 退格键内容
|
|
62
|
+
dot: '.', // 点
|
|
63
|
+
timer: null, // 长按多次删除的事件监听
|
|
64
|
+
cardX: 'X' // 身份证的X符号
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
computed: {
|
|
68
|
+
// 键盘需要显示的内容
|
|
69
|
+
numList() {
|
|
70
|
+
let tmp = [];
|
|
71
|
+
if (this.dotDisabled && this.mode == 'number') {
|
|
72
|
+
if (!this.random) {
|
|
73
|
+
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
|
|
74
|
+
} else {
|
|
75
|
+
return randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]);
|
|
76
|
+
}
|
|
77
|
+
} else if (!this.dotDisabled && this.mode == 'number') {
|
|
78
|
+
if (!this.random) {
|
|
79
|
+
return [1, 2, 3, 4, 5, 6, 7, 8, 9, this.dot, 0];
|
|
80
|
+
} else {
|
|
81
|
+
return randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, this.dot, 0]);
|
|
82
|
+
}
|
|
83
|
+
} else if (this.mode == 'card') {
|
|
84
|
+
if (!this.random) {
|
|
85
|
+
return [1, 2, 3, 4, 5, 6, 7, 8, 9, this.cardX, 0];
|
|
86
|
+
} else {
|
|
87
|
+
return randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, this.cardX, 0]);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
// 按键的样式,在非乱序&&数字键盘&&不显示点按钮时,index为9时,按键占位两个空间
|
|
92
|
+
itemStyle() {
|
|
93
|
+
return index => {
|
|
94
|
+
let style = {};
|
|
95
|
+
if (this.mode == 'number' && this.dotDisabled && index == 9) style.width = '464rpx';
|
|
96
|
+
return style;
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
// 是否让按键显示灰色,只在非乱序&&数字键盘&&且允许点按键的时候
|
|
100
|
+
btnBgGray() {
|
|
101
|
+
return index => {
|
|
102
|
+
if (!this.random && index == 9 && (this.mode != 'number' || (this.mode == 'number' && !this
|
|
103
|
+
.dotDisabled))) return true;
|
|
104
|
+
else return false;
|
|
105
|
+
};
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
created() {
|
|
109
|
+
},
|
|
110
|
+
emits: ["backspace", "change"],
|
|
111
|
+
methods: {
|
|
112
|
+
// 点击退格键
|
|
113
|
+
backspaceClick() {
|
|
114
|
+
this.$emit('backspace');
|
|
115
|
+
clearInterval(this.timer); //再次清空定时器,防止重复注册定时器
|
|
116
|
+
this.timer = null;
|
|
117
|
+
this.timer = setInterval(() => {
|
|
118
|
+
this.$emit('backspace');
|
|
119
|
+
}, 250);
|
|
120
|
+
},
|
|
121
|
+
clearTimer() {
|
|
122
|
+
clearInterval(this.timer);
|
|
123
|
+
this.timer = null;
|
|
124
|
+
},
|
|
125
|
+
// 获取键盘显示的内容
|
|
126
|
+
keyboardClick(val) {
|
|
127
|
+
// 允许键盘显示点模式和触发非点按键时,将内容转为数字类型
|
|
128
|
+
if (!this.dotDisabled && val != this.dot && val != this.cardX) val = Number(val);
|
|
129
|
+
this.$emit('change', val);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
</script>
|
|
134
|
+
|
|
135
|
+
<style lang="scss" scoped>
|
|
136
|
+
@import '../../scss/variables';
|
|
137
|
+
@import '../../scss/dd-shared';
|
|
138
|
+
$dd-number-keyboard-background-color: $dd-bg-section !default;
|
|
139
|
+
$dd-number-keyboard-padding:8px 10rpx 8px 10rpx !default;
|
|
140
|
+
$dd-number-keyboard-button-width:222rpx !default;
|
|
141
|
+
$dd-number-keyboard-button-margin:4px 6rpx !default;
|
|
142
|
+
$dd-number-keyboard-button-border-top-left-radius:4px !default;
|
|
143
|
+
$dd-number-keyboard-button-border-top-right-radius:4px !default;
|
|
144
|
+
$dd-number-keyboard-button-border-bottom-left-radius:4px !default;
|
|
145
|
+
$dd-number-keyboard-button-border-bottom-right-radius:4px !default;
|
|
146
|
+
$dd-number-keyboard-button-height: 90rpx!default;
|
|
147
|
+
$dd-number-keyboard-button-background-color:$dd-surface-container-high !default;
|
|
148
|
+
$dd-number-keyboard-button-box-shadow:0 2px 0px $dd-bg !default;
|
|
149
|
+
$dd-number-keyboard-text-font-size:20px !default;
|
|
150
|
+
$dd-number-keyboard-text-font-weight:500 !default;
|
|
151
|
+
$dd-number-keyboard-text-color:$dd-text-primary !default;
|
|
152
|
+
$dd-number-keyboard-gray-background-color:$dd-surface-container-highest !default;
|
|
153
|
+
$dd-number-keyboard-dd-keyboard-hover-background-color: $dd-surface-hover !default;
|
|
154
|
+
|
|
155
|
+
.dd-keyboard {
|
|
156
|
+
@include flex;
|
|
157
|
+
flex-direction: row;
|
|
158
|
+
justify-content: space-around;
|
|
159
|
+
background-color: $dd-number-keyboard-background-color;
|
|
160
|
+
flex-wrap: wrap;
|
|
161
|
+
padding: $dd-number-keyboard-padding;
|
|
162
|
+
|
|
163
|
+
&__button-wrapper {
|
|
164
|
+
box-shadow: $dd-number-keyboard-button-box-shadow;
|
|
165
|
+
margin: $dd-number-keyboard-button-margin;
|
|
166
|
+
border-top-left-radius: $dd-number-keyboard-button-border-top-left-radius;
|
|
167
|
+
border-top-right-radius: $dd-number-keyboard-button-border-top-right-radius;
|
|
168
|
+
border-bottom-left-radius: $dd-number-keyboard-button-border-bottom-left-radius;
|
|
169
|
+
border-bottom-right-radius: $dd-number-keyboard-button-border-bottom-right-radius;
|
|
170
|
+
|
|
171
|
+
&__button {
|
|
172
|
+
width: $dd-number-keyboard-button-width;
|
|
173
|
+
height: $dd-number-keyboard-button-height;
|
|
174
|
+
background-color: $dd-number-keyboard-button-background-color;
|
|
175
|
+
@include flex;
|
|
176
|
+
justify-content: center;
|
|
177
|
+
align-items: center;
|
|
178
|
+
border-top-left-radius: $dd-number-keyboard-button-border-top-left-radius;
|
|
179
|
+
border-top-right-radius: $dd-number-keyboard-button-border-top-right-radius;
|
|
180
|
+
border-bottom-left-radius: $dd-number-keyboard-button-border-bottom-left-radius;
|
|
181
|
+
border-bottom-right-radius: $dd-number-keyboard-button-border-bottom-right-radius;
|
|
182
|
+
|
|
183
|
+
&__text {
|
|
184
|
+
font-size: $dd-number-keyboard-text-font-size;
|
|
185
|
+
font-weight: $dd-number-keyboard-text-font-weight;
|
|
186
|
+
color: $dd-number-keyboard-text-color;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
&--gray {
|
|
190
|
+
background-color: $dd-number-keyboard-gray-background-color;
|
|
191
|
+
color: $dd-number-keyboard-text-color; // 退格图标 color=inherit,由此处控制
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.dd-keyboard-hover {
|
|
198
|
+
background-color: $dd-number-keyboard-dd-keyboard-hover-background-color;
|
|
199
|
+
}
|
|
200
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineMixin } from '../../libs/vue'
|
|
2
|
+
import NumberKeyboardDefaultProps from './numberKeyboard'
|
|
3
|
+
import { registerComponentProps } from '../../libs/config/props.js'
|
|
4
|
+
|
|
5
|
+
const defProps = registerComponentProps(NumberKeyboardDefaultProps)
|
|
6
|
+
export const props = defineMixin({
|
|
7
|
+
props: {
|
|
8
|
+
// 键盘的类型,number-数字键盘,card-身份证键盘
|
|
9
|
+
mode: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: () => defProps.numberKeyboard.value
|
|
12
|
+
},
|
|
13
|
+
// 是否显示键盘的"."符号
|
|
14
|
+
dotDisabled: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: () => defProps.numberKeyboard.dotDisabled
|
|
17
|
+
},
|
|
18
|
+
// 是否打乱键盘按键的顺序
|
|
19
|
+
random: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: () => defProps.numberKeyboard.random
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
})
|