@boteteam/utils 0.0.20 → 0.0.22
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/README.md +23 -23
- package/dist/cjs/CookieUtils.d.ts +3 -0
- package/dist/cjs/CookieUtils.js +22 -5
- package/dist/cjs/CookieUtils.js.map +2 -2
- package/dist/cjs/asyncStorage.js.map +1 -1
- package/dist/cjs/environment.d.ts +12 -0
- package/dist/cjs/environment.js +84 -0
- package/dist/cjs/environment.js.map +7 -0
- package/dist/cjs/file.js +1 -1
- package/dist/cjs/file.js.map +2 -2
- package/dist/cjs/fileToBase64.js.map +1 -1
- package/dist/cjs/formatModule/formatModuleData.js.map +1 -1
- package/dist/cjs/formatModule/helpers/formRulsRegMap.js.map +1 -1
- package/dist/cjs/formatModule/helpers/formatCarouselProps.js.map +1 -1
- package/dist/cjs/formatModule/helpers/formatChartsProps.js.map +1 -1
- package/dist/cjs/formatModule/helpers/formatDescriptionsProps.js.map +1 -1
- package/dist/cjs/formatModule/helpers/formatEchartCommonProps.js.map +1 -1
- package/dist/cjs/formatModule/helpers/formatEchartLineProps.js.map +1 -1
- package/dist/cjs/formatModule/helpers/formatEchartPieProps.js.map +1 -1
- package/dist/cjs/formatModule/helpers/formatFormProps.js.map +1 -1
- package/dist/cjs/formatModule/helpers/formatHighCodeProps.js.map +1 -1
- package/dist/cjs/formatModule/helpers/formatImageProps.js.map +1 -1
- package/dist/cjs/formatModule/helpers/formatListProps.js.map +1 -1
- package/dist/cjs/formatModule/helpers/formatLoopProps.js.map +1 -1
- package/dist/cjs/formatModule/helpers/formatStepsProps.js.map +1 -1
- package/dist/cjs/formatModule/helpers/formatStyleProps.js.map +1 -1
- package/dist/cjs/formatModule/helpers/formatTableProps.js.map +1 -1
- package/dist/cjs/formatModule/helpers/index.js.map +1 -1
- package/dist/cjs/formatModule/helpers/patternTransitionRegExp.js.map +1 -1
- package/dist/cjs/formatModule/helpers/staticCodeAssemble.js.map +1 -1
- package/dist/cjs/formatModule/helpers/stringPramarsValTransition.js.map +1 -1
- package/dist/cjs/formatModule/helpers/stringScriptExecution.js.map +1 -1
- package/dist/cjs/formatModule/helpers/urlPrefix.js.map +1 -1
- package/dist/cjs/http.d.ts +15 -7
- package/dist/cjs/http.js +71 -12
- package/dist/cjs/http.js.map +3 -3
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +17 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/loopPageStaticCodeMap.js.map +1 -1
- package/dist/cjs/markdownEscape.js.map +1 -1
- package/dist/cjs/pathArgsUtils.js +15 -2
- package/dist/cjs/pathArgsUtils.js.map +2 -2
- package/dist/cjs/scriptExecution.js.map +1 -1
- package/dist/cjs/securityUtils.d.ts +0 -3
- package/dist/cjs/securityUtils.js +31 -4
- package/dist/cjs/securityUtils.js.map +2 -2
- package/dist/cjs/stringUtils.js.map +1 -1
- package/dist/cjs/treeUtils.js.map +1 -1
- package/dist/esm/CookieUtils.d.ts +3 -0
- package/dist/esm/CookieUtils.js +57 -5
- package/dist/esm/CookieUtils.js.map +1 -1
- package/dist/esm/asyncStorage.js +4 -4
- package/dist/esm/asyncStorage.js.map +1 -1
- package/dist/esm/environment.d.ts +12 -0
- package/dist/esm/environment.js +63 -0
- package/dist/esm/environment.js.map +1 -0
- package/dist/esm/file.js +25 -25
- package/dist/esm/file.js.map +1 -1
- package/dist/esm/fileToBase64.js +4 -4
- package/dist/esm/fileToBase64.js.map +1 -1
- package/dist/esm/formatModule/formatModuleData.js.map +1 -1
- package/dist/esm/formatModule/helpers/formRulsRegMap.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatCarouselProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatChartsProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatDescriptionsProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatEchartCommonProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatEchartLineProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatEchartPieProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatFormProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatHighCodeProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatImageProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatListProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatLoopProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatStepsProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatStyleProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatTableProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/index.js.map +1 -1
- package/dist/esm/formatModule/helpers/patternTransitionRegExp.js.map +1 -1
- package/dist/esm/formatModule/helpers/staticCodeAssemble.js +4 -4
- package/dist/esm/formatModule/helpers/staticCodeAssemble.js.map +1 -1
- package/dist/esm/formatModule/helpers/stringPramarsValTransition.js.map +1 -1
- package/dist/esm/formatModule/helpers/stringScriptExecution.js.map +1 -1
- package/dist/esm/formatModule/helpers/urlPrefix.js.map +1 -1
- package/dist/esm/http.d.ts +15 -7
- package/dist/esm/http.js +118 -62
- package/dist/esm/http.js.map +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/loopPageStaticCodeMap.js.map +1 -1
- package/dist/esm/markdownEscape.js.map +1 -1
- package/dist/esm/pathArgsUtils.js +26 -11
- package/dist/esm/pathArgsUtils.js.map +1 -1
- package/dist/esm/scriptExecution.js.map +1 -1
- package/dist/esm/securityUtils.d.ts +0 -3
- package/dist/esm/securityUtils.js +53 -23
- package/dist/esm/securityUtils.js.map +1 -1
- package/dist/esm/stringUtils.js.map +1 -1
- package/dist/esm/treeUtils.js +8 -8
- 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
|
@@ -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 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"],
|
|
4
|
+
"sourcesContent": ["import { get } from 'lodash';\r\nimport { stringScriptExecution } from './stringScriptExecution';\r\nimport { getDataArr, getParamsContentByParamKeys, replaceParamsValue } from '../../treeUtils';\r\nimport formatTableProps from './formatTableProps';\r\nimport formatListProps from './formatListProps';\r\nimport formRulsRegMap from './formRulsRegMap';\r\nimport urlPrefix from './urlPrefix';\r\nimport patternTransitionRegExp from './patternTransitionRegExp';\r\n\r\nexport type formatFormPropsType = {\r\n options?: {\r\n column?: number;\r\n children?: {[key:string]: any}[]\r\n }\r\n parameters: {[key:string]: any};\r\n staticCodeMap: {[key:string]: any};\r\n staticOptionsMap: {[key:string]: any};\r\n}\r\n\r\nconst formatOptionsRecursively = (data: any[], labelApiPath: string[], valApiPath: string[]): any[] => {\r\n return data.map((item) => {\r\n const option: any = {\r\n label: get(item, labelApiPath),\r\n value: get(item, valApiPath),\r\n };\r\n \r\n // 如果存在children属性,递归处理\r\n if (item.children && Array.isArray(item.children)) {\r\n option.children = formatOptionsRecursively(item.children, labelApiPath, valApiPath);\r\n }\r\n \r\n return option;\r\n });\r\n};\r\n\r\nconst formatFormProps = ({\r\n parameters,\r\n staticCodeMap,\r\n staticOptionsMap,\r\n options = {},\r\n}: formatFormPropsType):{[key:string]: any} => {\r\n const { children, column } = options;\r\n const res:{[key:string]: any} = {};\r\n const formItems: { [key: string]: any }[] = [];\r\n const initValues: { [key: string]: any } = {};\r\n if (Array.isArray(children) && children.length > 0) {\r\n children.forEach((attrItem) => {\r\n const {\r\n compProps: attrCompProps,\r\n formProps: attrFormProps,\r\n } = attrItem || {};\r\n const {\r\n required,\r\n extend,\r\n display: attrFormPropsDisplay,\r\n ...otherAttrFormProps\r\n } = attrFormProps || {};\r\n const {\r\n dataOptions,\r\n ...otherAttrCompProps\r\n } = attrCompProps || {};\r\n const formItem:{[key:string]: any} = {\r\n key: attrItem?.id,\r\n label: attrFormProps?.label,\r\n name: attrFormProps?.name,\r\n type: attrItem?.compType,\r\n props: otherAttrCompProps || {},\r\n formProps: otherAttrFormProps || {},\r\n originModule: attrItem, // 以下是组件配置属性,用于属性编辑\r\n };\r\n if (extend?.type === 'text' && extend?.text && typeof extend?.text === 'string') {\r\n formItem.formProps = {\r\n ...formItem.formProps,\r\n extend: {\r\n ...extend,\r\n text: replaceParamsValue(extend?.text, parameters),\r\n },\r\n };\r\n } else if (extend?.type === 'controlBtns' && Array.isArray(extend?.controlBtns) && extend?.controlBtns?.length > 0) {\r\n formItem.formProps = {\r\n ...formItem.formProps,\r\n extend: {\r\n ...extend,\r\n controlBtns: extend?.controlBtns,\r\n },\r\n };\r\n } else {\r\n delete formItem.formProps.extend;\r\n }\r\n if (attrItem?.compType === 'table') {\r\n const tableProps = formatTableProps({\r\n options: attrItem?.compProps,\r\n staticCodeMap,\r\n parameters,\r\n });\r\n const rowKeys = getDataArr(attrItem?.compProps?.rowKey);\r\n formItem.props = {\r\n ...formItem.props,\r\n ...tableProps,\r\n rowKey: rowKeys?.length > 0 ? rowKeys?.[rowKeys?.length - 1] : 'key',\r\n hasSelectAll: (attrItem?.compProps?.rowSelection && attrItem?.compProps?.hasSelectAll) ? attrItem?.compProps?.hasSelectAll : null,\r\n rowSelection: attrItem?.compProps?.rowSelection || { type: 'radio' },\r\n };\r\n }\r\n if (['list', 'card'].includes(attrItem?.compType)) {\r\n const resProps = formatListProps({\r\n options: attrItem?.compProps,\r\n staticCodeMap,\r\n parameters,\r\n urlPrefix,\r\n });\r\n formItem.props = {\r\n ...resProps,\r\n rowSelection: attrItem?.compProps?.rowSelection || { type: 'radio' },\r\n };\r\n }\r\n if (attrItem?.compType === 'upload') {\r\n if (\r\n attrItem?.compProps?.data &&\r\n Object.keys(attrItem?.compProps?.data)?.length > 0\r\n ) {\r\n const uploadDataParams:{[key:string]: any} = {};\r\n Object.keys(attrItem?.compProps?.data).forEach(paramsName => {\r\n if (/\\$\\{(.+?)\\}/g.test(attrItem?.compProps?.data?.[paramsName])) {\r\n // const valParamArr = getDataArr(attrItem?.compProps?.data?.[paramsName]);\r\n uploadDataParams[paramsName] = getParamsContentByParamKeys(attrItem?.compProps?.data?.[paramsName], parameters);\r\n } else {\r\n uploadDataParams[paramsName] = attrItem?.compProps?.data?.[paramsName];\r\n }\r\n });\r\n formItem.props = {\r\n ...formItem.props,\r\n data: uploadDataParams,\r\n };\r\n }\r\n if (\r\n attrItem?.compProps?.action?.url &&\r\n typeof attrItem?.compProps?.action?.url === 'string'\r\n ) {\r\n formItem.props = {\r\n ...formItem.props,\r\n action: attrItem?.compProps?.action?.url,\r\n };\r\n }\r\n }\r\n let otherRules = Array.isArray(otherAttrFormProps?.rules) ? otherAttrFormProps?.rules?.filter((item: any) => !item?.required) : [];\r\n if (attrItem?.formProps?.defaultValue) {\r\n let attrDefVal:any = '';\r\n if (attrItem?.compType === 'upload') {\r\n formItem.formProps = {\r\n ...formItem.formProps,\r\n valuePropName: 'fileList',\r\n };\r\n attrDefVal = getParamsContentByParamKeys(attrItem?.formProps?.defaultValue, parameters) || [];\r\n } else {\r\n delete formItem.formProps.valuePropName;\r\n attrDefVal = replaceParamsValue(attrItem?.formProps?.defaultValue, parameters) || '';\r\n }\r\n initValues[otherAttrFormProps?.name] = attrDefVal;\r\n }\r\n otherRules = otherRules.map((item: {[key:string]: any}) => ({\r\n pattern: item?.type === 'custom' ? patternTransitionRegExp(item?.pattern) : (\r\n formRulsRegMap?.[item?.type] || ''\r\n ),\r\n message: item?.message,\r\n }));\r\n if (typeof attrFormPropsDisplay === 'boolean' || typeof attrFormPropsDisplay === 'string') {\r\n let formItemDisplay:boolean = true;\r\n if (typeof attrFormPropsDisplay === 'boolean') {\r\n formItemDisplay = attrFormPropsDisplay;\r\n } else if (typeof attrFormPropsDisplay === 'string' && attrFormPropsDisplay) {\r\n // const scriptCodeStr = stringPramarsValTransition(attrFormPropsDisplay, parameters);\r\n const codeExtendVal = stringScriptExecution(\r\n attrFormPropsDisplay,\r\n parameters,\r\n );\r\n formItemDisplay = codeExtendVal;\r\n }\r\n formItem.display = formItemDisplay;\r\n }\r\n if (typeof required === 'boolean' || typeof required === 'string') {\r\n let formItemRequired:boolean = false;\r\n if (typeof required === 'boolean') {\r\n formItemRequired = required;\r\n } else if (typeof required === 'string' && required) {\r\n // const scriptCodeStr = stringPramarsValTransition(required, parameters);\r\n const codeExtendVal = stringScriptExecution(required, parameters);\r\n formItemRequired = typeof codeExtendVal === 'boolean' ? codeExtendVal : false;\r\n }\r\n formItem.formProps = {\r\n ...formItem.formProps,\r\n rules: formItemRequired ? [{ required: formItemRequired }, ...otherRules] : otherRules,\r\n };\r\n } else {\r\n formItem.formProps = {\r\n ...formItem.formProps,\r\n rules: otherRules,\r\n };\r\n }\r\n if (dataOptions) {\r\n const attrItemDataOptions = dataOptions || {};\r\n if (attrItemDataOptions?.staticCode) {\r\n if (\r\n attrItem?.defaultValue &&\r\n staticCodeMap?.[attrItemDataOptions?.staticCode] &&\r\n staticCodeMap?.[attrItemDataOptions?.staticCode]?.[attrItem?.defaultValue]\r\n ) {\r\n initValues[attrItem?.attrCode] = staticCodeMap?.[attrItemDataOptions?.staticCode]?.[attrItem?.defaultValue];\r\n }\r\n const formatToTreeData = (optionsItems: {[key:string]: any}[]):{[key:string]: any}[] => {\r\n if (Array.isArray(optionsItems)) {\r\n return optionsItems.map(optItem => ({\r\n title: optItem?.label,\r\n value: optItem?.value,\r\n children: formatToTreeData(optItem?.children),\r\n }));\r\n }\r\n return [];\r\n };\r\n if (attrItem?.compType === 'treeSelect') {\r\n formItem.props = {\r\n ...formItem.props,\r\n treeData: formatToTreeData(staticOptionsMap?.[attrItemDataOptions?.staticCode]),\r\n };\r\n } else {\r\n formItem.props = {\r\n ...formItem.props,\r\n options: Array.isArray(staticOptionsMap?.[attrItemDataOptions?.staticCode]) ?\r\n staticOptionsMap?.[attrItemDataOptions?.staticCode] : [],\r\n };\r\n }\r\n } else if (attrItemDataOptions?.contextOptions && parameters) {\r\n const optLabelStr = attrItemDataOptions?.contextOptions?.label;\r\n const optValueStr = attrItemDataOptions?.contextOptions?.value;\r\n const splitParamsPath = (paramsPathStr: string) => {\r\n if (typeof paramsPathStr === 'string') {\r\n const paramsPathArr = paramsPathStr.replace(/\\$\\{|\\}/g, '').split('.');\r\n return paramsPathArr?.filter((item:string, idx:number) => !(idx === 0 && item === 'root'));\r\n }\r\n return [];\r\n };\r\n if (optValueStr) {\r\n const optValArr = splitParamsPath(optValueStr);\r\n const optLabelArr = splitParamsPath(optLabelStr);\r\n const optData: any[] = Array.isArray(parameters?.[optValArr?.[0]]) ? parameters?.[optValArr?.[0]] : [];\r\n const labelApiPath: string[] = optLabelArr?.slice(2);\r\n const valApiPath: string[] = optValArr?.slice(2);\r\n \r\n formItem.props = {\r\n ...formItem.props,\r\n options: formatOptionsRecursively(optData, labelApiPath, valApiPath),\r\n };\r\n }\r\n }\r\n }\r\n formItems.push(formItem);\r\n });\r\n }\r\n if (typeof column === 'number' && column > 1) {\r\n res.formMode = 'grid';\r\n res.span = 24 / column;\r\n } else {\r\n res.formMode = 'default';\r\n delete res.span;\r\n }\r\n res.formItems = formItems;\r\n res.initialValues = initValues;\r\n return res;\r\n};\r\n\r\nexport default formatFormProps;\r\n"],
|
|
5
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,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B,2CAAa,MAAM;AAClD,kBAAM,aAAuB,uCAAW,MAAM;AAE9C,qBAAS,QAAQ;AAAA,cACf,GAAG,SAAS;AAAA,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
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/formatModule/helpers/formatHighCodeProps.ts"],
|
|
4
|
-
"sourcesContent": ["import { get } from 'lodash';\nimport stringPramarsValTransition from './stringPramarsValTransition';\nimport { getDataArr } from '../../treeUtils';\n\nexport type formatHighCodePropsPropsType = {\n options?: { [key: string]: any };\n staticCodeMap?: { [key: string]: any };\n parameters?: { [key: string]: any };\n}\n\nexport type formatHighCodePropsExportType = { [key: string]: any }\n\nconst formatHighCodeProps = ({\n options = {},\n parameters,\n}: formatHighCodePropsPropsType): formatHighCodePropsExportType => {\n const res: { [key: string]: any } = {};\n const { fileProps = {} } = options;\n const { parameters: compParams = [] } = fileProps;\n\n // 循环替换value\n const loopToGetValue = (list: any[]) => list.map(l => {\n let lt = { ...l };\n\n if (!lt.oriVal) {\n lt = { ...lt, oriVal: lt.value };\n }\n\n if (['object', 'array'].includes(lt.type)) {\n const oriValPath = getDataArr(lt.oriVal);\n lt.value = get(parameters, oriValPath);\n } else {\n lt.value = stringPramarsValTransition(lt.oriVal || '', parameters || {});\n }\n\n if (lt.children?.length) {\n lt.children = loopToGetValue(lt.children);\n }\n\n return lt;\n });\n\n // 入参配置结构转成数据结构\n const changeParamsConfigToObject: (params: any) => any = param => {\n if (!param) {\n return {};\n }\n\n // 对象\n if (param.type === 'object') {\n const obj: any = param.value instanceof Object ? param.value : {};\n param.children?.forEach((child: any) => {\n obj[child.name] = changeParamsConfigToObject(child);\n });\n return obj;\n }\n\n // 数组\n if (param.type === 'array') {\n const element = param.children?.[0];\n const arr: any[] = param.value instanceof Array ? param.value : [];\n\n if (element && arr?.length) {\n arr.forEach(arrItem => {\n if (element.type === 'object' && arrItem) {\n Object.assign(arrItem, changeParamsConfigToObject(element));\n }\n });\n }\n\n return arr;\n }\n\n // 属性\n if (param.type === 'boolean' && param.value) {\n return param.value === 'true' || param.value === '1';\n }\n\n return param.value || null;\n };\n\n const paramsObj = changeParamsConfigToObject(loopToGetValue(compParams)?.[0] || {});\n res.parameters = paramsObj;\n return res;\n};\n\n\nexport default formatHighCodeProps;\n"],
|
|
4
|
+
"sourcesContent": ["import { get } from 'lodash';\r\nimport stringPramarsValTransition from './stringPramarsValTransition';\r\nimport { getDataArr } from '../../treeUtils';\r\n\r\nexport type formatHighCodePropsPropsType = {\r\n options?: { [key: string]: any };\r\n staticCodeMap?: { [key: string]: any };\r\n parameters?: { [key: string]: any };\r\n}\r\n\r\nexport type formatHighCodePropsExportType = { [key: string]: any }\r\n\r\nconst formatHighCodeProps = ({\r\n options = {},\r\n parameters,\r\n}: formatHighCodePropsPropsType): formatHighCodePropsExportType => {\r\n const res: { [key: string]: any } = {};\r\n const { fileProps = {} } = options;\r\n const { parameters: compParams = [] } = fileProps;\r\n\r\n // 循环替换value\r\n const loopToGetValue = (list: any[]) => list.map(l => {\r\n let lt = { ...l };\r\n\r\n if (!lt.oriVal) {\r\n lt = { ...lt, oriVal: lt.value };\r\n }\r\n\r\n if (['object', 'array'].includes(lt.type)) {\r\n const oriValPath = getDataArr(lt.oriVal);\r\n lt.value = get(parameters, oriValPath);\r\n } else {\r\n lt.value = stringPramarsValTransition(lt.oriVal || '', parameters || {});\r\n }\r\n\r\n if (lt.children?.length) {\r\n lt.children = loopToGetValue(lt.children);\r\n }\r\n\r\n return lt;\r\n });\r\n\r\n // 入参配置结构转成数据结构\r\n const changeParamsConfigToObject: (params: any) => any = param => {\r\n if (!param) {\r\n return {};\r\n }\r\n\r\n // 对象\r\n if (param.type === 'object') {\r\n const obj: any = param.value instanceof Object ? param.value : {};\r\n param.children?.forEach((child: any) => {\r\n obj[child.name] = changeParamsConfigToObject(child);\r\n });\r\n return obj;\r\n }\r\n\r\n // 数组\r\n if (param.type === 'array') {\r\n const element = param.children?.[0];\r\n const arr: any[] = param.value instanceof Array ? param.value : [];\r\n\r\n if (element && arr?.length) {\r\n arr.forEach(arrItem => {\r\n if (element.type === 'object' && arrItem) {\r\n Object.assign(arrItem, changeParamsConfigToObject(element));\r\n }\r\n });\r\n }\r\n\r\n return arr;\r\n }\r\n\r\n // 属性\r\n if (param.type === 'boolean' && param.value) {\r\n return param.value === 'true' || param.value === '1';\r\n }\r\n\r\n return param.value || null;\r\n };\r\n\r\n const paramsObj = changeParamsConfigToObject(loopToGetValue(compParams)?.[0] || {});\r\n res.parameters = paramsObj;\r\n return res;\r\n};\r\n\r\n\r\nexport default formatHighCodeProps;\r\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAoB;AACpB,wCAAuC;AACvC,uBAA2B;AAU3B,IAAM,sBAAsB,CAAC;AAAA,EAC3B,UAAU,CAAC;AAAA,EACX;AACF,MAAmE;AAfnE;AAgBE,QAAM,MAA8B,CAAC;AACrC,QAAM,EAAE,YAAY,CAAC,EAAE,IAAI;AAC3B,QAAM,EAAE,YAAY,aAAa,CAAC,EAAE,IAAI;AAGxC,QAAM,iBAAiB,CAAC,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aAAa,MAAM,OAAO;AAC3C,aAAO,MAAM,UAAU,UAAU,MAAM,UAAU;AAAA,IACnD;AAEA,WAAO,MAAM,SAAS;AAAA,EACxB;AAEA,QAAM,YAAY,6BAA2B,oBAAe,UAAU,MAAzB,mBAA6B,OAAM,CAAC,CAAC;AAClF,MAAI,aAAa;AACjB,SAAO;AACT;AAGA,IAAO,8BAAQ;",
|
|
6
6
|
"names": ["_a", "stringPramarsValTransition"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/formatModule/helpers/formatImageProps.ts"],
|
|
4
|
-
"sourcesContent": ["import { getParamsContentByParamKeys } from '../../treeUtils';\nimport { getFileUrlById } from '../../file';\n\nexport type formatImagePropsType = {\n options?: {\n dataSource?: {[key:string]: any}\n }\n parameters?: {[key:string]: any};\n}\n\nconst formatImageProps = ({\n parameters,\n options = {},\n}: formatImagePropsType):{[key:string]: any} => {\n const { dataSource } = options;\n const res:{[key:string]: any} = {};\n if (\n dataSource?.dataType === 'staticData' &&\n Array.isArray(dataSource?.fileList) &&\n dataSource?.fileList.length > 0\n ) {\n res.src = getFileUrlById(dataSource?.fileList?.[0]?.fileId);\n res.alt = dataSource?.fileList?.[0]?.fileName;\n }\n if (\n dataSource?.dataType === 'context' &&\n dataSource?.fileUrl\n ) {\n res.src = getParamsContentByParamKeys(dataSource?.fileUrl, parameters) || '';\n res.alt = getParamsContentByParamKeys(dataSource?.fileDesc, parameters) || '';\n }\n return res;\n};\n\nexport default formatImageProps;\n"],
|
|
4
|
+
"sourcesContent": ["import { getParamsContentByParamKeys } from '../../treeUtils';\r\nimport { getFileUrlById } from '../../file';\r\n\r\nexport type formatImagePropsType = {\r\n options?: {\r\n dataSource?: {[key:string]: any}\r\n }\r\n parameters?: {[key:string]: any};\r\n}\r\n\r\nconst formatImageProps = ({\r\n parameters,\r\n options = {},\r\n}: formatImagePropsType):{[key:string]: any} => {\r\n const { dataSource } = options;\r\n const res:{[key:string]: any} = {};\r\n if (\r\n dataSource?.dataType === 'staticData' &&\r\n Array.isArray(dataSource?.fileList) &&\r\n dataSource?.fileList.length > 0\r\n ) {\r\n res.src = getFileUrlById(dataSource?.fileList?.[0]?.fileId);\r\n res.alt = dataSource?.fileList?.[0]?.fileName;\r\n }\r\n if (\r\n dataSource?.dataType === 'context' &&\r\n dataSource?.fileUrl\r\n ) {\r\n res.src = getParamsContentByParamKeys(dataSource?.fileUrl, parameters) || '';\r\n res.alt = getParamsContentByParamKeys(dataSource?.fileDesc, parameters) || '';\r\n }\r\n return res;\r\n};\r\n\r\nexport default formatImageProps;\r\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA4C;AAC5C,kBAA+B;AAS/B,IAAM,mBAAmB,CAAC;AAAA,EACxB;AAAA,EACA,UAAU,CAAC;AACb,MAAgD;AAbhD;AAcE,QAAM,EAAE,WAAW,IAAI;AACvB,QAAM,MAA0B,CAAC;AACjC,OACE,yCAAY,cAAa,gBACrB,MAAM,QAAQ,yCAAY,QAAQ,MAClC,yCAAY,SAAS,UAAS,GAClC;AACA,QAAI,UAAM,6BAAe,oDAAY,aAAZ,mBAAuB,OAAvB,mBAA2B,MAAM;AAC1D,QAAI,OAAM,oDAAY,aAAZ,mBAAuB,OAAvB,mBAA2B;AAAA,EACvC;AACA,OACE,yCAAY,cAAa,cACzB,yCAAY,UACZ;AACA,QAAI,UAAM,8CAA4B,yCAAY,SAAS,UAAU,KAAK;AAC1E,QAAI,UAAM,8CAA4B,yCAAY,UAAU,UAAU,KAAK;AAAA,EAC7E;AACA,SAAO;AACT;AAEA,IAAO,2BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/formatModule/helpers/formatListProps.ts"],
|
|
4
|
-
"sourcesContent": ["import { get } from 'lodash';\nimport { stringScriptExecution } from './stringScriptExecution';\nimport { getDataArr, replaceLoopBodyParamsValue, getParamsContentByParamKeys } from '../../treeUtils';\nimport { getFileUrlById } from '../../file';\n\nexport type formatListPropsType = {\n urlPrefix: string;\n options: {[key:string]: any};\n staticCodeMap: {[key:string]: any};\n parameters: {[key:string]: any};\n}\n\nexport type formatListPropsExportType = {[key: string]: any}\n\nconst formatListProps = ({\n urlPrefix,\n parameters,\n staticCodeMap,\n options: opt,\n}: formatListPropsType): formatListPropsExportType => {\n const propsRes: { [key: string]: any } = { ...opt };\n if (Array.isArray(opt?.icon) && opt?.icon?.length > 0) {\n propsRes.icon = getFileUrlById(opt?.icon?.[0]?.fileId, { prefix: urlPrefix });\n } else {\n propsRes.icon = '';\n }\n if (\n parameters &&\n Object.keys(parameters).length > 0 &&\n opt?.dataSource\n ) {\n const sourceArr = getDataArr(opt?.dataSource) || [];\n const rowKeyArr = getDataArr(opt?.rowKey) || [];\n const items = getParamsContentByParamKeys(opt?.dataSource, parameters) || [];\n propsRes.rowKey = rowKeyArr.slice(-1)?.[0];\n const stringAttrValueTransition = (attr:{[key:string]: any}, pararms: {[key:string]: any}) => {\n let nowContent:string = '';\n if (typeof attr?.defaultValue === 'string' && attr?.defaultValue && pararms) {\n nowContent = attr?.defaultValue.replace(/\\$\\{(.+?)\\}/g, (match) => {\n const paramsPath = getDataArr(match).filter((itemKey) => !sourceArr.includes(itemKey)).slice(1);\n const filedVal = get(pararms, paramsPath);\n // 如果存在静态数组,则翻译静态数据\n if (\n attr?.staticCode &&\n staticCodeMap?.[attr?.staticCode]?.[filedVal] &&\n typeof staticCodeMap?.[attr?.staticCode]?.[filedVal] === 'string'\n ) {\n return staticCodeMap?.[attr?.staticCode]?.[filedVal];\n }\n return filedVal || '';\n });\n }\n return nowContent;\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: items,\n loopSourceArr: sourceArr,\n });\n };\n if (Array.isArray(items)) {\n items.forEach((item, idx) => {\n const attrList: { [key: string]: any }[] = [];\n if (Array.isArray(opt?.attrs) && opt?.attrs.length > 0) {\n opt?.attrs.forEach((attrItem) => {\n let attrsDisplay: boolean = true;\n if (typeof attrItem?.display === 'boolean' || typeof attrItem?.display === 'string') {\n if (typeof attrItem?.display === 'boolean') {\n attrsDisplay = attrItem?.display;\n } else if (typeof attrItem?.display === 'string' && attrItem?.display) {\n const scriptParameters = Object.assign((parameters || {}), { row: item, index: idx });\n const codeExtendVal = stringScriptExecution(\n attrItem?.display,\n scriptParameters,\n );\n attrsDisplay = codeExtendVal;\n }\n }\n if (attrsDisplay) {\n const attrObj: { [key: string]: any } = {};\n if (attrItem?.style) {\n attrObj.style = attrItem?.style;\n }\n if (attrItem?.defaultValue) {\n const attrValue = stringAttrValueTransition(attrItem, item);\n attrObj.attrName = attrItem?.attrName;\n attrObj.attrCode = attrItem?.attrCode;\n attrObj.attrValue = attrValue;\n }\n attrList.push(attrObj);\n }\n });\n }\n const dataObj: { [key: string]: any } = {\n label: replaceParamsValue(opt?.itemLabel, item),\n content: replaceParamsValue(opt?.itemContent, item),\n describe: replaceParamsValue(opt?.itemDescribe, item),\n originItem: item,\n };\n if (propsRes?.rowKey) {\n dataObj[propsRes?.rowKey] = item?.[propsRes?.rowKey];\n }\n if (attrList.length > 0) {\n dataObj.attrList = attrList;\n }\n if (Array.isArray(propsRes.dataSource)) {\n propsRes.dataSource.push(dataObj);\n } else {\n propsRes.dataSource = [dataObj];\n }\n });\n }\n }\n return propsRes;\n};\n\n\nexport default formatListProps;\n"],
|
|
4
|
+
"sourcesContent": ["import { get } from 'lodash';\r\nimport { stringScriptExecution } from './stringScriptExecution';\r\nimport { getDataArr, replaceLoopBodyParamsValue, getParamsContentByParamKeys } from '../../treeUtils';\r\nimport { getFileUrlById } from '../../file';\r\n\r\nexport type formatListPropsType = {\r\n urlPrefix: string;\r\n options: {[key:string]: any};\r\n staticCodeMap: {[key:string]: any};\r\n parameters: {[key:string]: any};\r\n}\r\n\r\nexport type formatListPropsExportType = {[key: string]: any}\r\n\r\nconst formatListProps = ({\r\n urlPrefix,\r\n parameters,\r\n staticCodeMap,\r\n options: opt,\r\n}: formatListPropsType): formatListPropsExportType => {\r\n const propsRes: { [key: string]: any } = { ...opt };\r\n if (Array.isArray(opt?.icon) && opt?.icon?.length > 0) {\r\n propsRes.icon = getFileUrlById(opt?.icon?.[0]?.fileId, { prefix: urlPrefix });\r\n } else {\r\n propsRes.icon = '';\r\n }\r\n if (\r\n parameters &&\r\n Object.keys(parameters).length > 0 &&\r\n opt?.dataSource\r\n ) {\r\n const sourceArr = getDataArr(opt?.dataSource) || [];\r\n const rowKeyArr = getDataArr(opt?.rowKey) || [];\r\n const items = getParamsContentByParamKeys(opt?.dataSource, parameters) || [];\r\n propsRes.rowKey = rowKeyArr.slice(-1)?.[0];\r\n const stringAttrValueTransition = (attr:{[key:string]: any}, pararms: {[key:string]: any}) => {\r\n let nowContent:string = '';\r\n if (typeof attr?.defaultValue === 'string' && attr?.defaultValue && pararms) {\r\n nowContent = attr?.defaultValue.replace(/\\$\\{(.+?)\\}/g, (match) => {\r\n const paramsPath = getDataArr(match).filter((itemKey) => !sourceArr.includes(itemKey)).slice(1);\r\n const filedVal = get(pararms, paramsPath);\r\n // 如果存在静态数组,则翻译静态数据\r\n if (\r\n attr?.staticCode &&\r\n staticCodeMap?.[attr?.staticCode]?.[filedVal] &&\r\n typeof staticCodeMap?.[attr?.staticCode]?.[filedVal] === 'string'\r\n ) {\r\n return staticCodeMap?.[attr?.staticCode]?.[filedVal];\r\n }\r\n return filedVal || '';\r\n });\r\n }\r\n return nowContent;\r\n };\r\n const replaceParamsValue = (\r\n contentStr: string,\r\n item: { [key: string]: any },\r\n ) => {\r\n return replaceLoopBodyParamsValue(\r\n contentStr, {\r\n parameters,\r\n loopParams: item,\r\n loopData: items,\r\n loopSourceArr: sourceArr,\r\n });\r\n };\r\n if (Array.isArray(items)) {\r\n items.forEach((item, idx) => {\r\n const attrList: { [key: string]: any }[] = [];\r\n if (Array.isArray(opt?.attrs) && opt?.attrs.length > 0) {\r\n opt?.attrs.forEach((attrItem) => {\r\n let attrsDisplay: boolean = true;\r\n if (typeof attrItem?.display === 'boolean' || typeof attrItem?.display === 'string') {\r\n if (typeof attrItem?.display === 'boolean') {\r\n attrsDisplay = attrItem?.display;\r\n } else if (typeof attrItem?.display === 'string' && attrItem?.display) {\r\n const scriptParameters = Object.assign((parameters || {}), { row: item, index: idx });\r\n const codeExtendVal = stringScriptExecution(\r\n attrItem?.display,\r\n scriptParameters,\r\n );\r\n attrsDisplay = codeExtendVal;\r\n }\r\n }\r\n if (attrsDisplay) {\r\n const attrObj: { [key: string]: any } = {};\r\n if (attrItem?.style) {\r\n attrObj.style = attrItem?.style;\r\n }\r\n if (attrItem?.defaultValue) {\r\n const attrValue = stringAttrValueTransition(attrItem, item);\r\n attrObj.attrName = attrItem?.attrName;\r\n attrObj.attrCode = attrItem?.attrCode;\r\n attrObj.attrValue = attrValue;\r\n }\r\n attrList.push(attrObj);\r\n }\r\n });\r\n }\r\n const dataObj: { [key: string]: any } = {\r\n label: replaceParamsValue(opt?.itemLabel, item),\r\n content: replaceParamsValue(opt?.itemContent, item),\r\n describe: replaceParamsValue(opt?.itemDescribe, item),\r\n originItem: item,\r\n };\r\n if (propsRes?.rowKey) {\r\n dataObj[propsRes?.rowKey] = item?.[propsRes?.rowKey];\r\n }\r\n if (attrList.length > 0) {\r\n dataObj.attrList = attrList;\r\n }\r\n if (Array.isArray(propsRes.dataSource)) {\r\n propsRes.dataSource.push(dataObj);\r\n } else {\r\n propsRes.dataSource = [dataObj];\r\n }\r\n });\r\n }\r\n }\r\n return propsRes;\r\n};\r\n\r\n\r\nexport default formatListProps;\r\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AA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mBAAmB,2BAAK,WAAW,IAAI;AAAA,UAC9C,SAAS,mBAAmB,2BAAK,aAAa,IAAI;AAAA,UAClD,UAAU,mBAAmB,2BAAK,cAAc,IAAI;AAAA,UACpD,YAAY;AAAA,QACd;AACA,YAAI,qCAAU,QAAQ;AACpB,kBAAQ,qCAAU,MAAM,IAAI,6BAAO,qCAAU;AAAA,QAC/C;AACA,YAAI,SAAS,SAAS,GAAG;AACvB,kBAAQ,WAAW;AAAA,QACrB;AACA,YAAI,MAAM,QAAQ,SAAS,UAAU,GAAG;AACtC,mBAAS,WAAW,KAAK,OAAO;AAAA,QAClC,OAAO;AACL,mBAAS,aAAa,CAAC,OAAO;AAAA,QAChC;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO;AACT;AAGA,IAAO,0BAAQ;",
|
|
6
6
|
"names": ["_a", "_b", "_c"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/formatModule/helpers/formatLoopProps.ts"],
|
|
4
|
-
"sourcesContent": ["import { getDataArr } from '../../treeUtils';\nimport { get } from 'lodash';\n\nexport type formatLoopPropsType = {\n options?: {\n dataSource?: string;\n }\n staticCodeMap?: {[key:string]: any};\n parameters?: {[key:string]: any};\n}\n\nexport type formatLoopPropsExportType = {\n dataSource: {[key: string]: any}[]\n}\n\nconst formatLoopProps = ({\n parameters,\n options = {},\n}: formatLoopPropsType): formatLoopPropsExportType => {\n const {\n dataSource,\n } = options;\n let dataList:{[key:string]: any}[] = [];\n if (dataSource) {\n const dataSourceArr = getDataArr(dataSource);\n if (parameters) {\n const dataSourceList = get(\n parameters,\n dataSourceArr,\n );\n if (Array.isArray(dataSourceList)) {\n dataList = dataSourceList;\n }\n }\n }\n return {\n dataSource: dataList,\n };\n};\n\nexport default formatLoopProps;\n"],
|
|
4
|
+
"sourcesContent": ["import { getDataArr } from '../../treeUtils';\r\nimport { get } from 'lodash';\r\n\r\nexport type formatLoopPropsType = {\r\n options?: {\r\n dataSource?: string;\r\n }\r\n staticCodeMap?: {[key:string]: any};\r\n parameters?: {[key:string]: any};\r\n}\r\n\r\nexport type formatLoopPropsExportType = {\r\n dataSource: {[key: string]: any}[]\r\n}\r\n\r\nconst formatLoopProps = ({\r\n parameters,\r\n options = {},\r\n}: formatLoopPropsType): formatLoopPropsExportType => {\r\n const {\r\n dataSource,\r\n } = options;\r\n let dataList:{[key:string]: any}[] = [];\r\n if (dataSource) {\r\n const dataSourceArr = getDataArr(dataSource);\r\n if (parameters) {\r\n const dataSourceList = get(\r\n parameters,\r\n dataSourceArr,\r\n );\r\n if (Array.isArray(dataSourceList)) {\r\n dataList = dataSourceList;\r\n }\r\n }\r\n }\r\n return {\r\n dataSource: dataList,\r\n };\r\n};\r\n\r\nexport default formatLoopProps;\r\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA2B;AAC3B,oBAAoB;AAcpB,IAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA,UAAU,CAAC;AACb,MAAsD;AACpD,QAAM;AAAA,IACJ;AAAA,EACF,IAAI;AACJ,MAAI,WAAiC,CAAC;AACtC,MAAI,YAAY;AACd,UAAM,oBAAgB,6BAAW,UAAU;AAC3C,QAAI,YAAY;AACd,YAAM,qBAAiB;AAAA,QACrB;AAAA,QACA;AAAA,MACF;AACA,UAAI,MAAM,QAAQ,cAAc,GAAG;AACjC,mBAAW;AAAA,MACb;AAAA,IACF;AAAA,EACF;AACA,SAAO;AAAA,IACL,YAAY;AAAA,EACd;AACF;AAEA,IAAO,0BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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"],
|
|
4
|
+
"sourcesContent": ["import { getDataArr, replaceLoopBodyParamsValue } from '../../treeUtils';\r\nimport { get } from 'lodash';\r\n\r\nexport type formatImagePropsType = {\r\n options?: {\r\n dataSource?: string,\r\n title?: string,\r\n description?: string,\r\n status?: string,\r\n size?: string,\r\n direction?: string,\r\n statusMap?: {\r\n wait?: string,\r\n process?: string,\r\n finish?: string,\r\n error?: string,\r\n }\r\n }\r\n parameters?: {[key:string]: any};\r\n}\r\n\r\nconst formatStepsProps = ({\r\n parameters,\r\n options = {},\r\n}: formatImagePropsType):{[key:string]: any} => {\r\n const {\r\n dataSource,\r\n title,\r\n description,\r\n status,\r\n direction,\r\n statusMap,\r\n } = options;\r\n const res:{[key:string]: any} = {\r\n size: 'small',\r\n };\r\n\r\n if (dataSource) {\r\n const dataSourceArr = getDataArr(dataSource);\r\n if (parameters) {\r\n const dataSourceList = get(\r\n parameters,\r\n dataSourceArr,\r\n );\r\n\r\n const replaceParamsValue = (\r\n contentStr: string,\r\n item: { [key: string]: any },\r\n ) => {\r\n return replaceLoopBodyParamsValue(\r\n contentStr, {\r\n parameters,\r\n loopParams: item,\r\n loopData: dataSourceList,\r\n loopSourceArr: dataSourceArr,\r\n });\r\n };\r\n if (Array.isArray(dataSourceList)) {\r\n res.items = dataSourceList.map(item => {\r\n // 获取状态值\r\n let recordStatus = status && replaceParamsValue(status, item) ? replaceParamsValue(status, item) : '';\r\n // 根据状态映射,转换状态值为步骤状态\r\n if (statusMap && Object.keys(statusMap).length > 0) {\r\n Object.keys(statusMap).forEach(key => {\r\n const statusValue = `${statusMap?.[key as keyof typeof statusMap]}` || '';\r\n if (recordStatus && statusValue && `${recordStatus}` === statusValue) {\r\n recordStatus = key;\r\n }\r\n });\r\n }\r\n return ({\r\n title: title ? replaceParamsValue(title, item) : '',\r\n description: description ? replaceParamsValue(description, item) : '',\r\n status: recordStatus || 'default',\r\n });\r\n });\r\n }\r\n }\r\n if (direction === 'horizontal') {\r\n res.labelPlacement = 'vertical';\r\n } else if (res?.labelPlacement) {\r\n delete res.labelPlacement;\r\n }\r\n }\r\n return res;\r\n};\r\n\r\nexport default formatStepsProps;\r\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;AAA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B;AAC9B,aAAO,IAAI;AAAA,IACb;AAAA,EACF;AACA,SAAO;AACT;AAEA,IAAO,2BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/formatModule/helpers/formatStyleProps.ts"],
|
|
4
|
-
"sourcesContent": ["import { cloneDeep } from 'lodash';\n\nconst formatStyleProps = (props: {[key:string]: any}, parentModuleProps?: {[key:string]: any}|null):{[key:string]: any} => {\n const cloneProps: {[key:string]: any} = props ? cloneDeep(props) : {};\n const { compProps = {} } = cloneProps;\n const { style = {} } = compProps || {};\n\n const alignKey1 = ['column', 'column-reverse'].includes(style?.['flex-direction']) ? 'alignItems' : 'justifyContent';\n const alignKey2 = !style?.['flex-direction'] || ['row', 'row-reverse'].includes(style?.['flex-direction']) ? 'alignItems' : 'justifyContent';\n const alignStyleMap:{[key:string]: {[key:string]: string}} = {\n leftTop: {\n [alignKey1]: 'flex-start',\n [alignKey2]: 'flex-start',\n },\n topCenter: {\n [alignKey1]: 'center',\n [alignKey2]: 'flex-start',\n },\n rightTop: {\n [alignKey1]: 'flex-end',\n [alignKey2]: 'flex-start',\n },\n leftCenter: {\n [alignKey1]: 'flex-start',\n [alignKey2]: 'center',\n },\n center: {\n [alignKey1]: 'center',\n [alignKey2]: 'center',\n },\n rightCenter: {\n [alignKey1]: 'flex-end',\n [alignKey2]: 'center',\n },\n leftBottom: {\n [alignKey1]: 'flex-start',\n [alignKey2]: 'flex-end',\n },\n bottomCenter: {\n [alignKey1]: 'center',\n [alignKey2]: 'flex-end',\n },\n rightBottom: {\n [alignKey1]: 'flex-end',\n [alignKey2]: 'flex-end',\n },\n };\n\n const styleObj:{[key:string]: any} = {};\n if (compProps.style && Object.keys(compProps.style)?.length > 0) {\n Object.keys(compProps.style).forEach(styleKey => {\n if (compProps.style?.[styleKey]) {\n if (['padding', 'margin'].includes(styleKey)) {\n styleObj[styleKey] = Array.isArray(compProps.style?.[styleKey]) ?\n compProps.style?.[styleKey].join(' ') : compProps.style?.[styleKey];\n } else if (!['gridColumns', 'alignMode'].includes(styleKey)) {\n styleObj[styleKey] = compProps.style?.[styleKey];\n }\n }\n });\n }\n\n if (parentModuleProps?.compProps?.style?.display === 'flex' && !compProps.style?.width) {\n styleObj.flex = '1';\n } else if (styleObj?.flex) {\n delete styleObj.flex;\n }\n\n if (compProps?.style?.display === 'grid') {\n const _gridColumns:string[] = [];\n if (Array.isArray(props?.children)) {\n props?.children.forEach((col:any) => {\n if (col?.compProps?.style?.width) {\n _gridColumns.push(col.compProps.style.width);\n } else {\n _gridColumns.push('1fr');\n }\n });\n }\n if (compProps?.style?.gridColumns > 1) {\n styleObj['grid-template-columns'] = `repeat(${compProps.style.gridColumns}, minmax(0, ${Math.ceil(100 / compProps?.style?.gridColumns)}%))`;\n } else if (_gridColumns?.length > 0) {\n styleObj['grid-template-columns'] = `${_gridColumns.join(' ')}`;\n } else if (compProps.style.gridColumns > 1) {\n styleObj['grid-template-columns'] = `repeat(${compProps.style.gridColumns}, 1fr)`;\n }\n } else if (styleObj['grid-template-columns']) {\n delete styleObj['grid-template-columns'];\n }\n \n return {\n ...styleObj,\n ...(alignStyleMap[style?.alignMode] || {}),\n };\n};\n\nexport default formatStyleProps;\n"],
|
|
4
|
+
"sourcesContent": ["import { cloneDeep } from 'lodash';\r\n\r\nconst formatStyleProps = (props: {[key:string]: any}, parentModuleProps?: {[key:string]: any}|null):{[key:string]: any} => {\r\n const cloneProps: {[key:string]: any} = props ? cloneDeep(props) : {};\r\n const { compProps = {} } = cloneProps;\r\n const { style = {} } = compProps || {};\r\n\r\n const alignKey1 = ['column', 'column-reverse'].includes(style?.['flex-direction']) ? 'alignItems' : 'justifyContent';\r\n const alignKey2 = !style?.['flex-direction'] || ['row', 'row-reverse'].includes(style?.['flex-direction']) ? 'alignItems' : 'justifyContent';\r\n const alignStyleMap:{[key:string]: {[key:string]: string}} = {\r\n leftTop: {\r\n [alignKey1]: 'flex-start',\r\n [alignKey2]: 'flex-start',\r\n },\r\n topCenter: {\r\n [alignKey1]: 'center',\r\n [alignKey2]: 'flex-start',\r\n },\r\n rightTop: {\r\n [alignKey1]: 'flex-end',\r\n [alignKey2]: 'flex-start',\r\n },\r\n leftCenter: {\r\n [alignKey1]: 'flex-start',\r\n [alignKey2]: 'center',\r\n },\r\n center: {\r\n [alignKey1]: 'center',\r\n [alignKey2]: 'center',\r\n },\r\n rightCenter: {\r\n [alignKey1]: 'flex-end',\r\n [alignKey2]: 'center',\r\n },\r\n leftBottom: {\r\n [alignKey1]: 'flex-start',\r\n [alignKey2]: 'flex-end',\r\n },\r\n bottomCenter: {\r\n [alignKey1]: 'center',\r\n [alignKey2]: 'flex-end',\r\n },\r\n rightBottom: {\r\n [alignKey1]: 'flex-end',\r\n [alignKey2]: 'flex-end',\r\n },\r\n };\r\n\r\n const styleObj:{[key:string]: any} = {};\r\n if (compProps.style && Object.keys(compProps.style)?.length > 0) {\r\n Object.keys(compProps.style).forEach(styleKey => {\r\n if (compProps.style?.[styleKey]) {\r\n if (['padding', 'margin'].includes(styleKey)) {\r\n styleObj[styleKey] = Array.isArray(compProps.style?.[styleKey]) ?\r\n compProps.style?.[styleKey].join(' ') : compProps.style?.[styleKey];\r\n } else if (!['gridColumns', 'alignMode'].includes(styleKey)) {\r\n styleObj[styleKey] = compProps.style?.[styleKey];\r\n }\r\n }\r\n });\r\n }\r\n\r\n if (parentModuleProps?.compProps?.style?.display === 'flex' && !compProps.style?.width) {\r\n styleObj.flex = '1';\r\n } else if (styleObj?.flex) {\r\n delete styleObj.flex;\r\n }\r\n\r\n if (compProps?.style?.display === 'grid') {\r\n const _gridColumns:string[] = [];\r\n if (Array.isArray(props?.children)) {\r\n props?.children.forEach((col:any) => {\r\n if (col?.compProps?.style?.width) {\r\n _gridColumns.push(col.compProps.style.width);\r\n } else {\r\n _gridColumns.push('1fr');\r\n }\r\n });\r\n }\r\n if (compProps?.style?.gridColumns > 1) {\r\n styleObj['grid-template-columns'] = `repeat(${compProps.style.gridColumns}, minmax(0, ${Math.ceil(100 / compProps?.style?.gridColumns)}%))`;\r\n } else if (_gridColumns?.length > 0) {\r\n styleObj['grid-template-columns'] = `${_gridColumns.join(' ')}`;\r\n } else if (compProps.style.gridColumns > 1) {\r\n styleObj['grid-template-columns'] = `repeat(${compProps.style.gridColumns}, 1fr)`;\r\n }\r\n } else if (styleObj['grid-template-columns']) {\r\n delete styleObj['grid-template-columns'];\r\n }\r\n \r\n return {\r\n ...styleObj,\r\n ...(alignStyleMap[style?.alignMode] || {}),\r\n };\r\n};\r\n\r\nexport default formatStyleProps;\r\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA0B;AAE1B,IAAM,mBAAmB,CAAC,OAA4B,sBAAqE;AAF3H;AAGE,QAAM,aAAkC,YAAQ,yBAAU,KAAK,IAAI,CAAC;AACpE,QAAM,EAAE,YAAY,CAAC,EAAE,IAAI;AAC3B,QAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,aAAa,CAAC;AAErC,QAAM,YAAY,CAAC,UAAU,gBAAgB,EAAE,SAAS,+BAAQ,iBAAiB,IAAI,eAAe;AACpG,QAAM,YAAY,EAAC,+BAAQ,sBAAqB,CAAC,OAAO,aAAa,EAAE,SAAS,+BAAQ,iBAAiB,IAAI,eAAe;AAC5H,QAAM,gBAAuD;AAAA,IAC3D,SAAS;AAAA,MACP,CAAC,SAAS,GAAG;AAAA,MACb,CAAC,SAAS,GAAG;AAAA,IACf;AAAA,IACA,WAAW;AAAA,MACT,CAAC,SAAS,GAAG;AAAA,MACb,CAAC,SAAS,GAAG;AAAA,IACf;AAAA,IACA,UAAU;AAAA,MACR,CAAC,SAAS,GAAG;AAAA,MACb,CAAC,SAAS,GAAG;AAAA,IACf;AAAA,IACA,YAAY;AAAA,MACV,CAAC,SAAS,GAAG;AAAA,MACb,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AACtF,aAAS,OAAO;AAAA,EAClB,WAAW,qCAAU,MAAM;AACzB,WAAO,SAAS;AAAA,EAClB;AAEA,QAAI,4CAAW,UAAX,mBAAkB,aAAY,QAAQ;AACxC,UAAM,eAAwB,CAAC;AAC/B,QAAI,MAAM,QAAQ,+BAAO,QAAQ,GAAG;AAClC,qCAAO,SAAS,QAAQ,CAAC,QAAY;AAvE3C,YAAAJ,KAAAC;AAwEQ,aAAIA,OAAAD,MAAA,2BAAK,cAAL,gBAAAA,IAAgB,UAAhB,gBAAAC,IAAuB,OAAO;AAChC,uBAAa,KAAK,IAAI,UAAU,MAAM,KAAK;AAAA,QAC7C,OAAO;AACL,uBAAa,KAAK,KAAK;AAAA,QACzB;AAAA,MACF;AAAA,IACF;AACA,UAAI,4CAAW,UAAX,mBAAkB,eAAc,GAAG;AACrC,eAAS,uBAAuB,IAAI,UAAU,UAAU,MAAM,0BAA0B,KAAK,KAAK,QAAM,4CAAW,UAAX,mBAAkB,YAAW;AAAA,IACvI,YAAW,6CAAc,UAAS,GAAG;AACnC,eAAS,uBAAuB,IAAI,GAAG,aAAa,KAAK,GAAG;AAAA,IAC9D,WAAW,UAAU,MAAM,cAAc,GAAG;AAC1C,eAAS,uBAAuB,IAAI,UAAU,UAAU,MAAM;AAAA,IAChE;AAAA,EACF,WAAW,SAAS,uBAAuB,GAAG;AAC5C,WAAO,SAAS,uBAAuB;AAAA,EACzC;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAI,cAAc,+BAAO,SAAS,KAAK,CAAC;AAAA,EAC1C;AACF;AAEA,IAAO,2BAAQ;",
|
|
6
6
|
"names": ["_a", "_b", "_c", "_d", "_e"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/formatModule/helpers/formatTableProps.ts"],
|
|
4
|
-
"sourcesContent": ["import { getDataArr } from '../../treeUtils';\nimport { stringScriptExecution } from './stringScriptExecution';\n// import stringPramarsValTransition from './stringPramarsValTransition';\nimport { get } from 'lodash';\n\nexport type formatTablePropsType = {\n options?: {\n attrs?: {[key:string]: any}[];\n columns?: {[key: string]: any}[];\n dataSource?: string;\n columnWidth?: string;\n columnMinWidth?: string;\n columnMaxWidth?: string;\n tableBodyHeight?: string;\n }\n staticCodeMap?: {[key:string]: any};\n parameters?: {[key:string]: any};\n}\n\nexport type formatTablePropsExportType = {\n columns: {[key: string]: any}[]\n dataSource: {[key: string]: any}[]\n scroll?: { y?: string, x?: string };\n}\n\nconst formatTableProps = ({\n staticCodeMap,\n parameters,\n options = {},\n}: formatTablePropsType): formatTablePropsExportType => {\n const {\n attrs,\n dataSource,\n columns,\n columnWidth,\n columnMinWidth,\n columnMaxWidth,\n tableBodyHeight,\n } = options;\n const _columns: {[key: string]: any}[] = [];\n let dataList: {[key: string]: any}[] = [];\n let scroll: { y?: string, x?: string } = {};\n\n if (typeof columns === 'string' && columns) {\n const columnsArr = getDataArr(columns);\n const columnsList = get(\n parameters,\n columnsArr,\n );\n if (Array.isArray(columnsList)) {\n columnsList.forEach((colItem) => {\n const colObj: { [key: string]: any } = {\n key: colItem?.dataIndex,\n title: colItem?.title,\n dataIndex: colItem?.dataIndex,\n };\n const colWidth = colItem?.width || columnWidth;\n const colMinWidth = colItem?.minWidth || columnMinWidth;\n const colMaxWidth = colItem?.maxWidth || columnMaxWidth;\n if (colWidth) {\n colObj.style = {\n ...(colObj.style || {}),\n width: colWidth,\n };\n }\n if (colMinWidth) {\n colObj.style = {\n ...(colObj.style || {}),\n minWidth: colMinWidth,\n };\n }\n if (colMaxWidth) {\n colObj.style = {\n ...(colObj.style || {}),\n maxWidth: colMaxWidth,\n };\n }\n _columns.push(colObj);\n });\n }\n } else if (Array.isArray(attrs) && attrs.length > 0) {\n attrs.forEach((attrItem) => {\n let attrsDisplay: boolean = true;\n if (typeof attrItem?.display === 'boolean' || typeof attrItem?.display === 'string') {\n if (typeof attrItem?.display === 'boolean') {\n attrsDisplay = attrItem?.display;\n } else if (typeof attrItem?.display === 'string' && attrItem?.display) {\n // const scriptCodeStr = stringPramarsValTransition(attrItem?.display, parameters || {});\n const codeExtendVal = stringScriptExecution(\n attrItem?.display,\n parameters || {},\n );\n attrsDisplay = codeExtendVal;\n }\n }\n\n if (attrsDisplay) {\n const colObj: { [key: string]: any } = {\n key: attrItem?.attrCode,\n title: attrItem?.attrName,\n };\n const colWidth = attrItem?.attrWidth || columnWidth;\n const colMinWidth = attrItem?.attrMinWidth || columnMinWidth;\n const colMaxWidth = attrItem?.attrMaxWidth || columnMaxWidth;\n if (typeof attrItem?.attrWidth === 'string') {\n colObj.width = attrItem?.attrWidth;\n }\n if (colWidth) {\n colObj.style = {\n ...(colObj.style || {}),\n width: colWidth,\n };\n }\n if (colMinWidth) {\n colObj.style = {\n ...(colObj.style || {}),\n minWidth: colMinWidth,\n };\n }\n if (colMaxWidth) {\n colObj.style = {\n ...(colObj.style || {}),\n maxWidth: colMaxWidth,\n };\n }\n const dataIndexArr = getDataArr(attrItem?.defaultValue);\n if (Array.isArray(dataIndexArr) && dataIndexArr.length > 0) {\n colObj.dataIndex = dataIndexArr.slice(-1)?.[0];\n }\n if (\n attrItem?.staticCode &&\n staticCodeMap?.[attrItem?.staticCode]\n ) {\n colObj.render = (val: string) => {\n return staticCodeMap?.[attrItem?.staticCode]?.[val] || val;\n };\n }\n _columns.push(colObj);\n }\n });\n }\n if (dataSource) {\n const dataSourceArr = getDataArr(dataSource);\n if (parameters) {\n const dataSourceList = get(\n parameters,\n dataSourceArr,\n );\n if (Array.isArray(dataSourceList)) {\n dataList = dataSourceList;\n }\n }\n }\n if (typeof tableBodyHeight === 'string' && tableBodyHeight) {\n scroll = {\n y: tableBodyHeight,\n };\n }\n return {\n columns: _columns,\n dataSource: dataList,\n scroll,\n };\n};\n\nexport default formatTableProps;\n"],
|
|
4
|
+
"sourcesContent": ["import { getDataArr } from '../../treeUtils';\r\nimport { stringScriptExecution } from './stringScriptExecution';\r\n// import stringPramarsValTransition from './stringPramarsValTransition';\r\nimport { get } from 'lodash';\r\n\r\nexport type formatTablePropsType = {\r\n options?: {\r\n attrs?: {[key:string]: any}[];\r\n columns?: {[key: string]: any}[];\r\n dataSource?: string;\r\n columnWidth?: string;\r\n columnMinWidth?: string;\r\n columnMaxWidth?: string;\r\n tableBodyHeight?: string;\r\n }\r\n staticCodeMap?: {[key:string]: any};\r\n parameters?: {[key:string]: any};\r\n}\r\n\r\nexport type formatTablePropsExportType = {\r\n columns: {[key: string]: any}[]\r\n dataSource: {[key: string]: any}[]\r\n scroll?: { y?: string, x?: string };\r\n}\r\n\r\nconst formatTableProps = ({\r\n staticCodeMap,\r\n parameters,\r\n options = {},\r\n}: formatTablePropsType): formatTablePropsExportType => {\r\n const {\r\n attrs,\r\n dataSource,\r\n columns,\r\n columnWidth,\r\n columnMinWidth,\r\n columnMaxWidth,\r\n tableBodyHeight,\r\n } = options;\r\n const _columns: {[key: string]: any}[] = [];\r\n let dataList: {[key: string]: any}[] = [];\r\n let scroll: { y?: string, x?: string } = {};\r\n\r\n if (typeof columns === 'string' && columns) {\r\n const columnsArr = getDataArr(columns);\r\n const columnsList = get(\r\n parameters,\r\n columnsArr,\r\n );\r\n if (Array.isArray(columnsList)) {\r\n columnsList.forEach((colItem) => {\r\n const colObj: { [key: string]: any } = {\r\n key: colItem?.dataIndex,\r\n title: colItem?.title,\r\n dataIndex: colItem?.dataIndex,\r\n };\r\n const colWidth = colItem?.width || columnWidth;\r\n const colMinWidth = colItem?.minWidth || columnMinWidth;\r\n const colMaxWidth = colItem?.maxWidth || columnMaxWidth;\r\n if (colWidth) {\r\n colObj.style = {\r\n ...(colObj.style || {}),\r\n width: colWidth,\r\n };\r\n }\r\n if (colMinWidth) {\r\n colObj.style = {\r\n ...(colObj.style || {}),\r\n minWidth: colMinWidth,\r\n };\r\n }\r\n if (colMaxWidth) {\r\n colObj.style = {\r\n ...(colObj.style || {}),\r\n maxWidth: colMaxWidth,\r\n };\r\n }\r\n _columns.push(colObj);\r\n });\r\n }\r\n } else if (Array.isArray(attrs) && attrs.length > 0) {\r\n attrs.forEach((attrItem) => {\r\n let attrsDisplay: boolean = true;\r\n if (typeof attrItem?.display === 'boolean' || typeof attrItem?.display === 'string') {\r\n if (typeof attrItem?.display === 'boolean') {\r\n attrsDisplay = attrItem?.display;\r\n } else if (typeof attrItem?.display === 'string' && attrItem?.display) {\r\n // const scriptCodeStr = stringPramarsValTransition(attrItem?.display, parameters || {});\r\n const codeExtendVal = stringScriptExecution(\r\n attrItem?.display,\r\n parameters || {},\r\n );\r\n attrsDisplay = codeExtendVal;\r\n }\r\n }\r\n\r\n if (attrsDisplay) {\r\n const colObj: { [key: string]: any } = {\r\n key: attrItem?.attrCode,\r\n title: attrItem?.attrName,\r\n };\r\n const colWidth = attrItem?.attrWidth || columnWidth;\r\n const colMinWidth = attrItem?.attrMinWidth || columnMinWidth;\r\n const colMaxWidth = attrItem?.attrMaxWidth || columnMaxWidth;\r\n if (typeof attrItem?.attrWidth === 'string') {\r\n colObj.width = attrItem?.attrWidth;\r\n }\r\n if (colWidth) {\r\n colObj.style = {\r\n ...(colObj.style || {}),\r\n width: colWidth,\r\n };\r\n }\r\n if (colMinWidth) {\r\n colObj.style = {\r\n ...(colObj.style || {}),\r\n minWidth: colMinWidth,\r\n };\r\n }\r\n if (colMaxWidth) {\r\n colObj.style = {\r\n ...(colObj.style || {}),\r\n maxWidth: colMaxWidth,\r\n };\r\n }\r\n const dataIndexArr = getDataArr(attrItem?.defaultValue);\r\n if (Array.isArray(dataIndexArr) && dataIndexArr.length > 0) {\r\n colObj.dataIndex = dataIndexArr.slice(-1)?.[0];\r\n }\r\n if (\r\n attrItem?.staticCode &&\r\n staticCodeMap?.[attrItem?.staticCode]\r\n ) {\r\n colObj.render = (val: string) => {\r\n return staticCodeMap?.[attrItem?.staticCode]?.[val] || val;\r\n };\r\n }\r\n _columns.push(colObj);\r\n }\r\n });\r\n }\r\n if (dataSource) {\r\n const dataSourceArr = getDataArr(dataSource);\r\n if (parameters) {\r\n const dataSourceList = get(\r\n parameters,\r\n dataSourceArr,\r\n );\r\n if (Array.isArray(dataSourceList)) {\r\n dataList = dataSourceList;\r\n }\r\n }\r\n }\r\n if (typeof tableBodyHeight === 'string' && tableBodyHeight) {\r\n scroll = {\r\n y: tableBodyHeight,\r\n };\r\n }\r\n return {\r\n columns: _columns,\r\n dataSource: dataList,\r\n scroll,\r\n };\r\n};\r\n\r\nexport default formatTableProps;\r\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA2B;AAC3B,mCAAsC;AAEtC,oBAAoB;AAsBpB,IAAM,mBAAmB,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,EACA,UAAU,CAAC;AACb,MAAwD;AACtD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,WAAmC,CAAC;AAC1C,MAAI,WAAmC,CAAC;AACxC,MAAI,SAAqC,CAAC;AAE1C,MAAI,OAAO,YAAY,YAAY,SAAS;AAC1C,UAAM,iBAAa,6BAAW,OAAO;AACrC,UAAM,kBAAc;AAAA,MAClB;AAAA,MACA;AAAA,IACF;AACA,QAAI,MAAM,QAAQ,WAAW,GAAG;AAC9B,kBAAY,QAAQ,CAAC,YAAY;AAC/B,cAAM,SAAiC;AAAA,UACrC,KAAK,mCAAS;AAAA,UACd,OAAO,mCAAS;AAAA,UAChB,WAAW,mCAAS;AAAA,QACtB;AACA,cAAM,YAAW,mCAAS,UAAS;AACnC,cAAM,eAAc,mCAAS,aAAY;AACzC,cAAM,eAAc,mCAAS,aAAY;AACzC,YAAI,UAAU;AACZ,iBAAO,QAAQ;AAAA,YACb,GAAI,OAAO,SAAS,CAAC;AAAA,YACrB,OAAO;AAAA,UACT;AAAA,QACF;AACA,YAAI,aAAa;AAC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AS,CAAC;AAAA,YACrB,UAAU;AAAA,UACZ;AAAA,QACF;AACA,cAAM,mBAAe,6BAAW,qCAAU,YAAY;AACtD,YAAI,MAAM,QAAQ,YAAY,KAAK,aAAa,SAAS,GAAG;AAC1D,iBAAO,aAAY,kBAAa,MAAM,EAAE,MAArB,mBAAyB;AAAA,QAC9C;AACA,aACE,qCAAU,gBACJ,+CAAgB,qCAAU,cAChC;AACA,iBAAO,SAAS,CAAC,QAAgB;AArI3C,gBAAAA;AAsIY,qBAAOA,MAAA,+CAAgB,qCAAU,gBAA1B,gBAAAA,IAAwC,SAAQ;AAAA,UACzD;AAAA,QACF;AACA,iBAAS,KAAK,MAAM;AAAA,MACtB;AAAA,IACF,CAAC;AAAA,EACH;AACA,MAAI,YAAY;AACd,UAAM,oBAAgB,6BAAW,UAAU;AAC3C,QAAI,YAAY;AACd,YAAM,qBAAiB;AAAA,QACrB;AAAA,QACA;AAAA,MACF;AACA,UAAI,MAAM,QAAQ,cAAc,GAAG;AACjC,mBAAW;AAAA,MACb;AAAA,IACF;AAAA,EACF;AACA,MAAI,OAAO,oBAAoB,YAAY,iBAAiB;AAC1D,aAAS;AAAA,MACP,GAAG;AAAA,IACL;AAAA,EACF;AACA,SAAO;AAAA,IACL,SAAS;AAAA,IACT,YAAY;AAAA,IACZ;AAAA,EACF;AACF;AAEA,IAAO,2BAAQ;",
|
|
6
6
|
"names": ["_a"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/formatModule/helpers/index.ts"],
|
|
4
|
-
"sourcesContent": ["import stringPramarsValTransition from './stringPramarsValTransition';\nimport patternTransitionRegExp from './patternTransitionRegExp';\nimport staticCodeAssemble from './staticCodeAssemble';\nimport formatTableProps from './formatTableProps';\nimport formatListProps from './formatListProps';\nimport formatImageProps from './formatImageProps';\nimport formatCarouselProps from './formatCarouselProps';\nimport formatDescriptionsProps from './formatDescriptionsProps';\nimport formatHighCodeProps from './formatHighCodeProps';\nimport formatFormProps from './formatFormProps';\nimport formatEchartLineProps from './formatEchartLineProps';\nimport formatEchartPieProps from './formatEchartPieProps';\nimport formatChartsProps from './formatChartsProps';\nimport formatLoopProps from './formatLoopProps';\nimport formatStyleProps from './formatStyleProps';\nimport formatStepsProps from './formatStepsProps';\nimport formRulsRegMap from './formRulsRegMap';\nimport urlPrefix from './urlPrefix';\nimport { stringScriptExecution } from './stringScriptExecution';\n\nexport {\n urlPrefix,\n formRulsRegMap,\n formatListProps,\n formatTableProps,\n formatCarouselProps,\n formatImageProps,\n formatDescriptionsProps,\n formatFormProps,\n formatHighCodeProps,\n formatEchartLineProps,\n formatEchartPieProps,\n formatChartsProps,\n formatLoopProps,\n formatStyleProps,\n formatStepsProps,\n staticCodeAssemble,\n patternTransitionRegExp,\n stringPramarsValTransition,\n stringScriptExecution,\n};\n"],
|
|
4
|
+
"sourcesContent": ["import stringPramarsValTransition from './stringPramarsValTransition';\r\nimport patternTransitionRegExp from './patternTransitionRegExp';\r\nimport staticCodeAssemble from './staticCodeAssemble';\r\nimport formatTableProps from './formatTableProps';\r\nimport formatListProps from './formatListProps';\r\nimport formatImageProps from './formatImageProps';\r\nimport formatCarouselProps from './formatCarouselProps';\r\nimport formatDescriptionsProps from './formatDescriptionsProps';\r\nimport formatHighCodeProps from './formatHighCodeProps';\r\nimport formatFormProps from './formatFormProps';\r\nimport formatEchartLineProps from './formatEchartLineProps';\r\nimport formatEchartPieProps from './formatEchartPieProps';\r\nimport formatChartsProps from './formatChartsProps';\r\nimport formatLoopProps from './formatLoopProps';\r\nimport formatStyleProps from './formatStyleProps';\r\nimport formatStepsProps from './formatStepsProps';\r\nimport formRulsRegMap from './formRulsRegMap';\r\nimport urlPrefix from './urlPrefix';\r\nimport { stringScriptExecution } from './stringScriptExecution';\r\n\r\nexport {\r\n urlPrefix,\r\n formRulsRegMap,\r\n formatListProps,\r\n formatTableProps,\r\n formatCarouselProps,\r\n formatImageProps,\r\n formatDescriptionsProps,\r\n formatFormProps,\r\n formatHighCodeProps,\r\n formatEchartLineProps,\r\n formatEchartPieProps,\r\n formatChartsProps,\r\n formatLoopProps,\r\n formatStyleProps,\r\n formatStepsProps,\r\n staticCodeAssemble,\r\n patternTransitionRegExp,\r\n stringPramarsValTransition,\r\n stringScriptExecution,\r\n};\r\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,8CAAAA;AAAA,EAAA,sDAAAC;AAAA,EAAA,kDAAAC;AAAA,EAAA,8DAAAC;AAAA,EAAA,0DAAAC;AAAA,EAAA,wDAAAC;AAAA,EAAA,8CAAAC;AAAA,EAAA,sDAAAC;AAAA,EAAA,gDAAAC;AAAA,EAAA,8CAAAC;AAAA,EAAA,8CAAAC;AAAA,EAAA,gDAAAC;AAAA,EAAA,gDAAAC;AAAA,EAAA,gDAAAC;AAAA,EAAA,8DAAAC;AAAA,EAAA,oDAAAC;AAAA,EAAA,oEAAAC;AAAA,EAAA;AAAA,oCAAAC;AAAA;AAAA;AAAA,wCAAuC;AACvC,qCAAoC;AACpC,gCAA+B;AAC/B,8BAA6B;AAC7B,6BAA4B;AAC5B,8BAA6B;AAC7B,iCAAgC;AAChC,qCAAoC;AACpC,iCAAgC;AAChC,6BAA4B;AAC5B,mCAAkC;AAClC,kCAAiC;AACjC,+BAA8B;AAC9B,6BAA4B;AAC5B,8BAA6B;AAC7B,8BAA6B;AAC7B,4BAA2B;AAC3B,uBAAsB;AACtB,mCAAsC;",
|
|
6
6
|
"names": ["formRulsRegMap", "formatCarouselProps", "formatChartsProps", "formatDescriptionsProps", "formatEchartLineProps", "formatEchartPieProps", "formatFormProps", "formatHighCodeProps", "formatImageProps", "formatListProps", "formatLoopProps", "formatStepsProps", "formatStyleProps", "formatTableProps", "patternTransitionRegExp", "staticCodeAssemble", "stringPramarsValTransition", "urlPrefix"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/formatModule/helpers/patternTransitionRegExp.ts"],
|
|
4
|
-
"sourcesContent": ["// 字符串转正则表达式\nconst patternTransitionRegExp = (patternString:string) => {\n try {\n if (typeof patternString === 'string' && patternString) {\n const expMatchPattern = /^\\/(.*?)\\/([gimsy]*)$/;\n if (expMatchPattern.test(patternString)) {\n const patternArr = patternString.match(expMatchPattern);\n if (Array.isArray(patternArr)) {\n return new RegExp(patternArr?.[1], patternArr?.[2]);\n }\n return '';\n }\n return new RegExp(patternString);\n }\n return '';\n } catch {\n return '';\n }\n};\n\n\nexport default patternTransitionRegExp;\n"],
|
|
4
|
+
"sourcesContent": ["// 字符串转正则表达式\r\nconst patternTransitionRegExp = (patternString:string) => {\r\n try {\r\n if (typeof patternString === 'string' && patternString) {\r\n const expMatchPattern = /^\\/(.*?)\\/([gimsy]*)$/;\r\n if (expMatchPattern.test(patternString)) {\r\n const patternArr = patternString.match(expMatchPattern);\r\n if (Array.isArray(patternArr)) {\r\n return new RegExp(patternArr?.[1], patternArr?.[2]);\r\n }\r\n return '';\r\n }\r\n return new RegExp(patternString);\r\n }\r\n return '';\r\n } catch {\r\n return '';\r\n }\r\n};\r\n\r\n\r\nexport default patternTransitionRegExp;\r\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAM,0BAA0B,CAAC,kBAAyB;AACxD,MAAI;AACF,QAAI,OAAO,kBAAkB,YAAY,eAAe;AACtD,YAAM,kBAAkB;AACxB,UAAI,gBAAgB,KAAK,aAAa,GAAG;AACvC,cAAM,aAAa,cAAc,MAAM,eAAe;AACtD,YAAI,MAAM,QAAQ,UAAU,GAAG;AAC7B,iBAAO,IAAI,OAAO,yCAAa,IAAI,yCAAa,EAAE;AAAA,QACpD;AACA,eAAO;AAAA,MACT;AACA,aAAO,IAAI,OAAO,aAAa;AAAA,IACjC;AACA,WAAO;AAAA,EACT,QAAE;AACA,WAAO;AAAA,EACT;AACF;AAGA,IAAO,kCAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/formatModule/helpers/staticCodeAssemble.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * 拼装静态数据键值对\n * @param staticCodeList 静态数据列表\n * @returns\n */\n\nconst staticCodeAssemble = (staticCodeList?:{[key:string]:any}|null):{\n staticCodeMap: { [key: string]: any },\n staticOptionsMap: { [key: string]: any }\n} => {\n const staticCodeMap: { [key: string]: any } = {};\n const staticOptionsMap: { [key: string]: any } = {};\n if (staticCodeList) {\n Object.keys(staticCodeList).forEach((codeKey) => {\n const objMap: { [key: string]: any } = {};\n\n const loopStaticData = (staticItems:{[key:string]: any}[]) => {\n const staticOpts:{ [key: string]: any }[] = [];\n if (Array.isArray(staticItems) && staticItems.length > 0) {\n staticItems.forEach((codeItem: any) => {\n objMap[codeItem?.attrValue] = codeItem?.attrValueName;\n const staticOptItem:{[key:string]: any} = {\n value: codeItem?.attrValue,\n label: codeItem?.attrValueName,\n };\n staticCodeMap[codeItem?.attrCode] = {\n ...staticCodeMap[codeItem?.attrCode],\n [codeItem?.attrValue]: codeItem?.attrValueName,\n };\n if (Array.isArray(codeItem?.attrRelList) && codeItem?.attrRelList.length > 0) {\n staticOptItem.children = loopStaticData(codeItem?.attrRelList);\n }\n staticOpts.push(staticOptItem);\n });\n }\n return staticOpts;\n };\n staticOptionsMap[codeKey] = loopStaticData(staticCodeList?.[codeKey]);\n });\n }\n\n return {\n staticCodeMap,\n staticOptionsMap,\n };\n};\n\n\nexport default staticCodeAssemble;\n"],
|
|
4
|
+
"sourcesContent": ["/**\r\n * 拼装静态数据键值对\r\n * @param staticCodeList 静态数据列表\r\n * @returns\r\n */\r\n\r\nconst staticCodeAssemble = (staticCodeList?:{[key:string]:any}|null):{\r\n staticCodeMap: { [key: string]: any },\r\n staticOptionsMap: { [key: string]: any }\r\n} => {\r\n const staticCodeMap: { [key: string]: any } = {};\r\n const staticOptionsMap: { [key: string]: any } = {};\r\n if (staticCodeList) {\r\n Object.keys(staticCodeList).forEach((codeKey) => {\r\n const objMap: { [key: string]: any } = {};\r\n\r\n const loopStaticData = (staticItems:{[key:string]: any}[]) => {\r\n const staticOpts:{ [key: string]: any }[] = [];\r\n if (Array.isArray(staticItems) && staticItems.length > 0) {\r\n staticItems.forEach((codeItem: any) => {\r\n objMap[codeItem?.attrValue] = codeItem?.attrValueName;\r\n const staticOptItem:{[key:string]: any} = {\r\n value: codeItem?.attrValue,\r\n label: codeItem?.attrValueName,\r\n };\r\n staticCodeMap[codeItem?.attrCode] = {\r\n ...staticCodeMap[codeItem?.attrCode],\r\n [codeItem?.attrValue]: codeItem?.attrValueName,\r\n };\r\n if (Array.isArray(codeItem?.attrRelList) && codeItem?.attrRelList.length > 0) {\r\n staticOptItem.children = loopStaticData(codeItem?.attrRelList);\r\n }\r\n staticOpts.push(staticOptItem);\r\n });\r\n }\r\n return staticOpts;\r\n };\r\n staticOptionsMap[codeKey] = loopStaticData(staticCodeList?.[codeKey]);\r\n });\r\n }\r\n\r\n return {\r\n staticCodeMap,\r\n staticOptionsMap,\r\n };\r\n};\r\n\r\n\r\nexport default staticCodeAssemble;\r\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,IAAM,qBAAqB,CAAC,mBAGvB;AACH,QAAM,gBAAwC,CAAC;AAC/C,QAAM,mBAA2C,CAAC;AAClD,MAAI,gBAAgB;AAClB,WAAO,KAAK,cAAc,EAAE,QAAQ,CAAC,YAAY;AAC/C,YAAM,SAAiC,CAAC;AAExC,YAAM,iBAAiB,CAAC,gBAAsC;AAC5D,cAAM,aAAsC,CAAC;AAC7C,YAAI,MAAM,QAAQ,WAAW,KAAK,YAAY,SAAS,GAAG;AACxD,sBAAY,QAAQ,CAAC,aAAkB;AACrC,mBAAO,qCAAU,SAAS,IAAI,qCAAU;AACxC,kBAAM,gBAAoC;AAAA,cACxC,OAAO,qCAAU;AAAA,cACjB,OAAO,qCAAU;AAAA,YACnB;AACA,0BAAc,qCAAU,QAAQ,IAAI;AAAA,cAClC,GAAG,cAAc,qCAAU,QAAQ;AAAA,cACnC,CAAC,qCAAU,SAAS,GAAG,qCAAU;AAAA,YACnC;AACA,gBAAI,MAAM,QAAQ,qCAAU,WAAW,MAAK,qCAAU,YAAY,UAAS,GAAG;AAC5E,4BAAc,WAAW,eAAe,qCAAU,WAAW;AAAA,YAC/D;AACA,uBAAW,KAAK,aAAa;AAAA,UAC/B,CAAC;AAAA,QACH;AACA,eAAO;AAAA,MACT;AACA,uBAAiB,OAAO,IAAI,eAAe,iDAAiB,QAAQ;AAAA,IACtE,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;AAGA,IAAO,6BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/formatModule/helpers/stringPramarsValTransition.ts"],
|
|
4
|
-
"sourcesContent": ["import { replaceParamsValue } from '../../treeUtils';\n\nconst stringPramarsValTransition = replaceParamsValue;\n\nexport default stringPramarsValTransition;\n"],
|
|
4
|
+
"sourcesContent": ["import { replaceParamsValue } from '../../treeUtils';\r\n\r\nconst stringPramarsValTransition = replaceParamsValue;\r\n\r\nexport default stringPramarsValTransition;\r\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAmC;AAEnC,IAAM,6BAA6B;AAEnC,IAAO,qCAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/formatModule/helpers/stringScriptExecution.ts"],
|
|
4
|
-
"sourcesContent": ["import 'ses';\n/* eslint-disable no-new-func */\n// export const stringScriptExecution = (scriptCode: string, root: any) => {\n// try {\n// if (scriptCode) {\n// // 将参数作为全局变量传递\n// const func = new Function('root', `return ${scriptCode}`);\n// const result = func(root);\n// console.log(result, root, scriptCode);\n// return result;\n// }\n// throw new Error('No script code provided');\n// } catch (err) {\n// console.error(err);\n// return null;\n// }\n// };\n\nexport const stringScriptExecution = (scriptCode: string, root: any = {}) => {\n const compartment = new Compartment({ root, window });\n try {\n return scriptCode ? compartment.evaluate(scriptCode) : null;\n } catch (err) {\n console.error(err);\n return err;\n }\n};\n"],
|
|
4
|
+
"sourcesContent": ["import 'ses';\r\n/* eslint-disable no-new-func */\r\n// export const stringScriptExecution = (scriptCode: string, root: any) => {\r\n// try {\r\n// if (scriptCode) {\r\n// // 将参数作为全局变量传递\r\n// const func = new Function('root', `return ${scriptCode}`);\r\n// const result = func(root);\r\n// console.log(result, root, scriptCode);\r\n// return result;\r\n// }\r\n// throw new Error('No script code provided');\r\n// } catch (err) {\r\n// console.error(err);\r\n// return null;\r\n// }\r\n// };\r\n\r\nexport const stringScriptExecution = (scriptCode: string, root: any = {}) => {\r\n const compartment = new Compartment({ root, window });\r\n try {\r\n return scriptCode ? compartment.evaluate(scriptCode) : null;\r\n } catch (err) {\r\n console.error(err);\r\n return err;\r\n }\r\n};\r\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAO;AAkBA,IAAM,wBAAwB,CAAC,YAAoB,OAAY,CAAC,MAAM;AAC3E,QAAM,cAAc,IAAI,YAAY,EAAE,MAAM,OAAO,CAAC;AACpD,MAAI;AACF,WAAO,aAAa,YAAY,SAAS,UAAU,IAAI;AAAA,EACzD,SAAS,KAAP;AACA,YAAQ,MAAM,GAAG;AACjB,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/formatModule/helpers/urlPrefix.ts"],
|
|
4
|
-
"sourcesContent": ["const urlPrefix = `${process.env.REACT_APP_REQ_PREFIX}/bote/`;\n\nexport default urlPrefix;\n"],
|
|
4
|
+
"sourcesContent": ["const urlPrefix = `${process.env.REACT_APP_REQ_PREFIX}/bote/`;\r\n\r\nexport default urlPrefix;\r\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAM,YAAY,GAAG,QAAQ,IAAI;AAEjC,IAAO,oBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/http.d.ts
CHANGED
|
@@ -3,14 +3,22 @@ export declare const tenantIdSessionKey: string;
|
|
|
3
3
|
* 构造管理平台或机器人工程的完整访问地址
|
|
4
4
|
* @param url 环境变量中配置的地址
|
|
5
5
|
*/
|
|
6
|
-
export declare const getAccessUrl: (url: string | undefined) => string;
|
|
6
|
+
export declare const getAccessUrl: (url: string | undefined) => string | null;
|
|
7
7
|
declare const request: {
|
|
8
8
|
getBaseUrl: () => string;
|
|
9
9
|
setUrlPrefix: (prefix: string) => void;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
setTenantId: (tenantId: string) => void;
|
|
11
|
+
getManagerUrl: (route?: string | null) => string | null;
|
|
12
|
+
getBotUrl: (route?: string | null) => string | null;
|
|
13
|
+
getBotIconUrl: (tenantId?: string, botId?: string, updatedTime?: string, isSecurity?: boolean) => string | undefined;
|
|
14
|
+
getSceneIconUrl: (tenantId?: string, sceneId?: string, updatedTime?: string, isSecurity?: boolean) => string | undefined;
|
|
15
|
+
getBotPageSettingIcon: ({ botId, tenantId, type, updatedTime, isSecurity, }: {
|
|
16
|
+
botId: string;
|
|
17
|
+
tenantId?: string | undefined;
|
|
18
|
+
type: 'welcomeBannerlg' | 'welcomeBannerxs' | 'welcomeIcon';
|
|
19
|
+
updatedTime?: string | undefined;
|
|
20
|
+
isSecurity?: boolean | undefined;
|
|
21
|
+
}) => string;
|
|
14
22
|
docChain: {
|
|
15
23
|
referenceDocUrl: ({ tenantId, docId, token, }: {
|
|
16
24
|
[key: string]: string;
|
|
@@ -18,10 +26,10 @@ declare const request: {
|
|
|
18
26
|
referenceDocChunkUrl: ({ tenantId, docId, chunkId, token, score, rank, docType, }: {
|
|
19
27
|
[key: string]: string;
|
|
20
28
|
}) => string;
|
|
21
|
-
downloadDocUrl: ({ tenantId, docId, token, isSecurity }: {
|
|
29
|
+
downloadDocUrl: ({ tenantId, docId, token, isSecurity, }: {
|
|
22
30
|
[key: string]: string | boolean;
|
|
23
31
|
}) => string;
|
|
24
|
-
imageUrl: ({ tenantId, docId, token, path, isSecurity }: {
|
|
32
|
+
imageUrl: ({ tenantId, docId, token, path, isSecurity, }: {
|
|
25
33
|
[key: string]: string | boolean;
|
|
26
34
|
}) => string;
|
|
27
35
|
};
|
package/dist/cjs/http.js
CHANGED
|
@@ -35,11 +35,15 @@ __export(http_exports, {
|
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(http_exports);
|
|
37
37
|
var import_security = __toESM(require("@lingxiteam/security"));
|
|
38
|
+
var import_environment = require("./environment");
|
|
38
39
|
var tenantIdSessionKey = "botSelectedTenantID";
|
|
39
40
|
var http = (url, config) => {
|
|
40
41
|
config.headers["content-type"] = "application/json;charset=UTF-8";
|
|
41
42
|
const token = sessionStorage.getItem("token");
|
|
42
|
-
|
|
43
|
+
if (token) {
|
|
44
|
+
config.headers.Authorization = `Bearer ${token}`;
|
|
45
|
+
}
|
|
46
|
+
config.headers["Tenant-Id"] = currentTenantId;
|
|
43
47
|
return new Promise((resolve, rejects) => {
|
|
44
48
|
fetch(url, config).then((response) => {
|
|
45
49
|
const contentType = response.headers.get("content-type");
|
|
@@ -81,14 +85,27 @@ var getUrl = (url, params = {}) => {
|
|
|
81
85
|
}
|
|
82
86
|
return `${baseUrl}${url}${paramsArr ? `?${paramsArr}` : ""}`;
|
|
83
87
|
};
|
|
88
|
+
var currentTenantId = "";
|
|
84
89
|
var getAccessUrl = (url) => {
|
|
85
90
|
if (!url) {
|
|
86
|
-
|
|
91
|
+
const location2 = (0, import_environment.getLocation)();
|
|
92
|
+
if (location2) {
|
|
93
|
+
return new URL("", location2.href).toString();
|
|
94
|
+
}
|
|
95
|
+
return null;
|
|
87
96
|
}
|
|
88
97
|
if (/^\d+$/.test(url)) {
|
|
89
|
-
|
|
98
|
+
const location2 = (0, import_environment.getLocation)();
|
|
99
|
+
if (location2) {
|
|
100
|
+
return `http://${location2.hostname}:${url}/`;
|
|
101
|
+
}
|
|
102
|
+
return `http://localhost:${url}/`;
|
|
103
|
+
}
|
|
104
|
+
const location = (0, import_environment.getLocation)();
|
|
105
|
+
if (location) {
|
|
106
|
+
return new URL(url, location.href).toString();
|
|
90
107
|
}
|
|
91
|
-
return
|
|
108
|
+
return url;
|
|
92
109
|
};
|
|
93
110
|
var managerUrl = getAccessUrl(process.env.BOTE_MANAGER_URL);
|
|
94
111
|
var botUrl = getAccessUrl(process.env.BOTE_BOT_URL);
|
|
@@ -99,30 +116,56 @@ var request = {
|
|
|
99
116
|
setUrlPrefix: (prefix) => {
|
|
100
117
|
baseUrl = `${prefix}${baseUrl}`;
|
|
101
118
|
},
|
|
119
|
+
setTenantId: (tenantId) => {
|
|
120
|
+
currentTenantId = tenantId;
|
|
121
|
+
},
|
|
102
122
|
getManagerUrl,
|
|
103
123
|
getBotUrl,
|
|
104
124
|
// 获取智能应用图标地址
|
|
105
|
-
getBotIconUrl: (tenantId, botId, updatedTime) => {
|
|
125
|
+
getBotIconUrl: (tenantId, botId, updatedTime, isSecurity = true) => {
|
|
106
126
|
if (tenantId && botId) {
|
|
107
127
|
let url = `${baseUrl}/manager/bot/botIcon?tenantId=${tenantId}&botId=${botId}`;
|
|
108
128
|
if (updatedTime) {
|
|
109
129
|
url += `&_=${updatedTime.replace(/\D/g, "")}`;
|
|
110
130
|
}
|
|
131
|
+
if (isSecurity) {
|
|
132
|
+
url = import_security.default.autoSecurityWithUrl(url);
|
|
133
|
+
}
|
|
111
134
|
return url;
|
|
112
135
|
}
|
|
113
136
|
return void 0;
|
|
114
137
|
},
|
|
115
138
|
// 获取智能体图标地址
|
|
116
|
-
getSceneIconUrl: (tenantId, sceneId, updatedTime) => {
|
|
139
|
+
getSceneIconUrl: (tenantId, sceneId, updatedTime, isSecurity = true) => {
|
|
117
140
|
if (tenantId && sceneId) {
|
|
118
141
|
let url = `${baseUrl}/manager/scene/sceneIcon?tenantId=${tenantId}&sceneId=${sceneId}`;
|
|
119
142
|
if (updatedTime) {
|
|
120
143
|
url += `&_=${updatedTime.replace(/\D/g, "")}`;
|
|
121
144
|
}
|
|
145
|
+
if (isSecurity) {
|
|
146
|
+
url = import_security.default.autoSecurityWithUrl(url);
|
|
147
|
+
}
|
|
122
148
|
return url;
|
|
123
149
|
}
|
|
124
150
|
return void 0;
|
|
125
151
|
},
|
|
152
|
+
// 获取机器人配置图标
|
|
153
|
+
getBotPageSettingIcon: ({
|
|
154
|
+
botId,
|
|
155
|
+
tenantId,
|
|
156
|
+
type,
|
|
157
|
+
updatedTime,
|
|
158
|
+
isSecurity = true
|
|
159
|
+
}) => {
|
|
160
|
+
let url = `${baseUrl}/manager/bot/getPageSettingIconByType?tenantId=${tenantId}&botId=${botId}&type=${type}`;
|
|
161
|
+
if (updatedTime) {
|
|
162
|
+
url += `&_=${updatedTime.replace(/\D/g, "")}`;
|
|
163
|
+
}
|
|
164
|
+
if (isSecurity) {
|
|
165
|
+
url = import_security.default.autoSecurityWithUrl(url);
|
|
166
|
+
}
|
|
167
|
+
return url;
|
|
168
|
+
},
|
|
126
169
|
// 构造 DocChain 相关地址的辅助方法
|
|
127
170
|
docChain: {
|
|
128
171
|
referenceDocUrl: ({
|
|
@@ -152,7 +195,12 @@ var request = {
|
|
|
152
195
|
return url;
|
|
153
196
|
},
|
|
154
197
|
// 下载文档接口地址
|
|
155
|
-
downloadDocUrl: ({
|
|
198
|
+
downloadDocUrl: ({
|
|
199
|
+
tenantId,
|
|
200
|
+
docId,
|
|
201
|
+
token,
|
|
202
|
+
isSecurity = true
|
|
203
|
+
}) => {
|
|
156
204
|
let url = `${baseUrl}/docchain/v1/doc/read?tenantId=${tenantId}&read_format=src&doc_id=${docId}`;
|
|
157
205
|
if (token) {
|
|
158
206
|
url += `&token=${token}`;
|
|
@@ -163,7 +211,13 @@ var request = {
|
|
|
163
211
|
return url;
|
|
164
212
|
},
|
|
165
213
|
// 图片地址
|
|
166
|
-
imageUrl: ({
|
|
214
|
+
imageUrl: ({
|
|
215
|
+
tenantId,
|
|
216
|
+
docId,
|
|
217
|
+
token,
|
|
218
|
+
path,
|
|
219
|
+
isSecurity = true
|
|
220
|
+
}) => {
|
|
167
221
|
let url = `${baseUrl}/docchain/v1/doc/read?tenantId=${tenantId}&read_format=path&doc_id=${docId}&path=${encodeURIComponent(
|
|
168
222
|
path
|
|
169
223
|
)}`;
|
|
@@ -199,8 +253,9 @@ var request = {
|
|
|
199
253
|
},
|
|
200
254
|
get: (url, cfg) => {
|
|
201
255
|
const { params, ...rest } = cfg || {};
|
|
202
|
-
|
|
203
|
-
|
|
256
|
+
if (!params.tenantId && currentTenantId) {
|
|
257
|
+
params.tenantId = currentTenantId;
|
|
258
|
+
}
|
|
204
259
|
const _url = getUrl(url, params);
|
|
205
260
|
return http(_url, {
|
|
206
261
|
method: "GET",
|
|
@@ -210,12 +265,16 @@ var request = {
|
|
|
210
265
|
},
|
|
211
266
|
post: (url, cfg) => {
|
|
212
267
|
const { data, params, ...rest } = cfg || {};
|
|
213
|
-
const tenantId = sessionStorage.getItem(tenantIdSessionKey) || data.tenantId;
|
|
214
268
|
let _body;
|
|
215
269
|
if (data instanceof FormData) {
|
|
216
|
-
data.
|
|
270
|
+
if (!data.get("tenantId") && currentTenantId) {
|
|
271
|
+
data.append("tenantId", currentTenantId);
|
|
272
|
+
}
|
|
217
273
|
_body = data;
|
|
218
274
|
} else {
|
|
275
|
+
if (!data.tenantId && currentTenantId) {
|
|
276
|
+
data.tenantId = currentTenantId;
|
|
277
|
+
}
|
|
219
278
|
_body = JSON.stringify(data || {});
|
|
220
279
|
}
|
|
221
280
|
const _url = getUrl(url, params);
|