hy-app 0.2.1 → 0.2.4

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 (78) hide show
  1. package/components/hy-button/index.scss +2 -0
  2. package/components/hy-cell/index.scss +0 -15
  3. package/components/hy-code-input/hy-code-input.vue +224 -0
  4. package/components/hy-code-input/index.scss +108 -0
  5. package/components/hy-code-input/props.ts +21 -0
  6. package/components/hy-code-input/typing.d.ts +65 -0
  7. package/components/hy-config-provider/hy-config-provider.vue +0 -1
  8. package/components/hy-config-provider/props.ts +1 -1
  9. package/components/hy-dropdown/props.ts +1 -1
  10. package/components/hy-dropdown-item/hy-dropdown-item.vue +2 -5
  11. package/components/hy-dropdown-item/index.scss +11 -13
  12. package/components/hy-grid/hy-grid.vue +7 -8
  13. package/components/hy-grid/props.ts +4 -0
  14. package/components/hy-grid/typing.d.ts +15 -0
  15. package/components/hy-icon/index.scss +2 -1
  16. package/components/hy-login/TheUserLogin.vue +0 -1
  17. package/components/hy-menu/hy-menu.vue +159 -0
  18. package/components/hy-menu/index.scss +58 -0
  19. package/components/hy-menu/props.ts +12 -0
  20. package/components/hy-menu/typing.d.ts +57 -0
  21. package/components/hy-modal/hy-modal.vue +5 -5
  22. package/components/hy-modal/index.scss +0 -6
  23. package/components/hy-notify/hy-notify.vue +169 -0
  24. package/components/hy-notify/index.scss +25 -0
  25. package/components/hy-notify/props.ts +14 -0
  26. package/components/hy-notify/typing.d.ts +44 -0
  27. package/components/hy-pagination/hy-pagination.vue +125 -0
  28. package/components/hy-pagination/index.scss +46 -0
  29. package/components/hy-pagination/props.ts +15 -0
  30. package/components/hy-pagination/typing.d.ts +44 -0
  31. package/components/hy-picker/index.scss +4 -0
  32. package/components/hy-scroll-list/index.scss +1 -1
  33. package/components/hy-search/index.scss +1 -2
  34. package/components/hy-signature/canvasHelper.ts +51 -0
  35. package/components/hy-signature/hy-signature.vue +656 -0
  36. package/components/hy-signature/index.scss +29 -0
  37. package/components/hy-signature/props.ts +29 -0
  38. package/components/hy-signature/typing.d.ts +181 -0
  39. package/components/hy-slider/index.scss +5 -1
  40. package/components/hy-subsection/hy-subsection.vue +15 -13
  41. package/components/hy-subsection/props.ts +2 -2
  42. package/components/hy-subsection/typing.d.ts +1 -1
  43. package/components/hy-swipe-action/hy-swipe-action.vue +288 -248
  44. package/components/hy-swipe-action/index.scss +34 -0
  45. package/components/hy-swipe-action/index.ts +34 -0
  46. package/components/hy-swipe-action/props.ts +15 -9
  47. package/components/hy-swipe-action/typing.d.ts +20 -22
  48. package/components/hy-swiper/index.scss +5 -0
  49. package/components/hy-tabBar/hy-tabBar.vue +96 -0
  50. package/components/hy-tabBar/index.scss +169 -0
  51. package/components/hy-tabBar/props.ts +13 -0
  52. package/components/hy-tabBar/typing.d.ts +54 -0
  53. package/components/hy-tabs/index.scss +2 -2
  54. package/components/hy-tag/index.scss +1 -1
  55. package/components/hy-text/index.scss +2 -2
  56. package/components/hy-textarea/hy-textarea.vue +5 -5
  57. package/components/hy-textarea/index.scss +5 -6
  58. package/components/hy-tooltip/index.scss +2 -2
  59. package/components/hy-upload/index.scss +1 -2
  60. package/components/hy-watermark/hy-watermark.vue +603 -0
  61. package/components/hy-watermark/index.scss +15 -0
  62. package/components/hy-watermark/props.ts +23 -0
  63. package/components/hy-watermark/typing.d.ts +76 -0
  64. package/components/index.ts +2 -2
  65. package/composables/index.ts +1 -0
  66. package/composables/useTouch.ts +48 -0
  67. package/index.ts +1 -1
  68. package/libs/css/mixin.scss +52 -13
  69. package/libs/css/vars.css +12 -2
  70. package/package.json +2 -2
  71. package/theme.scss +24 -46
  72. package/typing/modules/common.d.ts +1 -1
  73. package/utils/inspect.ts +20 -0
  74. package/utils/utils.ts +52 -22
  75. package/components/hy-swipe-action/index.wxs +0 -235
  76. package/components/hy-swipe-action/wxs.js +0 -15
  77. package/components/yk-tabbar/props.ts +0 -49
  78. package/components/yk-tabbar/yk-tabbar.vue +0 -224
