vueless 0.0.369 → 0.0.371

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,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.369",
3
+ "version": "0.0.371",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -47,7 +47,6 @@ import { computed, ref, watch, onMounted, nextTick, useId } from "vue";
47
47
  import { getDefault } from "../utils/utilUI.js";
48
48
 
49
49
  import UInput from "../ui.form-input/UInput.vue";
50
- import { SYMBOL_MINUS } from "../ui.text-money/constants.js";
51
50
 
52
51
  import defaultConfig from "./config.js";
53
52
  import useAttrs from "./useAttrs.js";
@@ -179,19 +178,11 @@ const props = defineProps({
179
178
  },
180
179
 
181
180
  /**
182
- * Show prefix in the raw value number.
181
+ * Prefix to display before input value.
183
182
  */
184
- rawValuePrefix: {
185
- type: Boolean,
186
- default: getDefault(defaultConfig, UInputMoney).rawValuePrefix,
187
- },
188
-
189
- /**
190
- * Show minus sign.
191
- */
192
- minus: {
193
- type: Boolean,
194
- default: getDefault(defaultConfig, UInputMoney).minus,
183
+ prefix: {
184
+ type: String,
185
+ default: getDefault(defaultConfig, UInputMoney).prefix,
195
186
  },
196
187
 
197
188
  /**
@@ -249,8 +240,7 @@ const { formattedValue, rawValue, setValue } = useFormatCurrency(`#${elementId}`
249
240
  decimalSeparator: props.decimalSeparator,
250
241
  thousandsSeparator: props.thousandsSeparator,
251
242
  positiveOnly: props.positiveOnly,
252
- rawValuePrefix: props.rawValuePrefix,
253
- prefix: props.minus ? SYMBOL_MINUS : "",
243
+ prefix: props.prefix,
254
244
  }));
255
245
 
256
246
  const localValue = computed({
@@ -8,9 +8,8 @@ export default /*tw*/ {
8
8
  decimalSeparator: ",",
9
9
  thousandsSeparator: " ",
10
10
  labelAlign: "topInside",
11
+ prefix: "",
11
12
  positiveOnly: false,
12
- rawValuePrefix: false,
13
- minus: false,
14
13
  readonly: false,
15
14
  disabled: false,
16
15
  },
@@ -92,14 +92,11 @@ DecimalSeparator.args = { decimalSeparator: "." };
92
92
  export const ThousandsSeparator = DefaultTemplate.bind({});
93
93
  ThousandsSeparator.args = { thousandsSeparator: "-" };
94
94
 
95
- export const RawValuePrefix = DefaultTemplate.bind({});
96
- RawValuePrefix.args = { rawValuePrefix: true };
97
-
98
95
  export const PositiveOnly = DefaultTemplate.bind({});
99
96
  PositiveOnly.args = { positiveOnly: true };
100
97
 
101
- export const Minus = DefaultTemplate.bind({});
102
- Minus.args = { minus: true };
98
+ export const Prefix = DefaultTemplate.bind({});
99
+ Prefix.args = { prefix: "+" };
103
100
 
104
101
  export const ReadOnly = DefaultTemplate.bind({});
105
102
  ReadOnly.args = { readOnly: true };
@@ -4,7 +4,7 @@ export default class FormatService {
4
4
  static comma = ",";
5
5
 
6
6
  static getRawValue(value, options) {
7
- const { thousandsSeparator, decimalSeparator, rawValuePrefix, prefix } = options;
7
+ const { thousandsSeparator, decimalSeparator, prefix } = options;
8
8
 
9
9
  value = String(value).endsWith(decimalSeparator)
10
10
  ? String(value).replace(decimalSeparator, "")
@@ -14,7 +14,7 @@ export default class FormatService {
14
14
  .replaceAll(thousandsSeparator, "")
15
15
  .replace(decimalSeparator, ".");
16
16
 
17
- return rawValuePrefix ? rawValueWithPrefix : rawValueWithPrefix.replace(prefix, "");
17
+ return rawValueWithPrefix.replace(prefix, "");
18
18
  }
19
19
 
20
20
  static getFormattedValue(value, options) {
@@ -568,7 +568,7 @@ const emit = defineEmits([
568
568
  "addOption",
569
569
 
570
570
  /**
571
- * Triggers when label position is changed.
571
+ * Triggers when the user commits the change to options or selected value explicitly.
572
572
  */
573
573
  "change",
574
574
  ]);
@@ -664,6 +664,7 @@ const dropdownValue = computed({
664
664
  }
665
665
 
666
666
  emit("update:modelValue", value);
667
+ emit("change", { value, options: props.options });
667
668
  deactivate();
668
669
  },
669
670
  });
@@ -727,15 +728,12 @@ const isLocalValue = computed(() => {
727
728
  : Boolean(String(localValue.value));
728
729
  });
729
730
 
730
- watch(search, () => onSearchChange);
731
- watch(
732
- localValue,
733
- () => {
734
- setLabelPosition();
735
- emit("change");
736
- },
737
- { deep: true },
738
- );
731
+ const onSearchChange = debounce(function (query) {
732
+ emit("searchChange", query);
733
+ }, 300);
734
+
735
+ watch(search, onSearchChange);
736
+ watch(localValue, setLabelPosition, { deep: true });
739
737
 
740
738
  if (props.addOption) {
741
739
  document.addEventListener("keydown", onKeydownAddOption);
@@ -743,10 +741,6 @@ if (props.addOption) {
743
741
 
744
742
  onMounted(setLabelPosition);
745
743
 
746
- const onSearchChange = debounce(async function (query) {
747
- emit("searchChange", query);
748
- }, 300);
749
-
750
744
  function getOptionLabel(option) {
751
745
  if (!option) return "";
752
746
 
@@ -762,10 +756,12 @@ function onKeydownAddOption(event) {
762
756
 
763
757
  if (isMeta && isEnter && isMac) {
764
758
  emit("addOption");
759
+ emit("change", { value: dropdownValue.value, options: props.options });
765
760
  }
766
761
 
767
762
  if (isEnter && isCtrl && !isMac) {
768
763
  emit("addOption");
764
+ emit("change", { value: dropdownValue.value, options: props.options });
769
765
  }
770
766
  }
771
767
 
@@ -851,6 +847,7 @@ function removeElement(option, shouldClose = true) {
851
847
  }
852
848
 
853
849
  emit("update:modelValue", value);
850
+ emit("change", { value, options: props.options });
854
851
  emit("remove", option, elementId);
855
852
 
856
853
  if (shouldClose) {
@@ -3,5 +3,3 @@
3
3
  `defineProps` is referencing locally declared variables. (vue/valid-define-props)
4
4
  */
5
5
  export const UMoney = "UMoney";
6
- export const SYMBOL_MINUS = "–";
7
- export const SYMBOL_PLUS = "+";
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.369",
4
+ "version": "0.0.371",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -4971,22 +4971,13 @@
4971
4971
  "default": "false"
4972
4972
  },
4973
4973
  {
4974
- "name": "rawValuePrefix",
4975
- "description": "Show prefix in the raw value number.",
4974
+ "name": "prefix",
4975
+ "description": "Prefix to display before input value.",
4976
4976
  "value": {
4977
4977
  "kind": "expression",
4978
- "type": "boolean"
4979
- },
4980
- "default": "false"
4981
- },
4982
- {
4983
- "name": "minus",
4984
- "description": "Show minus sign.",
4985
- "value": {
4986
- "kind": "expression",
4987
- "type": "boolean"
4978
+ "type": "string"
4988
4979
  },
4989
- "default": "false"
4980
+ "default": ""
4990
4981
  },
4991
4982
  {
4992
4983
  "name": "readonly",
@@ -7683,7 +7674,7 @@
7683
7674
  },
7684
7675
  {
7685
7676
  "name": "change",
7686
- "description": "Triggers when label position is changed."
7677
+ "description": "Triggers when the user commits the change to options or selected value explicitly."
7687
7678
  }
7688
7679
  ],
7689
7680
  "slots": [