@svgrid/enterprise 3.1.10 → 3.1.12

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 (63) hide show
  1. package/LICENSE +17 -13
  2. package/dist/cdn/svgrid-enterprise.svelte-external.js +10 -1
  3. package/dist/designer/assets/{GridFooter-Cu8_yBlQ.js → GridFooter-CKBVItAU.js} +1 -1
  4. package/dist/designer/assets/{GridMenus-BUjkkAU2.js → GridMenus-xnVGSn7N.js} +3 -3
  5. package/dist/designer/assets/SvDateRangeInput-DbfmXqJj.js +1 -0
  6. package/dist/designer/assets/SvDateTimePicker-r4FqmR6R.js +1 -0
  7. package/dist/designer/assets/{SvGrid.helpers-CIrmIo9U.js → SvGrid.helpers-BF2QRcNt.js} +1 -1
  8. package/dist/designer/assets/SvGridCellEditor-od4VbndV.js +4 -0
  9. package/dist/designer/assets/{SvGridChart-Fg43Yi0M.js → SvGridChart-DYtGHM3F.js} +2 -2
  10. package/dist/designer/assets/{SvGridChartBuilder-BqGuA3yU.js → SvGridChartBuilder-BjdQrnz5.js} +1 -1
  11. package/dist/designer/assets/{SvGridChartPanel-BsiXRAnx.js → SvGridChartPanel-Cm9_K7BV.js} +3 -3
  12. package/dist/designer/assets/{SvGridChartView-BgttK0tR.js → SvGridChartView-Bfs0bvDb.js} +1 -1
  13. package/dist/designer/assets/{cell-formatting-BWrW_O0n.js → cell-formatting-JoxA0t65.js} +1 -1
  14. package/dist/designer/assets/{chart-BIl-dIRv.js → chart-Bmu-KAet.js} +1 -1
  15. package/dist/designer/assets/{chart-panel-messages-4cF2vw7L.js → chart-panel-messages-B3y8y3kL.js} +1 -1
  16. package/dist/designer/assets/{chart-summary-B7bTtSCC.js → chart-summary-DxE0R2Bk.js} +1 -1
  17. package/dist/designer/assets/{chart-trend-CLsn5Hgd.js → chart-trend-_gDVw3bP.js} +1 -1
  18. package/dist/designer/assets/{export-format-DGscOjS9.js → export-format-BCuqcexA.js} +1 -1
  19. package/dist/designer/assets/index-B2WZFQ5M.css +1 -0
  20. package/dist/designer/assets/{index-CJodU3tU.js → index-DUaUUFEm.js} +317 -317
  21. package/dist/designer/assets/{src-C_U1NKOY.js → src-hO8VnnI5.js} +1 -1
  22. package/dist/designer/index.html +13 -13
  23. package/dist/fields/BaseTableView.svelte +43 -1
  24. package/dist/fields/LongTextEditor.svelte +6 -1
  25. package/dist/fields/RecordView.svelte +36 -9
  26. package/dist/fields/RowHeader.svelte +22 -3
  27. package/dist/fields/SelectEditor.svelte +8 -1
  28. package/dist/fields/SvBase.svelte +42 -2
  29. package/dist/fields/SvBase.svelte.d.ts +3 -0
  30. package/dist/fields/SvBaseViewBar.svelte +10 -0
  31. package/dist/fields/SvBaseViewBar.svelte.d.ts +5 -0
  32. package/dist/fields/activity.svelte.d.ts +42 -0
  33. package/dist/fields/activity.svelte.js +57 -0
  34. package/dist/fields/base-schema.d.ts +1 -1
  35. package/dist/fields/base-schema.js +7 -0
  36. package/dist/fields/base-sync.d.ts +21 -0
  37. package/dist/fields/base-sync.js +9 -7
  38. package/dist/fields/index.d.ts +1 -1
  39. package/dist/fields/index.js +9 -2
  40. package/dist/node/studio.js +11 -2
  41. package/dist/studio/ui-components.generated.js +9 -0
  42. package/dist/version.d.ts +2 -2
  43. package/dist/version.js +2 -2
  44. package/dist/wc/{GridFooter-f5K0aLe_.js → GridFooter-4T29pfok.js} +1 -1
  45. package/dist/wc/{GridMenus-FtSN_8t9.js → GridMenus-jRuxbYD8.js} +2 -2
  46. package/dist/wc/{SvDateRangeInput-DR6m7bSM.js → SvDateRangeInput-BYNOfYxD.js} +68 -65
  47. package/dist/wc/{SvDateTimePicker-D-vRnaMo.js → SvDateTimePicker-Bq9N0Oiy.js} +57 -53
  48. package/dist/wc/{SvGrid.helpers-B2GEKrxS.js → SvGrid.helpers-tk7gWxcT.js} +1 -1
  49. package/dist/wc/{SvGridCellEditor-B_cLJrsp.js → SvGridCellEditor-Nnl8C3Yj.js} +159 -148
  50. package/dist/wc/{SvGridChart-C6UvNIbN.js → SvGridChart-DrmqEen2.js} +3 -3
  51. package/dist/wc/{SvGridChartBuilder-ikf_5LyW.js → SvGridChartBuilder-XFvW1BdT.js} +3 -3
  52. package/dist/wc/{SvGridChartPanel-Dc_jj7B-.js → SvGridChartPanel-oJJtUKG6.js} +4 -4
  53. package/dist/wc/{SvGridChartView-thkznAOb.js → SvGridChartView-Cetuj70H.js} +2 -2
  54. package/dist/wc/{cell-formatting-hb3vzxhJ.js → cell-formatting-5uEa4Y_0.js} +1 -0
  55. package/dist/wc/{chart-CV5D7_k8.js → chart-CznMeoM7.js} +1 -1
  56. package/dist/wc/{chart-summary-DGx0QhJa.js → chart-summary-COWSPw1p.js} +1 -1
  57. package/dist/wc/{chart-trend-BIRH_xH8.js → chart-trend-Dcn6jrAS.js} +1 -1
  58. package/dist/wc/sv-sheet-element.js +4616 -4589
  59. package/package.json +3 -3
  60. package/dist/designer/assets/SvDateRangeInput-BBRzrQeg.js +0 -1
  61. package/dist/designer/assets/SvDateTimePicker-DCPg7WGN.js +0 -1
  62. package/dist/designer/assets/SvGridCellEditor-CJxThKL_.js +0 -4
  63. package/dist/designer/assets/index-BmvG99kR.css +0 -1
