qidian-vue-ui 2.7.5 → 2.8.1

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.
@@ -30,7 +30,7 @@ export interface QdCrudTableActionContext<D extends TableRowData = TableRowData>
30
30
  activeRowKeys: NonNullable<QdServiceTableProps['selectedRowKeys']>;
31
31
  self: QdCrudTableAction<D>;
32
32
  }
33
- export interface QdCrudTableAction<D extends TableRowData = TableRowData, R = unknown, P = object, TP = P> extends QdCrudTableWrapper<R, P, TP>, Qd2ConfigValue<Omit<TdButtonProps, 'default' | 'form' | 'onClick'>> {
33
+ export interface QdCrudTableAction<D extends TableRowData = TableRowData, R = unknown, P = object, TP = P> extends QdCrudTableWrapper<R, P, TP>, Pick<QdComponentConfig, 'ifRender'>, Qd2ConfigValue<Omit<TdButtonProps, 'default' | 'form' | 'onClick'>> {
34
34
  uid?: string;
35
35
  permiID?: string;
36
36
  permi?: string[];
@@ -1,3 +1,3 @@
1
- .qd-dict-checkbox-group[data-v-f8c31d38] .t-loading {
1
+ .qd-dict-checkbox-group[data-v-891f893c] .t-loading {
2
2
  position: relative;
3
3
  }
@@ -11,5 +11,6 @@ declare const _default: import("vue").DefineComponent<QdDictCheckboxGroupProps,
11
11
  modelValue: import("tdesign-vue-next").CheckboxGroupValue | string;
12
12
  defaultValue: import("tdesign-vue-next").CheckboxGroupValue;
13
13
  convStr: boolean | string;
14
+ strict: boolean;
14
15
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
16
  export default _default;
@@ -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 index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f8c31d38"]]);
5
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-891f893c"]]);
6
6
  export {
7
7
  index as default
8
8
  };
@@ -14,6 +14,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
14
14
  props: /* @__PURE__ */ mergeDefaults({
15
15
  dictType: {},
16
16
  convStr: { type: [Boolean, String] },
17
+ strict: { type: Boolean },
17
18
  modelValue: {},
18
19
  disabled: { type: Boolean },
19
20
  lazyLoad: { type: Boolean },
@@ -40,26 +41,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
40
41
  (typeof convStr === "string" ? convStr : "") || qdDictConvStrSeparator
41
42
  );
42
43
  }
43
- return modelValue.value;
44
+ if (reProps.value.strict) return modelValue.value;
45
+ return modelValue.value.map((item) => String(item));
44
46
  },
45
47
  set: (val) => {
46
48
  const { convStr } = reProps.value;
47
- if (convStr) {
48
- modelValue.value = val.join(
49
+ if (convStr)
50
+ return modelValue.value = val.join(
49
51
  (typeof convStr === "string" ? convStr : "") || qdDictConvStrSeparator
50
52
  );
51
- } else {
52
- modelValue.value = val;
53
- }
53
+ modelValue.value = reProps.value.strict ? val : val.map((item) => typeof item === "string" ? Number(item) : item);
54
54
  }
55
55
  });
56
56
  const dictType = toRef(props, "dictType");
57
57
  const reProps = computed(() => {
58
- const { modelValue: modelValue2, dictType: dictType2, convStr, options, ...checkboxOptions } = props;
58
+ const { modelValue: modelValue2, dictType: dictType2, convStr, options, strict, ...checkboxOptions } = props;
59
59
  return {
60
60
  dictType: dictType2,
61
61
  convStr,
62
62
  options,
63
+ strict,
63
64
  checkboxOptions,
64
65
  models: {
65
66
  modelValue: modelValue2
@@ -67,9 +68,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
67
68
  };
68
69
  });
69
70
  const { options: dictOptions, loading: dictLoading } = useDictDynamic(dictType);
70
- const reDictOptions = computed(
71
- () => isEmpty(reProps.value.options) ? dictOptions.value : reProps.value.options
72
- );
71
+ const reDictOptions = computed(() => {
72
+ const raw = isEmpty(reProps.value.options) ? dictOptions.value : reProps.value.options;
73
+ if (reProps.value.strict) return raw;
74
+ return raw.map((item) => ({ ...item, value: String(item.value) }));
75
+ });
73
76
  return (_ctx, _cache) => {
74
77
  return withDirectives((openBlock(), createBlock(unref(CheckboxGroup), mergeProps({
75
78
  modelValue: reModelValue.value,
@@ -6,4 +6,5 @@ export declare const qdDictCheckboxGroupProps: {
6
6
  readonly value: () => never[];
7
7
  readonly defaultValue: () => never[];
8
8
  readonly convStr: false;
9
+ readonly strict: false;
9
10
  };
@@ -5,7 +5,8 @@ const qdDictCheckboxGroupProps = {
5
5
  modelValue: () => [],
6
6
  value: () => [],
7
7
  defaultValue: () => [],
8
- convStr: false
8
+ convStr: false,
9
+ strict: false
9
10
  };
10
11
  export {
11
12
  qdDictCheckboxGroupProps
@@ -2,5 +2,6 @@ import type { CheckboxGroupValue, TdCheckboxGroupProps } from 'tdesign-vue-next'
2
2
  export interface QdDictCheckboxGroupProps extends Omit<TdCheckboxGroupProps, 'modelValue'> {
3
3
  dictType?: string;
4
4
  convStr?: boolean | string;
5
+ strict?: boolean;
5
6
  modelValue?: CheckboxGroupValue | string;
6
7
  }
@@ -1,3 +1,3 @@
1
- .qd-dict-radio-group[data-v-415af65d] .t-loading {
1
+ .qd-dict-radio-group[data-v-e0d2a59c] .t-loading {
2
2
  position: relative;
3
3
  }
@@ -9,5 +9,6 @@ declare const _default: import("vue").DefineComponent<QdDictRadioGroupProps, {},
9
9
  readonly: boolean;
10
10
  variant: "outline" | "primary-filled" | "default-filled";
11
11
  allowUncheck: boolean;
12
+ strict: boolean;
12
13
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
14
  export default _default;
@@ -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 index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-415af65d"]]);
5
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e0d2a59c"]]);
6
6
  export {
7
7
  index as default
8
8
  };
@@ -1,5 +1,5 @@
1
1
  import './index.css'
2
- import { defineComponent, mergeDefaults, toRef, computed, withDirectives, createBlock, openBlock, unref, mergeProps, isRef } from "vue";
2
+ import { defineComponent, mergeDefaults, toRef, computed, withDirectives, createBlock, openBlock, unref, mergeProps } 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
4
  import { isEmpty } from "qidian-shared";
5
5
  import { RadioGroup, LoadingDirective } from "tdesign-vue-next";
@@ -12,6 +12,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
12
12
  __name: "index",
13
13
  props: /* @__PURE__ */ mergeDefaults({
14
14
  dictType: {},
15
+ strict: { type: Boolean },
15
16
  allowUncheck: { type: Boolean },
16
17
  direction: {},
17
18
  disabled: { type: Boolean },
@@ -33,11 +34,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
33
34
  const emit = __emit;
34
35
  const { modelValue } = useVModels(props, emit);
35
36
  const dictType = toRef(props, "dictType");
37
+ const reModelValue = computed({
38
+ get: () => {
39
+ if (reProps.value.strict || typeof modelValue.value !== "number") return modelValue.value;
40
+ return String(modelValue.value);
41
+ },
42
+ set: (val) => {
43
+ modelValue.value = !reProps.value.strict && typeof val === "string" ? Number(val) : val;
44
+ }
45
+ });
36
46
  const reProps = computed(() => {
37
- const { modelValue: modelValue2, dictType: dictType2, options, ...radioOptions } = props;
47
+ const { modelValue: modelValue2, dictType: dictType2, options, strict, ...radioOptions } = props;
38
48
  return {
39
49
  dictType: dictType2,
40
50
  options,
51
+ strict,
41
52
  radioOptions,
42
53
  models: {
43
54
  modelValue: modelValue2
@@ -45,13 +56,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
45
56
  };
46
57
  });
47
58
  const { options: dictOptions, loading: dictLoading } = useDictDynamic(dictType);
48
- const reDictOptions = computed(
49
- () => isEmpty(reProps.value.options) ? dictOptions.value : reProps.value.options
50
- );
59
+ const reDictOptions = computed(() => {
60
+ const raw = isEmpty(reProps.value.options) ? dictOptions.value : reProps.value.options;
61
+ if (reProps.value.strict) return raw;
62
+ return raw.map((item) => ({ ...item, value: String(item.value) }));
63
+ });
51
64
  return (_ctx, _cache) => {
52
65
  return withDirectives((openBlock(), createBlock(unref(RadioGroup), mergeProps({
53
- modelValue: unref(modelValue),
54
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
66
+ modelValue: reModelValue.value,
67
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => reModelValue.value = $event),
55
68
  class: "qd-dict-radio-group"
56
69
  }, reProps.value.radioOptions, { options: reDictOptions.value }), null, 16, ["modelValue", "options"])), [
57
70
  [unref(vLoading), { loading: unref(dictLoading), size: "small" }]
@@ -2,6 +2,7 @@ export declare const qdDictRadioGroupProps: {
2
2
  readonly allowUncheck: false;
3
3
  readonly disabled: undefined;
4
4
  readonly readonly: undefined;
5
+ readonly strict: false;
5
6
  readonly theme: "radio";
6
7
  readonly variant: "outline";
7
8
  };
@@ -2,6 +2,7 @@ const qdDictRadioGroupProps = {
2
2
  allowUncheck: false,
3
3
  disabled: void 0,
4
4
  readonly: void 0,
5
+ strict: false,
5
6
  theme: "radio",
6
7
  variant: "outline"
7
8
  };
@@ -1,4 +1,5 @@
1
1
  import type { TdRadioGroupProps } from 'tdesign-vue-next';
2
2
  export interface QdDictRadioGroupProps extends TdRadioGroupProps {
3
3
  dictType?: string;
4
+ strict?: boolean;
4
5
  }
@@ -23,8 +23,8 @@ declare const __VLS_component: import("vue").DefineComponent<QdDictSelectProps,
23
23
  convStr: boolean | string;
24
24
  popupVisible: boolean;
25
25
  valueType: "value" | "object";
26
- dedupe: boolean;
27
26
  strict: boolean;
27
+ dedupe: boolean;
28
28
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
29
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
30
30
  export default _default;
@@ -1,6 +1,6 @@
1
- .qd-form-item[data-v-e77adabb] > .t-form__item > .t-form__controls > .t-form__controls-content > *:not(.t-switch):not(.t-tag):not(.t-icon):not(.qd-file-icon) {
1
+ .qd-form-item[data-v-c50cabe3] > .t-form__item > .t-form__controls > .t-form__controls-content > *:not(.t-switch):not(.t-tag):not(.t-icon):not(.qd-file-icon) {
2
2
  width: 100%;
3
3
  }
4
- .qd-form-item__component[data-v-e77adabb]:not(.t-switch):not(.t-tag):not(.t-icon):not(.qd-file-icon) {
4
+ .qd-form-item__component[data-v-c50cabe3]:not(.t-switch):not(.t-tag):not(.t-icon):not(.qd-file-icon) {
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-e77adabb"]]);
5
+ const QdFormItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c50cabe3"]]);
6
6
  export {
7
7
  QdFormItem as default
8
8
  };
@@ -19,6 +19,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
19
19
  props: /* @__PURE__ */ mergeDefaults({
20
20
  context: {},
21
21
  component: {},
22
+ label: { type: [Function, Object] },
22
23
  required: { type: [Boolean, String] },
23
24
  ifRender: { type: [Boolean, Function, Object] },
24
25
  help: { type: [String, Function, Object] },
@@ -27,7 +28,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
27
28
  trimOnBlur: { type: Boolean },
28
29
  gridIndex: {},
29
30
  for: {},
30
- label: {},
31
31
  labelAlign: {},
32
32
  labelWidth: {},
33
33
  name: {},
@@ -61,6 +61,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
61
61
  }
62
62
  return ifRender;
63
63
  });
64
+ const reLabel = computed(() => {
65
+ const label = props.label;
66
+ if (label?.__qdCompute || label?.__qdAsyncCompute) {
67
+ const { result } = qdUseComputeValue(
68
+ label,
69
+ currentContext,
70
+ props.crudMode
71
+ );
72
+ return result.value;
73
+ }
74
+ return label;
75
+ });
64
76
  const gridDefaultProps = inject(PROVIDE_GRID_ITEM_PROPS_KEY, void 0);
65
77
  const gridWidth = inject(PROVIDE_GRID_WIDTH_KEY, ref(DEFAULT_GRID_WIDTH));
66
78
  const gridIndex = computed(() => props.gridIndex);
@@ -95,12 +107,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
95
107
  const { component: reComponent, rules: wrappedRules } = resolveQdFormItemOptions({
96
108
  formItem: props,
97
109
  context: currentContext.value,
98
- label: formItemOptions.label,
110
+ label: reLabel.value,
99
111
  t
100
112
  });
101
113
  return {
102
114
  formItemOptions: {
103
115
  ...formItemOptions,
116
+ label: reLabel.value,
104
117
  rules: wrappedRules
105
118
  },
106
119
  gridItemOptions: { col, row },
@@ -10,9 +10,10 @@ export type QdFormBeforeSubmitQueueResult = boolean | {
10
10
  message?: string;
11
11
  };
12
12
  export type QdFormBeforeSubmitQueueItem = () => Promise<QdFormBeforeSubmitQueueResult> | QdFormBeforeSubmitQueueResult;
13
- export interface QdFormItemProps extends Omit<TdFormItemProps, 'rules' | 'help'>, AllowedComponentProps, QdGridItemProps, Pick<QdFormProps, 'crudMode' | 'defaultClearable'> {
13
+ export interface QdFormItemProps extends Omit<TdFormItemProps, 'label' | 'rules' | 'help'>, AllowedComponentProps, QdGridItemProps, Pick<QdFormProps, 'crudMode' | 'defaultClearable'> {
14
14
  context?: QdConfigRendererProps['context'];
15
15
  component?: QdConfigRendererProps['config'];
16
+ label?: QdConfigValue<TdFormItemProps['label']>;
16
17
  required?: boolean | string;
17
18
  ifRender?: QdConfigValue<boolean>;
18
19
  help?: TdFormItemProps['help'] | QdComputeFunction<TNodeReturnValue>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qidian-vue-ui",
3
- "version": "2.7.5",
3
+ "version": "2.8.1",
4
4
  "description": "基于 TDesign 的 QiDian Vue UI 组件库",
5
5
  "author": "qidian",
6
6
  "license": "MIT",
@@ -137,7 +137,7 @@
137
137
  "vue-codemirror": "^6.1.1",
138
138
  "vue-echarts": "^8.0.1",
139
139
  "vue-stream-markdown": "1.0.1-beta.1",
140
- "qidian-shared": "1.3.0"
140
+ "qidian-shared": "1.4.1"
141
141
  },
142
142
  "scripts": {
143
143
  "clean": "rm -rf dist",