ads-nuxt 0.6.2 → 0.6.4
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.
|
@@ -147,7 +147,7 @@ const props = withDefaults(
|
|
|
147
147
|
panelWidthClass?: string;
|
|
148
148
|
/**
|
|
149
149
|
* Ação de cadastrar no rodapé da lista, com ícone de adicionar. `{query}` vira a busca atual,
|
|
150
|
-
* ex.: "Cadastrar {query}". Sem valor, a ação não aparece.
|
|
150
|
+
* ex.: "Cadastrar {query}". Sem valor, com busca vazia ou com resultados na lista filtrada, a ação não aparece.
|
|
151
151
|
*/
|
|
152
152
|
addLabel?: string;
|
|
153
153
|
}>(),
|
|
@@ -125,7 +125,7 @@ const props = withDefaults(
|
|
|
125
125
|
widthClass?: string;
|
|
126
126
|
/**
|
|
127
127
|
* Ação de cadastrar no rodapé, com ícone de adicionar. `{query}` vira a busca atual.
|
|
128
|
-
* Sem valor, a ação não aparece.
|
|
128
|
+
* Sem valor, com busca vazia ou com resultados na lista filtrada, a ação não aparece.
|
|
129
129
|
*/
|
|
130
130
|
addLabel?: string;
|
|
131
131
|
}>(),
|
|
@@ -148,16 +148,20 @@ const emit = defineEmits<{
|
|
|
148
148
|
add: [query: string];
|
|
149
149
|
}>();
|
|
150
150
|
|
|
151
|
-
/** Texto da ação: `{query}` recebe a busca; sem busca, o trecho some. */
|
|
152
|
-
const addText = computed(() => {
|
|
153
|
-
if (!props.addLabel) return "";
|
|
154
|
-
const text = props.addLabel.replaceAll("{query}", query.value.trim());
|
|
155
|
-
return text.replace(/\s+/g, " ").trim();
|
|
156
|
-
});
|
|
157
|
-
|
|
158
151
|
const groups = computed(() => groupFilterOptions(props.options, query.value));
|
|
159
152
|
/** Correspondência exata da busca vem primeiro. */
|
|
160
153
|
const rows = computed(() => [...groups.value.exact, ...groups.value.matches]);
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Ação de cadastrar: `{query}` recebe a busca.
|
|
157
|
+
* Só aparece com busca preenchida e sem resultados na lista filtrada.
|
|
158
|
+
*/
|
|
159
|
+
const addText = computed(() => {
|
|
160
|
+
if (!props.addLabel) return "";
|
|
161
|
+
const typed = query.value.trim();
|
|
162
|
+
if (!typed || !groups.value.empty) return "";
|
|
163
|
+
return props.addLabel.replaceAll("{query}", typed).replace(/\s+/g, " ").trim();
|
|
164
|
+
});
|
|
161
165
|
const enabledOptions = computed(() => props.options.filter((option) => !option.disabled));
|
|
162
166
|
|
|
163
167
|
const selectedList = computed(() =>
|