dirk-cfx-react 1.1.50 → 1.1.51
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/hooks/index.cjs +17 -33
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.js +17 -33
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +17 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -33
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2069,7 +2069,7 @@ function createFormStore(initialValues, validationRules, onSubmit) {
|
|
|
2069
2069
|
const newValues = setNested(currentValues, path, value);
|
|
2070
2070
|
const oldValue = getNested(state.initialValues, path);
|
|
2071
2071
|
const hasChanged = value !== oldValue;
|
|
2072
|
-
history.push(currentValues);
|
|
2072
|
+
history.push({ values: currentValues, changed: new Set(changed) });
|
|
2073
2073
|
future.length = 0;
|
|
2074
2074
|
let newPartial = state.partialChanged;
|
|
2075
2075
|
if (hasChanged) {
|
|
@@ -2159,25 +2159,17 @@ function createFormStore(initialValues, validationRules, onSubmit) {
|
|
|
2159
2159
|
},
|
|
2160
2160
|
back: () => {
|
|
2161
2161
|
if (!history.length) return;
|
|
2162
|
-
const
|
|
2163
|
-
future.push(get().values);
|
|
2164
|
-
const initial = get().initialValues;
|
|
2165
|
-
let partial = {};
|
|
2162
|
+
const entry = history.pop();
|
|
2163
|
+
future.push({ values: get().values, changed: new Set(changed) });
|
|
2166
2164
|
changed.clear();
|
|
2167
|
-
const
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
for (const path of allKeys) {
|
|
2173
|
-
const val = getNested(prev, path);
|
|
2174
|
-
if (val !== getNested(initial, path)) {
|
|
2175
|
-
changed.add(path);
|
|
2176
|
-
partial = setNested(partial, path, val);
|
|
2177
|
-
}
|
|
2165
|
+
for (const f of entry.changed) changed.add(f);
|
|
2166
|
+
let partial = {};
|
|
2167
|
+
for (const path of changed) {
|
|
2168
|
+
const val = getNested(entry.values, path);
|
|
2169
|
+
partial = setNested(partial, path, val);
|
|
2178
2170
|
}
|
|
2179
2171
|
set({
|
|
2180
|
-
values:
|
|
2172
|
+
values: entry.values,
|
|
2181
2173
|
partialChanged: partial,
|
|
2182
2174
|
canBack: history.length > 0,
|
|
2183
2175
|
canForward: true,
|
|
@@ -2187,25 +2179,17 @@ function createFormStore(initialValues, validationRules, onSubmit) {
|
|
|
2187
2179
|
},
|
|
2188
2180
|
forward: () => {
|
|
2189
2181
|
if (!future.length) return;
|
|
2190
|
-
const
|
|
2191
|
-
history.push(get().values);
|
|
2192
|
-
const initial = get().initialValues;
|
|
2193
|
-
let partial = {};
|
|
2182
|
+
const entry = future.pop();
|
|
2183
|
+
history.push({ values: get().values, changed: new Set(changed) });
|
|
2194
2184
|
changed.clear();
|
|
2195
|
-
const
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
for (const path of allKeys) {
|
|
2201
|
-
const val = getNested(next, path);
|
|
2202
|
-
if (val !== getNested(initial, path)) {
|
|
2203
|
-
changed.add(path);
|
|
2204
|
-
partial = setNested(partial, path, val);
|
|
2205
|
-
}
|
|
2185
|
+
for (const f of entry.changed) changed.add(f);
|
|
2186
|
+
let partial = {};
|
|
2187
|
+
for (const path of changed) {
|
|
2188
|
+
const val = getNested(entry.values, path);
|
|
2189
|
+
partial = setNested(partial, path, val);
|
|
2206
2190
|
}
|
|
2207
2191
|
set({
|
|
2208
|
-
values:
|
|
2192
|
+
values: entry.values,
|
|
2209
2193
|
partialChanged: partial,
|
|
2210
2194
|
canBack: true,
|
|
2211
2195
|
canForward: future.length > 0,
|