vue-devui 1.0.0-beta.13 → 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.
package/vue-devui.es.js CHANGED
@@ -33,7 +33,7 @@ var __publicField = (obj, key, value) => {
33
33
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
34
34
  return value;
35
35
  };
36
- import { createVNode, getCurrentInstance, defineComponent as defineComponent$1, toRefs, inject, computed, Fragment, mergeProps, resolveComponent, createTextVNode, provide, onMounted, watch, ref, Transition, withDirectives, vShow, onBeforeUnmount, h, render, resolveDirective, Comment as Comment$1, reactive, toRef, onUpdated, onBeforeMount, nextTick as nextTick$1, readonly, unref as unref$1, Teleport, onUnmounted, createApp, renderSlot, isVNode, isRef as isRef$1, useSlots, shallowRef } from "vue";
36
+ import { createVNode, getCurrentInstance, defineComponent as defineComponent$1, toRefs, inject, computed, Fragment, mergeProps, resolveComponent, createTextVNode, provide, onMounted, watch, ref, Transition, withDirectives, vShow, nextTick as nextTick$1, h, render, resolveDirective, Teleport, renderSlot, isVNode, onUnmounted, reactive, toRef, isRef as isRef$1, onBeforeUnmount, Comment as Comment$1, onUpdated, onBeforeMount, readonly, unref as unref$1, createApp, useSlots, shallowRef } from "vue";
37
37
  const accordionProps = {
38
38
  data: {
39
39
  type: Array,
@@ -958,6 +958,1121 @@ var AnchorInstall = {
958
958
  app.use(Anchor);
959
959
  }
960
960
  };
961
+ const defaultFormatter = (item2) => item2 ? item2.label || item2.toString() : "";
962
+ const defaultValueParse = (item2) => item2;
963
+ const autoCompleteProps = {
964
+ modelValue: {
965
+ type: String,
966
+ default: ""
967
+ },
968
+ source: {
969
+ type: Array,
970
+ default: null
971
+ },
972
+ allowEmptyValueSearch: {
973
+ type: Boolean,
974
+ default: false
975
+ },
976
+ appendToBody: {
977
+ type: Boolean,
978
+ default: false
979
+ },
980
+ appendToBodyDirections: {
981
+ type: Object,
982
+ default: () => ({
983
+ originX: "left",
984
+ originY: "bottom",
985
+ overlayX: "left",
986
+ overlayY: "top"
987
+ })
988
+ },
989
+ disabled: {
990
+ type: Boolean,
991
+ default: false
992
+ },
993
+ delay: {
994
+ type: Number,
995
+ default: 300
996
+ },
997
+ disabledKey: {
998
+ type: String,
999
+ default: null
1000
+ },
1001
+ formatter: {
1002
+ type: Function,
1003
+ default: defaultFormatter
1004
+ },
1005
+ isSearching: {
1006
+ type: Boolean,
1007
+ default: false
1008
+ },
1009
+ sceneType: {
1010
+ type: String,
1011
+ default: null
1012
+ },
1013
+ searchFn: {
1014
+ type: Function,
1015
+ default: null
1016
+ },
1017
+ tipsText: {
1018
+ type: String,
1019
+ default: "\u6700\u8FD1\u8F93\u5165"
1020
+ },
1021
+ latestSource: {
1022
+ type: Array,
1023
+ default: null
1024
+ },
1025
+ valueParser: {
1026
+ type: Function,
1027
+ default: defaultValueParse
1028
+ },
1029
+ enableLazyLoad: {
1030
+ type: Boolean,
1031
+ default: false
1032
+ },
1033
+ dAutoCompleteWidth: {
1034
+ type: Number,
1035
+ default: null
1036
+ },
1037
+ showAnimation: {
1038
+ type: Boolean,
1039
+ default: true
1040
+ },
1041
+ maxHeight: {
1042
+ type: Number,
1043
+ default: 300
1044
+ },
1045
+ transInputFocusEmit: {
1046
+ type: Function,
1047
+ default: null
1048
+ },
1049
+ selectValue: {
1050
+ type: Function,
1051
+ default: null
1052
+ },
1053
+ loadMore: {
1054
+ type: Function,
1055
+ default: null
1056
+ }
1057
+ };
1058
+ const DropdownPropsKey = Symbol("DropdownPropsKey");
1059
+ function useCustomTemplate(ctx2, modelValue) {
1060
+ const itemTemplate = (item2, index2) => {
1061
+ const arr = { item: item2, index: index2 };
1062
+ if (ctx2.slots.itemTemplate) {
1063
+ return ctx2.slots.itemTemplate(arr);
1064
+ }
1065
+ return null;
1066
+ };
1067
+ const noResultItemTemplate = () => {
1068
+ if (ctx2.slots.noResultItemTemplate) {
1069
+ return ctx2.slots.noResultItemTemplate(modelValue.value);
1070
+ }
1071
+ return null;
1072
+ };
1073
+ const searchingTemplate = () => {
1074
+ if (ctx2.slots.searchingTemplate) {
1075
+ return ctx2.slots.searchingTemplate(modelValue.value);
1076
+ }
1077
+ return null;
1078
+ };
1079
+ const customRenderSolts = () => {
1080
+ const slots = {};
1081
+ if (ctx2.slots.itemTemplate) {
1082
+ slots["itemTemplate"] = itemTemplate;
1083
+ }
1084
+ if (ctx2.slots.noResultItemTemplate) {
1085
+ slots["noResultItemTemplate"] = noResultItemTemplate;
1086
+ }
1087
+ if (ctx2.slots.searchingTemplate) {
1088
+ slots["searchingTemplate"] = searchingTemplate;
1089
+ }
1090
+ return slots;
1091
+ };
1092
+ return { customRenderSolts };
1093
+ }
1094
+ function useSearchFn(ctx2, allowEmptyValueSearch, source, searchFn, formatter) {
1095
+ const searchList = ref([]);
1096
+ const showNoResultItemTemplate = ref(false);
1097
+ const handleSearch = async (term, enableLazyLoad) => {
1098
+ if (term == "" && !allowEmptyValueSearch.value) {
1099
+ searchList.value = [];
1100
+ showNoResultItemTemplate.value = false;
1101
+ return;
1102
+ }
1103
+ let arr = [];
1104
+ term = term.toLowerCase();
1105
+ if (enableLazyLoad) {
1106
+ arr = source.value;
1107
+ } else if (!searchFn.value) {
1108
+ source.value.forEach((item2) => {
1109
+ let cur = formatter.value(item2);
1110
+ cur = cur.toLowerCase();
1111
+ if (cur.startsWith(term)) {
1112
+ arr.push(item2);
1113
+ }
1114
+ });
1115
+ } else {
1116
+ arr = await searchFn.value(term);
1117
+ }
1118
+ searchList.value = arr;
1119
+ if (searchList.value.length == 0) {
1120
+ showNoResultItemTemplate.value = true;
1121
+ } else {
1122
+ showNoResultItemTemplate.value = false;
1123
+ }
1124
+ };
1125
+ const recentlyFocus = (latestSource) => {
1126
+ if (latestSource) {
1127
+ searchList.value = latestSource;
1128
+ }
1129
+ };
1130
+ return {
1131
+ handleSearch,
1132
+ recentlyFocus,
1133
+ searchList,
1134
+ showNoResultItemTemplate
1135
+ };
1136
+ }
1137
+ function useInputHandle(ctx2, searchList, showNoResultItemTemplate, modelValue, disabled, delay, handleSearch, transInputFocusEmit, recentlyFocus, latestSource) {
1138
+ const visible = ref(false);
1139
+ const inputRef = ref();
1140
+ const searchStatus = ref(false);
1141
+ const debounce2 = (cb, time) => {
1142
+ let timer;
1143
+ return (...args) => {
1144
+ if (timer) {
1145
+ clearTimeout(timer);
1146
+ }
1147
+ timer = setTimeout(async () => {
1148
+ searchStatus.value = true;
1149
+ await cb(...args);
1150
+ searchStatus.value = false;
1151
+ }, time);
1152
+ };
1153
+ };
1154
+ const onInputCb = async (value) => {
1155
+ await handleSearch(value);
1156
+ visible.value = true;
1157
+ };
1158
+ const onInputDebounce = debounce2(onInputCb, delay.value);
1159
+ const onInput = (e) => {
1160
+ const inp = e.target;
1161
+ searchStatus.value = false;
1162
+ showNoResultItemTemplate.value = false;
1163
+ ctx2.emit("update:modelValue", inp.value);
1164
+ onInputDebounce(inp.value);
1165
+ };
1166
+ const onFocus = () => {
1167
+ handleSearch(modelValue.value);
1168
+ recentlyFocus(latestSource.value);
1169
+ transInputFocusEmit.value && transInputFocusEmit.value();
1170
+ };
1171
+ const handleClose = () => {
1172
+ visible.value = false;
1173
+ searchStatus.value = false;
1174
+ showNoResultItemTemplate.value = false;
1175
+ };
1176
+ const toggleMenu = () => {
1177
+ if (!disabled.value) {
1178
+ if (visible.value) {
1179
+ handleClose();
1180
+ } else {
1181
+ visible.value = true;
1182
+ if (ctx2.slots.noResultItemTemplate && searchList.value.length == 0 && modelValue.value.trim() != "") {
1183
+ showNoResultItemTemplate.value = true;
1184
+ }
1185
+ }
1186
+ }
1187
+ };
1188
+ return {
1189
+ handleClose,
1190
+ toggleMenu,
1191
+ onInput,
1192
+ onFocus,
1193
+ inputRef,
1194
+ visible,
1195
+ searchStatus
1196
+ };
1197
+ }
1198
+ function useSelectHandle(ctx2, searchList, selectValue, handleSearch, formatter, handleClose) {
1199
+ const selectedIndex = ref(0);
1200
+ const getListIndex = (item2) => {
1201
+ if (searchList.value.length == 0) {
1202
+ return 0;
1203
+ }
1204
+ const ind = searchList.value.indexOf(item2);
1205
+ return ind == -1 ? 0 : ind;
1206
+ };
1207
+ const selectOptionClick = async (item2) => {
1208
+ const cur = formatter.value(item2);
1209
+ ctx2.emit("update:modelValue", cur);
1210
+ handleClose();
1211
+ await handleSearch(cur);
1212
+ selectedIndex.value = getListIndex(cur);
1213
+ selectValue.value && selectValue.value();
1214
+ };
1215
+ return {
1216
+ selectedIndex,
1217
+ selectOptionClick
1218
+ };
1219
+ }
1220
+ function useLazyHandle(props, ctx2, handleSearch) {
1221
+ const showLoading = ref(false);
1222
+ const dropDownRef = ref();
1223
+ const loadMore = () => {
1224
+ if (!props.enableLazyLoad && showLoading)
1225
+ return;
1226
+ const dropDownValue = dropDownRef.value;
1227
+ const height = dropDownValue.scrollHeight;
1228
+ const scrollTop = dropDownValue.clientHeight + dropDownValue.scrollTop;
1229
+ if (scrollTop >= height && scrollTop >= props.maxHeight) {
1230
+ props.loadMore();
1231
+ showLoading.value = true;
1232
+ }
1233
+ };
1234
+ ctx2.expose({ loadFinish });
1235
+ async function loadFinish() {
1236
+ await handleSearch(props.modelValue, props.enableLazyLoad);
1237
+ showLoading.value = false;
1238
+ }
1239
+ return {
1240
+ showLoading,
1241
+ dropDownRef,
1242
+ loadMore
1243
+ };
1244
+ }
1245
+ function useKeyBoardHandle(dropDownRef, visible, searchList, selectedIndex, searchStatus, showNoResultItemTemplate, selectOptionClick, handleClose) {
1246
+ var _a;
1247
+ const hoverIndex = ref((_a = selectedIndex.value) != null ? _a : 0);
1248
+ const scrollToActive = (index2) => {
1249
+ const ul = dropDownRef.value;
1250
+ const li = ul.children[index2];
1251
+ nextTick$1(() => {
1252
+ if (li.scrollIntoViewIfNeeded) {
1253
+ li.scrollIntoViewIfNeeded(false);
1254
+ } else {
1255
+ const containerInfo = ul.getBoundingClientRect();
1256
+ const elementInfo = li.getBoundingClientRect();
1257
+ if (elementInfo.bottom > containerInfo.bottom || elementInfo.top < containerInfo.top) {
1258
+ li.scrollIntoView(false);
1259
+ }
1260
+ }
1261
+ });
1262
+ };
1263
+ const handlekeyDown = (e) => {
1264
+ var _a2;
1265
+ const keyCode = e.key || e.code;
1266
+ if (keyCode === "Escape" && (visible.value && searchList.value.length || searchStatus.value || showNoResultItemTemplate.value)) {
1267
+ handleClose();
1268
+ return;
1269
+ }
1270
+ const status2 = visible.value && searchList.value.length && !searchStatus.value && !showNoResultItemTemplate.value;
1271
+ if (keyCode === "ArrowDown" && status2) {
1272
+ if (hoverIndex.value === searchList.value.length - 1) {
1273
+ hoverIndex.value = 0;
1274
+ scrollToActive(hoverIndex.value);
1275
+ return;
1276
+ }
1277
+ hoverIndex.value = hoverIndex.value + 1;
1278
+ scrollToActive(hoverIndex.value);
1279
+ } else if (keyCode === "ArrowUp" && status2) {
1280
+ if (hoverIndex.value === 0) {
1281
+ hoverIndex.value = searchList.value.length - 1;
1282
+ scrollToActive(hoverIndex.value);
1283
+ return;
1284
+ }
1285
+ hoverIndex.value = hoverIndex.value - 1;
1286
+ scrollToActive(hoverIndex.value);
1287
+ }
1288
+ if (keyCode === "Enter" && status2) {
1289
+ selectOptionClick(searchList.value[hoverIndex.value]);
1290
+ hoverIndex.value = (_a2 = selectedIndex.value) != null ? _a2 : 0;
1291
+ return;
1292
+ }
1293
+ };
1294
+ return {
1295
+ hoverIndex,
1296
+ handlekeyDown
1297
+ };
1298
+ }
1299
+ var autoComplete = "";
1300
+ class View {
1301
+ constructor() {
1302
+ __publicField(this, "top", "50%");
1303
+ __publicField(this, "left", "50%");
1304
+ }
1305
+ }
1306
+ const componentProps$1 = {
1307
+ message: String,
1308
+ backdrop: Boolean,
1309
+ view: {
1310
+ type: Object,
1311
+ default: () => new View()
1312
+ },
1313
+ zIndex: Number,
1314
+ isFull: {
1315
+ type: Boolean,
1316
+ default: false
1317
+ }
1318
+ };
1319
+ class LoadingProps {
1320
+ constructor() {
1321
+ __publicField(this, "target");
1322
+ __publicField(this, "message");
1323
+ __publicField(this, "loadingTemplateRef");
1324
+ __publicField(this, "backdrop", true);
1325
+ __publicField(this, "positionType", "relative");
1326
+ __publicField(this, "view", new View());
1327
+ __publicField(this, "zIndex");
1328
+ }
1329
+ }
1330
+ var loading$1 = "";
1331
+ var Loading = defineComponent$1({
1332
+ name: "DLoading",
1333
+ inheritAttrs: false,
1334
+ props: componentProps$1,
1335
+ setup(props) {
1336
+ const style2 = {
1337
+ top: props.view.top,
1338
+ left: props.view.left,
1339
+ zIndex: props.zIndex
1340
+ };
1341
+ if (!props.message) {
1342
+ style2.background = "none";
1343
+ }
1344
+ const isShow = ref(false);
1345
+ const open = () => {
1346
+ isShow.value = true;
1347
+ };
1348
+ const close = () => {
1349
+ isShow.value = false;
1350
+ };
1351
+ return {
1352
+ style: style2,
1353
+ isShow,
1354
+ open,
1355
+ close
1356
+ };
1357
+ },
1358
+ render() {
1359
+ var _a;
1360
+ const {
1361
+ isShow,
1362
+ isFull,
1363
+ backdrop,
1364
+ style: style2,
1365
+ message,
1366
+ $slots
1367
+ } = this;
1368
+ return isShow && createVNode("div", {
1369
+ "class": ["devui-loading-contanier", isFull ? "devui-loading--full" : ""]
1370
+ }, [((_a = $slots.default) == null ? void 0 : _a.call($slots)) || createVNode("div", {
1371
+ "class": "devui-loading-wrapper"
1372
+ }, [backdrop ? createVNode("div", {
1373
+ "class": "devui-loading-mask"
1374
+ }, null) : null, createVNode("div", {
1375
+ "style": style2,
1376
+ "class": "devui-loading-area"
1377
+ }, [createVNode("div", {
1378
+ "class": "devui-busy-default-spinner"
1379
+ }, [createVNode("div", {
1380
+ "class": "devui-loading-bar1"
1381
+ }, null), createVNode("div", {
1382
+ "class": "devui-loading-bar2"
1383
+ }, null), createVNode("div", {
1384
+ "class": "devui-loading-bar3"
1385
+ }, null), createVNode("div", {
1386
+ "class": "devui-loading-bar4"
1387
+ }, null)]), message ? createVNode("span", {
1388
+ "class": "devui-loading-text"
1389
+ }, [message]) : null])])]);
1390
+ }
1391
+ });
1392
+ const COMPONENT_CONTAINER_SYMBOL = Symbol("dev_component_container");
1393
+ function createComponent$1(Component, props, children = null) {
1394
+ const vnode = h(Component, __spreadValues({}, props), children);
1395
+ const container = document.createElement("div");
1396
+ vnode[COMPONENT_CONTAINER_SYMBOL] = container;
1397
+ render(vnode, container);
1398
+ return vnode.component;
1399
+ }
1400
+ function unmountComponent(ComponnetInstance) {
1401
+ render(null, ComponnetInstance == null ? void 0 : ComponnetInstance.vnode[COMPONENT_CONTAINER_SYMBOL]);
1402
+ }
1403
+ const loadingConstructor$1 = defineComponent$1(Loading);
1404
+ const cacheInstance = new WeakSet();
1405
+ const isEmpty = (val) => {
1406
+ if (!val)
1407
+ return true;
1408
+ if (Array.isArray(val))
1409
+ return val.length === 0;
1410
+ if (val instanceof Set || val instanceof Map)
1411
+ return val.size === 0;
1412
+ if (val instanceof Promise)
1413
+ return false;
1414
+ if (typeof val === "object") {
1415
+ try {
1416
+ return Object.keys(val).length === 0;
1417
+ } catch (e) {
1418
+ return false;
1419
+ }
1420
+ }
1421
+ return false;
1422
+ };
1423
+ const getType = (vari) => {
1424
+ return Object.prototype.toString.call(vari).slice(8, -1).toLowerCase();
1425
+ };
1426
+ const isPromise$1 = (value) => {
1427
+ const type4 = getType(value);
1428
+ switch (type4) {
1429
+ case "promise":
1430
+ return [value];
1431
+ case "array":
1432
+ if (value.some((val) => getType(val) !== "promise")) {
1433
+ console.error(new TypeError("Binding values should all be of type Promise"));
1434
+ return "error";
1435
+ }
1436
+ return value;
1437
+ default:
1438
+ return false;
1439
+ }
1440
+ };
1441
+ const unmount = (el) => {
1442
+ cacheInstance.delete(el);
1443
+ el.instance.proxy.close();
1444
+ unmountComponent(el.instance);
1445
+ };
1446
+ const toggleLoading = (el, binding) => {
1447
+ if (binding.value) {
1448
+ const vals = isPromise$1(binding.value);
1449
+ if (vals === "error")
1450
+ return;
1451
+ el.instance.proxy.open();
1452
+ el.appendChild(el.mask);
1453
+ cacheInstance.add(el);
1454
+ if (vals) {
1455
+ Promise.all(vals).catch((err) => {
1456
+ console.error(new Error("Promise handling errors"), err);
1457
+ }).finally(() => {
1458
+ unmount(el);
1459
+ });
1460
+ }
1461
+ } else {
1462
+ unmount(el);
1463
+ }
1464
+ };
1465
+ const removeAttribute = (el) => {
1466
+ el.removeAttribute("zindex");
1467
+ el.removeAttribute("positiontype");
1468
+ el.removeAttribute("backdrop");
1469
+ el.removeAttribute("message");
1470
+ el.removeAttribute("view");
1471
+ el.removeAttribute("loadingtemplateref");
1472
+ };
1473
+ const handleProps = (el, vprops) => {
1474
+ const props = __spreadValues(__spreadValues({}, new LoadingProps()), vprops);
1475
+ const loadingTemplateRef = props.loadingTemplateRef;
1476
+ const loadingInstance = createComponent$1(loadingConstructor$1, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
1477
+ el.style.position = props.positionType;
1478
+ el.options = props;
1479
+ el.instance = loadingInstance;
1480
+ el.mask = loadingInstance.proxy.$el;
1481
+ };
1482
+ const loadingDirective = {
1483
+ mounted: function(el, binding, vnode) {
1484
+ handleProps(el, vnode.props);
1485
+ removeAttribute(el);
1486
+ !isEmpty(binding.value) && toggleLoading(el, binding);
1487
+ },
1488
+ updated: function(el, binding, vnode) {
1489
+ if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el))
1490
+ return;
1491
+ !cacheInstance.has(el) && handleProps(el, vnode.props);
1492
+ removeAttribute(el);
1493
+ toggleLoading(el, binding);
1494
+ }
1495
+ };
1496
+ var DAutoCompleteDropdown = defineComponent$1({
1497
+ name: "DAutoCompleteDropdown",
1498
+ directives: {
1499
+ dLoading: loadingDirective
1500
+ },
1501
+ setup(props, ctx2) {
1502
+ const propsData = inject(DropdownPropsKey);
1503
+ const {
1504
+ visible,
1505
+ selectedIndex,
1506
+ selectOptionClick,
1507
+ searchList,
1508
+ searchStatus,
1509
+ dropDownRef,
1510
+ loadMore,
1511
+ showLoading,
1512
+ showNoResultItemTemplate,
1513
+ latestSource,
1514
+ modelValue,
1515
+ hoverIndex
1516
+ } = propsData;
1517
+ const {
1518
+ disabled,
1519
+ maxHeight,
1520
+ appendToBody,
1521
+ formatter,
1522
+ disabledKey,
1523
+ isSearching
1524
+ } = propsData.props;
1525
+ const onSelect = (item2) => {
1526
+ if (item2[disabledKey]) {
1527
+ return;
1528
+ }
1529
+ selectOptionClick(item2);
1530
+ };
1531
+ return () => {
1532
+ return withDirectives(createVNode("div", {
1533
+ "class": ["devui-dropdown-menu", appendToBody && "devui-dropdown-menu-cdk", disabled && "disabled", latestSource.value && "devui-dropdown-latestSource"]
1534
+ }, [createVNode("ul", {
1535
+ "ref": dropDownRef,
1536
+ "class": "devui-list-unstyled scroll-height",
1537
+ "style": {
1538
+ maxHeight: `${maxHeight}px`
1539
+ },
1540
+ "onScroll": loadMore
1541
+ }, [isSearching && ctx2.slots.searchingTemplate && searchStatus.value && createVNode("li", {
1542
+ "class": "devui-is-searching-template"
1543
+ }, [createVNode("div", {
1544
+ "class": "devui-no-data-tip"
1545
+ }, [ctx2.slots.searchingTemplate()])]), latestSource.value && !modelValue.value && createVNode("li", {
1546
+ "class": "devui-popup-tips"
1547
+ }, [createTextVNode("\u6700\u8FD1\u8F93\u5165")]), !showNoResultItemTemplate.value && !searchStatus.value && searchList != null && searchList.value.length > 0 && searchList.value.map((item2, index2) => {
1548
+ return createVNode("li", {
1549
+ "onClick": () => onSelect(item2),
1550
+ "class": ["devui-dropdown-item", selectedIndex.value == index2 && "selected", {
1551
+ "disabled": disabledKey && item2[disabledKey]
1552
+ }, {
1553
+ "devui-dropdown-bg": hoverIndex.value == index2
1554
+ }],
1555
+ "title": formatter(item2),
1556
+ "key": formatter(item2)
1557
+ }, [ctx2.slots.itemTemplate ? ctx2.slots.itemTemplate(item2, index2) : formatter(item2)]);
1558
+ }), !searchStatus.value && searchList.value.length == 0 && ctx2.slots.noResultItemTemplate && showNoResultItemTemplate.value && createVNode("li", {
1559
+ "class": "devui-no-result-template"
1560
+ }, [createVNode("div", {
1561
+ "class": "devui-no-data-tip"
1562
+ }, [ctx2.slots.noResultItemTemplate()])])])]), [[resolveDirective("dLoading"), showLoading.value], [vShow, visible.value && searchList.value.length > 0 || ctx2.slots.noResultItemTemplate && showNoResultItemTemplate.value || isSearching && ctx2.slots.searchingTemplate && searchStatus.value]]);
1563
+ };
1564
+ }
1565
+ });
1566
+ function on(element, eventName, handler) {
1567
+ if (document.addEventListener) {
1568
+ if (element && eventName && handler) {
1569
+ element.addEventListener(eventName, handler, false);
1570
+ }
1571
+ } else {
1572
+ if (element && eventName && handler) {
1573
+ element.attachEvent("on" + eventName, handler);
1574
+ }
1575
+ }
1576
+ }
1577
+ function off(element, eventName, handler) {
1578
+ if (document.removeEventListener) {
1579
+ if (element && eventName && handler) {
1580
+ element.removeEventListener(eventName, handler, false);
1581
+ }
1582
+ } else {
1583
+ if (element && eventName && handler) {
1584
+ element.detachEvent("on" + eventName, handler);
1585
+ }
1586
+ }
1587
+ }
1588
+ const ctx = Symbol("@@clickoutside");
1589
+ const nodeList = new Map();
1590
+ let startClick;
1591
+ let nid = 0;
1592
+ let isFirst = true;
1593
+ function createDocumentHandler(el, binding, vnode) {
1594
+ if (inBrowser && isFirst) {
1595
+ isFirst = false;
1596
+ on(document, "mousedown", (e) => {
1597
+ startClick = e;
1598
+ });
1599
+ on(document, "mouseup", (e) => {
1600
+ for (const [id, node] of nodeList) {
1601
+ node[ctx].documentHandler(e, startClick);
1602
+ }
1603
+ });
1604
+ }
1605
+ return function(mouseup, mousedown) {
1606
+ if (!vnode || !binding.instance || !mouseup.target || !mousedown.target || el.contains(mouseup.target) || el.contains(mousedown.target) || el === mouseup.target) {
1607
+ return;
1608
+ }
1609
+ el[ctx].bindingFn && el[ctx].bindingFn();
1610
+ };
1611
+ }
1612
+ const clickoutsideDirective = {
1613
+ beforeMount: function(el, binding, vnode) {
1614
+ nid++;
1615
+ nodeList.set(nid, el);
1616
+ el[ctx] = {
1617
+ nid,
1618
+ documentHandler: createDocumentHandler(el, binding, vnode),
1619
+ bindingFn: binding.value
1620
+ };
1621
+ },
1622
+ updated: function(el, binding, vnode) {
1623
+ el[ctx].documentHandler = createDocumentHandler(el, binding, vnode);
1624
+ el[ctx].bindingFn = binding.value;
1625
+ },
1626
+ unmounted: function(el) {
1627
+ nodeList.delete(el[ctx].nid);
1628
+ delete el[ctx];
1629
+ }
1630
+ };
1631
+ var overlay = "";
1632
+ function _isSlot$6(s) {
1633
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
1634
+ }
1635
+ const CommonOverlay = defineComponent$1({
1636
+ setup(props, ctx2) {
1637
+ return () => {
1638
+ let _slot;
1639
+ return createVNode(Teleport, {
1640
+ "to": "#d-overlay-anchor"
1641
+ }, {
1642
+ default: () => [createVNode(Transition, {
1643
+ "name": "devui-overlay-fade"
1644
+ }, _isSlot$6(_slot = renderSlot(ctx2.slots, "default")) ? _slot : {
1645
+ default: () => [_slot]
1646
+ })]
1647
+ });
1648
+ };
1649
+ }
1650
+ });
1651
+ const overlayProps = {
1652
+ visible: {
1653
+ type: Boolean
1654
+ },
1655
+ backgroundBlock: {
1656
+ type: Boolean,
1657
+ default: false
1658
+ },
1659
+ backgroundClass: {
1660
+ type: String,
1661
+ default: ""
1662
+ },
1663
+ backgroundStyle: {
1664
+ type: [String, Object]
1665
+ },
1666
+ onBackdropClick: {
1667
+ type: Function
1668
+ },
1669
+ backdropClose: {
1670
+ type: Boolean,
1671
+ default: true
1672
+ },
1673
+ hasBackdrop: {
1674
+ type: Boolean,
1675
+ default: true
1676
+ }
1677
+ };
1678
+ const overlayEmits = ["update:visible", "backdropClick"];
1679
+ const fixedOverlayProps = __spreadProps(__spreadValues({}, overlayProps), {
1680
+ overlayStyle: {
1681
+ type: [String, Object],
1682
+ default: void 0
1683
+ }
1684
+ });
1685
+ const flexibleOverlayProps = __spreadValues({
1686
+ origin: {
1687
+ type: Object,
1688
+ require: true
1689
+ },
1690
+ position: {
1691
+ type: Object,
1692
+ default: () => ({
1693
+ originX: "left",
1694
+ originY: "top",
1695
+ overlayX: "left",
1696
+ overlayY: "top"
1697
+ })
1698
+ }
1699
+ }, overlayProps);
1700
+ function useOverlayLogic(props, ctx2) {
1701
+ const backgroundClass = computed(() => {
1702
+ return [
1703
+ "devui-overlay-background",
1704
+ props.backgroundClass,
1705
+ !props.hasBackdrop ? "devui-overlay-background__disabled" : "devui-overlay-background__color"
1706
+ ];
1707
+ });
1708
+ const overlayClass = computed(() => {
1709
+ return "devui-overlay";
1710
+ });
1711
+ const handleBackdropClick = (event) => {
1712
+ var _a;
1713
+ event.preventDefault();
1714
+ (_a = props.onBackdropClick) == null ? void 0 : _a.call(props);
1715
+ if (props.backdropClose) {
1716
+ ctx2.emit("update:visible", false);
1717
+ }
1718
+ };
1719
+ const handleOverlayBubbleCancel = (event) => event.cancelBubble = true;
1720
+ onMounted(() => {
1721
+ const body2 = document.body;
1722
+ const originOverflow = body2.style.overflow;
1723
+ const originPosition = body2.style.position;
1724
+ watch([() => props.visible, () => props.backgroundBlock], ([visible, backgroundBlock]) => {
1725
+ if (backgroundBlock) {
1726
+ const top = body2.getBoundingClientRect().y;
1727
+ if (visible) {
1728
+ body2.style.overflowY = "scroll";
1729
+ body2.style.position = visible ? "fixed" : "";
1730
+ body2.style.top = `${top}px`;
1731
+ } else {
1732
+ body2.style.overflowY = originOverflow;
1733
+ body2.style.position = originPosition;
1734
+ body2.style.top = "";
1735
+ window.scrollTo(0, -top);
1736
+ }
1737
+ }
1738
+ });
1739
+ onUnmounted(() => {
1740
+ document.body.style.overflow = originOverflow;
1741
+ });
1742
+ });
1743
+ return {
1744
+ backgroundClass,
1745
+ overlayClass,
1746
+ handleBackdropClick,
1747
+ handleOverlayBubbleCancel
1748
+ };
1749
+ }
1750
+ function isComponent(target) {
1751
+ return !!(target == null ? void 0 : target.$el);
1752
+ }
1753
+ function getElement(element) {
1754
+ if (element instanceof Element) {
1755
+ return element;
1756
+ }
1757
+ if (element && typeof element === "object" && element.$el instanceof Element) {
1758
+ return element.$el;
1759
+ }
1760
+ return null;
1761
+ }
1762
+ const FlexibleOverlay = defineComponent$1({
1763
+ name: "DFlexibleOverlay",
1764
+ props: flexibleOverlayProps,
1765
+ emits: overlayEmits,
1766
+ setup(props, ctx2) {
1767
+ const overlayRef = ref(null);
1768
+ const positionedStyle = reactive({
1769
+ position: "absolute"
1770
+ });
1771
+ onMounted(async () => {
1772
+ const handleRectChange = (position, rect, origin) => {
1773
+ const point = calculatePosition(position, rect, origin);
1774
+ positionedStyle.left = `${point.x}px`;
1775
+ positionedStyle.top = `${point.y}px`;
1776
+ };
1777
+ const locationElements = computed(() => {
1778
+ const overlay2 = overlayRef.value;
1779
+ const origin = getOrigin(props.origin);
1780
+ if (!overlay2 || !origin) {
1781
+ return;
1782
+ }
1783
+ return {
1784
+ origin,
1785
+ overlay: overlay2
1786
+ };
1787
+ });
1788
+ const visibleRef = toRef(props, "visible");
1789
+ const positionRef = toRef(props, "position");
1790
+ watch([locationElements, visibleRef, positionRef], async ([locationElements2, visible, position], ov, onInvalidate) => {
1791
+ if (!visible || !locationElements2) {
1792
+ return;
1793
+ }
1794
+ const {
1795
+ origin,
1796
+ overlay: overlay2
1797
+ } = locationElements2;
1798
+ handleRectChange(position, overlay2.getBoundingClientRect(), origin);
1799
+ const unsubscriptions = [subscribeLayoutEvent(() => handleRectChange(position, overlay2.getBoundingClientRect(), origin)), subscribeOverlayResize(overlay2, (entries) => handleRectChange(position, entries[0].contentRect, origin)), subscribeOriginResize(origin, () => handleRectChange(position, overlay2.getBoundingClientRect(), origin))];
1800
+ onInvalidate(() => {
1801
+ unsubscriptions.forEach((fn) => fn());
1802
+ });
1803
+ });
1804
+ });
1805
+ const {
1806
+ backgroundClass,
1807
+ overlayClass,
1808
+ handleBackdropClick,
1809
+ handleOverlayBubbleCancel
1810
+ } = useOverlayLogic(props, ctx2);
1811
+ return () => createVNode(CommonOverlay, null, {
1812
+ default: () => [withDirectives(createVNode("div", {
1813
+ "style": props.backgroundStyle,
1814
+ "class": backgroundClass.value,
1815
+ "onClick": handleBackdropClick
1816
+ }, [createVNode("div", {
1817
+ "ref": overlayRef,
1818
+ "class": overlayClass.value,
1819
+ "style": positionedStyle,
1820
+ "onClick": handleOverlayBubbleCancel
1821
+ }, [renderSlot(ctx2.slots, "default")])]), [[vShow, props.visible]])]
1822
+ });
1823
+ }
1824
+ });
1825
+ function getOrigin(origin) {
1826
+ if (origin instanceof Element) {
1827
+ return origin;
1828
+ }
1829
+ if (isRef$1(origin)) {
1830
+ return getElement(origin.value);
1831
+ }
1832
+ if (isComponent(origin)) {
1833
+ return getElement(origin);
1834
+ }
1835
+ return origin;
1836
+ }
1837
+ function calculatePosition(position, rect, origin) {
1838
+ const originRect = getOriginRect(origin);
1839
+ const originPoint = getOriginRelativePoint(originRect, position);
1840
+ return getOverlayPoint(originPoint, rect, position);
1841
+ }
1842
+ function getOriginRect(origin) {
1843
+ if (origin instanceof Element) {
1844
+ return origin.getBoundingClientRect();
1845
+ }
1846
+ const width = origin.width || 0;
1847
+ const height = origin.height || 0;
1848
+ return {
1849
+ top: origin.y,
1850
+ bottom: origin.y + height,
1851
+ left: origin.x,
1852
+ right: origin.x + width,
1853
+ height,
1854
+ width
1855
+ };
1856
+ }
1857
+ function getOverlayPoint(originPoint, rect, position) {
1858
+ let x;
1859
+ const {
1860
+ width,
1861
+ height
1862
+ } = rect;
1863
+ if (position.overlayX == "center") {
1864
+ x = originPoint.x - width / 2;
1865
+ } else {
1866
+ x = position.overlayX == "left" ? originPoint.x : originPoint.x - width;
1867
+ }
1868
+ let y;
1869
+ if (position.overlayY == "center") {
1870
+ y = originPoint.y - height / 2;
1871
+ } else {
1872
+ y = position.overlayY == "top" ? originPoint.y : originPoint.y - height;
1873
+ }
1874
+ return {
1875
+ x,
1876
+ y
1877
+ };
1878
+ }
1879
+ function getOriginRelativePoint(originRect, position) {
1880
+ let x;
1881
+ if (position.originX == "center") {
1882
+ x = originRect.left + originRect.width / 2;
1883
+ } else {
1884
+ const startX = originRect.left;
1885
+ const endX = originRect.right;
1886
+ x = position.originX == "left" ? startX : endX;
1887
+ }
1888
+ let y;
1889
+ if (position.originY == "center") {
1890
+ y = originRect.top + originRect.height / 2;
1891
+ } else {
1892
+ y = position.originY == "top" ? originRect.top : originRect.bottom;
1893
+ }
1894
+ return {
1895
+ x,
1896
+ y
1897
+ };
1898
+ }
1899
+ function subscribeLayoutEvent(event) {
1900
+ window.addEventListener("scroll", event, true);
1901
+ window.addEventListener("resize", event);
1902
+ window.addEventListener("orientationchange", event);
1903
+ return () => {
1904
+ window.removeEventListener("scroll", event, true);
1905
+ window.removeEventListener("resize", event);
1906
+ window.removeEventListener("orientationchange", event);
1907
+ };
1908
+ }
1909
+ function subscribeOverlayResize(overlay2, callback) {
1910
+ if (overlay2 instanceof Element) {
1911
+ const resizeObserver = new ResizeObserver(callback);
1912
+ resizeObserver.observe(overlay2);
1913
+ return () => resizeObserver.disconnect();
1914
+ }
1915
+ return () => {
1916
+ };
1917
+ }
1918
+ function subscribeOriginResize(origin, callback) {
1919
+ if (origin instanceof Element) {
1920
+ const observer = new MutationObserver(callback);
1921
+ observer.observe(origin, {
1922
+ attributeFilter: ["style"]
1923
+ });
1924
+ return () => observer.disconnect();
1925
+ }
1926
+ return () => {
1927
+ };
1928
+ }
1929
+ function _isSlot$5(s) {
1930
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
1931
+ }
1932
+ var AutoComplete = defineComponent$1({
1933
+ name: "DAutoComplete",
1934
+ directives: {
1935
+ ClickOutside: clickoutsideDirective
1936
+ },
1937
+ props: autoCompleteProps,
1938
+ emits: ["update:modelValue"],
1939
+ setup(props, ctx2) {
1940
+ const {
1941
+ disabled,
1942
+ modelValue,
1943
+ appendToBody,
1944
+ dAutoCompleteWidth,
1945
+ delay,
1946
+ allowEmptyValueSearch,
1947
+ formatter,
1948
+ transInputFocusEmit,
1949
+ selectValue,
1950
+ source,
1951
+ searchFn,
1952
+ appendToBodyDirections,
1953
+ latestSource,
1954
+ showAnimation
1955
+ } = toRefs(props);
1956
+ const {
1957
+ handleSearch,
1958
+ searchList,
1959
+ showNoResultItemTemplate,
1960
+ recentlyFocus
1961
+ } = useSearchFn(ctx2, allowEmptyValueSearch, source, searchFn, formatter);
1962
+ const {
1963
+ onInput,
1964
+ onFocus,
1965
+ inputRef,
1966
+ visible,
1967
+ searchStatus,
1968
+ handleClose,
1969
+ toggleMenu
1970
+ } = useInputHandle(ctx2, searchList, showNoResultItemTemplate, modelValue, disabled, delay, handleSearch, transInputFocusEmit, recentlyFocus, latestSource);
1971
+ const {
1972
+ selectedIndex,
1973
+ selectOptionClick
1974
+ } = useSelectHandle(ctx2, searchList, selectValue, handleSearch, formatter, handleClose);
1975
+ const {
1976
+ showLoading,
1977
+ dropDownRef,
1978
+ loadMore
1979
+ } = useLazyHandle(props, ctx2, handleSearch);
1980
+ const {
1981
+ customRenderSolts
1982
+ } = useCustomTemplate(ctx2, modelValue);
1983
+ const {
1984
+ hoverIndex,
1985
+ handlekeyDown
1986
+ } = useKeyBoardHandle(dropDownRef, visible, searchList, selectedIndex, searchStatus, showNoResultItemTemplate, selectOptionClick, handleClose);
1987
+ provide(DropdownPropsKey, {
1988
+ props,
1989
+ visible,
1990
+ term: "",
1991
+ searchList,
1992
+ selectedIndex,
1993
+ searchStatus,
1994
+ selectOptionClick,
1995
+ dropDownRef,
1996
+ showLoading,
1997
+ loadMore,
1998
+ latestSource,
1999
+ modelValue,
2000
+ showNoResultItemTemplate,
2001
+ hoverIndex
2002
+ });
2003
+ const origin = ref();
2004
+ const position = reactive({
2005
+ appendToBodyDirections: {}
2006
+ });
2007
+ position.appendToBodyDirections = appendToBodyDirections;
2008
+ const renderDropdown = () => {
2009
+ if (appendToBody.value) {
2010
+ let _slot;
2011
+ return createVNode(FlexibleOverlay, {
2012
+ "hasBackdrop": false,
2013
+ "origin": origin,
2014
+ "position": position.appendToBodyDirections,
2015
+ "visible": visible.value,
2016
+ "onUpdate:visible": ($event) => visible.value = $event
2017
+ }, {
2018
+ default: () => [createVNode("div", {
2019
+ "class": "devui-dropdown devui-auto-complete-menu",
2020
+ "style": {
2021
+ width: dAutoCompleteWidth.value > 0 && dAutoCompleteWidth.value + "px"
2022
+ }
2023
+ }, [createVNode(DAutoCompleteDropdown, null, _isSlot$5(_slot = customRenderSolts()) ? _slot : {
2024
+ default: () => [_slot]
2025
+ })])]
2026
+ });
2027
+ } else {
2028
+ let _slot2;
2029
+ return createVNode("div", {
2030
+ "class": "devui-dropdown",
2031
+ "style": {
2032
+ width: dAutoCompleteWidth.value > 0 && dAutoCompleteWidth.value + "px"
2033
+ }
2034
+ }, [createVNode(Transition, {
2035
+ "name": showAnimation ? "fade" : ""
2036
+ }, {
2037
+ default: () => [createVNode(DAutoCompleteDropdown, null, _isSlot$5(_slot2 = customRenderSolts()) ? _slot2 : {
2038
+ default: () => [_slot2]
2039
+ })]
2040
+ })]);
2041
+ }
2042
+ };
2043
+ return () => {
2044
+ return withDirectives(createVNode("div", {
2045
+ "class": ["devui-auto-complete", "devui-form-group", "devui-has-feedback", visible.value && "devui-select-open"],
2046
+ "ref": origin,
2047
+ "style": {
2048
+ width: dAutoCompleteWidth.value > 0 && dAutoCompleteWidth.value + "px"
2049
+ }
2050
+ }, [createVNode("input", {
2051
+ "disabled": disabled.value,
2052
+ "type": "text",
2053
+ "onClick": toggleMenu,
2054
+ "class": ["devui-form-control", "devui-dropdown-origin", "devui-dropdown-origin-open", disabled.value && "disabled"],
2055
+ "placeholder": "Search",
2056
+ "onInput": onInput,
2057
+ "onFocus": onFocus,
2058
+ "value": modelValue.value,
2059
+ "ref": inputRef,
2060
+ "onKeydown": handlekeyDown
2061
+ }, null), renderDropdown()]), [[resolveDirective("click-outside"), handleClose]]);
2062
+ };
2063
+ }
2064
+ });
2065
+ AutoComplete.install = function(app) {
2066
+ app.component(AutoComplete.name, AutoComplete);
2067
+ };
2068
+ var AutoCompleteInstall = {
2069
+ title: "AutoComplete \u81EA\u52A8\u8865\u5168",
2070
+ category: "\u6570\u636E\u5F55\u5165",
2071
+ status: "100%",
2072
+ install(app) {
2073
+ app.use(AutoComplete);
2074
+ }
2075
+ };
961
2076
  const IconBody = (props) => {
962
2077
  const {
963
2078
  width,
@@ -1618,221 +2733,25 @@ var Icon = defineComponent$1({
1618
2733
  "style": {
1619
2734
  width: size,
1620
2735
  verticalAlign: "text-bottom"
1621
- }
1622
- }, null) : createVNode("i", {
1623
- "class": `${classPrefix} ${classPrefix}-${name}`,
1624
- "style": {
1625
- fontSize: size,
1626
- color: color2
1627
- }
1628
- }, null);
1629
- }
1630
- });
1631
- Icon.install = function(app) {
1632
- app.component(Icon.name, Icon);
1633
- };
1634
- var IconInstall = {
1635
- title: "Icon \u56FE\u6807",
1636
- category: "\u901A\u7528",
1637
- status: "100%",
1638
- install(app) {
1639
- app.use(Icon);
1640
- }
1641
- };
1642
- class View {
1643
- constructor() {
1644
- __publicField(this, "top", "50%");
1645
- __publicField(this, "left", "50%");
1646
- }
1647
- }
1648
- const componentProps$1 = {
1649
- message: String,
1650
- backdrop: Boolean,
1651
- view: {
1652
- type: Object,
1653
- default: () => new View()
1654
- },
1655
- zIndex: Number,
1656
- isFull: {
1657
- type: Boolean,
1658
- default: false
1659
- }
1660
- };
1661
- class LoadingProps {
1662
- constructor() {
1663
- __publicField(this, "target");
1664
- __publicField(this, "message");
1665
- __publicField(this, "loadingTemplateRef");
1666
- __publicField(this, "backdrop", true);
1667
- __publicField(this, "positionType", "relative");
1668
- __publicField(this, "view", new View());
1669
- __publicField(this, "zIndex");
1670
- }
1671
- }
1672
- var loading$1 = "";
1673
- var Loading = defineComponent$1({
1674
- name: "DLoading",
1675
- inheritAttrs: false,
1676
- props: componentProps$1,
1677
- setup(props) {
1678
- const style2 = {
1679
- top: props.view.top,
1680
- left: props.view.left,
1681
- zIndex: props.zIndex
1682
- };
1683
- if (!props.message) {
1684
- style2.background = "none";
1685
- }
1686
- const isShow = ref(false);
1687
- const open = () => {
1688
- isShow.value = true;
1689
- };
1690
- const close = () => {
1691
- isShow.value = false;
1692
- };
1693
- return {
1694
- style: style2,
1695
- isShow,
1696
- open,
1697
- close
1698
- };
1699
- },
1700
- render() {
1701
- var _a;
1702
- const {
1703
- isShow,
1704
- isFull,
1705
- backdrop,
1706
- style: style2,
1707
- message,
1708
- $slots
1709
- } = this;
1710
- return isShow && createVNode("div", {
1711
- "class": ["devui-loading-contanier", isFull ? "devui-loading--full" : ""]
1712
- }, [((_a = $slots.default) == null ? void 0 : _a.call($slots)) || createVNode("div", {
1713
- "class": "devui-loading-wrapper"
1714
- }, [backdrop ? createVNode("div", {
1715
- "class": "devui-loading-mask"
1716
- }, null) : null, createVNode("div", {
1717
- "style": style2,
1718
- "class": "devui-loading-area"
1719
- }, [createVNode("div", {
1720
- "class": "devui-busy-default-spinner"
1721
- }, [createVNode("div", {
1722
- "class": "devui-loading-bar1"
1723
- }, null), createVNode("div", {
1724
- "class": "devui-loading-bar2"
1725
- }, null), createVNode("div", {
1726
- "class": "devui-loading-bar3"
1727
- }, null), createVNode("div", {
1728
- "class": "devui-loading-bar4"
1729
- }, null)]), message ? createVNode("span", {
1730
- "class": "devui-loading-text"
1731
- }, [message]) : null])])]);
1732
- }
1733
- });
1734
- const COMPONENT_CONTAINER_SYMBOL = Symbol("dev_component_container");
1735
- function createComponent$1(Component, props, children = null) {
1736
- const vnode = h(Component, __spreadValues({}, props), children);
1737
- const container = document.createElement("div");
1738
- vnode[COMPONENT_CONTAINER_SYMBOL] = container;
1739
- render(vnode, container);
1740
- return vnode.component;
1741
- }
1742
- function unmountComponent(ComponnetInstance) {
1743
- render(null, ComponnetInstance == null ? void 0 : ComponnetInstance.vnode[COMPONENT_CONTAINER_SYMBOL]);
1744
- }
1745
- const loadingConstructor$1 = defineComponent$1(Loading);
1746
- const cacheInstance = new WeakSet();
1747
- const isEmpty = (val) => {
1748
- if (!val)
1749
- return true;
1750
- if (Array.isArray(val))
1751
- return val.length === 0;
1752
- if (val instanceof Set || val instanceof Map)
1753
- return val.size === 0;
1754
- if (val instanceof Promise)
1755
- return false;
1756
- if (typeof val === "object") {
1757
- try {
1758
- return Object.keys(val).length === 0;
1759
- } catch (e) {
1760
- return false;
1761
- }
1762
- }
1763
- return false;
1764
- };
1765
- const getType = (vari) => {
1766
- return Object.prototype.toString.call(vari).slice(8, -1).toLowerCase();
1767
- };
1768
- const isPromise$1 = (value) => {
1769
- const type4 = getType(value);
1770
- switch (type4) {
1771
- case "promise":
1772
- return [value];
1773
- case "array":
1774
- if (value.some((val) => getType(val) !== "promise")) {
1775
- console.error(new TypeError("Binding values should all be of type Promise"));
1776
- return "error";
1777
- }
1778
- return value;
1779
- default:
1780
- return false;
1781
- }
1782
- };
1783
- const unmount = (el) => {
1784
- cacheInstance.delete(el);
1785
- el.instance.proxy.close();
1786
- unmountComponent(el.instance);
1787
- };
1788
- const toggleLoading = (el, binding) => {
1789
- if (binding.value) {
1790
- const vals = isPromise$1(binding.value);
1791
- if (vals === "error")
1792
- return;
1793
- el.instance.proxy.open();
1794
- el.appendChild(el.mask);
1795
- cacheInstance.add(el);
1796
- if (vals) {
1797
- Promise.all(vals).catch((err) => {
1798
- console.error(new Error("Promise handling errors"), err);
1799
- }).finally(() => {
1800
- unmount(el);
1801
- });
1802
- }
1803
- } else {
1804
- unmount(el);
2736
+ }
2737
+ }, null) : createVNode("i", {
2738
+ "class": `${classPrefix} ${classPrefix}-${name}`,
2739
+ "style": {
2740
+ fontSize: size,
2741
+ color: color2
2742
+ }
2743
+ }, null);
1805
2744
  }
