proje-react-panel 1.11.0 → 1.12.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/CHANGELOG.md CHANGED
@@ -2,6 +2,52 @@
2
2
 
3
3
  This file starts at 1.11.0; earlier releases are only in the git history.
4
4
 
5
+ ## 1.12.0
6
+
7
+ ### Added
8
+
9
+ - **Lists size their own pages.** `ListPage` now asks for as many rows as the datagrid can show
10
+ instead of leaving the page size to the server, which on a tall screen meant ten rows and a large
11
+ empty area below them. The grid element is measured — not assumed — because a consumer styling its
12
+ own shell has no fixed `100vh - chrome` height, and any constant here would be silently wrong for
13
+ them. The row height is the other half of the sum and is *declared* rather than measured:
14
+ measuring a row would require rendering one first, so the correct page size would always cost a
15
+ second request. `@List({ rowHeight })` overrides it for taller rows, `@List({ autoCalculate: false })`
16
+ restores the previous behaviour, and the computed value travels as the existing `limit` query
17
+ parameter, so no backend change is needed.
18
+ - The declared `rowHeight` is applied to the row inline, and image cells are capped to it. A
19
+ declaration the library does not enforce is a guess: an `image` cell alone used to make its row
20
+ roughly three times taller than the rest, which is exactly the case that would break the
21
+ calculation. A development-only warning names any list that carries an image cell without
22
+ declaring a row height.
23
+
24
+ ### Fixed
25
+
26
+ - **The last page of a list is reachable again.** Page count used `Math.floor(total / limit)`, so a
27
+ final partial page was never drawn: 2151 records at 10 per page offered 215 pages and the last
28
+ record could not be opened from anywhere. Worse, any list with fewer than two full pages
29
+ (`total < 2 * limit`) computed a single page and hid the pagination entirely, stranding every
30
+ record after the first page. It also renders nothing while `limit` is still 0 rather than drawing
31
+ `NaN` pages.
32
+ - The loading state now fills the datagrid instead of replacing the whole page, so the list header
33
+ and footer no longer disappear on every page change.
34
+
35
+ ## 1.11.1
36
+
37
+ ### Fixed
38
+
39
+ - **Icons keep their `viewBox`, so consumer CSS can resize them.** SVGR was running SVGO with its
40
+ default configuration, whose `removeViewBox` plugin drops a `viewBox` that is redundant with
41
+ `width`/`height`. Only `check.svg` and `cross.svg` matched that condition (`0 0 24 24` with
42
+ `width=24`); every other icon carries `width=800` and was unaffected. Without a `viewBox` an SVG
43
+ cannot scale: a consumer sizing `.icon-true` to 16px got the top-left 16 units of a 24-unit
44
+ drawing — the tick in a boolean cell was cropped away rather than shrunk. `removeViewBox` is now
45
+ explicitly disabled in `rollup.config.mjs`. Consumers carrying a dist patch that injects the
46
+ attribute can remove it.
47
+ - `prefixIds` is passed explicitly alongside it, because supplying `svgoConfig` replaces SVGR's
48
+ default plugin list wholesale — losing it would let ids and class names collide between icons
49
+ inlined into the same bundle.
50
+
5
51
  ## 1.11.0
6
52
 
7
53
  ### Fixed
@@ -0,0 +1 @@
1
+ export {};
@@ -4,7 +4,16 @@ import { AnyClass } from '../../types/AnyClass';
4
4
  interface DatagridProps<T extends AnyClass> {
5
5
  data: T[];
6
6
  listPageMeta: ListPageMeta<T>;
7
+ loading?: boolean;
8
+ /**
9
+ * Satir yuksekligi satira UYGULANIR, sadece bildirilmez: otomatik sayfa
10
+ * boyutu bu sayiya gore hesaplandigi icin gercekle ayrismasina izin
11
+ * verilemez. Inline veriliyor ki tuketicinin kendi tablo CSS'i olsa da
12
+ * gecerli olsun.
13
+ */
14
+ rowHeight?: number;
15
+ containerRef?: React.RefObject<HTMLDivElement | null>;
7
16
  onRemoveItem?: (item: T) => Promise<void>;
8
17
  }
