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

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
@@ -1146,9 +1146,9 @@ var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
1146
1146
  };
1147
1147
  var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
1148
1148
  const resolvedItems = items ?? getDefaultFilterMatchOptionsString(isLanguagePtBr);
1149
- const currentFilter = options.value ?? {};
1150
- const currentValue = currentFilter.value ?? null;
1151
- const currentMatchMode = currentFilter.matchMode ?? "contains";
1149
+ const rawFilter = options.filterModel ?? {};
1150
+ const currentMatchMode = rawFilter.matchMode ?? "contains";
1151
+ const currentValue = typeof rawFilter.value === "string" ? rawFilter.value : "";
1152
1152
  const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
1153
1153
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1154
1154
  "div",
@@ -1173,15 +1173,8 @@ var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
1173
1173
  onChange: (e) => {
1174
1174
  const newMatchMode = e.value;
1175
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
1176
  options.filterCallback({
1184
- value: null,
1177
+ value: isNewSpecial ? null : null,
1185
1178
  matchMode: newMatchMode
1186
1179
  });
1187
1180
  }
@@ -1190,22 +1183,18 @@ var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
1190
1183
  !isSpecial && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1191
1184
  import_inputtext.InputText,
1192
1185
  {
1193
- value: currentValue ?? "",
1186
+ value: currentValue,
1194
1187
  placeholder: isLanguagePtBr ? "Pesquisar" : "Search",
1195
- style: { width: "100%" },
1196
1188
  className: "p-column-filter",
1189
+ style: { width: "100%" },
1197
1190
  onChange: (e) => {
1198
1191
  const value = e.target.value;
1199
1192
  if (value.trim()) {
1200
- options.filterCallback({
1201
- value,
1202
- matchMode: currentMatchMode
1203
- });
1193
+ options.filterCallback(
1194
+ value
1195
+ );
1204
1196
  } else {
1205
- options.filterCallback({
1206
- value: null,
1207
- matchMode: currentMatchMode
1208
- });
1197
+ options.filterCallback(null);
1209
1198
  }
1210
1199
  }
1211
1200
  }
package/dist/index.mjs CHANGED
@@ -1095,9 +1095,9 @@ var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
1095
1095
  };
1096
1096
  var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
1097
1097
  const resolvedItems = items ?? getDefaultFilterMatchOptionsString(isLanguagePtBr);
1098
- const currentFilter = options.value ?? {};
1099
- const currentValue = currentFilter.value ?? null;
1100
- const currentMatchMode = currentFilter.matchMode ?? "contains";
1098
+ const rawFilter = options.filterModel ?? {};
1099
+ const currentMatchMode = rawFilter.matchMode ?? "contains";
1100
+ const currentValue = typeof rawFilter.value === "string" ? rawFilter.value : "";
1101
1101
  const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
1102
1102
  return /* @__PURE__ */ jsxs6(
1103
1103
  "div",
@@ -1122,15 +1122,8 @@ var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
1122
1122
  onChange: (e) => {
1123
1123
  const newMatchMode = e.value;
1124
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
1125
  options.filterCallback({
1133
- value: null,
1126
+ value: isNewSpecial ? null : null,
1134
1127
  matchMode: newMatchMode
1135
1128
  });
1136
1129
  }
@@ -1139,22 +1132,18 @@ var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
1139
1132
  !isSpecial && /* @__PURE__ */ jsx11(
1140
1133
  InputText,
1141
1134
  {
1142
- value: currentValue ?? "",
1135
+ value: currentValue,
1143
1136
  placeholder: isLanguagePtBr ? "Pesquisar" : "Search",
1144
- style: { width: "100%" },
1145
1137
  className: "p-column-filter",
1138
+ style: { width: "100%" },
1146
1139
  onChange: (e) => {
1147
1140
  const value = e.target.value;
1148
1141
  if (value.trim()) {
1149
- options.filterCallback({
1150
- value,
1151
- matchMode: currentMatchMode
1152
- });
1142
+ options.filterCallback(
1143
+ value
1144
+ );
1153
1145
  } else {
1154
- options.filterCallback({
1155
- value: null,
1156
- matchMode: currentMatchMode
1157
- });
1146
+ options.filterCallback(null);
1158
1147
  }
1159
1148
  }
1160
1149
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charlesgomes/leafcode-shared-lib-react",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "description": "Lib de componentes react",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",