@bagelink/vue 1.7.90 → 1.7.94
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/components/Filter.vue.d.ts.map +1 -1
- package/dist/index.cjs +25 -25
- package/dist/index.mjs +4236 -4230
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/Filter.vue +35 -38
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts" generic="T extends Record<string, any>">
|
|
2
|
+
import type { Option } from '@bagelink/vue'
|
|
2
3
|
import type { ComparisonOperator } from '../utils/queryFilter'
|
|
3
|
-
import { Btn, DateInput, Dropdown, Icon, SelectInput, TextInput
|
|
4
|
+
import { Btn, DateInput, Dropdown, Icon, SelectInput, TextInput } from '@bagelink/vue'
|
|
4
5
|
import { computed } from 'vue'
|
|
5
6
|
|
|
6
7
|
type OptionsSource = Option[] | ((query: string) => Promise<Option[]>)
|
|
@@ -275,11 +276,8 @@ function onValueChange(field: string, operator: ComparisonOperator, value: strin
|
|
|
275
276
|
|
|
276
277
|
<template>
|
|
277
278
|
<Dropdown
|
|
278
|
-
flat
|
|
279
|
-
|
|
280
|
-
icon="filter_alt"
|
|
281
|
-
:value="activeFiltersCount > 0 ? `${currentTexts.filter} (${activeFiltersCount})` : currentTexts.filter"
|
|
282
|
-
thin
|
|
279
|
+
flat placement="bottom-end" icon="filter_alt"
|
|
280
|
+
:value="activeFiltersCount > 0 ? `${currentTexts.filter} (${activeFiltersCount})` : currentTexts.filter" thin
|
|
283
281
|
:auto-hide="false"
|
|
284
282
|
>
|
|
285
283
|
<div class="p-1 m_p-05">
|
|
@@ -294,22 +292,21 @@ function onValueChange(field: string, operator: ComparisonOperator, value: strin
|
|
|
294
292
|
|
|
295
293
|
<TransitionGroup name="condition">
|
|
296
294
|
<div
|
|
297
|
-
v-for="(condition, index) in conditions"
|
|
298
|
-
:key="condition.id"
|
|
295
|
+
v-for="(condition, index) in conditions" :key="condition.id"
|
|
299
296
|
class="grid filter-row gap-025 align-items-center p-025"
|
|
300
297
|
>
|
|
301
298
|
<!-- Connector (AND/OR) - display only for now -->
|
|
302
299
|
<div v-if="index > 0" class="min-w-20px">
|
|
303
|
-
<span
|
|
300
|
+
<span v-if="condition.connector === 'or'" class="txt12 opacity-6">{{
|
|
301
|
+
currentTexts.connectors.or }}</span>
|
|
302
|
+
<span v-else class="txt12 opacity-6">{{ currentTexts.connectors.and }}</span>
|
|
304
303
|
</div>
|
|
305
304
|
<div v-else class="min-w-20px" />
|
|
306
305
|
|
|
307
306
|
<!-- Field selector -->
|
|
308
307
|
<SelectInput
|
|
309
|
-
:model-value="condition.field"
|
|
310
|
-
:
|
|
311
|
-
:placeholder="currentTexts.placeholders.selectField"
|
|
312
|
-
class="m-0 light-input borderHover"
|
|
308
|
+
:model-value="condition.field" :options="fields"
|
|
309
|
+
:placeholder="currentTexts.placeholders.selectField" class="m-0 light-input borderHover"
|
|
313
310
|
@update:model-value="(v: string) => onFieldChange(condition.field, v, condition)"
|
|
314
311
|
/>
|
|
315
312
|
|
|
@@ -324,56 +321,54 @@ function onValueChange(field: string, operator: ComparisonOperator, value: strin
|
|
|
324
321
|
<!-- Value input - type-specific -->
|
|
325
322
|
<template v-if="needsValue(condition.operator)">
|
|
326
323
|
<SelectInput
|
|
327
|
-
v-if="getFieldOptions(condition.field)"
|
|
328
|
-
:model-value="condition.value"
|
|
324
|
+
v-if="getFieldOptions(condition.field)" :model-value="condition.value"
|
|
329
325
|
:options="getFieldOptions(condition.field)!"
|
|
330
326
|
:placeholder="currentTexts.placeholders.selectOption"
|
|
331
|
-
class="m-0 light-input borderHover"
|
|
332
|
-
searchable
|
|
327
|
+
class="m-0 light-input borderHover" searchable
|
|
333
328
|
@update:model-value="(v: string) => onValueChange(condition.field, condition.operator, v)"
|
|
334
329
|
/>
|
|
335
330
|
<SelectInput
|
|
336
331
|
v-else-if="getFieldType(condition.field) === 'boolean'"
|
|
337
|
-
:model-value="condition.value"
|
|
338
|
-
:options="booleanOptions"
|
|
332
|
+
:model-value="condition.value" :options="booleanOptions"
|
|
339
333
|
:placeholder="currentTexts.placeholders.selectOption"
|
|
340
334
|
class="m-0 light-input borderHover"
|
|
341
335
|
@update:model-value="(v: string) => onValueChange(condition.field, condition.operator, v)"
|
|
342
336
|
/>
|
|
343
337
|
<DateInput
|
|
344
338
|
v-else-if="getFieldType(condition.field) === 'date'"
|
|
345
|
-
:model-value="condition.value"
|
|
346
|
-
:placeholder="currentTexts.placeholders.selectDate"
|
|
339
|
+
:model-value="condition.value" :placeholder="currentTexts.placeholders.selectDate"
|
|
347
340
|
class="m-0 light-input borderHover"
|
|
348
341
|
@update:model-value="(v: any) => onValueChange(condition.field, condition.operator, String(v))"
|
|
349
342
|
/>
|
|
350
343
|
<TextInput
|
|
351
344
|
v-else-if="getFieldType(condition.field) === 'number'"
|
|
352
|
-
:model-value="condition.value"
|
|
353
|
-
placeholder="0"
|
|
354
|
-
type="number"
|
|
345
|
+
:model-value="condition.value" placeholder="0" type="number"
|
|
355
346
|
class="m-0 light-input borderHover"
|
|
356
347
|
@update:model-value="(v: string) => onValueChange(condition.field, condition.operator, v)"
|
|
357
348
|
/>
|
|
358
349
|
<TextInput
|
|
359
|
-
v-else
|
|
360
|
-
:
|
|
361
|
-
:placeholder="currentTexts.placeholders.enterValue"
|
|
362
|
-
class="m-0 light-input borderHover"
|
|
350
|
+
v-else :model-value="condition.value"
|
|
351
|
+
:placeholder="currentTexts.placeholders.enterValue" class="m-0 light-input borderHover"
|
|
363
352
|
@update:model-value="(v: string) => onValueChange(condition.field, condition.operator, v)"
|
|
364
353
|
/>
|
|
365
354
|
</template>
|
|
366
355
|
<div v-else />
|
|
367
356
|
|
|
368
357
|
<!-- Remove button -->
|
|
369
|
-
<Btn
|
|
358
|
+
<Btn
|
|
359
|
+
icon="close" thin flat size="small" class="m_bg-gray-40 m_px-3 m_mx-auto"
|
|
360
|
+
@click="removeCondition(condition.field)"
|
|
361
|
+
/>
|
|
370
362
|
</div>
|
|
371
363
|
</TransitionGroup>
|
|
372
364
|
</div>
|
|
373
365
|
|
|
374
366
|
<div class="flex gap-1 space-between">
|
|
375
367
|
<Btn icon="add" flat thin :value="currentTexts.buttons.addCondition" @click="addCondition" />
|
|
376
|
-
<Btn
|
|
368
|
+
<Btn
|
|
369
|
+
v-if="conditions.length > 0" icon="delete_sweep" flat thin color="gray"
|
|
370
|
+
:value="currentTexts.buttons.clearAll" @click="clearAll"
|
|
371
|
+
/>
|
|
377
372
|
</div>
|
|
378
373
|
</div>
|
|
379
374
|
</Dropdown>
|
|
@@ -383,29 +378,31 @@ function onValueChange(field: string, operator: ComparisonOperator, value: strin
|
|
|
383
378
|
.filter-row {
|
|
384
379
|
grid-template-columns: auto minmax(90px, 0.5fr) minmax(170px, 0.75fr) minmax(120px, 0.5fr) auto;
|
|
385
380
|
}
|
|
386
|
-
|
|
381
|
+
|
|
382
|
+
/* Transition animations */
|
|
387
383
|
.condition-enter-active,
|
|
388
384
|
.condition-leave-active {
|
|
389
|
-
|
|
385
|
+
transition: all 0.25s ease;
|
|
390
386
|
}
|
|
391
387
|
|
|
392
388
|
.condition-enter-from {
|
|
393
|
-
|
|
394
|
-
|
|
389
|
+
opacity: 0;
|
|
390
|
+
transform: translateX(-10px);
|
|
395
391
|
}
|
|
396
392
|
|
|
397
393
|
.condition-leave-to {
|
|
398
|
-
|
|
399
|
-
|
|
394
|
+
opacity: 0;
|
|
395
|
+
transform: translateX(10px);
|
|
400
396
|
}
|
|
401
397
|
|
|
402
398
|
:dir(rtl) .condition-enter-from {
|
|
403
|
-
|
|
399
|
+
transform: translateX(10px);
|
|
404
400
|
}
|
|
405
401
|
|
|
406
402
|
:dir(rtl) .condition-leave-to {
|
|
407
|
-
|
|
403
|
+
transform: translateX(-10px);
|
|
408
404
|
}
|
|
405
|
+
|
|
409
406
|
@media (max-width: 910px) {
|
|
410
407
|
.filter-row {
|
|
411
408
|
grid-template-columns: auto;
|