@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.
Files changed (114) hide show
  1. package/README.md +16 -7
  2. package/components/dd-action-sheet/dd-action-sheet.vue +3 -3
  3. package/components/dd-album/album.js +19 -0
  4. package/components/dd-album/dd-album.vue +345 -0
  5. package/components/dd-album/props.js +89 -0
  6. package/components/dd-avatar/avatar.js +19 -0
  7. package/components/dd-avatar/dd-avatar.vue +172 -160
  8. package/components/dd-avatar/props.js +84 -0
  9. package/components/dd-avatar-group/avatarGroup.js +14 -0
  10. package/components/dd-avatar-group/dd-avatar-group.vue +110 -0
  11. package/components/dd-avatar-group/props.js +57 -0
  12. package/components/dd-badge/dd-badge.vue +2 -2
  13. package/components/dd-barcode/dd-barcode.vue +1030 -0
  14. package/components/dd-bill-detail/dd-bill-detail.vue +265 -0
  15. package/components/dd-button/dd-button.vue +17 -17
  16. package/components/dd-calendar/dd-calendar.vue +357 -0
  17. package/components/dd-canvas/dd-canvas.vue +1088 -0
  18. package/components/dd-capsule-button/dd-capsule-button.vue +6 -6
  19. package/components/dd-car-keyboard/carKeyboard.js +6 -0
  20. package/components/dd-car-keyboard/dd-car-keyboard.vue +315 -0
  21. package/components/dd-car-keyboard/props.js +19 -0
  22. package/components/dd-cascader/dd-cascader.vue +405 -0
  23. package/components/dd-cell/dd-cell.vue +50 -23
  24. package/components/dd-cell-group/dd-cell-group.vue +32 -25
  25. package/components/dd-champion-card/dd-champion-card.vue +4 -4
  26. package/components/dd-checkbox/dd-checkbox.vue +30 -39
  27. package/components/dd-checkbox-group/dd-checkbox-group.vue +67 -0
  28. package/components/dd-copy/dd-copy.vue +74 -0
  29. package/components/dd-coupon/dd-coupon.vue +368 -0
  30. package/components/dd-cropper/dd-cropper.vue +1297 -0
  31. package/components/dd-dialog/dd-dialog.vue +1 -1
  32. package/components/dd-divider/dd-divider.vue +3 -3
  33. package/components/dd-dropdown-item/dd-dropdown-item.vue +5 -5
  34. package/components/dd-empty-state/dd-empty-state.vue +1 -1
  35. package/components/dd-field/dd-field.vue +531 -106
  36. package/components/dd-form/dd-form.vue +116 -0
  37. package/components/dd-form/rules.ts +84 -0
  38. package/components/dd-goods-sku/dd-goods-sku.vue +434 -0
  39. package/components/dd-icon/dd-icon.vue +2 -2
  40. package/components/dd-image/dd-image.vue +4 -4
  41. package/components/dd-input/dd-input.vue +5 -5
  42. package/components/dd-keyboard/dd-keyboard.vue +178 -0
  43. package/components/dd-keyboard/keyboard.js +22 -0
  44. package/components/dd-keyboard/props.js +89 -0
  45. package/components/dd-link/dd-link.vue +87 -0
  46. package/components/dd-link/link.js +18 -0
  47. package/components/dd-link/props.js +44 -0
  48. package/components/dd-list-cell/dd-list-cell.vue +4 -4
  49. package/components/dd-loading/dd-loading.vue +1 -1
  50. package/components/dd-loadmore/dd-loadmore.vue +2 -2
  51. package/components/dd-markdown/dd-markdown.vue +344 -0
  52. package/components/dd-markdown/marked.esm.mjs +7 -0
  53. package/components/dd-mini-program-navbar/dd-mini-program-navbar.vue +9 -9
  54. package/components/dd-navigation/dd-navigation.vue +5 -5
  55. package/components/dd-number-keyboard/dd-number-keyboard.vue +200 -0
  56. package/components/dd-number-keyboard/numberKeyboard.js +8 -0
  57. package/components/dd-number-keyboard/props.js +24 -0
  58. package/components/dd-parse/dd-parse.vue +534 -0
  59. package/components/dd-parse/node/handler.wxs +26 -0
  60. package/components/dd-parse/node/node.vue +603 -0
  61. package/components/dd-parse/parse.js +13 -0
  62. package/components/dd-parse/parser.js +1400 -0
  63. package/components/dd-parse/props.js +57 -0
  64. package/components/dd-popover/dd-popover.vue +10 -10
  65. package/components/dd-popover-item/dd-popover-item.vue +3 -3
  66. package/components/dd-popup/dd-popup.vue +5 -5
  67. package/components/dd-poster/dd-poster.vue +695 -0
  68. package/components/dd-progress/dd-progress.vue +3 -3
  69. package/components/dd-pull-refresh/dd-pull-refresh.vue +3 -3
  70. package/components/dd-qrcode/dd-qrcode.vue +509 -0
  71. package/components/dd-qrcode/qrcode.js +1283 -0
  72. package/components/dd-radio/dd-radio.vue +19 -20
  73. package/components/dd-radio-group/dd-radio-group.vue +53 -0
  74. package/components/dd-rate/dd-rate.vue +1 -1
  75. package/components/dd-room-card/dd-room-card.vue +3 -3
  76. package/components/dd-search-bar/dd-search-bar.vue +8 -8
  77. package/components/dd-segmented-tab/dd-segmented-tab.vue +6 -6
  78. package/components/dd-signature/dd-signature.vue +513 -0
  79. package/components/dd-skeleton/dd-skeleton.vue +1 -1
  80. package/components/dd-slider/dd-slider.vue +4 -4
  81. package/components/dd-stat-card/dd-stat-card.vue +5 -5
  82. package/components/dd-step/dd-step.vue +11 -11
  83. package/components/dd-stepper/dd-stepper.vue +6 -6
  84. package/components/dd-swipe-action/dd-swipe-action.vue +1 -1
  85. package/components/dd-swipeable-tab/dd-swipeable-tab.vue +1 -1
  86. package/components/dd-tabbar-item/dd-tabbar-item.vue +8 -8
  87. package/components/dd-tag/dd-tag.vue +17 -1
  88. package/components/dd-text/dd-text.vue +250 -0
  89. package/components/dd-text/props.js +120 -0
  90. package/components/dd-text/text.js +30 -0
  91. package/components/dd-text/value.js +87 -0
  92. package/components/dd-toast/dd-toast.vue +2 -2
  93. package/components/dd-upload/dd-upload.vue +4 -4
  94. package/components/dd-workorder-card/dd-workorder-card.vue +237 -0
  95. package/index.ts +50 -9
  96. package/libs/config/color.js +16 -0
  97. package/libs/config/config.js +25 -0
  98. package/libs/config/props.js +185 -0
  99. package/libs/config/zIndex.js +20 -0
  100. package/libs/function/digit.js +167 -0
  101. package/libs/function/index.js +932 -0
  102. package/libs/function/test.js +327 -0
  103. package/libs/i18n/index.d.ts +2 -0
  104. package/libs/i18n/index.js +89 -0
  105. package/libs/i18n/locales/zh-Hans.js +86 -0
  106. package/libs/mixin/button.js +18 -0
  107. package/libs/mixin/mixin.js +44 -0
  108. package/libs/mixin/mpMixin.js +13 -0
  109. package/libs/mixin/openType.js +27 -0
  110. package/libs/utils.ts +462 -0
  111. package/libs/vue.js +3 -0
  112. package/package.json +1 -1
  113. package/scss/_dd-shared.scss +40 -0
  114. package/scss/_variables.scss +4 -1
