-
Notifications
You must be signed in to change notification settings - Fork 70
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
Table: Datepicker, AutoComplete, Select Cell Editor #2387
Conversation
✅ Deploy Preview for moduswebcomponents ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
…ble-date-cell-picker
…310/table-date-cell-picker
@ElishaSamPeterPrabhu Some observations:
Component:
|
@ElishaSamPeterPrabhu I went over these changes again and this is what I think is needed before we can merge:
|
Have worked on all of the above suggestions Components._.Table.-.Inline.Editing.Storybook.-.Google.Chrome.2024-06-05.11-19-16.mp4 |
@@ -86,6 +86,10 @@ import { createGuid } from '../../utils/utils'; | |||
export class ModusTable { | |||
@Element() element: HTMLElement; | |||
|
|||
@Prop() editableCellId: string[] = []; | |||
@Watch('editableCellId') onEditableCellIdsChange(newVal: string[]) { | |||
console.log('editableCellIds', newVal); |
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.
Remove console.log
, and was this editableCellId
prop only used for debugging? If so, remove, otherwise we will need to discuss its purpose.
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.
Oops committed it by mistake, will remove it
@@ -373,6 +377,7 @@ export class ModusTable { | |||
this.setTableState(initialTableState); | |||
this.onRowsExpandableChange(this.rowsExpandable); | |||
this.initializeTable(); | |||
console.log('editableCellId232s', this.editableCellId); |
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.
Remove console.log
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.
Removed
@@ -25,28 +26,40 @@ import { ModusAutocompleteOption } from '../../../../modus-autocomplete/modus-au | |||
}) | |||
export class ModusTableCellEditor { | |||
@Prop() args: ModusTableCellEditorArgs; | |||
@Prop() value: string; | |||
@Prop() dataType: string; | |||
@Prop() value: any; |
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.
Don't use any
, if we can't establish the type then use unknown
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.
Replaced with unknown
@Prop() type: string; | ||
@Prop() valueChange: (newValue: string) => void; | ||
@Prop() keyDown: (e: KeyboardEvent, newValue: string) => void; | ||
|
||
private editedValue: string; | ||
private editedValue: any; |
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.
Don't use any
, if we can't establish the type then use unknown
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.
Replaced with unknown
private inputElement: HTMLElement; | ||
private outsideClickListener: (event: any) => void; |
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.
Wouldn't this be of type MouseEvent
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.
Yes, changed
}; | ||
if (this.type == 'date') document.addEventListener('click', this.outsideClickListener); | ||
} | ||
disconnectedCallback(): void { |
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.
Ultimately if we use the @Listen
then we won't need to have this.
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.
Replaced the callback logic with listen
const args = this.args as ModusTableCellSelectEditorArgs; | ||
const options = args?.options || []; | ||
const optionsDisplayProp = args?.optionsDisplayProp || valueKey; | ||
const selectedOption = options.find((option) => option[optionsDisplayProp] === this.value) as any; |
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.
Type would be unknown
. Always be mindful of these lint errors and correct when they are seen. Avoid using any
even when prototyping.
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.
Replaced with unknown
size="large" | ||
options={options} | ||
onInputBlur={this.handleBlur} | ||
onKeyDown={(e) => handleEnter(e, this.handleKeyDown)} | ||
onValueChange={(e: CustomEvent<unknown>) => { | ||
this.editedValue = e.detail[valueKey]; | ||
if (this.dataType === 'badge') { | ||
const { display, ...restProps } = e.detail as any; |
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.
any
should be unknown
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.
Replaced with unknown
const options = ((this.args as ModusTableCellDropdownEditorArgs)?.options || []) as ModusAutocompleteOption[] | string[]; | ||
let options, selectedOption; | ||
const args = this.args as ModusTableCellAutocompleteEditorArgs; | ||
// const { noResultsFoundText, noResultsFoundSubtext, showNoResultsFoundMessage, showOptionsOnFocus } = args; |
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.
Remove commented out code
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.
Removed
{...this.getDefaultProps('Autocomplete input')} | ||
include-search-icon="false" | ||
size="medium" | ||
//onClick={(e: MouseEvent) => e.stopPropagation()} |
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.
Remove commented out code
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.
Removed
For the autocomplete focus issue: |
Description
References
#2310 , #2311 , #2313
Type of change
How Has This Been Tested?
https://deploy-preview-2387--moduswebcomponents.netlify.app/
Checklist