@onehat/ui 0.3.319 → 0.3.321
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
|
@@ -273,7 +273,7 @@ export default function withFilters(WrappedComponent) {
|
|
|
273
273
|
type: filterType,
|
|
274
274
|
title,
|
|
275
275
|
} = filter;
|
|
276
|
-
|
|
276
|
+
|
|
277
277
|
if (!title) {
|
|
278
278
|
const propertyDef = Repository.getSchema().getPropertyDefinition(field);
|
|
279
279
|
title = propertyDef?.title;
|
|
@@ -282,7 +282,8 @@ export default function withFilters(WrappedComponent) {
|
|
|
282
282
|
if (_.isString(filterType)) {
|
|
283
283
|
if (filterType === FILTER_TYPE_ANCILLARY) {
|
|
284
284
|
title = modelFilterTypes[field].title;
|
|
285
|
-
|
|
285
|
+
const tagOrCombo = Repository.schema.model.ancillaryFiltersThatUseTags && inArray(field, Repository.schema.model.ancillaryFiltersThatUseTags) ? 'Tag' : 'Combo';
|
|
286
|
+
filterType = Inflector.camelize(Inflector.pluralize(field)) + tagOrCombo; // Convert field to PluralCamelCombo
|
|
286
287
|
}
|
|
287
288
|
Element = getComponentFromType(filterType);
|
|
288
289
|
if (filterType === 'Input') {
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
+
import _ from 'lodash';
|
|
2
3
|
|
|
3
|
-
export default function json() {
|
|
4
|
+
export default function json(isRequired = false) {
|
|
4
5
|
return yup.mixed().test(
|
|
5
6
|
'is-json',
|
|
6
7
|
'${path} is not valid JSON',
|
|
7
8
|
value => {
|
|
8
9
|
try {
|
|
9
|
-
JSON.parse(value);
|
|
10
|
-
|
|
10
|
+
const json = JSON.parse(value);
|
|
11
|
+
// Valid JSON
|
|
12
|
+
if (isRequired && _.isEmpty(json)) {
|
|
13
|
+
return false; // Empty JSON
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
11
16
|
} catch (error) {
|
|
12
17
|
return false; // Invalid JSON
|
|
13
18
|
}
|