vary-ui 3.22.46 → 3.22.50

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.
Files changed (47) hide show
  1. package/dist/{Loading-BKbyQIb2.js → Loading-D2Ra4DKv.js} +2 -2
  2. package/dist/{Wrap-DzLByCXj.js → Wrap-D0FSa0EY.js} +1 -1
  3. package/dist/lib/Button/Button.js +13 -13
  4. package/dist/lib/Card/Card.js +2 -2
  5. package/dist/lib/Checkbox/Checkbox.js +7 -6
  6. package/dist/lib/CheckboxGroup/CheckboxGroup.js +2 -2
  7. package/dist/lib/Confirm/Confirm.js +5 -10
  8. package/dist/lib/Date/Date.js +135 -121
  9. package/dist/lib/Dialog/Dialog.js +5 -4
  10. package/dist/lib/Divider/Divider.js +1 -1
  11. package/dist/lib/Form/Form.js +2 -3
  12. package/dist/lib/FormItem/FormItem.js +3 -3
  13. package/dist/lib/Input/Input.js +14 -13
  14. package/dist/lib/Link/Link.js +10 -10
  15. package/dist/lib/Loading/Loading.js +3 -3
  16. package/dist/lib/Menu/Menu.js +124 -97
  17. package/dist/lib/Message/Message.js +2 -2
  18. package/dist/lib/Pagination/Pagination.js +11 -12
  19. package/dist/lib/Popover/Popover.js +22 -9
  20. package/dist/lib/Radio/Radio.js +2 -2
  21. package/dist/lib/RadioButton/RadioButton.js +2 -2
  22. package/dist/lib/RadioGroup/RadioGroup.js +1 -1
  23. package/dist/lib/Scene/Scene.js +2 -2
  24. package/dist/lib/Scroll/Scroll.js +2 -2
  25. package/dist/lib/Select/Select.js +236 -117
  26. package/dist/lib/Skeleton/Skeleton.js +1 -1
  27. package/dist/lib/Tab/Tab.js +1 -1
  28. package/dist/lib/Table/Table.js +264 -229
  29. package/dist/lib/TableColumn/TableColumn.js +1 -1
  30. package/dist/lib/Tabs/Tabs.js +2 -2
  31. package/dist/types/index.d.ts +2 -1
  32. package/dist/types/lib/Button/Button.vue.d.ts +24 -22
  33. package/dist/types/lib/Date/Date.vue.d.ts +8 -8
  34. package/dist/types/lib/Input/Input.vue.d.ts +2 -2
  35. package/dist/types/lib/InputNumber/InputNumber.vue.d.ts +92 -0
  36. package/dist/types/lib/Link/Link.vue.d.ts +18 -16
  37. package/dist/types/lib/Menu/Menu.vue.d.ts +2 -2
  38. package/dist/types/lib/Scene/Scene.vue.d.ts +2 -2
  39. package/dist/types/lib/Select/Select.vue.d.ts +6 -6
  40. package/dist/vary-ui.css +1 -1
  41. package/dist/vary-ui.js +231 -19
  42. package/package.json +1 -1
  43. package/dist/types/src/main.d.ts +0 -3
  44. /package/dist/{_plugin-vue_export-helper-D7Ud-N38.js → _plugin-vue_export-helper-BXzNjKnu.js} +0 -0
  45. /package/dist/{_tslib-DdKtBmML.js → _tslib-DlAW9n5F.js} +0 -0
  46. /package/dist/{config-CzBnUX60.js → config-B07fLkJm.js} +0 -0
  47. /package/dist/{utils-BBP7kr-V.js → utils-CKmXyjAy.js} +0 -0
@@ -1,8 +1,9 @@
1
1
  import { defineComponent, ref, computed, inject, watch, createVNode } from 'vue';
2
- import { W as Wrap } from '../../Wrap-DzLByCXj.js';
3
- import { c as isFun } from '../../utils-BBP7kr-V.js';
4
- import { c as config } from '../../config-CzBnUX60.js';
5
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D7Ud-N38.js';
2
+ import { W as Wrap } from '../../Wrap-D0FSa0EY.js';
3
+ import { c as isFun } from '../../utils-CKmXyjAy.js';
4
+ import { c as config } from '../../config-B07fLkJm.js';
5
+ import { Icon } from '@iconify/vue';
6
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-BXzNjKnu.js';
6
7
 
