@player-ui/common-types-plugin 0.3.1-next.1 → 0.3.1
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/common-types-plugin.dev.js +11347 -0
- package/dist/common-types-plugin.prod.js +2 -0
- package/dist/index.cjs.js +18 -3
- package/dist/index.d.ts +14 -2
- package/dist/index.esm.js +18 -3
- package/dist/xlr/BooleanType.json +72 -0
- package/dist/xlr/CollectionType.json +39 -0
- package/dist/xlr/DateType.json +55 -0
- package/dist/xlr/IntegerNNType.json +75 -0
- package/dist/xlr/IntegerPosType.json +75 -0
- package/dist/xlr/IntegerType.json +55 -0
- package/dist/xlr/PhoneType.json +55 -0
- package/dist/xlr/StringType.json +62 -0
- package/dist/xlr/manifest.js +21 -0
- package/dist/xlr/manifest.json +26 -0
- package/package.json +13 -4
- package/src/formats/utils.ts +25 -1
- package/src/index.ts +29 -2
- package/src/validators/index.ts +4 -2
package/src/validators/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Expression } from '@player-ui/types';
|
|
2
|
+
import { resolveDataRefs } from '@player-ui/player';
|
|
2
3
|
import type { ValidatorFunction } from '@player-ui/player';
|
|
3
4
|
|
|
4
5
|
// Shamelessly lifted from Scott Gonzalez via the Bassistance Validation plugin http://projects.scottsplayground.com/email_address_validation/
|
|
@@ -177,12 +178,13 @@ export const regex: ValidatorFunction<{
|
|
|
177
178
|
return;
|
|
178
179
|
}
|
|
179
180
|
|
|
181
|
+
const resolvedRegex = resolveDataRefs(options.regex, context);
|
|
180
182
|
// Split up /pattern/flags into [pattern, flags]
|
|
181
|
-
const patternMatch =
|
|
183
|
+
const patternMatch = resolvedRegex.match(/^\/(.*)\/(\w)*$/);
|
|
182
184
|
|
|
183
185
|
const regexp = patternMatch
|
|
184
186
|
? new RegExp(patternMatch[1], patternMatch[2])
|
|
185
|
-
: new RegExp(
|
|
187
|
+
: new RegExp(resolvedRegex);
|
|
186
188
|
|
|
187
189
|
if (!regexp.test(value)) {
|
|
188
190
|
const message = context.constants.getConstants(
|