qidian-vue-ui 2.0.62 → 2.0.63

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.
@@ -1,103 +1,103 @@
1
- .qd-service-table[data-v-4b1d2efa] {
1
+ .qd-service-table[data-v-0eebbc97] {
2
2
  height: 100%;
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  }
6
- .qd-service-table[data-v-4b1d2efa] > .t-table__content {
6
+ .qd-service-table[data-v-0eebbc97] > .t-table__content {
7
7
  flex: 1;
8
8
  }
9
- .qd-service-table--mini[data-v-4b1d2efa] {
9
+ .qd-service-table--mini[data-v-0eebbc97] {
10
10
  font: var(--td-font-body-small);
11
11
  }
12
- .qd-service-table--mini[data-v-4b1d2efa] th,
13
- .qd-service-table--mini[data-v-4b1d2efa] tr:not(.t-table__expanded-row) > td {
12
+ .qd-service-table--mini[data-v-0eebbc97] th,
13
+ .qd-service-table--mini[data-v-0eebbc97] tr:not(.t-table__expanded-row) > td {
14
14
  padding: var(--td-comp-paddingTB-xxs) var(--td-comp-paddingLR-xxs);
15
15
  line-height: var(--td-line-height-body-small);
16
16
  }
17
- .qd-service-table--mini[data-v-4b1d2efa] .t-table__row-full-element {
17
+ .qd-service-table--mini[data-v-0eebbc97] .t-table__row-full-element {
18
18
  padding: var(--td-comp-paddingTB-xs) var(--td-comp-paddingLR-s);
19
19
  }
20
- .qd-service-table--hide-empty-image[data-v-4b1d2efa] .t-table__empty {
20
+ .qd-service-table--hide-empty-image[data-v-0eebbc97] .t-table__empty {
21
21
  min-height: auto;
22
22
  }
23
- .qd-service-table--hide-empty-image[data-v-4b1d2efa] .t-table__empty .t-empty {
23
+ .qd-service-table--hide-empty-image[data-v-0eebbc97] .t-table__empty .t-empty {
24
24
  padding: 0 !important;
25
25
  }
26
- .qd-service-table--hide-empty-image[data-v-4b1d2efa] .t-table__empty .t-empty__image {
26
+ .qd-service-table--hide-empty-image[data-v-0eebbc97] .t-table__empty .t-empty__image {
27
27
  display: none;
28
28
  }
29
- .qd-service-table--hide-empty-image[data-v-4b1d2efa] .t-table__empty .t-empty__title {
29
+ .qd-service-table--hide-empty-image[data-v-0eebbc97] .t-table__empty .t-empty__title {
30
30
  margin-top: 0;
31
31
  }
32
- .qd-service-table[data-v-4b1d2efa] .t-table__tree-col:not(:has(.t-table__tree-op-icon)) {
32
+ .qd-service-table[data-v-0eebbc97] .t-table__tree-col:not(:has(.t-table__tree-op-icon)) {
33
33
  margin-left: calc(var(--td-font-size-body-large) + var(--td-comp-margin-s));
34
34
  }
35
- .qd-service-table[data-v-4b1d2efa] .t-table__tree-leaf-node .t-table__tree-op-icon:empty {
35
+ .qd-service-table[data-v-0eebbc97] .t-table__tree-leaf-node .t-table__tree-op-icon:empty {
36
36
  width: calc(var(--td-font-size-body-large) + var(--td-comp-margin-s));
37
37
  }
38
- .qd-service-table[data-v-4b1d2efa] .t-affix > .t-table__affixed-header-elm-wrap,
39
- .qd-service-table[data-v-4b1d2efa] .t-affix > .t-table__scrollbar--obvious {
40
- transform: var(--v018dd895);
38
+ .qd-service-table[data-v-0eebbc97] .t-affix > .t-table__affixed-header-elm-wrap,
39
+ .qd-service-table[data-v-0eebbc97] .t-affix > .t-table__scrollbar--obvious {
40
+ transform: var(--v6ad82152);
41
41
  }
42
- .qd-service-table--horizontal-bar-static[data-v-4b1d2efa] .t-table__scrollbar--obvious {
42
+ .qd-service-table--horizontal-bar-static[data-v-0eebbc97] .t-table__scrollbar--obvious {
43
43
  visibility: hidden;
44
44
  pointer-events: none;
45
45
  }
46
- .qd-service-table--horizontal-bar-static[data-v-4b1d2efa] > div:has(> div > .t-table__scrollbar--obvious) {
46
+ .qd-service-table--horizontal-bar-static[data-v-0eebbc97] > div:has(> div > .t-table__scrollbar--obvious) {
47
47
  height: 0;
48
48
  margin-top: 0 !important;
49
49
  overflow: hidden;
50
50
  }
51
- .qd-service-table[data-v-4b1d2efa] .t-table__expanded-row .qd-service-table--horizontal-bar-static > div:has(> div > .t-table__scrollbar--obvious) {
51
+ .qd-service-table[data-v-0eebbc97] .t-table__expanded-row .qd-service-table--horizontal-bar-static > div:has(> div > .t-table__scrollbar--obvious) {
52
52
  display: none;
53
53
  }
54
- .qd-service-table[data-v-4b1d2efa] .t-table__expanded-row > td {
54
+ .qd-service-table[data-v-0eebbc97] .t-table__expanded-row > td {
55
55
  height: 0;
56
56
  }
57
- .qd-service-table[data-v-4b1d2efa] .t-table__affixed-header-elm-wrap {
57
+ .qd-service-table[data-v-0eebbc97] .t-table__affixed-header-elm-wrap {
58
58
  height: auto !important;
59
59
  }
60
- .qd-service-table[data-v-4b1d2efa] .t-table__affixed-header-elm {
60
+ .qd-service-table[data-v-0eebbc97] .t-table__affixed-header-elm {
61
61
  position: relative;
62
62
  scrollbar-width: none;
63
63
  }
64
- .qd-service-table[data-v-4b1d2efa] .t-table__affixed-header-elm::-webkit-scrollbar {
64
+ .qd-service-table[data-v-0eebbc97] .t-table__affixed-header-elm::-webkit-scrollbar {
65
65
  display: none;
66
66
  width: 0;
67
67
  height: 0;
68
68
  }
69
- .qd-service-table[data-v-4b1d2efa] .t-table__virtual-scroll-cursor + table {
69
+ .qd-service-table[data-v-0eebbc97] .t-table__virtual-scroll-cursor + table {
70
70
  border-collapse: separate;
71
71
  }
72
- .qd-service-table[data-v-4b1d2efa] .t-table__expanded-row-inner,
73
- .qd-service-table[data-v-4b1d2efa] .t-table__row-filter-inner {
72
+ .qd-service-table[data-v-0eebbc97] .t-table__expanded-row-inner,
73
+ .qd-service-table[data-v-0eebbc97] .t-table__row-filter-inner {
74
74
  display: block;
75
75
  position: sticky;
76
76
  left: 0;
77
- width: var(--ef69396c) !important;
77
+ width: var(--v8b5b98e8) !important;
78
78
  }
79
- .qd-service-table[data-v-4b1d2efa] .t-table__cell-wrap > .t-form__controls > .t-form__controls-content > *:not(.t-switch):not(.t-tag):not(.t-icon):not(.qd-file-icon) {
79
+ .qd-service-table[data-v-0eebbc97] .t-table__cell-wrap > .t-form__controls > .t-form__controls-content > *:not(.t-switch):not(.t-tag):not(.t-icon):not(.qd-file-icon) {
80
80
  width: 100%;
81
81
  }
82
- .qd-service-table[data-v-4b1d2efa] .qd-service-table__non-editable-col {
82
+ .qd-service-table[data-v-0eebbc97] .qd-service-table__non-editable-col {
83
83
  background-color: color-mix(in srgb, var(--td-bg-color-component) 50%, transparent);
84
84
  }
85
- .qd-service-table[data-v-4b1d2efa] td.qd-service-table__selected-cell {
85
+ .qd-service-table[data-v-0eebbc97] td.qd-service-table__selected-cell {
86
86
  box-shadow: inset 0 1px 0 0 var(--qst-sel-t, transparent), inset 0 -1px 0 0 var(--qst-sel-b, transparent), inset 1px 0 0 0 var(--qst-sel-l, transparent), inset -1px 0 0 0 var(--qst-sel-r, transparent);
87
87
  }
88
- .qd-service-table[data-v-4b1d2efa] .qd-service-table__selected-bt {
88
+ .qd-service-table[data-v-0eebbc97] .qd-service-table__selected-bt {
89
89
  --qst-sel-t: var(--td-brand-color);
90
90
  }
91
- .qd-service-table[data-v-4b1d2efa] .qd-service-table__selected-bb {
91
+ .qd-service-table[data-v-0eebbc97] .qd-service-table__selected-bb {
92
92
  --qst-sel-b: var(--td-brand-color);
93
93
  }
94
- .qd-service-table[data-v-4b1d2efa] .qd-service-table__selected-bl {
94
+ .qd-service-table[data-v-0eebbc97] .qd-service-table__selected-bl {
95
95
  --qst-sel-l: var(--td-brand-color);
96
96
  }
97
- .qd-service-table[data-v-4b1d2efa] .qd-service-table__selected-br {
97
+ .qd-service-table[data-v-0eebbc97] .qd-service-table__selected-br {
98
98
  --qst-sel-r: var(--td-brand-color);
99
99
  }
100
- .qd-service-table[data-v-4b1d2efa] td.qd-service-table__copied-cell {
100
+ .qd-service-table[data-v-0eebbc97] td.qd-service-table__copied-cell {
101
101
  background-image: var(--qst-copy-t, none), var(--qst-copy-b, none), var(--qst-copy-l, none), var(--qst-copy-r, none);
102
102
  background-size: 8px 1px,
103
103
  8px 1px,
@@ -108,128 +108,134 @@
108
108
  0 0,
109
109
  100% 0;
110
110
  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
111
- animation: qst-cell-ants-4b1d2efa 0.5s linear infinite;
111
+ animation: qst-cell-ants-0eebbc97 0.5s linear infinite;
112
112
  }
113
- .qd-service-table[data-v-4b1d2efa] td.qd-service-table__copied-cell.qd-service-table__selected-cell {
113
+ .qd-service-table[data-v-0eebbc97] td.qd-service-table__copied-cell.qd-service-table__selected-cell {
114
114
  background-size: 8px 2px,
115
115
  8px 2px,
116
116
  2px 8px,
117
117
  2px 8px;
118
118
  }
119
- .qd-service-table[data-v-4b1d2efa] .qd-service-table__copied-bt {
119
+ .qd-service-table[data-v-0eebbc97] .qd-service-table__copied-bt {
120
120
  --qst-copy-t: linear-gradient(90deg, var(--td-brand-color-hover) 50%, transparent 0);
121
121
  }
122
- .qd-service-table[data-v-4b1d2efa] .qd-service-table__copied-bb {
122
+ .qd-service-table[data-v-0eebbc97] .qd-service-table__copied-bb {
123
123
  --qst-copy-b: linear-gradient(90deg, var(--td-brand-color-hover) 50%, transparent 0);
124
124
  }
125
- .qd-service-table[data-v-4b1d2efa] .qd-service-table__copied-bl {
125
+ .qd-service-table[data-v-0eebbc97] .qd-service-table__copied-bl {
126
126
  --qst-copy-l: linear-gradient(0deg, var(--td-brand-color-hover) 50%, transparent 0);
127
127
  }
128
- .qd-service-table[data-v-4b1d2efa] .qd-service-table__copied-br {
128
+ .qd-service-table[data-v-0eebbc97] .qd-service-table__copied-br {
129
129
  --qst-copy-r: linear-gradient(0deg, var(--td-brand-color-hover) 50%, transparent 0);
130
130
  }
131
- .qd-service-table[data-v-4b1d2efa] tbody > tr.t-table__row--active {
131
+ .qd-service-table[data-v-0eebbc97] tbody > tr.t-table__row--active {
132
132
  background-color: var(--td-brand-color-light);
133
133
  }
134
- .qd-service-table[data-v-4b1d2efa] tbody > tr.t-table__row--active.t-table__row--hover,
135
- .qd-service-table[data-v-4b1d2efa] tbody > tr.t-table__row--active:hover {
134
+ .qd-service-table[data-v-0eebbc97] tbody > tr.t-table__row--active.t-table__row--hover,
135
+ .qd-service-table[data-v-0eebbc97] tbody > tr.t-table__row--active:hover {
136
136
  background-color: var(--td-brand-color-light-hover);
137
137
  }
138
- .qd-service-table[data-v-4b1d2efa] .qd-service-table__non-editable-col:not(.qd-service-table__copied-cell):is(
138
+ .qd-service-table[data-v-0eebbc97] .qd-service-table__non-editable-col:not(.qd-service-table__copied-cell):is(
139
139
  .t-table__cell--fixed-left,
140
140
  .t-table__cell--fixed-right
141
141
  ) {
142
142
  background-color: inherit;
143
143
  background-image: linear-gradient(color-mix(in srgb, var(--td-bg-color-secondarycontainer) 50%, transparent), color-mix(in srgb, var(--td-bg-color-secondarycontainer) 50%, transparent));
144
144
  }
145
- .qd-service-table--disable-horizontal-scroll[data-v-4b1d2efa] colgroup > col {
145
+ .qd-service-table--disable-horizontal-scroll[data-v-0eebbc97] colgroup > col {
146
146
  width: auto !important;
147
147
  }
148
- .qd-service-table[data-v-4b1d2efa] .t-table__filter-pop-content-inner {
148
+ .qd-service-table--cell-drag-selecting[data-v-0eebbc97] {
149
+ cursor: crosshair;
150
+ }
151
+ .qd-service-table--cell-drag-selecting[data-v-0eebbc97] td {
152
+ cursor: crosshair;
153
+ }
154
+ .qd-service-table[data-v-0eebbc97] .t-table__filter-pop-content-inner {
149
155
  padding: var(--td-comp-paddingTB-s) var(--td-comp-paddingLR-s) 0;
150
156
  }
151
- .qd-service-table[data-v-4b1d2efa] .t-table__filter-pop-content-inner:has(.qd-service-table-filter-item) {
157
+ .qd-service-table[data-v-0eebbc97] .t-table__filter-pop-content-inner:has(.qd-service-table-filter-item) {
152
158
  padding: 0;
153
159
  }
154
- .qd-service-table[data-v-4b1d2efa] .t-table__filter-pop-content-inner:has(
160
+ .qd-service-table[data-v-0eebbc97] .t-table__filter-pop-content-inner:has(
155
161
  .qd-service-table-filter-input,
156
162
  .qd-service-table-filter-custom
157
163
  ) {
158
164
  padding-bottom: var(--td-comp-paddingTB-s);
159
165
  }
160
- .qd-service-table[data-v-4b1d2efa] .t-table__filter--bottom-buttons {
166
+ .qd-service-table[data-v-0eebbc97] .t-table__filter--bottom-buttons {
161
167
  padding: var(--td-comp-paddingTB-s) var(--td-comp-paddingLR-s);
162
168
  }
163
- .qd-service-table--mini[data-v-4b1d2efa] .t-table__filter-pop-content-inner {
169
+ .qd-service-table--mini[data-v-0eebbc97] .t-table__filter-pop-content-inner {
164
170
  padding: var(--td-comp-paddingTB-xs) var(--td-comp-paddingLR-xs) 0;
165
171
  }
166
- .qd-service-table--mini[data-v-4b1d2efa] .t-table__filter--bottom-buttons {
172
+ .qd-service-table--mini[data-v-0eebbc97] .t-table__filter--bottom-buttons {
167
173
  padding: var(--td-comp-paddingTB-xs) var(--td-comp-paddingLR-xs);
168
174
  }
169
- .qd-service-table--mini[data-v-4b1d2efa] .t-table__filter-pop-content-inner:has(.qd-service-table-filter-item) {
175
+ .qd-service-table--mini[data-v-0eebbc97] .t-table__filter-pop-content-inner:has(.qd-service-table-filter-item) {
170
176
  padding: 0;
171
177
  }
172
- .qd-service-table--mini[data-v-4b1d2efa] .t-table__filter-pop-content-inner:has(
178
+ .qd-service-table--mini[data-v-0eebbc97] .t-table__filter-pop-content-inner:has(
173
179
  .qd-service-table-filter-input,
174
180
  .qd-service-table-filter-custom
175
181
  ) {
176
182
  padding-bottom: var(--td-comp-paddingTB-xs);
177
183
  }
178
- .qd-service-table[data-v-4b1d2efa] .qd-service-table-filter-item {
184
+ .qd-service-table[data-v-0eebbc97] .qd-service-table-filter-item {
179
185
  width: 266px;
180
186
  }
181
- .qd-service-table[data-v-4b1d2efa] .qd-service-table-filter-item__search,
182
- .qd-service-table[data-v-4b1d2efa] .qd-service-table-filter-item__all,
183
- .qd-service-table[data-v-4b1d2efa] .qd-service-table-filter-item__options {
187
+ .qd-service-table[data-v-0eebbc97] .qd-service-table-filter-item__search,
188
+ .qd-service-table[data-v-0eebbc97] .qd-service-table-filter-item__all,
189
+ .qd-service-table[data-v-0eebbc97] .qd-service-table-filter-item__options {
184
190
  padding: var(--td-comp-paddingTB-s) var(--td-comp-paddingLR-s) 0;
185
191
  }
186
- .qd-service-table[data-v-4b1d2efa] .qd-service-table-filter-item__all {
192
+ .qd-service-table[data-v-0eebbc97] .qd-service-table-filter-item__all {
187
193
  display: flex;
188
194
  align-items: center;
189
195
  padding: 0 var(--td-comp-paddingLR-s);
190
196
  border-bottom: 1px solid var(--td-component-stroke);
191
197
  }
192
- .qd-service-table[data-v-4b1d2efa] .qd-service-table-filter-item__options {
198
+ .qd-service-table[data-v-0eebbc97] .qd-service-table-filter-item__options {
193
199
  display: flex;
194
200
  flex-direction: column;
195
201
  height: 206px;
196
202
  padding: 0 var(--td-comp-paddingLR-s);
197
203
  overflow-y: auto;
198
204
  }
199
- .qd-service-table[data-v-4b1d2efa] .qd-service-table-filter-item__count {
205
+ .qd-service-table[data-v-0eebbc97] .qd-service-table-filter-item__count {
200
206
  margin-left: var(--td-comp-margin-xs);
201
207
  color: var(--td-text-color-placeholder);
202
208
  }
203
- .qd-service-table[data-v-4b1d2efa] .qd-service-table-filter-item__cell {
209
+ .qd-service-table[data-v-0eebbc97] .qd-service-table-filter-item__cell {
204
210
  pointer-events: none;
205
211
  }
206
- .qd-service-table[data-v-4b1d2efa] .qd-service-table-filter-item .t-checkbox,
207
- .qd-service-table[data-v-4b1d2efa] .qd-service-table-filter-item .t-radio {
212
+ .qd-service-table[data-v-0eebbc97] .qd-service-table-filter-item .t-checkbox,
213
+ .qd-service-table[data-v-0eebbc97] .qd-service-table-filter-item .t-radio {
208
214
  display: flex;
209
215
  align-items: center;
210
216
  }
211
- .qd-service-table[data-v-4b1d2efa] .qd-service-table-filter-item .t-checkbox__label,
212
- .qd-service-table[data-v-4b1d2efa] .qd-service-table-filter-item .t-radio__label {
217
+ .qd-service-table[data-v-0eebbc97] .qd-service-table-filter-item .t-checkbox__label,
218
+ .qd-service-table[data-v-0eebbc97] .qd-service-table-filter-item .t-radio__label {
213
219
  display: inline-flex;
214
220
  flex: 1 1 0;
215
221
  align-items: center;
216
222
  min-width: 0;
217
223
  overflow: hidden;
218
224
  }
219
- .qd-service-table--mini[data-v-4b1d2efa] .qd-service-table-filter-item__search {
225
+ .qd-service-table--mini[data-v-0eebbc97] .qd-service-table-filter-item__search {
220
226
  padding: var(--td-comp-paddingTB-xs) var(--td-comp-paddingLR-xs) 0;
221
227
  }
222
- .qd-service-table--mini[data-v-4b1d2efa] .qd-service-table-filter-item__all,
223
- .qd-service-table--mini[data-v-4b1d2efa] .qd-service-table-filter-item__options {
228
+ .qd-service-table--mini[data-v-0eebbc97] .qd-service-table-filter-item__all,
229
+ .qd-service-table--mini[data-v-0eebbc97] .qd-service-table-filter-item__options {
224
230
  padding: 0 var(--td-comp-paddingLR-xs);
225
231
  }
226
- @keyframes qst-cell-ants-4b1d2efa {
232
+ @keyframes qst-cell-ants-0eebbc97 {
227
233
  to {
228
234
  background-position: 8px 0, -8px 100%, 0 -8px, 100% 8px;
229
235
  }
230
236
  }
231
237
  @media (prefers-reduced-motion: reduce) {
232
- [data-v-4b1d2efa] td.qd-service-table__copied-cell {
238
+ [data-v-0eebbc97] td.qd-service-table__copied-cell {
233
239
  animation: none;
234
240
  }
235
241
  }
@@ -2,7 +2,7 @@ import './index.css'
2
2
  import _sfc_main from "./index.vue2.mjs";
3
3
  /* empty css */
4
4
  import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
5
- const QdServiceTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4b1d2efa"]]);
5
+ const QdServiceTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0eebbc97"]]);
6
6
  export {
7
7
  QdServiceTable as default
8
8
  };
@@ -20,6 +20,9 @@ import get from "../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/loda
20
20
  import _sfc_main$1 from "../../config-renderer/index.vue.mjs";
21
21
  import set from "../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/set.mjs";
22
22
  import QdForm from "../../form/index.vue.mjs";
23
+ const CELL_DRAG_SCROLL_EDGE_PX = 24;
24
+ const CELL_DRAG_SCROLL_MAX_SPEED_PX = 14;
25
+ const cellDragInteractiveSelector = "button, a, label, .t-tag, .t-checkbox, .t-radio, .t-switch, .t-input, .t-select";
23
26
  const popupLayerSelector = ".t-select-input--popup-visible, .t-popup__content, .t-dialog, .t-drawer, .t-image-viewer, .qd-multi-file-viewer";
24
27
  const editableElementSelector = 'input, textarea, select, [contenteditable="true"], .ql-editor';
25
28
  const defaultMinWidth = 80;
@@ -356,8 +359,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
356
359
  emit: __emit
357
360
  }) {
358
361
  useCssVars((_ctx) => ({
359
- "v018dd895": affixedHeaderTransform.value,
360
- "ef69396c": expandedRowWidth.value
362
+ "v6ad82152": affixedHeaderTransform.value,
363
+ "v8b5b98e8": expandedRowWidth.value
361
364
  }));
362
365
  const props = __props;
363
366
  const emit = __emit;
@@ -423,6 +426,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
423
426
  const copiedCells = shallowRef([]);
424
427
  const handledSelectionEvents = /* @__PURE__ */ new WeakSet();
425
428
  const selectionExcludedColKeys = /* @__PURE__ */ new Set(["expand", "drag"]);
429
+ let cellDragState = null;
430
+ const isCellDragSelecting = ref(false);
431
+ let suppressNextCellClick = false;
432
+ let dragScrollRafId = 0;
433
+ const dragCellCache = /* @__PURE__ */ new WeakMap();
426
434
  const editingCellValidationErrors = shallowRef(/* @__PURE__ */ new Map());
427
435
  const expandedRowProxyMap = /* @__PURE__ */ new WeakMap();
428
436
  let dataChangePending = false;
@@ -1404,6 +1412,187 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1404
1412
  syncSelectedRowKeysFromCells();
1405
1413
  emitRowSelectChange(cell.row, wasSelected ? "uncheck" : "check");
1406
1414
  }
1415
+ function computeCellRect(anchor, target) {
1416
+ if (!target.colKey || !anchor.colKey) return null;
1417
+ const columns = leafColumns.value;
1418
+ const fromCol = columns.findIndex((col) => col.colKey === anchor.colKey);
1419
+ const toCol = columns.findIndex((col) => col.colKey === target.colKey);
1420
+ const rows = data.value;
1421
+ const fromRow = rows.findIndex((row) => getRowValue(row) === getRowValue(anchor.row));
1422
+ const toRow = rows.findIndex((row) => getRowValue(row) === getRowValue(target.row));
1423
+ if (fromCol < 0 || toCol < 0 || fromRow < 0 || toRow < 0) return null;
1424
+ const [rowStart, rowEnd] = fromRow <= toRow ? [fromRow, toRow] : [toRow, fromRow];
1425
+ const [colStart, colEnd] = fromCol <= toCol ? [fromCol, toCol] : [toCol, fromCol];
1426
+ return {
1427
+ rowStart,
1428
+ rowEnd,
1429
+ colStart,
1430
+ colEnd
1431
+ };
1432
+ }
1433
+ function isSameCellRect(a, b) {
1434
+ return a.rowStart === b.rowStart && a.rowEnd === b.rowEnd && a.colStart === b.colStart && a.colEnd === b.colEnd;
1435
+ }
1436
+ function resolveCellFromPoint(x, y) {
1437
+ const element = document.elementFromPoint(x, y);
1438
+ const td = element instanceof Element ? element.closest("td[data-qd-col-key]") : null;
1439
+ if (!(td instanceof HTMLTableCellElement)) return null;
1440
+ if (dragCellCache.has(td)) return dragCellCache.get(td) ?? null;
1441
+ const rowKey = td.dataset.qdRowKey;
1442
+ const column = leafColumns.value.find((col) => String(col.colKey) === td.dataset.qdColKey);
1443
+ const row = data.value.find((item) => rowKey !== void 0 && String(getRowValue(item)) === rowKey);
1444
+ if (!row || !column || !isCellSelectableColumn(column)) return null;
1445
+ const cell = {
1446
+ row,
1447
+ colKey: column.colKey
1448
+ };
1449
+ dragCellCache.set(td, cell);
1450
+ return cell;
1451
+ }
1452
+ function handleCellDragMousedown(event, cell, column) {
1453
+ if (!activated.value || !reCellSelectable.value) return;
1454
+ if (event.button !== 0 || !cell.colKey) return;
1455
+ if (!isCellSelectableColumn(column)) return;
1456
+ const target = event.target;
1457
+ if (!(target instanceof Element)) return;
1458
+ if (isEditableOrPopupTarget(target)) return;
1459
+ if (target.closest(cellDragInteractiveSelector)) return;
1460
+ if (hasSelectionModifier(event)) return;
1461
+ event.preventDefault();
1462
+ cellDragState = {
1463
+ anchorCell: cell,
1464
+ lastTargetCell: cell,
1465
+ lastRect: null,
1466
+ moved: false,
1467
+ textAnchor: resolveTextPointFromEvent(event.clientX, event.clientY),
1468
+ clientX: event.clientX,
1469
+ clientY: event.clientY
1470
+ };
1471
+ document.addEventListener("mousemove", handleCellDragMousemove);
1472
+ document.addEventListener("mouseup", handleCellDragMouseup);
1473
+ document.addEventListener("mouseleave", handleCellDragCancel);
1474
+ window.addEventListener("blur", handleCellDragCancel);
1475
+ startCellDragScrollLoop();
1476
+ }
1477
+ function handleCellDragMousemove(event) {
1478
+ const state = cellDragState;
1479
+ if (!state || !activated.value) return;
1480
+ state.clientX = event.clientX;
1481
+ state.clientY = event.clientY;
1482
+ updateDragSelection(event.clientX, event.clientY);
1483
+ }
1484
+ function updateDragSelection(x, y) {
1485
+ const state = cellDragState;
1486
+ if (!state) return;
1487
+ const target = resolveCellFromPoint(x, y);
1488
+ if (!target) return;
1489
+ if (!state.moved && isSameEditingCell(target, state.anchorCell)) {
1490
+ updateCellTextSelection(x, y, state);
1491
+ return;
1492
+ }
1493
+ if (!state.moved) {
1494
+ document.getSelection()?.removeAllRanges();
1495
+ state.moved = true;
1496
+ isCellDragSelecting.value = true;
1497
+ }
1498
+ state.lastTargetCell = target;
1499
+ const rect = computeCellRect(state.anchorCell, target);
1500
+ if (!rect || state.lastRect && isSameCellRect(state.lastRect, rect)) return;
1501
+ state.lastRect = rect;
1502
+ selectedCells.value = expandSelectedCellRange(state.anchorCell, target);
1503
+ selectedCell.value = target;
1504
+ selectedCellAnchor.value = state.anchorCell;
1505
+ syncSelectedRowKeysFromCells();
1506
+ }
1507
+ function updateCellTextSelection(x, y, state) {
1508
+ if (!state.textAnchor) return;
1509
+ const focus = resolveTextPointFromEvent(x, y);
1510
+ if (!focus) return;
1511
+ document.getSelection()?.setBaseAndExtent(state.textAnchor.node, state.textAnchor.offset, focus.node, focus.offset);
1512
+ }
1513
+ function resolveTextPointFromEvent(x, y) {
1514
+ const position = document.caretPositionFromPoint?.(x, y);
1515
+ if (position) return {
1516
+ node: position.offsetNode,
1517
+ offset: position.offset
1518
+ };
1519
+ const range = document.caretRangeFromPoint(x, y);
1520
+ if (!range) return null;
1521
+ return {
1522
+ node: range.startContainer,
1523
+ offset: range.startOffset
1524
+ };
1525
+ }
1526
+ function handleCellDragMouseup() {
1527
+ const state = cellDragState;
1528
+ if (!state) return;
1529
+ const {
1530
+ moved,
1531
+ anchorCell,
1532
+ lastTargetCell
1533
+ } = state;
1534
+ teardownCellDrag();
1535
+ if (!moved) return;
1536
+ suppressNextCellClick = true;
1537
+ setTimeout(() => {
1538
+ suppressNextCellClick = false;
1539
+ }, 0);
1540
+ selectedCell.value = lastTargetCell;
1541
+ selectedCellAnchor.value = anchorCell;
1542
+ emitRowSelectChange(lastTargetCell.row, "check");
1543
+ document.getSelection()?.removeAllRanges();
1544
+ }
1545
+ function handleCellDragCancel() {
1546
+ if (!cellDragState) return;
1547
+ teardownCellDrag();
1548
+ }
1549
+ function teardownCellDrag() {
1550
+ cellDragState = null;
1551
+ isCellDragSelecting.value = false;
1552
+ stopCellDragScrollLoop();
1553
+ document.removeEventListener("mousemove", handleCellDragMousemove);
1554
+ document.removeEventListener("mouseup", handleCellDragMouseup);
1555
+ document.removeEventListener("mouseleave", handleCellDragCancel);
1556
+ window.removeEventListener("blur", handleCellDragCancel);
1557
+ }
1558
+ function startCellDragScrollLoop() {
1559
+ if (dragScrollRafId) return;
1560
+ const tick = () => {
1561
+ dragScrollRafId = requestAnimationFrame(tick);
1562
+ const state = cellDragState;
1563
+ const scrollEl = getCurrentTableContentEl();
1564
+ if (!state || !scrollEl) return;
1565
+ const rect = scrollEl.getBoundingClientRect();
1566
+ const dx = resolveDragScrollDelta(rect.left, rect.right, state.clientX, scrollEl.scrollLeft, scrollEl.scrollWidth);
1567
+ const dy = resolveDragScrollDelta(rect.top, rect.bottom, state.clientY, scrollEl.scrollTop, scrollEl.scrollHeight);
1568
+ if (!dx && !dy) return;
1569
+ scrollEl.scrollLeft += dx;
1570
+ scrollEl.scrollTop += dy;
1571
+ updateDragSelection(state.clientX, state.clientY);
1572
+ };
1573
+ dragScrollRafId = requestAnimationFrame(tick);
1574
+ }
1575
+ function stopCellDragScrollLoop() {
1576
+ if (!dragScrollRafId) return;
1577
+ cancelAnimationFrame(dragScrollRafId);
1578
+ dragScrollRafId = 0;
1579
+ }
1580
+ function resolveDragScrollDelta(start, end, pointer, current2, total2) {
1581
+ let delta = 0;
1582
+ if (current2 > 0) {
1583
+ const distance = pointer - start;
1584
+ if (distance <= CELL_DRAG_SCROLL_EDGE_PX) delta -= resolveDragScrollSpeed(distance);
1585
+ }
1586
+ if (current2 < total2) {
1587
+ const distance = end - pointer;
1588
+ if (distance <= CELL_DRAG_SCROLL_EDGE_PX) delta += resolveDragScrollSpeed(distance);
1589
+ }
1590
+ return delta;
1591
+ }
1592
+ function resolveDragScrollSpeed(distance) {
1593
+ const ratio = Math.max(0, Math.min(1, 1 - distance / CELL_DRAG_SCROLL_EDGE_PX));
1594
+ return Math.round(CELL_DRAG_SCROLL_MAX_SPEED_PX * ratio);
1595
+ }
1407
1596
  function resolveCellText(row, colKey) {
1408
1597
  const value = get(row, colKey);
1409
1598
  if (value === void 0 || value === null) return "";
@@ -1788,6 +1977,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1788
1977
  void exitEditingCell(activeEditingCell.value);
1789
1978
  }
1790
1979
  function handleCellClick(context) {
1980
+ if (suppressNextCellClick) return;
1791
1981
  const column = context.col;
1792
1982
  const cell = {
1793
1983
  row: context.row,
@@ -1840,6 +2030,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1840
2030
  if (!activated.value) return;
1841
2031
  if (event.defaultPrevented) return;
1842
2032
  if (event.key === "Escape") {
2033
+ if (cellDragState) handleCellDragCancel();
1843
2034
  handleSelectionClearKeydown(event.target);
1844
2035
  return;
1845
2036
  }
@@ -1879,6 +2070,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1879
2070
  if (result.written > 0) copiedCells.value = [];
1880
2071
  }
1881
2072
  function handleDocumentClick(event) {
2073
+ if (suppressNextCellClick) return;
1882
2074
  if (!activated.value) return;
1883
2075
  if (!editingCells.value.length && !selectedCell.value && !selectedCells.value.length) return;
1884
2076
  const hasVisibleDialog = Array.from(document.querySelectorAll(".t-dialog")).some((element) => element.getClientRects().length);
@@ -2496,17 +2688,30 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2496
2688
  };
2497
2689
  const finalizeColumn = (col) => {
2498
2690
  const previousAttrs = col.attrs;
2499
- col.attrs = (context) => ({
2500
- ...typeof previousAttrs === "function" ? previousAttrs(context) : previousAttrs,
2501
- onClickCapture: (event) => {
2502
- if (context.type !== "td") return;
2503
- handledSelectionEvents.add(event);
2504
- applyCellSelection({
2505
- row: context.row,
2506
- colKey: column.colKey
2507
- }, event);
2508
- }
2509
- });
2691
+ col.attrs = (context) => {
2692
+ const baseAttrs = typeof previousAttrs === "function" ? previousAttrs(context) : previousAttrs;
2693
+ if (context.type !== "td") return baseAttrs;
2694
+ return {
2695
+ ...baseAttrs,
2696
+ // 拖选反查用:表头/表尾/横向虚拟占位列不带标记,closest 直接排除
2697
+ "data-qd-col-key": String(column.colKey),
2698
+ "data-qd-row-key": String(getRowValue(context.row)),
2699
+ onMousedownCapture: (event) => {
2700
+ handleCellDragMousedown(event, {
2701
+ row: context.row,
2702
+ colKey: column.colKey
2703
+ }, column);
2704
+ },
2705
+ onClickCapture: (event) => {
2706
+ if (suppressNextCellClick) return;
2707
+ handledSelectionEvents.add(event);
2708
+ applyCellSelection({
2709
+ row: context.row,
2710
+ colKey: column.colKey
2711
+ }, event);
2712
+ }
2713
+ };
2714
+ };
2510
2715
  return col;
2511
2716
  };
2512
2717
  if (tableReadonly.value || !formItem) {
@@ -2855,6 +3060,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2855
3060
  flush: "post"
2856
3061
  });
2857
3062
  watch(data, (newData) => {
3063
+ handleCellDragCancel();
2858
3064
  pruneCellValidationErrors(newData);
2859
3065
  pruneDisabledSelectedRows(newData);
2860
3066
  });
@@ -2916,10 +3122,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2916
3122
  scheduleScrollRestore(position);
2917
3123
  });
2918
3124
  onDeactivated(() => {
3125
+ handleCellDragCancel();
2919
3126
  cancelScrollRestore();
2920
3127
  tableContentPause();
2921
3128
  });
2922
3129
  onBeforeUnmount(() => {
3130
+ handleCellDragCancel();
2923
3131
  cancelScrollRestore();
2924
3132
  tableContentStop();
2925
3133
  if (probeRafId) cancelAnimationFrame(probeRafId);
@@ -2969,7 +3177,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2969
3177
  return (_ctx, _cache) => {
2970
3178
  return withDirectives((openBlock(), createBlock(resolveDynamicComponent(reProps.value.tableOptions.tree ? unref(EnhancedTable) : unref(Table)), mergeProps({
2971
3179
  ref: "table",
2972
- class: ["qd-service-table", __props.headerBg ? "" : "t-table--header-bg-inherit", horizontalScrollAffixed.value ? "t-table--horizontal-bar-affixed" : "", reProps.value.tableOptions.horizontalScrollAffixedBottom && !horizontalScrollAffixed.value ? "qd-service-table--horizontal-bar-static" : "", reProps.value.size === "mini" ? "qd-service-table--mini" : "", __props.emptyImage === false ? "qd-service-table--hide-empty-image" : "", __props.disableHorizontalScroll ? "qd-service-table--disable-horizontal-scroll" : ""],
3180
+ class: ["qd-service-table", __props.headerBg ? "" : "t-table--header-bg-inherit", horizontalScrollAffixed.value ? "t-table--horizontal-bar-affixed" : "", reProps.value.tableOptions.horizontalScrollAffixedBottom && !horizontalScrollAffixed.value ? "qd-service-table--horizontal-bar-static" : "", reProps.value.size === "mini" ? "qd-service-table--mini" : "", __props.emptyImage === false ? "qd-service-table--hide-empty-image" : "", __props.disableHorizontalScroll ? "qd-service-table--disable-horizontal-scroll" : "", isCellDragSelecting.value ? "qd-service-table--cell-drag-selecting" : ""],
2973
3181
  onMouseenter: handleTableMouseEnter,
2974
3182
  "selected-row-keys": unref(selectedRowKeys),
2975
3183
  "onUpdate:selectedRowKeys": _cache[0] || (_cache[0] = ($event) => isRef(selectedRowKeys) ? selectedRowKeys.value = $event : null),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qidian-vue-ui",
3
- "version": "2.0.62",
3
+ "version": "2.0.63",
4
4
  "description": "基于 TDesign 的 QiDian Vue UI 组件库",
5
5
  "author": "qidian",
6
6
  "license": "MIT",