stellar-ui-plus 1.22.24 → 1.22.26

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.
@@ -5,6 +5,7 @@
5
5
  | `clientSecret` | 应用密钥 | `string` | `` | - | - |
6
6
  | `apiUrl` | 更新API地址 | `string` | `https://zboa.whzb.com/inte-cloud-dev/blade-system/api/inte/client/ver/currentDetail` | - | - |
7
7
  | `appType` | APP环境,版本号的最后一位为环境标识 | `string` | `` | - | - |
8
+ | `btnText` | 立即体验按钮文本 | `string` | `立即体验` | - | - |
8
9
 
9
10
 
10
11
  #### Events
@@ -64,7 +64,8 @@ const getData = (callback?: (resVersion: { name: string; code: string; updateFil
64
64
  });
65
65
  return;
66
66
  }
67
- data.name = nvs.splice(nvs.length - 1).join('.');
67
+ nvs.splice(nvs.length - 1);
68
+ data.name = nvs.join('.');
68
69
  }
69
70
  if (data.updateFile && data.code !== version.value) {
70
71
  open.value = true;
@@ -44,7 +44,6 @@ const emits = defineEmits<{
44
44
  (e: 'subscribe', event?: ButtonOnSubscribeEvent): void;
45
45
  (e: 'login', event?: ButtonOnLoginEvent): void;
46
46
  (e: 'getrealtimephonenumber', event?: any): void;
47
- (e: 'greeprivacyauthorization', event?: any): void;
48
47
  (e: 'getAuthorize', event?: any): void;
49
48
  (e: 'followLifestyle', event?: any): void;
50
49
  }>();
@@ -149,7 +148,7 @@ function handleClick(e: any) {
149
148
  @getphonenumber="emits('getphonenumber', $event)"
150
149
  @getrealtimephonenumber="emits('getrealtimephonenumber', $event)"
151
150
  @agreeprivacyauthorization="emits('agreeprivacyauthorization', $event)"
152
- @error="emits('error', $event)"
151
+ @error="emits('error')"
153
152
  @opensetting="emits('opensetting', $event)"
154
153
  @launchapp="emits('launchapp', $event)"
155
154
  @chooseavatar="emits('chooseavatar', $event)"
@@ -176,7 +175,7 @@ function handleClick(e: any) {
176
175
  @getphonenumber="emits('getphonenumber', $event)"
177
176
  @getrealtimephonenumber="emits('getrealtimephonenumber', $event)"
178
177
  @agreeprivacyauthorization="emits('agreeprivacyauthorization', $event)"
179
- @error="emits('error', $event)"
178
+ @error="emits('error')"
180
179
  @opensetting="emits('opensetting', $event)"
181
180
  @launchapp="emits('launchapp', $event)"
182
181
  @chooseavatar="emits('chooseavatar', $event)"
@@ -6,6 +6,7 @@ import utils from '../../utils/utils';
6
6
  import propsData, { RADIO_KEY, type RadioEmits } from './props';
7
7
  import type { RadioGroupProps } from '../ste-radio-group/props';
8
8
  import { useInject } from '../../utils/mixin';
9
+
9
10
  const componentName = `ste-radio`;
10
11
  defineOptions({
11
12
  name: componentName,
@@ -21,83 +22,97 @@ const Parent = useInject<{ props: Required<RadioGroupProps>; updateValue: (value
21
22
 
22
23
  const parentProps = computed(() => Parent?.parent?.props);
23
24
 
24
- const cmpReadonly = computed(() => getDefaultData('readonly', false));
25
- const cmpShape = computed(() => getDefaultData('shape', 'circle'));
26
- const cmpIconSize = computed(() => getDefaultData('iconSize', 36));
27
- const cmpCheckedColor = computed(() => getDefaultData('checkedColor', getColor().steThemeColor));
28
- const cmpTextPosition = computed(() => getDefaultData('textPosition', 'right'));
29
- const cmpTextSize = computed(() => getDefaultData('textSize', 28));
30
- const cmpTextInactiveColor = computed(() => getDefaultData('textInactiveColor', '#000000'));
31
- const cmpTextActiveColor = computed(() => getDefaultData('textActiveColor', '#000000'));
32
- const cmpTextDisabled = computed(() => getDefaultData('textDisabled', false));
33
- const cmpMarginLeft = computed(() => getDefaultData('marginLeft', '0'));
34
- const cmpMarginRight = computed(() => getDefaultData('marginRight', '0'));
35
- const cmpColumnGap = computed(() => getDefaultData('columnGap', '16'));
36
- const cmpDisabled = computed(() => getDefaultData('disabled', false));
37
- const cmpSlotProps = computed(() => ({ checked: cmpChecked.value, disabled: cmpDisabled.value, readonly: cmpReadonly.value }));
25
+ // 🚀 优化: 缓存 themeColor,避免每次调用 getColor()
26
+ const themeColor = getColor().steThemeColor;
27
+
28
+ // 🚀 优化: 只保留必要的 computed
29
+ const cmpChecked = computed(() => {
30
+ return parentProps.value ? parentProps.value.modelValue == props.name : props.modelValue == props.name;
31
+ });
38
32
 
33
+ // 🚀 优化: 合并所有样式计算,直接调用 getDefaultData
39
34
  const cmpRootStyle = computed(() => {
40
- let style: CSSProperties = {};
41
- style['fontSize'] = `var(--font-size-${cmpTextSize.value},${utils.formatPx(cmpTextSize.value)})`;
42
- style['color'] = cmpChecked.value ? cmpTextActiveColor.value : cmpTextInactiveColor.value;
43
- style['flexDirection'] = cmpTextPosition.value == 'right' ? 'row' : 'row-reverse';
44
- style['marginLeft'] = utils.formatPx(cmpMarginLeft.value);
45
- style['marginRight'] = utils.formatPx(cmpMarginRight.value);
35
+ const textSize = getDefaultData('textSize', 28);
36
+ const textPosition = getDefaultData('textPosition', 'right');
37
+ const readonly = getDefaultData('readonly', false);
38
+ const disabled = getDefaultData('disabled', false);
39
+ const textDisabled = getDefaultData('textDisabled', false);
40
+
41
+ const style: CSSProperties = {
42
+ fontSize: `var(--font-size-${textSize},${utils.formatPx(textSize)})`,
43
+ color: cmpChecked.value ? getDefaultData('textActiveColor', '#000000') : getDefaultData('textInactiveColor', '#000000'),
44
+ flexDirection: textPosition === 'right' ? 'row' : 'row-reverse',
45
+ marginLeft: utils.formatPx(getDefaultData('marginLeft', '0')),
46
+ marginRight: utils.formatPx(getDefaultData('marginRight', '0')),
47
+ };
48
+
46
49
  // #ifdef H5
47
- if (cmpDisabled.value || cmpReadonly.value) {
50
+ if (disabled || readonly) {
48
51
  style['cursor'] = 'not-allowed';
49
- } else if (cmpTextDisabled.value) {
52
+ } else if (textDisabled) {
50
53
  style['cursor'] = 'default';
51
54
  } else {
52
55
  style['cursor'] = 'pointer';
53
56
  }
54
57
  // #endif
55
- if (cmpTextDisabled.value) {
58
+
59
+ if (textDisabled) {
56
60
  style['pointerEvents'] = 'none';
57
61
  }
58
62
  return style;
59
63
  });
60
64
 
61
65
  const cmpIconStyle = computed(() => {
62
- let style: CSSProperties = {};
63
- style['marginRight'] = utils.formatPx(cmpColumnGap.value);
64
- return style;
66
+ return {
67
+ marginRight: utils.formatPx(getDefaultData('columnGap', '16')),
68
+ } as CSSProperties;
65
69
  });
66
70
 
67
71
  const cmpInputStyle = computed(() => {
68
- let style: CSSProperties = {};
69
- // 没有icon 则默认样式
70
- style['borderRadius'] = cmpShape.value == 'circle' ? '50%' : '0';
71
- style['border'] = `${utils.formatPx(2)} solid ${cmpChecked.value ? cmpCheckedColor.value : '#BBBBBB'}`;
72
- style['background'] = cmpChecked.value ? cmpCheckedColor.value : '#FFFFFF';
73
- style['width'] = `var(--font-size-${cmpIconSize.value},${utils.formatPx(cmpIconSize.value)})`;
74
- style['height'] = `var(--font-size-${cmpIconSize.value},${utils.formatPx(cmpIconSize.value)})`;
75
- style['lineHeight'] = `var(--font-size-${cmpIconSize.value},${utils.formatPx(cmpIconSize.value)})`;
72
+ const shape = getDefaultData('shape', 'circle');
73
+ const iconSize = getDefaultData('iconSize', 36);
74
+ const checkedColor = getDefaultData('checkedColor', themeColor);
75
+ const readonly = getDefaultData('readonly', false);
76
+ const disabled = getDefaultData('disabled', false);
77
+ const checked = cmpChecked.value;
78
+
79
+ const style: CSSProperties = {
80
+ borderRadius: shape === 'circle' ? '50%' : '0',
81
+ border: `${utils.formatPx(2)} solid ${checked ? checkedColor : '#BBBBBB'}`,
82
+ background: checked ? checkedColor : '#FFFFFF',
83
+ width: `var(--font-size-${iconSize},${utils.formatPx(iconSize)})`,
84
+ height: `var(--font-size-${iconSize},${utils.formatPx(iconSize)})`,
85
+ lineHeight: `var(--font-size-${iconSize},${utils.formatPx(iconSize)})`,
86
+ };
87
+
76
88
  // #ifdef H5
77
- if (cmpDisabled.value || cmpReadonly.value) {
78
- style['cursor'] = 'not-allowed';
79
- } else {
80
- style['cursor'] = 'pointer';
81
- }
89
+ style['cursor'] = disabled || readonly ? 'not-allowed' : 'pointer';
82
90
  // #endif
83
- if (cmpDisabled.value) {
91
+
92
+ if (disabled) {
84
93
  style['background'] = '#eeeeee';
85
94
  style['borderColor'] = '#bbbbbb';
86
95
  }
87
96
 
88
97
  // 在没有使用插槽内容时去掉边距
89
98
  if (!slots.default) {
90
- style['columnGap'] = 0;
99
+ style['columnGap'] = '0';
91
100
  }
92
101
  return style;
93
102
  });
94
103
 
95
- const cmpChecked = computed(() => {
96
- return parentProps.value ? parentProps.value.modelValue == props.name : props.modelValue == props.name;
97
- });
104
+ // 🚀 优化: slotProps 也直接计算
105
+ const cmpSlotProps = computed(() => ({
106
+ checked: cmpChecked.value,
107
+ disabled: getDefaultData('disabled', false),
108
+ readonly: getDefaultData('readonly', false),
109
+ }));
98
110
 
99
111
  async function click() {
100
- if (!cmpDisabled.value && !cmpReadonly.value) {
112
+ const readonly = getDefaultData('readonly', false);
113
+ const disabled = getDefaultData('disabled', false);
114
+
115
+ if (!disabled && !readonly) {
101
116
  let next = true;
102
117
  const stop = new Promise((resolve, reject) => {
103
118
  emits(
@@ -128,20 +143,11 @@ async function click() {
128
143
  }
129
144
  }
130
145
 
131
- type PropsKeyTypee = keyof typeof props;
132
- function getDefaultData(key: PropsKeyTypee, value: any) {
133
- try {
134
- if (Object.prototype.hasOwnProperty.call(props, key)) {
135
- if (props[key]) {
136
- return props[key];
137
- } else {
138
- return value;
139
- }
140
- }
141
- } catch (e) {
142
- return value;
143
- }
144
- }
146
+ type PropsKeyType = keyof typeof props;
147
+ const getDefaultData = <T,>(key: PropsKeyType, defaultValue: T): T => {
148
+ const value = props[key];
149
+ return value !== undefined && value !== '' ? (value as T) : defaultValue;
150
+ };
145
151
  </script>
146
152
 
147
153
  <template>
@@ -149,7 +155,7 @@ function getDefaultData(key: PropsKeyTypee, value: any) {
149
155
  <view class="icon" :style="[cmpIconStyle]">
150
156
  <slot name="icon" :slotProps="cmpSlotProps">
151
157
  <view class="input-icon" :style="[cmpInputStyle]">
152
- <ste-icon v-if="cmpChecked && cmpIconSize" :size="cmpIconSize * 0.8" code="&#xe67a;" :color="cmpDisabled ? '#bbbbbb' : '#fff'" bold></ste-icon>
158
+ <ste-icon v-if="cmpChecked" :size="getDefaultData('iconSize', 36) * 0.8" code="&#xe67a;" :color="getDefaultData('disabled', false) ? '#bbbbbb' : '#fff'" bold></ste-icon>
153
159
  </view>
154
160
  </slot>
155
161
  </view>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stellar-ui-plus",
3
- "version": "1.22.24",
3
+ "version": "1.22.26",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "MIT",