hy-app 0.6.9 → 0.7.1

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 (106) hide show
  1. package/attributes.json +1 -1
  2. package/components/hy-avatar/hy-avatar.vue +12 -5
  3. package/components/hy-avatar/props.ts +4 -2
  4. package/components/hy-avatar/typing.d.ts +8 -1
  5. package/components/hy-calendar/hy-calendar.vue +3 -2
  6. package/components/hy-calendar/month.vue +25 -5
  7. package/components/hy-calendar/props.ts +1 -1
  8. package/components/hy-calendar/typing.d.ts +9 -0
  9. package/components/hy-cascader/hy-cascader.vue +503 -0
  10. package/components/hy-cascader/index.scss +84 -0
  11. package/components/hy-cascader/props.ts +88 -0
  12. package/components/hy-cascader/typing.d.ts +34 -0
  13. package/components/hy-check-button/typing.d.ts +12 -7
  14. package/components/hy-code-input/hy-code-input.vue +33 -11
  15. package/components/hy-code-input/typing.d.ts +4 -0
  16. package/components/hy-config-provider/hy-config-provider.vue +58 -53
  17. package/components/hy-count-down/hy-count-down.vue +8 -8
  18. package/components/hy-count-down/typing.d.ts +16 -0
  19. package/components/hy-count-to/hy-count-to.vue +7 -7
  20. package/components/hy-count-to/typing.d.ts +24 -0
  21. package/components/hy-datetime-picker/props.ts +1 -1
  22. package/components/hy-datetime-picker/typing.d.ts +1 -1
  23. package/components/hy-dropdown/typing.d.ts +5 -0
  24. package/components/hy-dropdown-item/hy-dropdown-item.vue +1 -1
  25. package/components/hy-folding-panel/hy-folding-panel.vue +3 -3
  26. package/components/hy-folding-panel/typing.d.ts +23 -0
  27. package/components/hy-folding-panel-item/hy-folding-panel-item.vue +2 -2
  28. package/components/hy-folding-panel-item/typing.d.ts +21 -0
  29. package/components/hy-form/hy-form.vue +2 -2
  30. package/components/hy-form/typing.d.ts +37 -0
  31. package/components/hy-form-item/typing.d.ts +1 -1
  32. package/components/hy-grid/hy-grid.vue +12 -12
  33. package/components/hy-grid/index.scss +1 -2
  34. package/components/hy-grid/props.ts +7 -2
  35. package/components/hy-grid/typing.d.ts +1 -1
  36. package/components/hy-icon/typing.d.ts +52 -9
  37. package/components/hy-keyboard/constants.ts +83 -0
  38. package/components/hy-keyboard/hy-keyboard.vue +375 -0
  39. package/components/hy-keyboard/index.scss +73 -0
  40. package/components/hy-keyboard/key/index.scss +79 -0
  41. package/components/hy-keyboard/key/index.vue +91 -0
  42. package/components/hy-keyboard/key/types.ts +1 -0
  43. package/components/hy-keyboard/props.ts +108 -0
  44. package/components/hy-keyboard/typing.d.ts +18 -0
  45. package/components/hy-list/hy-list.vue +15 -13
  46. package/components/hy-list/props.ts +1 -1
  47. package/components/hy-modal/typing.d.ts +2 -2
  48. package/components/hy-notice-bar/hy-column-notice.vue +54 -94
  49. package/components/hy-notice-bar/hy-notice-bar.vue +128 -96
  50. package/components/hy-notice-bar/hy-row-notice.vue +89 -121
  51. package/components/hy-notice-bar/props.ts +86 -85
  52. package/components/hy-notify/hy-notify.vue +10 -10
  53. package/components/hy-notify/typing.d.ts +35 -0
  54. package/components/hy-number-step/hy-number-step.vue +370 -367
  55. package/components/hy-number-step/index.scss +1 -0
  56. package/components/hy-number-step/props.ts +1 -1
  57. package/components/hy-picker/hy-picker.vue +126 -149
  58. package/components/hy-picker/props.ts +4 -1
  59. package/components/hy-picker/typing.d.ts +22 -0
  60. package/components/hy-popover/hy-popover.vue +2 -2
  61. package/components/hy-popover/typing.d.ts +1 -1
  62. package/components/hy-popup/hy-popup.vue +1 -1
  63. package/components/hy-popup/index.scss +1 -0
  64. package/components/hy-price/hy-price.vue +52 -23
  65. package/components/hy-price/props.ts +54 -54
  66. package/components/hy-radio/props.ts +1 -1
  67. package/components/hy-radio/typing.d.ts +5 -1
  68. package/components/hy-rolling-num/typing.d.ts +1 -0
  69. package/components/hy-signature/hy-signature.vue +17 -17
  70. package/components/hy-signature/typing.d.ts +1 -1
  71. package/components/hy-skeleton/index.scss +17 -0
  72. package/components/hy-steps/hy-steps.vue +1 -1
  73. package/components/hy-submit-bar/typing.d.ts +3 -3
  74. package/components/hy-swipe-action/hy-swipe-action.vue +34 -15
  75. package/components/hy-swipe-action/index.scss +0 -1
  76. package/components/hy-switch/typing.d.ts +4 -0
  77. package/components/hy-tabbar/props.ts +2 -1
  78. package/components/hy-tabbar/typing.d.ts +5 -4
  79. package/components/hy-tabs/hy-tabs.vue +338 -336
  80. package/components/hy-tabs/index.scss +6 -6
  81. package/components/hy-tabs/typing.d.ts +41 -33
  82. package/components/hy-textarea/hy-textarea.vue +2 -2
  83. package/components/hy-textarea/typing.d.ts +4 -0
  84. package/components/hy-toast/hy-toast.vue +17 -9
  85. package/components/hy-toast/index.scss +1 -1
  86. package/components/hy-toast/typing.d.ts +56 -37
  87. package/components/hy-tooltip/hy-tooltip.vue +1 -1
  88. package/components/hy-tooltip/index.scss +1 -0
  89. package/components/hy-tooltip/props.ts +1 -1
  90. package/components/hy-upload/hy-upload.vue +16 -1
  91. package/components/hy-upload/index.scss +149 -144
  92. package/components/index.ts +6 -0
  93. package/global.d.ts +2 -0
  94. package/libs/api/http.ts +122 -119
  95. package/libs/config/icon.ts +442 -430
  96. package/libs/css/_function.scss +7 -13
  97. package/libs/css/iconfont.css +445 -441
  98. package/libs/css/theme.scss +3 -1
  99. package/libs/locale/lang/en-US.ts +4 -0
  100. package/libs/locale/lang/zh-CN.ts +4 -0
  101. package/libs/typing/index.ts +80 -0
  102. package/package.json +5 -2
  103. package/tags.json +1 -1
  104. package/web-types.json +1 -1
  105. package/components/hy-folding-panel/hy-folding-panel-group.vue +0 -163
  106. package/components/hy-qrcode/qrcode.js.bak +0 -1434
