@svgrid/enterprise 3.1.16 → 3.1.18

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.
Files changed (57) hide show
  1. package/dist/SvGridEditPanel.svelte +14 -1
  2. package/dist/SvGridScheduler.svelte +15 -6
  3. package/dist/SvSheet.svelte +2 -0
  4. package/dist/cdn/svgrid-enterprise.svelte-external.js +6582 -6501
  5. package/dist/designer/assets/{index-C0GDyyFs.js → index-DKudY-XD.js} +357 -346
  6. package/dist/designer/assets/index-WCxj6WfJ.css +1 -0
  7. package/dist/designer/index.html +2 -2
  8. package/dist/fields/SvBase.svelte +36 -33
  9. package/dist/fields/base-connect.js +50 -9
  10. package/dist/fields/base-sql.d.ts +8 -0
  11. package/dist/fields/base-sql.js +12 -3
  12. package/dist/install.js +3 -3
  13. package/dist/node/studio.js +205 -60
  14. package/dist/sheet-enable.d.ts +8 -2
  15. package/dist/sheet-enable.js +21 -9
  16. package/dist/sources/introspect-supabase.d.ts +6 -3
  17. package/dist/sources/introspect-supabase.js +29 -11
  18. package/dist/sources/supabase.d.ts +10 -0
  19. package/dist/sources/supabase.js +11 -2
  20. package/dist/studio/cli.d.ts +9 -0
  21. package/dist/studio/cli.js +41 -7
  22. package/dist/studio/emit-project.d.ts +3 -1
  23. package/dist/studio/emit-project.js +84 -33
  24. package/dist/studio/emit-schema.js +9 -2
  25. package/dist/studio/index.d.ts +1 -1
  26. package/dist/studio/init-flow.d.ts +7 -0
  27. package/dist/studio/init-flow.js +23 -2
  28. package/dist/studio/introspect-db.d.ts +15 -1
  29. package/dist/studio/introspect-db.js +29 -5
  30. package/dist/sveltekit/sql-source.d.ts +24 -0
  31. package/dist/sveltekit/sql-source.js +34 -1
  32. package/dist/sveltekit/sql.js +14 -2
  33. package/dist/version.d.ts +2 -2
  34. package/dist/version.js +2 -2
  35. package/dist/wc/GridFooter-BgoA77TJ.js +145 -0
  36. package/dist/wc/{GridMenus-q9qYpzKh.js → GridMenus-DVGuqp2l.js} +430 -430
  37. package/dist/wc/{PinSplitter-D-qtDhSM.js → PinSplitter-Btco0txr.js} +24 -24
  38. package/dist/wc/{SvChartMenu-CQNrQGT2.js → SvChartMenu-Ue-HFR5c.js} +58 -58
  39. package/dist/wc/{SvDateRangeInput-BYNOfYxD.js → SvDateRangeInput-CJZohgBe.js} +43 -43
  40. package/dist/wc/{SvDateTimePicker-Bq9N0Oiy.js → SvDateTimePicker-DmK_QkkU.js} +241 -241
  41. package/dist/wc/{SvField-B_kurx_P.js → SvField-C-OodMMv.js} +71 -71
  42. package/dist/wc/SvGridCellEditor-C7ios4i_.js +582 -0
  43. package/dist/wc/{SvGridChart-DrmqEen2.js → SvGridChart-DWRqlhCV.js} +549 -549
  44. package/dist/wc/{SvGridChartBuilder-XFvW1BdT.js → SvGridChartBuilder-BXW3yUR0.js} +337 -337
  45. package/dist/wc/{SvGridChartPanel-oJJtUKG6.js → SvGridChartPanel-28n4tomx.js} +354 -354
  46. package/dist/wc/{SvGridChartView-Cetuj70H.js → SvGridChartView-CbG_WrU-.js} +7 -7
  47. package/dist/wc/{SvGridDropdown-45WsObLL.js → SvGridDropdown-BVnpNU_I.js} +130 -130
  48. package/dist/wc/{SvModal-DrfOYYyX.js → SvModal-DLppAQED.js} +91 -91
  49. package/dist/wc/{client-DQIzjDBG.js → client-GWAV79ON.js} +479 -476
  50. package/dist/wc/{date-format-DS-z_h9v.js → date-format-4_QoS4zZ.js} +393 -393
  51. package/dist/wc/{grid-extension.svelte-Bufq4B4C.js → grid-extension.svelte-CucBS4FL.js} +1 -1
  52. package/dist/wc/sv-sheet-element.js +10475 -10461
  53. package/dist/wc/{svelte-virtualizer.svelte-CkZaFakp.js → svelte-virtualizer.svelte-BDcouWqw.js} +3 -3
  54. package/package.json +17 -4
  55. package/dist/designer/assets/index-BdL--HXH.css +0 -1
  56. package/dist/wc/GridFooter-4T29pfok.js +0 -145
  57. package/dist/wc/SvGridCellEditor-Nnl8C3Yj.js +0 -582
