@core-pilot/client-vue 0.0.7 → 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/bubble-list/index.js +1 -1
- package/dist/cjs/components/bubble-list/index.js.map +1 -1
- package/dist/cjs/components/core-card/index.js +2 -0
- package/dist/cjs/components/core-card/index.js.map +1 -0
- 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/bubble-list/index.js +1 -0
- package/dist/es/components/bubble-list/index.js.map +1 -1
- package/dist/es/components/core-card/index.js +81 -0
- package/dist/es/components/core-card/index.js.map +1 -0
- 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 +4 -0
- package/dist/es/components/index.js.map +1 -1
- package/dist/es/components/x-markdown/index.js +118 -21
- package/dist/es/components/x-markdown/index.js.map +1 -1
- package/dist/es/components/x-markdown/utils/parseCorePilotSchema.js +17 -2
- package/dist/es/components/x-markdown/utils/parseCorePilotSchema.js.map +1 -1
- package/dist/es/index.js +4 -0
- package/dist/es/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=(e,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=(e,E)=>{switch(e.type){case"view":return t(e);case"form":return p(e);case"card":return s(e);case"table":return c(e);case"input":return a(e,E);case"select":return o(e,E);case"dateTimePicker":return n(e,E);case"button":return i(e,E);case"tips":return m(e,E);case"text":return u(e,E);case"formfield":return d(e,E);case"column":return l(e,E);case"row":return g(e,E);case"col":return h(e,E);case"result":return r(e,E);case"tag":return v(e,E);case"radioGroup":return y(e,E);case"radio":return N(e,E);case"echart":return S(e,E);default:const b=e;console.error(b)}},r=(e,r)=>({tagName:"CoreResult",type:"element",properties:e.properties,parentScope:r}),t=r=>({tagName:"view",type:"element",properties:{title:r.title},children:r.children.map(r=>e(r))}),p=r=>{const t=[];r.fields.forEach(r=>{t.push(e(r,"form"))});const p={tagName:"div",type:"element",properties:{class:"hitl-btn-list"},children:r.actions.map(r=>e(r,"form"))};return t.push(p),{tagName:"ElForm",type:"element",properties:{labelPosition:"right",...r.properties},children:t}},a=(e,r)=>({tagName:"ElInput",type:"element",properties:e.properties,parentScope:r}),o=(e,r)=>({tagName:"ElSelect",type:"element",properties:e.properties,parentScope:r}),n=(e,r)=>({tagName:"ElDatePicker",type:"element",properties:e.properties,parentScope:r}),i=(r,t)=>{var p,a;return{tagName:"ElButton",type:"element",properties:{...r.properties,action:r.action,payload:r.payload},parentScope:t,children:null==(a=null==(p=r.children)?void 0:p.map)?void 0:a.call(p,r=>e(r,t))}},s=r=>{var t;const p={tagName:"CoreCard",type:"element",properties:r.properties,children:r.children.map(r=>e(r))};return(null==(t=r.slots)?void 0:t.header)&&(p.slots={header:r.slots.header.map(r=>e(r))}),p},l=(r,t)=>{var p;return{tagName:"ElTableColumn",type:"element",properties:r.properties,parentScope:t,children:null==(p=r.children)?void 0:p.map(r=>e(r,t))}},c=r=>(r.properties.tableProps||(r.properties.tableProps={data:[],...r.properties}),{tagName:"ElTable",type:"element",properties:r.properties,children:r.children.map(r=>e(r,"table"))}),m=(e,r)=>({tagName:"CoreTips",type:"element",properties:e.properties,parentScope:r}),u=(e,r)=>({tagName:"CoreText",type:"element",properties:e.properties,parentScope:r}),d=(r,t)=>{const p=r.properties.prop,a=((e,r)=>e.map(e=>({...e,properties:{...e.properties,formProp:r}})))(r.children,p);return{tagName:"ElFormItem",type:"element",properties:{...r.properties,rules:(o=r.properties.rules,null==o?void 0:o.map(e=>"pattern"in e&&e.pattern?{pattern:new RegExp(e.pattern),message:e.message,trigger:e.trigger}:e))},parentScope:t,children:[e(a[0],t)]};var o},g=(r,t)=>({tagName:"ElRow",type:"element",properties:r.properties,children:r.children.map(r=>e(r,t))}),h=(r,t)=>({tagName:"ElCol",type:"element",properties:r.properties,parentScope:t,children:r.children.map(r=>e(r,t))}),y=(r,t)=>{var p;return{tagName:"ElRadioGroup",type:"element",properties:r.properties,parentScope:t,children:null==(p=r.properties.options)?void 0:p.map(r=>e({type:"radio",properties:r},t))}},N=(e,r)=>({tagName:"ElRadio",type:"element",properties:e.properties,parentScope:r}),v=(r,t)=>{const p={tagName:"ElTag",type:"element",properties:r.properties,parentScope:t,children:r.children.map(r=>e(r,t))};return"table"===t&&(p.value=r.value),p},S=(e,r)=>({tagName:"CoreChart",type:"element",properties:e.properties,parentScope:r});exports.parseCorePilot=r=>e(r);
|
|
2
2
|
//# sourceMappingURL=parseCorePilotSchema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseCorePilotSchema.js","sources":["../../../../../src/components/x-markdown/utils/parseCorePilotSchema.ts"],"sourcesContent":["import { \n FormSchema, \n ViewSchema,\n FormFieldSchema, \n CardSchema, \n ButtonSchema, \n TableSchema, \n TipsSchema, \n TextSchema, \n InputSchema, \n SelectSchema, \n DateTimePickerSchema, \n TableColumnSchema, \n RowSchema, \n ColSchema, \n ResultSchema, \n TagSchema,\n RadioGroupSchema,\n RadioSchema,\n EChartsSchema,\n} from '@/types/index';\n\ntype ElementSchema = \n | ViewSchema<any> \n | FormSchema \n | FormFieldSchema \n | CardSchema \n | ButtonSchema \n | TableSchema \n | TipsSchema \n | TextSchema \n | InputSchema \n | SelectSchema \n | DateTimePickerSchema \n | TableColumnSchema \n | RowSchema \n | ColSchema \n | ResultSchema \n | TagSchema \n | RadioGroupSchema \n | RadioSchema\n | EChartsSchema;\n\ntype ParentScopeType = 'form' | 'table';\n\nconst parseSchema = (schema: ElementSchema, type?: ParentScopeType) => {\n switch (schema.type) {\n case 'view':\n return parseView(schema);\n case 'form':\n return parseForm(schema);\n case 'card':\n return parseCard(schema);\n case 'table':\n return parseTable(schema);\n case 'input':\n return parseInput(schema, type);\n case 'select':\n return parseSelect(schema, type);\n case 'dateTimePicker':\n return parseDate(schema, type);\n case 'button':\n return parseButton(schema, type);\n case 'tips':\n return parseTips(schema, type);\n case 'text':\n return parseText(schema, type);\n case 'formfield':\n return parseFormItem(schema, type);\n case 'column':\n return parseTableColumn(schema, type);\n case 'row':\n return parseRow(schema, type);\n case 'col':\n return parseCol(schema, type);\n case 'result':\n return parseResult(schema, type);\n case 'tag':\n return parseTag(schema, type);\n case 'radioGroup':\n return parseRadioGroup(schema, type);\n case 'radio':\n return parseRadio(schema, type);\n case 'echart':\n return parseECharts(schema, type);\n default:\n const _: never = schema;\n console.error(_);\n }\n}\n\n// result组件解析\nconst parseResult = (schema: ResultSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'CoreResult',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n }\n}\n\n// view组件解析\nconst parseView = (schema: ViewSchema<any>) => {\n return {\n tagName: 'view',\n type: 'element',\n properties: {\n title: schema.title,\n },\n children: schema.children.map((item) => {\n return parseSchema(item);\n })\n }\n}\n\n// form组件解析\nconst parseForm = (schema: FormSchema) => {\n const children: any[] = [] \n schema.fields.forEach((item) => {\n children.push(parseSchema(item, 'form'));\n });\n const actionChild = {\n tagName: 'div',\n type: 'element',\n properties: {\n class: 'hitl-btn-list',\n },\n children: schema.actions.map((item) => {\n return parseSchema(item, 'form');\n })\n }\n children.push(actionChild);\n return {\n tagName: 'ElForm',\n type: 'element',\n properties: {\n labelPosition: 'right',\n ...schema.properties,\n },\n children,\n }\n}\n\nconst parseInput = (schema: InputSchema, type?: ParentScopeType) => {\n return {\n tagName: 'ElInput',\n type: 'element',\n properties: schema.properties,\n parentScope: type,\n }\n}\n\nconst parseSelect = (schema: SelectSchema, type?: ParentScopeType) => {\n return {\n tagName: 'ElSelect',\n type: 'element',\n properties: schema.properties,\n parentScope: type,\n }\n}\n\nconst parseDate = (schema: DateTimePickerSchema, type?: ParentScopeType) => {\n return {\n tagName: 'ElDatePicker',\n type: 'element',\n properties: schema.properties,\n parentScope: type,\n }\n}\n\nconst parseButton = (schema: ButtonSchema, type?: ParentScopeType) => {\n return {\n tagName: 'ElButton',\n type: 'element',\n properties: {\n ...schema.properties,\n action: schema.action,\n payload: schema.payload,\n },\n // TODO 记录父级作用域,用于在form、table 组件中使用\n parentScope: type,\n children: schema.children?.map?.((item) => {\n return parseSchema(item, type);\n })\n }\n}\n\nconst parseCard = (schema: CardSchema) => {\n return {\n tagName: 'ElCard',\n type: 'element',\n properties: schema.properties,\n children: schema.children.map((item) => {\n return parseSchema(item);\n })\n }\n}\n\nconst parseTableColumn = (schema: TableColumnSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElTableColumn',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n children: schema.children?.map((item) => {\n return parseSchema(item, parentType);\n })\n }\n}\n\nconst parseTable = (schema: TableSchema) => {\n return {\n tagName: 'ElTable',\n type: 'element',\n properties: schema.properties,\n children: schema.children.map((item) => {\n return parseSchema(item, 'table');\n })\n }\n}\n\n\nconst parseTips = (schema: TipsSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'CoreTips',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n }\n}\n\nconst parseText = (schema: TextSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'CoreText',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n }\n}\nconst injectFormProp = (schema: FormFieldSchema['children'], prop: string) => {\n return schema.map((item) => {\n return {\n ...item,\n properties: {\n ...item.properties,\n formProp: prop,\n },\n }\n })\n}\nconst parseFormItem = (schema: FormFieldSchema, parentType?: ParentScopeType) => {\n const prop = schema.properties.prop;\n const children = injectFormProp(schema.children, prop);\n const formatRules = (rules: FormFieldSchema['properties']['rules']) => {\n return rules?.map((item) => {\n if ('pattern' in item && item.pattern) {\n return {\n pattern: new RegExp(item.pattern),\n message: item.message,\n trigger: item.trigger,\n }\n }\n return item;\n })\n }\n return {\n tagName: 'ElFormItem',\n type: 'element',\n properties: {\n ...schema.properties,\n rules: formatRules(schema.properties.rules),\n },\n parentScope: parentType,\n children: [\n parseSchema(children[0] as InputSchema, parentType),\n ]\n }\n}\n\nconst parseRow = (schema: RowSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElRow',\n type: 'element',\n properties: schema.properties,\n children: schema.children.map((item) => {\n return parseSchema(item, parentType);\n })\n }\n}\n\nconst parseCol = (schema: ColSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElCol',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n children: schema.children.map((item) => {\n return parseSchema(item as ElementSchema, parentType);\n })\n }\n}\n\nconst parseRadioGroup = (schema: RadioGroupSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElRadioGroup',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n children: schema.properties.options?.map((item) => {\n return parseSchema({\n type: 'radio',\n properties: item,\n } as RadioSchema, parentType);\n })\n }\n}\n\nconst parseRadio = (schema: RadioSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElRadio',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n }\n}\n\nconst parseTag = (schema: TagSchema, parentType?: ParentScopeType) => {\n const formatSchema = {\n tagName: 'ElTag',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n children: schema.children.map((item) => {\n return parseSchema(item as TextSchema, parentType);\n })\n }\n if (parentType === 'table') {\n formatSchema.value = schema.value;\n }\n return formatSchema;\n}\n\n// ECharts 图表解析\nconst parseECharts = (schema: EChartsSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'CoreChart',\n type: 'element' as const,\n properties: schema.properties,\n parentScope: parentType,\n };\n}\n\nexport const parseCorePilot = (schema: ViewSchema<any>) => {\n return parseSchema(schema);\n}"],"names":["parseSchema","schema","type","parseView","parseForm","parseCard","parseTable","parseInput","parseSelect","parseDate","parseButton","parseTips","parseText","parseFormItem","parseTableColumn","parseRow","parseCol","parseResult","parseTag","parseRadioGroup","parseRadio","parseECharts","_","console","error","parentType","tagName","properties","parentScope","title","children","map","item","fields","forEach","push","actionChild","class","actions","labelPosition","action","payload","_b","_a","call","prop","formProp","injectFormProp","rules","pattern","RegExp","message","trigger","options","formatSchema","value"],"mappings":"gFA6CA,MAAMA,EAAc,CAACC,EAAuBC,KAC1C,OAAQD,EAAOC,MACb,IAAK,OACH,OAAOC,EAAUF,GACnB,IAAK,OACH,OAAOG,EAAUH,GACnB,IAAK,OACH,OAAOI,EAAUJ,GACnB,IAAK,QACH,OAAOK,EAAWL,GACpB,IAAK,QACH,OAAOM,EAAWN,EAAQC,GAC5B,IAAK,SACH,OAAOM,EAAYP,EAAQC,GAC7B,IAAK,iBACH,OAAOO,EAAUR,EAAQC,GAC3B,IAAK,SACH,OAAOQ,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,EAAYgC,EAAoBP,KAM3C,MAHmB,UAAfA,IACF6B,EAAaC,MAAQtD,EAAOsD,OAEvBD,GAIHjC,EAAe,CAACpB,EAAuBwB,KACpC,CACLC,QAAS,YACTxB,KAAM,UACNyB,WAAY1B,EAAO0B,WACnBC,YAAaH,2BAIcxB,GACtBD,EAAYC"}
|
|
1
|
+
{"version":3,"file":"parseCorePilotSchema.js","sources":["../../../../../src/components/x-markdown/utils/parseCorePilotSchema.ts"],"sourcesContent":["import { \n FormSchema, \n ViewSchema,\n FormFieldSchema, \n CardSchema, \n ButtonSchema, \n TableSchema, \n TipsSchema, \n TextSchema, \n InputSchema, \n SelectSchema, \n DateTimePickerSchema, \n TableColumnSchema, \n RowSchema, \n ColSchema, \n ResultSchema, \n TagSchema,\n RadioGroupSchema,\n RadioSchema,\n EChartsSchema,\n} from '@/types/index';\n\ntype ElementSchema = \n | ViewSchema<any> \n | FormSchema \n | FormFieldSchema \n | CardSchema \n | ButtonSchema \n | TableSchema \n | TipsSchema \n | TextSchema \n | InputSchema \n | SelectSchema \n | DateTimePickerSchema \n | TableColumnSchema \n | RowSchema \n | ColSchema \n | ResultSchema \n | TagSchema \n | RadioGroupSchema \n | RadioSchema\n | EChartsSchema;\n\ntype ParentScopeType = 'form' | 'table';\n\nconst parseSchema = (schema: ElementSchema, type?: ParentScopeType) => {\n switch (schema.type) {\n case 'view':\n return parseView(schema);\n case 'form':\n return parseForm(schema);\n case 'card':\n return parseCard(schema);\n case 'table':\n return parseTable(schema);\n case 'input':\n return parseInput(schema, type);\n case 'select':\n return parseSelect(schema, type);\n case 'dateTimePicker':\n return parseDate(schema, type);\n case 'button':\n return parseButton(schema, type);\n case 'tips':\n return parseTips(schema, type);\n case 'text':\n return parseText(schema, type);\n case 'formfield':\n return parseFormItem(schema, type);\n case 'column':\n return parseTableColumn(schema, type);\n case 'row':\n return parseRow(schema, type);\n case 'col':\n return parseCol(schema, type);\n case 'result':\n return parseResult(schema, type);\n case 'tag':\n return parseTag(schema, type);\n case 'radioGroup':\n return parseRadioGroup(schema, type);\n case 'radio':\n return parseRadio(schema, type);\n case 'echart':\n return parseECharts(schema, type);\n default:\n const _: never = schema;\n console.error(_);\n }\n}\n\n// result组件解析\nconst parseResult = (schema: ResultSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'CoreResult',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n }\n}\n\n// view组件解析\nconst parseView = (schema: ViewSchema<any>) => {\n return {\n tagName: 'view',\n type: 'element',\n properties: {\n title: schema.title,\n },\n children: schema.children.map((item) => {\n return parseSchema(item);\n })\n }\n}\n\n// form组件解析\nconst parseForm = (schema: FormSchema) => {\n const children: any[] = [] \n schema.fields.forEach((item) => {\n children.push(parseSchema(item, 'form'));\n });\n const actionChild = {\n tagName: 'div',\n type: 'element',\n properties: {\n class: 'hitl-btn-list',\n },\n children: schema.actions.map((item) => {\n return parseSchema(item, 'form');\n })\n }\n children.push(actionChild);\n return {\n tagName: 'ElForm',\n type: 'element',\n properties: {\n labelPosition: 'right',\n ...schema.properties,\n },\n children,\n }\n}\n\nconst parseInput = (schema: InputSchema, type?: ParentScopeType) => {\n return {\n tagName: 'ElInput',\n type: 'element',\n properties: schema.properties,\n parentScope: type,\n }\n}\n\nconst parseSelect = (schema: SelectSchema, type?: ParentScopeType) => {\n return {\n tagName: 'ElSelect',\n type: 'element',\n properties: schema.properties,\n parentScope: type,\n }\n}\n\nconst parseDate = (schema: DateTimePickerSchema, type?: ParentScopeType) => {\n return {\n tagName: 'ElDatePicker',\n type: 'element',\n properties: schema.properties,\n parentScope: type,\n }\n}\n\nconst parseButton = (schema: ButtonSchema, type?: ParentScopeType) => {\n return {\n tagName: 'ElButton',\n type: 'element',\n properties: {\n ...schema.properties,\n action: schema.action,\n payload: schema.payload,\n },\n // TODO 记录父级作用域,用于在form、table 组件中使用\n parentScope: type,\n children: schema.children?.map?.((item) => {\n return parseSchema(item, type);\n })\n }\n}\n\nconst parseCard = (schema: CardSchema) => {\n const result: any = {\n tagName: 'CoreCard',\n type: 'element',\n properties: schema.properties,\n children: schema.children.map((item) => {\n return parseSchema(item);\n })\n };\n \n // 处理 header 插槽\n if (schema.slots?.header) {\n result.slots = {\n header: schema.slots.header.map((item) => {\n return parseSchema(item);\n })\n };\n }\n \n return result;\n}\n\nconst parseTableColumn = (schema: TableColumnSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElTableColumn',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n children: schema.children?.map((item) => {\n return parseSchema(item, parentType);\n })\n }\n}\n\nconst parseTable = (schema: TableSchema) => {\n // 兼容旧版本不存在tableProps属性\n if (!schema.properties.tableProps) {\n schema.properties.tableProps = {\n data: [],\n ...schema.properties,\n };\n }\n return {\n tagName: 'ElTable',\n type: 'element',\n properties: schema.properties,\n children: schema.children.map((item) => {\n return parseSchema(item, 'table');\n })\n }\n}\n\n\nconst parseTips = (schema: TipsSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'CoreTips',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n }\n}\n\nconst parseText = (schema: TextSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'CoreText',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n }\n}\nconst injectFormProp = (schema: FormFieldSchema['children'], prop: string) => {\n return schema.map((item) => {\n return {\n ...item,\n properties: {\n ...item.properties,\n formProp: prop,\n },\n }\n })\n}\nconst parseFormItem = (schema: FormFieldSchema, parentType?: ParentScopeType) => {\n const prop = schema.properties.prop;\n const children = injectFormProp(schema.children, prop);\n const formatRules = (rules: FormFieldSchema['properties']['rules']) => {\n return rules?.map((item) => {\n if ('pattern' in item && item.pattern) {\n return {\n pattern: new RegExp(item.pattern),\n message: item.message,\n trigger: item.trigger,\n }\n }\n return item;\n })\n }\n return {\n tagName: 'ElFormItem',\n type: 'element',\n properties: {\n ...schema.properties,\n rules: formatRules(schema.properties.rules),\n },\n parentScope: parentType,\n children: [\n parseSchema(children[0] as InputSchema, parentType),\n ]\n }\n}\n\nconst parseRow = (schema: RowSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElRow',\n type: 'element',\n properties: schema.properties,\n children: schema.children.map((item) => {\n return parseSchema(item, parentType);\n })\n }\n}\n\nconst parseCol = (schema: ColSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElCol',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n children: schema.children.map((item) => {\n return parseSchema(item as ElementSchema, parentType);\n })\n }\n}\n\nconst parseRadioGroup = (schema: RadioGroupSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElRadioGroup',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n children: schema.properties.options?.map((item) => {\n return parseSchema({\n type: 'radio',\n properties: item,\n } as RadioSchema, parentType);\n })\n }\n}\n\nconst parseRadio = (schema: RadioSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElRadio',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n }\n}\n\nconst parseTag = (schema: TagSchema, parentType?: ParentScopeType) => {\n const formatSchema = {\n tagName: 'ElTag',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n children: schema.children.map((item) => {\n return parseSchema(item as TextSchema, parentType);\n })\n }\n if (parentType === 'table') {\n formatSchema.value = schema.value;\n }\n return formatSchema;\n}\n\n// ECharts 图表解析\nconst parseECharts = (schema: EChartsSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'CoreChart',\n type: 'element' as const,\n properties: schema.properties,\n parentScope: parentType,\n };\n}\n\nexport const parseCorePilot = (schema: ViewSchema<any>) => {\n return parseSchema(schema);\n}"],"names":["parseSchema","schema","type","parseView","parseForm","parseCard","parseTable","parseInput","parseSelect","parseDate","parseButton","parseTips","parseText","parseFormItem","parseTableColumn","parseRow","parseCol","parseResult","parseTag","parseRadioGroup","parseRadio","parseECharts","_","console","error","parentType","tagName","properties","parentScope","title","children","map","item","fields","forEach","push","actionChild","class","actions","labelPosition","action","payload","_b","_a","call","result","slots","header","tableProps","data","prop","formProp","injectFormProp","rules","pattern","RegExp","message","trigger","options","formatSchema","value"],"mappings":"gFA6CA,MAAMA,EAAc,CAACC,EAAuBC,KAC1C,OAAQD,EAAOC,MACb,IAAK,OACH,OAAOC,EAAUF,GACnB,IAAK,OACH,OAAOG,EAAUH,GACnB,IAAK,OACH,OAAOI,EAAUJ,GACnB,IAAK,QACH,OAAOK,EAAWL,GACpB,IAAK,QACH,OAAOM,EAAWN,EAAQC,GAC5B,IAAK,SACH,OAAOM,EAAYP,EAAQC,GAC7B,IAAK,iBACH,OAAOO,EAAUR,EAAQC,GAC3B,IAAK,SACH,OAAOQ,EAAYT,EAAQC,GAC7B,IAAK,OACH,OAAOS,EAAUV,EAAQC,GAC3B,IAAK,OACH,OAAOU,EAAUX,EAAQC,GAC3B,IAAK,YACH,OAAOW,EAAcZ,EAAQC,GAC/B,IAAK,SACH,OAAOY,EAAiBb,EAAQC,GAClC,IAAK,MACH,OAAOa,EAASd,EAAQC,GAC1B,IAAK,MACH,OAAOc,EAASf,EAAQC,GAC1B,IAAK,SACH,OAAOe,EAAYhB,EAAQC,GAC7B,IAAK,MACH,OAAOgB,EAASjB,EAAQC,GAC1B,IAAK,aACH,OAAOiB,EAAgBlB,EAAQC,GACjC,IAAK,QACH,OAAOkB,EAAWnB,EAAQC,GAC5B,IAAK,SACH,OAAOmB,EAAapB,EAAQC,GAC9B,QACE,MAAMoB,EAAWrB,EACjBsB,QAAQC,MAAMF,KAKdL,EAAc,CAAChB,EAAsBwB,KAClC,CACLC,QAAS,aACTxB,KAAM,UACNyB,WAAY1B,EAAO0B,WACnBC,YAAaH,IAKXtB,EAAaF,IACV,CACLyB,QAAS,OACTxB,KAAM,UACNyB,WAAY,CACVE,MAAO5B,EAAO4B,OAEhBC,SAAU7B,EAAO6B,SAASC,IAAKC,GACtBhC,EAAYgC,MAMnB5B,EAAaH,IACjB,MAAM6B,EAAkB,GACxB7B,EAAOgC,OAAOC,QAASF,IAC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gC,EAAMP,MAKzBT,EAAW,CAACf,EAAmBwB,KAC5B,CACLC,QAAS,QACTxB,KAAM,UACNyB,WAAY1B,EAAO0B,WACnBC,YAAaH,EACbK,SAAU7B,EAAO6B,SAASC,IAAKC,GACtBhC,EAAYgC,EAAuBP,MAK1CN,EAAkB,CAAClB,EAA0BwB,WACjD,MAAO,CACLC,QAAS,eACTxB,KAAM,UACNyB,WAAY1B,EAAO0B,WACnBC,YAAaH,EACbK,SAAU,OAAAa,EAAA1C,EAAO0B,WAAW+B,cAAlB,EAAAf,EAA2BZ,IAAKC,GACjChC,EAAY,CACjBE,KAAM,QACNyB,WAAYK,GACIP,MAKlBL,EAAa,CAACnB,EAAqBwB,KAChC,CACLC,QAAS,UACTxB,KAAM,UACNyB,WAAY1B,EAAO0B,WACnBC,YAAaH,IAIXP,EAAW,CAACjB,EAAmBwB,KACnC,MAAMkC,EAAe,CACnBjC,QAAS,QACTxB,KAAM,UACNyB,WAAY1B,EAAO0B,WACnBC,YAAaH,EACbK,SAAU7B,EAAO6B,SAASC,IAAKC,GACtBhC,EAAYgC,EAAoBP,KAM3C,MAHmB,UAAfA,IACFkC,EAAaC,MAAQ3D,EAAO2D,OAEvBD,GAIHtC,EAAe,CAACpB,EAAuBwB,KACpC,CACLC,QAAS,YACTxB,KAAM,UACNyB,WAAY1B,EAAO0B,WACnBC,YAAaH,2BAIcxB,GACtBD,EAAYC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./components/index.js"),r=require("./components/bubble-list/index.js"),o=require("./components/x-markdown/index.js"),s=require("./components/file-preview/index.js"),t=require("./components/editor-sender/index.js"),n=require("./components/file-card/index.js"),i=require("./components/core-text/index.js"),p=require("./components/core-tips/index.js"),x=require("./components/core-result/index.js"),c=require("./components/core-table/index.js"),d=require("./components/core-chart/index.js"),l=(r,o)=>{Object.keys(e).forEach(o=>{r.component(o,e[o])})},
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./components/index.js"),r=require("./components/bubble-list/index.js"),o=require("./components/x-markdown/index.js"),s=require("./components/file-preview/index.js"),t=require("./components/editor-sender/index.js"),n=require("./components/file-card/index.js"),i=require("./components/core-text/index.js"),p=require("./components/core-tips/index.js"),x=require("./components/core-result/index.js"),c=require("./components/core-table/index.js"),d=require("./components/core-chart/index.js"),u=require("./components/core-card/index.js"),l=require("./components/core-upload/index.js"),a=(r,o)=>{Object.keys(e).forEach(o=>{r.component(o,e[o])})},m={install:a};exports.BubbleList=r,exports.XMarkdown=o,exports.FilePreview=s,exports.EditorSender=t,exports.FileCard=n,exports.CoreText=i,exports.CoreTips=p,exports.CoreResult=x,exports.CoreTable=c,exports.CoreChart=d,exports.CoreCard=u,exports.CoreUpload=l,exports.default=m,exports.install=a;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { type Plugin } from 'vue';\nimport * as Components from './components';\n\nexport * from './components';\n\nexport const install: Plugin = (app, options) => {\n Object.keys(Components).forEach((name) => {\n app.component(name, Components[name]);\n });\n};\n\nexport default {\n install,\n} as Plugin;\n"],"names":["install","app","options","Object","keys","Components","forEach","name","component","index"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { type Plugin } from 'vue';\nimport * as Components from './components';\n\nexport * from './components';\n\nexport const install: Plugin = (app, options) => {\n Object.keys(Components).forEach((name) => {\n app.component(name, Components[name]);\n });\n};\n\nexport default {\n install,\n} as Plugin;\n"],"names":["install","app","options","Object","keys","Components","forEach","name","component","index"],"mappings":"isBAKaA,EAAkB,CAACC,EAAKC,KACnCC,OAAOC,KAAKC,GAAYC,QAASC,IAC/BN,EAAIO,UAAUD,EAAMF,EAAWE,OAInCE,EAAe,CACbT"}
|