@@ -17,3 +17,26 @@ export interface IFoldingPanelGroupEmits {
17
17
  */
18
18
  (e: 'close', index: number | string): void
19
19
  }
20
+
21
+ /** HyFoldingPanel 组件实例暴露的方法 */
22
+ export interface IFoldingPanelExpose {
23
+ /**
24
+ * 打开指定索引的面板
25
+ * @param index 面板索引
26
+ */
27
+ open: (index: number | string) => void
28
+ /**
29
+ * 关闭所有面板
30
+ */
31
+ closeAll: () => void
32
+ /**
33
+ * 切换指定索引面板的状态
34
+ * @param index 面板索引
35
+ */
36
+ toggle: (index: number | string) => void
37
+ /**
38
+ * 关闭指定索引的面板
39
+ * @param index 面板索引
40
+ */
41
+ close: (index: number | string) => void
42
+ }
@@ -67,7 +67,7 @@ export default {
67
67
 
68
68
  <script setup lang="ts">
69
69
  import { ref, computed, inject, onMounted } from 'vue'
70
- import type { IFoldingPanelConfig, IFoldingPanelItemEmits } from './typing'
70
+ import type { IFoldingPanelConfig, IFoldingPanelItemEmits, IFoldingPanelItemExpose } from './typing'
71
71
  import { addUnit, IconConfig } from '../../libs'
72
72
  import foldingPanelItemProps from './props'
73
73
  // 组件
@@ -124,7 +124,7 @@ const handleClick = () => {
124
124
  }
125
125
 
126
126
  // 对外暴露的方法
127
- defineExpose({
127
+ defineExpose<IFoldingPanelItemExpose>({
128
128
  /**
129
129
  * 打开面板
130
130
  */
@@ -35,3 +35,24 @@ export interface IFoldingPanelItemEmits {
35
35
  */
36
36
  (e: 'child-click', index: number | string): void
37
37
  }
38
+
39
+ /** HyFoldingPanelItem 组件实例暴露的方法 */
40
+ export interface IFoldingPanelItemExpose {
41
+ /**
42
+ * 打开面板
43
+ */
44
+ open: () => void
45
+ /**
46
+ * 关闭面板
47
+ */
48
+ close: () => void
49
+ /**
50
+ * 切换面板状态
51
+ */
52
+ toggle: () => void
53
+ /**
54
+ * 获取当前展开状态
55
+ * @returns 当前展开状态
56
+ */
57
+ getExpanded: () => boolean
58
+ }
@@ -19,7 +19,7 @@ export default {
19
19
  import { provide, reactive, ref, toRefs } from 'vue'
20
20
  import { clearVal, isArray } from '../../libs'
21
21
  import formProps from './props'
22
- import type { IFormEmits } from './typing'
22
+ import type { IFormEmits, IFormExpose } from './typing'
23
23
 
24
24
  /**
25
25
  * 表单组件父组件,需要搭配hy-form-item
@@ -203,7 +203,7 @@ const submit = async () => {
203
203
  return false
204
204
  }
205
205
 
206
- defineExpose({
206
+ defineExpose<IFormExpose>({
207
207
  validate,
208
208
  resetFields,
209
209
  clearValidate,
@@ -1,3 +1,9 @@
1
+ import type { ExtractPropTypes } from 'vue'
2
+ import type formProps from './props'
3
+
4
+ export interface HyFormProps extends ExtractPropTypes<typeof formProps> {}
5
+ export type HyFormSimpleProps = HyFormProps
6
+
1
7
  export interface FormRule {
2
8
  /**
3
9
  * 是否必填
@@ -39,3 +45,34 @@ export interface IFormEmits {
39
45
  /** 表单校验 */
40
46
  (e: 'validate', valid: boolean, errors: AnyObject): void
41
47
  }
48
+
49
+ /** HyForm 组件实例暴露的方法和属性 */
50
+ export interface IFormExpose {
51
+ /**
52
+ * 验证所有表单字段
53
+ * @returns Promise,验证成功时 resolve,失败时 reject 并返回错误信息
54
+ */
55
+ validate: () => Promise<unknown>
56
+ /**
57
+ * 重置表单所有字段到初始值
58
+ */
59
+ resetFields: () => void
60
+ /**
61
+ * 清除表单验证错误
62
+ * @param fields 可选,指定要清除的字段名数组,不传则清除所有
63
+ */
64
+ clearValidate: (fields?: string[]) => void
65
+ /**
66
+ * 提交表单(会先执行验证)
67
+ * @returns Promise,验证成功时返回表单数据,失败时返回 false
68
+ */
69
+ submit: () => Promise<AnyObject | false>
70
+ /**
71
+ * 表单数据对象
72
+ */
73
+ formData: AnyObject
74
+ /**
75
+ * 表单错误信息
76
+ */
77
+ errors: Record<string, string>
78
+ }
@@ -1,4 +1,4 @@
1
- import HyFormSimpleProps, { type FormRule } from '../hy-form/typing'
1
+ import type { HyFormSimpleProps, FormRule } from '../../index'
2
2
  import type { ToRefs } from 'vue'
3
3
 
4
4
  export interface IFormContext extends ToRefs<HyFormSimpleProps> {
@@ -14,18 +14,18 @@
14
14
  :name="item[customKeys?.icon]"
15
15
  label-pos="bottom"
16
16
  :label="item[customKeys?.name]"
17
- :space="item?.iconConfig?.space || iconConfig?.space || 8"
18
- :color="item?.iconConfig?.color || iconConfig?.color"
19
- :size="item?.iconConfig?.size || iconConfig?.size || 30"
20
- :bold="item?.iconConfig?.bold || iconConfig?.bold"
21
- :customPrefix="item?.iconConfig?.customPrefix"
22
- :imgMode="item?.iconConfig?.imgMode || iconConfig?.imgMode"
23
- :width="item?.iconConfig?.width || iconConfig?.width"
24
- :height="item?.iconConfig?.height || iconConfig?.height"
25
- :top="item?.iconConfig?.top || iconConfig?.top"
26
- :stop="item?.iconConfig?.stop || iconConfig?.stop"
27
- :round="item?.iconConfig?.round || iconConfig?.round || 6"
28
- :customStyle="item?.iconConfig?.customStyle || iconConfig?.customStyle"
17
+ :space="item?.iconProps?.space || iconProps?.space || 8"
18
+ :color="item?.iconProps?.color || iconProps?.color"
19
+ :size="item?.iconProps?.size || iconProps?.size || size"
20
+ :bold="item?.iconProps?.bold || iconProps?.bold"
21
+ :customPrefix="item?.iconProps?.customPrefix"
22
+ :imgMode="item?.iconProps?.imgMode || iconProps?.imgMode"
23
+ :width="item?.iconProps?.width || iconProps?.width"
24
+ :height="item?.iconProps?.height || iconProps?.height"
25
+ :top="item?.iconProps?.top || iconProps?.top"
26
+ :stop="item?.iconProps?.stop || iconProps?.stop"
27
+ :round="item?.iconProps?.round || iconProps?.round || 6"
28
+ :customStyle="item?.iconProps?.customStyle || iconProps?.customStyle"
29
29
  ></hy-icon>
30
30
  </view>
31
31
  </template>
@@ -13,7 +13,6 @@
13
13
  /* #endif */
14
14
 
15
15
  @include e(item) {
16
- align-items: center;
17
16
  justify-content: center;
18
17
  position: relative;
19
18
  flex-direction: column;
@@ -24,9 +23,9 @@
24
23
  /* #endif */
25
24
 
26
25
  /* #ifdef MP */
27
- position: relative;
28
26
  float: left;
29
27
  /* #endif */
28
+ padding: $hy-border-margin-padding-base 0;
30
29
 
31
30
  // 只有当有 border 类时才显示边框
32
31
  @include m(border) {
@@ -21,6 +21,11 @@ const gridProps = {
21
21
  type: Number,
22
22
  default: 5
23
23
  },
24
+ /** 图标大小 */
25
+ size: {
26
+ type: [Number, String],
27
+ default: 44
28
+ },
24
29
  /** 是否显示宫格的边框 */
25
30
  border: {
26
31
  type: Boolean,
@@ -29,7 +34,7 @@ const gridProps = {
29
34
  /** 单个宫格高度 */
30
35
  itemHeight: {
31
36
  type: [Number, String],
32
- default: '80px'
37
+ default: '100%'
33
38
  },
34
39
  /**
35
40
  * 宫格对齐方式,表现为数量少的时候,靠左,居中,还是靠右
@@ -50,7 +55,7 @@ const gridProps = {
50
55
  default: 'transparent'
51
56
  },
52
57
  /** 图标属性api配置集合 */
53
- iconConfig: Object as PropType<HyIconProps>,
58
+ iconProps: Object as PropType<HyIconProps>,
54
59
  /** 定义需要用到的外部样式 */
55
60
  customStyle: Object as PropType<CSSProperties>,
56
61
  /** 自定义外部类名 */
@@ -12,7 +12,7 @@ export interface GridItemVo {
12
12
  /**
13
13
  * 图标属性api配置
14
14
  * */
15
- iconConfig?: Partial<HyIconProps>
15
+ iconProps?: Partial<HyIconProps>
16
16
  /**
17
17
  * 自定义内容键值对
18
18
  * */
@@ -1,9 +1,52 @@
1
- import type { ExtractPropTypes } from 'vue'
2
- import iconProps from './props'
3
-
4
- export interface HyIconProps extends ExtractPropTypes<typeof iconProps> {}
5
-
6
- export interface IIconEmits {
7
- /** 点击图标触发 */
8
- (e: 'click', index: string, e: Event): void
9
- }
1
+ import type { CSSProperties } from 'vue'
2
+
3
+ export interface HyIconProps {
4
+ /** 图标名称 */
5
+ name?: string
6
+ /** 图标颜色 */
7
+ color?: string
8
+ /** 图标字体大小,单位px */
9
+ size?: number | string
10
+ /** 是否显示粗体 */
11
+ bold?: boolean
12
+ /** 点击图标的时候传递事件出去的index(用于区分点击了哪一个) */
13
+ index?: string
14
+ /** 自定义扩展前缀,方便用户扩展自己的图标库 */
15
+ customPrefix?: string
16
+ /** 图标右侧的label文字 */
17
+ label?: string
18
+ /**
19
+ * label相对于图标的位置,只能right或bottom
20
+ * @values right,bottom
21
+ * */
22
+ labelPos?: string
23
+ /** label字体大小,单位px */
24
+ labelSize?: string
25
+ /** 图标右侧的label文字颜色 */
26
+ labelColor?: string
27
+ /** label与图标的距离,单位px */
28
+ space?: number | string
29
+ /** 图片的mode */
30
+ imgMode?: string
31
+ /** 显示图片小图标时的宽度 */
32
+ width?: string | number
33
+ /** 显示图片小图标时的高度 */
34
+ height?: string | number
35
+ /** 图标在垂直方向上的定位 用于解决某些情况下,让图标垂直居中的用途 */
36
+ top?: string | number
37
+ /** 是否阻止事件传播 */
38
+ stop?: boolean
39
+ /** 是否旋转 */
40
+ isRotate?: boolean
41
+ /** 图标圆角 */
42
+ round?: string | number
43
+ /** 定义需要用到的外部样式 */
44
+ customStyle?: CSSProperties
45
+ /** 自定义外部类名 */
46
+ customClass?: string
47
+ }
48
+
49
+ export interface IIconEmits {
50
+ /** 点击图标触发 */
51
+ (e: 'click', index: string, e: Event): void
52
+ }
@@ -0,0 +1,83 @@
1
+ /**
2
+ * 车牌号键盘-省份简称
3
+ */
4
+ export const CAR_KEYBOARD_AREAS = [
5
+ '京',
6
+ '沪',
7
+ '粤',
8
+ '津',
9
+ '冀',
10
+ '豫',
11
+ '云',
12
+ '辽',
13
+ '黑',
14
+ '湘',
15
+ '皖',
16
+ '鲁',
17
+ '苏',
18
+ '浙',
19
+ '赣',
20
+ '鄂',
21
+ '桂',
22
+ '甘',
23
+ '晋',
24
+ '陕',
25
+ '蒙',
26
+ '吉',
27
+ '闽',
28
+ '贵',
29
+ '渝',
30
+ '川',
31
+ '青',
32
+ '琼',
33
+ '宁',
34
+ '挂',
35
+ '藏',
36
+ '港',
37
+ '澳',
38
+ '新',
39
+ '使',
40
+ '学'
41
+ ]
42
+
43
+ /**
44
+ * 车牌号键盘-数字和字母(不包含I和O,因为车牌号规则中不使用这两个字母)
45
+ */
46
+ export const CAR_KEYBOARD_KEYS = [
47
+ 1,
48
+ 2,
49
+ 3,
50
+ 4,
51
+ 5,
52
+ 6,
53
+ 7,
54
+ 8,
55
+ 9,
56
+ 0,
57
+ 'Q',
58
+ 'W',
59
+ 'E',
60
+ 'R',
61
+ 'T',
62
+ 'Y',
63
+ 'U',
64
+ 'I',
65
+ 'O',
66
+ 'P',
67
+ 'A',
68
+ 'S',
69
+ 'D',
70
+ 'F',
71
+ 'G',
72
+ 'H',
73
+ 'J',
74
+ 'K',
75
+ 'L',
76
+ 'Z',
77
+ 'X',
78
+ 'C',
79
+ 'V',
80
+ 'B',
81
+ 'N',
82
+ 'M'
83
+ ]