ag-common 0.0.270 → 0.0.271

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.
@@ -1,4 +1,4 @@
1
1
  import { ITextEdit } from './types';
2
2
  import { StyledComponent } from 'styled-components';
3
3
  export declare const ValueReadonly: StyledComponent<"div", any, {}, never>;
4
- export declare const TextEdit: ({ defaultValue, defaultEditing, disableEdit, placeholder, className, singleLine, noGrow, attributes, leftContent, onSubmit, onEditingChange, onClickOutsideWithNoValue, onClickNotEditing, allowUndo, onEscape, maxLength, onKeyDown, }: ITextEdit) => JSX.Element;
4
+ export declare const TextEdit: (p: ITextEdit) => JSX.Element;
@@ -29,6 +29,7 @@ const common_1 = require("./common");
29
29
  const LengthBox_1 = require("./LengthBox");
30
30
  const useOnClickOutside_1 = require("../../helpers/useOnClickOutside");
31
31
  const common_2 = require("../../styles/common");
32
+ const dom_1 = require("../../helpers/dom");
32
33
  const styled_components_1 = __importStar(require("styled-components"));
33
34
  const react_1 = __importStar(require("react"));
34
35
  exports.ValueReadonly = styled_components_1.default.div `
@@ -81,7 +82,8 @@ const Icon = styled_components_1.default.div `
81
82
  filter: saturate(3);
82
83
  }
83
84
  `;
84
- const TextEdit = ({ defaultValue = '', defaultEditing, disableEdit = false, placeholder, className, singleLine = false, noGrow = false, attributes, leftContent, onSubmit, onEditingChange, onClickOutsideWithNoValue, onClickNotEditing, allowUndo = true, onEscape, maxLength, onKeyDown, }) => {
85
+ const TextEdit = (p) => {
86
+ const { defaultValue = '', defaultEditing, disableEdit = false, placeholder, className, singleLine = false, noGrow = false, leftContent, onSubmit, onEditingChange, onClickOutsideWithNoValue, onClickNotEditing, allowUndo = true, onEscape, maxLength, onKeyDown, } = p;
85
87
  const ref = (0, react_1.useRef)(null);
86
88
  const taref = (0, react_1.useRef)(null);
87
89
  const [value, setValue] = (0, react_1.useState)(defaultValue);
@@ -123,7 +125,7 @@ const TextEdit = ({ defaultValue = '', defaultEditing, disableEdit = false, plac
123
125
  // eslint-disable-next-line react-hooks/exhaustive-deps
124
126
  }, []);
125
127
  if (!editing || disableEdit) {
126
- return (react_1.default.createElement(common_1.ValueBox, Object.assign({}, common_2.noDrag, { className: className, "data-editing": "false", onClick: () => onClickNotEditing === null || onClickNotEditing === void 0 ? void 0 : onClickNotEditing(), "data-pointer": onClickNotEditing ? 'true' : 'false', "data-nogrow": noGrow }, attributes),
128
+ return (react_1.default.createElement(common_1.ValueBox, Object.assign({}, common_2.noDrag, { className: className, "data-editing": "false", onClick: () => onClickNotEditing === null || onClickNotEditing === void 0 ? void 0 : onClickNotEditing(), "data-pointer": onClickNotEditing ? 'true' : 'false', "data-nogrow": noGrow }, (0, dom_1.filterDataProps)(p)),
127
129
  leftContent || null,
128
130
  react_1.default.createElement(exports.ValueReadonly, { "data-type": "text" }, value || react_1.default.createElement("span", { style: { color: '#ccc' } }, placeholder)),
129
131
  react_1.default.createElement(Right, null, !disableEdit && (react_1.default.createElement(Icon, { style: common_1.iconRight, onClick: (e) => {
@@ -139,7 +141,7 @@ const TextEdit = ({ defaultValue = '', defaultEditing, disableEdit = false, plac
139
141
  : ValueTextArea;
140
142
  return (react_1.default.createElement(ValueBoxEdit, Object.assign({}, common_2.noDrag, { className: className, "data-editing": "true",
141
143
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
142
- ref: ref, tabIndex: -1, "data-nogrow": noGrow }, attributes),
144
+ ref: ref, tabIndex: -1, "data-nogrow": noGrow }, (0, dom_1.filterDataProps)(p)),
143
145
  leftContent || null,
144
146
  react_1.default.createElement(Comp, { tabIndex: editing ? 0 : undefined, "data-editing": "true", "data-valuechange": valueChange.toString(), ref: taref, "data-type": "text", value: value, onChange: (v) => {
145
147
  setValue(v.currentTarget.value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ag-common",
3
- "version": "0.0.270",
3
+ "version": "0.0.271",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Andrei Gec <@andreigec> (https://gec.dev/)",