lowcoder-comps 0.0.31 → 0.0.32

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 (86) hide show
  1. package/1e5cb9c2.js +447 -0
  2. package/24307cf2.js +25 -0
  3. package/256b619e.js +92 -0
  4. package/2b031be2.js +2967 -0
  5. package/2ff2c7a6.js +6 -0
  6. package/2ff7471d.js +9 -0
  7. package/444e09f1.js +268 -0
  8. package/4564a1bc.js +86 -0
  9. package/4a489df6.js +8 -0
  10. package/4a860f5d.js +505 -0
  11. package/4cc9caa5.js +2501 -0
  12. package/64d87c95.js +1536 -0
  13. package/6deaf0be.js +881 -0
  14. package/794e64d5.js +208 -0
  15. package/7a3f27e4.js +391 -0
  16. package/7ae6dd1c.js +319 -0
  17. package/92e85b65.js +65 -0
  18. package/97059d88.js +237 -0
  19. package/98955949.js +134435 -0
  20. package/a408f817.js +796 -0
  21. package/a40faea7.js +11624 -0
  22. package/a969f4ca.js +48428 -0
  23. package/aa1becc7.js +455 -0
  24. package/aa82b740.js +1269 -0
  25. package/c289b0aa.js +1102 -0
  26. package/c4d99b09.js +5 -0
  27. package/c9bb75eb.js +960 -0
  28. package/cb40fdd9.js +933 -0
  29. package/cc799554.js +1276 -0
  30. package/d3700d97.js +2284 -0
  31. package/d622fb26.js +818 -0
  32. package/d8c50a91.js +34 -0
  33. package/dce9fa3f.js +769 -0
  34. package/de8c90a7.js +1284 -0
  35. package/debd9490.js +819 -0
  36. package/df803461.js +220 -0
  37. package/e06dcfb0.js +1089 -0
  38. package/e6388bfd.js +915 -0
  39. package/ee801edf.js +804 -0
  40. package/f7c6b13d.js +19104 -0
  41. package/f8b68c1a.js +1127 -0
  42. package/f9637058.js +16 -0
  43. package/fcee2d3c.js +64 -0
  44. package/fd51bb2f.js +1579 -0
  45. package/index.js +5 -0
  46. package/package.json +4 -3
  47. package/README.md +0 -120
  48. package/index.html +0 -26
  49. package/index.tsx +0 -21
  50. package/jest.config.js +0 -6
  51. package/src/__test__/allComp.test.tsx +0 -61
  52. package/src/app-env.d.ts +0 -3
  53. package/src/comps/calendarComp/calendarComp.tsx +0 -633
  54. package/src/comps/calendarComp/calendarConstants.tsx +0 -1048
  55. package/src/comps/calendarComp/errorBoundary.tsx +0 -30
  56. package/src/comps/chartComp/chartComp.tsx +0 -442
  57. package/src/comps/chartComp/chartConfigs/barChartConfig.tsx +0 -51
  58. package/src/comps/chartComp/chartConfigs/cartesianAxisConfig.tsx +0 -307
  59. package/src/comps/chartComp/chartConfigs/chartUrls.tsx +0 -9
  60. package/src/comps/chartComp/chartConfigs/legendConfig.tsx +0 -55
  61. package/src/comps/chartComp/chartConfigs/lineChartConfig.tsx +0 -96
  62. package/src/comps/chartComp/chartConfigs/pieChartConfig.tsx +0 -83
  63. package/src/comps/chartComp/chartConfigs/scatterChartConfig.tsx +0 -62
  64. package/src/comps/chartComp/chartConstants.tsx +0 -299
  65. package/src/comps/chartComp/chartPropertyView.tsx +0 -235
  66. package/src/comps/chartComp/chartUtils.ts +0 -291
  67. package/src/comps/chartComp/reactEcharts/core.tsx +0 -194
  68. package/src/comps/chartComp/reactEcharts/index.ts +0 -21
  69. package/src/comps/chartComp/reactEcharts/types.ts +0 -76
  70. package/src/comps/chartComp/seriesComp.tsx +0 -119
  71. package/src/comps/imageEditorComp/imageEditorClass.tsx +0 -52
  72. package/src/comps/imageEditorComp/imageEditorConstants.tsx +0 -109
  73. package/src/comps/imageEditorComp/index.tsx +0 -184
  74. package/src/comps/mermaidComp/index.tsx +0 -44
  75. package/src/comps/mermaidComp/mermaid.tsx +0 -29
  76. package/src/global.ts +0 -1
  77. package/src/i18n/comps/index.tsx +0 -29
  78. package/src/i18n/comps/locales/en.ts +0 -163
  79. package/src/i18n/comps/locales/enObj.tsx +0 -198
  80. package/src/i18n/comps/locales/index.ts +0 -7
  81. package/src/i18n/comps/locales/types.tsx +0 -10
  82. package/src/i18n/comps/locales/zh.ts +0 -156
  83. package/src/i18n/comps/locales/zhObj.tsx +0 -4
  84. package/src/index.ts +0 -11
  85. package/tsconfig.json +0 -22
  86. package/vite.config.js +0 -10
