@reforgium/data-grid 2.3.5 → 2.3.6

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.
@@ -7,17 +7,11 @@ function cloneColumns(columns) {
7
7
  return columns.map((column) => ({ ...column }));
8
8
  }
9
9
  function resolvePinState(columns, key) {
10
- const visible = columns.filter(isVisible);
11
- const index = visible.findIndex((column) => column.key === key);
12
- if (index < 0) {
13
- return 'none';
14
- }
15
- const column = visible[index];
16
- if (!column.sticky) {
10
+ const column = columns.find((item) => item.key === key);
11
+ if (!column || !isVisible(column) || !column.sticky) {
17
12
  return 'none';
18
13
  }
19
- const middleIndex = Math.floor(visible.length / 2);
20
- return index < middleIndex ? 'left' : 'right';
14
+ return column.sticky === 'right' ? 'right' : 'left';
21
15
  }
22
16
  function moveColumn(columns, fromIndex, toIndex) {
23
17
  if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= columns.length || toIndex >= columns.length) {
@@ -38,11 +32,7 @@ function setColumnPin(columns, key, pin) {
38
32
  ...next[fromIndex],
39
33
  sticky: pin === 'none' ? undefined : pin,
40
34
  };
41
- if (pin === 'none') {
42
- return next;
43
- }
44
- const toIndex = pin === 'left' ? 0 : next.length - 1;
45
- return moveColumn(next, fromIndex, toIndex);
35
+ return next;
46
36
  }
47
37
  function setColumnVisibility(columns, key, visible) {
48
38
  const index = columns.findIndex((column) => column.key === key);
@@ -1,4 +1,4 @@
1
- import { c as computeScrollbarState, a as clampThumbTop, m as mapThumbTopToScrollTop } from './reforgium-data-grid-reforgium-data-grid-DK84fYFQ.mjs';
1
+ import { c as computeScrollbarState, a as clampThumbTop, m as mapThumbTopToScrollTop } from './reforgium-data-grid-reforgium-data-grid-D5cKt3RW.mjs';
2
2
 
3
3
  function createGridOverlayScrollFeature(ctx) {
4
4
  const showScrollbar = () => {
@@ -76,4 +76,4 @@ function createGridOverlayScrollFeature(ctx) {
76
76
  }
77
77
 
78
78
  export { createGridOverlayScrollFeature };
79
- //# sourceMappingURL=reforgium-data-grid-grid-overlay-scroll.feature-BnLB5Ny4.mjs.map
79
+ //# sourceMappingURL=reforgium-data-grid-grid-overlay-scroll.feature-C1hp0DIj.mjs.map
@@ -2295,29 +2295,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
2295
2295
  ` }]
2296
2296
  }], propDecorators: { expanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "expanded", required: false }] }] } });
2297
2297
 
2298
- /* eslint-disable max-len */
2299
2298
  class SortIcon {
2300
2299
  direction = input('asc', ...(ngDevMode ? [{ debugName: "direction" }] : []));
2301
2300
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: SortIcon, deps: [], target: i0.ɵɵFactoryTarget.Component });
2302
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.1", type: SortIcon, isStandalone: true, selector: "re-sort-ic", inputs: { direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
2303
- <svg width="18" height="18" viewBox="0 0 18 18" class="{{ direction() }}">
2304
- <path
2305
- d="M12.84 8.51259L9.66754 11.6851V4.59009C9.66754 4.39118 9.58852 4.20041 9.44787 4.05976C9.30722 3.91911 9.11645 3.84009 8.91754 3.84009C8.71863 3.84009 8.52786 3.91911 8.38721 4.05976C8.24656 4.20041 8.16754 4.39118 8.16754 4.59009V11.6851L4.99504 8.51259C4.92511 8.44266 4.84209 8.38719 4.75073 8.34934C4.65936 8.3115 4.56144 8.29202 4.46254 8.29202C4.36365 8.29202 4.26572 8.3115 4.17435 8.34934C4.08299 8.38719 3.99997 8.44266 3.93004 8.51259C3.86011 8.58252 3.80464 8.66553 3.7668 8.7569C3.72895 8.84827 3.70947 8.94619 3.70947 9.04509C3.70947 9.14398 3.72895 9.24191 3.7668 9.33327C3.80464 9.42464 3.86011 9.50766 3.93004 9.57759L8.38504 14.0251C8.45349 14.0952 8.53503 14.1513 8.62504 14.1901C8.71842 14.2256 8.81762 14.2435 8.91754 14.2426C9.01505 14.2438 9.11186 14.226 9.20254 14.1901C9.29255 14.1513 9.37409 14.0952 9.44254 14.0251L13.8975 9.57759C13.9678 9.50787 14.0236 9.42491 14.0617 9.33352C14.0998 9.24213 14.1194 9.1441 14.1194 9.04509C14.1194 8.94608 14.0998 8.84805 14.0617 8.75666C14.0236 8.66526 13.9678 8.58231 13.8975 8.51259C13.757 8.3729 13.5669 8.29449 13.3688 8.29449C13.1707 8.29449 12.9806 8.3729 12.84 8.51259Z"
2306
- fill="currentColor"
2307
- />
2308
- </svg>
2309
- `, isInline: true, styles: ["svg{transition:transform .3s ease-in-out}svg:not(.asc):not(.desc){display:none}.asc{transform:rotate(-180deg)}.desc{transform:rotate(0)}\n"] });
2301
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.1", type: SortIcon, isStandalone: true, selector: "re-sort-ic", inputs: { direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
2302
+ @if (direction()) {
2303
+ <svg width="18" height="18" viewBox="0 0 18 18" fill="none" class="{{ direction() }}">
2304
+ <path d="M9 14L9 4M9 4L4 9M9 4C9 4 12.0474 6.85212 14 9" stroke="currentColor" />
2305
+ </svg>
2306
+ } @else {
2307
+ <svg width="18" height="18" viewBox="0 0 18 18" class="unsort">
2308
+ <path d="M14 9L4 9M4 9L9 14M4 9C4 9 6.85212 5.95262 9 4" stroke="black" />
2309
+ <path
2310
+ d="M4.00049 9H14.0005M14.0005 9L9.00049 4M14.0005 9C14.0005 9 11.1484 12.0474 9.00049 14"
2311
+ stroke="black"
2312
+ />
2313
+ </svg>
2314
+ }
2315
+ `, isInline: true, styles: [".asc{transform:rotate(0);animation:sort-anim .2s ease-in-out}.desc{transform:rotate(180deg);transition:transform .3s ease-in-out}.unsort{animation:sort-anim .3s ease-in-out}@keyframes sort-anim{0%{transform:rotate(-90deg)}to{transform:rotate(0)}}\n"] });
2310
2316
  }
2311
2317
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: SortIcon, decorators: [{
2312
2318
  type: Component,
2313
2319
  args: [{ selector: 're-sort-ic', template: `
2314
- <svg width="18" height="18" viewBox="0 0 18 18" class="{{ direction() }}">
2315
- <path
2316
- d="M12.84 8.51259L9.66754 11.6851V4.59009C9.66754 4.39118 9.58852 4.20041 9.44787 4.05976C9.30722 3.91911 9.11645 3.84009 8.91754 3.84009C8.71863 3.84009 8.52786 3.91911 8.38721 4.05976C8.24656 4.20041 8.16754 4.39118 8.16754 4.59009V11.6851L4.99504 8.51259C4.92511 8.44266 4.84209 8.38719 4.75073 8.34934C4.65936 8.3115 4.56144 8.29202 4.46254 8.29202C4.36365 8.29202 4.26572 8.3115 4.17435 8.34934C4.08299 8.38719 3.99997 8.44266 3.93004 8.51259C3.86011 8.58252 3.80464 8.66553 3.7668 8.7569C3.72895 8.84827 3.70947 8.94619 3.70947 9.04509C3.70947 9.14398 3.72895 9.24191 3.7668 9.33327C3.80464 9.42464 3.86011 9.50766 3.93004 9.57759L8.38504 14.0251C8.45349 14.0952 8.53503 14.1513 8.62504 14.1901C8.71842 14.2256 8.81762 14.2435 8.91754 14.2426C9.01505 14.2438 9.11186 14.226 9.20254 14.1901C9.29255 14.1513 9.37409 14.0952 9.44254 14.0251L13.8975 9.57759C13.9678 9.50787 14.0236 9.42491 14.0617 9.33352C14.0998 9.24213 14.1194 9.1441 14.1194 9.04509C14.1194 8.94608 14.0998 8.84805 14.0617 8.75666C14.0236 8.66526 13.9678 8.58231 13.8975 8.51259C13.757 8.3729 13.5669 8.29449 13.3688 8.29449C13.1707 8.29449 12.9806 8.3729 12.84 8.51259Z"
2317
- fill="currentColor"
2318
- />
2319
- </svg>
2320
- `, styles: ["svg{transition:transform .3s ease-in-out}svg:not(.asc):not(.desc){display:none}.asc{transform:rotate(-180deg)}.desc{transform:rotate(0)}\n"] }]
2320
+ @if (direction()) {
2321
+ <svg width="18" height="18" viewBox="0 0 18 18" fill="none" class="{{ direction() }}">
2322
+ <path d="M9 14L9 4M9 4L4 9M9 4C9 4 12.0474 6.85212 14 9" stroke="currentColor" />
2323
+ </svg>
2324
+ } @else {
2325
+ <svg width="18" height="18" viewBox="0 0 18 18" class="unsort">
2326
+ <path d="M14 9L4 9M4 9L9 14M4 9C4 9 6.85212 5.95262 9 4" stroke="black" />
2327
+ <path
2328
+ d="M4.00049 9H14.0005M14.0005 9L9.00049 4M14.0005 9C14.0005 9 11.1484 12.0474 9.00049 14"
2329
+ stroke="black"
2330
+ />
2331
+ </svg>
2332
+ }
2333
+ `, styles: [".asc{transform:rotate(0);animation:sort-anim .2s ease-in-out}.desc{transform:rotate(180deg);transition:transform .3s ease-in-out}.unsort{animation:sort-anim .3s ease-in-out}@keyframes sort-anim{0%{transform:rotate(-90deg)}to{transform:rotate(0)}}\n"] }]
2321
2334
  }], propDecorators: { direction: [{ type: i0.Input, args: [{ isSignal: true, alias: "direction", required: false }] }] } });
