yxuse 3.0.51 → 3.0.53

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/lib/index.es6.js CHANGED
@@ -55,7 +55,7 @@ import { genFileId } from "element-plus";
55
55
  import { j as jumpToHome, b as getUserConfig } from "./index.es12.js";
56
56
  import { u as uploadResourceApi } from "./index.es13.js";
57
57
  const _hoisted_1$4 = { class: "dialog-footer flex justify-end" };
58
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
58
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
59
59
  __name: "index",
60
60
  setup(__props, { expose: __expose }) {
61
61
  const dialogOptions = reactive({
@@ -148,7 +148,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
148
148
  }
149
149
  });
150
150
  const _hoisted_1$3 = { class: "dialog-footer flex justify-end" };
151
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
151
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
152
152
  __name: "index",
153
153
  setup(__props, { expose: __expose }) {
154
154
  const drawerOptions = reactive({
@@ -240,7 +240,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
240
240
  };
241
241
  }
242
242
  });
243
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
243
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
244
244
  __name: "index",
245
245
  props: {
246
246
  conf: {},
@@ -20459,7 +20459,7 @@ const exportToExcel = ({ header, tableData, fileName }) => {
20459
20459
  function _isSlot$1(s) {
20460
20460
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
20461
20461
  }
20462
- const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
20462
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
20463
20463
  name: "YxTable"
20464
20464
  }), {
20465
20465
  __name: "index",
@@ -20491,7 +20491,13 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20491
20491
  startSort();
20492
20492
  });
20493
20493
  });
20494
+ watch(() => props.columns, () => {
20495
+ initTable();
20496
+ });
20494
20497
  onBeforeMount(() => __async(this, null, function* () {
20498
+ yield initTable();
20499
+ }));
20500
+ const initTable = () => __async(this, null, function* () {
20495
20501
  columns.value = typeof props.columns === "function" ? yield props.columns() : props.columns;
20496
20502
  columns.value.forEach((col) => {
20497
20503
  var _a;
@@ -20500,7 +20506,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20500
20506
  loadOptions(col.config);
20501
20507
  }
20502
20508
  });
20503
- }));
20509
+ });
20504
20510
  const loadOptions = (config) => __async(this, null, function* () {
20505
20511
  if ((config == null ? void 0 : config.options) && (config == null ? void 0 : config.options.length) === 0 && (config == null ? void 0 : config.loadOptions) && typeof (config == null ? void 0 : config.loadOptions) === "function") {
20506
20512
  config.options = yield config == null ? void 0 : config.loadOptions();
@@ -20550,7 +20556,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20550
20556
  prop: cell.prop,
20551
20557
  config: cell.config
20552
20558
  };
20553
- return createVNode(_sfc_main$7, {
20559
+ return createVNode(_sfc_main$6, {
20554
20560
  "conf": conf,
20555
20561
  "model": scope.row,
20556
20562
  "onChange": cell == null ? void 0 : cell.change
@@ -20619,105 +20625,29 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20619
20625
  default: () => [_slot]
20620
20626
  }), pagination()]);
20621
20627
  };
20622
- const exportDataToExcel = ({
20623
- header,
20624
- tableData,
20625
- fileName
20626
- }) => {
20628
+ const exportDataToExcel = (fileName) => {
20629
+ const header = columns.value.filter((cell) => cell.prop);
20630
+ const tableData = props.tableData;
20627
20631
  exportToExcel({
20628
20632
  header,
20629
20633
  tableData,
20630
- fileName
20634
+ fileName: fileName || Date.now()
20631
20635
  });
20632
20636
  };
20637
+ const updateColumns = (newColumns) => __async(this, null, function* () {
20638
+ if (!columns.value) return;
20639
+ columns.value = typeof newColumns === "function" ? yield newColumns() : newColumns;
20640
+ });
20633
20641
  __expose({
20634
20642
  tableRef,
20635
- exportDataToExcel
20643
+ exportDataToExcel,
20644
+ updateColumns
20636
20645
  });
20637
20646
  return (_ctx, _cache) => {
20638
20647
  return openBlock(), createBlock(resolveDynamicComponent(render2(props)));
20639
20648
  };
20640
20649
  }
20641
20650
  }));
