@onehat/ui 0.3.75 → 0.3.76
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 +1 -1
- package/src/Components/Form/Form.js +12 -2
- package/src/Components/Hoc/withPdfButton.js +13 -9
- package/src/Components/Icons/Bookmark.js +20 -0
- package/src/Constants/AppStates.js +3 -0
- package/src/Constants/MimeTypes.js +2126 -0
- package/src/PlatformImports/Web/Attachments.js +7 -2
package/package.json
CHANGED
|
@@ -499,8 +499,18 @@ function Form(props) {
|
|
|
499
499
|
</Row>;
|
|
500
500
|
}
|
|
501
501
|
|
|
502
|
-
let
|
|
503
|
-
|
|
502
|
+
let isRequired = false,
|
|
503
|
+
requiredIndicator = null;
|
|
504
|
+
if (editorType === EDITOR_TYPE__PLAIN) {
|
|
505
|
+
// submitted validator
|
|
506
|
+
if (validator?.fields && validator.fields[name]?.exclusiveTests?.required) {
|
|
507
|
+
isRequired = true;
|
|
508
|
+
}
|
|
509
|
+
} else if (propertyDef?.validator?.spec && !propertyDef.validator.spec.optional) {
|
|
510
|
+
// property definition
|
|
511
|
+
isRequired = true;
|
|
512
|
+
}
|
|
513
|
+
if (isRequired) {
|
|
504
514
|
requiredIndicator = <Text color="#f00" fontSize="30px" pr={1}>*</Text>;
|
|
505
515
|
}
|
|
506
516
|
if (!disableLabels && label && editorType !== EDITOR_TYPE__INLINE) {
|
|
@@ -43,6 +43,7 @@ export default function withPdfButton(WrappedComponent) {
|
|
|
43
43
|
} = props,
|
|
44
44
|
[isModalShown, setIsModalShown] = useState(false),
|
|
45
45
|
[width, height] = useAdjustedWindowSize(500, 800),
|
|
46
|
+
propertyNames = [],
|
|
46
47
|
buildModalItems = () => {
|
|
47
48
|
const modalItems = _.map(_.cloneDeep(items), (item, ix) => buildNextLayer(item, ix, columnDefaults)); // clone, as we don't want to alter the item by reference
|
|
48
49
|
|
|
@@ -57,10 +58,8 @@ export default function withPdfButton(WrappedComponent) {
|
|
|
57
58
|
} else {
|
|
58
59
|
name = ancillaryItem.title;
|
|
59
60
|
}
|
|
60
|
-
if (!inArray(name, ['Photos', 'Videos', 'Files'])) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
61
|
name = 'ancillary___' + name;
|
|
62
|
+
propertyNames.push(name); // for validator
|
|
64
63
|
items.push({
|
|
65
64
|
title: ancillaryItem.title,
|
|
66
65
|
label: ancillaryItem.title,
|
|
@@ -77,6 +76,7 @@ export default function withPdfButton(WrappedComponent) {
|
|
|
77
76
|
items,
|
|
78
77
|
showToggleAllCheckbox: true,
|
|
79
78
|
isCollapsible: false,
|
|
79
|
+
ml: 3, // since it's not in a column, which normally adds pl: 3
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -112,14 +112,18 @@ export default function withPdfButton(WrappedComponent) {
|
|
|
112
112
|
item.title = propertyDef.title;
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
+
if (name) {
|
|
116
|
+
propertyNames.push(name); // for validator
|
|
117
|
+
}
|
|
115
118
|
item.type = 'Checkbox';
|
|
116
119
|
return item;
|
|
117
120
|
},
|
|
118
|
-
buildValidator = (
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
buildValidator = () => {
|
|
122
|
+
const propertyValidatorDefs = {};
|
|
123
|
+
_.each(propertyNames, (name) => {
|
|
124
|
+
propertyValidatorDefs[name] = yup.boolean().required();
|
|
125
|
+
});
|
|
126
|
+
return yup.object(propertyValidatorDefs);
|
|
123
127
|
},
|
|
124
128
|
getStartingValues = (modalItems) => {
|
|
125
129
|
const startingValues = {};
|
|
@@ -171,7 +175,7 @@ export default function withPdfButton(WrappedComponent) {
|
|
|
171
175
|
const
|
|
172
176
|
modalItems = buildModalItems(),
|
|
173
177
|
startingValues = getStartingValues(modalItems),
|
|
174
|
-
validator = buildValidator(
|
|
178
|
+
validator = buildValidator();
|
|
175
179
|
modal = <Modal
|
|
176
180
|
isOpen={true}
|
|
177
181
|
onClose={() => setIsModalShown(false)}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc.
|
|
2
|
+
import * as React from "react"
|
|
3
|
+
import Svg, { Path } from "react-native-svg"
|
|
4
|
+
import { Icon } from 'native-base';
|
|
5
|
+
|
|
6
|
+
function SvgComponent(props) {
|
|
7
|
+
return (
|
|
8
|
+
<Icon
|
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
+
height={16}
|
|
11
|
+
width={12}
|
|
12
|
+
viewBox="0 0 384 512"
|
|
13
|
+
{...props}
|
|
14
|
+
>
|
|
15
|
+
<Path d="M0 48v439.7C0 501.1 10.9 512 24.3 512c5 0 9.9-1.5 14-4.4L192 400l153.7 107.6c4.1 2.9 9 4.4 14 4.4 13.4 0 24.3-10.9 24.3-24.3V48c0-26.5-21.5-48-48-48H48C21.5 0 0 21.5 0 48z" />
|
|
16
|
+
</Icon>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default SvgComponent
|