@boteteam/utils 0.0.14 → 0.0.17

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.
Files changed (41) hide show
  1. package/dist/cjs/formatModule/formatModuleData.js +19 -1
  2. package/dist/cjs/formatModule/formatModuleData.js.map +2 -2
  3. package/dist/cjs/formatModule/helpers/formatFormProps.js +20 -27
  4. package/dist/cjs/formatModule/helpers/formatFormProps.js.map +2 -2
  5. package/dist/cjs/formatModule/helpers/formatStepsProps.d.ts +23 -0
  6. package/dist/cjs/formatModule/helpers/formatStepsProps.js +88 -0
  7. package/dist/cjs/formatModule/helpers/formatStepsProps.js.map +7 -0
  8. package/dist/cjs/formatModule/helpers/formatTableProps.d.ts +11 -0
  9. package/dist/cjs/formatModule/helpers/formatTableProps.js +76 -6
  10. package/dist/cjs/formatModule/helpers/formatTableProps.js.map +2 -2
  11. package/dist/cjs/formatModule/helpers/index.d.ts +2 -1
  12. package/dist/cjs/formatModule/helpers/index.js +3 -0
  13. package/dist/cjs/formatModule/helpers/index.js.map +3 -3
  14. package/dist/cjs/index.d.ts +2 -1
  15. package/dist/cjs/index.js +9 -0
  16. package/dist/cjs/index.js.map +2 -2
  17. package/dist/cjs/securityUtils.d.ts +28 -0
  18. package/dist/cjs/securityUtils.js +103 -0
  19. package/dist/cjs/securityUtils.js.map +7 -0
  20. package/dist/esm/formatModule/formatModuleData.js +18 -5
  21. package/dist/esm/formatModule/formatModuleData.js.map +1 -1
  22. package/dist/esm/formatModule/helpers/formatFormProps.js +25 -32
  23. package/dist/esm/formatModule/helpers/formatFormProps.js.map +1 -1
  24. package/dist/esm/formatModule/helpers/formatStepsProps.d.ts +23 -0
  25. package/dist/esm/formatModule/helpers/formatStepsProps.js +58 -0
  26. package/dist/esm/formatModule/helpers/formatStepsProps.js.map +1 -0
  27. package/dist/esm/formatModule/helpers/formatTableProps.d.ts +11 -0
  28. package/dist/esm/formatModule/helpers/formatTableProps.js +73 -6
  29. package/dist/esm/formatModule/helpers/formatTableProps.js.map +1 -1
  30. package/dist/esm/formatModule/helpers/index.d.ts +2 -1
  31. package/dist/esm/formatModule/helpers/index.js +2 -1
  32. package/dist/esm/formatModule/helpers/index.js.map +1 -1
  33. package/dist/esm/index.d.ts +2 -1
  34. package/dist/esm/index.js +2 -1
  35. package/dist/esm/index.js.map +1 -1
  36. package/dist/esm/securityUtils.d.ts +28 -0
  37. package/dist/esm/securityUtils.js +101 -0
  38. package/dist/esm/securityUtils.js.map +1 -0
  39. package/dist/umd/index.min.js +1 -1
  40. package/dist/umd/index.min.js.map +1 -1
  41. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"names":["get","stringScriptExecution","getDataArr","getParamsContentByParamKeys","replaceParamsValue","formatTableProps","formatListProps","formRulsRegMap","urlPrefix","patternTransitionRegExp","formatOptionsRecursively","data","labelApiPath","valApiPath","map","item","option","label","value","children","Array","isArray","formatFormProps","_ref","parameters","staticCodeMap","staticOptionsMap","_ref$options","options","column","res","formItems","initValues","length","forEach","attrItem","_extend$controlBtns","_otherAttrFormProps$r","_attrItem$formProps","_ref2","attrCompProps","compProps","attrFormProps","formProps","_ref3","required","extend","attrFormPropsDisplay","display","otherAttrFormProps","_objectWithoutProperties","_excluded","_ref4","dataOptions","otherAttrCompProps","_excluded2","formItem","key","id","name","type","compType","props","originModule","text","_objectSpread","controlBtns","_attrItem$compProps","_attrItem$compProps2","_attrItem$compProps3","_attrItem$compProps4","_attrItem$compProps5","_attrItem$compProps6","_attrItem$compProps7","_formatTableProps","attrs","dataSource","columns","rowKeys","rowKey","hasSelectAll","rowSelection","includes","_attrItem$compProps8","resProps","_attrItem$compProps9","_Object$keys","_attrItem$compProps10","_attrItem$compProps15","_attrItem$compProps16","Object","keys","_attrItem$compProps11","uploadDataParams","paramsName","_attrItem$compProps12","test","_attrItem$compProps13","_attrItem$compProps14","action","url","_attrItem$compProps17","otherRules","rules","filter","defaultValue","attrDefVal","_attrItem$formProps2","valuePropName","_attrItem$formProps3","pattern","message","formItemDisplay","codeExtendVal","formItemRequired","concat","_toConsumableArray","attrItemDataOptions","staticCode","_staticCodeMap$attrIt","_staticCodeMap$attrIt2","attrCode","formatToTreeData","optionsItems","optItem","title","treeData","contextOptions","_attrItemDataOptions$","_attrItemDataOptions$2","optLabelStr","optValueStr","splitParamsPath","paramsPathStr","paramsPathArr","replace","split","idx","optValArr","optLabelArr","optData","slice","push","formMode","span","initialValues"],"sources":["../../../../src/formatModule/helpers/formatFormProps.ts"],"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 }\n res.formItems = formItems;\n res.initialValues = initValues;\n return res;\n};\n\nexport default formatFormProps;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAASA,GAAG,QAAQ,QAAQ;AAC5B,SAASC,qBAAqB;AAC9B,SAASC,UAAU,EAAEC,2BAA2B,EAAEC,kBAAkB;AACpE,OAAOC,gBAAgB;AACvB,OAAOC,eAAe;AACtB,OAAOC,cAAc;AACrB,OAAOC,SAAS;AAChB,OAAOC,uBAAuB;AAY9B,IAAMC,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAAIC,IAAW,EAAEC,YAAsB,EAAEC,UAAoB,EAAY;EACrG,OAAOF,IAAI,CAACG,GAAG,CAAC,UAACC,IAAI,EAAK;IACxB,IAAMC,MAAW,GAAG;MAClBC,KAAK,EAAEjB,GAAG,CAACe,IAAI,EAAEH,YAAY,CAAC;MAC9BM,KAAK,EAAElB,GAAG,CAACe,IAAI,EAAEF,UAAU;IAC7B,CAAC;;IAED;IACA,IAAIE,IAAI,CAACI,QAAQ,IAAIC,KAAK,CAACC,OAAO,CAACN,IAAI,CAACI,QAAQ,CAAC,EAAE;MACjDH,MAAM,CAACG,QAAQ,GAAGT,wBAAwB,CAACK,IAAI,CAACI,QAAQ,EAAEP,YAAY,EAAEC,UAAU,CAAC;IACrF;IAEA,OAAOG,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;AAED,IAAMM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AAC;YAChD,IAAMU,OAAc,GAAGxH,KAAK,CAACC,OAAO,CAACG,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAGkH,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAG,CAAC,CAAC,CAAC,CAAC,GAAGlH,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAGkH,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAG,CAAC,CAAC,CAAC,GAAG,EAAE;YACtG,IAAM9H,YAAsB,GAAG+H,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEE,KAAK,CAAC,CAAC,CAAC;YACpD,IAAMhI,UAAoB,GAAG6H,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEG,KAAK,CAAC,CAAC,CAAC;YAEhDrF,QAAQ,CAACM,KAAK,GAAAG,aAAA,CAAAA,aAAA,KACTT,QAAQ,CAACM,KAAK;cACjBlC,OAAO,EAAElB,wBAAwB,CAACkI,OAAO,EAAEhI,YAAY,EAAEC,UAAU;YAAC,EACrE;UACH;QACF;MACF;MACAkB,SAAS,CAAC+G,IAAI,CAACtF,QAAQ,CAAC;IAC1B,CAAC,CAAC;EACJ;EACA,IAAI,OAAO3B,MAAM,KAAK,QAAQ,IAAIA,MAAM,GAAG,CAAC,EAAE;IAC5CC,GAAG,CAACiH,QAAQ,GAAG,MAAM;IACrBjH,GAAG,CAACkH,IAAI,GAAG,EAAE,GAAGnH,MAAM;EACxB,CAAC,MAAM;IACLC,GAAG,CAACiH,QAAQ,GAAG,SAAS;IACxB,OAAOjH,GAAG,CAACkH,IAAI;EACjB;EACAlH,GAAG,CAACC,SAAS,GAAGA,SAAS;EACzBD,GAAG,CAACmH,aAAa,GAAGjH,UAAU;EAC9B,OAAOF,GAAG;AACZ,CAAC;AAED,eAAeR,eAAe"}