2322
2335
 
2323
2336
  /**
@@ -3159,7 +3172,7 @@ class DataGrid {
3159
3172
  if (this.overlayScrollFeaturePromise) {
3160
3173
  return this.overlayScrollFeaturePromise;
3161
3174
  }
3162
- this.overlayScrollFeaturePromise = import('./reforgium-data-grid-grid-overlay-scroll.feature-BnLB5Ny4.mjs').then(({ createGridOverlayScrollFeature }) => {
3175
+ this.overlayScrollFeaturePromise = import('./reforgium-data-grid-grid-overlay-scroll.feature-C1hp0DIj.mjs').then(({ createGridOverlayScrollFeature }) => {
3163
3176
  const feature = createGridOverlayScrollFeature({
3164
3177
  getScrollElement: () => this.scrollEl()?.nativeElement ?? null,
3165
3178
  getThumbTop: () => this.vm.thumbTopPx(),
@@ -3284,4 +3297,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImpor
3284
3297
  */
3285
3298
 
3286
3299
  export { DataGridTypeCellTemplateDirective as D, clampThumbTop as a, DataGridCellTemplateDirective as b, computeScrollbarState as c, DataGridHeaderTemplateDirective as d, DataGridRowDirective as e, DataGridDeclarativeColumn as f, DataGridDeclarativeHeaderDirective as g, DataGridDeclarativeCellDirective as h, DataGridCellEmptyDirective as i, DataGridCellLoadingDirective as j, DataGridStickyRowDirective as k, DataGridSortIconDirective as l, mapThumbTopToScrollTop as m, DataGridExpanderIconDirective as n, DATA_GRID_CONFIG as o, DEFAULT_DATA_GRID_DEFAULTS as p, provideDataGridDefaults as q, DataGrid as r };
