yc-agent-ui 1.2.6 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/chart/src/chart-card.vue.d.ts +21 -21
- package/es/components/chart/src/chart-container.vue.d.ts +2 -2
- package/es/components/chart/src/metric-card.vue.d.ts +1 -1
- package/es/components/data-table/src/data-table-pagination.vue.d.ts +3 -3
- package/es/components/data-table/src/data-table-toolbar.vue.d.ts +1 -1
- package/es/components/data-table/src/data-table.vue.d.ts +11 -11
- package/es/components/descriptions/index.d.ts +9 -9
- package/es/components/descriptions/src/index.vue.d.ts +3 -3
- package/es/components/dialog/index.d.ts +6 -6
- package/es/components/dialog/src/index.vue.d.ts +2 -2
- package/es/components/dialog-form/index.d.ts +14 -14
- package/es/components/dialog-form/src/index.vue.d.ts +10 -10
- package/es/components/display-item/index.d.ts +27 -27
- package/es/components/display-item/src/index.vue.d.ts +25 -25
- package/es/components/drawer-form/index.d.ts +23 -23
- package/es/components/drawer-form/src/index.vue.d.ts +13 -13
- package/es/components/form/index.d.ts +25 -25
- package/es/components/form/src/form-content.vue.d.ts +19 -19
- package/es/components/form/src/index.vue.d.ts +19 -19
- package/es/components/form-item/index.d.ts +31 -31
- package/es/components/form-item/src/index.vue.d.ts +18 -18
- package/es/components/input-tag/index.d.ts +3 -3
- package/es/components/input-tag/src/index.vue.d.ts +3 -3
- package/es/components/page/index.d.ts +753 -753
- package/es/components/page/src/index.vue.d.ts +256 -256
- package/es/components/pagination/index.d.ts +3 -3
- package/es/components/pagination/src/index.vue.d.ts +1 -1
- package/es/components/radio/index.d.ts +5 -5
- package/es/components/radio/src/index.vue.d.ts +5 -5
- package/es/components/render/index.d.ts +1 -1
- package/es/components/render/src/index.vue.d.ts +1 -1
- package/es/components/search/index.d.ts +182 -182
- package/es/components/search/src/index.vue.d.ts +66 -66
- package/es/components/table/index.d.ts +18 -18
- package/es/components/table/src/index.vue.d.ts +2 -2
- package/es/components/table/src/table-action-bar.vue.d.ts +2 -2
- package/es/components/table/src/table-column.vue.d.ts +58 -58
- package/es/components/utils/index.d.ts +3 -3
- package/es/components/virtual-table/index.d.ts +10 -10
- package/es/components/virtual-table/src/index.vue.d.ts +3 -3
- package/es/components/yc-ai-chat/src/bubble.vue.d.ts +1 -1
- package/es/components/yc-ai-chat/src/file-card.vue.d.ts +1 -1
- package/es/components/yc-ai-chat/src/mobile-frame.vue.d.ts +1 -1
- package/es/components/yc-ai-chat/src/select.vue.d.ts +5 -5
- package/es/components/yc-ai-chat/src/sender.vue.d.ts +1 -1
- package/es/components/yc-ai-chat/src/sidebar.vue.d.ts +4 -4
- package/es/components/yc-ai-chat/src/studio.vue.d.ts +1 -1
- package/es/components/yc-controls/src/choice-cards.vue.d.ts +2 -2
- package/es/components/yc-controls/src/segmented.vue.d.ts +1 -1
- package/es/components/yc-coss-table/src/coss-table.vue.d.ts +5 -5
- package/es/components/yc-coss-table/src/table-head.vue.d.ts +3 -3
- package/es/components/yc-display-cards/index.d.ts +20 -2
- package/es/components/yc-display-cards/src/form-card.vue.d.ts +22 -0
- package/es/components/yc-display-cards/src/table-card.vue.d.ts +1 -1
- package/es/components/yc-display-cards/src/types.d.ts +56 -0
- package/es/components/yc-gradient-card/src/index.vue.d.ts +2 -2
- package/es/components/yc-input/src/input.vue.d.ts +4 -4
- package/es/components/yc-input/src/money-input.vue.d.ts +3 -3
- package/es/components/yc-input/src/stepper-input.vue.d.ts +3 -3
- package/es/components/yc-input/src/textarea.vue.d.ts +1 -1
- package/es/components/yc-input-otp/src/index.vue.d.ts +3 -3
- package/es/components/yc-pagination/src/index.vue.d.ts +2 -2
- package/es/components/yc-plus-page/src/header-filter-cell.vue.d.ts +8 -8
- package/es/components/yc-plus-page/src/index.vue.d.ts +779 -779
- package/es/components/yc-plus-tree/src/index.vue.d.ts +1 -1
- package/es/components/yc-property-table/src/asset-table.vue.d.ts +2 -2
- package/es/components/yc-property-table/src/bill-table.vue.d.ts +2 -2
- package/es/components/yc-property-table/src/device-table.vue.d.ts +2 -2
- package/es/components/yc-property-table/src/order-table.vue.d.ts +2 -2
- package/es/components/yc-property-table/src/property-table.vue.d.ts +7 -7
- package/es/components/yc-select-v2/src/index.vue.d.ts +4 -4
- package/es/components/yc-status-dialog/src/index.vue.d.ts +1 -1
- package/es/components/yc-svg-icon/src/index.vue.d.ts +1 -1
- package/es/hooks/usePlusFormReset.d.ts +216 -216
- package/es/index.css +10 -9
- package/es/index.mjs +1 -1
- package/es/packages/components/index.mjs +1 -1
- package/es/packages/components/yc-display-cards/capability.mjs +24 -2
- package/es/packages/components/yc-display-cards/index.mjs +3 -1
- package/es/packages/components/yc-display-cards/src/detail-card.vue.mjs +1 -1
- package/es/packages/components/yc-display-cards/src/form-card.vue.mjs +6 -0
- package/es/packages/components/yc-display-cards/src/form-card2.vue.mjs +907 -0
- package/es/packages/components/yc-display-cards/src/metrics-card.vue.mjs +1 -1
- package/es/packages/components/yc-display-cards/src/table-card.vue.mjs +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/index.css +4 -3
- package/index.js +1465 -535
- package/index.min.css +4 -3
- package/index.min.js +38 -37
- package/index.min.mjs +36 -35
- package/index.mjs +1463 -534
- package/lib/components/chart/src/chart-card.vue.d.ts +21 -21
- package/lib/components/chart/src/chart-container.vue.d.ts +2 -2
- package/lib/components/chart/src/metric-card.vue.d.ts +1 -1
- package/lib/components/data-table/src/data-table-pagination.vue.d.ts +3 -3
- package/lib/components/data-table/src/data-table-toolbar.vue.d.ts +1 -1
- package/lib/components/data-table/src/data-table.vue.d.ts +11 -11
- package/lib/components/descriptions/index.d.ts +9 -9
- package/lib/components/descriptions/src/index.vue.d.ts +3 -3
- package/lib/components/dialog/index.d.ts +6 -6
- package/lib/components/dialog/src/index.vue.d.ts +2 -2
- package/lib/components/dialog-form/index.d.ts +14 -14
- package/lib/components/dialog-form/src/index.vue.d.ts +10 -10
- package/lib/components/display-item/index.d.ts +27 -27
- package/lib/components/display-item/src/index.vue.d.ts +25 -25
- package/lib/components/drawer-form/index.d.ts +23 -23
- package/lib/components/drawer-form/src/index.vue.d.ts +13 -13
- package/lib/components/form/index.d.ts +25 -25
- package/lib/components/form/src/form-content.vue.d.ts +19 -19
- package/lib/components/form/src/index.vue.d.ts +19 -19
- package/lib/components/form-item/index.d.ts +31 -31
- package/lib/components/form-item/src/index.vue.d.ts +18 -18
- package/lib/components/input-tag/index.d.ts +3 -3
- package/lib/components/input-tag/src/index.vue.d.ts +3 -3
- package/lib/components/page/index.d.ts +753 -753
- package/lib/components/page/src/index.vue.d.ts +256 -256
- package/lib/components/pagination/index.d.ts +3 -3
- package/lib/components/pagination/src/index.vue.d.ts +1 -1
- package/lib/components/radio/index.d.ts +5 -5
- package/lib/components/radio/src/index.vue.d.ts +5 -5
- package/lib/components/render/index.d.ts +1 -1
- package/lib/components/render/src/index.vue.d.ts +1 -1
- package/lib/components/search/index.d.ts +182 -182
- package/lib/components/search/src/index.vue.d.ts +66 -66
- package/lib/components/table/index.d.ts +18 -18
- package/lib/components/table/src/index.vue.d.ts +2 -2
- package/lib/components/table/src/table-action-bar.vue.d.ts +2 -2
- package/lib/components/table/src/table-column.vue.d.ts +58 -58
- package/lib/components/utils/index.d.ts +3 -3
- package/lib/components/virtual-table/index.d.ts +10 -10
- package/lib/components/virtual-table/src/index.vue.d.ts +3 -3
- package/lib/components/yc-ai-chat/src/bubble.vue.d.ts +1 -1
- package/lib/components/yc-ai-chat/src/file-card.vue.d.ts +1 -1
- package/lib/components/yc-ai-chat/src/mobile-frame.vue.d.ts +1 -1
- package/lib/components/yc-ai-chat/src/select.vue.d.ts +5 -5
- package/lib/components/yc-ai-chat/src/sender.vue.d.ts +1 -1
- package/lib/components/yc-ai-chat/src/sidebar.vue.d.ts +4 -4
- package/lib/components/yc-ai-chat/src/studio.vue.d.ts +1 -1
- package/lib/components/yc-controls/src/choice-cards.vue.d.ts +2 -2
- package/lib/components/yc-controls/src/segmented.vue.d.ts +1 -1
- package/lib/components/yc-coss-table/src/coss-table.vue.d.ts +5 -5
- package/lib/components/yc-coss-table/src/table-head.vue.d.ts +3 -3
- package/lib/components/yc-display-cards/index.d.ts +20 -2
- package/lib/components/yc-display-cards/src/form-card.vue.d.ts +22 -0
- package/lib/components/yc-display-cards/src/table-card.vue.d.ts +1 -1
- package/lib/components/yc-display-cards/src/types.d.ts +56 -0
- package/lib/components/yc-gradient-card/src/index.vue.d.ts +2 -2
- package/lib/components/yc-input/src/input.vue.d.ts +4 -4
- package/lib/components/yc-input/src/money-input.vue.d.ts +3 -3
- package/lib/components/yc-input/src/stepper-input.vue.d.ts +3 -3
- package/lib/components/yc-input/src/textarea.vue.d.ts +1 -1
- package/lib/components/yc-input-otp/src/index.vue.d.ts +3 -3
- package/lib/components/yc-pagination/src/index.vue.d.ts +2 -2
- package/lib/components/yc-plus-page/src/header-filter-cell.vue.d.ts +8 -8
- package/lib/components/yc-plus-page/src/index.vue.d.ts +779 -779
- package/lib/components/yc-plus-tree/src/index.vue.d.ts +1 -1
- package/lib/components/yc-property-table/src/asset-table.vue.d.ts +2 -2
- package/lib/components/yc-property-table/src/bill-table.vue.d.ts +2 -2
- package/lib/components/yc-property-table/src/device-table.vue.d.ts +2 -2
- package/lib/components/yc-property-table/src/order-table.vue.d.ts +2 -2
- package/lib/components/yc-property-table/src/property-table.vue.d.ts +7 -7
- package/lib/components/yc-select-v2/src/index.vue.d.ts +4 -4
- package/lib/components/yc-status-dialog/src/index.vue.d.ts +1 -1
- package/lib/components/yc-svg-icon/src/index.vue.d.ts +1 -1
- package/lib/hooks/usePlusFormReset.d.ts +216 -216
- package/lib/index.css +13 -12
- package/lib/index.js +1 -0
- package/lib/packages/components/index.js +1 -0
- package/lib/packages/components/yc-display-cards/capability.js +23 -1
- package/lib/packages/components/yc-display-cards/index.js +3 -0
- package/lib/packages/components/yc-display-cards/src/detail-card.vue.js +1 -1
- package/lib/packages/components/yc-display-cards/src/form-card.vue.js +10 -0
- package/lib/packages/components/yc-display-cards/src/form-card2.vue.js +911 -0
- package/lib/packages/components/yc-display-cards/src/metrics-card.vue.js +1 -1
- package/lib/packages/components/yc-display-cards/src/table-card.vue.js +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/locale/en.js +1 -1
- package/locale/en.min.js +1 -1
- package/locale/en.min.mjs +1 -1
- package/locale/en.mjs +1 -1
- package/locale/ja.js +1 -1
- package/locale/ja.min.js +1 -1
- package/locale/ja.min.mjs +1 -1
- package/locale/ja.mjs +1 -1
- package/locale/ko.js +1 -1
- package/locale/ko.min.js +1 -1
- package/locale/ko.min.mjs +1 -1
- package/locale/ko.mjs +1 -1
- package/locale/zh-cn.js +1 -1
- package/locale/zh-cn.min.js +1 -1
- package/locale/zh-cn.min.mjs +1 -1
- package/locale/zh-cn.mjs +1 -1
- package/locale/zh-tw.js +1 -1
- package/locale/zh-tw.min.js +1 -1
- package/locale/zh-tw.min.mjs +1 -1
- package/locale/zh-tw.mjs +1 -1
- package/package.json +1 -1
- package/theme-chalk/index.css +4 -3
|
@@ -0,0 +1,907 @@
|
|
|
1
|
+
import { defineComponent, ref, reactive, computed, watch, onMounted, onBeforeUnmount, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, createCommentVNode, Fragment, renderList, createTextVNode } from 'vue';
|
|
2
|
+
|
|
3
|
+
const _hoisted_1 = { class: "yc-display-card__header" };
|
|
4
|
+
const _hoisted_2 = { class: "yc-display-card__title-wrap yc-display-form-card__title-group" };
|
|
5
|
+
const _hoisted_3 = { class: "yc-display-form-card__titles" };
|
|
6
|
+
const _hoisted_4 = { class: "yc-display-card__title" };
|
|
7
|
+
const _hoisted_5 = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "yc-display-card__subtitle"
|
|
10
|
+
};
|
|
11
|
+
const _hoisted_6 = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "yc-display-form-card__loading"
|
|
14
|
+
};
|
|
15
|
+
const _hoisted_7 = {
|
|
16
|
+
key: 1,
|
|
17
|
+
class: "yc-display-form-card__body"
|
|
18
|
+
};
|
|
19
|
+
const _hoisted_8 = {
|
|
20
|
+
key: 0,
|
|
21
|
+
class: "yc-display-form-card__grid"
|
|
22
|
+
};
|
|
23
|
+
const _hoisted_9 = { class: "yc-display-form-card__label" };
|
|
24
|
+
const _hoisted_10 = {
|
|
25
|
+
key: 0,
|
|
26
|
+
class: "is-required"
|
|
27
|
+
};
|
|
28
|
+
const _hoisted_11 = ["value", "disabled", "onFocus", "onChange"];
|
|
29
|
+
const _hoisted_12 = { value: "" };
|
|
30
|
+
const _hoisted_13 = ["value"];
|
|
31
|
+
const _hoisted_14 = ["type", "value", "disabled", "onInput"];
|
|
32
|
+
const _hoisted_15 = ["step", "inputmode", "value", "disabled", "placeholder", "onInput"];
|
|
33
|
+
const _hoisted_16 = ["aria-checked", "disabled", "onClick"];
|
|
34
|
+
const _hoisted_17 = {
|
|
35
|
+
key: 4,
|
|
36
|
+
class: "yc-display-form-card__upload"
|
|
37
|
+
};
|
|
38
|
+
const _hoisted_18 = ["accept", "onChange"];
|
|
39
|
+
const _hoisted_19 = { class: "yc-display-form-card__upload-list" };
|
|
40
|
+
const _hoisted_20 = {
|
|
41
|
+
key: 0,
|
|
42
|
+
class: "yc-display-form-card__thumb"
|
|
43
|
+
};
|
|
44
|
+
const _hoisted_21 = ["src", "alt"];
|
|
45
|
+
const _hoisted_22 = ["onClick"];
|
|
46
|
+
const _hoisted_23 = {
|
|
47
|
+
key: 1,
|
|
48
|
+
class: "yc-display-form-card__file-chip"
|
|
49
|
+
};
|
|
50
|
+
const _hoisted_24 = { class: "yc-display-form-card__file-name" };
|
|
51
|
+
const _hoisted_25 = ["onClick"];
|
|
52
|
+
const _hoisted_26 = ["disabled", "onClick"];
|
|
53
|
+
const _hoisted_27 = { key: 0 };
|
|
54
|
+
const _hoisted_28 = { key: 1 };
|
|
55
|
+
const _hoisted_29 = ["value", "disabled", "placeholder", "onInput"];
|
|
56
|
+
const _hoisted_30 = ["value", "disabled", "placeholder", "onInput"];
|
|
57
|
+
const _hoisted_31 = { class: "yc-display-form-card__actions" };
|
|
58
|
+
const _hoisted_32 = ["disabled"];
|
|
59
|
+
const _hoisted_33 = ["disabled"];
|
|
60
|
+
const _hoisted_34 = {
|
|
61
|
+
key: 1,
|
|
62
|
+
class: "yc-display-form-card__alert is-error"
|
|
63
|
+
};
|
|
64
|
+
const _hoisted_35 = {
|
|
65
|
+
key: 2,
|
|
66
|
+
class: "yc-display-form-card__alert is-success"
|
|
67
|
+
};
|
|
68
|
+
const _hoisted_36 = {
|
|
69
|
+
key: 3,
|
|
70
|
+
class: "yc-display-form-card__result"
|
|
71
|
+
};
|
|
72
|
+
const _hoisted_37 = {
|
|
73
|
+
key: 0,
|
|
74
|
+
class: "yc-display-form-card__table-wrap"
|
|
75
|
+
};
|
|
76
|
+
const _hoisted_38 = { class: "yc-display-form-card__table" };
|
|
77
|
+
const _hoisted_39 = {
|
|
78
|
+
key: 1,
|
|
79
|
+
class: "yc-display-form-card__kv"
|
|
80
|
+
};
|
|
81
|
+
const _hoisted_40 = { class: "yc-display-form-card__kv-label" };
|
|
82
|
+
const _hoisted_41 = { class: "yc-display-form-card__kv-value" };
|
|
83
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
84
|
+
...{ name: "YcDisplayFormCard" },
|
|
85
|
+
__name: "form-card",
|
|
86
|
+
props: {
|
|
87
|
+
title: { default: "" },
|
|
88
|
+
subtitle: { default: "" },
|
|
89
|
+
operation: { default: "" },
|
|
90
|
+
mode: { default: void 0 },
|
|
91
|
+
submitLabel: { default: "" },
|
|
92
|
+
replyPrefix: { default: "" },
|
|
93
|
+
fields: { default: () => [] },
|
|
94
|
+
values: { default: () => ({}) },
|
|
95
|
+
compact: { type: Boolean, default: false },
|
|
96
|
+
skillName: { default: "" },
|
|
97
|
+
executeAction: { type: Function, default: void 0 },
|
|
98
|
+
uploadFile: { type: Function, default: void 0 }
|
|
99
|
+
},
|
|
100
|
+
emits: ["action"],
|
|
101
|
+
setup(__props, { emit: __emit }) {
|
|
102
|
+
const props = __props;
|
|
103
|
+
const emit = __emit;
|
|
104
|
+
const schemaTitle = ref("");
|
|
105
|
+
const schemaReadOnly = ref(null);
|
|
106
|
+
const loadedFields = ref([]);
|
|
107
|
+
const loadingSchema = ref(false);
|
|
108
|
+
const executing = ref(false);
|
|
109
|
+
const errorMessage = ref("");
|
|
110
|
+
const submitReceipt = ref(null);
|
|
111
|
+
const resultData = ref(null);
|
|
112
|
+
const hasExecuted = ref(false);
|
|
113
|
+
const replySent = ref(false);
|
|
114
|
+
const formValues = reactive({});
|
|
115
|
+
const remoteOptions = reactive({});
|
|
116
|
+
const loadingOptions = reactive({});
|
|
117
|
+
const uploadedFiles = reactive({});
|
|
118
|
+
const uploadingFields = reactive({});
|
|
119
|
+
const fileInputRefs = /* @__PURE__ */ new Map();
|
|
120
|
+
const resolvedMode = computed(() => {
|
|
121
|
+
if (props.mode === "reply") return "reply";
|
|
122
|
+
if (props.mode === "submit") return "submit";
|
|
123
|
+
if (props.mode === "query") return "query";
|
|
124
|
+
return schemaReadOnly.value === false ? "submit" : "query";
|
|
125
|
+
});
|
|
126
|
+
const cardTitle = computed(() => {
|
|
127
|
+
var _a;
|
|
128
|
+
if ((_a = props.title) == null ? void 0 : _a.trim()) return props.title.trim();
|
|
129
|
+
if (schemaTitle.value) return schemaTitle.value;
|
|
130
|
+
return props.skillName || "\u4E1A\u52A1\u8868\u5355";
|
|
131
|
+
});
|
|
132
|
+
const cardSubtitle = computed(
|
|
133
|
+
() => {
|
|
134
|
+
var _a;
|
|
135
|
+
return ((_a = props.subtitle) == null ? void 0 : _a.trim()) ? props.subtitle.trim() : "";
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
const resolvedSubmitLabel = computed(() => {
|
|
139
|
+
var _a;
|
|
140
|
+
if ((_a = props.submitLabel) == null ? void 0 : _a.trim()) return props.submitLabel.trim();
|
|
141
|
+
return resolvedMode.value === "query" ? "\u67E5\u8BE2" : "\u63D0\u4EA4";
|
|
142
|
+
});
|
|
143
|
+
const canExecute = computed(
|
|
144
|
+
() => {
|
|
145
|
+
var _a;
|
|
146
|
+
return resolvedMode.value === "reply" ? !replySent.value : Boolean(((_a = props.operation) == null ? void 0 : _a.trim()) && props.executeAction);
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
function isObject(value) {
|
|
150
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
151
|
+
}
|
|
152
|
+
function normalizeInlineOptions(raw) {
|
|
153
|
+
var _a;
|
|
154
|
+
if (!Array.isArray(raw)) return void 0;
|
|
155
|
+
const options = [];
|
|
156
|
+
for (const item of raw) {
|
|
157
|
+
if (typeof item === "string" || typeof item === "number") {
|
|
158
|
+
options.push({ label: String(item), value: item });
|
|
159
|
+
} else if (isObject(item) && item.value !== void 0 && item.value !== null) {
|
|
160
|
+
options.push({
|
|
161
|
+
label: String((_a = item.label) != null ? _a : item.value),
|
|
162
|
+
value: typeof item.value === "string" || typeof item.value === "number" || typeof item.value === "boolean" ? item.value : String(item.value)
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return options.length ? options : void 0;
|
|
167
|
+
}
|
|
168
|
+
const inlineFields = computed(() => {
|
|
169
|
+
if (!Array.isArray(props.fields)) return [];
|
|
170
|
+
return props.fields.filter((item) => Boolean(item) && typeof item === "object" && Boolean(item.name)).map((item) => {
|
|
171
|
+
var _a;
|
|
172
|
+
return {
|
|
173
|
+
...item,
|
|
174
|
+
name: String(item.name),
|
|
175
|
+
label: String((_a = item.label) != null ? _a : item.name),
|
|
176
|
+
visible: item.visible !== false
|
|
177
|
+
};
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
const visibleFields = computed(() => {
|
|
181
|
+
const source = inlineFields.value.length > 0 ? inlineFields.value : loadedFields.value;
|
|
182
|
+
return source.filter((field) => field.visible !== false);
|
|
183
|
+
});
|
|
184
|
+
function isSelectField(field) {
|
|
185
|
+
var _a, _b;
|
|
186
|
+
return Boolean(
|
|
187
|
+
field.widget === "select" || field.options_operation || ((_a = field.options) == null ? void 0 : _a.length) || ((_b = field.enum) == null ? void 0 : _b.length)
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
function isDateField(field) {
|
|
191
|
+
return field.widget === "date" || field.widget === "datetime";
|
|
192
|
+
}
|
|
193
|
+
function isNumberField(field) {
|
|
194
|
+
return field.type === "number" || field.type === "integer";
|
|
195
|
+
}
|
|
196
|
+
function isUploadField(field) {
|
|
197
|
+
return field.widget === "image" || field.widget === "file";
|
|
198
|
+
}
|
|
199
|
+
function extractArray(obj) {
|
|
200
|
+
for (const key of ["data", "rows", "items", "list", "records"]) {
|
|
201
|
+
if (Array.isArray(obj[key])) return obj[key];
|
|
202
|
+
}
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
const resultRows = computed(() => {
|
|
206
|
+
if (!hasExecuted.value || resultData.value == null) return null;
|
|
207
|
+
const raw = Array.isArray(resultData.value) ? resultData.value : isObject(resultData.value) ? extractArray(resultData.value) : null;
|
|
208
|
+
if (!raw) return null;
|
|
209
|
+
return raw.filter((item) => isObject(item));
|
|
210
|
+
});
|
|
211
|
+
const resultColumns = computed(() => {
|
|
212
|
+
const rows = resultRows.value;
|
|
213
|
+
if (!(rows == null ? void 0 : rows.length)) return [];
|
|
214
|
+
return Object.keys(rows[0]);
|
|
215
|
+
});
|
|
216
|
+
const resultDetailEntries = computed(() => {
|
|
217
|
+
if (!hasExecuted.value || resultRows.value || resultData.value == null) {
|
|
218
|
+
return [];
|
|
219
|
+
}
|
|
220
|
+
if (!isObject(resultData.value)) {
|
|
221
|
+
return [{ label: "\u7ED3\u679C", value: String(resultData.value) }];
|
|
222
|
+
}
|
|
223
|
+
return Object.entries(resultData.value).filter(
|
|
224
|
+
([, val]) => val === null || ["string", "number", "boolean"].includes(typeof val)
|
|
225
|
+
).map(([key, val]) => ({
|
|
226
|
+
label: key,
|
|
227
|
+
value: val === null ? "-" : String(val)
|
|
228
|
+
}));
|
|
229
|
+
});
|
|
230
|
+
function initPrefilledValues() {
|
|
231
|
+
if (isObject(props.values)) {
|
|
232
|
+
for (const [k, v] of Object.entries(props.values)) {
|
|
233
|
+
formValues[k] = v;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
function extractSelectOptions(data, labelKey, valueKey) {
|
|
238
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
239
|
+
const rows = Array.isArray(data) ? data : isObject(data) ? (_a = extractArray(data)) != null ? _a : [] : [];
|
|
240
|
+
const options = [];
|
|
241
|
+
for (const row of rows) {
|
|
242
|
+
if (typeof row === "string" || typeof row === "number") {
|
|
243
|
+
options.push({ label: String(row), value: row });
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
if (!isObject(row)) continue;
|
|
247
|
+
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;
|
|
248
|
+
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;
|
|
249
|
+
if (rawVal === void 0 || rawVal === null) continue;
|
|
250
|
+
options.push({
|
|
251
|
+
label: String(rawLabel != null ? rawLabel : rawVal),
|
|
252
|
+
value: typeof rawVal === "string" || typeof rawVal === "number" || typeof rawVal === "boolean" ? rawVal : String(rawVal)
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
return options;
|
|
256
|
+
}
|
|
257
|
+
async function loadFieldOptions(field) {
|
|
258
|
+
const op = field.options_operation;
|
|
259
|
+
if (!op || !props.executeAction || remoteOptions[field.name] || loadingOptions[field.name]) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
loadingOptions[field.name] = true;
|
|
263
|
+
try {
|
|
264
|
+
const res = await props.executeAction({ operation: op, mode: "options" });
|
|
265
|
+
remoteOptions[field.name] = extractSelectOptions(
|
|
266
|
+
res.data,
|
|
267
|
+
field.option_label_key,
|
|
268
|
+
field.option_value_key
|
|
269
|
+
);
|
|
270
|
+
} catch (e) {
|
|
271
|
+
remoteOptions[field.name] = [];
|
|
272
|
+
} finally {
|
|
273
|
+
loadingOptions[field.name] = false;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
function fieldOptions(field) {
|
|
277
|
+
var _a;
|
|
278
|
+
if ((_a = remoteOptions[field.name]) == null ? void 0 : _a.length) {
|
|
279
|
+
return remoteOptions[field.name];
|
|
280
|
+
}
|
|
281
|
+
const inline = normalizeInlineOptions(field.options);
|
|
282
|
+
if (inline == null ? void 0 : inline.length) return inline;
|
|
283
|
+
if (Array.isArray(field.enum) && field.enum.length > 0) {
|
|
284
|
+
return field.enum.map((item) => ({
|
|
285
|
+
label: String(item),
|
|
286
|
+
value: typeof item === "string" || typeof item === "number" || typeof item === "boolean" ? item : String(item)
|
|
287
|
+
}));
|
|
288
|
+
}
|
|
289
|
+
return [];
|
|
290
|
+
}
|
|
291
|
+
function handleSelectChange(field, event) {
|
|
292
|
+
var _a;
|
|
293
|
+
const select = event.target;
|
|
294
|
+
const raw = (_a = select == null ? void 0 : select.value) != null ? _a : "";
|
|
295
|
+
if (raw === "") {
|
|
296
|
+
formValues[field.name] = void 0;
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
const matched = fieldOptions(field).find((opt) => String(opt.value) === raw);
|
|
300
|
+
formValues[field.name] = matched ? matched.value : raw;
|
|
301
|
+
}
|
|
302
|
+
function handleNumberInput(field, event) {
|
|
303
|
+
var _a;
|
|
304
|
+
const input = event.target;
|
|
305
|
+
const raw = (_a = input == null ? void 0 : input.value) != null ? _a : "";
|
|
306
|
+
if (raw.trim() === "") {
|
|
307
|
+
formValues[field.name] = void 0;
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
const num = Number(raw);
|
|
311
|
+
formValues[field.name] = Number.isNaN(num) ? raw : num;
|
|
312
|
+
}
|
|
313
|
+
function formatDateInputValue(field, value) {
|
|
314
|
+
if (value === void 0 || value === null) return "";
|
|
315
|
+
const text = String(value);
|
|
316
|
+
if (field.widget === "datetime") {
|
|
317
|
+
return text.replace(" ", "T").slice(0, 16);
|
|
318
|
+
}
|
|
319
|
+
return text.slice(0, 10);
|
|
320
|
+
}
|
|
321
|
+
function handleDateInput(field, event) {
|
|
322
|
+
var _a;
|
|
323
|
+
const input = event.target;
|
|
324
|
+
const raw = (_a = input == null ? void 0 : input.value) != null ? _a : "";
|
|
325
|
+
if (!raw) {
|
|
326
|
+
formValues[field.name] = void 0;
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
formValues[field.name] = field.widget === "datetime" ? raw.replace("T", " ") : raw;
|
|
330
|
+
}
|
|
331
|
+
async function loadSchemaIfNeeded() {
|
|
332
|
+
var _a, _b, _c;
|
|
333
|
+
if (inlineFields.value.length > 0) {
|
|
334
|
+
for (const f of visibleFields.value) {
|
|
335
|
+
if (f.options_operation) void loadFieldOptions(f);
|
|
336
|
+
}
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
if (!((_a = props.operation) == null ? void 0 : _a.trim()) || !props.executeAction) return;
|
|
340
|
+
loadingSchema.value = true;
|
|
341
|
+
try {
|
|
342
|
+
const res = await props.executeAction({
|
|
343
|
+
operation: props.operation.trim(),
|
|
344
|
+
mode: "schema",
|
|
345
|
+
schema_only: true
|
|
346
|
+
});
|
|
347
|
+
schemaTitle.value = res.title || "";
|
|
348
|
+
schemaReadOnly.value = (_b = res.read_only) != null ? _b : null;
|
|
349
|
+
loadedFields.value = (_c = res.fields) != null ? _c : [];
|
|
350
|
+
for (const f of loadedFields.value) {
|
|
351
|
+
if (f.options_operation) void loadFieldOptions(f);
|
|
352
|
+
}
|
|
353
|
+
} catch (err) {
|
|
354
|
+
errorMessage.value = err instanceof Error ? err.message : "\u52A0\u8F7D\u8868\u5355\u5B57\u6BB5\u5B9A\u4E49\u5931\u8D25";
|
|
355
|
+
} finally {
|
|
356
|
+
loadingSchema.value = false;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
function setFileInputRef(fieldName, el) {
|
|
360
|
+
if (el instanceof HTMLInputElement) {
|
|
361
|
+
fileInputRefs.set(fieldName, el);
|
|
362
|
+
} else {
|
|
363
|
+
fileInputRefs.delete(fieldName);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
function triggerFileSelect(fieldName) {
|
|
367
|
+
var _a;
|
|
368
|
+
if (replySent.value || uploadingFields[fieldName]) return;
|
|
369
|
+
(_a = fileInputRefs.get(fieldName)) == null ? void 0 : _a.click();
|
|
370
|
+
}
|
|
371
|
+
function syncUploadFormValue(fieldName) {
|
|
372
|
+
var _a;
|
|
373
|
+
const items = (_a = uploadedFiles[fieldName]) != null ? _a : [];
|
|
374
|
+
formValues[fieldName] = items.length ? items.map((item) => item.attachment.fileName) : void 0;
|
|
375
|
+
}
|
|
376
|
+
async function createImagePreview(file) {
|
|
377
|
+
if (typeof URL !== "undefined" && typeof URL.createObjectURL === "function") {
|
|
378
|
+
return { previewUrl: URL.createObjectURL(file), isObjectUrl: true };
|
|
379
|
+
}
|
|
380
|
+
if (typeof FileReader !== "undefined") {
|
|
381
|
+
return new Promise((resolve) => {
|
|
382
|
+
const reader = new FileReader();
|
|
383
|
+
reader.onload = () => {
|
|
384
|
+
resolve({
|
|
385
|
+
previewUrl: typeof reader.result === "string" ? reader.result : void 0,
|
|
386
|
+
isObjectUrl: false
|
|
387
|
+
});
|
|
388
|
+
};
|
|
389
|
+
reader.onerror = () => resolve({});
|
|
390
|
+
reader.readAsDataURL(file);
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
return {};
|
|
394
|
+
}
|
|
395
|
+
async function handleFileInputChange(field, event) {
|
|
396
|
+
const input = event.target;
|
|
397
|
+
const files = (input == null ? void 0 : input.files) ? Array.from(input.files) : [];
|
|
398
|
+
if (input) input.value = "";
|
|
399
|
+
if (!files.length) return;
|
|
400
|
+
if (!props.uploadFile) {
|
|
401
|
+
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";
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
errorMessage.value = "";
|
|
405
|
+
uploadingFields[field.name] = true;
|
|
406
|
+
if (!uploadedFiles[field.name]) uploadedFiles[field.name] = [];
|
|
407
|
+
try {
|
|
408
|
+
for (const file of files) {
|
|
409
|
+
const attachment = await props.uploadFile(file);
|
|
410
|
+
const isImage = field.widget === "image" || file.type.startsWith("image/");
|
|
411
|
+
const preview = isImage ? await createImagePreview(file) : {};
|
|
412
|
+
uploadedFiles[field.name].push({
|
|
413
|
+
attachment,
|
|
414
|
+
previewUrl: preview.previewUrl,
|
|
415
|
+
isObjectUrl: preview.isObjectUrl
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
syncUploadFormValue(field.name);
|
|
419
|
+
} catch (err) {
|
|
420
|
+
errorMessage.value = err instanceof Error ? err.message : `\u4E0A\u4F20\u300C${field.label || field.name}\u300D\u5931\u8D25`;
|
|
421
|
+
} finally {
|
|
422
|
+
uploadingFields[field.name] = false;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
function removeUploadedItem(fieldName, index) {
|
|
426
|
+
if (replySent.value) return;
|
|
427
|
+
const list = uploadedFiles[fieldName];
|
|
428
|
+
if (!list) return;
|
|
429
|
+
const [removed] = list.splice(index, 1);
|
|
430
|
+
if ((removed == null ? void 0 : removed.previewUrl) && removed.isObjectUrl && typeof URL !== "undefined" && typeof URL.revokeObjectURL === "function") {
|
|
431
|
+
URL.revokeObjectURL(removed.previewUrl);
|
|
432
|
+
}
|
|
433
|
+
syncUploadFormValue(fieldName);
|
|
434
|
+
}
|
|
435
|
+
function collectUploadedAttachments() {
|
|
436
|
+
const result = [];
|
|
437
|
+
for (const field of inlineFields.value) {
|
|
438
|
+
if (!isUploadField(field)) continue;
|
|
439
|
+
const list = uploadedFiles[field.name];
|
|
440
|
+
if (list == null ? void 0 : list.length) {
|
|
441
|
+
for (const item of list) result.push(item.attachment);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
return result;
|
|
445
|
+
}
|
|
446
|
+
function isBlank(value) {
|
|
447
|
+
if (Array.isArray(value)) return value.length === 0;
|
|
448
|
+
return value === void 0 || value === null || String(value).trim() === "";
|
|
449
|
+
}
|
|
450
|
+
function displayValue(field, value) {
|
|
451
|
+
var _a;
|
|
452
|
+
if (isUploadField(field)) {
|
|
453
|
+
const items = (_a = uploadedFiles[field.name]) != null ? _a : [];
|
|
454
|
+
if (items.length) {
|
|
455
|
+
return `\u5DF2\u968F\u6D88\u606F\u4E0A\u4F20 ${items.length} \u4E2A\u9644\u4EF6\uFF08${items.map((item) => item.attachment.fileName).join("\u3001")}\uFF09`;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
const option = fieldOptions(field).find((opt) => opt.value === value);
|
|
459
|
+
if (!option || option.label === String(value)) return String(value);
|
|
460
|
+
return `${option.label}\uFF08${String(value)}\uFF09`;
|
|
461
|
+
}
|
|
462
|
+
function buildReplyText() {
|
|
463
|
+
var _a;
|
|
464
|
+
const prefix = ((_a = props.replyPrefix) == null ? void 0 : _a.trim()) ? props.replyPrefix.trim() : `\u8BF7\u6309\u4EE5\u4E0B\u4FE1\u606F${cardTitle.value}`;
|
|
465
|
+
const lines = [];
|
|
466
|
+
for (const field of inlineFields.value) {
|
|
467
|
+
const value = formValues[field.name];
|
|
468
|
+
if (isBlank(value)) continue;
|
|
469
|
+
lines.push(`${field.label || field.name}\uFF1A${displayValue(field, value)}`);
|
|
470
|
+
}
|
|
471
|
+
return [`${prefix}\uFF1A`, ...lines].join("\n");
|
|
472
|
+
}
|
|
473
|
+
async function handleExecute() {
|
|
474
|
+
if (!canExecute.value || executing.value) return;
|
|
475
|
+
errorMessage.value = "";
|
|
476
|
+
submitReceipt.value = null;
|
|
477
|
+
if (Object.values(uploadingFields).some(Boolean)) {
|
|
478
|
+
errorMessage.value = "\u9644\u4EF6\u6B63\u5728\u4E0A\u4F20\u4E2D\uFF0C\u8BF7\u7A0D\u5019\u518D\u63D0\u4EA4";
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
for (const field of visibleFields.value) {
|
|
482
|
+
if (field.required && isBlank(formValues[field.name])) {
|
|
483
|
+
const label = field.label || field.name;
|
|
484
|
+
errorMessage.value = isUploadField(field) ? `\u8BF7\u5148\u4E0A\u4F20\u300C${label}\u300D` : `\u8BF7\u5148\u586B\u5199\u300C${label}\u300D`;
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
if (resolvedMode.value === "reply") {
|
|
489
|
+
const attachments = collectUploadedAttachments();
|
|
490
|
+
replySent.value = true;
|
|
491
|
+
submitReceipt.value = "\u5DF2\u63D0\u4EA4\uFF0CAgent \u6B63\u5728\u6309\u4F60\u586B\u5199\u7684\u4FE1\u606F\u5904\u7406";
|
|
492
|
+
if (attachments.length) {
|
|
493
|
+
emit("action", buildReplyText(), attachments);
|
|
494
|
+
} else {
|
|
495
|
+
emit("action", buildReplyText());
|
|
496
|
+
}
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
if (!props.executeAction) return;
|
|
500
|
+
executing.value = true;
|
|
501
|
+
try {
|
|
502
|
+
const payload = {};
|
|
503
|
+
for (const [k, v] of Object.entries(formValues)) {
|
|
504
|
+
if (!isBlank(v)) {
|
|
505
|
+
payload[k] = v;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
const res = await props.executeAction({
|
|
509
|
+
operation: props.operation.trim(),
|
|
510
|
+
mode: resolvedMode.value,
|
|
511
|
+
values: payload
|
|
512
|
+
});
|
|
513
|
+
hasExecuted.value = true;
|
|
514
|
+
resultData.value = res.data;
|
|
515
|
+
if (resolvedMode.value === "submit") {
|
|
516
|
+
submitReceipt.value = `${cardTitle.value}\u5DF2\u63D0\u4EA4\u6210\u529F`;
|
|
517
|
+
}
|
|
518
|
+
} catch (err) {
|
|
519
|
+
errorMessage.value = err instanceof Error ? err.message : "\u64CD\u4F5C\u6267\u884C\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u8F93\u5165\u6761\u4EF6";
|
|
520
|
+
} finally {
|
|
521
|
+
executing.value = false;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
function revokeAllUploadPreviews() {
|
|
525
|
+
if (typeof URL === "undefined" || typeof URL.revokeObjectURL !== "function") {
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
for (const list of Object.values(uploadedFiles)) {
|
|
529
|
+
for (const item of list) {
|
|
530
|
+
if (item.previewUrl && item.isObjectUrl) URL.revokeObjectURL(item.previewUrl);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
function handleReset() {
|
|
535
|
+
for (const key of Object.keys(formValues)) {
|
|
536
|
+
delete formValues[key];
|
|
537
|
+
}
|
|
538
|
+
revokeAllUploadPreviews();
|
|
539
|
+
for (const key of Object.keys(uploadedFiles)) {
|
|
540
|
+
delete uploadedFiles[key];
|
|
541
|
+
}
|
|
542
|
+
initPrefilledValues();
|
|
543
|
+
errorMessage.value = "";
|
|
544
|
+
if (!replySent.value) submitReceipt.value = null;
|
|
545
|
+
}
|
|
546
|
+
watch(
|
|
547
|
+
() => props.values,
|
|
548
|
+
() => {
|
|
549
|
+
initPrefilledValues();
|
|
550
|
+
},
|
|
551
|
+
{ immediate: true, deep: true }
|
|
552
|
+
);
|
|
553
|
+
onMounted(() => {
|
|
554
|
+
void loadSchemaIfNeeded();
|
|
555
|
+
});
|
|
556
|
+
onBeforeUnmount(() => {
|
|
557
|
+
revokeAllUploadPreviews();
|
|
558
|
+
});
|
|
559
|
+
return (_ctx, _cache) => {
|
|
560
|
+
var _a;
|
|
561
|
+
return openBlock(), createElementBlock(
|
|
562
|
+
"div",
|
|
563
|
+
{
|
|
564
|
+
class: normalizeClass(["yc-display-card yc-display-form-card", { "is-compact": __props.compact }])
|
|
565
|
+
},
|
|
566
|
+
[
|
|
567
|
+
createElementVNode("div", _hoisted_1, [
|
|
568
|
+
createElementVNode("div", _hoisted_2, [
|
|
569
|
+
_cache[0] || (_cache[0] = createElementVNode(
|
|
570
|
+
"span",
|
|
571
|
+
{ class: "yc-display-form-card__accent" },
|
|
572
|
+
null,
|
|
573
|
+
-1
|
|
574
|
+
/* CACHED */
|
|
575
|
+
)),
|
|
576
|
+
createElementVNode("div", _hoisted_3, [
|
|
577
|
+
createElementVNode(
|
|
578
|
+
"div",
|
|
579
|
+
_hoisted_4,
|
|
580
|
+
toDisplayString(cardTitle.value),
|
|
581
|
+
1
|
|
582
|
+
/* TEXT */
|
|
583
|
+
),
|
|
584
|
+
cardSubtitle.value ? (openBlock(), createElementBlock(
|
|
585
|
+
"div",
|
|
586
|
+
_hoisted_5,
|
|
587
|
+
toDisplayString(cardSubtitle.value),
|
|
588
|
+
1
|
|
589
|
+
/* TEXT */
|
|
590
|
+
)) : createCommentVNode("v-if", true)
|
|
591
|
+
])
|
|
592
|
+
]),
|
|
593
|
+
createElementVNode(
|
|
594
|
+
"span",
|
|
595
|
+
{
|
|
596
|
+
class: normalizeClass(["yc-display-form-card__badge", resolvedMode.value === "query" ? "is-query" : "is-form"])
|
|
597
|
+
},
|
|
598
|
+
toDisplayString(resolvedMode.value === "query" ? "\u7B5B\u9009\u67E5\u8BE2" : "\u4E1A\u52A1\u8868\u5355"),
|
|
599
|
+
3
|
|
600
|
+
/* TEXT, CLASS */
|
|
601
|
+
)
|
|
602
|
+
]),
|
|
603
|
+
loadingSchema.value ? (openBlock(), createElementBlock("div", _hoisted_6, " \u6B63\u5728\u52A0\u8F7D\u8868\u5355\u914D\u7F6E\u2026 ")) : (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
604
|
+
visibleFields.value.length ? (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
605
|
+
(openBlock(true), createElementBlock(
|
|
606
|
+
Fragment,
|
|
607
|
+
null,
|
|
608
|
+
renderList(visibleFields.value, (field) => {
|
|
609
|
+
var _a2, _b, _c, _d, _e;
|
|
610
|
+
return openBlock(), createElementBlock(
|
|
611
|
+
"div",
|
|
612
|
+
{
|
|
613
|
+
key: field.name,
|
|
614
|
+
class: normalizeClass(["yc-display-form-card__field", {
|
|
615
|
+
"is-full-row": field.widget === "textarea" || isUploadField(field)
|
|
616
|
+
}])
|
|
617
|
+
},
|
|
618
|
+
[
|
|
619
|
+
createElementVNode("label", _hoisted_9, [
|
|
620
|
+
field.required ? (openBlock(), createElementBlock("span", _hoisted_10, "*")) : createCommentVNode("v-if", true),
|
|
621
|
+
createTextVNode(
|
|
622
|
+
" " + toDisplayString(field.label || field.name),
|
|
623
|
+
1
|
|
624
|
+
/* TEXT */
|
|
625
|
+
)
|
|
626
|
+
]),
|
|
627
|
+
isSelectField(field) ? (openBlock(), createElementBlock("select", {
|
|
628
|
+
key: 0,
|
|
629
|
+
value: (_a2 = formValues[field.name]) != null ? _a2 : "",
|
|
630
|
+
disabled: replySent.value,
|
|
631
|
+
class: "yc-display-form-card__control yc-display-form-card__select",
|
|
632
|
+
onFocus: ($event) => loadFieldOptions(field),
|
|
633
|
+
onChange: (event) => handleSelectChange(field, event)
|
|
634
|
+
}, [
|
|
635
|
+
createElementVNode(
|
|
636
|
+
"option",
|
|
637
|
+
_hoisted_12,
|
|
638
|
+
toDisplayString(loadingOptions[field.name] ? "\u52A0\u8F7D\u9009\u9879\u4E2D\u2026" : `\u8BF7\u9009\u62E9${field.label || field.name}`),
|
|
639
|
+
1
|
|
640
|
+
/* TEXT */
|
|
641
|
+
),
|
|
642
|
+
(openBlock(true), createElementBlock(
|
|
643
|
+
Fragment,
|
|
644
|
+
null,
|
|
645
|
+
renderList(fieldOptions(field), (opt) => {
|
|
646
|
+
return openBlock(), createElementBlock("option", {
|
|
647
|
+
key: String(opt.value),
|
|
648
|
+
value: String(opt.value)
|
|
649
|
+
}, toDisplayString(opt.label), 9, _hoisted_13);
|
|
650
|
+
}),
|
|
651
|
+
128
|
|
652
|
+
/* KEYED_FRAGMENT */
|
|
653
|
+
))
|
|
654
|
+
], 40, _hoisted_11)) : isDateField(field) ? (openBlock(), createElementBlock("input", {
|
|
655
|
+
key: 1,
|
|
656
|
+
type: field.widget === "datetime" ? "datetime-local" : "date",
|
|
657
|
+
value: formatDateInputValue(field, formValues[field.name]),
|
|
658
|
+
disabled: replySent.value,
|
|
659
|
+
class: "yc-display-form-card__control yc-display-form-card__input",
|
|
660
|
+
onInput: (event) => handleDateInput(field, event)
|
|
661
|
+
}, null, 40, _hoisted_14)) : isNumberField(field) ? (openBlock(), createElementBlock("input", {
|
|
662
|
+
key: 2,
|
|
663
|
+
type: "number",
|
|
664
|
+
step: field.type === "integer" ? "1" : "any",
|
|
665
|
+
inputmode: field.type === "integer" ? "numeric" : "decimal",
|
|
666
|
+
value: (_b = formValues[field.name]) != null ? _b : "",
|
|
667
|
+
disabled: replySent.value,
|
|
668
|
+
placeholder: `\u8BF7\u8F93\u5165${field.label || field.name}`,
|
|
669
|
+
class: "yc-display-form-card__control yc-display-form-card__input",
|
|
670
|
+
onInput: (event) => handleNumberInput(field, event)
|
|
671
|
+
}, null, 40, _hoisted_15)) : field.type === "boolean" ? (openBlock(), createElementBlock("button", {
|
|
672
|
+
key: 3,
|
|
673
|
+
type: "button",
|
|
674
|
+
role: "switch",
|
|
675
|
+
"aria-checked": Boolean(formValues[field.name]),
|
|
676
|
+
disabled: replySent.value,
|
|
677
|
+
class: normalizeClass(["yc-display-form-card__switch", { "is-checked": Boolean(formValues[field.name]) }]),
|
|
678
|
+
onClick: ($event) => formValues[field.name] = !formValues[field.name]
|
|
679
|
+
}, [..._cache[1] || (_cache[1] = [
|
|
680
|
+
createElementVNode(
|
|
681
|
+
"span",
|
|
682
|
+
{ class: "yc-display-form-card__switch-thumb" },
|
|
683
|
+
null,
|
|
684
|
+
-1
|
|
685
|
+
/* CACHED */
|
|
686
|
+
)
|
|
687
|
+
])], 10, _hoisted_16)) : isUploadField(field) ? (openBlock(), createElementBlock("div", _hoisted_17, [
|
|
688
|
+
createElementVNode("input", {
|
|
689
|
+
ref_for: true,
|
|
690
|
+
ref: (el) => setFileInputRef(field.name, el),
|
|
691
|
+
type: "file",
|
|
692
|
+
multiple: "",
|
|
693
|
+
accept: field.widget === "image" ? "image/*" : void 0,
|
|
694
|
+
class: "yc-display-form-card__upload-input",
|
|
695
|
+
onChange: (event) => handleFileInputChange(field, event)
|
|
696
|
+
}, null, 40, _hoisted_18),
|
|
697
|
+
createElementVNode("div", _hoisted_19, [
|
|
698
|
+
(openBlock(true), createElementBlock(
|
|
699
|
+
Fragment,
|
|
700
|
+
null,
|
|
701
|
+
renderList((_c = uploadedFiles[field.name]) != null ? _c : [], (item, idx) => {
|
|
702
|
+
return openBlock(), createElementBlock(
|
|
703
|
+
Fragment,
|
|
704
|
+
{
|
|
705
|
+
key: `${item.attachment.fileRef || item.attachment.fileName}-${idx}`
|
|
706
|
+
},
|
|
707
|
+
[
|
|
708
|
+
item.previewUrl ? (openBlock(), createElementBlock("div", _hoisted_20, [
|
|
709
|
+
createElementVNode("img", {
|
|
710
|
+
src: item.previewUrl,
|
|
711
|
+
alt: item.attachment.fileName
|
|
712
|
+
}, null, 8, _hoisted_21),
|
|
713
|
+
!replySent.value ? (openBlock(), createElementBlock("button", {
|
|
714
|
+
key: 0,
|
|
715
|
+
type: "button",
|
|
716
|
+
class: "yc-display-form-card__thumb-remove",
|
|
717
|
+
title: "\u79FB\u9664",
|
|
718
|
+
onClick: ($event) => removeUploadedItem(field.name, idx)
|
|
719
|
+
}, " \xD7 ", 8, _hoisted_22)) : createCommentVNode("v-if", true)
|
|
720
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_23, [
|
|
721
|
+
createElementVNode(
|
|
722
|
+
"span",
|
|
723
|
+
_hoisted_24,
|
|
724
|
+
toDisplayString(item.attachment.fileName),
|
|
725
|
+
1
|
|
726
|
+
/* TEXT */
|
|
727
|
+
),
|
|
728
|
+
!replySent.value ? (openBlock(), createElementBlock("button", {
|
|
729
|
+
key: 0,
|
|
730
|
+
type: "button",
|
|
731
|
+
class: "yc-display-form-card__file-remove",
|
|
732
|
+
title: "\u79FB\u9664",
|
|
733
|
+
onClick: ($event) => removeUploadedItem(field.name, idx)
|
|
734
|
+
}, " \xD7 ", 8, _hoisted_25)) : createCommentVNode("v-if", true)
|
|
735
|
+
]))
|
|
736
|
+
],
|
|
737
|
+
64
|
|
738
|
+
/* STABLE_FRAGMENT */
|
|
739
|
+
);
|
|
740
|
+
}),
|
|
741
|
+
128
|
|
742
|
+
/* KEYED_FRAGMENT */
|
|
743
|
+
)),
|
|
744
|
+
!replySent.value ? (openBlock(), createElementBlock("button", {
|
|
745
|
+
key: 0,
|
|
746
|
+
type: "button",
|
|
747
|
+
class: normalizeClass(["yc-display-form-card__upload-trigger", {
|
|
748
|
+
"is-image": field.widget === "image",
|
|
749
|
+
"is-loading": Boolean(uploadingFields[field.name])
|
|
750
|
+
}]),
|
|
751
|
+
disabled: Boolean(uploadingFields[field.name]),
|
|
752
|
+
onClick: ($event) => triggerFileSelect(field.name)
|
|
753
|
+
}, [
|
|
754
|
+
uploadingFields[field.name] ? (openBlock(), createElementBlock("span", _hoisted_27, "\u4E0A\u4F20\u4E2D\u2026")) : (openBlock(), createElementBlock(
|
|
755
|
+
"span",
|
|
756
|
+
_hoisted_28,
|
|
757
|
+
toDisplayString(field.widget === "image" ? "+ \u4E0A\u4F20\u56FE\u7247" : "+ \u4E0A\u4F20\u9644\u4EF6"),
|
|
758
|
+
1
|
|
759
|
+
/* TEXT */
|
|
760
|
+
))
|
|
761
|
+
], 10, _hoisted_26)) : createCommentVNode("v-if", true)
|
|
762
|
+
])
|
|
763
|
+
])) : field.widget === "textarea" ? (openBlock(), createElementBlock("textarea", {
|
|
764
|
+
key: 5,
|
|
765
|
+
rows: "3",
|
|
766
|
+
value: String((_d = formValues[field.name]) != null ? _d : ""),
|
|
767
|
+
disabled: replySent.value,
|
|
768
|
+
placeholder: `\u8BF7\u8F93\u5165${field.label || field.name}`,
|
|
769
|
+
class: "yc-display-form-card__control yc-display-form-card__textarea",
|
|
770
|
+
onInput: (event) => formValues[field.name] = event.target.value
|
|
771
|
+
}, null, 40, _hoisted_29)) : (openBlock(), createElementBlock("input", {
|
|
772
|
+
key: 6,
|
|
773
|
+
type: "text",
|
|
774
|
+
value: String((_e = formValues[field.name]) != null ? _e : ""),
|
|
775
|
+
disabled: replySent.value,
|
|
776
|
+
placeholder: `\u8BF7\u8F93\u5165${field.label || field.name}`,
|
|
777
|
+
class: "yc-display-form-card__control yc-display-form-card__input",
|
|
778
|
+
onInput: (event) => formValues[field.name] = event.target.value
|
|
779
|
+
}, null, 40, _hoisted_30))
|
|
780
|
+
],
|
|
781
|
+
2
|
|
782
|
+
/* CLASS */
|
|
783
|
+
);
|
|
784
|
+
}),
|
|
785
|
+
128
|
|
786
|
+
/* KEYED_FRAGMENT */
|
|
787
|
+
))
|
|
788
|
+
])) : createCommentVNode("v-if", true),
|
|
789
|
+
createElementVNode("div", _hoisted_31, [
|
|
790
|
+
createElementVNode("button", {
|
|
791
|
+
type: "button",
|
|
792
|
+
class: "yc-display-form-card__btn is-primary",
|
|
793
|
+
disabled: !canExecute.value || executing.value,
|
|
794
|
+
onClick: handleExecute
|
|
795
|
+
}, toDisplayString(executing.value ? "\u5904\u7406\u4E2D\u2026" : resolvedSubmitLabel.value), 9, _hoisted_32),
|
|
796
|
+
createElementVNode("button", {
|
|
797
|
+
type: "button",
|
|
798
|
+
class: "yc-display-form-card__btn is-default",
|
|
799
|
+
disabled: executing.value || replySent.value,
|
|
800
|
+
onClick: handleReset
|
|
801
|
+
}, " \u91CD\u7F6E ", 8, _hoisted_33)
|
|
802
|
+
]),
|
|
803
|
+
errorMessage.value ? (openBlock(), createElementBlock(
|
|
804
|
+
"div",
|
|
805
|
+
_hoisted_34,
|
|
806
|
+
toDisplayString(errorMessage.value),
|
|
807
|
+
1
|
|
808
|
+
/* TEXT */
|
|
809
|
+
)) : createCommentVNode("v-if", true),
|
|
810
|
+
submitReceipt.value ? (openBlock(), createElementBlock(
|
|
811
|
+
"div",
|
|
812
|
+
_hoisted_35,
|
|
813
|
+
toDisplayString(submitReceipt.value),
|
|
814
|
+
1
|
|
815
|
+
/* TEXT */
|
|
816
|
+
)) : createCommentVNode("v-if", true),
|
|
817
|
+
hasExecuted.value ? (openBlock(), createElementBlock("div", _hoisted_36, [
|
|
818
|
+
((_a = resultRows.value) == null ? void 0 : _a.length) ? (openBlock(), createElementBlock("div", _hoisted_37, [
|
|
819
|
+
createElementVNode("table", _hoisted_38, [
|
|
820
|
+
createElementVNode("thead", null, [
|
|
821
|
+
createElementVNode("tr", null, [
|
|
822
|
+
(openBlock(true), createElementBlock(
|
|
823
|
+
Fragment,
|
|
824
|
+
null,
|
|
825
|
+
renderList(resultColumns.value, (col) => {
|
|
826
|
+
return openBlock(), createElementBlock(
|
|
827
|
+
"th",
|
|
828
|
+
{ key: col },
|
|
829
|
+
toDisplayString(col),
|
|
830
|
+
1
|
|
831
|
+
/* TEXT */
|
|
832
|
+
);
|
|
833
|
+
}),
|
|
834
|
+
128
|
|
835
|
+
/* KEYED_FRAGMENT */
|
|
836
|
+
))
|
|
837
|
+
])
|
|
838
|
+
]),
|
|
839
|
+
createElementVNode("tbody", null, [
|
|
840
|
+
(openBlock(true), createElementBlock(
|
|
841
|
+
Fragment,
|
|
842
|
+
null,
|
|
843
|
+
renderList(resultRows.value, (row, rIdx) => {
|
|
844
|
+
return openBlock(), createElementBlock("tr", { key: rIdx }, [
|
|
845
|
+
(openBlock(true), createElementBlock(
|
|
846
|
+
Fragment,
|
|
847
|
+
null,
|
|
848
|
+
renderList(resultColumns.value, (col) => {
|
|
849
|
+
var _a2;
|
|
850
|
+
return openBlock(), createElementBlock(
|
|
851
|
+
"td",
|
|
852
|
+
{ key: col },
|
|
853
|
+
toDisplayString((_a2 = row[col]) != null ? _a2 : "\u2014"),
|
|
854
|
+
1
|
|
855
|
+
/* TEXT */
|
|
856
|
+
);
|
|
857
|
+
}),
|
|
858
|
+
128
|
|
859
|
+
/* KEYED_FRAGMENT */
|
|
860
|
+
))
|
|
861
|
+
]);
|
|
862
|
+
}),
|
|
863
|
+
128
|
|
864
|
+
/* KEYED_FRAGMENT */
|
|
865
|
+
))
|
|
866
|
+
])
|
|
867
|
+
])
|
|
868
|
+
])) : resultDetailEntries.value.length ? (openBlock(), createElementBlock("div", _hoisted_39, [
|
|
869
|
+
(openBlock(true), createElementBlock(
|
|
870
|
+
Fragment,
|
|
871
|
+
null,
|
|
872
|
+
renderList(resultDetailEntries.value, (entry) => {
|
|
873
|
+
return openBlock(), createElementBlock("div", {
|
|
874
|
+
key: entry.label,
|
|
875
|
+
class: "yc-display-form-card__kv-row"
|
|
876
|
+
}, [
|
|
877
|
+
createElementVNode(
|
|
878
|
+
"span",
|
|
879
|
+
_hoisted_40,
|
|
880
|
+
toDisplayString(entry.label),
|
|
881
|
+
1
|
|
882
|
+
/* TEXT */
|
|
883
|
+
),
|
|
884
|
+
createElementVNode(
|
|
885
|
+
"span",
|
|
886
|
+
_hoisted_41,
|
|
887
|
+
toDisplayString(entry.value),
|
|
888
|
+
1
|
|
889
|
+
/* TEXT */
|
|
890
|
+
)
|
|
891
|
+
]);
|
|
892
|
+
}),
|
|
893
|
+
128
|
|
894
|
+
/* KEYED_FRAGMENT */
|
|
895
|
+
))
|
|
896
|
+
])) : createCommentVNode("v-if", true)
|
|
897
|
+
])) : createCommentVNode("v-if", true)
|
|
898
|
+
]))
|
|
899
|
+
],
|
|
900
|
+
2
|
|
901
|
+
/* CLASS */
|
|
902
|
+
);
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
export { _sfc_main as default };
|