@vipl520/dk-ui 1.0.38 → 1.0.40

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 (42) hide show
  1. package/dist/index.js +65 -15
  2. package/dist/index.min.js +8 -8
  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 +65 -15
  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/components/header.vue.d.ts +6 -0
  12. package/es/table/src/components/header.vue2.mjs +6 -0
  13. package/es/table/src/components/header.vue2.mjs.map +1 -1
  14. package/es/table/src/props.d.ts +4 -0
  15. package/es/table/src/props.mjs +6 -0
  16. package/es/table/src/props.mjs.map +1 -1
  17. package/es/table/src/table.vue.d.ts +9 -0
  18. package/es/table/src/table.vue2.mjs +4 -1
  19. package/es/table/src/table.vue2.mjs.map +1 -1
  20. package/es/table/utils/dkTable.mjs +17 -1
  21. package/es/table/utils/dkTable.mjs.map +1 -1
  22. package/es/table/utils/dkTableApi.d.ts +6 -0
  23. package/es/table/utils/dkTableApi.mjs +32 -11
  24. package/es/table/utils/dkTableApi.mjs.map +1 -1
  25. package/lib/table/index.d.ts +15 -0
  26. package/lib/table/src/components/ComSearch.vue2.js +0 -2
  27. package/lib/table/src/components/ComSearch.vue2.js.map +1 -1
  28. package/lib/table/src/components/header.vue.d.ts +6 -0
  29. package/lib/table/src/components/header.vue2.js +6 -0
  30. package/lib/table/src/components/header.vue2.js.map +1 -1
  31. package/lib/table/src/props.d.ts +4 -0
  32. package/lib/table/src/props.js +6 -0
  33. package/lib/table/src/props.js.map +1 -1
  34. package/lib/table/src/table.vue.d.ts +9 -0
  35. package/lib/table/src/table.vue2.js +4 -1
  36. package/lib/table/src/table.vue2.js.map +1 -1
  37. package/lib/table/utils/dkTable.js +17 -1
  38. package/lib/table/utils/dkTable.js.map +1 -1
  39. package/lib/table/utils/dkTableApi.d.ts +6 -0
  40. package/lib/table/utils/dkTableApi.js +32 -11
  41. package/lib/table/utils/dkTableApi.js.map +1 -1
  42. 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
@@ -28123,7 +28140,8 @@
28123
28140
  return request(
28124
28141
  {
28125
28142
  url: this.actionUrl.get("recycleTable"),
28126
- method: "post"
28143
+ method: "post",
28144
+ ...this.requestConfig
28127
28145
  },
28128
28146
  {
28129
28147
  code_error_show: true
@@ -28138,7 +28156,8 @@
28138
28156
  {
28139
28157
  url: this.actionUrl.get("form"),
28140
28158
  method: "post",
28141
- data: { id }
28159
+ data: { id },
28160
+ ...this.requestConfig
28142
28161
  },
28143
28162
  {
28144
28163
  code_error_show: true
@@ -28154,7 +28173,8 @@
28154
28173
  {
28155
28174
  url: this.actionUrl.get("index"),
28156
28175
  method: "get",
28157
- params: filter
28176
+ params: filter,
28177
+ ...this.requestConfig
28158
28178
  },
28159
28179
  {
28160
28180
  code_error_show: true
@@ -28170,7 +28190,8 @@
28170
28190
  {
28171
28191
  url: this.actionUrl.get("recycle"),
28172
28192
  method: "get",
28173
- params: filter
28193
+ params: filter,
28194
+ ...this.requestConfig
28174
28195
  },
28175
28196
  {
28176
28197
  code_error_show: true
@@ -28186,7 +28207,8 @@
28186
28207
  {
28187
28208
  url: this.actionUrl.get("edit"),
28188
28209
  method: "get",
28189
- params
28210
+ params,
28211
+ ...this.requestConfig
28190
28212
  },
28191
28213
  {
28192
28214
  code_error_show: true
@@ -28204,7 +28226,8 @@
28204
28226
  method: "DELETE",
28205
28227
  params: {
28206
28228
  ids
28207
- }
28229
+ },
28230
+ ...this.requestConfig
28208
28231
  },
28209
28232
  {
28210
28233
  code_success_show: true,
@@ -28223,7 +28246,8 @@
28223
28246
  method: "POST",
28224
28247
  data: {
28225
28248
  ids
28226
- }
28249
+ },
28250
+ ...this.requestConfig
28227
28251
  },
28228
28252
  {
28229
28253
  code_success_show: true,
@@ -28242,7 +28266,8 @@
28242
28266
  method: "POST",
28243
28267
  data: {
28244
28268
  ids
28245
- }
28269
+ },
28270
+ ...this.requestConfig
28246
28271
  },
28247
28272
  {
28248
28273
  code_success_show: true,
@@ -28260,7 +28285,8 @@
28260
28285
  {
28261
28286
  url: this.actionUrl.has(action) ? this.actionUrl.get(action) : this.controllerUrl + action,
28262
28287
  method: "post",
28263
- data
28288
+ data,
28289
+ ...this.requestConfig
28264
28290
  },
28265
28291
  {
28266
28292
  code_success_show: true,
@@ -28281,7 +28307,8 @@
28281
28307
  data: {
28282
28308
  id,
28283
28309
  targetId
28284
- }
28310
+ },
28311
+ ...this.requestConfig
28285
28312
  },
28286
28313
  {
28287
28314
  code_error_show: true
@@ -28387,6 +28414,8 @@
28387
28414
  return true;
28388
28415
  }
28389
28416
  getIndex = () => {
28417
+ if (!this.runBefore("api", { name: "getIndex" }))
28418
+ return;
28390
28419
  if (!this.runBefore("getIndex"))
28391
28420
  return;
28392
28421
  this.table.loading = true;
@@ -28400,6 +28429,8 @@
28400
28429
  });
28401
28430
  };
