Skip to content
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

Merged
merged 39 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
b95a4c2
Update modus-table cell dropdown editable
ElishaSamPeterPrabhu Mar 28, 2024
725b446
Merge branch 'main' into issue-2313/table_select_cell_picker
ElishaSamPeterPrabhu Mar 28, 2024
f6b56dc
Merge branch 'main' into issue-2313/table_select_cell_picker
ElishaSamPeterPrabhu Apr 1, 2024
f537d06
Update auto complete to badge and link
ElishaSamPeterPrabhu Apr 1, 2024
be4d8fd
Merge branch 'main' into issue-2311/table_autocomplete_cell_editor
ElishaSamPeterPrabhu Apr 1, 2024
3deb650
Update focus of datepicker
ElishaSamPeterPrabhu Apr 1, 2024
b93b6b5
Merge branch 'main' into issue-2311/table_autocomplete_cell_editor
ElishaSamPeterPrabhu Apr 3, 2024
fb830ed
Merge branch 'issue-2313/table_select_cell_picker' into issue-2310/ta…
ElishaSamPeterPrabhu Apr 4, 2024
a56c59e
Merge branch 'issue-2311/table_autocomplete_cell_editor' into issue-2…
ElishaSamPeterPrabhu Apr 4, 2024
b8ecefd
Merge PRs and Format Code
ElishaSamPeterPrabhu Apr 4, 2024
60c0326
Update listener and docs
ElishaSamPeterPrabhu Apr 4, 2024
c6f0351
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu Apr 4, 2024
f5ae27c
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu Apr 8, 2024
dd0cc92
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu Apr 10, 2024
0b56a8e
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu Apr 11, 2024
b71aa9e
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu Apr 17, 2024
38a1ce2
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu Apr 18, 2024
b9af3e8
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu Apr 22, 2024
d14a253
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu Apr 25, 2024
dc87b14
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu Apr 26, 2024
f0a667f
Update behavior
ElishaSamPeterPrabhu Apr 29, 2024
e6daf3c
Align autocomplete cell
ElishaSamPeterPrabhu Apr 30, 2024
79bb111
Update css
ElishaSamPeterPrabhu Apr 30, 2024
caa9de6
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu May 2, 2024
b0d094a
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu May 3, 2024
72aff7a
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu May 15, 2024
a41f396
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu May 16, 2024
70908d1
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu May 20, 2024
fc648ee
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu May 22, 2024
1a82947
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu May 29, 2024
a7fe216
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu May 31, 2024
ec59779
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu Jun 3, 2024
df7ffc8
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu Jun 4, 2024
3e81f63
Update storybook and code logic
ElishaSamPeterPrabhu Jun 5, 2024
a3dbb68
Update input component css
ElishaSamPeterPrabhu Jun 5, 2024
9328a6b
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu Jun 5, 2024
8e27466
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu Jun 6, 2024
9bc859c
Merge branch 'main' into issue-2310/table-date-cell-picker
ElishaSamPeterPrabhu Jun 7, 2024
317ece5
Update logic
ElishaSamPeterPrabhu Jun 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
.chips-container {
align-items: center;
background-color: $modus-autocomplete-bg;
border: $rem-1px solid $modus-autocomplete-container-border-color;
border: var(--modus-autocomplete-border, #{$rem-1px solid $modus-autocomplete-container-border-color});
border-bottom-color: $modus-autocomplete-container-bottom-line-color;
border-radius: 4px;
box-sizing: border-box;
display: flex;
Expand Down Expand Up @@ -59,6 +60,8 @@
height: auto !important;
position: relative;

--input-font-size: var(--modus-autocomplete-font-size, #{12px});

&::part(input-container) {
border: none !important;
box-shadow: none;
Expand Down Expand Up @@ -163,6 +166,7 @@
}

.autocomplete .chips-container:focus-within {
border-color: $modus-autocomplete-container-border-active-color;
box-shadow: 0 0 0 1px $modus-autocomplete-container-border-active-color;
border: var(--modus-autocomplete-border-active, #{$rem-1px solid $modus-autocomplete-container-border-active-color});
box-shadow: 0 0 0 1px
var(--modus-autocomplete-border-active, #{$rem-1px solid $modus-autocomplete-container-border-active-color});
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ $modus-autocomplete-options-border-active-color: var(--modus-list-item-border-co
$modus-autocomplete-no-results-message-color: var(--modus-autocomplete-no-results-message-color, #252a2e) !default;
$modus-autocomplete-no-results-subtext-color: var(--modus-autocomplete-no-results-subtext-color, #252a2e) !default;
$modus-autocomplete-container-border-color: var(--modus-input-border-bottom-color, #6a6e79) !default;
$modus-autocomplete-container-bottom-line-color: var(--modus-input-bottom-line-color, #6a6e79) !default;
$modus-autocomplete-container-border-active-color: var(--modus-input-border-active-line-color, #217cbb) !default;
$modus-autocomplete-bg: var(--modus-autocomplete-bg, #fff) !default;
$modus-autocomplete-label-color: var(--modus-autocomplete-label-color, #464b52) !default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@
}

&:focus-within {
border-color: $modus-input-bottom-line-active-color;
box-shadow: 0 0 0 1px $modus-input-bottom-line-active-color;
border-color: var(--modus-input-border-color, #{$rem-1px solid $modus-input-bottom-line-active-color});
box-shadow: 0 0 0 1px var(--modus-input-border-color, #{$rem-1px solid $modus-input-bottom-line-active-color});

svg.icon-calendar path {
fill: $modus-input-bottom-line-active-color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
}

&:focus-within {
border-color: $modus-input-bottom-line-active-color;
box-shadow: 0 0 0 1px $modus-input-bottom-line-active-color;
border-color: var(--modus-input-border-color, #{$rem-1px solid $modus-input-bottom-line-active-color});
box-shadow: 0 0 0 1px var(--modus-input-border-color, #{$rem-1px solid $modus-input-bottom-line-active-color});
}

&.error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
}

&:focus-within {
border-color: $modus-input-bottom-line-active-color;
box-shadow: 0 0 0 1px $modus-input-bottom-line-active-color;
border-color: var(--modus-input-border-color, #{$rem-1px solid $modus-input-bottom-line-active-color});
box-shadow: 0 0 0 1px var(--modus-input-border-color, #{$rem-1px solid $modus-input-bottom-line-active-color});
}

&.large {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ import {
COLUMN_DEF_DATATYPE_INTEGER,
COLUMN_DEF_DATATYPE_LINK,
COLUMN_DEF_DATATYPE_TEXT,
CELL_EDIT_TYPE_DROPDOWN,
COLUMN_DEF_DATATYPE_BADGE,
CELL_EDIT_TYPE_SELECT,
CELL_EDIT_TYPE_DATE,
CELL_EDIT_TYPE_AUTOCOMPLETE,
CELL_EDIT_TYPE_INT,
CELL_EDIT_TYPE_TEXT,
} from '../modus-table.constants';
import { ModusAutocompleteOption } from '../../modus-autocomplete/modus-autocomplete';

export type ModusTableRowData = RowData;
export type ModusTableSortingState = SortingState;
Expand All @@ -37,12 +42,23 @@ export type ModusTableColumnDataType =
| typeof COLUMN_DEF_DATATYPE_BADGE;
// | typeof COLUMN_DEF_DATATYPE_DATE;

export type ModusTableCellEditorType = typeof CELL_EDIT_TYPE_DROPDOWN;
// typeof CELL_EDIT_TYPE_AUTOCOMPLETE |
export type ModusTableCellEditorType =
| typeof CELL_EDIT_TYPE_SELECT
| typeof CELL_EDIT_TYPE_TEXT
| typeof CELL_EDIT_TYPE_INT
| typeof CELL_EDIT_TYPE_AUTOCOMPLETE
| typeof CELL_EDIT_TYPE_DATE;

export type ModusTableCellDateEditorArgs = { format: string };
export type ModusTableCellDropdownEditorArgs = { options: unknown[] };
export type ModusTableCellEditorArgs = ModusTableCellDropdownEditorArgs | ModusTableCellDateEditorArgs;
export type ModusTableCellSelectEditorArgs = { options: unknown[]; optionsDisplayProp?: string };
export type ModusTableCellAutocompleteEditorArgs = {
options: ModusAutocompleteOption[];
noResultsFoundText: string;
noResultsFoundSubtext: string;
showNoResultsFoundMessage: boolean;
showOptionsOnFocus: boolean;
};
export type ModusTableCellEditorArgs = ModusTableCellSelectEditorArgs | ModusTableCellDateEditorArgs;

export type ModusTableSortingFunction<TData extends RowData> = SortingFnOption<TData> | 'sortForHyperlink' | 'sortForBadge';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ export const COLUMN_DEF_DATATYPE_BADGE = 'badge';

export const CELL_EDIT_TYPE_TEXT = COLUMN_DEF_DATATYPE_TEXT;
export const CELL_EDIT_TYPE_INT = COLUMN_DEF_DATATYPE_INTEGER;
export const CELL_EDIT_TYPE_DROPDOWN = 'dropdown';
export const CELL_EDIT_TYPE_SELECT = 'select';
export const CELL_EDIT_TYPE_AUTOCOMPLETE = 'autocomplete';
export const CELL_EDIT_TYPE_DATE = COLUMN_DEF_DATATYPE_DATE;

export const ALLOWED_CELL_EDIT_TYPES = [
CELL_EDIT_TYPE_TEXT,
CELL_EDIT_TYPE_INT,
CELL_EDIT_TYPE_DROPDOWN,
CELL_EDIT_TYPE_SELECT,
CELL_EDIT_TYPE_AUTOCOMPLETE,
CELL_EDIT_TYPE_DATE,
];
Expand Down
5 changes: 5 additions & 0 deletions stencil-workspace/src/components/modus-table/modus-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@
export class ModusTable {
@Element() element: HTMLElement;

@Prop() editableCellId: string[] = [];
@Watch('editableCellId') onEditableCellIdsChange(newVal: string[]) {
console.log('editableCellIds', newVal);

Check warning on line 91 in stencil-workspace/src/components/modus-table/modus-table.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected console statement
Copy link
Contributor

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.

Copy link
Collaborator Author

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

}
/** (Required) To display headers in the table. */
@Prop({ mutable: true }) columns!: ModusTableColumn<unknown>[];
@Watch('columns') onColumnsChange(newVal: ModusTableColumn<unknown>[]) {
Expand Down Expand Up @@ -373,6 +377,7 @@
this.setTableState(initialTableState);
this.onRowsExpandableChange(this.rowsExpandable);
this.initializeTable();
console.log('editableCellId232s', this.editableCellId);

Check warning on line 380 in stencil-workspace/src/components/modus-table/modus-table.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected console statement
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove console.log

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

}

componentWillRender(): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
:host {
--modus-autocomplete-border: none;
--modus-autocomplete-border-active: none;
--modus-autocomplete-font-size: 14px;
--modus-input-border-color: none;
}

.editor::part(input-container),
.editor::part(input) {
border: none !important;
Expand All @@ -17,3 +24,8 @@ table.density-compact {
height: calc($rem-24px - $rem-4px) !important;
}
}

.autocomplete-container {
margin-left: 4px;
margin-top: 5px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
KEYBOARD_ENTER,
CELL_EDIT_TYPE_AUTOCOMPLETE,
CELL_EDIT_TYPE_DATE,
CELL_EDIT_TYPE_DROPDOWN,
CELL_EDIT_TYPE_SELECT,
CELL_EDIT_TYPE_TEXT,
CELL_EDIT_TYPE_INT,
KEYBOARD_UP,
KEYBOARD_DOWN,
} from '../../../modus-table.constants';

import {
ModusTableCellAutocompleteEditorArgs,
ModusTableCellDateEditorArgs,
ModusTableCellDropdownEditorArgs,
ModusTableCellSelectEditorArgs,
ModusTableCellEditorArgs,
} from '../../../models/modus-table.models';
import { ModusDateInputEventDetails } from '../../../../modus-date-input/utils/modus-date-input.models';
Expand All @@ -25,28 +26,40 @@
})
export class ModusTableCellEditor {
@Prop() args: ModusTableCellEditorArgs;
@Prop() value: string;
@Prop() dataType: string;
@Prop() value: any;

Check warning on line 30 in stencil-workspace/src/components/modus-table/parts/cell/modus-table-cell-editor/modus-table-cell-editor.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
Copy link
Contributor

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

Copy link
Collaborator Author

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;

Check warning on line 35 in stencil-workspace/src/components/modus-table/parts/cell/modus-table-cell-editor/modus-table-cell-editor.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
Copy link
Contributor

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

Copy link
Collaborator Author

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;

Check warning on line 37 in stencil-workspace/src/components/modus-table/parts/cell/modus-table-cell-editor/modus-table-cell-editor.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
Copy link
Contributor

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

Copy link
Collaborator Author

@ElishaSamPeterPrabhu ElishaSamPeterPrabhu Jun 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, changed


connectedCallback(): void {
this.editedValue = this.value;
}

componentDidLoad(): void {
if (this.inputElement['focusInput']) this.inputElement['focusInput']();

this.outsideClickListener = (event) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it may be cleaner to do

  @Listen('click', { target: 'document' })
  handleDocumentClick(event: MouseEvent) {
    if (this.type != 'date'){
      return;
    }
    
    const target = event.target as HTMLElement;
    if (!this.inputElement.contains(event.target)) {
      this.handleBlur();
    }
  }

Also I am a firm believer that we should always use {} in our if statements. So

if (this.type == 'date') document.addEventListener('click', this.outsideClickListener);

is less readable and potentially more error prone than

if (this.type == 'date') {
  document.addEventListener('click', this.outsideClickListener);
}

If we were to keep the original logic, there is no reason to define this.outsideClickListener other than when the type is a date, since you don't register the click event unless it is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced with the above logic

if (!this.inputElement.contains(event.target)) {
this.handleBlur();
}
};
if (this.type == 'date') document.addEventListener('click', this.outsideClickListener);
}
disconnectedCallback(): void {
Copy link
Contributor

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.

Copy link
Collaborator Author

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

document.removeEventListener('click', this.outsideClickListener);
}

handleBlur: () => void = () => {
this.valueChange(this.editedValue);
this.valueChange(this.editedValue as string);
};

handleKeyDown: (e: KeyboardEvent) => void = (e) => {
this.keyDown(e, this.editedValue);
this.keyDown(e, this.editedValue as string);
};

getDefaultProps = (ariaLabel) => ({
Expand Down Expand Up @@ -88,10 +101,12 @@
);
}

renderDropdownInput(): JSX.Element[] {
renderSelectInput(): JSX.Element[] {
const valueKey = 'display';
const options = (this.args as ModusTableCellDropdownEditorArgs)?.options || [];
const selectedOption = options.find((option) => option[valueKey] === this.value);
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;

Check warning on line 109 in stencil-workspace/src/components/modus-table/parts/cell/modus-table-cell-editor/modus-table-cell-editor.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
Copy link
Contributor

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced with unknown


function handleEnter(e: KeyboardEvent, callback: (e: KeyboardEvent) => void) {
const code = e.key.toLowerCase();
Expand All @@ -105,13 +120,20 @@
<modus-select
{...this.getDefaultProps('Select input')}
value={selectedOption}
options-display-prop="display"
options-display-prop={optionsDisplayProp}
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;

Check warning on line 130 in stencil-workspace/src/components/modus-table/parts/cell/modus-table-cell-editor/modus-table-cell-editor.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any should be unknown

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced with unknown

this.editedValue = { ...restProps, text: display };
} else if (this.dataType === 'link') {
this.editedValue = e.detail;
} else {
this.editedValue = e.detail[valueKey];
}
}}></modus-select>
</div>
);
Expand All @@ -121,45 +143,72 @@
const valueKey = 'value';
const format = (this.args as ModusTableCellDateEditorArgs)?.format;
return (
<modus-date-picker>
<modus-date-picker onBlur={this.handleBlur} onClick={(e: MouseEvent) => e.stopPropagation()}>
<modus-date-input
{...this.getDefaultProps('Date input')}
format={format}
size="large"
show-calendar-icon="true"
value={this.value}
onClick={(e: MouseEvent) => e.stopPropagation()}
onValueChange={(e: CustomEvent<ModusDateInputEventDetails>) =>
(this.editedValue = e.detail[valueKey])
}></modus-date-input>
onValueChange={(e: CustomEvent<ModusDateInputEventDetails>) => {
this.editedValue = e.detail[valueKey];
}}></modus-date-input>
</modus-date-picker>
);
}

renderAutocompleteInput(): JSX.Element[] {
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented out code

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

if (this.dataType === 'badge') {
options = args?.options.map((option: any) => option.text) as ModusAutocompleteOption[] | string[];

Check warning on line 165 in stencil-workspace/src/components/modus-table/parts/cell/modus-table-cell-editor/modus-table-cell-editor.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

option would be of time unknown

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced with unknown

selectedOption = this.value['text'];
} else if (this.dataType === 'link') {
options = args?.options.map((option: any) => option.display) as ModusAutocompleteOption[] | string[];

Check warning on line 168 in stencil-workspace/src/components/modus-table/parts/cell/modus-table-cell-editor/modus-table-cell-editor.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

option would be of type unknown

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced with unknown

selectedOption = this.value['display'];
} else {
options = (args?.options || []) as ModusAutocompleteOption[] | string[];
selectedOption = this.editedValue;
}
return (
<modus-autocomplete
{...this.getDefaultProps('Autocomplete input')}
include-search-icon="false"
size="large"
// onClick={(e: MouseEvent) => e.stopPropagation()}
options={options}
// onInputBlur={this.handleBlur}
onOptionSelected={(e: CustomEvent<string>) => {
this.editedValue = e.detail;
this.valueChange(this.editedValue);
}}
// value={selectedOption}
// onKeyDown={(e) => e.stopPropagation()}
></modus-autocomplete>
<div class="autocomplete-container">
<modus-autocomplete
{...this.getDefaultProps('Autocomplete input')}
include-search-icon="false"
size="medium"
//onClick={(e: MouseEvent) => e.stopPropagation()}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented out code

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

options={options}
onBlur={this.handleBlur}
onKeyDown={(e) => e.stopPropagation()}
onOptionSelected={(e: CustomEvent<string>) => {
if (this.dataType === 'badge') {
args?.options.map((option: any) => {

Check warning on line 186 in stencil-workspace/src/components/modus-table/parts/cell/modus-table-cell-editor/modus-table-cell-editor.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

option would be of type unknown

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced with unknown

if (option.text == e.detail) {
this.editedValue = option;
}
});
} else if (this.dataType === 'link') {
args?.options.map((option: any) => {
if (option.display == e.detail) {
this.editedValue = option;
}
});
} else {
this.editedValue = e.detail;
}
}}
value={selectedOption}
// onKeyDown={(e) => e.stopPropagation()}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove any commented out code

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

></modus-autocomplete>
</div>
);
}

renderEditor(): JSX.Element[] {
switch (this.type) {
case CELL_EDIT_TYPE_DROPDOWN:
return this.renderDropdownInput();
case CELL_EDIT_TYPE_SELECT:
return this.renderSelectInput();
case CELL_EDIT_TYPE_AUTOCOMPLETE:
return this.renderAutocompleteInput();
case CELL_EDIT_TYPE_DATE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@

## Properties

| Property | Attribute | Description | Type | Default |
| ------------- | --------- | ----------- | ------------------------------------------------ | ----------- |
| `args` | -- | | `{ format: string; } \| { options: unknown[]; }` | `undefined` |
| `keyDown` | -- | | `(e: KeyboardEvent, newValue: string) => void` | `undefined` |
| `type` | `type` | | `string` | `undefined` |
| `value` | `value` | | `string` | `undefined` |
| `valueChange` | -- | | `(newValue: string) => void` | `undefined` |
| Property | Attribute | Description | Type | Default |
| ------------- | ----------- | ----------- | ----------------------------------------------------------------------------- | ----------- |
| `args` | -- | | `{ format: string; } \| { options: unknown[]; optionsDisplayProp?: string; }` | `undefined` |
| `dataType` | `data-type` | | `string` | `undefined` |
| `keyDown` | -- | | `(e: KeyboardEvent, newValue: string) => void` | `undefined` |
| `type` | `type` | | `string` | `undefined` |
| `value` | `value` | | `any` | `undefined` |
| `valueChange` | -- | | `(newValue: string) => void` | `undefined` |


## Dependencies
Expand Down
Loading