@weitutech/by-components-v3 1.1.11 → 1.1.13

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.
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, onMounted, watch, resolveComponent, createElementBlock, openBlock, createVNode, createElementVNode, mergeProps, Fragment, renderList, normalizeClass, toDisplayString, createTextVNode, useSlots, toRefs, computed, createBlock, createCommentVNode, unref, nextTick, isVNode, reactive, inject, provide, h as h$1, onUnmounted, TransitionGroup, Teleport, onActivated, onDeactivated, onBeforeUnmount, getCurrentInstance, readonly, getCurrentScope, onScopeDispose, isRef, warn as warn$1, renderSlot, Transition, withCtx, withDirectives, normalizeStyle, vShow, shallowReactive, resolveDynamicComponent, withModifiers, render, createApp } from "vue";
1
+ import { defineComponent, ref, onMounted, watch, resolveComponent, createElementBlock, openBlock, createVNode, createElementVNode, mergeProps, Fragment, renderList, normalizeClass, toDisplayString, createTextVNode, useSlots, toRefs, computed, createBlock, createCommentVNode, unref, nextTick, isVNode, reactive, inject, provide, h as h$1, onUnmounted, TransitionGroup, Teleport, onActivated, onDeactivated, onBeforeUnmount, getCurrentInstance, readonly, getCurrentScope, onScopeDispose, isRef, warn as warn$1, renderSlot, Transition, withCtx, withDirectives, normalizeStyle, vShow, shallowReactive, resolveDynamicComponent, withModifiers, render, createSlots, createApp } from "vue";
2
2
  function cloneDeep(obj) {
3
3
  if (obj === null || typeof obj !== "object") {
4
4
  return obj;
@@ -4011,10 +4011,10 @@ hooks$a.HTML5_FMT = {
4011
4011
  MONTH: "YYYY-MM"
4012
4012
  // <input type="month" />
4013
4013
  };
4014
- const _hoisted_1$3 = { class: "b-picker wrapper" };
4015
- const _hoisted_2$1 = { class: "btn" };
4016
- const _hoisted_3$1 = ["onClick"];
4017
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4014
+ const _hoisted_1$4 = { class: "b-picker wrapper" };
4015
+ const _hoisted_2$2 = { class: "btn" };
4016
+ const _hoisted_3$2 = ["onClick"];
4017
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4018
4018
  __name: "datePicker",
4019
4019
  props: {
4020
4020
  modelValue: { default: () => [] },
@@ -4111,18 +4111,18 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4111
4111
  );
4112
4112
  return (_ctx, _cache) => {
4113
4113
  const _component_el_date_picker = resolveComponent("el-date-picker");
4114
- return openBlock(), createElementBlock("div", _hoisted_1$3, [
4114
+ return openBlock(), createElementBlock("div", _hoisted_1$4, [
4115
4115
  createVNode(_component_el_date_picker, mergeProps({ style: { "width": "70%" } }, props, {
4116
4116
  modelValue: props.modelValue,
4117
4117
  "onUpdate:modelValue": handleChange
4118
4118
  }), null, 16, ["modelValue"]),
4119
- createElementVNode("div", _hoisted_2$1, [
4119
+ createElementVNode("div", _hoisted_2$2, [
4120
4120
  (openBlock(true), createElementBlock(Fragment, null, renderList(shortcuts.value, (item) => {
4121
4121
  return openBlock(), createElementBlock("span", {
4122
4122
  key: item.key,
4123
4123
  class: normalizeClass(["item", { item_active: item.key === active.value }]),
4124
4124
  onClick: ($event) => handleClick(item)
4125
- }, toDisplayString(item.label), 11, _hoisted_3$1);
4125
+ }, toDisplayString(item.label), 11, _hoisted_3$2);
4126
4126
  }), 128))
4127
4127
  ])
4128
4128
  ]);
@@ -4136,9 +4136,9 @@ const _export_sfc$1 = (sfc, props) => {
4136
4136
  }
4137
4137
  return target;
4138
4138
  };
4139
- const CustomDatePicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["__scopeId", "data-v-3d5f0e97"]]);
4140
- const _hoisted_1$2 = { class: "drawer_query_btn b-fold-search" };
4141
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4139
+ const CustomDatePicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["__scopeId", "data-v-3d5f0e97"]]);
4140
+ const _hoisted_1$3 = { class: "drawer_query_btn b-fold-search" };
4141
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4142
4142
  __name: "foldSearch",
4143
4143
  props: {
4144
4144
  unfold: { type: Boolean, default: false }
@@ -4163,7 +4163,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4163
4163
  emit("change", show.value);
4164
4164
  };
