qidian-vue-ui 2.0.34 → 2.0.35

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.
@@ -85,6 +85,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
85
85
  emptyImage: {
86
86
  type: [Boolean, String]
87
87
  },
88
+ readonly: {
89
+ type: Boolean
90
+ },
88
91
  lazyForm: {
89
92
  type: Boolean
90
93
  },
@@ -22,6 +22,7 @@ export declare const qdCrudTableProps: {
22
22
  readonly searchData: () => {};
23
23
  readonly emptyText: undefined;
24
24
  readonly emptyImage: true;
25
+ readonly readonly: undefined;
25
26
  readonly lazyForm: true;
26
27
  readonly editCellValidationBlock: "error";
27
28
  readonly rowKey: "id";
@@ -66,6 +66,7 @@ declare const _default: <D extends TableRowData = TableRowData, R = unknown, P =
66
66
  }) => import("tdesign-vue-next").TNodeReturnValue) | undefined;
67
67
  emptyText?: string | undefined;
68
68
  attach?: import("tdesign-vue-next").AttachNode | undefined;
69
+ readonly?: boolean | undefined;
69
70
  onValidate?: ((context: import("tdesign-vue-next").PrimaryTableValidateContext) => void) | undefined;
70
71
  rowKey?: string | undefined;
71
72
  scroll?: import("../..").QdServiceTableScroll | undefined;
@@ -47,6 +47,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
47
47
  headerBg: { type: Boolean },
48
48
  emptyText: {},
49
49
  emptyImage: { type: [Boolean, String] },
50
+ readonly: { type: Boolean },
50
51
  lazyForm: { type: Boolean },
51
52
  editCellValidationBlock: {},
52
53
  scroll: {},
