hy-app 0.3.5 → 0.3.7

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.
@@ -84,4 +84,9 @@
84
84
  @include m(hairline) {
85
85
  border-width: 0.5px;
86
86
  }
87
+ }
88
+
89
+ /* 去掉背景色 */
90
+ button {
91
+ background: transparent;
87
92
  }
@@ -1,7 +1,6 @@
1
- import type { HyButtonProps } from './typing'
2
- import { HyApp } from 'hy-app/typing/modules/common'
3
- import type { CSSProperties, PropType } from 'vue'
4
- import HyIconProps from '@/package/components/hy-icon/typing'
1
+ import type { HyButtonProps } from "./typing";
2
+ import type { CSSProperties, PropType } from "vue";
3
+ import type HyIconProps from "@/package/components/hy-icon/typing";
5
4
 
6
5
  export const defaultProps = {
7
6
  /** 是否显示按钮的细边框 */
@@ -12,20 +11,21 @@ export const defaultProps = {
12
11
  /** 按钮的预置样式 */
13
12
  type: {
14
13
  type: String as PropType<HyApp.ThemeType>,
15
- default: 'primary',
16
- validator: (v) => ['info', 'primary', 'error', 'warning', 'success'].includes(v),
14
+ default: "primary",
15
+ validator: (v) =>
16
+ ["info", "primary", "error", "warning", "success"].includes(v),
17
17
  },
18
18
  /** 按钮尺寸 */
19
19
  size: {
20
- type: String as PropType<HyApp.SizeType | 'mini'>,
21
- default: 'medium',
22
- validator: (v) => ['large', 'medium', 'small', 'mini'].includes(v),
20
+ type: String as PropType<HyApp.SizeType | "mini">,
21
+ default: "medium",
22
+ validator: (v) => ["large", "medium", "small", "mini"].includes(v),
23
23
  },
24
24
  /** 按钮形状 */
25
25
  shape: {
26
26
  type: String as PropType<HyApp.ShapeType>,
27
- default: 'square',
28
- validator: (v) => ['circle', 'square'].includes(v),
27
+ default: "square",
28
+ validator: (v) => ["circle", "square"].includes(v),
29
29
  },
30
30
  /** 按钮是否镂空,背景色透明 */
31
31
  plain: {
@@ -45,13 +45,13 @@ export const defaultProps = {
45
45
  /** 加载中提示文字 */
46
46
  loadingText: {
47
47
  type: String,
48
- default: '',
48
+ default: "",
49
49
  },
50
50
  /** 加载状态图标类型 */
51
51
  loadingMode: {
52
52
  type: String as PropType<HyApp.LoadingMode>,
53
- default: 'spinner',
54
- validator: (v) => ['spinner', 'circle', 'semicircle'].includes(v),
53
+ default: "spinner",
54
+ validator: (v) => ["spinner", "circle", "semicircle"].includes(v),
55
55
  },
56
56
  /** 加载图标大小 */
57
57
  loadingSize: {
@@ -61,17 +61,17 @@ export const defaultProps = {
61
61
  /** 开放能力,具体请看uniapp稳定关于button组件部分说明 */
62
62
  openType: {
63
63
  type: String,
64
- default: '',
64
+ default: "",
65
65
  },
66
66
  /** 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件 */
67
67
  formType: {
68
68
  type: String,
69
- default: '',
69
+ default: "",
70
70
  },
71
71
  /** 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 (注:只微信小程序、QQ小程序有效) */
72
72
  appParameter: {
73
73
  type: String,
74
- default: '',
74
+ default: "",
75
75
  },
76
76
  /** 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效 */
77
77
  hoverStopPropagation: {
@@ -81,27 +81,27 @@ export const defaultProps = {
81
81
  /** 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文(默认 en ) */
82
82
  lang: {
83
83
  type: String,
84
- default: 'en',
84
+ default: "en",
85
85
  },
86
86
  /** 会话来源,openType="contact"时有效 */
87
87
  sessionFrom: {
88
88
  type: String,
89
- default: '',
89
+ default: "",
90
90
  },
91
91
  /** 会话内消息卡片标题,openType="contact"时有效 */
92
92
  sendMessageTitle: {
93
93
  type: String,
94
- default: '',
94
+ default: "",
95
95
  },
96
96
  /** 会话内消息卡片点击跳转小程序路径,openType="contact"时有效 */
97
97
  sendMessagePath: {
98
98
  type: String,
99
- default: '',
99
+ default: "",
100
100
  },
101
101
  /** 会话内消息卡片图片,openType="contact"时有效 */
102
102
  sendMessageImg: {
103
103
  type: String,
104
- default: '',
104
+ default: "",
105
105
  },
106
106
  /** 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,openType="contact"时有效 */
107
107
  showMessageCard: {
@@ -111,7 +111,7 @@ export const defaultProps = {
111
111
  /** 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取 */
112
112
  dataName: {
113
113
  type: String,
114
- default: '',
114
+ default: "",
115
115
  },
116
116
  /** 节流时间,一定时间内只能触发一次 */
117
117
  throttleTime: {
@@ -131,7 +131,7 @@ export const defaultProps = {
131
131
  /** 按钮文字,之所以通过props传入,是因为slot传入的话(注:nvue中无法控制文字的样式) */
132
132
  text: {
133
133
  type: String,
134
- default: '',
134
+ default: "",
135
135
  },
136
136
  /** 按钮图标api集合 */
137
137
  icon: {
@@ -141,7 +141,7 @@ export const defaultProps = {
141
141
  /** 按钮颜色,支持传入linear-gradient渐变色 */
142
142
  color: {
143
143
  type: String,
144
- default: '',
144
+ default: "",
145
145
  },
146
146
  /** 阻止事件冒泡 */
147
147
  stop: {
@@ -156,4 +156,4 @@ export const defaultProps = {
156
156
  customClass: {
157
157
  type: String,
158
158
  },
159
- } as const
159
+ } as const;
@@ -60,7 +60,7 @@
60
60
  class="hy-card__foot"
61
61
  @tap="footClick"
62
62
  :style="[
63
- { padding: $slots.foot ? addUnit(paddingFoot || padding) : 0 },
63
+ { padding: $slots.footer ? addUnit(paddingFoot || padding) : 0 },
64
64
  footStyle,
65
65
  ]"
66
66
  :class="{
@@ -134,7 +134,7 @@ const props = defineProps({
134
134
  /** 卡片与屏幕两边和上下元素的间距,需带单位,如"30px 20px" */
135
135
  margin: {
136
136
  type: String,
137
- default: "15px",
137
+ default: "10px",
138
138
  },
139
139
  /** 卡片整体的圆角值,单位px */
140
140
  borderRadius: {
@@ -1,6 +1,6 @@
1
1
  import type { IEmptyIcon } from "./typing";
2
2
 
3
- const url = "https://registry.npmmirror.com/wot-design-uni-assets/*/files/";
3
+ const url = "https://registry.npmmirror.com/wot-design-uni-assets/1.0.4/files/";
4
4
 
5
5
  const emptyIcon: IEmptyIcon = {
6
6
  content: {
@@ -11,7 +11,6 @@
11
11
  justify-content: center;
12
12
  align-items: center;
13
13
  flex-direction: column;
14
- background: $hy-background;
15
14
  @include m(description) {
16
15
  width: 70%;
17
16
  text-align: center;
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view :class="cls" :style="style">
2
+ <view :class="flexClass" :style="flexStyle">
3
3
  <slot />
4
4
  </view>
5
5
  </template>
@@ -16,7 +16,7 @@ export default {
16
16
  </script>
17
17
 
18
18
  <script setup lang="ts">
19
- import { computed } from "vue";
19
+ import { computed, type CSSProperties } from "vue";
20
20
  import type { PropType } from "vue";
21
21
  import type { FlexAlign, FlexDirection, FlexJustify, FlexWrap } from "./typing";
22
22
  import { addUnit, isArray } from "../../utils";
@@ -73,13 +73,24 @@ const props = defineProps({
73
73
  type: [String, Number],
74
74
  default: "auto",
75
75
  },
76
+ /** 定义需要用到的外部样式 */
77
+ customStyle: {
78
+ type: Object as PropType<CSSProperties>,
79
+ default: () => {},
80
+ },
81
+ /** 自定义外部类名 */
82
+ customClass: String,
76
83
  });
77
84
 
78
85
  // 计算 class
79
- const cls = computed(() => ["hy-flex", props.vertical && "hy-flex--vertical"]);
86
+ const flexClass = computed(() => [
87
+ "hy-flex",
88
+ props.customClass,
89
+ props.vertical && "hy-flex--vertical",
90
+ ]);
80
91
 
81
92
  // 计算 style
82
- const style = computed(() => {
93
+ const flexStyle = computed(() => {
83
94
  const gap = isArray(props.gap) ? props.gap : [props.gap, props.gap];
84
95
  const [rowGap, colGap] = gap.map((v) => addUnit(v));
85
96
 
@@ -92,6 +103,7 @@ const style = computed(() => {
92
103
  "flex-basis": props.basis,
93
104
  "row-gap": colGap,
94
105
  "column-gap": rowGap,
106
+ ...props.customStyle,
95
107
  };
96
108
  });
97
109
  </script>
@@ -64,7 +64,7 @@ defineOptions({});
64
64
  const props = defineProps({
65
65
  /** 数据列表 */
66
66
  list: {
67
- type: Array as PropType<GridItemVo[]>,
67
+ type: Array as PropType<(GridItemVo | string)[]>,
68
68
  default: () => [],
69
69
  },
70
70
  /** 自定义键值 */
@@ -32,9 +32,6 @@
32
32
  <text>{{ item.content }}</text>
33
33
  </view>
34
34
  </view>
35
-
36
- <!-- 用户自定义样式 -->
37
- <slot name="content" v-else />
38
35
  </view>
39
36
  </view>
40
37
  <hy-transition
@@ -156,7 +153,6 @@ const props = defineProps({
156
153
  /** 显示的内容,也可以通过 slot#content 传入 */
157
154
  content: {
158
155
  type: [String, Array] as PropType<string | any[]>,
159
- required: true,
160
156
  },
161
157
  /**
162
158
  * 指定 popover 的放置位置
@@ -1,15 +1,15 @@
1
1
  <template>
2
2
  <HyTransition mode="fade" :show="show">
3
3
  <view
4
- :class="['hy-warn', `hy-warn--${type}--${theme}`, customClass]"
4
+ :class="['hy-warn', `hy-warn--${type}__${theme}`, customClass]"
5
5
  @tap.stop="clickHandler"
6
6
  :style="customStyle"
7
7
  >
8
- <view class="hy-warn__icon--left" v-if="showIcon">
8
+ <view class="hy-warn--icon__left" v-if="showIcon">
9
9
  <HyIcon :name="iconName(type)" size="21" :color="iconColor"></HyIcon>
10
10
  </view>
11
11
  <view
12
- class="hy-warn__content"
12
+ class="hy-warn--content"
13
13
  :style="[
14
14
  {
15
15
  paddingRight: closable ? '20px' : 0,
@@ -17,7 +17,7 @@
17
17
  ]"
18
18
  >
19
19
  <text
20
- class="hy-warn__content__title"
20
+ class="hy-warn--content__title"
21
21
  v-if="title"
22
22
  :style="[
23
23
  {
@@ -27,14 +27,14 @@
27
27
  ]"
28
28
  :class="[
29
29
  theme === 'dark'
30
- ? 'hy-warn__text--dark'
31
- : `hy-warn__text--${type}--light`,
30
+ ? 'hy-warn--text__dark'
31
+ : `hy-warn--text__${type}--light`,
32
32
  ]"
33
33
  >
34
34
  {{ title }}
35
35
  </text>
36
36
  <text
37
- class="hy-warn__content__desc"
37
+ class="hy-warn--content__desc"
38
38
  v-if="description"
39
39
  :style="[
40
40
  {
@@ -44,14 +44,17 @@
44
44
  ]"
45
45
  :class="[
46
46
  theme === 'dark'
47
- ? 'hy-warn__text--dark'
48
- : `hy-warn__text--${type}--light`,
47
+ ? 'hy-warn--text__dark'
48
+ : `hy-warn--text__${type}--light`,
49
49
  ]"
50
50
  >
51
51
  {{ description }}
52
52
  </text>
53
53
  </view>
54
- <view class="hy-warn__close" v-if="closable" @tap.stop="closeHandler">
54
+ <view class="hy-warn--right" v-if="$slots.right">
55
+ <slot name="right"></slot>
56
+ </view>
57
+ <view class="hy-warn--close" v-if="closable" @tap.stop="closeHandler">
55
58
  <HyIcon :name="IconConfig.CLOSE" :color="iconColor" size="15"></HyIcon>
56
59
  </view>
57
60
  </view>
@@ -111,8 +114,8 @@ const props = defineProps({
111
114
  },
112
115
  /** 显示的暗色或者亮色 */
113
116
  theme: {
114
- type: String,
115
- default: "light",
117
+ type: String as PropType<HyApp.DarkModeType>,
118
+ default: "dark",
116
119
  },
117
120
  /** 文字是否居中 */
118
121
  center: {
@@ -29,37 +29,37 @@
29
29
  align-items: center;
30
30
  border-radius: $hy-border-radius-sm;
31
31
 
32
- &--primary--dark {
32
+ @include m(primary__dark) {
33
33
  background-color: $hy-primary;
34
34
  }
35
35
 
36
- &--primary--light {
36
+ @include m(primary__light) {
37
37
  background-color: $hy-primary-light;
38
- .hy-warn__icon--left {
38
+ .hy-warn--icon__left {
39
39
  :deep(.hy-icon) {
40
40
  color: $hy-primary;
41
41
  }
42
42
  }
43
43
  }
44
44
 
45
- &--error--dark {
45
+ @include m(error__dark) {
46
46
  background-color: $hy-error;
47
47
  }
48
48
 
49
- &--error--light {
49
+ @include m(error__light) {
50
50
  background-color: $hy-error-light;
51
- .hy-warn__icon--left {
51
+ .hy-warn--icon__left {
52
52
  :deep(.hy-icon) {
53
53
  color: $hy-error;
54
54
  }
55
55
  }
56
56
  }
57
57
 
58
- &--success--dark {
58
+ @include m(success__dark) {
59
59
  background-color: $hy-success;
60
60
  }
61
61
 
62
- &--success--light {
62
+ @include m(success__light) {
63
63
  background-color: $hy-success-light;
64
64
  .hy-warn__icon--left {
65
65
  :deep(.hy-icon) {
@@ -68,11 +68,11 @@
68
68
  }
69
69
  }
70
70
 
71
- &--warning--dark {
71
+ @include m(warning__dark) {
72
72
  background-color: $hy-warning;
73
73
  }
74
74
 
75
- &--warning--light {
75
+ @include m(warning__light) {
76
76
  background-color: $hy-warning-light;
77
77
  .hy-warn__icon--left {
78
78
  :deep(.hy-icon) {
@@ -81,72 +81,66 @@
81
81
  }
82
82
  }
83
83
 
84
- &--info--dark {
84
+ @include m(info__dark) {
85
85
  background-color: $hy-info;
86
86
  }
87
87
 
88
- &--info--light {
88
+ @include m(info__light) {
89
89
  background-color: $hy-info-light;
90
- .hy-warn__icon--left {
90
+ .hy-warn--icon__left {
91
91
  :deep(.hy-icon) {
92
92
  color: $hy-info;
93
93
  }
94
94
  }
95
95
  }
96
96
 
97
- &__icon {
97
+ @include m(icon) {
98
98
  margin-right: $hy-border-margin-padding-sm;
99
99
  }
100
100
 
101
- &__content {
101
+ @include m(content) {
102
102
  @include flex(column);
103
103
  flex: 1;
104
104
 
105
- &__title {
105
+ @include e(title) {
106
106
  font-size: 14px;
107
107
  font-weight: bold;
108
108
  color: #fff;
109
109
  margin-bottom: 2px;
110
110
  }
111
111
 
112
- &__desc {
112
+ @include e(desc) {
113
113
  font-size: 14px;
114
114
  flex-wrap: wrap;
115
115
  color: #fff;
116
116
  }
117
117
  }
118
118
 
119
- &__title--dark,
120
- &__desc--dark {
119
+ @include m([title__dark, desc__dark]) {
121
120
  color: #ffffff;
122
121
  }
123
122
 
124
- &__text--primary--light,
125
- &__text--primary--light {
123
+ @include m(text__primary--light) {
126
124
  color: $hy-primary;
127
125
  }
128
126
 
129
- &__text--success--light,
130
- &__text--success--light {
127
+ @include m(text__success--light) {
131
128
  color: $hy-success;
132
129
  }
133
130
 
134
- &__text--warning--light,
135
- &__text--warning--light {
131
+ @include m(text__primary--light) {
136
132
  color: $hy-warning;
137
133
  }
138
134
 
139
- &__text--error--light,
140
- &__text--error--light {
135
+ @include m(text__error--light) {
141
136
  color: $hy-error;
142
137
  }
143
138
 
144
- &__text--info--light,
145
- &__text--info--light {
139
+ @include m(text__info--light) {
146
140
  color: $hy-info;
147
141
  }
148
142
 
149
- &__close {
143
+ @include m(close) {
150
144
  position: absolute;
151
145
  top: 11px;
152
146
  right: 10px;
@@ -118,7 +118,7 @@ export function usePopover(visibleArrow = true) {
118
118
  left: `${offsetX}px`,
119
119
  bottom: `${verticalY}px`,
120
120
  },
121
- `left: ${(popWidth.value >= width.value ? width.value / 2 : popWidth.value - 25) - offsetX}px;`,
121
+ `left: ${(popWidth.value >= width.value ? width.value / 2 : popWidth.value + 25) - offsetX}px;`,
122
122
  ],
123
123
  ],
124
124
  [
@@ -128,7 +128,7 @@ export function usePopover(visibleArrow = true) {
128
128
  right: `${offsetX}px`,
129
129
  bottom: `${verticalY}px`,
130
130
  },
131
- `right: ${(popWidth.value >= width.value ? width.value / 2 : popWidth.value - 25) - offsetX}px; transform: translateX(50%);`,
131
+ `right: ${(popWidth.value >= width.value ? width.value / 2 : popWidth.value + 25) - offsetX}px; transform: translateX(50%);`,
132
132
  ],
133
133
  ],
134
134
  // 下
@@ -150,7 +150,7 @@ export function usePopover(visibleArrow = true) {
150
150
  left: `${offsetX}px`,
151
151
  top: `${verticalY}px`,
152
152
  },
153
- `left: ${(popWidth.value >= width.value ? width.value / 2 : popWidth.value - 25) - offsetX}px;`,
153
+ `left: ${(popWidth.value >= width.value ? width.value / 2 : popWidth.value + 25) - offsetX}px;`,
154
154
  ],
155
155
  ],
156
156
  [
@@ -160,7 +160,7 @@ export function usePopover(visibleArrow = true) {
160
160
  right: `${offsetX}px`,
161
161
  top: `${verticalY}px`,
162
162
  },
163
- `right: ${(popWidth.value >= width.value ? width.value / 2 : popWidth.value - 25) - offsetX}px; transform: translateX(50%);`,
163
+ `right: ${(popWidth.value >= width.value ? width.value / 2 : popWidth.value + 25) - offsetX}px; transform: translateX(50%);`,
164
164
  ],
165
165
  ],
166
166
  // 左
@@ -1,7 +1,5 @@
1
- /**
2
- * 辅助函数
3
- */
4
- @import 'config';
1
+ @use 'config';
2
+
5
3
  $default-theme: #4d80f0 !default; // 正常色
6
4
 
7
5
  /* 转换成字符串 */
@@ -16,7 +14,7 @@ $default-theme: #4d80f0 !default; // 正常色
16
14
  @function containsModifier($selector) {
17
15
  $selector: selectorToString($selector);
18
16
 
19
- @if str-index($selector, $modifierSeparator) {
17
+ @if str-index($selector, config.$modifier-separator) {
20
18
  @return true;
21
19
  }
22
20
 
File without changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hy-app",
3
- "version": "0.3.5",
4
- "description": "tag加上迷你大小",
3
+ "version": "0.3.7",
4
+ "description": "修改popover气泡的自定义内容定位不准确bug",
5
5
  "main": "./index.ts",
6
6
  "private": false,
7
7
  "scripts": {},
@@ -11,9 +11,6 @@
11
11
  "暗黑模式"
12
12
  ],
13
13
  "web-types": "./web-types.json",
14
- "author": "gaoxianhua",
15
- "license": "MIT",
16
- "dependencies": {
17
- "hy-app": "0.3.*"
18
- }
14
+ "author": "华玥作者",
15
+ "license": "MIT"
19
16
  }
@@ -1,6 +0,0 @@
1
- // HyButton.docgen.js
2
- const { buttonProps } = require('./props.ts')
3
-
4
- module.exports = {
5
- props: buttonProps,
6
- }