@navette-js/infolists 1.0.0-beta.3 → 1.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +334 -56
- package/lib/index.js +891 -137
- package/package.json +3 -3
package/lib/index.d.ts
CHANGED
|
@@ -1,103 +1,341 @@
|
|
|
1
|
-
import { Component, type ComponentContext } from '@navette-js/schemas';
|
|
2
|
-
import { type ColorManager } from '@navette-js/support';
|
|
1
|
+
import { Component, type ComponentContext, type Renderable } from '@navette-js/schemas';
|
|
2
|
+
import { HtmlString, type AttrValue, type ClassList, type ColorManager, type Lazy } from '@navette-js/support';
|
|
3
3
|
export declare const useColorManager: (manager: ColorManager) => void;
|
|
4
|
+
type AttrMap = Record<string, AttrValue>;
|
|
5
|
+
/** Option that may depend on the record and on the state item. */
|
|
6
|
+
export type PerItem<T> = T | ((record: any, state: unknown) => T);
|
|
7
|
+
/** `icon()` / `color()` of an icon entry: a value, a map of state values, or a function. */
|
|
8
|
+
export type StateMap<T> = PerItem<T> | Record<string, T>;
|
|
9
|
+
/** PHP `date()` format (`M j, Y`, `d/m/Y H:i`…), with English month and day names. A backslash escapes a character. */
|
|
10
|
+
export declare function formatPhpDate(date: Date, format: string, timeZone?: string): string;
|
|
11
|
+
/** Carbon `isoFormat()` format (`L`, `LLL`, `dddd D MMMM YYYY`…), in English. Text in `[brackets]` is kept as is. */
|
|
12
|
+
export declare function formatIsoDate(date: Date, format: string, timeZone?: string): string;
|
|
13
|
+
/** Content of an entry slot: a schema component, an action, a text (escaped) or an `HtmlString` (inserted as is). */
|
|
14
|
+
export type EntrySlotItem = Component | Renderable | string | HtmlString;
|
|
15
|
+
type SlotValue = EntrySlotItem | EntrySlotItem[] | null;
|
|
16
|
+
export type EntrySlot = SlotValue | ((ctx: ComponentContext) => SlotValue | Promise<SlotValue>);
|
|
17
|
+
type SlotName = 'aboveLabel' | 'belowLabel' | 'beforeLabel' | 'afterLabel' | 'aboveContent' | 'belowContent' | 'beforeContent' | 'afterContent';
|
|
4
18
|
/** Base entry: a label and a value read from the record (dotted paths allowed) or computed. */
|
|
5
19
|
declare abstract class Entry extends Component {
|
|
6
|
-
protected _label: string | null
|
|
20
|
+
protected _label: Lazy<string | null, ComponentContext>;
|
|
7
21
|
protected _state: ((ctx: ComponentContext) => unknown | Promise<unknown>) | null;
|
|
22
|
+
protected _default: unknown;
|
|
23
|
+
protected _hiddenLabel: Lazy<boolean, ComponentContext>;
|
|
24
|
+
protected _placeholder: string | null;
|
|
25
|
+
protected _url: Lazy<string | null, ComponentContext>;
|
|
26
|
+
protected _openUrlInNewTab: Lazy<boolean, ComponentContext>;
|
|
27
|
+
protected _tooltip: PerItem<string | null>;
|
|
28
|
+
protected _emptyTooltip: string | null;
|
|
29
|
+
protected _inlineLabel: Lazy<boolean, ComponentContext>;
|
|
30
|
+
protected _alignment: Lazy<string | null, ComponentContext>;
|
|
31
|
+
protected _hiddenJs: string | null;
|
|
32
|
+
protected _visibleJs: string | null;
|
|
33
|
+
protected _extraEntryWrapperAttributes: Record<string, string>;
|
|
34
|
+
protected _slots: Partial<Record<SlotName, EntrySlot>>;
|
|
8
35
|
constructor(name: string);
|
|
9
36
|
hasStatePath(): boolean;
|
|
10
|
-
|
|
11
|
-
|
|
37
|
+
/** Label: a string or a function of the context. Escaped when rendered. */
|
|
38
|
+
label(label: Lazy<string | null, ComponentContext>): this;
|
|
12
39
|
/** Keeps the label for screen readers only. */
|
|
13
|
-
hiddenLabel(condition?: boolean): this;
|
|
40
|
+
hiddenLabel(condition?: Lazy<boolean, ComponentContext>): this;
|
|
14
41
|
/** Computed value; without it, the record attribute of the same name is shown. */
|
|
15
42
|
state(resolver: (ctx: ComponentContext) => unknown | Promise<unknown>): this;
|
|
43
|
+
/** State used when the real state is `null` or `undefined`; it is displayed as if it were real. */
|
|
44
|
+
default(state: unknown): this;
|
|
45
|
+
/** Gray text shown when the state is empty. */
|
|
46
|
+
placeholder(text: string | null): this;
|
|
47
|
+
/** Makes the content a link. Only `http(s)`, `mailto` and relative URLs are rendered: any other scheme is ignored. */
|
|
48
|
+
url(url: Lazy<string | null, ComponentContext>, openInNewTab?: Lazy<boolean, ComponentContext> | null): this;
|
|
49
|
+
openUrlInNewTab(condition?: Lazy<boolean, ComponentContext>): this;
|
|
50
|
+
/** Tooltip on the content: a string, or a function of the record and the state item. */
|
|
51
|
+
tooltip(tooltip: PerItem<string | null>): this;
|
|
52
|
+
/** Tooltip shown on the content when the state is empty. */
|
|
53
|
+
emptyTooltip(tooltip: string | null): this;
|
|
54
|
+
/** Label next to the content instead of above it (from the `sm` breakpoint). */
|
|
55
|
+
inlineLabel(condition?: Lazy<boolean, ComponentContext>): this;
|
|
56
|
+
/** Content alignment: `start`, `center`, `end`, `left`, `right`, `justify` or `between`. */
|
|
57
|
+
alignment(alignment: Lazy<string | null, ComponentContext>): this;
|
|
58
|
+
alignStart(): this;
|
|
59
|
+
alignCenter(): this;
|
|
60
|
+
alignEnd(): this;
|
|
61
|
+
alignLeft(): this;
|
|
62
|
+
alignRight(): this;
|
|
63
|
+
alignJustify(): this;
|
|
64
|
+
/** Hides the entry in the browser while this JavaScript expression is true (`$get('role') !== 'staff'`). Written by the developer, never from user input. */
|
|
65
|
+
hiddenJs(expression: string | null): this;
|
|
66
|
+
/** Shows the entry in the browser only while this JavaScript expression is true. */
|
|
67
|
+
visibleJs(expression: string | null): this;
|
|
68
|
+
/** Attributes of the outer element of the entry wrapper (label and content). Values are escaped. */
|
|
69
|
+
extraEntryWrapperAttributes(attributes: Record<string, string>): this;
|
|
70
|
+
aboveLabel(content: EntrySlot): this;
|
|
71
|
+
belowLabel(content: EntrySlot): this;
|
|
72
|
+
beforeLabel(content: EntrySlot): this;
|
|
73
|
+
/** Content after the label, aligned to the end. */
|
|
74
|
+
afterLabel(content: EntrySlot): this;
|
|
75
|
+
aboveContent(content: EntrySlot): this;
|
|
76
|
+
belowContent(content: EntrySlot): this;
|
|
77
|
+
beforeContent(content: EntrySlot): this;
|
|
78
|
+
/** Content after the entry content, aligned to the end. */
|
|
79
|
+
afterContent(content: EntrySlot): this;
|
|
80
|
+
getLabel(): Promise<string>;
|
|
16
81
|
protected getState(): Promise<unknown>;
|
|
17
|
-
|
|
18
|
-
protected
|
|
82
|
+
protected getExtraAttributesMap(): AttrMap;
|
|
83
|
+
protected getAlignment(): Promise<string | null>;
|
|
84
|
+
protected getEmptyAttributes(base: ClassList): AttrMap;
|
|
85
|
+
protected emptyHtml(base: ClassList): string;
|
|
86
|
+
/** Actions placed in the slots, so that they can be mounted (`schemaComponent` = entry key). */
|
|
87
|
+
getActions(): any[];
|
|
88
|
+
protected renderSlot(name: SlotName): Promise<string | null>;
|
|
89
|
+
/** Places the content in the entry wrapper: label column, content column, slots and link. */
|
|
90
|
+
protected wrapEmbeddedHtml(content: string): Promise<string>;
|
|
91
|
+
/** `hiddenJs()` / `visibleJs()`: the grid wrapper becomes a `<fieldset>` toggled by Alpine, as in Filament. */
|
|
92
|
+
toSchemaHtml(isVisible: boolean): Promise<string>;
|
|
19
93
|
}
|
|
20
|
-
/**
|
|
94
|
+
/**
|
|
95
|
+
* Sanitizer applied to the HTML an entry renders as is (`html()`, `markdown()`, `prose()`).
|
|
96
|
+
* Without one, `sanitizeHtml()` from `@navette-js/support` is used.
|
|
97
|
+
*/
|
|
21
98
|
export declare const useHtmlSanitizer: (sanitizer: ((html: string) => string) | null) => void;
|
|
22
|
-
|
|
99
|
+
type NumericOptions = {
|
|
100
|
+
decimalPlaces?: number | null;
|
|
101
|
+
maxDecimalPlaces?: number | null;
|
|
102
|
+
decimalSeparator?: string | null;
|
|
103
|
+
thousandsSeparator?: string | null;
|
|
104
|
+
locale?: string | null;
|
|
105
|
+
};
|
|
106
|
+
type MoneyOptions = {
|
|
107
|
+
divideBy?: number | null;
|
|
108
|
+
locale?: string | null;
|
|
109
|
+
decimalPlaces?: number | null;
|
|
110
|
+
};
|
|
111
|
+
/** Read-only text: badge, color, icon, money, number, date, list, Markdown and HTML. */
|
|
23
112
|
export declare class TextEntry extends Entry {
|
|
24
113
|
private _badge;
|
|
25
114
|
private _color;
|
|
26
115
|
private _icon;
|
|
116
|
+
private _iconColor;
|
|
117
|
+
private _iconPosition;
|
|
27
118
|
private _format;
|
|
28
|
-
private
|
|
29
|
-
private
|
|
30
|
-
private
|
|
119
|
+
private _formatter;
|
|
120
|
+
private _formatterKind;
|
|
121
|
+
private _isDate;
|
|
122
|
+
private _isMoney;
|
|
123
|
+
private _isNumeric;
|
|
124
|
+
private _timezone;
|
|
125
|
+
private _prefix;
|
|
126
|
+
private _suffix;
|
|
127
|
+
private _prose;
|
|
128
|
+
private _markdown;
|
|
129
|
+
private _html;
|
|
130
|
+
private _characterLimit;
|
|
131
|
+
private _wordLimit;
|
|
132
|
+
private _listWithLineBreaks;
|
|
133
|
+
private _bulleted;
|
|
134
|
+
private _listLimit;
|
|
135
|
+
private _expandableLimitedList;
|
|
136
|
+
private _separator;
|
|
137
|
+
private _copyable;
|
|
138
|
+
private _copyableState;
|
|
139
|
+
private _copyMessage;
|
|
140
|
+
private _copyMessageDuration;
|
|
141
|
+
private _size;
|
|
142
|
+
private _weight;
|
|
143
|
+
private _fontFamily;
|
|
144
|
+
private _lineClamp;
|
|
145
|
+
private _wrap;
|
|
31
146
|
static make(name: string): TextEntry;
|
|
32
147
|
badge(condition?: boolean): this;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
148
|
+
/** Text (or badge) color: a name, or a function of the record and the state item. */
|
|
149
|
+
color(color: PerItem<string | null>): this;
|
|
150
|
+
/** Heroicon before the text: a name, or a function of the record and the state item returning a name or `null`. */
|
|
151
|
+
icon(icon: PerItem<string | null>): this;
|
|
152
|
+
iconColor(color: PerItem<string | null>): this;
|
|
153
|
+
iconPosition(position: 'before' | 'after'): this;
|
|
154
|
+
/** Displayed text computed from the raw state; it takes precedence over date, number and money formatting. */
|
|
155
|
+
formatStateUsing(formatter: ((ctx: {
|
|
36
156
|
state: unknown;
|
|
37
157
|
record: any;
|
|
38
|
-
}) =>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
time(format?: string): this;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
158
|
+
}) => unknown) | null): this;
|
|
159
|
+
private setFormatter;
|
|
160
|
+
private dateFormatter;
|
|
161
|
+
/** Date in a PHP format, `M j, Y` by default ("Mar 5, 2024"). `false` turns date formatting off. */
|
|
162
|
+
date(format?: string | boolean | null, timezone?: string | null): this;
|
|
163
|
+
/** Date and time, `M j, Y H:i:s` by default. */
|
|
164
|
+
dateTime(format?: string | boolean | null, timezone?: string | null): this;
|
|
165
|
+
/** Time, `H:i:s` by default. */
|
|
166
|
+
time(format?: string | null, timezone?: string | null): this;
|
|
167
|
+
/** Date in a Carbon `isoFormat()` format, `L` by default ("03/05/2024"). */
|
|
168
|
+
isoDate(format?: string | null, timezone?: string | null): this;
|
|
169
|
+
/** Date and time in an `isoFormat()` format, `LLL` by default ("March 5, 2024 10:11 AM"). */
|
|
170
|
+
isoDateTime(format?: string | null, timezone?: string | null): this;
|
|
171
|
+
/** Time in an `isoFormat()` format, `LT` by default ("10:11 AM"). */
|
|
172
|
+
isoTime(format?: string | null, timezone?: string | null): this;
|
|
173
|
+
/** Relative date: "2 days ago". */
|
|
174
|
+
since(timezone?: string | null): this;
|
|
175
|
+
private dateTooltipFor;
|
|
176
|
+
/** Tooltip with the date in a PHP format (`M j, Y` by default). */
|
|
177
|
+
dateTooltip(format?: string | null, timezone?: string | null): this;
|
|
178
|
+
dateTimeTooltip(format?: string | null, timezone?: string | null): this;
|
|
179
|
+
timeTooltip(format?: string | null, timezone?: string | null): this;
|
|
180
|
+
isoDateTooltip(format?: string | null, timezone?: string | null): this;
|
|
181
|
+
isoDateTimeTooltip(format?: string | null, timezone?: string | null): this;
|
|
182
|
+
isoTimeTooltip(format?: string | null, timezone?: string | null): this;
|
|
183
|
+
sinceTooltip(timezone?: string | null): this;
|
|
184
|
+
/** IANA time zone in which dates are displayed (`UTC` by default). */
|
|
185
|
+
timezone(timezone: string | null): this;
|
|
186
|
+
/**
|
|
187
|
+
* Formatted number. `numeric(2)`: two decimal places. Options: `decimalPlaces`, `maxDecimalPlaces`, `locale` (`en-US` by default),
|
|
188
|
+
* or `decimalSeparator` / `thousandsSeparator` for fixed separators. `false` turns number formatting off.
|
|
189
|
+
*/
|
|
190
|
+
numeric(options?: boolean | number | null | NumericOptions): this;
|
|
52
191
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
192
|
+
* Amount of money in a currency (`usd` by default). `divideBy`: divides the state first (`100` for cents);
|
|
193
|
+
* `locale` (`en-US` by default) and `decimalPlaces` may be passed after it, or in an options object.
|
|
55
194
|
*/
|
|
195
|
+
money(currency?: string | ((record: any) => string), divideBy?: number | MoneyOptions | null, locale?: string | null, decimalPlaces?: number | null): this;
|
|
196
|
+
/** Text before the formatted state. A string is escaped; an `HtmlString` is inserted as is. */
|
|
197
|
+
prefix(text: string | HtmlString | null): this;
|
|
198
|
+
/** Text after the formatted state. A string is escaped; an `HtmlString` is inserted as is. */
|
|
199
|
+
suffix(text: string | HtmlString | null): this;
|
|
200
|
+
/** Truncates the text to `length` characters, followed by `end`. */
|
|
201
|
+
limit(length?: number | null, end?: string): this;
|
|
202
|
+
/** Truncates the text to a number of words, followed by `end`. */
|
|
203
|
+
words(words?: number | null, end?: string): this;
|
|
204
|
+
/** Clamps the text to a number of lines. */
|
|
205
|
+
lineClamp(lines: number | null): this;
|
|
206
|
+
/** `false`: long text does not wrap onto several lines. */
|
|
207
|
+
wrap(condition?: boolean): this;
|
|
208
|
+
/** Text size: `xs`, `sm` (default), `md` (or `base`) or `lg`. */
|
|
209
|
+
size(size: PerItem<string | null>): this;
|
|
210
|
+
/** Font weight: `thin`, `extralight`, `light`, `normal`, `medium`, `semibold`, `bold`, `extrabold` or `black`. */
|
|
211
|
+
weight(weight: PerItem<string | null>): this;
|
|
212
|
+
/** Font family: `sans`, `serif` or `mono`. */
|
|
213
|
+
fontFamily(family: PerItem<string | null>): this;
|
|
214
|
+
/** Typographic styling of rich content (`fi-prose`); the state is rendered as sanitized HTML. */
|
|
215
|
+
prose(condition?: boolean): this;
|
|
216
|
+
/** Renders Markdown as HTML. HTML in the state (from a rich editor) is sanitized instead. */
|
|
56
217
|
markdown(condition?: boolean): this;
|
|
57
|
-
|
|
58
|
-
|
|
218
|
+
/** Renders the state as HTML, after it has been sanitized. */
|
|
219
|
+
html(condition?: boolean): this;
|
|
220
|
+
/** Each value of a list on its own line. */
|
|
221
|
+
listWithLineBreaks(condition?: boolean): this;
|
|
222
|
+
/** Bulleted list (implies line breaks). */
|
|
223
|
+
bulleted(condition?: boolean): this;
|
|
224
|
+
/** Shows only the first values of a list, followed by "and N more". */
|
|
225
|
+
limitList(limit?: number | null): this;
|
|
226
|
+
/** With `limitList()` and line breaks: a link reveals the other values. */
|
|
227
|
+
expandableLimitedList(condition?: boolean): this;
|
|
228
|
+
/** Splits a string state into a list on this separator. */
|
|
229
|
+
separator(separator?: string | null): this;
|
|
59
230
|
/** Clicking copies the value to the clipboard. */
|
|
60
|
-
copyable(condition?: boolean): this;
|
|
61
|
-
/**
|
|
62
|
-
|
|
231
|
+
copyable(condition?: PerItem<boolean>): this;
|
|
232
|
+
/** Value copied, when it differs from the displayed text. */
|
|
233
|
+
copyableState(state: PerItem<string | null>): this;
|
|
234
|
+
copyMessage(message: string | null): this;
|
|
235
|
+
copyMessageDuration(milliseconds: number): this;
|
|
236
|
+
/** Displayed text of a state item, and whether it is (sanitized) HTML. */
|
|
237
|
+
private formatItem;
|
|
63
238
|
toHtml(): Promise<string>;
|
|
64
239
|
}
|
|
65
|
-
/** Color swatch: only hex or simple functional colors are
|
|
240
|
+
/** Color swatch: only hex or simple functional colors are displayed. */
|
|
66
241
|
export declare class ColorEntry extends Entry {
|
|
67
|
-
private
|
|
242
|
+
private _copyable;
|
|
243
|
+
private _copyableState;
|
|
244
|
+
private _copyMessage;
|
|
245
|
+
private _copyMessageDuration;
|
|
246
|
+
private _wrap;
|
|
68
247
|
static make(name: string): ColorEntry;
|
|
69
|
-
|
|
248
|
+
/** Clicking the swatch copies the color to the clipboard. */
|
|
249
|
+
copyable(condition?: PerItem<boolean>): this;
|
|
250
|
+
copyableState(state: PerItem<string | null>): this;
|
|
251
|
+
copyMessage(message: string | null): this;
|
|
252
|
+
copyMessageDuration(milliseconds: number): this;
|
|
253
|
+
wrap(condition?: boolean): this;
|
|
70
254
|
toHtml(): Promise<string>;
|
|
71
255
|
}
|
|
72
|
-
/** Read-only
|
|
256
|
+
/** Read-only images: only same-site (`/…`) or http(s) URLs are rendered. */
|
|
73
257
|
export declare class ImageEntry extends Entry {
|
|
74
258
|
private _height;
|
|
259
|
+
private _width;
|
|
75
260
|
private _alt;
|
|
76
261
|
private _circular;
|
|
262
|
+
private _square;
|
|
263
|
+
private _stacked;
|
|
264
|
+
private _ring;
|
|
265
|
+
private _overlap;
|
|
266
|
+
private _limit;
|
|
267
|
+
private _limitedRemainingText;
|
|
268
|
+
private _limitedRemainingTextSize;
|
|
269
|
+
private _defaultImageUrl;
|
|
270
|
+
private _extraImgAttributes;
|
|
271
|
+
private _wrap;
|
|
77
272
|
static make(name: string): ImageEntry;
|
|
78
|
-
/**
|
|
79
|
-
imageHeight(height: string): this;
|
|
80
|
-
|
|
273
|
+
/** Height of the images: a CSS length (`40px`, `2.5rem`…) or a number of pixels; `8rem` by default. Any other value is ignored. */
|
|
274
|
+
imageHeight(height: number | string | null): this;
|
|
275
|
+
/** Width of the images: a CSS length or a number of pixels. Any other value is ignored. */
|
|
276
|
+
imageWidth(width: number | string | null): this;
|
|
277
|
+
imageSize(size: number | string): this;
|
|
278
|
+
alt(text: PerItem<string | null>): this;
|
|
81
279
|
circular(condition?: boolean): this;
|
|
280
|
+
/** Square images: the width is the height. */
|
|
281
|
+
square(condition?: boolean): this;
|
|
282
|
+
/** Overlapping images (`2.5rem` high by default). */
|
|
283
|
+
stacked(condition?: boolean): this;
|
|
284
|
+
/** Ring width of stacked images, from 0 to 8. */
|
|
285
|
+
ring(width: number | null): this;
|
|
286
|
+
/** Overlap of stacked images, from 0 to 8 (2 by default). */
|
|
287
|
+
overlap(overlap: number | null): this;
|
|
288
|
+
/** Maximum number of images displayed. */
|
|
289
|
+
limit(limit?: number | null): this;
|
|
290
|
+
/** Shows "+N" after the limited images; `size`: `xs`, `sm` (default), `md` or `lg`. */
|
|
291
|
+
limitedRemainingText(condition?: boolean, size?: string | null): this;
|
|
292
|
+
/** Image displayed when the state is empty. */
|
|
293
|
+
defaultImageUrl(url: Lazy<string | null, ComponentContext>): this;
|
|
294
|
+
/** Extra `<img>` attributes (`loading`, `class`, `data-*`, `aria-*`…). Event handlers, `style` and sources are ignored; values are escaped. */
|
|
295
|
+
extraImgAttributes(attributes: Record<string, string>): this;
|
|
296
|
+
wrap(condition?: boolean): this;
|
|
82
297
|
toHtml(): Promise<string>;
|
|
83
298
|
}
|
|
84
|
-
/**
|
|
299
|
+
/** Icons chosen from the state; `boolean()` shows a green check or a red cross. */
|
|
85
300
|
export declare class IconEntry extends Entry {
|
|
86
301
|
private _boolean;
|
|
302
|
+
private _icon;
|
|
303
|
+
private _color;
|
|
304
|
+
private _size;
|
|
305
|
+
private _trueIcon;
|
|
306
|
+
private _falseIcon;
|
|
307
|
+
private _trueColor;
|
|
308
|
+
private _falseColor;
|
|
309
|
+
private _listWithLineBreaks;
|
|
310
|
+
private _wrap;
|
|
87
311
|
static make(name: string): IconEntry;
|
|
88
312
|
boolean(condition?: boolean): this;
|
|
313
|
+
/** Icon: a Heroicon name, a map of state values to names, or a function of the record and the state item. */
|
|
314
|
+
icon(icon: StateMap<string | null>): this;
|
|
315
|
+
/** Color: a name, a map of state values to colors, or a function of the record and the state item. */
|
|
316
|
+
color(color: StateMap<string | null>): this;
|
|
317
|
+
/** Icon size: `xs`, `sm`, `md`, `lg` (default), `xl` or `2xl`. */
|
|
318
|
+
size(size: PerItem<string | null>): this;
|
|
319
|
+
/** Icon of a true state (`o-check-circle` by default); `false`: no icon. Implies `boolean()`. */
|
|
320
|
+
trueIcon(icon: string | false | null): this;
|
|
321
|
+
/** Icon of a false state (`o-x-circle` by default); `false`: no icon. Implies `boolean()`. */
|
|
322
|
+
falseIcon(icon: string | false | null): this;
|
|
323
|
+
/** Color of a true state (`success` by default). Implies `boolean()`. */
|
|
324
|
+
trueColor(color: string | null): this;
|
|
325
|
+
/** Color of a false state (`danger` by default). Implies `boolean()`. */
|
|
326
|
+
falseColor(color: string | null): this;
|
|
327
|
+
/** Each icon of a list on its own line. */
|
|
328
|
+
listWithLineBreaks(condition?: boolean): this;
|
|
329
|
+
wrap(condition?: boolean): this;
|
|
89
330
|
toHtml(): Promise<string>;
|
|
90
331
|
}
|
|
91
332
|
/** Key/value pairs as a table: the state is an object (or its JSON form); a non-scalar value is shown as JSON. */
|
|
92
333
|
export declare class KeyValueEntry extends Entry {
|
|
93
334
|
private _keyLabel;
|
|
94
335
|
private _valueLabel;
|
|
95
|
-
private _placeholder;
|
|
96
336
|
static make(name: string): KeyValueEntry;
|
|
97
337
|
keyLabel(label: string | null): this;
|
|
98
338
|
valueLabel(label: string | null): this;
|
|
99
|
-
/** Text shown when there are no pairs ("No entries" by default). */
|
|
100
|
-
placeholder(text: string | null): this;
|
|
101
339
|
/** @deprecated Use `placeholder()`. */
|
|
102
340
|
emptyMessage(text: string | null): this;
|
|
103
341
|
toHtml(): Promise<string>;
|
|
@@ -110,7 +348,6 @@ export declare class CodeEntry extends Entry {
|
|
|
110
348
|
private _grammar;
|
|
111
349
|
private _lightTheme;
|
|
112
350
|
private _darkTheme;
|
|
113
|
-
private _placeholder;
|
|
114
351
|
private _copyable;
|
|
115
352
|
private _copyMessage;
|
|
116
353
|
private _copyMessageDuration;
|
|
@@ -120,7 +357,6 @@ export declare class CodeEntry extends Entry {
|
|
|
120
357
|
/** Theme class names only: without a highlighter, colors stay those of the default themes. */
|
|
121
358
|
lightTheme(theme: string | null): this;
|
|
122
359
|
darkTheme(theme: string | null): this;
|
|
123
|
-
placeholder(text: string | null): this;
|
|
124
360
|
/** Clicking copies the code to the clipboard. */
|
|
125
361
|
copyable(condition?: boolean): this;
|
|
126
362
|
copyMessage(message: string | null): this;
|
|
@@ -142,23 +378,65 @@ export declare class ViewEntry extends Entry {
|
|
|
142
378
|
}) => string | Promise<string>) | null): this;
|
|
143
379
|
/** `false`: the function renders the whole entry, without the usual wrapper (label). */
|
|
144
380
|
wrapped(condition?: boolean): this;
|
|
381
|
+
/** Places custom content in the entry wrapper (label, slots, link): for entry classes extending `ViewEntry`. */
|
|
382
|
+
protected wrap(content: string): Promise<string>;
|
|
145
383
|
toHtml(): Promise<string>;
|
|
146
384
|
}
|
|
147
|
-
/** Column
|
|
385
|
+
/** Column of a table repeatable entry: a header label, an optional width and alignment. */
|
|
386
|
+
export declare class TableColumn {
|
|
387
|
+
label: string;
|
|
388
|
+
private _width;
|
|
389
|
+
private _hiddenHeaderLabel;
|
|
390
|
+
private _wrapHeader;
|
|
391
|
+
private _alignment;
|
|
392
|
+
constructor(label: string);
|
|
393
|
+
static make(label: string): TableColumn;
|
|
394
|
+
/** Fixed width: a number of pixels, or a CSS length (`10rem`, `20%`). Any other value is ignored. */
|
|
395
|
+
width(width: number | string | null): this;
|
|
396
|
+
/** Keeps the header label for screen readers only. */
|
|
397
|
+
hiddenHeaderLabel(condition?: boolean): this;
|
|
398
|
+
/** Lets a long header label wrap onto several lines. */
|
|
399
|
+
wrapHeader(condition?: boolean): this;
|
|
400
|
+
/** Header alignment: `start`, `center` or `end`. */
|
|
401
|
+
alignment(alignment: string | null): this;
|
|
402
|
+
alignStart(): this;
|
|
403
|
+
alignCenter(): this;
|
|
404
|
+
alignEnd(): this;
|
|
405
|
+
getWidth(): string | null;
|
|
406
|
+
isHeaderLabelHidden(): boolean;
|
|
407
|
+
canHeaderWrap(): boolean;
|
|
408
|
+
getAlignment(): string | null;
|
|
409
|
+
}
|
|
410
|
+
/** Column header of a table repeatable entry: `TableColumn` from this package (or the one of @navette-js/forms). */
|
|
148
411
|
export type RepeatableColumn = {
|
|
149
412
|
label: string;
|
|
150
413
|
getWidth(): string | null;
|
|
414
|
+
isHeaderLabelHidden?(): boolean;
|
|
415
|
+
canHeaderWrap?(): boolean;
|
|
416
|
+
getAlignment?(): string | null;
|
|
151
417
|
};
|
|
152
418
|
/**
|
|
153
|
-
* Read-only list of items,
|
|
154
|
-
*
|
|
419
|
+
* Read-only list of items read from the record: cards in a grid (default), or a table (`table()`) with one row per item
|
|
420
|
+
* and one cell per entry.
|
|
155
421
|
*/
|
|
156
422
|
export declare class RepeatableEntry extends Entry {
|
|
157
|
-
private
|
|
423
|
+
private _tableColumns;
|
|
158
424
|
private _schema;
|
|
425
|
+
private _grid;
|
|
426
|
+
private _itemColumns;
|
|
427
|
+
private _contained;
|
|
159
428
|
static make(name: string): RepeatableEntry;
|
|
160
|
-
table
|
|
161
|
-
|
|
429
|
+
/** Renders the items as a table with these columns, in the order of the schema's entries. */
|
|
430
|
+
table(columns: RepeatableColumn[] | null): this;
|
|
431
|
+
/** Components repeated for each item. A function returns fresh instances for each item. */
|
|
432
|
+
schema(components: Component[] | (() => Component[])): this;
|
|
433
|
+
/** Card layout: number of item columns (from `lg` for a number, per breakpoint for an object); 2 when called without argument. */
|
|
434
|
+
grid(columns?: Record<string, number> | number | null): this;
|
|
435
|
+
/** Card layout: grid columns inside each item. */
|
|
436
|
+
columns(columns: Record<string, number> | number | null): this;
|
|
437
|
+
/** Card layout: `false` removes the card styling of the items. */
|
|
438
|
+
contained(condition?: boolean): this;
|
|
439
|
+
private itemSchema;
|
|
162
440
|
toHtml(): Promise<string>;
|
|
163
441
|
}
|
|
164
442
|
export {};
|