vue-devui 1.6.11 → 1.6.12

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.
@@ -29,7 +29,11 @@ var __objRest = (source, exclude) => {
29
29
  }
30
30
  return target;
31
31
  };
32
- import { ref, reactive, defineComponent, watch, provide, toRefs, createVNode, onUnmounted, Transition, mergeProps, unref, nextTick, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, computed, onMounted, Teleport, createTextVNode, onBeforeUnmount, toRef, onBeforeMount, vShow, resolveComponent, getCurrentInstance } from "vue";
32
+ var __publicField = (obj, key, value) => {
33
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
34
+ return value;
35
+ };
36
+ import { ref, reactive, defineComponent, watch, provide, toRefs, createVNode, onUnmounted, Transition, mergeProps, unref, nextTick, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, computed, onMounted, Teleport, createTextVNode, onBeforeUnmount, toRef, onBeforeMount, vShow, resolveComponent, getCurrentInstance, render, resolveDirective } from "vue";
33
37
  import { onClickOutside } from "@vueuse/core";
34
38
  import "clipboard";
35
39
  import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
@@ -4242,7 +4246,7 @@ var lodash = { exports: {} };
4242
4246
  function isElement(value) {
4243
4247
  return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
4244
4248
  }
4245
- function isEmpty(value) {
4249
+ function isEmpty2(value) {
4246
4250
  if (value == null) {
4247
4251
  return true;
4248
4252
  }
@@ -5372,7 +5376,7 @@ var lodash = { exports: {} };
5372
5376
  lodash2.isBuffer = isBuffer;
5373
5377
  lodash2.isDate = isDate;
5374
5378
  lodash2.isElement = isElement;
5375
- lodash2.isEmpty = isEmpty;
5379
+ lodash2.isEmpty = isEmpty2;
5376
5380
  lodash2.isEqual = isEqual;
5377
5381
  lodash2.isEqualWith = isEqualWith;
5378
5382
  lodash2.isError = isError;
@@ -7725,7 +7729,7 @@ var Schema = /* @__PURE__ */ function() {
7725
7729
  complete(results);
7726
7730
  }, source);
7727
7731
  };
