@boteteam/utils 0.0.27 → 0.0.29
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.js.map +1 -1
- package/dist/cjs/asyncStorage.js.map +1 -1
- package/dist/cjs/environment.js.map +1 -1
- package/dist/cjs/file.js.map +1 -1
- package/dist/cjs/fileToBase64.js.map +1 -1
- package/dist/cjs/formatModule/formatModuleData.js +99 -9
- package/dist/cjs/formatModule/formatModuleData.js.map +2 -2
- 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/formatControlBtn.d.ts +8 -0
- package/dist/cjs/formatModule/helpers/formatControlBtn.js +67 -0
- package/dist/cjs/formatModule/helpers/formatControlBtn.js.map +7 -0
- 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.d.ts +4 -1
- package/dist/cjs/formatModule/helpers/formatFormProps.js +51 -28
- package/dist/cjs/formatModule/helpers/formatFormProps.js.map +2 -2
- package/dist/cjs/formatModule/helpers/formatHighCodeProps.js.map +1 -1
- package/dist/cjs/formatModule/helpers/formatIconProps.d.ts +16 -0
- package/dist/cjs/formatModule/helpers/formatIconProps.js +49 -0
- package/dist/cjs/formatModule/helpers/formatIconProps.js.map +7 -0
- package/dist/cjs/formatModule/helpers/formatImageProps.js.map +1 -1
- package/dist/cjs/formatModule/helpers/formatListProps.js +69 -44
- package/dist/cjs/formatModule/helpers/formatListProps.js.map +3 -3
- package/dist/cjs/formatModule/helpers/formatLoopProps.d.ts +26 -2
- package/dist/cjs/formatModule/helpers/formatLoopProps.js +17 -10
- package/dist/cjs/formatModule/helpers/formatLoopProps.js.map +3 -3
- package/dist/cjs/formatModule/helpers/formatPanelProps.d.ts +8 -0
- package/dist/cjs/formatModule/helpers/formatPanelProps.js +67 -0
- package/dist/cjs/formatModule/helpers/formatPanelProps.js.map +7 -0
- 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.d.ts +5 -0
- package/dist/cjs/formatModule/helpers/formatTableProps.js +20 -0
- package/dist/cjs/formatModule/helpers/formatTableProps.js.map +3 -3
- package/dist/cjs/formatModule/helpers/index.d.ts +4 -1
- package/dist/cjs/formatModule/helpers/index.js +9 -0
- package/dist/cjs/formatModule/helpers/index.js.map +3 -3
- 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/getValueByPath.d.ts +10 -0
- package/dist/cjs/getValueByPath.js +69 -0
- package/dist/cjs/getValueByPath.js.map +7 -0
- package/dist/cjs/http.d.ts +8 -0
- package/dist/cjs/http.js +37 -1
- package/dist/cjs/http.js.map +2 -2
- package/dist/cjs/index.d.ts +5 -2
- package/dist/cjs/index.js +17 -0
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs/loopPageServiceApiMap.d.ts +17 -0
- package/dist/cjs/loopPageServiceApiMap.js +54 -0
- package/dist/cjs/loopPageServiceApiMap.js.map +7 -0
- package/dist/cjs/loopPageStaticCodeMap.js.map +1 -1
- package/dist/cjs/markdownEscape.js.map +1 -1
- package/dist/cjs/pathArgsUtils.js.map +1 -1
- package/dist/cjs/scriptExecution.js.map +1 -1
- package/dist/cjs/securityUtils.js +1 -1
- package/dist/cjs/securityUtils.js.map +2 -2
- package/dist/cjs/stringUtils.js.map +1 -1
- package/dist/cjs/timeFormat.d.ts +44 -0
- package/dist/cjs/timeFormat.js +127 -0
- package/dist/cjs/timeFormat.js.map +7 -0
- package/dist/cjs/treeUtils.js.map +1 -1
- package/dist/cjs/watchMatchMedia.js.map +1 -1
- 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.js +3 -3
- package/dist/esm/environment.js.map +1 -1
- package/dist/esm/file.js +32 -32
- 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 +118 -26
- 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/formatControlBtn.d.ts +8 -0
- package/dist/esm/formatModule/helpers/formatControlBtn.js +41 -0
- package/dist/esm/formatModule/helpers/formatControlBtn.js.map +1 -0
- 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.d.ts +4 -1
- package/dist/esm/formatModule/helpers/formatFormProps.js +93 -31
- 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/formatIconProps.d.ts +16 -0
- package/dist/esm/formatModule/helpers/formatIconProps.js +25 -0
- package/dist/esm/formatModule/helpers/formatIconProps.js.map +1 -0
- package/dist/esm/formatModule/helpers/formatImageProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatListProps.js +69 -44
- package/dist/esm/formatModule/helpers/formatListProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatLoopProps.d.ts +26 -2
- package/dist/esm/formatModule/helpers/formatLoopProps.js +35 -7
- package/dist/esm/formatModule/helpers/formatLoopProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/formatPanelProps.d.ts +8 -0
- package/dist/esm/formatModule/helpers/formatPanelProps.js +41 -0
- package/dist/esm/formatModule/helpers/formatPanelProps.js.map +1 -0
- 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.d.ts +5 -0
- package/dist/esm/formatModule/helpers/formatTableProps.js +12 -0
- package/dist/esm/formatModule/helpers/formatTableProps.js.map +1 -1
- package/dist/esm/formatModule/helpers/index.d.ts +4 -1
- package/dist/esm/formatModule/helpers/index.js +4 -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/getValueByPath.d.ts +10 -0
- package/dist/esm/getValueByPath.js +87 -0
- package/dist/esm/getValueByPath.js.map +1 -0
- package/dist/esm/http.d.ts +8 -0
- package/dist/esm/http.js +97 -58
- package/dist/esm/http.js.map +1 -1
- package/dist/esm/index.d.ts +5 -2
- package/dist/esm/index.js +5 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loopPageServiceApiMap.d.ts +17 -0
- package/dist/esm/loopPageServiceApiMap.js +40 -0
- package/dist/esm/loopPageServiceApiMap.js.map +1 -0
- package/dist/esm/loopPageStaticCodeMap.js.map +1 -1
- package/dist/esm/markdownEscape.js.map +1 -1
- package/dist/esm/pathArgsUtils.js +8 -8
- package/dist/esm/pathArgsUtils.js.map +1 -1
- package/dist/esm/scriptExecution.js.map +1 -1
- package/dist/esm/securityUtils.js +20 -20
- package/dist/esm/securityUtils.js.map +1 -1
- package/dist/esm/stringUtils.js.map +1 -1
- package/dist/esm/timeFormat.d.ts +44 -0
- package/dist/esm/timeFormat.js +121 -0
- package/dist/esm/timeFormat.js.map +1 -0
- package/dist/esm/treeUtils.js +8 -8
- package/dist/esm/treeUtils.js.map +1 -1
- package/dist/esm/watchMatchMedia.js.map +1 -1
- package/dist/umd/index.min.js +1 -1
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["get","set","formatEchartCommonProps","getDataArr","formatEchartLineProps","_ref","_ref$options","options","parameters","chartType","dataSource","labelDataIndex","attrSource","dynamicAttr","staticAttr","areaStyle","direction","chartLineProps","columnsList","dataKeyPath","labelKeyPath","dataList","seriesList","labelList","colKeyPath","Array","isArray","map","item","labelStr","slice","forEach","col","colDataPath","colName","title","dataIndex","_colKeyPath","_colKeyPath2","length","seriesItem","name","type","stack","data","dataVal","push"],"sources":["../../../../src/formatModule/helpers/formatEchartLineProps.ts"],"sourcesContent":["import { get, set } from 'lodash';\
|
|
1
|
+
{"version":3,"names":["get","set","formatEchartCommonProps","getDataArr","formatEchartLineProps","_ref","_ref$options","options","parameters","chartType","dataSource","labelDataIndex","attrSource","dynamicAttr","staticAttr","areaStyle","direction","chartLineProps","columnsList","dataKeyPath","labelKeyPath","dataList","seriesList","labelList","colKeyPath","Array","isArray","map","item","labelStr","slice","forEach","col","colDataPath","colName","title","dataIndex","_colKeyPath","_colKeyPath2","length","seriesItem","name","type","stack","data","dataVal","push"],"sources":["../../../../src/formatModule/helpers/formatEchartLineProps.ts"],"sourcesContent":["import { get, set } from 'lodash';\nimport formatEchartCommonProps from './formatEchartCommonProps';\nimport { getDataArr } from '../../treeUtils';\n\nexport type formatEchartLinePropsType = {\n options?: {\n dataSource?: string;\n labelDataIndex?: string;\n chartType?: 'line' | 'bar';\n direction?: 'horizontal' | 'vertical'; // 方向,折线图,柱状图生效\n attrSource?: 'staticAttr' | 'dynamicAttr',\n dynamicAttr?: string;\n staticAttr?: {[key:string]: any}[];\n areaStyle?: {[key:string]: any} | null;\n showLegend?: boolean;\n legend?: {[key:string]: any} | null;\n } & {[key:string]: any},\n parameters?:{[key:string]: any};\n}\n\nconst formatEchartLineProps = ({\n options = {},\n parameters,\n}: formatEchartLinePropsType) => {\n const {\n chartType,\n dataSource,\n labelDataIndex,\n attrSource,\n dynamicAttr,\n staticAttr,\n areaStyle,\n direction,\n } = options;\n const chartLineProps:{[key:string]: any} = formatEchartCommonProps({ options, parameters });\n let columnsList = [];\n const dataKeyPath = dataSource ? getDataArr(dataSource) : [];\n const labelKeyPath = labelDataIndex ? getDataArr(labelDataIndex) : [];\n const dataList = parameters && dataKeyPath ? get(parameters, dataKeyPath) : [];\n const seriesList:{[key:string]: any} = [];\n let labelList: string[] = [];\n if (attrSource === 'dynamicAttr' && dynamicAttr) {\n const colKeyPath = getDataArr(dynamicAttr);\n columnsList = parameters && colKeyPath ? get(parameters, colKeyPath) : [];\n } else {\n columnsList = Array.isArray(staticAttr) ? staticAttr : [];\n }\n if (Array.isArray(columnsList) && Array.isArray(dataList)) {\n if (labelKeyPath) {\n labelList = dataList.map(item => {\n const labelStr = get(item, labelKeyPath?.slice(2));\n return labelStr || '';\n });\n }\n columnsList.forEach(col => {\n let colKeyPath:string | string[] = [];\n let colDataPath:string | string[] = [];\n let colName = col?.title || '';\n if (attrSource === 'dynamicAttr' && col?.dataIndex) {\n colKeyPath = col?.dataIndex || '';\n colDataPath = col?.dataIndex || '';\n } else {\n colKeyPath = col?.dataIndex ? getDataArr(col?.dataIndex) : [];\n colDataPath = Array.isArray(colKeyPath) ? colKeyPath.slice(2) : [];\n colName = colName || colKeyPath?.[colKeyPath?.length - 1] || '';\n }\n const seriesItem:{[key:string]: any} = {\n name: colName,\n type: chartType,\n stack: 'Total',\n data: dataList.map(item => {\n const dataVal = get(item, colDataPath);\n return dataVal || 0;\n }),\n };\n if (areaStyle) {\n seriesItem.areaStyle = areaStyle;\n } else {\n delete seriesItem.areaStyle;\n }\n seriesList.push(seriesItem);\n });\n\n if (direction === 'vertical') {\n set(chartLineProps, ['options', 'xAxis'], {});\n set(chartLineProps, ['options', 'yAxis'], { data: labelList });\n } else {\n set(chartLineProps, ['options', 'xAxis'], { data: labelList });\n set(chartLineProps, ['options', 'yAxis'], { });\n }\n\n set(chartLineProps, ['options', 'tooltip', 'trigger'], 'axis');\n set(chartLineProps, ['options', 'series'], seriesList);\n }\n return chartLineProps;\n};\n\nexport default formatEchartLineProps;\n"],"mappings":"AAAA,SAASA,GAAG,EAAEC,GAAG,QAAQ,QAAQ;AACjC,OAAOC,uBAAuB;AAC9B,SAASC,UAAU;AAkBnB,IAAMC,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAAC,IAAA,EAGM;EAAA,IAAAC,YAAA,GAAAD,IAAA,CAF/BE,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAG,CAAC,CAAC,GAAAA,YAAA;IACZE,UAAU,GAAAH,IAAA,CAAVG,UAAU;EAEV,IACEC,SAAS,GAQPF,OAAO,CARTE,SAAS;IACTC,UAAU,GAORH,OAAO,CAPTG,UAAU;IACVC,cAAc,GAMZJ,OAAO,CANTI,cAAc;IACdC,UAAU,GAKRL,OAAO,CALTK,UAAU;IACVC,WAAW,GAITN,OAAO,CAJTM,WAAW;IACXC,UAAU,GAGRP,OAAO,CAHTO,UAAU;IACVC,SAAS,GAEPR,OAAO,CAFTQ,SAAS;IACTC,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I9B,SAAS,EAAE;QACbyB,UAAU,CAACzB,SAAS,GAAGA,SAAS;MAClC,CAAC,MAAM;QACL,OAAOyB,UAAU,CAACzB,SAAS;MAC7B;MACAO,UAAU,CAACwB,IAAI,CAACN,UAAU,CAAC;IAC7B,CAAC,CAAC;IAEF,IAAIxB,SAAS,KAAK,UAAU,EAAE;MAC5Bf,GAAG,CAACgB,cAAc,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;MAC7ChB,GAAG,CAACgB,cAAc,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE;QAAE2B,IAAI,EAAErB;MAAU,CAAC,CAAC;IAChE,CAAC,MAAM;MACLtB,GAAG,CAACgB,cAAc,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE;QAAE2B,IAAI,EAAErB;MAAU,CAAC,CAAC;MAC9DtB,GAAG,CAACgB,cAAc,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,CAAE,CAAC,CAAC;IAChD;IAEAhB,GAAG,CAACgB,cAAc,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAC9DhB,GAAG,CAACgB,cAAc,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAEK,UAAU,CAAC;EACxD;EACA,OAAOL,cAAc;AACvB,CAAC;AAED,eAAeb,qBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["set","formatEchartCommonProps","stringPramarsValTransition","getParamsContentByParamKeys","formatEchartPieProps","_ref","_ref$options","options","parameters","dataSource","insideRadius","externalRadius","startAngle","endAngle","showLabel","labelPosition","labelFormatter","itemBorderRadius","itemPadAngle","chartProps","seriesObj","type","emphasis","itemStyle","label","value","dataLabels","dataValues","seriesData","Array","isArray","forEach","item","idx","push","name","concat","show","labelObj","position","formatterStr","formatter","replace"],"sources":["../../../../src/formatModule/helpers/formatEchartPieProps.ts"],"sourcesContent":["import { set } from 'lodash';\
|
|
1
|
+
{"version":3,"names":["set","formatEchartCommonProps","stringPramarsValTransition","getParamsContentByParamKeys","formatEchartPieProps","_ref","_ref$options","options","parameters","dataSource","insideRadius","externalRadius","startAngle","endAngle","showLabel","labelPosition","labelFormatter","itemBorderRadius","itemPadAngle","chartProps","seriesObj","type","emphasis","itemStyle","label","value","dataLabels","dataValues","seriesData","Array","isArray","forEach","item","idx","push","name","concat","show","labelObj","position","formatterStr","formatter","replace"],"sources":["../../../../src/formatModule/helpers/formatEchartPieProps.ts"],"sourcesContent":["import { set } from 'lodash';\nimport formatEchartCommonProps from './formatEchartCommonProps';\nimport stringPramarsValTransition from './stringPramarsValTransition';\nimport { getParamsContentByParamKeys } from '../../treeUtils';\n\nexport type formatEchartLinePropsType = {\n options?: {\n dataSource?: {label?: string; value?:string };\n } & {[key:string]: any},\n parameters?:{[key:string]: any};\n}\n\nconst formatEchartPieProps = ({\n options = {},\n parameters,\n}: formatEchartLinePropsType) => {\n const {\n dataSource,\n insideRadius,\n externalRadius,\n startAngle,\n endAngle,\n showLabel,\n labelPosition,\n labelFormatter,\n itemBorderRadius,\n itemPadAngle,\n } = options;\n const chartProps:{[key:string]: any} = formatEchartCommonProps({ options, parameters });\n const seriesObj:{[key:string]: any} = {\n type: 'pie',\n emphasis: {\n itemStyle: {},\n },\n };\n if (dataSource?.label && dataSource?.value) {\n const dataLabels = getParamsContentByParamKeys(dataSource.label, parameters || {});\n const dataValues = getParamsContentByParamKeys(dataSource.value, parameters || {});\n const seriesData:{[key:string]: any} = [];\n if (Array.isArray(dataLabels)) {\n dataLabels.forEach((item, idx) => {\n seriesData.push({\n name: item || `${idx + 1}`,\n value: dataValues?.[idx] || 0,\n });\n });\n }\n\n set(seriesObj, ['data'], seriesData);\n\n if (typeof startAngle === 'number') {\n set(seriesObj, ['startAngle'], startAngle);\n }\n\n if (typeof endAngle === 'number') {\n set(seriesObj, ['endAngle'], endAngle);\n }\n\n set(seriesObj, ['radius'], [\n `${typeof insideRadius === 'number' ? insideRadius : 0}%`,\n `${typeof externalRadius === 'number' ? externalRadius : 50}%`,\n ]);\n\n if (!showLabel) {\n set(seriesObj, ['label'], { show: false });\n } else {\n const labelObj:{[key:string]:any} = {\n show: true,\n };\n if (labelPosition && typeof labelPosition === 'string') {\n labelObj.position = labelPosition;\n }\n if (labelFormatter && typeof labelFormatter === 'string') {\n const formatterStr = stringPramarsValTransition(labelFormatter, parameters || {});\n labelObj.formatter = formatterStr.replace(/\\\\n/gi, '\\n');\n }\n set(seriesObj, ['label'], labelObj);\n }\n\n if (itemBorderRadius && typeof itemBorderRadius === 'number') {\n set(seriesObj, ['itemStyle', 'borderRadius'], itemBorderRadius);\n }\n\n if (itemPadAngle && typeof itemPadAngle === 'number') {\n set(seriesObj, ['padAngle'], itemPadAngle);\n }\n\n set(chartProps, ['options', 'series'], [seriesObj]);\n }\n\n return chartProps;\n};\n\nexport default formatEchartPieProps;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,QAAQ;AAC5B,OAAOC,uBAAuB;AAC9B,OAAOC,0BAA0B;AACjC,SAASC,2BAA2B;AASpC,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAAC,IAAA,EAGO;EAAA,IAAAC,YAAA,GAAAD,IAAA,CAF/BE,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAG,CAAC,CAAC,GAAAA,YAAA;IACZE,UAAU,GAAAH,IAAA,CAAVG,UAAU;EAEV,IACEC,UAAU,GAURF,OAAO,CAVTE,UAAU;IACVC,YAAY,GASVH,OAAO,CATTG,YAAY;IACZC,cAAc,GAQZJ,OAAO,CARTI,cAAc;IACdC,UAAU,GAORL,OAAO,CAPTK,UAAU;IACVC,QAAQ,GAMNN,OAAO,CANTM,QAAQ;IACRC,SAAS,GAKPP,OAAO,CALTO,SAAS;IACTC,aAAa,GAIXR,OAAO,CAJTQ,aAAa;IACbC,cAAc,GAGZT,OAAO,CAHTS,cAAc;IACdC,gBAAgB,GAEdV,O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AAS,EAAE,QAAQ,CAAC,EAAE,CAACC,SAAS,CAAC,CAAC;EACrD;EAEA,OAAOD,UAAU;AACnB,CAAC;AAED,eAAef,oBAAoB"}
|
|
@@ -14,8 +14,11 @@ export type formatFormPropsType = {
|
|
|
14
14
|
staticOptionsMap: {
|
|
15
15
|
[key: string]: any;
|
|
16
16
|
};
|
|
17
|
+
serviceApiMap?: {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
};
|
|
17
20
|
};
|
|
18
|
-
declare const formatFormProps: ({ parameters, staticCodeMap, staticOptionsMap, options, }: formatFormPropsType) => {
|
|
21
|
+
declare const formatFormProps: ({ parameters, staticCodeMap, staticOptionsMap, serviceApiMap, options, }: formatFormPropsType) => {
|
|
19
22
|
[key: string]: any;
|
|
20
23
|
};
|
|
21
24
|
export default formatFormProps;
|
|
@@ -40,6 +40,8 @@ var formatFormProps = function formatFormProps(_ref) {
|
|
|
40
40
|
var parameters = _ref.parameters,
|
|
41
41
|
staticCodeMap = _ref.staticCodeMap,
|
|
42
42
|
staticOptionsMap = _ref.staticOptionsMap,
|
|
43
|
+
_ref$serviceApiMap = _ref.serviceApiMap,
|
|
44
|
+
serviceApiMap = _ref$serviceApiMap === void 0 ? {} : _ref$serviceApiMap,
|
|
43
45
|
_ref$options = _ref.options,
|
|
44
46
|
options = _ref$options === void 0 ? {} : _ref$options;
|
|
45
47
|
var children = options.children,
|
|
@@ -227,43 +229,103 @@ var formatFormProps = function formatFormProps(_ref) {
|
|
|
227
229
|
}
|
|
228
230
|
} else if (attrItemDataOptions !== null && attrItemDataOptions !== void 0 && attrItemDataOptions.contextOptions && parameters) {
|
|
229
231
|
var _attrItemDataOptions$, _attrItemDataOptions$2;
|
|
232
|
+
/**
|
|
233
|
+
* 处理下拉框数据源逻辑
|
|
234
|
+
* 1、 数据源为页面参数
|
|
235
|
+
* optLabelStr : ${pageParams.userList.item.name}
|
|
236
|
+
* optValueStr: ${pageParams.userList.item.id}
|
|
237
|
+
* parameters 中有个数据叫 userList,数据结构为:
|
|
238
|
+
* userList: [{
|
|
239
|
+
* name: '张三',
|
|
240
|
+
* id: '123',
|
|
241
|
+
* }]
|
|
242
|
+
* 2、 数据源为页面数据源
|
|
243
|
+
* optLabelStr: ${dataSource.access.listItem.ACCESS_NAME}
|
|
244
|
+
* optValueStr:${dataSource.access.listItem.ID}
|
|
245
|
+
* parameters 中有个数据叫 access,数据结构为:
|
|
246
|
+
* dataSource:{
|
|
247
|
+
* access: [{
|
|
248
|
+
* ACCESS_NAME: '张三',
|
|
249
|
+
* ID: '123',
|
|
250
|
+
* }],
|
|
251
|
+
* }
|
|
252
|
+
* 首先要判断optLabelStr和optValueStr 字符串前面的配置是否一致,如果不一致则给[] ,
|
|
253
|
+
* 比如 ${pageParams.userList.item.name} 和 ${pageParams.userLis.name} 就不一致
|
|
254
|
+
现在需要根据这个配置,把optLabelStr和optValueStr的值替换为实际的值 提供给下拉框的 options 属性, 如果是treeSelect, 则需要递归
|
|
255
|
+
*/
|
|
256
|
+
|
|
230
257
|
var optLabelStr = attrItemDataOptions === null || attrItemDataOptions === void 0 || (_attrItemDataOptions$ = attrItemDataOptions.contextOptions) === null || _attrItemDataOptions$ === void 0 ? void 0 : _attrItemDataOptions$.label;
|
|
231
258
|
var optValueStr = attrItemDataOptions === null || attrItemDataOptions === void 0 || (_attrItemDataOptions$2 = attrItemDataOptions.contextOptions) === null || _attrItemDataOptions$2 === void 0 ? void 0 : _attrItemDataOptions$2.value;
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
var optLabelArr = splitParamsPath(optLabelStr);
|
|
244
|
-
var optData = Array.isArray(parameters === null || parameters === void 0 ? void 0 : parameters[optValArr === null || optValArr === void 0 ? void 0 : optValArr[0]]) ? parameters === null || parameters === void 0 ? void 0 : parameters[optValArr === null || optValArr === void 0 ? void 0 : optValArr[0]] : [];
|
|
245
|
-
var labelApiPath = optLabelArr === null || optLabelArr === void 0 ? void 0 : optLabelArr.slice(2);
|
|
246
|
-
var valApiPath = optValArr === null || optValArr === void 0 ? void 0 : optValArr.slice(2);
|
|
247
|
-
var _formatToTreeData = function _formatToTreeData(optionsItems) {
|
|
248
|
-
if (Array.isArray(optionsItems)) {
|
|
249
|
-
return optionsItems.map(function (optItem) {
|
|
250
|
-
return {
|
|
251
|
-
title: get(optItem, labelApiPath),
|
|
252
|
-
value: get(optItem, valApiPath),
|
|
253
|
-
children: _formatToTreeData(optItem === null || optItem === void 0 ? void 0 : optItem.children)
|
|
254
|
-
};
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
return [];
|
|
258
|
-
};
|
|
259
|
-
if ((attrItem === null || attrItem === void 0 ? void 0 : attrItem.compType) === 'treeSelect') {
|
|
259
|
+
if (!optLabelStr || !optValueStr) {
|
|
260
|
+
formItem.props = _objectSpread(_objectSpread({}, formItem.props), {}, {
|
|
261
|
+
options: []
|
|
262
|
+
});
|
|
263
|
+
} else {
|
|
264
|
+
// 解析路径,使用 getDataArr 来统一处理路径解析
|
|
265
|
+
var labelPathArr = getDataArr(optLabelStr);
|
|
266
|
+
var valuePathArr = getDataArr(optValueStr);
|
|
267
|
+
|
|
268
|
+
// 检查路径长度,至少需要3段:数据源路径 + item/listItem + 字段名
|
|
269
|
+
if (labelPathArr.length < 2 || valuePathArr.length < 2) {
|
|
260
270
|
formItem.props = _objectSpread(_objectSpread({}, formItem.props), {}, {
|
|
261
|
-
|
|
271
|
+
options: []
|
|
262
272
|
});
|
|
263
273
|
} else {
|
|
264
|
-
|
|
265
|
-
|
|
274
|
+
// 提取数据源路径(去掉最后两个字段:item/listItem 和字段名)
|
|
275
|
+
// 对于页面参数:${pageParams.userList.item.name} -> ['userList', 'item', 'name'] -> 数据源路径: ['userList']
|
|
276
|
+
// 对于数据源:${dataSource.access.listItem.ACCESS_NAME} -> ['dataSource', 'access', 'listItem', 'ACCESS_NAME'] -> 数据源路径: ['dataSource', 'access']
|
|
277
|
+
var labelDataSourcePath = labelPathArr.slice(0, -2);
|
|
278
|
+
var valueDataSourcePath = valuePathArr.slice(0, -2);
|
|
279
|
+
|
|
280
|
+
// 检查数据源路径是否一致
|
|
281
|
+
var isPathConsistent = labelDataSourcePath.length === valueDataSourcePath.length && labelDataSourcePath.every(function (item, index) {
|
|
282
|
+
return item === valueDataSourcePath[index];
|
|
266
283
|
});
|
|
284
|
+
if (!isPathConsistent) {
|
|
285
|
+
// 路径不一致,返回空数组
|
|
286
|
+
formItem.props = _objectSpread(_objectSpread({}, formItem.props), {}, {
|
|
287
|
+
options: []
|
|
288
|
+
});
|
|
289
|
+
} else {
|
|
290
|
+
// 路径一致,从 parameters 中获取数据
|
|
291
|
+
var dataSourceData = get(parameters, labelDataSourcePath);
|
|
292
|
+
|
|
293
|
+
// 检查数据是否为数组
|
|
294
|
+
if (!Array.isArray(dataSourceData)) {
|
|
295
|
+
formItem.props = _objectSpread(_objectSpread({}, formItem.props), {}, {
|
|
296
|
+
options: []
|
|
297
|
+
});
|
|
298
|
+
} else {
|
|
299
|
+
// 提取字段路径(最后两个字段:item/listItem 和字段名)
|
|
300
|
+
// 对于页面参数:['userList', 'item', 'name'] -> 字段路径: ['name']
|
|
301
|
+
// 对于数据源:['dataSource', 'access', 'listItem', 'ACCESS_NAME'] -> 字段路径: ['ACCESS_NAME']
|
|
302
|
+
var labelFieldPath = labelPathArr.slice(-1);
|
|
303
|
+
var valueFieldPath = valuePathArr.slice(-1);
|
|
304
|
+
|
|
305
|
+
// 递归格式化树形数据
|
|
306
|
+
var _formatToTreeData = function _formatToTreeData(optionsItems) {
|
|
307
|
+
if (Array.isArray(optionsItems)) {
|
|
308
|
+
return optionsItems.map(function (optItem) {
|
|
309
|
+
return {
|
|
310
|
+
title: get(optItem, labelFieldPath),
|
|
311
|
+
value: get(optItem, valueFieldPath),
|
|
312
|
+
children: _formatToTreeData((optItem === null || optItem === void 0 ? void 0 : optItem.children) || [])
|
|
313
|
+
};
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
return [];
|
|
317
|
+
};
|
|
318
|
+
if ((attrItem === null || attrItem === void 0 ? void 0 : attrItem.compType) === 'treeSelect') {
|
|
319
|
+
formItem.props = _objectSpread(_objectSpread({}, formItem.props), {}, {
|
|
320
|
+
treeData: _formatToTreeData(dataSourceData)
|
|
321
|
+
});
|
|
322
|
+
} else {
|
|
323
|
+
formItem.props = _objectSpread(_objectSpread({}, formItem.props), {}, {
|
|
324
|
+
options: formatOptionsRecursively(dataSourceData, labelFieldPath, valueFieldPath)
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
267
329
|
}
|
|
268
330
|
}
|
|
269
331
|
}
|
|
@@ -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","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';\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 \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: get(optItem, labelApiPath),\r\n value: get(optItem, valApiPath),\r\n children: formatToTreeData(optItem?.children),\r\n }));\r\n }\r\n return [];\r\n };\r\n \r\n if (attrItem?.compType === 'treeSelect') {\r\n formItem.props = {\r\n ...formItem.props,\r\n treeData: formatToTreeData(optData),\r\n };\r\n } else {\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 }\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"],"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,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAK0B;EAAA,IAJ7CC,UAAU,GAAAD,IAAA,CAAVC,UAAU;IACVC,aAAa,GAAAF,IAAA,CAAbE,aAAa;IACbC,gBAAgB,GAAAH,IAAA,CAAhBG,gBAAgB;IAAAC,YAAA,GAAAJ,IAAA,CAChBK,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAG,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"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$serviceApiMap","serviceApiMap","_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","labelPathArr","valuePathArr","labelDataSourcePath","slice","valueDataSourcePath","isPathConsistent","every","index","dataSourceData","labelFieldPath","valueFieldPath","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 serviceApiMap?: {[key:string]: any}; // serviceApi数据MAP,key为 attrId\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 serviceApiMap = {},\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 /**\n * 处理下拉框数据源逻辑\n * 1、 数据源为页面参数\n * optLabelStr : ${pageParams.userList.item.name}\n * optValueStr: ${pageParams.userList.item.id}\n * parameters 中有个数据叫 userList,数据结构为:\n * userList: [{\n * name: '张三',\n * id: '123',\n * }]\n * 2、 数据源为页面数据源\n * optLabelStr: ${dataSource.access.listItem.ACCESS_NAME}\n * optValueStr:${dataSource.access.listItem.ID}\n * parameters 中有个数据叫 access,数据结构为:\n * dataSource:{\n * access: [{\n * ACCESS_NAME: '张三',\n * ID: '123',\n * }],\n * }\n * 首先要判断optLabelStr和optValueStr 字符串前面的配置是否一致,如果不一致则给[] ,\n * 比如 ${pageParams.userList.item.name} 和 ${pageParams.userLis.name} 就不一致\n 现在需要根据这个配置,把optLabelStr和optValueStr的值替换为实际的值 提供给下拉框的 options 属性, 如果是treeSelect, 则需要递归\n */\n\n const optLabelStr = attrItemDataOptions?.contextOptions?.label;\n const optValueStr = attrItemDataOptions?.contextOptions?.value;\n\n if (!optLabelStr || !optValueStr) {\n formItem.props = {\n ...formItem.props,\n options: [],\n };\n } else {\n // 解析路径,使用 getDataArr 来统一处理路径解析\n const labelPathArr = getDataArr(optLabelStr);\n const valuePathArr = getDataArr(optValueStr);\n\n // 检查路径长度,至少需要3段:数据源路径 + item/listItem + 字段名\n if (labelPathArr.length < 2 || valuePathArr.length < 2) {\n formItem.props = {\n ...formItem.props,\n options: [],\n };\n } else {\n // 提取数据源路径(去掉最后两个字段:item/listItem 和字段名)\n // 对于页面参数:${pageParams.userList.item.name} -> ['userList', 'item', 'name'] -> 数据源路径: ['userList']\n // 对于数据源:${dataSource.access.listItem.ACCESS_NAME} -> ['dataSource', 'access', 'listItem', 'ACCESS_NAME'] -> 数据源路径: ['dataSource', 'access']\n const labelDataSourcePath = labelPathArr.slice(0, -2);\n const valueDataSourcePath = valuePathArr.slice(0, -2);\n\n // 检查数据源路径是否一致\n const isPathConsistent = labelDataSourcePath.length === valueDataSourcePath.length &&\n labelDataSourcePath.every((item, index) => item === valueDataSourcePath[index]);\n\n if (!isPathConsistent) {\n // 路径不一致,返回空数组\n formItem.props = {\n ...formItem.props,\n options: [],\n };\n } else {\n // 路径一致,从 parameters 中获取数据\n const dataSourceData = get(parameters, labelDataSourcePath);\n\n // 检查数据是否为数组\n if (!Array.isArray(dataSourceData)) {\n formItem.props = {\n ...formItem.props,\n options: [],\n };\n } else {\n // 提取字段路径(最后两个字段:item/listItem 和字段名)\n // 对于页面参数:['userList', 'item', 'name'] -> 字段路径: ['name']\n // 对于数据源:['dataSource', 'access', 'listItem', 'ACCESS_NAME'] -> 字段路径: ['ACCESS_NAME']\n const labelFieldPath = labelPathArr.slice(-1);\n const valueFieldPath = valuePathArr.slice(-1);\n\n // 递归格式化树形数据\n const formatToTreeData = (optionsItems: {[key:string]: any}[]):{[key:string]: any}[] => {\n if (Array.isArray(optionsItems)) {\n return optionsItems.map(optItem => ({\n title: get(optItem, labelFieldPath),\n value: get(optItem, valueFieldPath),\n children: formatToTreeData(optItem?.children || []),\n }));\n }\n return [];\n };\n\n if (attrItem?.compType === 'treeSelect') {\n formItem.props = {\n ...formItem.props,\n treeData: formatToTreeData(dataSourceData),\n };\n } else {\n formItem.props = {\n ...formItem.props,\n options: formatOptionsRecursively(dataSourceData, labelFieldPath, valueFieldPath),\n };\n }\n }\n }\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;AAa9B,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,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAM0B;EAAA,IAL7CC,UAAU,GAAAD,IAAA,CAA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ACL;oBACA,OAAO,EAAE;kBACX,CAAC;kBAED,IAAI,CAAAkB,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAE0B,QAAQ,MAAK,YAAY,EAAE;oBACvCL,QAAQ,CAACM,KAAK,GAAAG,aAAA,CAAAA,aAAA,KACTT,QAAQ,CAACM,KAAK;sBACjB2D,QAAQ,EAAEJ,iBAAgB,CAACkB,cAAc;oBAAC,EAC3C;kBACH,CAAC,MAAM;oBACL/E,QAAQ,CAACM,KAAK,GAAAG,aAAA,CAAAA,aAAA,KACTT,QAAQ,CAACM,KAAK;sBACjBlC,OAAO,EAAEpB,wBAAwB,CAAC+H,cAAc,EAAEC,cAAc,EAAEC,cAAc;oBAAC,EAClF;kBACH;gBACF;cACF;YACF;UACF;QACF;MACF;MACA1G,SAAS,CAAC2G,IAAI,CAAClF,QAAQ,CAAC;IAC1B,CAAC,CAAC;EACJ;EACA,IAAI,OAAO3B,MAAM,KAAK,QAAQ,IAAIA,MAAM,GAAG,CAAC,EAAE;IAC5CC,GAAG,CAAC6G,QAAQ,GAAG,MAAM;IACrB7G,GAAG,CAAC8G,IAAI,GAAG,EAAE,GAAG/G,MAAM;EACxB,CAAC,MAAM;IACLC,GAAG,CAAC6G,QAAQ,GAAG,SAAS;IACxB,OAAO7G,GAAG,CAAC8G,IAAI;EACjB;EACA9G,GAAG,CAACC,SAAS,GAAGA,SAAS;EACzBD,GAAG,CAAC+G,aAAa,GAAG7G,UAAU;EAC9B,OAAOF,GAAG;AACZ,CAAC;AAED,eAAeV,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["get","stringPramarsValTransition","getDataArr","formatHighCodeProps","_ref","_loopToGetValue","_ref$options","options","parameters","res","_options$fileProps","fileProps","_fileProps$parameters","compParams","loopToGetValue","list","map","l","_lt$children","lt","_objectSpread","oriVal","value","includes","type","oriValPath","children","length","changeParamsConfigToObject","param","_param$children","obj","Object","forEach","child","name","_param$children2","element","arr","Array","arrItem","assign","paramsObj"],"sources":["../../../../src/formatModule/helpers/formatHighCodeProps.ts"],"sourcesContent":["import { get } from 'lodash';\
|
|
1
|
+
{"version":3,"names":["get","stringPramarsValTransition","getDataArr","formatHighCodeProps","_ref","_loopToGetValue","_ref$options","options","parameters","res","_options$fileProps","fileProps","_fileProps$parameters","compParams","loopToGetValue","list","map","l","_lt$children","lt","_objectSpread","oriVal","value","includes","type","oriValPath","children","length","changeParamsConfigToObject","param","_param$children","obj","Object","forEach","child","name","_param$children2","element","arr","Array","arrItem","assign","paramsObj"],"sources":["../../../../src/formatModule/helpers/formatHighCodeProps.ts"],"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"],"mappings":";;;;;;AAAA,SAASA,GAAG,QAAQ,QAAQ;AAC5B,OAAOC,0BAA0B;AACjC,SAASC,UAAU;AAUnB,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAAC,IAAA,EAG0C;EAAA,IAAAC,eAAA;EAAA,IAAAC,YAAA,GAAAF,IAAA,CAFjEG,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAG,CAAC,CAAC,GAAAA,YAAA;IACZE,UAAU,GAAAJ,IAAA,CAAVI,UAAU;EAEV,IAAMC,GAA2B,GAAG,CAAC,CAAC;EACtC,IAAAC,kBAAA,GAA2BH,OAAO,CAA1BI,SAAS;IAATA,SAAS,GAAAD,kBAAA,cAAG,CAAC,CAAC,GAAAA,kBAAA;EACtB,IAAAE,qBAAA,GAAwCD,SAAS,CAAzCH,UAAU;IAAEK,UAAU,GAAAD,qBAAA,cAAG,EAAE,GAAAA,qBAAA;;EAEnC;EACA,IAAME,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,IAAW;IAAA,OAAKA,IAAI,CAACC,GAAG,CAAC,UAAAC,CAAC,EAAI;MAAA,IAAAC,YAAA;MACpD,IAAIC,EAAE,GAAAC,aAAA,KAAQH,CAAC,CAAE;MAEjB,IAAI,CAACE,EAAE,CAACE,MAAM,EAAE;QACdF,EAAE,GAAAC,aAAA,CAAAA,aAAA,KAAQD,EAAE;UAAEE,MAAM,EAAEF,EAAE,CAACG;Q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OAAO,IAAAD,gBAAA,GAAGP,KAAK,CAACH,QAAQ,cAAAU,gBAAA,uBAAdA,gBAAA,CAAiB,CAAC,CAAC;MACnC,IAAME,GAAU,GAAGT,KAAK,CAACP,KAAK,YAAYiB,KAAK,GAAGV,KAAK,CAACP,KAAK,GAAG,EAAE;MAElE,IAAIe,OAAO,IAAIC,GAAG,aAAHA,GAAG,eAAHA,GAAG,CAAEX,MAAM,EAAE;QAC1BW,GAAG,CAACL,OAAO,CAAC,UAAAO,OAAO,EAAI;UACrB,IAAIH,OAAO,CAACb,IAAI,KAAK,QAAQ,IAAIgB,OAAO,EAAE;YACxCR,MAAM,CAACS,MAAM,CAACD,OAAO,EAAEZ,0BAA0B,CAACS,OAAO,CAAC,CAAC;UAC7D;QACF,CAAC,CAAC;MACJ;MAEA,OAAOC,GAAG;IACZ;;IAEA;IACA,IAAIT,KAAK,CAACL,IAAI,KAAK,SAAS,IAAIK,KAAK,CAACP,KAAK,EAAE;MAC3C,OAAOO,KAAK,CAACP,KAAK,KAAK,MAAM,IAAIO,KAAK,CAACP,KAAK,KAAK,GAAG;IACtD;IAEA,OAAOO,KAAK,CAACP,KAAK,IAAI,IAAI;EAC5B,CAAC;EAED,IAAMoB,SAAS,GAAGd,0BAA0B,CAAC,EAAAvB,eAAA,GAAAS,cAAc,CAACD,UAAU,CAAC,cAAAR,eAAA,uBAA1BA,eAAA,CAA6B,CAAC,CAAC,KAAI,CAAC,CAAC,CAAC;EACnFI,GAAG,CAACD,UAAU,GAAGkC,SAAS;EAC1B,OAAOjC,GAAG;AACZ,CAAC;AAGD,eAAeN,mBAAmB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type formatIconPropsType = {
|
|
3
|
+
icon?: {
|
|
4
|
+
icon: string;
|
|
5
|
+
type: 'bote' | 'antd' | 'script' | 'custom';
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
className?: string;
|
|
8
|
+
};
|
|
9
|
+
parameters?: {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
declare const formatIconProps: ({ parameters, icon, }: formatIconPropsType) => {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
};
|
|
16
|
+
export default formatIconProps;
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
import { stringScriptExecution } from "./stringScriptExecution";
|
|
3
|
+
var formatIconProps = function formatIconProps(_ref) {
|
|
4
|
+
var parameters = _ref.parameters,
|
|
5
|
+
icon = _ref.icon;
|
|
6
|
+
var res = {
|
|
7
|
+
style: icon === null || icon === void 0 ? void 0 : icon.style,
|
|
8
|
+
className: icon === null || icon === void 0 ? void 0 : icon.className
|
|
9
|
+
};
|
|
10
|
+
if ((icon === null || icon === void 0 ? void 0 : icon.type) === 'script') {
|
|
11
|
+
var scriptResult = stringScriptExecution(icon === null || icon === void 0 ? void 0 : icon.icon, parameters);
|
|
12
|
+
if (scriptResult && _typeof(scriptResult) === 'object') {
|
|
13
|
+
res.icon = scriptResult === null || scriptResult === void 0 ? void 0 : scriptResult.icon;
|
|
14
|
+
res.type = scriptResult === null || scriptResult === void 0 ? void 0 : scriptResult.type;
|
|
15
|
+
res.style = scriptResult === null || scriptResult === void 0 ? void 0 : scriptResult.style;
|
|
16
|
+
res.className = scriptResult === null || scriptResult === void 0 ? void 0 : scriptResult.className;
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
res.type = icon === null || icon === void 0 ? void 0 : icon.type;
|
|
20
|
+
res.icon = icon === null || icon === void 0 ? void 0 : icon.icon;
|
|
21
|
+
}
|
|
22
|
+
return res;
|
|
23
|
+
};
|
|
24
|
+
export default formatIconProps;
|
|
25
|
+
//# sourceMappingURL=formatIconProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["stringScriptExecution","formatIconProps","_ref","parameters","icon","res","style","className","type","scriptResult","_typeof"],"sources":["../../../../src/formatModule/helpers/formatIconProps.ts"],"sourcesContent":["\nimport { stringScriptExecution } from './stringScriptExecution';\n\nexport type formatIconPropsType = {\n icon?: {\n icon: string;\n type: 'bote' | 'antd' | 'script' | 'custom'; // 博特图标、Antd图标、脚本、自定义图标\n style?: React.CSSProperties;\n className?: string;\n };\n parameters?: {[key:string]: any};\n}\n\nconst formatIconProps = ({\n parameters,\n icon,\n}: formatIconPropsType):{[key:string]: any} => {\n const res:{[key:string]: any} = {\n style: icon?.style,\n className: icon?.className,\n };\n if (icon?.type === 'script') {\n const scriptResult = stringScriptExecution(icon?.icon, parameters);\n if (scriptResult && typeof scriptResult === 'object') {\n res.icon = scriptResult?.icon;\n res.type = scriptResult?.type;\n res.style = scriptResult?.style;\n res.className = scriptResult?.className;\n }\n } else {\n res.type = icon?.type;\n res.icon = icon?.icon;\n }\n return res;\n};\n\nexport default formatIconProps;\n"],"mappings":";AACA,SAASA,qBAAqB;AAY9B,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAG0B;EAAA,IAF7CC,UAAU,GAAAD,IAAA,CAAVC,UAAU;IACVC,IAAI,GAAAF,IAAA,CAAJE,IAAI;EAEJ,IAAMC,GAAuB,GAAG;IAC9BC,KAAK,EAAEF,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEE,KAAK;IAClBC,SAAS,EAAEH,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEG;EACnB,CAAC;EACD,IAAI,CAAAH,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEI,IAAI,MAAK,QAAQ,EAAE;IAC3B,IAAMC,YAAY,GAAGT,qBAAqB,CAACI,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEA,IAAI,EAAED,UAAU,CAAC;IAClE,IAAIM,YAAY,IAAIC,OAAA,CAAOD,YAAY,MAAK,QAAQ,EAAE;MACpDJ,GAAG,CAACD,IAAI,GAAGK,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEL,IAAI;MAC7BC,GAAG,CAACG,IAAI,GAAGC,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAED,IAAI;MAC7BH,GAAG,CAACC,KAAK,GAAGG,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEH,KAAK;MAC/BD,GAAG,CAACE,SAAS,GAAGE,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEF,SAAS;IACzC;EACF,CAAC,MAAM;IACLF,GAAG,CAACG,IAAI,GAAGJ,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEI,IAAI;IACrBH,GAAG,CAACD,IAAI,GAAGA,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEA,IAAI;EACvB;EACA,OAAOC,GAAG;AACZ,CAAC;AAED,eAAeJ,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getParamsContentByParamKeys","getFileUrlById","formatImageProps","_ref","parameters","_ref$options","options","dataSource","res","dataType","Array","isArray","fileList","length","_dataSource$fileList","_dataSource$fileList2","src","fileId","alt","fileName","fileUrl","fileDesc"],"sources":["../../../../src/formatModule/helpers/formatImageProps.ts"],"sourcesContent":["import { getParamsContentByParamKeys } from '../../treeUtils';\
|
|
1
|
+
{"version":3,"names":["getParamsContentByParamKeys","getFileUrlById","formatImageProps","_ref","parameters","_ref$options","options","dataSource","res","dataType","Array","isArray","fileList","length","_dataSource$fileList","_dataSource$fileList2","src","fileId","alt","fileName","fileUrl","fileDesc"],"sources":["../../../../src/formatModule/helpers/formatImageProps.ts"],"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"],"mappings":"AAAA,SAASA,2BAA2B;AACpC,SAASC,cAAc;AASvB,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,IAAQE,UAAU,GAAKD,OAAO,CAAtBC,UAAU;EAClB,IAAMC,GAAuB,GAAG,CAAC,CAAC;EAClC,IACE,CAAAD,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEE,QAAQ,MAAK,YAAY,IACjCC,KAAK,CAACC,OAAO,CAACJ,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEK,QAAQ,CAAC,IACnC,CAAAL,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEK,QAAQ,CAACC,MAAM,IAAG,CAAC,EACnC;IAAA,IAAAC,oBAAA,EAAAC,qBAAA;IACAP,GAAG,CAACQ,GAAG,GAAGf,cAAc,CAACM,UAAU,aAAVA,UAAU,gBAAAO,oBAAA,GAAVP,UAAU,CAAEK,QAAQ,cAAAE,oBAAA,gBAAAA,oBAAA,GAApBA,oBAAA,CAAuB,CAAC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