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