@lingxiteam/ebe-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/es/constants.js +0 -1
- package/es/index.js +52 -36
- package/es/node/move.d.ts +1 -0
- package/es/node/move.js +7 -4
- package/es/requestQueue.d.ts +9 -0
- package/es/requestQueue.js +59 -0
- package/lib/h5public/src/components/common/PreviewFile/index.tsx +3 -7
- package/lib/h5public/src/components/factory/package.json +1 -1
- package/lib/h5public/src/components/factory/src/BlockSelect/components/CheckBox/index.tsx +14 -4
- package/lib/h5public/src/components/factory/src/BlockSelect/components/Icon/index.tsx +4 -4
- package/lib/h5public/src/components/factory/src/BlockSelect/index.tsx +13 -21
- package/lib/h5public/src/components/factory/src/Button/index.tsx +1 -0
- package/lib/h5public/src/components/factory/src/Card/index.less +11 -24
- package/lib/h5public/src/components/factory/src/Card/index.tsx +61 -22
- package/lib/h5public/src/components/factory/src/DGroup/index.less +7 -3
- package/lib/h5public/src/components/factory/src/DformFile/FormFile.tsx +17 -4
- package/lib/h5public/src/components/factory/src/DformFile/assets/closeIcon.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/default.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/fileName.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/img.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/js.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/pdf.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/ppt.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/txt.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/word.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/xls.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/zip.png +0 -0
- package/lib/h5public/src/components/factory/src/DynamicDataContainer/YieldMethod.ts +33 -0
- package/lib/h5public/src/components/factory/src/DynamicDataContainer/index.less +41 -5
- package/lib/h5public/src/components/factory/src/DynamicDataContainer/index.tsx +18 -3
- package/lib/h5public/src/components/factory/src/DynamicDataContainer/useDynamicDataContainer.ts +14 -1
- package/lib/h5public/src/components/factory/src/DynamicList/index.tsx +4 -2
- package/lib/h5public/src/components/factory/src/DynamicTable/Table.tsx +3 -1
- package/lib/h5public/src/components/factory/src/Image/BasicImage/index.tsx +36 -1
- package/lib/h5public/src/components/factory/src/StackColumn/loader.tsx +1 -1
- package/lib/h5public/src/components/factory/src/StaticTabs/index.tsx +1 -1
- package/lib/h5public/src/components/factory/src/VerificationCode/index.tsx +14 -3
- package/lib/h5public/src/components/factory/src/VideoPlayer/loader.ts +1 -1
- package/lib/h5public/src/components/factory/src/utils/CustomModule.tsx +3 -0
- package/lib/h5public/src/components/factory/src/utils/hooks/useFormItem.ts +3 -0
- package/lib/h5public/src/hooks/usePageForm.ts +2 -3
- package/lib/h5public/src/utils/native.ts +94 -0
- package/lib/node/move.d.ts +1 -0
- package/lib/node/move.js +6 -3
- package/lib/pcpublic/src/components/common/PreviewFile/index.tsx +8 -0
- package/lib/pcpublic/src/components/common/PreviewFile/utils.ts +45 -0
- package/lib/pcpublic/src/components/pcfactory/package.json +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/CollapsePanel/index.tsx +6 -4
- package/lib/pcpublic/src/components/pcfactory/src/DynamicDataContainer/YieldMethod.ts +33 -0
- package/lib/pcpublic/src/components/pcfactory/src/DynamicDataContainer/index.tsx +18 -3
- package/lib/pcpublic/src/components/pcfactory/src/DynamicDataContainer/useDynamicDataContainer.ts +14 -1
- package/lib/pcpublic/src/components/pcfactory/src/Img/index.tsx +34 -2
- package/lib/pcpublic/src/components/pcfactory/src/LoopList/index.tsx +9 -4
- package/lib/pcpublic/src/components/pcfactory/src/ModalSelect/BaseModalSelect.tsx +8 -1
- package/lib/pcpublic/src/components/pcfactory/src/StdUpload/index.tsx +39 -13
- package/lib/pcpublic/src/components/pcfactory/src/SuperSelect/ComSelect.tsx +22 -14
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/index.tsx +12 -1
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCMDActions.ts +54 -12
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useColumns.tsx +516 -485
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCommon.ts +40 -2
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useDataSource.ts +3 -34
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useExpandable.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/usePagination.ts +30 -3
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowEdit.ts +34 -12
- package/lib/pcpublic/src/components/pcfactory/src/Table/index.tsx +15 -4
- package/lib/pcpublic/src/components/pcfactory/src/Tabs/index.tsx +2 -0
- package/lib/pcpublic/src/components/pcfactory/src/Tag/index.tsx +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/index.tsx +13 -2
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Card.less +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/FormGroup.less +8 -4
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Icon.less +4 -0
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/StdUpload.less +3 -3
- package/lib/pcpublic/src/components/pcfactory/src/utils/CustomModule.tsx +3 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/common.ts +15 -0
- package/lib/pcpublic/src/hooks/usePageForm.ts +2 -3
- package/lib/pcpublic/src/utils/exportCustomData/index.tsx +0 -3
- package/lib/public/src/hooks/useExportCustomDataFile.ts +4 -0
- package/lib/public/src/services/api/index.ts +12 -0
- package/lib/public/src/utils/Context/context.tsx +1 -0
- package/lib/public/src/utils/historytool.ts +3 -0
- package/lib/public/src/utils/lcdpBaseApi.ts +2 -2
- package/lib/public/src/utils/platform/utils/fileUtils.ts +12 -11
- package/lib/public/src/utils/polyfills.ts +4 -0
- package/lib/public/src/utils/popoverUtils.ts +56 -0
- package/lib/public/src/utils/service/baseRequest.ts +8 -8
- package/lib/public/src/utils/service/urlHelper.ts +2 -0
- package/package.json +2 -2
|
@@ -547,6 +547,19 @@ const useColumns = (props: any) => {
|
|
|
547
547
|
getPopupContainer={(triggerNode: HTMLElement) =>
|
|
548
548
|
triggerNode?.parentNode as HTMLElement
|
|
549
549
|
}
|
|
550
|
+
onVisibleChange={(vis: boolean) => {
|
|
551
|
+
if (fixedAction && tableRef?.current) {
|
|
552
|
+
const fixedActionEle =
|
|
553
|
+
tableRef.current?.querySelectorAll(
|
|
554
|
+
'.ued-table-actions',
|
|
555
|
+
)?.[index]?.parentNode;
|
|
556
|
+
// 操作列固定时 此时fixedActionEle默认antd样式为 position: sticky;z-index: 2
|
|
557
|
+
// 由于气泡卡片挂在fixedActionEle里面导致被后面的列遮盖
|
|
558
|
+
if (fixedActionEle) {
|
|
559
|
+
fixedActionEle.style.zIndex = vis ? 3 : 2;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}}
|
|
550
563
|
>
|
|
551
564
|
<Button
|
|
552
565
|
type="link"
|
|
@@ -699,6 +712,113 @@ const useColumns = (props: any) => {
|
|
|
699
712
|
return isPopover ? <div>{btn}</div> : btn;
|
|
700
713
|
};
|
|
701
714
|
|
|
715
|
+
// 处理cell props
|
|
716
|
+
const createCellProps = (record: any, col: any, rowIndex: number) => {
|
|
717
|
+
const __rowSpan = rowSpanMap?.get(record) || {};
|
|
718
|
+
const __rowClass = rowClassMap?.get(record) || {};
|
|
719
|
+
const rowSpan =
|
|
720
|
+
__rowSpan && __rowSpan[col.dataIndex] === undefined
|
|
721
|
+
? 1
|
|
722
|
+
: __rowSpan[col.dataIndex];
|
|
723
|
+
const rowClass = __rowClass && __rowClass[col.dataIndex];
|
|
724
|
+
|
|
725
|
+
// 表格单元格内-行数控制控制
|
|
726
|
+
let controllLineStyle = null;
|
|
727
|
+
const isLineNumSet =
|
|
728
|
+
col.lineNum && typeof col.lineNum === 'number' && col.lineNum > 0;
|
|
729
|
+
if (isLineNumSet) {
|
|
730
|
+
const lineHeight = size === 'small' ? 16 : 20;
|
|
731
|
+
controllLineStyle = {
|
|
732
|
+
lineHeight: `${lineHeight}px`,
|
|
733
|
+
maxHeight: `${lineHeight * col.lineNum}px`,
|
|
734
|
+
WebkitLineClamp: col.lineNum,
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
const cellProps: any = {
|
|
738
|
+
engineApis,
|
|
739
|
+
funcExpExecute,
|
|
740
|
+
appId,
|
|
741
|
+
pageId,
|
|
742
|
+
row: record,
|
|
743
|
+
rowId: record[currentRowKey],
|
|
744
|
+
rowIndex,
|
|
745
|
+
editable:
|
|
746
|
+
!!col.editoption &&
|
|
747
|
+
currentRowKey &&
|
|
748
|
+
nowInlineEditKey &&
|
|
749
|
+
record[currentRowKey] === nowInlineEditKey,
|
|
750
|
+
isExtend: col.isExtend,
|
|
751
|
+
dataIndex: col.dataIndex,
|
|
752
|
+
colorFormatInfo: [
|
|
753
|
+
...(colorFormatInfo || []),
|
|
754
|
+
...(col.colorFormatInfo || []),
|
|
755
|
+
],
|
|
756
|
+
isCustomRendering: !!col.customRendering,
|
|
757
|
+
rowSpan,
|
|
758
|
+
className: rowClass,
|
|
759
|
+
onTableCellClick,
|
|
760
|
+
controllLineStyle,
|
|
761
|
+
};
|
|
762
|
+
|
|
763
|
+
if (col.filter) {
|
|
764
|
+
// 开启过滤时,在td元素上记录对应的字段编码
|
|
765
|
+
cellProps['td-dataIndex'] = col.dataIndex;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
const { translateContent } = parseTranslateContent(col, {
|
|
769
|
+
text: record[col.dataIndex],
|
|
770
|
+
row: record,
|
|
771
|
+
index: rowIndex,
|
|
772
|
+
});
|
|
773
|
+
|
|
774
|
+
// 单元格提示 -> 默认提示
|
|
775
|
+
if (
|
|
776
|
+
col?.editContent?.edittype === 'title' &&
|
|
777
|
+
col?.editContent?.title &&
|
|
778
|
+
col.key !== ACTION_COL_KEY // 操作列不需要默认提示
|
|
779
|
+
) {
|
|
780
|
+
if (col?.editContent?.title?.code && col?.editContent?.title?.jsx) {
|
|
781
|
+
cellProps.title = undefined;
|
|
782
|
+
} else if (
|
|
783
|
+
col?.editContent?.title?.code &&
|
|
784
|
+
funcExpExecute &&
|
|
785
|
+
!col?.editContent?.title?.jsx
|
|
786
|
+
) {
|
|
787
|
+
// 如果是这个函数表示默认名称(因为垃圾DSL中,如果是这个code表示提示标题)
|
|
788
|
+
if (
|
|
789
|
+
col.editContent.title.code ===
|
|
790
|
+
'function main(text, row, index) { return text;}'
|
|
791
|
+
) {
|
|
792
|
+
cellProps.title = translateContent;
|
|
793
|
+
} else {
|
|
794
|
+
// 以下这个方法执行'function main(text, row, index) { return text;}'会报错, 先不兼容处理,先使用新版的jsx进行
|
|
795
|
+
cellProps.title = funcExpExecute(col.editContent.title.code, [
|
|
796
|
+
{
|
|
797
|
+
key: 'rowId',
|
|
798
|
+
value: translateContent,
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
key: 'row',
|
|
802
|
+
value: record,
|
|
803
|
+
},
|
|
804
|
+
{
|
|
805
|
+
key: 'index',
|
|
806
|
+
value: rowIndex,
|
|
807
|
+
},
|
|
808
|
+
]);
|
|
809
|
+
}
|
|
810
|
+
} else {
|
|
811
|
+
cellProps.title = col?.editContent?.title;
|
|
812
|
+
}
|
|
813
|
+
// 当editContent是false表示不提示,否则默认提示标题
|
|
814
|
+
} else if (col.editContent !== false) {
|
|
815
|
+
// 默认进行标题的提示
|
|
816
|
+
cellProps.title = translateContent;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
return cellProps;
|
|
820
|
+
};
|
|
821
|
+
|
|
702
822
|
// 递归解析列信息
|
|
703
823
|
const recursiveColumns = (columns: any) => {
|
|
704
824
|
const resolveColumns = columns
|
|
@@ -710,53 +830,61 @@ const useColumns = (props: any) => {
|
|
|
710
830
|
// 解析动态列配置,根据动态列数据源,得到真正的列配置数组数据
|
|
711
831
|
if (col.type === 'dynamicCol') {
|
|
712
832
|
if (col?.dataSource?.length) {
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
// 是否开启筛选
|
|
732
|
-
if (realCol.filter) {
|
|
733
|
-
realCol.onCell = (_: any, rowIndex: number) => ({
|
|
734
|
-
'td-dataIndex': dataIndex,
|
|
735
|
-
rowIndex,
|
|
736
|
-
});
|
|
737
|
-
|
|
738
|
-
realCol.filteredValue = filters[dataIndex];
|
|
739
|
-
realCol.filterDropdown = (filtersParams: FilterDropdownProps) =>
|
|
740
|
-
renderFilterDropDown(
|
|
741
|
-
filtersParams,
|
|
742
|
-
dataIndex,
|
|
743
|
-
resolveColumns,
|
|
744
|
-
);
|
|
745
|
-
realCol.filterDropdownVisible = !!filterDropdownOpen[dataIndex];
|
|
746
|
-
realCol.onFilterDropdownVisibleChange = (open: boolean) => {
|
|
747
|
-
onFilterDropdownVisibleChange(dataIndex, open);
|
|
833
|
+
const dynamicColumns = col.dataSource.map(
|
|
834
|
+
(c: any, index: number) => {
|
|
835
|
+
const dataIndex = c[col.dataIndex];
|
|
836
|
+
const realCol = {
|
|
837
|
+
...col, // 动态列所有配置行为(排序、固定等)相同
|
|
838
|
+
dataIndex,
|
|
839
|
+
title: () => (
|
|
840
|
+
<HeaderCellTitle
|
|
841
|
+
size={size}
|
|
842
|
+
column={{ ...col, title: c[col.title] }}
|
|
843
|
+
mode="engine"
|
|
844
|
+
funcExpExecute={funcExpExecute}
|
|
845
|
+
engineApis={engineApis}
|
|
846
|
+
/>
|
|
847
|
+
),
|
|
848
|
+
onHeaderCell: () => ({
|
|
849
|
+
style: col?.style,
|
|
850
|
+
}),
|
|
748
851
|
};
|
|
749
|
-
|
|
852
|
+
realCol.onCell = (record: any, rowIndex: number) => {
|
|
853
|
+
// 动态列处理cell逻辑保持跟普通列一致
|
|
854
|
+
const cellProps = createCellProps(record, realCol, rowIndex);
|
|
855
|
+
return cellProps;
|
|
856
|
+
};
|
|
857
|
+
// 动态列重置render方法和排序等属性,取最新的dataIndex处理渲染逻辑,并保持其他功能跟普通列一致
|
|
858
|
+
generateTableCol(realCol);
|
|
859
|
+
// 是否开启筛选
|
|
860
|
+
if (realCol.filter) {
|
|
861
|
+
realCol.filteredValue = filters[dataIndex];
|
|
862
|
+
realCol.filterDropdown = (
|
|
863
|
+
filtersParams: FilterDropdownProps,
|
|
864
|
+
) =>
|
|
865
|
+
renderFilterDropDown(
|
|
866
|
+
filtersParams,
|
|
867
|
+
dataIndex,
|
|
868
|
+
dynamicColumns,
|
|
869
|
+
);
|
|
870
|
+
realCol.filterDropdownVisible =
|
|
871
|
+
!!filterDropdownOpen[dataIndex];
|
|
872
|
+
realCol.onFilterDropdownVisibleChange = (open: boolean) => {
|
|
873
|
+
onFilterDropdownVisibleChange(dataIndex, open);
|
|
874
|
+
};
|
|
875
|
+
}
|
|
750
876
|
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
877
|
+
// 动态列标记一下,合计行需要根据key处理
|
|
878
|
+
realCol.dynamicOriginKey = realCol.key;
|
|
879
|
+
// key增强,拼接index,防止重复
|
|
880
|
+
realCol.key = `${realCol.key}_${index}`;
|
|
881
|
+
// 移除动态列标识字段,和动态列数据源字段
|
|
882
|
+
// delete realCol.type;
|
|
883
|
+
delete realCol.dataSource;
|
|
884
|
+
return realCol;
|
|
885
|
+
},
|
|
886
|
+
);
|
|
887
|
+
return dynamicColumns;
|
|
760
888
|
}
|
|
761
889
|
return [];
|
|
762
890
|
}
|
|
@@ -768,98 +896,7 @@ const useColumns = (props: any) => {
|
|
|
768
896
|
return {
|
|
769
897
|
...col,
|
|
770
898
|
onCell: (record: any, rowIndex: number) => {
|
|
771
|
-
const
|
|
772
|
-
const __rowClass = rowClassMap?.get(record) || {};
|
|
773
|
-
const rowSpan =
|
|
774
|
-
__rowSpan && __rowSpan[col.dataIndex] === undefined
|
|
775
|
-
? 1
|
|
776
|
-
: __rowSpan[col.dataIndex];
|
|
777
|
-
const rowClass = __rowClass && __rowClass[col.dataIndex];
|
|
778
|
-
|
|
779
|
-
const cellProps: any = {
|
|
780
|
-
engineApis,
|
|
781
|
-
funcExpExecute,
|
|
782
|
-
appId,
|
|
783
|
-
pageId,
|
|
784
|
-
row: record,
|
|
785
|
-
rowId: record[currentRowKey],
|
|
786
|
-
rowIndex,
|
|
787
|
-
editable:
|
|
788
|
-
!!col.editoption &&
|
|
789
|
-
currentRowKey &&
|
|
790
|
-
nowInlineEditKey &&
|
|
791
|
-
record[currentRowKey] === nowInlineEditKey,
|
|
792
|
-
isExtend: col.isExtend,
|
|
793
|
-
dataIndex: col.dataIndex,
|
|
794
|
-
colorFormatInfo: [
|
|
795
|
-
...(colorFormatInfo || []),
|
|
796
|
-
...(col.colorFormatInfo || []),
|
|
797
|
-
],
|
|
798
|
-
isCustomRendering: !!col.customRendering,
|
|
799
|
-
rowSpan,
|
|
800
|
-
className: rowClass,
|
|
801
|
-
onTableCellClick,
|
|
802
|
-
};
|
|
803
|
-
|
|
804
|
-
if (col.filter) {
|
|
805
|
-
// 开启过滤时,在td元素上记录对应的字段编码
|
|
806
|
-
cellProps['td-dataIndex'] = col.dataIndex;
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
const { translateContent } = parseTranslateContent(col, {
|
|
810
|
-
text: record[col.dataIndex],
|
|
811
|
-
row: record,
|
|
812
|
-
index,
|
|
813
|
-
});
|
|
814
|
-
|
|
815
|
-
// 单元格提示 -> 默认提示
|
|
816
|
-
if (
|
|
817
|
-
col?.editContent?.edittype === 'title' &&
|
|
818
|
-
col?.editContent?.title &&
|
|
819
|
-
col.key !== ACTION_COL_KEY // 操作列不需要默认提示
|
|
820
|
-
) {
|
|
821
|
-
if (
|
|
822
|
-
col?.editContent?.title?.code &&
|
|
823
|
-
col?.editContent?.title?.jsx
|
|
824
|
-
) {
|
|
825
|
-
cellProps.title = undefined;
|
|
826
|
-
} else if (
|
|
827
|
-
col?.editContent?.title?.code &&
|
|
828
|
-
funcExpExecute &&
|
|
829
|
-
!col?.editContent?.title?.jsx
|
|
830
|
-
) {
|
|
831
|
-
// 如果是这个函数表示默认名称(因为垃圾DSL中,如果是这个code表示提示标题)
|
|
832
|
-
if (
|
|
833
|
-
col.editContent.title.code ===
|
|
834
|
-
'function main(text, row, index) { return text;}'
|
|
835
|
-
) {
|
|
836
|
-
cellProps.title = translateContent;
|
|
837
|
-
} else {
|
|
838
|
-
// 以下这个方法执行'function main(text, row, index) { return text;}'会报错, 先不兼容处理,先使用新版的jsx进行
|
|
839
|
-
cellProps.title = funcExpExecute(col.editContent.title.code, [
|
|
840
|
-
{
|
|
841
|
-
key: 'rowId',
|
|
842
|
-
value: translateContent,
|
|
843
|
-
},
|
|
844
|
-
{
|
|
845
|
-
key: 'row',
|
|
846
|
-
value: record,
|
|
847
|
-
},
|
|
848
|
-
{
|
|
849
|
-
key: 'index',
|
|
850
|
-
value: rowIndex,
|
|
851
|
-
},
|
|
852
|
-
]);
|
|
853
|
-
}
|
|
854
|
-
} else {
|
|
855
|
-
cellProps.title = col?.editContent?.title;
|
|
856
|
-
}
|
|
857
|
-
// 当editContent是false表示不提示,否则默认提示标题
|
|
858
|
-
} else if (col.editContent !== false) {
|
|
859
|
-
// 默认进行标题的提示
|
|
860
|
-
cellProps.title = translateContent;
|
|
861
|
-
}
|
|
862
|
-
|
|
899
|
+
const cellProps = createCellProps(record, col, rowIndex);
|
|
863
900
|
return cellProps;
|
|
864
901
|
},
|
|
865
902
|
onHeaderCell: (record: any) => ({
|
|
@@ -1008,7 +1045,6 @@ const useColumns = (props: any) => {
|
|
|
1008
1045
|
const rowEditoption = JSON.parse(JSON.stringify(editoption || '{}'));
|
|
1009
1046
|
// 此时为下拉框绑定表达式场景,需要通过沙箱编译
|
|
1010
1047
|
const baseValName = rowEditoption?.selectoption?.valName;
|
|
1011
|
-
const childKeys = rowEditoption?.selectoption?.attr?.childKeys; // 绑定静态数据时,可能选择了某几个项
|
|
1012
1048
|
|
|
1013
1049
|
if (typeof baseValName === 'string') {
|
|
1014
1050
|
editoption.selectoption.renderValName = (row: any, index: number) =>
|
|
@@ -1036,12 +1072,6 @@ const useColumns = (props: any) => {
|
|
|
1036
1072
|
...rowEditoption.selectoption,
|
|
1037
1073
|
valName: Array.isArray(_valName) ? _valName : [],
|
|
1038
1074
|
};
|
|
1039
|
-
} else if (Array.isArray(childKeys) && childKeys.length) {
|
|
1040
|
-
// 如果选项设置中设置了静态编码,并且指勾选了其中几项属性,则需要过滤
|
|
1041
|
-
rowEditoption.selectoption.options =
|
|
1042
|
-
rowEditoption.selectoption.options.filter((d: any) =>
|
|
1043
|
-
childKeys.includes(d.value),
|
|
1044
|
-
);
|
|
1045
1075
|
} else if (
|
|
1046
1076
|
rowEditoption?.selectoption?.staticService &&
|
|
1047
1077
|
colServiceDataForEdit
|
|
@@ -1135,389 +1165,390 @@ const useColumns = (props: any) => {
|
|
|
1135
1165
|
};
|
|
1136
1166
|
};
|
|
1137
1167
|
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1168
|
+
// 处理普通列和动态列属性、渲染逻辑
|
|
1169
|
+
const generateTableCol = (colInfo: any) => {
|
|
1170
|
+
const c = colInfo;
|
|
1171
|
+
const { editoption, dataIndex, editContent } = c;
|
|
1141
1172
|
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
// 按照条件,初始化生成实际的列定义
|
|
1151
|
-
newColumns[i].render = (text: any, row: any, index: any) => {
|
|
1152
|
-
const rowId = row[currentRowKey];
|
|
1153
|
-
const { translateContent, rowEditoption } = parseTranslateContent(c, {
|
|
1154
|
-
text,
|
|
1155
|
-
row,
|
|
1156
|
-
index,
|
|
1157
|
-
});
|
|
1158
|
-
|
|
1159
|
-
// 编辑内容
|
|
1160
|
-
if (editoption && editoption.edittype) {
|
|
1161
|
-
// 行编辑规则
|
|
1162
|
-
const isRowEditableCanUse =
|
|
1163
|
-
!!handleIsRowEditableCanUse &&
|
|
1164
|
-
handleIsRowEditableCanUse(row, index);
|
|
1165
|
-
|
|
1166
|
-
// 列可编辑规则
|
|
1167
|
-
let isColEditable = true;
|
|
1168
|
-
if (typeof editoption.editable === 'string') {
|
|
1169
|
-
const editoptionEditableRule = editoption.editable;
|
|
1170
|
-
editoption.editable = (
|
|
1171
|
-
row: any,
|
|
1172
|
-
rowId: string | number,
|
|
1173
|
-
index: number,
|
|
1174
|
-
) =>
|
|
1175
|
-
sandBoxSafeRun(editoptionEditableRule, {
|
|
1176
|
-
row,
|
|
1177
|
-
rowId,
|
|
1178
|
-
index,
|
|
1179
|
-
});
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
if (typeof editoption.editable === 'function') {
|
|
1183
|
-
isColEditable = editoption.editable(row, rowId, index);
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
|
-
// 弹窗选择控件,组件状态入参处理
|
|
1187
|
-
const responseObj = editoption?.modalInfo?.responseObj;
|
|
1188
|
-
if (
|
|
1189
|
-
Array.isArray(responseObj) &&
|
|
1190
|
-
editoption?.edittype === 'ModalSelect' &&
|
|
1191
|
-
responseObj?.length
|
|
1192
|
-
) {
|
|
1193
|
-
editoption.modalInfo.responseObj = (
|
|
1194
|
-
row: any,
|
|
1195
|
-
rowId: string | number,
|
|
1196
|
-
index: number,
|
|
1197
|
-
) =>
|
|
1198
|
-
responseObj?.map((d: any) => {
|
|
1199
|
-
if (typeof d?.value === 'string') {
|
|
1200
|
-
const rule = d.value;
|
|
1201
|
-
d.value = sandBoxSafeRun(rule, {
|
|
1202
|
-
row,
|
|
1203
|
-
rowId,
|
|
1204
|
-
index,
|
|
1205
|
-
});
|
|
1206
|
-
}
|
|
1207
|
-
return d;
|
|
1208
|
-
});
|
|
1209
|
-
}
|
|
1173
|
+
c.render = (text: any, row: any, index: any) => {
|
|
1174
|
+
const rowId = row[currentRowKey];
|
|
1175
|
+
const { translateContent, rowEditoption } = parseTranslateContent(c, {
|
|
1176
|
+
text,
|
|
1177
|
+
row,
|
|
1178
|
+
index,
|
|
1179
|
+
});
|
|
1210
1180
|
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1181
|
+
// 编辑内容
|
|
1182
|
+
if (editoption && editoption.edittype) {
|
|
1183
|
+
// 行编辑规则
|
|
1184
|
+
const isRowEditableCanUse =
|
|
1185
|
+
!!handleIsRowEditableCanUse && handleIsRowEditableCanUse(row, index);
|
|
1186
|
+
|
|
1187
|
+
// 列可编辑规则
|
|
1188
|
+
let isColEditable = true;
|
|
1189
|
+
if (typeof editoption.editable === 'string') {
|
|
1190
|
+
const editoptionEditableRule = editoption.editable;
|
|
1191
|
+
editoption.editable = (
|
|
1192
|
+
row: any,
|
|
1193
|
+
rowId: string | number,
|
|
1194
|
+
index: number,
|
|
1195
|
+
) =>
|
|
1196
|
+
sandBoxSafeRun(editoptionEditableRule, {
|
|
1214
1197
|
row,
|
|
1215
1198
|
rowId,
|
|
1216
1199
|
index,
|
|
1217
|
-
);
|
|
1218
|
-
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1219
1202
|
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
currentRowKey &&
|
|
1224
|
-
nowInlineEditKey &&
|
|
1225
|
-
row[currentRowKey] === nowInlineEditKey; // 单行编辑模式
|
|
1203
|
+
if (typeof editoption.editable === 'function') {
|
|
1204
|
+
isColEditable = editoption.editable(row, rowId, index);
|
|
1205
|
+
}
|
|
1226
1206
|
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1207
|
+
// 弹窗选择控件,组件状态入参处理
|
|
1208
|
+
const responseObj = editoption?.modalInfo?.responseObj;
|
|
1209
|
+
if (
|
|
1210
|
+
Array.isArray(responseObj) &&
|
|
1211
|
+
editoption?.edittype === 'ModalSelect' &&
|
|
1212
|
+
responseObj?.length
|
|
1213
|
+
) {
|
|
1214
|
+
editoption.modalInfo.responseObj = (
|
|
1215
|
+
row: any,
|
|
1216
|
+
rowId: string | number,
|
|
1217
|
+
index: number,
|
|
1218
|
+
) =>
|
|
1219
|
+
responseObj?.map((d: any) => {
|
|
1220
|
+
if (typeof d?.value === 'string') {
|
|
1221
|
+
const rule = d.value;
|
|
1222
|
+
d.value = sandBoxSafeRun(rule, {
|
|
1223
|
+
row,
|
|
1224
|
+
rowId,
|
|
1225
|
+
index,
|
|
1226
|
+
});
|
|
1227
|
+
// 如果为空说明sandBoxSafeRun 执行异常应该直接给rule,不然直接输入字符串不行
|
|
1228
|
+
if (d.value === undefined && rule) {
|
|
1229
|
+
d.value = rule;
|
|
1230
|
+
}
|
|
1231
1231
|
}
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
return (
|
|
1235
|
-
<EditComponent
|
|
1236
|
-
c={c}
|
|
1237
|
-
disabled={editDisabled}
|
|
1238
|
-
editoption={rowEditoption}
|
|
1239
|
-
form={form}
|
|
1240
|
-
appId={appId}
|
|
1241
|
-
compId={compId}
|
|
1242
|
-
currentRowKey={currentRowKey}
|
|
1243
|
-
rowId={rowId}
|
|
1244
|
-
rowData={isWholeTableEdit ? row : nowEditingData}
|
|
1245
|
-
inlineVChange={inlineVChange}
|
|
1246
|
-
modalSelectParams={modalSelectParams}
|
|
1247
|
-
sandBoxSafeRun={sandBoxSafeRun}
|
|
1248
|
-
engineApis={engineApis}
|
|
1249
|
-
/>
|
|
1250
|
-
);
|
|
1251
|
-
}
|
|
1232
|
+
return d;
|
|
1233
|
+
});
|
|
1252
1234
|
}
|
|
1253
1235
|
|
|
1254
|
-
let
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
// const lineHeight = size === 'small' ? 16 : 20;
|
|
1262
|
-
controllLineStyle = {
|
|
1263
|
-
// lineHeight: `${lineHeight}px`,
|
|
1264
|
-
// maxHeight: `${lineHeight * c.lineNum}px`,
|
|
1265
|
-
WebkitLineClamp: c.lineNum,
|
|
1266
|
-
};
|
|
1236
|
+
let modalSelectParams = [];
|
|
1237
|
+
if (typeof editoption?.modalInfo?.responseObj === 'function') {
|
|
1238
|
+
modalSelectParams = editoption?.modalInfo?.responseObj(
|
|
1239
|
+
row,
|
|
1240
|
+
rowId,
|
|
1241
|
+
index,
|
|
1242
|
+
);
|
|
1267
1243
|
}
|
|
1268
1244
|
|
|
1269
|
-
|
|
1245
|
+
const editDisabled = !isColEditable || !isRowEditableCanUse;
|
|
1246
|
+
const isWholeTableEdit = editMode === 'multiple'; // 整表:多行编辑模式
|
|
1247
|
+
const isSingleRowEdit =
|
|
1248
|
+
currentRowKey &&
|
|
1249
|
+
nowInlineEditKey &&
|
|
1250
|
+
row[currentRowKey] === nowInlineEditKey; // 单行编辑模式
|
|
1251
|
+
|
|
1252
|
+
if (isWholeTableEdit || isSingleRowEdit) {
|
|
1253
|
+
const inlineVChange = (value: any, otherProps = {}) => {
|
|
1254
|
+
if (typeof onRowAttrValsChange === 'function') {
|
|
1255
|
+
onRowAttrValsChange(row, dataIndex, value, otherProps);
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1270
1258
|
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
title={
|
|
1289
|
-
<CustomModule
|
|
1290
|
-
code={c?.editContent?.title?.code}
|
|
1291
|
-
sandBoxLoadModule={engineApis.sandBoxLoadModule}
|
|
1292
|
-
errorInfo={{
|
|
1293
|
-
id: props.$$componentItem.id,
|
|
1294
|
-
}}
|
|
1295
|
-
compProps={{
|
|
1296
|
-
text: translateContent,
|
|
1297
|
-
item: row,
|
|
1298
|
-
index,
|
|
1299
|
-
}}
|
|
1300
|
-
/>
|
|
1301
|
-
}
|
|
1302
|
-
>
|
|
1303
|
-
<span>{translateContent}</span>
|
|
1304
|
-
</Tooltip>
|
|
1305
|
-
</span>
|
|
1306
|
-
);
|
|
1307
|
-
} else {
|
|
1308
|
-
content = (
|
|
1309
|
-
<span
|
|
1310
|
-
className="ued-control-line-number"
|
|
1311
|
-
style={controllLineStyle}
|
|
1312
|
-
>
|
|
1313
|
-
{translateContent}
|
|
1314
|
-
</span>
|
|
1315
|
-
);
|
|
1316
|
-
}
|
|
1259
|
+
return (
|
|
1260
|
+
<EditComponent
|
|
1261
|
+
c={c}
|
|
1262
|
+
disabled={editDisabled}
|
|
1263
|
+
editoption={rowEditoption}
|
|
1264
|
+
form={form}
|
|
1265
|
+
appId={appId}
|
|
1266
|
+
compId={compId}
|
|
1267
|
+
currentRowKey={currentRowKey}
|
|
1268
|
+
rowId={rowId}
|
|
1269
|
+
rowData={isWholeTableEdit ? row : nowEditingData}
|
|
1270
|
+
inlineVChange={inlineVChange}
|
|
1271
|
+
modalSelectParams={modalSelectParams}
|
|
1272
|
+
sandBoxSafeRun={sandBoxSafeRun}
|
|
1273
|
+
engineApis={engineApis}
|
|
1274
|
+
/>
|
|
1275
|
+
);
|
|
1317
1276
|
}
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
let content = translateContent;
|
|
1280
|
+
|
|
1281
|
+
// 表格单元格内-行数控制控制
|
|
1282
|
+
let controllLineStyle = {};
|
|
1283
|
+
const isLineNumSet =
|
|
1284
|
+
c.lineNum && typeof c.lineNum === 'number' && c.lineNum > 0;
|
|
1285
|
+
if (isLineNumSet) {
|
|
1286
|
+
// const lineHeight = size === 'small' ? 16 : 20;
|
|
1287
|
+
controllLineStyle = {
|
|
1288
|
+
// lineHeight: `${lineHeight}px`,
|
|
1289
|
+
// maxHeight: `${lineHeight * c.lineNum}px`,
|
|
1290
|
+
WebkitLineClamp: c.lineNum,
|
|
1291
|
+
};
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
let shouldRenderEdittypeTitle = false;
|
|
1318
1295
|
|
|
1319
|
-
|
|
1320
|
-
|
|
1296
|
+
if (
|
|
1297
|
+
c?.editContent?.edittype === 'title' &&
|
|
1298
|
+
c?.editContent?.title &&
|
|
1299
|
+
c.key !== ACTION_COL_KEY // 操作列不需要默认提示
|
|
1300
|
+
) {
|
|
1301
|
+
if (c?.editContent?.title?.code && c?.editContent?.title?.jsx) {
|
|
1302
|
+
shouldRenderEdittypeTitle = true;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
if (isLineNumSet && !c.customRendering) {
|
|
1306
|
+
if (shouldRenderEdittypeTitle) {
|
|
1321
1307
|
content = (
|
|
1322
|
-
<
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1308
|
+
<span className="ued-control-line-number" style={controllLineStyle}>
|
|
1309
|
+
<Tooltip
|
|
1310
|
+
title={
|
|
1311
|
+
<CustomModule
|
|
1312
|
+
code={c?.editContent?.title?.code}
|
|
1313
|
+
sandBoxLoadModule={engineApis.sandBoxLoadModule}
|
|
1314
|
+
errorInfo={{
|
|
1315
|
+
id: props.$$componentItem.id,
|
|
1316
|
+
}}
|
|
1317
|
+
compProps={{
|
|
1318
|
+
text: translateContent,
|
|
1319
|
+
item: row,
|
|
1320
|
+
index,
|
|
1321
|
+
}}
|
|
1322
|
+
/>
|
|
1323
|
+
}
|
|
1324
|
+
>
|
|
1325
|
+
<span>{translateContent}</span>
|
|
1326
|
+
</Tooltip>
|
|
1327
|
+
</span>
|
|
1334
1328
|
);
|
|
1335
|
-
} else
|
|
1329
|
+
} else {
|
|
1336
1330
|
content = (
|
|
1337
|
-
<span
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
__html: funcExpExecute(c.customRendering, [
|
|
1341
|
-
{
|
|
1342
|
-
key: 'text',
|
|
1343
|
-
value: translateContent,
|
|
1344
|
-
},
|
|
1345
|
-
{
|
|
1346
|
-
key: 'row',
|
|
1347
|
-
value: row,
|
|
1348
|
-
},
|
|
1349
|
-
{
|
|
1350
|
-
key: 'index',
|
|
1351
|
-
value: index,
|
|
1352
|
-
},
|
|
1353
|
-
]),
|
|
1354
|
-
}}
|
|
1355
|
-
className={classnames({
|
|
1356
|
-
'ued-control-line-number': isLineNumSet,
|
|
1357
|
-
})}
|
|
1358
|
-
style={controllLineStyle}
|
|
1359
|
-
/>
|
|
1331
|
+
<span className="ued-control-line-number" style={controllLineStyle}>
|
|
1332
|
+
{translateContent}
|
|
1333
|
+
</span>
|
|
1360
1334
|
);
|
|
1361
1335
|
}
|
|
1336
|
+
}
|
|
1362
1337
|
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1338
|
+
// 自定义渲染函数
|
|
1339
|
+
if (c.jsx) {
|
|
1340
|
+
content = (
|
|
1341
|
+
<CustomModule
|
|
1342
|
+
code={c.customRendering}
|
|
1343
|
+
sandBoxLoadModule={engineApis.sandBoxLoadModule}
|
|
1344
|
+
errorInfo={{
|
|
1345
|
+
id: props.$$componentItem.id,
|
|
1346
|
+
}}
|
|
1347
|
+
compProps={{
|
|
1348
|
+
text: translateContent,
|
|
1349
|
+
item: row,
|
|
1350
|
+
index,
|
|
1351
|
+
}}
|
|
1352
|
+
/>
|
|
1353
|
+
);
|
|
1354
|
+
} else if (c.customRendering && funcExpExecute) {
|
|
1355
|
+
content = (
|
|
1356
|
+
<span
|
|
1357
|
+
// eslint-disable-next-line react/no-danger
|
|
1358
|
+
dangerouslySetInnerHTML={{
|
|
1359
|
+
__html: funcExpExecute(c.customRendering, [
|
|
1360
|
+
{
|
|
1361
|
+
key: 'text',
|
|
1362
|
+
value: translateContent,
|
|
1363
|
+
},
|
|
1364
|
+
{
|
|
1365
|
+
key: 'row',
|
|
1366
|
+
value: row,
|
|
1367
|
+
},
|
|
1368
|
+
{
|
|
1369
|
+
key: 'index',
|
|
1370
|
+
value: index,
|
|
1371
|
+
},
|
|
1372
|
+
]),
|
|
1373
|
+
}}
|
|
1374
|
+
className={classnames({ 'ued-control-line-number': isLineNumSet })}
|
|
1375
|
+
style={controllLineStyle}
|
|
1376
|
+
/>
|
|
1377
|
+
);
|
|
1378
|
+
}
|
|
1373
1379
|
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
index,
|
|
1383
|
-
});
|
|
1384
|
-
}
|
|
1380
|
+
// 单元格提示 -> 气泡卡片
|
|
1381
|
+
if (editContent?.edittype === 'Popover' && editContent?.selectoption) {
|
|
1382
|
+
const { page, options } = editContent.selectoption;
|
|
1383
|
+
// 页面
|
|
1384
|
+
if (page && page.pageId && engineApis?.renderPopover) {
|
|
1385
|
+
if (!Object.keys(pageData).length || !pageData[page.pageId]) {
|
|
1386
|
+
return content;
|
|
1387
|
+
}
|
|
1385
1388
|
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1389
|
+
try {
|
|
1390
|
+
const pageRule = page.rule;
|
|
1391
|
+
if (pageRule) {
|
|
1392
|
+
if (typeof pageRule === 'string') {
|
|
1393
|
+
page.rule = (row: any, rowId: string, index: number) =>
|
|
1394
|
+
sandBoxSafeRun(pageRule, {
|
|
1395
|
+
row,
|
|
1396
|
+
rowId,
|
|
1397
|
+
index,
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
if (
|
|
1402
|
+
typeof page?.rule === 'function' &&
|
|
1403
|
+
page.rule(row, rowId, index)
|
|
1404
|
+
) {
|
|
1405
|
+
return content;
|
|
1394
1406
|
}
|
|
1395
|
-
} catch (e) {
|
|
1396
|
-
console.error(e);
|
|
1397
1407
|
}
|
|
1408
|
+
} catch (e) {
|
|
1409
|
+
console.error(e);
|
|
1410
|
+
}
|
|
1398
1411
|
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1412
|
+
const params: any = {};
|
|
1413
|
+
let popoverOptions = page.options;
|
|
1414
|
+
if (page.options) {
|
|
1415
|
+
popoverOptions = page.options.map((_c: any) => {
|
|
1416
|
+
const c = {
|
|
1417
|
+
..._c,
|
|
1418
|
+
};
|
|
1419
|
+
try {
|
|
1420
|
+
const stateParamRule = c?.paramFunc ?? c?.stateParam;
|
|
1421
|
+
if (stateParamRule) {
|
|
1422
|
+
if (typeof stateParamRule === 'string') {
|
|
1423
|
+
c.paramFunc = (row: any, rowId: string, index: number) =>
|
|
1424
|
+
sandBoxSafeRun(stateParamRule, {
|
|
1425
|
+
row,
|
|
1426
|
+
rowId,
|
|
1427
|
+
index,
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1414
1430
|
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
}
|
|
1431
|
+
if (typeof c.paramFunc === 'function') {
|
|
1432
|
+
params[_c.code] = c.paramFunc(row, rowId, index);
|
|
1433
|
+
c.stateParam = params[_c.code];
|
|
1419
1434
|
}
|
|
1420
|
-
} catch (e) {
|
|
1421
|
-
console.error(e);
|
|
1422
1435
|
}
|
|
1423
|
-
})
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
props,
|
|
1428
|
-
popoverSetting: {
|
|
1429
|
-
page,
|
|
1430
|
-
options: page.options,
|
|
1431
|
-
state: params,
|
|
1432
|
-
},
|
|
1433
|
-
uid: compId,
|
|
1436
|
+
} catch (e) {
|
|
1437
|
+
console.error(e);
|
|
1438
|
+
}
|
|
1439
|
+
return c;
|
|
1434
1440
|
});
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1441
|
+
}
|
|
1442
|
+
content = engineApis.renderPopover({
|
|
1443
|
+
childElement: content,
|
|
1444
|
+
props,
|
|
1445
|
+
popoverSetting: {
|
|
1446
|
+
page: {
|
|
1447
|
+
...page,
|
|
1448
|
+
options: popoverOptions,
|
|
1449
|
+
},
|
|
1450
|
+
options: popoverOptions,
|
|
1451
|
+
state: params,
|
|
1452
|
+
},
|
|
1453
|
+
uid: compId,
|
|
1454
|
+
});
|
|
1455
|
+
} else if (options.content) {
|
|
1456
|
+
// 自定义
|
|
1457
|
+
const {
|
|
1458
|
+
maxWidth,
|
|
1459
|
+
content: popContent,
|
|
1460
|
+
rule: popRule,
|
|
1461
|
+
...resOptions
|
|
1462
|
+
} = options;
|
|
1463
|
+
|
|
1464
|
+
// 隐藏规则
|
|
1465
|
+
try {
|
|
1466
|
+
if (popRule) {
|
|
1467
|
+
if (typeof popRule === 'string') {
|
|
1468
|
+
options.rule = (row: any, rowId: string, index: number) =>
|
|
1469
|
+
sandBoxSafeRun(popRule, {
|
|
1470
|
+
row,
|
|
1471
|
+
rowId,
|
|
1472
|
+
index,
|
|
1473
|
+
});
|
|
1474
|
+
}
|
|
1455
1475
|
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
children: content,
|
|
1462
|
-
};
|
|
1463
|
-
}
|
|
1476
|
+
if (
|
|
1477
|
+
typeof options?.rule === 'function' &&
|
|
1478
|
+
options.rule(row, rowId, index)
|
|
1479
|
+
) {
|
|
1480
|
+
return content;
|
|
1464
1481
|
}
|
|
1465
|
-
} catch (e) {
|
|
1466
|
-
console.error(e);
|
|
1467
1482
|
}
|
|
1483
|
+
} catch (e) {
|
|
1484
|
+
console.error(e);
|
|
1485
|
+
}
|
|
1468
1486
|
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1487
|
+
let newPopContent = popContent;
|
|
1488
|
+
try {
|
|
1489
|
+
if (popContent) {
|
|
1490
|
+
if (typeof popContent === 'string') {
|
|
1491
|
+
options.content = (row: any, rowId: string, index: number) =>
|
|
1492
|
+
sandBoxSafeRun(popContent, {
|
|
1493
|
+
row,
|
|
1494
|
+
rowId,
|
|
1495
|
+
index,
|
|
1496
|
+
});
|
|
1497
|
+
}
|
|
1480
1498
|
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
}
|
|
1499
|
+
if (typeof options?.content === 'function') {
|
|
1500
|
+
newPopContent = options.content(row, rowId, index);
|
|
1484
1501
|
}
|
|
1485
|
-
} catch (e) {
|
|
1486
|
-
console.error(e);
|
|
1487
1502
|
}
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
<Popover
|
|
1491
|
-
overlayStyle={{
|
|
1492
|
-
maxWidth: maxWidth || 'none',
|
|
1493
|
-
wordBreak: 'break-word',
|
|
1494
|
-
}}
|
|
1495
|
-
content={newPopContent}
|
|
1496
|
-
{...resOptions}
|
|
1497
|
-
arrowPointAtCenter
|
|
1498
|
-
>
|
|
1499
|
-
{content}
|
|
1500
|
-
</Popover>
|
|
1501
|
-
);
|
|
1503
|
+
} catch (e) {
|
|
1504
|
+
console.error(e);
|
|
1502
1505
|
}
|
|
1506
|
+
|
|
1507
|
+
content = (
|
|
1508
|
+
<Popover
|
|
1509
|
+
overlayStyle={{
|
|
1510
|
+
maxWidth: maxWidth || 'none',
|
|
1511
|
+
wordBreak: 'break-word',
|
|
1512
|
+
}}
|
|
1513
|
+
content={newPopContent}
|
|
1514
|
+
{...resOptions}
|
|
1515
|
+
arrowPointAtCenter
|
|
1516
|
+
>
|
|
1517
|
+
{content}
|
|
1518
|
+
</Popover>
|
|
1519
|
+
);
|
|
1503
1520
|
}
|
|
1521
|
+
}
|
|
1504
1522
|
|
|
1505
|
-
|
|
1506
|
-
|
|
1523
|
+
return content;
|
|
1524
|
+
};
|
|
1525
|
+
// 是否开启排序(判断标准:1、配置态配置 sorter: true 2、存量数据存在 defaultSortOrder)
|
|
1526
|
+
if (c.sorter || c.defaultSortOrder) {
|
|
1527
|
+
// 判断是根据前端默认排序函数排序,还是受控排序
|
|
1528
|
+
if (hasSortEvent || Object.keys(rowSpanColMap).length > 0) {
|
|
1529
|
+
c.sorter = true;
|
|
1530
|
+
} else {
|
|
1531
|
+
c.sorter = (a: any, b: any) => {
|
|
1532
|
+
return compareFn(a[c.dataIndex || c.key], b[c.dataIndex || c.key]);
|
|
1507
1533
|
};
|
|
1508
|
-
};
|
|
1509
|
-
|
|
1510
|
-
// 是否开启排序(判断标准:1、配置态配置 sorter: true 2、存量数据存在 defaultSortOrder)
|
|
1511
|
-
if (c.sorter || c.defaultSortOrder) {
|
|
1512
|
-
// 判断是根据前端默认排序函数排序,还是受控排序
|
|
1513
|
-
if (hasSortEvent || Object.keys(rowSpanColMap).length > 0) {
|
|
1514
|
-
newColumns[i].sorter = true;
|
|
1515
|
-
} else {
|
|
1516
|
-
newColumns[i].sorter = (a: any, b: any) => {
|
|
1517
|
-
return compareFn(a[c.dataIndex || c.key], b[c.dataIndex || c.key]);
|
|
1518
|
-
};
|
|
1519
|
-
}
|
|
1520
1534
|
}
|
|
1535
|
+
}
|
|
1536
|
+
};
|
|
1537
|
+
|
|
1538
|
+
const finalcolumns: any[] = useMemo(() => {
|
|
1539
|
+
const newColumns = [...customCols];
|
|
1540
|
+
let finalCols: ColumnProps<any>[] = [];
|
|
1541
|
+
|
|
1542
|
+
// 用于表格头分组的数据结构:左树根节点,为第0层
|
|
1543
|
+
const leftTree: any = {
|
|
1544
|
+
title: treeRootName,
|
|
1545
|
+
};
|
|
1546
|
+
|
|
1547
|
+
newColumns.forEach((c, i) => {
|
|
1548
|
+
const { dataIndex } = c;
|
|
1549
|
+
|
|
1550
|
+
// 按照条件,初始化生成实际的列定义
|
|
1551
|
+
generateTableCol(c);
|
|
1521
1552
|
|
|
1522
1553
|
// 是否开启筛选
|
|
1523
1554
|
if (c.filter) {
|