qidian-vue-ui 2.0.62 → 2.0.64

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,8 +1,9 @@
1
- export declare function serializeTsv(rows: string[][]): string;
1
+ export declare function serializeTsv(rows: (string | null)[][]): string;
2
2
  export declare function parseTsv(text: string): string[][];
3
3
  export type CellHtmlCell = {
4
4
  label: string;
5
5
  value: string;
6
+ hole?: boolean;
6
7
  };
7
8
  export declare function serializeCellHtml(rows: CellHtmlCell[][]): string | null;
8
- export declare function parseCellHtml(html: string): string[][] | null;
9
+ export declare function parseCellHtml(html: string): (string | null)[][] | null;
@@ -10,6 +10,7 @@ function parseTsv(text) {
10
10
  }
11
11
  const CELL_HTML_FLAG = "data-qd-service-table-clipboard";
12
12
  const CELL_HTML_VALUE = "data-qd-value";
13
+ const CELL_HTML_HOLE = "data-qd-hole";
13
14
  function serializeCellHtml(rows) {
14
15
  if (typeof document === "undefined") return null;
15
16
  const table = document.createElement("table");
@@ -19,6 +20,7 @@ function serializeCellHtml(rows) {
19
20
  const tr = document.createElement("tr");
20
21
  for (const cell of row) {
21
22
  const td = document.createElement("td");
23
+ if (cell.hole) td.setAttribute(CELL_HTML_HOLE, "");
22
24
  td.setAttribute(CELL_HTML_VALUE, cell.value);
23
25
  td.textContent = cell.label;
24
26
  tr.appendChild(td);
@@ -33,7 +35,9 @@ function parseCellHtml(html) {
33
35
  const doc = new DOMParser().parseFromString(html, "text/html");
34
36
  if (!doc.querySelector(`table[${CELL_HTML_FLAG}]`)) return null;
35
37
  return Array.from(doc.querySelectorAll("tr")).map(
36
- (tr) => Array.from(tr.querySelectorAll("td")).map((td) => td.getAttribute(CELL_HTML_VALUE) ?? "")
38
+ (tr) => Array.from(tr.querySelectorAll("td")).map(
39
+ (td) => td.hasAttribute(CELL_HTML_HOLE) ? null : td.getAttribute(CELL_HTML_VALUE) ?? ""
40
+ )
37
41
  );
38
42
  }
39
43
  export {
@@ -1,103 +1,103 @@
1
- .qd-service-table[data-v-4b1d2efa] {
1
+ .qd-service-table[data-v-43aa39f0] {
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-43aa39f0] > .t-table__content {
7
7
  flex: 1;
8
8
  }
9
- .qd-service-table--mini[data-v-4b1d2efa] {
9
+ .qd-service-table--mini[data-v-43aa39f0] {
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-43aa39f0] th,
13
+ .qd-service-table--mini[data-v-43aa39f0] 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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .t-affix > .t-table__affixed-header-elm-wrap,
39
+ .qd-service-table[data-v-43aa39f0] .t-affix > .t-table__scrollbar--obvious {
40
+ transform: var(--v05a25416);
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-43aa39f0] .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-43aa39f0] > 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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .t-table__expanded-row-inner,
73
+ .qd-service-table[data-v-43aa39f0] .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(--v1a4de8aa) !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-43aa39f0] .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-43aa39f0] .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-43aa39f0] 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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] 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-43aa39f0 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-43aa39f0] 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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] 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-43aa39f0] tbody > tr.t-table__row--active.t-table__row--hover,
135
+ .qd-service-table[data-v-43aa39f0] 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-43aa39f0] .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-43aa39f0] 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-43aa39f0] {
149
+ cursor: crosshair;
150
+ }
151
+ .qd-service-table--cell-drag-selecting[data-v-43aa39f0] td {
152
+ cursor: crosshair;
153
+ }
154
+ .qd-service-table[data-v-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .qd-service-table-filter-item__search,
188
+ .qd-service-table[data-v-43aa39f0] .qd-service-table-filter-item__all,
189
+ .qd-service-table[data-v-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .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-43aa39f0] .qd-service-table-filter-item .t-checkbox,
213
+ .qd-service-table[data-v-43aa39f0] .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-43aa39f0] .qd-service-table-filter-item .t-checkbox__label,
218
+ .qd-service-table[data-v-43aa39f0] .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-43aa39f0] .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-43aa39f0] .qd-service-table-filter-item__all,
229
+ .qd-service-table--mini[data-v-43aa39f0] .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-43aa39f0 {
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-43aa39f0] 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-43aa39f0"]]);
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
+ "v05a25416": affixedHeaderTransform.value,
363
+ "v1a4de8aa": 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 "";
@@ -1446,15 +1635,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1446
1635
  for (let colIdx = colStart; colIdx <= colEnd; colIdx++) {
1447
1636
  const position = positions.find((item) => item.rowIdx === rowIdx && item.colIdx === colIdx);
1448
1637
  const column = columns[colIdx];
1449
- cells.push({
1450
- row,
1451
- colKey: String(column.colKey)
1452
- });
1453
1638
  if (!position) {
1454
- rowValues.push("");
1639
+ rowValues.push(null);
1455
1640
  rowLabels.push("");
1456
1641
  continue;
1457
1642
  }
1643
+ cells.push({
1644
+ row,
1645
+ colKey: String(column.colKey)
1646
+ });
1458
1647
  const colKey = String(column.colKey);
1459
1648
  rowValues.push(resolveCellText(row, colKey));
1460
1649
  if (column.transformCopy) {
@@ -1509,7 +1698,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1509
1698
  const valueText = serializeTsv(selection.valueGrid);
1510
1699
  const html = serializeCellHtml(selection.valueGrid.map((rowValues, rowIdx) => rowValues.map((value, colIdx) => ({
1511
1700
  label: selection.labelGrid[rowIdx][colIdx],
1512
- value
1701
+ value: value ?? "",
1702
+ hole: value === null
1513
1703
  }))));
1514
1704
  const [error] = await to(writeClipboard(plain, html));
1515
1705
  if (error) {
@@ -1541,14 +1731,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1541
1731
  await navigator.clipboard.writeText(plain);
1542
1732
  return;
1543
1733
  }
1544
- const textarea = document.createElement("textarea");
1545
- textarea.value = plain;
1546
- textarea.style.position = "fixed";
1547
- textarea.style.opacity = "0";
1548
- document.body.appendChild(textarea);
1549
- textarea.select();
1734
+ const container = document.createElement("div");
1735
+ container.contentEditable = "true";
1736
+ container.style.position = "fixed";
1737
+ container.style.opacity = "0";
1738
+ container.textContent = plain;
1739
+ document.body.appendChild(container);
1740
+ const range = document.createRange();
1741
+ range.selectNodeContents(container);
1742
+ const selection = document.getSelection();
1743
+ selection?.removeAllRanges();
1744
+ selection?.addRange(range);
1745
+ const handleCopy = (event) => {
1746
+ event.clipboardData?.setData("text/plain", plain);
1747
+ if (html) event.clipboardData?.setData("text/html", html);
1748
+ event.preventDefault();
1749
+ };
1750
+ document.addEventListener("copy", handleCopy);
1550
1751
  const copied = document.execCommand("copy");
1551
- textarea.remove();
1752
+ document.removeEventListener("copy", handleCopy);
1753
+ selection?.removeAllRanges();
1754
+ container.remove();
1552
1755
  if (!copied) throw new Error("[QdServiceTable.writeClipboard] execCommand 复制剪贴板失败");
1553
1756
  }
1554
1757
  function canCopySelectedCells(target) {
@@ -1627,6 +1830,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1627
1830
  label
1628
1831
  } of plan) {
1629
1832
  if (!row || !column) continue;
1833
+ if (value === null) {
1834
+ skipped++;
1835
+ continue;
1836
+ }
1630
1837
  if (!isPasteTargetCell(column, row)) {
1631
1838
  skipped++;
1632
1839
  continue;
@@ -1636,7 +1843,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1636
1843
  row,
1637
1844
  rowIndex,
1638
1845
  column,
1639
- value: htmlValue,
1846
+ value: htmlValue ?? void 0,
1640
1847
  label
1641
1848
  }) : value;