1
+ {"version":3,"names":["get","stringScriptExecution","getDataArr","getParamsContentByParamKeys","replaceParamsValue","formatTableProps","formatListProps","formRulsRegMap","urlPrefix","patternTransitionRegExp","formatOptionsRecursively","data","labelApiPath","valApiPath","map","item","option","label","value","children","Array","isArray","formatFormProps","_ref","parameters","staticCodeMap","staticOptionsMap","_ref$options","options","column","res","formItems","initValues","length","forEach","attrItem","_extend$controlBtns","_otherAttrFormProps$r","_attrItem$formProps","_ref2","attrCompProps","compProps","attrFormProps","formProps","_ref3","required","extend","attrFormPropsDisplay","display","otherAttrFormProps","_objectWithoutProperties","_excluded","_ref4","dataOptions","otherAttrCompProps","_excluded2","formItem","key","id","name","type","compType","props","originModule","text","_objectSpread","controlBtns","_attrItem$compProps","_attrItem$compProps2","_attrItem$compProps3","_attrItem$compProps4","_attrItem$compProps5","tableProps","rowKeys","rowKey","hasSelectAll","rowSelection","includes","_attrItem$compProps6","resProps","_attrItem$compProps7","_Object$keys","_attrItem$compProps8","_attrItem$compProps13","_attrItem$compProps14","Object","keys","_attrItem$compProps9","uploadDataParams","paramsName","_attrItem$compProps10","test","_attrItem$compProps11","_attrItem$compProps12","action","url","_attrItem$compProps15","otherRules","rules","filter","defaultValue","attrDefVal","_attrItem$formProps2","valuePropName","_attrItem$formProps3","pattern","message","formItemDisplay","codeExtendVal","formItemRequired","concat","_toConsumableArray","attrItemDataOptions","staticCode","_staticCodeMap$attrIt","_staticCodeMap$attrIt2","attrCode","formatToTreeData","optionsItems","optItem","title","treeData","contextOptions","_attrItemDataOptions$","_attrItemDataOptions$2","optLabelStr","optValueStr","splitParamsPath","paramsPathStr","paramsPathArr","replace","split","idx","optValArr","optLabelArr","optData","slice","push","formMode","span","initialValues"],"sources":["../../../../src/formatModule/helpers/formatFormProps.ts"],"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"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAASA,GAAG,QAAQ,QAAQ;AAC5B,SAASC,qBAAqB;AAC9B,SAASC,UAAU,EAAEC,2BAA2B,EAAEC,kBAAkB;AACpE,OAAOC,gBAAgB;AACvB,OAAOC,eAAe;AACtB,OAAOC,cAAc;AACrB,O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CAACC,SAAS,GAAGA,SAAS;EACzBD,GAAG,CAAC8G,aAAa,GAAG5G,UAAU;EAC9B,OAAOF,GAAG;AACZ,CAAC;AAED,eAAeR,eAAe"}
@@ -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,58 @@
1
+ import { getDataArr, replaceLoopBodyParamsValue } from "../../treeUtils";
2
+ import { get } from 'lodash';
3
+ var formatStepsProps = function formatStepsProps(_ref) {
4
+ var parameters = _ref.parameters,
5
+ _ref$options = _ref.options,
6
+ options = _ref$options === void 0 ? {} : _ref$options;
7
+ var dataSource = options.dataSource,
8
+ title = options.title,
9
+ description = options.description,
10
+ status = options.status,
11
+ direction = options.direction,
12
+ statusMap = options.statusMap;
13
+ var res = {
14
+ size: 'small'
15
+ };
16
+ if (dataSource) {
17
+ var dataSourceArr = getDataArr(dataSource);
18
+ if (parameters) {
19
+ var dataSourceList = get(parameters, dataSourceArr);
20
+ var replaceParamsValue = function replaceParamsValue(contentStr, item) {
21
+ return replaceLoopBodyParamsValue(contentStr, {
22
+ parameters: parameters,
23
+ loopParams: item,
24
+ loopData: dataSourceList,
25
+ loopSourceArr: dataSourceArr
26
+ });
27
+ };
28
+ if (Array.isArray(dataSourceList)) {
29
+ res.items = dataSourceList.map(function (item) {
30
+ // 获取状态值
31
+ var recordStatus = status && replaceParamsValue(status, item) ? replaceParamsValue(status, item) : '';
32
+ // 根据状态映射,转换状态值为步骤状态
33
+ if (statusMap && Object.keys(statusMap).length > 0) {
34
+ Object.keys(statusMap).forEach(function (key) {
35
+ var statusValue = "".concat(statusMap === null || statusMap === void 0 ? void 0 : statusMap[key]) || '';
36
+ if (recordStatus && statusValue && "".concat(recordStatus) === statusValue) {
37
+ recordStatus = key;
38
+ }
39
+ });
40
+ }
41
+ return {
42
+ title: title ? replaceParamsValue(title, item) : '',
43
+ description: description ? replaceParamsValue(description, item) : '',
44
+ status: recordStatus || 'default'
45
+ };
46
+ });
47
+ }
48
+ }
49
+ if (direction === 'horizontal') {
50
+ res.labelPlacement = 'vertical';
51
+ } else if (res !== null && res !== void 0 && res.labelPlacement) {
52
+ delete res.labelPlacement;
53
+ }
54
+ }
55
+ return res;
56
+ };
57
+ export default formatStepsProps;
58
+ //# sourceMappingURL=formatStepsProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getDataArr","replaceLoopBodyParamsValue","get","formatStepsProps","_ref","parameters","_ref$options","options","dataSource","title","description","status","direction","statusMap","res","size","dataSourceArr","dataSourceList","replaceParamsValue","contentStr","item","loopParams","loopData","loopSourceArr","Array","isArray","items","map","recordStatus","Object","keys","length","forEach","key","statusValue","concat","labelPlacement"],"sources":["../../../../src/formatModule/helpers/formatStepsProps.ts"],"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"],"mappings":"AAAA,SAASA,UAAU,EAAEC,0BAA0B;AAC/C,SAASC,GAAG,QAAQ,QAAQ;AAoB5B,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAG0B;EAAA,IAF9CC,UAAU,GAAAD,IAAA,CAAVC,UAAU;IAAAC,YAAA,GAAAF,IAAA,CACVG,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAG,CAAC,CAAC,GAAAA,YAAA;EAEZ,IACEE,UAAU,GAMRD,OAAO,CANTC,UAAU;IACVC,KAAK,GAKHF,OAAO,CALTE,KAAK;IACLC,WAAW,GAITH,OAAO,CAJTG,WAAW;IACXC,MAAM,GAGJJ,OAAO,CAHTI,MAAM;IACNC,SAAS,GAEPL,OAAO,CAFTK,SAAS;IACTC,SAAS,GACPN,OAAO,CADTM,SAAS;EAEX,IAAMC,GAAuB,GAAG;IAC9BC,IAAI,EAAE;EACR,CAAC;EAED,IAAIP,UAAU,EAAE;IACd,IAAMQ,aAAa,GA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AAEU,IAAI,CAAC,GAAG,EAAE;YACrET,MAAM,EAAEiB,YAAY,IAAI;UAC1B,CAAC;QACH,CAAC,CAAC;MACJ;IACF;IACA,IAAIhB,SAAS,KAAK,YAAY,EAAE;MAC9BE,GAAG,CAACsB,cAAc,GAAG,UAAU;IACjC,CAAC,MAAM,IAAItB,GAAG,aAAHA,GAAG,eAAHA,GAAG,CAAEsB,cAAc,EAAE;MAC9B,OAAOtB,GAAG,CAACsB,cAAc;IAC3B;EACF;EACA,OAAOtB,GAAG;AACZ,CAAC;AAED,eAAeX,gBAAgB"}
@@ -3,7 +3,14 @@ export type formatTablePropsType = {
3
3
  attrs?: {
4
4
  [key: string]: any;
5
5
  }[];
6
+ columns?: {
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;
@@ -1,3 +1,9 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
7
  import { getDataArr } from "../../treeUtils";
2
8
  import { stringScriptExecution } from "./stringScriptExecution";
3
9
  // import stringPramarsValTransition from './stringPramarsValTransition';
@@ -8,10 +14,47 @@ var formatTableProps = function formatTableProps(_ref) {
8
14
  _ref$options = _ref.options,
9
15
  options = _ref$options === void 0 ? {} : _ref$options;
10
16
  var attrs = options.attrs,
11
- dataSource = options.dataSource;
12
- var columns = [];
17
+ dataSource = options.dataSource,
18
+ columns = options.columns,
19
+ columnWidth = options.columnWidth,
20
+ columnMinWidth = options.columnMinWidth,
21
+ columnMaxWidth = options.columnMaxWidth,
22
+ tableBodyHeight = options.tableBodyHeight;
23
+ var _columns = [];
13
24
  var dataList = [];
14
- if (Array.isArray(attrs) && attrs.length > 0) {
25
+ var scroll = {};
26
+ if (typeof columns === 'string' && columns) {
27
+ var columnsArr = getDataArr(columns);
28
+ var columnsList = get(parameters, columnsArr);
29
+ if (Array.isArray(columnsList)) {
30
+ columnsList.forEach(function (colItem) {
31
+ var colObj = {
32
+ key: colItem === null || colItem === void 0 ? void 0 : colItem.dataIndex,
33
+ title: colItem === null || colItem === void 0 ? void 0 : colItem.title,
34
+ dataIndex: colItem === null || colItem === void 0 ? void 0 : colItem.dataIndex
35
+ };
36
+ var colWidth = (colItem === null || colItem === void 0 ? void 0 : colItem.width) || columnWidth;
37
+ var colMinWidth = (colItem === null || colItem === void 0 ? void 0 : colItem.minWidth) || columnMinWidth;
38
+ var colMaxWidth = (colItem === null || colItem === void 0 ? void 0 : colItem.maxWidth) || columnMaxWidth;
39
+ if (colWidth) {
40
+ colObj.style = _objectSpread(_objectSpread({}, colObj.style || {}), {}, {
41
+ width: colWidth
42
+ });
43
+ }
44
+ if (colMinWidth) {
45
+ colObj.style = _objectSpread(_objectSpread({}, colObj.style || {}), {}, {
46
+ minWidth: colMinWidth
47
+ });
48
+ }
49
+ if (colMaxWidth) {
50
+ colObj.style = _objectSpread(_objectSpread({}, colObj.style || {}), {}, {
51
+ maxWidth: colMaxWidth
52
+ });
53
+ }
54
+ _columns.push(colObj);
55
+ });
56
+ }
57
+ } else if (Array.isArray(attrs) && attrs.length > 0) {
15
58
  attrs.forEach(function (attrItem) {
16
59
  var attrsDisplay = true;
17
60
  if (typeof (attrItem === null || attrItem === void 0 ? void 0 : attrItem.display) === 'boolean' || typeof (attrItem === null || attrItem === void 0 ? void 0 : attrItem.display) === 'string') {
@@ -28,9 +71,27 @@ var formatTableProps = function formatTableProps(_ref) {
28
71
  key: attrItem === null || attrItem === void 0 ? void 0 : attrItem.attrCode,
29
72
  title: attrItem === null || attrItem === void 0 ? void 0 : attrItem.attrName
30
73
  };
74
+ var colWidth = (attrItem === null || attrItem === void 0 ? void 0 : attrItem.attrWidth) || columnWidth;
75
+ var colMinWidth = (attrItem === null || attrItem === void 0 ? void 0 : attrItem.attrMinWidth) || columnMinWidth;
76
+ var colMaxWidth = (attrItem === null || attrItem === void 0 ? void 0 : attrItem.attrMaxWidth) || columnMaxWidth;
31
77
  if (typeof (attrItem === null || attrItem === void 0 ? void 0 : attrItem.attrWidth) === 'string') {
32
78
  colObj.width = attrItem === null || attrItem === void 0 ? void 0 : attrItem.attrWidth;
33
79
  }
80
+ if (colWidth) {
81
+ colObj.style = _objectSpread(_objectSpread({}, colObj.style || {}), {}, {
82
+ width: colWidth
83
+ });
84
+ }
85
+ if (colMinWidth) {
86
+ colObj.style = _objectSpread(_objectSpread({}, colObj.style || {}), {}, {
87
+ minWidth: colMinWidth
88
+ });
89
+ }
90
+ if (colMaxWidth) {
91
+ colObj.style = _objectSpread(_objectSpread({}, colObj.style || {}), {}, {
92
+ maxWidth: colMaxWidth
93
+ });
94
+ }
34
95
  var dataIndexArr = getDataArr(attrItem === null || attrItem === void 0 ? void 0 : attrItem.defaultValue);
35
96
  if (Array.isArray(dataIndexArr) && dataIndexArr.length > 0) {
36
97
  var _dataIndexArr$slice;
@@ -42,7 +103,7 @@ var formatTableProps = function formatTableProps(_ref) {
42
103
  return (staticCodeMap === null || staticCodeMap === void 0 || (_staticCodeMap$attrIt = staticCodeMap[attrItem === null || attrItem === void 0 ? void 0 : attrItem.staticCode]) === null || _staticCodeMap$attrIt === void 0 ? void 0 : _staticCodeMap$attrIt[val]) || val;
43
104
  };
44
105
  }
45
- columns.push(colObj);
106
+ _columns.push(colObj);
46
107
  }
47
108
  });
48
109
  }
@@ -55,9 +116,15 @@ var formatTableProps = function formatTableProps(_ref) {
55
116
  }
56
117
  }
57
118
  }
119
+ if (typeof tableBodyHeight === 'string' && tableBodyHeight) {
120
+ scroll = {
121
+ y: tableBodyHeight
122
+ };
123
+ }
58
124
  return {
59
- columns: columns,
60
- dataSource: dataList
125
+ columns: _columns,
126
+ dataSource: dataList,
127
+ scroll: scroll
61
128
  };
62
129
  };
63
130
  export default formatTableProps;
@@ -1 +1 @@
1
- {"version":3,"names":["getDataArr","stringScriptExecution","get","formatTableProps","_ref","staticCodeMap","parameters","_ref$options","options","attrs","dataSource","columns","dataList","Array","isArray","length","forEach","attrItem","attrsDisplay","display","codeExtendVal","colObj","key","attrCode","title","attrName","attrWidth","width","dataIndexArr","defaultValue","_dataIndexArr$slice","dataIndex","slice","staticCode","render","val","_staticCodeMap$attrIt","push","dataSourceArr","dataSourceList"],"sources":["../../../../src/formatModule/helpers/formatTableProps.ts"],"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 dataSource?: 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}\n\nconst formatTableProps = ({\n staticCodeMap,\n parameters,\n options = {},\n}: formatTablePropsType): formatTablePropsExportType => {\n const {\n attrs,\n dataSource,\n } = options;\n const columns: {[key: string]: any}[] = [];\n let dataList: {[key: string]: any}[] = [];\n 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 if (typeof attrItem?.attrWidth === 'string') {\n colObj.width = attrItem?.attrWidth;\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 return {\n columns,\n dataSource: dataList,\n };\n};\n\nexport default formatTableProps;\n"],"mappings":"AAAA,SAASA,UAAU;AACnB,SAASC,qBAAqB;AAC9B;AACA,SAASC,GAAG,QAAQ,QAAQ;AAgB5B,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAIkC;EAAA,IAHtDC,aAAa,GAAAD,IAAA,CAAbC,aAAa;IACbC,UAAU,GAAAF,IAAA,CAAVE,UAAU;IAAAC,YAAA,GAAAH,IAAA,CACVI,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAG,CAAC,CAAC,GAAAA,YAAA;EAEZ,IACEE,KAAK,GAEHD,OAAO,CAFTC,KAAK;IACLC,UAAU,GACRF,OAAO,CADTE,UAAU;EAEZ,IAAMC,OAA+B,GAAG,EAAE;EAC1C,IAAIC,QAAgC,GAAG,EAAE;EACzC,IAAIC,KAAK,CAACC,OAAO,CAACL,KAAK,CAAC,IAAIA,KAAK,CAACM,MAAM,GAAG,CAAC,EAAE;IAC5CN,KAAK,CAACO,OAAO,CAAC,UAACC,QAAQ,EAAK;MAC1B,IAAIC,YAAqB,GAAG,IAAI;MAChC,IAAI,QAAOD,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEE,OAAO,MAAK,SAAS,IAAI,QAAOF,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEE,OAAO,MAAK,QAAQ,EAAE;QACnF,IAAI,QAAOF,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEE,OAAO,MAAK,SAAS,EAAE;UAC1CD,YAAY,GAAGD,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEE,OAAO;QAClC,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M,GAAG,UAACC,GAAW,EAAK;YAAA,IAAAC,qBAAA;YAC/B,OAAO,CAAA/B,aAAa,aAAbA,aAAa,gBAAA+B,qBAAA,GAAb/B,aAAa,CAAGY,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEgB,UAAU,CAAC,cAAAG,qBAAA,uBAArCA,qBAAA,CAAwCD,GAAG,CAAC,KAAIA,GAAG;UAC5D,CAAC;QACH;QACAxB,OAAO,CAAC0B,IAAI,CAAChB,MAAM,CAAC;MACtB;IACF,CAAC,CAAC;EACJ;EACA,IAAIX,UAAU,EAAE;IACd,IAAM4B,aAAa,GAAGtC,UAAU,CAACU,UAAU,CAAC;IAC5C,IAAIJ,UAAU,EAAE;MACd,IAAMiC,cAAc,GAAGrC,GAAG,CACxBI,UAAU,EACVgC,aACF,CAAC;MACD,IAAIzB,KAAK,CAACC,OAAO,CAACyB,cAAc,CAAC,EAAE;QACjC3B,QAAQ,GAAG2B,cAAc;MAC3B;IACF;EACF;EACA,OAAO;IACL5B,OAAO,EAAPA,OAAO;IACPD,UAAU,EAAEE;EACd,CAAC;AACH,CAAC;AAED,eAAeT,gBAAgB"}
1
+ {"version":3,"names":["getDataArr","stringScriptExecution","get","formatTableProps","_ref","staticCodeMap","parameters","_ref$options","options","attrs","dataSource","columns","columnWidth","columnMinWidth","columnMaxWidth","tableBodyHeight","_columns","dataList","scroll","columnsArr","columnsList","Array","isArray","forEach","colItem","colObj","key","dataIndex","title","colWidth","width","colMinWidth","minWidth","colMaxWidth","maxWidth","style","_objectSpread","push","length","attrItem","attrsDisplay","display","codeExtendVal","attrCode","attrName","attrWidth","attrMinWidth","attrMaxWidth","dataIndexArr","defaultValue","_dataIndexArr$slice","slice","staticCode","render","val","_staticCodeMap$attrIt","dataSourceArr","dataSourceList","y"],"sources":["../../../../src/formatModule/helpers/formatTableProps.ts"],"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"],"mappings":";;;;;;AAAA,SAASA,UAAU;AACnB,SAASC,qBAAqB;AAC9B;AACA,SAASC,GAAG,QAAQ,QAAQ;AAsB5B,IAAMC,gB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Ac,GAAGvD,GAAG,CACxBI,UAAU,EACVkD,aACF,CAAC;MACD,IAAInC,KAAK,CAACC,OAAO,CAACmC,cAAc,CAAC,EAAE;QACjCxC,QAAQ,GAAGwC,cAAc;MAC3B;IACF;EACF;EACA,IAAI,OAAO1C,eAAe,KAAK,QAAQ,IAAIA,eAAe,EAAE;IAC1DG,MAAM,GAAG;MACPwC,CAAC,EAAE3C;IACL,CAAC;EACH;EACA,OAAO;IACLJ,OAAO,EAAEK,QAAQ;IACjBN,UAAU,EAAEO,QAAQ;IACpBC,MAAM,EAANA;EACF,CAAC;AACH,CAAC;AAED,eAAef,gBAAgB"}
@@ -12,7 +12,8 @@ import formatEchartLineProps from './formatEchartLineProps';
12
12
  import formatEchartPieProps from './formatEchartPieProps';