7
8
  var _sfc_main = /* @__PURE__ */ defineComponent({
8
9
  props: {
@@ -16,7 +17,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
16
17
  },
17
18
  clearable: {
18
19
  type: Boolean,
19
- defalut: false
20
+ default: false
20
21
  },
21
22
  prefix: {
22
23
  type: String,
@@ -94,10 +95,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
94
95
  const validateField = inject("validateField", (event, v) => {}); // 触发校验事件
95
96
  const inputValue = ref("");
96
97
  if (_props.modelValue) {
97
- inputValue.value = _props.modelValue === null || _props.modelValue == undefined ? "" : _props.modelValue + "";
98
+ inputValue.value = _props.modelValue === null || _props.modelValue === undefined ? "" : _props.modelValue + "";
98
99
  }
99
100
  watch(() => _props.modelValue, v => {
100
- inputValue.value = v === null || v == undefined ? "" : v + "";
101
+ inputValue.value = v === null || v === undefined ? "" : v + "";
101
102
  validateField("change", v + "");
102
103
  validateField("input", v + "");
103
104
  });
@@ -208,17 +209,17 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
208
209
  "onClick": e => {
209
210
  emitClear();
210
211
  }
211
- }, [createVNode("span", {
212
- "class": "icon-close-round-fill"
212
+ }, [createVNode(Icon, {
213
+ "icon": "mdi:close-circle"
213
214
  }, null)]), !_props.disabled && !_props.readonly && _props.type === "password" && createVNode("div", {
214
215
  "class": "v_input_eye",
215
216
  "onClick": () => {
216
217
  eyeOpen.value = !eyeOpen.value;
217
218
  }
218
- }, [eyeOpen.value ? createVNode("span", {
219
- "class": "icon-eye"
220
- }, null) : createVNode("span", {
221
- "class": "icon-eye-off"
219
+ }, [eyeOpen.value ? createVNode(Icon, {
220
+ "icon": "mdi:eye"
221
+ }, null) : createVNode(Icon, {
222
+ "icon": "mdi:eye-off"
222
223
  }, null)])],
223
224
  prefix: _slots.prefix,
224
225
  suffix: _slots.suffix
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, computed, createVNode } from 'vue';
2
- import { c as config } from '../../config-CzBnUX60.js';
2
+ import { c as config } from '../../config-B07fLkJm.js';
3
3
  import { Icon } from '@iconify/vue';
4
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D7Ud-N38.js';
4
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-BXzNjKnu.js';
5
5
 
6
6
  var _sfc_main = /* @__PURE__ */ defineComponent({
7
7
  props: {
@@ -12,35 +12,35 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
12
12
  // primary, success, danger, warning, info
13
13
  primary: {
14
14
  type: Boolean,
15
- defalut: false
15
+ default: false
16
16
  },
17
17
  success: {
18
18
  type: Boolean,
19
- defalut: false
19
+ default: false
20
20
  },
21
21
  danger: {
22
22
  type: Boolean,
23
- defalut: false
23
+ default: false
24
24
  },
25
25
  warning: {
26
26
  type: Boolean,
27
- defalut: false
27
+ default: false
28
28
  },
29
29
  info: {
30
30
  type: Boolean,
31
- defalut: false
31
+ default: false
32
32
  },
33
33
  disabled: {
34
34
  type: Boolean,
35
- defalut: false
35
+ default: false
36
36
  },
37
37
  size: {
38
38
  type: String,
39
- defalut: ""
39
+ default: ""
40
40
  },
41
41
  icon: {
42
42
  type: String,
43
- defalut: ""
43
+ default: ""
44
44
  }
45
45
  },
46
46
  emits: ["click"],
@@ -1,7 +1,7 @@
1
1
  import { shallowRef, createApp, h } from 'vue';
2
- import { L as Loading } from '../../Loading-BKbyQIb2.js';
3
- import { c as config } from '../../config-CzBnUX60.js';
4
- import '../../_plugin-vue_export-helper-D7Ud-N38.js';
2
+ import { L as Loading } from '../../Loading-D2Ra4DKv.js';
3
+ import { c as config } from '../../config-B07fLkJm.js';
4
+ import '../../_plugin-vue_export-helper-BXzNjKnu.js';
5
5
 
6
6
  const defaultOptions = {
7
7
  lock: false,
@@ -1,7 +1,6 @@
1
- import { defineComponent, ref, watch, createVNode } from 'vue';
2
- import { k as debounce } from '../../utils-BBP7kr-V.js';
3
- import Scroll from '../Scroll/Scroll.js';
4
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D7Ud-N38.js';
1
+ import { defineComponent, ref, computed, watch, createVNode } from 'vue';
2
+ import { Icon } from '@iconify/vue';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-BXzNjKnu.js';
5
4
 
6
5
  var _sfc_main = /* @__PURE__ */ defineComponent({
7
6
  props: {
@@ -37,123 +36,151 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
37
36
  slots: _slots,
38
37
  emit: _emit
39
38
  }) {
40
- const expandNodeKeys = ref([]);
39
+ const expandNodeKeys = ref(new Set());
41
40
  const activeNodeKey = ref("");
42
41
  const rowKey = _props.rowKey || "key";
43
- const data = [..._props.data];
44
- const allRows = [];
45
- const initData = debounce(function () {
46
- if (_props.data.length = -0) return;
47
- function p(rows, __chain = "") {
48
- rows.forEach(d => {
49
- d.__chain = __chain ? __chain + "---" + d[rowKey] : d[rowKey];
50
- allRows.push(d);
51
- if (d.children) p(d.children, d.__chain);
52
- });
42
+ // 响应式数据
43
+ const menuData = computed(() => _props.data || []);
44
+ // 扁平化所有节点,用于查找
45
+ const flattenNodes = (nodes, parentChain = []) => {
46
+ const result = [];
47
+ nodes.forEach(node => {
48
+ const key = node[rowKey];
49
+ const chain = [...parentChain, key];
50
+ result.push(Object.assign(Object.assign({}, node), {
51
+ __chain: chain
52
+ }));
53
+ if (node.children && node.children.length > 0) {
54
+ result.push(...flattenNodes(node.children, chain));
55
+ }
56
+ });
57
+ return result;
58
+ };
59
+ // 查找节点的所有父节点key
60
+ const findParentKeys = targetKey => {
61
+ const allNodes = flattenNodes(menuData.value);
62
+ const targetNode = allNodes.find(node => node[rowKey] === targetKey);
63
+ if (targetNode && targetNode.__chain) {
64
+ // 返回除了自己之外的所有父节点
65
+ return targetNode.__chain.slice(0, -1);
53
66
  }
54
- p(data);
55
- updateActiveKey(_props.modelValue.toString());
56
- updateExpandNode(_props.modelValue.toString());
57
- }, 100);
58
- function updateActiveKey(key) {
59
- activeNodeKey.value = key;
60
- }
61
- function updateExpandNode(key) {
67
+ return [];
68
+ };
69
+ // 初始化展开状态
70
+ const initExpandState = () => {
62
71
  if (_props.defaultOpenAll) {
63
- // 设置了展开全部
64
- expandNodeKeys.value = allRows.map(d => d[rowKey]);
72
+ // 默认展开全部有子节点的项
73
+ const allNodes = flattenNodes(menuData.value);
74
+ const keysWithChildren = allNodes.filter(node => node.children && node.children.length > 0).map(node => node[rowKey]);
75
+ expandNodeKeys.value = new Set(keysWithChildren);
76
+ } else if (_props.modelValue) {
77
+ // 根据modelValue展开到对应路径
78
+ const parentKeys = findParentKeys(_props.modelValue);
79
+ expandNodeKeys.value = new Set(parentKeys);
80
+ } else {
81
+ expandNodeKeys.value = new Set();
82
+ }
83
+ };
84
+ // 初始化激活状态
85
+ const initActiveState = () => {
86
+ activeNodeKey.value = _props.modelValue || "";
87
+ };
88
+ // 处理菜单项点击
89
+ const handleItemClick = item => {
90
+ const key = item[rowKey];
91
+ // 触发menu-click事件
92
+ _emit("menu-click", item);
93
+ // 如果是叶子节点(没有children),设置为激活
94
+ if (!item.children || item.children.length === 0) {
95
+ activeNodeKey.value = key;
96
+ _emit("update:model-value", key);
97
+ _emit("change", key, item);
65
98
  return;
66
99
  }
67
- // 根据modelValue更新
68
- // console.log(allRows);
69
- const findOne = allRows.find(d => d[rowKey] == key);
70
- if (findOne) {
71
- expandNodeKeys.value = findOne.__chain.split("---");
100
+ // 有子节点,处理展开/收起
101
+ const isExpanded = expandNodeKeys.value.has(key);
102
+ if (_props.onlyOneOpen) {
103
+ // 只允许一个展开项
104
+ if (isExpanded) {
105
+ // 当前已展开,关闭它
106
+ expandNodeKeys.value.clear();
107
+ _emit("menu-close", item);
108
+ } else {
109
+ // 当前未展开,关闭其他所有项,展开当前项
110
+ expandNodeKeys.value.clear();
111
+ expandNodeKeys.value.add(key);
112
+ _emit("menu-open", item);
113
+ }
72
114
  } else {
73
- expandNodeKeys.value = [];
115
+ // 允许多个展开项
116
+ if (isExpanded) {
117
+ // 当前已展开,关闭它
118
+ expandNodeKeys.value.delete(key);
119
+ _emit("menu-close", item);
120
+ } else {
121
+ // 当前未展开,展开它
122
+ expandNodeKeys.value.add(key);
123
+ _emit("menu-open", item);
124
+ }
125
+ }
126
+ };
127
+ // 监听modelValue变化
128
+ watch(() => _props.modelValue, newValue => {
129
+ activeNodeKey.value = newValue || "";
130
+ if (!_props.defaultOpenAll && newValue) {
131
+ // 根据新的modelValue更新展开状态
132
+ const parentKeys = findParentKeys(newValue);
133
+ expandNodeKeys.value = new Set(parentKeys);
74
134
  }
75
- // console.log(expandNodeKeys.value);
76
- }
77
- watch(() => _props.modelValue, v => {
78
- initData();
79
135
  }, {
80
136
  immediate: true
81
137
  });
82
- watch(() => _props.modelValue, v => {
83
- initData();
138
+ // 监听data变化
139
+ watch(() => _props.data, () => {
140
+ initExpandState();
141
+ initActiveState();
84
142
  }, {
85
- immediate: true
143
+ immediate: true,
144
+ deep: true
145
+ });
146
+ // 监听defaultOpenAll变化
147
+ watch(() => _props.defaultOpenAll, () => {
148
+ initExpandState();
86
149
  });
87
150
  return () => {
88
- function renderNode(row, __level, _parent) {
89
- // console.log(rowKey, row[rowKey]);
90
- if (!row[rowKey]) {
91
- console.warn("Menu item miss key prop");
92
- }
93
- const isActive = (!row.children || row.children.length == 0) && activeNodeKey.value === row[rowKey];
94
- const isExpand = expandNodeKeys.value.includes(row[rowKey]);
151
+ // 渲染菜单节点
152
+ const renderMenuItem = (item, level = 1) => {
153
+ const key = item[rowKey];
154
+ const hasChildren = item.children && item.children.length > 0;
155
+ const isActive = !hasChildren && activeNodeKey.value === key;
156
+ const isExpanded = expandNodeKeys.value.has(key);
95
157
  return createVNode("div", {
96
- "class": [],
97
- "key": row[rowKey]
158
+ "key": key
98
159
  }, [createVNode("div", {
99
160
  "class": ["v_menu_item", {
100
161
  "v_menu_item--active": isActive,
101
- "v_menu_item--open": isExpand
162
+ "v_menu_item--open": isExpanded
102
163
  }],
103
164
  "style": {
104
- "padding-left": __level * 1 + "em"
165
+ paddingLeft: `${level * 1}em`
105
166
  },
106
- "onClick": e => {
107
- // 先触发事件
108
- _emit("menu-click", row);
109
- // 没有子菜单,
110
- if (!row.children || row.children.length == 0) {
111
- activeNodeKey.value = row[rowKey];
112
- _emit("update:model-value", row[rowKey]);
113
- _emit("change", row[rowKey], row);
114
- return;
115
- }
116
- // 有子菜单, 要看当前是否为展开状态
117
- if (_props.onlyOneOpen) {
118
- // 如果开启了只允许一个展开项, 直接赋值
119
- if (isExpand) {
120
- expandNodeKeys.value = [];
121
- _emit("menu-open", row);
122
- } else {
123
- expandNodeKeys.value = [row[rowKey]];
124
- _emit("menu-close", row);
125
- }
126
- return;
127
- }
128
- // 允许多个展开项
129
- if (isExpand) {
130
- // console.log(expandNodeKeys.value);
131
- expandNodeKeys.value = expandNodeKeys.value.filter(r => r !== row[rowKey]);
132
- _emit("menu-open", row);
133
- } else {
134
- expandNodeKeys.value.push(row[rowKey]);
135
- _emit("menu-close", row);
136
- }
137
- }
167
+ "onClick": () => handleItemClick(item)
138
168
  }, [createVNode("div", {
139
169
  "class": "v_menu_item_content"
140
- }, [_slots.default ? _slots.default(row) : createVNode("div", {
170
+ }, [_slots.default ? _slots.default(item) : createVNode("div", {
141
171
  "class": "v_menu_item_text"
142
- }, [row.title])]), row.children && row.children.length > 0 && createVNode("span", {
143
- "class": "icon-arrow-right"
144
- }, null)]), isExpand && row.children && row.children.length > 0 && createVNode("div", {
145
- "class": ["v_menu_children", {
146
- "v_menu_children--open": isExpand
147
- }]
148
- }, [row.children.map(r => renderNode(r, __level + 1))])]);
149
- }
150
- return createVNode(Scroll, {
151
- "class": "v_menu"
152
- }, {
153
- default: () => [createVNode("div", {
154
- "class": "v_menu_body"
155
- }, [data.map(r => renderNode(r, 1))])]
156
- });
172
+ }, [item.title])]), hasChildren && createVNode(Icon, {
173
+ "icon": "mdi:chevron-right",
174
+ "class": "v_menu_item_arrow"
175
+ }, null)]), hasChildren && isExpanded && createVNode("div", {
176
+ "class": "v_menu_children"
177
+ }, [item.children.map(child => renderMenuItem(child, level + 1))])]);
178
+ };
179
+ return createVNode("div", {
180
+ "class": "v_menu v_menu_scroll_container"
181
+ }, [createVNode("div", {
182
+ "class": "v_menu_body"
183
+ }, [menuData.value.map(item => renderMenuItem(item, 1))])]);
157
184
  };
158
185
  }
159
186
  });
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, onMounted, h, createApp } from 'vue';
2
- import { c as config } from '../../config-CzBnUX60.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D7Ud-N38.js';
2
+ import { c as config } from '../../config-B07fLkJm.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-BXzNjKnu.js';
4
4
 
5
5
  var _sfc_main = defineComponent({
6
6
  props: {
@@ -1,15 +1,14 @@
1
1
  import { defineComponent, ref, watch, createVNode, createTextVNode } from 'vue';
2
2
  import Select from '../Select/Select.js';
3
- import { c as config } from '../../config-CzBnUX60.js';
4
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D7Ud-N38.js';
5
- import '../../_tslib-DdKtBmML.js';
6
- import '../../utils-BBP7kr-V.js';
3
+ import { c as config } from '../../config-B07fLkJm.js';
4
+ import { Icon } from '@iconify/vue';
5
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-BXzNjKnu.js';
6
+ import '../../_tslib-DlAW9n5F.js';
7
+ import '../../utils-CKmXyjAy.js';
7
8
  import '../Popover/Popover.js';
8
- import '../../Wrap-DzLByCXj.js';
9
- import '../Input/Input.js';
9
+ import '../../Wrap-D0FSa0EY.js';
10
10
  import '../Checkbox/Checkbox.js';
11
- import '../Scroll/Scroll.js';
12
- import '../../Loading-BKbyQIb2.js';
11
+ import '../../Loading-D2Ra4DKv.js';
13
12
 
14
13
  var _sfc_main = /* @__PURE__ */ defineComponent({
15
14
  props: {
@@ -148,8 +147,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
148
147
  changePage(pageNo.value - 1);
149
148
  }
150
149
  }
151
- }, [createVNode("span", {
152
- "class": "icon-arrow-left"
150
+ }, [createVNode(Icon, {
151
+ "icon": "mdi:chevron-left"
153
152
  }, null)]), showData.total > 0 && createVNode("div", {
154
153
  "class": ["v_pagination_item", "v_pagination_first", {
155
154
  "v_pagination_item--active": pageNo.value === 1
@@ -194,8 +193,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
194
193
  changePage(pageNo.value + 1);
195
194
  }
196
195
  }
197
- }, [createVNode("span", {
198
- "class": "icon-arrow-right"
196
+ }, [createVNode(Icon, {
197
+ "icon": "mdi:chevron-right"
199
198
  }, null)]), showData.total > 0 && _props.pageSizes && _props.pageSizes.length > 0 && createVNode(Select, {
200
199
  "modelValue": pageSize.value.toString(),
201
200
  "data": _props.pageSizes.map(p => {
@@ -1,5 +1,6 @@
1
1
  import { defineComponent, shallowRef, ref, reactive, watch, createVNode, Teleport, nextTick } from 'vue';
2
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D7Ud-N38.js';
2
+ import { t as throttle } from '../../utils-CKmXyjAy.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-BXzNjKnu.js';
3
4
 
4
5
  var _sfc_main = /* @__PURE__ */ defineComponent({
5
6
  props: {
@@ -49,6 +50,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
49
50
  "min-width": ""
50
51
  });
51
52
  const popOpen = ref(false);
53
+ // 节流的位置更新函数
54
+ const throttledUpdatePosition = throttle(() => {
55
+ if (popOpen.value) {
56
+ computedVerticlePosition();
57
+ }
58
+ }, 16); // 约 60fps
52
59
  function close(e) {
53
60
  if (e && e.target && e.target !== window && rootRef.value && rootRef.value.contains(e.target)) {
54
61
  return; // 如果是由组件内部元素触发的点击事件, 阻止关闭窗口
@@ -67,6 +74,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
67
74
  _emit("close");
68
75
  // 移除滚动事件
69
76
  window.removeEventListener("vary-scroll", throttleComputedVerticlePosition);
77
+ // 移除页面滚动和窗口大小变化监听
78
+ window.removeEventListener("scroll", throttledUpdatePosition, true);
79
+ window.removeEventListener("resize", throttledUpdatePosition);
70
80
  // 通过click触发的才需要移除监听事件
71
81
  _props.trigger === "click" && window.removeEventListener("click", close);
72
82
  }
@@ -82,8 +92,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
82
92
  _emit("update:model-value", true);
83
93
  _emit("change", true);
84
94
  _emit("open");
85
- // 添加滚动事件
86
- window.addEventListener("vary-scroll", throttleComputedVerticlePosition);
87
95
  // 打开弹窗后, 计算弹窗的尺寸
88
96
  nextTick().then(() => {
89
97
  // 输入框高度:
@@ -108,6 +116,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
108
116
  }
109
117
  }
110
118
  computedVerticlePosition();
119
+ // 添加页面滚动和窗口大小变化监听,实时更新位置
120
+ window.addEventListener("scroll", throttledUpdatePosition, true);
121
+ window.addEventListener("resize", throttledUpdatePosition);
111
122
  });
112
123
  // 200毫秒后, 添加全局事件, 点击窗口任意位置, 关闭下拉框
113
124
  // 如果是hover模式触发,鼠标移出组件范围会自动关闭
@@ -139,15 +150,16 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
139
150
  if (window.innerHeight - bodyRect.bottom > popRect.height) {
140
151
  // 如果下方空间足够,显示在下方
141
152
  popPosition.value = "bottom";
142
- popStyle.top = `${bodyRect.bottom + window.scrollY}px`;
153
+ // pop 使用的是 position: fixed,因此这里必须使用 viewport 坐标(不要叠加 scrollY
154
+ popStyle.top = `${bodyRect.bottom}px`;
143
155
  } else if (bodyRect.top > popRect.height) {
144
156
  // 如果上方空间足够,显示在上方
145
157
  popPosition.value = "top";
146
- popStyle.top = `${bodyRect.top + window.scrollY - popRect.height}px`;
158
+ popStyle.top = `${bodyRect.top - popRect.height}px`;
147
159
  } else {
148
160
  // 如果上下空间都不够,强制显示在下方
149
161
  popPosition.value = "bottom";
150
- popStyle.top = `${bodyRect.bottom + window.scrollY}px`;
162
+ popStyle.top = `${bodyRect.bottom}px`;
151
163
  }
152
164
  // 计算水平位置
153
165
  if (_props.align && ["left", "center", "right"].includes(_props.align)) {
@@ -165,15 +177,16 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
165
177
  // 设置水平位置
166
178
  switch (popAlign.value) {
167
179
  case "left":
168
- popStyle.left = `${bodyRect.left + window.scrollX}px`;
180
+ // pop 使用的是 position: fixed,因此这里必须使用 viewport 坐标(不要叠加 scrollX
181
+ popStyle.left = `${bodyRect.left}px`;
169
182
  popStyle.right = "";
170
183
  break;
171
184
  case "right":
172
- popStyle.right = `${window.innerWidth - bodyRect.right + window.scrollX}px`;
185
+ popStyle.right = `${window.innerWidth - bodyRect.right}px`;
173
186
  popStyle.left = "";
174
187
  break;
175
188
  case "center":
176
- popStyle.left = `${bodyRect.left + window.scrollX + (bodyRect.width - popRect.width) / 2}px`;
189
+ popStyle.left = `${bodyRect.left + (bodyRect.width - popRect.width) / 2}px`;
177
190
  popStyle.right = "";
178
191
  break;
179
192
  }
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, inject, ref, computed, createVNode } from 'vue';
2
- import { c as config } from '../../config-CzBnUX60.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D7Ud-N38.js';
2
+ import { c as config } from '../../config-B07fLkJm.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-BXzNjKnu.js';
4
4
 
5
5
  var _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  props: {
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, inject, ref, computed, createVNode } from 'vue';
2
- import { c as config } from '../../config-CzBnUX60.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D7Ud-N38.js';
2
+ import { c as config } from '../../config-B07fLkJm.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-BXzNjKnu.js';
4
4
 
5
5
  var _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  props: {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, provide, computed, createVNode } from 'vue';
2
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D7Ud-N38.js';
2
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-BXzNjKnu.js';
3
3
 
4
4
  var _sfc_main = /* @__PURE__ */ defineComponent({
5
5
  props: {
@@ -1,10 +1,10 @@
1
1
  import { defineComponent, computed, createElementBlock, openBlock, normalizeClass, renderSlot } from 'vue';
2
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D7Ud-N38.js';
2
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-BXzNjKnu.js';
3
3
 
4
4
  var _sfc_main = /*@__PURE__*/ defineComponent({
5
5
  __name: 'Scene',
6
6
  props: {
7
- flex: { type: Boolean, defalut: false },
7
+ flex: { type: Boolean, default: false },
8
8
  row: { type: Boolean, default: false }, // display:flex
9
9
  column: { type: Boolean, default: false }, // flex-direction: column
10
10
  wrap: { type: Boolean, default: false }, // flex-wrap:wrap
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, shallowRef, ref, onMounted, nextTick, onBeforeUnmount, createVNode } from 'vue';
2
- import { k as debounce } from '../../utils-BBP7kr-V.js';
3
- import { _ as _export_sfc } from '../../_plugin-vue_export-helper-D7Ud-N38.js';
2
+ import { k as debounce } from '../../utils-CKmXyjAy.js';
3
+ import { _ as _export_sfc } from '../../_plugin-vue_export-helper-BXzNjKnu.js';
4
4
 
5
5
  /**
6
6
  * note: