@sigmaott/base-library-next 2.2.6 → 2.2.8

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 (63) hide show
  1. package/.npmrc +3 -0
  2. package/locales/en.yaml +289 -289
  3. package/locales/vi.yaml +294 -294
  4. package/nuxt.config.ts +18 -18
  5. package/package.json +32 -33
  6. package/public/routes.json +33 -33
  7. package/src/api/axios.ts +3 -3
  8. package/src/api/index.ts +86 -86
  9. package/src/api-client-library/.openapi-generator/FILES +20 -20
  10. package/src/api-client-library/.openapi-generator-ignore +23 -23
  11. package/src/api-client-library/api/health-api.ts +119 -119
  12. package/src/api-client-library/api/presets-api.ts +599 -599
  13. package/src/api-client-library/api/profiles-api.ts +676 -676
  14. package/src/api-client-library/api.ts +20 -20
  15. package/src/api-client-library/base.ts +72 -72
  16. package/src/api-client-library/common.ts +150 -150
  17. package/src/api-client-library/configuration.ts +101 -101
  18. package/src/api-client-library/git_push.sh +57 -57
  19. package/src/api-client-library/index.ts +18 -18
  20. package/src/api-client-library/models/create-preset-dto.ts +223 -223
  21. package/src/api-client-library/models/create-profile-dto.ts +45 -45
  22. package/src/api-client-library/models/health-controller-get-health200-response-info-value.ts +32 -32
  23. package/src/api-client-library/models/health-controller-get-health200-response.ts +51 -51
  24. package/src/api-client-library/models/health-controller-get-health503-response.ts +51 -51
  25. package/src/api-client-library/models/index.ts +7 -7
  26. package/src/api-client-library/models/update-preset-dto.ts +223 -223
  27. package/src/api-client-library/models/update-profile-dto.ts +45 -45
  28. package/src/components/MediaSelection.vue +40 -40
  29. package/src/components/PresetModify.vue +154 -154
  30. package/src/components/PresetTable.vue +114 -114
  31. package/src/components/ProfileAllList.vue +137 -137
  32. package/src/components/ProfileFormModal.vue +79 -79
  33. package/src/components/ProfileModify.vue +152 -152
  34. package/src/components/ProfileTable.vue +68 -68
  35. package/src/components/WatermarkDraggableItem.vue +88 -88
  36. package/src/components/channel/ConfigWatermarkItem.vue +239 -239
  37. package/src/components/channel/WatermarkPreview.vue +19 -19
  38. package/src/components/common/Vue3DraggableResizable/Container.vue +71 -71
  39. package/src/components/common/Vue3DraggableResizable/index.vue +1327 -1327
  40. package/src/components/common/Vue3DraggableResizable/utils/dom.js +63 -63
  41. package/src/components/common/Vue3DraggableResizable/utils/fns.js +37 -37
  42. package/src/components/common/VueDraggableResizable/dom.js +63 -63
  43. package/src/components/common/VueDraggableResizable/fns.js +37 -37
  44. package/src/components/common/VueDraggableResizable/index.vue +958 -958
  45. package/src/components/preset/ConfigItem.vue +956 -956
  46. package/src/components/profile/ConfigItem.vue +765 -765
  47. package/src/components/profile/TableColumns.vue +137 -137
  48. package/src/components/shared/AudioInfoViewer.vue +101 -101
  49. package/src/components/shared/MediaInfoViewer.vue +257 -249
  50. package/src/components/shared/MediaInfoViewerSmall.vue +105 -105
  51. package/src/components/shared/PopoverProfile.vue +17 -17
  52. package/src/components/shared/VideoInfoViewer.vue +136 -136
  53. package/src/components/shared/fileSizeFilter.ts +26 -26
  54. package/src/composables/preset.ts +141 -141
  55. package/src/public/build-time.json +1 -1
  56. package/src/public/favicon.svg +15 -15
  57. package/src/public/logo.svg +9 -9
  58. package/src/public/routes.json +86 -86
  59. package/src/utils/common.ts +175 -175
  60. package/src/utils/config.ts +19 -19
  61. package/src/utils/preset.ts +353 -353
  62. package/src/utils/profile.ts +30 -30
  63. package/tsconfig.json +3 -3
