yc-agent-ui 1.2.8 → 1.2.11

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.
Files changed (223) hide show
  1. package/es/components/data-table/src/data-table.vue.d.ts +2 -2
  2. package/es/components/display-item/index.d.ts +3 -3
  3. package/es/components/display-item/src/index.vue.d.ts +1 -1
  4. package/es/components/drawer-form/index.d.ts +6 -6
  5. package/es/components/drawer-form/src/index.vue.d.ts +2 -2
  6. package/es/components/page/index.d.ts +100 -100
  7. package/es/components/page/src/index.vue.d.ts +33 -33
  8. package/es/components/table/index.d.ts +18 -18
  9. package/es/components/table/src/index.vue.d.ts +2 -2
  10. package/es/components/table/src/table-column.vue.d.ts +10 -10
  11. package/es/components/virtual-table/index.d.ts +7 -7
  12. package/es/components/virtual-table/src/index.vue.d.ts +2 -2
  13. package/es/components/yc-ai-chat/src/bubble.vue.d.ts +1 -1
  14. package/es/components/yc-ai-chat/src/file-card.vue.d.ts +1 -1
  15. package/es/components/yc-ai-chat/src/sender.vue.d.ts +1 -1
  16. package/es/components/yc-coss-table/src/coss-table.vue.d.ts +3 -3
  17. package/es/components/yc-coss-table/src/table.vue.d.ts +1 -1
  18. package/es/components/yc-display-cards/index.d.ts +218 -3
  19. package/es/components/yc-display-cards/src/card-renderer.vue.d.ts +16 -0
  20. package/es/components/yc-display-cards/src/elements/action-bar.vue.d.ts +12 -0
  21. package/es/components/yc-display-cards/src/elements/card-shell.vue.d.ts +24 -0
  22. package/es/components/yc-display-cards/src/elements/choice-group.vue.d.ts +14 -0
  23. package/es/components/yc-display-cards/src/elements/data-table.vue.d.ts +10 -0
  24. package/es/components/yc-display-cards/src/elements/field-control.vue.d.ts +22 -0
  25. package/es/components/yc-display-cards/src/elements/field-utils.d.ts +16 -0
  26. package/es/components/yc-display-cards/src/elements/form-field.vue.d.ts +18 -0
  27. package/es/components/yc-display-cards/src/elements/inline-alert.vue.d.ts +14 -0
  28. package/es/components/yc-display-cards/src/elements/input.vue.d.ts +20 -0
  29. package/es/components/yc-display-cards/src/elements/kv-list.vue.d.ts +8 -0
  30. package/es/components/yc-display-cards/src/elements/metric-grid.vue.d.ts +7 -0
  31. package/es/components/yc-display-cards/src/elements/status-tag.vue.d.ts +6 -0
  32. package/es/components/yc-display-cards/src/elements/switch.vue.d.ts +10 -0
  33. package/es/components/yc-display-cards/src/elements/upload.vue.d.ts +17 -0
  34. package/es/components/yc-display-cards/src/elements/use-card-form.d.ts +23 -0
  35. package/es/components/yc-display-cards/src/form-card.vue.d.ts +5 -2
  36. package/es/components/yc-display-cards/src/table-card.vue.d.ts +1 -2
  37. package/es/components/yc-display-cards/src/types.d.ts +179 -10
  38. package/es/components/yc-feedback/src/banner.vue.d.ts +1 -1
  39. package/es/components/yc-feedback/src/key-value-list.vue.d.ts +1 -1
  40. package/es/components/yc-input/src/textarea.vue.d.ts +2 -2
  41. package/es/components/yc-plus-page/src/header-filter-cell.vue.d.ts +8 -8
  42. package/es/components/yc-plus-page/src/index.vue.d.ts +115 -115
  43. package/es/components/yc-property-table/src/property-table.vue.d.ts +2 -2
  44. package/es/hooks/usePlusFormReset.d.ts +18 -18
  45. package/es/index.css +30 -24
  46. package/es/index.mjs +3 -1
  47. package/es/packages/components/index.mjs +3 -1
  48. package/es/packages/components/yc-display-cards/capability.mjs +57 -1
  49. package/es/packages/components/yc-display-cards/index.mjs +31 -1
  50. package/es/packages/components/yc-display-cards/src/card-renderer.vue.mjs +6 -0
  51. package/es/packages/components/yc-display-cards/src/card-renderer2.vue.mjs +295 -0
  52. package/es/packages/components/yc-display-cards/src/detail-card.vue.mjs +1 -1
  53. package/es/packages/components/yc-display-cards/src/detail-card2.vue.mjs +28 -94
  54. package/es/packages/components/yc-display-cards/src/elements/action-bar.vue.mjs +6 -0
  55. package/es/packages/components/yc-display-cards/src/elements/action-bar2.vue.mjs +38 -0
  56. package/es/packages/components/yc-display-cards/src/elements/card-shell.vue.mjs +6 -0
  57. package/es/packages/components/yc-display-cards/src/elements/card-shell2.vue.mjs +85 -0
  58. package/es/packages/components/yc-display-cards/src/elements/choice-group.vue.mjs +6 -0
  59. package/es/packages/components/yc-display-cards/src/elements/choice-group2.vue.mjs +57 -0
  60. package/es/packages/components/yc-display-cards/src/elements/data-table.vue.mjs +6 -0
  61. package/es/packages/components/yc-display-cards/src/elements/data-table2.vue.mjs +184 -0
  62. package/es/packages/components/yc-display-cards/src/elements/field-control.vue.mjs +5 -0
  63. package/es/packages/components/yc-display-cards/src/elements/field-control2.vue.mjs +92 -0
  64. package/es/packages/components/yc-display-cards/src/elements/field-utils.mjs +121 -0
  65. package/es/packages/components/yc-display-cards/src/elements/form-field.vue.mjs +6 -0
  66. package/es/packages/components/yc-display-cards/src/elements/form-field2.vue.mjs +68 -0
  67. package/es/packages/components/yc-display-cards/src/elements/inline-alert.vue.mjs +6 -0
  68. package/es/packages/components/yc-display-cards/src/elements/inline-alert2.vue.mjs +29 -0
  69. package/es/packages/components/yc-display-cards/src/elements/input.vue.mjs +6 -0
  70. package/es/packages/components/yc-display-cards/src/elements/input2.vue.mjs +148 -0
  71. package/es/packages/components/yc-display-cards/src/elements/kv-list.vue.mjs +6 -0
  72. package/es/packages/components/yc-display-cards/src/elements/kv-list2.vue.mjs +63 -0
  73. package/es/packages/components/yc-display-cards/src/elements/metric-grid.vue.mjs +6 -0
  74. package/es/packages/components/yc-display-cards/src/elements/metric-grid2.vue.mjs +97 -0
  75. package/es/packages/components/yc-display-cards/src/elements/status-tag.vue.mjs +6 -0
  76. package/es/packages/components/yc-display-cards/src/elements/status-tag2.vue.mjs +25 -0
  77. package/es/packages/components/yc-display-cards/src/elements/switch.vue.mjs +6 -0
  78. package/es/packages/components/yc-display-cards/src/elements/switch2.vue.mjs +35 -0
  79. package/es/packages/components/yc-display-cards/src/elements/upload.vue.mjs +6 -0
  80. package/es/packages/components/yc-display-cards/src/elements/upload2.vue.mjs +196 -0
  81. package/es/packages/components/yc-display-cards/src/elements/use-card-form.mjs +80 -0
  82. package/es/packages/components/yc-display-cards/src/form-card.vue.mjs +1 -1
  83. package/es/packages/components/yc-display-cards/src/form-card2.vue.mjs +169 -1140
  84. package/es/packages/components/yc-display-cards/src/metrics-card.vue.mjs +1 -1
  85. package/es/packages/components/yc-display-cards/src/metrics-card2.vue.mjs +19 -114
  86. package/es/packages/components/yc-display-cards/src/table-card.vue.mjs +1 -1
  87. package/es/packages/components/yc-display-cards/src/table-card2.vue.mjs +50 -232
  88. package/es/packages/components/yc-status-dialog/src/index.vue.mjs +1 -1
  89. package/es/version.d.ts +1 -1
  90. package/es/version.mjs +1 -1
  91. package/index.css +20 -14
  92. package/index.js +2204 -2354
  93. package/index.min.css +19 -13
  94. package/index.min.js +37 -43
  95. package/index.min.mjs +36 -42
  96. package/index.mjs +2184 -2353
  97. package/lib/components/data-table/src/data-table.vue.d.ts +2 -2
  98. package/lib/components/display-item/index.d.ts +3 -3
  99. package/lib/components/display-item/src/index.vue.d.ts +1 -1
  100. package/lib/components/drawer-form/index.d.ts +6 -6
  101. package/lib/components/drawer-form/src/index.vue.d.ts +2 -2
  102. package/lib/components/page/index.d.ts +100 -100
  103. package/lib/components/page/src/index.vue.d.ts +33 -33
  104. package/lib/components/table/index.d.ts +18 -18
  105. package/lib/components/table/src/index.vue.d.ts +2 -2
  106. package/lib/components/table/src/table-column.vue.d.ts +10 -10
  107. package/lib/components/virtual-table/index.d.ts +7 -7
  108. package/lib/components/virtual-table/src/index.vue.d.ts +2 -2
  109. package/lib/components/yc-ai-chat/src/bubble.vue.d.ts +1 -1
  110. package/lib/components/yc-ai-chat/src/file-card.vue.d.ts +1 -1
  111. package/lib/components/yc-ai-chat/src/sender.vue.d.ts +1 -1
  112. package/lib/components/yc-coss-table/src/coss-table.vue.d.ts +3 -3
  113. package/lib/components/yc-coss-table/src/table.vue.d.ts +1 -1
  114. package/lib/components/yc-display-cards/index.d.ts +218 -3
  115. package/lib/components/yc-display-cards/src/card-renderer.vue.d.ts +16 -0
  116. package/lib/components/yc-display-cards/src/elements/action-bar.vue.d.ts +12 -0
  117. package/lib/components/yc-display-cards/src/elements/card-shell.vue.d.ts +24 -0
  118. package/lib/components/yc-display-cards/src/elements/choice-group.vue.d.ts +14 -0
  119. package/lib/components/yc-display-cards/src/elements/data-table.vue.d.ts +10 -0
  120. package/lib/components/yc-display-cards/src/elements/field-control.vue.d.ts +22 -0
  121. package/lib/components/yc-display-cards/src/elements/field-utils.d.ts +16 -0
  122. package/lib/components/yc-display-cards/src/elements/form-field.vue.d.ts +18 -0
  123. package/lib/components/yc-display-cards/src/elements/inline-alert.vue.d.ts +14 -0
  124. package/lib/components/yc-display-cards/src/elements/input.vue.d.ts +20 -0
  125. package/lib/components/yc-display-cards/src/elements/kv-list.vue.d.ts +8 -0
  126. package/lib/components/yc-display-cards/src/elements/metric-grid.vue.d.ts +7 -0
  127. package/lib/components/yc-display-cards/src/elements/status-tag.vue.d.ts +6 -0
  128. package/lib/components/yc-display-cards/src/elements/switch.vue.d.ts +10 -0
  129. package/lib/components/yc-display-cards/src/elements/upload.vue.d.ts +17 -0
  130. package/lib/components/yc-display-cards/src/elements/use-card-form.d.ts +23 -0
  131. package/lib/components/yc-display-cards/src/form-card.vue.d.ts +5 -2
  132. package/lib/components/yc-display-cards/src/table-card.vue.d.ts +1 -2
  133. package/lib/components/yc-display-cards/src/types.d.ts +179 -10
  134. package/lib/components/yc-feedback/src/banner.vue.d.ts +1 -1
  135. package/lib/components/yc-feedback/src/key-value-list.vue.d.ts +1 -1
  136. package/lib/components/yc-input/src/textarea.vue.d.ts +2 -2
  137. package/lib/components/yc-plus-page/src/header-filter-cell.vue.d.ts +8 -8
  138. package/lib/components/yc-plus-page/src/index.vue.d.ts +115 -115
  139. package/lib/components/yc-property-table/src/property-table.vue.d.ts +2 -2
  140. package/lib/hooks/usePlusFormReset.d.ts +18 -18
  141. package/lib/index.css +29 -23
  142. package/lib/index.js +28 -7
  143. package/lib/packages/components/index.js +28 -7
  144. package/lib/packages/components/yc-display-cards/capability.js +56 -0
  145. package/lib/packages/components/yc-display-cards/index.js +49 -0
  146. package/lib/packages/components/yc-display-cards/src/card-renderer.vue.js +10 -0
  147. package/lib/packages/components/yc-display-cards/src/card-renderer2.vue.js +299 -0
  148. package/lib/packages/components/yc-display-cards/src/detail-card.vue.js +1 -1
  149. package/lib/packages/components/yc-display-cards/src/detail-card2.vue.js +27 -93
  150. package/lib/packages/components/yc-display-cards/src/elements/action-bar.vue.js +10 -0
  151. package/lib/packages/components/yc-display-cards/src/elements/action-bar2.vue.js +42 -0
  152. package/lib/packages/components/yc-display-cards/src/elements/card-shell.vue.js +10 -0
  153. package/lib/packages/components/yc-display-cards/src/elements/card-shell2.vue.js +89 -0
  154. package/lib/packages/components/yc-display-cards/src/elements/choice-group.vue.js +10 -0
  155. package/lib/packages/components/yc-display-cards/src/elements/choice-group2.vue.js +61 -0
  156. package/lib/packages/components/yc-display-cards/src/elements/data-table.vue.js +10 -0
  157. package/lib/packages/components/yc-display-cards/src/elements/data-table2.vue.js +188 -0
  158. package/lib/packages/components/yc-display-cards/src/elements/field-control.vue.js +9 -0
  159. package/lib/packages/components/yc-display-cards/src/elements/field-control2.vue.js +96 -0
  160. package/lib/packages/components/yc-display-cards/src/elements/field-utils.js +134 -0
  161. package/lib/packages/components/yc-display-cards/src/elements/form-field.vue.js +10 -0
  162. package/lib/packages/components/yc-display-cards/src/elements/form-field2.vue.js +72 -0
  163. package/lib/packages/components/yc-display-cards/src/elements/inline-alert.vue.js +10 -0
  164. package/lib/packages/components/yc-display-cards/src/elements/inline-alert2.vue.js +33 -0
  165. package/lib/packages/components/yc-display-cards/src/elements/input.vue.js +10 -0
  166. package/lib/packages/components/yc-display-cards/src/elements/input2.vue.js +152 -0
  167. package/lib/packages/components/yc-display-cards/src/elements/kv-list.vue.js +10 -0
  168. package/lib/packages/components/yc-display-cards/src/elements/kv-list2.vue.js +67 -0
  169. package/lib/packages/components/yc-display-cards/src/elements/metric-grid.vue.js +10 -0
  170. package/lib/packages/components/yc-display-cards/src/elements/metric-grid2.vue.js +101 -0
  171. package/lib/packages/components/yc-display-cards/src/elements/status-tag.vue.js +10 -0
  172. package/lib/packages/components/yc-display-cards/src/elements/status-tag2.vue.js +29 -0
  173. package/lib/packages/components/yc-display-cards/src/elements/switch.vue.js +10 -0
  174. package/lib/packages/components/yc-display-cards/src/elements/switch2.vue.js +39 -0
  175. package/lib/packages/components/yc-display-cards/src/elements/upload.vue.js +10 -0
  176. package/lib/packages/components/yc-display-cards/src/elements/upload2.vue.js +200 -0
  177. package/lib/packages/components/yc-display-cards/src/elements/use-card-form.js +82 -0
  178. package/lib/packages/components/yc-display-cards/src/form-card.vue.js +1 -1
  179. package/lib/packages/components/yc-display-cards/src/form-card2.vue.js +168 -1139
  180. package/lib/packages/components/yc-display-cards/src/metrics-card.vue.js +1 -1
  181. package/lib/packages/components/yc-display-cards/src/metrics-card2.vue.js +18 -113
  182. package/lib/packages/components/yc-display-cards/src/table-card.vue.js +1 -1
  183. package/lib/packages/components/yc-display-cards/src/table-card2.vue.js +49 -231
  184. package/lib/packages/components/yc-status-dialog/src/index.vue.js +1 -1
  185. package/lib/version.d.ts +1 -1
  186. package/lib/version.js +1 -1
  187. package/locale/en.js +1 -1
  188. package/locale/en.min.js +1 -1
  189. package/locale/en.min.mjs +1 -1
  190. package/locale/en.mjs +1 -1
  191. package/locale/ja.js +1 -1
  192. package/locale/ja.min.js +1 -1
  193. package/locale/ja.min.mjs +1 -1
  194. package/locale/ja.mjs +1 -1
  195. package/locale/ko.js +1 -1
  196. package/locale/ko.min.js +1 -1
  197. package/locale/ko.min.mjs +1 -1
  198. package/locale/ko.mjs +1 -1
  199. package/locale/zh-cn.js +1 -1
  200. package/locale/zh-cn.min.js +1 -1
  201. package/locale/zh-cn.min.mjs +1 -1
  202. package/locale/zh-cn.mjs +1 -1
  203. package/locale/zh-tw.js +1 -1
  204. package/locale/zh-tw.min.js +1 -1
  205. package/locale/zh-tw.min.mjs +1 -1
  206. package/locale/zh-tw.mjs +1 -1
  207. package/package.json +1 -2
  208. package/theme-chalk/index.css +20 -14
  209. package/theme-chalk/plus-dialog.css +1 -1
  210. package/theme-chalk/plus-yc-status-dialog.css +1 -1
  211. package/theme-chalk/src/dialog.scss +0 -6
  212. package/theme-chalk/src/index.scss +1 -2
  213. package/theme-chalk/src/yc-status-dialog.scss +2 -2
  214. package/es/_virtual/_commonjsHelpers.mjs +0 -7
  215. package/es/_virtual/toastify.mjs +0 -3
  216. package/es/components/yc-display-cards/src/toast.d.ts +0 -4
  217. package/es/node_modules/.pnpm/toastify-js@1.12.0/node_modules/toastify-js/src/toastify.mjs +0 -456
  218. package/es/packages/components/yc-display-cards/src/toast.mjs +0 -35
  219. package/lib/_virtual/_commonjsHelpers.js +0 -10
  220. package/lib/_virtual/toastify.js +0 -5
  221. package/lib/components/yc-display-cards/src/toast.d.ts +0 -4
  222. package/lib/node_modules/.pnpm/toastify-js@1.12.0/node_modules/toastify-js/src/toastify.js +0 -460
  223. package/lib/packages/components/yc-display-cards/src/toast.js +0 -37
