hyperapp-is 0.1.45 → 0.1.46
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/README.md
CHANGED
|
@@ -516,7 +516,8 @@ export const OptionButton = function <S> (
|
|
|
516
516
|
---
|
|
517
517
|
|
|
518
518
|
### HistoryInput
|
|
519
|
-
履歴付きインプットボックス
|
|
519
|
+
履歴付きインプットボックス
|
|
520
|
+
localState: { histories: string[] }
|
|
520
521
|
|
|
521
522
|
```ts
|
|
522
523
|
export const HistoryInput = function <S> (
|
|
@@ -527,7 +528,7 @@ export const HistoryInput = function <S> (
|
|
|
527
528
|
historyLimit?: number
|
|
528
529
|
[key: string]: any
|
|
529
530
|
}
|
|
530
|
-
): VNode<S>
|
|
531
|
+
): VNode<S>[]
|
|
531
532
|
```
|
|
532
533
|
|
|
533
534
|
- props : props
|
|
@@ -535,6 +536,7 @@ export const HistoryInput = function <S> (
|
|
|
535
536
|
- props.id : ユニークID
|
|
536
537
|
- props.keyNames: ステート内の文字までのパス
|
|
537
538
|
- props.historyLimit: 保持する履歴の最大数 (default = 10)
|
|
539
|
+
- returns : [HTMLInputElement, HTMLDataListElement]
|
|
538
540
|
|
|
539
541
|
履歴は `[props.id].histories` に保存されます
|
|
540
542
|
履歴を動的にクリアしたい場合 `setLocalState(state, id, { histories: [] })` などとして下さい
|
|
@@ -51,10 +51,9 @@ export declare const OptionButton: <S>(props: {
|
|
|
51
51
|
}, children: any) => VNode<S>;
|
|
52
52
|
/**
|
|
53
53
|
* 履歴付きインプット
|
|
54
|
+
* localState: { histories: string[] }
|
|
54
55
|
*
|
|
55
|
-
*
|
|
56
|
-
* ├ input
|
|
57
|
-
* └ datalist
|
|
56
|
+
* @returns {VNode<S>[]} - [HTMLInputElement, HTMLDataListElement]
|
|
58
57
|
*/
|
|
59
58
|
export declare const HistoryInput: <S>(props: {
|
|
60
59
|
state: S;
|
|
@@ -62,4 +61,4 @@ export declare const HistoryInput: <S>(props: {
|
|
|
62
61
|
keyNames: Keys_String;
|
|
63
62
|
historyLimit?: number;
|
|
64
63
|
[key: string]: any;
|
|
65
|
-
}) => VNode<S
|
|
64
|
+
}) => VNode<S>[];
|
|
@@ -162,10 +162,9 @@ export const OptionButton = function (props, children) {
|
|
|
162
162
|
// ---------- ---------- ---------- ---------- ----------
|
|
163
163
|
/**
|
|
164
164
|
* 履歴付きインプット
|
|
165
|
+
* localState: { histories: string[] }
|
|
165
166
|
*
|
|
166
|
-
*
|
|
167
|
-
* ├ input
|
|
168
|
-
* └ datalist
|
|
167
|
+
* @returns {VNode<S>[]} - [HTMLInputElement, HTMLDataListElement]
|
|
169
168
|
*/
|
|
170
169
|
export const HistoryInput = function (props) {
|
|
171
170
|
const { state, id, keyNames, historyLimit = 10 } = props;
|
|
@@ -210,16 +209,19 @@ export const HistoryInput = function (props) {
|
|
|
210
209
|
// ---------- ---------- ----------
|
|
211
210
|
// VNode
|
|
212
211
|
// ---------- ---------- ----------
|
|
213
|
-
return
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
212
|
+
return [
|
|
213
|
+
input({
|
|
214
|
+
type: "text",
|
|
215
|
+
...deleteKeys(props, "state", "keyNames", "historyLimit"),
|
|
216
|
+
list: `${id}-history`,
|
|
217
|
+
value,
|
|
218
|
+
oninput,
|
|
219
|
+
onkeydown,
|
|
220
|
+
}),
|
|
221
|
+
datalist({
|
|
222
|
+
id: `${id}-history`
|
|
223
|
+
}, histories.map(item => option({
|
|
224
|
+
value: item
|
|
225
|
+
})))
|
|
226
|
+
];
|
|
225
227
|
};
|