hy-app 0.2.1 → 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 (50) hide show
  1. package/components/hy-button/index.scss +4 -0
  2. package/components/hy-code-input/hy-code-input.vue +223 -0
  3. package/components/hy-code-input/index.scss +108 -0
  4. package/components/hy-code-input/props.ts +21 -0
  5. package/components/hy-code-input/typing.d.ts +65 -0
  6. package/components/hy-config-provider/hy-config-provider.vue +0 -1
  7. package/components/hy-dropdown/props.ts +1 -1
  8. package/components/hy-dropdown-item/hy-dropdown-item.vue +2 -5
  9. package/components/hy-dropdown-item/index.scss +11 -13
  10. package/components/hy-grid/hy-grid.vue +5 -5
  11. package/components/hy-icon/index.scss +1 -0
  12. package/components/hy-modal/hy-modal.vue +5 -5
  13. package/components/hy-modal/index.scss +0 -6
  14. package/components/hy-notify/hy-notify.vue +169 -0
  15. package/components/hy-notify/index.scss +25 -0
  16. package/components/hy-notify/props.ts +14 -0
  17. package/components/hy-notify/typing.d.ts +44 -0
  18. package/components/hy-pagination/hy-pagination.vue +125 -0
  19. package/components/hy-pagination/index.scss +46 -0
  20. package/components/hy-pagination/props.ts +15 -0
  21. package/components/hy-pagination/typing.d.ts +44 -0
  22. package/components/hy-picker/index.scss +4 -0
  23. package/components/hy-scroll-list/index.scss +1 -1
  24. package/components/hy-search/index.scss +1 -2
  25. package/components/hy-signature/canvasHelper.ts +51 -0
  26. package/components/hy-signature/hy-signature.vue +656 -0
  27. package/components/hy-signature/index.scss +31 -0
  28. package/components/hy-signature/props.ts +28 -0
  29. package/components/hy-signature/typing.d.ts +177 -0
  30. package/components/hy-slider/index.scss +5 -1
  31. package/components/hy-swipe-action/hy-swipe-action.vue +288 -248
  32. package/components/hy-swipe-action/index.scss +34 -0
  33. package/components/hy-swipe-action/index.ts +34 -0
  34. package/components/hy-swipe-action/props.ts +15 -9
  35. package/components/hy-swipe-action/typing.d.ts +20 -22
  36. package/components/hy-swiper/index.scss +5 -0
  37. package/components/hy-tabs/index.scss +2 -2
  38. package/components/hy-tag/index.scss +1 -1
  39. package/components/hy-textarea/hy-textarea.vue +5 -5
  40. package/components/hy-textarea/index.scss +5 -6
  41. package/components/hy-tooltip/index.scss +2 -2
  42. package/components/hy-upload/index.scss +1 -1
  43. package/composables/index.ts +1 -0
  44. package/composables/useTouch.ts +48 -0
  45. package/libs/css/mixin.scss +52 -13
  46. package/libs/css/vars.css +7 -1
  47. package/package.json +2 -2
  48. package/theme.scss +23 -46
  49. package/components/hy-swipe-action/index.wxs +0 -235
  50. package/components/hy-swipe-action/wxs.js +0 -15
@@ -1,4 +1,4 @@
1
- import type { CSSProperties } from "vue";
1
+ import type { CSSProperties, PropType } from "vue";
2
2
 
