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