stellar-ui-plus 1.24.9 → 1.24.11

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.
@@ -7,6 +7,7 @@
7
7
  | `maxlength` | value最大长度 | `number` | - | - | - |
8
8
  | `show` | 是否显示键盘,支持v-model:show绑定,mode='popup'时生效 | `boolean` | `false` | - | - |
9
9
  | `rightKeys` | 是否显示右侧功能键 | `boolean` | `true` | - | - |
10
+ | `customKeys` | 自定义按键,建议数量不大于2 | `string[]` | `[]` | - | - |
10
11
  | `randomKeys` | 按键是否随机排列 | `boolean` | `false` | - | - |
11
12
  | `confirmText` | 右侧确定按钮文本 | `string` | `确定` | - | - |
12
13
  | `confirmDisabled` | 右侧确认是否禁用 | `boolean` | `false` | - | - |
@@ -29,6 +30,7 @@
29
30
  | `backspace` | 删除按钮点击事件 | - | - |
30
31
  | `confirm` | 确认按钮点击事件 | `value`:输入值 | - |
31
32
  | `click` | 点击功能键(确认/删除/清除)之外的键盘触发 | `key`:当前点击的按钮 | - |
33
+ | `click-discount` | 点击折扣键盘触发 | `key`:当前点击的按钮 | - |
32
34
  | `beforeinput` | 输入之前触发,功能键之外的键盘点击时为输入 | `key`:当前点击的按钮<br/>`suspend`:开启等待的回调函数<br/>`next`:执行后续操作的回调函数<br/>`stop`:阻止后续执行的回调函数 | - |
33
35
  | `open` | 打开弹窗键盘触发 | - | - |
34
36
  | `close` | 关闭弹窗键盘触发 | - | - |
@@ -1,4 +1,4 @@
1
- # Keyboard 键盘
1
+ # CustomKeyboard 定制键盘
2
2
 
3
3
  用于页面上显示价格的组件
4
4
 
@@ -9,6 +9,7 @@ export interface NumberKeyboardProps {
9
9
  show: boolean;
10
10
  discounts: number[];
11
11
  rightKeys: boolean;
12
+ customKeys: string[];
12
13
  randomKeys: boolean;
13
14
  confirmText: string;
14
15
  confirmDisabled: boolean;
@@ -31,6 +32,7 @@ export default {
31
32
  show: { type: Boolean, default: () => false },
32
33
  discounts: { type: Array as PropType<number[]>, default: () => [] },
33
34
  rightKeys: { type: Boolean, default: () => true },
35
+ customKeys: { type: Array as PropType<string[]>, default: () => [] },
34
36
  randomKeys: { type: Boolean, default: () => false },
35
37
  confirmText: { type: String, default: () => '确定' },
36
38
  confirmDisabled: { type: Boolean, default: () => false },
@@ -62,6 +62,12 @@
62
62
  "type": "boolean",
63
63
  "default": true
64
64
  },
65
+ {
66
+ "name": "customKeys",
67
+ "description": "自定义按键,建议数量不大于2",
68
+ "type": "string[]",
69
+ "default": []
70
+ },
65
71
  {
66
72
  "name": "randomKeys",
67
73
  "description": "按键是否随机排列",
@@ -50,11 +50,12 @@ export default function useData({
50
50
  const cmpNumbers = computed(() => {
51
51
  let keys = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'];
52
52
  if (props.randomKeys) keys = utils.randomArray(keys);
53
- if (['number', 'discount'].includes(props.type)) {
54
- keys.push('.');
55
- } else if (props.type === "idcard") {
53
+ if (props.type === "idcard") {
56
54
  keys.push('X');
57
55
  }
56
+ if (Array.isArray(props.customKeys) && props.customKeys.length) {
57
+ keys.push(...props.customKeys);
58
+ }
58
59
 
59
60
  if (!props.rightKeys) {
60
61
  if (!props.showClear) {
@@ -86,6 +86,7 @@ const checkboxChange = () => {
86
86
 
87
87
  const onClick = (type: 'empty' | 'image' | 'title' | 'code' | 'price' | 'originalPrice' | 'stepper') => {
88
88
  emits('click', type);
89
+ if (['image', 'title', 'code'].includes(type)) clickSuggestInput();
89
90
  };
90
91
 
91
92
  const _tagBg = computed(() => (props.tagBg ? props.tagBg : getColor().steThemeColor));
@@ -158,7 +159,14 @@ const clickSuggest = (type: 'method' | 'back' | 'item' | 'right', item?: { label
158
159
  };
159
160
 
160
161
  const clickStepperInput = () => emits('click-stepper-input');
161
- const clickSuggestInput = () => emits('click-suggest-input');
162
+ const clickSuggestInput = () => {
163
+ if (!suggesData.value.applyForText) return;
164
+ emits('click-suggest-input');
165
+ applyForInputFocus.value = false;
166
+ nextTick(() => {
167
+ applyForInputFocus.value = true;
168
+ });
169
+ };
162
170
 
163
171
  const viewClass = computed(() => {
164
172
  const imgSize = utils.formatPx<'num'>(props.imageSize, 'num');
@@ -171,13 +179,6 @@ const viewClass = computed(() => {
171
179
  const cmpMore = computed(() => props.mode === 'more');
172
180
 
173
181
  const applyForInputFocus = ref(false);
174
-
175
- const handerFocus = () => {
176
- applyForInputFocus.value = false;
177
- nextTick(() => {
178
- applyForInputFocus.value = true;
179
- });
180
- };
181
182
  </script>
182
183
  <template>
183
184
  <view class="ste-goods-info-root" :class="{ less: mode === 'less' }" :style="[rootStyle]">
@@ -269,7 +270,7 @@ const handerFocus = () => {
269
270
  <view class="ste-goods-info-suggest-method-number">{{ suggesData.number }}</view>
270
271
  </view>
271
272
  <view class="ste-goods-info-apply-for" v-if="suggesData.applyForText">
272
- <div class="ste-goods-info-apply-for-input-hot" @click="handerFocus" />
273
+ <div class="ste-goods-info-apply-for-input-hot" @click.stop="clickSuggestInput" />
273
274
  <view class="ste-goods-info-apply-for-text">{{ suggesData.applyForText }}:</view>
274
275
  <view class="ste-goods-info-apply-for-number">
275
276
  <view class="ste-goods-info-apply-for-input" @click.stop="clickSuggestInput">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stellar-ui-plus",
3
- "version": "1.24.9",
3
+ "version": "1.24.11",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "MIT",