@data-c/pro 0.2.54 → 0.2.56

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
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/DataTable/index.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/DataTable/index.ts
2
2
  var _xdatagridpro = require('@mui/x-data-grid-pro');
3
3
 
4
4
  // src/DataTable/DataTable.tsx
5
- var _react = require('react');
5
+ var _react = require('react'); var _react2 = _interopRequireDefault(_react);
6
6
  var _iconsmaterial = require('@mui/icons-material');
7
7
  var _material = require('@mui/material');
8
8
 
@@ -111,6 +111,8 @@ function DataTableError({
111
111
 
112
112
 
113
113
 
114
+
115
+
114
116
  var TableRootContext = _react.createContext.call(void 0, {});
115
117
  function TableRootProvider({
116
118
  children
@@ -152,209 +154,274 @@ function useTableRootContext() {
152
154
 
153
155
  // src/DataTable/DataTable.tsx
154
156
 
155
- var getFilteredRows = ({ apiRef }) => _xdatagridpro.gridFilteredSortedRowIdsSelector.call(void 0, apiRef);
156
- function Table(props) {
157
- const {
158
- error,
159
- isLoading,
160
- isFetching,
161
- data,
162
- columns,
163
- controlledRowsSelectedId,
164
- onClearRowsSelectedId,
165
- onRowSelectionChange,
166
- onCellKeyDown,
167
- onRowDoubleClick,
168
- stackProps,
169
- slots,
170
- ...rest
171
- } = props;
172
- const {
173
- rowsSelectedId,
174
- setRowsSelectedId,
175
- clearCallback,
176
- setClearCallback,
177
- apiRef
178
- } = useTableRootContext();
179
- const parsedColumns = _react.useMemo.call(void 0, () => {
180
- return (columns2) => {
181
- return columns2.map((col) => {
182
- if (col.headerName === "A\xE7\xF5es") {
183
- return {
184
- ...col,
185
- minWidth: col.minWidth || 80,
186
- maxWidth: col.maxWidth || col.width || 80,
187
- headerClassName: "sticky-header",
188
- cellClassName: "sticky-cell"
189
- };
157
+ var _DataTable = _react2.default.forwardRef(
158
+ function Table(props, ref) {
159
+ const {
160
+ error,
161
+ isLoading,
162
+ isFetching,
163
+ data,
164
+ columns,
165
+ onColumnChange,
166
+ onColumnVisibilityModelChange,
167
+ onColumnOrderChange,
168
+ onColumnWidthChange,
169
+ controlledRowsSelectedId,
170
+ onClearRowsSelectedId,
171
+ onRowSelectionChange,
172
+ onCellKeyDown,
173
+ onRowDoubleClick,
174
+ stackProps,
175
+ slots,
176
+ restoreFromState,
177
+ ...rest
178
+ } = props;
179
+ const {
180
+ rowsSelectedId,
181
+ setRowsSelectedId,
182
+ clearCallback,
183
+ setClearCallback,
184
+ apiRef
185
+ } = useTableRootContext();
186
+ _react2.default.useImperativeHandle(
187
+ ref,
188
+ () => ({
189
+ apiRef: apiRef.current,
190
+ restoreState: (state) => {
191
+ if (!_optionalChain([apiRef, 'optionalAccess', _2 => _2.current]) || !state)
192
+ return;
193
+ const cleanState = Object.entries(state).reduce(
194
+ (acc, [key, value]) => {
195
+ if (value !== null) {
196
+ acc[key] = value;
197
+ }
198
+ return acc;
199
+ },
200
+ {}
201
+ );
202
+ if (Object.keys(cleanState).length > 0) {
203
+ console.log("Restaurando estado da tabela:", cleanState);
204
+ apiRef.current.restoreState(cleanState);
205
+ }
206
+ },
207
+ exportState: () => {
208
+ return _optionalChain([apiRef, 'optionalAccess', _3 => _3.current, 'optionalAccess', _4 => _4.exportState, 'call', _5 => _5({
209
+ exportOnlyDirtyModels: true
210
+ })]);
190
211
  }
191
- return {
192
- ...col,
193
- flex: col.flex || 1,
194
- minWidth: col.minWidth || 100,
195
- headerClassName: _optionalChain([col, 'optionalAccess', _2 => _2.enableStickyColumns]) ? "sticky-header" : "",
196
- cellClassName: _optionalChain([col, 'optionalAccess', _3 => _3.enableStickyColumns]) ? "sticky-cell" : ""
197
- };
212
+ }),
213
+ [apiRef]
214
+ );
215
+ const columnWidthDebounceRef = _react2.default.useRef(null);
216
+ const ignoreWarmupRef = _react2.default.useRef(true);
217
+ _react2.default.useEffect(() => {
218
+ const timeoutId = window.setTimeout(() => {
219
+ ignoreWarmupRef.current = false;
220
+ }, 100);
221
+ return () => {
222
+ window.clearTimeout(timeoutId);
223
+ if (columnWidthDebounceRef.current) {
224
+ window.clearTimeout(columnWidthDebounceRef.current);
225
+ }
226
+ };
227
+ }, []);
228
+ _react.useEffect.call(void 0, () => {
229
+ if (!apiRef.current)
230
+ return;
231
+ if (!restoreFromState)
232
+ return;
233
+ const cleanState = Object.entries(restoreFromState).reduce(
234
+ (acc, [key, value]) => {
235
+ if (value !== null) {
236
+ acc[key] = value;
237
+ }
238
+ return acc;
239
+ },
240
+ {}
241
+ );
242
+ if (Object.keys(cleanState).length > 0) {
243
+ apiRef.current.restoreState(cleanState);
244
+ }
245
+ }, [apiRef, restoreFromState]);
246
+ const emitColumnChange = _react2.default.useCallback(
247
+ (meta) => {
248
+ if (!apiRef.current)
249
+ return;
250
+ const state = apiRef.current.exportState({
251
+ exportOnlyDirtyModels: true
252
+ });
253
+ _optionalChain([onColumnChange, 'optionalCall', _6 => _6({ state, meta })]);
254
+ },
255
+ [apiRef, onColumnChange]
256
+ );
257
+ function _onColumnOrderChange(params, event, details) {
258
+ _optionalChain([onColumnOrderChange, 'optionalCall', _7 => _7(params, event, details)]);
259
+ emitColumnChange({
260
+ reason: "order"
198
261
  });
199
- };
200
- }, [columns]);
201
- _react.useEffect.call(void 0, () => {
202
- if (controlledRowsSelectedId) {
203
- setRowsSelectedId(controlledRowsSelectedId);
204
262
  }
205
- }, [controlledRowsSelectedId]);
206
- _react.useEffect.call(void 0, () => {
207
- if (clearCallback) {
208
- onClearRowsSelectedId && onClearRowsSelectedId({
209
- type: "include",
210
- ids: /* @__PURE__ */ new Set()
211
- });
212
- setClearCallback(false);
263
+ function _onColumnWidthChange(params, event, details) {
264
+ if (ignoreWarmupRef.current) {
265
+ return;
266
+ }
267
+ _optionalChain([onColumnWidthChange, 'optionalCall', _8 => _8(params, event, details)]);
268
+ emitColumnWidthChangeDebounced();
213
269
  }
214
- }, [clearCallback]);
215
- function handleCellKeyDown(params, event, details) {
216
- const eventCode = event.ctrlKey && event.code === "KeyE" ? "ctrl+e" : event.code;
217
- switch (eventCode) {
218
- case "Enter":
219
- event.preventDefault();
220
- if (onCellKeyDown)
221
- onCellKeyDown("edit", params.id);
222
- break;
223
- case "F3":
224
- event.preventDefault();
225
- if (onCellKeyDown)
226
- onCellKeyDown("edit", params.id);
227
- break;
228
- case "Delete":
229
- event.preventDefault();
230
- if (onCellKeyDown)
231
- onCellKeyDown("delete", params.id);
232
- break;
233
- case "ctrl+e":
234
- event.preventDefault();
235
- const handleExport = (options) => {
236
- if (_optionalChain([apiRef, 'optionalAccess', _4 => _4.current])) {
237
- apiRef.current.exportDataAsCsv(options);
238
- }
239
- };
240
- handleExport({ getRowsToExport: getFilteredRows });
241
- break;
242
- default:
243
- break;
270
+ function _onColumnVisibilityModelChange(params, details) {
271
+ _optionalChain([onColumnVisibilityModelChange, 'optionalCall', _9 => _9(params, details)]);
272
+ emitColumnChange({
273
+ reason: "visibility"
274
+ });
244
275
  }
245
- }
246
- function handleRowDoubleClick(params, _, details) {
247
- if (onRowDoubleClick)
248
- onRowDoubleClick("edit", params.id);
249
- }
250
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { height: "100%", minHeight: "500px", position: "relative", ...stackProps, children: [
251
- !isLoading && isFetching && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
252
- _material.LinearProgress,
253
- {
254
- sx: {
255
- position: "absolute",
256
- top: 0,
257
- right: 0,
258
- left: 0,
259
- zIndex: 999,
260
- height: "3px"
261
- }
276
+ const emitColumnWidthChangeDebounced = _react2.default.useCallback(() => {
277
+ if (columnWidthDebounceRef.current) {
278
+ window.clearTimeout(columnWidthDebounceRef.current);
279
+ }
280
+ columnWidthDebounceRef.current = window.setTimeout(() => {
281
+ emitColumnChange({ reason: "width" });
282
+ }, 250);
283
+ }, [emitColumnChange]);
284
+ _react.useEffect.call(void 0, () => {
285
+ if (controlledRowsSelectedId) {
286
+ setRowsSelectedId(controlledRowsSelectedId);
287
+ }
288
+ }, [controlledRowsSelectedId]);
289
+ _react.useEffect.call(void 0, () => {
290
+ if (clearCallback) {
291
+ onClearRowsSelectedId && onClearRowsSelectedId({
292
+ type: "include",
293
+ ids: /* @__PURE__ */ new Set()
294
+ });
295
+ setClearCallback(false);
262
296
  }
263
- ),
264
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
265
- _xdatagridpro.DataGridPro,
297
+ }, [clearCallback]);
298
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
299
+ _material.Stack,
266
300
  {
267
- apiRef,
268
- rows: data,
269
- columns: parsedColumns(columns),
270
- density: "compact",
271
- hideFooterPagination: true,
272
- hideFooter: true,
273
- loading: isLoading,
274
- rowHeight: 43,
275
- columnHeaderHeight: 43,
276
- disableVirtualization: true,
277
- onRowDoubleClick: handleRowDoubleClick,
278
- onCellKeyDown: handleCellKeyDown,
279
- disableRowSelectionOnClick: true,
280
- rowSelectionModel: rowsSelectedId,
281
- onRowSelectionModelChange: (rowSelectionModel, details) => {
282
- if (onRowSelectionChange) {
283
- onRowSelectionChange(rowSelectionModel, details);
284
- }
285
- if (controlledRowsSelectedId)
286
- return;
287
- setRowsSelectedId(rowSelectionModel);
288
- },
289
- slots: {
290
- booleanCellFalseIcon: () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.Circle, { color: "error", sx: { fontSize: "10pt" } }),
291
- booleanCellTrueIcon: () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.Circle, { color: "success", sx: { fontSize: "10pt" } }),
292
- noRowsOverlay: () => !isLoading && !!error ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DataTableError, { errorMessage: error }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DataTableEmptyData, {}),
293
- ...slots
294
- },
295
- slotProps: {
296
- loadingOverlay: {
297
- variant: "skeleton",
298
- noRowsVariant: "skeleton"
299
- }
300
- },
301
- disableColumnFilter: true,
302
- localeText: _locales.ptBR.components.MuiDataGrid.defaultProps.localeText,
303
- sx: {
304
- border: "none",
305
- borderRadius: 0,
306
- "--DataGrid-rowBorderColor": "#edf2f9",
307
- "--DataGrid-containerBackground": "#f4f6fa",
308
- ".MuiDataGrid-overlayWrapperInner": {
309
- display: "flex",
310
- alignItems: "center",
311
- justifyContent: "center"
312
- },
313
- ".MuiDataGrid-row": {
314
- backgroundColor: "white",
315
- "&:nth-of-type(even)": {
316
- backgroundColor: "#f9fafd"
317
- },
318
- ":hover": {
319
- backgroundColor: "#e9e9e9"
320
- },
321
- "&.Mui-selected": {
322
- backgroundColor: "rgb(238, 249, 252)",
323
- "&:hover": {
324
- backgroundColor: "rgb(222, 243, 249)"
301
+ height: "100%",
302
+ minHeight: "500px",
303
+ position: "relative",
304
+ ...stackProps,
305
+ children: [
306
+ !isLoading && isFetching && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
307
+ _material.LinearProgress,
308
+ {
309
+ sx: {
310
+ position: "absolute",
311
+ top: 0,
312
+ right: 0,
313
+ left: 0,
314
+ zIndex: 999,
315
+ height: "3px"
325
316
  }
326
317
  }
327
- },
328
- ".MuiDataGrid-cell": {
329
- fontSize: "12px",
330
- color: "#0b0e14"
331
- },
332
- ".MuiDataGrid-columnHeaders": {
333
- border: "solid 1px #edf2f9"
334
- },
335
- ".MuiDataGrid-columnHeaderTitle": {
336
- fontSize: "12px",
337
- color: "#0b0e14",
338
- fontWeight: "600"
339
- },
340
- "& .sticky-cell": {
341
- position: "sticky",
342
- right: 0,
343
- background: "inherit",
344
- zIndex: 1
345
- },
346
- "& .sticky-header": {
347
- position: "sticky",
348
- right: 0,
349
- background: "inherit",
350
- zIndex: 2
351
- }
352
- },
353
- ...rest
318
+ ),
319
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
320
+ _xdatagridpro.DataGridPro,
321
+ {
322
+ apiRef,
323
+ rows: data,
324
+ columns,
325
+ onColumnOrderChange: _onColumnOrderChange,
326
+ onColumnWidthChange: _onColumnWidthChange,
327
+ onColumnVisibilityModelChange: _onColumnVisibilityModelChange,
328
+ density: "compact",
329
+ hideFooterPagination: true,
330
+ hideFooter: true,
331
+ loading: isLoading,
332
+ rowHeight: 43,
333
+ columnHeaderHeight: 43,
334
+ disableVirtualization: true,
335
+ disableRowSelectionOnClick: true,
336
+ rowSelectionModel: rowsSelectedId,
337
+ onRowSelectionModelChange: (rowSelectionModel, details) => {
338
+ if (onRowSelectionChange) {
339
+ onRowSelectionChange(rowSelectionModel, details);
340
+ }
341
+ if (controlledRowsSelectedId)
342
+ return;
343
+ setRowsSelectedId(rowSelectionModel);
344
+ },
345
+ slots: {
346
+ booleanCellFalseIcon: () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.Circle, { color: "error", sx: { fontSize: "10pt" } }),
347
+ booleanCellTrueIcon: () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.Circle, { color: "success", sx: { fontSize: "10pt" } }),
348
+ noRowsOverlay: () => !isLoading && !!error ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DataTableError, { errorMessage: error }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DataTableEmptyData, {}),
349
+ ...slots
350
+ },
351
+ slotProps: {
352
+ loadingOverlay: {
353
+ variant: "skeleton",
354
+ noRowsVariant: "skeleton"
355
+ }
356
+ },
357
+ disableColumnFilter: true,
358
+ localeText: _locales.ptBR.components.MuiDataGrid.defaultProps.localeText,
359
+ sx: {
360
+ border: "none",
361
+ borderRadius: 0,
362
+ "--DataGrid-rowBorderColor": "#edf2f9",
363
+ "--DataGrid-containerBackground": "#f4f6fa",
364
+ ".MuiDataGrid-overlayWrapperInner": {
365
+ display: "flex",
366
+ alignItems: "center",
367
+ justifyContent: "center"
368
+ },
369
+ ".MuiDataGrid-row": {
370
+ backgroundColor: "white",
371
+ "&:nth-of-type(even)": {
372
+ backgroundColor: "#f9fafd"
373
+ },
374
+ ":hover": {
375
+ backgroundColor: "#e9e9e9"
376
+ },
377
+ "&.Mui-selected": {
378
+ backgroundColor: "rgb(238, 249, 252)",
379
+ "&:hover": {
380
+ backgroundColor: "rgb(222, 243, 249)"
381
+ }
382
+ }
383
+ },
384
+ ".MuiDataGrid-cell": {
385
+ fontSize: "12px",
386
+ color: "#0b0e14"
387
+ },
388
+ ".MuiDataGrid-columnHeaders": {
389
+ border: "solid 1px #edf2f9",
390
+ backgroundColor: "#f4f6fa"
391
+ },
392
+ ".MuiDataGrid-columnHeader": {
393
+ backgroundColor: "#f4f6fa"
394
+ },
395
+ ".MuiDataGrid-columnHeaders .MuiDataGrid-filler": {
396
+ backgroundColor: "#f4f6fa"
397
+ },
398
+ ".MuiDataGrid-columnHeaderTitle": {
399
+ fontSize: "12px",
400
+ color: "#0b0e14",
401
+ fontWeight: "600"
402
+ },
403
+ "& .sticky-cell": {
404
+ position: "sticky",
405
+ right: 0,
406
+ background: "inherit",
407
+ zIndex: 1
408
+ },
409
+ "& .sticky-header": {
410
+ position: "sticky",
411
+ right: 0,
412
+ backgroundColor: "#f4f6fa",
413
+ zIndex: 2
414
+ }
415
+ },
416
+ ...rest
417
+ }
418
+ )
419
+ ]
354
420
  }
355
- )
356
- ] });
357
- }
421
+ );
422
+ }
423
+ );
424
+ var DataTable_default = _DataTable;
358
425
 
359
426
  // src/DataTable/DataTableAction.tsx
360
427
 
@@ -376,132 +443,7 @@ function DataTableAction(props) {
376
443
 
377
444
 
378
445
 
379
-
380
- // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
381
-
382
-
383
- // ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
384
- var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
385
- var toCamelCase = (string) => string.replace(
386
- /^([A-Z])|[\s-_]+(\w)/g,
387
- (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
388
- );
389
- var toPascalCase = (string) => {
390
- const camelCase = toCamelCase(string);
391
- return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
392
- };
393
- var mergeClasses = (...classes) => classes.filter((className, index, array) => {
394
- return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
395
- }).join(" ").trim();
396
- var hasA11yProp = (props) => {
397
- for (const prop in props) {
398
- if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
399
- return true;
400
- }
401
- }
402
- };
403
-
404
- // ../../node_modules/lucide-react/dist/esm/Icon.js
405
-
406
-
407
- // ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
408
- var defaultAttributes = {
409
- xmlns: "http://www.w3.org/2000/svg",
410
- width: 24,
411
- height: 24,
412
- viewBox: "0 0 24 24",
413
- fill: "none",
414
- stroke: "currentColor",
415
- strokeWidth: 2,
416
- strokeLinecap: "round",
417
- strokeLinejoin: "round"
418
- };
419
-
420
- // ../../node_modules/lucide-react/dist/esm/Icon.js
421
- var Icon = _react.forwardRef.call(void 0,
422
- ({
423
- color = "currentColor",
424
- size = 24,
425
- strokeWidth = 2,
426
- absoluteStrokeWidth,
427
- className = "",
428
- children,
429
- iconNode,
430
- ...rest
431
- }, ref) => _react.createElement.call(void 0,
432
- "svg",
433
- {
434
- ref,
435
- ...defaultAttributes,
436
- width: size,
437
- height: size,
438
- stroke: color,
439
- strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
440
- className: mergeClasses("lucide", className),
441
- ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
442
- ...rest
443
- },
444
- [
445
- ...iconNode.map(([tag, attrs]) => _react.createElement.call(void 0, tag, attrs)),
446
- ...Array.isArray(children) ? children : [children]
447
- ]
448
- )
449
- );
450
-
451
- // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
452
- var createLucideIcon = (iconName, iconNode) => {
453
- const Component = _react.forwardRef.call(void 0,
454
- ({ className, ...props }, ref) => _react.createElement.call(void 0, Icon, {
455
- ref,
456
- iconNode,
457
- className: mergeClasses(
458
- `lucide-${toKebabCase(toPascalCase(iconName))}`,
459
- `lucide-${iconName}`,
460
- className
461
- ),
462
- ...props
463
- })
464
- );
465
- Component.displayName = toPascalCase(iconName);
466
- return Component;
467
- };
468
-
469
- // ../../node_modules/lucide-react/dist/esm/icons/arrow-big-down.js
470
- var __iconNode = [
471
- [
472
- "path",
473
- {
474
- d: "M15 11a1 1 0 0 0 1 1h2.939a1 1 0 0 1 .75 1.811l-6.835 6.836a1.207 1.207 0 0 1-1.707 0L4.31 13.81a1 1 0 0 1 .75-1.811H8a1 1 0 0 0 1-1V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1z",
475
- key: "1eaqc3"
476
- }
477
- ]
478
- ];
479
- var ArrowBigDown = createLucideIcon("arrow-big-down", __iconNode);
480
-
481
- // ../../node_modules/lucide-react/dist/esm/icons/pencil.js
482
- var __iconNode2 = [
483
- [
484
- "path",
485
- {
486
- d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
487
- key: "1a8usu"
488
- }
489
- ],
490
- ["path", { d: "m15 5 4 4", key: "1mk7zo" }]
491
- ];
492
- var Pencil = createLucideIcon("pencil", __iconNode2);
493
-
494
- // ../../node_modules/lucide-react/dist/esm/icons/trash-2.js
495
- var __iconNode3 = [
496
- ["path", { d: "M10 11v6", key: "nco0om" }],
497
- ["path", { d: "M14 11v6", key: "outv1u" }],
498
- ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
499
- ["path", { d: "M3 6h18", key: "d0wm0j" }],
500
- ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
501
- ];
502
- var Trash2 = createLucideIcon("trash-2", __iconNode3);
503
-
504
- // src/DataTable/DataTableActionDelete.tsx
446
+ var _lucidereact = require('lucide-react');
505
447
 
506
448
  function DataTableActionDelete(props) {
507
449
  const { ref, ...rest } = props;
@@ -510,7 +452,7 @@ function DataTableActionDelete(props) {
510
452
  {
511
453
  color: "error",
512
454
  label: "Deletar",
513
- icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Trash2, { size: 16 }),
455
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Trash2, { size: 16 }),
514
456
  ...rest,
515
457
  ref
516
458
  }
@@ -522,6 +464,7 @@ function DataTableActionDelete(props) {
522
464
 
523
465
 
524
466
 
467
+
525
468
  function DataTableActionEdit(props) {
526
469
  const { ref, ...rest } = props;
527
470
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -529,7 +472,7 @@ function DataTableActionEdit(props) {
529
472
  {
530
473
  label: "Editar",
531
474
  color: "primary",
532
- icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Pencil, { size: 16 }),
475
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Pencil, { size: 16 }),
533
476
  ...rest,
534
477
  ref
535
478
  }
@@ -566,6 +509,7 @@ function Actions({ children, breakpoints }) {
566
509
 
567
510
 
568
511
 
512
+
569
513
  function DataTableActionTransport(props) {
570
514
  const { ref, ...rest } = props;
571
515
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -573,13 +517,25 @@ function DataTableActionTransport(props) {
573
517
  {
574
518
  color: "primary",
575
519
  label: "Transportar",
576
- icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ArrowBigDown, { size: 16 }),
520
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArrowBigDown, { size: 16 }),
577
521
  ...rest,
578
522
  ref
579
523
  }
580
524
  );
581
525
  }
582
526
 
527
+ // src/DataTable/DataTableAddPanelTrigger.tsx
528
+
529
+
530
+
531
+
532
+ function DataTableAddPanelTrigger({
533
+ onClick
534
+ }) {
535
+ const theme = _material.useTheme.call(void 0, );
536
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xdatagridpro.ToolbarButton, { onClick, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.SquarePlus, { color: theme.palette.primary.main, size: 18 }) });
537
+ }
538
+
583
539
  // src/DataTable/DataTableButton.tsx
584
540
 
585
541
 
@@ -762,6 +718,16 @@ function CellActionTransport({
762
718
  );
763
719
  }
764
720
 
721
+ // src/DataTable/DataTableColumnsPanelTrigger.tsx
722
+
723
+
724
+
725
+
726
+ function DataTableColumnsPanelTrigger() {
727
+ const theme = _material.useTheme.call(void 0, );
728
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xdatagridpro.ColumnsPanelTrigger, { render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _xdatagridpro.ToolbarButton, {}), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Columns3Cog, { color: theme.palette.primary.main, size: 18 }) });
729
+ }
730
+
765
731
  // src/DataTable/DataTableContent.tsx
