yc-agent-ui 1.2.6 → 1.2.8

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 (136) hide show
  1. package/es/_virtual/_commonjsHelpers.mjs +7 -0
  2. package/es/_virtual/toastify.mjs +3 -0
  3. package/es/components/data-table/src/data-table-pagination.vue.d.ts +3 -3
  4. package/es/components/data-table/src/data-table-toolbar.vue.d.ts +1 -1
  5. package/es/components/data-table/src/data-table.vue.d.ts +3 -3
  6. package/es/components/dialog-form/index.d.ts +4 -4
  7. package/es/components/dialog-form/src/index.vue.d.ts +4 -4
  8. package/es/components/display-item/index.d.ts +15 -15
  9. package/es/components/display-item/src/index.vue.d.ts +13 -13
  10. package/es/components/drawer-form/index.d.ts +10 -10
  11. package/es/components/drawer-form/src/index.vue.d.ts +6 -6
  12. package/es/components/form/index.d.ts +11 -11
  13. package/es/components/form/src/form-content.vue.d.ts +9 -9
  14. package/es/components/form/src/index.vue.d.ts +9 -9
  15. package/es/components/form-item/index.d.ts +6 -6
  16. package/es/components/form-item/src/index.vue.d.ts +6 -6
  17. package/es/components/page/index.d.ts +362 -362
  18. package/es/components/page/src/index.vue.d.ts +123 -123
  19. package/es/components/search/index.d.ts +82 -82
  20. package/es/components/search/src/index.vue.d.ts +30 -30
  21. package/es/components/table/index.d.ts +18 -18
  22. package/es/components/table/src/index.vue.d.ts +2 -2
  23. package/es/components/table/src/table-column.vue.d.ts +34 -34
  24. package/es/components/virtual-table/index.d.ts +7 -7
  25. package/es/components/virtual-table/src/index.vue.d.ts +2 -2
  26. package/es/components/yc-ai-chat/src/file-card.vue.d.ts +1 -1
  27. package/es/components/yc-ai-chat/src/select.vue.d.ts +2 -2
  28. package/es/components/yc-ai-chat/src/sidebar.vue.d.ts +3 -3
  29. package/es/components/yc-coss-table/src/coss-table.vue.d.ts +2 -2
  30. package/es/components/yc-coss-table/src/table-head.vue.d.ts +1 -1
  31. package/es/components/yc-display-cards/index.d.ts +20 -1
  32. package/es/components/yc-display-cards/src/form-card.vue.d.ts +23 -0
  33. package/es/components/yc-display-cards/src/toast.d.ts +4 -0
  34. package/es/components/yc-display-cards/src/types.d.ts +77 -0
  35. package/es/components/yc-plus-page/src/header-filter-cell.vue.d.ts +8 -8
  36. package/es/components/yc-plus-page/src/index.vue.d.ts +381 -381
  37. package/es/components/yc-property-table/src/bill-table.vue.d.ts +1 -1
  38. package/es/components/yc-property-table/src/property-table.vue.d.ts +3 -3
  39. package/es/components/yc-select-v2/src/index.vue.d.ts +1 -1
  40. package/es/hooks/usePlusFormReset.d.ts +66 -66
  41. package/es/index.css +18 -10
  42. package/es/index.mjs +1 -1
  43. package/es/node_modules/.pnpm/toastify-js@1.12.0/node_modules/toastify-js/src/toastify.mjs +456 -0
  44. package/es/packages/components/index.mjs +1 -1
  45. package/es/packages/components/yc-display-cards/capability.mjs +24 -2
  46. package/es/packages/components/yc-display-cards/index.mjs +3 -1
  47. package/es/packages/components/yc-display-cards/src/detail-card.vue.mjs +1 -1
  48. package/es/packages/components/yc-display-cards/src/form-card.vue.mjs +6 -0
  49. package/es/packages/components/yc-display-cards/src/form-card2.vue.mjs +1266 -0
  50. package/es/packages/components/yc-display-cards/src/metrics-card.vue.mjs +1 -1
  51. package/es/packages/components/yc-display-cards/src/table-card.vue.mjs +1 -1
  52. package/es/packages/components/yc-display-cards/src/toast.mjs +35 -0
  53. package/es/version.d.ts +1 -1
  54. package/es/version.mjs +1 -1
  55. package/index.css +11 -3
  56. package/index.js +2309 -535
  57. package/index.min.css +11 -3
  58. package/index.min.js +44 -37
  59. package/index.min.mjs +42 -35
  60. package/index.mjs +2307 -534
  61. package/lib/_virtual/_commonjsHelpers.js +10 -0
  62. package/lib/_virtual/toastify.js +5 -0
  63. package/lib/components/data-table/src/data-table-pagination.vue.d.ts +3 -3
  64. package/lib/components/data-table/src/data-table-toolbar.vue.d.ts +1 -1
  65. package/lib/components/data-table/src/data-table.vue.d.ts +3 -3
  66. package/lib/components/dialog-form/index.d.ts +4 -4
  67. package/lib/components/dialog-form/src/index.vue.d.ts +4 -4
  68. package/lib/components/display-item/index.d.ts +15 -15
  69. package/lib/components/display-item/src/index.vue.d.ts +13 -13
  70. package/lib/components/drawer-form/index.d.ts +10 -10
  71. package/lib/components/drawer-form/src/index.vue.d.ts +6 -6
  72. package/lib/components/form/index.d.ts +11 -11
  73. package/lib/components/form/src/form-content.vue.d.ts +9 -9
  74. package/lib/components/form/src/index.vue.d.ts +9 -9
  75. package/lib/components/form-item/index.d.ts +6 -6
  76. package/lib/components/form-item/src/index.vue.d.ts +6 -6
  77. package/lib/components/page/index.d.ts +362 -362
  78. package/lib/components/page/src/index.vue.d.ts +123 -123
  79. package/lib/components/search/index.d.ts +82 -82
  80. package/lib/components/search/src/index.vue.d.ts +30 -30
  81. package/lib/components/table/index.d.ts +18 -18
  82. package/lib/components/table/src/index.vue.d.ts +2 -2
  83. package/lib/components/table/src/table-column.vue.d.ts +34 -34
  84. package/lib/components/virtual-table/index.d.ts +7 -7
  85. package/lib/components/virtual-table/src/index.vue.d.ts +2 -2
  86. package/lib/components/yc-ai-chat/src/file-card.vue.d.ts +1 -1
  87. package/lib/components/yc-ai-chat/src/select.vue.d.ts +2 -2
  88. package/lib/components/yc-ai-chat/src/sidebar.vue.d.ts +3 -3
  89. package/lib/components/yc-coss-table/src/coss-table.vue.d.ts +2 -2
  90. package/lib/components/yc-coss-table/src/table-head.vue.d.ts +1 -1
  91. package/lib/components/yc-display-cards/index.d.ts +20 -1
  92. package/lib/components/yc-display-cards/src/form-card.vue.d.ts +23 -0
  93. package/lib/components/yc-display-cards/src/toast.d.ts +4 -0
  94. package/lib/components/yc-display-cards/src/types.d.ts +77 -0
  95. package/lib/components/yc-plus-page/src/header-filter-cell.vue.d.ts +8 -8
  96. package/lib/components/yc-plus-page/src/index.vue.d.ts +381 -381
  97. package/lib/components/yc-property-table/src/bill-table.vue.d.ts +1 -1
  98. package/lib/components/yc-property-table/src/property-table.vue.d.ts +3 -3
  99. package/lib/components/yc-select-v2/src/index.vue.d.ts +1 -1
  100. package/lib/hooks/usePlusFormReset.d.ts +66 -66
  101. package/lib/index.css +19 -11
  102. package/lib/index.js +1 -0
  103. package/lib/node_modules/.pnpm/toastify-js@1.12.0/node_modules/toastify-js/src/toastify.js +460 -0
  104. package/lib/packages/components/index.js +1 -0
  105. package/lib/packages/components/yc-display-cards/capability.js +23 -1
  106. package/lib/packages/components/yc-display-cards/index.js +3 -0
  107. package/lib/packages/components/yc-display-cards/src/detail-card.vue.js +1 -1
  108. package/lib/packages/components/yc-display-cards/src/form-card.vue.js +10 -0
  109. package/lib/packages/components/yc-display-cards/src/form-card2.vue.js +1270 -0
  110. package/lib/packages/components/yc-display-cards/src/metrics-card.vue.js +1 -1
  111. package/lib/packages/components/yc-display-cards/src/table-card.vue.js +1 -1
  112. package/lib/packages/components/yc-display-cards/src/toast.js +37 -0
  113. package/lib/version.d.ts +1 -1
  114. package/lib/version.js +1 -1
  115. package/locale/en.js +1 -1
  116. package/locale/en.min.js +1 -1
  117. package/locale/en.min.mjs +1 -1
  118. package/locale/en.mjs +1 -1
  119. package/locale/ja.js +1 -1
  120. package/locale/ja.min.js +1 -1
  121. package/locale/ja.min.mjs +1 -1
  122. package/locale/ja.mjs +1 -1
  123. package/locale/ko.js +1 -1
  124. package/locale/ko.min.js +1 -1
  125. package/locale/ko.min.mjs +1 -1
  126. package/locale/ko.mjs +1 -1
  127. package/locale/zh-cn.js +1 -1
  128. package/locale/zh-cn.min.js +1 -1
  129. package/locale/zh-cn.min.mjs +1 -1
  130. package/locale/zh-cn.mjs +1 -1
  131. package/locale/zh-tw.js +1 -1
  132. package/locale/zh-tw.min.js +1 -1
  133. package/locale/zh-tw.min.mjs +1 -1
  134. package/locale/zh-tw.mjs +1 -1
  135. package/package.json +2 -1
  136. package/theme-chalk/index.css +11 -3
