@conform-to/dom 1.2.1 → 1.2.2
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/form.js +7 -5
- package/form.mjs +7 -5
- package/package.json +1 -1
package/form.js
CHANGED
|
@@ -22,7 +22,9 @@ function createFormMeta(options, initialized) {
|
|
|
22
22
|
value: initialValue,
|
|
23
23
|
constraint: (_options$constraint = options.constraint) !== null && _options$constraint !== void 0 ? _options$constraint : {},
|
|
24
24
|
validated: (_lastResult$state$val = lastResult === null || lastResult === void 0 || (_lastResult$state = lastResult.state) === null || _lastResult$state === void 0 ? void 0 : _lastResult$state.validated) !== null && _lastResult$state$val !== void 0 ? _lastResult$state$val : {},
|
|
25
|
-
key: getDefaultKey(defaultValue)
|
|
25
|
+
key: !initialized ? getDefaultKey(defaultValue) : _rollupPluginBabelHelpers.objectSpread2({
|
|
26
|
+
'': util.generateId()
|
|
27
|
+
}, getDefaultKey(defaultValue)),
|
|
26
28
|
// The `lastResult` should comes from the server which we won't expect the error to be null
|
|
27
29
|
// We can consider adding a warning if it happens
|
|
28
30
|
error: (_ref = lastResult === null || lastResult === void 0 ? void 0 : lastResult.error) !== null && _ref !== void 0 ? _ref : {}
|
|
@@ -41,9 +43,7 @@ function getDefaultKey(defaultValue, prefix) {
|
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
return result;
|
|
44
|
-
}, {
|
|
45
|
-
[prefix !== null && prefix !== void 0 ? prefix : '']: util.generateId()
|
|
46
|
-
});
|
|
46
|
+
}, {});
|
|
47
47
|
}
|
|
48
48
|
function setFieldsValidated(meta, fields) {
|
|
49
49
|
for (var _name of Object.keys(meta.error).concat(fields !== null && fields !== void 0 ? fields : [])) {
|
|
@@ -147,7 +147,9 @@ function updateValue(meta, name, value) {
|
|
|
147
147
|
if (name === '') {
|
|
148
148
|
meta.initialValue = value;
|
|
149
149
|
meta.value = value;
|
|
150
|
-
meta.key = getDefaultKey(value)
|
|
150
|
+
meta.key = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, getDefaultKey(value)), {}, {
|
|
151
|
+
'': util.generateId()
|
|
152
|
+
});
|
|
151
153
|
return;
|
|
152
154
|
}
|
|
153
155
|
meta.initialValue = util.clone(meta.initialValue);
|
package/form.mjs
CHANGED
|
@@ -18,7 +18,9 @@ function createFormMeta(options, initialized) {
|
|
|
18
18
|
value: initialValue,
|
|
19
19
|
constraint: (_options$constraint = options.constraint) !== null && _options$constraint !== void 0 ? _options$constraint : {},
|
|
20
20
|
validated: (_lastResult$state$val = lastResult === null || lastResult === void 0 || (_lastResult$state = lastResult.state) === null || _lastResult$state === void 0 ? void 0 : _lastResult$state.validated) !== null && _lastResult$state$val !== void 0 ? _lastResult$state$val : {},
|
|
21
|
-
key: getDefaultKey(defaultValue)
|
|
21
|
+
key: !initialized ? getDefaultKey(defaultValue) : _objectSpread2({
|
|
22
|
+
'': generateId()
|
|
23
|
+
}, getDefaultKey(defaultValue)),
|
|
22
24
|
// The `lastResult` should comes from the server which we won't expect the error to be null
|
|
23
25
|
// We can consider adding a warning if it happens
|
|
24
26
|
error: (_ref = lastResult === null || lastResult === void 0 ? void 0 : lastResult.error) !== null && _ref !== void 0 ? _ref : {}
|
|
@@ -37,9 +39,7 @@ function getDefaultKey(defaultValue, prefix) {
|
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
return result;
|
|
40
|
-
}, {
|
|
41
|
-
[prefix !== null && prefix !== void 0 ? prefix : '']: generateId()
|
|
42
|
-
});
|
|
42
|
+
}, {});
|
|
43
43
|
}
|
|
44
44
|
function setFieldsValidated(meta, fields) {
|
|
45
45
|
for (var _name of Object.keys(meta.error).concat(fields !== null && fields !== void 0 ? fields : [])) {
|
|
@@ -143,7 +143,9 @@ function updateValue(meta, name, value) {
|
|
|
143
143
|
if (name === '') {
|
|
144
144
|
meta.initialValue = value;
|
|
145
145
|
meta.value = value;
|
|
146
|
-
meta.key = getDefaultKey(value)
|
|
146
|
+
meta.key = _objectSpread2(_objectSpread2({}, getDefaultKey(value)), {}, {
|
|
147
|
+
'': generateId()
|
|
148
|
+
});
|
|
147
149
|
return;
|
|
148
150
|
}
|
|
149
151
|
meta.initialValue = clone(meta.initialValue);
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "A set of opinionated helpers built on top of the Constraint Validation API",
|
|
4
4
|
"homepage": "https://conform.guide",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "1.2.
|
|
6
|
+
"version": "1.2.2",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"module": "index.mjs",
|
|
9
9
|
"types": "index.d.ts",
|