@touchvue/plugin 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/index.mjs CHANGED
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { defineComponent, ref, computed, resolveComponent, resolveDirective, withDirectives, openBlock, createElementBlock, normalizeClass, normalizeStyle, createBlock, createCommentVNode, createElementVNode, renderSlot, getCurrentInstance, nextTick, render, createVNode, inject, watch, unref, withKeys, vShow, toDisplayString, Fragment, renderList, vModelSelect, createTextVNode, withCtx, withModifiers, onMounted, useSlots, onBeforeUnmount, provide, vModelText, vModelDynamic, isVNode, useAttrs, resolveDynamicComponent, mergeProps, h, isRef, reactive, createSlots, normalizeProps, guardReactiveProps, onDeactivated, onActivated, Transition, onUnmounted, useCssVars, markRaw, toRaw } from "vue";
7
+ import { defineComponent, ref, computed, resolveComponent, resolveDirective, withDirectives, openBlock, createElementBlock, normalizeClass, normalizeStyle, createBlock, createCommentVNode, createElementVNode, renderSlot, getCurrentInstance, nextTick, render, createVNode, onMounted, watchEffect, onUnmounted, inject, watch, unref, withKeys, vShow, toDisplayString, Fragment, renderList, vModelSelect, createTextVNode, withCtx, Teleport, withModifiers, useSlots, onBeforeUnmount, provide, vModelText, vModelDynamic, isVNode, useAttrs, resolveDynamicComponent, mergeProps, h, isRef, reactive, createSlots, normalizeProps, guardReactiveProps, onDeactivated, onActivated, Transition, useCssVars, markRaw, toRaw } from "vue";
8
8
  const withInstall = (main, extra) => {
9
9
  main.install = (app) => {
10
10
  for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
@@ -4103,6 +4103,33 @@ function matchFormat(input, format2) {
4103
4103
  const regex = new RegExp(`^${regexStr}$`);
4104
4104
  return regex.test(input);
4105
4105
  }
4106
+ function format$1(date, fmt) {
4107
+ const o = {
4108
+ "M+": date.getMonth() + 1,
4109
+ // 月份
4110
+ "d+": date.getDate(),
4111
+ // 日
4112
+ "h+": date.getHours(),
4113
+ // 小时
4114
+ "m+": date.getMinutes(),
4115
+ // 分
4116
+ "s+": date.getSeconds(),
4117
+ // 秒
4118
+ "q+": Math.floor((date.getMonth() + 3) / 3),
4119
+ // 季度
4120
+ S: date.getMilliseconds()
4121
+ // 毫秒
4122
+ };
4123
+ if (/(y+)/.test(fmt)) {
4124
+ fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
4125
+ }
4126
+ for (const k in o) {
4127
+ if (new RegExp("(" + k + ")").test(fmt)) {
4128
+ fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
4129
+ }
4130
+ }
4131
+ return fmt;
4132
+ }
4106
4133
  function handleBeforeChange(beforeChange, value) {
4107
4134
  return new Promise((resolve, reject) => {
4108
4135
  try {
@@ -4396,26 +4423,99 @@ function getBody(xhr) {
4396
4423
  try {
4397
4424
  return JSON.parse(text2);
4398
4425
  } catch (e) {
4399
- return text2;
4426
+ return {
4427
+ rawText: text2,
4428
+ parseError: {
4429
+ message: e.message,
4430
+ stack: e.stack
4431
+ }
4432
+ };
4400
4433
  }
4401
4434
  }
4402
4435
  const fileAjax = (option) => {
4403
4436
  if (typeof XMLHttpRequest === "undefined") {
4437
+ option.onError(
4438
+ {
4439
+ type: "network_error",
4440
+ message: "当前环境不支持 XMLHttpRequest",
4441
+ status: 0
4442
+ },
4443
+ 0
4444
+ );
4404
4445
  return;
4405
4446
  }
4406
4447
  const xhr = new XMLHttpRequest();
4407
4448
  const action = option.action;
4408
4449
  xhr.onerror = function error(e) {
4409
- option.onError(e, xhr.status);
4450
+ option.onError(
4451
+ {
4452
+ type: "network_error",
4453
+ message: "网络请求失败",
4454
+ status: xhr.status,
4455
+ event: e
4456
+ },
4457
+ xhr.status
4458
+ );
4459
+ };
4460
+ xhr.upload.addEventListener(
4461
+ "progress",
4462
+ function(e) {
4463
+ option.onProgress(e);
4464
+ },
4465
+ false
4466
+ );
4467
+ xhr.ontimeout = function(e) {
4468
+ option.onError(
4469
+ {
4470
+ type: "network_error",
4471
+ message: "文件上传请求超时",
4472
+ status: 0,
4473
+ event: e
4474
+ },
4475
+ 0
4476
+ );
4410
4477
  };
4411
- xhr.upload.addEventListener("progress", function(e) {
4412
- option.onProgress(e);
4413
- });
4414
4478
  xhr.onload = function onload() {
4415
- if (xhr.status < 200 || xhr.status >= 300) {
4416
- return option.onError("response" in xhr ? xhr.response : getBody(xhr), xhr.status);
4479
+ if (xhr.status >= 200 && xhr.status < 300) {
4480
+ const response = getBody(xhr);
4481
+ if (response == null ? void 0 : response.parseError) {
4482
+ option.onError(
4483
+ {
4484
+ type: "parse_error",
4485
+ message: `响应内容解析失败: ${response.parseError.message}`,
4486
+ status: xhr.status,
4487
+ response: response.rawText
4488
+ },
4489
+ xhr.status
4490
+ );
4491
+ return;
4492
+ }
4493
+ option.onSuccess(response, xhr.status);
4494
+ } else {
4495
+ const response = getBody(xhr);
4496
+ option.onError(
4497
+ {
4498
+ type: "http_error",
4499
+ message: `HTTP请求失败: ${xhr.status} ${xhr.statusText}`,
4500
+ status: xhr.status,
4501
+ response,
4502
+ // 补充返回状态文本,方便调试
4503
+ statusText: xhr.statusText
4504
+ },
4505
+ xhr.status
4506
+ );
4417
4507
  }
4418
- option.onSuccess("response" in xhr ? xhr.response : getBody(xhr), xhr.status);
4508
+ };
4509
+ xhr.onabort = function(e) {
4510
+ option.onError(
4511
+ {
4512
+ type: "network_error",
4513
+ message: "请求被手动取消",
4514
+ status: 0,
4515
+ event: e
4516
+ },
4517
+ 0
4518
+ );
4419
4519
  };
4420
4520
  xhr.open("post", action, true);
4421
4521
  if (option.withCredentials && "withCredentials" in xhr) {
@@ -5677,6 +5777,29 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
5677
5777
  props: selectProps,
5678
5778
  emits: ["change", "select", "update:modelValue", "option-loaded"],
5679
5779
  setup(__props, { expose: __expose, emit: __emit }) {
5780
+ const currentScale = ref(1);
5781
+ const calcScale = () => {
5782
+ if (!$el.value)
5783
+ return;
5784
+ const layoutWidth = $el.value.offsetWidth;
5785
+ if (layoutWidth === 0)
5786
+ return;
5787
+ const visualWidth = $el.value.getBoundingClientRect().width;
5788
+ currentScale.value = Number((visualWidth / layoutWidth).toFixed(4));
5789
+ };
5790
+ onMounted(() => {
5791
+ calcScale();
5792
+ window.addEventListener("resize", calcScale);
5793
+ const stopWatch = watchEffect(() => {
5794
+ if ($el.value) {
5795
+ calcScale();
5796
+ }
5797
+ });
5798
+ onUnmounted(() => {
5799
+ window.removeEventListener("resize", calcScale);
5800
+ stopWatch();
5801
+ });
5802
+ });
5680
5803
  const props = __props;
5681
5804
  const emit = __emit;
5682
5805
  const ToForm = inject("ToForm", null);
@@ -5692,7 +5815,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
5692
5815
  const focused = ref(false);
5693
5816
  const blurByLayer = ref(false);
5694
5817
  const layerSlide = ref(false);
5695
- const layerPosition = ref("auto");
5818
+ const layerPosition = ref("");
5696
5819
  const disabled = ref(props.disabled);
5697
5820
  const isChanging = ref(false);
5698
5821
  const filterValue = ref("");
@@ -6146,16 +6269,6 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
6146
6269
  }
6147
6270
  return arr;
6148
6271
  });
6149
- const getDynamicHeight = computed(() => {
6150
- if (!trigger.value || !optionLayer.value)
6151
- return "";
6152
- const triggerRect = trigger.value.getBoundingClientRect();
6153
- const windowHeight = window.innerHeight;
6154
- const distanceToBottom = windowHeight - triggerRect.bottom;
6155
- const distanceToTop = triggerRect.top;
6156
- const maxHeight = Math.max(distanceToBottom, distanceToTop) * 0.8;
6157
- return `${maxHeight}px`;
6158
- });
6159
6272
  const change = (value, option) => {
6160
6273
  if (props.beforeChange) {
6161
6274
  let result = props.beforeChange(value, option);
@@ -6717,6 +6830,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
6717
6830
  ref: input,
6718
6831
  modelValue: inputValue.value,
6719
6832
  "onUpdate:modelValue": ($event) => inputValue.value = $event,
6833
+ disabled: disabled.value,
6720
6834
  "sp-chars": _ctx.spChars,
6721
6835
  tabindex: _ctx.tabindex,
6722
6836
  clearable: _ctx.clearable,
@@ -6727,13 +6841,14 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
6727
6841
  onFocus: inputFocus,
6728
6842
  onKeyup: inputInput,
6729
6843
  onBlur: inputBlur
6730
- }, null, 8, ["modelValue", "onUpdate:modelValue", "sp-chars", "tabindex", "clearable", "placeholder"])) : createCommentVNode("", true),
6844
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "sp-chars", "tabindex", "clearable", "placeholder"])) : createCommentVNode("", true),
6731
6845
  _ctx.filterable ? (openBlock(), createBlock(unref(ToInput), {
6732
6846
  key: 1,
6733
6847
  ref_key: "filter",
6734
6848
  ref: filter,
6735
6849
  modelValue: filterValue.value,
6736
6850
  "onUpdate:modelValue": ($event) => filterValue.value = $event,
6851
+ disabled: disabled.value,
6737
6852
  "focus-when-clear": _ctx.focusWhenClear,
6738
6853
  "sp-chars": _ctx.inputable ? _ctx.spChars : false,
6739
6854
  tabindex: _ctx.tabindex,
@@ -6746,11 +6861,12 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
6746
6861
  onFocus: filterFocus,
6747
6862
  onKeyup: filterInput,
6748
6863
  onBlur: filterBlur
6749
- }, null, 8, ["modelValue", "onUpdate:modelValue", "focus-when-clear", "sp-chars", "tabindex", "clearable", "placeholder"])) : createCommentVNode("", true),
6864
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "focus-when-clear", "sp-chars", "tabindex", "clearable", "placeholder"])) : createCommentVNode("", true),
6750
6865
  _ctx.setDataFn ? (openBlock(), createBlock(unref(ToInput), {
6751
6866
  key: 2,
6752
6867
  modelValue: setDataInputValue.value,
6753
6868
  "onUpdate:modelValue": ($event) => setDataInputValue.value = $event,
6869
+ disabled: disabled.value,
6754
6870
  "sp-chars": _ctx.inputable ? _ctx.spChars : false,
6755
6871
  tabindex: _ctx.tabindex,
6756
6872
  clearable: _ctx.clearable,
@@ -6762,7 +6878,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
6762
6878
  onFocus: filterFocus,
6763
6879
  onKeyup: filterInput,
6764
6880
  onBlur: filterBlur
6765
- }, null, 8, ["modelValue", "onUpdate:modelValue", "sp-chars", "tabindex", "clearable", "placeholder"])) : createCommentVNode("", true)
6881
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "sp-chars", "tabindex", "clearable", "placeholder"])) : createCommentVNode("", true)
6766
6882
  ]))
6767
6883
  ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
6768
6884
  unref(selected).filter((item) => !item.hide).length === 0 && !_ctx.inputable && !_ctx.filterable && !_ctx.setDataFn ? (openBlock(), createElementBlock("span", {
@@ -6882,433 +6998,434 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
6882
6998
  [unref(vColorDirective), "danger"]
6883
6999
  ]) : createCommentVNode("", true)
6884
7000
  ], 512),
