@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.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +30 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -229,6 +229,7 @@ interface SearchOptions$1 {
|
|
|
229
229
|
caseSensitive?: boolean;
|
|
230
230
|
exact?: boolean;
|
|
231
231
|
value: string;
|
|
232
|
+
ignoredKeys?: string[];
|
|
232
233
|
}
|
|
233
234
|
interface UseGridProps$1<T> {
|
|
234
235
|
columns: ColumnsProps[];
|
|
@@ -396,6 +397,7 @@ interface IBaseDialogTriggerProps extends Omit<ButtonProps, 'name'> {
|
|
|
396
397
|
}
|
|
397
398
|
declare const BaseDialogTrigger: ({ name, onClick, ...props }: IBaseDialogTriggerProps) => React__default.JSX.Element;
|
|
398
399
|
declare const BaseDialogCreate: (name?: symbol) => {
|
|
400
|
+
name: symbol;
|
|
399
401
|
Trigger: (props: Omit<IBaseDialogTriggerProps, 'name'>) => React__default.JSX.Element;
|
|
400
402
|
Root: (props: Omit<IBaseDialogInstanceProviderProps, 'name'>) => React__default.JSX.Element;
|
|
401
403
|
Container: ({ children, ...rest }: IBaseDialogContainerProps) => React__default.JSX.Element;
|
|
@@ -404,6 +406,7 @@ declare const BaseDialogCreate: (name?: symbol) => {
|
|
|
404
406
|
};
|
|
405
407
|
declare const BaseDialog: {
|
|
406
408
|
Create: (name?: symbol) => {
|
|
409
|
+
name: symbol;
|
|
407
410
|
Trigger: (props: Omit<IBaseDialogTriggerProps, 'name'>) => React__default.JSX.Element;
|
|
408
411
|
Root: (props: Omit<IBaseDialogInstanceProviderProps, 'name'>) => React__default.JSX.Element;
|
|
409
412
|
Container: ({ children, ...rest }: IBaseDialogContainerProps) => React__default.JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -229,6 +229,7 @@ interface SearchOptions$1 {
|
|
|
229
229
|
caseSensitive?: boolean;
|
|
230
230
|
exact?: boolean;
|
|
231
231
|
value: string;
|
|
232
|
+
ignoredKeys?: string[];
|
|
232
233
|
}
|
|
233
234
|
interface UseGridProps$1<T> {
|
|
234
235
|
columns: ColumnsProps[];
|
|
@@ -396,6 +397,7 @@ interface IBaseDialogTriggerProps extends Omit<ButtonProps, 'name'> {
|
|
|
396
397
|
}
|
|
397
398
|
declare const BaseDialogTrigger: ({ name, onClick, ...props }: IBaseDialogTriggerProps) => React__default.JSX.Element;
|
|
398
399
|
declare const BaseDialogCreate: (name?: symbol) => {
|
|
400
|
+
name: symbol;
|
|
399
401
|
Trigger: (props: Omit<IBaseDialogTriggerProps, 'name'>) => React__default.JSX.Element;
|
|
400
402
|
Root: (props: Omit<IBaseDialogInstanceProviderProps, 'name'>) => React__default.JSX.Element;
|
|
401
403
|
Container: ({ children, ...rest }: IBaseDialogContainerProps) => React__default.JSX.Element;
|
|
@@ -404,6 +406,7 @@ declare const BaseDialogCreate: (name?: symbol) => {
|
|
|
404
406
|
};
|
|
405
407
|
declare const BaseDialog: {
|
|
406
408
|
Create: (name?: symbol) => {
|
|
409
|
+
name: symbol;
|
|
407
410
|
Trigger: (props: Omit<IBaseDialogTriggerProps, 'name'>) => React__default.JSX.Element;
|
|
408
411
|
Root: (props: Omit<IBaseDialogInstanceProviderProps, 'name'>) => React__default.JSX.Element;
|
|
409
412
|
Container: ({ children, ...rest }: IBaseDialogContainerProps) => React__default.JSX.Element;
|
package/dist/index.js
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__ */ React2.default.createElement(BaseDialogTrigger, __spreadValues({ name }, props)),
|
|
4313
4314
|
Root: (props) => /* @__PURE__ */ React2.default.createElement(BaseDialogInstanceProvider, __spreadValues({ name }, props)),
|
|
4314
4315
|
Container: BaseDialogContainer,
|
|
@@ -5140,39 +5141,53 @@ function useGrid({
|
|
|
5140
5141
|
clearSort
|
|
5141
5142
|
};
|
|
5142
5143
|
}
|
|
5143
|
-
|
|
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
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
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
|
}
|