stellar-ui-plus 1.25.6 → 1.25.8

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,140 +1,138 @@
1
- {
2
- "name": "ste-popup",
3
- "description": "验证码输入",
4
- "example": "<ste-popup v-model:show='show'></ste-popup>",
5
- "tutorial": "https://stellar-ui.intecloud.com.cn/?projectName=stellar-ui-plus&menu=%E7%BB%84%E4%BB%B6&active=ste-popup",
6
- "attributes": [
7
- {
8
- "name": "show",
9
- "description": "是否显示弹出层,使用v-model修饰符来双向绑定",
10
- "type": "boolean",
11
- "default": false
12
- },
13
- {
14
- "name": "backgroundColor",
15
- "description": "内容容器的背景色",
16
- "type": "string",
17
- "default": "#ffffff"
18
- },
19
- {
20
- "name": "isMaskClick",
21
- "description": "是否可以点击遮罩层关闭",
22
- "type": "boolean",
23
- "default": true
24
- },
25
- {
26
- "name": "width",
27
- "description": "内容区宽度",
28
- "type": "string | number",
29
- "default": "auto"
30
- },
31
- {
32
- "name": "height",
33
- "description": "内容区高度",
34
- "type": "string | number",
35
- "default": "auto"
36
- },
37
- {
38
- "name": "position",
39
- "description": "弹出位置",
40
- "type": "string",
41
- "values": [
42
- {
43
- "name": "center",
44
- "description": "中"
45
- },
46
- {
47
- "name": "top",
48
- "description": "上"
49
- },
50
- {
51
- "name": "bottom",
52
- "description": "下"
53
- },
54
- {
55
- "name": "left",
56
- "description": "左"
57
- },
58
- {
59
- "name": "right",
60
- "description": "右"
61
- }
62
- ],
63
- "default": "center"
64
- },
65
- {
66
- "name": "round",
67
- "description": "是否圆角",
68
- "type": "boolean",
69
- "default": false
70
- },
71
- {
72
- "name": "showClose",
73
- "description": "是否右上角显示关闭图标",
74
- "type": "boolean",
75
- "default": true
76
- },
77
- {
78
- "name": "offsetX",
79
- "description": "根据弹出位置,设置X轴偏移量,单位px 默认 0",
80
- "type": "string | number "
81
- },
82
- {
83
- "name": "offsetY",
84
- "description": "根据弹出位置,设置Y轴偏移量,单位px 默认 0",
85
- "type": "string | number"
86
- },
87
- {
88
- "name": "duration",
89
- "description": "动画持续时间,单位ms",
90
- "type": "number",
91
- "default": 200
92
- },
93
- {
94
- "name": "zIndex",
95
- "description": "弹窗层级z-index",
96
- "type": "number",
97
- "default": 998
98
- },
99
- {
100
- "name": "keepContent",
101
- "description": "隐藏后是否不销毁弹窗内容元素",
102
- "type": "boolean",
103
- "default": true
104
- },
105
- {
106
- "name": "[event]close",
107
- "description": "弹窗关闭动画执行完毕事件",
108
- "params": [
109
- {
110
- "name": "data",
111
- "description": "() => void"
112
- }
113
- ]
114
- },
115
- {
116
- "name": "[event]open",
117
- "description": "弹窗打开动画执行完毕事件",
118
- "params": [
119
- {
120
- "name": "data",
121
- "description": "() => void"
122
- }
123
- ]
124
- },
125
- {
126
- "name": "[event]maskClick",
127
- "description": "点击遮罩时触发",
128
- "params": [
129
- {
130
- "name": "data",
131
- "description": "() => void"
132
- }
133
- ]
134
- },
135
- {
136
- "name": "[slot]default",
137
- "description": "内容部分插槽"
138
- }
139
- ]
140
- }
1
+ {
2
+ "name": "ste-popup",
3
+ "description": "验证码输入",
4
+ "example": "<ste-popup v-model:show='show'></ste-popup>",
5
+ "tutorial": "https://stellar-ui.intecloud.com.cn/?projectName=stellar-ui-plus&menu=%E7%BB%84%E4%BB%B6&active=ste-popup",
6
+ "attributes": [
7
+ {
8
+ "name": "show",
9
+ "description": "是否显示弹出层,使用v-model修饰符来双向绑定",
10
+ "type": "boolean",
11
+ "default": false
12
+ },
13
+ {
14
+ "name": "backgroundColor",
15
+ "description": "内容容器的背景色",
16
+ "type": "string",
17
+ "default": "#ffffff"
18
+ },
19
+ {
20
+ "name": "isMaskClick",
21
+ "description": "是否可以点击遮罩层关闭",
22
+ "type": "boolean",
23
+ "default": true
24
+ },
25
+ {
26
+ "name": "width",
27
+ "description": "内容区宽度",
28
+ "type": "string | number",
29
+ "default": "auto"
30
+ },
31
+ {
32
+ "name": "height",
33
+ "description": "内容区高度",
34
+ "type": "string | number",
35
+ "default": "auto"
36
+ },
37
+ {
38
+ "name": "position",
39
+ "description": "弹出位置",
40
+ "type": "string",
41
+ "values": [
42
+ {
43
+ "name": "center",
44
+ "description": "中"
45
+ },
46
+ {
47
+ "name": "top",
48
+ "description": "上"
49
+ },
50
+ {
51
+ "name": "bottom",
52
+ "description": "下"
53
+ },
54
+ {
55
+ "name": "left",
56
+ "description": "左"
57
+ },
58
+ {
59
+ "name": "right",
60
+ "description": "右"
61
+ }
62
+ ],
63
+ "default": "center"
64
+ },
65
+ {
66
+ "name": "round",
67
+ "description": "是否圆角",
68
+ "type": "boolean",
69
+ "default": false
70
+ },
71
+ {
72
+ "name": "showClose",
73
+ "description": "是否右上角显示关闭图标",
74
+ "type": "boolean",
75
+ "default": true
76
+ },
77
+ {
78
+ "name": "offsetX",
79
+ "description": "根据弹出位置,设置X轴偏移量,单位px 默认 0",
80
+ "type": "string | number "
81
+ },
82
+ {
83
+ "name": "offsetY",
84
+ "description": "根据弹出位置,设置Y轴偏移量,单位px 默认 0",
85
+ "type": "string | number"
86
+ },
87
+ {
88
+ "name": "duration",
89
+ "description": "动画持续时间,单位ms",
90
+ "type": "number",
91
+ "default": 200
92
+ },
93
+ {
94
+ "name": "zIndex",
95
+ "description": "弹窗层级z-index",
96
+ "type": "number",
97
+ "default": 998
98
+ },
99
+ {
100
+ "name": "keepContent",
101
+ "description": "隐藏后是否不销毁弹窗内容元素",
102
+ "type": "boolean",
103
+ "default": true
104
+ },
105
+ {
106
+ "name": "[event]close",
107
+ "description": "弹窗关闭前触发,可用于异步拦截关闭",
108
+ "params": [
109
+ {
110
+ "name": "suspend",
111
+ "description": "开启等待的回调函数"
112
+ },
113
+ {
114
+ "name": "next",
115
+ "description": "执行后续关闭操作的回调函数"
116
+ },
117
+ {
118
+ "name": "stop",
119
+ "description": "阻止后续关闭操作的回调函数"
120
+ }
121
+ ]
122
+ },
123
+ {
124
+ "name": "[event]open-after",
125
+ "description": "弹窗打开动画执行完毕事件",
126
+ "params": []
127
+ },
128
+ {
129
+ "name": "[event]clickMask",
130
+ "description": "点击遮罩时触发",
131
+ "params": []
132
+ },
133
+ {
134
+ "name": "[slot]default",
135
+ "description": "内容部分插槽"
136
+ }
137
+ ]
138
+ }
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { ref, computed, watch, type CSSProperties } from 'vue';
2
+ import { ref, computed, watch, onUnmounted, type CSSProperties } from 'vue';
3
3
  import propsData from './props';
