@weitutech/by-components-v3 1.0.7 → 1.1.0

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.
@@ -4119,7 +4119,7 @@ const _export_sfc$1 = (sfc, props) => {
4119
4119
  }
4120
4120
  return target;
4121
4121
  };
4122
- const CustomDatePicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["__scopeId", "data-v-eb020748"]]);
4122
+ const CustomDatePicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["__scopeId", "data-v-2bbd448a"]]);
4123
4123
  const _hoisted_1$2 = { class: "drawer_query_btn b-fold-search" };
4124
4124
  const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4125
4125
  __name: "foldSearch",
@@ -4170,7 +4170,120 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4170
4170
  };
4171
4171
  }
4172
4172
  });
4173
- const FoldSearch = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["__scopeId", "data-v-8196bae0"]]);
4173
+ const FoldSearch = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["__scopeId", "data-v-04f92519"]]);
4174
+ /*! Element Plus Icons Vue v2.3.1 */
4175
+ var circle_close_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
4176
+ name: "CircleCloseFilled",
4177
+ __name: "circle-close-filled",
4178
+ setup(__props) {
4179
+ return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
4180
+ xmlns: "http://www.w3.org/2000/svg",
4181
+ viewBox: "0 0 1024 1024"
4182
+ }, [
4183
+ createElementVNode("path", {
4184
+ fill: "currentColor",
4185
+ d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336z"
4186
+ })
4187
+ ]));
4188
+ }
4189
+ });
4190
+ var circle_close_filled_default = circle_close_filled_vue_vue_type_script_setup_true_lang_default;
4191
+ var close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
4192
+ name: "Close",
4193
+ __name: "close",
4194
+ setup(__props) {
4195
+ return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
4196
+ xmlns: "http://www.w3.org/2000/svg",
4197
+ viewBox: "0 0 1024 1024"
4198
+ }, [
4199
+ createElementVNode("path", {
4200
+ fill: "currentColor",
4201
+ d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
4202
+ })
4203
+ ]));
4204
+ }
4205
+ });
4206
+ var close_default = close_vue_vue_type_script_setup_true_lang_default;
4207
+ var info_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
4208
+ name: "InfoFilled",
4209
+ __name: "info-filled",
4210
+ setup(__props) {
4211
+ return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
4212
+ xmlns: "http://www.w3.org/2000/svg",
4213
+ viewBox: "0 0 1024 1024"
4214
+ }, [
4215
+ createElementVNode("path", {
4216
+ fill: "currentColor",
4217
+ d: "M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"
4218
+ })
4219
+ ]));
4220
+ }
4221
+ });
4222
+ var info_filled_default = info_filled_vue_vue_type_script_setup_true_lang_default;
4223
+ var magic_stick_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
4224
+ name: "MagicStick",
4225
+ __name: "magic-stick",
4226
+ setup(__props) {
4227
+ return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
4228
+ xmlns: "http://www.w3.org/2000/svg",
4229
+ viewBox: "0 0 1024 1024"
4230
+ }, [
4231
+ createElementVNode("path", {
4232
+ fill: "currentColor",
4233
+ d: "M512 64h64v192h-64zm0 576h64v192h-64zM160 480v-64h192v64zm576 0v-64h192v64zM249.856 199.04l45.248-45.184L430.848 289.6 385.6 334.848 249.856 199.104zM657.152 606.4l45.248-45.248 135.744 135.744-45.248 45.248zM114.048 923.2 68.8 877.952l316.8-316.8 45.248 45.248zM702.4 334.848 657.152 289.6l135.744-135.744 45.248 45.248z"
4234
+ })
4235
+ ]));
4236
+ }
4237
+ });
4238
+ var magic_stick_default = magic_stick_vue_vue_type_script_setup_true_lang_default;
4239
+ var search_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
4240
+ name: "Search",
4241
+ __name: "search",
4242
+ setup(__props) {
4243
+ return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
4244
+ xmlns: "http://www.w3.org/2000/svg",
4245
+ viewBox: "0 0 1024 1024"
4246
+ }, [
4247
+ createElementVNode("path", {
4248
+ fill: "currentColor",
4249
+ d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"
4250
+ })
4251
+ ]));
4252
+ }
4253
+ });
4254
+ var search_default = search_vue_vue_type_script_setup_true_lang_default;
4255
+ var success_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
4256
+ name: "SuccessFilled",
4257
+ __name: "success-filled",
4258
+ setup(__props) {
4259
+ return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
4260
+ xmlns: "http://www.w3.org/2000/svg",
4261
+ viewBox: "0 0 1024 1024"
4262
+ }, [
4263
+ createElementVNode("path", {
4264
+ fill: "currentColor",
4265
+ d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
4266
+ })
4267
+ ]));
4268
+ }
4269
+ });
4270
+ var success_filled_default = success_filled_vue_vue_type_script_setup_true_lang_default;
4271
+ var warning_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
4272
+ name: "WarningFilled",
4273
+ __name: "warning-filled",
4274
+ setup(__props) {
4275
+ return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
4276
+ xmlns: "http://www.w3.org/2000/svg",
4277
+ viewBox: "0 0 1024 1024"
4278
+ }, [
4279
+ createElementVNode("path", {
4280
+ fill: "currentColor",
4281
+ d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"
4282
+ })
4283
+ ]));
4284
+ }
4285
+ });
4286
+ var warning_filled_default = warning_filled_vue_vue_type_script_setup_true_lang_default;
4174
4287
  function _isSlot(s) {
4175
4288
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
4176
4289
  }
