@boteteam/utils 0.0.18 → 0.0.19
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/formatModule/formatModuleData.js +14 -3
- package/dist/cjs/formatModule/formatModuleData.js.map +2 -2
- package/dist/cjs/securityUtils.js +1 -1
- package/dist/cjs/securityUtils.js.map +2 -2
- package/dist/esm/formatModule/formatModuleData.js +17 -6
- package/dist/esm/formatModule/formatModuleData.js.map +1 -1
- package/dist/esm/securityUtils.js +1 -1
- package/dist/esm/securityUtils.js.map +1 -1
- package/dist/umd/index.min.js +1 -1
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +2 -2
|
@@ -78,6 +78,7 @@ var formatModuleData = ({
|
|
|
78
78
|
column,
|
|
79
79
|
articleContent,
|
|
80
80
|
eventFlag,
|
|
81
|
+
events,
|
|
81
82
|
...otherCompProps
|
|
82
83
|
// 无需处理的属性
|
|
83
84
|
} = compProps || {};
|
|
@@ -90,9 +91,6 @@ var formatModuleData = ({
|
|
|
90
91
|
if (otherCompProps == null ? void 0 : otherCompProps.title) {
|
|
91
92
|
moduleDataRes.compProps.title = (0, import_helpers.stringPramarsValTransition)(otherCompProps == null ? void 0 : otherCompProps.title, allParametrs);
|
|
92
93
|
}
|
|
93
|
-
if (eventFlag) {
|
|
94
|
-
moduleDataRes.compProps.eventFlag = { checked: true };
|
|
95
|
-
}
|
|
96
94
|
moduleDataRes.parentCompProps = (parentModuleData == null ? void 0 : parentModuleData.compProps) || {};
|
|
97
95
|
if (["panel", "div", "page"].indexOf(compType) >= 0 && Array.isArray(children) && children.length > 0) {
|
|
98
96
|
const childs = children.map((item) => {
|
|
@@ -107,6 +105,19 @@ var formatModuleData = ({
|
|
|
107
105
|
});
|
|
108
106
|
});
|
|
109
107
|
moduleDataRes.children = childs;
|
|
108
|
+
if (compType === "page") {
|
|
109
|
+
if (events && (events == null ? void 0 : events.length) > 0) {
|
|
110
|
+
const onLoadEvent = events.find(
|
|
111
|
+
(item) => (item == null ? void 0 : item.key) === "pageLoad"
|
|
112
|
+
);
|
|
113
|
+
if (onLoadEvent) {
|
|
114
|
+
moduleDataRes.compProps.onLoad = onLoadEvent == null ? void 0 : onLoadEvent.event;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (eventFlag) {
|
|
118
|
+
moduleDataRes.compProps.eventFlag = { checked: true };
|
|
119
|
+
}
|
|
120
|
+
}
|
|
110
121
|
} else {
|
|
111
122
|
if (otherCompProps && ((_a = Object == null ? void 0 : Object.keys(otherCompProps)) == null ? void 0 : _a.length) > 0) {
|
|
112
123
|
Object == null ? void 0 : Object.keys(otherCompProps).forEach((compPropKey) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/formatModule/formatModuleData.ts"],
|
|
4
|
-
"sourcesContent": ["import 'ses';\nimport { getDataArr } from '../treeUtils';\nimport {\n urlPrefix,\n formatListProps,\n formatTableProps,\n formatCarouselProps,\n formatImageProps,\n formatFormProps,\n formatHighCodeProps,\n formatDescriptionsProps,\n formatLoopProps,\n formatStyleProps,\n formatEchartLineProps,\n formatEchartPieProps,\n formatChartsProps,\n formatStepsProps,\n staticCodeAssemble,\n stringPramarsValTransition,\n} from './helpers';\n\ntype formatModuleProps = {\n moduleData: { [key: string]: any } | null; // 页面配置数据\n parentModuleData?: { [key: string]: any } | null; // 父级配置数据\n pageData?: { [key: string]: any } | null; // 页面组件数据\n parameters?: any; // 入参上下文\n loopItemData?: any; // 循环体数据\n staticCodeList?: { [key: string]: any } | null; // 静态资源数据\n disabled?: boolean;\n};\n\nconst formatModuleData = ({\n moduleData,\n parentModuleData,\n parameters,\n loopItemData,\n staticCodeList,\n disabled,\n pageData,\n}: formatModuleProps): { [key: string]: any } | null => {\n let moduleDataRes: { [key: string]: any } = { };\n const allParametrs:{ [key: string]: any } = {\n ...(parameters || {}),\n pageData: pageData || {},\n loopItem: loopItemData || {},\n }; // 把页面数据与入参组装到一起\n const {\n staticCodeMap,\n staticOptionsMap,\n } = staticCodeAssemble(staticCodeList);\n\n if (moduleData) {\n const {\n compProps,\n compType,\n children,\n moduleTitle,\n moduleDescribe,\n id,\n } = moduleData;\n // 组装静态数据映射\n moduleDataRes = {\n ...moduleData,\n key: id,\n disabled,\n compProps: {},\n originModule: moduleData, // 配置moduled的信息\n };\n const {\n itemLabel: listItemLabel,\n itemContent: listItemContent,\n itemDescribe: listItemDescribe,\n dataSource: compDataSource,\n columns: compColumns,\n tableBodyHeight,\n fileProps,\n attrs,\n rowSelection,\n hasSelectAll,\n rowKey,\n fieldName,\n column,\n articleContent,\n eventFlag,\n ...otherCompProps // 无需处理的属性\n } = compProps || {};\n if (moduleTitle) {\n moduleDataRes.moduleTitle = stringPramarsValTransition(moduleTitle, allParametrs);\n }\n if (moduleDescribe) {\n moduleDataRes.moduleDescribe = stringPramarsValTransition(moduleDescribe, allParametrs);\n }\n if (otherCompProps?.title) {\n moduleDataRes.compProps.title = stringPramarsValTransition(otherCompProps?.title, allParametrs);\n }\n if (eventFlag) {\n moduleDataRes.compProps.eventFlag = { checked: true };\n }\n \n moduleDataRes.parentCompProps = parentModuleData?.compProps || {};\n if (\n ['panel', 'div', 'page'].indexOf(compType) >= 0 &&\n Array.isArray(children) &&\n children.length > 0\n ) {\n const childs = children.map((item) => {\n return formatModuleData({\n moduleData: item,\n parentModuleData: moduleData,\n parameters,\n loopItemData,\n staticCodeList,\n disabled,\n pageData,\n });\n });\n moduleDataRes.children = childs;\n } else {\n if (otherCompProps && Object?.keys(otherCompProps)?.length > 0) {\n Object?.keys(otherCompProps).forEach(compPropKey => {\n if (otherCompProps?.[compPropKey] || typeof otherCompProps?.[compPropKey] === 'number') {\n moduleDataRes.compProps[compPropKey] = otherCompProps?.[compPropKey];\n }\n });\n }\n if (rowSelection) {\n moduleDataRes.compProps.rowSelection = rowSelection;\n if (hasSelectAll && rowSelection?.type === 'checkbox') {\n moduleDataRes.compProps.hasSelectAll = hasSelectAll;\n } else {\n delete moduleDataRes.compProps.hasSelectAll;\n }\n }\n const rowKeyIndexArr = getDataArr(rowKey);\n\n if (Array.isArray(rowKeyIndexArr) && rowKeyIndexArr.length > 0) {\n moduleDataRes.compProps.rowKey = rowKeyIndexArr.slice(-1)?.[0];\n }\n\n if (compType === 'typography') {\n if (articleContent) {\n moduleDataRes.compProps.articleContent = stringPramarsValTransition(articleContent, allParametrs);\n }\n }\n if (compType === 'iframe') {\n moduleDataRes.compProps.url = stringPramarsValTransition(\n otherCompProps?.url,\n allParametrs,\n );\n }\n\n if (compType === 'carousel' && compDataSource && compDataSource?.dataType) {\n const carouselProps = formatCarouselProps({\n options: {\n dataSource: compDataSource,\n },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...carouselProps,\n };\n }\n if (compType === 'image' && compDataSource && compDataSource?.dataType) {\n const imageProps = formatImageProps({\n options: {\n dataSource: compDataSource,\n },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...imageProps,\n };\n }\n\n if (compType === 'highCodeComp') {\n const highCodeCompProps = formatHighCodeProps({\n options: { fileProps },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...highCodeCompProps,\n };\n }\n\n if (compType === 'table') {\n const tableProps = formatTableProps({\n options: {\n ...otherCompProps,\n columns: compColumns,\n dataSource: compDataSource,\n attrs,\n tableBodyHeight,\n },\n staticCodeMap,\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...tableProps,\n };\n }\n if (compType === 'form') {\n const formProps = formatFormProps({\n options: {\n column,\n children,\n },\n parameters: allParametrs,\n staticCodeMap,\n staticOptionsMap,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...formProps,\n };\n }\n if (compType === 'descriptions') {\n const descriptionsProps = formatDescriptionsProps({\n options: {\n column,\n attrs,\n },\n parameters: allParametrs,\n staticCodeMap,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...descriptionsProps,\n };\n }\n if (compType === 'loop') {\n const loopProps = formatLoopProps({\n options: {\n dataSource: compDataSource,\n },\n parameters: allParametrs,\n staticCodeMap,\n });\n const loopChilds:({[key:string]:any}|null)[] = [];\n if (\n Array.isArray(loopProps?.dataSource) && loopProps?.dataSource?.length > 0 &&\n Array.isArray(children) && children.length > 0\n ) {\n loopProps?.dataSource.forEach((dataItem) => {\n const dataItemKey = moduleDataRes?.compProps?.rowKey && dataItem?.[moduleDataRes?.compProps?.rowKey] ?\n dataItem?.[moduleDataRes?.compProps?.rowKey] : '';\n loopChilds.push({\n id: dataItemKey,\n key: dataItemKey,\n compType: 'loopItem',\n compProps: {},\n originItem: dataItem,\n children: children.map((item:{[key:string]:any}) => {\n const loopChildInfo = formatModuleData({\n moduleData: item,\n parentModuleData: moduleData,\n loopItemData: typeof dataItem === 'object' ? dataItem : { item: dataItem },\n parameters,\n staticCodeList,\n disabled,\n pageData,\n });\n return loopChildInfo;\n }),\n });\n });\n } else if (Array.isArray(children) && children.length > 0) {\n loopChilds.push({\n id: '1',\n key: '1',\n compType: 'loopItem',\n compProps: {},\n originItem: {},\n children: children.map((item:{[key:string]:any}) => {\n const loopChildInfo = formatModuleData({\n moduleData: item,\n parentModuleData: moduleData,\n loopItemData: {},\n parameters,\n staticCodeList,\n disabled,\n pageData,\n });\n return loopChildInfo;\n }),\n });\n }\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...loopProps,\n column,\n children: loopChilds,\n };\n }\n if (['list', 'card', 'recommendList'].includes(compType)) {\n const resProps = formatListProps({\n options: {\n ...otherCompProps,\n rowKey,\n rowSelection,\n attrs,\n itemLabel: listItemLabel,\n itemContent: listItemContent,\n itemDescribe: listItemDescribe,\n dataSource: compDataSource,\n },\n urlPrefix,\n staticCodeMap,\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...resProps,\n };\n }\n if (['echartBar', 'echartLine'].includes(compType)) {\n const echartProps = formatEchartLineProps({\n options: { ...otherCompProps, dataSource: compDataSource },\n parameters: allParametrs,\n });\n\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...echartProps,\n };\n }\n if (compType === 'echartPie') {\n const echartProps = formatEchartPieProps({\n options: {\n dataSource: compDataSource,\n ...otherCompProps,\n },\n parameters: allParametrs,\n });\n\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...echartProps,\n };\n }\n if (compType === 'charts') {\n const chartsProps = formatChartsProps({\n options: {\n echartsOptions: compProps?.echartsOptions,\n },\n parameters: allParametrs,\n });\n\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...chartsProps,\n };\n }\n }\n if (compType === 'steps') {\n const stepsProps = formatStepsProps({\n options: {\n dataSource: compDataSource,\n ...otherCompProps,\n },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...stepsProps,\n };\n }\n moduleDataRes.compProps.style = formatStyleProps(moduleData, parentModuleData);\n // 所有的模版 拼一个组装数据的key值\n if (moduleData?.compProps && fieldName) {\n moduleDataRes.compProps.fieldName = fieldName;\n }\n }\n\n return moduleDataRes;\n};\n\nexport default formatModuleData;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAO;AACP,uBAA2B;AAC3B,qBAiBO;AAYP,IAAM,mBAAmB,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAwD;AAvCxD;AAwCE,MAAI,gBAAwC,CAAE;AAC9C,QAAM,eAAsC;AAAA,IAC1C,GAAI,cAAc,CAAC;AAAA,IACnB,UAAU,YAAY,CAAC;AAAA,IACvB,UAAU,gBAAgB,CAAC;AAAA,EAC7B;AACA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,QAAI,mCAAmB,cAAc;AAErC,MAAI,YAAY;AACd,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,IAAI;AAEJ,oBAAgB;AAAA,MACd,GAAG;AAAA,MACH,KAAK;AAAA,MACL;AAAA,MACA,WAAW,CAAC;AAAA,MACZ,cAAc;AAAA;AAAA,IAChB;AACA,UAAM;AAAA,MACJ,WAAW;AAAA,MACX,aAAa;AAAA,MACb,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA;AAAA,IACL,IAAI,aAAa,CAAC;AAClB,QAAI,aAAa;AACf,oBAAc,kBAAc,2CAA2B,aAAa,YAAY;AAAA,IAClF;AACA,QAAI,gBAAgB;AAClB,oBAAc,qBAAiB,2CAA2B,gBAAgB,YAAY;AAAA,IACxF;AACA,QAAI,iDAAgB,OAAO;AACzB,oBAAc,UAAU,YAAQ,2CAA2B,iDAAgB,OAAO,YAAY;AAAA,IAChG;
|
|
4
|
+
"sourcesContent": ["import 'ses';\nimport { getDataArr } from '../treeUtils';\nimport {\n urlPrefix,\n formatListProps,\n formatTableProps,\n formatCarouselProps,\n formatImageProps,\n formatFormProps,\n formatHighCodeProps,\n formatDescriptionsProps,\n formatLoopProps,\n formatStyleProps,\n formatEchartLineProps,\n formatEchartPieProps,\n formatChartsProps,\n formatStepsProps,\n staticCodeAssemble,\n stringPramarsValTransition,\n} from './helpers';\n\ntype formatModuleProps = {\n moduleData: { [key: string]: any } | null; // 页面配置数据\n parentModuleData?: { [key: string]: any } | null; // 父级配置数据\n pageData?: { [key: string]: any } | null; // 页面组件数据\n parameters?: any; // 入参上下文\n loopItemData?: any; // 循环体数据\n staticCodeList?: { [key: string]: any } | null; // 静态资源数据\n disabled?: boolean;\n};\n\nconst formatModuleData = ({\n moduleData,\n parentModuleData,\n parameters,\n loopItemData,\n staticCodeList,\n disabled,\n pageData,\n}: formatModuleProps): { [key: string]: any } | null => {\n let moduleDataRes: { [key: string]: any } = { };\n const allParametrs:{ [key: string]: any } = {\n ...(parameters || {}),\n pageData: pageData || {},\n loopItem: loopItemData || {},\n }; // 把页面数据与入参组装到一起\n const {\n staticCodeMap,\n staticOptionsMap,\n } = staticCodeAssemble(staticCodeList);\n\n if (moduleData) {\n const {\n compProps,\n compType,\n children,\n moduleTitle,\n moduleDescribe,\n id,\n } = moduleData;\n // 组装静态数据映射\n moduleDataRes = {\n ...moduleData,\n key: id,\n disabled,\n compProps: {},\n originModule: moduleData, // 配置moduled的信息\n };\n const {\n itemLabel: listItemLabel,\n itemContent: listItemContent,\n itemDescribe: listItemDescribe,\n dataSource: compDataSource,\n columns: compColumns,\n tableBodyHeight,\n fileProps,\n attrs,\n rowSelection,\n hasSelectAll,\n rowKey,\n fieldName,\n column,\n articleContent,\n eventFlag,\n events,\n ...otherCompProps // 无需处理的属性\n } = compProps || {};\n if (moduleTitle) {\n moduleDataRes.moduleTitle = stringPramarsValTransition(moduleTitle, allParametrs);\n }\n if (moduleDescribe) {\n moduleDataRes.moduleDescribe = stringPramarsValTransition(moduleDescribe, allParametrs);\n }\n if (otherCompProps?.title) {\n moduleDataRes.compProps.title = stringPramarsValTransition(otherCompProps?.title, allParametrs);\n }\n \n moduleDataRes.parentCompProps = parentModuleData?.compProps || {};\n if (\n ['panel', 'div', 'page'].indexOf(compType) >= 0 &&\n Array.isArray(children) &&\n children.length > 0\n ) {\n const childs = children.map((item) => {\n return formatModuleData({\n moduleData: item,\n parentModuleData: moduleData,\n parameters,\n loopItemData,\n staticCodeList,\n disabled,\n pageData,\n });\n });\n moduleDataRes.children = childs;\n if (compType === 'page') {\n if (events && events?.length > 0) {\n const onLoadEvent = events.find(\n (item: any) => item?.key === 'pageLoad',\n );\n if (onLoadEvent) {\n moduleDataRes.compProps.onLoad = onLoadEvent?.event;\n }\n }\n if (eventFlag) {\n moduleDataRes.compProps.eventFlag = { checked: true };\n }\n }\n } else {\n if (otherCompProps && Object?.keys(otherCompProps)?.length > 0) {\n Object?.keys(otherCompProps).forEach(compPropKey => {\n if (otherCompProps?.[compPropKey] || typeof otherCompProps?.[compPropKey] === 'number') {\n moduleDataRes.compProps[compPropKey] = otherCompProps?.[compPropKey];\n }\n });\n }\n if (rowSelection) {\n moduleDataRes.compProps.rowSelection = rowSelection;\n if (hasSelectAll && rowSelection?.type === 'checkbox') {\n moduleDataRes.compProps.hasSelectAll = hasSelectAll;\n } else {\n delete moduleDataRes.compProps.hasSelectAll;\n }\n }\n const rowKeyIndexArr = getDataArr(rowKey);\n\n if (Array.isArray(rowKeyIndexArr) && rowKeyIndexArr.length > 0) {\n moduleDataRes.compProps.rowKey = rowKeyIndexArr.slice(-1)?.[0];\n }\n\n if (compType === 'typography') {\n if (articleContent) {\n moduleDataRes.compProps.articleContent = stringPramarsValTransition(articleContent, allParametrs);\n }\n }\n if (compType === 'iframe') {\n moduleDataRes.compProps.url = stringPramarsValTransition(\n otherCompProps?.url,\n allParametrs,\n );\n }\n\n if (compType === 'carousel' && compDataSource && compDataSource?.dataType) {\n const carouselProps = formatCarouselProps({\n options: {\n dataSource: compDataSource,\n },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...carouselProps,\n };\n }\n if (compType === 'image' && compDataSource && compDataSource?.dataType) {\n const imageProps = formatImageProps({\n options: {\n dataSource: compDataSource,\n },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...imageProps,\n };\n }\n\n if (compType === 'highCodeComp') {\n const highCodeCompProps = formatHighCodeProps({\n options: { fileProps },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...highCodeCompProps,\n };\n }\n\n if (compType === 'table') {\n const tableProps = formatTableProps({\n options: {\n ...otherCompProps,\n columns: compColumns,\n dataSource: compDataSource,\n attrs,\n tableBodyHeight,\n },\n staticCodeMap,\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...tableProps,\n };\n }\n if (compType === 'form') {\n const formProps = formatFormProps({\n options: {\n column,\n children,\n },\n parameters: allParametrs,\n staticCodeMap,\n staticOptionsMap,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...formProps,\n };\n }\n if (compType === 'descriptions') {\n const descriptionsProps = formatDescriptionsProps({\n options: {\n column,\n attrs,\n },\n parameters: allParametrs,\n staticCodeMap,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...descriptionsProps,\n };\n }\n if (compType === 'loop') {\n const loopProps = formatLoopProps({\n options: {\n dataSource: compDataSource,\n },\n parameters: allParametrs,\n staticCodeMap,\n });\n const loopChilds:({[key:string]:any}|null)[] = [];\n if (\n Array.isArray(loopProps?.dataSource) && loopProps?.dataSource?.length > 0 &&\n Array.isArray(children) && children.length > 0\n ) {\n loopProps?.dataSource.forEach((dataItem) => {\n const dataItemKey = moduleDataRes?.compProps?.rowKey && dataItem?.[moduleDataRes?.compProps?.rowKey] ?\n dataItem?.[moduleDataRes?.compProps?.rowKey] : '';\n loopChilds.push({\n id: dataItemKey,\n key: dataItemKey,\n compType: 'loopItem',\n compProps: {},\n originItem: dataItem,\n children: children.map((item:{[key:string]:any}) => {\n const loopChildInfo = formatModuleData({\n moduleData: item,\n parentModuleData: moduleData,\n loopItemData: typeof dataItem === 'object' ? dataItem : { item: dataItem },\n parameters,\n staticCodeList,\n disabled,\n pageData,\n });\n return loopChildInfo;\n }),\n });\n });\n } else if (Array.isArray(children) && children.length > 0) {\n loopChilds.push({\n id: '1',\n key: '1',\n compType: 'loopItem',\n compProps: {},\n originItem: {},\n children: children.map((item:{[key:string]:any}) => {\n const loopChildInfo = formatModuleData({\n moduleData: item,\n parentModuleData: moduleData,\n loopItemData: {},\n parameters,\n staticCodeList,\n disabled,\n pageData,\n });\n return loopChildInfo;\n }),\n });\n }\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...loopProps,\n column,\n children: loopChilds,\n };\n }\n if (['list', 'card', 'recommendList'].includes(compType)) {\n const resProps = formatListProps({\n options: {\n ...otherCompProps,\n rowKey,\n rowSelection,\n attrs,\n itemLabel: listItemLabel,\n itemContent: listItemContent,\n itemDescribe: listItemDescribe,\n dataSource: compDataSource,\n },\n urlPrefix,\n staticCodeMap,\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...resProps,\n };\n }\n if (['echartBar', 'echartLine'].includes(compType)) {\n const echartProps = formatEchartLineProps({\n options: { ...otherCompProps, dataSource: compDataSource },\n parameters: allParametrs,\n });\n\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...echartProps,\n };\n }\n if (compType === 'echartPie') {\n const echartProps = formatEchartPieProps({\n options: {\n dataSource: compDataSource,\n ...otherCompProps,\n },\n parameters: allParametrs,\n });\n\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...echartProps,\n };\n }\n if (compType === 'charts') {\n const chartsProps = formatChartsProps({\n options: {\n echartsOptions: compProps?.echartsOptions,\n },\n parameters: allParametrs,\n });\n\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...chartsProps,\n };\n }\n }\n if (compType === 'steps') {\n const stepsProps = formatStepsProps({\n options: {\n dataSource: compDataSource,\n ...otherCompProps,\n },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...stepsProps,\n };\n }\n moduleDataRes.compProps.style = formatStyleProps(moduleData, parentModuleData);\n // 所有的模版 拼一个组装数据的key值\n if (moduleData?.compProps && fieldName) {\n moduleDataRes.compProps.fieldName = fieldName;\n }\n }\n\n return moduleDataRes;\n};\n\nexport default formatModuleData;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAO;AACP,uBAA2B;AAC3B,qBAiBO;AAYP,IAAM,mBAAmB,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAwD;AAvCxD;AAwCE,MAAI,gBAAwC,CAAE;AAC9C,QAAM,eAAsC;AAAA,IAC1C,GAAI,cAAc,CAAC;AAAA,IACnB,UAAU,YAAY,CAAC;AAAA,IACvB,UAAU,gBAAgB,CAAC;AAAA,EAC7B;AACA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,QAAI,mCAAmB,cAAc;AAErC,MAAI,YAAY;AACd,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,IAAI;AAEJ,oBAAgB;AAAA,MACd,GAAG;AAAA,MACH,KAAK;AAAA,MACL;AAAA,MACA,WAAW,CAAC;AAAA,MACZ,cAAc;AAAA;AAAA,IAChB;AACA,UAAM;AAAA,MACJ,WAAW;AAAA,MACX,aAAa;AAAA,MACb,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA;AAAA,IACL,IAAI,aAAa,CAAC;AAClB,QAAI,aAAa;AACf,oBAAc,kBAAc,2CAA2B,aAAa,YAAY;AAAA,IAClF;AACA,QAAI,gBAAgB;AAClB,oBAAc,qBAAiB,2CAA2B,gBAAgB,YAAY;AAAA,IACxF;AACA,QAAI,iDAAgB,OAAO;AACzB,oBAAc,UAAU,YAAQ,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|
"version": 3,
|
|
3
3
|
"sources": ["../../src/securityUtils.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * 安全工具函数,用于防止XSS等安全漏洞\n */\n\n/**\n * 验证URL是否安全,防止XSS攻击\n * @param url 待验证的URL\n * @returns 是否为安全的URL\n */\nexport const isValidUrl = (url: string): boolean => {\n if (!url || typeof url !== 'string') {\n return false;\n }\n\n try {\n const urlObj = new URL(url, window.location.origin);\n \n // 只允许http和https协议,防止javascript:等危险协议\n if (!['http:', 'https:'].includes(urlObj.protocol)) {\n return false;\n }\n\n // 检查是否包含危险字符\n const dangerousPatterns = [\n /javascript:/i,\n /vbscript:/i,\n /data:/i,\n /file:/i,\n /<script/i,\n /onload=/i,\n /onerror=/i,\n /onclick=/i,\n ];\n\n return !dangerousPatterns.some(pattern => pattern.test(url));\n } catch {\n return false;\n }\n};\n\n/**\n * 清理和验证重定向URL,确保安全\n * @param url 待清理的URL\n * @param allowedDomains 允许的域名列表,为空时允许同源URL\n * @returns 清理后的安全URL,如果不安全则返回默认URL\n */\nexport const sanitizeRedirectUrl = (\n url: string,\n allowedDomains: string[] = [],\n defaultUrl: string = '/'\n): string => {\n if (!url || typeof url !== 'string') {\n return defaultUrl;\n }\n\n // 基本URL验证\n if (!isValidUrl(url)) {\n return defaultUrl;\n }\n\n try {\n const urlObj = new URL(url, window.location.origin);\n const currentHost = window.location.hostname;\n\n // 如果没有指定允许的域名,只允许同源URL\n if (allowedDomains.length === 0) {\n if (urlObj.hostname !== currentHost) {\n return defaultUrl;\n }\n } else {\n // 检查是否在允许的域名列表中\n const isAllowedDomain = allowedDomains.some(domain =>\n urlObj.hostname === domain || urlObj.hostname.endsWith(`.${domain}`)\n );\n \n if (!isAllowedDomain && urlObj.hostname !== currentHost) {\n return defaultUrl;\n }\n }\n\n return urlObj.
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,aAAa,CAAC,QAAyB;AAClD,MAAI,CAAC,OAAO,OAAO,QAAQ,UAAU;AACnC,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,SAAS,IAAI,IAAI,KAAK,OAAO,SAAS,MAAM;AAGlD,QAAI,CAAC,CAAC,SAAS,QAAQ,EAAE,SAAS,OAAO,QAAQ,GAAG;AAClD,aAAO;AAAA,IACT;AAGA,UAAM,oBAAoB;AAAA,MACxB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAEA,WAAO,CAAC,kBAAkB,KAAK,aAAW,QAAQ,KAAK,GAAG,CAAC;AAAA,EAC7D,QAAE;AACA,WAAO;AAAA,EACT;AACF;AAQO,IAAM,sBAAsB,CACjC,KACA,iBAA2B,CAAC,GAC5B,aAAqB,QACV;AACX,MAAI,CAAC,OAAO,OAAO,QAAQ,UAAU;AACnC,WAAO;AAAA,EACT;AAGA,MAAI,CAAC,WAAW,GAAG,GAAG;AACpB,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,SAAS,IAAI,IAAI,KAAK,OAAO,SAAS,MAAM;AAClD,UAAM,cAAc,OAAO,SAAS;AAGpC,QAAI,eAAe,WAAW,GAAG;AAC/B,UAAI,OAAO,aAAa,aAAa;AACnC,eAAO;AAAA,MACT;AAAA,IACF,OAAO;AAEL,YAAM,kBAAkB,eAAe;AAAA,QAAK,YAC1C,OAAO,aAAa,UAAU,OAAO,SAAS,SAAS,IAAI,QAAQ;AAAA,MACrE;AAEA,UAAI,CAAC,mBAAmB,OAAO,aAAa,aAAa;AACvD,eAAO;AAAA,MACT;AAAA,IACF;AAEA,WAAO,OAAO,
|
|
4
|
+
"sourcesContent": ["/**\n * 安全工具函数,用于防止XSS等安全漏洞\n */\n\n/**\n * 验证URL是否安全,防止XSS攻击\n * @param url 待验证的URL\n * @returns 是否为安全的URL\n */\nexport const isValidUrl = (url: string): boolean => {\n if (!url || typeof url !== 'string') {\n return false;\n }\n\n try {\n const urlObj = new URL(url, window.location.origin);\n \n // 只允许http和https协议,防止javascript:等危险协议\n if (!['http:', 'https:'].includes(urlObj.protocol)) {\n return false;\n }\n\n // 检查是否包含危险字符\n const dangerousPatterns = [\n /javascript:/i,\n /vbscript:/i,\n /data:/i,\n /file:/i,\n /<script/i,\n /onload=/i,\n /onerror=/i,\n /onclick=/i,\n ];\n\n return !dangerousPatterns.some(pattern => pattern.test(url));\n } catch {\n return false;\n }\n};\n\n/**\n * 清理和验证重定向URL,确保安全\n * @param url 待清理的URL\n * @param allowedDomains 允许的域名列表,为空时允许同源URL\n * @returns 清理后的安全URL,如果不安全则返回默认URL\n */\nexport const sanitizeRedirectUrl = (\n url: string,\n allowedDomains: string[] = [],\n defaultUrl: string = '/'\n): string => {\n if (!url || typeof url !== 'string') {\n return defaultUrl;\n }\n\n // 基本URL验证\n if (!isValidUrl(url)) {\n return defaultUrl;\n }\n\n try {\n const urlObj = new URL(url, window.location.origin);\n const currentHost = window.location.hostname;\n\n // 如果没有指定允许的域名,只允许同源URL\n if (allowedDomains.length === 0) {\n if (urlObj.hostname !== currentHost) {\n return defaultUrl;\n }\n } else {\n // 检查是否在允许的域名列表中\n const isAllowedDomain = allowedDomains.some(domain =>\n urlObj.hostname === domain || urlObj.hostname.endsWith(`.${domain}`)\n );\n \n if (!isAllowedDomain && urlObj.hostname !== currentHost) {\n return defaultUrl;\n }\n }\n\n return urlObj.pathname + urlObj.search;\n } catch {\n return defaultUrl;\n }\n};\n\n/**\n * 安全地设置window.location.href,防止XSS攻击\n * @param url 目标URL\n * @param allowedDomains 允许的域名列表\n */\nexport const safeRedirect = (url: string, allowedDomains: string[] = []): void => {\n const safeUrl = sanitizeRedirectUrl(url, allowedDomains);\n window.location.href = safeUrl;\n};\n\n/**\n * 验证和清理事件处理器,防止恶意代码注入\n * @param handler 事件处理函数\n * @returns 安全的事件处理函数\n */\nexport const sanitizeEventHandler = (handler: Function): Function => {\n if (typeof handler !== 'function') {\n return () => {};\n }\n \n return (...args: any[]) => {\n try {\n handler(...args);\n } catch (error) {\n console.error('Event handler error:', error);\n }\n };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,aAAa,CAAC,QAAyB;AAClD,MAAI,CAAC,OAAO,OAAO,QAAQ,UAAU;AACnC,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,SAAS,IAAI,IAAI,KAAK,OAAO,SAAS,MAAM;AAGlD,QAAI,CAAC,CAAC,SAAS,QAAQ,EAAE,SAAS,OAAO,QAAQ,GAAG;AAClD,aAAO;AAAA,IACT;AAGA,UAAM,oBAAoB;AAAA,MACxB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAEA,WAAO,CAAC,kBAAkB,KAAK,aAAW,QAAQ,KAAK,GAAG,CAAC;AAAA,EAC7D,QAAE;AACA,WAAO;AAAA,EACT;AACF;AAQO,IAAM,sBAAsB,CACjC,KACA,iBAA2B,CAAC,GAC5B,aAAqB,QACV;AACX,MAAI,CAAC,OAAO,OAAO,QAAQ,UAAU;AACnC,WAAO;AAAA,EACT;AAGA,MAAI,CAAC,WAAW,GAAG,GAAG;AACpB,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,SAAS,IAAI,IAAI,KAAK,OAAO,SAAS,MAAM;AAClD,UAAM,cAAc,OAAO,SAAS;AAGpC,QAAI,eAAe,WAAW,GAAG;AAC/B,UAAI,OAAO,aAAa,aAAa;AACnC,eAAO;AAAA,MACT;AAAA,IACF,OAAO;AAEL,YAAM,kBAAkB,eAAe;AAAA,QAAK,YAC1C,OAAO,aAAa,UAAU,OAAO,SAAS,SAAS,IAAI,QAAQ;AAAA,MACrE;AAEA,UAAI,CAAC,mBAAmB,OAAO,aAAa,aAAa;AACvD,eAAO;AAAA,MACT;AAAA,IACF;AAEA,WAAO,OAAO,WAAW,OAAO;AAAA,EAClC,QAAE;AACA,WAAO;AAAA,EACT;AACF;AAOO,IAAM,eAAe,CAAC,KAAa,iBAA2B,CAAC,MAAY;AAChF,QAAM,UAAU,oBAAoB,KAAK,cAAc;AACvD,SAAO,SAAS,OAAO;AACzB;AAOO,IAAM,uBAAuB,CAAC,YAAgC;AACnE,MAAI,OAAO,YAAY,YAAY;AACjC,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AAEA,SAAO,IAAI,SAAgB;AACzB,QAAI;AACF,cAAQ,GAAG,IAAI;AAAA,IACjB,SAAS,OAAP;AACA,cAAQ,MAAM,wBAAwB,KAAK;AAAA,IAC7C;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["itemLabel", "itemContent", "itemDescribe", "dataSource", "columns", "tableBodyHeight", "fileProps", "attrs", "rowSelection", "hasSelectAll", "rowKey", "fieldName", "column", "articleContent", "eventFlag"];
|
|
1
|
+
var _excluded = ["itemLabel", "itemContent", "itemDescribe", "dataSource", "columns", "tableBodyHeight", "fileProps", "attrs", "rowSelection", "hasSelectAll", "rowKey", "fieldName", "column", "articleContent", "eventFlag", "events"];
|
|
2
2
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
3
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
4
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -56,6 +56,7 @@ var formatModuleData = function formatModuleData(_ref) {
|
|
|
56
56
|
column = _ref2.column,
|
|
57
57
|
articleContent = _ref2.articleContent,
|
|
58
58
|
eventFlag = _ref2.eventFlag,
|
|
59
|
+
events = _ref2.events,
|
|
59
60
|
otherCompProps = _objectWithoutProperties(_ref2, _excluded);
|
|
60
61
|
if (moduleTitle) {
|
|
61
62
|
moduleDataRes.moduleTitle = stringPramarsValTransition(moduleTitle, allParametrs);
|
|
@@ -66,11 +67,6 @@ var formatModuleData = function formatModuleData(_ref) {
|
|
|
66
67
|
if (otherCompProps !== null && otherCompProps !== void 0 && otherCompProps.title) {
|
|
67
68
|
moduleDataRes.compProps.title = stringPramarsValTransition(otherCompProps === null || otherCompProps === void 0 ? void 0 : otherCompProps.title, allParametrs);
|
|
68
69
|
}
|
|
69
|
-
if (eventFlag) {
|
|
70
|
-
moduleDataRes.compProps.eventFlag = {
|
|
71
|
-
checked: true
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
70
|
moduleDataRes.parentCompProps = (parentModuleData === null || parentModuleData === void 0 ? void 0 : parentModuleData.compProps) || {};
|
|
75
71
|
if (['panel', 'div', 'page'].indexOf(compType) >= 0 && Array.isArray(children) && children.length > 0) {
|
|
76
72
|
var childs = children.map(function (item) {
|
|
@@ -85,6 +81,21 @@ var formatModuleData = function formatModuleData(_ref) {
|
|
|
85
81
|
});
|
|
86
82
|
});
|
|
87
83
|
moduleDataRes.children = childs;
|
|
84
|
+
if (compType === 'page') {
|
|
85
|
+
if (events && (events === null || events === void 0 ? void 0 : events.length) > 0) {
|
|
86
|
+
var onLoadEvent = events.find(function (item) {
|
|
87
|
+
return (item === null || item === void 0 ? void 0 : item.key) === 'pageLoad';
|
|
88
|
+
});
|
|
89
|
+
if (onLoadEvent) {
|
|
90
|
+
moduleDataRes.compProps.onLoad = onLoadEvent === null || onLoadEvent === void 0 ? void 0 : onLoadEvent.event;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (eventFlag) {
|
|
94
|
+
moduleDataRes.compProps.eventFlag = {
|
|
95
|
+
checked: true
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
88
99
|
} else {
|
|
89
100
|
var _Object$keys;
|
|
90
101
|
if (otherCompProps && (Object === null || Object === void 0 || (_Object$keys = Object.keys(otherCompProps)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length) > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getDataArr","urlPrefix","formatListProps","formatTableProps","formatCarouselProps","formatImageProps","formatFormProps","formatHighCodeProps","formatDescriptionsProps","formatLoopProps","formatStyleProps","formatEchartLineProps","formatEchartPieProps","formatChartsProps","formatStepsProps","staticCodeAssemble","stringPramarsValTransition","formatModuleData","_ref","moduleData","parentModuleData","parameters","loopItemData","staticCodeList","disabled","pageData","moduleDataRes","allParametrs","_objectSpread","loopItem","_staticCodeAssemble","staticCodeMap","staticOptionsMap","compProps","compType","children","moduleTitle","moduleDescribe","id","key","originModule","_ref2","listItemLabel","itemLabel","listItemContent","itemContent","listItemDescribe","itemDescribe","compDataSource","dataSource","compColumns","columns","tableBodyHeight","fileProps","attrs","rowSelection","hasSelectAll","rowKey","fieldName","column","articleContent","eventFlag","otherCompProps","_objectWithoutProperties","_excluded","title","checked","parentCompProps","indexOf","Array","isArray","length","childs","map","item","_Object$keys","Object","keys","forEach","compPropKey","type","rowKeyIndexArr","_rowKeyIndexArr$slice","slice","url","dataType","_moduleDataRes","carouselProps","options","_moduleDataRes2","imageProps","_moduleDataRes3","highCodeCompProps","_moduleDataRes4","tableProps","_moduleDataRes5","formProps","_moduleDataRes6","descriptionsProps","_loopProps$dataSource","_moduleDataRes10","loopProps","loopChilds","dataItem","_moduleDataRes7","_moduleDataRes8","_moduleDataRes9","dataItemKey","push","originItem","loopChildInfo","_typeof","includes","resProps","echartProps","chartsProps","echartsOptions","stepsProps","style"],"sources":["../../../src/formatModule/formatModuleData.ts"],"sourcesContent":["import 'ses';\nimport { getDataArr } from '../treeUtils';\nimport {\n urlPrefix,\n formatListProps,\n formatTableProps,\n formatCarouselProps,\n formatImageProps,\n formatFormProps,\n formatHighCodeProps,\n formatDescriptionsProps,\n formatLoopProps,\n formatStyleProps,\n formatEchartLineProps,\n formatEchartPieProps,\n formatChartsProps,\n formatStepsProps,\n staticCodeAssemble,\n stringPramarsValTransition,\n} from './helpers';\n\ntype formatModuleProps = {\n moduleData: { [key: string]: any } | null; // 页面配置数据\n parentModuleData?: { [key: string]: any } | null; // 父级配置数据\n pageData?: { [key: string]: any } | null; // 页面组件数据\n parameters?: any; // 入参上下文\n loopItemData?: any; // 循环体数据\n staticCodeList?: { [key: string]: any } | null; // 静态资源数据\n disabled?: boolean;\n};\n\nconst formatModuleData = ({\n moduleData,\n parentModuleData,\n parameters,\n loopItemData,\n staticCodeList,\n disabled,\n pageData,\n}: formatModuleProps): { [key: string]: any } | null => {\n let moduleDataRes: { [key: string]: any } = { };\n const allParametrs:{ [key: string]: any } = {\n ...(parameters || {}),\n pageData: pageData || {},\n loopItem: loopItemData || {},\n }; // 把页面数据与入参组装到一起\n const {\n staticCodeMap,\n staticOptionsMap,\n } = staticCodeAssemble(staticCodeList);\n\n if (moduleData) {\n const {\n compProps,\n compType,\n children,\n moduleTitle,\n moduleDescribe,\n id,\n } = moduleData;\n // 组装静态数据映射\n moduleDataRes = {\n ...moduleData,\n key: id,\n disabled,\n compProps: {},\n originModule: moduleData, // 配置moduled的信息\n };\n const {\n itemLabel: listItemLabel,\n itemContent: listItemContent,\n itemDescribe: listItemDescribe,\n dataSource: compDataSource,\n columns: compColumns,\n tableBodyHeight,\n fileProps,\n attrs,\n rowSelection,\n hasSelectAll,\n rowKey,\n fieldName,\n column,\n articleContent,\n eventFlag,\n ...otherCompProps // 无需处理的属性\n } = compProps || {};\n if (moduleTitle) {\n moduleDataRes.moduleTitle = stringPramarsValTransition(moduleTitle, allParametrs);\n }\n if (moduleDescribe) {\n moduleDataRes.moduleDescribe = stringPramarsValTransition(moduleDescribe, allParametrs);\n }\n if (otherCompProps?.title) {\n moduleDataRes.compProps.title = stringPramarsValTransition(otherCompProps?.title, allParametrs);\n }\n if (eventFlag) {\n moduleDataRes.compProps.eventFlag = { checked: true };\n }\n \n moduleDataRes.parentCompProps = parentModuleData?.compProps || {};\n if (\n ['panel', 'div', 'page'].indexOf(compType) >= 0 &&\n Array.isArray(children) &&\n children.length > 0\n ) {\n const childs = children.map((item) => {\n return formatModuleData({\n moduleData: item,\n parentModuleData: moduleData,\n parameters,\n loopItemData,\n staticCodeList,\n disabled,\n pageData,\n });\n });\n moduleDataRes.children = childs;\n } else {\n if (otherCompProps && Object?.keys(otherCompProps)?.length > 0) {\n Object?.keys(otherCompProps).forEach(compPropKey => {\n if (otherCompProps?.[compPropKey] || typeof otherCompProps?.[compPropKey] === 'number') {\n moduleDataRes.compProps[compPropKey] = otherCompProps?.[compPropKey];\n }\n });\n }\n if (rowSelection) {\n moduleDataRes.compProps.rowSelection = rowSelection;\n if (hasSelectAll && rowSelection?.type === 'checkbox') {\n moduleDataRes.compProps.hasSelectAll = hasSelectAll;\n } else {\n delete moduleDataRes.compProps.hasSelectAll;\n }\n }\n const rowKeyIndexArr = getDataArr(rowKey);\n\n if (Array.isArray(rowKeyIndexArr) && rowKeyIndexArr.length > 0) {\n moduleDataRes.compProps.rowKey = rowKeyIndexArr.slice(-1)?.[0];\n }\n\n if (compType === 'typography') {\n if (articleContent) {\n moduleDataRes.compProps.articleContent = stringPramarsValTransition(articleContent, allParametrs);\n }\n }\n if (compType === 'iframe') {\n moduleDataRes.compProps.url = stringPramarsValTransition(\n otherCompProps?.url,\n allParametrs,\n );\n }\n\n if (compType === 'carousel' && compDataSource && compDataSource?.dataType) {\n const carouselProps = formatCarouselProps({\n options: {\n dataSource: compDataSource,\n },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...carouselProps,\n };\n }\n if (compType === 'image' && compDataSource && compDataSource?.dataType) {\n const imageProps = formatImageProps({\n options: {\n dataSource: compDataSource,\n },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...imageProps,\n };\n }\n\n if (compType === 'highCodeComp') {\n const highCodeCompProps = formatHighCodeProps({\n options: { fileProps },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...highCodeCompProps,\n };\n }\n\n if (compType === 'table') {\n const tableProps = formatTableProps({\n options: {\n ...otherCompProps,\n columns: compColumns,\n dataSource: compDataSource,\n attrs,\n tableBodyHeight,\n },\n staticCodeMap,\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...tableProps,\n };\n }\n if (compType === 'form') {\n const formProps = formatFormProps({\n options: {\n column,\n children,\n },\n parameters: allParametrs,\n staticCodeMap,\n staticOptionsMap,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...formProps,\n };\n }\n if (compType === 'descriptions') {\n const descriptionsProps = formatDescriptionsProps({\n options: {\n column,\n attrs,\n },\n parameters: allParametrs,\n staticCodeMap,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...descriptionsProps,\n };\n }\n if (compType === 'loop') {\n const loopProps = formatLoopProps({\n options: {\n dataSource: compDataSource,\n },\n parameters: allParametrs,\n staticCodeMap,\n });\n const loopChilds:({[key:string]:any}|null)[] = [];\n if (\n Array.isArray(loopProps?.dataSource) && loopProps?.dataSource?.length > 0 &&\n Array.isArray(children) && children.length > 0\n ) {\n loopProps?.dataSource.forEach((dataItem) => {\n const dataItemKey = moduleDataRes?.compProps?.rowKey && dataItem?.[moduleDataRes?.compProps?.rowKey] ?\n dataItem?.[moduleDataRes?.compProps?.rowKey] : '';\n loopChilds.push({\n id: dataItemKey,\n key: dataItemKey,\n compType: 'loopItem',\n compProps: {},\n originItem: dataItem,\n children: children.map((item:{[key:string]:any}) => {\n const loopChildInfo = formatModuleData({\n moduleData: item,\n parentModuleData: moduleData,\n loopItemData: typeof dataItem === 'object' ? dataItem : { item: dataItem },\n parameters,\n staticCodeList,\n disabled,\n pageData,\n });\n return loopChildInfo;\n }),\n });\n });\n } else if (Array.isArray(children) && children.length > 0) {\n loopChilds.push({\n id: '1',\n key: '1',\n compType: 'loopItem',\n compProps: {},\n originItem: {},\n children: children.map((item:{[key:string]:any}) => {\n const loopChildInfo = formatModuleData({\n moduleData: item,\n parentModuleData: moduleData,\n loopItemData: {},\n parameters,\n staticCodeList,\n disabled,\n pageData,\n });\n return loopChildInfo;\n }),\n });\n }\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...loopProps,\n column,\n children: loopChilds,\n };\n }\n if (['list', 'card', 'recommendList'].includes(compType)) {\n const resProps = formatListProps({\n options: {\n ...otherCompProps,\n rowKey,\n rowSelection,\n attrs,\n itemLabel: listItemLabel,\n itemContent: listItemContent,\n itemDescribe: listItemDescribe,\n dataSource: compDataSource,\n },\n urlPrefix,\n staticCodeMap,\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...resProps,\n };\n }\n if (['echartBar', 'echartLine'].includes(compType)) {\n const echartProps = formatEchartLineProps({\n options: { ...otherCompProps, dataSource: compDataSource },\n parameters: allParametrs,\n });\n\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...echartProps,\n };\n }\n if (compType === 'echartPie') {\n const echartProps = formatEchartPieProps({\n options: {\n dataSource: compDataSource,\n ...otherCompProps,\n },\n parameters: allParametrs,\n });\n\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...echartProps,\n };\n }\n if (compType === 'charts') {\n const chartsProps = formatChartsProps({\n options: {\n echartsOptions: compProps?.echartsOptions,\n },\n parameters: allParametrs,\n });\n\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...chartsProps,\n };\n }\n }\n if (compType === 'steps') {\n const stepsProps = formatStepsProps({\n options: {\n dataSource: compDataSource,\n ...otherCompProps,\n },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...stepsProps,\n };\n }\n moduleDataRes.compProps.style = formatStyleProps(moduleData, parentModuleData);\n // 所有的模版 拼一个组装数据的key值\n if (moduleData?.compProps && fieldName) {\n moduleDataRes.compProps.fieldName = fieldName;\n }\n }\n\n return moduleDataRes;\n};\n\nexport default formatModuleData;\n"],"mappings":";;;;;;;;;AAAA,OAAO,KAAK;AACZ,SAASA,UAAU;AACnB,SACEC,SAAS,EACTC,eAAe,EACfC,gBAAgB,EAChBC,mBAAmB,EACnBC,gBAAgB,EAChBC,eAAe,EACfC,mBAAmB,EACnBC,uBAAuB,EACvBC,eAAe,EACfC,gBAAgB,EAChBC,qBAAqB,EACrBC,oBAAoB,EACpBC,iBAAiB,EACjBC,gBAAgB,EAChBC,kBAAkB,EAClBC,0BAA0B;AAa5B,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAQkC;EAAA,IAPtDC,UAAU,GAAAD,IAAA,CAAVC,UAAU;IACVC,gBAAgB,GAAAF,IAAA,CAAhBE,gBAAgB;IAChBC,UAAU,GAAAH,IAAA,CAAVG,UAAU;IACVC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;IACZC,cAAc,GAAAL,IAAA,CAAdK,cAAc;IACdC,QAAQ,GAAAN,IAAA,CAARM,QAAQ;IACRC,QAAQ,GAAAP,IAAA,CAARO,QAAQ;EAER,IAAIC,aAAqC,GAAG,CAAE,CAAC;EAC/C,IAAMC,YAAmC,GAAAC,aAAA,CAAAA,aAAA,K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,aAAa,CAACO,SAAS,GAAAL,aAAA,CAAAA,aAAA,KACjBF,aAAa,CAACO,SAAS,IAAI,CAAC,CAAC,GAC9BkF,WAAW,CACf;MACH;IACF;IACA,IAAIjF,QAAQ,KAAK,OAAO,EAAE;MACxB,IAAMmF,UAAU,GAAGvG,gBAAgB,CAAC;QAClC0E,OAAO,EAAA5D,aAAA;UACLqB,UAAU,EAAED;QAAc,GACvBc,cAAc,CAClB;QACDzC,UAAU,EAAEM;MACd,CAAC,CAAC;MACFD,aAAa,CAACO,SAAS,GAAAL,aAAA,CAAAA,aAAA,KACjBF,aAAa,CAACO,SAAS,IAAI,CAAC,CAAC,GAC9BoF,UAAU,CACd;IACH;IACA3F,aAAa,CAACO,SAAS,CAACqF,KAAK,GAAG5G,gBAAgB,CAACS,UAAU,EAAEC,gBAAgB,CAAC;IAC9E;IACA,IAAID,UAAU,aAAVA,UAAU,eAAVA,UAAU,CAAEc,SAAS,IAAIyB,SAAS,EAAE;MACtChC,aAAa,CAACO,SAAS,CAACyB,SAAS,GAAGA,SAAS;IAC/C;EACF;EAEA,OAAOhC,aAAa;AACtB,CAAC;AAED,eAAeT,gBAAgB"}
|
|
1
|
+
{"version":3,"names":["getDataArr","urlPrefix","formatListProps","formatTableProps","formatCarouselProps","formatImageProps","formatFormProps","formatHighCodeProps","formatDescriptionsProps","formatLoopProps","formatStyleProps","formatEchartLineProps","formatEchartPieProps","formatChartsProps","formatStepsProps","staticCodeAssemble","stringPramarsValTransition","formatModuleData","_ref","moduleData","parentModuleData","parameters","loopItemData","staticCodeList","disabled","pageData","moduleDataRes","allParametrs","_objectSpread","loopItem","_staticCodeAssemble","staticCodeMap","staticOptionsMap","compProps","compType","children","moduleTitle","moduleDescribe","id","key","originModule","_ref2","listItemLabel","itemLabel","listItemContent","itemContent","listItemDescribe","itemDescribe","compDataSource","dataSource","compColumns","columns","tableBodyHeight","fileProps","attrs","rowSelection","hasSelectAll","rowKey","fieldName","column","articleContent","eventFlag","events","otherCompProps","_objectWithoutProperties","_excluded","title","parentCompProps","indexOf","Array","isArray","length","childs","map","item","onLoadEvent","find","onLoad","event","checked","_Object$keys","Object","keys","forEach","compPropKey","type","rowKeyIndexArr","_rowKeyIndexArr$slice","slice","url","dataType","_moduleDataRes","carouselProps","options","_moduleDataRes2","imageProps","_moduleDataRes3","highCodeCompProps","_moduleDataRes4","tableProps","_moduleDataRes5","formProps","_moduleDataRes6","descriptionsProps","_loopProps$dataSource","_moduleDataRes10","loopProps","loopChilds","dataItem","_moduleDataRes7","_moduleDataRes8","_moduleDataRes9","dataItemKey","push","originItem","loopChildInfo","_typeof","includes","resProps","echartProps","chartsProps","echartsOptions","stepsProps","style"],"sources":["../../../src/formatModule/formatModuleData.ts"],"sourcesContent":["import 'ses';\nimport { getDataArr } from '../treeUtils';\nimport {\n urlPrefix,\n formatListProps,\n formatTableProps,\n formatCarouselProps,\n formatImageProps,\n formatFormProps,\n formatHighCodeProps,\n formatDescriptionsProps,\n formatLoopProps,\n formatStyleProps,\n formatEchartLineProps,\n formatEchartPieProps,\n formatChartsProps,\n formatStepsProps,\n staticCodeAssemble,\n stringPramarsValTransition,\n} from './helpers';\n\ntype formatModuleProps = {\n moduleData: { [key: string]: any } | null; // 页面配置数据\n parentModuleData?: { [key: string]: any } | null; // 父级配置数据\n pageData?: { [key: string]: any } | null; // 页面组件数据\n parameters?: any; // 入参上下文\n loopItemData?: any; // 循环体数据\n staticCodeList?: { [key: string]: any } | null; // 静态资源数据\n disabled?: boolean;\n};\n\nconst formatModuleData = ({\n moduleData,\n parentModuleData,\n parameters,\n loopItemData,\n staticCodeList,\n disabled,\n pageData,\n}: formatModuleProps): { [key: string]: any } | null => {\n let moduleDataRes: { [key: string]: any } = { };\n const allParametrs:{ [key: string]: any } = {\n ...(parameters || {}),\n pageData: pageData || {},\n loopItem: loopItemData || {},\n }; // 把页面数据与入参组装到一起\n const {\n staticCodeMap,\n staticOptionsMap,\n } = staticCodeAssemble(staticCodeList);\n\n if (moduleData) {\n const {\n compProps,\n compType,\n children,\n moduleTitle,\n moduleDescribe,\n id,\n } = moduleData;\n // 组装静态数据映射\n moduleDataRes = {\n ...moduleData,\n key: id,\n disabled,\n compProps: {},\n originModule: moduleData, // 配置moduled的信息\n };\n const {\n itemLabel: listItemLabel,\n itemContent: listItemContent,\n itemDescribe: listItemDescribe,\n dataSource: compDataSource,\n columns: compColumns,\n tableBodyHeight,\n fileProps,\n attrs,\n rowSelection,\n hasSelectAll,\n rowKey,\n fieldName,\n column,\n articleContent,\n eventFlag,\n events,\n ...otherCompProps // 无需处理的属性\n } = compProps || {};\n if (moduleTitle) {\n moduleDataRes.moduleTitle = stringPramarsValTransition(moduleTitle, allParametrs);\n }\n if (moduleDescribe) {\n moduleDataRes.moduleDescribe = stringPramarsValTransition(moduleDescribe, allParametrs);\n }\n if (otherCompProps?.title) {\n moduleDataRes.compProps.title = stringPramarsValTransition(otherCompProps?.title, allParametrs);\n }\n \n moduleDataRes.parentCompProps = parentModuleData?.compProps || {};\n if (\n ['panel', 'div', 'page'].indexOf(compType) >= 0 &&\n Array.isArray(children) &&\n children.length > 0\n ) {\n const childs = children.map((item) => {\n return formatModuleData({\n moduleData: item,\n parentModuleData: moduleData,\n parameters,\n loopItemData,\n staticCodeList,\n disabled,\n pageData,\n });\n });\n moduleDataRes.children = childs;\n if (compType === 'page') {\n if (events && events?.length > 0) {\n const onLoadEvent = events.find(\n (item: any) => item?.key === 'pageLoad',\n );\n if (onLoadEvent) {\n moduleDataRes.compProps.onLoad = onLoadEvent?.event;\n }\n }\n if (eventFlag) {\n moduleDataRes.compProps.eventFlag = { checked: true };\n }\n }\n } else {\n if (otherCompProps && Object?.keys(otherCompProps)?.length > 0) {\n Object?.keys(otherCompProps).forEach(compPropKey => {\n if (otherCompProps?.[compPropKey] || typeof otherCompProps?.[compPropKey] === 'number') {\n moduleDataRes.compProps[compPropKey] = otherCompProps?.[compPropKey];\n }\n });\n }\n if (rowSelection) {\n moduleDataRes.compProps.rowSelection = rowSelection;\n if (hasSelectAll && rowSelection?.type === 'checkbox') {\n moduleDataRes.compProps.hasSelectAll = hasSelectAll;\n } else {\n delete moduleDataRes.compProps.hasSelectAll;\n }\n }\n const rowKeyIndexArr = getDataArr(rowKey);\n\n if (Array.isArray(rowKeyIndexArr) && rowKeyIndexArr.length > 0) {\n moduleDataRes.compProps.rowKey = rowKeyIndexArr.slice(-1)?.[0];\n }\n\n if (compType === 'typography') {\n if (articleContent) {\n moduleDataRes.compProps.articleContent = stringPramarsValTransition(articleContent, allParametrs);\n }\n }\n if (compType === 'iframe') {\n moduleDataRes.compProps.url = stringPramarsValTransition(\n otherCompProps?.url,\n allParametrs,\n );\n }\n\n if (compType === 'carousel' && compDataSource && compDataSource?.dataType) {\n const carouselProps = formatCarouselProps({\n options: {\n dataSource: compDataSource,\n },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...carouselProps,\n };\n }\n if (compType === 'image' && compDataSource && compDataSource?.dataType) {\n const imageProps = formatImageProps({\n options: {\n dataSource: compDataSource,\n },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...imageProps,\n };\n }\n\n if (compType === 'highCodeComp') {\n const highCodeCompProps = formatHighCodeProps({\n options: { fileProps },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...highCodeCompProps,\n };\n }\n\n if (compType === 'table') {\n const tableProps = formatTableProps({\n options: {\n ...otherCompProps,\n columns: compColumns,\n dataSource: compDataSource,\n attrs,\n tableBodyHeight,\n },\n staticCodeMap,\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...tableProps,\n };\n }\n if (compType === 'form') {\n const formProps = formatFormProps({\n options: {\n column,\n children,\n },\n parameters: allParametrs,\n staticCodeMap,\n staticOptionsMap,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...formProps,\n };\n }\n if (compType === 'descriptions') {\n const descriptionsProps = formatDescriptionsProps({\n options: {\n column,\n attrs,\n },\n parameters: allParametrs,\n staticCodeMap,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...descriptionsProps,\n };\n }\n if (compType === 'loop') {\n const loopProps = formatLoopProps({\n options: {\n dataSource: compDataSource,\n },\n parameters: allParametrs,\n staticCodeMap,\n });\n const loopChilds:({[key:string]:any}|null)[] = [];\n if (\n Array.isArray(loopProps?.dataSource) && loopProps?.dataSource?.length > 0 &&\n Array.isArray(children) && children.length > 0\n ) {\n loopProps?.dataSource.forEach((dataItem) => {\n const dataItemKey = moduleDataRes?.compProps?.rowKey && dataItem?.[moduleDataRes?.compProps?.rowKey] ?\n dataItem?.[moduleDataRes?.compProps?.rowKey] : '';\n loopChilds.push({\n id: dataItemKey,\n key: dataItemKey,\n compType: 'loopItem',\n compProps: {},\n originItem: dataItem,\n children: children.map((item:{[key:string]:any}) => {\n const loopChildInfo = formatModuleData({\n moduleData: item,\n parentModuleData: moduleData,\n loopItemData: typeof dataItem === 'object' ? dataItem : { item: dataItem },\n parameters,\n staticCodeList,\n disabled,\n pageData,\n });\n return loopChildInfo;\n }),\n });\n });\n } else if (Array.isArray(children) && children.length > 0) {\n loopChilds.push({\n id: '1',\n key: '1',\n compType: 'loopItem',\n compProps: {},\n originItem: {},\n children: children.map((item:{[key:string]:any}) => {\n const loopChildInfo = formatModuleData({\n moduleData: item,\n parentModuleData: moduleData,\n loopItemData: {},\n parameters,\n staticCodeList,\n disabled,\n pageData,\n });\n return loopChildInfo;\n }),\n });\n }\n moduleDataRes.compProps = {\n ...(moduleDataRes?.compProps || {}),\n ...loopProps,\n column,\n children: loopChilds,\n };\n }\n if (['list', 'card', 'recommendList'].includes(compType)) {\n const resProps = formatListProps({\n options: {\n ...otherCompProps,\n rowKey,\n rowSelection,\n attrs,\n itemLabel: listItemLabel,\n itemContent: listItemContent,\n itemDescribe: listItemDescribe,\n dataSource: compDataSource,\n },\n urlPrefix,\n staticCodeMap,\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...resProps,\n };\n }\n if (['echartBar', 'echartLine'].includes(compType)) {\n const echartProps = formatEchartLineProps({\n options: { ...otherCompProps, dataSource: compDataSource },\n parameters: allParametrs,\n });\n\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...echartProps,\n };\n }\n if (compType === 'echartPie') {\n const echartProps = formatEchartPieProps({\n options: {\n dataSource: compDataSource,\n ...otherCompProps,\n },\n parameters: allParametrs,\n });\n\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...echartProps,\n };\n }\n if (compType === 'charts') {\n const chartsProps = formatChartsProps({\n options: {\n echartsOptions: compProps?.echartsOptions,\n },\n parameters: allParametrs,\n });\n\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...chartsProps,\n };\n }\n }\n if (compType === 'steps') {\n const stepsProps = formatStepsProps({\n options: {\n dataSource: compDataSource,\n ...otherCompProps,\n },\n parameters: allParametrs,\n });\n moduleDataRes.compProps = {\n ...(moduleDataRes.compProps || {}),\n ...stepsProps,\n };\n }\n moduleDataRes.compProps.style = formatStyleProps(moduleData, parentModuleData);\n // 所有的模版 拼一个组装数据的key值\n if (moduleData?.compProps && fieldName) {\n moduleDataRes.compProps.fieldName = fieldName;\n }\n }\n\n return moduleDataRes;\n};\n\nexport default formatModuleData;\n"],"mappings":";;;;;;;;;AAAA,OAAO,KAAK;AACZ,SAASA,UAAU;AACnB,SACEC,SAAS,EACTC,eAAe,EACfC,gBAAgB,EAChBC,mBAAmB,EACnBC,gBAAgB,EAChBC,eAAe,EACfC,mBAAmB,EACnBC,uBAAuB,EACvBC,eAAe,EACfC,gBAAgB,EAChBC,qBAAqB,EACrBC,oBAAoB,EACpBC,iBAAiB,EACjBC,gBAAgB,EAChBC,kBAAkB,EAClBC,0BAA0B;AAa5B,IAAMC,gBA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AAL,aAAA,CAAAA,aAAA,KACjBF,aAAa,CAACO,SAAS,IAAI,CAAC,CAAC,GAC9ByF,UAAU,CACd;IACH;IACAhG,aAAa,CAACO,SAAS,CAAC0F,KAAK,GAAGjH,gBAAgB,CAACS,UAAU,EAAEC,gBAAgB,CAAC;IAC9E;IACA,IAAID,UAAU,aAAVA,UAAU,eAAVA,UAAU,CAAEc,SAAS,IAAIyB,SAAS,EAAE;MACtChC,aAAa,CAACO,SAAS,CAACyB,SAAS,GAAGA,SAAS;IAC/C;EACF;EAEA,OAAOhC,aAAa;AACtB,CAAC;AAED,eAAeT,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isValidUrl","url","urlObj","URL","window","location","origin","includes","protocol","dangerousPatterns","some","pattern","test","_unused","sanitizeRedirectUrl","allowedDomains","arguments","length","undefined","defaultUrl","currentHost","hostname","isAllowedDomain","domain","endsWith","concat","
|
|
1
|
+
{"version":3,"names":["isValidUrl","url","urlObj","URL","window","location","origin","includes","protocol","dangerousPatterns","some","pattern","test","_unused","sanitizeRedirectUrl","allowedDomains","arguments","length","undefined","defaultUrl","currentHost","hostname","isAllowedDomain","domain","endsWith","concat","pathname","search","_unused2","safeRedirect","safeUrl","href","sanitizeEventHandler","handler","apply","error","console"],"sources":["../../src/securityUtils.ts"],"sourcesContent":["/**\n * 安全工具函数,用于防止XSS等安全漏洞\n */\n\n/**\n * 验证URL是否安全,防止XSS攻击\n * @param url 待验证的URL\n * @returns 是否为安全的URL\n */\nexport const isValidUrl = (url: string): boolean => {\n if (!url || typeof url !== 'string') {\n return false;\n }\n\n try {\n const urlObj = new URL(url, window.location.origin);\n \n // 只允许http和https协议,防止javascript:等危险协议\n if (!['http:', 'https:'].includes(urlObj.protocol)) {\n return false;\n }\n\n // 检查是否包含危险字符\n const dangerousPatterns = [\n /javascript:/i,\n /vbscript:/i,\n /data:/i,\n /file:/i,\n /<script/i,\n /onload=/i,\n /onerror=/i,\n /onclick=/i,\n ];\n\n return !dangerousPatterns.some(pattern => pattern.test(url));\n } catch {\n return false;\n }\n};\n\n/**\n * 清理和验证重定向URL,确保安全\n * @param url 待清理的URL\n * @param allowedDomains 允许的域名列表,为空时允许同源URL\n * @returns 清理后的安全URL,如果不安全则返回默认URL\n */\nexport const sanitizeRedirectUrl = (\n url: string,\n allowedDomains: string[] = [],\n defaultUrl: string = '/'\n): string => {\n if (!url || typeof url !== 'string') {\n return defaultUrl;\n }\n\n // 基本URL验证\n if (!isValidUrl(url)) {\n return defaultUrl;\n }\n\n try {\n const urlObj = new URL(url, window.location.origin);\n const currentHost = window.location.hostname;\n\n // 如果没有指定允许的域名,只允许同源URL\n if (allowedDomains.length === 0) {\n if (urlObj.hostname !== currentHost) {\n return defaultUrl;\n }\n } else {\n // 检查是否在允许的域名列表中\n const isAllowedDomain = allowedDomains.some(domain =>\n urlObj.hostname === domain || urlObj.hostname.endsWith(`.${domain}`)\n );\n \n if (!isAllowedDomain && urlObj.hostname !== currentHost) {\n return defaultUrl;\n }\n }\n\n return urlObj.pathname + urlObj.search;\n } catch {\n return defaultUrl;\n }\n};\n\n/**\n * 安全地设置window.location.href,防止XSS攻击\n * @param url 目标URL\n * @param allowedDomains 允许的域名列表\n */\nexport const safeRedirect = (url: string, allowedDomains: string[] = []): void => {\n const safeUrl = sanitizeRedirectUrl(url, allowedDomains);\n window.location.href = safeUrl;\n};\n\n/**\n * 验证和清理事件处理器,防止恶意代码注入\n * @param handler 事件处理函数\n * @returns 安全的事件处理函数\n */\nexport const sanitizeEventHandler = (handler: Function): Function => {\n if (typeof handler !== 'function') {\n return () => {};\n }\n \n return (...args: any[]) => {\n try {\n handler(...args);\n } catch (error) {\n console.error('Event handler error:', error);\n }\n };\n};\n"],"mappings":"AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,GAAW,EAAc;EAClD,IAAI,CAACA,GAAG,IAAI,OAAOA,GAAG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