@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.
Files changed (71) hide show
  1. package/README.md +1 -0
  2. package/locales/en.yaml +289 -0
  3. package/locales/vi.yaml +294 -0
  4. package/nuxt.config.ts +18 -0
  5. package/package.json +33 -0
  6. package/public/routes.json +34 -0
  7. package/src/api/axios.ts +3 -0
  8. package/src/api/index.ts +86 -0
  9. package/src/api-client-library/.openapi-generator/FILES +20 -0
  10. package/src/api-client-library/.openapi-generator/VERSION +1 -0
  11. package/src/api-client-library/.openapi-generator-ignore +23 -0
  12. package/src/api-client-library/api/health-api.ts +119 -0
  13. package/src/api-client-library/api/presets-api.ts +599 -0
  14. package/src/api-client-library/api/profiles-api.ts +676 -0
  15. package/src/api-client-library/api.ts +20 -0
  16. package/src/api-client-library/base.ts +72 -0
  17. package/src/api-client-library/common.ts +150 -0
  18. package/src/api-client-library/configuration.ts +101 -0
  19. package/src/api-client-library/git_push.sh +57 -0
  20. package/src/api-client-library/index.ts +18 -0
  21. package/src/api-client-library/models/create-preset-dto.ts +223 -0
  22. package/src/api-client-library/models/create-profile-dto.ts +45 -0
  23. package/src/api-client-library/models/health-controller-get-health200-response-info-value.ts +32 -0
  24. package/src/api-client-library/models/health-controller-get-health200-response.ts +51 -0
  25. package/src/api-client-library/models/health-controller-get-health503-response.ts +51 -0
  26. package/src/api-client-library/models/index.ts +7 -0
  27. package/src/api-client-library/models/update-preset-dto.ts +223 -0
  28. package/src/api-client-library/models/update-profile-dto.ts +45 -0
  29. package/src/components/MediaSelection.vue +40 -0
  30. package/src/components/PresetModify.vue +154 -0
  31. package/src/components/PresetTable.vue +114 -0
  32. package/src/components/ProfileAllList.vue +137 -0
  33. package/src/components/ProfileFormModal.vue +79 -0
  34. package/src/components/ProfileModify.vue +152 -0
  35. package/src/components/ProfileTable.vue +68 -0
  36. package/src/components/WatermarkDraggableItem.vue +88 -0
  37. package/src/components/channel/ConfigWatermarkItem.vue +239 -0
  38. package/src/components/channel/WatermarkPreview.vue +19 -0
  39. package/src/components/common/Vue3DraggableResizable/Container.vue +71 -0
  40. package/src/components/common/Vue3DraggableResizable/index.vue +1327 -0
  41. package/src/components/common/Vue3DraggableResizable/utils/dom.js +63 -0
  42. package/src/components/common/Vue3DraggableResizable/utils/fns.js +37 -0
  43. package/src/components/common/VueDraggableResizable/dom.js +63 -0
  44. package/src/components/common/VueDraggableResizable/fns.js +37 -0
  45. package/src/components/common/VueDraggableResizable/index.vue +958 -0
  46. package/src/components/preset/ConfigItem.vue +956 -0
  47. package/src/components/profile/ConfigItem.vue +765 -0
  48. package/src/components/profile/TableColumns.vue +137 -0
  49. package/src/components/shared/AudioInfoViewer.vue +101 -0
  50. package/src/components/shared/MediaInfoViewer.vue +249 -0
  51. package/src/components/shared/MediaInfoViewerSmall.vue +105 -0
  52. package/src/components/shared/PopoverProfile.vue +17 -0
  53. package/src/components/shared/VideoInfoViewer.vue +136 -0
  54. package/src/components/shared/fileSizeFilter.ts +26 -0
  55. package/src/composables/preset.ts +141 -0
  56. package/src/public/apple-touch-icon-180x180.png +0 -0
  57. package/src/public/build-time.json +1 -0
  58. package/src/public/favicon.ico +0 -0
  59. package/src/public/favicon.svg +15 -0
  60. package/src/public/logo.png +0 -0
  61. package/src/public/logo.svg +9 -0
  62. package/src/public/maskable-icon-512x512.png +0 -0
  63. package/src/public/pwa-192x192.png +0 -0
  64. package/src/public/pwa-512x512.png +0 -0
  65. package/src/public/pwa-64x64.png +0 -0
  66. package/src/public/routes.json +87 -0
  67. package/src/utils/common.ts +175 -0
  68. package/src/utils/config.ts +19 -0
  69. package/src/utils/preset.ts +353 -0
  70. package/src/utils/profile.ts +30 -0
  71. package/tsconfig.json +3 -0
