@farris/ui-vue 1.3.1 → 1.3.3
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/components/accordion/index.esm.js +103 -99
- package/components/accordion/index.umd.cjs +1 -1
- package/components/avatar/index.esm.js +301 -351
- package/components/avatar/index.umd.cjs +1 -1
- package/components/binding-selector/index.esm.js +444 -0
- package/components/binding-selector/index.umd.cjs +1 -0
- package/components/binding-selector/package.json +8 -0
- package/components/border-editor/index.esm.js +5 -3
- package/components/border-editor/index.umd.cjs +1 -1
- package/components/button-edit/index.esm.js +143 -139
- package/components/button-edit/index.umd.cjs +1 -1
- package/components/calendar/index.esm.js +407 -396
- package/components/calendar/index.umd.cjs +1 -1
- package/components/capsule/index.esm.js +266 -255
- package/components/capsule/index.umd.cjs +1 -1
- package/components/checkbox/index.esm.js +628 -641
- package/components/checkbox/index.umd.cjs +1 -1
- package/components/color-picker/index.esm.js +379 -374
- package/components/color-picker/index.umd.cjs +2 -2
- package/components/combo-list/index.esm.js +471 -471
- package/components/combo-list/index.umd.cjs +1 -1
- package/components/combo-tree/index.esm.js +155 -148
- package/components/combo-tree/index.umd.cjs +1 -1
- package/components/common/index.esm.js +487 -478
- package/components/common/index.umd.cjs +1 -1
- package/components/component/index.esm.js +330 -279
- package/components/component/index.umd.cjs +1 -1
- package/components/condition/index.esm.js +1171 -1277
- package/components/condition/index.umd.cjs +1 -1
- package/components/content-container/index.esm.js +220 -204
- package/components/content-container/index.umd.cjs +1 -1
- package/components/data-grid/index.esm.js +4743 -4641
- package/components/data-grid/index.umd.cjs +1 -1
- package/components/data-view/index.esm.js +2916 -3019
- package/components/data-view/index.umd.cjs +1 -1
- package/components/date-picker/index.esm.js +2375 -2590
- package/components/date-picker/index.umd.cjs +1 -1
- package/components/designer-canvas/index.css +1 -1
- package/components/designer-canvas/index.esm.js +9518 -1198
- package/components/designer-canvas/index.umd.cjs +1 -1
- package/components/designer-outline/index.esm.js +2 -1
- package/components/designer-outline/index.umd.cjs +1 -1
- package/components/drawer/index.esm.js +34 -38
- package/components/drawer/index.umd.cjs +1 -1
- package/components/dropdown/index.esm.js +149 -138
- package/components/dropdown/index.umd.cjs +2 -2
- package/components/dynamic-form/index.esm.js +1602 -1740
- package/components/dynamic-form/index.umd.cjs +1 -1
- package/components/dynamic-resolver/index.esm.js +159 -151
- package/components/dynamic-resolver/index.umd.cjs +1 -1
- package/components/dynamic-view/index.esm.js +218 -218
- package/components/dynamic-view/index.umd.cjs +1 -1
- package/components/event-parameter/index.esm.js +311 -0
- package/components/event-parameter/index.umd.cjs +1 -0
- package/components/event-parameter/package.json +8 -0
- package/components/events-editor/index.css +1 -1
- package/components/events-editor/index.esm.js +533 -563
- package/components/events-editor/index.umd.cjs +1 -1
- package/components/expression-editor/index.esm.js +95 -91
- package/components/expression-editor/index.umd.cjs +1 -1
- package/components/external-container/index.esm.js +2356 -2455
- package/components/external-container/index.umd.cjs +1 -1
- package/components/field-selector/index.esm.js +3048 -3308
- package/components/field-selector/index.umd.cjs +1 -1
- package/components/filter-bar/index.css +1 -1
- package/components/filter-bar/index.esm.js +10537 -3249
- package/components/filter-bar/index.umd.cjs +1 -1
- package/components/flow-canvas/index.css +1 -1
- package/components/flow-canvas/index.esm.js +9781 -1327
- package/components/flow-canvas/index.umd.cjs +1 -1
- package/components/image-cropper/index.esm.js +353 -341
- package/components/image-cropper/index.umd.cjs +1 -1
- package/components/input-group/index.esm.js +510 -827
- package/components/input-group/index.umd.cjs +1 -1
- package/components/layout/index.esm.js +278 -268
- package/components/layout/index.umd.cjs +1 -1
- package/components/list-nav/index.esm.js +144 -136
- package/components/list-nav/index.umd.cjs +1 -1
- package/components/list-view/index.esm.js +2139 -2237
- package/components/list-view/index.umd.cjs +1 -1
- package/components/lookup/index.esm.js +6414 -6367
- package/components/lookup/index.umd.cjs +1 -1
- package/components/mapping-editor/index.esm.js +5216 -5114
- package/components/mapping-editor/index.umd.cjs +1 -1
- package/components/message-box/index.esm.js +252 -252
- package/components/message-box/index.umd.cjs +1 -1
- package/components/modal/index.esm.js +70 -70
- package/components/modal/index.umd.cjs +1 -1
- package/components/nav/index.esm.js +486 -984
- package/components/nav/index.umd.cjs +3 -3
- package/components/number-range/index.esm.js +446 -498
- package/components/number-range/index.umd.cjs +1 -1
- package/components/number-spinner/index.esm.js +363 -388
- package/components/number-spinner/index.umd.cjs +1 -1
- package/components/order/index.esm.js +1050 -1308
- package/components/order/index.umd.cjs +1 -1
- package/components/page-footer/index.esm.js +134 -131
- package/components/page-footer/index.umd.cjs +1 -1
- package/components/page-header/index.esm.js +1072 -1082
- package/components/page-header/index.umd.cjs +1 -1
- package/components/pagination/index.esm.js +412 -910
- package/components/pagination/index.umd.cjs +1 -1
- package/components/progress/index.esm.js +214 -203
- package/components/progress/index.umd.cjs +3 -3
- package/components/property-editor/index.esm.js +1361 -1536
- package/components/property-editor/index.umd.cjs +2 -2
- package/components/property-panel/index.esm.js +650 -677
- package/components/property-panel/index.umd.cjs +1 -1
- package/components/query-solution/index.css +1 -1
- package/components/query-solution/index.esm.js +12344 -5048
- package/components/query-solution/index.umd.cjs +6 -1
- package/components/radio-button/index.esm.js +97 -97
- package/components/radio-button/index.umd.cjs +1 -1
- package/components/radio-group/index.css +1 -1
- package/components/radio-group/index.esm.js +1821 -565
- package/components/radio-group/index.umd.cjs +1 -1
- package/components/rate/index.esm.js +251 -244
- package/components/rate/index.umd.cjs +1 -1
- package/components/response-layout/index.esm.js +151 -140
- package/components/response-layout/index.umd.cjs +1 -1
- package/components/response-layout-editor/index.esm.js +707 -676
- package/components/response-layout-editor/index.umd.cjs +1 -1
- package/components/response-toolbar/index.esm.js +719 -740
- package/components/response-toolbar/index.umd.cjs +1 -1
- package/components/schema-selector/index.esm.js +4977 -5249
- package/components/schema-selector/index.umd.cjs +2 -2
- package/components/search-box/index.esm.js +145 -134
- package/components/search-box/index.umd.cjs +1 -1
- package/components/section/index.esm.js +348 -337
- package/components/section/index.umd.cjs +1 -1
- package/components/smoke-detector/index.esm.js +141 -130
- package/components/smoke-detector/index.umd.cjs +1 -1
- package/components/splitter/index.esm.js +311 -301
- package/components/splitter/index.umd.cjs +1 -1
- package/components/step/index.esm.js +231 -220
- package/components/step/index.umd.cjs +1 -1
- package/components/switch/index.esm.js +385 -432
- package/components/switch/index.umd.cjs +1 -1
- package/components/tabs/index.esm.js +1932 -1914
- package/components/tabs/index.umd.cjs +1 -1
- package/components/tags/index.esm.js +351 -340
- package/components/tags/index.umd.cjs +1 -1
- package/components/text/index.esm.js +209 -199
- package/components/text/index.umd.cjs +1 -1
- package/components/textarea/index.esm.js +388 -415
- package/components/textarea/index.umd.cjs +1 -1
- package/components/time-picker/index.esm.js +619 -666
- package/components/time-picker/index.umd.cjs +1 -1
- package/components/transfer/index.esm.js +493 -486
- package/components/transfer/index.umd.cjs +1 -1
- package/components/tree-grid/index.esm.js +3169 -3278
- package/components/tree-grid/index.umd.cjs +1 -1
- package/components/tree-view/index.esm.js +2320 -2418
- package/components/tree-view/index.umd.cjs +1 -1
- package/components/uploader/index.esm.js +563 -554
- package/components/uploader/index.umd.cjs +2 -2
- package/components/verify-detail/index.esm.js +287 -276
- package/components/verify-detail/index.umd.cjs +1 -1
- package/components/video/index.esm.js +368 -324
- package/components/video/index.umd.cjs +1 -1
- package/components/weather/index.esm.js +498 -487
- package/components/weather/index.umd.cjs +5 -5
- package/farris.all.esm.js +51302 -47651
- package/farris.all.umd.cjs +14 -9
- package/index.css +1 -1
- package/package.json +1 -1
- package/types/binding-selector/index.d.ts +55 -0
- package/types/binding-selector/src/binding-selector.component.d.ts +11 -0
- package/types/binding-selector/src/binding-selector.props.d.ts +52 -0
- package/types/binding-selector/src/components/binding-selector-container.component.d.ts +13 -0
- package/types/binding-selector/src/composition/use-field-selection.d.ts +9 -0
- package/types/combo-list/src/components/list-container.component.d.ts +6 -6
- package/types/combo-list/src/components/list-container.props.d.ts +1 -1
- package/types/combo-tree/src/components/tree-container.component.d.ts +5 -5
- package/types/common/entity/entity-schema.d.ts +26 -11
- package/types/common/index.d.ts +1 -0
- package/types/common/types.d.ts +2 -2
- package/types/condition/src/condition-fields.design.component.d.ts +18 -0
- package/types/condition/src/types.d.ts +6 -6
- package/types/data-grid/src/composition/data-grid-component-creator.service.d.ts +20 -0
- package/types/data-grid/src/{designer/data-grid-column.props.d.ts → data-grid-column.props.d.ts} +1 -1
- package/types/data-grid/src/data-grid.props.d.ts +2 -2
- package/types/data-grid/src/designer/grid-field-editor.component.d.ts +14 -14
- package/types/data-grid/src/schema/schema-resolver.d.ts +1 -1
- package/types/data-view/composition/types.d.ts +2 -2
- package/types/date-picker/src/components/calendar/calendar.component.d.ts +3 -3
- package/types/date-picker/src/components/month/month.component.d.ts +3 -3
- package/types/date-picker/src/components/year/year.component.d.ts +3 -3
- package/types/designer-canvas/index.d.ts +2 -1
- package/types/designer-canvas/src/composition/dg-control.d.ts +5 -0
- package/types/designer-canvas/src/composition/function/drag-resolve.d.ts +5 -0
- package/types/designer-canvas/src/composition/types.d.ts +49 -40
- package/types/designer-canvas/src/types.d.ts +8 -20
- package/types/dynamic-form/index.d.ts +1 -1
- package/types/dynamic-form/src/designer/form-group-use-designer-rules.d.ts +3 -0
- package/types/dynamic-form/src/schema/{schema-resolver.d.ts → response-form-schema-resolver.d.ts} +1 -1
- package/types/dynamic-form/src/types.d.ts +1 -1
- package/types/dynamic-resolver/src/common/toolbar-resolver.d.ts +5 -0
- package/types/dynamic-resolver/src/converter/row-number.converter.d.ts +3 -0
- package/types/entity-binding-selector/composition/use-entity-tree.d.ts +7 -0
- package/types/entity-binding-selector/entity-binding-selector.component.d.ts +11 -0
- package/types/entity-binding-selector/entity-binding-selector.props.d.ts +3 -0
- package/types/enum-editor/src/components/enum-editor-container.component.d.ts +3 -3
- package/types/enum-editor/src/enum-editor.component.d.ts +3 -3
- package/types/event-parameter/index.d.ts +31 -0
- package/types/event-parameter/src/composition/type.d.ts +77 -0
- package/types/event-parameter/src/composition/use-editor-combotree.d.ts +3 -0
- package/types/event-parameter/src/composition/use-editor-input.d.ts +3 -0
- package/types/event-parameter/src/composition/use-editor-select.d.ts +3 -0
- package/types/event-parameter/src/composition/use-editor-switch.d.ts +3 -0
- package/types/event-parameter/src/composition/use-editor.d.ts +3 -0
- package/types/event-parameter/src/event-parameter.component.d.ts +8 -0
- package/types/event-parameter/src/event-parameter.props.d.ts +34 -0
- package/types/external-container/src/designer/import-external-schema.component.d.ts +1 -1
- package/types/field-selector/src/field-selector.component.d.ts +1 -2
- package/types/field-selector/src/field-selector.props.d.ts +0 -9
- package/types/input-group/src/designer/use-input-group-rules.d.ts +1 -2
- package/types/list-view/src/designer/list-view-table.design.component.d.ts +15 -0
- package/types/list-view/src/list-view-table.component.d.ts +15 -0
- package/types/lookup/src/composition/use-user-data.d.ts +2 -2
- package/types/lookup/src/property-config/lookup.property-config.d.ts +2 -6
- package/types/modal/src/composition/modal.service.d.ts +2 -1
- package/types/page-header/src/designer/page-header.design.component.d.ts +1 -1
- package/types/page-header/src/page-header.component.d.ts +1 -1
- package/types/property-panel/index.d.ts +2 -1
- package/types/property-panel/src/composition/entity/property-entity.d.ts +1 -1
- package/types/property-panel/src/composition/type.d.ts +0 -13
- package/types/query-solution/src/composition/types.d.ts +35 -4
- package/types/query-solution/src/composition/use-header.d.ts +21 -0
- package/types/query-solution/src/composition/{use-filter.d.ts → use-http.d.ts} +2 -2
- package/types/query-solution/src/composition/use-solution.d.ts +20 -0
- package/types/query-solution/src/designer/query-solution-config/composition/types.d.ts +17 -16
- package/types/query-solution/src/designer/query-solution-config/query-solution-config.props.d.ts +14 -14
- package/types/query-solution/src/property-config/query-solution.property-config.d.ts +3 -51
- package/types/query-solution/src/query-solution.d.ts +10 -2
- package/types/radio-group/src/designer/item-collection-editor-inner.component.d.ts +29 -0
- package/types/radio-group/src/designer/item-collection-editor.component.d.ts +29 -0
- package/types/radio-group/src/designer/item-collection-editor.props.d.ts +21 -0
- package/types/radio-group/src/schema/schema-mapper.d.ts +1 -0
- package/types/radio-group/src/schema/schema-resolver.d.ts +1 -0
- package/types/response-toolbar/src/property-config/response-toolbar.property-config.d.ts +1 -0
- package/types/section/src/property-config/section.property-config.d.ts +17 -17
- package/types/section/src/schema/schema-resolver.d.ts +1 -2
- package/types/section/src/schema/toolbar-resolver.d.ts +1 -1
- package/types/tabs/src/composition/types.d.ts +4 -1
- package/types/tabs/src/property-config/tab-page.property-config.d.ts +9 -59
- package/types/tabs/src/property-config/tabs.property-config.d.ts +8 -71
- package/types/tabs/src/schema/schema-resolver.d.ts +1 -2
- package/types/text/src/composition/types.d.ts +4 -4
- package/types/textarea/src/property-config/textarea.property-config.d.ts +23 -0
- package/types/weather/src/composition/use-weather-charts.d.ts +15 -0
- package/types/weather/src/composition/use-weather-color.d.ts +15 -0
- package/types/weather/src/composition/use-weather-data.d.ts +15 -0
- package/types/weather/src/composition/use-weather-format-number.d.ts +15 -0
- package/types/property-panel/src/composition/entity/use-input-rules.d.ts +0 -3
- package/types/tree-grid/src/schema/column-resolver.d.ts +0 -3
- package/types/weather/src/composition/types.d.ts +0 -2
- /package/types/dynamic-form/src/designer/{use-designer-rules.d.ts → response-form-use-designer-rules.d.ts} +0 -0
- /package/types/dynamic-form/src/property-config/{form.property-config.d.ts → response-form.property-config.d.ts} +0 -0
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { inject as Te, ref as v, onMounted as Ae, onUnmounted as nt, watch as K, defineComponent as
|
|
1
|
+
import { inject as Te, ref as v, onMounted as Ae, onUnmounted as nt, watch as K, defineComponent as Se, createVNode as S, withModifiers as O } from "vue";
|
|
2
2
|
import { isPlainObject as Me, cloneDeep as ut } from "lodash-es";
|
|
3
3
|
const ze = {}, Ee = {};
|
|
4
4
|
function ve(e) {
|
|
5
|
-
const { properties: i, title: r, ignore:
|
|
6
|
-
|
|
5
|
+
const { properties: i, title: r, ignore: p } = e, o = p && Array.isArray(p), t = Object.keys(i).reduce((h, g) => ((!o || !p.find((w) => w === g)) && (h[g] = i[g].type === "object" && i[g].properties ? ve(i[g]) : ut(i[g].default)), h), {});
|
|
6
|
+
if (r && (!o || !p.find((h) => h === "id"))) {
|
|
7
|
+
const h = r.toLowerCase().replace(/-/g, "_");
|
|
8
|
+
t.id = `${h}_${Math.random().toString().slice(2, 6)}`;
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
7
11
|
}
|
|
8
12
|
function ke(e, i = {}, r) {
|
|
9
|
-
const
|
|
10
|
-
if (
|
|
11
|
-
let o = ve(
|
|
13
|
+
const p = ze[e];
|
|
14
|
+
if (p) {
|
|
15
|
+
let o = ve(p);
|
|
12
16
|
const t = Ee[e];
|
|
13
17
|
return o = t ? t({ getSchemaByType: ke }, o, i, r) : o, o;
|
|
14
18
|
}
|
|
@@ -16,33 +20,33 @@ function ke(e, i = {}, r) {
|
|
|
16
20
|
}
|
|
17
21
|
function rt(e, i) {
|
|
18
22
|
const r = ve(i);
|
|
19
|
-
return Object.keys(
|
|
23
|
+
return Object.keys(r).reduce((p, o) => (p[o] && Me(p[o]) && Me(e[o] || !e[o]) ? Object.assign(p[o], e[o] || {}) : p[o] = e[o], p), r), r;
|
|
20
24
|
}
|
|
21
25
|
function st(e, i) {
|
|
22
|
-
return Object.keys(e).filter((
|
|
26
|
+
return Object.keys(e).filter((p) => e[p] != null).reduce((p, o) => {
|
|
23
27
|
if (i.has(o)) {
|
|
24
28
|
const t = i.get(o);
|
|
25
29
|
if (typeof t == "string")
|
|
26
|
-
|
|
30
|
+
p[t] = e[o];
|
|
27
31
|
else {
|
|
28
|
-
const
|
|
29
|
-
Object.assign(
|
|
32
|
+
const h = t(o, e[o], e);
|
|
33
|
+
Object.assign(p, h);
|
|
30
34
|
}
|
|
31
35
|
} else
|
|
32
|
-
|
|
33
|
-
return
|
|
36
|
+
p[o] = e[o];
|
|
37
|
+
return p;
|
|
34
38
|
}, {});
|
|
35
39
|
}
|
|
36
40
|
function ot(e, i, r = /* @__PURE__ */ new Map()) {
|
|
37
|
-
const
|
|
38
|
-
return st(
|
|
41
|
+
const p = rt(e, i);
|
|
42
|
+
return st(p, r);
|
|
39
43
|
}
|
|
40
44
|
function ct(e = {}) {
|
|
41
|
-
function i(s,
|
|
42
|
-
if (typeof
|
|
43
|
-
return l[s].length ===
|
|
44
|
-
if (typeof
|
|
45
|
-
const u = Object.keys(
|
|
45
|
+
function i(s, y, m, l) {
|
|
46
|
+
if (typeof m == "number")
|
|
47
|
+
return l[s].length === m;
|
|
48
|
+
if (typeof m == "object") {
|
|
49
|
+
const u = Object.keys(m)[0], T = m[u];
|
|
46
50
|
if (u === "not")
|
|
47
51
|
return Number(l[s].length) !== Number(T);
|
|
48
52
|
if (u === "moreThan")
|
|
@@ -52,51 +56,51 @@ function ct(e = {}) {
|
|
|
52
56
|
}
|
|
53
57
|
return !1;
|
|
54
58
|
}
|
|
55
|
-
function r(s,
|
|
56
|
-
return l[s] && l[s].propertyValue && String(l[s].propertyValue.value) === String(
|
|
59
|
+
function r(s, y, m, l) {
|
|
60
|
+
return l[s] && l[s].propertyValue && String(l[s].propertyValue.value) === String(m);
|
|
57
61
|
}
|
|
58
|
-
const
|
|
62
|
+
const p = /* @__PURE__ */ new Map([
|
|
59
63
|
["length", i],
|
|
60
64
|
["getProperty", r]
|
|
61
65
|
]);
|
|
62
|
-
Object.keys(e).reduce((s,
|
|
63
|
-
function o(s,
|
|
64
|
-
const
|
|
65
|
-
return typeof
|
|
66
|
+
Object.keys(e).reduce((s, y) => (s.set(y, e[y]), s), p);
|
|
67
|
+
function o(s, y) {
|
|
68
|
+
const m = s;
|
|
69
|
+
return typeof y == "number" ? [{ target: m, operator: "length", param: null, value: Number(y) }] : typeof y == "boolean" ? [{ target: m, operator: "getProperty", param: s, value: !!y }] : typeof y == "object" ? Object.keys(y).map((l) => {
|
|
66
70
|
if (l === "length")
|
|
67
|
-
return { target:
|
|
68
|
-
const u = l, T =
|
|
69
|
-
return { target:
|
|
71
|
+
return { target: m, operator: "length", param: null, value: y[l] };
|
|
72
|
+
const u = l, T = y[l];
|
|
73
|
+
return { target: m, operator: "getProperty", param: u, value: T };
|
|
70
74
|
}) : [];
|
|
71
75
|
}
|
|
72
76
|
function t(s) {
|
|
73
|
-
return Object.keys(s).reduce((
|
|
77
|
+
return Object.keys(s).reduce((m, l) => {
|
|
74
78
|
const u = o(l, s[l]);
|
|
75
|
-
return
|
|
79
|
+
return m.push(...u), m;
|
|
76
80
|
}, []);
|
|
77
81
|
}
|
|
78
|
-
function
|
|
79
|
-
if (
|
|
80
|
-
const
|
|
81
|
-
return
|
|
82
|
+
function h(s, y) {
|
|
83
|
+
if (p.has(s.operator)) {
|
|
84
|
+
const m = p.get(s.operator);
|
|
85
|
+
return m && m(s.target, s.param, s.value, y) || !1;
|
|
82
86
|
}
|
|
83
87
|
return !1;
|
|
84
88
|
}
|
|
85
|
-
function
|
|
86
|
-
return t(s).reduce((u, T) => u &&
|
|
89
|
+
function g(s, y) {
|
|
90
|
+
return t(s).reduce((u, T) => u && h(T, y), !0);
|
|
87
91
|
}
|
|
88
|
-
function w(s,
|
|
89
|
-
const
|
|
92
|
+
function w(s, y) {
|
|
93
|
+
const m = Object.keys(s), l = m.includes("allOf"), u = m.includes("anyOf"), T = l || u, W = (T ? s[T ? l ? "allOf" : "anyOf" : "allOf"] : [s]).map((B) => g(B, y));
|
|
90
94
|
return l ? !W.includes(!1) : W.includes(!0);
|
|
91
95
|
}
|
|
92
96
|
return { parseValueSchema: w };
|
|
93
97
|
}
|
|
94
98
|
const ft = {}, vt = {};
|
|
95
99
|
ct();
|
|
96
|
-
function ht(e, i, r = /* @__PURE__ */ new Map(),
|
|
97
|
-
return ze[i.title] = i, Ee[i.title] =
|
|
98
|
-
const
|
|
99
|
-
return Object.assign(w,
|
|
100
|
+
function ht(e, i, r = /* @__PURE__ */ new Map(), p = (h, g, w, s) => g, o = {}, t = (h) => h) {
|
|
101
|
+
return ze[i.title] = i, Ee[i.title] = p, ft[i.title] = o, vt[i.title] = t, (h = {}) => {
|
|
102
|
+
const g = ot(h, i, r), w = Object.keys(e).reduce((s, y) => (s[y] = e[y].default, s), {});
|
|
103
|
+
return Object.assign(w, g);
|
|
100
104
|
};
|
|
101
105
|
}
|
|
102
106
|
function gt(e, i) {
|
|
@@ -180,7 +184,7 @@ const mt = /* @__PURE__ */ new Map([
|
|
|
180
184
|
type: Mt,
|
|
181
185
|
properties: wt,
|
|
182
186
|
required: Tt
|
|
183
|
-
},
|
|
187
|
+
}, St = "image-cropper", zt = "A Farris Component", Et = "object", kt = {
|
|
184
188
|
basic: {
|
|
185
189
|
description: "Basic Infomation",
|
|
186
190
|
title: "基本信息",
|
|
@@ -234,7 +238,7 @@ const mt = /* @__PURE__ */ new Map([
|
|
|
234
238
|
}
|
|
235
239
|
}
|
|
236
240
|
}, Dt = {
|
|
237
|
-
title:
|
|
241
|
+
title: St,
|
|
238
242
|
description: zt,
|
|
239
243
|
type: Et,
|
|
240
244
|
categories: kt
|
|
@@ -297,7 +301,7 @@ const mt = /* @__PURE__ */ new Map([
|
|
|
297
301
|
}
|
|
298
302
|
}, we = ht(he, At, mt, dt, Dt);
|
|
299
303
|
var ae = /* @__PURE__ */ ((e) => (e.Move = "move", e.Resize = "resize", e))(ae || {});
|
|
300
|
-
function
|
|
304
|
+
function Bt() {
|
|
301
305
|
function e(o) {
|
|
302
306
|
switch (typeof o == "string" && (o = i(o)), o) {
|
|
303
307
|
case 2:
|
|
@@ -322,81 +326,82 @@ function St() {
|
|
|
322
326
|
const t = new DataView(r(o));
|
|
323
327
|
if (t.getUint16(0, !1) !== 65496)
|
|
324
328
|
return -2;
|
|
325
|
-
const
|
|
326
|
-
let
|
|
327
|
-
for (;
|
|
328
|
-
if (t.getUint16(
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
329
|
+
const h = t.byteLength;
|
|
330
|
+
let g = 2;
|
|
331
|
+
for (; g < h; ) {
|
|
332
|
+
if (t.getUint16(g + 2, !1) <= 8)
|
|
333
|
+
return -1;
|
|
334
|
+
const w = t.getUint16(g, !1);
|
|
335
|
+
if (g += 2, w === 65505) {
|
|
336
|
+
if (t.getUint32(g += 2, !1) !== 1165519206)
|
|
332
337
|
return -1;
|
|
333
|
-
const s = t.getUint16(
|
|
334
|
-
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
for (let
|
|
338
|
-
if (t.getUint16(
|
|
339
|
-
return t.getUint16(
|
|
338
|
+
const s = t.getUint16(g += 6, !1) === 18761;
|
|
339
|
+
g += t.getUint32(g + 4, s);
|
|
340
|
+
const y = t.getUint16(g, s);
|
|
341
|
+
g += 2;
|
|
342
|
+
for (let m = 0; m < y; m++)
|
|
343
|
+
if (t.getUint16(g + m * 12, s) === 274)
|
|
344
|
+
return t.getUint16(g + m * 12 + 8, s);
|
|
340
345
|
} else {
|
|
341
346
|
if ((w & 65280) !== 65280)
|
|
342
347
|
break;
|
|
343
|
-
|
|
348
|
+
g += t.getUint16(g, !1);
|
|
344
349
|
}
|
|
345
350
|
}
|
|
346
351
|
return -1;
|
|
347
352
|
}
|
|
348
353
|
function r(o) {
|
|
349
354
|
o = o.replace(/^data:([^;]+);base64,/gmi, "");
|
|
350
|
-
const t = atob(o),
|
|
351
|
-
for (let w = 0; w <
|
|
352
|
-
|
|
353
|
-
return
|
|
354
|
-
}
|
|
355
|
-
function
|
|
356
|
-
const
|
|
357
|
-
t = Math.round(t),
|
|
358
|
-
const s =
|
|
355
|
+
const t = atob(o), h = t.length, g = new Uint8Array(h);
|
|
356
|
+
for (let w = 0; w < h; w++)
|
|
357
|
+
g[w] = t.charCodeAt(w);
|
|
358
|
+
return g.buffer;
|
|
359
|
+
}
|
|
360
|
+
function p(o, t, h) {
|
|
361
|
+
const g = o.width, w = o.height;
|
|
362
|
+
t = Math.round(t), h = Math.round(h);
|
|
363
|
+
const s = g / t, y = w / h, m = Math.ceil(s / 2), l = Math.ceil(y / 2), u = o.getContext("2d");
|
|
359
364
|
if (u) {
|
|
360
|
-
const T = u.getImageData(0, 0,
|
|
361
|
-
for (let R = 0; R <
|
|
362
|
-
for (let
|
|
363
|
-
const
|
|
364
|
-
let
|
|
365
|
-
const
|
|
366
|
-
let q = Math.ceil((
|
|
367
|
-
q = Math.min(q,
|
|
368
|
-
for (let L =
|
|
369
|
-
const z = Math.abs(
|
|
370
|
-
for (let
|
|
371
|
-
const
|
|
365
|
+
const T = u.getImageData(0, 0, g, w), M = u.createImageData(t, h), { data: P } = T, W = M.data;
|
|
366
|
+
for (let R = 0; R < h; R++)
|
|
367
|
+
for (let B = 0; B < t; B++) {
|
|
368
|
+
const j = (B + R * t) * 4, d = R * y;
|
|
369
|
+
let A = 0, c = 0, b = 0, V = 0, Q = 0, D = 0, E = 0;
|
|
370
|
+
const $ = Math.floor(B * s), C = Math.floor(R * y);
|
|
371
|
+
let q = Math.ceil((B + 1) * s), J = Math.ceil((R + 1) * y);
|
|
372
|
+
q = Math.min(q, g), J = Math.min(J, w);
|
|
373
|
+
for (let L = C; L < J; L++) {
|
|
374
|
+
const z = Math.abs(d - L) / l, ie = B * s, ee = z * z;
|
|
375
|
+
for (let U = $; U < q; U++) {
|
|
376
|
+
const N = Math.abs(ie - U) / m, H = Math.sqrt(ee + N * N);
|
|
372
377
|
if (H >= 1)
|
|
373
378
|
continue;
|
|
374
|
-
|
|
375
|
-
const
|
|
376
|
-
E +=
|
|
379
|
+
A = 2 * H * H * H - 3 * H * H + 1;
|
|
380
|
+
const I = 4 * (U + L * g);
|
|
381
|
+
E += A * P[I + 3], b += A, P[I + 3] < 255 && (A = A * P[I + 3] / 250), V += A * P[I], Q += A * P[I + 1], D += A * P[I + 2], c += A;
|
|
377
382
|
}
|
|
378
383
|
}
|
|
379
|
-
W[
|
|
384
|
+
W[j] = V / c, W[j + 1] = Q / c, W[j + 2] = D / c, W[j + 3] = E / b;
|
|
380
385
|
}
|
|
381
|
-
o.width = t, o.height =
|
|
386
|
+
o.width = t, o.height = h, u.putImageData(M, 0, 0);
|
|
382
387
|
}
|
|
383
388
|
}
|
|
384
389
|
return {
|
|
385
|
-
resizeCanvas:
|
|
390
|
+
resizeCanvas: p,
|
|
386
391
|
getTransformationsFromExifData: e
|
|
387
392
|
};
|
|
388
393
|
}
|
|
389
|
-
function
|
|
394
|
+
function Ct(e, i, r, p) {
|
|
390
395
|
function o(l, u) {
|
|
391
396
|
e.value.x2 = e.value.x1 + (e.value.y2 - e.value.y1) * r.value, l = Math.max(e.value.x2 - i.value.width, 0), u = Math.max(0 - e.value.y1, 0), (l > 0 || u > 0) && (e.value.x2 -= u * r.value > l ? u * r.value : l, e.value.y1 += u * r.value > l ? u : l / r.value);
|
|
392
397
|
}
|
|
393
398
|
function t(l, u) {
|
|
394
399
|
e.value.x2 = e.value.x1 + (e.value.y2 - e.value.y1) * r.value, l = Math.max(e.value.x2 - i.value.width, 0), u = Math.max(e.value.y2 - i.value.height, 0), (l > 0 || u > 0) && (e.value.x2 -= u * r.value > l ? u * r.value : l, e.value.y2 -= u * r.value > l ? u : l / r.value);
|
|
395
400
|
}
|
|
396
|
-
function
|
|
401
|
+
function h(l, u) {
|
|
397
402
|
e.value.y1 = e.value.y2 - (e.value.x2 - e.value.x1) / r.value, l = Math.max(0 - e.value.x1, 0), u = Math.max(0 - e.value.y1, 0), (l > 0 || u > 0) && (e.value.x1 += u * r.value > l ? u * r.value : l, e.value.y1 += u * r.value > l ? u : l / r.value);
|
|
398
403
|
}
|
|
399
|
-
function
|
|
404
|
+
function g(l, u) {
|
|
400
405
|
e.value.y1 = e.value.y2 - (e.value.x2 - e.value.x1) / r.value, l = Math.max(e.value.x2 - i.value.width, 0), u = Math.max(0 - e.value.y1, 0), (l > 0 || u > 0) && (e.value.x2 -= u * r.value > l ? u * r.value : l, e.value.y1 += u * r.value > l ? u : l / r.value);
|
|
401
406
|
}
|
|
402
407
|
function w(l, u) {
|
|
@@ -405,14 +410,14 @@ function Bt(e, i, r, m) {
|
|
|
405
410
|
function s(l, u) {
|
|
406
411
|
e.value.y2 = e.value.y1 + (e.value.x2 - e.value.x1) / r.value, l = Math.max(0 - e.value.x1, 0), u = Math.max(e.value.y2 - i.value.height, 0), (l > 0 || u > 0) && (e.value.x1 += u * r.value > l ? u * r.value : l, e.value.y2 -= u * r.value > l ? u : l / r.value);
|
|
407
412
|
}
|
|
408
|
-
function
|
|
413
|
+
function y() {
|
|
409
414
|
e.value.x2 = e.value.x1 + (e.value.y2 - e.value.y1) * r.value, e.value.y2 = e.value.y1 + (e.value.x2 - e.value.x1) / r.value;
|
|
410
415
|
const l = Math.max(0 - e.value.x1, 0), u = Math.max(e.value.x2 - i.value.width, 0), T = Math.max(e.value.y2 - i.value.height, 0), M = Math.max(0 - e.value.y1, 0);
|
|
411
416
|
(l > 0 || u > 0 || T > 0 || M > 0) && (e.value.x1 += T * r.value > l ? T * r.value : l, e.value.x2 -= M * r.value > u ? M * r.value : u, e.value.y1 += M * r.value > u ? M : u / r.value, e.value.y2 -= T * r.value > l ? T : l / r.value);
|
|
412
417
|
}
|
|
413
|
-
function
|
|
418
|
+
function m() {
|
|
414
419
|
if (i.value.width && i.value.height)
|
|
415
|
-
switch (
|
|
420
|
+
switch (p.position) {
|
|
416
421
|
case "top":
|
|
417
422
|
o(0, 0);
|
|
418
423
|
break;
|
|
@@ -420,10 +425,10 @@ function Bt(e, i, r, m) {
|
|
|
420
425
|
t(0, 0);
|
|
421
426
|
break;
|
|
422
427
|
case "topleft":
|
|
423
|
-
|
|
428
|
+
h(0, 0);
|
|
424
429
|
break;
|
|
425
430
|
case "topright":
|
|
426
|
-
|
|
431
|
+
g(0, 0);
|
|
427
432
|
break;
|
|
428
433
|
case "right":
|
|
429
434
|
case "bottomright":
|
|
@@ -434,23 +439,23 @@ function Bt(e, i, r, m) {
|
|
|
434
439
|
s(0, 0);
|
|
435
440
|
break;
|
|
436
441
|
case "center":
|
|
437
|
-
|
|
442
|
+
y();
|
|
438
443
|
break;
|
|
439
444
|
}
|
|
440
445
|
}
|
|
441
|
-
return { checkAspectRatio:
|
|
446
|
+
return { checkAspectRatio: m };
|
|
442
447
|
}
|
|
443
448
|
function De(e, i) {
|
|
444
|
-
const { resizeCanvas: r, getTransformationsFromExifData:
|
|
445
|
-
let
|
|
446
|
-
const
|
|
447
|
-
let ee,
|
|
448
|
-
const ge = v(e.imageChangedEvent), le = v(e.imageURL),
|
|
449
|
+
const { resizeCanvas: r, getTransformationsFromExifData: p } = Bt(), o = Te("NotifyService"), t = v(e.cropper), h = v(e.transform), g = v(e.cropperMinWidth), w = v(e.maintainAspectRatio), s = v(e.aspectRatio), y = v(e.autoCrop), m = v(e.backgroundColor), l = v(e.resizeToWidth), u = v(e.onlyScaleDown), T = v(e.containWithinAspectRatio), M = v(e.canvasRotation), P = v(e.format), W = v(e.imageQuality), R = v(e.resizeToHeight), B = v(e.cropperMinHeight), j = v(""), d = v(!0), A = v(!0);
|
|
450
|
+
let c, b, V = 0, Q, D, E;
|
|
451
|
+
const $ = v(null), C = v(""), q = v(""), J = v("0px"), L = v(), z = v({ width: 100, height: 100 }), ie = ae;
|
|
452
|
+
let ee, U = 20, N = 20, H = !1, I = { rotate: 0, flip: !1 }, x = { active: !1, type: null, position: null, x1: 0, y1: 0, x2: 0, y2: 0, clientX: 0, clientY: 0 };
|
|
453
|
+
const ge = v(e.imageChangedEvent), le = v(e.imageURL), Be = v(e.imageBase64), Ce = v(e.imageFile);
|
|
449
454
|
function We() {
|
|
450
|
-
q.value = "scaleX(" + (
|
|
455
|
+
q.value = "scaleX(" + (h.value.scale || 1) * (h.value.flipH ? -1 : 1) + ")scaleY(" + (h.value.scale || 1) * (h.value.flipV ? -1 : 1) + ")rotate(" + (h.value.rotate || 0) + "deg)";
|
|
451
456
|
}
|
|
452
457
|
function Y() {
|
|
453
|
-
|
|
458
|
+
A.value = !1, L.value = null, j.value = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=", x = {
|
|
454
459
|
active: !1,
|
|
455
460
|
type: null,
|
|
456
461
|
position: null,
|
|
@@ -463,7 +468,7 @@ function De(e, i) {
|
|
|
463
468
|
}, z.value = {
|
|
464
469
|
width: 0,
|
|
465
470
|
height: 0
|
|
466
|
-
},
|
|
471
|
+
}, c = {
|
|
467
472
|
width: 0,
|
|
468
473
|
height: 0
|
|
469
474
|
}, b = {
|
|
@@ -475,75 +480,75 @@ function De(e, i) {
|
|
|
475
480
|
return /image\/(png|jpg|jpeg|bmp|gif|tiff|webp)/.test(a);
|
|
476
481
|
}
|
|
477
482
|
function Pe() {
|
|
478
|
-
if (M.value +=
|
|
483
|
+
if (M.value += I.rotate, T.value && c.width && c.height) {
|
|
479
484
|
if (M.value % 2) {
|
|
480
|
-
const
|
|
485
|
+
const f = c.width * s.value, k = c.height / s.value;
|
|
481
486
|
return {
|
|
482
|
-
width: Math.max(
|
|
483
|
-
height: Math.max(
|
|
487
|
+
width: Math.max(c.height, f),
|
|
488
|
+
height: Math.max(c.width, k)
|
|
484
489
|
};
|
|
485
490
|
}
|
|
486
|
-
const a =
|
|
491
|
+
const a = c.height * s.value, n = c.width / s.value;
|
|
487
492
|
return {
|
|
488
|
-
width: Math.max(
|
|
489
|
-
height: Math.max(
|
|
493
|
+
width: Math.max(c.width, a),
|
|
494
|
+
height: Math.max(c.height, n)
|
|
490
495
|
};
|
|
491
496
|
}
|
|
492
497
|
return M.value % 2 ? {
|
|
493
|
-
height:
|
|
494
|
-
width:
|
|
498
|
+
height: c.width,
|
|
499
|
+
width: c.height
|
|
495
500
|
} : {
|
|
496
|
-
width:
|
|
497
|
-
height:
|
|
501
|
+
width: c.width,
|
|
502
|
+
height: c.height
|
|
498
503
|
};
|
|
499
504
|
}
|
|
500
505
|
function Re() {
|
|
501
|
-
M.value +=
|
|
506
|
+
M.value += I.rotate;
|
|
502
507
|
const a = Pe(), n = document.createElement("canvas");
|
|
503
508
|
a.width && a.height && (n.width = a.width, n.height = a.height);
|
|
504
|
-
const
|
|
505
|
-
return
|
|
509
|
+
const f = n.getContext("2d");
|
|
510
|
+
return c.width && c.height && E && (f == null || f.setTransform(I.flip ? -1 : 1, 0, 0, 1, n.width / 2, n.height / 2), f == null || f.rotate(Math.PI * (M.value / 2)), f == null || f.drawImage(E, -c.width / 2, -c.height / 2)), n.toDataURL();
|
|
506
511
|
}
|
|
507
512
|
function He(a) {
|
|
508
513
|
return new Promise((n) => {
|
|
509
|
-
ee = a,
|
|
510
|
-
var
|
|
511
|
-
b.width = (
|
|
514
|
+
ee = a, j.value = a, L.value = new Image(), L.value.onload = () => {
|
|
515
|
+
var f, k;
|
|
516
|
+
b.width = (f = L.value) == null ? void 0 : f.naturalWidth, b.height = (k = L.value) == null ? void 0 : k.naturalHeight, n();
|
|
512
517
|
}, L.value.src = ee;
|
|
513
518
|
});
|
|
514
519
|
}
|
|
515
520
|
function de() {
|
|
516
|
-
if (!E || !E.complete || !
|
|
521
|
+
if (!E || !E.complete || !I)
|
|
517
522
|
return Promise.reject(new Error("No image loaded"));
|
|
518
523
|
const a = Re();
|
|
519
524
|
return He(a);
|
|
520
525
|
}
|
|
521
526
|
function ne(a) {
|
|
522
|
-
const n = (
|
|
527
|
+
const n = (f) => {
|
|
523
528
|
o.show({
|
|
524
529
|
showCloseButton: !1,
|
|
525
530
|
timeout: 3e3,
|
|
526
531
|
animate: "fadeIn",
|
|
527
532
|
toasts: [{ type: "string", title: "提示", msg: "图片上传错误,请重试" }]
|
|
528
|
-
}),
|
|
533
|
+
}), d.value = !1, H = !0, i.emit("loadImageFailed"), E = null, C.value = "";
|
|
529
534
|
};
|
|
530
535
|
E = new Image(), E.onload = () => {
|
|
531
|
-
|
|
536
|
+
C.value = a, I = p(a), c.width = E == null ? void 0 : E.naturalWidth, c.height = E == null ? void 0 : E.naturalHeight, de().then(() => {
|
|
532
537
|
H = !1;
|
|
533
538
|
}).catch(n);
|
|
534
539
|
}, E.onerror = n, E.src = a;
|
|
535
540
|
}
|
|
536
|
-
function
|
|
541
|
+
function _e(a, n) {
|
|
537
542
|
Le(n) ? (H = !1, ne(a)) : (o.show({
|
|
538
543
|
showCloseButton: !1,
|
|
539
544
|
timeout: 3e3,
|
|
540
545
|
animate: "fadeIn",
|
|
541
546
|
toasts: [{ type: "string", title: "提示", msg: "图片类型不正确,请重试" }]
|
|
542
|
-
}),
|
|
547
|
+
}), d.value = !1, H = !0, i.emit("loadImageFailed"));
|
|
543
548
|
}
|
|
544
549
|
function me(a) {
|
|
545
550
|
const n = new FileReader();
|
|
546
|
-
n.onload = (
|
|
551
|
+
n.onload = (f) => _e(f.target.result, a.type), n.readAsDataURL(a);
|
|
547
552
|
}
|
|
548
553
|
function pe(a) {
|
|
549
554
|
const n = new Image();
|
|
@@ -553,55 +558,55 @@ function De(e, i) {
|
|
|
553
558
|
timeout: 3e3,
|
|
554
559
|
animate: "fadeIn",
|
|
555
560
|
toasts: [{ type: "string", title: "提示", msg: "图片加载错误,请重试" }]
|
|
556
|
-
}),
|
|
561
|
+
}), d.value = !1, H = !0, i.emit("loadImageFailed");
|
|
557
562
|
}, n.onload = () => {
|
|
558
563
|
H = !1;
|
|
559
|
-
const
|
|
560
|
-
|
|
564
|
+
const f = document.createElement("canvas"), k = f.getContext("2d");
|
|
565
|
+
f.width = n.width, f.height = n.height, k == null || k.drawImage(n, 0, 0), ne(f.toDataURL());
|
|
561
566
|
}, n.crossOrigin = "anonymous", n.src = a;
|
|
562
567
|
}
|
|
563
|
-
function
|
|
564
|
-
return
|
|
568
|
+
function $e() {
|
|
569
|
+
return $.value && $.value && $.value.offsetWidth > 0;
|
|
565
570
|
}
|
|
566
571
|
function ue() {
|
|
567
|
-
if (
|
|
568
|
-
const a =
|
|
572
|
+
if ($.value) {
|
|
573
|
+
const a = $.value;
|
|
569
574
|
z.value.width = a.offsetWidth, z.value.height = a.offsetHeight, J.value = "calc(50% - " + z.value.width / 2 + "px)";
|
|
570
575
|
}
|
|
571
576
|
}
|
|
572
|
-
function
|
|
573
|
-
L.value && z.value.width && (
|
|
577
|
+
function Ue() {
|
|
578
|
+
L.value && z.value.width && (U = g.value > 0 ? Math.max(20, g.value / L.value.width * z.value.width) : 20);
|
|
574
579
|
}
|
|
575
|
-
function
|
|
576
|
-
w.value ?
|
|
580
|
+
function je() {
|
|
581
|
+
w.value ? N = Math.max(20, U / s.value) : B.value > 0 && L.value && z.value.height ? N = Math.max(20, B.value / L.value.height * z.value.height) : N = 20;
|
|
577
582
|
}
|
|
578
583
|
function re() {
|
|
579
|
-
L.value ? (
|
|
584
|
+
L.value ? (Ue(), je()) : (U = 20, N = 20);
|
|
580
585
|
}
|
|
581
|
-
function
|
|
582
|
-
const a =
|
|
586
|
+
function Ne() {
|
|
587
|
+
const a = $.value, n = v({ x1: 0, x2: 0, y1: 0, y2: 0 });
|
|
583
588
|
if (a && b.width && b.height) {
|
|
584
|
-
const
|
|
589
|
+
const f = b.width / a.offsetWidth;
|
|
585
590
|
n.value = {
|
|
586
|
-
x1: Math.round(t.value.x1 *
|
|
587
|
-
y1: Math.round(t.value.y1 *
|
|
588
|
-
x2: Math.round(t.value.x2 *
|
|
589
|
-
y2: Math.round(t.value.y2 *
|
|
591
|
+
x1: Math.round(t.value.x1 * f),
|
|
592
|
+
y1: Math.round(t.value.y1 * f),
|
|
593
|
+
x2: Math.round(t.value.x2 * f),
|
|
594
|
+
y2: Math.round(t.value.y2 * f)
|
|
590
595
|
}, T.value || (n.value.x1 = Math.max(n.value.x1, 0), n.value.y1 = Math.max(n.value.y1, 0), n.value.x2 = Math.min(n.value.x2, b.width), n.value.y2 = Math.min(n.value.y2, b.height));
|
|
591
596
|
}
|
|
592
597
|
return n.value;
|
|
593
598
|
}
|
|
594
|
-
function
|
|
595
|
-
M.value +=
|
|
596
|
-
const a =
|
|
597
|
-
if (a && b.height && b.width &&
|
|
598
|
-
const
|
|
599
|
-
let k,
|
|
600
|
-
M.value % 2 ? (k = (b.width -
|
|
601
|
-
x1: Math.round(t.value.x1 *
|
|
602
|
-
y1: Math.round(t.value.y1 *
|
|
603
|
-
x2: Math.round(t.value.x2 *
|
|
604
|
-
y2: Math.round(t.value.y2 *
|
|
599
|
+
function Ie() {
|
|
600
|
+
M.value += I.rotate;
|
|
601
|
+
const a = $.value, n = v({ x1: 0, x2: 0, y1: 0, y2: 0 });
|
|
602
|
+
if (a && b.height && b.width && c.height && c.width) {
|
|
603
|
+
const f = b.width / a.offsetWidth;
|
|
604
|
+
let k, _;
|
|
605
|
+
M.value % 2 ? (k = (b.width - c.height) / 2, _ = (b.height - c.width) / 2) : (k = (b.width - c.width) / 2, _ = (b.height - c.height) / 2), n.value = {
|
|
606
|
+
x1: Math.round(t.value.x1 * f) - k,
|
|
607
|
+
y1: Math.round(t.value.y1 * f) - _,
|
|
608
|
+
x2: Math.round(t.value.x2 * f) - k,
|
|
609
|
+
y2: Math.round(t.value.y2 * f) - _
|
|
605
610
|
}, T.value || (n.value.x1 = Math.max(n.value.x1, 0), n.value.y1 = Math.max(n.value.y1, 0), n.value.x2 = Math.min(n.value.x2, b.width), n.value.y2 = Math.min(n.value.y2, b.height));
|
|
606
611
|
}
|
|
607
612
|
return n.value;
|
|
@@ -621,32 +626,32 @@ function De(e, i) {
|
|
|
621
626
|
return a.toDataURL("image/" + P.value, Ve());
|
|
622
627
|
}
|
|
623
628
|
function qe() {
|
|
624
|
-
if (
|
|
625
|
-
const a =
|
|
626
|
-
k.width = n, k.height =
|
|
627
|
-
const
|
|
628
|
-
if (
|
|
629
|
-
|
|
630
|
-
const G = (
|
|
631
|
-
b.width && b.height && (
|
|
629
|
+
if ($.value && $.value && L.value != null) {
|
|
630
|
+
const a = Ne(), n = a.x2 - a.x1, f = a.y2 - a.y1, k = document.createElement("canvas");
|
|
631
|
+
k.width = n, k.height = f;
|
|
632
|
+
const _ = k.getContext("2d");
|
|
633
|
+
if (_) {
|
|
634
|
+
m.value != null && (_.fillStyle = m.value, _.fillRect(0, 0, n, f));
|
|
635
|
+
const G = (h.value.scale || 1) * (h.value.flipH ? -1 : 1), Z = (h.value.scale || 1) * (h.value.flipV ? -1 : 1);
|
|
636
|
+
b.width && b.height && (_.setTransform(G, 0, 0, Z, b.width / 2, b.height / 2), _.translate(-a.x1 / G, -a.y1 / Z), _.rotate((h.value.rotate || 0) * Math.PI / 180), _.drawImage(L.value, -b.width / 2, -b.height / 2));
|
|
632
637
|
const F = {
|
|
633
638
|
width: n,
|
|
634
|
-
height:
|
|
639
|
+
height: f,
|
|
635
640
|
imagePosition: a,
|
|
636
641
|
cropperPosition: { ...t.value }
|
|
637
642
|
};
|
|
638
|
-
T.value && (F.offsetImagePosition =
|
|
639
|
-
const X = Oe(n,
|
|
640
|
-
return X !== 1 && (F.width = Math.round(n * X), F.height = w.value ? Math.round(F.width / s.value) : Math.round(
|
|
643
|
+
T.value && (F.offsetImagePosition = Ie());
|
|
644
|
+
const X = Oe(n, f);
|
|
645
|
+
return X !== 1 && (F.width = Math.round(n * X), F.height = w.value ? Math.round(F.width / s.value) : Math.round(f * X), r(k, F.width, F.height)), F.base64 = Fe(k), i.emit("imageCropped", F), F;
|
|
641
646
|
}
|
|
642
647
|
}
|
|
643
648
|
return null;
|
|
644
649
|
}
|
|
645
650
|
function te() {
|
|
646
|
-
|
|
651
|
+
y.value && qe();
|
|
647
652
|
}
|
|
648
653
|
function ye() {
|
|
649
|
-
const a =
|
|
654
|
+
const a = $.value;
|
|
650
655
|
if (a) {
|
|
651
656
|
if (!w.value)
|
|
652
657
|
t.value.x1 = 0, t.value.x2 = a.offsetWidth, t.value.y1 = 0, t.value.y2 = a.offsetHeight;
|
|
@@ -659,7 +664,7 @@ function De(e, i) {
|
|
|
659
664
|
const n = a.offsetHeight * s.value;
|
|
660
665
|
t.value.x1 = (a.offsetWidth - n) / 2, t.value.x2 = t.value.x1 + n;
|
|
661
666
|
}
|
|
662
|
-
te(),
|
|
667
|
+
te(), A.value = !0;
|
|
663
668
|
}
|
|
664
669
|
}
|
|
665
670
|
function xe() {
|
|
@@ -668,13 +673,13 @@ function De(e, i) {
|
|
|
668
673
|
timeout: 3e3,
|
|
669
674
|
animate: "fadeIn",
|
|
670
675
|
toasts: [{ type: "string", title: "提示", msg: "图片加载超时,请重试" }]
|
|
671
|
-
}), H = !0,
|
|
676
|
+
}), H = !0, d.value = !1, i.emit("loadImageFailed")) : $e() ? (H = !1, ue(), re(), ye(), i.emit("cropperReady", { ...z.value })) : (V++, setTimeout(() => xe(), 50));
|
|
672
677
|
}
|
|
673
678
|
function Qe() {
|
|
674
|
-
L.value != null && (
|
|
679
|
+
L.value != null && (d.value = !1, i.emit("imageLoaded"), V = 0, setTimeout(() => xe()));
|
|
675
680
|
}
|
|
676
681
|
function Ge() {
|
|
677
|
-
const a =
|
|
682
|
+
const a = $.value;
|
|
678
683
|
(z.value.width !== (a == null ? void 0 : a.offsetWidth) || z.value.height !== (a == null ? void 0 : a.offsetHeight)) && z.value.width && z.value.height && a && (t.value.x1 = t.value.x1 * a.offsetWidth / z.value.width, t.value.x2 = t.value.x2 * a.offsetWidth / z.value.width, t.value.y1 = t.value.y1 * a.offsetHeight / z.value.height, t.value.y2 = t.value.y2 * a.offsetHeight / z.value.height);
|
|
679
684
|
}
|
|
680
685
|
const Je = () => {
|
|
@@ -683,12 +688,12 @@ function De(e, i) {
|
|
|
683
688
|
clearTimeout(D), D = setTimeout(Je, 300);
|
|
684
689
|
};
|
|
685
690
|
Ae(() => {
|
|
686
|
-
window.addEventListener("resize", be), le.value && (Y(),
|
|
691
|
+
window.addEventListener("resize", be), le.value && (Y(), d.value = !0, pe(le.value));
|
|
687
692
|
}), nt(() => {
|
|
688
693
|
window.removeEventListener("resize", be);
|
|
689
694
|
});
|
|
690
695
|
function Ze() {
|
|
691
|
-
|
|
696
|
+
x.active && (x.active = !1, te());
|
|
692
697
|
}
|
|
693
698
|
function se(a) {
|
|
694
699
|
return (a.touches && a.touches[0] ? a.touches[0].clientX : a.clientX) || 0;
|
|
@@ -696,11 +701,11 @@ function De(e, i) {
|
|
|
696
701
|
function oe(a) {
|
|
697
702
|
return (a.touches && a.touches[0] ? a.touches[0].clientY : a.clientY) || 0;
|
|
698
703
|
}
|
|
699
|
-
function Ye(a, n,
|
|
700
|
-
|
|
704
|
+
function Ye(a, n, f = null) {
|
|
705
|
+
x && x.active || (a.preventDefault && a.preventDefault(), x = {
|
|
701
706
|
active: !0,
|
|
702
707
|
type: n,
|
|
703
|
-
position:
|
|
708
|
+
position: f,
|
|
704
709
|
clientX: se(a),
|
|
705
710
|
clientY: oe(a),
|
|
706
711
|
...t.value
|
|
@@ -710,62 +715,62 @@ function De(e, i) {
|
|
|
710
715
|
t.value.x1 < 0 && (t.value.x2 -= a ? t.value.x1 : 0, t.value.x1 = 0), t.value.y1 < 0 && (t.value.y2 -= a ? t.value.y1 : 0, t.value.y1 = 0), t.value.x2 > z.value.width && (t.value.x1 -= a ? t.value.x2 - z.value.width : 0, t.value.x2 = z.value.width), t.value.y2 > z.value.height && (t.value.y1 -= a ? t.value.y2 - z.value.height : 0, t.value.y2 = z.value.height);
|
|
711
716
|
}
|
|
712
717
|
function Xe(a) {
|
|
713
|
-
const n = se(a) -
|
|
714
|
-
t.value.x1 =
|
|
718
|
+
const n = se(a) - x.clientX, f = oe(a) - x.clientY;
|
|
719
|
+
t.value.x1 = x.x1 + n, t.value.y1 = x.y1 + f, t.value.x2 = x.x2 + n, t.value.y2 = x.y2 + f;
|
|
715
720
|
}
|
|
716
|
-
const { checkAspectRatio: Ke } =
|
|
721
|
+
const { checkAspectRatio: Ke } = Ct(t, z, s, x);
|
|
717
722
|
function et(a) {
|
|
718
|
-
const n = se(a) -
|
|
719
|
-
switch (
|
|
723
|
+
const n = se(a) - x.clientX, f = oe(a) - x.clientY;
|
|
724
|
+
switch (x.position) {
|
|
720
725
|
case "left":
|
|
721
|
-
t.value.x1 = Math.min(
|
|
726
|
+
t.value.x1 = Math.min(x.x1 + n, t.value.x2 - U);
|
|
722
727
|
break;
|
|
723
728
|
case "topleft":
|
|
724
|
-
t.value.x1 = Math.min(
|
|
729
|
+
t.value.x1 = Math.min(x.x1 + n, t.value.x2 - U), t.value.y1 = Math.min(x.y1 + f, t.value.y2 - N);
|
|
725
730
|
break;
|
|
726
731
|
case "top":
|
|
727
|
-
t.value.y1 = Math.min(
|
|
732
|
+
t.value.y1 = Math.min(x.y1 + f, t.value.y2 - N);
|
|
728
733
|
break;
|
|
729
734
|
case "topright":
|
|
730
|
-
t.value.x2 = Math.max(
|
|
735
|
+
t.value.x2 = Math.max(x.x2 + n, t.value.x1 + U), t.value.y1 = Math.min(x.y1 + f, t.value.y2 - N);
|
|
731
736
|
break;
|
|
732
737
|
case "right":
|
|
733
|
-
t.value.x2 = Math.max(
|
|
738
|
+
t.value.x2 = Math.max(x.x2 + n, t.value.x1 + U);
|
|
734
739
|
break;
|
|
735
740
|
case "bottomright":
|
|
736
|
-
t.value.x2 = Math.max(
|
|
741
|
+
t.value.x2 = Math.max(x.x2 + n, t.value.x1 + U), t.value.y2 = Math.max(x.y2 + f, t.value.y1 + N);
|
|
737
742
|
break;
|
|
738
743
|
case "bottom":
|
|
739
|
-
t.value.y2 = Math.max(
|
|
744
|
+
t.value.y2 = Math.max(x.y2 + f, t.value.y1 + N);
|
|
740
745
|
break;
|
|
741
746
|
case "bottomleft":
|
|
742
|
-
t.value.x1 = Math.min(
|
|
747
|
+
t.value.x1 = Math.min(x.x1 + n, t.value.x2 - U), t.value.y2 = Math.max(x.y2 + f, t.value.y1 + N);
|
|
743
748
|
break;
|
|
744
749
|
case "center":
|
|
745
|
-
const { scale: k } = a,
|
|
746
|
-
t.value.x1 = Math.min(
|
|
750
|
+
const { scale: k } = a, _ = Math.abs(x.x2 - x.x1) * k, G = Math.abs(x.y2 - x.y1) * k, { x1: Z } = t.value, { y1: F } = t.value;
|
|
751
|
+
t.value.x1 = Math.min(x.clientX - _ / 2, t.value.x2 - U), t.value.y1 = Math.min(x.clientY - G / 2, t.value.y2 - N), t.value.x2 = Math.max(x.clientX + _ / 2, Z + U), t.value.y2 = Math.max(x.clientY + G / 2, F + N);
|
|
747
752
|
break;
|
|
748
753
|
}
|
|
749
754
|
w.value && Ke();
|
|
750
755
|
}
|
|
751
756
|
function tt(a) {
|
|
752
|
-
|
|
753
|
-
|
|
757
|
+
x && x.active && (a.stopPropagation && a.stopPropagation(), a.preventDefault && a.preventDefault(), clearTimeout(Q), Q = setTimeout(() => {
|
|
758
|
+
x.type === ae.Move ? (Xe(a), ce(!0)) : x.type === ae.Resize && (et(a), ce(!1));
|
|
754
759
|
}, 300));
|
|
755
760
|
}
|
|
756
761
|
return K(ge, (a) => {
|
|
757
|
-
Y(), a && a.target && a.target.files && a.target.files.length > 0 && (
|
|
762
|
+
Y(), a && a.target && a.target.files && a.target.files.length > 0 && (d.value = !0, me(a.target.files[0]));
|
|
758
763
|
}), K(le, (a) => {
|
|
759
|
-
a ? (Y(),
|
|
764
|
+
a ? (Y(), d.value = !0, pe(a)) : (o.show({
|
|
760
765
|
showCloseButton: !1,
|
|
761
766
|
timeout: 3e3,
|
|
762
767
|
animate: "fadeIn",
|
|
763
768
|
toasts: [{ type: "string", title: "提示", msg: "图片路径为空" }]
|
|
764
|
-
}),
|
|
765
|
-
}), K(Se, (a) => {
|
|
766
|
-
Y(), x.value = !0, ne(a);
|
|
769
|
+
}), d.value = !1, H = !0);
|
|
767
770
|
}), K(Be, (a) => {
|
|
768
|
-
Y(),
|
|
771
|
+
Y(), d.value = !0, ne(a);
|
|
772
|
+
}), K(Ce, (a) => {
|
|
773
|
+
Y(), a && (d.value = !0, me(a));
|
|
769
774
|
}), K(
|
|
770
775
|
() => [
|
|
771
776
|
e.containWithinAspectRatio,
|
|
@@ -775,37 +780,37 @@ function De(e, i) {
|
|
|
775
780
|
e.transform,
|
|
776
781
|
e.imageChangedEvent
|
|
777
782
|
],
|
|
778
|
-
([a, n,
|
|
779
|
-
E && E.complete &&
|
|
783
|
+
([a, n, f, k, _, G], [Z, F, X, at, it, lt]) => {
|
|
784
|
+
E && E.complete && I && (a !== Z || n !== F) && de(), f !== X && (ue(), re(), ce(!1), te()), k !== at && A.value && ye(), _ !== it && (We(), te()), G !== lt && (ge.value = G);
|
|
780
785
|
}
|
|
781
786
|
), {
|
|
782
787
|
uploadError: H,
|
|
783
|
-
imageVisible:
|
|
784
|
-
backgroundColor:
|
|
785
|
-
sourceImage:
|
|
786
|
-
safeImgDataUrl:
|
|
788
|
+
imageVisible: A,
|
|
789
|
+
backgroundColor: m,
|
|
790
|
+
sourceImage: $,
|
|
791
|
+
safeImgDataUrl: j,
|
|
787
792
|
safeTransformStyle: q,
|
|
788
793
|
maxSize: z,
|
|
789
794
|
cropper: t,
|
|
790
795
|
marginLeft: J,
|
|
791
796
|
moveTypes: ie,
|
|
792
|
-
isLoading:
|
|
797
|
+
isLoading: d,
|
|
793
798
|
startMove: Ye,
|
|
794
799
|
imageLoadedInView: Qe,
|
|
795
800
|
moveStop: Ze,
|
|
796
801
|
moveImg: tt
|
|
797
802
|
};
|
|
798
803
|
}
|
|
799
|
-
const fe = /* @__PURE__ */
|
|
804
|
+
const fe = /* @__PURE__ */ Se({
|
|
800
805
|
name: "FImageCropper",
|
|
801
806
|
props: he,
|
|
802
807
|
emits: ["imageCropped", "imageLoaded", "cropperReady", "loadImageFailed"],
|
|
803
808
|
setup(e, i) {
|
|
804
|
-
const r = v(e.alignImage),
|
|
809
|
+
const r = v(e.alignImage), p = v(e.roundCropper), o = v(e.hideResizeSquares), t = v(e.loadImageErrorText), h = v(e.disabled), g = v(null), {
|
|
805
810
|
uploadError: w,
|
|
806
811
|
imageVisible: s,
|
|
807
|
-
backgroundColor:
|
|
808
|
-
sourceImage:
|
|
812
|
+
backgroundColor: y,
|
|
813
|
+
sourceImage: m,
|
|
809
814
|
safeImgDataUrl: l,
|
|
810
815
|
safeTransformStyle: u,
|
|
811
816
|
maxSize: T,
|
|
@@ -813,50 +818,50 @@ const fe = /* @__PURE__ */ Ce({
|
|
|
813
818
|
marginLeft: P,
|
|
814
819
|
moveTypes: W,
|
|
815
820
|
isLoading: R,
|
|
816
|
-
startMove:
|
|
817
|
-
imageLoadedInView:
|
|
818
|
-
moveStop:
|
|
819
|
-
moveImg:
|
|
821
|
+
startMove: B,
|
|
822
|
+
imageLoadedInView: j,
|
|
823
|
+
moveStop: d,
|
|
824
|
+
moveImg: A
|
|
820
825
|
} = De(e, i);
|
|
821
|
-
function
|
|
822
|
-
return
|
|
826
|
+
function c(D) {
|
|
827
|
+
return S("span", {
|
|
823
828
|
class: `farris-image-cropper-resize-bar ${D}`,
|
|
824
|
-
onMousedown: O((E) =>
|
|
829
|
+
onMousedown: O((E) => B(E, W.Resize, D), ["prevent"])
|
|
825
830
|
}, null);
|
|
826
831
|
}
|
|
827
832
|
function b(D) {
|
|
828
|
-
return
|
|
833
|
+
return S("div", null, [S("span", {
|
|
829
834
|
class: `farris-image-cropper-resize-bar ${D}`,
|
|
830
|
-
onMousedown: O((E) =>
|
|
831
|
-
}, [
|
|
835
|
+
onMousedown: O((E) => B(E, W.Resize, D), ["prevent"])
|
|
836
|
+
}, [S("span", {
|
|
832
837
|
class: "farris-image-cropper-square"
|
|
833
|
-
}, null)]),
|
|
838
|
+
}, null)]), S("span", {
|
|
834
839
|
class: "farris-image-cropper-resize top"
|
|
835
|
-
}, [
|
|
840
|
+
}, [S("span", {
|
|
836
841
|
class: "farris-image-cropper-square"
|
|
837
842
|
}, null)])]);
|
|
838
843
|
}
|
|
839
|
-
const V = ["top", "right", "bottom", "left"].map((D) =>
|
|
840
|
-
return () =>
|
|
844
|
+
const V = ["top", "right", "bottom", "left"].map((D) => c(D)), Q = ["topleft", "topright", "bottomright", "bottomleft"].map((D) => b(D));
|
|
845
|
+
return () => S("div", {
|
|
841
846
|
class: ["farris-image-cropper-frame", {
|
|
842
|
-
"farris-image-cropper-disabled":
|
|
847
|
+
"farris-image-cropper-disabled": h.value
|
|
843
848
|
}],
|
|
844
849
|
style: {
|
|
845
850
|
"text-align": r.value
|
|
846
851
|
},
|
|
847
|
-
onMousemove: O((D) =>
|
|
848
|
-
onTouchmove: O((D) =>
|
|
849
|
-
onMouseup: O(() =>
|
|
850
|
-
onTouchend: O(() =>
|
|
851
|
-
}, [!w &&
|
|
852
|
-
ref:
|
|
852
|
+
onMousemove: O((D) => A(D), ["prevent"]),
|
|
853
|
+
onTouchmove: O((D) => A(D), ["prevent"]),
|
|
854
|
+
onMouseup: O(() => d(), ["prevent"]),
|
|
855
|
+
onTouchend: O(() => d(), ["prevent"])
|
|
856
|
+
}, [!w && S("div", {
|
|
857
|
+
ref: g,
|
|
853
858
|
class: "farris-image-cropper",
|
|
854
859
|
style: [{
|
|
855
|
-
background: s.value ?
|
|
860
|
+
background: s.value ? y.value : ""
|
|
856
861
|
}]
|
|
857
|
-
}, [l.value &&
|
|
862
|
+
}, [l.value && S("img", {
|
|
858
863
|
title: "farris-source-image",
|
|
859
|
-
ref:
|
|
864
|
+
ref: m,
|
|
860
865
|
class: "farris-source-image",
|
|
861
866
|
style: [{
|
|
862
867
|
visibility: s.value ? "visible" : "hidden"
|
|
@@ -864,8 +869,8 @@ const fe = /* @__PURE__ */ Ce({
|
|
|
864
869
|
transform: u.value
|
|
865
870
|
}],
|
|
866
871
|
src: l.value,
|
|
867
|
-
onLoad: () =>
|
|
868
|
-
}, null), T.value &&
|
|
872
|
+
onLoad: () => j()
|
|
873
|
+
}, null), T.value && S("div", {
|
|
869
874
|
class: "farris-image-overlay",
|
|
870
875
|
style: [{
|
|
871
876
|
width: `${T.value.width || 0}px`
|
|
@@ -874,9 +879,9 @@ const fe = /* @__PURE__ */ Ce({
|
|
|
874
879
|
}, {
|
|
875
880
|
"margin-left": r.value === "center" ? P.value : ""
|
|
876
881
|
}]
|
|
877
|
-
}, null), s.value &&
|
|
882
|
+
}, null), s.value && S("div", {
|
|
878
883
|
class: ["farris-image-cropper-wrapper", {
|
|
879
|
-
"farris-image-cropper-rounded":
|
|
884
|
+
"farris-image-cropper-rounded": p.value
|
|
880
885
|
}],
|
|
881
886
|
style: [{
|
|
882
887
|
top: `${M.value.y1}px`
|
|
@@ -892,102 +897,109 @@ const fe = /* @__PURE__ */ Ce({
|
|
|
892
897
|
"margin-left": r.value === "center" ? P.value : ""
|
|
893
898
|
}],
|
|
894
899
|
tabindex: "0"
|
|
895
|
-
}, [
|
|
900
|
+
}, [S("div", {
|
|
896
901
|
class: "farris-image-cropper-move",
|
|
897
|
-
onMousedown: O((D) =>
|
|
898
|
-
}, null), !o.value &&
|
|
902
|
+
onMousedown: O((D) => B(D, W.Move, "topleft"), ["prevent"])
|
|
903
|
+
}, null), !o.value && S("div", null, [Q, V])])]), R.value && S("div", {
|
|
899
904
|
class: "farris-image-cropper-loading"
|
|
900
|
-
}, [
|
|
905
|
+
}, [S("div", {
|
|
901
906
|
class: "farris-image-cropper-loading-spinner"
|
|
902
|
-
}, null)]), w &&
|
|
907
|
+
}, null)]), w && S("div", {
|
|
903
908
|
class: "farris-image-cropper-error"
|
|
904
909
|
}, [t.value])]);
|
|
905
910
|
}
|
|
906
911
|
});
|
|
907
912
|
function Wt(e, i, r) {
|
|
908
|
-
var
|
|
909
|
-
|
|
910
|
-
}
|
|
911
|
-
const o = "", t = "", g = v();
|
|
913
|
+
var j;
|
|
914
|
+
const p = "", o = "", t = v();
|
|
912
915
|
function h() {
|
|
913
916
|
return (i == null ? void 0 : i.schema.componentType) !== "frame";
|
|
914
917
|
}
|
|
915
|
-
function
|
|
918
|
+
function g() {
|
|
916
919
|
return !1;
|
|
917
920
|
}
|
|
918
|
-
function
|
|
921
|
+
function w() {
|
|
919
922
|
return (i == null ? void 0 : i.schema.componentType) !== "frame";
|
|
920
923
|
}
|
|
921
|
-
function
|
|
924
|
+
function s() {
|
|
922
925
|
return (i == null ? void 0 : i.schema.componentType) === "frame";
|
|
923
926
|
}
|
|
924
|
-
function d
|
|
925
|
-
if (!
|
|
927
|
+
function y(d) {
|
|
928
|
+
if (!d || !d.value)
|
|
926
929
|
return null;
|
|
927
|
-
if (
|
|
928
|
-
return
|
|
929
|
-
const
|
|
930
|
-
return
|
|
930
|
+
if (d.value.schema && d.value.schema.type === "component")
|
|
931
|
+
return d.value;
|
|
932
|
+
const A = v(d == null ? void 0 : d.value.parent), c = y(A);
|
|
933
|
+
return c || null;
|
|
931
934
|
}
|
|
932
|
-
function
|
|
933
|
-
const { componentInstance:
|
|
934
|
-
return !
|
|
935
|
+
function m(d = i) {
|
|
936
|
+
const { componentInstance: A, designerItemElementRef: c } = d;
|
|
937
|
+
return !A || !A.value ? null : A.value.canMove ? c : m(d.parent);
|
|
935
938
|
}
|
|
936
|
-
function
|
|
939
|
+
function l(d) {
|
|
937
940
|
return !!r;
|
|
938
941
|
}
|
|
939
|
-
function
|
|
942
|
+
function u() {
|
|
940
943
|
return (i == null ? void 0 : i.schema.label) || (i == null ? void 0 : i.schema.title) || (i == null ? void 0 : i.schema.name);
|
|
941
944
|
}
|
|
942
|
-
function
|
|
945
|
+
function T() {
|
|
946
|
+
}
|
|
947
|
+
function M(d, A) {
|
|
943
948
|
}
|
|
944
|
-
function P(
|
|
949
|
+
function P(d, A) {
|
|
950
|
+
const { componentType: c } = d;
|
|
951
|
+
let b = ke(c, d, A);
|
|
952
|
+
const V = c.toLowerCase().replace(/-/g, "_");
|
|
953
|
+
return b && !b.id && b.type === c && (b.id = `${V}_${Math.random().toString().slice(2, 6)}`), b;
|
|
945
954
|
}
|
|
946
|
-
function W(
|
|
947
|
-
const { componentType: f } = x;
|
|
948
|
-
let b = ke(f, x, C);
|
|
949
|
-
const V = f.toLowerCase().replace("-", "_");
|
|
950
|
-
return b && !b.id && b.type === f && (b.id = `${V}_${Math.random().toString().slice(2, 6)}`), b;
|
|
955
|
+
function W(d) {
|
|
951
956
|
}
|
|
952
|
-
function R(
|
|
957
|
+
function R(...d) {
|
|
953
958
|
}
|
|
954
|
-
function
|
|
959
|
+
function B() {
|
|
960
|
+
i != null && i.schema.contents && i.schema.contents.map((d) => {
|
|
961
|
+
var b;
|
|
962
|
+
let A = d.id;
|
|
963
|
+
d.type === "component-ref" && (A = d.component);
|
|
964
|
+
const c = e.value.querySelector(`#${A}-design-item`);
|
|
965
|
+
(b = c == null ? void 0 : c.componentInstance) != null && b.value.onRemoveComponent && c.componentInstance.value.onRemoveComponent();
|
|
966
|
+
});
|
|
955
967
|
}
|
|
956
|
-
return
|
|
968
|
+
return t.value = {
|
|
957
969
|
canMove: h(),
|
|
958
|
-
canSelectParent:
|
|
959
|
-
canDelete:
|
|
960
|
-
canNested: !
|
|
970
|
+
canSelectParent: g(),
|
|
971
|
+
canDelete: w(),
|
|
972
|
+
canNested: !s(),
|
|
961
973
|
contents: i == null ? void 0 : i.schema.contents,
|
|
962
974
|
elementRef: e,
|
|
963
|
-
parent: (
|
|
975
|
+
parent: (j = i == null ? void 0 : i.parent) == null ? void 0 : j.componentInstance,
|
|
964
976
|
schema: i == null ? void 0 : i.schema,
|
|
965
|
-
styles:
|
|
966
|
-
designerClass:
|
|
967
|
-
canAccepts:
|
|
968
|
-
getBelongedComponentInstance:
|
|
969
|
-
getDraggableDesignItemElement:
|
|
970
|
-
getDraggingDisplayText:
|
|
971
|
-
getPropConfig:
|
|
972
|
-
getDragScopeElement:
|
|
973
|
-
onAcceptMovedChildElement:
|
|
974
|
-
onChildElementMovedOut:
|
|
975
|
-
addNewChildComponentSchema:
|
|
976
|
-
updateDragAndDropRules: m,
|
|
977
|
+
styles: p,
|
|
978
|
+
designerClass: o,
|
|
979
|
+
canAccepts: l,
|
|
980
|
+
getBelongedComponentInstance: y,
|
|
981
|
+
getDraggableDesignItemElement: m,
|
|
982
|
+
getDraggingDisplayText: u,
|
|
983
|
+
getPropConfig: R,
|
|
984
|
+
getDragScopeElement: T,
|
|
985
|
+
onAcceptMovedChildElement: M,
|
|
986
|
+
onChildElementMovedOut: W,
|
|
987
|
+
addNewChildComponentSchema: P,
|
|
977
988
|
triggerBelongedComponentToMoveWhenMoved: v(!1),
|
|
978
|
-
triggerBelongedComponentToDeleteWhenDeleted: v(!1)
|
|
979
|
-
|
|
989
|
+
triggerBelongedComponentToDeleteWhenDeleted: v(!1),
|
|
990
|
+
onRemoveComponent: B
|
|
991
|
+
}, t;
|
|
980
992
|
}
|
|
981
|
-
const Lt = /* @__PURE__ */
|
|
993
|
+
const Lt = /* @__PURE__ */ Se({
|
|
982
994
|
name: "FImageCropperDesign",
|
|
983
995
|
props: he,
|
|
984
996
|
emits: ["imageCropped", "imageLoaded", "cropperReady", "loadImageFailed"],
|
|
985
997
|
setup(e, i) {
|
|
986
|
-
const r = v(e.alignImage),
|
|
998
|
+
const r = v(e.alignImage), p = v(e.roundCropper), o = v(e.hideResizeSquares), t = v(e.loadImageErrorText), h = v(e.disabled), g = v(null), {
|
|
987
999
|
uploadError: w,
|
|
988
1000
|
imageVisible: s,
|
|
989
|
-
backgroundColor:
|
|
990
|
-
sourceImage:
|
|
1001
|
+
backgroundColor: y,
|
|
1002
|
+
sourceImage: m,
|
|
991
1003
|
safeImgDataUrl: l,
|
|
992
1004
|
safeTransformStyle: u,
|
|
993
1005
|
maxSize: T,
|
|
@@ -995,54 +1007,54 @@ const Lt = /* @__PURE__ */ Ce({
|
|
|
995
1007
|
marginLeft: P,
|
|
996
1008
|
moveTypes: W,
|
|
997
1009
|
isLoading: R,
|
|
998
|
-
startMove:
|
|
999
|
-
imageLoadedInView:
|
|
1000
|
-
moveStop:
|
|
1001
|
-
moveImg:
|
|
1002
|
-
} = De(e, i),
|
|
1010
|
+
startMove: B,
|
|
1011
|
+
imageLoadedInView: j,
|
|
1012
|
+
moveStop: d,
|
|
1013
|
+
moveImg: A
|
|
1014
|
+
} = De(e, i), c = v(), b = Te("design-item-context"), V = Wt(c, b);
|
|
1003
1015
|
Ae(() => {
|
|
1004
|
-
|
|
1016
|
+
c.value.componentInstance = V;
|
|
1005
1017
|
}), i.expose(V.value);
|
|
1006
|
-
function Q(
|
|
1007
|
-
return
|
|
1008
|
-
class: `farris-image-cropper-resize-bar ${
|
|
1009
|
-
onMousedown: O((q) =>
|
|
1018
|
+
function Q(C) {
|
|
1019
|
+
return S("span", {
|
|
1020
|
+
class: `farris-image-cropper-resize-bar ${C}`,
|
|
1021
|
+
onMousedown: O((q) => B(q, W.Resize, C), ["prevent"])
|
|
1010
1022
|
}, null);
|
|
1011
1023
|
}
|
|
1012
|
-
function D(
|
|
1013
|
-
return
|
|
1014
|
-
class: `farris-image-cropper-resize-bar ${
|
|
1015
|
-
onMousedown: O((q) =>
|
|
1016
|
-
}, [
|
|
1024
|
+
function D(C) {
|
|
1025
|
+
return S("div", null, [S("span", {
|
|
1026
|
+
class: `farris-image-cropper-resize-bar ${C}`,
|
|
1027
|
+
onMousedown: O((q) => B(q, W.Resize, C), ["prevent"])
|
|
1028
|
+
}, [S("span", {
|
|
1017
1029
|
class: "farris-image-cropper-square"
|
|
1018
|
-
}, null)]),
|
|
1030
|
+
}, null)]), S("span", {
|
|
1019
1031
|
class: "farris-image-cropper-resize top"
|
|
1020
|
-
}, [
|
|
1032
|
+
}, [S("span", {
|
|
1021
1033
|
class: "farris-image-cropper-square"
|
|
1022
1034
|
}, null)])]);
|
|
1023
1035
|
}
|
|
1024
|
-
const E = ["top", "right", "bottom", "left"].map((
|
|
1025
|
-
return () =>
|
|
1026
|
-
ref:
|
|
1036
|
+
const E = ["top", "right", "bottom", "left"].map((C) => Q(C)), $ = ["topleft", "topright", "bottomright", "bottomleft"].map((C) => D(C));
|
|
1037
|
+
return () => S("div", {
|
|
1038
|
+
ref: c,
|
|
1027
1039
|
class: ["farris-image-cropper-frame", {
|
|
1028
|
-
"farris-image-cropper-disabled":
|
|
1040
|
+
"farris-image-cropper-disabled": h.value
|
|
1029
1041
|
}],
|
|
1030
1042
|
style: {
|
|
1031
1043
|
"text-align": r.value
|
|
1032
1044
|
},
|
|
1033
|
-
onMousemove: O((
|
|
1034
|
-
onTouchmove: O((
|
|
1035
|
-
onMouseup: O(() =>
|
|
1036
|
-
onTouchend: O(() =>
|
|
1037
|
-
}, [!w &&
|
|
1038
|
-
ref:
|
|
1045
|
+
onMousemove: O((C) => A(C), ["prevent"]),
|
|
1046
|
+
onTouchmove: O((C) => A(C), ["prevent"]),
|
|
1047
|
+
onMouseup: O(() => d(), ["prevent"]),
|
|
1048
|
+
onTouchend: O(() => d(), ["prevent"])
|
|
1049
|
+
}, [!w && S("div", {
|
|
1050
|
+
ref: g,
|
|
1039
1051
|
class: "farris-image-cropper",
|
|
1040
1052
|
style: [{
|
|
1041
|
-
background: s.value ?
|
|
1053
|
+
background: s.value ? y.value : ""
|
|
1042
1054
|
}]
|
|
1043
|
-
}, [l.value &&
|
|
1055
|
+
}, [l.value && S("img", {
|
|
1044
1056
|
title: "farris-source-image",
|
|
1045
|
-
ref:
|
|
1057
|
+
ref: m,
|
|
1046
1058
|
class: "farris-source-image",
|
|
1047
1059
|
style: [{
|
|
1048
1060
|
visibility: s.value ? "visible" : "hidden"
|
|
@@ -1050,8 +1062,8 @@ const Lt = /* @__PURE__ */ Ce({
|
|
|
1050
1062
|
transform: u.value
|
|
1051
1063
|
}],
|
|
1052
1064
|
src: l.value,
|
|
1053
|
-
onLoad: () =>
|
|
1054
|
-
}, null), T.value &&
|
|
1065
|
+
onLoad: () => j()
|
|
1066
|
+
}, null), T.value && S("div", {
|
|
1055
1067
|
class: "farris-image-overlay",
|
|
1056
1068
|
style: [{
|
|
1057
1069
|
width: `${T.value.width || 0}px`
|
|
@@ -1060,9 +1072,9 @@ const Lt = /* @__PURE__ */ Ce({
|
|
|
1060
1072
|
}, {
|
|
1061
1073
|
"margin-left": r.value === "center" ? P.value : ""
|
|
1062
1074
|
}]
|
|
1063
|
-
}, null), s.value &&
|
|
1075
|
+
}, null), s.value && S("div", {
|
|
1064
1076
|
class: ["farris-image-cropper-wrapper", {
|
|
1065
|
-
"farris-image-cropper-rounded":
|
|
1077
|
+
"farris-image-cropper-rounded": p.value
|
|
1066
1078
|
}],
|
|
1067
1079
|
style: [{
|
|
1068
1080
|
top: `${M.value.y1}px`
|
|
@@ -1078,14 +1090,14 @@ const Lt = /* @__PURE__ */ Ce({
|
|
|
1078
1090
|
"margin-left": r.value === "center" ? P.value : ""
|
|
1079
1091
|
}],
|
|
1080
1092
|
tabindex: "0"
|
|
1081
|
-
}, [
|
|
1093
|
+
}, [S("div", {
|
|
1082
1094
|
class: "farris-image-cropper-move",
|
|
1083
|
-
onMousedown: O((
|
|
1084
|
-
}, null), !o.value &&
|
|
1095
|
+
onMousedown: O((C) => B(C, W.Move, "topleft"), ["prevent"])
|
|
1096
|
+
}, null), !o.value && S("div", null, [$, E])])]), R.value && S("div", {
|
|
1085
1097
|
class: "farris-image-cropper-loading"
|
|
1086
|
-
}, [
|
|
1098
|
+
}, [S("div", {
|
|
1087
1099
|
class: "farris-image-cropper-loading-spinner"
|
|
1088
|
-
}, null)]), w &&
|
|
1100
|
+
}, null)]), w && S("div", {
|
|
1089
1101
|
class: "farris-image-cropper-error"
|
|
1090
1102
|
}, [t.value])]);
|
|
1091
1103
|
}
|
|
@@ -1093,7 +1105,7 @@ const Lt = /* @__PURE__ */ Ce({
|
|
|
1093
1105
|
install(e) {
|
|
1094
1106
|
e.component(fe.name, fe);
|
|
1095
1107
|
},
|
|
1096
|
-
register(e, i, r,
|
|
1108
|
+
register(e, i, r, p) {
|
|
1097
1109
|
e["image-cropper"] = fe, i["image-cropper"] = we;
|
|
1098
1110
|
},
|
|
1099
1111
|
registerDesigner(e, i, r) {
|