@didaoktv/didaoui-uniapp 2.13.0 → 2.14.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.
Files changed (59) hide show
  1. package/README.md +6 -6
  2. package/components/dd-album/dd-album.vue +280 -228
  3. package/components/dd-avatar/dd-avatar.vue +132 -75
  4. package/components/dd-avatar-group/dd-avatar-group.vue +52 -30
  5. package/components/dd-barcode/dd-barcode.vue +884 -947
  6. package/components/dd-button/dd-button.vue +47 -21
  7. package/components/dd-canvas/dd-canvas.vue +1156 -985
  8. package/components/dd-car-keyboard/dd-car-keyboard.vue +12 -12
  9. package/components/dd-champion-card/dd-champion-card.vue +49 -21
  10. package/components/dd-checkbox-group/dd-checkbox-group.vue +2 -0
  11. package/components/dd-copy/dd-copy.vue +51 -56
  12. package/components/dd-cropper/dd-cropper.vue +1224 -1135
  13. package/components/dd-divider/dd-divider.vue +9 -2
  14. package/components/dd-form/dd-form.vue +2 -0
  15. package/components/dd-icon/dd-icon.vue +1 -1
  16. package/components/dd-keyboard/dd-keyboard.vue +95 -46
  17. package/components/dd-link/dd-link.vue +72 -49
  18. package/components/dd-markdown/dd-markdown.vue +154 -154
  19. package/components/dd-number-keyboard/dd-number-keyboard.vue +109 -94
  20. package/components/dd-parse/dd-parse.vue +473 -442
  21. package/components/dd-poster/dd-poster.vue +579 -567
  22. package/components/dd-pull-refresh/dd-pull-refresh.vue +1 -9
  23. package/components/dd-qrcode/dd-qrcode.vue +431 -405
  24. package/components/dd-radio-group/dd-radio-group.vue +1 -1
  25. package/components/dd-segmented-tab/dd-segmented-tab.vue +22 -14
  26. package/components/dd-signature/dd-signature.vue +377 -357
  27. package/components/dd-step/dd-step.vue +1 -1
  28. package/components/dd-sticky/dd-sticky.vue +5 -10
  29. package/components/dd-swipe-action/dd-swipe-action.vue +1 -9
  30. package/components/dd-swipe-item/dd-swipe-item.vue +2 -0
  31. package/components/dd-swipeable-tab/dd-swipeable-tab.vue +1 -5
  32. package/components/dd-switch/dd-switch.vue +1 -1
  33. package/components/dd-text/dd-text.vue +304 -82
  34. package/components/dd-waterfall/dd-waterfall.vue +89 -0
  35. package/index.ts +4 -3
  36. package/libs/function/index.d.ts +88 -0
  37. package/libs/function/index.js +14 -0
  38. package/libs/function/test.d.ts +65 -0
  39. package/package.json +1 -1
  40. package/scss/_mixins.scss +8 -0
  41. package/scss/_theme-tokens.scss +7 -0
  42. package/scss/_variables.scss +283 -156
  43. package/components/dd-album/album.js +0 -19
  44. package/components/dd-album/props.js +0 -89
  45. package/components/dd-avatar/avatar.js +0 -19
  46. package/components/dd-avatar/props.js +0 -84
  47. package/components/dd-avatar-group/avatarGroup.js +0 -14
  48. package/components/dd-avatar-group/props.js +0 -57
  49. package/components/dd-keyboard/keyboard.js +0 -19
  50. package/components/dd-keyboard/props.js +0 -79
  51. package/components/dd-link/link.js +0 -17
  52. package/components/dd-link/props.js +0 -44
  53. package/components/dd-number-keyboard/numberKeyboard.js +0 -8
  54. package/components/dd-number-keyboard/props.js +0 -24
  55. package/components/dd-parse/props.js +0 -57
  56. package/components/dd-text/props.js +0 -120
  57. package/components/dd-text/text.js +0 -30
  58. package/components/dd-text/value.js +0 -87
  59. package/scss/_dd-shared.scss +0 -40
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="dd-divider" :class="[`dd-divider--${contentPosition}`]">
2
+ <view class="dd-divider" :class="[`dd-divider--${contentPosition}`]" :style="rootStyle">
3
3
  <view
4
4
  class="dd-divider__line"
5
5
  :class="[
@@ -30,6 +30,8 @@ interface Props {
30
30
  dashed?: boolean
31
31
  /** true=1px hairline; false=4rpx (dashed 归一化为 1px) */
32
32
  hairline?: boolean
33
+ /** 最小高度(rpx);不传则用 $dd-space-5(24px),传 0 完全交给父容器控间距 */
34
+ minHeight?: number
33
35
  }
