@vipl520/dk-ui 1.0.38 → 1.0.39

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.
Files changed (36) hide show
  1. package/dist/index.js +41 -6
  2. package/dist/index.min.js +9 -9
  3. package/dist/index.min.js.map +1 -1
  4. package/dist/index.min.mjs +8 -8
  5. package/dist/index.min.mjs.map +1 -1
  6. package/dist/index.mjs +41 -6
  7. package/dist/web-types.json +1 -1
  8. package/es/table/index.d.ts +15 -0
  9. package/es/table/src/components/ComSearch.vue2.mjs +0 -2
  10. package/es/table/src/components/ComSearch.vue2.mjs.map +1 -1
  11. package/es/table/src/props.d.ts +4 -0
  12. package/es/table/src/props.mjs +6 -0
  13. package/es/table/src/props.mjs.map +1 -1
  14. package/es/table/src/table.vue.d.ts +9 -0
  15. package/es/table/src/table.vue2.mjs +4 -1
  16. package/es/table/src/table.vue2.mjs.map +1 -1
  17. package/es/table/utils/dkTable.mjs +17 -1
  18. package/es/table/utils/dkTable.mjs.map +1 -1
  19. package/es/table/utils/dkTableApi.d.ts +6 -0
  20. package/es/table/utils/dkTableApi.mjs +14 -2
  21. package/es/table/utils/dkTableApi.mjs.map +1 -1
  22. package/lib/table/index.d.ts +15 -0
  23. package/lib/table/src/components/ComSearch.vue2.js +0 -2
  24. package/lib/table/src/components/ComSearch.vue2.js.map +1 -1
  25. package/lib/table/src/props.d.ts +4 -0
  26. package/lib/table/src/props.js +6 -0
  27. package/lib/table/src/props.js.map +1 -1
  28. package/lib/table/src/table.vue.d.ts +9 -0
  29. package/lib/table/src/table.vue2.js +4 -1
  30. package/lib/table/src/table.vue2.js.map +1 -1
  31. package/lib/table/utils/dkTable.js +17 -1
  32. package/lib/table/utils/dkTable.js.map +1 -1
  33. package/lib/table/utils/dkTableApi.d.ts +6 -0
  34. package/lib/table/utils/dkTableApi.js +14 -2
  35. package/lib/table/utils/dkTableApi.js.map +1 -1
  36. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -25051,6 +25051,12 @@
25051
25051
  return ["refresh", "add", "export_csv", "edit", "delete", "comSearch", "quickSearch", "columnDisplay", "recycle"];
25052
25052
  },
25053
25053
  type: Array
25054
+ },
25055
+ hideButtons: {
25056
+ default: () => {
25057
+ return [];
25058
+ },
25059
+ type: Array
25054
25060
  }
25055
25061
  };
25056
25062
 
@@ -28077,6 +28083,8 @@
28077
28083
  class dkTableApi {
28078
28084
  controllerUrl;
28079
28085
  actionUrl;
28086
+ requestConfig = {};
28087
+ // 新增:用于存储配置的request参数
28080
28088
  constructor(controllerUrl) {
28081
28089
  if (!controllerUrl.endsWith("/")) {
28082
28090
  controllerUrl += "/";
@@ -28102,6 +28110,13 @@
28102
28110
  // 回收站还原
28103
28111
  ]);
28104
28112
  }
28113
+ /**
28114
+ * 配置request参数
28115
+ * @param config 包含HTTP方法、请求头等额外参数的对象
28116
+ */
28117
+ configureRequest(config) {
28118
+ this.requestConfig = { ...config };
28119
+ }
28105
28120
  /**
28106
28121
  * 获取表格配置
28107
28122
  */
@@ -28109,7 +28124,9 @@
28109
28124
  return request(
28110
28125
  {
28111
28126
  url: this.actionUrl.get("table"),
28112
- method: "post"
28127
+ method: "post",
28128
+ ...this.requestConfig
28129
+ // 将requestConfig的内容展开到request的参数中
28113
28130
  },
28114
28131
  {
28115
28132
  code_error_show: true
@@ -28154,7 +28171,8 @@
28154
28171
  {
28155
28172
  url: this.actionUrl.get("index"),
28156
28173
  method: "get",
28157
- params: filter
28174
+ params: filter,
28175
+ ...this.requestConfig
28158
28176
  },
28159
28177
  {
28160
28178
  code_error_show: true
@@ -28387,6 +28405,8 @@
28387
28405
  return true;
28388
28406
  }
28389
28407
  getIndex = () => {
28408
+ if (!this.runBefore("api", { name: "getIndex" }))
28409
+ return;
28390
28410
  if (!this.runBefore("getIndex"))
28391
28411
  return;
28392
28412
  this.table.loading = true;
@@ -28400,6 +28420,8 @@
28400
28420
  });
28401
28421
  };
