vue-devui 1.0.0-beta.10 → 1.0.0-beta.14

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 (82) hide show
  1. package/README.md +62 -45
  2. package/accordion/index.es.js +309 -38
  3. package/accordion/index.umd.js +1 -1
  4. package/accordion/style.css +1 -1
  5. package/alert/index.es.js +5 -2
  6. package/alert/index.umd.js +1 -1
  7. package/auto-complete/index.d.ts +7 -0
  8. package/auto-complete/index.es.js +1121 -0
  9. package/auto-complete/index.umd.js +1 -0
  10. package/auto-complete/package.json +7 -0
  11. package/auto-complete/style.css +1 -0
  12. package/button/index.es.js +213 -8
  13. package/button/index.umd.js +1 -1
  14. package/button/style.css +1 -1
  15. package/color-picker/index.d.ts +7 -0
  16. package/color-picker/index.es.js +2960 -0
  17. package/color-picker/index.umd.js +1 -0
  18. package/color-picker/package.json +7 -0
  19. package/color-picker/style.css +1 -0
  20. package/dragdrop/index.es.js +135 -10
  21. package/dragdrop/index.umd.js +1 -1
  22. package/drawer/index.es.js +38 -6
  23. package/drawer/index.umd.js +1 -1
  24. package/dropdown/index.es.js +30 -22
  25. package/dropdown/index.umd.js +1 -1
  26. package/dropdown/style.css +1 -1
  27. package/editable-select/index.es.js +67 -3
  28. package/editable-select/index.umd.js +11 -11
  29. package/form/index.es.js +59 -17
  30. package/form/index.umd.js +1 -1
  31. package/gantt/index.es.js +3 -3
  32. package/gantt/index.umd.js +1 -1
  33. package/image-preview/index.es.js +33 -15
  34. package/image-preview/index.umd.js +1 -1
  35. package/modal/index.es.js +214 -13
  36. package/modal/index.umd.js +1 -1
  37. package/modal/style.css +1 -1
  38. package/nuxt/components/AutoComplete.js +3 -0
  39. package/nuxt/components/ColorPicker.js +3 -0
  40. package/nuxt/components/DrawerService.js +3 -0
  41. package/overlay/index.es.js +1 -1
  42. package/overlay/index.umd.js +1 -1
  43. package/package.json +1 -16
  44. package/popover/index.es.js +13 -4
  45. package/popover/index.umd.js +1 -1
  46. package/progress/index.es.js +8 -8
  47. package/progress/index.umd.js +3 -3
  48. package/radio/index.es.js +5 -5
  49. package/radio/index.umd.js +1 -1
  50. package/slider/index.es.js +2 -5
  51. package/slider/index.umd.js +1 -1
  52. package/slider/style.css +1 -1
  53. package/splitter/index.es.js +191 -14
  54. package/splitter/index.umd.js +1 -1
  55. package/splitter/style.css +1 -1
  56. package/statistic/index.es.js +4 -4
  57. package/statistic/index.umd.js +1 -1
  58. package/statistic/style.css +1 -1
  59. package/style.css +1 -1
  60. package/table/index.es.js +236 -26
  61. package/table/index.umd.js +1 -1
  62. package/table/style.css +1 -1
  63. package/time-picker/index.es.js +221 -11
  64. package/time-picker/index.umd.js +1 -1
  65. package/time-picker/style.css +1 -1
  66. package/toast/index.es.js +8 -5
  67. package/toast/index.umd.js +1 -1
  68. package/toast/style.css +1 -1
  69. package/transfer/index.es.js +503 -59
  70. package/transfer/index.umd.js +1 -1
  71. package/transfer/style.css +1 -1
  72. package/tree/index.es.js +6 -5
  73. package/tree/index.umd.js +1 -1
  74. package/tree-select/index.es.js +129 -34
  75. package/tree-select/index.umd.js +1 -1
  76. package/tree-select/style.css +1 -1
  77. package/upload/index.es.js +165 -507
  78. package/upload/index.umd.js +1 -1
  79. package/upload/style.css +1 -1
  80. package/vue-devui.es.js +16501 -13904
  81. package/vue-devui.umd.js +19 -19
  82. package/nuxt/components/MultiUpload.js +0 -3
