lowcoder-comps 0.0.19 → 0.0.21

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.
Files changed (78) hide show
  1. package/04ea1009.js +985 -0
  2. package/0a1968f4.js +832 -0
  3. package/256b619e.js +92 -0
  4. package/2768fdea.js +275 -0
  5. package/2ff2c7a6.js +6 -0
  6. package/3087113d.js +1032 -0
  7. package/31b1cdd2.js +236 -0
  8. package/39f71758.js +849 -0
  9. package/3bd738e9.js +212 -0
  10. package/450c6bd6.js +447 -0
  11. package/4d1cf087.js +2679 -0
  12. package/54511d22.js +451 -0
  13. package/59cbb8ee.js +2456 -0
  14. package/62c916e0.js +86 -0
  15. package/74645131.js +1246 -0
  16. package/75095038.js +159 -0
  17. package/7c62ef63.js +34 -0
  18. package/8219433d.js +18619 -0
  19. package/86a4a706.js +1118 -0
  20. package/88c87bf8.js +943 -0
  21. package/8d8e98a7.js +365 -0
  22. package/9200edf7.js +70 -0
  23. package/9f3281b9.js +117321 -0
  24. package/a6e7fb9e.js +326 -0
  25. package/acdad8f2.js +7 -0
  26. package/b38c288b.js +24 -0
  27. package/ba44e76c.js +46688 -0
  28. package/cbee3d44.js +607 -0
  29. package/cc0f1351.js +793 -0
  30. package/e614be0d.js +91 -0
  31. package/f40ee59a.js +940 -0
  32. package/f576ac90.js +798 -0
  33. package/f9637058.js +16 -0
  34. package/fb09e069.js +1602 -0
  35. package/fc5c5300.js +2103 -0
  36. package/fe636892.js +823 -0
  37. package/fea654db.js +2827 -0
  38. package/index.js +5 -0
  39. package/package.json +4 -3
  40. package/README.md +0 -27
  41. package/index.html +0 -26
  42. package/index.tsx +0 -19
  43. package/jest.config.js +0 -6
  44. package/src/__test__/allComp.test.tsx +0 -61
  45. package/src/app-env.d.ts +0 -3
  46. package/src/comps/calendarComp/calendarComp.tsx +0 -443
  47. package/src/comps/calendarComp/calendarConstants.tsx +0 -898
  48. package/src/comps/chartComp/chartComp.tsx +0 -356
  49. package/src/comps/chartComp/chartConfigs/barChartConfig.tsx +0 -51
  50. package/src/comps/chartComp/chartConfigs/cartesianAxisConfig.tsx +0 -307
  51. package/src/comps/chartComp/chartConfigs/chartUrls.tsx +0 -9
  52. package/src/comps/chartComp/chartConfigs/legendConfig.tsx +0 -55
  53. package/src/comps/chartComp/chartConfigs/lineChartConfig.tsx +0 -96
  54. package/src/comps/chartComp/chartConfigs/pieChartConfig.tsx +0 -83
  55. package/src/comps/chartComp/chartConfigs/scatterChartConfig.tsx +0 -62
  56. package/src/comps/chartComp/chartConstants.tsx +0 -288
  57. package/src/comps/chartComp/chartPropertyView.tsx +0 -218
  58. package/src/comps/chartComp/chartUtils.ts +0 -291
  59. package/src/comps/chartComp/reactEcharts/core.tsx +0 -194
  60. package/src/comps/chartComp/reactEcharts/index.ts +0 -21
  61. package/src/comps/chartComp/reactEcharts/types.ts +0 -76
  62. package/src/comps/chartComp/seriesComp.tsx +0 -119
  63. package/src/comps/imageEditorComp/imageEditorClass.tsx +0 -52
  64. package/src/comps/imageEditorComp/imageEditorConstants.tsx +0 -109
  65. package/src/comps/imageEditorComp/index.tsx +0 -184
  66. package/src/comps/mermaidComp/index.tsx +0 -44
  67. package/src/comps/mermaidComp/mermaid.tsx +0 -29
  68. package/src/global.ts +0 -1
  69. package/src/i18n/comps/index.tsx +0 -29
  70. package/src/i18n/comps/locales/en.ts +0 -150
  71. package/src/i18n/comps/locales/enObj.tsx +0 -198
  72. package/src/i18n/comps/locales/index.ts +0 -7
  73. package/src/i18n/comps/locales/types.tsx +0 -10
  74. package/src/i18n/comps/locales/zh.ts +0 -145
  75. package/src/i18n/comps/locales/zhObj.tsx +0 -4
  76. package/src/index.ts +0 -11
  77. package/tsconfig.json +0 -22
  78. package/vite.config.js +0 -10
