stellar-ui-plus 1.25.8 → 1.25.10

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.
@@ -31,6 +31,13 @@ const emits = defineEmits<{
31
31
  (e: 'update:modelValue', selectedValue: string | number | number[]): void;
32
32
  }>();
33
33
 
34
+ const viewloading = ref(false);
35
+
36
+ const initOptions = (values = selectedValue.value) => {
37
+ const { options } = getDateOptions(values, props.mode as DateMode, props.minDate, props.maxDate);
38
+ setDataOptions(options);
39
+ };
40
+
34
41
  watch(
35
42
  () => props.modelValue,
36
43
  v => {
@@ -43,17 +50,34 @@ watch(
43
50
  values = value.map(item => Number(item));
44
51
  }
45
52
  setSelectValue(values as number[]);
53
+ // modelValue外部变化时,同步刷新dataOptions与selectedIndex,
54
+ // 避免打开下拉时picker仍停留在旧值位置。
55
+ viewloading.value = true;
56
+ initOptions(values);
57
+ nextTick(() => {
58
+ const indexs: number[] = [];
59
+ const _values = getNowDate(values, props.mode as DateMode);
60
+ dataOptions.value.forEach((item, index) => {
61
+ let i = item.map(({ value }) => value).indexOf(_values[index]);
62
+ if (i === -1) {
63
+ i = _values[index] > item[item.length - 1].value ? item.length - 1 : 0;
64
+ }
65
+ indexs.push(i);
66
+ });
67
+ setSelectIndex(indexs);
68
+ // 当modelValue为空时,selectedValue也应该同步为当前日期,
69
+ // 并回传给父组件(useData的selected),否则点确定时value为undefined
70
+ if (!values.length) {
71
+ setSelectValue(indexs.map((i, index) => dataOptions.value[index][i].value));
72
+ emits('change', selectedValue.value);
73
+ emits('update:modelValue', selectedValue.value);
74
+ }
75
+ viewloading.value = false;
76
+ });
46
77
  },
47
78
  { immediate: true }
48
79
  );
49
80
 
50
- const initOptions = (values = selectedValue.value) => {
51
- const { options } = getDateOptions(values, props.mode as DateMode, props.minDate, props.maxDate);
52
- setDataOptions(options);
53
- };
54
-
55
- const viewloading = ref(false);
56
-
57
81
  const initSelectIndex = (values = selectedValue.value) => {
58
82
  viewloading.value = true;
59
83
  nextTick(() => {
@@ -91,9 +115,6 @@ watch([() => props.minDate, () => props.maxDate], () => {
91
115
  initOptions();
92
116
  initSelectIndex();
93
117
  });
94
-
95
- initOptions();
96
- initSelectIndex();
97
118
  </script>
98
119
  <template>
99
120
  <picker-view v-if="!viewloading" style="height: 450rpx; width: 100%" indicator-style="height: 43px" immediate-change :value="selectedIndex" @change="onChange">
@@ -0,0 +1,21 @@
1
+ ## API
2
+
3
+ ### Props
4
+ | 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
5
+ | ----- | ----- | --- | ------- | ------ | -------- |
6
+ | `modelValue` | 绑定的值,支持v-model双向绑定 | `string / number / null / undefined` | - | - | - |
7
+ | `list` | 选项数据,每个选项支持 disabled 属性设置单项禁止选择 | `SelectOption[]` | `[]` | - | - |
8
+ | `placeholder` | 占位符 | `string` | `请选择` | - | - |
9
+ | `labelKey` | 选项标签Key | `string` | `label` | - | - |
10
+ | `valueKey` | 选项值Key | `string` | `value` | - | - |
11
+ | `disabled` | 禁用状态 | `boolean` | `false` | - | - |
12
+ | `maskClose` | 点击遮罩层是否关闭弹窗 | `boolean` | `true` | - | - |
13
+
14
+
15
+ ### Events
16
+ | 事件名 | 说明 | 事件参数 | 支持版本 |
17
+ | ----- | ----- | ------- | -------- |
18
+ | `update:modelValue` | 选中值改变时触发 | `value`:选中的值 | - |
19
+ | `change` | 选中值改变时触发 | `value`:选中的值<br/>`option`:选中的选项对象 | - |
20
+
21
+
package/index.ts CHANGED
@@ -120,6 +120,8 @@ import steSearchBox from "./components/ste-search-box/ste-search-box.vue"
120
120
  export const SteSearchBox = steSearchBox
121
121
  import steSelect from "./components/ste-select/ste-select.vue"
122
122
  export const SteSelect = steSelect
123
+ import steSelectOrder from "./components/ste-select-order/ste-select-order.vue"
124
+ export const SteSelectOrder = steSelectOrder
123
125
  import steSelectSeat from "./components/ste-select-seat/ste-select-seat.vue"
124
126
  export const SteSelectSeat = steSelectSeat
125
127
  import steSignature from "./components/ste-signature/ste-signature.vue"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stellar-ui-plus",
3
- "version": "1.25.8",
3
+ "version": "1.25.10",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -13,4 +13,4 @@
13
13
  "test": "echo \"Error: no test specified\" && exit 1",
14
14
  "publish-vscode-plugin": "cd ../../../plugins/ste-helper & pnpm run publish"
15
15
  }
16
- }
16
+ }
@@ -59,6 +59,7 @@ import steScrollToItem from "../components/ste-scroll-to-item/ste-scroll-to-item
59
59
  import steSearch from "../components/ste-search/ste-search.vue"