13
13
  import formatLoopProps from './formatLoopProps';
14
14
  import formatStyleProps from './formatStyleProps';
15
+ import formatStepsProps from './formatStepsProps';
15
16
  import formRulsRegMap from './formRulsRegMap';
16
17
  import urlPrefix from './urlPrefix';
17
18
  import { stringScriptExecution } from './stringScriptExecution';
18
- export { urlPrefix, formRulsRegMap, formatListProps, formatTableProps, formatCarouselProps, formatImageProps, formatDescriptionsProps, formatFormProps, formatHighCodeProps, formatEchartLineProps, formatEchartPieProps, formatLoopProps, formatStyleProps, staticCodeAssemble, patternTransitionRegExp, stringPramarsValTransition, stringScriptExecution, };
19
+ export { urlPrefix, formRulsRegMap, formatListProps, formatTableProps, formatCarouselProps, formatImageProps, formatDescriptionsProps, formatFormProps, formatHighCodeProps, formatEchartLineProps, formatEchartPieProps, formatLoopProps, formatStyleProps, formatStepsProps, staticCodeAssemble, patternTransitionRegExp, stringPramarsValTransition, stringScriptExecution, };
@@ -12,8 +12,9 @@ import formatEchartLineProps from "./formatEchartLineProps";
12
12
  import formatEchartPieProps from "./formatEchartPieProps";