@@ -234,7 +234,7 @@ async function gatherFromDatabase(flags, prompts, db) {
234
234
  if (schemas.length === 0)
235
235
  throw new UserError('None of the picked tables could be read.');
236
236
  prompts.say(` Read ${schemas.length} ${schemas.length === 1 ? 'table' : 'tables'}.`);
237
- return { schemas, sources, seed: {}, kind: 'sql' };
237
+ return { schemas, sources, seed: {}, kind: 'sql', ...(isFileDialect(dialect) ? { sqliteFile: url } : {}) };
238
238
  }
239
239
  /**
240
240
  * Supabase reads over its own REST API, so this needs no driver and no
@@ -389,6 +389,27 @@ async function askTheme(flags, prompts) {
389
389
  }
390
390
  /** Prefix a path with the output folder (`.` writes into the current one). */
391
391
  const inDir = (outDir, path) => (!outDir || outDir === '.' ? '' : outDir.replace(/[\\/]+$/, '') + '/') + path;
392
+ /**
393
+ * A file path given relative to where init ran, re-expressed relative to the
394
+ * app folder, which is where the app runs (`npm run dev` in `outDir`). Absolute
395
+ * paths pass through. An absolute or `..` out dir has no relative answer without
396
+ * the cwd, so the path is made absolute when the runtime has one.
397
+ */
398
+ export function fileFromApp(file, outDir) {
399
+ // `file:./x.db` is relative like `./x.db`; `file:/x.db` and `file:///x.db` are not.
400
+ const fileUrl = /^file:(?![\\/])(.+)$/.exec(file);
401
+ if (fileUrl)
402
+ return `file:${fileFromApp(fileUrl[1], outDir)}`;
403
+ if (!outDir || outDir === '.' || file === ':memory:' || /^([a-zA-Z]:[\\/]|[\\/]|file:)/.test(file))
404
+ return file;
405
+ const rel = file.replace(/^\.[\\/]/, '');
406
+ const segments = outDir.split(/[\\/]+/).filter((s) => s && s !== '.');
407
+ if (/^([a-zA-Z]:[\\/]|[\\/])/.test(outDir) || segments.includes('..')) {
408
+ const cwd = globalThis.process?.cwd?.();
409
+ return cwd ? `${cwd.replace(/\\/g, '/').replace(/\/+$/, '')}/${rel.replace(/\\/g, '/')}` : file;
410
+ }
411
+ return '../'.repeat(segments.length) + rel;
412
+ }
392
413
  /** Which marker files are present in `outDir` right now. */