1642
1849
  writeCellPasteValue(row, colKey, writtenValue);
@@ -1662,6 +1869,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1662
1869
  const row = rows[rowIdx];
1663
1870
  const column = columns[colIdx];
1664
1871
  if (!row || !column) continue;
1872
+ if (grid[rowIdx - anchorRowIdx][colIdx - anchorColIdx] === null) continue;
1665
1873
  cells.push({
1666
1874
  row,
1667
1875
  colKey: String(column.colKey)
@@ -1788,6 +1996,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1788
1996
  void exitEditingCell(activeEditingCell.value);
1789
1997
  }
1790
1998
  function handleCellClick(context) {
1999
+ if (suppressNextCellClick) return;
1791
2000
  const column = context.col;
1792
2001
  const cell = {
1793
2002
  row: context.row,
@@ -1840,6 +2049,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1840
2049
  if (!activated.value) return;
1841
2050
  if (event.defaultPrevented) return;
1842
2051
  if (event.key === "Escape") {
2052
+ if (cellDragState) handleCellDragCancel();
1843
2053
  handleSelectionClearKeydown(event.target);
1844
2054
  return;
1845
2055
  }
@@ -1879,6 +2089,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1879
2089
  if (result.written > 0) copiedCells.value = [];
1880
2090
  }
1881
2091
  function handleDocumentClick(event) {
2092
+ if (suppressNextCellClick) return;
1882
2093
  if (!activated.value) return;
1883
2094
  if (!editingCells.value.length && !selectedCell.value && !selectedCells.value.length) return;
1884
2095
  const hasVisibleDialog = Array.from(document.querySelectorAll(".t-dialog")).some((element) => element.getClientRects().length);
@@ -2496,17 +2707,30 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2496
2707
  };
2497
2708
  const finalizeColumn = (col) => {
2498
2709
  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
- });
2710
+ col.attrs = (context) => {
2711
+ const baseAttrs = typeof previousAttrs === "function" ? previousAttrs(context) : previousAttrs;
2712
+ if (context.type !== "td") return baseAttrs;
2713
+ return {
2714
+ ...baseAttrs,
2715
+ // 拖选反查用:表头/表尾/横向虚拟占位列不带标记,closest 直接排除
2716
+ "data-qd-col-key": String(column.colKey),
2717
+ "data-qd-row-key": String(getRowValue(context.row)),
2718
+ onMousedownCapture: (event) => {
2719
+ handleCellDragMousedown(event, {
2720
+ row: context.row,
2721
+ colKey: column.colKey
2722
+ }, column);
2723
+ },
2724
+ onClickCapture: (event) => {
2725
+ if (suppressNextCellClick) return;
2726
+ handledSelectionEvents.add(event);
2727
+ applyCellSelection({
2728
+ row: context.row,
2729
+ colKey: column.colKey
2730
+ }, event);
2731
+ }
2732
+ };
2733
+ };
2510
2734
  return col;
2511
2735
  };