@@ -4252,10 +4365,21 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4252
4365
  elSize: {
4253
4366
  default: "default"
4254
4367
  },
4255
- modelValue: {},
4368
+ otherOptions: {
4369
+ default: () => ({
4370
+ submit: true,
4371
+ reset: true,
4372
+ submitText: "搜索",
4373
+ resetText: "重置",
4374
+ showSubmitIcon: true
4375
+ })
4376
+ },
4377
+ modelValue: {
4378
+ default: () => ({})
4379
+ },
4256
4380
  scrollIntoViewOptions: {}
4257
4381
  },
4258
- emits: ["update:modelValue", "change", "resetBtnClick", "queryBtnClick"],
4382
+ emits: ["update:modelValue", "change", "resetBtnClick", "queryBtnClick", "submit", "reset"],
4259
4383
  setup(__props, {
4260
4384
  expose: __expose,
4261
4385
  emit: __emit
@@ -4267,8 +4391,9 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4267
4391
  formItems,
4268
4392
  ...others
4269
4393
  } = toRefs(props);
4270
- const cloneModelValue = cloneDeep(props.modelValue);
4271
- const cloneFormItems = cloneDeep(props.formItems);
4394
+ const initialFormValues = ref({});
4395
+ const replacementData = ref();
4396
+ const isFirstLoad = ref(true);
4272
4397
  const emit = __emit;
4273
4398
  const isFold = ref(true);
4274
4399
  const newFormItems = ref();
@@ -4278,7 +4403,6 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4278
4403
  immediate: true,
4279
4404
  deep: true
4280
4405
  });
