qidian-vue-ui 2.0.65 → 2.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.
@@ -1,40 +1,40 @@
1
- .qd-crud-table[data-v-cf0c0269] {
1
+ .qd-crud-table[data-v-38df8d6e] {
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-cf0c0269] {
6
+ .qd-crud-table > .qd-crud-search:not(.qd-crud-search--hide) + .qd-crud-table__body[data-v-38df8d6e] {
7
7
  margin-top: var(--td-comp-margin-l);
8
8
  }
9
- .qd-crud-table__body[data-v-cf0c0269] > .t-loading__parent > .t-card__body {
9
+ .qd-crud-table__body[data-v-38df8d6e] > .t-loading__parent > .t-card__body {
10
10
  display: flex;
11
11
  flex-direction: column;
12
12
  }
13
- .qd-crud-table__body[data-v-cf0c0269] > .t-loading__parent > .t-card__body > .qd-service-table .t-table__pagination {
13
+ .qd-crud-table__body[data-v-38df8d6e] > .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-cf0c0269] {
16
+ .qd-crud-table--fit-parent-height[data-v-38df8d6e] {
17
17
  height: 100%;
18
18
  }
19
- .qd-crud-table--fit-parent-height > .qd-crud-table__body[data-v-cf0c0269] {
19
+ .qd-crud-table--fit-parent-height > .qd-crud-table__body[data-v-38df8d6e] {
20
20
  flex: auto;
21
21
  }
22
- .qd-crud-table--fit-parent-height > .qd-crud-table__body[data-v-cf0c0269] > .t-loading__parent > .t-card__body {
22
+ .qd-crud-table--fit-parent-height > .qd-crud-table__body[data-v-38df8d6e] > .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-cf0c0269] > .t-loading__parent > .t-card__body > .qd-service-table {
26
+ .qd-crud-table--fit-parent-height > .qd-crud-table__body[data-v-38df8d6e] > .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-cf0c0269] {
30
+ .qd-crud-table__toolbar[data-v-38df8d6e] {
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-cf0c0269] {
34
+ .qd-crud-table__toolbar--has-space-item + .qd-service-table[data-v-38df8d6e] {
35
35
  margin-top: var(--td-comp-margin-l);
36
36
  }
37
- .qd-crud-table__toolbar-separator[data-v-cf0c0269] {
37
+ .qd-crud-table__toolbar-separator[data-v-38df8d6e] {
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-cf0c0269"]]);
5
+ const QdCrudTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-38df8d6e"]]);
6
6
  export {
7
7
  QdCrudTable as default
8
8
  };
@@ -18,8 +18,8 @@ import { hasPermiDirective } from "../../../directive/hasPermi.mjs";
18
18
  import _sfc_main$2 from "../../dialog/form.vue.mjs";
19
19
  import QdColumnsController from "../../columns-controller/index.vue.mjs";
20
20
  import get from "../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/get.mjs";
21
- import QdServiceTable from "../../service/table/index.vue.mjs";
22
21
  import { hasPermiOr } from "../../../utils/auth.mjs";
22
+ import QdServiceTable from "../../service/table/index.vue.mjs";
23
23
  const _hoisted_1 = {
24
24
  key: 0,
25
25
  class: "qd-crud-table__toolbar-separator"
@@ -412,12 +412,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
412
412
  const {
413
413
  t
414
414
  } = useConfig("crud");
415
+ const {
416
+ global: tableGlobalConfig
417
+ } = useConfig("table");
415
418
  const {
416
419
  msgError,
417
420
  msgSuccess,
418
421
  alertWarning,
419
422
  confirm
420
423
  } = useModal();
424
+ const SIZE_FONT_MAP = {
425
+ large: 16,
426
+ medium: 14,
427
+ small: 14,
428
+ mini: 12
429
+ };
430
+ const SIZE_PADDING_MAP = {
431
+ large: 40,
432
+ medium: 32,
433
+ small: 16,
434
+ mini: 12
435
+ };
421
436
  const treeIsExpand = computed(() => !!expandedTreeNodes.value?.length);
422
437
  const dialogFormMap = reactive({});
423
438
  const ifRenderMap = reactive({});
@@ -425,7 +440,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
425
440
  const shouldValidateInitialSearch = computed(() => !!props.service && props.manual !== true && !!props.search?.items?.length);
426
441
  const reProps = computed(() => {
427
442
  const {
428
- data: data2,
443
+ data: propsData,
429
444
  searchData: inSearchData,
430
445
  selectedRowKeys: selectedRowKeys2,
431
446
  activeRowKeys: activeRowKeys2,
@@ -524,13 +539,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
524
539
  }
525
540
  const operationLength = reRowActions.length;
526
541
  if (operationLength) {
542
+ const operationSize = serviceTableOptions.size ?? tableGlobalConfig.value?.size ?? "medium";
527
543
  const operationIdx = reColumns.findIndex((item) => item.colKey === "operation");
528
544
  const defaultOperation = {
529
545
  title: t("operationText"),
530
546
  colKey: "operation",
531
547
  align: "center",
532
548
  fixed: "right",
533
- width: 28 * operationLength + 25 * operationLength - 1 + 32
549
+ width: calcOperationWidth(reRowActions, data.value, operationSize)
534
550
  };
535
551
  if (operationIdx > -1) {
536
552
  reColumns[operationIdx] = {
@@ -579,7 +595,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
579
595
  rowActions: reRowActions,
580
596
  tools: reTools,
581
597
  models: {
582
- data: data2,
598
+ data: propsData,
583
599
  searchData: inSearchData,
584
600
  selectedRowKeys: selectedRowKeys2,
585
601
  activeRowKeys: activeRowKeys2,
@@ -740,6 +756,61 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
740
756
  if (!hasChanged) return;
741
757
  mergeColumns.value = newColumns;
742
758
  };
759
+ function calcTextWidth(text, fontSize) {
760
+ return [...text].reduce((width, char) => {
761
+ if (char.charCodeAt(0) > 255) return width + fontSize;
762
+ return width + Math.round(fontSize * (/[A-Z]/.test(char) ? 0.79 : 0.57));
763
+ }, 0);
764
+ }
765
+ function getActionWidth(action, row, fontSize = 14) {
766
+ if (action.component) return Math.round(fontSize * 2);
767
+ let iconWidth = 0;
768
+ if (action.prefixIcon) {
769
+ const icon = action.prefixIcon?.__qdCompute && row !== void 0 ? action.prefixIcon(getConfigRendererCtx(action, {
770
+ row
771
+ }), void 0) : action.prefixIcon;
772
+ iconWidth = icon ? Math.round(fontSize * 1.43) : 0;
773
+ }
774
+ const {
775
+ content
776
+ } = action;
777
+ if (typeof content === "string") return calcTextWidth(content, fontSize) + iconWidth;
778
+ if (row !== void 0 && content?.__qdCompute) {
779
+ const text = content(getConfigRendererCtx(action, {
780
+ row
781
+ }), void 0);
782
+ return typeof text === "string" ? calcTextWidth(text, fontSize) + iconWidth : Math.round(fontSize * 2) + iconWidth;
783
+ }
784
+ return content === void 0 && !iconWidth ? 0 : Math.round(fontSize * 1.14);
785
+ }
786
+ function isActionVisible(action, row) {
787
+ if (!hasPermiOr(action.permi, false)) return false;
788
+ const {
789
+ ifRender
790
+ } = action;
791
+ if (ifRender?.__qdCompute) {
792
+ return ifRender(getConfigRendererCtx(action, {
793
+ row
794
+ }), void 0) !== false;
795
+ }
796
+ return ifRender !== false;
797
+ }
798
+ function calcOperationWidth(rowActions, rows, size = "medium") {
799
+ const permittedActions = rowActions.filter((action) => hasPermiOr(action.permi, false));
800
+ if (!permittedActions.length) return 0;
801
+ const fontSize = SIZE_FONT_MAP[size] ?? 14;
802
+ const cellPadding = SIZE_PADDING_MAP[size] ?? 32;
803
+ const sumWidth = (actions, row) => actions.reduce((width, action) => width + getActionWidth(action, row, fontSize), 0) + (actions.length - 1) * 25 + cellPadding + 5;
804
+ if (!rows?.length) {
805
+ return sumWidth(permittedActions);
806
+ }
807
+ let maxWidth = 0;
808
+ for (const row of rows) {
809
+ const visibleActions = permittedActions.filter((action) => isActionVisible(action, row));
810
+ maxWidth = Math.max(maxWidth, sumWidth(visibleActions, row));
811
+ }
812
+ return maxWidth;
813
+ }
743
814
  function buildActions(actions, crudForm) {
744
815
  if (!actions) return [];
745
816
  return actions.map((item) => mergeAction({
@@ -1,103 +1,103 @@
1
- .qd-service-table[data-v-bb8ca5b9] {
1
+ .qd-service-table[data-v-645038b1] {
2
2
  height: 100%;
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  }
6
- .qd-service-table[data-v-bb8ca5b9] > .t-table__content {
6
+ .qd-service-table[data-v-645038b1] > .t-table__content {
7
7
  flex: 1;
8
8
  }
9
- .qd-service-table--mini[data-v-bb8ca5b9] {
9
+ .qd-service-table--mini[data-v-645038b1] {
10
10
  font: var(--td-font-body-small);
11
11
  }
12
- .qd-service-table--mini[data-v-bb8ca5b9] th,
13
- .qd-service-table--mini[data-v-bb8ca5b9] tr:not(.t-table__expanded-row) > td {
12
+ .qd-service-table--mini[data-v-645038b1] th,
13
+ .qd-service-table--mini[data-v-645038b1] tr:not(.t-table__expanded-row) > td {
14
14
  padding: var(--td-comp-paddingTB-xxs) var(--td-comp-paddingLR-xxs);
15
15
  line-height: var(--td-line-height-body-small);
16
16
  }
17
- .qd-service-table--mini[data-v-bb8ca5b9] .t-table__row-full-element {
17
+ .qd-service-table--mini[data-v-645038b1] .t-table__row-full-element {
18
18
  padding: var(--td-comp-paddingTB-xs) var(--td-comp-paddingLR-s);
19
19
  }
20
- .qd-service-table--hide-empty-image[data-v-bb8ca5b9] .t-table__empty {
20
+ .qd-service-table--hide-empty-image[data-v-645038b1] .t-table__empty {
21
21
  min-height: auto;
22
22
  }
23
- .qd-service-table--hide-empty-image[data-v-bb8ca5b9] .t-table__empty .t-empty {
23
+ .qd-service-table--hide-empty-image[data-v-645038b1] .t-table__empty .t-empty {
24
24
  padding: 0 !important;
25
25
  }
26
- .qd-service-table--hide-empty-image[data-v-bb8ca5b9] .t-table__empty .t-empty__image {
26
+ .qd-service-table--hide-empty-image[data-v-645038b1] .t-table__empty .t-empty__image {
27
27
  display: none;
28
28
  }
29
- .qd-service-table--hide-empty-image[data-v-bb8ca5b9] .t-table__empty .t-empty__title {
29
+ .qd-service-table--hide-empty-image[data-v-645038b1] .t-table__empty .t-empty__title {
30
30
  margin-top: 0;
31
31
  }
32
- .qd-service-table[data-v-bb8ca5b9] .t-table__tree-col:not(:has(.t-table__tree-op-icon)) {
32
+ .qd-service-table[data-v-645038b1] .t-table__tree-col:not(:has(.t-table__tree-op-icon)) {
33
33
  margin-left: calc(var(--td-font-size-body-large) + var(--td-comp-margin-s));
34
34
  }
35
- .qd-service-table[data-v-bb8ca5b9] .t-table__tree-leaf-node .t-table__tree-op-icon:empty {
35
+ .qd-service-table[data-v-645038b1] .t-table__tree-leaf-node .t-table__tree-op-icon:empty {
36
36
  width: calc(var(--td-font-size-body-large) + var(--td-comp-margin-s));
37
37
  }
38
- .qd-service-table[data-v-bb8ca5b9] .t-affix > .t-table__affixed-header-elm-wrap,
39
- .qd-service-table[data-v-bb8ca5b9] .t-affix > .t-table__scrollbar--obvious {
40
- transform: var(--f9e71248);
38
+ .qd-service-table[data-v-645038b1] .t-affix > .t-table__affixed-header-elm-wrap,
39
+ .qd-service-table[data-v-645038b1] .t-affix > .t-table__scrollbar--obvious {
40
+ transform: var(--bd3cad9a);
41
41
  }
42
- .qd-service-table--horizontal-bar-static[data-v-bb8ca5b9] .t-table__scrollbar--obvious {
42
+ .qd-service-table--horizontal-bar-static[data-v-645038b1] .t-table__scrollbar--obvious {
43
43
  visibility: hidden;
44
44
  pointer-events: none;
45
45
  }
46
- .qd-service-table--horizontal-bar-static[data-v-bb8ca5b9] > div:has(> div > .t-table__scrollbar--obvious) {
46
+ .qd-service-table--horizontal-bar-static[data-v-645038b1] > div:has(> div > .t-table__scrollbar--obvious) {
47
47
  height: 0;
48
48
  margin-top: 0 !important;
49
49
  overflow: hidden;
50
50
  }
51
- .qd-service-table[data-v-bb8ca5b9] .t-table__expanded-row .qd-service-table--horizontal-bar-static > div:has(> div > .t-table__scrollbar--obvious) {
51
+ .qd-service-table[data-v-645038b1] .t-table__expanded-row .qd-service-table--horizontal-bar-static > div:has(> div > .t-table__scrollbar--obvious) {
52
52
  display: none;
53
53
  }
54
- .qd-service-table[data-v-bb8ca5b9] .t-table__expanded-row > td {
54
+ .qd-service-table[data-v-645038b1] .t-table__expanded-row > td {
55
55
  height: 0;
56
56
  }
57
- .qd-service-table[data-v-bb8ca5b9] .t-table__affixed-header-elm-wrap {
57
+ .qd-service-table[data-v-645038b1] .t-table__affixed-header-elm-wrap {
58
58
  height: auto !important;
59
59
  }
60
- .qd-service-table[data-v-bb8ca5b9] .t-table__affixed-header-elm {
60
+ .qd-service-table[data-v-645038b1] .t-table__affixed-header-elm {
61
61
  position: relative;
62
62
  scrollbar-width: none;
63
63
  }
64
- .qd-service-table[data-v-bb8ca5b9] .t-table__affixed-header-elm::-webkit-scrollbar {
64
+ .qd-service-table[data-v-645038b1] .t-table__affixed-header-elm::-webkit-scrollbar {
65
65
  display: none;
66
66
  width: 0;
67
67
  height: 0;
68
68
  }
69
- .qd-service-table[data-v-bb8ca5b9] .t-table__virtual-scroll-cursor + table {
69
+ .qd-service-table[data-v-645038b1] .t-table__virtual-scroll-cursor + table {
70
70
  border-collapse: separate;
71
71
  }
72
- .qd-service-table[data-v-bb8ca5b9] .t-table__expanded-row-inner,
73
- .qd-service-table[data-v-bb8ca5b9] .t-table__row-filter-inner {
72
+ .qd-service-table[data-v-645038b1] .t-table__expanded-row-inner,
73
+ .qd-service-table[data-v-645038b1] .t-table__row-filter-inner {
74
74
  display: block;
75
75
  position: sticky;
76
76
  left: 0;
77
- width: var(--v88d7fa5e) !important;
77
+ width: var(--v44f78268) !important;
78
78
  }
79
- .qd-service-table[data-v-bb8ca5b9] .t-table__cell-wrap > .t-form__controls > .t-form__controls-content > *:not(.t-switch):not(.t-tag):not(.t-icon):not(.qd-file-icon) {
79
+ .qd-service-table[data-v-645038b1] .t-table__cell-wrap > .t-form__controls > .t-form__controls-content > *:not(.t-switch):not(.t-tag):not(.t-icon):not(.qd-file-icon) {
80
80
  width: 100%;
81
81
  }
82
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table__non-editable-col {
82
+ .qd-service-table[data-v-645038b1] .qd-service-table__non-editable-col {
83
83
  background-color: color-mix(in srgb, var(--td-bg-color-component) 50%, transparent);
84
84
  }
85
- .qd-service-table[data-v-bb8ca5b9] td.qd-service-table__selected-cell {
85
+ .qd-service-table[data-v-645038b1] td.qd-service-table__selected-cell {
86
86
  box-shadow: inset 0 1px 0 0 var(--qst-sel-t, transparent), inset 0 -1px 0 0 var(--qst-sel-b, transparent), inset 1px 0 0 0 var(--qst-sel-l, transparent), inset -1px 0 0 0 var(--qst-sel-r, transparent);
87
87
  }
88
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table__selected-bt {
88
+ .qd-service-table[data-v-645038b1] .qd-service-table__selected-bt {
89
89
  --qst-sel-t: var(--td-brand-color);
90
90
  }
91
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table__selected-bb {
91
+ .qd-service-table[data-v-645038b1] .qd-service-table__selected-bb {
92
92
  --qst-sel-b: var(--td-brand-color);
93
93
  }
94
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table__selected-bl {
94
+ .qd-service-table[data-v-645038b1] .qd-service-table__selected-bl {
95
95
  --qst-sel-l: var(--td-brand-color);
96
96
  }
97
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table__selected-br {
97
+ .qd-service-table[data-v-645038b1] .qd-service-table__selected-br {
98
98
  --qst-sel-r: var(--td-brand-color);
99
99
  }
100
- .qd-service-table[data-v-bb8ca5b9] td.qd-service-table__copied-cell {
100
+ .qd-service-table[data-v-645038b1] td.qd-service-table__copied-cell {
101
101
  background-image: var(--qst-copy-t, none), var(--qst-copy-b, none), var(--qst-copy-l, none), var(--qst-copy-r, none);
102
102
  background-size: 8px 1px,
103
103
  8px 1px,
@@ -108,134 +108,134 @@
108
108
  0 0,
109
109
  100% 0;
110
110
  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
111
- animation: qst-cell-ants-bb8ca5b9 0.5s linear infinite;
111
+ animation: qst-cell-ants-645038b1 0.5s linear infinite;
112
112
  }
113
- .qd-service-table[data-v-bb8ca5b9] td.qd-service-table__copied-cell.qd-service-table__selected-cell {
113
+ .qd-service-table[data-v-645038b1] td.qd-service-table__copied-cell.qd-service-table__selected-cell {
114
114
  background-size: 8px 2px,
115
115
  8px 2px,
116
116
  2px 8px,
117
117
  2px 8px;
118
118
  }
119
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table__copied-bt {
119
+ .qd-service-table[data-v-645038b1] .qd-service-table__copied-bt {
120
120
  --qst-copy-t: linear-gradient(90deg, var(--td-brand-color-hover) 50%, transparent 0);
121
121
  }
122
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table__copied-bb {
122
+ .qd-service-table[data-v-645038b1] .qd-service-table__copied-bb {
123
123
  --qst-copy-b: linear-gradient(90deg, var(--td-brand-color-hover) 50%, transparent 0);
124
124
  }
125
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table__copied-bl {
125
+ .qd-service-table[data-v-645038b1] .qd-service-table__copied-bl {
126
126
  --qst-copy-l: linear-gradient(0deg, var(--td-brand-color-hover) 50%, transparent 0);
127
127
  }
128
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table__copied-br {
128
+ .qd-service-table[data-v-645038b1] .qd-service-table__copied-br {
129
129
  --qst-copy-r: linear-gradient(0deg, var(--td-brand-color-hover) 50%, transparent 0);
130
130
  }
131
- .qd-service-table[data-v-bb8ca5b9] tbody > tr.t-table__row--active {
131
+ .qd-service-table[data-v-645038b1] tbody > tr.t-table__row--active {
132
132
  background-color: var(--td-brand-color-light);
133
133
  }
134
- .qd-service-table[data-v-bb8ca5b9] tbody > tr.t-table__row--active.t-table__row--hover,
135
- .qd-service-table[data-v-bb8ca5b9] tbody > tr.t-table__row--active:hover {
134
+ .qd-service-table[data-v-645038b1] tbody > tr.t-table__row--active.t-table__row--hover,
135
+ .qd-service-table[data-v-645038b1] tbody > tr.t-table__row--active:hover {
136
136
  background-color: var(--td-brand-color-light-hover);
137
137
  }
138
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table__non-editable-col:not(.qd-service-table__copied-cell):is(
138
+ .qd-service-table[data-v-645038b1] .qd-service-table__non-editable-col:not(.qd-service-table__copied-cell):is(
139
139
  .t-table__cell--fixed-left,
140
140
  .t-table__cell--fixed-right
141
141
  ) {
142
142
  background-color: inherit;
143
143
  background-image: linear-gradient(color-mix(in srgb, var(--td-bg-color-secondarycontainer) 50%, transparent), color-mix(in srgb, var(--td-bg-color-secondarycontainer) 50%, transparent));
144
144
  }
145
- .qd-service-table--disable-horizontal-scroll[data-v-bb8ca5b9] colgroup > col {
145
+ .qd-service-table--disable-horizontal-scroll[data-v-645038b1] colgroup > col {
146
146
  width: auto !important;
147
147
  }
148
- .qd-service-table--cell-drag-selecting[data-v-bb8ca5b9] {
148
+ .qd-service-table--cell-drag-selecting[data-v-645038b1] {
149
149
  cursor: crosshair;
150
150
  }
151
- .qd-service-table--cell-drag-selecting[data-v-bb8ca5b9] td {
151
+ .qd-service-table--cell-drag-selecting[data-v-645038b1] td {
152
152
  cursor: crosshair;
153
153
  }
154
- .qd-service-table[data-v-bb8ca5b9] .t-table__filter-pop-content-inner {
154
+ .qd-service-table[data-v-645038b1] .t-table__filter-pop-content-inner {
155
155
  padding: var(--td-comp-paddingTB-s) var(--td-comp-paddingLR-s) 0;
156
156
  }
157
- .qd-service-table[data-v-bb8ca5b9] .t-table__filter-pop-content-inner:has(.qd-service-table-filter-item) {
157
+ .qd-service-table[data-v-645038b1] .t-table__filter-pop-content-inner:has(.qd-service-table-filter-item) {
158
158
  padding: 0;
159
159
  }
160
- .qd-service-table[data-v-bb8ca5b9] .t-table__filter-pop-content-inner:has(
160
+ .qd-service-table[data-v-645038b1] .t-table__filter-pop-content-inner:has(
161
161
  .qd-service-table-filter-input,
162
162
  .qd-service-table-filter-custom
163
163
  ) {
164
164
  padding-bottom: var(--td-comp-paddingTB-s);
165
165
  }
166
- .qd-service-table[data-v-bb8ca5b9] .t-table__filter--bottom-buttons {
166
+ .qd-service-table[data-v-645038b1] .t-table__filter--bottom-buttons {
167
167
  padding: var(--td-comp-paddingTB-s) var(--td-comp-paddingLR-s);
168
168
  }
169
- .qd-service-table--mini[data-v-bb8ca5b9] .t-table__filter-pop-content-inner {
169
+ .qd-service-table--mini[data-v-645038b1] .t-table__filter-pop-content-inner {
170
170
  padding: var(--td-comp-paddingTB-xs) var(--td-comp-paddingLR-xs) 0;
171
171
  }
172
- .qd-service-table--mini[data-v-bb8ca5b9] .t-table__filter--bottom-buttons {
172
+ .qd-service-table--mini[data-v-645038b1] .t-table__filter--bottom-buttons {
173
173
  padding: var(--td-comp-paddingTB-xs) var(--td-comp-paddingLR-xs);
174
174
  }
175
- .qd-service-table--mini[data-v-bb8ca5b9] .t-table__filter-pop-content-inner:has(.qd-service-table-filter-item) {
175
+ .qd-service-table--mini[data-v-645038b1] .t-table__filter-pop-content-inner:has(.qd-service-table-filter-item) {
176
176
  padding: 0;
177
177
  }
178
- .qd-service-table--mini[data-v-bb8ca5b9] .t-table__filter-pop-content-inner:has(
178
+ .qd-service-table--mini[data-v-645038b1] .t-table__filter-pop-content-inner:has(
179
179
  .qd-service-table-filter-input,
180
180
  .qd-service-table-filter-custom
181
181
  ) {
182
182
  padding-bottom: var(--td-comp-paddingTB-xs);
183
183
  }
184
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table-filter-item {
184
+ .qd-service-table[data-v-645038b1] .qd-service-table-filter-item {
185
185
  width: 266px;
186
186
  }
187
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table-filter-item__search,
188
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table-filter-item__all,
189
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table-filter-item__options {
187
+ .qd-service-table[data-v-645038b1] .qd-service-table-filter-item__search,
188
+ .qd-service-table[data-v-645038b1] .qd-service-table-filter-item__all,
189
+ .qd-service-table[data-v-645038b1] .qd-service-table-filter-item__options {
190
190
  padding: var(--td-comp-paddingTB-s) var(--td-comp-paddingLR-s) 0;
191
191
  }
192
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table-filter-item__all {
192
+ .qd-service-table[data-v-645038b1] .qd-service-table-filter-item__all {
193
193
  display: flex;
194
194
  align-items: center;
195
195
  padding: 0 var(--td-comp-paddingLR-s);
196
196
  border-bottom: 1px solid var(--td-component-stroke);
197
197
  }
198
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table-filter-item__options {
198
+ .qd-service-table[data-v-645038b1] .qd-service-table-filter-item__options {
199
199
  display: flex;
200
200
  flex-direction: column;
201
201
  height: 206px;
202
202
  padding: 0 var(--td-comp-paddingLR-s);
203
203
  overflow-y: auto;
204
204
  }
205
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table-filter-item__count {
205
+ .qd-service-table[data-v-645038b1] .qd-service-table-filter-item__count {
206
206
  margin-left: var(--td-comp-margin-xs);
207
207
  color: var(--td-text-color-placeholder);
208
208
  }
209
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table-filter-item__cell {
209
+ .qd-service-table[data-v-645038b1] .qd-service-table-filter-item__cell {
210
210
  pointer-events: none;
211
211
  }
212
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table-filter-item .t-checkbox,
213
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table-filter-item .t-radio {
212
+ .qd-service-table[data-v-645038b1] .qd-service-table-filter-item .t-checkbox,
213
+ .qd-service-table[data-v-645038b1] .qd-service-table-filter-item .t-radio {
214
214
  display: flex;
215
215
  align-items: center;
216
216
  }
217
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table-filter-item .t-checkbox__label,
218
- .qd-service-table[data-v-bb8ca5b9] .qd-service-table-filter-item .t-radio__label {
217
+ .qd-service-table[data-v-645038b1] .qd-service-table-filter-item .t-checkbox__label,
218
+ .qd-service-table[data-v-645038b1] .qd-service-table-filter-item .t-radio__label {
219
219
  display: inline-flex;
220
220
  flex: 1 1 0;
221
221
  align-items: center;
222
222
  min-width: 0;
223
223
  overflow: hidden;
224
224
  }
225
- .qd-service-table--mini[data-v-bb8ca5b9] .qd-service-table-filter-item__search {
225
+ .qd-service-table--mini[data-v-645038b1] .qd-service-table-filter-item__search {
226
226
  padding: var(--td-comp-paddingTB-xs) var(--td-comp-paddingLR-xs) 0;
227
227
  }
228
- .qd-service-table--mini[data-v-bb8ca5b9] .qd-service-table-filter-item__all,
229
- .qd-service-table--mini[data-v-bb8ca5b9] .qd-service-table-filter-item__options {
228
+ .qd-service-table--mini[data-v-645038b1] .qd-service-table-filter-item__all,
229
+ .qd-service-table--mini[data-v-645038b1] .qd-service-table-filter-item__options {
230
230
  padding: 0 var(--td-comp-paddingLR-xs);
231
231
  }
232
- @keyframes qst-cell-ants-bb8ca5b9 {
232
+ @keyframes qst-cell-ants-645038b1 {
233
233
  to {
234
234
  background-position: 8px 0, -8px 100%, 0 -8px, 100% 8px;
235
235
  }
236
236
  }
237
237
  @media (prefers-reduced-motion: reduce) {
238
- [data-v-bb8ca5b9] td.qd-service-table__copied-cell {
238
+ [data-v-645038b1] td.qd-service-table__copied-cell {
239
239
  animation: none;
240
240
  }
241
241
  }
@@ -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 QdServiceTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-bb8ca5b9"]]);
5
+ const QdServiceTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-645038b1"]]);
6
6
  export {
7
7
  QdServiceTable as default
8
8
  };
@@ -359,8 +359,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
359
359
  emit: __emit
360
360
  }) {
361
361
  useCssVars((_ctx) => ({
362
- "f9e71248": affixedHeaderTransform.value,
363
- "v88d7fa5e": expandedRowWidth.value
362
+ "bd3cad9a": affixedHeaderTransform.value,
363
+ "v44f78268": expandedRowWidth.value
364
364
  }));
365
365
  const props = __props;
366
366
  const emit = __emit;
@@ -440,6 +440,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
440
440
  const formItemColumns = computed(() => flattenFormItemColumns(props.columns || []));
441
441
  const editableColumns = computed(() => flattenEditableColumns(props.columns || []));
442
442
  const reCellSelectable = computed(() => props.cellSelectable ?? false);
443
+ const rowClickSelectsRows = computed(() => {
444
+ if (props.selectOnRowClick !== void 0) return props.selectOnRowClick;
445
+ if (props.onRowClick) return false;
446
+ return !props.expandOnRowClick && !props.tree?.expandTreeNodeOnClick;
447
+ });
443
448
  const parentAddBeforeSubmitQueue = inject(PROVIDE_FORM_ADD_BEFORE_SUBMIT_QUEUE, void 0);
444
449
  const beforeSubmitQueueMap = /* @__PURE__ */ new Map();
445
450
  const editingCellValidationVersions = /* @__PURE__ */ new Map();
@@ -653,7 +658,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
653
658
  loading: loading2,
654
659
  data: data2,
655
660
  selectedRowKeys: selectedRowKeys2,
656
- activeRowKeys: activeRowKeys2,
661
+ activeRowKeys: _activeRowKeys,
657
662
  columnControllerVisible: columnControllerVisible2,
658
663
  displayColumns: displayColumns2,
659
664
  expandedRowKeys: expandedRowKeys2,
@@ -696,6 +701,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
696
701
  const onValidate = reTableOptions.onValidate;
697
702
  const onRowValidate = reTableOptions.onRowValidate;
698
703
  const onFilterChange = reTableOptions.onFilterChange;
704
+ const onSelectChange = reTableOptions.onSelectChange;
705
+ reTableOptions.onSelectChange = (value, context) => {
706
+ if (props.activeRowType) activeRowKeys.value = [...value];
707
+ onSelectChange?.(value, context);
708
+ };
699
709
  reTableOptions.onValidate = (context) => {
700
710
  replaceTableValidationErrors(context.result);
701
711
  onValidate?.(context);
@@ -978,7 +988,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
978
988
  models: {
979
989
  data: data2,
980
990
  selectedRowKeys: selectedRowKeys2,
981
- activeRowKeys: activeRowKeys2,
991
+ activeRowKeys: _activeRowKeys,
982
992
  columnControllerVisible: columnControllerVisible2,
983
993
  displayColumns: displayColumns2,
984
994
  expandedRowKeys: expandedRowKeys2,
@@ -1359,7 +1369,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1359
1369
  checkableRowKeys.push(rowValue);
1360
1370
  }
1361
1371
  }
1362
- selectedRowKeys.value = checkableRowKeys;
1372
+ if (rowClickSelectsRows.value) selectedRowKeys.value = checkableRowKeys;
1363
1373
  if (props.activeRowType) activeRowKeys.value = rowKeys;
1364
1374
  }
1365
1375
  function pruneDisabledSelectedRows(newData) {
@@ -1378,6 +1388,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1378
1388
  return column.cellSelectable ?? String(column.colKey) !== "operation";
1379
1389
  }
1380
1390
  function emitRowSelectChange(clickedRow, type) {
1391
+ if (!rowClickSelectsRows.value) return;
1381
1392
  const rowKeys = [...selectedRowKeys.value];
1382
1393
  const selectedRowData = rowKeys.map((key) => data.value.find((row) => getRowValue(row) === key)).filter((row) => !!row);
1383
1394
  props.onSelectChange?.(rowKeys, {
@@ -1394,10 +1405,44 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1394
1405
  if (event?.metaKey || event?.ctrlKey) {
1395
1406
  const exists = selectedCells.value.some((item) => isSameEditingCell(item, cell));
1396
1407
  const rest = selectedCells.value.filter((item) => !isSameEditingCell(item, cell));
1397
- selectedCells.value = exists ? rest : [...rest, cell];
1398
- selectedCell.value = selectedCells.value.at(-1);
1408
+ const prevRows = new Set(selectedCells.value.map((item) => getRowValue(item.row)));
1409
+ const next = exists ? rest : [...rest, cell];
1410
+ const nextRows = new Set(next.map((item) => getRowValue(item.row)));
1411
+ selectedCells.value = next;
1412
+ selectedCell.value = next.at(-1);
1399
1413
  selectedCellAnchor.value = cell;
1400
- syncSelectedRowKeysFromCells();
1414
+ const singleRowSelect = props.selectType === "single";
1415
+ const clickedRowValue = getRowValue(cell.row);
1416
+ if (rowClickSelectsRows.value) {
1417
+ if (singleRowSelect) {
1418
+ selectedRowKeys.value = [clickedRowValue];
1419
+ } else {
1420
+ const nextKeys = new Set(selectedRowKeys.value);
1421
+ for (const rowValue of nextRows) {
1422
+ if (prevRows.has(rowValue)) continue;
1423
+ const rowIndex = data.value.findIndex((row) => getRowValue(row) === rowValue);
1424
+ if (rowIndex >= 0 && !isRowSelectDisabled(data.value[rowIndex], rowIndex)) {
1425
+ nextKeys.add(rowValue);
1426
+ }
1427
+ }
1428
+ for (const rowValue of prevRows) {
1429
+ if (!nextRows.has(rowValue)) nextKeys.delete(rowValue);
1430
+ }
1431
+ selectedRowKeys.value = [...nextKeys];
1432
+ }
1433
+ }
1434
+ if (props.activeRowType) {
1435
+ if (singleRowSelect) {
1436
+ activeRowKeys.value = [clickedRowValue];
1437
+ } else {
1438
+ const nextActive = new Set(activeRowKeys.value);
1439
+ for (const rowValue of nextRows) nextActive.add(rowValue);
1440
+ for (const rowValue of prevRows) {
1441
+ if (!nextRows.has(rowValue)) nextActive.delete(rowValue);
1442
+ }
1443
+ activeRowKeys.value = [...nextActive];
1444
+ }
1445
+ }
1401
1446
  emitRowSelectChange(cell.row, wasSelected ? "uncheck" : "check");
1402
1447
  return;
1403
1448
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qidian-vue-ui",
3
- "version": "2.0.65",
3
+ "version": "2.1.0",
4
4
  "description": "基于 TDesign 的 QiDian Vue UI 组件库",
5
5
  "author": "qidian",
6
6
  "license": "MIT",