@nebularstreams/libmui 2.5.113 → 2.5.115
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/libui.esm.js +1 -1
- package/dist/libui.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/widgets/InputWidget.js +51 -45
- package/src/widgets/SmileysWidget.js +2 -2
package/package.json
CHANGED
|
@@ -158,55 +158,61 @@ const
|
|
|
158
158
|
...attrs.title && {title: attrs.title},
|
|
159
159
|
value: getValue(attrs, state),
|
|
160
160
|
placeholder: attrs.hint || "",
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (attrs.validator) state.isValid = attrs.validator(state.value);
|
|
165
|
-
if (attrs.onchange) {
|
|
166
|
-
(attrs.oninput || attrs.onchange)(state.value, event);
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
onchange: (event) => {
|
|
170
|
-
if (attrs.onchange) {
|
|
171
|
-
if (attrs.validator) state.isValid = attrs.validator(state.value);
|
|
172
|
-
event.enterPressed = state.enterPressed;
|
|
173
|
-
delete state.enterPressed;
|
|
174
|
-
attrs.onchange(getInput(attrs, event.target.value), event);
|
|
175
|
-
if (attrs.staticField) {
|
|
176
|
-
reset(true);
|
|
177
|
-
} else {
|
|
178
|
-
delete state.value;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
onblur: () => {
|
|
183
|
-
if (state.showInput) {
|
|
184
|
-
reset(true);
|
|
161
|
+
...attrs.readonly
|
|
162
|
+
? {
|
|
163
|
+
readonly: "readonly"
|
|
185
164
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
165
|
+
: {
|
|
166
|
+
oninput: (event) => {
|
|
167
|
+
state.value = getInput(attrs, event.target.value);
|
|
168
|
+
event.fromoninput = true;
|
|
169
|
+
if (attrs.validator) state.isValid = attrs.validator(state.value);
|
|
170
|
+
if (attrs.onchange) {
|
|
171
|
+
(attrs.oninput || attrs.onchange)(state.value, event);
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
onchange: (event) => {
|
|
175
|
+
if (attrs.onchange) {
|
|
176
|
+
if (attrs.validator) state.isValid = attrs.validator(state.value);
|
|
177
|
+
event.enterPressed = state.enterPressed;
|
|
178
|
+
delete state.enterPressed;
|
|
179
|
+
attrs.onchange(getInput(attrs, event.target.value), event);
|
|
180
|
+
if (attrs.staticField) {
|
|
181
|
+
reset(true);
|
|
182
|
+
} else {
|
|
183
|
+
delete state.value;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
onblur: () => {
|
|
188
|
+
if (state.showInput) {
|
|
194
189
|
reset(true);
|
|
195
190
|
}
|
|
191
|
+
},
|
|
192
|
+
onkeyup: (event) => {
|
|
193
|
+
if (state.showInput) {
|
|
194
|
+
if (event.key === "Escape") {
|
|
195
|
+
reset(true);
|
|
196
|
+
} else if (event.key === "Enter") {
|
|
197
|
+
if (state.value === attrs.value || !state.value) {
|
|
198
|
+
attrs.onchange(attrs.value, event);
|
|
199
|
+
reset(true);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
onbeforeinput: (e) => {
|
|
205
|
+
if (attrs.subtype === "number" && e.data && !/^[0-9.\-]$/.test(e.data)) {
|
|
206
|
+
e.preventDefault(); // nothing but 0-9 or “.” gets through
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
inputmode: attrs.subtype === "number" ? "decimal" : undefined, // nicer mobile keyboard
|
|
210
|
+
onkeypress: (event) => {
|
|
211
|
+
if (!state.showInput && event.key === "Enter") {
|
|
212
|
+
attrs.onenter && attrs.onenter(event.target.value, event);
|
|
213
|
+
}
|
|
196
214
|
}
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
onbeforeinput: (e) => {
|
|
200
|
-
if (attrs.subtype === "number" && e.data && !/^[0-9.\-]$/.test(e.data)) {
|
|
201
|
-
e.preventDefault(); // nothing but 0-9 or “.” gets through
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
inputmode: attrs.subtype === "number" ? "decimal" : undefined, // nicer mobile keyboard
|
|
205
|
-
onkeypress: (event) => {
|
|
206
|
-
if (!state.showInput && event.key === "Enter") {
|
|
207
|
-
attrs.onenter && attrs.onenter(event.target.value, event);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
215
|
+
},
|
|
210
216
|
}),
|
|
211
217
|
|
|
212
218
|
m(".span.actions.absolute.right.bottom", [
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import m from "mithril";
|
|
2
2
|
import {defineWidget, Empty} from "./Basic";
|
|
3
3
|
import InputWidget from "./InputWidget";
|
|
4
|
-
import EMOJIS from "../meta/
|
|
5
|
-
import FONTAWESOME from "../meta/
|
|
4
|
+
import EMOJIS from "../meta/Emojis";
|
|
5
|
+
import FONTAWESOME from "../meta/FontAwesome";
|
|
6
6
|
|
|
7
7
|
const
|
|
8
8
|
|