@@ -17,8 +17,42 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { computed, defineComponent, inject, createVNode, mergeProps, toRef, provide, ref, watch, withDirectives, resolveDirective, resolveComponent, reactive, onMounted, onBeforeUnmount, renderSlot, useSlots, isVNode, createTextVNode } from "vue";
21
- const transferBaseProps = {
20
+ var __publicField = (obj, key, value) => {
21
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
22
+ return value;
23
+ };
24
+ import { computed, defineComponent, inject, createVNode, mergeProps, toRef, provide, ref, watch, withDirectives, resolveDirective, resolveComponent, reactive, onMounted, onBeforeUnmount, renderSlot, useSlots, isVNode, onUnmounted, createTextVNode, h, render } from "vue";
25
+ const transferCommon = {
26
+ showTooltip: {
27
+ type: Boolean,
28
+ default: () => false
29
+ },
30
+ tooltipPosition: {
31
+ type: String,
32
+ default: () => "top"
33
+ }
34
+ };
35
+ const transferDragFunctions = {
36
+ onDragstart: {
37
+ type: Function
38
+ },
39
+ onDrop: {
40
+ type: Function
41
+ },
42
+ onDragleave: {
43
+ type: Function
44
+ },
45
+ onDragover: {
46
+ type: Function
47
+ },
48
+ onDragenter: {
49
+ type: Function
50
+ },
51
+ onDragend: {
52
+ type: Function
53
+ }
54
+ };
55
+ const transferBaseProps = __spreadProps(__spreadValues(__spreadValues({}, transferCommon), transferDragFunctions), {
22
56
  sourceOption: {
23
57
  type: Array,
24
58
  default() {
@@ -71,13 +105,13 @@ const transferBaseProps = {
71
105
  type: Number,
72
106
  default: () => 0
73
107
  },
74
- showTooltip: {
108
+ isSourceDroppable: {
75
109
  type: Boolean,
76
110
  default: () => false
77
111
  },
78
- tooltipPosition: {
79
- type: String,
80
- default: () => "top"
112
+ isTargetDroppable: {
113
+ type: Boolean,
114
+ default: () => false
81
115
  },
82
116
  scopedSlots: {
83
117
  type: Object
@@ -90,8 +124,11 @@ const transferBaseProps = {
90
124
  },
91
125
  onUpdateCheckeds: {
92
126
  type: Function
127
+ },
128
+ onDragend: {
129
+ type: Function
93
130
  }
94
- };
131
+ });
95
132
  const getFilterData = (props, type) => {
96
133
  const newModel = [];
97
134
  const data = type === "source" ? props.sourceOption : props.targetOption;
@@ -994,6 +1031,15 @@ var DSearch = defineComponent({
994
1031
  };
995
1032
  }
996
1033
  });
1034
+ const transferDragProps = __spreadProps(__spreadValues(__spreadValues({}, transferCommon), transferDragFunctions), {
1035
+ itemData: {
1036
+ type: Object
1037
+ },
1038
+ id: {
1039
+ type: Number,
1040
+ default: () => null
1041
+ }
1042
+ });
997
1043
  const tooltipProps = {
998
1044
  position: {
999
1045
  type: String,
@@ -1152,6 +1198,159 @@ var DTooltip = defineComponent({
1152
1198
  };
1153
1199
  }
1154
1200
  });
1201
+ const transferCheckboxProps = __spreadProps(__spreadValues({}, transferCommon), {
1202
+ data: {
1203
+ type: Object
1204
+ },
1205
+ id: {
1206
+ type: Number
1207
+ }
1208
+ });
1209
+ function _isSlot$1(s) {
1210
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
1211
+ }
1212
+ var DTransfeCheckbox = defineComponent({
1213
+ name: "DTransferCheckbox",
1214
+ components: {
1215
+ DCheckbox,
1216
+ DTooltip
1217
+ },
1218
+ props: transferCheckboxProps,
1219
+ setup(props) {
1220
+ const renderCheckbox = () => {
1221
+ return createVNode(DCheckbox, {
1222
+ "label": props.data.key,
1223
+ "value": props.data.value,
1224
+ "disabled": props.data.disabled,
1225
+ "class": "devui-transfer-panel-body-list-item",
1226
+ "key": props.id
1227
+ }, null);
1228
+ };
1229
+ return () => {
1230
+ let _slot;
1231
+ return !props.showTooltip ? renderCheckbox() : createVNode(DTooltip, {
1232
+ "class": "devui-transfer-panel-body-list-tooltip",
1233
+ "position": props.tooltipPosition,
1234
+ "content": props.data.key
1235
+ }, _isSlot$1(_slot = renderCheckbox()) ? _slot : {
1236
+ default: () => [_slot]
1237
+ });
1238
+ };
1239
+ }
1240
+ });
1241
+ var devuiIcon = "";
1242
+ var DTransferDrag = defineComponent({
1243
+ name: "DTransferDrag",
1244
+ components: {
1245
+ DTransfeCheckbox
1246
+ },
1247
+ props: transferDragProps,
1248
+ setup(props) {
1249
+ const dragRef = ref(null);
1250
+ const dragHighlight = ref(false);
1251
+ const dragOverNodeKey = ref("");
1252
+ const dropPosition = ref(null);
1253
+ const dragTimer = ref(null);
1254
+ const calcDropPosition = (event) => {
1255
+ const {
1256
+ clientY
1257
+ } = event;
1258
+ const {
1259
+ top,
1260
+ bottom,
1261
+ height
1262
+ } = dragRef.value.getBoundingClientRect();
1263
+ const des = Math.max(height * 0.25, 2);
1264
+ if (clientY <= top + des) {
1265
+ return -1;
1266
+ }
1267
+ if (clientY >= bottom - des) {
1268
+ return 1;
1269
+ }
1270
+ return 0;
1271
+ };
1272
+ const resetState = () => {
1273
+ dragOverNodeKey.value = "";
1274
+ dropPosition.value = null;
1275
+ dragHighlight.value = null;
1276
+ };
1277
+ onUnmounted(() => {
1278
+ clearTimeout(dragTimer.value);
1279
+ });
1280
+ return () => {
1281
+ const state = dragOverNodeKey.value === props.itemData.key;
1282
+ return createVNode("div", {
1283
+ "class": {
1284
+ "devui-transfer-panel-body-list-item": true,
1285
+ "devui-transfer-drag-dragging": dragHighlight.value,
1286
+ "devui-transfer-drag-over": state && dropPosition.value === 0,
1287
+ "devui-transfer\u2013drag-over-top": state && dropPosition.value === -1,
1288
+ "devui-transfer\u2013drag-over-bottom": state && dropPosition.value === 1
1289
+ },
1290
+ "onDragenter": (event) => {
1291
+ event.preventDefault();
1292
+ event.stopPropagation();
1293
+ clearTimeout(dragTimer.value);
1294
+ const curDropPosition = calcDropPosition(event);
1295
+ if (props.itemData.key === dragOverNodeKey.value && curDropPosition === 0) {
1296
+ resetState();
1297
+ return;
1298
+ }
1299
+ dragTimer.value = setTimeout(() => {
1300
+ dragOverNodeKey.value = props.itemData.key;
1301
+ dropPosition.value = curDropPosition;
1302
+ }, 0);
1303
+ props.onDragenter && props.onDragenter(event, props.itemData);
1304
+ },
1305
+ "onDragover": (event) => {
1306
+ event.preventDefault();
1307
+ event.stopPropagation();
1308
+ if (props.itemData.key === dragOverNodeKey.value) {
1309
+ const curDropPosition = calcDropPosition(event);
1310
+ if (curDropPosition === dropPosition.value) {
1311
+ return;
1312
+ }
1313
+ dropPosition.value = curDropPosition;
1314
+ }
1315
+ props.onDragover && props.onDragover(event, props.itemData);
1316
+ },
1317
+ "onDragleave": (event) => {
1318
+ event.stopPropagation();
1319
+ resetState();
1320
+ props.onDragleave && props.onDragleave(event, props.itemData);
1321
+ },
1322
+ "onDrop": (event) => {
1323
+ event.preventDefault();
1324
+ event.stopPropagation();
1325
+ resetState();
1326
+ props.onDrop && props.onDrop(event, props.itemData);
1327
+ },
1328
+ "onDragend": (event) => {
1329
+ event.stopPropagation();
1330
+ props.onDragend && props.onDragend(event, props.itemData);
1331
+ }
1332
+ }, [createVNode("div", {
1333
+ "class": "devui-transfer-panel-body-list-drag",
1334
+ "draggable": true,
1335
+ "ref": dragRef,
1336
+ "onDragstart": (event) => {
1337
+ event.stopPropagation();
1338
+ dragHighlight.value = true;
1339
+ props.onDragstart && props.onDragstart(event, props.itemData);
1340
+ }
1341
+ }, [createVNode("span", {
1342
+ "class": "devui-transfer-panel-body-list-drag__icon"
1343
+ }, [createVNode(resolveComponent("d-icon"), {
1344
+ "name": "drag-small"
1345
+ }, null)]), createVNode(DTransfeCheckbox, {
1346
+ "data": props.itemData,
1347
+ "id": props.id,
1348
+ "showTooltip": props.showTooltip,
1349
+ "tooltipPosition": props.tooltipPosition
1350
+ }, null)])]);
1351
+ };
1352
+ }
1353
+ });
1155
1354
  function _isSlot(s) {
1156
1355
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
1157
1356
  }
@@ -1161,54 +1360,98 @@ var DTransferBase = defineComponent({
1161
1360
  DSearch,
1162
1361
  DCheckboxGroup,
1163
1362
  DCheckbox,
1164
- DTooltip
1363
+ DTransferDrag,
1364
+ DTransfeCheckbox
1165
1365
  },
1166
1366
  props: transferBaseProps,
1167
1367
  setup(props, ctx) {
1368
+ const allHalfchecked = ref(false);
1168
1369
  const modelValues = computed(() => props.checkedValues);
1370
+ const dragWrapClass = computed(() => {
1371
+ const isDrag = props.isSourceDroppable || props.isTargetDroppable;
1372
+ return `devui-transfer-panel-body-list devui-transfer-panel-body-${isDrag ? "" : "no"}drag`;
1373
+ });
1169
1374
  const searchQuery = computed(() => props.filter);
1170
1375
  const baseClass = TransferBaseClass(props);
1376
+ const dropItem = ref(null);
1377
+ watch(() => props.checkedNum, (nVal) => {
1378
+ if (props.allChecked) {
1379
+ allHalfchecked.value = !props.allChecked;
1380
+ } else {
1381
+ allHalfchecked.value = nVal !== 0;
1382
+ }
1383
+ }, {
1384
+ immediate: true
1385
+ });
1171
1386
  const updateSearchQuery = (val) => ctx.emit("changeQuery", val);
1172
- const renderCheckbox = (props2, key, showTooltip = false, tooltipPosition = "top") => {
1173
- const checkbox2 = createVNode(DCheckbox, {
1174
- "class": "devui-transfer-panel-body-list-item",
1175
- "label": props2.key,
1176
- "value": props2.value,
1177
- "disabled": props2.disabled,
1178
- "key": key
1179
- }, null);
1180
- return !showTooltip ? checkbox2 : createVNode(DTooltip, {
1181
- "position": tooltipPosition,
1182
- "content": props2.key
1183
- }, _isSlot(checkbox2) ? checkbox2 : {
1184
- default: () => [checkbox2]
1387
+ const renderCheckboxGroup = () => {
1388
+ let _slot;
1389
+ return createVNode(DCheckboxGroup, {
1390
+ "modelValue": modelValues.value,
1391
+ "onChange": (values) => ctx.emit("updateCheckeds", values)
1392
+ }, _isSlot(_slot = props.sourceOption.map((item, idx) => {
1393
+ return createVNode(DTransfeCheckbox, {
1394
+ "data": item,
1395
+ "id": idx,
1396
+ "showTooltip": props.showTooltip,
1397
+ "tooltipPosition": props.tooltipPosition
1398
+ }, null);
1399
+ })) ? _slot : {
1400
+ default: () => [_slot]
1401
+ });
1402
+ };
1403
+ const renderDragCheckboxGroup = () => {
1404
+ let _slot2;
1405
+ return createVNode(DCheckboxGroup, {
1406
+ "modelValue": modelValues.value,
1407
+ "onChange": (values) => ctx.emit("updateCheckeds", values)
1408
+ }, _isSlot(_slot2 = props.sourceOption.map((item, idx) => {
1409
+ return createVNode(DTransferDrag, {
1410
+ "itemData": item,
1411
+ "id": idx,
1412
+ "showTooltip": props.showTooltip,
1413
+ "tooltipPosition": props.tooltipPosition,
1414
+ "onDrop": (event, item2) => {
1415
+ dropItem.value = item2;
1416
+ },
1417
+ "onDragend": (event, dragItem) => {
1418
+ props.onDragend && props.onDragend(dragItem, dropItem.value);
1419
+ }
1420
+ }, null);
1421
+ })) ? _slot2 : {
1422
+ default: () => [_slot2]
1185
1423
  });
1186
1424
  };
1187
1425
  return {
1188
1426
  baseClass,
1189
1427
  searchQuery,
1428
+ dragWrapClass,
1190
1429
  modelValues,
1430
+ dropItem,
1431
+ allHalfchecked,
1191
1432
  updateSearchQuery,
1192
- renderCheckbox
1433
+ renderCheckboxGroup,
1434
+ renderDragCheckboxGroup
1193
1435
  };
1194
1436
  },
1195
1437
  render() {
1196
- let _slot;
1197
1438
  const {
1198
1439
  title,
1199
1440
  baseClass,
1200
1441
  checkedNum,
1201
1442
  allChecked,
1443
+ allHalfchecked,
1202
1444
  sourceOption,
1203
1445
  allCount,
1204
1446
  updateSearchQuery,
1205
1447
  search: search2,
1206
1448
  searchQuery,
1207
- modelValues,
1449
+ dragWrapClass,
1208
1450
  height,
1209
- showTooltip,
1210
- tooltipPosition,
1211
- renderCheckbox
1451
+ isSourceDroppable,
1452
+ isTargetDroppable,
1453
+ renderCheckboxGroup,
1454
+ renderDragCheckboxGroup
1212
1455
  } = this;
1213
1456
  return createVNode("div", {
1214
1457
  "class": baseClass
@@ -1217,8 +1460,11 @@ var DTransferBase = defineComponent({
1217
1460
  }, [createVNode("div", {
1218
1461
  "class": "devui-transfer-panel-header-allChecked"
1219
1462
  }, [createVNode(DCheckbox, {
1463
+ "halfchecked": allHalfchecked,
1220
1464
  "modelValue": allChecked,
1221
- "onChange": (value) => this.$emit("changeAllSource", value)
1465
+ "onChange": (value) => {
1466
+ this.$emit("changeAllSource", value);
1467
+ }
1222
1468
  }, _isSlot(title) ? title : {
1223
1469
  default: () => [title]
1224
1470
  })]), createVNode("div", {
@@ -1231,18 +1477,11 @@ var DTransferBase = defineComponent({
1231
1477
  "modelValue": searchQuery,
1232
1478
  "onUpdate:modelValue": updateSearchQuery
1233
1479
  }, null)]), createVNode("div", {
1234
- "class": "devui-transfer-panel-body-list",
1480
+ "class": dragWrapClass,
1235
1481
  "style": {
1236
1482
  height
1237
1483
  }
1238
- }, [sourceOption.length ? createVNode(DCheckboxGroup, {
1239
- "modelValue": modelValues,
1240
- "onChange": (values) => this.$emit("updateCheckeds", values)
1241
- }, _isSlot(_slot = sourceOption.map((item, idx) => {
1242
- return renderCheckbox(item, idx, showTooltip, tooltipPosition);
1243
- })) ? _slot : {
1244
- default: () => [_slot]
1245
- }) : createVNode("div", {
1484
+ }, [sourceOption.length ? isSourceDroppable || isTargetDroppable ? renderDragCheckboxGroup() : renderCheckboxGroup() : createVNode("div", {
1246
1485
  "class": "devui-transfer-panel-body-list-empty"
1247
1486
  }, [createTextVNode("\u65E0\u6570\u636E")])])])]);
1248
1487
  }
@@ -1296,12 +1535,208 @@ var Icon = defineComponent({
1296
1535
  Icon.install = function(app) {
1297
1536
  app.component(Icon.name, Icon);
1298
1537
  };
1538
+ class View {
1539
+ constructor() {
1540
+ __publicField(this, "top", "50%");
1541
+ __publicField(this, "left", "50%");
1542
+ }
1543
+ }
1544
+ const componentProps = {
1545
+ message: String,
1546
+ backdrop: Boolean,
1547
+ view: {
1548
+ type: Object,
1549
+ default: () => new View()
1550
+ },
1551
+ zIndex: Number,
1552
+ isFull: {
1553
+ type: Boolean,
1554
+ default: false
1555
+ }
1556
+ };
1557
+ class LoadingProps {
1558
+ constructor() {
1559
+ __publicField(this, "target");
1560
+ __publicField(this, "message");
1561
+ __publicField(this, "loadingTemplateRef");
1562
+ __publicField(this, "backdrop", true);
1563
+ __publicField(this, "positionType", "relative");
1564
+ __publicField(this, "view", new View());
1565
+ __publicField(this, "zIndex");
1566
+ }
1567
+ }
1568
+ var loading = "";
1569
+ var Loading = defineComponent({
1570
+ name: "DLoading",
1571
+ inheritAttrs: false,
1572
+ props: componentProps,
1573
+ setup(props) {
1574
+ const style = {
1575
+ top: props.view.top,
1576
+ left: props.view.left,
1577
+ zIndex: props.zIndex
1578
+ };
1579
+ if (!props.message) {
1580
+ style.background = "none";
1581
+ }
1582
+ const isShow = ref(false);
1583
+ const open = () => {
1584
+ isShow.value = true;
1585
+ };
1586
+ const close = () => {
1587
+ isShow.value = false;
1588
+ };
1589
+ return {
1590
+ style,
1591
+ isShow,
1592
+ open,
1593
+ close
1594
+ };
1595
+ },
1596
+ render() {
1597
+ var _a;
1598
+ const {
1599
+ isShow,
1600
+ isFull,
1601
+ backdrop,
1602
+ style,
1603
+ message,
1604
+ $slots
1605
+ } = this;
1606
+ return isShow && createVNode("div", {
1607
+ "class": ["devui-loading-contanier", isFull ? "devui-loading--full" : ""]
1608
+ }, [((_a = $slots.default) == null ? void 0 : _a.call($slots)) || createVNode("div", {
1609
+ "class": "devui-loading-wrapper"
1610
+ }, [backdrop ? createVNode("div", {
1611
+ "class": "devui-loading-mask"
1612
+ }, null) : null, createVNode("div", {
1613
+ "style": style,
1614
+ "class": "devui-loading-area"
1615
+ }, [createVNode("div", {
1616
+ "class": "devui-busy-default-spinner"
1617
+ }, [createVNode("div", {
1618
+ "class": "devui-loading-bar1"
1619
+ }, null), createVNode("div", {
1620
+ "class": "devui-loading-bar2"
1621
+ }, null), createVNode("div", {
1622
+ "class": "devui-loading-bar3"
1623
+ }, null), createVNode("div", {
1624
+ "class": "devui-loading-bar4"
1625
+ }, null)]), message ? createVNode("span", {
1626
+ "class": "devui-loading-text"
1627
+ }, [message]) : null])])]);
1628
+ }
1629
+ });
1630
+ const COMPONENT_CONTAINER_SYMBOL = Symbol("dev_component_container");
1631
+ function createComponent(Component, props, children = null) {
1632
+ const vnode = h(Component, __spreadValues({}, props), children);
1633
+ const container = document.createElement("div");
1634
+ vnode[COMPONENT_CONTAINER_SYMBOL] = container;
1635
+ render(vnode, container);
1636
+ return vnode.component;
1637
+ }
1638
+ function unmountComponent(ComponnetInstance) {
1639
+ render(null, ComponnetInstance == null ? void 0 : ComponnetInstance.vnode[COMPONENT_CONTAINER_SYMBOL]);
1640
+ }
1641
+ const loadingConstructor = defineComponent(Loading);
1642
+ const cacheInstance = new WeakSet();
1643
+ const isEmpty = (val) => {
1644
+ if (!val)
1645
+ return true;
1646
+ if (Array.isArray(val))
1647
+ return val.length === 0;
1648
+ if (val instanceof Set || val instanceof Map)
1649
+ return val.size === 0;
1650
+ if (val instanceof Promise)
1651
+ return false;
1652
+ if (typeof val === "object") {
1653
+ try {
1654
+ return Object.keys(val).length === 0;
1655
+ } catch (e) {
1656
+ return false;
1657
+ }
1658
+ }
1659
+ return false;
1660
+ };
1661
+ const getType = (vari) => {
1662
+ return Object.prototype.toString.call(vari).slice(8, -1).toLowerCase();
1663
+ };
1664
+ const isPromise = (value) => {
1665
+ const type = getType(value);
1666
+ switch (type) {
1667
+ case "promise":
1668
+ return [value];
1669
+ case "array":
1670
+ if (value.some((val) => getType(val) !== "promise")) {
1671
+ console.error(new TypeError("Binding values should all be of type Promise"));
1672
+ return "error";
1673
+ }
1674
+ return value;
1675
+ default:
1676
+ return false;
1677
+ }
1678
+ };
1679
+ const unmount = (el) => {
1680
+ cacheInstance.delete(el);
1681
+ el.instance.proxy.close();
1682
+ unmountComponent(el.instance);
1683
+ };
1684
+ const toggleLoading = (el, binding) => {
1685
+ if (binding.value) {
1686
+ const vals = isPromise(binding.value);
1687
+ if (vals === "error")
1688
+ return;
1689
+ el.instance.proxy.open();
1690
+ el.appendChild(el.mask);
1691
+ cacheInstance.add(el);
1692
+ if (vals) {
1693
+ Promise.all(vals).catch((err) => {
1694
+ console.error(new Error("Promise handling errors"), err);
1695
+ }).finally(() => {
1696
+ unmount(el);
1697
+ });
1698
+ }
1699
+ } else {
1700
+ unmount(el);
1701
+ }
1702
+ };
1703
+ const removeAttribute = (el) => {
1704
+ el.removeAttribute("zindex");
1705
+ el.removeAttribute("positiontype");
1706
+ el.removeAttribute("backdrop");
1707
+ el.removeAttribute("message");
1708
+ el.removeAttribute("view");
1709
+ el.removeAttribute("loadingtemplateref");
1710
+ };
1711
+ const handleProps = (el, vprops) => {
1712
+ const props = __spreadValues(__spreadValues({}, new LoadingProps()), vprops);
1713
+ const loadingTemplateRef = props.loadingTemplateRef;
1714
+ const loadingInstance = createComponent(loadingConstructor, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
1715
+ el.style.position = props.positionType;
1716
+ el.options = props;
1717
+ el.instance = loadingInstance;
1718
+ el.mask = loadingInstance.proxy.$el;
1719
+ };
1720
+ const loadingDirective = {
1721
+ mounted: function(el, binding, vnode) {
1722
+ handleProps(el, vnode.props);
1723
+ removeAttribute(el);
1724
+ !isEmpty(binding.value) && toggleLoading(el, binding);
1725
+ },
1726
+ updated: function(el, binding, vnode) {
1727
+ if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el))
1728
+ return;
1729
+ !cacheInstance.has(el) && handleProps(el, vnode.props);
1730
+ removeAttribute(el);
1731
+ toggleLoading(el, binding);
1732
+ }
1733
+ };
1299
1734
  const buttonProps = {
1300
1735
  type: {
1301
1736
  type: String,
1302
1737
  default: "button"
1303
1738
  },
1304
- btnStyle: {
1739
+ variant: {
1305
1740
  type: String,
1306
1741
  default: "primary"
1307
1742
  },
@@ -1343,6 +1778,9 @@ const buttonProps = {
1343
1778
  var button = "";
1344
1779
  var DButton = defineComponent({
1345
1780
  name: "DButton",
1781
+ directives: {
1782
+ devLoading: loadingDirective
1783
+ },
1346
1784
  props: buttonProps,
1347
1785
  setup(props, ctx) {
1348
1786
  const buttonContent = ref(null);
@@ -1356,15 +1794,15 @@ var DButton = defineComponent({
1356
1794
  const hasContent = computed(() => ctx.slots.default);
1357
1795
  const btnClass = computed(() => {
1358
1796
  const {
1359
- btnStyle,
1797
+ variant,
1360
1798
  size,
1361
1799
  position,
1362
1800
  bordered,
1363
1801
  icon
1364
1802
  } = props;
1365
- const origin = `devui-btn devui-btn-${btnStyle} devui-btn-${size} devui-btn-${position}`;
1803
+ const origin = `devui-btn devui-btn-${variant} devui-btn-${size} devui-btn-${position}`;
1366
1804
  const borderedClass = bordered ? "bordered" : "";
1367
- const btnIcon = !!icon && !hasContent.value && btnStyle !== "primary" ? "d-btn-icon" : "";
1805
+ const btnIcon = !!icon && !hasContent.value && variant !== "primary" ? "d-btn-icon" : "";
1368
1806
  const btnIconWrap = !!icon ? "d-btn-icon-wrap" : "";
1369
1807
  return `${origin} ${borderedClass} ${btnIcon} ${btnIconWrap}`;
1370
1808
  });
@@ -1388,9 +1826,9 @@ var DButton = defineComponent({
1388
1826
  showLoading,
1389
1827
  width
1390
1828
  } = props;
1391
- return withDirectives(createVNode("div", mergeProps({
1829
+ return createVNode("div", mergeProps({
1392
1830
  "class": "devui-btn-host"
1393
- }, ctx.attrs), [createVNode("button", {
1831
+ }, ctx.attrs), [withDirectives(createVNode("button", {
1394
1832
  "class": btnClass.value,
1395
1833
  "type": type,
1396
1834
  "disabled": disabled,
@@ -1404,7 +1842,7 @@ var DButton = defineComponent({
1404
1842
  }, null) : null, createVNode("span", {
1405
1843
  "class": "button-content",
1406
1844
  "ref": buttonContent
1407
- }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])])]), [[resolveDirective("dLoading"), showLoading]]);
1845
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])]), [[resolveDirective("devLoading"), showLoading]])]);
1408
1846
  };
1409
1847
  }
1410
1848
  });
@@ -1460,7 +1898,7 @@ var DTransferOperation = defineComponent({
1460
1898
  };
1461
1899
  }
1462
1900
  });
1463
- const transferProps = {
1901
+ const transferProps = __spreadProps(__spreadValues({}, transferCommon), {
1464
1902
  sourceOption: {
1465
1903
  type: Array,
1466
1904
  require: true,
@@ -1503,14 +1941,6 @@ const transferProps = {
1503
1941
  type: Boolean,
1504
1942
  default: () => false
1505
1943
  },
1506
- showTooltip: {
1507
- type: Boolean,
1508
- default: () => false
1509
- },
1510
- tooltipPosition: {
1511
- type: String,
1512
- default: () => "top"
1513
- },
1514
1944
  beforeTransfer: {
1515
1945
  type: Function
1516
1946
  },
@@ -1531,8 +1961,11 @@ const transferProps = {
1531
1961
  },
1532
1962
  afterTransfer: {
1533
1963
  type: Function
1964
+ },
1965
+ onDragend: {
1966
+ type: Function
1534
1967
  }
1535
- };
1968
+ });
1536
1969
  const headerSlot = (ctx, name) => {
1537
1970
  return !ctx.slots[`${name}-header`] ? null : () => ctx.slots[`${name}-header`] && ctx.slots[`${name}-header`]();
1538
1971
  };
@@ -1561,7 +1994,7 @@ var Transfer = defineComponent({
1561
1994
  watch(() => props.targetOption, () => {
1562
1995
  rightOptions = reactive(initState(props, "target"));
1563
1996
  });
1564
- watch(() => leftOptions.keyword, (nVal) => {
1997
+ watch(() => leftOptions.keyword, () => {
1565
1998
  searchFilterData(leftOptions);
1566
1999
  });
1567
2000
  watch(() => leftOptions.checkedValues, (values) => {
@@ -1570,7 +2003,7 @@ var Transfer = defineComponent({
1570
2003
  }, {
1571
2004
  deep: true
1572
2005
  });
1573
- watch(() => rightOptions.keyword, (nVal) => {
2006
+ watch(() => rightOptions.keyword, () => {
1574
2007
  searchFilterData(rightOptions);
1575
2008
  });
1576
2009
  watch(() => rightOptions.checkedValues, (values) => {
@@ -1654,6 +2087,13 @@ var Transfer = defineComponent({
1654
2087
  const isFunction = (type) => {
1655
2088
  return props[type] && typeof props[type] === "function";
1656
2089
  };
2090
+ const dataSort = (target, dragItem, dropItem, direction) => {
2091
+ const startIndex = target.filterData.findIndex((item) => item.key === dragItem.key);
2092
+ const endIndex = target.filterData.findIndex((item) => item.key === dropItem.key);
2093
+ target.filterData.splice(endIndex, 1, dragItem);
2094
+ target.filterData.splice(startIndex, 1, dropItem);
2095
+ props.onDragend && props.onDragend(direction, dragItem, dropItem);
2096
+ };
1657
2097
  return () => {
1658
2098
  return createVNode("div", {
1659
2099
  "class": "devui-transfer"
@@ -1670,9 +2110,11 @@ var Transfer = defineComponent({
1670
2110
  "allCount": leftOptions.data.length,
1671
2111
  "showTooltip": props.showTooltip,
1672
2112
  "tooltipPosition": props.tooltipPosition,
2113
+ "isSourceDroppable": props.isSourceDroppable,
1673
2114
  "onChangeAllSource": (value) => changeAllSource(leftOptions, value),
1674
2115
  "onUpdateCheckeds": updateLeftCheckeds,
1675
- "onChangeQuery": (value) => changeQueryHandle(leftOptions, "left", value)
2116
+ "onChangeQuery": (value) => changeQueryHandle(leftOptions, "left", value),
2117
+ "onDragend": (dragItem, dropItem) => dataSort(leftOptions, dragItem, dropItem, "left")
1676
2118
  }, {
1677
2119
  header: headerSlot(ctx, "left"),
1678
2120
  body: bodySlot(ctx, "left")
@@ -1701,9 +2143,11 @@ var Transfer = defineComponent({
1701
2143
  "allCount": rightOptions.data.length,
1702
2144
  "showTooltip": props.showTooltip,
1703
2145
  "tooltipPosition": props.tooltipPosition,
2146
+ "isTargetDroppable": props.isTargetDroppable,
1704
2147
  "onChangeAllSource": (value) => changeAllSource(rightOptions, value),
1705
2148
  "onUpdateCheckeds": updateRightCheckeds,
1706
- "onChangeQuery": (value) => changeQueryHandle(rightOptions, "right", value)
2149
+ "onChangeQuery": (value) => changeQueryHandle(rightOptions, "right", value),
2150
+ "onDragend": (dragItem, dropItem) => dataSort(rightOptions, dragItem, dropItem, "right")
1707
2151
  }, {
1708
2152
  header: headerSlot(ctx, "right"),
1709
2153
  body: bodySlot(ctx, "right")
@@ -1717,7 +2161,7 @@ Transfer.install = function(app) {
1717
2161
  var index = {
1718
2162
  title: "Transfer \u7A7F\u68AD\u6846",
1719
2163
  category: "\u6570\u636E\u5F55\u5165",
1720
- status: "10%",
2164
+ status: "40%",
1721
2165
  install(app) {
1722
2166
  app.use(Transfer);
1723
2167
  }