hyperapp-is 0.1.23 → 0.1.25
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 +71 -66
- package/dist/hyperapp-is/core/navigator.d.ts +8 -8
- package/dist/hyperapp-is/core/navigator.js +83 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -614,29 +614,29 @@ export const getParentItems = (
|
|
|
614
614
|
```ts
|
|
615
615
|
export const NavigatorFinder = function <S> (
|
|
616
616
|
props: {
|
|
617
|
-
state
|
|
618
|
-
id
|
|
619
|
-
currentKeys
|
|
620
|
-
columns
|
|
621
|
-
plugIn
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
afterRender
|
|
626
|
-
state : S
|
|
627
|
-
localState: Recrod<string, any>
|
|
628
|
-
}, vnode: VNode<S>) => VNode<S>
|
|
617
|
+
state : S
|
|
618
|
+
id : string
|
|
619
|
+
currentKeys : Keys_NavigatorItem
|
|
620
|
+
columns ?: (directory: NavigatorItem | undefined) => NavigatorColumn[]
|
|
621
|
+
plugIn ?: (state: S, localState: Record<string, any>) => VNode<S>[]
|
|
622
|
+
toolBarNode ?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>
|
|
623
|
+
parentItemsNode ?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>
|
|
624
|
+
statusBarNode ?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>
|
|
625
|
+
afterRender ?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>
|
|
629
626
|
[key: string]: any
|
|
630
627
|
}
|
|
631
628
|
): VNode<S>
|
|
632
629
|
```
|
|
633
630
|
|
|
634
|
-
- state
|
|
635
|
-
- id
|
|
636
|
-
- currentKeys
|
|
637
|
-
- columns
|
|
638
|
-
- plugIn
|
|
639
|
-
-
|
|
631
|
+
- state : ステート
|
|
632
|
+
- id : ユニークID (DOM ID)
|
|
633
|
+
- currentKeys : カレント NavigatorItem までのパス
|
|
634
|
+
- columns : NavigatorColumn の配列を返す関数
|
|
635
|
+
- plugIn : プラグインの挿入
|
|
636
|
+
- toolBarNode : `toolBar` レンダーフック
|
|
637
|
+
- parentItemsNode: `parentItems` レンダーフック
|
|
638
|
+
- statusBarNode : `statusBar` レンダーフック
|
|
639
|
+
- afterRender : 全体のレンダーフック
|
|
640
640
|
|
|
641
641
|
localState
|
|
642
642
|
- searchText: "" as string // 検索テキスト
|
|
@@ -648,39 +648,40 @@ localState
|
|
|
648
648
|
vnode
|
|
649
649
|
```html
|
|
650
650
|
<div id={id}>
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
651
|
+
<div class="rapper">
|
|
652
|
+
<div class="toolBar">
|
|
653
|
+
<input type="text" />
|
|
654
|
+
<button type="button">FILTER</button>
|
|
655
|
+
</div>
|
|
656
|
+
|
|
657
|
+
<div class="parentItems">
|
|
658
|
+
<ol>
|
|
659
|
+
<li>parent</li>
|
|
660
|
+
</ol>
|
|
661
|
+
<button type="button">COPY</button>
|
|
662
|
+
</div>
|
|
663
|
+
|
|
664
|
+
<div class="items">
|
|
665
|
+
<table>
|
|
666
|
+
<thead>
|
|
667
|
+
<tr>
|
|
668
|
+
<th>ヘッダー</th>
|
|
669
|
+
<th class="sort">ソート付きヘッダー</th>
|
|
670
|
+
</tr>
|
|
671
|
+
</thead>
|
|
672
|
+
<tbody>
|
|
673
|
+
<tr>
|
|
674
|
+
<td class="file"><span>value</span></td>
|
|
675
|
+
<td class="directory"><span>value</span></td>
|
|
676
|
+
</tr>
|
|
677
|
+
</tbody>
|
|
678
|
+
</table>
|
|
679
|
+
</div>
|
|
680
|
+
|
|
681
|
+
<div class="statusBar">message</div>
|
|
655
682
|
</div>
|
|
656
683
|
|
|
657
|
-
|
|
658
|
-
<ol>
|
|
659
|
-
<li>parent</li>
|
|
660
|
-
</ol>
|
|
661
|
-
<button type="button">COPY</button>
|
|
662
|
-
</div>
|
|
663
|
-
|
|
664
|
-
<div class="items">
|
|
665
|
-
<table>
|
|
666
|
-
<thead>
|
|
667
|
-
<tr>
|
|
668
|
-
<th>ヘッダー</th>
|
|
669
|
-
<th class="sort">ソート付きヘッダー</th>
|
|
670
|
-
</tr>
|
|
671
|
-
</thead>
|
|
672
|
-
<tbody>
|
|
673
|
-
<tr>
|
|
674
|
-
<td class="file"><span>value</span></td>
|
|
675
|
-
<td class="directory"><span>value</span></td>
|
|
676
|
-
</tr>
|
|
677
|
-
</tbody>
|
|
678
|
-
</table>
|
|
679
|
-
</div>
|
|
680
|
-
|
|
681
|
-
<div class="statusBar">message</div>
|
|
682
|
-
|
|
683
|
-
<!-- plugIn 必要な文だけ追加 -->
|
|
684
|
+
<!-- plugIn 必要な分だけ追加 -->
|
|
684
685
|
<div id={plugInID}>
|
|
685
686
|
</div>
|
|
686
687
|
</div>
|
|
@@ -706,27 +707,31 @@ export interface SearchResult {
|
|
|
706
707
|
```ts
|
|
707
708
|
export const NavigatorSearch = function <S> (
|
|
708
709
|
props: {
|
|
709
|
-
state
|
|
710
|
-
id
|
|
711
|
-
currentKeys
|
|
712
|
-
searchResult
|
|
713
|
-
hitTest
|
|
714
|
-
maxItemsCount
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
[key: string]: any
|
|
710
|
+
state : S
|
|
711
|
+
id : string
|
|
712
|
+
currentKeys : Keys_NavigatorItem
|
|
713
|
+
searchResult : (item: NavigatorItem, depth: number) => VNode<S> | VNode<S>[]
|
|
714
|
+
hitTest : (item: NavigatorItem) => boolean
|
|
715
|
+
maxItemsCount : number
|
|
716
|
+
toolBarNode ?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>
|
|
717
|
+
parentItemsNode?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>
|
|
718
|
+
statusBarNode ?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>
|
|
719
|
+
afterRender ?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>
|
|
720
|
+
[key: string] : any
|
|
720
721
|
}
|
|
721
722
|
): VNode<S>
|
|
722
723
|
```
|
|
723
724
|
|
|
724
|
-
- state
|
|
725
|
-
- id
|
|
726
|
-
-
|
|
727
|
-
-
|
|
728
|
-
-
|
|
729
|
-
-
|
|
725
|
+
- state : ステート
|
|
726
|
+
- id : ユニークID (DOM ID)
|
|
727
|
+
- currentKeys : カレント NavigatorItem までのパス
|
|
728
|
+
- searchResult : カードとして表示する VNode
|
|
729
|
+
- hitTest : 抽出条件
|
|
730
|
+
- maxItemsCount : 最初に表示するカードの最大数
|
|
731
|
+
- toolBarNode : `toolBar` レンダーフック
|
|
732
|
+
- parentItemsNode: `parentItems` レンダーフック
|
|
733
|
+
- statusBarNode : `statusBar` レンダーフック
|
|
734
|
+
- afterRender : 全体のレンダーフック
|
|
730
735
|
|
|
731
736
|
localState
|
|
732
737
|
- maxItemsCount: props.maxItemsCount as number // カードの最大表示数
|
|
@@ -53,10 +53,10 @@ export declare const NavigatorFinder: <S>(props: {
|
|
|
53
53
|
currentKeys: Keys_NavigatorItem;
|
|
54
54
|
columns?: (directory: NavigatorItem | undefined) => NavigatorColumn[];
|
|
55
55
|
plugIn?: (state: S, localState: Record<string, any>) => VNode<S>[];
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
toolBarNode?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>;
|
|
57
|
+
parentItemsNode?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>;
|
|
58
|
+
statusBarNode?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>;
|
|
59
|
+
afterRender?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>;
|
|
60
60
|
[key: string]: any;
|
|
61
61
|
}) => VNode<S>;
|
|
62
62
|
/**
|
|
@@ -100,9 +100,9 @@ export declare const NavigatorSearch: <S>(props: {
|
|
|
100
100
|
searchResult: (item: NavigatorItem, depth: number) => VNode<S> | VNode<S>[];
|
|
101
101
|
hitTest: (item: NavigatorItem) => boolean;
|
|
102
102
|
maxItemsCount: number;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
toolBarNode?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>;
|
|
104
|
+
parentItemsNode?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>;
|
|
105
|
+
statusBarNode?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>;
|
|
106
|
+
afterRender?: (state: S, localState: Record<string, any>, vnode: VNode<S>) => VNode<S>;
|
|
107
107
|
[key: string]: any;
|
|
108
108
|
}) => VNode<S>;
|
|
@@ -261,29 +261,41 @@ export const NavigatorFinder = function (props) {
|
|
|
261
261
|
// ---------- ---------- ----------
|
|
262
262
|
// VNode
|
|
263
263
|
// ---------- ---------- ----------
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}, div({
|
|
264
|
+
// toolBarNode
|
|
265
|
+
const toolBarNode = div({
|
|
267
266
|
class: "toolBar"
|
|
268
267
|
}, input({
|
|
269
268
|
type: "text",
|
|
270
269
|
placeholder: "search keys",
|
|
271
270
|
value: localState.searchText,
|
|
272
271
|
oninput: action_inputSearchText
|
|
273
|
-
}),
|
|
272
|
+
}), button({
|
|
273
|
+
type: "button",
|
|
274
|
+
title: "delete keys",
|
|
275
|
+
onclick: (state) => {
|
|
276
|
+
return setLocalState(state, id, {
|
|
277
|
+
searchText: ""
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
}, icon_trashBox), SelectButton({
|
|
274
281
|
state: state,
|
|
275
282
|
id: `${createLocalKey(id)}_filter`,
|
|
276
|
-
keyNames: [createLocalKey(id), "selected"]
|
|
277
|
-
|
|
283
|
+
keyNames: [createLocalKey(id), "selected"],
|
|
284
|
+
title: "filter"
|
|
285
|
+
}, icon_filter));
|
|
286
|
+
// parentItemsNode
|
|
287
|
+
const parentItemsNode = div({
|
|
278
288
|
class: "parentItems"
|
|
279
289
|
}, ol({}, parentItems.map(parent => li({
|
|
280
290
|
key: parent.path,
|
|
281
291
|
onclick: [action_parentClick, parent]
|
|
282
292
|
}, parent.name))), button({
|
|
283
293
|
type: "button",
|
|
284
|
-
title: "
|
|
294
|
+
title: "copy",
|
|
285
295
|
onclick: action_copyFolderPath
|
|
286
|
-
},
|
|
296
|
+
}, icon_copy));
|
|
297
|
+
// itemsNode
|
|
298
|
+
const itemsNode = div({
|
|
287
299
|
class: "items"
|
|
288
300
|
}, table({}, thead({}, tr({}, columns.map(col => th({
|
|
289
301
|
class: col.compare ? "sort" : "",
|
|
@@ -306,9 +318,15 @@ export const NavigatorFinder = function (props) {
|
|
|
306
318
|
}, span({
|
|
307
319
|
class: hitTest(t) ? "hit" : ""
|
|
308
320
|
}, v));
|
|
309
|
-
}))))))
|
|
310
|
-
//
|
|
311
|
-
div({ class: "statusBar" }, message)
|
|
321
|
+
}))))));
|
|
322
|
+
// statusBarNode
|
|
323
|
+
const statusBarNode = div({ class: "statusBar" }, message);
|
|
324
|
+
// vnode
|
|
325
|
+
const vnode = div({
|
|
326
|
+
...deleteKeys(props, "state", "currentKeys", "columns", "plugIn", "toolBarNode", "parentItemsNode", "statusBarNode", "afterRender")
|
|
327
|
+
}, div({
|
|
328
|
+
class: "rapper"
|
|
329
|
+
}, props.toolBarNode ? props.toolBarNode(state, localState, toolBarNode) : toolBarNode, props.parentItemsNode ? props.parentItemsNode(state, localState, parentItemsNode) : parentItemsNode, itemsNode, props.statusBarNode ? props.statuBarNode(state, localState, statusBarNode) : statusBarNode),
|
|
312
330
|
// plugIn
|
|
313
331
|
plugIn
|
|
314
332
|
? plugIn(state, localState)
|
|
@@ -316,7 +334,7 @@ export const NavigatorFinder = function (props) {
|
|
|
316
334
|
// ---------- ---------- ----------
|
|
317
335
|
// afterRender
|
|
318
336
|
// ---------- ---------- ----------
|
|
319
|
-
return afterRender ? afterRender(
|
|
337
|
+
return afterRender ? afterRender(state, localState, vnode) : vnode;
|
|
320
338
|
};
|
|
321
339
|
// ---------- ---------- ---------- ---------- ----------
|
|
322
340
|
// svg icon
|
|
@@ -387,6 +405,39 @@ const icon_file = svg({
|
|
|
387
405
|
strokeLinecap: "round",
|
|
388
406
|
strokeLinejoin: "round"
|
|
389
407
|
}, path({ d: "M6 2h9l5 5v15a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z" }), path({ d: "M14 2v6h6" }));
|
|
408
|
+
// icon_trashBox
|
|
409
|
+
const icon_trashBox = svg({
|
|
410
|
+
viewBox: "0 0 24 24",
|
|
411
|
+
width: 24,
|
|
412
|
+
height: 24,
|
|
413
|
+
fill: "none",
|
|
414
|
+
stroke: "currentColor",
|
|
415
|
+
strokeWidth: 2,
|
|
416
|
+
strokeLinecap: "round",
|
|
417
|
+
strokeLinejoin: "round"
|
|
418
|
+
}, path({ d: "M3 6h18" }), path({ d: "M8 6V4h8v2" }), path({ d: "M6 6l1 14h10l1-14" }), path({ d: "M10 11v6" }), path({ d: "M14 11v6" }));
|
|
419
|
+
// icon_filter
|
|
420
|
+
const icon_filter = svg({
|
|
421
|
+
viewBox: "0 0 24 24",
|
|
422
|
+
width: 24,
|
|
423
|
+
height: 24,
|
|
424
|
+
fill: "none",
|
|
425
|
+
stroke: "currentColor",
|
|
426
|
+
strokeWidth: 2,
|
|
427
|
+
strokeLinecap: "round",
|
|
428
|
+
strokeLinejoin: "round"
|
|
429
|
+
}, path({ d: "M3 5h18" }), path({ d: "M6 12h12" }), path({ d: "M10 19h4" }));
|
|
430
|
+
// icon_copy
|
|
431
|
+
const icon_copy = svg({
|
|
432
|
+
viewBox: "0 0 24 24",
|
|
433
|
+
width: 24,
|
|
434
|
+
height: 24,
|
|
435
|
+
fill: "none",
|
|
436
|
+
stroke: "currentColor",
|
|
437
|
+
strokeWidth: 2,
|
|
438
|
+
strokeLinecap: "round",
|
|
439
|
+
strokeLinejoin: "round"
|
|
440
|
+
}, path({ d: "M9 9h11v11H9z" }), path({ d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }));
|
|
390
441
|
// ---------- ---------- ---------- ---------- ----------
|
|
391
442
|
// NavigatorSearch Component (NavigatorFinder plugIn)
|
|
392
443
|
// ---------- ---------- ---------- ---------- ----------
|
|
@@ -516,56 +567,60 @@ export const NavigatorSearch = function (props) {
|
|
|
516
567
|
// ---------- ---------- ----------
|
|
517
568
|
// vnode
|
|
518
569
|
// ---------- ---------- ----------
|
|
519
|
-
const
|
|
520
|
-
...deleteKeys(props, "state", "currentKeys", "searchResult", "hitTest", "maxItemsCount", "afterRender")
|
|
521
|
-
},
|
|
522
|
-
// toolBar
|
|
523
|
-
div({
|
|
570
|
+
const toolBarNode = div({
|
|
524
571
|
class: "toolBar"
|
|
525
572
|
},
|
|
526
573
|
// sort
|
|
527
574
|
button({
|
|
528
575
|
type: "button",
|
|
576
|
+
title: "sort depth",
|
|
529
577
|
onclick: [action_setSort, "depth"]
|
|
530
578
|
}, icon_depth), button({
|
|
531
579
|
type: "button",
|
|
580
|
+
title: "sort name",
|
|
532
581
|
onclick: [action_setSort, "name"]
|
|
533
582
|
}, icon_name),
|
|
534
583
|
// filter
|
|
535
584
|
button({
|
|
536
585
|
type: "button",
|
|
537
586
|
class: localState.isDirectory ? "" : "ignore",
|
|
587
|
+
title: "directory",
|
|
538
588
|
onclick: (state) => setLocalState(state, id, {
|
|
539
589
|
isDirectory: !localState.isDirectory
|
|
540
590
|
})
|
|
541
591
|
}, icon_directory), button({
|
|
542
592
|
type: "button",
|
|
543
593
|
class: localState.isFile ? "" : "ignore",
|
|
594
|
+
title: "file",
|
|
544
595
|
onclick: (state) => setLocalState(state, id, {
|
|
545
596
|
isFile: !localState.isFile
|
|
546
597
|
})
|
|
547
|
-
}, icon_file))
|
|
548
|
-
//
|
|
549
|
-
div({
|
|
598
|
+
}, icon_file));
|
|
599
|
+
// parentItemsNode
|
|
600
|
+
const parentItemsNode = div({
|
|
550
601
|
class: "parentItems"
|
|
551
602
|
}, ol({}, parentItems.map(item => li({
|
|
552
603
|
onclick: (state) => setValue(state, currentKeys, item)
|
|
553
|
-
}, item.name))))
|
|
554
|
-
//
|
|
555
|
-
div({
|
|
604
|
+
}, item.name))));
|
|
605
|
+
// itemsNode
|
|
606
|
+
const itemsNode = div({
|
|
556
607
|
class: "items",
|
|
557
608
|
onscroll: action_itemsScroll
|
|
558
609
|
}, ul({}, drawItems.map(item => li({
|
|
559
610
|
class: "item",
|
|
560
611
|
key: item.item.path,
|
|
561
612
|
title: item.item.path
|
|
562
|
-
}, searchResult(item.item, item.depth)))))
|
|
563
|
-
//
|
|
564
|
-
div({
|
|
613
|
+
}, searchResult(item.item, item.depth)))));
|
|
614
|
+
// statusBarNode
|
|
615
|
+
const statusBarNode = div({
|
|
565
616
|
class: "statusBar"
|
|
566
|
-
}, message)
|
|
617
|
+
}, message);
|
|
618
|
+
// vnode
|
|
619
|
+
const vnode = div({
|
|
620
|
+
...deleteKeys(props, "state", "currentKeys", "searchResult", "hitTest", "maxItemsCount", "toolBarNode", "parentItemsNode", "statusBarNode", "afterRender")
|
|
621
|
+
}, props.toolBarNode ? props.toolBarNode(state, localState, toolBarNode) : toolBarNode, props.parentItemsNode ? props.parentItemsNode(state, localState, parentItemsNode) : parentItemsNode, itemsNode, props.statusBarNode ? props.statusBarNode(state, localState, statusBarNode) : statusBarNode);
|
|
567
622
|
// ---------- ---------- ----------
|
|
568
623
|
// afterRender
|
|
569
624
|
// ---------- ---------- ----------
|
|
570
|
-
return afterRender ? afterRender(
|
|
625
|
+
return afterRender ? afterRender(state, localState, vnode) : vnode;
|
|
571
626
|
};
|