proje-react-panel 1.11.1 → 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 +30 -0
- package/dist/__tests__/build/svgoViewBox.test.d.ts +1 -0
- package/dist/__tests__/components/list/Pagination.test.d.ts +1 -0
- package/dist/__tests__/components/list/listMetrics.test.d.ts +1 -0
- package/dist/components/list/Datagrid.d.ts +10 -1
- package/dist/components/list/listMetrics.d.ts +31 -0
- package/dist/decorators/list/List.d.ts +15 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/how_to.md +23 -0
- package/package.json +3 -2
- package/src/__tests__/build/svgoViewBox.test.ts +48 -0
- package/src/__tests__/components/list/Pagination.test.tsx +53 -0
- package/src/__tests__/components/list/listMetrics.test.ts +36 -0
- package/src/assets/icons/svg/down-arrow-backup-2.svg +2 -2
- package/src/components/list/Datagrid.tsx +18 -3
- package/src/components/list/ListPage.tsx +94 -8
- package/src/components/list/Pagination.tsx +5 -1
- package/src/components/list/cells/ImageCell.tsx +6 -1
- package/src/components/list/listMetrics.ts +42 -0
- package/src/decorators/list/List.ts +15 -0
- package/svgo.icons.json +6 -0
- package/.idea/codeStyles/Project.xml +0 -54
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/jsLinters/eslint.xml +0 -6
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -7
- package/.idea/proje-react-panel.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/.idea/watcherTasks.xml +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,36 @@
|
|
|
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
|
+
|
|
5
35
|
## 1.11.1
|
|
6
36
|
|
|
7
37
|
### Fixed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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;
|