@bagelink/vue 1.9.63 → 1.9.67
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 +1 -1
- package/dist/components/Filter.vue.d.ts.map +1 -1
- package/dist/components/Modal.vue.d.ts.map +1 -1
- package/dist/i18n/index.d.ts +3 -1
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/index.cjs +33 -33
- package/dist/index.mjs +964 -967
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/Filter.vue +11 -12
- package/src/components/Modal.vue +3 -0
- package/src/i18n/index.ts +12 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts" generic="T extends Record<string, any>">
|
|
2
2
|
import type { Option } from '@bagelink/vue'
|
|
3
|
-
import type { ComparisonOperator, LogicalOperator, QueryConditions } from '
|
|
3
|
+
import type { ComparisonOperator, LogicalOperator, QueryConditions } from '../utils/queryFilter'
|
|
4
4
|
import { Btn, DateInput, Dropdown, Icon, SelectInput, TextInput, useI18n } from '@bagelink/vue'
|
|
5
5
|
import { computed } from 'vue'
|
|
6
6
|
|
|
@@ -132,7 +132,8 @@ const booleanOptions = computed(() => [
|
|
|
132
132
|
{ label: currentTexts.value.boolean.false, value: 'false' },
|
|
133
133
|
])
|
|
134
134
|
|
|
135
|
-
function parseValue(value: string): string | number | boolean | null {
|
|
135
|
+
function parseValue(value: string | number | boolean | null): string | number | boolean | null {
|
|
136
|
+
if (typeof value === 'number' || typeof value === 'boolean' || value === null) return value
|
|
136
137
|
if (value === 'true') return true
|
|
137
138
|
if (value === 'false') return false
|
|
138
139
|
if (value === 'null') return null
|
|
@@ -140,7 +141,7 @@ function parseValue(value: string): string | number | boolean | null {
|
|
|
140
141
|
return value
|
|
141
142
|
}
|
|
142
143
|
|
|
143
|
-
function updateConditionAtIndex(index: number, updates: Partial<{ field: string, op: ComparisonOperator, value: string, connector: LogicalOperator }>) {
|
|
144
|
+
function updateConditionAtIndex(index: number, updates: Partial<{ field: string, op: ComparisonOperator, value: string | number | boolean | null, connector: LogicalOperator }>) {
|
|
144
145
|
const newModel = [...model.value]
|
|
145
146
|
const existing = newModel[index]
|
|
146
147
|
if (!existing) return
|
|
@@ -197,11 +198,11 @@ function needsValue(operator: ComparisonOperator): boolean {
|
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
const activeFiltersCount = computed(() => {
|
|
200
|
-
return conditions.value.filter(c => Boolean(c.field) && (c.operator === 'pr' || Boolean(c.value))).length
|
|
201
|
+
return conditions.value.filter((c: UICondition) => Boolean(c.field) && (c.operator === 'pr' || Boolean(c.value))).length
|
|
201
202
|
})
|
|
202
203
|
|
|
203
204
|
function getConditionIndex(id: string): number {
|
|
204
|
-
return conditions.value.findIndex(c => c.id === id)
|
|
205
|
+
return conditions.value.findIndex((c: UICondition) => c.id === id)
|
|
205
206
|
}
|
|
206
207
|
|
|
207
208
|
function onFieldChange(id: string, newField: string) {
|
|
@@ -244,8 +245,7 @@ function onConnectorChange(id: string, connector: LogicalOperator) {
|
|
|
244
245
|
<TransitionGroup name="condition">
|
|
245
246
|
<div
|
|
246
247
|
v-for="(condition, index) in conditions" :key="condition.id"
|
|
247
|
-
class="grid filter-row gap-025 align-items-center pt-025"
|
|
248
|
-
:class="{
|
|
248
|
+
class="grid filter-row gap-025 align-items-center pt-025" :class="{
|
|
249
249
|
'mt-025': index > 0 && condition.connector === 'or',
|
|
250
250
|
'pt-075 border-top-or': index > 0 && condition.connector === 'or',
|
|
251
251
|
}"
|
|
@@ -253,16 +253,14 @@ function onConnectorChange(id: string, connector: LogicalOperator) {
|
|
|
253
253
|
<!-- Connector (AND/OR) -->
|
|
254
254
|
<div v-if="index > 0" class="min-w-100px">
|
|
255
255
|
<SelectInput
|
|
256
|
-
:model-value="condition.connector || 'and'"
|
|
257
|
-
:options="[
|
|
256
|
+
:model-value="condition.connector || 'and'" :options="[
|
|
258
257
|
{ label: currentTexts.connectors.and, value: 'and' },
|
|
259
258
|
{ label: currentTexts.connectors.or, value: 'or' },
|
|
260
|
-
]"
|
|
261
|
-
class="m-0 and-or-select txt-12"
|
|
259
|
+
]" class="m-0 and-or-select txt-12"
|
|
262
260
|
@update:model-value="(v: LogicalOperator) => onConnectorChange(condition.id, v)"
|
|
263
261
|
/>
|
|
264
262
|
</div>
|
|
265
|
-
<div v-else
|
|
263
|
+
<div v-else />
|
|
266
264
|
|
|
267
265
|
<!-- Field selector -->
|
|
268
266
|
<SelectInput
|
|
@@ -340,6 +338,7 @@ function onConnectorChange(id: string, connector: LogicalOperator) {
|
|
|
340
338
|
--input-font-size: 12px !important;
|
|
341
339
|
--input-background-color: transparent !important;
|
|
342
340
|
}
|
|
341
|
+
|
|
343
342
|
.and-or-select .selectinput-btn {
|
|
344
343
|
border: none;
|
|
345
344
|
width: 100%;
|
package/src/components/Modal.vue
CHANGED
package/src/i18n/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Composer, I18n } from 'vue-i18n'
|
|
2
|
-
import { createI18n as createVueI18n
|
|
2
|
+
import { createI18n as createVueI18n } from 'vue-i18n'
|
|
3
3
|
import en from './locales/en.json'
|
|
4
4
|
import es from './locales/es.json'
|
|
5
5
|
import fr from './locales/fr.json'
|
|
@@ -91,19 +91,21 @@ interface UseI18nReturn {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
|
-
* useI18n wrapper that returns bagelink's typed i18n functions
|
|
94
|
+
* useI18n wrapper that returns bagelink's typed i18n functions.
|
|
95
|
+
* Uses the global i18n instance directly to work in all contexts,
|
|
96
|
+
* including dialog containers mounted in a secondary app instance.
|
|
95
97
|
*/
|
|
96
98
|
export function useI18n(): UseI18nReturn {
|
|
97
|
-
const
|
|
99
|
+
const global = getI18n().global as Composer
|
|
98
100
|
|
|
99
101
|
return {
|
|
100
|
-
$t: t,
|
|
101
|
-
t,
|
|
102
|
-
locale,
|
|
103
|
-
availableLocales,
|
|
104
|
-
fallbackLocale,
|
|
105
|
-
n,
|
|
106
|
-
d,
|
|
102
|
+
$t: global.t,
|
|
103
|
+
t: global.t,
|
|
104
|
+
locale: global.locale,
|
|
105
|
+
availableLocales: global.availableLocales,
|
|
106
|
+
fallbackLocale: global.fallbackLocale,
|
|
107
|
+
n: global.n,
|
|
108
|
+
d: global.d,
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
111
|
|