@weitutech/by-components-v3 1.1.12 → 1.1.14

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.
@@ -40558,8 +40558,11 @@ const ByTable = /* @__PURE__ */ defineComponent({
40558
40558
  columns,
40559
40559
  ...others
40560
40560
  } = props.gridOptions;
40561
- const newColumns = replaceColumnWidthToColumns(props.name, columns);
40561
+ let newColumns = replaceColumnWidthToColumns(props.name, columns);
40562
40562
  setHasCache();
40563
+ if (isMobile.value || tableWidth.value < 1e3) {
40564
+ newColumns = removeFixedColumns(newColumns);
40565
+ }
40563
40566
  return {
40564
40567
  border: true,
40565
40568
  round: true,
@@ -40611,6 +40614,8 @@ const ByTable = /* @__PURE__ */ defineComponent({
40611
40614
  const hasCache = ref(false);
40612
40615
  const originColumns = ref([]);
40613
40616
  const tempColumns = ref([]);
40617
+ const tableWidth = ref(window.innerWidth);
40618
+ const isMobile = ref(false);
40614
40619
  watch(() => props.gridOptions.columns, (newColumns) => {
40615
40620
  const result = rewriteWidthColumns(tempColumns.value, newColumns);
40616
40621
  originColumns.value = result;
@@ -40623,8 +40628,51 @@ const ByTable = /* @__PURE__ */ defineComponent({
40623
40628
  events.forEach((eventName) => {
40624
40629
  listeners.value["on" + eventName.split("-").map((item) => capitalizeFirstLetter(item)).join("")] = (event) => emit(eventName, event);
40625
40630
  });
40626
- console.log(listeners.value, "listeners");
40631
+ checkDeviceType();
40632
+ initResizeListener();
40633
+ });
40634
+ onUnmounted(() => {
40635
+ removeResizeListener();
40627
40636
  });
40637
+ const checkDeviceType = () => {
40638
+ const userAgent = navigator.userAgent || navigator.vendor || window.opera;
40639
+ const isMobileByUA = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent.toLowerCase());
40640
+ const isSmallScreen = window.innerWidth <= 1024;
40641
+ isMobile.value = isMobileByUA || isSmallScreen;
40642
+ };
40643
+ const initResizeListener = () => {
40644
+ window.addEventListener("resize", handleResize);
40645
+ nextTick(() => {
40646
+ if (vxeGridRef.value && vxeGridRef.value.$el) {
40647
+ tableWidth.value = vxeGridRef.value.$el.offsetWidth;
40648
+ }
40649
+ });
40650
+ };
40651
+ const removeResizeListener = () => {
40652
+ window.removeEventListener("resize", handleResize);
40653
+ };
40654
+ const handleResize = () => {
40655
+ if (vxeGridRef.value && vxeGridRef.value.$el) {
40656
+ tableWidth.value = vxeGridRef.value.$el.offsetWidth;
40657
+ } else {
40658
+ tableWidth.value = window.innerWidth;
40659
+ }
40660
+ };
40661
+ const removeFixedColumns = (columns) => {
40662
+ if (!columns || !Array.isArray(columns)) return columns;
40663
+ return columns.map((column) => {
40664
+ const newColumn = {
40665
+ ...column
40666
+ };
40667
+ if (newColumn.fixed) {
40668
+ delete newColumn.fixed;
40669
+ }
40670
+ if (newColumn.children && Array.isArray(newColumn.children)) {
40671
+ newColumn.children = removeFixedColumns(newColumn.children);
40672
+ }
40673
+ return newColumn;
40674
+ });
40675
+ };
40628
40676
  const handlePagerChange = (context) => {
40629
40677
  if (vxeGridRef.value) {
40630
40678
  vxeGridRef.value.scrollTo(0, 0);
@@ -40944,6 +40992,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
40944
40992
  if (!item.props) return {};
40945
40993
  const otherProps = { ...item.props };
40946
40994
  delete otherProps.value;
40995
+ if (item.type === ToolBarItemType.Select && item.props.onlyShowPlaceholder) {
40996
+ return otherProps;
40997
+ }
40947
40998
  return otherProps;
40948
40999
  };
40949
41000
  const getComponentStyle = (item) => {
@@ -41018,7 +41069,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
41018
41069
  return openBlock(), createElementBlock("div", _hoisted_1, [
41019
41070
  createElementVNode("div", _hoisted_2, [
41020
41071
  (openBlock(true), createElementBlock(Fragment, null, renderList(leftItemsComputed.value, (item, idx) => {
41021
- var _a2;
41072
+ var _a2, _b;
41022
41073
  return openBlock(), createElementBlock(Fragment, {
41023
41074
  key: "left-" + idx
41024
41075
  }, [
@@ -41028,17 +41079,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
41028
41079
  }, getComponentProps(item), {
41029
41080
  disabled: item.disabled,
41030
41081
  style: getComponentStyle(item),
41031
- "model-value": valueTracker.value.hasOwnProperty(item.name) ? valueTracker.value[item.name] : (_a2 = item.props) == null ? void 0 : _a2.value,
41082
+ "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,
41032
41083
  onClick: (e) => handleEvent("click", item, e),
41033
41084
  onInput: (val) => handleEvent("input", item, val),
41034
41085
  onChange: (val) => handleEvent("change", item, val),
41035
41086
  "onUpdate:modelValue": (val) => handleEvent("update:model-value", item, val)
41036
41087
  }), createSlots({
41037
41088
  default: withCtx(() => {
41038
- var _a3, _b, _c;
41089
+ var _a3, _b2, _c;
41039
41090
  return [
41040
41091
  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),
41041
- 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((_b = item.props) == null ? void 0 : _b.value), 1)) : createCommentVNode("", true),
41092
+ 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),
41042
41093
  item.type === unref(ToolBarItemType).Button && item.label ? (openBlock(), createElementBlock("span", _hoisted_5, toDisplayString(item.label), 1)) : createCommentVNode("", true),
41043
41094
  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),
41044
41095
  item.type === unref(ToolBarItemType).Select ? (openBlock(true), createElementBlock(Fragment, { key: 4 }, renderList(item.asyncOptions || ((_c = item.props) == null ? void 0 : _c.options) || [], (opt) => {
@@ -41085,7 +41136,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
41085
41136
  ]),
41086
41137
  createElementVNode("div", _hoisted_7, [
41087
41138
  (openBlock(true), createElementBlock(Fragment, null, renderList(rightItemsComputed.value, (item, idx) => {
41088
- var _a2;
41139
+ var _a2, _b;
41089
41140
  return openBlock(), createElementBlock(Fragment, {
41090
41141
  key: "right-" + idx
41091
41142
  }, [
@@ -41095,17 +41146,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
41095
41146
  }, getComponentProps(item), {
41096
41147
  disabled: item.disabled,
41097
41148
  style: getComponentStyle(item),
41098
- "model-value": valueTracker.value.hasOwnProperty(item.name) ? valueTracker.value[item.name] : (_a2 = item.props) == null ? void 0 : _a2.value,
41149
+ "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,
41099
41150
  onClick: (e) => handleEvent("click", item, e),
41100
41151
  onInput: (val) => handleEvent("input", item, val),
41101
41152
  onChange: (val) => handleEvent("change", item, val),
41102
41153
  "onUpdate:modelValue": (val) => handleEvent("update:model-value", item, val)
41103
41154
  }), createSlots({
41104
41155
  default: withCtx(() => {
41105
- var _a3, _b, _c;
41156
+ var _a3, _b2, _c;
41106
41157
  return [
41107
41158
  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),
41108
- 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((_b = item.props) == null ? void 0 : _b.value), 1)) : createCommentVNode("", true),
41159
+ 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),
41109
41160
  item.type === unref(ToolBarItemType).Button && item.label ? (openBlock(), createElementBlock("span", _hoisted_10, toDisplayString(item.label), 1)) : createCommentVNode("", true),
41110
41161
  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),
41111
41162
  item.type === unref(ToolBarItemType).Select ? (openBlock(true), createElementBlock(Fragment, { key: 4 }, renderList(item.asyncOptions || ((_c = item.props) == null ? void 0 : _c.options) || [], (opt) => {