@@ -0,0 +1,32 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Sigma Library
5
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ *
7
+ * The version of the OpenAPI document: 1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+
17
+ /**
18
+ *
19
+ * @export
20
+ * @interface HealthControllerGetHealth200ResponseInfoValue
21
+ */
22
+ export interface HealthControllerGetHealth200ResponseInfoValue {
23
+ [key: string]: string | any;
24
+
25
+ /**
26
+ *
27
+ * @type {string}
28
+ * @memberof HealthControllerGetHealth200ResponseInfoValue
29
+ */
30
+ 'status'?: string;
31
+ }
32
+
@@ -0,0 +1,51 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Sigma Library
5
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ *
7
+ * The version of the OpenAPI document: 1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ // May contain unused imports in some cases
17
+ // @ts-ignore
18
+ import { HealthControllerGetHealth200ResponseInfoValue } from './health-controller-get-health200-response-info-value';
19
+
20
+ /**
21
+ *
22
+ * @export
23
+ * @interface HealthControllerGetHealth200Response
24
+ */
25
+ export interface HealthControllerGetHealth200Response {
26
+ /**
27
+ *
28
+ * @type {string}
29
+ * @memberof HealthControllerGetHealth200Response
30
+ */
31
+ 'status'?: string;
32
+ /**
33
+ *
34
+ * @type {{ [key: string]: HealthControllerGetHealth200ResponseInfoValue; }}
35
+ * @memberof HealthControllerGetHealth200Response
36
+ */
37
+ 'info'?: { [key: string]: HealthControllerGetHealth200ResponseInfoValue; } | null;
38
+ /**
39
+ *
40
+ * @type {{ [key: string]: HealthControllerGetHealth200ResponseInfoValue; }}
41
+ * @memberof HealthControllerGetHealth200Response
42
+ */
43
+ 'error'?: { [key: string]: HealthControllerGetHealth200ResponseInfoValue; } | null;
44
+ /**
45
+ *
46
+ * @type {{ [key: string]: HealthControllerGetHealth200ResponseInfoValue; }}
47
+ * @memberof HealthControllerGetHealth200Response
48
+ */
49
+ 'details'?: { [key: string]: HealthControllerGetHealth200ResponseInfoValue; };
50
+ }
51
+
@@ -0,0 +1,51 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Sigma Library
5
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ *
7
+ * The version of the OpenAPI document: 1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ // May contain unused imports in some cases
17
+ // @ts-ignore
18
+ import { HealthControllerGetHealth200ResponseInfoValue } from './health-controller-get-health200-response-info-value';
19
+
20
+ /**
21
+ *
22
+ * @export
23
+ * @interface HealthControllerGetHealth503Response
24
+ */
25
+ export interface HealthControllerGetHealth503Response {
26
+ /**
27
+ *
28
+ * @type {string}
29
+ * @memberof HealthControllerGetHealth503Response
30
+ */
31
+ 'status'?: string;
32
+ /**
33
+ *
34
+ * @type {{ [key: string]: HealthControllerGetHealth200ResponseInfoValue; }}
35
+ * @memberof HealthControllerGetHealth503Response
36
+ */
37
+ 'info'?: { [key: string]: HealthControllerGetHealth200ResponseInfoValue; } | null;
38
+ /**
39
+ *
40
+ * @type {{ [key: string]: HealthControllerGetHealth200ResponseInfoValue; }}
41
+ * @memberof HealthControllerGetHealth503Response
42
+ */
43
+ 'error'?: { [key: string]: HealthControllerGetHealth200ResponseInfoValue; } | null;
44
+ /**
45
+ *
46
+ * @type {{ [key: string]: HealthControllerGetHealth200ResponseInfoValue; }}
47
+ * @memberof HealthControllerGetHealth503Response
48
+ */
49
+ 'details'?: { [key: string]: HealthControllerGetHealth200ResponseInfoValue; };
50
+ }
51
+
@@ -0,0 +1,7 @@
1
+ export * from './create-preset-dto';
2
+ export * from './create-profile-dto';
3
+ export * from './health-controller-get-health200-response';
4
+ export * from './health-controller-get-health200-response-info-value';
5
+ export * from './health-controller-get-health503-response';
6
+ export * from './update-preset-dto';
7
+ export * from './update-profile-dto';
@@ -0,0 +1,223 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Sigma Library
5
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ *
7
+ * The version of the OpenAPI document: 1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+
17
+ /**
18
+ *
19
+ * @export
20
+ * @interface UpdatePresetDto
21
+ */
22
+ export interface UpdatePresetDto {
23
+ /**
24
+ * phân loại preset
25
+ * @type {string}
26
+ * @memberof UpdatePresetDto
27
+ */
28
+ 'type'?: UpdatePresetDtoTypeEnum;
29
+ /**
30
+ * Bộ mã của video
31
+ * @type {string}
32
+ * @memberof UpdatePresetDto
33
+ */
34
+ 'codec'?: UpdatePresetDtoCodecEnum;
35
+ /**
36
+ * Giá trị bitrate
37
+ * @type {number}
38
+ * @memberof UpdatePresetDto
39
+ */
40
+ 'bitrate'?: number;
41
+ /**
42
+ * mô tả tuỳ chỉnh của đầu ra
43
+ * @type {string}
44
+ * @memberof UpdatePresetDto
45
+ */
46
+ 'description'?: string;
47
+ /**
48
+ *
49
+ * @type {string}
50
+ * @memberof UpdatePresetDto
51
+ */
52
+ 'options'?: string;
53
+ /**
54
+ * audio only
55
+ * @type {number}
56
+ * @memberof UpdatePresetDto
57
+ */
58
+ 'sampleRate'?: UpdatePresetDtoSampleRateEnum;
59
+ /**
60
+ * audio only
61
+ * @type {number}
62
+ * @memberof UpdatePresetDto
63
+ */
64
+ 'channel'?: UpdatePresetDtoChannelEnum;
65
+ /**
66
+ * audio only
67
+ * @type {string}
68
+ * @memberof UpdatePresetDto
69
+ */
70
+ 'profile'?: UpdatePresetDtoProfileEnum;
71
+ /**
72
+ * video only
73
+ * @type {string}
74
+ * @memberof UpdatePresetDto
75
+ */
76
+ 'videoProfile'?: UpdatePresetDtoVideoProfileEnum;
77
+ /**
78
+ * audio only thay đổi volume từ luồng gốc: + \"+5dB\", \"-10dB\": thay đổi 1 lượng) + 0.5, 2 : giảm 1 nửa, gấp đôi + \"loudnorm\": tự động theo chuẩn EBU R128
79
+ * @type {string}
80
+ * @memberof UpdatePresetDto
81
+ */
82
+ 'volume'?: UpdatePresetDtoVolumeEnum;
83
+ /**
84
+ * video only. Giá trị khung hình trên giây (Frame per second). Giá trị này không thể lớn hơn giá trị fps của luồng đầu vào
85
+ * @type {number}
86
+ * @memberof UpdatePresetDto
87
+ */
88
+ 'fps'?: number;
89
+ /**
90
+ * video only. Giá trị độ cao của video của luồng đầu ra, dựa trên pixel. Đối với phần lớn bộ mã video bạn có thể để trống, chiều cao của video sẽ tương ứng với nguồn đầu vào. Tuy nhiên, việc này không được khuyến khích
91
+ * @type {number}
92
+ * @memberof UpdatePresetDto
93
+ */
94
+ 'height'?: number;
95
+ /**
96
+ * video only. Giá trị độ rộng của video của luồng đầu ra, dựa trên pixel. Đối với phần lớn bộ mã video bạn có thể để trống, chiều rộng của video sẽ tương ứng với nguồn đầu vào. Tuy nhiên, việc này không được khuyến khích
97
+ * @type {number}
98
+ * @memberof UpdatePresetDto
99
+ */
100
+ 'width'?: number;
101
+ /**
102
+ * video only. bật chế độ constant bitrate
103
+ * @type {boolean}
104
+ * @memberof UpdatePresetDto
105
+ */
106
+ 'cbr'?: boolean;
107
+ /**
108
+ * video only
109
+ * @type {string}
110
+ * @memberof UpdatePresetDto
111
+ */
112
+ 'pixelFormat'?: UpdatePresetDtoPixelFormatEnum;
113
+ /**
114
+ * video only, (chú ý: nếu để width, height, scaleType trong option tổng, nguồn sẽ scale trước khi xử lý tiếp theo)
115
+ * @type {string}
116
+ * @memberof UpdatePresetDto
117
+ */
118
+ 'scaleType'?: UpdatePresetDtoScaleTypeEnum;
119
+ /**
120
+ * video only, chế độ constant quality
121
+ * @type {number}
122
+ * @memberof UpdatePresetDto
123
+ */
124
+ 'cq'?: number;
125
+ /**
126
+ * video only, chế độ video interlaced
127
+ * @type {boolean}
128
+ * @memberof UpdatePresetDto
129
+ */
130
+ 'interlaced'?: boolean;
131
+ /**
132
+ * bframe number
133
+ * @type {number}
134
+ * @memberof UpdatePresetDto
135
+ */
136
+ 'bframe'?: number;
137
+ /**
138
+ * Tên
139
+ * @type {string}
140
+ * @memberof UpdatePresetDto
141
+ */
142
+ 'name'?: string;
143
+ }
144
+
145
+ export const UpdatePresetDtoTypeEnum = {
146
+ Video: 'video',
147
+ Audio: 'audio',
148
+ Data: 'data'
149
+ } as const;
150
+
151
+ export type UpdatePresetDtoTypeEnum = typeof UpdatePresetDtoTypeEnum[keyof typeof UpdatePresetDtoTypeEnum];
152
+ export const UpdatePresetDtoCodecEnum = {
153
+ H264: 'h264',
154
+ Hevc: 'hevc',
155
+ Copy: 'copy',
156
+ Aac: 'aac',
157
+ Ac3: 'ac3',
158
+ Eac3: 'eac3',
159
+ Mp2: 'mp2',
160
+ Scte35: 'scte35',
161
+ Id3: 'id3'
162
+ } as const;
163
+
164
+ export type UpdatePresetDtoCodecEnum = typeof UpdatePresetDtoCodecEnum[keyof typeof UpdatePresetDtoCodecEnum];
165
+ export const UpdatePresetDtoSampleRateEnum = {
166
+ NUMBER_44100: 44100,
167
+ NUMBER_48000: 48000
168
+ } as const;
169
+
170
+ export type UpdatePresetDtoSampleRateEnum = typeof UpdatePresetDtoSampleRateEnum[keyof typeof UpdatePresetDtoSampleRateEnum];
171
+ export const UpdatePresetDtoChannelEnum = {
172
+ NUMBER_1: 1,
173
+ NUMBER_2: 2,
174
+ NUMBER_6: 6
175
+ } as const;
176
+
177
+ export type UpdatePresetDtoChannelEnum = typeof UpdatePresetDtoChannelEnum[keyof typeof UpdatePresetDtoChannelEnum];
178
+ export const UpdatePresetDtoProfileEnum = {
179
+ Low: 'aac_low',
180
+ He: 'aac_he',
181
+ HeV2: 'aac_he_v2',
182
+ Main: 'aac_main',
183
+ Ld: 'aac_ld',
184
+ Eld: 'aac_eld'
185
+ } as const;
186
+
187
+ export type UpdatePresetDtoProfileEnum = typeof UpdatePresetDtoProfileEnum[keyof typeof UpdatePresetDtoProfileEnum];
188
+ export const UpdatePresetDtoVideoProfileEnum = {
189
+ Baseline: 'BASELINE',
190
+ Main: 'MAIN',
191
+ High: 'HIGH'
192
+ } as const;
193
+
194
+ export type UpdatePresetDtoVideoProfileEnum = typeof UpdatePresetDtoVideoProfileEnum[keyof typeof UpdatePresetDtoVideoProfileEnum];
195
+ export const UpdatePresetDtoVolumeEnum = {
196
+ _5dB: '+5dB',
197
+ _10dB: '-10dB',
198
+ _05: '0.5',
199
+ _2: '2',
200
+ Loudnorm: 'loudnorm'
201
+ } as const;
202
+
203
+ export type UpdatePresetDtoVolumeEnum = typeof UpdatePresetDtoVolumeEnum[keyof typeof UpdatePresetDtoVolumeEnum];
204
+ export const UpdatePresetDtoPixelFormatEnum = {
205
+ Yuv420p: 'yuv420p',
206
+ Yuv444p: 'yuv444p',
207
+ Yuv420p10le: 'yuv420p10le',
208
+ Yuv444p10le: 'yuv444p10le'
209
+ } as const;
210
+
211
+ export type UpdatePresetDtoPixelFormatEnum = typeof UpdatePresetDtoPixelFormatEnum[keyof typeof UpdatePresetDtoPixelFormatEnum];
212
+ export const UpdatePresetDtoScaleTypeEnum = {
213
+ FitWidth: 'fitWidth',
214
+ FitHeight: 'fitHeight',
215
+ FitInside: 'fitInside',
216
+ FitCrop: 'fitCrop',
217
+ FitBoth: 'fitBoth',
218
+ Source: 'source'
219
+ } as const;
220
+
221
+ export type UpdatePresetDtoScaleTypeEnum = typeof UpdatePresetDtoScaleTypeEnum[keyof typeof UpdatePresetDtoScaleTypeEnum];
222
+
223
+
@@ -0,0 +1,45 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Sigma Library
5
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ *
7
+ * The version of the OpenAPI document: 1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ // May contain unused imports in some cases
17
+ // @ts-ignore
18
+ import { UpdatePresetDto } from './update-preset-dto';
19
+
20
+ /**
21
+ *
22
+ * @export
23
+ * @interface UpdateProfileDto
24
+ */
25
+ export interface UpdateProfileDto {
26
+ /**
27
+ * Tên
28
+ * @type {string}
29
+ * @memberof UpdateProfileDto
30
+ */
31
+ 'name'?: string;
32
+ /**
33
+ * mô tả tuỳ chỉnh của đầu ra
34
+ * @type {string}
35
+ * @memberof UpdateProfileDto
36
+ */
37
+ 'description'?: string;
38
+ /**
39
+ *
40
+ * @type {Array<UpdatePresetDto>}
41
+ * @memberof UpdateProfileDto
42
+ */
43
+ 'presets'?: Array<UpdatePresetDto>;
44
+ }
45
+
@@ -0,0 +1,40 @@
1
+ <script lang="ts" setup>
2
+ const props = defineProps<{
3
+ mediaType: 'audio' | 'video' | 'data' | string & {}
4
+ exclusion: string[]
5
+ }>()
6
+
7
+ defineEmits(['selectItem'])
8
+
9
+ const mediaType = toRef(props, 'mediaType')
10
+ function getQuery() {
11
+ return JSON.stringify({
12
+ type: {
13
+ $eq: mediaType.value,
14
+ },
15
+ })
16
+ }
17
+
18
+ const params = ref({
19
+ page: 1,
20
+ perPage: 15,
21
+ q: getQuery(),
22
+ sort: '',
23
+ })
24
+
25
+ watch(
26
+ mediaType,
27
+ () => {
28
+ params.value.q = getQuery()
29
+ },
30
+ { immediate: true },
31
+ )
32
+ </script>
33
+
34
+ <template>
35
+ <PresetTable
36
+ v-model:params="params"
37
+ height="400px"
38
+ @select="(item) => $emit('selectItem', item)"
39
+ />
40
+ </template>
@@ -0,0 +1,154 @@
1
+ <script lang="ts" setup>
2
+ import { objectMap } from '@antfu/utils'
3
+ import { presetsApi } from '../api'
4
+ import type { CreatePresetDto } from '~/api-client-library'
5
+
6
+ const props = withDefaults(defineProps<{
7
+ id?: string
8
+ mode?: 'create' | 'edit' | 'clone'
9
+ item: any
10
+ exclusion: string[]
11
+ disable: string[]
12
+ defaultMediaType?: 'video' | 'audio' | 'data'
13
+ prop?: string
14
+ isPackage?: boolean
15
+ }>(), {
16
+ mode: 'create',
17
+ item: () => { },
18
+ exclusion: () => [],
19
+ disable: () => [],
20
+ })
21
+ const emit = defineEmits(['close'])
22
+ const id = toRef(props, 'id')
23
+
24
+ const initFields = ref({
25
+ id: '',
26
+ // TODO: refactor me
27
+ type: props.defaultMediaType as 'video' | 'audio' | 'data',
28
+ name: '',
29
+ codec: '',
30
+ option: '',
31
+ bitrate: 0,
32
+ sampleRate: 0,
33
+ fps: 0,
34
+ width: 0,
35
+ height: 0,
36
+ pixelFormat: '',
37
+ bframe: 0,
38
+ scaleType: '',
39
+ cq: 0,
40
+ interlaced: false,
41
+ cbr: false,
42
+ channel: 2,
43
+ profile: '',
44
+ volume: '',
45
+ streamId: '',
46
+ streamIndex: '',
47
+ })
48
+ const fields = ref(klona(initFields.value))
49
+
50
+ if (props.item) {
51
+ initFields.value = klona(props.item)
52
+ fields.value = klona(props.item)
53
+ }
54
+
55
+ useQuery(
56
+ [QueryKeys.LibraryPresetDetail, id],
57
+ async () => {
58
+ const { data } = await presetsApi.presetsControllerGet({ id: id.value })
59
+ return {
60
+ // Add streamId and streamIndex to fields
61
+ ...data,
62
+ streamIndex: 0,
63
+ streamId: '',
64
+ }
65
+ },
66
+ {
67
+ enabled: computed(() => !!id.value),
68
+ onSuccess(data) {
69
+ initFields.value = klona(data)
70
+ fields.value = klona(data)
71
+ },
72
+ },
73
+ )
74
+
75
+ function formToPayloadPreset(presetForm: any) {
76
+ const preset = emptyStr2Undefined(presetForm)
77
+ let removedKeys: string[] = []
78
+ if (presetForm.type === 'video')
79
+ removedKeys = ['sampleRate', 'channel', 'profile', 'volume']
80
+ else if (presetForm.type === 'audio')
81
+ removedKeys = ['fps', 'height', 'width', 'cbr', 'pixelFormat', 'scaleType', 'cq', 'interlaced']
82
+ else if (presetForm.type === 'data')
83
+ removedKeys = ['fps', 'height', 'width', 'cbr', 'pixelFormat', 'scaleType', 'cq', 'interlaced']
84
+
85
+ const payload = objectMap(preset, (k, v) => removedKeys.includes(k) ? undefined : [k, v])
86
+
87
+ return payload
88
+ }
89
+
90
+ function resetFields() {
91
+ fields.value = klona(initFields.value)
92
+ }
93
+
94
+ const { createPresetMutation, isMutationLoading, updatePresetMutation } = usePresetMutation()
95
+ const { t } = useI18n()
96
+ const { formRef, formValue, handleSubmit, handleValidate, formErrors, getAtrrs, submitLocks } = useElForm<CreatePresetDto>({
97
+ initialValues: fields,
98
+ async onSubmit(values) {
99
+ if (props.mode === 'create') {
100
+ await createPresetMutation.mutateAsync(formToPayloadPreset(values))
101
+ ElMessage.success(t('library_preset.preset_created_successfully'))
102
+ formRef.value?.resetFields()
103
+ }
104
+
105
+ if (props.mode === 'edit') {
106
+ await updatePresetMutation.mutateAsync({
107
+ id: fields.value.id,
108
+ updatePresetDto: formToPayloadPreset(fields.value),
109
+ })
110
+ ElMessage.success(t('library_preset.preset_updated_successfully'))
111
+ }
112
+
113
+ if (props.mode === 'clone') {
114
+ const { id, ...rest } = fields.value
115
+ await createPresetMutation.mutateAsync(formToPayloadPreset(rest))
116
+ ElMessage.success(t('library_preset.preset_cloned_successfully'))
117
+ }
118
+
119
+ emit('close')
120
+ resetFields()
121
+ },
122
+ })
123
+ if (props.prop)
124
+ useSyncElForm(props.prop, { formValue, formErrors, submitLocks, formRef })
125
+
126
+ const isSubmitting = ref(false)
127
+
128
+ function handleClose() {
129
+ if (!isSubmitting.value)
130
+ emit('close')
131
+ }
132
+ </script>
133
+
134
+ <template>
135
+ <el-form
136
+ ref="formRef" label-position="top" label-width="80px" :model="formValue" :validate-on-rule-change="true"
137
+ @validate="handleValidate"
138
+ >
139
+ <slot name="input" :fields="fields" :get-atrrs="getAtrrs" />
140
+ <PresetConfigItem :is-package="isPackage" :default-media-type="defaultMediaType" />
141
+
142
+ <div v-if="!exclusion.includes('action')" class="flex items-center justify-end">
143
+ <el-button :disabled="isMutationLoading" @click="handleClose">
144
+ {{ $t('library_action.cancel') }}
145
+ </el-button>
146
+ <!-- <el-button :disabled="isMutationLoading" type="info" @click="resetFields">
147
+ {{ $t('library_action.reset') }}
148
+ </el-button> -->
149
+ <el-button type="primary" :loading="isMutationLoading" @click="handleSubmit">
150
+ {{ $t('library_action.submit') }}
151
+ </el-button>
152
+ </div>
153
+ </el-form>
154
+ </template>