@@ -5,7 +5,7 @@
5
5
  `dd-radio--${size}`,
6
6
  {
7
7
  'dd-radio--checked': isChecked,
8
- 'dd-radio--disabled': disabled,
8
+ 'dd-radio--disabled': isDisabled,
9
9
  },
10
10
  ]"
11
11
  @click="onToggle"
@@ -20,36 +20,35 @@
20
20
  </template>
21
21
 
22
22
  <script setup lang="ts">
23
- import { computed } from 'vue'
23
+ import { computed, inject } from 'vue'
24
24
 
25
25
  interface Props {
26
- modelValue?: any
27
- value?: any
26
+ /** 选项值,对应 dd-radio-group 的 modelValue */
27
+ value: any
28
28
  disabled?: boolean
29
29
  size?: 'md' | 'sm'
30
30
  label?: string
31
31
  }
32
32
 
33
33
  const props = withDefaults(defineProps<Props>(), {
34
- modelValue: null,
35
34
  value: null,
36
35
  disabled: false,
37
36
  size: 'md',
38
37
  label: '',
39
38
  })
40
39
 
41
- const emit = defineEmits<{
42
- (e: 'update:modelValue', val: any): void
43
- (e: 'change', val: any): void
44
- }>()
40
+ // 必须配合 dd-radio-group 使用(vant/uview 同款约定)
41
+ const group = inject<{
42
+ props: { modelValue: any; disabled: boolean }
43
+ toggle: (value: any) => void
44
+ } | null>('dd-radio-group', null)
45
45
 
