@core-pilot/client-vue 0.0.8 → 0.0.9
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/dist/cjs/client-vue.css +1 -1
- package/dist/cjs/components/core-card/index.js +1 -1
- package/dist/cjs/components/core-card/index.js.map +1 -1
- package/dist/cjs/components/core-upload/assets/delete.svg.js +2 -0
- package/dist/cjs/components/core-upload/assets/delete.svg.js.map +1 -0
- package/dist/cjs/components/core-upload/assets/temp.svg.js +2 -0
- package/dist/cjs/components/core-upload/assets/temp.svg.js.map +1 -0
- package/dist/cjs/components/core-upload/assets/upload.svg.js +2 -0
- package/dist/cjs/components/core-upload/assets/upload.svg.js.map +1 -0
- package/dist/cjs/components/core-upload/index.js +2 -0
- package/dist/cjs/components/core-upload/index.js.map +1 -0
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/components/x-markdown/index.js +1 -1
- package/dist/cjs/components/x-markdown/index.js.map +1 -1
- package/dist/cjs/components/x-markdown/utils/parseCorePilotSchema.js +1 -1
- package/dist/cjs/components/x-markdown/utils/parseCorePilotSchema.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/client-vue.css +1 -1
- package/dist/es/components/core-card/index.js +9 -4
- package/dist/es/components/core-card/index.js.map +1 -1
- package/dist/es/components/core-upload/assets/delete.svg.js +5 -0
- package/dist/es/components/core-upload/assets/delete.svg.js.map +1 -0
- package/dist/es/components/core-upload/assets/temp.svg.js +5 -0
- package/dist/es/components/core-upload/assets/temp.svg.js.map +1 -0
- package/dist/es/components/core-upload/assets/upload.svg.js +5 -0
- package/dist/es/components/core-upload/assets/upload.svg.js.map +1 -0
- package/dist/es/components/core-upload/index.js +258 -0
- package/dist/es/components/core-upload/index.js.map +1 -0
- package/dist/es/components/index.js +2 -0
- package/dist/es/components/index.js.map +1 -1
- package/dist/es/components/x-markdown/index.js +22 -11
- package/dist/es/components/x-markdown/index.js.map +1 -1
- package/dist/es/components/x-markdown/utils/parseCorePilotSchema.js +10 -1
- package/dist/es/components/x-markdown/utils/parseCorePilotSchema.js.map +1 -1
- package/dist/es/index.js +2 -0
- package/dist/es/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -48,16 +48,21 @@ const CoreCard = /* @__PURE__ */ defineComponent({
|
|
|
48
48
|
"shadow": this.shadow
|
|
49
49
|
}, {
|
|
50
50
|
header: hasHeader ? () => createVNode("div", {
|
|
51
|
-
"class": "core-card__header"
|
|
51
|
+
"class": "core-card__header"
|
|
52
|
+
}, [createVNode("div", {
|
|
53
|
+
"class": "core-card__header-left",
|
|
52
54
|
"onClick": this.toggleCollapse,
|
|
53
55
|
"style": this.collapsible ? {
|
|
54
56
|
cursor: "pointer"
|
|
55
57
|
} : {}
|
|
56
58
|
}, [createVNode("span", {
|
|
57
|
-
"class": "core-card__header-text"
|
|
58
|
-
|
|
59
|
+
"class": "core-card__header-text",
|
|
60
|
+
"title": this.header
|
|
61
|
+
}, [this.header]), this.collapsible && createVNode("i", {
|
|
59
62
|
"class": `core-card__collapse-icon ${this.collapseIconClass}`
|
|
60
|
-
}, null)])
|
|
63
|
+
}, null)]), this.$slots.header && createVNode("div", {
|
|
64
|
+
"class": "core-card__header-right"
|
|
65
|
+
}, [this.$slots.header()])]) : void 0,
|
|
61
66
|
default: () => {
|
|
62
67
|
var _a, _b;
|
|
63
68
|
return createVNode("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/core-card/index.tsx"],"sourcesContent":["import { defineComponent, ref, PropType, computed } from 'vue';\nimport { ElCard } from 'element-plus';\nimport './style.less';\n\nexport default defineComponent({\n name: 'CoreCard',\n props: {\n header: {\n type: String,\n default: '',\n },\n shadow: {\n type: String as PropType<'always' | 'never' | 'hover'>,\n default: 'always',\n },\n collapsible: {\n type: Boolean,\n default: true,\n },\n defaultCollapsed: {\n type: Boolean,\n default: false,\n },\n },\n setup(props, { slots }) {\n const isCollapsed = ref(props.defaultCollapsed);\n\n const toggleCollapse = () => {\n if (props.collapsible) {\n isCollapsed.value = !isCollapsed.value;\n }\n };\n\n const collapseIconClass = computed(() => {\n return isCollapsed.value ? 'core-card__collapse-icon--collapsed' : 'core-card__collapse-icon--expanded';\n });\n\n return {\n isCollapsed,\n toggleCollapse,\n collapseIconClass,\n };\n },\n render() {\n const hasHeader = this.header || this.$slots.header;\n \n return (\n <ElCard\n class=\"core-card\"\n shadow={this.shadow}\n >\n {{\n header: hasHeader ? () => (\n <div \n class=\"core-card__header\"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/core-card/index.tsx"],"sourcesContent":["import { defineComponent, ref, PropType, computed } from 'vue';\nimport { ElCard } from 'element-plus';\nimport './style.less';\n\nexport default defineComponent({\n name: 'CoreCard',\n props: {\n header: {\n type: String,\n default: '',\n },\n shadow: {\n type: String as PropType<'always' | 'never' | 'hover'>,\n default: 'always',\n },\n collapsible: {\n type: Boolean,\n default: true,\n },\n defaultCollapsed: {\n type: Boolean,\n default: false,\n },\n },\n setup(props, { slots }) {\n const isCollapsed = ref(props.defaultCollapsed);\n\n const toggleCollapse = () => {\n if (props.collapsible) {\n isCollapsed.value = !isCollapsed.value;\n }\n };\n\n const collapseIconClass = computed(() => {\n return isCollapsed.value ? 'core-card__collapse-icon--collapsed' : 'core-card__collapse-icon--expanded';\n });\n\n return {\n isCollapsed,\n toggleCollapse,\n collapseIconClass,\n };\n },\n render() {\n const hasHeader = this.header || this.$slots.header;\n \n return (\n <ElCard\n class=\"core-card\"\n shadow={this.shadow}\n >\n {{\n header: hasHeader ? () => (\n <div class=\"core-card__header\">\n <div \n class=\"core-card__header-left\"\n onClick={this.toggleCollapse}\n style={this.collapsible ? { cursor: 'pointer' } : {}}\n >\n <span \n class=\"core-card__header-text\"\n title={this.header}\n >\n {this.header}\n </span>\n {this.collapsible && (\n <i class={`core-card__collapse-icon ${this.collapseIconClass}`}></i>\n )}\n </div>\n {this.$slots.header && (\n <div class=\"core-card__header-right\">\n {this.$slots.header()}\n </div>\n )}\n </div>\n ) : undefined,\n default: () => (\n <div\n class={{\n 'core-card__body': true,\n 'core-card__body--collapsed': this.isCollapsed,\n }}\n >\n {this.$slots.default?.()}\n </div>\n ),\n }}\n </ElCard>\n );\n },\n});\n\n"],"names":["name","props","header","type","String","default","shadow","collapsible","Boolean","defaultCollapsed","setup","slots","isCollapsed","ref","toggleCollapse","value","collapseIconClass","computed","render","hasHeader","$slots","_createVNode","ElCard","cursor","undefined"],"mappings":";;;;;AAIA,MAAA,2CAA+B;AAAA,EAC7BA,MAAM;AAAA,EACNC,OAAO;AAAA,IACLC,QAAQ;AAAA,MACNC,MAAMC;AAAAA,MACNC,SAAS;AAAA;IAEXC,QAAQ;AAAA,MACNH,MAAMC;AAAAA,MACNC,SAAS;AAAA;IAEXE,aAAa;AAAA,MACXJ,MAAMK;AAAAA,MACNH,SAAS;AAAA;IAEXI,kBAAkB;AAAA,MAChBN,MAAMK;AAAAA,MACNH,SAAS;AAAA,IACX;AAAA;EAEFK,MAAMT,OAAO;AAAA,IAAEU;AAAAA,EAAM,GAAG;AACtB,UAAMC,cAAcC,IAAIZ,MAAMQ,gBAAgB;AAE9C,UAAMK,iBAAiBA,MAAM;AAC3B,UAAIb,MAAMM,aAAa;AACrBK,oBAAYG,QAAQ,CAACH,YAAYG;AAAAA,MACnC;AAAA,IACF;AAEA,UAAMC,oBAAoBC,SAAS,MAAM;AACvC,aAAOL,YAAYG,QAAQ,wCAAwC;AAAA,IACrE,CAAC;AAED,WAAO;AAAA,MACLH;AAAAA,MACAE;AAAAA,MACAE;AAAAA;EAEJ;AAAA,EACAE,SAAS;AACP,UAAMC,YAAY,KAAKjB,UAAU,KAAKkB,OAAOlB;AAE7C,WAAAmB,YAAAC,QAAA;AAAA,MAAA,SAAA;AAAA,MAAA,UAGY,KAAKhB;AAAAA,IAAM,GAAA;AAAA,MAGjBJ,QAAQiB,YAAY,MAAAE,YAAA,OAAA;AAAA,QAAA,SAAA;AAAA,MAAA,GAAA,CAAAA,YAAA,OAAA;AAAA,QAAA,SAAA;AAAA,QAAA,WAIL,KAAKP;AAAAA,QAAc,SACrB,KAAKP,cAAc;AAAA,UAAEgB,QAAQ;AAAA,QAAU,IAAI,CAAA;AAAA,MAAE,GAAA,CAAAF,YAAA,QAAA;AAAA,QAAA,SAAA;AAAA,QAAA,SAI3C,KAAKnB;AAAAA,SAAM,CAEjB,KAAKA,MAAM,CAAA,GAEb,KAAKK,eAAWc,YAAA,KAAA;AAAA,QAAA,SACL,4BAA4B,KAAKL,iBAAiB;AAAA,MAAE,GAAA,IAAA,CAC/D,IAEF,KAAKI,OAAOlB,UAAMmB,YAAA,OAAA;AAAA,QAAA,SAAA;AAAA,SAAA,CAEd,KAAKD,OAAOlB,OAAM,CAAE,CAAA,CAExB,CAAA,IAEDsB;AAAAA,MACJnB,SAASA,MAAAA;;AAAAgB,2BAAA,OAAA;AAAA,UAAA,SAEE;AAAA,YACL,mBAAmB;AAAA,YACnB,8BAA8B,KAAKT;AAAAA,UACrC;AAAA,QAAC,GAAA,EAEA,gBAAKQ,QAAOf,YAAZ,2BAAuB,CAAA;AAAA;AAAA,IAE3B,CAAA;AAAA,EAIT;AACF,CAAC;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const deleteIcon = "data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.66602%203.66666H13.3327'%20stroke='%23ADB0BB'%20stroke-width='1.33333'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M6%201.66666H10'%20stroke='%23ADB0BB'%20stroke-width='1.33333'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M4%205.66666H12V13.3333C12%2013.8856%2011.5523%2014.3333%2011%2014.3333H5C4.4477%2014.3333%204%2013.8856%204%2013.3333V5.66666Z'%20stroke='%23ADB0BB'%20stroke-width='1.33333'%20stroke-linejoin='round'/%3e%3c/svg%3e";
|
|
2
|
+
export {
|
|
3
|
+
deleteIcon as default
|
|
4
|
+
};
|
|
5
|
+
//# sourceMappingURL=delete.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.svg.js","sources":["../../../../../src/components/core-upload/assets/delete.svg"],"sourcesContent":["export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M2.66602%203.66666H13.3327'%20stroke='%23ADB0BB'%20stroke-width='1.33333'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M6%201.66666H10'%20stroke='%23ADB0BB'%20stroke-width='1.33333'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M4%205.66666H12V13.3333C12%2013.8856%2011.5523%2014.3333%2011%2014.3333H5C4.4477%2014.3333%204%2013.8856%204%2013.3333V5.66666Z'%20stroke='%23ADB0BB'%20stroke-width='1.33333'%20stroke-linejoin='round'/%3e%3c/svg%3e\""],"names":[],"mappings":"AAAA,MAAA,aAAe;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const tempIcon = "data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M13%202H3C2.44772%202%202%202.44772%202%203V13C2%2013.5523%202.44772%2014%203%2014H13C13.5523%2014%2014%2013.5523%2014%2013V3C14%202.44772%2013.5523%202%2013%202Z'%20stroke='%2353576A'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M2%204.66666H13.3333'%20stroke='%2353576A'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M8%207.58334H11'%20stroke='%2353576A'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M8%2010.25H11'%20stroke='%2353576A'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M4.66602%202V14'%20stroke='%2353576A'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e";
|
|
2
|
+
export {
|
|
3
|
+
tempIcon as default
|
|
4
|
+
};
|
|
5
|
+
//# sourceMappingURL=temp.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"temp.svg.js","sources":["../../../../../src/components/core-upload/assets/temp.svg"],"sourcesContent":["export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M13%202H3C2.44772%202%202%202.44772%202%203V13C2%2013.5523%202.44772%2014%203%2014H13C13.5523%2014%2014%2013.5523%2014%2013V3C14%202.44772%2013.5523%202%2013%202Z'%20stroke='%2353576A'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M2%204.66666H13.3333'%20stroke='%2353576A'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M8%207.58334H11'%20stroke='%2353576A'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M8%2010.25H11'%20stroke='%2353576A'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M4.66602%202V14'%20stroke='%2353576A'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e\""],"names":[],"mappings":"AAAA,MAAA,WAAe;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const uploadIcon = "data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.89322%206.75699C2.42557%207.10602%201.33398%208.42552%201.33398%209.99999C1.33398%2011.8409%202.82637%2013.3333%204.66732%2013.3333C4.98312%2013.3333%205.28865%2013.2894%205.57815%2013.2074'%20stroke='white'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M12.0189%206.75699C13.4866%207.10602%2014.5782%208.42552%2014.5782%209.99999C14.5782%2011.8409%2013.0858%2013.3333%2011.2448%2013.3333C10.929%2013.3333%2010.6235%2013.2894%2010.334%2013.2074'%20stroke='white'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M12%206.66666C12%204.45752%2010.2091%202.66666%208%202.66666C5.79087%202.66666%204%204.45752%204%206.66666'%20stroke='white'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M5.6875%209.29374L7.999%206.97461L10.3763%209.33341'%20stroke='white'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M8%2012.6667V8.15396'%20stroke='white'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e";
|
|
2
|
+
export {
|
|
3
|
+
uploadIcon as default
|
|
4
|
+
};
|
|
5
|
+
//# sourceMappingURL=upload.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload.svg.js","sources":["../../../../../src/components/core-upload/assets/upload.svg"],"sourcesContent":["export default \"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.89322%206.75699C2.42557%207.10602%201.33398%208.42552%201.33398%209.99999C1.33398%2011.8409%202.82637%2013.3333%204.66732%2013.3333C4.98312%2013.3333%205.28865%2013.2894%205.57815%2013.2074'%20stroke='white'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M12.0189%206.75699C13.4866%207.10602%2014.5782%208.42552%2014.5782%209.99999C14.5782%2011.8409%2013.0858%2013.3333%2011.2448%2013.3333C10.929%2013.3333%2010.6235%2013.2894%2010.334%2013.2074'%20stroke='white'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M12%206.66666C12%204.45752%2010.2091%202.66666%208%202.66666C5.79087%202.66666%204%204.45752%204%206.66666'%20stroke='white'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M5.6875%209.29374L7.999%206.97461L10.3763%209.33341'%20stroke='white'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M8%2012.6667V8.15396'%20stroke='white'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e\""],"names":[],"mappings":"AAAA,MAAA,aAAe;"}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { defineComponent, createVNode, createTextVNode, ref, watch, computed } from "vue";
|
|
2
|
+
import { ElUpload, ElButton, ElMessage } from "element-plus";
|
|
3
|
+
/* empty css */
|
|
4
|
+
/* empty css */
|
|
5
|
+
/* empty css */
|
|
6
|
+
/* empty css */
|
|
7
|
+
/* empty css */
|
|
8
|
+
/* empty css */
|
|
9
|
+
import uploadIcon from "./assets/upload.svg.js";
|
|
10
|
+
import tempIcon from "./assets/temp.svg.js";
|
|
11
|
+
import deleteIcon from "./assets/delete.svg.js";
|
|
12
|
+
/* empty css */
|
|
13
|
+
const index = /* @__PURE__ */ defineComponent({
|
|
14
|
+
name: "CoreUpload",
|
|
15
|
+
props: {
|
|
16
|
+
// 上传地址
|
|
17
|
+
action: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: ""
|
|
20
|
+
},
|
|
21
|
+
// 允许上传的文件类型
|
|
22
|
+
accept: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: ".xlsx,.xls,.csv"
|
|
25
|
+
},
|
|
26
|
+
// 文件大小限制(单位:MB)
|
|
27
|
+
maxSize: {
|
|
28
|
+
type: Number,
|
|
29
|
+
default: 10
|
|
30
|
+
},
|
|
31
|
+
// 是否支持多文件上传
|
|
32
|
+
multiple: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: true
|
|
35
|
+
},
|
|
36
|
+
// 文件列表
|
|
37
|
+
fileList: {
|
|
38
|
+
type: Array,
|
|
39
|
+
default: () => []
|
|
40
|
+
},
|
|
41
|
+
// 下载模板的URL
|
|
42
|
+
templateUrl: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: ""
|
|
45
|
+
},
|
|
46
|
+
// 下载模板的文件名
|
|
47
|
+
templateFileName: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: "模板文件"
|
|
50
|
+
},
|
|
51
|
+
// 提示文本
|
|
52
|
+
tips: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: ""
|
|
55
|
+
},
|
|
56
|
+
// 是否禁用
|
|
57
|
+
disabled: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false
|
|
60
|
+
},
|
|
61
|
+
// 自定义上传请求
|
|
62
|
+
httpRequest: {
|
|
63
|
+
type: Function,
|
|
64
|
+
default: void 0
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
emits: ["update:fileList", "change", "remove", "download-template", "error"],
|
|
68
|
+
setup(props, {
|
|
69
|
+
emit
|
|
70
|
+
}) {
|
|
71
|
+
const uploadRef = ref();
|
|
72
|
+
const fileList = ref(props.fileList || []);
|
|
73
|
+
watch(() => props.fileList, (newFileList) => {
|
|
74
|
+
if (newFileList && JSON.stringify(newFileList) !== JSON.stringify(fileList.value)) {
|
|
75
|
+
fileList.value = [...newFileList || []];
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
deep: true,
|
|
79
|
+
immediate: true
|
|
80
|
+
});
|
|
81
|
+
const tipsText = computed(() => {
|
|
82
|
+
if (props.tips) {
|
|
83
|
+
return props.tips;
|
|
84
|
+
}
|
|
85
|
+
const acceptTypes = props.accept.split(",").map((type) => type.replace(".", "").toUpperCase()).join(" 或 ");
|
|
86
|
+
return `支持 ${acceptTypes} 格式。文件大小不超过 ${props.maxSize}MB。`;
|
|
87
|
+
});
|
|
88
|
+
const formatFileSize = (size) => {
|
|
89
|
+
if (size < 1024) {
|
|
90
|
+
return size + " B";
|
|
91
|
+
} else if (size < 1024 * 1024) {
|
|
92
|
+
return (size / 1024).toFixed(2) + " KB";
|
|
93
|
+
} else {
|
|
94
|
+
return (size / (1024 * 1024)).toFixed(2) + " MB";
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const getFileExtension = (filename) => {
|
|
98
|
+
const lastDot = filename.lastIndexOf(".");
|
|
99
|
+
return lastDot !== -1 ? filename.substring(lastDot).toLowerCase() : "";
|
|
100
|
+
};
|
|
101
|
+
const validateFileType = (file) => {
|
|
102
|
+
const acceptTypes = props.accept.split(",").map((type) => type.trim().toLowerCase());
|
|
103
|
+
const fileExt = getFileExtension(file.name);
|
|
104
|
+
const isValid = acceptTypes.some((type) => {
|
|
105
|
+
if (type.startsWith(".")) {
|
|
106
|
+
return type === fileExt;
|
|
107
|
+
}
|
|
108
|
+
return file.type && file.type.includes(type.replace(".", ""));
|
|
109
|
+
});
|
|
110
|
+
if (!isValid) {
|
|
111
|
+
const acceptTypesText = props.accept.split(",").map((type) => type.replace(".", "").toUpperCase()).join(" 或 ");
|
|
112
|
+
ElMessage.error(`只能上传 ${acceptTypesText} 格式的文件!`);
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
return true;
|
|
116
|
+
};
|
|
117
|
+
const validateFileSize = (file) => {
|
|
118
|
+
const maxSizeBytes = props.maxSize * 1024 * 1024;
|
|
119
|
+
if (file.size > maxSizeBytes) {
|
|
120
|
+
ElMessage.error(`文件大小不能超过 ${props.maxSize}MB!`);
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
};
|
|
125
|
+
const beforeUpload = (file) => {
|
|
126
|
+
if (!validateFileType(file)) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
if (!validateFileSize(file)) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
return true;
|
|
133
|
+
};
|
|
134
|
+
const handleChange = (uploadFile, uploadFiles) => {
|
|
135
|
+
fileList.value = uploadFiles.map((file) => ({
|
|
136
|
+
name: file.name,
|
|
137
|
+
url: file.url,
|
|
138
|
+
uid: file.uid,
|
|
139
|
+
status: file.status,
|
|
140
|
+
response: file.response
|
|
141
|
+
}));
|
|
142
|
+
emit("update:fileList", fileList.value);
|
|
143
|
+
emit("change", uploadFile, uploadFiles);
|
|
144
|
+
};
|
|
145
|
+
const handleRemove = (uploadFile, uploadFiles) => {
|
|
146
|
+
fileList.value = uploadFiles.map((file) => ({
|
|
147
|
+
name: file.name,
|
|
148
|
+
url: file.url,
|
|
149
|
+
uid: file.uid,
|
|
150
|
+
status: file.status,
|
|
151
|
+
response: file.response
|
|
152
|
+
}));
|
|
153
|
+
emit("update:fileList", fileList.value);
|
|
154
|
+
emit("remove", uploadFile, uploadFiles);
|
|
155
|
+
};
|
|
156
|
+
const handleError = (error, uploadFile) => {
|
|
157
|
+
ElMessage.error(`文件 ${uploadFile.name} 上传失败:${error.message}`);
|
|
158
|
+
emit("error", error, uploadFile);
|
|
159
|
+
};
|
|
160
|
+
const handleDownloadTemplate = () => {
|
|
161
|
+
if (!props.templateUrl) {
|
|
162
|
+
ElMessage.warning("模板文件地址未配置");
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
emit("download-template", props.templateUrl);
|
|
166
|
+
const link = document.createElement("a");
|
|
167
|
+
link.href = props.templateUrl;
|
|
168
|
+
link.download = props.templateFileName;
|
|
169
|
+
document.body.appendChild(link);
|
|
170
|
+
link.click();
|
|
171
|
+
document.body.removeChild(link);
|
|
172
|
+
};
|
|
173
|
+
const handleDelete = (file) => {
|
|
174
|
+
const index2 = fileList.value.findIndex((item) => item.uid === file.uid);
|
|
175
|
+
if (index2 !== -1) {
|
|
176
|
+
fileList.value.splice(index2, 1);
|
|
177
|
+
emit("update:fileList", fileList.value);
|
|
178
|
+
emit("remove", file, fileList.value);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
return {
|
|
182
|
+
uploadRef,
|
|
183
|
+
fileList,
|
|
184
|
+
tipsText,
|
|
185
|
+
formatFileSize,
|
|
186
|
+
beforeUpload,
|
|
187
|
+
handleChange,
|
|
188
|
+
handleRemove,
|
|
189
|
+
handleError,
|
|
190
|
+
handleDownloadTemplate,
|
|
191
|
+
handleDelete
|
|
192
|
+
};
|
|
193
|
+
},
|
|
194
|
+
render() {
|
|
195
|
+
return createVNode("div", {
|
|
196
|
+
"class": "core-upload"
|
|
197
|
+
}, [createVNode("div", {
|
|
198
|
+
"class": "core-upload__actions"
|
|
199
|
+
}, [createVNode(ElUpload, {
|
|
200
|
+
"ref": "uploadRef",
|
|
201
|
+
"class": "core-upload__upload",
|
|
202
|
+
"action": this.action,
|
|
203
|
+
"accept": this.accept,
|
|
204
|
+
"multiple": this.multiple,
|
|
205
|
+
"fileList": this.fileList,
|
|
206
|
+
"beforeUpload": this.beforeUpload,
|
|
207
|
+
"onChange": this.handleChange,
|
|
208
|
+
"onRemove": this.handleRemove,
|
|
209
|
+
"onError": this.handleError,
|
|
210
|
+
"httpRequest": this.httpRequest,
|
|
211
|
+
"disabled": this.disabled,
|
|
212
|
+
"showFileList": false
|
|
213
|
+
}, {
|
|
214
|
+
trigger: () => createVNode(ElButton, {
|
|
215
|
+
"type": "primary",
|
|
216
|
+
"icon": createVNode("img", {
|
|
217
|
+
"src": uploadIcon,
|
|
218
|
+
"alt": "upload"
|
|
219
|
+
}, null),
|
|
220
|
+
"disabled": this.disabled
|
|
221
|
+
}, {
|
|
222
|
+
default: () => [createTextVNode("上传文件")]
|
|
223
|
+
})
|
|
224
|
+
}), createVNode(ElButton, {
|
|
225
|
+
"icon": createVNode("img", {
|
|
226
|
+
"src": tempIcon,
|
|
227
|
+
"alt": "download"
|
|
228
|
+
}, null),
|
|
229
|
+
"onClick": this.handleDownloadTemplate,
|
|
230
|
+
"disabled": this.disabled
|
|
231
|
+
}, {
|
|
232
|
+
default: () => [createTextVNode("下载模板")]
|
|
233
|
+
})]), this.tipsText && createVNode("div", {
|
|
234
|
+
"class": "core-upload__tips"
|
|
235
|
+
}, [this.tipsText]), this.fileList && this.fileList.length > 0 && createVNode("div", {
|
|
236
|
+
"class": "core-upload__file-list"
|
|
237
|
+
}, [this.fileList.map((file) => createVNode("div", {
|
|
238
|
+
"key": file.uid,
|
|
239
|
+
"class": "core-upload__file-item"
|
|
240
|
+
}, [createVNode("div", {
|
|
241
|
+
"class": "core-upload__file-info"
|
|
242
|
+
}, [createVNode("span", {
|
|
243
|
+
"class": "core-upload__file-icon"
|
|
244
|
+
}, [createTextVNode("📄")]), createVNode("span", {
|
|
245
|
+
"class": "core-upload__file-name",
|
|
246
|
+
"title": file.name
|
|
247
|
+
}, [file.name])]), createVNode("img", {
|
|
248
|
+
"onClick": () => this.handleDelete(file),
|
|
249
|
+
"src": deleteIcon,
|
|
250
|
+
"alt": "delete",
|
|
251
|
+
"class": "core-upload__file-delete"
|
|
252
|
+
}, null)]))])]);
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
export {
|
|
256
|
+
index as default
|
|
257
|
+
};
|
|
258
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/core-upload/index.tsx"],"sourcesContent":["import { defineComponent, ref, PropType, computed, watch } from 'vue';\nimport { ElUpload, ElButton, ElMessage, ElIcon } from 'element-plus';\nimport type { UploadFile, UploadFiles, UploadRequestOptions } from 'element-plus';\n// @ts-ignore\nimport uploadIcon from './assets/upload.svg';\n// @ts-ignore\nimport tempIcon from './assets/temp.svg';\n// @ts-ignore\nimport deleteIcon from './assets/delete.svg';\nimport './style.less';\n\nexport interface UploadFileItem {\n name: string;\n url?: string;\n uid?: number;\n status?: 'ready' | 'uploading' | 'success' | 'fail';\n response?: any;\n [key: string]: any;\n}\n\nexport default defineComponent({\n name: 'CoreUpload',\n props: {\n // 上传地址\n action: {\n type: String,\n default: '',\n },\n // 允许上传的文件类型\n accept: {\n type: String,\n default: '.xlsx,.xls,.csv',\n },\n // 文件大小限制(单位:MB)\n maxSize: {\n type: Number,\n default: 10,\n },\n // 是否支持多文件上传\n multiple: {\n type: Boolean,\n default: true,\n },\n // 文件列表\n fileList: {\n type: Array as PropType<UploadFileItem[]>,\n default: () => [],\n },\n // 下载模板的URL\n templateUrl: {\n type: String,\n default: '',\n },\n // 下载模板的文件名\n templateFileName: {\n type: String,\n default: '模板文件',\n },\n // 提示文本\n tips: {\n type: String,\n default: '',\n },\n // 是否禁用\n disabled: {\n type: Boolean,\n default: false,\n },\n // 自定义上传请求\n httpRequest: {\n type: Function as PropType<(options: UploadRequestOptions) => void>,\n default: undefined,\n },\n },\n emits: ['update:fileList', 'change', 'remove', 'download-template', 'error'],\n setup(props, { emit }) {\n const uploadRef = ref<InstanceType<typeof ElUpload>>();\n const fileList = ref<UploadFileItem[]>(props.fileList || []);\n\n // 监听外部 fileList 变化\n watch(\n () => props.fileList,\n (newFileList) => {\n if (newFileList && JSON.stringify(newFileList) !== JSON.stringify(fileList.value)) {\n fileList.value = [...(newFileList || [])];\n }\n },\n { deep: true, immediate: true }\n );\n\n // 生成提示文本\n const tipsText = computed(() => {\n if (props.tips) {\n return props.tips;\n }\n const acceptTypes = props.accept\n .split(',')\n .map((type) => type.replace('.', '').toUpperCase())\n .join(' 或 ');\n return `支持 ${acceptTypes} 格式。文件大小不超过 ${props.maxSize}MB。`;\n });\n\n // 格式化文件大小\n const formatFileSize = (size: number): string => {\n if (size < 1024) {\n return size + ' B';\n } else if (size < 1024 * 1024) {\n return (size / 1024).toFixed(2) + ' KB';\n } else {\n return (size / (1024 * 1024)).toFixed(2) + ' MB';\n }\n };\n\n // 获取文件扩展名\n const getFileExtension = (filename: string): string => {\n const lastDot = filename.lastIndexOf('.');\n return lastDot !== -1 ? filename.substring(lastDot).toLowerCase() : '';\n };\n\n // 验证文件类型\n const validateFileType = (file: File): boolean => {\n const acceptTypes = props.accept.split(',').map((type) => type.trim().toLowerCase());\n const fileExt = getFileExtension(file.name);\n const isValid = acceptTypes.some((type) => {\n if (type.startsWith('.')) {\n return type === fileExt;\n }\n // 支持 MIME 类型\n return file.type && file.type.includes(type.replace('.', ''));\n });\n\n if (!isValid) {\n const acceptTypesText = props.accept\n .split(',')\n .map((type) => type.replace('.', '').toUpperCase())\n .join(' 或 ');\n ElMessage.error(`只能上传 ${acceptTypesText} 格式的文件!`);\n return false;\n }\n return true;\n };\n\n // 验证文件大小\n const validateFileSize = (file: File): boolean => {\n const maxSizeBytes = props.maxSize * 1024 * 1024;\n if (file.size > maxSizeBytes) {\n ElMessage.error(`文件大小不能超过 ${props.maxSize}MB!`);\n return false;\n }\n return true;\n };\n\n // 上传前的校验\n const beforeUpload = (file: File): boolean => {\n // 类型校验\n if (!validateFileType(file)) {\n return false;\n }\n // 大小校验\n if (!validateFileSize(file)) {\n return false;\n }\n return true;\n };\n\n // 文件状态改变时的钩子\n const handleChange = (uploadFile: UploadFile, uploadFiles: UploadFiles) => {\n fileList.value = uploadFiles.map((file) => ({\n name: file.name,\n url: file.url,\n uid: file.uid,\n status: file.status,\n response: file.response,\n }));\n emit('update:fileList', fileList.value);\n emit('change', uploadFile, uploadFiles);\n };\n\n // 文件移除时的钩子\n const handleRemove = (uploadFile: UploadFile, uploadFiles: UploadFiles) => {\n fileList.value = uploadFiles.map((file) => ({\n name: file.name,\n url: file.url,\n uid: file.uid,\n status: file.status,\n response: file.response,\n }));\n emit('update:fileList', fileList.value);\n emit('remove', uploadFile, uploadFiles);\n };\n\n // 上传失败时的钩子\n const handleError = (error: Error, uploadFile: UploadFile) => {\n ElMessage.error(`文件 ${uploadFile.name} 上传失败:${error.message}`);\n emit('error', error, uploadFile);\n };\n\n // 下载模板\n const handleDownloadTemplate = () => {\n if (!props.templateUrl) {\n ElMessage.warning('模板文件地址未配置');\n return;\n }\n emit('download-template', props.templateUrl);\n \n // 如果没有自定义下载处理,则使用默认下载方式\n const link = document.createElement('a');\n link.href = props.templateUrl;\n link.download = props.templateFileName;\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n };\n\n // 删除文件\n const handleDelete = (file: UploadFileItem) => {\n const index = fileList.value.findIndex((item) => item.uid === file.uid);\n if (index !== -1) {\n fileList.value.splice(index, 1);\n emit('update:fileList', fileList.value);\n emit('remove', file, fileList.value);\n }\n };\n\n return {\n uploadRef,\n fileList,\n tipsText,\n formatFileSize,\n beforeUpload,\n handleChange,\n handleRemove,\n handleError,\n handleDownloadTemplate,\n handleDelete,\n };\n },\n render() {\n return (\n <div class=\"core-upload\">\n {/* 第一层:上传文件、下载模板按钮 */}\n <div class=\"core-upload__actions\">\n <ElUpload\n ref=\"uploadRef\"\n class=\"core-upload__upload\"\n action={this.action}\n accept={this.accept}\n multiple={this.multiple}\n fileList={this.fileList}\n beforeUpload={this.beforeUpload}\n onChange={this.handleChange}\n onRemove={this.handleRemove}\n onError={this.handleError}\n httpRequest={this.httpRequest}\n disabled={this.disabled}\n showFileList={false}\n >\n {{\n trigger: () => (\n <ElButton\n type=\"primary\"\n icon={<img src={uploadIcon} alt=\"upload\" />}\n disabled={this.disabled}\n >\n 上传文件\n </ElButton>\n ),\n }}\n </ElUpload>\n <ElButton\n icon={<img src={tempIcon} alt=\"download\" />}\n onClick={this.handleDownloadTemplate}\n disabled={this.disabled}\n >\n 下载模板\n </ElButton>\n </div>\n\n {/* 第二层:tips 简要描述当前上传限制 */}\n {this.tipsText && (\n <div class=\"core-upload__tips\">\n {this.tipsText}\n </div>\n )}\n\n {/* 第三层:已经上传的列表,支持删除 */}\n {this.fileList && this.fileList.length > 0 && (\n <div class=\"core-upload__file-list\">\n {this.fileList.map((file) => (\n <div key={file.uid} class=\"core-upload__file-item\">\n <div class=\"core-upload__file-info\">\n <span class=\"core-upload__file-icon\">📄</span>\n <span\n class=\"core-upload__file-name\"\n title={file.name}\n >\n {file.name}\n </span>\n </div>\n <img onClick={() => this.handleDelete(file)} src={deleteIcon} alt=\"delete\" class=\"core-upload__file-delete\" />\n </div>\n ))}\n </div>\n )}\n </div>\n );\n },\n});\n\n"],"names":["name","props","action","type","String","default","accept","maxSize","Number","multiple","Boolean","fileList","Array","templateUrl","templateFileName","tips","disabled","httpRequest","Function","undefined","emits","setup","emit","uploadRef","ref","watch","newFileList","JSON","stringify","value","deep","immediate","tipsText","computed","acceptTypes","split","map","replace","toUpperCase","join","formatFileSize","size","toFixed","getFileExtension","filename","lastDot","lastIndexOf","substring","toLowerCase","validateFileType","file","trim","fileExt","isValid","some","startsWith","includes","acceptTypesText","ElMessage","error","validateFileSize","maxSizeBytes","beforeUpload","handleChange","uploadFile","uploadFiles","url","uid","status","response","handleRemove","handleError","message","handleDownloadTemplate","warning","link","document","createElement","href","download","body","appendChild","click","removeChild","handleDelete","index","findIndex","item","splice","render","_createVNode","ElUpload","trigger","ElButton","uploadIcon","_createTextVNode","tempIcon","length","onClick","deleteIcon"],"mappings":";;;;;;;;;;;;AAoBA,MAAA,wCAA+B;AAAA,EAC7BA,MAAM;AAAA,EACNC,OAAO;AAAA;AAAA,IAELC,QAAQ;AAAA,MACNC,MAAMC;AAAAA,MACNC,SAAS;AAAA;;IAGXC,QAAQ;AAAA,MACNH,MAAMC;AAAAA,MACNC,SAAS;AAAA;;IAGXE,SAAS;AAAA,MACPJ,MAAMK;AAAAA,MACNH,SAAS;AAAA;;IAGXI,UAAU;AAAA,MACRN,MAAMO;AAAAA,MACNL,SAAS;AAAA;;IAGXM,UAAU;AAAA,MACRR,MAAMS;AAAAA,MACNP,SAASA,MAAM,CAAA;AAAA;;IAGjBQ,aAAa;AAAA,MACXV,MAAMC;AAAAA,MACNC,SAAS;AAAA;;IAGXS,kBAAkB;AAA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AAA,OAIaM;AAAAA,QAAQ,OAAA;AAAA,MAAA,GAAA,IAAA;AAAA,MAAA,WACf,KAAKvB;AAAAA,MAAsB,YAC1B,KAAKzD;AAAAA,IAAQ,GAAA;AAAA,MAAAX,SAAAA,MAAA,CAAA0F,gBAAA,MAAA,CAAA;AAAA,IAAA,CAAA,CAAA,CAAA,GAO1B,KAAK/D,YAAQ0D,YAAA,OAAA;AAAA,MAAA,SAAA;AAAA,IAAA,GAAA,CAET,KAAK1D,QAAQ,CAAA,GAKjB,KAAKrB,YAAY,KAAKA,SAASsF,SAAS,KAACP,YAAA,OAAA;AAAA,MAAA,SAAA;AAAA,OAAA,CAErC,KAAK/E,SAASyB,IAAKc,UAAIwC,YAAA,OAAA;AAAA,MAAA,OACZxC,KAAKiB;AAAAA,MAAG,SAAA;AAAA,IAAA,GAAA,CAAAuB,YAAA,OAAA;AAAA,MAAA,SAAA;AAAA,IAAA,GAAA,CAAAA,YAAA,QAAA;AAAA,MAAA,SAAA;AAAA,OAAA,CAAAK,yBAAAL,YAAA,QAAA;AAAA,MAAA,SAAA;AAAA,MAAA,SAKLxC,KAAKlD;AAAAA,IAAI,GAAA,CAEfkD,KAAKlD,IAAI,CAAA,CAAA,CAAA,GAAA0F,YAAA,OAAA;AAAA,MAAA,WAGAQ,MAAM,KAAKd,aAAalC,IAAI;AAAA,MAAC,OAAOiD;AAAAA,MAAU,OAAA;AAAA,MAAA,SAAA;AAAA,IAAA,GAAA,IAAA,CAAA,CAAA,CAE/D,CAAC,CAAA,CAEL,CAAA;AAAA,EAGP;AACF,CAAC;"}
|
|
@@ -9,6 +9,7 @@ import { default as default9 } from "./core-result/index.js";
|
|
|
9
9
|
import { default as default10 } from "./core-table/index.js";
|
|
10
10
|
import { default as default11 } from "./core-chart/index.js";
|
|
11
11
|
import { default as default12 } from "./core-card/index.js";
|
|
12
|
+
import { default as default13 } from "./core-upload/index.js";
|
|
12
13
|
export {
|
|
13
14
|
default2 as BubbleList,
|
|
14
15
|
default12 as CoreCard,
|
|
@@ -17,6 +18,7 @@ export {
|
|
|
17
18
|
default10 as CoreTable,
|
|
18
19
|
default7 as CoreText,
|
|
19
20
|
default8 as CoreTips,
|
|
21
|
+
default13 as CoreUpload,
|
|
20
22
|
default5 as EditorSender,
|
|
21
23
|
default6 as FileCard,
|
|
22
24
|
default4 as FilePreview,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -502,7 +502,7 @@ ${divContent}${divEnd}`;
|
|
|
502
502
|
]);
|
|
503
503
|
};
|
|
504
504
|
const hastToVNode = (node, index, row) => {
|
|
505
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
505
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
506
506
|
if (!node) return null;
|
|
507
507
|
let children = [];
|
|
508
508
|
const blackTagNames = ["sub", "pre", "text", "ElForm"];
|
|
@@ -584,12 +584,23 @@ ${divContent}${divEnd}`;
|
|
|
584
584
|
}, children);
|
|
585
585
|
}
|
|
586
586
|
if (node.tagName === "CoreCard") {
|
|
587
|
+
const slots = {};
|
|
588
|
+
if ((_d = node.slots) == null ? void 0 : _d.header) {
|
|
589
|
+
slots.header = () => {
|
|
590
|
+
return node.slots.header.map((slotItem) => {
|
|
591
|
+
return hastToVNode(slotItem, index);
|
|
592
|
+
});
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
if (children && children.length > 0) {
|
|
596
|
+
slots.default = () => children;
|
|
597
|
+
}
|
|
587
598
|
return h(CoreCard, {
|
|
588
599
|
...node.properties
|
|
589
|
-
},
|
|
600
|
+
}, slots);
|
|
590
601
|
}
|
|
591
602
|
if (node.tagName === "ElForm") {
|
|
592
|
-
const children2 = (
|
|
603
|
+
const children2 = (_e = node.children) == null ? void 0 : _e.map((child) => hastToVNode(child, curInit));
|
|
593
604
|
curInit++;
|
|
594
605
|
return h(ElForm, {
|
|
595
606
|
ref: formRefs.value.set,
|
|
@@ -604,7 +615,7 @@ ${divContent}${divEnd}`;
|
|
|
604
615
|
}, children);
|
|
605
616
|
}
|
|
606
617
|
if (node.tagName === "ElButton") {
|
|
607
|
-
let payload = (
|
|
618
|
+
let payload = (_f = node.properties) == null ? void 0 : _f.payload;
|
|
608
619
|
if (node.parentScope === "table") {
|
|
609
620
|
payload = row;
|
|
610
621
|
}
|
|
@@ -621,7 +632,7 @@ ${divContent}${divEnd}`;
|
|
|
621
632
|
return h(ElSelect, {
|
|
622
633
|
...node.properties,
|
|
623
634
|
disabled: checkDisabled(node),
|
|
624
|
-
modelValue: hitlData.value[index][(
|
|
635
|
+
modelValue: hitlData.value[index][(_g = node.properties) == null ? void 0 : _g.formProp],
|
|
625
636
|
"onUpdate:modelValue": (value) => {
|
|
626
637
|
var _a2;
|
|
627
638
|
hitlData.value[index][(_a2 = node.properties) == null ? void 0 : _a2.formProp] = value;
|
|
@@ -632,7 +643,7 @@ ${divContent}${divEnd}`;
|
|
|
632
643
|
return h(ElDatePicker, {
|
|
633
644
|
...node.properties,
|
|
634
645
|
disabled: checkDisabled(node),
|
|
635
|
-
modelValue: hitlData.value[index][(
|
|
646
|
+
modelValue: hitlData.value[index][(_h = node.properties) == null ? void 0 : _h.formProp],
|
|
636
647
|
"onUpdate:modelValue": (value) => {
|
|
637
648
|
var _a2;
|
|
638
649
|
hitlData.value[index][(_a2 = node.properties) == null ? void 0 : _a2.formProp] = value;
|
|
@@ -643,7 +654,7 @@ ${divContent}${divEnd}`;
|
|
|
643
654
|
return h(ElInput, {
|
|
644
655
|
...node.properties,
|
|
645
656
|
disabled: checkDisabled(node),
|
|
646
|
-
modelValue: hitlData.value[index][(
|
|
657
|
+
modelValue: hitlData.value[index][(_i = node.properties) == null ? void 0 : _i.formProp],
|
|
647
658
|
"onUpdate:modelValue": (value) => {
|
|
648
659
|
var _a2;
|
|
649
660
|
hitlData.value[index][(_a2 = node.properties) == null ? void 0 : _a2.formProp] = value;
|
|
@@ -654,7 +665,7 @@ ${divContent}${divEnd}`;
|
|
|
654
665
|
return h(ElRadioGroup, {
|
|
655
666
|
...node.properties,
|
|
656
667
|
disabled: checkDisabled(node),
|
|
657
|
-
modelValue: hitlData.value[index][(
|
|
668
|
+
modelValue: hitlData.value[index][(_j = node.properties) == null ? void 0 : _j.formProp],
|
|
658
669
|
"onUpdate:modelValue": (value) => {
|
|
659
670
|
var _a2;
|
|
660
671
|
hitlData.value[index][(_a2 = node.properties) == null ? void 0 : _a2.formProp] = value;
|
|
@@ -711,10 +722,10 @@ ${divContent}${divEnd}`;
|
|
|
711
722
|
});
|
|
712
723
|
}
|
|
713
724
|
if (node.tagName === "pre") {
|
|
714
|
-
const codeNode = (
|
|
725
|
+
const codeNode = (_k = node.children) == null ? void 0 : _k.find((child) => child.tagName === "code");
|
|
715
726
|
if (codeNode) {
|
|
716
|
-
if ((
|
|
717
|
-
const code = ((
|
|
727
|
+
if ((_m = (_l = codeNode.properties) == null ? void 0 : _l.className) == null ? void 0 : _m.includes("language-CorePilot")) {
|
|
728
|
+
const code = ((_o = (_n = codeNode.children) == null ? void 0 : _n[0]) == null ? void 0 : _o.value) || "";
|
|
718
729
|
if (!isCompleteJSON(code)) {
|
|
719
730
|
return renderSkeleton();
|
|
720
731
|
}
|