hy-app 0.5.1 → 0.5.3

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 (39) hide show
  1. package/components/hy-action-sheet/index.scss +0 -5
  2. package/components/hy-back-top/hy-back-top.vue +10 -9
  3. package/components/hy-back-top/props.ts +5 -3
  4. package/components/hy-badge/hy-badge.vue +2 -1
  5. package/components/hy-badge/props.ts +5 -3
  6. package/components/hy-button/hy-button.vue +5 -5
  7. package/components/hy-button/index.scss +9 -0
  8. package/components/hy-button/props.ts +11 -6
  9. package/components/hy-coupon/hy-coupon.vue +159 -167
  10. package/components/hy-coupon/index.scss +130 -516
  11. package/components/hy-coupon/props.ts +98 -127
  12. package/components/hy-coupon/typing.d.ts +147 -146
  13. package/components/hy-folding-panel-item/hy-folding-panel-item.vue +1 -3
  14. package/components/hy-folding-panel-item/index.scss +0 -8
  15. package/components/hy-form-group/hy-form-group.vue +308 -511
  16. package/components/hy-form-group/index.scss +0 -33
  17. package/components/hy-form-group/props.ts +103 -13
  18. package/components/hy-form-group/typing.d.ts +0 -77
  19. package/components/hy-form-item/hy-form-item.vue +3 -3
  20. package/components/hy-input/hy-input.vue +16 -10
  21. package/components/hy-input/index.scss +4 -0
  22. package/components/hy-input/props.ts +2 -2
  23. package/components/hy-notice-bar/hy-column-notice.vue +63 -70
  24. package/components/hy-notice-bar/hy-row-notice.vue +92 -110
  25. package/components/hy-notice-bar/index.scss +2 -4
  26. package/components/hy-notice-bar/props.ts +4 -1
  27. package/components/hy-qrcode/hy-qrcode.vue +1 -1
  28. package/components/hy-qrcode/index.scss +1 -0
  29. package/components/hy-qrcode/qrcode.js +1208 -1402
  30. package/components/hy-rate/hy-rate.vue +0 -1
  31. package/components/hy-read-more/hy-read-more.vue +1 -1
  32. package/components/hy-textarea/hy-textarea.vue +1 -1
  33. package/components/hy-textarea/index.scss +8 -7
  34. package/components/hy-toast/index.scss +2 -7
  35. package/libs/css/common.scss +0 -5
  36. package/libs/typing/modules/form.ts +159 -163
  37. package/package.json +2 -2
  38. package/web-types.json +1 -1
  39. package/components/hy-coupon/README.md +0 -133
@@ -1,33 +0,0 @@
1
- @use "../../libs/css/theme" as *;
2
- @use "../../libs/css/mixin.scss" as *;
3
-
4
-
5
- @include b(form) {
6
- @include m(item) {
7
- color: $hy-text-color;
8
- display: flex;
9
- //align-items: center;
10
- margin-bottom: $hy-border-margin-padding-lg;
11
- padding-bottom: $hy-border-margin-padding-sm;
12
- &__label {
13
- padding: $hy-border-margin-padding-base 0;
14
- }
15
- &__container {
16
- flex: 1;
17
- display: flex;
18
- flex-direction: column;
19
- &-content {
20
- flex: 1;
21
- display: flex;
22
- align-items: center;
23
- .flex {
24
- flex: 1;
25
- }
26
- }
27
- &-warning {
28
- color: $hy-error;
29
- font-size: $hy-font-size-sm;
30
- }
31
- }
32
- }
33
- }
@@ -1,15 +1,105 @@
1
- import type IProps from "./typing";
1
+ import type { FormColumnsType } from '../../libs'
2
+ import type HyInputProps from '../hy-input/typing'
3
+ import type HyTextareaProps from '../hy-textarea/typing'
4
+ import type HySwitchProps from '../hy-switch/typing'
5
+ import type HyPickerProps from '../hy-picker/typing'
6
+ import type HyRadioProps from '../hy-radio/typing'
7
+ import type HyCheckButtonProps from '../hy-check-button/typing'
8
+ import type { PropType } from 'vue'
2
9
 