@@ -0,0 +1,1266 @@
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';
3
+
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 = {
13
+ key: 0,
14
+ class: "yc-display-form-card__loading"
15
+ };
16
+ const _hoisted_7 = {
17
+ key: 1,
18
+ class: "yc-display-form-card__body"
19
+ };
20
+ const _hoisted_8 = {
21
+ key: 0,
22
+ class: "yc-display-form-card__grid"
23
+ };
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
+ var _sfc_main = /* @__PURE__ */ defineComponent({
122
+ ...{ name: "YcDisplayFormCard" },
123
+ __name: "form-card",
124
+ props: {
125
+ title: { default: "" },
126
+ subtitle: { default: "" },
127
+ operation: { default: "" },
128
+ mode: { default: void 0 },
129
+ submitLabel: { default: "" },
130
+ replyPrefix: { default: "" },
131
+ fields: { default: () => [] },
132
+ values: { default: () => ({}) },
133
+ compact: { type: Boolean, default: false },
134
+ skillName: { default: "" },
135
+ executeAction: { type: Function, default: void 0 },
136
+ uploadFile: { type: Function, default: void 0 },
137
+ submitReply: { type: Function, default: void 0 }
138
+ },
139
+ emits: ["action"],
140
+ setup(__props, { emit: __emit }) {
141
+ const props = __props;
142
+ const emit = __emit;
143
+ const schemaTitle = ref("");
144
+ const schemaReadOnly = ref(null);
145
+ const loadedFields = ref([]);
146
+ const loadingSchema = ref(false);
147
+ const executing = ref(false);
148
+ const errorMessage = ref("");
149
+ const submitReceipt = ref(null);
150
+ const resultData = ref(null);
151
+ 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();
162
+ const resolvedMode = computed(() => {
163
+ if (props.mode === "reply") return "reply";
164
+ if (props.mode === "submit") return "submit";
165
+ if (props.mode === "query") return "query";
166
+ return schemaReadOnly.value === false ? "submit" : "query";
167
+ });
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(
175
+ () => {
176
+ var _a;
177
+ return ((_a = props.subtitle) == null ? void 0 : _a.trim()) ? props.subtitle.trim() : "";
178
+ }
179
+ );
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
+ const canExecute = computed(
186
+ () => {
187
+ var _a;
188
+ return resolvedMode.value === "reply" ? !replySent.value : Boolean(((_a = props.operation) == null ? void 0 : _a.trim()) && props.executeAction);
189
+ }
190
+ );
191
+ function isObject(value) {
192
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
193
+ }
194
+ function normalizeInlineOptions(raw) {
195
+ 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);
236
+ });
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
+ const resultRows = computed(() => {
272
+ 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));
276
+ });
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
+ }));
295
+ });
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;
322
+ }
323
+ async function loadFieldOptions(field) {
324
+ const op = field.options_operation;
325
+ if (!op || !props.executeAction || remoteOptions[field.name] || loadingOptions[field.name]) {
326
+ return;
327
+ }
328
+ loadingOptions[field.name] = true;
329
+ try {
330
+ const res = await props.executeAction({ operation: op, mode: "options" });
331
+ remoteOptions[field.name] = extractSelectOptions(
332
+ res.data,
333
+ field.option_label_key,
334
+ field.option_value_key
335
+ );
336
+ } catch (e) {
337
+ remoteOptions[field.name] = [];
338
+ } 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);
384
+ }
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
+ }
397
+ 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
482
+ });
483
+ }
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
+ }
552
+ }
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) {
558
+ 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
+ if (!canExecute.value || executing.value) return;
618
+ 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";
622
+ return;
623
+ }
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
+ 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
+ }
696
+ return;
697
+ }
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);
704
+ }
705
+ return;
706
+ }
707
+ if (!props.executeAction) return;
708
+ executing.value = true;
709
+ try {
710
+ const payload = {};
711
+ for (const [k, v] of Object.entries(formValues)) {
712
+ if (!isBlank(v)) {
713
+ payload[k] = v;
714
+ }
715
+ }
716
+ const res = await props.executeAction({
717
+ operation: props.operation.trim(),
718
+ mode: resolvedMode.value,
719
+ values: payload
720
+ });
721
+ hasExecuted.value = true;
722
+ resultData.value = res.data;
723
+ if (resolvedMode.value === "submit") {
724
+ submitReceipt.value = `${cardTitle.value}\u5DF2\u63D0\u4EA4\u6210\u529F`;
725
+ }
726
+ } catch (err) {
727
+ errorMessage.value = err instanceof Error ? err.message : "\u64CD\u4F5C\u6267\u884C\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u8F93\u5165\u6761\u4EF6";
728
+ } finally {
729
+ executing.value = false;
730
+ }
731
+ }
732
+ function revokeAllUploadPreviews() {
733
+ if (typeof URL === "undefined" || typeof URL.revokeObjectURL !== "function") {
734
+ return;
735
+ }
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();
759
+ errorMessage.value = "";
760
+ if (!replySent.value) submitReceipt.value = null;
761
+ }
762
+ watch(
763
+ () => props.values,
764
+ () => {
765
+ initPrefilledValues();
766
+ },
767
+ { immediate: true, deep: true }
768
+ );
769
+ onMounted(() => {
770
+ void loadSchemaIfNeeded();
771
+ });
772
+ onBeforeUnmount(() => {
773
+ revokeAllUploadPreviews();
774
+ });
775
+ return (_ctx, _cache) => {
776
+ 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, [
1132
+ (openBlock(true), createElementBlock(
1133
+ Fragment,
1134
+ 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
+ ]);
1251
+ }),
1252
+ 128
1253
+ /* KEYED_FRAGMENT */
1254
+ ))
1255
+ ])) : createCommentVNode("v-if", true)
1256
+ ])) : createCommentVNode("v-if", true)
1257
+ ]))
1258
+ ],
1259
+ 2
1260
+ /* CLASS */
1261
+ );
1262
+ };
1263
+ }
1264
+ });
1265
+
1266
+ export { _sfc_main as default };