hyperapp-is 0.1.46 → 0.1.48
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
|
@@ -522,11 +522,12 @@ localState: { histories: string[] }
|
|
|
522
522
|
```ts
|
|
523
523
|
export const HistoryInput = function <S> (
|
|
524
524
|
props: {
|
|
525
|
-
state
|
|
526
|
-
id
|
|
527
|
-
keyNames
|
|
528
|
-
historyLimit?: number
|
|
529
|
-
|
|
525
|
+
state : S
|
|
526
|
+
id : string
|
|
527
|
+
keyNames : Keys_String
|
|
528
|
+
historyLimit ?: number
|
|
529
|
+
afterRender ?: (state: S, localState: Record<string, any>, vnode: VNode<S>[]) => VNode<S>[]
|
|
530
|
+
[key: string] : any
|
|
530
531
|
}
|
|
531
532
|
): VNode<S>[]
|
|
532
533
|
```
|
|
@@ -536,6 +537,7 @@ export const HistoryInput = function <S> (
|
|
|
536
537
|
- props.id : ユニークID
|
|
537
538
|
- props.keyNames: ステート内の文字までのパス
|
|
538
539
|
- props.historyLimit: 保持する履歴の最大数 (default = 10)
|
|
540
|
+
- props.afterRender : 全体のレンダーフック
|
|
539
541
|
- returns : [HTMLInputElement, HTMLDataListElement]
|
|
540
542
|
|
|
541
543
|
履歴は `[props.id].histories` に保存されます
|
|
@@ -167,7 +167,7 @@ export const OptionButton = function (props, children) {
|
|
|
167
167
|
* @returns {VNode<S>[]} - [HTMLInputElement, HTMLDataListElement]
|
|
168
168
|
*/
|
|
169
169
|
export const HistoryInput = function (props) {
|
|
170
|
-
const { state, id, keyNames, historyLimit = 10 } = props;
|
|
170
|
+
const { state, id, keyNames, historyLimit = 10, afterRender } = props;
|
|
171
171
|
const value = getValue(state, keyNames, "");
|
|
172
172
|
const localState = getLocalState(state, id, {
|
|
173
173
|
histories: []
|
|
@@ -209,10 +209,10 @@ export const HistoryInput = function (props) {
|
|
|
209
209
|
// ---------- ---------- ----------
|
|
210
210
|
// VNode
|
|
211
211
|
// ---------- ---------- ----------
|
|
212
|
-
|
|
212
|
+
const vnode = [
|
|
213
213
|
input({
|
|
214
214
|
type: "text",
|
|
215
|
-
...deleteKeys(props, "state", "keyNames", "historyLimit"),
|
|
215
|
+
...deleteKeys(props, "state", "keyNames", "historyLimit", "afterRender"),
|
|
216
216
|
list: `${id}-history`,
|
|
217
217
|
value,
|
|
218
218
|
oninput,
|
|
@@ -224,4 +224,7 @@ export const HistoryInput = function (props) {
|
|
|
224
224
|
value: item
|
|
225
225
|
})))
|
|
226
226
|
];
|
|
227
|
+
return afterRender
|
|
228
|
+
? afterRender(state, localState, vnode)
|
|
229
|
+
: vnode;
|
|
227
230
|
};
|