├── .eslintignore
├── .eslintrc.js
├── .github
├── release.yml
└── workflows
│ └── deploy.yml
├── .gitignore
├── .npmrc
├── CHANGELOG.md
├── LICENSE.md
├── README.md
├── dev
├── App.vue
├── main.ts
├── plugins
│ └── element.ts
└── tests
│ ├── all-tests.vue
│ ├── big-data-multiple-select.vue
│ ├── big-data-table.vue
│ ├── big-data.vue
│ ├── bug-74.vue
│ ├── check-or-expand.vue
│ ├── set-value-in-mounted.vue
│ ├── show-unrender-label.vue
│ └── slots.vue
├── docs
├── .vitepress
│ ├── .eslintrc.js
│ ├── components
│ │ ├── check-strictly.vue
│ │ ├── custom-props.vue
│ │ ├── custom-render.vue
│ │ ├── custom-slot.vue
│ │ ├── filterable.vue
│ │ ├── lazy-load-cache-data.vue
│ │ ├── lazy-load.vue
│ │ ├── multiple.vue
│ │ ├── slots-menu.vue
│ │ ├── virtual.vue
│ │ └── with-form.vue
│ ├── config.mts
│ └── theme
│ │ ├── enhanceApp.ts
│ │ └── index.ts
├── README.md
├── index.md
└── public
│ └── logo.svg
├── env.d.ts
├── index.html
├── jetbrains.svg
├── package-lock.json
├── package.json
├── public
└── logo.svg
├── rollupx.config.js
├── src
├── components
│ ├── CacheOption.ts
│ ├── ElSelect.ts
│ ├── ElSelectTree.vue
│ ├── ElSelectTreeOption.ts
│ ├── ElSelectTreeVirtual.vue
│ ├── ElSelectVirtual.ts
│ ├── ElTreeNodeVirtual.ts
│ ├── ElTreeVirtual.ts
│ ├── style.scss
│ ├── utils.spec.ts
│ ├── utils.ts
│ └── virtual-list.ts
├── dark-base.scss
├── dark.scss
├── element-ui.ts
├── index.ts
├── plugins
│ └── element.ts
└── style.scss
├── tsconfig.app.json
├── tsconfig.config.json
├── tsconfig.json
├── tsconfig.vitest.json
└── vite.config.ts
/.eslintignore:
--------------------------------------------------------------------------------
1 | !.eslintrc.js
2 | lib
3 | dist
4 | stat
5 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | /* eslint-env node */
2 | require('@rushstack/eslint-patch/modern-module-resolution');
3 | const path = require('path');
4 |
5 | module.exports = {
6 | root: true,
7 | extends: [
8 | 'plugin:vue/essential',
9 | 'eslint:recommended',
10 | '@vue/eslint-config-typescript/recommended',
11 | '@vue/eslint-config-prettier',
12 | ],
13 | rules: {
14 | // eslint http://eslint.cn/docs/rules/
15 | 'no-debugger': 'error',
16 | 'no-console': 'error',
17 | eqeqeq: ['error', 'always'],
18 |
19 | // prettier https://prettier.io/docs/en/options.html
20 | 'prettier/prettier': [
21 | 'error',
22 | {
23 | singleQuote: true,
24 | arrowParens: 'always',
25 | semi: true,
26 | trailingComma: 'all',
27 | },
28 | ],
29 |
30 | // vue
31 | 'vue/multi-word-component-names': 'off',
32 | 'vue/no-mutating-props': 'off',
33 | 'vue/no-reserved-component-names': 'off',
34 |
35 | // typescript https://typescript-eslint.io/rules/
36 | '@typescript-eslint/no-explicit-any': 'off',
37 | '@typescript-eslint/ban-types': [
38 | 'error',
39 | {
40 | types: {
41 | '{}': false,
42 | },
43 | },
44 | ],
45 |
46 | // import https://github.com/import-js/eslint-plugin-import#rules
47 | 'import/no-useless-path-segments': 'error',
48 | 'import/first': 'error',
49 | 'import/no-duplicates': 'error',
50 | 'import/order': [
51 | 'error',
52 | {
53 | groups: [
54 | ['builtin', 'external'],
55 | ['type'],
56 | ['internal', 'parent', 'sibling', 'index'],
57 | ],
58 | pathGroups: [
59 | {
60 | pattern: '@/**',
61 | group: 'internal',
62 | },
63 | ],
64 | 'newlines-between': 'always',
65 | alphabetize: { order: 'asc' },
66 | },
67 | ],
68 | 'import/newline-after-import': 'error',
69 | },
70 |
71 | plugins: [
72 | // https://github.com/import-js/eslint-import-resolver-typescript#configuration
73 | 'import',
74 | ],
75 |
76 | settings: {
77 | // https://github.com/import-js/eslint-import-resolver-typescript#configuration
78 | 'import/parsers': {
79 | '@typescript-eslint/parser': ['.ts', '.tsx'],
80 | },
81 | 'import/resolver': {
82 | typescript: {
83 | alwaysTryTypes: true,
84 | project: path.resolve(__dirname, 'tsconfig.json'),
85 | },
86 | },
87 | },
88 | };
89 |
--------------------------------------------------------------------------------
/.github/release.yml:
--------------------------------------------------------------------------------
1 | changelog:
2 | exclude:
3 | labels:
4 | - ignore-for-release
5 | authors:
6 | - octocat
7 | categories:
8 | - title: Fixes
9 | labels:
10 | - fix
11 | - title: Features
12 | labels:
13 | - feat
14 | - title: Performs
15 | labels:
16 | - perf
17 | - title: Other Changes
18 | labels:
19 | - "*"
--------------------------------------------------------------------------------
/.github/workflows/deploy.yml:
--------------------------------------------------------------------------------
1 | name: Deploy
2 | on:
3 | push:
4 | branches:
5 | - master
6 | jobs:
7 | deploy:
8 | runs-on: ubuntu-latest
9 | steps:
10 | - uses: actions/checkout@v2
11 | - uses: actions/setup-node@v3
12 | with:
13 | node-version: 16
14 | cache: npm
15 | - run: npm i
16 | - name: Build
17 | run: npm run docs:build
18 | - name: Deploy
19 | uses: peaceiris/actions-gh-pages@v3
20 | with:
21 | github_token: ${{ secrets.GITHUB_TOKEN }}
22 | publish_dir: docs/.vitepress/dist
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | stat
4 | lib
5 | types
6 | dist
7 | docs/.vitepress/cache
8 | docs/.vitepress/dist
9 |
10 | # local env files
11 | .env.local
12 | .env.*.local
13 |
14 | # Log files
15 | npm-debug.log*
16 | yarn-debug.log*
17 | yarn-error.log*
18 |
19 | # Editor directories and files
20 | .idea
21 | .vscode
22 | *.suo
23 | *.ntvs*
24 | *.njsproj
25 | *.sln
26 | *.sw?
27 |
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | registry=https://registry.npmjs.org
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## [2.1.1-beta.17](https://github.com/yujinpan/el-select-tree/compare/v2.1.1-beta.16...v2.1.1-beta.17) (2024-11-14)
2 |
3 | ### Bug Fixes
4 |
5 | - cache option does not work and makes the check very slow ([77b7eb2](https://github.com/yujinpan/el-select-tree/commit/77b7eb236ff4c7c456c50dfb1f01a95b5922b439))
6 |
7 | ### Performance Improvements
8 |
9 | - optimizing array comparison efficiency ([faa870b](https://github.com/yujinpan/el-select-tree/commit/faa870b388f7dc781b7585a89b8957b0f81b4ee6))
10 |
11 | ## [2.1.1-beta.16](https://github.com/yujinpan/el-select-tree/compare/v2.1.1-beta.15...v2.1.1-beta.16) (2024-09-30)
12 |
13 | ### Bug Fixes
14 |
15 | - slowly when many items checked ([d8516e7](https://github.com/yujinpan/el-select-tree/commit/d8516e7c6506acb5849f175cf0707a6e30012016))
16 |
17 | ## [2.1.1-beta.15](https://github.com/yujinpan/el-select-tree/compare/v2.1.1-beta.14...v2.1.1-beta.15) (2024-06-18)
18 |
19 | ### Bug Fixes
20 |
21 | - always focus when use filter ([af87fe0](https://github.com/yujinpan/el-select-tree/commit/af87fe028581b7a91138ef0c80ce38df0caea6eb))
22 | - popper position incorrect when menu display or use filter ([405b457](https://github.com/yujinpan/el-select-tree/commit/405b457984eb5aab000fc16a32219282f20a6417))
23 |
24 | ### Features
25 |
26 | - add uppercase/lowercase matching ([c78b64d](https://github.com/yujinpan/el-select-tree/commit/c78b64d6961758e7e0a4a3baa9e61ac8a098b746))
27 |
28 | ## [2.1.1-beta.14](https://github.com/yujinpan/el-select-tree/compare/v2.1.1-beta.13...v2.1.1-beta.14) (2024-05-29)
29 |
30 | ### Features
31 |
32 | - add component optional styles, support dark mode ([1dc1ea6](https://github.com/yujinpan/el-select-tree/commit/1dc1ea675db2e742e55f8b260d834c2cc77951cf))
33 |
34 | ## [2.1.1-beta.13](https://github.com/yujinpan/el-select-tree/compare/v2.1.1-beta.12...v2.1.1-beta.13) (2024-05-28)
35 |
36 | ### Bug Fixes
37 |
38 | - filter data empty when scroll to bottom ([d52a4b6](https://github.com/yujinpan/el-select-tree/commit/d52a4b6622a8bbd86fe670fa7d01e547ed9e4138))
39 |
40 | ## [2.1.1-beta.12](https://github.com/yujinpan/el-select-tree/compare/v2.1.1-beta.11...v2.1.1-beta.12) (2024-05-17)
41 |
42 | ### Bug Fixes
43 |
44 | - `getParentKeys` does not include multi-level nodes ([c88e722](https://github.com/yujinpan/el-select-tree/commit/c88e72236c0caf236bc2c9b58a80e09f4972a250))
45 |
46 | ## [2.1.1-beta.11](https://github.com/yujinpan/el-select-tree/compare/v2.1.1-beta.10...v2.1.1-beta.11) (2024-05-14)
47 |
48 | ### Bug Fixes
49 |
50 | - use `Vue.observable` instead of `reactive` (vue2.6) ([7c82ecb](https://github.com/yujinpan/el-select-tree/commit/7c82ecb8f8bc76c81a7801d1cfa4f42c73ad8f66))
51 |
52 | ## [2.1.1-beta.10](https://github.com/yujinpan/el-select-tree/compare/v2.1.1-beta.9...v2.1.1-beta.10) (2024-04-25)
53 |
54 | ### Bug Fixes
55 |
56 | - checkedKeys sort with selection order ([277dab4](https://github.com/yujinpan/el-select-tree/commit/277dab40d76c05fc712cb658f0e2921ae5e0f133))
57 |
58 | # 2.0.3 2021-11-24
59 |
60 | ## Feature
61 |
62 | - add props can resolve callback function type
63 |
64 | # 2.0.2 2021-11-23
65 |
66 | ## Feature
67 |
68 | - new document and examples
69 | - add the option `show-checkbox`
70 |
71 | ## Fix
72 |
73 | - read `label` un parsed
74 | - el-select props un merged
75 | - filter text not clear when visible change
76 |
77 | # 2.0.1 2021-10-11
78 |
79 | ## Feature
80 |
81 | - add the support with `renderContent` and `#option` slot
82 |
83 | ## Refactor
84 |
85 | - auto expanded with selected
86 | - auto merge props
87 |
88 | # 2.0.0 2021-09-29
89 |
90 | ## Refactor
91 |
92 | - development env update to TS
93 | - make full use of the two components and combine them
94 | - better support for almost all attributes of components, like `filterable`, `multiple`
95 |
96 | # 1.1.1 2021-01-13
97 |
98 | ## Feature
99 |
100 | - add `popoverWidth` props
101 |
102 | ## Fix
103 |
104 | - popover position update when tree node expanded
105 |
106 | ## Refactor
107 |
108 | - external style-inject and vue-runtime-helpers package
109 |
110 | # 1.1.0 2021-01-08
111 |
112 | ## Remove
113 |
114 | - `disabledValues` props removed(use node's disabled props)
115 |
116 | ## Fix
117 |
118 | - lazy load be ignored when data is empty
119 | - cannot selected option when lazy load
120 | - `defaultExpandedKeys` is invalid when value not set
121 | - `autoExpandParent` to default true
122 |
123 | # 1.0.26 2020-09-25
124 |
125 | ## Feature
126 |
127 | - add inherited properties from ElTree
128 |
129 | ## Fix
130 |
131 | - disabled values invalid in children
132 |
133 | # 1.0.25 2020-09-15
134 |
135 | ## Fix
136 |
137 | - label not change when data to empty
138 |
139 | # 1.0.24 2020-08-29
140 |
141 | ## Fix
142 |
143 | - rollup-plugin-vue normalizer not parse https://github.com/vuejs/rollup-plugin-vue/issues/262
144 |
145 | # 1.0.23 2020-07-22
146 |
147 | ## Refactor
148 |
149 | - remove props `popover-min-width` and auto compute min-width
150 |
151 | ## Fix
152 |
153 | - min-width needs to subtract the border
154 | - `props.children` is not work with multiple disabled
155 |
156 | # 1.0.22 2020-06-01
157 |
158 | ## Fix
159 |
160 | - set selected when options init async and repeat prevent it
161 |
162 | # 1.0.21 2020-06-01
163 |
164 | ## Fix
165 |
166 | - add pinter style in expand icon and remove the text flex attribute(unused and width is not auto in ie)
167 |
168 | # 1.0.20 2020-05-28
169 |
170 | ## Fix
171 |
172 | - cannot clear in disabled state
173 |
174 | # 1.0.19 2020-05-27
175 |
176 | ## Fix
177 |
178 | - import compiled version with ElementUI's `Emitter` mixin
179 | - `check-strictly` does not valid in multiple check
180 |
181 | # 1.0.17 2020-05-19
182 |
183 | ## Fix
184 |
185 | - Handle verification timing error on el-form
186 |
187 | # 1.0.15 2020-05-13
188 |
189 | ## Features
190 |
191 | - add the `clearable`
192 |
193 | ## Fix
194 |
195 | - fix the motion problem of the arrow icon of the selector
196 |
197 | # 1.0.14 2020-01-07
198 |
199 | ## Features
200 |
201 | - add new attr `defaultExpandAll`, control expand all tree node
202 |
203 | # 1.0.13 2019-12-31
204 |
205 | ## Bug Fixes
206 |
207 | - `checkStrictly` not work
208 | - tree node child `label` unbind
209 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 yujinpan
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # el-select-tree
2 |
3 | ElementUI's el-select combined with el-tree.
4 |
5 | - Online examples [https://yujinpan.github.io/el-select-tree/](https://yujinpan.github.io/el-select-tree/)
6 |
7 | > - 2.1 Support custom menu header/footer.
8 | > - 2.1 `check-on-click-node` is available with `show-checkobx`, default is `false`. **Broken Change**
9 | > - 2.1 `expand-on-click-node` is available, default is `true`.
10 | > - 2.1 Support [virtual list](https://yujinpan.github.io/el-select-tree/#virtual).
11 | > - 2.0 Comprehensively improve the utilization rate of original parts.
12 |
13 | ## Usage
14 |
15 | ### Install
16 |
17 | ```
18 | npm install --save el-select-tree
19 | ```
20 |
21 | ### Require element-ui
22 |
23 | If your project does not use element-ui,
24 | you need to introduce a separate element-ui package, like this:
25 |
26 | ```js
27 | import "el-select-tree/lib/element-ui";
28 | ```
29 |
30 | ### Global registration
31 |
32 | ```js
33 | import Vue from "vue";
34 | import ElSelectTree from "el-select-tree";
35 |
36 | Vue.use(ElSelectTree);
37 | ```
38 |
39 | ### In-component registration
40 |
41 | ```js
42 | import ElSelectTree from "el-select-tree";
43 |
44 | export default {
45 | components: {
46 | ElSelectTree,
47 | },
48 | };
49 | ```
50 |
51 | ### Complete example
52 |
53 | ```vue
54 |
55 |
4 | Data volume: 500 * 20 * 10 = {{ 500 * 20 * 10 }}
5 |
5 |
34 |
6 |
33 | {{ index + 1 }}
7 | {{ item.name }}
8 |
9 |
20 |
21 |
32 |
5 | use checkbox:
6 |
5 | use checkbox and filterable:
6 |
17 |
18 |
19 |
",
44 | `
45 |
46 |
47 |
54 | `,
55 | );
56 | },
57 | });
58 |
--------------------------------------------------------------------------------
/docs/.vitepress/theme/enhanceApp.ts:
--------------------------------------------------------------------------------
1 | import '@/element-ui';
2 | import {
3 | Form,
4 | FormItem,
5 | Button,
6 | Table,
7 | TableColumn,
8 | Loading,
9 | Link,
10 | Checkbox,
11 | } from 'element-ui';
12 |
13 | import type { EnhanceAppContext } from 'vitepress';
14 |
15 | import ElSelectTree, { ElSelectTreeVirtual } from '@/index';
16 | import '@/style.scss';
17 | import 'element-ui/packages/theme-chalk/src/button.scss';
18 | import 'element-ui/packages/theme-chalk/src/form.scss';
19 | import 'element-ui/packages/theme-chalk/src/form-item.scss';
20 |
21 | export default (ctx: EnhanceAppContext) => {
22 | const { app: Vue } = ctx;
23 |
24 | Vue.use(Form);
25 | Vue.use(FormItem);
26 | Vue.use(Button);
27 | Vue.use(Table);
28 | Vue.use(TableColumn);
29 | Vue.use(Loading);
30 | Vue.use(Link);
31 | Vue.use(ElSelectTree);
32 | Vue.use(ElSelectTreeVirtual);
33 | Vue.use(Checkbox);
34 | };
35 |
--------------------------------------------------------------------------------
/docs/.vitepress/theme/index.ts:
--------------------------------------------------------------------------------
1 | import DefaultTheme from 'vitepress/theme';
2 | import { enhanceApp as enhanceAppDemo } from 'vitepress-plugin-component-demo';
3 |
4 | import type { Theme } from 'vitepress';
5 |
6 | import enhanceApp from './enhanceApp';
7 |
8 | export default {
9 | extends: DefaultTheme,
10 | async enhanceApp(context) {
11 | enhanceAppDemo(context);
12 | enhanceApp(context);
13 | },
14 | } as Theme;
15 |
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
1 | # el-select-tree
2 |
3 | ElementUI's el-select combined with el-tree.
4 |
5 | > - 2.1 Support custom menu [header/footer](#slots-menu).
6 | > - 2.1 `check-on-click-node` is available with `show-checkobx`, default is `false`.
4 | 5 | 6 | 7 | 8 |
9 | 10 |
14 |