@@ -3,125 +3,27 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var vue = require('vue');
6
- var toast = require('./toast.js');
6
+ var actionBar = require('./elements/action-bar.vue.js');
7
+ var cardShell = require('./elements/card-shell.vue.js');
8
+ var dataTable = require('./elements/data-table.vue.js');
9
+ var fieldControl_vue_vue_type_script_setup_true_lang = require('./elements/field-control2.vue.js');
10
+ var inlineAlert = require('./elements/inline-alert.vue.js');
11
+ var kvList = require('./elements/kv-list.vue.js');
12
+ var fieldUtils = require('./elements/field-utils.js');
13
+ var useCardForm = require('./elements/use-card-form.js');
7
14
 
8
- const _hoisted_1 = { class: "yc-display-card__header" };
9
- const _hoisted_2 = { class: "yc-display-card__title-wrap yc-display-form-card__title-group" };
10
- const _hoisted_3 = { class: "yc-display-form-card__titles" };
11
- const _hoisted_4 = { class: "yc-display-card__title" };
12
- const _hoisted_5 = {
13
- key: 0,
14
- class: "yc-display-card__subtitle"
15
- };
16
- const _hoisted_6 = {
15
+ const _hoisted_1 = {
17
16
  key: 0,
18
17
  class: "yc-display-form-card__loading"
19
18
  };
20
- const _hoisted_7 = {
19
+ const _hoisted_2 = {
21
20
  key: 1,
22
21
  class: "yc-display-form-card__body"
23
22
  };
24
- const _hoisted_8 = {
23
+ const _hoisted_3 = {
25
24
  key: 0,
26
25
  class: "yc-display-form-card__grid"
27
26
  };
28
- const _hoisted_9 = { class: "yc-display-form-card__label" };
29
- const _hoisted_10 = {
30
- key: 0,
31
- class: "is-required"
32
- };
33
- const _hoisted_11 = {
34
- key: 1,
35
- class: "yc-display-form-card__dynamic-tag"
36
- };
37
- const _hoisted_12 = {
38
- key: 0,
39
- class: "yc-display-form-card__choice-group",
40
- role: "radiogroup"
41
- };
42
- const _hoisted_13 = ["aria-checked", "disabled", "onClick"];
43
- const _hoisted_14 = {
44
- key: 1,
45
- class: "yc-display-form-card__choice-group",
46
- role: "group"
47
- };
48
- const _hoisted_15 = ["aria-checked", "disabled", "onClick"];
49
- const _hoisted_16 = ["value", "disabled", "onFocus", "onChange"];
50
- const _hoisted_17 = { value: "" };
51
- const _hoisted_18 = ["value"];
52
- const _hoisted_19 = ["type", "value", "disabled", "onInput"];
53
- const _hoisted_20 = ["step", "inputmode", "value", "disabled", "placeholder", "onInput"];
54
- const _hoisted_21 = ["aria-checked", "disabled", "onClick"];
55
- const _hoisted_22 = {
56
- key: 6,
57
- class: "yc-display-form-card__upload"
58
- };
59
- const _hoisted_23 = ["accept", "onChange"];
60
- const _hoisted_24 = { class: "yc-display-form-card__upload-list" };
61
- const _hoisted_25 = {
62
- key: 0,
63
- class: "yc-display-form-card__thumb"
64
- };
65
- const _hoisted_26 = ["src", "alt"];
66
- const _hoisted_27 = ["onClick"];
67
- const _hoisted_28 = {
68
- key: 1,
69
- class: "yc-display-form-card__file-chip"
70
- };
71
- const _hoisted_29 = { class: "yc-display-form-card__file-name" };
72
- const _hoisted_30 = ["onClick"];
73
- const _hoisted_31 = ["disabled", "onClick"];
74
- const _hoisted_32 = { key: 0 };
75
- const _hoisted_33 = { key: 1 };
76
- const _hoisted_34 = ["value", "disabled", "placeholder", "onInput", "onBlur"];
77
- const _hoisted_35 = ["value", "disabled", "placeholder", "onInput", "onBlur"];
78
- const _hoisted_36 = ["value", "disabled", "placeholder", "onInput"];
79
- const _hoisted_37 = ["value", "disabled", "placeholder", "onInput"];
80
- const _hoisted_38 = {
81
- key: 11,
82
- class: "yc-display-form-card__field-error"
83
- };
84
- const _hoisted_39 = { class: "yc-display-form-card__actions" };
85
- const _hoisted_40 = ["disabled"];
86
- const _hoisted_41 = ["disabled"];
87
- const _hoisted_42 = {
88
- key: 1,
89
- class: "yc-display-form-card__alert is-error"
90
- };
91
- const _hoisted_43 = {
92
- key: 2,
93
- class: "yc-display-form-card__alert is-success"
94
- };
95
- const _hoisted_44 = {
96
- key: 3,
97
- class: "yc-display-form-card__trace"
98
- };
99
- const _hoisted_45 = { class: "yc-display-form-card__trace-arrow" };
100
- const _hoisted_46 = {
101
- key: 0,
102
- class: "yc-display-form-card__trace-list"
103
- };
104
- const _hoisted_47 = { class: "yc-display-form-card__trace-content" };
105
- const _hoisted_48 = { class: "yc-display-form-card__trace-label" };
106
- const _hoisted_49 = {
107
- key: 0,
108
- class: "yc-display-form-card__trace-detail"
109
- };
110
- const _hoisted_50 = {
111
- key: 4,
112
- class: "yc-display-form-card__result"
113
- };
114
- const _hoisted_51 = {
115
- key: 0,
116
- class: "yc-display-form-card__table-wrap"
117
- };
118
- const _hoisted_52 = { class: "yc-display-form-card__table" };
119
- const _hoisted_53 = {
120
- key: 1,
121
- class: "yc-display-form-card__kv"
122
- };
123
- const _hoisted_54 = { class: "yc-display-form-card__kv-label" };
124
- const _hoisted_55 = { class: "yc-display-form-card__kv-value" };
125
27
  var _sfc_main = /* @__PURE__ */ vue.defineComponent({
126
28
  ...{ name: "YcDisplayFormCard" },
127
29
  __name: "form-card",
@@ -138,9 +40,10 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
138
40
  skillName: { default: "" },
139
41
  executeAction: { type: Function, default: void 0 },
140
42
  uploadFile: { type: Function, default: void 0 },
141
- submitReply: { type: Function, default: void 0 }
43
+ submitReply: { type: Function, default: void 0 },
44
+ inlineFeedback: { type: Boolean, default: true }
142
45
  },
143
- emits: ["action"],
46
+ emits: ["action", "feedback"],
144
47
  setup(__props, { emit: __emit }) {
145
48
  const props = __props;
146
49
  const emit = __emit;
@@ -148,1121 +51,247 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
148
51
  const schemaReadOnly = vue.ref(null);
149
52
  const loadedFields = vue.ref([]);
150
53
  const loadingSchema = vue.ref(false);
54
+ const loadingOptions = vue.ref({});
151
55
  const executing = vue.ref(false);
56
+ const replySent = vue.ref(false);
152
57
  const errorMessage = vue.ref("");
153
- const submitReceipt = vue.ref(null);
58
+ const successMessage = vue.ref("");
154
59
  const resultData = vue.ref(null);
155
60
  const hasExecuted = vue.ref(false);
156
- const replySent = vue.ref(false);
157
- const dynamicFields = vue.ref([]);
158
- const traceSteps = vue.ref([]);
159
- const traceExpanded = vue.ref(false);
160
- const formValues = vue.reactive({});
161
- const remoteOptions = vue.reactive({});
162
- const loadingOptions = vue.reactive({});
163
- const uploadedFiles = vue.reactive({});
164
- const uploadingFields = vue.reactive({});
165
- const fileInputRefs = /* @__PURE__ */ new Map();
61
+ const form = useCardForm.useCardForm(
62
+ vue.computed(() => {
63
+ var _a;
64
+ return ((_a = props.fields) == null ? void 0 : _a.length) ? props.fields : loadedFields.value;
65
+ }),
66
+ vue.computed(() => props.values)
67
+ );
166
68
  const resolvedMode = vue.computed(() => {
167
- if (props.mode === "reply") return "reply";
168
- if (props.mode === "submit") return "submit";
169
- if (props.mode === "query") return "query";
69
+ if (props.mode) return props.mode;
170
70
  return schemaReadOnly.value === false ? "submit" : "query";
171
71
  });
172
- const cardTitle = vue.computed(() => {
173
- var _a;
174
- if ((_a = props.title) == null ? void 0 : _a.trim()) return props.title.trim();
175
- if (schemaTitle.value) return schemaTitle.value;
176
- return props.skillName || "\u4E1A\u52A1\u8868\u5355";
177
- });
178
- const cardSubtitle = vue.computed(
72
+ const cardTitle = vue.computed(
179
73
  () => {
180
74
  var _a;
181
- return ((_a = props.subtitle) == null ? void 0 : _a.trim()) ? props.subtitle.trim() : "";
75
+ return ((_a = props.title) == null ? void 0 : _a.trim()) || schemaTitle.value || props.skillName || "\u4E1A\u52A1\u8868\u5355";
182
76
  }
183
77
  );
184
- const resolvedSubmitLabel = vue.computed(() => {
185
- var _a;
186
- if ((_a = props.submitLabel) == null ? void 0 : _a.trim()) return props.submitLabel.trim();
187
- return resolvedMode.value === "query" ? "\u67E5\u8BE2" : "\u63D0\u4EA4";
188
- });
189
78
  const canExecute = vue.computed(
190
79
  () => {
191
80
  var _a;
192
81
  return resolvedMode.value === "reply" ? !replySent.value : Boolean(((_a = props.operation) == null ? void 0 : _a.trim()) && props.executeAction);
193
82
  }
194
83
  );
195
- function isObject(value) {
196
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
197
- }
198
- function normalizeInlineOptions(raw) {
84
+ const actions = vue.computed(() => {
199
85
  var _a;
200
- if (!Array.isArray(raw)) return void 0;
201
- const options = [];
202
- for (const item of raw) {
203
- if (typeof item === "string" || typeof item === "number") {
204
- options.push({ label: String(item), value: item });
205
- } else if (isObject(item) && item.value !== void 0 && item.value !== null) {
206
- options.push({
207
- label: String((_a = item.label) != null ? _a : item.value),
208
- value: typeof item.value === "string" || typeof item.value === "number" || typeof item.value === "boolean" ? item.value : String(item.value)
209
- });
210
- }
211
- }
212
- return options.length ? options : void 0;
213
- }
214
- const inlineFields = vue.computed(() => {
215
- var _a;
216
- const base = Array.isArray(props.fields) ? props.fields : [];
217
- const merged = [...base, ...dynamicFields.value];
218
- const seen = /* @__PURE__ */ new Set();
219
- const result = [];
220
- for (const item of merged) {
221
- if (!item || typeof item !== "object" || !item.name) continue;
222
- const name = String(item.name);
223
- if (seen.has(name)) continue;
224
- seen.add(name);
225
- result.push({
226
- ...item,
227
- name,
228
- label: String((_a = item.label) != null ? _a : name),
229
- visible: item.visible !== false
230
- });
231
- }
232
- return result;
233
- });
234
- const dynamicFieldNames = vue.computed(
235
- () => new Set(dynamicFields.value.map((f) => f.name))
236
- );
237
- const visibleFields = vue.computed(() => {
238
- const source = inlineFields.value.length > 0 ? inlineFields.value : loadedFields.value;
239
- return source.filter((field) => field.visible !== false);
86
+ return [
87
+ {
88
+ key: "submit",
89
+ label: ((_a = props.submitLabel) == null ? void 0 : _a.trim()) || (resolvedMode.value === "query" ? "\u67E5\u8BE2" : "\u63D0\u4EA4"),
90
+ primary: true,
91
+ disabled: !canExecute.value
92
+ },
93
+ { key: "reset", label: "\u91CD\u7F6E", disabled: replySent.value }
94
+ ];
240
95
  });
241
- function isRadioField(field) {
242
- return field.widget === "radio";
243
- }
244
- function isCheckboxField(field) {
245
- return field.widget === "checkbox";
246
- }
247
- function isSelectField(field) {
248
- var _a, _b;
249
- if (isRadioField(field) || isCheckboxField(field)) return false;
250
- return Boolean(
251
- field.widget === "select" || field.options_operation || ((_a = field.options) == null ? void 0 : _a.length) || ((_b = field.enum) == null ? void 0 : _b.length)
252
- );
253
- }
254
- function isPhoneField(field) {
255
- return field.widget === "phone" || field.widget === "tel";
256
- }
257
- function isEmailField(field) {
258
- return field.widget === "email";
259
- }
260
- function isDateField(field) {
261
- return field.widget === "date" || field.widget === "datetime";
262
- }
263
- function isNumberField(field) {
264
- return field.type === "number" || field.type === "integer";
265
- }
266
- function isUploadField(field) {
267
- return field.widget === "image" || field.widget === "file";
268
- }
269
- function extractArray(obj) {
270
- for (const key of ["data", "rows", "items", "list", "records"]) {
271
- if (Array.isArray(obj[key])) return obj[key];
272
- }
273
- return null;
274
- }
275
96
  const resultRows = vue.computed(() => {
276
97
  if (!hasExecuted.value || resultData.value == null) return null;
277
- const raw = Array.isArray(resultData.value) ? resultData.value : isObject(resultData.value) ? extractArray(resultData.value) : null;
278
- if (!raw) return null;
279
- return raw.filter((item) => isObject(item));
98
+ const raw = Array.isArray(resultData.value) ? resultData.value : fieldUtils.isPlainObject(resultData.value) ? fieldUtils.extractRows(resultData.value) : null;
99
+ return raw ? raw.filter(fieldUtils.isPlainObject) : null;
280
100
  });
281
- const resultColumns = vue.computed(() => {
282
- const rows = resultRows.value;
283
- if (!(rows == null ? void 0 : rows.length)) return [];
284
- return Object.keys(rows[0]);
285
- });
286
- const resultDetailEntries = vue.computed(() => {
287
- if (!hasExecuted.value || resultRows.value || resultData.value == null) {
288
- return [];
289
- }
290
- if (!isObject(resultData.value)) {
291
- return [{ label: "\u7ED3\u679C", value: String(resultData.value) }];
292
- }
293
- return Object.entries(resultData.value).filter(
294
- ([, val]) => val === null || ["string", "number", "boolean"].includes(typeof val)
295
- ).map(([key, val]) => ({
296
- label: key,
297
- value: val === null ? "-" : String(val)
298
- }));
101
+ const resultEntries = vue.computed(() => {
102
+ if (!hasExecuted.value || resultRows.value || resultData.value == null) return [];
103
+ if (!fieldUtils.isPlainObject(resultData.value)) return [{ label: "\u7ED3\u679C", value: String(resultData.value) }];
104
+ return Object.entries(resultData.value).filter(([, val]) => val === null || ["string", "number", "boolean"].includes(typeof val)).map(([label, val]) => ({ label, value: val === null ? "-" : String(val) }));
299
105
  });
300
- function initPrefilledValues() {
301
- if (isObject(props.values)) {
302
- for (const [k, v] of Object.entries(props.values)) {
303
- formValues[k] = v;
304
- }
305
- }
306
- }
307
- function extractSelectOptions(data, labelKey, valueKey) {
308
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
309
- const rows = Array.isArray(data) ? data : isObject(data) ? (_a = extractArray(data)) != null ? _a : [] : [];
310
- const options = [];
311
- for (const row of rows) {
312
- if (typeof row === "string" || typeof row === "number") {
313
- options.push({ label: String(row), value: row });
314
- continue;
315
- }
316
- if (!isObject(row)) continue;
317
- const rawVal = (_g = (_f = (_e = (_d = (_c = (_b = valueKey && row[valueKey] !== void 0 ? row[valueKey] : void 0) != null ? _b : row.id) != null ? _c : row.value) != null ? _d : row.code) != null ? _e : row.key) != null ? _f : row.projectId) != null ? _g : row.name;
318
- const rawLabel = (_l = (_k = (_j = (_i = (_h = labelKey && row[labelKey] !== void 0 ? row[labelKey] : void 0) != null ? _h : row.name) != null ? _i : row.label) != null ? _j : row.title) != null ? _k : row.projectName) != null ? _l : rawVal;
319
- if (rawVal === void 0 || rawVal === null) continue;
320
- options.push({
321
- label: String(rawLabel != null ? rawLabel : rawVal),
322
- value: typeof rawVal === "string" || typeof rawVal === "number" || typeof rawVal === "boolean" ? rawVal : String(rawVal)
323
- });
324
- }
325
- return options;
106
+ function report(feedback) {
107
+ if (feedback.type === "success") successMessage.value = feedback.message;
108
+ else errorMessage.value = feedback.message;
109
+ emit("feedback", feedback);
326
110
  }
327
111
  async function loadFieldOptions(field) {
328
112
  const op = field.options_operation;
329
- if (!op || !props.executeAction || remoteOptions[field.name] || loadingOptions[field.name]) {
113
+ if (!op || !props.executeAction || form.remoteOptions[field.name] || loadingOptions.value[field.name]) {
330
114
  return;
331
115
  }
332
- loadingOptions[field.name] = true;
116
+ loadingOptions.value[field.name] = true;
333
117
  try {
334
118
  const res = await props.executeAction({ operation: op, mode: "options" });
335
- remoteOptions[field.name] = extractSelectOptions(
119
+ form.remoteOptions[field.name] = fieldUtils.extractOptions(
336
120
  res.data,
337
121
  field.option_label_key,
338
122
  field.option_value_key
339
123
  );
340
124
  } catch (e) {
341
- remoteOptions[field.name] = [];
125
+ form.remoteOptions[field.name] = [];
342
126
  } finally {
343
- loadingOptions[field.name] = false;
344
- }
345
- }
346
- function fieldOptions(field) {
347
- var _a;
348
- if ((_a = remoteOptions[field.name]) == null ? void 0 : _a.length) {
349
- return remoteOptions[field.name];
350
- }
351
- const inline = normalizeInlineOptions(field.options);
352
- if (inline == null ? void 0 : inline.length) return inline;
353
- if (Array.isArray(field.enum) && field.enum.length > 0) {
354
- return field.enum.map((item) => ({
355
- label: String(item),
356
- value: typeof item === "string" || typeof item === "number" || typeof item === "boolean" ? item : String(item)
357
- }));
358
- }
359
- return [];
360
- }
361
- function handleSelectChange(field, event) {
362
- var _a;
363
- const select = event.target;
364
- const raw = (_a = select == null ? void 0 : select.value) != null ? _a : "";
365
- if (raw === "") {
366
- formValues[field.name] = void 0;
367
- return;
368
- }
369
- const matched = fieldOptions(field).find((opt) => String(opt.value) === raw);
370
- formValues[field.name] = matched ? matched.value : raw;
371
- }
372
- function handleNumberInput(field, event) {
373
- var _a;
374
- const input = event.target;
375
- const raw = (_a = input == null ? void 0 : input.value) != null ? _a : "";
376
- if (raw.trim() === "") {
377
- formValues[field.name] = void 0;
378
- return;
379
- }
380
- const num = Number(raw);
381
- formValues[field.name] = Number.isNaN(num) ? raw : num;
382
- }
383
- function formatDateInputValue(field, value) {
384
- if (value === void 0 || value === null) return "";
385
- const text = String(value);
386
- if (field.widget === "datetime") {
387
- return text.replace(" ", "T").slice(0, 16);
127
+ loadingOptions.value[field.name] = false;
388
128
  }
389
- return text.slice(0, 10);
390
- }
391
- function handleDateInput(field, event) {
392
- var _a;
393
- const input = event.target;
394
- const raw = (_a = input == null ? void 0 : input.value) != null ? _a : "";
395
- if (!raw) {
396
- formValues[field.name] = void 0;
397
- return;
398
- }
399
- formValues[field.name] = field.widget === "datetime" ? raw.replace("T", " ") : raw;
400
129
  }
401
130
  async function loadSchemaIfNeeded() {
402
- var _a, _b, _c;
403
- if (inlineFields.value.length > 0) {
404
- for (const f of visibleFields.value) {
405
- if (f.options_operation) void loadFieldOptions(f);
406
- }
407
- return;
408
- }
409
- if (!((_a = props.operation) == null ? void 0 : _a.trim()) || !props.executeAction) return;
410
- loadingSchema.value = true;
411
- try {
412
- const res = await props.executeAction({
413
- operation: props.operation.trim(),
414
- mode: "schema",
415
- schema_only: true
416
- });
417
- schemaTitle.value = res.title || "";
418
- schemaReadOnly.value = (_b = res.read_only) != null ? _b : null;
419
- loadedFields.value = (_c = res.fields) != null ? _c : [];
420
- for (const f of loadedFields.value) {
421
- if (f.options_operation) void loadFieldOptions(f);
422
- }
423
- } catch (err) {
424
- errorMessage.value = err instanceof Error ? err.message : "\u52A0\u8F7D\u8868\u5355\u5B57\u6BB5\u5B9A\u4E49\u5931\u8D25";
425
- } finally {
426
- loadingSchema.value = false;
427
- }
428
- }
429
- function setFileInputRef(fieldName, el) {
430
- if (el instanceof HTMLInputElement) {
431
- fileInputRefs.set(fieldName, el);
432
- } else {
433
- fileInputRefs.delete(fieldName);
434
- }
435
- }
436
- function triggerFileSelect(fieldName) {
437
- var _a;
438
- if (replySent.value || uploadingFields[fieldName]) return;
439
- (_a = fileInputRefs.get(fieldName)) == null ? void 0 : _a.click();
440
- }
441
- function syncUploadFormValue(fieldName) {
442
- var _a;
443
- const items = (_a = uploadedFiles[fieldName]) != null ? _a : [];
444
- formValues[fieldName] = items.length ? items.map((item) => item.attachment.fileName) : void 0;
445
- }
446
- async function createImagePreview(file) {
447
- if (typeof URL !== "undefined" && typeof URL.createObjectURL === "function") {
448
- return { previewUrl: URL.createObjectURL(file), isObjectUrl: true };
449
- }
450
- if (typeof FileReader !== "undefined") {
451
- return new Promise((resolve) => {
452
- const reader = new FileReader();
453
- reader.onload = () => {
454
- resolve({
455
- previewUrl: typeof reader.result === "string" ? reader.result : void 0,
456
- isObjectUrl: false
457
- });
458
- };
459
- reader.onerror = () => resolve({});
460
- reader.readAsDataURL(file);
461
- });
462
- }
463
- return {};
464
- }
465
- async function handleFileInputChange(field, event) {
466
- const input = event.target;
467
- const files = (input == null ? void 0 : input.files) ? Array.from(input.files) : [];
468
- if (input) input.value = "";
469
- if (!files.length) return;
470
- if (!props.uploadFile) {
471
- errorMessage.value = "\u5F53\u524D\u9875\u9762\u672A\u914D\u7F6E\u8868\u5355\u4E0A\u4F20\u80FD\u529B\uFF0C\u8BF7\u5728\u4E0B\u65B9\u8F93\u5165\u6846\u76F4\u63A5\u53D1\u9001\u56FE\u7247";
472
- return;
473
- }
474
- errorMessage.value = "";
475
- uploadingFields[field.name] = true;
476
- if (!uploadedFiles[field.name]) uploadedFiles[field.name] = [];
477
- try {
478
- for (const file of files) {
479
- const attachment = await props.uploadFile(file);
480
- const isImage = field.widget === "image" || file.type.startsWith("image/");
481
- const preview = isImage ? await createImagePreview(file) : {};
482
- uploadedFiles[field.name].push({
483
- attachment,
484
- previewUrl: preview.previewUrl,
485
- isObjectUrl: preview.isObjectUrl
131
+ var _a, _b, _c, _d;
132
+ if (!((_a = props.fields) == null ? void 0 : _a.length) && ((_b = props.operation) == null ? void 0 : _b.trim()) && props.executeAction) {
133
+ loadingSchema.value = true;
134
+ try {
135
+ const res = await props.executeAction({
136
+ operation: props.operation.trim(),
137
+ mode: "schema",
138
+ schema_only: true
486
139
  });
140
+ schemaTitle.value = res.title || "";
141
+ schemaReadOnly.value = (_c = res.read_only) != null ? _c : null;
142
+ loadedFields.value = (_d = res.fields) != null ? _d : [];
143
+ } catch (err) {
144
+ report({ type: "error", message: err instanceof Error ? err.message : "\u52A0\u8F7D\u8868\u5355\u5B57\u6BB5\u5B9A\u4E49\u5931\u8D25" });
145
+ } finally {
146
+ loadingSchema.value = false;
487
147
  }
488
- syncUploadFormValue(field.name);
489
- } catch (err) {
490
- errorMessage.value = err instanceof Error ? err.message : `\u4E0A\u4F20\u300C${field.label || field.name}\u300D\u5931\u8D25`;
491
- } finally {
492
- uploadingFields[field.name] = false;
493
- }
494
- }
495
- function removeUploadedItem(fieldName, index) {
496
- if (replySent.value) return;
497
- const list = uploadedFiles[fieldName];
498
- if (!list) return;
499
- const [removed] = list.splice(index, 1);
500
- if ((removed == null ? void 0 : removed.previewUrl) && removed.isObjectUrl && typeof URL !== "undefined" && typeof URL.revokeObjectURL === "function") {
501
- URL.revokeObjectURL(removed.previewUrl);
502
- }
503
- syncUploadFormValue(fieldName);
504
- }
505
- function collectUploadedAttachments() {
506
- const result = [];
507
- for (const field of inlineFields.value) {
508
- if (!isUploadField(field)) continue;
509
- const list = uploadedFiles[field.name];
510
- if (list == null ? void 0 : list.length) {
511
- for (const item of list) result.push(item.attachment);
512
- }
513
- }
514
- return result;
515
- }
516
- function isCheckboxChecked(field, optionValue) {
517
- const current = formValues[field.name];
518
- return Array.isArray(current) && current.includes(optionValue);
519
- }
520
- function toggleCheckboxOption(field, optionValue) {
521
- if (replySent.value) return;
522
- const current = Array.isArray(formValues[field.name]) ? [...formValues[field.name]] : [];
523
- const idx = current.indexOf(optionValue);
524
- if (idx >= 0) {
525
- current.splice(idx, 1);
526
- } else {
527
- current.push(optionValue);
528
- }
529
- formValues[field.name] = current.length ? current : void 0;
530
- }
531
- const fieldValidationErrors = vue.reactive({});
532
- function validateFieldFormat(field, value) {
533
- if (isBlank(value)) return "";
534
- const text = String(value).trim();
535
- const label = field.label || field.name;
536
- if (isPhoneField(field)) {
537
- const normalized = text.replace(/[\s-]/g, "");
538
- if (!/^1[3-9]\d{9}$/.test(normalized) && !/^0\d{2,3}\d{7,8}$/.test(normalized)) {
539
- return `\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u300C${label}\u300D\uFF0811\u4F4D\u624B\u673A\u53F7\u6216\u56FA\u8BDD\uFF09`;
540
- }
541
- }
542
- if (isEmailField(field)) {
543
- if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(text)) {
544
- return `\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u300C${label}\u300D\u90AE\u7BB1\u683C\u5F0F`;
545
- }
546
- }
547
- return "";
548
- }
549
- function handleFieldBlur(field) {
550
- const msg = validateFieldFormat(field, formValues[field.name]);
551
- if (msg) {
552
- fieldValidationErrors[field.name] = msg;
553
- } else {
554
- delete fieldValidationErrors[field.name];
555
148
  }
149
+ for (const field of form.visibleFields.value) void loadFieldOptions(field);
556
150
  }
557
- function isBlank(value) {
558
- if (Array.isArray(value)) return value.length === 0;
559
- return value === void 0 || value === null || String(value).trim() === "";
560
- }
561
- function displayValue(field, value) {
151
+ async function submit() {
562
152
  var _a;
563
- if (isUploadField(field)) {
564
- const items = (_a = uploadedFiles[field.name]) != null ? _a : [];
565
- if (items.length) {
566
- return `\u5DF2\u968F\u6D88\u606F\u4E0A\u4F20 ${items.length} \u4E2A\u9644\u4EF6\uFF08${items.map((item) => item.attachment.fileName).join("\u3001")}\uFF09`;
567
- }
568
- }
569
- if (Array.isArray(value)) {
570
- const opts = fieldOptions(field);
571
- return value.map((v) => {
572
- const opt = opts.find((o) => o.value === v);
573
- return !opt || opt.label === String(v) ? String(v) : `${opt.label}\uFF08${String(v)}\uFF09`;
574
- }).join("\u3001");
575
- }
576
- const option = fieldOptions(field).find((opt) => opt.value === value);
577
- if (!option || option.label === String(value)) return String(value);
578
- return `${option.label}\uFF08${String(value)}\uFF09`;
579
- }
580
- function buildReplyText() {
581
- var _a;
582
- const prefix = ((_a = props.replyPrefix) == null ? void 0 : _a.trim()) ? props.replyPrefix.trim() : `\u8BF7\u6309\u4EE5\u4E0B\u4FE1\u606F${cardTitle.value}`;
583
- const lines = [];
584
- for (const field of inlineFields.value) {
585
- const value = formValues[field.name];
586
- if (isBlank(value)) continue;
587
- lines.push(`${field.label || field.name}\uFF1A${displayValue(field, value)}`);
588
- }
589
- return [`${prefix}\uFF1A`, ...lines].join("\n");
590
- }
591
- function upsertTraceStep(step) {
592
- const idx = traceSteps.value.findIndex((item) => item.id === step.id);
593
- if (idx >= 0) {
594
- traceSteps.value[idx] = { ...traceSteps.value[idx], ...step };
595
- } else {
596
- traceSteps.value.push(step);
597
- }
598
- }
599
- function appendMissingFieldsFromResult(missingFields, message) {
600
- const existingNames = new Set(inlineFields.value.map((f) => f.name));
601
- const candidates = Array.isArray(missingFields) ? [...missingFields] : [];
602
- if (candidates.length === 0 && message && /(附件|图片|照片|photo|image|attachment)/i.test(message) && !inlineFields.value.some((f) => isUploadField(f))) {
603
- candidates.push({
604
- name: "attachments",
605
- label: "\u73B0\u573A\u7167\u7247",
606
- widget: "image",
607
- required: true,
608
- visible: true
609
- });
610
- }
611
- for (const field of candidates) {
612
- if (!(field == null ? void 0 : field.name) || existingNames.has(field.name)) continue;
613
- existingNames.add(field.name);
614
- dynamicFields.value.push({
615
- ...field,
616
- visible: field.visible !== false
617
- });
618
- }
619
- }
620
- async function handleExecute() {
621
153
  if (!canExecute.value || executing.value) return;
622
154
  errorMessage.value = "";
623
- submitReceipt.value = null;
624
- if (Object.values(uploadingFields).some(Boolean)) {
625
- errorMessage.value = "\u9644\u4EF6\u6B63\u5728\u4E0A\u4F20\u4E2D\uFF0C\u8BF7\u7A0D\u5019\u518D\u63D0\u4EA4";
155
+ successMessage.value = "";
156
+ const invalid = form.validate();
157
+ if (invalid) {
158
+ report({ type: "validation", message: invalid.message, field: invalid.field });
626
159
  return;
627
160
  }
628
- for (const field of visibleFields.value) {
629
- const val = formValues[field.name];
630
- if (field.required && isBlank(val)) {
631
- const label = field.label || field.name;
632
- errorMessage.value = isUploadField(field) ? `\u8BF7\u5148\u4E0A\u4F20\u300C${label}\u300D` : `\u8BF7\u5148\u586B\u5199\u300C${label}\u300D`;
633
- return;
634
- }
635
- const formatErr = validateFieldFormat(field, val);
636
- if (formatErr) {
637
- fieldValidationErrors[field.name] = formatErr;
638
- errorMessage.value = formatErr;
639
- return;
640
- }
641
- delete fieldValidationErrors[field.name];
642
- }
643
161
  if (resolvedMode.value === "reply") {
644
- const attachments = collectUploadedAttachments();
645
- const replyText = buildReplyText();
646
- if (props.submitReply) {
647
- executing.value = true;
648
- traceExpanded.value = true;
649
- traceSteps.value = [
650
- {
651
- id: "submit",
652
- label: "\u6B63\u5728\u63D0\u4EA4\u8868\u5355\u4EA4\u7531\u4E1A\u52A1\u52A9\u624B\u5904\u7406\u2026",
653
- status: "running"
654
- }
655
- ];
656
- try {
657
- const res = await props.submitReply({
658
- text: replyText,
659
- attachments: attachments.length ? attachments : void 0,
660
- values: { ...formValues },
661
- onTrace: upsertTraceStep
662
- });
663
- if (Array.isArray(res.trace)) {
664
- for (const step of res.trace) upsertTraceStep(step);
665
- }
666
- if (res.ok) {
667
- upsertTraceStep({
668
- id: "submit",
669
- label: "\u8868\u5355\u63D0\u4EA4\u4E0E\u5904\u7406\u5B8C\u6210",
670
- status: "succeeded",
671
- detail: res.message
672
- });
673
- replySent.value = true;
674
- submitReceipt.value = res.message || `${cardTitle.value}\u5904\u7406\u6210\u529F`;
675
- toast.showDisplayToast(submitReceipt.value, "success");
676
- } else {
677
- upsertTraceStep({
678
- id: "submit",
679
- label: "\u5904\u7406\u672A\u5B8C\u6210\uFF0C\u9700\u8865\u5145\u4FE1\u606F",
680
- status: "failed",
681
- detail: res.message
682
- });
683
- errorMessage.value = res.message || "\u4FE1\u606F\u4E0D\u5B8C\u6574\u6216\u5904\u7406\u5931\u8D25\uFF0C\u8BF7\u8865\u5145\u540E\u91CD\u65B0\u63D0\u4EA4";
684
- appendMissingFieldsFromResult(res.missingFields, res.message);
685
- toast.showDisplayToast(errorMessage.value, "warning", 4500);
686
- }
687
- } catch (err) {
688
- const msg = err instanceof Error ? err.message : "\u63D0\u4EA4\u5904\u7406\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5";
689
- upsertTraceStep({
690
- id: "submit",
691
- label: "\u63D0\u4EA4\u8FC7\u7A0B\u53D1\u751F\u5F02\u5E38",
692
- status: "failed",
693
- detail: msg
694
- });
695
- errorMessage.value = msg;
696
- toast.showDisplayToast(msg, "error", 4500);
697
- } finally {
698
- executing.value = false;
699
- }
162
+ const attachments = form.attachments();
163
+ const text = form.replyText(((_a = props.replyPrefix) == null ? void 0 : _a.trim()) || `\u8BF7\u6309\u4EE5\u4E0B\u4FE1\u606F${cardTitle.value}`);
164
+ if (!props.submitReply) {
165
+ replySent.value = true;
166
+ if (attachments.length) emit("action", text, attachments);
167
+ else emit("action", text);
700
168
  return;
701
169
  }
702
- replySent.value = true;
703
- submitReceipt.value = "\u5DF2\u63D0\u4EA4\uFF0CAgent \u6B63\u5728\u6309\u4F60\u586B\u5199\u7684\u4FE1\u606F\u5904\u7406\uFF08\u82E5\u5904\u7406\u5931\u8D25\u53EF\u70B9\u300C\u4FEE\u6539\u91CD\u63D0\u300D\uFF09";
704
- if (attachments.length) {
705
- emit("action", replyText, attachments);
706
- } else {
707
- emit("action", replyText);
170
+ executing.value = true;
171
+ try {
172
+ const res = await props.submitReply({
173
+ text,
174
+ attachments: attachments.length ? attachments : void 0,
175
+ values: { ...form.values }
176
+ });
177
+ if (res.ok) {
178
+ replySent.value = true;
179
+ report({ type: "success", message: res.message || `${cardTitle.value}\u5904\u7406\u6210\u529F` });
180
+ } else {
181
+ form.appendFields(res.missingFields);
182
+ report({ type: "error", message: res.message || "\u4FE1\u606F\u4E0D\u5B8C\u6574\u6216\u5904\u7406\u5931\u8D25\uFF0C\u8BF7\u8865\u5145\u540E\u91CD\u65B0\u63D0\u4EA4" });
183
+ }
184
+ } catch (err) {
185
+ report({ type: "error", message: err instanceof Error ? err.message : "\u63D0\u4EA4\u5904\u7406\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5" });
186
+ } finally {
187
+ executing.value = false;
708
188
  }
709
189
  return;
710
190
  }
711
191
  if (!props.executeAction) return;
712
192
  executing.value = true;
713
193
  try {
714
- const payload = {};
715
- for (const [k, v] of Object.entries(formValues)) {
716
- if (!isBlank(v)) {
717
- payload[k] = v;
718
- }
194
+ const values = {};
195
+ for (const [key, value] of Object.entries(form.values)) {
196
+ if (!fieldUtils.isBlankValue(value)) values[key] = value;
719
197
  }
720
198
  const res = await props.executeAction({
721
199
  operation: props.operation.trim(),
722
200
  mode: resolvedMode.value,
723
- values: payload
201
+ values
724
202
  });
725
203
  hasExecuted.value = true;
726
204
  resultData.value = res.data;
727
205
  if (resolvedMode.value === "submit") {
728
- submitReceipt.value = `${cardTitle.value}\u5DF2\u63D0\u4EA4\u6210\u529F`;
206
+ report({ type: "success", message: `${cardTitle.value}\u5DF2\u63D0\u4EA4\u6210\u529F` });
729
207
  }
730
208
  } catch (err) {
731
- errorMessage.value = err instanceof Error ? err.message : "\u64CD\u4F5C\u6267\u884C\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u8F93\u5165\u6761\u4EF6";
209
+ report({ type: "error", message: err instanceof Error ? err.message : "\u64CD\u4F5C\u6267\u884C\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u8F93\u5165\u6761\u4EF6" });
732
210
  } finally {
733
211
  executing.value = false;
734
212
  }
735
213
  }
736
- function revokeAllUploadPreviews() {
737
- if (typeof URL === "undefined" || typeof URL.revokeObjectURL !== "function") {
214
+ function handleAction(key) {
215
+ if (key === "submit") {
216
+ void submit();
738
217
  return;
739
218
  }
740
- for (const list of Object.values(uploadedFiles)) {
741
- for (const item of list) {
742
- if (item.previewUrl && item.isObjectUrl) URL.revokeObjectURL(item.previewUrl);
743
- }
744
- }
745
- }
746
- function unlockReplyEdit() {
747
- replySent.value = false;
748
- errorMessage.value = "";
749
- submitReceipt.value = null;
750
- }
751
- function handleReset() {
752
- for (const key of Object.keys(formValues)) {
753
- delete formValues[key];
754
- }
755
- for (const key of Object.keys(fieldValidationErrors)) {
756
- delete fieldValidationErrors[key];
757
- }
758
- revokeAllUploadPreviews();
759
- for (const key of Object.keys(uploadedFiles)) {
760
- delete uploadedFiles[key];
761
- }
762
- initPrefilledValues();
219
+ form.reset();
763
220
  errorMessage.value = "";
764
- if (!replySent.value) submitReceipt.value = null;
221
+ if (!replySent.value) successMessage.value = "";
765
222
  }
766
- vue.watch(
767
- () => props.values,
768
- () => {
769
- initPrefilledValues();
770
- },
771
- { immediate: true, deep: true }
772
- );
773
223
  vue.onMounted(() => {
774
224
  void loadSchemaIfNeeded();
775
225
  });
776
- vue.onBeforeUnmount(() => {
777
- revokeAllUploadPreviews();
778
- });
779
226
  return (_ctx, _cache) => {
780
227
  var _a;
781
- return vue.openBlock(), vue.createElementBlock(
782
- "div",
783
- {
784
- class: vue.normalizeClass(["yc-display-card yc-display-form-card", { "is-compact": __props.compact }])
785
- },
786
- [
787
- vue.createElementVNode("div", _hoisted_1, [
788
- vue.createElementVNode("div", _hoisted_2, [
789
- _cache[1] || (_cache[1] = vue.createElementVNode(
790
- "span",
791
- { class: "yc-display-form-card__accent" },
792
- null,
793
- -1
794
- /* CACHED */
795
- )),
796
- vue.createElementVNode("div", _hoisted_3, [
797
- vue.createElementVNode(
798
- "div",
799
- _hoisted_4,
800
- vue.toDisplayString(cardTitle.value),
801
- 1
802
- /* TEXT */
803
- ),
804
- cardSubtitle.value ? (vue.openBlock(), vue.createElementBlock(
805
- "div",
806
- _hoisted_5,
807
- vue.toDisplayString(cardSubtitle.value),
808
- 1
809
- /* TEXT */
810
- )) : vue.createCommentVNode("v-if", true)
811
- ])
812
- ]),
813
- vue.createElementVNode(
814
- "span",
815
- {
816
- class: vue.normalizeClass(["yc-display-form-card__badge", resolvedMode.value === "query" ? "is-query" : "is-form"])
817
- },
818
- vue.toDisplayString(resolvedMode.value === "query" ? "\u7B5B\u9009\u67E5\u8BE2" : "\u4E1A\u52A1\u8868\u5355"),
819
- 3
820
- /* TEXT, CLASS */
821
- )
822
- ]),
823
- loadingSchema.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, " \u6B63\u5728\u52A0\u8F7D\u8868\u5355\u914D\u7F6E\u2026 ")) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
824
- visibleFields.value.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8, [
825
- (vue.openBlock(true), vue.createElementBlock(
826
- vue.Fragment,
827
- null,
828
- vue.renderList(visibleFields.value, (field) => {
829
- var _a2, _b, _c, _d, _e, _f, _g;
830
- return vue.openBlock(), vue.createElementBlock(
831
- "div",
832
- {
833
- key: field.name,
834
- class: vue.normalizeClass(["yc-display-form-card__field", {
835
- "is-full-row": field.widget === "textarea" || isUploadField(field)
836
- }])
837
- },
838
- [
839
- vue.createElementVNode("label", _hoisted_9, [
840
- field.required ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_10, "*")) : vue.createCommentVNode("v-if", true),
841
- vue.createTextVNode(
842
- " " + vue.toDisplayString(field.label || field.name) + " ",
843
- 1
844
- /* TEXT */
845
- ),
846
- dynamicFieldNames.value.has(field.name) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_11, " \u9700\u8865\u5145 ")) : vue.createCommentVNode("v-if", true)
847
- ]),
848
- isRadioField(field) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_12, [
849
- (vue.openBlock(true), vue.createElementBlock(
850
- vue.Fragment,
851
- null,
852
- vue.renderList(fieldOptions(field), (opt) => {
853
- return vue.openBlock(), vue.createElementBlock("button", {
854
- key: String(opt.value),
855
- type: "button",
856
- role: "radio",
857
- "aria-checked": formValues[field.name] === opt.value,
858
- disabled: replySent.value,
859
- class: vue.normalizeClass(["yc-display-form-card__choice-item", { "is-selected": formValues[field.name] === opt.value }]),
860
- onClick: ($event) => formValues[field.name] = opt.value
861
- }, vue.toDisplayString(opt.label), 11, _hoisted_13);
862
- }),
863
- 128
864
- /* KEYED_FRAGMENT */
865
- ))
866
- ])) : isCheckboxField(field) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14, [
867
- (vue.openBlock(true), vue.createElementBlock(
868
- vue.Fragment,
869
- null,
870
- vue.renderList(fieldOptions(field), (opt) => {
871
- return vue.openBlock(), vue.createElementBlock("button", {
872
- key: String(opt.value),
873
- type: "button",
874
- role: "checkbox",
875
- "aria-checked": isCheckboxChecked(field, opt.value),
876
- disabled: replySent.value,
877
- class: vue.normalizeClass(["yc-display-form-card__choice-item", { "is-selected": isCheckboxChecked(field, opt.value) }]),
878
- onClick: ($event) => toggleCheckboxOption(field, opt.value)
879
- }, vue.toDisplayString(opt.label), 11, _hoisted_15);
880
- }),
881
- 128
882
- /* KEYED_FRAGMENT */
883
- ))
884
- ])) : isSelectField(field) ? (vue.openBlock(), vue.createElementBlock("select", {
885
- key: 2,
886
- value: (_a2 = formValues[field.name]) != null ? _a2 : "",
887
- disabled: replySent.value,
888
- class: "yc-display-form-card__control yc-display-form-card__select",
889
- onFocus: ($event) => loadFieldOptions(field),
890
- onChange: (event) => handleSelectChange(field, event)
891
- }, [
892
- vue.createElementVNode(
893
- "option",
894
- _hoisted_17,
895
- vue.toDisplayString(loadingOptions[field.name] ? "\u52A0\u8F7D\u9009\u9879\u4E2D\u2026" : `\u8BF7\u9009\u62E9${field.label || field.name}`),
896
- 1
897
- /* TEXT */
898
- ),
899
- (vue.openBlock(true), vue.createElementBlock(
900
- vue.Fragment,
901
- null,
902
- vue.renderList(fieldOptions(field), (opt) => {
903
- return vue.openBlock(), vue.createElementBlock("option", {
904
- key: String(opt.value),
905
- value: String(opt.value)
906
- }, vue.toDisplayString(opt.label), 9, _hoisted_18);
907
- }),
908
- 128
909
- /* KEYED_FRAGMENT */
910
- ))
911
- ], 40, _hoisted_16)) : isDateField(field) ? (vue.openBlock(), vue.createElementBlock("input", {
912
- key: 3,
913
- type: field.widget === "datetime" ? "datetime-local" : "date",
914
- value: formatDateInputValue(field, formValues[field.name]),
915
- disabled: replySent.value,
916
- class: "yc-display-form-card__control yc-display-form-card__input",
917
- onInput: (event) => handleDateInput(field, event)
918
- }, null, 40, _hoisted_19)) : isNumberField(field) ? (vue.openBlock(), vue.createElementBlock("input", {
919
- key: 4,
920
- type: "number",
921
- step: field.type === "integer" ? "1" : "any",
922
- inputmode: field.type === "integer" ? "numeric" : "decimal",
923
- value: (_b = formValues[field.name]) != null ? _b : "",
924
- disabled: replySent.value,
925
- placeholder: `\u8BF7\u8F93\u5165${field.label || field.name}`,
926
- class: "yc-display-form-card__control yc-display-form-card__input",
927
- onInput: (event) => handleNumberInput(field, event)
928
- }, null, 40, _hoisted_20)) : field.type === "boolean" ? (vue.openBlock(), vue.createElementBlock("button", {
929
- key: 5,
930
- type: "button",
931
- role: "switch",
932
- "aria-checked": Boolean(formValues[field.name]),
933
- disabled: replySent.value,
934
- class: vue.normalizeClass(["yc-display-form-card__switch", { "is-checked": Boolean(formValues[field.name]) }]),
935
- onClick: ($event) => formValues[field.name] = !formValues[field.name]
936
- }, [..._cache[2] || (_cache[2] = [
937
- vue.createElementVNode(
938
- "span",
939
- { class: "yc-display-form-card__switch-thumb" },
940
- null,
941
- -1
942
- /* CACHED */
943
- )
944
- ])], 10, _hoisted_21)) : isUploadField(field) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_22, [
945
- vue.createElementVNode("input", {
946
- ref_for: true,
947
- ref: (el) => setFileInputRef(field.name, el),
948
- type: "file",
949
- multiple: "",
950
- accept: field.widget === "image" ? "image/*" : void 0,
951
- class: "yc-display-form-card__upload-input",
952
- onChange: (event) => handleFileInputChange(field, event)
953
- }, null, 40, _hoisted_23),
954
- vue.createElementVNode("div", _hoisted_24, [
955
- (vue.openBlock(true), vue.createElementBlock(
956
- vue.Fragment,
957
- null,
958
- vue.renderList((_c = uploadedFiles[field.name]) != null ? _c : [], (item, idx) => {
959
- return vue.openBlock(), vue.createElementBlock(
960
- vue.Fragment,
961
- {
962
- key: `${item.attachment.fileRef || item.attachment.fileName}-${idx}`
963
- },
964
- [
965
- item.previewUrl ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_25, [
966
- vue.createElementVNode("img", {
967
- src: item.previewUrl,
968
- alt: item.attachment.fileName
969
- }, null, 8, _hoisted_26),
970
- !replySent.value ? (vue.openBlock(), vue.createElementBlock("button", {
971
- key: 0,
972
- type: "button",
973
- class: "yc-display-form-card__thumb-remove",
974
- title: "\u79FB\u9664",
975
- onClick: ($event) => removeUploadedItem(field.name, idx)
976
- }, " \xD7 ", 8, _hoisted_27)) : vue.createCommentVNode("v-if", true)
977
- ])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_28, [
978
- vue.createElementVNode(
979
- "span",
980
- _hoisted_29,
981
- vue.toDisplayString(item.attachment.fileName),
982
- 1
983
- /* TEXT */
984
- ),
985
- !replySent.value ? (vue.openBlock(), vue.createElementBlock("button", {
986
- key: 0,
987
- type: "button",
988
- class: "yc-display-form-card__file-remove",
989
- title: "\u79FB\u9664",
990
- onClick: ($event) => removeUploadedItem(field.name, idx)
991
- }, " \xD7 ", 8, _hoisted_30)) : vue.createCommentVNode("v-if", true)
992
- ]))
993
- ],
994
- 64
995
- /* STABLE_FRAGMENT */
996
- );
997
- }),
998
- 128
999
- /* KEYED_FRAGMENT */
1000
- )),
1001
- !replySent.value ? (vue.openBlock(), vue.createElementBlock("button", {
1002
- key: 0,
1003
- type: "button",
1004
- class: vue.normalizeClass(["yc-display-form-card__upload-trigger", {
1005
- "is-image": field.widget === "image",
1006
- "is-loading": Boolean(uploadingFields[field.name])
1007
- }]),
1008
- disabled: Boolean(uploadingFields[field.name]),
1009
- onClick: ($event) => triggerFileSelect(field.name)
1010
- }, [
1011
- uploadingFields[field.name] ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_32, "\u4E0A\u4F20\u4E2D\u2026")) : (vue.openBlock(), vue.createElementBlock(
1012
- "span",
1013
- _hoisted_33,
1014
- vue.toDisplayString(field.widget === "image" ? "+ \u4E0A\u4F20\u56FE\u7247" : "+ \u4E0A\u4F20\u9644\u4EF6"),
1015
- 1
1016
- /* TEXT */
1017
- ))
1018
- ], 10, _hoisted_31)) : vue.createCommentVNode("v-if", true)
1019
- ])
1020
- ])) : isPhoneField(field) ? (vue.openBlock(), vue.createElementBlock("input", {
1021
- key: 7,
1022
- type: "tel",
1023
- inputmode: "tel",
1024
- maxlength: "20",
1025
- value: String((_d = formValues[field.name]) != null ? _d : ""),
1026
- disabled: replySent.value,
1027
- placeholder: `\u8BF7\u8F93\u5165${field.label || field.name}`,
1028
- class: vue.normalizeClass(["yc-display-form-card__control yc-display-form-card__input", { "is-invalid": Boolean(fieldValidationErrors[field.name]) }]),
1029
- onInput: (event) => {
1030
- formValues[field.name] = event.target.value;
1031
- delete fieldValidationErrors[field.name];
1032
- },
1033
- onBlur: ($event) => handleFieldBlur(field)
1034
- }, null, 42, _hoisted_34)) : isEmailField(field) ? (vue.openBlock(), vue.createElementBlock("input", {
1035
- key: 8,
1036
- type: "email",
1037
- inputmode: "email",
1038
- value: String((_e = formValues[field.name]) != null ? _e : ""),
1039
- disabled: replySent.value,
1040
- placeholder: `\u8BF7\u8F93\u5165${field.label || field.name}`,
1041
- class: vue.normalizeClass(["yc-display-form-card__control yc-display-form-card__input", { "is-invalid": Boolean(fieldValidationErrors[field.name]) }]),
1042
- onInput: (event) => {
1043
- formValues[field.name] = event.target.value;
1044
- delete fieldValidationErrors[field.name];
1045
- },
1046
- onBlur: ($event) => handleFieldBlur(field)
1047
- }, null, 42, _hoisted_35)) : field.widget === "textarea" ? (vue.openBlock(), vue.createElementBlock("textarea", {
1048
- key: 9,
1049
- rows: "3",
1050
- value: String((_f = formValues[field.name]) != null ? _f : ""),
1051
- disabled: replySent.value,
1052
- placeholder: `\u8BF7\u8F93\u5165${field.label || field.name}`,
1053
- class: "yc-display-form-card__control yc-display-form-card__textarea",
1054
- onInput: (event) => formValues[field.name] = event.target.value
1055
- }, null, 40, _hoisted_36)) : (vue.openBlock(), vue.createElementBlock("input", {
1056
- key: 10,
1057
- type: "text",
1058
- value: String((_g = formValues[field.name]) != null ? _g : ""),
1059
- disabled: replySent.value,
1060
- placeholder: `\u8BF7\u8F93\u5165${field.label || field.name}`,
1061
- class: "yc-display-form-card__control yc-display-form-card__input",
1062
- onInput: (event) => formValues[field.name] = event.target.value
1063
- }, null, 40, _hoisted_37)),
1064
- fieldValidationErrors[field.name] ? (vue.openBlock(), vue.createElementBlock(
1065
- "span",
1066
- _hoisted_38,
1067
- vue.toDisplayString(fieldValidationErrors[field.name]),
1068
- 1
1069
- /* TEXT */
1070
- )) : vue.createCommentVNode("v-if", true)
1071
- ],
1072
- 2
1073
- /* CLASS */
1074
- );
1075
- }),
1076
- 128
1077
- /* KEYED_FRAGMENT */
1078
- ))
1079
- ])) : vue.createCommentVNode("v-if", true),
1080
- vue.createElementVNode("div", _hoisted_39, [
1081
- resolvedMode.value === "reply" && replySent.value ? (vue.openBlock(), vue.createElementBlock("button", {
1082
- key: 0,
1083
- type: "button",
1084
- class: "yc-display-form-card__btn is-default",
1085
- onClick: unlockReplyEdit
1086
- }, " \u4FEE\u6539\u91CD\u63D0 ")) : vue.createCommentVNode("v-if", true),
1087
- vue.createElementVNode("button", {
1088
- type: "button",
1089
- class: "yc-display-form-card__btn is-primary",
1090
- disabled: !canExecute.value || executing.value,
1091
- onClick: handleExecute
1092
- }, vue.toDisplayString(executing.value ? "\u5904\u7406\u4E2D\u2026" : resolvedSubmitLabel.value), 9, _hoisted_40),
1093
- vue.createElementVNode("button", {
1094
- type: "button",
1095
- class: "yc-display-form-card__btn is-default",
1096
- disabled: executing.value || replySent.value,
1097
- onClick: handleReset
1098
- }, " \u91CD\u7F6E ", 8, _hoisted_41)
1099
- ]),
1100
- errorMessage.value ? (vue.openBlock(), vue.createElementBlock(
1101
- "div",
1102
- _hoisted_42,
1103
- vue.toDisplayString(errorMessage.value),
1104
- 1
1105
- /* TEXT */
1106
- )) : vue.createCommentVNode("v-if", true),
1107
- submitReceipt.value ? (vue.openBlock(), vue.createElementBlock(
1108
- "div",
1109
- _hoisted_43,
1110
- vue.toDisplayString(submitReceipt.value),
1111
- 1
1112
- /* TEXT */
1113
- )) : vue.createCommentVNode("v-if", true),
1114
- traceSteps.value.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_44, [
1115
- vue.createElementVNode("button", {
1116
- type: "button",
1117
- class: "yc-display-form-card__trace-toggle",
1118
- onClick: _cache[0] || (_cache[0] = ($event) => traceExpanded.value = !traceExpanded.value)
1119
- }, [
1120
- vue.createElementVNode(
1121
- "span",
1122
- null,
1123
- " \u6267\u884C\u8FFD\u8E2A\uFF08" + vue.toDisplayString(traceSteps.value.length) + " \u6B65\uFF09 ",
1124
- 1
1125
- /* TEXT */
1126
- ),
1127
- vue.createElementVNode(
1128
- "span",
1129
- _hoisted_45,
1130
- vue.toDisplayString(traceExpanded.value ? "\u6536\u8D77" : "\u5C55\u5F00"),
1131
- 1
1132
- /* TEXT */
1133
- )
1134
- ]),
1135
- traceExpanded.value ? (vue.openBlock(), vue.createElementBlock("ul", _hoisted_46, [
228
+ return vue.openBlock(), vue.createBlock(cardShell.default, {
229
+ class: vue.normalizeClass(["yc-display-form-card", { "is-compact": __props.compact }]),
230
+ title: cardTitle.value,
231
+ subtitle: (_a = __props.subtitle) == null ? void 0 : _a.trim(),
232
+ badge: resolvedMode.value === "query" ? { text: "\u7B5B\u9009\u67E5\u8BE2", tone: "neutral" } : { text: "\u4E1A\u52A1\u8868\u5355", tone: "primary" },
233
+ accent: "",
234
+ compact: __props.compact
235
+ }, {
236
+ default: vue.withCtx(() => {
237
+ var _a2;
238
+ return [
239
+ loadingSchema.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, "\u6B63\u5728\u52A0\u8F7D\u8868\u5355\u914D\u7F6E\u2026")) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
240
+ vue.unref(form).visibleFields.value.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, [
1136
241
  (vue.openBlock(true), vue.createElementBlock(
1137
242
  vue.Fragment,
1138
243
  null,
1139
- vue.renderList(traceSteps.value, (step) => {
1140
- return vue.openBlock(), vue.createElementBlock(
1141
- "li",
1142
- {
1143
- key: step.id,
1144
- class: vue.normalizeClass(["yc-display-form-card__trace-item", `is-${step.status}`])
1145
- },
1146
- [
1147
- _cache[3] || (_cache[3] = vue.createElementVNode(
1148
- "span",
1149
- { class: "yc-display-form-card__trace-dot" },
1150
- null,
1151
- -1
1152
- /* CACHED */
1153
- )),
1154
- vue.createElementVNode("div", _hoisted_47, [
1155
- vue.createElementVNode(
1156
- "div",
1157
- _hoisted_48,
1158
- vue.toDisplayString(step.label),
1159
- 1
1160
- /* TEXT */
1161
- ),
1162
- step.detail ? (vue.openBlock(), vue.createElementBlock(
1163
- "div",
1164
- _hoisted_49,
1165
- vue.toDisplayString(step.detail),
1166
- 1
1167
- /* TEXT */
1168
- )) : vue.createCommentVNode("v-if", true)
1169
- ])
1170
- ],
1171
- 2
1172
- /* CLASS */
1173
- );
1174
- }),
1175
- 128
1176
- /* KEYED_FRAGMENT */
1177
- ))
1178
- ])) : vue.createCommentVNode("v-if", true)
1179
- ])) : vue.createCommentVNode("v-if", true),
1180
- hasExecuted.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_50, [
1181
- ((_a = resultRows.value) == null ? void 0 : _a.length) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_51, [
1182
- vue.createElementVNode("table", _hoisted_52, [
1183
- vue.createElementVNode("thead", null, [
1184
- vue.createElementVNode("tr", null, [
1185
- (vue.openBlock(true), vue.createElementBlock(
1186
- vue.Fragment,
1187
- null,
1188
- vue.renderList(resultColumns.value, (col) => {
1189
- return vue.openBlock(), vue.createElementBlock(
1190
- "th",
1191
- { key: col },
1192
- vue.toDisplayString(col),
1193
- 1
1194
- /* TEXT */
1195
- );
1196
- }),
1197
- 128
1198
- /* KEYED_FRAGMENT */
1199
- ))
1200
- ])
1201
- ]),
1202
- vue.createElementVNode("tbody", null, [
1203
- (vue.openBlock(true), vue.createElementBlock(
1204
- vue.Fragment,
1205
- null,
1206
- vue.renderList(resultRows.value, (row, rIdx) => {
1207
- return vue.openBlock(), vue.createElementBlock("tr", { key: rIdx }, [
1208
- (vue.openBlock(true), vue.createElementBlock(
1209
- vue.Fragment,
1210
- null,
1211
- vue.renderList(resultColumns.value, (col) => {
1212
- var _a2;
1213
- return vue.openBlock(), vue.createElementBlock(
1214
- "td",
1215
- { key: col },
1216
- vue.toDisplayString((_a2 = row[col]) != null ? _a2 : "\u2014"),
1217
- 1
1218
- /* TEXT */
1219
- );
1220
- }),
1221
- 128
1222
- /* KEYED_FRAGMENT */
1223
- ))
1224
- ]);
1225
- }),
1226
- 128
1227
- /* KEYED_FRAGMENT */
1228
- ))
1229
- ])
1230
- ])
1231
- ])) : resultDetailEntries.value.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_53, [
1232
- (vue.openBlock(true), vue.createElementBlock(
1233
- vue.Fragment,
1234
- null,
1235
- vue.renderList(resultDetailEntries.value, (entry) => {
1236
- return vue.openBlock(), vue.createElementBlock("div", {
1237
- key: entry.label,
1238
- class: "yc-display-form-card__kv-row"
1239
- }, [
1240
- vue.createElementVNode(
1241
- "span",
1242
- _hoisted_54,
1243
- vue.toDisplayString(entry.label),
1244
- 1
1245
- /* TEXT */
1246
- ),
1247
- vue.createElementVNode(
1248
- "span",
1249
- _hoisted_55,
1250
- vue.toDisplayString(entry.value),
1251
- 1
1252
- /* TEXT */
1253
- )
1254
- ]);
244
+ vue.renderList(vue.unref(form).visibleFields.value, (field) => {
245
+ return vue.openBlock(), vue.createBlock(fieldControl_vue_vue_type_script_setup_true_lang.default, {
246
+ key: field.name,
247
+ field,
248
+ "model-value": vue.unref(form).values[field.name],
249
+ options: vue.unref(form).optionsOf(field),
250
+ "loading-options": Boolean(loadingOptions.value[field.name]),
251
+ disabled: replySent.value,
252
+ error: vue.unref(form).errors[field.name],
253
+ hint: vue.unref(form).appendedNames.value.has(field.name) ? "\u9700\u8865\u5145" : "",
254
+ "upload-file": __props.uploadFile,
255
+ "onUpdate:modelValue": (value) => vue.unref(form).setValue(field.name, value),
256
+ onFocus: ($event) => loadFieldOptions(field),
257
+ onBlur: ($event) => vue.unref(form).values[field.name] !== void 0 && vue.unref(form).validateField(field),
258
+ onUploadError: (message) => report({ type: "upload-error", message, field: field.name })
259
+ }, null, 8, ["field", "model-value", "options", "loading-options", "disabled", "error", "hint", "upload-file", "onUpdate:modelValue", "onFocus", "onBlur", "onUploadError"]);
1255
260
  }),
1256
261
  128
1257
262
  /* KEYED_FRAGMENT */
1258
263
  ))
1259
- ])) : vue.createCommentVNode("v-if", true)
1260
- ])) : vue.createCommentVNode("v-if", true)
1261
- ]))
1262
- ],
1263
- 2
1264
- /* CLASS */
1265
- );
264
+ ])) : vue.createCommentVNode("v-if", true),
265
+ vue.createVNode(actionBar.default, {
266
+ items: actions.value,
267
+ "loading-key": executing.value ? "submit" : "",
268
+ onClick: handleAction
269
+ }, null, 8, ["items", "loading-key"]),
270
+ __props.inlineFeedback && errorMessage.value ? (vue.openBlock(), vue.createBlock(inlineAlert.default, {
271
+ key: 1,
272
+ tone: "error",
273
+ text: errorMessage.value
274
+ }, null, 8, ["text"])) : vue.createCommentVNode("v-if", true),
275
+ __props.inlineFeedback && successMessage.value ? (vue.openBlock(), vue.createBlock(inlineAlert.default, {
276
+ key: 2,
277
+ tone: "success",
278
+ text: successMessage.value
279
+ }, null, 8, ["text"])) : vue.createCommentVNode("v-if", true),
280
+ ((_a2 = resultRows.value) == null ? void 0 : _a2.length) ? (vue.openBlock(), vue.createBlock(dataTable.default, {
281
+ key: 3,
282
+ rows: resultRows.value,
283
+ bordered: ""
284
+ }, null, 8, ["rows"])) : resultEntries.value.length ? (vue.openBlock(), vue.createBlock(kvList.default, {
285
+ key: 4,
286
+ items: resultEntries.value,
287
+ bordered: ""
288
+ }, null, 8, ["items"])) : vue.createCommentVNode("v-if", true)
289
+ ]))
290
+ ];
291
+ }),
292
+ _: 1
293
+ /* STABLE */
294
+ }, 8, ["class", "title", "subtitle", "badge", "compact"]);
1266
295
  };
1267
296
  }
1268
297
  });