@boteteam/utils 0.0.28 → 0.0.30
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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/formatModule/helpers/formatEchartCommonProps.ts"],
|
|
4
|
-
"sourcesContent": ["import { set } from 'lodash';\
|
|
4
|
+
"sourcesContent": ["import { set } from 'lodash';\nimport stringPramarsValTransition from './stringPramarsValTransition';\n\nexport type formatEchartLinePropsType = {\n options?: {[key:string]: any},\n parameters?:{[key:string]: any};\n}\n\nconst eachPosition = (positonName:string) => {\n let res:{[key:string]: any} = {};\n switch (positonName) {\n case 'leftTop':\n res = {\n left: 0,\n top: 0,\n };\n break;\n case 'topCenter':\n res = {\n left: 'center',\n top: 0,\n };\n break;\n case 'rightTop':\n res = {\n right: 0,\n top: 0,\n };\n break;\n case 'leftCenter':\n res = {\n left: 0,\n top: 'center',\n };\n break;\n case 'center':\n res = {\n right: 'center',\n top: 'center',\n };\n break;\n case 'rightCenter':\n res = {\n right: 0,\n top: 'center',\n };\n break;\n case 'leftBottom':\n res = {\n left: 0,\n bottom: 0,\n };\n break;\n case 'bottomCenter':\n res = {\n left: 'center',\n bottom: 0,\n };\n break;\n case 'rightBottom':\n res = {\n right: 0,\n bottom: 0,\n };\n break;\n default:\n break;\n }\n return res;\n};\n\nconst formatEchartLineProps = ({\n options = {},\n parameters = {},\n}: formatEchartLinePropsType) => {\n const {\n title,\n subtitle,\n grid,\n legend,\n color,\n showLegend,\n titlePosition,\n } = options;\n const chartOptions:{[key:string]: any} = {\n options: {\n title: {\n itemGap: 4,\n },\n tooltip: {\n feature: {\n saveAsImage: {},\n },\n },\n },\n };\n\n if (title || subtitle) {\n if (title) {\n set(chartOptions, ['options', 'title', 'text'], stringPramarsValTransition(title, parameters));\n }\n \n if (subtitle) {\n set(chartOptions, ['options', 'title', 'subtext'], stringPramarsValTransition(subtitle, parameters));\n }\n\n if (titlePosition) {\n const titlePositionObj:{[key:string]: any} = eachPosition(titlePosition);\n Object.keys(titlePositionObj).forEach(poKey => {\n set(chartOptions, ['options', 'title', poKey], titlePositionObj?.[poKey]);\n });\n }\n }\n\n if (grid) {\n set(chartOptions, ['options', 'grid'], grid);\n }\n \n if (showLegend) {\n let legndObj:{[key:string]: any} = {};\n if (legend) {\n const { position, ...otherLegnd } = legend;\n const positionObj = eachPosition(position);\n legndObj = {\n ...positionObj,\n ...otherLegnd,\n };\n }\n\n set(chartOptions, ['options', 'legend'], legndObj);\n }\n\n if (Array.isArray(color) && color?.length > 0) {\n set(chartOptions, ['options', 'color'], color);\n }\n \n return chartOptions;\n};\n\nexport default formatEchartLineProps;\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAoB;AACpB,wCAAuC;AAOvC,IAAM,eAAe,CAAC,gBAAuB;AAC3C,MAAI,MAA0B,CAAC;AAC/B,UAAQ,aAAa;AAAA,IACnB,KAAK;AACH,YAAM;AAAA,QACJ,MAAM;AAAA,QACN,KAAK;AAAA,MACP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AAC,WAAW,SAAS,SAAS,OAAG,kCAAAA,SAA2B,UAAU,UAAU,CAAC;AAAA,IACrG;AAEA,QAAI,eAAe;AACjB,YAAM,mBAAuC,aAAa,aAAa;AACvE,aAAO,KAAK,gBAAgB,EAAE,QAAQ,WAAS;AAC7C,+BAAI,cAAc,CAAC,WAAW,SAAS,KAAK,GAAG,qDAAmB,MAAM;AAAA,MAC1E,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,MAAM;AACR,2BAAI,cAAc,CAAC,WAAW,MAAM,GAAG,IAAI;AAAA,EAC7C;AAEA,MAAI,YAAY;AACd,QAAI,WAA+B,CAAC;AACpC,QAAI,QAAQ;AACV,YAAM,EAAE,UAAU,GAAG,WAAW,IAAI;AACpC,YAAM,cAAc,aAAa,QAAQ;AACzC,iBAAW;AAAA,QACT,GAAG;AAAA,QACH,GAAG;AAAA,MACL;AAAA,IACF;AAEA,2BAAI,cAAc,CAAC,WAAW,QAAQ,GAAG,QAAQ;AAAA,EACnD;AAEA,MAAI,MAAM,QAAQ,KAAK,MAAK,+BAAO,UAAS,GAAG;AAC7C,2BAAI,cAAc,CAAC,WAAW,OAAO,GAAG,KAAK;AAAA,EAC/C;AAEA,SAAO;AACT;AAEA,IAAO,kCAAQ;",
|
|
6
6
|
"names": ["stringPramarsValTransition"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/formatModule/helpers/formatEchartLineProps.ts"],
|
|
4
|
-
"sourcesContent": ["import { get, set } from 'lodash';\
|
|
4
|
+
"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"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAyB;AACzB,qCAAoC;AACpC,uBAA2B;AAkB3B,IAAM,wBAAwB,CAAC;AAAA,EAC7B,UAAU,CAAC;AAAA,EACX;AACF,MAAiC;AAC/B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,qBAAqC,+BAAAA,SAAwB,EAAE,SAAS,WAAW,CAAC;AAC1F,MAAI,cAAc,CAAC;AACnB,QAAM,cAAc,iBAAa,6BAAW,UAAU,IAAI,CAAC;AAC3D,QAAM,eAAe,qBAAiB,6BAAW,cAAc,IAAI,CAAC;AACpE,QAAM,WAAW,cAAc,kBAAc,mBAAI,YAAY,WAAW,IAAI,CAAC;AAC7E,QAAM,aAAiC,CAAC;AACxC,MAAI,YAAsB,CAAC;AAC3B,MAAI,eAAe,iBAAiB,aAAa;AAC/C,UAAM,iBAAa,6BAAW,WAAW;AACzC,kBAAc,cAAc,iBAAa,mBAAI,YAAY,UAAU,IAAI,CAAC;AAAA,EAC1E,OAAO;AACL,kBAAc,MAAM,QAAQ,UAAU,IAAI,aAAa,CAAC;AAAA,EAC1D;AACA,MAAI,MAAM,QAAQ,WAAW,KAAK,MAAM,QAAQ,QAAQ,GAAG;A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GAAG,MAAM;AAC7D,2BAAI,gBAAgB,CAAC,WAAW,QAAQ,GAAG,UAAU;AAAA,EACvD;AACA,SAAO;AACT;AAEA,IAAO,gCAAQ;",
|
|
6
6
|
"names": ["formatEchartCommonProps"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/formatModule/helpers/formatEchartPieProps.ts"],
|
|
4
|
-
"sourcesContent": ["import { set } from 'lodash';\
|
|
4
|
+
"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"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAoB;AACpB,qCAAoC;AACpC,wCAAuC;AACvC,uBAA4C;AAS5C,IAAM,uBAAuB,CAAC;AAAA,EAC5B,UAAU,CAAC;AAAA,EACX;AACF,MAAiC;AAC/B,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,iBAAiC,+BAAAA,SAAwB,EAAE,SAAS,WAAW,CAAC;AACtF,QAAM,YAAgC;AAAA,IACpC,MAAM;AAAA,IACN,UAAU;AAAA,MACR,WAAW,CAAC;AAAA,IACd;AAAA,EACF;AACA,OAAI,yCAAY,WAAS,yCAAY,QAAO;AAC1C,UAAM,iBAAa,8CAA4B,WAAW,OAAO,cAAc,CAAC,CAAC;AACjF,UAAM,iBAAa,8CAA4B,WAAW,OAA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AAU,GAAG,YAAY;AAAA,IAC3C;AAEA,2BAAI,YAAY,CAAC,WAAW,QAAQ,GAAG,CAAC,SAAS,CAAC;AAAA,EACpD;AAEA,SAAO;AACT;AAEA,IAAO,+BAAQ;",
|
|
6
6
|
"names": ["formatEchartCommonProps", "stringPramarsValTransition"]
|
|
7
7
|
}
|
|
@@ -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;
|
|
@@ -56,6 +56,7 @@ var formatFormProps = ({
|
|
|
56
56
|
parameters,
|
|
57
57
|
staticCodeMap,
|
|
58
58
|
staticOptionsMap,
|
|
59
|
+
serviceApiMap = {},
|
|
59
60
|
options = {}
|
|
60
61
|
}) => {
|
|
61
62
|
const { children, column } = options;
|
|
@@ -241,39 +242,61 @@ var formatFormProps = ({
|
|
|
241
242
|
} else if ((attrItemDataOptions == null ? void 0 : attrItemDataOptions.contextOptions) && parameters) {
|
|
242
243
|
const optLabelStr = (_x = attrItemDataOptions == null ? void 0 : attrItemDataOptions.contextOptions) == null ? void 0 : _x.label;
|
|
243
244
|
const optValueStr = (_y = attrItemDataOptions == null ? void 0 : attrItemDataOptions.contextOptions) == null ? void 0 : _y.value;
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
return [];
|
|
250
|
-
};
|
|
251
|
-
if (optValueStr) {
|
|
252
|
-
const optValArr = splitParamsPath(optValueStr);
|
|
253
|
-
const optLabelArr = splitParamsPath(optLabelStr);
|
|
254
|
-
const optData = Array.isArray(parameters == null ? void 0 : parameters[optValArr == null ? void 0 : optValArr[0]]) ? parameters == null ? void 0 : parameters[optValArr == null ? void 0 : optValArr[0]] : [];
|
|
255
|
-
const labelApiPath = optLabelArr == null ? void 0 : optLabelArr.slice(2);
|
|
256
|
-
const valApiPath = optValArr == null ? void 0 : optValArr.slice(2);
|
|
257
|
-
const formatToTreeData = (optionsItems) => {
|
|
258
|
-
if (Array.isArray(optionsItems)) {
|
|
259
|
-
return optionsItems.map((optItem) => ({
|
|
260
|
-
title: (0, import_lodash.get)(optItem, labelApiPath),
|
|
261
|
-
value: (0, import_lodash.get)(optItem, valApiPath),
|
|
262
|
-
children: formatToTreeData(optItem == null ? void 0 : optItem.children)
|
|
263
|
-
}));
|
|
264
|
-
}
|
|
265
|
-
return [];
|
|
245
|
+
if (!optLabelStr || !optValueStr) {
|
|
246
|
+
formItem.props = {
|
|
247
|
+
...formItem.props,
|
|
248
|
+
options: []
|
|
266
249
|
};
|
|
267
|
-
|
|
250
|
+
} else {
|
|
251
|
+
const labelPathArr = (0, import_treeUtils.getDataArr)(optLabelStr);
|
|
252
|
+
const valuePathArr = (0, import_treeUtils.getDataArr)(optValueStr);
|
|
253
|
+
if (labelPathArr.length < 2 || valuePathArr.length < 2) {
|
|
268
254
|
formItem.props = {
|
|
269
255
|
...formItem.props,
|
|
270
|
-
|
|
256
|
+
options: []
|
|
271
257
|
};
|
|
272
258
|
} else {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
259
|
+
const labelDataSourcePath = labelPathArr.slice(0, -2);
|
|
260
|
+
const valueDataSourcePath = valuePathArr.slice(0, -2);
|
|
261
|
+
const isPathConsistent = labelDataSourcePath.length === valueDataSourcePath.length && labelDataSourcePath.every((item, index) => item === valueDataSourcePath[index]);
|
|
262
|
+
if (!isPathConsistent) {
|
|
263
|
+
formItem.props = {
|
|
264
|
+
...formItem.props,
|
|
265
|
+
options: []
|
|
266
|
+
};
|
|
267
|
+
} else {
|
|
268
|
+
const dataSourceData = (0, import_lodash.get)(parameters, labelDataSourcePath);
|
|
269
|
+
if (!Array.isArray(dataSourceData)) {
|
|
270
|
+
formItem.props = {
|
|
271
|
+
...formItem.props,
|
|
272
|
+
options: []
|
|
273
|
+
};
|
|
274
|
+
} else {
|
|
275
|
+
const labelFieldPath = labelPathArr.slice(-1);
|
|
276
|
+
const valueFieldPath = valuePathArr.slice(-1);
|
|
277
|
+
const formatToTreeData = (optionsItems) => {
|
|
278
|
+
if (Array.isArray(optionsItems)) {
|
|
279
|
+
return optionsItems.map((optItem) => ({
|
|
280
|
+
title: (0, import_lodash.get)(optItem, labelFieldPath),
|
|
281
|
+
value: (0, import_lodash.get)(optItem, valueFieldPath),
|
|
282
|
+
children: formatToTreeData((optItem == null ? void 0 : optItem.children) || [])
|
|
283
|
+
}));
|
|
284
|
+
}
|
|
285
|
+
return [];
|
|
286
|
+
};
|
|
287
|
+
if ((attrItem == null ? void 0 : attrItem.compType) === "treeSelect") {
|
|
288
|
+
formItem.props = {
|
|
289
|
+
...formItem.props,
|
|
290
|
+
treeData: formatToTreeData(dataSourceData)
|
|
291
|
+
};
|
|
292
|
+
} else {
|
|
293
|
+
formItem.props = {
|
|
294
|
+
...formItem.props,
|
|
295
|
+
options: formatOptionsRecursively(dataSourceData, labelFieldPath, valueFieldPath)
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
277
300
|
}
|
|
278
301
|
}
|
|
279
302
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/formatModule/helpers/formatFormProps.ts"],
|
|
4
|
-
"sourcesContent": ["import { get } from 'lodash';\r\nimport { stringScriptExecution } from './stringScriptExecution';\r\nimport { getDataArr, getParamsContentByParamKeys, replaceParamsValue } from '../../treeUtils';\r\nimport formatTableProps from './formatTableProps';\r\nimport formatListProps from './formatListProps';\r\nimport formRulsRegMap from './formRulsRegMap';\r\nimport urlPrefix from './urlPrefix';\r\nimport patternTransitionRegExp from './patternTransitionRegExp';\r\n\r\nexport type formatFormPropsType = {\r\n options?: {\r\n column?: number;\r\n children?: {[key:string]: any}[]\r\n }\r\n parameters: {[key:string]: any};\r\n staticCodeMap: {[key:string]: any};\r\n staticOptionsMap: {[key:string]: any};\r\n}\r\n\r\nconst formatOptionsRecursively = (data: any[], labelApiPath: string[], valApiPath: string[]): any[] => {\r\n return data.map((item) => {\r\n const option: any = {\r\n label: get(item, labelApiPath),\r\n value: get(item, valApiPath),\r\n };\r\n \r\n // 如果存在children属性,递归处理\r\n if (item.children && Array.isArray(item.children)) {\r\n option.children = formatOptionsRecursively(item.children, labelApiPath, valApiPath);\r\n }\r\n \r\n return option;\r\n });\r\n};\r\n\r\nconst formatFormProps = ({\r\n parameters,\r\n staticCodeMap,\r\n staticOptionsMap,\r\n options = {},\r\n}: formatFormPropsType):{[key:string]: any} => {\r\n const { children, column } = options;\r\n const res:{[key:string]: any} = {};\r\n const formItems: { [key: string]: any }[] = [];\r\n const initValues: { [key: string]: any } = {};\r\n if (Array.isArray(children) && children.length > 0) {\r\n children.forEach((attrItem) => {\r\n const {\r\n compProps: attrCompProps,\r\n formProps: attrFormProps,\r\n } = attrItem || {};\r\n const {\r\n required,\r\n extend,\r\n display: attrFormPropsDisplay,\r\n ...otherAttrFormProps\r\n } = attrFormProps || {};\r\n const {\r\n dataOptions,\r\n ...otherAttrCompProps\r\n } = attrCompProps || {};\r\n const formItem:{[key:string]: any} = {\r\n key: attrItem?.id,\r\n label: attrFormProps?.label,\r\n name: attrFormProps?.name,\r\n type: attrItem?.compType,\r\n props: otherAttrCompProps || {},\r\n formProps: otherAttrFormProps || {},\r\n originModule: attrItem, // 以下是组件配置属性,用于属性编辑\r\n };\r\n if (extend?.type === 'text' && extend?.text && typeof extend?.text === 'string') {\r\n formItem.formProps = {\r\n ...formItem.formProps,\r\n extend: {\r\n ...extend,\r\n text: replaceParamsValue(extend?.text, parameters),\r\n },\r\n };\r\n } else if (extend?.type === 'controlBtns' && Array.isArray(extend?.controlBtns) && extend?.controlBtns?.length > 0) {\r\n formItem.formProps = {\r\n ...formItem.formProps,\r\n extend: {\r\n ...extend,\r\n controlBtns: extend?.controlBtns,\r\n },\r\n };\r\n } else {\r\n delete formItem.formProps.extend;\r\n }\r\n if (attrItem?.compType === 'table') {\r\n const tableProps = formatTableProps({\r\n options: attrItem?.compProps,\r\n staticCodeMap,\r\n parameters,\r\n });\r\n const rowKeys = getDataArr(attrItem?.compProps?.rowKey);\r\n formItem.props = {\r\n ...formItem.props,\r\n ...tableProps,\r\n rowKey: rowKeys?.length > 0 ? rowKeys?.[rowKeys?.length - 1] : 'key',\r\n hasSelectAll: (attrItem?.compProps?.rowSelection && attrItem?.compProps?.hasSelectAll) ? attrItem?.compProps?.hasSelectAll : null,\r\n rowSelection: attrItem?.compProps?.rowSelection || { type: 'radio' },\r\n };\r\n }\r\n if (['list', 'card'].includes(attrItem?.compType)) {\r\n const resProps = formatListProps({\r\n options: attrItem?.compProps,\r\n staticCodeMap,\r\n parameters,\r\n urlPrefix,\r\n });\r\n formItem.props = {\r\n ...resProps,\r\n rowSelection: attrItem?.compProps?.rowSelection || { type: 'radio' },\r\n };\r\n }\r\n if (attrItem?.compType === 'upload') {\r\n if (\r\n attrItem?.compProps?.data &&\r\n Object.keys(attrItem?.compProps?.data)?.length > 0\r\n ) {\r\n const uploadDataParams:{[key:string]: any} = {};\r\n Object.keys(attrItem?.compProps?.data).forEach(paramsName => {\r\n if (/\\$\\{(.+?)\\}/g.test(attrItem?.compProps?.data?.[paramsName])) {\r\n // const valParamArr = getDataArr(attrItem?.compProps?.data?.[paramsName]);\r\n uploadDataParams[paramsName] = getParamsContentByParamKeys(attrItem?.compProps?.data?.[paramsName], parameters);\r\n } else {\r\n uploadDataParams[paramsName] = attrItem?.compProps?.data?.[paramsName];\r\n }\r\n });\r\n formItem.props = {\r\n ...formItem.props,\r\n data: uploadDataParams,\r\n };\r\n }\r\n if (\r\n attrItem?.compProps?.action?.url &&\r\n typeof attrItem?.compProps?.action?.url === 'string'\r\n ) {\r\n formItem.props = {\r\n ...formItem.props,\r\n action: attrItem?.compProps?.action?.url,\r\n };\r\n }\r\n }\r\n let otherRules = Array.isArray(otherAttrFormProps?.rules) ? otherAttrFormProps?.rules?.filter((item: any) => !item?.required) : [];\r\n if (attrItem?.formProps?.defaultValue) {\r\n let attrDefVal:any = '';\r\n if (attrItem?.compType === 'upload') {\r\n formItem.formProps = {\r\n ...formItem.formProps,\r\n valuePropName: 'fileList',\r\n };\r\n attrDefVal = getParamsContentByParamKeys(attrItem?.formProps?.defaultValue, parameters) || [];\r\n } else {\r\n delete formItem.formProps.valuePropName;\r\n attrDefVal = replaceParamsValue(attrItem?.formProps?.defaultValue, parameters) || '';\r\n }\r\n initValues[otherAttrFormProps?.name] = attrDefVal;\r\n }\r\n otherRules = otherRules.map((item: {[key:string]: any}) => ({\r\n pattern: item?.type === 'custom' ? patternTransitionRegExp(item?.pattern) : (\r\n formRulsRegMap?.[item?.type] || ''\r\n ),\r\n message: item?.message,\r\n }));\r\n if (typeof attrFormPropsDisplay === 'boolean' || typeof attrFormPropsDisplay === 'string') {\r\n let formItemDisplay:boolean = true;\r\n if (typeof attrFormPropsDisplay === 'boolean') {\r\n formItemDisplay = attrFormPropsDisplay;\r\n } else if (typeof attrFormPropsDisplay === 'string' && attrFormPropsDisplay) {\r\n // const scriptCodeStr = stringPramarsValTransition(attrFormPropsDisplay, parameters);\r\n const codeExtendVal = stringScriptExecution(\r\n attrFormPropsDisplay,\r\n parameters,\r\n );\r\n formItemDisplay = codeExtendVal;\r\n }\r\n formItem.display = formItemDisplay;\r\n }\r\n if (typeof required === 'boolean' || typeof required === 'string') {\r\n let formItemRequired:boolean = false;\r\n if (typeof required === 'boolean') {\r\n formItemRequired = required;\r\n } else if (typeof required === 'string' && required) {\r\n // const scriptCodeStr = stringPramarsValTransition(required, parameters);\r\n const codeExtendVal = stringScriptExecution(required, parameters);\r\n formItemRequired = typeof codeExtendVal === 'boolean' ? codeExtendVal : false;\r\n }\r\n formItem.formProps = {\r\n ...formItem.formProps,\r\n rules: formItemRequired ? [{ required: formItemRequired }, ...otherRules] : otherRules,\r\n };\r\n } else {\r\n formItem.formProps = {\r\n ...formItem.formProps,\r\n rules: otherRules,\r\n };\r\n }\r\n if (dataOptions) {\r\n const attrItemDataOptions = dataOptions || {};\r\n if (attrItemDataOptions?.staticCode) {\r\n if (\r\n attrItem?.defaultValue &&\r\n staticCodeMap?.[attrItemDataOptions?.staticCode] &&\r\n staticCodeMap?.[attrItemDataOptions?.staticCode]?.[attrItem?.defaultValue]\r\n ) {\r\n initValues[attrItem?.attrCode] = staticCodeMap?.[attrItemDataOptions?.staticCode]?.[attrItem?.defaultValue];\r\n }\r\n const formatToTreeData = (optionsItems: {[key:string]: any}[]):{[key:string]: any}[] => {\r\n if (Array.isArray(optionsItems)) {\r\n return optionsItems.map(optItem => ({\r\n title: optItem?.label,\r\n value: optItem?.value,\r\n children: formatToTreeData(optItem?.children),\r\n }));\r\n }\r\n return [];\r\n };\r\n if (attrItem?.compType === 'treeSelect') {\r\n formItem.props = {\r\n ...formItem.props,\r\n treeData: formatToTreeData(staticOptionsMap?.[attrItemDataOptions?.staticCode]),\r\n };\r\n } else {\r\n formItem.props = {\r\n ...formItem.props,\r\n options: Array.isArray(staticOptionsMap?.[attrItemDataOptions?.staticCode]) ?\r\n staticOptionsMap?.[attrItemDataOptions?.staticCode] : [],\r\n };\r\n }\r\n } else if (attrItemDataOptions?.contextOptions && parameters) {\r\n const optLabelStr = attrItemDataOptions?.contextOptions?.label;\r\n const optValueStr = attrItemDataOptions?.contextOptions?.value;\r\n const splitParamsPath = (paramsPathStr: string) => {\r\n if (typeof paramsPathStr === 'string') {\r\n const paramsPathArr = paramsPathStr.replace(/\\$\\{|\\}/g, '').split('.');\r\n return paramsPathArr?.filter((item:string, idx:number) => !(idx === 0 && item === 'root'));\r\n }\r\n return [];\r\n };\r\n if (optValueStr) {\r\n const optValArr = splitParamsPath(optValueStr);\r\n const optLabelArr = splitParamsPath(optLabelStr);\r\n const optData: any[] = Array.isArray(parameters?.[optValArr?.[0]]) ? parameters?.[optValArr?.[0]] : [];\r\n const labelApiPath: string[] = optLabelArr?.slice(2);\r\n const valApiPath: string[] = optValArr?.slice(2);\r\n\r\n \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"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAoB;AACpB,mCAAsC;AACtC,uBAA4E;AAC5E,8BAA6B;AAC7B,6BAA4B;AAC5B,4BAA2B;AAC3B,uBAAsB;AACtB,qCAAoC;
|
|
4
|
+
"sourcesContent": ["import { get } from 'lodash';\nimport { stringScriptExecution } from './stringScriptExecution';\nimport { getDataArr, getParamsContentByParamKeys, replaceParamsValue } from '../../treeUtils';\nimport formatTableProps from './formatTableProps';\nimport formatListProps from './formatListProps';\nimport formRulsRegMap from './formRulsRegMap';\nimport urlPrefix from './urlPrefix';\nimport patternTransitionRegExp from './patternTransitionRegExp';\n\nexport type formatFormPropsType = {\n options?: {\n column?: number;\n children?: {[key:string]: any}[]\n }\n parameters: {[key:string]: any};\n staticCodeMap: {[key:string]: any};\n staticOptionsMap: {[key:string]: any};\n 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"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAoB;AACpB,mCAAsC;AACtC,uBAA4E;AAC5E,8BAA6B;AAC7B,6BAA4B;AAC5B,4BAA2B;AAC3B,uBAAsB;AACtB,qCAAoC;AAapC,IAAM,2BAA2B,CAAC,MAAa,cAAwB,eAAgC;AACrG,SAAO,KAAK,IAAI,CAAC,SAAS;AACxB,UAAM,SAAc;AAAA,MAClB,WAAO,mBAAI,MAAM,YAAY;AAAA,MAC7B,WAAO,mBAAI,MAAM,UAAU;AAAA,IAC7B;AAGA,QAAI,KAAK,YAAY,MAAM,QAAQ,KAAK,QAAQ,GAAG;AACjD,aAAO,WAAW,yBAAyB,KAAK,UAAU,cAAc,UAAU;AAAA,IACpF;AAEA,WAAO;AAAA,EACT,CAAC;AACH;AAEA,IAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB,CAAC;AAAA,EACjB,UAAU,CAAC;AACb,MAA+C;AAC7C,QAAM,EAAE,UAAU,OAAO,IAAI;AAC7B,QAAM,MAA0B,CAAC;AACjC,QAAM,YAAsC,CAAC;AAC7C,QAAM,aAAqC,CAAC;AAC5C,MAAI,MAAM,QAAQ,QAAQ,KAAK,SAAS,SAAS,GAAG;AAClD,aAAS,QAAQ,CAAC,aAAa;AAhDnC;AAiDM,YAAM;AAAA,QACJ,WA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mBAAmB,CAAC,iBAA8D;AACtF,wBAAI,MAAM,QAAQ,YAAY,GAAG;AAC/B,6BAAO,aAAa,IAAI,cAAY;AAAA,wBAClC,WAAO,mBAAI,SAAS,cAAc;AAAA,wBAClC,WAAO,mBAAI,SAAS,cAAc;AAAA,wBAClC,UAAU,kBAAiB,mCAAS,aAAY,CAAC,CAAC;AAAA,sBACpD,EAAE;AAAA,oBACJ;AACA,2BAAO,CAAC;AAAA,kBACV;AAEA,uBAAI,qCAAU,cAAa,cAAc;AACvC,6BAAS,QAAQ;AAAA,sBACf,GAAG,SAAS;AAAA,sBACZ,UAAU,iBAAiB,cAAc;AAAA,oBAC3C;AAAA,kBACF,OAAO;AACL,6BAAS,QAAQ;AAAA,sBACf,GAAG,SAAS;AAAA,sBACZ,SAAS,yBAAyB,gBAAgB,gBAAgB,cAAc;AAAA,oBAClF;AAAA,kBACF;AAAA,gBACF;AAAA,cACF;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AACA,gBAAU,KAAK,QAAQ;AAAA,IACzB,CAAC;AAAA,EACH;AACA,MAAI,OAAO,WAAW,YAAY,SAAS,GAAG;AAC5C,QAAI,WAAW;AACf,QAAI,OAAO,KAAK;AAAA,EAClB,OAAO;AACL,QAAI,WAAW;AACf,WAAO,IAAI;AAAA,EACb;AACA,MAAI,YAAY;AAChB,MAAI,gBAAgB;AACpB,SAAO;AACT;AAEA,IAAO,0BAAQ;",
|
|
6
6
|
"names": ["formatTableProps", "formatListProps", "urlPrefix", "_a", "_b", "_c", "_d", "_e", "_f", "patternTransitionRegExp", "formRulsRegMap"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/formatModule/helpers/formatHighCodeProps.ts"],
|
|
4
|
-
"sourcesContent": ["import { get } from 'lodash';\
|
|
4
|
+
"sourcesContent": ["import { get } from 'lodash';\nimport stringPramarsValTransition from './stringPramarsValTransition';\nimport { getDataArr } from '../../treeUtils';\n\nexport type formatHighCodePropsPropsType = {\n options?: { [key: string]: any };\n staticCodeMap?: { [key: string]: any };\n parameters?: { [key: string]: any };\n}\n\nexport type formatHighCodePropsExportType = { [key: string]: any }\n\nconst formatHighCodeProps = ({\n options = {},\n parameters,\n}: formatHighCodePropsPropsType): formatHighCodePropsExportType => {\n const res: { [key: string]: any } = {};\n const { fileProps = {} } = options;\n const { parameters: compParams = [] } = fileProps;\n\n // 循环替换value\n const loopToGetValue = (list: any[]) => list.map(l => {\n let lt = { ...l };\n\n if (!lt.oriVal) {\n lt = { ...lt, oriVal: lt.value };\n }\n\n if (['object', 'array'].includes(lt.type)) {\n const oriValPath = getDataArr(lt.oriVal);\n lt.value = get(parameters, oriValPath);\n } else {\n lt.value = stringPramarsValTransition(lt.oriVal || '', parameters || {});\n }\n\n if (lt.children?.length) {\n lt.children = loopToGetValue(lt.children);\n }\n\n return lt;\n });\n\n // 入参配置结构转成数据结构\n const changeParamsConfigToObject: (params: any) => any = param => {\n if (!param) {\n return {};\n }\n\n // 对象\n if (param.type === 'object') {\n const obj: any = param.value instanceof Object ? param.value : {};\n param.children?.forEach((child: any) => {\n obj[child.name] = changeParamsConfigToObject(child);\n });\n return obj;\n }\n\n // 数组\n if (param.type === 'array') {\n const element = param.children?.[0];\n const arr: any[] = param.value instanceof Array ? param.value : [];\n\n if (element && arr?.length) {\n arr.forEach(arrItem => {\n if (element.type === 'object' && arrItem) {\n Object.assign(arrItem, changeParamsConfigToObject(element));\n }\n });\n }\n\n return arr;\n }\n\n // 属性\n if (param.type === 'boolean' && param.value) {\n return param.value === 'true' || param.value === '1';\n }\n\n return param.value || null;\n };\n\n const paramsObj = changeParamsConfigToObject(loopToGetValue(compParams)?.[0] || {});\n res.parameters = paramsObj;\n return res;\n};\n\n\nexport default formatHighCodeProps;\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAA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a,MAAM,iBAAiB,QAAQ,MAAM,QAAQ,CAAC;AAEjE,UAAI,YAAW,2BAAK,SAAQ;AAC1B,YAAI,QAAQ,aAAW;AACrB,cAAI,QAAQ,SAAS,YAAY,SAAS;AACxC,mBAAO,OAAO,SAAS,2BAA2B,OAAO,CAAC;AAAA,UAC5D;AAAA,QACF,CAAC;AAAA,MACH;AAEA,aAAO;AAAA,IACT;AAGA,QAAI,MAAM,SAAS,aAAa,MAAM,OAAO;AAC3C,aAAO,MAAM,UAAU,UAAU,MAAM,UAAU;AAAA,IACnD;AAEA,WAAO,MAAM,SAAS;AAAA,EACxB;AAEA,QAAM,YAAY,6BAA2B,oBAAe,UAAU,MAAzB,mBAA6B,OAAM,CAAC,CAAC;AAClF,MAAI,aAAa;AACjB,SAAO;AACT;AAGA,IAAO,8BAAQ;",
|
|
6
6
|
"names": ["_a", "stringPramarsValTransition"]
|
|
7
7
|
}
|
|
@@ -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,49 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/formatModule/helpers/formatIconProps.ts
|
|
20
|
+
var formatIconProps_exports = {};
|
|
21
|
+
__export(formatIconProps_exports, {
|
|
22
|
+
default: () => formatIconProps_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(formatIconProps_exports);
|
|
25
|
+
var import_stringScriptExecution = require("./stringScriptExecution");
|
|
26
|
+
var formatIconProps = ({
|
|
27
|
+
parameters,
|
|
28
|
+
icon
|
|
29
|
+
}) => {
|
|
30
|
+
const res = {
|
|
31
|
+
style: icon == null ? void 0 : icon.style,
|
|
32
|
+
className: icon == null ? void 0 : icon.className
|
|
33
|
+
};
|
|
34
|
+
if ((icon == null ? void 0 : icon.type) === "script") {
|
|
35
|
+
const scriptResult = (0, import_stringScriptExecution.stringScriptExecution)(icon == null ? void 0 : icon.icon, parameters);
|
|
36
|
+
if (scriptResult && typeof scriptResult === "object") {
|
|
37
|
+
res.icon = scriptResult == null ? void 0 : scriptResult.icon;
|
|
38
|
+
res.type = scriptResult == null ? void 0 : scriptResult.type;
|
|
39
|
+
res.style = scriptResult == null ? void 0 : scriptResult.style;
|
|
40
|
+
res.className = scriptResult == null ? void 0 : scriptResult.className;
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
res.type = icon == null ? void 0 : icon.type;
|
|
44
|
+
res.icon = icon == null ? void 0 : icon.icon;
|
|
45
|
+
}
|
|
46
|
+
return res;
|
|
47
|
+
};
|
|
48
|
+
var formatIconProps_default = formatIconProps;
|
|
49
|
+
//# sourceMappingURL=formatIconProps.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/formatModule/helpers/formatIconProps.ts"],
|
|
4
|
+
"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"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mCAAsC;AAYtC,IAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA;AACF,MAA+C;AAC7C,QAAM,MAA0B;AAAA,IAC9B,OAAO,6BAAM;AAAA,IACb,WAAW,6BAAM;AAAA,EACnB;AACA,OAAI,6BAAM,UAAS,UAAU;AAC3B,UAAM,mBAAe,oDAAsB,6BAAM,MAAM,UAAU;AACjE,QAAI,gBAAgB,OAAO,iBAAiB,UAAU;AACpD,UAAI,OAAO,6CAAc;AACzB,UAAI,OAAO,6CAAc;AACzB,UAAI,QAAQ,6CAAc;AAC1B,UAAI,YAAY,6CAAc;AAAA,IAChC;AAAA,EACF,OAAO;AACL,QAAI,OAAO,6BAAM;AACjB,QAAI,OAAO,6BAAM;AAAA,EACnB;AACA,SAAO;AACT;AAEA,IAAO,0BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/formatModule/helpers/formatImageProps.ts"],
|
|
4
|
-
"sourcesContent": ["import { getParamsContentByParamKeys } from '../../treeUtils';\
|
|
4
|
+
"sourcesContent": ["import { getParamsContentByParamKeys } from '../../treeUtils';\nimport { getFileUrlById } from '../../file';\n\nexport type formatImagePropsType = {\n options?: {\n dataSource?: {[key:string]: any}\n }\n parameters?: {[key:string]: any};\n}\n\nconst formatImageProps = ({\n parameters,\n options = {},\n}: formatImagePropsType):{[key:string]: any} => {\n const { dataSource } = options;\n const res:{[key:string]: any} = {};\n if (\n dataSource?.dataType === 'staticData' &&\n Array.isArray(dataSource?.fileList) &&\n dataSource?.fileList.length > 0\n ) {\n res.src = getFileUrlById(dataSource?.fileList?.[0]?.fileId);\n res.alt = dataSource?.fileList?.[0]?.fileName;\n }\n if (\n dataSource?.dataType === 'context' &&\n dataSource?.fileUrl\n ) {\n res.src = getParamsContentByParamKeys(dataSource?.fileUrl, parameters) || '';\n res.alt = getParamsContentByParamKeys(dataSource?.fileDesc, parameters) || '';\n }\n return res;\n};\n\nexport default formatImageProps;\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA4C;AAC5C,kBAA+B;AAS/B,IAAM,mBAAmB,CAAC;AAAA,EACxB;AAAA,EACA,UAAU,CAAC;AACb,MAAgD;AAbhD;AAcE,QAAM,EAAE,WAAW,IAAI;AACvB,QAAM,MAA0B,CAAC;AACjC,OACE,yCAAY,cAAa,gBACrB,MAAM,QAAQ,yCAAY,QAAQ,MAClC,yCAAY,SAAS,UAAS,GAClC;AACA,QAAI,UAAM,6BAAe,oDAAY,aAAZ,mBAAuB,OAAvB,mBAA2B,MAAM;AAC1D,QAAI,OAAM,oDAAY,aAAZ,mBAAuB,OAAvB,mBAA2B;AAAA,EACvC;AACA,OACE,yCAAY,cAAa,cACzB,yCAAY,UACZ;AACA,QAAI,UAAM,8CAA4B,yCAAY,SAAS,UAAU,KAAK;AAC1E,QAAI,UAAM,8CAA4B,yCAAY,UAAU,UAAU,KAAK;AAAA,EAC7E;AACA,SAAO;AACT;AAEA,IAAO,2BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
18
|
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
17
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
28
|
|
|
19
29
|
// src/formatModule/helpers/formatListProps.ts
|
|
@@ -26,6 +36,7 @@ var import_lodash = require("lodash");
|
|
|
26
36
|
var import_stringScriptExecution = require("./stringScriptExecution");
|
|
27
37
|
var import_treeUtils = require("../../treeUtils");
|
|
28
38
|
var import_file = require("../../file");
|
|
39
|
+
var import_formatControlBtn = __toESM(require("./formatControlBtn"));
|
|
29
40
|
var formatListProps = ({
|
|
30
41
|
urlPrefix,
|
|
31
42
|
parameters,
|
|
@@ -39,7 +50,57 @@ var formatListProps = ({
|
|
|
39
50
|
} else {
|
|
40
51
|
propsRes.icon = "";
|
|
41
52
|
}
|
|
42
|
-
|
|
53
|
+
const processAttrs = (item, idx, replaceValueFn, attrReplaceFn) => {
|
|
54
|
+
const attrList = [];
|
|
55
|
+
if (Array.isArray(opt == null ? void 0 : opt.attrs) && (opt == null ? void 0 : opt.attrs.length) > 0) {
|
|
56
|
+
opt.attrs.forEach((attrItem) => {
|
|
57
|
+
let attrsDisplay = true;
|
|
58
|
+
if (typeof (attrItem == null ? void 0 : attrItem.display) === "boolean" || typeof (attrItem == null ? void 0 : attrItem.display) === "string") {
|
|
59
|
+
if (typeof (attrItem == null ? void 0 : attrItem.display) === "boolean") {
|
|
60
|
+
attrsDisplay = attrItem == null ? void 0 : attrItem.display;
|
|
61
|
+
} else if (typeof (attrItem == null ? void 0 : attrItem.display) === "string" && (attrItem == null ? void 0 : attrItem.display)) {
|
|
62
|
+
const scriptParameters = Object.assign(parameters || {}, { row: item, index: idx });
|
|
63
|
+
const codeExtendVal = (0, import_stringScriptExecution.stringScriptExecution)(
|
|
64
|
+
attrItem == null ? void 0 : attrItem.display,
|
|
65
|
+
scriptParameters
|
|
66
|
+
);
|
|
67
|
+
attrsDisplay = codeExtendVal;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (attrsDisplay) {
|
|
71
|
+
const attrObj = {};
|
|
72
|
+
if (attrItem == null ? void 0 : attrItem.style) {
|
|
73
|
+
attrObj.style = attrItem == null ? void 0 : attrItem.style;
|
|
74
|
+
}
|
|
75
|
+
if (attrItem == null ? void 0 : attrItem.defaultValue) {
|
|
76
|
+
const attrValue = attrReplaceFn ? attrReplaceFn(attrItem, item) : replaceValueFn((attrItem == null ? void 0 : attrItem.defaultValue) || "", item);
|
|
77
|
+
attrObj.attrName = attrItem == null ? void 0 : attrItem.attrName;
|
|
78
|
+
attrObj.attrCode = attrItem == null ? void 0 : attrItem.attrCode;
|
|
79
|
+
attrObj.attrValue = attrValue;
|
|
80
|
+
}
|
|
81
|
+
attrList.push(attrObj);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return attrList;
|
|
86
|
+
};
|
|
87
|
+
const buildDataObj = (item, idx, replaceValueFn, attrReplaceFn) => {
|
|
88
|
+
const dataObj = {
|
|
89
|
+
label: replaceValueFn((opt == null ? void 0 : opt.itemLabel) || "", item),
|
|
90
|
+
content: replaceValueFn((opt == null ? void 0 : opt.itemContent) || "", item),
|
|
91
|
+
describe: replaceValueFn((opt == null ? void 0 : opt.itemDescribe) || "", item),
|
|
92
|
+
originItem: item
|
|
93
|
+
};
|
|
94
|
+
if (propsRes == null ? void 0 : propsRes.rowKey) {
|
|
95
|
+
dataObj[propsRes.rowKey] = item == null ? void 0 : item[propsRes.rowKey];
|
|
96
|
+
}
|
|
97
|
+
const attrList = processAttrs(item, idx, replaceValueFn, attrReplaceFn);
|
|
98
|
+
if (attrList.length > 0) {
|
|
99
|
+
dataObj.attrList = attrList;
|
|
100
|
+
}
|
|
101
|
+
return dataObj;
|
|
102
|
+
};
|
|
103
|
+
if (parameters && Object.keys(parameters).length > 0) {
|
|
43
104
|
const sourceArr = (0, import_treeUtils.getDataArr)(opt == null ? void 0 : opt.dataSource) || [];
|
|
44
105
|
const rowKeyArr = (0, import_treeUtils.getDataArr)(opt == null ? void 0 : opt.rowKey) || [];
|
|
45
106
|
const items = (0, import_treeUtils.getParamsContentByParamKeys)(opt == null ? void 0 : opt.dataSource, parameters) || [];
|
|
@@ -72,49 +133,7 @@ var formatListProps = ({
|
|
|
72
133
|
};
|
|
73
134
|
if (Array.isArray(items)) {
|
|
74
135
|
items.forEach((item, idx) => {
|
|
75
|
-
const
|
|
76
|
-
if (Array.isArray(opt == null ? void 0 : opt.attrs) && (opt == null ? void 0 : opt.attrs.length) > 0) {
|
|
77
|
-
opt == null ? void 0 : opt.attrs.forEach((attrItem) => {
|
|
78
|
-
let attrsDisplay = true;
|
|
79
|
-
if (typeof (attrItem == null ? void 0 : attrItem.display) === "boolean" || typeof (attrItem == null ? void 0 : attrItem.display) === "string") {
|
|
80
|
-
if (typeof (attrItem == null ? void 0 : attrItem.display) === "boolean") {
|
|
81
|
-
attrsDisplay = attrItem == null ? void 0 : attrItem.display;
|
|
82
|
-
} else if (typeof (attrItem == null ? void 0 : attrItem.display) === "string" && (attrItem == null ? void 0 : attrItem.display)) {
|
|
83
|
-
const scriptParameters = Object.assign(parameters || {}, { row: item, index: idx });
|
|
84
|
-
const codeExtendVal = (0, import_stringScriptExecution.stringScriptExecution)(
|
|
85
|
-
attrItem == null ? void 0 : attrItem.display,
|
|
86
|
-
scriptParameters
|
|
87
|
-
);
|
|
88
|
-
attrsDisplay = codeExtendVal;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
if (attrsDisplay) {
|
|
92
|
-
const attrObj = {};
|
|
93
|
-
if (attrItem == null ? void 0 : attrItem.style) {
|
|
94
|
-
attrObj.style = attrItem == null ? void 0 : attrItem.style;
|
|
95
|
-
}
|
|
96
|
-
if (attrItem == null ? void 0 : attrItem.defaultValue) {
|
|
97
|
-
const attrValue = stringAttrValueTransition(attrItem, item);
|
|
98
|
-
attrObj.attrName = attrItem == null ? void 0 : attrItem.attrName;
|
|
99
|
-
attrObj.attrCode = attrItem == null ? void 0 : attrItem.attrCode;
|
|
100
|
-
attrObj.attrValue = attrValue;
|
|
101
|
-
}
|
|
102
|
-
attrList.push(attrObj);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
const dataObj = {
|
|
107
|
-
label: replaceParamsValue(opt == null ? void 0 : opt.itemLabel, item),
|
|
108
|
-
content: replaceParamsValue(opt == null ? void 0 : opt.itemContent, item),
|
|
109
|
-
describe: replaceParamsValue(opt == null ? void 0 : opt.itemDescribe, item),
|
|
110
|
-
originItem: item
|
|
111
|
-
};
|
|
112
|
-
if (propsRes == null ? void 0 : propsRes.rowKey) {
|
|
113
|
-
dataObj[propsRes == null ? void 0 : propsRes.rowKey] = item == null ? void 0 : item[propsRes == null ? void 0 : propsRes.rowKey];
|
|
114
|
-
}
|
|
115
|
-
if (attrList.length > 0) {
|
|
116
|
-
dataObj.attrList = attrList;
|
|
117
|
-
}
|
|
136
|
+
const dataObj = buildDataObj(item, idx, replaceParamsValue, stringAttrValueTransition);
|
|
118
137
|
if (Array.isArray(propsRes.dataSource)) {
|
|
119
138
|
propsRes.dataSource.push(dataObj);
|
|
120
139
|
} else {
|
|
@@ -122,6 +141,12 @@ var formatListProps = ({
|
|
|
122
141
|
}
|
|
123
142
|
});
|
|
124
143
|
}
|
|
144
|
+
if (Array.isArray(opt == null ? void 0 : opt.controlBtns) && (opt == null ? void 0 : opt.controlBtns.length) > 0) {
|
|
145
|
+
propsRes.controlBtns = opt == null ? void 0 : opt.controlBtns.map((btn) => (0, import_formatControlBtn.default)({
|
|
146
|
+
btnProps: btn,
|
|
147
|
+
parameters
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
125
150
|
}
|
|
126
151
|
return propsRes;
|
|
127
152
|
};
|