1.1.12 • Published 3 years ago

lit-finder v1.1.12

Weekly downloads
18
License
ISC
Repository
github
Last release
3 years ago

Finder MacOS by Lit

Installation

npm install lit-finder

Example

<template>
    <div>
        <finder
            :tree="tree"
            :handleItemClick="handleItemClick"
        >
            <template v-slot:finder-file-detail="{data}">
                {{data.label}}
            </template>
        </finder>
    </div>
</template>

<script>
import Finder from 'lit-finder';

export default {
    components: {Finder},
    data: () => ({
        tree: [
            {
                label: 'Parent 01',
                type: 'folder',
                children: [
                    {label: 'Parent 01 - Child 1', syncData: true, type: 'folder'},
                    {label: 'Parent 01 - Child 2', type: 'file'},
                ],
                suffix: 10
            },
            {
                label: 'Parent 02',
                type: 'folder',
                children: [
                    {label: 'Parent 01 - Child 1', type: 'file'},
                    {label: 'Parent 01 - Child 2', type: 'file'},
                ]
            },
        ]
    }),
    methods: {
        async handleItemClick(nodeData) {
            // do something, return Promise
            return Promise.resolve([
                {
                    label: 'New node 01'
                },
                {
                    label: 'New node 02'
                }
            ])
        }
    }
}
</script>

Props

NameTypeDefault
treeArray[]Base data of finder. Array of node
handleItemClickFunctionnullHandle event when click on node(have two params includes: nodeData, options)
optionsObject{}Init finder options(detail below)

Node properties

KeyTypeDefault value
labelStringrequiredName of node
typeStringrequirefolder,file: show node with type file or folder and css
childrenArray[]Children node
suffixString,Number''suffix content
syncDataBooleanfalseif true: define handleItemClick function to handle
suffixClassString''style for suffix content

Init options

KeyTypeDefault value
recursiveAllBooleanfalseExpand all nodes.
suffixClassString''Class of suffix content(When node have suffix options).
handleItemClickFunctionnullHandle event when click into node
containerClassString''Extra class of finder container
wrapperClassString''Custom wrapper class

Actions

Rerender
<template>
    <finder
        ...
        ref="finder"
    >
    
    </finder>
</template>

<script>
export default {
    // ...,
    data: () => ({
        keyword: ''
    }),
    methods: {
        someHandle() {
            // call something to get data
            const data = [
                {
                    label: 'Parent 01',
                    type: 'folder',
                    children: [
                        {label: 'Parent 01 - Child 1', syncData: true, type: 'folder'},
                        {label: 'Parent 01 - Child 2', type: 'file'},
                    ],
                    suffix: 10
                }
            ]
    
            /** render with keyword */
            this.$refs.finder.reRender(data, {
                keyword: this.keyword,
                noData: 'No data specific' // you can use node element instead string
                // highlightFile: true,
                // highlightFolder: false,
            })
        }
    }
}
</script>
  • Rerender options:
KeyTypeDefault valueExplain
keywordString''highlight name file or folder match which match keyword
noDataString, Node Element'No data specific!'Show message no data when the finder have no data
highlightFileBooleantruedefault highlight word inside file name which match keyword
highlighFolderBooleanfalsehighlight folder name like the way highlightFile works
1.1.12

3 years ago

1.1.11

3 years ago

1.1.10

3 years ago

1.1.9

3 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.1

4 years ago

1.1.2

4 years ago

1.0.19

4 years ago

1.0.20

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago