@xaypay/tui 0.0.81 → 0.0.82
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.es.js +210 -135
- package/dist/index.js +210 -135
- package/package.json +1 -1
- package/src/components/icon/Arrow.js +2 -2
- package/src/components/icon/CaptchaArrowDown.js +2 -2
- package/src/components/icon/CaptchaArrowUp.js +2 -2
- package/src/components/icon/CheckboxChecked.js +2 -2
- package/src/components/icon/CheckboxUnchecked.js +2 -2
- package/src/components/icon/Close.js +2 -2
- package/src/components/icon/CloseIcon.js +2 -2
- package/src/components/icon/CloseSlide.js +2 -2
- package/src/components/icon/DeleteComponent.js +2 -2
- package/src/components/icon/Dots.js +2 -2
- package/src/components/icon/HeartFilled.js +2 -2
- package/src/components/icon/HeartOutline.js +2 -2
- package/src/components/icon/ListItemDelete.js +2 -2
- package/src/components/icon/ListItemJpeg.js +2 -2
- package/src/components/icon/ListItemJpg.js +2 -2
- package/src/components/icon/ListItemPdf.js +2 -2
- package/src/components/icon/ListItemPng.js +2 -2
- package/src/components/icon/Next.js +2 -2
- package/src/components/icon/Nextarrow.js +2 -2
- package/src/components/icon/PDF.js +2 -2
- package/src/components/icon/Prev.js +2 -2
- package/src/components/icon/RangeArrowDefault.js +2 -2
- package/src/components/icon/RangeArrowError.js +2 -2
- package/src/components/icon/RangeArrowSuccess.js +2 -2
- package/src/components/icon/RemoveFile.js +2 -2
- package/src/components/icon/ToasterClose.js +2 -2
- package/src/components/icon/ToasterError.js +2 -2
- package/src/components/icon/ToasterInfo.js +2 -2
- package/src/components/icon/ToasterSuccess.js +2 -2
- package/src/components/icon/ToasterWarning.js +2 -2
- package/src/components/icon/Tooltip.js +2 -2
- package/src/components/icon/Upload.js +2 -2
- package/src/components/input/index.js +11 -21
- package/src/components/modal/index.js +26 -15
- package/src/components/modal/modal.stories.js +1 -1
- package/src/components/newAutocomplete/index.js +9 -5
- package/src/components/select/index.js +9 -2
- package/src/components/singleCheckbox/index.js +27 -5
- package/src/components/table/index.js +28 -11
- package/src/components/table/table.stories.js +382 -256
- package/src/components/table/td.js +26 -8
- package/src/components/table/th.js +28 -5
- package/src/components/textarea/index.js +21 -15
- package/src/components/textarea/textarea.stories.js +4 -0
- package/src/stories/configuration.stories.mdx +17 -5
- package/tui.config.js +17 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import Table from '
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import Table from '.';
|
|
3
3
|
|
|
4
4
|
import { ReactComponent as ReactSVGPlus } from './../../assets/plus.svg';
|
|
5
5
|
import { ReactComponent as ReactSVGMinus } from './../../assets/minus.svg';
|
|
@@ -14,285 +14,411 @@ export default {
|
|
|
14
14
|
title: 'Components/Table'
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
const headerData = [
|
|
18
|
+
{
|
|
19
|
+
type: 'show',
|
|
20
|
+
content: 'Հ/Հ',
|
|
21
|
+
checkBox: {
|
|
22
|
+
checked: false,
|
|
23
|
+
checkedColor: 'orange',
|
|
24
|
+
unCheckedColor: 'orange'
|
|
25
|
+
},
|
|
26
|
+
sortingArrows: true
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
type: 'show',
|
|
30
|
+
content: 'ՀՎՀՀ',
|
|
31
|
+
sortingArrows: true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
type: 'show',
|
|
35
|
+
content: 'Վարչ․շրջան',
|
|
36
|
+
sortingArrows: true
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: 'show',
|
|
40
|
+
content: 'Վճար',
|
|
41
|
+
checkBox: {
|
|
42
|
+
checked: false,
|
|
43
|
+
checkedColor: 'orange',
|
|
44
|
+
unCheckedColor: 'orange'
|
|
45
|
+
},
|
|
46
|
+
sortingArrows: true
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
type: 'show',
|
|
50
|
+
content: 'Ամսաթիվ',
|
|
51
|
+
sortingArrows: true
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: 'show',
|
|
55
|
+
content: 'Մուտքի ամս․',
|
|
56
|
+
sortingArrows: true
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: 'show',
|
|
60
|
+
content: 'Հավելյալ ինֆորմացիա',
|
|
61
|
+
sortingArrows: true
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
type: 'show',
|
|
65
|
+
content: 'Ստեղծված',
|
|
66
|
+
sortingArrows: true
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: 'show',
|
|
70
|
+
content: 'Գործողություն',
|
|
71
|
+
sortingArrows: true
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: 'show',
|
|
75
|
+
content: <ReactSVG />,
|
|
76
|
+
sortingArrows: false,
|
|
77
|
+
}
|
|
78
|
+
];
|
|
26
79
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
80
|
+
const bodyData = [
|
|
81
|
+
{
|
|
82
|
+
hh: {
|
|
83
|
+
id: 19854,
|
|
84
|
+
content: 19854,
|
|
85
|
+
checkBox: {
|
|
86
|
+
checked: false,
|
|
87
|
+
checkedColor: 'green',
|
|
88
|
+
unCheckedColor: 'green'
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
hvhh: {
|
|
92
|
+
content: 10195524
|
|
93
|
+
},
|
|
94
|
+
shrjan: {
|
|
95
|
+
content: 'Շենգավիթ'
|
|
96
|
+
},
|
|
97
|
+
pay: {
|
|
98
|
+
id: 19854,
|
|
99
|
+
content: 7000,
|
|
100
|
+
checkBox: {
|
|
101
|
+
checked: false,
|
|
102
|
+
checkedColor: 'green',
|
|
103
|
+
unCheckedColor: 'green'
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
startDate: {
|
|
107
|
+
content: '27.05.2022'
|
|
108
|
+
},
|
|
109
|
+
enterDate: {
|
|
110
|
+
content: '27.05.2022'
|
|
111
|
+
},
|
|
112
|
+
info: {
|
|
113
|
+
openArrow: <ReactSVGArrowUp />,
|
|
114
|
+
closeArrow: <ReactSVGArrowDown />,
|
|
115
|
+
content: 'Այլ արտաքին գովազդի տեղադրելու վճար / ԱՁ',
|
|
116
|
+
contentList: [
|
|
117
|
+
'Ակտիվ է => Այո',
|
|
118
|
+
'Lorem just => ipsum',
|
|
119
|
+
'Dolor sit => amet',
|
|
120
|
+
'text for => test',
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
create: {
|
|
124
|
+
content: '27.05.2022'
|
|
125
|
+
},
|
|
126
|
+
actions: [
|
|
53
127
|
{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
onClick: handleHeaderItemClick
|
|
128
|
+
id: 19854,
|
|
129
|
+
type: 'attach',
|
|
130
|
+
content: <ReactSVGAttach />
|
|
58
131
|
},
|
|
59
132
|
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
133
|
+
id: 19854,
|
|
134
|
+
type: 'plus',
|
|
135
|
+
content: <ReactSVGPlus />
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
hh: {
|
|
141
|
+
id: 19954,
|
|
142
|
+
content: 19954,
|
|
143
|
+
checkBox: {
|
|
144
|
+
checked: false,
|
|
145
|
+
checkedColor: 'green',
|
|
146
|
+
unCheckedColor: 'green'
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
hvhh: {
|
|
150
|
+
content: 14595524
|
|
151
|
+
},
|
|
152
|
+
shrjan: {
|
|
153
|
+
content: 'Կենտրոն'
|
|
154
|
+
},
|
|
155
|
+
pay: {
|
|
156
|
+
id: 19954,
|
|
157
|
+
content: 7840,
|
|
158
|
+
checkBox: {
|
|
159
|
+
checked: false,
|
|
160
|
+
checkedColor: 'green',
|
|
161
|
+
unCheckedColor: 'green'
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
startDate: {
|
|
165
|
+
content: '27.05.2022'
|
|
166
|
+
},
|
|
167
|
+
enterDate: {
|
|
168
|
+
content: '27.05.2022'
|
|
169
|
+
},
|
|
170
|
+
info: {
|
|
171
|
+
openArrow: <ReactSVGArrowUp />,
|
|
172
|
+
closeArrow: <ReactSVGArrowDown />,
|
|
173
|
+
content: 'Այլ արտաքին գովազդի տեղադրելու վճար / ԱՁ',
|
|
174
|
+
contentList: [
|
|
175
|
+
'Ակտիվ է => Այո',
|
|
176
|
+
'Lorem just => ipsum',
|
|
177
|
+
'Dolor sit => amet',
|
|
178
|
+
'text for => test',
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
create: {
|
|
182
|
+
content: '27.05.2022'
|
|
183
|
+
},
|
|
184
|
+
actions: [
|
|
65
185
|
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
onClick: handleHeaderItemClick
|
|
186
|
+
id: 19954,
|
|
187
|
+
type: 'minus',
|
|
188
|
+
content: <ReactSVGMinus />
|
|
70
189
|
},
|
|
71
190
|
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
191
|
+
id: 19954,
|
|
192
|
+
type: 'delete',
|
|
193
|
+
content: <ReactSVGDelete />
|
|
194
|
+
}
|
|
195
|
+
]
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
hh: {
|
|
199
|
+
id: 20037,
|
|
200
|
+
content: 20037,
|
|
201
|
+
checkBox: {
|
|
202
|
+
checked: false,
|
|
203
|
+
checkedColor: 'green',
|
|
204
|
+
unCheckedColor: 'green'
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
hvhh: {
|
|
208
|
+
content: 14595524
|
|
209
|
+
},
|
|
210
|
+
shrjan: {
|
|
211
|
+
content: 'Շենգավիթ'
|
|
212
|
+
},
|
|
213
|
+
pay: {
|
|
214
|
+
id: 20037,
|
|
215
|
+
content: 6541,
|
|
216
|
+
checkBox: {
|
|
217
|
+
checked: false,
|
|
218
|
+
checkedColor: 'green',
|
|
219
|
+
unCheckedColor: 'green'
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
startDate: {
|
|
223
|
+
content: '27.05.2022'
|
|
224
|
+
},
|
|
225
|
+
enterDate: {
|
|
226
|
+
content: '27.05.2022'
|
|
227
|
+
},
|
|
228
|
+
info: {
|
|
229
|
+
openArrow: <ReactSVGArrowUp />,
|
|
230
|
+
closeArrow: <ReactSVGArrowDown />,
|
|
231
|
+
content: 'Այլ արտաքին գովազդի տեղադրելու վճար / ԱՁ',
|
|
232
|
+
contentList: [
|
|
233
|
+
'Ակտիվ է => Այո',
|
|
234
|
+
'Lorem just => ipsum',
|
|
235
|
+
'Dolor sit => amet',
|
|
236
|
+
'text for => test',
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
create: {
|
|
240
|
+
content: '27.05.2022'
|
|
241
|
+
},
|
|
242
|
+
actions: [
|
|
77
243
|
{
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
onClick: handleHeaderItemClick
|
|
244
|
+
id: 20037,
|
|
245
|
+
type: 'attach',
|
|
246
|
+
content: <ReactSVGAttach />
|
|
82
247
|
},
|
|
83
248
|
{
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
onClick: handleHeaderItemClick
|
|
249
|
+
id: 20037,
|
|
250
|
+
type: 'plus',
|
|
251
|
+
content: <ReactSVGPlus />
|
|
88
252
|
}
|
|
89
|
-
]
|
|
90
|
-
|
|
253
|
+
]
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
hh: {
|
|
257
|
+
id: 21031,
|
|
258
|
+
content: 21031,
|
|
259
|
+
checkBox: {
|
|
260
|
+
checked: false,
|
|
261
|
+
checkedColor: 'green',
|
|
262
|
+
unCheckedColor: 'green'
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
hvhh: {
|
|
266
|
+
content: 14595524
|
|
267
|
+
},
|
|
268
|
+
shrjan: {
|
|
269
|
+
content: 'Կենտրոն'
|
|
270
|
+
},
|
|
271
|
+
pay: {
|
|
272
|
+
id: 21031,
|
|
273
|
+
content: 9845,
|
|
274
|
+
checkBox: {
|
|
275
|
+
checked: false,
|
|
276
|
+
checkedColor: 'green',
|
|
277
|
+
unCheckedColor: 'green'
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
startDate: {
|
|
281
|
+
content: '27.05.2022'
|
|
282
|
+
},
|
|
283
|
+
enterDate: {
|
|
284
|
+
content: '27.05.2022'
|
|
285
|
+
},
|
|
286
|
+
info: {
|
|
287
|
+
openArrow: <ReactSVGArrowUp />,
|
|
288
|
+
closeArrow: <ReactSVGArrowDown />,
|
|
289
|
+
content: 'Այլ արտաքին գովազդի տեղադրելու վճար / ԱՁ',
|
|
290
|
+
contentList: [
|
|
291
|
+
'Ակտիվ է => Այո',
|
|
292
|
+
'Lorem just => ipsum',
|
|
293
|
+
'Dolor sit => amet',
|
|
294
|
+
'text for => test',
|
|
295
|
+
]
|
|
296
|
+
},
|
|
297
|
+
create: {
|
|
298
|
+
content: '27.05.2022'
|
|
299
|
+
},
|
|
300
|
+
actions: [
|
|
91
301
|
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
pay: 7000,
|
|
96
|
-
startDate: '27.05.2022',
|
|
97
|
-
enterDate: '27.05.2022',
|
|
98
|
-
info: {
|
|
99
|
-
id: 19854,
|
|
100
|
-
openArrow: <ReactSVGArrowUp />,
|
|
101
|
-
closeArrow: <ReactSVGArrowDown />,
|
|
102
|
-
contentTitle: 'Այլ արտաքին գովազդի տեղադրելու վճար / ԱՁ',
|
|
103
|
-
contentList: [
|
|
104
|
-
'Ակտիվ է => Այո',
|
|
105
|
-
'Lorem just => ipsum',
|
|
106
|
-
'Dolor sit => amet',
|
|
107
|
-
'text for => test',
|
|
108
|
-
]
|
|
109
|
-
},
|
|
110
|
-
create: '27.05.2022',
|
|
111
|
-
actions: [
|
|
112
|
-
{
|
|
113
|
-
id: 19854,
|
|
114
|
-
type: 'attach',
|
|
115
|
-
content: <ReactSVGAttach />,
|
|
116
|
-
onClick: handleBodyActionClick
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
id: 19954,
|
|
120
|
-
type: 'plus',
|
|
121
|
-
content: <ReactSVGPlus />,
|
|
122
|
-
onClick: handleBodyActionClick
|
|
123
|
-
}
|
|
124
|
-
]
|
|
302
|
+
id: 21031,
|
|
303
|
+
type: 'minus',
|
|
304
|
+
content: <ReactSVGMinus />
|
|
125
305
|
},
|
|
126
306
|
{
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
pay: 7840,
|
|
131
|
-
startDate: '27.05.2022',
|
|
132
|
-
enterDate: '27.05.2022',
|
|
133
|
-
info: {
|
|
134
|
-
id: 19854,
|
|
135
|
-
openArrow: <ReactSVGArrowUp />,
|
|
136
|
-
closeArrow: <ReactSVGArrowDown />,
|
|
137
|
-
contentTitle: 'Այլ արտաքին գովազդի տեղադրելու վճար / ԱՁ',
|
|
138
|
-
contentList: [
|
|
139
|
-
'Ակտիվ է => Այո',
|
|
140
|
-
'Lorem just => ipsum',
|
|
141
|
-
'Dolor sit => amet',
|
|
142
|
-
'text for => test',
|
|
143
|
-
]
|
|
144
|
-
},
|
|
145
|
-
create: '27.05.2022',
|
|
146
|
-
actions: [
|
|
147
|
-
{
|
|
148
|
-
id: 20101,
|
|
149
|
-
type: 'minus',
|
|
150
|
-
content: <ReactSVGMinus />,
|
|
151
|
-
onClick: handleBodyActionClick
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
id: 21554,
|
|
155
|
-
type: 'delete',
|
|
156
|
-
content: <ReactSVGDelete />,
|
|
157
|
-
onClick: handleBodyActionClick
|
|
158
|
-
}
|
|
159
|
-
]
|
|
307
|
+
id: 21031,
|
|
308
|
+
type: 'delete',
|
|
309
|
+
content: <ReactSVGDelete />
|
|
160
310
|
}
|
|
161
311
|
]
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return <Table data={tableDataInfo} {...args} />;
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
export const Default = Template.bind({});
|
|
168
|
-
Default.args = {};
|
|
312
|
+
}
|
|
313
|
+
];
|
|
169
314
|
|
|
315
|
+
const Template = (args) => {
|
|
316
|
+
const [tableDataHeader, setTableDataHeader] = useState(headerData);
|
|
317
|
+
const [tableDataBody, setTableDataBody] = useState(bodyData);
|
|
170
318
|
|
|
319
|
+
const [checkedFirstCount, setCheckedFirstCount] = useState(0);
|
|
320
|
+
const [checkedSecondCount, setCheckedSecondCount] = useState(0);
|
|
171
321
|
|
|
322
|
+
const handleHeaderItemClick = (e) => {
|
|
323
|
+
e.stopPropagation();
|
|
324
|
+
console.log(e.target.innerText);
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
const handleBodyActionClick = (e) => {
|
|
328
|
+
console.log(e.target.id, 'e.target.id - - - - id');
|
|
329
|
+
console.log(e.target.getAttribute('type'), 'e.target.type - - - - type');
|
|
330
|
+
};
|
|
172
331
|
|
|
332
|
+
const handleCheckedHeader = (e, content) => {
|
|
333
|
+
e.stopPropagation();
|
|
334
|
+
let checkableItemIndex;
|
|
335
|
+
let checkableItemBool;
|
|
336
|
+
const updatedHeader = tableDataHeader.slice();
|
|
337
|
+
const updatedBody = tableDataBody.slice().map(item => Object.values(item));
|
|
338
|
+
const newData = updatedHeader.map((item, index) => {
|
|
339
|
+
if (item.content === content) {
|
|
340
|
+
checkableItemIndex = index;
|
|
341
|
+
checkableItemBool = !item.checkBox.checked;
|
|
342
|
+
item.checkBox.checked = !item.checkBox.checked;
|
|
343
|
+
}
|
|
344
|
+
return item;
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
const newUpdatedBody = updatedBody.map(item => {
|
|
348
|
+
return item.map((innerItem, innerIndex) => {
|
|
349
|
+
if (checkableItemIndex === innerIndex) {
|
|
350
|
+
innerItem.checkBox.checked = checkableItemBool;
|
|
351
|
+
}
|
|
352
|
+
return innerItem;
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
setTableDataHeader(newData);
|
|
356
|
+
setTableDataBody(newUpdatedBody);
|
|
357
|
+
};
|
|
173
358
|
|
|
359
|
+
const handleCheckedBody = (e, content, id) => {
|
|
360
|
+
e.stopPropagation();
|
|
174
361
|
|
|
362
|
+
const updatedBody = tableDataBody.slice().map(item => Object.values(item));
|
|
363
|
+
const newData = updatedBody.map(item => {
|
|
364
|
+
return item.map((innerItem, innerIndex) => {
|
|
365
|
+
if (innerItem.id === id && innerItem.content === content) {
|
|
366
|
+
if (innerIndex === 0) {
|
|
367
|
+
if (innerItem.checkBox.checked === false) {
|
|
368
|
+
setCheckedFirstCount(prev => prev + 1);
|
|
369
|
+
} else {
|
|
370
|
+
setCheckedFirstCount(prev => prev - 1);
|
|
371
|
+
}
|
|
372
|
+
} else if (innerIndex === 3) {
|
|
373
|
+
if (innerItem.checkBox.checked === false) {
|
|
374
|
+
setCheckedSecondCount(prev => prev + 1);
|
|
375
|
+
} else {
|
|
376
|
+
setCheckedSecondCount(prev => prev - 1);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
innerItem.checkBox.checked = !innerItem.checkBox.checked;
|
|
380
|
+
}
|
|
381
|
+
return innerItem;
|
|
382
|
+
});
|
|
383
|
+
});
|
|
384
|
+
setTableDataBody(newData);
|
|
385
|
+
};
|
|
175
386
|
|
|
387
|
+
const handleHeaderCheckedUpdate = () => {
|
|
388
|
+
const updatedHeader = tableDataHeader.slice();
|
|
176
389
|
|
|
390
|
+
const newData = updatedHeader.map((item, index) => {
|
|
391
|
+
if (checkedFirstCount === tableDataBody.length && index === 0) {
|
|
392
|
+
item.checkBox.checked = true;
|
|
393
|
+
} else if (checkedFirstCount !== tableDataBody.length && index === 0) {
|
|
394
|
+
item.checkBox.checked = false;
|
|
395
|
+
}
|
|
177
396
|
|
|
397
|
+
if (checkedSecondCount === tableDataBody.length && index === 3) {
|
|
398
|
+
item.checkBox.checked = true;
|
|
399
|
+
} else if (checkedSecondCount !== tableDataBody.length && index === 3) {
|
|
400
|
+
item.checkBox.checked = false;
|
|
401
|
+
}
|
|
402
|
+
return item;
|
|
403
|
+
});
|
|
404
|
+
setTableDataHeader(newData);
|
|
405
|
+
};
|
|
178
406
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
// {
|
|
184
|
-
// type: 'hide',
|
|
185
|
-
// icon: svg
|
|
186
|
-
// }
|
|
187
|
-
// ]
|
|
407
|
+
useEffect(() => {
|
|
408
|
+
handleHeaderCheckedUpdate();
|
|
409
|
+
}, [checkedFirstCount, checkedSecondCount]);
|
|
410
|
+
|
|
188
411
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
// svg: <SVG></SVG>,
|
|
200
|
-
// click: onclick()
|
|
201
|
-
// },
|
|
202
|
-
// {
|
|
203
|
-
// type: "action",
|
|
204
|
-
// data: [
|
|
205
|
-
// {
|
|
206
|
-
// icon: svg,
|
|
207
|
-
// title?: 'sadas',
|
|
208
|
-
// click: onclick()
|
|
209
|
-
// },
|
|
210
|
-
// {
|
|
211
|
-
// icon: svg,
|
|
212
|
-
// group: [
|
|
213
|
-
// {
|
|
214
|
-
// icon: svg,
|
|
215
|
-
// title?: 'sadas',
|
|
216
|
-
// click: onclick()
|
|
217
|
-
// },
|
|
218
|
-
// {
|
|
219
|
-
// icon: svg,
|
|
220
|
-
// title?: 'sadas',
|
|
221
|
-
// click: onclick()
|
|
222
|
-
// }
|
|
223
|
-
// ]
|
|
224
|
-
// }
|
|
225
|
-
// ]
|
|
226
|
-
// },
|
|
227
|
-
// {
|
|
228
|
-
// type: "action",
|
|
229
|
-
// data: [
|
|
230
|
-
// [
|
|
231
|
-
// {
|
|
232
|
-
// icon: svg,
|
|
233
|
-
// title?: 'sadas',
|
|
234
|
-
// click: onclick()
|
|
235
|
-
// },
|
|
236
|
-
// {
|
|
237
|
-
// icon: svg,
|
|
238
|
-
// group: [
|
|
239
|
-
// {
|
|
240
|
-
// icon: svg,
|
|
241
|
-
// title?: 'sadas',
|
|
242
|
-
// click: onclick()
|
|
243
|
-
// },
|
|
244
|
-
// {
|
|
245
|
-
// icon: svg,
|
|
246
|
-
// title?: 'sadas',
|
|
247
|
-
// click: onclick()
|
|
248
|
-
// }
|
|
249
|
-
// ]
|
|
250
|
-
// }
|
|
251
|
-
// ],
|
|
252
|
-
// [
|
|
253
|
-
// {
|
|
254
|
-
// icon: svg,
|
|
255
|
-
// title?: 'sadas',
|
|
256
|
-
// click: onclick()
|
|
257
|
-
// },
|
|
258
|
-
// {
|
|
259
|
-
// icon: svg,
|
|
260
|
-
// group: [
|
|
261
|
-
// {
|
|
262
|
-
// icon: svg,
|
|
263
|
-
// title?: 'sadas',
|
|
264
|
-
// click: onclick()
|
|
265
|
-
// },
|
|
266
|
-
// {
|
|
267
|
-
// icon: svg,
|
|
268
|
-
// title?: 'sadas',
|
|
269
|
-
// click: onclick()
|
|
270
|
-
// }
|
|
271
|
-
// ]
|
|
272
|
-
// }
|
|
273
|
-
// ]
|
|
274
|
-
// ]
|
|
275
|
-
// },
|
|
276
|
-
// {
|
|
277
|
-
// type: "accordion",
|
|
278
|
-
// title: 'asdasdsa',
|
|
279
|
-
// openKeys: [
|
|
280
|
-
// 't1',
|
|
281
|
-
// 't2',
|
|
282
|
-
// 't3'
|
|
283
|
-
// ]
|
|
284
|
-
// },
|
|
285
|
-
// {
|
|
286
|
-
// type: "text",
|
|
287
|
-
// accourdionData: [
|
|
288
|
-
// 'asdasd',
|
|
289
|
-
// <Component></Component>,
|
|
290
|
-
// 'asdasd',
|
|
291
|
-
// 'asdasd'
|
|
292
|
-
// ]
|
|
293
|
-
// }
|
|
294
|
-
// ]
|
|
295
|
-
// }
|
|
296
|
-
// ]
|
|
297
|
-
// }
|
|
412
|
+
return <Table
|
|
413
|
+
{...args}
|
|
414
|
+
dataBody={tableDataBody}
|
|
415
|
+
dataHeader={tableDataHeader}
|
|
416
|
+
handleCheckedBody={handleCheckedBody}
|
|
417
|
+
handleCheckedHeader={handleCheckedHeader}
|
|
418
|
+
handleBodyActionClick={handleBodyActionClick}
|
|
419
|
+
handleHeaderItemClick={handleHeaderItemClick}
|
|
420
|
+
/>;
|
|
421
|
+
};
|
|
298
422
|
|
|
423
|
+
export const Default = Template.bind({});
|
|
424
|
+
Default.args = {};
|