-
-
Notifications
You must be signed in to change notification settings - Fork 29
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(filter): Date Filter should trigger Grid State change with Backspace #1545
Conversation
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1545 +/- ##
========================================
+ Coverage 99.8% 99.8% +0.1%
========================================
Files 198 198
Lines 21671 21674 +3
Branches 7241 6967 -274
========================================
+ Hits 21610 21613 +3
Misses 61 61 ☔ View full report in Codecov by Sentry. |
awesome, i can give this a try on monday with my app |
I added Cypress tests for the GraphQL Example 10 which has a Date Range filter, to cover the change, I added console log of the Grid State and it now triggers expected State change. I didn't had Cypress tests for a regular Compound Date but since the Date Range works, it should be enough (and I did tests manually the regular date filter). I could maybe add some Cypress tests for the Angular-Slickgrid (Client Side - Example 4) instead since I don't have too many examples in here with console logs of the Grid State changes... so let's merge, another bug bites the dust |
@zewa666 hmm I'll have to take another look at it later. Have you done anything troubleshooting on the code I changed? Like adding breakpoints or console logs? EDIT gave it another try and I see it working as expected, did you run pnpm install and are you sure that you get the latest code? Are you maybe on a Mac or does it have different keycode for whatever reason? It should fall in this event listener, you could add a breakpoint to verify. Maybe run a full Bundle Library before running it again? I don't think you have the latest code because even your date picker doesn't get cleared but mine does (see below), so you don't have latest code OR you're not falling in the listener below for unknown reason. slickgrid-universal/packages/common/src/filters/dateFilter.ts Lines 143 to 148 in ff61101
|
I was looking at it from the website samples (https://ghiscoding.github.io/slickgrid-universal/#/example10) ooh ... hold on I guess it's not deployed there yet. that could be the reason :) But anyways there seems to be more issues with the DatePicker, like I can now only paste formats in ISO (2020-01-07) format but not others like (07/01/2020) or (01.07.2020). So I need to dig deeper on that |
@zewa666 hahaha yeah the demo is only being deployed on releases. I did that to avoid showing unreleased features 😉 |
So 1 thing to note is that the new lib can only work with Date in ISO format (that is how it managed to keep its build size small) and also the associated input and its format is all done by code that I needed to implement myself (since again the external lib only accepts ISO format) and that is where and when I use the other external new lib Tempo. One advantage of having to deal with the input myself is that I no longer need parsing functions from Moment to Flatpickr and vice versa, because Flatpickr had a different parsing format than MomentJS, so I always had to do the parsing back and forth, though I no longer need to do that anymore since I'm in charge of the input format myself. I haven't tried copy+paste so that would explain why it doesn't work, but I thought that I've set the input as read only, so how did you paste a date? Should we really accept a paste though? I mean it's a date picker, so technically you should always use the picker UI. Is that for Date editor and not the filter? ohhh unless you meant the Excel Copy Buffer plugin, yeah it might need tweaking on the parsing of the date editor (I don't remember if it's in the |
exactly the paste from Excel use case. My idea is anyways to allow only 3 specific formats. if its none of that I want to paste an Invalid Date forcing the user to fix it. so ideally I could have an entry point where I do the conversion from X to ISO or error/null, so the lib can keep focusing on ISO, which I very like btw. Where would you see that paste check fit? |
I'm not sure how the Excel Copy Buffer works, I added console log on the date editor Was the same manual test actually working before the new major? |
yes pasting has a somewhat different workflow as it only consumes the validator from a defined editor (one of the earlier PRs). I didnt have that feature yet and sat down to implement it since the old parser actually acted a but weird from different locales based excel sheets. hence I'm actually quite happy the new one just accepts ISO and forces it on the dev to convert the copy buffer to the matching format. I guess I'll go with onBeforePasteCell and simply do the conversion there if the target column to be pasted from the range is a date editor. So no worries I'll figure it out. perhaps it makes sense to update the docs afterwards with a snippet on how others can do it as well |
yeah ok, I'll let you submit an update of the docs if you don't mind since you know the subject more than I do. Just 1 thing to note though is that when parsing with Tempo, I purposely used slickgrid-universal/packages/common/src/filters/dateFilter.ts Lines 304 to 305 in aa0a74f
|
yeah being from Austria I'm used to all sorts of weird stuff with i18n related conversion issues between en-US and de-AT. seen that one you mentioned and I think I've also proposed fixing everything CI related to en-US, at least thats what I used to do with Aurelia-I18n |
I just edited my comment above with the following comments which explains it all I guess... Finally the thing to note is that Tempo tries to use Intl.DateTimeFormat as much as possible to keep the lib small, which is why I had some format differences |
btw whats your recommended approach to testing out a non-released master merge with my angular-slickgrid app? just forcefully npm install straight from github-master vs npm? or should I do a local build of master repo and npm link? |
my approach is very uncommon and crude, I run a full Slickgrid-Universal build and then copy the Another approach that is typically recommended is to use npm link (something like along this article), it's probably better with yarn or pnpm though... but 1 of the reason I'm not using this approach is that there's no easy On/Off switch to remove this link, so once it's linked it kind of bypasses the original and released code. if you find something better, please let me know, for now I'll keep using 1st approach Looking at pnpm docs, I guess you could do 3rd approach that you mentioned which would probably work too |
i thought going with npm pack https://dev.to/scooperdev/use-npm-pack-to-test-your-packages-locally-486e |
oh cool I wasn't aware of that one, but you probably need to find out the full path to get it working and update all packages, it shouldn't be too much of a problem. Have you tried the 3rd approach I mentioned above? Basically what you proposed earlier |
nope, I actually prefer to stick to npm, thats the baseline for everyone, and only use pnpm in your repos. So that wont work for my app |
if you want to go with npm pack, you could add npm scripts for each package (I've done that in Lerna-Lite for testing purposes) |
TODOs