2512
2736
  if (tableReadonly.value || !formItem) {
@@ -2855,6 +3079,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2855
3079
  flush: "post"
2856
3080
  });
2857
3081
  watch(data, (newData) => {
3082
+ handleCellDragCancel();
2858
3083
  pruneCellValidationErrors(newData);
2859
3084
  pruneDisabledSelectedRows(newData);
2860
3085
  });
@@ -2916,10 +3141,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2916
3141
  scheduleScrollRestore(position);
2917
3142
  });
2918
3143
  onDeactivated(() => {
3144
+ handleCellDragCancel();
2919
3145
  cancelScrollRestore();
2920
3146
  tableContentPause();
2921
3147
  });
2922
3148
  onBeforeUnmount(() => {
3149
+ handleCellDragCancel();
2923
3150
  cancelScrollRestore();
2924
3151
  tableContentStop();
2925
3152
  if (probeRafId) cancelAnimationFrame(probeRafId);
@@ -2969,7 +3196,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2969
3196
  return (_ctx, _cache) => {
2970
3197
  return withDirectives((openBlock(), createBlock(resolveDynamicComponent(reProps.value.tableOptions.tree ? unref(EnhancedTable) : unref(Table)), mergeProps({
2971
3198
  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" : ""],
3199
+ 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
3200
  onMouseenter: handleTableMouseEnter,
2974
3201
  "selected-row-keys": unref(selectedRowKeys),
2975
3202
  "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.64",
4
4
  "description": "基于 TDesign 的 QiDian Vue UI 组件库",
5
5
  "author": "qidian",
6
6
  "license": "MIT",