@@ -0,0 +1,125 @@
1
+ <template>
2
+ <view
3
+ class="hy-pagination"
4
+ :style="customStyle"
5
+ v-if="!(hideIfOnePage && totalPageNum === 1)"
6
+ >
7
+ <view class="hy-pagination__content">
8
+ <hy-button
9
+ :plain="modelValue > 1"
10
+ type="info"
11
+ size="small"
12
+ :disabled="modelValue <= 1"
13
+ shape="circle"
14
+ class="hy-pagination__nav"
15
+ @click="sub"
16
+ >
17
+ <text v-if="!showIcon">{{ prevText }}</text>
18
+ <hy-icon
19
+ v-else
20
+ :class="`hy-pagination__left hy-pagination__icon ${modelValue <= 1 ? 'hy-pagination__nav--disabled' : 'hy-pagination__nav--active'}`"
21
+ :name="IconConfig.LEFT"
22
+ ></hy-icon>
23
+ </hy-button>
24
+ <view class="hy-pagination__size">
25
+ <text class="hy-pagination__current">{{ modelValue }}</text>
26
+ <text class="hy-pagination__separator">/</text>
27
+ <text>{{ totalPageNum }}</text>
28
+ </view>
29
+ <hy-button
30
+ :plain="modelValue < totalPageNum"
31
+ type="info"
32
+ size="small"
33
+ :disabled="modelValue >= totalPageNum"
34
+ shape="circle"
35
+ @click="add"
36
+ >
37
+ <text v-if="!showIcon">{{ nextText }}</text>
38
+ <hy-icon
39
+ v-else
40
+ :custom-class="`hy-pagination__icon ${modelValue >= totalPageNum ? 'hy-pagination__nav--disabled' : 'hy-pagination__nav--active'}`"
41
+ :name="IconConfig.RIGHT"
42
+ ></hy-icon>
43
+ </hy-button>
44
+ </view>
45
+ <view class="hy-pagination__message" v-if="showMessage">
46
+ <text>当前页:{{ modelValue }},</text>
47
+ <text v-if="total">当前数据:{{ total }},</text>
48
+ <text>分页大小:{{ pageSize }}</text>
49
+ </view>
50
+ </view>
51
+ </template>
52
+
53
+ <script lang="ts">
54
+ export default {
55
+ name: "hy-pagination",
56
+ options: {
57
+ virtualHost: true,
58
+ addGlobalClass: true,
59
+ styleIsolation: "shared",
60
+ },
61
+ };
62
+ </script>
63
+
64
+ <script lang="ts" setup>
65
+ import HyIcon from "../hy-icon/hy-icon.vue";
66
+ import HyButton from "../hy-button/hy-button.vue";
67
+ import { ref, toRefs, watch } from "vue";
68
+ import type IProps from "./typing";
69
+ import defaultProps from "./props";
70
+ import { IconConfig } from "hy-app";
71
+
72
+ const props = withDefaults(defineProps<IProps>(), defaultProps);
73
+ const { pageSize, totalPage } = toRefs(props);
74
+ const emit = defineEmits(["change", "update:modelValue"]);
75
+
76
+ const totalPageNum = ref<number>(0); // 总页数
77
+
78
+ watch(
79
+ () => totalPage.value,
80
+ (newValue) => {
81
+ if (!totalPageNum.value && newValue) {
82
+ totalPageNum.value = totalPageNum.value;
83
+ }
84
+ },
85
+ { immediate: true, deep: true },
86
+ );
87
+
88
+ watch(
89
+ () => props.total,
90
+ () => {
91
+ updateTotalPage();
92
+ },
93
+ { immediate: true, deep: true },
94
+ );
95
+
96
+ /**
97
+ * @description 加数
98
+ * */
99
+ const add = () => {
100
+ const { modelValue } = props;
101
+ if (modelValue > totalPageNum.value - 1) {
102
+ return;
103
+ }
104
+ emit("change", { value: modelValue + 1 });
105
+ emit("update:modelValue", modelValue + 1);
106
+ };
107
+
108
+ const sub = () => {
109
+ const { modelValue } = props;
110
+ if (modelValue < 2) {
111
+ return;
112
+ }
113
+ emit("change", { value: modelValue - 1 });
114
+ emit("update:modelValue", modelValue - 1);
115
+ };
116
+
117
+ function updateTotalPage() {
118
+ const { total, pageSize } = props;
119
+ totalPageNum.value = Math.ceil(total / pageSize);
120
+ }
121
+ </script>
122
+
123
+ <style lang="scss" scoped>
124
+ @import "./index.scss";
125
+ </style>
@@ -0,0 +1,46 @@
1
+ @use "../../theme.scss" as *;
2
+ @use "../../libs/css/mixin.scss" as *;
3
+
4
+
5
+ @include b(pagination) {
6
+ user-select: none;
7
+
8
+ //@include edeep(icon) {
9
+ // font-size: $-pagination-icon-size;
10
+ //}
11
+
12
+ @include e(content) {
13
+ display: flex;
14
+ justify-content: flex-start;
15
+ align-items: center;
16
+ padding: $hy-border-margin-padding-base;
17
+ }
18
+ @include e(message) {
19
+ text-align: center;
20
+ font-size: $hy-font-size-sm;
21
+ padding: 1px 0 16px 0;
22
+ }
23
+ &__nav {
24
+ min-width: 60px;
25
+ @include m(active){
26
+ color: rgba(0,0,0,0.65)
27
+ }
28
+ @include m(disabled){
29
+ color: rgba(0,0,0,0.15)
30
+ }
31
+ }
32
+ @include e(size){
33
+ flex: 1;
34
+ text-align: center;
35
+ font-size: $hy-font-size-sm;
36
+ }
37
+ @include e(separator){
38
+ padding: 0 4px;
39
+ }
40
+ &__left {
41
+ display: inline-block;
42
+ }
43
+ @include e(current){
44
+ color: $hy-primary;
45
+ }
46
+ }
@@ -0,0 +1,15 @@
1
+ import type IProps from "./typing";
2
+
3
+ const defaultProps: IProps = {
4
+ modelValue: 1,
5
+ totalPage: 1,
6
+ showIcon: false,
7
+ showMessage: false,
8
+ total: 0,
9
+ pageSize: 10,
10
+ prevText: "上一页",
11
+ nextText: "下一页",
12
+ hideIfOnePage: true,
13
+ };
14
+
15
+ export default defaultProps;
@@ -0,0 +1,44 @@
1
+ import type { CSSProperties } from "vue";
2
+
3
+ export default interface HyPaginationProps {
4
+ /**
5
+ * @description 当前页
6
+ */
7
+ modelValue: number;
8
+ /**
9
+ * @description 总页数,如果有total,则优先使用total计算页数
10
+ */
11
+ totalPage?: number;
12
+ /**
13
+ * @description 是否展示分页为Icon图标
14
+ */
15
+ showIcon?: boolean;
16
+ /**
17
+ * @desc 是否展示总条数
18
+ */
19
+ showMessage?: boolean;
20
+ /**
21
+ * @description 总条数
22
+ */
23
+ total?: number;
24
+ /**
25
+ * @description 每页条数
26
+ */
27
+ pageSize?: number;
28
+ /**
29
+ * @description 上一页文本
30
+ */
31
+ prevText?: string;
32
+ /**
33
+ * @description 下一页文本
34
+ */
35
+ nextText?: string;
36
+ /**
37
+ * @description 总页数只有一页时是否隐藏
38
+ */
39
+ hideIfOnePage?: boolean;
40
+ /**
41
+ * @description 定义需要用到的外部样式
42
+ * */
43
+ customStyle?: CSSProperties;
44
+ }
@@ -37,6 +37,10 @@
37
37
  flex: 1;
