@charlesgomes/leafcode-shared-lib-react 1.0.3 → 1.0.4

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
@@ -279,6 +279,7 @@ var import_jsx_runtime6 = require("react/jsx-runtime");
279
279
  function DynamicColumns({
280
280
  columns,
281
281
  isMultiSelectionMode = true,
282
+ isLanguagePtBr,
282
283
  onEdit,
283
284
  onDelete,
284
285
  customActionsColums = []
@@ -301,6 +302,7 @@ function DynamicColumns({
301
302
  columns.forEach((col, idx) => {
302
303
  const isActionsCol = col.field === "acoes";
303
304
  const width = isActionsCol && col?.size ? col.size + "rem" : "6rem";
305
+ const placeholder = isLanguagePtBr ? "Procurar" : "Search";
304
306
  array.push(
305
307
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
306
308
  import_column.Column,
@@ -313,7 +315,7 @@ function DynamicColumns({
313
315
  dataType: col.dataType,
314
316
  filterElement: col.filterElement ? (options) => col.filterElement?.(options, col.mask) ?? void 0 : void 0,
315
317
  filterMatchModeOptions: col.filterMatchModeOptions,
316
- filterPlaceholder: !isActionsCol ? "Procurar" : void 0,
318
+ filterPlaceholder: !isActionsCol ? placeholder : void 0,
317
319
  ...col.field !== "acoes" && {
318
320
  resizeable: col.enableResizeable ?? true
319
321
  },
@@ -380,7 +382,8 @@ function DataTableAdvancedFilterWrapper({
380
382
  disablePagination = false,
381
383
  sortFieldInitial,
382
384
  sortOrderInitial = 1,
383
- isMultiSelectionMode = true
385
+ isMultiSelectionMode = true,
386
+ isLanguagePtBr = true
384
387
  }) {
385
388
  const [isClient, setIsClient] = (0, import_react4.useState)(false);
386
389
  (0, import_react4.useEffect)(() => {
@@ -596,7 +599,8 @@ function DataTableAdvancedFilterWrapper({
596
599
  isMultiSelectionMode,
597
600
  onEdit,
598
601
  onDelete,
599
- customActionsColums
602
+ customActionsColums,
603
+ isLanguagePtBr
600
604
  })
601
605
  ]
602
606
  }
@@ -779,30 +783,40 @@ function DataTableAdvancedFilter({
779
783
  isLanguagePtBr = true
780
784
  }) {
781
785
  const [isClient, setIsClient] = (0, import_react6.useState)(false);
782
- (0, import_api2.addLocale)("pt", localePtBr);
783
- (0, import_api2.locale)("pt");
786
+ (0, import_react6.useEffect)(() => {
787
+ (0, import_api2.addLocale)("pt", localePtBr);
788
+ }, []);
789
+ (0, import_react6.useEffect)(() => {
790
+ (0, import_api2.locale)(isLanguagePtBr ? "pt" : "en");
791
+ }, [isLanguagePtBr]);
784
792
  (0, import_react6.useEffect)(() => {
785
793
  setIsClient(true);
786
794
  }, []);
787
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: isClient && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_api2.PrimeReactProvider, { value: isLanguagePtBr ? { locale: "pt" } : {}, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
788
- DataTableAdvancedFilterWrapper,
795
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: isClient && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
796
+ import_api2.PrimeReactProvider,
789
797
  {
790
- queryKey,
791
- mutationFn,
792
- columns,
793
- initFilters,
794
- onNew,
795
- onEdit,
796
- onDelete,
797
- customActions,
798
- customActionsColums,
799
- disablePagination,
800
- sortFieldInitial,
801
- sortOrderInitial,
802
- isMultiSelectionMode,
803
- isLanguagePtBr
798
+ value: isLanguagePtBr ? { locale: "pt" } : { locale: "en" },
799
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
800
+ DataTableAdvancedFilterWrapper,
801
+ {
802
+ queryKey,
803
+ mutationFn,
804
+ columns,
805
+ initFilters,
806
+ onNew,
807
+ onEdit,
808
+ onDelete,
809
+ customActions,
810
+ customActionsColums,
811
+ disablePagination,
812
+ sortFieldInitial,
813
+ sortOrderInitial,
814
+ isMultiSelectionMode,
815
+ isLanguagePtBr
816
+ }
817
+ )
804
818
  }
805
- ) }) });
819
+ ) });
806
820
  }
807
821
 
808
822
  // src/components/DataTableAdvancedFilter/FilterTemplates.tsx
package/dist/index.mjs CHANGED
@@ -234,6 +234,7 @@ import { jsx as jsx6 } from "react/jsx-runtime";
234
234
  function DynamicColumns({
235
235
  columns,
236
236
  isMultiSelectionMode = true,
237
+ isLanguagePtBr,
237
238
  onEdit,
238
239
  onDelete,
239
240
  customActionsColums = []
@@ -256,6 +257,7 @@ function DynamicColumns({
256
257
  columns.forEach((col, idx) => {
257
258
  const isActionsCol = col.field === "acoes";
258
259
  const width = isActionsCol && col?.size ? col.size + "rem" : "6rem";
260
+ const placeholder = isLanguagePtBr ? "Procurar" : "Search";
259
261
  array.push(
260
262
  /* @__PURE__ */ jsx6(
261
263
  Column,
@@ -268,7 +270,7 @@ function DynamicColumns({
268
270
  dataType: col.dataType,
269
271
  filterElement: col.filterElement ? (options) => col.filterElement?.(options, col.mask) ?? void 0 : void 0,
270
272
  filterMatchModeOptions: col.filterMatchModeOptions,
271
- filterPlaceholder: !isActionsCol ? "Procurar" : void 0,
273
+ filterPlaceholder: !isActionsCol ? placeholder : void 0,
272
274
  ...col.field !== "acoes" && {
273
275
  resizeable: col.enableResizeable ?? true
274
276
  },
@@ -335,7 +337,8 @@ function DataTableAdvancedFilterWrapper({
335
337
  disablePagination = false,
336
338
  sortFieldInitial,
337
339
  sortOrderInitial = 1,
338
- isMultiSelectionMode = true
340
+ isMultiSelectionMode = true,
341
+ isLanguagePtBr = true
339
342
  }) {
340
343
  const [isClient, setIsClient] = useState2(false);
341
344
  useEffect2(() => {
@@ -551,7 +554,8 @@ function DataTableAdvancedFilterWrapper({
551
554
  isMultiSelectionMode,
552
555
  onEdit,
553
556
  onDelete,
554
- customActionsColums
557
+ customActionsColums,
558
+ isLanguagePtBr
555
559
  })
556
560
  ]
557
561
  }
@@ -734,30 +738,40 @@ function DataTableAdvancedFilter({
734
738
  isLanguagePtBr = true
735
739
  }) {
736
740
  const [isClient, setIsClient] = useState3(false);
737
- addLocale("pt", localePtBr);
738
- locale("pt");
741
+ useEffect3(() => {
742
+ addLocale("pt", localePtBr);
743
+ }, []);
744
+ useEffect3(() => {
745
+ locale(isLanguagePtBr ? "pt" : "en");
746
+ }, [isLanguagePtBr]);
739
747
  useEffect3(() => {
740
748
  setIsClient(true);
741
749
  }, []);
742
- return /* @__PURE__ */ jsx8(Fragment4, { children: isClient && /* @__PURE__ */ jsx8(PrimeReactProvider, { value: isLanguagePtBr ? { locale: "pt" } : {}, children: /* @__PURE__ */ jsx8(
743
- DataTableAdvancedFilterWrapper,
750
+ return /* @__PURE__ */ jsx8(Fragment4, { children: isClient && /* @__PURE__ */ jsx8(
751
+ PrimeReactProvider,
744
752
  {
745
- queryKey,
746
- mutationFn,
747
- columns,
748
- initFilters,
749
- onNew,
750
- onEdit,
751
- onDelete,
752
- customActions,
753
- customActionsColums,
754
- disablePagination,
755
- sortFieldInitial,
756
- sortOrderInitial,
757
- isMultiSelectionMode,
758
- isLanguagePtBr
753
+ value: isLanguagePtBr ? { locale: "pt" } : { locale: "en" },
754
+ children: /* @__PURE__ */ jsx8(
755
+ DataTableAdvancedFilterWrapper,
756
+ {
757
+ queryKey,
758
+ mutationFn,
759
+ columns,
760
+ initFilters,
761
+ onNew,
762
+ onEdit,
763
+ onDelete,
764
+ customActions,
765
+ customActionsColums,
766
+ disablePagination,
767
+ sortFieldInitial,
768
+ sortOrderInitial,
769
+ isMultiSelectionMode,
770
+ isLanguagePtBr
771
+ }
772
+ )
759
773
  }
760
- ) }) });
774
+ ) });
761
775
  }
762
776
 
763
777
  // src/components/DataTableAdvancedFilter/FilterTemplates.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charlesgomes/leafcode-shared-lib-react",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Lib de componentes react",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",