@devjuliovilla/jv-ui 1.8.0 → 1.10.0
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/README.md +93 -3
- package/fesm2022/devjuliovilla-jv-ui.mjs +798 -194
- package/fesm2022/devjuliovilla-jv-ui.mjs.map +1 -1
- package/package.json +4 -1
- package/types/devjuliovilla-jv-ui.d.ts +122 -8
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ import { ApplicationConfig } from '@angular/core';
|
|
|
20
20
|
import { provideJvUi } from '@devjuliovilla/jv-ui';
|
|
21
21
|
|
|
22
22
|
export const appConfig: ApplicationConfig = {
|
|
23
|
-
providers: [provideJvUi({
|
|
23
|
+
providers: [provideJvUi({ messagesLocale: 'en', formatLocale: 'en-US' })],
|
|
24
24
|
};
|
|
25
25
|
```
|
|
26
26
|
|
|
@@ -42,7 +42,7 @@ export class App {}
|
|
|
42
42
|
| Category | Components |
|
|
43
43
|
|---|---|
|
|
44
44
|
| Buttons | `JvButton`, `JvButtonGroup`, `JvIconButton` |
|
|
45
|
-
| Forms | `JvInput`, `JvTextarea`, `JvSelect`, `JvCheckbox`, `JvRadio`, `JvSwitch`, `JvFormContainer` |
|
|
45
|
+
| Forms | `JvInput`, `JvTextarea`, `JvCode`, `JvSelect`, `JvCheckbox`, `JvRadio`, `JvSwitch`, `JvDatePicker`, `JvModalSelector`, `JvFileInput`, `JvFormContainer` |
|
|
46
46
|
| Data Grid | `JvGrid` — full-featured data table (see below) |
|
|
47
47
|
| Containers | `JvCard`, `JvSection`, `JvDivider` |
|
|
48
48
|
| List | `JvList`, `JvListItem` — list with title, description, icons, badges, and interactive items |
|
|
@@ -124,7 +124,8 @@ import { JvGridComponent } from '@devjuliovilla/jv-ui';
|
|
|
124
124
|
| `editOptions` | `{ label: string; value: unknown }[]` | Options for select editor |
|
|
125
125
|
| `width` | `string` | Column width (e.g. '8rem') |
|
|
126
126
|
| `align` | `'start' \| 'center' \| 'end'` | Text alignment |
|
|
127
|
-
| `type` | `'text' \| 'number' \| 'currency' \| 'date' \| 'datetime' \| 'boolean'` | Data type for formatting |
|
|
127
|
+
| `type` | `'text' \| 'integer' \| 'number' \| 'currency' \| 'percent' \| 'date' \| 'time' \| 'datetime' \| 'boolean'` | Data type for formatting |
|
|
128
|
+
| `formatOptions` | `Intl.NumberFormatOptions & Intl.DateTimeFormatOptions` | Per-column formatting overrides |
|
|
128
129
|
| `format` | `(value, row) => string` | Custom display formatter |
|
|
129
130
|
| `children` | `JvGridColumn<T>[]` | Child columns for grouped headers |
|
|
130
131
|
| `resizable` | `boolean` | Allow column resize |
|
|
@@ -337,6 +338,95 @@ export class ProfileComponent {
|
|
|
337
338
|
}
|
|
338
339
|
```
|
|
339
340
|
|
|
341
|
+
## Code API
|
|
342
|
+
|
|
343
|
+
```typescript
|
|
344
|
+
import { JvCodeComponent } from '@devjuliovilla/jv-ui';
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
| Input | Type | Default | Description |
|
|
348
|
+
|---|---|---|---|
|
|
349
|
+
| `code` | `string` | — | Code or text content to render |
|
|
350
|
+
| `language` | `string` | `''` | Optional language badge |
|
|
351
|
+
| `title` | `string` | `''` | Optional header title |
|
|
352
|
+
| `font` | `'jetbrains-mono' \| 'fira-code' \| 'cascadia' \| 'consolas' \| 'system'` | `'jetbrains-mono'` | Mono font preset for the rendered block |
|
|
353
|
+
| `editable` | `boolean` | `false` | Renders a textarea-style editing surface instead of read-only preview |
|
|
354
|
+
| `width` | `string` | `'100%'` | CSS width applied to the component |
|
|
355
|
+
| `height` | `string` | `'auto'` | CSS height for the editable surface or minimum preview height |
|
|
356
|
+
|
|
357
|
+
Use `JvCode` for read-only payloads or long single-line content where horizontal scrolling should be preserved instead of wrapping.
|
|
358
|
+
The library does not bundle font files. `JvCode` references common mono families and will use any web font you load at the application level.
|
|
359
|
+
|
|
360
|
+
When `editable` is enabled, `JvCode` emits `codeChange` on every edit so the parent can keep the source text in sync.
|
|
361
|
+
|
|
362
|
+
### Example
|
|
363
|
+
|
|
364
|
+
```typescript
|
|
365
|
+
import { Component } from '@angular/core';
|
|
366
|
+
import { JvCodeComponent } from '@devjuliovilla/jv-ui';
|
|
367
|
+
|
|
368
|
+
@Component({
|
|
369
|
+
selector: 'app-payload-preview',
|
|
370
|
+
standalone: true,
|
|
371
|
+
imports: [JvCodeComponent],
|
|
372
|
+
template: `
|
|
373
|
+
<jv-code
|
|
374
|
+
[code]="payload"
|
|
375
|
+
language="json"
|
|
376
|
+
title="HTTP payload preview"
|
|
377
|
+
font="fira-code"
|
|
378
|
+
[editable]="true"
|
|
379
|
+
width="100%"
|
|
380
|
+
height="18rem"
|
|
381
|
+
(codeChange)="payload = $event"
|
|
382
|
+
/>
|
|
383
|
+
`,
|
|
384
|
+
})
|
|
385
|
+
export class PayloadPreviewComponent {
|
|
386
|
+
payload = '{"status":"ok"}';
|
|
387
|
+
}
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
If you want hosted fonts without shipping them in your package, load them at the app level, for example:
|
|
391
|
+
|
|
392
|
+
```css
|
|
393
|
+
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
## Confirm Dialog Labels
|
|
397
|
+
|
|
398
|
+
`JvDialogService.confirm()` already supports `confirmLabel` and `cancelLabel` overrides per dialog. If you omit them, the defaults come from the active translation dictionary using `dialog.confirm` and `dialog.cancel`.
|
|
399
|
+
|
|
400
|
+
This lets you either:
|
|
401
|
+
|
|
402
|
+
- override labels directly for a specific action like `Guardar evento` / `Descartar cambios`
|
|
403
|
+
- or register translated defaults in your i18n dictionary for each supported language
|
|
404
|
+
|
|
405
|
+
Example with business copy:
|
|
406
|
+
|
|
407
|
+
```typescript
|
|
408
|
+
const confirmed = await dialogService.confirm({
|
|
409
|
+
title: 'Guardar evento',
|
|
410
|
+
message: 'Se aplicaran cambios a la agenda del equipo.',
|
|
411
|
+
confirmLabel: 'Guardar evento',
|
|
412
|
+
cancelLabel: 'Descartar cambios',
|
|
413
|
+
tone: 'primary',
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
if (confirmed) {
|
|
417
|
+
saveEvent();
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
Example using translated defaults from your dictionary:
|
|
422
|
+
|
|
423
|
+
```typescript
|
|
424
|
+
await dialogService.confirm({
|
|
425
|
+
message: 'This action will publish the current draft.',
|
|
426
|
+
tone: 'primary',
|
|
427
|
+
});
|
|
428
|
+
```
|
|
429
|
+
|
|
340
430
|
## Icon System
|
|
341
431
|
|
|
342
432
|
```typescript
|