pixel-react 1.1.5 → 1.1.7
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/.yarn/install-state.gz +0 -0
- package/lib/components/IconButton/IconButton.stories.d.ts +1 -0
- package/lib/components/Input/Input.d.ts +1 -1
- package/lib/components/Input/types.d.ts +4 -0
- package/lib/components/MiniModal/MiniModal.stories.d.ts +1 -1
- package/lib/components/MiniModal/types.d.ts +12 -0
- package/lib/components/TableTree/TableTree.d.ts +4 -2
- package/lib/index.d.ts +9 -3
- package/lib/index.esm.js +118 -22
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +118 -22
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/rollup.config.mjs +5 -1
- package/src/assets/Themes/BaseTheme.scss +8 -1
- package/src/assets/Themes/DarkTheme.scss +7 -0
- package/src/assets/icons/app_switch.svg +11 -0
- package/src/assets/icons/backward_icon.svg +3 -0
- package/src/assets/icons/cloud_server_host_icon.svg +3 -0
- package/src/assets/icons/continue_without_sign.svg +3 -0
- package/src/assets/icons/forward_icon.svg +3 -0
- package/src/assets/icons/hamburger_menu.svg +3 -0
- package/src/assets/icons/plus_user_icon.svg +3 -0
- package/src/assets/icons/reload.svg +3 -0
- package/src/assets/icons/toast_close.svg +2 -2
- package/src/assets/icons/user_profile.svg +3 -0
- package/src/assets/icons/window_maximize.svg +4 -0
- package/src/assets/icons/window_minimize.svg +3 -0
- package/src/components/AppHeader/AppHeader.scss +2 -1
- package/src/components/Chip/Chip.scss +14 -13
- package/src/components/Icon/Icon.stories.tsx +1 -1
- package/src/components/Icon/Icons.scss +1 -1
- package/src/components/Icon/iconList.ts +23 -0
- package/src/components/IconButton/IconButton.scss +23 -12
- package/src/components/IconButton/IconButton.stories.tsx +9 -1
- package/src/components/IconButton/IconButton.tsx +5 -3
- package/src/components/Input/Input.scss +6 -1
- package/src/components/Input/Input.tsx +8 -4
- package/src/components/Input/types.ts +4 -0
- package/src/components/MiniModal/MiniModal.scss +39 -8
- package/src/components/MiniModal/MiniModal.stories.tsx +199 -75
- package/src/components/MiniModal/MiniModal.tsx +46 -2
- package/src/components/MiniModal/types.ts +13 -0
- package/src/components/TableTree/TableTree.stories.tsx +8 -1
- package/src/components/TableTree/TableTree.tsx +25 -3
- package/src/index.ts +0 -6
@@ -27,6 +27,9 @@ const useModal = () => {
|
|
27
27
|
const BasicModalComponent = () => {
|
28
28
|
const btnRef1 = useRef<HTMLButtonElement>(null);
|
29
29
|
const btnRef2 = useRef<HTMLButtonElement>(null);
|
30
|
+
const btnRef3 = useRef<HTMLButtonElement>(null);
|
31
|
+
const btnRef4 = useRef<HTMLButtonElement>(null);
|
32
|
+
const btnRef5 = useRef<HTMLButtonElement>(null);
|
30
33
|
const { currentModal, openModal, closeModal } = useModal();
|
31
34
|
|
32
35
|
const handleCancel = () => {
|
@@ -45,6 +48,7 @@ const BasicModalComponent = () => {
|
|
45
48
|
{currentModal === 1 && (
|
46
49
|
<MiniModal
|
47
50
|
anchorRef={btnRef1}
|
51
|
+
modalProperties={{ width: 300, height: 180 }}
|
48
52
|
headerProps={
|
49
53
|
<>
|
50
54
|
<Typography as="p">Modal 1</Typography>
|
@@ -68,7 +72,9 @@ const BasicModalComponent = () => {
|
|
68
72
|
onClick: () => {},
|
69
73
|
}}
|
70
74
|
isWrapped={false}
|
75
|
+
isPopOver={false}
|
71
76
|
isAnimated={true}
|
77
|
+
modalPosition="left"
|
72
78
|
/>
|
73
79
|
)}
|
74
80
|
|
@@ -82,17 +88,16 @@ const BasicModalComponent = () => {
|
|
82
88
|
{currentModal === 2 && (
|
83
89
|
<MiniModal
|
84
90
|
anchorRef={btnRef2}
|
91
|
+
modalProperties={{ width: 300, height: 180 }}
|
85
92
|
headerProps={
|
86
93
|
<>
|
87
|
-
<Typography as="p"
|
88
|
-
Modal 2
|
89
|
-
</Typography>
|
94
|
+
<Typography as="p">Modal 2</Typography>
|
90
95
|
<hr />
|
91
96
|
</>
|
92
97
|
}
|
93
98
|
childContent={
|
94
99
|
<>
|
95
|
-
<Typography as="p"
|
100
|
+
<Typography as="p">
|
96
101
|
This is some content inside the second modal.
|
97
102
|
</Typography>
|
98
103
|
</>
|
@@ -107,47 +112,31 @@ const BasicModalComponent = () => {
|
|
107
112
|
}}
|
108
113
|
isWrapped={false}
|
109
114
|
isAnimated={false}
|
115
|
+
isPopOver={false}
|
116
|
+
modalPosition="top"
|
110
117
|
/>
|
111
118
|
)}
|
112
|
-
</div>
|
113
|
-
);
|
114
|
-
};
|
115
|
-
export const BasicModal: Story = {
|
116
|
-
render: () => <BasicModalComponent />,
|
117
|
-
};
|
118
|
-
export const CustomModalWithWrapper = () => {
|
119
|
-
const btnRef1 = useRef<HTMLButtonElement>(null);
|
120
|
-
const btnRef2 = useRef<HTMLButtonElement>(null);
|
121
|
-
const btnRef3 = useRef<HTMLButtonElement>(null);
|
122
|
-
const { currentModal, openModal, closeModal } = useModal();
|
123
|
-
|
124
|
-
const handleCancel = () => {
|
125
|
-
closeModal();
|
126
|
-
};
|
127
|
-
|
128
|
-
return (
|
129
|
-
<div className="ff-mini-modal-buttons-flex ff-mini-modal-gap-10">
|
130
119
|
<Button
|
131
|
-
onClick={() => openModal(
|
132
|
-
ref={
|
133
|
-
label="
|
134
|
-
variant={currentModal ===
|
120
|
+
onClick={() => openModal(3)}
|
121
|
+
ref={btnRef3}
|
122
|
+
label="3"
|
123
|
+
variant={currentModal === 3 ? 'primary' : 'secondary'}
|
135
124
|
/>
|
136
125
|
|
137
|
-
{currentModal ===
|
126
|
+
{currentModal === 3 && (
|
138
127
|
<MiniModal
|
139
|
-
anchorRef={
|
140
|
-
modalProperties={{ width:
|
128
|
+
anchorRef={btnRef3}
|
129
|
+
modalProperties={{ width: 300, height: 180 }}
|
141
130
|
headerProps={
|
142
131
|
<>
|
143
|
-
<Typography as="p">
|
132
|
+
<Typography as="p">Modal 3</Typography>
|
144
133
|
<hr />
|
145
134
|
</>
|
146
135
|
}
|
147
136
|
childContent={
|
148
137
|
<>
|
149
138
|
<Typography as="p">
|
150
|
-
This is some content inside the
|
139
|
+
This is some content inside the second modal.
|
151
140
|
</Typography>
|
152
141
|
</>
|
153
142
|
}
|
@@ -156,76 +145,74 @@ export const CustomModalWithWrapper = () => {
|
|
156
145
|
onClick: handleCancel,
|
157
146
|
}}
|
158
147
|
proceedButtonProps={{
|
159
|
-
text: '
|
148
|
+
text: 'Proceed',
|
160
149
|
onClick: () => {},
|
161
150
|
}}
|
162
|
-
isWrapped={
|
163
|
-
isAnimated={
|
164
|
-
|
165
|
-
|
166
|
-
anchorLeftDistanceForWrapper={170}
|
167
|
-
extraTopSpace={{ normalModal: 5 }}
|
151
|
+
isWrapped={false}
|
152
|
+
isAnimated={false}
|
153
|
+
isPopOver={false}
|
154
|
+
modalPosition="top"
|
168
155
|
/>
|
169
156
|
)}
|
170
|
-
|
171
157
|
<Button
|
172
|
-
onClick={() => openModal(
|
173
|
-
ref={
|
174
|
-
label="
|
175
|
-
variant={currentModal ===
|
158
|
+
onClick={() => openModal(4)}
|
159
|
+
ref={btnRef4}
|
160
|
+
label="4"
|
161
|
+
variant={currentModal === 4 ? 'primary' : 'secondary'}
|
176
162
|
/>
|
177
163
|
|
178
|
-
{currentModal ===
|
164
|
+
{currentModal === 4 && (
|
179
165
|
<MiniModal
|
180
|
-
anchorRef={
|
181
|
-
modalProperties={{ width:
|
166
|
+
anchorRef={btnRef4}
|
167
|
+
modalProperties={{ width: 300, height: 180 }}
|
182
168
|
headerProps={
|
183
169
|
<>
|
184
|
-
<Typography as="p">
|
170
|
+
<Typography as="p">Modal 4</Typography>
|
185
171
|
<hr />
|
186
172
|
</>
|
187
173
|
}
|
188
174
|
childContent={
|
189
|
-
|
175
|
+
<>
|
176
|
+
<Typography as="p">
|
177
|
+
This is some content inside the second modal.
|
178
|
+
</Typography>
|
179
|
+
</>
|
190
180
|
}
|
191
181
|
cancelButtonProps={{
|
192
182
|
text: 'Cancel',
|
193
183
|
onClick: handleCancel,
|
194
184
|
}}
|
195
185
|
proceedButtonProps={{
|
196
|
-
text: '
|
186
|
+
text: 'Proceed',
|
197
187
|
onClick: () => {},
|
198
188
|
}}
|
199
|
-
isWrapped={
|
189
|
+
isWrapped={false}
|
200
190
|
isAnimated={false}
|
201
|
-
|
202
|
-
|
203
|
-
anchorLeftDistanceForWrapper={170}
|
204
|
-
extraTopSpace={{ normalModal: 5 }}
|
191
|
+
isPopOver={false}
|
192
|
+
modalPosition="bottom"
|
205
193
|
/>
|
206
194
|
)}
|
207
|
-
|
208
195
|
<Button
|
209
|
-
onClick={() => openModal(
|
210
|
-
ref={
|
211
|
-
label="
|
212
|
-
variant={currentModal ===
|
196
|
+
onClick={() => openModal(5)}
|
197
|
+
ref={btnRef5}
|
198
|
+
label="5"
|
199
|
+
variant={currentModal === 5 ? 'primary' : 'secondary'}
|
213
200
|
/>
|
214
201
|
|
215
|
-
{currentModal ===
|
202
|
+
{currentModal === 5 && (
|
216
203
|
<MiniModal
|
217
|
-
anchorRef={
|
218
|
-
modalProperties={{ width:
|
204
|
+
anchorRef={btnRef5}
|
205
|
+
modalProperties={{ width: 300, height: 180 }}
|
219
206
|
headerProps={
|
220
207
|
<>
|
221
|
-
<Typography as="p">
|
208
|
+
<Typography as="p">Modal 5</Typography>
|
222
209
|
<hr />
|
223
210
|
</>
|
224
211
|
}
|
225
212
|
childContent={
|
226
213
|
<>
|
227
214
|
<Typography as="p">
|
228
|
-
This is some content inside the
|
215
|
+
This is some content inside the second modal.
|
229
216
|
</Typography>
|
230
217
|
</>
|
231
218
|
}
|
@@ -234,20 +221,22 @@ export const CustomModalWithWrapper = () => {
|
|
234
221
|
onClick: handleCancel,
|
235
222
|
}}
|
236
223
|
proceedButtonProps={{
|
237
|
-
text: '
|
224
|
+
text: 'Proceed',
|
238
225
|
onClick: () => {},
|
239
226
|
}}
|
240
|
-
isWrapped={
|
241
|
-
isAnimated={
|
242
|
-
|
243
|
-
|
244
|
-
anchorLeftDistanceForWrapper={170}
|
245
|
-
extraTopSpace={{ normalModal: 5 }}
|
227
|
+
isWrapped={false}
|
228
|
+
isAnimated={false}
|
229
|
+
isPopOver={false}
|
230
|
+
modalPosition="right"
|
246
231
|
/>
|
247
232
|
)}
|
248
233
|
</div>
|
249
234
|
);
|
250
235
|
};
|
236
|
+
export const BasicModal: Story = {
|
237
|
+
render: () => <BasicModalComponent />,
|
238
|
+
};
|
239
|
+
|
251
240
|
export const CustomModalWithArrow = () => {
|
252
241
|
const btnRef1 = useRef<HTMLButtonElement>(null);
|
253
242
|
const btnRef2 = useRef<HTMLButtonElement>(null);
|
@@ -272,7 +261,7 @@ export const CustomModalWithArrow = () => {
|
|
272
261
|
{currentModal === 1 && (
|
273
262
|
<MiniModal
|
274
263
|
anchorRef={btnRef1}
|
275
|
-
modalProperties={{ width:
|
264
|
+
modalProperties={{ width: 300, height: 250 }}
|
276
265
|
headerProps={
|
277
266
|
<>
|
278
267
|
<Typography as="p">Modal 1</Typography>
|
@@ -315,7 +304,7 @@ export const CustomModalWithArrow = () => {
|
|
315
304
|
|
316
305
|
{currentModal === 2 && (
|
317
306
|
<MiniModal
|
318
|
-
modalProperties={{ width:
|
307
|
+
modalProperties={{ width: 300, height: 350 }}
|
319
308
|
anchorRef={btnRef2}
|
320
309
|
headerProps={
|
321
310
|
<>
|
@@ -343,6 +332,7 @@ export const CustomModalWithArrow = () => {
|
|
343
332
|
isAnimated={false}
|
344
333
|
isPopOver={true}
|
345
334
|
modalPosition="right"
|
335
|
+
leftTopArrow={false}
|
346
336
|
extraRightSpace={{ middleLeftArrow: 4 }}
|
347
337
|
extraLeftSpace={{ rightAlignModal: 40 }}
|
348
338
|
/>
|
@@ -357,6 +347,7 @@ export const CustomModalWithArrow = () => {
|
|
357
347
|
{currentModal === 3 && (
|
358
348
|
<MiniModal
|
359
349
|
anchorRef={btnRef3}
|
350
|
+
modalProperties={{ width: 300, height: 250 }}
|
360
351
|
headerProps={
|
361
352
|
<>
|
362
353
|
<Typography as="p">Modal 3</Typography>
|
@@ -396,7 +387,7 @@ export const CustomModalWithArrow = () => {
|
|
396
387
|
{currentModal === 4 && (
|
397
388
|
<MiniModal
|
398
389
|
anchorRef={btnRef4}
|
399
|
-
modalProperties={{ height:
|
390
|
+
modalProperties={{ width: 300, height: 200 }}
|
400
391
|
headerProps={
|
401
392
|
<>
|
402
393
|
<Typography as="p">Modal 4</Typography>
|
@@ -437,7 +428,7 @@ export const CustomModalWithArrow = () => {
|
|
437
428
|
{currentModal === 5 && (
|
438
429
|
<MiniModal
|
439
430
|
anchorRef={btnRef5}
|
440
|
-
modalProperties={{ height: 148, width:
|
431
|
+
modalProperties={{ height: 148, width: 304 }}
|
441
432
|
headerProps={
|
442
433
|
<>
|
443
434
|
<Typography as="p">Modal 5</Typography>
|
@@ -471,5 +462,138 @@ export const CustomModalWithArrow = () => {
|
|
471
462
|
</div>
|
472
463
|
);
|
473
464
|
};
|
465
|
+
export const CustomModalWithWrapper = () => {
|
466
|
+
const btnRef1 = useRef<HTMLButtonElement>(null);
|
467
|
+
const btnRef2 = useRef<HTMLButtonElement>(null);
|
468
|
+
const btnRef3 = useRef<HTMLButtonElement>(null);
|
469
|
+
const { currentModal, openModal, closeModal } = useModal();
|
470
|
+
|
471
|
+
const handleCancel = () => {
|
472
|
+
closeModal();
|
473
|
+
};
|
474
|
+
|
475
|
+
return (
|
476
|
+
<div className="ff-mini-modal-buttons-flex ff-mini-modal-gap-10">
|
477
|
+
<Button
|
478
|
+
onClick={() => openModal(1)}
|
479
|
+
ref={btnRef1}
|
480
|
+
label="1"
|
481
|
+
variant={currentModal === 1 ? 'primary' : 'secondary'}
|
482
|
+
/>
|
483
|
+
|
484
|
+
{currentModal === 1 && (
|
485
|
+
<MiniModal
|
486
|
+
anchorRef={btnRef1}
|
487
|
+
modalProperties={{ width: 487, height: 180 }}
|
488
|
+
headerProps={
|
489
|
+
<>
|
490
|
+
<Typography as="p">Update Label For Scripts</Typography>
|
491
|
+
<hr />
|
492
|
+
</>
|
493
|
+
}
|
494
|
+
childContent={
|
495
|
+
<>
|
496
|
+
<Typography as="p">
|
497
|
+
This is some content inside the first modal.
|
498
|
+
</Typography>
|
499
|
+
</>
|
500
|
+
}
|
501
|
+
cancelButtonProps={{
|
502
|
+
text: 'Cancel',
|
503
|
+
onClick: handleCancel,
|
504
|
+
}}
|
505
|
+
proceedButtonProps={{
|
506
|
+
text: 'Update',
|
507
|
+
onClick: () => {},
|
508
|
+
}}
|
509
|
+
isWrapped={true}
|
510
|
+
isAnimated={true}
|
511
|
+
firstAnchorRef={btnRef1}
|
512
|
+
anchorRefLeftNum={164}
|
513
|
+
anchorLeftDistanceForWrapper={170}
|
514
|
+
extraTopSpace={{ normalModal: 5 }}
|
515
|
+
/>
|
516
|
+
)}
|
517
|
+
|
518
|
+
<Button
|
519
|
+
onClick={() => openModal(2)}
|
520
|
+
ref={btnRef2}
|
521
|
+
label="2"
|
522
|
+
variant={currentModal === 2 ? 'primary' : 'secondary'}
|
523
|
+
/>
|
524
|
+
|
525
|
+
{currentModal === 2 && (
|
526
|
+
<MiniModal
|
527
|
+
anchorRef={btnRef2}
|
528
|
+
modalProperties={{ width: 358, height: 135 }}
|
529
|
+
headerProps={
|
530
|
+
<>
|
531
|
+
<Typography as="p">Export Selected scripts</Typography>
|
532
|
+
<hr />
|
533
|
+
</>
|
534
|
+
}
|
535
|
+
childContent={
|
536
|
+
<Typography as="p">Child content modify here</Typography>
|
537
|
+
}
|
538
|
+
cancelButtonProps={{
|
539
|
+
text: 'Cancel',
|
540
|
+
onClick: handleCancel,
|
541
|
+
}}
|
542
|
+
proceedButtonProps={{
|
543
|
+
text: 'Export',
|
544
|
+
onClick: () => {},
|
545
|
+
}}
|
546
|
+
isWrapped={true}
|
547
|
+
isAnimated={false}
|
548
|
+
firstAnchorRef={btnRef1}
|
549
|
+
anchorRefLeftNum={193}
|
550
|
+
anchorLeftDistanceForWrapper={170}
|
551
|
+
extraTopSpace={{ normalModal: 5 }}
|
552
|
+
/>
|
553
|
+
)}
|
554
|
+
|
555
|
+
<Button
|
556
|
+
onClick={() => openModal(3)}
|
557
|
+
ref={btnRef3}
|
558
|
+
label="3"
|
559
|
+
variant={currentModal === 3 ? 'primary' : 'secondary'}
|
560
|
+
/>
|
561
|
+
|
562
|
+
{currentModal === 3 && (
|
563
|
+
<MiniModal
|
564
|
+
anchorRef={btnRef3}
|
565
|
+
modalProperties={{ width: 487, height: 210 }}
|
566
|
+
headerProps={
|
567
|
+
<>
|
568
|
+
<Typography as="p">Delete Selected Scripts</Typography>
|
569
|
+
<hr />
|
570
|
+
</>
|
571
|
+
}
|
572
|
+
childContent={
|
573
|
+
<>
|
574
|
+
<Typography as="p">
|
575
|
+
This is some content inside the third modal.
|
576
|
+
</Typography>
|
577
|
+
</>
|
578
|
+
}
|
579
|
+
cancelButtonProps={{
|
580
|
+
text: 'Cancel',
|
581
|
+
onClick: handleCancel,
|
582
|
+
}}
|
583
|
+
proceedButtonProps={{
|
584
|
+
text: 'Delete',
|
585
|
+
onClick: () => {},
|
586
|
+
}}
|
587
|
+
isWrapped={true}
|
588
|
+
isAnimated={true}
|
589
|
+
firstAnchorRef={btnRef1}
|
590
|
+
anchorRefLeftNum={225}
|
591
|
+
anchorLeftDistanceForWrapper={170}
|
592
|
+
extraTopSpace={{ normalModal: 5 }}
|
593
|
+
/>
|
594
|
+
)}
|
595
|
+
</div>
|
596
|
+
);
|
597
|
+
};
|
474
598
|
|
475
599
|
export default meta;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { useEffect, useRef, useState, useCallback, forwardRef } from 'react';
|
2
2
|
import { createPortal } from 'react-dom';
|
3
|
-
import { MiniEditModalProps } from './types.js';
|
3
|
+
import { MiniEditModalProps, Rect, AvailableSpace } from './types.js';
|
4
4
|
import Button from '../Button/Button.js';
|
5
5
|
import useEscapeKey from '../../hooks/keyboardevents/useEscKeyEvent.js';
|
6
6
|
import useClickOutside from '../../hooks/useClickOutside';
|
@@ -38,6 +38,47 @@ const MiniModal = forwardRef<HTMLDivElement, MiniEditModalProps>(
|
|
38
38
|
});
|
39
39
|
const [isVisible, setIsVisible] = useState(false);
|
40
40
|
const modalRef = useRef<HTMLDivElement>(null);
|
41
|
+
// Function to calculate available space
|
42
|
+
const getAvailableSpace = (rect: Rect): AvailableSpace => {
|
43
|
+
const { top, left, bottom, right } = rect;
|
44
|
+
const viewportWidth = window.innerWidth;
|
45
|
+
const viewportHeight = window.innerHeight;
|
46
|
+
|
47
|
+
return {
|
48
|
+
spaceTop: top,
|
49
|
+
spaceLeft: left,
|
50
|
+
spaceRight: viewportWidth - right,
|
51
|
+
spaceBottom: viewportHeight - bottom,
|
52
|
+
};
|
53
|
+
};
|
54
|
+
const anchorRect = anchorRef.current?.getBoundingClientRect();
|
55
|
+
if (!isWrapped && anchorRect) {
|
56
|
+
const availableSpace = getAvailableSpace(anchorRect);
|
57
|
+
switch (modalPosition) {
|
58
|
+
case 'top':
|
59
|
+
if (availableSpace.spaceTop < (modalProperties?.height ?? 150)) {
|
60
|
+
modalPosition = 'bottom';
|
61
|
+
}
|
62
|
+
break;
|
63
|
+
case 'left':
|
64
|
+
if (availableSpace.spaceLeft < (modalProperties?.width ?? 480)) {
|
65
|
+
modalPosition = 'right';
|
66
|
+
}
|
67
|
+
break;
|
68
|
+
case 'right':
|
69
|
+
if (availableSpace.spaceRight < (modalProperties?.width ?? 480)) {
|
70
|
+
modalPosition = 'left';
|
71
|
+
}
|
72
|
+
break;
|
73
|
+
case 'bottom':
|
74
|
+
if (availableSpace.spaceBottom < (modalProperties?.height ?? 150)) {
|
75
|
+
modalPosition = 'top';
|
76
|
+
}
|
77
|
+
break;
|
78
|
+
default:
|
79
|
+
break;
|
80
|
+
}
|
81
|
+
}
|
41
82
|
|
42
83
|
//specify for the wrapper div left position
|
43
84
|
const calculateAnchorRefLeft = (anchorRefLeftNum?: number) => {
|
@@ -174,7 +215,10 @@ const MiniModal = forwardRef<HTMLDivElement, MiniEditModalProps>(
|
|
174
215
|
></div>
|
175
216
|
)}
|
176
217
|
<div
|
177
|
-
className=
|
218
|
+
className={classNames('mini-edit-modal', {
|
219
|
+
'mini-edit-modal-wrapper-shadow': !!isWrapped,
|
220
|
+
'mini-edit-modal-arrow-shadow': !!isPopOver,
|
221
|
+
})}
|
178
222
|
style={{
|
179
223
|
minWidth: isWrapped ? '358px' : '',
|
180
224
|
width: `${modalProperties?.width}px`,
|
@@ -86,3 +86,16 @@ export interface MiniEditModalProps {
|
|
86
86
|
rightAlignModal?: number;
|
87
87
|
};
|
88
88
|
}
|
89
|
+
export interface Rect {
|
90
|
+
top: number;
|
91
|
+
left: number;
|
92
|
+
bottom: number;
|
93
|
+
right: number;
|
94
|
+
}
|
95
|
+
|
96
|
+
export interface AvailableSpace {
|
97
|
+
spaceTop: number;
|
98
|
+
spaceLeft: number;
|
99
|
+
spaceRight: number;
|
100
|
+
spaceBottom: number;
|
101
|
+
}
|
@@ -67,7 +67,14 @@ const createTilteAndAction = (row: any): JSX.Element => {
|
|
67
67
|
|
68
68
|
export const Default: Story = {
|
69
69
|
args: {
|
70
|
-
|
70
|
+
select: 'radio',
|
71
|
+
onChange: (e: any, node: any) => {
|
72
|
+
e.preventDefault();
|
73
|
+
e.stopPropagation();
|
74
|
+
|
75
|
+
console.log(node, '------------', e);
|
76
|
+
},
|
77
|
+
selected: ['MOD1003'],
|
71
78
|
treeData,
|
72
79
|
columnsData: [
|
73
80
|
{
|
@@ -7,6 +7,7 @@ import { checkEmpty } from '../../utils/checkEmpty/checkEmpty';
|
|
7
7
|
|
8
8
|
import Checkbox from '../Checkbox';
|
9
9
|
import './TableTree.scss';
|
10
|
+
import RadioButton from '../RadioButton';
|
10
11
|
|
11
12
|
interface ColumnDataProps {
|
12
13
|
name: string;
|
@@ -22,20 +23,24 @@ interface ObjectProps {
|
|
22
23
|
}
|
23
24
|
|
24
25
|
interface TableTreeProps {
|
25
|
-
|
26
|
+
select: 'checkbox' | 'radio' | 'none';
|
26
27
|
columnsData: Array<ColumnDataProps>;
|
27
28
|
treeData: Array<ObjectProps>;
|
28
29
|
onClick?: (
|
29
30
|
event: React.MouseEvent<HTMLDivElement, MouseEvent>,
|
30
31
|
data: any
|
31
32
|
) => void;
|
33
|
+
onChange?: (e: any, node: any) => void;
|
34
|
+
selected: Array<string>;
|
32
35
|
}
|
33
36
|
|
34
37
|
const TableTree = ({
|
35
38
|
columnsData,
|
36
39
|
treeData,
|
37
|
-
|
40
|
+
select,
|
38
41
|
onClick = () => {},
|
42
|
+
onChange,
|
43
|
+
selected,
|
39
44
|
}: TableTreeProps) => {
|
40
45
|
const [expandedNodes, setExpandedNodes] = useState<Set<ObjectProps>>(
|
41
46
|
new Set()
|
@@ -89,6 +94,12 @@ const TableTree = ({
|
|
89
94
|
|
90
95
|
const isExpanded = expandedNodes.has(node);
|
91
96
|
|
97
|
+
const handleCheckBoxChange = (e, node) => {
|
98
|
+
if (onChange) {
|
99
|
+
onChange(e, node);
|
100
|
+
}
|
101
|
+
};
|
102
|
+
|
92
103
|
useLayoutEffect(() => {
|
93
104
|
if (nodeRef.current) {
|
94
105
|
const observer = new ResizeObserver(() => {
|
@@ -143,7 +154,18 @@ const TableTree = ({
|
|
143
154
|
style={{ fontWeight: node.folder ? 600 : 400 }}
|
144
155
|
onClick={(event) => onClick(event, node)}
|
145
156
|
>
|
146
|
-
{
|
157
|
+
{select === 'checkbox' && (
|
158
|
+
<Checkbox
|
159
|
+
checked={selected.includes(node.key)}
|
160
|
+
onChange={(e) => handleCheckBoxChange(e, node)}
|
161
|
+
/>
|
162
|
+
)}
|
163
|
+
{select === 'radio' && (
|
164
|
+
<RadioButton
|
165
|
+
checked={selected.includes(node.key)}
|
166
|
+
onChange={(e) => handleCheckBoxChange(e, node)}
|
167
|
+
/>
|
168
|
+
)}
|
147
169
|
{prepareData(node, column)}
|
148
170
|
</div>
|
149
171
|
</td>
|
package/src/index.ts
CHANGED
@@ -55,19 +55,13 @@ import {
|
|
55
55
|
getExtension,
|
56
56
|
getExtensionWithPeriod,
|
57
57
|
} from './utils/getExtension/getExtension';
|
58
|
-
|
59
58
|
import { findAndInsert } from './utils/findAndInsert/findAndInsert';
|
60
59
|
import { ffid } from './utils/ffID/ffid';
|
61
|
-
|
62
60
|
import { debounce } from './utils/debounce/debounce';
|
63
61
|
import { compareArrays } from './utils/compareArrays/compareArrays';
|
64
|
-
|
65
62
|
import { compareObjects } from './utils/compareObjects/compareObjects';
|
66
|
-
|
67
63
|
import { getEncryptedData } from './utils/getEncryptedData/getEncryptedData';
|
68
|
-
|
69
64
|
import { throttle } from './utils/throttle/throttle';
|
70
|
-
|
71
65
|
import { truncateText } from './utils/truncateText/truncateText';
|
72
66
|
|
73
67
|
export {
|