@charlesgomes/leafcode-shared-lib-react 1.0.86 → 1.0.88

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.d.mts CHANGED
@@ -74,24 +74,8 @@ interface Props {
74
74
  btnSuccess?: string;
75
75
  disabledBtnSuccess?: boolean;
76
76
  type?: "submit" | "button";
77
- fonts?: {
78
- modalTitleFontWeight?: number | string;
79
- modalTitleFontSize?: number | string;
80
- modalTitleFontFamily?: string;
81
- modalBodyFontFamily?: string;
82
- modalBodyFontSize?: number | string;
83
- };
84
- colors?: {
85
- modalBgColor?: string;
86
- modalTitleColor?: string;
87
- modalBodyColor?: string;
88
- modalCloseColor?: string;
89
- };
90
- modalMaxWidth?: {
91
- modalMaxWidth?: number | string;
92
- };
93
77
  }
94
- declare function ModalBase({ show, onHide, onAction, title, children, loading, btnCancel, btnSuccess, type, disabledBtnSuccess, colors, fonts, modalMaxWidth, }: Props): react_jsx_runtime.JSX.Element;
78
+ declare function ModalBase({ show, onHide, onAction, title, children, loading, btnCancel, btnSuccess, type, disabledBtnSuccess, }: Props): react_jsx_runtime.JSX.Element;
95
79
 
