@freegridjs/core 1.0.1 → 1.1.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/dist/cdn/freegrid.esm.js +27 -14
- package/dist/cdn/freegrid.min.js +26 -13
- package/dist/index.d.ts +3 -3
- package/dist/index.js +210 -71
- package/dist/locales/de.d.ts +1 -1
- package/dist/locales/de.js +1 -0
- package/dist/locales/en.d.ts +1 -1
- package/dist/locales/en.js +1 -0
- package/dist/locales/es.d.ts +1 -1
- package/dist/locales/es.js +1 -0
- package/dist/locales/fr.d.ts +1 -1
- package/dist/locales/fr.js +1 -0
- package/dist/locales/id.d.ts +1 -1
- package/dist/locales/id.js +1 -0
- package/dist/locales/it.d.ts +1 -1
- package/dist/locales/it.js +1 -0
- package/dist/locales/ja.d.ts +1 -1
- package/dist/locales/ja.js +1 -0
- package/dist/locales/ko.d.ts +1 -1
- package/dist/locales/ko.js +1 -0
- package/dist/locales/pt-BR.d.ts +1 -1
- package/dist/locales/pt-BR.js +1 -0
- package/dist/locales/ru.d.ts +1 -1
- package/dist/locales/ru.js +1 -0
- package/dist/locales/th.d.ts +1 -1
- package/dist/locales/th.js +1 -0
- package/dist/locales/vi.d.ts +1 -1
- package/dist/locales/vi.js +1 -0
- package/dist/locales/zh-CN.d.ts +1 -1
- package/dist/locales/zh-CN.js +1 -0
- package/dist/locales/zh-TW.d.ts +1 -1
- package/dist/locales/zh-TW.js +1 -0
- package/dist/{types-bFz-Q6ac.d.ts → types-BDvXVuCe.d.ts} +32 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { G as GridOptions, a as GridApi, E as ExportOptions, R as Row, D as Datasource, L as LocalePack } from './types-
|
|
2
|
-
export { A as AdvancedFilter, b as AdvancedFilterCondition, c as Aggregator, C as CellEvent, d as CellParams, e as ChartHandle, f as ChartOptions, g as ColumnDef, h as ColumnState, i as ColumnType, j as CombinedFilterModel, k as ContextMenuItem, l as ContextMenuParams, m as CustomEditor, n as DateFilterModel, o as DateOp, p as EditorParams, q as EditorSpec, F as FilterModel, r as FilterOp, s as FilterType, t as GridEvents, u as GridRange, I as InvalidCell, K as KeyAction, M as Messages, N as NumberFilterModel, v as NumberOp, P as PivotConfig, w as
|
|
1
|
+
import { G as GridOptions, a as GridApi, E as ExportOptions, R as Row, D as Datasource, L as LocalePack } from './types-BDvXVuCe.js';
|
|
2
|
+
export { A as AdvancedFilter, b as AdvancedFilterCondition, c as Aggregator, C as CellEvent, d as CellParams, e as ChartHandle, f as ChartOptions, g as ColumnDef, h as ColumnState, i as ColumnType, j as CombinedFilterModel, k as ContextMenuItem, l as ContextMenuParams, m as CustomEditor, n as DateFilterModel, o as DateOp, p as EditorParams, q as EditorSpec, F as FilterModel, r as FilterOp, s as FilterType, t as GridEvents, u as GridRange, I as InvalidCell, K as KeyAction, M as Messages, N as NumberFilterModel, v as NumberOp, P as PivotConfig, w as PrintOptions, x as Region, y as RowDragOptions, z as RowDropParams, B as RowDropPosition, H as RowTransaction, S as SavedGridState, J as SavedStatePart, O as ScrollPosition, Q as SelectOption, T as ServerParams, U as SetFilterModel, V as SortDir, W as SortItem, X as SpanParams, Y as SummaryCell, Z as SummaryOptions, _ as SummaryRowDef, $ as TextFilterModel, a0 as TextOp, a1 as TransactionResult, a2 as XlsxCell, a3 as XlsxSheet, a4 as readXlsx, a5 as writeXlsx } from './types-BDvXVuCe.js';
|
|
3
3
|
export { default as en } from './locales/en.js';
|
|
4
4
|
|
|
5
5
|
declare function createGrid(host: HTMLElement, options: GridOptions): GridApi;
|
|
6
6
|
|
|
7
7
|
/** FreeGrid version (kept in sync with releases.json by scripts/release.mjs). */
|
|
8
|
-
declare const version = "1.0
|
|
8
|
+
declare const version = "1.1.0";
|
|
9
9
|
|
|
10
10
|
interface LicenseInfo {
|
|
11
11
|
/** Licensed domains (plus their www. host); `*.example.com` also covers every subdomain. */
|
package/dist/index.js
CHANGED
|
@@ -2582,6 +2582,7 @@ var en = {
|
|
|
2582
2582
|
clearFilters: "Clear all filters",
|
|
2583
2583
|
exportCsv: "Export CSV",
|
|
2584
2584
|
exportExcel: "Export Excel",
|
|
2585
|
+
print: "Print\u2026",
|
|
2585
2586
|
pivot: "Pivot",
|
|
2586
2587
|
pivotMode: "Pivot mode",
|
|
2587
2588
|
pivotRows: "Row groups",
|
|
@@ -3643,6 +3644,7 @@ var ContextMenu = class {
|
|
|
3643
3644
|
{ label: loc.exportExcel, action: () => grid.api.exportXlsx() }
|
|
3644
3645
|
);
|
|
3645
3646
|
if (grid.options.advancedFilter !== false && !grid.options.pivot) items.push("separator", { label: `${loc.advancedFilter}\u2026`, action: () => grid.filterBuilder.open() });
|
|
3647
|
+
items.push("separator", { label: loc.print, action: () => grid.api.print() });
|
|
3646
3648
|
return items;
|
|
3647
3649
|
}
|
|
3648
3650
|
pasteFromClipboard() {
|
|
@@ -4677,6 +4679,58 @@ function attachHeader(grid) {
|
|
|
4677
4679
|
};
|
|
4678
4680
|
}
|
|
4679
4681
|
|
|
4682
|
+
// src/rows/sort.ts
|
|
4683
|
+
function compareNonBlank(a, b, collator) {
|
|
4684
|
+
if (typeof a === "number" && typeof b === "number") return a - b;
|
|
4685
|
+
if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();
|
|
4686
|
+
if (typeof a === "boolean" && typeof b === "boolean") return Number(a) - Number(b);
|
|
4687
|
+
return collator.compare(String(a), String(b));
|
|
4688
|
+
}
|
|
4689
|
+
function normalize(def, v) {
|
|
4690
|
+
if (isBlank(v)) return null;
|
|
4691
|
+
if (def.type === "number") {
|
|
4692
|
+
const n = typeof v === "number" ? v : Number(v);
|
|
4693
|
+
return Number.isNaN(n) ? null : n;
|
|
4694
|
+
}
|
|
4695
|
+
if (def.type === "date") return toDate(v)?.getTime() ?? null;
|
|
4696
|
+
return v;
|
|
4697
|
+
}
|
|
4698
|
+
function compareValues(a, b, collator) {
|
|
4699
|
+
const ba = isBlank(a), bb = isBlank(b);
|
|
4700
|
+
if (ba || bb) return ba === bb ? 0 : ba ? 1 : -1;
|
|
4701
|
+
return compareNonBlank(a, b, collator);
|
|
4702
|
+
}
|
|
4703
|
+
function sortNodes(nodes, sort, resolve, collator) {
|
|
4704
|
+
const keys = sort.map((s) => ({ def: resolve(s.colId), mul: s.dir === "desc" ? -1 : 1 })).filter((k) => !!k.def);
|
|
4705
|
+
if (!keys.length) return nodes;
|
|
4706
|
+
const values = keys.map((k) => nodes.map((n) => {
|
|
4707
|
+
const v = getCellValue(k.def, n.data);
|
|
4708
|
+
return k.def.comparator ? v : normalize(k.def, v);
|
|
4709
|
+
}));
|
|
4710
|
+
const order = nodes.map((_, i) => i);
|
|
4711
|
+
order.sort((i, j) => {
|
|
4712
|
+
for (let k = 0; k < keys.length; k++) {
|
|
4713
|
+
const { def, mul } = keys[k];
|
|
4714
|
+
const a = values[k][i], b = values[k][j];
|
|
4715
|
+
let c;
|
|
4716
|
+
if (def.comparator) {
|
|
4717
|
+
try {
|
|
4718
|
+
c = (Number(def.comparator(a, b, nodes[i].data, nodes[j].data)) || 0) * mul;
|
|
4719
|
+
} catch {
|
|
4720
|
+
warn(`comparator of column "${def.id ?? def.field}" threw; treating values as equal`);
|
|
4721
|
+
c = 0;
|
|
4722
|
+
}
|
|
4723
|
+
} else {
|
|
4724
|
+
const ba = isBlank(a), bb = isBlank(b);
|
|
4725
|
+
c = ba || bb ? ba === bb ? 0 : ba ? 1 : -1 : compareNonBlank(a, b, collator) * mul;
|
|
4726
|
+
}
|
|
4727
|
+
if (c) return c;
|
|
4728
|
+
}
|
|
4729
|
+
return i - j;
|
|
4730
|
+
});
|
|
4731
|
+
return order.map((i) => nodes[i]);
|
|
4732
|
+
}
|
|
4733
|
+
|
|
4680
4734
|
// src/export/csv.ts
|
|
4681
4735
|
var FORMULA = /^[=+\-@\t\r]/;
|
|
4682
4736
|
function toCsv(rows, sep = ",") {
|
|
@@ -5087,10 +5141,68 @@ var header = (def, id) => def.header ?? def.field ?? id;
|
|
|
5087
5141
|
var ALIGNS = ["left", "center", "right"];
|
|
5088
5142
|
var PLAIN_NUMBER = /^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i;
|
|
5089
5143
|
var escHtml = (s) => String(s ?? "").replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]);
|
|
5144
|
+
var PAPERS = ["A4", "A3", "A5", "B4", "B5", "letter", "legal"];
|
|
5145
|
+
var PORTRAIT_WIDTH = 760;
|
|
5146
|
+
var cssStr = (s) => `"${s.replace(/[\\"<\n\r]/g, (c) => c === "\n" ? "\\A " : c === "\r" ? "" : `\\${c.charCodeAt(0).toString(16)} `)}"`;
|
|
5147
|
+
var hexOf = (argb) => argb ? `#${argb.slice(2)}` : "";
|
|
5148
|
+
function printLines(grid, rows, groupBy) {
|
|
5149
|
+
const out = [];
|
|
5150
|
+
let n = 0;
|
|
5151
|
+
const sort = grid.store.state.sort;
|
|
5152
|
+
const collator = grid.collator();
|
|
5153
|
+
const walk = (list, level) => {
|
|
5154
|
+
if (level >= groupBy.length) {
|
|
5155
|
+
for (const row of list) out.push({ kind: "row", row, n: ++n });
|
|
5156
|
+
return;
|
|
5157
|
+
}
|
|
5158
|
+
const colId = groupBy[level];
|
|
5159
|
+
const def = grid.columns.getNode(colId)?.def;
|
|
5160
|
+
if (!def) return walk(list, level + 1);
|
|
5161
|
+
const buckets = /* @__PURE__ */ new Map();
|
|
5162
|
+
for (const r of list) {
|
|
5163
|
+
const v = getCellValue(def, r);
|
|
5164
|
+
const k = isBlank(v) ? "" : setKey(v);
|
|
5165
|
+
let b = buckets.get(k);
|
|
5166
|
+
if (!b) buckets.set(k, b = { value: v, rows: [] });
|
|
5167
|
+
b.rows.push(r);
|
|
5168
|
+
}
|
|
5169
|
+
const dir = sort.find((x) => x.colId === colId)?.dir === "desc" ? -1 : 1;
|
|
5170
|
+
for (const b of [...buckets.values()].sort((a, c) => compareValues(a.value, c.value, collator) * dir)) {
|
|
5171
|
+
out.push({ kind: "group", colId, value: b.value, rows: b.rows, level });
|
|
5172
|
+
walk(b.rows, level + 1);
|
|
5173
|
+
}
|
|
5174
|
+
};
|
|
5175
|
+
walk(rows, 0);
|
|
5176
|
+
return out;
|
|
5177
|
+
}
|
|
5178
|
+
var PRINT_CSS = `
|
|
5179
|
+
* { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
|
|
5180
|
+
body { font: 10.5px/1.45 system-ui, 'Pretendard', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif; color: #111827; margin: 0; }
|
|
5181
|
+
header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 0 0 10px; padding-bottom: 8px; border-bottom: 2px solid #111827; }
|
|
5182
|
+
h1 { font-size: 17px; margin: 0; letter-spacing: -.01em; }
|
|
5183
|
+
.sub { margin: 3px 0 0; color: #4b5563; font-size: 11px; }
|
|
5184
|
+
.printed { margin: 0; color: #6b7280; font-size: 9.5px; white-space: nowrap; }
|
|
5185
|
+
table { border-collapse: collapse; width: 100%; }
|
|
5186
|
+
table.fit { table-layout: fixed; }
|
|
5187
|
+
th, td { padding: 4px 7px; border-bottom: 1px solid #e5e7eb; vertical-align: top; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
|
|
5188
|
+
th { background: #f3f4f6; color: #374151; font-weight: 600; text-align: left; vertical-align: bottom; border-bottom: 1.5px solid #9ca3af; border-left: 1px solid #e5e7eb; }
|
|
5189
|
+
th.span { text-align: center; }
|
|
5190
|
+
th:first-child { border-left: 0; }
|
|
5191
|
+
thead { display: table-header-group; }
|
|
5192
|
+
tr { break-inside: avoid; page-break-inside: avoid; }
|
|
5193
|
+
.num { text-align: right; color: #9ca3af; }
|
|
5194
|
+
tr.group td { background: #eef2f7; font-weight: 600; border-top: 1px solid #cbd5e1; break-after: avoid; page-break-after: avoid; }
|
|
5195
|
+
tr.group.level-0 td { background: #e2e8f0; }
|
|
5196
|
+
tr.total td { font-weight: 700; background: #f3f4f6; border-top: 1.5px solid #111827; border-bottom: 0; }
|
|
5197
|
+
`;
|
|
5090
5198
|
function buildPrintHtml(grid, opts = {}) {
|
|
5091
5199
|
const cols = exportColumns(grid, opts.columns);
|
|
5092
|
-
const
|
|
5200
|
+
const loc = grid.store.state.locale;
|
|
5201
|
+
const code = loc.code;
|
|
5093
5202
|
const fmts = cols.map((c) => getFormatter(c.def, code));
|
|
5203
|
+
const nf = new Intl.NumberFormat(code);
|
|
5204
|
+
const numbered = opts.rowNumbers ?? !!grid.options.rowNumbers;
|
|
5205
|
+
const align = (def) => ALIGNS.includes(def.align) ? def.align : def.type === "number" ? "right" : def.type === "boolean" ? "center" : "left";
|
|
5094
5206
|
const chains = cols.map((c) => {
|
|
5095
5207
|
const chain = [];
|
|
5096
5208
|
for (let n = c.node; n; n = n.parent) chain.unshift(n);
|
|
@@ -5099,7 +5211,7 @@ function buildPrintHtml(grid, opts = {}) {
|
|
|
5099
5211
|
const depth = Math.max(1, ...chains.map((ch) => ch.length));
|
|
5100
5212
|
const head = [];
|
|
5101
5213
|
for (let level = 0; level < depth; level++) {
|
|
5102
|
-
let tr = "";
|
|
5214
|
+
let tr = level === 0 && numbered ? `<th class="num" rowspan="${depth}">#</th>` : "";
|
|
5103
5215
|
for (let ci = 0; ci < cols.length; ci++) {
|
|
5104
5216
|
const chain = chains[ci];
|
|
5105
5217
|
const leaf = chain.length - 1;
|
|
@@ -5108,29 +5220,108 @@ function buildPrintHtml(grid, opts = {}) {
|
|
|
5108
5220
|
if (ci > 0 && chains[ci - 1][level] === g) continue;
|
|
5109
5221
|
let span = 1;
|
|
5110
5222
|
while (ci + span < cols.length && chains[ci + span][level] === g) span++;
|
|
5111
|
-
tr += `<th colspan="${span}">${escHtml(header(g.def, g.id))}</th>`;
|
|
5223
|
+
tr += `<th colspan="${span}"${span > 1 ? ' class="span"' : ""}>${escHtml(header(g.def, g.id))}</th>`;
|
|
5112
5224
|
} else if (level === leaf) {
|
|
5113
|
-
|
|
5225
|
+
const a = align(cols[ci].def);
|
|
5226
|
+
tr += `<th colspan="1" rowspan="${depth - level}"${a === "left" ? "" : ` style="text-align:${a}"`}>${escHtml(header(cols[ci].def, cols[ci].id))}</th>`;
|
|
5114
5227
|
}
|
|
5115
5228
|
}
|
|
5116
5229
|
head.push(`<tr>${tr}</tr>`);
|
|
5117
5230
|
}
|
|
5118
|
-
const
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5231
|
+
const aggText = (c, i, v, agg) => {
|
|
5232
|
+
if (v == null || v === "") return "";
|
|
5233
|
+
if (agg === "count") return nf.format(v);
|
|
5234
|
+
const type = c.def.type ?? (typeof v === "number" ? "number" : v instanceof Date ? "date" : void 0);
|
|
5235
|
+
return type === c.def.type ? fmts[i](v) : getFormatter({ ...c.def, type }, code)(v);
|
|
5236
|
+
};
|
|
5237
|
+
const labelled = (cls, label, values, indent = 0) => {
|
|
5238
|
+
let lead = 0;
|
|
5239
|
+
while (lead < cols.length - 1 && !values[lead]) lead++;
|
|
5240
|
+
lead = Math.max(1, lead);
|
|
5241
|
+
let tr = numbered ? '<td class="num"></td>' : "";
|
|
5242
|
+
tr += `<td colspan="${lead}"${indent ? ` style="padding-left:${7 + indent * 14}px"` : ""}>${escHtml(label)}</td>`;
|
|
5243
|
+
for (let i = lead; i < cols.length; i++) tr += `<td style="text-align:${align(cols[i].def)}">${escHtml(values[i] ?? "")}</td>`;
|
|
5244
|
+
return `<tr class="${cls}">${tr}</tr>`;
|
|
5245
|
+
};
|
|
5246
|
+
const rows = exportRows(grid, opts.rows);
|
|
5247
|
+
const groupBy = opts.groups !== false && !grid.rowModel.server && !grid.options.treeData ? grid.getGroupBy() : [];
|
|
5248
|
+
const probe = opts.styles !== false && cols.some((c) => c.def.cellClass) ? classStyles(grid) : null;
|
|
5249
|
+
let body = "";
|
|
5250
|
+
try {
|
|
5251
|
+
for (const line of printLines(grid, rows, groupBy)) {
|
|
5252
|
+
if (line.kind === "group") {
|
|
5253
|
+
const def = grid.columns.getNode(line.colId)?.def;
|
|
5254
|
+
const value = isBlank(line.value) ? loc.blanks : def ? getFormatter(def, code)(line.value) : String(line.value);
|
|
5255
|
+
const label = `${def ? header(def, line.colId) : line.colId}: ${value} (${nf.format(line.rows.length)})`;
|
|
5256
|
+
const values = cols.map((c, i) => {
|
|
5257
|
+
if (!c.def.aggFunc || groupBy.includes(c.id)) return void 0;
|
|
5258
|
+
try {
|
|
5259
|
+
return aggText(c, i, aggregate(c.def.aggFunc, line.rows.map((r2) => getCellValue(c.def, r2)), line.rows), c.def.aggFunc) || void 0;
|
|
5260
|
+
} catch {
|
|
5261
|
+
return void 0;
|
|
5262
|
+
}
|
|
5263
|
+
});
|
|
5264
|
+
body += labelled(`group level-${Math.min(line.level, 5)}`, label, values, line.level);
|
|
5265
|
+
continue;
|
|
5266
|
+
}
|
|
5267
|
+
const r = line.row;
|
|
5268
|
+
let tr = numbered ? `<td class="num">${line.n}</td>` : "";
|
|
5269
|
+
cols.forEach((c, i) => {
|
|
5270
|
+
const v = getCellValue(c.def, r);
|
|
5271
|
+
const text2 = isBlank(v) ? "" : fmts[i](v);
|
|
5272
|
+
let style = `text-align:${align(c.def)}`;
|
|
5273
|
+
if (probe && c.def.cellClass) {
|
|
5274
|
+
let cls;
|
|
5275
|
+
try {
|
|
5276
|
+
cls = typeof c.def.cellClass === "function" ? c.def.cellClass({ value: v, formatted: text2, row: r, rowIndex: line.n - 1, column: c.def }) : c.def.cellClass;
|
|
5277
|
+
} catch {
|
|
5278
|
+
cls = void 0;
|
|
5279
|
+
}
|
|
5280
|
+
if (cls) {
|
|
5281
|
+
const st = probe.of(cls);
|
|
5282
|
+
if (st.color) style += `;color:${hexOf(st.color)}`;
|
|
5283
|
+
if (st.fill) style += `;background:${hexOf(st.fill)}`;
|
|
5284
|
+
if (st.bold) style += ";font-weight:600";
|
|
5285
|
+
}
|
|
5286
|
+
}
|
|
5287
|
+
tr += `<td style="${style}">${escHtml(text2)}</td>`;
|
|
5288
|
+
});
|
|
5289
|
+
body += `<tr>${tr}</tr>`;
|
|
5290
|
+
}
|
|
5291
|
+
} finally {
|
|
5292
|
+
probe?.dispose();
|
|
5293
|
+
}
|
|
5294
|
+
let foot = "";
|
|
5295
|
+
const summary = opts.summary !== false ? grid.summary() : null;
|
|
5296
|
+
if (summary) {
|
|
5297
|
+
summary.opts.rows.forEach((def, ri) => {
|
|
5298
|
+
const values = cols.map((c, i) => {
|
|
5299
|
+
const spec = def.columns?.[c.id];
|
|
5300
|
+
return spec === void 0 ? void 0 : aggText(c, i, summary.values[ri]?.[c.id], cellSpec(spec).agg) || void 0;
|
|
5301
|
+
});
|
|
5302
|
+
foot += labelled("total", def.label ?? "", values);
|
|
5303
|
+
});
|
|
5304
|
+
}
|
|
5305
|
+
const widths = cols.map((c) => Math.max(1, c.width));
|
|
5306
|
+
const sum = widths.reduce((a, b) => a + b, 0);
|
|
5307
|
+
const paper = PAPERS.includes(opts.paper) ? opts.paper : "A4";
|
|
5308
|
+
const orientation = opts.orientation === "portrait" || opts.orientation === "landscape" ? opts.orientation : sum + (numbered ? 40 : 0) > PORTRAIT_WIDTH ? "landscape" : "portrait";
|
|
5309
|
+
const fit = opts.fitToWidth !== false;
|
|
5310
|
+
const colgroup = fit ? `<colgroup>${numbered ? '<col style="width:40px">' : ""}${widths.map((w) => `<col style="width:${Math.round(w / sum * 1e3) / 10}%">`).join("")}</colgroup>` : "";
|
|
5123
5311
|
const title = escHtml(opts.title ?? document.title ?? "");
|
|
5312
|
+
const printed = opts.printedAt !== false ? new Intl.DateTimeFormat(code, { dateStyle: "medium", timeStyle: "short" }).format(/* @__PURE__ */ new Date()) : "";
|
|
5313
|
+
const heading = opts.title || opts.subtitle ? `<div>${opts.title ? `<h1>${title}</h1>` : ""}${opts.subtitle ? `<p class="sub">${escHtml(opts.subtitle)}</p>` : ""}</div>` : "<div></div>";
|
|
5314
|
+
const top = opts.title || opts.subtitle || printed ? `<header>${heading}${printed ? `<p class="printed">${escHtml(printed)}</p>` : ""}</header>` : "";
|
|
5315
|
+
const small = "font: 8.5px system-ui, sans-serif; color: #6b7280;";
|
|
5316
|
+
const page = [
|
|
5317
|
+
`size: ${paper} ${orientation}; margin: 12mm 12mm 14mm;`,
|
|
5318
|
+
opts.footer ? `@bottom-left { content: ${cssStr(opts.footer)}; ${small} }` : "",
|
|
5319
|
+
opts.pageNumbers !== false ? `@bottom-right { content: counter(page) " / " counter(pages); ${small} }` : ""
|
|
5320
|
+
].join(" ");
|
|
5321
|
+
const stripes = opts.striped !== false ? "tbody tr:not(.group):nth-child(even) td { background: #f9fafb; }" : "";
|
|
5124
5322
|
return `<!doctype html><html lang="${escHtml(code)}"><head><meta charset="utf-8"><title>${title}</title><style>
|
|
5125
|
-
@page {
|
|
5126
|
-
body
|
|
5127
|
-
h1 { font-size: 15px; margin: 0 0 8px; }
|
|
5128
|
-
table { border-collapse: collapse; width: 100%; }
|
|
5129
|
-
th, td { border: 1px solid #999; padding: 3px 6px; }
|
|
5130
|
-
th { background: #eee; font-weight: 600; }
|
|
5131
|
-
thead { display: table-header-group; }
|
|
5132
|
-
tr { page-break-inside: avoid; }
|
|
5133
|
-
</style></head><body>${opts.title ? `<h1>${title}</h1>` : ""}<table><thead>${opts.headers === false ? "" : head.join("")}</thead><tbody>${body}</tbody></table></body></html>`;
|
|
5323
|
+
@page { ${page} }${PRINT_CSS}${stripes}
|
|
5324
|
+
</style></head><body>${top}<table${fit ? ' class="fit"' : ""}>${colgroup}<thead>${opts.headers === false ? "" : head.join("")}</thead><tbody>${body}</tbody>${foot ? `<tfoot>${foot}</tfoot>` : ""}</table></body></html>`;
|
|
5134
5325
|
}
|
|
5135
5326
|
function printHtml(html) {
|
|
5136
5327
|
if (typeof document === "undefined") return;
|
|
@@ -5778,58 +5969,6 @@ var GridCharts = class {
|
|
|
5778
5969
|
}
|
|
5779
5970
|
};
|
|
5780
5971
|
|
|
5781
|
-
// src/rows/sort.ts
|
|
5782
|
-
function compareNonBlank(a, b, collator) {
|
|
5783
|
-
if (typeof a === "number" && typeof b === "number") return a - b;
|
|
5784
|
-
if (a instanceof Date && b instanceof Date) return a.getTime() - b.getTime();
|
|
5785
|
-
if (typeof a === "boolean" && typeof b === "boolean") return Number(a) - Number(b);
|
|
5786
|
-
return collator.compare(String(a), String(b));
|
|
5787
|
-
}
|
|
5788
|
-
function normalize(def, v) {
|
|
5789
|
-
if (isBlank(v)) return null;
|
|
5790
|
-
if (def.type === "number") {
|
|
5791
|
-
const n = typeof v === "number" ? v : Number(v);
|
|
5792
|
-
return Number.isNaN(n) ? null : n;
|
|
5793
|
-
}
|
|
5794
|
-
if (def.type === "date") return toDate(v)?.getTime() ?? null;
|
|
5795
|
-
return v;
|
|
5796
|
-
}
|
|
5797
|
-
function compareValues(a, b, collator) {
|
|
5798
|
-
const ba = isBlank(a), bb = isBlank(b);
|
|
5799
|
-
if (ba || bb) return ba === bb ? 0 : ba ? 1 : -1;
|
|
5800
|
-
return compareNonBlank(a, b, collator);
|
|
5801
|
-
}
|
|
5802
|
-
function sortNodes(nodes, sort, resolve, collator) {
|
|
5803
|
-
const keys = sort.map((s) => ({ def: resolve(s.colId), mul: s.dir === "desc" ? -1 : 1 })).filter((k) => !!k.def);
|
|
5804
|
-
if (!keys.length) return nodes;
|
|
5805
|
-
const values = keys.map((k) => nodes.map((n) => {
|
|
5806
|
-
const v = getCellValue(k.def, n.data);
|
|
5807
|
-
return k.def.comparator ? v : normalize(k.def, v);
|
|
5808
|
-
}));
|
|
5809
|
-
const order = nodes.map((_, i) => i);
|
|
5810
|
-
order.sort((i, j) => {
|
|
5811
|
-
for (let k = 0; k < keys.length; k++) {
|
|
5812
|
-
const { def, mul } = keys[k];
|
|
5813
|
-
const a = values[k][i], b = values[k][j];
|
|
5814
|
-
let c;
|
|
5815
|
-
if (def.comparator) {
|
|
5816
|
-
try {
|
|
5817
|
-
c = (Number(def.comparator(a, b, nodes[i].data, nodes[j].data)) || 0) * mul;
|
|
5818
|
-
} catch {
|
|
5819
|
-
warn(`comparator of column "${def.id ?? def.field}" threw; treating values as equal`);
|
|
5820
|
-
c = 0;
|
|
5821
|
-
}
|
|
5822
|
-
} else {
|
|
5823
|
-
const ba = isBlank(a), bb = isBlank(b);
|
|
5824
|
-
c = ba || bb ? ba === bb ? 0 : ba ? 1 : -1 : compareNonBlank(a, b, collator) * mul;
|
|
5825
|
-
}
|
|
5826
|
-
if (c) return c;
|
|
5827
|
-
}
|
|
5828
|
-
return i - j;
|
|
5829
|
-
});
|
|
5830
|
-
return order.map((i) => nodes[i]);
|
|
5831
|
-
}
|
|
5832
|
-
|
|
5833
5972
|
// src/pivot.ts
|
|
5834
5973
|
var SOURCE = /* @__PURE__ */ new WeakMap();
|
|
5835
5974
|
var aggName = (a) => typeof a === "function" ? "custom" : a;
|
|
@@ -5955,7 +6094,7 @@ function buildPivot(source, config, defOf, labels, locale) {
|
|
|
5955
6094
|
}
|
|
5956
6095
|
|
|
5957
6096
|
// src/version.ts
|
|
5958
|
-
var version = "1.0
|
|
6097
|
+
var version = "1.1.0";
|
|
5959
6098
|
|
|
5960
6099
|
// src/license.ts
|
|
5961
6100
|
var PUBLIC_KEY = { kty: "EC", crv: "P-256", x: "sUTKkglZmk-HMKPNub8p7AeLBKesHCU8irIkw9rJlbE", y: "j0U_aKRDR7iApY9UpaD3hUemhBLZJwDv9-QiT_hUyw8" };
|
package/dist/locales/de.d.ts
CHANGED
package/dist/locales/de.js
CHANGED
package/dist/locales/en.d.ts
CHANGED
package/dist/locales/en.js
CHANGED
package/dist/locales/es.d.ts
CHANGED
package/dist/locales/es.js
CHANGED
package/dist/locales/fr.d.ts
CHANGED
package/dist/locales/fr.js
CHANGED
package/dist/locales/id.d.ts
CHANGED
package/dist/locales/id.js
CHANGED
package/dist/locales/it.d.ts
CHANGED
package/dist/locales/it.js
CHANGED
package/dist/locales/ja.d.ts
CHANGED
package/dist/locales/ja.js
CHANGED
|
@@ -72,6 +72,7 @@ var ja = {
|
|
|
72
72
|
clearFilters: "\u3059\u3079\u3066\u306E\u30D5\u30A3\u30EB\u30BF\u30FC\u3092\u89E3\u9664",
|
|
73
73
|
exportCsv: "CSV \u306B\u66F8\u304D\u51FA\u3059",
|
|
74
74
|
exportExcel: "Excel \u306B\u66F8\u304D\u51FA\u3059",
|
|
75
|
+
print: "\u5370\u5237\u2026",
|
|
75
76
|
pivot: "\u30D4\u30DC\u30C3\u30C8",
|
|
76
77
|
pivotMode: "\u30D4\u30DC\u30C3\u30C8\u30E2\u30FC\u30C9",
|
|
77
78
|
pivotRows: "\u884C\u30B0\u30EB\u30FC\u30D7",
|
package/dist/locales/ko.d.ts
CHANGED
package/dist/locales/ko.js
CHANGED
|
@@ -72,6 +72,7 @@ var ko = {
|
|
|
72
72
|
clearFilters: "\uD544\uD130 \uBAA8\uB450 \uC9C0\uC6B0\uAE30",
|
|
73
73
|
exportCsv: "CSV\uB85C \uB0B4\uBCF4\uB0B4\uAE30",
|
|
74
74
|
exportExcel: "\uC5D1\uC140\uB85C \uB0B4\uBCF4\uB0B4\uAE30",
|
|
75
|
+
print: "\uC778\uC1C4\u2026",
|
|
75
76
|
pivot: "\uD53C\uBC97",
|
|
76
77
|
pivotMode: "\uD53C\uBC97 \uBAA8\uB4DC",
|
|
77
78
|
pivotRows: "\uD589 \uADF8\uB8F9",
|
package/dist/locales/pt-BR.d.ts
CHANGED
package/dist/locales/pt-BR.js
CHANGED
package/dist/locales/ru.d.ts
CHANGED
package/dist/locales/ru.js
CHANGED
|
@@ -72,6 +72,7 @@ var ru = {
|
|
|
72
72
|
clearFilters: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0432\u0441\u0435 \u0444\u0438\u043B\u044C\u0442\u0440\u044B",
|
|
73
73
|
exportCsv: "\u042D\u043A\u0441\u043F\u043E\u0440\u0442 \u0432 CSV",
|
|
74
74
|
exportExcel: "\u042D\u043A\u0441\u043F\u043E\u0440\u0442 \u0432 Excel",
|
|
75
|
+
print: "\u041F\u0435\u0447\u0430\u0442\u044C\u2026",
|
|
75
76
|
pivot: "\u0421\u0432\u043E\u0434\u043D\u0430\u044F",
|
|
76
77
|
pivotMode: "\u0420\u0435\u0436\u0438\u043C \u0441\u0432\u043E\u0434\u043D\u043E\u0439 \u0442\u0430\u0431\u043B\u0438\u0446\u044B",
|
|
77
78
|
pivotRows: "\u0413\u0440\u0443\u043F\u043F\u044B \u0441\u0442\u0440\u043E\u043A",
|
package/dist/locales/th.d.ts
CHANGED
package/dist/locales/th.js
CHANGED
|
@@ -72,6 +72,7 @@ var th = {
|
|
|
72
72
|
clearFilters: "\u0E25\u0E49\u0E32\u0E07\u0E15\u0E31\u0E27\u0E01\u0E23\u0E2D\u0E07\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14",
|
|
73
73
|
exportCsv: "\u0E2A\u0E48\u0E07\u0E2D\u0E2D\u0E01 CSV",
|
|
74
74
|
exportExcel: "\u0E2A\u0E48\u0E07\u0E2D\u0E2D\u0E01 Excel",
|
|
75
|
+
print: "\u0E1E\u0E34\u0E21\u0E1E\u0E4C\u2026",
|
|
75
76
|
pivot: "Pivot",
|
|
76
77
|
pivotMode: "\u0E42\u0E2B\u0E21\u0E14 Pivot",
|
|
77
78
|
pivotRows: "\u0E01\u0E25\u0E38\u0E48\u0E21\u0E41\u0E16\u0E27",
|
package/dist/locales/vi.d.ts
CHANGED
package/dist/locales/vi.js
CHANGED
package/dist/locales/zh-CN.d.ts
CHANGED
package/dist/locales/zh-CN.js
CHANGED
|
@@ -72,6 +72,7 @@ var zhCN = {
|
|
|
72
72
|
clearFilters: "\u6E05\u9664\u6240\u6709\u7B5B\u9009",
|
|
73
73
|
exportCsv: "\u5BFC\u51FA CSV",
|
|
74
74
|
exportExcel: "\u5BFC\u51FA Excel",
|
|
75
|
+
print: "\u6253\u5370\u2026",
|
|
75
76
|
pivot: "\u6570\u636E\u900F\u89C6",
|
|
76
77
|
pivotMode: "\u900F\u89C6\u6A21\u5F0F",
|
|
77
78
|
pivotRows: "\u884C\u5206\u7EC4",
|
package/dist/locales/zh-TW.d.ts
CHANGED
package/dist/locales/zh-TW.js
CHANGED
|
@@ -72,6 +72,7 @@ var zhTW = {
|
|
|
72
72
|
clearFilters: "\u6E05\u9664\u6240\u6709\u7BE9\u9078",
|
|
73
73
|
exportCsv: "\u532F\u51FA CSV",
|
|
74
74
|
exportExcel: "\u532F\u51FA Excel",
|
|
75
|
+
print: "\u5217\u5370\u2026",
|
|
75
76
|
pivot: "\u6A1E\u7D10\u5206\u6790",
|
|
76
77
|
pivotMode: "\u6A1E\u7D10\u5206\u6790\u6A21\u5F0F",
|
|
77
78
|
pivotRows: "\u5217\u7FA4\u7D44",
|