4281
- const replacementData = ref();
4282
4406
  watch(() => props.modelValue, (newValue, _) => {
4283
4407
  replacementData.value = {
4284
4408
  ...replacementData.value ? replacementData.value : {},
@@ -4288,6 +4412,12 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4288
4412
  immediate: true,
4289
4413
  deep: true
4290
4414
  });
4415
+ onMounted(() => {
4416
+ if (isFirstLoad.value) {
4417
+ initialFormValues.value = cloneDeep(replacementData.value);
4418
+ isFirstLoad.value = false;
4419
+ }
4420
+ });
4291
4421
  const handleValueChange = (value, field, item) => {
4292
4422
  console.log(value, "value", item);
4293
4423
  if (replacementData.value) {
@@ -4480,15 +4610,24 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4480
4610
  return createVNode(CustomDatePicker, mergeProps(item.attrs, {
4481
4611
  "a": item.attrs.a,
4482
4612
  "modelValue": props.modelValue[item.field],
4483
- "onUpdate:modelValue": ($event) => handleValueChange($event, item.field, item)
4613
+ "onUpdate:modelValue": ($event) => {
4614
+ handleValueChange($event, item.field, item);
4615
+ if (item.startTimeField && item.endTimeField && $event) {
4616
+ if ($event.length === 2) {
4617
+ if (item.startTimeField && props.modelValue[item.startTimeField] !== $event[0]) {
4618
+ handleValueChange($event[0], item.startTimeField, item);
4619
+ }
4620
+ if (item.endTimeField && props.modelValue[item.endTimeField] !== $event[1]) {
4621
+ handleValueChange($event[1], item.endTimeField, item);
4622
+ }
4623
+ } else if ($event.length === 0) {
4624
+ handleValueChange("", item.startTimeField, item);
4625
+ handleValueChange("", item.endTimeField, item);
4626
+ }
4627
+ }
4628
+ }
4484
4629
  }), null);
4485
4630
  };
4486
- const queryClick = () => {
4487
- emit("queryBtnClick");
4488
- };
4489
- const resetClick = () => {
4490
- emit("resetBtnClick", cloneModelValue, cloneFormItems);
4491
- };
4492
4631
  const SearchBtn = (item) => {
4493
4632
  return createVNode("div", null, [createVNode(resolveComponent("el-button"), mergeProps(item.attrs, {
4494
4633
  "size": getSize(item),
@@ -4503,16 +4642,32 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4503
4642
  default: () => [(item.attrs || {}).searchText || "搜索"]
4504
4643
  })]);
4505
4644
  };
4645
+ const FormButtons = (item) => {
4646
+ return createVNode("div", null, [(!item.otherOptions || item.otherOptions.reset !== false) && createVNode(resolveComponent("el-button"), mergeProps(item.attrs, {
4647
+ "size": getSize(item),
4648
+ "variant": "plain",
4649
+ "type": "default",
4650
+ "native-type": "reset"
4651
+ }), {
4652
+ default: () => [(item.otherOptions || {}).resetText || "重置"]
4653
+ }), (!item.otherOptions || item.otherOptions.submit !== false) && createVNode(resolveComponent("el-button"), mergeProps(item.attrs, {
4654
+ "size": getSize(item),
4655
+ "type": "primary",
4656
+ "native-type": "submit",
4657
+ "icon": !item.otherOptions || item.otherOptions.showSubmitIcon ? search_default : ""
4658
+ }), {
4659
+ default: () => [(item.otherOptions || {}).submitText || "搜索"]
4660
+ })]);
4661
+ };
4506
4662
  const ElCustom = (item) => {
4507
4663
  const slotsName = (item == null ? void 0 : item.field) ?? "default";
4508
4664
  const name = slots[item.field] ? slotsName : "default";
4509
4665
  return createVNode("div", null, [slots[name] ? slots[name]() : null]);
4510
4666
  };
4511
- const components2 = /* @__PURE__ */ new Map([["input", ElInput], ["inputNumber", ElInputNumber], ["select", ElSelect], ["treeSelect", ElTreeSelect], ["cascader", ElCascader], ["switch", ElSwitch], ["radio", ElRadio], ["checkbox", ElCheckbox], ["datepicker", ElDatePicker], ["customDatePicker", DatePicker2], ["search", SearchBtn], ["custom", ElCustom]]);
4667
+ const components2 = /* @__PURE__ */ new Map([["input", ElInput], ["inputNumber", ElInputNumber], ["select", ElSelect], ["treeSelect", ElTreeSelect], ["cascader", ElCascader], ["switch", ElSwitch], ["radio", ElRadio], ["checkbox", ElCheckbox], ["datepicker", ElDatePicker], ["customDatePicker", DatePicker2], ["search", SearchBtn], ["custom", ElCustom], ["formButtons", FormButtons]]);
4512
4668
  const DynamicComponent = (item) => components2.get(item.type)(item);
4513
4669
  const showFold = computed(() => {
4514
4670
  return (item) => {
4515
- console.log();
4516
4671
  if (!props.isFlexible) {
4517
4672
  return true;
4518
4673
  } else {
@@ -4577,15 +4732,50 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4577
4732
  return createVNode(resolveComponent("el-form"), mergeProps({
4578
4733
  "ref": formRef,
4579
4734
  "model": modelValue.value
4580
- }, formAttrs.value), _isSlot(ElFormRow) ? ElFormRow : {
4735
+ }, formAttrs.value, {
4736
+ "onSubmit": (e) => {
4737
+ e.preventDefault();
4738
+ submit();
4739
+ },
4740
+ "onReset": (e) => {
4741
+ e.preventDefault();
4742
+ reset();
4743
+ }
4744
+ }), _isSlot(ElFormRow) ? ElFormRow : {
4581
4745
  default: () => [ElFormRow]
4582
4746
  });
4583
4747
  };
4584
4748
  const handleFlexible = (val) => {
4585
4749
  isFold.value = !val;
4586
4750
  };
4751
+ const queryClick = () => {
4752
+ emit("queryBtnClick");
4753
+ };
4754
+ const resetClick = () => {
4755
+ var _a2;
4756
+ emit("update:modelValue", cloneDeep(initialFormValues.value));
4757
+ (_a2 = formRef.value) == null ? void 0 : _a2.resetFields();
4758
+ emit("resetBtnClick", cloneDeep(props.modelValue), cloneDeep(props.formItems));
4759
+ };
4760
+ const submit = () => {
4761
+ var _a2;
4762
+ console.log("submit 时的 modelValue:", modelValue.value);
4763
+ (_a2 = formRef.value) == null ? void 0 : _a2.validate((valid) => {
4764
+ if (valid) {
4765
+ emit("submit", modelValue.value);
4766
+ }
4767
+ });
4768
+ };
4769
+ const reset = () => {
4770
+ var _a2;
4771
+ emit("update:modelValue", cloneDeep(initialFormValues.value));
4772
+ (_a2 = formRef.value) == null ? void 0 : _a2.resetFields();
4773
+ emit("reset");
4774
+ };
4587
4775
  __expose({
4588
- formRef
4776
+ formRef,
4777
+ submit,
4778
+ reset
4589
4779
  });
4590
4780
  return (_ctx, _cache) => {
4591
4781
  var _a2;
@@ -4597,7 +4787,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4597
4787
  };
4598
4788
  }
4599
4789
  });
4600
- const ZshForm = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["__scopeId", "data-v-7d463c3f"]]);
4790
+ const ZshForm = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["__scopeId", "data-v-85f37128"]]);
4601
4791
  const _hoisted_1$1 = {
4602
4792
  id: "pager",
4603
4793
  class: "pager fixed bottom-0 right-0 w-full flex justify-center items-center z-50"
@@ -4654,7 +4844,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4654
4844
  };