13
13
  import formatLoopProps from "./formatLoopProps";
14
14
  import formatStyleProps from "./formatStyleProps";
15
+ import formatStepsProps from "./formatStepsProps";
15
16
  import formRulsRegMap from "./formRulsRegMap";
16
17
  import urlPrefix from "./urlPrefix";
17
18
  import { stringScriptExecution } from "./stringScriptExecution";
18
- export { urlPrefix, formRulsRegMap, formatListProps, formatTableProps, formatCarouselProps, formatImageProps, formatDescriptionsProps, formatFormProps, formatHighCodeProps, formatEchartLineProps, formatEchartPieProps, formatLoopProps, formatStyleProps, staticCodeAssemble, patternTransitionRegExp, stringPramarsValTransition, stringScriptExecution };
19
+ export { urlPrefix, formRulsRegMap, formatListProps, formatTableProps, formatCarouselProps, formatImageProps, formatDescriptionsProps, formatFormProps, formatHighCodeProps, formatEchartLineProps, formatEchartPieProps, formatLoopProps, formatStyleProps, formatStepsProps, staticCodeAssemble, patternTransitionRegExp, stringPramarsValTransition, stringScriptExecution };
19
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["stringPramarsValTransition","patternTransitionRegExp","staticCodeAssemble","formatTableProps","formatListProps","formatImageProps","formatCarouselProps","formatDescriptionsProps","formatHighCodeProps","formatFormProps","formatEchartLineProps","formatEchartPieProps","formatLoopProps","formatStyleProps","formRulsRegMap","urlPrefix","stringScriptExecution"],"sources":["../../../../src/formatModule/helpers/index.ts"],"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 formatLoopProps from './formatLoopProps';\nimport formatStyleProps from './formatStyleProps';\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 formatLoopProps,\n formatStyleProps,\n staticCodeAssemble,\n patternTransitionRegExp,\n stringPramarsValTransition,\n stringScriptExecution,\n};\n"],"mappings":"AAAA,OAAOA,0BAA0B;AACjC,OAAOC,uBAAuB;AAC9B,OAAOC,kBAAkB;AACzB,OAAOC,gBAAgB;AACvB,OAAOC,eAAe;AACtB,OAAOC,gBAAgB;AACvB,OAAOC,mBAAmB;AAC1B,OAAOC,uBAAuB;AAC9B,OAAOC,mBAAmB;AAC1B,OAAOC,eAAe;AACtB,OAAOC,qBAAqB;AAC5B,OAAOC,oBAAoB;AAC3B,OAAOC,eAAe;AACtB,OAAOC,gBAAgB;AACvB,OAAOC,cAAc;AACrB,OAAOC,SAAS;AAChB,SAASC,qBAAqB;AAE9B,SACED,SAAS,EACTD,cAAc,EACdV,eAAe,EACfD,gBAAgB,EAChBG,mBAAmB,EACnBD,gBAAgB,EAChBE,uBAAuB,EACvBE,eAAe,EACfD,mBAAmB,EACnBE,qBAAqB,EACrBC,oBAAoB,EACpBC,eAAe,EACfC,gBAAgB,EAChBX,kBAAkB,EAClBD,uBAAuB,EACvBD,0BAA0B,EAC1BgB,qBAAqB"}
1
+ {"version":3,"names":["stringPramarsValTransition","patternTransitionRegExp","staticCodeAssemble","formatTableProps","formatListProps","formatImageProps","formatCarouselProps","formatDescriptionsProps","formatHighCodeProps","formatFormProps","formatEchartLineProps","formatEchartPieProps","formatLoopProps","formatStyleProps","formatStepsProps","formRulsRegMap","urlPrefix","stringScriptExecution"],"sources":["../../../../src/formatModule/helpers/index.ts"],"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 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 formatLoopProps,\n formatStyleProps,\n formatStepsProps,\n staticCodeAssemble,\n patternTransitionRegExp,\n stringPramarsValTransition,\n stringScriptExecution,\n};\n"],"mappings":"AAAA,OAAOA,0BAA0B;AACjC,OAAOC,uBAAuB;AAC9B,OAAOC,kBAAkB;AACzB,OAAOC,gBAAgB;AACvB,OAAOC,eAAe;AACtB,OAAOC,gBAAgB;AACvB,OAAOC,mBAAmB;AAC1B,OAAOC,uBAAuB;AAC9B,OAAOC,mBAAmB;AAC1B,OAAOC,eAAe;AACtB,OAAOC,qBAAqB;AAC5B,OAAOC,oBAAoB;AAC3B,OAAOC,eAAe;AACtB,OAAOC,gBAAgB;AACvB,OAAOC,gBAAgB;AACvB,OAAOC,cAAc;AACrB,OAAOC,SAAS;AAChB,SAASC,qBAAqB;AAE9B,SACED,SAAS,EACTD,cAAc,EACdX,eAAe,EACfD,gBAAgB,EAChBG,mBAAmB,EACnBD,gBAAgB,EAChBE,uBAAuB,EACvBE,eAAe,EACfD,mBAAmB,EACnBE,qBAAqB,EACrBC,oBAAoB,EACpBC,eAAe,EACfC,gBAAgB,EAChBC,gBAAgB,EAChBZ,kBAAkB,EAClBD,uBAAuB,EACvBD,0BAA0B,EAC1BiB,qBAAqB"}
@@ -9,5 +9,6 @@ import { patternTransitionRegExp, stringPramarsValTransition, stringScriptExecut
9
9
  import loopPageStaticCodeMap from './loopPageStaticCodeMap';
10
10
  import scriptExecution, { type scriptExecutionType } from './scriptExecution';
11
11
  import { getFileUrlById, getRemoteComponentUrlByCode, getRemoteComponentUrlById } from './file';
12
+ import { isValidUrl, sanitizeRedirectUrl, safeRedirect, sanitizeEventHandler } from './securityUtils';
12
13
  export type { fileToBase64Type, asyncLocalStorageType, asyncSessionStorageType, scriptExecutionType, };
13
- export { fileToBase64, CookieUtils, argsToString, argsToObject, getSearchObj, asyncLocalStorage, asyncSessionStorage, camelToSnake, underscoreToCamelCase, generateRandom18Int, formatModuleData, patternTransitionRegExp, stringPramarsValTransition, loopPageStaticCodeMap, getDataArr, replaceParamsValue, replaceParamsValueForEvent, getParamsContentByParamKeys, getFileUrlById, getRemoteComponentUrlByCode, getRemoteComponentUrlById, stringScriptExecution, scriptExecution, };
14
+ export { fileToBase64, CookieUtils, argsToString, argsToObject, getSearchObj, asyncLocalStorage, asyncSessionStorage, camelToSnake, underscoreToCamelCase, generateRandom18Int, formatModuleData, patternTransitionRegExp, stringPramarsValTransition, loopPageStaticCodeMap, getDataArr, replaceParamsValue, replaceParamsValueForEvent, getParamsContentByParamKeys, getFileUrlById, getRemoteComponentUrlByCode, getRemoteComponentUrlById, stringScriptExecution, scriptExecution, isValidUrl, sanitizeRedirectUrl, safeRedirect, sanitizeEventHandler, };
package/dist/esm/index.js CHANGED
@@ -9,9 +9,10 @@ import { patternTransitionRegExp, stringPramarsValTransition, stringScriptExecut
9
9
  import loopPageStaticCodeMap from "./loopPageStaticCodeMap";
10
10
  import scriptExecution from "./scriptExecution";
11
11
  import { getFileUrlById, getRemoteComponentUrlByCode, getRemoteComponentUrlById } from "./file";
12
+ import { isValidUrl, sanitizeRedirectUrl, safeRedirect, sanitizeEventHandler } from "./securityUtils";
12
13
 
13
14
  // 避免 _对象 和其他库冲突
14
15
  var _ = require('lodash');
15
16
  _.noConflict();
16
- export { fileToBase64, CookieUtils, argsToString, argsToObject, getSearchObj, asyncLocalStorage, asyncSessionStorage, camelToSnake, underscoreToCamelCase, generateRandom18Int, formatModuleData, patternTransitionRegExp, stringPramarsValTransition, loopPageStaticCodeMap, getDataArr, replaceParamsValue, replaceParamsValueForEvent, getParamsContentByParamKeys, getFileUrlById, getRemoteComponentUrlByCode, getRemoteComponentUrlById, stringScriptExecution, scriptExecution };
17
+ export { fileToBase64, CookieUtils, argsToString, argsToObject, getSearchObj, asyncLocalStorage, asyncSessionStorage, camelToSnake, underscoreToCamelCase, generateRandom18Int, formatModuleData, patternTransitionRegExp, stringPramarsValTransition, loopPageStaticCodeMap, getDataArr, replaceParamsValue, replaceParamsValueForEvent, getParamsContentByParamKeys, getFileUrlById, getRemoteComponentUrlByCode, getRemoteComponentUrlById, stringScriptExecution, scriptExecution, isValidUrl, sanitizeRedirectUrl, safeRedirect, sanitizeEventHandler };
17
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["fileToBase64","CookieUtils","argsToString","argsToObject","getSearchObj","asyncLocalStorage","asyncSessionStorage","camelToSnake","underscoreToCamelCase","generateRandom18Int","getDataArr","replaceParamsValue","getParamsContentByParamKeys","replaceParamsValueForEvent","formatModuleData","patternTransitionRegExp","stringPramarsValTransition","stringScriptExecution","loopPageStaticCodeMap","scriptExecution","getFileUrlById","getRemoteComponentUrlByCode","getRemoteComponentUrlById","_","require","noConflict"],"sources":["../../src/index.ts"],"sourcesContent":["import fileToBase64, { type fileToBase64Type } from './fileToBase64';\nimport CookieUtils from './CookieUtils';\nimport { argsToString, argsToObject, getSearchObj } from './pathArgsUtils';\nimport {\n asyncLocalStorage,\n asyncSessionStorage,\n type asyncLocalStorageType,\n type asyncSessionStorageType,\n} from './asyncStorage';\nimport {\n camelToSnake,\n underscoreToCamelCase,\n generateRandom18Int,\n} from './stringUtils';\nimport {\n getDataArr,\n replaceParamsValue,\n getParamsContentByParamKeys,\n replaceParamsValueForEvent,\n} from './treeUtils';\nimport formatModuleData from './formatModule/formatModuleData';\nimport {\n patternTransitionRegExp,\n stringPramarsValTransition,\n stringScriptExecution,\n} from './formatModule/helpers';\nimport loopPageStaticCodeMap from './loopPageStaticCodeMap';\nimport scriptExecution, { type scriptExecutionType } from './scriptExecution';\nimport {\n getFileUrlById,\n getRemoteComponentUrlByCode,\n getRemoteComponentUrlById,\n} from './file';\n\n\n// 避免 _对象 和其他库冲突\nconst _ = require('lodash');\n\n_.noConflict();\n\nexport type {\n fileToBase64Type,\n asyncLocalStorageType,\n asyncSessionStorageType,\n scriptExecutionType,\n};\n\nexport {\n fileToBase64,\n CookieUtils,\n argsToString,\n argsToObject,\n getSearchObj,\n asyncLocalStorage,\n asyncSessionStorage,\n camelToSnake,\n underscoreToCamelCase,\n generateRandom18Int,\n formatModuleData,\n patternTransitionRegExp,\n stringPramarsValTransition,\n loopPageStaticCodeMap,\n getDataArr,\n replaceParamsValue,\n replaceParamsValueForEvent,\n getParamsContentByParamKeys,\n getFileUrlById,\n getRemoteComponentUrlByCode,\n getRemoteComponentUrlById,\n stringScriptExecution,\n scriptExecution,\n};\n"],"mappings":"AAAA,OAAOA,YAAY;AACnB,OAAOC,WAAW;AAClB,SAASC,YAAY,EAAEC,YAAY,EAAEC,YAAY;AACjD,SACEC,iBAAiB,EACjBC,mBAAmB;AAIrB,SACEC,YAAY,EACZC,qBAAqB,EACrBC,mBAAmB;AAErB,SACEC,UAAU,EACVC,kBAAkB,EAClBC,2BAA2B,EAC3BC,0BAA0B;AAE5B,OAAOC,gBAAgB;AACvB,SACEC,uBAAuB,EACvBC,0BAA0B,EAC1BC,qBAAqB;AAEvB,OAAOC,qBAAqB;AAC5B,OAAOC,eAAe;AACtB,SACEC,cAAc,EACdC,2BAA2B,EAC3BC,yBAAyB;;AAI3B;AACA,IAAMC,CAAC,GAAGC,OAAO,CAAC,QAAQ,CAAC;AAE3BD,CAAC,CAACE,UAAU,CAAC,CAAC;AASd,SACEzB,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,YAAY,EACZC,YAAY,EACZC,iBAAiB,EACjBC,mBAAmB,EACnBC,YAAY,EACZC,qBAAqB,EACrBC,mBAAmB,EACnBK,gBAAgB,EAChBC,uBAAuB,EACvBC,0BAA0B,EAC1BE,qBAAqB,EACrBR,UAAU,EACVC,kBAAkB,EAClBE,0BAA0B,EAC1BD,2BAA2B,EAC3BQ,cAAc,EACdC,2BAA2B,EAC3BC,yBAAyB,EACzBL,qBAAqB,EACrBE,eAAe"}
1
+ {"version":3,"names":["fileToBase64","CookieUtils","argsToString","argsToObject","getSearchObj","asyncLocalStorage","asyncSessionStorage","camelToSnake","underscoreToCamelCase","generateRandom18Int","getDataArr","replaceParamsValue","getParamsContentByParamKeys","replaceParamsValueForEvent","formatModuleData","patternTransitionRegExp","stringPramarsValTransition","stringScriptExecution","loopPageStaticCodeMap","scriptExecution","getFileUrlById","getRemoteComponentUrlByCode","getRemoteComponentUrlById","isValidUrl","sanitizeRedirectUrl","safeRedirect","sanitizeEventHandler","_","require","noConflict"],"sources":["../../src/index.ts"],"sourcesContent":["import fileToBase64, { type fileToBase64Type } from './fileToBase64';\nimport CookieUtils from './CookieUtils';\nimport { argsToString, argsToObject, getSearchObj } from './pathArgsUtils';\nimport {\n asyncLocalStorage,\n asyncSessionStorage,\n type asyncLocalStorageType,\n type asyncSessionStorageType,\n} from './asyncStorage';\nimport {\n camelToSnake,\n underscoreToCamelCase,\n generateRandom18Int,\n} from './stringUtils';\nimport {\n getDataArr,\n replaceParamsValue,\n getParamsContentByParamKeys,\n replaceParamsValueForEvent,\n} from './treeUtils';\nimport formatModuleData from './formatModule/formatModuleData';\nimport {\n patternTransitionRegExp,\n stringPramarsValTransition,\n stringScriptExecution,\n} from './formatModule/helpers';\nimport loopPageStaticCodeMap from './loopPageStaticCodeMap';\nimport scriptExecution, { type scriptExecutionType } from './scriptExecution';\nimport {\n getFileUrlById,\n getRemoteComponentUrlByCode,\n getRemoteComponentUrlById,\n} from './file';\nimport {\n isValidUrl,\n sanitizeRedirectUrl,\n safeRedirect,\n sanitizeEventHandler,\n} from './securityUtils';\n\n// 避免 _对象 和其他库冲突\nconst _ = require('lodash');\n\n_.noConflict();\n\nexport type {\n fileToBase64Type,\n asyncLocalStorageType,\n asyncSessionStorageType,\n scriptExecutionType,\n};\n\nexport {\n fileToBase64,\n CookieUtils,\n argsToString,\n argsToObject,\n getSearchObj,\n asyncLocalStorage,\n asyncSessionStorage,\n camelToSnake,\n underscoreToCamelCase,\n generateRandom18Int,\n formatModuleData,\n patternTransitionRegExp,\n stringPramarsValTransition,\n loopPageStaticCodeMap,\n getDataArr,\n replaceParamsValue,\n replaceParamsValueForEvent,\n getParamsContentByParamKeys,\n getFileUrlById,\n getRemoteComponentUrlByCode,\n getRemoteComponentUrlById,\n stringScriptExecution,\n scriptExecution,\n isValidUrl,\n sanitizeRedirectUrl,\n safeRedirect,\n sanitizeEventHandler,\n};\n"],"mappings":"AAAA,OAAOA,YAAY;AACnB,OAAOC,WAAW;AAClB,SAASC,YAAY,EAAEC,YAAY,EAAEC,YAAY;AACjD,SACEC,iBAAiB,EACjBC,mBAAmB;AAIrB,SACEC,YAAY,EACZC,qBAAqB,EACrBC,mBAAmB;AAErB,SACEC,UAAU,EACVC,kBAAkB,EAClBC,2BAA2B,EAC3BC,0BAA0B;AAE5B,OAAOC,gBAAgB;AACvB,SACEC,uBAAuB,EACvBC,0BAA0B,EAC1BC,qBAAqB;AAEvB,OAAOC,qBAAqB;AAC5B,OAAOC,eAAe;AACtB,SACEC,cAAc,EACdC,2BAA2B,EAC3BC,yBAAyB;AAE3B,SACEC,UAAU,EACVC,mBAAmB,EACnBC,YAAY,EACZC,oBAAoB;;AAGtB;AACA,IAAMC,CAAC,GAAGC,OAAO,CAAC,QAAQ,CAAC;AAE3BD,CAAC,CAACE,UAAU,CAAC,CAAC;AASd,SACE7B,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,YAAY,EACZC,YAAY,EACZC,iBAAiB,EACjBC,mBAAmB,EACnBC,YAAY,EACZC,qBAAqB,EACrBC,mBAAmB,EACnBK,gBAAgB,EAChBC,uBAAuB,EACvBC,0BAA0B,EAC1BE,qBAAqB,EACrBR,UAAU,EACVC,kBAAkB,EAClBE,0BAA0B,EAC1BD,2BAA2B,EAC3BQ,cAAc,EACdC,2BAA2B,EAC3BC,yBAAyB,EACzBL,qBAAqB,EACrBE,eAAe,EACfI,UAAU,EACVC,mBAAmB,EACnBC,YAAY,EACZC,oBAAoB"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * 安全工具函数,用于防止XSS等安全漏洞
3
+ */
4
+ /**
5
+ * 验证URL是否安全,防止XSS攻击
6
+ * @param url 待验证的URL
7
+ * @returns 是否为安全的URL
8
+ */
9
+ export declare const isValidUrl: (url: string) => boolean;
10
+ /**
11
+ * 清理和验证重定向URL,确保安全
12
+ * @param url 待清理的URL
13
+ * @param allowedDomains 允许的域名列表,为空时允许同源URL
14
+ * @returns 清理后的安全URL,如果不安全则返回默认URL
15
+ */
16
+ export declare const sanitizeRedirectUrl: (url: string, allowedDomains?: string[], defaultUrl?: string) => string;
17
+ /**
18
+ * 安全地设置window.location.href,防止XSS攻击
19
+ * @param url 目标URL
20
+ * @param allowedDomains 允许的域名列表
21
+ */
22
+ export declare const safeRedirect: (url: string, allowedDomains?: string[]) => void;
23
+ /**
24
+ * 验证和清理事件处理器,防止恶意代码注入
25
+ * @param handler 事件处理函数
26
+ * @returns 安全的事件处理函数
27
+ */
28
+ export declare const sanitizeEventHandler: (handler: Function) => Function;
@@ -0,0 +1,101 @@
1
+ /**
2
+ * 安全工具函数,用于防止XSS等安全漏洞
3
+ */
4
+
5
+ /**
6
+ * 验证URL是否安全,防止XSS攻击
7
+ * @param url 待验证的URL
8
+ * @returns 是否为安全的URL
9
+ */
10
+ export var isValidUrl = function isValidUrl(url) {
11
+ if (!url || typeof url !== 'string') {
12
+ return false;
13
+ }
14
+ try {
15
+ var urlObj = new URL(url, window.location.origin);
16
+
17
+ // 只允许http和https协议,防止javascript:等危险协议
18
+ if (!['http:', 'https:'].includes(urlObj.protocol)) {
19
+ return false;
20
+ }
21
+
22
+ // 检查是否包含危险字符
23
+ var dangerousPatterns = [/javascript:/i, /vbscript:/i, /data:/i, /file:/i, /<script/i, /onload=/i, /onerror=/i, /onclick=/i];
24
+ return !dangerousPatterns.some(function (pattern) {
25
+ return pattern.test(url);
26
+ });
27
+ } catch (_unused) {
28
+ return false;
29
+ }
30
+ };
31
+
32
+ /**
33
+ * 清理和验证重定向URL,确保安全
34
+ * @param url 待清理的URL
35
+ * @param allowedDomains 允许的域名列表,为空时允许同源URL
36
+ * @returns 清理后的安全URL,如果不安全则返回默认URL
37
+ */
38
+ export var sanitizeRedirectUrl = function sanitizeRedirectUrl(url) {
39
+ var allowedDomains = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
40
+ var defaultUrl = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '/';
41
+ if (!url || typeof url !== 'string') {
42
+ return defaultUrl;
43
+ }
44
+
45
+ // 基本URL验证
46
+ if (!isValidUrl(url)) {
47
+ return defaultUrl;
48
+ }
49
+ try {
50
+ var urlObj = new URL(url, window.location.origin);
51
+ var currentHost = window.location.hostname;
52
+
53
+ // 如果没有指定允许的域名,只允许同源URL
54
+ if (allowedDomains.length === 0) {
55
+ if (urlObj.hostname !== currentHost) {
56
+ return defaultUrl;
57
+ }
58
+ } else {
59
+ // 检查是否在允许的域名列表中
60
+ var isAllowedDomain = allowedDomains.some(function (domain) {
61
+ return urlObj.hostname === domain || urlObj.hostname.endsWith(".".concat(domain));
62
+ });
63
+ if (!isAllowedDomain && urlObj.hostname !== currentHost) {
64
+ return defaultUrl;
65
+ }
66
+ }
67
+ return urlObj.toString();
68
+ } catch (_unused2) {
69
+ return defaultUrl;
70
+ }
71
+ };
72
+
73
+ /**
74
+ * 安全地设置window.location.href,防止XSS攻击
75
+ * @param url 目标URL
76
+ * @param allowedDomains 允许的域名列表
77
+ */
78
+ export var safeRedirect = function safeRedirect(url) {
79
+ var allowedDomains = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
80
+ var safeUrl = sanitizeRedirectUrl(url, allowedDomains);
81
+ window.location.href = safeUrl;
82
+ };
83
+
84
+ /**
85
+ * 验证和清理事件处理器,防止恶意代码注入
86
+ * @param handler 事件处理函数
87
+ * @returns 安全的事件处理函数
88
+ */
89
+ export var sanitizeEventHandler = function sanitizeEventHandler(handler) {
90
+ if (typeof handler !== 'function') {
91
+ return function () {};
92
+ }
93
+ return function () {
94
+ try {
95
+ handler.apply(void 0, arguments);
96
+ } catch (error) {
97
+ console.error('Event handler error:', error);
98
+ }
99
+ };
100
+ };
101
+ //# sourceMappingURL=securityUtils.js.map