hy-app 0.5.14 → 0.5.15

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.
@@ -1,7 +1,6 @@
1
1
  @use "../../libs/css/mixin" as *;
2
- @use "../../libs/css/iconfont.css" as *;
3
2
  @use "../../libs/css/theme" as *;
4
-
3
+ @use "../../libs/css/iconfont" as *;
5
4
 
6
5
  @include b(icon) {
7
6
  /* #ifndef APP-NVUE */
@@ -95,17 +95,6 @@ const indexItemStyles = computed(() => {
95
95
  height: addUnit(props.width),
96
96
  fontSize: addUnit(props.indexSize)
97
97
  } as CSSProperties
98
- console.log(
99
- props.indexList.reduce((styles: Record<string, CSSProperties>, item: IIndexItem) => {
100
- const isActive = props.modelValue === indexValue.value(item)
101
- styles[indexValue.value(item)] = {
102
- ...commonStyle,
103
- color: isActive ? props.activeIndexColor : props.indexColor,
104
- backgroundColor: isActive ? props.activeIndexBgColor : props.indexBgColor
105
- }
106
- return styles
107
- }, {})
108
- )
109
98
 
110
99
  // 为每个索引项创建样式对象并缓存
111
100
  return props.indexList.reduce((styles: Record<string, CSSProperties>, item: IIndexItem) => {
@@ -121,7 +110,6 @@ const indexItemStyles = computed(() => {
121
110
 
122
111
  // 获取索引项样式的便捷方法
123
112
  const getIndexItemStyle = (index: string) => {
124
- console.log(index, '===')
125
113
  return indexItemStyles.value[index] || {}
126
114
  }
127
115
 
@@ -51,7 +51,7 @@
51
51
  border-radius: 100px 100px 0 100px;
52
52
  text-align: center;
53
53
  color: #ffffff;
54
- background-color: #c9c9c9;
54
+ background-color: $hy-background--empty;
55
55
  transform: rotate(-45deg);
56
56
  display: flex;
57
57
  justify-content: center;
@@ -1,174 +1,174 @@
1
- <template>
2
- <hy-transition mode="slide-down" :customStyle="containerStyle" :show="open">
3
- <view
4
- :class="['hy-notify', `hy-notify--${tmpConfig?.type}`, customClass]"
5
- :style="[backgroundColor, customStyle]"
6
- >
7
- <hy-status-bar v-if="tmpConfig?.safeAreaInsetTop"></hy-status-bar>
8
- <view class="hy-notify__wrapper">
9
- <template v-if="['success', 'warning', 'error'].includes(tmpConfig.type)">
10
- <slot v-if="$slots.icon" name="icon"></slot>
11
- <hy-icon
12
- v-else
13
- :name="tmpConfig?.icon || icon"
14
- :color="tmpConfig?.color"
15
- :size="tmpConfig.fontSize"
16
- :customStyle="{ marginRight: '4px' }"
17
- ></hy-icon>
18
- </template>
19
- <text
20
- class="hy-notify__wrapper--text"
21
- :style="{
22
- fontSize: addUnit(tmpConfig?.fontSize),
23
- color: tmpConfig?.color
24
- }"
25
- >
26
- {{ tmpConfig?.message }}
27
- </text>
28
- </view>
29
- </view>
30
- </hy-transition>
31
- </template>
32
-
33
- <script lang="ts">
34
- export default {
35
- name: 'hy-notify',
36
- options: {
37
- addGlobalClass: true,
38
- virtualHost: true,
39
- styleIsolation: 'shared'
40
- }
41
- }
42
- </script>
43
-
44
- <script setup lang="ts">
45
- import type HyNotifyProps from './typing'
46
- import { computed, ref } from 'vue'
47
- import type { CSSProperties } from 'vue'
48
- import { addUnit, IconConfig } from '../../libs'
49
- import notifyProps from './props'
50
- // 组件
51
- import HyTransition from '../hy-transition/hy-transition.vue'
52
- import HyStatusBar from '../hy-status-bar/hy-status-bar.vue'
53
- import HyIcon from '../hy-icon/hy-icon.vue'
54
-
55
- /**
56
- * 一般用于页面顶部向下滑出一个提示,尔后自动收起的场景。
57
- * @displayName hy-notify
58
- */
59
- defineOptions({})
60
-
61
- const props = defineProps(notifyProps)
62
-
63
- const config = ref<HyNotifyProps>({
64
- // 到顶部的距离
65
- top: props.top,
66
- // type主题,primary,success,warning,error
67
- type: props.type,
68
- // 字体颜色
69
- color: props.color,
70
- // 背景颜色
71
- bgColor: props.bgColor,
72
- // 展示的文字内容
73
- message: props.message,
74
- // 展示时长,为0时不消失,单位ms
75
- duration: props.duration,
76
- // 字体大小
77
- fontSize: props.fontSize,
78
- // 是否留出顶部安全距离(状态栏高度)
79
- safeAreaInsetTop: props.safeAreaInsetTop
80
- })
81
- const tmpConfig = ref<HyNotifyProps>({})
82
- const open = ref(false)
83
- let timer: ReturnType<typeof setTimeout>
84
-
85
- /**
86
- * @description 容器样式
87
- * */
88
- const containerStyle = computed(() => {
89
- let top = 0
90
- if (tmpConfig.value.top === 0) {
91
- // #ifdef H5
92
- // H5端,导航栏为普通元素,需要将组件移动到导航栏的下边沿
93
- // H5的导航栏高度为44px
94
- top = 44
95
- // #endif
96
- }
97
- const style: CSSProperties = {
98
- top: addUnit(tmpConfig.value.top === 0 ? top : tmpConfig.value.top),
99
- // 因为组件底层为hy-transition组件,必须将其设置为fixed定位
100
- // 让其出现在导航栏底部
101
- position: 'fixed',
102
- left: 0,
103
- right: 0,
104
- zIndex: 10076
105
- }
106
- return style
107
- })
108
- /**
109
- * @description 组件背景颜色
110
- */
111
- const backgroundColor = computed(() => {
112
- const style: CSSProperties = {}
113
- if (tmpConfig.value.bgColor) {
114
- style.backgroundColor = tmpConfig.value.bgColor
115
- }
116
- return style
117
- })
118
-
119
- /**
120
- * @description 默认主题下的图标
121
- * */
122
- const icon = computed(() => {
123
- switch (tmpConfig.value.type) {
124
- case 'success':
125
- return IconConfig.SUCCESS
126
- case 'error':
127
- return IconConfig.CLOSE_CIRCLE
128
- case 'warning':
129
- return IconConfig.NOTICE
130
- default:
131
- return ''
132
- }
133
- })
134
-
135
- const show = (options: HyNotifyProps) => {
136
- // 不将结果合并到this.config变量,避免多次调用hy-toast,前后的配置造成混乱
137
- tmpConfig.value = Object.assign(config.value, options)
138
- // 任何定时器初始化之前,都要执行清除操作,否则可能会造成混乱
139
- clearTimer()
140
- open.value = true
141
- if (tmpConfig.value.duration && tmpConfig.value.duration! > 0) {
142
- timer = setTimeout(() => {
143
- open.value = false
144
- // 倒计时结束,清除定时器,隐藏toast组件
145
- clearTimer()
146
- // 判断是否存在callback方法,如果存在就执行
147
- typeof tmpConfig.value.complete === 'function' && tmpConfig.value.complete()
148
- }, tmpConfig.value.duration)
149
- }
150
- }
151
- /**
152
- * @description 关闭notify
153
- * */
154
- const close = () => {
155
- clearTimer()
156
- }
157
- /**
158
- * @description 清除定时任务
159
- * */
160
- const clearTimer = () => {
161
- open.value = false
162
- // 清除定时器
163
- clearTimeout(timer)
164
- }
165
-
166
- defineExpose({
167
- show,
168
- close
169
- })
170
- </script>
171
-
172
- <style scoped lang="scss">
173
- @import './index.scss';
174
- </style>
1
+ <template>
2
+ <hy-transition mode="slide-down" :customStyle="containerStyle" :show="open">
3
+ <view
4
+ :class="['hy-notify', `hy-notify--${tmpConfig?.type}`, customClass]"
5
+ :style="[backgroundColor, customStyle]"
6
+ >
7
+ <hy-status-bar v-if="tmpConfig?.safeAreaInsetTop"></hy-status-bar>
8
+ <view class="hy-notify__wrapper">
9
+ <template v-if="['success', 'warning', 'error'].includes(tmpConfig.type)">
10
+ <slot v-if="$slots.icon" name="icon"></slot>
11
+ <hy-icon
12
+ v-else
13
+ :name="tmpConfig?.icon || icon"
14
+ :color="tmpConfig?.color"
15
+ :size="tmpConfig.fontSize"
16
+ :customStyle="{ marginRight: '4px' }"
17
+ ></hy-icon>
18
+ </template>
19
+ <text
20
+ class="hy-notify__wrapper--text"
21
+ :style="{
22
+ fontSize: addUnit(tmpConfig?.fontSize),
23
+ color: tmpConfig?.color
24
+ }"
25
+ >
26
+ {{ tmpConfig?.message }}
27
+ </text>
28
+ </view>
29
+ </view>
30
+ </hy-transition>
31
+ </template>
32
+
33
+ <script lang="ts">
34
+ export default {
35
+ name: 'hy-notify',
36
+ options: {
37
+ addGlobalClass: true,
38
+ virtualHost: true,
39
+ styleIsolation: 'shared'
40
+ }
41
+ }
42
+ </script>
43
+
44
+ <script setup lang="ts">
45
+ import type HyNotifyProps from './typing'
46
+ import { computed, ref } from 'vue'
47
+ import type { CSSProperties } from 'vue'
48
+ import { addUnit, IconConfig } from '../../libs'
49
+ import notifyProps from './props'
50
+ // 组件
51
+ import HyTransition from '../hy-transition/hy-transition.vue'
52
+ import HyStatusBar from '../hy-status-bar/hy-status-bar.vue'
53
+ import HyIcon from '../hy-icon/hy-icon.vue'
54
+
55
+ /**
56
+ * 一般用于页面顶部向下滑出一个提示,尔后自动收起的场景。
57
+ * @displayName hy-notify
58
+ */
59
+ defineOptions({})
60
+
61
+ const props = defineProps(notifyProps)
62
+
63
+ const config = ref<HyNotifyProps>({
64
+ // 到顶部的距离
65
+ top: props.top,
66
+ // type主题,primary,success,warning,error
67
+ type: props.type,
68
+ // 字体颜色
69
+ color: props.color,
70
+ // 背景颜色
71
+ bgColor: props.bgColor,
72
+ // 展示的文字内容
73
+ message: props.message,
74
+ // 展示时长,为0时不消失,单位ms
75
+ duration: props.duration,
76
+ // 字体大小
77
+ fontSize: props.fontSize,
78
+ // 是否留出顶部安全距离(状态栏高度)
79
+ safeAreaInsetTop: props.safeAreaInsetTop
80
+ })
81
+ const tmpConfig = ref<HyNotifyProps>({})
82
+ const open = ref(false)
83
+ let timer: ReturnType<typeof setTimeout>
84
+
85
+ /**
86
+ * @description 容器样式
87
+ * */
88
+ const containerStyle = computed(() => {
89
+ let top = 0
90
+ if (tmpConfig.value.top === 0) {
91
+ // #ifdef H5
92
+ // H5端,导航栏为普通元素,需要将组件移动到导航栏的下边沿
93
+ // H5的导航栏高度为44px
94
+ top = 44
95
+ // #endif
96
+ }
97
+ const style: CSSProperties = {
98
+ top: addUnit(tmpConfig.value.top === 0 ? top : tmpConfig.value.top),
99
+ // 因为组件底层为hy-transition组件,必须将其设置为fixed定位
100
+ // 让其出现在导航栏底部
101
+ position: 'fixed',
102
+ left: 0,
103
+ right: 0,
104
+ zIndex: 10076
105
+ }
106
+ return style
107
+ })
108
+ /**
109
+ * @description 组件背景颜色
110
+ */
111
+ const backgroundColor = computed(() => {
112
+ const style: CSSProperties = {}
113
+ if (tmpConfig.value.bgColor) {
114
+ style.backgroundColor = tmpConfig.value.bgColor
115
+ }
116
+ return style
117
+ })
118
+
119
+ /**
120
+ * @description 默认主题下的图标
121
+ * */
122
+ const icon = computed(() => {
123
+ switch (tmpConfig.value.type) {
124
+ case 'success':
125
+ return IconConfig.SUCCESS
126
+ case 'error':
127
+ return IconConfig.CLOSE_CIRCLE
128
+ case 'warning':
129
+ return IconConfig.NOTICE_CIRCLE
130
+ default:
131
+ return ''
132
+ }
133
+ })
134
+
135
+ const show = (options: HyNotifyProps) => {
136
+ // 不将结果合并到this.config变量,避免多次调用hy-toast,前后的配置造成混乱
137
+ tmpConfig.value = Object.assign(config.value, options)
138
+ // 任何定时器初始化之前,都要执行清除操作,否则可能会造成混乱
139
+ clearTimer()
140
+ open.value = true
141
+ if (tmpConfig.value.duration && tmpConfig.value.duration! > 0) {
142
+ timer = setTimeout(() => {
143
+ open.value = false
144
+ // 倒计时结束,清除定时器,隐藏toast组件
145
+ clearTimer()
146
+ // 判断是否存在callback方法,如果存在就执行
147
+ typeof tmpConfig.value.complete === 'function' && tmpConfig.value.complete()
148
+ }, tmpConfig.value.duration)
149
+ }
150
+ }
151
+ /**
152
+ * @description 关闭notify
153
+ * */
154
+ const close = () => {
155
+ clearTimer()
156
+ }
157
+ /**
158
+ * @description 清除定时任务
159
+ * */
160
+ const clearTimer = () => {
161
+ open.value = false
162
+ // 清除定时器
163
+ clearTimeout(timer)
164
+ }
165
+
166
+ defineExpose({
167
+ show,
168
+ close
169
+ })
170
+ </script>
171
+
172
+ <style scoped lang="scss">
173
+ @import './index.scss';
174
+ </style>
@@ -5,7 +5,6 @@
5
5
  <template v-else>
6
6
  <hy-input
7
7
  v-model="inputLabelValue"
8
- :readonly="true"
9
8
  :disabled="input?.disabled"
10
9
  :disabledColor="input?.disabledColor"
11
10
  :shape="input?.shape"
@@ -43,7 +43,7 @@
43
43
  }
44
44
 
45
45
  @include e(item) {
46
- color: $hy-text-color;
46
+ color: $hy-text-color !important;
47
47
  @include lineEllipsis;
48
48
  @include m(disabled) {
49
49
  /* #ifndef APP-NVUE */
@@ -31,6 +31,7 @@
31
31
  /* #ifdef H5 */
32
32
  cursor: pointer;
33
33
  /* #endif */
34
+ flex-shrink: 0;
34
35
 
35
36
  @include m(disabled) {
36
37
  /* #ifdef H5 */
@@ -120,7 +120,7 @@ const valueStyle = computed(() => {
120
120
  })
121
121
 
122
122
  /**
123
- * @description 格式化值
123
+ * 格式化值
124
124
  * */
125
125
  const value = computed(() => {
126
126
  switch (props.mode) {
@@ -78,7 +78,7 @@ defineOptions({})
78
78
 
79
79
  const props = defineProps(textareaProps)
80
80
  const emit = defineEmits<ITextareaEmits>()
81
- const formItem = inject<FormItemContext>('formItem')
81
+ const formItem = inject<FormItemContext | null>('formItem', null)
82
82
 
83
83
  // 输入框的值
84
84
  const innerValue = ref<string>('')
@@ -33,6 +33,7 @@
33
33
  min-height: 50rpx;
34
34
  max-height: 200rpx;
35
35
  color: $hy-text-color;
36
+ caret-color: $hy-text-color;
36
37
  flex: 1;
37
38
  font-size: 15px;
38
39
  width: 100%;
@@ -50,7 +51,3 @@
50
51
  border-radius: $hy-border-radius-sm;
51
52
  }
52
53
  }
53
- //textarea {
54
- // background-color: transparent;
55
- // border: none;
56
- //}