4165
4165
  return (_ctx, _cache) => {
4166
- return openBlock(), createElementBlock("div", _hoisted_1$2, [
4166
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
4167
4167
  createElementVNode("div", { onClick: drawer2 }, [
4168
4168
  show.value == true ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4169
4169
  _cache[0] || (_cache[0] = createElementVNode("span", { style: { "color": "#3aa1ff", "vertical-align": "middle" } }, "收起", -1)),
@@ -4187,7 +4187,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4187
4187
  };
4188
4188
  }
4189
4189
  });
4190
- const FoldSearch = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["__scopeId", "data-v-04f92519"]]);
4190
+ const FoldSearch = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["__scopeId", "data-v-04f92519"]]);
4191
4191
  /*! Element Plus Icons Vue v2.3.1 */
4192
4192
  var circle_close_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
4193
4193
  name: "CircleCloseFilled",
@@ -4304,7 +4304,7 @@ var warning_filled_default = warning_filled_vue_vue_type_script_setup_true_lang_
4304
4304
  function _isSlot(s) {
4305
4305
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
4306
4306
  }
4307
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4307
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4308
4308
  ...{
4309
4309
  name: "ByForm"
4310
4310
  },
@@ -4808,12 +4808,12 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4808
4808
  };
4809
4809
  }
4810
4810
  });
4811
- const ZshForm = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["__scopeId", "data-v-0cc3ecb8"]]);
4812
- const _hoisted_1$1 = {
4811
+ const ZshForm = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["__scopeId", "data-v-0cc3ecb8"]]);
4812
+ const _hoisted_1$2 = {
4813
4813
  id: "pager",
4814
4814
  class: "pager fixed bottom-0 right-0 w-full flex justify-center items-center z-50"
4815
4815
  };
4816
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4816
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4817
4817
  __name: "base-pager",
4818
4818
  props: {
4819
4819
  pageSize: { default: 25 },
@@ -4851,7 +4851,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4851
4851
  };
4852
4852
  return (_ctx, _cache) => {
4853
4853
  const _component_el_pagination = resolveComponent("el-pagination");
4854
- return openBlock(), createElementBlock("div", _hoisted_1$1, [
4854
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [
4855
4855
  createVNode(_component_el_pagination, {
4856
4856
  layout: "total, prev, pager, next,sizes, jumper",
4857
4857
  total: _ctx.total,
@@ -4865,7 +4865,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4865
4865
  };
4866
4866
  }
4867
4867
  });
4868
- const BasePager = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["__scopeId", "data-v-4b6faf2c"]]);
4868
+ const BasePager = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["__scopeId", "data-v-4b6faf2c"]]);
4869
4869
  const coreVersion = "4.1.5";
4870
4870
  const VxeCore = {
4871
4871
  coreVersion,
@@ -37662,7 +37662,7 @@ const __default__$2 = defineComponent({
37662
37662
  name: "ElIcon",
37663
37663
  inheritAttrs: false
37664
37664
  });
37665
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
37665
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
37666
37666
  ...__default__$2,
37667
37667
  props: iconProps,
37668
37668
  setup(__props) {
@@ -37687,7 +37687,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
37687
37687
  };
37688
37688
  }
37689
37689
  });
37690
- var Icon$1 = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "icon.vue"]]);
37690
+ var Icon$1 = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "icon.vue"]]);
37691
37691
  const ElIcon = withInstall(Icon$1);
37692
37692
  const iconPropType = definePropType([
37693
37693
  String,
@@ -37743,7 +37743,7 @@ const badgeProps = buildProps({
37743
37743
  const __default__$1 = defineComponent({
37744
37744
  name: "ElBadge"
37745
37745
  });
37746
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
37746
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
37747
37747
  ...__default__$1,
37748
37748
  props: badgeProps,
37749
37749
  setup(__props, { expose }) {
@@ -37805,7 +37805,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
37805
37805
  };
37806
37806
  }
37807
37807
  });
37808
- var Badge$1 = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "badge.vue"]]);
37808
+ var Badge$1 = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "badge.vue"]]);
37809
37809
  const ElBadge = withInstall(Badge$1);
37810
37810
  const configProviderProps = buildProps({
37811
37811
  a11y: {
@@ -37965,7 +37965,7 @@ const getOffsetOrSpace = (id, offset2) => {
37965
37965
  const __default__ = defineComponent({
37966
37966
  name: "ElMessage"
37967
37967
  });
37968
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
37968
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
37969
37969
  ...__default__,
37970
37970
  props: messageProps,
37971
37971
  emits: messageEmits,
@@ -38106,7 +38106,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
38106
38106
  };
38107
38107
  }
38108
38108
  });
38109
- var MessageConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "message.vue"]]);
38109
+ var MessageConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "message.vue"]]);
38110
38110
  let seed = 1;
