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 all 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
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@ import {
h, // eslint-disable-line @typescript-eslint/no-unused-vars
} from '@stencil/core';
import { ModusTableCellBadge } from '../../models/modus-table.models';
import { KEYBOARD_ENTER, KEYBOARD_SPACE } from '../../modus-table.constants';

interface ModusTableCellBadgeProps {
badge: ModusTableCellBadge;
onBadgeClick?: (badge: ModusTableCellBadge) => void;
}

export const ModusTableCellBadgeElement: FunctionalComponent<ModusTableCellBadgeProps> = ({ badge }) => {
export const ModusTableCellBadgeElement: FunctionalComponent<ModusTableCellBadgeProps> = ({ badge, onBadgeClick }) => {
function handleBadgeKeyDown(e: KeyboardEvent) {
const key = e.key.toLowerCase();
if (key === KEYBOARD_ENTER || key === KEYBOARD_SPACE) {
onBadgeClick(badge);
e.stopImmediatePropagation();
}
}

return (
<div class="cell-badge">
<div class="cell-badge" onClick={() => onBadgeClick(badge)} onKeyDown={() => handleBadgeKeyDown}>
<modus-badge tabIndex={0} color={badge.color} size={badge.size} type={badge.type} ariaLabel={badge?.ariaLabel}>
{badge.text}
</modus-badge>
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;
}
Loading