@data-c/pro 0.2.55 → 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,216 +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
+ })]);
211
+ }
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);
190
225
  }
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
- };
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);
262
287
  }
263
- ),
264
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
265
- _xdatagridpro.DataGridPro,
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);
296
+ }
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
- backgroundColor: "#f4f6fa"
335
- },
336
- ".MuiDataGrid-columnHeader": {
337
- backgroundColor: "#f4f6fa"
338
- },
339
- ".MuiDataGrid-columnHeaders .MuiDataGrid-filler": {
340
- backgroundColor: "#f4f6fa"
341
- },
342
- ".MuiDataGrid-columnHeaderTitle": {
343
- fontSize: "12px",
344
- color: "#0b0e14",
345
- fontWeight: "600"
346
- },
347
- "& .sticky-cell": {
348
- position: "sticky",
349
- right: 0,
350
- background: "inherit",
351
- zIndex: 1
352
- },
353
- "& .sticky-header": {
354
- position: "sticky",
355
- right: 0,
356
- backgroundColor: "#f4f6fa",
357
- zIndex: 2
358
- }
359
- },
360
- ...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
+ ]
361
420
  }
362
- )
363
- ] });
364
- }
421
+ );
422
+ }
423
+ );
424
+ var DataTable_default = _DataTable;
365
425
 
366
426
  // src/DataTable/DataTableAction.tsx
367
427
 