6885
- createVNode(unref(ToFloat), {
6886
- ref_key: "optionLayer",
6887
- ref: optionLayer,
6888
- class: normalizeClass(["to-select-option", setOptionClass.value]),
6889
- align: _ctx.optionDisplay === "popup" ? "center" : _ctx.optionAlign,
6890
- lazy: _ctx.lazy,
6891
- width: iOptionWidth.value,
6892
- slide: layerSlide.value,
6893
- position: layerPosition.value,
6894
- onClosed: layerClose,
6895
- onMousedown: layerMousedown,
6896
- onBeforeOpen: layerOpen
6897
- }, {
6898
- default: withCtx(() => [
6899
- dataLoading.value ? withDirectives((openBlock(), createBlock(unref(ToPadding), {
6900
- key: 0,
6901
- value: 2
7001
+ (openBlock(), createBlock(Teleport, { to: "body" }, [
7002
+ createElementVNode("div", {
7003
+ class: normalizeClass(["to-select", unref(setClass)])
7004
+ }, [
7005
+ createVNode(unref(ToFloat), {
7006
+ ref_key: "optionLayer",
7007
+ ref: optionLayer,
7008
+ style: normalizeStyle({ transform: `scale(${currentScale.value})`, transformOrigin: "left top" }),
7009
+ global: false,
7010
+ class: normalizeClass(["to-select-option", setOptionClass.value]),
7011
+ align: _ctx.optionDisplay === "popup" ? "center" : _ctx.optionAlign,
7012
+ width: iOptionWidth.value,
7013
+ slide: layerSlide.value,
7014
+ position: layerPosition.value,
7015
+ onClosed: layerClose,
7016
+ onMousedown: layerMousedown,
7017
+ onBeforeOpen: layerOpen
6902
7018
  }, {
6903
7019
  default: withCtx(() => [
6904
- createVNode(unref(ToIcon), { value: "loading" })
6905
- ]),
6906
- _: 1
6907
- })), [
6908
- [_directive_align, "center"]
6909
- ]) : renderSlot(_ctx.$slots, "default", {
6910
- key: 1,
6911
- data: options.value
6912
- }, () => [
6913
- _ctx.optionDisplay === "popup" || (_ctx.inputable || _ctx.filterable) && unref($phone) ? (openBlock(), createBlock(unref(ToGrid), {
6914
- key: 0,
6915
- style: { "width": "100%" },
6916
- type: "v"
6917
- }, {
6918
- default: withCtx(() => [
6919
- createVNode(unref(ToGridItem), {
6920
- side: "",
6921
- width: "full"
7020
+ dataLoading.value ? withDirectives((openBlock(), createBlock(unref(ToPadding), {
7021
+ key: 0,
7022
+ value: 2
7023
+ }, {
7024
+ default: withCtx(() => [
7025
+ createVNode(unref(ToIcon), { value: "loading" })
7026
+ ]),
7027
+ _: 1
7028
+ })), [
7029
+ [_directive_align, "center"]
7030
+ ]) : renderSlot(_ctx.$slots, "default", {
7031
+ key: 1,
7032
+ data: options.value
7033
+ }, () => [
7034
+ _ctx.optionDisplay === "popup" || (_ctx.inputable || _ctx.filterable) && unref($phone) ? (openBlock(), createBlock(unref(ToGrid), {
7035
+ key: 0,
7036
+ style: { "width": "100%" },
7037
+ type: "v"
6922
7038
  }, {
6923
7039
  default: withCtx(() => [
6924
- createVNode(unref(ToPadding), { value: "1" }, {
7040
+ createVNode(unref(ToGridItem), {
7041
+ side: "",
7042
+ width: "full"
7043
+ }, {
6925
7044
  default: withCtx(() => [
6926
- createVNode(unref(ToHeader), {
6927
- level: "0",
6928
- title: validateDesc.value ? unref(t)("to.select.float.title", validateDesc.value) : unref(t)("to.select.float.titlePlaceholder", validateDesc.value),
6929
- onBack: ($event) => closeLayer()
6930
- }, {
7045
+ createVNode(unref(ToPadding), { value: "1" }, {
6931
7046
  default: withCtx(() => [
6932
- createVNode(unref(ToButton), {
6933
- fillet: "normal",
6934
- icon: "close",
6935
- mode: "none",
6936
- color: "primary",
6937
- onClick: ($event) => (clear(), closeLayer())
7047
+ createVNode(unref(ToHeader), {
7048
+ level: "0",
7049
+ title: validateDesc.value ? unref(t)("to.select.float.title", validateDesc.value) : unref(t)("to.select.float.titlePlaceholder", validateDesc.value),
7050
+ onBack: ($event) => closeLayer()
6938
7051
  }, {
6939
7052
  default: withCtx(() => [
6940
- createTextVNode(toDisplayString(unref(t)("to.common.clear")), 1)
7053
+ createVNode(unref(ToButton), {
7054
+ fillet: "normal",
7055
+ icon: "close",
7056
+ mode: "none",
7057
+ color: "primary",
7058
+ onClick: ($event) => (clear(), closeLayer())
7059
+ }, {
7060
+ default: withCtx(() => [
7061
+ createTextVNode(toDisplayString(unref(t)("to.common.clear")), 1)
7062
+ ]),
7063
+ _: 1
7064
+ }, 8, ["onClick"])
6941
7065
  ]),
6942
7066
  _: 1
6943
- }, 8, ["onClick"])
7067
+ }, 8, ["title", "onBack"])
6944
7068
  ]),
6945
7069
  _: 1
6946
- }, 8, ["title", "onBack"])
6947
- ]),
6948
- _: 1
6949
- }),
6950
- _ctx.filterable || _ctx.inputable ? (openBlock(), createBlock(unref(ToPadding), {
6951
- key: 0,
6952
- position: "side",
6953
- value: "1"
6954
- }, {
6955
- default: withCtx(() => [
6956
- _ctx.multiple ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
6957
- _ctx.inputable ? (openBlock(), createElementBlock("span", {
6958
- key: 0,
6959
- class: normalizeClass(["to-select to-select-arrow-none", _ctx.fillet === "normal" ? "to-input-fillet-normal" : ""]),
6960
- style: { "width": "100%" }
6961
- }, [
6962
- createElementVNode("span", { class: "to-select-content" }, [
6963
- createElementVNode("span", { class: "to-select-tag" }, [
6964
- unref(selected).length > 0 && !(isAll.value && _ctx.useAllText) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(selected), (item, index) => {
6965
- return openBlock(), createElementBlock(Fragment, null, [
6966
- !item.hide ? (openBlock(), createBlock(unref(ToTag), {
6967
- key: index,
6968
- color: "fg",
6969
- mode: "plain",
6970
- removable: _ctx.removable && !disabled.value,
6971
- onRemove: ($event) => removeTag(item)
7070
+ }),
7071
+ _ctx.filterable || _ctx.inputable ? (openBlock(), createBlock(unref(ToPadding), {
7072
+ key: 0,
7073
+ position: "side",
7074
+ value: "1"
7075
+ }, {
7076
+ default: withCtx(() => [
7077
+ _ctx.multiple ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
7078
+ _ctx.inputable ? (openBlock(), createElementBlock("span", {
7079
+ key: 0,
7080
+ class: normalizeClass(["to-select to-select-arrow-none", _ctx.fillet === "normal" ? "to-input-fillet-normal" : ""]),
7081
+ style: { "width": "100%" }
7082
+ }, [
7083
+ createElementVNode("span", { class: "to-select-content" }, [
7084
+ createElementVNode("span", { class: "to-select-tag" }, [
7085
+ unref(selected).length > 0 && !(isAll.value && _ctx.useAllText) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(selected), (item, index) => {
7086
+ return openBlock(), createElementBlock(Fragment, null, [
7087
+ !item.hide ? (openBlock(), createBlock(unref(ToTag), {
7088
+ key: index,
7089
+ color: "fg",
7090
+ mode: "plain",
7091
+ removable: _ctx.removable && !disabled.value,
7092
+ onRemove: ($event) => removeTag(item)
7093
+ }, {
7094
+ default: withCtx(() => [
7095
+ createTextVNode(toDisplayString(item[iLabelText.value]), 1)
7096
+ ]),
7097
+ _: 2
7098
+ }, 1032, ["removable", "onRemove"])) : createCommentVNode("", true)
7099
+ ], 64);
7100
+ }), 256)) : createCommentVNode("", true),
7101
+ _ctx.filterable ? (openBlock(), createBlock(unref(ToInput), {
7102
+ key: 1,
7103
+ ref_key: "popupFilter",
7104
+ ref: popupFilter,
7105
+ modelValue: multipleFilterValue.value,
7106
+ "onUpdate:modelValue": ($event) => multipleFilterValue.value = $event,
7107
+ "sp-chars": _ctx.spChars,
7108
+ "prevent-focus": "",
7109
+ mode: "none",
7110
+ placeholder: unref(selected).filter((item) => !item.hide).length > 0 ? "" : _ctx.placeholder
6972
7111
  }, {
6973
7112
  default: withCtx(() => [
6974
- createTextVNode(toDisplayString(item[iLabelText.value]), 1)
7113
+ createVNode(unref(ToButton), {
7114
+ icon: "ok",
7115
+ mode: "none",
7116
+ color: "primary",
7117
+ onClick: enter
7118
+ })
6975
7119
  ]),
6976
- _: 2
6977
- }, 1032, ["removable", "onRemove"])) : createCommentVNode("", true)
6978
- ], 64);
6979
- }), 256)) : createCommentVNode("", true),
6980
- _ctx.filterable ? (openBlock(), createBlock(unref(ToInput), {
6981
- key: 1,
6982
- ref_key: "popupFilter",
6983
- ref: popupFilter,
6984
- modelValue: multipleFilterValue.value,
6985
- "onUpdate:modelValue": ($event) => multipleFilterValue.value = $event,
6986
- "sp-chars": _ctx.spChars,
6987
- "prevent-focus": "",
6988
- mode: "none",
6989
- placeholder: unref(selected).filter((item) => !item.hide).length > 0 ? "" : _ctx.placeholder
6990
- }, {
6991
- default: withCtx(() => [
6992
- createVNode(unref(ToButton), {
6993
- icon: "ok",
6994
- mode: "none",
6995
- color: "primary",
6996
- onClick: enter
6997
- })
6998
- ]),
6999
- _: 1
7000
- }, 8, ["modelValue", "onUpdate:modelValue", "sp-chars", "placeholder"])) : (openBlock(), createBlock(unref(ToInput), {
7001
- key: 2,
7002
- ref_key: "popupInput",
7003
- ref: popupInput,
7004
- modelValue: multipleInputValue.value,
7005
- "onUpdate:modelValue": ($event) => multipleInputValue.value = $event,
7006
- "prevent-focus": "",
7007
- mode: "none",
7008
- placeholder: unref(selected).filter((item) => !item.hide).length > 0 ? "" : _ctx.placeholder
7009
- }, {
7010
- default: withCtx(() => [
7011
- createVNode(unref(ToButton), {
7012
- icon: "ok",
7120
+ _: 1
7121
+ }, 8, ["modelValue", "onUpdate:modelValue", "sp-chars", "placeholder"])) : (openBlock(), createBlock(unref(ToInput), {
7122
+ key: 2,
7123
+ ref_key: "popupInput",
7124
+ ref: popupInput,
7125
+ modelValue: multipleInputValue.value,
7126
+ "onUpdate:modelValue": ($event) => multipleInputValue.value = $event,
7127
+ "prevent-focus": "",
7013
7128
  mode: "none",
7014
- color: "primary",
7015
- onClick: enter
7016
- })
7017
- ]),
7018
- _: 1
7019
- }, 8, ["modelValue", "onUpdate:modelValue", "placeholder"]))
7020
- ])
7021
- ])
7022
- ], 2)) : (openBlock(), createBlock(unref(ToInput), {
7023
- key: 1,
7024
- ref_key: "popupFilter",
7025
- ref: popupFilter,
7026
- modelValue: multipleFilterValue.value,
7027
- "onUpdate:modelValue": ($event) => multipleFilterValue.value = $event,
7028
- "sp-chars": false,
7029
- width: "full",
7030
- "prevent-focus": "",
7031
- placeholder: unref(selected).filter((item) => !item.hide).length > 0 ? "" : _ctx.placeholder
7032
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"]))
7033
- ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
7034
- _ctx.inputable ? (openBlock(), createBlock(unref(ToInput), {
7035
- key: 0,
7036
- ref_key: "popupInput",
7037
- ref: popupInput,
7038
- modelValue: inputValue.value,
7039
- "onUpdate:modelValue": ($event) => inputValue.value = $event,
7040
- "sp-chars": _ctx.spChars,
7041
- "prevent-focus": "",
7042
- width: "full",
7043
- placeholder: _ctx.placeholder
7044
- }, null, 8, ["modelValue", "onUpdate:modelValue", "sp-chars", "placeholder"])) : (openBlock(), createBlock(unref(ToInput), {
7045
- key: 1,
7046
- ref_key: "popupFilter",
7047
- ref: popupFilter,
7048
- modelValue: filterValue.value,
7049
- "onUpdate:modelValue": ($event) => filterValue.value = $event,
7050
- "sp-chars": false,
7051
- "prevent-focus": "",
7052
- width: "full",
7053
- placeholder: "筛选",
7054
- onClear: filterClear
7055
- }, null, 8, ["modelValue", "onUpdate:modelValue"]))
7056
- ], 64))
7057
- ]),
7058
- _: 1
7059
- })) : createCommentVNode("", true)
7060
- ]),
7061
- _: 1
7062
- }),
7063
- createVNode(unref(ToGridItem), { width: "full" }, {
7064
- default: withCtx(() => [
7065
- nodata.value ? withDirectives((openBlock(), createBlock(unref(ToPadding), {
7066
- key: 0,
7067
- value: 2
7068
- }, {
7069
- default: withCtx(() => [
7070
- createTextVNode(toDisplayString(_ctx.nodataText), 1)
7071
- ]),
7072
- _: 1
7073
- })), [
7074
- [unref(vColorDirective), "info"]
7075
- ]) : nomatch.value ? withDirectives((openBlock(), createBlock(unref(ToPadding), {
7076
- key: 1,
7077
- value: 2
7078
- }, {
7079
- default: withCtx(() => [
7080
- createTextVNode(toDisplayString(_ctx.nomatchText), 1)
7129
+ placeholder: unref(selected).filter((item) => !item.hide).length > 0 ? "" : _ctx.placeholder
7130
+ }, {
7131
+ default: withCtx(() => [
7132
+ createVNode(unref(ToButton), {
7133
+ icon: "ok",
7134
+ mode: "none",
7135
+ color: "primary",
7136
+ onClick: enter
7137
+ })
7138
+ ]),
7139
+ _: 1
7140
+ }, 8, ["modelValue", "onUpdate:modelValue", "placeholder"]))
7141
+ ])
7142
+ ])
7143
+ ], 2)) : (openBlock(), createBlock(unref(ToInput), {
7144
+ key: 1,
7145
+ ref_key: "popupFilter",
7146
+ ref: popupFilter,
7147
+ modelValue: multipleFilterValue.value,
7148
+ "onUpdate:modelValue": ($event) => multipleFilterValue.value = $event,
7149
+ "sp-chars": false,
7150
+ width: "full",
7151
+ "prevent-focus": "",
7152
+ placeholder: unref(selected).filter((item) => !item.hide).length > 0 ? "" : _ctx.placeholder
7153
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"]))
7154
+ ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
7155
+ _ctx.inputable ? (openBlock(), createBlock(unref(ToInput), {
7156
+ key: 0,
7157
+ ref_key: "popupInput",
7158
+ ref: popupInput,
7159
+ modelValue: inputValue.value,
7160
+ "onUpdate:modelValue": ($event) => inputValue.value = $event,
7161
+ "sp-chars": _ctx.spChars,
7162
+ "prevent-focus": "",
7163
+ width: "full",
7164
+ placeholder: _ctx.placeholder
7165
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "sp-chars", "placeholder"])) : (openBlock(), createBlock(unref(ToInput), {
7166
+ key: 1,
7167
+ ref_key: "popupFilter",
7168
+ ref: popupFilter,
7169
+ modelValue: filterValue.value,
7170
+ "onUpdate:modelValue": ($event) => filterValue.value = $event,
7171
+ "sp-chars": false,
7172
+ "prevent-focus": "",
7173
+ width: "full",
7174
+ placeholder: "筛选",
7175
+ onClear: filterClear
7176
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]))
7177
+ ], 64))
7178
+ ]),
7179
+ _: 1
7180
+ })) : createCommentVNode("", true)
7081
7181
  ]),
7082
7182
  _: 1
7083
- })), [
7084
- [unref(vColorDirective), "info"]
7085
- ]) : createCommentVNode("", true),
7086
- !nodata.value && !nomatch.value ? (openBlock(), createBlock(unref(ToScroll), {
7087
- key: 2,
7088
- style: normalizeStyle({ maxHeight: getDynamicHeight.value })
7089
- }, {
7183
+ }),
7184
+ createVNode(unref(ToGridItem), { width: "full" }, {
7090
7185
  default: withCtx(() => [
7091
- createVNode(unref(ToPadding), { value: 0.5 }, {
7186
+ nodata.value ? withDirectives((openBlock(), createBlock(unref(ToPadding), {
7187
+ key: 0,
7188
+ value: 2
7189
+ }, {
7092
7190
  default: withCtx(() => [
7093
- _ctx.multiple ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
7094
- createVNode(unref(ToPadding), { value: 0.5 }, {
7095
- default: withCtx(() => [
7096
- createVNode(unref(ToButton), { onClick: selectAll }, {
7191
+ createTextVNode(toDisplayString(_ctx.nodataText), 1)
7192
+ ]),
7193
+ _: 1
7194
+ })), [
7195
+ [unref(vColorDirective), "info"]
7196
+ ]) : nomatch.value ? withDirectives((openBlock(), createBlock(unref(ToPadding), {
7197
+ key: 1,
7198
+ value: 2
7199
+ }, {
7200
+ default: withCtx(() => [
7201
+ createTextVNode(toDisplayString(_ctx.nomatchText), 1)
7202
+ ]),
7203
+ _: 1
7204
+ })), [
7205
+ [unref(vColorDirective), "info"]
7206
+ ]) : createCommentVNode("", true),
7207
+ !nodata.value && !nomatch.value ? (openBlock(), createBlock(unref(ToScroll), { key: 2 }, {
7208
+ default: withCtx(() => [
7209
+ createVNode(unref(ToPadding), { value: 0.5 }, {
7210
+ default: withCtx(() => [
7211
+ _ctx.multiple ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
7212
+ createVNode(unref(ToPadding), { value: 0.5 }, {
7097
7213
  default: withCtx(() => [
7098
- createTextVNode(toDisplayString(unref(t)("to.common.selectAll")), 1)
7214
+ createVNode(unref(ToButton), { onClick: selectAll }, {
7215
+ default: withCtx(() => [
7216
+ createTextVNode(toDisplayString(unref(t)("to.common.selectAll")), 1)
7217
+ ]),
7218
+ _: 1
7219
+ }),
7220
+ createVNode(unref(ToButton), { onClick: deselect }, {
7221
+ default: withCtx(() => [
7222
+ createTextVNode(toDisplayString(unref(t)("to.common.Deselect")), 1)
7223
+ ]),
7224
+ _: 1
7225
+ })
7099
7226
  ]),
7100
7227
  _: 1
7101
7228
  }),
7102
- createVNode(unref(ToButton), { onClick: deselect }, {
7229
+ createVNode(unref(ToGrid), { col: _ctx.optionCol }, {
7103
7230
  default: withCtx(() => [
7104
- createTextVNode(toDisplayString(unref(t)("to.common.Deselect")), 1)
7231
+ (openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (item) => {
7232
+ return withDirectives((openBlock(), createBlock(unref(ToGridItem), {
7233
+ key: item[iValueText.value],
7234
+ width: "full"
7235
+ }, {
7236
+ default: withCtx(() => [
7237
+ createVNode(unref(ToCheckbox), {
7238
+ wrap: _ctx.optionWrap,
7239
+ title: item[iLabelText.value],
7240
+ width: "full",
7241
+ label: item[iLabelText.value],
7242
+ disabled: !!item.disabled,
7243
+ value: Boolean(unref(selected).find((el) => el[iValueText.value] === item[iValueText.value])),
7244
+ onChange: (value) => {
7245
+ return multipleItemChange(value, item);
7246
+ }
7247
+ }, null, 8, ["wrap", "title", "label", "disabled", "value", "onChange"])
7248
+ ]),
7249
+ _: 2
7250
+ }, 1024)), [
7251
+ [vShow, multipleFilter(item)],
7252
+ [unref(vDis), !!item.disabled]
7253
+ ]);
7254
+ }), 128))
7105
7255
  ]),
7106
7256
  _: 1
7107
- })
7108
- ]),
7109
- _: 1
7110
- }),
7111
- createVNode(unref(ToGrid), { col: _ctx.optionCol }, {
7112
- default: withCtx(() => [
7113
- (openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (item) => {
7114
- return withDirectives((openBlock(), createBlock(unref(ToGridItem), {
7115
- key: item[iValueText.value],
7116
- width: "full"
7117
- }, {
7118
- default: withCtx(() => [
7119
- createVNode(unref(ToCheckbox), {
7120
- wrap: _ctx.optionWrap,
7121
- title: item[iLabelText.value],
7122
- width: "full",
7123
- label: item[iLabelText.value],
7124
- disabled: !!item.disabled,
7125
- value: Boolean(unref(selected).find((el) => el[iValueText.value] === item[iValueText.value])),
7126
- onChange: (value) => {
7127
- return multipleItemChange(value, item);
7128
- }
7129
- }, null, 8, ["wrap", "title", "label", "disabled", "value", "onChange"])
7130
- ]),
7131
- _: 2
7132
- }, 1024)), [
7133
- [vShow, multipleFilter(item)],
7134
- [unref(vDis), !!item.disabled]
7135
- ]);
7136
- }), 128))
7137
- ]),
7138
- _: 1
7139
- }, 8, ["col"])
7140
- ], 64)) : (openBlock(), createBlock(unref(ToGrid), {
7141
- key: 1,
7142
- col: _ctx.optionCol
7143
- }, {
7144
- default: withCtx(() => [
7145
- (openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (item) => {
7146
- return withDirectives((openBlock(), createElementBlock("div", {
7147
- key: item[iValueText.value],
7148
- class: normalizeClass({ "is-on": unref(selected)[iValueText.value] === item[iValueText.value] }),
7149
- onClick: withModifiers(($event) => itemChange(item), ["stop"])
7150
- }, [
7151
- item[iLabelText.value] ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
7152
- createTextVNode(toDisplayString(item[iLabelText.value]), 1)
7153
- ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
7154
- createTextVNode(toDisplayString(_ctx.placeholder), 1)
7155
- ], 64))
7156
- ], 10, ["onClick"])), [
7157
- [vShow, filterByValue(item)],
7158
- [unref(vDis), !!item.disabled]
7159
- ]);
7160
- }), 128))
7257
+ }, 8, ["col"])
7258
+ ], 64)) : (openBlock(), createBlock(unref(ToGrid), {
7259
+ key: 1,
7260
+ col: _ctx.optionCol
7261
+ }, {
7262
+ default: withCtx(() => [
7263
+ (openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (item) => {
7264
+ return withDirectives((openBlock(), createElementBlock("div", {
7265
+ key: item[iValueText.value],
7266
+ class: normalizeClass({ "is-on": unref(selected)[iValueText.value] === item[iValueText.value] }),
7267
+ onClick: withModifiers(($event) => itemChange(item), ["stop"])
7268
+ }, [
7269
+ item[iLabelText.value] ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
7270
+ createTextVNode(toDisplayString(item[iLabelText.value]), 1)
7271
+ ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
7272
+ createTextVNode(toDisplayString(_ctx.placeholder), 1)
7273
+ ], 64))
7274
+ ], 10, ["onClick"])), [
7275
+ [vShow, filterByValue(item)],
7276
+ [unref(vDis), !!item.disabled]
7277
+ ]);
7278
+ }), 128))
7279
+ ]),
7280
+ _: 1
7281
+ }, 8, ["col"]))
7161
7282
  ]),
7162
7283
  _: 1
7163
- }, 8, ["col"]))
7284
+ })
7164
7285
  ]),
7165
7286
  _: 1
7166
- })
7287
+ })) : createCommentVNode("", true)
7167
7288
  ]),
7168
7289
  _: 1
7169
- }, 8, ["style"])) : createCommentVNode("", true)
7170
- ]),
7171
- _: 1
7172
- }),
7173
- createVNode(unref(ToGridItem), {
7174
- side: "",
7175
- width: "full"
7176
- }, {
7177
- default: withCtx(() => [
7178
- createVNode(unref(ToSubmit), {
7179
- width: "full",
7180
- space: "0"
7290
+ }),
7291
+ createVNode(unref(ToGridItem), {
7292
+ side: "",
7293
+ width: "full"
7181
7294
  }, {
7182
7295
  default: withCtx(() => [
7183
- withDirectives((openBlock(), createBlock(unref(ToButton), {
7184
- fillet: "none",
7185
- color: "primary",
7186
- mode: "line",
7187
- onClick: ($event) => (phoneCloseLayer(), iValue.value = "")
7188
- }, {
7189
- default: withCtx(() => [
7190
- createTextVNode(toDisplayString(unref(t)("to.common.clear")), 1)
7191
- ]),
7192
- _: 1
7193
- }, 8, ["onClick"])), [
7194
- [_directive_size, "l"]
7195
- ]),
7196
- withDirectives((openBlock(), createBlock(unref(ToButton), {
7197
- mode: "fill",
7198
- color: "primary",
7199
- fillet: "none",
7200
- onClick: ($event) => phoneCloseLayer()
7296
+ createVNode(unref(ToSubmit), {
7297
+ width: "full",
7298
+ space: "0"
7201
7299
  }, {
7202
7300
  default: withCtx(() => [
7203
- createTextVNode(toDisplayString(unref(t)("to.common.confirm")), 1)
7301
+ withDirectives((openBlock(), createBlock(unref(ToButton), {
7302
+ fillet: "none",
7303
+ color: "primary",
7304
+ mode: "line",
7305
+ onClick: ($event) => (phoneCloseLayer(), iValue.value = "")
7306
+ }, {
7307
+ default: withCtx(() => [
7308
+ createTextVNode(toDisplayString(unref(t)("to.common.clear")), 1)
7309
+ ]),
7310
+ _: 1
7311
+ }, 8, ["onClick"])), [
7312
+ [_directive_size, "l"]
7313
+ ]),
7314
+ withDirectives((openBlock(), createBlock(unref(ToButton), {
7315
+ mode: "fill",
7316
+ color: "primary",
7317
+ fillet: "none",
7318
+ onClick: ($event) => phoneCloseLayer()
7319
+ }, {
7320
+ default: withCtx(() => [
7321
+ createTextVNode(toDisplayString(unref(t)("to.common.confirm")), 1)
7322
+ ]),
7323
+ _: 1
7324
+ }, 8, ["onClick"])), [
7325
+ [_directive_size, "l"]
7326
+ ])
7204
7327
  ]),
7205
7328
  _: 1
7206
- }, 8, ["onClick"])), [
7207
- [_directive_size, "l"]
7208
- ])
7329
+ })
7209
7330
  ]),
7210
7331
  _: 1
7211
7332
  })
7212
7333
  ]),
7213
7334
  _: 1
7214
- })
7215
- ]),
7216
- _: 1
7217
- })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
7218
- nodata.value ? (openBlock(), createElementBlock("div", {
7219
- key: 0,
7220
- class: "to-select-option-tip"
7221
- }, toDisplayString(_ctx.nodataText), 1)) : nomatch.value ? (openBlock(), createElementBlock("div", {
7222
- key: 1,
7223
- class: "to-select-option-tip"
7224
- }, toDisplayString(_ctx.nomatchText), 1)) : createCommentVNode("", true),
7225
- !nodata.value && !nomatch.value ? (openBlock(), createBlock(unref(ToScroll), {
7226
- key: 2,
7227
- style: normalizeStyle({ maxHeight: getDynamicHeight.value })
7228
- }, {
7229
- default: withCtx(() => [
7230
- _ctx.multiple ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
7231
- createElementVNode("div", { class: "to-select-option-fn" }, [
7232
- createVNode(unref(ToButton), {
7233
- class: "to-select-option-button value-all",
7234
- onClick: selectAll
7235
- }, {
7236
- default: withCtx(() => [
7237
- createTextVNode(toDisplayString(unref(t)("to.common.selectAll")), 1)
7335
+ })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
7336
+ nodata.value ? (openBlock(), createElementBlock("div", {
7337
+ key: 0,
7338
+ class: "to-select-option-tip"
7339
+ }, toDisplayString(_ctx.nodataText), 1)) : nomatch.value ? (openBlock(), createElementBlock("div", {
7340
+ key: 1,
7341
+ class: "to-select-option-tip"
7342
+ }, toDisplayString(_ctx.nomatchText), 1)) : createCommentVNode("", true),
7343
+ !nodata.value && !nomatch.value ? (openBlock(), createBlock(unref(ToScroll), { key: 2 }, {
7344
+ default: withCtx(() => [
7345
+ _ctx.multiple ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
7346
+ createElementVNode("div", { class: "to-select-option-fn" }, [
7347
+ createVNode(unref(ToButton), {
7348
+ class: "to-select-option-button value-all",
7349
+ onClick: selectAll
7350
+ }, {
7351
+ default: withCtx(() => [
7352
+ createTextVNode(toDisplayString(unref(t)("to.common.selectAll")), 1)
7353
+ ]),
7354
+ _: 1
7355
+ }),
7356
+ createVNode(unref(ToButton), {
7357
+ class: "to-select-option-button value-inverse",
7358
+ onClick: deselect
7359
+ }, {
7360
+ default: withCtx(() => [
7361
+ createTextVNode(toDisplayString(unref(t)("to.common.Deselect")), 1)
7362
+ ]),
7363
+ _: 1
7364
+ })
7238
7365
  ]),
7239
- _: 1
7240
- }),
7241
- createVNode(unref(ToButton), {
7242
- class: "to-select-option-button value-inverse",
7243
- onClick: deselect
7366
+ createVNode(unref(ToGrid), {
7367
+ class: "to-select-list is-multiple",
7368
+ col: _ctx.optionCol
7369
+ }, {
7370
+ default: withCtx(() => [
7371
+ (openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (item) => {
7372
+ return withDirectives((openBlock(), createBlock(unref(ToCheckbox), {
7373
+ key: item[iValueText.value],
7374
+ class: "to-select-check",
7375
+ wrap: _ctx.optionWrap,
7376
+ title: item[iLabelText.value],
7377
+ width: "full",
7378
+ label: item[iLabelText.value],
7379
+ disabled: !!item.disabled,
7380
+ value: Boolean(unref(selected).find((el) => el[iValueText.value] === item[iValueText.value])),
7381
+ onChange: (value) => {
7382
+ return multipleItemChange(value, item);
7383
+ }
7384
+ }, null, 8, ["wrap", "title", "label", "disabled", "value", "onChange"])), [
7385
+ [vShow, multipleFilter(item)],
7386
+ [unref(vDis), !!item.disabled]
7387
+ ]);
7388
+ }), 128))
7389
+ ]),
7390
+ _: 1
7391
+ }, 8, ["col"])
7392
+ ], 64)) : (openBlock(), createBlock(unref(ToGrid), {
7393
+ key: 1,
7394
+ col: _ctx.optionCol,
7395
+ class: "to-select-list"
7244
7396
  }, {
7245
7397
  default: withCtx(() => [
7246
- createTextVNode(toDisplayString(unref(t)("to.common.Deselect")), 1)
7398
+ (openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (item) => {
7399
+ return withDirectives((openBlock(), createElementBlock("div", {
7400
+ key: item[iValueText.value],
7401
+ class: normalizeClass(["to-select-option-item", { "is-on": unref(selected)[iValueText.value] === item[iValueText.value] }]),
7402
+ onClick: withModifiers(($event) => itemChange(item), ["stop"])
7403
+ }, [
7404
+ item[iLabelText.value] ? (openBlock(), createElementBlock("span", {
7405
+ key: 0,
7406
+ class: "to-select-option-item-text"
7407
+ }, toDisplayString(item[iLabelText.value]), 1)) : (openBlock(), createElementBlock("span", {
7408
+ key: 1,
7409
+ class: "to-select-option-item-text"
7410
+ }, toDisplayString(_ctx.placeholder), 1))
7411
+ ], 10, ["onClick"])), [
7412
+ [vShow, filterByValue(item)],
7413
+ [unref(vDis), !!item.disabled]
7414
+ ]);
7415
+ }), 128))
7247
7416
  ]),
7248
7417
  _: 1
7249
- })
7250
- ]),
7251
- createVNode(unref(ToGrid), {
7252
- class: "to-select-list is-multiple",
7253
- col: _ctx.optionCol
7254
- }, {
7255
- default: withCtx(() => [
7256
- (openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (item) => {
7257
- return withDirectives((openBlock(), createBlock(unref(ToCheckbox), {
7258
- key: item[iValueText.value],
7259
- class: "to-select-check",
7260
- wrap: _ctx.optionWrap,
7261
- title: item[iLabelText.value],
7262
- width: "full",
7263
- label: item[iLabelText.value],
7264
- disabled: !!item.disabled,
7265
- value: Boolean(unref(selected).find((el) => el[iValueText.value] === item[iValueText.value])),
7266
- onChange: (value) => {
7267
- return multipleItemChange(value, item);
7268
- }
7269
- }, null, 8, ["wrap", "title", "label", "disabled", "value", "onChange"])), [
7270
- [vShow, multipleFilter(item)],
7271
- [unref(vDis), !!item.disabled]
7272
- ]);
7273
- }), 128))
7274
- ]),
7275
- _: 1
7276
- }, 8, ["col"])
7277
- ], 64)) : (openBlock(), createBlock(unref(ToGrid), {
7278
- key: 1,
7279
- col: _ctx.optionCol,
7280
- class: "to-select-list"
7281
- }, {
7282
- default: withCtx(() => [
7283
- (openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (item) => {
7284
- return withDirectives((openBlock(), createElementBlock("div", {
7285
- key: item[iValueText.value],
7286
- class: normalizeClass(["to-select-option-item", { "is-on": unref(selected)[iValueText.value] === item[iValueText.value] }]),
7287
- onClick: withModifiers(($event) => itemChange(item), ["stop"])
7288
- }, [
7289
- item[iLabelText.value] ? (openBlock(), createElementBlock("span", {
7290
- key: 0,
7291
- class: "to-select-option-item-text"
7292
- }, toDisplayString(item[iLabelText.value]), 1)) : (openBlock(), createElementBlock("span", {
7293
- key: 1,
7294
- class: "to-select-option-item-text"
7295
- }, toDisplayString(_ctx.placeholder), 1))
7296
- ], 10, ["onClick"])), [
7297
- [vShow, filterByValue(item)],
7298
- [unref(vDis), !!item.disabled]
7299
- ]);
7300
- }), 128))
7418
+ }, 8, ["col"]))
7301
7419
  ]),
