qidian-vue-ui 2.0.45 → 2.0.46

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.
@@ -1,40 +1,40 @@
1
- .qd-crud-table[data-v-336e27b9] {
1
+ .qd-crud-table[data-v-caa57b85] {
2
2
  width: 100%;
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  }
6
- .qd-crud-table > .qd-crud-search:not(.qd-crud-search--hide) + .qd-crud-table__body[data-v-336e27b9] {
6
+ .qd-crud-table > .qd-crud-search:not(.qd-crud-search--hide) + .qd-crud-table__body[data-v-caa57b85] {
7
7
  margin-top: var(--td-comp-margin-l);
8
8
  }
9
- .qd-crud-table__body[data-v-336e27b9] > .t-loading__parent > .t-card__body {
9
+ .qd-crud-table__body[data-v-caa57b85] > .t-loading__parent > .t-card__body {
10
10
  display: flex;
11
11
  flex-direction: column;
12
12
  }
13
- .qd-crud-table__body[data-v-336e27b9] > .t-loading__parent > .t-card__body > .qd-service-table .t-table__pagination {
13
+ .qd-crud-table__body[data-v-caa57b85] > .t-loading__parent > .t-card__body > .qd-service-table .t-table__pagination {
14
14
  padding-bottom: 0;
15
15
  }
16
- .qd-crud-table--fit-parent-height[data-v-336e27b9] {
16
+ .qd-crud-table--fit-parent-height[data-v-caa57b85] {
17
17
  height: 100%;
18
18
  }
19
- .qd-crud-table--fit-parent-height > .qd-crud-table__body[data-v-336e27b9] {
19
+ .qd-crud-table--fit-parent-height > .qd-crud-table__body[data-v-caa57b85] {
20
20
  flex: auto;
21
21
  }
22
- .qd-crud-table--fit-parent-height > .qd-crud-table__body[data-v-336e27b9] > .t-loading__parent > .t-card__body {
22
+ .qd-crud-table--fit-parent-height > .qd-crud-table__body[data-v-caa57b85] > .t-loading__parent > .t-card__body {
23
23
  height: 100%;
24
24
  min-height: 443px;
25
25
  }
26
- .qd-crud-table--fit-parent-height > .qd-crud-table__body[data-v-336e27b9] > .t-loading__parent > .t-card__body > .qd-service-table {
26
+ .qd-crud-table--fit-parent-height > .qd-crud-table__body[data-v-caa57b85] > .t-loading__parent > .t-card__body > .qd-service-table {
27
27
  flex: 1 1 0;
28
28
  overflow: hidden;
29
29
  }
30
- .qd-crud-table__toolbar[data-v-336e27b9] {
30
+ .qd-crud-table__toolbar[data-v-caa57b85] {
31
31
  display: flex;
32
32
  justify-content: space-between;
33
33
  }
34
- .qd-crud-table__toolbar--has-space-item + .qd-service-table[data-v-336e27b9] {
34
+ .qd-crud-table__toolbar--has-space-item + .qd-service-table[data-v-caa57b85] {
35
35
  margin-top: var(--td-comp-margin-l);
36
36
  }
37
- .qd-crud-table__toolbar-separator[data-v-336e27b9] {
37
+ .qd-crud-table__toolbar-separator[data-v-caa57b85] {
38
38
  display: inline-block;
39
39
  padding-left: var(--td-comp-paddingLR-s);
40
40
  }
@@ -2,7 +2,7 @@ import './index.css'
2
2
  import _sfc_main from "./index.vue2.mjs";
3
3
  /* empty css */
4
4
  import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
5
- const QdCrudTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-336e27b9"]]);
5
+ const QdCrudTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-caa57b85"]]);
6
6
  export {
7
7
  QdCrudTable as default
8
8
  };
@@ -731,10 +731,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
731
731
  if (currentOptions === false) return;
732
732
  const mergeOptions = merge({}, defaultOptions, currentOptions);
733
733
  if (mergeOptions.crudMode !== "view" && !currentOptions) return;
734
+ if (typeof currentOptions === "object" && currentOptions.component) {
735
+ mergeOptions.component = currentOptions.component;
736
+ }
734
737
  mergeOptions.permi = buildActionPermi(mergeOptions);
735
738
  if (mergeOptions.crudMode !== "del") {
736
739
  const form = buildActionForm(mergeOptions, crudForm);
737
- if (!form && !mergeOptions.onClick) return;
740
+ if (!form && !mergeOptions.onClick && !mergeOptions.component) return;
738
741
  mergeOptions.form = form;
739
742
  }
740
743
  return mergeOptions;
@@ -985,6 +988,55 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
985
988
  return false;
986
989
  }
987
990
  }
991
+ function buildActionComponent(action, defaultComponent, originalParams) {
992
+ const {
993
+ component,
994
+ ...actionProps
995
+ } = action;
996
+ const onClick = buildActionOnClick(action, originalParams);
997
+ const disabled = defaultComponent === Button ? buildActionDisabled(action) : action.disabled;
998
+ const ifRender = "ifRender" in action ? action.ifRender : void 0;
999
+ if (!component) {
1000
+ return {
1001
+ is: defaultComponent,
1002
+ ...actionProps,
1003
+ form: defaultComponent === Button ? void 0 : action.form,
1004
+ onClick,
1005
+ disabled
1006
+ };
1007
+ }
1008
+ return {
1009
+ ...component,
1010
+ ifRender: component.ifRender ?? ifRender,
1011
+ onClick: component.onClick ?? onClick,
1012
+ disabled: component.disabled ?? disabled
1013
+ };
1014
+ }
1015
+ function buildToolComponent(tool) {
1016
+ const {
1017
+ component,
1018
+ ...toolProps
1019
+ } = tool;
1020
+ const action = tool;
1021
+ const onClick = buildActionOnClick(action);
1022
+ const disabled = buildActionDisabled(action);
1023
+ if (!component) {
1024
+ return {
1025
+ is: Button,
1026
+ ...toolProps,
1027
+ content: "",
1028
+ variant: "text",
1029
+ shape: "square",
1030
+ onClick,
1031
+ disabled
1032
+ };
1033
+ }
1034
+ return {
1035
+ ...component,
1036
+ onClick: component.onClick ?? onClick,
1037
+ disabled: component.disabled ?? disabled
1038
+ };
1039
+ }
988
1040
  async function getDetail(action, params) {
989
1041
  const {
990
1042
  detailOptions
@@ -1135,13 +1187,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1135
1187
  }) ? (openBlock(), createElementBlock("span", _hoisted_1)) : createCommentVNode("", true), withDirectives(createVNode(unref(_sfc_main$1), {
1136
1188
  "fn-inject-ctx": "",
1137
1189
  context: getConfigRendererCtx(item),
1138
- config: {
1139
- is: unref(Button),
1140
- ...item,
1141
- form: void 0,
1142
- onClick: buildActionOnClick(item),
1143
- disabled: buildActionDisabled(item)
1144
- },
1190
+ config: buildActionComponent(item, unref(Button)),
1145
1191
  onIfRenderChange: (ifRender) => setActionIfRender(ifRender, item, {
1146
1192
  index
1147
1193
  })
@@ -1165,15 +1211,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1165
1211
  default: withCtx(() => [withDirectives(createVNode(unref(_sfc_main$1), {
1166
1212
  "fn-inject-ctx": "",
1167
1213
  context: getConfigRendererCtx(item),
1168
- config: {
1169
- is: unref(Button),
1170
- ...item,
1171
- content: "",
1172
- variant: "text",
1173
- shape: "square",
1174
- onClick: buildActionOnClick(item),
1175
- disabled: buildActionDisabled(item)
1176
- },
1214
+ config: buildToolComponent(item),
1177
1215
  onIfRenderChange: (ifRender) => setActionIfRender(ifRender, item, {
1178
1216
  index,
1179
1217
  mapKey: "tool"
@@ -1292,11 +1330,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1292
1330
  key: `${slotProps.colIndex}.${slotProps.rowIndex}.${index}.renderer`,
1293
1331
  "fn-inject-ctx": "",
1294
1332
  context: getConfigRendererCtx(item, slotProps),
1295
- config: {
1296
- is: unref(Link),
1297
- ...item,
1298
- onClick: buildActionOnClick(item, slotProps)
1299
- },
1333
+ config: buildActionComponent(item, unref(Link), slotProps),
1300
1334
  onIfRenderChange: (ifRender) => setActionIfRender(ifRender, item, {
1301
1335
  colIndex: slotProps.colIndex,
1302
1336
  rowIndex: slotProps.rowIndex,
@@ -34,6 +34,7 @@ export interface QdCrudTableAction<D extends TableRowData = TableRowData, R = un
34
34
  uid?: string;
35
35
  permiID?: string;
36
36
  permi?: string[];
37
+ component?: QdComponentConfig;
37
38
  selectType?: QdServiceTableProps['selectType'];
38
39
  onClick?: (context: QdCrudTableActionContext<D> & Partial<PrimaryTableCellParams<D>>, e: MouseEvent) => void | Promise<void>;
39
40
  }
@@ -41,6 +42,7 @@ export interface QdCrudTableRowAction<D extends TableRowData = TableRowData, R =
41
42
  uid?: string;
42
43
  permiID?: string;
43
44
  permi?: string[];
45
+ component?: QdComponentConfig;
44
46
  selectType?: QdServiceTableProps['selectType'];
45
47
  detail?: QdCrudDetail;
46
48
  onClick?: (context: QdCrudTableActionContext<D> & PrimaryTableCellParams<D>, e: MouseEvent) => void | Promise<void>;
@@ -62,6 +64,7 @@ export interface QdCrudTableToolContext<D extends TableRowData = TableRowData> {
62
64
  export interface QdCrudTableTool<D extends TableRowData = TableRowData> {
63
65
  content?: string;
64
66
  icon?: TNode;
67
+ component?: QdComponentConfig;
65
68
  permiID?: string;
66
69
  permi?: string[];
67
70
  disabled?: boolean | ((ctx: QdCrudTableToolContext<D>) => boolean);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qidian-vue-ui",
3
- "version": "2.0.45",
3
+ "version": "2.0.46",
4
4
  "description": "基于 TDesign 的 QiDian Vue UI 组件库",
5
5
  "author": "qidian",
6
6
  "license": "MIT",