@@ -383,132 +443,7 @@ function DataTableAction(props) {
383
443
 
384
444
 
385
445
 
386
-
387
- // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
388
-
389
-
390
- // ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
391
- var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
392
- var toCamelCase = (string) => string.replace(
393
- /^([A-Z])|[\s-_]+(\w)/g,
394
- (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
395
- );
396
- var toPascalCase = (string) => {
397
- const camelCase = toCamelCase(string);
398
- return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
399
- };
400
- var mergeClasses = (...classes) => classes.filter((className, index, array) => {
401
- return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
402
- }).join(" ").trim();
403
- var hasA11yProp = (props) => {
404
- for (const prop in props) {
405
- if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
406
- return true;
407
- }
408
- }
409
- };
410
-
411
- // ../../node_modules/lucide-react/dist/esm/Icon.js
412
-
413
-
414
- // ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
415
- var defaultAttributes = {
416
- xmlns: "http://www.w3.org/2000/svg",
417
- width: 24,
418
- height: 24,
419
- viewBox: "0 0 24 24",
420
- fill: "none",
421
- stroke: "currentColor",
422
- strokeWidth: 2,
423
- strokeLinecap: "round",
424
- strokeLinejoin: "round"
425
- };
426
-
427
- // ../../node_modules/lucide-react/dist/esm/Icon.js
428
- var Icon = _react.forwardRef.call(void 0,
429
- ({
430
- color = "currentColor",
431
- size = 24,
432
- strokeWidth = 2,
433
- absoluteStrokeWidth,
434
- className = "",
435
- children,
436
- iconNode,
437
- ...rest
438
- }, ref) => _react.createElement.call(void 0,
439
- "svg",
440
- {
441
- ref,
442
- ...defaultAttributes,
443
- width: size,
444
- height: size,
445
- stroke: color,
446
- strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
447
- className: mergeClasses("lucide", className),
448
- ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
449
- ...rest
450
- },
451
- [
452
- ...iconNode.map(([tag, attrs]) => _react.createElement.call(void 0, tag, attrs)),
453
- ...Array.isArray(children) ? children : [children]
454
- ]
455
- )
456
- );
457
-
458
- // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
459
- var createLucideIcon = (iconName, iconNode) => {
460
- const Component = _react.forwardRef.call(void 0,
461
- ({ className, ...props }, ref) => _react.createElement.call(void 0, Icon, {
462
- ref,
463
- iconNode,
464
- className: mergeClasses(
465
- `lucide-${toKebabCase(toPascalCase(iconName))}`,
466
- `lucide-${iconName}`,
467
- className
468
- ),
469
- ...props
470
- })
471
- );
472
- Component.displayName = toPascalCase(iconName);
473
- return Component;
474
- };
475
-
476
- // ../../node_modules/lucide-react/dist/esm/icons/arrow-big-down.js
477
- var __iconNode = [
478
- [
479
- "path",
480
- {
481
- 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",
482
- key: "1eaqc3"
483
- }
484
- ]
485
- ];
486
- var ArrowBigDown = createLucideIcon("arrow-big-down", __iconNode);
487
-
488
- // ../../node_modules/lucide-react/dist/esm/icons/pencil.js
489
- var __iconNode2 = [
490
- [
491
- "path",
492
- {
493
- 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",
494
- key: "1a8usu"
495
- }
496
- ],
497
- ["path", { d: "m15 5 4 4", key: "1mk7zo" }]
498
- ];
499
- var Pencil = createLucideIcon("pencil", __iconNode2);
500
-
501
- // ../../node_modules/lucide-react/dist/esm/icons/trash-2.js
502
- var __iconNode3 = [
503
- ["path", { d: "M10 11v6", key: "nco0om" }],
504
- ["path", { d: "M14 11v6", key: "outv1u" }],
505
- ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
506
- ["path", { d: "M3 6h18", key: "d0wm0j" }],
507
- ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
508
- ];
509
- var Trash2 = createLucideIcon("trash-2", __iconNode3);
510
-
511
- // src/DataTable/DataTableActionDelete.tsx
446
+ var _lucidereact = require('lucide-react');
512
447
 
513
448
  function DataTableActionDelete(props) {
514
449
  const { ref, ...rest } = props;
@@ -517,7 +452,7 @@ function DataTableActionDelete(props) {
517
452
  {
518
453
  color: "error",
519
454
  label: "Deletar",
520
- icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Trash2, { size: 16 }),
455
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Trash2, { size: 16 }),
521
456
  ...rest,
522
457
  ref
523
458
  }
@@ -529,6 +464,7 @@ function DataTableActionDelete(props) {
529
464
 
530
465
 
531
466
 
467
+
532
468
  function DataTableActionEdit(props) {
533
469
  const { ref, ...rest } = props;
534
470
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -536,7 +472,7 @@ function DataTableActionEdit(props) {
536
472
  {
537
473
  label: "Editar",
538
474
  color: "primary",
539
- icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Pencil, { size: 16 }),
475
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Pencil, { size: 16 }),
540
476
  ...rest,
541
477
  ref
542
478
  }
@@ -573,6 +509,7 @@ function Actions({ children, breakpoints }) {
573
509
 
574
510
 
575
511
 
512
+
576
513
  function DataTableActionTransport(props) {
577
514
  const { ref, ...rest } = props;
578
515
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -580,13 +517,25 @@ function DataTableActionTransport(props) {
580
517
  {
581
518
  color: "primary",
582
519
  label: "Transportar",
583
- icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ArrowBigDown, { size: 16 }),
520
+ icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArrowBigDown, { size: 16 }),
584
521
  ...rest,
585
522
  ref
586
523
  }
587
524
  );
588
525
  }
589
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
+
590
539
  // src/DataTable/DataTableButton.tsx
591
540
 
592
541
 
@@ -769,6 +718,16 @@ function CellActionTransport({
769
718
  );
770
719
  }
771
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
+
772
731
  // src/DataTable/DataTableContent.tsx
773
732
 
774
733
 
@@ -793,11 +752,11 @@ function Content(props) {
793
752
 
794
753
 
795
754
 
796
- var getFilteredRows2 = ({ apiRef }) => _xdatagridpro.gridFilteredSortedRowIdsSelector.call(void 0, apiRef);
755
+ var getFilteredRows = ({ apiRef }) => _xdatagridpro.gridFilteredSortedRowIdsSelector.call(void 0, apiRef);
797
756
  function ExportCsvButton() {
798
757
  const { apiRef } = useTableRootContext();
799
758
  const handleExport = (options) => {
800
- if (_optionalChain([apiRef, 'optionalAccess', _5 => _5.current])) {
759
+ if (_optionalChain([apiRef, 'optionalAccess', _10 => _10.current])) {
801
760
  apiRef.current.exportDataAsCsv(options);
802
761
  }
803
762
  };
@@ -805,7 +764,7 @@ function ExportCsvButton() {
805
764
  DataTableButton,
806
765
  {
807
766
  startIcon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.FileDownload, {}),
808
- onClick: () => handleExport({ getRowsToExport: getFilteredRows2 }),
767
+ onClick: () => handleExport({ getRowsToExport: getFilteredRows }),
809
768
  children: "Exportar CSV"
810
769
  }
811
770
  );
@@ -856,7 +815,7 @@ function Pagination(props) {
856
815
  } = props;
857
816
  const { page, pageSize = 15, totalRecords } = pagination || {};
858
817
  const pages = _react.useMemo.call(void 0, () => {
859
- if (_optionalChain([pagination, 'optionalAccess', _6 => _6.lastPage]))
818
+ if (_optionalChain([pagination, 'optionalAccess', _11 => _11.lastPage]))
860
819
  return pagination.lastPage;
861
820
  if ((totalRecords || 0) < pageSize)
862
821
  return 1;
@@ -988,7 +947,7 @@ function Root({ children, height, ...rest }) {
988
947
  function SelectionCounter(props) {
989
948
  const { countTitle, gender } = props;
990
949
  const { rowsSelectedId } = useTableRootContext();
991
- 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;
992
951
  const flexSufixCountTitle = _react.useMemo.call(void 0, () => {
993
952
  if (!countTitle)
994
953
  return "";
@@ -1040,24 +999,39 @@ function Title({
1040
999
  // src/DataTable/DataTableToolbar.tsx
1041
1000
 
1042
1001
 
1002
+
1043
1003
  function Toolbar({ children }) {
1044
1004
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1045
- _material.Stack,
1005
+ _xdatagridpro.Toolbar,
1046
1006
  {
1047
- component: _material.Paper,
1048
- elevation: 0,
1049
- gap: 1.5,
1050
- flexDirection: "row",
1051
- justifyContent: "space-between",
1052
- alignItems: "center",
1053
- p: 1,
1054
- borderRadius: "8px 8px 0 0",
1055
- sx: { width: "100%" },
1056
- 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
+ )
1057
1022
  }
1058
1023
  );
1059
1024
  }
1060
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
+
1061
1035
  // src/DataTable/index.ts
1062
1036
  var DataTable = {
1063
1037
  CellActionTransport,
@@ -1070,87 +1044,23 @@ var DataTable = {
1070
1044
  Pagination,
1071
1045
  Actions,
1072
1046
  Toolbar,
1047
+ ToolbarActionsContainer,
1073
1048
  Content,
1074
1049
  Button: DataTableButton,
1075
1050
  Footer,
1076
- Table,
1051
+ Table: DataTable_default,
1077
1052
  Title,
1078
1053
  Root,
1079
1054
  Action: DataTableAction,
1080
1055
  ActionEdit: DataTableActionEdit,
1081
1056
  ActionDelete: DataTableActionDelete,
1082
1057
  ActionTransport: DataTableActionTransport,
1083
- ColumnsPanelTrigger: _xdatagridpro.ColumnsPanelTrigger,
1058
+ ColumnsPanelTrigger: DataTableColumnsPanelTrigger,
1059
+ AddPanelTrigger: DataTableAddPanelTrigger,
1084
1060
  useGridApiRef: _xdatagridpro.useGridApiRef
1085
1061
  };
1086
- var DataTable_default = DataTable;
1087
-
1088
-
1089
- exports.DataTable = DataTable_default;
1090
- /*! Bundled license information:
1091
-
1092
- lucide-react/dist/esm/shared/src/utils.js:
1093
- (**
1094
- * @license lucide-react v0.536.0 - ISC
1095
- *
1096
- * This source code is licensed under the ISC license.
1097
- * See the LICENSE file in the root directory of this source tree.
1098
- *)
1099
-
1100
- lucide-react/dist/esm/defaultAttributes.js:
1101
- (**
1102
- * @license lucide-react v0.536.0 - ISC
1103
- *
1104
- * This source code is licensed under the ISC license.
1105
- * See the LICENSE file in the root directory of this source tree.
1106
- *)
1107
-
1108
- lucide-react/dist/esm/Icon.js:
1109
- (**
1110
- * @license lucide-react v0.536.0 - ISC
1111
- *
1112
- * This source code is licensed under the ISC license.
1113
- * See the LICENSE file in the root directory of this source tree.
1114
- *)
1115
-
1116
- lucide-react/dist/esm/createLucideIcon.js:
1117
- (**
1118
- * @license lucide-react v0.536.0 - ISC
1119
- *
1120
- * This source code is licensed under the ISC license.
1121
- * See the LICENSE file in the root directory of this source tree.
1122
- *)
1123
-
1124
- lucide-react/dist/esm/icons/arrow-big-down.js:
1125
- (**
1126
- * @license lucide-react v0.536.0 - ISC
1127
- *
1128
- * This source code is licensed under the ISC license.
1129
- * See the LICENSE file in the root directory of this source tree.
1130
- *)
1131
-
1132
- lucide-react/dist/esm/icons/pencil.js:
1133
- (**
1134
- * @license lucide-react v0.536.0 - ISC
1135
- *
1136
- * This source code is licensed under the ISC license.
1137
- * See the LICENSE file in the root directory of this source tree.
1138
- *)
1139
-
1140
- lucide-react/dist/esm/icons/trash-2.js:
1141
- (**
1142
- * @license lucide-react v0.536.0 - ISC
1143
- *
1144
- * This source code is licensed under the ISC license.
1145
- * See the LICENSE file in the root directory of this source tree.
1146
- *)
1147
-
1148
- lucide-react/dist/esm/lucide-react.js:
1149
- (**
1150
- * @license lucide-react v0.536.0 - ISC
1151
- *
1152
- * This source code is licensed under the ISC license.
1153
- * See the LICENSE file in the root directory of this source tree.
1154
- *)
1155
- */
1062
+ var DataTable_default2 = DataTable;
1063
+
1064
+
1065
+ exports.DataTable = DataTable_default2;
1156
1066
  //# sourceMappingURL=index.js.map