@tak-ps/vue-tabler 3.87.4 → 4.1.0
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 +9 -0
- package/README.md +102 -2
- package/components/Alert.vue +18 -23
- package/components/BreadCrumb.vue +10 -10
- package/components/Button.vue +6 -4
- package/components/Bytes.vue +7 -7
- package/components/Delete.vue +46 -27
- package/components/Dropdown.vue +11 -22
- package/components/Epoch.vue +10 -12
- package/components/EpochRange.vue +11 -16
- package/components/Err.vue +14 -18
- package/components/Help.vue +12 -14
- package/components/IconButton.vue +13 -17
- package/components/InlineAlert.vue +8 -6
- package/components/List.vue +42 -34
- package/components/Loading.vue +10 -11
- package/components/Markdown.vue +10 -11
- package/components/Modal.vue +12 -14
- package/components/None.vue +18 -21
- package/components/Pager.vue +19 -21
- package/components/Progress.vue +8 -7
- package/components/RefreshButton.vue +12 -15
- package/components/Schema.vue +25 -23
- package/components/Slidedown.vue +13 -14
- package/components/input/Colour.vue +26 -37
- package/components/input/Enum.vue +25 -40
- package/components/input/FileInput.vue +31 -46
- package/components/input/Input.vue +52 -74
- package/components/input/Range.vue +29 -45
- package/components/input/Select.vue +13 -18
- package/components/input/TimeZone.vue +23 -33
- package/components/input/Toggle.vue +22 -32
- package/components/internal/Label.vue +11 -16
- package/eslint.config.js +11 -10
- package/package.json +12 -7
- package/tsconfig.json +30 -0
- /package/{lib.js → lib.ts} +0 -0
package/components/List.vue
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
>
|
|
20
20
|
<div class='d-flex mx-2'>
|
|
21
21
|
<span
|
|
22
|
-
v-if='ele'
|
|
22
|
+
v-if='ele && namekey'
|
|
23
23
|
style='padding-top: 6px;'
|
|
24
24
|
v-text='ele[namekey]'
|
|
25
25
|
/>
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<div class='ms-auto'>
|
|
32
32
|
<IconSettings
|
|
33
33
|
:size='32'
|
|
34
|
-
|
|
34
|
+
stroke='1'
|
|
35
35
|
style='margin-top: 4px;'
|
|
36
36
|
/>
|
|
37
37
|
</div>
|
|
@@ -51,11 +51,12 @@
|
|
|
51
51
|
placeholder='Name'
|
|
52
52
|
/>
|
|
53
53
|
<div
|
|
54
|
-
v-for='ele in list[listkey]'
|
|
54
|
+
v-for='ele in (listkey ? list[listkey] : [])'
|
|
55
55
|
:key='ele.id'
|
|
56
56
|
@click='select(ele)'
|
|
57
57
|
>
|
|
58
58
|
<div
|
|
59
|
+
v-if='namekey'
|
|
59
60
|
class='d-flex align-items-center my-1 cursor-pointer'
|
|
60
61
|
v-text='ele[namekey]'
|
|
61
62
|
/>
|
|
@@ -65,43 +66,44 @@
|
|
|
65
66
|
</div>
|
|
66
67
|
</template>
|
|
67
68
|
|
|
68
|
-
<script setup>
|
|
69
|
+
<script setup lang="ts">
|
|
69
70
|
import { ref, computed, watch, onMounted } from 'vue'
|
|
70
71
|
import TablerInput from './input/Input.vue';
|
|
71
72
|
import {
|
|
72
73
|
IconSettings
|
|
73
74
|
} from '@tabler/icons-vue';
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
url
|
|
77
|
-
listkey
|
|
78
|
-
namekey
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
type: Number,
|
|
94
|
-
default: 10
|
|
95
|
-
},
|
|
96
|
-
})
|
|
76
|
+
export interface ListProps {
|
|
77
|
+
url?: string;
|
|
78
|
+
listkey?: string;
|
|
79
|
+
namekey?: string;
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
|
+
initial?: Record<string, any>;
|
|
82
|
+
label?: string;
|
|
83
|
+
required?: boolean;
|
|
84
|
+
disabled?: boolean;
|
|
85
|
+
limit?: number;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const props = withDefaults(defineProps<ListProps>(), {
|
|
89
|
+
label: '',
|
|
90
|
+
required: false,
|
|
91
|
+
disabled: false,
|
|
92
|
+
limit: 10
|
|
93
|
+
});
|
|
97
94
|
|
|
98
|
-
const emit = defineEmits
|
|
95
|
+
const emit = defineEmits<{
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
97
|
+
(e: 'selected', ele: any): void
|
|
98
|
+
}>()
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
101
|
+
const ele = ref<any>(null)
|
|
101
102
|
const isMounted = ref(false)
|
|
102
103
|
const filter = ref('')
|
|
103
|
-
|
|
104
|
-
const
|
|
104
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
105
|
+
const list = ref<any>({})
|
|
106
|
+
const button = ref<HTMLElement | null>(null)
|
|
105
107
|
|
|
106
108
|
const buttonHeight = computed(() => {
|
|
107
109
|
if(!isMounted.value) return 100;
|
|
@@ -109,16 +111,22 @@ const buttonHeight = computed(() => {
|
|
|
109
111
|
return buttonDOM ? buttonDOM.offsetWidth : 100;
|
|
110
112
|
})
|
|
111
113
|
|
|
112
|
-
|
|
114
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
115
|
+
const select = (selectedEle: any) => {
|
|
113
116
|
ele.value = selectedEle;
|
|
114
|
-
|
|
117
|
+
if (props.namekey) {
|
|
118
|
+
filter.value = selectedEle[props.namekey];
|
|
119
|
+
}
|
|
115
120
|
emit("selected", selectedEle)
|
|
116
121
|
}
|
|
117
122
|
|
|
118
123
|
const fetchList = async () => {
|
|
124
|
+
if (!props.url) return;
|
|
125
|
+
// @ts-expect-error: Global window function
|
|
119
126
|
const url = window.stdurl(props.url);
|
|
120
127
|
url.searchParams.append('filter', filter.value);
|
|
121
|
-
url.searchParams.append('limit', props.limit);
|
|
128
|
+
url.searchParams.append('limit', String(props.limit));
|
|
129
|
+
// @ts-expect-error: Global window function
|
|
122
130
|
list.value = await window.std(url);
|
|
123
131
|
}
|
|
124
132
|
|
|
@@ -133,7 +141,7 @@ watch(filter, async () => {
|
|
|
133
141
|
|
|
134
142
|
// Mounted lifecycle
|
|
135
143
|
onMounted(async () => {
|
|
136
|
-
if (props.initial && props.initial[props.namekey]) ele.value = props.initial;
|
|
144
|
+
if (props.initial && props.namekey && props.initial[props.namekey]) ele.value = props.initial;
|
|
137
145
|
await fetchList();
|
|
138
146
|
isMounted.value = true;
|
|
139
147
|
})
|
package/components/Loading.vue
CHANGED
|
@@ -38,15 +38,14 @@
|
|
|
38
38
|
</div>
|
|
39
39
|
</template>
|
|
40
40
|
|
|
41
|
-
<script setup>
|
|
42
|
-
|
|
43
|
-
inline
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
})
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
export interface LoadingProps {
|
|
43
|
+
inline?: boolean;
|
|
44
|
+
desc?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
withDefaults(defineProps<LoadingProps>(), {
|
|
48
|
+
inline: false,
|
|
49
|
+
desc: 'Loading...'
|
|
50
|
+
});
|
|
52
51
|
</script>
|
package/components/Markdown.vue
CHANGED
|
@@ -5,20 +5,19 @@
|
|
|
5
5
|
/>
|
|
6
6
|
</template>
|
|
7
7
|
|
|
8
|
-
<script setup>
|
|
8
|
+
<script setup lang="ts">
|
|
9
9
|
import { computed } from 'vue'
|
|
10
|
+
// @ts-expect-error: showdown types not available
|
|
10
11
|
import showdown from 'showdown'
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
markdown:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
})
|
|
13
|
+
export interface MarkdownProps {
|
|
14
|
+
markdown: string;
|
|
15
|
+
autowrap?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const props = withDefaults(defineProps<MarkdownProps>(), {
|
|
19
|
+
autowrap: true
|
|
20
|
+
});
|
|
22
21
|
|
|
23
22
|
const html = computed(() => {
|
|
24
23
|
const converter = new showdown.Converter({
|
package/components/Modal.vue
CHANGED
|
@@ -33,26 +33,24 @@
|
|
|
33
33
|
</teleport>
|
|
34
34
|
</template>
|
|
35
35
|
|
|
36
|
-
<script setup>
|
|
36
|
+
<script setup lang="ts">
|
|
37
37
|
import { ref, onMounted, nextTick } from 'vue'
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
size
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
})
|
|
39
|
+
export interface ModalProps {
|
|
40
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
41
|
+
fade?: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
withDefaults(defineProps<ModalProps>(), {
|
|
45
|
+
size: 'sm',
|
|
46
|
+
fade: true
|
|
47
|
+
});
|
|
50
48
|
|
|
51
|
-
const modal = ref(null)
|
|
49
|
+
const modal = ref<HTMLElement | null>(null)
|
|
52
50
|
|
|
53
51
|
onMounted(() => {
|
|
54
52
|
nextTick(() => {
|
|
55
|
-
modal.value
|
|
53
|
+
modal.value?.focus()
|
|
56
54
|
})
|
|
57
55
|
})
|
|
58
56
|
</script>
|
package/components/None.vue
CHANGED
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
<IconNotesOff
|
|
10
10
|
v-if='compact'
|
|
11
11
|
:size='32'
|
|
12
|
-
|
|
12
|
+
stroke='1'
|
|
13
13
|
/>
|
|
14
14
|
<IconNotesOff
|
|
15
15
|
v-else
|
|
16
16
|
:size='48'
|
|
17
|
-
|
|
17
|
+
stroke='1'
|
|
18
18
|
/>
|
|
19
19
|
</div>
|
|
20
20
|
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
}'
|
|
26
26
|
>
|
|
27
27
|
<div class='user-select-none'>
|
|
28
|
-
|
|
28
|
+
<span v-text='label' />
|
|
29
29
|
</div>
|
|
30
30
|
</div>
|
|
31
31
|
|
|
@@ -44,27 +44,24 @@
|
|
|
44
44
|
</div>
|
|
45
45
|
</template>
|
|
46
46
|
|
|
47
|
-
<script setup>
|
|
47
|
+
<script setup lang="ts">
|
|
48
48
|
import {
|
|
49
49
|
IconNotesOff
|
|
50
50
|
} from '@tabler/icons-vue'
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
label
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
compact: {
|
|
58
|
-
type: Boolean,
|
|
59
|
-
default: false
|
|
60
|
-
},
|
|
61
|
-
create: {
|
|
62
|
-
type: Boolean,
|
|
63
|
-
default: true
|
|
64
|
-
},
|
|
65
|
-
})
|
|
52
|
+
export interface NoneProps {
|
|
53
|
+
label?: string;
|
|
54
|
+
compact?: boolean;
|
|
55
|
+
create?: boolean;
|
|
56
|
+
}
|
|
66
57
|
|
|
67
|
-
|
|
68
|
-
'
|
|
69
|
-
|
|
58
|
+
withDefaults(defineProps<NoneProps>(), {
|
|
59
|
+
label: 'No Items',
|
|
60
|
+
compact: false,
|
|
61
|
+
create: true
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const emit = defineEmits<{
|
|
65
|
+
(e: 'create'): void
|
|
66
|
+
}>()
|
|
70
67
|
</script>
|
package/components/Pager.vue
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class='pagination m-0'>
|
|
3
3
|
<div>
|
|
4
|
-
<template v-if='
|
|
4
|
+
<template v-if='total <= limit'>
|
|
5
5
|
<button
|
|
6
6
|
class='btn mx-1'
|
|
7
7
|
@click='changePage(0)'
|
|
8
8
|
>
|
|
9
9
|
<IconHome
|
|
10
10
|
:size='32'
|
|
11
|
-
|
|
11
|
+
stroke='1'
|
|
12
12
|
class='icon'
|
|
13
13
|
/>Home
|
|
14
14
|
</button>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
>
|
|
22
22
|
<IconHome
|
|
23
23
|
:size='32'
|
|
24
|
-
|
|
24
|
+
stroke='1'
|
|
25
25
|
class='icon'
|
|
26
26
|
/>Home
|
|
27
27
|
</button>
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
<span class=''> ... </span>
|
|
31
31
|
</template>
|
|
32
32
|
|
|
33
|
-
<template v-if='
|
|
33
|
+
<template v-if='total / limit > 2'>
|
|
34
34
|
<button
|
|
35
35
|
v-for='i in middle'
|
|
36
36
|
:key='i'
|
|
@@ -55,33 +55,31 @@
|
|
|
55
55
|
</div>
|
|
56
56
|
</template>
|
|
57
57
|
|
|
58
|
-
<script setup>
|
|
58
|
+
<script setup lang="ts">
|
|
59
59
|
import { ref, watch } from 'vue'
|
|
60
60
|
import {
|
|
61
61
|
IconHome
|
|
62
62
|
} from '@tabler/icons-vue';
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
total:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
limit: {
|
|
72
|
-
type: Number
|
|
73
|
-
}
|
|
74
|
-
})
|
|
64
|
+
export interface PagerProps {
|
|
65
|
+
total: number;
|
|
66
|
+
page: number;
|
|
67
|
+
limit: number;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const props = defineProps<PagerProps>();
|
|
75
71
|
|
|
76
|
-
const emit = defineEmits
|
|
72
|
+
const emit = defineEmits<{
|
|
73
|
+
(e: 'page', page: number): void
|
|
74
|
+
}>()
|
|
77
75
|
|
|
78
76
|
const spread = ref(0)
|
|
79
|
-
const middle = ref([])
|
|
77
|
+
const middle = ref<number[]>([])
|
|
80
78
|
const current = ref(0)
|
|
81
79
|
const end = ref(0)
|
|
82
80
|
|
|
83
81
|
const create = () => {
|
|
84
|
-
const endValue = Math.ceil(
|
|
82
|
+
const endValue = Math.ceil(props.total / props.limit);
|
|
85
83
|
let spreadValue; //Number of pages in between home button and last page
|
|
86
84
|
if (endValue <= 2) {
|
|
87
85
|
spreadValue = 0;
|
|
@@ -104,7 +102,7 @@ const create = () => {
|
|
|
104
102
|
};
|
|
105
103
|
}
|
|
106
104
|
|
|
107
|
-
const changePage = (page) => {
|
|
105
|
+
const changePage = (page: number) => {
|
|
108
106
|
current.value = page;
|
|
109
107
|
emit('page', current.value);
|
|
110
108
|
}
|
|
@@ -143,7 +141,7 @@ watch(() => props.limit, () => {
|
|
|
143
141
|
watch(current, () => {
|
|
144
142
|
if (end.value < 5) return; // All buttons are shown already
|
|
145
143
|
|
|
146
|
-
let start;
|
|
144
|
+
let start: number;
|
|
147
145
|
if (current.value <= 3) {
|
|
148
146
|
start = 0;
|
|
149
147
|
} else if (current.value >= end.value - 4) {
|
package/components/Progress.vue
CHANGED
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
</div>
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
|
-
<script setup>
|
|
11
|
-
|
|
12
|
-
percent
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
export interface ProgressProps {
|
|
12
|
+
percent?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
withDefaults(defineProps<ProgressProps>(), {
|
|
16
|
+
percent: 1
|
|
17
|
+
});
|
|
17
18
|
</script>
|
|
@@ -23,24 +23,21 @@
|
|
|
23
23
|
</IconButton>
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
|
-
<script setup>
|
|
26
|
+
<script setup lang="ts">
|
|
27
27
|
import {
|
|
28
28
|
IconRefresh
|
|
29
29
|
} from '@tabler/icons-vue';
|
|
30
30
|
import IconButton from './IconButton.vue';
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
title
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
size:
|
|
42
|
-
|
|
43
|
-
default: 32
|
|
44
|
-
}
|
|
45
|
-
})
|
|
32
|
+
export interface RefreshButtonProps {
|
|
33
|
+
title?: string;
|
|
34
|
+
loading?: boolean;
|
|
35
|
+
size?: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const props = withDefaults(defineProps<RefreshButtonProps>(), {
|
|
39
|
+
title: 'Refresh',
|
|
40
|
+
loading: false,
|
|
41
|
+
size: 32
|
|
42
|
+
});
|
|
46
43
|
</script>
|
package/components/Schema.vue
CHANGED
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
<IconPlus
|
|
58
58
|
v-if='!disabled'
|
|
59
59
|
:size='32'
|
|
60
|
-
|
|
60
|
+
stroke='1'
|
|
61
61
|
class='cursor-pointer'
|
|
62
62
|
@click='push(key)'
|
|
63
63
|
/>
|
|
@@ -71,13 +71,13 @@
|
|
|
71
71
|
>
|
|
72
72
|
<div class='d-flex'>
|
|
73
73
|
<div class='mx-2 my-2'>
|
|
74
|
-
Entry <span v-text='i + 1' />
|
|
74
|
+
Entry <span v-text='Number(i) + 1' />
|
|
75
75
|
</div>
|
|
76
76
|
<div class='ms-auto mx-2 my-2'>
|
|
77
77
|
<IconTrash
|
|
78
78
|
v-if='!disabled'
|
|
79
79
|
:size='32'
|
|
80
|
-
|
|
80
|
+
stroke='1'
|
|
81
81
|
class='cursor-pointer'
|
|
82
82
|
@click='data[key].splice(i, 1)'
|
|
83
83
|
/>
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
</div>
|
|
107
107
|
</template>
|
|
108
108
|
|
|
109
|
-
<script setup>
|
|
109
|
+
<script setup lang="ts">
|
|
110
110
|
import { ref, watch, onMounted } from 'vue'
|
|
111
111
|
import TablerInput from './input/Input.vue';
|
|
112
112
|
import TablerToggle from './input/Toggle.vue';
|
|
@@ -117,28 +117,30 @@ import {
|
|
|
117
117
|
IconTrash,
|
|
118
118
|
} from '@tabler/icons-vue';
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
disabled:
|
|
130
|
-
|
|
131
|
-
default: false
|
|
132
|
-
}
|
|
133
|
-
})
|
|
120
|
+
export interface SchemaProps {
|
|
121
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
122
|
+
modelValue: any;
|
|
123
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
124
|
+
schema: any;
|
|
125
|
+
disabled?: boolean;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const props = withDefaults(defineProps<SchemaProps>(), {
|
|
129
|
+
disabled: false
|
|
130
|
+
});
|
|
134
131
|
|
|
135
|
-
const emit = defineEmits
|
|
132
|
+
const emit = defineEmits<{
|
|
133
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
134
|
+
(e: 'update:modelValue', value: any): void;
|
|
135
|
+
}>();
|
|
136
136
|
|
|
137
|
-
const loading = ref(true)
|
|
138
|
-
|
|
139
|
-
const
|
|
137
|
+
const loading = ref(true);
|
|
138
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
139
|
+
const s = ref<any>({});
|
|
140
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
141
|
+
const data = ref<any>({});
|
|
140
142
|
|
|
141
|
-
const push = (key) => {
|
|
143
|
+
const push = (key: string) => {
|
|
142
144
|
if (!props.schema.properties[key].items) data.value[key].push('');
|
|
143
145
|
if (props.schema.properties[key].items.type === 'object') {
|
|
144
146
|
data.value[key].push({});
|
package/components/Slidedown.vue
CHANGED
|
@@ -42,27 +42,26 @@
|
|
|
42
42
|
</div>
|
|
43
43
|
</template>
|
|
44
44
|
|
|
45
|
-
<script setup>
|
|
45
|
+
<script setup lang="ts">
|
|
46
46
|
import { ref } from 'vue';
|
|
47
47
|
import {
|
|
48
48
|
IconChevronDown
|
|
49
49
|
} from '@tabler/icons-vue';
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
export interface SlidedownProps {
|
|
52
|
+
arrow?: boolean;
|
|
53
|
+
clickAnywhereExpand?: boolean;
|
|
54
|
+
}
|
|
54
55
|
|
|
55
|
-
const props = defineProps({
|
|
56
|
-
arrow:
|
|
57
|
-
|
|
58
|
-
default: true
|
|
59
|
-
},
|
|
60
|
-
clickAnywhereExpand: {
|
|
61
|
-
type: Boolean,
|
|
62
|
-
default: false
|
|
63
|
-
}
|
|
56
|
+
const props = withDefaults(defineProps<SlidedownProps>(), {
|
|
57
|
+
arrow: true,
|
|
58
|
+
clickAnywhereExpand: false
|
|
64
59
|
});
|
|
65
60
|
|
|
61
|
+
const isExpanded = ref(false);
|
|
62
|
+
|
|
63
|
+
const contentWrapperRef = ref<HTMLElement | null>(null);
|
|
64
|
+
|
|
66
65
|
function toggle() {
|
|
67
66
|
isExpanded.value = !isExpanded.value;
|
|
68
67
|
|
|
@@ -72,7 +71,7 @@ function toggle() {
|
|
|
72
71
|
if (isExpanded.value) {
|
|
73
72
|
el.style.maxHeight = el.scrollHeight + 'px';
|
|
74
73
|
} else {
|
|
75
|
-
el.style.maxHeight =
|
|
74
|
+
el.style.maxHeight = ''; // Reset to CSS default (0)
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
};
|
|
@@ -36,48 +36,37 @@
|
|
|
36
36
|
</div>
|
|
37
37
|
</template>
|
|
38
38
|
|
|
39
|
-
<script setup>
|
|
39
|
+
<script setup lang="ts">
|
|
40
40
|
import { ref, watch, onMounted } from 'vue'
|
|
41
41
|
import TablerLabel from '../internal/Label.vue'
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
modelValue:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
required:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
type: String,
|
|
62
|
-
default: ''
|
|
63
|
-
},
|
|
64
|
-
disabled: {
|
|
65
|
-
type: Boolean,
|
|
66
|
-
default: false,
|
|
67
|
-
},
|
|
68
|
-
label: {
|
|
69
|
-
type: String,
|
|
70
|
-
default: ''
|
|
71
|
-
},
|
|
72
|
-
})
|
|
43
|
+
export interface ColourProps {
|
|
44
|
+
modelValue: string;
|
|
45
|
+
autofocus?: boolean;
|
|
46
|
+
default?: string;
|
|
47
|
+
required?: boolean;
|
|
48
|
+
description?: string;
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
label?: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const props = withDefaults(defineProps<ColourProps>(), {
|
|
54
|
+
autofocus: false,
|
|
55
|
+
default: '',
|
|
56
|
+
required: false,
|
|
57
|
+
description: '',
|
|
58
|
+
disabled: false,
|
|
59
|
+
label: ''
|
|
60
|
+
});
|
|
73
61
|
|
|
74
|
-
const emit = defineEmits
|
|
75
|
-
'blur'
|
|
76
|
-
|
|
62
|
+
const emit = defineEmits<{
|
|
63
|
+
(e: 'blur'): void;
|
|
64
|
+
(e: 'update:modelValue', value: string): void;
|
|
65
|
+
}>();
|
|
77
66
|
|
|
78
|
-
const current = ref('')
|
|
67
|
+
const current = ref<string>('')
|
|
79
68
|
|
|
80
|
-
const invertColours = {
|
|
69
|
+
const invertColours: Record<string, string> = {
|
|
81
70
|
'#1d273b': 'dark',
|
|
82
71
|
'#ffffff': 'white',
|
|
83
72
|
'#206bc4': 'blue',
|
|
@@ -91,7 +80,7 @@ const invertColours = {
|
|
|
91
80
|
'#74b816': 'lime'
|
|
92
81
|
}
|
|
93
82
|
|
|
94
|
-
const colours = {
|
|
83
|
+
const colours: Record<string, string> = {
|
|
95
84
|
dark: '#1d273b',
|
|
96
85
|
white: '#ffffff',
|
|
97
86
|
blue: '#206bc4',
|