@ouestfrance/sipa-bms-ui 8.9.0 → 8.9.2

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.
@@ -1,17 +1,17 @@
1
1
  import { InputOption } from '../../models';
2
2
  import { FieldComponentProps } from '../../plugins/field/field-component.model';
3
3
  export interface Props extends FieldComponentProps {
4
- options: InputOption[];
4
+ options: InputOption[] | string[];
5
5
  placeholder?: string;
6
6
  }
7
7
  type __VLS_Props = Props;
8
8
  type __VLS_PublicProps = {
9
- 'modelValue': InputOption[];
9
+ 'modelValue'?: string[] | null;
10
10
  } & __VLS_Props;
11
11
  declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
12
- "update:modelValue": (value: InputOption[]) => any;
12
+ "update:modelValue": (value: string[] | null) => any;
13
13
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
14
- "onUpdate:modelValue"?: ((value: InputOption[]) => any) | undefined;
14
+ "onUpdate:modelValue"?: ((value: string[] | null) => any) | undefined;
15
15
  }>, {
16
16
  label: string;
17
17
  required: boolean;
@@ -1188,28 +1188,28 @@ input[type=radio][data-v-c0c9efa3]:checked::before {
1188
1188
  --field-border-color: var(--bms-grey-25);
1189
1189
  --input-background-color: var(--bms-grey-25);
1190
1190
  pointer-events: none;
1191
- }.tags[data-v-05d9b16f] {
1191
+ }.tags[data-v-aece870d] {
1192
1192
  display: flex;
1193
1193
  gap: 0.5em;
1194
1194
  padding: var(--field-margin);
1195
1195
  flex-wrap: wrap;
1196
1196
  width: 100%;
1197
1197
  }
1198
- .tags .search[data-v-05d9b16f] {
1198
+ .tags .search[data-v-aece870d] {
1199
1199
  outline: none;
1200
1200
  border: none;
1201
1201
  background-color: transparent;
1202
1202
  flex-grow: 1;
1203
1203
  }
1204
- .icon-container[data-v-05d9b16f] {
1204
+ .icon-container[data-v-aece870d] {
1205
1205
  height: 100%;
1206
1206
  display: flex;
1207
1207
  align-items: center;
1208
1208
  }
1209
- .icon-container[data-v-05d9b16f]:hover {
1209
+ .icon-container[data-v-aece870d]:hover {
1210
1210
  cursor: pointer;
1211
1211
  }
1212
- .icon-container .icon[data-v-05d9b16f] {
1212
+ .icon-container .icon[data-v-aece870d] {
1213
1213
  display: block;
1214
1214
  width: 1em;
1215
1215
  height: 1em;
@@ -1628,16 +1628,14 @@ input[type=radio][data-v-c0c9efa3]:checked::before {
1628
1628
  display: flex;
1629
1629
  justify-content: flex-end;
1630
1630
  gap: 1em;
1631
- }.stepper-header[data-v-c872a497] {
1631
+ }.stepper-header[data-v-c132d5cd] {
1632
1632
  display: flex;
1633
1633
  justify-content: center;
1634
1634
  align-items: center;
1635
- position: sticky;
1636
- z-index: 2;
1637
1635
  top: 0;
1638
1636
  padding: 2em 0;
1639
1637
  }
1640
- .stepper-header[data-v-c872a497]::before {
1638
+ .stepper-header[data-v-c132d5cd]::before {
1641
1639
  content: "";
1642
1640
  display: block;
1643
1641
  width: 80%;
@@ -1651,7 +1649,7 @@ input[type=radio][data-v-c0c9efa3]:checked::before {
1651
1649
  opacity: 0;
1652
1650
  transition: opacity 0.2s linear;
1653
1651
  }
1654
- .stepper-header[data-v-c872a497]::after {
1652
+ .stepper-header[data-v-c132d5cd]::after {
1655
1653
  content: "";
1656
1654
  display: block;
1657
1655
  position: absolute;
@@ -1662,22 +1660,22 @@ input[type=radio][data-v-c0c9efa3]:checked::before {
1662
1660
  background: transparent;
1663
1661
  z-index: -1;
1664
1662
  }
1665
- .stepper-header--step[data-v-c872a497] {
1663
+ .stepper-header--step[data-v-c132d5cd] {
1666
1664
  display: flex;
1667
1665
  justify-content: center;
1668
1666
  align-items: center;
1669
1667
  margin: 0 10px;
1670
1668
  }
1671
- .stepper-header--step[data-v-c872a497]:first-child {
1669
+ .stepper-header--step[data-v-c132d5cd]:first-child {
1672
1670
  margin: 0 10px 0 0;
1673
1671
  }
1674
- .stepper-header--step[data-v-c872a497]:last-child {
1672
+ .stepper-header--step[data-v-c132d5cd]:last-child {
1675
1673
  margin: 0;
1676
1674
  }
1677
- .stepper-header--step.clickable:hover div[data-v-c872a497] {
1675
+ .stepper-header--step.clickable:hover div[data-v-c132d5cd] {
1678
1676
  cursor: pointer;
1679
1677
  }
1680
- .stepper-header--indicator[data-v-c872a497] {
1678
+ .stepper-header--indicator[data-v-c132d5cd] {
1681
1679
  width: 30px;
1682
1680
  height: 30px;
1683
1681
  display: flex;
@@ -1689,22 +1687,22 @@ input[type=radio][data-v-c0c9efa3]:checked::before {
1689
1687
  font-weight: bold;
1690
1688
  margin-right: 10px;
1691
1689
  }
1692
- .stepper-header--indicator.active[data-v-c872a497] {
1690
+ .stepper-header--indicator.active[data-v-c132d5cd] {
1693
1691
  border: none;
1694
1692
  background-color: var(--bms-main-100);
1695
1693
  color: white;
1696
1694
  }
1697
- .stepper-header--indicator.complete[data-v-c872a497] {
1695
+ .stepper-header--indicator.complete[data-v-c132d5cd] {
1698
1696
  border: none;
1699
1697
  background-color: var(--bms-success-color);
1700
1698
  color: white;
1701
1699
  font-size: 20px;
1702
1700
  }
1703
- .stepper-header--separator[data-v-c872a497] {
1701
+ .stepper-header--separator[data-v-c132d5cd] {
1704
1702
  width: 30px;
1705
1703
  margin-left: 10px;
1706
1704
  }
1707
- .stepper-body[data-v-c872a497] {
1705
+ .stepper-body[data-v-c132d5cd] {
1708
1706
  margin: 10px 10px 0 10px;
1709
1707
  }a[data-v-02d02028] {
1710
1708
  cursor: pointer;
@@ -68458,9 +68458,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
68458
68458
  disabled: { type: Boolean, default: false },
68459
68459
  small: { type: Boolean }
68460
68460
  }, {
68461
- "modelValue": {
68462
- required: true
68463
- },
68461
+ "modelValue": { default: [] },
68464
68462
  "modelModifiers": {}
68465
68463
  }),
68466
68464
  emits: ["update:modelValue"],
@@ -68472,8 +68470,12 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
68472
68470
  const openDatalist = () => isDatalistOpen.value = true;
68473
68471
  const searching = ref("");
68474
68472
  const modelValue = useModel(__props, "modelValue");
68473
+ onClickOutside(inputElement, closeDatalist, {
68474
+ ignore: [".datalist-option", ".icon-toggle-button"]
68475
+ });
68475
68476
  const onBackspace = () => {
68476
- modelValue.value.splice(-1);
68477
+ if (searching.value.length === 0 && modelValue.value && modelValue.value.length > 0)
68478
+ modelValue.value.splice(-1);
68477
68479
  };
68478
68480
  const setFocus = () => {
68479
68481
  if (inputElement.value) {
@@ -68481,38 +68483,50 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
68481
68483
  }
68482
68484
  };
68483
68485
  const onSelect = (option) => {
68484
- modelValue.value.push(option);
68486
+ if (typeof option === "string") {
68487
+ modelValue.value = (modelValue.value ?? []).concat(option);
68488
+ } else if (option.value) {
68489
+ modelValue.value = (modelValue.value ?? []).concat(option.value);
68490
+ }
68485
68491
  searching.value = "";
68486
68492
  setFocus();
68487
68493
  closeDatalist();
68488
68494
  };
68489
68495
  const removeOption = (value) => {
68490
- modelValue.value = modelValue.value.filter((o) => o.value !== value);
68496
+ modelValue.value = (modelValue.value ?? []).filter((o) => o !== value);
68491
68497
  };
68492
68498
  const clearInput = () => {
68493
68499
  modelValue.value = [];
68494
68500
  searching.value = "";
68495
68501
  };
68496
- const displayedOptions = computed(
68497
- () => props.options.filter((o) => searchString(o.label, searching.value)).filter(
68498
- (o) => !modelValue.value.find((option) => option.value === o.value)
68499
- )
68502
+ const selectedItems = computed(() => {
68503
+ if (!modelValue.value) return [];
68504
+ const items = [];
68505
+ modelValue.value.forEach((selectedValue) => {
68506
+ const item = optionsLabelValue.value.find(
68507
+ (option) => option.value === selectedValue
68508
+ );
68509
+ if (item) items.push(item);
68510
+ });
68511
+ return items;
68512
+ });
68513
+ const optionsLabelValue = computed(
68514
+ () => Array.isArray(props.options) && !!props.options.length && typeof props.options[0] === "string" ? props.options.map((o) => ({ label: o, value: o })) : props.options
68500
68515
  );
68501
- const displayValues = computed(
68502
- () => modelValue.value.filter(
68503
- (o) => props.options.find((option) => option.value === o.value)
68504
- )
68516
+ const filteredOptions = computed(
68517
+ () => optionsLabelValue.value.filter((o) => searchString(o.label, searching.value))
68505
68518
  );
68506
68519
  return (_ctx, _cache) => {
68507
68520
  return openBlock(), createBlock(RawSelect, mergeProps(_ctx.$props, {
68508
- options: displayedOptions.value,
68521
+ options: filteredOptions.value,
68509
68522
  "model-value": modelValue.value,
68510
68523
  open: isDatalistOpen.value,
68511
- onSelect
68524
+ onSelect,
68525
+ onClick: setFocus
68512
68526
  }), {
68513
68527
  input: withCtx(() => [
68514
68528
  createElementVNode("div", _hoisted_1$F, [
68515
- (openBlock(true), createElementBlock(Fragment, null, renderList(displayValues.value, (tag) => {
68529
+ (openBlock(true), createElementBlock(Fragment, null, renderList(selectedItems.value, (tag) => {
68516
68530
  return openBlock(), createBlock(BmsTag, {
68517
68531
  small: _ctx.small,
68518
68532
  active: "",
@@ -68543,7 +68557,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
68543
68557
  ])
68544
68558
  ]),
68545
68559
  createElementVNode("span", _hoisted_2$r, [
68546
- modelValue.value.length ? (openBlock(), createBlock(unref(X), {
68560
+ modelValue.value && modelValue.value?.length ? (openBlock(), createBlock(unref(X), {
68547
68561
  key: 0,
68548
68562
  class: "icon icon-clear",
68549
68563
  onClick: withModifiers(clearInput, ["stop"])
@@ -68578,7 +68592,7 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
68578
68592
  }
68579
68593
  });
68580
68594
 
68581
- const BmsMultiSelect = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["__scopeId", "data-v-05d9b16f"]]);
68595
+ const BmsMultiSelect = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["__scopeId", "data-v-aece870d"]]);
68582
68596
 
68583
68597
  const _sfc_main$N = /* @__PURE__ */ defineComponent({
68584
68598
  __name: "BmsSearch",
@@ -89584,7 +89598,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
89584
89598
  }
89585
89599
  });
89586
89600
 
89587
- const BmsStepper = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-c872a497"]]);
89601
+ const BmsStepper = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-c132d5cd"]]);
89588
89602
 
89589
89603
  const historyRoutes = ref([]);
89590
89604
  const useRouterHistory = () => {