28402
28431
  getTable = (cache = false) => {
28432
+ if (!this.runBefore("api", { name: "getTable" }))
28433
+ return;
28403
28434
  if (!this.runBefore("getTable"))
28404
28435
  return;
28405
28436
  this.table.columnLoading = true;
@@ -28429,6 +28460,8 @@
28429
28460
  * 显示回收站
28430
28461
  */
28431
28462
  async showRecycle() {
28463
+ if (!this.runBefore("api", { name: "getRecycleTable" }))
28464
+ return;
28432
28465
  if (!this.runBefore("getRecycleTable"))
28433
28466
  return;
28434
28467
  this.recycleTable.showDialogLoading = true;
@@ -28443,6 +28476,8 @@
28443
28476
  * 获取回收站列表
28444
28477
  */
28445
28478
  getRecycleIndex = () => {
28479
+ if (!this.runBefore("api", { name: "getRecycleIndex" }))
28480
+ return;
28446
28481
  if (!this.runBefore("getRecycleIndex"))
28447
28482
  return;
28448
28483
  this.recycleTable.loading = true;
@@ -28458,7 +28493,9 @@
28458
28493
  * @param cache
28459
28494
  */
28460
28495
  getRecycleTable = (cache = false) => {
28461
- if (!this.runBefore("getTable"))
28496
+ if (!this.runBefore("api", { name: "getRecycleTable" }))
28497
+ return;
28498
+ if (!this.runBefore("getRecycleTable"))
28462
28499
  return;
28463
28500
  this.recycleTable.columnLoading = true;
28464
28501
  if (cache) {
@@ -28567,6 +28604,8 @@
28567
28604
  if (!data.row || !data.field.prop)
28568
28605
  return;
28569
28606
  if (Object.keys(data.row).length === 0) ;
28607
+ if (!this.runBefore("api", { name: "fieldChange" }))
28608
+ return;
28570
28609
  data.row.loading = true;
28571
28610
  this.api.postData("edit", {
28572
28611
  [this.table.pk]: data.row[this.table.pk],
@@ -28603,6 +28642,8 @@
28603
28642
  };
28604
28643
  // 删除
28605
28644
  postDel = (ids) => {
28645
+ if (!this.runBefore("api", { name: "postDel" }))
28646
+ return;
28606
28647
  if (!this.runBefore("postDel", { ids }))
28607
28648
  return;
28608
28649
  this.api.del(ids).then((res) => {
@@ -28675,6 +28716,8 @@
28675
28716
  } else {
28676
28717
  this.form.edit_id = 0;
28677
28718
  }
28719
+ if (!this.runBefore("api", { name: "toggleForm" }))
28720
+ return;
28678
28721
  this.api.form(this.form.edit_id).then((res) => {
28679
28722
  this.form.ref.setFormData(res.data);
28680
28723
  this.form.ref.show();
@@ -29826,7 +29869,6 @@
29826
29869
  } else if (fieldDataTemp.render == "time" && (fieldDataTemp.operator == "RANGE" || fieldDataTemp.operator == "NOT RANGE")) {
29827
29870
  if (DkTable.comSearch.form[key] && DkTable.comSearch.form[key].length >= 2) {
29828
29871
  val = DkTable.comSearch.form[key][0] + "," + DkTable.comSearch.form[key][1];
29829
- console.log("val", val, DkTable.comSearch.form[key]);
29830
29872
  }
29831
29873
  } else if (fieldDataTemp.operator == "RANGE" || fieldDataTemp.operator == "NOT RANGE") {
29832
29874
  if (!DkTable.comSearch.form[key + "-start"] && !DkTable.comSearch.form[key + "-end"]) {
@@ -29845,7 +29887,6 @@
29845
29887
  });
29846
29888
  }
29847
29889
  }
29848
- console.log("comSearchData", comSearchData);
29849
29890
  DkTable.onTableAction("com-search", comSearchData);
29850
29891
  };
29851
29892
  const onResetForm = () => {
@@ -30445,6 +30486,7 @@
30445
30486
  _: 1
30446
30487
  /* STABLE */
30447
30488
  })) : require$$0.createCommentVNode("v-if", true),
30489
+ require$$0.renderSlot(_ctx.$slots, "AddButtonAppend"),
30448
30490
  props.buttons.includes("export_csv") && require$$0.unref(DkTable).auth("export_csv") ? (require$$0.openBlock(), require$$0.createBlock(_component_el_tooltip, {
30449
30491
  key: 2,
30450
30492
  content: "\u5BFC\u51FA\u9009\u4E2D\u884C",
@@ -30470,6 +30512,7 @@
30470
30512
  _: 1
30471
30513
  /* STABLE */
30472
30514
  })) : require$$0.createCommentVNode("v-if", true),
30515
+ require$$0.renderSlot(_ctx.$slots, "ExportButtonAppend"),
30473
30516
  props.buttons.includes("edit") && require$$0.unref(DkTable).auth("edit") ? (require$$0.openBlock(), require$$0.createBlock(_component_el_tooltip, {
30474
30517
  key: 3,
30475
30518
  content: "\u7F16\u8F91\u9009\u4E2D\u884C",
@@ -30495,6 +30538,7 @@
30495
30538
  _: 1
30496
30539
  /* STABLE */
30497
30540
  })) : require$$0.createCommentVNode("v-if", true),
30541
+ require$$0.renderSlot(_ctx.$slots, "EditButtonAppend"),
30498
30542
  props.buttons.includes("delete") && require$$0.unref(DkTable).auth("del") ? (require$$0.openBlock(), require$$0.createBlock(_component_el_popconfirm, {
30499
30543
  key: 4,
30500
30544
  "confirm-button-text": "\u5220\u9664",
@@ -30535,6 +30579,7 @@
30535
30579
  _: 1
30536
30580
  /* STABLE */
30537
30581
  }, 8, ["disabled"])) : require$$0.createCommentVNode("v-if", true),
30582
+ require$$0.renderSlot(_ctx.$slots, "DeleteButtonAppend"),
30538
30583
  props.buttons.includes("unfold") ? (require$$0.openBlock(), require$$0.createBlock(_component_el_tooltip, {
30539
30584
  key: 5,
30540
30585
  content: (require$$0.unref(DkTable).table.expandAll ? "\u6536\u7F29" : "\u5C55\u5F00") + "\u6240\u6709\u5B50\u83DC\u5355",
@@ -30566,6 +30611,7 @@
30566
30611
  _: 1
30567
30612
  /* STABLE */
30568
30613
  }, 8, ["content"])) : require$$0.createCommentVNode("v-if", true),
30614
+ require$$0.renderSlot(_ctx.$slots, "UnfoldButtonAppend"),
30569
30615
  props.buttons.includes("recycle") && require$$0.unref(DkTable).auth("recycle") ? (require$$0.openBlock(), require$$0.createBlock(_component_el_tooltip, {
30570
30616
  key: 6,
30571
30617
  content: "\u6253\u5F00\u56DE\u6536\u7AD9",
@@ -30590,6 +30636,7 @@
30590
30636
  _: 1
30591
30637
  /* STABLE */
30592
30638
  })) : require$$0.createCommentVNode("v-if", true),
30639
+ require$$0.renderSlot(_ctx.$slots, "RecycleButtonAppend"),
30593
30640
  require$$0.createElementVNode("div", _hoisted_9$2, [
30594
30641
  require$$0.createElementVNode("div", _hoisted_10$1, [
30595
30642
  require$$0.createVNode(_component_el_input, {
@@ -31451,6 +31498,9 @@
31451
31498
  DkTable.table.ref = TableRef.value;
31452
31499
  DkTable.form.ref = FormRef.value;
31453
31500
  });
31501
+ const effectiveButtons = require$$0.computed(() => {
31502
+ return [...new Set(props.buttons.filter((button) => !props.hideButtons.includes(button)))];
31503
+ });
31454
31504
  const onTableSizeChange = (val) => {
31455
31505
  DkTable.onTableAction("page-size-change", { size: val });
31456
31506
  };
@@ -31556,7 +31606,7 @@
31556
31606
  require$$0.createCommentVNode("\u9876\u90E8\u83DC\u5355"),
31557
31607
  require$$0.createVNode(DkTableHeader, {
31558
31608
  size: "default",
31559
- buttons: _ctx.buttons
31609
+ buttons: effectiveButtons.value
31560
31610
  }, require$$0.createSlots({
31561
31611
  _: 2
31562
31612
  /* DYNAMIC */