aport-tools 4.4.24 → 4.4.26
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/forms/InputAttach.d.ts +6 -0
- package/dist/index.esm.js +20 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +20 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! aport-tools v4.4.
|
1
|
+
/*! aport-tools v4.4.26 | ISC */
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
var React = require('react');
|
@@ -1162,13 +1162,25 @@ var InputAttach = function InputAttach(_a) {
|
|
1162
1162
|
_d = _a.disabled,
|
1163
1163
|
disabled = _d === void 0 ? false : _d,
|
1164
1164
|
_e = _a.placeholder,
|
1165
|
-
placeholder = _e === void 0 ? "Upload an image" : _e
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1165
|
+
placeholder = _e === void 0 ? "Upload an image" : _e,
|
1166
|
+
_f = _a.firstValue,
|
1167
|
+
firstValue = _f === void 0 ? [] : _f;
|
1168
|
+
var _g = useFormContext(),
|
1169
|
+
setFormValue = _g.setFormValue,
|
1170
|
+
formErrors = _g.errors;
|
1171
|
+
var _h = React.useState([]),
|
1172
|
+
selectedFiles = _h[0],
|
1173
|
+
setSelectedFiles = _h[1];
|
1174
|
+
// Ref to track initialization
|
1175
|
+
var isInitialized = React.useRef(false);
|
1176
|
+
// Sync firstValue with selectedFiles when it changes
|
1177
|
+
React.useEffect(function () {
|
1178
|
+
if (!isInitialized.current) {
|
1179
|
+
setSelectedFiles(firstValue);
|
1180
|
+
setFormValue(name, firstValue); // Update form context
|
1181
|
+
isInitialized.current = true;
|
1182
|
+
}
|
1183
|
+
}, [firstValue, name, setFormValue]);
|
1172
1184
|
var theme = React.useContext(aportThemes.ThemeContext).theme;
|
1173
1185
|
var colors = theme.colors;
|
1174
1186
|
var pickImage = function pickImage() {
|