Skip to content

Commit 0779bc4

Browse files
committed
Merge branch 'develop'
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
2 parents e06c7ad + 54f77f2 commit 0779bc4

File tree

25 files changed

+701
-602
lines changed

25 files changed

+701
-602
lines changed

components.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ declare module 'vue' {
2020
AppColorPicker: typeof import('./src/components/ui/AppColorPicker.vue')['default']
2121
AppColumnPicker: typeof import('./src/components/ui/AppColumnPicker.vue')['default']
2222
AppDialog: typeof import('./src/components/ui/AppDialog.vue')['default']
23+
AppDraggable: typeof import('./src/components/ui/AppDraggable.vue')['default']
2324
AppDragOverlay: typeof import('./src/components/ui/AppDragOverlay.vue')['default']
2425
AppFocusableContainer: typeof import('./src/components/ui/AppFocusableContainer.vue')['default']
2526
AppFooter: typeof import('./src/components/layout/AppFooter.vue')['default']

package-lock.json

Lines changed: 312 additions & 341 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
"main": "index.js",
3535
"dependencies": {
36-
"@ctrl/tinycolor": "^3.6.0",
36+
"@ctrl/tinycolor": "^4.0.2",
3737
"@fontsource/raleway": "^5.0.8",
3838
"@fontsource/roboto": "^5.0.8",
3939
"@jaames/iro": "^5.5.2",
@@ -43,7 +43,7 @@
4343
"dompurify": "^3.0.5",
4444
"echarts": "^5.4.3",
4545
"echarts-gl": "^2.0.9",
46-
"hls.js": "^1.4.10",
46+
"hls.js": "^1.4.12",
4747
"jwt-decode": "^3.1.2",
4848
"lodash-es": "^4.17.21",
4949
"md5": "^2.3.0",
@@ -68,7 +68,6 @@
6868
"vue-property-decorator": "^9.1.2",
6969
"vue-router": "^3.6.5",
7070
"vue-virtual-scroller": "^1.1.2",
71-
"vuedraggable": "^2.24.3",
7271
"vuetify": "^2.7.1",
7372
"vuetify-confirm": "^2.0.6",
7473
"vuex": "^3.6.2"
@@ -77,21 +76,21 @@
7776
"@mdi/js": "^7.2.96",
7877
"@originjs/vite-plugin-content": "^1.0.3",
7978
"@types/dompurify": "^3.0.2",
80-
"@types/jsdom": "^21.1.1",
81-
"@types/lodash-es": "^4.17.8",
79+
"@types/jsdom": "^21.1.2",
80+
"@types/lodash-es": "^4.17.9",
8281
"@types/md5": "^2.3.2",
83-
"@types/node": "^18.17.4",
84-
"@types/semver": "^7.5.0",
85-
"@types/sortablejs": "^1.15.1",
86-
"@types/uuid": "^9.0.2",
82+
"@types/node": "^18.17.15",
83+
"@types/semver": "^7.5.1",
84+
"@types/sortablejs": "^1.15.2",
85+
"@types/uuid": "^9.0.3",
8786
"@typescript-eslint/eslint-plugin": "^5.62.0",
8887
"@typescript-eslint/parser": "^5.62.0",
8988
"@vitejs/plugin-vue2": "^2.2.0",
9089
"@vue/eslint-config-standard": "^8.0.1",
9190
"@vue/eslint-config-typescript": "^11.0.3",
9291
"@vue/test-utils": "^1.3.6",
9392
"@vue/tsconfig": "^0.1.3",
94-
"eslint": "^8.46.0",
93+
"eslint": "^8.49.0",
9594
"eslint-plugin-vue": "^9.17.0",
9695
"husky": "^8.0.3",
9796
"jsdom": "^22.1.0",
@@ -101,17 +100,17 @@
101100
"sass": "~1.32",
102101
"shx": "^0.3.4",
103102
"standard-version": "^9.5.0",
104-
"typescript": "^5.1.6",
105-
"unplugin-vue-components": "^0.25.1",
103+
"typescript": "^5.2.2",
104+
"unplugin-vue-components": "^0.25.2",
106105
"vite": "^4.4.9",
107-
"vite-plugin-checker": "^0.6.1",
106+
"vite-plugin-checker": "^0.6.2",
108107
"vite-plugin-monaco-editor": "^1.1.0",
109-
"vite-plugin-pwa": "^0.16.4",
110-
"vitest": "^0.34.1",
108+
"vite-plugin-pwa": "^0.16.5",
109+
"vitest": "^0.34.4",
111110
"vue-debounce-decorator": "^1.0.1",
112111
"vue-i18n-extract": "^2.0.7",
113112
"vue-template-compiler": "^2.7.14",
114-
"vue-tsc": "^1.8.8"
113+
"vue-tsc": "^1.8.10"
115114
},
116115
"_id": "fluidd@0.0.3",
117116
"bugs": {

src/components/settings/macros/MacroSettings.vue

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,21 @@
5555
</app-setting>
5656

5757
<v-divider />
58-
<draggable
58+
59+
<app-draggable
5960
v-model="macros"
60-
v-bind="dragOptions"
61+
:options="{
62+
animation: 200,
63+
handle: '.handle',
64+
group: `macro-settings-${category.name}`,
65+
ghostClass: 'ghost'
66+
}"
6167
>
6268
<section
6369
v-for="(macro, i) in macros"
6470
:key="macro.name"
6571
>
6672
<app-setting
67-
:key="`macro-${macro.name}`"
6873
:accent-color="macro.color"
6974
:r-cols="2"
7075
@click="handleSettingsDialog(macro)"
@@ -101,10 +106,9 @@
101106

102107
<v-divider
103108
v-if="i < macros.length - 1 && macros.length > 0"
104-
:key="`divider-${macro.name}`"
105109
/>
106110
</section>
107-
</draggable>
111+
</app-draggable>
108112
</v-card>
109113

110114
<macro-settings-dialog
@@ -117,7 +121,6 @@
117121

118122
<script lang="ts">
119123
import { Component, Vue } from 'vue-property-decorator'
120-
import draggable from 'vuedraggable'
121124
import MacroSettingsDialog from './MacroSettingsDialog.vue'
122125
import { Macro, MacroCategory } from '@/store/macros/types'
123126
import store from '@/store'
@@ -134,8 +137,7 @@ const routeGuard = (to: any) => {
134137
135138
@Component({
136139
components: {
137-
MacroSettingsDialog,
138-
draggable
140+
MacroSettingsDialog
139141
}
140142
})
141143
export default class MacroSettings extends Vue {
@@ -147,15 +149,6 @@ export default class MacroSettings extends Vue {
147149
macro: null
148150
}
149151
150-
get dragOptions () {
151-
return {
152-
animation: 200,
153-
handle: '.handle',
154-
group: `macro-settings-${this.category.name}`,
155-
ghostClass: 'ghost'
156-
}
157-
}
158-
159152
get macros () {
160153
const id = this.categoryId
161154
const macros = this.$store.getters['macros/getMacrosByCategory'](id)

src/components/ui/AppDraggable.vue

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
<template>
2+
<div>
3+
<slot />
4+
</div>
5+
</template>
6+
7+
<script lang="ts">
8+
import { Component, Prop, VModel, Vue, Watch } from 'vue-property-decorator'
9+
import Sortable from 'sortablejs'
10+
11+
const instanceKey = Symbol('instanceKey')
12+
13+
type TargetHtmlElement = HTMLElement & {
14+
[instanceKey]: AppDraggable | null
15+
}
16+
17+
const isTargetHtmlElement = (element: HTMLElement): element is TargetHtmlElement => instanceKey in element
18+
19+
@Component({})
20+
export default class AppDraggable extends Vue {
21+
@VModel({ type: Array, default: [] })
22+
items!: unknown[]
23+
24+
@Prop({ type: Object })
25+
readonly options?: Sortable.Options
26+
27+
@Prop({ type: String })
28+
readonly target?: string
29+
30+
@Watch('options')
31+
onOptions (value: Sortable.Options) {
32+
if (this.sortable) {
33+
for (const prop in value) {
34+
const propAsOptionsKey = prop as keyof Sortable.Options
35+
36+
this.sortable.option(propAsOptionsKey, value[propAsOptionsKey])
37+
}
38+
}
39+
}
40+
41+
@Watch('target')
42+
onTarget () {
43+
this.dettach()
44+
this.attach()
45+
}
46+
47+
sortable: Sortable | null = null
48+
49+
handleStart (event: Sortable.SortableEvent) {
50+
this.$emit('start', event)
51+
}
52+
53+
handleAdd (event: Sortable.SortableEvent) {
54+
const { oldIndex, newIndex, from } = event
55+
56+
if (
57+
oldIndex === undefined ||
58+
newIndex === undefined ||
59+
!isTargetHtmlElement(from) ||
60+
from[instanceKey] === null
61+
) {
62+
return
63+
}
64+
65+
const fromInstance = from[instanceKey]
66+
67+
const items = [...this.items]
68+
69+
items.splice(newIndex, 0, fromInstance.items[oldIndex])
70+
71+
this.items = items
72+
73+
this.$emit('add', event)
74+
}
75+
76+
handleRemove (event: Sortable.SortableEvent) {
77+
const { oldIndex } = event
78+
79+
if (oldIndex === undefined) {
80+
return
81+
}
82+
83+
const items = [...this.items]
84+
85+
items.splice(oldIndex, 1)
86+
87+
this.items = items
88+
89+
this.$emit('remove', event)
90+
}
91+
92+
handleUpdate (event: Sortable.SortableEvent) {
93+
const { oldIndex, newIndex } = event
94+
95+
if (
96+
oldIndex === undefined ||
97+
newIndex === undefined
98+
) {
99+
return
100+
}
101+
102+
const items = [...this.items]
103+
104+
const movedItem = items.splice(oldIndex, 1)[0]
105+
items.splice(newIndex, 0, movedItem)
106+
107+
this.items = items
108+
109+
this.$emit('update', event)
110+
}
111+
112+
handleEnd (event: Sortable.SortableEvent) {
113+
this.$emit('end', event)
114+
}
115+
116+
attach () {
117+
const targetElement = (
118+
this.target &&
119+
this.$el.querySelector<TargetHtmlElement>(this.target)
120+
) || this.$el as TargetHtmlElement
121+
122+
targetElement[instanceKey] = this
123+
124+
const options: Sortable.Options = {
125+
...this.options,
126+
onStart: this.handleStart,
127+
onAdd: this.handleAdd,
128+
onRemove: this.handleRemove,
129+
onUpdate: this.handleUpdate,
130+
onEnd: this.handleEnd
131+
}
132+
133+
this.sortable = Sortable.create(targetElement, options)
134+
}
135+
136+
dettach () {
137+
const targetElement = this.sortable?.el
138+
139+
if (targetElement && isTargetHtmlElement(targetElement)) {
140+
targetElement[instanceKey] = null
141+
}
142+
143+
this.sortable?.destroy()
144+
this.sortable = null
145+
}
146+
147+
mounted () {
148+
this.attach()
149+
}
150+
151+
unmounted () {
152+
this.dettach()
153+
}
154+
}
155+
</script>

src/components/widgets/filesystem/FileSystemBrowser.vue

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ import { AppTableHeader } from '@/types'
288288
import FilesMixin from '@/mixins/files'
289289
290290
import FileRowItem from './FileRowItem.vue'
291+
import { SupportedImageFormats, SupportedVideoFormats } from '@/globals'
291292
292293
@Component({
293294
components: {
@@ -406,20 +407,15 @@ export default class FileSystemBrowser extends Mixins(FilesMixin) {
406407
)
407408
408409
if (item.type === 'file') {
409-
switch (item.extension) {
410-
case 'bmp':
411-
case 'gif':
412-
case 'jpg':
413-
case 'jpeg':
414-
case 'png':
415-
case 'tif':
416-
case 'tiff':
417-
case 'webp':
418-
return readonly ? '$fileImageLock' : '$fileImage'
419-
case 'zip':
420-
return readonly ? '$fileZipLock' : '$fileZip'
421-
default:
422-
return readonly ? '$fileLock' : '$file'
410+
if (item.extension === 'zip') {
411+
return readonly ? '$fileZipLock' : '$fileZip'
412+
} else if (
413+
SupportedImageFormats.includes(`.${item.extension}`) ||
414+
SupportedVideoFormats.includes(`.${item.extension}`)
415+
) {
416+
return readonly ? '$fileImageLock' : '$fileImage'
417+
} else {
418+
return readonly ? '$fileLock' : '$file'
423419
}
424420
} else if (item.name === '..') {
425421
return '$folderUp'

src/components/widgets/filesystem/FileSystemContextMenu.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,9 @@ export default class FileSystemContextMenu extends Mixins(StateMixin, FilesMixin
229229
return (
230230
!Array.isArray(this.file) &&
231231
this.file.type !== 'directory' &&
232-
!this.rootProperties.readonly &&
233232
(
234233
this.file.permissions === undefined ||
235-
this.file.permissions.includes('w')
234+
this.file.permissions.includes('r')
236235
)
237236
)
238237
}

0 commit comments

Comments
 (0)