7302
7420
  _: 1
7303
- }, 8, ["col"]))
7304
- ]),
7305
- _: 1
7306
- }, 8, ["style"])) : createCommentVNode("", true)
7307
- ], 64))
7308
- ])
7309
- ]),
7310
- _: 3
7311
- }, 8, ["class", "align", "lazy", "width", "slide", "position"])
7421
+ })) : createCommentVNode("", true)
7422
+ ], 64))
7423
+ ])
7424
+ ]),
7425
+ _: 3
7426
+ }, 8, ["style", "class", "align", "width", "slide", "position"])
7427
+ ], 2)
7428
+ ]))
7312
7429
  ], 46, ["id", "tabindex"])), [
7313
7430
  [_directive_tip, changed.value ? unref(t)("to.common.originalValue", getLabel(valueStore.value[0])) : ""]
7314
7431
  ]);
@@ -9030,6 +9147,10 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
9030
9147
  type: [Number, String],
9031
9148
  default: ""
9032
9149
  },
9150
+ labelPosition: {
9151
+ type: String,
9152
+ default: "left"
9153
+ },
9033
9154
  col: {
9034
9155
  type: [Number, String],
9035
9156
  default: 1
@@ -9054,6 +9175,18 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
9054
9175
  type: String,
9055
9176
  default: ""
9056
9177
  },
9178
+ space: {
9179
+ type: [Number, String],
9180
+ default: ""
9181
+ },
9182
+ spaceX: {
9183
+ type: [Number, String],
9184
+ default: ""
9185
+ },
9186
+ spaceY: {
9187
+ type: [Number, String],
9188
+ default: ""
9189
+ },
9057
9190
  comparable: Boolean,
9058
9191
  readonly: Boolean
9059
9192
  },
@@ -9063,6 +9196,12 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
9063
9196
  const slots = useSlots();
9064
9197
  const items = ref([]);
9065
9198
  const maxLabelWidth = ref(0);
9199
+ const labelWidthRef = ref(props.labelWidth);
9200
+ const labelPositionRef = ref(props.labelPosition);
9201
+ const spaceRef = ref(props.space);
9202
+ const spaceXRef = ref(props.spaceX);
9203
+ const spaceYRef = ref(props.spaceY);
9204
+ const valueWidthRef = ref(props.valueWidth);
9066
9205
  const adjust = () => {
9067
9206
  setTimeout(() => {
9068
9207
  let maxWidth = 0;
@@ -9100,8 +9239,23 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
9100
9239
  arr.push(`dir-${props.dir}`);
9101
9240
  if (props.valueWidth)
9102
9241
  arr.push(`value-width-${props.valueWidth}`);
9242
+ if (props.labelPosition)
9243
+ arr.push(`label-position-${props.labelPosition}`);
9103
9244
  return arr;
9104
9245
  });
9246
+ const setStyle = computed(() => {
9247
+ const style = {};
9248
+ if (props.space) {
9249
+ style.gap = props.space + "em";
9250
+ }
9251
+ if (props.spaceX) {
9252
+ style["--gap-x"] = props.spaceX + "em";
9253
+ }
9254
+ if (props.spaceY) {
9255
+ style["--gap-y"] = props.spaceY + "em";
9256
+ }
9257
+ return style;
9258
+ });
9105
9259
  const submitStyle = computed(() => {
9106
9260
  if (props.submitPosition === "item") {
9107
9261
  if (props.labelWidth === "max") {
@@ -9112,6 +9266,45 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
9112
9266
  }
9113
9267
  return {};
9114
9268
  });
9269
+ watch(
9270
+ () => props.labelWidth,
9271
+ (newVal) => {
9272
+ labelWidthRef.value = newVal;
9273
+ if (newVal === "max") {
9274
+ adjust();
9275
+ }
9276
+ }
9277
+ );
9278
+ watch(
9279
+ () => props.labelPosition,
9280
+ (newVal) => {
9281
+ labelPositionRef.value = newVal;
9282
+ }
9283
+ );
9284
+ watch(
9285
+ () => props.space,
9286
+ (newVal) => {
9287
+ spaceRef.value = newVal;
9288
+ }
9289
+ );
9290
+ watch(
9291
+ () => props.spaceX,
9292
+ (newVal) => {
9293
+ spaceXRef.value = newVal;
9294
+ }
9295
+ );
9296
+ watch(
9297
+ () => props.spaceY,
9298
+ (newVal) => {
9299
+ spaceYRef.value = newVal;
9300
+ }
9301
+ );
9302
+ watch(
9303
+ () => props.valueWidth,
9304
+ (newVal) => {
9305
+ valueWidthRef.value = newVal;
9306
+ }
9307
+ );
9115
9308
  onMounted(() => {
9116
9309
  if (props.labelWidth === "max") {
9117
9310
  window.addEventListener("resize", adjust);
@@ -9124,15 +9317,21 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
9124
9317
  }
9125
9318
  });
9126
9319
  provide("ToForm", {
9127
- labelWidth: props.labelWidth,
9320
+ labelWidth: labelWidthRef,
9321
+ labelPosition: labelPositionRef,
9322
+ space: spaceRef,
9323
+ spaceX: spaceXRef,
9324
+ spaceY: spaceYRef,
9128
9325
  submitPosition: props.submitPosition,
9129
9326
  items: items.value,
9130
9327
  type: props.type,
9131
- comparable: props.comparable
9328
+ comparable: props.comparable,
9329
+ valueWidth: valueWidthRef
9132
9330
  });
9133
9331
  return (_ctx, _cache) => {
9134
9332
  return openBlock(), createElementBlock("div", {
9135
- class: normalizeClass(["to-form", setClass.value])
9333
+ class: normalizeClass(["to-form", setClass.value]),
9334
+ style: normalizeStyle(setStyle.value)
9136
9335
  }, [
9137
9336
  createElementVNode("div", {
9138
9337
  ref_key: "toForm",
@@ -9152,7 +9351,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
9152
9351
  renderSlot(_ctx.$slots, "submit")
9153
9352
  ], 4)) : createCommentVNode("", true)
9154
9353
  ], 512)
9155
- ], 2);
9354
+ ], 6);
9156
9355
  };
9157
9356
  }
9158
9357
  });
@@ -9196,7 +9395,10 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
9196
9395
  const setLabelStyle = computed(() => {
9197
9396
  const style = {};
9198
9397
  if (ToForm.labelWidth) {
9199
- style.width = ToForm.labelWidth + "em";
9398
+ const labelWidth = ToForm.labelWidth.value !== void 0 ? ToForm.labelWidth.value : ToForm.labelWidth;
9399
+ if (labelWidth) {
9400
+ style.width = labelWidth + "em";
9401
+ }
9200
9402
  }
9201
9403
  return style;
9202
9404
  });
@@ -9706,7 +9908,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
9706
9908
  },
9707
9909
  clearable: {
9708
9910
  type: Boolean,
9709
- default: false
9911
+ default: true
9710
9912
  },
9711
9913
  preventFocus: {
9712
9914
  type: Boolean,
@@ -9764,12 +9966,6 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
9764
9966
  type: [String, Number],
9765
9967
  default: 0
9766
9968
  },
9767
- value: {
9768
- type: [String, Number],
9769
- default: () => {
9770
- return "";
9771
- }
9772
- },
9773
9969
  readonly: {
9774
9970
  type: Boolean,
9775
9971
  default: false
@@ -9797,6 +9993,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
9797
9993
  watch(
9798
9994
  () => props.modelValue,
9799
9995
  (val) => {
9996
+ clearVisible.value = !!val;
9800
9997
  data.value = val;
9801
9998
  },
9802
9999
  { immediate: true, deep: true }
@@ -9860,6 +10057,14 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
9860
10057
  errorTip.value = val;
9861
10058
  }
9862
10059
  );
10060
+ watch(
10061
+ () => props.autofocus,
10062
+ (val) => {
10063
+ if (val) {
10064
+ focusInput();
10065
+ }
10066
+ }
10067
+ );
9863
10068
  const focusInput = () => {
9864
10069
  if (inputRef.value) {
9865
10070
  try {
@@ -9875,7 +10080,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
9875
10080
  }
9876
10081
  };
9877
10082
  onMounted(() => {
9878
- data.value = props.step ? 0 : props.value || props.modelValue;
10083
+ data.value = props.modelValue;
9879
10084
  itype.value = props.type;
9880
10085
  if (props.autofocus) {
9881
10086
  nextTick(() => {
@@ -9923,9 +10128,6 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
9923
10128
  if (props.step) {
9924
10129
  arr.push("is-step");
9925
10130
  }
9926
- if (props.type === "textarea" && props.clearable) {
9927
- arr.push("is-clearable");
9928
- }
9929
10131
  if (ToForm && ToForm.comparable || props.comparable) {
9930
10132
  arr.push("to-compare");
9931
10133
  }
@@ -10170,28 +10372,29 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
10170
10372
  [vModelDynamic, data.value]
10171
10373
  ])
10172
10374
  ])),
10173
- withDirectives(createVNode(unref(ToIcon), {
10375
+ !props.disabled && props.clearable && !props.step ? withDirectives((openBlock(), createBlock(unref(ToIcon), {
10376
+ key: 6,
10174
10377
  class: "to-input-clear",
10175
10378
  link: "",
10176
10379
  value: "close",
10177
10380
  onClick: withModifiers(clear, ["stop"])
10178
- }, null, 512), [
10381
+ }, null, 512)), [
10179
10382
  [vShow, clearVisible.value]
10180
- ]),
10383
+ ]) : createCommentVNode("", true),
10181
10384
  props.maxlength !== Infinity && props.count && props.type !== "textarea" ? (openBlock(), createElementBlock("span", {
10182
- key: 6,
10385
+ key: 7,
10183
10386
  class: "to-input-count"
10184
10387
  }, [
10185
10388
  createElementVNode("span", { class: "to-input-count-text" }, toDisplayString(getDataLength.value) + "/" + toDisplayString(props.maxlength), 1)
10186
10389
  ])) : createCommentVNode("", true),
10187
10390
  props.suffix ? (openBlock(), createElementBlock("span", {
10188
- key: 7,
10391
+ key: 8,
10189
10392
  class: "to-input-suffix-text"
10190
10393
  }, [
10191
10394
  createElementVNode("span", null, toDisplayString(props.suffix), 1)
10192
10395
  ])) : createCommentVNode("", true),
10193
10396
  props.suggestion || _ctx.$slots.default || _ctx.$slots.suffix || props.step ? (openBlock(), createElementBlock("span", {
10194
- key: 8,
10397
+ key: 9,
10195
10398
  class: "to-input-suffix"
10196
10399
  }, [
10197
10400
  renderSlot(_ctx.$slots, "default"),
@@ -10217,7 +10420,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
10217
10420
  ])) : createCommentVNode("", true)
10218
10421
  ])) : createCommentVNode("", true),
