sprintify-ui 0.4.9 → 0.4.10

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.
@@ -33,10 +33,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
33
33
  default: undefined;
34
34
  type: StringConstructor;
35
35
  };
36
- currentModel: {
37
- default: null;
38
- type: PropType<Option | null>;
39
- };
40
36
  hasError: {
41
37
  default: boolean;
42
38
  type: BooleanConstructor;
@@ -112,10 +108,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
112
108
  default: undefined;
113
109
  type: StringConstructor;
114
110
  };
115
- currentModel: {
116
- default: null;
117
- type: PropType<Option | null>;
118
- };
119
111
  hasError: {
120
112
  default: boolean;
121
113
  type: BooleanConstructor;
@@ -170,7 +162,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
170
162
  showEmptyOption: boolean;
171
163
  emptyOptionLabel: string;
172
164
  primaryKey: string;
173
- currentModel: Option | null;
174
165
  }, {}>, {
175
166
  option?(_: {
176
167
  focus: () => void;
@@ -178,8 +178,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
178
178
  showEmptyOption: boolean;
179
179
  emptyOptionLabel: string;
180
180
  primaryKey: string;
181
- currentModel: Option | null;
182
181
  showRouteUrl: ((id: string | number) => string) | undefined;
182
+ currentModel: Option | null;
183
183
  }, {}>, {
184
184
  option?(_: {
185
185
  focus: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.4.9",
3
+ "version": "0.4.10",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -81,10 +81,6 @@ const props = defineProps({
81
81
  default: undefined,
82
82
  type: String,
83
83
  },
84
- currentModel: {
85
- default: null,
86
- type: [Object, null] as PropType<Option | null>,
87
- },
88
84
  hasError: {
89
85
  default: false,
90
86
  type: Boolean,
@@ -127,22 +123,16 @@ const emit = defineEmits(['update:modelValue']);
127
123
 
128
124
  const autocomplete = ref<InstanceType<typeof BaseAutocomplete> | null>(null);
129
125
 
130
- const model = ref(props.currentModel);
131
-
132
- watch(
133
- () => props.currentModel,
134
- (newValue, oldValue) => {
135
- model.value = newValue;
136
- },
137
- { deep: true }
138
- );
126
+ const model = computed(() => {
127
+ return props.modelValue
128
+ ? props.options.find((option) => option[props.primaryKey] === props.modelValue)
129
+ : null;
130
+ });
139
131
 
140
132
  function onUpdate(newModel: Option | null) {
141
133
  if (!newModel) {
142
- model.value = null;
143
134
  emit('update:modelValue', null);
144
135
  } else {
145
- model.value = newModel;
146
136
  emit('update:modelValue', newModel[props.primaryKey]);
147
137
  }
148
138
  }