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

fix(module:datepicker): validate manually entered date against format #1389

Merged

Conversation

anddrzejb
Copy link
Member

@anddrzejb anddrzejb commented Apr 19, 2021

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • Bundle size optimization
  • Performance optimization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

Fixes #1354

💡 Background and solution

Previous string analyzer for manually entered date was very crud and was working with really overarching assumptions (I am bashing myself, as I was the one to create it). Current analyzer is meant to be much more versatile.

datePicker_manualEntryValidation

However...
It seems to me that generally current format handling is incorrect and I believe it should be altered. At this stage, regional settings of the client's browser are completely ignored. Unless Format parameter is set, the format is always yyyy-MM-dd (if time the also + HH:mm:ss), regardless of browser's regional settings. Have a look at this line (this is a link to code before this PR), and you will see it is hardcoded. Shouldn't the format be taken from DatePickerLocale? And if consumer wants to alter format for only particular DatePicker, then should revert to Format property.
I know antD seems to ignore regional settings, but I think this is incorrect.

Also, FormatAnalyzer introduced by this PR basically handles standard date inputs - it does not (yet?) handles Week and Quarter input types. It could be probably(?) done, but I'd like to first address the regional settings issue.

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Changelog is provided or not needed

@github-actions
Copy link

github-actions bot commented Apr 19, 2021

@codecov-commenter
Copy link

codecov-commenter commented Apr 19, 2021

Codecov Report

Merging #1389 (d9934b8) into master (a0e1c40) will increase coverage by 0.80%.
The diff coverage is 68.81%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1389      +/-   ##
=========================================
+ Coverage    7.23%   8.04%   +0.80%     
=========================================
  Files         450     451       +1     
  Lines       28290   28528     +238     
=========================================
+ Hits         2047    2294     +247     
+ Misses      26243   26234       -9     
Impacted Files Coverage Δ
components/date-picker/DatePicker.Razor.cs 0.00% <0.00%> (ø)
components/date-picker/RangePicker.razor.cs 0.00% <0.00%> (ø)
components/date-picker/internal/DatePickerBase.cs 0.00% <0.00%> (ø)
components/date-picker/locale/FormatAnalyzer.cs 93.59% <93.59%> (ø)
components/date-picker/locale/DatePickerLocale.cs 98.18% <100.00%> (+98.18%) ⬆️
...onents/core/Extensions/DataConvertionExtensions.cs 100.00% <0.00%> (+100.00%) ⬆️

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 a0e1c40...d9934b8. Read the comment docs.

@Zonciu
Copy link
Member

Zonciu commented Apr 19, 2021

I think this should not be updated to 0205 year until the year string has 4 number characters.
image

Check ant design react version:
image

@anddrzejb
Copy link
Member Author

It is not updated. At least not the value. You are indeed getting a visual cue where you currently are, but the values are not selected at least until you enter a full date. If you press enter, then indeed the app will try to apply unexpected date.
Here is my comparison (for range, but same thing apply to datepicker):
datePicker_manualEntryValidation_feature

So in order of operations:

  1. Date was selected using mouse. Selected date is 2021-04-19 (I will omit time here, event though it can easily also take part in observing the changes).
  2. Caret is set on the first digit of the year, and that first digit is deleted. Typed date is 021-04-19
  3. Panel focuses on year 0021-04 but no day is highlighted. That means the value was not yet changed. Lack of change is visible in the browser's console.
  4. "0" is added so now the typed date is 0021-04-19. This makes the date valid and you can see that reflected in the console.

If in point 4. instead of pressing "0", you would press "Enter", then the value would be set to 0021-04-19.

So, depending on a point of view, one could consider viewing the year you are currently typing as a feature. True, not intended, but once I saw it I figured it could be useful (at least I know I wanted to have a way to "peek" into a specific month without applying any changes).

This is though flushing a problem with the code - OnChange event should not be fired, at least not until the change is acceptable - so I will fix that when we resolve this conversation & hopefully I will get a feedback on the comments I made in the initial PR comment.

Sorry for the gif not being as slow as I hoped it will be - it may be hard to follow (that is why I added the operations). My skills in gif editing area are still lacking...

@Zonciu
Copy link
Member

Zonciu commented Apr 20, 2021

I mean here:
image

The date picker body should not render a invalid date at this moment, until the input string matches the format.

And the day selected mark is missing, according to this test: https://github.com/ant-design-blazor/ant-design-blazor/pull/1389/files#diff-71952683b85054528af1c8883b3cb5ac5eef189b255d831371e6dc489a01bd7fR38

@ElderJames ElderJames requested a review from Zonciu April 20, 2021 03:32
@ElderJames ElderJames added this to the 0.9.0 - MILESTONE: May 2021 milestone Apr 20, 2021
@anddrzejb
Copy link
Member Author

