@dative-gpi/foundation-shared-components 1.0.31 → 1.0.33

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.
@@ -43,13 +43,15 @@ export default defineComponent({
43
43
  emits: ["update:modelValue"],
44
44
  setup(_, { emit }) {
45
45
  const onUpdate = (value: string) => {
46
- const match = /([0-9 ]*[,.]?)?[0-9]+/.exec(value);
47
- if (match && !isNaN(parseFloat(match[0].replace(",", ".").replace(" ", "")))) {
48
- emit("update:modelValue", parseFloat(match[0].replace(",", ".").replace(" ", "")));
46
+ if (value === "-") {
47
+ return;
49
48
  }
50
- else {
51
- emit("update:modelValue", 0);
49
+ const match = /[-]?([0-9 ]*[,.]?)?[0-9]*/.exec(value);
50
+ if (match != null && !isNaN(parseFloat(match[0].replace(",", ".").replace(" ", "")))) {
51
+ emit("update:modelValue", parseFloat(match[0].replace(",", ".").replace(" ", "")));
52
+ return;
52
53
  }
54
+ emit("update:modelValue", 0);
53
55
  };
54
56
 
55
57
  return {
package/models/rules.ts CHANGED
@@ -31,7 +31,7 @@ export const TagRules = {
31
31
  };
32
32
 
33
33
  export const NumberRules = {
34
- required: (message: string | undefined = undefined) => (value: string) => (!!value && !isNaN(parseFloat(value))) || (message ?? $tr("ui.rules.required", "Required")),
34
+ required: (message: string | undefined = undefined) => (value: string) => (value != null && !isNaN(parseFloat(value))) || (message ?? $tr("ui.rules.required", "Required")),
35
35
  min: (min: number, message: string | undefined = undefined) => (value: string) => (!!value && !isNaN(parseFloat(value)) && parseFloat(value) >= min) || (message ?? $tr("ui.rules.number-min", "Must be at least {0}", min.toString())),
36
36
  max: (max: number, message: string | undefined = undefined) => (value: string) => (!!value && !isNaN(parseFloat(value)) && parseFloat(value) <= max) || (message ?? $tr("ui.rules.number-max", "Must be at most {0}", max.toString())),
37
37
  integer: (message: string | undefined = undefined) => (value: string) => (!!value && !isNaN(parseFloat(value)) && Number.isInteger(parseFloat(value))) || (message ?? $tr("ui.rules.number-integer", "Must be an integer"))
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-shared-components",
3
3
  "sideEffects": false,
4
- "version": "1.0.31",
4
+ "version": "1.0.33",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -10,8 +10,8 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "@dative-gpi/foundation-shared-domain": "1.0.31",
14
- "@dative-gpi/foundation-shared-services": "1.0.31"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.33",
14
+ "@dative-gpi/foundation-shared-services": "1.0.33"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "@dative-gpi/bones-ui": "^0.0.75",
@@ -35,5 +35,5 @@
35
35
  "sass": "1.71.1",
36
36
  "sass-loader": "13.3.2"
37
37
  },
38
- "gitHead": "ea23a4b514a19e238373a52d9dd99b24c17adf1c"
38
+ "gitHead": "df28d1c192793f3ab75ae910d17ea0457bd54c84"
39
39
  }