Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cdk:forms): add useuseAccessorAndControl, useAccessor, useControl #1012

Merged
merged 1 commit into from
Jul 13, 2022

Conversation

danranVm
Copy link
Member

@danranVm danranVm commented Jul 13, 2022

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added/updated or not needed
  • Docs and demo have been added/updated or not needed

What is the current behavior?

之前的 accessor 是一个 shallowReactive 对象,每次使用 value 或者 disabled 都得多访问一层:

  • accessor.valueRef.value
  • accessor.disabled.value
export interface ValueAccessor<T = any> {
  valueRef: ComputedRef<T>
  disabled: ComputedRef<boolean>
  markAsBlurred: () => void
  setValue: (value: T) => void
}

What is the new behavior?

现在的 accessor 是一个 reactive 对象,每次使用 value 或者 disabled 直接访问即可。

export interface FormAccessor<T = any> {
  value: T
  disabled: boolean
  markAsBlurred: () => void
  setValue: (value: T) => void
}

Other information

@idux-bot
Copy link

idux-bot bot commented Jul 13, 2022

This preview will be available after the AzureCI is passed.

@codecov
Copy link

codecov bot commented Jul 13, 2022

Codecov Report

Merging #1012 (743732b) into main (cf302ac) will decrease coverage by 0.22%.
The diff coverage is 96.22%.

❗ Current head 743732b differs from pull request most recent head bd9be2b. Consider uploading reports for the commit bd9be2b to get more accurate results

@@            Coverage Diff             @@
##             main    #1012      +/-   ##
==========================================
- Coverage   94.18%   93.96%   -0.23%     
==========================================
  Files         308      308              
  Lines       29052    29249     +197     
  Branches     3479     2519     -960     
==========================================
+ Hits        27364    27485     +121     
- Misses       1688     1764      +76     
Impacted Files Coverage Δ
packages/components/time-picker/src/TimePicker.tsx 31.25% <50.00%> (ø)
packages/components/rate/src/Rate.tsx 76.36% <80.00%> (+0.29%) ⬆️
packages/components/radio/src/Radio.tsx 93.41% <81.81%> (+0.07%) ⬆️
packages/components/checkbox/src/Checkbox.tsx 97.75% <90.90%> (+0.02%) ⬆️
packages/components/switch/src/Switch.tsx 94.56% <90.90%> (+0.24%) ⬆️
...ages/components/input-number/src/useInputNumber.ts 82.45% <94.11%> (+0.47%) ⬆️
packages/components/input/src/useInput.ts 92.25% <94.11%> (+0.40%) ⬆️
packages/cdk/forms/src/utils.ts 71.52% <97.09%> (-23.68%) ⬇️
packages/cdk/forms/src/controls.ts 100.00% <100.00%> (ø)
packages/cdk/utils/src/composable.ts 100.00% <100.00%> (ø)
... and 20 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cf302ac...bd9be2b. Read the comment docs.

@danranVm danranVm merged commit 6f4d3af into IDuxFE:main Jul 13, 2022
@danranVm danranVm deleted the feat-cdk-forms branch July 13, 2022 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant