@operato/data-grist 0.2.41 → 0.2.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/custom-elements.json +186 -14
- package/demo/index.html +79 -39
- package/dist/src/data-grid/data-grid-header.d.ts +1 -1
- package/dist/src/data-grid/data-grid-header.js +39 -9
- package/dist/src/data-grid/data-grid-header.js.map +1 -1
- package/dist/src/data-grist.d.ts +2 -1
- package/dist/src/data-grist.js +6 -3
- package/dist/src/data-grist.js.map +1 -1
- package/dist/src/filters/filter-checkbox.d.ts +2 -0
- package/dist/src/filters/filter-checkbox.js +30 -0
- package/dist/src/filters/filter-checkbox.js.map +1 -0
- package/dist/src/filters/filter-input.d.ts +2 -0
- package/dist/src/filters/filter-input.js +7 -0
- package/dist/src/filters/filter-input.js.map +1 -0
- package/dist/src/filters/filter-range-date.d.ts +2 -0
- package/dist/src/filters/filter-range-date.js +10 -0
- package/dist/src/filters/filter-range-date.js.map +1 -0
- package/dist/src/filters/filter-range-number.d.ts +2 -0
- package/dist/src/filters/filter-range-number.js +9 -0
- package/dist/src/filters/filter-range-number.js.map +1 -0
- package/dist/src/filters/filter-select.d.ts +2 -0
- package/dist/src/filters/filter-select.js +9 -0
- package/dist/src/filters/filter-select.js.map +1 -0
- package/dist/src/filters/filter-styles.d.ts +1 -0
- package/dist/src/filters/filter-styles.js +40 -0
- package/dist/src/filters/filter-styles.js.map +1 -0
- package/dist/src/filters/index.d.ts +5 -1
- package/dist/src/filters/index.js +5 -1
- package/dist/src/filters/index.js.map +1 -1
- package/dist/src/filters/registry.js +26 -23
- package/dist/src/filters/registry.js.map +1 -1
- package/dist/src/types.d.ts +4 -4
- package/dist/src/types.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/data-grid/data-grid-header.ts +42 -10
- package/src/data-grist.ts +7 -4
- package/src/filters/filter-checkbox.ts +35 -0
- package/src/filters/filter-input.ts +10 -0
- package/src/filters/filter-range-date.ts +13 -0
- package/src/filters/filter-range-number.ts +12 -0
- package/src/filters/filter-select.ts +11 -0
- package/src/filters/filter-styles.ts +40 -0
- package/src/filters/index.ts +5 -1
- package/src/filters/registry.ts +26 -23
- package/src/types.ts +4 -5
- package/themes/grist-theme.css +3 -0
- package/yarn-error.log +3149 -2371
- package/src/filters/list-select.ts +0 -14
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { html } from 'lit-html'
|
|
2
|
+
|
|
3
|
+
import { FilterSelectRenderer } from '../types'
|
|
4
|
+
|
|
5
|
+
export const FilterRangeDate: FilterSelectRenderer = (column, owner) => {
|
|
6
|
+
const filter = column.filter
|
|
7
|
+
var type = typeof filter === 'boolean' ? column.type : filter?.type || column.type
|
|
8
|
+
if (type === 'datetime') {
|
|
9
|
+
type = 'datetime-local'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return html` <input name="from" type=${type} /> ~ <input name="to" type=${type} /> `
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { html } from 'lit-html'
|
|
2
|
+
|
|
3
|
+
import { FilterSelectRenderer } from '../types'
|
|
4
|
+
|
|
5
|
+
export const FilterRangeNumber: FilterSelectRenderer = (column, owner) => {
|
|
6
|
+
const filter = column.filter
|
|
7
|
+
const type = typeof filter === 'boolean' ? column.type : filter?.type || column.type
|
|
8
|
+
|
|
9
|
+
return html`
|
|
10
|
+
<input name="from" type="number" placeholder="minimum" /> ~ <input name="to" type="number" placeholder="maximum" />
|
|
11
|
+
`
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { html } from 'lit-html'
|
|
2
|
+
|
|
3
|
+
import { FilterSelectRenderer } from '../types'
|
|
4
|
+
|
|
5
|
+
export const FilterSelect: FilterSelectRenderer = (column, owner) => {
|
|
6
|
+
const options = (typeof column.filter !== 'boolean' && column.filter?.options) || []
|
|
7
|
+
|
|
8
|
+
return html`
|
|
9
|
+
${options?.map((option: string) => html` <ox-checkbox option value=${option}>${option}</ox-checkbox> `)}
|
|
10
|
+
`
|
|
11
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { css } from 'lit'
|
|
2
|
+
|
|
3
|
+
export const FilterStyles = css`
|
|
4
|
+
:host {
|
|
5
|
+
--ox-input-placeholder-color: var(--primary-color);
|
|
6
|
+
|
|
7
|
+
--ox-input-padding: var(--padding-narrow) var(--padding-default);
|
|
8
|
+
--ox-input-border: 1px solid rgba(0, 0, 0, 0.2);
|
|
9
|
+
--ox-input-border-radius: var(--border-radius);
|
|
10
|
+
--ox-input-font: normal 14px var(--theme-font);
|
|
11
|
+
--ox-input-color: var(--primary-text-color);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
[filter] input::placeholder {
|
|
15
|
+
color: var(--ox-input-placeholder-color);
|
|
16
|
+
opacity: 0.7;
|
|
17
|
+
}
|
|
18
|
+
[filter] input {
|
|
19
|
+
margin: 0 10px 5px 10px;
|
|
20
|
+
padding: var(--ox-input-padding);
|
|
21
|
+
border: var(--ox-input-border);
|
|
22
|
+
border-radius: var(--ox-input-border-radius);
|
|
23
|
+
font: var(--ox-input-font);
|
|
24
|
+
color: var(--ox-input-color, #3a5877);
|
|
25
|
+
}
|
|
26
|
+
[filter] input[type='number'] {
|
|
27
|
+
padding-right: var(--padding-narrow);
|
|
28
|
+
max-width: 100px;
|
|
29
|
+
}
|
|
30
|
+
[filter] input[type='datetime-local'] {
|
|
31
|
+
padding-right: var(--padding-narrow);
|
|
32
|
+
max-width: 170px;
|
|
33
|
+
}
|
|
34
|
+
[filter] input[name='from'] {
|
|
35
|
+
margin: 0 0 5px 10px;
|
|
36
|
+
}
|
|
37
|
+
[filter] input[name='to'] {
|
|
38
|
+
margin: 0 10px 5px 0;
|
|
39
|
+
}
|
|
40
|
+
`
|
package/src/filters/index.ts
CHANGED
package/src/filters/registry.ts
CHANGED
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
import { FilterSelectRenderer } from '../types'
|
|
2
|
-
import {
|
|
2
|
+
import { FilterCheckbox } from './filter-checkbox'
|
|
3
|
+
import { FilterInput } from './filter-input'
|
|
4
|
+
import { FilterRangeDate } from './filter-range-date'
|
|
5
|
+
import { FilterRangeNumber } from './filter-range-number'
|
|
6
|
+
import { FilterSelect } from './filter-select'
|
|
3
7
|
|
|
4
8
|
var RENDERERS: {
|
|
5
9
|
[name: string]: FilterSelectRenderer
|
|
6
10
|
} = {
|
|
7
|
-
string:
|
|
8
|
-
text:
|
|
9
|
-
email:
|
|
10
|
-
tel:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
json5: ListSelect
|
|
11
|
+
string: FilterInput,
|
|
12
|
+
text: FilterInput,
|
|
13
|
+
email: FilterInput,
|
|
14
|
+
tel: FilterInput,
|
|
15
|
+
integer: FilterRangeNumber,
|
|
16
|
+
float: FilterRangeNumber,
|
|
17
|
+
number: FilterRangeNumber,
|
|
18
|
+
select: FilterSelect,
|
|
19
|
+
boolean: FilterCheckbox,
|
|
20
|
+
checkbox: FilterCheckbox,
|
|
21
|
+
month: FilterRangeDate,
|
|
22
|
+
week: FilterRangeDate,
|
|
23
|
+
date: FilterRangeDate,
|
|
24
|
+
time: FilterRangeDate,
|
|
25
|
+
datetime: FilterRangeDate,
|
|
26
|
+
color: FilterInput,
|
|
27
|
+
progress: FilterRangeNumber,
|
|
28
|
+
link: FilterInput,
|
|
29
|
+
image: FilterInput,
|
|
30
|
+
json5: FilterInput
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
export function registerRenderer(type: string, renderer: FilterSelectRenderer) {
|
|
@@ -44,5 +47,5 @@ export function getRenderer(type: string | FilterSelectRenderer): FilterSelectRe
|
|
|
44
47
|
return type
|
|
45
48
|
}
|
|
46
49
|
|
|
47
|
-
return RENDERERS[type || 'text'] ||
|
|
50
|
+
return RENDERERS[type || 'text'] || FilterSelect
|
|
48
51
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { TemplateResult } from 'lit-html'
|
|
2
|
-
|
|
3
1
|
import { DataCardField } from './data-card/data-card-field'
|
|
4
2
|
import { DataCardGutter } from './data-card/data-card-gutter'
|
|
5
|
-
import { RecordCard } from './data-card/record-card'
|
|
6
3
|
import { DataGridField } from './data-grid/data-grid-field'
|
|
7
4
|
import { DataListField } from './data-list/data-list-field'
|
|
8
5
|
import { DataListGutter } from './data-list/data-list-gutter'
|
|
9
|
-
import { RecordPartial } from './data-list/record-partial'
|
|
10
6
|
import { DataReportField } from './data-report/data-report-field'
|
|
7
|
+
import { RecordCard } from './data-card/record-card'
|
|
8
|
+
import { RecordPartial } from './data-list/record-partial'
|
|
9
|
+
import { TemplateResult } from 'lit-html'
|
|
11
10
|
|
|
12
11
|
export type GristConfig = {
|
|
13
12
|
columns: ColumnConfig[]
|
|
@@ -19,7 +18,7 @@ export type GristConfig = {
|
|
|
19
18
|
|
|
20
19
|
export type SorterConfig = { name: string; desc?: boolean }
|
|
21
20
|
export type SortersConfig = SorterConfig[]
|
|
22
|
-
export type FilterConfig = { type: string; options?: { [key: string]: any } }
|
|
21
|
+
export type FilterConfig = { type: string; options?: { [key: string]: any } } | boolean
|
|
23
22
|
|
|
24
23
|
export type PaginationConfig = {
|
|
25
24
|
page?: number
|
package/themes/grist-theme.css
CHANGED
|
@@ -33,6 +33,9 @@ body {
|
|
|
33
33
|
--grid-header-splitter-border-hover: 1px solid var(--primary-color);
|
|
34
34
|
--grid-header-color: rgba(var(--secondary-color-rgb), 0.8);
|
|
35
35
|
--grid-header-font: bold var(--fontsize-small) var(--theme-font);
|
|
36
|
+
--grid-header-filter-title-color: var(--primary-text-color);
|
|
37
|
+
--grid-header-filter-title-font: normal 12px var(--theme-font);
|
|
38
|
+
--grid-header-filter-title-icon-color: var(--primary-color);
|
|
36
39
|
|
|
37
40
|
--grid-record-background-color: var(--theme-white-color);
|
|
38
41
|
--grid-record-odd-background-color: rgba(255, 255, 255, 0.4);
|