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

feat(item): show tooltip when text ellipsis #394

Merged
merged 26 commits into from
Sep 6, 2022
Merged
Changes from 2 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
cec66de
feat(item): show tooltip when text ellipsis
Nantawat-Poothong Jul 12, 2022
03d0e02
style(item): fix lint error
Nantawat-Poothong Jul 12, 2022
ce428da
fix(item): remove condition to register tooltip
Nantawat-Poothong Jul 14, 2022
641f41e
chore(item): use isElementOverflown and remove isTruncated
Nantawat-Poothong Jul 14, 2022
f71343a
Merge branch 'v6' into fix/select-with-tooltip-data-object
Nantawat-Poothong Jul 18, 2022
ec8dfee
fix(item): add tooltip for label and sub-label
Nantawat-Poothong Aug 17, 2022
647c1e9
fix(item): change way to call methods
Nantawat-Poothong Aug 17, 2022
b35b2e8
Merge branch 'v6' into fix/select-with-tooltip-data-object
Nantawat-Poothong Aug 17, 2022
c01de6a
test(item): add more test cases
Nantawat-Poothong Aug 18, 2022
077f9c1
Merge branch 'v6' into fix/select-with-tooltip-data-object
Nantawat-Poothong Aug 18, 2022
e99d4e3
Merge branch 'v6' into fix/select-with-tooltip-data-object
Nantawat-Poothong Aug 18, 2022
5913e0d
fix(item): update tooltip content
Nantawat-Poothong Aug 18, 2022
390305b
fix(item): update tooltip follow feedback
Nantawat-Poothong Aug 25, 2022
79b5617
fix(item): update subLabel show content logic
Nantawat-Poothong Aug 25, 2022
d293a1e
Merge branch 'v6' into fix/select-with-tooltip-data-object
Nantawat-Poothong Aug 25, 2022
6701858
chore(color-picker): add new slot ref
Nantawat-Poothong Aug 26, 2022
9f76ec7
Merge remote-tracking branch 'origin/fix/select-with-tooltip-data-obj…
Nantawat-Poothong Aug 26, 2022
1495102
fix(item): update test snapshot
Nantawat-Poothong Aug 26, 2022
b9a5731
chore(color-picker): simplify label and subLabel logic template
Nantawat-Poothong Aug 26, 2022
0036e90
fix(item): remove unnecessary code
Nantawat-Poothong Aug 26, 2022
eba8dcd
Merge branch 'v6' into fix/select-with-tooltip-data-object
Nantawat-Poothong Aug 26, 2022
6e4d645
chore(item): update code comment
Nantawat-Poothong Aug 31, 2022
ca05a77
chore(item): remove unnecessary casting type
Nantawat-Poothong Aug 31, 2022
4849f93
chore(color-picker): remove empty line
Nantawat-Poothong Sep 1, 2022
e29c869
Merge branch 'v6' into fix/select-with-tooltip-data-object
Nantawat-Poothong Sep 5, 2022
59e0f3d
fix(item): handle empty slot when assign to nodes
Nantawat-Poothong Sep 6, 2022
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
13 changes: 13 additions & 0 deletions packages/elements/src/item/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { query } from '@refinitiv-ui/core/decorators/query.js';
import { VERSION } from '../version.js';
import '../icon/index.js';
import '../checkbox/index.js';
import { registerOverflowTooltip } from '../tooltip/index.js';

import type { ItemType, ItemText, ItemHeader, ItemDivider, ItemData } from './helpers/types';
export type { ItemType, ItemText, ItemHeader, ItemDivider, ItemData };
Expand Down Expand Up @@ -260,6 +261,18 @@ export class Item extends ControlElement {
return !!(this.labelEl && (this.labelEl.offsetWidth < this.labelEl.scrollWidth));
}

/**
* Called after the component is first rendered
* @param changedProperties Properties which have changed
* @returns {void}
*/
protected firstUpdated (changedProperties: PropertyValues): void {
super.firstUpdated(changedProperties);
if (this.labelEl) {
registerOverflowTooltip(this.labelEl, () => this.textContent, () => this.isTruncated);
TremayneChrist marked this conversation as resolved.
Show resolved Hide resolved
}
}

/**
* A `TemplateResult` that will be used
* to render the updated internal template.
Expand Down