stk-table-vue 0.6.17 → 0.7.1

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 (40) hide show
  1. package/README.md +211 -213
  2. package/lib/src/StkTable/StkTable.vue.d.ts +43 -24
  3. package/lib/src/StkTable/components/TriangleIcon.vue.d.ts +2 -0
  4. package/lib/src/StkTable/const.d.ts +0 -1
  5. package/lib/src/StkTable/types/highlightDimOptions.d.ts +1 -5
  6. package/lib/src/StkTable/types/index.d.ts +27 -7
  7. package/lib/src/StkTable/useHighlight.d.ts +1 -1
  8. package/lib/src/StkTable/useRowExpand.d.ts +17 -0
  9. package/lib/src/StkTable/useTree.d.ts +20 -0
  10. package/lib/src/StkTable/utils/index.d.ts +3 -1
  11. package/lib/stk-table-vue.js +320 -167
  12. package/lib/style.css +29 -20
  13. package/package.json +74 -75
  14. package/src/StkTable/StkTable.vue +1557 -1550
  15. package/src/StkTable/components/DragHandle.vue +9 -9
  16. package/src/StkTable/components/SortIcon.vue +6 -6
  17. package/src/StkTable/components/TriangleIcon.vue +3 -0
  18. package/src/StkTable/const.ts +37 -37
  19. package/src/StkTable/index.ts +4 -4
  20. package/src/StkTable/style.less +567 -553
  21. package/src/StkTable/types/highlightDimOptions.ts +26 -26
  22. package/src/StkTable/types/index.ts +260 -239
  23. package/src/StkTable/useAutoResize.ts +91 -91
  24. package/src/StkTable/useColResize.ts +216 -216
  25. package/src/StkTable/useFixedCol.ts +148 -148
  26. package/src/StkTable/useFixedStyle.ts +75 -75
  27. package/src/StkTable/useGetFixedColPosition.ts +65 -65
  28. package/src/StkTable/useHighlight.ts +320 -318
  29. package/src/StkTable/useKeyboardArrowScroll.ts +112 -112
  30. package/src/StkTable/useRowExpand.ts +78 -0
  31. package/src/StkTable/useThDrag.ts +102 -102
  32. package/src/StkTable/useTrDrag.ts +118 -118
  33. package/src/StkTable/useTree.ts +158 -0
  34. package/src/StkTable/useVirtualScroll.ts +462 -462
  35. package/src/StkTable/utils/constRefUtils.ts +29 -29
  36. package/src/StkTable/utils/index.ts +224 -212
  37. package/src/StkTable/utils/useTriggerRef.ts +33 -33
  38. package/src/VirtualTree.vue +622 -622
  39. package/src/VirtualTreeSelect.vue +367 -367
  40. package/src/vite-env.d.ts +10 -10
