@xy-planning-network/trees 0.13.12 → 0.13.13
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/trees.css +1 -1
- package/dist/trees.es.js +11229 -6547
- package/dist/trees.umd.js +20 -22
- package/package.json +2 -2
- package/src/index.css +61 -3
- package/src/lib-components/forms/DateRangePicker.vue +178 -129
- package/src/lib-components/forms/RangeCalendar.vue +245 -0
- package/src/lib-components/lists/DynamicTable.vue +3 -2
- package/types/composables/date.d.ts +4 -4
- package/types/composables/dateRange.d.ts +16 -0
- package/types/composables/forms.d.ts +9 -2
- package/types/composables/index.d.ts +2 -0
- package/types/lib-components/forms/DateRangePicker.vue.d.ts +73 -8
- package/types/lib-components/forms/RangeCalendar.vue.d.ts +34 -0
- package/types/lib-components/index.d.ts +3 -1
|
@@ -113,9 +113,9 @@ const pagination = ref({
|
|
|
113
113
|
const query = ref("")
|
|
114
114
|
|
|
115
115
|
const dateRangeChanged = (newDateRange: DateRange | undefined): void => {
|
|
116
|
-
|
|
116
|
+
// NOTE(spk): DateRangePicker emits update:model-value events on both minDate and maxDate mutations.
|
|
117
|
+
if (!newDateRange?.maxDate === !newDateRange?.minDate) {
|
|
117
118
|
pagination.value.page = 1
|
|
118
|
-
dateRange.value = newDateRange
|
|
119
119
|
loadAndRender()
|
|
120
120
|
}
|
|
121
121
|
}
|
|
@@ -322,6 +322,7 @@ loadAndRender()
|
|
|
322
322
|
<DateRangePicker
|
|
323
323
|
id="table-date-range"
|
|
324
324
|
v-model="dateRange"
|
|
325
|
+
position="bottom-end"
|
|
325
326
|
v-bind="{ ...dateSearchProps }"
|
|
326
327
|
@update:model-value="dateRangeChanged"
|
|
327
328
|
/>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { DateRangeAction } from "../entry";
|
|
1
2
|
export interface DateRange {
|
|
2
3
|
minDate: number;
|
|
3
4
|
maxDate: number;
|
|
4
5
|
}
|
|
5
6
|
export interface DateRangeProps {
|
|
6
|
-
|
|
7
|
-
label?: string;
|
|
8
|
-
maxDate?: Date | string | number;
|
|
7
|
+
actions?: DateRangeAction[];
|
|
9
8
|
maxRange?: number;
|
|
10
|
-
|
|
9
|
+
maxValue?: Date | null;
|
|
10
|
+
minValue?: Date;
|
|
11
11
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains a collection of "Quick Actions" that can be used
|
|
3
|
+
* with DateRangePicker, so offer convenience ranges that a user can select at
|
|
4
|
+
* the click of a button.
|
|
5
|
+
*/
|
|
6
|
+
import { DateRangeAction } from "../entry";
|
|
7
|
+
import type { DateValue } from "reka-ui";
|
|
8
|
+
export declare const calendarDateToUnix: (date: DateValue) => number;
|
|
9
|
+
export declare const dateRangeLast7Days: DateRangeAction;
|
|
10
|
+
export declare const dateRangeLast30Days: DateRangeAction;
|
|
11
|
+
export declare const dateRangeThisMonth: DateRangeAction;
|
|
12
|
+
export declare const dateRangeLastMonth: DateRangeAction;
|
|
13
|
+
export declare const dateRangeThisYear: DateRangeAction;
|
|
14
|
+
export declare const dateRangeLastYear: DateRangeAction;
|
|
15
|
+
export declare const dateRangeClear: DateRangeAction;
|
|
16
|
+
export declare const dateRangeActions: DateRangeAction[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DateRange } from "../composables/date";
|
|
1
2
|
export interface Input {
|
|
2
3
|
modelValue?: any;
|
|
3
4
|
label?: string;
|
|
@@ -14,6 +15,10 @@ export interface InputOption {
|
|
|
14
15
|
export interface BooleanInput extends Input {
|
|
15
16
|
modelValue?: boolean | null;
|
|
16
17
|
}
|
|
18
|
+
export interface DateRangeAction {
|
|
19
|
+
label: string;
|
|
20
|
+
action: (props: DateRangeInput) => DateRange;
|
|
21
|
+
}
|
|
17
22
|
/**
|
|
18
23
|
* DateRangeInput allows a max range to be applied to the datepicker
|
|
19
24
|
* such that selecting the first date will then apply a max/min of +/- maxRange.
|
|
@@ -23,13 +28,15 @@ export interface BooleanInput extends Input {
|
|
|
23
28
|
* dates prior to Jan 1 given the handling of maxRange being adjusted on the fly.
|
|
24
29
|
*/
|
|
25
30
|
export interface DateRangeInput extends Input {
|
|
31
|
+
actions?: DateRangeAction[];
|
|
26
32
|
modelValue?: {
|
|
27
33
|
minDate: number;
|
|
28
34
|
maxDate: number;
|
|
29
35
|
};
|
|
30
|
-
maxDate?: Date | string | number;
|
|
31
36
|
maxRange?: number;
|
|
32
|
-
|
|
37
|
+
maxValue?: Date | null;
|
|
38
|
+
minValue?: Date;
|
|
39
|
+
position?: "bottom" | "bottom-start" | "bottom-end";
|
|
33
40
|
}
|
|
34
41
|
export interface DateTimeInput extends Input {
|
|
35
42
|
modelValue?: string | null;
|
|
@@ -4,6 +4,8 @@ import type { DynamicTableOptions, DynamicTableAPI, TableActionButton, TableActi
|
|
|
4
4
|
import type { DetailListAPI, SortDir } from "./list";
|
|
5
5
|
export type { UseBaseAPIOptions, UseBaseAPI, DetailListAPI, DynamicTableOptions, DynamicTableAPI, SortDir, TableActionButton, TableActionItem, TableActionLink, TableActions, TableBulkActions, TableBulkActionItem, TableColumn, TableColumns, TableCellAlignment, TableRowData, TableRowsData, };
|
|
6
6
|
export { useBaseAPI, useBaseAPIGet, useBaseAPIPatch, useBaseAPIPut, useBaseAPIPost, useBaseAPIDelete, };
|
|
7
|
+
import { calendarDateToUnix, dateRangeActions, dateRangeLast7Days, dateRangeLast30Days, dateRangeThisMonth, dateRangeLastMonth, dateRangeThisYear, dateRangeLastYear, dateRangeClear } from "./dateRange";
|
|
8
|
+
export { calendarDateToUnix, dateRangeActions, dateRangeLast7Days, dateRangeLast30Days, dateRangeThisMonth, dateRangeLastMonth, dateRangeThisYear, dateRangeLastYear, dateRangeClear, };
|
|
7
9
|
import { useFlashes, useAppFlashes, useAppFlasher } from "./useFlashes";
|
|
8
10
|
import type { FlashMessage, FlashType, FlashStore, Flasher } from "./useFlashes";
|
|
9
11
|
export type { FlashMessage, FlashType, FlashStore, Flasher };
|
|
@@ -1,10 +1,75 @@
|
|
|
1
|
-
import "flatpickr/dist/flatpickr.min.css";
|
|
2
1
|
import type { DateRangeInput } from "../../composables/forms";
|
|
2
|
+
/**
|
|
3
|
+
* NOTE(spk): Default actions made available by Trees do not
|
|
4
|
+
* account for minValue, maxValue, and maxRange boundary restrictions.
|
|
5
|
+
*
|
|
6
|
+
* Likewise a pre-hydrated v-model that is outside those bounds also does
|
|
7
|
+
* not apply boundaries to that initial value.
|
|
8
|
+
*/
|
|
3
9
|
type __VLS_Props = DateRangeInput;
|
|
4
10
|
type __VLS_PublicProps = {
|
|
5
11
|
modelValue?: DateRangeInput["modelValue"];
|
|
6
12
|
} & __VLS_Props;
|
|
7
|
-
declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
13
|
+
declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
14
|
+
calendar: Readonly<import("vue").ShallowRef<import("vue").CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
15
|
+
modelValue?: {
|
|
16
|
+
minDate: number;
|
|
17
|
+
maxDate: number;
|
|
18
|
+
} | undefined;
|
|
19
|
+
} & DateRangeInput & {
|
|
20
|
+
actions?: import("../../composables/forms").DateRangeAction[] | undefined;
|
|
21
|
+
borderless?: boolean | undefined;
|
|
22
|
+
maxRange?: number | undefined;
|
|
23
|
+
maxValue?: Date | null | undefined;
|
|
24
|
+
minValue?: Date | undefined;
|
|
25
|
+
}> & Readonly<{
|
|
26
|
+
"onUpdate:modelValue"?: ((value: {
|
|
27
|
+
minDate: number;
|
|
28
|
+
maxDate: number;
|
|
29
|
+
} | undefined) => any) | undefined;
|
|
30
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
31
|
+
"update:modelValue": (value: {
|
|
32
|
+
minDate: number;
|
|
33
|
+
maxDate: number;
|
|
34
|
+
} | undefined) => any;
|
|
35
|
+
}, import("vue").PublicProps, {
|
|
36
|
+
actions: import("../../composables/forms").DateRangeAction[];
|
|
37
|
+
borderless: boolean;
|
|
38
|
+
maxRange: number;
|
|
39
|
+
maxValue: Date | null;
|
|
40
|
+
minValue: Date;
|
|
41
|
+
}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
42
|
+
P: {};
|
|
43
|
+
B: {};
|
|
44
|
+
D: {};
|
|
45
|
+
C: {};
|
|
46
|
+
M: {};
|
|
47
|
+
Defaults: {};
|
|
48
|
+
}, Readonly<{
|
|
49
|
+
modelValue?: {
|
|
50
|
+
minDate: number;
|
|
51
|
+
maxDate: number;
|
|
52
|
+
} | undefined;
|
|
53
|
+
} & DateRangeInput & {
|
|
54
|
+
actions?: import("../../composables/forms").DateRangeAction[] | undefined;
|
|
55
|
+
borderless?: boolean | undefined;
|
|
56
|
+
maxRange?: number | undefined;
|
|
57
|
+
maxValue?: Date | null | undefined;
|
|
58
|
+
minValue?: Date | undefined;
|
|
59
|
+
}> & Readonly<{
|
|
60
|
+
"onUpdate:modelValue"?: ((value: {
|
|
61
|
+
minDate: number;
|
|
62
|
+
maxDate: number;
|
|
63
|
+
} | undefined) => any) | undefined;
|
|
64
|
+
}>, {}, {}, {}, {}, {
|
|
65
|
+
actions: import("../../composables/forms").DateRangeAction[];
|
|
66
|
+
borderless: boolean;
|
|
67
|
+
maxRange: number;
|
|
68
|
+
maxValue: Date | null;
|
|
69
|
+
minValue: Date;
|
|
70
|
+
}> | null>>;
|
|
71
|
+
input: Readonly<import("vue").ShallowRef<HTMLInputElement | null>>;
|
|
72
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
73
|
"update:modelValue": (value: {
|
|
9
74
|
minDate: number;
|
|
10
75
|
maxDate: number;
|
|
@@ -16,16 +81,16 @@ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {},
|
|
|
16
81
|
} | undefined) => any) | undefined;
|
|
17
82
|
}>, {
|
|
18
83
|
label: string;
|
|
84
|
+
actions: import("../../composables/forms").DateRangeAction[];
|
|
85
|
+
position: "bottom" | "bottom-start" | "bottom-end";
|
|
19
86
|
modelValue: {
|
|
20
87
|
minDate: number;
|
|
21
88
|
maxDate: number;
|
|
22
89
|
};
|
|
23
|
-
maxDate: string | number | Date;
|
|
24
|
-
maxRange: number;
|
|
25
|
-
startDate: string | number | Date;
|
|
26
90
|
help: string;
|
|
27
91
|
placeholder: string;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
92
|
+
maxRange: number;
|
|
93
|
+
maxValue: Date | null;
|
|
94
|
+
minValue: Date;
|
|
95
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
31
96
|
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { DateRangeAction, DateRangeInput } from "../../composables/forms";
|
|
2
|
+
/**
|
|
3
|
+
* FIXME(spk): An oddity of Reka-UI RangeCalendar is that is applies
|
|
4
|
+
* [data-highlighted] attributes to all cells inside the range applicable
|
|
5
|
+
* to the maximum-days range, even those that are outside of min-value/max-value.
|
|
6
|
+
*/
|
|
7
|
+
type __VLS_Props = DateRangeInput & {
|
|
8
|
+
actions?: DateRangeAction[];
|
|
9
|
+
borderless?: boolean;
|
|
10
|
+
maxRange?: number;
|
|
11
|
+
maxValue?: Date | null;
|
|
12
|
+
minValue?: Date;
|
|
13
|
+
};
|
|
14
|
+
type __VLS_PublicProps = {
|
|
15
|
+
modelValue?: DateRangeInput["modelValue"];
|
|
16
|
+
} & __VLS_Props;
|
|
17
|
+
declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
|
+
"update:modelValue": (value: {
|
|
19
|
+
minDate: number;
|
|
20
|
+
maxDate: number;
|
|
21
|
+
} | undefined) => any;
|
|
22
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
23
|
+
"onUpdate:modelValue"?: ((value: {
|
|
24
|
+
minDate: number;
|
|
25
|
+
maxDate: number;
|
|
26
|
+
} | undefined) => any) | undefined;
|
|
27
|
+
}>, {
|
|
28
|
+
actions: DateRangeAction[];
|
|
29
|
+
borderless: boolean;
|
|
30
|
+
maxRange: number;
|
|
31
|
+
maxValue: Date | null;
|
|
32
|
+
minValue: Date;
|
|
33
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
34
|
+
export default _default;
|
|
@@ -38,11 +38,12 @@ import { default as MultiCheckboxes } from "./forms/MultiCheckboxes.vue";
|
|
|
38
38
|
import { default as NumberInput } from "./forms/NumberInput.vue";
|
|
39
39
|
import { default as Radio } from "./forms/Radio.vue";
|
|
40
40
|
import { default as RadioCards } from "./forms/RadioCards.vue";
|
|
41
|
+
import { default as RangeCalendar } from "./forms/RangeCalendar.vue";
|
|
41
42
|
import { default as Select } from "./forms/Select.vue";
|
|
42
43
|
import { default as TextArea } from "./forms/TextArea.vue";
|
|
43
44
|
import { default as YesOrNoRadio } from "./forms/YesOrNoRadio.vue";
|
|
44
45
|
export { ActionsButtonGroup, ActionsDropdown, Cards, ContentModal, DateFilter, DetailList, DownloadCell, Flash, InlineAlert, Modal, SidebarLayout, Slideover, StackedLayout, Popover, PopoverContent, PopoverPosition, // Type export
|
|
45
|
-
Paginator, Spinner, DataTable, Steps, DynamicTable, Tabs, TablePaginator, Toggle, Tooltip, BaseInput, Checkbox, DateRangePicker, DateTime, InputError, InputHelp, InputLabel, FieldsetLegend, MultiCheckboxes, NumberInput, Radio, RadioCards, Select, TextArea, YesOrNoRadio, XYSpinner, ProgressCircles, ProgressCirclesLabeled, };
|
|
46
|
+
Paginator, Spinner, DataTable, Steps, DynamicTable, Tabs, TablePaginator, Toggle, Tooltip, BaseInput, Checkbox, DateRangePicker, DateTime, InputError, InputHelp, InputLabel, FieldsetLegend, MultiCheckboxes, NumberInput, Radio, RadioCards, RangeCalendar, Select, TextArea, YesOrNoRadio, XYSpinner, ProgressCircles, ProgressCirclesLabeled, };
|
|
46
47
|
/**
|
|
47
48
|
* declare global component types for App.use(Trees)
|
|
48
49
|
*/
|
|
@@ -82,6 +83,7 @@ export interface TreesComponents {
|
|
|
82
83
|
NumberInput: typeof NumberInput;
|
|
83
84
|
Radio: typeof Radio;
|
|
84
85
|
RadioCards: typeof RadioCards;
|
|
86
|
+
RangeCalendar: typeof RangeCalendar;
|
|
85
87
|
Select: typeof Select;
|
|
86
88
|
TextArea: typeof TextArea;
|
|
87
89
|
YesOrNoRadio: typeof YesOrNoRadio;
|