@pisell/materials 1.0.670 → 1.0.671

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.
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { InputProps } from './type';
3
+ declare const InputWithMode: React.FC<InputProps & import("../../dataSourceForm/utils").WithModeProps>;
4
+ export default InputWithMode;
@@ -1,4 +1,4 @@
1
- var _excluded = ["enableQRScanner", "value", "onChange", "renderMode", "innerRef"];
1
+ var _excluded = ["enableQRScanner", "value", "onChange", "renderMode", "innerRef", "className"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
4
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -21,6 +21,7 @@ var Input = function Input(props) {
21
21
  onChange = props.onChange,
22
22
  renderMode = props.renderMode,
23
23
  innerRef = props.innerRef,
24
+ className = props.className,
24
25
  restProps = _objectWithoutProperties(props, _excluded);
25
26
 
26
27
  // 使用内部状态来管理输入值
@@ -114,8 +115,30 @@ var Input = function Input(props) {
114
115
  if (renderMode === 'view' || renderMode === 'tableView') {
115
116
  return /*#__PURE__*/React.createElement(ReadPretty, props);
116
117
  }
118
+
119
+ // 注入自定义样式到文档
120
+ useEffect(function () {
121
+ if (enableQRScanner) {
122
+ // 创建一个样式元素
123
+ var styleEl = document.createElement('style');
124
+ styleEl.id = 'pisell-qr-scanner-style';
125
+ styleEl.innerHTML = "\n .pisell-input-with-scanner .pisell-lowcode-input-group .pisell-lowcode-input-group-addon {\n background-color: var(--primary-600, #7F56D9);\n }\n ";
126
+
127
+ // 添加到文档中
128
+ document.head.appendChild(styleEl);
129
+
130
+ // 清理函数
131
+ return function () {
132
+ var existingStyle = document.getElementById('pisell-qr-scanner-style');
133
+ if (existingStyle) {
134
+ document.head.removeChild(existingStyle);
135
+ }
136
+ };
137
+ }
138
+ }, [enableQRScanner]);
117
139
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AntInput, _extends({}, restProps, {
118
140
  ref: innerRef || undefined,
141
+ className: "".concat(className || '', " ").concat(enableQRScanner ? 'pisell-input-with-scanner' : ''),
119
142
  addonAfter: scanSuffix,
120
143
  value: inputValue,
121
144
  onChange: handleInputChange
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { InputProps } from './type';
3
+ declare const InputWithMode: React.FC<InputProps & import("../../dataSourceForm/utils").WithModeProps>;
4
+ export default InputWithMode;
@@ -47,6 +47,8 @@ var Input = (props) => {
47
47
  // 明确解构,避免通过restProps传递
48
48
  innerRef,
49
49
  // 明确解构
50
+ className,
51
+ // 明确解构className
50
52
  ...restProps
51
53
  } = props;
52
54
  const [inputValue, setInputValue] = (0, import_react.useState)(propValue || "");
@@ -103,11 +105,30 @@ var Input = (props) => {
103
105
  if (renderMode === "view" || renderMode === "tableView") {
104
106
  return /* @__PURE__ */ import_react.default.createElement(import_ReadPretty.default, { ...props });
105
107
  }
108
+ (0, import_react.useEffect)(() => {
109
+ if (enableQRScanner) {
110
+ const styleEl = document.createElement("style");
111
+ styleEl.id = "pisell-qr-scanner-style";
112
+ styleEl.innerHTML = `
113
+ .pisell-input-with-scanner .pisell-lowcode-input-group .pisell-lowcode-input-group-addon {
114
+ background-color: var(--primary-600, #7F56D9);
115
+ }
116
+ `;
117
+ document.head.appendChild(styleEl);
118
+ return () => {
119
+ const existingStyle = document.getElementById("pisell-qr-scanner-style");
120
+ if (existingStyle) {
121
+ document.head.removeChild(existingStyle);
122
+ }
123
+ };
124
+ }
125
+ }, [enableQRScanner]);
106
126
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
107
127
  import_antd.Input,
108
128
  {
109
129
  ...restProps,
110
130
  ref: innerRef || void 0,
131
+ className: `${className || ""} ${enableQRScanner ? "pisell-input-with-scanner" : ""}`,
111
132
  addonAfter: scanSuffix,
112
133
  value: inputValue,
113
134
  onChange: handleInputChange
@@ -10,7 +10,7 @@ export default [
10
10
  props: {
11
11
  placeholder: inputPlaceholder,
12
12
  allowClear: true,
13
- enableQRScanner: true,
13
+ enableQRScanner: false,
14
14
  },
15
15
  },
16
16
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.0.670",
3
+ "version": "1.0.671",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",