@openmrs/esm-framework 3.3.2-pre.24 → 3.3.2-pre.30
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/.turbo/turbo-build.log +7 -7
- package/dist/openmrs-esm-framework.js +1 -1
- package/dist/openmrs-esm-framework.js.map +1 -1
- package/docs/API.md +47 -6
- package/package.json +13 -13
package/docs/API.md
CHANGED
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
- [inRange](API.md#inrange)
|
|
54
54
|
- [isUrl](API.md#isurl)
|
|
55
55
|
- [isUrlWithTemplateParameters](API.md#isurlwithtemplateparameters)
|
|
56
|
+
- [oneOf](API.md#oneof)
|
|
56
57
|
- [validator](API.md#validator)
|
|
57
58
|
|
|
58
59
|
### Date and Time Functions
|
|
@@ -590,10 +591,11 @@ ___
|
|
|
590
591
|
| `inRange` | (`min`: `number`, `max`: `number`) => [`Validator`](API.md#validator) |
|
|
591
592
|
| `isUrl` | [`Validator`](API.md#validator) |
|
|
592
593
|
| `isUrlWithTemplateParameters` | (`allowedTemplateParameters`: `string`[]) => [`Validator`](API.md#validator) |
|
|
594
|
+
| `oneOf` | (`allowedValues`: `any`[]) => [`Validator`](API.md#validator) |
|
|
593
595
|
|
|
594
596
|
#### Defined in
|
|
595
597
|
|
|
596
|
-
[packages/framework/esm-config/src/validators/validators.ts:
|
|
598
|
+
[packages/framework/esm-config/src/validators/validators.ts:69](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-config/src/validators/validators.ts#L69)
|
|
597
599
|
|
|
598
600
|
___
|
|
599
601
|
|
|
@@ -1667,24 +1669,63 @@ parameters, plus any specified in `allowedTemplateParameters`.
|
|
|
1667
1669
|
|
|
1668
1670
|
___
|
|
1669
1671
|
|
|
1672
|
+
### oneOf
|
|
1673
|
+
|
|
1674
|
+
▸ `Const` **oneOf**(`allowedValues`): [`Validator`](API.md#validator)
|
|
1675
|
+
|
|
1676
|
+
Verifies that the value is one of the allowed options.
|
|
1677
|
+
|
|
1678
|
+
#### Parameters
|
|
1679
|
+
|
|
1680
|
+
| Name | Type | Description |
|
|
1681
|
+
| :------ | :------ | :------ |
|
|
1682
|
+
| `allowedValues` | `any`[] | The list of allowable values |
|
|
1683
|
+
|
|
1684
|
+
#### Returns
|
|
1685
|
+
|
|
1686
|
+
[`Validator`](API.md#validator)
|
|
1687
|
+
|
|
1688
|
+
#### Defined in
|
|
1689
|
+
|
|
1690
|
+
[packages/framework/esm-config/src/validators/validators.ts:62](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-config/src/validators/validators.ts#L62)
|
|
1691
|
+
|
|
1692
|
+
___
|
|
1693
|
+
|
|
1670
1694
|
### validator
|
|
1671
1695
|
|
|
1672
1696
|
▸ **validator**(`validationFunction`, `message`): [`Validator`](API.md#validator)
|
|
1673
1697
|
|
|
1698
|
+
Constructs a custom validator.
|
|
1699
|
+
|
|
1700
|
+
### Example
|
|
1701
|
+
|
|
1702
|
+
```typescript
|
|
1703
|
+
{
|
|
1704
|
+
foo: {
|
|
1705
|
+
_default: 0,
|
|
1706
|
+
_validators: [
|
|
1707
|
+
validator(val => val >= 0, "Must not be negative.")
|
|
1708
|
+
]
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
```
|
|
1712
|
+
|
|
1674
1713
|
#### Parameters
|
|
1675
1714
|
|
|
1676
|
-
| Name | Type |
|
|
1677
|
-
| :------ | :------ |
|
|
1678
|
-
| `validationFunction` | [`ValidatorFunction`](API.md#validatorfunction) |
|
|
1679
|
-
| `message` | `string` |
|
|
1715
|
+
| Name | Type | Description |
|
|
1716
|
+
| :------ | :------ | :------ |
|
|
1717
|
+
| `validationFunction` | [`ValidatorFunction`](API.md#validatorfunction) | Takes the configured value as input. Returns true if it is valid, false otherwise. |
|
|
1718
|
+
| `message` | `string` \| (`value`: `any`) => `string` | A string message that explains why the value is invalid. Can also be a function that takes the value as input and returns a string. |
|
|
1680
1719
|
|
|
1681
1720
|
#### Returns
|
|
1682
1721
|
|
|
1683
1722
|
[`Validator`](API.md#validator)
|
|
1684
1723
|
|
|
1724
|
+
A validator ready for use in a config schema
|
|
1725
|
+
|
|
1685
1726
|
#### Defined in
|
|
1686
1727
|
|
|
1687
|
-
[packages/framework/esm-config/src/validators/validator.ts:
|
|
1728
|
+
[packages/framework/esm-config/src/validators/validator.ts:25](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-config/src/validators/validator.ts#L25)
|
|
1688
1729
|
|
|
1689
1730
|
___
|
|
1690
1731
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-framework",
|
|
3
|
-
"version": "3.3.2-pre.
|
|
3
|
+
"version": "3.3.2-pre.30",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"browser": "dist/openmrs-esm-framework.js",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -35,18 +35,18 @@
|
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@openmrs/esm-api": "^3.3.2-pre.
|
|
39
|
-
"@openmrs/esm-breadcrumbs": "^3.3.2-pre.
|
|
40
|
-
"@openmrs/esm-config": "^3.3.2-pre.
|
|
41
|
-
"@openmrs/esm-error-handling": "^3.3.2-pre.
|
|
42
|
-
"@openmrs/esm-extensions": "^3.3.2-pre.
|
|
43
|
-
"@openmrs/esm-globals": "^3.3.2-pre.
|
|
44
|
-
"@openmrs/esm-offline": "^3.3.2-pre.
|
|
45
|
-
"@openmrs/esm-react-utils": "^3.3.2-pre.
|
|
46
|
-
"@openmrs/esm-state": "^3.3.2-pre.
|
|
47
|
-
"@openmrs/esm-styleguide": "^3.3.2-pre.
|
|
48
|
-
"@openmrs/esm-utils": "^3.3.2-pre.
|
|
38
|
+
"@openmrs/esm-api": "^3.3.2-pre.30",
|
|
39
|
+
"@openmrs/esm-breadcrumbs": "^3.3.2-pre.30",
|
|
40
|
+
"@openmrs/esm-config": "^3.3.2-pre.30",
|
|
41
|
+
"@openmrs/esm-error-handling": "^3.3.2-pre.30",
|
|
42
|
+
"@openmrs/esm-extensions": "^3.3.2-pre.30",
|
|
43
|
+
"@openmrs/esm-globals": "^3.3.2-pre.30",
|
|
44
|
+
"@openmrs/esm-offline": "^3.3.2-pre.30",
|
|
45
|
+
"@openmrs/esm-react-utils": "^3.3.2-pre.30",
|
|
46
|
+
"@openmrs/esm-state": "^3.3.2-pre.30",
|
|
47
|
+
"@openmrs/esm-styleguide": "^3.3.2-pre.30",
|
|
48
|
+
"@openmrs/esm-utils": "^3.3.2-pre.30",
|
|
49
49
|
"dayjs": "^1.10.7"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "e22c9bb85f1d58ac6090e680099f501d31c63158"
|
|
52
52
|
}
|