@@ -16,6 +16,7 @@ export declare const qdCrudTabsTableProps: {
16
16
  readonly searchData: () => {};
17
17
  readonly emptyText: undefined;
18
18
  readonly emptyImage: true;
19
+ readonly readonly: undefined;
19
20
  readonly lazyForm: true;
20
21
  readonly editCellValidationBlock: "error";
21
22
  readonly rowKey: "id";
@@ -1,156 +1,156 @@
1
- .qd-service-table[data-v-1793b265] {
1
+ .qd-service-table[data-v-bff70dd6] {
2
2
  height: 100%;
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  }
6
- .qd-service-table[data-v-1793b265] > .t-table__content {
6
+ .qd-service-table[data-v-bff70dd6] > .t-table__content {
7
7
  flex: 1;
8
8
  }
9
- .qd-service-table--mini[data-v-1793b265] {
9
+ .qd-service-table--mini[data-v-bff70dd6] {
10
10
  font: var(--td-font-body-small);
11
11
  }
12
- .qd-service-table--mini[data-v-1793b265] th,
13
- .qd-service-table--mini[data-v-1793b265] tr:not(.t-table__expanded-row) > td {
12
+ .qd-service-table--mini[data-v-bff70dd6] th,
13
+ .qd-service-table--mini[data-v-bff70dd6] 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-1793b265] .t-table__row-full-element {
17
+ .qd-service-table--mini[data-v-bff70dd6] .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-1793b265] .t-table__empty {
20
+ .qd-service-table--hide-empty-image[data-v-bff70dd6] .t-table__empty {
21
21
  min-height: auto;
22
22
  }
23
- .qd-service-table--hide-empty-image[data-v-1793b265] .t-table__empty .t-empty {
23
+ .qd-service-table--hide-empty-image[data-v-bff70dd6] .t-table__empty .t-empty {
24
24
  padding: 0 !important;
25
25
  }
26
- .qd-service-table--hide-empty-image[data-v-1793b265] .t-table__empty .t-empty__image {
26
+ .qd-service-table--hide-empty-image[data-v-bff70dd6] .t-table__empty .t-empty__image {
27
27
  display: none;
28
28
  }
29
- .qd-service-table--hide-empty-image[data-v-1793b265] .t-table__empty .t-empty__title {
29
+ .qd-service-table--hide-empty-image[data-v-bff70dd6] .t-table__empty .t-empty__title {
30
30
  margin-top: 0;
31
31
  }
32
- .qd-service-table[data-v-1793b265] .t-table__tree-col:not(:has(.t-table__tree-op-icon)) {
32
+ .qd-service-table[data-v-bff70dd6] .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-1793b265] .t-table__tree-leaf-node .t-table__tree-op-icon:empty {
35
+ .qd-service-table[data-v-bff70dd6] .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-1793b265] .t-affix > .t-table__affixed-header-elm-wrap,
39
- .qd-service-table[data-v-1793b265] .t-affix > .t-table__scrollbar--obvious {
40
- transform: var(--c120d096);
38
+ .qd-service-table[data-v-bff70dd6] .t-affix > .t-table__affixed-header-elm-wrap,
39
+ .qd-service-table[data-v-bff70dd6] .t-affix > .t-table__scrollbar--obvious {
40
+ transform: var(--d0bff1fe);
41
41
  }
42
- .qd-service-table--horizontal-bar-static[data-v-1793b265] .t-table__scrollbar--obvious {
42
+ .qd-service-table--horizontal-bar-static[data-v-bff70dd6] .t-table__scrollbar--obvious {
43
43
  visibility: hidden;
44
44
  pointer-events: none;
45
45
  }
46
- .qd-service-table[data-v-1793b265] .t-table__expanded-row .qd-service-table--horizontal-bar-static > div:has(> div > .t-table__scrollbar--obvious) {
46
+ .qd-service-table[data-v-bff70dd6] .t-table__expanded-row .qd-service-table--horizontal-bar-static > div:has(> div > .t-table__scrollbar--obvious) {
47
47
  display: none;
48
48
  }
49
- .qd-service-table[data-v-1793b265] .t-table__expanded-row > td {
49
+ .qd-service-table[data-v-bff70dd6] .t-table__expanded-row > td {
50
50
  height: 0;
51
51
  }
52
- .qd-service-table[data-v-1793b265] .t-table__affixed-header-elm-wrap {
52
+ .qd-service-table[data-v-bff70dd6] .t-table__affixed-header-elm-wrap {
53
53
  height: auto !important;
54
54
  }
55
- .qd-service-table[data-v-1793b265] .t-table__affixed-header-elm {
55
+ .qd-service-table[data-v-bff70dd6] .t-table__affixed-header-elm {
56
56
  position: relative;
57
57
  scrollbar-width: none;
58
58
  }
59
- .qd-service-table[data-v-1793b265] .t-table__affixed-header-elm::-webkit-scrollbar {
59
+ .qd-service-table[data-v-bff70dd6] .t-table__affixed-header-elm::-webkit-scrollbar {
60
60
  display: none;
61
61
  width: 0;
62
62
  height: 0;
63
63
  }
64
- .qd-service-table[data-v-1793b265] .t-table__virtual-scroll-cursor + table {
64
+ .qd-service-table[data-v-bff70dd6] .t-table__virtual-scroll-cursor + table {
65
65
  border-collapse: separate;
66
66
  }
67
- .qd-service-table[data-v-1793b265] .t-table__expanded-row-inner {
67
+ .qd-service-table[data-v-bff70dd6] .t-table__expanded-row-inner {
68
68
  display: block;
69
69
  position: sticky;
70
70
  left: 0;
71
- width: var(--b49a0b2c) !important;
71
+ width: var(--v2ce85a94) !important;
72
72
  }
73
- .qd-service-table[data-v-1793b265] .t-table__cell-wrap > .t-form__controls > .t-form__controls-content > *:not(.t-switch):not(.t-tag):not(.t-icon):not(.qd-file-icon) {
73
+ .qd-service-table[data-v-bff70dd6] .t-table__cell-wrap > .t-form__controls > .t-form__controls-content > *:not(.t-switch):not(.t-tag):not(.t-icon):not(.qd-file-icon) {
74
74
  width: 100%;
75
75
  }
76
- .qd-service-table[data-v-1793b265] .qd-service-table__non-editable-col {
76
+ .qd-service-table[data-v-bff70dd6] .qd-service-table__non-editable-col {
77
77
  background-color: color-mix(in srgb, var(--td-bg-color-component) 50%, transparent);
78
78
  }
79
- .qd-service-table[data-v-1793b265] .qd-service-table__non-editable-col:is(
79
+ .qd-service-table[data-v-bff70dd6] .qd-service-table__non-editable-col:is(
80
80
  .t-table__cell--fixed-left,
81
81
  .t-table__cell--fixed-right
82
82
  ) {
83
83
  background-color: inherit;
84
84
  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));
85
85
  }
86
- .qd-service-table--disable-horizontal-scroll[data-v-1793b265] colgroup > col {
86
+ .qd-service-table--disable-horizontal-scroll[data-v-bff70dd6] colgroup > col {
87
87
  width: auto !important;
88
88
  }
89
- .qd-service-table[data-v-1793b265] .t-table__filter-pop-content-inner {
89
+ .qd-service-table[data-v-bff70dd6] .t-table__filter-pop-content-inner {
90
90
  padding: var(--td-comp-paddingTB-s) var(--td-comp-paddingLR-s) 0;
91
91
  }
92
- .qd-service-table[data-v-1793b265] .t-table__filter-pop-content-inner:has(.qd-service-table-filter-item) {
92
+ .qd-service-table[data-v-bff70dd6] .t-table__filter-pop-content-inner:has(.qd-service-table-filter-item) {
93
93
  padding: 0;
94
94
  }
95
- .qd-service-table[data-v-1793b265] .t-table__filter-pop-content-inner:has(
95
+ .qd-service-table[data-v-bff70dd6] .t-table__filter-pop-content-inner:has(
96
96
  .qd-service-table-filter-input,
97
97
  .qd-service-table-filter-custom
98
98
  ) {
99
99
  padding-bottom: var(--td-comp-paddingTB-s);
100
100
  }
101
- .qd-service-table[data-v-1793b265] .t-table__filter--bottom-buttons {
101
+ .qd-service-table[data-v-bff70dd6] .t-table__filter--bottom-buttons {
102
102
  padding: var(--td-comp-paddingTB-s) var(--td-comp-paddingLR-s);
103
103
  }
104
- .qd-service-table--mini[data-v-1793b265] .t-table__filter-pop-content-inner {
104
+ .qd-service-table--mini[data-v-bff70dd6] .t-table__filter-pop-content-inner {
105
105
  padding: var(--td-comp-paddingTB-xs) var(--td-comp-paddingLR-xs) 0;
106
106
  }
107
- .qd-service-table--mini[data-v-1793b265] .t-table__filter--bottom-buttons {
107
+ .qd-service-table--mini[data-v-bff70dd6] .t-table__filter--bottom-buttons {
108
108
  padding: var(--td-comp-paddingTB-xs) var(--td-comp-paddingLR-xs);
109
109
  }
110
- .qd-service-table--mini[data-v-1793b265] .t-table__filter-pop-content-inner:has(.qd-service-table-filter-item) {
110
+ .qd-service-table--mini[data-v-bff70dd6] .t-table__filter-pop-content-inner:has(.qd-service-table-filter-item) {
111
111
  padding: 0;
112
112
  }
113
- .qd-service-table--mini[data-v-1793b265] .t-table__filter-pop-content-inner:has(
113
+ .qd-service-table--mini[data-v-bff70dd6] .t-table__filter-pop-content-inner:has(
114
114
  .qd-service-table-filter-input,
115
115
  .qd-service-table-filter-custom
116
116
  ) {
117
117
  padding-bottom: var(--td-comp-paddingTB-xs);
118
118
  }
119
- .qd-service-table[data-v-1793b265] .qd-service-table-filter-item {
119
+ .qd-service-table[data-v-bff70dd6] .qd-service-table-filter-item {
120
120
  width: 266px;
121
121
  }
122
- .qd-service-table[data-v-1793b265] .qd-service-table-filter-item__search,
123
- .qd-service-table[data-v-1793b265] .qd-service-table-filter-item__all,
124
- .qd-service-table[data-v-1793b265] .qd-service-table-filter-item__options {
122
+ .qd-service-table[data-v-bff70dd6] .qd-service-table-filter-item__search,
123
+ .qd-service-table[data-v-bff70dd6] .qd-service-table-filter-item__all,
124
+ .qd-service-table[data-v-bff70dd6] .qd-service-table-filter-item__options {
125
125
  padding: var(--td-comp-paddingTB-s) var(--td-comp-paddingLR-s) 0;
126
126
  }
127
- .qd-service-table[data-v-1793b265] .qd-service-table-filter-item__all {
127
+ .qd-service-table[data-v-bff70dd6] .qd-service-table-filter-item__all {
128
128
  padding: 0 var(--td-comp-paddingLR-s);
129
129
  border-bottom: 1px solid var(--td-component-stroke);
130
130
  }
131
- .qd-service-table[data-v-1793b265] .qd-service-table-filter-item__options {
131
+ .qd-service-table[data-v-bff70dd6] .qd-service-table-filter-item__options {
132
132
  display: flex;
133
133
  flex-direction: column;
134
134
  height: 206px;
135
135
  padding: 0 var(--td-comp-paddingLR-s);
136
136
  overflow-y: auto;
137
137
  }
138
- .qd-service-table[data-v-1793b265] .qd-service-table-filter-item__count {
138
+ .qd-service-table[data-v-bff70dd6] .qd-service-table-filter-item__count {
139
139
  margin-left: var(--td-comp-margin-xs);
140
140
  color: var(--td-text-color-placeholder);
141
141
  }
142
- .qd-service-table[data-v-1793b265] .qd-service-table-filter-item__cell {
142
+ .qd-service-table[data-v-bff70dd6] .qd-service-table-filter-item__cell {
143
143
  pointer-events: none;
144
144
  }
145
- .qd-service-table[data-v-1793b265] .qd-service-table-filter-item .t-checkbox__label,
146
- .qd-service-table[data-v-1793b265] .qd-service-table-filter-item .t-radio__label {
145
+ .qd-service-table[data-v-bff70dd6] .qd-service-table-filter-item .t-checkbox__label,
146
+ .qd-service-table[data-v-bff70dd6] .qd-service-table-filter-item .t-radio__label {
147
147
  display: inline-flex;
148
148
  align-items: center;
149
149
  }
150
- .qd-service-table--mini[data-v-1793b265] .qd-service-table-filter-item__search {
150
+ .qd-service-table--mini[data-v-bff70dd6] .qd-service-table-filter-item__search {
151
151
  padding: var(--td-comp-paddingTB-xs) var(--td-comp-paddingLR-xs) 0;
152
152
  }
153
- .qd-service-table--mini[data-v-1793b265] .qd-service-table-filter-item__all,
154
- .qd-service-table--mini[data-v-1793b265] .qd-service-table-filter-item__options {
153
+ .qd-service-table--mini[data-v-bff70dd6] .qd-service-table-filter-item__all,
154
+ .qd-service-table--mini[data-v-bff70dd6] .qd-service-table-filter-item__options {
155
155
  padding: 0 var(--td-comp-paddingLR-xs);
156
156
  }
@@ -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-1793b265"]]);
5
+ const QdServiceTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-bff70dd6"]]);
6
6
  export {
7
7
  QdServiceTable as default
8
8
  };
@@ -8,10 +8,12 @@ import { validate } from "tdesign-vue-next/es/form/utils/form-model.mjs";
8
8
  import { useModal } from "../../../hooks/useModal.mjs";
9
9
  import { getTransformOffset } from "../../../utils/tools.mjs";
10
10
  import { useConfig } from "../../config-provider/useConfig.mjs";
11
- import { resolveQdFormItemOptions, getQdFormComponentName } from "../../form/utils.mjs";
11
+ import { getQdFormComponentName, resolveQdFormItemOptions } from "../../form/utils.mjs";
12
12
  import QdServiceTableEditCell from "./edit-cell.mjs";
13
13
  import QdServiceTableFilterItem from "./filter-item.mjs";
14
14
  import { qdServiceTableTreeConfig, qdServiceTableProps, getSortParams } from "./props.mjs";
15
+ import { useReadonly } from "../../../hooks/useReadonly.mjs";
16
+ import { useDisabled } from "../../../hooks/useDisabled.mjs";
15
17
  import { PROVIDE_FORM_ADD_BEFORE_SUBMIT_QUEUE } from "../../form/config.mjs";
16
18
  import get from "../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/get.mjs";
17
19
  import _sfc_main$1 from "../../config-renderer/index.vue.mjs";
@@ -40,6 +42,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
40
42
  emptyImage: {
41
43
  type: [Boolean, String]
42
44
  },
45
+ readonly: {
46
+ type: Boolean
47
+ },
43
48
  lazyForm: {
44
49
  type: Boolean
45
50
  },
@@ -327,8 +332,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
327
332
  emit: __emit
328
333
  }) {
329
334
  useCssVars((_ctx) => ({
330
- "c120d096": affixedHeaderTransform.value,
331
- "b49a0b2c": expandedRowWidth.value
335
+ "d0bff1fe": affixedHeaderTransform.value,
336
+ "v2ce85a94": expandedRowWidth.value
332
337
  }));
333
338
  const props = __props;
334
339
  const emit = __emit;
@@ -378,6 +383,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
378
383
  const {
379
384
  msgError
380
385
  } = useModal();
386
+ const tdReadonly = useReadonly();
387
+ const tdDisabled = useDisabled();
388
+ const tableReadonly = computed(() => tdReadonly.value || tdDisabled.value);
381
389
  const tableRef = useTemplateRef("table");
382
390
  const treeLoadIds = ref([]);
383
391
  const editingCells = shallowRef([]);
@@ -576,6 +584,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
576
584
  expandedTreeNodes: expandedTreeNodes2,
577
585
  emptyText,
578
586
  emptyImage: _emptyImage,
587
+ readonly: _readonly,
579
588
  lazyForm: _lazyForm,
580
589
  scroll,
581
590
  selectOnRowClick,
@@ -764,7 +773,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
764
773
  };
765
774
  const hasFormItemColumns = formItemColumns.value.length > 0;
766
775
  const callerEditableCellState = reTableOptions.editableCellState;
767
- const reEditableCellState = hasFormItemColumns ? (context) => {
776
+ const reEditableCellState = tableReadonly.value ? () => false : hasFormItemColumns ? (context) => {
768
777
  const column = context.col;
769
778
  if (!column.formItem) {
770
779
  if (callerEditableCellState) return callerEditableCellState(context);
@@ -773,7 +782,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
773
782
  }
774
783
  return !resolveFormItemLazy(column) || isEditingCell(context.row, column.colKey);
775
784
  } : callerEditableCellState;
776
- const reEditableRowKeys = hasFormItemColumns ? (data2 || []).map((row) => getRowValue(row)) : reTableOptions.editableRowKeys;
785
+ const reEditableRowKeys = tableReadonly.value ? [] : hasFormItemColumns ? (data2 || []).map((row) => getRowValue(row)) : reTableOptions.editableRowKeys;
777
786
  const {
778
787
  offsetBottom: horizontalScrollOffsetBottom = 0,
779
788
  onFixedChange: onHorizontalScrollFixedChange,
@@ -895,7 +904,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
895
904
  };
896
905
  });
897
906
  });
898
- watch([reSort, () => searchData.value?.orderByColumn, () => searchData.value?.isAsc], syncSearchDataSort, {
907
+ watch([reSort, () => props.columns, () => searchData.value?.orderByColumn, () => searchData.value?.isAsc], syncSearchDataSort, {
899
908
  immediate: true,
900
909
  flush: "sync"
901
910
  });
@@ -930,6 +939,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
930
939
  });
931
940
  const reOnSortChange = (sortValue, options) => {
932
941
  reProps.value.tableOptions.onSortChange?.(sortValue, options);
942
+ if (typeof options.col.sorter === "function") return;
933
943
  changeCurrent(1);
934
944
  };
935
945
  const tableLoad = computed(() => {
@@ -980,6 +990,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
980
990
  if (props.defaultSort) return normalizeSort(props.defaultSort);
981
991
  return props.multipleSort ? [] : void 0;
982
992
  }
993
+ function isLocalSortColumn(sortBy) {
994
+ function findColumn(columns) {
995
+ for (const column of columns) {
996
+ if (column.colKey === sortBy) return column;
997
+ const child = column.children ? findColumn(column.children) : void 0;
998
+ if (child) return child;
999
+ }
1000
+ }
1001
+ return typeof findColumn(props.columns ?? [])?.sorter === "function";
1002
+ }
1003
+ function getRemoteSort(value) {
1004
+ const sortList = Array.isArray(value) ? value : value ? [value] : [];
1005
+ const remoteSortList = sortList.filter((item) => !isLocalSortColumn(item.sortBy));
1006
+ return Array.isArray(value) ? remoteSortList : remoteSortList[0];
1007
+ }
983
1008
  async function transformServiceParams(params) {
984
1009
  const mergedParams = {
985
1010
  ...params,
@@ -990,7 +1015,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
990
1015
  return mergedParams;
991
1016
  }
992
1017
  function syncSearchDataSort() {
993
- const sortParams = getSortParams(reSort.value);
1018
+ const sortParams = getSortParams(getRemoteSort(reSort.value));
994
1019
  const current2 = searchData.value;
995
1020
  if (!current2) return;
996
1021
  if (sortParams.orderByColumn) {
@@ -1212,6 +1237,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1212
1237
  }, 0);
1213
1238
  }
1214
1239
  function enterEditingCell(target, autofocus = true) {
1240
+ if (tableReadonly.value) return;
1215
1241
  const currentActiveCell = activeEditingCell.value;
1216
1242
  if (currentActiveCell && !isSameEditingCell(currentActiveCell, target)) {
1217
1243
  clearAutofocusEditingCell(currentActiveCell);
@@ -1232,6 +1258,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1232
1258
  void exitEditingCell(activeEditingCell.value);
1233
1259
  }
1234
1260
  function handleCellClick(context) {
1261
+ if (tableReadonly.value) return;
1235
1262
  const column = context.col;
1236
1263
  if (column.formItem) {
1237
1264
  const editingCell = findEditingCell(context.row, column.colKey);
@@ -1846,6 +1873,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1846
1873
  return columns.map((column) => {
1847
1874
  const {
1848
1875
  children,
1876
+ edit,
1849
1877
  filter,
1850
1878
  filterItem,
1851
1879
  formItem,
@@ -1853,6 +1881,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1853
1881
  } = column;
1854
1882
  const reColumn = {
1855
1883
  ...tableColumn,
1884
+ ...!tableReadonly.value && edit ? {
1885
+ edit
1886
+ } : {},
1856
1887
  ...filterItem ? {
1857
1888
  filter: resolveColumnFilter(column, filterItem, filter)
1858
1889
  } : {
@@ -1866,7 +1897,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1866
1897
  } : {}
1867
1898
  };
1868
1899
  const columnClassName = reColumn.className === void 0 ? [] : Array.isArray(reColumn.className) ? reColumn.className : [reColumn.className];
1869
- if (!formItem) {
1900
+ if (tableReadonly.value || !formItem) {
1870
1901
  if (!children && formItemColumns.value.length) {
1871
1902
  reColumn.className = [...columnClassName, (context) => context.type === "td" ? "qd-service-table__non-editable-col" : ""];
1872
1903
  }
@@ -1880,7 +1911,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1880
1911
  ...attrs,
1881
1912
  onDblclick: (event) => {
1882
1913
  if (typeof onDblclick === "function") onDblclick(event);
1883
- if (event.defaultPrevented || !resolveFormItemLazy(column)) return;
1914
+ if (event.defaultPrevented || tableReadonly.value || !resolveFormItemLazy(column)) {
1915
+ return;
1916
+ }
1884
1917
  enterEditingCell({
1885
1918
  row: context.row,
1886
1919
  colKey: column.colKey
@@ -1948,7 +1981,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1948
1981
  };
1949
1982
  }
1950
1983
  };
1951
- const explicitEdit = column.edit;
1984
+ const explicitEdit = edit;
1952
1985
  const generatedProps = generatedEdit.props;
1953
1986
  reColumn.edit = {
1954
1987
  ...generatedEdit,
@@ -1966,6 +1999,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1966
1999
  if (!(rootEl instanceof HTMLElement)) return tableContentEl.value;
1967
2000
  return rootEl.querySelector(".t-table__content") ?? tableContentEl.value;
1968
2001
  }
2002
+ function clearEditingState() {
2003
+ editingCells.value = [];
2004
+ activeEditingCell.value = void 0;
2005
+ autofocusEditingCell.value = void 0;
2006
+ }
1969
2007
  function setScrollElTo(position = scrollRecord) {
1970
2008
  const scrollEl = getCurrentTableContentEl();
1971
2009
  if (!scrollEl) return;
@@ -2188,6 +2226,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2188
2226
  }, {
2189
2227
  immediate: true
2190
2228
  });
2229
+ watch(tableReadonly, (readonly) => {
2230
+ if (!readonly) return;
2231
+ clearEditingState();
2232
+ }, {
2233
+ flush: "sync"
2234
+ });
2191
2235
  watch(expandedTreeNodes, adjustScrollWhenTreeExpanded, {
2192
2236
  flush: "post"
2193
2237
  });
@@ -11,6 +11,7 @@ export declare const qdServiceTableProps: {
11
11
  readonly searchData: () => {};
12
12
  readonly emptyText: undefined;
13
13
  readonly emptyImage: true;
14
+ readonly readonly: undefined;
14
15
  readonly lazyForm: true;
15
16
  readonly editCellValidationBlock: "error";
16
17
  readonly rowKey: "id";
@@ -10,6 +10,7 @@ const qdServiceTableProps = {
10
10
  searchData: () => ({}),
11
11
  emptyText: void 0,
12
12
  emptyImage: true,
13
+ readonly: void 0,
13
14
  lazyForm: true,
14
15
  editCellValidationBlock: "error",
15
16
  rowKey: "id",
@@ -74,6 +74,7 @@ export interface QdServiceTableProps<D extends TableRowData = TableRowData, R =
74
74
  searchData?: Record<string, unknown>;
75
75
  emptyText?: string;
76
76
  emptyImage?: boolean | TdEmptyProps['image'];
77
+ readonly?: boolean;
77
78
  lazyForm?: boolean;
78
79
  editCellValidationBlock?: QdServiceTableEditCellValidationBlock;
79
80
  scroll?: QdServiceTableScroll;
@@ -73,6 +73,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
73
73
  emptyImage: {
74
74
  type: [Boolean, String]
75
75
  },
76
+ readonly: {
77
+ type: Boolean
78
+ },
76
79
  lazyForm: {
77
80
  type: Boolean
78
81
  },
@@ -302,9 +305,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
302
305
  multiple: {
303
306
  type: Boolean
304
307
  },
305
- readonly: {
306
- type: Boolean
307
- },
308
308
  disabled: {
309
309
  type: Boolean
310
310
  },
@@ -87,6 +87,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
87
87
  emptyImage: {
88
88
  type: [Boolean, String]
89
89
  },
90
+ readonly: {
91
+ type: Boolean
92
+ },
90
93
  lazyForm: {
91
94
  type: Boolean
92
95
  },
@@ -308,9 +311,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
308
311
  multiple: {
309
312
  type: Boolean
310
313
  },
311
- readonly: {
312
- type: Boolean
313
- },
314
314
  disabled: {
315
315
  type: Boolean
316
316
  },
@@ -63,6 +63,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
63
63
  emptyImage: {
64
64
  type: [Boolean, String]
65
65
  },
66
+ readonly: {
67
+ type: Boolean
68
+ },
66
69
  lazyForm: {
67
70
  type: Boolean
68
71
  },
@@ -295,9 +298,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
295
298
  multiple: {
296
299
  type: Boolean
297
300
  },
298
- readonly: {
299
- type: Boolean
300
- },
301
301
  disabled: {
302
302
  type: Boolean
303
303
  },
@@ -12,13 +12,13 @@ import { qdUploadAcceptMap } from "./config.mjs";
12
12
  import { qdUploadSizeLimit, qdUploadProps } from "./props.mjs";
13
13
  import { uploadByXhr, calcUploadTimeout } from "./request.mjs";
14
14
  import { PROVIDE_FORM_ADD_BEFORE_SUBMIT_QUEUE, PROVIDE_FORM_ADD_AFTER_SUBMIT_QUEUE, PROVIDE_FORM_RESET_QUEUE } from "../form/config.mjs";
15
- import { useReadonly } from "../../hooks/useReadonly.mjs";
16
- import { useDisabled } from "../../hooks/useDisabled.mjs";
17
15
  import _sfc_main$1 from "./image-file-list-display/index.vue.mjs";
18
16
  import QdUploadFileFlowFileListDisplay from "./file-flow-file-list-display/index.vue.mjs";
19
17
  import _sfc_main$2 from "../multi-file-viewer/index.vue.mjs";
20
18
  /* empty css */
21
19
  import _sfc_main$3 from "./image-flow-file-list-display/index.vue.mjs";
20
+ import { useReadonly } from "../../hooks/useReadonly.mjs";
21
+ import { useDisabled } from "../../hooks/useDisabled.mjs";
22
22
  import { useModal } from "../../hooks/useModal.mjs";
23
23
  const tempOssIdPrefix = "__qd_upload_temp_";
24
24
  const _sfc_main = /* @__PURE__ */ defineComponent({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qidian-vue-ui",
3
- "version": "2.0.34",
3
+ "version": "2.0.35",
4
4
  "description": "基于 TDesign 的 QiDian Vue UI 组件库",
5
5
  "author": "qidian",
6
6
  "license": "MIT",