@xy-planning-network/trees 0.3.4 → 0.4.0-rc-3
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/style.css +1 -0
- package/dist/trees.es.js +8399 -0
- package/dist/trees.umd.js +10 -0
- package/dist/types/api/base.d.ts +12 -0
- package/dist/types/entry.d.ts +8 -0
- package/dist/types/helpers/Uniques.d.ts +4 -0
- package/dist/types/lib-components/forms/BaseInput.vue.d.ts +38 -0
- package/dist/types/lib-components/forms/Checkbox.vue.d.ts +22 -0
- package/dist/types/lib-components/forms/DateRangePicker.vue.d.ts +45 -0
- package/dist/types/lib-components/forms/InputHelp.vue.d.ts +22 -0
- package/dist/types/lib-components/forms/InputLabel.vue.d.ts +22 -0
- package/dist/types/lib-components/forms/MultiCheckboxes.vue.d.ts +34 -0
- package/dist/types/lib-components/forms/Radio.vue.d.ts +44 -0
- package/dist/types/lib-components/forms/Select.vue.d.ts +58 -0
- package/dist/types/lib-components/forms/TextArea.vue.d.ts +32 -0
- package/dist/types/lib-components/forms/Toggle.vue.d.ts +17 -0
- package/dist/types/lib-components/forms/YesOrNoRadio.vue.d.ts +33 -0
- package/dist/types/lib-components/index.d.ts +64 -0
- package/dist/types/lib-components/layout/DateFilter.vue.d.ts +34 -0
- package/dist/types/lib-components/layout/SidebarLayout.vue.d.ts +33 -0
- package/dist/types/lib-components/layout/StackedLayout.vue.d.ts +40 -0
- package/dist/types/lib-components/lists/Cards.vue.d.ts +23 -0
- package/dist/types/lib-components/lists/DetailList.vue.d.ts +34 -0
- package/dist/types/lib-components/lists/DownloadCell.vue.d.ts +20 -0
- package/dist/types/lib-components/lists/StaticTable.vue.d.ts +18 -0
- package/dist/types/lib-components/lists/Table.vue.d.ts +29 -0
- package/dist/types/lib-components/navigation/ActionsDropdown.vue.d.ts +26 -0
- package/dist/types/lib-components/navigation/Paginator.vue.d.ts +27 -0
- package/dist/types/lib-components/navigation/Steps.vue.d.ts +53 -0
- package/dist/types/lib-components/navigation/Tabs.vue.d.ts +36 -0
- package/dist/types/lib-components/overlays/ContentModal.vue.d.ts +24 -0
- package/dist/types/lib-components/overlays/Flash.vue.d.ts +6 -0
- package/dist/types/lib-components/overlays/Modal.vue.d.ts +51 -0
- package/dist/types/lib-components/overlays/Slideover.vue.d.ts +30 -0
- package/dist/types/lib-components/overlays/Spinner.vue.d.ts +2 -0
- package/dist/types/types/nav.d.ts +7 -0
- package/dist/types/types/table.d.ts +32 -0
- package/dist/types/types/users.d.ts +9 -0
- package/package.json +47 -66
- package/src/lib-components/forms/BaseInput.vue +51 -45
- package/src/lib-components/forms/Checkbox.vue +31 -22
- package/src/lib-components/forms/DateRangePicker.vue +56 -56
- package/src/lib-components/forms/InputHelp.vue +12 -9
- package/src/lib-components/forms/InputLabel.vue +12 -9
- package/src/lib-components/forms/MultiCheckboxes.vue +48 -44
- package/src/lib-components/forms/Radio.vue +34 -24
- package/src/lib-components/forms/Select.vue +40 -46
- package/src/lib-components/forms/TextArea.vue +23 -17
- package/src/lib-components/forms/Toggle.vue +7 -11
- package/src/lib-components/forms/YesOrNoRadio.vue +31 -27
- package/src/lib-components/layout/DateFilter.vue +31 -30
- package/src/lib-components/layout/SidebarLayout.vue +36 -51
- package/src/lib-components/layout/StackedLayout.vue +32 -55
- package/src/lib-components/lists/Cards.vue +8 -12
- package/src/lib-components/lists/DetailList.vue +83 -83
- package/src/lib-components/lists/DownloadCell.vue +8 -12
- package/src/lib-components/lists/StaticTable.vue +30 -23
- package/src/lib-components/lists/Table.vue +146 -122
- package/src/lib-components/navigation/ActionsDropdown.vue +39 -43
- package/src/lib-components/navigation/Paginator.vue +65 -80
- package/src/lib-components/navigation/Steps.vue +38 -27
- package/src/lib-components/navigation/Tabs.vue +64 -60
- package/src/lib-components/overlays/ContentModal.vue +27 -31
- package/src/lib-components/overlays/Flash.vue +85 -70
- package/src/lib-components/overlays/Modal.vue +39 -42
- package/src/lib-components/overlays/Slideover.vue +30 -35
- package/src/lib-components/overlays/Spinner.vue +51 -51
- package/src/types/env.d.ts +18 -0
- package/src/types/global.d.ts +10 -0
- package/dist/trees.esm.js +0 -10994
- package/dist/trees.min.js +0 -7
- package/dist/trees.ssr.js +0 -11669
- package/trees.d.ts +0 -43
|
@@ -1,3 +1,59 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import Uniques from "@/helpers/Uniques"
|
|
3
|
+
import flatpickr from "flatpickr"
|
|
4
|
+
import "flatpickr/dist/flatpickr.min.css"
|
|
5
|
+
import { onMounted, useAttrs } from "vue"
|
|
6
|
+
import BaseInput from "./BaseInput.vue"
|
|
7
|
+
|
|
8
|
+
const props = withDefaults(
|
|
9
|
+
defineProps<{
|
|
10
|
+
modelValue: {
|
|
11
|
+
minDate: number
|
|
12
|
+
maxDate: number
|
|
13
|
+
}
|
|
14
|
+
startDate?: number
|
|
15
|
+
label?: string
|
|
16
|
+
help?: string
|
|
17
|
+
}>(),
|
|
18
|
+
{
|
|
19
|
+
startDate: 0,
|
|
20
|
+
label: "",
|
|
21
|
+
help: "",
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
const emits = defineEmits(["update:modelValue"])
|
|
26
|
+
const attrs = useAttrs()
|
|
27
|
+
const uuid = (attrs.id as string) || Uniques.CreateIdAttribute()
|
|
28
|
+
|
|
29
|
+
const updateModelValue = (value: { minDate: number; maxDate: number }) => {
|
|
30
|
+
emits("update:modelValue", value)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
onMounted(() => {
|
|
34
|
+
flatpickr(`#${uuid}`, {
|
|
35
|
+
dateFormat: "m-d-Y",
|
|
36
|
+
mode: "range",
|
|
37
|
+
maxDate: new Date(), // So far, we cannot have options past today for ranges
|
|
38
|
+
minDate: props.startDate,
|
|
39
|
+
onClose: (selectedDates) => {
|
|
40
|
+
if (selectedDates.length === 2) {
|
|
41
|
+
updateModelValue({
|
|
42
|
+
minDate: selectedDates[0].setUTCHours(0, 0, 0, 0) / 1000,
|
|
43
|
+
maxDate: Math.floor(
|
|
44
|
+
selectedDates[1].setUTCHours(23, 59, 59, 999) / 1000
|
|
45
|
+
),
|
|
46
|
+
})
|
|
47
|
+
} else if (selectedDates.length === 0) {
|
|
48
|
+
updateModelValue({
|
|
49
|
+
minDate: 0,
|
|
50
|
+
maxDate: 0,
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
</script>
|
|
1
57
|
<template>
|
|
2
58
|
<BaseInput
|
|
3
59
|
type="text"
|
|
@@ -7,59 +63,3 @@
|
|
|
7
63
|
:help="help"
|
|
8
64
|
></BaseInput>
|
|
9
65
|
</template>
|
|
10
|
-
|
|
11
|
-
<script lang="ts">
|
|
12
|
-
import Uniques from "@/helpers/Uniques";
|
|
13
|
-
import { Emit, Options, Prop, Vue } from "vue-property-decorator";
|
|
14
|
-
import flatpickr from "flatpickr";
|
|
15
|
-
import "flatpickr/dist/flatpickr.min.css";
|
|
16
|
-
import BaseInput from "./BaseInput.vue";
|
|
17
|
-
|
|
18
|
-
@Options({
|
|
19
|
-
name: "DateRangePicker",
|
|
20
|
-
components: { BaseInput },
|
|
21
|
-
})
|
|
22
|
-
export default class DateRangePicker extends Vue {
|
|
23
|
-
@Prop({ type: Object, required: true }) modelValue!: {
|
|
24
|
-
minDate: number;
|
|
25
|
-
maxDate: number;
|
|
26
|
-
};
|
|
27
|
-
@Prop({ type: Number, required: false }) startDate?: number;
|
|
28
|
-
@Prop({ type: String, required: false }) label?: string;
|
|
29
|
-
@Prop({ type: String, required: false }) help?: string;
|
|
30
|
-
|
|
31
|
-
uuid = (this.$attrs.id as string) || Uniques.CreateIdAttribute();
|
|
32
|
-
|
|
33
|
-
@Emit("update:modelValue")
|
|
34
|
-
updateModelValue(value: {
|
|
35
|
-
minDate: number;
|
|
36
|
-
maxDate: number;
|
|
37
|
-
}): { minDate: number; maxDate: number } {
|
|
38
|
-
return value;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
mounted() {
|
|
42
|
-
flatpickr(`#${this.uuid}`, {
|
|
43
|
-
dateFormat: "m-d-Y",
|
|
44
|
-
mode: "range",
|
|
45
|
-
maxDate: new Date(), // So far, we cannot have options past today for ranges
|
|
46
|
-
minDate: this.startDate,
|
|
47
|
-
onClose: (selectedDates) => {
|
|
48
|
-
if (selectedDates.length === 2) {
|
|
49
|
-
this.updateModelValue({
|
|
50
|
-
minDate: selectedDates[0].setUTCHours(0, 0, 0, 0) / 1000,
|
|
51
|
-
maxDate: Math.floor(
|
|
52
|
-
selectedDates[1].setUTCHours(23, 59, 59, 999) / 1000
|
|
53
|
-
),
|
|
54
|
-
});
|
|
55
|
-
} else if (selectedDates.length === 0) {
|
|
56
|
-
this.updateModelValue({
|
|
57
|
-
minDate: 0,
|
|
58
|
-
maxDate: 0,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
</script>
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
withDefaults(
|
|
3
|
+
defineProps<{
|
|
4
|
+
tag?: string
|
|
5
|
+
text?: string
|
|
6
|
+
}>(),
|
|
7
|
+
{
|
|
8
|
+
tag: "div",
|
|
9
|
+
text: "",
|
|
10
|
+
}
|
|
11
|
+
)
|
|
12
|
+
</script>
|
|
1
13
|
<template>
|
|
2
14
|
<component
|
|
3
15
|
:is="tag"
|
|
@@ -10,12 +22,3 @@
|
|
|
10
22
|
{{ text }}
|
|
11
23
|
</component>
|
|
12
24
|
</template>
|
|
13
|
-
<script lang="ts">
|
|
14
|
-
import { Options, Prop, Vue } from "vue-property-decorator";
|
|
15
|
-
|
|
16
|
-
@Options({ name: "InputHelp" })
|
|
17
|
-
export default class InputHelp extends Vue {
|
|
18
|
-
@Prop({ type: String, required: false }) text?: string;
|
|
19
|
-
@Prop({ type: String, required: false, default: "div" }) tag?: string;
|
|
20
|
-
}
|
|
21
|
-
</script>
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
withDefaults(
|
|
3
|
+
defineProps<{
|
|
4
|
+
label?: string
|
|
5
|
+
tag?: string
|
|
6
|
+
}>(),
|
|
7
|
+
{
|
|
8
|
+
label: "",
|
|
9
|
+
tag: "label",
|
|
10
|
+
}
|
|
11
|
+
)
|
|
12
|
+
</script>
|
|
1
13
|
<template>
|
|
2
14
|
<component
|
|
3
15
|
:is="tag"
|
|
@@ -9,12 +21,3 @@
|
|
|
9
21
|
>{{ label }}</component
|
|
10
22
|
>
|
|
11
23
|
</template>
|
|
12
|
-
<script lang="ts">
|
|
13
|
-
import { Options, Prop, Vue } from "vue-property-decorator";
|
|
14
|
-
|
|
15
|
-
@Options({ name: "InputLabel" })
|
|
16
|
-
export default class InputLabel extends Vue {
|
|
17
|
-
@Prop({ type: String, required: false }) label?: string;
|
|
18
|
-
@Prop({ type: String, required: false, default: "label" }) tag?: string;
|
|
19
|
-
}
|
|
20
|
-
</script>
|
|
@@ -1,51 +1,55 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import Uniques from "@/helpers/Uniques"
|
|
3
|
+
import { ref, useAttrs } from "vue"
|
|
4
|
+
import InputLabel from "./InputLabel.vue"
|
|
5
|
+
|
|
6
|
+
// TODO: checkbox should support the help text prop - possibly as a tooltip
|
|
7
|
+
// TODO: aria-labelledby may be superfluous here since the input is wrapped in a label
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(
|
|
10
|
+
defineProps<{
|
|
11
|
+
options: {
|
|
12
|
+
label: string
|
|
13
|
+
value: string
|
|
14
|
+
}[]
|
|
15
|
+
legend?: string
|
|
16
|
+
modelValue: string[]
|
|
17
|
+
}>(),
|
|
18
|
+
{
|
|
19
|
+
legend: "",
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const emits = defineEmits(["update:modelValue"])
|
|
24
|
+
const attrs = useAttrs()
|
|
25
|
+
const uuid = (attrs.id as string) || Uniques.CreateIdAttribute()
|
|
26
|
+
const model = ref<string[]>(props.modelValue)
|
|
27
|
+
</script>
|
|
1
28
|
<template>
|
|
2
29
|
<fieldset>
|
|
3
30
|
<InputLabel class="block mb-0" :label="legend" tag="legend"></InputLabel>
|
|
4
31
|
<div class="mt-4" v-for="(option, index) in options" :key="option.value">
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
32
|
+
<label class="inline-flex items-center">
|
|
33
|
+
<input
|
|
34
|
+
type="checkbox"
|
|
35
|
+
class="focus:ring-blue-500 h-4 w-4 text-xy-blue border-gray-600 rounded disabled:opacity-50 disabled:cursor-not-allowed"
|
|
36
|
+
:id="`${uuid}-${index}`"
|
|
37
|
+
:value="option.value"
|
|
38
|
+
v-model="model"
|
|
39
|
+
v-bind="{
|
|
40
|
+
...$attrs,
|
|
41
|
+
onChange: () => {
|
|
42
|
+
emits('update:modelValue', model)
|
|
43
|
+
},
|
|
44
|
+
}"
|
|
45
|
+
/>
|
|
46
|
+
<InputLabel
|
|
47
|
+
class="ml-2"
|
|
48
|
+
:for="`${uuid}-${index}`"
|
|
49
|
+
:label="option.label"
|
|
50
|
+
tag="span"
|
|
51
|
+
></InputLabel>
|
|
52
|
+
</label>
|
|
20
53
|
</div>
|
|
21
54
|
</fieldset>
|
|
22
55
|
</template>
|
|
23
|
-
|
|
24
|
-
<script lang="ts">
|
|
25
|
-
import Uniques from "@/helpers/Uniques";
|
|
26
|
-
import { Options, Prop, Vue, Watch } from "vue-property-decorator";
|
|
27
|
-
import InputLabel from "./InputLabel.vue";
|
|
28
|
-
|
|
29
|
-
@Options({ name: "MultiCheckboxes", components: { InputLabel } })
|
|
30
|
-
export default class MultiCheckboxes extends Vue {
|
|
31
|
-
@Prop({ type: Array, required: true }) options!: Array<{
|
|
32
|
-
label: string;
|
|
33
|
-
value: string;
|
|
34
|
-
}>;
|
|
35
|
-
@Prop({ type: String, required: false }) legend?: string;
|
|
36
|
-
@Prop({ type: Array, required: true }) modelValue!: string[];
|
|
37
|
-
|
|
38
|
-
model: string[] = [];
|
|
39
|
-
|
|
40
|
-
uuid = (this.$attrs.id as string) || Uniques.CreateIdAttribute();
|
|
41
|
-
|
|
42
|
-
@Watch("model")
|
|
43
|
-
onModelChanged(val: string[]): void {
|
|
44
|
-
this.$emit("update:modelValue", val);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
mounted() {
|
|
48
|
-
this.model = this.modelValue;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
</script>
|
|
@@ -1,7 +1,37 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import Uniques from "@/helpers/Uniques"
|
|
3
|
+
import { useAttrs } from "vue"
|
|
4
|
+
import InputLabel from "./InputLabel.vue"
|
|
5
|
+
|
|
6
|
+
// TODO: add horizontal layout support
|
|
7
|
+
const props = withDefaults(
|
|
8
|
+
defineProps<{
|
|
9
|
+
options: {
|
|
10
|
+
label: string
|
|
11
|
+
value: string
|
|
12
|
+
}[]
|
|
13
|
+
legend?: string
|
|
14
|
+
modelValue?: string
|
|
15
|
+
vertical?: boolean
|
|
16
|
+
}>(),
|
|
17
|
+
{
|
|
18
|
+
legend: "",
|
|
19
|
+
modelValue: "",
|
|
20
|
+
vertical: true,
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
const emits = defineEmits(["update:modelValue"])
|
|
24
|
+
const attrs = useAttrs()
|
|
25
|
+
const uuid = (attrs.id as string) || Uniques.CreateIdAttribute()
|
|
26
|
+
</script>
|
|
1
27
|
<template>
|
|
2
28
|
<fieldset class="mt-1 space-y-2">
|
|
3
29
|
<InputLabel class="block" :label="legend" tag="legend"></InputLabel>
|
|
4
|
-
<
|
|
30
|
+
<component
|
|
31
|
+
v-for="(option, index) in options"
|
|
32
|
+
:key="option.value"
|
|
33
|
+
:is="props.vertical ? 'div' : 'span'"
|
|
34
|
+
>
|
|
5
35
|
<label
|
|
6
36
|
class="inline-flex items-center"
|
|
7
37
|
:class="{ 'cursor-not-allowed': $attrs.disabled }"
|
|
@@ -17,32 +47,12 @@
|
|
|
17
47
|
v-bind="{
|
|
18
48
|
...$attrs,
|
|
19
49
|
onChange: ($event) => {
|
|
20
|
-
|
|
50
|
+
emits('update:modelValue', ($event.target as HTMLInputElement).value)
|
|
21
51
|
},
|
|
22
52
|
}"
|
|
23
53
|
/>
|
|
24
|
-
<
|
|
25
|
-
{{ option.label }}
|
|
26
|
-
</span>
|
|
54
|
+
<InputLabel class="ml-2" :label="option.label" tag="span"></InputLabel>
|
|
27
55
|
</label>
|
|
28
|
-
</
|
|
56
|
+
</component>
|
|
29
57
|
</fieldset>
|
|
30
58
|
</template>
|
|
31
|
-
|
|
32
|
-
<script lang="ts">
|
|
33
|
-
import Uniques from "@/helpers/Uniques";
|
|
34
|
-
import { Options, Prop, Vue } from "vue-property-decorator";
|
|
35
|
-
import InputLabel from "./InputLabel.vue";
|
|
36
|
-
|
|
37
|
-
@Options({ name: "Radio", components: { InputLabel } })
|
|
38
|
-
export default class Radio extends Vue {
|
|
39
|
-
@Prop({ type: Array, required: true }) options!: Array<{
|
|
40
|
-
label: string;
|
|
41
|
-
value: string;
|
|
42
|
-
}>;
|
|
43
|
-
@Prop({ type: String, required: false }) legend?: string;
|
|
44
|
-
@Prop({ type: String, required: false }) modelValue?: string;
|
|
45
|
-
|
|
46
|
-
uuid = (this.$attrs.id as string) || Uniques.CreateIdAttribute();
|
|
47
|
-
}
|
|
48
|
-
</script>
|
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import Uniques from "@/helpers/Uniques"
|
|
3
|
+
import InputLabel from "./InputLabel.vue"
|
|
4
|
+
import InputHelp from "./InputHelp.vue"
|
|
5
|
+
import { computed, useAttrs } from "vue"
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(
|
|
8
|
+
defineProps<{
|
|
9
|
+
design?: "standard" | "compressed"
|
|
10
|
+
label?: string
|
|
11
|
+
help?: string
|
|
12
|
+
placeholder?: string
|
|
13
|
+
options: { label: string; value: string | number }[]
|
|
14
|
+
modelValue: string | number // TODO: spk 4.0-rc test usage of undefined initial model value here.
|
|
15
|
+
}>(),
|
|
16
|
+
{
|
|
17
|
+
design: "standard",
|
|
18
|
+
label: "",
|
|
19
|
+
help: "",
|
|
20
|
+
placeholder: "Select an option",
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
const emit = defineEmits(["update:modelValue"])
|
|
25
|
+
const attrs = useAttrs()
|
|
26
|
+
const uuid = (attrs.id as string) || Uniques.CreateIdAttribute()
|
|
27
|
+
|
|
28
|
+
const classes = computed((): string => {
|
|
29
|
+
return (
|
|
30
|
+
{
|
|
31
|
+
standard:
|
|
32
|
+
"mt-1 block w-full border border-gray-600 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm",
|
|
33
|
+
compressed:
|
|
34
|
+
"appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-600 text-gray-900 focus:outline-none focus:ring-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm",
|
|
35
|
+
} as any
|
|
36
|
+
)[props.design]
|
|
37
|
+
})
|
|
38
|
+
</script>
|
|
1
39
|
<template>
|
|
2
40
|
<InputLabel :id="`${uuid}-label`" :for="uuid" :label="label"></InputLabel>
|
|
3
41
|
<select
|
|
@@ -9,17 +47,11 @@
|
|
|
9
47
|
v-bind="{
|
|
10
48
|
...$attrs,
|
|
11
49
|
onChange: ($event) => {
|
|
12
|
-
|
|
50
|
+
emit('update:modelValue', ($event.target as HTMLInputElement).value)
|
|
13
51
|
},
|
|
14
52
|
}"
|
|
15
53
|
>
|
|
16
|
-
<option
|
|
17
|
-
value=""
|
|
18
|
-
disabled
|
|
19
|
-
selected
|
|
20
|
-
v-if="placeholder"
|
|
21
|
-
:placeholder="placeholder"
|
|
22
|
-
>
|
|
54
|
+
<option v-if="placeholder" value="" disabled selected>
|
|
23
55
|
{{ placeholder }}
|
|
24
56
|
</option>
|
|
25
57
|
<option
|
|
@@ -31,41 +63,3 @@
|
|
|
31
63
|
</select>
|
|
32
64
|
<InputHelp :id="`${uuid}-help`" :text="help"></InputHelp>
|
|
33
65
|
</template>
|
|
34
|
-
|
|
35
|
-
<script lang="ts">
|
|
36
|
-
import Uniques from "@/helpers/Uniques";
|
|
37
|
-
import { Options, Prop, Vue } from "vue-property-decorator";
|
|
38
|
-
import InputLabel from "./InputLabel.vue";
|
|
39
|
-
import InputHelp from "./InputHelp.vue";
|
|
40
|
-
|
|
41
|
-
@Options({ name: "Select", components: { InputLabel, InputHelp } })
|
|
42
|
-
export default class Select extends Vue {
|
|
43
|
-
@Prop({ type: String, required: false }) design?: string;
|
|
44
|
-
@Prop({ type: String, required: false }) label?: string;
|
|
45
|
-
@Prop({ type: String, required: false }) help?: string;
|
|
46
|
-
@Prop({ type: Array, required: true }) options!: Array<{
|
|
47
|
-
label: string;
|
|
48
|
-
value: string | number;
|
|
49
|
-
}>;
|
|
50
|
-
@Prop({ type: String, required: false, default: "Select an option" })
|
|
51
|
-
placeholder?: string;
|
|
52
|
-
@Prop({ type: [String, Number], required: true }) modelValue!:
|
|
53
|
-
| string
|
|
54
|
-
| number
|
|
55
|
-
| undefined;
|
|
56
|
-
|
|
57
|
-
uuid = (this.$attrs.id as string) || Uniques.CreateIdAttribute();
|
|
58
|
-
|
|
59
|
-
get classes(): string {
|
|
60
|
-
const design = this.design ? this.design : "undefined";
|
|
61
|
-
return ({
|
|
62
|
-
undefined:
|
|
63
|
-
"mt-1 block w-full border border-gray-600 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm",
|
|
64
|
-
standard:
|
|
65
|
-
"mt-1 block w-full border border-gray-600 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm",
|
|
66
|
-
compressed:
|
|
67
|
-
"appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-600 text-gray-900 focus:outline-none focus:ring-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm",
|
|
68
|
-
} as any)[design];
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
</script>
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import Uniques from "@/helpers/Uniques"
|
|
3
|
+
import InputLabel from "./InputLabel.vue"
|
|
4
|
+
import InputHelp from "./InputHelp.vue"
|
|
5
|
+
import { useAttrs } from "vue"
|
|
6
|
+
withDefaults(
|
|
7
|
+
defineProps<{
|
|
8
|
+
help?: string
|
|
9
|
+
label?: string
|
|
10
|
+
modelValue?: string | number
|
|
11
|
+
}>(),
|
|
12
|
+
{
|
|
13
|
+
help: "",
|
|
14
|
+
label: "",
|
|
15
|
+
modelValue: "",
|
|
16
|
+
}
|
|
17
|
+
)
|
|
18
|
+
const attrs = useAttrs()
|
|
19
|
+
const emit = defineEmits(["update:modelValue"])
|
|
20
|
+
const uuid = (attrs.id as string) || Uniques.CreateIdAttribute()
|
|
21
|
+
</script>
|
|
22
|
+
|
|
1
23
|
<template>
|
|
2
24
|
<InputLabel
|
|
3
25
|
class="block"
|
|
@@ -21,24 +43,8 @@
|
|
|
21
43
|
]"
|
|
22
44
|
:id="uuid"
|
|
23
45
|
:value="modelValue"
|
|
24
|
-
@input="
|
|
46
|
+
@input="emit('update:modelValue', ($event.target as HTMLInputElement).value)"
|
|
25
47
|
v-bind="$attrs"
|
|
26
48
|
/>
|
|
27
49
|
<InputHelp :id="`${uuid}-help`" :text="help"></InputHelp>
|
|
28
50
|
</template>
|
|
29
|
-
|
|
30
|
-
<script lang="ts">
|
|
31
|
-
import Uniques from "@/helpers/Uniques";
|
|
32
|
-
import { Options, Prop, Vue } from "vue-property-decorator";
|
|
33
|
-
import InputLabel from "./InputLabel.vue";
|
|
34
|
-
import InputHelp from "./InputHelp.vue";
|
|
35
|
-
|
|
36
|
-
@Options({ name: "TextArea", components: { InputLabel, InputHelp } })
|
|
37
|
-
export default class TextArea extends Vue {
|
|
38
|
-
@Prop({ type: String, required: false }) label?: string;
|
|
39
|
-
@Prop({ type: String, required: false }) help?: string;
|
|
40
|
-
@Prop({ type: [String, Number], required: false }) modelValue?: string;
|
|
41
|
-
|
|
42
|
-
uuid = (this.$attrs.id as string) || Uniques.CreateIdAttribute();
|
|
43
|
-
}
|
|
44
|
-
</script>
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Switch } from "@headlessui/vue"
|
|
3
|
+
|
|
4
|
+
withDefaults(defineProps<{ modelValue: boolean }>(), { modelValue: false })
|
|
5
|
+
const emits = defineEmits(["update:modelValue"])
|
|
6
|
+
</script>
|
|
1
7
|
<template>
|
|
2
8
|
<Switch
|
|
3
9
|
:class="[
|
|
@@ -5,7 +11,7 @@
|
|
|
5
11
|
'relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500',
|
|
6
12
|
]"
|
|
7
13
|
:modelValue="modelValue"
|
|
8
|
-
@update:modelValue="
|
|
14
|
+
@update:modelValue="emits('update:modelValue', $event)"
|
|
9
15
|
>
|
|
10
16
|
<span class="sr-only">Use</span>
|
|
11
17
|
<span
|
|
@@ -17,13 +23,3 @@
|
|
|
17
23
|
/>
|
|
18
24
|
</Switch>
|
|
19
25
|
</template>
|
|
20
|
-
|
|
21
|
-
<script lang="ts">
|
|
22
|
-
import { Options, Prop, Vue } from "vue-property-decorator";
|
|
23
|
-
import { Switch } from "@headlessui/vue";
|
|
24
|
-
|
|
25
|
-
@Options({ name: "Toggle", components: { Switch } })
|
|
26
|
-
export default class Toggle extends Vue {
|
|
27
|
-
@Prop({ type: Boolean, required: false }) modelValue?: boolean;
|
|
28
|
-
}
|
|
29
|
-
</script>
|
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import Uniques from "@/helpers/Uniques"
|
|
3
|
+
import { computed, useAttrs } from "vue"
|
|
4
|
+
import InputLabel from "./InputLabel.vue"
|
|
5
|
+
|
|
6
|
+
const props = withDefaults(
|
|
7
|
+
defineProps<{
|
|
8
|
+
modelValue?: boolean
|
|
9
|
+
legend?: string
|
|
10
|
+
name?: string
|
|
11
|
+
}>(),
|
|
12
|
+
{
|
|
13
|
+
modelValue: undefined,
|
|
14
|
+
legend: "",
|
|
15
|
+
name: "",
|
|
16
|
+
}
|
|
17
|
+
)
|
|
18
|
+
const emits = defineEmits(["update:modelValue"])
|
|
19
|
+
const attrs = useAttrs()
|
|
20
|
+
const uuid = (attrs.id as string) || Uniques.CreateIdAttribute()
|
|
21
|
+
const hasNameAttr = computed((): boolean => {
|
|
22
|
+
return typeof props.name === "string" && props.name !== ""
|
|
23
|
+
})
|
|
24
|
+
const onChange = (e: Event) => {
|
|
25
|
+
emits("update:modelValue", (e.target as HTMLInputElement).value === "true")
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
1
28
|
<template>
|
|
2
29
|
<fieldset>
|
|
3
30
|
<InputLabel class="block" :label="legend" tag="legend"></InputLabel>
|
|
@@ -15,12 +42,10 @@
|
|
|
15
42
|
:checked="modelValue === true"
|
|
16
43
|
v-bind="{
|
|
17
44
|
...$attrs,
|
|
18
|
-
onChange:
|
|
19
|
-
$emit('update:modelValue', $event.target.value === 'true');
|
|
20
|
-
},
|
|
45
|
+
onChange: onChange,
|
|
21
46
|
}"
|
|
22
47
|
/>
|
|
23
|
-
<
|
|
48
|
+
<InputLabel class="ml-2" label="Yes" tag="span"></InputLabel>
|
|
24
49
|
</label>
|
|
25
50
|
<label
|
|
26
51
|
class="inline-flex items-center ml-6"
|
|
@@ -36,31 +61,10 @@
|
|
|
36
61
|
:checked="modelValue === false"
|
|
37
62
|
v-bind="{
|
|
38
63
|
...$attrs,
|
|
39
|
-
onChange:
|
|
40
|
-
$emit('update:modelValue', $event.target.value === 'true');
|
|
41
|
-
},
|
|
64
|
+
onChange: onChange,
|
|
42
65
|
}"
|
|
43
66
|
/>
|
|
44
|
-
<
|
|
67
|
+
<InputLabel class="ml-2" label="No" tag="span"></InputLabel>
|
|
45
68
|
</label>
|
|
46
69
|
</fieldset>
|
|
47
70
|
</template>
|
|
48
|
-
|
|
49
|
-
<script lang="ts">
|
|
50
|
-
import Uniques from "@/helpers/Uniques";
|
|
51
|
-
import { Options, Prop, Vue } from "vue-property-decorator";
|
|
52
|
-
import InputLabel from "./InputLabel.vue";
|
|
53
|
-
|
|
54
|
-
@Options({ name: "YesOrNoRadio", components: { InputLabel } })
|
|
55
|
-
export default class YesOrNoRadio extends Vue {
|
|
56
|
-
@Prop({ type: Boolean, required: false }) modelValue?: boolean;
|
|
57
|
-
@Prop({ type: String, required: false }) legend?: string;
|
|
58
|
-
@Prop({ type: String, required: false, default: "" }) name?: string;
|
|
59
|
-
|
|
60
|
-
uuid = (this.$attrs.id as string) || Uniques.CreateIdAttribute();
|
|
61
|
-
|
|
62
|
-
get hasNameAttr(): boolean {
|
|
63
|
-
return typeof this.name === "string" && this.name !== "";
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
</script>
|
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export interface DateRange {
|
|
3
|
+
minDate: number
|
|
4
|
+
maxDate: number
|
|
5
|
+
}
|
|
6
|
+
</script>
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { ref } from "vue"
|
|
9
|
+
import DateRangePicker from "../forms/DateRangePicker.vue"
|
|
10
|
+
|
|
11
|
+
const props = defineProps<{
|
|
12
|
+
dateRange: DateRange
|
|
13
|
+
sortDir: string
|
|
14
|
+
title: string
|
|
15
|
+
}>()
|
|
16
|
+
const dateRange = ref<DateRange>(props.dateRange)
|
|
17
|
+
|
|
18
|
+
const emits = defineEmits<{
|
|
19
|
+
(e: "sort-dir-changed", val: string): void
|
|
20
|
+
(e: "date-range-changed", val: DateRange): void
|
|
21
|
+
}>()
|
|
22
|
+
|
|
23
|
+
const sortDirChanged = (sortDir: string) => {
|
|
24
|
+
emits("sort-dir-changed", sortDir)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const dateRangeChanged = (dateRange: DateRange) => {
|
|
28
|
+
emits("date-range-changed", dateRange)
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
1
31
|
<template>
|
|
2
32
|
<div
|
|
3
33
|
class="md:flex md:items-center md:justify-between bg-white mx-auto py-4 border-t border-gray-100"
|
|
@@ -9,7 +39,7 @@
|
|
|
9
39
|
</div>
|
|
10
40
|
<div class="mt-4 flex md:mt-0 md:ml-4">
|
|
11
41
|
<select
|
|
12
|
-
@change="sortDirChanged($event.target.value)"
|
|
42
|
+
@change="sortDirChanged(($event.target as HTMLInputElement).value)"
|
|
13
43
|
class="block w-full border border-gray-600 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm"
|
|
14
44
|
>
|
|
15
45
|
<option value="DESC">Newest-Oldest</option>
|
|
@@ -24,32 +54,3 @@
|
|
|
24
54
|
</div>
|
|
25
55
|
</div>
|
|
26
56
|
</template>
|
|
27
|
-
|
|
28
|
-
<script lang="ts">
|
|
29
|
-
import { Emit, Options, Prop, Vue } from "vue-property-decorator";
|
|
30
|
-
import DateRangePicker from "../forms/DateRangePicker.vue";
|
|
31
|
-
|
|
32
|
-
@Options({ components: { DateRangePicker }, name: "DateFilter" })
|
|
33
|
-
export default class DateFilter extends Vue {
|
|
34
|
-
// TODO: sort select should use built in select component
|
|
35
|
-
@Prop({ type: Object, required: true }) dateRange!: {
|
|
36
|
-
minDate: number;
|
|
37
|
-
maxDate: number;
|
|
38
|
-
};
|
|
39
|
-
@Prop({ type: String, required: true }) sortDir!: string;
|
|
40
|
-
@Prop({ type: String, required: true }) title!: string;
|
|
41
|
-
|
|
42
|
-
@Emit()
|
|
43
|
-
sortDirChanged(sortDir: string): string {
|
|
44
|
-
return sortDir;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
@Emit()
|
|
48
|
-
dateRangeChanged(dateRange: {
|
|
49
|
-
minDate: number;
|
|
50
|
-
maxDate: number;
|
|
51
|
-
}): { minDate: number; maxDate: number } {
|
|
52
|
-
return dateRange;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
</script>
|