hy-app 0.2.0 → 0.2.2

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 (104) hide show
  1. package/README.md +2 -1
  2. package/components/hy-back-top/index.scss +1 -10
  3. package/components/hy-badge/index.scss +5 -5
  4. package/components/hy-button/hy-button.vue +6 -7
  5. package/components/hy-button/index.scss +4 -11
  6. package/components/hy-calendar/index.scss +21 -24
  7. package/components/hy-calendar/month.vue +28 -6
  8. package/components/hy-calendar/props.ts +1 -1
  9. package/components/hy-card/index.scss +2 -11
  10. package/components/hy-cell/index.scss +9 -22
  11. package/components/hy-checkbox/hy-checkbox.vue +9 -6
  12. package/components/hy-checkbox/index.scss +14 -17
  13. package/components/hy-code-input/hy-code-input.vue +223 -0
  14. package/components/hy-code-input/index.scss +108 -0
  15. package/components/hy-code-input/props.ts +21 -0
  16. package/components/hy-code-input/typing.d.ts +65 -0
  17. package/components/hy-config-provider/hy-config-provider.vue +2 -1
  18. package/components/hy-config-provider/index.scss +2 -6
  19. package/components/hy-count-down/index.scss +0 -9
  20. package/components/hy-count-to/index.scss +1 -9
  21. package/components/hy-divider/index.scss +2 -1
  22. package/components/hy-divider/props.ts +2 -2
  23. package/components/hy-dropdown/index.scss +1 -1
  24. package/components/hy-dropdown/props.ts +1 -1
  25. package/components/hy-dropdown-item/hy-dropdown-item.vue +2 -5
  26. package/components/hy-dropdown-item/index.scss +13 -30
  27. package/components/hy-empty/index.scss +1 -10
  28. package/components/hy-float-button/index.scss +4 -9
  29. package/components/hy-form/index.scss +1 -8
  30. package/components/hy-grid/hy-grid.vue +5 -5
  31. package/components/hy-grid/index.scss +1 -1
  32. package/components/hy-icon/index.scss +4 -9
  33. package/components/hy-image/hy-image.vue +5 -5
  34. package/components/hy-image/index.scss +2 -2
  35. package/components/hy-image/props.ts +1 -1
  36. package/components/hy-input/hy-input.vue +9 -14
  37. package/components/hy-input/index.scss +10 -12
  38. package/components/hy-input/props.ts +1 -1
  39. package/components/hy-line/index.scss +1 -0
  40. package/components/hy-line/props.ts +1 -1
  41. package/components/hy-line-progress/index.scss +1 -12
  42. package/components/hy-loading/index.scss +2 -2
  43. package/components/hy-modal/hy-modal.vue +8 -5
  44. package/components/hy-modal/index.scss +7 -25
  45. package/components/hy-modal/props.ts +3 -3
  46. package/components/hy-navbar/index.scss +3 -14
  47. package/components/hy-notice-bar/index.scss +31 -41
  48. package/components/hy-notice-bar/props.ts +2 -2
  49. package/components/hy-notify/hy-notify.vue +169 -0
  50. package/components/hy-notify/index.scss +25 -0
  51. package/components/hy-notify/props.ts +14 -0
  52. package/components/hy-notify/typing.d.ts +44 -0
  53. package/components/hy-number-step/index.scss +6 -24
  54. package/components/hy-pagination/hy-pagination.vue +125 -0
  55. package/components/hy-pagination/index.scss +46 -0
  56. package/components/hy-pagination/props.ts +15 -0
  57. package/components/hy-pagination/typing.d.ts +44 -0
  58. package/components/hy-picker/index.scss +5 -1
  59. package/components/hy-popup/index.scss +1 -10
  60. package/components/hy-price/index.scss +0 -6
  61. package/components/hy-qrcode/index.scss +1 -1
  62. package/components/hy-radio/hy-radio.vue +8 -5
  63. package/components/hy-radio/index.scss +16 -18
  64. package/components/hy-rate/index.scss +1 -6
  65. package/components/hy-read-more/index.scss +3 -20
  66. package/components/hy-scroll-list/index.scss +1 -1
  67. package/components/hy-search/index.scss +6 -26
  68. package/components/hy-signature/canvasHelper.ts +51 -0
  69. package/components/hy-signature/hy-signature.vue +656 -0
  70. package/components/hy-signature/index.scss +31 -0
  71. package/components/hy-signature/props.ts +28 -0
  72. package/components/hy-signature/typing.d.ts +177 -0
  73. package/components/hy-slider/index.scss +6 -2
  74. package/components/hy-slider/props.ts +2 -2
  75. package/components/hy-steps/hy-steps.vue +38 -20
  76. package/components/hy-steps/index.scss +6 -17
  77. package/components/hy-submit-bar/index.scss +1 -9
  78. package/components/hy-subsection/index.scss +2 -16
  79. package/components/hy-swipe-action/hy-swipe-action.vue +288 -248
  80. package/components/hy-swipe-action/index.scss +32 -7
  81. package/components/hy-swipe-action/index.ts +34 -0
  82. package/components/hy-swipe-action/props.ts +15 -9
  83. package/components/hy-swipe-action/typing.d.ts +20 -22
  84. package/components/hy-swiper/index.scss +5 -10
  85. package/components/hy-switch/index.scss +19 -18
  86. package/components/hy-switch/props.ts +0 -1
  87. package/components/hy-tabs/index.scss +4 -18
  88. package/components/hy-tag/index.scss +3 -3
  89. package/components/hy-text/hy-text.vue +5 -4
  90. package/components/hy-text/index.scss +3 -15
  91. package/components/hy-textarea/hy-textarea.vue +5 -5
  92. package/components/hy-textarea/index.scss +8 -20
  93. package/components/hy-toast/index.scss +5 -22
  94. package/components/hy-tooltip/index.scss +7 -5
  95. package/components/hy-upload/index.scss +5 -15
  96. package/composables/index.ts +1 -0
  97. package/composables/useTouch.ts +48 -0
  98. package/index.scss +1 -0
  99. package/libs/css/mixin.scss +58 -13
  100. package/libs/css/vars.css +53 -0
  101. package/package.json +2 -2
  102. package/theme.scss +42 -54
  103. package/components/hy-swipe-action/index.wxs +0 -235
  104. package/components/hy-swipe-action/wxs.js +0 -15
