Skip to content

Releases: lawvs/fn-sphere

@fn-sphere/[email protected]

29 Sep 16:10
Compare
Choose a tag to compare

Patch Changes

@fn-sphere/[email protected]

29 Sep 16:10
Compare
Choose a tag to compare

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 use createDefaultRule for default rule creation.
      • Updated useFilterGroup and useFilterRule to use createDefaultRule when no input is provided.
  • 62aeaf0 Thanks @lawvs! - Export filterableFields in useRootRule hook.
    Remove filterableFields from useFilterRule hook.

    BREAKING CHANGE: The filterableFields is now exported in the useRootRule hook instead of the useFilterRule hook.

    Migration:

    + const { filterableFields } = useRootRule();
    - const { filterableFields } = useFilterRule(rule);
  • #51 a8b07f2 Thanks @lawvs! - Add locale supports

    BREAKING CHANGE

    • All name of filter has been changed.
    • The booleanFilter has been removed.
  • 9badd88 Thanks @lawvs! - Breaking Changes

    • Renamed filterGroup prop to rule in FilterGroupContainer.
    • Modified filterTheme in theme-mui-material to use rule instead of filterGroup.

Patch Changes

  • 964faf3 Thanks @lawvs! - Add depth limit for filter group

  • 5f4d54f Thanks @lawvs! - Rename updateRootRule to setRootRule in useRootRule hook

    Migration:

    - const { updateRootRule } = useRootRule();
    + const { setRootRule } = useRootRule();
  • 200e5a1 Thanks @lawvs! - Deprecated getRootRule in favor of rootRule in useRootRule hook.

    Migration:

    + const { rootRule } = useRootRule();
    - const { getRootRule } = useRootRule();
  • 479f048 Thanks @lawvs! - Fix logical error in toggleGroupOp function within the useFilterGroup hook

  • 8337984 Thanks @lawvs! - Support custom style for components

  • 6be8772 Thanks @lawvs! - Support moveRule in useFilterRule

  • Updated dependencies [a8b07f2, 020bdb1, a8b07f2, 01369a8]:

@fn-sphere/[email protected]

29 Sep 16:10
Compare
Choose a tag to compare

Minor Changes

  • #51 a8b07f2 Thanks @lawvs! - Make string filter case insensitive

  • #51 a8b07f2 Thanks @lawvs! - Add locale supports

    BREAKING 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 and defineGenericFn.

Patch Changes

  • 020bdb1 Thanks @lawvs! - Add new utils function createDefaultRule

@fn-sphere/[email protected]

27 Aug 17:50
625fc0b
Compare
Choose a tag to compare

Minor Changes

  • ab1a0c6: - Deprecated onPredicateChange in useFilterSphere

    • ⚠️ BREAKING CHANGES

      • The onRuleChange callback in useFilterSphere now receives an object with both filterRule and predicate properties, instead of just the filterRule.
      • The onPredicateChange callback has been removed. Use the predicate property in the onRuleChange 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);
        },
      });
    • 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 in DataInputViewProps 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 from FilterRule
    • Move Add Condition and Add Group buttons to the FilterGroupContainer

Patch Changes

@fn-sphere/[email protected]

27 Aug 17:50
625fc0b
Compare
Choose a tag to compare

Patch Changes

  • f5eae65: Remove throw statements in filterFn
  • 2b17977: Support literal union in preset fn

@fn-sphere/[email protected]

11 Aug 08:19
3b53224
Compare
Choose a tag to compare

Minor Changes

  • 55b7fb1: - In useFilterSelect:

    • The updateField function has been deprecated and replaced with setField for clarity and consistency.
    • The updateFilter function has been deprecated and replaced with setFilter.
    • In useFilterRule:
      • The updateRule function has been renamed to setRule
      • Added a new duplicateRule function to duplicate a rule.
      • Added a new invertRule function.
    • In useFilterGroup and useFilterRule:
      • The parameter SingleFilter has been changed to SingleFilterInput for simplicity.
      • The parameter FilterGroup has been changed to FilterGroupInput for simplicity.
  • 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 retaining args when filter is changed

  • d4c6a7d: - Update useFilterSphere hook to use predicate instead of getPredicate:

    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() to get totalRuleCount in useFilterSphere hook
    • Add validRuleCount to useFilterSphere hook to get the count of valid rules
  • c5ad41a: Add countValidRules function to useFilterSphere hook

    const { 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 the updateFieldOptions to the updateField 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
    />;
  • Updated dependencies [e0f5632]

  • Updated dependencies [744b13e]

  • Updated dependencies [b042713]

@fn-sphere/[email protected]

11 Aug 08:19
3b53224
Compare
Choose a tag to compare

Patch Changes

  • e0f5632: Fix isValidRule incorrectly returned false for functions with skipValidate enabled

    Now, even if skipValidate is enabled, the input data is still checked for length.

  • 744b13e: Allow attaching meta to filter rule

  • b042713: Add countValidRules function

@fn-sphere/[email protected]

07 Aug 16:06
ee4de0e
Compare
Choose a tag to compare

Patch Changes

@fn-sphere/[email protected]

07 Aug 11:11
291fddf
Compare
Choose a tag to compare

Patch Changes

@fn-sphere/[email protected]

07 Aug 16:05
ee4de0e
Compare
Choose a tag to compare