766
732
 
767
733
 
@@ -786,11 +752,11 @@ function Content(props) {
786
752
 
787
753
 
788
754
 
789
- var getFilteredRows2 = ({ apiRef }) => _xdatagridpro.gridFilteredSortedRowIdsSelector.call(void 0, apiRef);
755
+ var getFilteredRows = ({ apiRef }) => _xdatagridpro.gridFilteredSortedRowIdsSelector.call(void 0, apiRef);
790
756
  function ExportCsvButton() {
791
757
  const { apiRef } = useTableRootContext();
792
758
  const handleExport = (options) => {
793
- if (_optionalChain([apiRef, 'optionalAccess', _5 => _5.current])) {
759
+ if (_optionalChain([apiRef, 'optionalAccess', _10 => _10.current])) {
794
760
  apiRef.current.exportDataAsCsv(options);
795
761
  }
796
762
  };
@@ -798,7 +764,7 @@ function ExportCsvButton() {
798
764
  DataTableButton,
799
765
  {
800
766
  startIcon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.FileDownload, {}),
801
- onClick: () => handleExport({ getRowsToExport: getFilteredRows2 }),
767
+ onClick: () => handleExport({ getRowsToExport: getFilteredRows }),
802
768
  children: "Exportar CSV"
803
769
  }
804
770
  );
@@ -849,7 +815,7 @@ function Pagination(props) {
849
815
  } = props;
850
816
  const { page, pageSize = 15, totalRecords } = pagination || {};
851
817
  const pages = _react.useMemo.call(void 0, () => {
852
- if (_optionalChain([pagination, 'optionalAccess', _6 => _6.lastPage]))
818
+ if (_optionalChain([pagination, 'optionalAccess', _11 => _11.lastPage]))
853
819
  return pagination.lastPage;
854
820
  if ((totalRecords || 0) < pageSize)
855
821
  return 1;
@@ -981,7 +947,7 @@ function Root({ children, height, ...rest }) {
981
947
  function SelectionCounter(props) {
982
948
  const { countTitle, gender } = props;
983
949
  const { rowsSelectedId } = useTableRootContext();
984
- const countQuantidade = _optionalChain([rowsSelectedId, 'optionalAccess', _7 => _7.ids, 'access', _8 => _8.size]) || 0;
950
+ const countQuantidade = _optionalChain([rowsSelectedId, 'optionalAccess', _12 => _12.ids, 'access', _13 => _13.size]) || 0;
985
951
  const flexSufixCountTitle = _react.useMemo.call(void 0, () => {
986
952
  if (!countTitle)
987
953
  return "";
@@ -1033,24 +999,39 @@ function Title({
1033
999
  // src/DataTable/DataTableToolbar.tsx
1034
1000
 
1035
1001
 
1002
+
1036
1003
  function Toolbar({ children }) {
1037
1004
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1038
- _material.Stack,
1005
+ _xdatagridpro.Toolbar,
1039
1006
  {
1040
- component: _material.Paper,
1041
- elevation: 0,
1042
- gap: 1.5,
1043
- flexDirection: "row",
1044
- justifyContent: "space-between",
1045
- alignItems: "center",
1046
- p: 1,
1047
- borderRadius: "8px 8px 0 0",
1048
- sx: { width: "100%" },
1049
- children
1007
+ render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1008
+ _material.Stack,
1009
+ {
1010
+ component: _material.Paper,
1011
+ elevation: 0,
1012
+ gap: 1.5,
1013
+ flexDirection: "row",
1014
+ justifyContent: "space-between",
1015
+ alignItems: "center",
1016
+ p: 1,
1017
+ borderRadius: "8px 8px 0 0",
1018
+ sx: { width: "100%" },
1019
+ children
1020
+ }
1021
+ )
1050
1022
  }
1051
1023
  );
1052
1024
  }
1053
1025
 
1026
+ // src/DataTable/DataTableToolbarActionsContainer.tsx
1027
+
1028
+
1029
+ function ToolbarActionsContainer({
1030
+ children
1031
+ }) {
1032
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Stack, { direction: "row", alignItems: "center", justifyContent: "flex-end", children });
1033
+ }
1034
+
1054
1035
  // src/DataTable/index.ts
1055
1036
  var DataTable = {
1056
1037
  CellActionTransport,
@@ -1063,87 +1044,23 @@ var DataTable = {
1063
1044
  Pagination,
1064
1045
  Actions,
1065
1046
  Toolbar,
1047
+ ToolbarActionsContainer,
1066
1048
  Content,
1067
1049
  Button: DataTableButton,
1068
1050
  Footer,
1069
- Table,
1051
+ Table: DataTable_default,
1070
1052
  Title,
1071
1053
  Root,
1072
1054
  Action: DataTableAction,
1073
1055
  ActionEdit: DataTableActionEdit,
1074
1056
  ActionDelete: DataTableActionDelete,
1075
1057
  ActionTransport: DataTableActionTransport,
1076
- ColumnsPanelTrigger: _xdatagridpro.ColumnsPanelTrigger,
1058
+ ColumnsPanelTrigger: DataTableColumnsPanelTrigger,
1059
+ AddPanelTrigger: DataTableAddPanelTrigger,
1077
1060
  useGridApiRef: _xdatagridpro.useGridApiRef
1078
1061
  };
1079
- var DataTable_default = DataTable;
1080
-
1081
-
1082
- exports.DataTable = DataTable_default;
1083
- /*! Bundled license information:
1084
-
1085
- lucide-react/dist/esm/shared/src/utils.js:
1086
- (**
1087
- * @license lucide-react v0.536.0 - ISC
1088
- *
1089
- * This source code is licensed under the ISC license.
1090
- * See the LICENSE file in the root directory of this source tree.
1091
- *)
1092
-
1093
- lucide-react/dist/esm/defaultAttributes.js:
1094
- (**
1095
- * @license lucide-react v0.536.0 - ISC
1096
- *
1097
- * This source code is licensed under the ISC license.
1098
- * See the LICENSE file in the root directory of this source tree.
1099
- *)
1100
-
1101
- lucide-react/dist/esm/Icon.js:
1102
- (**
1103
- * @license lucide-react v0.536.0 - ISC
1104
- *
1105
- * This source code is licensed under the ISC license.
1106
- * See the LICENSE file in the root directory of this source tree.
1107
- *)
1108
-
1109
- lucide-react/dist/esm/createLucideIcon.js:
1110
- (**
1111
- * @license lucide-react v0.536.0 - ISC
1112
- *
1113
- * This source code is licensed under the ISC license.
1114
- * See the LICENSE file in the root directory of this source tree.
1115
- *)
1116
-
1117
- lucide-react/dist/esm/icons/arrow-big-down.js:
1118
- (**
1119
- * @license lucide-react v0.536.0 - ISC
1120
- *
1121
- * This source code is licensed under the ISC license.
1122
- * See the LICENSE file in the root directory of this source tree.
1123
- *)
1124
-
1125
- lucide-react/dist/esm/icons/pencil.js:
1126
- (**
1127
- * @license lucide-react v0.536.0 - ISC
1128
- *
1129
- * This source code is licensed under the ISC license.
1130
- * See the LICENSE file in the root directory of this source tree.
1131
- *)
1132
-
1133
- lucide-react/dist/esm/icons/trash-2.js:
1134
- (**
1135
- * @license lucide-react v0.536.0 - ISC
1136
- *
1137
- * This source code is licensed under the ISC license.
1138
- * See the LICENSE file in the root directory of this source tree.
1139
- *)
1140
-
1141
- lucide-react/dist/esm/lucide-react.js:
1142
- (**
1143
- * @license lucide-react v0.536.0 - ISC
1144
- *
1145
- * This source code is licensed under the ISC license.
1146
- * See the LICENSE file in the root directory of this source tree.
1147
- *)
1148
- */
1062
+ var DataTable_default2 = DataTable;
1063
+
1064
+
1065
+ exports.DataTable = DataTable_default2;
1149
1066
  //# sourceMappingURL=index.js.map