4
4
  import utils from '../../utils/utils';
5
5
  const DEFAULT_BORDER_RADIUS = 32;
@@ -13,12 +13,15 @@ defineOptions({
13
13
  },
14
14
  });
15
15
 
16
- const animationProp: UniApp.CreateAnimationOptions = { duration: props.duration, timingFunction: 'ease-out' };
16
+ const animationProp = computed<UniApp.CreateAnimationOptions>(() => ({ duration: props.duration, timingFunction: 'ease-out' }));
17
17
  const pageDisplay = ref('none');
18
18
  const overlayAnimationData = ref<UniApp.Animation>();
19
19
  const animationData = ref<UniApp.Animation>();
20
20
  const showContent = ref(false);
21
21
 
22
+ let beginTimer: ReturnType<typeof setTimeout> | null = null;
23
+ let endTimer: ReturnType<typeof setTimeout> | null = null;
24
+
22
25
  const emits = defineEmits<{
23
26
  (e: 'clickMask'): void;
24
27
  (e: 'close', suspend: () => void, next: () => void, stop: () => void): void;
@@ -48,14 +51,6 @@ const cmpContentStyle = computed(() => {
48
51
  height: utils.addUnit(props.height),
49
52
  backgroundColor: props.backgroundColor,
50
53
  };
51
-
52
- if (props.position === 'center') {
53
- } else if (props.position === 'bottom') {
54
- } else if (props.position === 'top') {
55
- } else if (props.position === 'left') {
56
- } else if (props.position === 'right') {
57
- }
58
-
59
54
  return style;
60
55
  });