393
414
  async function markersIn(outDir, io) {
394
415
  const found = new Set();
@@ -477,7 +498,7 @@ export async function runStudioInit(flags, prompts, db, io, fetchText = null) {
477
498
  // On the model, not only on this emit: studio.config.json is written from the
478
499
  // same object below, so the designer reopens it as the same SvelteKit major.
479
500
  const project = flags.kit === 3 ? setKitVersion(built, 3) : built;
480
- const files = emitStudioAppBundle(project);
501
+ const files = emitStudioAppBundle(project, data.sqliteFile ? { databaseUrl: fileFromApp(data.sqliteFile, outDir) } : {});
481
502
  const written = await writeAll(files, outDir, io);
482
503
  // The design itself, so `svgrid-studio designer` reopens exactly this app.
483
504
  const configPath = inDir(outDir, 'studio.config.json');
@@ -9,11 +9,25 @@
9
9
  * better-sqlite3, the Supabase client, ...). Nothing here imports a driver, so
10
10
  * it's testable and adds no dependencies.
11
11
  */
12
- import type { EntityFieldType, EntitySchema } from '../schema.js';
12
+ import type { EntityField, EntityFieldType, EntitySchema } from '../schema.js';
13
13
  export type SqlDialectName = 'postgres' | 'supabase' | 'mysql' | 'mssql' | 'sqlite';
14
14
  export type DbExecute = (sql: string, params: unknown[]) => Promise<Array<Record<string, unknown>>>;
15
15
  /** Best-effort SQL type -> entity field type. The designer can refine edge cases. */
16
16
  export declare function mapSqlType(raw: string): EntityFieldType;
17
+ /**
18
+ * A Base table's insertion-order column, `BASE_ORDER_COLUMN` in
19
+ * fields/base-sql.ts (not imported: that module pulls in a .svelte registry,
20
+ * and this one runs in the Node bundle). `base-sql.dom.test.ts` keeps the two
21
+ * equal.
22
+ */
23
+ export declare const BASE_ORDER_COLUMN_NAME = "svgrid_order";
24
+ /**
25
+ * A Base table's order column stays in the schema (base-connect finds it there
26
+ * and reads in its order) but is never shown or written by a generated app.
27
+ */
28
+ export declare function hideBaseOrderColumn<F extends Pick<EntityField, 'required' | 'readonly' | 'hidden'> & {
29
+ field: unknown;
30
+ }>(field: F): F;
17
31
  export type IntrospectDbOptions = {
18
32
  dialect: SqlDialectName;
19
33
  table: string;
@@ -28,20 +28,42 @@ export function mapSqlType(raw) {
28
28
  return 'json';
29
29
  return 'text';
30
30
  }
31
- function fieldFrom(name, rawType, pk, notNull) {
31
+ /**
32
+ * A Base table's insertion-order column, `BASE_ORDER_COLUMN` in
33
+ * fields/base-sql.ts (not imported: that module pulls in a .svelte registry,
34
+ * and this one runs in the Node bundle). `base-sql.dom.test.ts` keeps the two
35
+ * equal.
36
+ */
37
+ export const BASE_ORDER_COLUMN_NAME = 'svgrid_order';
38
+ function fieldFrom(name, rawType, pk, notNull, generated = false) {
32
39
  const field = { field: name, type: mapSqlType(rawType) };
33
40
  if (pk) {
34
41
  field.primaryKey = true;
35
42
  field.readonly = true;
36
43
  }
44
+ else if (generated) {
45
+ // Identity and generated columns: the database fills them and rejects a
46
+ // written value, so a form must neither require nor send one.
47
+ field.readonly = true;
48
+ }
37
49
  else if (notNull) {
38
50
  field.required = true;
39
51
  }
40
52
  return field;
41
53
  }
42
- /** Map catalog rows (aliased name/type/nullable/pk) from information_schema dialects. */
54
+ /**
55
+ * A Base table's order column stays in the schema (base-connect finds it there
56
+ * and reads in its order) but is never shown or written by a generated app.
57
+ */
58
+ export function hideBaseOrderColumn(field) {
59
+ if (field.field !== BASE_ORDER_COLUMN_NAME)
60
+ return field;
61
+ const { required: _required, ...rest } = field;
62
+ return { ...rest, readonly: true, hidden: true };
63
+ }
64
+ /** Map catalog rows (aliased name/type/nullable/pk/generated) from information_schema dialects. */
43
65
  function infoSchemaFields(rows) {
44
- return rows.map((r) => fieldFrom(String(r.name), String(r.type ?? ''), truthy(r.pk), !truthy(r.nullable)));
66
+ return rows.map((r) => hideBaseOrderColumn(fieldFrom(String(r.name), String(r.type ?? ''), truthy(r.pk), !truthy(r.nullable), truthy(r.generated))));
45
67
  }
46
68
  /** Map SQLite `PRAGMA table_info` rows (name/type/notnull/pk-as-index). */
47
69
  function sqliteFields(rows) {
@@ -61,7 +83,8 @@ const POSTGRES = {
61
83
  columns: (table) => ({
62
84
  sql: `SELECT c.column_name AS name, c.data_type AS type,
63
85
  CASE WHEN c.is_nullable = 'YES' THEN 1 ELSE 0 END AS nullable,
64
- CASE WHEN pk.column_name IS NOT NULL THEN 1 ELSE 0 END AS pk
86
+ CASE WHEN pk.column_name IS NOT NULL THEN 1 ELSE 0 END AS pk,
87
+ CASE WHEN (c.is_identity = 'YES' AND c.identity_generation = 'ALWAYS') OR c.is_generated = 'ALWAYS' THEN 1 ELSE 0 END AS generated
65
88
  FROM information_schema.columns c
66
89
  LEFT JOIN (
67
90
  SELECT kcu.column_name
@@ -96,7 +119,8 @@ const MYSQL = {
96
119
  columns: (table) => ({
97
120
  sql: `SELECT COLUMN_NAME AS name, DATA_TYPE AS type,
98
121
  CASE WHEN IS_NULLABLE = 'YES' THEN 1 ELSE 0 END AS nullable,
99
- CASE WHEN COLUMN_KEY = 'PRI' THEN 1 ELSE 0 END AS pk
122
+ CASE WHEN COLUMN_KEY = 'PRI' THEN 1 ELSE 0 END AS pk,
123
+ CASE WHEN EXTRA LIKE '%GENERATED%' THEN 1 ELSE 0 END AS generated
100
124
  FROM information_schema.columns
101
125
  WHERE TABLE_NAME = ? AND TABLE_SCHEMA = DATABASE()
102
126
  ORDER BY ORDINAL_POSITION`,
@@ -49,5 +49,29 @@ export type SqlDataSourceConfig<TData extends RowData> = {
49
49
  * Names outside this list never reach SQL.
50
50
  */
51
51
  aggregators?: ReadonlyArray<string>;
52
+ /**
53
+ * How rows come back when the request has no sort, e.g. creation order:
54
+ * `[{ field: 'createdAt' }]`. Default: a field on a `created_at` or
55
+ * `inserted_at` column when the schema has one, else the primary key. The
56
+ * primary key is appended to every leaf order as a tie-breaker, so paging
57
+ * is deterministic.
58
+ */
59
+ defaultOrder?: ReadonlyArray<{
60
+ field: string;
61
+ desc?: boolean;
62
+ }>;
52
63
  };
64
+ /**
65
+ * The order rows come back in while nothing is sorted: `defaultOrder` when
66
+ * given (each field checked against the schema), else a field on a
67
+ * `created_at` / `inserted_at` column, else none. The SQL and Supabase
68
+ * sources then add the primary key as the tie-breaker.
69
+ */
70
+ export declare function unsortedOrder<TData extends RowData>(schema: EntitySchema<TData>, defaultOrder: ReadonlyArray<{
71
+ field: string;
72
+ desc?: boolean;
73
+ }> | undefined, columnOf?: (field: string) => string): Array<{
74
+ field: string;
75
+ desc: boolean;
76
+ }>;
53
77
  export declare function createSqlDataSource<TData extends RowData>(config: SqlDataSourceConfig<TData>): WritableDataSource<TData> & AggregateSource;
@@ -3,6 +3,26 @@ import { nudgeEnterpriseFor } from '../license.js';
3
3
  import { planQuery } from './query-plan.js';
4
4
  import { planToSql } from './sql.js';
5
5
  const SQL_AGG = { sum: 'SUM', avg: 'AVG', min: 'MIN', max: 'MAX' };
6
+ /** Columns that hold when a row was made, by the usual conventions (Supabase, Rails, Ecto). */
7
+ const CREATION_COLUMNS = new Set(['created_at', 'inserted_at']);
8
+ /**
9
+ * The order rows come back in while nothing is sorted: `defaultOrder` when
10
+ * given (each field checked against the schema), else a field on a
11
+ * `created_at` / `inserted_at` column, else none. The SQL and Supabase
12
+ * sources then add the primary key as the tie-breaker.
13
+ */
14
+ export function unsortedOrder(schema, defaultOrder, columnOf = (f) => f) {
15
+ const known = new Set(schema.fields.map((f) => String(f.field)));
16
+ if (defaultOrder) {
17
+ for (const o of defaultOrder) {
18
+ if (!known.has(o.field))
19
+ throw new Error(`defaultOrder field "${o.field}" is not in the schema`);
20
+ }
21
+ return defaultOrder.map((o) => ({ field: o.field, desc: !!o.desc }));
22
+ }
23
+ const creation = schema.fields.find((f) => CREATION_COLUMNS.has(columnOf(String(f.field)).toLowerCase()));
24
+ return creation ? [{ field: String(creation.field), desc: false }] : [];
25
+ }
6
26
  function quoter(dialect) {
7
27
  const q = dialect.quote ?? '"';
8
28
  return (name) => `${q}${name.replace(new RegExp(q, 'g'), q + q)}${q}`;
@@ -40,6 +60,19 @@ export function createSqlDataSource(config) {
40
60
  : '*';
41
61
  const planDialect = hasRenames ? { ...dialect, column: columnOf } : dialect;
42
62
  const RET = returning ? ` RETURNING ${projection}` : '';
63
+ // Without an ORDER BY, Postgres returns an updated row last and LIMIT /
64
+ // OFFSET pages in no fixed order. Unsorted rows go in creation order where
65
+ // that is known (a text key such as a UUID orders 1, 10, 2 and at random),
66
+ // and the key breaks ties under any order.
67
+ const key = schema.fields.some((f) => f.field === idField) ? idField : null;
68
+ const unsorted = unsortedOrder(schema, config.defaultOrder, columnOf);
69
+ const orderText = (sort) => {
70
+ const order = sort.length ? sort : unsorted;
71
+ const parts = order.map((o) => `${col(o.field)} ${o.desc ? 'DESC' : 'ASC'}`);
72
+ if (key && !order.some((o) => o.field === key))
73
+ parts.push(`${col(key)} ASC`);
74
+ return parts.length ? `ORDER BY ${parts.join(', ')}` : '';
75
+ };
43
76
  return {
44
77
  async getRows(request) {
45
78
  const plan = planQuery(schema, request, planOptions);
@@ -63,7 +96,7 @@ export function createSqlDataSource(config) {
63
96
  }
64
97
  const rowsSql = plan.groupBy
65
98
  ? squish(`SELECT ${select} FROM ${t} ${sql.whereText} ${sql.groupByText} ${sql.orderByText} LIMIT ${sql.limit} OFFSET ${sql.offset}`)
66
- : squish(`SELECT ${projection} FROM ${t} ${sql.whereText} ${sql.orderByText} LIMIT ${sql.limit} OFFSET ${sql.offset}`);
99
+ : squish(`SELECT ${projection} FROM ${t} ${sql.whereText} ${orderText(plan.orderBy)} LIMIT ${sql.limit} OFFSET ${sql.offset}`);
67
100
  const countSql = squish(`SELECT ${sql.countText} AS count FROM ${t} ${sql.whereText}`);
68
101
  const rows = await execute(rowsSql, sql.params);
69
102
  const countRows = await execute(countSql, sql.params);
@@ -14,6 +14,10 @@ export function planToSql(plan, dialect = {}) {
14
14
  throw new Error(`planToSql: "${fn}" is not an aggregate function name`);
15
15
  return fn.toUpperCase();
16
16
  };
17
+ // LIMIT and OFFSET are pasted in raw too, and come from the request body
18
+ // (`pageSize`, `startRow`), so only a non-negative integer gets through.
19
+ const limit = sqlCount(plan.limit, 'limit');
20
+ const offset = sqlCount(plan.offset, 'offset');
17
21
  /**
18
22
  * Render predicates + search into one WHERE body, binding into `into`.
19
23
  * Placeholder numbering follows that array, so a second call with a fresh
@@ -166,8 +170,8 @@ export function planToSql(plan, dialect = {}) {
166
170
  orderBy,
167
171
  orderByText: orderBy ? `ORDER BY ${orderBy}` : '',
168
172
  params,
169
- limit: plan.limit,
170
- offset: plan.offset,
173
+ limit,
174
+ offset,
171
175
  select,
172
176
  groupBy,
173
177
  groupByText: groupBy ? `GROUP BY ${groupBy}` : '',
@@ -179,6 +183,14 @@ export function planToSql(plan, dialect = {}) {
179
183
  pivotSelect,
180
184
  };
181
185
  }
186
+ /** A row count for LIMIT / OFFSET: a non-negative safe integer, or a digit string of one. */
187
+ function sqlCount(value, what) {
188
+ const n = typeof value === 'string' && /^\d+$/.test(value) ? Number(value) : value;
189
+ if (typeof n !== 'number' || !Number.isSafeInteger(n) || n < 0) {
190
+ throw new Error(`planToSql: ${what} must be a non-negative integer, got ${String(JSON.stringify(value)).slice(0, 40)}`);
191
+ }
192
+ return n;
193
+ }
182
194
  function predicateSql(pred, ctx) {
183
195
  const { id, bind, like } = ctx;
184
196
  const col = id(pred.field);
package/dist/version.d.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * `version.test.ts` asserts this matches `package.json`, so the two cannot drift.
12
12
  */
13
- export declare const SVGRID_VERSION = "3.1.16";
13
+ export declare const SVGRID_VERSION = "3.1.18";
14
14
  /**
15
15
  * The version of `@svgrid/grid`, which releases on its own line: enterprise is
16
16
  * on 3.1.x while the grid is on 3.0.x.
@@ -23,4 +23,4 @@ export declare const SVGRID_VERSION = "3.1.16";
23
23
  *
24
24
  * `version.test.ts` asserts this matches packages/grid/package.json.
25
25
  */
26
- export declare const GRID_VERSION = "3.0.17";
26
+ export declare const GRID_VERSION = "3.0.19";
package/dist/version.js CHANGED
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * `version.test.ts` asserts this matches `package.json`, so the two cannot drift.
12
12
  */
13
- export const SVGRID_VERSION = '3.1.16';
13
+ export const SVGRID_VERSION = '3.1.18';
14
14
  /**
15
15
  * The version of `@svgrid/grid`, which releases on its own line: enterprise is
16
16
  * on 3.1.x while the grid is on 3.0.x.
@@ -23,4 +23,4 @@ export const SVGRID_VERSION = '3.1.16';
23
23
  *
24
24
  * `version.test.ts` asserts this matches packages/grid/package.json.
25
25
  */
26
- export const GRID_VERSION = '3.0.17';
26
+ export const GRID_VERSION = '3.0.19';
@@ -0,0 +1,145 @@
1
+ import { D as e, G as t, H as n, I as r, L as i, M as a, O as o, P as s, R as c, S as l, U as u, Y as d, at as f, ct as p, dt as m, ft as h, ht as g, j as _, m as v, n as y, nt as b, ot as x, rt as S, tt as C } from "./client-GWAV79ON.js";
2
+ import { s as w } from "./SvGrid.helpers-tk7gWxcT.js";
3
+ import "./sv-sheet-element.js";
4
+ //#region ../grid/dist/GridFooter.svelte
5
+ var T = c("<span class=\"sv-grid-status-item\"><span class=\"sv-grid-status-label\"> </span> </span>"), E = c("<span class=\"sv-grid-status-item\"><span class=\"sv-grid-status-label\">Numeric</span> </span>"), D = c("<span class=\"sv-grid-status-item\"><span class=\"sv-grid-status-label\"> </span> </span>"), O = c("<span class=\"sv-grid-status-item\"><span class=\"sv-grid-status-label\"> </span> </span>"), k = c("<span class=\"sv-grid-status-item\"><span class=\"sv-grid-status-label\"> </span> </span>"), A = c("<span class=\"sv-grid-status-item\"><span class=\"sv-grid-status-label\"> </span> </span>"), j = c("<div class=\"sv-grid-status-bar\" role=\"status\" aria-live=\"polite\"></div>"), ee = c("<div class=\"sv-grid-dropdown\"><button type=\"button\" class=\"sv-grid-dropdown-trigger\" aria-haspopup=\"listbox\" aria-expanded=\"false\"><span class=\"sv-grid-dropdown-label\"> </span> <span class=\"sv-grid-dropdown-caret\" aria-hidden=\"true\"><!></span></button></div>"), te = c("<div role=\"navigation\" aria-label=\"Pagination\"><div class=\"sv-grid-pagination-pagesize\"><span> </span> <div class=\"sv-grid-pagination-pagesize-dd\"><!></div></div> <span class=\"sv-grid-pagination-range\"><strong> </strong> to <strong> </strong> of <strong> </strong></span> <div class=\"sv-grid-pagination-nav\"><button type=\"button\" class=\"sv-grid-pagination-btn\"><!></button> <button type=\"button\" class=\"sv-grid-pagination-btn\"><!></button> <span class=\"sv-grid-pagination-label\"> <strong> </strong> <strong> </strong></span> <button type=\"button\" class=\"sv-grid-pagination-btn\"><!></button> <button type=\"button\" class=\"sv-grid-pagination-btn\"><!></button></div></div>"), M = c("<!> <!>", 1);
6
+ function N(n, c) {
7
+ h(c, !0);
8
+ let N = y(c, "pager", 3, !0), P = y(c, "showStatus", 3, !0), ne = y(c, "top", 3, !1), F = x(null), I = x(!1);
9
+ async function re() {
10
+ if (!(t(F) || t(I))) {
11
+ f(I, !0);
12
+ try {
13
+ f(F, (await import("./SvGridDropdown-BVnpNU_I.js")).default, !0);
14
+ } finally {
15
+ f(I, !1);
16
+ }
17
+ }
18
+ }
19
+ let L = p(() => c.ctrl.paginationEnabled), R = p(() => c.ctrl.statusBarEnabled), z = p(() => c.ctrl.statusBarAggregates), B = p(() => c.ctrl.statusBarStats), V = p(() => c.ctrl.changePage), ie = p(() => c.ctrl.goToPage), ae = p(() => c.ctrl.setPageSize), H = p(() => c.ctrl.messages);
20
+ var U = M(), W = b(U), G = (e) => {
21
+ let n = p(() => t(B));
22
+ var a = j();
23
+ o(a, 20, () => t(z), (e) => e, (e, a) => {
24
+ var o = i(), c = b(o), l = (e) => {
25
+ var i = T(), a = C(i), o = C(a, !0);
26
+ g(a);
27
+ var c = S(a, 1, !0);
28
+ g(i), d((e) => {
29
+ s(o, t(H).statCount), s(c, e);
30
+ }, [() => w(t(n).count)]), r(e, i);
31
+ }, u = (e) => {
32
+ var i = E(), a = S(C(i), 1, !0);
33
+ g(i), d((e) => s(a, e), [() => w(t(n).numericCount)]), r(e, i);
34
+ }, f = (e) => {
35
+ var i = D(), a = C(i), o = C(a, !0);
36
+ g(a);
37
+ var c = S(a, 1, !0);
38
+ g(i), d((e) => {
39
+ s(o, t(H).statSum), s(c, e);
40
+ }, [() => w(t(n).sum)]), r(e, i);
41
+ }, p = (e) => {
42
+ var i = O(), a = C(i), o = C(a, !0);
43
+ g(a);
44
+ var c = S(a, 1, !0);
45
+ g(i), d((e) => {
46
+ s(o, t(H).statAvg), s(c, e);
47
+ }, [() => w(t(n).avg)]), r(e, i);
48
+ }, m = (e) => {
49
+ var i = k(), a = C(i), o = C(a, !0);
50
+ g(a);
51
+ var c = S(a, 1, !0);
52
+ g(i), d((e) => {
53
+ s(o, t(H).statMin), s(c, e);
54
+ }, [() => w(t(n).min)]), r(e, i);
55
+ }, h = (e) => {
56
+ var i = A(), a = C(i), o = C(a, !0);
57
+ g(a);
58
+ var c = S(a, 1, !0);
59
+ g(i), d((e) => {
60
+ s(o, t(H).statMax), s(c, e);
61
+ }, [() => w(t(n).max)]), r(e, i);
62
+ };
63
+ _(c, (e) => {
64
+ a === "count" ? e(l) : a === "numericCount" ? e(u, 1) : t(n).numericCount > 0 && a === "sum" ? e(f, 2) : t(n).numericCount > 0 && a === "avg" ? e(p, 3) : t(n).numericCount > 0 && a === "min" ? e(m, 4) : t(n).numericCount > 0 && a === "max" && e(h, 5);
65
+ }), r(e, o);
66
+ }), g(a), r(e, a);
67
+ };
68
+ _(W, (e) => {
69
+ P() && t(R) && t(B) && e(G);
70
+ });
71
+ var K = S(W, 2), q = (n) => {
72
+ let o = p(() => c.ctrl.paginationTotalRows), f = p(() => c.ctrl.paginationPageSize), m = p(() => Math.max(1, Math.ceil(t(o) / t(f)))), h = p(() => Math.min(c.ctrl.paginationPageIndex + 1, t(m))), y = p(() => t(o) === 0 ? 0 : (t(h) - 1) * t(f) + 1), x = p(() => Math.min(t(o), t(h) * t(f))), w = p(() => t(h) <= 1), T = p(() => t(h) >= t(m)), E = p(() => c.pageSizeOptions && c.pageSizeOptions.length ? c.pageSizeOptions : [
73
+ 10,
74
+ 25,
75
+ 50,
76
+ 100
77
+ ]);
78
+ var D = te();
79
+ let O;
80
+ var k = C(D), A = C(k), j = C(A, !0);
81
+ g(A);
82
+ var M = S(A, 2), N = C(M), P = (n) => {
83
+ var a = i(), o = b(a);
84
+ {
85
+ let n = p(() => t(E).map((e) => ({
86
+ value: e,
87
+ label: String(e)
88
+ })));
89
+ e(o, () => t(F), (e, r) => {
90
+ r(e, {
91
+ get options() {
92
+ return t(n);
93
+ },
94
+ get value() {
95
+ return t(f);
96
+ },
97
+ autoOpen: !0,
98
+ onChange: (e) => t(ae)(Number(e))
99
+ });
100
+ });
101
+ }
102
+ r(n, a);
103
+ }, I = (e) => {
104
+ var n = ee(), i = C(n), o = C(i), l = C(o, !0);
105
+ g(o);
106
+ var p = S(o, 2), m = C(p);
107
+ a(m, () => c.icon, () => "page-size-caret"), g(p), g(i), g(n), d(() => s(l, t(f))), u("click", i, re), r(e, n);
108
+ };
109
+ _(N, (e) => {
110
+ t(F) ? e(P) : e(I, -1);
111
+ }), g(M), g(k);
112
+ var L = S(k, 2), R = C(L), z = C(R, !0);
113
+ g(R);
114
+ var B = S(R, 2), U = C(B, !0);
115
+ g(B);
116
+ var W = S(B, 2), G = C(W, !0);
117
+ g(W), g(L);
118
+ var K = S(L, 2), q = C(K), oe = C(q);
119
+ a(oe, () => c.icon, () => "page-first"), g(q);
120
+ var J = S(q, 2), se = C(J);
121
+ a(se, () => c.icon, () => "page-prev"), g(J);
122
+ var Y = S(J, 2), X = C(Y), Z = S(X), ce = C(Z, !0);
123
+ g(Z);
124
+ var le = S(Z), ue = S(le), de = C(ue, !0);
125
+ g(ue), g(Y);
126
+ var Q = S(Y, 2), fe = C(Q);
127
+ a(fe, () => c.icon, () => "page-next"), g(Q);
128
+ var $ = S(Q, 2), pe = C($);
129
+ a(pe, () => c.icon, () => "page-last"), g($), g(K), g(D), d((e, n, r, i, a) => {
130
+ O = l(D, 1, "sv-grid-pagination", null, O, { "sv-grid-pagination-top": ne() }), s(j, t(H).pageSize), s(z, e), s(U, n), s(G, r), q.disabled = t(w), v(q, "aria-label", t(H).firstPage), J.disabled = t(w), v(J, "aria-label", t(H).prevPage), s(X, `${t(H).page ?? ""} `), s(ce, i), s(le, ` ${t(H).of ?? ""} `), s(de, a), Q.disabled = t(T), v(Q, "aria-label", t(H).nextPage), $.disabled = t(T), v($, "aria-label", t(H).lastPage);
131
+ }, [
132
+ () => t(y).toLocaleString(),
133
+ () => t(x).toLocaleString(),
134
+ () => t(o).toLocaleString(),
135
+ () => t(h).toLocaleString(),
136
+ () => t(m).toLocaleString()
137
+ ]), u("click", q, () => t(ie)(0)), u("click", J, () => t(V)(-1)), u("click", Q, () => t(V)(1)), u("click", $, () => t(ie)(t(m) - 1)), r(n, D);
138
+ };
139
+ _(K, (e) => {
140
+ N() && t(L) && e(q);
141
+ }), r(n, U), m();
142
+ }
143
+ n(["click"]);
144
+ //#endregion
145
+ export { N as default };