@protobase/schema 0.22.4 → 0.22.5
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/dist/model.d.ts +4 -1
- package/dist/view-widgets.d.ts +8 -1
- package/dist/view-widgets.js +12 -6
- package/package.json +1 -1
package/dist/model.d.ts
CHANGED
|
@@ -568,7 +568,7 @@ export type DatePreset = 'today' | 'yesterday' | '24h' | '7d' | '30d' | '90d' |
|
|
|
568
568
|
* A filter widget above a list (`.filters((r, w) => ...)`), on a filterable field; see
|
|
569
569
|
* [Filters and the chart](website/src/content/docs/reference/ui-config.mdx#filters-and-the-chart).
|
|
570
570
|
*/
|
|
571
|
-
export type FilterWidgetModel = {
|
|
571
|
+
export type FilterWidgetModel = ({
|
|
572
572
|
/** A slider between the lowest and highest value. */
|
|
573
573
|
kind: 'range';
|
|
574
574
|
/** The field it filters. */
|
|
@@ -601,6 +601,9 @@ export type FilterWidgetModel = {
|
|
|
601
601
|
fields: string[];
|
|
602
602
|
/** The menu's label. */
|
|
603
603
|
label: string;
|
|
604
|
+
}) & {
|
|
605
|
+
/** Shown behind the bar's "More filters" menu until it is picked there or set. */
|
|
606
|
+
secondary?: boolean;
|
|
604
607
|
};
|
|
605
608
|
/**
|
|
606
609
|
* Records of another resource on the record page: those whose `field` holds this record's key or, with `through`,
|
package/dist/view-widgets.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { DatePreset, FilterWidgetModel } from "./model.js";
|
|
2
2
|
import { Ref } from "./refs.js";
|
|
3
3
|
//#region src/view-widgets.d.ts
|
|
4
|
+
/** Every widget also takes `secondary: true`, which puts it behind the bar's "More filters" menu until it is picked there or set. */
|
|
4
5
|
export declare const widgets: {
|
|
5
6
|
/** A slider between the field's lowest and highest value; `histogram` draws the values' histogram behind it. */
|
|
6
7
|
range: (ref: Ref, o?: {
|
|
7
8
|
histogram?: boolean;
|
|
9
|
+
secondary?: boolean;
|
|
8
10
|
}) => FilterWidgetModel;
|
|
9
11
|
/**
|
|
10
12
|
* A menu of the field's values with counts; `search` adds a search box for long lists. On a relation it searches the
|
|
@@ -12,19 +14,24 @@ export declare const widgets: {
|
|
|
12
14
|
*/
|
|
13
15
|
facets: (ref: Ref, o?: {
|
|
14
16
|
search?: boolean;
|
|
17
|
+
secondary?: boolean;
|
|
15
18
|
}) => FilterWidgetModel;
|
|
16
19
|
/** A date range with buttons for the `presets`, such as `today` and `30d`. */
|
|
17
20
|
dateRange: (ref: Ref, o?: {
|
|
18
21
|
presets?: DatePreset[];
|
|
22
|
+
secondary?: boolean;
|
|
19
23
|
}) => FilterWidgetModel;
|
|
20
24
|
/** A switch for a boolean field. */
|
|
21
|
-
toggle: (ref: Ref
|
|
25
|
+
toggle: (ref: Ref, o?: {
|
|
26
|
+
secondary?: boolean;
|
|
27
|
+
}) => FilterWidgetModel;
|
|
22
28
|
/**
|
|
23
29
|
* A menu of boolean fields under one `label`, such as "for sale" and "for rent": a record shows when any chosen field
|
|
24
30
|
* is true, so one that is both shows under each.
|
|
25
31
|
*/
|
|
26
32
|
flags: (refs: Ref<string, boolean | null>[], o: {
|
|
27
33
|
label: string;
|
|
34
|
+
secondary?: boolean;
|
|
28
35
|
}) => FilterWidgetModel;
|
|
29
36
|
};
|
|
30
37
|
//#endregion
|
package/dist/view-widgets.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
//#region src/view-widgets.ts
|
|
2
|
+
/** Every widget also takes `secondary: true`, which puts it behind the bar's "More filters" menu until it is picked there or set. */
|
|
2
3
|
const widgets = {
|
|
3
4
|
/** A slider between the field's lowest and highest value; `histogram` draws the values' histogram behind it. */
|
|
4
5
|
range: (ref, o = {}) => ({
|
|
5
6
|
kind: "range",
|
|
6
7
|
field: ref.name,
|
|
7
|
-
histogram: o.histogram ?? false
|
|
8
|
+
histogram: o.histogram ?? false,
|
|
9
|
+
...o.secondary && { secondary: true }
|
|
8
10
|
}),
|
|
9
11
|
/**
|
|
10
12
|
* A menu of the field's values with counts; `search` adds a search box for long lists. On a relation it searches the
|
|
@@ -13,18 +15,21 @@ const widgets = {
|
|
|
13
15
|
facets: (ref, o = {}) => ({
|
|
14
16
|
kind: "facets",
|
|
15
17
|
field: ref.name,
|
|
16
|
-
search: o.search ?? false
|
|
18
|
+
search: o.search ?? false,
|
|
19
|
+
...o.secondary && { secondary: true }
|
|
17
20
|
}),
|
|
18
21
|
/** A date range with buttons for the `presets`, such as `today` and `30d`. */
|
|
19
22
|
dateRange: (ref, o = {}) => ({
|
|
20
23
|
kind: "dateRange",
|
|
21
24
|
field: ref.name,
|
|
22
|
-
presets: o.presets ?? []
|
|
25
|
+
presets: o.presets ?? [],
|
|
26
|
+
...o.secondary && { secondary: true }
|
|
23
27
|
}),
|
|
24
28
|
/** A switch for a boolean field. */
|
|
25
|
-
toggle: (ref) => ({
|
|
29
|
+
toggle: (ref, o = {}) => ({
|
|
26
30
|
kind: "toggle",
|
|
27
|
-
field: ref.name
|
|
31
|
+
field: ref.name,
|
|
32
|
+
...o.secondary && { secondary: true }
|
|
28
33
|
}),
|
|
29
34
|
/**
|
|
30
35
|
* A menu of boolean fields under one `label`, such as "for sale" and "for rent": a record shows when any chosen field
|
|
@@ -33,7 +38,8 @@ const widgets = {
|
|
|
33
38
|
flags: (refs, o) => ({
|
|
34
39
|
kind: "flags",
|
|
35
40
|
fields: refs.map((ref) => ref.name),
|
|
36
|
-
label: o.label
|
|
41
|
+
label: o.label,
|
|
42
|
+
...o.secondary && { secondary: true }
|
|
37
43
|
})
|
|
38
44
|
};
|
|
39
45
|
//#endregion
|