cenitu-table 0.4.0-beta.0 → 0.4.0-beta.1
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 +53 -2
- package/README.tr.md +53 -2
- package/dist/cenitu-table.cjs +1 -1
- package/dist/cenitu-table.js +28 -27
- package/dist/{index-BIH30fQ2.js → index-CKuAiNIg.js} +2292 -1810
- package/dist/index-Cl7J9niR.cjs +235 -0
- package/dist/react.cjs +1 -1
- package/dist/react.js +99 -59
- package/dist/types/export/types.d.ts +2 -0
- package/dist/types/export/xlsxRead.d.ts +3 -0
- package/dist/types/grid/cellTypes.d.ts +59 -4
- package/dist/types/grid/columnMenu.d.ts +2 -0
- package/dist/types/grid/contextMenu.d.ts +1 -1
- package/dist/types/grid/grid.d.ts +81 -2
- package/dist/types/grid/messages.d.ts +5 -0
- package/dist/types/grid/search.d.ts +5 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/react/index.d.ts +16 -1
- package/package.json +1 -1
- package/dist/index-Bidvqh7P.cjs +0 -197
package/README.md
CHANGED
|
@@ -20,6 +20,9 @@ A spreadsheet-like data grid with a built-in, multi-sheet formula engine. Writte
|
|
|
20
20
|
- **Layout:** frozen rows and columns, merged cells, hidden columns, column drag-and-drop.
|
|
21
21
|
- **Formula engine:** 100+ functions (SUM, IF, XLOOKUP, SUMIFS, TEXT, date functions…), dynamic arrays that spill (FILTER, SORT, UNIQUE, SEQUENCE), cross-sheet references (`'Other sheet'!A1`), named expressions, incremental recalculation, cycle detection.
|
|
22
22
|
- **Server mode:** paging, sorting and filtering on your backend, with a page bar and text, list, date and yes/no filters.
|
|
23
|
+
- **Editing:** dropdowns that store an id and show a label, choices searched on your server, custom editors, also as React components.
|
|
24
|
+
- **Rows:** expandable detail areas, hidden rows, row click events, footer totals, notes and links.
|
|
25
|
+
- **Touch:** handles follow fingers, long press opens the context menu.
|
|
23
26
|
- **Data binding:** rows as arrays or as objects bound to columns by property path; edits are written back to your objects.
|
|
24
27
|
- **Import and export:** read and write XLSX (formulas, formats, styles, frozen panes, merges), export CSV with protection against formula injection, all without any library.
|
|
25
28
|
- **Accessibility:** ARIA grid roles and an announced active cell for screen readers.
|
|
@@ -113,7 +116,7 @@ book.sheets.forEach((sheet, i) => {
|
|
|
113
116
|
});
|
|
114
117
|
```
|
|
115
118
|
|
|
116
|
-
Read: values, formulas, number formats, fonts, fills, alignment, column widths, row heights, hidden columns, frozen panes, merges and defined names. Not read: charts, images, comments, conditional formats
|
|
119
|
+
Read: values, formulas, number formats, fonts, fills, alignment, column widths, row heights, hidden rows and columns, frozen panes, merges and defined names. Not read: charts, images, comments, conditional formats and data validation. Pass `formulas: 'values'` to take the results stored in the file instead of formulas, for example when a file uses functions the engine does not have.
|
|
117
120
|
|
|
118
121
|
### Server mode
|
|
119
122
|
|
|
@@ -148,7 +151,7 @@ Rules worth knowing:
|
|
|
148
151
|
- Change events carry `rowKey` and `columnId`; saving edits, also before a page change, is up to the application.
|
|
149
152
|
- Undo history ends with each new page.
|
|
150
153
|
- Formulas are off unless `formulas` is set, and they then see only the loaded page.
|
|
151
|
-
- Select all, find and replace, and
|
|
154
|
+
- Select all, find and replace, and `downloadCSV`/`downloadXLSX` cover the loaded page only; `downloadAllCSV`/`downloadAllXLSX` cover the full result through `fetchAllRows`.
|
|
152
155
|
- Rows cannot be added or removed locally. A paste that does not fit is cut off and reported by `afterPasteClipped`.
|
|
153
156
|
|
|
154
157
|
### Row events and saved column layout
|
|
@@ -167,6 +170,54 @@ Rules worth knowing:
|
|
|
167
170
|
|
|
168
171
|
Layouts need column ids (`columns[i].id` or `data`). Removed columns are skipped when restoring, and new ones stay after the saved ones. A double click also fires two row clicks, as in the browser. `setColumnLayout` clears undo history when it moves columns.
|
|
169
172
|
|
|
173
|
+
### Editors and dropdowns
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
import { reactEditor, reactRenderer } from 'cenitu-table/react';
|
|
177
|
+
|
|
178
|
+
const columns = [
|
|
179
|
+
// Stores the id, shows the label; typed and pasted labels become ids.
|
|
180
|
+
{ data: 'statusId', type: 'dropdown', source: [{ value: 1, label: 'Open' }, { value: 2, label: 'Closed' }] },
|
|
181
|
+
// Searches on the server. Older requests are aborted through `signal`.
|
|
182
|
+
{
|
|
183
|
+
data: 'partnerId',
|
|
184
|
+
type: 'dropdown',
|
|
185
|
+
loadOptions: (query, signal) => api.partners(query, { signal }),
|
|
186
|
+
resolveLabel: (id, row) => row.partner?.name,
|
|
187
|
+
},
|
|
188
|
+
{ data: 'color', editor: reactEditor(ColorPicker) }, // props: value, commit, cancel, row, col…
|
|
189
|
+
{ data: 'state', renderer: reactRenderer(StateBadge) }, // props: value, context
|
|
190
|
+
];
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Without React, an editor is a function: `editor: ({ el, value, commit, cancel }) => ({ getValue, destroy })`. It renders into `el` and finishes with `commit(value)` or `cancel()`. A click elsewhere stores `getValue()` when given, and `destroy` runs once however it closes. With `loadOptions`, text alone changes nothing: a choice must be picked, or the cell emptied (`strict: false` allows free text).
|
|
194
|
+
|
|
195
|
+
A `renderer` may return a cleanup function, called when the cell element is recycled while scrolling.
|
|
196
|
+
|
|
197
|
+
### Rows, totals, notes and links
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
import { linkRenderer } from 'cenitu-table';
|
|
201
|
+
|
|
202
|
+
new CenituGrid(el, {
|
|
203
|
+
data,
|
|
204
|
+
rowDetail: (host, row) => void (host.textContent = row.notes), // expand mark in row headers
|
|
205
|
+
columns: [
|
|
206
|
+
{ data: 'total', summary: 'sum' }, // sum, avg, count, min, max or a function
|
|
207
|
+
{ data: 'site', renderer: linkRenderer((v) => String(v)) }, // http, https, mailto and tel only
|
|
208
|
+
],
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
grid.hideRows([3]);
|
|
212
|
+
grid.setCellNote(0, 1, 'Check this');
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
In server mode, totals come from `summaryValues: { total: 1234 }`, because the page cannot know them. To export the full result there, give `fetchAllRows: (query) => api.all(query)` and call `downloadAllXLSX()` or `downloadAllCSV()`.
|
|
216
|
+
|
|
217
|
+
### Theming
|
|
218
|
+
|
|
219
|
+
`theme: 'light' | 'dark' | 'auto'` can change at runtime through `updateSettings` or the React prop. Colors are CSS variables on `.ct-root`, `.ct-menu`, `.ct-bar` and `.ct-pager`: `--ct-bg`, `--ct-fg`, `--ct-muted`, `--ct-grid`, `--ct-header-bg`, `--ct-header-fg`, `--ct-header-hl`, `--ct-accent`, `--ct-range`, `--ct-error`, `--ct-invalid-bg`, `--ct-readonly-fg`, `--ct-shadow`, `--ct-match`, `--ct-note`.
|
|
220
|
+
|
|
170
221
|
### Find, formula bar, sorting by several columns
|
|
171
222
|
|
|
172
223
|
```ts
|
package/README.tr.md
CHANGED
|
@@ -16,6 +16,9 @@ Spreadsheet benzeri bir data grid ve ona bağlı, çok sayfalı bir formül moto
|
|
|
16
16
|
- **Yerleşim:** sabit satır ve sütunlar, birleştirilmiş hücreler, gizli sütunlar, sürükleyerek sütun taşıma.
|
|
17
17
|
- **Formül motoru:** 100'den fazla fonksiyon (SUM, IF, XLOOKUP, SUMIFS, TEXT, tarih fonksiyonları…), taşan dinamik diziler (FILTER, SORT, UNIQUE, SEQUENCE), sayfalar arası referanslar (`'Diğer Sayfa'!A1`), isimli ifadeler, artımlı yeniden hesaplama, döngü tespiti.
|
|
18
18
|
- **Sunucu modu:** sayfalama, sıralama ve süzme arka uçta; sayfa çubuğu ile metin, liste, tarih ve evet/hayır süzgeçleri.
|
|
19
|
+
- **Düzenleme:** kimlik saklayıp etiket gösteren açılır listeler, sunucuda aranan seçenekler, React bileşeni de olabilen özel editörler.
|
|
20
|
+
- **Satırlar:** açılır ayrıntı alanları, gizli satırlar, satır tıklama olayları, alt toplamlar, notlar ve bağlantılar.
|
|
21
|
+
- **Dokunmatik:** tutamaçlar parmağı izler, uzun basış sağ tık menüsünü açar.
|
|
19
22
|
- **Veri bağlama:** satırlar dizi ya da nesne olarak verilebilir. Nesnelerde sütunlar alan yoluna bağlanır ve düzenlemeler nesnelerinize geri yazılır.
|
|
20
23
|
- **İçe ve dışa aktarma:** XLSX okuma ve yazma (formüller, biçimler, stiller, sabit bölmeler, birleştirmeler), formül enjeksiyonuna karşı korumalı CSV; hiçbir kütüphane kullanmadan.
|
|
21
24
|
- **Erişilebilirlik:** ARIA grid rolleri, ekran okuyucuya duyurulan aktif hücre.
|
|
@@ -111,7 +114,7 @@ kitap.sheets.forEach((sayfa, i) => {
|
|
|
111
114
|
});
|
|
112
115
|
```
|
|
113
116
|
|
|
114
|
-
Okunanlar: değerler, formüller, sayı biçimleri, yazı tipleri, dolgular, hizalama, sütun genişlikleri, satır yükseklikleri, gizli sütunlar, sabit bölmeler, birleştirmeler ve tanımlı adlar. Okunmayanlar: grafikler, resimler, yorumlar, koşullu biçimler
|
|
117
|
+
Okunanlar: değerler, formüller, sayı biçimleri, yazı tipleri, dolgular, hizalama, sütun genişlikleri, satır yükseklikleri, gizli satır ve sütunlar, sabit bölmeler, birleştirmeler ve tanımlı adlar. Okunmayanlar: grafikler, resimler, yorumlar, koşullu biçimler ve veri doğrulama. Dosyada motorun bilmediği fonksiyonlar varsa `formulas: 'values'` ile formüller yerine dosyadaki sonuçları alabilirsiniz.
|
|
115
118
|
|
|
116
119
|
### Sunucu modu
|
|
117
120
|
|
|
@@ -146,7 +149,7 @@ Bilmeniz gerekenler:
|
|
|
146
149
|
- Değişiklik olayları `rowKey` ve `columnId` taşır; düzenlemeleri sayfa değişmeden önce de dahil kaydetmek uygulamaya aittir.
|
|
147
150
|
- Geri alma geçmişi her yeni sayfada sıfırlanır.
|
|
148
151
|
- `formulas` verilmedikçe formüller kapalıdır; açılırsa yalnızca yüklü sayfayı görür.
|
|
149
|
-
- Tümünü seçme, bul ve değiştir,
|
|
152
|
+
- Tümünü seçme, bul ve değiştir, `downloadCSV`/`downloadXLSX` yalnızca yüklü sayfayı kapsar; `downloadAllCSV`/`downloadAllXLSX` ise `fetchAllRows` ile tüm sonucu aktarır.
|
|
150
153
|
- Satırlar yerelde eklenip silinemez. Sığmayan yapıştırma kesilir ve `afterPasteClipped` ile bildirilir.
|
|
151
154
|
|
|
152
155
|
### Satır olayları ve kolon düzeni
|
|
@@ -165,6 +168,54 @@ Bilmeniz gerekenler:
|
|
|
165
168
|
|
|
166
169
|
Kolon düzeni için kolon kimliği gerekir (`columns[i].id` ya da `data`). Geri yüklerken kaldırılmış kolonlar atlanır, yeni kolonlar kayıtlı olanların sonrasında kalır. Tarayıcıdaki gibi çift tıklama iki satır tıklaması da üretir. `setColumnLayout` kolon taşırsa geri alma geçmişini temizler.
|
|
167
170
|
|
|
171
|
+
### Editörler ve açılır listeler
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
import { reactEditor, reactRenderer } from 'cenitu-table/react';
|
|
175
|
+
|
|
176
|
+
const columns = [
|
|
177
|
+
// Kimliği saklar, etiketi gösterir; yazılan ve yapıştırılan etiketler kimliğe çevrilir.
|
|
178
|
+
{ data: 'durumId', type: 'dropdown', source: [{ value: 1, label: 'Açık' }, { value: 2, label: 'Kapalı' }] },
|
|
179
|
+
// Sunucuda arar. Eski istekler `signal` ile iptal edilir.
|
|
180
|
+
{
|
|
181
|
+
data: 'cariId',
|
|
182
|
+
type: 'dropdown',
|
|
183
|
+
loadOptions: (sorgu, signal) => api.cariler(sorgu, { signal }),
|
|
184
|
+
resolveLabel: (id, satir) => satir.cari?.ad,
|
|
185
|
+
},
|
|
186
|
+
{ data: 'renk', editor: reactEditor(RenkSecici) }, // prop'lar: value, commit, cancel, row, col…
|
|
187
|
+
{ data: 'durum', renderer: reactRenderer(DurumRozeti) }, // prop'lar: value, context
|
|
188
|
+
];
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
React olmadan editör bir fonksiyondur: `editor: ({ el, value, commit, cancel }) => ({ getValue, destroy })`. `el` içine çizer, `commit(deger)` ya da `cancel()` ile biter. Başka yere tıklanınca varsa `getValue()` saklanır; `destroy` nasıl kapanırsa kapansın bir kez çalışır. `loadOptions` ile yalnızca metin yazmak değeri değiştirmez: seçenek seçilmeli ya da hücre boşaltılmalıdır (`strict: false` serbest metne izin verir).
|
|
192
|
+
|
|
193
|
+
`renderer` bir temizlik fonksiyonu döndürebilir; hücre elemanı kaydırma sırasında yeniden kullanılırken çağrılır.
|
|
194
|
+
|
|
195
|
+
### Satırlar, toplamlar, notlar ve bağlantılar
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
import { linkRenderer } from 'cenitu-table';
|
|
199
|
+
|
|
200
|
+
new CenituGrid(el, {
|
|
201
|
+
data,
|
|
202
|
+
rowDetail: (alan, satir) => void (alan.textContent = satir.aciklama), // satır başlığında açma işareti
|
|
203
|
+
columns: [
|
|
204
|
+
{ data: 'tutar', summary: 'sum' }, // sum, avg, count, min, max ya da fonksiyon
|
|
205
|
+
{ data: 'site', renderer: linkRenderer((v) => String(v)) }, // yalnızca http, https, mailto, tel
|
|
206
|
+
],
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
grid.hideRows([3]);
|
|
210
|
+
grid.setCellNote(0, 1, 'Kontrol et');
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Sunucu modunda toplamlar `summaryValues: { tutar: 1234 }` ile verilir, çünkü sayfa bunları bilemez. Tüm sonucu dışa aktarmak için `fetchAllRows: (sorgu) => api.tumu(sorgu)` verip `downloadAllXLSX()` ya da `downloadAllCSV()` çağırın.
|
|
214
|
+
|
|
215
|
+
### Tema
|
|
216
|
+
|
|
217
|
+
`theme: 'light' | 'dark' | 'auto'` çalışırken `updateSettings` ya da React prop'uyla değiştirilebilir. Renkler `.ct-root`, `.ct-menu`, `.ct-bar` ve `.ct-pager` üzerindeki CSS değişkenleridir: `--ct-bg`, `--ct-fg`, `--ct-muted`, `--ct-grid`, `--ct-header-bg`, `--ct-header-fg`, `--ct-header-hl`, `--ct-accent`, `--ct-range`, `--ct-error`, `--ct-invalid-bg`, `--ct-readonly-fg`, `--ct-shadow`, `--ct-match`, `--ct-note`.
|
|
218
|
+
|
|
168
219
|
### Bul, formül çubuğu, çok sütunlu sıralama
|
|
169
220
|
|
|
170
221
|
```ts
|
package/dist/cenitu-table.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-Cl7J9niR.cjs");exports.CSV_MIME=e.CSV_MIME;exports.CellError=e.CellError;exports.CenituGrid=e.CenituGrid;exports.FormulaEngine=e.FormulaEngine;exports.FormulaSyntaxError=e.FormulaSyntaxError;exports.MAX_COLS=e.MAX_COLS;exports.MAX_ROWS=e.MAX_ROWS;exports.RangeValue=e.RangeValue;exports.SHEET_SPAN=e.SHEET_SPAN;exports.XLSX_MIME=e.XLSX_MIME;exports.ZipReader=e.ZipReader;exports.cellKey=e.cellKey;exports.columnIndex=e.columnIndex;exports.columnLabel=e.columnLabel;exports.crc32=e.crc32;exports.dateCodeFromPattern=e.dateCodeFromPattern;exports.dateToSerial=e.dateToSerial;exports.downloadBlob=e.downloadBlob;exports.enUS=e.enUS;exports.formatDateCode=e.formatDateCode;exports.formatSerialDate=e.formatSerialDate;exports.getRegisteredFunctionNames=e.getRegisteredFunctionNames;exports.inverseMove=e.inverseMove;exports.isDateFormat=e.isDateFormat;exports.isError=e.isError;exports.isFormula=e.isFormula;exports.keyToAddress=e.keyToAddress;exports.linkRenderer=e.linkRenderer;exports.normalizeRange=e.normalizeRange;exports.numberFormatFromMeta=e.numberFormatFromMeta;exports.parseA1=e.parseA1;exports.parseDateString=e.parseDateString;exports.parseFormula=e.parseFormula;exports.pxToColWidth=e.pxToColWidth;exports.quoteSheetName=e.quoteSheetName;exports.rangeContains=e.rangeContains;exports.readXLSX=e.readXLSX;exports.registerFunction=e.registerFunction;exports.sanitizeSheetNames=e.sanitizeSheetNames;exports.serialToDate=e.serialToDate;exports.setClock=e.setClock;exports.setRandom=e.setRandom;exports.toA1=e.toA1;exports.toCSV=e.toCSV;exports.toXLSX=e.toXLSX;exports.toXLSXCompressed=e.toXLSXCompressed;exports.trTR=e.trTR;exports.unparse=e.unparse;exports.unregisterFunction=e.unregisterFunction;exports.workbookEngine=e.workbookEngine;exports.xlsxParts=e.xlsxParts;exports.zipDeflate=e.zipDeflate;exports.zipStore=e.zipStore;
|
package/dist/cenitu-table.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, b as r, C as o, F as t, c as n, M as i, d as l, R as m, S, X as d, Z as u, e as C, f as F, g, h as p, j as X, k as c, l as E, m as M, n as R, o as x, p as A, q as D, r as L, s as T, t as
|
|
1
|
+
import { a as e, b as r, C as o, F as t, c as n, M as i, d as l, R as m, S, X as d, Z as u, e as C, f as F, g, h as p, j as X, k as c, l as E, m as M, n as R, o as x, p as A, q as D, r as L, s as T, t as k, u as _, v as b, w as f, x as z, y as N, z as h, A as y, B as I, D as P, E as V, G as v, H as w, I as W, J as q, K as B, L as G, N as H, P as K, Q as O, T as U, U as Z, V as j, W as J, Y as Q, _ as Y, $, a0 as aa } from "./index-CKuAiNIg.js";
|
|
2
2
|
export {
|
|
3
3
|
e as CSV_MIME,
|
|
4
4
|
r as CellError,
|
|
@@ -25,31 +25,32 @@ export {
|
|
|
25
25
|
D as inverseMove,
|
|
26
26
|
L as isDateFormat,
|
|
27
27
|
T as isError,
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
k as isFormula,
|
|
29
|
+
_ as keyToAddress,
|
|
30
|
+
b as linkRenderer,
|
|
30
31
|
f as normalizeRange,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
32
|
+
z as numberFormatFromMeta,
|
|
33
|
+
N as parseA1,
|
|
34
|
+
h as parseDateString,
|
|
35
|
+
y as parseFormula,
|
|
36
|
+
I as pxToColWidth,
|
|
37
|
+
P as quoteSheetName,
|
|
38
|
+
V as rangeContains,
|
|
39
|
+
v as readXLSX,
|
|
40
|
+
w as registerFunction,
|
|
41
|
+
W as sanitizeSheetNames,
|
|
42
|
+
q as serialToDate,
|
|
43
|
+
B as setClock,
|
|
44
|
+
G as setRandom,
|
|
45
|
+
H as toA1,
|
|
46
|
+
K as toCSV,
|
|
47
|
+
O as toXLSX,
|
|
48
|
+
U as toXLSXCompressed,
|
|
49
|
+
Z as trTR,
|
|
50
|
+
j as unparse,
|
|
51
|
+
J as unregisterFunction,
|
|
52
|
+
Q as workbookEngine,
|
|
53
|
+
Y as xlsxParts,
|
|
54
|
+
$ as zipDeflate,
|
|
55
|
+
aa as zipStore
|
|
55
56
|
};
|