@retailcrm/embed-ui-v1-components 0.5.8 → 0.5.10
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/dist/host.cjs +82 -19
- package/dist/host.d.ts +23 -0
- package/dist/host.js +83 -20
- package/dist/remote.cjs +11 -0
- package/dist/remote.d.ts +15 -0
- package/dist/remote.js +13 -2
- package/package.json +2 -1
package/dist/host.cjs
CHANGED
|
@@ -4,12 +4,13 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
6
6
|
const vue = require("vue");
|
|
7
|
-
const
|
|
7
|
+
const imagePreview = require("@retailcrm/image-preview");
|
|
8
|
+
const _hoisted_1$f = {
|
|
8
9
|
xmlns: "http://www.w3.org/2000/svg",
|
|
9
10
|
viewBox: "0 0 24 24"
|
|
10
11
|
};
|
|
11
12
|
function render$7(_ctx, _cache) {
|
|
12
|
-
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$
|
|
13
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$f, _cache[0] || (_cache[0] = [
|
|
13
14
|
vue.createElementVNode("path", {
|
|
14
15
|
fill: "currentColor",
|
|
15
16
|
"fill-rule": "evenodd",
|
|
@@ -19,30 +20,72 @@ function render$7(_ctx, _cache) {
|
|
|
19
20
|
]));
|
|
20
21
|
}
|
|
21
22
|
const IconHelpOutlined = { render: render$7 };
|
|
22
|
-
const _hoisted_1$
|
|
23
|
+
const _hoisted_1$e = {
|
|
23
24
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24
25
|
viewBox: "0 0 18 8"
|
|
25
26
|
};
|
|
26
27
|
function render$6(_ctx, _cache) {
|
|
27
|
-
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$
|
|
28
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$e, _cache[0] || (_cache[0] = [
|
|
28
29
|
vue.createElementVNode("g", { fill: "currentColor" }, [
|
|
29
30
|
vue.createElementVNode("path", { d: "M0 0v8h2.867q1.257-.011 1.935-.604.68-.594.68-1.748 0-.675-.33-1.143a1.54 1.54 0 0 0-.892-.62q.497-.21.775-.654.279-.45.279-1.039 0-1.077-.694-1.632Q3.926 0 2.584 0zm1.52 6.676v-2.16h1.393q1.048.016 1.048 1.116 0 .488-.303.77-.3.273-.836.274zm1.124-3.324H1.52V1.335h1.064q.628 0 .916.242.294.236.294.78 0 .972-1.15.995M7.503 6.352h2.665L10.679 8h1.616l-2.76-8H8.125L5.38 8h1.616zm2.254-1.336H7.913l.917-2.994zM12.362 8V0h2.27q.972 0 1.737.478.77.473 1.2 1.352.432.873.431 1.989v.368q0 1.115-.425 1.983a3.17 3.17 0 0 1-1.191 1.346A3.26 3.26 0 0 1 14.646 8zm1.52-6.665v5.34h.734q.891 0 1.363-.631.47-.632.481-1.808v-.423q0-1.22-.466-1.846-.466-.632-1.363-.632z" })
|
|
30
31
|
], -1)
|
|
31
32
|
]));
|
|
32
33
|
}
|
|
33
34
|
const SpriteBAD = { render: render$6 };
|
|
34
|
-
const _hoisted_1$
|
|
35
|
+
const _hoisted_1$d = {
|
|
35
36
|
xmlns: "http://www.w3.org/2000/svg",
|
|
36
37
|
viewBox: "0 0 16 8"
|
|
37
38
|
};
|
|
38
39
|
function render$5(_ctx, _cache) {
|
|
39
|
-
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$
|
|
40
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$d, _cache[0] || (_cache[0] = [
|
|
40
41
|
vue.createElementVNode("g", { fill: "currentColor" }, [
|
|
41
42
|
vue.createElementVNode("path", { d: "M3.373 6.016 5.058 0h1.704L4.175 8H2.577L0 0h1.7zM8.99 8H7.46V0H8.99zM11.84 8V5.181h1.343q1.322 0 2.067-.676.75-.681.75-1.857 0-.774-.342-1.379a2.3 2.3 0 0 0-.98-.94Q14.045 0 13.208 0H10.31v8zm1.368-4.154h-1.367v-2.51h1.403q.567.01.888.373t.322.95q0 .571-.322.88-.316.307-.924.307" })
|
|
42
43
|
], -1)
|
|
43
44
|
]));
|
|
44
45
|
}
|
|
45
46
|
const SpriteVIP = { render: render$5 };
|
|
47
|
+
const ImageWorkersKey = Symbol("$image.workers");
|
|
48
|
+
const _hoisted_1$c = ["alt", "src"];
|
|
49
|
+
const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
|
|
50
|
+
__name: "UiImage",
|
|
51
|
+
props: {
|
|
52
|
+
alt: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: ""
|
|
55
|
+
},
|
|
56
|
+
src: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: ""
|
|
59
|
+
},
|
|
60
|
+
resize: {
|
|
61
|
+
type: null,
|
|
62
|
+
default: void 0
|
|
63
|
+
},
|
|
64
|
+
crop: {
|
|
65
|
+
type: null,
|
|
66
|
+
default: void 0
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
setup(__props) {
|
|
70
|
+
const props = __props;
|
|
71
|
+
const workers = vue.inject(ImageWorkersKey, vue.ref([]));
|
|
72
|
+
const url = vue.computed(() => {
|
|
73
|
+
if (!props.src) {
|
|
74
|
+
return void 0;
|
|
75
|
+
}
|
|
76
|
+
if (props.resize || props.crop) {
|
|
77
|
+
return workers.value.length ? imagePreview.preview(workers.value, props.src, props.resize, props.crop) : void 0;
|
|
78
|
+
}
|
|
79
|
+
return props.src;
|
|
80
|
+
});
|
|
81
|
+
return (_ctx, _cache) => {
|
|
82
|
+
return vue.openBlock(), vue.createElementBlock("img", vue.mergeProps({
|
|
83
|
+
alt: __props.alt,
|
|
84
|
+
src: url.value
|
|
85
|
+
}, _ctx.$attrs), null, 16, _hoisted_1$c);
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
});
|
|
46
89
|
const isURL = (href) => {
|
|
47
90
|
try {
|
|
48
91
|
const normalizedHref = href.includes("://") ? href : `http://${href}`;
|
|
@@ -68,24 +111,23 @@ var STATUS = /* @__PURE__ */ ((STATUS2) => {
|
|
|
68
111
|
STATUS2["FREE"] = "free";
|
|
69
112
|
return STATUS2;
|
|
70
113
|
})(STATUS || {});
|
|
71
|
-
const _hoisted_1$b =
|
|
72
|
-
const _hoisted_2$4 = {
|
|
114
|
+
const _hoisted_1$b = {
|
|
73
115
|
key: 1,
|
|
74
116
|
class: "ui-v1-avatar__unresolved"
|
|
75
117
|
};
|
|
76
|
-
const
|
|
118
|
+
const _hoisted_2$4 = {
|
|
77
119
|
key: 3,
|
|
78
120
|
class: "ui-v1-avatar__initials"
|
|
79
121
|
};
|
|
80
|
-
const
|
|
122
|
+
const _hoisted_3$3 = {
|
|
81
123
|
key: 4,
|
|
82
124
|
class: "ui-v1-avatar__labels"
|
|
83
125
|
};
|
|
84
|
-
const
|
|
126
|
+
const _hoisted_4$1 = {
|
|
85
127
|
key: 0,
|
|
86
128
|
class: "ui-v1-avatar__label ui-v1-avatar__label_vip"
|
|
87
129
|
};
|
|
88
|
-
const
|
|
130
|
+
const _hoisted_5$1 = {
|
|
89
131
|
key: 1,
|
|
90
132
|
class: "ui-v1-avatar__label ui-v1-avatar__label_bad"
|
|
91
133
|
};
|
|
@@ -130,6 +172,10 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
130
172
|
type: String,
|
|
131
173
|
validator: (size) => Object.values(SIZE$5).includes(size),
|
|
132
174
|
default: SIZE$5.SM
|
|
175
|
+
},
|
|
176
|
+
optimize: {
|
|
177
|
+
type: [Boolean, Object],
|
|
178
|
+
default: true
|
|
133
179
|
}
|
|
134
180
|
},
|
|
135
181
|
setup(__props) {
|
|
@@ -146,6 +192,20 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
146
192
|
return otherNames.length > 0 ? firstLetterOf(firstName) + firstLetterOf(otherNames[otherNames.length - 1]) : firstLetterOf(firstName);
|
|
147
193
|
});
|
|
148
194
|
const size = vue.inject(AvatarSizeKey, vue.computed(() => props.size));
|
|
195
|
+
const optimization = vue.computed(() => {
|
|
196
|
+
if (!props.optimize) {
|
|
197
|
+
return { resize: void 0, crop: void 0 };
|
|
198
|
+
}
|
|
199
|
+
const processing = typeof props.optimize === "object" ? props.optimize : {};
|
|
200
|
+
return {
|
|
201
|
+
resize: processing.resize ?? {
|
|
202
|
+
[SIZE$5.XS]: "48x-",
|
|
203
|
+
[SIZE$5.SM]: "72x-",
|
|
204
|
+
[SIZE$5.LG]: "104x-"
|
|
205
|
+
}[size.value],
|
|
206
|
+
crop: processing.crop
|
|
207
|
+
};
|
|
208
|
+
});
|
|
149
209
|
return (_ctx, _cache) => {
|
|
150
210
|
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(__props.href ? "a" : "div"), vue.mergeProps({
|
|
151
211
|
ref: "root",
|
|
@@ -158,15 +218,16 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
158
218
|
}
|
|
159
219
|
}, _ctx.$attrs), {
|
|
160
220
|
default: vue.withCtx(() => [
|
|
161
|
-
__props.src ? (vue.openBlock(), vue.
|
|
221
|
+
__props.src ? (vue.openBlock(), vue.createBlock(_sfc_main$i, {
|
|
162
222
|
key: 0,
|
|
163
223
|
src: __props.src,
|
|
164
|
-
|
|
224
|
+
resize: optimization.value.resize,
|
|
225
|
+
crop: optimization.value.crop,
|
|
165
226
|
class: "ui-v1-avatar__image",
|
|
166
227
|
draggable: "false",
|
|
167
228
|
onLoad: _cache[0] || (_cache[0] = ($event) => loaded.value = true),
|
|
168
229
|
onError: _cache[1] || (_cache[1] = ($event) => loaded.value = false)
|
|
169
|
-
}, null,
|
|
230
|
+
}, null, 8, ["src", "resize", "crop"])) : !__props.src && unresolved.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
|
|
170
231
|
vue.createVNode(vue.unref(IconHelpOutlined))
|
|
171
232
|
])) : vue.createCommentVNode("", true),
|
|
172
233
|
__props.status && !(__props.vip || __props.bad) ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
@@ -177,16 +238,16 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
177
238
|
[`ui-v1-avatar__status_${__props.status}`]: __props.status
|
|
178
239
|
})
|
|
179
240
|
}, null, 2)) : vue.createCommentVNode("", true),
|
|
180
|
-
!(unresolved.value || loaded.value) ? (vue.openBlock(), vue.createElementBlock("div",
|
|
241
|
+
!(unresolved.value || loaded.value) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$4, [
|
|
181
242
|
vue.renderSlot(_ctx.$slots, "default", {}, () => [
|
|
182
243
|
vue.createTextVNode(vue.toDisplayString(initials.value), 1)
|
|
183
244
|
])
|
|
184
245
|
])) : vue.createCommentVNode("", true),
|
|
185
|
-
__props.vip || __props.bad ? (vue.openBlock(), vue.createElementBlock("div",
|
|
186
|
-
__props.vip ? (vue.openBlock(), vue.createElementBlock("span",
|
|
246
|
+
__props.vip || __props.bad ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$3, [
|
|
247
|
+
__props.vip ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$1, [
|
|
187
248
|
vue.createVNode(vue.unref(SpriteVIP), { class: "ui-v1-avatar__vip" })
|
|
188
249
|
])) : vue.createCommentVNode("", true),
|
|
189
|
-
__props.bad ? (vue.openBlock(), vue.createElementBlock("span",
|
|
250
|
+
__props.bad ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_5$1, [
|
|
190
251
|
vue.createVNode(vue.unref(SpriteBAD), { class: "ui-v1-avatar__bad" })
|
|
191
252
|
])) : vue.createCommentVNode("", true)
|
|
192
253
|
])) : vue.createCommentVNode("", true)
|
|
@@ -3701,12 +3762,14 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
3701
3762
|
}
|
|
3702
3763
|
});
|
|
3703
3764
|
exports.I18nPlugin = plugin;
|
|
3765
|
+
exports.ImageWorkersKey = ImageWorkersKey;
|
|
3704
3766
|
exports.ModalPlugin = plugin$1;
|
|
3705
3767
|
exports.UiAvatar = _sfc_main$h;
|
|
3706
3768
|
exports.UiAvatarList = _sfc_main$g;
|
|
3707
3769
|
exports.UiButton = _sfc_main$f;
|
|
3708
3770
|
exports.UiCheckbox = _sfc_main$e;
|
|
3709
3771
|
exports.UiError = _sfc_main$d;
|
|
3772
|
+
exports.UiImage = _sfc_main$i;
|
|
3710
3773
|
exports.UiLink = _sfc_main$c;
|
|
3711
3774
|
exports.UiLoader = _sfc_main$a;
|
|
3712
3775
|
exports.UiModalSidebar = _sfc_main$8;
|
package/dist/host.d.ts
CHANGED
|
@@ -8,10 +8,12 @@ import { EmitsOptions } from 'vue';
|
|
|
8
8
|
import { EmitsToProps } from 'vue';
|
|
9
9
|
import { ExtractDefaultPropTypes } from 'vue';
|
|
10
10
|
import { ExtractPropTypes } from 'vue';
|
|
11
|
+
import { InjectionKey } from 'vue';
|
|
11
12
|
import { MethodOptions } from 'vue';
|
|
12
13
|
import { Plugin as Plugin_2 } from 'vue';
|
|
13
14
|
import { PropType } from 'vue';
|
|
14
15
|
import { PublicProps } from 'vue';
|
|
16
|
+
import { Ref } from 'vue';
|
|
15
17
|
import { SlotsType } from 'vue';
|
|
16
18
|
|
|
17
19
|
declare const __VLS_component: DefineComponent_2<ExtractPropTypes< {
|
|
@@ -238,6 +240,8 @@ declare enum APPEARANCE_3 {
|
|
|
238
240
|
|
|
239
241
|
declare type DefineComponent<PropsOrPropOptions = object, M extends MethodOptions = MethodOptions, E extends EmitsOptions = EmitsOptions, EE extends string = string, PP = PublicProps, Props = ResolveProps<PropsOrPropOptions, E>, Defaults = ExtractDefaultPropTypes<PropsOrPropOptions>, S extends SlotsType = SlotsType, LC extends Record<string, Component> = Record<string, Component>, Directives extends Record<string, Directive> = Record<string, Directive>, Exposed extends string = string, Provide extends ComponentProvideOptions = ComponentProvideOptions, MakeDefaultsOptional extends boolean = true, TypeRefs extends Record<string, unknown> = Record<string, unknown>, TypeEl extends Element = Element> = DefineComponent_2<PropsOrPropOptions, Record<string, never>, Record<string, never>, Record<string, never>, M, ComponentOptionsMixin, ComponentOptionsMixin, E, EE, PP, Props, Defaults, S, LC, Directives, Exposed, Provide, MakeDefaultsOptional, TypeRefs, TypeEl>;
|
|
240
242
|
|
|
243
|
+
declare type Dimensions = `${number}x${number}` | `${number}x-`;
|
|
244
|
+
|
|
241
245
|
declare enum DIRECTION {
|
|
242
246
|
LEFT = "left",
|
|
243
247
|
RIGHT = "right"
|
|
@@ -245,6 +249,8 @@ declare enum DIRECTION {
|
|
|
245
249
|
|
|
246
250
|
export declare const I18nPlugin: Plugin_2;
|
|
247
251
|
|
|
252
|
+
export declare const ImageWorkersKey: InjectionKey<Ref<string[]>>;
|
|
253
|
+
|
|
248
254
|
export declare const ModalPlugin: Plugin_2;
|
|
249
255
|
|
|
250
256
|
declare type Numeric = number | string;
|
|
@@ -336,6 +342,10 @@ declare type UiAvatarProperties = {
|
|
|
336
342
|
vip?: boolean;
|
|
337
343
|
bad?: boolean;
|
|
338
344
|
size?: SIZE;
|
|
345
|
+
optimize?: boolean | {
|
|
346
|
+
resize?: Dimensions;
|
|
347
|
+
crop?: Dimensions;
|
|
348
|
+
};
|
|
339
349
|
};
|
|
340
350
|
|
|
341
351
|
export declare const UiButton: DefineComponent<
|
|
@@ -388,6 +398,19 @@ declare type UiErrorProperties = {
|
|
|
388
398
|
ellipsis?: boolean;
|
|
389
399
|
};
|
|
390
400
|
|
|
401
|
+
export declare const UiImage: DefineComponent<
|
|
402
|
+
UiImageProperties
|
|
403
|
+
>;
|
|
404
|
+
|
|
405
|
+
declare type UiImageProperties = {
|
|
406
|
+
/** Alternative text for HTMLImageElement */
|
|
407
|
+
alt?: string;
|
|
408
|
+
/** Source for HTMLImageElement */
|
|
409
|
+
src?: string;
|
|
410
|
+
resize?: Dimensions | undefined;
|
|
411
|
+
crop?: Dimensions | undefined;
|
|
412
|
+
};
|
|
413
|
+
|
|
391
414
|
export declare const UiLink: DefineComponent<UiLinkProperties>;
|
|
392
415
|
|
|
393
416
|
declare type UiLinkProperties = {
|
package/dist/host.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { openBlock, createElementBlock, createElementVNode, defineComponent,
|
|
5
|
-
|
|
4
|
+
import { openBlock, createElementBlock, createElementVNode, defineComponent, inject, ref, computed, mergeProps, useSlots, createBlock, resolveDynamicComponent, unref, withCtx, createVNode, createCommentVNode, normalizeClass, renderSlot, createTextVNode, toDisplayString, provide, Fragment, renderList, Text, Comment, h, Transition, normalizeProps, guardReactiveProps, normalizeStyle, reactive, watch, onMounted, onActivated, onDeactivated, onBeforeUnmount, useAttrs, Teleport, withDirectives, vShow, toHandlers, withModifiers, createSlots } from "vue";
|
|
5
|
+
import { preview } from "@retailcrm/image-preview";
|
|
6
|
+
const _hoisted_1$f = {
|
|
6
7
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7
8
|
viewBox: "0 0 24 24"
|
|
8
9
|
};
|
|
9
10
|
function render$7(_ctx, _cache) {
|
|
10
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
11
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$f, _cache[0] || (_cache[0] = [
|
|
11
12
|
createElementVNode("path", {
|
|
12
13
|
fill: "currentColor",
|
|
13
14
|
"fill-rule": "evenodd",
|
|
@@ -17,30 +18,72 @@ function render$7(_ctx, _cache) {
|
|
|
17
18
|
]));
|
|
18
19
|
}
|
|
19
20
|
const IconHelpOutlined = { render: render$7 };
|
|
20
|
-
const _hoisted_1$
|
|
21
|
+
const _hoisted_1$e = {
|
|
21
22
|
xmlns: "http://www.w3.org/2000/svg",
|
|
22
23
|
viewBox: "0 0 18 8"
|
|
23
24
|
};
|
|
24
25
|
function render$6(_ctx, _cache) {
|
|
25
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
26
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$e, _cache[0] || (_cache[0] = [
|
|
26
27
|
createElementVNode("g", { fill: "currentColor" }, [
|
|
27
28
|
createElementVNode("path", { d: "M0 0v8h2.867q1.257-.011 1.935-.604.68-.594.68-1.748 0-.675-.33-1.143a1.54 1.54 0 0 0-.892-.62q.497-.21.775-.654.279-.45.279-1.039 0-1.077-.694-1.632Q3.926 0 2.584 0zm1.52 6.676v-2.16h1.393q1.048.016 1.048 1.116 0 .488-.303.77-.3.273-.836.274zm1.124-3.324H1.52V1.335h1.064q.628 0 .916.242.294.236.294.78 0 .972-1.15.995M7.503 6.352h2.665L10.679 8h1.616l-2.76-8H8.125L5.38 8h1.616zm2.254-1.336H7.913l.917-2.994zM12.362 8V0h2.27q.972 0 1.737.478.77.473 1.2 1.352.432.873.431 1.989v.368q0 1.115-.425 1.983a3.17 3.17 0 0 1-1.191 1.346A3.26 3.26 0 0 1 14.646 8zm1.52-6.665v5.34h.734q.891 0 1.363-.631.47-.632.481-1.808v-.423q0-1.22-.466-1.846-.466-.632-1.363-.632z" })
|
|
28
29
|
], -1)
|
|
29
30
|
]));
|
|
30
31
|
}
|
|
31
32
|
const SpriteBAD = { render: render$6 };
|
|
32
|
-
const _hoisted_1$
|
|
33
|
+
const _hoisted_1$d = {
|
|
33
34
|
xmlns: "http://www.w3.org/2000/svg",
|
|
34
35
|
viewBox: "0 0 16 8"
|
|
35
36
|
};
|
|
36
37
|
function render$5(_ctx, _cache) {
|
|
37
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
38
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$d, _cache[0] || (_cache[0] = [
|
|
38
39
|
createElementVNode("g", { fill: "currentColor" }, [
|
|
39
40
|
createElementVNode("path", { d: "M3.373 6.016 5.058 0h1.704L4.175 8H2.577L0 0h1.7zM8.99 8H7.46V0H8.99zM11.84 8V5.181h1.343q1.322 0 2.067-.676.75-.681.75-1.857 0-.774-.342-1.379a2.3 2.3 0 0 0-.98-.94Q14.045 0 13.208 0H10.31v8zm1.368-4.154h-1.367v-2.51h1.403q.567.01.888.373t.322.95q0 .571-.322.88-.316.307-.924.307" })
|
|
40
41
|
], -1)
|
|
41
42
|
]));
|
|
42
43
|
}
|
|
43
44
|
const SpriteVIP = { render: render$5 };
|
|
45
|
+
const ImageWorkersKey = Symbol("$image.workers");
|
|
46
|
+
const _hoisted_1$c = ["alt", "src"];
|
|
47
|
+
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
48
|
+
__name: "UiImage",
|
|
49
|
+
props: {
|
|
50
|
+
alt: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: ""
|
|
53
|
+
},
|
|
54
|
+
src: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: ""
|
|
57
|
+
},
|
|
58
|
+
resize: {
|
|
59
|
+
type: null,
|
|
60
|
+
default: void 0
|
|
61
|
+
},
|
|
62
|
+
crop: {
|
|
63
|
+
type: null,
|
|
64
|
+
default: void 0
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
setup(__props) {
|
|
68
|
+
const props = __props;
|
|
69
|
+
const workers = inject(ImageWorkersKey, ref([]));
|
|
70
|
+
const url = computed(() => {
|
|
71
|
+
if (!props.src) {
|
|
72
|
+
return void 0;
|
|
73
|
+
}
|
|
74
|
+
if (props.resize || props.crop) {
|
|
75
|
+
return workers.value.length ? preview(workers.value, props.src, props.resize, props.crop) : void 0;
|
|
76
|
+
}
|
|
77
|
+
return props.src;
|
|
78
|
+
});
|
|
79
|
+
return (_ctx, _cache) => {
|
|
80
|
+
return openBlock(), createElementBlock("img", mergeProps({
|
|
81
|
+
alt: __props.alt,
|
|
82
|
+
src: url.value
|
|
83
|
+
}, _ctx.$attrs), null, 16, _hoisted_1$c);
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
});
|
|
44
87
|
const isURL = (href) => {
|
|
45
88
|
try {
|
|
46
89
|
const normalizedHref = href.includes("://") ? href : `http://${href}`;
|
|
@@ -66,24 +109,23 @@ var STATUS = /* @__PURE__ */ ((STATUS2) => {
|
|
|
66
109
|
STATUS2["FREE"] = "free";
|
|
67
110
|
return STATUS2;
|
|
68
111
|
})(STATUS || {});
|
|
69
|
-
const _hoisted_1$b =
|
|
70
|
-
const _hoisted_2$4 = {
|
|
112
|
+
const _hoisted_1$b = {
|
|
71
113
|
key: 1,
|
|
72
114
|
class: "ui-v1-avatar__unresolved"
|
|
73
115
|
};
|
|
74
|
-
const
|
|
116
|
+
const _hoisted_2$4 = {
|
|
75
117
|
key: 3,
|
|
76
118
|
class: "ui-v1-avatar__initials"
|
|
77
119
|
};
|
|
78
|
-
const
|
|
120
|
+
const _hoisted_3$3 = {
|
|
79
121
|
key: 4,
|
|
80
122
|
class: "ui-v1-avatar__labels"
|
|
81
123
|
};
|
|
82
|
-
const
|
|
124
|
+
const _hoisted_4$1 = {
|
|
83
125
|
key: 0,
|
|
84
126
|
class: "ui-v1-avatar__label ui-v1-avatar__label_vip"
|
|
85
127
|
};
|
|
86
|
-
const
|
|
128
|
+
const _hoisted_5$1 = {
|
|
87
129
|
key: 1,
|
|
88
130
|
class: "ui-v1-avatar__label ui-v1-avatar__label_bad"
|
|
89
131
|
};
|
|
@@ -128,6 +170,10 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
128
170
|
type: String,
|
|
129
171
|
validator: (size) => Object.values(SIZE$5).includes(size),
|
|
130
172
|
default: SIZE$5.SM
|
|
173
|
+
},
|
|
174
|
+
optimize: {
|
|
175
|
+
type: [Boolean, Object],
|
|
176
|
+
default: true
|
|
131
177
|
}
|
|
132
178
|
},
|
|
133
179
|
setup(__props) {
|
|
@@ -144,6 +190,20 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
144
190
|
return otherNames.length > 0 ? firstLetterOf(firstName) + firstLetterOf(otherNames[otherNames.length - 1]) : firstLetterOf(firstName);
|
|
145
191
|
});
|
|
146
192
|
const size = inject(AvatarSizeKey, computed(() => props.size));
|
|
193
|
+
const optimization = computed(() => {
|
|
194
|
+
if (!props.optimize) {
|
|
195
|
+
return { resize: void 0, crop: void 0 };
|
|
196
|
+
}
|
|
197
|
+
const processing = typeof props.optimize === "object" ? props.optimize : {};
|
|
198
|
+
return {
|
|
199
|
+
resize: processing.resize ?? {
|
|
200
|
+
[SIZE$5.XS]: "48x-",
|
|
201
|
+
[SIZE$5.SM]: "72x-",
|
|
202
|
+
[SIZE$5.LG]: "104x-"
|
|
203
|
+
}[size.value],
|
|
204
|
+
crop: processing.crop
|
|
205
|
+
};
|
|
206
|
+
});
|
|
147
207
|
return (_ctx, _cache) => {
|
|
148
208
|
return openBlock(), createBlock(resolveDynamicComponent(__props.href ? "a" : "div"), mergeProps({
|
|
149
209
|
ref: "root",
|
|
@@ -156,15 +216,16 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
156
216
|
}
|
|
157
217
|
}, _ctx.$attrs), {
|
|
158
218
|
default: withCtx(() => [
|
|
159
|
-
__props.src ? (openBlock(),
|
|
219
|
+
__props.src ? (openBlock(), createBlock(_sfc_main$i, {
|
|
160
220
|
key: 0,
|
|
161
221
|
src: __props.src,
|
|
162
|
-
|
|
222
|
+
resize: optimization.value.resize,
|
|
223
|
+
crop: optimization.value.crop,
|
|
163
224
|
class: "ui-v1-avatar__image",
|
|
164
225
|
draggable: "false",
|
|
165
226
|
onLoad: _cache[0] || (_cache[0] = ($event) => loaded.value = true),
|
|
166
227
|
onError: _cache[1] || (_cache[1] = ($event) => loaded.value = false)
|
|
167
|
-
}, null,
|
|
228
|
+
}, null, 8, ["src", "resize", "crop"])) : !__props.src && unresolved.value ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
168
229
|
createVNode(unref(IconHelpOutlined))
|
|
169
230
|
])) : createCommentVNode("", true),
|
|
170
231
|
__props.status && !(__props.vip || __props.bad) ? (openBlock(), createElementBlock("span", {
|
|
@@ -175,16 +236,16 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
175
236
|
[`ui-v1-avatar__status_${__props.status}`]: __props.status
|
|
176
237
|
})
|
|
177
238
|
}, null, 2)) : createCommentVNode("", true),
|
|
178
|
-
!(unresolved.value || loaded.value) ? (openBlock(), createElementBlock("div",
|
|
239
|
+
!(unresolved.value || loaded.value) ? (openBlock(), createElementBlock("div", _hoisted_2$4, [
|
|
179
240
|
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
180
241
|
createTextVNode(toDisplayString(initials.value), 1)
|
|
181
242
|
])
|
|
182
243
|
])) : createCommentVNode("", true),
|
|
183
|
-
__props.vip || __props.bad ? (openBlock(), createElementBlock("div",
|
|
184
|
-
__props.vip ? (openBlock(), createElementBlock("span",
|
|
244
|
+
__props.vip || __props.bad ? (openBlock(), createElementBlock("div", _hoisted_3$3, [
|
|
245
|
+
__props.vip ? (openBlock(), createElementBlock("span", _hoisted_4$1, [
|
|
185
246
|
createVNode(unref(SpriteVIP), { class: "ui-v1-avatar__vip" })
|
|
186
247
|
])) : createCommentVNode("", true),
|
|
187
|
-
__props.bad ? (openBlock(), createElementBlock("span",
|
|
248
|
+
__props.bad ? (openBlock(), createElementBlock("span", _hoisted_5$1, [
|
|
188
249
|
createVNode(unref(SpriteBAD), { class: "ui-v1-avatar__bad" })
|
|
189
250
|
])) : createCommentVNode("", true)
|
|
190
251
|
])) : createCommentVNode("", true)
|
|
@@ -3700,12 +3761,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
3700
3761
|
});
|
|
3701
3762
|
export {
|
|
3702
3763
|
plugin as I18nPlugin,
|
|
3764
|
+
ImageWorkersKey,
|
|
3703
3765
|
plugin$1 as ModalPlugin,
|
|
3704
3766
|
_sfc_main$h as UiAvatar,
|
|
3705
3767
|
_sfc_main$g as UiAvatarList,
|
|
3706
3768
|
_sfc_main$f as UiButton,
|
|
3707
3769
|
_sfc_main$e as UiCheckbox,
|
|
3708
3770
|
_sfc_main$d as UiError,
|
|
3771
|
+
_sfc_main$i as UiImage,
|
|
3709
3772
|
_sfc_main$c as UiLink,
|
|
3710
3773
|
_sfc_main$a as UiLoader,
|
|
3711
3774
|
_sfc_main$8 as UiModalSidebar,
|
package/dist/remote.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const vue = require("vue");
|
|
4
4
|
require("@remote-ui/rpc");
|
|
5
|
+
const imagePreview = require("@retailcrm/image-preview");
|
|
5
6
|
const REMOTE_SLOT = "RemoteSlot";
|
|
6
7
|
const toRemoteSlots = (named, slots) => {
|
|
7
8
|
const actual = named.filter((slotName) => slotName in slots);
|
|
@@ -172,6 +173,15 @@ const UiYandexMap = defineRemoteComponent(
|
|
|
172
173
|
"update:address"
|
|
173
174
|
]
|
|
174
175
|
);
|
|
176
|
+
const ImageWorkersKey = Symbol("$image.workers");
|
|
177
|
+
const usePreview = (workers = vue.ref([])) => {
|
|
178
|
+
const _workers = vue.inject(ImageWorkersKey, workers);
|
|
179
|
+
return {
|
|
180
|
+
workers: _workers,
|
|
181
|
+
preview: (url, resize = void 0, crop = void 0) => imagePreview.preview(_workers.value, url, resize, crop)
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
exports.ImageWorkersKey = ImageWorkersKey;
|
|
175
185
|
exports.UiAvatar = UiAvatar;
|
|
176
186
|
exports.UiAvatarList = UiAvatarList;
|
|
177
187
|
exports.UiAvatarListType = UiAvatarListType;
|
|
@@ -206,3 +216,4 @@ exports.UiTransition = UiTransition;
|
|
|
206
216
|
exports.UiTransitionType = UiTransitionType;
|
|
207
217
|
exports.UiYandexMap = UiYandexMap;
|
|
208
218
|
exports.UiYandexMapType = UiYandexMapType;
|
|
219
|
+
exports.usePreview = usePreview;
|
package/dist/remote.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Component } from 'vue';
|
|
2
2
|
import { HTMLAttributes } from 'vue';
|
|
3
|
+
import { InjectionKey } from 'vue';
|
|
3
4
|
import { MethodOptions } from 'vue';
|
|
5
|
+
import { Ref } from 'vue';
|
|
4
6
|
import { RemoteCallable } from '@remote-ui/rpc';
|
|
5
7
|
import { SchemaType } from '@omnicajs/vue-remote/remote';
|
|
6
8
|
import { SchemaType as SchemaType_2 } from '@omnicajs/vue-remote/dist/remote';
|
|
@@ -40,11 +42,15 @@ declare enum CLOSE_METHOD {
|
|
|
40
42
|
KEY_ESC = "Esc"
|
|
41
43
|
}
|
|
42
44
|
|
|
45
|
+
declare type Dimensions = `${number}x${number}` | `${number}x-`;
|
|
46
|
+
|
|
43
47
|
declare enum DIRECTION {
|
|
44
48
|
LEFT = "left",
|
|
45
49
|
RIGHT = "right"
|
|
46
50
|
}
|
|
47
51
|
|
|
52
|
+
export declare const ImageWorkersKey: InjectionKey<Ref<string[]>>;
|
|
53
|
+
|
|
48
54
|
declare type Numeric = number | string;
|
|
49
55
|
|
|
50
56
|
declare type Primitive = boolean | number | string | null | undefined;
|
|
@@ -147,6 +153,10 @@ declare type UiAvatarProperties = {
|
|
|
147
153
|
vip?: boolean;
|
|
148
154
|
bad?: boolean;
|
|
149
155
|
size?: SIZE;
|
|
156
|
+
optimize?: boolean | {
|
|
157
|
+
resize?: Dimensions;
|
|
158
|
+
crop?: Dimensions;
|
|
159
|
+
};
|
|
150
160
|
};
|
|
151
161
|
|
|
152
162
|
export declare const UiAvatarType: SchemaType<"UiAvatar", RemoteProperties<UiAvatarProperties>>;
|
|
@@ -525,6 +535,11 @@ declare type UiYandexMapProperties = {
|
|
|
525
535
|
|
|
526
536
|
export declare const UiYandexMapType: SchemaType<"UiYandexMap", RemoteProperties<UiYandexMapProperties>, Record<string, never>>;
|
|
527
537
|
|
|
538
|
+
export declare const usePreview: (workers?: Ref<string[]>) => {
|
|
539
|
+
workers: Ref<string[], string[]>;
|
|
540
|
+
preview: (url: string, resize?: Dimensions | undefined, crop?: Dimensions | undefined) => string;
|
|
541
|
+
};
|
|
542
|
+
|
|
528
543
|
declare enum VARIANT {
|
|
529
544
|
DEFAULT = "default",
|
|
530
545
|
SUCCESS = "success",
|
package/dist/remote.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { defineComponent, h } from "vue";
|
|
1
|
+
import { defineComponent, h, inject, ref } from "vue";
|
|
2
2
|
import "@remote-ui/rpc";
|
|
3
|
+
import { preview } from "@retailcrm/image-preview";
|
|
3
4
|
const REMOTE_SLOT = "RemoteSlot";
|
|
4
5
|
const toRemoteSlots = (named, slots) => {
|
|
5
6
|
const actual = named.filter((slotName) => slotName in slots);
|
|
@@ -170,7 +171,16 @@ const UiYandexMap = defineRemoteComponent(
|
|
|
170
171
|
"update:address"
|
|
171
172
|
]
|
|
172
173
|
);
|
|
174
|
+
const ImageWorkersKey = Symbol("$image.workers");
|
|
175
|
+
const usePreview = (workers = ref([])) => {
|
|
176
|
+
const _workers = inject(ImageWorkersKey, workers);
|
|
177
|
+
return {
|
|
178
|
+
workers: _workers,
|
|
179
|
+
preview: (url, resize = void 0, crop = void 0) => preview(_workers.value, url, resize, crop)
|
|
180
|
+
};
|
|
181
|
+
};
|
|
173
182
|
export {
|
|
183
|
+
ImageWorkersKey,
|
|
174
184
|
UiAvatar,
|
|
175
185
|
UiAvatarList,
|
|
176
186
|
UiAvatarListType,
|
|
@@ -204,5 +214,6 @@ export {
|
|
|
204
214
|
UiTransition,
|
|
205
215
|
UiTransitionType,
|
|
206
216
|
UiYandexMap,
|
|
207
|
-
UiYandexMapType
|
|
217
|
+
UiYandexMapType,
|
|
218
|
+
usePreview
|
|
208
219
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retailcrm/embed-ui-v1-components",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.10",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "RetailDriverLLC <integration@retailcrm.ru>",
|
|
7
7
|
"repository": "git@github.com:retailcrm/embed-ui.git",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@omnicajs/vue-remote": "^0.2.5",
|
|
58
58
|
"@remote-ui/rpc": "^1.4.5",
|
|
59
|
+
"@retailcrm/image-preview": "^1.0.2",
|
|
59
60
|
"remark-gfm": "^4.0.0"
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|