vue-devui 1.0.0-beta.8 → 1.0.0-beta.9

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
@@ -6518,6 +6518,10 @@ var DropdownInstall = {
6518
6518
  }
6519
6519
  };
6520
6520
  const editableSelectProps = {
6521
+ appendToBody: {
6522
+ type: Boolean,
6523
+ default: false
6524
+ },
6521
6525
  modelValue: {
6522
6526
  type: [String, Number]
6523
6527
  },
@@ -6526,7 +6530,8 @@ const editableSelectProps = {
6526
6530
  default: () => []
6527
6531
  },
6528
6532
  width: {
6529
- type: Number
6533
+ type: Number,
6534
+ default: 450
6530
6535
  },
6531
6536
  maxHeight: {
6532
6537
  type: Number
@@ -6557,8 +6562,76 @@ const editableSelectProps = {
6557
6562
  },
6558
6563
  searchFn: {
6559
6564
  type: Function
6565
+ },
6566
+ loadMore: {
6567
+ type: Function
6560
6568
  }
6561
6569
  };
6570
+ const selectDropdownProps = {
6571
+ options: {
6572
+ type: Array,
6573
+ default: () => []
6574
+ }
6575
+ };
6576
+ function className$2(classStr, classOpt) {
6577
+ let classname = classStr;
6578
+ if (typeof classOpt === "object") {
6579
+ Object.keys(classOpt).forEach((key) => {
6580
+ classOpt[key] && (classname += ` ${key}`);
6581
+ });
6582
+ }
6583
+ return classname;
6584
+ }
6585
+ var SelectDropdown = defineComponent$1({
6586
+ name: "DSelectDropdown",
6587
+ props: selectDropdownProps,
6588
+ setup(props) {
6589
+ const select2 = inject("InjectionKey");
6590
+ const {
6591
+ props: selectProps2,
6592
+ dropdownRef,
6593
+ visible,
6594
+ selectOptionClick,
6595
+ renderDefaultSlots,
6596
+ renderEmptySlots,
6597
+ selectedIndex,
6598
+ loadMore
6599
+ } = select2;
6600
+ const {
6601
+ maxHeight
6602
+ } = selectProps2;
6603
+ return () => {
6604
+ const getLiCls = (item2, index2) => {
6605
+ const {
6606
+ disabledKey
6607
+ } = selectProps2;
6608
+ return className$2("devui-dropdown-item", {
6609
+ disabled: disabledKey ? !!item2[disabledKey] : false,
6610
+ selected: selectedIndex.value === index2
6611
+ });
6612
+ };
6613
+ return withDirectives(createVNode("div", {
6614
+ "class": "devui-dropdown-menu"
6615
+ }, [createVNode("ul", {
6616
+ "ref": dropdownRef,
6617
+ "class": "devui-list-unstyled scroll-height",
6618
+ "style": {
6619
+ maxHeight: maxHeight + "px"
6620
+ },
6621
+ "onScroll": loadMore
6622
+ }, [props.options.map((o, index2) => {
6623
+ return createVNode("li", {
6624
+ "class": getLiCls(o, index2),
6625
+ "onClick": ($evnet) => selectOptionClick($evnet, o)
6626
+ }, [renderDefaultSlots(o)]);
6627
+ }), withDirectives(createVNode("li", {
6628
+ "class": "devui-no-result-template"
6629
+ }, [createVNode("div", {
6630
+ "class": "devui-no-data-tip"
6631
+ }, [renderEmptySlots()])]), [[vShow, props.options.length === 0]])])]), [[vShow, visible]]);
6632
+ };
6633
+ }
6634
+ });
6562
6635
  var editableSelect = "";
6563
6636
  function on(element, eventName, handler) {
6564
6637
  if (document.addEventListener) {
@@ -6625,15 +6698,6 @@ const clickoutsideDirective = {
6625
6698
  delete el[ctx];
6626
6699
  }
6627
6700
  };
6628
- function className$2(classStr, classOpt) {
6629
- let classname = classStr;
6630
- if (typeof classOpt === "object") {
6631
- Object.keys(classOpt).forEach((key) => {
6632
- classOpt[key] && (classname += ` ${key}`);
6633
- });
6634
- }
6635
- return classname;
6636
- }
6637
6701
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
6638
6702
  var lodash = { exports: {} };
6639
6703
  /**
@@ -9880,8 +9944,8 @@ var lodash = { exports: {} };
9880
9944
  }
9881
9945
  return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined$1, comparator) : [];
9882
9946
  });
9883
- function join(array4, separator) {
9884
- return array4 == null ? "" : nativeJoin.call(array4, separator);
9947
+ function join(array4, separator2) {
9948
+ return array4 == null ? "" : nativeJoin.call(array4, separator2);
9885
9949
  }
9886
9950
  function last2(array4) {
9887
9951
  var length = array4 == null ? 0 : array4.length;
@@ -11189,22 +11253,22 @@ var lodash = { exports: {} };
11189
11253
  var snakeCase = createCompounder(function(result3, word, index2) {
11190
11254
  return result3 + (index2 ? "_" : "") + word.toLowerCase();
11191
11255
  });
11192
- function split(string3, separator, limit) {
11193
- if (limit && typeof limit != "number" && isIterateeCall2(string3, separator, limit)) {
11194
- separator = limit = undefined$1;
11256
+ function split(string3, separator2, limit) {
11257
+ if (limit && typeof limit != "number" && isIterateeCall2(string3, separator2, limit)) {
11258
+ separator2 = limit = undefined$1;
11195
11259
  }
11196
11260
  limit = limit === undefined$1 ? MAX_ARRAY_LENGTH : limit >>> 0;
11197
11261
  if (!limit) {
11198
11262
  return [];
11199
11263
  }
11200
11264
  string3 = toString2(string3);
11201
- if (string3 && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
11202
- separator = baseToString2(separator);
11203
- if (!separator && hasUnicode(string3)) {
11265
+ if (string3 && (typeof separator2 == "string" || separator2 != null && !isRegExp(separator2))) {
11266
+ separator2 = baseToString2(separator2);
11267
+ if (!separator2 && hasUnicode(string3)) {
11204
11268
  return castSlice(stringToArray(string3), 0, limit);
11205
11269
  }
11206
11270
  }
11207
- return string3.split(separator, limit);
11271
+ return string3.split(separator2, limit);
11208
11272
  }
11209
11273
  var startCase = createCompounder(function(result3, word, index2) {
11210
11274
  return result3 + (index2 ? " " : "") + upperFirst(word);
@@ -11303,7 +11367,7 @@ var lodash = { exports: {} };
11303
11367
  function truncate(string3, options) {
11304
11368
  var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
11305
11369
  if (isObject2(options)) {
11306
- var separator = "separator" in options ? options.separator : separator;
11370
+ var separator2 = "separator" in options ? options.separator : separator2;
11307
11371
  length = "length" in options ? toInteger(options.length) : length;
11308
11372
  omission = "omission" in options ? baseToString2(options.omission) : omission;
11309
11373
  }
@@ -11321,26 +11385,26 @@ var lodash = { exports: {} };
11321
11385
  return omission;
11322
11386
  }
11323
11387
  var result3 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string3.slice(0, end);
11324
- if (separator === undefined$1) {
11388
+ if (separator2 === undefined$1) {
11325
11389
  return result3 + omission;
11326
11390
  }
11327
11391
  if (strSymbols) {
11328
11392
  end += result3.length - end;
11329
11393
  }
11330
- if (isRegExp(separator)) {
11331
- if (string3.slice(end).search(separator)) {
11394
+ if (isRegExp(separator2)) {
11395
+ if (string3.slice(end).search(separator2)) {
11332
11396
  var match, substring = result3;
11333
- if (!separator.global) {
11334
- separator = RegExp2(separator.source, toString2(reFlags2.exec(separator)) + "g");
11397
+ if (!separator2.global) {
11398
+ separator2 = RegExp2(separator2.source, toString2(reFlags2.exec(separator2)) + "g");
11335
11399
  }
11336
- separator.lastIndex = 0;
11337
- while (match = separator.exec(substring)) {
11400
+ separator2.lastIndex = 0;
11401
+ while (match = separator2.exec(substring)) {
11338
11402
  var newEnd = match.index;
11339
11403
  }
11340
11404
  result3 = result3.slice(0, newEnd === undefined$1 ? end : newEnd);
11341
11405
  }
11342
- } else if (string3.indexOf(baseToString2(separator), end) != end) {
11343
- var index2 = result3.lastIndexOf(separator);
11406
+ } else if (string3.indexOf(baseToString2(separator2), end) != end) {
11407
+ var index2 = result3.lastIndexOf(separator2);
11344
11408
  if (index2 > -1) {
11345
11409
  result3 = result3.slice(0, index2);
11346
11410
  }
@@ -12054,11 +12118,54 @@ var EditableSelect = defineComponent$1({
12054
12118
  props: editableSelectProps,
12055
12119
  emits: ["update:modelValue"],
12056
12120
  setup(props, ctx2) {
12057
- const dropdownRef = ref(null);
12121
+ const renderDropdown = (condition, type4) => {
12122
+ if (!condition && type4 === 0) {
12123
+ return createVNode(Transition, {
12124
+ "name": "fade"
12125
+ }, {
12126
+ default: () => [createVNode(SelectDropdown, {
12127
+ "options": filteredOptions.value
12128
+ }, null)]
12129
+ });
12130
+ } else if (condition && type4 === 1) {
12131
+ return createVNode(resolveComponent("d-flexible-overlay"), {
12132
+ "hasBackdrop": false,
12133
+ "origin": origin,
12134
+ "position": position,
12135
+ "visible": visible.value,
12136
+ "onUpdate:visible": ($event) => visible.value = $event
12137
+ }, {
12138
+ default: () => [createVNode("div", {
12139
+ "class": "devui-dropdown",
12140
+ "style": {
12141
+ width: props.width + "px"
12142
+ }
12143
+ }, [createVNode(SelectDropdown, {
12144
+ "options": filteredOptions.value
12145
+ }, null)])]
12146
+ });
12147
+ }
12148
+ };
12149
+ const renderDefaultSlots = (item2) => {
12150
+ return ctx2.slots.default ? renderSlot(ctx2.slots, "default", {
12151
+ item: item2
12152
+ }) : item2.name;
12153
+ };
12154
+ const renderEmptySlots = () => {
12155
+ return ctx2.slots.empty ? renderSlot(ctx2.slots, "empty") : emptyText.value;
12156
+ };
12157
+ const origin = ref();
12158
+ const dropdownRef = ref();
12058
12159
  const visible = ref(false);
12059
12160
  const inputValue = ref("");
12060
- const activeIndex = ref(0);
12161
+ const selectedIndex = ref(0);
12061
12162
  const query = ref(props.modelValue);
12163
+ const position = reactive({
12164
+ originX: "left",
12165
+ originY: "bottom",
12166
+ overlayX: "left",
12167
+ overlayY: "top"
12168
+ });
12062
12169
  const wait = computed(() => props.remote ? 300 : 0);
12063
12170
  const emptyText = computed(() => {
12064
12171
  const options = filteredOptions.value;
@@ -12134,7 +12241,7 @@ var EditableSelect = defineComponent$1({
12134
12241
  e.stopPropagation();
12135
12242
  } else {
12136
12243
  query.value = item2.name;
12137
- activeIndex.value = findIndex(item2);
12244
+ selectedIndex.value = findIndex(item2);
12138
12245
  inputValue.value = "";
12139
12246
  ctx2.emit("update:modelValue", item2.name);
12140
12247
  }
@@ -12144,28 +12251,31 @@ var EditableSelect = defineComponent$1({
12144
12251
  return;
12145
12252
  const dropdownVal = dropdownRef.value;
12146
12253
  if (dropdownVal.clientHeight + dropdownVal.scrollTop >= dropdownVal.scrollHeight) {
12147
- props.remoteMethod(inputValue.value);
12254
+ props.loadMore();
12148
12255
  }
12149
12256
  };
12257
+ provide("InjectionKey", {
12258
+ dropdownRef,
12259
+ props: reactive(__spreadValues({}, toRefs(props))),
12260
+ visible,
12261
+ emptyText,
12262
+ selectedIndex,
12263
+ loadMore,
12264
+ selectOptionClick,
12265
+ renderDefaultSlots,
12266
+ renderEmptySlots
12267
+ });
12150
12268
  return () => {
12151
- const selectCls = className$2("devui-form-group devui-has-feedback", {
12269
+ const selectCls = className$2("devui-editable-select devui-form-group devui-has-feedback", {
12152
12270
  "devui-select-open": visible.value
12153
12271
  });
12154
12272
  const inputCls = className$2("devui-form-control devui-dropdown-origin devui-dropdown-origin-open", {
12155
12273
  disabled: props.disabled
12156
12274
  });
12157
- const getLiCls = (item2, index2) => {
12158
- const {
12159
- disabledKey
12160
- } = props;
12161
- return className$2("devui-dropdown-item", {
12162
- disabled: disabledKey ? !!item2[disabledKey] : false,
12163
- selected: activeIndex.value === index2
12164
- });
12165
- };
12166
- return withDirectives(createVNode("div", {
12275
+ return createVNode(Fragment, null, [withDirectives(createVNode("div", {
12167
12276
  "class": selectCls,
12168
- "onClick": toggleMenu
12277
+ "onClick": toggleMenu,
12278
+ "ref": origin
12169
12279
  }, [createVNode("input", {
12170
12280
  "class": inputCls,
12171
12281
  "type": "text",
@@ -12175,36 +12285,9 @@ var EditableSelect = defineComponent$1({
12175
12285
  "class": "devui-form-control-feedback"
12176
12286
  }, [createVNode("span", {
12177
12287
  "class": "devui-select-chevron-icon"
12178
- }, [createVNode(Icon, {
12288
+ }, [createVNode(resolveComponent("d-icon"), {
12179
12289
  "name": "select-arrow"
12180
- }, null)])]), createVNode("div", {
12181
- "class": "devui-editable-select"
12182
- }, [createVNode(Transition, {
12183
- "name": "fade"
12184
- }, {
12185
- default: () => [withDirectives(createVNode("div", {
12186
- "class": "devui-dropdown-menu"
12187
- }, [createVNode("ul", {
12188
- "class": "devui-list-unstyled scroll-height",
12189
- "ref": dropdownRef,
12190
- "style": {
12191
- maxHeight: props.maxHeight + "px"
12192
- },
12193
- "onScroll": loadMore
12194
- }, [filteredOptions.value.map((item2, index2) => {
12195
- return createVNode("li", {
12196
- "class": getLiCls(item2, index2),
12197
- "onClick": ($evnet) => selectOptionClick($evnet, item2),
12198
- "key": item2.name
12199
- }, [ctx2.slots.default ? renderSlot(ctx2.slots, "default", {
12200
- item: item2
12201
- }) : item2.name]);
12202
- }), withDirectives(createVNode("li", {
12203
- "class": "devui-no-result-template"
12204
- }, [createVNode("div", {
12205
- "class": "devui-no-data-tip"
12206
- }, [emptyText.value])]), [[vShow, filteredOptions.value.length === 0]])])]), [[vShow, visible.value]])]
12207
- })])]), [[resolveDirective("click-outside"), handleClose]]);
12290
+ }, null)])]), renderDropdown(props.appendToBody, 0)]), [[resolveDirective("click-outside"), handleClose]]), renderDropdown(props.appendToBody, 1)]);
12208
12291
  };
12209
12292
  }
12210
12293
  });
@@ -14034,11 +14117,11 @@ var Fullscreen = defineComponent$1({
14034
14117
  props: fullscreenProps,
14035
14118
  emits: ["fullscreenLaunch"],
14036
14119
  setup(props, ctx2) {
14037
- let currentTarget = ref(null);
14120
+ let currentTarget = null;
14038
14121
  const isFullscreen = ref(false);
14039
14122
  const slotElement = ref(null);
14040
14123
  const onFullScreenChange = () => {
14041
- if (currentTarget.value) {
14124
+ if (currentTarget) {
14042
14125
  const targetElement = currentTarget;
14043
14126
  if (document.fullscreenElement) {
14044
14127
  addFullScreenStyle();
@@ -14146,6 +14229,16 @@ var Fullscreen = defineComponent$1({
14146
14229
  document.addEventListener("webkitfullscreenchange", onFullScreenChange);
14147
14230
  document.addEventListener("keydown", handleKeyDown);
14148
14231
  });
14232
+ onBeforeUnmount(() => {
14233
+ const btnLaunch = slotElement.value.querySelector("[fullscreen-launch]");
14234
+ if (btnLaunch) {
14235
+ btnLaunch.removeEventListener("click", handleFullscreen);
14236
+ }
14237
+ document.removeEventListener("fullscreenchange", onFullScreenChange);
14238
+ document.removeEventListener("MSFullscreenChange", onFullScreenChange);
14239
+ document.removeEventListener("webkitfullscreenchange", onFullScreenChange);
14240
+ document.removeEventListener("keydown", handleKeyDown);
14241
+ });
14149
14242
  return () => {
14150
14243
  const defaultSlot = renderSlot(useSlots(), "default");
14151
14244
  return createVNode("div", {
@@ -14953,11 +15046,21 @@ var imagePreview$1 = "";
14953
15046
  const imagePreviewProps = {
14954
15047
  url: {
14955
15048
  type: String,
14956
- default: ""
15049
+ default: "",
15050
+ required: true
14957
15051
  },
14958
15052
  previewUrlList: {
14959
15053
  type: Array,
14960
- default: () => []
15054
+ default: () => [],
15055
+ required: true
15056
+ },
15057
+ zIndex: {
15058
+ type: Number,
15059
+ required: false
15060
+ },
15061
+ backDropZIndex: {
15062
+ type: Number,
15063
+ required: false
14961
15064
  }
14962
15065
  };
14963
15066
  class Transform {
@@ -15084,6 +15187,12 @@ var imagePreview = defineComponent$1({
15084
15187
  let transform = null;
15085
15188
  const index2 = ref(0);
15086
15189
  const url2 = computed(() => props.previewUrlList[index2.value]);
15190
+ const imageStyle = props.zIndex ? {
15191
+ zIndex: props.zIndex
15192
+ } : {};
15193
+ const bgStyle = props.backDropZIndex ? {
15194
+ zIndex: props.backDropZIndex
15195
+ } : {};
15087
15196
  function initTransform() {
15088
15197
  const imageElement = document.querySelector(".devui-image-preview-main-image");
15089
15198
  transform = new Transform(imageElement);
@@ -15141,8 +15250,9 @@ var imagePreview = defineComponent$1({
15141
15250
  unKeyBoard();
15142
15251
  });
15143
15252
  return () => {
15144
- return createVNode("div", {
15145
- "class": "devui-image-preview"
15253
+ return createVNode(Fragment, null, [createVNode("div", {
15254
+ "class": "devui-image-preview",
15255
+ "style": imageStyle
15146
15256
  }, [createVNode("img", {
15147
15257
  "class": "devui-image-preview-main-image",
15148
15258
  "src": url2.value
@@ -15300,7 +15410,10 @@ var imagePreview = defineComponent$1({
15300
15410
  "fill-rule": "nonzero"
15301
15411
  }, null)])])]), createVNode("button", {
15302
15412
  "onClick": onZoomOriginal
15303
- }, [createVNode("span", null, [createTextVNode("1:1")])])])]);
15413
+ }, [createVNode("span", null, [createTextVNode("1:1")])])])]), createVNode("div", {
15414
+ "class": "devui-image-preview-bg",
15415
+ "style": bgStyle
15416
+ }, null)]);
15304
15417
  };
15305
15418
  }
15306
15419
  });
@@ -15328,8 +15441,13 @@ class ImagePreviewService {
15328
15441
  __publicField(ImagePreviewService, "$body", null);
15329
15442
  __publicField(ImagePreviewService, "$div", null);
15330
15443
  __publicField(ImagePreviewService, "$overflow", "");
15331
- function mountedPreviewImages(url2, urlList) {
15332
- ImagePreviewService.open({ url: url2, previewUrlList: urlList });
15444
+ function mountedPreviewImages(props) {
15445
+ ImagePreviewService.open({
15446
+ url: props.url,
15447
+ previewUrlList: props.previewUrlList,
15448
+ zIndex: props.zIndex,
15449
+ backDropZIndex: props.backDropZIndex
15450
+ });
15333
15451
  }
15334
15452
  function unmountedPreviewImages() {
15335
15453
  ImagePreviewService.close();
@@ -15346,7 +15464,12 @@ function handleImgByEl(el) {
15346
15464
  if (((_a = target == null ? void 0 : target.nodeName) == null ? void 0 : _a.toLowerCase()) === "img") {
15347
15465
  const urlList = getImgByEl(el);
15348
15466
  const url2 = target.getAttribute("src");
15349
- mountedPreviewImages(url2, urlList);
15467
+ mountedPreviewImages({
15468
+ url: url2,
15469
+ previewUrlList: urlList,
15470
+ zIndex: el == null ? void 0 : el.zIndex,
15471
+ backDropZIndex: el == null ? void 0 : el.backDropZIndex
15472
+ });
15350
15473
  }
15351
15474
  });
15352
15475
  }
@@ -15359,7 +15482,12 @@ var ImagePreviewDirective = {
15359
15482
  if (custom instanceof Object) {
15360
15483
  custom.open = () => {
15361
15484
  const urlList = getImgByEl(el);
15362
- mountedPreviewImages(urlList == null ? void 0 : urlList[0], urlList);
15485
+ mountedPreviewImages({
15486
+ url: urlList == null ? void 0 : urlList[0],
15487
+ previewUrlList: urlList,
15488
+ zIndex: el == null ? void 0 : el.zIndex,
15489
+ backDropZIndex: el == null ? void 0 : el.backDropZIndex
15490
+ });
15363
15491
  };
15364
15492
  custom.close = () => unmountedPreviewImages();
15365
15493
  }
@@ -15370,6 +15498,11 @@ var ImagePreviewDirective = {
15370
15498
  },
15371
15499
  unmounted() {
15372
15500
  unmountedPreviewImages();
15501
+ },
15502
+ updated(el, binding) {
15503
+ var _a, _b;
15504
+ el.zIndex = (_a = binding.value) == null ? void 0 : _a.zIndex;
15505
+ el.backDropZIndex = (_b = binding.value) == null ? void 0 : _b.backDropZIndex;
15373
15506
  }
15374
15507
  };
15375
15508
  var ImagePreviewInstall = {
@@ -18903,10 +19036,23 @@ var TipsTemplate = defineComponent$1({
18903
19036
  rule = __spreadValues(__spreadValues({}, rule), dataFn);
18904
19037
  }
18905
19038
  const temp = ref(null);
19039
+ const deviation = (x) => {
19040
+ let deviationConstant = x > 24 ? 0 : -(x / 2) + 2;
19041
+ if (x <= 10) {
19042
+ deviationConstant = -10;
19043
+ }
19044
+ return deviationConstant;
19045
+ };
18906
19046
  onMounted(() => {
18907
19047
  const domBounding = document.querySelector(query).getBoundingClientRect();
19048
+ const {
19049
+ width,
19050
+ height
19051
+ } = domBounding;
18908
19052
  const distance = 10;
18909
19053
  let positionTop = 0;
19054
+ const heightDeviation = deviation(height);
19055
+ const widthDeviation = deviation(width);
18910
19056
  let positionLeft = 0;
18911
19057
  const targetDom = document.querySelector(".read-tip-container").getBoundingClientRect();
18912
19058
  if (rule.appendToBody) {
@@ -18916,18 +19062,18 @@ var TipsTemplate = defineComponent$1({
18916
19062
  switch (rule.position) {
18917
19063
  case "top":
18918
19064
  styles.top = positionTop - targetDom.height - distance + "px";
18919
- styles.left = positionLeft + "px";
19065
+ styles.left = positionLeft + widthDeviation + "px";
18920
19066
  break;
18921
19067
  case "left":
18922
- styles.top = positionTop + "px";
19068
+ styles.top = positionTop + heightDeviation + "px";
18923
19069
  styles.left = positionLeft - targetDom.width - distance + "px";
18924
19070
  break;
18925
19071
  case "bottom":
18926
19072
  styles.top = positionTop + domBounding.height + distance + "px";
18927
- styles.left = positionLeft + "px";
19073
+ styles.left = positionLeft + widthDeviation + "px";
18928
19074
  break;
18929
19075
  case "right":
18930
- styles.top = positionTop + "px";
19076
+ styles.top = positionTop + heightDeviation + "px";
18931
19077
  styles.left = positionLeft + domBounding.width + distance + "px";
18932
19078
  break;
18933
19079
  }
@@ -19366,7 +19512,7 @@ const searchProps = {
19366
19512
  type: String,
19367
19513
  default: ""
19368
19514
  },
19369
- searchFn: {
19515
+ onSearch: {
19370
19516
  type: Function,
19371
19517
  default: void 0
19372
19518
  },
@@ -19431,7 +19577,7 @@ const keydownHandles = (ctx2, keywords, delay) => {
19431
19577
  useEmitKeyword(keywords.value);
19432
19578
  };
19433
19579
  const useEmitKeyword = debounce$1((value) => {
19434
- ctx2.emit("searchFn", value);
19580
+ ctx2.emit("onSearch", value);
19435
19581
  }, delay);
19436
19582
  return {
19437
19583
  onInputKeydown,
@@ -19443,7 +19589,7 @@ var search = "";
19443
19589
  var DSearch = defineComponent$1({
19444
19590
  name: "DSearch",
19445
19591
  props: searchProps,
19446
- emits: ["update:modelValue", "searchFn"],
19592
+ emits: ["update:modelValue", "onSearch"],
19447
19593
  setup(props, ctx2) {
19448
19594
  const rootClasses = getRootClass(props);
19449
19595
  const {
@@ -19471,7 +19617,8 @@ var DSearch = defineComponent$1({
19471
19617
  "onClick": onClickHandle
19472
19618
  }, [createVNode(resolveComponent("d-icon"), {
19473
19619
  "name": "search",
19474
- "size": "inherit"
19620
+ "size": "inherit",
19621
+ "key": "search"
19475
19622
  }, null)]), createVNode(DInput, {
19476
19623
  "size": props.size,
19477
19624
  "disabled": props.disabled,
@@ -19487,13 +19634,15 @@ var DSearch = defineComponent$1({
19487
19634
  "onClick": onClearHandle
19488
19635
  }, [createVNode(resolveComponent("d-icon"), {
19489
19636
  "name": "close",
19490
- "size": "inherit"
19637
+ "size": "inherit",
19638
+ "key": "close"
19491
19639
  }, null)]), props.iconPosition === "right" && createVNode("div", {
19492
19640
  "class": "devui-search__icon",
19493
19641
  "onClick": onClickHandle
19494
19642
  }, [createVNode(resolveComponent("d-icon"), {
19495
19643
  "name": "search",
19496
- "size": "inherit"
19644
+ "size": "inherit",
19645
+ "key": "search"
19497
19646
  }, null)])]);
19498
19647
  };
19499
19648
  }
@@ -20908,12 +21057,284 @@ var SplitterInstall = {
20908
21057
  app.use(Splitter);
20909
21058
  }
20910
21059
  };
21060
+ const statisticProps = {
21061
+ title: {
21062
+ type: String,
21063
+ default: ""
21064
+ },
21065
+ value: {
21066
+ type: [Number, String]
21067
+ },
21068
+ prefix: {
21069
+ type: String
21070
+ },
21071
+ suffix: {
21072
+ type: String
21073
+ },
21074
+ precision: {
21075
+ type: Number
21076
+ },
21077
+ groupSeparator: {
21078
+ type: String,
21079
+ default: ","
21080
+ },
21081
+ showGroupSeparator: {
21082
+ type: Boolean,
21083
+ default: false
21084
+ },
21085
+ titleStyle: {
21086
+ type: Object
21087
+ },
21088
+ contentStyle: {
21089
+ type: Object
21090
+ },
21091
+ animationDuration: {
21092
+ type: Number,
21093
+ default: 2e3
21094
+ },
21095
+ valueFrom: {
21096
+ type: Number
21097
+ },
21098
+ animation: {
21099
+ type: Boolean,
21100
+ default: false
21101
+ },
21102
+ start: {
21103
+ type: Boolean,
21104
+ default: false
21105
+ },
21106
+ extra: {
21107
+ type: String,
21108
+ default: ""
21109
+ },
21110
+ easing: {
21111
+ type: String,
21112
+ default: "easeOutCubic"
21113
+ },
21114
+ delay: {
21115
+ type: Number,
21116
+ default: 0
21117
+ }
21118
+ };
21119
+ const separator = (SeparatorString, groupSeparator, showGroupSeparator) => {
21120
+ const res = SeparatorString.replace(/\d+/, function(n) {
21121
+ return n.replace(/(\d)(?=(\d{3})+$)/g, function($1) {
21122
+ return $1 + `${showGroupSeparator ? groupSeparator : ""}`;
21123
+ });
21124
+ });
21125
+ return res;
21126
+ };
21127
+ const isHasDot = (value) => {
21128
+ if (!isNaN(value)) {
21129
+ return (value + "").indexOf(".") !== -1;
21130
+ }
21131
+ };
21132
+ const analysisValueType = (value, propsValue, groupSeparator, splitPrecisionNumber, showGroupSeparator) => {
21133
+ const fixedNumber = propsValue.toString().indexOf(".") !== -1 ? propsValue.toString().length - propsValue.toString().indexOf(".") - 1 : 0;
21134
+ if (typeof value === "number") {
21135
+ if (isHasDot(value)) {
21136
+ return splitPrecisionNumber ? separator(value.toFixed(splitPrecisionNumber).toString(), groupSeparator, showGroupSeparator) : separator(value.toFixed(fixedNumber).toString(), groupSeparator, showGroupSeparator);
21137
+ } else {
21138
+ return splitPrecisionNumber ? separator(value.toFixed(splitPrecisionNumber).toString(), groupSeparator, showGroupSeparator) : separator(value.toString(), groupSeparator, showGroupSeparator);
21139
+ }
21140
+ } else {
21141
+ return value;
21142
+ }
21143
+ };
21144
+ const pow = Math.pow;
21145
+ const sqrt = Math.sqrt;
21146
+ const easeOutCubic = function(x) {
21147
+ return 1 - pow(1 - x, 3);
21148
+ };
21149
+ const linear = (x) => x;
21150
+ const easeOutExpo = function(x) {
21151
+ return x === 1 ? 1 : 1 - pow(2, -10 * x);
21152
+ };
21153
+ const easeInOutExpo = function(x) {
21154
+ return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? pow(2, 20 * x - 10) / 2 : (2 - pow(2, -20 * x + 10)) / 2;
21155
+ };
21156
+ const easeInExpo = function(x) {
21157
+ return x === 0 ? 0 : pow(2, 10 * x - 10);
21158
+ };
21159
+ const easeInOutCirc = function(x) {
21160
+ return x < 0.5 ? (1 - sqrt(1 - pow(2 * x, 2))) / 2 : (sqrt(1 - pow(-2 * x + 2, 2)) + 1) / 2;
21161
+ };
21162
+ var easing = /* @__PURE__ */ Object.freeze({
21163
+ __proto__: null,
21164
+ [Symbol.toStringTag]: "Module",
21165
+ easeOutCubic,
21166
+ linear,
21167
+ easeOutExpo,
21168
+ easeInOutExpo,
21169
+ easeInExpo,
21170
+ easeInOutCirc
21171
+ });
21172
+ class Tween {
21173
+ constructor(options) {
21174
+ __publicField(this, "from");
21175
+ __publicField(this, "to");
21176
+ __publicField(this, "duration");
21177
+ __publicField(this, "delay");
21178
+ __publicField(this, "easing");
21179
+ __publicField(this, "onStart");
21180
+ __publicField(this, "onUpdate");
21181
+ __publicField(this, "onFinish");
21182
+ __publicField(this, "startTime");
21183
+ __publicField(this, "started");
21184
+ __publicField(this, "finished");
21185
+ __publicField(this, "timer");
21186
+ __publicField(this, "time");
21187
+ __publicField(this, "elapsed");
21188
+ __publicField(this, "keys");
21189
+ const { from, to, duration, delay, easing: easing2, onStart, onUpdate, onFinish } = options;
21190
+ for (const key in from) {
21191
+ if (to[key] === void 0) {
21192
+ to[key] = from[key];
21193
+ }
21194
+ }
21195
+ for (const key in to) {
21196
+ if (from[key] === void 0) {
21197
+ from[key] = to[key];
21198
+ }
21199
+ }
21200
+ this.from = from;
21201
+ this.to = to;
21202
+ this.duration = duration;
21203
+ this.delay = delay;
21204
+ this.easing = easing2;
21205
+ this.onStart = onStart;
21206
+ this.onUpdate = onUpdate;
21207
+ this.onFinish = onFinish;
21208
+ this.startTime = Date.now() + this.delay;
21209
+ this.started = false;
21210
+ this.finished = false;
21211
+ this.timer = null;
21212
+ this.keys = {};
21213
+ }
21214
+ update() {
21215
+ this.time = Date.now();
21216
+ if (this.time < this.startTime) {
21217
+ return;
21218
+ }
21219
+ if (this.finished) {
21220
+ return;
21221
+ }
21222
+ if (this.elapsed === this.duration) {
21223
+ if (!this.finished) {
21224
+ this.finished = true;
21225
+ this.onFinish && this.onFinish(this.keys);
21226
+ }
21227
+ return;
21228
+ }
21229
+ this.elapsed = this.time - this.startTime;
21230
+ this.elapsed = this.elapsed > this.duration ? this.duration : this.elapsed;
21231
+ for (const key in this.to) {
21232
+ this.keys[key] = this.from[key] + (this.to[key] - this.from[key]) * easing[this.easing](this.elapsed / this.duration);
21233
+ }
21234
+ if (!this.started) {
21235
+ this.onStart && this.onStart(this.keys);
21236
+ this.started = true;
21237
+ }
21238
+ this.onUpdate(this.keys);
21239
+ }
21240
+ start() {
21241
+ this.startTime = Date.now() + this.delay;
21242
+ const tick = () => {
21243
+ this.update();
21244
+ this.timer = requestAnimationFrame(tick);
21245
+ if (this.finished) {
21246
+ cancelAnimationFrame(this.timer);
21247
+ this.timer = null;
21248
+ }
21249
+ };
21250
+ tick();
21251
+ }
21252
+ stop() {
21253
+ cancelAnimationFrame(this.timer);
21254
+ this.timer = null;
21255
+ }
21256
+ }
21257
+ var statistic = "";
21258
+ var Statistic = defineComponent$1({
21259
+ name: "DStatistic",
21260
+ props: statisticProps,
21261
+ inheritAttrs: false,
21262
+ setup(props, ctx2) {
21263
+ var _a;
21264
+ const innerValue = ref((_a = props.valueFrom) != null ? _a : props.value);
21265
+ const tween = ref(null);
21266
+ const animation = (from = ((_b) => (_b = props.valueFrom) != null ? _b : 0)(), to = typeof props.value === "number" ? props.value : Number(props.value)) => {
21267
+ if (from !== to) {
21268
+ tween.value = new Tween({
21269
+ from: {
21270
+ value: from
21271
+ },
21272
+ to: {
21273
+ value: to
21274
+ },
21275
+ delay: props.delay,
21276
+ duration: props.animationDuration,
21277
+ easing: props.easing,
21278
+ onUpdate: (keys2) => {
21279
+ innerValue.value = keys2.value;
21280
+ },
21281
+ onFinish: () => {
21282
+ innerValue.value = to;
21283
+ }
21284
+ });
21285
+ tween.value.start();
21286
+ }
21287
+ };
21288
+ const statisticValue = computed(() => {
21289
+ return analysisValueType(innerValue.value, props.value, props.groupSeparator, props.precision, props.showGroupSeparator, props.animation);
21290
+ });
21291
+ onMounted(() => {
21292
+ if (props.animation && props.start) {
21293
+ animation();
21294
+ }
21295
+ });
21296
+ watch(() => props.start, (value) => {
21297
+ if (value && !tween.value) {
21298
+ animation();
21299
+ }
21300
+ });
21301
+ return () => {
21302
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
21303
+ return createVNode("div", mergeProps({
21304
+ "class": "devui-statistic"
21305
+ }, ctx2.attrs), [createVNode("div", {
21306
+ "class": "devui-statistic-title",
21307
+ "style": props.titleStyle
21308
+ }, [((_b = (_a2 = ctx2.slots).title) == null ? void 0 : _b.call(_a2)) || props.title]), createVNode("div", {
21309
+ "class": "devui-statistic-content",
21310
+ "style": props.contentStyle
21311
+ }, [props.prefix || ((_d = (_c = ctx2.slots).prefix) == null ? void 0 : _d.call(_c)) ? createVNode("span", {
21312
+ "class": "devui-statistic-prefix"
21313
+ }, [((_f = (_e = ctx2.slots).prefix) == null ? void 0 : _f.call(_e)) || props.prefix]) : null, createVNode("span", {
21314
+ "class": "devui-statistic--value"
21315
+ }, [statisticValue.value]), props.suffix || ((_h = (_g = ctx2.slots).suffix) == null ? void 0 : _h.call(_g)) ? createVNode("span", {
21316
+ "class": "devui-statistic-suffix"
21317
+ }, [((_j = (_i = ctx2.slots).suffix) == null ? void 0 : _j.call(_i)) || props.suffix]) : null]), ((_l = (_k = ctx2.slots).extra) == null ? void 0 : _l.call(_k)) || props.extra]);
21318
+ };
21319
+ }
21320
+ });
21321
+ Statistic.install = function(app) {
21322
+ app.component(Statistic.name, Statistic);
21323
+ };
21324
+ var StatisticInstall = {
21325
+ title: "Statistic \u7EDF\u8BA1\u6570\u503C",
21326
+ category: "\u6570\u636E\u5C55\u793A",
21327
+ status: void 0,
21328
+ install(app) {
21329
+ app.use(Statistic);
21330
+ }
21331
+ };
20911
21332
  var status = "";
20912
21333
  var Status = defineComponent$1({
20913
21334
  name: "DStatus",
20914
21335
  props: {
20915
21336
  type: {
20916
- default: "initial",
21337
+ default: "invalid",
20917
21338
  type: String
20918
21339
  }
20919
21340
  },
@@ -20979,7 +21400,7 @@ const stepsGuideProps = {
20979
21400
  }
20980
21401
  };
20981
21402
  function useStepsGuidePosition(props, currentStep) {
20982
- const guideClassList = ["devui-steps-guide"];
21403
+ const guideClassList = reactive(["devui-steps-guide"]);
20983
21404
  const stepsRef = ref(null);
20984
21405
  const guidePosition = reactive({
20985
21406
  left: "",
@@ -20987,7 +21408,7 @@ function useStepsGuidePosition(props, currentStep) {
20987
21408
  zIndex: props.zIndex
20988
21409
  });
20989
21410
  const updateGuidePosition = () => {
20990
- if (!currentStep.value)
21411
+ if (!currentStep.value || !stepsRef.value)
20991
21412
  return;
20992
21413
  const baseTop = window.pageYOffset - document.documentElement.clientTop;
20993
21414
  const baseLeft = window.pageXOffset - document.documentElement.clientLeft;
@@ -21003,6 +21424,10 @@ function useStepsGuidePosition(props, currentStep) {
21003
21424
  guideClassList.splice(1, 1, currentStepPosition);
21004
21425
  const triggerSelector = currentStep.value.target || currentStep.value.trigger;
21005
21426
  const triggerElement = document.querySelector(triggerSelector);
21427
+ if (!triggerElement) {
21428
+ console.warn(`${triggerSelector} \u4E0D\u5B58\u5728!`);
21429
+ return false;
21430
+ }
21006
21431
  const targetRect = triggerElement.getBoundingClientRect();
21007
21432
  _left = targetRect.left + triggerElement.clientWidth / 2 - stepGuideElement.clientWidth / 2 + baseLeft;
21008
21433
  _top = targetRect.top + triggerElement.clientHeight / 2 - stepGuideElement.clientHeight / 2 + baseTop;
@@ -21034,7 +21459,7 @@ function useStepsGuidePosition(props, currentStep) {
21034
21459
  }
21035
21460
  guidePosition.left = _left + "px";
21036
21461
  guidePosition.top = _top + "px";
21037
- if (props.scrollToTargetSwitch) {
21462
+ if (props.scrollToTargetSwitch && typeof stepGuideElement.scrollIntoView === "function") {
21038
21463
  nextTick$1(() => {
21039
21464
  stepGuideElement.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
21040
21465
  });
@@ -21060,9 +21485,7 @@ function useStepsGuideCtrl(props, ctx2, updateGuidePosition, stepIndex) {
21060
21485
  if (index2 !== -1 && props.stepChange()) {
21061
21486
  if (index2 > -1 && index2 < stepsCount.value) {
21062
21487
  stepIndex.value = index2;
21063
- console.log(stepIndex.value, index2, stepsCount.value);
21064
21488
  nextTick$1(() => {
21065
- console.log(stepIndex.value, index2, stepsCount.value);
21066
21489
  updateGuidePosition();
21067
21490
  });
21068
21491
  } else {
@@ -27227,6 +27650,7 @@ const installs = [
27227
27650
  SkeletonInstall,
27228
27651
  SliderInstall,
27229
27652
  SplitterInstall,
27653
+ StatisticInstall,
27230
27654
  StatusInstall,
27231
27655
  StepsGuideInstall,
27232
27656
  StickyInstall,
@@ -27251,4 +27675,4 @@ var vueDevui = {
27251
27675
  installs.forEach((p) => app.use(p));
27252
27676
  }
27253
27677
  };
27254
- export { Accordion, Alert, Anchor, Aside, Avatar, BackTop, Badge, Breadcrumb, DButton as Button, Card, Carousel, Cascader, Checkbox, Col, Column, Comment, Content, Countdown, DatePicker, DraggableDirective, Drawer, 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, MultiUpload, NavSprite, Pagination, Panel, Popover, Progress, QuadrantDiagram, Radio, RadioGroup, Rate, ReadTip, Result, RippleDirective, Row, DSearch as Search, Select, Skeleton, SkeletonItem, Slider, Splitter, 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 };
27678
+ export { Accordion, Alert, Anchor, Aside, Avatar, BackTop, Badge, Breadcrumb, DButton as Button, Card, Carousel, Cascader, Checkbox, Col, Column, Comment, Content, Countdown, DatePicker, DraggableDirective, Drawer, 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, MultiUpload, NavSprite, Pagination, Panel, Popover, Progress, QuadrantDiagram, Radio, RadioGroup, Rate, ReadTip, Result, RippleDirective, Row, DSearch as Search, Select, Skeleton, SkeletonItem, Slider, 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 };