60
60
  import steSearchBox from "../components/ste-search-box/ste-search-box.vue"
61
61
  import steSelect from "../components/ste-select/ste-select.vue"
62
+ import steSelectOrder from "../components/ste-select-order/ste-select-order.vue"
62
63
  import steSelectSeat from "../components/ste-select-seat/ste-select-seat.vue"
63
64
  import steSignature from "../components/ste-signature/ste-signature.vue"
64
65
  import steSimpleCalendar from "../components/ste-simple-calendar/ste-simple-calendar.vue"
@@ -155,6 +156,7 @@ import steWatermark from "../components/ste-watermark/ste-watermark.vue"
155
156
  SteSearch: typeof steSearch;
156
157
  SteSearchBox: typeof steSearchBox;
157
158
  SteSelect: typeof steSelect;
159
+ SteSelectOrder: typeof steSelectOrder;
158
160
  SteSelectSeat: typeof steSelectSeat;
159
161
  SteSignature: typeof steSignature;
160
162
  SteSimpleCalendar: typeof steSimpleCalendar;
@@ -59,6 +59,7 @@ import steScrollToItem from "../components/ste-scroll-to-item/ste-scroll-to-item
59
59
  import steSearch from "../components/ste-search/ste-search.vue"
60
60
  import steSearchBox from "../components/ste-search-box/ste-search-box.vue"
61
61
  import steSelect from "../components/ste-select/ste-select.vue"
62
+ import steSelectOrder from "../components/ste-select-order/ste-select-order.vue"
62
63
  import steSelectSeat from "../components/ste-select-seat/ste-select-seat.vue"
63
64
  import steSignature from "../components/ste-signature/ste-signature.vue"
64
65
  import steSimpleCalendar from "../components/ste-simple-calendar/ste-simple-calendar.vue"
@@ -150,6 +151,7 @@ export type RefScrollToItem = InstanceType<typeof steScrollToItem>
150
151
  export type RefSearch = InstanceType<typeof steSearch>
151
152
  export type RefSearchBox = InstanceType<typeof steSearchBox>
152
153
  export type RefSelect = InstanceType<typeof steSelect>
154
+ export type RefSelectOrder = InstanceType<typeof steSelectOrder>
153
155
  export type RefSelectSeat = InstanceType<typeof steSelectSeat>
154
156
  export type RefSignature = InstanceType<typeof steSignature>
155
157
  export type RefSimpleCalendar = InstanceType<typeof steSimpleCalendar>