@dskripchenko/laravel-admin 1.45.1 → 1.46.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.
@@ -1,5 +1,5 @@
1
1
  import './chart.css';
2
- import { type ChartSeries } from './chartGeometry';
2
+ import { type ChartValueFormat, type ChartSeries } from './chartGeometry';
3
3
  export type CartesianKind = 'line' | 'area' | 'bar';
4
4
  interface Props {
5
5
  kind?: CartesianKind;
@@ -10,10 +10,13 @@ interface Props {
10
10
  stacked?: boolean;
11
11
  /** The minimum plot height in px; the chart grows with its cell beyond it. */
12
12
  height?: number;
13
+ /** ChartWidget::money() / precision(): how the values read. */
14
+ format?: ChartValueFormat | null;
13
15
  }
14
16
  declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
15
17
  title: string;
16
18
  height: number;
19
+ format: ChartValueFormat | null;
17
20
  description: string;
18
21
  kind: CartesianKind;
19
22
  stacked: boolean;
@@ -1,4 +1,4 @@
1
- import { type RawDataset } from './chartGeometry';
1
+ import { type ChartValueFormat, type RawDataset } from './chartGeometry';
2
2
  interface ChartData {
3
3
  /**
4
4
  * The backend's ChartWidget::data() returns `chartType`. The older wrapper
@@ -9,6 +9,8 @@ interface ChartData {
9
9
  labels?: Array<string | number>;
10
10
  datasets?: RawDataset[];
11
11
  stacked?: boolean;
12
+ /** ChartWidget::money() / precision(); null — plain numbers. */
13
+ format?: ChartValueFormat | null;
12
14
  }
13
15
  interface Props {
14
16
  type?: string;
@@ -20,6 +22,7 @@ interface Props {
20
22
  labels?: Array<string | number>;
21
23
  datasets?: RawDataset[];
22
24
  stacked?: boolean;
25
+ format?: ChartValueFormat | null;
23
26
  }
24
27
  declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
25
28
  export default _default;
@@ -1,3 +1,4 @@
1
+ import { type ChartValueFormat } from './chartGeometry';
1
2
  interface Slice {
2
3
  label: string;
3
4
  value: number;
@@ -8,9 +9,12 @@ interface Props {
8
9
  data: Slice[];
9
10
  /** A doughnut's hole; a pie is drawn without one. */
10
11
  hole?: boolean;
12
+ /** ChartWidget::money() / precision(): how the values read. */
13
+ format?: ChartValueFormat | null;
11
14
  }
12
15
  declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
13
16
  title: string;
17
+ format: ChartValueFormat | null;
14
18
  hole: boolean;
15
19
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
20
  export default _default;
@@ -1,15 +1,18 @@
1
1
  import './chart.css';
2
- import { type ChartSeries } from './chartGeometry';
2
+ import { type ChartSeries, type ChartValueFormat } from './chartGeometry';
3
3
  interface Props {
4
4
  title?: string;
5
5
  description?: string;
6
6
  labels: string[];
7
7
  series: ChartSeries[];
8
8
  height?: number;
9
+ /** ChartWidget::money() / precision(): how the values read. */
10
+ format?: ChartValueFormat | null;
9
11
  }
10
12
  declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
11
13
  title: string;
12
14
  height: number;
15
+ format: ChartValueFormat | null;
13
16
  description: string;
14
17
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
18
  export default _default;
@@ -1,14 +1,22 @@
1
1
  import { type UidTableColumn } from '@dskripchenko/ui';
2
+ import type { CellMeta } from '../resource/cellFormat';
2
3
  /**
3
- * The backend's RecentListWidget::data() returns the columns as
4
- * `[{column, label}]` while UidTable expects `{key, label}`, so they are
5
- * converted here.
4
+ * The backend's RecentListWidget::data() sends each column as
5
+ * TableColumn::toArray() — {name, label, preset, meta, align} — plus the
6
+ * older `column` key; UidTable expects `{key, label}`, so they are converted
7
+ * here. The cells are drawn by the AdminTableCell a resource list uses, so
8
+ * asMoney(), asDate(), asBadge() and asLink() look the same on a dashboard.
9
+ * A column with no preset still gets its ISO dates formatted (formatCell).
6
10
  */
7
11
  interface BackendColumn {
8
12
  column?: string;
13
+ name?: string;
9
14
  key?: string;
10
15
  label: string;
11
16
  align?: 'left' | 'center' | 'right';
17
+ width?: string | null;
18
+ preset?: string | null;
19
+ meta?: CellMeta | null;
12
20
  }
13
21
  interface Props {
14
22
  title?: string;
@@ -50,9 +50,21 @@ export interface NiceScale {
50
50
  * always inside, so bars and areas grow from a real baseline.
51
51
  */
52
52
  export declare function niceScale(min: number, max: number, count?: number): NiceScale;
53
- /** An axis tick: compact (1.2K, 3M), in the panel's locale. */
54
- export declare function formatTick(v: number): string;
55
- /** A value in a tooltip or the data table: full, with grouping, in the panel's locale. */
56
- export declare function formatValue(v: number | null): string;
53
+ /**
54
+ * How a chart shows its values (ChartWidget::money() / precision()): money in
55
+ * a currency, or a number with fixed decimals. Absent — a plain number.
56
+ */
57
+ export interface ChartValueFormat {
58
+ style?: 'currency' | 'decimal' | string;
59
+ currency?: string;
60
+ decimals?: number;
61
+ }
62
+ /** An axis tick: compact (1.2K, 3M — $1.2K with money), in the panel's locale. */
63
+ export declare function formatTick(v: number, format?: ChartValueFormat | null): string;
64
+ /**
65
+ * A value in a tooltip or the data table: full, with grouping, in the panel's
66
+ * locale — as money when the chart says so.
67
+ */
68
+ export declare function formatValue(v: number | null, format?: ChartValueFormat | null): string;
57
69
  /** A rough text width in px for the axis font — enough to keep labels apart. */
58
70
  export declare function estimateTextWidth(text: string, fontPx?: number): number;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * The phrases that name a resource's records: page titles, confirmations,
3
+ * toasts and empty states.
4
+ *
5
+ * The manifest's `label` is plural ("Authors") and reads wrong inside a
6
+ * sentence about one record. `singular_label` (Resource::singularLabel()) is
7
+ * the name of one record as it reads mid-sentence ("author"), or null when the
8
+ * resource has none in this locale.
9
+ *
10
+ * Every phrase is a Russian source string translated through the JSON
11
+ * dictionary. A translation may use placeholders its source does not: Russian
12
+ * would need the noun in the accusative, which a nominative singular cannot
13
+ * give, so its source says "delete this record", while the English
14
+ * translation says "Delete this :singular?". Every phrase therefore receives
15
+ * the whole set:
16
+ *
17
+ * :singular the record's name, or the translated word "record" without one
18
+ * :Singular the same with a capital letter, for the start of a sentence
19
+ * :label the resource label as the manifest gives it
20
+ * :plural the label lowered for the middle of a sentence
21
+ */
22
+ import type { ManifestResourceMeta } from '../../stores/manifest';
23
+ type Meta = Pick<ManifestResourceMeta, 'label'> & {
24
+ singular_label?: string | null;
25
+ };
26
+ /**
27
+ * Lowers a caption for the middle of a sentence. A word in capitals ("API",
28
+ * "URL") is an acronym and keeps its case.
29
+ */
30
+ export declare function nounCase(text: string): string;
31
+ /** The resource's singular in the current locale, or null without one. */
32
+ export declare function singularOf(meta: Meta | null | undefined): string | null;
33
+ /** The placeholder set every phrase receives; see the header. */
34
+ export declare function nounParams(meta: Meta | null | undefined, slug: string): Record<string, string>;
35
+ /** The create page's title: "Create author", or "New record: Authors". */
36
+ export declare function createTitle(meta: Meta | null | undefined, slug: string): string;
37
+ /**
38
+ * The name of a record without a title: "Author #12", or the older
39
+ * "Authors: record #12" when the resource has no singular.
40
+ */
41
+ export declare function recordFallbackTitle(meta: Meta | null | undefined, slug: string, id: string | number): string;
42
+ /**
43
+ * The edit page's title: "Edit author: Ivan Petrov" (the Russian source names
44
+ * only the record), "Edit author #12" without a record title.
45
+ */
46
+ export declare function editTitle(meta: Meta | null | undefined, slug: string, id: string | number, recordTitle: string | null): string;
47
+ /**
48
+ * The delete confirmation: "Delete author “Ivan Petrov”?" when the record has
49
+ * a title, "Delete this author?" otherwise.
50
+ */
51
+ export declare function deleteConfirmText(meta: Meta | null | undefined, slug: string, recordTitle?: string | null): string;
52
+ /** The toast after a create: "Author created." */
53
+ export declare function createdToast(meta: Meta | null | undefined, slug: string): string;
54
+ /** The toast after a delete: "Author deleted." */
55
+ export declare function deletedToast(meta: Meta | null | undefined, slug: string): string;
56
+ /**
57
+ * The empty state's description: "No authors yet. Create the first author." or,
58
+ * for who may not create, "No authors yet."
59
+ */
60
+ export declare function emptyDescription(meta: Meta | null | undefined, slug: string, canCreate: boolean): string;
61
+ /** The create button's tooltip; the same words as the create page's title. */
62
+ export declare function createTooltip(meta: Meta | null | undefined, slug: string): string;
63
+ /**
64
+ * Picks a record's title from its data: Resource::recordTitle() first, then the
65
+ * record's own title, name or label.
66
+ */
67
+ export declare function recordTitleOf(record: Record<string, unknown> | null | undefined): string | null;
68
+ export {};
@@ -0,0 +1 @@
1
+ export {};