bkui-vue 2.1.0-dev-beta.11 → 2.1.0-dev-beta.13

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.
@@ -13,11 +13,19 @@ export type TreeNode = {
13
13
  };
14
14
  /**
15
15
  * 拖拽放置类型
16
- * - child: 作为目标节点的子节点
17
- * - move: 作为目标节点的同级节点(非排序模式)
18
- * - sort: 同父节点下排序(排序模式)
16
+ * - 同父级节点,落在目标节点前/后:dropType = 'sort'
17
+ * - 同父级节点,落在目标节点中间作为直接子节点:dropType = 'child'
18
+ * - 非同父级等其他情况:dropType = 'move'
19
+ * 非同父级等其他情况:dropType = 'move'
19
20
  */
20
21
  export type DropType = 'child' | 'move' | 'sort';
22
+ /**
23
+ * 拖拽添加为子节点后,目标节点的展开状态
24
+ * - expand: 展开目标节点
25
+ * - collapse: 收起目标节点
26
+ * - inherit: 保持目标节点当前展开收起状态
27
+ */
28
+ export type DragTargetOpenState = 'collapse' | 'expand' | 'inherit';
21
29
  export type DisableDropHandler = (data: TreeNode, type: DropType, target: TreeNode) => boolean;
22
30
  export type TreeDataChangeTrigger = 'async' | 'drag';
