@bit-sun/business-component 2.2.1 → 2.2.2
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/dist/index.d.ts +1 -0
- package/dist/index.esm.js +6007 -5131
- package/dist/index.js +6006 -5129
- package/dist/plugin/TableColumnSetting/index.d.ts +64 -0
- package/dist/plugin/TableColumnSetting/utils.d.ts +1 -0
- package/dist/utils/LocalstorageUtils.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/Business/AddSelectBusiness/index.md +21 -0
- package/src/components/Business/AddSelectBusiness/index.tsx +4 -1
- package/src/components/Functional/AddSelect/index.md +2 -1
- package/src/components/Functional/AddSelect/index.tsx +251 -173
- package/src/components/Functional/BillEntry/index.tsx +129 -33
- package/src/index.ts +1 -1
- package/src/plugin/TableColumnSetting/index.less +247 -0
- package/src/plugin/TableColumnSetting/index.md +50 -0
- package/src/plugin/TableColumnSetting/index.tsx +724 -0
- package/src/plugin/TableColumnSetting/utils.ts +19 -0
- package/src/utils/LocalstorageUtils.ts +33 -0
|
@@ -5,9 +5,14 @@ import { SearchOutlined, CopyOutlined, CloseCircleOutlined } from '@ant-design/i
|
|
|
5
5
|
import { stringify } from 'querystring';
|
|
6
6
|
import './index.less';
|
|
7
7
|
import axios from 'axios';
|
|
8
|
+
import { Resizable } from 'react-resizable';
|
|
8
9
|
import { checkQuantityAccuracy, precisionQuantity } from '@/utils/checkUtils';
|
|
9
10
|
import { tableColumnsImage } from '@/components/Business/BsSulaQueryTable/utils';
|
|
10
11
|
import { getSkuImg } from '@/utils/TableUtils';
|
|
12
|
+
import TableColumnSetting from '@/plugin/TableColumnSetting';
|
|
13
|
+
import { setInitialShowColumn } from '@/plugin/TableColumnSetting/utils';
|
|
14
|
+
import { getItemDefaultWidth, noEmptyArray } from '@/components/Business/columnSettingTable/utils';
|
|
15
|
+
import { handleAntdColumnsSpecialParams } from '@/utils/utils';
|
|
11
16
|
|
|
12
17
|
const InputElement = ({
|
|
13
18
|
record, text, currentIndex, inputLength, index, setData, data, item, callSelectItem
|
|
@@ -440,7 +445,25 @@ const InputElement = ({
|
|
|
440
445
|
)
|
|
441
446
|
}
|
|
442
447
|
|
|
443
|
-
const
|
|
448
|
+
const ResizeableTitle = (props) => {
|
|
449
|
+
const { onResize, width, ...restProps } = props;
|
|
450
|
+
|
|
451
|
+
if (!width) {
|
|
452
|
+
return <th {...restProps} />;
|
|
453
|
+
}
|
|
454
|
+
return (
|
|
455
|
+
<Resizable
|
|
456
|
+
width={width}
|
|
457
|
+
height={0}
|
|
458
|
+
onResize={onResize}
|
|
459
|
+
draggableOpts={{ enableUserSelectHack: false }}
|
|
460
|
+
>
|
|
461
|
+
<th {...restProps} />
|
|
462
|
+
</Resizable>
|
|
463
|
+
);
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
const BillEntry: React.FC = ({ onSaveCallback, validDataUrl="/items/sku/import/check", isBrandAuth=true, isCheckStockNum=true, tableCode='skuBillEntry-tableSelectedItemPartCode' }) => {
|
|
444
467
|
const columns = [
|
|
445
468
|
{
|
|
446
469
|
title: 'SKU编码',
|
|
@@ -526,8 +549,52 @@ const BillEntry: React.FC = ({ onSaveCallback, validDataUrl="/items/sku/import/c
|
|
|
526
549
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
527
550
|
const [data, setData] = useState([{ hovered: false }]);
|
|
528
551
|
const tableRef = useRef(null)
|
|
552
|
+
const codeSelected = tableCode;
|
|
529
553
|
|
|
530
554
|
const [loading, setLoading] = useState(false);
|
|
555
|
+
const [selectColumns, setSelectColumns] = useState([]);
|
|
556
|
+
const [showColumns, setShowColumns] = useState([]);
|
|
557
|
+
|
|
558
|
+
useEffect(() => {
|
|
559
|
+
setSelectColumns([...columns.map(item => {
|
|
560
|
+
const inputLength = columns.filter(item => item.isInputItem || item.isSelectItem).length
|
|
561
|
+
const currentIndex = inputIndex
|
|
562
|
+
if (item.isInputItem) {
|
|
563
|
+
inputIndex++;
|
|
564
|
+
return {
|
|
565
|
+
...item,
|
|
566
|
+
render: (text, record, index) => {
|
|
567
|
+
return (
|
|
568
|
+
<InputElement setData={setData} callSelectItem={callSelectItem.bind(this, index)} item={item} isPrimaryInput={item.isPrimaryInput} record={record} text={text} data={data} index={index} inputLength={inputLength} currentIndex={currentIndex} />
|
|
569
|
+
);
|
|
570
|
+
},
|
|
571
|
+
}
|
|
572
|
+
} else if (item.isSelectItem) {
|
|
573
|
+
inputIndex++;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
return item
|
|
577
|
+
}), {
|
|
578
|
+
title: '操作',
|
|
579
|
+
width: 50,
|
|
580
|
+
render: (text, record, index) => {
|
|
581
|
+
if (index !== 0) {
|
|
582
|
+
return (
|
|
583
|
+
<span style={{ cursor: 'pointer', color: '#005CFF' }} onClick={() => {
|
|
584
|
+
deleteRecord(record)
|
|
585
|
+
}}>删除</span>
|
|
586
|
+
)
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}])
|
|
590
|
+
},[data])
|
|
591
|
+
|
|
592
|
+
useEffect(() => {
|
|
593
|
+
setInitialShowColumn(codeSelected,selectColumns,(res) => {
|
|
594
|
+
console.log(res,'---res')
|
|
595
|
+
setShowColumnsCallback(res)
|
|
596
|
+
})
|
|
597
|
+
},[selectColumns])
|
|
531
598
|
|
|
532
599
|
const callSelectItem = (index, item) => {
|
|
533
600
|
if (item) {
|
|
@@ -549,37 +616,6 @@ const BillEntry: React.FC = ({ onSaveCallback, validDataUrl="/items/sku/import/c
|
|
|
549
616
|
}
|
|
550
617
|
|
|
551
618
|
let inputIndex = 0;
|
|
552
|
-
let selectColumns = [...columns.map(item => {
|
|
553
|
-
const inputLength = columns.filter(item => item.isInputItem || item.isSelectItem).length
|
|
554
|
-
const currentIndex = inputIndex
|
|
555
|
-
if (item.isInputItem) {
|
|
556
|
-
inputIndex++;
|
|
557
|
-
return {
|
|
558
|
-
...item,
|
|
559
|
-
render: (text, record, index) => {
|
|
560
|
-
return (
|
|
561
|
-
<InputElement setData={setData} callSelectItem={callSelectItem.bind(this, index)} item={item} isPrimaryInput={item.isPrimaryInput} record={record} text={text} data={data} index={index} inputLength={inputLength} currentIndex={currentIndex} />
|
|
562
|
-
);
|
|
563
|
-
},
|
|
564
|
-
}
|
|
565
|
-
} else if (item.isSelectItem) {
|
|
566
|
-
inputIndex++;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
return item
|
|
570
|
-
}), {
|
|
571
|
-
title: '操作',
|
|
572
|
-
width: 50,
|
|
573
|
-
render: (text, record, index) => {
|
|
574
|
-
if (index !== 0) {
|
|
575
|
-
return (
|
|
576
|
-
<span style={{ cursor: 'pointer', color: '#005CFF' }} onClick={() => {
|
|
577
|
-
deleteRecord(record)
|
|
578
|
-
}}>删除</span>
|
|
579
|
-
)
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
}]
|
|
583
619
|
|
|
584
620
|
const isSkuCanEntry = (resultData) => {
|
|
585
621
|
// 处理业务参数
|
|
@@ -642,11 +678,66 @@ const BillEntry: React.FC = ({ onSaveCallback, validDataUrl="/items/sku/import/c
|
|
|
642
678
|
})
|
|
643
679
|
}
|
|
644
680
|
|
|
681
|
+
const setShowColumnsCallback = (newColumns: Array<any>) => {
|
|
682
|
+
setShowColumns([...newColumns])
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
const handleResize = (arr,index: any, callback) => (_: any, { size }: any) => {
|
|
686
|
+
let newColumns = arr.map((col: any) => ({ ...col }));
|
|
687
|
+
const handleIndex = (arr: any, indexArr: any) => {
|
|
688
|
+
let i = indexArr.shift();
|
|
689
|
+
if (indexArr.length > 0) {
|
|
690
|
+
handleIndex(arr[i].children, indexArr);
|
|
691
|
+
} else {
|
|
692
|
+
arr[i] = {
|
|
693
|
+
...arr[i],
|
|
694
|
+
width: size.width,
|
|
695
|
+
};
|
|
696
|
+
handleAntdColumnsSpecialParams(arr[i]);
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
handleIndex(newColumns, [...index]);
|
|
700
|
+
callback(newColumns)
|
|
701
|
+
};
|
|
702
|
+
|
|
703
|
+
const handleColumns = (arr: any, indexArr: any[], callback: any) => {
|
|
704
|
+
arr.forEach((item: any, index: any) => {
|
|
705
|
+
let indexArrInside = [...indexArr, index].filter((i: any) => i || i === 0)
|
|
706
|
+
if (noEmptyArray(item.children)) {
|
|
707
|
+
handleColumns(item.children, indexArrInside);
|
|
708
|
+
} else {
|
|
709
|
+
item.width = item.width || getItemDefaultWidth(item);
|
|
710
|
+
item.onHeaderCell = (column: any) => ({
|
|
711
|
+
...item,
|
|
712
|
+
width:
|
|
713
|
+
typeof column.width === 'number'
|
|
714
|
+
? column.width
|
|
715
|
+
: parseInt(column.width.replace('px', '')),
|
|
716
|
+
onResize: handleResize(arr,indexArrInside, callback),
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
})
|
|
720
|
+
};
|
|
721
|
+
let showSelectedCol = showColumns.map((item: any) => {
|
|
722
|
+
handleAntdColumnsSpecialParams(item);
|
|
723
|
+
return ({ ...item })
|
|
724
|
+
})
|
|
725
|
+
handleColumns(showSelectedCol, [],(res)=> setShowColumnsCallback(res));
|
|
726
|
+
|
|
645
727
|
return (
|
|
646
728
|
<div className='add_select'>
|
|
647
729
|
<div className='add_select_quick_header'>
|
|
648
730
|
<div className='add_select_quick_header_title'><div>快速录入</div><Button type="primary" onClick={() => handleSubmit()} loading={loading}>提交</Button></div>
|
|
649
731
|
<span><span>*</span> 快捷键:【Tab】-跳格切换;【Shift+←、→】-当前行左、右移动;【 ↑、↓】-当前列上、下移动;【ctrl+Delete】-删除当前行;</span>
|
|
732
|
+
<span style={{ marginRight: 8, float: 'right' }}>
|
|
733
|
+
<TableColumnSetting
|
|
734
|
+
setShowColumns={setShowColumnsCallback}
|
|
735
|
+
showColumns={showColumns}
|
|
736
|
+
datasource={selectColumns || []}
|
|
737
|
+
tableCode={codeSelected}
|
|
738
|
+
settingImgAttribute={{ width: 24, style: { marginTop: 2 } }}
|
|
739
|
+
/>
|
|
740
|
+
</span>
|
|
650
741
|
</div>
|
|
651
742
|
<div className={'add_select_wrapper_select add_select_wrapper_select_quick'}>
|
|
652
743
|
<Table
|
|
@@ -654,12 +745,17 @@ const BillEntry: React.FC = ({ onSaveCallback, validDataUrl="/items/sku/import/c
|
|
|
654
745
|
scroll={{ y: 240 }}
|
|
655
746
|
ref={tableRef}
|
|
656
747
|
dataSource={data}
|
|
657
|
-
columns={
|
|
748
|
+
columns={showSelectedCol}
|
|
658
749
|
pagination={false}
|
|
659
750
|
rowClassName={'row-class'}
|
|
660
751
|
rowClassName={(record: object | null | undefined, index: number) =>
|
|
661
752
|
index % 2 === 0 ? 'table_base row-class' : 'table_odd row-class'
|
|
662
753
|
}
|
|
754
|
+
components={{
|
|
755
|
+
header: {
|
|
756
|
+
cell: ResizeableTitle,
|
|
757
|
+
},
|
|
758
|
+
}}
|
|
663
759
|
/>
|
|
664
760
|
</div>
|
|
665
761
|
|
package/src/index.ts
CHANGED
|
@@ -31,4 +31,4 @@ export { default as BsSulaQueryTable } from './components/Business/BsSulaQueryTa
|
|
|
31
31
|
export { default as BsLayout } from './components/Business/BsLayouts';
|
|
32
32
|
export { default as MoreTreeTable } from './components/Business/moreTreeTable';;
|
|
33
33
|
export { default as JsonQueryTable } from './components/Business/JsonQueryTable';
|
|
34
|
-
|
|
34
|
+
export { default as TableColumnSetting} from './plugin/TableColumnSetting';
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
// 列自定义
|
|
2
|
+
.sort_table_wrapper {
|
|
3
|
+
.sort_table {
|
|
4
|
+
display: flex;
|
|
5
|
+
|
|
6
|
+
.sort_table_column_wrapper {
|
|
7
|
+
width: 560px;
|
|
8
|
+
margin-right: 10px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.sort_table_content_wrapper {
|
|
12
|
+
width: 210px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.sort_table_column_count,
|
|
16
|
+
.sort_table_content_count {
|
|
17
|
+
height: 20px;
|
|
18
|
+
font-family: PingFangSC-Regular;
|
|
19
|
+
font-weight: 400;
|
|
20
|
+
font-size: 14px;
|
|
21
|
+
color: #000000;
|
|
22
|
+
letter-spacing: 0;
|
|
23
|
+
|
|
24
|
+
span {
|
|
25
|
+
color: #848484;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.sort_table_column {
|
|
30
|
+
margin-top: 10px;
|
|
31
|
+
width: 560px;
|
|
32
|
+
height: 430px;
|
|
33
|
+
overflow: auto;
|
|
34
|
+
padding: 10px;
|
|
35
|
+
background: #ffffff;
|
|
36
|
+
border: 1px solid #d9d9d9;
|
|
37
|
+
border-radius: 5px;
|
|
38
|
+
|
|
39
|
+
&_all {
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-wrap: wrap;
|
|
42
|
+
justify-content: space-between;
|
|
43
|
+
|
|
44
|
+
&_empty {
|
|
45
|
+
width: 538px;
|
|
46
|
+
line-height: 360px;
|
|
47
|
+
text-align: center;
|
|
48
|
+
font-family: PingFangSC-Regular;
|
|
49
|
+
font-weight: 400;
|
|
50
|
+
font-size: 14px;
|
|
51
|
+
color: #848484;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&_special {
|
|
56
|
+
margin-top: 40px;
|
|
57
|
+
width: 100px;
|
|
58
|
+
height: 20px;
|
|
59
|
+
font-family: PingFangSC-Regular;
|
|
60
|
+
font-weight: 400;
|
|
61
|
+
font-size: 14px;
|
|
62
|
+
color: #848484;
|
|
63
|
+
letter-spacing: 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.ant-checkbox-wrapper {
|
|
67
|
+
width: 144px;
|
|
68
|
+
margin-top: 16px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.ant-checkbox-wrapper+.ant-checkbox-wrapper {
|
|
72
|
+
margin-left: 0px;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.sort_table_content {
|
|
77
|
+
margin-top: 10px;
|
|
78
|
+
padding-top: 10px;
|
|
79
|
+
padding-bottom: 10px;
|
|
80
|
+
border: 1px solid #d9d9d9;
|
|
81
|
+
border-radius: 5px;
|
|
82
|
+
|
|
83
|
+
.ant-table-wrapper {
|
|
84
|
+
padding: 0px !important;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.sort_table_title {
|
|
88
|
+
height: 32px;
|
|
89
|
+
line-height: 32px;
|
|
90
|
+
padding-left: 10px;
|
|
91
|
+
color: gray;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
div.ant-modal-header {
|
|
97
|
+
width: 820px;
|
|
98
|
+
height: 64px;
|
|
99
|
+
background: #ffffff;
|
|
100
|
+
padding: 20px;
|
|
101
|
+
border: 0px;
|
|
102
|
+
|
|
103
|
+
div.ant-modal-title {
|
|
104
|
+
height: 24px;
|
|
105
|
+
font-family: PingFangSC-Medium;
|
|
106
|
+
font-weight: 500;
|
|
107
|
+
font-size: 18px;
|
|
108
|
+
color: #000000;
|
|
109
|
+
letter-spacing: 0;
|
|
110
|
+
line-height: 24px;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.ant-modal-body {
|
|
115
|
+
padding: 0 20px !important;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.ant-modal-close-x {
|
|
119
|
+
height: 24px;
|
|
120
|
+
font-family: PingFangSC-Medium;
|
|
121
|
+
font-weight: 500;
|
|
122
|
+
font-size: 18px;
|
|
123
|
+
color: #000000;
|
|
124
|
+
letter-spacing: 0;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.ant-input-affix-wrapper {
|
|
128
|
+
padding: 0px;
|
|
129
|
+
padding-right: 10px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
input {
|
|
133
|
+
height: 32px;
|
|
134
|
+
padding: 6px 4px;
|
|
135
|
+
border-radius: 5px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.ant-input-prefix {
|
|
139
|
+
width: 24px;
|
|
140
|
+
height: 24px;
|
|
141
|
+
margin: 4px;
|
|
142
|
+
// border: 1px dashed #d9d9d9;
|
|
143
|
+
display: flex;
|
|
144
|
+
justify-content: center;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.ant-modal-footer {
|
|
148
|
+
height: 70px;
|
|
149
|
+
border: 0;
|
|
150
|
+
padding: 20px;
|
|
151
|
+
|
|
152
|
+
.ant-btn {
|
|
153
|
+
width: 80px;
|
|
154
|
+
height: 34px;
|
|
155
|
+
border-radius: 5px;
|
|
156
|
+
|
|
157
|
+
span {
|
|
158
|
+
font-family: PingFangSC-Medium;
|
|
159
|
+
font-weight: 600;
|
|
160
|
+
font-size: 14px;
|
|
161
|
+
letter-spacing: 0;
|
|
162
|
+
text-align: center;
|
|
163
|
+
line-height: 20px;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
&:first-child {
|
|
167
|
+
margin-right: 524px;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.ant-table-wrapper::-webkit-scrollbar {
|
|
173
|
+
display: none;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.ant-table-wrapper {
|
|
177
|
+
margin-top: 10px;
|
|
178
|
+
height: 364px;
|
|
179
|
+
overflow: scroll;
|
|
180
|
+
padding-bottom: 50px;
|
|
181
|
+
|
|
182
|
+
tr {
|
|
183
|
+
height: 36px;
|
|
184
|
+
|
|
185
|
+
td {
|
|
186
|
+
width: 24px !important;
|
|
187
|
+
height: 36px !important;
|
|
188
|
+
font-family: PingFangSC-Regular;
|
|
189
|
+
font-weight: 400;
|
|
190
|
+
font-size: 14px;
|
|
191
|
+
color: #000000;
|
|
192
|
+
letter-spacing: 0;
|
|
193
|
+
|
|
194
|
+
&:first-child {
|
|
195
|
+
padding-left: 10px !important;
|
|
196
|
+
padding-right: 0px !important;
|
|
197
|
+
width: 115px !important;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
img {
|
|
201
|
+
// border: 1px dashed #d9d9d9;
|
|
202
|
+
cursor: pointer;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&:not(:first-child) {
|
|
206
|
+
padding-left: 0px !important;
|
|
207
|
+
padding-right: 0px !important;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
&:last-child {
|
|
211
|
+
padding-left: 0px !important;
|
|
212
|
+
padding-right: 3px !important;
|
|
213
|
+
width: 34px !important;
|
|
214
|
+
|
|
215
|
+
img {
|
|
216
|
+
// border: 1px dashed #d9d9d9;
|
|
217
|
+
position: relative;
|
|
218
|
+
top: 1px;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.global_tab_nav_style {
|
|
227
|
+
top: 2px !important;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.row-dragging {
|
|
231
|
+
background: #fafafa;
|
|
232
|
+
border: 1px solid #ccc;
|
|
233
|
+
z-index: 10000;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.row-dragging td {
|
|
237
|
+
padding: 7px 16px;
|
|
238
|
+
display: none;
|
|
239
|
+
|
|
240
|
+
}
|
|
241
|
+
.row-dragging td:first-child {
|
|
242
|
+
display: inline-block;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.row-dragging .drag-visible {
|
|
246
|
+
visibility: visible;
|
|
247
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 表头设置
|
|
3
|
+
order: 1
|
|
4
|
+
nav:
|
|
5
|
+
title: 插件
|
|
6
|
+
order: 1
|
|
7
|
+
group:
|
|
8
|
+
path: /plugin/TableColumnSetting
|
|
9
|
+
order: 0
|
|
10
|
+
title: 功能组件
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## TableColumnSetting
|
|
14
|
+
|
|
15
|
+
表头设置demo
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import React, { useState, useRef } from 'react';
|
|
19
|
+
import { TableColumnSetting } from '../../index';
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export default () => {
|
|
24
|
+
const tableRef = useRef()
|
|
25
|
+
|
|
26
|
+
const [showColumns, setShowColumns] = useState([])
|
|
27
|
+
|
|
28
|
+
const selectColumns = [];
|
|
29
|
+
const tableCode = 'test-TableCode'
|
|
30
|
+
|
|
31
|
+
const setShowColumnsCallback = (value: any) => {
|
|
32
|
+
setShowColumns(value)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div>
|
|
37
|
+
<TableColumnSetting
|
|
38
|
+
setShowColumns={setShowColumnsCallback}
|
|
39
|
+
showColumns={showColumns}
|
|
40
|
+
datasource={selectColumns || []}
|
|
41
|
+
tableCode={tableCode}
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
<API></API>
|
|
49
|
+
|
|
50
|
+
More skills for writing demo: https://d.umijs.org/guide/demo-principle
|