96
80
  interface PaginatedResponse$1<T> {
97
81
  items: T[];
@@ -253,11 +237,11 @@ declare const getNullableCollection: (isLanguagePtBr: boolean) => {
253
237
  declare const mapPrimeToBackendFilters: (filters: any, globalFilterFields: string[]) => {
254
238
  and: any[];
255
239
  } | undefined;
256
- type CampoDinamico = {
240
+ type DynamicField = {
257
241
  id: string;
258
- tipoDado: string;
242
+ documentType: string;
259
243
  };
260
- declare function buildDynamicCampoFilters(campos: CampoDinamico[]): Record<string, any>;
244
+ declare function buildDynamicFieldFilters(fields: DynamicField[]): Record<string, any>;
261
245
  declare const getUrlParams: (sortFieldInitial: string, sortOrderInitial: 1 | -1) => {
262
246
  page: number;
263
247
  rows: number;
@@ -300,6 +284,7 @@ interface LeafcodeTheme {
300
284
  text: string;
301
285
  placeholder: string;
302
286
  passwordToggle: string;
287
+ labelLine: string;
303
288
  };
304
289
 
305
290
  fonts: {
@@ -345,6 +330,27 @@ interface LeafcodeTheme {
345
330
  radius: string;
346
331
  };
347
332
  };
333
+
334
+ modalBase: {
335
+ colors: {
336
+ modalTitleColor: string;
337
+ modalBgColor: string;
338
+ modalCloseColor: string;
339
+ modalBodyColor: string;
340
+ };
341
+
342
+ fonts: {
343
+ modalTitleFontFamily: string;
344
+ modalTitleFontWeight: number | string;
345
+ modalTitleFontSize: string | number;
346
+ modalBodyFontFamily: string | number;
347
+ modalBodyFontSize: string | number;
348
+ };
349
+
350
+ sizes: {
351
+ modalMaxWidth: string | number;
352
+ };
353
+ };
348
354
  };
349
355
  }
350
356
 
@@ -360,4 +366,4 @@ declare const LeafcodeThemeProvider: ({ children, theme, }: LeafcodeThemeProvide
360
366
 
361
367
  declare const defaultTheme: LeafcodeTheme;
362
368
 
363
- export { Button, type ColumnCustom, CustomFilterElement, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, Input, InputAutoComplete, type InputAutoCompleteProps, InputSelect, LeafcodeThemeProvider, ModalBase, type PaginatedResponse$1 as PaginatedResponse, SelectFilterTemplate, type ServiceParams, TextArea, ValueFilterTemplate, buildDynamicCampoFilters, buildSortingWithFilters, customMatchModes, defaultTheme, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsEnum, getDefaultFilterMatchOptionsNumber, getDefaultFilterMatchOptionsString, getDefaultFilterMatchOptionsStringArray, getNullable, getNullableCollection, getUrlParams, isSpecialMatchMode, mapPrimeToBackendFilters };
369
+ export { Button, type ColumnCustom, CustomFilterElement, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, Input, InputAutoComplete, type InputAutoCompleteProps, InputSelect, LeafcodeThemeProvider, ModalBase, type PaginatedResponse$1 as PaginatedResponse, SelectFilterTemplate, type ServiceParams, TextArea, ValueFilterTemplate, buildDynamicFieldFilters, buildSortingWithFilters, customMatchModes, defaultTheme, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsEnum, getDefaultFilterMatchOptionsNumber, getDefaultFilterMatchOptionsString, getDefaultFilterMatchOptionsStringArray, getNullable, getNullableCollection, getUrlParams, isSpecialMatchMode, mapPrimeToBackendFilters };
package/dist/index.d.ts CHANGED
@@ -74,24 +74,8 @@ interface Props {
74
74
  btnSuccess?: string;
75
75
  disabledBtnSuccess?: boolean;
76
76
  type?: "submit" | "button";
77
- fonts?: {
78
- modalTitleFontWeight?: number | string;
79
- modalTitleFontSize?: number | string;
80
- modalTitleFontFamily?: string;
81
- modalBodyFontFamily?: string;
82
- modalBodyFontSize?: number | string;
83
- };
84
- colors?: {
85
- modalBgColor?: string;
86
- modalTitleColor?: string;
87
- modalBodyColor?: string;
88
- modalCloseColor?: string;
89
- };
90
- modalMaxWidth?: {
91
- modalMaxWidth?: number | string;
92
- };
93
77
  }
94
- declare function ModalBase({ show, onHide, onAction, title, children, loading, btnCancel, btnSuccess, type, disabledBtnSuccess, colors, fonts, modalMaxWidth, }: Props): react_jsx_runtime.JSX.Element;
78
+ declare function ModalBase({ show, onHide, onAction, title, children, loading, btnCancel, btnSuccess, type, disabledBtnSuccess, }: Props): react_jsx_runtime.JSX.Element;
95
79
 
96
80
  interface PaginatedResponse$1<T> {
97
81
  items: T[];
@@ -253,11 +237,11 @@ declare const getNullableCollection: (isLanguagePtBr: boolean) => {
253
237
  declare const mapPrimeToBackendFilters: (filters: any, globalFilterFields: string[]) => {
254
238
  and: any[];
255
239
  } | undefined;
256
- type CampoDinamico = {
240
+ type DynamicField = {
257
241
  id: string;
258
- tipoDado: string;
242
+ documentType: string;
259
243
  };
260
- declare function buildDynamicCampoFilters(campos: CampoDinamico[]): Record<string, any>;
244
+ declare function buildDynamicFieldFilters(fields: DynamicField[]): Record<string, any>;
261
245
  declare const getUrlParams: (sortFieldInitial: string, sortOrderInitial: 1 | -1) => {
262
246
  page: number;
263
247
  rows: number;
@@ -300,6 +284,7 @@ interface LeafcodeTheme {
300
284
  text: string;
301
285
  placeholder: string;
302
286
  passwordToggle: string;
287
+ labelLine: string;
303
288
  };
304
289
 
305
290
  fonts: {
@@ -345,6 +330,27 @@ interface LeafcodeTheme {
345
330
  radius: string;
346
331
  };
347
332
  };
333
+
334
+ modalBase: {
335
+ colors: {
336
+ modalTitleColor: string;
337
+ modalBgColor: string;
338
+ modalCloseColor: string;
339
+ modalBodyColor: string;
340
+ };
341
+
342
+ fonts: {
343
+ modalTitleFontFamily: string;
344
+ modalTitleFontWeight: number | string;
345
+ modalTitleFontSize: string | number;
346
+ modalBodyFontFamily: string | number;
347
+ modalBodyFontSize: string | number;
348
+ };
349
+
350
+ sizes: {
351
+ modalMaxWidth: string | number;
352
+ };
353
+ };
348
354
  };
349
355
  }
350
356
 
@@ -360,4 +366,4 @@ declare const LeafcodeThemeProvider: ({ children, theme, }: LeafcodeThemeProvide
360
366
 
361
367
  declare const defaultTheme: LeafcodeTheme;
362
368
 
363
- export { Button, type ColumnCustom, CustomFilterElement, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, Input, InputAutoComplete, type InputAutoCompleteProps, InputSelect, LeafcodeThemeProvider, ModalBase, type PaginatedResponse$1 as PaginatedResponse, SelectFilterTemplate, type ServiceParams, TextArea, ValueFilterTemplate, buildDynamicCampoFilters, buildSortingWithFilters, customMatchModes, defaultTheme, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsEnum, getDefaultFilterMatchOptionsNumber, getDefaultFilterMatchOptionsString, getDefaultFilterMatchOptionsStringArray, getNullable, getNullableCollection, getUrlParams, isSpecialMatchMode, mapPrimeToBackendFilters };
369
+ export { Button, type ColumnCustom, CustomFilterElement, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, Input, InputAutoComplete, type InputAutoCompleteProps, InputSelect, LeafcodeThemeProvider, ModalBase, type PaginatedResponse$1 as PaginatedResponse, SelectFilterTemplate, type ServiceParams, TextArea, ValueFilterTemplate, buildDynamicFieldFilters, buildSortingWithFilters, customMatchModes, defaultTheme, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsEnum, getDefaultFilterMatchOptionsNumber, getDefaultFilterMatchOptionsString, getDefaultFilterMatchOptionsStringArray, getNullable, getNullableCollection, getUrlParams, isSpecialMatchMode, mapPrimeToBackendFilters };
package/dist/index.js CHANGED
@@ -45,7 +45,7 @@ __export(index_exports, {
45
45
  SelectFilterTemplate: () => SelectFilterTemplate,
46
46
  TextArea: () => TextArea,
47
47
  ValueFilterTemplate: () => ValueFilterTemplate,
48
- buildDynamicCampoFilters: () => buildDynamicCampoFilters,
48
+ buildDynamicFieldFilters: () => buildDynamicFieldFilters,
49
49
  buildSortingWithFilters: () => buildSortingWithFilters,
50
50
  customMatchModes: () => customMatchModes,
51
51
  defaultTheme: () => defaultTheme,
@@ -94,7 +94,8 @@ var defaultTheme = {
94
94
  background: "#FFFFFF",
95
95
  text: "#18181B",
96
96
  placeholder: "#71717A",
97
- passwordToggle: "#71717A"
97
+ passwordToggle: "#71717A",
98
+ labelLine: "#FFFFFF"
98
99
  },
99
100
  fonts: {
100
101
  label: "Roboto, sans-serif",
@@ -135,6 +136,24 @@ var defaultTheme = {
135
136
  minWidth: "8rem",
136
137
  radius: "6px"
137
138
  }
139
+ },
140
+ modalBase: {
141
+ colors: {
142
+ modalTitleColor: "#000",
143
+ modalBgColor: "#fff",
144
+ modalCloseColor: "#bf1717",
145
+ modalBodyColor: "#000"
146
+ },
147
+ fonts: {
148
+ modalTitleFontFamily: '"Roboto", sans-serif',
149
+ modalTitleFontWeight: 600,
150
+ modalTitleFontSize: "13px",
151
+ modalBodyFontFamily: '"Roboto", sans-serif',
152
+ modalBodyFontSize: "1rem"
153
+ },
154
+ sizes: {
155
+ modalMaxWidth: "36rem"
156
+ }
138
157
  }
139
158
  }
140
159
  };
@@ -334,7 +353,7 @@ var InputBase = ({
334
353
  "--input-font-size": theme.components.input.fonts.inputSize,
335
354
  // Colors
336
355
  "--label-color": theme.components.input.colors.text,
337
- "--label-line": theme.colors.light,
356
+ "--label-line": theme.components.input.colors.labelLine,
338
357
  "--input-border": theme.components.input.colors.border,
339
358
  "--input-bg": theme.components.input.colors.background,
340
359
  "--autofill-box-shadow": theme.components.input.colors.background,
@@ -434,7 +453,7 @@ var TextAreaBase = ({
434
453
  "--input-font-size": theme.components.input.fonts.inputSize,
435
454
  // Colors
436
455
  "--label-color": theme.components.input.colors.text,
437
- "--label-line": theme.colors.light,
456
+ "--label-line": theme.components.input.colors.labelLine,
438
457
  "--input-border": theme.components.input.colors.border,
439
458
  "--input-bg": theme.components.input.colors.background,
440
459
  "--autofill-box-shadow": theme.components.input.colors.background,
@@ -521,7 +540,7 @@ var InputBase2 = ({
521
540
  "--label-color": theme.components.input.colors.text,
522
541
  "--input-border": theme.components.input.colors.border,
523
542
  "--input-bg": theme.components.input.colors.background,
524
- "--label-line": theme.colors.light,
543
+ "--label-line": theme.components.input.colors.labelLine,
525
544
  "--input-text-color": theme.colors.light,
526
545
  "--input-placeholder": theme.components.input.colors.placeholder,
527
546
  "--input-focus-border": theme.components.input.colors.focusBorder,
@@ -632,22 +651,20 @@ function ModalBase({
632
651
  btnCancel = "Cancel",
633
652
  btnSuccess = "Save",
634
653
  type = "button",
635
- disabledBtnSuccess,
636
- colors,
637
- fonts,
638
- modalMaxWidth
654
+ disabledBtnSuccess
639
655
  }) {
656
+ const theme = useLeafcodeTheme();
640
657
  const styleVars = {
641
- "--modal-title-font-weight": fonts?.modalTitleFontWeight,
642
- "--modal-title-font-size": fonts?.modalTitleFontSize,
643
- "--modal-title-font-family": fonts?.modalTitleFontFamily,
644
- "--modal-body-font-family": fonts?.modalBodyFontFamily,
645
- "--modal-body-font-size": fonts?.modalBodyFontSize,
646
- "--modal-bg-color": colors?.modalBgColor,
647
- "--modal-title-color": colors?.modalTitleColor,
648
- "--modal-body-color": colors?.modalBodyColor,
649
- "--modal-close-color": colors?.modalCloseColor,
650
- "--modal-max-width": modalMaxWidth?.modalMaxWidth
658
+ "--modal-title-font-weight": theme.components.modalBase.fonts?.modalTitleFontWeight,
659
+ "--modal-title-font-size": theme.components.modalBase.fonts?.modalTitleFontSize,
660
+ "--modal-title-font-family": theme.components.modalBase.fonts?.modalTitleFontFamily,
661
+ "--modal-body-font-family": theme.components.modalBase.fonts?.modalBodyFontFamily,
662
+ "--modal-body-font-size": theme.components.modalBase.fonts?.modalBodyFontSize,
663
+ "--modal-bg-color": theme.components.modalBase.colors?.modalBgColor,
664
+ "--modal-title-color": theme.components.modalBase.colors?.modalTitleColor,
665
+ "--modal-body-color": theme.components.modalBase.colors?.modalBodyColor,
666
+ "--modal-close-color": theme.components.modalBase.colors?.modalCloseColor,
667
+ "--modal-max-width": theme.components.modalBase.sizes.modalMaxWidth
651
668
  };
652
669
  (0, import_react9.useEffect)(() => {
653
670
  const handleKeyDown = (event) => {
@@ -745,7 +762,7 @@ function AutoCompleteInner(props, ref) {
745
762
  } = props;
746
763
  const theme = useLeafcodeTheme();
747
764
  const styleVars = {
748
- "--label-line": theme.colors.light,
765
+ "--label-line": theme.components.input.colors.labelLine,
749
766
  "--label-font-family": theme.components.input.fonts.label,
750
767
  "--label-font-weight": theme.components.input.fonts.labelWeight,
751
768
  "--label-font-size": theme.components.input.fonts.labelSize,
@@ -1885,7 +1902,7 @@ var buildFilterPayload = (fieldName, matchMode, rawValue) => {
1885
1902
  };
1886
1903
  var mapPrimeToBackendFilters = (filters, globalFilterFields) => {
1887
1904
  const finalAnd = [];
1888
- const camposMap = {};
1905
+ const fieldsMap = {};
1889
1906
  Object.entries(filters).forEach(([field, config]) => {
1890
1907
  if (!config) return;
1891
1908
  if (field === "global" && typeof config.value === "string" && config.value.trim() !== "") {
@@ -1926,14 +1943,14 @@ var mapPrimeToBackendFilters = (filters, globalFilterFields) => {
1926
1943
  }) : [];
1927
1944
  if (!constraints.length) return;
1928
1945
  const colOperator = config.operator === "or" ? "or" : "and";
1929
- if (config.collection === "campos" && config.fieldId) {
1930
- if (!camposMap[config.fieldId]) {
1931
- camposMap[config.fieldId] = { operator: colOperator, values: [] };
1946
+ if (config.collection === "fields" && config.fieldId) {
1947
+ if (!fieldsMap[config.fieldId]) {
1948
+ fieldsMap[config.fieldId] = { operator: colOperator, values: [] };
1932
1949
  }
1933
1950
  constraints.forEach((c) => {
1934
1951
  const effectiveMatchMode = resolveMatchMode(c.matchMode, c.value);
1935
- const payload = buildFilterPayload(config.filterFieldCollection ?? "valor", effectiveMatchMode, c.value);
1936
- if (payload) camposMap[config.fieldId].values.push(payload);
1952
+ const payload = buildFilterPayload(config.filterFieldCollection ?? "value", effectiveMatchMode, c.value);
1953
+ if (payload) fieldsMap[config.fieldId].values.push(payload);
1937
1954
  });
1938
1955
  return;
1939
1956
  }
@@ -1968,13 +1985,13 @@ var mapPrimeToBackendFilters = (filters, globalFilterFields) => {
1968
1985
  }
1969
1986
  finalAnd.push({ [colOperator]: columnPayloads });
1970
1987
  });
1971
- Object.entries(camposMap).forEach(([fieldId, config]) => {
1988
+ Object.entries(fieldsMap).forEach(([fieldId, config]) => {
1972
1989
  if (!config.values.length) return;
1973
1990
  finalAnd.push({
1974
- collection: "campos",
1991
+ collection: "fields",
1975
1992
  any: {
1976
1993
  and: [
1977
- { field: "tipocampo.id", operator: "Equals", value: fieldId },
1994
+ { field: "fieldType.id", operator: "Equals", value: fieldId },
1978
1995
  { [config.operator]: config.values }
1979
1996
  ]
1980
1997
  }
@@ -2006,29 +2023,28 @@ function pushIntoCollectionTree(root, collectionPath, fieldName, payloadBase) {
2006
2023
  field: fieldName
2007
2024
  });
2008
2025
  }
2009
- function getMatchModeByTipo(tipo) {
2010
- switch (tipo) {
2011
- case "NumeroInteiro":
2012
- case "NumeroDecimal":
2026
+ function getMatchModeByTipo(type) {
2027
+ switch (type) {
2028
+ case "Integer":
2029
+ case "Decimal":
2013
2030
  return import_api3.FilterMatchMode.EQUALS;
2014
2031
  default:
2015
2032
  return import_api3.FilterMatchMode.CONTAINS;
2016
2033
  }
2017
2034
  }
2018
- function buildDynamicCampoFilters(campos) {
2019
- return campos?.reduce((acc, campo) => {
2020
- acc[`${campo.id}`] = {
2035
+ function buildDynamicFieldFilters(fields) {
2036
+ return fields?.reduce((acc, field) => {
2037
+ acc[`${field.id}`] = {
2021
2038
  operator: import_api3.FilterOperator.AND,
2022
2039
  constraints: [
2023
2040
  {
2024
2041
  value: null,
2025
- matchMode: getMatchModeByTipo(campo.tipoDado)
2042
+ matchMode: getMatchModeByTipo(field.documentType)
2026
2043
  }
2027
2044
  ],
2028
- collection: "campos",
2029
- filterFieldCollection: "valor",
2030
- fieldId: campo.id
2031
- // opcional (útil pro backend)
2045
+ collection: "fields",
2046
+ filterFieldCollection: "value",
2047
+ fieldId: field.id
2032
2048
  };
2033
2049
  return acc;
2034
2050
  }, {});
@@ -2081,14 +2097,14 @@ function buildSortingWithFilters(filters, sortField, order) {
2081
2097
  if (sortFilter?.fieldId) {
2082
2098
  sorting = [
2083
2099
  {
2084
- collection: "campos",
2100
+ collection: "fields",
2085
2101
  filter: {
2086
- field: "tipocampo.id",
2102
+ field: "fieldType.id",
2087
2103
  operator: "equals",
2088
2104
  value: sortFilter.fieldId
2089
2105
  },
2090
2106
  first: {
2091
- field: "valor",
2107
+ field: "value",
2092
2108
  direction
2093
2109
  }
2094
2110
  }
@@ -2474,7 +2490,7 @@ var import_api5 = require("primereact/api");
2474
2490
  SelectFilterTemplate,
2475
2491
  TextArea,
2476
2492
  ValueFilterTemplate,
2477
- buildDynamicCampoFilters,
2493
+ buildDynamicFieldFilters,
2478
2494
  buildSortingWithFilters,
2479
2495
  customMatchModes,
2480
2496
  defaultTheme,
package/dist/index.mjs CHANGED
@@ -30,7 +30,8 @@ var defaultTheme = {
30
30
  background: "#FFFFFF",
31
31
  text: "#18181B",
32
32
  placeholder: "#71717A",
33
- passwordToggle: "#71717A"
33
+ passwordToggle: "#71717A",
34
+ labelLine: "#FFFFFF"
34
35
  },
35
36
  fonts: {
36
37
  label: "Roboto, sans-serif",
@@ -71,6 +72,24 @@ var defaultTheme = {
71
72
  minWidth: "8rem",
72
73
  radius: "6px"
73
74
  }
75
+ },
76
+ modalBase: {
77
+ colors: {
78
+ modalTitleColor: "#000",
79
+ modalBgColor: "#fff",
80
+ modalCloseColor: "#bf1717",
81
+ modalBodyColor: "#000"
82
+ },
83
+ fonts: {
84
+ modalTitleFontFamily: '"Roboto", sans-serif',
85
+ modalTitleFontWeight: 600,
86
+ modalTitleFontSize: "13px",
87
+ modalBodyFontFamily: '"Roboto", sans-serif',
88
+ modalBodyFontSize: "1rem"
89
+ },
90
+ sizes: {
91
+ modalMaxWidth: "36rem"
92
+ }
74
93
  }
75
94
  }
76
95
  };
@@ -273,7 +292,7 @@ var InputBase = ({
273
292
  "--input-font-size": theme.components.input.fonts.inputSize,
274
293
  // Colors
275
294
  "--label-color": theme.components.input.colors.text,
276
- "--label-line": theme.colors.light,
295
+ "--label-line": theme.components.input.colors.labelLine,
277
296
  "--input-border": theme.components.input.colors.border,
278
297
  "--input-bg": theme.components.input.colors.background,
279
298
  "--autofill-box-shadow": theme.components.input.colors.background,
@@ -373,7 +392,7 @@ var TextAreaBase = ({
373
392
  "--input-font-size": theme.components.input.fonts.inputSize,
374
393
  // Colors
375
394
  "--label-color": theme.components.input.colors.text,
376
- "--label-line": theme.colors.light,
395
+ "--label-line": theme.components.input.colors.labelLine,
377
396
  "--input-border": theme.components.input.colors.border,
378
397
  "--input-bg": theme.components.input.colors.background,
379
398
  "--autofill-box-shadow": theme.components.input.colors.background,
@@ -464,7 +483,7 @@ var InputBase2 = ({
464
483
  "--label-color": theme.components.input.colors.text,
465
484
  "--input-border": theme.components.input.colors.border,
466
485
  "--input-bg": theme.components.input.colors.background,
467
- "--label-line": theme.colors.light,
486
+ "--label-line": theme.components.input.colors.labelLine,
468
487
  "--input-text-color": theme.colors.light,
469
488
  "--input-placeholder": theme.components.input.colors.placeholder,
470
489
  "--input-focus-border": theme.components.input.colors.focusBorder,
@@ -575,22 +594,20 @@ function ModalBase({
575
594
  btnCancel = "Cancel",
576
595
  btnSuccess = "Save",
577
596
  type = "button",
578
- disabledBtnSuccess,
579
- colors,
580
- fonts,
581
- modalMaxWidth
597
+ disabledBtnSuccess
582
598
  }) {
599
+ const theme = useLeafcodeTheme();
583
600
  const styleVars = {
584
- "--modal-title-font-weight": fonts?.modalTitleFontWeight,
585
- "--modal-title-font-size": fonts?.modalTitleFontSize,
586
- "--modal-title-font-family": fonts?.modalTitleFontFamily,
587
- "--modal-body-font-family": fonts?.modalBodyFontFamily,
588
- "--modal-body-font-size": fonts?.modalBodyFontSize,
589
- "--modal-bg-color": colors?.modalBgColor,
590
- "--modal-title-color": colors?.modalTitleColor,
591
- "--modal-body-color": colors?.modalBodyColor,
592
- "--modal-close-color": colors?.modalCloseColor,
593
- "--modal-max-width": modalMaxWidth?.modalMaxWidth
601
+ "--modal-title-font-weight": theme.components.modalBase.fonts?.modalTitleFontWeight,
602
+ "--modal-title-font-size": theme.components.modalBase.fonts?.modalTitleFontSize,
603
+ "--modal-title-font-family": theme.components.modalBase.fonts?.modalTitleFontFamily,
604
+ "--modal-body-font-family": theme.components.modalBase.fonts?.modalBodyFontFamily,
605
+ "--modal-body-font-size": theme.components.modalBase.fonts?.modalBodyFontSize,
606
+ "--modal-bg-color": theme.components.modalBase.colors?.modalBgColor,
607
+ "--modal-title-color": theme.components.modalBase.colors?.modalTitleColor,
608
+ "--modal-body-color": theme.components.modalBase.colors?.modalBodyColor,
609
+ "--modal-close-color": theme.components.modalBase.colors?.modalCloseColor,
610
+ "--modal-max-width": theme.components.modalBase.sizes.modalMaxWidth
594
611
  };
595
612
  useEffect3(() => {
596
613
  const handleKeyDown = (event) => {
@@ -693,7 +710,7 @@ function AutoCompleteInner(props, ref) {
693
710
  } = props;
694
711
  const theme = useLeafcodeTheme();
695
712
  const styleVars = {
696
- "--label-line": theme.colors.light,
713
+ "--label-line": theme.components.input.colors.labelLine,
697
714
  "--label-font-family": theme.components.input.fonts.label,
698
715
  "--label-font-weight": theme.components.input.fonts.labelWeight,
699
716
  "--label-font-size": theme.components.input.fonts.labelSize,
@@ -1833,7 +1850,7 @@ var buildFilterPayload = (fieldName, matchMode, rawValue) => {
1833
1850
  };
1834
1851
  var mapPrimeToBackendFilters = (filters, globalFilterFields) => {
1835
1852
  const finalAnd = [];
1836
- const camposMap = {};
1853
+ const fieldsMap = {};
1837
1854
  Object.entries(filters).forEach(([field, config]) => {
1838
1855
  if (!config) return;
1839
1856
  if (field === "global" && typeof config.value === "string" && config.value.trim() !== "") {
@@ -1874,14 +1891,14 @@ var mapPrimeToBackendFilters = (filters, globalFilterFields) => {
1874
1891
  }) : [];
1875
1892
  if (!constraints.length) return;
1876
1893
  const colOperator = config.operator === "or" ? "or" : "and";
1877
- if (config.collection === "campos" && config.fieldId) {
1878
- if (!camposMap[config.fieldId]) {
1879
- camposMap[config.fieldId] = { operator: colOperator, values: [] };
1894
+ if (config.collection === "fields" && config.fieldId) {
1895
+ if (!fieldsMap[config.fieldId]) {
1896
+ fieldsMap[config.fieldId] = { operator: colOperator, values: [] };
1880
1897
  }
1881
1898
  constraints.forEach((c) => {
1882
1899
  const effectiveMatchMode = resolveMatchMode(c.matchMode, c.value);
1883
- const payload = buildFilterPayload(config.filterFieldCollection ?? "valor", effectiveMatchMode, c.value);
1884
- if (payload) camposMap[config.fieldId].values.push(payload);
1900
+ const payload = buildFilterPayload(config.filterFieldCollection ?? "value", effectiveMatchMode, c.value);
1901
+ if (payload) fieldsMap[config.fieldId].values.push(payload);
1885
1902
  });
1886
1903
  return;
1887
1904
  }
@@ -1916,13 +1933,13 @@ var mapPrimeToBackendFilters = (filters, globalFilterFields) => {
1916
1933
  }
1917
1934
  finalAnd.push({ [colOperator]: columnPayloads });
1918
1935
  });
1919
- Object.entries(camposMap).forEach(([fieldId, config]) => {
1936
+ Object.entries(fieldsMap).forEach(([fieldId, config]) => {
1920
1937
  if (!config.values.length) return;
1921
1938
  finalAnd.push({
1922
- collection: "campos",
1939
+ collection: "fields",
1923
1940
  any: {
1924
1941
  and: [
1925
- { field: "tipocampo.id", operator: "Equals", value: fieldId },
1942
+ { field: "fieldType.id", operator: "Equals", value: fieldId },
1926
1943
  { [config.operator]: config.values }
1927
1944
  ]
1928
1945
  }
@@ -1954,29 +1971,28 @@ function pushIntoCollectionTree(root, collectionPath, fieldName, payloadBase) {
1954
1971
  field: fieldName
1955
1972
  });
1956
1973
  }
1957
- function getMatchModeByTipo(tipo) {
1958
- switch (tipo) {
1959
- case "NumeroInteiro":
1960
- case "NumeroDecimal":
1974
+ function getMatchModeByTipo(type) {
1975
+ switch (type) {
1976
+ case "Integer":
1977
+ case "Decimal":
1961
1978
  return FilterMatchMode3.EQUALS;
1962
1979
  default:
1963
1980
  return FilterMatchMode3.CONTAINS;
1964
1981
  }
1965
1982
  }
1966
- function buildDynamicCampoFilters(campos) {
1967
- return campos?.reduce((acc, campo) => {
1968
- acc[`${campo.id}`] = {
1983
+ function buildDynamicFieldFilters(fields) {
1984
+ return fields?.reduce((acc, field) => {
1985
+ acc[`${field.id}`] = {
1969
1986
  operator: FilterOperator.AND,
1970
1987
  constraints: [
1971
1988
  {
1972
1989
  value: null,
1973
- matchMode: getMatchModeByTipo(campo.tipoDado)
1990
+ matchMode: getMatchModeByTipo(field.documentType)
1974
1991
  }
1975
1992
  ],
1976
- collection: "campos",
1977
- filterFieldCollection: "valor",
1978
- fieldId: campo.id
1979
- // opcional (útil pro backend)
1993
+ collection: "fields",
1994
+ filterFieldCollection: "value",
1995
+ fieldId: field.id
1980
1996
  };
1981
1997
  return acc;
1982
1998
  }, {});
@@ -2029,14 +2045,14 @@ function buildSortingWithFilters(filters, sortField, order) {
2029
2045
  if (sortFilter?.fieldId) {
2030
2046
  sorting = [
2031
2047
  {
2032
- collection: "campos",
2048
+ collection: "fields",
2033
2049
  filter: {
2034
- field: "tipocampo.id",
2050
+ field: "fieldType.id",
2035
2051
  operator: "equals",
2036
2052
  value: sortFilter.fieldId
2037
2053
  },
2038
2054
  first: {
2039
- field: "valor",
2055
+ field: "value",
2040
2056
  direction
2041
2057
  }
2042
2058
  }
@@ -2421,7 +2437,7 @@ export {
2421
2437
  SelectFilterTemplate,
2422
2438
  TextArea,
2423
2439
  ValueFilterTemplate,
2424
- buildDynamicCampoFilters,
2440
+ buildDynamicFieldFilters,
2425
2441
  buildSortingWithFilters,
2426
2442
  customMatchModes,
2427
2443
  defaultTheme,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charlesgomes/leafcode-shared-lib-react",
3
- "version": "1.0.86",
3
+ "version": "1.0.88",
4
4
  "description": "Lib de componentes react",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",