34
36
 
35
37
  const props = withDefaults(defineProps<Props>(), {
@@ -41,6 +43,11 @@ const props = withDefaults(defineProps<Props>(), {
41
43
  const slots = useSlots()
42
44
  const hasContent = computed(() => !!slots.default)
43
45
 
46
+ // minHeight 为 rpx,运行时 upx2px 转 px(H5 动态 style 不识别 rpx)
47
+ const rootStyle = computed(() =>
48
+ props.minHeight == null ? '' : `min-height:${uni.upx2px(props.minHeight)}px`,
49
+ )
50
+
44
51
  const lineStyle = computed(() => (props.dashed ? 'dashed' : 'solid'))
45
52
  // ponytail: dashed 非 hairline 归一化回 1px,避免 4rpx 粗虚线显得笨重
46
53
  const effectiveHairline = computed(() => props.hairline || props.dashed)
@@ -54,7 +61,7 @@ const effectiveHairline = computed(() => props.hairline || props.dashed)
54
61
  display: flex;
55
62
  align-items: center;
56
63
  width: 100%;
57
- height: $dd-space-5; // 24px
64
+ min-height: $dd-space-5; // 24px,插槽内容更高时随内容撑开
58
65
 
59
66
  &__content {
60
67
  flex: none;
@@ -109,6 +109,8 @@ defineExpose({ validate, validateField, resetValidation, submit, getValues })
109
109
  </script>
110
110
 
111
111
  <style lang="scss" scoped>
112
+ @import '../../scss/variables';
113
+ @import '../../scss/mixins';
112
114
  .dd-form {
113
115
  display: block;
114
116
  width: 100%;
@@ -214,7 +214,7 @@ const iconStyle = computed(() => {
214
214
 
215
215
  <style lang="scss" scoped>
216
216
  @import '../../scss/variables';
217
-
217
+ @import '../../scss/mixins';
218
218
  // ponytail: iconfont.cn 项目(Project id 5222155) base64 woff2 内嵌,避免外链字体请求;在线链接仅供调试,生产应下载字体包自托管备份
219
219
  // ceiling: 图标集变更时从 iconfont.cn 该项目重新导出并替换 base64 与回退链接;若字体内码与下方 &--name:before 的 codepoint 不一致,图标需同步校正
220
220
  @font-face {
@@ -53,10 +53,10 @@
53
53
  </dd-popup>
54
54
  </template>
55
55
 
56
- <script>
57
- import { props } from './props';
58
- import { mpMixin } from '../../libs/mixin/mpMixin';
59
- import { mixin } from '../../libs/mixin/mixin';
56
+ <script setup lang="ts">
57
+ import { computed } from 'vue'
58
+ import DdPopup from '../dd-popup/dd-popup.vue'
59
+ import DdNumberKeyboard from '../dd-number-keyboard/dd-number-keyboard.vue'
60
60
 
61
61
  /**
62
62
  * keyboard 键盘
@@ -82,53 +82,102 @@
82
82
  * @event {Function} backspace 键盘退格键被点击
83
83
  * @example <dd-keyboard mode="number" v-model="show"></dd-keyboard>
84
84
  */
85
- export default {
86
- name: "dd-keyboard",
87
- data() {
88
- return {
85
+ interface Props {
86
+ // 键盘的类型,number-数字键盘,card-身份证键盘,car-车牌号键盘
87
+ mode?: string
88
+ // 是否显示键盘的"."符号
89
+ dotDisabled?: boolean
90
+ // 是否显示顶部工具条
91
+ tooltip?: boolean
92
+ // 是否显示工具条中间的提示
93
+ showTips?: boolean
94
+ // 工具条中间的提示文字
95
+ tips?: string
96
+ // 是否显示工具条左边的"取消"按钮
97
+ showCancel?: boolean
98
+ // 是否显示工具条右边的"完成"按钮
99
+ showConfirm?: boolean
100
+ // 是否打乱键盘按键的顺序
101
+ random?: boolean
102
+ // 是否开启底部安全区适配,开启的话,会在iPhoneX机型底部添加一定的内边距
103
+ safeAreaInsetBottom?: boolean
104
+ // 是否允许通过点击遮罩关闭键盘
105
+ closeOnClickOverlay?: boolean
106
+ // 控制键盘的弹出与收起
107
+ show?: boolean
108
+ // 是否显示遮罩,某些时候数字键盘时,用户希望看到自己的数值,所以可能不想要遮罩
109
+ overlay?: boolean
110
+ // 取消按钮的文字
111
+ cancelText?: string
112
+ // 确认按钮的文字
113
+ confirmText?: string
114
+ }
89
115
 
90
- }
91
- },
92
- mixins: [mpMixin, mixin, props],
93
- computed: {
94
- // ponytail: 剥离运行时主题;面板底色由 dd-popup($dd-bg-elevated)承担
95
- popupShow: {
96
- get() {
97
- return this.show;
98
- },
99
- set(val) {
100
- if (!val) this.$emit('close');
101
- }
102
- }
116
+ const props = withDefaults(defineProps<Props>(), {
117
+ mode: 'number',
118
+ dotDisabled: false,
119
+ tooltip: true,
120
+ showTips: true,
121
+ tips: '',
122
+ showCancel: true,
123
+ showConfirm: true,
124
+ random: false,
125
+ safeAreaInsetBottom: true,
126
+ closeOnClickOverlay: true,
127
+ show: false,
128
+ overlay: true,
129
+ cancelText: '取消',
130
+ confirmText: '确定',
131
+ })
132
+
133
+ const emit = defineEmits<{
134
+ (e: 'change', val: any): void;
135
+ (e: 'close'): void;
136
+ (e: 'confirm'): void;
137
+ (e: 'cancel'): void;
138
+ (e: 'backspace'): void;
139
+ }>()
140
+
141
+ // ponytail: 剥离运行时主题;面板底色由 dd-popup($dd-bg-elevated)承担
142
+ const popupShow = computed({
143
+ get() {
144
+ return props.show;
103
145
  },
104
- emits: ["change", "close", "confirm", "cancel", "backspace"],
105
- methods: {
106
- change(e) {
107
- this.$emit('change', e);
108
- },
109
- // 键盘关闭
110
- popupClose() {
111
- this.$emit('close');
112
- },
113
- // 输入完成
114
- onConfirm() {
115
- this.$emit('confirm');
116
- },
117
- // 取消输入
118
- onCancel() {
119
- this.$emit('cancel');
120
- },
121
- // 退格键
122
- backspace() {
123
- this.$emit('backspace');
124
- }
146
+ set(val) {
147
+ if (!val) emit('close');
125
148
  }
149
+ })
150
+
151
+ function change(e: any) {
152
+ emit('change', e);
126
153
  }
154
+
155
+ // 键盘关闭
156
+ function popupClose() {
157
+ emit('close');
158
+ }
159
+
160
+ // 输入完成
161
+ function onConfirm() {
162
+ emit('confirm');
163
+ }
164
+
165
+ // 取消输入
166
+ function onCancel() {
167
+ emit('cancel');
168
+ }
169
+
170
+ // 退格键
171
+ function backspace() {
172
+ emit('backspace');
173
+ }
174
+
175
+ defineExpose({ popupShow, change, popupClose, onConfirm, onCancel, backspace })
127
176
  </script>
128
177
 
129
178
  <style lang="scss" scoped>
130
179
  @import '../../scss/variables';
131
- @import '../../scss/dd-shared';
180
+ @import '../../scss/mixins';
132
181
 
133
182
  .dd-keyboard {
134
183
  // 工具条按钮点击反馈(text 不支持 hover-class,由外层 view 承担)
@@ -137,16 +186,16 @@
137
186
  }
138
187
 
139
188
  &__tooltip {
140
- @include flex;
189
+ @include dd-flex;
141
190
  justify-content: space-between;
142
191
  background-color: var(--dd-bg-elevated, #{$dd-bg-elevated});
143
- padding: 14px 12px;
192
+ padding: 28rpx $dd-space-3;
144
193
 
145
194
  &__item {
146
195
  color: var(--dd-text-primary, #{$dd-text-primary});
147
196
  flex: 1;
148
197
  text-align: center;
149
- font-size: 15px;
198
+ font-size: 30rpx;
150
199
  }
151
200
 
152
201
  &__submit {
@@ -6,11 +6,9 @@
6
6
  >{{text}}</text>
7
7
  </template>
8
8
 
9
- <script>
10
- import { props } from './props';
11
- import { mpMixin } from '../../libs/mixin/mpMixin';
12
- import { mixin } from '../../libs/mixin/mixin';
13
- import { addStyle, addUnit, getPx, toast } from '../../libs/function/index';
9
+ <script setup lang="ts">
10
+ import { computed, nextTick } from 'vue'
11
+ import { addStyle, addUnit, getPx, toast } from '../../libs/function/index.js';
14
12
  /**
15
13
  * link 超链接
16
14
  * @description 该组件为超链接组件,在不同平台有不同表现形式:在APP平台会通过plus环境打开内置浏览器,在小程序中把链接复制到粘贴板,同时提示信息,在H5中通过window.open打开链接。
@@ -25,62 +23,87 @@
25
23
  *
26
24
  * @example <dd-link href="https://didaoktv.com">蜀道难,难于上青天</dd-link>
27
25
  */
28
- export default {
29
- name: "dd-link",
30
- mixins: [mpMixin, mixin, props],
31
- computed: {
32
- linkStyle() {
33
- const style = {
34
- color: this.color,
35
- fontSize: addUnit(this.fontSize),
36
- // line-height设置为比字体大小多2px
37
- lineHeight: addUnit(getPx(this.fontSize) + 2),
38
- textDecoration: this.underLine ? 'underline' : 'none'
39
- }
40
- // if (this.underLine) {
41
- // style.borderBottomColor = this.lineColor || this.color
42
- // style.borderBottomWidth = '1px'
43
- // }
44
- return style
45
- }
46
- },
47
- emits: ["click"],
48
- methods: {
49
- addStyle,
50
- openLink() {
51
- // #ifdef APP-PLUS
52
- plus.runtime.openURL(this.href)
53
- // #endif
54
- // #ifdef H5
55
- window.open(this.href)
56
- // #endif
57
- // #ifdef MP
58
- uni.setClipboardData({
59
- data: this.href,
60
- success: () => {
61
- uni.hideToast();
62
- this.$nextTick(() => {
63
- toast(this.mpTips);
64
- })
65
- }
66
- });
67
- // #endif
68
- this.$emit('click')
69
- }
26
+ interface Props {
27
+ // 文字颜色
28
+ color?: string
29
+ // 字体大小,单位px
30
+ fontSize?: string | number
31
+ // 是否显示下划线
32
+ underLine?: boolean
33
+ // 要跳转的链接
34
+ href?: string
35
+ // 小程序中复制到粘贴板的提示语
36
+ mpTips?: string
37
+ // 下划线颜色
38
+ lineColor?: string
39
+ // 超链接的问题,不使用slot形式传入,是因为nvue下无法修改颜色
40
+ text?: string
41
+ // 定义需要用到的外部样式
42
+ customStyle?: Record<string, any> | string
43
+ }
44
+
45
+ const props = withDefaults(defineProps<Props>(), {
46
+ color: '#3c9cff',
47
+ fontSize: 15,
48
+ underLine: false,
49
+ href: '',
50
+ mpTips: '链接已复制,请在浏览器打开',
51
+ lineColor: '',
52
+ text: '',
53
+ customStyle: () => ({}),
54
+ })
55
+
56
+ const emit = defineEmits<{ (e: 'click'): void }>()
57
+
58
+ const linkStyle = computed(() => {
59
+ const style = {
60
+ color: props.color,
61
+ fontSize: addUnit(props.fontSize),
62
+ // line-height设置为比字体大小多2px
63
+ lineHeight: addUnit(getPx(props.fontSize) + 2),
64
+ textDecoration: props.underLine ? 'underline' : 'none'
70
65
  }
66
+ // if (props.underLine) {
67
+ // style.borderBottomColor = props.lineColor || props.color
68
+ // style.borderBottomWidth = '1px'
69
+ // }
70
+ return style
71
+ })
72
+
73
+ function openLink() {
74
+ // #ifdef APP-PLUS
75
+ plus.runtime.openURL(props.href)
76
+ // #endif
77
+ // #ifdef H5
78
+ window.open(props.href)
79
+ // #endif
80
+ // #ifdef MP
81
+ uni.setClipboardData({
82
+ data: props.href,
83
+ success: () => {
84
+ uni.hideToast();
85
+ nextTick(() => {
86
+ toast(props.mpTips);
87
+ })
88
+ }
89
+ });
90
+ // #endif
91
+ emit('click')
71
92
  }
93
+
94
+ defineExpose({ openLink, linkStyle })
72
95
  </script>
73
96
 
74
97
  <style lang="scss" scoped>
75
98
  @import '../../scss/variables';
76
- @import '../../scss/dd-shared';
99
+ @import '../../scss/mixins';
77
100
  $dd-link-line-height:1 !default;
78
101
 
79
102
  .dd-link {
80
103
  /* #ifndef APP-NVUE */
81
104
  line-height: $dd-link-line-height;
82
105
  /* #endif */
83
- @include flex;
106
+ @include dd-flex;
84
107
  flex-wrap: wrap;
85
108
  flex: 1;
86
109
  }