3h1-ui 3.0.0-next.221 → 3.0.0-next.222

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.
package/es/index.js CHANGED
@@ -30003,6 +30003,13 @@ const shyTagBasicProps = reactive({
30003
30003
  type: Array,
30004
30004
  default: () => []
30005
30005
  },
30006
+ api: {
30007
+ type: Function
30008
+ },
30009
+ params: {
30010
+ type: Object,
30011
+ default: () => ({})
30012
+ },
30006
30013
  value: {
30007
30014
  type: [String, Number]
30008
30015
  },
@@ -30027,6 +30034,7 @@ const ShyTag = /* @__PURE__ */ defineComponent({
30027
30034
  const {
30028
30035
  prefixCls: prefixCls2
30029
30036
  } = useDesign$1("tag");
30037
+ const optionsRef = ref([]);
30030
30038
  const fieldNames = computed(() => ({
30031
30039
  label: "label",
30032
30040
  value: "value",
@@ -30034,7 +30042,20 @@ const ShyTag = /* @__PURE__ */ defineComponent({
30034
30042
  css: "cssClass",
30035
30043
  ...props2.fieldNames
30036
30044
  }));
30037
- const tag2 = computed(() => props2.options.find((item) => item[unref(fieldNames).value] == props2.value) ?? {
30045
+ watch(() => props2.options, (val) => {
30046
+ optionsRef.value = unref(val);
30047
+ }, {
30048
+ immediate: true,
30049
+ deep: true
30050
+ });
30051
+ watch(() => props2.params, async (val) => {
30052
+ if (!props2.api)
30053
+ return;
30054
+ optionsRef.value = await props2.api(val);
30055
+ }, {
30056
+ immediate: true
30057
+ });
30058
+ const tag2 = computed(() => unref(optionsRef).find((item) => item[unref(fieldNames).value] == props2.value) ?? {
30038
30059
  [unref(fieldNames).label]: "-",
30039
30060
  [unref(fieldNames).color]: "var(--gray-5)",
30040
30061
  [unref(fieldNames).css]: ""
@@ -49291,7 +49312,6 @@ const Descriptions = /* @__PURE__ */ defineComponent({
49291
49312
  setDescProps
49292
49313
  });
49293
49314
  const transformValue = (item) => {
49294
- const options = ref([]);
49295
49315
  const {
49296
49316
  field,
49297
49317
  componentProps: comProps,
@@ -49306,22 +49326,15 @@ const Descriptions = /* @__PURE__ */ defineComponent({
49306
49326
  } = unref(getProps);
49307
49327
  if ((summaryTotalFields == null ? void 0 : summaryTotalFields.length) && summaryTotalFields.includes(field)) {
49308
49328
  return handleValuePrecision(item, data);
49309
- } else if (componentProps == null ? void 0 : componentProps.options) {
49310
- const options2 = treeToList(componentProps.options);
49311
- return createVNode(ShyTag, mergeProps({
49312
- "value": data[`${field}`]
49313
- }, componentProps, {
49314
- "options": options2
49315
- }), null);
49316
- } else if (componentProps == null ? void 0 : componentProps.api) {
49317
- const params = (componentProps == null ? void 0 : componentProps.params) || {};
49318
- componentProps.api(params).then((res) => {
49319
- options.value = treeToList(res);
49320
- });
49329
+ } else if ((componentProps == null ? void 0 : componentProps.options) || (componentProps == null ? void 0 : componentProps.api)) {
49330
+ let options = [];
49331
+ if (Array.isArray(componentProps.options)) {
49332
+ options = treeToList(componentProps.options);
49333
+ }
49321
49334
  return createVNode(ShyTag, mergeProps({
49322
49335
  "value": data[`${field}`]
49323
49336
  }, componentProps, {
49324
- "options": unref(options)
49337
+ "options": options
49325
49338
  }), null);
49326
49339
  } else if (["DatePicker", "MonthPicker", "RangePicker", "WeekPicker", "TimePicker"].includes(component)) {
49327
49340
  if (!data[`${field}`])
@@ -3,6 +3,13 @@ declare const ShyTag: import("vue").DefineComponent<{
3
3
  type: ((new (...args: any[]) => Recordable<any>[]) | (() => Recordable<any>[])) | ((new (...args: any[]) => Recordable<any>[]) | (() => Recordable<any>[]))[];
4
4
  default: () => any[];
5
5
  };
6
+ api: {
7
+ type: FunctionConstructor;
8
+ };
9
+ params: {
10
+ type: ((new (...args: any[]) => Recordable<any>) | (() => Recordable<any>)) | ((new (...args: any[]) => Recordable<any>) | (() => Recordable<any>))[];
11
+ default: () => {};
12
+ };
6
13
  value: {
7
14
  type: (NumberConstructor | StringConstructor)[];
8
15
  };
@@ -42,6 +49,13 @@ declare const ShyTag: import("vue").DefineComponent<{
42
49
  type: ((new (...args: any[]) => Recordable<any>[]) | (() => Recordable<any>[])) | ((new (...args: any[]) => Recordable<any>[]) | (() => Recordable<any>[]))[];
43
50
  default: () => any[];
44
51
  };
52
+ api: {
53
+ type: FunctionConstructor;
54
+ };
55
+ params: {
56
+ type: ((new (...args: any[]) => Recordable<any>) | (() => Recordable<any>)) | ((new (...args: any[]) => Recordable<any>) | (() => Recordable<any>))[];
57
+ default: () => {};
58
+ };
45
59
  value: {
46
60
  type: (NumberConstructor | StringConstructor)[];
47
61
  };
@@ -78,6 +92,7 @@ declare const ShyTag: import("vue").DefineComponent<{
78
92
  };
79
93
  }>>, {
80
94
  options: Recordable<any>[];
95
+ params: {};
81
96
  fieldNames: {};
82
97
  isTag: boolean;
83
98
  tagMode: "text" | "tag" | "point";
@@ -3,6 +3,13 @@ export declare const shyTagBasicProps: {
3
3
  type: ((new (...args: any[]) => Recordable<any>[]) | (() => Recordable<any>[])) | ((new (...args: any[]) => Recordable<any>[]) | (() => Recordable<any>[]))[];
4
4
  default: () => any[];
5
5
  };
6
+ api: {
7
+ type: FunctionConstructor;
8
+ };
9
+ params: {
10
+ type: ((new (...args: any[]) => Recordable<any>) | (() => Recordable<any>)) | ((new (...args: any[]) => Recordable<any>) | (() => Recordable<any>))[];
11
+ default: () => {};
12
+ };
6
13
  value: {
7
14
  type: (NumberConstructor | StringConstructor)[];
8
15
  };
package/lib/index.js CHANGED
@@ -30027,6 +30027,13 @@ const shyTagBasicProps = vue.reactive({
30027
30027
  type: Array,
30028
30028
  default: () => []
30029
30029
  },
30030
+ api: {
30031
+ type: Function
30032
+ },
30033
+ params: {
30034
+ type: Object,
30035
+ default: () => ({})
30036
+ },
30030
30037
  value: {
30031
30038
  type: [String, Number]
30032
30039
  },
@@ -30051,6 +30058,7 @@ const ShyTag = /* @__PURE__ */ vue.defineComponent({
30051
30058
  const {
30052
30059
  prefixCls: prefixCls2
30053
30060
  } = use.useDesign("tag");
30061
+ const optionsRef = vue.ref([]);
30054
30062
  const fieldNames = vue.computed(() => ({
30055
30063
  label: "label",
30056
30064
  value: "value",
@@ -30058,7 +30066,20 @@ const ShyTag = /* @__PURE__ */ vue.defineComponent({
30058
30066
  css: "cssClass",
30059
30067
  ...props2.fieldNames
30060
30068
  }));
30061
- const tag2 = vue.computed(() => props2.options.find((item) => item[vue.unref(fieldNames).value] == props2.value) ?? {
30069
+ vue.watch(() => props2.options, (val) => {
30070
+ optionsRef.value = vue.unref(val);
30071
+ }, {
30072
+ immediate: true,
30073
+ deep: true
30074
+ });
30075
+ vue.watch(() => props2.params, async (val) => {
30076
+ if (!props2.api)
30077
+ return;
30078
+ optionsRef.value = await props2.api(val);
30079
+ }, {
30080
+ immediate: true
30081
+ });
30082
+ const tag2 = vue.computed(() => vue.unref(optionsRef).find((item) => item[vue.unref(fieldNames).value] == props2.value) ?? {
30062
30083
  [vue.unref(fieldNames).label]: "-",
30063
30084
  [vue.unref(fieldNames).color]: "var(--gray-5)",
30064
30085
  [vue.unref(fieldNames).css]: ""
@@ -49315,7 +49336,6 @@ const Descriptions = /* @__PURE__ */ vue.defineComponent({
49315
49336
  setDescProps
49316
49337
  });
49317
49338
  const transformValue = (item) => {
49318
- const options = vue.ref([]);
49319
49339
  const {
49320
49340
  field,
49321
49341
  componentProps: comProps,
@@ -49330,22 +49350,15 @@ const Descriptions = /* @__PURE__ */ vue.defineComponent({
49330
49350
  } = vue.unref(getProps);
49331
49351
  if ((summaryTotalFields == null ? void 0 : summaryTotalFields.length) && summaryTotalFields.includes(field)) {
49332
49352
  return handleValuePrecision(item, data);
49333
- } else if (componentProps == null ? void 0 : componentProps.options) {
49334
- const options2 = treeToList(componentProps.options);
49335
- return vue.createVNode(ShyTag, vue.mergeProps({
49336
- "value": data[`${field}`]
49337
- }, componentProps, {
49338
- "options": options2
49339
- }), null);
49340
- } else if (componentProps == null ? void 0 : componentProps.api) {
49341
- const params = (componentProps == null ? void 0 : componentProps.params) || {};
49342
- componentProps.api(params).then((res) => {
49343
- options.value = treeToList(res);
49344
- });
49353
+ } else if ((componentProps == null ? void 0 : componentProps.options) || (componentProps == null ? void 0 : componentProps.api)) {
49354
+ let options = [];
49355
+ if (Array.isArray(componentProps.options)) {
49356
+ options = treeToList(componentProps.options);
49357
+ }
49345
49358
  return vue.createVNode(ShyTag, vue.mergeProps({
49346
49359
  "value": data[`${field}`]
49347
49360
  }, componentProps, {
49348
- "options": vue.unref(options)
49361
+ "options": options
49349
49362
  }), null);
49350
49363
  } else if (["DatePicker", "MonthPicker", "RangePicker", "WeekPicker", "TimePicker"].includes(component)) {
49351
49364
  if (!data[`${field}`])
@@ -3,6 +3,13 @@ declare const ShyTag: import("vue").DefineComponent<{
3
3
  type: ((new (...args: any[]) => Recordable<any>[]) | (() => Recordable<any>[])) | ((new (...args: any[]) => Recordable<any>[]) | (() => Recordable<any>[]))[];
4
4
  default: () => any[];
5
5
  };
6
+ api: {
7
+ type: FunctionConstructor;
8
+ };
9
+ params: {
10
+ type: ((new (...args: any[]) => Recordable<any>) | (() => Recordable<any>)) | ((new (...args: any[]) => Recordable<any>) | (() => Recordable<any>))[];
11
+ default: () => {};
12
+ };
6
13
  value: {
7
14
  type: (NumberConstructor | StringConstructor)[];
8
15
  };
@@ -42,6 +49,13 @@ declare const ShyTag: import("vue").DefineComponent<{
42
49
  type: ((new (...args: any[]) => Recordable<any>[]) | (() => Recordable<any>[])) | ((new (...args: any[]) => Recordable<any>[]) | (() => Recordable<any>[]))[];
43
50
  default: () => any[];
44
51
  };
52
+ api: {
53
+ type: FunctionConstructor;
54
+ };
55
+ params: {
56
+ type: ((new (...args: any[]) => Recordable<any>) | (() => Recordable<any>)) | ((new (...args: any[]) => Recordable<any>) | (() => Recordable<any>))[];
57
+ default: () => {};
58
+ };
45
59
  value: {
46
60
  type: (NumberConstructor | StringConstructor)[];
47
61
  };
@@ -78,6 +92,7 @@ declare const ShyTag: import("vue").DefineComponent<{
78
92
  };
79
93
  }>>, {
80
94
  options: Recordable<any>[];
95
+ params: {};
81
96
  fieldNames: {};
82
97
  isTag: boolean;
83
98
  tagMode: "text" | "tag" | "point";
@@ -3,6 +3,13 @@ export declare const shyTagBasicProps: {
3
3
  type: ((new (...args: any[]) => Recordable<any>[]) | (() => Recordable<any>[])) | ((new (...args: any[]) => Recordable<any>[]) | (() => Recordable<any>[]))[];
4
4
  default: () => any[];
5
5
  };
6
+ api: {
7
+ type: FunctionConstructor;
8
+ };
9
+ params: {
10
+ type: ((new (...args: any[]) => Recordable<any>) | (() => Recordable<any>)) | ((new (...args: any[]) => Recordable<any>) | (() => Recordable<any>))[];
11
+ default: () => {};
12
+ };
6
13
  value: {
7
14
  type: (NumberConstructor | StringConstructor)[];
8
15
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "3h1-ui",
3
- "version": "3.0.0-next.221",
3
+ "version": "3.0.0-next.222",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -29,8 +29,8 @@
29
29
  "vue-json-pretty": "^2.2.3",
30
30
  "vxe-table": "^4.3.6",
31
31
  "xe-utils": "^3.5.7",
32
- "@shy-plugins/tinymce": "^1.0.6",
33
32
  "@shy-plugins/use": "1.0.1-next.5",
33
+ "@shy-plugins/tinymce": "^1.0.6",
34
34
  "@shy-plugins/utils": "1.0.0-next.1"
35
35
  },
36
36
  "types": "es/ui/index.d.ts",