4655
4845
  }
4656
4846
  });
4657
- const BasePager = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["__scopeId", "data-v-0c63fb09"]]);
4847
+ const BasePager = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["__scopeId", "data-v-4b6faf2c"]]);
4658
4848
  const coreVersion = "4.0.29";
4659
4849
  const VxeCore = {
4660
4850
  coreVersion,
@@ -33890,103 +34080,6 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
33890
34080
  });
33891
34081
  var Icon$1 = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "icon.vue"]]);
33892
34082
  const ElIcon = withInstall(Icon$1);
33893
- /*! Element Plus Icons Vue v2.3.1 */
33894
- var circle_close_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
33895
- name: "CircleCloseFilled",
33896
- __name: "circle-close-filled",
33897
- setup(__props) {
33898
- return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
33899
- xmlns: "http://www.w3.org/2000/svg",
33900
- viewBox: "0 0 1024 1024"
33901
- }, [
33902
- createElementVNode("path", {
33903
- fill: "currentColor",
33904
- d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336z"
33905
- })
33906
- ]));
33907
- }
33908
- });
33909
- var circle_close_filled_default = circle_close_filled_vue_vue_type_script_setup_true_lang_default;
33910
- var close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
33911
- name: "Close",
33912
- __name: "close",
33913
- setup(__props) {
33914
- return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
33915
- xmlns: "http://www.w3.org/2000/svg",
33916
- viewBox: "0 0 1024 1024"
33917
- }, [
33918
- createElementVNode("path", {
33919
- fill: "currentColor",
33920
- d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
33921
- })
33922
- ]));
33923
- }
33924
- });
33925
- var close_default = close_vue_vue_type_script_setup_true_lang_default;
33926
- var info_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
33927
- name: "InfoFilled",
33928
- __name: "info-filled",
33929
- setup(__props) {
33930
- return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
33931
- xmlns: "http://www.w3.org/2000/svg",
33932
- viewBox: "0 0 1024 1024"
33933
- }, [
33934
- createElementVNode("path", {
33935
- fill: "currentColor",
33936
- d: "M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"
33937
- })
33938
- ]));
33939
- }
33940
- });
33941
- var info_filled_default = info_filled_vue_vue_type_script_setup_true_lang_default;
33942
- var magic_stick_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
33943
- name: "MagicStick",
33944
- __name: "magic-stick",
33945
- setup(__props) {
33946
- return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
33947
- xmlns: "http://www.w3.org/2000/svg",
33948
- viewBox: "0 0 1024 1024"
33949
- }, [
33950
- createElementVNode("path", {
33951
- fill: "currentColor",
33952
- d: "M512 64h64v192h-64zm0 576h64v192h-64zM160 480v-64h192v64zm576 0v-64h192v64zM249.856 199.04l45.248-45.184L430.848 289.6 385.6 334.848 249.856 199.104zM657.152 606.4l45.248-45.248 135.744 135.744-45.248 45.248zM114.048 923.2 68.8 877.952l316.8-316.8 45.248 45.248zM702.4 334.848 657.152 289.6l135.744-135.744 45.248 45.248z"
33953
- })
33954
- ]));
33955
- }
33956
- });
33957
- var magic_stick_default = magic_stick_vue_vue_type_script_setup_true_lang_default;
33958
- var success_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
33959
- name: "SuccessFilled",
33960
- __name: "success-filled",
33961
- setup(__props) {
33962
- return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
33963
- xmlns: "http://www.w3.org/2000/svg",
33964
- viewBox: "0 0 1024 1024"
33965
- }, [
33966
- createElementVNode("path", {
33967
- fill: "currentColor",
33968
- d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
33969
- })
33970
- ]));
33971
- }
33972
- });
33973
- var success_filled_default = success_filled_vue_vue_type_script_setup_true_lang_default;
33974
- var warning_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
33975
- name: "WarningFilled",
33976
- __name: "warning-filled",
33977
- setup(__props) {
33978
- return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
33979
- xmlns: "http://www.w3.org/2000/svg",
33980
- viewBox: "0 0 1024 1024"
33981
- }, [
33982
- createElementVNode("path", {
33983
- fill: "currentColor",
33984
- d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"
33985
- })
33986
- ]));
33987
- }
33988
- });
33989
- var warning_filled_default = warning_filled_vue_vue_type_script_setup_true_lang_default;
33990
34083
  const iconPropType = definePropType([
33991
34084
  String,
33992
34085
  Object,
@@ -36385,18 +36478,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
36385
36478
  };
36386
36479
  draggableMenu.value.forEach((cols) => {
36387
36480
  if (cols.field === "left" || cols.field === "right") {
36388
- params.column.push(...cols.children.map((col) => ({
36389
- label: col.title,
36390
- type: col.type ? "true" : "false",
36391
- key: col.field,
36392
- overLength: col.showOverflow,
36393
- sort: col.sort,
36394
- sortable: col.sortable,
36395
- fixed: cols.field,
36396
- width: col.width,
36397
- align: col.align,
36398
- parentColTitle: col.parentColTitle || void 0
36399
- })));
36481
+ params.column.push(
36482
+ ...cols.children.map((col) => ({
36483
+ label: col.title,
36484
+ type: col.type ? "true" : "false",
36485
+ key: col.field,
36486
+ overLength: col.showOverflow,
36487
+ sort: col.sort,
36488
+ sortable: col.sortable,
36489
+ fixed: cols.field,
36490
+ width: col.width,
36491
+ align: col.align,
36492
+ parentColTitle: col.parentColTitle || void 0
36493
+ }))
36494
+ );
36400
36495
  } else {
36401
36496
  params.column.push({
36402
36497
  label: cols.title,
@@ -36704,8 +36799,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
36704
36799
  };
36705
36800
  }
36706
36801
  });
36707
- const CustomColumn = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["__scopeId", "data-v-4a62d7dd"]]);
36708
- const events = ["keydown", "current-change", "radio-change", "checkbox-change", "checkbox-all", "checkbox-range-start", "checkbox-range-change", "checkbox-range-end", "cell-dblclick", "cell-menu", "cell-mouseenter", "cell-mouseleave", "cell-delete-value", "header-cell-click", "header-cell-dblclick", "header-cell-menu", "footer-cell-click", "footer-cell-dblclick", "footer-cell-menu", "clear-merge", "sort-change", "clear-sort", "filter-visible", "filter-change", "clear-filter", "resizable-change", "toggle-row-expand", "toggle-tree-expand", "menu-click", "cell-selected", "edit-closed", "edit-activated", "edit-disabled", "valid-error", "scroll", "custom", "page-change", "form-submit", "form-submit-invalid", "form-reset", "form-collapse", "proxy-query", "proxy-delete", "proxy-save", "toolbar-button-click", "toolbar-tool-click", "zoom", "cell-click"];
36802
+ const CustomColumn = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["__scopeId", "data-v-0dadba78"]]);
36803
+ const events = ["keydown", "current-change", "radio-change", "checkbox-change", "checkbox-all", "checkbox-range-start", "checkbox-range-change", "checkbox-range-end", "cell-dblclick", "cell-menu", "cell-mouseenter", "cell-mouseleave", "cell-delete-value", "header-cell-click", "header-cell-dblclick", "header-cell-menu", "footer-cell-click", "footer-cell-dblclick", "footer-cell-menu", "clear-merge", "sort-change", "clear-sort", "filter-visible", "filter-change", "clear-filter", "toggle-row-expand", "toggle-tree-expand", "menu-click", "cell-selected", "edit-closed", "edit-activated", "edit-disabled", "valid-error", "scroll", "custom", "page-change", "form-submit", "form-submit-invalid", "form-reset", "form-collapse", "proxy-query", "proxy-delete", "proxy-save", "toolbar-button-click", "toolbar-tool-click", "zoom", "cell-click"];
36709
36804
  const capitalizeFirstLetter = (str) => {
36710
36805
  return str.charAt(0).toUpperCase() + str.slice(1);
36711
36806
  };