20642
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
20643
- __name: "index",
20644
- props: {
20645
- searchColumns: {},
20646
- searchParams: {},
20647
- showSearchBtn: {
20648
- type: Boolean,
20649
- default: true
20650
- },
20651
- showAddBtn: {
20652
- type: Boolean,
20653
- default: true
20654
- },
20655
- style: {},
20656
- labelStyle: {},
20657
- className: {},
20658
- classLabelName: {}
20659
- },
20660
- emits: ["search", "add"],
20661
- setup(__props, {
20662
- emit: __emit
20663
- }) {
20664
- const slots = useSlots();
20665
- const props = __props;
20666
- const emit = __emit;
20667
- const render2 = (props2) => {
20668
- const {
20669
- searchColumns,
20670
- searchParams,
20671
- showSearchBtn,
20672
- showAddBtn,
20673
- style,
20674
- labelStyle,
20675
- className,
20676
- classLabelName
20677
- } = props2;
20678
- const renderColumn = (searchColumns2) => {
20679
- return searchColumns2.filter((cell) => !cell.show || cell.show()).map((cell) => {
20680
- var _a, _b;
20681
- const conf = {
20682
- renderType: cell.renderType,
20683
- prop: cell.key,
20684
- config: cell.config
20685
- };
20686
- return createVNode("div", {
20687
- "class": `flex items-center search-item ${className != null ? className : ""} ${(_a = cell.className) != null ? _a : ""}`,
20688
- "style": __spreadValues(__spreadValues({}, style), cell.style)
20689
- }, [createVNode("span", {
20690
- "class": `whitespace-nowrap label ${classLabelName != null ? classLabelName : ""} ${(_b = cell.classLabelName) != null ? _b : ""}`,
20691
- "style": __spreadValues(__spreadValues({}, labelStyle), cell.labelStyle)
20692
- }, [createTextVNode(" "), cell.label, createTextVNode(" ")]), createVNode(_sfc_main$7, {
20693
- "class": cell.componentClassName,
20694
- "style": cell.componentStyle,
20695
- "conf": conf,
20696
- "model": searchParams,
20697
- "onChange": cell == null ? void 0 : cell.change
20698
- }, null)]);
20699
- });
20700
- };
20701
- return createVNode(Fragment, null, [createVNode("div", {
20702
- "class": "table-search flex gap-10"
20703
- }, [renderColumn(searchColumns), showSearchBtn && createVNode(resolveComponent("el-button"), {
20704
- "onClick": () => emit("search"),
20705
- "class": "search-item"
20706
- }, {
20707
- default: () => [createTextVNode("搜索"), " "]
20708
- }), showAddBtn && createVNode(resolveComponent("el-button"), {
20709
- "class": "search-item",
20710
- "onClick": () => emit("add")
20711
- }, {
20712
- default: () => [createTextVNode("添加")]
20713
- }), slots.default && slots.default()])]);
20714
- };
20715
- return (_ctx, _cache) => {
20716
- return openBlock(), createBlock(resolveDynamicComponent(render2(props)));
20717
- };
20718
- }
20719
- });
20720
- const index$2 = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-c70da20e"]]);
20721
20651
  const _hoisted_1$2 = {
20722
20652
  xmlns: "http://www.w3.org/2000/svg",
20723
20653
  viewBox: "0 0 1024 1024"
@@ -20803,7 +20733,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20803
20733
  if ((config == null ? void 0 : config.options) && (config == null ? void 0 : config.options.length) === 0 && (config == null ? void 0 : config.loadOptions) && typeof (config == null ? void 0 : config.loadOptions) === "function") {
20804
20734
  config.options = yield config == null ? void 0 : config.loadOptions();
20805
20735
  if (prop && ((_a = props == null ? void 0 : props.formParams) == null ? void 0 : _a[prop])) {
20806
- formData.value[prop] = props.formParams[prop];
20736
+ formData.value[prop] = props == null ? void 0 : props.formParams[prop];
20807
20737
  }
20808
20738
  }
20809
20739
  });