@@ -0,0 +1,177 @@
1
+ import type { CSSProperties } from "vue";
2
+
3
+ export default interface HySignatureProps {
4
+ /**
5
+ * @description 签名笔颜色
6
+ * */
7
+ penColor?: string;
8
+ /**
9
+ * @description 签名笔宽度(默认 1 )
10
+ * */
11
+ lineWidth?: number;
12
+ /**
13
+ * @description 清空按钮的文本
14
+ * */
15
+ clearText?: string;
16
+ /**
17
+ * @description 撤回按钮的文本
18
+ * */
19
+ revokeText?: string;
20
+ /**
21
+ * @description 恢复按钮的文本
22
+ * */
23
+ restoreText?: string;
24
+ /**
25
+ * @description 确认按钮的文本
26
+ * */
27
+ confirmText?: string;
28
+ /**
29
+ * @description 目标文件的类型(默认 png )
30
+ * */
31
+ fileType?: string;
32
+ /**
33
+ * @description 签名笔颜色
34
+ * */
35
+ quality?: number;
36
+ /**
37
+ * @description 目标文件的质量(默认 1 )
38
+ * */
39
+ exportScale?: number;
40
+ /**
41
+ * @description 是否禁用签名板(默认 false )
42
+ * */
43
+ disabled?: boolean;
44
+ /**
45
+ * @description 画布的高度
46
+ * */
47
+ height?: number;
48
+ /**
49
+ * @description 画布的宽度
50
+ * */
51
+ width?: number;
52
+ /**
53
+ * @description 画板的背景色
54
+ * */
55
+ backgroundColor?: string;
56
+ /**
57
+ * @description 是否禁用画布滚动(默认 true )
58
+ * */
59
+ disableScroll?: boolean;
60
+ /**
61
+ * @description 是否开启历史记录(默认 false )
62
+ * */
63
+ enableHistory?: boolean;
64
+ /**
65
+ * @description 撤回和恢复的步长(默认 1 )
66
+ * */
67
+ step?: number;
68
+ /**
69
+ * @description 撤回按钮的文本(默认 撤销 )
70
+ * */
71
+ undoText?: string;
72
+ /**
73
+ * @description 恢复按钮的文本(默认 恢复 )
74
+ * */
75
+ redoText?: string;
76
+ /**
77
+ * @description 是否启用压感模式(默认 false )
78
+ * */
79
+ pressure?: boolean;
80
+ /**
81
+ * @description 压感模式下笔画最小宽度(默认 2 )
82
+ * */
83
+ minWidth?: number;
84
+ /**
85
+ * @description 压感模式下笔画最大宽度(默认 6 )
86
+ * */
87
+ maxWidth?: number;
88
+ /**
89
+ * @description 最小速度阈值,影响压感模式下的笔画宽度变化(默认 1.5 )
90
+ * */
91
+ minSpeed?: number;
92
+ /**
93
+ * @description 定义需要用到的外部样式
94
+ * */
95
+ customStyle?: CSSProperties;
96
+ }
97
+
98
+ /**
99
+ * 签名结果类型
100
+ * @property tempFilePath - 生成图片的临时路径
101
+ * @property success - 是否成功生成图片
102
+ * @property width - 生成图片的宽度
103
+ * @property height - 生成图片的高度
104
+ */
105
+ export type SignatureResult = {
106
+ tempFilePath: string;
107
+ success: boolean;
108
+ width: number;
109
+ height: number;
110
+ };
111
+
112
+ /**
113
+ * 签名线条类型
114
+ * @property points - 线条所包含的所有点的数组
115
+ * @property color - 线条颜色
116
+ * @property width - 线条宽度
117
+ * @property backgroundColor - 线条背景色 (可选)
118
+ * @property isPressure - 是否为笔锋模式的线条 (可选)
119
+ */
120
+ export interface Line {
121
+ points: Point[];
122
+ color: string;
123
+ width: number;
124
+ backgroundColor?: string;
125
+ isPressure?: boolean;
126
+ }
127
+
128
+ /**
129
+ * 签名点位类型
130
+ * @property x - 点的横坐标
131
+ * @property y - 点的纵坐标
132
+ * @property t - 点的时间戳
133
+ * @property speed - 当前点的绘制速度 (可选)
134
+ * @property distance - 与上一个点的距离 (可选)
135
+ * @property lineWidth - 当前点的线宽 (可选,用于笔锋模式)
136
+ * @property lastX1 - 贝塞尔曲线第一个控制点的x坐标 (可选)
137
+ * @property lastY1 - 贝塞尔曲线第一个控制点的y坐标 (可选)
138
+ * @property lastX2 - 贝塞尔曲线第二个控制点的x坐标 (可选)
139
+ * @property lastY2 - 贝塞尔曲线第二个控制点的y坐标 (可选)
140
+ * @property isFirstPoint - 是否为线条的第一个点 (可选)
141
+ */
142
+ export interface Point {
143
+ x: number;
144
+ y: number;
145
+ t: number;
146
+ speed?: number;
147
+ distance?: number;
148
+ lineWidth?: number;
149
+ lastX1?: number;
150
+ lastY1?: number;
151
+ lastX2?: number;
152
+ lastY2?: number;
153
+ isFirstPoint?: boolean;
154
+ }
155
+
156
+ /**
157
+ * 签名组件暴露的方法类型
158
+ * @property init - 初始化签名板
159
+ * @property clear - 清除签名
160
+ * @property confirm - 确认签名并生成图片
161
+ * @property restore - 恢复上一步操作
162
+ * @property revoke - 撤销上一步操作
163
+ */
164
+ export type SignatureExpose = {
165
+ /** 初始化签名板
166
+ * @param forceUpdate - 是否强制更新
167
+ */
168
+ init: (forceUpdate?: boolean) => void;
169
+ /** 点击清除按钮清除签名 */
170
+ clear: () => void;
171
+ /** 点击确定按钮 */
172
+ confirm: () => void;
173
+ /* 点击恢复 */
174
+ restore: () => void;
175
+ /* 点击撤回 */
176
+ revoke: () => void;
177
+ };
@@ -33,7 +33,8 @@
33
33
  }