@@ -1,367 +1,367 @@
1
- <template>
2
- <div class="v-tree-select-wrapper" :class="{ disabled: disabled }">
3
- <!-- <input type="text" @click="onInputClick($event)" /> -->
4
- <div class="tree-select-main" :class="{ expand: showDropdown }" @click="onInputClick">
5
- <div class="tree-select-main-label" :class="{ placeholder: !selectedLabel }" :title="selectedLabel">
6
- {{ selectedLabel || placeholder }}
7
- </div>
8
- <div class="tree-select-main-arrow"></div>
9
- </div>
10
- <Teleport :to="renderDropdownToBody ? body : void 0" :disabled="!renderDropdownToBody">
11
- <!-- VirtualTreeSelect下拉框 -->
12
- <div v-if="vIfLoadComponent" v-show="!disabled && showDropdown" class="dropdown-menu" :style="dropdownMenuStyle">
13
- <VirtualTree
14
- ref="virtualTree"
15
- v-bind="vsTreeProps"
16
- height="100%"
17
- :replace-fields="assignedFields"
18
- :tree-data="treeDataClone"
19
- @item-click="onTreeItemClick"
20
- />
21
- </div>
22
- </Teleport>
23
- <!-- 遮罩:用于点击区域外关闭 -->
24
- <div v-if="!disabled && showDropdown" class="dropdown-mask" :style="{ zIndex: zIndex }" @click="showDropdown = false"></div>
25
- </div>
26
- </template>
27
- <script>
28
- /** 不支持v-model 只能通过 :value + change事件更新 */
29
- import VirtualTree from './VirtualTree.vue';
30
-
31
- const _defaultFields = {
32
- key: 'key',
33
- title: 'title',
34
- children: 'children',
35
- };
36
- export default {
37
- components: { VirtualTree },
38
- props: {
39
- value: {
40
- type: String,
41
- default: '',
42
- },
43
- /** 下拉框高度 */
44
- dropdownHeight: {
45
- type: Number,
46
- default: 240, // 8行
47
- },
48
- /** 下拉框宽度 */
49
- dropdownWidth: {
50
- type: Number,
51
- default: null,
52
- },
53
- /** 下拉菜单与下拉框间的距离 */
54
- dropdownSpace: {
55
- type: Number,
56
- default: 2,
57
- },
58
- /** 格式化选中展示的label */
59
- labelFormatter: {
60
- type: Function,
61
- default: null,
62
- },
63
- /** 下拉框的z-index */
64
- zIndex: {
65
- type: Number,
66
- default: 10,
67
- },
68
- placeholder: {
69
- type: String,
70
- default: '请选择',
71
- },
72
- treeData: {
73
- type: Array,
74
- default: () => [],
75
- },
76
- /** 是否禁用 */
77
- disabled: Boolean,
78
- /** 替换数据title,key,children字段 */
79
- replaceFields: {
80
- type: Object,
81
- default: () => _defaultFields,
82
- },
83
- /** VirtualScrollTree 的prop*/
84
- vsTreeProps: {
85
- type: Object,
86
- default: () => ({}),
87
- },
88
- /** 是否把dropdown挂载在body */
89
- renderDropdownToBody: {
90
- type: Boolean,
91
- default: false,
92
- },
93
- },
94
- data() {
95
- return {
96
- dropdownMenuStyle: {},
97
- showDropdown: false,
98
- /** 展开下拉框时才加载组件 */
99
- vIfLoadComponent: false,
100
- /** 保存的prop value */
101
- storedValue: null,
102
- /** 记录下次打开下拉框时,是否需要执行这些操作1.高亮2.展开父节点3.滚动至选中的位置 */
103
- resetVTree: false,
104
- };
105
- },
106
- computed: {
107
- treeDataClone() {
108
- return [...this.treeData];
109
- },
110
- /** 合并传入的fields */
111
- assignedFields() {
112
- return Object.assign({}, _defaultFields, this.replaceFields);
113
- },
114
- selectedLabel() {
115
- let label = '';
116
- const item = this.getItemByKey(this.storedValue);
117
- if (item) {
118
- if (this.labelFormatter) {
119
- label = this.labelFormatter(item);
120
- } else {
121
- label = item[this.assignedFields.title];
122
- }
123
- }
124
- return label || this.storedValue;
125
- },
126
- },
127
- watch: {
128
- value(v) {
129
- this.storedValue = v;
130
- // this.$refs.virtualTree?.setCurrent(v);
131
- // this.$refs.virtualTree?.expandItem([v] /* , { foldOthers: true } */);
132
- },
133
- },
134
- mounted() {
135
- this.storedValue = this.value;
136
- },
137
- methods: {
138
- onInputClick(e) {
139
- if (this.disabled) return;
140
- if (!this.vIfLoadComponent || this.resetVTree) {
141
- this.vIfLoadComponent = true;
142
- this.resetVTree = false;
143
- this.$nextTick(() => {
144
- this.$refs.virtualTree?.setCurrent(this.storedValue);
145
- this.$refs.virtualTree?.expandItem([this.storedValue] /* , { foldOthers: true } */);
146
- this.$refs.virtualTree?.scrollTo(this.storedValue); // 滚动至
147
- });
148
- }
149
-
150
- this.setDropdownMenuStyle(e);
151
- this.showDropdown = !this.showDropdown;
152
- this.$nextTick(() => {
153
- this.$refs.virtualTree.resize();
154
- });
155
- },
156
- onTreeItemClick(item) {
157
- this.showDropdown = false;
158
- this.$emit('change', item);
159
- },
160
- // -----------
161
- /**
162
- * 设置下拉框从上方弹出还是下方
163
- */
164
- setDropdownMenuStyle() {
165
- const { innerWidth, innerHeight } = window;
166
- /** @type {DOMRect} */
167
- const rect = this.$el.getBoundingClientRect();
168
- const bottom = innerHeight - rect.top - rect.height;
169
- const dropdownWidth = this.dropdownWidth ? this.dropdownWidth : rect.width;
170
- // reset style
171
- this.dropdownMenuStyle = {
172
- position: 'absolute',
173
- width: dropdownWidth + 'px',
174
- height: this.dropdownHeight + 'px',
175
- zIndex: this.zIndex + 1,
176
- };
177
- if (this.renderDropdownToBody) {
178
- this.dropdownMenuStyle.top = rect.bottom + this.dropdownSpace + 'px';
179
- this.dropdownMenuStyle.left = rect.left + 'px';
180
- if (innerWidth - rect.left < dropdownWidth) {
181
- // 右边没有空间放左边
182
- this.dropdownMenuStyle.left = rect.right - this.dropdownWidth + 'px';
183
- }
184
- if (innerHeight - rect.bottom < this.dropdownHeight) {
185
- // 下面没有空间放上面
186
- this.dropdownMenuStyle.top = rect.top - this.dropdownHeight - this.dropdownSpace + 'px';
187
- }
188
- } else {
189
- if (innerWidth - rect.left >= dropdownWidth) {
190
- // 右边有空间
191
- this.dropdownMenuStyle.right = null;
192
- } else if (rect.right >= dropdownWidth) {
193
- // 左边有空间
194
- this.dropdownMenuStyle.right = 0;
195
- } else {
196
- this.dropdownMenuStyle.width = '96vw';
197
- this.dropdownMenuStyle.right = -1 * (innerWidth - rect.right) + 'px';
198
- }
199
-
200
- if (bottom >= this.dropdownHeight) {
201
- // 下方有充足空间
202
- this.dropdownMenuStyle.top = rect.height + this.dropdownSpace + 'px';
203
- } else if (rect.top >= this.dropdownHeight) {
204
- // 上方有充足空间
205
- this.dropdownMenuStyle.top = -1 * this.dropdownHeight - this.dropdownSpace + 'px';
206
- } else {
207
- this.dropdownMenuStyle.top = 0;
208
- this.dropdownMenuStyle.position = 'fixed';
209
- this.dropdownMenuStyle.height = innerHeight + 'px';
210
- }
211
- }
212
- },
213
- /** 通过key值查找一项 */
214
- getItemByKey(key) {
215
- let result = null;
216
- (function recursion(dataSource) {
217
- for (let i = 0; i < dataSource.length; i++) {
218
- const item = dataSource[i];
219
- if (item[this.assignedFields.key] === key) {
220
- result = item;
221
- return 0;
222
- }
223
- if (item[this.assignedFields.children]) {
224
- const res = recursion.bind(this)(item[this.assignedFields.children] || []);
225
- if (res === 0) return 0;
226
- }
227
- }
228
- }).bind(this)(this.treeData);
229
- return result;
230
- },
231
-
232
- // --------------- ref Func
233
- /**
234
- * 设置当前选中的项(高亮),会触发change事件
235
- */
236
- setValue(item) {
237
- let currentItem = item;
238
- if (typeof item !== 'object') {
239
- currentItem = this.getItemByKey(item);
240
- }
241
- if (currentItem) {
242
- this.storedValue = currentItem[this.assignedFields.key];
243
- this.resetVTree = true; // 下次打开下拉框时是否设置虚拟树
244
- this.onTreeItemClick(currentItem);
245
- }
246
- },
247
- },
248
- };
249
- </script>
250
- <style lang="less" scoped>
251
- :deep(.vtScroll-tree ul li .list-item:hover:not(.item-highlight)) {
252
- background-color: #f7f7fc;
253
- }
254
-
255
- .v-tree-select-wrapper.disabled {
256
- .tree-select-main {
257
- border: 1px solid #cbcbe1;
258
- background-color: rgb(246, 246, 246);
259
- cursor: not-allowed;
260
-
261
- .tree-select-main-label {
262
- color: #ccc;
263
- }
264
-
265
- .tree-select-main-arrow {
266
- border-top: 5px solid #ccc;
267
- }
268
- }
269
- }
270
-
271
- .v-tree-select-wrapper {
272
- position: relative;
273
- width: 200px;
274
- height: 25px;
275
- transition: border 0.3s;
276
-
277
- &.disabled {
278
- .tree-select-main {
279
- border: 1px solid #cccccc;
280
- }
281
- }
282
-
283
- &:hover:not(.disabled) {
284
- .tree-select-main {
285
- border: 1px solid #8f90b5;
286
- }
287
- }
288
-
289
- .tree-select-main {
290
- display: flex;
291
- justify-content: space-between;
292
- cursor: pointer;
293
- width: 100%;
294
- height: 100%;
295
- border: 1px solid #ddd;
296
- border-radius: 4px;
297
- overflow: hidden;
298
- white-space: nowrap;
299
- box-sizing: border-box;
300
- padding: 0 10px;
301
- transition: all 0.3s;
302
-
303
- &.expand {
304
- border: 1px solid #8f90b5;
305
-
306
- .tree-select-main-arrow {
307
- border-top: 5px solid #4a4b72;
308
- transform: rotate(180deg);
309
- }
310
- }
311
-
312
- .tree-select-main-label {
313
- width: 100%;
314
- overflow: hidden;
315
- text-overflow: ellipsis;
316
-
317
- &.placeholder {
318
- color: #7d7d94;
319
- }
320
- }
321
-
322
- .tree-select-main-arrow {
323
- margin-left: 10px;
324
- align-self: center;
325
- width: 0;
326
- height: 0;
327
- border-top: 5px solid #757699;
328
- border-left: 4px solid transparent;
329
- border-right: 4px solid transparent;
330
- border-bottom: 0px;
331
- transition: transform 0.2s ease;
332
-
333
- &.expand {
334
- transform: rotate(180deg);
335
- }
336
- }
337
- }
338
-
339
- .dropdown-menu {
340
- overflow: hidden;
341
- border: 1px solid #ddd;
342
- position: absolute;
343
- box-sizing: border-box;
344
- width: 100%;
345
- // min-width: max-content;
346
- // margin-top: 2px;
347
- border-radius: 4px;
348
- outline: none;
349
- box-shadow: 0 4px 12px rgba(10, 39, 86, 0.15);
350
- border: 1px solid #ececf7;
351
- // ::v-deep .vtScroll-tree {
352
- // min-width: max-content;
353
- // }
354
- }
355
-
356
- /**遮罩 */
357
- .dropdown-mask {
358
- position: fixed;
359
- top: 0;
360
- left: 0;
361
- right: 0;
362
- bottom: 0;
363
- height: 100vh;
364
- width: 100vw;
365
- }
366
- }
367
- </style>
1
+ <template>
2
+ <div class="v-tree-select-wrapper" :class="{ disabled: disabled }">
3
+ <!-- <input type="text" @click="onInputClick($event)" /> -->
4
+ <div class="tree-select-main" :class="{ expand: showDropdown }" @click="onInputClick">
5
+ <div class="tree-select-main-label" :class="{ placeholder: !selectedLabel }" :title="selectedLabel">
6
+ {{ selectedLabel || placeholder }}
7
+ </div>
8
+ <div class="tree-select-main-arrow"></div>
9
+ </div>
10
+ <Teleport :to="renderDropdownToBody ? body : void 0" :disabled="!renderDropdownToBody">
11
+ <!-- VirtualTreeSelect下拉框 -->
12
+ <div v-if="vIfLoadComponent" v-show="!disabled && showDropdown" class="dropdown-menu" :style="dropdownMenuStyle">
13
+ <VirtualTree
14
+ ref="virtualTree"
15
+ v-bind="vsTreeProps"
16
+ height="100%"
17
+ :replace-fields="assignedFields"
18
+ :tree-data="treeDataClone"
19
+ @item-click="onTreeItemClick"
20
+ />
21
+ </div>
22
+ </Teleport>
23
+ <!-- 遮罩:用于点击区域外关闭 -->
24
+ <div v-if="!disabled && showDropdown" class="dropdown-mask" :style="{ zIndex: zIndex }" @click="showDropdown = false"></div>
25
+ </div>
26
+ </template>
27
+ <script>
28
+ /** 不支持v-model 只能通过 :value + change事件更新 */
29
+ import VirtualTree from './VirtualTree.vue';
30
+
31
+ const _defaultFields = {
32
+ key: 'key',
33
+ title: 'title',
34
+ children: 'children',
35
+ };
36
+ export default {
37
+ components: { VirtualTree },
38
+ props: {
39
+ value: {
40
+ type: String,
41
+ default: '',
42
+ },
43
+ /** 下拉框高度 */
44
+ dropdownHeight: {
45
+ type: Number,
46
+ default: 240, // 8行
47
+ },
48
+ /** 下拉框宽度 */
49
+ dropdownWidth: {
50
+ type: Number,
51
+ default: null,
52
+ },
53
+ /** 下拉菜单与下拉框间的距离 */
54
+ dropdownSpace: {
55
+ type: Number,
56
+ default: 2,
57
+ },
58
+ /** 格式化选中展示的label */
59
+ labelFormatter: {
60
+ type: Function,
61
+ default: null,
62
+ },
63
+ /** 下拉框的z-index */
64
+ zIndex: {
65
+ type: Number,
66
+ default: 10,
67
+ },
68
+ placeholder: {
69
+ type: String,
70
+ default: '请选择',
71
+ },
72
+ treeData: {
73
+ type: Array,
74
+ default: () => [],
75
+ },
76
+ /** 是否禁用 */
77
+ disabled: Boolean,
78
+ /** 替换数据title,key,children字段 */
79
+ replaceFields: {
80
+ type: Object,
81
+ default: () => _defaultFields,
82
+ },
83
+ /** VirtualScrollTree 的prop*/
84
+ vsTreeProps: {
85
+ type: Object,
86
+ default: () => ({}),
87
+ },
88
+ /** 是否把dropdown挂载在body */
89
+ renderDropdownToBody: {
90
+ type: Boolean,
91
+ default: false,
92
+ },
93
+ },
94
+ data() {
95
+ return {
96
+ dropdownMenuStyle: {},
97
+ showDropdown: false,
98
+ /** 展开下拉框时才加载组件 */
99
+ vIfLoadComponent: false,
100
+ /** 保存的prop value */
101
+ storedValue: null,
102
+ /** 记录下次打开下拉框时,是否需要执行这些操作1.高亮2.展开父节点3.滚动至选中的位置 */
103
+ resetVTree: false,
104
+ };
105
+ },
106
+ computed: {
107
+ treeDataClone() {
108
+ return [...this.treeData];
109
+ },
110
+ /** 合并传入的fields */
111
+ assignedFields() {
112
+ return Object.assign({}, _defaultFields, this.replaceFields);
113
+ },
114
+ selectedLabel() {
115
+ let label = '';
116
+ const item = this.getItemByKey(this.storedValue);
117
+ if (item) {
118
+ if (this.labelFormatter) {
119
+ label = this.labelFormatter(item);
120
+ } else {
121
+ label = item[this.assignedFields.title];
122
+ }
123
+ }
124
+ return label || this.storedValue;
125
+ },
126
+ },
127
+ watch: {
128
+ value(v) {
129
+ this.storedValue = v;
130
+ // this.$refs.virtualTree?.setCurrent(v);
131
+ // this.$refs.virtualTree?.expandItem([v] /* , { foldOthers: true } */);
132
+ },
133
+ },
134
+ mounted() {
135
+ this.storedValue = this.value;
136
+ },
137
+ methods: {
138
+ onInputClick(e) {
139
+ if (this.disabled) return;
140
+ if (!this.vIfLoadComponent || this.resetVTree) {
141
+ this.vIfLoadComponent = true;
142
+ this.resetVTree = false;
143
+ this.$nextTick(() => {
144
+ this.$refs.virtualTree?.setCurrent(this.storedValue);
145
+ this.$refs.virtualTree?.expandItem([this.storedValue] /* , { foldOthers: true } */);
146
+ this.$refs.virtualTree?.scrollTo(this.storedValue); // 滚动至
147
+ });
148
+ }
149
+
150
+ this.setDropdownMenuStyle(e);
151
+ this.showDropdown = !this.showDropdown;
152
+ this.$nextTick(() => {
153
+ this.$refs.virtualTree.resize();
154
+ });
155
+ },
156
+ onTreeItemClick(item) {
157
+ this.showDropdown = false;
158
+ this.$emit('change', item);
159
+ },
160
+ // -----------
161
+ /**
162
+ * 设置下拉框从上方弹出还是下方
163
+ */
164
+ setDropdownMenuStyle() {
165
+ const { innerWidth, innerHeight } = window;
166
+ /** @type {DOMRect} */
167
+ const rect = this.$el.getBoundingClientRect();
168
+ const bottom = innerHeight - rect.top - rect.height;
169
+ const dropdownWidth = this.dropdownWidth ? this.dropdownWidth : rect.width;
170
+ // reset style
171
+ this.dropdownMenuStyle = {
172
+ position: 'absolute',
173
+ width: dropdownWidth + 'px',
174
+ height: this.dropdownHeight + 'px',
175
+ zIndex: this.zIndex + 1,
176
+ };
177
+ if (this.renderDropdownToBody) {
178
+ this.dropdownMenuStyle.top = rect.bottom + this.dropdownSpace + 'px';
179
+ this.dropdownMenuStyle.left = rect.left + 'px';
180
+ if (innerWidth - rect.left < dropdownWidth) {
181
+ // 右边没有空间放左边
182
+ this.dropdownMenuStyle.left = rect.right - this.dropdownWidth + 'px';
183
+ }
184
+ if (innerHeight - rect.bottom < this.dropdownHeight) {
185
+ // 下面没有空间放上面
186
+ this.dropdownMenuStyle.top = rect.top - this.dropdownHeight - this.dropdownSpace + 'px';
187
+ }
188
+ } else {
189
+ if (innerWidth - rect.left >= dropdownWidth) {
190
+ // 右边有空间
191
+ this.dropdownMenuStyle.right = null;
192
+ } else if (rect.right >= dropdownWidth) {
193
+ // 左边有空间
194
+ this.dropdownMenuStyle.right = 0;
195
+ } else {
196
+ this.dropdownMenuStyle.width = '96vw';
197
+ this.dropdownMenuStyle.right = -1 * (innerWidth - rect.right) + 'px';
198
+ }
199
+
200
+ if (bottom >= this.dropdownHeight) {
201
+ // 下方有充足空间
202
+ this.dropdownMenuStyle.top = rect.height + this.dropdownSpace + 'px';
203
+ } else if (rect.top >= this.dropdownHeight) {
204
+ // 上方有充足空间
205
+ this.dropdownMenuStyle.top = -1 * this.dropdownHeight - this.dropdownSpace + 'px';
206
+ } else {
207
+ this.dropdownMenuStyle.top = 0;
208
+ this.dropdownMenuStyle.position = 'fixed';
209
+ this.dropdownMenuStyle.height = innerHeight + 'px';
210
+ }
211
+ }
212
+ },
213
+ /** 通过key值查找一项 */
214
+ getItemByKey(key) {
215
+ let result = null;
216
+ (function recursion(dataSource) {
217
+ for (let i = 0; i < dataSource.length; i++) {
218
+ const item = dataSource[i];
219
+ if (item[this.assignedFields.key] === key) {
220
+ result = item;
221
+ return 0;
222
+ }
223
+ if (item[this.assignedFields.children]) {
224
+ const res = recursion.bind(this)(item[this.assignedFields.children] || []);
225
+ if (res === 0) return 0;
226
+ }
227
+ }
228
+ }).bind(this)(this.treeData);
229
+ return result;
230
+ },
231
+
232
+ // --------------- ref Func
233
+ /**
234
+ * 设置当前选中的项(高亮),会触发change事件
235
+ */
236
+ setValue(item) {
237
+ let currentItem = item;
238
+ if (typeof item !== 'object') {
239
+ currentItem = this.getItemByKey(item);
240
+ }
241
+ if (currentItem) {
242
+ this.storedValue = currentItem[this.assignedFields.key];
243
+ this.resetVTree = true; // 下次打开下拉框时是否设置虚拟树
244
+ this.onTreeItemClick(currentItem);
245
+ }
246
+ },
247
+ },
248
+ };
249
+ </script>
250
+ <style lang="less" scoped>
251
+ :deep(.vtScroll-tree ul li .list-item:hover:not(.item-highlight)) {
252
+ background-color: #f7f7fc;
253
+ }
254
+
255
+ .v-tree-select-wrapper.disabled {
256
+ .tree-select-main {
257
+ border: 1px solid #cbcbe1;
258
+ background-color: rgb(246, 246, 246);
259
+ cursor: not-allowed;
260
+
261
+ .tree-select-main-label {
262
+ color: #ccc;
263
+ }
264
+
265
+ .tree-select-main-arrow {
266
+ border-top: 5px solid #ccc;
267
+ }
268
+ }
269
+ }
270
+
271
+ .v-tree-select-wrapper {
272
+ position: relative;
273
+ width: 200px;
274
+ height: 25px;
275
+ transition: border 0.3s;
276
+
277
+ &.disabled {
278
+ .tree-select-main {
279
+ border: 1px solid #cccccc;
280
+ }
281
+ }
282
+
283
+ &:hover:not(.disabled) {
284
+ .tree-select-main {
285
+ border: 1px solid #8f90b5;
286
+ }
287
+ }
288
+
289
+ .tree-select-main {
290
+ display: flex;
291
+ justify-content: space-between;
292
+ cursor: pointer;
293
+ width: 100%;
294
+ height: 100%;
295
+ border: 1px solid #ddd;
296
+ border-radius: 4px;
297
+ overflow: hidden;
298
+ white-space: nowrap;
299
+ box-sizing: border-box;
300
+ padding: 0 10px;
301
+ transition: all 0.3s;
302
+
303
+ &.expand {
304
+ border: 1px solid #8f90b5;
305
+
306
+ .tree-select-main-arrow {
307
+ border-top: 5px solid #4a4b72;
308
+ transform: rotate(180deg);
309
+ }
310
+ }
311
+
312
+ .tree-select-main-label {
313
+ width: 100%;
314
+ overflow: hidden;
315
+ text-overflow: ellipsis;
316
+
317
+ &.placeholder {
318
+ color: #7d7d94;
319
+ }
320
+ }
321
+
322
+ .tree-select-main-arrow {
323
+ margin-left: 10px;
324
+ align-self: center;
325
+ width: 0;
326
+ height: 0;
327
+ border-top: 5px solid #757699;
328
+ border-left: 4px solid transparent;
329
+ border-right: 4px solid transparent;
330
+ border-bottom: 0px;
331
+ transition: transform 0.2s ease;
332
+
333
+ &.expand {
334
+ transform: rotate(180deg);
335
+ }
336
+ }
337
+ }
338
+
339
+ .dropdown-menu {
340
+ overflow: hidden;
341
+ border: 1px solid #ddd;
342
+ position: absolute;
343
+ box-sizing: border-box;
344
+ width: 100%;
345
+ // min-width: max-content;
346
+ // margin-top: 2px;
347
+ border-radius: 4px;
348
+ outline: none;
349
+ box-shadow: 0 4px 12px rgba(10, 39, 86, 0.15);
350
+ border: 1px solid #ececf7;
351
+ // ::v-deep .vtScroll-tree {
352
+ // min-width: max-content;
353
+ // }
354
+ }
355
+
356
+ /**遮罩 */
357
+ .dropdown-mask {
358
+ position: fixed;
359
+ top: 0;
360
+ left: 0;
361
+ right: 0;
362
+ bottom: 0;
363
+ height: 100vh;
364
+ width: 100vw;
365
+ }
366
+ }
367
+ </style>