46
- const isChecked = computed(() => props.modelValue === props.value)
46
+ const isChecked = computed(() => group?.props.modelValue === props.value)
47
+ const isDisabled = computed(() => props.disabled || !!group?.props.disabled)
47
48
 
48
49
  function onToggle() {
49
- if (props.disabled) return
50
- if (isChecked.value) return
51
- emit('update:modelValue', props.value)
52
- emit('change', props.value)
50
+ if (isDisabled.value || !group) return
51
+ group.toggle(props.value)
53
52
  }
54
53
  </script>
55
54
 
@@ -75,7 +74,7 @@ function onToggle() {
75
74
 
76
75
  &__inner {
77
76
  border-radius: 50%;
78
- background: #ffffff;
77
+ background: $dd-color-white;
79
78
  transform: scale(0);
80
79
  opacity: 0;
81
80
  @include dd-transition(transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s);
@@ -105,8 +104,8 @@ function onToggle() {
105
104
 
106
105
  .dd-radio--md {
107
106
  .dd-radio__outer {
108
- width: 40rpx;
109
- height: 40rpx;
107
+ width: $dd-size-icon-md;
108
+ height: $dd-size-icon-md;
110
109
  }
111
110
  .dd-radio__inner {
112
111
  width: 20rpx;
@@ -115,15 +114,15 @@ function onToggle() {
115
114
  }
116
115
  .dd-radio--sm {
117
116
  .dd-radio__outer {
118
- width: 32rpx;
119
- height: 32rpx;
117
+ width: $dd-size-icon-sm;
118
+ height: $dd-size-icon-sm;
120
119
  }
121
120
  .dd-radio__inner {
122
121
  width: 14rpx;
123
122
  height: 14rpx;
124
123
  }
125
124
  .dd-radio__label {
126
- font-size: 28rpx;
125
+ font-size: $dd-font-size-body;
127
126
  }
128
127
  }
129
128
  </style>
@@ -0,0 +1,53 @@
1
+ <template>
2
+ <view class="dd-radio-group" :class="{ 'dd-radio-group--vertical': direction === 'vertical' }">
3
+ <slot></slot>
4
+ </view>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import { provide } from 'vue'
9
+
10
+ interface Props {
11
+ modelValue?: any
12
+ disabled?: boolean
13
+ direction?: 'horizontal' | 'vertical'
14
+ }
15
+
16
+ const props = withDefaults(defineProps<Props>(), {
17
+ modelValue: null,
18
+ disabled: false,
19
+ direction: 'horizontal',
20
+ })
21
+
22
+ const emit = defineEmits<{
23
+ (e: 'update:modelValue', val: any): void
24
+ (e: 'change', val: any): void
25
+ }>()
26
+
27
+ provide('dd-radio-group', {
28
+ props,
29
+ toggle(value: any) {
30
+ if (props.modelValue === value) return
31
+ emit('update:modelValue', value)
32
+ emit('change', value)
33
+ },
34
+ })
35
+ </script>
36
+
37
+ <style lang="scss" scoped>
38
+ @import '../../scss/variables';
39
+
40
+ .dd-radio-group {
41
+ display: flex;
42
+ flex-wrap: wrap;
43
+ align-items: center;
44
+ gap: $dd-space-4;
45
+ width: 100%;
46
+
47
+ &--vertical {
48
+ flex-direction: column;
49
+ align-items: flex-start;
50
+ gap: $dd-space-3;
51
+ }
52
+ }
53
+ </style>
@@ -76,7 +76,7 @@ function select(val: number) {
76
76
  .dd-rate {
77
77
  display: inline-flex;
78
78
  align-items: center;
79
- gap: 8rpx;
79
+ gap: $dd-space-1;
80
80
 
81
81
  &__item {
82
82
  position: relative;
@@ -137,7 +137,7 @@ function onClick() {
137
137
  .dd-room-card__status {
138
138
  display: flex;
139
139
  align-items: center;
140
- gap: 8rpx;
140
+ gap: $dd-space-1;
141
141
 
142
142
  &--inline {
143
143
  margin-left: $dd-space-2;
@@ -174,7 +174,7 @@ function onClick() {
174
174
  background: $dd-gradient-primary;
175
175
  border-radius: $dd-radius-sm;
176
176
  text {
177
- font-size: 20rpx;
177
+ font-size: $dd-font-size-caption;
178
178
  font-weight: 700;
179
179
  color: $dd-neutral-900;
180
180
  line-height: 1.6;
@@ -255,7 +255,7 @@ function onClick() {
255
255
  min-width: 0;
256
256
  display: flex;
257
257
  flex-direction: column;
258
- gap: 4rpx;
258
+ gap: $dd-space-1;
259
259
  }
260
260
 
261
261
  .dd-room-card__list-head {
@@ -100,15 +100,15 @@ function onCancel() {
100
100
  .dd-search {
101
101
  display: flex;
102
102
  align-items: center;
103
- gap: 16rpx;
103
+ gap: $dd-space-2;
104
104
 
105
105
  &__wrap {
106
106
  flex: 1;
107
107
  display: flex;
108
108
  align-items: center;
109
- gap: 16rpx;
109
+ gap: $dd-space-2;
110
110
  height: 88rpx;
111
- padding: 0 24rpx;
111
+ padding: 0 $dd-space-3;
112
112
  background: $dd-neutral-800;
113
113
  border: 1px solid $dd-neutral-700;
114
114
  border-radius: $dd-radius-full;
@@ -126,7 +126,7 @@ function onCancel() {
126
126
  }
127
127
 
128
128
  &__icon {
129
- font-size: 28rpx;
129
+ font-size: $dd-font-size-body;
130
130
  color: $dd-neutral-400;
131
131
  line-height: 1;
132
132
  @include dd-transition(color 0.2s);
@@ -140,7 +140,7 @@ function onCancel() {
140
140
  flex: 1;
141
141
  min-width: 0;
142
142
  height: 100%;
143
- font-size: 28rpx;
143
+ font-size: $dd-font-size-body;
144
144
  color: $dd-neutral-100;
145
145
  background: transparent;
146
146
  border: none;
@@ -153,14 +153,14 @@ function onCancel() {
153
153
  border-radius: 50%;
154
154
  background: $dd-neutral-800;
155
155
  color: $dd-neutral-300;
156
- font-size: 24rpx;
156
+ font-size: $dd-font-size-caption;
157
157
  line-height: 1;
158
158
  }
159
159
 
160
160
  &__cancel {
161
161
  flex-shrink: 0;
162
- padding: 0 8rpx;
163
- font-size: 28rpx;
162
+ padding: 0 $dd-space-1;
163
+ font-size: $dd-font-size-body;
164
164
  font-weight: 500;
165
165
  color: $dd-primary-400;
166
166
  }
@@ -112,7 +112,7 @@ watch(() => props.options, measure)
112
112
  .dd-seg__track {
113
113
  position: relative;
114
114
  display: inline-flex;
115
- padding: 8rpx;
115
+ padding: $dd-space-1;
116
116
  background: $dd-neutral-800;
117
117
  border: 1px solid $dd-border-default;
118
118
  border-radius: $dd-radius-full;
@@ -137,8 +137,8 @@ watch(() => props.options, measure)
137
137
 
138
138
  .dd-seg__indicator {
139
139
  position: absolute;
140
- top: 8rpx;
141
- bottom: 8rpx;
140
+ top: $dd-space-1;
141
+ bottom: $dd-space-1;
142
142
  left: 0;
143
143
  background: $dd-color-white;
144
144
  border-radius: $dd-radius-full;
@@ -152,11 +152,11 @@ watch(() => props.options, measure)
152
152
  .dd-seg--text {
153
153
  display: flex;
154
154
  flex-direction: row;
155
- gap: 64rpx;
155
+ gap: $dd-space-6;
156
156
 
157
157
  .dd-seg-text__item {
158
158
  position: relative;
159
- padding: 16rpx 0;
159
+ padding: $dd-space-2 0;
160
160
  color: $dd-text-tertiary;
161
161
  font-size: $dd-font-size-body;
162
162
  font-weight: 500;
@@ -174,7 +174,7 @@ watch(() => props.options, measure)
174
174
  bottom: 0;
175
175
  left: 20%;
176
176
  width: 60%;
177
- height: 4rpx;
177
+ height: $dd-space-1;
178
178
  background: $dd-primary-400;
179
179
  border-radius: $dd-radius-full;
180
180
  }