3
- const defaultProps: IProps = {
4
- labelPosition: "left",
5
- labelWidth: "auto",
6
- labelAlign: "left",
7
- symbol: false,
8
- borderBottom: false,
9
- right: false,
10
- itemHeight: 40,
11
- columns: [],
12
- formData: {},
13
- };
10
+ const formGroupProps = {
11
+ /**
12
+ * 表单域提示文字的位置
13
+ * @values left, top
14
+ * */
15
+ labelPosition: {
16
+ type: String,
17
+ default: 'left'
18
+ },
19
+ /**
20
+ * label宽度
21
+ * */
22
+ labelWidth: {
23
+ type: [String, Number],
24
+ default: 'auto'
25
+ },
26
+ /**
27
+ * 是否右对齐
28
+ * */
29
+ right: {
30
+ type: Boolean,
31
+ default: false
32
+ },
33
+ /**
34
+ * label字体的对齐方式
35
+ * @values left,center,right
36
+ * */
37
+ labelAlign: {
38
+ type: String,
39
+ default: 'left'
40
+ },
41
+ /**
42
+ * 显示底部下划线
43
+ * */
44
+ border: {
45
+ type: Boolean,
46
+ default: false
47
+ },
48
+ /**
49
+ * 是否全部禁用
50
+ * */
51
+ disabled: {
52
+ type: Boolean,
53
+ default: false
54
+ },
55
+ /**
56
+ * 输入框属性api集合
57
+ * */
58
+ input: {
59
+ type: Object as PropType<Partial<HyInputProps>>
60
+ },
61
+ /**
62
+ * 文本域属性api集合
63
+ * */
64
+ textarea: {
65
+ type: Array as PropType<Partial<HyTextareaProps>>
66
+ },
67
+ /**
68
+ * 选择器属性api集合
69
+ * */
70
+ picker: {
71
+ type: Array as PropType<Partial<HyPickerProps>>
72
+ },
73
+ /**
74
+ * 开关属性api集合
75
+ * */
76
+ switchItem: {
77
+ type: Array as PropType<Partial<HySwitchProps>>
78
+ },
79
+ /**
80
+ * 单选属性api集合
81
+ * */
82
+ radio: {
83
+ type: Array as PropType<Partial<HyRadioProps>>
84
+ },
85
+ /**
86
+ * 选择按钮属性api集合
87
+ * */
88
+ checkButton: {
89
+ type: Array as PropType<Partial<HyCheckButtonProps>>
90
+ },
91
+ /**
92
+ * 表单配置
93
+ * */
94
+ columns: {
95
+ type: Array as PropType<FormColumnsType[]>
96
+ },
97
+ /**
98
+ * 表单值
99
+ * */
100
+ formData: {
101
+ type: Object as PropType<Record<string, any>>
102
+ }
103
+ }
14
104
 
15
- export default defaultProps;
105
+ export default formGroupProps
@@ -1,77 +0,0 @@
1
- import type { FormColumnsType } from '../../libs'
2
- import type HyInputProps from '../hy-input/typing'
3
- import type HyTextareaProps from '../hy-textarea/typing'
4
- import type HySwitchProps from '../hy-switch/typing'
5
- import type HyPickerProps from '../hy-picker/typing'
6
- import type HyRadioProps from '../hy-radio/typing'
7
- import type HyCheckButtonProps from '../hy-check-button/typing'
8
-
9
- export default interface HyFormProps {
10
- /**
11
- * @description 表单域提示文字的位置
12
- * left - 左侧
13
- * top - 上方
14
- * */
15
- labelPosition?: 'left' | 'top'
16
- /**
17
- * @description label宽度
18
- * 数字 - 固定值
19
- * auto - 自适应
20
- * */
21
- labelWidth?: string | number
22
- /**
23
- * @description 是否右对齐
24
- * */
25
- right?: boolean
26
- /**
27
- * @description label字体的对齐方式
28
- * left - 左对齐
29
- * center - 中间对齐
30
- * right - 右对齐
31
- * */
32
- labelAlign?: HyApp.RowCenterType
33
- /**
34
- * @description 显示冒号符号
35
- * */
36
- symbol?: boolean
37
- /**
38
- * @description 显示底部下划线
39
- * */
40
- borderBottom?: boolean
41
- /**
42
- * @description 当行内容高度
43
- * */
44
- itemHeight?: number | string
45
- /**
46
- * @description 输入框属性api集合
47
- * */
48
- input?: Partial<HyInputProps>
49
- /**
50
- * @description 文本域属性api集合
51
- * */
52
- textarea?: Partial<HyTextareaProps>
53
- /**
54
- * @description 选择器属性api集合
55
- * */
56
- picker?: Partial<HyPickerProps>
57
- /**
58
- * @description 开关属性api集合
59
- * */
60
- switchItem?: Partial<HySwitchProps>
61
- /**
62
- * @description 单选属性api集合
63
- * */
64
- radio?: Partial<HyRadioProps>
65
- /**
66
- * @description 选择按钮属性api集合
67
- * */
68
- checkButton?: Partial<HyCheckButtonProps>
69
- /**
70
- * @description 表单配置
71
- * */
72
- columns: FormColumnsType[]
73
- /**
74
- * @description 表单值
75
- * */
76
- formData: Record<string, any>
77
- }
@@ -1,10 +1,10 @@
1
1
  <template>
