@sigmaott/base-library-next 2.1.9
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/README.md +1 -0
- package/locales/en.yaml +289 -0
- package/locales/vi.yaml +294 -0
- package/nuxt.config.ts +18 -0
- package/package.json +33 -0
- package/public/routes.json +34 -0
- package/src/api/axios.ts +3 -0
- package/src/api/index.ts +86 -0
- package/src/api-client-library/.openapi-generator/FILES +20 -0
- package/src/api-client-library/.openapi-generator/VERSION +1 -0
- package/src/api-client-library/.openapi-generator-ignore +23 -0
- package/src/api-client-library/api/health-api.ts +119 -0
- package/src/api-client-library/api/presets-api.ts +599 -0
- package/src/api-client-library/api/profiles-api.ts +676 -0
- package/src/api-client-library/api.ts +20 -0
- package/src/api-client-library/base.ts +72 -0
- package/src/api-client-library/common.ts +150 -0
- package/src/api-client-library/configuration.ts +101 -0
- package/src/api-client-library/git_push.sh +57 -0
- package/src/api-client-library/index.ts +18 -0
- package/src/api-client-library/models/create-preset-dto.ts +223 -0
- package/src/api-client-library/models/create-profile-dto.ts +45 -0
- package/src/api-client-library/models/health-controller-get-health200-response-info-value.ts +32 -0
- package/src/api-client-library/models/health-controller-get-health200-response.ts +51 -0
- package/src/api-client-library/models/health-controller-get-health503-response.ts +51 -0
- package/src/api-client-library/models/index.ts +7 -0
- package/src/api-client-library/models/update-preset-dto.ts +223 -0
- package/src/api-client-library/models/update-profile-dto.ts +45 -0
- package/src/components/MediaSelection.vue +40 -0
- package/src/components/PresetModify.vue +154 -0
- package/src/components/PresetTable.vue +114 -0
- package/src/components/ProfileAllList.vue +137 -0
- package/src/components/ProfileFormModal.vue +79 -0
- package/src/components/ProfileModify.vue +152 -0
- package/src/components/ProfileTable.vue +68 -0
- package/src/components/WatermarkDraggableItem.vue +88 -0
- package/src/components/channel/ConfigWatermarkItem.vue +239 -0
- package/src/components/channel/WatermarkPreview.vue +19 -0
- package/src/components/common/Vue3DraggableResizable/Container.vue +71 -0
- package/src/components/common/Vue3DraggableResizable/index.vue +1327 -0
- package/src/components/common/Vue3DraggableResizable/utils/dom.js +63 -0
- package/src/components/common/Vue3DraggableResizable/utils/fns.js +37 -0
- package/src/components/common/VueDraggableResizable/dom.js +63 -0
- package/src/components/common/VueDraggableResizable/fns.js +37 -0
- package/src/components/common/VueDraggableResizable/index.vue +958 -0
- package/src/components/preset/ConfigItem.vue +956 -0
- package/src/components/profile/ConfigItem.vue +765 -0
- package/src/components/profile/TableColumns.vue +137 -0
- package/src/components/shared/AudioInfoViewer.vue +101 -0
- package/src/components/shared/MediaInfoViewer.vue +249 -0
- package/src/components/shared/MediaInfoViewerSmall.vue +105 -0
- package/src/components/shared/PopoverProfile.vue +17 -0
- package/src/components/shared/VideoInfoViewer.vue +136 -0
- package/src/components/shared/fileSizeFilter.ts +26 -0
- package/src/composables/preset.ts +141 -0
- package/src/public/apple-touch-icon-180x180.png +0 -0
- package/src/public/build-time.json +1 -0
- package/src/public/favicon.ico +0 -0
- package/src/public/favicon.svg +15 -0
- package/src/public/logo.png +0 -0
- package/src/public/logo.svg +9 -0
- package/src/public/maskable-icon-512x512.png +0 -0
- package/src/public/pwa-192x192.png +0 -0
- package/src/public/pwa-512x512.png +0 -0
- package/src/public/pwa-64x64.png +0 -0
- package/src/public/routes.json +87 -0
- package/src/utils/common.ts +175 -0
- package/src/utils/config.ts +19 -0
- package/src/utils/preset.ts +353 -0
- package/src/utils/profile.ts +30 -0
- package/tsconfig.json +3 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { normalizePreset } from '../utils/preset'
|
|
3
|
+
import { getPresets } from '../api'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
params: any
|
|
7
|
+
height?: string
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
const emit = defineEmits<{
|
|
11
|
+
(e: 'update:params', params: any): void
|
|
12
|
+
(e: 'select', preset: any): void
|
|
13
|
+
}>()
|
|
14
|
+
|
|
15
|
+
const params = useVModel(props, 'params', emit)
|
|
16
|
+
|
|
17
|
+
const _q = computed({
|
|
18
|
+
get: () => params.value.q,
|
|
19
|
+
set: (val) => {
|
|
20
|
+
params.value.q = val
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const q = useQueryParams(_q, {})
|
|
25
|
+
|
|
26
|
+
const { data, isLoading, refetch } = useQuery(
|
|
27
|
+
[QueryKeys.LibraryPreset, params],
|
|
28
|
+
async () => {
|
|
29
|
+
// return (await getProfiles(params, { params: { q: toReactive(q) } })).data
|
|
30
|
+
return (await getPresets(params.value)).data
|
|
31
|
+
},
|
|
32
|
+
)
|
|
33
|
+
const refreshForm = reactive({
|
|
34
|
+
enabled: true,
|
|
35
|
+
duration: 20,
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const tableData = computed(() => {
|
|
39
|
+
return data.value?.data.map(normalizePreset)
|
|
40
|
+
})
|
|
41
|
+
const tableRef = ref(null)
|
|
42
|
+
const paginationRef = ref(null)
|
|
43
|
+
|
|
44
|
+
function handleSizeChange(value: number) {
|
|
45
|
+
params.value.perPage = value
|
|
46
|
+
params.value.page = 1
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<el-table
|
|
52
|
+
v-bind="$attrs"
|
|
53
|
+
ref="tableRef"
|
|
54
|
+
v-loading="isLoading"
|
|
55
|
+
:data="tableData"
|
|
56
|
+
stripe border
|
|
57
|
+
class="w-ful my-16px flex-1"
|
|
58
|
+
:height="height"
|
|
59
|
+
@row-click="$emit('select', $event)"
|
|
60
|
+
>
|
|
61
|
+
<el-table-column prop="id" label="ID" width="60" fixed>
|
|
62
|
+
<template #default="{ row }">
|
|
63
|
+
<SSCopyButton :value="row.id" />
|
|
64
|
+
</template>
|
|
65
|
+
</el-table-column>
|
|
66
|
+
|
|
67
|
+
<el-table-column label="Name" prop="name" min-width="130">
|
|
68
|
+
<template #default="scope">
|
|
69
|
+
{{ scope.row.name }}
|
|
70
|
+
</template>
|
|
71
|
+
</el-table-column>
|
|
72
|
+
<el-table-column align="center" label="Type" prop="type" min-width="100">
|
|
73
|
+
<template #default="scope">
|
|
74
|
+
{{ scope.row.type }}
|
|
75
|
+
</template>
|
|
76
|
+
</el-table-column>
|
|
77
|
+
<el-table-column label="Information" prop="information" width="500">
|
|
78
|
+
<template #default="scope">
|
|
79
|
+
<SharedVideoInfoViewer v-if="scope.row.type === 'video'" :video="scope.row" />
|
|
80
|
+
|
|
81
|
+
<SharedAudioInfoViewer v-if="scope.row.type === 'audio'" :audio="scope.row" />
|
|
82
|
+
</template>
|
|
83
|
+
</el-table-column>
|
|
84
|
+
<el-table-column label="Option" prop="option" min-width="130">
|
|
85
|
+
<template #default="scope">
|
|
86
|
+
<div>{{ scope.row.option || '' }}</div>
|
|
87
|
+
</template>
|
|
88
|
+
</el-table-column>
|
|
89
|
+
<el-table-column label="Description" prop="description" min-width="130">
|
|
90
|
+
<template #default="scope">
|
|
91
|
+
<div>{{ scope.row.description }}</div>
|
|
92
|
+
</template>
|
|
93
|
+
</el-table-column>
|
|
94
|
+
<slot />
|
|
95
|
+
</el-table>
|
|
96
|
+
<div class="flex items-center justify-between">
|
|
97
|
+
<el-pagination
|
|
98
|
+
v-if="tableData"
|
|
99
|
+
ref="paginationRef"
|
|
100
|
+
v-model:current-page="params.page"
|
|
101
|
+
background
|
|
102
|
+
:page-sizes="[10, 15, 20, 50, 100]"
|
|
103
|
+
:page-size="params.perPage"
|
|
104
|
+
layout="total, sizes, prev, pager, next, jumper"
|
|
105
|
+
:total="data?.total || 0"
|
|
106
|
+
@size-change="handleSizeChange"
|
|
107
|
+
/>
|
|
108
|
+
<SSAutoRefresh
|
|
109
|
+
:duration="refreshForm.duration"
|
|
110
|
+
:enabled="refreshForm.enabled"
|
|
111
|
+
@on-refresh="refetch"
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
114
|
+
</template>
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { normalizeProfile } from '../utils/profile'
|
|
3
|
+
import { deleteProfile, getProfiles } from '../api'
|
|
4
|
+
import ProfileFormModal from './ProfileFormModal.vue'
|
|
5
|
+
|
|
6
|
+
const emit = defineEmits(['selectItem'])
|
|
7
|
+
const { t } = useI18n()
|
|
8
|
+
const route = useRoute()
|
|
9
|
+
const params = reactive({
|
|
10
|
+
...useRouteQueries({
|
|
11
|
+
page: 1,
|
|
12
|
+
perPage: 15,
|
|
13
|
+
q: '{}',
|
|
14
|
+
}),
|
|
15
|
+
populates: 'sigmaChannels',
|
|
16
|
+
sort: '',
|
|
17
|
+
})
|
|
18
|
+
const q = useQueryParams(toRef(params, 'q'), {})
|
|
19
|
+
|
|
20
|
+
const { data, isLoading, refetch } = useQuery(
|
|
21
|
+
[QueryKeys.LibraryProfile, params],
|
|
22
|
+
async () => {
|
|
23
|
+
return (await getProfiles(params)).data
|
|
24
|
+
},
|
|
25
|
+
)
|
|
26
|
+
const refreshForm = reactive({
|
|
27
|
+
enabled: true,
|
|
28
|
+
duration: 20,
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const tableData = computed(() => {
|
|
32
|
+
return data.value?.data.map(normalizeProfile)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
function handleSizeChange(value: number) {
|
|
36
|
+
params.perPage = value
|
|
37
|
+
params.page = 1
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let modifierFormMode = $ref<'create' | 'edit' | 'clone'>('create')
|
|
41
|
+
let isShowModifierForm = $ref(route.query.mode === 'create')
|
|
42
|
+
let edittingProfileId = $ref<string>()
|
|
43
|
+
|
|
44
|
+
function handleEdit(id: string) {
|
|
45
|
+
modifierFormMode = 'edit'
|
|
46
|
+
isShowModifierForm = true
|
|
47
|
+
edittingProfileId = id
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function handleClone(id: string) {
|
|
51
|
+
modifierFormMode = 'clone'
|
|
52
|
+
isShowModifierForm = true
|
|
53
|
+
edittingProfileId = id
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function handleDestroy(id: string) {
|
|
57
|
+
ElMessageBox.confirm('This will permanently delete the profile. Continue?', 'Warning', {
|
|
58
|
+
confirmButtonText: 'OK',
|
|
59
|
+
cancelButtonText: 'Cancel',
|
|
60
|
+
type: 'warning',
|
|
61
|
+
})
|
|
62
|
+
.then(async () => {
|
|
63
|
+
const res = await deleteProfile(id)
|
|
64
|
+
if (res) {
|
|
65
|
+
ElMessage({
|
|
66
|
+
message: 'Delete successful',
|
|
67
|
+
type: 'success',
|
|
68
|
+
})
|
|
69
|
+
refetch()
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
.catch(() => { })
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function handleAdd() {
|
|
76
|
+
modifierFormMode = 'create'
|
|
77
|
+
isShowModifierForm = true
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function selecteRow(row: any) {
|
|
81
|
+
emit('selectItem', row)
|
|
82
|
+
}
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<template>
|
|
86
|
+
<div class="flex items-center justify-between">
|
|
87
|
+
<div class="font-bold uppercase">
|
|
88
|
+
{{ t('Profile.list') }}
|
|
89
|
+
</div>
|
|
90
|
+
<el-button type="primary" @click="handleAdd">
|
|
91
|
+
<template #icon>
|
|
92
|
+
<div class="i-ep:plus" />
|
|
93
|
+
</template>
|
|
94
|
+
Add
|
|
95
|
+
</el-button>
|
|
96
|
+
</div>
|
|
97
|
+
<ProfileTable :is-loading="isLoading" :selecte-row="selecteRow" :table-data="tableData">
|
|
98
|
+
<el-table-column fixed="right" label="Action" align="center" width="200">
|
|
99
|
+
<template #default="scope">
|
|
100
|
+
<el-button-group>
|
|
101
|
+
<el-tooltip content="Edit">
|
|
102
|
+
<el-button type="primary" @click="handleEdit(scope.row.id)">
|
|
103
|
+
<template #icon>
|
|
104
|
+
<div class="i-ep:edit" />
|
|
105
|
+
</template>
|
|
106
|
+
</el-button>
|
|
107
|
+
</el-tooltip>
|
|
108
|
+
<el-tooltip content="Clone" placement="top-start">
|
|
109
|
+
<el-button type="warning" @click="handleClone(scope.row.id)">
|
|
110
|
+
<template #icon>
|
|
111
|
+
<div class="i-ep:document-copy" />
|
|
112
|
+
</template>
|
|
113
|
+
</el-button>
|
|
114
|
+
</el-tooltip>
|
|
115
|
+
<el-tooltip content="Delete">
|
|
116
|
+
<el-button type="danger" @click="handleDestroy(scope.row.id)">
|
|
117
|
+
<template #icon>
|
|
118
|
+
<div class="i-ep:delete" />
|
|
119
|
+
</template>
|
|
120
|
+
</el-button>
|
|
121
|
+
</el-tooltip>
|
|
122
|
+
</el-button-group>
|
|
123
|
+
</template>
|
|
124
|
+
</el-table-column>
|
|
125
|
+
</ProfileTable>
|
|
126
|
+
<div class="flex items-center justify-between">
|
|
127
|
+
<el-pagination
|
|
128
|
+
v-if="tableData" v-model:current-page="params.page" background
|
|
129
|
+
:page-sizes="[10, 20, 50, 100]" :page-size="params.perPage" layout="total, sizes, prev, pager, next, jumper"
|
|
130
|
+
:total="data?.total || 0" @size-change="handleSizeChange"
|
|
131
|
+
/>
|
|
132
|
+
|
|
133
|
+
<SSAutoRefresh :duration="10" enabled @on-refresh="refetch" />
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
<ProfileFormModal :id="edittingProfileId" v-model="isShowModifierForm" :mode="modifierFormMode" @on-refresh="refetch" />
|
|
137
|
+
</template>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { getProfile } from '../api'
|
|
3
|
+
import ProfileModify from './ProfileModify.vue'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
modelValue: boolean
|
|
7
|
+
mode: 'create' | 'edit' | 'clone'
|
|
8
|
+
id: string
|
|
9
|
+
}>()
|
|
10
|
+
|
|
11
|
+
const emit = defineEmits<{
|
|
12
|
+
(e: 'onRefresh'): void
|
|
13
|
+
}>()
|
|
14
|
+
|
|
15
|
+
const id = toRef(props, 'id')
|
|
16
|
+
const mode = toRef(props, 'mode')
|
|
17
|
+
|
|
18
|
+
const { data: profileDetail, isLoading } = useQuery(
|
|
19
|
+
[QueryKeys.LibraryProfile, id, mode],
|
|
20
|
+
async () => {
|
|
21
|
+
return (await getProfile(id.value!)).data
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
enabled: computed(() => !!id.value),
|
|
25
|
+
},
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
const { modelValue: visible } = defineModels<{
|
|
29
|
+
modelValue: boolean
|
|
30
|
+
}>()
|
|
31
|
+
|
|
32
|
+
const modifyTitle = computed(() => {
|
|
33
|
+
if (props.mode === 'create')
|
|
34
|
+
return 'Create'
|
|
35
|
+
if (props.mode === 'edit')
|
|
36
|
+
return 'Edit'
|
|
37
|
+
if (props.mode === 'clone')
|
|
38
|
+
return 'Clone'
|
|
39
|
+
return '-'
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
function handleCloseModifierForm() {
|
|
43
|
+
visible.value = false
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function handleDoneAddProfile() {
|
|
47
|
+
handleCloseModifierForm()
|
|
48
|
+
emit('onRefresh')
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function handleDoneCloneProfile() {
|
|
52
|
+
handleCloseModifierForm()
|
|
53
|
+
emit('onRefresh')
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function handleDoneUpdateProfile() {
|
|
57
|
+
handleCloseModifierForm()
|
|
58
|
+
emit('onRefresh')
|
|
59
|
+
}
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<template>
|
|
63
|
+
<el-dialog
|
|
64
|
+
v-model="visible"
|
|
65
|
+
append-to-body
|
|
66
|
+
width="75%"
|
|
67
|
+
:title="modifyTitle"
|
|
68
|
+
:before-close="handleCloseModifierForm"
|
|
69
|
+
>
|
|
70
|
+
<ProfileModify
|
|
71
|
+
:mode="mode"
|
|
72
|
+
:item="props.mode !== 'create' ? profileDetail : null"
|
|
73
|
+
@added="handleDoneAddProfile"
|
|
74
|
+
@cloned="handleDoneCloneProfile"
|
|
75
|
+
@updated="handleDoneUpdateProfile"
|
|
76
|
+
@close="visible = false"
|
|
77
|
+
/>
|
|
78
|
+
</el-dialog>
|
|
79
|
+
</template>
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { serializePreset } from '../utils/preset'
|
|
3
|
+
import type { CreateProfileDto } from '../api-client-library'
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(defineProps<{
|
|
6
|
+
mode: 'create' | 'edit' | 'clone' // why so much mode?
|
|
7
|
+
needSubmit: boolean
|
|
8
|
+
prop?: string
|
|
9
|
+
item?: CreateProfileDto | null
|
|
10
|
+
isPackage?: boolean
|
|
11
|
+
}>(), { needSubmit: true })
|
|
12
|
+
|
|
13
|
+
const emit = defineEmits<{
|
|
14
|
+
close: []
|
|
15
|
+
submit: [profile: CreateProfileDto]
|
|
16
|
+
}>()
|
|
17
|
+
|
|
18
|
+
const item = toRef(props, 'item')
|
|
19
|
+
|
|
20
|
+
const activeMedia = ref()
|
|
21
|
+
|
|
22
|
+
const initFields = ref<any>({
|
|
23
|
+
name: '',
|
|
24
|
+
video: [],
|
|
25
|
+
audio: [],
|
|
26
|
+
other: [],
|
|
27
|
+
presets: [],
|
|
28
|
+
})
|
|
29
|
+
const fields = ref(klona(initFields.value))
|
|
30
|
+
|
|
31
|
+
if (props.prop)
|
|
32
|
+
useSyncElForm(props.prop, { formValue, formErrors, submitLocks, formRef })
|
|
33
|
+
|
|
34
|
+
watchEffect(() => {
|
|
35
|
+
if (props.item) {
|
|
36
|
+
initFields.value = klona(item.value)
|
|
37
|
+
fields.value = klona(item.value)
|
|
38
|
+
activeMedia.value = 'media-0'
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const { createProfileMutation, updateProfileMutation, isMutationLoading } = useProfileMutation()
|
|
43
|
+
|
|
44
|
+
const { t } = useI18n()
|
|
45
|
+
const { formRef, formValue, handleSubmit, handleValidate, formErrors, getAtrrs, submitLocks } = useElForm<any>({
|
|
46
|
+
initialValues: fields,
|
|
47
|
+
async onSubmit(values) {
|
|
48
|
+
if (props.mode === 'create') {
|
|
49
|
+
await createProfileMutation.mutateAsync(serializeData(fields.value))
|
|
50
|
+
ElMessage.success(t('library_profile.profile_added_successfully'))
|
|
51
|
+
handleReset()
|
|
52
|
+
formRef.value?.resetFields()
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (props.mode === 'edit') {
|
|
56
|
+
await updateProfileMutation.mutateAsync({
|
|
57
|
+
id: fields.value.id,
|
|
58
|
+
updateProfileDto: serializeData(fields.value),
|
|
59
|
+
})
|
|
60
|
+
ElMessage.success(t('library_profile.profile_updated_successfully'))
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (props.mode === 'clone') {
|
|
64
|
+
await createProfileMutation.mutateAsync(serializeData(fields.value))
|
|
65
|
+
ElMessage.success(t('library_profile.profile_cloned_successfully'))
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
emit('close')
|
|
69
|
+
emit('submit', serializeData(fields.value))
|
|
70
|
+
try {
|
|
71
|
+
// switch (props.mode) {
|
|
72
|
+
// case 'create': {
|
|
73
|
+
// res = await createProfile(payload)
|
|
74
|
+
// if (res) {
|
|
75
|
+
// ElMessage.success('Add successful')
|
|
76
|
+
// emit('added', res)
|
|
77
|
+
// }
|
|
78
|
+
// break
|
|
79
|
+
// }
|
|
80
|
+
// case 'edit': {
|
|
81
|
+
// let parsed = serializeData(fields.value)
|
|
82
|
+
// parsed = { ...parsed, ...{ id: fields.value.id } }
|
|
83
|
+
// res = await updateProfile(parsed)
|
|
84
|
+
// if (res) {
|
|
85
|
+
// ElMessage.success('Update successful')
|
|
86
|
+
// emit('updated', res)
|
|
87
|
+
// }
|
|
88
|
+
// break
|
|
89
|
+
// }
|
|
90
|
+
// case 'clone': {
|
|
91
|
+
// const payload = serializeData(fields.value)
|
|
92
|
+
// res = await createProfile(payload)
|
|
93
|
+
// if (res) {
|
|
94
|
+
// ElMessage.success('Clone successful')
|
|
95
|
+
// emit('cloned', res)
|
|
96
|
+
// }
|
|
97
|
+
// break
|
|
98
|
+
// }
|
|
99
|
+
// default:
|
|
100
|
+
// break
|
|
101
|
+
// }
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
function handleReset() {
|
|
109
|
+
fields.value = klona(initFields.value)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function handleCancel() {
|
|
113
|
+
emit('close')
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function serializeData(data: any) {
|
|
117
|
+
const { name, description, presets = [] } = data
|
|
118
|
+
const serializedPresets = presets.map((item) => {
|
|
119
|
+
return serializePreset(item)
|
|
120
|
+
})
|
|
121
|
+
return {
|
|
122
|
+
name,
|
|
123
|
+
description,
|
|
124
|
+
presets: serializedPresets,
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
</script>
|
|
128
|
+
|
|
129
|
+
<template>
|
|
130
|
+
<el-form
|
|
131
|
+
ref="formRef" label-position="top" label-width="80px" :model="formValue"
|
|
132
|
+
@validate="handleValidate"
|
|
133
|
+
>
|
|
134
|
+
<ProfileConfigItem v-model:activeMedia="activeMedia" :is-package="isPackage">
|
|
135
|
+
<template #default>
|
|
136
|
+
<slot name="input" :fields="fields" :get-atrrs="getAtrrs" />
|
|
137
|
+
</template>
|
|
138
|
+
</ProfileConfigItem>
|
|
139
|
+
<div v-if="needSubmit" class="mt-4 w-full flex justify-end">
|
|
140
|
+
<!-- <el-button :disabled="isMutationLoading" @click="handleReset">
|
|
141
|
+
{{ $t('library_action.reset') }}
|
|
142
|
+
</el-button> -->
|
|
143
|
+
|
|
144
|
+
<el-button type="primary" plain :disabled="isMutationLoading" @click="handleCancel">
|
|
145
|
+
{{ $t('library_action.cancel') }}
|
|
146
|
+
</el-button>
|
|
147
|
+
<el-button :loading="isMutationLoading" type="primary" @click="handleSubmit">
|
|
148
|
+
{{ $t('library_action.submit') }}
|
|
149
|
+
</el-button>
|
|
150
|
+
</div>
|
|
151
|
+
</el-form>
|
|
152
|
+
</template>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
const { isLoading, selecteRow, tableData, hasSelection, sortChange } = definePropsRefs<{
|
|
3
|
+
isLoading?: boolean
|
|
4
|
+
selecteRow?: (row: any) => void
|
|
5
|
+
tableData: any[]
|
|
6
|
+
hasSelection?: boolean
|
|
7
|
+
sortChange?: (row: any) => void
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
const { selectedProfiles } = defineModels<{
|
|
11
|
+
selectedProfiles?: any[]
|
|
12
|
+
}>()
|
|
13
|
+
|
|
14
|
+
const hasId = computed(() => tableData.value?.some(item => item.id))
|
|
15
|
+
|
|
16
|
+
const toggle = ref(false)
|
|
17
|
+
function handleSelectionChange(val) {
|
|
18
|
+
if (toggle.value)
|
|
19
|
+
return
|
|
20
|
+
selectedProfiles.value = val
|
|
21
|
+
}
|
|
22
|
+
const multipleTableRef = ref<any>()
|
|
23
|
+
whenever(multipleTableRef, () => {
|
|
24
|
+
if (selectedProfiles.value?.length > 0) {
|
|
25
|
+
toggle.value = true
|
|
26
|
+
tableData.value.forEach((row) => {
|
|
27
|
+
const isSelected = selectedProfiles.value?.some(item => item.id === row.id)
|
|
28
|
+
multipleTableRef.value?.toggleRowSelection(row, isSelected)
|
|
29
|
+
})
|
|
30
|
+
toggle.value = false
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<el-table
|
|
37
|
+
ref="multipleTableRef"
|
|
38
|
+
v-loading="isLoading"
|
|
39
|
+
:data="tableData"
|
|
40
|
+
stripe
|
|
41
|
+
border
|
|
42
|
+
row-key="id"
|
|
43
|
+
v-bind="$attrs"
|
|
44
|
+
class="my-16px w-full flex-1 [&_.el-table\_\_row:hover]:cursor-pointer"
|
|
45
|
+
@sort-change="sortChange"
|
|
46
|
+
@row-click="selecteRow"
|
|
47
|
+
@selection-change="handleSelectionChange"
|
|
48
|
+
>
|
|
49
|
+
<slot name="empty" />
|
|
50
|
+
<slot name="single" />
|
|
51
|
+
<el-table-column v-if="hasSelection" type="selection" width="55" />
|
|
52
|
+
<el-table-column
|
|
53
|
+
prop="id"
|
|
54
|
+
label="ID"
|
|
55
|
+
width="60"
|
|
56
|
+
fixed
|
|
57
|
+
>
|
|
58
|
+
<template #default="{ row }">
|
|
59
|
+
<SSCopyButton v-if="hasId" :value="row.id" @click.prevent.stop />
|
|
60
|
+
</template>
|
|
61
|
+
</el-table-column>
|
|
62
|
+
<ProfileTableColumns />
|
|
63
|
+
<template #empty>
|
|
64
|
+
<slot name="empty" />
|
|
65
|
+
</template>
|
|
66
|
+
<slot />
|
|
67
|
+
</el-table>
|
|
68
|
+
</template>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { isNumber } from '@antfu/utils'
|
|
3
|
+
|
|
4
|
+
const { modelValue } = defineModels<{
|
|
5
|
+
modelValue: {
|
|
6
|
+
mediaScale: number
|
|
7
|
+
width: number
|
|
8
|
+
height: number
|
|
9
|
+
x: number
|
|
10
|
+
y: number
|
|
11
|
+
isActive: boolean
|
|
12
|
+
assetId: string
|
|
13
|
+
}
|
|
14
|
+
}>()
|
|
15
|
+
|
|
16
|
+
const screenRatio = ref(3)
|
|
17
|
+
const watermarkXBoundary = ref(1920)
|
|
18
|
+
const watermarkYBoundary = ref(1080)
|
|
19
|
+
|
|
20
|
+
const w = computed({
|
|
21
|
+
get: () => {
|
|
22
|
+
return modelValue.value.width / screenRatio.value * modelValue.value.mediaScale
|
|
23
|
+
},
|
|
24
|
+
set: (value: number) => {
|
|
25
|
+
modelValue.value = {
|
|
26
|
+
...modelValue.value,
|
|
27
|
+
width: value * screenRatio.value,
|
|
28
|
+
mediaScale: Number(((value * screenRatio.value) / modelValue.value.width).toFixed(1)),
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const h = computed({
|
|
34
|
+
get: () => {
|
|
35
|
+
return modelValue.value.height / screenRatio.value * modelValue.value.mediaScale
|
|
36
|
+
},
|
|
37
|
+
set: (value: number) => {
|
|
38
|
+
modelValue.value = {
|
|
39
|
+
...modelValue.value,
|
|
40
|
+
height: value * screenRatio.value,
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const x = computed({
|
|
46
|
+
get: () => {
|
|
47
|
+
const origin = modelValue.value.x
|
|
48
|
+
if (origin >= 0)
|
|
49
|
+
return origin / screenRatio.value
|
|
50
|
+
return (watermarkXBoundary.value + origin - modelValue.value.width) / screenRatio.value
|
|
51
|
+
},
|
|
52
|
+
set: (left: number) => {
|
|
53
|
+
modelValue.value.x = (left * screenRatio.value) || 0
|
|
54
|
+
},
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
const y = computed({
|
|
58
|
+
get: () => {
|
|
59
|
+
const origin = modelValue.value.y
|
|
60
|
+
if (isNumber(origin)) {
|
|
61
|
+
if (origin >= 0)
|
|
62
|
+
return origin / screenRatio.value
|
|
63
|
+
return (watermarkYBoundary.value + origin - modelValue.value.height) / screenRatio.value
|
|
64
|
+
}
|
|
65
|
+
return origin
|
|
66
|
+
},
|
|
67
|
+
set: (top: number) => {
|
|
68
|
+
modelValue.value.y = (top * screenRatio.value) || 0
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
const { data } = useAssetDetail(() => modelValue.value.assetId)
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<template>
|
|
76
|
+
<CommonVue3DraggableResizable
|
|
77
|
+
v-model:x="x" v-model:y="y" v-model:h="h" v-model:w="w"
|
|
78
|
+
v-model:active="modelValue.isActive" :handles="['tl', 'tr', 'br', 'bl']" :parent="true" :draggable="true"
|
|
79
|
+
:resizable="true" :lock-aspect-ratio="true"
|
|
80
|
+
>
|
|
81
|
+
<el-image v-if="data?.uri" class="h-full w-full" :src="data.uri" />
|
|
82
|
+
</CommonVue3DraggableResizable>
|
|
83
|
+
<!--
|
|
84
|
+
:min-width="getVisualWatermarkSize(watermark.width || 10, 0.1)"
|
|
85
|
+
:min-height="getVisualWatermarkSize(watermark.height || 10, 0.1)"
|
|
86
|
+
:max-width="getVisualWatermarkSize(watermark.width, 10)"
|
|
87
|
+
:max-height="getVisualWatermarkSize(watermark.height, 10)" -->
|
|
88
|
+
</template>
|