forked from shesha-io/shesha-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstyles.ts
More file actions
858 lines (767 loc) · 29.9 KB
/
styles.ts
File metadata and controls
858 lines (767 loc) · 29.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
import { createStyles, SerializedStyles } from 'antd-style';
import { IBorderValue } from '@/designer-components/_settings/utils/border/interfaces';
import { IShadowValue } from '@/designer-components/_settings/utils/shadow/interfaces';
import { getBorderStyle } from '@/designer-components/_settings/utils/border/utils';
import { getShadowStyle } from '@/designer-components/_settings/utils/shadow/utils';
import { IDimensionsValue } from '@/designer-components/_settings/utils/index';
const tableClassNames = {
shaTable: 'sha-table',
thead: 'thead',
tbody: 'tbody',
tr: 'tr',
th: 'th',
td: 'td',
trHead: 'tr-head',
trBody: 'tr-body',
shaCrudCell: 'sha-crud-cell',
shaNewRow: 'sha-new-row',
trBodyGhost: 'tr-body-ghost',
trOdd: 'tr-odd',
sortedAsc: 'sorted-asc',
sortedDesc: 'sorted-desc',
fixedColumn: 'fixed-column',
relativeColumn: 'relative-column',
boxShadowLeft: 'box-shadow-left',
boxShadowRight: 'box-shadow-right',
trSelected: 'sha-tr-selected',
shaTableEmpty: 'sha-table-empty',
shaSortable: 'sha-sortable',
shaDragging: 'sha-dragging',
shaTooltipIcon: 'sha-tooltip-icon',
shaCellParent: 'sha-cell-parent',
shaCellParentFW: 'sha-cell-parent-fw', // Full width cell parent, used for cells that should take full width of the row,
shaSpanCenterVertically: 'sha-span-center-vertically',
};
const tableStyles = {
styles: tableClassNames,
};
export const useStyles = (): typeof tableStyles => {
return tableStyles;
};
export const useMainStyles = createStyles(({ css, cx, token, prefixCls, iconPrefixCls }, {
rowBackgroundColor,
rowAlternateBackgroundColor,
rowHoverBackgroundColor,
rowSelectedBackgroundColor,
border,
dimensions,
backgroundColor,
headerFontFamily,
headerFontSize,
headerFontWeight,
headerBackgroundColor,
headerTextColor,
headerTextAlign,
bodyTextAlign,
rowHeight,
rowPadding,
rowBorder,
rowBorderStyle,
boxShadow,
sortableIndicatorColor,
striped: _striped,
cellBorderColor,
cellBorders,
headerBorder,
cellBorder,
headerShadow,
rowShadow,
rowDividers,
bodyFontFamily,
bodyFontSize,
bodyFontWeight,
bodyFontColor,
freezeHeaders,
actionIconSize,
actionIconColor,
}: {
rowBackgroundColor?: string;
rowAlternateBackgroundColor?: string;
rowHoverBackgroundColor?: string;
rowSelectedBackgroundColor?: string;
border?: IBorderValue;
backgroundColor?: string;
headerFontFamily?: string;
headerFontSize?: string;
headerFontWeight?: string;
headerBackgroundColor?: string;
headerTextColor?: string;
headerTextAlign?: string;
bodyTextAlign?: string;
rowHeight?: string;
rowPadding?: string;
rowBorder?: string;
rowBorderStyle?: IBorderValue;
boxShadow?: string;
dimensions?: IDimensionsValue;
sortableIndicatorColor?: string;
striped?: boolean;
cellBorderColor?: string;
cellBorders?: boolean;
cellPadding?: string;
headerBorder?: IBorderValue;
cellBorder?: IBorderValue;
headerShadow?: IShadowValue;
rowShadow?: IShadowValue;
rowDividers?: boolean;
bodyFontFamily?: string;
bodyFontSize?: string;
bodyFontWeight?: number & {} | string;
bodyFontColor?: string;
freezeHeaders?: boolean;
actionIconSize?: string | number;
actionIconColor?: string;
}) => {
const {
shaTable,
thead,
tbody,
tr,
th,
td,
trHead,
trBody,
shaCrudCell,
shaNewRow,
trBodyGhost,
trOdd,
sortedAsc,
fixedColumn,
relativeColumn,
boxShadowRight,
boxShadowLeft,
sortedDesc,
trSelected,
shaTableEmpty,
shaSortable,
shaDragging,
shaTooltipIcon,
shaCellParent,
shaCellParentFW,
shaSpanCenterVertically,
} = tableClassNames;
const borderStyles = getBorderStyle(border || {}, {});
const headerBorderStyles = getBorderStyle(headerBorder || {}, {});
const cellBorderStyles = getBorderStyle(cellBorder || {}, {});
const headerShadowStyles = getShadowStyle(headerShadow);
const rowShadowStyles = getShadowStyle(rowShadow);
const effectivePadding = rowPadding;
const hasBorderRadius = border?.radius && (
(border.radius.all && parseFloat(String(border.radius.all)) !== 0) ||
(border.radius.topLeft && parseFloat(String(border.radius.topLeft)) !== 0) ||
(border.radius.topRight && parseFloat(String(border.radius.topRight)) !== 0) ||
(border.radius.bottomLeft && parseFloat(String(border.radius.bottomLeft)) !== 0) ||
(border.radius.bottomRight && parseFloat(String(border.radius.bottomRight)) !== 0)
);
// var(--ant-primary-3)
const hoverableRow = rowHoverBackgroundColor !== undefined ? `
&:not(.${trSelected}) {
background: ${rowHoverBackgroundColor || token.colorPrimaryBgHover} !important;
}
` : '';
const groupBorder = '1px solid lightgray';
const nestedPaddings = (indexStart: number, index: number): SerializedStyles | null => {
return indexStart < index
? css`
&.sha-group-level-${indexStart} {
> .${prefixCls}-collapse-item {
> .${prefixCls}-collapse-header {
margin-left: ${indexStart * 15}px;
border-bottom: ${groupBorder};
border-radius: unset;
${indexStart > 0 ? `border-left: ${groupBorder};` : ''}
${indexStart === 0 ? `border-top: ${groupBorder};` : ''}
}
}
}
${nestedPaddings(indexStart + 1, index)}
`
: null;
};
// .sha-react-table
const shaReactTable = cx(
'sha-react-table',
css`
/*
* Use max-content to expand with table columns, while allowing horizontal scroll
* when content exceeds parent container width (via overflow-x on parent)
*/
display: inline-block;
width: calc(100% - 16px);
/* These styles are required for a horizontaly scrollable table overflow */
/* IMPORTANT: freezeHeaders requires overflow: auto for position: sticky to work */
overflow-y: ${freezeHeaders ? 'auto' : (boxShadow ? 'visible' : 'auto')};
${boxShadow && !freezeHeaders ? `
/* Apply box shadow to container */
box-shadow: ${boxShadow};
/* Add margin to create space for shadow without affecting table width */
margin: 8px;
/* Remove margin from parent to compensate */
position: relative;
` : ''}
${boxShadow && freezeHeaders ? `
/* When both boxShadow and freezeHeaders are enabled, apply shadow differently */
/* to avoid breaking sticky positioning */
box-shadow: ${boxShadow};
margin: 8px;
position: relative;
` : ''}
${dimensions?.height ? `height: ${dimensions.height};` : ''}
${dimensions?.minHeight ? `min-height: ${dimensions.minHeight};` : ''}
${dimensions?.maxHeight ? `max-height: ${dimensions.maxHeight};` : ''}
.${shaSpanCenterVertically} {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
.anticon svg{
margin-top: 3px !important;
}
.${shaTable} {
border-spacing: 0;
display: inline-block;
min-width: 100%;
box-sizing: border-box;
/* Background applied to table ensures it covers all rows when scrolling with freezeHeaders */
${backgroundColor ? `background: ${backgroundColor};` : 'background: white;'}
/* Apply border styles to the inner table */
${Object.entries(borderStyles).map(([key, value]) => {
// Convert camelCase CSS properties to kebab-case
const cssKey = key.replace(/([A-Z])/g, '-$1').toLowerCase();
return `${cssKey}: ${value};`;
}).join('\n')}
/* When border-radius is present, clip content but not shadows */
/* Only apply to tables without fixed columns since overflow affects position:sticky */
&:not(:has(.${fixedColumn})) {
${hasBorderRadius ? `
border-radius: inherit;
> .${thead}, > .${tbody} {
overflow: hidden;
}
` : ''}
}
.${thead} {
/* These styles are required for a scrollable body to align with the header properly */
overflow-y: auto;
overflow-x: hidden;
}
.${tbody} {
overflow-x: hidden;
background: transparent;
> .${shaSortable}:not(.${shaDragging}) {
.${tr}.${trBody}:hover {
${hoverableRow}
}
}
> .${tr}.${trBody}:hover {
${hoverableRow}
}
.${shaTableEmpty} {
display: flex;
height: 250px;
justify-content: center;
align-items: center;
}
.${prefixCls}-collapse {
border: none;
.${prefixCls}-collapse-item {
border: none;
.${prefixCls}-collapse-header {
padding-top: unset !important;
padding-bottom: unset !important;
font-weight: normal;
font-size: 14px;
min-height: 30px;
display: flex !important;
align-items: center !important;
}
.${prefixCls}-collapse-content {
.${prefixCls}-collapse-content-box {
padding: unset;
div.tr.tr-body:last-child {
border-bottom: ${groupBorder};
}
}
}
}
${nestedPaddings(0, 9)}
}
}
.${tr} {
&.${trHead} {
box-shadow: 0 2px 15px 0 rgb(0 0 0 / 15%);
${headerBackgroundColor ? `background-color: ${headerBackgroundColor} !important;` : `background-color: ${backgroundColor} !important;`}
${headerFontFamily ? `font-family: ${headerFontFamily};` : ''}
${headerFontSize ? `font-size: ${headerFontSize};` : ''}
${headerFontWeight ? `font-weight: ${headerFontWeight} !important;` : ''}
${headerTextColor ? `color: ${headerTextColor};` : 'color: #000000ff !important;'}
${Object.entries(headerBorderStyles).map(([key, value]) => `${key.replace(/([A-Z])/g, '-$1').toLowerCase()}: ${value};`).join(' ')}
${Object.entries(headerShadowStyles || {}).map(([key, value]) => `${key.replace(/([A-Z])/g, '-$1').toLowerCase()}: ${value};`).join(' ')}
/* Apply text alignment to header cells */
.${th} {
${headerTextAlign ? `text-align: ${headerTextAlign} !important;` : ''}
/* Map headerTextAlign to justify-content for flex containers */
${headerTextAlign === 'left' ? 'justify-content: flex-start !important;' : ''}
${headerTextAlign === 'right' ? 'justify-content: flex-end !important;' : ''}
${headerTextAlign === 'center' ? 'justify-content: center !important;' : ''}
${headerTextAlign === 'justify' ? 'justify-content: space-between !important;' : ''}
}
/* Apply header background to relative columns within headers */
.${relativeColumn} {
${headerBackgroundColor ? `background-color: ${headerBackgroundColor} !important;` : `background-color: ${backgroundColor} !important;`}
}
}
&.${trBody} {
${rowHeight ? `height: ${rowHeight};` : 'height: auto;'}
/* Row must be positioned and use flex for separators to work */
position: relative;
display: flex;
align-items: stretch;
${(() => {
// Prefer rowBorderStyle over rowBorder for full border control
if (rowBorderStyle) {
const borderStyles = getBorderStyle(rowBorderStyle, {});
return Object.entries(borderStyles)
.map(([key, value]) => `${key.replace(/([A-Z])/g, '-$1').toLowerCase()}: ${value};`)
.join(' ');
}
return rowBorder ? `border: ${rowBorder};` : '';
})()}
${rowBackgroundColor ? `background: ${rowBackgroundColor} !important;` : 'background: transparent !important;'}
${Object.entries(rowShadowStyles || {}).map(([key, value]) => `${key.replace(/([A-Z])/g, '-$1').toLowerCase()}: ${value};`).join(' ')}
${rowDividers ? `border-bottom: 1px solid ${token.colorBorderSecondary};` : 'border-bottom: none;'}
/* Apply text alignment and font styles to body cells */
.${td} {
${bodyTextAlign ? `text-align: ${bodyTextAlign} !important;` : ''}
${bodyFontFamily ? `font-family: ${bodyFontFamily} !important;` : ''}
${bodyFontSize ? `font-size: ${bodyFontSize};` : ''}
${bodyFontWeight ? `font-weight: ${bodyFontWeight};` : ''}
${bodyFontColor ? `color: ${bodyFontColor};` : ''}
}
/* Apply body font styles to custom component wrappers */
.sha-data-cell,
.sha-form-cell {
${bodyFontFamily ? `font-family: ${bodyFontFamily} !important;` : ''}
${bodyFontSize ? `font-size: ${bodyFontSize} !important;` : ''}
${bodyFontWeight ? `font-weight: ${bodyFontWeight} !important;` : ''}
${bodyFontColor ? `color: ${bodyFontColor} !important;` : ''}
${bodyTextAlign ? `text-align: ${bodyTextAlign} !important;` : ''}
}
/* Apply body font styles to form component content */
.sha-form-cell .ant-form-item-control-input-content {
${bodyFontFamily ? `font-family: ${bodyFontFamily} !important;` : ''}
${bodyFontSize ? `font-size: ${bodyFontSize} !important;` : ''}
${bodyFontWeight ? `font-weight: ${bodyFontWeight} !important;` : ''}
${bodyFontColor ? `color: ${bodyFontColor} !important;` : ''}
${bodyTextAlign ? `text-align: ${bodyTextAlign} !important;` : ''}
}
/* Override Ant Design component defaults with table body font styles */
.ant-select-selection-item,
.ant-select-selection-placeholder,
.ant-input,
.ant-input-number-input,
.ant-picker-input > input,
.sha-data-cell input,
.sha-data-cell .ant-select-selection-search-input {
${bodyFontFamily ? `font-family: ${bodyFontFamily} !important;` : ''}
${bodyFontSize ? `font-size: ${bodyFontSize} !important;` : ''}
${bodyFontWeight ? `font-weight: ${bodyFontWeight} !important;` : ''}
${bodyFontColor ? `color: ${bodyFontColor} !important;` : ''}
${bodyTextAlign ? `text-align: ${bodyTextAlign} !important;` : ''}
}
/* Apply to autocomplete and entity reference components */
.sha-autocomplete-raw-value,
.sha-entity-reference-display-name {
${bodyFontFamily ? `font-family: ${bodyFontFamily} !important;` : ''}
${bodyFontSize ? `font-size: ${bodyFontSize} !important;` : ''}
${bodyFontWeight ? `font-weight: ${bodyFontWeight} !important;` : ''}
${bodyFontColor ? `color: ${bodyFontColor} !important;` : ''}
${bodyTextAlign ? `text-align: ${bodyTextAlign} !important;` : ''}
}
/* Apply to readonly display components */
.read-only-display-form-item,
.read-only-display-form-item div {
${bodyFontFamily ? `font-family: ${bodyFontFamily} !important;` : ''}
${bodyFontSize ? `font-size: ${bodyFontSize} !important;` : ''}
${bodyFontWeight ? `font-weight: ${bodyFontWeight} !important;` : ''}
${bodyFontColor ? `color: ${bodyFontColor} !important;` : ''}
${bodyTextAlign ? `text-align: ${bodyTextAlign} !important;` : ''}
}
/* Apply to text field components */
.sha-input {
${bodyFontFamily ? `font-family: ${bodyFontFamily} !important;` : ''}
${bodyFontSize ? `font-size: ${bodyFontSize} !important;` : ''}
${bodyFontWeight ? `font-weight: ${bodyFontWeight} !important;` : ''}
${bodyFontColor ? `color: ${bodyFontColor} !important;` : ''}
${bodyTextAlign ? `text-align: ${bodyTextAlign} !important;` : ''}
input {
${bodyFontFamily ? `font-family: ${bodyFontFamily} !important;` : ''}
${bodyFontSize ? `font-size: ${bodyFontSize} !important;` : ''}
${bodyFontWeight ? `font-weight: ${bodyFontWeight} !important;` : ''}
${bodyFontColor ? `color: ${bodyFontColor} !important;` : ''}
${bodyTextAlign ? `text-align: ${bodyTextAlign} !important;` : ''}
}
}
/* Make dropdowns transparent to inherit row background by default */
/* Can be overridden by component-level appearance settings */
.ant-select-selector,
.ant-input,
.ant-picker,
.ant-input-number-input-wrap,
.ant-input-number {
background: transparent;
background-color: transparent;
}
}
.${td} {
vertical-align: middle;
${cellBorders && cellBorderColor ? `border: 1px solid ${cellBorderColor};` : ''}
${Object.entries(cellBorderStyles).map(([key, value]) => `${key.replace(/([A-Z])/g, '-$1').toLowerCase()}: ${value};`).join(' ')}
/* Action icons styling for all table cells */
.sha-link {
/* Always center icons regardless of cell text-align */
display: inline-flex;
align-items: center;
justify-content: center;
width: 100%;
.${iconPrefixCls} {
font-size: ${actionIconSize || bodyFontSize || '16px'};
width: ${actionIconSize || bodyFontSize || '16px'};
height: ${actionIconSize || bodyFontSize || '16px'};
min-width: ${actionIconSize || bodyFontSize || '16px'};
min-height: ${actionIconSize || bodyFontSize || '16px'};
${actionIconColor ? `color: ${actionIconColor};` : ''}
}
}
}
.${th} {
vertical-align: middle;
${headerTextAlign ? `text-align: ${headerTextAlign};` : ''}
}
.${shaCrudCell} {
display: flex;
width: 100%;
min-height: 22px;
height: 100%;
justify-content: center;
align-items: center;
${bodyFontFamily ? `font-family: ${bodyFontFamily};` : ''}
${bodyFontSize ? `font-size: ${bodyFontSize};` : ''}
${bodyFontWeight ? `font-weight: ${bodyFontWeight};` : ''}
${bodyFontColor ? `color: ${bodyFontColor};` : ''}
.sha-link {
border: none;
padding: 0 5px;
width: auto;
height: auto;
.${iconPrefixCls} {
font-size: ${actionIconSize || bodyFontSize || '16px'};
width: ${actionIconSize || bodyFontSize || '16px'};
height: ${actionIconSize || bodyFontSize || '16px'};
min-width: ${actionIconSize || bodyFontSize || '16px'};
min-height: ${actionIconSize || bodyFontSize || '16px'};
${actionIconColor ? `color: ${actionIconColor};` : ''}
display: inline-flex;
align-items: center;
justify-content: center;
}
}
.sha-action-button {
display: flex;
width: auto;
justify-content: center;
align-items: center;
.${iconPrefixCls} {
font-size: ${actionIconSize || bodyFontSize || '16px'};
width: ${actionIconSize || bodyFontSize || '16px'};
height: ${actionIconSize || bodyFontSize || '16px'};
min-width: ${actionIconSize || bodyFontSize || '16px'};
min-height: ${actionIconSize || bodyFontSize || '16px'};
${actionIconColor ? `color: ${actionIconColor};` : ''}
display: inline-flex;
align-items: center;
justify-content: center;
}
}
}
&.${shaNewRow} {
display: flex;
justify-content: center;
align-items: center;
height: -webkit-fill-available !important;
border-top: 0.5px solid rgb(220, 220, 220) !important;
border-bottom: 0.5px solid rgb(218, 218, 218) !important;
.${shaCrudCell} {
height: -webkit-fill-available !important;
.sha-link {
.${iconPrefixCls} {
font-size: 18px;
width: 18px;
min-width: 18px;
}
}
}
}
&.${trBodyGhost} {
border: 1px dashed ${token.colorPrimary};
border-radius: 2px;
opacity: 0.7;
}
&.${trOdd} {
${(rowAlternateBackgroundColor || rowBackgroundColor) ? `background: ${rowAlternateBackgroundColor || rowBackgroundColor} !important;` : 'background: transparent !important;'}
/* Make dropdowns transparent to inherit row background by default */
/* Can be overridden by component-level appearance settings */
.ant-select-selector,
.ant-input,
.ant-picker,
.ant-input-number-input-wrap,
.ant-input-number {
background: transparent;
background-color: transparent;
}
}
&.${trSelected} {
.sha-link {
color: white;
}
background: ${rowSelectedBackgroundColor || token.colorPrimary} !important;
color: white;
.ant-form-item-control-input-content, button, a {
color: white;
}
.sha-form-cell{
.ant-form-item-control-input-content, a, button {
color: white;
}
.sha-stored-files-renderer, .ant-upload-list {
color: white;
}
}
.sha-data-cell {
color: white;
}
/* Remove white background from dropdowns in selected rows */
.ant-select-selector,
.ant-input,
.ant-picker,
.ant-input-number-input-wrap,
.ant-input-number {
background: transparent !important;
background-color: transparent !important;
}
/* Ensure all form component text is white in selected rows */
.ant-select-selection-item,
.ant-select-selection-placeholder,
.ant-input,
.ant-input-number-input,
.ant-picker-input > input,
.sha-data-cell input,
.sha-data-cell .ant-select-selection-search-input {
color: white !important;
}
/* Ensure autocomplete text is white */
.sha-autocomplete-raw-value,
.sha-entity-reference-display-name {
color: white !important;
}
/* Ensure readonly display components show white text */
.read-only-display-form-item,
.read-only-display-form-item div {
color: white !important;
}
/* Ensure sha-input components (textfield) show white text */
.sha-input {
color: white !important;
input {
color: white !important;
}
}
}
/* Ensure selected row styling always takes priority over striped rows */
&.${trOdd}.${trSelected} {
background: ${rowSelectedBackgroundColor || token.colorPrimary} !important;
color: white;
}
.${prefixCls}-form-item {
.${prefixCls}-form-item-row {
.${prefixCls}-form-item-control {
.${prefixCls}-form-item-control-input {
min-height: unset;
.${prefixCls}-btn.entity-reference-btn {
line-height: unset;
height: unset;
}
}
}
}
}
.${shaCellParent} {
min-width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
cursor: auto;
& .ant-form-item-control-input {
overflow: visible;
position: relative;
z-index: 999;
width: 100% !important;
}
/* Override vertical alignment for form controls in table cells */
& .ant-select,
& .ant-input,
& .ant-input-number,
& .ant-picker {
vertical-align: middle !important;
}
}
.${shaCellParentFW} {
min-width: 100%;
& .ant-form-item-control-input {
overflow: visible;
position: relative;
z-index: 999;
width: 100% !important;
}
/* Override vertical alignment for form controls in table cells */
& .ant-select,
& .ant-input,
& .ant-input-number,
& .ant-picker {
vertical-align: middle !important;
}
}
}
.${shaTooltipIcon} {
color: darkgray !important;
margin-left: 5px;
margin-right: 5px;
}
.${th} {
${headerBackgroundColor ? `background-color: ${headerBackgroundColor} !important;` : ''}
${headerFontFamily ? `font-family: ${headerFontFamily};` : ''}
${headerFontSize ? `font-size: ${headerFontSize};` : ''}
${headerFontWeight ? `font-weight: ${headerFontWeight} !important;` : ''}
${headerTextColor ? `color: ${headerTextColor};` : 'color: #000000ff !important;'}
&.${sortedAsc} {
border-top: 3px solid ${sortableIndicatorColor || token.colorPrimary};
padding-top: 5px;
}
&.${sortedDesc} {
border-bottom: 3px solid ${sortableIndicatorColor || token.colorPrimary};
}
&.${fixedColumn} {
position: sticky;
z-index: 999;
opacity: 1;
}
&.${relativeColumn} {
display: inline-block;
position: relative;
z-index: -100;
}
&.${boxShadowLeft} {
box-shadow: 5px 0 3px -2px #ccc;
}
&.${boxShadowRight} {
box-shadow: -5px 0 3px -2px #ccc;
}
&.ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
/* Common cell styles for both headers and body cells */
.${th}, .${td} {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin: 0;
padding: 0.5rem; /* Default padding for all cells */
/* Add vertical separator using pseudo-element that stretches full height */
&::after {
content: '';
position: absolute;
right: 0;
top: 0;
bottom: 0px;
width: 1px;
background-color: rgba(0, 0, 0, 0.05);
pointer-events: none;
}
/* Only apply minimum height when rowHeight is auto to prevent empty cell collapse */
${!rowHeight || rowHeight === 'auto' ? `
/* Force cells to stretch to row height - !important overrides React Table inline styles */
min-height: 44px !important;
height: auto !important;
align-self: stretch !important;
display: flex !important;
justify-content: ${bodyTextAlign === 'right'
? 'flex-end'
: bodyTextAlign === 'center'
? 'center'
: 'flex-start'} !important;
align-items: center !important;
/* Force empty cells to maintain height */
&:empty::before {
content: '';
display: inline-block;
}
` : ''}
/* In this example we use an absolutely position resizer, so this is required. */
position: relative;
/* Allow overflow for cells with forms to show validation messages */
&:has(.sha-form-cell) {
overflow: visible;
}
.resizer {
/* prevents from scrolling while dragging on touch devices */
/* touch-action :none; */
&.isResizing {
border-right: 1px solid gray;
}
height: 100%;
border-right: 1px solid rgba(0, 0, 0, 0.05);
touch-action: none;
display: inline-block;
position: absolute;
width: 5px;
top: 0;
bottom: 0;
right: -0.5px;
cursor: col-resize;
z-index: 10;
}
&.${fixedColumn} {
position: sticky;
z-index: 10;
opacity: 1;
.sha-link {
color: ${token.colorPrimary};
}
}
&.${relativeColumn} {
display: inline-block;
position: relative;
z-index: 0;
}
&.${boxShadowLeft} {
box-shadow: 5px 0 3px -2px #ccc;
}
&.${boxShadowRight} {
box-shadow: -5px 0 3px -2px #ccc;
}
}
/* Table body cell-specific padding from rowPadding prop */
.${td} {
${effectivePadding ? `padding: ${effectivePadding};` : ''}
}
}
`,
);
return {
shaReactTable,
};
});