7728
- _proto.getType = function getType(rule) {
7732
+ _proto.getType = function getType2(rule) {
7729
7733
  if (rule.type === void 0 && rule.pattern instanceof RegExp) {
7730
7734
  rule.type = "pattern";
7731
7735
  }
@@ -8251,7 +8255,7 @@ function useSelect(props, selectRef, ctx, focus, blur, isSelectFocus, t) {
8251
8255
  return label.toString().toLocaleLowerCase().includes(filterQuery.value.toLocaleLowerCase().trim());
8252
8256
  }).length;
8253
8257
  if (isLoading.value) {
8254
- return props.loadingText || t("loadingText");
8258
+ return "";
8255
8259
  }
8256
8260
  if (isSupportFilter.value && filterQuery.value && injectOptionsArray.value.length > 0 && visibleOptionsCount === 0) {
8257
8261
  return props.noMatchText || t("noMatchText");
@@ -9373,8 +9377,216 @@ function useSelectFunction(props, selectRef) {
9373
9377
  return { isSelectFocus, focus, blur };
9374
9378
  }
9375
9379
  var select = "";
9380
+ class View {
9381
+ constructor() {
9382
+ __publicField(this, "top", "50%");
9383
+ __publicField(this, "left", "50%");
9384
+ }
9385
+ }
9386
+ const loadingProps = {
9387
+ message: String,
9388
+ backdrop: Boolean,
9389
+ view: {
9390
+ type: Object,
9391
+ default: () => new View()
9392
+ },
9393
+ zIndex: Number,
9394
+ isFull: {
9395
+ type: Boolean,
9396
+ default: false
9397
+ }
9398
+ };
9399
+ class LoadingOptions {
9400
+ constructor() {
9401
+ __publicField(this, "target");
9402
+ __publicField(this, "message");
9403
+ __publicField(this, "loadingTemplateRef");
9404
+ __publicField(this, "backdrop", true);
9405
+ __publicField(this, "positionType", "relative");
9406
+ __publicField(this, "view", new View());
9407
+ __publicField(this, "zIndex");
9408
+ }
9409
+ }
9410
+ var loading = "";
9411
+ var Loading = defineComponent({
9412
+ name: "Loading",
9413
+ inheritAttrs: false,
9414
+ props: loadingProps,
9415
+ setup(props) {
9416
+ const style = {
9417
+ top: props.view.top,
9418
+ left: props.view.left,
9419
+ zIndex: props.zIndex
9420
+ };
9421
+ if (!props.message) {
9422
+ style.background = "none";
9423
+ }
9424
+ const isShow = ref(false);
9425
+ const open = () => {
9426
+ isShow.value = true;
9427
+ };
9428
+ const close = () => {
9429
+ isShow.value = false;
9430
+ };
9431
+ return {
9432
+ style,
9433
+ isShow,
9434
+ open,
9435
+ close
9436
+ };
9437
+ },
9438
+ render() {
9439
+ var _a;
9440
+ const {
9441
+ isShow,
9442
+ isFull,
9443
+ backdrop,
9444
+ style,
9445
+ message,
9446
+ $slots
9447
+ } = this;
9448
+ const ns2 = useNamespace$1("loading");
9449
+ return isShow && createVNode("div", {
9450
+ "class": [ns2.b(), isFull ? ns2.m("full") : ""]
9451
+ }, [((_a = $slots.default) == null ? void 0 : _a.call($slots)) || createVNode("div", {
9452
+ "class": ns2.e("wrapper")
9453
+ }, [backdrop ? createVNode("div", {
9454
+ "class": ns2.e("mask")
9455
+ }, null) : null, createVNode("div", {
9456
+ "style": style,
9457
+ "class": ns2.e("area")
9458
+ }, [createVNode("div", {
9459
+ "class": ns2.e("busy-default-spinner")
9460
+ }, [createVNode("div", {
9461
+ "class": ns2.e("bar1")
9462
+ }, null), createVNode("div", {
9463
+ "class": ns2.e("bar2")
9464
+ }, null), createVNode("div", {
9465
+ "class": ns2.e("bar3")
9466
+ }, null), createVNode("div", {
9467
+ "class": ns2.e("bar4")
9468
+ }, null)]), message ? createVNode("span", {
9469
+ "class": ns2.e("text")
9470
+ }, [message]) : null])])]);
9471
+ }
9472
+ });
9473
+ const COMPONENT_CONTAINER_SYMBOL = Symbol("dev_component_container");
9474
+ function createComponent(component, props, children = null) {
9475
+ const vnode = h(component, __spreadValues({}, props), children);
9476
+ const container = document.createElement("div");
9477
+ vnode[COMPONENT_CONTAINER_SYMBOL] = container;
9478
+ render(vnode, container);
9479
+ return vnode.component;
9480
+ }
9481
+ function unmountComponent(ComponnetInstance) {
9482
+ render(null, ComponnetInstance == null ? void 0 : ComponnetInstance.vnode[COMPONENT_CONTAINER_SYMBOL]);
9483
+ }
9484
+ const loadingConstructor = defineComponent(Loading);
9485
+ const cacheInstance = /* @__PURE__ */ new WeakSet();
9486
+ const isEmpty = (val) => {
9487
+ if (!val) {
9488
+ return true;
9489
+ }
9490
+ if (Array.isArray(val)) {
9491
+ return val.length === 0;
9492
+ }
9493
+ if (val instanceof Set || val instanceof Map) {
9494
+ return val.size === 0;
9495
+ }
9496
+ if (val instanceof Promise) {
9497
+ return false;
9498
+ }
9499
+ if (typeof val === "object") {
9500
+ try {
9501
+ return Object.keys(val).length === 0;
9502
+ } catch (e) {
9503
+ return false;
9504
+ }
9505
+ }
9506
+ return false;
9507
+ };
9508
+ const getType = (vari) => {
9509
+ return Object.prototype.toString.call(vari).slice(8, -1).toLowerCase();
9510
+ };
9511
+ const isPromise = (value) => {
9512
+ const type4 = getType(value);
9513
+ switch (type4) {
9514
+ case "promise":
9515
+ return [value];
9516
+ case "array":
9517
+ if (value.some((val) => getType(val) !== "promise")) {
9518
+ console.error(new TypeError("Binding values should all be of type Promise"));
9519
+ return "error";
9520
+ }
9521
+ return value;
9522
+ default:
9523
+ return false;
9524
+ }
9525
+ };
9526
+ const unmount = (el) => {
9527
+ cacheInstance.delete(el);
9528
+ el.instance.proxy.close();
9529
+ unmountComponent(el.instance);
9530
+ };
9531
+ const toggleLoading = (el, binding) => {
9532
+ var _a, _b, _c;
9533
+ if (binding.value) {
9534
+ const vals = isPromise(binding.value);
9535
+ if (vals === "error") {
9536
+ return;
9537
+ }
9538
+ (_c = (_b = (_a = el == null ? void 0 : el.instance) == null ? void 0 : _a.proxy) == null ? void 0 : _b.open) == null ? void 0 : _c.call(_b);
9539
+ el.appendChild(el.mask);
9540
+ cacheInstance.add(el);
9541
+ if (vals) {
9542
+ Promise.all(vals).catch((err) => {
9543
+ console.error(new Error("Promise handling errors"), err);
9544
+ }).finally(() => {
9545
+ unmount(el);
9546
+ });
9547
+ }
9548
+ } else {
9549
+ unmount(el);
9550
+ }
9551
+ };
9552
+ const removeAttribute = (el) => {
9553
+ el.removeAttribute("zindex");
9554
+ el.removeAttribute("positiontype");
9555
+ el.removeAttribute("backdrop");
9556
+ el.removeAttribute("message");
9557
+ el.removeAttribute("view");
9558
+ el.removeAttribute("loadingtemplateref");
9559
+ };
9560
+ const handleProps = (el, vprops) => {
9561
+ var _a;
9562
+ const props = __spreadValues(__spreadValues({}, new LoadingOptions()), vprops);
9563
+ const loadingTemplateRef = props.loadingTemplateRef;
9564
+ const loadingInstance = createComponent(loadingConstructor, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
9565
+ el.style.position = props.positionType || "relative";
9566
+ el.options = props;
9567
+ el.instance = loadingInstance;
9568
+ el.mask = (_a = loadingInstance == null ? void 0 : loadingInstance.proxy) == null ? void 0 : _a.$el;
9569
+ };
9570
+ const LoadingDirective = {
9571
+ mounted: function(el, binding, vnode) {
9572
+ handleProps(el, vnode.props);
9573
+ removeAttribute(el);
9574
+ !isEmpty(binding.value) && toggleLoading(el, binding);
9575
+ },
9576
+ updated: function(el, binding, vnode) {
9577
+ if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el)) {
9578
+ return;
9579
+ }
9580
+ !cacheInstance.has(el) && handleProps(el, vnode.props);
9581
+ removeAttribute(el);
9582
+ toggleLoading(el, binding);
9583
+ }
9584
+ };
9376
9585
  var Select = defineComponent({
9377
9586
  name: "DSelect",
9587
+ directives: {
9588
+ dLoading: LoadingDirective
9589
+ },
9378
9590
  props: selectProps,
9379
9591
  emits: ["toggle-change", "value-change", "update:modelValue", "focus", "blur", "remove-tag", "clear", "input-change"],
9380
9592
  setup(props, ctx) {
@@ -9504,7 +9716,7 @@ var Select = defineComponent({
9504
9716
  }, {
9505
9717
  default: () => {
9506
9718
  var _a, _b, _c, _d;
9507
- return [createVNode("div", {
9719
+ return [withDirectives(createVNode("div", {
9508
9720
  "class": dropdownCls,
9509
9721
  "style": {
9510
9722
  width: `${dropdownWidth.value}`
@@ -9532,9 +9744,9 @@ var Select = defineComponent({
9532
9744
  "label": item.name,
9533
9745
  "disabled": isDisabled(item)
9534
9746
  }, null) : item.name || item.value]
9535
- }))]), [[vShow, !isLoading.value]]), isShowEmptyText.value && createVNode("div", null, [((_c = ctx.slots) == null ? void 0 : _c.empty) && ctx.slots.empty(), !((_d = ctx.slots) == null ? void 0 : _d.empty) && createVNode("p", {
9747
+ }))]), [[vShow, !isLoading.value]]), (isLoading.value || isShowEmptyText.value) && createVNode("div", null, [((_c = ctx.slots) == null ? void 0 : _c.empty) && ctx.slots.empty(), !((_d = ctx.slots) == null ? void 0 : _d.empty) && createVNode("p", {
9536
9748
  "class": dropdownEmptyCls
9537
- }, [emptyText.value])])])];
9749
+ }, [emptyText.value])])]), [[resolveDirective("dLoading"), isLoading.value]])];
9538
9750
  }
9539
9751
  }), [[vShow, isOpen.value]])]
9540
9752
  })]