Releases: lawvs/fn-sphere
@fn-sphere/[email protected]
Patch Changes
-
9badd88
Thanks @lawvs! - Breaking Changes- Renamed
filterGroup
prop torule
in FilterGroupContainer. - Modified
filterTheme
in theme-mui-material to userule
instead offilterGroup
.
- Renamed
-
50d4c0b
Thanks @lawvs! - - UpdatedFilterGroupContainer
template with improved layout and functionality.- Removed
variant="contained"
from Button component. - Updated
SingleFilter
template:- Replaced
DeleteIcon
withClearIcon
.
- Replaced
- Removed
-
Updated dependencies [
964faf3
,5f4d54f
,ef470f1
,62aeaf0
,a8b07f2
,200e5a1
,479f048
,9badd88
,8337984
,6be8772
]:- @fn-sphere/[email protected]
@fn-sphere/[email protected]
Minor Changes
-
ef470f1
Thanks @lawvs! - Breaking Changes- Now the first field and the first filter will be selected by default when creating a new rule.
- Updated
useFilterSphere
to usecreateDefaultRule
for default rule creation. - Updated
useFilterGroup
anduseFilterRule
to usecreateDefaultRule
when no input is provided.
- Updated
- Now the first field and the first filter will be selected by default when creating a new rule.
-
62aeaf0
Thanks @lawvs! - ExportfilterableFields
inuseRootRule
hook.
RemovefilterableFields
fromuseFilterRule
hook.BREAKING CHANGE: The
filterableFields
is now exported in theuseRootRule
hook instead of theuseFilterRule
hook.Migration:
+ const { filterableFields } = useRootRule(); - const { filterableFields } = useFilterRule(rule);
-
#51
a8b07f2
Thanks @lawvs! - Add locale supportsBREAKING CHANGE
- All name of filter has been changed.
- The
booleanFilter
has been removed.
-
9badd88
Thanks @lawvs! - Breaking Changes- Renamed
filterGroup
prop torule
in FilterGroupContainer. - Modified
filterTheme
in theme-mui-material to userule
instead offilterGroup
.
- Renamed
Patch Changes
-
5f4d54f
Thanks @lawvs! - RenameupdateRootRule
tosetRootRule
inuseRootRule
hookMigration:
- const { updateRootRule } = useRootRule(); + const { setRootRule } = useRootRule();
-
200e5a1
Thanks @lawvs! - DeprecatedgetRootRule
in favor ofrootRule
inuseRootRule
hook.Migration:
+ const { rootRule } = useRootRule(); - const { getRootRule } = useRootRule();
-
479f048
Thanks @lawvs! - Fix logical error intoggleGroupOp
function within theuseFilterGroup
hook -
8337984
Thanks @lawvs! - Support custom style for components -
Updated dependencies [
a8b07f2
,020bdb1
,a8b07f2
,01369a8
]:- @fn-sphere/[email protected]
@fn-sphere/[email protected]
Minor Changes
-
#51
a8b07f2
Thanks @lawvs! - Make string filter case insensitive -
#51
a8b07f2
Thanks @lawvs! - Add locale supportsBREAKING CHANGE
- All name of filter has been changed.
- The
booleanFilter
has been removed.
-
01369a8
Thanks @lawvs! - Breaking Changes- Removed support for array input in
defineTypedFn
anddefineGenericFn
.
- Removed support for array input in
Patch Changes
@fn-sphere/[email protected]
Minor Changes
-
ab1a0c6: - Deprecated
onPredicateChange
inuseFilterSphere
-
⚠️ BREAKING CHANGES- The
onRuleChange
callback inuseFilterSphere
now receives an object with bothfilterRule
andpredicate
properties, instead of just thefilterRule
. - The
onPredicateChange
callback has been removed. Use thepredicate
property in theonRuleChange
callback instead.
export interface FilterSphereInput<Data> extends BasicFilterSphereInput<Data> { onRuleChange?: (data: { filterRule: FilterGroup; predicate: (data: Data) => boolean; }) => void; } const { context } = useFilterSphere({ schema: YOUR_DATA_SCHEMA, onRuleChange: ({ predicate }) => { const filteredData = YOUR_DATA.filter(predicate); console.log(filteredData); }, });
- The
-
Migration Guide
const { context } = useFilterSphere({ schema: YOUR_DATA_SCHEMA, - onRuleChange: (filterRule) => { - console.log(filterRule); - }, - onPredicateChange: (predicate) => { - const filteredData = YOUR_DATA.filter(predicate); - console.log(filteredData); - }, + onRuleChange: ({ filterRule, predicate }) => { + const filteredData = YOUR_DATA.filter(predicate); + console.log(filterRule, filteredData); + }, });
-
-
87acc5e: - BREAKING CHANGES
updateInput
inDataInputViewProps
now use spread parameter to accept new values.
- updateInput([newValue]); + updateInput(newValue);
-
70565bc: - BREAKING CHANGES
- Increased spacing in templates
- Enhanced
SingleFilterContainer
styling:- Improved vertical alignment of child elements
- Remove
isValid
flag fromFilterRule
- Move
Add Condition
andAdd Group
buttons to theFilterGroupContainer
Patch Changes
@fn-sphere/[email protected]
@fn-sphere/[email protected]
Minor Changes
-
55b7fb1: - In
useFilterSelect
:- The
updateField
function has been deprecated and replaced withsetField
for clarity and consistency. - The
updateFilter
function has been deprecated and replaced withsetFilter
. - In
useFilterRule
:- The
updateRule
function has been renamed tosetRule
- Added a new
duplicateRule
function to duplicate a rule. - Added a new
invertRule
function.
- The
- In
useFilterGroup
anduseFilterRule
:- The parameter
SingleFilter
has been changed toSingleFilterInput
for simplicity. - The parameter
FilterGroup
has been changed toFilterGroupInput
for simplicity.
- The parameter
- The
-
e05bcbe: Removed inline theme merging logic from
FilterSphereProvider
.Introduced
createFilterTheme
for theme merging.Migration guide:
- <FilterSphereProvider theme={customTheme}> + const theme = createFilterTheme(customTheme); + <FilterSphereProvider theme={theme}>
Patch Changes
-
0ce4129: Add
tryRetainArgs
to allow retainingargs
when filter is changed -
d4c6a7d: - Update
useFilterSphere
hook to usepredicate
instead ofgetPredicate
:import { useFilterSphere } from "@fn-sphere/filter"; - const { rule, predicate, context } = useFilterSphere({ + const { rule, getPredicate, context } = useFilterSphere({ schema: YOUR_DATA_SCHEMA, }); - const filteredData = YOUR_DATA.filter(getPredicate()); + const filteredData = YOUR_DATA.filter(predicate);
- Update
countTotalRules()
toget totalRuleCount
inuseFilterSphere
hook - Add
validRuleCount
touseFilterSphere
hook to get the count of valid rules
- Update
-
c5ad41a: Add
countValidRules
function touseFilterSphere
hookconst { countValidRules } = useFilterSphere(); const validRulesCount = countValidRules();
-
311f306: - Added the ability to retain the current filter and arguments when the field is changed in the
useFilterSelect
hook.- Introduced the
UpdateFieldOptions
type to specify the behavior when updating the field. - Updated the
FieldSelect
component to pass theupdateFieldOptions
to theupdateField
function.
export type UpdateFieldOptions = { /** * Try to continue using the current filter when the field is changed. * * @default true */ tryRetainFilter?: boolean; /** * Automatically select the first filter when the field is changed and the filter is not retained. * * @default true */ autoSelectFirstFilter?: boolean; /** * Try to continue using the current args when the field is changed. * * @default true */ tryRetainArgs?: boolean; }; <FieldSelect rule={rule} tryRetainFilter autoSelectFirstFilter tryRetainArgs />;
- Introduced the
-
Updated dependencies [e0f5632]
-
Updated dependencies [744b13e]
-
Updated dependencies [b042713]
- @fn-sphere/[email protected]
@fn-sphere/[email protected]
@fn-sphere/[email protected]
Patch Changes
- 19e8e38: Update preset templates
- @fn-sphere/[email protected]
@fn-sphere/[email protected]
Patch Changes
- 715e792: Add
getLocaleText
API- @fn-sphere/[email protected]
@fn-sphere/[email protected]
@fn-sphere/[email protected]