2745
+ });
2746
+ Icon.install = function(app) {
2747
+ app.component(Icon.name, Icon);
1806
2748
  };
1807
- const removeAttribute = (el) => {
1808
- el.removeAttribute("zindex");
1809
- el.removeAttribute("positiontype");
1810
- el.removeAttribute("backdrop");
1811
- el.removeAttribute("message");
1812
- el.removeAttribute("view");
1813
- el.removeAttribute("loadingtemplateref");
1814
- };
1815
- const handleProps = (el, vprops) => {
1816
- const props = __spreadValues(__spreadValues({}, new LoadingProps()), vprops);
1817
- const loadingTemplateRef = props.loadingTemplateRef;
1818
- const loadingInstance = createComponent$1(loadingConstructor$1, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
1819
- el.style.position = props.positionType;
1820
- el.options = props;
1821
- el.instance = loadingInstance;
1822
- el.mask = loadingInstance.proxy.$el;
1823
- };
1824
- const loadingDirective = {
1825
- mounted: function(el, binding, vnode) {
1826
- handleProps(el, vnode.props);
1827
- removeAttribute(el);
1828
- !isEmpty(binding.value) && toggleLoading(el, binding);
1829
- },
1830
- updated: function(el, binding, vnode) {
1831
- if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el))
1832
- return;
1833
- !cacheInstance.has(el) && handleProps(el, vnode.props);
1834
- removeAttribute(el);
1835
- toggleLoading(el, binding);
2749
+ var IconInstall = {
2750
+ title: "Icon \u56FE\u6807",
2751
+ category: "\u901A\u7528",
2752
+ status: "100%",
2753
+ install(app) {
2754
+ app.use(Icon);
1836
2755
  }
1837
2756
  };
1838
2757
  const buttonProps = {
@@ -9430,18 +10349,6 @@ const dropdownProps = {
9430
10349
  default: "102px"
9431
10350
  }
9432
10351
  };
9433
- function isComponent(target) {
9434
- return !!(target == null ? void 0 : target.$el);
9435
- }
9436
- function getElement(element) {
9437
- if (element instanceof Element) {
9438
- return element;
9439
- }
9440
- if (element && typeof element === "object" && element.$el instanceof Element) {
9441
- return element.$el;
9442
- }
9443
- return null;
9444
- }
9445
10352
  function subscribeEvent(dom, type4, callback) {
9446
10353
  dom == null ? void 0 : dom.addEventListener(type4, callback);
9447
10354
  return () => {
@@ -9507,205 +10414,24 @@ const useDropdown = ({
9507
10414
  originEnter = false;
9508
10415
  if (!closeOnMouseLeaveMenu.value) {
9509
10416
  handleLeave("origin");
9510
- }
9511
- }), subscribeEvent(dropdownEl, "mouseenter", () => {
9512
- overlayEnter = true;
9513
- visible.value = true;
9514
- }), subscribeEvent(dropdownEl, "mouseleave", () => {
9515
- overlayEnter = false;
9516
- handleLeave("dropdown");
9517
- }));
9518
- }
9519
- onInvalidate(() => subscriptions.forEach((v) => v()));
9520
- });
9521
- return { dropdownEl: dropdownElRef };
9522
- };
9523
- var overlay = "";
9524
- function _isSlot$4(s) {
9525
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
9526
- }
9527
- const CommonOverlay = defineComponent$1({
9528
- setup(props, ctx2) {
9529
- return () => {
9530
- let _slot;
9531
- return createVNode(Teleport, {
9532
- "to": "#d-overlay-anchor"
9533
- }, {
9534
- default: () => [createVNode(Transition, {
9535
- "name": "devui-overlay-fade"
9536
- }, _isSlot$4(_slot = renderSlot(ctx2.slots, "default")) ? _slot : {
9537
- default: () => [_slot]
9538
- })]
9539
- });
9540
- };
9541
- }
9542
- });
9543
- const overlayProps = {
9544
- visible: {
9545
- type: Boolean
9546
- },
9547
- backgroundBlock: {
9548
- type: Boolean,
9549
- default: false
9550
- },
9551
- backgroundClass: {
9552
- type: String,
9553
- default: ""
9554
- },
9555
- backgroundStyle: {
9556
- type: [String, Object]
9557
- },
9558
- onBackdropClick: {
9559
- type: Function
9560
- },
9561
- backdropClose: {
9562
- type: Boolean,
9563
- default: true
9564
- },
9565
- hasBackdrop: {
9566
- type: Boolean,
9567
- default: true
9568
- }
9569
- };
9570
- const overlayEmits = ["update:visible", "backdropClick"];
9571
- const fixedOverlayProps = __spreadProps(__spreadValues({}, overlayProps), {
9572
- overlayStyle: {
9573
- type: [String, Object],
9574
- default: void 0
9575
- }
9576
- });
9577
- const flexibleOverlayProps = __spreadValues({
9578
- origin: {
9579
- type: Object,
9580
- require: true
9581
- },
9582
- position: {
9583
- type: Object,
9584
- default: () => ({
9585
- originX: "left",
9586
- originY: "top",
9587
- overlayX: "left",
9588
- overlayY: "top"
9589
- })
9590
- }
9591
- }, overlayProps);
9592
- function useOverlayLogic(props, ctx2) {
9593
- const backgroundClass = computed(() => {
9594
- return [
9595
- "devui-overlay-background",
9596
- props.backgroundClass,
9597
- !props.hasBackdrop ? "devui-overlay-background__disabled" : "devui-overlay-background__color"
9598
- ];
9599
- });
9600
- const overlayClass = computed(() => {
9601
- return "devui-overlay";
9602
- });
9603
- const handleBackdropClick = (event) => {
9604
- var _a;
9605
- event.preventDefault();
9606
- (_a = props.onBackdropClick) == null ? void 0 : _a.call(props);
9607
- if (props.backdropClose) {
9608
- ctx2.emit("update:visible", false);
9609
- }
9610
- };
9611
- const handleOverlayBubbleCancel = (event) => event.cancelBubble = true;
9612
- onMounted(() => {
9613
- const body2 = document.body;
9614
- const originOverflow = body2.style.overflow;
9615
- const originPosition = body2.style.position;
9616
- watch([() => props.visible, () => props.backgroundBlock], ([visible, backgroundBlock]) => {
9617
- if (backgroundBlock) {
9618
- const top = body2.getBoundingClientRect().y;
9619
- if (visible) {
9620
- body2.style.overflowY = "scroll";
9621
- body2.style.position = visible ? "fixed" : "";
9622
- body2.style.top = `${top}px`;
9623
- } else {
9624
- body2.style.overflowY = originOverflow;
9625
- body2.style.position = originPosition;
9626
- body2.style.top = "";
9627
- window.scrollTo(0, -top);
9628
- }
9629
- }
9630
- });
9631
- onUnmounted(() => {
9632
- document.body.style.overflow = originOverflow;
9633
- });
9634
- });
9635
- return {
9636
- backgroundClass,
9637
- overlayClass,
9638
- handleBackdropClick,
9639
- handleOverlayBubbleCancel
9640
- };
9641
- }
9642
- const FixedOverlay = defineComponent$1({
9643
- name: "DFixedOverlay",
9644
- props: fixedOverlayProps,
9645
- emits: overlayEmits,
9646
- setup(props, ctx2) {
9647
- const {
9648
- backgroundClass,
9649
- overlayClass,
9650
- handleBackdropClick,
9651
- handleOverlayBubbleCancel
9652
- } = useOverlayLogic(props, ctx2);
9653
- return () => createVNode(CommonOverlay, null, {
9654
- default: () => [withDirectives(createVNode("div", {
9655
- "class": backgroundClass.value,
9656
- "style": props.backgroundStyle,
9657
- "onClick": handleBackdropClick
9658
- }, [createVNode("div", {
9659
- "class": overlayClass.value,
9660
- "style": props.overlayStyle,
9661
- "onClick": handleOverlayBubbleCancel
9662
- }, [renderSlot(ctx2.slots, "default")])]), [[vShow, props.visible]])]
9663
- });
9664
- }
9665
- });
9666
- const FlexibleOverlay = defineComponent$1({
9667
- name: "DFlexibleOverlay",
9668
- props: flexibleOverlayProps,
9669
- emits: overlayEmits,
9670
- setup(props, ctx2) {
9671
- const overlayRef = ref(null);
9672
- const positionedStyle = reactive({
9673
- position: "absolute"
9674
- });
9675
- onMounted(async () => {
9676
- const handleRectChange = (position, rect, origin) => {
9677
- const point = calculatePosition(position, rect, origin);
9678
- positionedStyle.left = `${point.x}px`;
9679
- positionedStyle.top = `${point.y}px`;
9680
- };
9681
- const locationElements = computed(() => {
9682
- const overlay2 = overlayRef.value;
9683
- const origin = getOrigin(props.origin);
9684
- if (!overlay2 || !origin) {
9685
- return;
9686
- }
9687
- return {
9688
- origin,
9689
- overlay: overlay2
9690
- };
9691
- });
9692
- const visibleRef = toRef(props, "visible");
9693
- const positionRef = toRef(props, "position");
9694
- watch([locationElements, visibleRef, positionRef], async ([locationElements2, visible, position], ov, onInvalidate) => {
9695
- if (!visible || !locationElements2) {
9696
- return;
9697
- }
9698
- const {
9699
- origin,
9700
- overlay: overlay2
9701
- } = locationElements2;
9702
- handleRectChange(position, overlay2.getBoundingClientRect(), origin);
9703
- const unsubscriptions = [subscribeLayoutEvent(() => handleRectChange(position, overlay2.getBoundingClientRect(), origin)), subscribeOverlayResize(overlay2, (entries) => handleRectChange(position, entries[0].contentRect, origin)), subscribeOriginResize(origin, () => handleRectChange(position, overlay2.getBoundingClientRect(), origin))];
9704
- onInvalidate(() => {
9705
- unsubscriptions.forEach((fn) => fn());
9706
- });
9707
- });
9708
- });
10417
+ }
10418
+ }), subscribeEvent(dropdownEl, "mouseenter", () => {
10419
+ overlayEnter = true;
10420
+ visible.value = true;
10421
+ }), subscribeEvent(dropdownEl, "mouseleave", () => {
10422
+ overlayEnter = false;
10423
+ handleLeave("dropdown");
10424
+ }));
10425
+ }
10426
+ onInvalidate(() => subscriptions.forEach((v) => v()));
10427
+ });
10428
+ return { dropdownEl: dropdownElRef };
10429
+ };
10430
+ const FixedOverlay = defineComponent$1({
10431
+ name: "DFixedOverlay",
10432
+ props: fixedOverlayProps,
10433
+ emits: overlayEmits,
10434
+ setup(props, ctx2) {
9709
10435
  const {
9710
10436
  backgroundClass,
9711
10437
  overlayClass,
@@ -9714,122 +10440,17 @@ const FlexibleOverlay = defineComponent$1({
9714
10440
  } = useOverlayLogic(props, ctx2);
9715
10441
  return () => createVNode(CommonOverlay, null, {
9716
10442
  default: () => [withDirectives(createVNode("div", {
9717
- "style": props.backgroundStyle,
9718
10443
  "class": backgroundClass.value,
10444
+ "style": props.backgroundStyle,
9719
10445
  "onClick": handleBackdropClick
9720
10446
  }, [createVNode("div", {
9721
- "ref": overlayRef,
9722
10447
  "class": overlayClass.value,
9723
- "style": positionedStyle,
10448
+ "style": props.overlayStyle,
9724
10449
  "onClick": handleOverlayBubbleCancel
9725
10450
  }, [renderSlot(ctx2.slots, "default")])]), [[vShow, props.visible]])]
9726
10451
  });
9727
10452
  }
9728
10453
  });
9729
- function getOrigin(origin) {
9730
- if (origin instanceof Element) {
9731
- return origin;
9732
- }
9733
- if (isRef$1(origin)) {
9734
- return getElement(origin.value);
9735
- }
9736
- if (isComponent(origin)) {
9737
- return getElement(origin);
9738
- }
9739
- return origin;
9740
- }
9741
- function calculatePosition(position, rect, origin) {
9742
- const originRect = getOriginRect(origin);
9743
- const originPoint = getOriginRelativePoint(originRect, position);
9744
- return getOverlayPoint(originPoint, rect, position);
9745
- }
9746
- function getOriginRect(origin) {
9747
- if (origin instanceof Element) {
9748
- return origin.getBoundingClientRect();
9749
- }
9750
- const width = origin.width || 0;
9751
- const height = origin.height || 0;
9752
- return {
9753
- top: origin.y,
9754
- bottom: origin.y + height,
9755
- left: origin.x,
9756
- right: origin.x + width,
9757
- height,
9758
- width
9759
- };
9760
- }
9761
- function getOverlayPoint(originPoint, rect, position) {
9762
- let x;
9763
- const {
9764
- width,
9765
- height
9766
- } = rect;
9767
- if (position.overlayX == "center") {
9768
- x = originPoint.x - width / 2;
9769
- } else {
9770
- x = position.overlayX == "left" ? originPoint.x : originPoint.x - width;
9771
- }
9772
- let y;
9773
- if (position.overlayY == "center") {
9774
- y = originPoint.y - height / 2;
9775
- } else {
9776
- y = position.overlayY == "top" ? originPoint.y : originPoint.y - height;
9777
- }
9778
- return {
9779
- x,
9780
- y
9781
- };
9782
- }
9783
- function getOriginRelativePoint(originRect, position) {
9784
- let x;
9785
- if (position.originX == "center") {
9786
- x = originRect.left + originRect.width / 2;
9787
- } else {
9788
- const startX = originRect.left;
9789
- const endX = originRect.right;
9790
- x = position.originX == "left" ? startX : endX;
9791
- }
9792
- let y;
9793
- if (position.originY == "center") {
9794
- y = originRect.top + originRect.height / 2;
9795
- } else {
9796
- y = position.originY == "top" ? originRect.top : originRect.bottom;
9797
- }
9798
- return {
9799
- x,
9800
- y
9801
- };
9802
- }
9803
- function subscribeLayoutEvent(event) {
9804
- window.addEventListener("scroll", event, true);
9805
- window.addEventListener("resize", event);
9806
- window.addEventListener("orientationchange", event);
9807
- return () => {
9808
- window.removeEventListener("scroll", event, true);
9809
- window.removeEventListener("resize", event);
9810
- window.removeEventListener("orientationchange", event);
9811
- };
9812
- }
9813
- function subscribeOverlayResize(overlay2, callback) {
9814
- if (overlay2 instanceof Element) {
9815
- const resizeObserver = new ResizeObserver(callback);
9816
- resizeObserver.observe(overlay2);
9817
- return () => resizeObserver.disconnect();
9818
- }
9819
- return () => {
9820
- };
9821
- }
9822
- function subscribeOriginResize(origin, callback) {
9823
- if (origin instanceof Element) {
9824
- const observer = new MutationObserver(callback);
9825
- observer.observe(origin, {
9826
- attributeFilter: ["style"]
9827
- });
9828
- return () => observer.disconnect();
9829
- }
9830
- return () => {
9831
- };
9832
- }
9833
10454
  FlexibleOverlay.install = function(app) {
9834
10455
  app.component(FlexibleOverlay.name, FlexibleOverlay);
9835
10456
  };
@@ -9981,137 +10602,72 @@ const editableSelectProps = {
9981
10602
  };
9982
10603
  const selectDropdownProps = {
9983
10604
  options: {
9984
- type: Array,
9985
- default: () => []
9986
- }
9987
- };
9988
- function className$2(classStr, classOpt) {
9989
- let classname = classStr;
9990
- if (typeof classOpt === "object") {
9991
- Object.keys(classOpt).forEach((key) => {
9992
- classOpt[key] && (classname += ` ${key}`);
9993
- });
9994
- }
9995
- return classname;
9996
- }
9997
- var SelectDropdown = defineComponent$1({
9998
- name: "DSelectDropdown",
9999
- props: selectDropdownProps,
10000
- setup(props) {
10001
- const select2 = inject("InjectionKey");
10002
- const {
10003
- props: selectProps2,
10004
- dropdownRef,
10005
- visible,
10006
- selectOptionClick,
10007
- renderDefaultSlots,
10008
- renderEmptySlots,
10009
- selectedIndex,
10010
- hoverIndex,
10011
- loadMore
10012
- } = select2;
10013
- const {
10014
- maxHeight
10015
- } = selectProps2;
10016
- return () => {
10017
- const getLiCls = (item2, index2) => {
10018
- const {
10019
- disabledKey
10020
- } = selectProps2;
10021
- return className$2("devui-dropdown-item", {
10022
- disabled: disabledKey ? !!item2[disabledKey] : false,
10023
- selected: selectedIndex.value === index2,
10024
- "devui-dropdown-bg": hoverIndex.value === index2
10025
- });
10026
- };
10027
- return withDirectives(createVNode("div", {
10028
- "class": "devui-dropdown-menu"
10029
- }, [createVNode("ul", {
10030
- "ref": dropdownRef,
10031
- "class": "devui-list-unstyled scroll-height",
10032
- "style": {
10033
- maxHeight: maxHeight + "px"
10034
- },
10035
- "onScroll": loadMore
10036
- }, [props.options.map((o, index2) => {
10037
- return createVNode("li", {
10038
- "class": getLiCls(o, index2),
10039
- "onClick": ($evnet) => selectOptionClick($evnet, o)
10040
- }, [renderDefaultSlots(o)]);
10041
- }), withDirectives(createVNode("li", {
10042
- "class": "devui-no-result-template"
10043
- }, [createVNode("div", {
10044
- "class": "devui-no-data-tip"
10045
- }, [renderEmptySlots()])]), [[vShow, props.options.length === 0]])])]), [[vShow, visible]]);
10046
- };
10047
- }
10048
- });
10049
- var editableSelect = "";
10050
- function on(element, eventName, handler) {
10051
- if (document.addEventListener) {
10052
- if (element && eventName && handler) {
10053
- element.addEventListener(eventName, handler, false);
10054
- }
10055
- } else {
10056
- if (element && eventName && handler) {
10057
- element.attachEvent("on" + eventName, handler);
10058
- }
10059
- }
10060
- }
10061
- function off(element, eventName, handler) {
10062
- if (document.removeEventListener) {
10063
- if (element && eventName && handler) {
10064
- element.removeEventListener(eventName, handler, false);
10065
- }
10066
- } else {
10067
- if (element && eventName && handler) {
10068
- element.detachEvent("on" + eventName, handler);
10069
- }
10070
- }
10071
- }
10072
- const ctx = Symbol("@@clickoutside");
10073
- const nodeList = new Map();
10074
- let startClick;
10075
- let nid = 0;
10076
- let isFirst = true;
10077
- function createDocumentHandler(el, binding, vnode) {
10078
- if (inBrowser && isFirst) {
10079
- isFirst = false;
10080
- on(document, "mousedown", (e) => {
10081
- startClick = e;
10082
- });
10083
- on(document, "mouseup", (e) => {
10084
- for (const [id, node] of nodeList) {
10085
- node[ctx].documentHandler(e, startClick);
10086
- }
10087
- });
10088
- }
10089
- return function(mouseup, mousedown) {
10090
- if (!vnode || !binding.instance || !mouseup.target || !mousedown.target || el.contains(mouseup.target) || el.contains(mousedown.target) || el === mouseup.target) {
10091
- return;
10092
- }
10093
- el[ctx].bindingFn && el[ctx].bindingFn();
10094
- };
10095
- }
10096
- const clickoutsideDirective = {
10097
- beforeMount: function(el, binding, vnode) {
10098
- nid++;
10099
- nodeList.set(nid, el);
10100
- el[ctx] = {
10101
- nid,
10102
- documentHandler: createDocumentHandler(el, binding, vnode),
10103
- bindingFn: binding.value
10104
- };
10105
- },
10106
- updated: function(el, binding, vnode) {
10107
- el[ctx].documentHandler = createDocumentHandler(el, binding, vnode);
10108
- el[ctx].bindingFn = binding.value;
10109
- },
10110
- unmounted: function(el) {
10111
- nodeList.delete(el[ctx].nid);
10112
- delete el[ctx];
10605
+ type: Array,
10606
+ default: () => []
10113
10607
  }
10114
10608
  };
10609
+ function className$2(classStr, classOpt) {
10610
+ let classname = classStr;
10611
+ if (typeof classOpt === "object") {
10612
+ Object.keys(classOpt).forEach((key) => {
10613
+ classOpt[key] && (classname += ` ${key}`);
10614
+ });
10615
+ }
10616
+ return classname;
10617
+ }
10618
+ var SelectDropdown = defineComponent$1({
10619
+ name: "DSelectDropdown",
10620
+ props: selectDropdownProps,
10621
+ setup(props) {
10622
+ const select2 = inject("InjectionKey");
10623
+ const {
10624
+ props: selectProps2,
10625
+ dropdownRef,
10626
+ visible,
10627
+ selectOptionClick,
10628
+ renderDefaultSlots,
10629
+ renderEmptySlots,
10630
+ selectedIndex,
10631
+ hoverIndex,
10632
+ loadMore
10633
+ } = select2;
10634
+ const {
10635
+ maxHeight
10636
+ } = selectProps2;
10637
+ return () => {
10638
+ const getLiCls = (item2, index2) => {
10639
+ const {
10640
+ disabledKey
10641
+ } = selectProps2;
10642
+ return className$2("devui-dropdown-item", {
10643
+ disabled: disabledKey ? !!item2[disabledKey] : false,
10644
+ selected: selectedIndex.value === index2,
10645
+ "devui-dropdown-bg": hoverIndex.value === index2
10646
+ });
10647
+ };
10648
+ return withDirectives(createVNode("div", {
10649
+ "class": "devui-dropdown-menu"
10650
+ }, [createVNode("ul", {
10651
+ "ref": dropdownRef,
10652
+ "class": "devui-list-unstyled scroll-height",
10653
+ "style": {
10654
+ maxHeight: maxHeight + "px"
10655
+ },
10656
+ "onScroll": loadMore
10657
+ }, [props.options.map((o, index2) => {
10658
+ return createVNode("li", {
10659
+ "class": getLiCls(o, index2),
10660
+ "onClick": ($evnet) => selectOptionClick($evnet, o)
10661
+ }, [renderDefaultSlots(o)]);
10662
+ }), withDirectives(createVNode("li", {
10663
+ "class": "devui-no-result-template"
10664
+ }, [createVNode("div", {
10665
+ "class": "devui-no-data-tip"
10666
+ }, [renderEmptySlots()])]), [[vShow, props.options.length === 0]])])]), [[vShow, visible]]);
10667
+ };
10668
+ }
10669
+ });
10670
+ var editableSelect = "";
10115
10671
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
10116
10672
  var lodash = { exports: {} };
10117
10673
  /**
@@ -16180,6 +16736,9 @@ var FormItem = defineComponent$1({
16180
16736
  var formControl = "";
16181
16737
  var FormControl = defineComponent$1({
16182
16738
  name: "DFormControl",
16739
+ directives: {
16740
+ clickoutside: clickoutsideDirective
16741
+ },
16183
16742
  props: formControlProps,
16184
16743
  setup(props, ctx2) {
16185
16744
  const formControl2 = ref();
@@ -16188,6 +16747,7 @@ var FormControl = defineComponent$1({
16188
16747
  const isHorizontal = labelData.layout === "horizontal";
16189
16748
  const uid = uniqueId("dfc-");
16190
16749
  const showPopover = ref(false);
16750
+ const updateOn = ref("change");
16191
16751
  const tipMessage = ref("");
16192
16752
  const popPosition = ref("bottom");
16193
16753
  let rectInfo = {
@@ -16204,13 +16764,15 @@ var FormControl = defineComponent$1({
16204
16764
  const el = document.getElementById(uid);
16205
16765
  elOffset = getElOffset(el);
16206
16766
  EventBus.on("showPopoverErrorMessage", (data) => {
16767
+ var _a;
16207
16768
  if (uid === data.uid) {
16208
16769
  rectInfo = el.getBoundingClientRect();
16209
- popoverLeftPosition = popPosition.value === "top" || popPosition.value === "bottom" ? rectInfo.right - rectInfo.width / 2 : rectInfo.right;
16210
- popoverTopPosition = popPosition.value === "top" ? elOffset.top + rectInfo.height / 2 - rectInfo.height : elOffset.top + rectInfo.height / 2;
16211
16770
  showPopover.value = data.showPopover;
16212
16771
  tipMessage.value = data.message;
16213
16772
  popPosition.value = data.popPosition;
16773
+ popoverLeftPosition = popPosition.value === "top" || popPosition.value === "bottom" ? rectInfo.right - rectInfo.width / 2 : rectInfo.right;
16774
+ popoverTopPosition = popPosition.value === "top" ? elOffset.top + rectInfo.height / 2 - rectInfo.height : elOffset.top + rectInfo.height / 2;
16775
+ updateOn.value = (_a = data.updateOn) != null ? _a : "change";
16214
16776
  }
16215
16777
  });
16216
16778
  });
@@ -16238,17 +16800,22 @@ var FormControl = defineComponent$1({
16238
16800
  };
16239
16801
  }
16240
16802
  });
16803
+ const handleClickOutside = () => {
16804
+ if (updateOn.value !== "change") {
16805
+ showPopover.value = false;
16806
+ }
16807
+ };
16241
16808
  return () => {
16242
16809
  var _a, _b, _c, _d, _e, _f, _g, _h;
16243
16810
  const {
16244
16811
  feedbackStatus,
16245
16812
  extraInfo
16246
16813
  } = props;
16247
- return createVNode("div", {
16814
+ return withDirectives(createVNode("div", {
16248
16815
  "class": "form-control",
16249
16816
  "ref": formControl2,
16250
16817
  "data-uid": uid
16251
- }, [createVNode(Teleport, {
16818
+ }, [showPopover.value && createVNode(Teleport, {
16252
16819
  "to": "body"
16253
16820
  }, {
16254
16821
  default: () => [createVNode("div", {
@@ -16260,6 +16827,7 @@ var FormControl = defineComponent$1({
16260
16827
  height: rectInfo.height + "px"
16261
16828
  }
16262
16829
  }, [createVNode(Popover, {
16830
+ "controlled": updateOn.value !== "change",
16263
16831
  "visible": showPopover.value,
16264
16832
  "content": tipMessage.value,
16265
16833
  "popType": "error",
@@ -16277,7 +16845,7 @@ var FormControl = defineComponent$1({
16277
16845
  "color": iconData.value.color
16278
16846
  }, null)])]), extraInfo && createVNode("div", {
16279
16847
  "class": "devui-form-control-extra-info"
16280
- }, [extraInfo])]);
16848
+ }, [extraInfo])]), [[resolveDirective("clickoutside"), handleClickOutside]]);
16281
16849
  };
16282
16850
  }
16283
16851
  });
@@ -16446,13 +17014,25 @@ function handleErrorStrategyPass(el) {
16446
17014
  index2 !== -1 && classList.splice(index2, 1);
16447
17015
  el.setAttribute("class", classList.join(" "));
16448
17016
  }
16449
- function handleValidateError({ el, tipEl, message, isFormTag, messageShowType, dfcUID, popPosition = "right-bottom" }) {
17017
+ function getFormControlUID(el) {
17018
+ if (el.tagName.toLocaleLowerCase() === "body")
17019
+ return "";
17020
+ if (el.parentElement.id.startsWith("dfc-")) {
17021
+ return el.parentElement.id;
17022
+ } else {
17023
+ getFormControlUID(el.parentElement);
17024
+ }
17025
+ }
17026
+ function handleValidateError({ el, tipEl, message = "", isFormTag, messageShowType, dfcUID, popPosition = "right-bottom", updateOn }) {
16450
17027
  if (isFormTag && messageShowType === MessageShowTypeEnum.toast) {
16451
17028
  alert(message);
16452
17029
  return;
16453
17030
  }
17031
+ if (!dfcUID) {
17032
+ dfcUID = getFormControlUID(el);
17033
+ }
16454
17034
  if (MessageShowTypeEnum.popover === messageShowType) {
16455
- EventBus.emit("showPopoverErrorMessage", { showPopover: true, message, uid: dfcUID, popPosition });
17035
+ EventBus.emit("showPopoverErrorMessage", { showPopover: true, message, uid: dfcUID, popPosition, updateOn });
16456
17036
  return;
16457
17037
  }
16458
17038
  tipEl.innerText = "" + message;
@@ -16474,7 +17054,7 @@ function getFormName(binding) {
16474
17054
  const key = Object.keys(_refs)[0];
16475
17055
  return _refs[key]["name"];
16476
17056
  }
16477
- function validateFn({ validator, modelValue, el, tipEl, isFormTag, messageShowType, dfcUID, popPosition }) {
17057
+ function validateFn({ validator, modelValue, el, tipEl, isFormTag, messageShowType, dfcUID, popPosition, updateOn }) {
16478
17058
  validator.validate({ modelName: modelValue }).then(() => {
16479
17059
  handleValidatePass(el, tipEl);
16480
17060
  }).catch((err) => {
@@ -16487,7 +17067,7 @@ function validateFn({ validator, modelValue, el, tipEl, isFormTag, messageShowTy
16487
17067
  } else {
16488
17068
  msg = errors[0].message;
16489
17069
  }
16490
- handleValidateError({ el, tipEl, message: msg, isFormTag, messageShowType, dfcUID, popPosition });
17070
+ handleValidateError({ el, tipEl, message: msg, isFormTag, messageShowType, dfcUID, popPosition, updateOn });
16491
17071
  });
16492
17072
  }
16493
17073
  function checkValidPopsition(positionStr) {
@@ -16586,11 +17166,16 @@ var dValidateRules = {
16586
17166
  const htmlEventValidateHandler = (e) => {
16587
17167
  const modelValue = e.target.value;
16588
17168
  if (messageShowType === MessageShowTypeEnum.popover) {
16589
- EventBus.emit("showPopoverErrorMessage", { showPopover: false, message: "", uid: dfcUID, popPosition });
17169
+ EventBus.emit("showPopoverErrorMessage", { showPopover: false, message: "", uid: dfcUID, popPosition, updateOn });
16590
17170
  }
16591
- validateFn({ validator, modelValue, el, tipEl, isFormTag: false, messageShowType, dfcUID, popPosition });
17171
+ validateFn({ validator, modelValue, el, tipEl, isFormTag: false, messageShowType, dfcUID, popPosition, updateOn });
16592
17172
  };
16593
17173
  vnode.children[0].el.addEventListener(updateOn, htmlEventValidateHandler);
17174
+ if (messageShowType === MessageShowTypeEnum.popover && updateOn === UpdateOnEnum.change) {
17175
+ vnode.children[0].el.addEventListener("focus", () => {
17176
+ EventBus.emit("showPopoverErrorMessage", { showPopover: false, uid: dfcUID, updateOn });
17177
+ });
17178
+ }
16594
17179
  if (errorStrategy === ErrorStrategyEnum.pristine) {
16595
17180
  handleErrorStrategy(el);
16596
17181
  vnode.children[0].props.value = "" + vnode.children[0].props.value;
@@ -16598,7 +17183,7 @@ var dValidateRules = {
16598
17183
  const formName = getFormName(binding);
16599
17184
  formName && EventBus.on(`formSubmit:${formName}`, () => {
16600
17185
  const modelValue = isFormTag ? "" : vnode.children[0].el.value;
16601
- validateFn({ validator, modelValue, el, tipEl, isFormTag, messageShowType });
17186
+ validateFn({ validator, modelValue, el, tipEl, isFormTag, messageShowType, updateOn: "submit" });
16602
17187
  });
16603
17188
  }
16604
17189
  };
@@ -18727,7 +19312,7 @@ const getRangeValueOf = (value, min, max) => {
18727
19312
  }
18728
19313
  return value;
18729
19314
  };
18730
- function _isSlot$3(s) {
19315
+ function _isSlot$4(s) {
18731
19316
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
18732
19317
  }
18733
19318
  var Dialog = defineComponent$1({
@@ -18792,7 +19377,7 @@ var Dialog = defineComponent$1({
18792
19377
  "variant": variant,
18793
19378
  "disabled": disabled,
18794
19379
  "onClick": handler
18795
- }, _isSlot$3(text) ? text : {
19380
+ }, _isSlot$4(text) ? text : {
18796
19381
  default: () => [text]
18797
19382
  });
18798
19383
  });
@@ -21043,7 +21628,7 @@ var Radio = defineComponent$1({
21043
21628
  }
21044
21629
  });
21045
21630
  var radioGroup = "";
21046
- function _isSlot$2(s) {
21631
+ function _isSlot$3(s) {
21047
21632
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
21048
21633
  }
21049
21634
  var RadioGroup = defineComponent$1({
@@ -21079,7 +21664,7 @@ var RadioGroup = defineComponent$1({
21079
21664
  return createVNode(Radio, {
21080
21665
  "key": item2,
21081
21666
  "value": item2
21082
- }, _isSlot$2(item2) ? item2 : {
21667
+ }, _isSlot$3(item2) ? item2 : {
21083
21668
  default: () => [item2]
21084
21669
  });
21085
21670
  });
@@ -23580,11 +24165,11 @@ const statisticProps = {
23580
24165
  },
23581
24166
  groupSeparator: {
23582
24167
  type: String,
23583
- default: ","
24168
+ default: ""
23584
24169
  },
23585
24170
  showGroupSeparator: {
23586
24171
  type: Boolean,
23587
- default: false
24172
+ default: true
23588
24173
  },
23589
24174
  titleStyle: {
23590
24175
  type: Object
@@ -27292,7 +27877,37 @@ var TooltipInstall = {
27292
27877
  app.use(DTooltip);
27293
27878
  }
27294
27879
  };
27295
- const transferBaseProps = {
27880
+ const transferCommon = {
27881
+ showTooltip: {
27882
+ type: Boolean,
27883
+ default: () => false
27884
+ },
27885
+ tooltipPosition: {
27886
+ type: String,
27887
+ default: () => "top"
27888
+ }
27889
+ };
27890
+ const transferDragFunctions = {
27891
+ onDragstart: {
27892
+ type: Function
27893
+ },
27894
+ onDrop: {
27895
+ type: Function
27896
+ },
27897
+ onDragleave: {
27898
+ type: Function
27899
+ },
27900
+ onDragover: {
27901
+ type: Function
27902
+ },
27903
+ onDragenter: {
27904
+ type: Function
27905
+ },
27906
+ onDragend: {
27907
+ type: Function
27908
+ }
27909
+ };
27910
+ const transferBaseProps = __spreadProps(__spreadValues(__spreadValues({}, transferCommon), transferDragFunctions), {
27296
27911
  sourceOption: {
27297
27912
  type: Array,
27298
27913
  default() {
@@ -27345,13 +27960,13 @@ const transferBaseProps = {
27345
27960
  type: Number,
27346
27961
  default: () => 0
27347
27962
  },
27348
- showTooltip: {
27963
+ isSourceDroppable: {
27349
27964
  type: Boolean,
27350
27965
  default: () => false
27351
27966
  },
27352
- tooltipPosition: {
27353
- type: String,
27354
- default: () => "top"
27967
+ isTargetDroppable: {
27968
+ type: Boolean,
27969
+ default: () => false
27355
27970
  },
27356
27971
  scopedSlots: {
27357
27972
  type: Object
@@ -27364,8 +27979,11 @@ const transferBaseProps = {
27364
27979
  },
27365
27980
  onUpdateCheckeds: {
27366
27981
  type: Function
27982
+ },
27983
+ onDragend: {
27984
+ type: Function
27367
27985
  }
27368
- };
27986
+ });
27369
27987
  const getFilterData = (props, type4) => {
27370
27988
  const newModel = [];
27371
27989
  const data = type4 === "source" ? props.sourceOption : props.targetOption;
@@ -27397,6 +28015,168 @@ const TransferBaseClass = (props) => {
27397
28015
  return `devui-transfer-panel devui-transfer-${props.type}`;
27398
28016
  });
27399
28017
  };
28018
+ const transferDragProps = __spreadProps(__spreadValues(__spreadValues({}, transferCommon), transferDragFunctions), {
28019
+ itemData: {
28020
+ type: Object
28021
+ },
28022
+ id: {
28023
+ type: Number,
28024
+ default: () => null
28025
+ }
28026
+ });
28027
+ const transferCheckboxProps = __spreadProps(__spreadValues({}, transferCommon), {
28028
+ data: {
28029
+ type: Object
28030
+ },
28031
+ id: {
28032
+ type: Number
28033
+ }
28034
+ });
28035
+ function _isSlot$2(s) {
28036
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
28037
+ }
28038
+ var DTransfeCheckbox = defineComponent$1({
28039
+ name: "DTransferCheckbox",
28040
+ components: {
28041
+ DCheckbox: Checkbox,
28042
+ DTooltip
28043
+ },
28044
+ props: transferCheckboxProps,
28045
+ setup(props) {
28046
+ const renderCheckbox = () => {
28047
+ return createVNode(Checkbox, {
28048
+ "label": props.data.key,
28049
+ "value": props.data.value,
28050
+ "disabled": props.data.disabled,
28051
+ "class": "devui-transfer-panel-body-list-item",
28052
+ "key": props.id
28053
+ }, null);
28054
+ };
28055
+ return () => {
28056
+ let _slot;
28057
+ return !props.showTooltip ? renderCheckbox() : createVNode(DTooltip, {
28058
+ "class": "devui-transfer-panel-body-list-tooltip",
28059
+ "position": props.tooltipPosition,
28060
+ "content": props.data.key
28061
+ }, _isSlot$2(_slot = renderCheckbox()) ? _slot : {
28062
+ default: () => [_slot]
28063
+ });
28064
+ };
28065
+ }
28066
+ });
28067
+ var devuiIcon = "";
28068
+ var DTransferDrag = defineComponent$1({
28069
+ name: "DTransferDrag",
28070
+ components: {
28071
+ DTransfeCheckbox
28072
+ },
28073
+ props: transferDragProps,
28074
+ setup(props) {
28075
+ const dragRef = ref(null);
28076
+ const dragHighlight = ref(false);
28077
+ const dragOverNodeKey = ref("");
28078
+ const dropPosition = ref(null);
28079
+ const dragTimer = ref(null);
28080
+ const calcDropPosition = (event) => {
28081
+ const {
28082
+ clientY
28083
+ } = event;
28084
+ const {
28085
+ top,
28086
+ bottom,
28087
+ height
28088
+ } = dragRef.value.getBoundingClientRect();
28089
+ const des = Math.max(height * 0.25, 2);
28090
+ if (clientY <= top + des) {
28091
+ return -1;
28092
+ }
28093
+ if (clientY >= bottom - des) {
28094
+ return 1;
28095
+ }
28096
+ return 0;
28097
+ };
28098
+ const resetState = () => {
28099
+ dragOverNodeKey.value = "";
28100
+ dropPosition.value = null;
28101
+ dragHighlight.value = null;
28102
+ };
28103
+ onUnmounted(() => {
28104
+ clearTimeout(dragTimer.value);
28105
+ });
28106
+ return () => {
28107
+ const state = dragOverNodeKey.value === props.itemData.key;
28108
+ return createVNode("div", {
28109
+ "class": {
28110
+ "devui-transfer-panel-body-list-item": true,
28111
+ "devui-transfer-drag-dragging": dragHighlight.value,
28112
+ "devui-transfer-drag-over": state && dropPosition.value === 0,
28113
+ "devui-transfer\u2013drag-over-top": state && dropPosition.value === -1,
28114
+ "devui-transfer\u2013drag-over-bottom": state && dropPosition.value === 1
28115
+ },
28116
+ "onDragenter": (event) => {
28117
+ event.preventDefault();
28118
+ event.stopPropagation();
28119
+ clearTimeout(dragTimer.value);
28120
+ const curDropPosition = calcDropPosition(event);
28121
+ if (props.itemData.key === dragOverNodeKey.value && curDropPosition === 0) {
28122
+ resetState();
28123
+ return;
28124
+ }
28125
+ dragTimer.value = setTimeout(() => {
28126
+ dragOverNodeKey.value = props.itemData.key;
28127
+ dropPosition.value = curDropPosition;
28128
+ }, 0);
28129
+ props.onDragenter && props.onDragenter(event, props.itemData);
28130
+ },
28131
+ "onDragover": (event) => {
28132
+ event.preventDefault();
28133
+ event.stopPropagation();
28134
+ if (props.itemData.key === dragOverNodeKey.value) {
28135
+ const curDropPosition = calcDropPosition(event);
28136
+ if (curDropPosition === dropPosition.value) {
28137
+ return;
28138
+ }
28139
+ dropPosition.value = curDropPosition;
28140
+ }
28141
+ props.onDragover && props.onDragover(event, props.itemData);
28142
+ },
28143
+ "onDragleave": (event) => {
28144
+ event.stopPropagation();
28145
+ resetState();
28146
+ props.onDragleave && props.onDragleave(event, props.itemData);
28147
+ },
28148
+ "onDrop": (event) => {
28149
+ event.preventDefault();
28150
+ event.stopPropagation();
28151
+ resetState();
28152
+ props.onDrop && props.onDrop(event, props.itemData);
28153
+ },
28154
+ "onDragend": (event) => {
28155
+ event.stopPropagation();
28156
+ props.onDragend && props.onDragend(event, props.itemData);
28157
+ }
28158
+ }, [createVNode("div", {
28159
+ "class": "devui-transfer-panel-body-list-drag",
28160
+ "draggable": true,
28161
+ "ref": dragRef,
28162
+ "onDragstart": (event) => {
28163
+ event.stopPropagation();
28164
+ dragHighlight.value = true;
28165
+ props.onDragstart && props.onDragstart(event, props.itemData);
28166
+ }
28167
+ }, [createVNode("span", {
28168
+ "class": "devui-transfer-panel-body-list-drag__icon"
28169
+ }, [createVNode(resolveComponent("d-icon"), {
28170
+ "name": "drag-small"
28171
+ }, null)]), createVNode(DTransfeCheckbox, {
28172
+ "data": props.itemData,
28173
+ "id": props.id,
28174
+ "showTooltip": props.showTooltip,
28175
+ "tooltipPosition": props.tooltipPosition
28176
+ }, null)])]);
28177
+ };
28178
+ }
28179
+ });
27400
28180
  function _isSlot$1(s) {
27401
28181
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
27402
28182
  }
@@ -27406,54 +28186,98 @@ var DTransferBase = defineComponent$1({
27406
28186
  DSearch,
27407
28187
  DCheckboxGroup,
27408
28188
  DCheckbox: Checkbox,
27409
- DTooltip
28189
+ DTransferDrag,
28190
+ DTransfeCheckbox
27410
28191
  },
27411
28192
  props: transferBaseProps,
27412
28193
  setup(props, ctx2) {
28194
+ const allHalfchecked = ref(false);
27413
28195
  const modelValues = computed(() => props.checkedValues);
28196
+ const dragWrapClass = computed(() => {
28197
+ const isDrag = props.isSourceDroppable || props.isTargetDroppable;
28198
+ return `devui-transfer-panel-body-list devui-transfer-panel-body-${isDrag ? "" : "no"}drag`;
28199
+ });
27414
28200
  const searchQuery = computed(() => props.filter);
27415
28201
  const baseClass = TransferBaseClass(props);
28202
+ const dropItem = ref(null);
28203
+ watch(() => props.checkedNum, (nVal) => {
28204
+ if (props.allChecked) {
28205
+ allHalfchecked.value = !props.allChecked;
28206
+ } else {
28207
+ allHalfchecked.value = nVal !== 0;
28208
+ }
28209
+ }, {
28210
+ immediate: true
28211
+ });
27416
28212
  const updateSearchQuery = (val) => ctx2.emit("changeQuery", val);
27417
- const renderCheckbox = (props2, key, showTooltip = false, tooltipPosition = "top") => {
27418
- const checkbox2 = createVNode(Checkbox, {
27419
- "class": "devui-transfer-panel-body-list-item",
27420
- "label": props2.key,
27421
- "value": props2.value,
27422
- "disabled": props2.disabled,
27423
- "key": key
27424
- }, null);
27425
- return !showTooltip ? checkbox2 : createVNode(DTooltip, {
27426
- "position": tooltipPosition,
27427
- "content": props2.key
27428
- }, _isSlot$1(checkbox2) ? checkbox2 : {
27429
- default: () => [checkbox2]
28213
+ const renderCheckboxGroup = () => {
28214
+ let _slot;
28215
+ return createVNode(DCheckboxGroup, {
28216
+ "modelValue": modelValues.value,
28217
+ "onChange": (values) => ctx2.emit("updateCheckeds", values)
28218
+ }, _isSlot$1(_slot = props.sourceOption.map((item2, idx) => {
28219
+ return createVNode(DTransfeCheckbox, {
28220
+ "data": item2,
28221
+ "id": idx,
28222
+ "showTooltip": props.showTooltip,
28223
+ "tooltipPosition": props.tooltipPosition
28224
+ }, null);
28225
+ })) ? _slot : {
28226
+ default: () => [_slot]
28227
+ });
28228
+ };
28229
+ const renderDragCheckboxGroup = () => {
28230
+ let _slot2;
28231
+ return createVNode(DCheckboxGroup, {
28232
+ "modelValue": modelValues.value,
28233
+ "onChange": (values) => ctx2.emit("updateCheckeds", values)
28234
+ }, _isSlot$1(_slot2 = props.sourceOption.map((item2, idx) => {
28235
+ return createVNode(DTransferDrag, {
28236
+ "itemData": item2,
28237
+ "id": idx,
28238
+ "showTooltip": props.showTooltip,
28239
+ "tooltipPosition": props.tooltipPosition,
28240
+ "onDrop": (event, item3) => {
28241
+ dropItem.value = item3;
28242
+ },
28243
+ "onDragend": (event, dragItem) => {
28244
+ props.onDragend && props.onDragend(dragItem, dropItem.value);
28245
+ }
28246
+ }, null);
28247
+ })) ? _slot2 : {
28248
+ default: () => [_slot2]
27430
28249
  });
27431
28250
  };
27432
28251
  return {
27433
28252
  baseClass,
27434
28253
  searchQuery,
28254
+ dragWrapClass,
27435
28255
  modelValues,
28256
+ dropItem,
28257
+ allHalfchecked,
27436
28258
  updateSearchQuery,
27437
- renderCheckbox
28259
+ renderCheckboxGroup,
28260
+ renderDragCheckboxGroup
27438
28261
  };
27439
28262
  },
27440
28263
  render() {
27441
- let _slot;
27442
28264
  const {
27443
28265
  title,
27444
28266
  baseClass,
27445
28267
  checkedNum,
27446
28268
  allChecked,
28269
+ allHalfchecked,
27447
28270
  sourceOption,
27448
28271
  allCount,
27449
28272
  updateSearchQuery,
27450
28273
  search: search2,
27451
28274
  searchQuery,
27452
- modelValues,
28275
+ dragWrapClass,
27453
28276
  height,
27454
- showTooltip,
27455
- tooltipPosition,
27456
- renderCheckbox
28277
+ isSourceDroppable,
28278
+ isTargetDroppable,
28279
+ renderCheckboxGroup,
28280
+ renderDragCheckboxGroup
27457
28281
  } = this;
27458
28282
  return createVNode("div", {
27459
28283
  "class": baseClass
@@ -27462,8 +28286,11 @@ var DTransferBase = defineComponent$1({
27462
28286
  }, [createVNode("div", {
27463
28287
  "class": "devui-transfer-panel-header-allChecked"
27464
28288
  }, [createVNode(Checkbox, {
28289
+ "halfchecked": allHalfchecked,
27465
28290
  "modelValue": allChecked,
27466
- "onChange": (value) => this.$emit("changeAllSource", value)
28291
+ "onChange": (value) => {
28292
+ this.$emit("changeAllSource", value);
28293
+ }
27467
28294
  }, _isSlot$1(title) ? title : {
27468
28295
  default: () => [title]
27469
28296
  })]), createVNode("div", {
@@ -27476,18 +28303,11 @@ var DTransferBase = defineComponent$1({
27476
28303
  "modelValue": searchQuery,
27477
28304
  "onUpdate:modelValue": updateSearchQuery
27478
28305
  }, null)]), createVNode("div", {
27479
- "class": "devui-transfer-panel-body-list",
28306
+ "class": dragWrapClass,
27480
28307
  "style": {
27481
28308
  height
27482
28309
  }
27483
- }, [sourceOption.length ? createVNode(DCheckboxGroup, {
27484
- "modelValue": modelValues,
27485
- "onChange": (values) => this.$emit("updateCheckeds", values)
27486
- }, _isSlot$1(_slot = sourceOption.map((item2, idx) => {
27487
- return renderCheckbox(item2, idx, showTooltip, tooltipPosition);
27488
- })) ? _slot : {
27489
- default: () => [_slot]
27490
- }) : createVNode("div", {
28310
+ }, [sourceOption.length ? isSourceDroppable || isTargetDroppable ? renderDragCheckboxGroup() : renderCheckboxGroup() : createVNode("div", {
27491
28311
  "class": "devui-transfer-panel-body-list-empty"
27492
28312
  }, [createTextVNode("\u65E0\u6570\u636E")])])])]);
27493
28313
  }
@@ -27544,7 +28364,7 @@ var DTransferOperation = defineComponent$1({
27544
28364
  };
27545
28365
  }
27546
28366
  });
27547
- const transferProps = {
28367
+ const transferProps = __spreadProps(__spreadValues({}, transferCommon), {
27548
28368
  sourceOption: {
27549
28369
  type: Array,
27550
28370
  require: true,
@@ -27587,14 +28407,6 @@ const transferProps = {
27587
28407
  type: Boolean,
27588
28408
  default: () => false
27589
28409
  },
27590
- showTooltip: {
27591
- type: Boolean,
27592
- default: () => false
27593
- },
27594
- tooltipPosition: {
27595
- type: String,
27596
- default: () => "top"
27597
- },
27598
28410
  beforeTransfer: {
27599
28411
  type: Function
27600
28412
  },
@@ -27615,8 +28427,11 @@ const transferProps = {
27615
28427
  },
27616
28428
  afterTransfer: {
27617
28429
  type: Function
28430
+ },
28431
+ onDragend: {
28432
+ type: Function
27618
28433
  }
27619
- };
28434
+ });
27620
28435
  const headerSlot = (ctx2, name) => {
27621
28436
  return !ctx2.slots[`${name}-header`] ? null : () => ctx2.slots[`${name}-header`] && ctx2.slots[`${name}-header`]();
27622
28437
  };
@@ -27645,7 +28460,7 @@ var Transfer = defineComponent$1({
27645
28460
  watch(() => props.targetOption, () => {
27646
28461
  rightOptions = reactive(initState(props, "target"));
27647
28462
  });
27648
- watch(() => leftOptions.keyword, (nVal) => {
28463
+ watch(() => leftOptions.keyword, () => {
27649
28464
  searchFilterData(leftOptions);
27650
28465
  });
27651
28466
  watch(() => leftOptions.checkedValues, (values) => {
@@ -27654,7 +28469,7 @@ var Transfer = defineComponent$1({
27654
28469
  }, {
27655
28470
  deep: true
27656
28471
  });
27657
- watch(() => rightOptions.keyword, (nVal) => {
28472
+ watch(() => rightOptions.keyword, () => {
27658
28473
  searchFilterData(rightOptions);
27659
28474
  });
27660
28475
  watch(() => rightOptions.checkedValues, (values) => {
@@ -27738,6 +28553,13 @@ var Transfer = defineComponent$1({
27738
28553
  const isFunction2 = (type4) => {
27739
28554
  return props[type4] && typeof props[type4] === "function";
27740
28555
  };
28556
+ const dataSort = (target, dragItem, dropItem, direction) => {
28557
+ const startIndex = target.filterData.findIndex((item2) => item2.key === dragItem.key);
28558
+ const endIndex = target.filterData.findIndex((item2) => item2.key === dropItem.key);
28559
+ target.filterData.splice(endIndex, 1, dragItem);
28560
+ target.filterData.splice(startIndex, 1, dropItem);
28561
+ props.onDragend && props.onDragend(direction, dragItem, dropItem);
28562
+ };
27741
28563
  return () => {
27742
28564
  return createVNode("div", {
27743
28565
  "class": "devui-transfer"
@@ -27754,9 +28576,11 @@ var Transfer = defineComponent$1({
27754
28576
  "allCount": leftOptions.data.length,
27755
28577
  "showTooltip": props.showTooltip,
27756
28578
  "tooltipPosition": props.tooltipPosition,
28579
+ "isSourceDroppable": props.isSourceDroppable,
27757
28580
  "onChangeAllSource": (value) => changeAllSource(leftOptions, value),
27758
28581
  "onUpdateCheckeds": updateLeftCheckeds,
27759
- "onChangeQuery": (value) => changeQueryHandle(leftOptions, "left", value)
28582
+ "onChangeQuery": (value) => changeQueryHandle(leftOptions, "left", value),
28583
+ "onDragend": (dragItem, dropItem) => dataSort(leftOptions, dragItem, dropItem, "left")
27760
28584
  }, {
27761
28585
  header: headerSlot(ctx2, "left"),
27762
28586
  body: bodySlot(ctx2, "left")
@@ -27785,9 +28609,11 @@ var Transfer = defineComponent$1({
27785
28609
  "allCount": rightOptions.data.length,
27786
28610
  "showTooltip": props.showTooltip,
27787
28611
  "tooltipPosition": props.tooltipPosition,
28612
+ "isTargetDroppable": props.isTargetDroppable,
27788
28613
  "onChangeAllSource": (value) => changeAllSource(rightOptions, value),
27789
28614
  "onUpdateCheckeds": updateRightCheckeds,
27790
- "onChangeQuery": (value) => changeQueryHandle(rightOptions, "right", value)
28615
+ "onChangeQuery": (value) => changeQueryHandle(rightOptions, "right", value),
28616
+ "onDragend": (dragItem, dropItem) => dataSort(rightOptions, dragItem, dropItem, "right")
27791
28617
  }, {
27792
28618
  header: headerSlot(ctx2, "right"),
27793
28619
  body: bodySlot(ctx2, "right")
@@ -27801,7 +28627,7 @@ Transfer.install = function(app) {
27801
28627
  var TransferInstall = {
27802
28628
  title: "Transfer \u7A7F\u68AD\u6846",
27803
28629
  category: "\u6570\u636E\u5F55\u5165",
27804
- status: "10%",
28630
+ status: "40%",
27805
28631
  install(app) {
27806
28632
  app.use(Transfer);
27807
28633
  }
@@ -28290,13 +29116,14 @@ var Tree = defineComponent$1({
28290
29116
  }
28291
29117
  return toggle(target, item3);
28292
29118
  };
28293
- return isParent || children && children.length ? open ? createVNode(IconOpen$1, {
28294
- "class": "mr-xs",
29119
+ return createVNode("div", {
29120
+ "class": "devui-tree-node__folder",
28295
29121
  "onClick": handleClick
29122
+ }, [isParent || children && children.length ? open ? createVNode(IconOpen$1, {
29123
+ "class": "mr-xs"
28296
29124
  }, null) : createVNode(IconClose$1, {
28297
- "class": "mr-xs",
28298
- "onClick": handleClick
28299
- }, null) : createVNode(Indent, null, null);
29125
+ "class": "mr-xs"
29126
+ }, null) : createVNode(Indent, null, null)]);
28300
29127
  };
28301
29128
  const checkState = CHECK_CONFIG[(_a = selected.value[id]) != null ? _a : "none"];
28302
29129
  return createVNode("div", {
@@ -28375,6 +29202,10 @@ const treeSelectProps = {
28375
29202
  type: Boolean,
28376
29203
  default: false
28377
29204
  },
29205
+ enableLabelization: {
29206
+ type: Boolean,
29207
+ default: false
29208
+ },
28378
29209
  onToggleChange: {
28379
29210
  type: Function,
28380
29211
  default: void 0
@@ -28384,10 +29215,12 @@ const treeSelectProps = {
28384
29215
  default: void 0
28385
29216
  }
28386
29217
  };
29218
+ const nodeMap = new Map();
28387
29219
  function attributeExtension(data) {
28388
29220
  data.forEach((el) => {
28389
29221
  let level = 1;
28390
29222
  el.level = level;
29223
+ nodeMap.set(el.label, el);
28391
29224
  const nodeQueue = [];
28392
29225
  nodeQueue.push(el);
28393
29226
  while (nodeQueue.length !== 0) {
@@ -28396,6 +29229,7 @@ function attributeExtension(data) {
28396
29229
  node.children.forEach((el2) => {
28397
29230
  el2.level = level + 1;
28398
29231
  el2.parent = node;
29232
+ nodeMap.set(el2.label, el2);
28399
29233
  nodeQueue.push(el2);
28400
29234
  });
28401
29235
  }
@@ -28432,7 +29266,7 @@ function useToggle(props) {
28432
29266
  };
28433
29267
  }
28434
29268
  function useSelect(props) {
28435
- const inputValue = ref("");
29269
+ const inputValue = ref([]);
28436
29270
  const selectedCache = new Set();
28437
29271
  const selectValue = (item2) => {
28438
29272
  if (!props.multiple) {
@@ -28444,7 +29278,7 @@ function useSelect(props) {
28444
29278
  useCache(item2);
28445
29279
  searchUp(item2);
28446
29280
  searchDown(item2);
28447
- inputValue.value = [...selectedCache].toString();
29281
+ inputValue.value = [...selectedCache];
28448
29282
  }
28449
29283
  };
28450
29284
  const useCache = (item2) => {
@@ -28495,27 +29329,43 @@ function useSelect(props) {
28495
29329
  }
28496
29330
  function useClear(props, ctx2, data) {
28497
29331
  const isClearable = computed(() => {
28498
- return !props.disabled && props.allowClear && data.value.length > 0;
29332
+ return !props.disabled && props.allowClear;
28499
29333
  });
28500
- const handleClear = (e) => {
29334
+ const handleClearAll = (e) => {
28501
29335
  e.preventDefault();
28502
29336
  e.stopPropagation();
28503
29337
  if (props.multiple) {
28504
29338
  ctx2.emit("update:modelValue", []);
29339
+ data.value = [];
28505
29340
  } else {
28506
29341
  ctx2.emit("update:modelValue", "");
28507
29342
  data.value = "";
28508
29343
  }
28509
29344
  };
29345
+ const handleClearItem = (e, item2) => {
29346
+ e.preventDefault();
29347
+ e.stopPropagation();
29348
+ if (props.multiple) {
29349
+ data.value.splice(data.value.indexOf(item2), 1);
29350
+ ctx2.emit("update:modelValue", data.value);
29351
+ } else {
29352
+ ctx2.emit("update:modelValue", []);
29353
+ data.value = [];
29354
+ }
29355
+ };
28510
29356
  return {
28511
29357
  isClearable,
28512
- handleClear
29358
+ handleClearAll,
29359
+ handleClearItem
28513
29360
  };
28514
29361
  }
28515
29362
  var IconOpen = "data:image/svg+xml;base64,PHN2ZwogIHdpZHRoPSIxNnB4IgogIGhlaWdodD0iMTZweCIKICB2aWV3Qm94PSIwIDAgMTYgMTYiCiAgdmVyc2lvbj0iMS4xIgogIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIKICBjbGFzcz0ic3ZnLWljb24gc3ZnLWljb24tY2xvc2UiCj4KICA8ZyBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICA8cmVjdCB4PSIwLjUiIHk9IjAuNSIgd2lkdGg9IjE1IiBoZWlnaHQ9IjE1IiByeD0iMiIgc3Ryb2tlPSIjNWU3Y2UwIj48L3JlY3Q+CiAgICA8cmVjdCB4PSI0IiB5PSI3IiB3aWR0aD0iOCIgaGVpZ2h0PSIyIiBmaWxsPSIjNWU3Y2UwIj48L3JlY3Q+CiAgPC9nPgo8L3N2Zz4=";
28516
29363
  var IconClose = "data:image/svg+xml;base64,PHN2ZwogIHdpZHRoPSIxNnB4IgogIGhlaWdodD0iMTZweCIKICB2aWV3Qm94PSIwIDAgMTYgMTYiCiAgdmVyc2lvbj0iMS4xIgogIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIKICBjbGFzcz0ic3ZnLWljb24iCj4KICA8ZyBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgIDxyZWN0IHg9IjAuNSIgeT0iMC41IiB3aWR0aD0iMTUiIGhlaWdodD0iMTUiIHJ4PSIyIiBzdHJva2U9IiMyNTJiM2EiPjwvcmVjdD4KICAgIDxwYXRoCiAgICAgIGZpbGw9IiMyNTJiM2EiCiAgICAgIGQ9Ik04Ljc1LDQgTDguNzUsNy4yNSBMMTIsNy4yNSBMMTIsOC43NSBMOC43NDksOC43NSBMOC43NSwxMiBMNy4yNSwxMiBMNy4yNDksOC43NSBMNCw4Ljc1IEw0LDcuMjUgTDcuMjUsNy4yNSBMNy4yNSw0IEw4Ljc1LDQgWiIKICAgID48L3BhdGg+CiAgPC9nPgo8L3N2Zz4K";
28517
29364
  var TreeSelect = defineComponent$1({
28518
29365
  name: "DTreeSelect",
29366
+ directives: {
29367
+ ClickOutside: clickoutsideDirective
29368
+ },
28519
29369
  props: treeSelectProps,
28520
29370
  emits: ["toggleChange", "valueChange", "update:modelValue"],
28521
29371
  setup(props, ctx2) {
@@ -28524,8 +29374,9 @@ var TreeSelect = defineComponent$1({
28524
29374
  placeholder,
28525
29375
  disabled,
28526
29376
  multiple,
28527
- leafOnly
28528
- } = props;
29377
+ leafOnly,
29378
+ enableLabelization
29379
+ } = toRefs(props);
28529
29380
  const {
28530
29381
  visible,
28531
29382
  selectToggle,
@@ -28537,22 +29388,30 @@ var TreeSelect = defineComponent$1({
28537
29388
  } = useSelect(props);
28538
29389
  const {
28539
29390
  isClearable,
28540
- handleClear
29391
+ handleClearAll,
29392
+ handleClearItem
28541
29393
  } = useClear(props, ctx2, inputValue);
28542
29394
  const clickNode = (item2) => {
28543
- if (!leafOnly) {
29395
+ if (!leafOnly.value) {
28544
29396
  selectValue(item2);
28545
- !multiple && selectToggle(item2);
29397
+ !multiple.value && selectToggle(item2);
28546
29398
  } else {
28547
29399
  if (!item2.children) {
28548
29400
  selectValue(item2);
28549
- !multiple && selectToggle(item2);
29401
+ !multiple.value && selectToggle(item2);
28550
29402
  }
28551
29403
  }
28552
29404
  };
29405
+ const deleteNode2 = (e, item2) => {
29406
+ handleClearItem(e, item2);
29407
+ selectValue(nodeMap.get(item2));
29408
+ };
28553
29409
  const treeSelectCls = className("devui-tree-select", {
28554
29410
  "devui-tree-select-open": visible.value,
28555
- "devui-tree-select-disabled": disabled
29411
+ "devui-tree-select-disabled": disabled.value
29412
+ });
29413
+ const treeSelectInputItem = className("devui-tree-select-value", {
29414
+ "devui-tree-select-value-enableLabelization": enableLabelization.value
28556
29415
  });
28557
29416
  const renderNode = (item2) => createVNode("div", {
28558
29417
  "class": "devui-tree-select-item",
@@ -28566,7 +29425,9 @@ var TreeSelect = defineComponent$1({
28566
29425
  }, null) : createVNode(IconClose, {
28567
29426
  "class": "mr-xs",
28568
29427
  "onClick": (e) => treeToggle(e, item2)
28569
- }, null) : createVNode("span", null, ["\xA0\xA0\xA0"]), multiple ? item2.halfchecked ? createVNode(Checkbox, {
29428
+ }, null) : createVNode("span", null, ["\xA0\xA0\xA0"]), ctx2.slots.default ? ctx2.slots.default({
29429
+ item: item2
29430
+ }) : multiple.value ? item2.halfchecked ? createVNode(Checkbox, {
28570
29431
  "label": item2.label,
28571
29432
  "halfchecked": item2.halfchecked
28572
29433
  }, null) : createVNode(Checkbox, {
@@ -28582,20 +29443,26 @@ var TreeSelect = defineComponent$1({
28582
29443
  });
28583
29444
  };
28584
29445
  return () => {
28585
- return createVNode("div", {
29446
+ return withDirectives(createVNode("div", {
28586
29447
  "class": treeSelectCls
28587
29448
  }, [createVNode("div", {
28588
29449
  "class": isClearable.value ? "devui-tree-select-clearable" : "devui-tree-select-notclearable",
28589
29450
  "onClick": () => selectToggle()
28590
- }, [createVNode("input", {
28591
- "value": inputValue.value,
28592
- "type": "text",
29451
+ }, [createVNode("div", {
28593
29452
  "class": "devui-tree-select-input",
28594
- "placeholder": placeholder,
28595
- "readonly": true,
28596
- "disabled": disabled
28597
- }, null), createVNode("span", {
28598
- "onClick": (e) => handleClear(e),
29453
+ "placeholder": placeholder.value
29454
+ }, [multiple.value ? inputValue.value.map((item2) => createVNode("div", {
29455
+ "class": treeSelectInputItem
29456
+ }, [item2, enableLabelization.value ? createVNode(resolveComponent("d-icon"), {
29457
+ "name": "close",
29458
+ "onClick": (e) => deleteNode2(e, item2)
29459
+ }, null) : createVNode("span", null, [createTextVNode(",")])])) : !Array.isArray(inputValue.value) && createVNode("div", {
29460
+ "class": treeSelectInputItem
29461
+ }, [inputValue.value, enableLabelization.value && createVNode(resolveComponent("d-icon"), {
29462
+ "name": "close",
29463
+ "onClick": (e) => handleClearItem(e)
29464
+ }, null)])]), createVNode("span", {
29465
+ "onClick": (e) => handleClearAll(e),
28599
29466
  "class": "devui-tree-select-clear"
28600
29467
  }, [createVNode(resolveComponent("d-icon"), {
28601
29468
  "name": "close"
@@ -28611,8 +29478,8 @@ var TreeSelect = defineComponent$1({
28611
29478
  "class": "devui-tree-select-dropdown"
28612
29479
  }, [createVNode("ul", {
28613
29480
  "class": "devui-tree-select-dropdown-list"
28614
- }, [renderTree(attributeExtension(treeData))])]), [[vShow, visible.value]])]
28615
- })]);
29481
+ }, [renderTree(attributeExtension(treeData.value))])]), [[vShow, visible.value]])]
29482
+ })]), [[resolveDirective("click-outside"), () => visible.value = false]]);
28616
29483
  };
28617
29484
  }
28618
29485
  });
@@ -29410,6 +30277,7 @@ const installs = [
29410
30277
  AccordionInstall,
29411
30278
  AlertInstall,
29412
30279
  AnchorInstall,
30280
+ AutoCompleteInstall,
29413
30281
  AvatarInstall,
29414
30282
  BackTopInstall,
29415
30283
  BadgeInstall,
@@ -29481,4 +30349,4 @@ var vueDevui = {
29481
30349
  installs.forEach((p) => app.use(p));
29482
30350
  }
29483
30351
  };
29484
- export { Accordion, Alert, Anchor, Aside, Avatar, BackTop, Badge, Breadcrumb, DButton as Button, Card, Carousel, Cascader, Checkbox, Col, ColorPicker, Column, Comment, Content, Countdown, DatePicker, DraggableDirective, Drawer, DrawerService, Dropdown, DroppableDirective, EditableSelect, FixedOverlay, FlexibleOverlay, Footer, Form, FormControl, FormItem, FormLabel, FormOperation, Fullscreen, Gantt, Header, Icon, ImagePreviewDirective, ImagePreviewService, DInput as Input, InputIcon, InputNumber, Layout, loadingDirective as Loading, loading as LoadingService, Modal, NavSprite, Pagination, Panel, Popover, Progress, QuadrantDiagram, Radio, RadioGroup, Rate, ReadTip, Result, RippleDirective, Row, DSearch as Search, Select, Skeleton, SkeletonItem, Slider, SortableDirective, Splitter, Statistic, Status, StepsGuide, StickSlider, Sticky, Switch, Table, Tabs, Tag, TagInput, Textarea, TimeAxis, TimeAxisItem, TimePicker, Toast, ToastService, DTooltip as Tooltip, Transfer, Tree, TreeSelect, Upload, vueDevui as default };
30352
+ export { Accordion, Alert, Anchor, Aside, AutoComplete, Avatar, BackTop, Badge, Breadcrumb, DButton as Button, Card, Carousel, Cascader, Checkbox, Col, ColorPicker, Column, Comment, Content, Countdown, DatePicker, DraggableDirective, Drawer, DrawerService, Dropdown, DroppableDirective, EditableSelect, FixedOverlay, FlexibleOverlay, Footer, Form, FormControl, FormItem, FormLabel, FormOperation, Fullscreen, Gantt, Header, Icon, ImagePreviewDirective, ImagePreviewService, DInput as Input, InputIcon, InputNumber, Layout, loadingDirective as Loading, loading as LoadingService, Modal, NavSprite, Pagination, Panel, Popover, Progress, QuadrantDiagram, Radio, RadioGroup, Rate, ReadTip, Result, RippleDirective, Row, DSearch as Search, Select, Skeleton, SkeletonItem, Slider, SortableDirective, Splitter, Statistic, Status, StepsGuide, StickSlider, Sticky, Switch, Table, Tabs, Tag, TagInput, Textarea, TimeAxis, TimeAxisItem, TimePicker, Toast, ToastService, DTooltip as Tooltip, Transfer, Tree, TreeSelect, Upload, vueDevui as default };