10219
10422
  props.step ? withDirectives((openBlock(), createBlock(unref(ToIcon), {
10220
- key: 9,
10423
+ key: 10,
10221
10424
  class: "to-input-increase",
10222
10425
  value: props.stepIconMode ? "collapse" : "add",
10223
10426
  link: "",
@@ -11479,8 +11682,6 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent({
11479
11682
  emit("close");
11480
11683
  };
11481
11684
  const bgClose = () => {
11482
- console.log("★");
11483
- console.log(props.closeOnBlur);
11484
11685
  if (props.closeOnBlur) {
11485
11686
  close2();
11486
11687
  }
@@ -11895,6 +12096,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
11895
12096
  { immediate: true }
11896
12097
  );
11897
12098
  watch(() => props.total, computePager);
12099
+ watch(() => props.pagerCount, computePager);
11898
12100
  onMounted(() => {
11899
12101
  computePager();
11900
12102
  });
@@ -13700,7 +13902,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
13700
13902
  const errorType = ref("rule");
13701
13903
  const errorTip = ref("");
13702
13904
  const layerSlide = ref(false);
13703
- const layerPosition = ref("auto");
13905
+ const layerPosition = ref("");
13704
13906
  const disabled = ref(props.disabled);
13705
13907
  const inputBox = ref(null);
13706
13908
  const layerRef = ref(null);
@@ -13718,6 +13920,21 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
13718
13920
  layerPosition.value = "bottom";
13719
13921
  }
13720
13922
  });
13923
+ const setClass = computed(() => {
13924
+ const arr = ["to-form-readonly"];
13925
+ if (errorTip.value) {
13926
+ arr.push("to-input-mode-line");
13927
+ arr.push("to-input-color-danger");
13928
+ arr.push("to-input-tip-show");
13929
+ } else {
13930
+ if (props.mode) {
13931
+ for (let i = 0; i < props.mode.split(" ").length; i++) {
13932
+ arr.push(`mode-${props.mode.split(" ")[i]}`);
13933
+ }
13934
+ }
13935
+ }
13936
+ return arr;
13937
+ });
13721
13938
  const showCloseLayer = computed(() => {
13722
13939
  return (isPc.value || props.showCalendar) && (props.type === "months" || props.type === "dates");
13723
13940
  });
@@ -13762,11 +13979,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
13762
13979
  }
13763
13980
  function showLayer() {
13764
13981
  var _a2;
13765
- let className = inputBox.value && inputBox.value.$el && inputBox.value.$el.className || "";
13766
13982
  errorTip.value = inputBox.value.errorTip = "";
13767
- if (className.indexOf("to-dis") > -1) {
13768
- return;
13769
- }
13770
13983
  if (!disabled.value) {
13771
13984
  (_a2 = layerRef.value) == null ? void 0 : _a2.toggle(inputBox.value.$el);
13772
13985
  nextTick(() => {
@@ -13820,78 +14033,85 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
13820
14033
  link: __props.inputable,
13821
14034
  class: normalizeClass(disabled.value ? "to-dis" : ""),
13822
14035
  value: "time",
13823
- onClick: showLayer
14036
+ onClick: withModifiers(showLayer, ["stop"])
13824
14037
  }, null, 8, ["link", "class"])) : (openBlock(), createBlock(unref(ToIcon), {
13825
14038
  key: 1,
13826
14039
  link: __props.inputable,
13827
14040
  class: normalizeClass(disabled.value ? "to-dis" : ""),
13828
14041
  value: "date",
13829
- onClick: showLayer
14042
+ onClick: withModifiers(showLayer, ["stop"])
13830
14043
  }, null, 8, ["link", "class"]))
13831
14044
  ]),
13832
14045
  default: withCtx(() => [
13833
- createVNode(unref(ToFloat), {
13834
- ref_key: "layerRef",
13835
- ref: layerRef,
13836
- lazy: __props.lazy,
13837
- slide: layerSlide.value,
13838
- position: layerPosition.value,
13839
- padding: 0.5,
13840
- width: unref(isPc) ? __props.type === "datetime" ? 43 : 23 : "",
13841
- align: __props.optionAlign ? __props.optionAlign : unref(isPc) ? "right" : "auto",
13842
- onClosed: handleLayerClose
13843
- }, {
13844
- default: withCtx(() => [
13845
- unref(isPc) || __props.showCalendar ? (openBlock(), createBlock(unref(ToScroll), { key: 0 }, {
14046
+ (openBlock(), createBlock(Teleport, { to: "body" }, [
14047
+ createElementVNode("div", {
14048
+ class: normalizeClass(["to-date-picker", setClass.value])
14049
+ }, [
14050
+ createVNode(unref(ToFloat), {
14051
+ ref_key: "layerRef",
14052
+ ref: layerRef,
14053
+ global: false,
14054
+ lazy: __props.lazy,
14055
+ slide: layerSlide.value,
14056
+ position: layerPosition.value,
14057
+ padding: 0.5,
14058
+ width: unref(isPc) ? __props.type === "datetime" ? 43 : 23 : "",
14059
+ align: __props.optionAlign ? __props.optionAlign : unref(isPc) ? "right" : "",
14060
+ onClosed: handleLayerClose
14061
+ }, {
13846
14062
  default: withCtx(() => [
13847
- createVNode(unref(ToCalendar), {
13848
- ref_key: "calendar",
13849
- ref: calendar,
14063
+ unref(isPc) || __props.showCalendar ? (openBlock(), createBlock(unref(ToScroll), { key: 0 }, {
14064
+ default: withCtx(() => [
14065
+ createVNode(unref(ToCalendar), {
14066
+ ref_key: "calendar",
14067
+ ref: calendar,
14068
+ modelValue: unref(date),
14069
+ "onUpdate:modelValue": ($event) => isRef(date) ? date.value = $event : null,
14070
+ class: "to-date-picker-calendar",
14071
+ time: __props.time,
14072
+ type: __props.type,
14073
+ min: __props.min,
14074
+ max: __props.max,
14075
+ "min-year": __props.minYear,
14076
+ "max-year": __props.maxYear,
14077
+ "disabled-date": __props.disabledDate,
14078
+ "before-change": __props.beforeChange,
14079
+ onChange: select,
14080
+ onClose: ($event) => {
14081
+ var _a2;
14082
+ return (_a2 = layerRef.value) == null ? void 0 : _a2.close();
14083
+ }
14084
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "time", "type", "min", "max", "min-year", "max-year", "disabled-date", "before-change", "onClose"])
14085
+ ]),
14086
+ _: 1
14087
+ })) : (openBlock(), createBlock(_sfc_main$O, {
14088
+ key: 1,
13850
14089
  modelValue: unref(date),
13851
14090
  "onUpdate:modelValue": ($event) => isRef(date) ? date.value = $event : null,
13852
- class: "to-date-picker-calendar",
13853
14091
  time: __props.time,
13854
14092
  type: __props.type,
13855
14093
  min: __props.min,
13856
14094
  max: __props.max,
13857
- "min-year": __props.minYear,
13858
- "max-year": __props.maxYear,
13859
- "disabled-date": __props.disabledDate,
13860
- "before-change": __props.beforeChange,
13861
- onChange: select,
13862
- onClose: ($event) => {
14095
+ onCancel: ($event) => {
13863
14096
  var _a2;
13864
14097
  return (_a2 = layerRef.value) == null ? void 0 : _a2.close();
13865
- }
13866
- }, null, 8, ["modelValue", "onUpdate:modelValue", "time", "type", "min", "max", "min-year", "max-year", "disabled-date", "before-change", "onClose"])
14098
+ },
14099
+ onChange: select,
14100
+ onClear: ($event) => clear()
14101
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "time", "type", "min", "max", "onCancel", "onClear"])),
14102
+ showCloseLayer.value ? (openBlock(), createElementBlock("div", { key: 2 }, [
14103
+ createVNode(_component_to_button, { onClick: closeLayer }, {
14104
+ default: withCtx(() => [
14105
+ createTextVNode("确定")
14106
+ ]),
14107
+ _: 1
14108
+ })
14109
+ ])) : createCommentVNode("", true)
13867
14110
  ]),
13868
14111
  _: 1
13869
- })) : (openBlock(), createBlock(_sfc_main$O, {
13870
- key: 1,
13871
- modelValue: unref(date),
13872
- "onUpdate:modelValue": ($event) => isRef(date) ? date.value = $event : null,
13873
- time: __props.time,
13874
- type: __props.type,
13875
- min: __props.min,
13876
- max: __props.max,
13877
- onCancel: ($event) => {
13878
- var _a2;
13879
- return (_a2 = layerRef.value) == null ? void 0 : _a2.close();
13880
- },
13881
- onChange: select,
13882
- onClear: ($event) => clear()
13883
- }, null, 8, ["modelValue", "onUpdate:modelValue", "time", "type", "min", "max", "onCancel", "onClear"])),
13884
- showCloseLayer.value ? (openBlock(), createElementBlock("div", { key: 2 }, [
13885
- createVNode(_component_to_button, { onClick: closeLayer }, {
13886
- default: withCtx(() => [
13887
- createTextVNode("确定")
13888
- ]),
13889
- _: 1
13890
- })
13891
- ])) : createCommentVNode("", true)
13892
- ]),
13893
- _: 1
13894
- }, 8, ["lazy", "slide", "position", "width", "align"])
14112
+ }, 8, ["lazy", "slide", "position", "width", "align"])
14113
+ ], 2)
14114
+ ]))
13895
14115
  ]),
13896
14116
  _: 1
13897
14117
  }, 8, ["id", "model-value", "readonly", "required", "desc", "color", "prefix", "suffix", "mode", "prop-error-type", "prop-error-tip", "fillet", "fillet-position", "placeholder", "disabled", "sp-chars", "link", "clearable", "width", "comparable", "onClear", "onInput"]);
@@ -13993,9 +14213,15 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
13993
14213
  floatRef.value.open($el.value);
13994
14214
  }
13995
14215
  function handleOpen() {
14216
+ if (props.disabled) {
14217
+ return;
14218
+ }
13996
14219
  floatRef.value.open($el.value);
13997
14220
  }
13998
14221
  function handleClose() {
14222
+ if (props.disabled) {
14223
+ return;
14224
+ }
13999
14225
  startDate.value = "";
14000
14226
  endDate.value = "";
14001
14227
  rangeValue.value = "";
@@ -14030,7 +14256,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
14030
14256
  [vModelText, startDate.value],
14031
14257
  [unref(vDis), __props.disabled]
14032
14258
  ]),