@@ -36714,6 +36809,15 @@ const ByTable = /* @__PURE__ */ defineComponent({
36714
36809
  gridOptions: {
36715
36810
  type: Object,
36716
36811
  required: true
36812
+ },
36813
+ //如果有传入name时,当表格宽度拖动时,会缓存当前表格每列的宽度,下次刷新将展示缓存宽度(⚠️注意:同一个项目中name一定不要重复)
36814
+ name: {
36815
+ type: String,
36816
+ default: ""
36817
+ },
36818
+ autoHeight: {
36819
+ type: Boolean,
36820
+ default: false
36717
36821
  }
36718
36822
  },
36719
36823
  emits: ["pageChange", "setColumns", "setGroupColumn", ...events],
@@ -36726,11 +36830,15 @@ const ByTable = /* @__PURE__ */ defineComponent({
36726
36830
  const {
36727
36831
  customColumnConfig,
36728
36832
  pagerConfig,
36833
+ columns,
36729
36834
  ...others
36730
36835
  } = props.gridOptions;
36836
+ const newColumns = getColumnsData(columns);
36731
36837
  return {
36732
36838
  border: true,
36733
- showOverflow: true,
36839
+ // 'visible' 值在 v4 版本中已经不再支持 (true:显示省略号; false:不显示省略号,自动撑高)
36840
+ showOverflow: !props.autoHeight,
36841
+ showHeaderOverflow: props.autoHeight ? "tooltip" : true,
36734
36842
  height: 710,
36735
36843
  align: "center",
36736
36844
  copyFields: [],
@@ -36739,6 +36847,7 @@ const ByTable = /* @__PURE__ */ defineComponent({
36739
36847
  loadingConfig: {
36740
36848
  text: "加载中..."
36741
36849
  },
36850
+ columns: newColumns,
36742
36851
  ...others,
36743
36852
  columnConfig: {
36744
36853
  resizable: true
@@ -36767,6 +36876,40 @@ const ByTable = /* @__PURE__ */ defineComponent({
36767
36876
  console.log(listeners.value, "listeners");
36768
36877
  });
36769
36878
  const CustomColumnRef = ref();
36879
+ const getColumnsData = (columns) => {
36880
+ if (!props.name) {
36881
+ return columns;
36882
+ }
36883
+ const cacheColumns = JSON.parse(localStorage.getItem(props.name));
36884
+ if (!cacheColumns) {
36885
+ return columns;
36886
+ }
36887
+ const cols = compareColumnsAndCols(columns, cacheColumns);
36888
+ if (cols && props.name) {
36889
+ columns.forEach((item) => {
36890
+ item.width = (cols.find((col) => col.field === item.field) || {}).width || item.width || void 0;
36891
+ });
36892
+ }
36893
+ return columns;
36894
+ };
36895
+ const compareColumnsAndCols = (columns, cacheColumns) => {
36896
+ if (!cacheColumns || !props.name) {
36897
+ return void 0;
36898
+ }
36899
+ console.log(columns, "columns");
36900
+ columns.forEach((item) => {
36901
+ if (item && item.field && !cacheColumns.some((col) => col && col.field === item.field)) {
36902
+ cacheColumns.push({
36903
+ field: item.field,
36904
+ width: item.width
36905
+ });
36906
+ }
36907
+ });
36908
+ const newCacheColumns = cacheColumns.filter((item) => item && item.field && columns.some((col) => col && col.field === item.field));
36909
+ console.log("newCacheColumns=====:", newCacheColumns);
36910
+ localStorage.setItem(props.name, JSON.stringify(newCacheColumns));
36911
+ return newCacheColumns;
36912
+ };
36770
36913
  const handlePagerChange = (context) => {
36771
36914
  emit("pageChange", context);
36772
36915
  };
@@ -36789,6 +36932,17 @@ const ByTable = /* @__PURE__ */ defineComponent({
36789
36932
  }
36790
36933
  emit("cell-click", context);
36791
36934
  };
36935
+ const handleResizableChange = (context) => {
36936
+ emit("resizable-change", context);
36937
+ if (!props.name) return;
36938
+ const collectColumn = context.$table.getTableColumn().collectColumn;
36939
+ console.log(collectColumn, "collectColumn");
36940
+ const clos = collectColumn.filter((col) => col.field).map((col) => ({
36941
+ field: col.field,
36942
+ width: col.renderWidth
36943
+ }));
36944
+ localStorage.setItem(props.name, JSON.stringify(clos));
36945
+ };
36792
36946
  const handleOpenCustomColumn = () => {
36793
36947
  console.log(CustomColumnRef.value.dialogVisible, "CustomColumnRef.value.dialogVisible");
36794
36948
  CustomColumnRef.value.dialogVisible = true;
@@ -36882,7 +37036,8 @@ const ByTable = /* @__PURE__ */ defineComponent({
36882
37036
  return createVNode("div", {
36883
37037
  "class": "VxeGridWrap"
36884
37038
  }, [createVNode(VxeGrid, mergeProps(defaultOptions.value, listeners.value, {
36885
- "onCellClick": handleCellClick
37039
+ "onCellClick": handleCellClick,
37040
+ "onResizableChange": handleResizableChange
36886
37041
  }), {
36887
37042
  ...Slots
36888
37043
  }), props.gridOptions.customColumnConfig && props.gridOptions.customColumnConfig.showCustomColumn ? createVNode(CustomColumn, {