@bluemarble/bm-components 1.17.2 → 1.19.0

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.mjs CHANGED
@@ -4309,6 +4309,7 @@ var BaseDialogTrigger = (_a) => {
4309
4309
  };
4310
4310
  var BaseDialogCreate = (name = Symbol()) => {
4311
4311
  return {
4312
+ name,
4312
4313
  Trigger: (props) => /* @__PURE__ */ React28.createElement(BaseDialogTrigger, __spreadValues({ name }, props)),
4313
4314
  Root: (props) => /* @__PURE__ */ React28.createElement(BaseDialogInstanceProvider, __spreadValues({ name }, props)),
4314
4315
  Container: BaseDialogContainer,
@@ -5140,39 +5141,53 @@ function useGrid({
5140
5141
  clearSort
5141
5142
  };
5142
5143
  }
5143
- function searchKeysForValue(row, compare) {
5144
+ var isNumberOrString = (value) => ["number", "string"].includes(typeof value);
5145
+ var concatenateKey = (key, prev) => {
5146
+ if (!prev)
5147
+ return key;
5148
+ return `${prev}.${key}`;
5149
+ };
5150
+ function searchKeysForValue(row, accKey, compare) {
5144
5151
  if (typeof row === "undefined")
5145
5152
  return false;
5146
5153
  const rowKeys = Object.keys(row);
5147
5154
  let match = false;
5148
- const isNumberOrString = (value) => ["number", "string"].includes(typeof value);
5149
5155
  for (const key of rowKeys) {
5156
+ if (match)
5157
+ break;
5150
5158
  const objValue = row[key];
5151
- if (objValue) {
5152
- if (Array.isArray(objValue))
5153
- match = objValue.some(
5154
- (obj) => isNumberOrString(obj) ? compare(obj) : searchKeysForValue(obj, compare)
5155
- );
5156
- else if (typeof objValue === "object")
5157
- match = searchKeysForValue(objValue, compare);
5158
- else
5159
- match = compare(row[key]);
5160
- if (match)
5161
- return match;
5159
+ if (!objValue)
5160
+ continue;
5161
+ const concatenatedKey = concatenateKey(key, accKey);
5162
+ if (Array.isArray(objValue)) {
5163
+ match = objValue.some(
5164
+ (obj) => isNumberOrString(obj) ? compare(concatenatedKey, obj) : searchKeysForValue(obj, concatenatedKey, compare)
5165
+ );
5166
+ continue;
5167
+ }
5168
+ if (typeof objValue === "object") {
5169
+ match = searchKeysForValue(objValue, concatenatedKey, compare);
5170
+ continue;
5162
5171
  }
5172
+ match = compare(concatenatedKey, row[key]);
5163
5173
  }
5164
5174
  return match;
5165
5175
  }
5166
5176
  function createSearch(options) {
5167
5177
  const searchValue = options.caseSensitive ? options.value : String(options.value).toLowerCase();
5168
- function compare(objValue) {
5178
+ function compare(key, objValue) {
5179
+ if (options.ignoredKeys) {
5180
+ const isIgnoredKey = options.ignoredKeys.includes(key);
5181
+ if (isIgnoredKey)
5182
+ return false;
5183
+ }
5169
5184
  const value = options.caseSensitive ? String(objValue) : String(objValue).toLowerCase();
5170
5185
  if (options.exact)
5171
5186
  return value === searchValue;
5172
5187
  return value.includes(searchValue);
5173
5188
  }
5174
5189
  return (row) => {
5175
- const match = searchKeysForValue(row, compare);
5190
+ const match = searchKeysForValue(row, "", compare);
5176
5191
  return match;
5177
5192
  };
5178
5193
  }