I think we clearly differ in opinion here - this is the part I was considering a feature. But since you are the reviewer, I applied the requested changes in commit 9a5b3d5.

@anddrzejb
Copy link
Member Author

@Zonciu Commit ed5ba0a & a845ff2 address the conversation we had on discord and the issue you mentioned there.

I was trying to recreate your issue after my changes, and I couldn't. My current results:

  1. AntBlazor docs (wasm) with switch to locale:
    datePicker_stringValid_Chinese

  2. AntBlazor docs (wasm) issue recreation:
    datePicker_stringValidatorWasmDocs

  3. My tests with different combinations of current culture, locale, Format and default:
    datePicker_stringValidatorServer

Here's the code if you would like to test it:

@using System.Globalization
@using System.Text.Json;
@CultureInfo.CurrentCulture.Name /(ui) @CultureInfo.CurrentUICulture.Name<br />
<DatePicker TValue="DateTime?" ShowTime="@true" Placeholder="@("Current culture")"/>
<br />
<br />
<DatePicker TValue="DateTime?" ShowTime="@true" Format="yyyy/MM/dd" Placeholder="@("Format set")"/>
<br />
<br />
<DatePicker TValue="DateTime?" Picker="@DatePickerType.Date" Locale="@CN" CultureInfo="CiCn" 
            Placeholder="@("CultureInfo=CiCn")"/>
<br />
<br />
<DatePicker TValue="DateTime?" Picker="@DatePickerType.Date" Locale="@CN" Format="yyyy/MM/dd" 
            Placeholder="@("Locale=CN & Placeholder")"/>

@code
{
    CultureInfo CiCn = CultureInfo.GetCultureInfo("zh-CN");
    DatePickerLocale CN = new DatePickerLocale
    {
        FirstDayOfWeek = DayOfWeek.Sunday,
        Lang = new DateLocale
        {
            YearFormat = "yyyy年",
            MonthFormat = "M月",
            DateSelect = "选择日期",
            WeekSelect = "选择周",
            MonthSelect = "选择月份",
            YearSelect = "选择年份",
            QuarterSelect = "选择季度",
            Today = "今天",
            DateFormat = "yyyy MM dd"
        }
    };
}

On top of that, I also found another issue. If you use Placeholder, it will only be shown in the beginning, then it will revert to defaults in locale. This is of course solvable, but in locale we have for example DateSelect and DatePlaceholder, they both contain the same. I think they are duplicating here, correct? So we either pick *Placeholder or *Select... And here is the issue recreation:
datePicker_vanishingPlaceholder

@anddrzejb anddrzejb closed this Apr 20, 2021
@anddrzejb anddrzejb reopened this Apr 20, 2021
@anddrzejb
Copy link
Member Author

@Zonciu Commit dd21191 added handling of manual entry for week, month, quarter & year mode.

Suffix is handled for picker type = "year"
Tests include validation of not changing state
@anddrzejb
Copy link
Member Author

@Zonciu Commit c889ca0 contains fixes for suffix in year. I also added handling prefix in a date, for formats like this XXyyyyZ will be handled properly as well.

@anddrzejb
Copy link
Member Author

@Zonciu Commit 19834f2 addresses only resetting dates when in conflict. It does not address any visual issues.

@anddrzejb
Copy link
Member Author

@Zonciu just found another bug, new commit 916a840. This thing was really troublesome... Anyway, hope you will not find any bugs in this one either.

@anddrzejb anddrzejb requested a review from Zonciu April 27, 2021 13:24
@Zonciu
Copy link
Member

Zonciu commented Apr 27, 2021

Unfortunately, I did find some bugs...

1.

<RangePicker TValue="DateTime?[]" ShowTime="@true" />

When I select the end date and click Ok button, the date panel will be closed, it should switch the input cursor to start date. If I press Enter key in the end date picker, it works fine.


2.

When I set the end quarter, the same quarter of the start quarter is disabled, it should be enabled.

image

@anddrzejb
Copy link
Member Author

These are both pre-existing bugs not really related to this PR. From what I can see they originate from the panels. I know about couple other bugs in there that I did not address in here,
For instance, there is week counting bug. Or bug that allows to select disabled dates (I am not talking about entering using keyboard but with a mouse click). As we once stated in our discord discussion, I intend to create issue for these, once this one is merged (or dropped although I really hope it will not be dropped 😏 ).

@Zonciu
Copy link
Member

Zonciu commented Apr 27, 2021

OK, then we'll leave the rest of the bugs for the next PR.