@@ -6,6 +6,9 @@ const title = (s) => s.replace(/[_-]+/g, ' ').replace(/([a-z])([A-Z])/g, '$1 $2'
6
6
  const linkName = (column) => column.replace(/_?id$/i, '') || column;
7
7
  const MONEY = /(^|_)(price|amount|cost|budget|revenue|salary|total|fee|value|spend|mrr|arr)($|_)/i;
8
8
  const LONG = /(^|_)(notes?|description|body|comment|comments|summary|details|bio|content|message)($|_)/i;
9
+ // Who changed or added a row, as the app (or an agent) writes it: a user id the base names from its people list.
10
+ const MODIFIED_BY = /^(updated|modified|last_modified|edited)_?by$/i;
11
+ const CREATED_BY = /^created_?by$/i;
9
12
  function fieldOf(f) {
10
13
  const header = f.label ?? title(f.field);
11
14
  const base = { id: f.field, field: f.field, header };
@@ -35,6 +38,10 @@ function fieldOf(f) {
35
38
  return { ...base, fieldType: 'url' };
36
39
  if (editor === 'phone')
37
40
  return { ...base, fieldType: 'phone' };
41
+ if (MODIFIED_BY.test(f.field))
42
+ return { ...base, fieldType: 'lastModifiedBy' };
43
+ if (CREATED_BY.test(f.field))
44
+ return { ...base, fieldType: 'createdBy' };
38
45
  if (LONG.test(f.field))
39
46
  return { ...base, fieldType: 'longText' };
40
47
  return { ...base, fieldType: 'text' };
@@ -119,6 +119,25 @@ export type BaseSyncStatus = {
119
119
  table: string;
120
120
  limit: number;
121
121
  };
122
+ /**
123
+ * A change made in the database by someone else (another user, another tab,
124
+ * a script, an AI agent), as the base found it when it read the table again.
125
+ */
126
+ export type BaseRemoteChange = {
127
+ /** The base table's id. */
128
+ table: string;
129
+ type: 'insert' | 'update' | 'delete';
130
+ /** The record's page id. */
131
+ id: string;
132
+ /** The record as it is now; for a delete, as it was. */
133
+ record: Row;
134
+ /** For an update: each stored field that moved, from what to what. */
135
+ fields?: Array<{
136
+ field: string;
137
+ from: unknown;
138
+ to: unknown;
139
+ }>;
140
+ };
122
141
  export type BaseSyncOptions = {
123
142
  getTables: () => BaseTable[] | undefined;
124
143
  /** Put tables in the page without writing them (loaded, undone, changed elsewhere). */
@@ -129,6 +148,8 @@ export type BaseSyncOptions = {
129
148
  action: 'insert' | 'update' | 'delete' | 'load';
130
149
  message: string;
131
150
  }) => void;
151
+ /** Changes made elsewhere, after they are in the page. Never called for the page's own writes. */
152
+ onRemoteChange?: (changes: BaseRemoteChange[]) => void;
132
153
  };
133
154
  export declare function createBaseSync(options: BaseSyncOptions): {
134
155
  load: () => Promise<void>;
@@ -441,7 +441,7 @@ export function createBaseSync(options) {
441
441
  return;
442
442
  const fields = storedFields(list, t);
443
443
  const fresh = new Map(rows.map((r) => [String(r.id), r]));
444
- let changed = false;
444
+ const changes = [];
445
445
  const data = [];
446
446
  for (const r of t.data) {
447
447
  if (!r)
@@ -453,33 +453,35 @@ export function createBaseSync(options) {
453
453
  data.push(r);
454
454
  else {
455
455
  before.delete(id);
456
- changed = true;
456
+ changes.push({ table: tableId, type: 'delete', id, record: r });
457
457
  }
458
458
  continue;
459
459
  }
460
460
  fresh.delete(id);
461
- const moved = fields.filter((f) => f in server && !same(server[f], before.get(id)?.[f]));
461
+ const was = before.get(id);
462
+ const moved = fields.filter((f) => f in server && !same(server[f], was?.[f]));
462
463
  if (moved.length) {
463
- changed = true;
464
464
  const next = { ...r };
465
465
  for (const f of moved)
466
466
  next[f] = server[f];
467
- before.set(id, { ...before.get(id), ...pick(server, moved) });
467
+ changes.push({ table: tableId, type: 'update', id, record: next, fields: moved.map((f) => ({ field: f, from: was?.[f], to: server[f] })) });
468
+ before.set(id, { ...was, ...pick(server, moved) });
468
469
  data.push(next);
469
470
  }
470
471
  else
471
472
  data.push(r);
472
473
  }
473
474
  for (const [id, r] of fresh) {
474
- changed = true;
475
475
  before.set(id, pick(r, fields));
476
+ changes.push({ table: tableId, type: 'insert', id, record: r });
476
477
  data.push(r);
477
478
  }
478
- if (!changed)
479
+ if (!changes.length)
479
480
  return;
480
481
  let next = list.map((x) => (x.id === tableId ? { ...x, data } : x));
481
482
  next = linkBack(next, tableId);
482
483
  options.apply(next);
484
+ options.onRemoteChange?.(changes);
483
485
  }
484
486
  return {
485
487
  load,
@@ -10,7 +10,7 @@ export { default as SvBaseViewBar } from './SvBaseViewBar.svelte';
10
10
  export { default as SvBaseForm } from './SvBaseForm.svelte';
11
11
  export { default as SvBase } from './SvBase.svelte';
12
12
  export { blankTable, newRecordId, type BaseTable } from './base-tables.js';
13
- export { baseSource, createBaseSync, type BaseSource, type BaseSourceOptions, type BaseSyncStatus, type ForeignKeyLink, type JunctionLink, } from './base-sync.js';
13
+ export { baseSource, createBaseSync, type BaseSource, type BaseSourceOptions, type BaseSyncStatus, type BaseRemoteChange, type ForeignKeyLink, type JunctionLink, } from './base-sync.js';
14
14
  export { baseFieldsFromSchema, baseTablesFromSchemas, baseSpecFromSchemas, baseTablesFromSpec, type BaseTableSpec, type BaseLinkSpec } from './base-schema.js';
15
15
  export { baseToSql, sqlName, type BaseToSqlOptions, type BaseTableComment, type BaseJunctionComment } from './base-sql.js';
16
16
  export { applyBaseComments, withInverses, type BaseComments } from './base-schema.js';
@@ -162,6 +162,13 @@ function stampModified(ctrl, row, columnId) {
162
162
  if (!row)
163
163
  return;
164
164
  const author = getCurrentUser()?.id;
165
+ // Into the edit overlay too, as an edit goes: what reads through it (an
166
+ // open record) shows the stamp at once, not after the grid draws again.
167
+ const rowId = ctrl.buildApi?.().getRowId?.(row);
168
+ const overlay = (id, value) => {
169
+ if (rowId != null && ctrl.editedCellValues)
170
+ ctrl.editedCellValues = { ...ctrl.editedCellValues, [`${rowId}:${id}`]: value };
171
+ };
165
172
  for (const c of (ctrl?.internalColumns ?? [])) {
166
173
  if (c.fieldType !== 'lastModifiedTime' && c.fieldType !== 'lastModifiedBy')
167
174
  continue;
@@ -172,9 +179,9 @@ function stampModified(ctrl, row, columnId) {
172
179
  if (p.watch === 'specific' && !(p.watchFields ?? []).includes(columnId))
173
180
  continue;
174
181
  if (c.fieldType === 'lastModifiedTime')
175
- row[c.field] = new Date().toISOString();
182
+ overlay(id, (row[c.field] = new Date().toISOString()));
176
183
  else if (author !== undefined)
177
- row[c.field] = author;
184
+ overlay(id, (row[c.field] = author));
178
185
  }
179
186
  }
180
187
  /** The record's activity: what a cell now holds after an edit. */
@@ -6904,6 +6904,14 @@ var GENERATED_UI_SURFACE = {
6904
6904
  "label": "Aria Label",
6905
6905
  "type": "string",
6906
6906
  "group": "advanced"
6907
+ },
6908
+ {
6909
+ "key": "focusable",
6910
+ "label": "Focusable",
6911
+ "type": "boolean",
6912
+ "default": true,
6913
+ "description": "False: the button never takes focus or a Tab stop, so pressing it keeps focus in the field it steps (a spinner beside an input). Default true.",
6914
+ "group": "common"
6907
6915
  }
6908
6916
  ],
6909
6917
  "events": [{
@@ -8585,6 +8593,7 @@ var GENERATED_UI_SURFACE = {
8585
8593
  "key": "block",
8586
8594
  "label": "Block",
8587
8595
  "type": "boolean",
8596
+ "default": false,
8588
8597
  "description": "Fill the container instead of the control's own default width. A default width is right for a control sitting on its own; in a form grid a row of inputs each stopping at a different width reads as broken.",
8589
8598
  "group": "appearance"
8590
8599
  },
@@ -16446,7 +16455,7 @@ function hasFieldConditions(schema) {
16446
16455
  *
16447
16456
  * `version.test.ts` asserts this matches `package.json`, so the two cannot drift.
16448
16457
  */
16449
- var SVGRID_VERSION = "3.1.10";
16458
+ var SVGRID_VERSION = "3.1.12";
16450
16459
  /**
16451
16460
  * The version of `@svgrid/grid`, which releases on its own line: enterprise is
16452
16461
  * on 3.1.x while the grid is on 3.0.x.
@@ -16459,7 +16468,7 @@ var SVGRID_VERSION = "3.1.10";
16459
16468
  *
16460
16469
  * `version.test.ts` asserts this matches packages/grid/package.json.
16461
16470
  */
16462
- var GRID_VERSION = "3.0.13";
16471
+ var GRID_VERSION = "3.0.15";
16463
16472
  //#endregion
16464
16473
  //#region src/studio/emit-project.ts
16465
16474
  var has = (blocks, kind) => blocks.some((b) => b.config.kind === kind);
@@ -4729,6 +4729,14 @@ export const GENERATED_UI_SURFACE = {
4729
4729
  "label": "Aria Label",
4730
4730
  "type": "string",
4731
4731
  "group": "advanced"
4732
+ },
4733
+ {
4734
+ "key": "focusable",
4735
+ "label": "Focusable",
4736
+ "type": "boolean",
4737
+ "default": true,
4738
+ "description": "False: the button never takes focus or a Tab stop, so pressing it keeps focus in the field it steps (a spinner beside an input). Default true.",
4739
+ "group": "common"
4732
4740
  }
4733
4741
  ],
4734
4742
  "events": [
@@ -6449,6 +6457,7 @@ export const GENERATED_UI_SURFACE = {
6449
6457
  "key": "block",
6450
6458
  "label": "Block",
6451
6459
  "type": "boolean",
6460
+ "default": false,
6452
6461
  "description": "Fill the container instead of the control's own default width. A default width is right for a control sitting on its own; in a form grid a row of inputs each stopping at a different width reads as broken.",
6453
6462
  "group": "appearance"
6454
6463
  },
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.10";
13
+ export declare const SVGRID_VERSION = "3.1.12";
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.10";
23
23
  *
24
24
  * `version.test.ts` asserts this matches packages/grid/package.json.
25
25
  */
26
- export declare const GRID_VERSION = "3.0.13";
26
+ export declare const GRID_VERSION = "3.0.15";
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.10';
13
+ export const SVGRID_VERSION = '3.1.12';
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.10';
23
23
  *
24
24
  * `version.test.ts` asserts this matches packages/grid/package.json.
25
25
  */
26
- export const GRID_VERSION = '3.0.13';
26
+ export const GRID_VERSION = '3.0.15';
@@ -1,5 +1,5 @@
1
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, dt as p, et as m, it as h, j as g, m as _, mt as v, n as y, nt as b, st as x, tt as S, ut as C } from "./client-DQIzjDBG.js";
2
- import { s as w } from "./SvGrid.helpers-B2GEKrxS.js";
2
+ import { s as w } from "./SvGrid.helpers-tk7gWxcT.js";
3
3
  import "./sv-sheet-element.js";
4
4
  //#region ../grid/dist/GridFooter.svelte
5
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);
@@ -1,5 +1,5 @@
1
1
  import { $ as e, D as t, G as n, H as r, I as i, L as a, M as o, O as s, P as c, Q as l, R as u, S as d, T as f, U as p, W as m, X as h, Y as g, Z as _, _ as v, a as y, at as b, b as x, d as S, dt as C, et as w, f as T, h as E, ht as D, it as O, j as k, k as A, l as ee, m as j, mt as M, n as N, nt as P, o as te, p as F, pt as I, q as ne, st as L, tt as R, u as z, ut as re, w as ie, x as B, y as V, z as ae } from "./client-DQIzjDBG.js";
2
- import { S as oe, h as se, r as ce, u as le, w as ue } from "./SvGrid.helpers-B2GEKrxS.js";
2
+ import { S as oe, h as se, r as ce, u as le, w as ue } from "./SvGrid.helpers-tk7gWxcT.js";
3
3
  import { c as H, s as de, t as fe } from "./svelte-virtualizer.svelte-ehwOupl-.js";
4
4
  import { n as U } from "./grid-extension.svelte-Bufq4B4C.js";
5
5
  import { i as pe, t as W } from "./editor-contract-peBDxir_.js";
@@ -954,7 +954,7 @@ function Tt(r, u) {
954
954
  let e = n(J) ?? n(q);
955
955
  if (!e) return;
956
956
  let t = n(Te).find((t) => t.id === e);
957
- ue(t?.columnDef) && (n(zt) || import("./SvDateTimePicker-D-vRnaMo.js").then((e) => O(zt, e.default, !0)), n(Bt) || import("./SvDateRangeInput-DR6m7bSM.js").then((e) => O(Bt, e.default, !0)));
957
+ ue(t?.columnDef) && (n(zt) || import("./SvDateTimePicker-Bq9N0Oiy.js").then((e) => O(zt, e.default, !0)), n(Bt) || import("./SvDateRangeInput-BYNOfYxD.js").then((e) => O(Bt, e.default, !0)));
958
958
  });
959
959
  function Vt(e, t) {
960
960
  let n = () => {
@@ -1,30 +1,30 @@
1
- import { G as e, H as t, I as n, R as r, S as i, T as a, U as o, X as s, Y as c, _ as l, a as u, at as d, dt as f, et as p, f as m, it as h, j as g, m as _, mt as v, n as y, nt as b, p as x, rt as S, st as C, tt as ee, ut as w, w as T, x as E } from "./client-DQIzjDBG.js";
2
- import { a as D, i as O, t as te } from "./editor-contract-peBDxir_.js";
3
- import { i as k, o as A, r as ne, t as re } from "./date-format-DS-z_h9v.js";
4
- import { n as ie, r as ae, t as oe } from "./popover-WsGlvtQv.js";
5
- import { t as se } from "./SvField-B_kurx_P.js";
1
+ import { G as e, H as t, I as n, R as r, S as i, T as a, U as o, X as s, Y as c, _ as l, a as u, at as d, dt as f, et as p, f as ee, it as m, j as h, m as g, mt as _, n as v, nt as y, p as b, rt as x, st as S, tt as te, ut as C, w, x as T } from "./client-DQIzjDBG.js";
2
+ import { a as E, i as D, t as ne } from "./editor-contract-peBDxir_.js";
3
+ import { i as O, o as k, r as re, t as ie } from "./date-format-DS-z_h9v.js";
4
+ import { n as ae, r as oe, t as se } from "./popover-WsGlvtQv.js";
5
+ import { t as ce } from "./SvField-B_kurx_P.js";
6
6
  //#region ../grid/dist/SvDateRangeInput.svelte
7
- var ce = r("<button type=\"button\" class=\"sv-dri__clear svelte-1rb3yee\">&times;</button>"), le = r("<div class=\"sv-dri__panel\" role=\"dialog\"><!></div>"), ue = r("<input type=\"hidden\"/> <input type=\"hidden\"/>", 1), de = r("<div><div><svg class=\"sv-dri__icon svelte-1rb3yee\" viewBox=\"0 0 24 24\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\"></rect><path d=\"M16 2v4M8 2v4M3 10h18\"></path></svg> <input/> <!></div> <!> <!></div>"), fe = {
7
+ var le = r("<button type=\"button\" class=\"sv-dri__clear svelte-1rb3yee\">&times;</button>"), ue = r("<div class=\"sv-dri__panel\" role=\"dialog\"><!></div>"), de = r("<input type=\"hidden\"/> <input type=\"hidden\"/>", 1), fe = r("<div><div><svg class=\"sv-dri__icon svelte-1rb3yee\" viewBox=\"0 0 24 24\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\"></rect><path d=\"M16 2v4M8 2v4M3 10h18\"></path></svg> <input/> <!></div> <!> <!></div>"), pe = {
8
8
  hash: "svelte-1rb3yee",
9
9
  code: ".sv-dri.svelte-1rb3yee {--_accent: var(--sg-accent, #2563eb);--_border: var(--sg-input-border, var(--sg-border, #cbd5e1));--_radius: var(--sg-radius, 8px);display:inline-block;position:relative;color:var(--sg-fg, #0f172a);}.sv-dri--disabled.svelte-1rb3yee {opacity:0.6;}.sv-dri__field.svelte-1rb3yee {display:flex;align-items:center;gap:6px;width:260px;background:var(--sg-input-bg, #fff);border:1px solid var(--_border);border-radius:var(--_radius);padding-inline:10px 4px;}.sv-dri__field.svelte-1rb3yee:focus-within {border-color:var(--_accent);box-shadow:0 0 0 2px color-mix(in srgb, var(--_accent) 22%, transparent);}.sv-dri__field.is-invalid.svelte-1rb3yee {border-color:var(--sg-danger, #dc2626);}.sv-dri__field.is-invalid.svelte-1rb3yee:focus-within {box-shadow:0 0 0 2px color-mix(in srgb, var(--sg-danger, #dc2626) 22%, transparent);}.sv-dri__field--sm.svelte-1rb3yee {height:28px;font-size:12px;}.sv-dri__field--md.svelte-1rb3yee {height:34px;font-size:13px;}.sv-dri__field--lg.svelte-1rb3yee {height:40px;font-size:15px;}.sv-dri__icon.svelte-1rb3yee {color:var(--sg-muted, #64748b);flex:none;}.sv-dri__input.svelte-1rb3yee {flex:1;min-width:0;border:0;background:none;outline:none;color:inherit;font:inherit;cursor:pointer;text-overflow:ellipsis;}.sv-dri__input.svelte-1rb3yee::placeholder {color:var(--sg-muted, #94a3b8);}.sv-dri__clear.svelte-1rb3yee {display:grid;place-items:center;width:24px;height:24px;flex:none;background:none;border:0;color:var(--sg-muted, #64748b);cursor:pointer;border-radius:6px;font-size:17px;line-height:1;}.sv-dri__clear.svelte-1rb3yee:hover {color:var(--_accent);background:color-mix(in srgb, var(--_accent) 10%, transparent);}.sv-dri__panel {z-index:2147483647;background:var(--sg-bg, #fff);border:1px solid var(--sg-border, #e2e8f0);border-radius:12px;box-shadow:0 16px 48px -12px rgba(15, 23, 42, 0.35);}\n /* Fill the container - see `block` in SvEditorProps. */.sv-dri.is-block.svelte-1rb3yee, .sv-dri.is-block.svelte-1rb3yee .sv-dri__field:where(.svelte-1rb3yee) {width:100%;max-width:100%;}"
10
10
  };
11
- function j(t, r) {
12
- f(r, !0), a(t, fe);
13
- let j = {
11
+ function A(t, r) {
12
+ f(r, !0), a(t, pe);
13
+ let A = {
14
14
  dialog: "Choose a date range",
15
15
  clear: "Clear",
16
16
  open: "Open calendar",
17
17
  to: "to"
18
- }, M = y(r, "value", 3, null), pe = y(r, "formatString", 3, "yyyy-MM-dd"), me = y(r, "min", 3, null), he = y(r, "max", 3, null), ge = y(r, "months", 3, 2), N = y(r, "firstDayOfWeek", 3, 0), P = y(r, "weekNumbers", 3, !1), F = y(r, "locale", 19, () => typeof navigator < "u" ? navigator.language : "en-US"), I = y(r, "placeholder", 3, "Select date range"), L = y(r, "animate", 3, !1), _e = y(r, "autoOpen", 3, !1), R = y(r, "disabled", 3, !1), ve = y(r, "readonly", 3, !1), ye = y(r, "size", 3, "md"), z = y(r, "invalid", 3, !1), be = y(r, "block", 3, !1), B = y(r, "required", 3, !1), xe = O("sv-daterange"), V = C(() => r.id ?? xe), H = C(() => D(j, r.messages)), U = C(() => r.dir === "ltr" || r.dir === "rtl" ? r.dir : void 0), W = C(() => !R() && !ve()), G = (e) => re(e, pe(), F()), Se = C(() => {
19
- if (!M()) return "";
20
- let [t, n] = M();
18
+ }, j = v(r, "value", 3, null), me = v(r, "formatString", 3, "yyyy-MM-dd"), he = v(r, "min", 3, null), ge = v(r, "max", 3, null), _e = v(r, "months", 3, 2), M = v(r, "firstDayOfWeek", 3, 0), N = v(r, "weekNumbers", 3, !1), P = v(r, "locale", 19, () => typeof navigator < "u" ? navigator.language : "en-US"), F = v(r, "placeholder", 3, "Select date range"), I = v(r, "animate", 3, !1), ve = v(r, "autoOpen", 3, !1), L = v(r, "disabled", 3, !1), ye = v(r, "readonly", 3, !1), be = v(r, "size", 3, "md"), R = v(r, "invalid", 3, !1), z = v(r, "block", 3, !1), B = v(r, "required", 3, !1), xe = D("sv-daterange"), V = S(() => r.id ?? xe), H = S(() => E(A, r.messages)), U = S(() => r.dir === "ltr" || r.dir === "rtl" ? r.dir : void 0), W = S(() => !L() && !ye()), G = (e) => ie(e, me(), P()), Se = S(() => {
19
+ if (!j()) return "";
20
+ let [t, n] = j();
21
21
  return t && n ? `${G(t)} ${e(H).to} ${G(n)}` : t ? G(t) : "";
22
- }), Ce = C(() => M() ? k(M()[0], M()[1]) : null), K = d(!1);
22
+ }), Ce = S(() => j() ? O(j()[0], j()[1]) : null), K = d(!1);
23
23
  function q() {
24
- e(W) && !e(K) && h(K, !0);
24
+ e(W) && !e(K) && m(K, !0);
25
25
  }
26
26
  function J() {
27
- h(K, !1);
27
+ m(K, !1);
28
28
  }
29
29
  function we() {
30
30
  e(K) ? J() : q();
@@ -35,9 +35,9 @@ function j(t, r) {
35
35
  function Ee(e) {
36
36
  if (!e.length) return;
37
37
  let t = e[0], n = e[e.length - 1];
38
- r.onChange?.([A(t), A(n)]), e.length >= 1 && t !== n && J();
38
+ r.onChange?.([k(t), k(n)]), e.length >= 1 && t !== n && J();
39
39
  }
40
- let Y = d(null), X = d(null), Z = d(null), Q = d(S({
40
+ let Y = d(null), X = d(null), Z = d(null), Q = d(x({
41
41
  top: 0,
42
42
  left: 0,
43
43
  width: 0,
@@ -46,7 +46,7 @@ function j(t, r) {
46
46
  availHeight: 0
47
47
  }));
48
48
  function $() {
49
- e(Y) && h(Q, oe(e(Y).getBoundingClientRect(), {
49
+ e(Y) && m(Q, se(e(Y).getBoundingClientRect(), {
50
50
  estimatedHeight: 360,
51
51
  minWidth: 300
52
52
  }), !0);
@@ -65,12 +65,12 @@ function j(t, r) {
65
65
  };
66
66
  });
67
67
  function De(e) {
68
- e.key === "Escape" ? J() : e.key === "ArrowDown" && (e.altKey || !M()) && (e.preventDefault(), q());
68
+ e.key === "Escape" ? J() : e.key === "ArrowDown" && (e.altKey || !j()) && (e.preventDefault(), q());
69
69
  }
70
70
  function Oe(e) {
71
- _e() && (e.focus(), q());
71
+ ve() && (e.focus(), q());
72
72
  }
73
- se(t, {
73
+ ce(t, {
74
74
  get id() {
75
75
  return e(V);
76
76
  },
@@ -89,111 +89,114 @@ function j(t, r) {
89
89
  get dir() {
90
90
  return r.dir;
91
91
  },
92
+ get block() {
93
+ return z();
94
+ },
92
95
  children: (t, a) => {
93
- var s = de();
96
+ var s = fe();
94
97
  let d;
95
98
  var f = p(s);
96
- let y;
97
- var S = b(p(f), 2);
98
- m(S, (t) => ({
99
+ let v;
100
+ var x = y(p(f), 2);
101
+ ee(x, (t) => ({
99
102
  id: e(V),
100
103
  class: "sv-dri__input",
101
104
  type: "text",
102
105
  readonly: !0,
103
- placeholder: I(),
106
+ placeholder: F(),
104
107
  value: e(Se),
105
- disabled: R(),
108
+ disabled: L(),
106
109
  ...t,
107
110
  "aria-haspopup": "dialog",
108
111
  "aria-expanded": e(K),
109
112
  onkeydown: De
110
- }), [() => te({
113
+ }), [() => ne({
111
114
  id: e(V),
112
- invalid: z(),
115
+ invalid: R(),
113
116
  required: B(),
114
117
  error: r.error,
115
118
  hint: r.hint,
116
119
  ariaLabel: r.ariaLabel
117
- })], void 0, void 0, "svelte-1rb3yee", !0), u(S, (e) => h(X, e), () => e(X)), T(S, (e) => Oe?.(e));
118
- var C = b(S, 2), w = (t) => {
119
- var r = ce();
120
- c(() => _(r, "aria-label", e(H).clear)), o("click", r, (e) => {
120
+ })], void 0, void 0, "svelte-1rb3yee", !0), u(x, (e) => m(X, e), () => e(X)), w(x, (e) => Oe?.(e));
121
+ var S = y(x, 2), C = (t) => {
122
+ var r = le();
123
+ c(() => g(r, "aria-label", e(H).clear)), o("click", r, (e) => {
121
124
  e.stopPropagation(), Te();
122
125
  }), n(t, r);
123
126
  };
124
- g(C, (t) => {
125
- M() && e(W) && t(w);
126
- }), v(f), u(f, (e) => h(Y, e), () => e(Y));
127
- var D = b(f, 2), O = (t) => {
128
- var i = le();
127
+ h(S, (t) => {
128
+ j() && e(W) && t(C);
129
+ }), _(f), u(f, (e) => m(Y, e), () => e(Y));
130
+ var E = y(f, 2), D = (t) => {
131
+ var i = ue();
129
132
  let a;
130
133
  var o = p(i);
131
- ne(o, {
134
+ re(o, {
132
135
  get value() {
133
136
  return e(Ce);
134
137
  },
135
138
  selectionMode: "range",
136
139
  get min() {
137
- return me();
140
+ return he();
138
141
  },
139
142
  get max() {
140
- return he();
143
+ return ge();
141
144
  },
142
145
  get months() {
143
- return ge();
146
+ return _e();
144
147
  },
145
148
  get firstDayOfWeek() {
146
- return N();
149
+ return M();
147
150
  },
148
151
  get weekNumbers() {
149
- return P();
152
+ return N();
150
153
  },
151
154
  get locale() {
152
- return F();
155
+ return P();
153
156
  },
154
157
  get presets() {
155
158
  return r.presets;
156
159
  },
157
160
  get animate() {
158
- return L();
161
+ return I();
159
162
  },
160
163
  get dir() {
161
164
  return e(U);
162
165
  },
163
166
  onChange: Ee
164
- }), v(i), u(i, (e) => h(Z, e), () => e(Z)), T(i, (e) => ae?.(e)), T(i, (e, t) => ie?.(e, t), () => ({ up: e(Q).openUpward })), c(() => {
165
- _(i, "aria-label", e(H).dialog), _(i, "dir", e(U)), a = E(i, "", a, {
167
+ }), _(i), u(i, (e) => m(Z, e), () => e(Z)), w(i, (e) => oe?.(e)), w(i, (e, t) => ae?.(e, t), () => ({ up: e(Q).openUpward })), c(() => {
168
+ g(i, "aria-label", e(H).dialog), g(i, "dir", e(U)), a = T(i, "", a, {
166
169
  position: "fixed",
167
170
  top: `${e(Q).top}px`,
168
171
  left: `${e(Q).left}px`
169
172
  }), i.dir = i.dir;
170
173
  }), n(t, i);
171
174
  };
172
- g(D, (t) => {
173
- e(K) && t(O);
175
+ h(E, (t) => {
176
+ e(K) && t(D);
174
177
  });
175
- var k = b(D, 2), A = (e) => {
176
- var t = ue(), i = ee(t);
177
- x(i);
178
- var a = b(i, 2);
179
- x(a), c((e, t) => {
180
- _(i, "name", `${r.name}_start`), l(i, e), _(a, "name", `${r.name}_end`), l(a, t);
181
- }, [() => M()?.[0] ? M()[0].toISOString() : "", () => M()?.[1] ? M()[1].toISOString() : ""]), n(e, t);
178
+ var O = y(E, 2), k = (e) => {
179
+ var t = de(), i = te(t);
180
+ b(i);
181
+ var a = y(i, 2);
182
+ b(a), c((e, t) => {
183
+ g(i, "name", `${r.name}_start`), l(i, e), g(a, "name", `${r.name}_end`), l(a, t);
184
+ }, [() => j()?.[0] ? j()[0].toISOString() : "", () => j()?.[1] ? j()[1].toISOString() : ""]), n(e, t);
182
185
  };
183
- g(k, (e) => {
184
- r.name && e(A);
185
- }), v(s), c(() => {
186
+ h(O, (e) => {
187
+ r.name && e(k);
188
+ }), _(s), c(() => {
186
189
  d = i(s, 1, "sv-dri svelte-1rb3yee", null, d, {
187
- "is-block": be(),
188
- "sv-dri--disabled": R()
189
- }), y = i(f, 1, `sv-dri__field sv-dri__field--${ye() ?? ""}`, "svelte-1rb3yee", y, { "is-invalid": z() }), _(f, "dir", e(U)), f.dir = f.dir;
190
+ "is-block": z(),
191
+ "sv-dri--disabled": L()
192
+ }), v = i(f, 1, `sv-dri__field sv-dri__field--${be() ?? ""}`, "svelte-1rb3yee", v, { "is-invalid": R() }), g(f, "dir", e(U)), f.dir = f.dir;
190
193
  }), o("click", f, () => {
191
194
  e(W) && (e(X)?.focus(), we());
192
195
  }), n(t, s);
193
196
  },
194
197
  $$slots: { default: !0 }
195
- }), w();
198
+ }), C();
196
199
  }
197
200
  t(["click"]);
198
201
  //#endregion
199
- export { j as default };
202
+ export { A as default };