sprintify-ui 0.0.109 → 0.0.111
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 +600 -598
- package/dist/types/src/components/BaseField.vue.d.ts +1 -1
- package/dist/types/src/components/BaseFieldI18n.vue.d.ts +1 -1
- package/dist/types/src/components/BaseStatistic.vue.d.ts +1 -1
- package/dist/types/src/components/BaseTableColumn.vue.d.ts +1 -1
- package/dist/types/src/types/index.d.ts +8 -4
- package/package.json +1 -1
- package/src/components/BaseAutocomplete.stories.js +1 -1
- package/src/components/BaseAutocomplete.vue +24 -11
- package/src/components/BaseAutocompleteFetch.stories.js +1 -1
- package/src/components/BaseBelongsTo.stories.js +1 -1
- package/src/types/index.ts +9 -4
|
@@ -42,9 +42,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
42
42
|
type: PropType<string | string[] | Record<string, boolean>>;
|
|
43
43
|
};
|
|
44
44
|
}>>, {
|
|
45
|
+
label: string;
|
|
45
46
|
required: boolean;
|
|
46
47
|
name: string;
|
|
47
|
-
label: string;
|
|
48
48
|
errorType: "default" | "alert";
|
|
49
49
|
labelClass: string | string[] | Record<string, boolean>;
|
|
50
50
|
}>, {
|
|
@@ -81,9 +81,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
81
81
|
}>> & {
|
|
82
82
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
83
83
|
}, {
|
|
84
|
+
label: string;
|
|
84
85
|
required: boolean;
|
|
85
86
|
name: string;
|
|
86
|
-
label: string;
|
|
87
87
|
defaultValue: string | number | boolean;
|
|
88
88
|
modelValue: {
|
|
89
89
|
[locale: string]: string | number | boolean;
|
|
@@ -48,8 +48,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
48
48
|
type: PropType<string | null>;
|
|
49
49
|
};
|
|
50
50
|
}>>, {
|
|
51
|
-
caption: string | null;
|
|
52
51
|
label: string | null;
|
|
52
|
+
caption: string | null;
|
|
53
53
|
secondaryValue: string | null;
|
|
54
54
|
trend: "up" | "down" | null;
|
|
55
55
|
}>;
|
|
@@ -152,8 +152,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
152
152
|
default: () => {};
|
|
153
153
|
};
|
|
154
154
|
}>>, {
|
|
155
|
-
meta: Record<string, any> | unknown[];
|
|
156
155
|
label: string;
|
|
156
|
+
meta: Record<string, any> | unknown[];
|
|
157
157
|
toggle: boolean;
|
|
158
158
|
width: number;
|
|
159
159
|
field: string;
|
|
@@ -163,9 +163,13 @@ export interface NotificationsConfig {
|
|
|
163
163
|
footerLabel?: string;
|
|
164
164
|
footerTo?: RouteLocationRaw;
|
|
165
165
|
}
|
|
166
|
+
export interface SelectConfigurationOption {
|
|
167
|
+
value: OptionValue;
|
|
168
|
+
label: string;
|
|
169
|
+
[key: string]: any;
|
|
170
|
+
}
|
|
166
171
|
export interface SelectConfiguration {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
onChange: (value: OptionValue) => void;
|
|
172
|
+
option?: SelectConfigurationOption;
|
|
173
|
+
options: SelectConfigurationOption[];
|
|
174
|
+
onChange?: (option: SelectConfigurationOption | null) => void;
|
|
171
175
|
}
|
package/package.json
CHANGED
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
>
|
|
16
16
|
<option
|
|
17
17
|
v-for="option in select.options"
|
|
18
|
-
:key="option
|
|
19
|
-
:value="option
|
|
18
|
+
:key="option.value + ''"
|
|
19
|
+
:value="option.value"
|
|
20
20
|
>
|
|
21
|
-
{{ option
|
|
21
|
+
{{ option.label }}
|
|
22
22
|
</option>
|
|
23
23
|
</select>
|
|
24
24
|
<div class="relative grow">
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
<script lang="ts" setup>
|
|
121
121
|
import { get } from 'lodash';
|
|
122
122
|
import { PropType, Ref, ComputedRef } from 'vue';
|
|
123
|
-
import { NormalizedOption, Option } from '@/types';
|
|
123
|
+
import { NormalizedOption, Option, OptionValue } from '@/types';
|
|
124
124
|
import { useHasOptions } from '@/composables/hasOptions';
|
|
125
125
|
import { useField } from '@/composables/field';
|
|
126
126
|
import { BaseIcon } from './index';
|
|
@@ -420,27 +420,40 @@ function highlight() {
|
|
|
420
420
|
inputElement.value?.select();
|
|
421
421
|
}
|
|
422
422
|
|
|
423
|
-
const selection = ref(null) as Ref<
|
|
423
|
+
const selection = ref(null) as Ref<OptionValue>;
|
|
424
424
|
|
|
425
425
|
watch(
|
|
426
426
|
() => props.select,
|
|
427
427
|
(select) => {
|
|
428
|
-
if (select
|
|
429
|
-
|
|
428
|
+
if (select) {
|
|
429
|
+
if (select.option) {
|
|
430
|
+
selection.value = select.option.value;
|
|
431
|
+
} else if (select.options.length) {
|
|
432
|
+
selection.value = select.options[0].value;
|
|
433
|
+
}
|
|
434
|
+
} else {
|
|
435
|
+
selection.value = null;
|
|
430
436
|
}
|
|
431
437
|
},
|
|
432
438
|
{ immediate: true }
|
|
433
439
|
);
|
|
434
440
|
|
|
435
441
|
function onSelectChange(event: Event) {
|
|
436
|
-
focus();
|
|
437
|
-
open();
|
|
438
|
-
highlight();
|
|
439
442
|
const value = get(event, 'target.value', null);
|
|
443
|
+
const option = props.select?.options.find((option) => option.value == value);
|
|
444
|
+
|
|
440
445
|
if (props.select && props.select.onChange) {
|
|
441
|
-
props.select.onChange(
|
|
446
|
+
props.select.onChange(option ?? null);
|
|
442
447
|
}
|
|
448
|
+
|
|
443
449
|
emit('select', value);
|
|
450
|
+
|
|
451
|
+
// Let the emitted select event propagate before opening the dropdown
|
|
452
|
+
nextTick(() => {
|
|
453
|
+
focus();
|
|
454
|
+
open();
|
|
455
|
+
highlight();
|
|
456
|
+
});
|
|
444
457
|
}
|
|
445
458
|
|
|
446
459
|
const slotProps = {
|
package/src/types/index.ts
CHANGED
|
@@ -198,9 +198,14 @@ export interface NotificationsConfig {
|
|
|
198
198
|
footerTo?: RouteLocationRaw;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
export interface SelectConfigurationOption {
|
|
202
|
+
value: OptionValue;
|
|
203
|
+
label: string;
|
|
204
|
+
[key: string]: any;
|
|
205
|
+
}
|
|
206
|
+
|
|
201
207
|
export interface SelectConfiguration {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
onChange: (value: OptionValue) => void;
|
|
208
|
+
option?: SelectConfigurationOption;
|
|
209
|
+
options: SelectConfigurationOption[];
|
|
210
|
+
onChange?: (option: SelectConfigurationOption | null) => void;
|
|
206
211
|
}
|