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

[Lens] Adds dynamic table cell coloring #95217

Merged
merged 158 commits into from
May 28, 2021
Merged
Show file tree
Hide file tree
Changes from 155 commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
aab74bd
:sparkles: First barch of features for the dynamic coloring
dej611 Mar 23, 2021
f0cf421
Merge branch 'master' into lens/dynamic-coloring-table
kibanamachine Mar 24, 2021
65425b9
Merge remote-tracking branch 'upstream/master' into lens/dynamic-colo…
dej611 Mar 24, 2021
04a72a1
:label: Fix type issues in palette
dej611 Mar 24, 2021
6946e14
:bug: Fix reverse bug
dej611 Mar 25, 2021
fd3cb0d
:sparkles: Add getGradientHelper + make prev getColor(s) to categoric…
dej611 Mar 25, 2021
59add6a
:sparkles: Improved color assignment
dej611 Mar 26, 2021
8bbc32c
:fire: Remove NativeRenderer as discussed offline
dej611 Mar 26, 2021
7caf16b
:label: + :white_check_mark: Fix types and unit tests broken
dej611 Mar 26, 2021
838cd4b
:globe_with_meridians: Fix i18n issue
dej611 Mar 26, 2021
4325d6e
:bug: Migrating to new palette API
dej611 Mar 26, 2021
b6e5da8
:bug: Fix custom palette with percentage range side checks
dej611 Mar 29, 2021
33d3880
:white_check_mark: Add tests for new API
dej611 Mar 29, 2021
86f96c6
:white_check_mark: Add test for stops reverse
dej611 Mar 29, 2021
1e706a4
:bug: Fix bugs with segments assignment + bound checks
dej611 Mar 29, 2021
151782e
:white_check_mark: Add cell value coloring suite
dej611 Mar 29, 2021
605f90f
:sparkles: Add new custom gradient enabled mock palette
dej611 Mar 29, 2021
6369003
:bug: fix issue with columns with prev format + speed up numeric check
dej611 Mar 29, 2021
6d351d0
:white_check_mark: Add table context tests
dej611 Mar 29, 2021
0b62d3c
:lipstick: Move to initial flyout
dej611 Mar 30, 2021
d46db64
:truck: Rename palette panel file
dej611 Mar 30, 2021
2c6677e
:white_check_mark: Add more unit/component tests
dej611 Mar 30, 2021
2856d09
Merge remote-tracking branch 'upstream/master' into lens/dynamic-colo…
dej611 Mar 30, 2021
e30f1b5
Merge remote-tracking branch 'upstream/master' into lens/dynamic-colo…
dej611 Mar 30, 2021
5cfbeb2
Merge remote-tracking branch 'upstream/master' into lens/dynamic-colo…
dej611 Mar 30, 2021
842db6a
:globe_with_meridians: Fix i18n issue
dej611 Mar 30, 2021
84ff634
:label: fix type issue
dej611 Mar 30, 2021
d1c9d21
:white_check_mark: Add a11y tests for dynamic coloring
dej611 Mar 30, 2021
2c29274
Merge remote-tracking branch 'upstream/master' into lens/dynamic-colo…
dej611 Mar 30, 2021
67121fb
:white_check_mark: Add functional tests for dynamic coloring
dej611 Mar 31, 2021
eb29048
Merge remote-tracking branch 'upstream/master' into lens/dynamic-colo…
dej611 Apr 1, 2021
992a720
Merge branch 'master' into lens/dynamic-coloring-table
kibanamachine Apr 1, 2021
cd76fb4
:bug: Fix value normalization for 1 value ranges
dej611 Apr 1, 2021
384d866
:white_check_mark: Add test for single value range
dej611 Apr 2, 2021
205a6aa
Merge branch 'lens/dynamic-coloring-table' of github.com:dej611/kiban…
dej611 Apr 2, 2021
c8a797b
:pencil2: Fix wrong labelling
dej611 Apr 2, 2021
07a390d
:lipstick: Add stacked flyout
dej611 Apr 2, 2021
2fb5f2c
:white_check_mark: Fix ref issue with new flyout panel
dej611 Apr 2, 2021
40aaa78
:lipstick: Fix disalignment between ColorStops and ColorDisplay compo…
dej611 Apr 2, 2021
a6d45be
:ok_hand: Avoid quick string casting
dej611 Apr 2, 2021
010bd4e
:white_check_mark: Fixed missing ref
dej611 Apr 2, 2021
ffbb597
:white_check_mark: Fix functional broken test
dej611 Apr 2, 2021
26ac213
:white_check_mark: Fix accessibility tests for new flyout layout
dej611 Apr 2, 2021
ae5d169
Merge branch 'master' into lens/dynamic-coloring-table
kibanamachine Apr 6, 2021
228fc87
:pencil2: Add documentation for new dynamic coloring
dej611 Apr 6, 2021
e40b1b5
eui to 31.12.0
thompsongl Apr 6, 2021
c40c7b6
type updates
thompsongl Apr 6, 2021
4cc4a70
snapshot updates
thompsongl Apr 6, 2021
c51a382
snapshot updates
thompsongl Apr 7, 2021
4e610e3
euiavatarprops
thompsongl Apr 7, 2021
19b85be
Merge branch 'master' into eui/32.0
thompsongl Apr 7, 2021
5a658fd
eui to 32.0.3
thompsongl Apr 7, 2021
dcc3473
Merge branch 'master' into eui/32.0
thompsongl Apr 7, 2021
59f3dd4
euicard updates
thompsongl Apr 7, 2021
51f7c03
Merge branch 'master' into eui/32.0
thompsongl Apr 8, 2021
102f809
update test
thompsongl Apr 8, 2021
3fb8dbf
Merge branch 'master' into eui/32.0
thompsongl Apr 12, 2021
1994016
Merge branch 'master' into eui/32.0
thompsongl Apr 13, 2021
c0d85b1
Merge branch 'pr/96459' into lens/dynamic-coloring-table-2
dej611 Apr 13, 2021
ec37938
:sparkles: Introduce new stepped palette
dej611 Apr 14, 2021
5e15b8d
Merge remote-tracking branch upstream/master into lens/dynamic-colori…
dej611 Apr 19, 2021
cdfe83e
:lipstick: Differenciate panel back icon
dej611 Apr 19, 2021
11237eb
:lipstick: Fix flush
dej611 Apr 19, 2021
0524825
:ok_hand: First batch of fixes based on feedbacks
dej611 Apr 19, 2021
652ca77
:ok_hand: Sync color stops with range inputs
dej611 Apr 19, 2021
9b8d23f
:bug: Fix various issues with new stops remapping
dej611 Apr 20, 2021
432ebef
:lipstick: Add icon and palette on dimension
dej611 Apr 20, 2021
53650cd
:ok_hand: Fix types + add tooltips for disabled range fields
dej611 Apr 20, 2021
3c0d9b6
:white_check_mark: Fix unit tests
dej611 Apr 20, 2021
8e07fe7
Merge branch 'master' into lens/dynamic-coloring-table
kibanamachine Apr 20, 2021
711c3a4
Merge remote-tracking branch 'upstream/master' into lens/dynamic-colo…
dej611 Apr 21, 2021
c777c46
:bug: Fix issue that was affecting functional test
dej611 Apr 21, 2021
786187e
Merge branch 'master' into lens/dynamic-coloring-table
kibanamachine Apr 23, 2021
457b617
Merge remote-tracking branch 'upstream/master' into lens/dynamic-colo…
dej611 Apr 26, 2021
3664f08
Merge remote-tracking branch upstream/master into lens/dynamic-colori…
dej611 Apr 26, 2021
3f70b70
Merge branch 'lens/dynamic-coloring-table' of github.com:dej611/kiban…
dej611 Apr 26, 2021
3c62f43
:sparkles: Use live data for ranges
dej611 Apr 27, 2021
ce498fb
:recycle: Rework dynamic coloring implementation with activeData + ne…
dej611 Apr 30, 2021
2f3f5a1
Merge remote-tracking branch 'upstream/master' into lens/dynamic-colo…
dej611 Apr 30, 2021
3138d90
Merge remote-tracking branch 'upstream/master' into lens/dynamic-colo…
dej611 May 4, 2021
dda7496
:sparkles: Rework without fixed mode
dej611 May 5, 2021
b31fa03
:sparkles: implement only fixed mode
dej611 May 5, 2021
c99a666
:bug: Fix disabled state
dej611 May 6, 2021
415d159
:speech_balloon: Add color stop help content
dej611 May 6, 2021
3f4aed6
:fire: Remove steps slider
dej611 May 6, 2021
1db5b7d
:bug: Restore working bits
dej611 May 6, 2021
baa99bd
:sparkles: Reworked for all fixed mode
dej611 May 6, 2021
2ebbe76
Merge branch 'master' into lens/dynamic-coloring-table
kibanamachine May 10, 2021
12b1f6d
:bug: Fix various issues found
dej611 May 10, 2021
cba35ae
:bug: Fix add color stop bug
dej611 May 10, 2021
f8ba1e8
:bug: Fix inclusiveness check
dej611 May 10, 2021
ddb8151
:speech_balloon: Fix i18n tag
dej611 May 10, 2021
8911e54
:speech_balloon: Fix another i18n issue
dej611 May 10, 2021
2736fa3
:fire: Remove all gradient logic
dej611 May 10, 2021
ee0290b
:fire: Remove more code from previous implementations
dej611 May 10, 2021
abe60c8
:label: fix type issue in tests
dej611 May 10, 2021
a8c8f3c
:label: Fix more type issues
dej611 May 10, 2021
438bf9a
:sparkles: Add support for negative values + limit digits to 2
dej611 May 10, 2021
3765ce9
:white_check_mark: Fix some unit tests
dej611 May 10, 2021
00052a2
:truck: First migration pass
dej611 May 11, 2021
7c676f6
:truck: Moved more utilities to the shared codebase
dej611 May 11, 2021
f39ad69
:sparkles: Chosen sorting on block blur
dej611 May 11, 2021
3c5d65b
:white_check_mark: Add tests for more coloring stuff
dej611 May 11, 2021
8442188
:white_check_mark: Fix naming issue
dej611 May 11, 2021
a683a98
:white_check_mark: Fix all tests
dej611 May 11, 2021
127e786
:sparkles: Restored onBlur option to test
dej611 May 11, 2021
18cd6d4
Merge remote-tracking branch 'upstream/master' into lens/dynamic-colo…
dej611 May 12, 2021
5fb6d50
:bug: Fix the reverse bug + sort on row blur
dej611 May 12, 2021
8f32109
:white_check_mark: Fix remaining failing tests
dej611 May 12, 2021
f9f2aa3
:label: Fix type issue
dej611 May 12, 2021
4c25801
:ok_hand: First batch of feedback integrated
dej611 May 13, 2021
e365f3f
:label: Fix type issue
dej611 May 13, 2021
b775a9a
:fire: remove doc for now
dej611 May 13, 2021
a660e0b
:lipstick: More ui refactoring
dej611 May 13, 2021
f60063f
:truck: Move value to color function to the custom palette
dej611 May 13, 2021
449b6ed
:white_check_mark: Fix tests affected by the move
dej611 May 13, 2021
118f252
:rotating_light: Remove unused type
dej611 May 13, 2021
f9fec50
:ok_hand: Reduce tooltip message
dej611 May 13, 2021
20e9110
:sparkles: Support transposed global min/max computation
dej611 May 13, 2021
3f3857d
:white_check_mark: Fix failing tests
dej611 May 14, 2021
5ebbd11
Merge remote-tracking branch 'upstream/master' into lens/dynamic-colo…
dej611 May 14, 2021
51a9e77
:white_check_mark: Fix functional test
dej611 May 14, 2021
acdbbc0
:fire: remove code
dej611 May 14, 2021
a6b2872
:white_check_mark: Update functional tests
dej611 May 14, 2021
7449290
:truck: Moved more files to shared folder
dej611 May 14, 2021
7b783fd
:white_check_mark: Fix test for new picker
dej611 May 14, 2021
7853371
:bug: Fix delete delay for stops
dej611 May 14, 2021
75f70c2
:speech_balloon: Add aria announcements on stops sort
dej611 May 14, 2021
1576a61
[Lens] Dynamic Coloring Design Tweaks (#7)
May 17, 2021
8b19e88
:ok_hand: Restore previous value on color field lost of focus
dej611 May 17, 2021
a8b3d8e
:white_check_mark: Fix a11y + functional tests and refactored methods
dej611 May 17, 2021
b47bb12
:lipstick: Remove transparent placeholder
dej611 May 17, 2021
c1710b9
:bug: disambiguate palette picker helpers
dej611 May 17, 2021
3a03887
Merge branch 'master' into lens/dynamic-coloring-table
kibanamachine May 17, 2021
7ede507
:white_check_mark: Fix test
dej611 May 17, 2021
ed43b8f
Merge branch 'lens/dynamic-coloring-table' of github.com:dej611/kiban…
dej611 May 17, 2021
8b1368a
Merge remote-tracking branch upstream/master into lens/dynamic-colori…
dej611 May 18, 2021
e21d482
:truck: Move useDebounceWithOptions to avoid cyclic dependency
dej611 May 18, 2021
b9fae38
Merge branch 'master' into lens/dynamic-coloring-table
dej611 May 18, 2021
60402f7
Merge remote-tracking branch upstream/master into lens/dynamic-colori…
dej611 May 20, 2021
724513d
:bug: Fix invalid color string issue
dej611 May 20, 2021
a65338c
:bug: Fix same stop issue
dej611 May 20, 2021
d669fa9
Merge branch 'lens/dynamic-coloring-table' of github.com:dej611/kiban…
dej611 May 20, 2021
d7e4c90
:ok_hand: Resolved all raised issues
dej611 May 24, 2021
688d0c2
:bug: Handle the unmount issue
dej611 May 24, 2021
7228e9c
Merge branch 'master' into lens/dynamic-coloring-table
kibanamachine May 24, 2021
2a709a2
:bug: Fix the debouncing issue
dej611 May 26, 2021
8ad2493
:lipstick: Add pointer look to palette hover
dej611 May 26, 2021
58e5998
Merge branch 'master' into lens/dynamic-coloring-table
kibanamachine May 26, 2021
c3c4bf0
:fire: Remove old screenshots in doc
dej611 May 26, 2021
b18be4e
Merge branch 'lens/dynamic-coloring-table' of github.com:dej611/kiban…
dej611 May 26, 2021
ec13bb4
Merge branch 'master' into lens/dynamic-coloring-table
kibanamachine May 27, 2021
96a13e3
:bug: Fix focus bug + empty dataset
dej611 May 27, 2021
e8b62fb
:bug: Remove positional cache
dej611 May 27, 2021
13fb8cb
:bug: Check on the whole palette configuration to refresh local state
dej611 May 27, 2021
266dd99
:bug: Address both convertion issue at the source
dej611 May 28, 2021
59c029d
:label: Fix type issue
dej611 May 28, 2021
637bddd
Merge branch 'master' into lens/dynamic-coloring-table
kibanamachine May 28, 2021
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
25 changes: 24 additions & 1 deletion src/plugins/charts/common/palette.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ import {
systemPalette,
PaletteOutput,
CustomPaletteState,
CustomPaletteArguments,
} from './palette';
import { functionWrapper } from 'src/plugins/expressions/common/expression_functions/specs/tests/utils';

describe('palette', () => {
const fn = functionWrapper(palette()) as (
context: null,
args?: { color?: string[]; gradient?: boolean; reverse?: boolean }
args?: Partial<CustomPaletteArguments>
) => PaletteOutput<CustomPaletteState>;

it('results a palette', () => {
Expand All @@ -39,6 +40,18 @@ describe('palette', () => {
});
});

describe('stop', () => {
it('sets stops', () => {
const result = fn(null, { color: ['red', 'green', 'blue'], stop: [1, 2, 3] });
expect(result.params!.stops).toEqual([1, 2, 3]);
});

it('defaults to pault_tor_14 colors', () => {
const result = fn(null);
expect(result.params!.colors).toEqual(defaultCustomColors);
});
});

describe('gradient', () => {
it('sets gradient', () => {
let result = fn(null, { gradient: true });
Expand Down Expand Up @@ -69,6 +82,16 @@ describe('palette', () => {
const result = fn(null);
expect(result.params!.colors).toEqual(defaultCustomColors);
});

it('keeps the stops order pristine when set', () => {
const stops = [1, 2, 3];
const result = fn(null, {
color: ['red', 'green', 'blue'],
stop: [1, 2, 3],
reverse: true,
});
expect(result.params!.stops).toEqual(stops);
});
});
});
});
Expand Down
60 changes: 58 additions & 2 deletions src/plugins/charts/common/palette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,21 @@ export interface CustomPaletteArguments {
color?: string[];
gradient: boolean;
reverse?: boolean;
stop?: number[];
range?: 'number' | 'percent';
rangeMin?: number;
rangeMax?: number;
continuity?: 'above' | 'below' | 'all' | 'none';
}

export interface CustomPaletteState {
colors: string[];
gradient: boolean;
stops: number[];
range: 'number' | 'percent';
rangeMin: number;
rangeMax: number;
continuity?: 'above' | 'below' | 'all' | 'none';
}

export interface SystemPaletteArguments {
Expand Down Expand Up @@ -83,6 +93,35 @@ export function palette(): ExpressionFunctionDefinition<
}),
required: false,
},
stop: {
multi: true,
types: ['number'],
help: i18n.translate('charts.functions.palette.args.stopHelpText', {
defaultMessage:
'The palette color stops. When used, it must be associated with each color.',
}),
required: false,
},
continuity: {
types: ['string'],
options: ['above', 'below', 'all', 'none'],
default: 'above',
help: '',
},
rangeMin: {
types: ['number'],
help: '',
},
rangeMax: {
types: ['number'],
help: '',
},
range: {
types: ['string'],
options: ['number', 'percent'],
default: 'percent',
help: '',
},
gradient: {
types: ['boolean'],
default: false,
Expand All @@ -101,15 +140,32 @@ export function palette(): ExpressionFunctionDefinition<
},
},
fn: (input, args) => {
const { color, reverse, gradient } = args;
const {
color,
continuity,
reverse,
gradient,
stop,
range,
rangeMin = 0,
rangeMax = 100,
} = args;
const colors = ([] as string[]).concat(color || defaultCustomColors);

const stops = ([] as number[]).concat(stop || []);
if (stops.length > 0 && colors.length !== stops.length) {
throw Error('When stop is used, each color must have an associated stop value.');
}
return {
type: 'palette',
name: 'custom',
params: {
colors: reverse ? colors.reverse() : colors,
stops,
range: range ?? 'percent',
gradient,
continuity,
rangeMin,
rangeMax,
},
};
},
Expand Down
Loading