@bagelink/vue 0.0.566 → 0.0.568

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.
@@ -19,6 +19,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_TypePropsToRu
19
19
  multiselect?: boolean;
20
20
  icon?: MaterialIcons;
21
21
  hideLabel?: boolean;
22
+ defaultValue?: Option;
22
23
  }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
23
24
  "update:modelValue": (...args: any[]) => void;
24
25
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
@@ -33,6 +34,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_TypePropsToRu
33
34
  multiselect?: boolean;
34
35
  icon?: MaterialIcons;
35
36
  hideLabel?: boolean;
37
+ defaultValue?: Option;
36
38
  }>>> & {
37
39
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
38
40
  }, {}, {}>;
@@ -1 +1 @@
1
- {"version":3,"file":"SelectInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/form/inputs/SelectInput.vue"],"names":[],"mappings":"AAIA,OAAO,wBAAwB,CAAA;AAC/B,OAAO,EAGN,KAAK,aAAa,EAElB,MAAM,eAAe,CAAA;AAItB,KAAK,MAAM,GACR,MAAM,GACN,MAAM,GACN,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACnB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAA;AA4J5C,iBAAS,cAAc;kBAyQI,GAAG;EAG7B;AAqCD,QAAA,MAAM,eAAe;aAMX,MAAM,EAAE;kBACH,MAAM;eACT,OAAO;iBACL,MAAM;iBACN,OAAO;eACT,OAAO;YACV,MAAM;gBACF,OAAO;kBACL,OAAO;WACd,aAAa;gBACR,OAAO;;;;aAVV,MAAM,EAAE;kBACH,M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,eAAe;aAMX,MAAM,EAAE;kBACH,MAAM;eACT,OAAO;iBACL,MAAM;iBACN,OAAO;eACT,OAAO;YACV,MAAM;gBACF,OAAO;kBACL,OAAO;WACd,aAAa;gBACR,OAAO;mBACJ,MAAM;;;;aAXZ,MAAM,EAAE;kBACH,MAAM;eACT,OAAO;iBACL,MAAM;iBACN,OAAO;eACT,OAAO;YACV,MAAM;gBACF,OAAO;kBACL,OAAO;WACd,aAAa;gBACR,OAAO;mBACJ,MAAM;;;UAGpB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAAvG,wBAAwG;AACxG,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAClD,MAAM,EAAE,CAAC,CAAC;KACT,CAAA;CAAE,CAAC"}
package/dist/index.cjs CHANGED
@@ -25624,7 +25624,8 @@ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
25624
25624
  fullWidth: { type: Boolean },
25625
25625
  multiselect: { type: Boolean },
25626
25626
  icon: {},
25627
- hideLabel: { type: Boolean }
25627
+ hideLabel: { type: Boolean },
25628
+ defaultValue: {}
25628
25629
  },
25629
25630
  emits: ["update:modelValue"],
25630
25631
  setup(__props, { emit: __emit }) {
@@ -25673,7 +25674,7 @@ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
25673
25674
  if (typeof option2 === "number") return option2;
25674
25675
  return option2.value;
25675
25676
  }
25676
- const isSelected = (option2) => !!selectedItems.value.find((item) => getValue(option2) === getValue(item));
25677
+ const isSelected = (option2) => selectedItems.value.find((item) => getValue(option2) === getValue(item)) !== void 0;
25677
25678
  const filteredOptions = vue.computed(() => props2.options.filter((option2) => {
25678
25679
  const searchTerm = search.value.split(/\s+/).filter(Boolean).map((t) => new RegExp(t, "gi"));
25679
25680
  return Boolean(option2) && searchTerm.every((s2) => getLabel(option2).match(s2));
@@ -25713,7 +25714,7 @@ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
25713
25714
  () => props2.modelValue,
25714
25715
  (newVal) => {
25715
25716
  if (!props2.multiselect) {
25716
- const newOption = props2.options.find((o2) => getValue(o2) === newVal) || newVal;
25717
+ const newOption = props2.options.find((o2) => getValue(o2) === newVal) ?? newVal;
25717
25718
  if (newOption && !isSelected(newOption)) selectedItems.value = [newOption];
25718
25719
  } else {
25719
25720
  const isSame = compareArrays([newVal].flat(), selectedItems.value);
@@ -25731,12 +25732,21 @@ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
25731
25732
  const exists = props2.options.find(
25732
25733
  (o2) => getValue(o2) === getValue(option2)
25733
25734
  );
25734
- if (!exists) selectedItems.value.splice(i2, 1);
25735
+ if (exists === void 0) selectedItems.value.splice(i2, 1);
25735
25736
  else selectedItems.value.splice(i2, 1, exists);
25736
25737
  });
25737
25738
  },
25738
25739
  { deep: true, immediate: true }
25739
25740
  );
25741
+ vue.onMounted(() => {
25742
+ if (props2.defaultValue !== void 0) {
25743
+ const defaultOption = props2.options.find(
25744
+ (o2) => getValue(o2) === getValue(props2.defaultValue)
25745
+ );
25746
+ if (defaultOption === void 0) return;
25747
+ selectedItems.value = [defaultOption];
25748
+ }
25749
+ });
25740
25750
  return (_ctx, _cache) => {
25741
25751
  return vue.openBlock(), vue.createBlock(vue.unref(kt$1), {
25742
25752
  ref_key: "dropdown",
@@ -25821,7 +25831,7 @@ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
25821
25831
  };
25822
25832
  }
25823
25833
  });
