-
Notifications
You must be signed in to change notification settings - Fork 346
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
UI: an Input ModeViewControl #8350
Conversation
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.
Hi @nnhaagen,
Thx a lot for your contribution to the UI framework.
This review will only focus on the public interface, so this can go to JF first. We will review the implementation once it has been accepted.
About the concrete changes, answer the following questions:
- Legacy
ViewControl\Mode
: the proposed interface looks a lot smaller than the old one. Is this on purpose? I distinctly remember an issue which has been addressed for the old ones, which should probably be considered here too. Something about the label. Also, why not adopt the old factory description?
Please implement the following changes:
- PHPDoc: please provide a PHPDoc annotation for the
$options
parameter, describing the possible values (corresponding toMode::isClientSideValueOk()
). - Deprecation: please deprecate the legacy
ViewControl\Mode
viewcontrol (on the factory).
Kind regards,
@thibsy
2c7b83c
to
d760238
Compare
Hi @thibsy,
There's not much beside the options a consumer could or should do with the control itself.
Ultimately: yes. But then we should deprecated all of them, aye? Best regards, |
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.
Hi @nhaagen,
Thx for your explanation. I agree that we should deprecate the entire legacy view control namespace at once. Could you create a roadmap entry for this? If you have the time, another PR would be highly appreciated of course.
I also realised, I was thinking about the wrong labelling issue (it concerned C\Table\Column\Column::getOrderingLabels()
) - sry about that.
The interface LGTM now, so we can pass this through JF. The implementation contains some minor issues, which need to be addressed once this has been accepted.
Please consider the following suggestions. You do not need to follow them:
- Inline JavaScript: we try to keep inline JavaScript to a minimum. I suggest to create a file with a function that contains the logic registered inside the renderer, which is populated as e.g.
il.UI.viewcontrol.createMode()
or similar.
Please implement the following changes:
- Probable bug: you have several usages of
array_keys($options)[0]
, which I think will break if one passes an empty array to create an instance. I am not sure if we really want to enforce an array entry, therefore I suggest to simply address these places by usingarray_key_first()
with a null-coalesce where necessary. - Optional ID: the template file contains an optional block for the ID attribute. The attribute is always required though, therefore please remove it (not the variable).
Hi @thibsy ,
There already is a roadmap entry on this (concerning all other VCs, too), I'll see to it.
Actually, with ModeVC, the id is indeed optional (I removed the other ones, though): the JS is on the buttons it generates, not the component itself. Best, |
This has been postponed to the next JourFixe. |
Jour Fixe, 06 JAN 2025: We highly appreciate this suggestion and accept the PR for trunk. |
@nhaagen I assign this back to you while you are refining the JS. Feel free to pass back once this is ready! |
972ca11
to
4aeb9f9
Compare
4aeb9f9
to
91c96fd
Compare
Hi @thibsy , I externalized the JS, maybe you want to take a look? |
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.
Hi @nhaagen,
Thanks a lot for externalising the JavaScript of all the new view controls!
I assumed the actual JavaScript code of the other view controls was simply copied from the renderer, so I only checked the new mode more closely. Let me know if there was a relevant change in some of the other ones.
About the concrete changes, please answer the following questions:
- Styling: is the styling already covered by the legacy view controls? If not, when/how will this be added?
Please consider the following suggestions. You do not need to follow them, but please indicate shortly why you prefer to do otherwise:
- File names: just for future reference, this is currently optional: but according to our JavaScript code-style, file names must reflect their
default export
, if there is any - with a few exceptions for e.g. generated files or configs.
Please implement the following changes:
-
Event.srcElement
: this property has been deprecated, please useEvent.target
instead. - Optional chaining: please use
?.
for all chained function calls when setting theoptValue
.
Kind regards,
Rollup does not like that chaining: In this case, I'd also not expect any of the elements to not be there, they are quite integral to the view control. |
@thibsy Please iterate =) |
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.
This LGTM now, you're right about the invalid syntax of course. Thx a lot @nhaagen for this contribution!
We do have a mode view control in the non-input view controls, but we do not for the input ones.
That's obviously missing.
Styling is missing from this PR, but should not be hard to do for @catenglaender , e.g.