2
- <view class="hy-form-item" :class="[`hy-form-item--${labelPosition}`]">
2
+ <view class="hy-form-item" :class="[`hy-form-item--${labelPos}`]">
3
3
  <view v-if="label" class="hy-form-item__label" :style="labelStyle">
4
4
  <text v-if="isRequired" class="hy-form-item__label--required">*</text>
5
5
  {{ label }}
6
6
  </view>
7
- <view :class="['hy-form-item__content', formContext.border && 'hy-border__bottom']">
7
+ <view :class="['hy-form-item__content', formContext.border.value && 'hy-border__bottom']">
8
8
  <slot></slot>
9
9
  </view>
10
10
  <view v-if="errorMessage" class="hy-form-item__error">
@@ -98,7 +98,7 @@ const labelStyle = computed(() => {
98
98
  })
99
99
 
100
100
  // 标签位置
101
- const labelPosition = computed(() => {
101
+ const labelPos = computed(() => {
102
102
  return formContext?.labelPosition?.value || 'left'
103
103
  })
104
104
 
@@ -1,5 +1,8 @@
1
1
  <template>
2
- <view :class="['hy-input', inputClass]" :style="[wrapperStyle, borderStyle(focused)]">
2
+ <view
3
+ :class="['hy-input', inputClass, customClass]"
4
+ :style="[wrapperStyle, borderStyle(focused)]"
5
+ >
3
6
  <view class="hy-input__content">
4
7
  <view
5
8
  class="hy-input__content--prefix-icon"
@@ -7,7 +10,7 @@
7
10
  @tap.stop="onPrefix"
8
11
  >
9
12
  <slot v-if="$slots.prefix" name="prefix"></slot>
10
- <HyIcon
13
+ <hy-icon
11
14
  v-else
12
15
  :name="prefixIcon?.name"
13
16
  :size="prefixIcon?.size"
@@ -21,7 +24,7 @@
21
24
  :stop="prefixIcon?.stop"
22
25
  :round="prefixIcon?.round"
23
26
  :customStyle="prefixIcon?.customStyle"
24
- ></HyIcon>
27
+ ></hy-icon>
25
28
  </view>
26
29
  <view class="hy-input__content--field-wrapper" @tap="clickHandler">
27
30
  <!-- 根据uni-app的input组件文档,H5和APP中只要声明了password参数(无论true还是false),type均失效,此时
@@ -29,7 +32,10 @@
29
32
  -->
30
33
  <input
31
34
  ref="input-native"
32
- class="hy-input__content--field-wrapper__field"
35
+ :class="[
36
+ 'hy-input__content--field-wrapper__field',
37
+ disabled && 'hy-input__disabled-text'
38
+ ]"
33
39
  :style="[inputStyle]"
34
40
  :type="type"
35
41
  :focus="focus"
@@ -58,12 +64,12 @@
58
64
  />
59
65
  </view>
60
66
  <view class="hy-input__content--clear" v-if="isShowClear" @tap.stop="onClear">
61
- <HyIcon
67
+ <hy-icon
62
68
  :name="IconConfig.CLOSE"
63
69
  size="11"
64
70
  color="#ffffff"
65
71
  :customStyle="{ lineHeight: '12px' }"
66
- ></HyIcon>
72
+ ></hy-icon>
67
73
  </view>
68
74
  <view
69
75
  class="hy-input__content--subfix-icon"
@@ -71,7 +77,7 @@
71
77
  @tap.stop="onSuffix"
72
78
  >
73
79
  <slot v-if="$slots.suffix" name="suffix"></slot>
74
- <HyIcon
80
+ <hy-icon
75
81
  v-else
76
82
  :name="suffixIcon?.name"
77
83
  :size="suffixIcon?.size"
@@ -85,7 +91,7 @@
85
91
  :stop="suffixIcon?.stop"
86
92
  :round="suffixIcon?.round"
87
93
  :customStyle="suffixIcon?.customStyle"
88
- ></HyIcon>
94
+ ></hy-icon>
89
95
  </view>
90
96
  </view>
91
97
  </view>
@@ -162,8 +168,8 @@ watch(
162
168
  * @description 是否显示清除控件
163
169
  * */
164
170
  const isShowClear = computed(() => {
165
- const { clearable, readonly } = props
166
- return clearable && !readonly && innerValue.value !== ''
171
+ const { clearable, readonly, disabled } = props
172
+ return clearable && !readonly && !disabled && innerValue.value !== ''
167
173
  })
168
174
  /**
169
175
  * @description 组件的类名
@@ -18,6 +18,10 @@
18
18
  :deep(.hy-icon) {
19
19
  color: $hy-text-color--disabled;
20
20
  }
21
+
22
+ &-text {
23
+ color: $hy-text-color--disabled !important;
24
+ }
21
25
  }
22
26
 
23
27
  @include e(no-radius){
@@ -151,7 +151,7 @@ const inputProps = {
151
151
  * @values surround,bottom,none
152
152
  * */
153
153
  border: {
154
- type: String as PropType<HyApp.BorderType>,
154
+ type: String,
155
155
  default: 'surround'
156
156
  },
157
157
  /** 是否只读,与disabled不同之处在于disabled会置灰组件,而readonly则不会 */
@@ -164,7 +164,7 @@ const inputProps = {
164
164
  * @values circle,square
165
165
  * */
166
166
  shape: {
167
- type: String as PropType<HyApp.ShapeType>,
167
+ type: String,
168
168
  default: 'square'
169
169
  },
170
170
  /** 是否忽略组件内对文本合成系统事件的处理 */
@@ -1,101 +1,94 @@
1
1
  <template>
2
- <view class="hy-notice" @tap="clickHandler">
3
- <slot name="icon">
4
- <view class="hy-notice__left-icon" v-if="icon">
5
- <HyIcon :name="icon" :color="color" size="19"></HyIcon>
6
- <!-- <HyIcon :name="icon" :color="color" size="19"></HyIcon>-->
7
- </view>
8
- </slot>
9
- <swiper
10
- :disable-touch="disableTouch"
11
- :vertical="!step"
12
- :circular="true"
13
- :interval="duration"
14
- :autoplay="true"
15
- class="hy-notice__swiper"
16
- @change="noticeChange"
17
- >
18
- <swiper-item
19
- v-for="(item, index) in text"
20
- :key="index"
21
- class="hy-notice__swiper--item"
22
- :style="{ justifyContent: justifyContent }"
23
- >
24
- <text class="hy-notice__swiper--item__text" :style="[textStyle]">{{
25
- item
26
- }}</text>
27
- </swiper-item>
28
- </swiper>
29
- <view
30
- class="hy-notice__right-icon"
31
- v-if="['link', 'closable'].includes(mode)"
32
- >
33
- <HyIcon
34
- v-if="mode === 'link'"
35
- :name="IconConfig.RIGHT"
36
- :size="17"
37
- :color="color"
38
- ></HyIcon>
39
- <HyIcon
40
- v-if="mode === 'closable'"
41
- :name="IconConfig.CLOSE"
42
- :size="16"
43
- :color="color"
44
- @click="close"
45
- ></HyIcon>
2
+ <view class="hy-notice" @tap="clickHandler">
3
+ <slot name="icon">
4
+ <view class="hy-notice__left-icon" v-if="icon">
5
+ <hy-icon :name="icon" :color="color" size="19"></hy-icon>
6
+ </view>
7
+ </slot>
8
+ <swiper
9
+ :disable-touch="disableTouch"
10
+ :vertical="!step"
11
+ :circular="true"
12
+ :interval="duration"
13
+ :autoplay="true"
14
+ class="hy-notice__swiper"
15
+ @change="noticeChange"
16
+ >
17
+ <swiper-item
18
+ v-for="(item, index) in text"
19
+ :key="index"
20
+ class="hy-notice__swiper--item"
21
+ :style="{ justifyContent: justifyContent }"
22
+ >
23
+ <text class="hy-notice__swiper--item__text" :style="[textStyle]">{{ item }}</text>
24
+ </swiper-item>
25
+ </swiper>
26
+ <view class="hy-notice__right-icon" v-if="['link', 'closable'].includes(mode)">
27
+ <hy-icon
28
+ v-if="mode === 'link'"
29
+ :name="IconConfig.RIGHT"
30
+ :size="17"
31
+ :color="color"
32
+ ></hy-icon>
33
+ <hy-icon
34
+ v-if="mode === 'closable'"
35
+ :name="IconConfig.CLOSE"
36
+ :size="16"
37
+ :color="color"
38
+ @click="close"
39
+ ></hy-icon>
40
+ </view>
46
41
  </view>
47
- </view>
48
42
  </template>
49
43
 
50
44
  <script setup lang="ts">
51
- import { type CSSProperties, toRefs, computed, ref, watch } from "vue";
52
- import type IProps from "./typing";
53
- import defaultProps from "./props";
54
- import { addUnit, error, IconConfig } from "../../libs";
45
+ import { type CSSProperties, toRefs, computed, ref, watch } from 'vue'
46
+ import noticeBarProps from './props'
47
+ import { addUnit, error, IconConfig } from '../../libs'
55
48
 
56
49
  // 组件
57
- import HyIcon from "../hy-icon/hy-icon.vue";
50
+ import HyIcon from '../hy-icon/hy-icon.vue'
58
51
 
59
- const props = withDefaults(defineProps<IProps>(), defaultProps);
60
- const { text, fontSize, color } = toRefs(props);
61
- const emit = defineEmits(["click", "close"]);
52
+ const props = defineProps(noticeBarProps)
53
+ const { text, fontSize, color } = toRefs(props)
54
+ const emit = defineEmits(['click', 'close'])
62
55
 
63
- const index = ref(0);
56
+ const index = ref(0)
64
57
 
65
58
  watch(
66
- () => text.value,
67
- (newVal) => !Array.isArray(newVal) && error("传入值必须是数组"),
68
- { immediate: true },
69
- );
59
+ () => text.value,
60
+ (newVal) => !Array.isArray(newVal) && error('传入值必须是数组'),
61
+ { immediate: true }
62
+ )
70
63
 
71
64
  /**
72
65
  * @description 文字内容的样式
73
66
  * */
74
67
  const textStyle = computed<CSSProperties>(() => {
75
- let style: CSSProperties = {};
76
- style.color = color.value;
77
- style.fontSize = addUnit(fontSize.value);
78
- return style;
79
- });
68
+ let style: CSSProperties = {}
69
+ style.color = color.value
70
+ style.fontSize = addUnit(fontSize.value)
71
+ return style
72
+ })
80
73
 
81
74
  const noticeChange = (e: any) => {
82
- index.value = e.detail.current;
83
- };
75
+ index.value = e.detail.current
76
+ }
84
77
 
85
78
  /**
86
79
  * @description 点击通告栏
87
80
  * */
88
81
  const clickHandler = (index: number) => {
89
- emit("click", index);
90
- };
82
+ emit('click', index)
83
+ }
91
84
  /**
92
85
  * @description 点击关闭按钮
93
86
  * */
94
87
  const close = () => {
95
- emit("close");
96
- };
88
+ emit('close')
89
+ }
97
90
  </script>
98
91
 
99
92
  <style lang="scss" scoped>
100
- @import "./index.scss";
93
+ @import './index.scss';
101
94
  </style>