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