@jsb188/calendar 1.1.10 → 1.1.11

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.
@@ -0,0 +1,370 @@
1
+ import { cn } from '@jsb188/app/utils/string.ts';
2
+ import { Icon } from '@jsb188/react-web/svgs/Icon';
3
+ import { DateTime } from 'luxon';
4
+ import { type MouseEvent, memo, useCallback, useMemo } from 'react';
5
+ import {
6
+ getCalendarTimeZone,
7
+ normalizeCalendarWeekStartsOn,
8
+ } from '../libs/calendar-range.ts';
9
+
10
+ /**
11
+ * A month at a glance.
12
+ *
13
+ * Standalone on purpose: it reads nothing from the rest of this package — no
14
+ * range math, no atoms, no CalendarDayObj — so it drops into a sidebar, a date
15
+ * picker, or a surface that never imports the calendar grid at all. It draws
16
+ * the month itself from a single date and reports clicks back out; every other
17
+ * decision is a prop.
18
+ *
19
+ * Days are addressed by their local date key ("yyyy-MM-dd") rather than by
20
+ * Date, so a caller asking "is this day selected" never has to reason about
21
+ * instants and zones, which disagree about which day it is.
22
+ */
23
+
24
+ const FILE_CONSTANTS = {
25
+ // Six rows always, never five: a grid that changed height between months
26
+ // would make everything below it jump on every step
27
+ weekCount: 6,
28
+ dateFormat: 'yyyy-MM-dd',
29
+ daySize: 26,
30
+ headerStyle: { marginBottom: 6 },
31
+ gridStyle: {
32
+ display: 'grid' as const,
33
+ gridTemplateColumns: 'repeat(7, minmax(0, 1fr))',
34
+ },
35
+ columnLabelStyle: { paddingBottom: 2 },
36
+ };
37
+
38
+ /*
39
+ * One drawn cell.
40
+ */
41
+
42
+ interface MiniCalendarDayObj {
43
+ dateKey: string;
44
+ // Day of month, localized
45
+ label: string;
46
+ // False for the leading and trailing days of the neighbouring months
47
+ isInMonth: boolean;
48
+ }
49
+
50
+ /*
51
+ * Build the six-by-seven grid a month is drawn on, padded at both ends so the
52
+ * 1st lands under its own weekday column.
53
+ */
54
+
55
+ function buildMiniCalendarWeeks(p: {
56
+ monthDate: Date;
57
+ timeZone?: string | null;
58
+ locale?: string | null;
59
+ weekStartsOn: number;
60
+ }): MiniCalendarDayObj[][] {
61
+ const { monthDate, timeZone, locale, weekStartsOn } = p;
62
+ const monthStart = DateTime.fromJSDate(monthDate, {
63
+ zone: timeZone || undefined,
64
+ })
65
+ .setLocale(locale || 'en')
66
+ .startOf('month');
67
+ // luxon: 1 = Monday .. 7 = Sunday; normalize to 0 = Sunday
68
+ const gridStart = monthStart.minus({
69
+ days: ((monthStart.weekday % 7) - weekStartsOn + 7) % 7,
70
+ });
71
+ const weeks: MiniCalendarDayObj[][] = [];
72
+
73
+ for (let weekIndex = 0; weekIndex < FILE_CONSTANTS.weekCount; weekIndex++) {
74
+ const week: MiniCalendarDayObj[] = [];
75
+
76
+ for (let dayIndex = 0; dayIndex < 7; dayIndex++) {
77
+ const day = gridStart.plus({ days: weekIndex * 7 + dayIndex });
78
+
79
+ week.push({
80
+ dateKey: day.toFormat(FILE_CONSTANTS.dateFormat),
81
+ label: day.toFormat('d'),
82
+ isInMonth:
83
+ day.month === monthStart.month && day.year === monthStart.year,
84
+ });
85
+ }
86
+
87
+ weeks.push(week);
88
+ }
89
+
90
+ return weeks;
91
+ }
92
+
93
+ /*
94
+ * Return the text treatment one day gets. A selected day takes its colour from
95
+ * the fill behind it, so it opts out of all three.
96
+ */
97
+
98
+ function getMiniCalendarDayColorClassName(p: {
99
+ isSelected: boolean;
100
+ isToday: boolean;
101
+ isInMonth: boolean;
102
+ }): string {
103
+ if (p.isSelected) {
104
+ return '';
105
+ }
106
+
107
+ if (p.isToday) {
108
+ return 'cl_primary ft_bold';
109
+ }
110
+
111
+ // A leading or trailing day belongs to the neighbouring month; dimmed, not
112
+ // hidden, so the week it sits in still reads as a week
113
+ return p.isInMonth ? 'cl_md' : 'cl_lt';
114
+ }
115
+
116
+ export interface MiniCalendarProps {
117
+ className?: string;
118
+ // Any instant inside the month to draw
119
+ monthDate: Date;
120
+ timeZone?: string | null;
121
+ locale?: string | null;
122
+ // 0 = Sunday .. 6 = Saturday
123
+ weekStartsOn?: number;
124
+ // The heading above the grid. Absent, and with no stepper, the header row
125
+ // is not drawn at all, so a caller that titles its own panel gets only the
126
+ // month.
127
+ title?: string | null;
128
+ // Column headings; derived from the locale when not supplied
129
+ weekdayLabels?: string[];
130
+ // Days drawn as chosen: a solid filled square
131
+ selectedDateKeys?: string[];
132
+ // Days drawn as the range currently on screen: a faint band behind the row.
133
+ // Any run of them is joined, so a week reads as one band and four days read
134
+ // as one shorter band, without the caller saying which shape it meant.
135
+ highlightedDateKeys?: string[];
136
+ // The day marked as today, passed in rather than read from the system
137
+ // clock, so this agrees with whatever zone its owner draws in
138
+ todayDateKey?: string | null;
139
+ // Leading and trailing days of the neighbouring months, dimmed. Off leaves
140
+ // those cells empty so the month reads as its own block.
141
+ showAdjacentMonthDays?: boolean;
142
+ // Edge of one day square, in pixels
143
+ daySize?: number;
144
+ // Display strings; the package owns no copy of its own
145
+ previousText?: string;
146
+ nextText?: string;
147
+ // The two paint states, so a caller can theme the grid without forking it
148
+ selectedClassName?: string;
149
+ highlightClassName?: string;
150
+ // Absent means no stepper is drawn, for a grid somebody else navigates
151
+ onStepMonth?: (direction: 1 | -1) => void;
152
+ onSelectDay?: (dateKey: string) => void;
153
+ }
154
+
155
+ export const MiniCalendar = memo((p: MiniCalendarProps) => {
156
+ const {
157
+ className,
158
+ monthDate,
159
+ timeZone,
160
+ locale,
161
+ weekStartsOn,
162
+ title,
163
+ weekdayLabels,
164
+ selectedDateKeys,
165
+ highlightedDateKeys,
166
+ todayDateKey,
167
+ showAdjacentMonthDays,
168
+ daySize,
169
+ previousText,
170
+ nextText,
171
+ selectedClassName,
172
+ highlightClassName,
173
+ onStepMonth,
174
+ onSelectDay,
175
+ } = p;
176
+
177
+ const resolvedTimeZone = getCalendarTimeZone(timeZone);
178
+ const weekStart = normalizeCalendarWeekStartsOn(weekStartsOn);
179
+ const size = daySize || FILE_CONSTANTS.daySize;
180
+ const cellStyle = useMemo(() => ({ height: size + 4 }), [size]);
181
+ const dayStyle = useMemo(() => ({ width: size, height: size }), [size]);
182
+
183
+ // The grid only changes when the date crosses into another month, so it is
184
+ // keyed on the month rather than the instant: a caller passing a live clock
185
+ // would otherwise rebuild all 42 cells on every tick
186
+ const monthKey = useMemo(
187
+ () =>
188
+ DateTime.fromJSDate(monthDate, { zone: resolvedTimeZone }).toFormat(
189
+ 'yyyy-MM',
190
+ ),
191
+ [monthDate, resolvedTimeZone],
192
+ );
193
+
194
+ const weeks = useMemo(
195
+ // "monthDate" is read inside but "monthKey" is the dependency; see above
196
+ () =>
197
+ buildMiniCalendarWeeks({
198
+ monthDate,
199
+ timeZone: resolvedTimeZone,
200
+ locale,
201
+ weekStartsOn: weekStart,
202
+ }),
203
+ [monthKey, resolvedTimeZone, locale, weekStart],
204
+ );
205
+
206
+ /*
207
+ * Column headings, built from a real week so they honour the locale and the
208
+ * configured week start rather than a hardcoded list.
209
+ */
210
+
211
+ const columnLabels = useMemo(() => {
212
+ if (weekdayLabels) {
213
+ return weekdayLabels;
214
+ }
215
+
216
+ // Any Sunday; 2026-01-04 is one
217
+ const sunday = DateTime.fromObject(
218
+ { year: 2026, month: 1, day: 4 },
219
+ { zone: resolvedTimeZone },
220
+ ).setLocale(locale || 'en');
221
+
222
+ return Array.from({ length: 7 }, (_unused, index) =>
223
+ sunday
224
+ .plus({ days: index + weekStart })
225
+ .toFormat('ccc')
226
+ .slice(0, 2),
227
+ );
228
+ }, [weekdayLabels, resolvedTimeZone, locale, weekStart]);
229
+
230
+ // Membership is asked 42 times per render, so the lists become sets once
231
+ const selectedSet = useMemo(
232
+ () => new Set(selectedDateKeys || []),
233
+ [selectedDateKeys],
234
+ );
235
+ const highlightedSet = useMemo(
236
+ () => new Set(highlightedDateKeys || []),
237
+ [highlightedDateKeys],
238
+ );
239
+
240
+ /*
241
+ * Move to the month represented by the clicked step action.
242
+ */
243
+ const handleStepMonth = useCallback(
244
+ (event: MouseEvent<HTMLButtonElement>) => {
245
+ onStepMonth?.(
246
+ event.currentTarget.dataset.direction === 'PREVIOUS' ? -1 : 1,
247
+ );
248
+ },
249
+ [onStepMonth],
250
+ );
251
+
252
+ /*
253
+ * Report the date stored on the clicked day without allocating one callback
254
+ * for every day cell.
255
+ */
256
+ const handleSelectDay = useCallback(
257
+ (event: MouseEvent<HTMLButtonElement>) => {
258
+ const dateKey = event.currentTarget.dataset.dateKey;
259
+ if (dateKey) {
260
+ onSelectDay?.(dateKey);
261
+ }
262
+ },
263
+ [onSelectDay],
264
+ );
265
+
266
+ return (
267
+ <div className={cn('unsel', className)}>
268
+ {title || onStepMonth ? (
269
+ <div className="h_spread" style={FILE_CONSTANTS.headerStyle}>
270
+ <span className="f ellip ft_sm ft_bold cl_md">{title || ''}</span>
271
+
272
+ {onStepMonth ? (
273
+ <span className="h_item no_shrink">
274
+ {/* No IconButton exists in the kit, so these are the
275
+ documented raw pattern: a bare button wrapping an
276
+ Icon. The sprite has no chevron-left, so the
277
+ previous arrow is the right one turned around. */}
278
+ <button
279
+ type="button"
280
+ className="av_sm h_center tf_rotate_180"
281
+ aria-label={previousText}
282
+ title={previousText}
283
+ data-direction="PREVIOUS"
284
+ onClick={handleStepMonth}
285
+ >
286
+ <Icon name="chevron-right" />
287
+ </button>
288
+
289
+ <button
290
+ type="button"
291
+ className="av_sm h_center"
292
+ aria-label={nextText}
293
+ title={nextText}
294
+ data-direction="NEXT"
295
+ onClick={handleStepMonth}
296
+ >
297
+ <Icon name="chevron-right" />
298
+ </button>
299
+ </span>
300
+ ) : null}
301
+ </div>
302
+ ) : null}
303
+
304
+ <div style={FILE_CONSTANTS.gridStyle}>
305
+ {columnLabels.map((label, index) => (
306
+ <div
307
+ key={index}
308
+ className="a_c ft_tn cl_lt"
309
+ style={FILE_CONSTANTS.columnLabelStyle}
310
+ >
311
+ {label}
312
+ </div>
313
+ ))}
314
+ </div>
315
+
316
+ {weeks.map((week, weekIndex) => (
317
+ <div key={weekIndex} style={FILE_CONSTANTS.gridStyle}>
318
+ {week.map((day, dayIndex) => {
319
+ const isHighlighted = highlightedSet.has(day.dateKey);
320
+ const isSelected = selectedSet.has(day.dateKey);
321
+ const isDrawn = day.isInMonth || !!showAdjacentMonthDays;
322
+
323
+ return (
324
+ <div
325
+ key={day.dateKey}
326
+ className={cn(
327
+ 'h_center',
328
+ isHighlighted ? highlightClassName || 'bg_alt' : '',
329
+ // Only the ends of a run are rounded, so a highlighted
330
+ // week reads as one band rather than seven pills
331
+ isHighlighted &&
332
+ !highlightedSet.has(week[dayIndex - 1]?.dateKey || '')
333
+ ? 'rl_df'
334
+ : '',
335
+ isHighlighted &&
336
+ !highlightedSet.has(week[dayIndex + 1]?.dateKey || '')
337
+ ? 'rr_df'
338
+ : '',
339
+ )}
340
+ style={cellStyle}
341
+ >
342
+ {isDrawn ? (
343
+ <button
344
+ type="button"
345
+ className={cn(
346
+ 'h_center ft_sm r_df',
347
+ isSelected
348
+ ? selectedClassName || 'bg_primary'
349
+ : 'bg_active_hv',
350
+ getMiniCalendarDayColorClassName({
351
+ isSelected,
352
+ isToday: day.dateKey === todayDateKey,
353
+ isInMonth: day.isInMonth,
354
+ }),
355
+ )}
356
+ data-date-key={day.dateKey}
357
+ style={dayStyle}
358
+ onClick={handleSelectDay}
359
+ >
360
+ {day.label}
361
+ </button>
362
+ ) : null}
363
+ </div>
364
+ );
365
+ })}
366
+ </div>
367
+ ))}
368
+ </div>
369
+ );
370
+ });
@@ -31,23 +31,34 @@ export interface CalendarAgendaUIProps {
31
31
  }
