ghiscoding / slickgrid-universal

Slickgrid-Universal is a monorepo which includes all Editors, Filters, Extensions, Services related to SlickGrid usage and is also Framework Agnostic
https://ghiscoding.github.io/slickgrid-universal/
Other
90 stars 29 forks source link

Datepicker with manual input #1684

Closed zewa666 closed 2 months ago

zewa666 commented 2 months ago

Clear and concise description of the problem

The new vanilla calender is working great, in combo with copy & paste you're also able to quickly fill out values. Sometimes though, its simply easier to change the date by actually typing it in. Currently slickgrid doesn't provide this feature as the input box is always readonly.

Suggested solution

When a date cell editor is opened, there should be an option to configure readonly mode. If disabled, users can enter dates in the input field and they get synced back to the date control.

image

Alternative

No response

Additional context

No response

Validations

ghiscoding commented 2 months ago

Ah yeah that's probably a decent addition to go with, in Flatpickr we had the allowInput, I was using that in my previous unit tests

Allows the user to enter a date directly into the input field. By default, direct entry is disabled.

https://github.com/ghiscoding/slickgrid-universal/blob/11b565e0e2623d20669b838263fb1638f53ea5dc/packages/common/src/editors/__tests__/dateEditor.spec.ts#L222-L226

I think it might be ok to add this as a new option into the VanillaCalendarOption interface, however I think it should stay as disabled or unset by default

https://github.com/ghiscoding/slickgrid-universal/blob/3c6ce204dd9b48091b4c49c5c07b5799b3af34b9/packages/common/src/interfaces/vanillaCalendarOption.interface.ts#L10-L15

~Should I assume that you'll soon go ahead with a PR? 😉~ Ah yeah I hadn't a chance to see all PRs yet 😆

You did use readonly though, should we use the same as Flatpickr or do you still prefer readonly? It might be a good idea to follow the same

zewa666 commented 2 months ago

I didnt know about the FlatPickr option but agree that it should be kept as allowEdit and yep it should stay false as default for backwards compat. I'll update the PR with those info