slim-select 2.0.2 → 2.1.0
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/dist/index.d.ts +1 -1
- package/dist/render.d.ts +1 -1
- package/dist/slimselect.cjs.js +54 -16
- package/dist/slimselect.es.js +54 -16
- package/dist/slimselect.global.js +54 -16
- package/dist/slimselect.js +54 -16
- package/dist/slimselect.min.js +1 -1
- package/dist/slimselect.umd.js +54 -16
- package/dist/slimselect.umd.min.js +1 -1
- package/docs/assets/index.css +1 -1
- package/docs/assets/index.js +7 -7
- package/docs/assets/index3.js +25 -16
- package/docs/assets/index5.js +145 -9
- package/docs/assets/install.js +4 -4
- package/package.json +11 -3
- package/src/docs/app.vue +4 -4
- package/src/docs/{images → assets/images}/check-mark.svg +0 -0
- package/src/docs/{images → assets/images}/chrome.svg +0 -0
- package/src/docs/{images → assets/images}/firefox.svg +0 -0
- package/src/docs/{images → assets/images}/github.png +0 -0
- package/src/docs/{images → assets/images}/ie.svg +0 -0
- package/src/docs/{images → assets/images}/npm.png +0 -0
- package/src/docs/{images → assets/images}/opera.svg +0 -0
- package/src/docs/{images → assets/images}/safari.svg +0 -0
- package/src/docs/assets/scss/misc.scss +7 -0
- package/src/docs/env.d.ts +1 -0
- package/src/docs/pages/events/addable.vue +22 -6
- package/src/docs/pages/events/before_after_change.vue +15 -1
- package/src/docs/pages/events/search.vue +2 -1
- package/src/docs/pages/frameworks/vue.vue +373 -7
- package/src/docs/pages/home.vue +18 -18
- package/src/docs/pages/methods/get_data.vue +2 -1
- package/src/docs/pages/methods/open_close.vue +1 -1
- package/src/slim-select/index.ts +1 -1
- package/src/slim-select/render.ts +83 -25
- package/src/slim-select/rollup.config.mjs +5 -0
- package/src/slim-select/select.ts +14 -5
- package/src/vue/dist/slimselectvue.es.js +1655 -0
- package/src/vue/dist/slimselectvue.global.js +1658 -0
- package/src/vue/dist/slimselectvue.ssr.js +1657 -0
- package/src/vue/hello.ts +5 -0
- package/src/vue/package.json +27 -0
- package/src/vue/rollup.config.mjs +44 -0
- package/src/vue/slimselect.vue +39 -5
- package/src/vue/tsconfig.json +14 -0
package/src/vue/hello.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@slim-select/vue",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Vue integration",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/brianvoe/slim-select.git"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"vue"
|
|
11
|
+
],
|
|
12
|
+
"author": "Brian Voelker <brian@webiswhatido.com> (http://webiswhatido.com)",
|
|
13
|
+
"homepage": "https://slimselectjs.com",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/brianvoe/slim-select/issues"
|
|
17
|
+
},
|
|
18
|
+
"main": "dist/slimselectvue.ssr.js",
|
|
19
|
+
"browser": "dist/slimselect.global.js",
|
|
20
|
+
"module": "dist/slimselectvue.es.js",
|
|
21
|
+
"types": "dist/index.d.ts",
|
|
22
|
+
"typings": "dist/index.d.ts",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "rollup -c rollup.config.mjs",
|
|
25
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import vue from 'rollup-plugin-vue'
|
|
2
|
+
import resolve from '@rollup/plugin-node-resolve'
|
|
3
|
+
import typescript from 'rollup-plugin-typescript2'
|
|
4
|
+
|
|
5
|
+
export default [
|
|
6
|
+
// ESM build to be used with webpack/rollup.
|
|
7
|
+
{
|
|
8
|
+
input: './slimselect.vue',
|
|
9
|
+
output: {
|
|
10
|
+
format: 'es',
|
|
11
|
+
file: './dist/slimselectvue.es.js',
|
|
12
|
+
},
|
|
13
|
+
external: ['vue', 'slim-select'],
|
|
14
|
+
plugins: [resolve(), typescript({ clean: true }), vue()],
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
// SSR build.
|
|
18
|
+
{
|
|
19
|
+
input: './slimselect.vue',
|
|
20
|
+
output: {
|
|
21
|
+
exports: 'auto',
|
|
22
|
+
format: 'cjs',
|
|
23
|
+
file: './dist/slimselectvue.ssr.js',
|
|
24
|
+
},
|
|
25
|
+
external: ['vue', 'slim-select'],
|
|
26
|
+
plugins: [resolve(), typescript({ clean: true }), vue({ template: { optimizeSSR: true } })],
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
// Browser build.
|
|
30
|
+
{
|
|
31
|
+
input: './slimselect.vue',
|
|
32
|
+
output: {
|
|
33
|
+
name: 'SlimSelectVue',
|
|
34
|
+
format: 'iife',
|
|
35
|
+
file: './dist/slimselectvue.global.js',
|
|
36
|
+
globals: {
|
|
37
|
+
vue: 'vue',
|
|
38
|
+
'slim-select': 'slim-select',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
external: ['vue', 'slim-select'],
|
|
42
|
+
plugins: [resolve(), typescript({ clean: true }), vue()],
|
|
43
|
+
},
|
|
44
|
+
]
|
package/src/vue/slimselect.vue
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { defineComponent } from 'vue'
|
|
2
|
+
import { defineComponent, PropType } from 'vue'
|
|
3
3
|
|
|
4
|
-
import SlimSelect, { Config } from '../slim-select'
|
|
4
|
+
import SlimSelect, { Config, Events } from '../slim-select'
|
|
5
|
+
import Settings from '../slim-select/settings'
|
|
6
|
+
import { DataArrayPartial } from '../slim-select/store'
|
|
5
7
|
|
|
6
8
|
export default defineComponent({
|
|
7
9
|
name: 'SlimSelect',
|
|
8
10
|
props: {
|
|
11
|
+
data: {
|
|
12
|
+
type: Array as PropType<DataArrayPartial>,
|
|
13
|
+
},
|
|
9
14
|
settings: {
|
|
10
|
-
type: Object
|
|
15
|
+
type: Object as PropType<Settings>,
|
|
16
|
+
},
|
|
17
|
+
events: {
|
|
18
|
+
type: Object as PropType<Events>,
|
|
11
19
|
},
|
|
12
20
|
},
|
|
13
21
|
data() {
|
|
@@ -17,14 +25,24 @@ export default defineComponent({
|
|
|
17
25
|
},
|
|
18
26
|
mounted() {
|
|
19
27
|
let config = {
|
|
20
|
-
select: this.$refs.slim
|
|
28
|
+
select: this.$refs.slim,
|
|
21
29
|
} as Config
|
|
22
30
|
|
|
23
|
-
// If
|
|
31
|
+
// If data is passed in, use it
|
|
32
|
+
if (this.data) {
|
|
33
|
+
config.data = this.data
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// If settings are passed in, use it
|
|
24
37
|
if (this.settings) {
|
|
25
38
|
config.settings = this.settings
|
|
26
39
|
}
|
|
27
40
|
|
|
41
|
+
// If events are passed in, use it
|
|
42
|
+
if (this.events) {
|
|
43
|
+
config.events = this.events
|
|
44
|
+
}
|
|
45
|
+
|
|
28
46
|
// Initialize SlimSelect
|
|
29
47
|
this.slim = new SlimSelect(config)
|
|
30
48
|
},
|
|
@@ -33,6 +51,22 @@ export default defineComponent({
|
|
|
33
51
|
this.slim.destroy()
|
|
34
52
|
}
|
|
35
53
|
},
|
|
54
|
+
watch: {
|
|
55
|
+
data: {
|
|
56
|
+
handler: function (newData) {
|
|
57
|
+
if (this.slim) {
|
|
58
|
+
this.slim.setData(newData)
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
deep: true,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
methods: {
|
|
65
|
+
// This allows via a ref to call the SlimSelect methods
|
|
66
|
+
getSlimSelect() {
|
|
67
|
+
return this.slim
|
|
68
|
+
},
|
|
69
|
+
},
|
|
36
70
|
})
|
|
37
71
|
</script>
|
|
38
72
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2016",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"strict": true /* Enable all strict type-checking options. */,
|
|
7
|
+
"declaration": false /* Generates corresponding '.d.ts' file. */,
|
|
8
|
+
"outDir": "./dist", // Output to dist folder
|
|
9
|
+
"removeComments": true /* Do not emit comments to output. */,
|
|
10
|
+
"importHelpers": true /* Import emit helpers from 'tslib'. */
|
|
11
|
+
},
|
|
12
|
+
"include": ["**/**.ts", "**/*.vue"],
|
|
13
|
+
"exclude": ["./dist", "../slim-select/*"]
|
|
14
|
+
}
|