( value, currentPosition, xyPosition, index, setXyPosition, userId, initial, dateFormat, fontSize, fontColor, dateDetails, textWidgetHeight )
| 1187 | |
| 1188 | //function for save widgets value on onchange function |
| 1189 | export const onChangeInput = ( |
| 1190 | value, |
| 1191 | currentPosition, |
| 1192 | xyPosition, |
| 1193 | index, |
| 1194 | setXyPosition, |
| 1195 | userId, |
| 1196 | initial, |
| 1197 | dateFormat, |
| 1198 | fontSize, |
| 1199 | fontColor, |
| 1200 | dateDetails, |
| 1201 | textWidgetHeight |
| 1202 | ) => { |
| 1203 | const isDuplicateValueUpdate = !dateFormat && !textWidgetHeight; |
| 1204 | const shouldAutoApplyDuplicateWidget = (position) => { |
| 1205 | const currentName = getDuplicateAutoApplyName(currentPosition); |
| 1206 | const positionName = getDuplicateAutoApplyName(position); |
| 1207 | return currentName && positionName && currentName === positionName; |
| 1208 | }; |
| 1209 | const applyDuplicateWidgetValue = (position) => { |
| 1210 | if ( |
| 1211 | position?.options?.response === value && |
| 1212 | position?.options?.defaultValue === "" |
| 1213 | ) { |
| 1214 | return position; |
| 1215 | } |
| 1216 | return { |
| 1217 | ...position, |
| 1218 | options: { |
| 1219 | ...position.options, |
| 1220 | response: value, |
| 1221 | defaultValue: "" |
| 1222 | } |
| 1223 | }; |
| 1224 | }; |
| 1225 | const isSigners = xyPosition.some( |
| 1226 | (data) => data.signerPtr || data.Role === "prefill" |
| 1227 | ); |
| 1228 | let filterSignerPos; |
| 1229 | if (isSigners) { |
| 1230 | if (userId) { |
| 1231 | filterSignerPos = xyPosition.filter((data) => data.Id === userId); |
| 1232 | } |
| 1233 | const getPlaceHolder = filterSignerPos[0]?.placeHolder; |
| 1234 | if (initial) { |
| 1235 | const xyData = addInitialData(xyPosition, setXyPosition, value, userId); |
| 1236 | setXyPosition(xyData); |
| 1237 | } else { |
| 1238 | const getPageNumer = getPlaceHolder.filter( |
| 1239 | (data) => data.pageNumber === index |
| 1240 | ); |
| 1241 | if (getPageNumer.length > 0) { |
| 1242 | const updatePositionValue = (position) => { |
| 1243 | if (position.key === currentPosition.key) { |
| 1244 | if (dateFormat) { |
| 1245 | return { |
| 1246 | ...position, |
no test coverage detected