61
56
 
@@ -108,8 +103,8 @@ async function beginAnimation() {
108
103
 
109
104
  pageDisplay.value = 'flex';
110
105
  await utils.sleep(50);
111
- let animation = uni.createAnimation(animationProp);
112
- let overlayAnimation = uni.createAnimation(animationProp);
106
+ let animation = uni.createAnimation(animationProp.value);
107
+ let overlayAnimation = uni.createAnimation(animationProp.value);
113
108
  overlayAnimation.opacity(1).step({
114
109
  duration: props.duration,
115
110
  });
@@ -128,15 +123,16 @@ async function beginAnimation() {
128
123
  overlayAnimationData.value = overlayAnimation.export();
129
124
  animationData.value = animation.export();
130
125
 
131
- setTimeout(() => {
126
+ if (beginTimer) clearTimeout(beginTimer);
127
+ beginTimer = setTimeout(() => {
132
128
  showContent.value = true;
133
129
  emits('open-after');
134
130
  }, props.duration);
135
131
  }
136
132
 
137
133
  function endAnimation() {
138
- let animation = uni.createAnimation(animationProp);
139
- let overlayAnimation = uni.createAnimation(animationProp);
134
+ let animation = uni.createAnimation(animationProp.value);
135
+ let overlayAnimation = uni.createAnimation(animationProp.value);
140
136
  overlayAnimation.opacity(0).step();
141
137
 
142
138
  if (props.position === 'center') {
@@ -150,23 +146,24 @@ function endAnimation() {
150
146
  overlayAnimationData.value = overlayAnimation.export();
151
147
  animationData.value = animation.export();
152
148
 
153
- setTimeout(() => {
149
+ if (endTimer) clearTimeout(endTimer);
150
+ endTimer = setTimeout(() => {
154
151
  pageDisplay.value = 'none';
155
152
  showContent.value = false;
156
153
  }, props.duration);
157
154
  }
158
155
 
159
- function touchmove(e: TouchEvent) {
160
- // TODO nvue 取消冒泡
161
- e.stopPropagation();
162
- }
156
+ onUnmounted(() => {
157
+ if (beginTimer) clearTimeout(beginTimer);
158
+ if (endTimer) clearTimeout(endTimer);
159
+ });
163
160
  </script>
164
161
 
165
162
  <template>
166
163
  <view class="ste-popup" :class="position" :style="[cmpPageStyle]" @click.stop="onMaskClick" :animation="overlayAnimationData" data-test="popup">
167
164
  <view class="content" :class="position" :style="[cmpContentStyle]" :animation="animationData" @click.stop>
168
165
  <template v-if="keepContent || showContent">
169
- <scroll-view style="width: 100%; height: 100%" v-if="Number(height) > 0" :scroll-y="true" @touchmove.stop.prevent="touchmove">
166
+ <scroll-view style="width: 100%; height: 100%" v-if="Number(height) > 0" :scroll-y="true" @touchmove.stop.prevent>
170
167
  <slot name="default"></slot>
171
168
  </scroll-view>
172
169
  <slot v-else name="default"></slot>
@@ -176,7 +173,7 @@ function touchmove(e: TouchEvent) {
176
173
  </view>
177
174
  </view>
178
175
  <view class="close-icon-box-center" @click="handleClose" v-if="showClose && position == 'center' && showContent">
179
- <ste-icon code="&#xe6a0;" :size="40" color="'#fff'"></ste-icon>
176
+ <ste-icon code="&#xe6a0;" :size="40" :color="'#fff'"></ste-icon>
180
177
  </view>
181
178
  </view>
182
179
  </template>
@@ -189,7 +186,6 @@ function touchmove(e: TouchEvent) {
189
186
  position: fixed;
190
187
  left: 0;
191
188
  top: 0;
192
- overflow: hidden;
193
189
  justify-content: center;
194
190
  align-items: center;
195
191
  touch-action: none;
@@ -23,7 +23,7 @@
23
23
  ### Events
24
24
  | 事件名 | 说明 | 事件参数 | 支持版本 |
25
25
  | ----- | ----- | ------- | -------- |
26
- | `click` | 点击复选框时触发的事件 | `value`:当前复选框的绑定值<br/>`suspend`:等待<br/>`next`:继续<br/>`stop`:停止 | - |
27
- | `change` | 当绑定值变化时触发的事件 | `value`:当前复选框的绑定值 | - |
26
+ | `click` | 点击单选框时触发的事件 | `value`:当前单选框的绑定值<br/>`suspend`:等待<br/>`next`:继续<br/>`stop`:停止 | - |
27
+ | `change` | 当绑定值变化时触发的事件 | `value`:当前单选框的绑定值 | - |
28
28
 
29
29
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ste-radio",
3
3
  "description": "单选框组件, 在一组备选项中进行单选。",
4
- "example": "<ste-checkbox>单选框</ste-checkbox>",
4
+ "example": "<ste-radio>单选框</ste-radio>",
5
5
  "tutorial": "https://stellar-ui.intecloud.com.cn/?projectName=stellar-ui-plus&menu=%E7%BB%84%E4%BB%B6&active=ste-radio",
6
6
  "attributes": [
7
7
  {
@@ -114,11 +114,11 @@
114
114
  },
115
115
  {
116
116
  "name": "[event]click",
117
- "description": "点击复选框时触发的事件",
117
+ "description": "点击单选框时触发的事件",
118
118
  "params": [
119
119
  {
120
120
  "name": "value",
121
- "description": "当前复选框的绑定值"
121
+ "description": "当前单选框的绑定值"
122
122
  },
123
123
  {
124
124
  "name": "suspend",
@@ -140,7 +140,7 @@
140
140
  "params": [
141
141
  {
142
142
  "name": "value",
143
- "description": "当前复选框的绑定值"
143
+ "description": "当前单选框的绑定值"
144
144
  }
145
145
  ]
146
146
  }
@@ -312,12 +312,6 @@
312
312
 
313
313
  ---$
314
314
 
315
- ## API
316
-
317
- ## Props
318
-
319
- 背景之外的颜色属性只支持`16进制`、`RGB`、`RGBA`格式
320
-
321
315
  <!-- props -->
322
316
 
323
317
  ---$
@@ -0,0 +1,61 @@
1
+ # SelectOrder 订单选择
2
+
3
+ - 用于选择订单的下拉选择组件
4
+
5
+ ---$
6
+
7
+ ## 使用示例
8
+
9
+ ## 基础用法
10
+
11
+ - 属性`list`接收一个数组,数组中的每一项为一个对象,对象中包含`label`和`value`两个属性,分别表示节点的显示文本和节点的值
12
+ - 若`label`和`value`属性字段名不同,可通过`labelKey`和`valueKey`属性进行设置
13
+ - 属性`modelValue`接收一个值,表示当前选中的节点值,支持v-model双向绑定
14
+ - 事件`change`在节点值改变时触发,返回当前选中的值和选项对象
15
+
16
+ ```html
17
+ <template>
18
+ <ste-select-order :list="list" v-model="value" @change="onChange"></ste-select-order>
19
+ </template>
20
+ <script lang="ts" setup>
21
+ import { ref } from 'vue';
22
+ const value = ref(null);
23
+ const list = ref([
24
+ { label: '全部订单', value: 'all' },
25
+ { label: '待付款', value: 'pending' },
26
+ { label: '待发货', value: 'unshipped' },
27
+ { label: '待收货', value: 'unreceived' },
28
+ { label: '已完成', value: 'completed' },
29
+ ]);
30
+
31
+ function onChange(val, option) {
32
+ console.log(val, option);
33
+ }
34
+ </script>
35
+ ```
36
+
37
+ ## 禁用状态
38
+
39
+ - 属性`disabled`设置为`true`时,组件将被禁用
40
+
41
+ ```html
42
+ <template>
43
+ <ste-select-order :list="list" v-model="value" disabled></ste-select-order>
44
+ </template>
45
+ <script lang="ts" setup>
46
+ import { ref } from 'vue';
47
+ const value = ref(null);
48
+ const list = ref([
49
+ { label: '全部订单', value: 'all' },
50
+ { label: '待付款', value: 'pending' },
51
+ { label: '待发货', value: 'unshipped' },
52
+ ]);
53
+ </script>
54
+ ```
55
+
56
+ ---$
57
+
58
+ <!-- props -->
59
+
60
+ ---$
61
+ {{xuyajun}}
@@ -0,0 +1,5 @@
1
+ {
2
+ "group": "业务组件",
3
+ "title": "SelectOrder 订单选择",
4
+ "icon": "https://image.whzb.com/chain/StellarUI/%E7%BB%84%E4%BB%B6%E5%9B%BE%E6%A0%87/progress.png"
5
+ }
@@ -0,0 +1,30 @@
1
+ import type { PropType } from 'vue';
2
+
3
+ export interface SelectOption {
4
+ label?: string;
5
+ value: string | number;
6
+ disabled?: boolean;
7
+ [key: string]: any;
8
+ }
9
+
10
+ export type SelectValue = string | number | null | undefined;
11
+
12
+ export interface SteSelectOrderProps {
13
+ modelValue: SelectValue;
14
+ list: SelectOption[];
15
+ placeholder: string;
16
+ labelKey: string;
17
+ valueKey: string;
18
+ disabled: boolean;
19
+ maskClose: boolean;
20
+ }
21
+
22
+ export default {
23
+ modelValue: { type: [String, Number, null, undefined] as PropType<SelectValue>, default: undefined },
24
+ list: { type: Array as PropType<SelectOption[]>, default: () => [] },
25
+ placeholder: { type: String, default: '请选择' },
26
+ labelKey: { type: String, default: 'label' },
27
+ valueKey: { type: String, default: 'value' },
28
+ disabled: { type: Boolean, default: false },
29
+ maskClose: { type: Boolean, default: true },
30
+ };
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "ste-select-order",
3
+ "description": "订单选择",
4
+ "example": "<ste-select-order />",
5
+ "tutorial": "https://stellar-ui.intecloud.com.cn/?projectName=stellar-ui-plus&menu=%E7%BB%84%E4%BB%B6&active=ste-select-order",
6
+ "attributes": [
7
+ {
8
+ "name": "modelValue",
9
+ "description": "绑定的值,支持v-model双向绑定",
10
+ "type": "string | number | null | undefined"
11
+ },
12
+ {
13
+ "name": "list",
14
+ "description": "选项数据,每个选项支持 disabled 属性设置单项禁止选择",
15
+ "type": "SelectOption[]",
16
+ "default": []
17
+ },
18
+ {
19
+ "name": "placeholder",
20
+ "description": "占位符",
21
+ "type": "string",
22
+ "default": "请选择"
23
+ },
24
+ {
25
+ "name": "labelKey",
26
+ "description": "选项标签Key",
27
+ "type": "string",
28
+ "default": "label"
29
+ },
30
+ {
31
+ "name": "valueKey",
32
+ "description": "选项值Key",
33
+ "type": "string",
34
+ "default": "value"
35
+ },
36
+ {
37
+ "name": "disabled",
38
+ "description": "禁用状态",
39
+ "type": "boolean",
40
+ "default": false
41
+ },
42
+ {
43
+ "name": "maskClose",
44
+ "description": "点击遮罩层是否关闭弹窗",
45
+ "type": "boolean",
46
+ "default": true
47
+ },
48
+ {
49
+ "name": "[event]update:modelValue",
50
+ "description": "选中值改变时触发",
51
+ "params": [
52
+ {
53
+ "name": "value",
54
+ "description": "选中的值"
55
+ }
56
+ ]
57
+ },
58
+ {
59
+ "name": "[event]change",
60
+ "description": "选中值改变时触发",
61
+ "params": [
62
+ {
63
+ "name": "value",
64
+ "description": "选中的值"
65
+ },
66
+ {
67
+ "name": "option",
68
+ "description": "选中的选项对象"
69
+ }
70
+ ]
71
+ }
72
+ ]
73
+ }