14033
- createElementVNode("span", { class: "to-date-range-separator" }, "~"),
14259
+ createElementVNode("span", { class: "to-date-range-separator" }, toDisplayString(props.seperatorText), 1),
14034
14260
  withDirectives(createElementVNode("input", {
14035
14261
  "onUpdate:modelValue": ($event) => endDate.value = $event,
14036
14262
  class: "to-date-range-input",
@@ -14839,7 +15065,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
14839
15065
  const $el = ref(null);
14840
15066
  const flatData = computed(() => flattenTree(props.data));
14841
15067
  const expandedSet = ref(/* @__PURE__ */ new Set());
14842
- const visibleRows = computed(() => flatData.value.filter((item) => item.level === 0 || isVisible(item, flatData.value)));
15068
+ const visibleRows = computed(() => flatData.value.filter((item) => item._level === 0 || isVisible(item, flatData.value)));
14843
15069
  const tipShow = ref("");
14844
15070
  const checkedRows = computed(() => {
14845
15071
  let checked = [];
@@ -14858,10 +15084,10 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
14858
15084
  const result = [];
14859
15085
  for (const item of data) {
14860
15086
  const _id = uid++;
14861
- const { _children, ...rest } = item;
15087
+ const { children, ...rest } = item;
14862
15088
  result.push(reactive({ ...rest, _id, _parentId, _level, _checked: Boolean(item._checked) }));
14863
- if (_children && Array.isArray(_children)) {
14864
- result.push(...flattenTree(_children, _level + 1, _id));
15089
+ if (children && Array.isArray(children)) {
15090
+ result.push(...flattenTree(children, _level + 1, _id));
14865
15091
  }
14866
15092
  }
14867
15093
  return result;
@@ -15006,13 +15232,13 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
15006
15232
  tipShow.value === index && column.showTip ? withDirectives((openBlock(), createElementBlock("td", {
15007
15233
  key: column.prop,
15008
15234
  class: normalizeClass(["to-table-td", setTdClass(column).value]),
15009
- style: normalizeStyle({ paddingLeft: column.toggler && row.level ? `${row.level + 2}em` : "" }),
15235
+ style: normalizeStyle({ paddingLeft: column.toggler && row._level ? `${row._level + 2}em` : "" }),
15010
15236
  onMouseenter: (e) => handleMouseEnter(e, index),
15011
15237
  onMouseleave: handleMouseLeave
15012
15238
  }, [
15013
15239
  hasChildren(row) && column.toggler ? (openBlock(), createElementBlock("span", {
15014
15240
  key: 0,
15015
- class: normalizeClass(["to-table-toggle", { "is-expand": expandedSet.value.has(row.id) }]),
15241
+ class: normalizeClass(["to-table-toggle", { "is-expand": expandedSet.value.has(row._id) }]),
15016
15242
  onClick: ($event) => toggleExpand(row)
15017
15243
  }, null, 10, ["onClick"])) : createCommentVNode("", true),
15018
15244
  renderSlot(_ctx.$slots, column.prop, {
@@ -15027,13 +15253,13 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
15027
15253
  ]) : (openBlock(), createElementBlock("td", {
15028
15254
  key: column.prop + "else",
15029
15255
  class: normalizeClass(["to-table-td", setTdClass(column).value]),
15030
- style: normalizeStyle({ paddingLeft: column.toggler && row.level ? `${row.level + 2}em` : "" }),
15256
+ style: normalizeStyle({ paddingLeft: column.toggler && row._level ? `${row._level + 2}em` : "" }),
15031
15257
  onMouseenter: (e) => handleMouseEnter(e, index),
15032
15258
  onMouseleave: handleMouseLeave
15033
15259
  }, [
15034
15260
  hasChildren(row) && column.toggler ? (openBlock(), createElementBlock("span", {
15035
15261
  key: 0,
15036
- class: normalizeClass(["to-table-toggle", { "is-expand": expandedSet.value.has(row.id) }]),
15262
+ class: normalizeClass(["to-table-toggle", { "is-expand": expandedSet.value.has(row._id) }]),
15037
15263
  onClick: ($event) => toggleExpand(row)
15038
15264
  }, null, 10, ["onClick"])) : createCommentVNode("", true),
15039
15265
  renderSlot(_ctx.$slots, column.prop, {
@@ -17780,291 +18006,236 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
17780
18006
  }
17781
18007
  });
17782
18008
  withInstall(_sfc_main$y);
17783
- const fixProps = {
17784
- // 初始离左侧距离
17785
- left: { type: [String, Number], default: "auto" },
17786
- // 初始离右侧距离,left 为 'auto' 时有效
17787
- right: { type: [String, Number], default: 1 },
17788
- // 初始离顶部距离
17789
- top: { type: [String, Number], default: "auto" },
17790
- // 初始离底部距离,top 为 'auto' 时有效
17791
- bottom: { type: [String, Number], default: 1 },
17792
- number: { type: [String, Number], default: 0 },
17793
- appendToBody: { type: Boolean, default: true },
17794
- draggable: Boolean
17795
- };
18009
+ const DRAG_THRESHOLD = 5;
17796
18010
  const _sfc_main$x = /* @__PURE__ */ defineComponent({
17797
18011
  ...{
17798
18012
  name: "ToFix"
17799
18013
  },
17800
18014
  __name: "Fix",
17801
- props: fixProps,
17802
- emits: ["click"],
17803
- setup(__props, { emit: __emit }) {
18015
+ props: {
18016
+ mode: {
18017
+ type: String,
18018
+ default: "default"
18019
+ },
18020
+ top: {
18021
+ type: [String, Number],
18022
+ default: "auto"
18023
+ },
18024
+ number: {
18025
+ type: [String, Number],
18026
+ default: ""
18027
+ },
18028
+ left: {
18029
+ type: [String, Number],
18030
+ default: "auto"
18031
+ },
18032
+ right: {
18033
+ type: [String, Number],
18034
+ default: 1
18035
+ },
18036
+ bottom: {
18037
+ type: [String, Number],
18038
+ default: 1
18039
+ },
18040
+ appendToBody: {
18041
+ type: Boolean,
18042
+ default: true
18043
+ },
18044
+ draggable: Boolean
18045
+ },
18046
+ setup(__props) {
17804
18047
  const props = __props;
17805
- const emit = __emit;
17806
18048
  const content = ref(null);
17807
- const isDragging = ref(false);
18049
+ const resizeTimer = ref(null);
18050
+ const isDown = ref(false);
17808
18051
  const offsetX = ref(0);
17809
18052
  const offsetY = ref(0);
17810
18053
  const currentTop = ref(null);
17811
18054
  const currentLeft = ref(null);
17812
18055
  const currentRight = ref(null);
17813
18056
  const currentBottom = ref(null);
17814
- const draggingStarted = ref(false);
17815
- const initialPositionStyle = ref("");
17816
- let resizeTimer = null;
18057
+ const isDraging = ref(false);
18058
+ const startX = ref(0);
18059
+ const startY = ref(0);
17817
18060
  const setStyle = computed(() => {
17818
18061
  const obj = {};
17819
- obj.zIndex = 9999;
17820
- if (isDragging.value || currentTop.value || currentLeft.value) {
17821
- obj.position = "fixed";
17822
- if (currentLeft.value) {
17823
- obj.left = currentLeft.value;
17824
- obj.right = "auto";
17825
- }
17826
- if (currentTop.value) {
17827
- obj.top = currentTop.value;
18062
+ if (currentTop.value) {
18063
+ obj.top = currentTop.value;
18064
+ obj.bottom = "auto";
18065
+ } else {
18066
+ if (props.top && props.top !== "auto") {
18067
+ obj.top = props.top + "em";
17828
18068
  obj.bottom = "auto";
18069
+ } else if (props.bottom && props.bottom !== "auto") {
18070
+ obj.bottom = props.bottom + "em";
18071
+ obj.top = "auto";
17829
18072
  }
17830
- return obj;
17831
- }
17832
- if (props.top && props.top !== "auto") {
17833
- obj.top = addEm(props.top);
17834
- obj.bottom = "auto";
17835
- } else if (props.bottom && props.bottom !== "auto") {
17836
- obj.bottom = addEm(props.bottom);
17837
- obj.top = "auto";
17838
18073
  }
17839
- if (props.left && props.left !== "auto") {
17840
- obj.left = addEm(props.left);
18074
+ if (currentLeft.value) {
18075
+ obj.left = currentLeft.value;
17841
18076
  obj.right = "auto";
17842
- } else if (props.right && props.right !== "auto") {
17843
- obj.right = addEm(props.right);
17844
- obj.left = "auto";
18077
+ } else {
18078
+ if (props.left && props.left !== "auto") {
18079
+ obj.left = props.left + "em";
18080
+ obj.right = "auto";
18081
+ } else if (props.right && props.right !== "auto") {
18082
+ obj.right = props.right + "em";
18083
+ obj.left = "auto";
18084
+ }
17845
18085
  }
17846
18086
  return obj;
17847
18087
  });
17848
- function addEm(val) {
17849
- return isNaN(Number(val)) ? val : val + "em";
17850
- }
17851
- watch(isDragging, (val) => {
17852
- document.body.style.userSelect = val ? "none" : "";
17853
- });
17854
- onMounted(() => {
17855
- init();
17856
- });
17857
- onActivated(() => {
17858
- init();
17859
- });
17860
- onDeactivated(() => {
17861
- destroy();
17862
- });
17863
- onBeforeUnmount(() => {
17864
- destroy();
18088
+ const setClass = computed(() => {
18089
+ const arr = [];
18090
+ if (props.mode) {
18091
+ arr.push(`mode-${props.mode}`);
18092
+ }
18093
+ if (isDraging.value) {
18094
+ arr.push(`is-dragging`);
18095
+ }
18096
+ return arr;
17865
18097
  });
17866
- function init() {
17867
- if (props.right && props.right !== "auto") {
17868
- initialPositionStyle.value = "right";
17869
- } else if (props.bottom && props.bottom !== "auto") {
17870
- initialPositionStyle.value = "bottom";
17871
- } else if (props.left && props.left !== "auto") {
17872
- initialPositionStyle.value = "left";
18098
+ watch(isDown, (val) => {
18099
+ if (val) {
18100
+ document.body.style.userSelect = "none";
17873
18101
  } else {
17874
- initialPositionStyle.value = "top";
18102
+ document.body.style.userSelect = "";
17875
18103
  }
17876
- if (props.appendToBody && content.value && content.value.parentNode !== document.body) {
17877
- const wrapper = document.createElement("div");
17878
- wrapper.classList.add("to-fix-portal");
17879
- wrapper.style.position = "fixed";
17880
- wrapper.style.zIndex = "9999";
17881
- wrapper.style.pointerEvents = "none";
17882
- wrapper.appendChild(content.value);
17883
- document.body.appendChild(wrapper);
18104
+ });
18105
+ const init = () => {
18106
+ var _a2;
18107
+ if (props.appendToBody && ((_a2 = content.value) == null ? void 0 : _a2.parentElement)) {
18108
+ document.body.appendChild(content.value.parentElement);
17884
18109
  }
17885
18110
  window.addEventListener("resize", resize);
17886
- setTimeout(() => {
17887
- if (!content.value)
17888
- return;
17889
- const viewportWidth = document.documentElement.clientWidth;
17890
- const viewportHeight = document.documentElement.clientHeight;
17891
- const elWidth = content.value.offsetWidth;
17892
- const elHeight = content.value.offsetHeight;
17893
- let initialLeft, initialTop;
17894
- if (props.left && props.left !== "auto") {
17895
- const leftValue = isNaN(Number(props.left)) ? 0 : Number(props.left) * 16;
17896
- initialLeft = leftValue;
17897
- } else if (props.right && props.right !== "auto") {
17898
- const rightValue = isNaN(Number(props.right)) ? 0 : Number(props.right) * 16;
17899
- initialLeft = viewportWidth - elWidth - rightValue;
17900
- } else {
17901
- initialLeft = (viewportWidth - elWidth) / 2;
17902
- }
17903
- if (props.top && props.top !== "auto") {
17904
- const topValue = isNaN(Number(props.top)) ? 0 : Number(props.top) * 16;
17905
- initialTop = topValue;
17906
- } else if (props.bottom && props.bottom !== "auto") {
17907
- const bottomValue = isNaN(Number(props.bottom)) ? 0 : Number(props.bottom) * 16;
17908
- initialTop = viewportHeight - elHeight - bottomValue;
17909
- } else {
17910
- initialTop = (viewportHeight - elHeight) / 2;
17911
- }
17912
- updateElementPosition(initialLeft, initialTop);
17913
- }, 0);
17914
- }
17915
- function destroy() {
18111
+ };
18112
+ const destroy = () => {
18113
+ var _a2, _b;
17916
18114
  window.removeEventListener("resize", resize);
17917
- const portals = document.querySelectorAll(".to-fix-portal");
17918
- portals.forEach((portal) => {
17919
- if (portal.parentNode) {
17920
- portal.parentNode.removeChild(portal);
17921
- }
17922
- });
17923
- }
17924
- function onMouseDown(event) {
17925
- var _a2;
18115
+ if (props.appendToBody && ((_b = (_a2 = content.value) == null ? void 0 : _a2.parentElement) == null ? void 0 : _b.parentNode)) {
18116
+ content.value.parentElement.parentNode.removeChild(content.value.parentElement);
18117
+ }
18118
+ };
18119
+ const onMouseDown = (event) => {
17926
18120
  if (!props.draggable)
17927
18121
  return;
17928
- isDragging.value = true;
17929
- draggingStarted.value = false;
17930
- const rect = (_a2 = content.value) == null ? void 0 : _a2.getBoundingClientRect();
17931
- if (!rect)
17932
- return;
17933
- offsetX.value = event.clientX - rect.left;
17934
- offsetY.value = event.clientY - rect.top;
18122
+ isDown.value = true;
18123
+ isDraging.value = false;
18124
+ startX.value = event.clientX;
18125
+ startY.value = event.clientY;
18126
+ if (content.value) {
18127
+ const rect = content.value.getBoundingClientRect();
18128
+ offsetX.value = event.clientX - rect.left;
18129
+ offsetY.value = event.clientY - rect.top;
18130
+ }
17935
18131
  document.addEventListener("mousemove", onMouseMove);
17936
18132
  document.addEventListener("mouseup", onMouseUp);
17937
- event.preventDefault();
17938
- event.stopPropagation();
17939
- }
17940
- function onMouseMove(event) {
17941
- if (!isDragging.value || !content.value)
18133
+ };
18134
+ const onMouseMove = (event) => {
18135
+ if (!isDown.value)
17942
18136
  return;
17943
- draggingStarted.value = true;
17944
- const newLeft = event.clientX - offsetX.value;
17945
- const newTop = event.clientY - offsetY.value;
17946
- updateElementPosition(newLeft, newTop);
17947
- }
17948
- function onMouseUp() {
17949
- if (isDragging.value) {
17950
- isDragging.value = false;
17951
- document.removeEventListener("mousemove", onMouseMove);
17952
- document.removeEventListener("mouseup", onMouseUp);
18137
+ const distance = Math.sqrt(Math.pow(event.clientX - startX.value, 2) + Math.pow(event.clientY - startY.value, 2));
18138
+ if (distance >= DRAG_THRESHOLD) {
18139
+ isDraging.value = true;
18140
+ setPosition(event.clientX, event.clientY);
17953
18141
  }
17954
- }
17955
- function onTouchStart(event) {
17956
- var _a2;
18142
+ };
18143
+ const onMouseUp = () => {
18144
+ isDown.value = false;
18145
+ isDraging.value = false;
18146
+ document.removeEventListener("mousemove", onMouseMove);
18147
+ document.removeEventListener("mouseup", onMouseUp);
18148
+ setEmUnit();
18149
+ };
18150
+ const onTouchStart = (event) => {
17957
18151
  if (!props.draggable)
17958
18152
  return;
17959
- isDragging.value = true;
17960
- draggingStarted.value = false;
18153
+ isDown.value = true;
18154
+ isDraging.value = false;
17961
18155
  const touch = event.touches[0];
17962
- const rect = (_a2 = content.value) == null ? void 0 : _a2.getBoundingClientRect();
17963
- if (!rect)
17964
- return;
17965
- offsetX.value = touch.clientX - rect.left;
17966
- offsetY.value = touch.clientY - rect.top;
17967
- document.addEventListener("touchmove", onTouchMove, { passive: false });
18156
+ startX.value = touch.clientX;
18157
+ startY.value = touch.clientY;
18158
+ if (content.value) {
18159
+ const rect = content.value.getBoundingClientRect();
18160
+ offsetX.value = touch.clientX - rect.left;
18161
+ offsetY.value = touch.clientY - rect.top;
18162
+ }
18163
+ document.addEventListener("touchmove", onTouchMove);
17968
18164
  document.addEventListener("touchend", onTouchEnd);
17969
- event.preventDefault();
17970
- }
17971
- function onTouchMove(event) {
17972
- if (!isDragging.value || !content.value)
18165
+ };
18166
+ const onTouchMove = (event) => {
18167
+ if (!isDown.value)
17973
18168
  return;
17974
- draggingStarted.value = true;
17975
18169
  const touch = event.touches[0];
17976
- const newLeft = touch.clientX - offsetX.value;
17977
- const newTop = touch.clientY - offsetY.value;
17978
- updateElementPosition(newLeft, newTop);
17979
- event.preventDefault();
17980
- event.stopPropagation();
17981
- }
17982
- function onTouchEnd() {
17983
- if (isDragging.value) {
17984
- isDragging.value = false;
17985
- document.removeEventListener("touchmove", onTouchMove);
17986
- document.removeEventListener("touchend", onTouchEnd);
18170
+ const distance = Math.sqrt(Math.pow(touch.clientX - startX.value, 2) + Math.pow(touch.clientY - startY.value, 2));
18171
+ if (distance >= DRAG_THRESHOLD) {
18172
+ isDraging.value = true;
18173
+ setPosition(touch.clientX, touch.clientY);
17987
18174
  }
17988
- }
17989
- function onClick(event) {
17990
- if (draggingStarted.value) {
17991
- event.preventDefault();
17992
- event.stopPropagation();
17993
- draggingStarted.value = false;
17994
- } else {
17995
- emit("click");
18175
+ };
18176
+ const onTouchEnd = () => {
18177
+ isDown.value = false;
18178
+ isDraging.value = false;
18179
+ document.removeEventListener("touchmove", onTouchMove);
18180
+ document.removeEventListener("touchend", onTouchEnd);
18181
+ setEmUnit();
18182
+ };
18183
+ const setEmUnit = () => {
18184
+ if (content.value) {
18185
+ currentTop.value = content.value.getBoundingClientRect().top / getEm() + "em";
18186
+ currentLeft.value = content.value.getBoundingClientRect().left / getEm() + "em";
17996
18187
  }
17997
- }
17998
- function updateElementPosition(left, top) {
18188
+ };
18189
+ const setPosition = (clientX, clientY) => {
17999
18190
  if (!content.value)
18000
18191
  return;
18001
- const viewportWidth = document.documentElement.clientWidth;
18002
- const viewportHeight = document.documentElement.clientHeight;
18192
+ const container = content.value.offsetParent || document.documentElement;
18193
+ const containerRect = container.getBoundingClientRect();
18194
+ const elRect = content.value.getBoundingClientRect();
18003
18195
  const elWidth = content.value.offsetWidth;
18004
18196
  const elHeight = content.value.offsetHeight;
18005
- let newLeft = left;
18006
- let newTop = top;
18007
- const margin = 5;
18008
- if (newLeft < margin)
18009
- newLeft = margin;
18010
- if (newLeft + elWidth > viewportWidth - margin)
18011
- newLeft = viewportWidth - elWidth - margin;
18012
- if (newTop < margin)
18013
- newTop = margin;
18014
- if (newTop + elHeight > viewportHeight - margin)
18015
- newTop = viewportHeight - elHeight - margin;
18016
- currentLeft.value = `${newLeft}px`;
18197
+ let newLeft = clientX ? clientX - offsetX.value : elRect.left;
18198
+ let newTop = clientY ? clientY - offsetY.value : elRect.top;
18199
+ if (newLeft < 0)
18200
+ newLeft = 0;
18201
+ if (newLeft + elWidth > containerRect.width)
18202
+ newLeft = containerRect.width - elWidth;
18203
+ if (newTop < 0)
18204
+ newTop = 0;
18205
+ if (newTop + elHeight > containerRect.height)
18206
+ newTop = containerRect.height - elHeight;
18017
18207
  currentTop.value = `${newTop}px`;
18208
+ currentLeft.value = `${newLeft}px`;
18018
18209
  currentRight.value = "auto";
18019
18210
  currentBottom.value = "auto";
18020
- if (content.value.style) {
18021
- content.value.style.position = "fixed";
18022
- content.value.style.left = `${newLeft}px`;
18023
- content.value.style.top = `${newTop}px`;
18024
- content.value.style.right = "auto";
18025
- content.value.style.bottom = "auto";
18211
+ };
18212
+ const resize = () => {
18213
+ if (resizeTimer.value) {
18214
+ clearTimeout(resizeTimer.value);
18026
18215
  }
18027
- }
18028
- function resize() {
18029
- if (!content.value)
18030
- return;
18031
- if (resizeTimer)
18032
- clearTimeout(resizeTimer);
18033
- resizeTimer = setTimeout(() => {
18034
- var _a2;
18035
- const rect = (_a2 = content.value) == null ? void 0 : _a2.getBoundingClientRect();
18036
- if (!rect)
18037
- return;
18038
- const viewportWidth = document.documentElement.clientWidth;
18039
- const viewportHeight = document.documentElement.clientHeight;
18040
- const margin = 5;
18041
- let newLeft = rect.left;
18042
- let newTop = rect.top;
18043
- let needsUpdate = false;
18044
- if (rect.right > viewportWidth - margin) {
18045
- newLeft = viewportWidth - rect.width - margin;
18046
- needsUpdate = true;
18047
- }
18048
- if (rect.bottom > viewportHeight - margin) {
18049
- newTop = viewportHeight - rect.height - margin;
18050
- needsUpdate = true;
18051
- }
18052
- if (rect.left < margin) {
18053
- newLeft = margin;
18054
- needsUpdate = true;
18055
- }
18056
- if (rect.top < margin) {
18057
- newTop = margin;
18058
- needsUpdate = true;
18059
- }
18060
- if (needsUpdate) {
18061
- updateElementPosition(newLeft, newTop);
18062
- }
18216
+ resizeTimer.value = window.setTimeout(() => {
18217
+ setPosition();
18218
+ nextTick(() => {
18219
+ setEmUnit();
18220
+ });
18063
18221
  }, 300);
18064
- }
18222
+ };
18223
+ onMounted(() => {
18224
+ init();
18225
+ });
18226
+ onActivated(() => {
18227
+ init();
18228
+ });
18229
+ onDeactivated(() => {
18230
+ destroy();
18231
+ });
18232
+ onBeforeUnmount(() => {
18233
+ destroy();
18234
+ });
18065
18235
  return (_ctx, _cache) => {
18236
+ const _component_to_tag = resolveComponent("to-tag");
18066
18237
  return openBlock(), createElementBlock("div", {
18067
- class: normalizeClass(["to-fix", { "is-dragging": isDragging.value }])
18238
+ class: normalizeClass(["to-fix", setClass.value])
18068
18239
  }, [
18069
18240
  createElementVNode("div", {
18070
18241
  ref_key: "content",
@@ -18072,18 +18243,19 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
18072
18243
  class: "to-fix-wrapper",
18073
18244
  style: normalizeStyle(setStyle.value),
18074
18245
  onMousedown: onMouseDown,
18075
- onTouchstart: onTouchStart,
18076
- onClick: withModifiers(onClick, ["prevent"])
18246
+ onTouchstart: onTouchStart
18077
18247
  }, [
18078
18248
  renderSlot(_ctx.$slots, "default"),
18079
- Number(_ctx.number) ? (openBlock(), createElementBlock("div", {
18249
+ Number(__props.number) ? (openBlock(), createBlock(_component_to_tag, {
18080
18250
  key: 0,
18081
- class: "to-fix-number"
18082
- }, [
18083
- createElementVNode("div", { class: "to-fix-number-content" }, [
18084
- createElementVNode("div", { class: "to-fix-number-text" }, toDisplayString(_ctx.number), 1)
18085
- ])
18086
- ])) : createCommentVNode("", true)
18251
+ class: "to-fix-number",
18252
+ type: "number"
18253
+ }, {
18254
+ default: withCtx(() => [
18255
+ createTextVNode(toDisplayString(__props.number), 1)
18256
+ ]),
18257
+ _: 1
18258
+ })) : createCommentVNode("", true)
18087
18259
  ], 36)
18088
18260
  ], 2);
18089
18261
  };
@@ -18093,7 +18265,7 @@ withInstall(_sfc_main$x);
18093
18265
  const floatProps = {
18094
18266
  slide: { type: Boolean, default: false },
18095
18267
  lazy: { type: Boolean, default: true },
18096
- position: { type: String, default: "auto" },
18268
+ position: { type: String, default: "" },
18097
18269
  width: { type: [Number, String], default: "" },
18098
18270
  height: { type: [Number, String], default: "" },
18099
18271
  left: { type: [Number, String], default: "" },
@@ -18108,7 +18280,8 @@ const floatProps = {
18108
18280
  afterOpen: { type: Function, default: null },
18109
18281
  dx: { type: [Number, String], default: 0 },
18110
18282
  dy: { type: [Number, String], default: 0 },
18111
- mode: { type: String, default: "" }
18283
+ mode: { type: String, default: "" },
18284
+ global: { type: Boolean, default: true }
18112
18285
  };
18113
18286
  const floatEmits = ["click", "mouseenter", "mouseleave", "beforeOpen", "opened", "beforeClose", "closed"];
18114
18287
  const _sfc_main$w = /* @__PURE__ */ defineComponent({
@@ -18120,22 +18293,23 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
18120
18293
  props: floatProps,
18121
18294
  emits: floatEmits,
18122
18295
  setup(__props, { expose: __expose, emit: __emit }) {
18123
- const ins = getCurrentInstance().proxy;
18124
18296
  const props = __props;
18125
18297
  const emit = __emit;
18298
+ const attrs = useAttrs();
18126
18299
  const el = ref(null);
18127
18300
  const origin = ref("top");
18128
18301
  const ifShow = ref(false);
18129
- const show = ref(false);
18130
18302
  const scrollNode = ref(null);
18131
18303
  const iposition = ref(props.position || (props.slide ? "right" : "auto"));
18132
18304
  const ialign = ref(props.align);
18133
18305
  const link = ref(null);
18134
- const opened = ref(false);
18306
+ const isOpen = ref(false);
18135
18307
  const isOver = ref(false);
18136
18308
  const mask = ref(null);
18137
18309
  const wrapper = ref(null);
18310
+ const content = ref(null);
18138
18311
  const event = ref("");
18312
+ const size = ref(1);
18139
18313
  watch(
18140
18314
  () => props.position,
18141
18315
  (val) => {
@@ -18150,25 +18324,9 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
18150
18324
  },
18151
18325
  { immediate: true }
18152
18326
  );
18153
- watch(
18154
- () => show.value,
18155
- (val) => {
18156
- if (val) {
18157
- ins.$el.style.transform = "scale(1)";
18158
- setTimeout(() => {
18159
- ins.$el.style.transform = "";
18160
- }, 300);
18161
- } else {
18162
- ins.$el.style.transform = "scale(1)";
18163
- nextTick(() => {
18164
- ins.$el.style.transform = "scale(1, 0)";
18165
- });
18166
- }
18167
- }
18168
- );
18169
18327
  const setClass = computed(() => {
18170
18328
  const arr = [];
18171
- if (show.value)
18329
+ if (isOpen.value)
18172
18330
  arr.push("is-show");
18173
18331
  if (props.slide) {
18174
18332
  arr.push("is-slide");
@@ -18207,6 +18365,9 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
18207
18365
  else
18208
18366
  obj.top = props.top + "em";
18209
18367
  }
18368
+ if (size.value !== 1) {
18369
+ obj.fontSize = size.value + "em";
18370
+ }
18210
18371
  if (props.zIndex) {
18211
18372
  obj.zIndex = props.zIndex;
18212
18373
  } else {
@@ -18215,111 +18376,56 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
18215
18376
  }
18216
18377
  return obj;
18217
18378
  });
18218
- const wrapperStyle = ref({
18219
- width: "",
18220
- height: "",
18221
- transform: ""
18222
- });
18223
- function setWrapperStyle() {
18224
- if ((props.position === "right" || props.position === "left") && props.width) {
18379
+ const wrapperStyle = computed(() => {
18380
+ let obj = {};
18381
+ if ((iposition.value === "right" || iposition.value === "left") && props.width) {
18225
18382
  if (!isNaN(Number(props.width)))
18226
- wrapperStyle.value.width = props.width + "em";
18383
+ obj.width = props.width + "em";
18227
18384
  else if (props.width === "full")
18228
- wrapperStyle.value.width = "100%";
18229
- else
18230
- wrapperStyle.value.width = String(props.width);
18231
- }
18232
- if ((props.position === "top" || props.position === "bottom") && props.height) {
18233
- if (!isNaN(Number(props.height)))
18234
- wrapperStyle.value.height = props.height + "em";
18235
- else if (props.height === "full")
18236
- wrapperStyle.value.height = "100%";
18385
+ obj.width = "100%";
18237
18386
  else
18238
- wrapperStyle.value.height = String(props.height);
18387
+ obj.width = props.width;
18239
18388
  }
18240
- if (props.slide) {
18241
- setTransform();
18389
+ return obj;
18390
+ });
18391
+ onMounted(() => {
18392
+ init();
18393
+ });
18394
+ onActivated(() => {
18395
+ init();
18396
+ });
18397
+ onBeforeUnmount(() => {
18398
+ destroy();
18399
+ });
18400
+ onDeactivated(() => {
18401
+ destroy();
18402
+ });
18403
+ function init() {
18404
+ if (!props.slide) {
18405
+ window.addEventListener("resize", close2, false);
18242
18406
  }
18243
18407
  }
18244
- function setTransform() {
18245
- if (props.position === "top") {
18246
- wrapperStyle.value.transform = "translateY(-100%)";
18247
- }
18248
- if (props.position === "bottom") {
18249
- wrapperStyle.value.transform = "translateY(100%)";
18250
- }
18251
- if (props.position === "right") {
18252
- wrapperStyle.value.transform = "translateX(100%)";
18253
- }
18254
- if (props.position === "left") {
18255
- wrapperStyle.value.transform = "translateX(-100%)";
18408
+ function destroy() {
18409
+ if (!props.slide) {
18410
+ document.body.removeEventListener("mousedown", blur);
18411
+ document.body.removeEventListener("touchstart", blur);
18412
+ window.removeEventListener("resize", close2);
18256
18413
  }
18414
+ document.body.removeEventListener("scroll", close2);
18415
+ document.body.removeEventListener("wheel", close2);
18257
18416
  }
18258
18417
  function maskClickHandle() {
18259
18418
  if (props.closeOnBlur) {
18260
18419
  close2();
18261
18420
  }
18262
18421
  }
18263
- function close2(e) {
18264
- if (e && el.value && el.value.contains(e.target)) {
18265
- return;
18266
- }
18267
- if (show.value && opened.value) {
18268
- if (props.beforeClose) {
18269
- const fn = props.beforeClose();
18270
- if (fn && typeof fn.then === "function") {
18271
- fn.then(() => {
18272
- closeAction();
18273
- }).catch((error) => {
18274
- console.log(error);
18275
- });
18276
- } else {
18277
- if (fn)
18278
- closeAction();
18279
- }
18280
- } else {
18281
- closeAction();
18282
- }
18283
- }
18284
- }
18285
- function closeAction() {
18286
- if (!props.height && wrapper.value) {
18287
- wrapper.value.style.height = "";
18288
- }
18289
- isOver.value = false;
18290
- if (props.slide) {
18291
- wrapperStyle.value.transform = "translateX(0)";
18292
- setTimeout(() => {
18293
- show.value = false;
18294
- opened.value = false;
18295
- setTransform();
18296
- }, 10);
18297
- } else {
18298
- if (scrollNode.value) {
18299
- scrollNode.value.removeEventListener("scroll", close2);
18300
- }
18301
- emit("beforeClose");
18302
- show.value = false;
18303
- opened.value = false;
18304
- }
18305
- setTimeout(() => {
18306
- if (props.lazy) {
18307
- ifShow.value = false;
18308
- }
18309
- emit("closed");
18310
- if (props.afterClose && Object.prototype.toString.call(props.afterClose) === "[object Function]") {
18311
- props.afterClose();
18312
- }
18313
- }, 300);
18314
- }
18315
18422
  function set(link2) {
18316
18423
  if (props.slide) {
18317
- let timer = setTimeout(() => {
18424
+ setTimeout(() => {
18318
18425
  if ((iposition.value === "top" || iposition.value === "bottom") && !props.height && wrapper.value) {
18319
18426
  wrapper.value.style.height = "";
18320
- wrapper.value.style.height = wrapper.value.offsetHeight + "px";
18427
+ wrapper.value.style.height = wrapper.value.getBoundingClientRect().height + "px";
18321
18428
  }
18322
- clearTimeout(timer);
18323
18429
  }, 0);
18324
18430
  } else if (link2) {
18325
18431
  if (wrapper.value)
@@ -18330,15 +18436,15 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
18330
18436
  if ("x" in link2 || "touches" in link2) {
18331
18437
  el.value.style.width = "14em";
18332
18438
  } else {
18333
- el.value.style.width = link2.offsetWidth + "px";
18439
+ el.value.style.width = link2.getBoundingClientRect().width + "px";
18334
18440
  }
18335
18441
  }
18336
18442
  if (props.top === "" || props.left === "") {
18337
18443
  let x, y, linkWidth, linkHeight;
18338
- const wrapperWidth = ((_a2 = wrapper.value) == null ? void 0 : _a2.offsetWidth) || 0;
18339
- const wrapperHeight = ((_b = wrapper.value) == null ? void 0 : _b.offsetHeight) || 0;
18340
- const bodyWidth = document.body.offsetWidth;
18341
- const bodyHeight = document.body.offsetHeight;
18444
+ const wrapperWidth = ((_a2 = wrapper.value) == null ? void 0 : _a2.getBoundingClientRect().width) || 0;
18445
+ const wrapperHeight = ((_b = wrapper.value) == null ? void 0 : _b.getBoundingClientRect().height) || 0;
18446
+ const bodyWidth = document.body.getBoundingClientRect().width;
18447
+ const bodyHeight = document.body.getBoundingClientRect().height;
18342
18448
  let topSpace, bottomSpace, leftSpace, rightSpace;
18343
18449
  let useSpace = 0;
18344
18450
  const dx = Number(props.dx) * 1;
@@ -18351,14 +18457,14 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
18351
18457
  } else {
18352
18458
  x = link2.getBoundingClientRect().left;
18353
18459
  y = link2.getBoundingClientRect().top;
18354
- linkWidth = link2.offsetWidth;
18355
- linkHeight = link2.offsetHeight;
18460
+ linkWidth = link2.getBoundingClientRect().width;
18461
+ linkHeight = link2.getBoundingClientRect().height;
18356
18462
  }
18357
18463
  topSpace = y;
18358
18464
  bottomSpace = bodyHeight - y - linkHeight;
18359
18465
  leftSpace = x;
18360
18466
  rightSpace = bodyWidth - x - linkWidth;
18361
- if (props.position === "auto") {
18467
+ if (!props.position) {
18362
18468
  if (bottomSpace >= wrapperHeight) {
18363
18469
  iposition.value = "bottom";
18364
18470
  } else if (y >= wrapperHeight) {
@@ -18446,6 +18552,11 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
18446
18552
  isOver.value = true;
18447
18553
  wrapper.value.style.height = useSpace + "px";
18448
18554
  }
18555
+ if (link2) {
18556
+ const ratio = link2.getBoundingClientRect().width / link2.offsetWidth;
18557
+ const ratio2 = Number(getComputedStyle(link2).fontSize.trim().toLowerCase().replace(/px$/, "")) / Number(getComputedStyle(document.body).fontSize.trim().toLowerCase().replace(/px$/, ""));
18558
+ size.value = ratio * ratio2;
18559
+ }
18449
18560
  }
18450
18561
  });
18451
18562
  }
@@ -18468,29 +18579,26 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
18468
18579
  }
18469
18580
  }
18470
18581
  function openAction(by) {
18471
- if (!show.value && (!props.lazy || !ifShow.value)) {
18582
+ if (!isOpen.value) {
18472
18583
  emit("beforeOpen");
18473
18584
  if (props.slide) {
18474
18585
  if (props.lazy) {
18475
18586
  ifShow.value = true;
18476
18587
  }
18477
- setTimeout(() => {
18478
- show.value = true;
18479
- }, 0);
18480
- setTimeout(() => {
18481
- wrapperStyle.value.transform = "translateX(0)";
18482
- }, 10);
18588
+ nextTick(() => {
18589
+ set();
18590
+ setOpenStyle();
18591
+ });
18483
18592
  if (props.afterOpen && Object.prototype.toString.call(props.afterOpen) === "[object Function]") {
18484
18593
  props.afterOpen();
18485
18594
  }
18486
18595
  let timer = null;
18487
18596
  timer = setTimeout(() => {
18488
18597
  emit("opened");
18489
- opened.value = true;
18490
18598
  clearTimeout(timer);
18491
18599
  timer = null;
18492
- wrapperStyle.value.transform = "";
18493
- }, 300);
18600
+ }, 100);
18601
+ isOpen.value = true;
18494
18602
  } else {
18495
18603
  document.body.addEventListener("mousedown", blur);
18496
18604
  document.body.addEventListener("touchstart", blur);
@@ -18517,24 +18625,121 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
18517
18625
  ifShow.value = true;
18518
18626
  }
18519
18627
  setTimeout(() => {
18520
- show.value = true;
18521
- }, 0);
18522
- nextTick(() => {
18523
18628
  set(link.value);
18629
+ setOpenStyle();
18524
18630
  if (link.value && !("x" in link.value) && !("touches" in link.value)) {
18525
18631
  setScrollStatus();
18526
18632
  }
18527
- });
18633
+ }, 0);
18528
18634
  if (props.afterOpen && Object.prototype.toString.call(props.afterOpen) === "[object Function]") {
18529
18635
  props.afterOpen();
18530
18636
  }
18531
18637
  emit("opened");
18532
- opened.value = true;
18638
+ isOpen.value = true;
18639
+ }
18640
+ }
18641
+ }
18642
+ function setOpenStyle() {
18643
+ if (props.slide) {
18644
+ if (iposition.value === "top") {
18645
+ wrapper.value.style.transform = "translateY(-100%)";
18646
+ }
18647
+ if (iposition.value === "bottom") {
18648
+ wrapper.value.style.transform = "translateY(100%)";
18649
+ }
18650
+ if (iposition.value === "right") {
18651
+ wrapper.value.style.transform = "translateX(100%)";
18652
+ }
18653
+ if (iposition.value === "left") {
18654
+ wrapper.value.style.transform = "translateX(-100%)";
18655
+ }
18656
+ setTimeout(() => {
18657
+ wrapper.value.style.transition = "transform 100ms ease-out";
18658
+ wrapper.value.style.transform = "translateY(0)";
18659
+ setTimeout(() => {
18660
+ wrapper.value.style.transform = "";
18661
+ }, 100);
18662
+ }, 0);
18663
+ } else {
18664
+ el.value.style.transform = "scale(1, 0)";
18665
+ el.value.style.visibility = "visible";
18666
+ setTimeout(() => {
18667
+ el.value.style.transition = "transform 100ms ease-out";
18668
+ el.value.style.transform = "scale(1)";
18669
+ setTimeout(() => {
18670
+ el.value.style.transform = "";
18671
+ }, 100);
18672
+ }, 0);
18673
+ }
18674
+ }
18675
+ function close2(e) {
18676
+ if (e && el.value && el.value.contains(e.target)) {
18677
+ return;
18678
+ }
18679
+ if (isOpen.value) {
18680
+ if (props.beforeClose) {
18681
+ const fn = props.beforeClose();
18682
+ if (fn && typeof fn.then === "function") {
18683
+ fn.then(() => {
18684
+ closeAction();
18685
+ }).catch((error) => {
18686
+ console.log(error);
18687
+ });
18688
+ } else {
18689
+ if (fn)
18690
+ closeAction();
18691
+ }
18692
+ } else {
18693
+ closeAction();
18694
+ }
18695
+ }
18696
+ }
18697
+ function closeAction() {
18698
+ if (!props.height && wrapper.value) {
18699
+ wrapper.value.style.height = "";
18700
+ }
18701
+ isOver.value = false;
18702
+ if (props.slide) {
18703
+ setCloseStyle();
18704
+ isOpen.value = false;
18705
+ } else {
18706
+ if (scrollNode.value) {
18707
+ scrollNode.value.removeEventListener("scroll", close2);
18708
+ }
18709
+ emit("beforeClose");
18710
+ setCloseStyle();
18711
+ isOpen.value = false;
18712
+ }
18713
+ setTimeout(() => {
18714
+ if (props.lazy) {
18715
+ ifShow.value = false;
18716
+ }
18717
+ emit("closed");
18718
+ if (props.afterClose && Object.prototype.toString.call(props.afterClose) === "[object Function]") {
18719
+ props.afterClose();
18533
18720
  }
18721
+ }, 100);
18722
+ }
18723
+ function setCloseStyle() {
18724
+ if (props.slide) {
18725
+ if (iposition.value === "top") {
18726
+ wrapper.value.style.transform = "translateY(-100%)";
18727
+ }
18728
+ if (iposition.value === "bottom") {
18729
+ wrapper.value.style.transform = "translateY(100%)";
18730
+ }
18731
+ if (iposition.value === "right") {
18732
+ wrapper.value.style.transform = "translateX(100%)";
18733
+ }
18734
+ if (iposition.value === "left") {
18735
+ wrapper.value.style.transform = "translateX(-100%)";
18736
+ }
18737
+ } else {
18738
+ el.value.style.transform = "scale(1,0)";
18534
18739
  }
18535
18740
  }
18536
18741
  function toggle(by) {
18537
- if (show.value) {
18742
+ if (isOpen.value) {
18538
18743
  close2();
18539
18744
  } else {
18540
18745
  if (by) {
@@ -18568,47 +18773,8 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
18568
18773
  });
18569
18774
  }
18570
18775
  function setScrollStatus() {
18571
- const searchNode = (Node) => {
18572
- if (Node.nodeName === "BODY") {
18573
- return Node;
18574
- } else {
18575
- if (Node.nodeName === "DIV" && typeof Node.className === "string" && Node.className.indexOf("to-scroll-content") > -1) {
18576
- return Node;
18577
- } else {
18578
- return searchNode(Node.parentNode);
18579
- }
18580
- }
18581
- };
18582
- if (link.value && "parentNode" in link.value && link.value.parentNode) {
18583
- scrollNode.value = searchNode(link.value.parentNode);
18584
- if (scrollNode.value) {
18585
- if (scrollNode.value) {
18586
- scrollNode.value.addEventListener("scroll", close2, { passive: true });
18587
- scrollNode.value.addEventListener("wheel", close2, { passive: true });
18588
- }
18589
- }
18590
- }
18591
- }
18592
- onMounted(() => {
18593
- if (!props.slide) {
18594
- window.addEventListener("resize", resizeHandle, false);
18595
- } else {
18596
- setWrapperStyle();
18597
- }
18598
- });
18599
- onBeforeUnmount(() => {
18600
- if (!props.slide) {
18601
- document.body.removeEventListener("mousedown", blur);
18602
- document.body.removeEventListener("touchstart", blur);
18603
- window.removeEventListener("resize", resizeHandle);
18604
- }
18605
- if (scrollNode.value) {
18606
- scrollNode.value.removeEventListener("scroll", close2);
18607
- scrollNode.value.removeEventListener("wheel", close2);
18608
- }
18609
- });
18610
- function resizeHandle() {
18611
- close2();
18776
+ document.body.addEventListener("scroll", close2, { passive: true });
18777
+ document.body.addEventListener("wheel", close2, { passive: true });
18612
18778
  }
18613
18779
  async function getElementFromRef(refOrNode) {
18614
18780
  var _a2;
@@ -18628,34 +18794,45 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
18628
18794
  }
18629
18795
  __expose({ open: open2, close: close2, toggle, set });
18630
18796
  return (_ctx, _cache) => {
18631
- return (_ctx.lazy ? ifShow.value : true) ? (openBlock(), createElementBlock("div", {
18632
- key: 0,
18633
- ref_key: "el",
18634
- ref: el,
18635
- class: normalizeClass(["to-float", [...setClass.value, _ctx.$attrs.class]]),
18636
- style: normalizeStyle(setStyle.value),
18637
- onMousedown: ($event) => _ctx.$emit("click"),
18638
- onTouchstart: ($event) => _ctx.$emit("click"),
18639
- onMouseenter: ($event) => _ctx.$emit("mouseenter"),
18640
- onMouseleave: ($event) => _ctx.$emit("mouseleave")
18797
+ return openBlock(), createBlock(Teleport, {
18798
+ to: "body",
18799
+ disabled: !_ctx.global
18641
18800
  }, [
18642
- createElementVNode("div", {
18643
- ref_key: "mask",
18644
- ref: mask,
18645
- class: "to-float-mask",
18646
- onClick: maskClickHandle
18647
- }, null, 512),
18648
- createElementVNode("div", {
18649
- ref_key: "wrapper",
18650
- ref: wrapper,
18651
- class: "to-float-wrapper",
18652
- style: normalizeStyle(wrapperStyle.value)
18801
+ (_ctx.lazy ? ifShow.value : true) ? (openBlock(), createElementBlock("div", {
18802
+ key: 0,
18803
+ ref_key: "el",
18804
+ ref: el,
18805
+ class: normalizeClass(["to-float", [setClass.value, unref(attrs).class]]),
18806
+ style: normalizeStyle([setStyle.value, unref(attrs).style]),
18807
+ onMousedown: ($event) => _ctx.$emit("click"),
18808
+ onTouchstart: ($event) => _ctx.$emit("click"),
18809
+ onMouseenter: ($event) => _ctx.$emit("mouseenter"),
18810
+ onMouseleave: ($event) => _ctx.$emit("mouseleave"),
18811
+ onClick: withModifiers(() => {
18812
+ }, ["stop"])
18653
18813
  }, [
18654
- createElementVNode("div", { class: "to-float-content" }, [
18655
- renderSlot(_ctx.$slots, "default")
18656
- ])
18657
- ], 4)
18658
- ], 46, ["onMousedown", "onTouchstart", "onMouseenter", "onMouseleave"])) : createCommentVNode("", true);
18814
+ createElementVNode("div", {
18815
+ ref_key: "mask",
18816
+ ref: mask,
18817
+ class: "to-float-mask",
18818
+ onClick: maskClickHandle
18819
+ }, null, 512),
18820
+ createElementVNode("div", {
18821
+ ref_key: "wrapper",
18822
+ ref: wrapper,
18823
+ class: "to-float-wrapper",
18824
+ style: normalizeStyle(_ctx.slide ? wrapperStyle.value : null)
18825
+ }, [
18826
+ createElementVNode("div", {
18827
+ ref_key: "content",
18828
+ ref: content,
18829
+ class: "to-float-content"
18830
+ }, [
18831
+ renderSlot(_ctx.$slots, "default")
18832
+ ], 512)
18833
+ ], 4)
18834
+ ], 46, ["onMousedown", "onTouchstart", "onMouseenter", "onMouseleave", "onClick"])) : createCommentVNode("", true)
18835
+ ], 8, ["disabled"]);
18659
18836
  };
18660
18837
  }
18661
18838
  });
@@ -20753,10 +20930,9 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
20753
20930
  onTouchend: touchend,
20754
20931
  onTouchmove: touchmove
20755
20932
  }, [
20756
- createElementVNode("div", { class: "pic" }, [
20933
+ createElementVNode("div", { class: "to-slide-pic" }, [
20757
20934
  createElementVNode("ul", {
20758
- ref_key: "ul",
20759
- ref: ul,
20935
+ ref: "to-slide-wrapper",
20760
20936
  style: normalizeStyle(setUlStyle.value)
20761
20937
  }, [
20762
20938
  createElementVNode("li", {
@@ -22015,34 +22191,41 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
22015
22191
  }, [
22016
22192
  createCommentVNode("", true)
22017
22193
  ]),
22018
- createVNode(unref(ToFloat), {
22019
- ref_key: "cascaderFloat",
22020
- ref: cascaderFloat,
22021
- class: "to-cascader-layer",
22022
- width: floatWidth.value,
22023
- lazy: "",
22024
- onClosed: afterClose
22025
- }, {
22026
- default: withCtx(() => [
22027
- !data_.value.length ? (openBlock(), createElementBlock("div", {
22028
- key: 0,
22029
- style: { "text-align": "center", "color": "#ccc", "padding": "3em 0.3em" }
22030
- }, "暂无数据")) : createCommentVNode("", true),
22031
- createVNode(_component_to_scroll, {
22032
- onClick: withModifiers(() => {
22033
- }, ["stop"])
22194
+ (openBlock(), createBlock(Teleport, { to: "body" }, [
22195
+ createElementVNode("div", {
22196
+ class: normalizeClass(["to-cascader", setClass.value])
22197
+ }, [
22198
+ createVNode(unref(ToFloat), {
22199
+ ref_key: "cascaderFloat",
22200
+ ref: cascaderFloat,
22201
+ global: false,
22202
+ class: "to-cascader-layer",
22203
+ width: floatWidth.value,
22204
+ lazy: "",
22205
+ onClosed: afterClose
22034
22206
  }, {
22035
22207
  default: withCtx(() => [
22036
- (openBlock(), createBlock(_sfc_main$i, {
22037
- key: String(data_.value),
22038
- data: data_.value
22039
- }, null, 8, ["data"]))
22208
+ !data_.value.length ? (openBlock(), createElementBlock("div", {
22209
+ key: 0,
22210
+ style: { "text-align": "center", "color": "#ccc", "padding": "3em 0.3em" }
22211
+ }, "暂无数据")) : createCommentVNode("", true),
22212
+ createVNode(_component_to_scroll, {
22213
+ onClick: withModifiers(() => {
22214
+ }, ["stop"])
22215
+ }, {
22216
+ default: withCtx(() => [
22217
+ (openBlock(), createBlock(_sfc_main$i, {
22218
+ key: String(data_.value),
22219
+ data: data_.value
22220
+ }, null, 8, ["data"]))
22221
+ ]),
22222
+ _: 1
22223
+ }, 8, ["onClick"])
22040
22224
  ]),
22041
22225
  _: 1
22042
- }, 8, ["onClick"])
22043
- ]),
22044
- _: 1
22045
- }, 8, ["width"]),
22226
+ }, 8, ["width"])
22227
+ ], 2)
22228
+ ])),
22046
22229
  errorTip.value ? withDirectives((openBlock(), createElementBlock("span", {
22047
22230
  key: 4,
22048
22231
  class: "to-box-tip"
@@ -23459,7 +23642,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
23459
23642
  disabled: { type: Boolean, default: false },
23460
23643
  downloadable: { type: Boolean, default: false },
23461
23644
  name: { default: "uploadfile" },
23462
- credentialsable: { type: Boolean, default: false },
23645
+ withCredentials: { type: Boolean, default: false },
23463
23646
  files: { default: () => [] },
23464
23647
  data: { default: () => ({}) },
23465
23648
  beforeSelect: { type: [Function, null], default: null },
@@ -23641,7 +23824,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
23641
23824
  action: props.action,
23642
23825
  data: formData,
23643
23826
  headers: props.headers,
23644
- withCredentials: props.credentialsable,
23827
+ withCredentials: props.withCredentials,
23645
23828
  onError: (err, status) => {
23646
23829
  setFilePropertyByUid(file.uid, "status", "error");
23647
23830
  emit("error", err, status, file);
@@ -23947,7 +24130,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
23947
24130
  opened: { type: Function, default: () => true },
23948
24131
  beforeOpen: { type: Function, default: () => true },
23949
24132
  headers: { default: () => null },
23950
- credentialsable: { type: Boolean, default: false },
24133
+ withCredentials: { type: Boolean, default: false },
23951
24134
  data: { default: () => null },
23952
24135
  disabled: { type: Boolean, default: false }
23953
24136
  },
@@ -23959,39 +24142,106 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
23959
24142
  return !!instance.vnode.props.onDownloadTemplate;
23960
24143
  };
23961
24144
  const emit = __emit;
23962
- const _fileName = ref("");
23963
- const floatEl = ref(null);
24145
+ const state = ref("");
24146
+ const fileName = ref("");
24147
+ const layer = ref(null);
23964
24148
  const iconEl = ref(null);
23965
- const buttonEl = ref(null);
24149
+ const button = ref(null);
23966
24150
  const fileInput = ref(null);
23967
24151
  const btnIcon = ref("import");
24152
+ const isDragOver = ref(false);
24153
+ const isFloatOpen = ref(false);
24154
+ const errorTip = ref("");
23968
24155
  const setClass = computed(() => {
23969
24156
  let arr = [];
23970
24157
  if (props.mode) {
23971
24158
  arr.push(`mode-${props.mode}`);
23972
24159
  }
24160
+ if (state.value) {
24161
+ arr.push(`state-${state.value}`);
24162
+ }
23973
24163
  return arr;
23974
24164
  });
24165
+ const setFileClass = computed(() => {
24166
+ let arr = [];
24167
+ if (isDragOver.value) {
24168
+ arr.push("is-dragover");
24169
+ }
24170
+ return arr;
24171
+ });
24172
+ const fileTypeIcons = {
24173
+ excel: [".xls", ".xlsx", ".csv"],
24174
+ img: [".png", ".jpg", ".gif", ".apng", ".webp"],
24175
+ ppt: [".ppt", ".pptx", ".ppsx"],
24176
+ rar: [".rar", ".zip", ".tar", ".gz", ".tgz"],
24177
+ video: [".rm", ".rmvb", ".avi", ".mkv", ".mp4", ".wmv", ".mov", ".movie", ".mpeg", ".mpg", ".qt"],
24178
+ voice: [".mp2", ".mp3", ".wma", ".midi"],
24179
+ word: [".doc", ".docx"]
24180
+ };
24181
+ const getIcon = computed(() => {
24182
+ if (!state.value) {
24183
+ return "upload";
24184
+ }
24185
+ if (state.value === "uploading") {
24186
+ return "loading";
24187
+ }
24188
+ if (state.value === "success") {
24189
+ return "ok";
24190
+ }
24191
+ if (state.value === "error") {
24192
+ return "close";
24193
+ }
24194
+ if (!fileName.value || typeof fileName.value !== "string") {
24195
+ return "default";
24196
+ }
24197
+ let ext;
24198
+ if (fileName.value.startsWith(".")) {
24199
+ ext = fileName.value.toLowerCase();
24200
+ } else {
24201
+ const lastDotIndex = fileName.value.lastIndexOf(".");
24202
+ if (lastDotIndex === -1) {
24203
+ return "default";
24204
+ }
24205
+ ext = fileName.value.slice(lastDotIndex).toLowerCase();
24206
+ }
24207
+ for (const [iconType, extList] of Object.entries(fileTypeIcons)) {
24208
+ if (extList.includes(ext)) {
24209
+ return iconType;
24210
+ }
24211
+ }
24212
+ return "default";
24213
+ });
24214
+ const validateFileType = (file) => {
24215
+ if (!props.accept)
24216
+ return true;
24217
+ const fileName2 = file.name.toLowerCase();
24218
+ const acceptRules = props.accept.split(",").map((rule) => rule.trim().toLowerCase());
24219
+ return acceptRules.some((rule) => {
24220
+ if (rule.startsWith(".")) {
24221
+ return fileName2.endsWith(rule);
24222
+ } else if (rule === "*/*") {
24223
+ return true;
24224
+ } else if (rule.includes("/*")) {
24225
+ const typePrefix = rule.split("/*")[0];
24226
+ return file.type.toLowerCase().startsWith(typePrefix + "/");
24227
+ } else {
24228
+ return file.type.toLowerCase() === rule;
24229
+ }
24230
+ });
24231
+ };
23975
24232
  const handleChange = async (e) => {
23976
- let flag = true;
23977
- if (props.beforeStart) {
23978
- if (typeof props.beforeStart === "function") {
23979
- const result = props.beforeStart(e.target.files[0]);
23980
- if (result && typeof result.then === "function") {
23981
- flag = await result;
23982
- } else {
23983
- flag = !!result;
23984
- }
24233
+ const files = e.target.files;
24234
+ if (files && files.length > 0) {
24235
+ const file = files[0];
24236
+ if (validateFileType(file)) {
24237
+ await processFile(file);
23985
24238
  } else {
23986
- flag = !!props.beforeStart;
24239
+ state.value = "error";
24240
+ errorTip.value = "文件类型不正确";
24241
+ fileName.value = "";
24242
+ e.target.value = "";
23987
24243
  }
23988
24244
  }
23989
- if (!flag || !props.action)
23990
- return false;
23991
- _fileName.value = e.target.files[0].name;
23992
- btnIcon.value = "loading";
23993
- emit("start", e.target.files[0]);
23994
- handleUpload(e.target.files[0]);
23995
24245
  };
23996
24246
  async function handleUpload(file) {
23997
24247
  let formData = new FormData();
@@ -24001,20 +24251,36 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
24001
24251
  formData.append(key, props.data[key]);
24002
24252
  });
24003
24253
  }
24254
+ state.value = "uploading";
24004
24255
  fileAjax({
24005
24256
  action: props.action,
24006
24257
  data: formData,
24007
24258
  headers: props.headers,
24008
- withCredentials: props.credentialsable,
24259
+ withCredentials: props.withCredentials,
24009
24260
  onError: (err, status) => {
24261
+ var _a2;
24262
+ state.value = "error";
24010
24263
  emit("error", err, status, file);
24264
+ switch (err.type) {
24265
+ case "network_error":
24266
+ errorTip.value = "网络错误:" + err.message;
24267
+ break;
24268
+ case "http_error":
24269
+ errorTip.value = `服务器错误(${status}):${((_a2 = err.response) == null ? void 0 : _a2.message) || err.message}`;
24270
+ break;
24271
+ case "parse_error":
24272
+ errorTip.value = "服务器返回数据格式错误:" + err.message;
24273
+ break;
24274
+ }
24011
24275
  },
24012
24276
  onSuccess: (data, status) => {
24013
- let _data = JSON.parse(data);
24277
+ let _data = JSON.parse(JSON.stringify(data));
24014
24278
  btnIcon.value = "import";
24279
+ state.value = "success";
24015
24280
  emit("success", _data, status, file);
24016
24281
  },
24017
24282
  onProgress: (e) => {
24283
+ state.value = "uploading";
24018
24284
  emit("progress", e.loaded, e.total, file);
24019
24285
  }
24020
24286
  });
@@ -24022,7 +24288,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
24022
24288
  const handleFloat = (el) => {
24023
24289
  if (props.disabled)
24024
24290
  return false;
24025
- floatEl.value.toggle(el);
24291
+ layer.value.toggle(el);
24026
24292
  };
24027
24293
  const handleImport = () => {
24028
24294
  fileInput.value.click();
@@ -24030,26 +24296,128 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
24030
24296
  const downloadTem = () => {
24031
24297
  emit("download-template");
24032
24298
  };
24299
+ const handleReset = () => {
24300
+ state.value = "";
24301
+ fileName.value = "";
24302
+ errorTip.value = "";
24303
+ btnIcon.value = "import";
24304
+ if (fileInput.value) {
24305
+ fileInput.value.value = "";
24306
+ }
24307
+ };
24308
+ const handleFloatOpened = () => {
24309
+ isFloatOpen.value = true;
24310
+ addPasteListener();
24311
+ if (props.opened) {
24312
+ props.opened();
24313
+ }
24314
+ };
24315
+ const handleFloatClosed = () => {
24316
+ removePasteListener();
24317
+ isFloatOpen.value = false;
24318
+ if (props.closed) {
24319
+ props.closed();
24320
+ }
24321
+ };
24322
+ const handleDragOver = () => {
24323
+ isDragOver.value = true;
24324
+ };
24325
+ const handleDragLeave = () => {
24326
+ isDragOver.value = false;
24327
+ };
24328
+ const handleDrop = async (e) => {
24329
+ var _a2;
24330
+ isDragOver.value = false;
24331
+ const files = (_a2 = e.dataTransfer) == null ? void 0 : _a2.files;
24332
+ if (files && files.length > 0) {
24333
+ const file = files[0];
24334
+ if (validateFileType(file)) {
24335
+ await processFile(file);
24336
+ } else {
24337
+ state.value = "error";
24338
+ errorTip.value = "文件类型不正确";
24339
+ fileName.value = "";
24340
+ }
24341
+ }
24342
+ };
24343
+ const handlePaste = async (e) => {
24344
+ var _a2;
24345
+ if (!isFloatOpen.value)
24346
+ return;
24347
+ const items = (_a2 = e.clipboardData) == null ? void 0 : _a2.items;
24348
+ if (!items)
24349
+ return;
24350
+ for (let i = 0; i < items.length; i++) {
24351
+ const item = items[i];
24352
+ if (item.kind === "file") {
24353
+ const file = item.getAsFile();
24354
+ if (file && validateFileType(file)) {
24355
+ e.preventDefault();
24356
+ await processFile(file);
24357
+ break;
24358
+ } else if (file) {
24359
+ e.preventDefault();
24360
+ state.value = "error";
24361
+ errorTip.value = "文件类型不正确";
24362
+ fileName.value = "";
24363
+ break;
24364
+ }
24365
+ }
24366
+ }
24367
+ };
24368
+ const addPasteListener = () => {
24369
+ document.body.addEventListener("paste", handlePaste);
24370
+ };
24371
+ const removePasteListener = () => {
24372
+ document.body.removeEventListener("paste", handlePaste);
24373
+ };
24374
+ onBeforeUnmount(() => {
24375
+ removePasteListener();
24376
+ });
24377
+ const processFile = async (file) => {
24378
+ let flag = true;
24379
+ if (props.beforeStart) {
24380
+ if (typeof props.beforeStart === "function") {
24381
+ const result = props.beforeStart(file);
24382
+ if (result && typeof result.then === "function") {
24383
+ flag = await result;
24384
+ } else {
24385
+ flag = !!result;
24386
+ }
24387
+ } else {
24388
+ flag = !!props.beforeStart;
24389
+ }
24390
+ }
24391
+ if (!flag || !props.action)
24392
+ return false;
24393
+ fileName.value = file.name;
24394
+ btnIcon.value = "loading";
24395
+ emit("start", file);
24396
+ handleUpload(file);
24397
+ };
24033
24398
  return (_ctx, _cache) => {
24399
+ const _component_to_scroll = resolveComponent("to-scroll");
24034
24400
  return openBlock(), createElementBlock("span", {
24035
24401
  class: normalizeClass(["to-import", setClass.value])
24036
24402
  }, [
24037
- createElementVNode("input", {
24403
+ withDirectives(createElementVNode("input", {
24038
24404
  ref_key: "fileInput",
24039
24405
  ref: fileInput,
24040
24406
  type: "file",
24041
24407
  accept: __props.accept,
24042
- style: { "display": "none" },
24043
24408
  onChange: handleChange
24044
- }, null, 40, ["accept"]),
24409
+ }, null, 40, ["accept"]), [
24410
+ [vShow, false]
24411
+ ]),
24045
24412
  props.type === "button" ? (openBlock(), createBlock(unref(ToButton), {
24046
24413
  key: 0,
24047
- ref_key: "buttonEl",
24048
- ref: buttonEl,
24049
- icon: "import|left",
24414
+ ref_key: "button",
24415
+ ref: button,
24416
+ class: "to-import-button",
24417
+ icon: "import",
24050
24418
  disabled: props.disabled,
24051
24419
  expand: "",
24052
- onClick: withModifiers(($event) => handleFloat(buttonEl.value), ["stop"])
24420
+ onClick: withModifiers(($event) => handleFloat(button.value), ["stop"])
24053
24421
  }, {
24054
24422
  default: withCtx(() => [
24055
24423
  createTextVNode(toDisplayString(props.buttonText), 1)
@@ -24059,63 +24427,73 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
24059
24427
  key: 1,
24060
24428
  ref_key: "iconEl",
24061
24429
  ref: iconEl,
24430
+ link: "",
24062
24431
  value: "import",
24432
+ class: "to-import-icon",
24063
24433
  disabled: props.disabled,
24064
24434
  onClick: withModifiers(($event) => handleFloat(iconEl.value), ["stop"])
24065
24435
  }, null, 8, ["disabled", "onClick"])),
24066
24436
  createVNode(unref(ToFloat), {
24067
- ref_key: "floatEl",
24068
- ref: floatEl,
24437
+ ref_key: "layer",
24438
+ ref: layer,
24069
24439
  width: "25",
24440
+ class: "to-import-layer",
24070
24441
  lazy: "",
24071
- opened: props.opened,
24072
- closed: props.closed,
24073
24442
  "before-open": props.beforeOpen,
24074
- "before-close": props.beforeClose
24443
+ "before-close": props.beforeClose,
24444
+ onOpened: handleFloatOpened,
24445
+ onClosed: handleFloatClosed
24075
24446
  }, {
24076
24447
  default: withCtx(() => [
24077
- createVNode(unref(ToPadding), { value: 1 }, {
24448
+ createVNode(_component_to_scroll, null, {
24078
24449
  default: withCtx(() => [
24079
- createVNode(unref(ToInput), {
24080
- modelValue: _fileName.value,
24081
- "onUpdate:modelValue": ($event) => _fileName.value = $event,
24082
- mode: "import-input"
24083
- }, {
24084
- default: withCtx(() => [
24085
- createVNode(unref(ToButton), {
24086
- mode: "import-button",
24087
- icon: btnIcon.value,
24088
- expand: "",
24089
- onClick: handleImport
24450
+ createElementVNode("div", {
24451
+ class: normalizeClass(["to-import-file", setFileClass.value]),
24452
+ onDragover: withModifiers(handleDragOver, ["prevent"]),
24453
+ onDragleave: withModifiers(handleDragLeave, ["prevent"]),
24454
+ onClick: handleImport,
24455
+ onDrop: withModifiers(handleDrop, ["prevent"])
24456
+ }, [
24457
+ createVNode(unref(ToIcon), {
24458
+ value: getIcon.value,
24459
+ class: "to-import-file-icon"
24460
+ }, null, 8, ["value"]),
24461
+ createElementVNode("div", { class: "to-import-file-name" }, [
24462
+ createElementVNode("span", { class: "to-import-file-name-text" }, toDisplayString(errorTip.value || fileName.value || "点击 / 拖拽 / 粘贴"), 1)
24463
+ ]),
24464
+ state.value || hasDownloadTemplate() ? (openBlock(), createElementBlock("div", {
24465
+ key: 0,
24466
+ class: "to-import-file-fn"
24467
+ }, [
24468
+ state.value ? (openBlock(), createBlock(unref(ToButton), {
24469
+ key: 0,
24470
+ icon: "reset",
24471
+ class: "to-import-reset",
24472
+ onClick: withModifiers(handleReset, ["stop"])
24090
24473
  }, {
24091
24474
  default: withCtx(() => [
24092
- createTextVNode(toDisplayString(props.buttonText), 1)
24475
+ createTextVNode("重置")
24093
24476
  ]),
24094
24477
  _: 1
24095
- }, 8, ["icon"])
24096
- ]),
24097
- _: 1
24098
- }, 8, ["modelValue", "onUpdate:modelValue"]),
24099
- hasDownloadTemplate() ? (openBlock(), createElementBlock("div", { key: 0 }, [
24100
- createVNode(unref(ToGap)),
24101
- createVNode(unref(ToButton), {
24102
- mode: "import-template",
24103
- color: "primary",
24104
- icon: "download",
24105
- onClick: downloadTem
24106
- }, {
24107
- default: withCtx(() => [
24108
- createTextVNode("模版下载")
24109
- ]),
24110
- _: 1
24111
- })
24112
- ])) : createCommentVNode("", true)
24478
+ })) : hasDownloadTemplate() ? (openBlock(), createBlock(unref(ToButton), {
24479
+ key: 1,
24480
+ class: "to-import-download",
24481
+ icon: "download",
24482
+ onClick: withModifiers(downloadTem, ["stop"])
24483
+ }, {
24484
+ default: withCtx(() => [
24485
+ createTextVNode("模版下载")
24486
+ ]),
24487
+ _: 1
24488
+ })) : createCommentVNode("", true)
24489
+ ])) : createCommentVNode("", true)
24490
+ ], 34)
24113
24491
  ]),
24114
24492
  _: 1
24115
24493
  })
24116
24494
  ]),
24117
24495
  _: 1
24118
- }, 8, ["opened", "closed", "before-open", "before-close"])
24496
+ }, 8, ["before-open", "before-close"])
24119
24497
  ], 2);
24120
24498
  };
24121
24499
  }
@@ -24132,10 +24510,10 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
24132
24510
  type: { default: "button" },
24133
24511
  fileTypes: { default: ".xlsx,.xls" },
24134
24512
  fileType: { default: ".xls" },
24135
- fileName: { default: "请选择" },
24513
+ fileName: { default: "导出文件" + format$1(/* @__PURE__ */ new Date(), "yyyyMMdd") },
24136
24514
  action: { default: "" },
24137
24515
  headers: { default: () => null },
24138
- credentialsable: { type: Boolean, default: false },
24516
+ withCredentials: { type: Boolean, default: false },
24139
24517
  data: { default: () => null },
24140
24518
  beforeStart: { type: Function, default: () => true },
24141
24519
  httpRequest: { type: Function, default: ajax$1 },
@@ -24155,6 +24533,13 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
24155
24533
  const _fileName = ref(props.fileName);
24156
24534
  const _fileType = ref(props.fileType);
24157
24535
  const btnIcon = ref("export|left");
24536
+ const setClass = computed(() => {
24537
+ let arr = [];
24538
+ if (props.mode) {
24539
+ arr.push(`mode-${props.mode}`);
24540
+ }
24541
+ return arr;
24542
+ });
24158
24543
  const emit = __emit;
24159
24544
  watch(
24160
24545
  () => props.fileName,
@@ -24169,6 +24554,9 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
24169
24554
  }
24170
24555
  );
24171
24556
  const handleFloat = (el) => {
24557
+ if (props.disabled) {
24558
+ return;
24559
+ }
24172
24560
  floatEl.value.toggle(el);
24173
24561
  };
24174
24562
  async function handleExport() {
@@ -24188,7 +24576,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
24188
24576
  data: props.data || {},
24189
24577
  headers: props.headers,
24190
24578
  filename: _fileName.value,
24191
- withCredentials: props.credentialsable,
24579
+ withCredentials: props.withCredentials,
24192
24580
  onError: (err) => {
24193
24581
  emit("error", err);
24194
24582
  },
@@ -24222,12 +24610,16 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
24222
24610
  });
24223
24611
  }
24224
24612
  return (_ctx, _cache) => {
24225
- return openBlock(), createElementBlock("span", { class: "to-export" }, [
24613
+ return openBlock(), createElementBlock("span", {
24614
+ class: normalizeClass(["to-export", setClass.value])
24615
+ }, [
24226
24616
  props.type === "button" ? (openBlock(), createBlock(unref(ToButton), {
24227
24617
  key: 0,
24228
24618
  ref_key: "buttonEl",
24229
24619
  ref: buttonEl,
24230
- icon: "export|left",
24620
+ class: "to-export-button",
24621
+ disabled: props.disabled,
24622
+ icon: "export",
24231
24623
  expand: "",
24232
24624
  onClick: withModifiers(($event) => handleFloat(buttonEl.value), ["stop"])
24233
24625
  }, {
@@ -24235,65 +24627,60 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
24235
24627
  createTextVNode(toDisplayString(props.buttonText), 1)
24236
24628
  ]),
24237
24629
  _: 1
24238
- }, 8, ["onClick"])) : (openBlock(), createBlock(unref(ToIcon), {
24630
+ }, 8, ["disabled", "onClick"])) : (openBlock(), createBlock(unref(ToIcon), {
24239
24631
  key: 1,
24240
24632
  ref_key: "iconEl",
24241
24633
  ref: iconEl,
24634
+ link: "",
24635
+ class: "to-export-icon",
24242
24636
  value: "export",
24243
24637
  onClick: withModifiers(($event) => handleFloat(iconEl.value), ["stop"])
24244
24638
  }, null, 8, ["onClick"])),
24245
24639
  createVNode(unref(ToFloat), {
24246
24640
  ref_key: "floatEl",
24247
24641
  ref: floatEl,
24248
- width: "25",
24642
+ class: "to-export-layer",
24643
+ width: "30",
24249
24644
  lazy: "",
24250
- opened: props.opened,
24251
- closed: props.closed,
24252
24645
  "before-open": props.beforeOpen,
24253
- "before-close": props.beforeClose
24646
+ "before-close": props.beforeClose,
24647
+ onOpened: props.opened,
24648
+ onClosed: props.closed
24254
24649
  }, {
24255
24650
  default: withCtx(() => [
24256
- createVNode(unref(ToPadding), { value: 1 }, {
24651
+ createVNode(unref(ToInput), {
24652
+ modelValue: _fileName.value,
24653
+ "onUpdate:modelValue": ($event) => _fileName.value = $event,
24654
+ class: "to-export-input"
24655
+ }, {
24656
+ prefix: withCtx(() => [
24657
+ createVNode(unref(ToSelect), {
24658
+ modelValue: _fileType.value,
24659
+ "onUpdate:modelValue": ($event) => _fileType.value = $event,
24660
+ "option-width": "7",
24661
+ clearable: false,
24662
+ class: "to-export-select",
24663
+ data: props.fileTypes
24664
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "data"])
24665
+ ]),
24257
24666
  default: withCtx(() => [
24258
- createVNode(unref(ToInput), {
24259
- modelValue: _fileName.value,
24260
- "onUpdate:modelValue": ($event) => _fileName.value = $event,
24261
- mode: "export-input"
24667
+ createVNode(unref(ToButton), {
24668
+ class: "to-export-confirm",
24669
+ icon: "ok",
24670
+ onClick: handleExport
24262
24671
  }, {
24263
- prefix: withCtx(() => [
24264
- createVNode(unref(ToSelect), {
24265
- modelValue: _fileType.value,
24266
- "onUpdate:modelValue": ($event) => _fileType.value = $event,
24267
- mode: "export-select",
24268
- data: props.fileTypes
24269
- }, null, 8, ["modelValue", "onUpdate:modelValue", "data"])
24270
- ]),
24271
24672
  default: withCtx(() => [
24272
- createVNode(unref(ToButton), {
24273
- mode: "export-button",
24274
- icon: btnIcon.value,
24275
- expand: "",
24276
- onClick: handleExport
24277
- }, {
24278
- default: withCtx(() => [
24279
- createTextVNode(toDisplayString(props.buttonText), 1)
24280
- ]),
24281
- _: 1
24282
- }, 8, ["icon"])
24673
+ createTextVNode("确定")
24283
24674
  ]),
24284
24675
  _: 1
24285
- }, 8, ["modelValue", "onUpdate:modelValue"]),
24286
- createElementVNode("div", null, [
24287
- createVNode(unref(ToGap)),
24288
- createTextVNode(" 导出设置完成,请点击导出 ")
24289
- ])
24676
+ })
24290
24677
  ]),
24291
24678
  _: 1
24292
- })
24679
+ }, 8, ["modelValue", "onUpdate:modelValue"])
24293
24680
  ]),
24294
24681
  _: 1
24295
- }, 8, ["opened", "closed", "before-open", "before-close"])
24296
- ]);
24682
+ }, 8, ["before-open", "before-close", "onOpened", "onClosed"])
24683
+ ], 2);
24297
24684
  };
24298
24685
  }
24299
24686
  });
@@ -26954,13 +27341,13 @@ const echartsMapProps = {
26954
27341
  type: [String, Number],
26955
27342
  default: 1
26956
27343
  },
26957
- aspectRatio: {
27344
+ aspectScale: {
26958
27345
  type: [String, Number],
26959
- default: ""
27346
+ default: 0.75
26960
27347
  },
26961
27348
  shadow: {
26962
- type: String,
26963
- default: ""
27349
+ type: Array,
27350
+ default: () => []
26964
27351
  },
26965
27352
  itemShadow: {
26966
27353
  type: String,
@@ -27066,6 +27453,10 @@ const echartsMapProps = {
27066
27453
  type: String,
27067
27454
  default: "/geo_data/"
27068
27455
  },
27456
+ outlineApi: {
27457
+ type: String,
27458
+ default: "https://geo.datav.aliyun.com/areas_v3/bound/"
27459
+ },
27069
27460
  forwardEvent: {
27070
27461
  type: String,
27071
27462
  default: "click"
@@ -29324,7 +29715,6 @@ const cityData = [
29324
29715
  city: "90"
29325
29716
  }
29326
29717
  ];
29327
- const OUTLINE_BASE_URL = "https://geo.datav.aliyun.com/areas_v3/bound/";
29328
29718
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
29329
29719
  ...{
29330
29720
  name: "ToEchartsMap"
@@ -29427,22 +29817,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
29427
29817
  if (props.width) {
29428
29818
  style.width = formatSize(props.width);
29429
29819
  }
29430
- let finalScaleX = Number(props.scaleX) || 1;
29431
- let finalScaleY = Number(props.scaleY) || 1;
29432
- if (props.aspectRatio) {
29433
- const targetRatio = Number(props.aspectRatio);
29434
- if (targetRatio > 0) {
29435
- const currentRatio = finalScaleX / finalScaleY;
29436
- if (currentRatio < targetRatio) {
29437
- finalScaleX = finalScaleY * targetRatio;
29438
- } else {
29439
- finalScaleY = finalScaleX / targetRatio;
29440
- }
29441
- }
29442
- }
29443
- const rotate = Number(props.rotate) || 0;
29444
- style.transform = `rotate(${rotate}deg) scaleX(${finalScaleX}) scaleY(${finalScaleY})`;
29445
- style.transformOrigin = "center center";
29446
29820
  return style;
29447
29821
  });
29448
29822
  const loadEcharts = async () => {
@@ -29636,7 +30010,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
29636
30010
  if (outlineCache.has(code))
29637
30011
  return outlineCache.get(code);
29638
30012
  try {
29639
- const res = await fetch(`${OUTLINE_BASE_URL}${code}.json`);
30013
+ const res = await fetch(`${props.outlineApi}${code}.json`);
29640
30014
  if (!res.ok)
29641
30015
  throw new Error(`Request failed: ${res.status}`);
29642
30016
  const json = await res.json();
@@ -29696,10 +30070,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
29696
30070
  var _a2;
29697
30071
  const getLabelConfig = (isHover = false) => {
29698
30072
  var _a3;
29699
- const name = (e) => {
29700
- var _a4, _b;
29701
- return (_b = (_a4 = props.nameMap) == null ? void 0 : _a4[e.name]) != null ? _b : e.name;
29702
- };
29703
30073
  const fontColor = isHover ? props.fontColorHover || props.fontColor : props.fontColor;
29704
30074
  const fontSizeValue = isHover ? props.fontSizeHover || props.fontSize : props.fontSize;
29705
30075
  const fontSize = Number(fontSizeValue) * currentEm.value;
@@ -29712,8 +30082,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
29712
30082
  };
29713
30083
  if (!props.showLabelIcon) {
29714
30084
  return {
29715
- ...baseLabel,
29716
- formatter: (e) => `${name(e)}`
30085
+ ...baseLabel
29717
30086
  };
29718
30087
  }
29719
30088
  if (props.labelIconType === "image") {
@@ -29721,8 +30090,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
29721
30090
  const [width, height] = Array.isArray(size) ? size : [size, size];
29722
30091
  return {
29723
30092
  ...baseLabel,
29724
- formatter: (e) => `{a|${name(e)}}
29725
- {b|}`,
29726
30093
  rich: {
29727
30094
  a: { ...baseLabel },
29728
30095
  b: {
@@ -29735,9 +30102,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
29735
30102
  };
29736
30103
  }
29737
30104
  return {
29738
- ...baseLabel,
29739
- formatter: (e) => `${name(e)}
29740
- ${props.labelIcon}`
30105
+ ...baseLabel
29741
30106
  };
29742
30107
  };
29743
30108
  if (props.is3d) {
@@ -29768,17 +30133,18 @@ ${props.labelIcon}`
29768
30133
  borderColor: props.borderColorHover || props.borderColor
29769
30134
  },
29770
30135
  label: getLabelConfig(true)
29771
- }
30136
+ },
30137
+ nameMap: props.nameMap
30138
+ // aspectScale: props.aspectScale
29772
30139
  };
29773
30140
  }
29774
- const shadowParts = parseShadow(props.shadow);
29775
30141
  const itemShadowParts = parseShadow(props.itemShadow);
29776
30142
  return {
29777
30143
  type: "map",
29778
30144
  map: geoName,
29779
30145
  data: mapData,
29780
30146
  top: 0,
29781
- bottom: props.shadow ? shadowParts[0] ? Number(shadowParts[0]) * currentEm.value : currentEm.value : 0,
30147
+ bottom: 0,
29782
30148
  label: getLabelConfig(false),
29783
30149
  itemStyle: {
29784
30150
  shadowBlur: itemShadowParts[0] ? Number(itemShadowParts[0]) * currentEm.value : 0,
@@ -29803,51 +30169,37 @@ ${props.labelIcon}`
29803
30169
  borderColor: props.borderColorHover || props.borderColor
29804
30170
  },
29805
30171
  label: getLabelConfig(true)
29806
- }
30172
+ },
30173
+ nameMap: props.nameMap,
30174
+ aspectScale: props.aspectScale
29807
30175
  };
29808
30176
  };
29809
30177
  const getOption = (geoName, code, mapData) => {
29810
- var _a2;
29811
30178
  const baseSeries = getBaseSeries(geoName, mapData);
29812
30179
  const seriesWithZ = { ...baseSeries, z: 3 };
29813
- const shadowParts = parseShadow(props.shadow);
29814
30180
  const { min, max: max2 } = getMinMax(mapData);
29815
30181
  const geoLayers = [];
29816
- if (props.shadow) {
29817
- const shadowOffset = shadowParts[0] ? Number(shadowParts[0]) * currentEm.value : currentEm.value;
29818
- const shadowColor = (_a2 = shadowParts[1]) != null ? _a2 : "rgba(0,0,0,0.3)";
29819
- const shadow2Color = shadowParts[2];
29820
- if (shadow2Color) {
30182
+ if (props.shadow.length) {
30183
+ props.shadow.forEach((item, i) => {
29821
30184
  geoLayers.push({
29822
- z: 1,
30185
+ z: props.shadow.length - i,
29823
30186
  show: true,
29824
30187
  map: geoName,
30188
+ top: 0,
30189
+ bottom: 0,
29825
30190
  roam: false,
29826
- top: shadowOffset * 2,
29827
- bottom: -shadowOffset,
29828
30191
  silent: true,
29829
30192
  itemStyle: {
29830
- areaColor: shadow2Color,
30193
+ areaColor: item.shadowColor,
30194
+ shadowOffsetY: item.shadowOffset,
30195
+ shadowColor: item.shadowColor,
29831
30196
  borderColor: "transparent"
29832
- }
30197
+ },
30198
+ aspectScale: props.aspectScale
29833
30199
  });
29834
- }
29835
- geoLayers.push({
29836
- z: 2,
29837
- show: true,
29838
- map: geoName,
29839
- roam: false,
29840
- top: shadowOffset,
29841
- bottom: 0,
29842
- silent: true,
29843
- itemStyle: {
29844
- areaColor: shadowColor,
29845
- borderColor: "transparent"
29846
- }
29847
30200
  });
29848
30201
  }
29849
30202
  if (props.showOutline) {
29850
- const shadowOffset = shadowParts[0] ? Number(shadowParts[0]) * currentEm.value : currentEm.value;
29851
30203
  const outlineMapName = `${geoName}__outline`;
29852
30204
  geoLayers.push({
29853
30205
  z: 2,
@@ -29855,7 +30207,7 @@ ${props.labelIcon}`
29855
30207
  map: outlineMapName,
29856
30208
  roam: false,
29857
30209
  top: 0,
29858
- bottom: props.shadow ? shadowOffset : 0,
30210
+ bottom: 0,
29859
30211
  silent: true,
29860
30212
  itemStyle: {
29861
30213
  areaColor: "transparent",
@@ -29863,7 +30215,8 @@ ${props.labelIcon}`
29863
30215
  borderWidth: Number(props.outlineWidth),
29864
30216
  borderJoin: "round",
29865
30217
  borderMiterLimit: 2
29866
- }
30218
+ },
30219
+ aspectScale: props.aspectScale
29867
30220
  });
29868
30221
  }
29869
30222
  seriesWithZ.z = 3;