lew-ui 2.4.5 → 2.4.7

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/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { h as h$1, defineComponent, openBlock, createBlock, resolveDynamicComponent, normalizeClass, normalizeStyle, unref, createApp, computed, createElementBlock, renderSlot, getCurrentScope, onScopeDispose, toRef as toRef$1, readonly, customRef, ref, onMounted, nextTick, getCurrentInstance, shallowRef, watch, toRefs, mergeModels, useModel, reactive, withCtx, createElementVNode, createVNode, Transition, createCommentVNode, withModifiers, withDirectives, toDisplayString, vShow, Fragment, renderList, createTextVNode, resolveDirective, isRef, vModelText, mergeProps, createSlots, onUnmounted, vModelDynamic, watchEffect, TransitionGroup, resolveComponent, toRaw, vModelCheckbox, onActivated, normalizeProps, guardReactiveProps, Teleport, provide, inject } from "vue";
1
+ import { h as h$1, defineComponent, openBlock, createBlock, resolveDynamicComponent, normalizeClass, normalizeStyle, unref, createApp, computed, createElementBlock, renderSlot, getCurrentScope, onScopeDispose, toRef as toRef$1, readonly, customRef, ref, onMounted, nextTick, getCurrentInstance, shallowRef, watch, toRefs, mergeModels, useModel, reactive, withCtx, createElementVNode, createVNode, Transition, createCommentVNode, withModifiers, withDirectives, toDisplayString, vShow, Fragment, renderList, createTextVNode, resolveDirective, isRef, vModelText, mergeProps, createSlots, onUnmounted, vModelDynamic, watchEffect, TransitionGroup, toRaw, vModelCheckbox, resolveComponent, onActivated, normalizeProps, guardReactiveProps, Teleport, provide, inject } from "vue";
2
2
  const flexProps = {
3
3
  direction: {
4
4
  type: String,
@@ -7777,14 +7777,13 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
7777
7777
  getWidth
7778
7778
  });
