@jsg-developer/vue-pack 0.0.8 → 0.0.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/THIRD_PARTY_LICENSES.json +1 -1
- package/dist/chunks/{ArrayObject-Csiz0aJR.cjs.js → ArrayObject-0xuEhOhk.cjs.js} +1 -1
- package/dist/chunks/ArrayObject-DOjuPD1E.es.js +4 -0
- package/dist/chunks/{ColorPicker-CrIAXDwh.cjs.js → ColorPicker-9dL3PtG3.cjs.js} +1 -1
- package/dist/chunks/ColorPicker-BHhrw8Wl.es.js +4 -0
- package/dist/chunks/ComboboxComponent-CCkruI47.es.js +4 -0
- package/dist/chunks/{ComboboxComponent-CPTq69Ar.cjs.js → ComboboxComponent-CTx8Vw_9.cjs.js} +1 -1
- package/dist/chunks/CurrencyInput-BtFZho2N.es.js +4 -0
- package/dist/chunks/{CurrencyInput-CwoIqJ6_.cjs.js → CurrencyInput-ClSyBpnK.cjs.js} +1 -1
- package/dist/chunks/{DateInput-wbBbKLmh.cjs.js → DateInput-BThmjoqx.cjs.js} +1 -1
- package/dist/chunks/DateInput-b7NB_vXk.es.js +4 -0
- package/dist/chunks/{DateTimeInput-CCrf600J.es.js → DateTimeInput--FP_u8Yt.es.js} +1 -1
- package/dist/chunks/{DateTimeInput-BEpP2CFJ.cjs.js → DateTimeInput-Cpl1gFSK.cjs.js} +1 -1
- package/dist/chunks/{DateTimeInput.vue_vue_type_script_setup_true_lang-DF9gRqkl.es.js → DateTimeInput.vue_vue_type_script_setup_true_lang-BrkVOH9p.es.js} +1 -1
- package/dist/chunks/{DateTimeInput.vue_vue_type_script_setup_true_lang-BGz0eU7k.cjs.js → DateTimeInput.vue_vue_type_script_setup_true_lang-CILx0Aq6.cjs.js} +1 -1
- package/dist/chunks/EmailInput-B9UAysfD.es.js +4 -0
- package/dist/chunks/{EmailInput-CNVGAFnD.cjs.js → EmailInput-eOIpKbZI.cjs.js} +1 -1
- package/dist/chunks/{FileArrayInput-CAwxVS0H.cjs.js → FileArrayInput-6mVb0lZm.cjs.js} +1 -1
- package/dist/chunks/{FileArrayInput-DEHJtU_H.es.js → FileArrayInput-YgwwMJ8d.es.js} +2 -2
- package/dist/chunks/{FileArrayInput.vue_vue_type_script_setup_true_lang-BMhnxsx_.cjs.js → FileArrayInput.vue_vue_type_script_setup_true_lang-CvKWrmWs.cjs.js} +1 -1
- package/dist/chunks/{FileArrayInput.vue_vue_type_script_setup_true_lang-BrR9G0CJ.es.js → FileArrayInput.vue_vue_type_script_setup_true_lang-do6gh6pp.es.js} +1 -1
- package/dist/chunks/FileInput-C0TwpVgG.es.js +4 -0
- package/dist/chunks/{FileInput-D3qv7Xva.cjs.js → FileInput-DeYBBEUM.cjs.js} +1 -1
- package/dist/chunks/GroupRenderer-Cz1hjI-2.es.js +4 -0
- package/dist/chunks/{GroupRenderer-B-LDNqgX.cjs.js → GroupRenderer-DCjLcNfJ.cjs.js} +1 -1
- package/dist/chunks/{ImageArrayInput-BGOtUALS.cjs.js → ImageArrayInput-CQft-D0T.cjs.js} +1 -1
- package/dist/chunks/{ImageArrayInput-CjLQeJk1.es.js → ImageArrayInput-D5BB4r2J.es.js} +2 -2
- package/dist/chunks/ImageArrayInput.vue_vue_type_script_setup_true_lang-BZSS-Tzm.es.js +421 -0
- package/dist/chunks/ImageArrayInput.vue_vue_type_script_setup_true_lang-oeMxAliE.cjs.js +2 -0
- package/dist/chunks/{ImageInput-DiBVxIYB.cjs.js → ImageInput-D1eTYtg7.cjs.js} +1 -1
- package/dist/chunks/ImageInput-VbEI9JIR.es.js +4 -0
- package/dist/chunks/{NumberInput-uOgJyDTw.cjs.js → NumberInput-CMTLiG1b.cjs.js} +1 -1
- package/dist/chunks/NumberInput-DS17O3Cn.es.js +4 -0
- package/dist/chunks/{ObjectInput-DaD5_SCP.cjs.js → ObjectInput-EZWeOXLi.cjs.js} +1 -1
- package/dist/chunks/ObjectInput-b19oeQba.es.js +4 -0
- package/dist/chunks/PasswordInput-CBEbd-Ud.es.js +4 -0
- package/dist/chunks/{PasswordInput-De3IIREc.cjs.js → PasswordInput-CiM-mVrk.cjs.js} +1 -1
- package/dist/chunks/RateInput-3FQoVl8h.es.js +4 -0
- package/dist/chunks/{RateInput-DabVE516.cjs.js → RateInput-Cl6JCRpp.cjs.js} +1 -1
- package/dist/chunks/{TabelData-C0mYBwlw.cjs.js → TabelData-B0Le_B_Q.cjs.js} +1 -1
- package/dist/chunks/{TabelData-DmCnbhpq.es.js → TabelData-BHJC8v6o.es.js} +1 -1
- package/dist/chunks/{TagInput-DeJtdDLy.cjs.js → TagInput-CWz-bPwU.cjs.js} +1 -1
- package/dist/chunks/TagInput-DkB_fD-R.es.js +4 -0
- package/dist/chunks/TelInput-DU-SCcTv.es.js +4 -0
- package/dist/chunks/{TelInput-BP9pUjqj.cjs.js → TelInput-lfixYiaM.cjs.js} +1 -1
- package/dist/chunks/TextAreaInput-BUbpY_xl.es.js +4 -0
- package/dist/chunks/{TextAreaInput-HHOxggqB.cjs.js → TextAreaInput-D8RLKe9N.cjs.js} +1 -1
- package/dist/chunks/{TextAreaQuill-eYXH5fmB.es.js → TextAreaQuill-Bejqkd4x.es.js} +1 -1
- package/dist/chunks/{TextAreaQuill-B9Y9deA0.cjs.js → TextAreaQuill-DVN0ki8_.cjs.js} +1 -1
- package/dist/chunks/{TextInput-CdvHKzTG.cjs.js → TextInput-BtfPzo6G.cjs.js} +1 -1
- package/dist/chunks/TextInput-DThEAetr.es.js +4 -0
- package/dist/chunks/{TimeInput-X--wGzRV.cjs.js → TimeInput-DK-OIXEt.cjs.js} +1 -1
- package/dist/chunks/TimeInput-LUsipRMe.es.js +4 -0
- package/dist/chunks/ToggleInput-BA6Q1ZAd.es.js +4 -0
- package/dist/chunks/{ToggleInput-D3mXx4T9.cjs.js → ToggleInput-jjAYu5tM.cjs.js} +1 -1
- package/dist/chunks/{UrlInput-B7aRJE-9.cjs.js → UrlInput-BcVGcszC.cjs.js} +1 -1
- package/dist/chunks/UrlInput-CGMHyowb.es.js +4 -0
- package/dist/chunks/{resize-BCFyG_8Z.es.js → resize-Bn1jzV77.es.js} +2383 -2298
- package/dist/chunks/resize-BvELN8MY.cjs.js +12 -0
- package/dist/init.cjs.js +1 -1
- package/dist/init.es.js +1 -1
- package/dist/jsgd-vue-pack.cjs.js +1 -1
- package/dist/jsgd-vue-pack.es.js +104 -109
- package/dist/style.css +1 -1
- package/dist/types/components/Form/composables/useFormModal.d.ts +1 -9
- package/dist/types/components/UI/Inputs/ImageInput.vue.d.ts +3 -1
- package/dist/types/configs/types/field.types.d.ts +15 -28
- package/dist/types/configs/types/index.d.ts +1 -0
- package/dist/types/configs/types/props.types.d.ts +28 -6
- package/dist/types/configs/types/seo.types.d.ts +37 -0
- package/dist/types/untils/index.d.ts +1 -0
- package/dist/types/untils/seo.d.ts +4 -0
- package/dist/vue.cjs.js +1 -1
- package/dist/vue.es.js +6 -6
- package/package.json +1 -1
- package/dist/chunks/ArrayObject-BOxAB7JZ.es.js +0 -4
- package/dist/chunks/ColorPicker-DLKQ9Ey-.es.js +0 -4
- package/dist/chunks/ComboboxComponent-NlXQEb6_.es.js +0 -4
- package/dist/chunks/CurrencyInput-ClxBxxvt.es.js +0 -4
- package/dist/chunks/DateInput-Cin-DZ5f.es.js +0 -4
- package/dist/chunks/EmailInput-Dy0XZ2Qa.es.js +0 -4
- package/dist/chunks/FileInput-CgYkE6-h.es.js +0 -4
- package/dist/chunks/GroupRenderer-B9wTfSqo.es.js +0 -4
- package/dist/chunks/ImageArrayInput.vue_vue_type_script_setup_true_lang-B1pEayO7.cjs.js +0 -2
- package/dist/chunks/ImageArrayInput.vue_vue_type_script_setup_true_lang-DrIW4vyr.es.js +0 -322
- package/dist/chunks/ImageInput-C35ZFMDt.es.js +0 -4
- package/dist/chunks/NumberInput-Cb45QifM.es.js +0 -4
- package/dist/chunks/ObjectInput-DAyAshay.es.js +0 -4
- package/dist/chunks/PasswordInput-BPId2jr-.es.js +0 -4
- package/dist/chunks/RateInput-D6pg36at.es.js +0 -4
- package/dist/chunks/TagInput-Dd6wqtMS.es.js +0 -4
- package/dist/chunks/TelInput-D-CBtvax.es.js +0 -4
- package/dist/chunks/TextAreaInput-6XZuCGgS.es.js +0 -4
- package/dist/chunks/TextInput-BhSOEwQF.es.js +0 -4
- package/dist/chunks/TimeInput-C1P44F3V.es.js +0 -4
- package/dist/chunks/ToggleInput-CSw8joFu.es.js +0 -4
- package/dist/chunks/UrlInput-_14ZDA_x.es.js +0 -4
- package/dist/chunks/resize-xk-5mOU-.cjs.js +0 -12
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { Ref, ComputedRef } from 'vue';
|
|
2
|
-
import { Schema, Errors, FormData, FromModalProps, GlobalDefaultText } from '../../../configs/types';
|
|
3
|
-
export interface SeoAnalysisResult {
|
|
4
|
-
score: number;
|
|
5
|
-
details: {
|
|
6
|
-
passed: boolean;
|
|
7
|
-
message: string;
|
|
8
|
-
label: string;
|
|
9
|
-
}[];
|
|
10
|
-
}
|
|
2
|
+
import { Schema, Errors, FormData, FromModalProps, GlobalDefaultText, SeoAnalysisResult } from '../../../configs/types';
|
|
11
3
|
interface FormModalComposable {
|
|
12
4
|
formData: Ref<FormData>;
|
|
13
5
|
errors: Ref<Errors>;
|
|
@@ -9,5 +9,7 @@ declare const _default: import('vue').DefineComponent<ImageInputProps, {}, {}, {
|
|
|
9
9
|
"onRemove:error"?: ((key: string) => any) | undefined;
|
|
10
10
|
}>, {
|
|
11
11
|
id: string;
|
|
12
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
12
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
13
|
+
fileInputRef: HTMLInputElement;
|
|
14
|
+
}, HTMLDivElement>;
|
|
13
15
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataKeyConfig, Item, SubmitAuthOptionMap, Schema, XOR, DateOnly, TimeOnly, DateTimeString } from '../..';
|
|
1
|
+
import { DataKeyConfig, Item, SubmitAuthOptionMap, Schema, XOR, DateOnly, TimeOnly, DateTimeString, watermarkMargin, watermarkPosition, watermarkSize } from '../..';
|
|
2
2
|
export declare const ImageTypes: readonly ["png", "jpg", "jpeg", "gif", "bmp", "webp", "heif", "heic", "tiff", "tif", "svg", "avif", "ico", "jfif"];
|
|
3
3
|
export type ImageType = (typeof ImageTypes)[number];
|
|
4
4
|
export declare const fieldTypes: readonly ["text", "email", "password", "number", "image", "color", "select", "arrayObject", "quillEditor", "optionGroupSchema", "tag", "object", "url", "toggle", "date", "time", "dateTime", "imageArray", "file", "fileArray", "textArea", "currency", "rate", "tel"];
|
|
@@ -98,27 +98,6 @@ export interface NumberField extends BaseField {
|
|
|
98
98
|
duplicate?: (string | number)[] | boolean;
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
export interface SeoFieldMapping {
|
|
102
|
-
sendSeo?: boolean;
|
|
103
|
-
title: string;
|
|
104
|
-
description: string;
|
|
105
|
-
news?: string;
|
|
106
|
-
slug?: string;
|
|
107
|
-
focusKeyword?: string;
|
|
108
|
-
tags?: string;
|
|
109
|
-
image?: string;
|
|
110
|
-
author?: string;
|
|
111
|
-
publishedAt?: string;
|
|
112
|
-
canonical?: string;
|
|
113
|
-
}
|
|
114
|
-
export interface SeoAnalysisResult {
|
|
115
|
-
score: number;
|
|
116
|
-
details: {
|
|
117
|
-
passed: boolean;
|
|
118
|
-
message: string;
|
|
119
|
-
label: string;
|
|
120
|
-
}[];
|
|
121
|
-
}
|
|
122
101
|
export interface QuillEditorField extends BaseField {
|
|
123
102
|
type: 'quillEditor';
|
|
124
103
|
placeholder?: string;
|
|
@@ -182,9 +161,13 @@ export interface ImageField extends BaseField {
|
|
|
182
161
|
allowedTypes?: ImageType[];
|
|
183
162
|
};
|
|
184
163
|
watermark?: {
|
|
185
|
-
url: string;
|
|
186
|
-
position
|
|
187
|
-
transparant
|
|
164
|
+
url: string | 'upload';
|
|
165
|
+
position?: XOR<'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'full', watermarkPosition>;
|
|
166
|
+
transparant?: number;
|
|
167
|
+
size?: XOR<number, watermarkSize>;
|
|
168
|
+
margin?: XOR<watermarkMargin, number>;
|
|
169
|
+
rotate?: number;
|
|
170
|
+
opacity?: number;
|
|
188
171
|
};
|
|
189
172
|
}
|
|
190
173
|
export interface ImageArrayField extends BaseField {
|
|
@@ -208,9 +191,13 @@ export interface ImageArrayField extends BaseField {
|
|
|
208
191
|
allowedTypes?: ImageType[];
|
|
209
192
|
};
|
|
210
193
|
watermark?: {
|
|
211
|
-
url: string;
|
|
212
|
-
position
|
|
213
|
-
transparant
|
|
194
|
+
url: string | 'upload';
|
|
195
|
+
position?: XOR<'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'full', watermarkPosition>;
|
|
196
|
+
transparant?: number;
|
|
197
|
+
size?: XOR<number, watermarkSize>;
|
|
198
|
+
margin?: XOR<watermarkMargin, number>;
|
|
199
|
+
rotate?: number;
|
|
200
|
+
opacity?: number;
|
|
214
201
|
};
|
|
215
202
|
}
|
|
216
203
|
export interface FileArrayField extends BaseField {
|
|
@@ -288,6 +288,20 @@ export interface FileArrayInputProps {
|
|
|
288
288
|
lang?: string;
|
|
289
289
|
error?: string | string[];
|
|
290
290
|
}
|
|
291
|
+
export interface watermarkSize {
|
|
292
|
+
width: number;
|
|
293
|
+
height: number;
|
|
294
|
+
}
|
|
295
|
+
export interface watermarkMargin {
|
|
296
|
+
top?: number;
|
|
297
|
+
bottom?: number;
|
|
298
|
+
left?: number;
|
|
299
|
+
right?: number;
|
|
300
|
+
}
|
|
301
|
+
export interface watermarkPosition {
|
|
302
|
+
x: number;
|
|
303
|
+
y: number;
|
|
304
|
+
}
|
|
291
305
|
export interface ImageInputProps {
|
|
292
306
|
id?: string;
|
|
293
307
|
label?: string;
|
|
@@ -314,9 +328,13 @@ export interface ImageInputProps {
|
|
|
314
328
|
allowedTypes?: ImageType[];
|
|
315
329
|
};
|
|
316
330
|
watermark?: {
|
|
317
|
-
url: string;
|
|
318
|
-
position
|
|
319
|
-
transparant
|
|
331
|
+
url: string | 'upload';
|
|
332
|
+
position?: XOR<'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'full', watermarkPosition>;
|
|
333
|
+
transparant?: number;
|
|
334
|
+
size?: XOR<number, watermarkSize>;
|
|
335
|
+
margin?: XOR<watermarkMargin, number>;
|
|
336
|
+
rotate?: number;
|
|
337
|
+
opacity?: number;
|
|
320
338
|
};
|
|
321
339
|
lang?: SupportedLanguage;
|
|
322
340
|
}
|
|
@@ -347,9 +365,13 @@ export interface ImageArrayInputProps {
|
|
|
347
365
|
allowedTypes?: ImageType[];
|
|
348
366
|
};
|
|
349
367
|
watermark?: {
|
|
350
|
-
url: string;
|
|
351
|
-
position
|
|
352
|
-
transparant
|
|
368
|
+
url: string | 'upload';
|
|
369
|
+
position?: XOR<'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'full', watermarkPosition>;
|
|
370
|
+
transparant?: number;
|
|
371
|
+
size?: XOR<number, watermarkSize>;
|
|
372
|
+
margin?: XOR<watermarkMargin, number>;
|
|
373
|
+
rotate?: number;
|
|
374
|
+
opacity?: number;
|
|
353
375
|
};
|
|
354
376
|
lang?: SupportedLanguage;
|
|
355
377
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type SeoContentType = 'article' | 'product' | 'promo' | 'page';
|
|
2
|
+
export interface SeoFieldMapping {
|
|
3
|
+
contentType: SeoContentType;
|
|
4
|
+
scorePath?: string;
|
|
5
|
+
analysisPath?: string;
|
|
6
|
+
meta: {
|
|
7
|
+
title?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
slug?: string;
|
|
10
|
+
focusKeyword?: string;
|
|
11
|
+
canonical?: string;
|
|
12
|
+
};
|
|
13
|
+
content?: {
|
|
14
|
+
body?: string;
|
|
15
|
+
image?: string;
|
|
16
|
+
tags?: string;
|
|
17
|
+
author?: string;
|
|
18
|
+
};
|
|
19
|
+
social?: {
|
|
20
|
+
ogTitle?: string;
|
|
21
|
+
ogDescription?: string;
|
|
22
|
+
ogImage?: string;
|
|
23
|
+
twitterTitle?: string;
|
|
24
|
+
twitterDescription?: string;
|
|
25
|
+
twitterImage?: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface SeoAnalysisResult {
|
|
29
|
+
score: number;
|
|
30
|
+
details: {
|
|
31
|
+
passed: boolean;
|
|
32
|
+
score: number;
|
|
33
|
+
message: string;
|
|
34
|
+
label: string;
|
|
35
|
+
group: 'meta' | 'content' | 'social' | 'keyword';
|
|
36
|
+
}[];
|
|
37
|
+
}
|
package/dist/vue.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./chunks/resize-
|
|
1
|
+
"use strict";const e=require("./chunks/resize-BvELN8MY.cjs.js"),n=require("./chunks/TabelData-B0Le_B_Q.cjs.js"),s=require("./chunks/DateTimeInput.vue_vue_type_script_setup_true_lang-CILx0Aq6.cjs.js"),u=require("./chunks/FileArrayInput.vue_vue_type_script_setup_true_lang-CvKWrmWs.cjs.js"),c=require("./chunks/ImageArrayInput.vue_vue_type_script_setup_true_lang-oeMxAliE.cjs.js"),m=require("./chunks/TextAreaQuill-DVN0ki8_.cjs.js"),p=require("./init.cjs.js"),i=Object.freeze(Object.defineProperty({__proto__:null,AlertApp:n._sfc_main$4,ArrayObjectInput:e._sfc_main$2,BaseImage:n._sfc_main,BaseLabel:n._sfc_main$1,ColorInput:e._sfc_main$3,CurrencyInput:e._sfc_main$5,DateInput:e._sfc_main$7,DateTimeInput:s._sfc_main,EmailInput:e._sfc_main$8,FieldDetailRenderer:n.FieldDetailRenderer,FileArrayInput:u._sfc_main,FileInput:e._sfc_main$9,FormFieldRenderer:e._sfc_main,FormModal:e.FormModal,GroupRendererInput:e._sfc_main$10,ImageArrayInput:c._sfc_main,ImageInput:e._sfc_main$11,ImagePreview:n._sfc_main$2,Loader:e.Loader,ModalDetailData:n.ModalDetailData,NumberInput:e._sfc_main$12,ObjectInput:e._sfc_main$13,PasswordInput:e._sfc_main$14,RateInput:e._sfc_main$6,SafeHtml:n._sfc_main$3,SelectedOptions:e._sfc_main$4,TabelData:n.TabelData,TagInput:e._sfc_main$15,TelInput:e._sfc_main$17,TextAreaInput:e._sfc_main$16,TextAreaQuillInput:m.default,TextInput:e._sfc_main$18,TimeInput:e._sfc_main$19,ToggleInput:e._sfc_main$20,Tooltip:e._sfc_main$1,UrlInput:e._sfc_main$21,WarningForm:n.WarningForm},Symbol.toStringTag,{value:"Module"})),o={install(r,t){for(const _ in i){const a=i[_];a&&(a.name||a.__name)&&r.component(_,a)}t&&p(t)}};module.exports=o;
|
package/dist/vue.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { b as t, c as m, e as i, g as r, h as o, i as c, _ as f, F as p, j as l, k as u, L as $, l as I, m as d, n as g, f as T, d as b, o as F, q as A, p as y, r as j, t as D, v as x, a as O, w as M } from "./chunks/resize-
|
|
2
|
-
import { d as R, _ as S, a as k, F as v, b as w, M as C, c as L, T as P, W as h } from "./chunks/TabelData-
|
|
3
|
-
import { _ as q } from "./chunks/DateTimeInput.vue_vue_type_script_setup_true_lang-
|
|
4
|
-
import { _ as z } from "./chunks/FileArrayInput.vue_vue_type_script_setup_true_lang-
|
|
5
|
-
import { _ as B } from "./chunks/ImageArrayInput.vue_vue_type_script_setup_true_lang-
|
|
6
|
-
import Q from "./chunks/TextAreaQuill-
|
|
1
|
+
import { b as t, c as m, e as i, g as r, h as o, i as c, _ as f, F as p, j as l, k as u, L as $, l as I, m as d, n as g, f as T, d as b, o as F, q as A, p as y, r as j, t as D, v as x, a as O, w as M } from "./chunks/resize-Bn1jzV77.es.js";
|
|
2
|
+
import { d as R, _ as S, a as k, F as v, b as w, M as C, c as L, T as P, W as h } from "./chunks/TabelData-BHJC8v6o.es.js";
|
|
3
|
+
import { _ as q } from "./chunks/DateTimeInput.vue_vue_type_script_setup_true_lang-BrkVOH9p.es.js";
|
|
4
|
+
import { _ as z } from "./chunks/FileArrayInput.vue_vue_type_script_setup_true_lang-do6gh6pp.es.js";
|
|
5
|
+
import { _ as B } from "./chunks/ImageArrayInput.vue_vue_type_script_setup_true_lang-BZSS-Tzm.es.js";
|
|
6
|
+
import Q from "./chunks/TextAreaQuill-Bejqkd4x.es.js";
|
|
7
7
|
import W from "./init.es.js";
|
|
8
8
|
const e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
9
9
|
__proto__: null,
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("vue"),o=require("./resize-xk-5mOU-.cjs.js");require("dompurify");require("lodash.isequal");require("zod");const P={class:"jsgd-w-full jsgd-mb-4"},R=["for"],T={key:0,class:"jsgd-grid jsgd-grid-cols-2 jsgd-gap-4 jsgd-mb-6 min-[480px]:jsgd-grid-cols-3 md:jsgd-grid-cols-4 lg:jsgd-grid-cols-5"},U=["src","alt"],$=["onClick"],z={key:1,class:"jsgd-text-center jsgd-py-8 jsgd-px-4 jsgd-text-slate-400 dark:jsgd-text-slate-500"},A={class:"jsgd-text-center jsgd-mt-4"},D=["id","disabled"],N=["for"],q=["disabled"],K={class:"jsgd-mt-2 jsgd-flex jsgd-flex-col jsgd-gap-1"},G=t.defineComponent({__name:"ImageArrayInput",props:{id:{default:o.setUID},label:{},modelValue:{default:()=>[]},previewAlt:{},disabled:{type:Boolean},error:{},previewImages:{},validate:{},watermark:{},lang:{}},emits:["update:modelValue","push:error","remove:error"],setup(h,{emit:I}){const e=h,u=I,y=t.inject("TableComponents",{labels:t.ref(o.defaultTextLabelsMap[e.lang??"en"])}).labels,f=t.inject("TableComponents")?.ShowAlert,w=t.ref([]),j=t.ref([]),x=t.computed(()=>j.value.length>0?j.value:typeof e.error=="string"?[e.error]:Array.isArray(e.error)?e.error:[]),b=t.computed(()=>e.disabled?!0:!!(e.validate?.maxFiles&&e.modelValue&&e.modelValue.length>=e.validate.maxFiles)),M=t.computed(()=>{if(!e.validate)return"";const a=e.validate,r=[];if(a.maxFiles&&r.push(o.getMessage("imageMaxFiles",{max:a.maxFiles},e.lang??"en")),a.allowedTypes&&r.push(o.getMessage("imageType",{},e.lang??"en")+` (${a.allowedTypes.join(", ")})`),a.maxSize&&r.push(o.getMessage("imageMaxSize",{max:a.maxSize},e.lang??"en")),a.pixel){const s=a.pixel;("minWidth"in s||"maxWidth"in s||"minHeight"in s||"maxHeight"in s)&&(s.minWidth&&r.push(o.getMessage("imageMinWidth",{min:s.minWidth},e.lang??"en")),s.minHeight&&r.push(o.getMessage("imageMinHeight",{min:s.minHeight},e.lang??"en")),s.maxWidth&&r.push(o.getMessage("imageMaxWidth",{max:s.maxWidth},e.lang??"en")),s.maxHeight&&r.push(o.getMessage("imageMaxHeight",{max:s.maxHeight},e.lang??"en"))),("width"in s||"height"in s)&&r.push(o.getMessage("imagePixel",{width:s.width??"any",height:s.height??"any"},e.lang??"en"))}return a.ratio&&r.push(o.getMessage("imageRatio",{w:a.ratio.Width,h:a.ratio.Height},e.lang??"en")),r.join(`
|
|
2
|
-
`)});t.watch(()=>e.modelValue,async a=>{if(!a||a.length===0){w.value=e.previewImages||[],E();return}const r=a.map(s=>new Promise(d=>{if(typeof s=="string")d(s);else if(s instanceof File){const i=new FileReader;i.onload=g=>d(g.target?.result),i.onerror=()=>d(""),i.readAsDataURL(s)}else d("")}));w.value=await Promise.all(r),E()},{immediate:!0,deep:!0});function V(a,r=!1){return new Promise((s,d)=>{const i=new Image;r&&(i.crossOrigin="anonymous"),i.onload=()=>s(i),i.onerror=g=>{console.error("Failed to load image:",a,g),d(new Error(`Failed to load image: ${a}`))},i.src=a})}async function B(a){if(!e.watermark)return a;const r=e.watermark,s=URL.createObjectURL(a);try{const[d,i]=await Promise.all([V(s,!1),V(r.url,!0)]),g=document.createElement("canvas");g.width=d.width,g.height=d.height;const n=g.getContext("2d");if(!n)return a;n.drawImage(d,0,0),n.globalAlpha=r.transparant/100;let c=0,l=0;const m=10;switch(r.position){case"top-left":c=m,l=m,n.drawImage(i,c,l);break;case"top-right":c=d.width-i.width-m,l=m,n.drawImage(i,c,l);break;case"bottom-left":c=m,l=d.height-i.height-m,n.drawImage(i,c,l);break;case"bottom-right":c=d.width-i.width-m,l=d.height-i.height-m,n.drawImage(i,c,l);break;case"full":n.drawImage(i,0,0,d.width,d.height);break}return n.globalAlpha=1,new Promise((v,k)=>{g.toBlob(p=>{if(p){const F=new File([p],a.name,{type:a.type});v(F)}else k(new Error("Canvas toBlob failed"))},a.type)})}catch(d){throw console.error(`Watermark application failed for ${a.name}:`,d),f?.("error",`Watermark Error (${a.name})`,["Gagal menerapkan watermark pada gambar."]),d}finally{URL.revokeObjectURL(s)}}function _(){if(e.disabled)return;if(b.value){f?.("error",o.getMessage("imageMaxFiles",{max:e.validate.maxFiles},e.lang??"en"));return}const a=prompt(y.value.placeholder?.url??"Please enter the image URL");if(a)if(a.startsWith("http://")||a.startsWith("https://")){const r=e.modelValue||[];u("update:modelValue",[...r,a])}else f?.("error","Invalid URL",["Please enter a valid URL starting with http:// or https://"])}async function C(a){if(e.disabled)return;const r=a.target,s=r.files;if(!s||s.length===0)return;const d=e.modelValue||[],i=e.validate?.maxFiles;if(i&&d.length+s.length>i){f?.("error",o.getMessage("imageMaxFiles",{max:i},e.lang??"en")),r.value="";return}const g=[],n=e.validate?.allowedTypes?.map(l=>l.toLowerCase())??[];for(const l of Array.from(s)){const m=l.name.split(".").pop()?.toLowerCase();if(n.length>0&&(!m||!n.includes(m))){f?.("error","Invalid file type",[o.getMessage("imageType",{},e.lang??"en")+` (${e.validate?.allowedTypes?.join(", ")})`]);continue}g.push(l)}let c=[];if(e.watermark&&g.length>0)try{const l=g.map(m=>B(m));c=await Promise.all(l)}catch(l){console.error("Batch watermarking failed:",l),r.value="";return}else c=g;c.length>0&&u("update:modelValue",[...d,...c]),r.value=""}function W(a){if(e.disabled)return;const r=[...e.modelValue||[]];r.splice(a,1),u("update:modelValue",r)}async function E(){if(!e.validate||!e.modelValue||e.modelValue.length===0){j.value=[],u("remove:error",e.id);return}const a=[];e.validate.maxFiles&&e.modelValue.length>e.validate.maxFiles&&a.push(o.getMessage("imageMaxFiles",{max:e.validate.maxFiles},e.lang??"en"));const r=e.modelValue.map((d,i)=>S(d,i+1));(await Promise.all(r)).forEach(d=>a.push(...d)),j.value=[...new Set(a)],j.value.length>0?u("push:error",j.value,e.id):u("remove:error",e.id)}async function S(a,r){const s=[];if(!(a instanceof File))return typeof a=="string"&&(e.validate?.pixel||e.validate?.ratio),[];const d=a,i=e.validate;if(i.allowedTypes){const g=d.name.split(".").pop()?.toLowerCase();(!g||!i.allowedTypes.map(n=>n.toLowerCase()).includes(g))&&s.push(`File ${r}: `+o.getMessage("imageType",{},e.lang??"en")+` (${i.allowedTypes.join(", ")})`)}if(i.maxSize&&d.size/1024>i.maxSize&&s.push(`File ${r}: `+o.getMessage("imageMaxSize",{max:i.maxSize},e.lang??"en")),i.pixel||i.ratio){const g=await H(d),n=g.width,c=g.height;if(i.pixel){const l=i.pixel;("minWidth"in l&&l.minWidth&&n<l.minWidth||"minHeight"in l&&l.minHeight&&c<l.minHeight||"maxWidth"in l&&l.maxWidth&&n>l.maxWidth||"maxHeight"in l&&l.maxHeight&&c>l.maxHeight)&&s.push(`File ${r}: Invalid dimensions.`),("width"in l&&l.width&&n!==l.width||"height"in l&&l.height&&c!==l.height)&&s.push(`File ${r}: `+o.getMessage("imagePixel",{width:l.width??n,height:l.height??c},e.lang??"en"))}if(i.ratio){const l=i.ratio.Width,m=i.ratio.Height,v=o.simplifyRatio(n,c),k=o.simplifyRatio(l,m);let p=v.w===k.w&&v.h===k.h;if(!p){const F=n/c,L=l/m;p=Math.abs(F-L)<=.01}p||s.push(`File ${r}: `+o.getMessage("imageRatio",{w:String(l),h:String(m)},e.lang??"en"))}}return s}function H(a){return new Promise(r=>{const s=new FileReader;s.onload=d=>{const i=new Image;i.onload=()=>r({width:i.width,height:i.height}),i.onerror=()=>r({width:0,height:0}),i.src=d.target?.result},s.onerror=()=>r({width:0,height:0}),s.readAsDataURL(a)})}return(a,r)=>(t.openBlock(),t.createElementBlock("div",P,[t.createElementVNode("label",{for:h.id,class:t.normalizeClass(["jsgd-inline-flex jsgd-items-center jsgd-gap-2 jsgd-text-sm jsgd-font-medium jsgd-mb-2 jsgd-text-slate-900 jsgd-transition-colors jsgd-duration-200 dark:jsgd-text-slate-100",{"jsgd-text-red-500 dark:jsgd-text-red-400":x.value.length!==0}])},[t.createTextVNode(t.toDisplayString(h.label)+" ",1),M.value?(t.openBlock(),t.createBlock(t.unref(o._sfc_main$1),{key:0,text:M.value,as:"strong"},{default:t.withCtx(()=>[...r[0]||(r[0]=[t.createTextVNode(" ❓",-1)])]),_:1},8,["text"])):t.createCommentVNode("",!0)],10,R),t.createElementVNode("div",{class:t.normalizeClass(["jsgd-bg-slate-50 jsgd-border-2 jsgd-border-dashed jsgd-border-slate-300 jsgd-rounded-xl jsgd-p-6 jsgd-transition-colors jsgd-duration-200 hover:jsgd-bg-slate-100 hover:jsgd-border-blue-500 dark:jsgd-bg-slate-800 dark:jsgd-border-slate-600 dark:hover:jsgd-bg-slate-700 dark:hover:jsgd-border-blue-400",{"jsgd-border-red-300 dark:jsgd-border-red-800":x.value.length!==0}])},[w.value.length>0?(t.openBlock(),t.createElementBlock("div",T,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(w.value,(s,d)=>(t.openBlock(),t.createElementBlock("div",{key:d,class:"jsgd-relative jsgd-rounded-lg jsgd-overflow-hidden jsgd-shadow-sm jsgd-transition-all jsgd-duration-200 jsgd-group hover:jsgd-scale-105 hover:jsgd-shadow-lg jsgd-animate-[popIn_0.4s_ease-out_backwards]",style:t.normalizeStyle({animationDelay:`${d*50}ms`})},[t.createElementVNode("img",{src:s,alt:`${h.previewAlt} ${d+1}`,class:"jsgd-block jsgd-w-full jsgd-aspect-square jsgd-object-cover jsgd-bg-white dark:jsgd-bg-transparent"},null,8,U),h.disabled?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("button",{key:0,onClick:i=>W(d),class:"jsgd-absolute jsgd-top-2 jsgd-right-2 jsgd-w-7 jsgd-h-7 jsgd-pb-[5px] jsgd-flex jsgd-items-center jsgd-justify-center jsgd-text-xl jsgd-font-bold jsgd-leading-none jsgd-text-white jsgd-bg-red-500/80 jsgd-backdrop-blur-sm jsgd-rounded-full jsgd-border-2 jsgd-border-white jsgd-cursor-pointer jsgd-opacity-0 jsgd-scale-50 jsgd-transition-all jsgd-duration-200 hover:jsgd-bg-red-600 hover:jsgd-scale-110 hover:jsgd-rotate-90 group-hover:jsgd-opacity-100 group-hover:jsgd-scale-100","aria-label":"Remove image"}," × ",8,$))],4))),128))])):(t.openBlock(),t.createElementBlock("div",z,[t.createElementVNode("p",null,t.toDisplayString(t.unref(y)?.message?.noItemSelected),1)])),t.createElementVNode("div",A,[t.createElementVNode("input",{id:h.id,type:"file",accept:"image/*",multiple:"",onChange:C,class:"jsgd-hidden",disabled:b.value},null,40,D),t.createElementVNode("label",{for:h.id,class:t.normalizeClass(["jsgd-inline-flex jsgd-items-center jsgd-gap-2 jsgd-px-5 jsgd-py-2.5 jsgd-font-medium jsgd-border-none jsgd-rounded-lg jsgd-text-white jsgd-bg-blue-500 jsgd-cursor-pointer jsgd-transition-all jsgd-duration-200 hover:jsgd-bg-blue-600 hover:jsgd-scale-105 hover:jsgd-shadow-lg disabled:jsgd-bg-slate-100 disabled:jsgd-text-slate-500 disabled:jsgd-cursor-not-allowed dark:jsgd-bg-blue-600 dark:hover:jsgd-bg-blue-500 dark:disabled:jsgd-bg-slate-700 dark:disabled:jsgd-text-slate-400 before:jsgd-content-['+'] before:jsgd-text-lg before:jsgd-leading-none",{"jsgd-opacity-60 jsgd-cursor-not-allowed":b.value}])},t.toDisplayString(t.unref(y)?.btn?.upload??"Upload"),11,N),t.createElementVNode("button",{type:"button",onClick:_,disabled:b.value,class:"jsgd-inline-flex jsgd-items-center jsgd-gap-2 jsgd-px-5 jsgd-py-2.5 jsgd-font-medium jsgd-border-none jsgd-rounded-lg jsgd-text-white jsgd-bg-slate-600 jsgd-cursor-pointer jsgd-transition-all jsgd-duration-200 hover:jsgd-bg-slate-700 hover:jsgd-scale-105 hover:jsgd-shadow-lg disabled:jsgd-opacity-60 disabled:jsgd-cursor-not-allowed dark:jsgd-bg-slate-500 dark:hover:jsgd-bg-slate-400"}," URL ",8,q)])],2),t.createElementVNode("div",K,[x.value.length>0?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(x.value,(s,d)=>(t.openBlock(),t.createElementBlock("p",{key:d,class:"jsgd-text-sm jsgd-text-red-500 jsgd-animate-[fadeIn_300ms_ease-out] dark:jsgd-text-red-400"},t.toDisplayString(s),1))),128)):t.createCommentVNode("",!0)])]))}});exports._sfc_main=G;
|
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
import { defineComponent as Q, inject as T, ref as C, computed as H, watch as X, createElementBlock as u, openBlock as h, createElementVNode as c, normalizeClass as P, createTextVNode as $, createBlock as Y, createCommentVNode as S, toDisplayString as I, unref as U, withCtx as Z, Fragment as A, renderList as z, normalizeStyle as N } from "vue";
|
|
2
|
-
import { U as ee, z as te, a9 as m, S as M, a as ae } from "./resize-BCFyG_8Z.es.js";
|
|
3
|
-
import "dompurify";
|
|
4
|
-
import "lodash.isequal";
|
|
5
|
-
import "zod";
|
|
6
|
-
const se = { class: "jsgd-w-full jsgd-mb-4" }, ie = ["for"], re = {
|
|
7
|
-
key: 0,
|
|
8
|
-
class: "jsgd-grid jsgd-grid-cols-2 jsgd-gap-4 jsgd-mb-6 min-[480px]:jsgd-grid-cols-3 md:jsgd-grid-cols-4 lg:jsgd-grid-cols-5"
|
|
9
|
-
}, de = ["src", "alt"], le = ["onClick"], oe = {
|
|
10
|
-
key: 1,
|
|
11
|
-
class: "jsgd-text-center jsgd-py-8 jsgd-px-4 jsgd-text-slate-400 dark:jsgd-text-slate-500"
|
|
12
|
-
}, ne = { class: "jsgd-text-center jsgd-mt-4" }, ge = ["id", "disabled"], me = ["for"], he = ["disabled"], ce = { class: "jsgd-mt-2 jsgd-flex jsgd-flex-col jsgd-gap-1" }, be = /* @__PURE__ */ Q({
|
|
13
|
-
__name: "ImageArrayInput",
|
|
14
|
-
props: {
|
|
15
|
-
id: { default: ee },
|
|
16
|
-
label: {},
|
|
17
|
-
modelValue: { default: () => [] },
|
|
18
|
-
previewAlt: {},
|
|
19
|
-
disabled: { type: Boolean },
|
|
20
|
-
error: {},
|
|
21
|
-
previewImages: {},
|
|
22
|
-
validate: {},
|
|
23
|
-
watermark: {},
|
|
24
|
-
lang: {}
|
|
25
|
-
},
|
|
26
|
-
emits: ["update:modelValue", "push:error", "remove:error"],
|
|
27
|
-
setup(j, { emit: E }) {
|
|
28
|
-
const e = j, p = E, _ = T("TableComponents", {
|
|
29
|
-
labels: C(te[e.lang ?? "en"])
|
|
30
|
-
}).labels, x = T("TableComponents")?.ShowAlert, b = C([]), f = C([]), v = H(() => f.value.length > 0 ? f.value : typeof e.error == "string" ? [e.error] : Array.isArray(e.error) ? e.error : []), y = H(() => e.disabled ? !0 : !!(e.validate?.maxFiles && e.modelValue && e.modelValue.length >= e.validate.maxFiles)), V = H(() => {
|
|
31
|
-
if (!e.validate) return "";
|
|
32
|
-
const t = e.validate, i = [];
|
|
33
|
-
if (t.maxFiles && i.push(m("imageMaxFiles", { max: t.maxFiles }, e.lang ?? "en")), t.allowedTypes && i.push(m("imageType", {}, e.lang ?? "en") + ` (${t.allowedTypes.join(", ")})`), t.maxSize && i.push(m("imageMaxSize", { max: t.maxSize }, e.lang ?? "en")), t.pixel) {
|
|
34
|
-
const a = t.pixel;
|
|
35
|
-
("minWidth" in a || "maxWidth" in a || "minHeight" in a || "maxHeight" in a) && (a.minWidth && i.push(m("imageMinWidth", { min: a.minWidth }, e.lang ?? "en")), a.minHeight && i.push(m("imageMinHeight", { min: a.minHeight }, e.lang ?? "en")), a.maxWidth && i.push(m("imageMaxWidth", { max: a.maxWidth }, e.lang ?? "en")), a.maxHeight && i.push(m("imageMaxHeight", { max: a.maxHeight }, e.lang ?? "en"))), ("width" in a || "height" in a) && i.push(
|
|
36
|
-
m(
|
|
37
|
-
"imagePixel",
|
|
38
|
-
{ width: a.width ?? "any", height: a.height ?? "any" },
|
|
39
|
-
e.lang ?? "en"
|
|
40
|
-
)
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
return t.ratio && i.push(
|
|
44
|
-
m("imageRatio", { w: t.ratio.Width, h: t.ratio.Height }, e.lang ?? "en")
|
|
45
|
-
), i.join(`
|
|
46
|
-
`);
|
|
47
|
-
});
|
|
48
|
-
X(
|
|
49
|
-
() => e.modelValue,
|
|
50
|
-
async (t) => {
|
|
51
|
-
if (!t || t.length === 0) {
|
|
52
|
-
b.value = e.previewImages || [], R();
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const i = t.map((a) => new Promise((d) => {
|
|
56
|
-
if (typeof a == "string")
|
|
57
|
-
d(a);
|
|
58
|
-
else if (a instanceof File) {
|
|
59
|
-
const s = new FileReader();
|
|
60
|
-
s.onload = (o) => d(o.target?.result), s.onerror = () => d(""), s.readAsDataURL(a);
|
|
61
|
-
} else
|
|
62
|
-
d("");
|
|
63
|
-
}));
|
|
64
|
-
b.value = await Promise.all(i), R();
|
|
65
|
-
},
|
|
66
|
-
{ immediate: !0, deep: !0 }
|
|
67
|
-
);
|
|
68
|
-
function L(t, i = !1) {
|
|
69
|
-
return new Promise((a, d) => {
|
|
70
|
-
const s = new Image();
|
|
71
|
-
i && (s.crossOrigin = "anonymous"), s.onload = () => a(s), s.onerror = (o) => {
|
|
72
|
-
console.error("Failed to load image:", t, o), d(new Error(`Failed to load image: ${t}`));
|
|
73
|
-
}, s.src = t;
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
async function B(t) {
|
|
77
|
-
if (!e.watermark)
|
|
78
|
-
return t;
|
|
79
|
-
const i = e.watermark, a = URL.createObjectURL(t);
|
|
80
|
-
try {
|
|
81
|
-
const [d, s] = await Promise.all([
|
|
82
|
-
L(a, !1),
|
|
83
|
-
L(i.url, !0)
|
|
84
|
-
]), o = document.createElement("canvas");
|
|
85
|
-
o.width = d.width, o.height = d.height;
|
|
86
|
-
const l = o.getContext("2d");
|
|
87
|
-
if (!l) return t;
|
|
88
|
-
l.drawImage(d, 0, 0), l.globalAlpha = i.transparant / 100;
|
|
89
|
-
let n = 0, r = 0;
|
|
90
|
-
const g = 10;
|
|
91
|
-
switch (i.position) {
|
|
92
|
-
case "top-left":
|
|
93
|
-
n = g, r = g, l.drawImage(s, n, r);
|
|
94
|
-
break;
|
|
95
|
-
case "top-right":
|
|
96
|
-
n = d.width - s.width - g, r = g, l.drawImage(s, n, r);
|
|
97
|
-
break;
|
|
98
|
-
case "bottom-left":
|
|
99
|
-
n = g, r = d.height - s.height - g, l.drawImage(s, n, r);
|
|
100
|
-
break;
|
|
101
|
-
case "bottom-right":
|
|
102
|
-
n = d.width - s.width - g, r = d.height - s.height - g, l.drawImage(s, n, r);
|
|
103
|
-
break;
|
|
104
|
-
case "full":
|
|
105
|
-
l.drawImage(s, 0, 0, d.width, d.height);
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
return l.globalAlpha = 1, new Promise((k, F) => {
|
|
109
|
-
o.toBlob((w) => {
|
|
110
|
-
if (w) {
|
|
111
|
-
const W = new File([w], t.name, { type: t.type });
|
|
112
|
-
k(W);
|
|
113
|
-
} else
|
|
114
|
-
F(new Error("Canvas toBlob failed"));
|
|
115
|
-
}, t.type);
|
|
116
|
-
});
|
|
117
|
-
} catch (d) {
|
|
118
|
-
throw console.error(`Watermark application failed for ${t.name}:`, d), x?.("error", `Watermark Error (${t.name})`, [
|
|
119
|
-
"Gagal menerapkan watermark pada gambar."
|
|
120
|
-
]), d;
|
|
121
|
-
} finally {
|
|
122
|
-
URL.revokeObjectURL(a);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
function D() {
|
|
126
|
-
if (e.disabled) return;
|
|
127
|
-
if (y.value) {
|
|
128
|
-
x?.(
|
|
129
|
-
"error",
|
|
130
|
-
m("imageMaxFiles", { max: e.validate.maxFiles }, e.lang ?? "en")
|
|
131
|
-
);
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
const t = prompt(_.value.placeholder?.url ?? "Please enter the image URL");
|
|
135
|
-
if (t)
|
|
136
|
-
if (t.startsWith("http://") || t.startsWith("https://")) {
|
|
137
|
-
const i = e.modelValue || [];
|
|
138
|
-
p("update:modelValue", [...i, t]);
|
|
139
|
-
} else
|
|
140
|
-
x?.("error", "Invalid URL", [
|
|
141
|
-
"Please enter a valid URL starting with http:// or https://"
|
|
142
|
-
]);
|
|
143
|
-
}
|
|
144
|
-
async function K(t) {
|
|
145
|
-
if (e.disabled) return;
|
|
146
|
-
const i = t.target, a = i.files;
|
|
147
|
-
if (!a || a.length === 0) return;
|
|
148
|
-
const d = e.modelValue || [], s = e.validate?.maxFiles;
|
|
149
|
-
if (s && d.length + a.length > s) {
|
|
150
|
-
x?.("error", m("imageMaxFiles", { max: s }, e.lang ?? "en")), i.value = "";
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
const o = [], l = e.validate?.allowedTypes?.map((r) => r.toLowerCase()) ?? [];
|
|
154
|
-
for (const r of Array.from(a)) {
|
|
155
|
-
const g = r.name.split(".").pop()?.toLowerCase();
|
|
156
|
-
if (l.length > 0 && (!g || !l.includes(g))) {
|
|
157
|
-
x?.("error", "Invalid file type", [
|
|
158
|
-
m("imageType", {}, e.lang ?? "en") + ` (${e.validate?.allowedTypes?.join(", ")})`
|
|
159
|
-
]);
|
|
160
|
-
continue;
|
|
161
|
-
}
|
|
162
|
-
o.push(r);
|
|
163
|
-
}
|
|
164
|
-
let n = [];
|
|
165
|
-
if (e.watermark && o.length > 0)
|
|
166
|
-
try {
|
|
167
|
-
const r = o.map((g) => B(g));
|
|
168
|
-
n = await Promise.all(r);
|
|
169
|
-
} catch (r) {
|
|
170
|
-
console.error("Batch watermarking failed:", r), i.value = "";
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
else
|
|
174
|
-
n = o;
|
|
175
|
-
n.length > 0 && p("update:modelValue", [...d, ...n]), i.value = "";
|
|
176
|
-
}
|
|
177
|
-
function q(t) {
|
|
178
|
-
if (e.disabled) return;
|
|
179
|
-
const i = [...e.modelValue || []];
|
|
180
|
-
i.splice(t, 1), p("update:modelValue", i);
|
|
181
|
-
}
|
|
182
|
-
async function R() {
|
|
183
|
-
if (!e.validate || !e.modelValue || e.modelValue.length === 0) {
|
|
184
|
-
f.value = [], p("remove:error", e.id);
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
const t = [];
|
|
188
|
-
e.validate.maxFiles && e.modelValue.length > e.validate.maxFiles && t.push(m("imageMaxFiles", { max: e.validate.maxFiles }, e.lang ?? "en"));
|
|
189
|
-
const i = e.modelValue.map(
|
|
190
|
-
(d, s) => G(d, s + 1)
|
|
191
|
-
);
|
|
192
|
-
(await Promise.all(i)).forEach((d) => t.push(...d)), f.value = [...new Set(t)], f.value.length > 0 ? p("push:error", f.value, e.id) : p("remove:error", e.id);
|
|
193
|
-
}
|
|
194
|
-
async function G(t, i) {
|
|
195
|
-
const a = [];
|
|
196
|
-
if (!(t instanceof File))
|
|
197
|
-
return typeof t == "string" && (e.validate?.pixel || e.validate?.ratio), [];
|
|
198
|
-
const d = t, s = e.validate;
|
|
199
|
-
if (s.allowedTypes) {
|
|
200
|
-
const o = d.name.split(".").pop()?.toLowerCase();
|
|
201
|
-
(!o || !s.allowedTypes.map((l) => l.toLowerCase()).includes(o)) && a.push(
|
|
202
|
-
`File ${i}: ` + m("imageType", {}, e.lang ?? "en") + ` (${s.allowedTypes.join(", ")})`
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
if (s.maxSize && d.size / 1024 > s.maxSize && a.push(
|
|
206
|
-
`File ${i}: ` + m("imageMaxSize", { max: s.maxSize }, e.lang ?? "en")
|
|
207
|
-
), s.pixel || s.ratio) {
|
|
208
|
-
const o = await O(d), l = o.width, n = o.height;
|
|
209
|
-
if (s.pixel) {
|
|
210
|
-
const r = s.pixel;
|
|
211
|
-
("minWidth" in r && r.minWidth && l < r.minWidth || "minHeight" in r && r.minHeight && n < r.minHeight || "maxWidth" in r && r.maxWidth && l > r.maxWidth || "maxHeight" in r && r.maxHeight && n > r.maxHeight) && a.push(`File ${i}: Invalid dimensions.`), ("width" in r && r.width && l !== r.width || "height" in r && r.height && n !== r.height) && a.push(
|
|
212
|
-
`File ${i}: ` + m(
|
|
213
|
-
"imagePixel",
|
|
214
|
-
{ width: r.width ?? l, height: r.height ?? n },
|
|
215
|
-
e.lang ?? "en"
|
|
216
|
-
)
|
|
217
|
-
);
|
|
218
|
-
}
|
|
219
|
-
if (s.ratio) {
|
|
220
|
-
const r = s.ratio.Width, g = s.ratio.Height, k = M(l, n), F = M(r, g);
|
|
221
|
-
let w = k.w === F.w && k.h === F.h;
|
|
222
|
-
if (!w) {
|
|
223
|
-
const W = l / n, J = r / g;
|
|
224
|
-
w = Math.abs(W - J) <= 0.01;
|
|
225
|
-
}
|
|
226
|
-
w || a.push(
|
|
227
|
-
`File ${i}: ` + m(
|
|
228
|
-
"imageRatio",
|
|
229
|
-
{ w: String(r), h: String(g) },
|
|
230
|
-
e.lang ?? "en"
|
|
231
|
-
)
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
return a;
|
|
236
|
-
}
|
|
237
|
-
function O(t) {
|
|
238
|
-
return new Promise((i) => {
|
|
239
|
-
const a = new FileReader();
|
|
240
|
-
a.onload = (d) => {
|
|
241
|
-
const s = new Image();
|
|
242
|
-
s.onload = () => i({ width: s.width, height: s.height }), s.onerror = () => i({ width: 0, height: 0 }), s.src = d.target?.result;
|
|
243
|
-
}, a.onerror = () => i({ width: 0, height: 0 }), a.readAsDataURL(t);
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
return (t, i) => (h(), u("div", se, [
|
|
247
|
-
c("label", {
|
|
248
|
-
for: j.id,
|
|
249
|
-
class: P(["jsgd-inline-flex jsgd-items-center jsgd-gap-2 jsgd-text-sm jsgd-font-medium jsgd-mb-2 jsgd-text-slate-900 jsgd-transition-colors jsgd-duration-200 dark:jsgd-text-slate-100", { "jsgd-text-red-500 dark:jsgd-text-red-400": v.value.length !== 0 }])
|
|
250
|
-
}, [
|
|
251
|
-
$(I(j.label) + " ", 1),
|
|
252
|
-
V.value ? (h(), Y(U(ae), {
|
|
253
|
-
key: 0,
|
|
254
|
-
text: V.value,
|
|
255
|
-
as: "strong"
|
|
256
|
-
}, {
|
|
257
|
-
default: Z(() => [...i[0] || (i[0] = [
|
|
258
|
-
$(" ❓", -1)
|
|
259
|
-
])]),
|
|
260
|
-
_: 1
|
|
261
|
-
}, 8, ["text"])) : S("", !0)
|
|
262
|
-
], 10, ie),
|
|
263
|
-
c("div", {
|
|
264
|
-
class: P(["jsgd-bg-slate-50 jsgd-border-2 jsgd-border-dashed jsgd-border-slate-300 jsgd-rounded-xl jsgd-p-6 jsgd-transition-colors jsgd-duration-200 hover:jsgd-bg-slate-100 hover:jsgd-border-blue-500 dark:jsgd-bg-slate-800 dark:jsgd-border-slate-600 dark:hover:jsgd-bg-slate-700 dark:hover:jsgd-border-blue-400", { "jsgd-border-red-300 dark:jsgd-border-red-800": v.value.length !== 0 }])
|
|
265
|
-
}, [
|
|
266
|
-
b.value.length > 0 ? (h(), u("div", re, [
|
|
267
|
-
(h(!0), u(A, null, z(b.value, (a, d) => (h(), u("div", {
|
|
268
|
-
key: d,
|
|
269
|
-
class: "jsgd-relative jsgd-rounded-lg jsgd-overflow-hidden jsgd-shadow-sm jsgd-transition-all jsgd-duration-200 jsgd-group hover:jsgd-scale-105 hover:jsgd-shadow-lg jsgd-animate-[popIn_0.4s_ease-out_backwards]",
|
|
270
|
-
style: N({ animationDelay: `${d * 50}ms` })
|
|
271
|
-
}, [
|
|
272
|
-
c("img", {
|
|
273
|
-
src: a,
|
|
274
|
-
alt: `${j.previewAlt} ${d + 1}`,
|
|
275
|
-
class: "jsgd-block jsgd-w-full jsgd-aspect-square jsgd-object-cover jsgd-bg-white dark:jsgd-bg-transparent"
|
|
276
|
-
}, null, 8, de),
|
|
277
|
-
j.disabled ? S("", !0) : (h(), u("button", {
|
|
278
|
-
key: 0,
|
|
279
|
-
onClick: (s) => q(d),
|
|
280
|
-
class: "jsgd-absolute jsgd-top-2 jsgd-right-2 jsgd-w-7 jsgd-h-7 jsgd-pb-[5px] jsgd-flex jsgd-items-center jsgd-justify-center jsgd-text-xl jsgd-font-bold jsgd-leading-none jsgd-text-white jsgd-bg-red-500/80 jsgd-backdrop-blur-sm jsgd-rounded-full jsgd-border-2 jsgd-border-white jsgd-cursor-pointer jsgd-opacity-0 jsgd-scale-50 jsgd-transition-all jsgd-duration-200 hover:jsgd-bg-red-600 hover:jsgd-scale-110 hover:jsgd-rotate-90 group-hover:jsgd-opacity-100 group-hover:jsgd-scale-100",
|
|
281
|
-
"aria-label": "Remove image"
|
|
282
|
-
}, " × ", 8, le))
|
|
283
|
-
], 4))), 128))
|
|
284
|
-
])) : (h(), u("div", oe, [
|
|
285
|
-
c("p", null, I(U(_)?.message?.noItemSelected), 1)
|
|
286
|
-
])),
|
|
287
|
-
c("div", ne, [
|
|
288
|
-
c("input", {
|
|
289
|
-
id: j.id,
|
|
290
|
-
type: "file",
|
|
291
|
-
accept: "image/*",
|
|
292
|
-
multiple: "",
|
|
293
|
-
onChange: K,
|
|
294
|
-
class: "jsgd-hidden",
|
|
295
|
-
disabled: y.value
|
|
296
|
-
}, null, 40, ge),
|
|
297
|
-
c("label", {
|
|
298
|
-
for: j.id,
|
|
299
|
-
class: P(["jsgd-inline-flex jsgd-items-center jsgd-gap-2 jsgd-px-5 jsgd-py-2.5 jsgd-font-medium jsgd-border-none jsgd-rounded-lg jsgd-text-white jsgd-bg-blue-500 jsgd-cursor-pointer jsgd-transition-all jsgd-duration-200 hover:jsgd-bg-blue-600 hover:jsgd-scale-105 hover:jsgd-shadow-lg disabled:jsgd-bg-slate-100 disabled:jsgd-text-slate-500 disabled:jsgd-cursor-not-allowed dark:jsgd-bg-blue-600 dark:hover:jsgd-bg-blue-500 dark:disabled:jsgd-bg-slate-700 dark:disabled:jsgd-text-slate-400 before:jsgd-content-['+'] before:jsgd-text-lg before:jsgd-leading-none", {
|
|
300
|
-
"jsgd-opacity-60 jsgd-cursor-not-allowed": y.value
|
|
301
|
-
}])
|
|
302
|
-
}, I(U(_)?.btn?.upload ?? "Upload"), 11, me),
|
|
303
|
-
c("button", {
|
|
304
|
-
type: "button",
|
|
305
|
-
onClick: D,
|
|
306
|
-
disabled: y.value,
|
|
307
|
-
class: "jsgd-inline-flex jsgd-items-center jsgd-gap-2 jsgd-px-5 jsgd-py-2.5 jsgd-font-medium jsgd-border-none jsgd-rounded-lg jsgd-text-white jsgd-bg-slate-600 jsgd-cursor-pointer jsgd-transition-all jsgd-duration-200 hover:jsgd-bg-slate-700 hover:jsgd-scale-105 hover:jsgd-shadow-lg disabled:jsgd-opacity-60 disabled:jsgd-cursor-not-allowed dark:jsgd-bg-slate-500 dark:hover:jsgd-bg-slate-400"
|
|
308
|
-
}, " URL ", 8, he)
|
|
309
|
-
])
|
|
310
|
-
], 2),
|
|
311
|
-
c("div", ce, [
|
|
312
|
-
v.value.length > 0 ? (h(!0), u(A, { key: 0 }, z(v.value, (a, d) => (h(), u("p", {
|
|
313
|
-
key: d,
|
|
314
|
-
class: "jsgd-text-sm jsgd-text-red-500 jsgd-animate-[fadeIn_300ms_ease-out] dark:jsgd-text-red-400"
|
|
315
|
-
}, I(a), 1))), 128)) : S("", !0)
|
|
316
|
-
])
|
|
317
|
-
]));
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
export {
|
|
321
|
-
be as _
|
|
322
|
-
};
|