-
-
Notifications
You must be signed in to change notification settings - Fork 999
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
Add Date filter to the DateTime column of table #1856
Conversation
请注意,我们采用了目前的实现,是有原因的。忽略掉毫秒部分是因为DatePicker组件并不支持修改毫秒值,而保留时间部分自然是因为——用户可能需要这一功能。诚然,只对日期进行筛选是一种常见需求,但显然这不能涵盖所有的应用场景。目前的实现对于只对日期进行筛选的场景,用户需要使用大于和小于规则,比较麻烦但是是可行的。 所以,请不要修改Equals规则的当前实现,请添加一个新的规则,名称可以是DateEquals,在新规则下实现这一功能。这是我解决这个问题的思路,类似的,可以实现MonthEquals等功能,来解决跨年份选取同一月份日期的场景。 |
我认为你说的很有道理, 我已经把修改还原, 并新增了相同日期与相同月份两个判断 |
DatePicker的ShowTime那里还是要判断一下,如果只对日期筛选就不需要ShowTime=true了 |
case TableFilterCompareOperator.TheSameDateWith: | ||
return Expression.LessThanOrEqual(Expression.Property(leftExpr, "Date"), | ||
Expression.Property(rightExpr, "Date")); | ||
case TableFilterCompareOperator.TheSameMonthWith: | ||
return Expression.LessThanOrEqual(Expression.Property(leftExpr, "Month"), | ||
Expression.Property(rightExpr, "Month")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该是Equal不是LessThanOrEqual,另外如果 比较月份 是 只比较 月 而 不比较 年 的话,UI那里可能用Select而不用DatePicker更合适?而且只加上Month规则可能有点突兀,要不你把Day规则也加上?要是拿不定主意的话可以先把Month规则去掉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不好意思, 我复制代码的时候忘记改了, 脑子有点糊涂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我先把 Month 规则去掉吧
Codecov Report
@@ Coverage Diff @@
## master #1856 +/- ##
===========================================
+ Coverage 0.00% 23.56% +23.56%
===========================================
Files 478 495 +17
Lines 31185 23235 -7950
Branches 0 121 +121
===========================================
+ Hits 0 5475 +5475
+ Misses 31185 17757 -13428
- Partials 0 3 +3
Continue to review full report at Codecov.
|
* fix(module: table): fix initial load and render (#1835) * fix(module: table): fix initial load and render * delete the useless method * chore: remove redundant semi-colons (#1812) Co-authored-by: James Yeung <shunjiey@hotmail.com> * fix(module: checkbox): checked state didn't follow the value change (#1841) * fix(module: menu): menu item click event should be triggered when menu selectable is false (#1843) * fix(module: tag): Tag component style parameters are not rendered (#1847) * fix(module: tag): Tag component style parameters are not rendered (#1846) * fix(module: tag): change call GetStyle in OnParameterSet Co-authored-by: haojiajun <haojiajun@vanelink.net> * fix(module: tree): SelectedNodeChanged would be fired twice twice (#1849) * fix(module: table): prevent propagation of expand button click events (#1850) * changelog 0.9.2 (#1851) * feat(module: upload): add method parameter (#1853) * add method parameter to upload component * update documentation * add test Co-authored-by: Noah Potash <noah.potash@outbreaklabs.com> * fix(module: table): avoid `OnChange` being called multiple times during initialization (#1855) * fix(module: table): avoid OnChange being called multiple times during initialisation * fix indent * fix(module: table): didn't refresh when using client side data source (#1858) * feat(module: table): add TheSameDateWith condition operator for DateTime column (#1856) * use date in datetime filter * fix spelling errors * Restore changes and add Date and Month FilterCompareOperator * hide time when filter date or month * Remove the month FilterCompareOperator * add locale data Co-authored-by: James Yeung <shunjiey@hotmail.com> * fix(module: checkbox): option change does not lock checkboxes (#1863) * fix(module: table): ignore milliseconds when applying the datetime filter (#1864) * remove milliseconds when filtering * remove the milliseconds when set the datetime filter value Co-authored-by: James Yeung <shunjiey@hotmail.com> * fix(module: input-number): default value binding (#1871) * fix(module: input-number): default value binding * fix default value * fix(module: autocomplete): overlay is showing for AutoCompleteSearch (#1860) * fix(module:autocomplete): overlay is showing for AutoCompleteSearch * translate comments * code cleanup Co-authored-by: ElderJames <shunjiey@hotmail.com> * fix(module: tag): rename `CheckedChange` to `CheckedChanged` (#1876) * Update Tag compliance with Blazor conventions Add the missing 'd' to CheckedChanged callback in order to properly support two ways binding on the Checked property * Fix references to renamed method in Tag component * Update tests for Tag Co-authored-by: Stefano Drussi <stefano.driussi@hotmail.it> Co-authored-by: James Yeung <shunjiey@hotmail.com> * feat(module: menu): Add IconTemplate for menu item (#1879) * docs: update CONTRIBUTING (#1882) * feat(module: breadcrumb): add `Href` parameter and overlay dropdown (#1859) * Setup breadcrumb dropdown * Setup breadcrumb href * fix dropdown style * fix dropdown trigger class * fix tests Co-authored-by: James Yeung <shunjiey@hotmail.com> * fix(module: table): call `StateHasChanged` in `InternalReload` (#1874) (#1875) * fix(module: table): not automatically load with ActionColumn (#1883) Fixed an issue where a table would not automatically load after initialization when an ActionColumn was used. * feat(module: table): add nested table demo (#1884) * fix(module: modal): auto focus the ok button and remove the focus of the trigger button (#1838) * fix: second opening of focus in modal fails if DestroyOnClose is false * fix: confirm cannot get focus element * fix: set ConfirmAutoFocusButton is OK * fix: module ImagePreview cannot close on second click * fix: blur active element when comfirm focus element is disabled * fix(module: table): fix the format issue of datetime samedate filter (#1889) * changelog 0.9.3 (#1890) Co-authored-by: Simon Cropp <simon.cropp@gmail.com> Co-authored-by: JohnHao421 <544106829@qq.com> Co-authored-by: haojiajun <haojiajun@vanelink.net> Co-authored-by: Noah Potash <digitalnugget@gmail.com> Co-authored-by: Noah Potash <noah.potash@outbreaklabs.com> Co-authored-by: SmallY <45689960+iamSmallY@users.noreply.github.com> Co-authored-by: Andrzej Bakun <andrzej@neelyc.com.cy> Co-authored-by: Stefano Driussi <stedri@gmail.com> Co-authored-by: Stefano Drussi <stefano.driussi@hotmail.it> Co-authored-by: Guyiming <guyiming2011@126.com> Co-authored-by: YongQuanRao <79885120+JamesGit-hash@users.noreply.github.com> Co-authored-by: Maksim <maksalmak@gmail.com> Co-authored-by: Nikolay Krondev <nikolaykrondev@users.noreply.github.com> Co-authored-by: zxyao <zxyao145@gmail.com> Co-authored-by: anranruye <54608128+anranruye@users.noreply.github.com>
…ime column (#1856) * use date in datetime filter * fix spelling errors * Restore changes and add Date and Month FilterCompareOperator * hide time when filter date or month * Remove the month FilterCompareOperator * add locale data Co-authored-by: James Yeung <shunjiey@hotmail.com>
* fix(module: table): fix initial load and render (#1835) * fix(module: table): fix initial load and render * delete the useless method * chore: remove redundant semi-colons (#1812) Co-authored-by: James Yeung <shunjiey@hotmail.com> * fix(module: checkbox): checked state didn't follow the value change (#1841) * fix(module: menu): menu item click event should be triggered when menu selectable is false (#1843) * fix(module: tag): Tag component style parameters are not rendered (#1847) * fix(module: tag): Tag component style parameters are not rendered (#1846) * fix(module: tag): change call GetStyle in OnParameterSet Co-authored-by: haojiajun <haojiajun@vanelink.net> * fix(module: tree): SelectedNodeChanged would be fired twice twice (#1849) * fix(module: table): prevent propagation of expand button click events (#1850) * changelog 0.9.2 (#1851) * feat(module: upload): add method parameter (#1853) * add method parameter to upload component * update documentation * add test Co-authored-by: Noah Potash <noah.potash@outbreaklabs.com> * fix(module: table): avoid `OnChange` being called multiple times during initialization (#1855) * fix(module: table): avoid OnChange being called multiple times during initialisation * fix indent * fix(module: table): didn't refresh when using client side data source (#1858) * feat(module: table): add TheSameDateWith condition operator for DateTime column (#1856) * use date in datetime filter * fix spelling errors * Restore changes and add Date and Month FilterCompareOperator * hide time when filter date or month * Remove the month FilterCompareOperator * add locale data Co-authored-by: James Yeung <shunjiey@hotmail.com> * fix(module: checkbox): option change does not lock checkboxes (#1863) * fix(module: table): ignore milliseconds when applying the datetime filter (#1864) * remove milliseconds when filtering * remove the milliseconds when set the datetime filter value Co-authored-by: James Yeung <shunjiey@hotmail.com> * fix(module: input-number): default value binding (#1871) * fix(module: input-number): default value binding * fix default value * fix(module: autocomplete): overlay is showing for AutoCompleteSearch (#1860) * fix(module:autocomplete): overlay is showing for AutoCompleteSearch * translate comments * code cleanup Co-authored-by: ElderJames <shunjiey@hotmail.com> * fix(module: tag): rename `CheckedChange` to `CheckedChanged` (#1876) * Update Tag compliance with Blazor conventions Add the missing 'd' to CheckedChanged callback in order to properly support two ways binding on the Checked property * Fix references to renamed method in Tag component * Update tests for Tag Co-authored-by: Stefano Drussi <stefano.driussi@hotmail.it> Co-authored-by: James Yeung <shunjiey@hotmail.com> * feat(module: menu): Add IconTemplate for menu item (#1879) * docs: update CONTRIBUTING (#1882) * feat(module: breadcrumb): add `Href` parameter and overlay dropdown (#1859) * Setup breadcrumb dropdown * Setup breadcrumb href * fix dropdown style * fix dropdown trigger class * fix tests Co-authored-by: James Yeung <shunjiey@hotmail.com> * fix(module: table): call `StateHasChanged` in `InternalReload` (#1874) (#1875) * fix(module: table): not automatically load with ActionColumn (#1883) Fixed an issue where a table would not automatically load after initialization when an ActionColumn was used. * feat(module: table): add nested table demo (#1884) * fix(module: modal): auto focus the ok button and remove the focus of the trigger button (#1838) * fix: second opening of focus in modal fails if DestroyOnClose is false * fix: confirm cannot get focus element * fix: set ConfirmAutoFocusButton is OK * fix: module ImagePreview cannot close on second click * fix: blur active element when comfirm focus element is disabled * fix(module: table): fix the format issue of datetime samedate filter (#1889) * changelog 0.9.3 (#1890) Co-authored-by: Simon Cropp <simon.cropp@gmail.com> Co-authored-by: JohnHao421 <544106829@qq.com> Co-authored-by: haojiajun <haojiajun@vanelink.net> Co-authored-by: Noah Potash <digitalnugget@gmail.com> Co-authored-by: Noah Potash <noah.potash@outbreaklabs.com> Co-authored-by: SmallY <45689960+iamSmallY@users.noreply.github.com> Co-authored-by: Andrzej Bakun <andrzej@neelyc.com.cy> Co-authored-by: Stefano Driussi <stedri@gmail.com> Co-authored-by: Stefano Drussi <stefano.driussi@hotmail.it> Co-authored-by: Guyiming <guyiming2011@126.com> Co-authored-by: YongQuanRao <79885120+JamesGit-hash@users.noreply.github.com> Co-authored-by: Maksim <maksalmak@gmail.com> Co-authored-by: Nikolay Krondev <nikolaykrondev@users.noreply.github.com> Co-authored-by: zxyao <zxyao145@gmail.com> Co-authored-by: anranruye <54608128+anranruye@users.noreply.github.com>
…ime column (#1856) * use date in datetime filter * fix spelling errors * Restore changes and add Date and Month FilterCompareOperator * hide time when filter date or month * Remove the month FilterCompareOperator * add locale data Co-authored-by: James Yeung <shunjiey@hotmail.com>
* fix(module: table): fix initial load and render (#1835) * fix(module: table): fix initial load and render * delete the useless method * chore: remove redundant semi-colons (#1812) Co-authored-by: James Yeung <shunjiey@hotmail.com> * fix(module: checkbox): checked state didn't follow the value change (#1841) * fix(module: menu): menu item click event should be triggered when menu selectable is false (#1843) * fix(module: tag): Tag component style parameters are not rendered (#1847) * fix(module: tag): Tag component style parameters are not rendered (#1846) * fix(module: tag): change call GetStyle in OnParameterSet Co-authored-by: haojiajun <haojiajun@vanelink.net> * fix(module: tree): SelectedNodeChanged would be fired twice twice (#1849) * fix(module: table): prevent propagation of expand button click events (#1850) * changelog 0.9.2 (#1851) * feat(module: upload): add method parameter (#1853) * add method parameter to upload component * update documentation * add test Co-authored-by: Noah Potash <noah.potash@outbreaklabs.com> * fix(module: table): avoid `OnChange` being called multiple times during initialization (#1855) * fix(module: table): avoid OnChange being called multiple times during initialisation * fix indent * fix(module: table): didn't refresh when using client side data source (#1858) * feat(module: table): add TheSameDateWith condition operator for DateTime column (#1856) * use date in datetime filter * fix spelling errors * Restore changes and add Date and Month FilterCompareOperator * hide time when filter date or month * Remove the month FilterCompareOperator * add locale data Co-authored-by: James Yeung <shunjiey@hotmail.com> * fix(module: checkbox): option change does not lock checkboxes (#1863) * fix(module: table): ignore milliseconds when applying the datetime filter (#1864) * remove milliseconds when filtering * remove the milliseconds when set the datetime filter value Co-authored-by: James Yeung <shunjiey@hotmail.com> * fix(module: input-number): default value binding (#1871) * fix(module: input-number): default value binding * fix default value * fix(module: autocomplete): overlay is showing for AutoCompleteSearch (#1860) * fix(module:autocomplete): overlay is showing for AutoCompleteSearch * translate comments * code cleanup Co-authored-by: ElderJames <shunjiey@hotmail.com> * fix(module: tag): rename `CheckedChange` to `CheckedChanged` (#1876) * Update Tag compliance with Blazor conventions Add the missing 'd' to CheckedChanged callback in order to properly support two ways binding on the Checked property * Fix references to renamed method in Tag component * Update tests for Tag Co-authored-by: Stefano Drussi <stefano.driussi@hotmail.it> Co-authored-by: James Yeung <shunjiey@hotmail.com> * feat(module: menu): Add IconTemplate for menu item (#1879) * docs: update CONTRIBUTING (#1882) * feat(module: breadcrumb): add `Href` parameter and overlay dropdown (#1859) * Setup breadcrumb dropdown * Setup breadcrumb href * fix dropdown style * fix dropdown trigger class * fix tests Co-authored-by: James Yeung <shunjiey@hotmail.com> * fix(module: table): call `StateHasChanged` in `InternalReload` (#1874) (#1875) * fix(module: table): not automatically load with ActionColumn (#1883) Fixed an issue where a table would not automatically load after initialization when an ActionColumn was used. * feat(module: table): add nested table demo (#1884) * fix(module: modal): auto focus the ok button and remove the focus of the trigger button (#1838) * fix: second opening of focus in modal fails if DestroyOnClose is false * fix: confirm cannot get focus element * fix: set ConfirmAutoFocusButton is OK * fix: module ImagePreview cannot close on second click * fix: blur active element when comfirm focus element is disabled * fix(module: table): fix the format issue of datetime samedate filter (#1889) * changelog 0.9.3 (#1890) Co-authored-by: Simon Cropp <simon.cropp@gmail.com> Co-authored-by: JohnHao421 <544106829@qq.com> Co-authored-by: haojiajun <haojiajun@vanelink.net> Co-authored-by: Noah Potash <digitalnugget@gmail.com> Co-authored-by: Noah Potash <noah.potash@outbreaklabs.com> Co-authored-by: SmallY <45689960+iamSmallY@users.noreply.github.com> Co-authored-by: Andrzej Bakun <andrzej@neelyc.com.cy> Co-authored-by: Stefano Driussi <stedri@gmail.com> Co-authored-by: Stefano Drussi <stefano.driussi@hotmail.it> Co-authored-by: Guyiming <guyiming2011@126.com> Co-authored-by: YongQuanRao <79885120+JamesGit-hash@users.noreply.github.com> Co-authored-by: Maksim <maksalmak@gmail.com> Co-authored-by: Nikolay Krondev <nikolaykrondev@users.noreply.github.com> Co-authored-by: zxyao <zxyao145@gmail.com> Co-authored-by: anranruye <54608128+anranruye@users.noreply.github.com>
…ime column (#1856) * use date in datetime filter * fix spelling errors * Restore changes and add Date and Month FilterCompareOperator * hide time when filter date or month * Remove the month FilterCompareOperator * add locale data Co-authored-by: James Yeung <shunjiey@hotmail.com>
* fix(module: table): fix initial load and render (#1835) * fix(module: table): fix initial load and render * delete the useless method * chore: remove redundant semi-colons (#1812) Co-authored-by: James Yeung <shunjiey@hotmail.com> * fix(module: checkbox): checked state didn't follow the value change (#1841) * fix(module: menu): menu item click event should be triggered when menu selectable is false (#1843) * fix(module: tag): Tag component style parameters are not rendered (#1847) * fix(module: tag): Tag component style parameters are not rendered (#1846) * fix(module: tag): change call GetStyle in OnParameterSet Co-authored-by: haojiajun <haojiajun@vanelink.net> * fix(module: tree): SelectedNodeChanged would be fired twice twice (#1849) * fix(module: table): prevent propagation of expand button click events (#1850) * changelog 0.9.2 (#1851) * feat(module: upload): add method parameter (#1853) * add method parameter to upload component * update documentation * add test Co-authored-by: Noah Potash <noah.potash@outbreaklabs.com> * fix(module: table): avoid `OnChange` being called multiple times during initialization (#1855) * fix(module: table): avoid OnChange being called multiple times during initialisation * fix indent * fix(module: table): didn't refresh when using client side data source (#1858) * feat(module: table): add TheSameDateWith condition operator for DateTime column (#1856) * use date in datetime filter * fix spelling errors * Restore changes and add Date and Month FilterCompareOperator * hide time when filter date or month * Remove the month FilterCompareOperator * add locale data Co-authored-by: James Yeung <shunjiey@hotmail.com> * fix(module: checkbox): option change does not lock checkboxes (#1863) * fix(module: table): ignore milliseconds when applying the datetime filter (#1864) * remove milliseconds when filtering * remove the milliseconds when set the datetime filter value Co-authored-by: James Yeung <shunjiey@hotmail.com> * fix(module: input-number): default value binding (#1871) * fix(module: input-number): default value binding * fix default value * fix(module: autocomplete): overlay is showing for AutoCompleteSearch (#1860) * fix(module:autocomplete): overlay is showing for AutoCompleteSearch * translate comments * code cleanup Co-authored-by: ElderJames <shunjiey@hotmail.com> * fix(module: tag): rename `CheckedChange` to `CheckedChanged` (#1876) * Update Tag compliance with Blazor conventions Add the missing 'd' to CheckedChanged callback in order to properly support two ways binding on the Checked property * Fix references to renamed method in Tag component * Update tests for Tag Co-authored-by: Stefano Drussi <stefano.driussi@hotmail.it> Co-authored-by: James Yeung <shunjiey@hotmail.com> * feat(module: menu): Add IconTemplate for menu item (#1879) * docs: update CONTRIBUTING (#1882) * feat(module: breadcrumb): add `Href` parameter and overlay dropdown (#1859) * Setup breadcrumb dropdown * Setup breadcrumb href * fix dropdown style * fix dropdown trigger class * fix tests Co-authored-by: James Yeung <shunjiey@hotmail.com> * fix(module: table): call `StateHasChanged` in `InternalReload` (#1874) (#1875) * fix(module: table): not automatically load with ActionColumn (#1883) Fixed an issue where a table would not automatically load after initialization when an ActionColumn was used. * feat(module: table): add nested table demo (#1884) * fix(module: modal): auto focus the ok button and remove the focus of the trigger button (#1838) * fix: second opening of focus in modal fails if DestroyOnClose is false * fix: confirm cannot get focus element * fix: set ConfirmAutoFocusButton is OK * fix: module ImagePreview cannot close on second click * fix: blur active element when comfirm focus element is disabled * fix(module: table): fix the format issue of datetime samedate filter (#1889) * changelog 0.9.3 (#1890) Co-authored-by: Simon Cropp <simon.cropp@gmail.com> Co-authored-by: JohnHao421 <544106829@qq.com> Co-authored-by: haojiajun <haojiajun@vanelink.net> Co-authored-by: Noah Potash <digitalnugget@gmail.com> Co-authored-by: Noah Potash <noah.potash@outbreaklabs.com> Co-authored-by: SmallY <45689960+iamSmallY@users.noreply.github.com> Co-authored-by: Andrzej Bakun <andrzej@neelyc.com.cy> Co-authored-by: Stefano Driussi <stedri@gmail.com> Co-authored-by: Stefano Drussi <stefano.driussi@hotmail.it> Co-authored-by: Guyiming <guyiming2011@126.com> Co-authored-by: YongQuanRao <79885120+JamesGit-hash@users.noreply.github.com> Co-authored-by: Maksim <maksalmak@gmail.com> Co-authored-by: Nikolay Krondev <nikolaykrondev@users.noreply.github.com> Co-authored-by: zxyao <zxyao145@gmail.com> Co-authored-by: anranruye <54608128+anranruye@users.noreply.github.com>
🤔 This is a ...
🔗 Related issue link
Fixes #1854
💡 Background and solution
The purpose of this PR is to modify the expected behavior of the default filter for the
DateTime
column of the table. The original default filter eliminates the milliseconds of the selected time when filtering, but does not eliminate the milliseconds in the data, resulting in the Equal option never being obtained the expected result.I think that usually only the year, month and day need to be considered when filtering the
DateTime
in the table, so the PR only keeps the year, month and day in the options and data when filtering, and removes the rest of the data.And this PR also fixes a spelling error.
📝 Changelog
GetDefaultCampareOperator
toGetDefaultCompareOperator
and addleftExpr = Expression.Property(leftExpr, "Date");
before compare theDateTime
☑️ Self Check before Merge