qidian-vue-ui 2.0.32 → 2.0.33

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.
@@ -88,6 +88,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
88
88
  lazyForm: {
89
89
  type: Boolean
90
90
  },
91
+ editCellValidationBlock: {},
91
92
  scroll: {},
92
93
  tree: {},
93
94
  loadingWithData: {
@@ -23,6 +23,7 @@ export declare const qdCrudTableProps: {
23
23
  readonly emptyText: undefined;
24
24
  readonly emptyImage: true;
25
25
  readonly lazyForm: true;
26
+ readonly editCellValidationBlock: "error";
26
27
  readonly rowKey: "id";
27
28
  readonly expandIcon: true;
28
29
  readonly selectOnRowClick: undefined;
@@ -193,6 +193,7 @@ declare const _default: <D extends TableRowData = TableRowData, R = unknown, P =
193
193
  headerBg?: boolean | undefined;
194
194
  emptyImage?: string | boolean | ((h: typeof import("vue").h) => import("tdesign-vue-next").TNodeReturnValue) | import("tdesign-vue-next").TdImageProps | undefined;
195
195
  lazyForm?: boolean | undefined;
196
+ editCellValidationBlock?: import("../../service/table/types").QdServiceTableEditCellValidationBlock | undefined;
196
197
  loadingWithData?: boolean | undefined;
197
198
  disableHorizontalScroll?: boolean | undefined;
198
199
  cacheKey?: string | ((params?: unknown[] | undefined) => string) | undefined;
@@ -48,6 +48,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
48
48
  emptyText: {},
49
49
  emptyImage: { type: [Boolean, String] },
50
50
  lazyForm: { type: Boolean },
51
+ editCellValidationBlock: {},
51
52
  scroll: {},
52
53
  tree: {},
53
54
  loadingWithData: { type: Boolean },
@@ -17,6 +17,7 @@ export declare const qdCrudTabsTableProps: {
17
17
  readonly emptyText: undefined;
18
18
  readonly emptyImage: true;
19
19
  readonly lazyForm: true;
20
+ readonly editCellValidationBlock: "error";
20
21
  readonly rowKey: "id";
21
22
  readonly expandIcon: true;
22
23
  readonly selectOnRowClick: undefined;
@@ -1,88 +1,88 @@
1
- .qd-service-table[data-v-ffc43b16] {
1
+ .qd-service-table[data-v-92206ee3] {
2
2
  height: 100%;
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  }
6
- .qd-service-table[data-v-ffc43b16] > .t-table__content {
6
+ .qd-service-table[data-v-92206ee3] > .t-table__content {
7
7
  flex: 1;
8
8
  }
9
- .qd-service-table--mini[data-v-ffc43b16] {
9
+ .qd-service-table--mini[data-v-92206ee3] {
10
10
  font: var(--td-font-body-small);
11
11
  }
12
- .qd-service-table--mini[data-v-ffc43b16] th,
13
- .qd-service-table--mini[data-v-ffc43b16] tr:not(.t-table__expanded-row) > td {
12
+ .qd-service-table--mini[data-v-92206ee3] th,
13
+ .qd-service-table--mini[data-v-92206ee3] 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-ffc43b16] .t-table__row-full-element {
17
+ .qd-service-table--mini[data-v-92206ee3] .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-ffc43b16] .t-table__empty {
20
+ .qd-service-table--hide-empty-image[data-v-92206ee3] .t-table__empty {
21
21
  min-height: auto;
22
22
  }
23
- .qd-service-table--hide-empty-image[data-v-ffc43b16] .t-table__empty .t-empty {
23
+ .qd-service-table--hide-empty-image[data-v-92206ee3] .t-table__empty .t-empty {
24
24
  padding: 0 !important;
25
25
  }
26
- .qd-service-table--hide-empty-image[data-v-ffc43b16] .t-table__empty .t-empty__image {
26
+ .qd-service-table--hide-empty-image[data-v-92206ee3] .t-table__empty .t-empty__image {
27
27
  display: none;
28
28
  }
29
- .qd-service-table--hide-empty-image[data-v-ffc43b16] .t-table__empty .t-empty__title {
29
+ .qd-service-table--hide-empty-image[data-v-92206ee3] .t-table__empty .t-empty__title {
30
30
  margin-top: 0;
31
31
  }
32
- .qd-service-table[data-v-ffc43b16] .t-table__tree-col:not(:has(.t-table__tree-op-icon)) {
32
+ .qd-service-table[data-v-92206ee3] .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-ffc43b16] .t-table__tree-leaf-node .t-table__tree-op-icon:empty {
35
+ .qd-service-table[data-v-92206ee3] .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-ffc43b16] .t-affix > .t-table__affixed-header-elm-wrap,
39
- .qd-service-table[data-v-ffc43b16] .t-affix > .t-table__scrollbar--obvious {
40
- transform: var(--v366f53ea);
38
+ .qd-service-table[data-v-92206ee3] .t-affix > .t-table__affixed-header-elm-wrap,
39
+ .qd-service-table[data-v-92206ee3] .t-affix > .t-table__scrollbar--obvious {
40
+ transform: var(--v48c62e9a);
41
41
  }
42
- .qd-service-table--horizontal-bar-static[data-v-ffc43b16] .t-table__scrollbar--obvious {
42
+ .qd-service-table--horizontal-bar-static[data-v-92206ee3] .t-table__scrollbar--obvious {
43
43
  visibility: hidden;
44
44
  pointer-events: none;
45
45
  }
46
- .qd-service-table[data-v-ffc43b16] .t-table__expanded-row .qd-service-table--horizontal-bar-static > div:has(> div > .t-table__scrollbar--obvious) {
46
+ .qd-service-table[data-v-92206ee3] .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-ffc43b16] .t-table__expanded-row > td {
49
+ .qd-service-table[data-v-92206ee3] .t-table__expanded-row > td {
50
50
  height: 0;
51
51
  }
52
- .qd-service-table[data-v-ffc43b16] .t-table__affixed-header-elm-wrap {
52
+ .qd-service-table[data-v-92206ee3] .t-table__affixed-header-elm-wrap {
53
53
  height: auto !important;
54
54
  }
55
- .qd-service-table[data-v-ffc43b16] .t-table__affixed-header-elm {
55
+ .qd-service-table[data-v-92206ee3] .t-table__affixed-header-elm {
56
56
  position: relative;
57
57
  scrollbar-width: none;
58
58
  }
59
- .qd-service-table[data-v-ffc43b16] .t-table__affixed-header-elm::-webkit-scrollbar {
59
+ .qd-service-table[data-v-92206ee3] .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-ffc43b16] .t-table__virtual-scroll-cursor + table {
64
+ .qd-service-table[data-v-92206ee3] .t-table__virtual-scroll-cursor + table {
65
65
  border-collapse: separate;
66
66
  }
67
- .qd-service-table[data-v-ffc43b16] .t-table__expanded-row-inner {
67
+ .qd-service-table[data-v-92206ee3] .t-table__expanded-row-inner {
68
68
  display: block;
69
69
  position: sticky;
70
70
  left: 0;
71
- width: var(--v12b6b140) !important;
71
+ width: var(--v442c3de2) !important;
72
72
  }
73
- .qd-service-table[data-v-ffc43b16] .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-92206ee3] .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-ffc43b16] .qd-service-table__non-editable-col {
76
+ .qd-service-table[data-v-92206ee3] .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-ffc43b16] .qd-service-table__non-editable-col:is(
79
+ .qd-service-table[data-v-92206ee3] .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-ffc43b16] colgroup > col {
86
+ .qd-service-table--disable-horizontal-scroll[data-v-92206ee3] colgroup > col {
87
87
  width: auto !important;
88
88
  }
@@ -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-ffc43b16"]]);
5
+ const QdServiceTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-92206ee3"]]);
6
6
  export {
7
7
  QdServiceTable as default
8
8
  };
@@ -41,6 +41,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
41
41
  lazyForm: {
42
42
  type: Boolean
43
43
  },
44
+ editCellValidationBlock: {},
44
45
  scroll: {},
45
46
  tree: {},
46
47
  loadingWithData: {
@@ -324,8 +325,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
324
325
  emit: __emit
325
326
  }) {
326
327
  useCssVars((_ctx) => ({
327
- "v366f53ea": affixedHeaderTransform.value,
328
- "v12b6b140": expandedRowWidth.value
328
+ "v48c62e9a": affixedHeaderTransform.value,
329
+ "v442c3de2": expandedRowWidth.value
329
330
  }));
330
331
  const props = __props;
331
332
  const emit = __emit;
@@ -1065,6 +1066,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1065
1066
  else nextErrors.delete(rowValue);
1066
1067
  editingCellValidationErrors.value = nextErrors;
1067
1068
  }
1069
+ function clearValidateData() {
1070
+ tableRef.value?.clearValidateData();
1071
+ editingCellValidationErrors.value = /* @__PURE__ */ new Map();
1072
+ }
1068
1073
  function pruneCellValidationErrors(rows) {
1069
1074
  const currentErrors = editingCellValidationErrors.value;
1070
1075
  if (!currentErrors.size) return;
@@ -1151,6 +1156,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1151
1156
  autofocusEditingCell.value = void 0;
1152
1157
  }
1153
1158
  let suppressEnterCellKey = null;
1159
+ function shouldBlockEditingCellExit(results) {
1160
+ const block = props.editCellValidationBlock;
1161
+ if (block === "none") return false;
1162
+ return results?.some((item) => {
1163
+ if (item.result !== false) return false;
1164
+ const type = item.type === "warning" ? "warning" : "error";
1165
+ return block === "all" || block === type;
1166
+ }) ?? false;
1167
+ }
1154
1168
  async function exitEditingCell(target) {
1155
1169
  const cellKey = getCellKey(target.row, target.colKey);
1156
1170
  const version = (editingCellValidationVersions.get(cellKey) ?? 0) + 1;
@@ -1160,7 +1174,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1160
1174
  } = await tableRef.value?.validateTableData() ?? {};
1161
1175
  if (version !== editingCellValidationVersions.get(cellKey)) return;
1162
1176
  if (!isEditingCell(target.row, target.colKey)) return;
1163
- if (result[cellKey]?.length) return;
1177
+ if (shouldBlockEditingCellExit(result[cellKey])) return;
1164
1178
  editingCellValidationVersions.delete(cellKey);
1165
1179
  removeEditingCell(target);
1166
1180
  suppressEnterCellKey = cellKey;
@@ -2065,6 +2079,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2065
2079
  setPollingInterval,
2066
2080
  validateTableData,
2067
2081
  validateRowData,
2082
+ clearValidateData,
2068
2083
  submitTableData,
2069
2084
  submitRowData,
2070
2085
  getData: (key) => {
@@ -12,6 +12,7 @@ export declare const qdServiceTableProps: {
12
12
  readonly emptyText: undefined;
13
13
  readonly emptyImage: true;
14
14
  readonly lazyForm: true;
15
+ readonly editCellValidationBlock: "error";
15
16
  readonly rowKey: "id";
16
17
  readonly expandIcon: true;
17
18
  readonly selectOnRowClick: undefined;
@@ -11,6 +11,7 @@ const qdServiceTableProps = {
11
11
  emptyText: void 0,
12
12
  emptyImage: true,
13
13
  lazyForm: true,
14
+ editCellValidationBlock: "error",
14
15
  rowKey: "id",
15
16
  expandIcon: true,
16
17
  selectOnRowClick: void 0,
@@ -15,6 +15,7 @@ export type QdServiceTableFormItem = Omit<QdFormItemProps, 'name' | 'label' | 'c
15
15
  lazy?: boolean;
16
16
  virtualValidateRender?: boolean;
17
17
  };
18
+ export type QdServiceTableEditCellValidationBlock = 'none' | 'error' | 'warning' | 'all';
18
19
  export type QdServiceTableDeleteCheckResult = void | boolean | {
19
20
  success: boolean;
20
21
  message?: string;
@@ -61,6 +62,7 @@ export interface QdServiceTableProps<D extends TableRowData = TableRowData, R =
61
62
  emptyText?: string;
62
63
  emptyImage?: boolean | TdEmptyProps['image'];
63
64
  lazyForm?: boolean;
65
+ editCellValidationBlock?: QdServiceTableEditCellValidationBlock;
64
66
  scroll?: QdServiceTableScroll;
65
67
  tree?: TdEnhancedTableProps<D>['tree'] & {
66
68
  lazyLoad?: boolean;
@@ -76,6 +76,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
76
76
  lazyForm: {
77
77
  type: Boolean
78
78
  },
79
+ editCellValidationBlock: {},
79
80
  scroll: {},
80
81
  tree: {},
81
82
  loadingWithData: {
@@ -41,6 +41,7 @@ export declare const qdServiceDialogTableSelectProps: {
41
41
  readonly emptyText: undefined;
42
42
  readonly emptyImage: true;
43
43
  readonly lazyForm: true;
44
+ readonly editCellValidationBlock: "error";
44
45
  readonly expandIcon: true;
45
46
  readonly selectOnRowClick: undefined;
46
47
  readonly bordered: undefined;
@@ -90,6 +90,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
90
90
  lazyForm: {
91
91
  type: Boolean
92
92
  },
93
+ editCellValidationBlock: {},
93
94
  scroll: {},
94
95
  tree: {},
95
96
  loadingWithData: {
@@ -16,6 +16,7 @@ export declare const qdServiceDialogTabsTableSelectProps: {
16
16
  readonly emptyText: undefined;
17
17
  readonly emptyImage: true;
18
18
  readonly lazyForm: true;
19
+ readonly editCellValidationBlock: "error";
19
20
  readonly expandIcon: true;
20
21
  readonly selectOnRowClick: undefined;
21
22
  readonly bordered: undefined;
@@ -66,6 +66,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
66
66
  lazyForm: {
67
67
  type: Boolean
68
68
  },
69
+ editCellValidationBlock: {},
69
70
  scroll: {},
70
71
  tree: {},
71
72
  loadingWithData: {
@@ -15,6 +15,7 @@ export declare const qdServicePopupTableSelectProps: {
15
15
  readonly emptyText: undefined;
16
16
  readonly emptyImage: true;
17
17
  readonly lazyForm: true;
18
+ readonly editCellValidationBlock: "error";
18
19
  readonly expandIcon: true;
19
20
  readonly selectOnRowClick: undefined;
20
21
  readonly bordered: undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qidian-vue-ui",
3
- "version": "2.0.32",
3
+ "version": "2.0.33",
4
4
  "description": "基于 TDesign 的 QiDian Vue UI 组件库",
5
5
  "author": "qidian",
6
6
  "license": "MIT",