@zat-design/sisyphus-react 3.9.4-beta.1 → 3.9.4-beta.3
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/coverage/lcov-report/src/.umi/core/devScripts.ts.html +241 -0
- package/coverage/lcov-report/src/.umi/core/history.ts.html +148 -0
- package/coverage/lcov-report/src/.umi/core/index.html +206 -0
- package/coverage/lcov-report/src/.umi/core/plugin.ts.html +109 -0
- package/coverage/lcov-report/src/.umi/core/pluginRegister.ts.html +160 -0
- package/coverage/lcov-report/src/.umi/core/polyfill.ts.html +97 -0
- package/coverage/lcov-report/src/.umi/core/routes.ts.html +26050 -0
- package/coverage/lcov-report/src/.umi/core/umiExports.ts.html +112 -0
- package/coverage/lcov-report/src/.umi/dumi/demos/index.html +116 -0
- package/coverage/lcov-report/src/.umi/dumi/demos/index.ts.html +6340 -0
- package/coverage/lcov-report/src/.umi/dumi/index.html +116 -0
- package/coverage/lcov-report/src/.umi/dumi/layout.tsx.html +109 -0
- package/coverage/lcov-report/src/.umi/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-antd/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-antd/runtime.tsx.html +172 -0
- package/coverage/lcov-report/src/.umi/plugin-helmet/exports.ts.html +94 -0
- package/coverage/lcov-report/src/.umi/plugin-helmet/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/Provider.tsx.html +196 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/exports.ts.html +106 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/initialState.ts.html +88 -0
- package/coverage/lcov-report/src/.umi/plugin-initial-state/runtime.tsx.html +124 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/SelectLang.tsx.html +1246 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/index.html +161 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/locale.tsx.html +268 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/localeExports.ts.html +778 -0
- package/coverage/lcov-report/src/.umi/plugin-locale/runtime.tsx.html +115 -0
- package/coverage/lcov-report/src/.umi/plugin-model/Provider.tsx.html +202 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/constant.tsx.html +97 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/dispatcher.tsx.html +142 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/executor.tsx.html +334 -0
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-model/index.html +146 -0
- package/coverage/lcov-report/src/.umi/plugin-model/runtime.tsx.html +121 -0
- package/coverage/lcov-report/src/.umi/plugin-model/useModel.tsx.html +298 -0
- package/coverage/lcov-report/src/.umi/plugin-request/index.html +116 -0
- package/coverage/lcov-report/src/.umi/plugin-request/request.ts.html +919 -0
- package/coverage/lcov-report/src/.umi/umi.ts.html +268 -0
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.d.ts +1 -1
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +13 -10
- package/es/ProEditTable/components/RenderField/index.js +2 -3
- package/es/ProEditTable/utils/diffOriginal.d.ts +21 -0
- package/es/ProEditTable/utils/diffOriginal.js +62 -0
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +36 -32
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.d.ts +1 -1
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +13 -10
- package/lib/ProEditTable/components/RenderField/index.js +2 -3
- package/lib/ProEditTable/utils/diffOriginal.d.ts +21 -0
- package/lib/ProEditTable/utils/diffOriginal.js +68 -0
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +36 -32
- package/package.json +1 -1
@@ -0,0 +1,268 @@
|
|
1
|
+
|
2
|
+
<!doctype html>
|
3
|
+
<html lang="en">
|
4
|
+
|
5
|
+
<head>
|
6
|
+
<title>Code coverage report for src/.umi/umi.ts</title>
|
7
|
+
<meta charset="utf-8" />
|
8
|
+
<link rel="stylesheet" href="../../prettify.css" />
|
9
|
+
<link rel="stylesheet" href="../../base.css" />
|
10
|
+
<link rel="shortcut icon" type="image/x-icon" href="../../favicon.png" />
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
12
|
+
<style type='text/css'>
|
13
|
+
.coverage-summary .sorter {
|
14
|
+
background-image: url(../../sort-arrow-sprite.png);
|
15
|
+
}
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<div class='wrapper'>
|
21
|
+
<div class='pad1'>
|
22
|
+
<h1><a href="../../index.html">All files</a> / <a href="index.html">src/.umi</a> umi.ts</h1>
|
23
|
+
<div class='clearfix'>
|
24
|
+
|
25
|
+
<div class='fl pad1y space-right2'>
|
26
|
+
<span class="strong">0% </span>
|
27
|
+
<span class="quiet">Statements</span>
|
28
|
+
<span class='fraction'>0/14</span>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
|
32
|
+
<div class='fl pad1y space-right2'>
|
33
|
+
<span class="strong">0% </span>
|
34
|
+
<span class="quiet">Branches</span>
|
35
|
+
<span class='fraction'>0/7</span>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
|
39
|
+
<div class='fl pad1y space-right2'>
|
40
|
+
<span class="strong">0% </span>
|
41
|
+
<span class="quiet">Functions</span>
|
42
|
+
<span class='fraction'>0/4</span>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
|
46
|
+
<div class='fl pad1y space-right2'>
|
47
|
+
<span class="strong">0% </span>
|
48
|
+
<span class="quiet">Lines</span>
|
49
|
+
<span class='fraction'>0/13</span>
|
50
|
+
</div>
|
51
|
+
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<p class="quiet">
|
55
|
+
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
56
|
+
</p>
|
57
|
+
<template id="filterTemplate">
|
58
|
+
<div class="quiet">
|
59
|
+
Filter:
|
60
|
+
<input oninput="onInput()" type="search" id="fileSearch">
|
61
|
+
</div>
|
62
|
+
</template>
|
63
|
+
</div>
|
64
|
+
<div class='status-line low'></div>
|
65
|
+
<pre><table class="coverage">
|
66
|
+
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
67
|
+
<a name='L2'></a><a href='#L2'>2</a>
|
68
|
+
<a name='L3'></a><a href='#L3'>3</a>
|
69
|
+
<a name='L4'></a><a href='#L4'>4</a>
|
70
|
+
<a name='L5'></a><a href='#L5'>5</a>
|
71
|
+
<a name='L6'></a><a href='#L6'>6</a>
|
72
|
+
<a name='L7'></a><a href='#L7'>7</a>
|
73
|
+
<a name='L8'></a><a href='#L8'>8</a>
|
74
|
+
<a name='L9'></a><a href='#L9'>9</a>
|
75
|
+
<a name='L10'></a><a href='#L10'>10</a>
|
76
|
+
<a name='L11'></a><a href='#L11'>11</a>
|
77
|
+
<a name='L12'></a><a href='#L12'>12</a>
|
78
|
+
<a name='L13'></a><a href='#L13'>13</a>
|
79
|
+
<a name='L14'></a><a href='#L14'>14</a>
|
80
|
+
<a name='L15'></a><a href='#L15'>15</a>
|
81
|
+
<a name='L16'></a><a href='#L16'>16</a>
|
82
|
+
<a name='L17'></a><a href='#L17'>17</a>
|
83
|
+
<a name='L18'></a><a href='#L18'>18</a>
|
84
|
+
<a name='L19'></a><a href='#L19'>19</a>
|
85
|
+
<a name='L20'></a><a href='#L20'>20</a>
|
86
|
+
<a name='L21'></a><a href='#L21'>21</a>
|
87
|
+
<a name='L22'></a><a href='#L22'>22</a>
|
88
|
+
<a name='L23'></a><a href='#L23'>23</a>
|
89
|
+
<a name='L24'></a><a href='#L24'>24</a>
|
90
|
+
<a name='L25'></a><a href='#L25'>25</a>
|
91
|
+
<a name='L26'></a><a href='#L26'>26</a>
|
92
|
+
<a name='L27'></a><a href='#L27'>27</a>
|
93
|
+
<a name='L28'></a><a href='#L28'>28</a>
|
94
|
+
<a name='L29'></a><a href='#L29'>29</a>
|
95
|
+
<a name='L30'></a><a href='#L30'>30</a>
|
96
|
+
<a name='L31'></a><a href='#L31'>31</a>
|
97
|
+
<a name='L32'></a><a href='#L32'>32</a>
|
98
|
+
<a name='L33'></a><a href='#L33'>33</a>
|
99
|
+
<a name='L34'></a><a href='#L34'>34</a>
|
100
|
+
<a name='L35'></a><a href='#L35'>35</a>
|
101
|
+
<a name='L36'></a><a href='#L36'>36</a>
|
102
|
+
<a name='L37'></a><a href='#L37'>37</a>
|
103
|
+
<a name='L38'></a><a href='#L38'>38</a>
|
104
|
+
<a name='L39'></a><a href='#L39'>39</a>
|
105
|
+
<a name='L40'></a><a href='#L40'>40</a>
|
106
|
+
<a name='L41'></a><a href='#L41'>41</a>
|
107
|
+
<a name='L42'></a><a href='#L42'>42</a>
|
108
|
+
<a name='L43'></a><a href='#L43'>43</a>
|
109
|
+
<a name='L44'></a><a href='#L44'>44</a>
|
110
|
+
<a name='L45'></a><a href='#L45'>45</a>
|
111
|
+
<a name='L46'></a><a href='#L46'>46</a>
|
112
|
+
<a name='L47'></a><a href='#L47'>47</a>
|
113
|
+
<a name='L48'></a><a href='#L48'>48</a>
|
114
|
+
<a name='L49'></a><a href='#L49'>49</a>
|
115
|
+
<a name='L50'></a><a href='#L50'>50</a>
|
116
|
+
<a name='L51'></a><a href='#L51'>51</a>
|
117
|
+
<a name='L52'></a><a href='#L52'>52</a>
|
118
|
+
<a name='L53'></a><a href='#L53'>53</a>
|
119
|
+
<a name='L54'></a><a href='#L54'>54</a>
|
120
|
+
<a name='L55'></a><a href='#L55'>55</a>
|
121
|
+
<a name='L56'></a><a href='#L56'>56</a>
|
122
|
+
<a name='L57'></a><a href='#L57'>57</a>
|
123
|
+
<a name='L58'></a><a href='#L58'>58</a>
|
124
|
+
<a name='L59'></a><a href='#L59'>59</a>
|
125
|
+
<a name='L60'></a><a href='#L60'>60</a>
|
126
|
+
<a name='L61'></a><a href='#L61'>61</a>
|
127
|
+
<a name='L62'></a><a href='#L62'>62</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
128
|
+
<span class="cline-any cline-neutral"> </span>
|
129
|
+
<span class="cline-any cline-neutral"> </span>
|
130
|
+
<span class="cline-any cline-neutral"> </span>
|
131
|
+
<span class="cline-any cline-neutral"> </span>
|
132
|
+
<span class="cline-any cline-neutral"> </span>
|
133
|
+
<span class="cline-any cline-neutral"> </span>
|
134
|
+
<span class="cline-any cline-neutral"> </span>
|
135
|
+
<span class="cline-any cline-neutral"> </span>
|
136
|
+
<span class="cline-any cline-neutral"> </span>
|
137
|
+
<span class="cline-any cline-neutral"> </span>
|
138
|
+
<span class="cline-any cline-neutral"> </span>
|
139
|
+
<span class="cline-any cline-neutral"> </span>
|
140
|
+
<span class="cline-any cline-no"> </span>
|
141
|
+
<span class="cline-any cline-neutral"> </span>
|
142
|
+
<span class="cline-any cline-no"> </span>
|
143
|
+
<span class="cline-any cline-neutral"> </span>
|
144
|
+
<span class="cline-any cline-neutral"> </span>
|
145
|
+
<span class="cline-any cline-neutral"> </span>
|
146
|
+
<span class="cline-any cline-no"> </span>
|
147
|
+
<span class="cline-any cline-neutral"> </span>
|
148
|
+
<span class="cline-any cline-neutral"> </span>
|
149
|
+
<span class="cline-any cline-neutral"> </span>
|
150
|
+
<span class="cline-any cline-neutral"> </span>
|
151
|
+
<span class="cline-any cline-neutral"> </span>
|
152
|
+
<span class="cline-any cline-neutral"> </span>
|
153
|
+
<span class="cline-any cline-neutral"> </span>
|
154
|
+
<span class="cline-any cline-neutral"> </span>
|
155
|
+
<span class="cline-any cline-neutral"> </span>
|
156
|
+
<span class="cline-any cline-neutral"> </span>
|
157
|
+
<span class="cline-any cline-neutral"> </span>
|
158
|
+
<span class="cline-any cline-neutral"> </span>
|
159
|
+
<span class="cline-any cline-no"> </span>
|
160
|
+
<span class="cline-any cline-neutral"> </span>
|
161
|
+
<span class="cline-any cline-neutral"> </span>
|
162
|
+
<span class="cline-any cline-neutral"> </span>
|
163
|
+
<span class="cline-any cline-neutral"> </span>
|
164
|
+
<span class="cline-any cline-no"> </span>
|
165
|
+
<span class="cline-any cline-neutral"> </span>
|
166
|
+
<span class="cline-any cline-neutral"> </span>
|
167
|
+
<span class="cline-any cline-neutral"> </span>
|
168
|
+
<span class="cline-any cline-no"> </span>
|
169
|
+
<span class="cline-any cline-neutral"> </span>
|
170
|
+
<span class="cline-any cline-neutral"> </span>
|
171
|
+
<span class="cline-any cline-neutral"> </span>
|
172
|
+
<span class="cline-any cline-neutral"> </span>
|
173
|
+
<span class="cline-any cline-neutral"> </span>
|
174
|
+
<span class="cline-any cline-neutral"> </span>
|
175
|
+
<span class="cline-any cline-no"> </span>
|
176
|
+
<span class="cline-any cline-neutral"> </span>
|
177
|
+
<span class="cline-any cline-no"> </span>
|
178
|
+
<span class="cline-any cline-no"> </span>
|
179
|
+
<span class="cline-any cline-no"> </span>
|
180
|
+
<span class="cline-any cline-no"> </span>
|
181
|
+
<span class="cline-any cline-no"> </span>
|
182
|
+
<span class="cline-any cline-neutral"> </span>
|
183
|
+
<span class="cline-any cline-neutral"> </span>
|
184
|
+
<span class="cline-any cline-no"> </span>
|
185
|
+
<span class="cline-any cline-neutral"> </span>
|
186
|
+
<span class="cline-any cline-neutral"> </span>
|
187
|
+
<span class="cline-any cline-neutral"> </span>
|
188
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">// @ts-nocheck
|
189
|
+
import './core/polyfill';
|
190
|
+
import '@@/core/devScripts';
|
191
|
+
import { plugin } from './core/plugin';
|
192
|
+
import './core/pluginRegister';
|
193
|
+
import { createHistory } from './core/history';
|
194
|
+
import { ApplyPluginsType } from '/Users/zakj/Desktop/pro/za-material-warehouse/node_modules/@umijs/runtime';
|
195
|
+
import { renderClient } from '/Users/zakj/Desktop/pro/za-material-warehouse/node_modules/@umijs/renderer-react/dist/index.js';
|
196
|
+
import { getRoutes } from './core/routes';
|
197
|
+
|
198
|
+
|
199
|
+
import '../global.less';
|
200
|
+
import { _onCreate } from './plugin-locale/locale';
|
201
|
+
<span class="cstat-no" title="statement not covered" >_onCreate();</span>
|
202
|
+
|
203
|
+
const getClientRender = <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >(a</span>rgs: { hot?: boolean; routes?: any[] } = <span class="branch-0 cbranch-no" title="branch not covered" >{})</span> => <span class="cstat-no" title="statement not covered" >plugin.applyPlugins({</span></span>
|
204
|
+
key: 'render',
|
205
|
+
type: ApplyPluginsType.compose,
|
206
|
+
initialValue: <span class="fstat-no" title="function not covered" >()</span> => {
|
207
|
+
const opts = <span class="cstat-no" title="statement not covered" >plugin.applyPlugins({</span>
|
208
|
+
key: 'modifyClientRenderOpts',
|
209
|
+
type: ApplyPluginsType.modify,
|
210
|
+
initialValue: {
|
211
|
+
routes: args.routes || getRoutes(),
|
212
|
+
plugin,
|
213
|
+
history: createHistory(args.hot),
|
214
|
+
isServer: process.env.__IS_SERVER,
|
215
|
+
dynamicImport: true,
|
216
|
+
rootElement: 'root',
|
217
|
+
defaultTitle: `sisyphus(3.4.3-beta.6)`,
|
218
|
+
},
|
219
|
+
});
|
220
|
+
<span class="cstat-no" title="statement not covered" > return renderClient(opts);</span>
|
221
|
+
},
|
222
|
+
args,
|
223
|
+
});
|
224
|
+
|
225
|
+
const clientRender = <span class="cstat-no" title="statement not covered" >getClientRender();</span>
|
226
|
+
export default clientRender();
|
227
|
+
|
228
|
+
|
229
|
+
<span class="cstat-no" title="statement not covered" > window.g_umi = {</span>
|
230
|
+
version: '3.5.41',
|
231
|
+
};
|
232
|
+
|
233
|
+
|
234
|
+
// hot module replacement
|
235
|
+
// @ts-ignore
|
236
|
+
<span class="cstat-no" title="statement not covered" >if (module.hot) {</span>
|
237
|
+
// @ts-ignore
|
238
|
+
<span class="cstat-no" title="statement not covered" > module.hot.accept('./core/routes', <span class="fstat-no" title="function not covered" >()</span> => {</span>
|
239
|
+
const ret = <span class="cstat-no" title="statement not covered" >require('./core/routes');</span>
|
240
|
+
<span class="cstat-no" title="statement not covered" > if (ret.then) {</span>
|
241
|
+
<span class="cstat-no" title="statement not covered" > ret.then(<span class="fstat-no" title="function not covered" >({</span> getRoutes }) => {</span>
|
242
|
+
<span class="cstat-no" title="statement not covered" > getClientRender({ hot: true, routes: getRoutes() })();</span>
|
243
|
+
});
|
244
|
+
} else {
|
245
|
+
<span class="cstat-no" title="statement not covered" > getClientRender({ hot: true, routes: ret.getRoutes() })();</span>
|
246
|
+
}
|
247
|
+
});
|
248
|
+
}
|
249
|
+
</pre></td></tr></table></pre>
|
250
|
+
|
251
|
+
<div class='push'></div><!-- for sticky footer -->
|
252
|
+
</div><!-- /wrapper -->
|
253
|
+
<div class='footer quiet pad2 space-top1 center small'>
|
254
|
+
Code coverage generated by
|
255
|
+
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
256
|
+
at 2024-01-24T02:49:50.075Z
|
257
|
+
</div>
|
258
|
+
<script src="../../prettify.js"></script>
|
259
|
+
<script>
|
260
|
+
window.onload = function () {
|
261
|
+
prettyPrint();
|
262
|
+
};
|
263
|
+
</script>
|
264
|
+
<script src="../../sorter.js"></script>
|
265
|
+
<script src="../../block-navigation.js"></script>
|
266
|
+
</body>
|
267
|
+
</html>
|
268
|
+
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { FormInstance } from 'antd';
|
3
3
|
import { NamePath } from 'antd/lib/form/interface';
|
4
|
-
import { DiffOriginalParams } from '
|
4
|
+
import { DiffOriginalParams } from '../../utils/diffOriginal';
|
5
5
|
interface Props {
|
6
6
|
name?: NamePath;
|
7
7
|
names?: NamePath[];
|
@@ -10,7 +10,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
import React, { useMemo, useRef } from 'react';
|
11
11
|
import classnames from 'classnames';
|
12
12
|
import { get } from 'lodash';
|
13
|
-
import { diffOriginal } from '
|
13
|
+
import { diffOriginal } from '../../utils/diffOriginal';
|
14
14
|
import { useProConfig } from '../../../ProConfigProvider';
|
15
15
|
import { isEmpty } from '../../../utils';
|
16
16
|
var toNamePath = function toNamePath(name) {
|
@@ -34,7 +34,7 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
34
34
|
if (!originalValues) {
|
35
35
|
return undefined;
|
36
36
|
}
|
37
|
-
var
|
37
|
+
var originRecord;
|
38
38
|
if (rowKeyPath) {
|
39
39
|
var rowValueNamePath = namePath.slice(0, rowKeyPath.length - 1); // 表单中变动值所在行
|
40
40
|
var rowKeyName = rowKeyPath[rowKeyPath.length - 1]; // rowKey在行内的name
|
@@ -43,13 +43,13 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
43
43
|
var keyValue = rowValue[rowKeyName]; // 获取表单中rowKey值
|
44
44
|
if (!keyValue) return undefined;
|
45
45
|
var originalValueList = get(originalValues, originalName.slice(0, rowKeyPath.length - 2));
|
46
|
-
|
46
|
+
originRecord = originalValueList === null || originalValueList === void 0 ? void 0 : originalValueList.find(function (item) {
|
47
47
|
return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
|
48
48
|
});
|
49
49
|
var originalValue;
|
50
50
|
if (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) {
|
51
51
|
var originalNamesValue = originalNames.map(function (originalName) {
|
52
|
-
return get(
|
52
|
+
return get(originRecord, originalName.slice(rowKeyPath.length - 1));
|
53
53
|
});
|
54
54
|
// 有可能出现数组中全是undefined的情况 视为没有值
|
55
55
|
var fillUndefined = originalNamesValue.every(function (valItem) {
|
@@ -57,11 +57,12 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
57
57
|
});
|
58
58
|
originalValue = fillUndefined ? undefined : originalNamesValue;
|
59
59
|
} else {
|
60
|
-
originalValue = get(
|
60
|
+
originalValue = get(originRecord, originalName.slice(rowKeyPath.length - 1));
|
61
61
|
}
|
62
62
|
return {
|
63
63
|
originalValue: originalValue,
|
64
|
-
|
64
|
+
originRecord: originRecord,
|
65
|
+
record: rowValue
|
65
66
|
};
|
66
67
|
}
|
67
68
|
// 这个方法是给editTable专用的 暂时不存在不传rowKey的情况
|
@@ -69,7 +70,7 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
69
70
|
originalValue: (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
|
70
71
|
return get(originalValues, originalName);
|
71
72
|
}) : get(originalValues, originalName),
|
72
|
-
|
73
|
+
originRecord: originRecord
|
73
74
|
};
|
74
75
|
};
|
75
76
|
var ListChangedWrapper = function ListChangedWrapper(props) {
|
@@ -130,8 +131,10 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
130
131
|
value: _value,
|
131
132
|
originalValue: _originalValue,
|
132
133
|
form: form,
|
133
|
-
equalWith: equalWith
|
134
|
-
|
134
|
+
equalWith: equalWith,
|
135
|
+
originRecord: originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.originRecord,
|
136
|
+
record: originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.record,
|
137
|
+
index: index
|
135
138
|
});
|
136
139
|
}, [props[valuePropName], originalValue]);
|
137
140
|
var isAdd = diffType === 'add';
|
@@ -144,7 +147,7 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
144
147
|
var _children = children;
|
145
148
|
if (viewRender) {
|
146
149
|
if (! /*#__PURE__*/React.isValidElement(viewRender)) {
|
147
|
-
return viewRender(orgValue, (originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.
|
150
|
+
return viewRender(orgValue, (originalDTO === null || originalDTO === void 0 ? void 0 : originalDTO.originRecord) || {}, {
|
148
151
|
form: form,
|
149
152
|
name: name,
|
150
153
|
index: index
|
@@ -6,7 +6,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
6
6
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
7
7
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
8
8
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
9
|
-
var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "
|
9
|
+
var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "onDiff", "className", "trim", "confirm", "dependencies"];
|
10
10
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
11
11
|
/* eslint-disable prefer-destructuring */
|
12
12
|
/* eslint-disable prefer-const */
|
@@ -52,7 +52,6 @@ var RenderField = function RenderField(_ref) {
|
|
52
52
|
required = _column$required === void 0 ? false : _column$required,
|
53
53
|
_column$rules = column.rules,
|
54
54
|
rules = _column$rules === void 0 ? [] : _column$rules,
|
55
|
-
equalWith = column.equalWith,
|
56
55
|
onDiff = column.onDiff,
|
57
56
|
className = column.className,
|
58
57
|
trim = column.trim,
|
@@ -568,7 +567,7 @@ var RenderField = function RenderField(_ref) {
|
|
568
567
|
originalNames: originalNames,
|
569
568
|
originalValues: originalValues,
|
570
569
|
form: form,
|
571
|
-
equalWith: onDiff
|
570
|
+
equalWith: onDiff,
|
572
571
|
type: type,
|
573
572
|
onChange: _onChange,
|
574
573
|
valuePropName: _formItemProps.valuePropName,
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { FormInstance } from 'antd';
|
2
|
+
export type DiffType = 'same' | 'add' | 'changed';
|
3
|
+
export interface DiffOriginalParams {
|
4
|
+
originalValue: any;
|
5
|
+
value: any;
|
6
|
+
form: FormInstance;
|
7
|
+
equalWith?: ({ originValue, originRecord, value, record, index }: {
|
8
|
+
originValue: any;
|
9
|
+
originRecord: any;
|
10
|
+
value: any;
|
11
|
+
record: any;
|
12
|
+
index: number;
|
13
|
+
}) => DiffType | undefined;
|
14
|
+
/** 原始行数据 */
|
15
|
+
originRecord: any;
|
16
|
+
/** 当前行数据 */
|
17
|
+
record: any;
|
18
|
+
/** 当前行索引 */
|
19
|
+
index: number;
|
20
|
+
}
|
21
|
+
export declare const diffOriginal: (params: DiffOriginalParams) => DiffType;
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import { isEqual, isFunction, isObject } from 'lodash';
|
2
|
+
import { validate } from '@zat-design/utils';
|
3
|
+
var isEmpty = validate.isEmpty;
|
4
|
+
// 过滤对象中undefined字段
|
5
|
+
// 防止{a: '1'} {a: '1', b: undefined | null}被认为不相等
|
6
|
+
var filterObject = function filterObject(data) {
|
7
|
+
if (!isObject(data) || Array.isArray(data) || data === null) return data;
|
8
|
+
var resData = {};
|
9
|
+
Object.keys(data).forEach(function (key) {
|
10
|
+
if (!isEmpty(data[key])) {
|
11
|
+
resData[key] = data[key];
|
12
|
+
}
|
13
|
+
});
|
14
|
+
// 空对象视为null 比较时 null undefined {} [] '' 视为相等
|
15
|
+
if (!Object.keys(resData).length) return null;
|
16
|
+
return resData;
|
17
|
+
};
|
18
|
+
export var diffOriginal = function diffOriginal(params) {
|
19
|
+
var originalValue = params.originalValue,
|
20
|
+
value = params.value,
|
21
|
+
equalWith = params.equalWith,
|
22
|
+
originRecord = params.originRecord,
|
23
|
+
record = params.record,
|
24
|
+
index = params.index;
|
25
|
+
// 支持传入自定义比较事件
|
26
|
+
if (isFunction(equalWith)) {
|
27
|
+
var diffRes = equalWith({
|
28
|
+
originValue: originalValue,
|
29
|
+
originRecord: originRecord,
|
30
|
+
value: value,
|
31
|
+
record: record,
|
32
|
+
index: index
|
33
|
+
});
|
34
|
+
// 如果返回undefined走内置比较逻辑
|
35
|
+
if (diffRes !== undefined) {
|
36
|
+
if (typeof diffRes === 'boolean') {
|
37
|
+
return diffRes ? 'same' : 'changed';
|
38
|
+
}
|
39
|
+
return diffRes;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
var _value = filterObject(value);
|
43
|
+
var _originalValue = filterObject(originalValue);
|
44
|
+
// 如果原始值为空 且当前有值的话 认为变更类型是新增
|
45
|
+
if (isEmpty(_originalValue) && !isEmpty(_value)) {
|
46
|
+
return 'add';
|
47
|
+
}
|
48
|
+
if (Array.isArray(_originalValue)) {
|
49
|
+
var isSame = _originalValue.every(function (valueItem, index) {
|
50
|
+
// 如果两个值有一个不是空值, 则进行深比较
|
51
|
+
if (!isEmpty(value === null || value === void 0 ? void 0 : value[index]) || !isEmpty(valueItem)) {
|
52
|
+
return isEqual(value === null || value === void 0 ? void 0 : value[index], valueItem);
|
53
|
+
}
|
54
|
+
return true;
|
55
|
+
});
|
56
|
+
return isSame ? 'same' : 'changed';
|
57
|
+
}
|
58
|
+
if (!isEmpty(_originalValue) || !isEmpty(_value)) {
|
59
|
+
return isEqual(_value, _originalValue) ? 'same' : 'changed';
|
60
|
+
}
|
61
|
+
return 'same';
|
62
|
+
};
|
package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js
CHANGED
@@ -106,7 +106,7 @@ var DndWrapper = function DndWrapper(_ref2) {
|
|
106
106
|
}();
|
107
107
|
var onDragEnd = /*#__PURE__*/function () {
|
108
108
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref5) {
|
109
|
-
var active, over, transformedValue, activeObject, overObject, activeLevel, activeParentId, overLevel, overParentId, nextDataSource, _flatTree, activeIndex, overIndex, nextValue;
|
109
|
+
var active, over, transformedValue, activeObject, overObject, activeLevel, activeParentId, overLevel, overParentId, nextDataSource, _nextDataSource, _flatTree, activeIndex, overIndex, nextValue;
|
110
110
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
111
111
|
while (1) switch (_context2.prev = _context2.next) {
|
112
112
|
case 0:
|
@@ -114,7 +114,7 @@ var DndWrapper = function DndWrapper(_ref2) {
|
|
114
114
|
// 为数据源划分层级及parentId
|
115
115
|
transformedValue = addLevelAndParentId(value, rowKey); // 同一level层级的且parentId相同的,可以互相之间拖拽替换
|
116
116
|
if (!(active.id !== (over === null || over === void 0 ? void 0 : over.id))) {
|
117
|
-
_context2.next =
|
117
|
+
_context2.next = 20;
|
118
118
|
break;
|
119
119
|
}
|
120
120
|
activeObject = treeNodeFind(transformedValue, function (t) {
|
@@ -124,47 +124,51 @@ var DndWrapper = function DndWrapper(_ref2) {
|
|
124
124
|
return t.rowKey === (over === null || over === void 0 ? void 0 : over.id);
|
125
125
|
});
|
126
126
|
if (!(activeObject && overObject)) {
|
127
|
-
_context2.next =
|
127
|
+
_context2.next = 20;
|
128
128
|
break;
|
129
129
|
}
|
130
130
|
activeLevel = activeObject.level, activeParentId = activeObject.parentId;
|
131
|
-
overLevel = overObject.level, overParentId = overObject.parentId;
|
131
|
+
overLevel = overObject.level, overParentId = overObject.parentId;
|
132
|
+
nextDataSource = value;
|
133
|
+
if (!(activeLevel === overLevel && activeParentId === overParentId)) {
|
134
|
+
_context2.next = 20;
|
135
|
+
break;
|
136
|
+
}
|
137
|
+
// 将树平铺
|
138
|
+
_flatTree = transformTreeToArray(transformedValue).map(function (item) {
|
139
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
140
|
+
children: undefined
|
141
|
+
});
|
142
|
+
});
|
143
|
+
activeIndex = _flatTree.findIndex(function (i) {
|
144
|
+
return i.rowKey === active.id;
|
145
|
+
});
|
146
|
+
overIndex = _flatTree.findIndex(function (i) {
|
147
|
+
return i.rowKey === (over === null || over === void 0 ? void 0 : over.id);
|
148
|
+
});
|
149
|
+
nextValue = arrayMove(_flatTree, activeIndex, overIndex);
|
150
|
+
nextDataSource = createTreeFromArray(nextValue, {
|
151
|
+
itemKey: 'rowKey',
|
152
|
+
parentKey: 'parentId',
|
153
|
+
childrenKey: 'children'
|
154
|
+
});
|
155
|
+
// 如果传了onDragEndGuard 则视为外部业务逻辑自处理
|
132
156
|
if (!(onDragEndGuard && isFunction(onDragEndGuard))) {
|
133
|
-
_context2.next =
|
157
|
+
_context2.next = 19;
|
134
158
|
break;
|
135
159
|
}
|
136
|
-
_context2.next =
|
160
|
+
_context2.next = 18;
|
137
161
|
return onDragEndGuard({
|
138
162
|
activeObject: activeObject,
|
139
163
|
overObject: overObject,
|
140
|
-
|
164
|
+
originDataSource: value,
|
165
|
+
currentDataSource: nextDataSource
|
141
166
|
});
|
142
|
-
case
|
167
|
+
case 18:
|
143
168
|
nextDataSource = _context2.sent;
|
144
|
-
|
145
|
-
|
146
|
-
case
|
147
|
-
if (activeLevel === overLevel && activeParentId === overParentId) {
|
148
|
-
// 将树平铺
|
149
|
-
_flatTree = transformTreeToArray(transformedValue).map(function (item) {
|
150
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
151
|
-
children: undefined
|
152
|
-
});
|
153
|
-
});
|
154
|
-
activeIndex = _flatTree.findIndex(function (i) {
|
155
|
-
return i.rowKey === active.id;
|
156
|
-
});
|
157
|
-
overIndex = _flatTree.findIndex(function (i) {
|
158
|
-
return i.rowKey === (over === null || over === void 0 ? void 0 : over.id);
|
159
|
-
});
|
160
|
-
nextValue = arrayMove(_flatTree, activeIndex, overIndex);
|
161
|
-
onChange(createTreeFromArray(nextValue, {
|
162
|
-
itemKey: 'rowKey',
|
163
|
-
parentKey: 'parentId',
|
164
|
-
childrenKey: 'children'
|
165
|
-
}));
|
166
|
-
}
|
167
|
-
case 15:
|
169
|
+
case 19:
|
170
|
+
onChange((_nextDataSource = nextDataSource) !== null && _nextDataSource !== void 0 ? _nextDataSource : []);
|
171
|
+
case 20:
|
168
172
|
case "end":
|
169
173
|
return _context2.stop();
|
170
174
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { FormInstance } from 'antd';
|
3
3
|
import { NamePath } from 'antd/lib/form/interface';
|
4
|
-
import { DiffOriginalParams } from '
|
4
|
+
import { DiffOriginalParams } from '../../utils/diffOriginal';
|
5
5
|
interface Props {
|
6
6
|
name?: NamePath;
|
7
7
|
names?: NamePath[];
|