@charlesgomes/leafcode-shared-lib-react 1.0.30 → 1.0.32

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.css CHANGED
@@ -108,7 +108,7 @@ th {
108
108
  border-top: 1px solid #edf0f2;
109
109
  border-bottom: 1px solid #edf0f2;
110
110
  border-left: 1px solid #edf0f2;
111
- padding: 0 14px;
111
+ padding: 0 0 0 7px;
112
112
  font-size: 14px;
113
113
  font-family: "Roboto", sans-serif;
114
114
  font-weight: bold;
@@ -117,7 +117,7 @@ th {
117
117
  td {
118
118
  border-bottom: 1px solid #edf0f2;
119
119
  border-left: 1px solid #edf0f2;
120
- padding: 5px 1rem;
120
+ padding: 1.5px 7px;
121
121
  }
122
122
  .p-datatable .p-datatable-header {
123
123
  background: transparent;
@@ -134,9 +134,6 @@ td {
134
134
  -moz-appearance: none;
135
135
  background: #fff url("./seta-E7LTVAWJ.svg") no-repeat right 6px center;
136
136
  }
137
- .react-tooltip {
138
- z-index: 99 !important;
139
- }
140
137
  .p-paginator-left-content {
141
138
  flex: 1;
142
139
  }
@@ -178,6 +175,30 @@ th {
178
175
  background: #094394;
179
176
  color: #ffffff;
180
177
  }
178
+ .p-datatable .p-datatable-tbody > tr > td.p-selection-column {
179
+ text-align: center !important;
180
+ display: table-cell;
181
+ vertical-align: middle;
182
+ position: relative;
183
+ }
184
+ .p-datatable .p-datatable-tbody > tr > td.p-selection-column .p-checkbox {
185
+ position: relative;
186
+ left: -2px;
187
+ }
188
+ .p-datatable .p-datatable-thead > tr > th.p-selection-column .p-checkbox-input {
189
+ text-align: center !important;
190
+ position: relative;
191
+ left: -1rem;
192
+ }
193
+ .p-selection-column .p-checkbox {
194
+ display: inline-flex;
195
+ vertical-align: middle;
196
+ justify-content: center;
197
+ align-items: center;
198
+ }
199
+ .p-column-header-content .p-checkbox {
200
+ position: static;
201
+ }
181
202
  .p-datatable .p-datatable-tbody > tr.p-highlight {
182
203
  background: #fafbfc;
183
204
  }
@@ -295,6 +316,7 @@ th {
295
316
  }
296
317
  .p-column-title {
297
318
  flex: 1;
319
+ text-align: left;
298
320
  }
299
321
  .p-column-filter-add-button {
300
322
  font-family: "Roboto", sans-serif;
@@ -400,14 +422,9 @@ th {
400
422
  opacity: 1;
401
423
  }
402
424
  .box-icones-actions-column {
403
- position: fixed;
404
- z-index: 2;
405
- padding: 0.125rem;
406
425
  width: fit-content;
407
426
  height: fit-content;
408
427
  margin: auto;
409
- right: 6px;
410
- transform: translate(-50%, -50%);
411
428
  display: flex;
412
429
  align-items: center;
413
430
  justify-content: center;
@@ -415,6 +432,19 @@ th {
415
432
  gap: 0.25rem;
416
433
  transition: opacity 0.2s ease;
417
434
  }
435
+ .p-datatable .p-datatable-tbody > tr > td:last-child {
436
+ position: sticky !important;
437
+ right: 0;
438
+ z-index: 11;
439
+ border-left: transparent;
440
+ border-right: transparent;
441
+ }
442
+ .p-datatable .p-datatable-tbody > tr > td:nth-last-child(2) {
443
+ border-right: 1px solid #edf0f2 !important;
444
+ }
445
+ .react-tooltip {
446
+ z-index: 99 !important;
447
+ }
418
448
  .box-icones-actions-column:hover {
419
449
  opacity: 1;
420
450
  }
@@ -469,3 +499,8 @@ th {
469
499
  min-width: 100%;
470
500
  }
471
501
  }
502
+ .p-datatable .p-datatable-thead > tr > th:last-child .p-column-title {
503
+ flex: 1;
504
+ text-align: center;
505
+ padding: 0 17px 0 7px;
506
+ }
package/dist/index.d.mts CHANGED
@@ -69,6 +69,7 @@ interface ColumnCustom<T> {
69
69
  dataType?: "boolean" | "string" | "date" | "dateTime" | "numeric";
70
70
  filterGlobal?: boolean;
71
71
  filterElement?: ReactNode;
72
+ showFilterMatchModes?: boolean;
72
73
  filterMatchModeOptions?: {
73
74
  label: string;
74
75
  value: FilterMatchModeType | string;
@@ -96,7 +97,14 @@ declare const DateFilterTemplate: (options: any, mask?: (value: any) => string |
96
97
  declare const DateTimeFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
97
98
  declare const ValueFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
98
99
  declare const SelectFilterTemplate: (options: any, isLanguagePtBr?: boolean, items?: IItemProps[]) => react_jsx_runtime.JSX.Element;
100
+ declare const CustomFilterElement: (options: any, isLanguagePtBr?: boolean, items?: any[]) => react_jsx_runtime.JSX.Element;
99
101
 
102
+ declare const customMatchModes: {
103
+ notStartsWith: string;
104
+ notEndsWith: string;
105
+ empty: string;
106
+ notEmpty: string;
107
+ };
100
108
  declare const getDefaultFilterMatchOptionsString: (isLanguagePtBr?: boolean) => {
101
109
  label: string;
102
110
  value: string;
@@ -118,4 +126,4 @@ declare const getDefaultFilterMatchOptionsEnumNotNullable: (isLanguagePtBr: bool
118
126
  value: FilterMatchMode;
119
127
  }[];
120
128
 
121
- export { Button, type ColumnCustom, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, ModalBase, SelectFilterTemplate, ValueFilterTemplate, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsEnum, getDefaultFilterMatchOptionsEnumNotNullable, getDefaultFilterMatchOptionsString, getDefaultFilterMatchOptionsStringArray };
129
+ export { Button, type ColumnCustom, CustomFilterElement, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, ModalBase, SelectFilterTemplate, ValueFilterTemplate, customMatchModes, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsEnum, getDefaultFilterMatchOptionsEnumNotNullable, getDefaultFilterMatchOptionsString, getDefaultFilterMatchOptionsStringArray };
package/dist/index.d.ts CHANGED
@@ -69,6 +69,7 @@ interface ColumnCustom<T> {
69
69
  dataType?: "boolean" | "string" | "date" | "dateTime" | "numeric";
70
70
  filterGlobal?: boolean;
71
71
  filterElement?: ReactNode;
72
+ showFilterMatchModes?: boolean;
72
73
  filterMatchModeOptions?: {
73
74
  label: string;
74
75
  value: FilterMatchModeType | string;
@@ -96,7 +97,14 @@ declare const DateFilterTemplate: (options: any, mask?: (value: any) => string |
96
97
  declare const DateTimeFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
97
98
  declare const ValueFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
98
99
  declare const SelectFilterTemplate: (options: any, isLanguagePtBr?: boolean, items?: IItemProps[]) => react_jsx_runtime.JSX.Element;
100
+ declare const CustomFilterElement: (options: any, isLanguagePtBr?: boolean, items?: any[]) => react_jsx_runtime.JSX.Element;
99
101
 
102
+ declare const customMatchModes: {
103
+ notStartsWith: string;
104
+ notEndsWith: string;
105
+ empty: string;
106
+ notEmpty: string;
107
+ };
100
108
  declare const getDefaultFilterMatchOptionsString: (isLanguagePtBr?: boolean) => {
101
109
  label: string;
102
110
  value: string;
@@ -118,4 +126,4 @@ declare const getDefaultFilterMatchOptionsEnumNotNullable: (isLanguagePtBr: bool
118
126
  value: FilterMatchMode;
119
127
  }[];
120
128
 
121
- export { Button, type ColumnCustom, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, ModalBase, SelectFilterTemplate, ValueFilterTemplate, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsEnum, getDefaultFilterMatchOptionsEnumNotNullable, getDefaultFilterMatchOptionsString, getDefaultFilterMatchOptionsStringArray };
129
+ export { Button, type ColumnCustom, CustomFilterElement, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, ModalBase, SelectFilterTemplate, ValueFilterTemplate, customMatchModes, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsEnum, getDefaultFilterMatchOptionsEnumNotNullable, getDefaultFilterMatchOptionsString, getDefaultFilterMatchOptionsStringArray };
package/dist/index.js CHANGED
@@ -31,14 +31,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
33
  Button: () => Button,
34
+ CustomFilterElement: () => CustomFilterElement,
34
35
  DataTableAdvancedFilter: () => DataTableAdvancedFilter,
35
36
  DateFilterTemplate: () => DateFilterTemplate,
36
37
  DateTimeFilterTemplate: () => DateTimeFilterTemplate,
37
- FilterMatchMode: () => import_api4.FilterMatchMode,
38
- FilterOperator: () => import_api4.FilterOperator,
38
+ FilterMatchMode: () => import_api5.FilterMatchMode,
39
+ FilterOperator: () => import_api5.FilterOperator,
39
40
  ModalBase: () => ModalBase,
40
41
  SelectFilterTemplate: () => SelectFilterTemplate,
41
42
  ValueFilterTemplate: () => ValueFilterTemplate,
43
+ customMatchModes: () => customMatchModes,
42
44
  getDefaultFilterMatchOptionsDate: () => getDefaultFilterMatchOptionsDate,
43
45
  getDefaultFilterMatchOptionsEnum: () => getDefaultFilterMatchOptionsEnum,
44
46
  getDefaultFilterMatchOptionsEnumNotNullable: () => getDefaultFilterMatchOptionsEnumNotNullable,
@@ -239,6 +241,7 @@ function TooltipCustom({ label, id }) {
239
241
  className: "tooltip-icone",
240
242
  opacity: 1,
241
243
  place: "top",
244
+ content: label,
242
245
  anchorSelect: `#${id}`,
243
246
  style: {
244
247
  zIndex: 9999
@@ -464,6 +467,7 @@ function DynamicColumns({
464
467
  filter: !isActionsCol,
465
468
  frozen: col.frozen,
466
469
  alignFrozen: col.alignFrozen,
470
+ showFilterMatchModes: col.showFilterMatchModes,
467
471
  dataType: col.dataType,
468
472
  hidden: col.hidden,
469
473
  filterElement: col.filterElement ? (options) => col.filterElement?.(options, col.mask) ?? void 0 : void 0,
@@ -493,6 +497,7 @@ function DynamicColumns({
493
497
  }
494
498
 
495
499
  // src/utils/DataTableUtils.tsx
500
+ var import_api2 = require("primereact/api");
496
501
  var getUrlParams = (sortFieldInitial, sortOrderInitial) => {
497
502
  const params = new URLSearchParams(
498
503
  typeof window !== "undefined" ? window.location.search : ""
@@ -766,11 +771,8 @@ function DataTableAdvancedFilterWrapper({
766
771
  ...filters[key]?.filterFieldCollection && {
767
772
  filterFieldCollection: filters[key].filterFieldCollection
768
773
  },
769
- ...filters[key]?.campoId && {
770
- campoId: filters[key].campoId
771
- },
772
- ...filters[key]?.operator && {
773
- operator: filters[key].operator
774
+ ...filters[key]?.fieldId && {
775
+ fieldId: filters[key].fieldId
774
776
  }
775
777
  };
776
778
  }
@@ -797,7 +799,7 @@ function DataTableAdvancedFilterWrapper({
797
799
  }
798
800
 
799
801
  // src/components/DataTableAdvancedFilter/DataTableAdvancedFilter.tsx
800
- var import_api2 = require("primereact/api");
802
+ var import_api3 = require("primereact/api");
801
803
 
802
804
  // src/utils/locale.ts
803
805
  var localePtBr = {
@@ -973,16 +975,16 @@ function DataTableAdvancedFilter({
973
975
  }) {
974
976
  const [isClient, setIsClient] = (0, import_react8.useState)(false);
975
977
  (0, import_react8.useEffect)(() => {
976
- (0, import_api2.addLocale)("pt", localePtBr);
978
+ (0, import_api3.addLocale)("pt", localePtBr);
977
979
  }, []);
978
980
  (0, import_react8.useEffect)(() => {
979
- (0, import_api2.locale)(isLanguagePtBr ? "pt" : "en");
981
+ (0, import_api3.locale)(isLanguagePtBr ? "pt" : "en");
980
982
  }, [isLanguagePtBr]);
981
983
  (0, import_react8.useEffect)(() => {
982
984
  setIsClient(true);
983
985
  }, []);
984
986
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: isClient && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
985
- import_api2.PrimeReactProvider,
987
+ import_api3.PrimeReactProvider,
986
988
  {
987
989
  value: isLanguagePtBr ? { locale: "pt" } : { locale: "en" },
988
990
  children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
@@ -1011,6 +1013,7 @@ function DataTableAdvancedFilter({
1011
1013
 
1012
1014
  // src/components/DataTableAdvancedFilter/FilterTemplates.tsx
1013
1015
  var import_react_select = __toESM(require("react-select"));
1016
+ var import_dropdown = require("primereact/dropdown");
1014
1017
  var import_jsx_runtime11 = require("react/jsx-runtime");
1015
1018
  var DateFilterTemplate = (options, mask) => {
1016
1019
  const parsedValue = options.value && typeof options.value === "string" ? /* @__PURE__ */ new Date(options.value + "T00:00:00") : options.value;
@@ -1141,9 +1144,79 @@ var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
1141
1144
  }
1142
1145
  );
1143
1146
  };
1147
+ var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
1148
+ const resolvedItems = items ?? getDefaultFilterMatchOptionsString(isLanguagePtBr);
1149
+ const currentFilter = options.value ?? {};
1150
+ const currentValue = currentFilter.value ?? null;
1151
+ const currentMatchMode = currentFilter.matchMode ?? "contains";
1152
+ const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
1153
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1154
+ "div",
1155
+ {
1156
+ className: "filter-wrapper",
1157
+ style: {
1158
+ display: "flex",
1159
+ flexDirection: "column",
1160
+ gap: "8px",
1161
+ minWidth: "200px"
1162
+ },
1163
+ children: [
1164
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1165
+ import_dropdown.Dropdown,
1166
+ {
1167
+ value: currentMatchMode,
1168
+ options: resolvedItems,
1169
+ optionLabel: "label",
1170
+ optionValue: "value",
1171
+ placeholder: "Tipo de filtro",
1172
+ style: { width: "100%" },
1173
+ onChange: (e) => {
1174
+ const newMatchMode = e.value;
1175
+ const isNewSpecial = newMatchMode === customMatchModes.empty || newMatchMode === customMatchModes.notEmpty;
1176
+ if (isNewSpecial) {
1177
+ options.filterCallback({
1178
+ value: null,
1179
+ matchMode: newMatchMode
1180
+ });
1181
+ return;
1182
+ }
1183
+ options.filterCallback({
1184
+ value: null,
1185
+ matchMode: newMatchMode
1186
+ });
1187
+ }
1188
+ }
1189
+ ),
1190
+ !isSpecial && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1191
+ import_inputtext.InputText,
1192
+ {
1193
+ value: currentValue ?? "",
1194
+ placeholder: isLanguagePtBr ? "Pesquisar" : "Search",
1195
+ style: { width: "100%" },
1196
+ className: "p-column-filter",
1197
+ onChange: (e) => {
1198
+ const value = e.target.value;
1199
+ if (value.trim()) {
1200
+ options.filterCallback({
1201
+ value,
1202
+ matchMode: currentMatchMode
1203
+ });
1204
+ } else {
1205
+ options.filterCallback({
1206
+ value: null,
1207
+ matchMode: currentMatchMode
1208
+ });
1209
+ }
1210
+ }
1211
+ }
1212
+ )
1213
+ ]
1214
+ }
1215
+ );
1216
+ };
1144
1217
 
1145
1218
  // src/components/DataTableAdvancedFilter/filterModes.ts
1146
- var import_api3 = require("primereact/api");
1219
+ var import_api4 = require("primereact/api");
1147
1220
  var customMatchModes = {
1148
1221
  notStartsWith: "notStartsWith",
1149
1222
  notEndsWith: "notEndsWith",
@@ -1153,23 +1226,23 @@ var customMatchModes = {
1153
1226
  var getDefaultFilterMatchOptionsString = (isLanguagePtBr = true) => [
1154
1227
  {
1155
1228
  label: isLanguagePtBr ? "Cont\xE9m" : "Contains",
1156
- value: import_api3.FilterMatchMode.CONTAINS
1229
+ value: import_api4.FilterMatchMode.CONTAINS
1157
1230
  },
1158
1231
  {
1159
1232
  label: isLanguagePtBr ? "N\xE3o cont\xE9m" : "Does not contain",
1160
- value: import_api3.FilterMatchMode.NOT_CONTAINS
1233
+ value: import_api4.FilterMatchMode.NOT_CONTAINS
1161
1234
  },
1162
1235
  {
1163
1236
  label: isLanguagePtBr ? "Igual" : "Equals",
1164
- value: import_api3.FilterMatchMode.EQUALS
1237
+ value: import_api4.FilterMatchMode.EQUALS
1165
1238
  },
1166
1239
  {
1167
1240
  label: isLanguagePtBr ? "Diferente" : "Not equals",
1168
- value: import_api3.FilterMatchMode.NOT_EQUALS
1241
+ value: import_api4.FilterMatchMode.NOT_EQUALS
1169
1242
  },
1170
1243
  {
1171
1244
  label: isLanguagePtBr ? "Come\xE7a com" : "Starts with",
1172
- value: import_api3.FilterMatchMode.STARTS_WITH
1245
+ value: import_api4.FilterMatchMode.STARTS_WITH
1173
1246
  },
1174
1247
  {
1175
1248
  label: isLanguagePtBr ? "N\xE3o come\xE7a com" : "Does not start with",
@@ -1177,7 +1250,7 @@ var getDefaultFilterMatchOptionsString = (isLanguagePtBr = true) => [
1177
1250
  },
1178
1251
  {
1179
1252
  label: isLanguagePtBr ? "Termina com" : "Ends with",
1180
- value: import_api3.FilterMatchMode.ENDS_WITH
1253
+ value: import_api4.FilterMatchMode.ENDS_WITH
1181
1254
  },
1182
1255
  {
1183
1256
  label: isLanguagePtBr ? "N\xE3o termina com" : "Does not end with",
@@ -1186,36 +1259,40 @@ var getDefaultFilterMatchOptionsString = (isLanguagePtBr = true) => [
1186
1259
  {
1187
1260
  label: isLanguagePtBr ? "Vazio" : "Empty",
1188
1261
  value: customMatchModes.empty
1262
+ },
1263
+ {
1264
+ label: isLanguagePtBr ? "N\xE3o Vazio" : "NotEmpty",
1265
+ value: customMatchModes.notEmpty
1189
1266
  }
1190
1267
  ];
1191
1268
  var getDefaultFilterMatchOptionsStringArray = (isLanguagePtBr = true) => [
1192
1269
  {
1193
1270
  label: isLanguagePtBr ? "Cont\xE9m" : "Contains",
1194
- value: import_api3.FilterMatchMode.CONTAINS
1271
+ value: import_api4.FilterMatchMode.CONTAINS
1195
1272
  },
1196
1273
  {
1197
1274
  label: isLanguagePtBr ? "N\xE3o cont\xE9m" : "Does not contain",
1198
- value: import_api3.FilterMatchMode.NOT_CONTAINS
1275
+ value: import_api4.FilterMatchMode.NOT_CONTAINS
1199
1276
  }
1200
1277
  ];
1201
1278
  var getDefaultFilterMatchOptionsDate = (isLanguagePtBr) => [
1202
1279
  {
1203
1280
  label: isLanguagePtBr ? "Data antes de" : "Date before",
1204
- value: import_api3.FilterMatchMode.DATE_BEFORE
1281
+ value: import_api4.FilterMatchMode.DATE_BEFORE
1205
1282
  },
1206
1283
  {
1207
1284
  label: isLanguagePtBr ? "Data depois de" : "Date after",
1208
- value: import_api3.FilterMatchMode.DATE_AFTER
1285
+ value: import_api4.FilterMatchMode.DATE_AFTER
1209
1286
  }
1210
1287
  ];
1211
1288
  var getDefaultFilterMatchOptionsEnum = (isLanguagePtBr) => [
1212
1289
  {
1213
1290
  label: isLanguagePtBr ? "Igual" : "Equals",
1214
- value: import_api3.FilterMatchMode.EQUALS
1291
+ value: import_api4.FilterMatchMode.EQUALS
1215
1292
  },
1216
1293
  {
1217
1294
  label: isLanguagePtBr ? "Diferente" : "Not equals",
1218
- value: import_api3.FilterMatchMode.NOT_EQUALS
1295
+ value: import_api4.FilterMatchMode.NOT_EQUALS
1219
1296
  },
1220
1297
  {
1221
1298
  label: isLanguagePtBr ? "Vazio" : "Empty",
@@ -1229,19 +1306,20 @@ var getDefaultFilterMatchOptionsEnum = (isLanguagePtBr) => [
1229
1306
  var getDefaultFilterMatchOptionsEnumNotNullable = (isLanguagePtBr) => [
1230
1307
  {
1231
1308
  label: isLanguagePtBr ? "Igual" : "Equals",
1232
- value: import_api3.FilterMatchMode.EQUALS
1309
+ value: import_api4.FilterMatchMode.EQUALS
1233
1310
  },
1234
1311
  {
1235
1312
  label: isLanguagePtBr ? "Diferente" : "Not equals",
1236
- value: import_api3.FilterMatchMode.NOT_EQUALS
1313
+ value: import_api4.FilterMatchMode.NOT_EQUALS
1237
1314
  }
1238
1315
  ];
1239
1316
 
1240
1317
  // src/index.tsx
1241
- var import_api4 = require("primereact/api");
1318
+ var import_api5 = require("primereact/api");
1242
1319
  // Annotate the CommonJS export names for ESM import in node:
1243
1320
  0 && (module.exports = {
1244
1321
  Button,
1322
+ CustomFilterElement,
1245
1323
  DataTableAdvancedFilter,
1246
1324
  DateFilterTemplate,
1247
1325
  DateTimeFilterTemplate,
@@ -1250,6 +1328,7 @@ var import_api4 = require("primereact/api");
1250
1328
  ModalBase,
1251
1329
  SelectFilterTemplate,
1252
1330
  ValueFilterTemplate,
1331
+ customMatchModes,
1253
1332
  getDefaultFilterMatchOptionsDate,
1254
1333
  getDefaultFilterMatchOptionsEnum,
1255
1334
  getDefaultFilterMatchOptionsEnumNotNullable,
package/dist/index.mjs CHANGED
@@ -190,6 +190,7 @@ function TooltipCustom({ label, id }) {
190
190
  className: "tooltip-icone",
191
191
  opacity: 1,
192
192
  place: "top",
193
+ content: label,
193
194
  anchorSelect: `#${id}`,
194
195
  style: {
195
196
  zIndex: 9999
@@ -415,6 +416,7 @@ function DynamicColumns({
415
416
  filter: !isActionsCol,
416
417
  frozen: col.frozen,
417
418
  alignFrozen: col.alignFrozen,
419
+ showFilterMatchModes: col.showFilterMatchModes,
418
420
  dataType: col.dataType,
419
421
  hidden: col.hidden,
420
422
  filterElement: col.filterElement ? (options) => col.filterElement?.(options, col.mask) ?? void 0 : void 0,
@@ -444,6 +446,7 @@ function DynamicColumns({
444
446
  }
445
447
 
446
448
  // src/utils/DataTableUtils.tsx
449
+ import { FilterMatchMode as FilterMatchMode3, FilterOperator } from "primereact/api";
447
450
  var getUrlParams = (sortFieldInitial, sortOrderInitial) => {
448
451
  const params = new URLSearchParams(
449
452
  typeof window !== "undefined" ? window.location.search : ""
@@ -717,11 +720,8 @@ function DataTableAdvancedFilterWrapper({
717
720
  ...filters[key]?.filterFieldCollection && {
718
721
  filterFieldCollection: filters[key].filterFieldCollection
719
722
  },
720
- ...filters[key]?.campoId && {
721
- campoId: filters[key].campoId
722
- },
723
- ...filters[key]?.operator && {
724
- operator: filters[key].operator
723
+ ...filters[key]?.fieldId && {
724
+ fieldId: filters[key].fieldId
725
725
  }
726
726
  };
727
727
  }
@@ -962,7 +962,8 @@ function DataTableAdvancedFilter({
962
962
 
963
963
  // src/components/DataTableAdvancedFilter/FilterTemplates.tsx
964
964
  import Select from "react-select";
965
- import { jsx as jsx11 } from "react/jsx-runtime";
965
+ import { Dropdown } from "primereact/dropdown";
966
+ import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
966
967
  var DateFilterTemplate = (options, mask) => {
967
968
  const parsedValue = options.value && typeof options.value === "string" ? /* @__PURE__ */ new Date(options.value + "T00:00:00") : options.value;
968
969
  return /* @__PURE__ */ jsx11(
@@ -1092,9 +1093,79 @@ var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
1092
1093
  }
1093
1094
  );
1094
1095
  };
1096
+ var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
1097
+ const resolvedItems = items ?? getDefaultFilterMatchOptionsString(isLanguagePtBr);
1098
+ const currentFilter = options.value ?? {};
1099
+ const currentValue = currentFilter.value ?? null;
1100
+ const currentMatchMode = currentFilter.matchMode ?? "contains";
1101
+ const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
1102
+ return /* @__PURE__ */ jsxs6(
1103
+ "div",
1104
+ {
1105
+ className: "filter-wrapper",
1106
+ style: {
1107
+ display: "flex",
1108
+ flexDirection: "column",
1109
+ gap: "8px",
1110
+ minWidth: "200px"
1111
+ },
1112
+ children: [
1113
+ /* @__PURE__ */ jsx11(
1114
+ Dropdown,
1115
+ {
1116
+ value: currentMatchMode,
1117
+ options: resolvedItems,
1118
+ optionLabel: "label",
1119
+ optionValue: "value",
1120
+ placeholder: "Tipo de filtro",
1121
+ style: { width: "100%" },
1122
+ onChange: (e) => {
1123
+ const newMatchMode = e.value;
1124
+ const isNewSpecial = newMatchMode === customMatchModes.empty || newMatchMode === customMatchModes.notEmpty;
1125
+ if (isNewSpecial) {
1126
+ options.filterCallback({
1127
+ value: null,
1128
+ matchMode: newMatchMode
1129
+ });
1130
+ return;
1131
+ }
1132
+ options.filterCallback({
1133
+ value: null,
1134
+ matchMode: newMatchMode
1135
+ });
1136
+ }
1137
+ }
1138
+ ),
1139
+ !isSpecial && /* @__PURE__ */ jsx11(
1140
+ InputText,
1141
+ {
1142
+ value: currentValue ?? "",
1143
+ placeholder: isLanguagePtBr ? "Pesquisar" : "Search",
1144
+ style: { width: "100%" },
1145
+ className: "p-column-filter",
1146
+ onChange: (e) => {
1147
+ const value = e.target.value;
1148
+ if (value.trim()) {
1149
+ options.filterCallback({
1150
+ value,
1151
+ matchMode: currentMatchMode
1152
+ });
1153
+ } else {
1154
+ options.filterCallback({
1155
+ value: null,
1156
+ matchMode: currentMatchMode
1157
+ });
1158
+ }
1159
+ }
1160
+ }
1161
+ )
1162
+ ]
1163
+ }
1164
+ );
1165
+ };
1095
1166
 
1096
1167
  // src/components/DataTableAdvancedFilter/filterModes.ts
1097
- import { FilterMatchMode as FilterMatchMode3 } from "primereact/api";
1168
+ import { FilterMatchMode as FilterMatchMode4 } from "primereact/api";
1098
1169
  var customMatchModes = {
1099
1170
  notStartsWith: "notStartsWith",
1100
1171
  notEndsWith: "notEndsWith",
@@ -1104,23 +1175,23 @@ var customMatchModes = {
1104
1175
  var getDefaultFilterMatchOptionsString = (isLanguagePtBr = true) => [
1105
1176
  {
1106
1177
  label: isLanguagePtBr ? "Cont\xE9m" : "Contains",
1107
- value: FilterMatchMode3.CONTAINS
1178
+ value: FilterMatchMode4.CONTAINS
1108
1179
  },
1109
1180
  {
1110
1181
  label: isLanguagePtBr ? "N\xE3o cont\xE9m" : "Does not contain",
1111
- value: FilterMatchMode3.NOT_CONTAINS
1182
+ value: FilterMatchMode4.NOT_CONTAINS
1112
1183
  },
1113
1184
  {
1114
1185
  label: isLanguagePtBr ? "Igual" : "Equals",
1115
- value: FilterMatchMode3.EQUALS
1186
+ value: FilterMatchMode4.EQUALS
1116
1187
  },
1117
1188
  {
1118
1189
  label: isLanguagePtBr ? "Diferente" : "Not equals",
1119
- value: FilterMatchMode3.NOT_EQUALS
1190
+ value: FilterMatchMode4.NOT_EQUALS
1120
1191
  },
1121
1192
  {
1122
1193
  label: isLanguagePtBr ? "Come\xE7a com" : "Starts with",
1123
- value: FilterMatchMode3.STARTS_WITH
1194
+ value: FilterMatchMode4.STARTS_WITH
1124
1195
  },
1125
1196
  {
1126
1197
  label: isLanguagePtBr ? "N\xE3o come\xE7a com" : "Does not start with",
@@ -1128,7 +1199,7 @@ var getDefaultFilterMatchOptionsString = (isLanguagePtBr = true) => [
1128
1199
  },
1129
1200
  {
1130
1201
  label: isLanguagePtBr ? "Termina com" : "Ends with",
1131
- value: FilterMatchMode3.ENDS_WITH
1202
+ value: FilterMatchMode4.ENDS_WITH
1132
1203
  },
1133
1204
  {
1134
1205
  label: isLanguagePtBr ? "N\xE3o termina com" : "Does not end with",
@@ -1137,36 +1208,40 @@ var getDefaultFilterMatchOptionsString = (isLanguagePtBr = true) => [
1137
1208
  {
1138
1209
  label: isLanguagePtBr ? "Vazio" : "Empty",
1139
1210
  value: customMatchModes.empty
1211
+ },
1212
+ {
1213
+ label: isLanguagePtBr ? "N\xE3o Vazio" : "NotEmpty",
1214
+ value: customMatchModes.notEmpty
1140
1215
  }
1141
1216
  ];
1142
1217
  var getDefaultFilterMatchOptionsStringArray = (isLanguagePtBr = true) => [
1143
1218
  {
1144
1219
  label: isLanguagePtBr ? "Cont\xE9m" : "Contains",
1145
- value: FilterMatchMode3.CONTAINS
1220
+ value: FilterMatchMode4.CONTAINS
1146
1221
  },
1147
1222
  {
1148
1223
  label: isLanguagePtBr ? "N\xE3o cont\xE9m" : "Does not contain",
1149
- value: FilterMatchMode3.NOT_CONTAINS
1224
+ value: FilterMatchMode4.NOT_CONTAINS
1150
1225
  }
1151
1226
  ];
1152
1227
  var getDefaultFilterMatchOptionsDate = (isLanguagePtBr) => [
1153
1228
  {
1154
1229
  label: isLanguagePtBr ? "Data antes de" : "Date before",
1155
- value: FilterMatchMode3.DATE_BEFORE
1230
+ value: FilterMatchMode4.DATE_BEFORE
1156
1231
  },
1157
1232
  {
1158
1233
  label: isLanguagePtBr ? "Data depois de" : "Date after",
1159
- value: FilterMatchMode3.DATE_AFTER
1234
+ value: FilterMatchMode4.DATE_AFTER
1160
1235
  }
1161
1236
  ];
1162
1237
  var getDefaultFilterMatchOptionsEnum = (isLanguagePtBr) => [
1163
1238
  {
1164
1239
  label: isLanguagePtBr ? "Igual" : "Equals",
1165
- value: FilterMatchMode3.EQUALS
1240
+ value: FilterMatchMode4.EQUALS
1166
1241
  },
1167
1242
  {
1168
1243
  label: isLanguagePtBr ? "Diferente" : "Not equals",
1169
- value: FilterMatchMode3.NOT_EQUALS
1244
+ value: FilterMatchMode4.NOT_EQUALS
1170
1245
  },
1171
1246
  {
1172
1247
  label: isLanguagePtBr ? "Vazio" : "Empty",
@@ -1180,26 +1255,28 @@ var getDefaultFilterMatchOptionsEnum = (isLanguagePtBr) => [
1180
1255
  var getDefaultFilterMatchOptionsEnumNotNullable = (isLanguagePtBr) => [
1181
1256
  {
1182
1257
  label: isLanguagePtBr ? "Igual" : "Equals",
1183
- value: FilterMatchMode3.EQUALS
1258
+ value: FilterMatchMode4.EQUALS
1184
1259
  },
1185
1260
  {
1186
1261
  label: isLanguagePtBr ? "Diferente" : "Not equals",
1187
- value: FilterMatchMode3.NOT_EQUALS
1262
+ value: FilterMatchMode4.NOT_EQUALS
1188
1263
  }
1189
1264
  ];
1190
1265
 
1191
1266
  // src/index.tsx
1192
- import { FilterMatchMode as FilterMatchMode4, FilterOperator } from "primereact/api";
1267
+ import { FilterMatchMode as FilterMatchMode5, FilterOperator as FilterOperator2 } from "primereact/api";
1193
1268
  export {
1194
1269
  Button,
1270
+ CustomFilterElement,
1195
1271
  DataTableAdvancedFilter,
1196
1272
  DateFilterTemplate,
1197
1273
  DateTimeFilterTemplate,
1198
- FilterMatchMode4 as FilterMatchMode,
1199
- FilterOperator,
1274
+ FilterMatchMode5 as FilterMatchMode,
1275
+ FilterOperator2 as FilterOperator,
1200
1276
  ModalBase,
1201
1277
  SelectFilterTemplate,
1202
1278
  ValueFilterTemplate,
1279
+ customMatchModes,
1203
1280
  getDefaultFilterMatchOptionsDate,
1204
1281
  getDefaultFilterMatchOptionsEnum,
1205
1282
  getDefaultFilterMatchOptionsEnumNotNullable,
@@ -125,7 +125,7 @@ th {
125
125
  border-top: 1px solid #edf0f2;
126
126
  border-bottom: 1px solid #edf0f2;
127
127
  border-left: 1px solid #edf0f2;
128
- padding: 0 14px;
128
+ padding: 0 0 0 7px;
129
129
  font-size: 14px;
130
130
  font-family: "Roboto", sans-serif;
131
131
  font-weight: bold;
@@ -135,7 +135,7 @@ th {
135
135
  td {
136
136
  border-bottom: 1px solid #edf0f2;
137
137
  border-left: 1px solid #edf0f2;
138
- padding: 5px 1rem;
138
+ padding: 1.5px 7px;
139
139
  }
140
140
 
141
141
  .p-datatable .p-datatable-header {
@@ -157,10 +157,6 @@ td {
157
157
  background: #fff url("../assets/images/seta.svg") no-repeat right 6px center;
158
158
  }
159
159
 
160
- .react-tooltip {
161
- z-index: 99 !important;
162
- }
163
-
164
160
  .p-paginator-left-content {
165
161
  flex: 1;
166
162
  }
@@ -175,7 +171,7 @@ th {
175
171
  font-weight: bold;
176
172
  }
177
173
 
178
- .p-datatable .p-datatable-tbody>tr {
174
+ .p-datatable .p-datatable-tbody > tr {
179
175
  background: #fff;
180
176
  color: #000;
181
177
  font-family: "roboto", sans-serif;
@@ -205,13 +201,43 @@ th {
205
201
  left: -2px;
206
202
  }
207
203
 
208
- .p-checkbox:not(.p-disabled):has(.p-checkbox-input:hover).p-highlight .p-checkbox-box {
204
+ .p-checkbox:not(.p-disabled):has(.p-checkbox-input:hover).p-highlight
205
+ .p-checkbox-box {
209
206
  border-color: #094394;
210
207
  background: #094394;
211
208
  color: #ffffff;
212
209
  }
213
210
 
214
- .p-datatable .p-datatable-tbody>tr.p-highlight {
211
+ .p-datatable .p-datatable-tbody > tr > td.p-selection-column {
212
+ text-align: center !important;
213
+ display: table-cell;
214
+ vertical-align: middle;
215
+ position: relative;
216
+ }
217
+
218
+ .p-datatable .p-datatable-tbody > tr > td.p-selection-column .p-checkbox {
219
+ position: relative;
220
+ left: -2px;
221
+ }
222
+
223
+ .p-datatable .p-datatable-thead > tr > th.p-selection-column .p-checkbox-input {
224
+ text-align: center !important;
225
+ position: relative;
226
+ left: -1rem;
227
+ }
228
+
229
+ .p-selection-column .p-checkbox {
230
+ display: inline-flex;
231
+ vertical-align: middle;
232
+ justify-content: center;
233
+ align-items: center;
234
+ }
235
+
236
+ .p-column-header-content .p-checkbox {
237
+ position: static;
238
+ }
239
+
240
+ .p-datatable .p-datatable-tbody > tr.p-highlight {
215
241
  background: #fafbfc;
216
242
  }
217
243
 
@@ -347,6 +373,7 @@ th {
347
373
 
348
374
  .p-column-title {
349
375
  flex: 1;
376
+ text-align: left;
350
377
  }
351
378
 
352
379
  .p-column-filter-add-button {
@@ -360,7 +387,7 @@ th {
360
387
  padding: 10px 0;
361
388
  }
362
389
 
363
- .p-column-filter-add-button>svg {
390
+ .p-column-filter-add-button > svg {
364
391
  width: 12px;
365
392
  height: 12px;
366
393
  }
@@ -404,7 +431,7 @@ th {
404
431
  padding: 10px 0 0 0;
405
432
  }
406
433
 
407
- .p-column-filter-remove-button>svg {
434
+ .p-column-filter-remove-button > svg {
408
435
  width: 12px;
409
436
  height: 12px;
410
437
  }
@@ -417,8 +444,8 @@ th {
417
444
  z-index: 99;
418
445
  }
419
446
 
420
- .NextPage>svg,
421
- .PrevPage>svg {
447
+ .NextPage > svg,
448
+ .PrevPage > svg {
422
449
  fill: #fff;
423
450
  }
424
451
 
@@ -473,14 +500,9 @@ th {
473
500
  }
474
501
 
475
502
  .box-icones-actions-column {
476
- position: fixed;
477
- z-index: 2;
478
- padding: 0.125rem;
479
503
  width: fit-content;
480
504
  height: fit-content;
481
505
  margin: auto;
482
- right: 6px;
483
- transform: translate( -50%, -50%);
484
506
  display: flex;
485
507
  align-items: center;
486
508
  justify-content: center;
@@ -489,6 +511,22 @@ th {
489
511
  transition: opacity 0.2s ease;
490
512
  }
491
513
 
514
+ .p-datatable .p-datatable-tbody > tr > td:last-child {
515
+ position: sticky !important;
516
+ right: 0;
517
+ z-index: 11;
518
+ border-left: transparent;
519
+ border-right: transparent;
520
+ }
521
+
522
+ .p-datatable .p-datatable-tbody > tr > td:nth-last-child(2) {
523
+ border-right: 1px solid #edf0f2 !important;
524
+ }
525
+
526
+ .react-tooltip {
527
+ z-index: 99 !important;
528
+ }
529
+
492
530
  .box-icones-actions-column:hover {
493
531
  opacity: 1;
494
532
  }
@@ -542,7 +580,6 @@ th {
542
580
  }
543
581
 
544
582
  @media (max-width: 567px) {
545
-
546
583
  .disablePagination,
547
584
  .paginatorLeft {
548
585
  display: grid;
@@ -552,4 +589,10 @@ th {
552
589
  .custom-select {
553
590
  min-width: 100%;
554
591
  }
555
- }
592
+ }
593
+
594
+ .p-datatable .p-datatable-thead > tr > th:last-child .p-column-title {
595
+ flex: 1;
596
+ text-align: center;
597
+ padding: 0 17px 0 7px;
598
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charlesgomes/leafcode-shared-lib-react",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "description": "Lib de componentes react",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",