@ceed/ads 0.0.29 → 0.0.30

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.
@@ -71,6 +71,29 @@ function TablePagination(props) {
71
71
  page !== lastPage && (React.createElement(Button, { size: "sm", variant: "plain", color: "neutral", onClick: function () { return onPageChange(lastPage); } }, lastPage)),
72
72
  React.createElement(Button, { size: "sm", variant: "plain", color: "neutral", onClick: function () { return onPageChange(page + 1); }, disabled: page === lastPage, "aria-label": "Next page" }, ">"))));
73
73
  }
74
+ var Resizer = function (ref) { return (React.createElement(Box, { sx: {
75
+ position: "absolute",
76
+ top: 0,
77
+ right: 0,
78
+ bottom: 0,
79
+ width: "4px",
80
+ cursor: "col-resize",
81
+ }, onMouseDown: function (e) {
82
+ var _a;
83
+ var initialX = e.clientX;
84
+ var initialWidth = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width;
85
+ var onMouseMove = function (e) {
86
+ if (initialWidth && initialX) {
87
+ ref.current.style.width = "".concat(initialWidth + (e.clientX - initialX), "px");
88
+ }
89
+ };
90
+ var onMouseUp = function () {
91
+ document.removeEventListener("mousemove", onMouseMove);
92
+ document.removeEventListener("mouseup", onMouseUp);
93
+ };
94
+ document.addEventListener("mousemove", onMouseMove);
95
+ document.addEventListener("mouseup", onMouseUp);
96
+ } })); };
74
97
  function useDataTableRenderer(_a) {
75
98
  var rows = _a.rows, columns = _a.columns, totalRowsProp = _a.rowCount, paginationModel = _a.paginationModel, onPaginationModelChange = _a.onPaginationModelChange, _b = _a.selectionModel, selectionModel = _b === void 0 ? [] : _b, onSelectionModelChange = _a.onSelectionModelChange, stickyHeader = _a.stickyHeader;
76
99
  var _c = useState((paginationModel === null || paginationModel === void 0 ? void 0 : paginationModel.page) || 1), page = _c[0], setPage = _c[1];
@@ -106,42 +129,17 @@ function useDataTableRenderer(_a) {
106
129
  pageSize: pageSize,
107
130
  onPaginationModelChange: handlePageChange,
108
131
  getColumnHeader: useCallback(function (column) {
109
- var _a, _b;
132
+ var _a, _b, _c;
110
133
  var ref = useRef(null);
111
- var style = useMemo(function () {
112
- var _a;
113
- return ({
114
- width: column.width,
115
- minWidth: (_a = column.minWidth) !== null && _a !== void 0 ? _a : "50px",
116
- maxWidth: column.maxWidth,
117
- textAlign: column.type === "number" ? "end" : "start",
118
- position: stickyHeader ? undefined : "relative",
119
- });
120
- }, [column, stickyHeader]);
121
- var resizer = ((_a = column.resizable) !== null && _a !== void 0 ? _a : true) ? (React.createElement(Box, { sx: {
122
- position: "absolute",
123
- top: 0,
124
- right: 0,
125
- bottom: 0,
126
- width: "4px",
127
- cursor: "col-resize",
128
- }, onMouseDown: function (e) {
129
- var _a;
130
- var initialX = e.clientX;
131
- var initialWidth = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().width;
132
- var onMouseMove = function (e) {
133
- if (initialWidth && initialX) {
134
- ref.current.style.width = "".concat(initialWidth + (e.clientX - initialX), "px");
135
- }
136
- };
137
- var onMouseUp = function () {
138
- document.removeEventListener("mousemove", onMouseMove);
139
- document.removeEventListener("mouseup", onMouseUp);
140
- };
141
- document.addEventListener("mousemove", onMouseMove);
142
- document.addEventListener("mouseup", onMouseUp);
143
- } })) : null;
144
- return (React.createElement("th", { ref: ref, key: column.field, style: style }, (_b = column.headerName) !== null && _b !== void 0 ? _b : column.field,
134
+ var style = {
135
+ width: column.width,
136
+ minWidth: (_a = column.minWidth) !== null && _a !== void 0 ? _a : "50px",
137
+ maxWidth: column.maxWidth,
138
+ textAlign: column.type === "number" ? "end" : "start",
139
+ position: stickyHeader ? undefined : "relative",
140
+ };
141
+ var resizer = ((_b = column.resizable) !== null && _b !== void 0 ? _b : true) ? Resizer(ref) : null;
142
+ return (React.createElement("th", { ref: ref, key: column.field, style: style }, (_c = column.headerName) !== null && _c !== void 0 ? _c : column.field,
145
143
  resizer));
146
144
  }, [stickyHeader, columns]),
147
145
  dataInPage: dataInPage,
package/framer/index.js CHANGED
@@ -32216,6 +32216,34 @@ function TablePagination(props) {
32216
32216
  }
32217
32217
  );
32218
32218
  }
32219
+ var Resizer = (ref) => /* @__PURE__ */ jsx2(
32220
+ Box_default2,
32221
+ {
32222
+ sx: {
32223
+ position: "absolute",
32224
+ top: 0,
32225
+ right: 0,
32226
+ bottom: 0,
32227
+ width: "4px",
32228
+ cursor: "col-resize"
32229
+ },
32230
+ onMouseDown: (e) => {
32231
+ const initialX = e.clientX;
32232
+ const initialWidth = ref.current?.getBoundingClientRect().width;
32233
+ const onMouseMove = (e2) => {
32234
+ if (initialWidth && initialX) {
32235
+ ref.current.style.width = `${initialWidth + (e2.clientX - initialX)}px`;
32236
+ }
32237
+ };
32238
+ const onMouseUp = () => {
32239
+ document.removeEventListener("mousemove", onMouseMove);
32240
+ document.removeEventListener("mouseup", onMouseUp);
32241
+ };
32242
+ document.addEventListener("mousemove", onMouseMove);
32243
+ document.addEventListener("mouseup", onMouseUp);
32244
+ }
32245
+ }
32246
+ );
32219
32247
  function useDataTableRenderer({
32220
32248
  rows,
32221
32249
  columns,
@@ -32273,44 +32301,14 @@ function useDataTableRenderer({
32273
32301
  getColumnHeader: useCallback23(
32274
32302
  (column2) => {
32275
32303
  const ref = useRef40(null);
32276
- const style4 = useMemo32(
32277
- () => ({
32278
- width: column2.width,
32279
- minWidth: column2.minWidth ?? "50px",
32280
- maxWidth: column2.maxWidth,
32281
- textAlign: column2.type === "number" ? "end" : "start",
32282
- position: stickyHeader ? void 0 : "relative"
32283
- }),
32284
- [column2, stickyHeader]
32285
- );
32286
- const resizer = column2.resizable ?? true ? /* @__PURE__ */ jsx2(
32287
- Box_default2,
32288
- {
32289
- sx: {
32290
- position: "absolute",
32291
- top: 0,
32292
- right: 0,
32293
- bottom: 0,
32294
- width: "4px",
32295
- cursor: "col-resize"
32296
- },
32297
- onMouseDown: (e) => {
32298
- const initialX = e.clientX;
32299
- const initialWidth = ref.current?.getBoundingClientRect().width;
32300
- const onMouseMove = (e2) => {
32301
- if (initialWidth && initialX) {
32302
- ref.current.style.width = `${initialWidth + (e2.clientX - initialX)}px`;
32303
- }
32304
- };
32305
- const onMouseUp = () => {
32306
- document.removeEventListener("mousemove", onMouseMove);
32307
- document.removeEventListener("mouseup", onMouseUp);
32308
- };
32309
- document.addEventListener("mousemove", onMouseMove);
32310
- document.addEventListener("mouseup", onMouseUp);
32311
- }
32312
- }
32313
- ) : null;
32304
+ const style4 = {
32305
+ width: column2.width,
32306
+ minWidth: column2.minWidth ?? "50px",
32307
+ maxWidth: column2.maxWidth,
32308
+ textAlign: column2.type === "number" ? "end" : "start",
32309
+ position: stickyHeader ? void 0 : "relative"
32310
+ };
32311
+ const resizer = column2.resizable ?? true ? Resizer(ref) : null;
32314
32312
  return /* @__PURE__ */ jsxs2("th", { ref, style: style4, children: [
32315
32313
  column2.headerName ?? column2.field,
32316
32314
  resizer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ceed/ads",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "description": "UI tool for Ecube Labs front-end developers",