@1771technologies/lytenyte-pro 0.0.40 → 0.0.42

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/index.js CHANGED
@@ -289,27 +289,24 @@ function useHeaderCells(api) {
289
289
  }
290
290
  function useResizeDivider(api, column) {
291
291
  const isResizable = api.columnIsResizable(column);
292
- const timeOutRef = useRef(null);
293
- const dragStarted = useRef(false);
292
+ const [active, setActive] = useState(false);
294
293
  const resizeProps = useMemo(() => {
295
294
  if (!isResizable) return {};
296
295
  const onPointerDown = (e) => {
297
- e.preventDefault();
296
+ if (e.pointerType === "mouse" && e.button !== 0) return;
298
297
  const startWidth = api.columnVisualWidth(column);
299
298
  const isRtl = api.getState().rtl.peek();
300
299
  let startX = null;
301
300
  let anim = null;
302
301
  let delta = 0;
303
- if (timeOutRef.current) clearTimeout(timeOutRef.current);
304
- timeOutRef.current = setTimeout(() => {
305
- dragStarted.current = true;
306
- timeOutRef.current = null;
307
- }, 100);
302
+ e.preventDefault();
303
+ e.stopPropagation();
304
+ document.body.classList.add("lng1771-column-resize-active");
305
+ setActive(true);
308
306
  const controller = new AbortController();
309
307
  document.addEventListener(
310
308
  "pointermove",
311
309
  (ev) => {
312
- if (dragStarted.current === false) return;
313
310
  if (startX === null) {
314
311
  startX = getClientX(ev);
315
312
  return;
@@ -327,9 +324,9 @@ function useResizeDivider(api, column) {
327
324
  window.addEventListener(
328
325
  "pointerup",
329
326
  () => {
330
- if (timeOutRef.current) clearTimeout(timeOutRef.current);
331
327
  if (anim) cancelAnimationFrame(anim);
332
- dragStarted.current = false;
328
+ setActive(false);
329
+ document.body.classList.remove("lng1771-column-resize-active");
333
330
  const newWidth = startWidth + delta;
334
331
  api.columnResize(column, newWidth);
335
332
  api.getState().internal.columnWidthDeltas.set(null);
@@ -340,7 +337,7 @@ function useResizeDivider(api, column) {
340
337
  };
341
338
  return { onPointerDown };
342
339
  }, [api, column, isResizable]);
343
- return resizeProps;
340
+ return { ...resizeProps, active };
344
341
  }
345
342
  function HeaderDivider({
346
343
  api,
@@ -358,7 +355,7 @@ function HeaderDivider({
358
355
  const isLastStart = startCount > 0 && columnIndex === startCount - 1;
359
356
  const isFirstEnd = endCount > 0 && startCount + centerCount === columnIndex;
360
357
  const isLast = startCount + centerCount + endCount - 1 === columnIndex;
361
- const resizeProps = useResizeDivider(api, column);
358
+ const { onPointerDown, active: resizeActive } = useResizeDivider(api, column);
362
359
  const rtl = api.getState().rtl.use();
363
360
  const style = useMemo(() => {
364
361
  const isStart = column.pin === "start";
@@ -397,7 +394,8 @@ function HeaderDivider({
397
394
  return /* @__PURE__ */ jsx(
398
395
  "div",
399
396
  {
400
- ...resizeProps,
397
+ onPointerDown,
398
+ "data-resize-active": resizeActive,
401
399
  onDoubleClick: () => {
402
400
  const autosize = api.getState().autosizeDoubleClickHeader.peek();
403
401
  if (autosize) api.autosizeColumn(column, { includeHeader: true });
@@ -3655,16 +3653,41 @@ function HeaderCellDefault({ column, api }) {
3655
3653
  const hints = column.uiHints ?? sx.columnBase.peek().uiHints ?? {};
3656
3654
  const columnMenuOpen = sx.columnMenuActiveColumn.use();
3657
3655
  const hasControls = hints.columnMenu || hints.sortButton && isSortable;
3656
+ const rowGroup = sx.rowGroupModel.use();
3657
+ const aggModel = sx.aggModel.use();
3658
+ const agg = aggModel[column.id];
3659
+ const fn = useMemo(() => {
3660
+ return rowGroup.length > 0 && agg ? typeof agg.fn === "string" ? `(${agg.fn})` : "fn(x)" : null;
3661
+ }, [agg, rowGroup.length]);
3662
+ const subTitle = hints.subTitle;
3663
+ const stacked = hints.stacked ?? false;
3658
3664
  return /* @__PURE__ */ jsxs(
3659
3665
  "div",
3660
3666
  {
3661
3667
  className: clsx(
3662
3668
  "lng1771-header-default",
3663
- column.type === "number" && "lng1771-header-default--end-align",
3664
- column.type !== "number" && "lng1771-header-default--start-align"
3669
+ column.type === "number" && "lng1771-header-default--end-justify",
3670
+ column.type !== "number" && "lng1771-header-default--start-justify"
3665
3671
  ),
3666
3672
  children: [
3667
- /* @__PURE__ */ jsx("div", { children: column.headerName ?? column.id }),
3673
+ /* @__PURE__ */ jsxs(
3674
+ "div",
3675
+ {
3676
+ className: clsx(
3677
+ "lng1771-header-default__label",
3678
+ column.type === "number" && "lng1771-header-default__label--end-justify",
3679
+ column.type !== "number" && "lng1771-header-default__label--start-justify",
3680
+ stacked && "lng1771-header-default__label--stacked"
3681
+ ),
3682
+ children: [
3683
+ /* @__PURE__ */ jsx("div", { children: column.headerName ?? column.id }),
3684
+ /* @__PURE__ */ jsxs("div", { className: "lng1771-header-default__label-secondary", children: [
3685
+ subTitle && /* @__PURE__ */ jsx("div", { className: "lng1771-header-default__label-secondary-title", children: subTitle }),
3686
+ hints.showAggName && fn && /* @__PURE__ */ jsx("div", { className: "lng1771-header-default__label-secondary-agg", children: fn })
3687
+ ] })
3688
+ ]
3689
+ }
3690
+ ),
3668
3691
  hasControls && /* @__PURE__ */ jsxs("div", { className: "lng1771-header-default__controls", children: [
3669
3692
  isSortable && hints.sortButton && /* @__PURE__ */ jsxs(
3670
3693
  "button",
@@ -3672,6 +3695,7 @@ function HeaderCellDefault({ column, api }) {
3672
3695
  tabIndex: -1,
3673
3696
  "data-active": currentSort != null,
3674
3697
  className: clsx("lng1771-header-default__button"),
3698
+ "data-is-sort": true,
3675
3699
  onClick: () => api.columnSortCycleToNext(column),
3676
3700
  children: [
3677
3701
  currentSort === "asc" && /* @__PURE__ */ jsx(SortAscending, { width: 16, height: 16 }),
@@ -324,6 +324,14 @@ INPUT
324
324
  &:hover div {
325
325
  background-color: var(--lng1771-primary-50);
326
326
  }
327
+
328
+ &[data-resize-active="true"] {
329
+ background-color: var(--lng1771-primary-50);
330
+ }
331
+ }
332
+
333
+ .lng1771-column-resize-active {
334
+ cursor: col-resize;
327
335
  }
328
336
  .lng1771-header__group {
329
337
  grid-column-start: 1;
@@ -553,6 +561,7 @@ INPUT
553
561
  height: 1px;
554
562
  width: 100%;
555
563
  background-color: var(--lng1771-gray-40);
564
+ box-sizing: border-box;
556
565
  }
557
566
 
558
567
  .lng1771-menu__item,
@@ -589,6 +598,7 @@ INPUT
589
598
  display: flex;
590
599
  align-items: center;
591
600
  justify-content: space-between;
601
+ box-sizing: border-box;
592
602
  }
593
603
 
594
604
  .lng1771-menu__arrow {
@@ -619,6 +629,7 @@ INPUT
619
629
  align-items: center;
620
630
  background-color: inherit;
621
631
  text-transform: uppercase;
632
+ box-sizing: border-box;
622
633
  }
623
634
 
624
635
  .lng1771-menu__radio-item-indicator,
@@ -627,6 +638,7 @@ INPUT
627
638
  display: flex;
628
639
  align-items: center;
629
640
  justify-content: center;
641
+ box-sizing: border-box;
630
642
  }
631
643
  .lng1771-pill {
632
644
  white-space: nowrap;
@@ -1946,8 +1958,54 @@ body.lng1771-drag-on
1946
1958
  letter-spacing: 0.25px;
1947
1959
  }
1948
1960
 
1949
- .lng1771-header-default--end-align {
1961
+ .lng1771-header-default__label {
1962
+ display: flex;
1963
+ gap: 4px;
1964
+
1965
+ & span:last-child {
1966
+ font-size: 10px;
1967
+ text-transform: uppercase;
1968
+ color: var(--lng1771-primary-50);
1969
+ }
1970
+ }
1971
+
1972
+ .lng1771-header-default__label:not(
1973
+ .lng1771-header-default__label--stacked
1974
+ ).lng1771-header-default__label--end-justify {
1975
+ flex-direction: row-reverse;
1976
+ justify-content: flex-start;
1977
+ align-items: center;
1978
+ gap: 2px;
1979
+ text-align: end;
1980
+ }
1981
+
1982
+ .lng1771-header-default__label--stacked {
1983
+ flex-direction: column;
1984
+ gap: 2px;
1985
+ }
1986
+
1987
+ .lng1771-header-default__label--end-justify {
1988
+ width: 100%;
1950
1989
  justify-content: flex-end;
1990
+ align-items: flex-end;
1991
+ text-align: end;
1992
+ }
1993
+
1994
+ .lng1771-header-default__label-secondary {
1995
+ display: flex;
1996
+ align-items: center;
1997
+ gap: 2px;
1998
+ font-size: 10px;
1999
+ }
2000
+
2001
+ .lng1771-header-default--end-justify .lng1771-header-default__label-secondary {
2002
+ flex-direction: row-reverse;
2003
+ }
2004
+
2005
+ .lng1771-header-default__label-secondary-agg {
2006
+ color: var(--lng1771-primary-50);
2007
+ font-weight: 600;
2008
+ text-transform: lowercase;
1951
2009
  }
1952
2010
 
1953
2011
  .lng1771-header-default__controls {
@@ -1957,11 +2015,11 @@ body.lng1771-drag-on
1957
2015
  gap: 4px;
1958
2016
  }
1959
2017
 
1960
- .lng1771-header-default--start-align .lng1771-header-default__controls {
2018
+ .lng1771-header-default--start-justify .lng1771-header-default__controls {
1961
2019
  inset-inline-end: 12px;
1962
2020
  }
1963
2021
 
1964
- .lng1771-header-default--end-align .lng1771-header-default__controls {
2022
+ .lng1771-header-default--end-justify .lng1771-header-default__controls {
1965
2023
  inset-inline-start: 12px;
1966
2024
  flex-direction: row-reverse;
1967
2025
  }
@@ -1981,7 +2039,6 @@ body.lng1771-drag-on
1981
2039
 
1982
2040
  &:hover {
1983
2041
  background-color: var(--lng1771-gray-20);
1984
- border-color: var(--lng1771-gray-30);
1985
2042
  cursor: pointer;
1986
2043
  }
1987
2044
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1771technologies/lytenyte-pro",
3
- "version": "0.0.40",
3
+ "version": "0.0.42",
4
4
  "license": "COMMERCIAL",
5
5
  "type": "module",
6
6
  "files": [
@@ -70,20 +70,20 @@
70
70
  "react-dom": "^18.0.0 || ^19.0.0"
71
71
  },
72
72
  "dependencies": {
73
- "@1771technologies/grid-client-data-source-pro": "0.0.40",
74
- "@1771technologies/grid-core": "0.0.40",
75
- "@1771technologies/grid-design": "0.0.40",
76
- "@1771technologies/grid-provider": "0.0.40",
77
- "@1771technologies/grid-store-pro": "0.0.40",
78
- "@1771technologies/grid-tree-data-source": "0.0.40",
79
- "@1771technologies/grid-types": "0.0.40",
80
- "@1771technologies/js-utils": "0.0.40",
81
- "@1771technologies/lytenyte-core": "0.0.40",
82
- "@1771technologies/react-cascada": "0.0.40",
83
- "@1771technologies/react-dragon": "0.0.40",
84
- "@1771technologies/react-sizer": "0.0.40",
85
- "@1771technologies/react-split-pane": "0.0.40",
86
- "@1771technologies/react-utils": "0.0.40",
73
+ "@1771technologies/grid-client-data-source-pro": "0.0.42",
74
+ "@1771technologies/grid-core": "0.0.42",
75
+ "@1771technologies/grid-design": "0.0.42",
76
+ "@1771technologies/grid-provider": "0.0.42",
77
+ "@1771technologies/grid-store-pro": "0.0.42",
78
+ "@1771technologies/grid-tree-data-source": "0.0.42",
79
+ "@1771technologies/grid-types": "0.0.42",
80
+ "@1771technologies/js-utils": "0.0.42",
81
+ "@1771technologies/lytenyte-core": "0.0.42",
82
+ "@1771technologies/react-cascada": "0.0.42",
83
+ "@1771technologies/react-dragon": "0.0.42",
84
+ "@1771technologies/react-sizer": "0.0.42",
85
+ "@1771technologies/react-split-pane": "0.0.42",
86
+ "@1771technologies/react-utils": "0.0.42",
87
87
  "@base-ui-components/react": "1.0.0-alpha.7"
88
88
  },
89
89
  "devDependencies": {