23
31
  export type TreeDataChangePayload = {
@@ -193,9 +201,7 @@ export declare const treeProps: {
193
201
  */
194
202
  disableDrop: PropType<DisableDropHandler>;
195
203
  /**
196
- * 拖拽阈值
197
- * 用于判断拖拽时鼠标位置与节点的距离
198
- * 当鼠标位置与节点的距离大于此值时,才会触发拖拽
204
+ * 拖拽阈值:节点顶部/底部区域占比用于判定前后插入,中间区域作为目标子节点
199
205
  */
200
206
  dragThreshold: import("vue-types").VueTypeValidableDef<number> & {
201
207
  default: number;
@@ -203,7 +209,7 @@ export declare const treeProps: {
203
209
  default: number;
204
210
  };
205
211
  /**
206
- * 节点拖拽时可交换位置(开启拖拽可交换位置后将不支持改变层级)
212
+ * 节点拖拽时可调整前后顺序;拖拽到节点中部仍会添加为目标子节点
207
213
  */
208
214
  dragSort: import("vue-types").VueTypeValidableDef<boolean> & {
209
215
  default: boolean;
@@ -219,6 +225,15 @@ export declare const treeProps: {
219
225
  dragSortMode: import("vue-types").VueTypeDef<string> & {
220
226
  default: string;
221
227
  };
228
+ /**
229
+ * 拖拽添加为子节点后,目标节点的展开状态
230
+ * - expand: 展开目标节点
231
+ * - collapse: 收起目标节点
232
+ * - inherit: 保持目标节点当前展开收起状态
233
+ */
234
+ dragTargetOpenState: import("vue-types").VueTypeDef<string> & {
235
+ default: string;
236
+ };
222
237
  /**
223
238
  * 节点是否可以选中
224
239
  */
package/lib/tree/tree.css CHANGED
@@ -189,29 +189,6 @@
189
189
  .bk-tree .bk-node-row.is-selected:hover {
190
190
  background-color: #e1ecff;
191
191
  }
192
- .bk-tree .bk-node-row.drop-before::before {
193
- content: '';
194
- position: absolute;
195
- top: 0;
196
- left: 0;
197
- right: 0;
198
- height: 1px;
199
- background-color: #2196F3;
200
- }
201
- .bk-tree .bk-node-row.drop-after::before {
202
- content: '';
203
- position: absolute;
204
- bottom: 0;
205
- left: 0;
206
- right: 0;
207
- height: 1px;
208
- background-color: #2196F3;
209
- }
210
- .bk-tree .bk-node-row.drop-inner {
211
- background-color: rgba(33, 150, 243, 0.1);
212
- outline: 1px dashed #2196F3;
213
- outline-offset: -1px;
214
- }
215
192
  .bk-tree-node {
216
193
  position: relative;
217
194
  display: flex;
@@ -297,68 +274,49 @@
297
274
  text-overflow: ellipsis;
298
275
  white-space: nowrap;
299
276
  }
300
- .bk-tree-drop-active {
301
- background: #f5f7fa;
277
+ .bk-tree-node-draggable {
278
+ cursor: grab;
279
+ user-select: none;
302
280
  }
303
- .bk-tree-drop-disabled {
304
- background: #ffd5d5;
281
+ .bk-tree-node-draggable:hover {
282
+ background-color: #f5f7fa;
305
283
  }
306
- .bk-tree-drop-disabled .bk-tree-node {
284
+ .bk-tree-drop-disabled {
307
285
  cursor: no-drop;
308
- }
309
- .bk-tree-ghost {
310
286
  opacity: 0.5;
311
- background: #c8ebfb;
312
- }
313
- .bk-tree-chosen {
314
- background: #e1ecff;
315
287
  }
316
288
  .bk-tree-drag {
317
- opacity: 0.8;
318
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
289
+ opacity: 0.85;
319
290
  cursor: grabbing;
320
291
  }
321
- .bk-tree-drag-disabled .bk-node-row {
292
+ .bk-tree-drag-disabled {
322
293
  cursor: no-drop;
323
294
  opacity: 0.5;
324
295
  }
325
- .bk-tree .insert-line {
296
+ .bk-tree-drop-before,
297
+ .bk-tree-drop-after,
298
+ .bk-tree-drop-inner {
299
+ background-clip: content-box;
300
+ }
301
+ .bk-tree-drop-before::after,
302
+ .bk-tree-drop-after::after {
326
303
  position: absolute;
304
+ right: 0;
305
+ left: var(--drop-line-left, 0);
306
+ display: block;
327
307
  height: 2px;
328
- background: #2196F3;
329
- display: none;
330
- pointer-events: none;
331
- z-index: 999;
332
- }
333
- .bk-tree-drop-indicator {
334
- position: fixed;
335
- pointer-events: none;
336
- z-index: 9999;
337
- }
338
- .bk-tree-drop-indicator.bk-tree-drop-inner {
339
- background: rgba(33, 150, 243, 0.06);
340
- outline: 2px dashed #3a84ff;
341
- outline-offset: -2px;
342
- border-radius: 2px;
343
- box-shadow: inset 0 0 0 1px rgba(58, 132, 255, 0.1);
344
- }
345
- .bk-tree-drop-indicator.bk-tree-drop-line {
346
- background: #3a84ff;
347
308
  border-radius: 1px;
348
- }
349
- .bk-tree-drop-indicator.bk-tree-drop-line::before,
350
- .bk-tree-drop-indicator.bk-tree-drop-line::after {
309
+ background-color: #3a84ff;
351
310
  content: '';
352
- position: absolute;
353
- width: 6px;
354
- height: 6px;
355
- border-radius: 50%;
356
- background: #3a84ff;
357
- top: -2px;
311
+ pointer-events: none;
358
312
  }
359
- .bk-tree-drop-indicator.bk-tree-drop-line::before {
360
- left: 0;
313
+ .bk-tree-drop-before::after {
314
+ top: -1px;
361
315
  }
362
- .bk-tree-drop-indicator.bk-tree-drop-line::after {
363
- right: 0;
316
+ .bk-tree-drop-after::after {
317
+ bottom: -1px;
318
+ }
319
+ .bk-tree-drop-inner {
320
+ background-color: rgba(58, 132, 255, 0.08);
321
+ box-shadow: inset 0 0 0 1px rgba(58, 132, 255, 0.28);
364
322
  }
@@ -85,6 +85,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
85
85
  dragSortMode: import("vue-types").VueTypeDef<string> & {
86
86
  default: string;
87
87
  };
88
+ dragTargetOpenState: import("vue-types").VueTypeDef<string> & {
89
+ default: string;
90
+ };
88
91
  selectable: import("vue-types").VueTypeDef<any> & {
89
92
  default: any;
90
93
  };
@@ -242,6 +245,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
242
245
  dragSortMode: import("vue-types").VueTypeDef<string> & {
243
246
  default: string;
244
247
  };
248
+ dragTargetOpenState: import("vue-types").VueTypeDef<string> & {
249
+ default: string;
250
+ };
245
251
  selectable: import("vue-types").VueTypeDef<any> & {
246
252
  default: any;
247
253
  };
@@ -338,6 +344,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
338
344
  dragThreshold: number;
339
345
  dragSort: boolean;
340
346
  dragSortMode: string;
347
+ dragTargetOpenState: string;
341
348
  selectable: any;
342
349
  disabledFolderSelectable: boolean;
343
350
  showCheckbox: any;
@@ -23,34 +23,6 @@
23
23
  }
24
24
  }
25
25
 
26
- &.drop-before {
27
- &::before {
28
- content: '';
29
- position: absolute;
30
- top: 0;
31
- left: 0;
32
- right: 0;
33
- height: 1px;
34
- background-color: #2196F3;
35
- }
36
- }
37
- &.drop-after {
38
- &::before {
39
- content: '';
40
- position: absolute;
41
- bottom: 0;
42
- left: 0;
43
- right: 0;
44
- height: 1px;
45
- background-color: #2196F3;
46
- }
47
- }
48
-
49
- &.drop-inner {
50
- background-color: rgba(33, 150, 243, 0.1);
51
- outline: 1px dashed #2196F3;
52
- outline-offset: -1px;
53
- }
54
26
  }
55
27
 
56
28
  &-node {
@@ -161,83 +133,61 @@
161
133
  }
162
134
  }
163
135
 
164
- &-drop-active {
165
- background: #f5f7fa;
166
- }
136
+ &-node-draggable {
137
+ cursor: grab;
138
+ user-select: none;
167
139
 
168
- &-drop-disabled {
169
- background: #ffd5d5;
170
- .@{bk-prefix}-tree-node {
171
- cursor: no-drop;
140
+ &:hover {
141
+ background-color: #f5f7fa;
172
142
  }
173
143
  }
174
144
 
175
- &-ghost {
145
+ &-drop-disabled {
146
+ cursor: no-drop;
176
147
  opacity: 0.5;
177
- background: #c8ebfb;
178
- }
179
-
180
- &-chosen {
181
- background: #e1ecff;
182
148
  }
183
149
 
184
150
  &-drag {
185
- opacity: 0.8;
186
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
151
+ opacity: 0.85;
187
152
  cursor: grabbing;
188
153
  }
189
154
 
190
155
  &-drag-disabled {
191
- .@{bk-prefix}-node-row {
192
- cursor: no-drop;
193
- opacity: 0.5;
194
- }
195
- }
196
-
197
- .insert-line {
198
- position: absolute;
199
- height: 2px;
200
- background: #2196F3;
201
- display: none;
202
- pointer-events: none;
203
- z-index: 999;
156
+ cursor: no-drop;
157
+ opacity: 0.5;
204
158
  }
205
- }
206
159
 
207
- .@{bk-prefix}-tree-drop-indicator {
208
- position: fixed;
209
- pointer-events: none;
210
- z-index: 9999;
211
-
212
- &.@{bk-prefix}-tree-drop-inner {
213
- background: rgba(33, 150, 243, 0.06);
214
- outline: 2px dashed #3a84ff;
215
- outline-offset: -2px;
216
- border-radius: 2px;
217
- box-shadow: inset 0 0 0 1px rgba(58, 132, 255, 0.1);
160
+ &-drop-before,
161
+ &-drop-after,
162
+ &-drop-inner {
163
+ background-clip: content-box;
218
164
  }
219
165
 
220
- &.@{bk-prefix}-tree-drop-line {
221
- background: #3a84ff;
222
- border-radius: 1px;
223
-
224
- &::before,
166
+ &-drop-before,
167
+ &-drop-after {
225
168
  &::after {
226
- content: '';
227
169
  position: absolute;
228
- width: 6px;
229
- height: 6px;
230
- border-radius: 50%;
231
- background: #3a84ff;
232
- top: -2px;
170
+ right: 0;
171
+ left: var(--drop-line-left, 0);
172
+ display: block;
173
+ height: 2px;
174
+ border-radius: 1px;
175
+ background-color: #3a84ff;
176
+ content: '';
177
+ pointer-events: none;
233
178
  }
179
+ }
234
180
 
235
- &::before {
236
- left: 0;
237
- }
181
+ &-drop-before::after {
182
+ top: -1px;
183
+ }
238
184
 
239
- &::after {
240
- right: 0;
241
- }
185
+ &-drop-after::after {
186
+ bottom: -1px;
187
+ }
188
+
189
+ &-drop-inner {
190
+ background-color: rgba(58, 132, 255, 0.08);
191
+ box-shadow: inset 0 0 0 1px rgba(58, 132, 255, 0.28);
242
192
  }
243
193
  }
@@ -320,29 +320,6 @@
320
320
  .bk-tree .bk-node-row.is-selected:hover {
321
321
  background-color: #e1ecff;
322
322
  }
323
- .bk-tree .bk-node-row.drop-before::before {
324
- content: '';
325
- position: absolute;
326
- top: 0;
327
- left: 0;
328
- right: 0;
329
- height: 1px;
330
- background-color: #2196F3;
331
- }
332
- .bk-tree .bk-node-row.drop-after::before {
333
- content: '';
334
- position: absolute;
335
- bottom: 0;
336
- left: 0;
337
- right: 0;
338
- height: 1px;
339
- background-color: #2196F3;
340
- }
341
- .bk-tree .bk-node-row.drop-inner {
342
- background-color: rgba(33, 150, 243, 0.1);
343
- outline: 1px dashed #2196F3;
344
- outline-offset: -1px;
345
- }
346
323
  .bk-tree-node {
347
324
  position: relative;
348
325
  display: flex;
@@ -428,68 +405,49 @@
428
405
  text-overflow: ellipsis;
429
406
  white-space: nowrap;
430
407
  }
431
- .bk-tree-drop-active {
432
- background: #f5f7fa;
408
+ .bk-tree-node-draggable {
409
+ cursor: grab;
410
+ user-select: none;
433
411
  }
434
- .bk-tree-drop-disabled {
435
- background: #ffd5d5;
412
+ .bk-tree-node-draggable:hover {
413
+ background-color: #f5f7fa;
436
414
  }
437
- .bk-tree-drop-disabled .bk-tree-node {
415
+ .bk-tree-drop-disabled {
438
416
  cursor: no-drop;
439
- }
440
- .bk-tree-ghost {
441
417
  opacity: 0.5;
442
- background: #c8ebfb;
443
- }
444
- .bk-tree-chosen {
445
- background: #e1ecff;
446
418
  }
447
419
  .bk-tree-drag {
448
- opacity: 0.8;
449
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
420
+ opacity: 0.85;
450
421
  cursor: grabbing;
451
422
  }
452
- .bk-tree-drag-disabled .bk-node-row {
423
+ .bk-tree-drag-disabled {
453
424
  cursor: no-drop;
454
425
  opacity: 0.5;
455
426
  }
456
- .bk-tree .insert-line {
427
+ .bk-tree-drop-before,
428
+ .bk-tree-drop-after,
429
+ .bk-tree-drop-inner {
430
+ background-clip: content-box;
431
+ }
432
+ .bk-tree-drop-before::after,
433
+ .bk-tree-drop-after::after {
457
434
  position: absolute;
435
+ right: 0;
436
+ left: var(--drop-line-left, 0);
437
+ display: block;
458
438
  height: 2px;
459
- background: #2196F3;
460
- display: none;
461
- pointer-events: none;
462
- z-index: 999;
463
- }
464
- .bk-tree-drop-indicator {
465
- position: fixed;
466
- pointer-events: none;
467
- z-index: 9999;
468
- }
469
- .bk-tree-drop-indicator.bk-tree-drop-inner {
470
- background: rgba(33, 150, 243, 0.06);
471
- outline: 2px dashed #3a84ff;
472
- outline-offset: -2px;
473
- border-radius: 2px;
474
- box-shadow: inset 0 0 0 1px rgba(58, 132, 255, 0.1);
475
- }
476
- .bk-tree-drop-indicator.bk-tree-drop-line {
477
- background: #3a84ff;
478
439
  border-radius: 1px;
479
- }
480
- .bk-tree-drop-indicator.bk-tree-drop-line::before,
481
- .bk-tree-drop-indicator.bk-tree-drop-line::after {
440
+ background-color: #3a84ff;
482
441
  content: '';
483
- position: absolute;
484
- width: 6px;
485
- height: 6px;
486
- border-radius: 50%;
487
- background: #3a84ff;
488
- top: -2px;
442
+ pointer-events: none;
489
443
  }
490
- .bk-tree-drop-indicator.bk-tree-drop-line::before {
491
- left: 0;
444
+ .bk-tree-drop-before::after {
445
+ top: -1px;
492
446
  }
493
- .bk-tree-drop-indicator.bk-tree-drop-line::after {
494
- right: 0;
447
+ .bk-tree-drop-after::after {
448
+ bottom: -1px;
449
+ }
450
+ .bk-tree-drop-inner {
451
+ background-color: rgba(58, 132, 255, 0.08);
452
+ box-shadow: inset 0 0 0 1px rgba(58, 132, 255, 0.28);
495
453
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkui-vue",
3
- "version": "2.1.0-dev-beta.11",
3
+ "version": "2.1.0-dev-beta.13",
4
4
  "workspaces": [
5
5
  "packages/**",
6
6
  "scripts/cli",
@@ -135,7 +135,6 @@
135
135
  "js-calendar": "~1.2.3",
136
136
  "json-formatter-js": "~2.3.4",
137
137
  "lodash": "~4.17.21",
138
- "sortablejs": "~1.15.7",
139
138
  "tinycolor2": "~1.6.0",
140
139
  "vue-types": "~4.1.1"
141
140
  }