qidian-vue-ui 2.7.4 → 2.8.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.
@@ -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;
@@ -239,9 +239,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
239
239
  }
240
240
  function setDefaultSelectFirst(data) {
241
241
  if (!hasAutoSelected && reProps.value.defaultSelectFirst && isEmpty(reModelValue.value) && data.length) {
242
- const firstOption = data.find((option) => !option.disabled);
242
+ const { keys, multiple, valueType } = reProps.value.selectOptions;
243
+ const firstOption = data.find(
244
+ (option) => !option[keys?.disabled || "disabled"]
245
+ );
243
246
  if (!firstOption) return;
244
- const { multiple, valueType } = reProps.value.selectOptions;
245
247
  const firstValue = valueType === "object" ? firstOption : firstOption.value;
246
248
  const value = multiple ? [firstValue] : firstValue;
247
249
  reModelValue.value = value;
@@ -1,4 +1,4 @@
1
- .qd-service-select__load[data-v-893f4675] {
1
+ .qd-service-select__load[data-v-676b5752] {
2
2
  width: 100%;
3
3
  border-top: 1px solid var(--td-component-stroke);
4
4
  padding: 6px;
@@ -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 QdServiceSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-893f4675"]]);
7
+ const QdServiceSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-676b5752"]]);
8
8
  export {
9
9
  QdServiceSelect as default
10
10
  };
@@ -404,9 +404,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
404
404
  }
405
405
  function setDefaultSelectFirst(data2) {
406
406
  if (!hasAutoSelected && reProps.value.defaultSelectFirst && isEmpty(reModelValue.value) && data2.length) {
407
- const firstOption = data2.find((option) => !option.disabled);
408
- if (!firstOption) return;
409
407
  const { keys, multiple, valueType } = reProps.value.selectOptions;
408
+ const firstOption = data2.find(
409
+ (option) => !option[keys?.disabled || qdServiceSelectKeys.disabled]
410
+ );
411
+ if (!firstOption) return;
410
412
  const firstValue = valueType === "object" ? firstOption : firstOption[keys?.value || qdServiceSelectKeys.value];
411
413
  reModelValue.value = multiple ? [firstValue] : firstValue;
412
414
  unWatchAutoSelected?.();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qidian-vue-ui",
3
- "version": "2.7.4",
3
+ "version": "2.8.0",
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",