3
3
  interface SwipeActionOptionsVo {
4
4
  text: string;
@@ -6,36 +6,33 @@ interface SwipeActionOptionsVo {
6
6
  icon?: string;
7
7
  iconSize?: string | number;
8
8
  }
9
+ export type SwipeActionStatus = "close" | "left" | "right";
10
+ // 点击关闭按钮、滑动关闭按钮、通过控制value关闭按钮
11
+ export type SwipeActionReason = "click" | "swipe" | "value";
12
+ export type SwipeActionPosition = SwipeActionStatus | "inside";
13
+ export type SwipeActionBeforeClose = (
14
+ reason: SwipeActionReason,
15
+ position: SwipeActionPosition,
16
+ ) => void;
9
17
 
10
18
  export default interface SwipeActionProps {
11
19
  /**
12
- * @description 数据列表
20
+ * @description 滑动按钮的状态,使用v-model进行双向绑定。
21
+ * 选值为:'left'(左滑)、'close'(关闭状态)、'right'(右滑)。
13
22
  * */
14
- list: Record<string, any>[];
23
+ modelValue?: SwipeActionStatus;
15
24
  /**
16
- * @description 控制打开或者关闭(默认 false )
17
- * */
18
- show?: boolean;
19
- /**
20
- * @description 标识符,如果是v-for,可用index索引值
21
- * */
22
- name?: string;
23
- /**
24
- * @description 唯一键值
25
- * */
26
- key?: string;
27
- /**
28
- * @description 是否禁用(默认 false )
25
+ * @description 是否禁用滑动操作
29
26
  * */
30
27
  disabled?: boolean;
31
- /**
32
- * @description 滑动距离阈值,只有大于此值,才被认为是要打开菜单(默认 30 )
33
- * */
34
- threshold?: number;
35
28
  /**
36
29
  * @description 是否自动关闭其他swipe按钮组(默认 true )
37
30
  * */
38
31
  autoClose?: boolean;
32
+ /**
33
+ * @description 显示底部边框
34
+ * */
35
+ borderBottom?: boolean;
39
36
  /**
40
37
  * @description 右侧按钮内容
41
38
  * */
@@ -45,9 +42,10 @@ export default interface SwipeActionProps {
45
42
  * */
46
43
  duration?: number;
47
44
  /**
48
- * @description 是否关闭
45
+ * @description 在关闭滑动按钮前调用的钩子函数
46
+ * @desc 可以在此函数中执行一些关闭前的操作,如确认提示等。
49
47
  * */
50
- closeOnClick: boolean;
48
+ beforeClose?: funtion | PropType<SwipeActionBeforeClose>;
51
49
  /**
52
50
  * @description 定义需要用到的外部样式
53
51
  * */
@@ -12,6 +12,10 @@
12
12
  &__wrapper {
13
13
  flex: 1;
14
14
 
15
+ :deep(.uni-swiper-wrapper) {
16
+ background-color: $hy-background;
17
+ }
18
+
15
19
  &__item {
16
20
  flex: 1;
17
21
 
@@ -22,6 +26,7 @@
22
26
  transition: transform 0.3s;
23
27
  flex: 1;
24
28
 
29
+
25
30
  &__image {
26
31
  flex: 1;
27
32
  }
@@ -47,10 +47,10 @@
47
47
  &--text {
48
48
  font-size: 15px;
49
49
  color: $hy-text-color;
50
- white-space: nowrap !important;
50
+ white-space: nowrap;
51
51
 
52
52
  &--disabled {
53
- color: $hy-light-background-disabled !important;
53
+ color: $hy-background--disabled !important;
54
54
  }
55
55
  }
56
56
  }
@@ -13,7 +13,7 @@
13
13
  }
14
14
 
15
15
  /*禁用*/
16
- @include themeColor(disabled, $hy-background--disabled, $hy-color-disable-icon,
16
+ @include themeColor(disabled, $hy-background--disabled, $hy-text-color--disabled,
17
17
  $hy-background--disabled);
18
18
 
19
19
  /*圆角*/
@@ -5,7 +5,7 @@
5
5
  :style="[textareaStyle, borderStyle(isFocus)]"
6
6
  >
7
7
  <textarea
8
- class="hy-textarea__field"
8
+ class="hy-textarea--field"
9
9
  :value="innerValue"
10
10
  :style="{ height: addUnit(height) }"
11
11
  :placeholder="placeholder || ''"
@@ -47,13 +47,13 @@
47
47
 
48
48
  <script lang="ts">
49
49
  export default {
50
- name: 'hy-textarea',
50
+ name: "hy-textarea",
51
51
  options: {
52
52
  addGlobalClass: true,
53
53
  virtualHost: true,
54
- styleIsolation: 'shared'
55
- }
56
- }
54
+ styleIsolation: "shared",
55
+ },
56
+ };
57
57
  </script>
58
58
 
59
59
  <script setup lang="ts">
@@ -8,31 +8,30 @@
8
8
  flex: 1;
9
9
  padding: $hy-border-margin-padding-base;
10
10
 
11
- &--radius {
11
+ @include m(radius) {
12
12
  border-radius: $hy-border-radius-sm;
13
13
  }
14
14
 
15
- &--no-radius {
15
+ @include m(no-radius) {
16
16
  border-radius: $hy-border-radius-no;
17
17
  }
18
18
 
19
- &--disabled {
19
+ @include m(disabled) {
20
20
  background-color: $hy-background--disabled;
21
21
  color: $hy-text-color--disabled;
22
22
  }
23
23
 
24
- &__field {
24
+ @include m(field) {
25
25
  flex: 1;
26
26
  font-size: 15px;
27
27
  width: 100%;
28
28
  }
29
29
 
30
- &--count {
30
+ @include m(count) {
31
31
  position: absolute;
32
32
  right: 5px;
33
33
  bottom: 2px;
34
34
  font-size: 12px;
35
- color: $hy-text-color--2;
36
35
  background-color: $hy-background--3;
37
36
  padding: 1px 4px;
38
37
  border-radius: $hy-border-radius-sm;
@@ -21,7 +21,7 @@
21
21
  justify-content: center;
22
22
 
23
23
  &__list {
24
- background-color: #060607;
24
+ background-color: rgb(50, 50, 51);
25
25
  position: relative;
26
26
  flex: 1;
27
27
  border-radius: $hy-border-radius-sm;
@@ -49,7 +49,7 @@
49
49
 
50
50
  &__indicator {
51
51
  position: absolute;
52
- background-color: #060607;
52
+ background-color: rgb(50, 50, 51);
53
53
  width: 14px;
54
54
  height: 14px;
55
55
  bottom: -4px;
@@ -37,7 +37,7 @@ $hy-upload-text-font-size: 11px !default;
37
37
 
38
38
  &__text {
39
39
  font-size: $hy-upload-text-font-size;
40
- color: $hy-tips-color;
40
+ color: $hy-text-color--grey;
41
41
  margin-top: 2px;
42
42
  }
43
43
  }
@@ -1 +1,2 @@
1
1
  export * from "./useShare";
2
+ export * from "./useTouch";
@@ -0,0 +1,48 @@
1
+ import { ref } from "vue";
2
+
3
+ export function useTouch() {
4
+ const direction = ref<string>("");
5
+ const deltaX = ref<number>(0);
6
+ const deltaY = ref<number>(0);
7
+ const offsetX = ref<number>(0);
8
+ const offsetY = ref<number>(0);
9
+ const startX = ref<number>(0);
10
+ const startY = ref<number>(0);
11
+
12
+ function touchStart(event: any) {
13
+ const touch = event.touches[0];
14
+ direction.value = "";
15
+ deltaX.value = 0;
16
+ deltaY.value = 0;
17
+ offsetX.value = 0;
18
+ offsetY.value = 0;
19
+ startX.value = touch.clientX;
20
+ startY.value = touch.clientY;
21
+ }
22
+
23
+ function touchMove(event: any) {
24
+ const touch = event.touches[0];
25
+ deltaX.value = touch.clientX - startX.value;
26
+ deltaY.value = touch.clientY - startY.value;
27
+ offsetX.value = Math.abs(deltaX.value);
28
+ offsetY.value = Math.abs(deltaY.value);
29
+ direction.value =
30
+ offsetX.value > offsetY.value
31
+ ? "horizontal"
32
+ : offsetX.value < offsetY.value
33
+ ? "vertical"
34
+ : "";
35
+ }
36
+
37
+ return {
38
+ touchStart,
39
+ touchMove,
40
+ direction,
41
+ deltaX,
42
+ deltaY,
43
+ offsetX,
44
+ offsetY,
45
+ startX,
46
+ startY,
47
+ };
48
+ }
@@ -1,6 +1,9 @@
1
1
  @use "../../theme.scss";
2
- $namespace: hy;
3
- $modifier-separator: '--';
2
+ $namespace: 'hy' !default;
3
+ $common-separator: '-' !default;
4
+ $element-separator: '__' !default;
5
+ $modifier-separator: '--' !default;
6
+ $state-prefix: 'is-' !default;
4
7
 
5
8
  @mixin b($block) {
6
9
  $B: $namespace + '-' + $block !global;
@@ -28,6 +31,53 @@ $modifier-separator: '--';
28
31
  }
29
32
  }
30
33
 
34
+ @mixin e($element) {
35
+ $E: $element !global;
36
+ $selector: &;
37
+ $currentSelector: '';
38
+ @each $unit in $element {
39
+ $currentSelector: #{$currentSelector +
40
+ '.' +
41
+ $B +
42
+ $element-separator +
43
+ $unit +
44
+ ','};
45
+ }
46
+
47
+ @if hitAllSpecialNestRule($selector) {
48
+ @at-root {
49
+ #{$selector} {
50
+ #{$currentSelector} {
51
+ @content;
52
+ }
53
+ }
54
+ }
55
+ } @else {
56
+ @at-root {
57
+ #{$currentSelector} {
58
+ @content;
59
+ }
60
+ }
61
+ }
62
+ }
63
+
64
+ /* 状态,生成 is-$state 类名 */
65
+ @mixin is($states...) {
66
+ @at-root {
67
+ @each $state in $states {
68
+ &.#{$state-prefix + $state} {
69
+ @content;
70
+ }
71
+ }
72
+ }
73
+ }
74
+ /* 添加伪类元素 */
75
+ @mixin pseudo($pseudo) {
76
+ @at-root #{&}#{':#{$pseudo}'} {
77
+ @content;
78
+ }
79
+ }
80
+
31
81
  @mixin themeColor($type, $bg-color: transparent, $border-color: transparent, $color: #FFFFFF) {
32
82
  @include m($type) {
33
83
  background-color: $bg-color;
@@ -62,17 +112,6 @@ $modifier-separator: '--';
62
112
  flex-direction: $direction;
63
113
  }
64
114
 
65
- /* 状态,生成 is-$state 类名 */
66
- @mixin when($states...) {
67
- @at-root {
68
- @each $state in $states {
69
- &.#{$state-prefix + $state} {
70
- @content;
71
- }
72
- }
73
- }
74
- }
75
-
76
115
  /* 几行出现省略号 */
77
116
  @mixin line-feed($line: 1) {
78
117
  display: -webkit-box;
package/libs/css/vars.css CHANGED
@@ -5,7 +5,8 @@
5
5
  --hy-text-color--2: #67676c;
6
6
  --hy-text-color--3: #929295;
7
7
  --hy-text-color--4: rgba(0, 0, 0, 0.1);
8
- --hy-icon-color: #606266;
8
+ --hy-icon-color: #999;
9
+ --hy-text-color--grey: #67676c;
9
10
  --hy-text-color--placeholder: rgba(0, 0, 0, 0.25);
10
11
  --hy-text-color--disabled: rgba(0, 0, 0, 0.25);
11
12
 
@@ -18,6 +19,8 @@
18
19
  --hy-background--hover: rgba(0,0,0,0.2);
19
20
 
20
21
  --hy-border-line: 1rpx solid #c2c2c4;
22
+ --hy-border-color: #c2c2c4;
23
+ --hy-border-color--2: #c9cacc;
21
24
  }
22
25
 
23
26
  .hy-theme--dark {
@@ -32,6 +35,7 @@
32
35
  --hy-text-color-3: #6a6a71;
33
36
  --hy-text-color--4: rgba(255, 255, 255, 0.1);
34
37
  --hy-icon-color: #FFFFFF;
38
+ --hy-text-color--grey: #98989f;
35
39
  --hy-text-color--placeholder: rgba(255, 255, 255, 0.25);
36
40
  --hy-text-color--disabled: rgba(255, 255, 255, 0.25);
37
41
 
@@ -44,4 +48,6 @@
44
48
  --hy-background--hover: rgba(255,255,255,0.2);
45
49
 
46
50
  --hy-border-line: 1rpx solid #3c3f44;
51
+ --hy-border-color: #3c3f44;
52
+ --hy-border-color--2: #FFFFFF;
47
53
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hy-app",
3
- "version": "0.2.1",
4
- "description": "全局主题色配置",
3
+ "version": "0.2.2",
4
+ "description": "添加签名、分页组件",
5
5
  "main": "./index.ts",
6
6
  "private": false,
7
7
  "scripts": {},
package/theme.scss CHANGED
@@ -24,30 +24,29 @@ $hy-info-dark: var(--hy-info--dark, #82848a) !default;
24
24
  $hy-info-disabled: var(--hy-info--disabled, #c8c9cc) !default;
25
25
  $hy-info-light: var(--hy-info--light, #f4f4f5) !default;
26
26
 
27
+ /* 字体颜色 */
28
+ $hy-text-color: var(--hy-text-color, #3c3c43) !default; // 一般用于基础文字
29
+ $hy-text-color--2: var(--hy-text-color--2, #67676c) !default; // 一般用于提示
30
+ $hy-text-color--3: var(--hy-text-color--3, #929295) !default; // 一般用于浅色提示
31
+ $hy-text-color--4: var(--hy-text-color--4, rgba(0, 0, 0, 0.1)) !default; // 一般用于浅色
32
+ $hy-icon-color: var(--hy-icon-color, #606266) !default; // 一般用于icon
33
+ $hy-text-color--grey: var(--hy-text-color--grey, #999) !default; // 辅助灰色,如加载更多的提示信息
34
+ $hy-text-color--placeholder: var(--hy-text-color--placeholder, #808080) !default; // 输入框提示颜色
35
+ $hy-text-color--disabled: var(--hy-text-color--disabled, #c0c0c0) !default; // 禁用文字颜色
36
+ $hy-border-color: var(--hy-border-color, #c0c0c0) !default; // 边框颜色
37
+ $hy-text-color-hover: var(--hy-text-color-hover, #58595b)!default; // 点击状态文字颜色
27
38
 
28
- $hy-dark-bg-disabled: rgba(48, 48, 56, 0.51) !default;
29
- $hy-dark-color: #ffffff !default;
30
- $hy-dark-icon: #7C7C7C !default;
31
- $hy-dark-color2: var(#f2270c) !default;
32
- $hy-dark-color3: var(rgba(232, 230, 227, 0.8)) !default;
33
- $hy-dark-color-gray: var(#c0c0c0) !default;
34
- $hy-dark-text-disabled: #c0c0c0 !default;
35
- $hy-dark-border-color: var(#3a3a3c) !default;
36
39
 
37
- /* 亮色背景颜色 */
38
- $hy-light-background: var(--hy-light-background, #F8F8F8) !default;
39
- $hy-light-background-color: var(--hy-light-background-color, #FFFFFF) !default;
40
- $hy-light-background-disabled: var(--hy-light-background-disabled, #F5F5F5) !default;
41
- $hy-light-background-hover: var(--hy-light-background-hover, #f1f1f1) !default; //点击状态颜色
40
+ /* 背景色 */
41
+ $hy-background: var(--hy-background, #f8f8f8) !default; // 背景色
42
+ $hy-background--2: var(--hy-background--2, #ffffff) !default; // 弹窗背景色
43
+ $hy-background--3: var(--hy-background--3, #646566) !default; // 弹窗背景色
44
+ $hy-background--container: var(--hy-background--container, #ffffff) !default; // 容器背景色
45
+ $hy-background--disabled: var(--hy-background--disabled, #F5F5F5); // 禁用背景色
46
+ $hy-background--track: var(--hy-background--track, #c6c7cb) !default;
47
+ $hy-background--empty: var(--hy-background--empty, #f6f6f7) !default; // 搜索背景色
48
+ $hy-background--hover: var(--hy-background--hover, #707070) !default; // 点击状态
42
49
  $hy-light-background-mask: var(--hy-light-background-mask, rgba(0, 0, 0, 0.5)); //遮罩颜色
43
- $hy-light-background-image: var(--hy-light-background-image, #F3F3F3) !default; // 图片背景色
44
-
45
- /* 文字基本颜色 */
46
- $hy-light-color: var(--hy-light-color, #333) !default; //基本色
47
- $hy-text-color-hover: var(--hy-text-color-hover, #58595b)!default;
48
-
49
- $hy-tips-color: #909193FF;
50
- $hy-color-disable-icon: #c8c9cc;
51
50
 
52
51
  /* 文字尺寸 */
53
52
  $hy-font-size-sm: 12px;
@@ -68,7 +67,8 @@ $hy-font-size-hint: 26rpx;
68
67
 
69
68
  /* 边框颜色 */
70
69
  $hy-border-color-light: var(--hy-border-color-light, #c8c7cc) !default;
71
- $hy-border-color: var(--hy-border-color, #c8c7cc66) !default;
70
+ $hy-border-color: var(--hy-border-color, #c2c2c4) !default;
71
+ $hy-border-color--2: var(--hy-border-color--2, #c9cacc) !default;
72
72
 
73
73
  /* 图片尺寸 */
74
74
  $hy-img-size-sm: var(--hy-img-size-sm, 45rpx) !default;
@@ -97,27 +97,4 @@ $hy-border-margin-padding-sm: var(--hy-border-margin-padding-sm, 10rpx) !default
97
97
  $hy-border-margin-padding-base: var(--hy-border-margin-padding-base, 20rpx) !default;
98
98
  $hy-border-margin-padding-lg: var(--hy-border-margin-padding-lg, 30rpx) !default;
99
99
  /* 底部线条 */
100
- $hy-border-line: var(--hy-border-line, 1rpx solid #dadbde) !default;
101
-
102
-
103
- /* 字体 */
104
- $hy-text-color: var(--hy-text-color, #3c3c43) !default; // 一般用于文字
105
- $hy-text-color--2: var(--hy-text-color--2, #67676c) !default; // 一般用于icon
106
- $hy-text-color--3: var(--hy-text-color--3, #929295) !default; // 一般用于icon
107
- $hy-text-color--4: var(--hy-text-color--4, #929295) !default; // 一般用于icon
108
- $hy-icon-color: var(--hy-icon-color, #606266) !default; // 一般用于icon
109
- $hy-text-color--grey: var(--hy-text-color-3, #999) !default; // 辅助灰色,如加载更多的提示信息
110
- $hy-text-color--placeholder: var(--hy-text-color--placeholder, #808080) !default; // 输入框提示颜色
111
- $hy-text-color--disabled: var(--hy-text-color--disabled, #c0c0c0) !default; // 禁用文字颜色
112
- $hy-border-color: var(--hy-border-color, #c0c0c0) !default;
113
-
114
-
115
- /* 背景色 */
116
- $hy-background: var(--hy-background, #f8f8f8) !default; // 背景色
117
- $hy-background--2: var(--hy-background--2, #ffffff) !default; // 弹窗背景色
118
- $hy-background--3: var(--hy-background--3, #646566) !default; // 弹窗背景色
119
- $hy-background--container: var(--hy-background--container, #ffffff) !default; // 容器背景色
120
- $hy-background--disabled: var(--hy-background--disabled, #F5F5F5); // 禁用背景色
121
- $hy-background--track: var(--hy-background--track, #c6c7cb) !default;
122
- $hy-background--empty: var(--hy-background--empty, #f6f6f7) !default; // 搜索背景色
123
- $hy-background--hover: var(--hy-background--hover, #707070) !default; // 点击状态
100
+ $hy-border-line: var(--hy-border-line, 1rpx solid #c2c2c4) !default;