qidian-vue-ui 1.3.0 → 1.3.2

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,36 +1,36 @@
1
- .qd-crud-table[data-v-7074f039] {
1
+ .qd-crud-table[data-v-deb7960f] {
2
2
  width: 100%;
3
3
  height: 100%;
4
4
  display: flex;
5
5
  flex-direction: column;
6
6
  }
7
- .qd-crud-table > .qd-crud-search:not(.qd-crud-search--hide) + .qd-crud-table__body[data-v-7074f039] {
7
+ .qd-crud-table > .qd-crud-search:not(.qd-crud-search--hide) + .qd-crud-table__body[data-v-deb7960f] {
8
8
  margin-top: var(--td-comp-margin-l);
9
9
  }
10
- .qd-crud-table__body[data-v-7074f039] {
10
+ .qd-crud-table__body[data-v-deb7960f] {
11
11
  flex: auto;
12
12
  }
13
- .qd-crud-table__body[data-v-7074f039] > .t-loading__parent > .t-card__body {
13
+ .qd-crud-table__body[data-v-deb7960f] > .t-loading__parent > .t-card__body {
14
14
  height: 100%;
15
15
  min-height: 443px;
16
16
  display: flex;
17
17
  flex-direction: column;
18
18
  }
19
- .qd-crud-table__body[data-v-7074f039] > .t-loading__parent > .t-card__body > .qd-service-table {
19
+ .qd-crud-table__body[data-v-deb7960f] > .t-loading__parent > .t-card__body > .qd-service-table {
20
20
  flex: 1 1 0;
21
21
  overflow: hidden;
22
22
  }
23
- .qd-crud-table__body[data-v-7074f039] > .t-loading__parent > .t-card__body > .qd-service-table .t-table__pagination {
23
+ .qd-crud-table__body[data-v-deb7960f] > .t-loading__parent > .t-card__body > .qd-service-table .t-table__pagination {
24
24
  padding-bottom: 0;
25
25
  }
26
- .qd-crud-table__toolbar[data-v-7074f039] {
26
+ .qd-crud-table__toolbar[data-v-deb7960f] {
27
27
  display: flex;
28
28
  justify-content: space-between;
29
29
  }
30
- .qd-crud-table__toolbar:has(.t-space-item) + .qd-service-table[data-v-7074f039] {
30
+ .qd-crud-table__toolbar--has-space-item + .qd-service-table[data-v-deb7960f] {
31
31
  margin-top: var(--td-comp-margin-l);
32
32
  }
33
- .qd-crud-table__toolbar-separator[data-v-7074f039] {
33
+ .qd-crud-table__toolbar-separator[data-v-deb7960f] {
34
34
  display: inline-block;
35
35
  padding-left: var(--td-comp-paddingLR-s);
36
36
  }
@@ -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-7074f039"]]);
5
+ const QdCrudTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-deb7960f"]]);
6
6
  export {
7
7
  QdCrudTable as default
8
8
  };
@@ -1,5 +1,5 @@
1
1
  import './index.css'
2
- import { defineComponent, mergeDefaults, computed, reactive, useTemplateRef, ref, createElementBlock, openBlock, renderSlot, createVNode, withDirectives, createCommentVNode, createBlock, unref, mergeProps, isRef, createSlots, renderList, withCtx, normalizeProps, guardReactiveProps, vShow, createElementVNode, Fragment, withModifiers, nextTick, shallowRef, toRef, triggerRef } from "vue";
2
+ import { defineComponent, mergeDefaults, computed, reactive, useTemplateRef, ref, onMounted, onBeforeUnmount, createElementBlock, openBlock, renderSlot, createVNode, withDirectives, createCommentVNode, createBlock, unref, mergeProps, isRef, createSlots, renderList, withCtx, normalizeProps, guardReactiveProps, vShow, createElementVNode, normalizeClass, Fragment, withModifiers, nextTick, shallowRef, toRef, triggerRef } from "vue";
3
3
  import { useVModels, useLocalStorage } from "../../../node_modules/.pnpm/@vueuse_core@14.2.0_vue@3.5.26_typescript@5.9.3_/node_modules/@vueuse/core/dist/index.mjs";
4
4
  import { MD5, easyCopy, suspectedWrapperPromise, createExposeProxy, extractSlotsWithPrefix, isEmpty, generateRandomString, to } from "qidian-shared";
5
5
  import { SearchIcon, RefreshIcon, UnfoldLessIcon, UnfoldMoreIcon, SettingIcon, AddIcon, DeleteIcon } from "tdesign-icons-vue-next";
@@ -24,13 +24,10 @@ const _hoisted_1 = {
24
24
  class: "qd-crud-table"
25
25
  };
26
26
  const _hoisted_2 = {
27
- class: "qd-crud-table__toolbar"
28
- };
29
- const _hoisted_3 = {
30
27
  key: 0,
31
28
  class: "qd-crud-table__toolbar-separator"
32
29
  };
33
- const _hoisted_4 = {
30
+ const _hoisted_3 = {
34
31
  key: 0,
35
32
  class: "qd-crud-table__toolbar-separator"
36
33
  };
@@ -569,6 +566,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
569
566
  const searchVisible = ref(true);
570
567
  const searchRef = useTemplateRef("search");
571
568
  let searchMode = "refresh";
569
+ const toolbarRef = useTemplateRef("toolbar");
570
+ const toolbarHasSpaceItem = ref(false);
571
+ let toolbarObserver = null;
572
572
  function handleSearch() {
573
573
  searchMode = "changeCurrent";
574
574
  }
@@ -966,6 +966,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
966
966
  }
967
967
  return false;
968
968
  }
969
+ function syncToolbarHasSpaceItem() {
970
+ toolbarHasSpaceItem.value = !!toolbarRef.value?.querySelector(".t-space-item");
971
+ }
972
+ onMounted(() => {
973
+ syncToolbarHasSpaceItem();
974
+ const toolbarEl = toolbarRef.value;
975
+ if (!toolbarEl) return;
976
+ toolbarObserver = new MutationObserver(syncToolbarHasSpaceItem);
977
+ toolbarObserver.observe(toolbarEl, {
978
+ childList: true,
979
+ subtree: true
980
+ });
981
+ });
982
+ onBeforeUnmount(() => {
983
+ toolbarObserver?.disconnect();
984
+ toolbarObserver = null;
985
+ });
969
986
  __expose(createExposeProxy({}, tableRef));
970
987
  return (_ctx, _cache) => {
971
988
  return openBlock(), createElementBlock("div", _hoisted_1, [renderSlot(_ctx.$slots, "header", {}, () => [reProps.value.searchOptions?.items?.length ? withDirectives((openBlock(), createBlock(unref(QdCrudSearch), mergeProps({
@@ -988,7 +1005,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
988
1005
  })]), 1040, ["data", "class"])), [[vShow, searchVisible.value]]) : createCommentVNode("", true)], true), createVNode(unref(QdCard), {
989
1006
  class: "qd-crud-table__body"
990
1007
  }, {
991
- default: withCtx(() => [createElementVNode("div", _hoisted_2, [createVNode(unref(Space), {
1008
+ default: withCtx(() => [createElementVNode("div", {
1009
+ ref: "toolbar",
1010
+ class: normalizeClass(["qd-crud-table__toolbar", {
1011
+ "qd-crud-table__toolbar--has-space-item": toolbarHasSpaceItem.value
1012
+ }])
1013
+ }, [createVNode(unref(Space), {
992
1014
  align: "center",
993
1015
  size: 0
994
1016
  }, {
@@ -997,7 +1019,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
997
1019
  key: item.uid || index
998
1020
  }, [getActionSeparator(item, {
999
1021
  index
1000
- }) ? (openBlock(), createElementBlock("span", _hoisted_3)) : createCommentVNode("", true), withDirectives(createVNode(unref(_sfc_main$1), {
1022
+ }) ? (openBlock(), createElementBlock("span", _hoisted_2)) : createCommentVNode("", true), withDirectives(createVNode(unref(_sfc_main$1), {
1001
1023
  "fn-inject-ctx": "",
1002
1024
  context: getConfigRendererCtx(item),
1003
1025
  config: {
@@ -1023,7 +1045,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1023
1045
  }, [getActionSeparator(item, {
1024
1046
  index,
1025
1047
  mapKey: "tool"
1026
- }) ? (openBlock(), createElementBlock("span", _hoisted_4)) : createCommentVNode("", true), createVNode(unref(Tooltip), {
1048
+ }) ? (openBlock(), createElementBlock("span", _hoisted_3)) : createCommentVNode("", true), createVNode(unref(Tooltip), {
1027
1049
  content: item.content,
1028
1050
  disabled: !item.content
1029
1051
  }, {
@@ -1116,7 +1138,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1116
1138
  _: 1
1117
1139
  }, 8, ["content"])], 64)) : createCommentVNode("", true)], true)]),
1118
1140
  _: 3
1119
- })]), createVNode(unref(QdServiceTable), mergeProps({
1141
+ })], 2), createVNode(unref(QdServiceTable), mergeProps({
1120
1142
  ref: "table",
1121
1143
  data: unref(data),
1122
1144
  "onUpdate:data": _cache[2] || (_cache[2] = ($event) => isRef(data) ? data.value = $event : null),
@@ -1,33 +1,17 @@
1
- .qd-form--descriptions[data-v-7b85acc1] .qd-grid {
1
+ .qd-form--descriptions[data-v-2ca4a3ef] .qd-grid {
2
2
  border-top: 1px solid var(--td-component-border);
3
3
  border-left: 1px solid var(--td-component-border);
4
4
  }
5
- .qd-form--descriptions[data-v-7b85acc1] .qd-grid-item {
5
+ .qd-form--descriptions[data-v-2ca4a3ef] .qd-grid-item {
6
6
  border-right: 1px solid var(--td-component-border);
7
7
  border-bottom: 1px solid var(--td-component-border);
8
8
  }
9
- .qd-form--descriptions[data-v-7b85acc1] .qd-grid-item:has(.t-form__item > .t-form__label--top) {
10
- display: grid;
11
- grid-row: span 2 !important;
12
- grid-template-rows: subgrid;
13
- }
14
- .qd-form--descriptions[data-v-7b85acc1] .t-form__item {
9
+ .qd-form--descriptions[data-v-2ca4a3ef] .t-form__item {
15
10
  display: flex;
16
11
  align-items: stretch;
17
12
  height: 100%;
18
13
  }
19
- .qd-form--descriptions[data-v-7b85acc1] .t-form__item:has(> .t-form__label--top) {
20
- display: contents;
21
- }
22
- .qd-form--descriptions[data-v-7b85acc1] .t-form__item:has(> .t-form__label--top) .t-form__controls {
23
- height: auto;
24
- min-height: min-content;
25
- }
26
- .qd-form--descriptions[data-v-7b85acc1] .t-form__item:has(> .t-form__label--top) .t-form__controls-content {
27
- min-height: min-content;
28
- white-space: normal;
29
- }
30
- .qd-form--descriptions[data-v-7b85acc1] .t-form__label {
14
+ .qd-form--descriptions[data-v-2ca4a3ef] .t-form__label {
31
15
  display: flex;
32
16
  flex-direction: column;
33
17
  justify-content: center;
@@ -35,20 +19,17 @@
35
19
  padding: var(--td-comp-paddingLR-m) var(--td-comp-paddingLR-l);
36
20
  height: 100%;
37
21
  }
38
- .qd-form--descriptions[data-v-7b85acc1] .t-form__label:not(.t-form__label--top):not([style*='width: 100%']) {
39
- border-right: 1px solid var(--td-component-border);
40
- }
41
- .qd-form--descriptions[data-v-7b85acc1] .t-form__label--top {
22
+ .qd-form--descriptions[data-v-2ca4a3ef] .t-form__label--top {
42
23
  border-bottom: 1px solid var(--td-component-border);
43
24
  align-items: center;
44
- height: auto;
25
+ height: var(--qd-form-description-label-height, auto);
45
26
  white-space: normal;
46
27
  }
47
- .qd-form--descriptions[data-v-7b85acc1] .t-form__label--top + .t-form__controls > .t-form__controls-content {
28
+ .qd-form--descriptions[data-v-2ca4a3ef] .t-form__label--top + .t-form__controls > .t-form__controls-content {
48
29
  justify-content: center;
49
30
  text-align: center;
50
31
  }
51
- .qd-form--descriptions[data-v-7b85acc1] .t-form__controls {
32
+ .qd-form--descriptions[data-v-2ca4a3ef] .t-form__controls {
52
33
  flex: 1 1 0;
53
34
  overflow: hidden;
54
35
  display: flex;
@@ -58,6 +39,23 @@
58
39
  margin-left: 0 !important;
59
40
  height: 100%;
60
41
  }
61
- .qd-form--descriptions[data-v-7b85acc1] .t-form__controls:has(> .t-form__controls-content:empty) {
42
+ .qd-form--descriptions[data-v-2ca4a3ef] .qd-form-item--label-top {
43
+ display: grid;
44
+ grid-template-rows: auto minmax(min-content, auto);
45
+ grid-row: span 2 !important;
46
+ }
47
+ .qd-form--descriptions[data-v-2ca4a3ef] .qd-form-item--label-top > .t-form__item {
48
+ display: contents;
49
+ }
50
+ .qd-form--descriptions[data-v-2ca4a3ef] .qd-form-item--label-top .t-form__controls-content {
51
+ white-space: normal;
52
+ }
53
+ .qd-form--descriptions[data-v-2ca4a3ef] .qd-form-item--empty-content .t-form__controls {
62
54
  padding: 0 !important;
55
+ min-height: 0;
56
+ height: 0;
57
+ overflow: hidden;
58
+ }
59
+ .qd-form--descriptions[data-v-2ca4a3ef] .qd-form-item:not(.qd-form-item--label-top):not(.qd-form-item--label-width-full) .t-form__label {
60
+ border-right: 1px solid var(--td-component-border);
63
61
  }
@@ -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 QdForm = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7b85acc1"]]);
5
+ const QdForm = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-2ca4a3ef"]]);
6
6
  export {
7
7
  QdForm as default
8
8
  };
@@ -1,7 +1,7 @@
1
1
  import './index.css'
2
- import { defineComponent, mergeDefaults, provide, nextTick, onBeforeUnmount, useTemplateRef, ref, computed, withDirectives, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot, normalizeProps, guardReactiveProps, createVNode, createElementBlock, Fragment, renderList } from "vue";
2
+ import { defineComponent, mergeDefaults, provide, nextTick, onBeforeUnmount, useTemplateRef, ref, computed, watch, onMounted, withDirectives, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot, normalizeProps, guardReactiveProps, createElementBlock, Fragment, renderList } from "vue";
3
3
  import { useVModels } from "../../node_modules/.pnpm/@vueuse_core@14.2.0_vue@3.5.26_typescript@5.9.3_/node_modules/@vueuse/core/dist/index.mjs";
4
- import { createExposeProxy, easyCopy, hasOwn, to, suspectedWrapperPromise } from "qidian-shared";
4
+ import { createExposeProxy, resizeDirective, easyCopy, hasOwn, to, suspectedWrapperPromise } from "qidian-shared";
5
5
  import { Form, LoadingDirective } from "tdesign-vue-next";
6
6
  import { useModal } from "../../hooks/useModal.mjs";
7
7
  import { useConfig } from "../config-provider/useConfig.mjs";
@@ -49,6 +49,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
49
49
  emits: ["update:modelValue"],
50
50
  setup(__props, { expose: __expose, emit: __emit }) {
51
51
  const vLoading = LoadingDirective;
52
+ const vResize = resizeDirective;
52
53
  const props = __props;
53
54
  const emit = __emit;
54
55
  const { data } = useVModels(props, emit, { passive: true });
@@ -81,6 +82,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
81
82
  });
82
83
  });
83
84
  const formRef = useTemplateRef("form");
85
+ const gridRef = useTemplateRef("gridRef");
84
86
  const submitShowErrorMessage = ref();
85
87
  const submitScrollToFirstError = ref();
86
88
  let submitResolver;
@@ -233,6 +235,49 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
233
235
  return res;
234
236
  }
235
237
  };
238
+ function syncDescriptionLabelRows() {
239
+ if (!reProps.value.descriptions) return;
240
+ const gridEl = gridRef.value?.$el ?? null;
241
+ if (!gridEl) return;
242
+ const items = Array.from(gridEl.querySelectorAll(".qd-form-item--label-top"));
243
+ if (!items.length) return;
244
+ const rows = /* @__PURE__ */ new Map();
245
+ for (const item of items) {
246
+ const top = item.offsetTop;
247
+ let rowKey = top;
248
+ for (const key of rows.keys()) {
249
+ if (Math.abs(key - top) <= 1) {
250
+ rowKey = key;
251
+ break;
252
+ }
253
+ }
254
+ const rowItems = rows.get(rowKey);
255
+ if (rowItems) rowItems.push(item);
256
+ else rows.set(rowKey, [item]);
257
+ }
258
+ for (const rowItems of rows.values()) {
259
+ let maxHeight = 0;
260
+ for (const item of rowItems) {
261
+ const label = item.querySelector(".t-form__label");
262
+ if (!label) continue;
263
+ label.style.setProperty("--qd-form-description-label-height", "");
264
+ maxHeight = Math.max(maxHeight, label.offsetHeight);
265
+ }
266
+ for (const item of rowItems) {
267
+ item.querySelector(".t-form__label")?.style.setProperty("--qd-form-description-label-height", `${maxHeight}px`);
268
+ }
269
+ }
270
+ }
271
+ watch(
272
+ [() => reProps.value.formItems, data],
273
+ () => {
274
+ nextTick(syncDescriptionLabelRows);
275
+ },
276
+ { deep: true }
277
+ );
278
+ onMounted(() => {
279
+ nextTick(syncDescriptionLabelRows);
280
+ });
236
281
  __expose(createExposeProxy(expose, formRef));
237
282
  return (_ctx, _cache) => {
238
283
  return withDirectives((openBlock(), createBlock(unref(Form), mergeProps({
@@ -250,19 +295,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
250
295
  default: withCtx(() => [
251
296
  renderSlot(_ctx.$slots, "header", { context: unref(data) }, void 0, true),
252
297
  renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(reProps.value.gridOptions)), () => [
253
- createVNode(unref(QdGrid), normalizeProps(guardReactiveProps(reProps.value.gridOptions)), {
298
+ withDirectives((openBlock(), createBlock(unref(QdGrid), mergeProps({
299
+ ref_key: "gridRef",
300
+ ref: gridRef
301
+ }, reProps.value.gridOptions), {
254
302
  default: withCtx(() => [
255
303
  (openBlock(true), createElementBlock(Fragment, null, renderList(reProps.value.formItems, (item, index) => {
256
304
  return openBlock(), createBlock(QdFormItem, mergeProps({
257
305
  key: index,
258
306
  "crud-mode": __props.crudMode,
259
307
  context: unref(data),
260
- "default-clearable": __props.defaultClearable
261
- }, { ref_for: true }, item), null, 16, ["crud-mode", "context", "default-clearable"]);
308
+ "default-clearable": __props.defaultClearable,
309
+ "label-align": item.labelAlign ?? reProps.value.formOptions.labelAlign
310
+ }, { ref_for: true }, item), null, 16, ["crud-mode", "context", "default-clearable", "label-align"]);
262
311
  }), 128))
263
312
  ]),
264
313
  _: 1
265
- }, 16)
314
+ }, 16)), [
315
+ [unref(vResize), syncDescriptionLabelRows]
316
+ ])
266
317
  ], true),
267
318
  renderSlot(_ctx.$slots, "footer", { context: unref(data) }, void 0, true)
268
319
  ]),
@@ -1,6 +1,6 @@
1
- .qd-form-item[data-v-90d2f0f4] > .t-form__item > .t-form__controls > .t-form__controls-content > *:not(.t-switch) {
1
+ .qd-form-item[data-v-ad6b610c] > .t-form__item > .t-form__controls > .t-form__controls-content > *:not(.t-switch) {
2
2
  width: 100%;
3
3
  }
4
- .qd-form-item__component[data-v-90d2f0f4]:not(.t-switch) {
4
+ .qd-form-item__component[data-v-ad6b610c]:not(.t-switch) {
5
5
  width: 100%;
6
6
  }
@@ -2,7 +2,7 @@ import './item.css'
2
2
  import _sfc_main from "./item.vue2.mjs";
3
3
  /* empty css */
4
4
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
5
- const QdFormItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-90d2f0f4"]]);
5
+ const QdFormItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ad6b610c"]]);
6
6
  export {
7
7
  QdFormItem as default
8
8
  };
@@ -95,7 +95,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
95
95
  key: 0,
96
96
  class: [
97
97
  "qd-form-item",
98
- reProps.value.formItemOptions.name ? `qd-form-item__${reProps.value.formItemOptions.name}` : ""
98
+ reProps.value.formItemOptions.name ? `qd-form-item__${reProps.value.formItemOptions.name}` : "",
99
+ reProps.value.formItemOptions.labelAlign === "top" ? "qd-form-item--label-top" : "",
100
+ reProps.value.formItemOptions.labelWidth === "100%" ? "qd-form-item--label-width-full" : "",
101
+ !reProps.value.configRendererOptions.config && !_ctx.$slots.default ? "qd-form-item--empty-content" : ""
99
102
  ]
100
103
  }, reProps.value.gridItemOptions), {
101
104
  default: withCtx(() => [
@@ -9,13 +9,11 @@
9
9
  border-bottom: 1px solid var(--td-component-stroke);
10
10
  }
11
11
  .qd-multi-file-viewer .t-dialog .t-dialog__body,
12
- .qd-multi-file-viewer .qd-dialog .t-dialog__body,
13
- .qd-multi-file-viewer .t-dialog .t-dialog:has(.t-dialog__footer) .t-dialog__body,
14
- .qd-multi-file-viewer .qd-dialog .t-dialog:has(.t-dialog__footer) .t-dialog__body,
12
+ .qd-multi-file-viewer.qd-dialog .t-dialog__body,
15
13
  .qd-multi-file-viewer .t-dialog .t-dialog__body--fullscreen,
16
- .qd-multi-file-viewer .qd-dialog .t-dialog__body--fullscreen,
14
+ .qd-multi-file-viewer.qd-dialog .t-dialog__body--fullscreen,
17
15
  .qd-multi-file-viewer .t-dialog .t-dialog__body--fullscreen--without-footer,
18
- .qd-multi-file-viewer .qd-dialog .t-dialog__body--fullscreen--without-footer {
16
+ .qd-multi-file-viewer.qd-dialog .t-dialog__body--fullscreen--without-footer {
19
17
  padding: 0 !important;
20
18
  }
21
19
  .qd-multi-file-viewer__body {
@@ -4,7 +4,7 @@ import _sfc_main from "./index.vue2.mjs";
4
4
  /* empty css */
5
5
  /* empty css */
6
6
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
7
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-777a7929"]]);
7
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-2084d5ab"]]);
8
8
  export {
9
9
  index as default
10
10
  };
@@ -1,10 +1,10 @@
1
1
  import './index2.css'
2
2
  import './index.css'
3
- import { defineComponent, mergeDefaults, useTemplateRef, ref, reactive, computed, watch, createVNode, onMounted, createBlock, openBlock, unref, mergeProps, isRef, withCtx, renderSlot, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString, createSlots, normalizeProps, guardReactiveProps } from "vue";
3
+ import { defineComponent, mergeDefaults, useTemplateRef, ref, reactive, computed, watch, createVNode, onMounted, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString, isRef, createSlots, normalizeProps, guardReactiveProps } from "vue";
4
4
  import { useVModels } from "../../node_modules/.pnpm/@vueuse_core@14.2.0_vue@3.5.26_typescript@5.9.3_/node_modules/@vueuse/core/dist/index.mjs";
5
5
  import { isEmpty, identifyType, extractSlotsWithPrefix, hasOwn } from "qidian-shared";
6
6
  import { AddIcon, SearchIcon } from "tdesign-icons-vue-next";
7
- import { Popup, Select, Option, Input, Space, Button } from "tdesign-vue-next";
7
+ import { Popup, Select, Option, InputAdornment, Input, Button, Space } from "tdesign-vue-next";
8
8
  import { useConfig } from "../config-provider/useConfig.mjs";
9
9
  import { qdDialogTableSelectSearchGrid } from "../service-dialog-table-select/props.mjs";
10
10
  import { qdServiceSelectKeys } from "../service-select/props.mjs";
@@ -30,6 +30,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
30
30
  addConfirmBtn: {},
31
31
  addCancelBtn: {},
32
32
  addInput: {},
33
+ mode: {},
34
+ quoteBtn: {},
33
35
  title: {},
34
36
  permiPrefix: {},
35
37
  tableMinHeight: {
@@ -350,7 +352,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
350
352
  const reProps = computed(() => {
351
353
  const {
352
354
  modelValue: modelValue2,
353
- popupVisible: popupVisible2,
355
+ popupVisible: popupVisibleProp,
354
356
  popupProps,
355
357
  fillOptions,
356
358
  searchData: searchData2,
@@ -367,6 +369,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
367
369
  valueType,
368
370
  clearable,
369
371
  creatable,
372
+ mode,
373
+ quoteBtn,
370
374
  placeholder,
371
375
  size,
372
376
  onClear,
@@ -387,7 +391,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
387
391
  });
388
392
  const onVisibleChange = rePopupOptions.onVisibleChange;
389
393
  rePopupOptions.onVisibleChange = (visible, context) => {
394
+ if (mode === "input" && !popupVisible.value && visible) return;
390
395
  onVisibleChange?.(visible, context);
396
+ popupVisible.value = visible;
391
397
  if (visible) {
392
398
  fillOptionsWatchStop?.();
393
399
  handleOpen();
@@ -449,8 +455,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
449
455
  ...qdServiceSelectKeys,
450
456
  ...keys
451
457
  };
458
+ const effectiveCreatable = mode === "input" || creatable;
459
+ const quoteBtnOptions = merge({}, {
460
+ content: "引用",
461
+ onClick: openPopup,
462
+ disabled: tdReadonly.value || tdDisabled.value
463
+ }, typeof quoteBtn === "string" ? {
464
+ content: quoteBtn
465
+ } : quoteBtn);
452
466
  return {
453
- creatable,
467
+ mode,
468
+ creatable: effectiveCreatable,
469
+ quoteBtnOptions,
454
470
  fillOptions,
455
471
  keys: reKeys,
456
472
  popupOptions: rePopupOptions,
@@ -482,7 +498,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
482
498
  addInputOptions,
483
499
  models: {
484
500
  modelValue: modelValue2,
485
- popupVisible: popupVisible2,
501
+ popupVisible: popupVisibleProp,
486
502
  searchData: searchData2,
487
503
  data: inData,
488
504
  columnControllerVisible: columnControllerVisible2,
@@ -516,6 +532,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
516
532
  }
517
533
  return modelValue.value;
518
534
  });
535
+ const inputValue = computed({
536
+ get: () => modelValue.value ?? "",
537
+ set: (val) => {
538
+ modelValue.value = val;
539
+ }
540
+ });
541
+ let lastConfirmedValue;
542
+ let suppressNextBlur = false;
519
543
  function cleanEmptyChildren(rows, childrenKey) {
520
544
  if (!childrenKey) return rows;
521
545
  return rows.map((row) => {
@@ -568,6 +592,33 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
568
592
  selectedRowKeys.value = isEmpty(modelValue.value) ? [] : [modelValue.value];
569
593
  }
570
594
  }
595
+ function openPopup(e) {
596
+ e.stopPropagation();
597
+ if (tdReadonly.value || tdDisabled.value) return;
598
+ popupVisible.value = true;
599
+ reProps.value.popupOptions.onVisibleChange?.(true, {
600
+ e,
601
+ trigger: "trigger-element-click"
602
+ });
603
+ }
604
+ function onInputFocus() {
605
+ lastConfirmedValue = modelValue.value;
606
+ }
607
+ function onInputBlur(_value) {
608
+ if (suppressNextBlur) {
609
+ suppressNextBlur = false;
610
+ return;
611
+ }
612
+ const value = modelValue.value;
613
+ if (value === lastConfirmedValue) return;
614
+ lastConfirmedValue = value;
615
+ confirmCustom(value);
616
+ }
617
+ function onInputClear(context) {
618
+ suppressNextBlur = true;
619
+ handleClear(context);
620
+ lastConfirmedValue = modelValue.value;
621
+ }
571
622
  function handleClear(context) {
572
623
  selectedRowKeys.value = [];
573
624
  selectedRows.value = [];
@@ -580,6 +631,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
580
631
  });
581
632
  reProps.value.onClear?.(context);
582
633
  }
634
+ function confirmCustom(value, e) {
635
+ reProps.value.onCreate?.(value);
636
+ reProps.value.onChange?.(value, {
637
+ e,
638
+ option: null,
639
+ selectedOptions: [],
640
+ trigger: "check"
641
+ });
642
+ }
583
643
  function confirmAddCustom(e) {
584
644
  reProps.value.onCreate?.(addCustom.value);
585
645
  reProps.value.onChange?.(addCustom.value, {
@@ -614,43 +674,42 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
614
674
  __expose(expose);
615
675
  return (_ctx, _cache) => {
616
676
  return openBlock(), createBlock(unref(Popup), mergeProps({
617
- modelValue: unref(popupVisible),
618
- "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => isRef(popupVisible) ? popupVisible.value = $event : null)
677
+ visible: unref(popupVisible)
619
678
  }, reProps.value.popupOptions), {
620
679
  content: withCtx(() => [createVNode(unref(QdCrudTable), mergeProps({
621
680
  ref: "table",
622
681
  class: "qd-popup-table-select__table",
623
682
  "search-data": unref(searchData),
624
- "onUpdate:searchData": _cache[1] || (_cache[1] = ($event) => isRef(searchData) ? searchData.value = $event : null),
683
+ "onUpdate:searchData": _cache[2] || (_cache[2] = ($event) => isRef(searchData) ? searchData.value = $event : null),
625
684
  data: unref(data),
626
- "onUpdate:data": _cache[2] || (_cache[2] = ($event) => isRef(data) ? data.value = $event : null),
685
+ "onUpdate:data": _cache[3] || (_cache[3] = ($event) => isRef(data) ? data.value = $event : null),
627
686
  "selected-row-keys": selectedRowKeys.value,
628
- "onUpdate:selectedRowKeys": _cache[3] || (_cache[3] = ($event) => selectedRowKeys.value = $event),
687
+ "onUpdate:selectedRowKeys": _cache[4] || (_cache[4] = ($event) => selectedRowKeys.value = $event),
629
688
  "active-row-keys": selectedRowKeys.value,
630
- "onUpdate:activeRowKeys": _cache[4] || (_cache[4] = ($event) => selectedRowKeys.value = $event),
689
+ "onUpdate:activeRowKeys": _cache[5] || (_cache[5] = ($event) => selectedRowKeys.value = $event),
631
690
  "column-controller-visible": unref(columnControllerVisible),
632
- "onUpdate:columnControllerVisible": _cache[5] || (_cache[5] = ($event) => isRef(columnControllerVisible) ? columnControllerVisible.value = $event : null),
691
+ "onUpdate:columnControllerVisible": _cache[6] || (_cache[6] = ($event) => isRef(columnControllerVisible) ? columnControllerVisible.value = $event : null),
633
692
  "expanded-rowKeys": unref(expandedRowKeys),
634
- "onUpdate:expandedRowKeys": _cache[6] || (_cache[6] = ($event) => isRef(expandedRowKeys) ? expandedRowKeys.value = $event : null),
693
+ "onUpdate:expandedRowKeys": _cache[7] || (_cache[7] = ($event) => isRef(expandedRowKeys) ? expandedRowKeys.value = $event : null),
635
694
  "filter-value": unref(filterValue),
636
- "onUpdate:filterValue": _cache[7] || (_cache[7] = ($event) => isRef(filterValue) ? filterValue.value = $event : null),
695
+ "onUpdate:filterValue": _cache[8] || (_cache[8] = ($event) => isRef(filterValue) ? filterValue.value = $event : null),
637
696
  sort: unref(sort),
638
- "onUpdate:sort": _cache[8] || (_cache[8] = ($event) => isRef(sort) ? sort.value = $event : null),
697
+ "onUpdate:sort": _cache[9] || (_cache[9] = ($event) => isRef(sort) ? sort.value = $event : null),
639
698
  "expanded-tree-nodes": unref(expandedTreeNodes),
640
- "onUpdate:expandedTreeNodes": _cache[9] || (_cache[9] = ($event) => isRef(expandedTreeNodes) ? expandedTreeNodes.value = $event : null),
699
+ "onUpdate:expandedTreeNodes": _cache[10] || (_cache[10] = ($event) => isRef(expandedTreeNodes) ? expandedTreeNodes.value = $event : null),
641
700
  "reserve-selected-row-on-paginate": "",
642
701
  "active-row-type": "multiple"
643
702
  }, reProps.value.tableOptions, {
644
703
  onSelectChange: handleSelectChange
645
704
  }), createSlots({
646
705
  _: 2
647
- }, [reProps.value.creatable ? {
706
+ }, [reProps.value.mode === "select" && reProps.value.creatable ? {
648
707
  name: "table-bottom-content",
649
708
  fn: withCtx(() => [addCustom.visible ? (openBlock(), createElementBlock("div", _hoisted_1, [renderSlot(_ctx.$slots, "add-input", {
650
709
  addCustom
651
710
  }, () => [createVNode(unref(Input), mergeProps({
652
711
  modelValue: addCustom.value,
653
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => addCustom.value = $event),
712
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => addCustom.value = $event),
654
713
  autofocus: ""
655
714
  }, reProps.value.addInputOptions), null, 16, ["modelValue"])], true), createVNode(unref(Space), {
656
715
  size: "small"
@@ -683,7 +742,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
683
742
  })]), 1040, ["search-data", "data", "selected-row-keys", "active-row-keys", "column-controller-visible", "expanded-rowKeys", "filter-value", "sort", "expanded-tree-nodes"])]),
684
743
  default: withCtx(() => [renderSlot(_ctx.$slots, "default", {
685
744
  selectedRows: selectedRows.value
686
- }, () => [createVNode(unref(Select), mergeProps({
745
+ }, () => [reProps.value.mode === "select" ? (openBlock(), createBlock(unref(Select), mergeProps({
746
+ key: 0,
687
747
  "model-value": selectValue.value,
688
748
  options: selectedRows.value,
689
749
  "popup-visible": false
@@ -702,9 +762,28 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
702
762
  }, 1032, ["value", "label"]);
703
763
  }), 128))]),
704
764
  _: 1
705
- }, 16, ["model-value", "options"])], true)]),
765
+ }, 16, ["model-value", "options"])) : (openBlock(), createBlock(unref(InputAdornment), {
766
+ key: 1
767
+ }, {
768
+ append: withCtx(() => [createVNode(unref(Button), mergeProps({
769
+ class: "qd-popup-table-select__input-trigger"
770
+ }, reProps.value.quoteBtnOptions), null, 16)]),
771
+ default: withCtx(() => [createVNode(unref(Input), {
772
+ modelValue: inputValue.value,
773
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event),
774
+ clearable: reProps.value.selectOptions.clearable,
775
+ readonly: reProps.value.selectOptions.readonly,
776
+ disabled: reProps.value.selectOptions.disabled,
777
+ placeholder: reProps.value.selectOptions.placeholder,
778
+ size: reProps.value.selectOptions.size,
779
+ onFocus: onInputFocus,
780
+ onBlur: onInputBlur,
781
+ onClear: onInputClear
782
+ }, null, 8, ["modelValue", "clearable", "readonly", "disabled", "placeholder", "size"])]),
783
+ _: 1
784
+ }))], true)]),
706
785
  _: 3
707
- }, 16, ["modelValue"]);
786
+ }, 16, ["visible"]);
708
787
  };
709
788
  }
710
789
  });
@@ -1,19 +1,23 @@
1
- .qd-popup-table-select__table[data-v-777a7929] .qd-crud-search > .t-loading__parent > .t-card__body,
2
- .qd-popup-table-select__table[data-v-777a7929] .qd-crud-table__body > .t-loading__parent > .t-card__body {
1
+ .qd-popup-table-select__table[data-v-2084d5ab] .qd-crud-search > .t-loading__parent > .t-card__body,
2
+ .qd-popup-table-select__table[data-v-2084d5ab] .qd-crud-table__body > .t-loading__parent > .t-card__body {
3
3
  padding: 0 !important;
4
4
  }
5
- .qd-popup-table-select__table[data-v-777a7929] .qd-crud-table__toolbar {
5
+ .qd-popup-table-select__table[data-v-2084d5ab] .qd-crud-table__toolbar {
6
6
  display: none;
7
7
  }
8
- .qd-popup-table-select__table[data-v-777a7929] .qd-service-table {
8
+ .qd-popup-table-select__table[data-v-2084d5ab] .qd-service-table {
9
9
  margin-top: 0;
10
10
  }
11
- .qd-popup-table-select__table-add[data-v-777a7929] {
11
+ .qd-popup-table-select__table-add[data-v-2084d5ab] {
12
12
  margin-top: var(--td-comp-margin-m);
13
13
  display: flex;
14
14
  }
15
- .qd-popup-table-select__table-add .t-input__wrap[data-v-777a7929] {
15
+ .qd-popup-table-select__table-add .t-input__wrap[data-v-2084d5ab] {
16
16
  flex: 1 1 0;
17
17
  overflow: hidden;
18
18
  margin-right: var(--td-comp-margin-m);
19
19
  }
20
+ .qd-popup-table-select__input-trigger[data-v-2084d5ab] {
21
+ border-top-left-radius: 0;
22
+ border-bottom-left-radius: 0;
23
+ }
@@ -5,6 +5,7 @@ export declare const qdServicePopupTableSelectProps: {
5
5
  readonly disabled: undefined;
6
6
  readonly clearable: false;
7
7
  readonly valueType: "value";
8
+ readonly mode: "select";
8
9
  readonly data: () => never[];
9
10
  readonly columnControllerVisible: undefined;
10
11
  readonly displayColumns: undefined;
@@ -13,7 +13,8 @@ const qdServicePopupTableSelectProps = {
13
13
  readonly: void 0,
14
14
  disabled: void 0,
15
15
  clearable: false,
16
- valueType: "value"
16
+ valueType: "value",
17
+ mode: "select"
17
18
  };
18
19
  const qdServicePopupProps = {
19
20
  placement: "bottom-left"
@@ -9,5 +9,7 @@ export interface QdServicePopupTableSelectProps<D extends TableRowData = TableRo
9
9
  addConfirmBtn?: string | TdButtonProps | null;
10
10
  addCancelBtn?: string | TdButtonProps | null;
11
11
  addInput?: string | TdInputProps | null;
12
+ mode?: 'select' | 'input';
13
+ quoteBtn?: string | TdButtonProps | null;
12
14
  }
13
15
  export type QdServicePopupTableSelectInstanceFunctions = QdCrudTableInstanceFunctions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qidian-vue-ui",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "基于 TDesign 的 QiDian Vue UI 组件库",
5
5
  "author": "qidian",
6
6
  "license": "MIT",