@@ -1,898 +0,0 @@
1
- import { trans } from "../../i18n/comps";
2
- import {
3
- backgroundToBorder,
4
- CalendarStyleType,
5
- contrastText,
6
- contrastColor,
7
- handleToCalendarHeadSelectBg,
8
- handleToCalendarToday,
9
- genHoverColor,
10
- DATE_FORMAT,
11
- DATE_TIME_FORMAT,
12
- ThemeDetail,
13
- isDarkColor,
14
- darkenColor,
15
- lightenColor,
16
- toHex,
17
- UnderlineCss,
18
- } from "lowcoder-sdk";
19
- import styled from "styled-components";
20
- import dayjs from "dayjs";
21
- import {
22
- DayHeaderContentArg,
23
- FormatterInput,
24
- SlotLabelContentArg,
25
- ViewContentArg,
26
- } from "@fullcalendar/core";
27
- import { Form } from "antd";
28
-
29
- export const Wrapper = styled.div<{
30
- editable: boolean;
31
- $style: CalendarStyleType;
32
- theme?: ThemeDetail;
33
- left?: number;
34
- }>`
35
- position: relative;
36
- height: 100%;
37
- overflow: hidden;
38
- color: ${(props) => props.$style.text};
39
- .fc-theme-standard .fc-list-day-cushion,
40
- .fc .fc-timegrid-col.fc-day-today,
41
- .fc .fc-daygrid-day.fc-day-today {
42
- background-color: ${(props) => props.$style.background};
43
- }
44
- .fc .fc-highlight {
45
- background-color: ${(props) => props.$style.selectBackground};
46
- }
47
- a {
48
- color: ${(props) => props.$style.text};
49
- }
50
-
51
- .fc .fc-timegrid-slot {
52
- height: 28px;
53
- }
54
-
55
- // day
56
- .fc-timeGridDay-view {
57
- .fc-col-header-cell {
58
- font-size: 20px;
59
- font-weight: 500;
60
- a {
61
- line-height: 67px;
62
- }
63
- }
64
- }
65
-
66
- // list
67
- .fc-list {
68
- .fc-list-table {
69
- table-layout: fixed;
70
- th {
71
- background-color: ${(props) => props.$style.background};
72
- }
73
- }
74
- .fc-list-event-graphic {
75
- display: none;
76
- }
77
- .fc-list-day-cushion {
78
- font-size: 16px;
79
- font-weight: 500;
80
- line-height: 32px;
81
- padding: 0 24px;
82
- }
83
- .fc-list-day-side-text {
84
- float: left;
85
- margin-left: 24px;
86
- }
87
- .fc-list-day {
88
- th {
89
- padding: 8px 0 3px 0;
90
- }
91
- > th {
92
- border: none;
93
- }
94
- &:not(:nth-of-type(1)) .fc-list-day-cushion {
95
- border-top: 1px solid
96
- ${(props) =>
97
- toHex(props.$style.border) === "#D7D9E0"
98
- ? "#E1E3EB"
99
- : lightenColor(props.$style.border, 0.03)};
100
- }
101
- }
102
- .fc-event + .fc-list-day th {
103
- padding-top: 11px;
104
- .fc-list-day-cushion {
105
- padding-top: 8px;
106
- }
107
- }
108
- .fc-event {
109
- .fc-list-event-time,
110
- .fc-list-event-title {
111
- border: none;
112
- }
113
- &:hover .event {
114
- box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.15);
115
- border-width: 1px;
116
- margin: 2px 5px;
117
- height: 20px;
118
- .event-title {
119
- margin-left: 15px;
120
- }
121
- &::before {
122
- left: 2px;
123
- }
124
- }
125
- }
126
- .fc-event {
127
- font-size: 13px;
128
- line-height: 20px;
129
- display: flex;
130
- align-items: center;
131
- &.no-time {
132
- padding-left: 19px;
133
- }
134
- }
135
- .fc-list-event-time {
136
- padding: 0px 16px 0 24px;
137
- vertical-align: middle;
138
- min-width: 87px;
139
- width: 87px;
140
- box-sizing: content-box;
141
- }
142
- .fc-list-event-title {
143
- min-width: 266px;
144
- overflow: hidden;
145
- text-overflow: ellipsis;
146
- white-space: nowrap;
147
- padding: 0 14px 0 0;
148
- cursor: pointer;
149
- .event {
150
- font-size: 13px;
151
- height: 18px;
152
- line-height: 18px;
153
- margin: 3px 5px;
154
- border-width: 0;
155
- align-items: center;
156
- &::before {
157
- height: 14px;
158
- top: 2px;
159
- left: 3px;
160
- }
161
- .event-time {
162
- display: none;
163
- }
164
- .event-title {
165
- margin-left: 16px;
166
- overflow: hidden;
167
- text-overflow: ellipsis;
168
- white-space: nowrap;
169
- }
170
- .event-remove {
171
- background-color: inherit;
172
- }
173
- }
174
- }
175
- .fc-event:hover td {
176
- background-color: inherit;
177
- }
178
- }
179
-
180
- // month
181
- .fc-dayGridMonth-view {
182
- .fc-daygrid-day-frame {
183
- min-height: 95px;
184
- height: 100%;
185
- }
186
- .fc-col-header-cell {
187
- font-size: 14px;
188
- font-weight: 400;
189
- text-align: left;
190
- padding-left: 16px;
191
- a {
192
- padding: 0;
193
- line-height: 39px;
194
- }
195
- }
196
- .fc-daygrid-day-number {
197
- font-size: 14px;
198
- line-height: 22px;
199
- font-weight: 500;
200
- padding: 0 6px;
201
- border-radius: 11px;
202
- margin: 12px 0 0 10px;
203
- }
204
- .fc-daygrid-day-top {
205
- flex-direction: inherit;
206
- }
207
- .fc-day-today .fc-daygrid-day-number {
208
- background-color: ${(props) => props.theme.primary};
209
- color: ${(props) =>
210
- contrastText(props.theme.primary || "", props.theme.textDark, props.theme.textLight)};
211
- }
212
- .fc-daygrid-day-events {
213
- padding: 1px 0 5px 0;
214
- min-height: unset;
215
- .fc-event {
216
- margin: 2px 4px 2px 12px;
217
- padding: 0;
218
- &:hover .event {
219
- padding-right: 20px;
220
- }
221
- .event {
222
- font-size: 13px;
223
- line-height: 18px;
224
- padding-right: 0;
225
- .event-time {
226
- display: none;
227
- }
228
- .event-title {
229
- margin-left: 15px;
230
- overflow: hidden;
231
- text-overflow: ellipsis;
232
- white-space: nowrap;
233
- }
234
- &::before {
235
- height: 14px;
236
- }
237
- }
238
- }
239
- .fc-daygrid-day-bottom {
240
- padding: 2px 2px 0 10px;
241
- }
242
- }
243
- .fc-day-other {
244
- color: ${(props) => props.$style.text};
245
- .fc-daygrid-day-top,
246
- .fc-daygrid-day-events {
247
- opacity: 0.35;
248
- }
249
- .event::before {
250
- background-color: ${(props) => props.$style.text};
251
- }
252
- }
253
- }
254
- // month drag event
255
- .fc > .fc-event {
256
- visibility: hidden;
257
- }
258
-
259
- // more link
260
- .fc-view-harness-active .fc-more-popover {
261
- border-radius: 4px;
262
- box-shadow: 0 0px 10px 4px rgba(0, 0, 0, 0.25);
263
- overflow: hidden;
264
- left: ${(props) => `min(${props.left}px, calc(100% - 210px)) !important`};
265
- .fc-popover-body {
266
- padding: 4px 0;
267
- min-width: 200px;
268
- width: 200px;
269
- .fc-daygrid-event-harness {
270
- margin: 4px;
271
- .fc-event {
272
- margin: 0;
273
- .event {
274
- height: fit-content;
275
- .event-title {
276
- white-space: pre-wrap;
277
- }
278
- .event-time {
279
- margin-top: 0;
280
- }
281
- }
282
- }
283
- }
284
- }
285
- .fc-popover-header,
286
- .fc-popover-body {
287
- background-color: ${(props) => props.$style.background};
288
- }
289
- .fc-popover-header .fc-popover-close {
290
- color: #8b8fa3;
291
- &:hover {
292
- color: #222;
293
- }
294
- }
295
- }
296
-
297
- .fc-direction-ltr .fc-timegrid-more-link {
298
- border: 1px solid ${(props) => props.$style.border};
299
- border-radius: 4px;
300
- box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.15);
301
- font-size: 13px;
302
- display: inline-block;
303
- font-weight: 500;
304
- background-color: ${(props) => lightenColor(props.$style.background, 0.1)};
305
- }
306
-
307
- .fc-dayGridMonth-view .fc-more-link {
308
- margin: 0 2px 2px 2px !important;
309
- }
310
- .fc-timeGridWeek-view .fc-more-link,
311
- .fc-timeGridDay-view .fc-more-link {
312
- margin: 2px !important;
313
- }
314
- .fc-daygrid-day-events {
315
- margin: 0 !important;
316
- padding: 2px 0;
317
- .fc-event {
318
- margin: 2px 4px;
319
- }
320
- .fc-daygrid-day-bottom {
321
- line-height: 16px;
322
- padding: 0;
323
- .fc-more-link {
324
- width: calc(100% - 4px);
325
- border: 1px solid ${(props) => props.$style.border};
326
- border-radius: 4px;
327
- box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.15);
328
- font-size: 13px;
329
- display: inline-block;
330
- height: 20px;
331
- padding-left: 15px;
332
- font-weight: 500;
333
- background-color: ${(props) => lightenColor(props.$style.background, 0.1)};
334
- }
335
- }
336
- }
337
-
338
- // on resize
339
- .fc-media-screen {
340
- height: 100% !important;
341
- }
342
- .fc-scroller {
343
- overflow: hidden auto !important;
344
- overflow: hidden overlay !important;
345
- }
346
- .fc-col-header,
347
- .fc-scroller > div,
348
- .fc-scroller > div > table,
349
- .fc-scrollgrid-sync-table,
350
- .fc-timegrid-cols > table,
351
- .fc .fc-scrollgrid,
352
- .fc .fc-scrollgrid table {
353
- width: 100% !important;
354
- }
355
-
356
- // event
357
- .fc-timegrid-event .fc-event-main {
358
- padding: 4px 0 4px 1px;
359
- }
360
- .fc-event {
361
- position: relative;
362
- height: 100%;
363
- background-color: unset !important;
364
- border: none !important;
365
- box-shadow: none !important;
366
- .event-remove {
367
- color: ${(props) => props.$style.text};
368
- }
369
- &:hover {
370
- .event-remove {
371
- opacity: ${(props) => props.editable && 1};
372
- }
373
- }
374
- }
375
-
376
- // left time
377
- .time.past {
378
- opacity: 0.35;
379
- }
380
-
381
- .past .time {
382
- opacity: 0.35;
383
- }
384
-
385
- .future .time {
386
- opacity: 1;
387
- }
388
-
389
- .fc-scrollgrid-liquid > tbody {
390
- & > tr:nth-of-type(2) {
391
- display: ${(props) => props.allDay && 1};
392
- }
393
- }
394
- .fc .fc-timegrid-slot-label-cushion {
395
- padding: 0 15px;
396
- }
397
-
398
- // border-radius, bg
399
- .fc-theme-standard .fc-list {
400
- background-color: ${(props) => props.$style.background};
401
- border-radius: ${(props) => `0 0 ${props.$style.radius} ${props.$style.radius}`};
402
- border-color: ${(props) => props.$style.border};
403
- border-top-color: ${(props) =>
404
- toHex(props.$style.border) === "#D7D9E0"
405
- ? "#E1E3EB"
406
- : lightenColor(props.$style.border, 0.03)};
407
- }
408
- .fc-scrollgrid-liquid {
409
- border-radius: ${(props) => `0 0 ${props.$style.radius} ${props.$style.radius}`};
410
- overflow: hidden;
411
- border-right-width: 1px;
412
- border-bottom-width: 1px;
413
- border-color: ${(props) => props.$style.border};
414
- > thead,
415
- > tbody > tr:nth-of-type(1),
416
- .fc-scrollgrid-section-liquid > td {
417
- background-color: ${(props) => props.$style.background};
418
- }
419
- }
420
- .fc-scrollgrid-section-liquid > td,
421
- .fc-scrollgrid-liquid .fc-scrollgrid-section-header > th {
422
- border: none;
423
- }
424
- .fc-scrollgrid-liquid > tbody > tr:nth-of-type(1) > td {
425
- border-right: none;
426
- }
427
- .fc-theme-standard .fc-scrollgrid {
428
- border-color: ${(props) =>
429
- toHex(props.$style.border) === "#D7D9E0"
430
- ? "#E1E3EB"
431
- : lightenColor(props.$style.border, 0.03)};
432
- }
433
- .fc .fc-scrollgrid {
434
- border-bottom-width: 1px;
435
- border-right-width: 1px;
436
- }
437
-
438
- .fc-day-sat,
439
- .fc-day-sun {
440
- &.fc-timegrid-col,
441
- &.fc-daygrid-day {
442
- background-color: ${(props) =>
443
- isDarkColor(props.$style.background)
444
- ? darkenColor(props.$style.background, 0.06)
445
- : darkenColor(props.$style.background, 0.02)};
446
- }
447
- }
448
- .fc-theme-standard td,
449
- .fc-theme-standard th {
450
- border-color: ${(props) =>
451
- toHex(props.$style.border) === "#D7D9E0"
452
- ? "#E1E3EB"
453
- : lightenColor(props.$style.border, 0.03)};
454
- }
455
-
456
- // header
457
- .fc .fc-toolbar.fc-header-toolbar {
458
- padding: 16px;
459
- margin-bottom: 0;
460
- border: 1px solid ${(props) => props.$style.border};
461
- border-bottom: none;
462
- border-radius: ${(props) => `${props.$style.radius} ${props.$style.radius} 0 0`};
463
- background-color: ${(props) => props.$style.background};
464
- }
465
- .fc-toolbar-title {
466
- color: ${(props) => props.$style.title};
467
- font-size: 24px;
468
- line-height: 24px;
469
- display: inline-flex;
470
- }
471
- .fc-toolbar-chunk {
472
- display: inline-flex;
473
- align-items: center;
474
- }
475
- .fc .fc-toolbar-chunk .fc-button.fc-button-primary {
476
- height: 28px;
477
- display: flex;
478
- align-items: center;
479
- justify-content: center;
480
- &:not(:disabled):not(.fc-button-active) {
481
- &:hover,
482
- &:active {
483
- color: ${(props) => props.$style.btnText};
484
- background-color: ${(props) =>
485
- toHex(props.$style.headerBtnBackground) === "#FFFFFF"
486
- ? "#F5F5F6"
487
- : genHoverColor(props.$style.headerBtnBackground)};
488
- border-color: ${(props) =>
489
- toHex(props.$style.headerBtnBackground) === "#FFFFFF"
490
- ? "#D7D9E0"
491
- : backgroundToBorder(genHoverColor(props.$style.headerBtnBackground))};
492
- }
493
- }
494
- &:not(:disabled):focus {
495
- box-shadow: none;
496
- }
497
- &:disabled {
498
- cursor: not-allowed;
499
- opacity: 1;
500
- &,
501
- &:hover {
502
- background-color: ${(props) => props.$style.headerBtnBackground};
503
- border-color: ${(props) => backgroundToBorder(props.$style.headerBtnBackground)};
504
- color: ${(props) =>
505
- toHex(props.$style.btnText) === "#222222"
506
- ? "#B8B9BF"
507
- : contrastColor(props.$style.btnText)};
508
- }
509
- }
510
- }
511
- .fc .fc-button-primary:not(:disabled).fc-button-active:focus,
512
- .fc .fc-button-primary:not(:disabled):active:focus {
513
- box-shadow: none;
514
- }
515
- .fc-toolbar-chunk:nth-of-type(3) .fc-button-primary {
516
- height: 28px;
517
- display: inline-flex;
518
- font-size: 14px;
519
- margin-left: 8px;
520
- background-color: ${(props) => props.$style.headerBtnBackground};
521
- border-color: ${(props) => backgroundToBorder(props.$style.headerBtnBackground)};
522
- color: ${(props) => props.$style.btnText};
523
- &.fc-today-button {
524
- min-width: 52px;
525
- }
526
- &.fc-prev-button,
527
- &.fc-next-button {
528
- padding: 0;
529
- width: 28px;
530
- color: ${(props) => lightenColor(props.$style.btnText, 0.4)};
531
- }
532
- &.fc-prev-button {
533
- margin-left: 12px;
534
- }
535
- }
536
- .fc-toolbar-chunk:nth-of-type(3) .fc-button-group {
537
- background-color: ${(props) =>
538
- toHex(props.$style.headerBtnBackground) === "#FFFFFF"
539
- ? "#EFEFF1"
540
- : isDarkColor(props.$style.headerBtnBackground)
541
- ? props.$style.headerBtnBackground
542
- : darkenColor(props.$style.headerBtnBackground, 0.1)};
543
- border-radius: 4px;
544
- margin-left: 16px;
545
- .fc-button-primary {
546
- background-color: transparent;
547
- min-width: 60px;
548
- border-radius: 4px;
549
- margin: 2px;
550
- border: none;
551
- color: ${(props) =>
552
- toHex(props.$style.btnText) === "#222222"
553
- ? "#8B8FA3"
554
- : lightenColor(props.$style.btnText, 0.4)};
555
- font-weight: 500;
556
-
557
- &.fc-button-active {
558
- background-color: ${(props) =>
559
- isDarkColor(props.$style.headerBtnBackground)
560
- ? lightenColor(props.$style.headerBtnBackground, 0.1)
561
- : props.$style.headerBtnBackground};
562
- color: ${(props) => props.$style.btnText};
563
- }
564
- }
565
- }
566
-
567
- // week head
568
- .fc-timeGridWeek-view {
569
- .week-head {
570
- display: flex;
571
- flex-direction: column;
572
- font-size: 14px;
573
- font-weight: 400;
574
- &.past span {
575
- opacity: 0.35;
576
- }
577
- .week {
578
- padding-bottom: 3px;
579
- }
580
- .day {
581
- font-size: 20px;
582
- font-weight: 500;
583
- line-height: 22px;
584
- }
585
- }
586
- .fc-day-today.fc-col-header-cell {
587
- background-color: ${(props) =>
588
- isDarkColor(props.$style.background) ? "#ffffff19" : toHex(props.theme.primary!) + "19"};
589
- a {
590
- color: ${(props) =>
591
- !isDarkColor(props.$style.background) && darkenColor(props.theme.primary!, 0.1)};
592
- }
593
- }
594
- .fc-col-header-cell-cushion {
595
- padding: 8px 0 13px 0;
596
- }
597
- }
598
-
599
- // week left
600
- .fc .fc-timegrid-axis-cushion {
601
- min-width: 62px;
602
- min-height: 52px;
603
- max-width: none;
604
- display: inline-flex;
605
- align-items: center;
606
- justify-content: center;
607
- }
608
- .fc-direction-ltr .fc-timegrid-slot-label-frame {
609
- text-align: center;
610
- }
611
- .fc .fc-timegrid-slot-label {
612
- border: none;
613
- }
614
-
615
- // time can doubleClick
616
- .fc-timegrid-bg-harness,
617
- .fc-daygrid-day-bg {
618
- pointer-events: none;
619
- }
620
- `;
621
-
622
- export const Remove = styled.div<{ isList: boolean }>`
623
- position: absolute;
624
- pointer-events: auto;
625
- top: 0;
626
- right: 0;
627
- display: flex;
628
- padding: 5px;
629
- opacity: 0;
630
- cursor: pointer;
631
- &:hover {
632
- g {
633
- stroke: #315efb;
634
- }
635
- }
636
- `;
637
-
638
- export const Event = styled.div<{
639
- bg: string;
640
- theme: Object;
641
- isList: boolean;
642
- allDay: boolean;
643
- $style: CalendarStyleType;
644
- }>`
645
- height: 100%;
646
- width: 100%;
647
- pointer-events: none;
648
- border-radius: 4px;
649
- box-shadow: ${(props) => !props.isList && "0 0 5px 0 rgba(0, 0, 0, 0.15)"};
650
- border: 1px solid ${(props) => props.$style.border};
651
- display: ${(props) => props.isList && "flex"};
652
- background-color: ${(props) => !props.isList && lightenColor(props.$style.background, 0.1)};
653
- overflow: hidden;
654
- font-size: 13px;
655
- line-height: 19px;
656
- padding-right: 20px;
657
- overflow: hidden;
658
- position: relative;
659
- &::before {
660
- content: "";
661
- position: absolute;
662
- display: block;
663
- width: 5px;
664
- height: calc(100% - 4px);
665
- left: 2px;
666
- top: 2px;
667
- border-radius: 3px;
668
- background-color: ${(props) => props.bg};
669
- }
670
-
671
- .event-time {
672
- color: ${(props) =>
673
- !props.isList &&
674
- (isDarkColor(props.$style.text) ? lightenColor(props.$style.text, 0.2) : props.$style.text)};
675
- margin-left: 15px;
676
- white-space: pre-wrap;
677
- margin-top: 2px;
678
- }
679
- .event-title {
680
- color: ${(props) => !props.isList && props.$style.text};
681
- font-weight: 500;
682
- margin-left: 15px;
683
- white-space: pre-wrap;
684
- word-break: break-word;
685
- }
686
-
687
- &.small {
688
- height: 20px;
689
- .event-time {
690
- display: none;
691
- }
692
- .event-title {
693
- text-overflow: ellipsis;
694
- overflow: hidden;
695
- white-space: nowrap;
696
- }
697
- }
698
- &.middle {
699
- padding-top: 2px;
700
- .event-time,
701
- .event-title {
702
- text-overflow: ellipsis;
703
- overflow: hidden;
704
- white-space: nowrap;
705
- }
706
- }
707
- &.large {
708
- .event-time {
709
- margin-top: 13px;
710
- }
711
- }
712
- &.past {
713
- background-color: ${(props) => isDarkColor(props.$style.background) && props.$style.background};
714
- &::before {
715
- background-color: ${(props) =>
716
- toHex(props.$style.text) === "#3C3C3C"
717
- ? "#8B8FA3"
718
- : isDarkColor(props.$style.text)
719
- ? lightenColor(props.$style.text, 0.3)
720
- : props.$style.text};
721
- }
722
- &::before,
723
- .event-title,
724
- .event-time {
725
- opacity: 0.35;
726
- }
727
- }
728
- `;
729
-
730
- export const FormWrapper = styled(Form)`
731
- .ant-form-item-label {
732
- width: 100px;
733
- text-align: left;
734
- line-height: 18px;
735
- label:not(.ant-form-item-required) {
736
- margin-left: 11px;
737
- }
738
- label span {
739
- ${UnderlineCss}
740
- }
741
- }
742
- `;
743
-
744
- export type EventType = {
745
- id?: string;
746
- label?: string;
747
- title?: string;
748
- start?: string;
749
- end?: string;
750
- allDay?: boolean;
751
- color?: string;
752
- groupId?: string;
753
- value?: string;
754
- };
755
-
756
- export enum ViewType {
757
- MONTH = "dayGridMonth",
758
- WEEK = "timeGridWeek",
759
- DAY = "timeGridDay",
760
- LIST = "listWeek",
761
- }
762
-
763
- export const DefaultViewOptions = [
764
- {
765
- label: trans("calendar.month"),
766
- value: "dayGridMonth",
767
- },
768
- {
769
- label: trans("calendar.week"),
770
- value: "timeGridWeek",
771
- },
772
- {
773
- label: trans("calendar.day"),
774
- value: "timeGridDay",
775
- },
776
- {
777
- label: trans("calendar.list"),
778
- value: "listWeek",
779
- },
780
- ] as const;
781
-
782
- export const FirstDayOptions = [
783
- {
784
- label: trans("calendar.monday"),
785
- value: "1",
786
- },
787
- {
788
- label: trans("calendar.tuesday"),
789
- value: "2",
790
- },
791
- {
792
- label: trans("calendar.wednesday"),
793
- value: "3",
794
- },
795
- {
796
- label: trans("calendar.thursday"),
797
- value: "4",
798
- },
799
- {
800
- label: trans("calendar.friday"),
801
- value: "5",
802
- },
803
- {
804
- label: trans("calendar.saturday"),
805
- value: "6",
806
- },
807
- {
808
- label: trans("calendar.sunday"),
809
- value: "0",
810
- },
811
- ];
812
-
813
- export const defaultData = [
814
- {
815
- id: "1",
816
- title: "Coding",
817
- start: dayjs().hour(10).minute(0).second(0).format(DATE_TIME_FORMAT),
818
- end: dayjs().hour(11).minute(30).second(0).format(DATE_TIME_FORMAT),
819
- color: "#079968",
820
- },
821
- {
822
- id: "2",
823
- title: "Rest",
824
- start: dayjs().hour(24).format(DATE_FORMAT),
825
- end: dayjs().hour(48).format(DATE_FORMAT),
826
- allDay: true,
827
- },
828
- ];
829
-
830
- export const buttonText = {
831
- today: trans("calendar.today"),
832
- month: trans("calendar.month"),
833
- week: trans("calendar.week"),
834
- day: trans("calendar.day"),
835
- list: trans("calendar.list"),
836
- };
837
-
838
- export const headerToolbar = {
839
- left: "title",
840
- right: "prev today next dayGridMonth,timeGridWeek,timeGridDay,listWeek",
841
- };
842
-
843
- const weekHeadContent = (info: DayHeaderContentArg) => {
844
- const text = info.text.split(" ");
845
- return {
846
- html: `<span class="week-head ${info.isPast && "past"} ${info.isToday && "today"}">
847
- <span class="week">${text[0]}</span>
848
- <span class="day">${text[1]}</span>
849
- </span>`,
850
- };
851
- };
852
-
853
- const leftTimeContent = (info: SlotLabelContentArg) => {
854
- let isPast = false;
855
- if (info.view.type === ViewType.WEEK) {
856
- isPast = dayjs().isAfter(dayjs(dayjs().format("YYYY MM DD " + info.text)));
857
- } else if (info.view.type === ViewType.DAY) {
858
- isPast = dayjs().isAfter(
859
- dayjs(dayjs(info.view.activeStart).format("YYYY MM DD " + info.text))
860
- );
861
- }
862
- return {
863
- html: `<span class="time ${isPast && "past"}">${info.text}</span>`,
864
- };
865
- };
866
-
867
- export const views = {
868
- [ViewType.WEEK]: {
869
- dayHeaderFormat: "ddd DD",
870
- dayHeaderContent: (info: DayHeaderContentArg) => weekHeadContent(info),
871
- slotLabelContent: (info: SlotLabelContentArg) => leftTimeContent(info),
872
- },
873
- [ViewType.DAY]: {
874
- slotLabelContent: (info: SlotLabelContentArg) => leftTimeContent(info),
875
- },
876
- [ViewType.LIST]: {
877
- listDayFormat: { weekday: "short" },
878
- },
879
- } as const;
880
-
881
- export const slotLabelFormat = [
882
- {
883
- hour: "2-digit",
884
- minute: "2-digit",
885
- },
886
- ] as FormatterInput[];
887
-
888
- export const viewClassNames = (info: ViewContentArg) => {
889
- let className = "";
890
- if ([ViewType.WEEK, ViewType.DAY].includes(info.view.type as ViewType)) {
891
- if (dayjs().isAfter(info.view.activeEnd)) {
892
- className = "past";
893
- } else if (dayjs().isBefore(info.view.activeStart)) {
894
- className = "future";
895
- }
896
- }
897
- return className;
898
- };