sprintify-ui 0.6.84 → 0.6.86
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/sprintify-ui.es.js +179 -176
- package/dist/types/components/BaseAutocomplete.vue.d.ts +7 -7
- package/dist/types/components/BaseAutocompleteDrawer.vue.d.ts +1 -1
- package/dist/types/components/BaseAutocompleteFetch.vue.d.ts +5 -5
- package/dist/types/components/BaseBelongsTo.vue.d.ts +4 -4
- package/dist/types/components/BaseBelongsToFetch.vue.d.ts +5 -5
- package/dist/types/components/BaseButtonGroup.vue.d.ts +11 -11
- package/dist/types/components/BaseColor.vue.d.ts +6 -6
- package/dist/types/components/BaseDropdownAutocomplete.vue.d.ts +7 -7
- package/dist/types/components/BaseHasMany.vue.d.ts +5 -5
- package/dist/types/components/BaseRadioGroup.vue.d.ts +3 -3
- package/dist/types/components/BaseSelect.vue.d.ts +4 -4
- package/dist/types/components/BaseTagAutocomplete.vue.d.ts +6 -6
- package/dist/types/components/BaseTagAutocompleteFetch.vue.d.ts +4 -4
- package/dist/types/composables/hasOptions.d.ts +2 -2
- package/dist/types/types/Media.d.ts +1 -1
- package/dist/types/types/Notification.d.ts +1 -1
- package/dist/types/types/UploadedFile.d.ts +1 -1
- package/dist/types/types/User.d.ts +1 -1
- package/dist/types/types/index.d.ts +2 -2
- package/dist/types/utils/sizes.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/BaseAutocomplete.vue +5 -5
- package/src/components/BaseAutocompleteFetch.vue +4 -4
- package/src/components/BaseBelongsTo.vue +3 -3
- package/src/components/BaseBelongsToFetch.vue +4 -4
- package/src/components/BaseButtonGroup.vue +5 -5
- package/src/components/BaseColor.vue +4 -4
- package/src/components/BaseDropdownAutocomplete.vue +5 -5
- package/src/components/BaseHasMany.vue +4 -4
- package/src/components/BaseRadioGroup.vue +2 -2
- package/src/components/BaseSelect.vue +2 -2
- package/src/components/BaseTagAutocomplete.vue +3 -3
- package/src/components/BaseTagAutocompleteFetch.vue +3 -3
- package/src/composables/hasOptions.ts +3 -3
- package/src/types/Media.ts +1 -1
- package/src/types/Notification.ts +1 -1
- package/src/types/UploadedFile.ts +1 -1
- package/src/types/User.ts +1 -1
- package/src/types/index.ts +2 -2
- package/src/utils/sizes.ts +3 -1
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
<script lang="ts" setup>
|
|
46
46
|
import { PropType } from 'vue';
|
|
47
47
|
import BaseAutocomplete from './BaseAutocomplete.vue';
|
|
48
|
-
import {
|
|
48
|
+
import { RawOption, SelectConfiguration } from '@/types';
|
|
49
49
|
import { Size } from '@/utils/sizes';
|
|
50
50
|
|
|
51
51
|
const props = defineProps({
|
|
@@ -57,7 +57,7 @@ const props = defineProps({
|
|
|
57
57
|
},
|
|
58
58
|
options: {
|
|
59
59
|
required: true,
|
|
60
|
-
type: Array as PropType<
|
|
60
|
+
type: Array as PropType<RawOption[]>,
|
|
61
61
|
},
|
|
62
62
|
primaryKey: {
|
|
63
63
|
default: 'id',
|
|
@@ -135,7 +135,7 @@ const model = computed(() => {
|
|
|
135
135
|
: null;
|
|
136
136
|
});
|
|
137
137
|
|
|
138
|
-
function onUpdate(newModel:
|
|
138
|
+
function onUpdate(newModel: RawOption | null) {
|
|
139
139
|
if (!newModel) {
|
|
140
140
|
emit('update:modelValue', null, null);
|
|
141
141
|
} else {
|
|
@@ -47,7 +47,7 @@ import { PropType } from 'vue';
|
|
|
47
47
|
import { AxiosResponse } from 'axios';
|
|
48
48
|
import { config } from '@/index';
|
|
49
49
|
import BaseAutocompleteFetch from './BaseAutocompleteFetch.vue';
|
|
50
|
-
import {
|
|
50
|
+
import { RawOption, SelectConfiguration } from '@/types';
|
|
51
51
|
import { Size } from '@/utils/sizes';
|
|
52
52
|
import { debounce, isObject } from 'lodash';
|
|
53
53
|
|
|
@@ -92,7 +92,7 @@ const props = defineProps({
|
|
|
92
92
|
},
|
|
93
93
|
currentModel: {
|
|
94
94
|
default: undefined,
|
|
95
|
-
type: [Object, null, undefined] as PropType<
|
|
95
|
+
type: [Object, null, undefined] as PropType<RawOption | null | undefined>,
|
|
96
96
|
},
|
|
97
97
|
hasError: {
|
|
98
98
|
default: false,
|
|
@@ -144,7 +144,7 @@ const autocompleteFetch = ref<InstanceType<
|
|
|
144
144
|
typeof BaseAutocompleteFetch
|
|
145
145
|
> | null>(null);
|
|
146
146
|
|
|
147
|
-
const model = ref<
|
|
147
|
+
const model = ref<RawOption | null>(null);
|
|
148
148
|
const ensureModelIsFilledDebounced = debounce(ensureModelIsFilled, 100);
|
|
149
149
|
|
|
150
150
|
watch(
|
|
@@ -159,7 +159,7 @@ watch(
|
|
|
159
159
|
|
|
160
160
|
ensureModelIsFilledDebounced();
|
|
161
161
|
|
|
162
|
-
function onUpdate(newModel:
|
|
162
|
+
function onUpdate(newModel: RawOption | null) {
|
|
163
163
|
if (!newModel) {
|
|
164
164
|
model.value = null;
|
|
165
165
|
emit('update:modelValue', null, null);
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
<script lang="ts" setup>
|
|
29
29
|
import { PropType, computed } from 'vue';
|
|
30
|
-
import { NormalizedOption,
|
|
30
|
+
import { NormalizedOption, RawOption } from '@/types';
|
|
31
31
|
import { cloneDeep, isArray } from 'lodash';
|
|
32
32
|
import { useHasOptions } from '@/composables/hasOptions';
|
|
33
33
|
import { useField } from '@/composables/field';
|
|
@@ -43,7 +43,7 @@ const props = defineProps({
|
|
|
43
43
|
modelValue: {
|
|
44
44
|
default: undefined,
|
|
45
45
|
type: [Object, Array, null, undefined] as PropType<
|
|
46
|
-
|
|
46
|
+
RawOption[] | RawOption | null | undefined
|
|
47
47
|
>,
|
|
48
48
|
},
|
|
49
49
|
class: {
|
|
@@ -67,10 +67,10 @@ const props = defineProps({
|
|
|
67
67
|
type: String as PropType<'button' | 'submit'>,
|
|
68
68
|
},
|
|
69
69
|
buttonColor: {
|
|
70
|
-
default(option:
|
|
70
|
+
default(option: RawOption, selected: boolean) {
|
|
71
71
|
return selected ? 'primary' : ''
|
|
72
72
|
},
|
|
73
|
-
type: Function as PropType<(option:
|
|
73
|
+
type: Function as PropType<(option: RawOption, selected: boolean) => string>,
|
|
74
74
|
},
|
|
75
75
|
twButton: {
|
|
76
76
|
default: '',
|
|
@@ -82,7 +82,7 @@ const props = defineProps({
|
|
|
82
82
|
},
|
|
83
83
|
options: {
|
|
84
84
|
required: true,
|
|
85
|
-
type: Array as PropType<
|
|
85
|
+
type: Array as PropType<RawOption[]>,
|
|
86
86
|
},
|
|
87
87
|
labelKey: {
|
|
88
88
|
required: true,
|
|
@@ -35,7 +35,7 @@ import { PropType } from 'vue';
|
|
|
35
35
|
import { BaseButtonGroup } from '.';
|
|
36
36
|
import { isArray } from 'lodash';
|
|
37
37
|
import { useField } from '@/composables/field';
|
|
38
|
-
import {
|
|
38
|
+
import { RawOption } from '@/types';
|
|
39
39
|
import { palette } from '@/utils/colors';
|
|
40
40
|
import { getContrast } from 'color2k';
|
|
41
41
|
import { Size } from '@/utils/sizes';
|
|
@@ -70,10 +70,10 @@ const props = defineProps({
|
|
|
70
70
|
},
|
|
71
71
|
},
|
|
72
72
|
buttonColor: {
|
|
73
|
-
default(option:
|
|
73
|
+
default(option: RawOption, selected: boolean) {
|
|
74
74
|
return option.value;
|
|
75
75
|
},
|
|
76
|
-
type: Function as PropType<(option:
|
|
76
|
+
type: Function as PropType<(option: RawOption, selected: boolean) => string>,
|
|
77
77
|
},
|
|
78
78
|
multiple: {
|
|
79
79
|
default: false,
|
|
@@ -126,7 +126,7 @@ const { emitUpdate } = useField({
|
|
|
126
126
|
emit: emit,
|
|
127
127
|
});
|
|
128
128
|
|
|
129
|
-
function transformModelValue(payload:
|
|
129
|
+
function transformModelValue(payload: RawOption | RawOption[] | null) {
|
|
130
130
|
if (props.multiple) {
|
|
131
131
|
let newModalValue = [] as string[];
|
|
132
132
|
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
<script lang="ts" setup>
|
|
62
62
|
import { isArray } from 'lodash';
|
|
63
63
|
import { PropType } from 'vue';
|
|
64
|
-
import {
|
|
64
|
+
import { RawOption, SelectConfiguration } from '@/types';
|
|
65
65
|
import BaseDropdown from './BaseDropdown.vue';
|
|
66
66
|
import BaseAutocomplete from './BaseAutocomplete.vue';
|
|
67
67
|
import BaseAutocompleteFetch from './BaseAutocompleteFetch.vue';
|
|
@@ -72,7 +72,7 @@ import { Placement } from '@floating-ui/vue';
|
|
|
72
72
|
const props = defineProps({
|
|
73
73
|
modelValue: {
|
|
74
74
|
type: [Array, Object, null, undefined] as PropType<
|
|
75
|
-
|
|
75
|
+
RawOption[] | RawOption | null | undefined
|
|
76
76
|
>,
|
|
77
77
|
default: undefined,
|
|
78
78
|
},
|
|
@@ -85,7 +85,7 @@ const props = defineProps({
|
|
|
85
85
|
default: undefined,
|
|
86
86
|
},
|
|
87
87
|
options: {
|
|
88
|
-
type: Array as PropType<
|
|
88
|
+
type: Array as PropType<RawOption[] | undefined>,
|
|
89
89
|
default: undefined,
|
|
90
90
|
},
|
|
91
91
|
labelKey: {
|
|
@@ -174,7 +174,7 @@ watch(
|
|
|
174
174
|
);
|
|
175
175
|
|
|
176
176
|
function onUpdate(
|
|
177
|
-
value:
|
|
177
|
+
value: RawOption | RawOption[] | null | undefined,
|
|
178
178
|
close: () => void
|
|
179
179
|
) {
|
|
180
180
|
newValue.value = getNewValue(value);
|
|
@@ -186,7 +186,7 @@ function onUpdate(
|
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
function getNewValue(value:
|
|
189
|
+
function getNewValue(value: RawOption | RawOption[] | null | undefined) {
|
|
190
190
|
if (isArray(value)) {
|
|
191
191
|
return value;
|
|
192
192
|
}
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
<script lang="ts" setup>
|
|
47
47
|
import { debounce } from 'lodash';
|
|
48
|
-
import {
|
|
48
|
+
import { RawOption } from '@/types';
|
|
49
49
|
import { config } from '@/index';
|
|
50
50
|
import { PropType } from 'vue';
|
|
51
51
|
import BaseTagAutocompleteFetch from './BaseTagAutocompleteFetch.vue';
|
|
@@ -97,7 +97,7 @@ const props = defineProps({
|
|
|
97
97
|
default() {
|
|
98
98
|
return undefined;
|
|
99
99
|
},
|
|
100
|
-
type: Array as PropType<
|
|
100
|
+
type: Array as PropType<RawOption[] | undefined>,
|
|
101
101
|
},
|
|
102
102
|
hasError: {
|
|
103
103
|
default: false,
|
|
@@ -113,7 +113,7 @@ const tagAutocompleteFetch = ref<InstanceType<
|
|
|
113
113
|
typeof BaseTagAutocompleteFetch
|
|
114
114
|
> | null>(null);
|
|
115
115
|
|
|
116
|
-
const models = ref<
|
|
116
|
+
const models = ref<RawOption[]>([]);
|
|
117
117
|
const ensureModelIsFilledDebounced = debounce(() => ensureModelsAreFilled(), 100);
|
|
118
118
|
|
|
119
119
|
watch(
|
|
@@ -130,7 +130,7 @@ watch(
|
|
|
130
130
|
|
|
131
131
|
ensureModelIsFilledDebounced();
|
|
132
132
|
|
|
133
|
-
function onUpdate(newModels:
|
|
133
|
+
function onUpdate(newModels: RawOption[]) {
|
|
134
134
|
models.value = newModels;
|
|
135
135
|
emit(
|
|
136
136
|
'update:modelValue',
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
<script lang="ts" setup>
|
|
38
38
|
import { PropType } from 'vue';
|
|
39
|
-
import { NormalizedOption,
|
|
39
|
+
import { NormalizedOption, RawOption, OptionValue } from '@/types';
|
|
40
40
|
import { useField } from '@/composables/field';
|
|
41
41
|
import { uniqueId } from 'lodash';
|
|
42
42
|
|
|
@@ -61,7 +61,7 @@ const props = defineProps({
|
|
|
61
61
|
},
|
|
62
62
|
options: {
|
|
63
63
|
required: true,
|
|
64
|
-
type: Array as PropType<
|
|
64
|
+
type: Array as PropType<RawOption[]>,
|
|
65
65
|
},
|
|
66
66
|
labelKey: {
|
|
67
67
|
required: true,
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
import { PropType } from 'vue';
|
|
42
42
|
import { get, isArray } from 'lodash';
|
|
43
43
|
import { useField } from '@/composables/field';
|
|
44
|
-
import { NormalizedOption, OptionValue,
|
|
44
|
+
import { NormalizedOption, OptionValue, RawOption } from '@/types';
|
|
45
45
|
import { t } from '@/i18n';
|
|
46
46
|
import { twMerge } from 'tailwind-merge';
|
|
47
47
|
import { Size, sizes } from '@/utils/sizes';
|
|
@@ -90,7 +90,7 @@ const props = defineProps({
|
|
|
90
90
|
},
|
|
91
91
|
options: {
|
|
92
92
|
default: undefined,
|
|
93
|
-
type: Array as PropType<
|
|
93
|
+
type: Array as PropType<RawOption[]>,
|
|
94
94
|
},
|
|
95
95
|
labelKey: {
|
|
96
96
|
default: undefined,
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
<script lang="ts" setup>
|
|
93
93
|
import { cloneDeep, get } from 'lodash';
|
|
94
94
|
import { PropType, ComputedRef } from 'vue';
|
|
95
|
-
import { NormalizedOption,
|
|
95
|
+
import { NormalizedOption, RawOption } from '@/types';
|
|
96
96
|
import { useHasOptions } from '@/composables/hasOptions';
|
|
97
97
|
import { useField } from '@/composables/field';
|
|
98
98
|
import { useClickOutside } from '@/composables/clickOutside';
|
|
@@ -107,11 +107,11 @@ const notifications = useNotificationsStore();
|
|
|
107
107
|
const props = defineProps({
|
|
108
108
|
modelValue: {
|
|
109
109
|
required: true,
|
|
110
|
-
type: [Array, null] as PropType<
|
|
110
|
+
type: [Array, null] as PropType<RawOption[] | null>,
|
|
111
111
|
},
|
|
112
112
|
options: {
|
|
113
113
|
required: true,
|
|
114
|
-
type: Array as PropType<
|
|
114
|
+
type: Array as PropType<RawOption[]>,
|
|
115
115
|
},
|
|
116
116
|
labelKey: {
|
|
117
117
|
required: true,
|
|
@@ -63,7 +63,7 @@ import { config } from '@/index';
|
|
|
63
63
|
import { PropType } from 'vue';
|
|
64
64
|
import {
|
|
65
65
|
Collection,
|
|
66
|
-
|
|
66
|
+
RawOption,
|
|
67
67
|
PaginatedCollection,
|
|
68
68
|
ResourceCollection,
|
|
69
69
|
} from '@/types';
|
|
@@ -74,7 +74,7 @@ import { t } from '@/i18n';
|
|
|
74
74
|
const props = defineProps({
|
|
75
75
|
modelValue: {
|
|
76
76
|
required: true,
|
|
77
|
-
type: Array as PropType<
|
|
77
|
+
type: Array as PropType<RawOption[]>,
|
|
78
78
|
},
|
|
79
79
|
url: {
|
|
80
80
|
required: true,
|
|
@@ -131,7 +131,7 @@ const fetching = ref(false);
|
|
|
131
131
|
const firstSearch = ref(false);
|
|
132
132
|
const keywords = ref('');
|
|
133
133
|
const page = ref(1);
|
|
134
|
-
const options = ref<
|
|
134
|
+
const options = ref<RawOption[]>([]);
|
|
135
135
|
|
|
136
136
|
const data = ref<null | ResourceCollection | PaginatedCollection | Collection>(
|
|
137
137
|
null
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
|
-
import { NormalizedOption,
|
|
2
|
+
import { NormalizedOption, RawOption } from '@/types';
|
|
3
3
|
import { isArray, isObject } from 'lodash';
|
|
4
4
|
|
|
5
5
|
export function useHasOptions(
|
|
6
|
-
modelValue: Ref<
|
|
7
|
-
options: Ref<
|
|
6
|
+
modelValue: Ref<RawOption[] | RawOption | null | undefined>,
|
|
7
|
+
options: Ref<RawOption[]>,
|
|
8
8
|
labelKey: Ref<string>,
|
|
9
9
|
valueKey: Ref<string>,
|
|
10
10
|
multiple: Ref<boolean> = ref(false)
|
package/src/types/Media.ts
CHANGED
package/src/types/User.ts
CHANGED
package/src/types/index.ts
CHANGED
|
@@ -34,10 +34,10 @@ export interface DataTableQuery extends Record<string, any> {
|
|
|
34
34
|
|
|
35
35
|
export type OptionValue = string | number | null;
|
|
36
36
|
|
|
37
|
-
export type
|
|
37
|
+
export type RawOption = Record<string, any>;
|
|
38
38
|
|
|
39
39
|
export type NormalizedOption = {
|
|
40
|
-
option:
|
|
40
|
+
option: RawOption;
|
|
41
41
|
value: OptionValue;
|
|
42
42
|
label: string;
|
|
43
43
|
};
|