@@ -20823,21 +20753,22 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
20823
20753
  });
20824
20754
  const getRules = () => {
20825
20755
  var _a;
20826
- let rules = {};
20756
+ const rules = {};
20827
20757
  if (!((_a = formColumn.value) == null ? void 0 : _a.length)) return;
20828
20758
  const handleRule = (item) => {
20829
20759
  var _a2;
20830
- if (!item.required) return;
20831
20760
  if (!item.prop) return;
20832
20761
  const isSelect = (item == null ? void 0 : item.renderType) && ["select", "cascader"].includes(item == null ? void 0 : item.renderType);
20833
20762
  const defaultRule = {
20834
20763
  required: true,
20835
- message: `${(_a2 = item.label) != null ? _a2 : ""}不能为空`,
20764
+ message: `${(_a2 = item.label) != null ? _a2 : "该字段"}不能为空`,
20836
20765
  trigger: isSelect ? "change" : "blur"
20837
20766
  };
20838
- rules[item.prop] = rules[item.prop] ? [...rules[item.prop], defaultRule] : [defaultRule];
20839
- if (item.rules) {
20840
- rules[item.prop] = [...rules[item.prop], ...item.rules];
20767
+ if (item.required) {
20768
+ rules[item.prop] = [defaultRule];
20769
+ }
20770
+ if (item.rules && item.rules.length > 0) {
20771
+ rules[item.prop] = [...rules[item == null ? void 0 : item.prop] || [], ...item.rules];
20841
20772
  }
20842
20773
  };
20843
20774
  formColumn.value.forEach((form) => {
@@ -21020,7 +20951,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
21020
20951
  };
21021
20952
  }
21022
20953
  }));
21023
- const index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-2435d575"]]);
20954
+ const index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-4196aa66"]]);
21024
20955
  let versionKey, curVersion, updateApp;
21025
20956
  const updateSysVersion = () => {
21026
20957
  localStorage.setItem(versionKey, curVersion);
@@ -21280,25 +21211,23 @@ const components2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
21280
21211
  LogoTitleRender,
21281
21212
  Toolbar,
21282
21213
  Update,
21283
- YxDialog: _sfc_main$9,
21284
- YxDrawer: _sfc_main$8,
21214
+ YxDialog: _sfc_main$8,
21215
+ YxDrawer: _sfc_main$7,
21285
21216
  YxForm: index$1,
21286
21217
  YxIcon: index,
21287
- YxSearchForm: index$2,
21288
- YxTable: _sfc_main$6,
21218
+ YxTable: _sfc_main$5,
21289
21219
  YxUpload: _sfc_main$1
21290
21220
  }, Symbol.toStringTag, { value: "Module" }));
21291
21221
  export {
21292
21222
  LogoTitleRender as L,
21293
21223
  Update as U,
21294
- _sfc_main$9 as _,
21295
- _sfc_main$8 as a,
21296
- _sfc_main$6 as b,
21224
+ _sfc_main$8 as _,
21225
+ _sfc_main$7 as a,
21226
+ _sfc_main$5 as b,
21297
21227
  components2 as c,
21298
- index$1 as d,
21299
- index as e,
21300
- _sfc_main$1 as f,
21301
- LogoTitle as g,
21302
- index$2 as i
21228
+ index as d,
21229
+ _sfc_main$1 as e,
21230
+ LogoTitle as f,
21231
+ index$1 as i
21303
21232
  };
21304
21233
  //# sourceMappingURL=index.es6.js.map
Binary file