@@ -1,239 +1,239 @@
1
- <script lang="ts" setup>
2
- import service from '@/api/axios'
3
-
4
- const { prop, isHiddenPlaylist } = definePropsRefs<{
5
- prop: string
6
- isHiddenPlaylist?: boolean
7
- }>()
8
-
9
- const { schemaObj } = useAsyncSchema('/api/transcode/api-docs-json', 'WatermarkDto')
10
- provide('isHiddenPlaylist', isHiddenPlaylist.value)
11
-
12
- function getProp(key: string) {
13
- return () => prop.value ? `${prop.value}.${key}` : ''
14
- }
15
- const { t } = useI18n()
16
-
17
- const [enableValue, enableAttrs] = useElField<boolean>(getProp('enable'), [])
18
-
19
- const [delayValue, delayAttrs] = useElField<number>(getProp('delay'), [
20
- {
21
- required: true,
22
- message: $t('Watermark.delay_is_required'),
23
- trigger: ['blur', 'change'],
24
- },
25
- ], { enabled: enableValue })
26
-
27
- const [xValue, xAttrs] = useElField<number>(getProp('x'), [
28
- {
29
- required: true,
30
- message: $t('Watermark.x_is_required'),
31
- trigger: ['blur', 'change'],
32
- },
33
- ], {
34
- enabled: enableValue,
35
- })
36
-
37
- const [yValue, yAttrs] = useElField<number>(getProp('y'), [
38
- {
39
- required: true,
40
- message: $t('Watermark.y_is_required'),
41
- trigger: ['blur', 'change'],
42
- },
43
- ], {
44
- enabled: enableValue,
45
- })
46
-
47
- const [assetIdValue, assetIdAttrs] = useElField<string>(getProp('assetId'), [
48
- {
49
- required: true,
50
- trigger: ['change'],
51
- asyncValidator: (rule, value) => {
52
- return new Promise((resolve, reject) => {
53
- if (!value) {
54
- reject(new Error(t('watermark.please_select_the_watermark')))
55
- }
56
- else {
57
- $libraryApi('api/library/assets/{id}', { pathParams: { id: value } })
58
- .then(resolve).catch(() => {
59
- reject(new Error(t('asset_not_found')))
60
- })
61
- }
62
- })
63
- },
64
- },
65
- ], {
66
- enabled: enableValue,
67
- })
68
-
69
- const [widthValue] = useElField<number>(getProp('width'), [
70
- {
71
- required: true,
72
- trigger: ['blur', 'change'],
73
- },
74
- ], { enabled: enableValue })
75
-
76
- const [heightValue] = useElField<number>(getProp('height'), [
77
- {
78
- required: true,
79
- trigger: ['blur', 'change'],
80
- },
81
- ], {
82
- enabled: enableValue,
83
- })
84
-
85
- const [mediaScaleValue, mediaScaleAttr] = useElField<number>(getProp('mediaScale'), [
86
- {
87
-
88
- required: true,
89
- trigger: ['blur', 'change'],
90
- validator: (rule, value, callback) => {
91
- if (value > 10 || value < 0.1)
92
- callback(new Error(t('library.the_media_scale_must_be_between')))
93
- return callback()
94
- },
95
- },
96
- ], {
97
- enabled: enableValue,
98
- })
99
-
100
- const assetSrc = ref('https://i.ibb.co/0QvpcB3/on-fast.png')
101
- const limit = ref(['image'])
102
- const { data } = useAssetDetail(() => assetIdValue.value)
103
-
104
- function handleRemove() {
105
- ElMessageBox.confirm(t('base_library.are_you_sure_to_remove_watermark_asset'), t('general.warning'), {
106
- confirmButtonText: t('Actions.confirm'),
107
- cancelButtonText: t('Actions.cancel'),
108
- type: 'warning',
109
- })
110
- .then(() => {
111
- assetIdValue.value = ''
112
- assetSrc.value = ''
113
- })
114
- }
115
-
116
- const yRevert = computed({
117
- get: () => {
118
- return 1080 - yValue.value
119
- },
120
- set: (value: number) => {
121
- yValue.value = 1080 - value
122
- },
123
- })
124
-
125
- watch(mediaScaleValue, () => {
126
- if (!data.value || !mediaScaleValue.value)
127
- return
128
- // update width and height
129
- widthValue.value = data.value?.metadata?.width * mediaScaleValue.value
130
- heightValue.value = data.value?.metadata?.height * mediaScaleValue.value
131
- })
132
-
133
- watchImmediate(data, () => {
134
- if (!data.value)
135
- return
136
- const w = data.value?.metadata?.width
137
- const h = data.value?.metadata?.height
138
- const defaultScale = h > 1080 || w > 1920 ? 0.1 : 1
139
- mediaScaleValue.value = mediaScaleValue.value || defaultScale
140
- widthValue.value = w * mediaScaleValue.value
141
- heightValue.value = h * mediaScaleValue.value
142
- })
143
-
144
- const imageStyles = computed(() => {
145
- return {
146
- top: `${yValue.value / 3}px`,
147
- left: `${xValue.value / 3}px`,
148
- height: `${heightValue.value / 3}px`,
149
- width: `${widthValue.value / 3}px`,
150
- }
151
- })
152
-
153
- function handleChangeEnable(newValue: boolean) {
154
- if (newValue && !xValue.value) {
155
- xValue.value = 0,
156
- yValue.value = 0
157
- mediaScaleValue.value = 1
158
- delayValue.value = 0
159
- widthValue.value = 120
160
- heightValue.value = 88
161
- }
162
- }
163
- </script>
164
-
165
- <template>
166
- <div>
167
- <div class="flex flex-wrap gap-x-48px">
168
- <el-form-item v-bind="enableAttrs">
169
- <template #label>
170
- <SSInformationLabel :label="$t('watermark.enable_label')" :info="schemaObj.enable" />
171
- </template>
172
- <el-switch v-model="enableValue" @change="handleChangeEnable" />
173
- </el-form-item>
174
- <el-form-item v-bind="delayAttrs">
175
- <template #label>
176
- <SSInformationLabel :label="`${$t('watermark.delay')} (s)`" :info="schemaObj.delay" />
177
- </template>
178
- <el-input-number v-model="delayValue" :disabled="!enableValue" :min="0" :max="120" :step="1" step-strictly />
179
- </el-form-item>
180
- <el-form-item v-bind="xAttrs">
181
- <template #label>
182
- <SSInformationLabel label="X" :info="schemaObj.x" />
183
- </template>
184
- <el-input-number v-model="xValue" :disabled="!enableValue" :min="0" :max="1920" />
185
- </el-form-item>
186
- <el-form-item v-bind="yAttrs">
187
- <template #label>
188
- <SSInformationLabel label="Y" :info="schemaObj.y" />
189
- </template>
190
- <el-input-number v-model="yValue" :disabled="!enableValue" :min="0" :max="1080" />
191
- </el-form-item>
192
-
193
- <el-form-item label="Media scale" v-bind="mediaScaleAttr" class="w-400px">
194
- <template #label>
195
- <SSInformationLabel label="Media scale" :info="schemaObj.mediaScale" />
196
- </template>
197
- <el-slider v-model="mediaScaleValue" :step="0.01" :disabled="!enableValue" :min="0.1" :max="10"
198
- class="[&_.el-slider\_\_bar]:!bg-transparent" show-input />
199
- </el-form-item>
200
- </div>
201
- <el-form-item v-bind="assetIdAttrs" class="block [&_.el-form-item\_\_error]:(ml-2)">
202
- <template #label>
203
- <SSInformationLabel label="Asset" :info="schemaObj.assetId" />
204
- </template>
205
-
206
- <SSAssetPicker v-model="assetIdValue" :asset-src="assetSrc" :disabled="!enableValue" :axios-instance="service"
207
- :limit="limit" :asset-domain="ASSET_DEV_URL" />
208
- <div class="relative">
209
- <el-image v-if="data?.uri" fit="scale-down" class="ml-4 h-50px w-50px" :src="data.uri" />
210
- <el-button v-if="assetIdValue && enableValue" size="small" class="absolute right-[-8px] top-0" type="danger"
211
- circle plain @click="handleRemove">
212
- <template #icon>
213
- <div class="i-carbon:close" />
214
- </template>
215
- </el-button>
216
- </div>
217
- </el-form-item>
218
- <div v-if="enableValue" class="grid grid-cols-[1fr_auto_1fr] grid-rows-[1fr_auto_1fr] mt-6">
219
- <div class="col-start-2 pb-18px">
220
- <el-slider v-model="xValue" :disabled="!enableValue" class="[&_.el-slider\_\_bar]:!bg-transparent" :min="0"
221
- :max="1920" />
222
- </div>
223
- <div class="col-start-1 flex justify-end pr-18px">
224
- <el-slider v-model="yRevert" vertical :min="0" :max="1080" :format-tooltip="(value) => `${1080 - value}`"
225
- class="[&_.el-slider\_\_bar]:!bg-transparent" :disabled="!enableValue" />
226
- </div>
227
- <div class="relative col-start-2 mx-auto h-360px w-640px of-hidden rounded-10px ring-18px ring-gray-300">
228
- <div class="absolute right-0 top-0 text-9px font-bold leading-12px -translate-y-full">
229
- <el-text>
230
- Full HD: <span>1920 x 1080</span>
231
- </el-text>
232
- </div>
233
- <div class="absolute h-full w-full bg-#000">
234
- <el-image v-if="data?.uri" :src="data.uri" :style="imageStyles" />
235
- </div>
236
- </div>
237
- </div>
238
- </div>
239
- </template>
1
+ <script lang="ts" setup>
2
+ import service from '@/api/axios'
3
+
4
+ const { prop, isHiddenPlaylist } = definePropsRefs<{
5
+ prop: string
6
+ isHiddenPlaylist?: boolean
7
+ }>()
8
+
9
+ const { schemaObj } = useAsyncSchema('/api/transcode/api-docs-json', 'WatermarkDto')
10
+ provide('isHiddenPlaylist', isHiddenPlaylist.value)
11
+
12
+ function getProp(key: string) {
13
+ return () => prop.value ? `${prop.value}.${key}` : ''
14
+ }
15
+ const { t } = useI18n()
16
+
17
+ const [enableValue, enableAttrs] = useElField<boolean>(getProp('enable'), [])
18
+
19
+ const [delayValue, delayAttrs] = useElField<number>(getProp('delay'), [
20
+ {
21
+ required: true,
22
+ message: $t('Watermark.delay_is_required'),
23
+ trigger: ['blur', 'change'],
24
+ },
25
+ ], { enabled: enableValue })
26
+
27
+ const [xValue, xAttrs] = useElField<number>(getProp('x'), [
28
+ {
29
+ required: true,
30
+ message: $t('Watermark.x_is_required'),
31
+ trigger: ['blur', 'change'],
32
+ },
33
+ ], {
34
+ enabled: enableValue,
35
+ })
36
+
37
+ const [yValue, yAttrs] = useElField<number>(getProp('y'), [
38
+ {
39
+ required: true,
40
+ message: $t('Watermark.y_is_required'),
41
+ trigger: ['blur', 'change'],
42
+ },
43
+ ], {
44
+ enabled: enableValue,
45
+ })
46
+
47
+ const [assetIdValue, assetIdAttrs] = useElField<string>(getProp('assetId'), [
48
+ {
49
+ required: true,
50
+ trigger: ['change'],
51
+ asyncValidator: (rule, value) => {
52
+ return new Promise((resolve, reject) => {
53
+ if (!value) {
54
+ reject(new Error(t('watermark.please_select_the_watermark')))
55
+ }
56
+ else {
57
+ $libraryApi('api/library/assets/{id}', { pathParams: { id: value } })
58
+ .then(resolve).catch(() => {
59
+ reject(new Error(t('asset_not_found')))
60
+ })
61
+ }
62
+ })
63
+ },
64
+ },
65
+ ], {
66
+ enabled: enableValue,
67
+ })
68
+
69
+ const [widthValue] = useElField<number>(getProp('width'), [
70
+ {
71
+ required: true,
72
+ trigger: ['blur', 'change'],
73
+ },
74
+ ], { enabled: enableValue })
75
+
76
+ const [heightValue] = useElField<number>(getProp('height'), [
77
+ {
78
+ required: true,
79
+ trigger: ['blur', 'change'],
80
+ },
81
+ ], {
82
+ enabled: enableValue,
83
+ })
84
+
85
+ const [mediaScaleValue, mediaScaleAttr] = useElField<number>(getProp('mediaScale'), [
86
+ {
87
+
88
+ required: true,
89
+ trigger: ['blur', 'change'],
90
+ validator: (rule, value, callback) => {
91
+ if (value > 10 || value < 0.1)
92
+ callback(new Error(t('library.the_media_scale_must_be_between')))
93
+ return callback()
94
+ },
95
+ },
96
+ ], {
97
+ enabled: enableValue,
98
+ })
99
+
100
+ const assetSrc = ref('https://i.ibb.co/0QvpcB3/on-fast.png')
101
+ const limit = ref(['image'])
102
+ const { data } = useAssetDetail(() => assetIdValue.value)
103
+
104
+ function handleRemove() {
105
+ ElMessageBox.confirm(t('base_library.are_you_sure_to_remove_watermark_asset'), t('general.warning'), {
106
+ confirmButtonText: t('Actions.confirm'),
107
+ cancelButtonText: t('Actions.cancel'),
108
+ type: 'warning',
109
+ })
110
+ .then(() => {
111
+ assetIdValue.value = ''
112
+ assetSrc.value = ''
113
+ })
114
+ }
115
+
116
+ const yRevert = computed({
117
+ get: () => {
118
+ return 1080 - yValue.value
119
+ },
120
+ set: (value: number) => {
121
+ yValue.value = 1080 - value
122
+ },
123
+ })
124
+
125
+ watch(mediaScaleValue, () => {
126
+ if (!data.value || !mediaScaleValue.value)
127
+ return
128
+ // update width and height
129
+ widthValue.value = data.value?.metadata?.width * mediaScaleValue.value
130
+ heightValue.value = data.value?.metadata?.height * mediaScaleValue.value
131
+ })
132
+
133
+ watchImmediate(data, () => {
134
+ if (!data.value)
135
+ return
136
+ const w = data.value?.metadata?.width
137
+ const h = data.value?.metadata?.height
138
+ const defaultScale = h > 1080 || w > 1920 ? 0.1 : 1
139
+ mediaScaleValue.value = mediaScaleValue.value || defaultScale
140
+ widthValue.value = w * mediaScaleValue.value
141
+ heightValue.value = h * mediaScaleValue.value
142
+ })
143
+
144
+ const imageStyles = computed(() => {
145
+ return {
146
+ top: `${yValue.value / 3}px`,
147
+ left: `${xValue.value / 3}px`,
148
+ height: `${heightValue.value / 3}px`,
149
+ width: `${widthValue.value / 3}px`,
150
+ }
151
+ })
152
+
153
+ function handleChangeEnable(newValue: boolean) {
154
+ if (newValue && !xValue.value) {
155
+ xValue.value = 0,
156
+ yValue.value = 0
157
+ mediaScaleValue.value = 1
158
+ delayValue.value = 0
159
+ widthValue.value = 120
160
+ heightValue.value = 88
161
+ }
162
+ }
163
+ </script>
164
+
165
+ <template>
166
+ <div>
167
+ <div class="flex flex-wrap gap-x-48px">
168
+ <el-form-item v-bind="enableAttrs">
169
+ <template #label>
170
+ <SSInformationLabel :label="$t('watermark.enable_label')" :info="schemaObj.enable" />
171
+ </template>
172
+ <el-switch v-model="enableValue" @change="handleChangeEnable" />
173
+ </el-form-item>
174
+ <el-form-item v-bind="delayAttrs">
175
+ <template #label>
176
+ <SSInformationLabel :label="`${$t('watermark.delay')} (s)`" :info="schemaObj.delay" />
177
+ </template>
178
+ <el-input-number v-model="delayValue" :disabled="!enableValue" :min="0" :max="120" :step="1" step-strictly />
179
+ </el-form-item>
180
+ <el-form-item v-bind="xAttrs">
181
+ <template #label>
182
+ <SSInformationLabel label="X" :info="schemaObj.x" />
183
+ </template>
184
+ <el-input-number v-model="xValue" :disabled="!enableValue" :min="0" :max="1920" />
185
+ </el-form-item>
186
+ <el-form-item v-bind="yAttrs">
187
+ <template #label>
188
+ <SSInformationLabel label="Y" :info="schemaObj.y" />
189
+ </template>
190
+ <el-input-number v-model="yValue" :disabled="!enableValue" :min="0" :max="1080" />
191
+ </el-form-item>
192
+
193
+ <el-form-item label="Media scale" v-bind="mediaScaleAttr" class="w-400px">
194
+ <template #label>
195
+ <SSInformationLabel label="Media scale" :info="schemaObj.mediaScale" />
196
+ </template>
197
+ <el-slider v-model="mediaScaleValue" :step="0.01" :disabled="!enableValue" :min="0.1" :max="10"
198
+ class="[&_.el-slider\_\_bar]:!bg-transparent" show-input />
199
+ </el-form-item>
200
+ </div>
201
+ <el-form-item v-bind="assetIdAttrs" class="block [&_.el-form-item\_\_error]:(ml-2)">
202
+ <template #label>
203
+ <SSInformationLabel label="Asset" :info="schemaObj.assetId" />
204
+ </template>
205
+
206
+ <SSAssetPicker v-model="assetIdValue" :asset-src="assetSrc" :disabled="!enableValue" :axios-instance="service"
207
+ :limit="limit" :asset-domain="ASSET_DEV_URL" />
208
+ <div class="relative">
209
+ <el-image v-if="data?.uri" fit="scale-down" class="ml-4 h-50px w-50px" :src="data.uri" />
210
+ <el-button v-if="assetIdValue && enableValue" size="small" class="absolute right-[-8px] top-0" type="danger"
211
+ circle plain @click="handleRemove">
212
+ <template #icon>
213
+ <div class="i-carbon:close" />
214
+ </template>
215
+ </el-button>
216
+ </div>
217
+ </el-form-item>
218
+ <div v-if="enableValue" class="grid grid-cols-[1fr_auto_1fr] grid-rows-[1fr_auto_1fr] mt-6">
219
+ <div class="col-start-2 pb-18px">
220
+ <el-slider v-model="xValue" :disabled="!enableValue" class="[&_.el-slider\_\_bar]:!bg-transparent" :min="0"
221
+ :max="1920" />
222
+ </div>
223
+ <div class="col-start-1 flex justify-end pr-18px">
224
+ <el-slider v-model="yRevert" vertical :min="0" :max="1080" :format-tooltip="(value) => `${1080 - value}`"
225
+ class="[&_.el-slider\_\_bar]:!bg-transparent" :disabled="!enableValue" />
226
+ </div>
227
+ <div class="relative col-start-2 mx-auto h-360px w-640px of-hidden rounded-10px ring-18px ring-gray-300">
228
+ <div class="absolute right-0 top-0 text-9px font-bold leading-12px -translate-y-full">
229
+ <el-text>
230
+ Full HD: <span>1920 x 1080</span>
231
+ </el-text>
232
+ </div>
233
+ <div class="absolute h-full w-full bg-#000">
234
+ <el-image v-if="data?.uri" :src="data.uri" :style="imageStyles" />
235
+ </div>
236
+ </div>
237
+ </div>
238
+ </div>
239
+ </template>
@@ -1,19 +1,19 @@
1
- <script lang="ts" setup>
2
- const { prop } = definePropsRefs<{
3
- prop: string
4
- }>()
5
- const [watermarkValue] = useElField<boolean>(prop.value)
6
- </script>
7
-
8
- <template>
9
- <div class="relative mx-auto mb-12px h-396px w-676px border-18px border-gray-300 rounded-10px border-solid">
10
- <div class="absolute right-0 top-0 text-9px font-bold leading-12px -translate-y-full">
11
- <el-text>
12
- Full HD: <span>1920 x 1080</span>
13
- </el-text>
14
- </div>
15
- <div class="absolute h-full w-full bg-#000">
16
- <WatermarkDraggableItem v-if="watermarkValue" v-model="watermarkValue" />
17
- </div>
18
- </div>
19
- </template>
1
+ <script lang="ts" setup>
2
+ const { prop } = definePropsRefs<{
3
+ prop: string
4
+ }>()
5
+ const [watermarkValue] = useElField<boolean>(prop.value)
6
+ </script>
7
+
8
+ <template>
9
+ <div class="relative mx-auto mb-12px h-396px w-676px border-18px border-gray-300 rounded-10px border-solid">
10
+ <div class="absolute right-0 top-0 text-9px font-bold leading-12px -translate-y-full">
11
+ <el-text>
12
+ Full HD: <span>1920 x 1080</span>
13
+ </el-text>
14
+ </div>
15
+ <div class="absolute h-full w-full bg-#000">
16
+ <WatermarkDraggableItem v-if="watermarkValue" v-model="watermarkValue" />
17
+ </div>
18
+ </div>
19
+ </template>
@@ -1,71 +1,71 @@
1
- <script setup>
2
- import { computed, provide, ref } from 'vue'
3
-
4
- const props = defineProps({
5
- grid: {
6
- type: Array,
7
- default: () => [1, 1],
8
- validator: val =>
9
- Array.isArray(val)
10
- && typeof val[0] === 'number'
11
- && typeof val[1] === 'number',
12
- },
13
- showGrid: {
14
- type: [Boolean, String],
15
- default: false,
16
- validator: val => [true, false, 'x', 'y', 'both'].includes(val),
17
- },
18
- gridColor: {
19
- type: String,
20
- default: 'rgba(0, 0, 0, 0.1)',
21
- },
22
- className: {
23
- type: String,
24
- default: 'drv-container',
25
- },
26
- })
27
-
28
- const grid = computed(() => {
29
- return props.grid
30
- })
31
-
32
- const className = computed(() => {
33
- return props.className
34
- })
35
-
36
- provide('drvContainerClass', className)
37
- provide('drvContainerGrid', grid)
38
-
39
- // const emit = defineEmits(['dragging', 'dragstop', 'activated', 'deactivated'])
40
-
41
- const el = ref(null)
42
-
43
- const gridBackgroundStyle = computed(() => {
44
- const axisBg = {
45
- x: `linear-gradient(-90deg, ${props.gridColor} 1px, transparent 1px) 0px 0px / ${props.grid[0]}px ${props.grid[0]}px`,
46
- y: `linear-gradient(0deg, ${props.gridColor} 1px, transparent 1px) 0px 0px / ${props.grid[1]}px ${props.grid[1]}px`,
47
- }
48
-
49
- if (props.showGrid === 'x' || props.showGrid === 'y')
50
- return axisBg[props.showGrid]
51
-
52
- return props.showGrid ? `${axisBg.x}, ${axisBg.y}` : null
53
- })
54
-
55
- const style = computed(() => {
56
- const style = {
57
- position: 'relative',
58
- }
59
-
60
- if (props.showGrid)
61
- style.background = gridBackgroundStyle.value
62
-
63
- return style
64
- })
65
- </script>
66
-
67
- <template>
68
- <div ref="el" :style="style" :class="[className]">
69
- <slot />
70
- </div>
71
- </template>
1
+ <script setup>
2
+ import { computed, provide, ref } from 'vue'
3
+
4
+ const props = defineProps({
5
+ grid: {
6
+ type: Array,
7
+ default: () => [1, 1],
8
+ validator: val =>
9
+ Array.isArray(val)
10
+ && typeof val[0] === 'number'
11
+ && typeof val[1] === 'number',
12
+ },
13
+ showGrid: {
14
+ type: [Boolean, String],
15
+ default: false,
16
+ validator: val => [true, false, 'x', 'y', 'both'].includes(val),
17
+ },
18
+ gridColor: {
19
+ type: String,
20
+ default: 'rgba(0, 0, 0, 0.1)',
21
+ },
22
+ className: {
23
+ type: String,
24
+ default: 'drv-container',
25
+ },
26
+ })
27
+
28
+ const grid = computed(() => {
29
+ return props.grid
30
+ })
31
+
32
+ const className = computed(() => {
33
+ return props.className
34
+ })
35
+
36
+ provide('drvContainerClass', className)
37
+ provide('drvContainerGrid', grid)
38
+
39
+ // const emit = defineEmits(['dragging', 'dragstop', 'activated', 'deactivated'])
40
+
41
+ const el = ref(null)
42
+
43
+ const gridBackgroundStyle = computed(() => {
44
+ const axisBg = {
45
+ x: `linear-gradient(-90deg, ${props.gridColor} 1px, transparent 1px) 0px 0px / ${props.grid[0]}px ${props.grid[0]}px`,
46
+ y: `linear-gradient(0deg, ${props.gridColor} 1px, transparent 1px) 0px 0px / ${props.grid[1]}px ${props.grid[1]}px`,
47
+ }
48
+
49
+ if (props.showGrid === 'x' || props.showGrid === 'y')
50
+ return axisBg[props.showGrid]
51
+
52
+ return props.showGrid ? `${axisBg.x}, ${axisBg.y}` : null
53
+ })
54
+
55
+ const style = computed(() => {
56
+ const style = {
57
+ position: 'relative',
58
+ }
59
+
60
+ if (props.showGrid)
61
+ style.background = gridBackgroundStyle.value
62
+
63
+ return style
64
+ })
65
+ </script>
66
+
67
+ <template>
68
+ <div ref="el" :style="style" :class="[className]">
69
+ <slot />
70
+ </div>
71
+ </template>