7779
7779
  return (_ctx, _cache) => {
7780
- const _component_lew_flex = resolveComponent("lew-flex");
7781
7780
  return openBlock(), createElementBlock("div", {
7782
7781
  ref_key: "formLabelRef",
7783
7782
  ref: formLabelRef,
7784
7783
  class: "lew-get-label-width-box"
7785
7784
  }, [
7786
7785
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (item, index2) => {
7787
- return openBlock(), createBlock(_component_lew_flex, {
7786
+ return openBlock(), createBlock(unref(LewFlex), {
7788
7787
  gap: "5",
7789
7788
  style: normalizeStyle({
7790
7789
  fontSize: `var(--lew-form-font-size-${__props.size})`
@@ -7805,7 +7804,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
7805
7804
  };
7806
7805
  }
7807
7806
  });
7808
- const LewGetLabelWidth = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__scopeId", "data-v-27f672b0"]]);
7807
+ const LewGetLabelWidth = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__scopeId", "data-v-792e52a4"]]);
7809
7808
  const _sfc_main$J = /* @__PURE__ */ defineComponent({
7810
7809
  __name: "LewFormItem",
7811
7810
  props: /* @__PURE__ */ mergeModels(formItemProps, {
@@ -7816,6 +7815,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
7816
7815
  }),
7817
7816
  emits: /* @__PURE__ */ mergeModels(["change"], ["update:modelValue"]),
7818
7817
  setup(__props, { expose: __expose, emit: __emit }) {
7818
+ var _a;
7819
7819
  const asMap = {
7820
7820
  input: LewInput,
7821
7821
  textarea: LewTextarea,
@@ -7834,6 +7834,10 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
7834
7834
  upload: LewUpload,
7835
7835
  "input-number": LewInputNumber
7836
7836
  };
7837
+ const app = (_a = getCurrentInstance()) == null ? void 0 : _a.appContext.app;
7838
+ if (app && !app.directive("tooltip")) {
7839
+ app.use(LewTooltip);
7840
+ }
7837
7841
  const getFormItemClassNames = computed(() => {
7838
7842
  const { direction, size } = cloneDeep(props);
7839
7843
  return object2class("lew-form-item", { direction, size });
@@ -7877,7 +7881,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
7877
7881
  };
7878
7882
  __expose({ validate, setError });
7879
7883
  return (_ctx, _cache) => {
7880
- var _a;
7884
+ var _a2;
7881
7885
  const _directive_tooltip = resolveDirective("tooltip");
7882
7886
  return openBlock(), createElementBlock("div", {
7883
7887
  class: normalizeClass(["lew-form-item", unref(getFormItemClassNames)]),
@@ -7909,7 +7913,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
7909
7913
  createElementVNode("div", {
7910
7914
  class: normalizeClass(["lew-form-item-main", { "lew-form-item-error": unref(errMsg) }]),
7911
7915
  style: normalizeStyle({
7912
- width: _ctx.direction === "x" ? `calc(${(_a = unref(formItemRef)) == null ? void 0 : _a.offsetWidth}px - ${unref(any2px)(_ctx.labelWidth)} - 10px)` : "100%",
7916
+ width: _ctx.direction === "x" ? `calc(${(_a2 = unref(formItemRef)) == null ? void 0 : _a2.offsetWidth}px - ${unref(any2px)(_ctx.labelWidth)} - 10px)` : "100%",
7913
7917
  justifyContent: _ctx.direction === "x" && _ctx.between ? "flex-end" : "flex-start"
7914
7918
  })
7915
7919
  }, [
@@ -7933,7 +7937,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
7933
7937
  };
7934
7938
  }
7935
7939
  });
7936
- const LewFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-87f45791"]]);
7940
+ const LewFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-ddaaa50f"]]);
7937
7941
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
7938
7942
  function getDefaultExportFromCjs(x2) {
7939
7943
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
@@ -9774,7 +9778,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
9774
9778
  };
9775
9779
  }
9776
9780
  });
9777
- const LewForm = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__scopeId", "data-v-0b1e5560"]]);
9781
+ const LewForm = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__scopeId", "data-v-d8f3f2f7"]]);
9778
9782
  const checkboxModel = {
9779
9783
  modelValue: {
9780
9784
  type: Boolean,
@@ -10302,8 +10306,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
10302
10306
  });
10303
10307
  });
10304
10308
  return (_ctx, _cache) => {
10305
- const _component_lew_flex = resolveComponent("lew-flex");
10306
- return openBlock(), createBlock(_component_lew_flex, {
10309
+ return openBlock(), createBlock(unref(LewFlex), {
10307
10310
  x: "start",
10308
10311
  gap: "10",
10309
10312
  class: normalizeClass(["lew-radio-group", unref(getRadioGroupClassName)]),
@@ -10329,7 +10332,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
10329
10332
  };
10330
10333
  }
10331
10334
  });
10332
- const LewRadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-54a1b5ef"]]);
10335
+ const LewRadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-edc6d013"]]);
10333
10336
  const selectModel = {
10334
10337
  modelValue: {
10335
10338
  type: [String, Number, void 0],
@@ -10991,7 +10994,6 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
10991
10994
  });
10992
10995
  __expose({ show, hide: hide2 });
10993
10996
  return (_ctx, _cache) => {
10994
- const _component_lew_empty = resolveComponent("lew-empty");
10995
10997
  return openBlock(), createBlock(unref(_sfc_main$k), {
10996
10998
  ref_key: "lewPopoverRef",
10997
10999
  ref: lewPopoverRef,
@@ -11140,7 +11142,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
11140
11142
  class: "lew-not-found"
11141
11143
  }, {
11142
11144
  default: withCtx(() => [
11143
- createVNode(_component_lew_empty, { title: "暂无结果" })
11145
+ createVNode(unref(_sfc_main$d), { title: "暂无结果" })
11144
11146
  ]),
11145
11147
  _: 1
11146
11148
  }))
@@ -11195,7 +11197,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
11195
11197
  };
11196
11198
  }
11197
11199
  });
11198
- const LewSelectMultiple = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-3ebc2970"]]);
11200
+ const LewSelectMultiple = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-77cedcac"]]);
11199
11201
  const switchModel = {
11200
11202
  modelValue: {
11201
11203
  type: Boolean,
@@ -19103,6 +19105,11 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
19103
19105
  }),
19104
19106
  emits: /* @__PURE__ */ mergeModels(["change"], ["update:modelValue"]),
19105
19107
  setup(__props, { emit: __emit }) {
19108
+ var _a;
19109
+ const app = (_a = getCurrentInstance()) == null ? void 0 : _a.appContext.app;
19110
+ if (app && !app.directive("tooltip")) {
19111
+ app.use(LewTooltip);
19112
+ }
19106
19113
  const { isSupported } = useClipboardItems({ read: true });
19107
19114
  const tipFontSizeMap = {
19108
19115
  small: 14,
@@ -19374,12 +19381,12 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
19374
19381
  default: withCtx(() => [
19375
19382
  withDirectives(createElementVNode("label", {
19376
19383
  onMouseenter: _cache[2] || (_cache[2] = ($event) => {
19377
- var _a;
19378
- return (_a = unref(inputPasteRef)) == null ? void 0 : _a.focus();
19384
+ var _a2;
19385
+ return (_a2 = unref(inputPasteRef)) == null ? void 0 : _a2.focus();
19379
19386
  }),
19380
19387
  onMouseleave: _cache[3] || (_cache[3] = ($event) => {
19381
- var _a;
19382
- return (_a = unref(inputPasteRef)) == null ? void 0 : _a.blur();
19388
+ var _a2;
19389
+ return (_a2 = unref(inputPasteRef)) == null ? void 0 : _a2.blur();
19383
19390
  }),
19384
19391
  class: normalizeClass(["lew-upload-label", unref(getUploadLabelClass)]),
19385
19392
  style: { "width": "100%" }
@@ -19655,7 +19662,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
19655
19662
  };
19656
19663
  }
19657
19664
  });
19658
- const LewUpload = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-6be88b57"]]);
19665
+ const LewUpload = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-6c2e3992"]]);
19659
19666
  const collapseModel = {
19660
19667
  modelValue: {
19661
19668
  type: [Array, String],
@@ -24050,7 +24057,7 @@ const LewTooltip = {
24050
24057
  install(app) {
24051
24058
  app.directive("tooltip", {
24052
24059
  mounted(el, binding) {
24053
- var _a;
24060
+ var _a, _b, _c;
24054
24061
  const { trigger, content, placement, allowHTML, delay } = binding.value;
24055
24062
  let _trigger = trigger;
24056
24063
  if (trigger === "hover") {
@@ -24073,29 +24080,31 @@ const LewTooltip = {
24073
24080
  duration: [250, 250],
24074
24081
  delay: trigger === "mouseenter" ? delay || [80, 80] : void 0
24075
24082
  });
24076
- el.instance.popper.children[0].setAttribute("data-lew", "tooltip");
24077
- if (!((_a = binding == null ? void 0 : binding.value) == null ? void 0 : _a.content)) {
24078
- el.instance.disable();
24083
+ (_a = el.instance) == null ? void 0 : _a.popper.children[0].setAttribute("data-lew", "tooltip");
24084
+ if (!((_b = binding == null ? void 0 : binding.value) == null ? void 0 : _b.content)) {
24085
+ (_c = el.instance) == null ? void 0 : _c.disable();
24079
24086
  }
24080
24087
  },
24081
24088
  updated(el, binding) {
24089
+ var _a, _b, _c, _d, _e;
24082
24090
  const { triggerFrom, content } = binding.value;
24083
24091
  if (!content) {
24084
- el.instance.disable();
24092
+ (_a = el.instance) == null ? void 0 : _a.disable();
24085
24093
  } else {
24086
- el.instance.enable();
24087
- el.instance.setContent(content);
24094
+ (_b = el.instance) == null ? void 0 : _b.enable();
24095
+ (_c = el.instance) == null ? void 0 : _c.setContent(content);
24088
24096
  }
24089
24097
  if (triggerFrom === "input-number") {
24090
24098
  if (content) {
24091
- el.instance.show();
24099
+ (_d = el.instance) == null ? void 0 : _d.show();
24092
24100
  } else {
24093
- el.instance.hide();
24101
+ (_e = el.instance) == null ? void 0 : _e.hide();
24094
24102
  }
24095
24103
  }
24096
24104
  },
24097
24105
  unmounted(el) {
24098
- el.instance.hide();
24106
+ var _a;
24107
+ (_a = el.instance) == null ? void 0 : _a.hide();
24099
24108
  el.instance = null;
24100
24109
  }
24101
24110
  });