quasar 2.18.3 → 2.18.4
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/dist/api/QField.json +1 -1
- package/dist/api/QFile.json +1 -1
- package/dist/api/QInput.json +1 -1
- package/dist/api/QSelect.json +1 -1
- package/dist/icon-set/bootstrap-icons.umd.prod.js +1 -1
- package/dist/icon-set/eva-icons.umd.prod.js +1 -1
- package/dist/icon-set/fontawesome-v5-pro.umd.prod.js +1 -1
- package/dist/icon-set/fontawesome-v5.umd.prod.js +1 -1
- package/dist/icon-set/fontawesome-v6-pro.umd.prod.js +1 -1
- package/dist/icon-set/fontawesome-v6.umd.prod.js +1 -1
- package/dist/icon-set/ionicons-v4.umd.prod.js +1 -1
- package/dist/icon-set/line-awesome.umd.prod.js +1 -1
- package/dist/icon-set/material-icons-outlined.umd.prod.js +1 -1
- package/dist/icon-set/material-icons-round.umd.prod.js +1 -1
- package/dist/icon-set/material-icons-sharp.umd.prod.js +1 -1
- package/dist/icon-set/material-icons.umd.prod.js +1 -1
- package/dist/icon-set/material-symbols-outlined.umd.prod.js +1 -1
- package/dist/icon-set/material-symbols-rounded.umd.prod.js +1 -1
- package/dist/icon-set/material-symbols-sharp.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v3.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v4.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v5.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v6.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v7.umd.prod.js +1 -1
- package/dist/icon-set/svg-bootstrap-icons.umd.prod.js +1 -1
- package/dist/icon-set/svg-eva-icons.umd.prod.js +1 -1
- package/dist/icon-set/svg-fontawesome-v5.umd.prod.js +1 -1
- package/dist/icon-set/svg-fontawesome-v6.umd.prod.js +1 -1
- package/dist/icon-set/svg-ionicons-v4.umd.prod.js +1 -1
- package/dist/icon-set/svg-ionicons-v5.umd.prod.js +1 -1
- package/dist/icon-set/svg-ionicons-v6.umd.prod.js +1 -1
- package/dist/icon-set/svg-line-awesome.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons-outlined.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons-round.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons-sharp.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-symbols-outlined.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-symbols-rounded.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-symbols-sharp.umd.prod.js +1 -1
- package/dist/icon-set/svg-mdi-v6.umd.prod.js +1 -1
- package/dist/icon-set/svg-mdi-v7.umd.prod.js +1 -1
- package/dist/icon-set/svg-themify.umd.prod.js +1 -1
- package/dist/icon-set/themify.umd.prod.js +1 -1
- package/dist/lang/ar-TN.umd.prod.js +1 -1
- package/dist/lang/ar.umd.prod.js +1 -1
- package/dist/lang/az-Latn.umd.prod.js +1 -1
- package/dist/lang/bg.umd.prod.js +1 -1
- package/dist/lang/bn.umd.prod.js +1 -1
- package/dist/lang/bs-BA.umd.prod.js +1 -1
- package/dist/lang/ca.umd.prod.js +1 -1
- package/dist/lang/cs.umd.prod.js +1 -1
- package/dist/lang/da.umd.prod.js +1 -1
- package/dist/lang/de-CH.umd.prod.js +1 -1
- package/dist/lang/de-DE.umd.prod.js +1 -1
- package/dist/lang/de.umd.prod.js +1 -1
- package/dist/lang/el.umd.prod.js +1 -1
- package/dist/lang/en-GB.umd.prod.js +1 -1
- package/dist/lang/en-US.umd.prod.js +1 -1
- package/dist/lang/eo.umd.prod.js +1 -1
- package/dist/lang/es.umd.prod.js +1 -1
- package/dist/lang/et.umd.prod.js +1 -1
- package/dist/lang/eu.umd.prod.js +1 -1
- package/dist/lang/fa-IR.umd.prod.js +1 -1
- package/dist/lang/fa.umd.prod.js +1 -1
- package/dist/lang/fi.umd.prod.js +1 -1
- package/dist/lang/fr.umd.prod.js +1 -1
- package/dist/lang/gn.umd.prod.js +1 -1
- package/dist/lang/he.umd.prod.js +1 -1
- package/dist/lang/hi.umd.prod.js +1 -1
- package/dist/lang/hr.umd.prod.js +1 -1
- package/dist/lang/hu.umd.prod.js +1 -1
- package/dist/lang/id.umd.prod.js +1 -1
- package/dist/lang/is.umd.prod.js +1 -1
- package/dist/lang/it.umd.prod.js +1 -1
- package/dist/lang/ja.umd.prod.js +1 -1
- package/dist/lang/kk.umd.prod.js +1 -1
- package/dist/lang/km.umd.prod.js +1 -1
- package/dist/lang/ko-KR.umd.prod.js +1 -1
- package/dist/lang/kur-CKB.umd.prod.js +1 -1
- package/dist/lang/lt.umd.prod.js +1 -1
- package/dist/lang/lu.umd.prod.js +1 -1
- package/dist/lang/lv.umd.prod.js +1 -1
- package/dist/lang/mk.umd.prod.js +1 -1
- package/dist/lang/ml.umd.prod.js +1 -1
- package/dist/lang/mm.umd.prod.js +1 -1
- package/dist/lang/ms-MY.umd.prod.js +1 -1
- package/dist/lang/ms.umd.prod.js +1 -1
- package/dist/lang/my.umd.prod.js +1 -1
- package/dist/lang/nb-NO.umd.prod.js +1 -1
- package/dist/lang/nl.umd.prod.js +1 -1
- package/dist/lang/pl.umd.prod.js +1 -1
- package/dist/lang/pt-BR.umd.prod.js +1 -1
- package/dist/lang/pt.umd.prod.js +1 -1
- package/dist/lang/ro.umd.prod.js +1 -1
- package/dist/lang/ru.umd.prod.js +1 -1
- package/dist/lang/sk.umd.prod.js +1 -1
- package/dist/lang/sl.umd.prod.js +1 -1
- package/dist/lang/sm.umd.prod.js +1 -1
- package/dist/lang/sq.umd.prod.js +1 -1
- package/dist/lang/sr-CYR.umd.prod.js +1 -1
- package/dist/lang/sr.umd.prod.js +1 -1
- package/dist/lang/sv.umd.prod.js +1 -1
- package/dist/lang/ta.umd.prod.js +1 -1
- package/dist/lang/th.umd.prod.js +1 -1
- package/dist/lang/tl.umd.prod.js +1 -1
- package/dist/lang/tr.umd.prod.js +1 -1
- package/dist/lang/ug.umd.prod.js +1 -1
- package/dist/lang/uk.umd.prod.js +1 -1
- package/dist/lang/ur-PK.umd.prod.js +1 -1
- package/dist/lang/uz-Cyrl.umd.prod.js +1 -1
- package/dist/lang/uz-Latn.umd.prod.js +1 -1
- package/dist/lang/vi.umd.prod.js +1 -1
- package/dist/lang/zh-CN.umd.prod.js +1 -1
- package/dist/lang/zh-TW.umd.prod.js +1 -1
- package/dist/quasar.client.js +390 -361
- package/dist/quasar.sass +1 -1
- package/dist/quasar.server.prod.cjs +26 -26
- package/dist/quasar.server.prod.js +26 -26
- package/dist/quasar.umd.js +42 -13
- package/dist/quasar.umd.prod.js +29 -29
- package/dist/types/index.d.ts +26 -0
- package/dist/vetur/quasar-attributes.json +1 -1
- package/dist/vetur/quasar-tags.json +1 -1
- package/dist/web-types/web-types.json +1 -1
- package/package.json +1 -1
- package/src/components/input/use-mask.js +46 -13
- package/src/components/input/use-mask.json +55 -4
- package/src/composables/private.use-validate/use-validate.json +6 -6
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref, watch, nextTick } from 'vue'
|
|
1
|
+
import { ref, computed, watch, nextTick } from 'vue'
|
|
2
2
|
|
|
3
3
|
import { shouldIgnoreKey } from '../../utils/private.keyboard/key-composition.js'
|
|
4
4
|
|
|
@@ -12,7 +12,7 @@ const NAMED_MASKS = {
|
|
|
12
12
|
card: '#### #### #### ####'
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const { tokenMap: DEFAULT_TOKEN_MAP, tokenKeys: DEFAULT_TOKEN_MAP_KEYS } = getTokenMap({
|
|
16
16
|
'#': { pattern: '[\\d]', negate: '[^\\d]' },
|
|
17
17
|
|
|
18
18
|
S: { pattern: '[a-zA-Z]', negate: '[^a-zA-Z]' },
|
|
@@ -23,29 +23,62 @@ const TOKENS = {
|
|
|
23
23
|
|
|
24
24
|
X: { pattern: '[0-9a-zA-Z]', negate: '[^0-9a-zA-Z]', transform: v => v.toLocaleUpperCase() },
|
|
25
25
|
x: { pattern: '[0-9a-zA-Z]', negate: '[^0-9a-zA-Z]', transform: v => v.toLocaleLowerCase() }
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const KEYS = Object.keys(TOKENS)
|
|
29
|
-
KEYS.forEach(key => {
|
|
30
|
-
TOKENS[ key ].regex = new RegExp(TOKENS[ key ].pattern)
|
|
31
26
|
})
|
|
32
27
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
function getTokenMap (tokens) {
|
|
29
|
+
const tokenKeys = Object.keys(tokens)
|
|
30
|
+
const tokenMap = {}
|
|
31
|
+
|
|
32
|
+
tokenKeys.forEach(key => {
|
|
33
|
+
const entry = tokens[ key ]
|
|
34
|
+
tokenMap[ key ] = {
|
|
35
|
+
...entry,
|
|
36
|
+
regex: new RegExp(entry.pattern)
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
return { tokenMap, tokenKeys }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function getTokenRegexMask (keys) {
|
|
44
|
+
return new RegExp('\\\\([^.*+?^${}()|([\\]])|([.*+?^${}()|[\\]])|([' + keys.join('') + '])|(.)', 'g')
|
|
45
|
+
}
|
|
36
46
|
|
|
47
|
+
const escRegex = /[.*+?^${}()|[\]\\]/g
|
|
48
|
+
const DEFAULT_TOKEN_REGEX_MASK = getTokenRegexMask(DEFAULT_TOKEN_MAP_KEYS)
|
|
37
49
|
const MARKER = String.fromCharCode(1)
|
|
38
50
|
|
|
39
51
|
export const useMaskProps = {
|
|
40
52
|
mask: String,
|
|
41
53
|
reverseFillMask: Boolean,
|
|
42
54
|
fillMask: [ Boolean, String ],
|
|
43
|
-
unmaskedValue: Boolean
|
|
55
|
+
unmaskedValue: Boolean,
|
|
56
|
+
maskTokens: Object
|
|
44
57
|
}
|
|
45
58
|
|
|
46
59
|
export default function (props, emit, emitValue, inputRef) {
|
|
47
60
|
let maskMarked, maskReplaced, computedMask, computedUnmask, pastedTextStart, selectionAnchor
|
|
48
61
|
|
|
62
|
+
const tokens = computed(() => {
|
|
63
|
+
if (props.maskTokens === void 0 || props.maskTokens === null) {
|
|
64
|
+
return {
|
|
65
|
+
tokenMap: DEFAULT_TOKEN_MAP,
|
|
66
|
+
tokenRegexMask: DEFAULT_TOKEN_REGEX_MASK
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const { tokenMap: customTokens } = getTokenMap(props.maskTokens)
|
|
71
|
+
const tokenMap = {
|
|
72
|
+
...DEFAULT_TOKEN_MAP,
|
|
73
|
+
...customTokens
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
tokenMap,
|
|
78
|
+
tokenRegexMask: getTokenRegexMask(Object.keys(tokenMap))
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
|
|
49
82
|
const hasMask = ref(null)
|
|
50
83
|
const innerValue = ref(getInitialMaskedValue())
|
|
51
84
|
|
|
@@ -137,9 +170,9 @@ export default function (props, emit, emitValue, inputRef) {
|
|
|
137
170
|
unmaskChar = '',
|
|
138
171
|
negateChar = ''
|
|
139
172
|
|
|
140
|
-
localComputedMask.replace(tokenRegexMask, (_, char1, esc, token, char2) => {
|
|
173
|
+
localComputedMask.replace(tokens.value.tokenRegexMask, (_, char1, esc, token, char2) => {
|
|
141
174
|
if (token !== void 0) {
|
|
142
|
-
const c =
|
|
175
|
+
const c = tokens.value.tokenMap[ token ]
|
|
143
176
|
mask.push(c)
|
|
144
177
|
negateChar = c.negate
|
|
145
178
|
if (firstMatch === true) {
|
|
@@ -6,26 +6,77 @@
|
|
|
6
6
|
"examples": [
|
|
7
7
|
"'###-##'", "'date'", "'datetime'", "'time'", "'fulltime'", "'phone'", "'card'"
|
|
8
8
|
],
|
|
9
|
-
"category": "
|
|
9
|
+
"category": "mask"
|
|
10
10
|
},
|
|
11
11
|
|
|
12
12
|
"fill-mask": {
|
|
13
13
|
"type": [ "Boolean", "String" ],
|
|
14
14
|
"desc": "Fills string with specified characters (or underscore if value is not string) to fill mask's length",
|
|
15
15
|
"examples": [ "true", "'0'", "'_'" ],
|
|
16
|
-
"category": "
|
|
16
|
+
"category": "mask"
|
|
17
17
|
},
|
|
18
18
|
|
|
19
19
|
"reverse-fill-mask": {
|
|
20
20
|
"type": "Boolean",
|
|
21
21
|
"desc": "Fills string from the right side of the mask",
|
|
22
|
-
"category": "
|
|
22
|
+
"category": "mask"
|
|
23
23
|
},
|
|
24
24
|
|
|
25
25
|
"unmasked-value": {
|
|
26
26
|
"type": "Boolean",
|
|
27
27
|
"desc": "Model will be unmasked (won't contain tokens/separation characters)",
|
|
28
|
-
"category": "
|
|
28
|
+
"category": "mask"
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
"mask-tokens": {
|
|
32
|
+
"type": "Object",
|
|
33
|
+
"desc": "Object of custom mask tokens to be added on top of the default ones; Can also override any of the default ones",
|
|
34
|
+
"definition": {
|
|
35
|
+
"...tokenCharacter": {
|
|
36
|
+
"type": "Object",
|
|
37
|
+
"desc": "The definition for the current custom mask token",
|
|
38
|
+
"required": true,
|
|
39
|
+
"definition": {
|
|
40
|
+
"pattern": {
|
|
41
|
+
"type": "String",
|
|
42
|
+
"required": true,
|
|
43
|
+
"desc": "A string representing a regular expression to match against a single character",
|
|
44
|
+
"examples": [ "'[0-9]'", "'[a-zA-Z]'" ]
|
|
45
|
+
},
|
|
46
|
+
"negate": {
|
|
47
|
+
"type": "String",
|
|
48
|
+
"required": true,
|
|
49
|
+
"desc": "A string representing a regular expression to NOT match against a single character",
|
|
50
|
+
"examples": [ "'[^0-9]'", "'[^a-zA-Z]'" ]
|
|
51
|
+
},
|
|
52
|
+
"transform": {
|
|
53
|
+
"type": "Function",
|
|
54
|
+
"required": false,
|
|
55
|
+
"desc": "A function that takes the character as argument and returns the transformed character",
|
|
56
|
+
"examples": [ "v => v.toLocaleUpperCase()" ],
|
|
57
|
+
"params": {
|
|
58
|
+
"char": {
|
|
59
|
+
"type": "String",
|
|
60
|
+
"required": true,
|
|
61
|
+
"desc": "The character being transformed",
|
|
62
|
+
"examples": [ "'a'", "'1'" ]
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"returns": {
|
|
66
|
+
"type": "String",
|
|
67
|
+
"desc": "The transformed character"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"examples": [
|
|
72
|
+
"{ pattern: '[0-4a-eA-E]', negate: '[^0-4a-eA-E]', transform: v => v.toLocaleUpperCase() }",
|
|
73
|
+
"{ pattern: '[5-8]', negate: '[^5-8]' }"
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"examples": [ "{ C: { pattern: '[0-4a-eA-E]', negate: '[^0-4a-eA-E]', transform: v => v.toLocaleUpperCase() } }" ],
|
|
78
|
+
"category": "mask",
|
|
79
|
+
"addedIn": "v2.18.4"
|
|
29
80
|
}
|
|
30
81
|
}
|
|
31
82
|
}
|
|
@@ -10,20 +10,20 @@
|
|
|
10
10
|
"type": [ "Boolean", "null" ],
|
|
11
11
|
"default": "null",
|
|
12
12
|
"desc": "Does field have validation errors?",
|
|
13
|
-
"category": "
|
|
13
|
+
"category": "validation"
|
|
14
14
|
},
|
|
15
15
|
|
|
16
16
|
"error-message": {
|
|
17
17
|
"type": "String",
|
|
18
18
|
"desc": "Validation error message (gets displayed only if 'error' is set to 'true')",
|
|
19
19
|
"examples": [ "'Username must have at least 5 characters'" ],
|
|
20
|
-
"category": "
|
|
20
|
+
"category": "validation"
|
|
21
21
|
},
|
|
22
22
|
|
|
23
23
|
"no-error-icon": {
|
|
24
24
|
"type": "Boolean",
|
|
25
25
|
"desc": "Hide error icon when there is an error",
|
|
26
|
-
"category": "
|
|
26
|
+
"category": "validation"
|
|
27
27
|
},
|
|
28
28
|
|
|
29
29
|
"rules": {
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"[ 'fulltime' ]",
|
|
36
36
|
"[ (val, rules) => rules.email(val) || 'Please enter a valid email address' ]"
|
|
37
37
|
],
|
|
38
|
-
"category": "
|
|
38
|
+
"category": "validation"
|
|
39
39
|
},
|
|
40
40
|
|
|
41
41
|
"reactive-rules": {
|
|
42
42
|
"type": "Boolean",
|
|
43
43
|
"desc": "By default a change in the rules does not trigger a new validation until the model changes; If set to true then a change in the rules will trigger a validation; Has a performance penalty, so use it only when you really need it",
|
|
44
|
-
"category": "
|
|
44
|
+
"category": "validation"
|
|
45
45
|
},
|
|
46
46
|
|
|
47
47
|
"lazy-rules": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"desc": "If set to boolean true then it checks validation status against the 'rules' only after field loses focus for first time; If set to 'ondemand' then it will trigger only when component's validate() method is manually called or when the wrapper QForm submits itself",
|
|
50
50
|
"default": "false",
|
|
51
51
|
"values": [ "true", "false", "'ondemand'" ],
|
|
52
|
-
"category": "
|
|
52
|
+
"category": "validation"
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
|