S
S
Slow1324322022-03-12 20:41:29
JavaScript
Slow132432, 2022-03-12 20:41:29

Input does not work correctly, what should I do?

The site has a field with percentages. when you enter a double number in input, a % appears after each digit. As I understood the fields are formed by this code.

(function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _OrdersEdit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./OrdersEdit */ \"./wp-content/themes/gruz/src/react/components/OrdersEdit.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } Object.defineProperty(subClass, \"prototype\", { value: Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }), writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\nvar OrdersItem = /*#__PURE__*/function (_Component) {\n  _inherits(OrdersItem, _Component);\n\n  var _super = _createSuper(OrdersItem);\n\n  function OrdersItem(props) {\n    var _this;\n\n    _classCallCheck(this, OrdersItem);\n\n    _this = _super.call(this, props);\n    _this.state = {\n      status: props.order.id_status\n    };\n    return _this;\n  }\n\n  _createClass(OrdersItem, [{\n    key: \"render\",\n    value: function render() {\n      var props = this.props,\n          state = this.state;\n      var order = props.order;\n      var orderId = parseInt(order.id);\n      var isActive = props.activeOrder === orderId;\n      var createTime = new Date(Date.parse(order.create_time.replace(/-/g, '/')));\n      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n        className: \"orders-item \".concat(isActive ? 'active' : '', \" \").concat(isActive && props.edited ? 'edited' : '', \" \").concat(isActive && props.loadingOrder ? 'updating' : '')\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n        className: \"orders-item__header\"\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n        className: \"orders-item-field field-number\"\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"input\", {\n        type: \"text\",\n        readOnly: true,\n        name: \"id\",\n        value: \"#\".concat(order.id)\n      })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n        className: \"orders-item-field field-time\"\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"input\", {\n        type: \"text\",\n        readOnly: true,\n        name: \"timezone\",\n        value: \"\".concat(createTime.getHours(), \":\").concat(createTime.getMinutes(), \" (\").concat(order.timezone, \")\")\n      })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n        className: \"orders-item-field field-location\"\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"select\", {\n        onChange: props.onOrderDataChange,\n        disabled: !isActive,\n        value: order.city,\n        name: \"city\",\n        \"data-string\": \"1\"\n      }, props.cities.map(function (item, index) {\n        return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"option\", {\n          key: index,\n          value: item.title\n        }, item.title);\n      }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n        className: \"orders-item-field field-name\"\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"input\", {\n        onChange: props.onOrderDataChange,\n        type: \"text\",\n        readOnly: !isActive,\n        name: \"fio\",\n        value: order.fio\n      })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n        className: \"orders-item-field field-phone\"\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"input\", {\n        onChange: props.onOrderDataChange,\n        type: \"text\",\n        readOnly: !isActive,\n        name: \"phone\",\n        value: order.phone\n      })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n        className: \"orders-item-field field-percent\"\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"input\", {\n        onChange: props.onOrderDataChange,\n        type: \"text\",\n        readOnly: !isActive,\n        name: \"percent\",\n        value: \"\".concat(order.percent, \"%\")\n      })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n        className: \"orders-item-field field-status\"\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"select\", {\n        onChange: props.onOrderDataChange,\n        disabled: !isActive,\n        value: order.id_status,\n        name: \"id_status\",\n        \"data-status\": order.id_status\n      }, props.statuses.map(function (item, index) {\n        return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"option\", {\n          key: index,\n          value: index\n        }, item);\n      }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n        className: \"orders-item-field field-readmore\"\n      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", {\n        \"data-id\": orderId,\n        onClick: props.onReadmoreClick\n      }, \"\\u041F\\u043E\\u0434\\u0440\\u043E\\u0431\\u043D\\u0435\\u0435\"))), isActive ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_OrdersEdit__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n        saved: props.saved,\n        transports: props.transports,\n        onOrderDataChange: props.onOrderDataChange,\n        onDetailsClick: props.onDetailsClick,\n        onEditPricesClick: props.onEditPricesClick,\n        onOrderDatetimeChange: props.onOrderDatetimeChange,\n        editedprice: props.editedprice,\n        editedaltprice: props.editedaltprice,\n        edited: props.edited,\n        onOrderSaveClick: props.onOrderSaveClick,\n        order: order\n      }) : null);\n    }\n  }]);\n\n  return OrdersItem;\n}(react__WEBPACK_IMPORTED_MODULE_0__[\"Component\"]);\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (OrdersItem);\n\n//# sourceURL=webpack:///./wp-content/themes/gruz/src/react/components/OrdersItem.js?");

/***/ })

This is the first time I've encountered such a mess. Through ctrl+f you can find the field with the percentage "percent". Please tell me what to do?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question