3287
- //# sourceMappingURL=reforgium-data-grid-reforgium-data-grid-DK84fYFQ.mjs.map
3300
+ //# sourceMappingURL=reforgium-data-grid-reforgium-data-grid-D5cKt3RW.mjs.map
@@ -1,2 +1,2 @@
1
- export { o as DATA_GRID_CONFIG, p as DEFAULT_DATA_GRID_DEFAULTS, r as DataGrid, i as DataGridCellEmptyDirective, j as DataGridCellLoadingDirective, b as DataGridCellTemplateDirective, h as DataGridDeclarativeCellDirective, f as DataGridDeclarativeColumn, g as DataGridDeclarativeHeaderDirective, n as DataGridExpanderIconDirective, d as DataGridHeaderTemplateDirective, e as DataGridRowDirective, l as DataGridSortIconDirective, k as DataGridStickyRowDirective, D as DataGridTypeCellTemplateDirective, q as provideDataGridDefaults } from './reforgium-data-grid-reforgium-data-grid-DK84fYFQ.mjs';
1
+ export { o as DATA_GRID_CONFIG, p as DEFAULT_DATA_GRID_DEFAULTS, r as DataGrid, i as DataGridCellEmptyDirective, j as DataGridCellLoadingDirective, b as DataGridCellTemplateDirective, h as DataGridDeclarativeCellDirective, f as DataGridDeclarativeColumn, g as DataGridDeclarativeHeaderDirective, n as DataGridExpanderIconDirective, d as DataGridHeaderTemplateDirective, e as DataGridRowDirective, l as DataGridSortIconDirective, k as DataGridStickyRowDirective, D as DataGridTypeCellTemplateDirective, q as provideDataGridDefaults } from './reforgium-data-grid-reforgium-data-grid-D5cKt3RW.mjs';
2
2
  //# sourceMappingURL=reforgium-data-grid.mjs.map
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.3.5",
2
+ "version": "2.3.6",
3
3
  "name": "@reforgium/data-grid",
4
4
  "description": "reforgium DataGrid component",
5
5
  "author": "rtommievich",