@@ -1,1048 +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 { default as Form } from "antd/es/form";
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) =>
209
- props.$theme?.primary ? props.$theme.primary : props.$style.background};
210
- color: ${(props) =>
211
- contrastText(
212
- props.$theme?.primary || "",
213
- props.$theme?.textDark || "#000000",
214
- props.$theme?.textLight || "#ffffff"
215
- )};
216
- }
217
- .fc-daygrid-day-events {
218
- padding: 1px 0 5px 0;
219
- min-height: unset;
220
- .fc-event {
221
- margin: 2px 4px 2px 12px;
222
- padding: 0;
223
- &:hover .event {
224
- padding-right: 20px;
225
- }
226
- .event {
227
- font-size: 13px;
228
- line-height: 18px;
229
- padding-right: 0;
230
- .event-time {
231
- display: none;
232
- }
233
- .event-title {
234
- margin-left: 15px;
235
- overflow: hidden;
236
- text-overflow: ellipsis;
237
- white-space: nowrap;
238
- }
239
- &::before {
240
- height: 14px;
241
- }
242
- }
243
- }
244
- .fc-daygrid-day-bottom {
245
- padding: 2px 2px 0 10px;
246
- }
247
- }
248
- .fc-day-other {
249
- color: ${(props) => props.$style.text};
250
- .fc-daygrid-day-top,
251
- .fc-daygrid-day-events {
252
- opacity: 0.35;
253
- }
254
- .event::before {
255
- background-color: ${(props) => props.$style.text};
256
- }
257
- }
258
- }
259
- // month drag event
260
- .fc > .fc-event {
261
- visibility: hidden;
262
- }
263
-
264
- // more link
265
- .fc-view-harness-active .fc-more-popover {
266
- border-radius: 4px;
267
- box-shadow: 0 0px 10px 4px rgba(0, 0, 0, 0.25);
268
- overflow: hidden;
269
- left: ${(props) => `min(${props.$left}px, calc(100% - 210px)) !important`};
270
- .fc-popover-body {
271
- padding: 4px 0;
272
- min-width: 200px;
273
- width: 200px;
274
- .fc-daygrid-event-harness {
275
- margin: 4px;
276
- .fc-event {
277
- margin: 0;
278
- .event {
279
- height: fit-content;
280
- .event-title {
281
- white-space: pre-wrap;
282
- }
283
- .event-time {
284
- margin-top: 0;
285
- }
286
- }
287
- }
288
- }
289
- }
290
- .fc-popover-header,
291
- .fc-popover-body {
292
- background-color: ${(props) => props.$style.background};
293
- }
294
- .fc-popover-header .fc-popover-close {
295
- color: #8b8fa3;
296
- &:hover {
297
- color: #222;
298
- }
299
- }
300
- }
301
-
302
- .fc-direction-ltr .fc-timegrid-more-link {
303
- border: 1px solid ${(props) => props.$style.border};
304
- border-radius: 4px;
305
- box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.15);
306
- font-size: 13px;
307
- display: inline-block;
308
- font-weight: 500;
309
- background-color: ${(props) => lightenColor(props.$style.background, 0.1)};
310
- }
311
-
312
- .fc-dayGridMonth-view .fc-more-link {
313
- margin: 0 2px 2px 2px !important;
314
- }
315
- .fc-timeGridWeek-view .fc-more-link,
316
- .fc-timeGridDay-view .fc-more-link {
317
- margin: 2px !important;
318
- }
319
- .fc-daygrid-day-events {
320
- margin: 0 !important;
321
- padding: 2px 0;
322
- .fc-event {
323
- margin: 2px 4px;
324
- }
325
- .fc-daygrid-day-bottom {
326
- line-height: 16px;
327
- padding: 0;
328
- .fc-more-link {
329
- width: calc(100% - 4px);
330
- border: 1px solid ${(props) => props.$style.border};
331
- border-radius: 4px;
332
- box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.15);
333
- font-size: 13px;
334
- display: inline-block;
335
- height: 20px;
336
- padding-left: 15px;
337
- font-weight: 500;
338
- background-color: ${(props) =>
339
- lightenColor(props.$style.background, 0.1)};
340
- }
341
- }
342
- }
343
-
344
- // on resize
345
- .fc-media-screen {
346
- height: 100% !important;
347
- }
348
- .fc-scroller {
349
- overflow: hidden auto !important;
350
- overflow: hidden overlay !important;
351
- }
352
- .fc-col-header,
353
- .fc-scroller > div,
354
- .fc-scroller > div > table,
355
- .fc-scrollgrid-sync-table,
356
- .fc-timegrid-cols > table,
357
- .fc .fc-scrollgrid,
358
- .fc .fc-scrollgrid table {
359
- width: 100% !important;
360
- }
361
-
362
- // event
363
- .fc-timegrid-event .fc-event-main {
364
- padding: 4px 0 4px 1px;
365
- }
366
- .fc-event {
367
- position: relative;
368
- height: 100%;
369
- background-color: unset !important;
370
- border: none !important;
371
- box-shadow: none !important;
372
- .event-remove {
373
- color: ${(props) => props.$style.text};
374
- }
375
- &:hover {
376
- .event-remove {
377
- opacity: ${(props) => (props.$editable ? 1 : undefined)};
378
- }
379
- }
380
- }
381
-
382
- // left time
383
- .time.past {
384
- opacity: 0.35;
385
- }
386
-
387
- .past .time {
388
- opacity: 0.35;
389
- }
390
-
391
- .future .time {
392
- opacity: 1;
393
- }
394
-
395
- .fc-scrollgrid-liquid > tbody {
396
- & > tr:nth-of-type(2) {
397
- display: ${(props) => props.allDay && 1};
398
- }
399
- }
400
- .fc .fc-timegrid-slot-label-cushion {
401
- padding: 0 15px;
402
- }
403
-
404
- // border-radius, bg
405
- .fc-theme-standard .fc-list {
406
- background-color: ${(props) => props.$style.background};
407
- border-radius: ${(props) =>
408
- `0 0 ${props.$style.radius} ${props.$style.radius}`};
409
- border-color: ${(props) => props.$style.border};
410
- border-top-color: ${(props) =>
411
- toHex(props.$style.border) === "#D7D9E0"
412
- ? "#E1E3EB"
413
- : lightenColor(props.$style.border, 0.03)};
414
- }
415
- .fc-scrollgrid-liquid {
416
- border-radius: ${(props) =>
417
- `0 0 ${props.$style.radius} ${props.$style.radius}`};
418
- overflow: hidden;
419
- border-right-width: 1px;
420
- border-bottom-width: 1px;
421
- border-color: ${(props) => props.$style.border};
422
- > thead,
423
- > tbody > tr:nth-of-type(1),
424
- .fc-scrollgrid-section-liquid > td {
425
- background-color: ${(props) => props.$style.background};
426
- }
427
- }
428
- .fc-scrollgrid-section-liquid > td,
429
- .fc-scrollgrid-liquid .fc-scrollgrid-section-header > th {
430
- border: none;
431
- }
432
- .fc-scrollgrid-liquid > tbody > tr:nth-of-type(1) > td {
433
- border-right: none;
434
- }
435
- .fc-theme-standard .fc-scrollgrid {
436
- border-color: ${(props) =>
437
- toHex(props.$style.border) === "#D7D9E0"
438
- ? "#E1E3EB"
439
- : lightenColor(props.$style.border, 0.03)};
440
- }
441
- .fc .fc-scrollgrid {
442
- border-bottom-width: 1px;
443
- border-right-width: 1px;
444
- }
445
-
446
- .fc-day-sat,
447
- .fc-day-sun {
448
- &.fc-timegrid-col,
449
- &.fc-daygrid-day {
450
- background-color: ${(props) =>
451
- isDarkColor(props.$style.background)
452
- ? darkenColor(props.$style.background, 0.06)
453
- : darkenColor(props.$style.background, 0.02)};
454
- }
455
- }
456
- .fc-theme-standard td,
457
- .fc-theme-standard th {
458
- border-color: ${(props) =>
459
- toHex(props.$style.border) === "#D7D9E0"
460
- ? "#E1E3EB"
461
- : lightenColor(props.$style.border, 0.03)};
462
- }
463
-
464
- // header
465
- .fc .fc-toolbar.fc-header-toolbar {
466
- padding: 16px;
467
- margin-bottom: 0;
468
- border: 1px solid ${(props) => props.$style.border};
469
- border-bottom: none;
470
- border-radius: ${(props) =>
471
- `${props.$style.radius} ${props.$style.radius} 0 0`};
472
- background-color: ${(props) => props.$style.background};
473
- }
474
- .fc-toolbar-title {
475
- color: ${(props) => props.$style.title};
476
- font-size: 24px;
477
- line-height: 24px;
478
- display: inline-flex;
479
- }
480
- .fc-toolbar-chunk {
481
- display: inline-flex;
482
- align-items: center;
483
- }
484
- .fc .fc-toolbar-chunk .fc-button.fc-button-primary {
485
- height: 28px;
486
- display: flex;
487
- align-items: center;
488
- justify-content: center;
489
- &:not(:disabled):not(.fc-button-active) {
490
- &:hover,
491
- &:active {
492
- color: ${(props) => props.$style.btnText};
493
- background-color: ${(props) =>
494
- toHex(props.$style.headerBtnBackground) === "#FFFFFF"
495
- ? "#F5F5F6"
496
- : genHoverColor(props.$style.headerBtnBackground)};
497
- border-color: ${(props) =>
498
- toHex(props.$style.headerBtnBackground) === "#FFFFFF"
499
- ? "#D7D9E0"
500
- : backgroundToBorder(
501
- genHoverColor(props.$style.headerBtnBackground)
502
- )};
503
- }
504
- }
505
- &:not(:disabled):focus {
506
- box-shadow: none;
507
- }
508
- &:disabled {
509
- cursor: not-allowed;
510
- opacity: 1;
511
- &,
512
- &:hover {
513
- background-color: ${(props) => props.$style.headerBtnBackground};
514
- border-color: ${(props) =>
515
- backgroundToBorder(props.$style.headerBtnBackground)};
516
- color: ${(props) =>
517
- toHex(props.$style.btnText) === "#222222"
518
- ? "#B8B9BF"
519
- : contrastColor(props.$style.btnText)};
520
- }
521
- }
522
- }
523
- .fc .fc-button-primary:not(:disabled).fc-button-active:focus,
524
- .fc .fc-button-primary:not(:disabled):active:focus {
525
- box-shadow: none;
526
- }
527
- .fc-toolbar-chunk:nth-of-type(3) .fc-button-primary {
528
- height: 28px;
529
- display: inline-flex;
530
- font-size: 14px;
531
- margin-left: 8px;
532
- background-color: ${(props) => props.$style.headerBtnBackground};
533
- border-color: ${(props) =>
534
- backgroundToBorder(props.$style.headerBtnBackground)};
535
- color: ${(props) => props.$style.btnText};
536
- &.fc-today-button {
537
- min-width: 52px;
538
- }
539
- &.fc-prev-button,
540
- &.fc-next-button {
541
- padding: 0;
542
- width: 28px;
543
- color: ${(props) => lightenColor(props.$style.btnText, 0.4)};
544
- }
545
- &.fc-prev-button {
546
- margin-left: 12px;
547
- }
548
- }
549
- .fc-toolbar-chunk:nth-of-type(3) .fc-button-group {
550
- background-color: ${(props) =>
551
- toHex(props.$style.headerBtnBackground) === "#FFFFFF"
552
- ? "#EFEFF1"
553
- : isDarkColor(props.$style.headerBtnBackground)
554
- ? props.$style.headerBtnBackground
555
- : darkenColor(props.$style.headerBtnBackground, 0.1)};
556
- border-radius: 4px;
557
- margin-left: 16px;
558
- .fc-button-primary {
559
- background-color: transparent;
560
- min-width: 60px;
561
- border-radius: 4px;
562
- margin: 2px;
563
- border: none;
564
- color: ${(props) =>
565
- toHex(props.$style.btnText) === "#222222"
566
- ? "#8B8FA3"
567
- : lightenColor(props.$style.btnText, 0.4)};
568
- font-weight: 500;
569
-
570
- &.fc-button-active {
571
- background-color: ${(props) =>
572
- isDarkColor(props.$style.headerBtnBackground)
573
- ? lightenColor(props.$style.headerBtnBackground, 0.1)
574
- : props.$style.headerBtnBackground};
575
- color: ${(props) => props.$style.btnText};
576
- }
577
- }
578
- }
579
-
580
- // week head
581
- .fc-timeGridWeek-view {
582
- .week-head {
583
- display: flex;
584
- flex-direction: column;
585
- font-size: 14px;
586
- font-weight: 400;
587
- &.past span {
588
- opacity: 0.35;
589
- }
590
- .week {
591
- padding-bottom: 3px;
592
- }
593
- .day {
594
- font-size: 20px;
595
- font-weight: 500;
596
- line-height: 22px;
597
- }
598
- }
599
- .fc-day-today.fc-col-header-cell {
600
- background-color: ${(props) =>
601
- isDarkColor(props.$style.background)
602
- ? "#ffffff19"
603
- : toHex(props.$theme?.primary!) + "19"};
604
- a {
605
- color: ${(props) =>
606
- !isDarkColor(props.$style.background) &&
607
- darkenColor(props.$theme?.primary!, 0.1)};
608
- }
609
- }
610
- .fc-col-header-cell-cushion {
611
- padding: 8px 0 13px 0;
612
- }
613
- }
614
-
615
- // week left
616
- .fc .fc-timegrid-axis-cushion {
617
- min-width: 62px;
618
- min-height: 52px;
619
- max-width: none;
620
- display: inline-flex;
621
- align-items: center;
622
- justify-content: center;
623
- }
624
- .fc-direction-ltr .fc-timegrid-slot-label-frame {
625
- text-align: center;
626
- }
627
- .fc .fc-timegrid-slot-label {
628
- border: none;
629
- }
630
-
631
- // time can doubleClick
632
- .fc-timegrid-bg-harness,
633
- .fc-daygrid-day-bg {
634
- pointer-events: none;
635
- }
636
- `;
637
-
638
- export const Remove = styled.div<{ $isList: boolean }>`
639
- position: absolute;
640
- pointer-events: auto;
641
- top: 0;
642
- right: 0;
643
- display: flex;
644
- padding: 5px;
645
- opacity: 0;
646
- cursor: pointer;
647
- &:hover {
648
- g {
649
- stroke: #315efb;
650
- }
651
- }
652
- `;
653
-
654
- export const Event = styled.div<{
655
- $bg: string;
656
- theme: Object;
657
- $isList: boolean;
658
- $allDay: boolean;
659
- $style: CalendarStyleType;
660
- }>`
661
- height: 100%;
662
- width: 100%;
663
- pointer-events: none;
664
- border-radius: 4px;
665
- box-shadow: ${(props) => !props.$isList && "0 0 5px 0 rgba(0, 0, 0, 0.15)"};
666
- border: 1px solid ${(props) => props.$style.border};
667
- display: ${(props) => props.$isList && "flex"};
668
- background-color: ${(props) =>
669
- !props.$isList && lightenColor(props.$style.background, 0.1)};
670
- overflow: hidden;
671
- font-size: 13px;
672
- line-height: 19px;
673
- padding-right: 20px;
674
- overflow: hidden;
675
- position: relative;
676
- &::before {
677
- content: "";
678
- position: absolute;
679
- display: block;
680
- width: 5px;
681
- height: calc(100% - 4px);
682
- left: 2px;
683
- top: 2px;
684
- border-radius: 3px;
685
- background-color: ${(props) => props.$bg};
686
- }
687
-
688
- .event-time {
689
- color: ${(props) =>
690
- !props.$isList &&
691
- (isDarkColor(props.$style.text)
692
- ? lightenColor(props.$style.text, 0.2)
693
- : props.$style.text)};
694
- margin-left: 15px;
695
- white-space: pre-wrap;
696
- margin-top: 2px;
697
- }
698
- .event-title {
699
- color: ${(props) => !props.$isList && props.$style.text};
700
- font-weight: 500;
701
- margin-left: 15px;
702
- white-space: pre-wrap;
703
- word-break: break-word;
704
- }
705
-
706
- &.small {
707
- height: 20px;
708
- .event-time {
709
- display: none;
710
- }
711
- .event-title {
712
- text-overflow: ellipsis;
713
- overflow: hidden;
714
- white-space: nowrap;
715
- }
716
- }
717
- &.middle {
718
- padding-top: 2px;
719
- .event-time,
720
- .event-title {
721
- text-overflow: ellipsis;
722
- overflow: hidden;
723
- white-space: nowrap;
724
- }
725
- }
726
- &.large {
727
- .event-time {
728
- margin-top: 13px;
729
- }
730
- }
731
- &.past {
732
- background-color: ${(props) =>
733
- isDarkColor(props.$style.background) && props.$style.background};
734
- &::before {
735
- background-color: ${(props) =>
736
- toHex(props.$style.text) === "#3C3C3C"
737
- ? "#8B8FA3"
738
- : isDarkColor(props.$style.text)
739
- ? lightenColor(props.$style.text, 0.3)
740
- : props.$style.text};
741
- }
742
- &::before,
743
- .event-title,
744
- .event-time {
745
- opacity: 0.35;
746
- }
747
- }
748
- `;
749
-
750
- export const FormWrapper = styled(Form)`
751
- .ant-form-item-label {
752
- width: 100px;
753
- text-align: left;
754
- line-height: 18px;
755
- label:not(.ant-form-item-required) {
756
- margin-left: 11px;
757
- }
758
- label span {
759
- ${UnderlineCss}
760
- }
761
- }
762
- `;
763
-
764
- export type EventType = {
765
- id?: string;
766
- resourceId?: string;
767
- label?: string;
768
- title?: string;
769
- start?: string;
770
- end?: string;
771
- allDay?: boolean;
772
- color?: string;
773
- groupId?: string;
774
- value?: string;
775
- };
776
-
777
- export enum ViewType {
778
- YEAR = "multiMonthYear",
779
- MONTH = "dayGridMonth",
780
- WEEK = "timeGridWeek",
781
- DAY = "timeGridDay",
782
- DAYLIST = "dayGridDay",
783
- LIST = "listWeek",
784
- TIMEGRID = "timeGridDay",
785
- }
786
-
787
- export const DefaultWithPremiumViewOptions = [
788
- {
789
- label: trans("calendar.resourceTimeGridDay"),
790
- value: "resourceTimeGridDay",
791
- },
792
- {
793
- label: trans("calendar.timeline"),
794
- value: "resourceTimelineDay",
795
- },
796
- {
797
- label: trans("calendar.year"),
798
- value: "multiMonthYear",
799
- },
800
- {
801
- label: trans("calendar.month"),
802
- value: "dayGridMonth",
803
- },
804
- {
805
- label: trans("calendar.week"),
806
- value: "timeGridWeek",
807
- },
808
- {
809
- label: trans("calendar.weekdaygrid"),
810
- value: "dayGridWeek",
811
- },
812
- {
813
- label: trans("calendar.daygrid"),
814
- value: "dayGridDay",
815
- },
816
- {
817
- label: trans("calendar.day"),
818
- value: "timeGridDay",
819
- },
820
- {
821
- label: trans("calendar.list"),
822
- value: "listWeek",
823
- },
824
- ] as const;
825
-
826
- export const DefaultWithFreeViewOptions = [
827
- {
828
- label: trans("calendar.year"),
829
- value: "multiMonthYear",
830
- },
831
- {
832
- label: trans("calendar.month"),
833
- value: "dayGridMonth",
834
- },
835
- {
836
- label: trans("calendar.week"),
837
- value: "timeGridWeek",
838
- },
839
- {
840
- label: trans("calendar.weekdaygrid"),
841
- value: "dayGridWeek",
842
- },
843
- {
844
- label: trans("calendar.daygrid"),
845
- value: "dayGridDay",
846
- },
847
- {
848
- label: trans("calendar.day"),
849
- value: "timeGridDay",
850
- },
851
- {
852
- label: trans("calendar.list"),
853
- value: "listWeek",
854
- },
855
- ] as const;
856
-
857
- export const FirstDayOptions = [
858
- {
859
- label: trans("calendar.monday"),
860
- value: "1",
861
- },
862
- {
863
- label: trans("calendar.tuesday"),
864
- value: "2",
865
- },
866
- {
867
- label: trans("calendar.wednesday"),
868
- value: "3",
869
- },
870
- {
871
- label: trans("calendar.thursday"),
872
- value: "4",
873
- },
874
- {
875
- label: trans("calendar.friday"),
876
- value: "5",
877
- },
878
- {
879
- label: trans("calendar.saturday"),
880
- value: "6",
881
- },
882
- {
883
- label: trans("calendar.sunday"),
884
- value: "0",
885
- },
886
- ];
887
-
888
- export const defaultData = [
889
- {
890
- id: "1",
891
- title: "Coding",
892
- start: dayjs().hour(10).minute(0).second(0).format(DATE_TIME_FORMAT),
893
- end: dayjs().hour(12).minute(30).second(0).format(DATE_TIME_FORMAT),
894
- color: "#079968",
895
- },
896
- {
897
- id: "2",
898
- title: "Rest",
899
- start: dayjs().hour(24).format(DATE_FORMAT),
900
- end: dayjs().hour(48).format(DATE_FORMAT),
901
- allDay: true,
902
- },
903
- ];
904
- export const resourcesEventsDefaultData = [
905
- {
906
- id: "1",
907
- resourceId: "d1",
908
- title: "event 1",
909
- start: dayjs().hour(10).minute(0).second(0).format(DATE_TIME_FORMAT),
910
- end: dayjs().hour(17).minute(30).second(0).format(DATE_TIME_FORMAT),
911
- color: "#079968",
912
- },
913
- {
914
- id: "2",
915
- resourceId: "b",
916
- title: "event 5",
917
- start: dayjs().hour(8).minute(0).second(0).format(DATE_TIME_FORMAT),
918
- end: dayjs().hour(16).minute(30).second(0).format(DATE_TIME_FORMAT),
919
- color: "#079968",
920
- },
921
- {
922
- id: "3",
923
- resourceId: "a",
924
- title: "event 3",
925
- start: dayjs().hour(12).minute(0).second(0).format(DATE_TIME_FORMAT),
926
- end: dayjs().hour(21).minute(30).second(0).format(DATE_TIME_FORMAT),
927
- color: "#079968",
928
- },
929
- ];
930
-
931
- export const resourcesDefaultData = [
932
- {
933
- id: "a",
934
- title: "Auditorium A",
935
- },
936
- {
937
- id: "b",
938
- title: "Auditorium B",
939
- eventColor: "green",
940
- },
941
- {
942
- id: "d",
943
- title: "Auditorium D",
944
- children: [
945
- {
946
- id: "d1",
947
- title: "Room D1",
948
- },
949
- {
950
- id: "d2",
951
- title: "Room D2",
952
- },
953
- ],
954
- },
955
- ];
956
-
957
- export const buttonText = {
958
- today: trans("calendar.today"),
959
- month: trans("calendar.month"),
960
- week: trans("calendar.week"),
961
- timeline: trans("calendar.timeline"),
962
- day: trans("calendar.day"),
963
- list: trans("calendar.list"),
964
- };
965
-
966
- export const headerToolbar = {
967
- left: "title",
968
- right: "prev today next dayGridMonth,timeGridWeek,timeGridDay,listWeek",
969
- };
970
-
971
- export const resourceTimeLineHeaderToolbar = {
972
- left: "title",
973
- right:
974
- "prev today next resourceTimelineMonth,resourceTimelineWeek,resourceTimelineDay",
975
- };
976
- export const resourceTimeGridHeaderToolbar = {
977
- left: "title",
978
- right: "prev today next",
979
- };
980
-
981
- const weekHeadContent = (info: DayHeaderContentArg) => {
982
- const text = info.text.split(" ");
983
- return {
984
- html: `<span class="week-head ${info.isPast && "past"} ${
985
- info.isToday && "today"
986
- }">
987
- <span class="week">${text[0]}</span>
988
- <span class="day">${text[1]}</span>
989
- </span>`,
990
- };
991
- };
992
-
993
- const leftTimeContent = (info: SlotLabelContentArg) => {
994
- let isPast = false;
995
- if (info.view.type === ViewType.WEEK) {
996
- isPast = dayjs().isAfter(dayjs(dayjs().format("YYYY MM DD " + info.text)));
997
- } else if (info.view.type === ViewType.DAY) {
998
- isPast = dayjs().isAfter(
999
- dayjs(dayjs(info.view.activeStart).format("YYYY MM DD " + info.text))
1000
- );
1001
- }
1002
- return {
1003
- html: `<span class="time ${isPast && "past"}">${info.text}</span>`,
1004
- };
1005
- };
1006
-
1007
- export const views = {
1008
- [ViewType.WEEK]: {
1009
- dayHeaderFormat: "ddd DD",
1010
- dayHeaderContent: (info: DayHeaderContentArg) => weekHeadContent(info),
1011
- slotLabelContent: (info: SlotLabelContentArg) => leftTimeContent(info),
1012
- },
1013
- [ViewType.DAY]: {
1014
- slotLabelContent: (info: SlotLabelContentArg) => leftTimeContent(info),
1015
- },
1016
- [ViewType.LIST]: {
1017
- listDayFormat: { weekday: "short" },
1018
- },
1019
- } as const;
1020
-
1021
- export const slotLabelFormat = [
1022
- {
1023
- hour: "2-digit",
1024
- minute: "2-digit",
1025
- },
1026
- ] as FormatterInput[];
1027
-
1028
- export const slotLabelFormatWeek = [
1029
- { week: "short" },
1030
- { hour: "2-digit" },
1031
- ] as FormatterInput[];
1032
-
1033
- export const slotLabelFormatMonth = [
1034
- { week: "short" },
1035
- { weekday: "short" }
1036
- ] as FormatterInput[];
1037
-
1038
- export const viewClassNames = (info: ViewContentArg) => {
1039
- let className = "";
1040
- if ([ViewType.WEEK, ViewType.DAY].includes(info.view.type as ViewType)) {
1041
- if (dayjs().isAfter(info.view.activeEnd)) {
1042
- className = "past";
1043
- } else if (dayjs().isBefore(info.view.activeStart)) {
1044
- className = "future";
1045
- }
1046
- }
1047
- return className;
1048
- };