38111
38111
  const normalizeOptions = (params) => {
38112
38112
  const options = !params || isString$1(params) || isVNode(params) || isFunction$1(params) ? { message: params } : params;
@@ -39842,20 +39842,20 @@ const deepClone = (target) => {
39842
39842
  }
39843
39843
  return result;
39844
39844
  };
39845
- const _hoisted_1 = { id: "custom_column" };
39846
- const _hoisted_2 = { class: "el-dialog-box" };
39847
- const _hoisted_3 = { class: "left_box" };
39848
- const _hoisted_4 = {
39845
+ const _hoisted_1$1 = { id: "custom_column" };
39846
+ const _hoisted_2$1 = { class: "el-dialog-box" };
39847
+ const _hoisted_3$1 = { class: "left_box" };
39848
+ const _hoisted_4$1 = {
39849
39849
  class: "row",
39850
39850
  style: { "padding-right": "20px" }
39851
39851
  };
39852
- const _hoisted_5 = { class: "cell" };
39853
- const _hoisted_6 = { class: "left_box_body" };
39854
- const _hoisted_7 = { class: "left_nav" };
39855
- const _hoisted_8 = ["onClick"];
39856
- const _hoisted_9 = { class: "left_menu" };
39857
- const _hoisted_10 = { class: "checkbox_title" };
39858
- const _hoisted_11 = { class: "right_box" };
39852
+ const _hoisted_5$1 = { class: "cell" };
39853
+ const _hoisted_6$1 = { class: "left_box_body" };
39854
+ const _hoisted_7$1 = { class: "left_nav" };
39855
+ const _hoisted_8$1 = ["onClick"];
39856
+ const _hoisted_9$1 = { class: "left_menu" };
39857
+ const _hoisted_10$1 = { class: "checkbox_title" };
39858
+ const _hoisted_11$1 = { class: "right_box" };
39859
39859
  const _hoisted_12 = { class: "drag_box" };
39860
39860
  const _hoisted_13 = { class: "drag_text_box" };
39861
39861
  const _hoisted_14 = { class: "drag_title" };
@@ -39873,7 +39873,7 @@ const _hoisted_21 = { class: "drag_li_text" };
39873
39873
  const _hoisted_22 = ["onClick"];
39874
39874
  const _hoisted_23 = ["onClick"];
39875
39875
  const _hoisted_24 = { class: "footer" };
39876
- const _sfc_main = /* @__PURE__ */ defineComponent({
39876
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
39877
39877
  ...{
39878
39878
  name: "CustomColumn"
39879
39879
  },
@@ -40156,7 +40156,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
40156
40156
  const _component_el_tooltip = resolveComponent("el-tooltip");
40157
40157
  const _component_el_icon = resolveComponent("el-icon");
40158
40158
  const _component_el_dialog = resolveComponent("el-dialog");
40159
- return openBlock(), createElementBlock("div", _hoisted_1, [
40159
+ return openBlock(), createElementBlock("div", _hoisted_1$1, [
40160
40160
  createVNode(_component_el_dialog, {
40161
40161
  "close-on-click-modal": false,
40162
40162
  modelValue: dialogVisible.value,
@@ -40189,11 +40189,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
40189
40189
  ])
40190
40190
  ]),
40191
40191
  default: withCtx(() => [
40192
- createElementVNode("div", _hoisted_2, [
40193
- createElementVNode("div", _hoisted_3, [
40192
+ createElementVNode("div", _hoisted_2$1, [
40193
+ createElementVNode("div", _hoisted_3$1, [
40194
40194
  _cache[3] || (_cache[3] = createElementVNode("div", { class: "box_title" }, "数据指标", -1)),
40195
- createElementVNode("div", _hoisted_4, [
40196
- createElementVNode("div", _hoisted_5, [
40195
+ createElementVNode("div", _hoisted_4$1, [
40196
+ createElementVNode("div", _hoisted_5$1, [
40197
40197
  createVNode(_component_el_input, {
40198
40198
  modelValue: search.value,
40199
40199
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => search.value = $event),
@@ -40212,26 +40212,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
40212
40212
  __: [2]
40213
40213
  })
40214
40214
  ]),
40215
- createElementVNode("div", _hoisted_6, [
40216
- createElementVNode("div", _hoisted_7, [
40215
+ createElementVNode("div", _hoisted_6$1, [
40216
+ createElementVNode("div", _hoisted_7$1, [
40217
40217
  createElementVNode("ul", null, [
40218
40218
  (openBlock(true), createElementBlock(Fragment, null, renderList(checkBoxMenuBySearch.value, (item, index) => {
40219
40219
  return openBlock(), createElementBlock("li", {
40220
40220
  key: index,
40221
40221
  class: normalizeClass({ active: activeId.value === index }),
40222
40222
  onClick: ($event) => setHighlight(index)
40223
- }, toDisplayString(item.label), 11, _hoisted_8);
40223
+ }, toDisplayString(item.label), 11, _hoisted_8$1);
40224
40224
  }), 128))
40225
40225
  ])
40226
40226
  ]),
40227
- createElementVNode("div", _hoisted_9, [
40227
+ createElementVNode("div", _hoisted_9$1, [
40228
40228
  (openBlock(true), createElementBlock(Fragment, null, renderList(checkBoxMenuBySearch.value, (item, index) => {
40229
40229
  return openBlock(), createElementBlock("div", {
40230
40230
  key: index,
40231
40231
  ref_for: true,
40232
40232
  ref: (el) => tagItems.value[index] = el
40233
40233
  }, [
40234
- createElementVNode("div", _hoisted_10, toDisplayString(item.label), 1),
40234
+ createElementVNode("div", _hoisted_10$1, toDisplayString(item.label), 1),
40235
40235
  createVNode(_component_el_row, null, {
40236
40236
  default: withCtx(() => [
40237
40237
  (openBlock(true), createElementBlock(Fragment, null, renderList(item.data, (each, idx) => {
@@ -40265,7 +40265,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
40265
40265
  ])
40266
40266
  ])
40267
40267
  ]),
40268
- createElementVNode("div", _hoisted_11, [
40268
+ createElementVNode("div", _hoisted_11$1, [
40269
40269
  createElementVNode("div", _hoisted_12, [
40270
40270
  createVNode(_component_el_row, null, {
40271
40271
  default: withCtx(() => [
@@ -40415,7 +40415,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
40415
40415
  };
40416
40416
  }
40417
40417
  });
40418
- const CustomColumn = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["__scopeId", "data-v-9bcdfbf0"]]);
40418
+ const CustomColumn = /* @__PURE__ */ _export_sfc$1(_sfc_main$1, [["__scopeId", "data-v-9bcdfbf0"]]);
40419
40419
  const isCachedTableColumns = (name) => {
40420
40420
  if (!name) return false;
40421
40421
  return !!localStorage.getItem(name);
@@ -40539,6 +40539,10 @@ const ByTable = /* @__PURE__ */ defineComponent({
40539
40539
  autoHeight: {
40540
40540
  type: Boolean,
40541
40541
  default: false
40542
+ },
40543
+ loading: {
40544
+ type: Boolean,
40545
+ default: false
40542
40546
  }
40543
40547
  },
40544
40548
  emits: ["pageChange", "setColumns", "setGroupColumn", ...events],
@@ -40558,6 +40562,7 @@ const ByTable = /* @__PURE__ */ defineComponent({
40558
40562
  setHasCache();
40559
40563
  return {
40560
40564
  border: true,
40565
+ round: true,
40561
40566
  // 'visible' 值在 v4 版本中已经不再支持 (true:显示省略号; false:不显示省略号,自动撑高)
40562
40567
  showOverflow: !props.autoHeight,
40563
40568
  ...props.gridOptions.autoHeight ? {
@@ -40567,9 +40572,9 @@ const ByTable = /* @__PURE__ */ defineComponent({
40567
40572
  height: 720
40568
40573
  },
40569
40574
  align: "center",
40570
- copyFields: [],
40571
- emptyText: "暂无数据",
40572
- loading: false,
40575
+ copyFields: props.gridOptions.copyFields || [],
40576
+ emptyText: props.gridOptions.emptyText || "暂无数据",
40577
+ loading: props.loading,
40573
40578
  loadingConfig: {
40574
40579
  text: "加载中..."
40575
40580
  },
@@ -40792,6 +40797,366 @@ const ByTable = /* @__PURE__ */ defineComponent({
40792
40797
  };
40793
40798
  }
40794
40799
  });
40800
+ var ToolBarItemType = /* @__PURE__ */ ((ToolBarItemType2) => {
40801
+ ToolBarItemType2["Text"] = "text";
40802
+ ToolBarItemType2["Button"] = "button";
40803
+ ToolBarItemType2["RadioGroup"] = "radio-group";
40804
+ ToolBarItemType2["Select"] = "select";
40805
+ ToolBarItemType2["Input"] = "input";
40806
+ return ToolBarItemType2;
40807
+ })(ToolBarItemType || {});
40808
+ const _hoisted_1 = { class: "by-tool-bar" };
40809
+ const _hoisted_2 = { class: "by-tool-bar__left" };
40810
+ const _hoisted_3 = {
40811
+ key: 0,
40812
+ style: { "display": "none" }
40813
+ };
40814
+ const _hoisted_4 = {
40815
+ key: 1,
40816
+ style: { "display": "none" }
40817
+ };
40818
+ const _hoisted_5 = { key: 2 };
40819
+ const _hoisted_6 = { key: 3 };
40820
+ const _hoisted_7 = { class: "by-tool-bar__right" };
40821
+ const _hoisted_8 = {
40822
+ key: 0,
40823
+ style: { "display": "none" }
40824
+ };
40825
+ const _hoisted_9 = {
40826
+ key: 1,
40827
+ style: { "display": "none" }
40828
+ };
40829
+ const _hoisted_10 = { key: 2 };
40830
+ const _hoisted_11 = { key: 3 };
40831
+ const _sfc_main = /* @__PURE__ */ defineComponent({
40832
+ __name: "ByToolBar",
40833
+ props: {
40834
+ items: { default: () => [] }
40835
+ },
40836
+ emits: ["action"],
40837
+ setup(__props, { emit: __emit }) {
40838
+ const props = __props;
40839
+ const emit = __emit;
40840
+ const loadedOptions = ref({});
40841
+ const valueTracker = ref({});
40842
+ const itemsWithAsyncOptions = computed(() => {
40843
+ return props.items.map((item) => {
40844
+ let newItem = addDefaultProps(item);
40845
+ if (item.type === ToolBarItemType.Select && item.name && loadedOptions.value[item.name]) {
40846
+ newItem = {
40847
+ ...newItem,
40848
+ props: {
40849
+ ...newItem.props,
40850
+ loading: loadedOptions.value[item.name].loading
40851
+ },
40852
+ asyncOptions: loadedOptions.value[item.name].options
40853
+ };
40854
+ }
40855
+ return newItem;
40856
+ });
40857
+ });
40858
+ const leftItemsComputed = computed(() => {
40859
+ return itemsWithAsyncOptions.value.filter((item) => item.position !== "right" && !item.hidden);
40860
+ });
40861
+ const rightItemsComputed = computed(() => {
40862
+ return itemsWithAsyncOptions.value.filter((item) => item.position === "right" && !item.hidden);
40863
+ });
40864
+ const addDefaultProps = (item) => {
40865
+ var _a2;
40866
+ let newItem = { ...item };
40867
+ if (((_a2 = item.props) == null ? void 0 : _a2.value) !== void 0) {
40868
+ console.log(`[ByToolBar] 原始 ${item.name} value:`, item.props.value);
40869
+ }
40870
+ const needsSize = [ToolBarItemType.Button, ToolBarItemType.Select, ToolBarItemType.Input, ToolBarItemType.RadioGroup];
40871
+ if (needsSize.includes(item.type)) {
40872
+ if (item.props) {
40873
+ newItem = {
40874
+ ...item,
40875
+ props: {
40876
+ size: "default",
40877
+ ...item.props
40878
+ // 确保原始属性(包括 value)不被覆盖
40879
+ }
40880
+ };
40881
+ } else {
40882
+ newItem = {
40883
+ ...item,
40884
+ props: {
40885
+ size: "default"
40886
+ }
40887
+ };
40888
+ }
40889
+ }
40890
+ if (item.type === ToolBarItemType.Text) {
40891
+ const defaultTextStyle = {
40892
+ fontSize: "16px",
40893
+ color: "#333333"
40894
+ };
40895
+ if (item.props) {
40896
+ newItem = {
40897
+ ...item,
40898
+ props: {
40899
+ ...defaultTextStyle,
40900
+ ...item.props
40901
+ // 确保原始属性不被覆盖
40902
+ }
40903
+ };
40904
+ } else {
40905
+ newItem = {
40906
+ ...item,
40907
+ props: defaultTextStyle
40908
+ };
40909
+ }
40910
+ }
40911
+ return newItem;
40912
+ };
40913
+ const loadSelectOptions = () => {
40914
+ props.items.forEach((item) => {
40915
+ var _a2;
40916
+ if (item.type === ToolBarItemType.Select && item.props && typeof item.props.loadOptions === "function") {
40917
+ const { name } = item;
40918
+ if (!name) {
40919
+ console.error("[ByToolBar] 下拉框使用异步加载loadOptions时,必须设置name属性.");
40920
+ return;
40921
+ }
40922
+ if ((_a2 = loadedOptions.value[name]) == null ? void 0 : _a2.loaded) return;
40923
+ loadedOptions.value[name] = { loading: true, options: [], loaded: false };
40924
+ item.props.loadOptions().then((options) => {
40925
+ loadedOptions.value[name].options = options;
40926
+ loadedOptions.value[name].loaded = true;
40927
+ }).finally(() => {
40928
+ loadedOptions.value[name].loading = false;
40929
+ });
40930
+ }
40931
+ });
40932
+ };
40933
+ const getComponentType = (item) => {
40934
+ const map2 = {
40935
+ [ToolBarItemType.Text]: "span",
40936
+ [ToolBarItemType.Button]: "el-button",
40937
+ [ToolBarItemType.RadioGroup]: "el-radio-group",
40938
+ [ToolBarItemType.Select]: "el-select",
40939
+ [ToolBarItemType.Input]: "el-input"
40940
+ };
40941
+ return map2[item.type] || "div";
40942
+ };
40943
+ const getComponentProps = (item) => {
40944
+ if (!item.props) return {};
40945
+ const otherProps = { ...item.props };
40946
+ delete otherProps.value;
40947
+ if (item.type === ToolBarItemType.Select && item.props.onlyShowPlaceholder) {
40948
+ return otherProps;
40949
+ }
40950
+ return otherProps;
40951
+ };
40952
+ const getComponentStyle = (item) => {
40953
+ var _a2, _b, _c, _d;
40954
+ const style = {};
40955
+ switch (item.type) {
40956
+ case ToolBarItemType.Text:
40957
+ style.maxWidth = "300px";
40958
+ style.overflow = "hidden";
40959
+ style.textOverflow = "ellipsis";
40960
+ style.whiteSpace = "nowrap";
40961
+ if (item.props) {
40962
+ if ((_a2 = item.props) == null ? void 0 : _a2.fontSize) {
40963
+ style.fontSize = item.props.fontSize;
40964
+ }
40965
+ if ((_b = item.props) == null ? void 0 : _b.color) {
40966
+ style.color = item.props.color;
40967
+ }
40968
+ if ((_c = item.props) == null ? void 0 : _c.maxWidth) {
40969
+ style.maxWidth = item.props.maxWidth;
40970
+ }
40971
+ if ((_d = item.props) == null ? void 0 : _d.width) {
40972
+ style.width = item.props.width;
40973
+ }
40974
+ }
40975
+ break;
40976
+ case ToolBarItemType.Input:
40977
+ case ToolBarItemType.Select:
40978
+ style.maxWidth = "200px";
40979
+ break;
40980
+ case ToolBarItemType.Button:
40981
+ case ToolBarItemType.RadioGroup:
40982
+ style.maxWidth = "400px";
40983
+ break;
40984
+ }
40985
+ return style;
40986
+ };
40987
+ const handleEvent = (eventType, item, payload) => {
40988
+ if (eventType === "update:model-value" || eventType === "input" || eventType === "change") {
40989
+ if (item.props) {
40990
+ item.props.value = payload;
40991
+ const origin = props.items.find((i) => i.name === item.name);
40992
+ if (origin && origin.props) {
40993
+ origin.props.value = payload;
40994
+ }
40995
+ if (item.name) {
40996
+ valueTracker.value[item.name] = payload;
40997
+ }
40998
+ }
40999
+ }
41000
+ emit("action", { type: eventType, item, payload });
41001
+ };
41002
+ watch(
41003
+ () => props.items,
41004
+ () => {
41005
+ nextTick(() => {
41006
+ loadSelectOptions();
41007
+ props.items.forEach((item) => {
41008
+ var _a2;
41009
+ if (item.name && ((_a2 = item.props) == null ? void 0 : _a2.value) !== void 0) {
41010
+ valueTracker.value[item.name] = item.props.value;
41011
+ }
41012
+ });
41013
+ });
41014
+ },
41015
+ { immediate: true, deep: true }
41016
+ );
41017
+ return (_ctx, _cache) => {
41018
+ const _component_el_icon = resolveComponent("el-icon");
41019
+ const _component_el_option = resolveComponent("el-option");
41020
+ const _component_el_radio_button = resolveComponent("el-radio-button");
41021
+ return openBlock(), createElementBlock("div", _hoisted_1, [
41022
+ createElementVNode("div", _hoisted_2, [
41023
+ (openBlock(true), createElementBlock(Fragment, null, renderList(leftItemsComputed.value, (item, idx) => {
41024
+ var _a2, _b;
41025
+ return openBlock(), createElementBlock(Fragment, {
41026
+ key: "left-" + idx
41027
+ }, [
41028
+ !item.slot && !item.hidden ? (openBlock(), createBlock(resolveDynamicComponent(getComponentType(item)), mergeProps({
41029
+ key: 0,
41030
+ ref_for: true
41031
+ }, getComponentProps(item), {
41032
+ disabled: item.disabled,
41033
+ style: getComponentStyle(item),
41034
+ "model-value": item.type === unref(ToolBarItemType).Select && ((_a2 = item.props) == null ? void 0 : _a2.onlyShowPlaceholder) ? void 0 : valueTracker.value.hasOwnProperty(item.name) ? valueTracker.value[item.name] : (_b = item.props) == null ? void 0 : _b.value,
41035
+ onClick: (e) => handleEvent("click", item, e),
41036
+ onInput: (val) => handleEvent("input", item, val),
41037
+ onChange: (val) => handleEvent("change", item, val),
41038
+ "onUpdate:modelValue": (val) => handleEvent("update:model-value", item, val)
41039
+ }), createSlots({
41040
+ default: withCtx(() => {
41041
+ var _a3, _b2, _c;
41042
+ return [
41043
+ item.type === unref(ToolBarItemType).Select || item.type === unref(ToolBarItemType).Input || item.type === unref(ToolBarItemType).RadioGroup ? (openBlock(), createElementBlock("div", _hoisted_3, "调试: " + toDisplayString(item.name) + " = " + toDisplayString((_a3 = item.props) == null ? void 0 : _a3.value), 1)) : createCommentVNode("", true),
41044
+ item.type === unref(ToolBarItemType).Select || item.type === unref(ToolBarItemType).Input || item.type === unref(ToolBarItemType).RadioGroup ? (openBlock(), createElementBlock("div", _hoisted_4, "实际值: " + toDisplayString(item.name) + " model-value = " + toDisplayString((_b2 = item.props) == null ? void 0 : _b2.value), 1)) : createCommentVNode("", true),
41045
+ item.type === unref(ToolBarItemType).Button && item.label ? (openBlock(), createElementBlock("span", _hoisted_5, toDisplayString(item.label), 1)) : createCommentVNode("", true),
41046
+ item.type === unref(ToolBarItemType).Text ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(item.label) + toDisplayString(item.props && (item.props.children || item.props.innerHTML)), 1)) : createCommentVNode("", true),
41047
+ item.type === unref(ToolBarItemType).Select ? (openBlock(true), createElementBlock(Fragment, { key: 4 }, renderList(item.asyncOptions || ((_c = item.props) == null ? void 0 : _c.options) || [], (opt) => {
41048
+ return openBlock(), createBlock(_component_el_option, {
41049
+ key: opt.value,
41050
+ label: opt.label,
41051
+ value: opt.value
41052
+ }, null, 8, ["label", "value"]);
41053
+ }), 128)) : createCommentVNode("", true),
41054
+ item.type === unref(ToolBarItemType).RadioGroup ? (openBlock(true), createElementBlock(Fragment, { key: 5 }, renderList(item.radios || [], (opt) => {
41055
+ return openBlock(), createBlock(_component_el_radio_button, {
41056
+ key: opt.value,
41057
+ label: opt.value
41058
+ }, {
41059
+ default: withCtx(() => [
41060
+ createTextVNode(toDisplayString(opt.label), 1)
41061
+ ]),
41062
+ _: 2
41063
+ }, 1032, ["label"]);
41064
+ }), 128)) : createCommentVNode("", true)
41065
+ ];
41066
+ }),
41067
+ _: 2
41068
+ }, [
41069
+ item.type === unref(ToolBarItemType).Button && item.props && item.props.icon ? {
41070
+ name: "icon",
41071
+ fn: withCtx(() => [
41072
+ createVNode(_component_el_icon, null, {
41073
+ default: withCtx(() => [
41074
+ (openBlock(), createBlock(resolveDynamicComponent(item.props.icon)))
41075
+ ]),
41076
+ _: 2
41077
+ }, 1024)
41078
+ ]),
41079
+ key: "0"
41080
+ } : void 0
41081
+ ]), 1040, ["disabled", "style", "model-value", "onClick", "onInput", "onChange", "onUpdate:modelValue"])) : !item.hidden ? (openBlock(), createElementBlock("div", {
41082
+ key: "left-slot-" + idx
41083
+ }, [
41084
+ renderSlot(_ctx.$slots, item.slot)
41085
+ ])) : createCommentVNode("", true)
41086
+ ], 64);
41087
+ }), 128))
41088
+ ]),
41089
+ createElementVNode("div", _hoisted_7, [
41090
+ (openBlock(true), createElementBlock(Fragment, null, renderList(rightItemsComputed.value, (item, idx) => {
41091
+ var _a2, _b;
41092
+ return openBlock(), createElementBlock(Fragment, {
41093
+ key: "right-" + idx
41094
+ }, [
41095
+ !item.slot && !item.hidden ? (openBlock(), createBlock(resolveDynamicComponent(getComponentType(item)), mergeProps({
41096
+ key: 0,
41097
+ ref_for: true
41098
+ }, getComponentProps(item), {
41099
+ disabled: item.disabled,
41100
+ style: getComponentStyle(item),
41101
+ "model-value": item.type === unref(ToolBarItemType).Select && ((_a2 = item.props) == null ? void 0 : _a2.onlyShowPlaceholder) ? void 0 : valueTracker.value.hasOwnProperty(item.name) ? valueTracker.value[item.name] : (_b = item.props) == null ? void 0 : _b.value,
41102
+ onClick: (e) => handleEvent("click", item, e),
41103
+ onInput: (val) => handleEvent("input", item, val),
41104
+ onChange: (val) => handleEvent("change", item, val),
41105
+ "onUpdate:modelValue": (val) => handleEvent("update:model-value", item, val)
41106
+ }), createSlots({
41107
+ default: withCtx(() => {
41108
+ var _a3, _b2, _c;
41109
+ return [
41110
+ item.type === unref(ToolBarItemType).Select || item.type === unref(ToolBarItemType).Input || item.type === unref(ToolBarItemType).RadioGroup ? (openBlock(), createElementBlock("div", _hoisted_8, "调试: " + toDisplayString(item.name) + " = " + toDisplayString((_a3 = item.props) == null ? void 0 : _a3.value), 1)) : createCommentVNode("", true),
41111
+ item.type === unref(ToolBarItemType).Select || item.type === unref(ToolBarItemType).Input || item.type === unref(ToolBarItemType).RadioGroup ? (openBlock(), createElementBlock("div", _hoisted_9, "实际值: " + toDisplayString(item.name) + " model-value = " + toDisplayString((_b2 = item.props) == null ? void 0 : _b2.value), 1)) : createCommentVNode("", true),
41112
+ item.type === unref(ToolBarItemType).Button && item.label ? (openBlock(), createElementBlock("span", _hoisted_10, toDisplayString(item.label), 1)) : createCommentVNode("", true),
41113
+ item.type === unref(ToolBarItemType).Text ? (openBlock(), createElementBlock("span", _hoisted_11, toDisplayString(item.label) + toDisplayString(item.props && (item.props.children || item.props.innerHTML)), 1)) : createCommentVNode("", true),
41114
+ item.type === unref(ToolBarItemType).Select ? (openBlock(true), createElementBlock(Fragment, { key: 4 }, renderList(item.asyncOptions || ((_c = item.props) == null ? void 0 : _c.options) || [], (opt) => {
41115
+ return openBlock(), createBlock(_component_el_option, {
41116
+ key: opt.value,
41117
+ label: opt.label,
41118
+ value: opt.value
41119
+ }, null, 8, ["label", "value"]);
41120
+ }), 128)) : createCommentVNode("", true),
41121
+ item.type === unref(ToolBarItemType).RadioGroup ? (openBlock(true), createElementBlock(Fragment, { key: 5 }, renderList(item.radios || [], (opt) => {
41122
+ return openBlock(), createBlock(_component_el_radio_button, {
41123
+ key: opt.value,
41124
+ label: opt.value
41125
+ }, {
41126
+ default: withCtx(() => [
41127
+ createTextVNode(toDisplayString(opt.label), 1)
41128
+ ]),
41129
+ _: 2
41130
+ }, 1032, ["label"]);
41131
+ }), 128)) : createCommentVNode("", true)
41132
+ ];
41133
+ }),
41134
+ _: 2
41135
+ }, [
41136
+ item.type === unref(ToolBarItemType).Button && item.props && item.props.icon ? {
41137
+ name: "icon",
41138
+ fn: withCtx(() => [
41139
+ createVNode(_component_el_icon, null, {
41140
+ default: withCtx(() => [
41141
+ (openBlock(), createBlock(resolveDynamicComponent(item.props.icon)))
41142
+ ]),
41143
+ _: 2
41144
+ }, 1024)
41145
+ ]),
41146
+ key: "0"
41147
+ } : void 0
41148
+ ]), 1040, ["disabled", "style", "model-value", "onClick", "onInput", "onChange", "onUpdate:modelValue"])) : !item.hidden ? (openBlock(), createElementBlock("div", {
41149
+ key: "right-slot-" + idx
41150
+ }, [
41151
+ renderSlot(_ctx.$slots, item.slot)
41152
+ ])) : createCommentVNode("", true)
41153
+ ], 64);
41154
+ }), 128))
41155
+ ])
41156
+ ]);
41157
+ };
41158
+ }
41159
+ });
40795
41160
  const zhCN = {
40796
41161
  vxe: {
40797
41162
  base: {
@@ -80921,7 +81286,8 @@ const VxeUIExport = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
80921
81286
  const components = {
80922
81287
  ByForm: ZshForm,
80923
81288
  ByPager: BasePager,
80924
- ByTable
81289
+ ByTable,
81290
+ ByToolBar: _sfc_main
80925
81291
  };
80926
81292
  const install = (app) => {
80927
81293
  app.use(VxeUIExport);
@@ -80934,6 +81300,7 @@ const ByComponentsV3 = {
80934
81300
  install
80935
81301
  };
80936
81302
  export {
81303
+ ToolBarItemType,
80937
81304
  components,
80938
81305
  ByComponentsV3 as default
80939
81306
  };