34
34
 
35
35
  &__base {
36
- background-color: #ebedf0;
36
+ background-color: $hy-background--empty;
37
+ border-radius: $hy-border-radius-semicircle;
37
38
  }
38
39
 
39
40
  /* #ifndef APP-NVUE */
@@ -53,6 +54,9 @@
53
54
  border-radius: $hy-border-radius-semicircle;
54
55
  transition: width 0.2s;
55
56
  background-color: $hy-primary;
57
+ &-0 {
58
+ background-color: $hy-background--empty;
59
+ }
56
60
  }
57
61
 
58
62
  &__button {
@@ -60,7 +64,7 @@
60
64
  height: 24px;
61
65
  border-radius: 50%;
62
66
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
63
- background-color: #fff;
67
+ background-color: $hy-background--3;
64
68
  transform: scale(0.9);
65
69
  /* #ifdef H5 */
66
70
  cursor: pointer;
@@ -8,8 +8,8 @@ const defaultProps: IProps = {
8
8
  max: 100,
9
9
  step: 1,
10
10
  activeColor: "",
11
- inactiveColor: "#c0c4cc",
12
- blockColor: "#ffffff",
11
+ inactiveColor: "",
12
+ blockColor: "",
13
13
  showValue: false,
14
14
  disabled: false,
15
15
  useNative: false,
@@ -8,7 +8,11 @@
8
8
  <!-- 线条 -->
9
9
  <view
10
10
  v-if="i > 0"
11
- :class="[`hy-steps-item__line--${direction}`, 'hy-steps-item__line', statusClass(i, item.error)]"
11
+ :class="[
12
+ `hy-steps-item__line--${direction}`,
13
+ 'hy-steps-item__line',
14
+ statusClass(i, item.error),
15
+ ]"
12
16
  :style="lineStyle(item, i)"
13
17
  ></view>
14
18
  <!-- 线条 -->
@@ -18,13 +22,16 @@
18
22
  :class="[
19
23
  `hy-steps-item__wrapper--${direction}`,
20
24
  dot ? `hy-steps-item__wrapper--dot` : statusClass(i, item.error),
21
- 'hy-steps-item__wrapper'
25
+ 'hy-steps-item__wrapper',
22
26
  ]"