Zonciu
Zonciu previously approved these changes Apr 27, 2021
@ElderJames ElderJames enabled auto-merge (squash) April 28, 2021 03:29
@ElderJames ElderJames merged commit c65f0d5 into ant-design-blazor:master Apr 28, 2021
@anddrzejb anddrzejb deleted the datePickerManualEntryValidation branch April 28, 2021 03:55
ElderJames added a commit that referenced this pull request May 16, 2021
* fix(module: select): enum default value protection (#1368)

* fix(module: affix): can't affix while OffsetTop is zero (#1373)

* fix(module: affix): can't affix while OffsetTop is zero

* use affixed setter for rerendering

* limit rerendering

* fix(module: input): binding data when the Enter key is pressed (#1375)

* fix(module: table): ellipsis can't work (#1376)

* feat: add element component (#1378)

* refactor: rename `HtmlElement` property case

* rename the directory name for overlay

* add element component

* fix(module: table): Unify FieldName, add DisplayAttribute for DiplayName, fix Filter for DataIndex (#1372)

* fix(module: table): Unify FieldName value

* fix(module: table): Get column name from DisplayAttribute

* fix(module: table): Filter for DataIndex

* docs(module: table): Intuitive sorterCompare for Filter demo

* fix(module: table): fix header title doesn't display when Sortable is false

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(dialog): add Dispose lifecycle function to Dialog (#1379)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: input): preserve focus and caret position for input password when visibility is toggled (#1377)

* set focus when the password button is clicked

* add methods for selection

* set selectionStart after Focus

* fix typescript

* set selectionEnd as well

* fix a stupid if-condition-bug

* remove checks for element

* add selectionStart to getDomInfo

* get selectionStart from Element

* delete unneeded js method

Co-authored-by: mihails.kuzmins <mihails.kuzmins@daytongroup.lv>
Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: table): can not use DataIndex nullable mode with not nullable property (#1382)

* fix(module: table): column header sorter not refresh after ClearSorter is called (#1385)

* fix(module:table): column header sorter not refresh after ClearSorter is called

* add judgment condition for calling StateHasChanged in IFieldColumn.ClearSorter()

* fix(module: form): validation message unique (#1391)

* fix(module: tag): closable typo and delete mode (#1393)

* fix(module: tag): closable typo and delete mode

* return early

* test(module: divider): divider tests (#1397)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* feat(module: modal): support define modal's style in ModalOptions (#1400)

* fix(module: checkbox & switch): Checked parameter binding (#1394)

* fix(module:checkbox): allow binding to Checked parameter

* fix(module:switch): allow binding to Checked parameter

* fix(modules): checkbox & switch get AntInputBoolComponentBase class

* test(module:switch): add tests

* test(module:checkbox): add tests

* test(module:divider): simplify by using id:ignore

* docs(module:checkbox): bind example

* docs(module:switch): bind example

* fix(module:switch): add Control + docs + tests

* feat(module:checkboxgroup): add layout and mixed mode

* fix: review comments + tests

* fix(module:checkboxgroup): parameter name should be MixedMode

added more tests

* fix demo

* fix(module:checkboxgroup): allow toggling between modes

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: select): OnDataSourceChange called when expected (#1419)

* fix(module:select): OnDataSourceChange called when expected

* test(module:select): add missing scenario

* fix(module: table): DataIndex filter pop up (#1421)

* fix(module:overlayTrigger): TrigerRefernece points to OverlayTrigger.Ref.

* fix(module:overlay): Show waits for competing code to finish

* Update OverlayTrigger.razor.cs

* clean code

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* feat: use ResizeObserver Api instead of window.resize (#1392)

* feat: use ResizeObserver Api instead of window.resize

* fix(module:select): fall back to window.resize in IE11.

* fix(module:domEventService): switch from IsIE11 to IsResizeObserverSupported

* fix: Console.WriteLine removed

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: table): check null in set sorter method (#1423)

* fix(module: datepicker): validate manually entered date against format (#1389)

* fix(module:datepicker): validate manually entered date against format

* fix(module:datepicker): keep frozen the panel until valid date entered

* fix(module:datepicker): switch to current culture format

* fix(module:datepicker): build fix

* fix(module:datepicker): use InvariantCulture when calling ToString on date

* fix(module:datepicker): FormatAnalyzer handles also year, week, month & quarter picker

* fix(module:datepicker): FormatAnalyzer broken tests

* fix: FormatAnalyzer handles prefixes in format.

Suffix is handled for picker type = "year"
Tests include validation of not changing state

* fix: all modes go through format analyzing (inluding week&quarter)

* fix(module:datepickerbase): InternalFormat initalized properly for all modes

* fix(module:rangepicker): reset opposing date when in conflict with current

* fix(module:rangePicker): handle null in second part of range

* fix(module:datepicker): switch from BindConverter to partials

* tests(module:datepicker): FormatAnalyzer new tests to cover switch from BindConverter

* tests(module:datepicker): missed change in tests

* fix: focus, key events, reset value to original if not confirmed

* fix: bug fix on range & clean-up

* Update DatePicker.razor

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: overlay): issues in boundaryAdjustMode (#1420)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: cascader): incorrect size (#1432)

* fix(module: cascader): incorrect size

* add test for cascader size

* fix(module: table): fix wrong spell for TableFilterCompareOperator.EndsWith (#1434)

* fix(module: table): remove an redundant whitespace

* fix(module: table): fix wrong spell

* fix(module: table): fix wrong spell

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: cascader): add SelectedNodesChanged and invoke it after clear selected (#1437)

* fix(module: table): fix spell mistake for TableFilterType.FieldType (#1442)

* style(module:table): fix spell mistake for TableFilterType.FieldType

* style(module:table): fix spell mistake for TableFilterType.FieldType

* fix(module: select): fix error for nullable TItem (#1451)

* fix(module: checkbox): remove Value initialization blocking (#1459)

* fix(module:checkbox): remove Value initialization blocking

* Update CheckboxTests.razor

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: select): support IEnumerable in form (#1460)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: select): fix dropdown width for IE (#1469)

* fix(module:select): fix dropdown width for IE

* fix(module:select): add a comment to explain the change

* revert 'merge local branch'

* revert 'merge local branch'

* revert 'merge local branch'

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: dialog): modify delay time to DOM_ MIN_ TIMEOUT_ VALUE (#1445)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: datepicker): Date picker panel click closing + some issues from #1431 (#1452)

* fix(module:datetime) keep open when click on panel

fix: tab key behavior
blur/show optimization

* fix(module:rangepicker): tab key behavior improvements

blur/focus optimizations

* fix(module:overlay): overlay visible before positioning

fix: flickering

* fix(module:datepicker): handle escape key

* fix(module:datepicker): mark properly current date on panel

* fix(module:datepicker): week mode calculates weeks properly

* fix(module: table): exception is thrown when the DataIndex ends with the get_Item method. (#1485)

* fix(module: table): set DisplayName to null if MemberExpression is not found in the DataIndex expression tree (#1488)

* feat(module: cascader): support showSearch (#1484)

* feat(module: cascader): support showSearch

* add empty dropdown

* fix clear icon

* fix(module: InputNumber): input number self changing (#1490)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: inputNumber): allow culture info to format input (#1480)

* fix(module:inputnumber): allow culture info to format input

* docs(module:inputnumber): demo & docs

* fix translation

Co-authored-by: ElderJames <shunjiey@hotmail.com>

* docs: update docs for modal dragging (#1497)

* fix(module: table): fix built-in filter select option width (#1500)

* fix(module: datepicker): fix multiple CultureInfo properties (#1492)

* fix(module:datepicker): fix multiple CultureInfo properties

* fix(module:datepicker): fix multiple CultureInfo properties

* fix(module: input): fix Input component for Guid type (#1510)

* fix(module:input): fix Input component for Guid type

* docs(module:input): add Guid generic sample code

* fix(module:input): add a comment to explain the change

* fix(module: input): guid optimization (#1515)

* fix:(module: overlay): positioning should take scroll into account (#1511)

Co-authored-by: Ocoka <somewhere@network>
Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix: js function getDom return null bug (#1417)

* fix: js function getDom return null bug (#1374)

* fix: add IF precompiled instruction for observer attribute

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix: missing using is causing build failure (#1518)

* change log 0.8.1 (#1522)

* change log 0.8.1

* fix order

Co-authored-by: Andrzej Bakun <andrzej@neelyc.com.cy>
Co-authored-by: Zonciu Liang <zonciu@zonciu.com>
Co-authored-by: zxyao <zxyao145@gmail.com>
Co-authored-by: MihailsKuzmins <47413092+MihailsKuzmins@users.noreply.github.com>
Co-authored-by: mihails.kuzmins <mihails.kuzmins@daytongroup.lv>
Co-authored-by: anranruye <54608128+anranruye@users.noreply.github.com>
Co-authored-by: 笨木头 <musicvs@163.com>
Co-authored-by: Maksim <maksalmak@gmail.com>
Co-authored-by: Ivan Ocoka <ocokanet@gmail.com>
Co-authored-by: Ocoka <somewhere@network>
ElderJames added a commit that referenced this pull request Apr 23, 2022
#1389)

* fix(module:datepicker): validate manually entered date against format

* fix(module:datepicker): keep frozen the panel until valid date entered

* fix(module:datepicker): switch to current culture format

* fix(module:datepicker): build fix

* fix(module:datepicker): use InvariantCulture when calling ToString on date

* fix(module:datepicker): FormatAnalyzer handles also year, week, month & quarter picker

* fix(module:datepicker): FormatAnalyzer broken tests

* fix: FormatAnalyzer handles prefixes in format.

Suffix is handled for picker type = "year"
Tests include validation of not changing state

* fix: all modes go through format analyzing (inluding week&quarter)

* fix(module:datepickerbase): InternalFormat initalized properly for all modes

* fix(module:rangepicker): reset opposing date when in conflict with current

* fix(module:rangePicker): handle null in second part of range

* fix(module:datepicker): switch from BindConverter to partials

* tests(module:datepicker): FormatAnalyzer new tests to cover switch from BindConverter

* tests(module:datepicker): missed change in tests

* fix: focus, key events, reset value to original if not confirmed

* fix: bug fix on range & clean-up

* Update DatePicker.razor

Co-authored-by: James Yeung <shunjiey@hotmail.com>
ElderJames added a commit that referenced this pull request Apr 23, 2022
* fix(module: select): enum default value protection (#1368)

* fix(module: affix): can't affix while OffsetTop is zero (#1373)

* fix(module: affix): can't affix while OffsetTop is zero

* use affixed setter for rerendering

* limit rerendering

* fix(module: input): binding data when the Enter key is pressed (#1375)

* fix(module: table): ellipsis can't work (#1376)

* feat: add element component (#1378)

* refactor: rename `HtmlElement` property case

* rename the directory name for overlay

* add element component

* fix(module: table): Unify FieldName, add DisplayAttribute for DiplayName, fix Filter for DataIndex (#1372)

* fix(module: table): Unify FieldName value

* fix(module: table): Get column name from DisplayAttribute

* fix(module: table): Filter for DataIndex

* docs(module: table): Intuitive sorterCompare for Filter demo

* fix(module: table): fix header title doesn't display when Sortable is false

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(dialog): add Dispose lifecycle function to Dialog (#1379)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: input): preserve focus and caret position for input password when visibility is toggled (#1377)

* set focus when the password button is clicked

* add methods for selection

* set selectionStart after Focus

* fix typescript

* set selectionEnd as well

* fix a stupid if-condition-bug

* remove checks for element

* add selectionStart to getDomInfo

* get selectionStart from Element

* delete unneeded js method

Co-authored-by: mihails.kuzmins <mihails.kuzmins@daytongroup.lv>
Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: table): can not use DataIndex nullable mode with not nullable property (#1382)

* fix(module: table): column header sorter not refresh after ClearSorter is called (#1385)

* fix(module:table): column header sorter not refresh after ClearSorter is called

* add judgment condition for calling StateHasChanged in IFieldColumn.ClearSorter()

* fix(module: form): validation message unique (#1391)

* fix(module: tag): closable typo and delete mode (#1393)

* fix(module: tag): closable typo and delete mode

* return early

* test(module: divider): divider tests (#1397)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* feat(module: modal): support define modal's style in ModalOptions (#1400)

* fix(module: checkbox & switch): Checked parameter binding (#1394)

* fix(module:checkbox): allow binding to Checked parameter

* fix(module:switch): allow binding to Checked parameter

* fix(modules): checkbox & switch get AntInputBoolComponentBase class

* test(module:switch): add tests

* test(module:checkbox): add tests

* test(module:divider): simplify by using id:ignore

* docs(module:checkbox): bind example

* docs(module:switch): bind example

* fix(module:switch): add Control + docs + tests

* feat(module:checkboxgroup): add layout and mixed mode

* fix: review comments + tests

* fix(module:checkboxgroup): parameter name should be MixedMode

added more tests

* fix demo

* fix(module:checkboxgroup): allow toggling between modes

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: select): OnDataSourceChange called when expected (#1419)

* fix(module:select): OnDataSourceChange called when expected

* test(module:select): add missing scenario

* fix(module: table): DataIndex filter pop up (#1421)

* fix(module:overlayTrigger): TrigerRefernece points to OverlayTrigger.Ref.

* fix(module:overlay): Show waits for competing code to finish

* Update OverlayTrigger.razor.cs

* clean code

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* feat: use ResizeObserver Api instead of window.resize (#1392)

* feat: use ResizeObserver Api instead of window.resize

* fix(module:select): fall back to window.resize in IE11.

* fix(module:domEventService): switch from IsIE11 to IsResizeObserverSupported

* fix: Console.WriteLine removed

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: table): check null in set sorter method (#1423)

* fix(module: datepicker): validate manually entered date against format (#1389)

* fix(module:datepicker): validate manually entered date against format

* fix(module:datepicker): keep frozen the panel until valid date entered

* fix(module:datepicker): switch to current culture format

* fix(module:datepicker): build fix

* fix(module:datepicker): use InvariantCulture when calling ToString on date

* fix(module:datepicker): FormatAnalyzer handles also year, week, month & quarter picker

* fix(module:datepicker): FormatAnalyzer broken tests

* fix: FormatAnalyzer handles prefixes in format.

Suffix is handled for picker type = "year"
Tests include validation of not changing state

* fix: all modes go through format analyzing (inluding week&quarter)

* fix(module:datepickerbase): InternalFormat initalized properly for all modes

* fix(module:rangepicker): reset opposing date when in conflict with current

* fix(module:rangePicker): handle null in second part of range

* fix(module:datepicker): switch from BindConverter to partials

* tests(module:datepicker): FormatAnalyzer new tests to cover switch from BindConverter

* tests(module:datepicker): missed change in tests

* fix: focus, key events, reset value to original if not confirmed

* fix: bug fix on range & clean-up

* Update DatePicker.razor

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: overlay): issues in boundaryAdjustMode (#1420)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: cascader): incorrect size (#1432)

* fix(module: cascader): incorrect size

* add test for cascader size

* fix(module: table): fix wrong spell for TableFilterCompareOperator.EndsWith (#1434)

* fix(module: table): remove an redundant whitespace

* fix(module: table): fix wrong spell

* fix(module: table): fix wrong spell

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: cascader): add SelectedNodesChanged and invoke it after clear selected (#1437)

* fix(module: table): fix spell mistake for TableFilterType.FieldType (#1442)

* style(module:table): fix spell mistake for TableFilterType.FieldType

* style(module:table): fix spell mistake for TableFilterType.FieldType

* fix(module: select): fix error for nullable TItem (#1451)

* fix(module: checkbox): remove Value initialization blocking (#1459)

* fix(module:checkbox): remove Value initialization blocking

* Update CheckboxTests.razor

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: select): support IEnumerable in form (#1460)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: select): fix dropdown width for IE (#1469)

* fix(module:select): fix dropdown width for IE

* fix(module:select): add a comment to explain the change

* revert 'merge local branch'

* revert 'merge local branch'

* revert 'merge local branch'

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: dialog): modify delay time to DOM_ MIN_ TIMEOUT_ VALUE (#1445)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: datepicker): Date picker panel click closing + some issues from #1431 (#1452)

* fix(module:datetime) keep open when click on panel

fix: tab key behavior
blur/show optimization

* fix(module:rangepicker): tab key behavior improvements

blur/focus optimizations

* fix(module:overlay): overlay visible before positioning

fix: flickering

* fix(module:datepicker): handle escape key

* fix(module:datepicker): mark properly current date on panel

* fix(module:datepicker): week mode calculates weeks properly

* fix(module: table): exception is thrown when the DataIndex ends with the get_Item method. (#1485)

* fix(module: table): set DisplayName to null if MemberExpression is not found in the DataIndex expression tree (#1488)

* feat(module: cascader): support showSearch (#1484)

* feat(module: cascader): support showSearch

* add empty dropdown

* fix clear icon

* fix(module: InputNumber): input number self changing (#1490)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: inputNumber): allow culture info to format input (#1480)

* fix(module:inputnumber): allow culture info to format input

* docs(module:inputnumber): demo & docs

* fix translation

Co-authored-by: ElderJames <shunjiey@hotmail.com>

* docs: update docs for modal dragging (#1497)

* fix(module: table): fix built-in filter select option width (#1500)

* fix(module: datepicker): fix multiple CultureInfo properties (#1492)

* fix(module:datepicker): fix multiple CultureInfo properties

* fix(module:datepicker): fix multiple CultureInfo properties

* fix(module: input): fix Input component for Guid type (#1510)

* fix(module:input): fix Input component for Guid type

* docs(module:input): add Guid generic sample code

* fix(module:input): add a comment to explain the change

* fix(module: input): guid optimization (#1515)

* fix:(module: overlay): positioning should take scroll into account (#1511)

Co-authored-by: Ocoka <somewhere@network>
Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix: js function getDom return null bug (#1417)

* fix: js function getDom return null bug (#1374)

* fix: add IF precompiled instruction for observer attribute

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix: missing using is causing build failure (#1518)

* change log 0.8.1 (#1522)

* change log 0.8.1

* fix order

Co-authored-by: Andrzej Bakun <andrzej@neelyc.com.cy>
Co-authored-by: Zonciu Liang <zonciu@zonciu.com>
Co-authored-by: zxyao <zxyao145@gmail.com>
Co-authored-by: MihailsKuzmins <47413092+MihailsKuzmins@users.noreply.github.com>
Co-authored-by: mihails.kuzmins <mihails.kuzmins@daytongroup.lv>
Co-authored-by: anranruye <54608128+anranruye@users.noreply.github.com>
Co-authored-by: 笨木头 <musicvs@163.com>
Co-authored-by: Maksim <maksalmak@gmail.com>
Co-authored-by: Ivan Ocoka <ocokanet@gmail.com>
Co-authored-by: Ocoka <somewhere@network>
ElderJames added a commit that referenced this pull request Apr 30, 2022
#1389)

* fix(module:datepicker): validate manually entered date against format

* fix(module:datepicker): keep frozen the panel until valid date entered

* fix(module:datepicker): switch to current culture format

* fix(module:datepicker): build fix

* fix(module:datepicker): use InvariantCulture when calling ToString on date

* fix(module:datepicker): FormatAnalyzer handles also year, week, month & quarter picker

* fix(module:datepicker): FormatAnalyzer broken tests

* fix: FormatAnalyzer handles prefixes in format.

Suffix is handled for picker type = "year"
Tests include validation of not changing state

* fix: all modes go through format analyzing (inluding week&quarter)

* fix(module:datepickerbase): InternalFormat initalized properly for all modes

* fix(module:rangepicker): reset opposing date when in conflict with current

* fix(module:rangePicker): handle null in second part of range

* fix(module:datepicker): switch from BindConverter to partials

* tests(module:datepicker): FormatAnalyzer new tests to cover switch from BindConverter

* tests(module:datepicker): missed change in tests

* fix: focus, key events, reset value to original if not confirmed

* fix: bug fix on range & clean-up

* Update DatePicker.razor

Co-authored-by: James Yeung <shunjiey@hotmail.com>
ElderJames added a commit that referenced this pull request Apr 30, 2022
* fix(module: select): enum default value protection (#1368)

* fix(module: affix): can't affix while OffsetTop is zero (#1373)

* fix(module: affix): can't affix while OffsetTop is zero

* use affixed setter for rerendering

* limit rerendering

* fix(module: input): binding data when the Enter key is pressed (#1375)

* fix(module: table): ellipsis can't work (#1376)

* feat: add element component (#1378)

* refactor: rename `HtmlElement` property case

* rename the directory name for overlay

* add element component

* fix(module: table): Unify FieldName, add DisplayAttribute for DiplayName, fix Filter for DataIndex (#1372)

* fix(module: table): Unify FieldName value

* fix(module: table): Get column name from DisplayAttribute

* fix(module: table): Filter for DataIndex

* docs(module: table): Intuitive sorterCompare for Filter demo

* fix(module: table): fix header title doesn't display when Sortable is false

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(dialog): add Dispose lifecycle function to Dialog (#1379)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: input): preserve focus and caret position for input password when visibility is toggled (#1377)

* set focus when the password button is clicked

* add methods for selection

* set selectionStart after Focus

* fix typescript

* set selectionEnd as well

* fix a stupid if-condition-bug

* remove checks for element

* add selectionStart to getDomInfo

* get selectionStart from Element

* delete unneeded js method

Co-authored-by: mihails.kuzmins <mihails.kuzmins@daytongroup.lv>
Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: table): can not use DataIndex nullable mode with not nullable property (#1382)

* fix(module: table): column header sorter not refresh after ClearSorter is called (#1385)

* fix(module:table): column header sorter not refresh after ClearSorter is called

* add judgment condition for calling StateHasChanged in IFieldColumn.ClearSorter()

* fix(module: form): validation message unique (#1391)

* fix(module: tag): closable typo and delete mode (#1393)

* fix(module: tag): closable typo and delete mode

* return early

* test(module: divider): divider tests (#1397)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* feat(module: modal): support define modal's style in ModalOptions (#1400)

* fix(module: checkbox & switch): Checked parameter binding (#1394)

* fix(module:checkbox): allow binding to Checked parameter

* fix(module:switch): allow binding to Checked parameter

* fix(modules): checkbox & switch get AntInputBoolComponentBase class

* test(module:switch): add tests

* test(module:checkbox): add tests

* test(module:divider): simplify by using id:ignore

* docs(module:checkbox): bind example

* docs(module:switch): bind example

* fix(module:switch): add Control + docs + tests

* feat(module:checkboxgroup): add layout and mixed mode

* fix: review comments + tests

* fix(module:checkboxgroup): parameter name should be MixedMode

added more tests

* fix demo

* fix(module:checkboxgroup): allow toggling between modes

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: select): OnDataSourceChange called when expected (#1419)

* fix(module:select): OnDataSourceChange called when expected

* test(module:select): add missing scenario

* fix(module: table): DataIndex filter pop up (#1421)

* fix(module:overlayTrigger): TrigerRefernece points to OverlayTrigger.Ref.

* fix(module:overlay): Show waits for competing code to finish

* Update OverlayTrigger.razor.cs

* clean code

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* feat: use ResizeObserver Api instead of window.resize (#1392)

* feat: use ResizeObserver Api instead of window.resize

* fix(module:select): fall back to window.resize in IE11.

* fix(module:domEventService): switch from IsIE11 to IsResizeObserverSupported

* fix: Console.WriteLine removed

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: table): check null in set sorter method (#1423)

* fix(module: datepicker): validate manually entered date against format (#1389)

* fix(module:datepicker): validate manually entered date against format

* fix(module:datepicker): keep frozen the panel until valid date entered

* fix(module:datepicker): switch to current culture format

* fix(module:datepicker): build fix

* fix(module:datepicker): use InvariantCulture when calling ToString on date

* fix(module:datepicker): FormatAnalyzer handles also year, week, month & quarter picker

* fix(module:datepicker): FormatAnalyzer broken tests

* fix: FormatAnalyzer handles prefixes in format.

Suffix is handled for picker type = "year"
Tests include validation of not changing state

* fix: all modes go through format analyzing (inluding week&quarter)

* fix(module:datepickerbase): InternalFormat initalized properly for all modes

* fix(module:rangepicker): reset opposing date when in conflict with current

* fix(module:rangePicker): handle null in second part of range

* fix(module:datepicker): switch from BindConverter to partials

* tests(module:datepicker): FormatAnalyzer new tests to cover switch from BindConverter

* tests(module:datepicker): missed change in tests

* fix: focus, key events, reset value to original if not confirmed

* fix: bug fix on range & clean-up

* Update DatePicker.razor

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: overlay): issues in boundaryAdjustMode (#1420)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: cascader): incorrect size (#1432)

* fix(module: cascader): incorrect size

* add test for cascader size

* fix(module: table): fix wrong spell for TableFilterCompareOperator.EndsWith (#1434)

* fix(module: table): remove an redundant whitespace

* fix(module: table): fix wrong spell

* fix(module: table): fix wrong spell

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: cascader): add SelectedNodesChanged and invoke it after clear selected (#1437)

* fix(module: table): fix spell mistake for TableFilterType.FieldType (#1442)

* style(module:table): fix spell mistake for TableFilterType.FieldType

* style(module:table): fix spell mistake for TableFilterType.FieldType

* fix(module: select): fix error for nullable TItem (#1451)

* fix(module: checkbox): remove Value initialization blocking (#1459)

* fix(module:checkbox): remove Value initialization blocking

* Update CheckboxTests.razor

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: select): support IEnumerable in form (#1460)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: select): fix dropdown width for IE (#1469)

* fix(module:select): fix dropdown width for IE

* fix(module:select): add a comment to explain the change

* revert 'merge local branch'

* revert 'merge local branch'

* revert 'merge local branch'

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: dialog): modify delay time to DOM_ MIN_ TIMEOUT_ VALUE (#1445)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: datepicker): Date picker panel click closing + some issues from #1431 (#1452)

* fix(module:datetime) keep open when click on panel

fix: tab key behavior
blur/show optimization

* fix(module:rangepicker): tab key behavior improvements

blur/focus optimizations

* fix(module:overlay): overlay visible before positioning

fix: flickering

* fix(module:datepicker): handle escape key

* fix(module:datepicker): mark properly current date on panel

* fix(module:datepicker): week mode calculates weeks properly

* fix(module: table): exception is thrown when the DataIndex ends with the get_Item method. (#1485)

* fix(module: table): set DisplayName to null if MemberExpression is not found in the DataIndex expression tree (#1488)

* feat(module: cascader): support showSearch (#1484)

* feat(module: cascader): support showSearch

* add empty dropdown

* fix clear icon

* fix(module: InputNumber): input number self changing (#1490)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: inputNumber): allow culture info to format input (#1480)

* fix(module:inputnumber): allow culture info to format input

* docs(module:inputnumber): demo & docs

* fix translation

Co-authored-by: ElderJames <shunjiey@hotmail.com>

* docs: update docs for modal dragging (#1497)

* fix(module: table): fix built-in filter select option width (#1500)

* fix(module: datepicker): fix multiple CultureInfo properties (#1492)

* fix(module:datepicker): fix multiple CultureInfo properties

* fix(module:datepicker): fix multiple CultureInfo properties

* fix(module: input): fix Input component for Guid type (#1510)

* fix(module:input): fix Input component for Guid type

* docs(module:input): add Guid generic sample code

* fix(module:input): add a comment to explain the change

* fix(module: input): guid optimization (#1515)

* fix:(module: overlay): positioning should take scroll into account (#1511)

Co-authored-by: Ocoka <somewhere@network>
Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix: js function getDom return null bug (#1417)

* fix: js function getDom return null bug (#1374)

* fix: add IF precompiled instruction for observer attribute

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix: missing using is causing build failure (#1518)

* change log 0.8.1 (#1522)

* change log 0.8.1

* fix order

Co-authored-by: Andrzej Bakun <andrzej@neelyc.com.cy>
Co-authored-by: Zonciu Liang <zonciu@zonciu.com>
Co-authored-by: zxyao <zxyao145@gmail.com>
Co-authored-by: MihailsKuzmins <47413092+MihailsKuzmins@users.noreply.github.com>
Co-authored-by: mihails.kuzmins <mihails.kuzmins@daytongroup.lv>
Co-authored-by: anranruye <54608128+anranruye@users.noreply.github.com>
Co-authored-by: 笨木头 <musicvs@163.com>
Co-authored-by: Maksim <maksalmak@gmail.com>
Co-authored-by: Ivan Ocoka <ocokanet@gmail.com>
Co-authored-by: Ocoka <somewhere@network>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The date component will have a data error if you enter the year, month and day manually
4 participants