@plastic-js/tsumiki 0.1.78 → 0.1.79
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/dist/components/Input.js +11 -2
- package/package.json +1 -1
package/dist/components/Input.js
CHANGED
|
@@ -160,6 +160,7 @@ var Input = (props = {}) => {
|
|
|
160
160
|
]);
|
|
161
161
|
const showPassword = createSignal(false);
|
|
162
162
|
const isPassword = read(local.type) === "password";
|
|
163
|
+
let inputEl = null;
|
|
163
164
|
const hasPrefix = () => read(local.prefix) != null;
|
|
164
165
|
const hasSuffix = () => read(local.suffix) != null || isPassword;
|
|
165
166
|
const field = useFieldContext();
|
|
@@ -187,12 +188,19 @@ var Input = (props = {}) => {
|
|
|
187
188
|
if (!isPassword) return read(local.type);
|
|
188
189
|
return showPassword() ? "text" : "password";
|
|
189
190
|
};
|
|
191
|
+
const handleAffixPointerDown = (e) => {
|
|
192
|
+
if (effectiveDisabled()) return;
|
|
193
|
+
const target = e.target;
|
|
194
|
+
if (target && target.closest && target.closest("button, a, input, select, textarea, label, [contenteditable]")) return;
|
|
195
|
+
inputEl?.focus();
|
|
196
|
+
};
|
|
190
197
|
const renderAffix = (content) => {
|
|
191
198
|
if (content == null) return null;
|
|
192
199
|
return () => {
|
|
193
200
|
const _el0 = _tmpl.cloneNode(true);
|
|
194
201
|
insert(_el0, () => content);
|
|
195
202
|
setProp(_el0, "className", () => affixClass);
|
|
203
|
+
setProp(_el0, "onPointerDown", () => handleAffixPointerDown);
|
|
196
204
|
return _el0;
|
|
197
205
|
};
|
|
198
206
|
};
|
|
@@ -206,8 +214,9 @@ var Input = (props = {}) => {
|
|
|
206
214
|
if (p == null) return null;
|
|
207
215
|
return renderAffix(p);
|
|
208
216
|
}, _el1);
|
|
209
|
-
insert(_el0, () => jsx(ark$1.input, mergeProps({
|
|
210
|
-
|
|
217
|
+
insert(_el0, () => jsx(ark$1.input, mergeProps({ ref: (el) => {
|
|
218
|
+
inputEl = el;
|
|
219
|
+
if (typeof local.ref === "function") local.ref(el);
|
|
211
220
|
} }, () => field ? field.getInputProps() : {}, rest, {
|
|
212
221
|
type: inputType,
|
|
213
222
|
"aria-invalid": () => effectiveInvalid() ? "true" : "false",
|