@boteteam/utils 0.0.15 → 0.0.18
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/file.js +10 -1
- package/dist/cjs/file.js.map +2 -2
- package/dist/cjs/formatModule/formatModuleData.js +31 -1
- package/dist/cjs/formatModule/formatModuleData.js.map +2 -2
- package/dist/cjs/formatModule/helpers/formatChartsProps.d.ts +13 -0
- package/dist/cjs/formatModule/helpers/formatChartsProps.js +48 -0
- package/dist/cjs/formatModule/helpers/formatChartsProps.js.map +7 -0
- package/dist/cjs/formatModule/helpers/formatFormProps.js +20 -27
- package/dist/cjs/formatModule/helpers/formatFormProps.js.map +2 -2
- package/dist/cjs/formatModule/helpers/formatStepsProps.d.ts +23 -0
- package/dist/cjs/formatModule/helpers/formatStepsProps.js +88 -0
- package/dist/cjs/formatModule/helpers/formatStepsProps.js.map +7 -0
- package/dist/cjs/formatModule/helpers/formatTableProps.d.ts +11 -0
- package/dist/cjs/formatModule/helpers/formatTableProps.js +76 -6
- package/dist/cjs/formatModule/helpers/formatTableProps.js.map +2 -2
- package/dist/cjs/formatModule/helpers/index.d.ts +3 -1
- package/dist/cjs/formatModule/helpers/index.js +6 -0
- package/dist/cjs/formatModule/helpers/index.js.map +3 -3
- package/dist/cjs/formatModule/helpers/stringPramarsValTransition.d.ts +1 -1
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +9 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/securityUtils.d.ts +28 -0
- package/dist/cjs/securityUtils.js +103 -0
- package/dist/cjs/securityUtils.js.map +7 -0
- package/dist/cjs/treeUtils.d.ts +1 -1
- package/dist/cjs/treeUtils.js +4 -1
- package/dist/cjs/treeUtils.js.map +2 -2
- package/dist/esm/file.js +10 -3
- package/dist/esm/file.js.map +1 -1
- package/dist/esm/formatModule/formatModuleData.js +27 -7
- package/dist/esm/formatModule/formatModuleData.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatChartsProps.d.ts +13 -0
- package/dist/esm/formatModule/helpers/formatChartsProps.js +12 -0
- package/dist/esm/formatModule/helpers/formatChartsProps.js.map +1 -0
- package/dist/esm/formatModule/helpers/formatFormProps.js +25 -32
- package/dist/esm/formatModule/helpers/formatFormProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatStepsProps.d.ts +23 -0
- package/dist/esm/formatModule/helpers/formatStepsProps.js +58 -0
- package/dist/esm/formatModule/helpers/formatStepsProps.js.map +1 -0
- package/dist/esm/formatModule/helpers/formatTableProps.d.ts +11 -0
- package/dist/esm/formatModule/helpers/formatTableProps.js +73 -6
- package/dist/esm/formatModule/helpers/formatTableProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/index.d.ts +3 -1
- package/dist/esm/formatModule/helpers/index.js +3 -1
- package/dist/esm/formatModule/helpers/index.js.map +1 -1
- package/dist/esm/formatModule/helpers/stringPramarsValTransition.d.ts +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/securityUtils.d.ts +28 -0
- package/dist/esm/securityUtils.js +101 -0
- package/dist/esm/securityUtils.js.map +1 -0
- package/dist/esm/treeUtils.d.ts +1 -1
- package/dist/esm/treeUtils.js +5 -0
- package/dist/esm/treeUtils.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
package/dist/cjs/file.js
CHANGED
|
@@ -42,8 +42,17 @@ var getFileUrlById = (fileId, {
|
|
|
42
42
|
isSecurity = true,
|
|
43
43
|
params
|
|
44
44
|
} = {}) => {
|
|
45
|
+
var _a;
|
|
45
46
|
const baseUrl = prefix ? prefix.replace(/\/$/, "") : DEFAULT_PREFIX;
|
|
46
|
-
const
|
|
47
|
+
const token = ((_a = (0, import_pathArgsUtils.getSearchObj)()) == null ? void 0 : _a.token) || "";
|
|
48
|
+
const queryParams = {
|
|
49
|
+
fileId,
|
|
50
|
+
...params
|
|
51
|
+
};
|
|
52
|
+
if (token) {
|
|
53
|
+
queryParams.token = token;
|
|
54
|
+
}
|
|
55
|
+
const query = (0, import_pathArgsUtils.argsToString)(queryParams);
|
|
47
56
|
const url = `${baseUrl}/file/download?${query}`;
|
|
48
57
|
return isSecurity ? import_security.default.autoSecurityWithUrl(url) : url;
|
|
49
58
|
};
|
package/dist/cjs/file.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/file.ts"],
|
|
4
|
-
"sourcesContent": ["import security from '@lingxiteam/security';\nimport { argsToString } from './pathArgsUtils';\n\n// 暂时放到utils中,后续考虑独立在@boteteam/service包\n\nconst DEFAULT_PREFIX = `${process.env.REACT_APP_REQ_PREFIX}/bote`;\n\n/**\n * 根据文件ID生成文件URL地址\n * @param fileId 文件ID\n * @param options 配置选项\n * @param options.prefix 自定义请求前缀(默认使用环境变量配置)\n * @param options.isSecurity 是否启用安全处理(默认true), 将对url地址参数加密或加签\n * @param options.params 自定义参数,将添加到query参数中\n * @returns 文件URL地址\n */\nexport const getFileUrlById = (\n fileId: string,\n {\n prefix,\n isSecurity = true,\n params,\n }: {\n prefix?: string;\n isSecurity?: boolean;\n params?: Record<string, any>;\n } = {},\n) => {\n const baseUrl = prefix ? prefix.replace(/\\/$/, '') : DEFAULT_PREFIX;\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAqB;AACrB,
|
|
4
|
+
"sourcesContent": ["import security from '@lingxiteam/security';\nimport { argsToString, getSearchObj } from './pathArgsUtils';\n\n// 暂时放到utils中,后续考虑独立在@boteteam/service包\n\nconst DEFAULT_PREFIX = `${process.env.REACT_APP_REQ_PREFIX}/bote`;\n\n/**\n * 根据文件ID生成文件URL地址\n * @param fileId 文件ID\n * @param options 配置选项\n * @param options.prefix 自定义请求前缀(默认使用环境变量配置)\n * @param options.isSecurity 是否启用安全处理(默认true), 将对url地址参数加密或加签\n * @param options.params 自定义参数,将添加到query参数中\n * @returns 文件URL地址\n */\nexport const getFileUrlById = (\n fileId: string,\n {\n prefix,\n isSecurity = true,\n params,\n }: {\n prefix?: string;\n isSecurity?: boolean;\n params?: Record<string, any>;\n } = {},\n) => {\n const baseUrl = prefix ? prefix.replace(/\\/$/, '') : DEFAULT_PREFIX;\n // 如果url中存在token,则把token添加到query参数中\n const token = getSearchObj()?.token || '';\n const queryParams:{[key:string]:any} = {\n fileId,\n ...params,\n };\n if (token) {\n queryParams.token = token;\n }\n const query = argsToString(queryParams);\n const url = `${baseUrl}/file/download?${query}`;\n return isSecurity ? security.autoSecurityWithUrl(url) : url;\n};\n\nconst getRemoteComponentUrl = ({\n prefix,\n isSecurity = true,\n params = {},\n}: {\n prefix?: string;\n isSecurity?: boolean;\n params?: Record<string, any>;\n} = {}) => {\n const baseUrl = prefix ? prefix.replace(/\\/$/, '') : DEFAULT_PREFIX;\n const query = argsToString(params);\n const url = `${baseUrl}/manager/skill/page/getRemoteComponent?${query}`;\n return isSecurity ? security.autoSecurityWithUrl(url) : url;\n};\n\n/**\n * 根据页面编码生成远程组件URL地址\n * @param pageCode 页面编码\n * @param options 配置选项\n * @param options.prefix 自定义请求前缀(默认使用环境变量配置)\n * @param options.isSecurity 是否启用安全处理(默认true), 将对url地址参数加密或加签\n * @param options.params 自定义参数,将添加到query参数中\n * @returns 文件URL地址\n */\nexport const getRemoteComponentUrlByCode = (\n pageCode: string,\n options: Parameters<typeof getRemoteComponentUrl>[0],\n) => {\n return getRemoteComponentUrl({\n ...options,\n params: { pageCode, ...options?.params },\n });\n};\n\n/**\n * 根据文件ID生成远程组件URL地址\n * @param fileInfoId 文件ID\n * @param options 配置选项\n * @param options.prefix 自定义请求前缀(默认使用环境变量配置)\n * @param options.isSecurity 是否启用安全处理(默认true), 将对url地址参数加密或加签\n * @param options.params 自定义参数,将添加到query参数中\n * @returns 文件URL地址\n */\nexport const getRemoteComponentUrlById = (\n fileInfoId: string,\n options: Parameters<typeof getRemoteComponentUrl>[0],\n) => {\n return getRemoteComponentUrl({\n ...options,\n params: { fileInfoId, ...options?.params },\n });\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAqB;AACrB,2BAA2C;AAI3C,IAAM,iBAAiB,GAAG,QAAQ,IAAI;AAW/B,IAAM,iBAAiB,CAC5B,QACA;AAAA,EACE;AAAA,EACA,aAAa;AAAA,EACb;AACF,IAII,CAAC,MACF;AA3BL;AA4BE,QAAM,UAAU,SAAS,OAAO,QAAQ,OAAO,EAAE,IAAI;AAErD,QAAM,UAAQ,4CAAa,MAAb,mBAAgB,UAAS;AACvC,QAAM,cAAiC;AAAA,IACrC;AAAA,IACA,GAAG;AAAA,EACL;AACA,MAAI,OAAO;AACT,gBAAY,QAAQ;AAAA,EACtB;AACA,QAAM,YAAQ,mCAAa,WAAW;AACtC,QAAM,MAAM,GAAG,yBAAyB;AACxC,SAAO,aAAa,gBAAAA,QAAS,oBAAoB,GAAG,IAAI;AAC1D;AAEA,IAAM,wBAAwB,CAAC;AAAA,EAC7B;AAAA,EACA,aAAa;AAAA,EACb,SAAS,CAAC;AACZ,IAII,CAAC,MAAM;AACT,QAAM,UAAU,SAAS,OAAO,QAAQ,OAAO,EAAE,IAAI;AACrD,QAAM,YAAQ,mCAAa,MAAM;AACjC,QAAM,MAAM,GAAG,iDAAiD;AAChE,SAAO,aAAa,gBAAAA,QAAS,oBAAoB,GAAG,IAAI;AAC1D;AAWO,IAAM,8BAA8B,CACzC,UACA,YACG;AACH,SAAO,sBAAsB;AAAA,IAC3B,GAAG;AAAA,IACH,QAAQ,EAAE,UAAU,GAAG,mCAAS,OAAO;AAAA,EACzC,CAAC;AACH;AAWO,IAAM,4BAA4B,CACvC,YACA,YACG;AACH,SAAO,sBAAsB;AAAA,IAC3B,GAAG;AAAA,IACH,QAAQ,EAAE,YAAY,GAAG,mCAAS,OAAO;AAAA,EAC3C,CAAC;AACH;",
|
|
6
6
|
"names": ["security"]
|
|
7
7
|
}
|
|
@@ -67,6 +67,8 @@ var formatModuleData = ({
|
|
|
67
67
|
itemContent: listItemContent,
|
|
68
68
|
itemDescribe: listItemDescribe,
|
|
69
69
|
dataSource: compDataSource,
|
|
70
|
+
columns: compColumns,
|
|
71
|
+
tableBodyHeight,
|
|
70
72
|
fileProps,
|
|
71
73
|
attrs,
|
|
72
74
|
rowSelection,
|
|
@@ -173,8 +175,11 @@ var formatModuleData = ({
|
|
|
173
175
|
if (compType === "table") {
|
|
174
176
|
const tableProps = (0, import_helpers.formatTableProps)({
|
|
175
177
|
options: {
|
|
178
|
+
...otherCompProps,
|
|
179
|
+
columns: compColumns,
|
|
180
|
+
dataSource: compDataSource,
|
|
176
181
|
attrs,
|
|
177
|
-
|
|
182
|
+
tableBodyHeight
|
|
178
183
|
},
|
|
179
184
|
staticCodeMap,
|
|
180
185
|
parameters: allParametrs
|
|
@@ -318,6 +323,31 @@ var formatModuleData = ({
|
|
|
318
323
|
...echartProps
|
|
319
324
|
};
|
|
320
325
|
}
|
|
326
|
+
if (compType === "charts") {
|
|
327
|
+
const chartsProps = (0, import_helpers.formatChartsProps)({
|
|
328
|
+
options: {
|
|
329
|
+
echartsOptions: compProps == null ? void 0 : compProps.echartsOptions
|
|
330
|
+
},
|
|
331
|
+
parameters: allParametrs
|
|
332
|
+
});
|
|
333
|
+
moduleDataRes.compProps = {
|
|
334
|
+
...moduleDataRes.compProps || {},
|
|
335
|
+
...chartsProps
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
if (compType === "steps") {
|
|
340
|
+
const stepsProps = (0, import_helpers.formatStepsProps)({
|
|
341
|
+
options: {
|
|
342
|
+
dataSource: compDataSource,
|
|
343
|
+
...otherCompProps
|
|
344
|
+
},
|
|
345
|
+
parameters: allParametrs
|
|
346
|
+
});
|
|
347
|
+
moduleDataRes.compProps = {
|
|
348
|
+
...moduleDataRes.compProps || {},
|
|
349
|
+
...stepsProps
|
|
350
|
+
};
|
|
321
351
|
}
|
|
322
352
|
moduleDataRes.compProps.style = (0, import_helpers.formatStyleProps)(moduleData, parentModuleData);
|
|
323
353
|
if ((moduleData == null ? void 0 : moduleData.compProps) && fieldName) {
|
|
@@ -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 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 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 attrs,\n dataSource: compDataSource,\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 }\n moduleDataRes.compProps.style = formatStyleProps(moduleData, parentModuleData);\n // 所有的模版 拼一个组装数据的key值\n if (moduleData?.compProps && fieldName) {\n moduleDataRes.compProps.fieldName = fieldName;\n }\n }\n \n // console.log('moduleDataRes', moduleDataRes);\n return moduleDataRes;\n};\n\nexport default formatModuleData;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAO;AACP,uBAA2B;AAC3B,
|
|
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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iCAAiB;AAAA,QAClC,SAAS;AAAA,UACP,YAAY;AAAA,UACZ,GAAG;AAAA,QACL;AAAA,QACA,YAAY;AAAA,MACd,CAAC;AACD,oBAAc,YAAY;AAAA,QACxB,GAAI,cAAc,aAAa,CAAC;AAAA,QAChC,GAAG;AAAA,MACL;AAAA,IACF;AACA,kBAAc,UAAU,YAAQ,iCAAiB,YAAY,gBAAgB;AAE7E,SAAI,yCAAY,cAAa,WAAW;AACtC,oBAAc,UAAU,YAAY;AAAA,IACtC;AAAA,EACF;AAEA,SAAO;AACT;AAEA,IAAO,2BAAQ;",
|
|
6
6
|
"names": ["_a", "_b", "_c"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type formatChartsPropsType = {
|
|
2
|
+
options?: {
|
|
3
|
+
echartsOptions?: string;
|
|
4
|
+
};
|
|
5
|
+
parameters?: {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export type formatChartsPropsExportType = {
|
|
10
|
+
options: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
declare const formatChartsProps: ({ parameters, options, }: formatChartsPropsType) => formatChartsPropsExportType;
|
|
13
|
+
export default formatChartsProps;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/formatModule/helpers/formatChartsProps.ts
|
|
30
|
+
var formatChartsProps_exports = {};
|
|
31
|
+
__export(formatChartsProps_exports, {
|
|
32
|
+
default: () => formatChartsProps_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(formatChartsProps_exports);
|
|
35
|
+
var import_stringPramarsValTransition = __toESM(require("./stringPramarsValTransition"));
|
|
36
|
+
var formatChartsProps = ({
|
|
37
|
+
parameters,
|
|
38
|
+
options = {}
|
|
39
|
+
}) => {
|
|
40
|
+
const {
|
|
41
|
+
echartsOptions
|
|
42
|
+
} = options;
|
|
43
|
+
return {
|
|
44
|
+
options: (0, import_stringPramarsValTransition.default)(echartsOptions || "", parameters, true)
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
var formatChartsProps_default = formatChartsProps;
|
|
48
|
+
//# sourceMappingURL=formatChartsProps.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/formatModule/helpers/formatChartsProps.ts"],
|
|
4
|
+
"sourcesContent": ["import stringPramarsValTransition from './stringPramarsValTransition';\n\nexport type formatChartsPropsType = {\n options?: {\n echartsOptions?: string;\n }\n parameters?: {[key:string]: any};\n}\n\nexport type formatChartsPropsExportType = {\n options: string | undefined\n}\n\nconst formatChartsProps = ({\n parameters,\n options = {},\n}: formatChartsPropsType): formatChartsPropsExportType => {\n const {\n echartsOptions,\n } = options;\n\n return {\n options: stringPramarsValTransition(echartsOptions || '', parameters, true),\n };\n};\n\nexport default formatChartsProps;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCAAuC;AAavC,IAAM,oBAAoB,CAAC;AAAA,EACzB;AAAA,EACA,UAAU,CAAC;AACb,MAA0D;AACxD,QAAM;AAAA,IACJ;AAAA,EACF,IAAI;AAEJ,SAAO;AAAA,IACL,aAAS,kCAAAA,SAA2B,kBAAkB,IAAI,YAAY,IAAI;AAAA,EAC5E;AACF;AAEA,IAAO,4BAAQ;",
|
|
6
|
+
"names": ["stringPramarsValTransition"]
|
|
7
|
+
}
|
|
@@ -64,7 +64,7 @@ var formatFormProps = ({
|
|
|
64
64
|
const initValues = {};
|
|
65
65
|
if (Array.isArray(children) && children.length > 0) {
|
|
66
66
|
children.forEach((attrItem) => {
|
|
67
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y
|
|
67
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
68
68
|
const {
|
|
69
69
|
compProps: attrCompProps,
|
|
70
70
|
formProps: attrFormProps
|
|
@@ -109,25 +109,18 @@ var formatFormProps = ({
|
|
|
109
109
|
delete formItem.formProps.extend;
|
|
110
110
|
}
|
|
111
111
|
if ((attrItem == null ? void 0 : attrItem.compType) === "table") {
|
|
112
|
-
const {
|
|
113
|
-
|
|
114
|
-
dataSource
|
|
115
|
-
} = (0, import_formatTableProps.default)({
|
|
116
|
-
options: {
|
|
117
|
-
attrs: (_b = attrItem == null ? void 0 : attrItem.compProps) == null ? void 0 : _b.attrs,
|
|
118
|
-
dataSource: (_c = attrItem == null ? void 0 : attrItem.compProps) == null ? void 0 : _c.dataSource
|
|
119
|
-
},
|
|
112
|
+
const tableProps = (0, import_formatTableProps.default)({
|
|
113
|
+
options: attrItem == null ? void 0 : attrItem.compProps,
|
|
120
114
|
staticCodeMap,
|
|
121
115
|
parameters
|
|
122
116
|
});
|
|
123
|
-
const rowKeys = (0, import_treeUtils.getDataArr)((
|
|
117
|
+
const rowKeys = (0, import_treeUtils.getDataArr)((_b = attrItem == null ? void 0 : attrItem.compProps) == null ? void 0 : _b.rowKey);
|
|
124
118
|
formItem.props = {
|
|
125
119
|
...formItem.props,
|
|
126
|
-
|
|
127
|
-
dataSource,
|
|
120
|
+
...tableProps,
|
|
128
121
|
rowKey: (rowKeys == null ? void 0 : rowKeys.length) > 0 ? rowKeys == null ? void 0 : rowKeys[(rowKeys == null ? void 0 : rowKeys.length) - 1] : "key",
|
|
129
|
-
hasSelectAll: ((
|
|
130
|
-
rowSelection: ((
|
|
122
|
+
hasSelectAll: ((_c = attrItem == null ? void 0 : attrItem.compProps) == null ? void 0 : _c.rowSelection) && ((_d = attrItem == null ? void 0 : attrItem.compProps) == null ? void 0 : _d.hasSelectAll) ? (_e = attrItem == null ? void 0 : attrItem.compProps) == null ? void 0 : _e.hasSelectAll : null,
|
|
123
|
+
rowSelection: ((_f = attrItem == null ? void 0 : attrItem.compProps) == null ? void 0 : _f.rowSelection) || { type: "radio" }
|
|
131
124
|
};
|
|
132
125
|
}
|
|
133
126
|
if (["list", "card"].includes(attrItem == null ? void 0 : attrItem.compType)) {
|
|
@@ -139,13 +132,13 @@ var formatFormProps = ({
|
|
|
139
132
|
});
|
|
140
133
|
formItem.props = {
|
|
141
134
|
...resProps,
|
|
142
|
-
rowSelection: ((
|
|
135
|
+
rowSelection: ((_g = attrItem == null ? void 0 : attrItem.compProps) == null ? void 0 : _g.rowSelection) || { type: "radio" }
|
|
143
136
|
};
|
|
144
137
|
}
|
|
145
138
|
if ((attrItem == null ? void 0 : attrItem.compType) === "upload") {
|
|
146
|
-
if (((
|
|
139
|
+
if (((_h = attrItem == null ? void 0 : attrItem.compProps) == null ? void 0 : _h.data) && ((_j = Object.keys((_i = attrItem == null ? void 0 : attrItem.compProps) == null ? void 0 : _i.data)) == null ? void 0 : _j.length) > 0) {
|
|
147
140
|
const uploadDataParams = {};
|
|
148
|
-
Object.keys((
|
|
141
|
+
Object.keys((_k = attrItem == null ? void 0 : attrItem.compProps) == null ? void 0 : _k.data).forEach((paramsName) => {
|
|
149
142
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
150
143
|
if (/\$\{(.+?)\}/g.test((_b2 = (_a2 = attrItem == null ? void 0 : attrItem.compProps) == null ? void 0 : _a2.data) == null ? void 0 : _b2[paramsName])) {
|
|
151
144
|
uploadDataParams[paramsName] = (0, import_treeUtils.getParamsContentByParamKeys)((_d2 = (_c2 = attrItem == null ? void 0 : attrItem.compProps) == null ? void 0 : _c2.data) == null ? void 0 : _d2[paramsName], parameters);
|
|
@@ -158,25 +151,25 @@ var formatFormProps = ({
|
|
|
158
151
|
data: uploadDataParams
|
|
159
152
|
};
|
|
160
153
|
}
|
|
161
|
-
if (((
|
|
154
|
+
if (((_m = (_l = attrItem == null ? void 0 : attrItem.compProps) == null ? void 0 : _l.action) == null ? void 0 : _m.url) && typeof ((_o = (_n = attrItem == null ? void 0 : attrItem.compProps) == null ? void 0 : _n.action) == null ? void 0 : _o.url) === "string") {
|
|
162
155
|
formItem.props = {
|
|
163
156
|
...formItem.props,
|
|
164
|
-
action: (
|
|
157
|
+
action: (_q = (_p = attrItem == null ? void 0 : attrItem.compProps) == null ? void 0 : _p.action) == null ? void 0 : _q.url
|
|
165
158
|
};
|
|
166
159
|
}
|
|
167
160
|
}
|
|
168
|
-
let otherRules = Array.isArray(otherAttrFormProps == null ? void 0 : otherAttrFormProps.rules) ? (
|
|
169
|
-
if ((
|
|
161
|
+
let otherRules = Array.isArray(otherAttrFormProps == null ? void 0 : otherAttrFormProps.rules) ? (_r = otherAttrFormProps == null ? void 0 : otherAttrFormProps.rules) == null ? void 0 : _r.filter((item) => !(item == null ? void 0 : item.required)) : [];
|
|
162
|
+
if ((_s = attrItem == null ? void 0 : attrItem.formProps) == null ? void 0 : _s.defaultValue) {
|
|
170
163
|
let attrDefVal = "";
|
|
171
164
|
if ((attrItem == null ? void 0 : attrItem.compType) === "upload") {
|
|
172
165
|
formItem.formProps = {
|
|
173
166
|
...formItem.formProps,
|
|
174
167
|
valuePropName: "fileList"
|
|
175
168
|
};
|
|
176
|
-
attrDefVal = (0, import_treeUtils.getParamsContentByParamKeys)((
|
|
169
|
+
attrDefVal = (0, import_treeUtils.getParamsContentByParamKeys)((_t = attrItem == null ? void 0 : attrItem.formProps) == null ? void 0 : _t.defaultValue, parameters) || [];
|
|
177
170
|
} else {
|
|
178
171
|
delete formItem.formProps.valuePropName;
|
|
179
|
-
attrDefVal = (0, import_treeUtils.replaceParamsValue)((
|
|
172
|
+
attrDefVal = (0, import_treeUtils.replaceParamsValue)((_u = attrItem == null ? void 0 : attrItem.formProps) == null ? void 0 : _u.defaultValue, parameters) || "";
|
|
180
173
|
}
|
|
181
174
|
initValues[otherAttrFormProps == null ? void 0 : otherAttrFormProps.name] = attrDefVal;
|
|
182
175
|
}
|
|
@@ -221,8 +214,8 @@ var formatFormProps = ({
|
|
|
221
214
|
if (dataOptions) {
|
|
222
215
|
const attrItemDataOptions = dataOptions || {};
|
|
223
216
|
if (attrItemDataOptions == null ? void 0 : attrItemDataOptions.staticCode) {
|
|
224
|
-
if ((attrItem == null ? void 0 : attrItem.defaultValue) && (staticCodeMap == null ? void 0 : staticCodeMap[attrItemDataOptions == null ? void 0 : attrItemDataOptions.staticCode]) && ((
|
|
225
|
-
initValues[attrItem == null ? void 0 : attrItem.attrCode] = (
|
|
217
|
+
if ((attrItem == null ? void 0 : attrItem.defaultValue) && (staticCodeMap == null ? void 0 : staticCodeMap[attrItemDataOptions == null ? void 0 : attrItemDataOptions.staticCode]) && ((_v = staticCodeMap == null ? void 0 : staticCodeMap[attrItemDataOptions == null ? void 0 : attrItemDataOptions.staticCode]) == null ? void 0 : _v[attrItem == null ? void 0 : attrItem.defaultValue])) {
|
|
218
|
+
initValues[attrItem == null ? void 0 : attrItem.attrCode] = (_w = staticCodeMap == null ? void 0 : staticCodeMap[attrItemDataOptions == null ? void 0 : attrItemDataOptions.staticCode]) == null ? void 0 : _w[attrItem == null ? void 0 : attrItem.defaultValue];
|
|
226
219
|
}
|
|
227
220
|
const formatToTreeData = (optionsItems) => {
|
|
228
221
|
if (Array.isArray(optionsItems)) {
|
|
@@ -246,8 +239,8 @@ var formatFormProps = ({
|
|
|
246
239
|
};
|
|
247
240
|
}
|
|
248
241
|
} else if ((attrItemDataOptions == null ? void 0 : attrItemDataOptions.contextOptions) && parameters) {
|
|
249
|
-
const optLabelStr = (
|
|
250
|
-
const optValueStr = (
|
|
242
|
+
const optLabelStr = (_x = attrItemDataOptions == null ? void 0 : attrItemDataOptions.contextOptions) == null ? void 0 : _x.label;
|
|
243
|
+
const optValueStr = (_y = attrItemDataOptions == null ? void 0 : attrItemDataOptions.contextOptions) == null ? void 0 : _y.value;
|
|
251
244
|
const splitParamsPath = (paramsPathStr) => {
|
|
252
245
|
if (typeof paramsPathStr === "string") {
|
|
253
246
|
const paramsPathArr = paramsPathStr.replace(/\$\{|\}/g, "").split(".");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/formatModule/helpers/formatFormProps.ts"],
|
|
4
|
-
"sourcesContent": ["import { get } from 'lodash';\nimport { stringScriptExecution } from './stringScriptExecution';\nimport { getDataArr, getParamsContentByParamKeys, replaceParamsValue } from '../../treeUtils';\nimport formatTableProps from './formatTableProps';\nimport formatListProps from './formatListProps';\nimport formRulsRegMap from './formRulsRegMap';\nimport urlPrefix from './urlPrefix';\nimport patternTransitionRegExp from './patternTransitionRegExp';\n\nexport type formatFormPropsType = {\n options?: {\n column?: number;\n children?: {[key:string]: any}[]\n }\n parameters: {[key:string]: any};\n staticCodeMap: {[key:string]: any};\n staticOptionsMap: {[key:string]: any};\n}\n\nconst formatOptionsRecursively = (data: any[], labelApiPath: string[], valApiPath: string[]): any[] => {\n return data.map((item) => {\n const option: any = {\n label: get(item, labelApiPath),\n value: get(item, valApiPath),\n };\n \n // 如果存在children属性,递归处理\n if (item.children && Array.isArray(item.children)) {\n option.children = formatOptionsRecursively(item.children, labelApiPath, valApiPath);\n }\n \n return option;\n });\n};\n\nconst formatFormProps = ({\n parameters,\n staticCodeMap,\n staticOptionsMap,\n options = {},\n}: formatFormPropsType):{[key:string]: any} => {\n const { children, column } = options;\n const res:{[key:string]: any} = {};\n const formItems: { [key: string]: any }[] = [];\n const initValues: { [key: string]: any } = {};\n if (Array.isArray(children) && children.length > 0) {\n children.forEach((attrItem) => {\n const {\n compProps: attrCompProps,\n formProps: attrFormProps,\n } = attrItem || {};\n const {\n required,\n extend,\n display: attrFormPropsDisplay,\n ...otherAttrFormProps\n } = attrFormProps || {};\n const {\n dataOptions,\n ...otherAttrCompProps\n } = attrCompProps || {};\n const formItem:{[key:string]: any} = {\n key: attrItem?.id,\n label: attrFormProps?.label,\n name: attrFormProps?.name,\n type: attrItem?.compType,\n props: otherAttrCompProps || {},\n formProps: otherAttrFormProps || {},\n originModule: attrItem, // 以下是组件配置属性,用于属性编辑\n };\n if (extend?.type === 'text' && extend?.text && typeof extend?.text === 'string') {\n formItem.formProps = {\n ...formItem.formProps,\n extend: {\n ...extend,\n text: replaceParamsValue(extend?.text, parameters),\n },\n };\n } else if (extend?.type === 'controlBtns' && Array.isArray(extend?.controlBtns) && extend?.controlBtns?.length > 0) {\n formItem.formProps = {\n ...formItem.formProps,\n extend: {\n ...extend,\n controlBtns: extend?.controlBtns,\n },\n };\n } else {\n delete formItem.formProps.extend;\n }\n if (attrItem?.compType === 'table') {\n const {\n columns,\n dataSource,\n } = formatTableProps({\n options: {\n attrs: attrItem?.compProps?.attrs,\n dataSource: attrItem?.compProps?.dataSource,\n },\n staticCodeMap,\n parameters,\n });\n const rowKeys = getDataArr(attrItem?.compProps?.rowKey);\n formItem.props = {\n ...formItem.props,\n columns,\n dataSource,\n rowKey: rowKeys?.length > 0 ? rowKeys?.[rowKeys?.length - 1] : 'key',\n hasSelectAll: (attrItem?.compProps?.rowSelection && attrItem?.compProps?.hasSelectAll) ? attrItem?.compProps?.hasSelectAll : null,\n rowSelection: attrItem?.compProps?.rowSelection || { type: 'radio' },\n };\n }\n if (['list', 'card'].includes(attrItem?.compType)) {\n const resProps = formatListProps({\n options: attrItem?.compProps,\n staticCodeMap,\n parameters,\n urlPrefix,\n });\n formItem.props = {\n ...resProps,\n rowSelection: attrItem?.compProps?.rowSelection || { type: 'radio' },\n };\n }\n if (attrItem?.compType === 'upload') {\n if (\n attrItem?.compProps?.data &&\n Object.keys(attrItem?.compProps?.data)?.length > 0\n ) {\n const uploadDataParams:{[key:string]: any} = {};\n Object.keys(attrItem?.compProps?.data).forEach(paramsName => {\n if (/\\$\\{(.+?)\\}/g.test(attrItem?.compProps?.data?.[paramsName])) {\n // const valParamArr = getDataArr(attrItem?.compProps?.data?.[paramsName]);\n uploadDataParams[paramsName] = getParamsContentByParamKeys(attrItem?.compProps?.data?.[paramsName], parameters);\n } else {\n uploadDataParams[paramsName] = attrItem?.compProps?.data?.[paramsName];\n }\n });\n formItem.props = {\n ...formItem.props,\n data: uploadDataParams,\n };\n }\n if (\n attrItem?.compProps?.action?.url &&\n typeof attrItem?.compProps?.action?.url === 'string'\n ) {\n formItem.props = {\n ...formItem.props,\n action: attrItem?.compProps?.action?.url,\n };\n }\n }\n let otherRules = Array.isArray(otherAttrFormProps?.rules) ? otherAttrFormProps?.rules?.filter((item: any) => !item?.required) : [];\n if (attrItem?.formProps?.defaultValue) {\n let attrDefVal:any = '';\n if (attrItem?.compType === 'upload') {\n formItem.formProps = {\n ...formItem.formProps,\n valuePropName: 'fileList',\n };\n attrDefVal = getParamsContentByParamKeys(attrItem?.formProps?.defaultValue, parameters) || [];\n } else {\n delete formItem.formProps.valuePropName;\n attrDefVal = replaceParamsValue(attrItem?.formProps?.defaultValue, parameters) || '';\n }\n initValues[otherAttrFormProps?.name] = attrDefVal;\n }\n otherRules = otherRules.map((item: {[key:string]: any}) => ({\n pattern: item?.type === 'custom' ? patternTransitionRegExp(item?.pattern) : (\n formRulsRegMap?.[item?.type] || ''\n ),\n message: item?.message,\n }));\n if (typeof attrFormPropsDisplay === 'boolean' || typeof attrFormPropsDisplay === 'string') {\n let formItemDisplay:boolean = true;\n if (typeof attrFormPropsDisplay === 'boolean') {\n formItemDisplay = attrFormPropsDisplay;\n } else if (typeof attrFormPropsDisplay === 'string' && attrFormPropsDisplay) {\n // const scriptCodeStr = stringPramarsValTransition(attrFormPropsDisplay, parameters);\n const codeExtendVal = stringScriptExecution(\n attrFormPropsDisplay,\n parameters,\n );\n formItemDisplay = codeExtendVal;\n }\n formItem.display = formItemDisplay;\n }\n if (typeof required === 'boolean' || typeof required === 'string') {\n let formItemRequired:boolean = false;\n if (typeof required === 'boolean') {\n formItemRequired = required;\n } else if (typeof required === 'string' && required) {\n // const scriptCodeStr = stringPramarsValTransition(required, parameters);\n const codeExtendVal = stringScriptExecution(required, parameters);\n formItemRequired = typeof codeExtendVal === 'boolean' ? codeExtendVal : false;\n }\n formItem.formProps = {\n ...formItem.formProps,\n rules: formItemRequired ? [{ required: formItemRequired }, ...otherRules] : otherRules,\n };\n } else {\n formItem.formProps = {\n ...formItem.formProps,\n rules: otherRules,\n };\n }\n if (dataOptions) {\n const attrItemDataOptions = dataOptions || {};\n if (attrItemDataOptions?.staticCode) {\n if (\n attrItem?.defaultValue &&\n staticCodeMap?.[attrItemDataOptions?.staticCode] &&\n staticCodeMap?.[attrItemDataOptions?.staticCode]?.[attrItem?.defaultValue]\n ) {\n initValues[attrItem?.attrCode] = staticCodeMap?.[attrItemDataOptions?.staticCode]?.[attrItem?.defaultValue];\n }\n const formatToTreeData = (optionsItems: {[key:string]: any}[]):{[key:string]: any}[] => {\n if (Array.isArray(optionsItems)) {\n return optionsItems.map(optItem => ({\n title: optItem?.label,\n value: optItem?.value,\n children: formatToTreeData(optItem?.children),\n }));\n }\n return [];\n };\n if (attrItem?.compType === 'treeSelect') {\n formItem.props = {\n ...formItem.props,\n treeData: formatToTreeData(staticOptionsMap?.[attrItemDataOptions?.staticCode]),\n };\n } else {\n formItem.props = {\n ...formItem.props,\n options: Array.isArray(staticOptionsMap?.[attrItemDataOptions?.staticCode]) ?\n staticOptionsMap?.[attrItemDataOptions?.staticCode] : [],\n };\n }\n } else if (attrItemDataOptions?.contextOptions && parameters) {\n const optLabelStr = attrItemDataOptions?.contextOptions?.label;\n const optValueStr = attrItemDataOptions?.contextOptions?.value;\n const splitParamsPath = (paramsPathStr: string) => {\n if (typeof paramsPathStr === 'string') {\n const paramsPathArr = paramsPathStr.replace(/\\$\\{|\\}/g, '').split('.');\n return paramsPathArr?.filter((item:string, idx:number) => !(idx === 0 && item === 'root'));\n }\n return [];\n };\n if (optValueStr) {\n const optValArr = splitParamsPath(optValueStr);\n const optLabelArr = splitParamsPath(optLabelStr);\n const optData: any[] = Array.isArray(parameters?.[optValArr?.[0]]) ? parameters?.[optValArr?.[0]] : [];\n const labelApiPath: string[] = optLabelArr?.slice(2);\n const valApiPath: string[] = optValArr?.slice(2);\n \n formItem.props = {\n ...formItem.props,\n options: formatOptionsRecursively(optData, labelApiPath, valApiPath),\n };\n }\n }\n }\n formItems.push(formItem);\n });\n }\n if (typeof column === 'number' && column > 1) {\n res.formMode = 'grid';\n res.span = 24 / column;\n } else {\n res.formMode = 'default';\n delete res.span;\n }\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Ae;AAAA,QACtB,MAAM,+CAAe;AAAA,QACrB,MAAM,qCAAU;AAAA,QAChB,OAAO,sBAAsB,CAAC;AAAA,QAC9B,WAAW,sBAAsB,CAAC;AAAA,QAClC,cAAc;AAAA;AAAA,MAChB;AACA,WAAI,iCAAQ,UAAS,WAAU,iCAAQ,SAAQ,QAAO,iCAAQ,UAAS,UAAU;AAC/E,iBAAS,YAAY;AAAA,UACnB,GAAG,SAAS;AAAA,UACZ,QAAQ;AAAA,YACN,GAAG;AAAA,YACH,UAAM,qCAAmB,iCAAQ,MAAM,UAAU;AAAA,UACnD;AAAA,QACF;AAAA,MACF,YAAW,iCAAQ,UAAS,iBAAiB,MAAM,QAAQ,iCAAQ,WAAW,OAAK,sCAAQ,gBAAR,mBAAqB,UAAS,GAAG;AAClH,iBAAS,YAAY;AAAA,UACnB,GAAG,SAAS;AAAA,UACZ,QAAQ;AAAA,YACN,GAAG;AAAA,YACH,aAAa,iCAAQ;AAAA,UACvB;AAAA,QACF;AAAA,MACF,OAAO;AACL,eAAO,SAAS,UAAU;AAAA,MAC5B;AACA,WAAI,qCAAU,cAAa,SAAS;AAClC,cAAM
|
|
4
|
+
"sourcesContent": ["import { get } from 'lodash';\nimport { stringScriptExecution } from './stringScriptExecution';\nimport { getDataArr, getParamsContentByParamKeys, replaceParamsValue } from '../../treeUtils';\nimport formatTableProps from './formatTableProps';\nimport formatListProps from './formatListProps';\nimport formRulsRegMap from './formRulsRegMap';\nimport urlPrefix from './urlPrefix';\nimport patternTransitionRegExp from './patternTransitionRegExp';\n\nexport type formatFormPropsType = {\n options?: {\n column?: number;\n children?: {[key:string]: any}[]\n }\n parameters: {[key:string]: any};\n staticCodeMap: {[key:string]: any};\n staticOptionsMap: {[key:string]: any};\n}\n\nconst formatOptionsRecursively = (data: any[], labelApiPath: string[], valApiPath: string[]): any[] => {\n return data.map((item) => {\n const option: any = {\n label: get(item, labelApiPath),\n value: get(item, valApiPath),\n };\n \n // 如果存在children属性,递归处理\n if (item.children && Array.isArray(item.children)) {\n option.children = formatOptionsRecursively(item.children, labelApiPath, valApiPath);\n }\n \n return option;\n });\n};\n\nconst formatFormProps = ({\n parameters,\n staticCodeMap,\n staticOptionsMap,\n options = {},\n}: formatFormPropsType):{[key:string]: any} => {\n const { children, column } = options;\n const res:{[key:string]: any} = {};\n const formItems: { [key: string]: any }[] = [];\n const initValues: { [key: string]: any } = {};\n if (Array.isArray(children) && children.length > 0) {\n children.forEach((attrItem) => {\n const {\n compProps: attrCompProps,\n formProps: attrFormProps,\n } = attrItem || {};\n const {\n required,\n extend,\n display: attrFormPropsDisplay,\n ...otherAttrFormProps\n } = attrFormProps || {};\n const {\n dataOptions,\n ...otherAttrCompProps\n } = attrCompProps || {};\n const formItem:{[key:string]: any} = {\n key: attrItem?.id,\n label: attrFormProps?.label,\n name: attrFormProps?.name,\n type: attrItem?.compType,\n props: otherAttrCompProps || {},\n formProps: otherAttrFormProps || {},\n originModule: attrItem, // 以下是组件配置属性,用于属性编辑\n };\n if (extend?.type === 'text' && extend?.text && typeof extend?.text === 'string') {\n formItem.formProps = {\n ...formItem.formProps,\n extend: {\n ...extend,\n text: replaceParamsValue(extend?.text, parameters),\n },\n };\n } else if (extend?.type === 'controlBtns' && Array.isArray(extend?.controlBtns) && extend?.controlBtns?.length > 0) {\n formItem.formProps = {\n ...formItem.formProps,\n extend: {\n ...extend,\n controlBtns: extend?.controlBtns,\n },\n };\n } else {\n delete formItem.formProps.extend;\n }\n if (attrItem?.compType === 'table') {\n const tableProps = formatTableProps({\n options: attrItem?.compProps,\n staticCodeMap,\n parameters,\n });\n const rowKeys = getDataArr(attrItem?.compProps?.rowKey);\n formItem.props = {\n ...formItem.props,\n ...tableProps,\n rowKey: rowKeys?.length > 0 ? rowKeys?.[rowKeys?.length - 1] : 'key',\n hasSelectAll: (attrItem?.compProps?.rowSelection && attrItem?.compProps?.hasSelectAll) ? attrItem?.compProps?.hasSelectAll : null,\n rowSelection: attrItem?.compProps?.rowSelection || { type: 'radio' },\n };\n }\n if (['list', 'card'].includes(attrItem?.compType)) {\n const resProps = formatListProps({\n options: attrItem?.compProps,\n staticCodeMap,\n parameters,\n urlPrefix,\n });\n formItem.props = {\n ...resProps,\n rowSelection: attrItem?.compProps?.rowSelection || { type: 'radio' },\n };\n }\n if (attrItem?.compType === 'upload') {\n if (\n attrItem?.compProps?.data &&\n Object.keys(attrItem?.compProps?.data)?.length > 0\n ) {\n const uploadDataParams:{[key:string]: any} = {};\n Object.keys(attrItem?.compProps?.data).forEach(paramsName => {\n if (/\\$\\{(.+?)\\}/g.test(attrItem?.compProps?.data?.[paramsName])) {\n // const valParamArr = getDataArr(attrItem?.compProps?.data?.[paramsName]);\n uploadDataParams[paramsName] = getParamsContentByParamKeys(attrItem?.compProps?.data?.[paramsName], parameters);\n } else {\n uploadDataParams[paramsName] = attrItem?.compProps?.data?.[paramsName];\n }\n });\n formItem.props = {\n ...formItem.props,\n data: uploadDataParams,\n };\n }\n if (\n attrItem?.compProps?.action?.url &&\n typeof attrItem?.compProps?.action?.url === 'string'\n ) {\n formItem.props = {\n ...formItem.props,\n action: attrItem?.compProps?.action?.url,\n };\n }\n }\n let otherRules = Array.isArray(otherAttrFormProps?.rules) ? otherAttrFormProps?.rules?.filter((item: any) => !item?.required) : [];\n if (attrItem?.formProps?.defaultValue) {\n let attrDefVal:any = '';\n if (attrItem?.compType === 'upload') {\n formItem.formProps = {\n ...formItem.formProps,\n valuePropName: 'fileList',\n };\n attrDefVal = getParamsContentByParamKeys(attrItem?.formProps?.defaultValue, parameters) || [];\n } else {\n delete formItem.formProps.valuePropName;\n attrDefVal = replaceParamsValue(attrItem?.formProps?.defaultValue, parameters) || '';\n }\n initValues[otherAttrFormProps?.name] = attrDefVal;\n }\n otherRules = otherRules.map((item: {[key:string]: any}) => ({\n pattern: item?.type === 'custom' ? patternTransitionRegExp(item?.pattern) : (\n formRulsRegMap?.[item?.type] || ''\n ),\n message: item?.message,\n }));\n if (typeof attrFormPropsDisplay === 'boolean' || typeof attrFormPropsDisplay === 'string') {\n let formItemDisplay:boolean = true;\n if (typeof attrFormPropsDisplay === 'boolean') {\n formItemDisplay = attrFormPropsDisplay;\n } else if (typeof attrFormPropsDisplay === 'string' && attrFormPropsDisplay) {\n // const scriptCodeStr = stringPramarsValTransition(attrFormPropsDisplay, parameters);\n const codeExtendVal = stringScriptExecution(\n attrFormPropsDisplay,\n parameters,\n );\n formItemDisplay = codeExtendVal;\n }\n formItem.display = formItemDisplay;\n }\n if (typeof required === 'boolean' || typeof required === 'string') {\n let formItemRequired:boolean = false;\n if (typeof required === 'boolean') {\n formItemRequired = required;\n } else if (typeof required === 'string' && required) {\n // const scriptCodeStr = stringPramarsValTransition(required, parameters);\n const codeExtendVal = stringScriptExecution(required, parameters);\n formItemRequired = typeof codeExtendVal === 'boolean' ? codeExtendVal : false;\n }\n formItem.formProps = {\n ...formItem.formProps,\n rules: formItemRequired ? [{ required: formItemRequired }, ...otherRules] : otherRules,\n };\n } else {\n formItem.formProps = {\n ...formItem.formProps,\n rules: otherRules,\n };\n }\n if (dataOptions) {\n const attrItemDataOptions = dataOptions || {};\n if (attrItemDataOptions?.staticCode) {\n if (\n attrItem?.defaultValue &&\n staticCodeMap?.[attrItemDataOptions?.staticCode] &&\n staticCodeMap?.[attrItemDataOptions?.staticCode]?.[attrItem?.defaultValue]\n ) {\n initValues[attrItem?.attrCode] = staticCodeMap?.[attrItemDataOptions?.staticCode]?.[attrItem?.defaultValue];\n }\n const formatToTreeData = (optionsItems: {[key:string]: any}[]):{[key:string]: any}[] => {\n if (Array.isArray(optionsItems)) {\n return optionsItems.map(optItem => ({\n title: optItem?.label,\n value: optItem?.value,\n children: formatToTreeData(optItem?.children),\n }));\n }\n return [];\n };\n if (attrItem?.compType === 'treeSelect') {\n formItem.props = {\n ...formItem.props,\n treeData: formatToTreeData(staticOptionsMap?.[attrItemDataOptions?.staticCode]),\n };\n } else {\n formItem.props = {\n ...formItem.props,\n options: Array.isArray(staticOptionsMap?.[attrItemDataOptions?.staticCode]) ?\n staticOptionsMap?.[attrItemDataOptions?.staticCode] : [],\n };\n }\n } else if (attrItemDataOptions?.contextOptions && parameters) {\n const optLabelStr = attrItemDataOptions?.contextOptions?.label;\n const optValueStr = attrItemDataOptions?.contextOptions?.value;\n const splitParamsPath = (paramsPathStr: string) => {\n if (typeof paramsPathStr === 'string') {\n const paramsPathArr = paramsPathStr.replace(/\\$\\{|\\}/g, '').split('.');\n return paramsPathArr?.filter((item:string, idx:number) => !(idx === 0 && item === 'root'));\n }\n return [];\n };\n if (optValueStr) {\n const optValArr = splitParamsPath(optValueStr);\n const optLabelArr = splitParamsPath(optLabelStr);\n const optData: any[] = Array.isArray(parameters?.[optValArr?.[0]]) ? parameters?.[optValArr?.[0]] : [];\n const labelApiPath: string[] = optLabelArr?.slice(2);\n const valApiPath: string[] = optValArr?.slice(2);\n \n formItem.props = {\n ...formItem.props,\n options: formatOptionsRecursively(optData, labelApiPath, valApiPath),\n };\n }\n }\n }\n formItems.push(formItem);\n });\n }\n if (typeof column === 'number' && column > 1) {\n res.formMode = 'grid';\n res.span = 24 / column;\n } else {\n res.formMode = 'default';\n delete res.span;\n }\n res.formItems = formItems;\n res.initialValues = initValues;\n return res;\n};\n\nexport default formatFormProps;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAoB;AACpB,mCAAsC;AACtC,uBAA4E;AAC5E,8BAA6B;AAC7B,6BAA4B;AAC5B,4BAA2B;AAC3B,uBAAsB;AACtB,qCAAoC;AAYpC,IAAM,2BAA2B,CAAC,MAAa,cAAwB,eAAgC;AACrG,SAAO,KAAK,IAAI,CAAC,SAAS;AACxB,UAAM,SAAc;AAAA,MAClB,WAAO,mBAAI,MAAM,YAAY;AAAA,MAC7B,WAAO,mBAAI,MAAM,UAAU;AAAA,IAC7B;AAGA,QAAI,KAAK,YAAY,MAAM,QAAQ,KAAK,QAAQ,G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A,cACZ,SAAS,yBAAyB,SAAS,cAAc,UAAU;AAAA,YACrE;AAAA,UACF;AAAA,QACF;AAAA,MACF;AACA,gBAAU,KAAK,QAAQ;AAAA,IACzB,CAAC;AAAA,EACH;AACA,MAAI,OAAO,WAAW,YAAY,SAAS,GAAG;AAC5C,QAAI,WAAW;AACf,QAAI,OAAO,KAAK;AAAA,EAClB,OAAO;AACL,QAAI,WAAW;AACf,WAAO,IAAI;AAAA,EACb;AACA,MAAI,YAAY;AAChB,MAAI,gBAAgB;AACpB,SAAO;AACT;AAEA,IAAO,0BAAQ;",
|
|
6
6
|
"names": ["formatTableProps", "formatListProps", "urlPrefix", "_a", "_b", "_c", "_d", "_e", "_f", "patternTransitionRegExp", "formRulsRegMap"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type formatImagePropsType = {
|
|
2
|
+
options?: {
|
|
3
|
+
dataSource?: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
status?: string;
|
|
7
|
+
size?: string;
|
|
8
|
+
direction?: string;
|
|
9
|
+
statusMap?: {
|
|
10
|
+
wait?: string;
|
|
11
|
+
process?: string;
|
|
12
|
+
finish?: string;
|
|
13
|
+
error?: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
parameters?: {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
declare const formatStepsProps: ({ parameters, options, }: formatImagePropsType) => {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
};
|
|
23
|
+
export default formatStepsProps;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/formatModule/helpers/formatStepsProps.ts
|
|
20
|
+
var formatStepsProps_exports = {};
|
|
21
|
+
__export(formatStepsProps_exports, {
|
|
22
|
+
default: () => formatStepsProps_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(formatStepsProps_exports);
|
|
25
|
+
var import_treeUtils = require("../../treeUtils");
|
|
26
|
+
var import_lodash = require("lodash");
|
|
27
|
+
var formatStepsProps = ({
|
|
28
|
+
parameters,
|
|
29
|
+
options = {}
|
|
30
|
+
}) => {
|
|
31
|
+
const {
|
|
32
|
+
dataSource,
|
|
33
|
+
title,
|
|
34
|
+
description,
|
|
35
|
+
status,
|
|
36
|
+
direction,
|
|
37
|
+
statusMap
|
|
38
|
+
} = options;
|
|
39
|
+
const res = {
|
|
40
|
+
size: "small"
|
|
41
|
+
};
|
|
42
|
+
if (dataSource) {
|
|
43
|
+
const dataSourceArr = (0, import_treeUtils.getDataArr)(dataSource);
|
|
44
|
+
if (parameters) {
|
|
45
|
+
const dataSourceList = (0, import_lodash.get)(
|
|
46
|
+
parameters,
|
|
47
|
+
dataSourceArr
|
|
48
|
+
);
|
|
49
|
+
const replaceParamsValue = (contentStr, item) => {
|
|
50
|
+
return (0, import_treeUtils.replaceLoopBodyParamsValue)(
|
|
51
|
+
contentStr,
|
|
52
|
+
{
|
|
53
|
+
parameters,
|
|
54
|
+
loopParams: item,
|
|
55
|
+
loopData: dataSourceList,
|
|
56
|
+
loopSourceArr: dataSourceArr
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
if (Array.isArray(dataSourceList)) {
|
|
61
|
+
res.items = dataSourceList.map((item) => {
|
|
62
|
+
let recordStatus = status && replaceParamsValue(status, item) ? replaceParamsValue(status, item) : "";
|
|
63
|
+
if (statusMap && Object.keys(statusMap).length > 0) {
|
|
64
|
+
Object.keys(statusMap).forEach((key) => {
|
|
65
|
+
const statusValue = `${statusMap == null ? void 0 : statusMap[key]}` || "";
|
|
66
|
+
if (recordStatus && statusValue && `${recordStatus}` === statusValue) {
|
|
67
|
+
recordStatus = key;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
title: title ? replaceParamsValue(title, item) : "",
|
|
73
|
+
description: description ? replaceParamsValue(description, item) : "",
|
|
74
|
+
status: recordStatus || "default"
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (direction === "horizontal") {
|
|
80
|
+
res.labelPlacement = "vertical";
|
|
81
|
+
} else if (res == null ? void 0 : res.labelPlacement) {
|
|
82
|
+
delete res.labelPlacement;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return res;
|
|
86
|
+
};
|
|
87
|
+
var formatStepsProps_default = formatStepsProps;
|
|
88
|
+
//# sourceMappingURL=formatStepsProps.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/formatModule/helpers/formatStepsProps.ts"],
|
|
4
|
+
"sourcesContent": ["import { getDataArr, replaceLoopBodyParamsValue } from '../../treeUtils';\nimport { get } from 'lodash';\n\nexport type formatImagePropsType = {\n options?: {\n dataSource?: string,\n title?: string,\n description?: string,\n status?: string,\n size?: string,\n direction?: string,\n statusMap?: {\n wait?: string,\n process?: string,\n finish?: string,\n error?: string,\n }\n }\n parameters?: {[key:string]: any};\n}\n\nconst formatStepsProps = ({\n parameters,\n options = {},\n}: formatImagePropsType):{[key:string]: any} => {\n const {\n dataSource,\n title,\n description,\n status,\n direction,\n statusMap,\n } = options;\n const res:{[key:string]: any} = {\n size: 'small',\n };\n\n if (dataSource) {\n const dataSourceArr = getDataArr(dataSource);\n if (parameters) {\n const dataSourceList = get(\n parameters,\n dataSourceArr,\n );\n\n const replaceParamsValue = (\n contentStr: string,\n item: { [key: string]: any },\n ) => {\n return replaceLoopBodyParamsValue(\n contentStr, {\n parameters,\n loopParams: item,\n loopData: dataSourceList,\n loopSourceArr: dataSourceArr,\n });\n };\n if (Array.isArray(dataSourceList)) {\n res.items = dataSourceList.map(item => {\n // 获取状态值\n let recordStatus = status && replaceParamsValue(status, item) ? replaceParamsValue(status, item) : '';\n // 根据状态映射,转换状态值为步骤状态\n if (statusMap && Object.keys(statusMap).length > 0) {\n Object.keys(statusMap).forEach(key => {\n const statusValue = `${statusMap?.[key as keyof typeof statusMap]}` || '';\n if (recordStatus && statusValue && `${recordStatus}` === statusValue) {\n recordStatus = key;\n }\n });\n }\n return ({\n title: title ? replaceParamsValue(title, item) : '',\n description: description ? replaceParamsValue(description, item) : '',\n status: recordStatus || 'default',\n });\n });\n }\n }\n if (direction === 'horizontal') {\n res.labelPlacement = 'vertical';\n } else if (res?.labelPlacement) {\n delete res.labelPlacement;\n }\n }\n return res;\n};\n\nexport default formatStepsProps;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAuD;AACvD,oBAAoB;AAoBpB,IAAM,mBAAmB,CAAC;AAAA,EACxB;AAAA,EACA,UAAU,CAAC;AACb,MAAgD;AAC9C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,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{
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}[];
|
|
6
9
|
dataSource?: string;
|
|
10
|
+
columnWidth?: string;
|
|
11
|
+
columnMinWidth?: string;
|
|
12
|
+
columnMaxWidth?: string;
|
|
13
|
+
tableBodyHeight?: string;
|
|
7
14
|
};
|
|
8
15
|
staticCodeMap?: {
|
|
9
16
|
[key: string]: any;
|
|
@@ -19,6 +26,10 @@ export type formatTablePropsExportType = {
|
|
|
19
26
|
dataSource: {
|
|
20
27
|
[key: string]: any;
|
|
21
28
|
}[];
|
|
29
|
+
scroll?: {
|
|
30
|
+
y?: string;
|
|
31
|
+
x?: string;
|
|
32
|
+
};
|
|
22
33
|
};
|
|
23
34
|
declare const formatTableProps: ({ staticCodeMap, parameters, options, }: formatTablePropsType) => formatTablePropsExportType;
|
|
24
35
|
export default formatTableProps;
|