-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
refactor(typings): added new column generic #442
Conversation
Codecov Report
@@ Coverage Diff @@
## master #442 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 163 163
Lines 10233 10233
Branches 3484 3484
=========================================
Hits 10233 10233 Continue to review full report at Codecov.
|
@@ -96,7 +106,7 @@ export interface Column<T = any> { | |||
* NOTE: a field with dot notation (.) will be considered a complex object. | |||
* For example: { id: 'Users', field: 'user.firstName' } | |||
*/ | |||
field: string; | |||
field: Join<PathsToStringProps<T>, '.'>; |
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.
quite a feat, can that be string | Join<PathsToStringProps<T>, '.'>
or it's unnecessary? What does it show in the intellisense? I wouldn't mind seeing print screen of that in the PR
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.
Not next to a PC currently but if you Union with string this one wins since it includes all the Options from the other. In intellisense it shows the available dot.notations for T.
This one would certainly need more testing which is why i've created the draft so that you can fire your expectations at it. E.g can also a whole complex object be the field or only primitives? Not sure If thats currently handled.
Take your time as mentioned it relies on a next feature version of TS so there is plenty time to look at this ;)
@zewa666
Looks very promising, perhaps you could even post your answer to my SO question that I've referenced earlier since this goes even further than my original question. I added some print screens to the PR description on top |
|
Thanks for the all the info, so I'd go back on the last 2 points then
|
How about the idea with the dedicated example? Or do you still prefer that its part of Example2? |
If you think an Example would make more sense and there's enough content to justify a new Example then go for it. |
yeah it wasn't essentially worth the hassle of a new example since it's not too much to show. I've added it now to Example2 as you proposed and reverted Example1. So for now as you suggested, let this rest for a while until the new TS version is released and than we can see how to go forward with this hone |
sounds good to me |
So I know there's still 2 weeks before the official release of TypeScript but I think I'm basically trying to delay a |
Peer dependencies wont help since you ship the d.ts file containing the new typings which will make older TS versions throw. Essentially you'd still enforce the user to update. Sad but true I don't really see any way instead of a major bump. You could argue that JS consumers wouldnt care but an automated build for TS users would most likely break, hence breaking change. There is one more issue. Angular has only very specific Support for TS versions so this change could lock them out until 4.1.0 isnt properly supported by ng. Since its not such a huge game-changing feature I'd recommend waiting until you're fine with making the move to universal and then add it to the major bump. With regards to i18n you should only have to update both aurelia-i18n and i18next. If you didnt use Rother df/nf or the mentioned Baseclass no troubles. I can give it a shot and create a new PR for it |
I actually wasn't thinking to push this to Angular for that reason (at least not until Slickgrid-Universal is used in that lib too), I wanted to make it available in Aurelia-Slickgrid when TypeScript 4.1.x is out and also replicate the code change into Slickgrid-Universal. I think it will take me couple more months to get Slickgrid-Universal used by Aurelia-Slickgrid (at least I got all the chore cleanup done now so I should proceed soon with the next step to use the monorepo into the lib but yeah couple more months). I like your change so I wanted to push it soon but I didn't want a breaking change mostly because that could mean 2 breaking versions in a matter of months but I wouldn't want to wait for your change to be available.
I'm only using the I18N Service and a few subscribe to the |
hmm if you bump to 3.x branch of aurelia-i18n users still on 2.x and using mentioned breaking changes would still result in such a change. So also this one in that case would make sense to do during your next major bump. The important aspect is that you allowed to override the used i18n service here so users with a more recent version can still use it, which is what I'm doing as an example. So again also here no need for a hurried update. Again same as with typescript, you really want to make sure to address those kind of changes with a major bump, as that is pretty much the only way to guarantee your users auto-builds not to break since rarely anybody takes a The downside of major bumps is that you can't any longer ship simple fixes to older majors without having to support multiple major lines. So I get your intention on wanting to keep them away as long as possible. Since there isn't as much activity here for the aurelia version tbh I'd just wait it out and do it properly as mentioned with the next big major push. For everybody who really wants and needs to do it earlier, e.g me, I can always patch-package/workaround issues until the new release lands. |
Alright it looks like you're more in favor of waiting for a breaking version for those 2 reasons we talked about, so that will come after I use Slickgrid-Universal within Aurelia-Slickgrid, so probably after Christmas then. I will soon start the work since the cleanup is mainly done. I also wonder if there will be any breaking changes for Aurelia2 with my lib, I don't think so but I didn't have time to try Au2 yet. Doesn't look like it will ship before mid next year anyway, so I shouldn't wait for that before releasing a major version. Thanks for all the feedback, that helps and happy to hear you will start using it soon 😉 Cheers and thanks again |
I haven't advertised this feature because it's not available in Aurelia-Slickgrid (only is in Slickgrid-Universal) but I added this new SlickGrid Composite Editor Modal window. It might interest you, so take a look at the live Example, the 4 buttons on the right is the new feature (it took me over a month to get it all to what I wanted, from a built-in modal window Create/Edit/MassUpdate/MassUpdateBySelection and we mainly use it for Mass Update in Salesforce (and it looks like they want me to add Clone line as well)... So anyway, that will come in only after merging Slickgrid-Universal into Aurelia-Slickgrid because that was too much code to go through. |
Frankly I'm looking forward to the slickgrid-universal merge much much more since then contributions will make sense across the board. Also with regards to v2 yeah might take a while for the Alpha, but there shouldnt be too much Issues except for the postRenderer part which will be doable. Anyways of you're going to look for more info hop over to the Aurelia discord channel which is primarily about V2. Would also making chats easier instead of misusing PRs and Issues ;) https://discord.gg/RBtyM6u |
Now that TypeScript 4.1.2 is official, I'm adding it into Slickgrid-Universal and this is beautiful 🏆 However I found a possible problem with this approach, there are some grids that the user wants to add his custom column without following the interface, for example in my use I have a column for "Action" but it's not part of my interface (and shouldn't be), the only way that I see dealing with this would be to disable the linter but do you have other suggestions to deal with those? Well actually, I have this other possible solution, that might be the only viable solution, thought? |
Yep thats what I asked a few posts back. Ok I'll give it a thought, perhaps we can find something. Is this a usual case would you say? |
Hmm that would depend on use cases, I looked at all the Examples that I've made and there's only 3 out of 29 that have such extra columns, it's mostly related to a column for "Actions"
Though you might have seen other extra columns like the Row Selections, Row Move and Row Detail which are displayed as the first column with an icon, but for these extra features are added internally by the lib so they shouldn't matter. So all in all, we're basically looking at the most common use case being an "Actions" column and I'm ok with just adding the type like I wrote earlier or add a built-in ActionColumn interface and extend it, but I'm not sure that really simplifies it Also worth to know that the Action column, like I shown in previous print screen, also require a Custom Formatter to display the button/icon or text for it. |
Oh ok so there is just that action column. Thought there are more of these extra predefined columns. Yeah so your proposal sounds great with & action: string. |
@zewa666 Couple of questions for you
# aurelia
{
"main": "dist/esnext/index.js",
"module": "dist/esnext/index.js",
"types": "dist/index.d.ts",
"typings": "dist/index.d.ts",
} # slickgrid-universal
{
"main": "dist/commonjs/index.js",
"module": "dist/es2015/index.js",
"typings": "dist/commonjs/index.d.ts"
}
Again the next version PR is #466 |
@zewa666 ...oh and I can confirm that user won't be able to use the code unless they have TypeScript 4.1.x, I got into that problem that I couldn't use the |
Yep so as mentioned for Aurelia its most likely gonna be ok but for Angular until their CLI supports it it could mean troubles. Definitely good if this is given at least another month or so until release |
At this point it's not on my radar, I'm starting the process of using the monorepo in Aurelia-Slickgrid because it's simply easier than Angular-Slickgrid, and there's a lot of reasons why it is easier here
So for all of these reasons, I'm not in a hurry to start using the monorepo in Angular-Slickgrid, I rather start with Aurelia-Slickgrid because Aurelia follows the standards and I tried to do the same in Slickgrid-Universal, so it's just much easier to get it working with Slickgrid-Universal. Aurelia community will benefit first because of their standards which was always a benefit of Aurelia 🚀 Thanks for the input and reminder though 😉 |
Alright this is fantastic, but at the same time requires a feature from current TS nightly. So I wouldn't deem that rdy to merge right now.
Anyways, open up Example1.ts which I've modified as sample (it's just a draft) and try to use intellisense on:
EDIT:
don't forget to check out the dot notation
Intellisense in action