9
- export declare function Datagrid<T extends AnyClass>({ data, listPageMeta, onRemoveItem, }: DatagridProps<T>): React.JSX.Element;
18
+ export declare function Datagrid<T extends AnyClass>({ data, listPageMeta, loading, rowHeight, containerRef, onRemoveItem, }: DatagridProps<T>): React.JSX.Element;
10
19
  export {};
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Otomatik sayfa boyutunun iki girdisi var ve ikisi ayri yollardan geliyor:
3
+ *
4
+ * - Datagrid'in yuksekligi OLCULUR. Tuketici kutuphanenin liste CSS'ini
5
+ * kullanmak zorunda degil (kendi kabugunu yazan bir panelde datagrid ne
6
+ * `100vh - 120px`'tir ne de baska bir sabit), dolayisiyla buraya px yazmak
7
+ * sessizce yanlislanacak bir varsayim olurdu.
8
+ * - Satir yuksekligi BEYAN EDILIR ve tabloya dayatilir (`@List({ rowHeight })`).
9
+ * Olculmuyor: olcmek icin once satirin render olmasi, yani bir istek atilmis
10
+ * olmasi gerekirdi; dogru limit ikinci bir istek demek olurdu.
11
+ */
12
+ /** Olcum yapilamadiginda (SSR, jsdom, yukseklik 0) kullanilan sayfa boyutu. */
13
+ export declare const LIST_FALLBACK_LIMIT = 10;
14
+ /**
15
+ * Satirin varsayilan yuksekligi (px): hucre dolgusu + satir kutusu + alt cizgi.
16
+ * Satirini kendi CSS'iyle degistiren ya da `image` gibi yuksek hucre tasiyan
17
+ * tuketici `@List({ rowHeight })` ile kendi olcusunu verir.
18
+ */
19
+ export declare const LIST_ROW_HEIGHT = 44;
20
+ /**
21
+ * Otomatik hesabin tabani ve tavani: cok kisa ekranda kullanilamaz bir liste,
22
+ * cok uzun ekranda sunucuyu doven bir sorgu cikmasin.
23
+ */
24
+ export declare const LIST_MIN_LIMIT = 5;
25
+ export declare const LIST_MAX_LIMIT = 100;
26
+ /**
27
+ * Datagrid'e kac satir sigiyorsa o kadar kayit iste. Tablo basligi da o alanin
28
+ * icinde duruyor, o yuzden bir satir dusuluyor; dusulmezse hesap tam bir satir
29
+ * tasar ve otomatik boyut kendi amacinin tersine scroll uretir.
30
+ */
31
+ export declare function calculateListLimit(containerHeight: number, rowHeight?: number): number;
@@ -44,6 +44,21 @@ export interface ListOptions<T> {
44
44
  actions?: ((item: T) => ListActionOptions<T>) | ListActionOptions<T>;
45
45
  primaryId?: string;
46
46
  key?: string;
47
+ /**
48
+ * Sayfa boyutunu ekrana sigan satir sayisindan hesapla. Varsayilan acik:
49
+ * sabit bir sayfa boyutu (ornegin 10) buyuk ekranda tablonun altinda kocaman
50
+ * bir bosluk birakiyordu — datagrid yuksekligi viewport'a civili.
51
+ * Kapatirsan `getData` limit'i eskisi gibi kendi belirler.
52
+ */
53
+ autoCalculate?: boolean;
54
+ /**
55
+ * Satir yuksekligi (px). Sadece bir bilgi degil, tabloya UYGULANIR: satira
56
+ * bu yukseklik verilir ve hucre icerigi (ornegin gorsel) buna kirpilir.
57
+ * Boylece beyan ile gercek asla ayrisamaz. Yalnizca satirini kendi CSS'iyle
58
+ * degistiren ya da `image` gibi yuksek hucre tasiyan listelerde gerekir;
59
+ * verilmezse kutuphanenin kendi olcusu (`LIST_ROW_HEIGHT`) kullanilir.
60
+ */
61
+ rowHeight?: number;
47
62
  }
48
63
  export type ListConfiguration<T> = ListOptions<T> & {
49
64
  key: string;