23
27
  :style="itemStyleInner"
24
28
  >
25
29
  <slot name="icon" :error="item?.error" :index="i">
26
30
  <view
27
- :class="['hy-steps-item__wrapper--dot__item', `hy-steps-item__wrapper--dot__${statusClass(i, item.error)}`]"
31
+ :class="[
32
+ 'hy-steps-item__wrapper--dot__item',
33
+ `hy-steps-item__wrapper--dot__${statusClass(i, item.error)}`,
34
+ ]"
28
35
  v-if="dot"
29
36
  :style="{
30
37
  backgroundColor: statusColor(i, item?.error),
@@ -90,10 +97,12 @@
90
97
  <slot name="content" :record="item" :index="i">
91
98
  <slot name="title" :title="item.title" :index="i">
92
99
  <text
100
+ :class="[
101
+ current == i && 'hy-steps-item__content__title--active',
102
+ ]"
93
103
  :style="{
94
104
  lineHeight: '20px',
95
105
  fontSize: current == i ? '14px' : '13px',
96
- color: i == current ? '#2c405a' : '#555555',
97
106
  }"
98
107
  >{{ item.title }}</text
99
108
  >
@@ -113,28 +122,37 @@
113
122
 
114
123
  <script lang="ts">
115
124
  export default {
116
- name: 'hy-steps',
125
+ name: "hy-steps",
117
126
  options: {
118
127
  addGlobalClass: true,
119
128
  virtualHost: true,
120
- styleIsolation: 'shared'
121
- }
122
- }
129
+ styleIsolation: "shared",
130
+ },
131
+ };
123
132
  </script>
124
133
 
125
134
  <script setup lang="ts">
126
- import {computed, type CSSProperties, toRefs, ref, onMounted, getCurrentInstance, watch} from "vue";
135
+ import {
136
+ computed,
137
+ type CSSProperties,
138
+ toRefs,
139
+ ref,
140
+ onMounted,
141
+ getCurrentInstance,
142
+ watch,
143
+ } from "vue";
127
144
  import defaultProps from "./props";
128
145
  import type IProps from "./typing";
129
146
  import type { StepListVo } from "./typing";
130
- import {addUnit, getRect} from "../../utils";
147
+ import { addUnit, getRect } from "../../utils";
131
148
  import { ColorConfig, IconConfig } from "../../config";
132
149
 
133
150
  // 组件
134
151
  import HyIcon from "../hy-icon/hy-icon.vue";
135
152
 
136
153
  const props = withDefaults(defineProps<IProps>(), defaultProps);
137
- const { current, list, direction, dot, inactiveColor, activeColor } = toRefs(props);
154
+ const { current, list, direction, dot, inactiveColor, activeColor } =
155
+ toRefs(props);
138
156
  const emit = defineEmits(["click", "update:current"]);
139
157
 