25824
- const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-761f89bf"]]);
25834
+ const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-4e1d2142"]]);
25825
25835
  /*!
25826
25836
  * vue-draggable-next v2.2.0
25827
25837
  * (c) 2023 Anish George
package/dist/index.mjs CHANGED
@@ -25622,7 +25622,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
25622
25622
  fullWidth: { type: Boolean },
25623
25623
  multiselect: { type: Boolean },
25624
25624
  icon: {},
25625
- hideLabel: { type: Boolean }
25625
+ hideLabel: { type: Boolean },
25626
+ defaultValue: {}
25626
25627
  },
25627
25628
  emits: ["update:modelValue"],
25628
25629
  setup(__props, { emit: __emit }) {
@@ -25671,7 +25672,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
25671
25672
  if (typeof option2 === "number") return option2;
25672
25673
  return option2.value;
25673
25674
  }
25674
- const isSelected = (option2) => !!selectedItems.value.find((item) => getValue(option2) === getValue(item));
25675
+ const isSelected = (option2) => selectedItems.value.find((item) => getValue(option2) === getValue(item)) !== void 0;
25675
25676
  const filteredOptions = computed(() => props2.options.filter((option2) => {
25676
25677
  const searchTerm = search.value.split(/\s+/).filter(Boolean).map((t) => new RegExp(t, "gi"));
25677
25678
  return Boolean(option2) && searchTerm.every((s2) => getLabel(option2).match(s2));
@@ -25711,7 +25712,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
25711
25712
  () => props2.modelValue,
25712
25713
  (newVal) => {
25713
25714
  if (!props2.multiselect) {
25714
- const newOption = props2.options.find((o2) => getValue(o2) === newVal) || newVal;
25715
+ const newOption = props2.options.find((o2) => getValue(o2) === newVal) ?? newVal;
25715
25716
  if (newOption && !isSelected(newOption)) selectedItems.value = [newOption];
25716
25717
  } else {
25717
25718
  const isSame = compareArrays([newVal].flat(), selectedItems.value);
@@ -25729,12 +25730,21 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
25729
25730
  const exists = props2.options.find(
25730
25731
  (o2) => getValue(o2) === getValue(option2)
25731
25732
  );
25732
- if (!exists) selectedItems.value.splice(i2, 1);
25733
+ if (exists === void 0) selectedItems.value.splice(i2, 1);
25733
25734
  else selectedItems.value.splice(i2, 1, exists);
25734
25735
  });
25735
25736
  },
25736
25737
  { deep: true, immediate: true }
25737
25738
  );
25739
+ onMounted(() => {
25740
+ if (props2.defaultValue !== void 0) {
25741
+ const defaultOption = props2.options.find(
25742
+ (o2) => getValue(o2) === getValue(props2.defaultValue)
25743
+ );
25744
+ if (defaultOption === void 0) return;
25745
+ selectedItems.value = [defaultOption];
25746
+ }
25747
+ });
25738
25748
  return (_ctx, _cache) => {
25739
25749
  return openBlock(), createBlock(unref(kt$1), {
25740
25750
  ref_key: "dropdown",
@@ -25819,7 +25829,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
25819
25829
  };
25820
25830
  }
25821
25831
  });
25822
- const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-761f89bf"]]);
25832
+ const SelectInput = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-4e1d2142"]]);
25823
25833
  /*!
25824
25834
  * vue-draggable-next v2.2.0
25825
25835
  * (c) 2023 Anish George
package/dist/style.css CHANGED
@@ -1909,10 +1909,10 @@ svg.leaflet-image-layer.leaflet-interactive path {
1909
1909
  }
1910
1910
  .resize-observer[data-v-b329ee4c]{position:absolute;top:0;left:0;z-index:-1;width:100%;height:100%;border:none;background-color:transparent;pointer-events:none;display:block;overflow:hidden;opacity:0}.resize-observer[data-v-b329ee4c] object{display:block;position:absolute;top:0;left:0;height:100%;width:100%;overflow:hidden;pointer-events:none;z-index:-1}.v-popper__popper{z-index:10000;top:0;left:0;outline:none}.v-popper__popper.v-popper__popper--hidden{visibility:hidden;opacity:0;transition:opacity .15s,visibility .15s;pointer-events:none}.v-popper__popper.v-popper__popper--shown{visibility:visible;opacity:1;transition:opacity .15s}.v-popper__popper.v-popper__popper--skip-transition,.v-popper__popper.v-popper__popper--skip-transition>.v-popper__wrapper{transition:none!important}.v-popper__backdrop{position:absolute;top:0;left:0;width:100%;height:100%;display:none}.v-popper__inner{position:relative;box-sizing:border-box;overflow-y:auto}.v-popper__inner>div{position:relative;z-index:1;max-width:inherit;max-height:inherit}.v-popper__arrow-container{position:absolute;width:10px;height:10px}.v-popper__popper--arrow-overflow .v-popper__arrow-container,.v-popper__popper--no-positioning .v-popper__arrow-container{display:none}.v-popper__arrow-inner,.v-popper__arrow-outer{border-style:solid;position:absolute;top:0;left:0;width:0;height:0}.v-popper__arrow-inner{visibility:hidden;border-width:7px}.v-popper__arrow-outer{border-width:6px}.v-popper__popper[data-popper-placement^=top] .v-popper__arrow-inner,.v-popper__popper[data-popper-placement^=bottom] .v-popper__arrow-inner{left:-2px}.v-popper__popper[data-popper-placement^=top] .v-popper__arrow-outer,.v-popper__popper[data-popper-placement^=bottom] .v-popper__arrow-outer{left:-1px}.v-popper__popper[data-popper-placement^=top] .v-popper__arrow-inner,.v-popper__popper[data-popper-placement^=top] .v-popper__arrow-outer{border-bottom-width:0;border-left-color:transparent!important;border-right-color:transparent!important;border-bottom-color:transparent!important}.v-popper__popper[data-popper-placement^=top] .v-popper__arrow-inner{top:-2px}.v-popper__popper[data-popper-placement^=bottom] .v-popper__arrow-container{top:0}.v-popper__popper[data-popper-placement^=bottom] .v-popper__arrow-inner,.v-popper__popper[data-popper-placement^=bottom] .v-popper__arrow-outer{border-top-width:0;border-left-color:transparent!important;border-right-color:transparent!important;border-top-color:transparent!important}.v-popper__popper[data-popper-placement^=bottom] .v-popper__arrow-inner{top:-4px}.v-popper__popper[data-popper-placement^=bottom] .v-popper__arrow-outer{top:-6px}.v-popper__popper[data-popper-placement^=left] .v-popper__arrow-inner,.v-popper__popper[data-popper-placement^=right] .v-popper__arrow-inner{top:-2px}.v-popper__popper[data-popper-placement^=left] .v-popper__arrow-outer,.v-popper__popper[data-popper-placement^=right] .v-popper__arrow-outer{top:-1px}.v-popper__popper[data-popper-placement^=right] .v-popper__arrow-inner,.v-popper__popper[data-popper-placement^=right] .v-popper__arrow-outer{border-left-width:0;border-left-color:transparent!important;border-top-color:transparent!important;border-bottom-color:transparent!important}.v-popper__popper[data-popper-placement^=right] .v-popper__arrow-inner{left:-4px}.v-popper__popper[data-popper-placement^=right] .v-popper__arrow-outer{left:-6px}.v-popper__popper[data-popper-placement^=left] .v-popper__arrow-container{right:-10px}.v-popper__popper[data-popper-placement^=left] .v-popper__arrow-inner,.v-popper__popper[data-popper-placement^=left] .v-popper__arrow-outer{border-right-width:0;border-top-color:transparent!important;border-right-color:transparent!important;border-bottom-color:transparent!important}.v-popper__popper[data-popper-placement^=left] .v-popper__arrow-inner{left:-2px}.v-popper--theme-tooltip .v-popper__inner{background:rgba(0,0,0,.8);color:#fff;border-radius:6px;padding:7px 12px 6px}.v-popper--theme-tooltip .v-popper__arrow-outer{border-color:#000c}.v-popper--theme-dropdown .v-popper__inner{background:#fff;color:#000;border-radius:6px;border:1px solid #ddd;box-shadow:0 6px 30px #0000001a}.v-popper--theme-dropdown .v-popper__arrow-inner{visibility:visible;border-color:#fff}.v-popper--theme-dropdown .v-popper__arrow-outer{border-color:#ddd}
1911
1911
 
1912
- .selectinput[data-v-761f89bf] {
1912
+ .selectinput[data-v-4e1d2142] {
1913
1913
  width: 100%;
1914
1914
  }
1915
- .selectinput-option[data-v-761f89bf] {
1915
+ .selectinput-option[data-v-4e1d2142] {
1916
1916
  padding: 6px 12px;
1917
1917
  cursor: pointer;
1918
1918
  border-radius: 5px;
@@ -1923,14 +1923,14 @@ svg.leaflet-image-layer.leaflet-interactive path {
1923
1923
  width: 100%;
1924
1924
  font-size: var(--input-font-size);
1925
1925
  }
1926
- .selectinput-options[data-v-761f89bf] {
1926
+ .selectinput-options[data-v-4e1d2142] {
1927
1927
  max-height: 300px;
1928
1928
  overflow-y: auto;
1929
1929
  }
1930
- .selectinput-option[data-v-761f89bf]:hover {
1930
+ .selectinput-option[data-v-4e1d2142]:hover {
1931
1931
  background: var(--bgl-gray-20);
1932
1932
  }
1933
- .isEmpty p[data-v-761f89bf] {
1933
+ .isEmpty p[data-v-4e1d2142] {
1934
1934
  opacity: 0.3;
1935
1935
  }
1936
1936
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "0.0.566",
4
+ "version": "0.0.568",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { watch } from 'vue'
2
+ import { onMounted, watch } from 'vue'
3
3
  import { Dropdown } from 'floating-vue'
4
4
  import 'floating-vue/style.css'
5
5
  import {
@@ -27,6 +27,7 @@ const props = defineProps<{
27
27
  multiselect?: boolean
28
28
  icon?: MaterialIcons
29
29
  hideLabel?: boolean
30
+ defaultValue?: Option
30
31
  }>()
31
32
 
32
33
  const emit = defineEmits(['update:modelValue'])
@@ -47,8 +48,7 @@ function openOptions() {
47
48
 
48
49
  function updateOpen(visible: boolean) {
49
50
  open = visible
50
- if (!open) { search = ''
51
- }
51
+ if (!open) { search = '' }
52
52
  else {
53
53
  setTimeout(
54
54
  () => (searchInput as any)?.$el?.querySelector('input')?.focus(),
@@ -83,7 +83,7 @@ function getValue(option?: Option) {
83
83
  return option.value
84
84
  }
85
85
 
86
- const isSelected = (option: Option) => !!selectedItems.find(item => getValue(option) === getValue(item))
86
+ const isSelected = (option: Option) => selectedItems.find(item => getValue(option) === getValue(item)) !== undefined
87
87
 
88
88
  const filteredOptions = $computed(() => props.options.filter((option) => {
89
89
  const searchTerm = search
@@ -136,8 +136,7 @@ watch(
136
136
  () => props.modelValue,
137
137
  (newVal: Option | Option[]) => {
138
138
  if (!props.multiselect) {
139
- const newOption
140
- = props.options.find(o => getValue(o) === newVal) || newVal
139
+ const newOption = props.options.find(o => getValue(o) === newVal) ?? newVal
141
140
  if (newOption && !isSelected(newOption)) selectedItems = [newOption]
142
141
  } else {
143
142
  const isSame = compareArrays([newVal].flat(), selectedItems)
@@ -156,7 +155,7 @@ watch(
156
155
  const exists = props.options.find(
157
156
  o => getValue(o) === getValue(option),
158
157
  )
159
- if (!exists) selectedItems.splice(i, 1)
158
+ if (exists === undefined) selectedItems.splice(i, 1)
160
159
  else selectedItems.splice(i, 1, exists)
161
160
  })
162
161
  // const original = JSON.stringify(props.options.map(getValue));
@@ -165,6 +164,17 @@ watch(
165
164
  },
166
165
  { deep: true, immediate: true },
167
166
  )
167
+
168
+ onMounted(() => {
169
+ if (props.defaultValue !== undefined) {
170
+ const defaultOption = props.options.find(
171
+ o => getValue(o) === getValue(props.defaultValue),
172
+ )
173
+ if (defaultOption === undefined) return
174
+
175
+ selectedItems = [defaultOption]
176
+ }
177
+ })
168
178
  </script>
169
179
 
170
180
  <template>