38
38
  justify-content: center;
39
39
 
40
+ :deep(.uni-picker-view-indicator) {
41
+ background: $hy-background--hover;
42
+ }
43
+
40
44
  &__item {
41
45
  @include flex;
42
46
  justify-content: center;
@@ -30,7 +30,7 @@
30
30
  height: 4px;
31
31
  border-radius: $hy-border-radius-semicircle;
32
32
  overflow: hidden;
33
- background-color: var(--hy-theme-color--light, $hy-border-color);
33
+ background-color: $hy-background--empty;
34
34
 
35
35
  &__bar {
36
36
  width: 20px;
@@ -33,8 +33,7 @@ $hy-search-close-size: 20px !default;
33
33
  }
34
34
 
35
35
  &__label {
36
- color:
37
- $hy-light-color;
36
+ color: $hy-text-color;
38
37
  font-size: $hy-font-size-base;
39
38
  margin: 0 4px;
40
39
  }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * 适配 canvas 2d 上下文
3
+ * @param ctx canvas 2d 上下文
4
+ * @returns
5
+ */
6
+ export function canvas2dAdapter(
7
+ ctx: CanvasRenderingContext2D,
8
+ ): UniApp.CanvasContext {
9
+ return Object.assign(ctx, {
10
+ setFillStyle(color: string | CanvasGradient) {
11
+ ctx.fillStyle = color;
12
+ },
13
+ setStrokeStyle(color: string | CanvasGradient | CanvasPattern) {
14
+ ctx.strokeStyle = color;
15
+ },
16
+ setLineWidth(lineWidth: number) {
17
+ ctx.lineWidth = lineWidth;
18
+ },
19
+ setLineCap(lineCap: "butt" | "round" | "square") {
20
+ ctx.lineCap = lineCap;
21
+ },
22
+
23
+ setFontSize(font: string) {
24
+ ctx.font = font;
25
+ },
26
+ setGlobalAlpha(alpha: number) {
27
+ ctx.globalAlpha = alpha;
28
+ },
29
+ setLineJoin(lineJoin: "bevel" | "round" | "miter") {
30
+ ctx.lineJoin = lineJoin;
31
+ },
32
+ setTextAlign(align: "left" | "center" | "right") {
33
+ ctx.textAlign = align;
34
+ },
35
+ setMiterLimit(miterLimit: number) {
36
+ ctx.miterLimit = miterLimit;
37
+ },
38
+ setShadow(offsetX: number, offsetY: number, blur: number, color: string) {
39
+ ctx.shadowOffsetX = offsetX;
40
+ ctx.shadowOffsetY = offsetY;
41
+ ctx.shadowBlur = blur;
42
+ ctx.shadowColor = color;
43
+ },
44
+ setTextBaseline(textBaseline: "top" | "bottom" | "middle") {
45
+ ctx.textBaseline = textBaseline;
46
+ },
47
+ createCircularGradient() {},
48
+ draw() {},
49
+ addColorStop() {},
50
+ }) as unknown as UniApp.CanvasContext;
51
+ }