140
158
  const size = ref<UniApp.NodeInfo>({
@@ -144,14 +162,14 @@ const size = ref<UniApp.NodeInfo>({
144
162
  const instance = getCurrentInstance();
145
163
 
146
164
  watch(
147
- () => current.value,
148
- (newVal: number) => {
149
- if(list.value[newVal - 1]?.error) {
150
- const index = list.value.findIndex(item => item.error);
151
- emit("update:current", index);
152
- }
165
+ () => current.value,
166
+ (newVal: number) => {
167
+ if (list.value[newVal - 1]?.error) {
168
+ const index = list.value.findIndex((item) => item.error);
169
+ emit("update:current", index);
153
170
  }
154
- )
171
+ },
172
+ );
155
173
 
156
174
  /**
157
175
  * @description 线条样式
@@ -164,10 +182,10 @@ const lineStyle = computed(() => {
164
182
  style.left = addUnit(-size.value.width! / 2 + 12);
165
183
  } else {
166
184
  style.height = addUnit(size.value.height! - 30);
167
- style.top = addUnit(25)
185
+ style.top = addUnit(25);
168
186
  }
169
187
  style.backgroundColor = temp.error
170
- ? ''
188
+ ? ""
171
189
  : index < current.value
172
190
  ? activeColor.value
173
191
  : inactiveColor.value;
@@ -1,20 +1,6 @@
1
1
  @use "../../theme.scss" as *;
2
2
  @use "../../libs/css/mixin.scss" as *;
3
3
 
4
- /* 暗色主题 */
5
- @include b(theme){
6
- @include m(dark) {
7
- @include b(steps) {
8
- //color: $hy-dark-color;
9
- &__wrapper__nav__item--active {
10
- .hy-tabs__wrapper__nav__item--text {
11
- color: $hy-dark-color;
12
- }
13
- }
14
- }
15
- }
16
- }
17
-
18
4
  @include b(steps) {
19
5
  @include flex;
20
6
 
@@ -104,14 +90,14 @@
104
90
  flex-shrink: 0;
105
91
  /* #endif */
106
92
  border-radius: $hy-border-radius-semicircle;
107
- border: 1px solid $hy-tips-color;
93
+ border: $hy-border-line;
108
94
  @include flex(row);
109
95
  align-items: center;
110
96
  justify-content: center;
111
97
  transition: background-color 0.3s;
112
98
 
113
99
  &__text {
114
- color: $hy-tips-color;
100
+ color: $hy-text-color--grey;
115
101
  font-size: 11px;
116
102
  @include flex(row);
117
103
  align-items: center;
@@ -125,6 +111,9 @@
125
111
  &__content {
126
112
  @include flex;
127
113
  flex: 1;
114
+ &__title--active {
115
+ color: $hy-primary;
116
+ }
128
117
 
129
118
  &--row {
130
119
  flex-direction: column;
@@ -142,7 +131,7 @@
142
131
  /* 线条样式 */
143
132
  &__line {
144
133
  position: absolute;
145
- background: $hy-tips-color;
134
+ background: $hy-border-color;
146
135
 
147
136
  &.finish {
148
137
  background-color: $hy-primary;
@@ -1,18 +1,10 @@
1
1
  @use "../../theme.scss" as *;
2
2
  @use "../../libs/css/mixin.scss" as *;
3
3
 
4
- /* 暗色主题 */
5
- @include b(theme){
6
- @include m(dark) {
7
- @include b(submit-bar) {
8
- background-color: $hy-dark-background;
9
- }
10
- }
11
- }
12
4
 
13
5
  @include b(submit-bar) {
14
6
  display: flex;
15
- background-color: $hy-light-background-color;
7
+ background-color: $hy-background--container;
16
8
  padding: $hy-border-margin-padding-base;
17
9
  width: 100%;
18
10
  box-sizing: border-box;
@@ -1,20 +1,6 @@
1
1
  @use "../../theme.scss" as *;
2
2
  @use "../../libs/css/mixin.scss" as *;
3
3
 
4
- /* 暗色主题 */
5
- @include b(theme){
6
- @include m(dark) {
7
- @include b(subsection) {
8
- color: $hy-dark-color;
9
- @include m(button) {
10
- background-color: $hy-dark-background--track;
11
- &__bar {
12
- background-color: $hy-dark-background--container;
13
- }
14
- }
15
- }
16
- }
17
- }
18
4
 
19
5
  @include b(subsection) {
20
6
  @include flex;
@@ -27,13 +13,13 @@
27
13
 
28
14
  @include m(button) {
29
15
  height: 35px;
30
- background-color: rgb(238, 238, 239);
16
+ background-color: $hy-background--3;
31
17
  padding: 3px;
32
18
  border-radius: $hy-border-radius-sm;
33
19
  align-items: stretch;
34
20
 
35
21
  &__bar {
36
- background-color: #ffffff;
22
+ background-color: $hy-background--container !important;
37
23
  border-radius: $hy-border-radius-sm;
38
24
  }
39
25
  }