@charlesgomes/leafcode-shared-lib-react 1.0.7 → 1.0.9

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
@@ -43,7 +43,7 @@ interface PaginatedResponse<T> {
43
43
  }
44
44
 
45
45
  interface ColumnCustom<T> {
46
- field: keyof T | "acoes" | string; // "acoes" não existe no User, então adicionamos manualmente
46
+ field: keyof T | "acoes" | "actions" | string;
47
47
  header: string;
48
48
  enableSorting?: boolean;
49
49
  size?: number;
@@ -67,10 +67,15 @@ interface ColumnCustom<T> {
67
67
 
68
68
  declare function DataTableAdvancedFilter<T extends object>({ queryKey, mutationFn, columns, initFilters, onNew, onEdit, onDelete, customActions, customActionsColums, disablePagination, sortFieldInitial, sortOrderInitial, isMultiSelectionMode, isLanguagePtBr, }: IDataTableProps<T>): react_jsx_runtime.JSX.Element;
69
69
 
70
+ interface IItemProps {
71
+ value: string;
72
+ label: string;
73
+ }
74
+
70
75
  declare const DateFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
71
76
  declare const DateTimeFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
72
77
  declare const ValueFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
73
- declare const SelectFilterTemplate: (options: any, isLanguagePtBr?: boolean) => react_jsx_runtime.JSX.Element;
78
+ declare const SelectFilterTemplate: (options: any, isLanguagePtBr?: boolean, items?: IItemProps[]) => react_jsx_runtime.JSX.Element;
74
79
 
75
80
  declare const getDefaultFilterMatchOptionsString: (isLanguagePtBr?: boolean) => {
76
81
  label: string;
@@ -81,9 +86,4 @@ declare const getDefaultFilterMatchOptionsDate: (isLanguagePtBr: boolean) => {
81
86
  value: FilterMatchMode;
82
87
  }[];
83
88
 
84
- interface IItemProps {
85
- value: string;
86
- label: string;
87
- }
88
-
89
89
  export { Botao, type BotaoProps, type ColumnCustom, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, SelectFilterTemplate, ValueFilterTemplate, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsString };
package/dist/index.d.ts CHANGED
@@ -43,7 +43,7 @@ interface PaginatedResponse<T> {
43
43
  }
44
44
 
45
45
  interface ColumnCustom<T> {
46
- field: keyof T | "acoes" | string; // "acoes" não existe no User, então adicionamos manualmente
46
+ field: keyof T | "acoes" | "actions" | string;
47
47
  header: string;
48
48
  enableSorting?: boolean;
49
49
  size?: number;
@@ -67,10 +67,15 @@ interface ColumnCustom<T> {
67
67
 
68
68
  declare function DataTableAdvancedFilter<T extends object>({ queryKey, mutationFn, columns, initFilters, onNew, onEdit, onDelete, customActions, customActionsColums, disablePagination, sortFieldInitial, sortOrderInitial, isMultiSelectionMode, isLanguagePtBr, }: IDataTableProps<T>): react_jsx_runtime.JSX.Element;
69
69
 
70
+ interface IItemProps {
71
+ value: string;
72
+ label: string;
73
+ }
74
+
70
75
  declare const DateFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
71
76
  declare const DateTimeFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
72
77
  declare const ValueFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
73
- declare const SelectFilterTemplate: (options: any, isLanguagePtBr?: boolean) => react_jsx_runtime.JSX.Element;
78
+ declare const SelectFilterTemplate: (options: any, isLanguagePtBr?: boolean, items?: IItemProps[]) => react_jsx_runtime.JSX.Element;
74
79
 
75
80
  declare const getDefaultFilterMatchOptionsString: (isLanguagePtBr?: boolean) => {
76
81
  label: string;
@@ -81,9 +86,4 @@ declare const getDefaultFilterMatchOptionsDate: (isLanguagePtBr: boolean) => {
81
86
  value: FilterMatchMode;
82
87
  }[];
83
88
 
84
- interface IItemProps {
85
- value: string;
86
- label: string;
87
- }
88
-
89
89
  export { Botao, type BotaoProps, type ColumnCustom, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, SelectFilterTemplate, ValueFilterTemplate, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsString };
package/dist/index.js CHANGED
@@ -336,7 +336,7 @@ function DynamicColumns({
336
336
  );
337
337
  }
338
338
  columns.forEach((col, idx) => {
339
- const isActionsCol = col.field === "acoes";
339
+ const isActionsCol = col.field === "acoes" || col.field === "actions";
340
340
  const width = isActionsCol && col?.size ? col.size + "rem" : "6rem";
341
341
  const placeholder = isLanguagePtBr ? "Procurar" : "Search";
342
342
  array.push(
@@ -352,7 +352,7 @@ function DynamicColumns({
352
352
  filterElement: col.filterElement ? (options) => col.filterElement?.(options, col.mask) ?? void 0 : void 0,
353
353
  filterMatchModeOptions: col.filterMatchModeOptions,
354
354
  filterPlaceholder: !isActionsCol ? placeholder : void 0,
355
- ...col.field !== "acoes" && {
355
+ ...(col.field !== "acoes" || col.field !== "actions") && {
356
356
  resizeable: col.enableResizeable ?? true
357
357
  },
358
358
  style: isActionsCol ? { width, minWidth: width, position: "relative" } : {},
@@ -454,7 +454,7 @@ function DataTableAdvancedFilterWrapper({
454
454
  const filtersKey = JSON.stringify(debouncedFilters);
455
455
  const globalFilterFields = (0, import_react4.useMemo)(() => {
456
456
  return columns?.filter(
457
- (col) => col.filterGlobal === true && col.field !== "acoes"
457
+ (col) => col.filterGlobal === true && (col.field !== "acoes" || col.field !== "actions")
458
458
  ).map((col) => col.field) ?? [];
459
459
  }, [columns]);
460
460
  const { data: customers, isLoading } = (0, import_react_query.useQuery)({
@@ -934,8 +934,8 @@ var ValueFilterTemplate = (options, mask) => {
934
934
  }
935
935
  );
936
936
  };
937
- var SelectFilterTemplate = (options, isLanguagePtBr = true) => {
938
- const selectOptions = [
937
+ var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
938
+ const selectOptions = items.length > 0 ? items : [
939
939
  { label: isLanguagePtBr ? "Todos" : "All", value: null },
940
940
  { label: isLanguagePtBr ? "Sim" : "Yes", value: true },
941
941
  { label: isLanguagePtBr ? "N\xE3o" : "No", value: false }
package/dist/index.mjs CHANGED
@@ -291,7 +291,7 @@ function DynamicColumns({
291
291
  );
292
292
  }
293
293
  columns.forEach((col, idx) => {
294
- const isActionsCol = col.field === "acoes";
294
+ const isActionsCol = col.field === "acoes" || col.field === "actions";
295
295
  const width = isActionsCol && col?.size ? col.size + "rem" : "6rem";
296
296
  const placeholder = isLanguagePtBr ? "Procurar" : "Search";
297
297
  array.push(
@@ -307,7 +307,7 @@ function DynamicColumns({
307
307
  filterElement: col.filterElement ? (options) => col.filterElement?.(options, col.mask) ?? void 0 : void 0,
308
308
  filterMatchModeOptions: col.filterMatchModeOptions,
309
309
  filterPlaceholder: !isActionsCol ? placeholder : void 0,
310
- ...col.field !== "acoes" && {
310
+ ...(col.field !== "acoes" || col.field !== "actions") && {
311
311
  resizeable: col.enableResizeable ?? true
312
312
  },
313
313
  style: isActionsCol ? { width, minWidth: width, position: "relative" } : {},
@@ -409,7 +409,7 @@ function DataTableAdvancedFilterWrapper({
409
409
  const filtersKey = JSON.stringify(debouncedFilters);
410
410
  const globalFilterFields = useMemo(() => {
411
411
  return columns?.filter(
412
- (col) => col.filterGlobal === true && col.field !== "acoes"
412
+ (col) => col.filterGlobal === true && (col.field !== "acoes" || col.field !== "actions")
413
413
  ).map((col) => col.field) ?? [];
414
414
  }, [columns]);
415
415
  const { data: customers, isLoading } = useQuery({
@@ -889,8 +889,8 @@ var ValueFilterTemplate = (options, mask) => {
889
889
  }
890
890
  );
891
891
  };
892
- var SelectFilterTemplate = (options, isLanguagePtBr = true) => {
893
- const selectOptions = [
892
+ var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
893
+ const selectOptions = items.length > 0 ? items : [
894
894
  { label: isLanguagePtBr ? "Todos" : "All", value: null },
895
895
  { label: isLanguagePtBr ? "Sim" : "Yes", value: true },
896
896
  { label: isLanguagePtBr ? "N\xE3o" : "No", value: false }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charlesgomes/leafcode-shared-lib-react",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Lib de componentes react",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",