28402
28422
  getTable = (cache = false) => {
28423
+ if (!this.runBefore("api", { name: "getTable" }))
28424
+ return;
28403
28425
  if (!this.runBefore("getTable"))
28404
28426
  return;
28405
28427
  this.table.columnLoading = true;
@@ -28429,6 +28451,8 @@
28429
28451
  * 显示回收站
28430
28452
  */
28431
28453
  async showRecycle() {
28454
+ if (!this.runBefore("api", { name: "getRecycleTable" }))
28455
+ return;
28432
28456
  if (!this.runBefore("getRecycleTable"))
28433
28457
  return;
28434
28458
  this.recycleTable.showDialogLoading = true;
@@ -28443,6 +28467,8 @@
28443
28467
  * 获取回收站列表
28444
28468
  */
28445
28469
  getRecycleIndex = () => {
28470
+ if (!this.runBefore("api", { name: "getRecycleIndex" }))
28471
+ return;
28446
28472
  if (!this.runBefore("getRecycleIndex"))
28447
28473
  return;
28448
28474
  this.recycleTable.loading = true;
@@ -28458,7 +28484,9 @@
28458
28484
  * @param cache
28459
28485
  */
28460
28486
  getRecycleTable = (cache = false) => {
28461
- if (!this.runBefore("getTable"))
28487
+ if (!this.runBefore("api", { name: "getRecycleTable" }))
28488
+ return;
28489
+ if (!this.runBefore("getRecycleTable"))
28462
28490
  return;
28463
28491
  this.recycleTable.columnLoading = true;
28464
28492
  if (cache) {
@@ -28567,6 +28595,8 @@
28567
28595
  if (!data.row || !data.field.prop)
28568
28596
  return;
28569
28597
  if (Object.keys(data.row).length === 0) ;
28598
+ if (!this.runBefore("api", { name: "fieldChange" }))
28599
+ return;
28570
28600
  data.row.loading = true;
28571
28601
  this.api.postData("edit", {
28572
28602
  [this.table.pk]: data.row[this.table.pk],
@@ -28603,6 +28633,8 @@
28603
28633
  };
28604
28634
  // 删除
28605
28635
  postDel = (ids) => {
28636
+ if (!this.runBefore("api", { name: "postDel" }))
28637
+ return;
28606
28638
  if (!this.runBefore("postDel", { ids }))
28607
28639
  return;
28608
28640
  this.api.del(ids).then((res) => {
@@ -28675,6 +28707,8 @@
28675
28707
  } else {
28676
28708
  this.form.edit_id = 0;
28677
28709
  }
28710
+ if (!this.runBefore("api", { name: "toggleForm" }))
28711
+ return;
28678
28712
  this.api.form(this.form.edit_id).then((res) => {
28679
28713
  this.form.ref.setFormData(res.data);
28680
28714
  this.form.ref.show();
@@ -29826,7 +29860,6 @@
29826
29860
  } else if (fieldDataTemp.render == "time" && (fieldDataTemp.operator == "RANGE" || fieldDataTemp.operator == "NOT RANGE")) {
29827
29861
  if (DkTable.comSearch.form[key] && DkTable.comSearch.form[key].length >= 2) {
29828
29862
  val = DkTable.comSearch.form[key][0] + "," + DkTable.comSearch.form[key][1];
29829
- console.log("val", val, DkTable.comSearch.form[key]);
29830
29863
  }
29831
29864
  } else if (fieldDataTemp.operator == "RANGE" || fieldDataTemp.operator == "NOT RANGE") {
29832
29865
  if (!DkTable.comSearch.form[key + "-start"] && !DkTable.comSearch.form[key + "-end"]) {
@@ -29845,7 +29878,6 @@
29845
29878
  });
29846
29879
  }
29847
29880
  }
29848
- console.log("comSearchData", comSearchData);
29849
29881
  DkTable.onTableAction("com-search", comSearchData);
29850
29882
  };
29851
29883
  const onResetForm = () => {
@@ -31451,6 +31483,9 @@
31451
31483
  DkTable.table.ref = TableRef.value;
31452
31484
  DkTable.form.ref = FormRef.value;
31453
31485
  });
31486
+ const effectiveButtons = require$$0.computed(() => {
31487
+ return [...new Set(props.buttons.filter((button) => !props.hideButtons.includes(button)))];
31488
+ });
31454
31489
  const onTableSizeChange = (val) => {
31455
31490
  DkTable.onTableAction("page-size-change", { size: val });
31456
31491
  };
@@ -31556,7 +31591,7 @@
31556
31591
  require$$0.createCommentVNode("\u9876\u90E8\u83DC\u5355"),
31557
31592
  require$$0.createVNode(DkTableHeader, {
31558
31593
  size: "default",
31559
- buttons: _ctx.buttons
31594
+ buttons: effectiveButtons.value
31560
31595
  }, require$$0.createSlots({
31561
31596
  _: 2
31562
31597
  /* DYNAMIC */