@stonecrop/beam 0.2.6 → 0.2.7
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/package.json +23 -9
- package/src/{ActionFooter.vue → components/ActionFooter.vue} +6 -8
- package/src/{BeamModal.vue → components/BeamModal.vue} +5 -6
- package/src/components/BeamModalOutlet.vue +14 -0
- package/src/components/Confirm.vue +7 -0
- package/src/{ItemCheck.vue → components/ItemCheck.vue} +15 -21
- package/src/components/ItemCount.vue +41 -0
- package/src/components/ListAnchor.vue +14 -0
- package/src/{ListItem.vue → components/ListItem.vue} +14 -14
- package/src/components/ListView.vue +53 -0
- package/src/{Navbar.vue → components/Navbar.vue} +6 -8
- package/src/components/ScanInput.vue +33 -0
- package/src/histoire.setup.ts +30 -0
- package/src/index.ts +42 -0
- package/src/shims-vue.d.ts +5 -0
- package/src/BeamModalOutlet.vue +0 -8
- package/src/Confirm.vue +0 -20
- package/src/ItemCount.vue +0 -62
- package/src/ListAnchor.vue +0 -17
- package/src/ListView.vue +0 -47
- package/src/ScanInput.vue +0 -35
- package/src/index.js +0 -53
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/beam",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
@@ -17,12 +17,13 @@
|
|
|
17
17
|
},
|
|
18
18
|
"exports": {
|
|
19
19
|
".": {
|
|
20
|
-
"import": "./dist/beam
|
|
21
|
-
"require": "./dist/beam
|
|
22
|
-
}
|
|
20
|
+
"import": "./dist/beam.js",
|
|
21
|
+
"require": "./dist/beam.umd.cjs"
|
|
22
|
+
},
|
|
23
|
+
"./styles": "./dist/style.css"
|
|
23
24
|
},
|
|
24
|
-
"main": "
|
|
25
|
-
"module": "
|
|
25
|
+
"main": "dist/beam.js",
|
|
26
|
+
"module": "dist/beam.js",
|
|
26
27
|
"files": [
|
|
27
28
|
"dist/*",
|
|
28
29
|
"src/*"
|
|
@@ -32,8 +33,17 @@
|
|
|
32
33
|
"vue": "^3.4.23"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
36
|
+
"@histoire/plugin-vue": "^0.17.17",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^7.6.0",
|
|
38
|
+
"@typescript-eslint/parser": "^7.6.0",
|
|
35
39
|
"@vitejs/plugin-vue": "^5.0.4",
|
|
36
40
|
"cypress": "^12.11.0",
|
|
41
|
+
"eslint": "^8.40.0",
|
|
42
|
+
"eslint-config-prettier": "^8.8.0",
|
|
43
|
+
"eslint-plugin-vue": "^9.11.1",
|
|
44
|
+
"histoire": "^0.17.17",
|
|
45
|
+
"sass": "^1.75.0",
|
|
46
|
+
"typescript": "^5.4.5",
|
|
37
47
|
"vite": "^5.2.9",
|
|
38
48
|
"vue-router": "^4"
|
|
39
49
|
},
|
|
@@ -44,8 +54,12 @@
|
|
|
44
54
|
"node": ">=20.11.0"
|
|
45
55
|
},
|
|
46
56
|
"scripts": {
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
57
|
+
"build": "tsc -b && vite build",
|
|
58
|
+
"dev": "vite",
|
|
59
|
+
"lint": "eslint . --ext .ts,.vue",
|
|
60
|
+
"preview": "vite preview",
|
|
61
|
+
"story:build": "histoire build",
|
|
62
|
+
"story:dev": "histoire dev",
|
|
63
|
+
"story:preview": "histoire preview"
|
|
50
64
|
}
|
|
51
65
|
}
|
|
@@ -7,13 +7,11 @@
|
|
|
7
7
|
</span>
|
|
8
8
|
</footer>
|
|
9
9
|
</template>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
},
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
const emit = defineEmits(['click'])
|
|
13
|
+
|
|
14
|
+
const handleFooterAction = () => {
|
|
15
|
+
emit('click')
|
|
18
16
|
}
|
|
19
17
|
</script>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<portal-target name="beam__modal_outlet" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
const emit = defineEmits(['confirmmodal', 'closemodal'])
|
|
7
|
+
|
|
8
|
+
const confirmModal = () => {
|
|
9
|
+
emit('confirmmodal')
|
|
10
|
+
}
|
|
11
|
+
const closeModal = () => {
|
|
12
|
+
emit('closemodal')
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
@@ -4,27 +4,21 @@
|
|
|
4
4
|
<div class="checkmark" tabindex="0"></div>
|
|
5
5
|
</label>
|
|
6
6
|
</template>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
methods: {
|
|
24
|
-
handleInput(e) {
|
|
25
|
-
this.$emit('input', this.checked)
|
|
26
|
-
},
|
|
27
|
-
},
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import { ref } from 'vue'
|
|
10
|
+
|
|
11
|
+
// make this v-model sensitive from parent
|
|
12
|
+
const props = defineProps<{
|
|
13
|
+
value?: boolean
|
|
14
|
+
}>()
|
|
15
|
+
|
|
16
|
+
const emit = defineEmits(['input'])
|
|
17
|
+
|
|
18
|
+
const checked = ref(props.value)
|
|
19
|
+
|
|
20
|
+
const handleInput = (e: InputEvent) => {
|
|
21
|
+
emit('input', checked.value)
|
|
28
22
|
}
|
|
29
23
|
</script>
|
|
30
24
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="beam__itemcount">
|
|
3
|
+
<span
|
|
4
|
+
:contenteditable="editable"
|
|
5
|
+
:class="{ alert: countColor === false }"
|
|
6
|
+
@input="handleInput"
|
|
7
|
+
@click="handleInput">
|
|
8
|
+
{{ count }}
|
|
9
|
+
</span>
|
|
10
|
+
<span>/{{ denominator }}</span>
|
|
11
|
+
<span v-if="uom"> {{ uom }}</span>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { ref, computed } from 'vue'
|
|
17
|
+
|
|
18
|
+
const emit = defineEmits(['input'])
|
|
19
|
+
const props = withDefaults(
|
|
20
|
+
defineProps<{
|
|
21
|
+
value?: number
|
|
22
|
+
denominator: number
|
|
23
|
+
uom?: string
|
|
24
|
+
editable?: boolean
|
|
25
|
+
}>(),
|
|
26
|
+
{ value: 0, editable: true, uom: '' }
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
const count = ref(props.value)
|
|
30
|
+
|
|
31
|
+
const handleInput = (event: InputEvent | MouseEvent) => {
|
|
32
|
+
event.preventDefault()
|
|
33
|
+
event.stopPropagation()
|
|
34
|
+
count.value = Number(event.target.innerHTML.replace(/[^0-9]/g, ''))
|
|
35
|
+
emit('input', count.value)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const countColor = computed(() => {
|
|
39
|
+
return count.value === props.denominator
|
|
40
|
+
})
|
|
41
|
+
</script>
|
|
@@ -14,21 +14,21 @@
|
|
|
14
14
|
<ItemCheck v-if="item.hasOwnProperty('checked')" v-model="item.checked" />
|
|
15
15
|
</li>
|
|
16
16
|
</template>
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
<script setup lang="ts">
|
|
18
19
|
import ItemCount from './ItemCount.vue'
|
|
19
20
|
import ItemCheck from './ItemCheck.vue'
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
22
|
+
defineProps<{
|
|
23
|
+
item: {
|
|
24
|
+
label: string
|
|
25
|
+
description: string
|
|
26
|
+
count?: {
|
|
27
|
+
count: number
|
|
28
|
+
of: number
|
|
29
|
+
uom: string
|
|
30
|
+
}
|
|
31
|
+
checked?: boolean
|
|
32
|
+
}
|
|
33
|
+
}>()
|
|
34
34
|
</script>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ul class="beam__listview">
|
|
3
|
+
<li v-for="(item, index) in items" :key="index">
|
|
4
|
+
<template v-if="item.linkComponent">
|
|
5
|
+
<component :is="item.linkComponent" :to="item.route" tabindex="-1">
|
|
6
|
+
<ListItem :item="item"></ListItem>
|
|
7
|
+
</component>
|
|
8
|
+
</template>
|
|
9
|
+
<template v-else>
|
|
10
|
+
<ListItem :item="item"></ListItem>
|
|
11
|
+
</template>
|
|
12
|
+
</li>
|
|
13
|
+
</ul>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
import { onMounted, onUnmounted } from 'vue'
|
|
18
|
+
|
|
19
|
+
import ListItem from './ListItem.vue'
|
|
20
|
+
|
|
21
|
+
defineProps<{
|
|
22
|
+
items: {
|
|
23
|
+
label: string
|
|
24
|
+
description: string
|
|
25
|
+
count?: {
|
|
26
|
+
count: number
|
|
27
|
+
of: number
|
|
28
|
+
uom: string
|
|
29
|
+
}
|
|
30
|
+
checked?: boolean
|
|
31
|
+
linkComponent?: string
|
|
32
|
+
route?: string
|
|
33
|
+
}[]
|
|
34
|
+
}>()
|
|
35
|
+
|
|
36
|
+
const emit = defineEmits(['scrollbottom'])
|
|
37
|
+
|
|
38
|
+
onMounted(() => {
|
|
39
|
+
window.addEventListener('scroll', handleScroll)
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
onUnmounted(() => {
|
|
43
|
+
window.removeEventListener('scroll', handleScroll)
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const handleScroll = () => {
|
|
47
|
+
const scrollHeightDifference = document.documentElement.scrollHeight - window.innerHeight
|
|
48
|
+
const scrollposition = document.documentElement.scrollTop
|
|
49
|
+
if (scrollHeightDifference - scrollposition <= 2) {
|
|
50
|
+
emit('scrollbottom')
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
</script>
|
|
@@ -13,13 +13,11 @@
|
|
|
13
13
|
</div>
|
|
14
14
|
</nav>
|
|
15
15
|
</template>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
},
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
const emit = defineEmits(['click'])
|
|
19
|
+
|
|
20
|
+
const handlePrimaryAction = () => {
|
|
21
|
+
emit('click')
|
|
24
22
|
}
|
|
25
23
|
</script>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="scan_input"></div>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { ref, onMounted, onUnmounted } from 'vue'
|
|
7
|
+
|
|
8
|
+
const emit = defineEmits(['scaninput'])
|
|
9
|
+
const barcode = ref('')
|
|
10
|
+
|
|
11
|
+
const handleScanInput = (event: InputEvent | KeyboardEvent) => {
|
|
12
|
+
if (event.target.tagName !== 'INPUT') {
|
|
13
|
+
if (event.key !== 'Enter') {
|
|
14
|
+
barcode.value += `${event.key}`
|
|
15
|
+
} else {
|
|
16
|
+
emit('scaninput', barcode.value)
|
|
17
|
+
barcode.value = ''
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
onMounted(() => {
|
|
23
|
+
document.addEventListener('keypress', event => {
|
|
24
|
+
handleScanInput(event)
|
|
25
|
+
})
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
onUnmounted(() => {
|
|
29
|
+
window.removeEventListener('keypress', event => {
|
|
30
|
+
handleScanInput(event)
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
</script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineSetupVue3 } from '@histoire/plugin-vue'
|
|
2
|
+
|
|
3
|
+
import ActionFooter from '@/components/ActionFooter.vue'
|
|
4
|
+
import BeamModal from '@/components/BeamModal.vue'
|
|
5
|
+
import BeamModalOutlet from '@/components/BeamModalOutlet.vue'
|
|
6
|
+
import Confirm from '@/components/Confirm.vue'
|
|
7
|
+
import ItemCheck from '@/components/ItemCheck.vue'
|
|
8
|
+
import ItemCount from '@/components/ItemCount.vue'
|
|
9
|
+
import ListAnchor from '@/components/ListAnchor.vue'
|
|
10
|
+
import ListItem from '@/components/ListItem.vue'
|
|
11
|
+
import ListView from '@/components/ListView.vue'
|
|
12
|
+
import Navbar from '@/components/Navbar.vue'
|
|
13
|
+
import ScanInput from '@/components/ScanInput.vue'
|
|
14
|
+
import PortalVue from 'portal-vue'
|
|
15
|
+
|
|
16
|
+
export const setupVue3 = defineSetupVue3(({ app }) => {
|
|
17
|
+
app.use(PortalVue)
|
|
18
|
+
|
|
19
|
+
app.component('ActionFooter', ActionFooter)
|
|
20
|
+
app.component('BeamModal', BeamModal)
|
|
21
|
+
app.component('BeamModalOutlet', BeamModalOutlet)
|
|
22
|
+
app.component('Confirm', Confirm)
|
|
23
|
+
app.component('ItemCheck', ItemCheck)
|
|
24
|
+
app.component('ItemCount', ItemCount)
|
|
25
|
+
app.component('ListAnchor', ListAnchor)
|
|
26
|
+
app.component('ListItem', ListItem)
|
|
27
|
+
app.component('ListView', ListView)
|
|
28
|
+
app.component('Navbar', Navbar)
|
|
29
|
+
app.component('ScanInput', ScanInput)
|
|
30
|
+
})
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { App } from 'vue'
|
|
2
|
+
|
|
3
|
+
import ActionFooter from '@/components/ActionFooter.vue'
|
|
4
|
+
import BeamModal from '@/components/BeamModal.vue'
|
|
5
|
+
import BeamModalOutlet from '@/components/BeamModalOutlet.vue'
|
|
6
|
+
import Confirm from '@/components/Confirm.vue'
|
|
7
|
+
import ItemCheck from '@/components/ItemCheck.vue'
|
|
8
|
+
import ItemCount from '@/components/ItemCount.vue'
|
|
9
|
+
import ListAnchor from '@/components/ListAnchor.vue'
|
|
10
|
+
import ListItem from '@/components/ListItem.vue'
|
|
11
|
+
import ListView from '@/components/ListView.vue'
|
|
12
|
+
import Navbar from '@/components/Navbar.vue'
|
|
13
|
+
import ScanInput from '@/components/ScanInput.vue'
|
|
14
|
+
|
|
15
|
+
function install(app: App /* options */) {
|
|
16
|
+
app.component('ActionFooter', ActionFooter)
|
|
17
|
+
app.component('BeamModal', BeamModal)
|
|
18
|
+
app.component('BeamModalOutlet', BeamModalOutlet)
|
|
19
|
+
app.component('Confirm', Confirm)
|
|
20
|
+
app.component('ItemCheck', ItemCheck)
|
|
21
|
+
app.component('ItemCount', ItemCount)
|
|
22
|
+
app.component('ListAnchor', ListAnchor)
|
|
23
|
+
app.component('ListItem', ListItem)
|
|
24
|
+
app.component('ListView', ListView)
|
|
25
|
+
app.component('Navbar', Navbar)
|
|
26
|
+
app.component('ScanInput', ScanInput)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
ActionFooter,
|
|
31
|
+
BeamModal,
|
|
32
|
+
BeamModalOutlet,
|
|
33
|
+
Confirm,
|
|
34
|
+
ItemCheck,
|
|
35
|
+
ItemCount,
|
|
36
|
+
ListAnchor,
|
|
37
|
+
ListItem,
|
|
38
|
+
ListView,
|
|
39
|
+
Navbar,
|
|
40
|
+
ScanInput,
|
|
41
|
+
install,
|
|
42
|
+
}
|
package/src/BeamModalOutlet.vue
DELETED
package/src/Confirm.vue
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="beam__modal-confirm">
|
|
3
|
-
<h2>Would you like to continue?</h2>
|
|
4
|
-
<button class="btn" @click="confirmModal">Yes</button>
|
|
5
|
-
<button class="btn" @click="closeModal">No</button>
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
<script>
|
|
9
|
-
export default {
|
|
10
|
-
name: 'ConfirmDialog',
|
|
11
|
-
methods: {
|
|
12
|
-
confirmModal() {
|
|
13
|
-
this.$emit('confirmmodal')
|
|
14
|
-
},
|
|
15
|
-
closeModal() {
|
|
16
|
-
this.$emit('closemodal')
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
}
|
|
20
|
-
</script>
|
package/src/ItemCount.vue
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="beam__itemcount">
|
|
3
|
-
<span
|
|
4
|
-
:contenteditable="editable"
|
|
5
|
-
:class="{ alert: countColor === false }"
|
|
6
|
-
@input="handleInput($event)"
|
|
7
|
-
@click="handleInput($event)"
|
|
8
|
-
>{{ count }}</span
|
|
9
|
-
>
|
|
10
|
-
<span>/{{ denominator }}</span
|
|
11
|
-
><span v-if="uom"> {{ uom }}</span>
|
|
12
|
-
</div>
|
|
13
|
-
</template>
|
|
14
|
-
<script>
|
|
15
|
-
export default {
|
|
16
|
-
name: 'ItemCount',
|
|
17
|
-
props: {
|
|
18
|
-
value: {
|
|
19
|
-
type: Number,
|
|
20
|
-
required: false,
|
|
21
|
-
default: 0,
|
|
22
|
-
},
|
|
23
|
-
denominator: {
|
|
24
|
-
type: Number,
|
|
25
|
-
required: true,
|
|
26
|
-
},
|
|
27
|
-
uom: {
|
|
28
|
-
type: String,
|
|
29
|
-
required: false,
|
|
30
|
-
default: null,
|
|
31
|
-
},
|
|
32
|
-
editable: {
|
|
33
|
-
type: Boolean,
|
|
34
|
-
required: false,
|
|
35
|
-
default: false,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
data() {
|
|
39
|
-
return {
|
|
40
|
-
count: this.value,
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
methods: {
|
|
44
|
-
handleInput(event) {
|
|
45
|
-
event.preventDefault()
|
|
46
|
-
event.stopPropagation()
|
|
47
|
-
this.count = Number(event.target.innerHTML.replace(/[^0-9]/g, ''))
|
|
48
|
-
this.$emit('input', this.count)
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
computed: {
|
|
52
|
-
countColor() {
|
|
53
|
-
return this.count === this.denominator
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
watch: {
|
|
57
|
-
value() {
|
|
58
|
-
this.count = this.value
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
}
|
|
62
|
-
</script>
|
package/src/ListAnchor.vue
DELETED
package/src/ListView.vue
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ul class="beam__listview">
|
|
3
|
-
<li v-for="(item, index) in items" :key="index">
|
|
4
|
-
<template v-if="item.linkComponent">
|
|
5
|
-
<component :is="item.linkComponent" :to="item.route" tabindex="-1">
|
|
6
|
-
<ListItem :item="item"></ListItem>
|
|
7
|
-
</component>
|
|
8
|
-
</template>
|
|
9
|
-
<template v-else>
|
|
10
|
-
<ListItem :item="item"></ListItem>
|
|
11
|
-
</template>
|
|
12
|
-
</li>
|
|
13
|
-
</ul>
|
|
14
|
-
</template>
|
|
15
|
-
<script>
|
|
16
|
-
import ListAnchor from './ListAnchor.vue'
|
|
17
|
-
import ListItem from './ListItem.vue'
|
|
18
|
-
|
|
19
|
-
export default {
|
|
20
|
-
name: 'ListView',
|
|
21
|
-
components: {
|
|
22
|
-
ListItem,
|
|
23
|
-
ListAnchor,
|
|
24
|
-
},
|
|
25
|
-
props: {
|
|
26
|
-
items: {
|
|
27
|
-
type: Array,
|
|
28
|
-
required: true,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
created() {
|
|
32
|
-
window.addEventListener('scroll', this.handleScroll)
|
|
33
|
-
},
|
|
34
|
-
destroyed() {
|
|
35
|
-
window.removeEventListener('scroll', this.handleScroll)
|
|
36
|
-
},
|
|
37
|
-
methods: {
|
|
38
|
-
handleScroll() {
|
|
39
|
-
const scrollHeightDifference = document.documentElement.scrollHeight - window.innerHeight
|
|
40
|
-
const scrollposition = document.documentElement.scrollTop
|
|
41
|
-
if (scrollHeightDifference - scrollposition <= 2) {
|
|
42
|
-
this.$emit('scrollbottom')
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
}
|
|
47
|
-
</script>
|
package/src/ScanInput.vue
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div id="scan_input"></div>
|
|
3
|
-
</template>
|
|
4
|
-
<script>
|
|
5
|
-
export default {
|
|
6
|
-
name: 'ScanInput',
|
|
7
|
-
data() {
|
|
8
|
-
return {
|
|
9
|
-
barcode: '',
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
methods: {
|
|
13
|
-
handleScanInput(event) {
|
|
14
|
-
if (event.target.tagName !== 'INPUT') {
|
|
15
|
-
if (event.key !== 'Enter') {
|
|
16
|
-
this.barcode += `${event.key}`
|
|
17
|
-
} else {
|
|
18
|
-
this.$emit('scaninput', this.barcode)
|
|
19
|
-
this.barcode = ''
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
mounted() {
|
|
25
|
-
document.addEventListener('keypress', event => {
|
|
26
|
-
this.handleScanInput(event)
|
|
27
|
-
})
|
|
28
|
-
},
|
|
29
|
-
destroyed() {
|
|
30
|
-
window.removeEventListener('keypress', event => {
|
|
31
|
-
this.handleScanInput(event)
|
|
32
|
-
})
|
|
33
|
-
},
|
|
34
|
-
}
|
|
35
|
-
</script>
|
package/src/index.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import Navbar from './Navbar.vue'
|
|
2
|
-
import ListView from './ListView.vue'
|
|
3
|
-
import ListItem from './ListItem.vue'
|
|
4
|
-
import ListAnchor from './ListAnchor.vue'
|
|
5
|
-
import ItemCount from './ItemCount.vue'
|
|
6
|
-
import ItemCheck from './ItemCheck.vue'
|
|
7
|
-
import ScanInput from './ScanInput.vue'
|
|
8
|
-
import ActionFooter from './ActionFooter.vue'
|
|
9
|
-
import BeamModal from './BeamModal.vue'
|
|
10
|
-
import BeamModalOutlet from './BeamModalOutlet.vue'
|
|
11
|
-
import ConfirmDialog from './Confirm.vue'
|
|
12
|
-
import PortalVue from 'portal-vue'
|
|
13
|
-
|
|
14
|
-
const components = [
|
|
15
|
-
Navbar,
|
|
16
|
-
ListView,
|
|
17
|
-
ListItem,
|
|
18
|
-
ListAnchor,
|
|
19
|
-
ItemCount,
|
|
20
|
-
ItemCheck,
|
|
21
|
-
ScanInput,
|
|
22
|
-
ActionFooter,
|
|
23
|
-
BeamModal,
|
|
24
|
-
ConfirmDialog,
|
|
25
|
-
BeamModalOutlet,
|
|
26
|
-
]
|
|
27
|
-
|
|
28
|
-
const install = function (Vue, opts = {}) {
|
|
29
|
-
Vue.use(PortalVue)
|
|
30
|
-
components.forEach(component => {
|
|
31
|
-
Vue.component(component.name, component)
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (typeof window !== 'undefined' && window.Vue) {
|
|
36
|
-
install(window.Vue)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default {
|
|
40
|
-
version: '0.1.0',
|
|
41
|
-
install,
|
|
42
|
-
Navbar,
|
|
43
|
-
ListView,
|
|
44
|
-
ListItem,
|
|
45
|
-
ListAnchor,
|
|
46
|
-
ItemCount,
|
|
47
|
-
ItemCheck,
|
|
48
|
-
ScanInput,
|
|
49
|
-
ActionFooter,
|
|
50
|
-
BeamModal,
|
|
51
|
-
ConfirmDialog,
|
|
52
|
-
BeamModalOutlet,
|
|
53
|
-
}
|