@bagelink/vue 1.10.19 → 1.10.23

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "1.10.19",
4
+ "version": "1.10.23",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
@@ -90,7 +90,7 @@
90
90
  "signature_pad": "^5.0.9",
91
91
  "vue-i18n": "^11.2.8",
92
92
  "vue-toastification": "^2.0.0-rc.5",
93
- "@bagelink/utils": "1.10.19"
93
+ "@bagelink/utils": "1.10.23"
94
94
  },
95
95
  "scripts": {
96
96
  "dev": "tsx watch src/index.ts",
@@ -251,7 +251,16 @@ function getConditionIndex(id: string): number {
251
251
 
252
252
  function onFieldChange(id: string, newField: string) {
253
253
  const index = getConditionIndex(id)
254
- if (index >= 0) updateConditionAtIndex(index, { field: newField })
254
+ if (index < 0) return
255
+ const fieldDef = getFieldDef(newField)
256
+ const multi = !!(fieldDef?.multiple && fieldDef?.options)
257
+ const validOps = getOperatorsForType(fieldDef?.type || 'string', !!fieldDef?.options, multi)
258
+ const defaultOp = (multi ? 'in' : validOps[0]?.value ?? 'eq') as ComparisonOperator
259
+ updateConditionAtIndex(index, {
260
+ field: newField,
261
+ op: defaultOp,
262
+ value: multi ? [] : '',
263
+ })
255
264
  }
256
265
 
257
266
  function onOperatorChange(id: string, operator: ComparisonOperator) {
@@ -333,6 +342,7 @@ function onConnectorChange(id: string, connector: LogicalOperator) {
333
342
  <template v-if="needsValue(condition.operator)">
334
343
  <SelectInput
335
344
  v-if="getFieldOptions(condition.field) && isMultiOperator(condition.operator)"
345
+ :key="`${condition.id}-${condition.field}-multi`"
336
346
  :model-value="Array.isArray(condition.value) ? condition.value : []"
337
347
  :options="getFieldOptions(condition.field)!"
338
348
  :placeholder="currentTexts.placeholders.selectOption"
@@ -340,7 +350,9 @@ function onConnectorChange(id: string, connector: LogicalOperator) {
340
350
  @update:model-value="(v: string[]) => onValueChange(condition.id, v)"
341
351
  />
342
352
  <SelectInput
343
- v-else-if="getFieldOptions(condition.field)" :model-value="condition.value"
353
+ v-else-if="getFieldOptions(condition.field)"
354
+ :key="`${condition.id}-${condition.field}-single`"
355
+ :model-value="condition.value"
344
356
  :options="getFieldOptions(condition.field)!"
345
357
  :placeholder="currentTexts.placeholders.selectOption"
346
358
  class="m-0 light-input borderHover" searchable
@@ -348,6 +360,7 @@ function onConnectorChange(id: string, connector: LogicalOperator) {
348
360
  />
349
361
  <SelectInput
350
362
  v-else-if="getFieldType(condition.field) === 'boolean'"
363
+ :key="`${condition.id}-${condition.field}-bool`"
351
364
  :model-value="condition.value" :options="booleanOptions"
352
365
  :placeholder="currentTexts.placeholders.selectOption"
353
366
  class="m-0 light-input borderHover"
@@ -355,12 +368,14 @@ function onConnectorChange(id: string, connector: LogicalOperator) {
355
368
  />
356
369
  <DateInput
357
370
  v-else-if="getFieldType(condition.field) === 'date'"
371
+ :key="`${condition.id}-${condition.field}-date`"
358
372
  :model-value="(condition.value as string)"
359
373
  :placeholder="currentTexts.placeholders.selectDate" class="m-0 light-input borderHover"
360
374
  @update:model-value="(v: any) => onValueChange(condition.id, String(v))"
361
375
  />
362
376
  <TextInput
363
377
  v-else-if="getFieldType(condition.field) === 'number'"
378
+ :key="`${condition.id}-${condition.field}-number`"
364
379
  :model-value="(condition.value as string)" placeholder="0" type="number"
365
380
  class="m-0 light-input borderHover"
366
381
  @update:model-value="(v: string) => onValueChange(condition.id, v)"
@@ -417,7 +432,7 @@ function onConnectorChange(id: string, connector: LogicalOperator) {
417
432
 
418
433
  .first-filter-row {
419
434
  grid-template-columns: minmax(calc(140px + 0.25rem), 0.5fr) minmax(170px, 0.75fr) minmax(120px, 0.5fr) auto;
420
- padding-top: 0 !important;
435
+ padding-top: 0 !important;
421
436
  }
422
437
 
423
438
  .filter-row {
@@ -449,8 +464,9 @@ function onConnectorChange(id: string, connector: LogicalOperator) {
449
464
  }
450
465
 
451
466
  @media (max-width: 910px) {
452
- .filter-row,
453
- .first-filter-row {
467
+
468
+ .filter-row,
469
+ .first-filter-row {
454
470
  grid-template-columns: auto;
455
471
  }
456
472
  }