32
32
 
33
33
  export const CalendarAgendaUI = memo((p: CalendarAgendaUIProps) => {
34
- const { days, selectedEventId, timeLabelByEventId, emptyText, onSelectEvent } = p;
34
+ const {
35
+ days,
36
+ selectedEventId,
37
+ timeLabelByEventId,
38
+ emptyText,
39
+ onSelectEvent,
40
+ } = p;
35
41
 
36
42
  if (!days.length) {
37
43
  return (
38
- <div className='f h_0 v_center a_c'>
39
- <span className='ft_sm cl_lt'>{emptyText}</span>
44
+ <div className="f h_0 v_center a_c">
45
+ <span className="ft_sm cl_lt">{emptyText}</span>
40
46
  </div>
41
47
  );
42
48
  }
43
49
 
44
50
  return (
45
- <div className='f h_0 app_scr auto_y'>
51
+ <div className="f h_0 app_scr auto_y">
46
52
  {days.map((day) => (
47
- <div key={day.dateKey} className='bd_t_1 bd_t_bd'>
53
+ <div key={day.dateKey} className="bd_t_1 bd_t_bd">
48
54
  <div
49
55
  className={cn('ft_tn', day.isToday ? 'ft_bold' : 'cl_lt')}
50
- style={{ paddingLeft: 12, paddingRight: 12, paddingTop: 6, paddingBottom: 2 }}
56
+ style={{
57
+ paddingLeft: 12,
58
+ paddingRight: 12,
59
+ paddingTop: 6,
60
+ paddingBottom: 2,
61
+ }}
51
62
  >
52
63
  {day.label}
53
64
  </div>
@@ -55,28 +66,37 @@ export const CalendarAgendaUI = memo((p: CalendarAgendaUIProps) => {
55
66
  {day.events.map((event) => (
56
67
  <button
57
68
  key={`${day.dateKey}:${event.id}`}
58
- type='button'
69
+ type="button"
59
70
  className={cn(
60
71
  'w_f a_l h_item gap_sm',
61
72
  event.status === 'CANCELED' ? 'strikethrough' : '',
62
73
  selectedEventId === event.id ? 'bg_active' : '',
63
74
  )}
64
- style={{ paddingLeft: 12, paddingRight: 12, paddingTop: 4, paddingBottom: 4 }}
75
+ style={{
76
+ paddingLeft: 12,
77
+ paddingRight: 12,
78
+ paddingTop: 4,
79
+ paddingBottom: 4,
80
+ }}
65
81
  onClick={() => onSelectEvent(event.id)}
66
82
  >
67
83
  <span
68
84
  className={cn(
69
85
  'no_shrink ft_tn cl_lt rel of',
70
- event.status === 'DRAFT' ? CALENDAR_DRAFT_PATTERN_CLASS_NAME : '',
86
+ event.status === 'DRAFT'
87
+ ? CALENDAR_DRAFT_PATTERN_CLASS_NAME
88
+ : '',
71
89
  )}
72
90
  style={{ width: 104 }}
73
91
  >
74
92
  {timeLabelByEventId.get(event.id) || ''}
75
93
  </span>
76
94
 
77
- <span className='f ellip ft_sm'>{event.title}</span>
95
+ <span className="f ellip ft_sm">{event.title}</span>
78
96
 
79
- {event.isMine ? <span className='no_shrink ft_tn cl_lt'>•</span> : null}
97
+ {event.isMine ? (
98
+ <span className="no_shrink ft_tn cl_lt">•</span>
99
+ ) : null}
80
100
  </button>
81
101
  ))}
82
102
  </div>
@@ -107,54 +107,81 @@ export const CalendarCoverageUI = memo((p: CalendarCoverageUIProps) => {
107
107
 
108
108
  if (!rows.length || !buckets.length) {
109
109
  return (
110
- <div className='f h_0 v_center a_c'>
111
- <span className='ft_sm cl_lt'>{emptyText}</span>
110
+ <div className="f h_0 v_center a_c">
111
+ <span className="ft_sm cl_lt">{emptyText}</span>
112
112
  </div>
113
113
  );
114
114
  }
115
115
 
116
116
  // The board is wider than its container by design; the scroller needs a
117
117
  // real width to scroll to, and both sticky edges hang off it
118
- const boardWidth = resourceColumnWidth + (buckets.length * bucketWidth);
118
+ const boardWidth = resourceColumnWidth + buckets.length * bucketWidth;
119
119
 
120
120
  return (
121
- <div className='f h_0 w_f app_scr of_x auto_x auto_y'>
122
- <div className='v_stretch' style={{ width: boardWidth }}>
121
+ <div className="f h_0 w_f app_scr of_x auto_x auto_y">
122
+ <div className="v_stretch" style={{ width: boardWidth }}>
123
123
  <div
124
- className='no_shrink h_item sticky bg bd_b_1 bd_b_bd'
124
+ className="no_shrink h_item sticky bg bd_b_1 bd_b_bd"
125
125
  style={{ top: 0, zIndex: 30 }}
126
126
  >
127
127
  <div
128
- className='no_shrink v_stretch sticky bg ellip bd_r_1 bd_r_bd'
129
- style={{ left: 0, width: resourceColumnWidth, zIndex: 20, paddingLeft: 8 }}
128
+ className="no_shrink v_stretch sticky bg ellip bd_r_1 bd_r_bd"
129
+ style={{
130
+ left: 0,
131
+ width: resourceColumnWidth,
132
+ zIndex: 20,
133
+ paddingLeft: 8,
134
+ }}
130
135
  >
131
- <span className='ellip ft_tn cl_lt'>{resourceHeaderText}</span>
136
+ <span className="ellip ft_tn cl_lt">{resourceHeaderText}</span>
132
137
  </div>
133
138
 
134
139
  {buckets.map((bucket) => (
135
140
  <div
136
141
  key={bucket.key}
137
- className={cn('no_shrink v_stretch a_c of', bucket.isMuted ? 'bg_alt' : '')}
142
+ className={cn(
143
+ 'no_shrink v_stretch a_c of',
144
+ bucket.isMuted ? 'bg_alt' : '',
145
+ )}
138
146
  style={{ width: bucketWidth, paddingTop: 3, paddingBottom: 3 }}
139
147
  >
140
- <span className={cn('ellip ft_tn', bucket.isMuted ? 'cl_lt' : 'cl_md')}>
148
+ <span
149
+ className={cn(
150
+ 'ellip ft_tn',
151
+ bucket.isMuted ? 'cl_lt' : 'cl_md',
152
+ )}
153
+ >
141
154
  {bucket.label}
142
155
  </span>
143
156
 
144
- {bucket.subLabel ? <span className='ellip ft_tn cl_lt'>{bucket.subLabel}</span> : null}
157
+ {bucket.subLabel ? (
158
+ <span className="ellip ft_tn cl_lt">{bucket.subLabel}</span>
159
+ ) : null}
145
160
  </div>
146
161
  ))}
147
162
  </div>
148
163
 
149
164
  {rows.map((row) => (
150
- <div key={row.resourceId} className='no_shrink h_item bd_b_1 bd_b_bd' style={{ height: rowHeight }}>
165
+ <div
166
+ key={row.resourceId}
167
+ className="no_shrink h_item bd_b_1 bd_b_bd"
168
+ style={{ height: rowHeight }}
169
+ >
151
170
  <div
152
- className='no_shrink v_center h_f sticky bg of bd_r_1 bd_r_bd'
153
- style={{ left: 0, width: resourceColumnWidth, zIndex: 20, paddingLeft: 8, paddingRight: 6 }}
171
+ className="no_shrink v_center h_f sticky bg of bd_r_1 bd_r_bd"
172
+ style={{
173
+ left: 0,
174
+ width: resourceColumnWidth,
175
+ zIndex: 20,
176
+ paddingLeft: 8,
177
+ paddingRight: 6,
178
+ }}
154
179
  >
155
- <span className='w_f ellip ft_tn'>{row.name}</span>
180
+ <span className="w_f ellip ft_tn">{row.name}</span>
156
181
 
157
- {row.subName ? <span className='w_f ellip ft_tn cl_lt'>{row.subName}</span> : null}
182
+ {row.subName ? (
183
+ <span className="w_f ellip ft_tn cl_lt">{row.subName}</span>
184
+ ) : null}
158
185
  </div>
159
186
 
160
187
  {row.cells.map((cell) => {
@@ -162,28 +189,44 @@ export const CalendarCoverageUI = memo((p: CalendarCoverageUIProps) => {
162
189
  // severity only decides how loudly it is said
163
190
  const isShort = !cell.isEmpty && cell.actual < cell.required;
164
191
  const isBlocking = isShort && cell.severity === 'BLOCK';
165
- const isSelected = !!selectedViolationKey && cell.violationKey === selectedViolationKey;
192
+ const isSelected =
193
+ !!selectedViolationKey &&
194
+ cell.violationKey === selectedViolationKey;
166
195
 
167
196
  return (
168
197
  <button
169
198
  key={cell.key}
170
- type='button'
199
+ type="button"
171
200
  className={cn(
172
201
  'no_shrink h_center h_f rel bd_l_1 bd_l_bd',
173
- isBlocking ? 'bg_red_alt_lt' : isShort ? 'bg_amber_alt_lt' : '',
202
+ isBlocking
203
+ ? 'bg_red_alt_lt'
204
+ : isShort
205
+ ? 'bg_amber_alt_lt'
206
+ : '',
174
207
  // The stripe needs a relative parent and a colour
175
208
  // for its overlay; `medium_bf` is the neutral one
176
- cell.isDraft ? `${CALENDAR_DRAFT_PATTERN_CLASS_NAME} medium_bf` : '',
209
+ cell.isDraft
210
+ ? `${CALENDAR_DRAFT_PATTERN_CLASS_NAME} medium_bf`
211
+ : '',
177
212
  isSelected ? 'ol_primary' : '',
178
213
  )}
179
214
  style={{ width: bucketWidth }}
180
- onClick={onSelectCell ? () => onSelectCell(row.resourceId, cell) : undefined}
215
+ onClick={
216
+ onSelectCell
217
+ ? () => onSelectCell(row.resourceId, cell)
218
+ : undefined
219
+ }
181
220
  >
182
221
  {/* Positioned so it paints above the stripe overlay */}
183
222
  <span
184
223
  className={cn(
185
224
  'rel ellip ft_tn',
186
- isBlocking ? 'cl_err ft_bold' : isShort ? 'cl_warn ft_bold' : 'cl_md',
225
+ isBlocking
226
+ ? 'cl_err ft_bold'
227
+ : isShort
228
+ ? 'cl_warn ft_bold'
229
+ : 'cl_md',
187
230
  )}
188
231
  >
189
232
  {cell.isEmpty ? '' : countText(cell.actual, cell.required)}