@farris/ui-vue 1.2.9 → 1.3.1
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 +64 -64
- package/components/accordion/index.umd.cjs +1 -1
- package/components/avatar/index.esm.js +521 -336
- package/components/avatar/index.umd.cjs +1 -1
- package/components/button-edit/index.css +1 -1
- package/components/button-edit/index.esm.js +99 -97
- package/components/button-edit/index.umd.cjs +1 -1
- package/components/calendar/index.esm.js +496 -504
- package/components/calendar/index.umd.cjs +1 -1
- package/components/capsule/index.esm.js +251 -259
- package/components/capsule/index.umd.cjs +1 -1
- package/components/checkbox/index.esm.js +696 -519
- package/components/checkbox/index.umd.cjs +1 -1
- package/components/color-picker/index.esm.js +368 -376
- package/components/color-picker/index.umd.cjs +2 -2
- package/components/combo-list/index.css +1 -0
- package/components/combo-list/index.esm.js +1141 -340
- package/components/combo-list/index.umd.cjs +1 -1
- package/components/combo-tree/index.esm.js +116 -116
- package/components/combo-tree/index.umd.cjs +1 -1
- package/components/common/index.esm.js +986 -798
- package/components/common/index.umd.cjs +1 -1
- package/components/component/index.esm.js +463 -998
- package/components/component/index.umd.cjs +1 -1
- package/components/condition/index.css +1 -0
- package/components/condition/index.esm.js +2233 -1057
- package/components/condition/index.umd.cjs +1 -1
- package/components/content-container/index.esm.js +335 -1002
- package/components/content-container/index.umd.cjs +1 -1
- package/components/data-grid/index.css +1 -1
- package/components/data-grid/index.esm.js +6193 -4702
- package/components/data-grid/index.umd.cjs +1 -1
- package/components/data-view/index.css +1 -0
- package/components/data-view/index.esm.js +4562 -3294
- package/components/data-view/index.umd.cjs +1 -1
- package/components/date-picker/index.css +1 -1
- package/components/date-picker/index.esm.js +3420 -2623
- package/components/date-picker/index.umd.cjs +1 -1
- package/components/designer-canvas/index.css +1 -1
- package/components/designer-canvas/index.esm.js +914 -883
- package/components/designer-canvas/index.umd.cjs +1 -1
- package/components/designer-outline/index.esm.js +14 -13
- package/components/designer-outline/index.umd.cjs +1 -1
- package/components/dropdown/index.esm.js +204 -212
- package/components/dropdown/index.umd.cjs +2 -2
- package/components/dynamic-form/index.css +1 -0
- package/components/dynamic-form/index.esm.js +2795 -1835
- package/components/dynamic-form/index.umd.cjs +1 -1
- package/components/dynamic-resolver/index.esm.js +180 -130
- package/components/dynamic-resolver/index.umd.cjs +1 -1
- package/components/dynamic-view/index.esm.js +303 -290
- package/components/dynamic-view/index.umd.cjs +1 -1
- package/components/events-editor/index.esm.js +328 -336
- package/components/events-editor/index.umd.cjs +1 -1
- package/components/expression-editor/index.esm.js +65 -65
- package/components/expression-editor/index.umd.cjs +1 -1
- package/components/external-container/index.css +1 -1
- package/components/external-container/index.esm.js +3349 -3626
- package/components/external-container/index.umd.cjs +1 -1
- package/components/field-selector/index.css +1 -1
- package/components/field-selector/index.esm.js +5344 -8588
- package/components/field-selector/index.umd.cjs +1 -1
- package/components/filter-bar/index.css +1 -1
- package/components/filter-bar/index.esm.js +2179 -2227
- package/components/filter-bar/index.umd.cjs +1 -1
- package/components/flow-canvas/index.css +1 -1
- package/components/flow-canvas/index.esm.js +684 -675
- package/components/flow-canvas/index.umd.cjs +1 -1
- package/components/image-cropper/index.esm.js +482 -490
- package/components/image-cropper/index.umd.cjs +1 -1
- package/components/input-group/index.esm.js +746 -569
- package/components/input-group/index.umd.cjs +1 -1
- package/components/layout/index.esm.js +409 -385
- package/components/layout/index.umd.cjs +1 -1
- package/components/list-nav/index.esm.js +348 -1019
- package/components/list-nav/index.umd.cjs +1 -1
- package/components/list-view/index.css +1 -1
- package/components/list-view/index.esm.js +3606 -2388
- package/components/list-view/index.umd.cjs +1 -1
- package/components/lookup/index.css +1 -1
- package/components/lookup/index.esm.js +10871 -8970
- package/components/lookup/index.umd.cjs +1 -1
- package/components/mapping-editor/index.css +1 -1
- package/components/mapping-editor/index.esm.js +6019 -5631
- package/components/mapping-editor/index.umd.cjs +1 -1
- 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 -1
- package/components/modal/index.css +1 -1
- package/components/modal/index.esm.js +438 -398
- package/components/modal/index.umd.cjs +1 -1
- package/components/nav/index.esm.js +912 -1281
- package/components/nav/index.umd.cjs +3 -3
- package/components/notify/index.esm.js +59 -53
- package/components/notify/index.umd.cjs +1 -1
- package/components/number-range/index.esm.js +660 -484
- package/components/number-range/index.umd.cjs +1 -1
- package/components/number-spinner/index.esm.js +682 -506
- package/components/number-spinner/index.umd.cjs +1 -1
- package/components/order/index.css +1 -1
- package/components/order/index.esm.js +1848 -1658
- package/components/order/index.umd.cjs +1 -1
- package/components/page-footer/index.esm.js +100 -100
- package/components/page-footer/index.umd.cjs +1 -1
- package/components/page-header/index.esm.js +1120 -1923
- package/components/page-header/index.umd.cjs +1 -1
- package/components/pagination/index.esm.js +875 -1214
- package/components/pagination/index.umd.cjs +1 -1
- package/components/popover/index.esm.js +71 -70
- package/components/popover/index.umd.cjs +1 -1
- package/components/progress/index.esm.js +229 -237
- package/components/progress/index.umd.cjs +3 -3
- package/components/property-editor/index.css +1 -1
- package/components/property-editor/index.esm.js +2314 -1521
- package/components/property-editor/index.umd.cjs +3 -3
- package/components/property-panel/index.esm.js +867 -868
- package/components/property-panel/index.umd.cjs +1 -1
- package/components/query-solution/index.css +1 -1
- package/components/query-solution/index.esm.js +4332 -3623
- package/components/query-solution/index.umd.cjs +1 -1
- package/components/radio-button/index.esm.js +72 -72
- package/components/radio-button/index.umd.cjs +1 -1
- package/components/radio-group/index.esm.js +613 -437
- package/components/radio-group/index.umd.cjs +1 -1
- package/components/rate/index.esm.js +255 -263
- package/components/rate/index.umd.cjs +1 -1
- package/components/response-layout/index.esm.js +144 -152
- package/components/response-layout/index.umd.cjs +1 -1
- package/components/response-layout-editor/index.css +1 -1
- package/components/response-layout-editor/index.esm.js +1101 -1038
- package/components/response-layout-editor/index.umd.cjs +1 -1
- package/components/response-toolbar/index.esm.js +935 -1750
- package/components/response-toolbar/index.umd.cjs +1 -1
- package/components/schema-selector/index.css +1 -1
- package/components/schema-selector/index.esm.js +5264 -5677
- package/components/schema-selector/index.umd.cjs +2 -2
- package/components/search-box/index.esm.js +151 -154
- package/components/search-box/index.umd.cjs +1 -1
- package/components/section/index.esm.js +438 -1125
- package/components/section/index.umd.cjs +1 -1
- package/components/smoke-detector/index.esm.js +93 -101
- package/components/smoke-detector/index.umd.cjs +1 -1
- package/components/splitter/index.esm.js +563 -1202
- package/components/splitter/index.umd.cjs +1 -1
- package/components/splitter/style.js +2 -0
- package/components/step/index.esm.js +248 -256
- package/components/step/index.umd.cjs +1 -1
- package/components/switch/index.esm.js +549 -373
- package/components/switch/index.umd.cjs +1 -1
- package/components/tabs/index.css +1 -1
- package/components/tabs/index.esm.js +2436 -3110
- package/components/tabs/index.umd.cjs +1 -1
- package/components/tags/index.esm.js +328 -336
- package/components/tags/index.umd.cjs +1 -1
- package/components/text/index.esm.js +339 -347
- package/components/text/index.umd.cjs +1 -1
- package/components/textarea/index.esm.js +554 -378
- package/components/textarea/index.umd.cjs +1 -1
- package/components/time-picker/index.css +1 -1
- package/components/time-picker/index.esm.js +1322 -1144
- package/components/time-picker/index.umd.cjs +1 -1
- package/components/transfer/index.css +1 -1
- package/components/transfer/index.esm.js +537 -543
- package/components/transfer/index.umd.cjs +1 -1
- package/components/tree-grid/index.css +1 -1
- package/components/tree-grid/index.esm.js +5113 -9426
- package/components/tree-grid/index.umd.cjs +1 -1
- package/components/tree-view/index.css +1 -0
- package/components/tree-view/index.esm.js +3900 -2677
- package/components/tree-view/index.umd.cjs +1 -1
- package/components/uploader/index.esm.js +568 -570
- package/components/uploader/index.umd.cjs +2 -2
- package/components/verify-detail/index.esm.js +266 -274
- package/components/verify-detail/index.umd.cjs +1 -1
- package/components/video/index.esm.js +553 -1052
- package/components/video/index.umd.cjs +1 -1
- package/components/weather/index.esm.js +558 -566
- package/components/weather/index.umd.cjs +5 -5
- package/farris.all.esm.js +22009 -22688
- package/farris.all.umd.cjs +9 -9
- package/index.css +1 -1
- package/package.json +1 -1
- package/types/capsule/src/capsule.props.d.ts +2 -2
- package/types/combo-list/src/components/list-container.component.d.ts +0 -3
- package/types/combo-list/src/components/list-container.props.d.ts +0 -4
- package/types/common/directive/area-response.d.ts +10 -0
- package/types/common/index.d.ts +9 -0
- package/types/common/radio-checkbox/radio-checkbox.props.d.ts +1 -0
- package/types/common/types.d.ts +1 -1
- package/types/common/utils/encrypt.d.ts +2 -0
- package/types/common/utils/resolve-field.d.ts +2 -0
- package/types/common/utils/use-class.d.ts +7 -0
- package/types/component/src/component.props.d.ts +7 -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/condition/src/types.d.ts +2 -1
- package/types/content-container/src/designer/use-designer-rules.d.ts +3 -3
- package/types/data-grid/index.d.ts +11 -5
- package/types/data-grid/src/data-grid.component.d.ts +4 -2
- package/types/data-grid/src/data-grid.props.d.ts +1 -0
- package/types/data-grid/src/designer/data-grid.design.component.d.ts +2 -2
- package/types/data-grid/src/designer/use-designer-rules.d.ts +2 -2
- package/types/data-view/components/row/hierarchy-row.component.d.ts +2 -2
- package/types/data-view/composition/data/use-tree-data.d.ts +1 -1
- package/types/data-view/composition/types.d.ts +19 -4
- package/types/data-view/composition/visualization/use-virtual-scroll.d.ts +0 -15
- 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/rule/use-dragula-common-rule.d.ts +4 -0
- package/types/designer-canvas/src/composition/rule/use-template-rule.d.ts +30 -0
- package/types/designer-canvas/src/composition/types.d.ts +2 -3
- package/types/designer-canvas/src/types.d.ts +2 -1
- 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/response-form.design.component.d.ts +7 -1
- package/types/dynamic-form/src/designer/use-designer-rules.d.ts +1 -1
- 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 +1 -0
- package/types/dynamic-form/src/types.d.ts +12 -1
- package/types/dynamic-resolver/index.d.ts +1 -0
- package/types/dynamic-resolver/src/common/toolbar-resolver.d.ts +1 -1
- package/types/dynamic-resolver/src/event-handler-resolver.d.ts +4 -0
- package/types/dynamic-resolver/src/types.d.ts +9 -0
- package/types/dynamic-view/index.d.ts +1 -0
- package/types/dynamic-view/src/event-dispatcher.d.ts +1 -1
- package/types/external-container/src/designer/use-designer-rules.d.ts +3 -3
- package/types/index.d.ts +2 -0
- package/types/layout/src/designer/layout-pane-use-designer-rules.d.ts +3 -3
- package/types/list-nav/src/designer/use-designer-rules.d.ts +3 -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/pagination/src/components/buttons/goto-buttons.component.d.ts +2 -2
- package/types/pagination/src/components/buttons/next-buttons.component.d.ts +2 -2
- package/types/pagination/src/components/buttons/previous-buttons.component.d.ts +2 -2
- package/types/pagination/src/components/pages/page-list.component.d.ts +2 -2
- package/types/pagination/src/components/pages/page-number.component.d.ts +2 -2
- package/types/property-panel/index.d.ts +2 -1
- 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/query-solution/src/designer/query-solution-config/composition/types.d.ts +34 -27
- package/types/query-solution/src/designer/query-solution-config/composition/use-panel.d.ts +2 -16
- package/types/{data-grid/src/designer/use-group-column.d.ts → query-solution/src/designer/query-solution-config/composition/use-property.d.ts} +4 -5
- package/types/query-solution/src/designer/query-solution-config/composition/use-querysolution-rules.d.ts +3 -0
- package/types/query-solution/src/designer/query-solution-config/composition/use-transfer.d.ts +1 -1
- package/types/query-solution/src/property-config/query-solution.property-config.d.ts +60 -0
- package/types/query-solution/src/solutions.d.ts +108 -509
- package/types/response-layout-editor/index.d.ts +3 -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/designer/use-designer-rules.d.ts +3 -3
- package/types/response-toolbar/src/property-config/response-toolbar-item.property-config.d.ts +1 -0
- package/types/section/src/designer/use-designer-rules.d.ts +3 -3
- package/types/splitter/src/components/splitter-pane.component.d.ts +1 -1
- package/types/splitter/src/designer/splitter-pane-use-designer-rules.d.ts +3 -3
- package/types/splitter/src/designer/splitter-use-designer-rules.d.ts +3 -3
- package/types/tabs/src/designer/tab-page-use-designer-rules.d.ts +3 -3
- package/types/tabs/src/designer/tab-use-designer-rules.d.ts +3 -3
- package/types/tabs/src/tabs.props.d.ts +1 -0
- package/types/tree-grid/index.d.ts +8 -2
- package/types/tree-grid/src/tree-grid.component.d.ts +3 -1
- package/types/designer-canvas/src/composition/rule/use-drag-drop-rules.d.ts +0 -19
- package/types/designer-canvas/src/composition/use-dragula-common-rule.d.ts +0 -4
- package/types/list-nav/src/composition/use-designer-rules.d.ts +0 -3
- package/types/modal/src/composition/use-esc.d.ts +0 -1
- package/types/query-solution/src/designer/query-solution-config/composition/mock-data.d.ts +0 -6
- 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
|
|
2
|
-
import { cloneDeep as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
const { properties: i, title: r, ignore:
|
|
6
|
-
return (!o || !
|
|
1
|
+
import { inject as Te, ref as v, onMounted as Ae, onUnmounted as nt, watch as K, defineComponent as Ce, createVNode as A, withModifiers as O } from "vue";
|
|
2
|
+
import { isPlainObject as Me, cloneDeep as ut } from "lodash-es";
|
|
3
|
+
const ze = {}, Ee = {};
|
|
4
|
+
function ve(e) {
|
|
5
|
+
const { properties: i, title: r, ignore: m } = e, o = m && Array.isArray(m), t = Object.keys(i).reduce((g, h) => ((!o || !m.find((w) => w == h)) && (g[h] = i[h].type === "object" && i[h].properties ? ve(i[h]) : ut(i[h].default)), g), {});
|
|
6
|
+
return r && (!o || !m.find((g) => g == "id")) && (t.id = `${r}-${Date.now()}`), t;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
const
|
|
10
|
-
if (
|
|
11
|
-
let o =
|
|
8
|
+
function ke(e, i = {}, r) {
|
|
9
|
+
const m = ze[e];
|
|
10
|
+
if (m) {
|
|
11
|
+
let o = ve(m);
|
|
12
12
|
const t = Ee[e];
|
|
13
|
-
return o = t ? t({ getSchemaByType:
|
|
13
|
+
return o = t ? t({ getSchemaByType: ke }, o, i, r) : o, o;
|
|
14
14
|
}
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
17
|
-
function ut(e, i) {
|
|
18
|
-
const r = he(i);
|
|
19
|
-
return Object.keys(e).reduce((y, o) => (y[o] && typeof y[o] == "object" ? Object.assign(y[o], e[o]) : y[o] = e[o], y), r), r;
|
|
20
|
-
}
|
|
21
17
|
function rt(e, i) {
|
|
22
|
-
|
|
18
|
+
const r = ve(i);
|
|
19
|
+
return Object.keys(e).reduce((m, o) => (m[o] && Me(m[o]) && Me(e[o]) ? Object.assign(m[o], e[o]) : m[o] = e[o], m), r), r;
|
|
20
|
+
}
|
|
21
|
+
function st(e, i) {
|
|
22
|
+
return Object.keys(e).filter((m) => e[m] != null).reduce((m, o) => {
|
|
23
23
|
if (i.has(o)) {
|
|
24
24
|
const t = i.get(o);
|
|
25
25
|
if (typeof t == "string")
|
|
26
|
-
|
|
26
|
+
m[t] = e[o];
|
|
27
27
|
else {
|
|
28
|
-
const
|
|
29
|
-
Object.assign(
|
|
28
|
+
const g = t(o, e[o], e);
|
|
29
|
+
Object.assign(m, g);
|
|
30
30
|
}
|
|
31
31
|
} else
|
|
32
|
-
|
|
33
|
-
return
|
|
32
|
+
m[o] = e[o];
|
|
33
|
+
return m;
|
|
34
34
|
}, {});
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const
|
|
38
|
-
return
|
|
36
|
+
function ot(e, i, r = /* @__PURE__ */ new Map()) {
|
|
37
|
+
const m = rt(e, i);
|
|
38
|
+
return st(m, 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, p, d, l) {
|
|
42
|
+
if (typeof d == "number")
|
|
43
|
+
return l[s].length === d;
|
|
44
|
+
if (typeof d == "object") {
|
|
45
|
+
const u = Object.keys(d)[0], T = d[u];
|
|
46
46
|
if (u === "not")
|
|
47
|
-
return Number(
|
|
47
|
+
return Number(l[s].length) !== Number(T);
|
|
48
48
|
if (u === "moreThan")
|
|
49
|
-
return Number(
|
|
49
|
+
return Number(l[s].length) >= Number(T);
|
|
50
50
|
if (u === "lessThan")
|
|
51
|
-
return Number(
|
|
51
|
+
return Number(l[s].length) <= Number(T);
|
|
52
52
|
}
|
|
53
53
|
return !1;
|
|
54
54
|
}
|
|
55
|
-
function r(s,
|
|
56
|
-
return
|
|
55
|
+
function r(s, p, d, l) {
|
|
56
|
+
return l[s] && l[s].propertyValue && String(l[s].propertyValue.value) === String(d);
|
|
57
57
|
}
|
|
58
|
-
const
|
|
58
|
+
const m = /* @__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, p) => (s.set(p, e[p]), s), m);
|
|
63
|
+
function o(s, p) {
|
|
64
|
+
const d = s;
|
|
65
|
+
return typeof p == "number" ? [{ target: d, operator: "length", param: null, value: Number(p) }] : typeof p == "boolean" ? [{ target: d, operator: "getProperty", param: s, value: !!p }] : typeof p == "object" ? Object.keys(p).map((l) => {
|
|
66
|
+
if (l === "length")
|
|
67
|
+
return { target: d, operator: "length", param: null, value: p[l] };
|
|
68
|
+
const u = l, T = p[l];
|
|
69
|
+
return { target: d, operator: "getProperty", param: u, value: T };
|
|
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((d, l) => {
|
|
74
|
+
const u = o(l, s[l]);
|
|
75
|
+
return d.push(...u), d;
|
|
76
76
|
}, []);
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
if (
|
|
80
|
-
const
|
|
81
|
-
return
|
|
78
|
+
function g(s, p) {
|
|
79
|
+
if (m.has(s.operator)) {
|
|
80
|
+
const d = m.get(s.operator);
|
|
81
|
+
return d && d(s.target, s.param, s.value, p) || !1;
|
|
82
82
|
}
|
|
83
83
|
return !1;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
return t(s).reduce((u,
|
|
85
|
+
function h(s, p) {
|
|
86
|
+
return t(s).reduce((u, T) => u && g(T, p), !0);
|
|
87
87
|
}
|
|
88
|
-
function w(s,
|
|
89
|
-
const
|
|
90
|
-
return
|
|
88
|
+
function w(s, p) {
|
|
89
|
+
const d = Object.keys(s), l = d.includes("allOf"), u = d.includes("anyOf"), T = l || u, W = (T ? s[T ? l ? "allOf" : "anyOf" : "allOf"] : [s]).map((S) => h(S, p));
|
|
90
|
+
return l ? !W.includes(!1) : W.includes(!0);
|
|
91
91
|
}
|
|
92
92
|
return { parseValueSchema: w };
|
|
93
93
|
}
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
function
|
|
97
|
-
return
|
|
98
|
-
const
|
|
99
|
-
return Object.assign(w,
|
|
94
|
+
const ft = {}, vt = {};
|
|
95
|
+
ct();
|
|
96
|
+
function ht(e, i, r = /* @__PURE__ */ new Map(), m = (g, h, w) => h, o = {}, t = (g) => g) {
|
|
97
|
+
return ze[i.title] = i, Ee[i.title] = m, ft[i.title] = o, vt[i.title] = t, (g = {}) => {
|
|
98
|
+
const h = ot(g, i, r), w = Object.keys(e).reduce((s, p) => (s[p] = e[p].default, s), {});
|
|
99
|
+
return Object.assign(w, h);
|
|
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
|
+
}, Tt = [
|
|
173
173
|
"id",
|
|
174
174
|
"type"
|
|
175
175
|
], At = {
|
|
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: Tt
|
|
183
|
+
}, Ct = "image-cropper", zt = "A Farris Component", Et = "object", kt = {
|
|
184
184
|
basic: {
|
|
185
185
|
description: "Basic Infomation",
|
|
186
186
|
title: "基本信息",
|
|
@@ -233,12 +233,12 @@ const dt = /* @__PURE__ */ new Map([
|
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
},
|
|
237
|
-
title:
|
|
238
|
-
description:
|
|
239
|
-
type:
|
|
240
|
-
categories:
|
|
241
|
-
},
|
|
236
|
+
}, Dt = {
|
|
237
|
+
title: Ct,
|
|
238
|
+
description: zt,
|
|
239
|
+
type: Et,
|
|
240
|
+
categories: kt
|
|
241
|
+
}, he = {
|
|
242
242
|
/** 输出图片格式 */
|
|
243
243
|
format: { type: String, default: "png" },
|
|
244
244
|
/** 保持长宽比例 */
|
|
@@ -295,9 +295,9 @@ const dt = /* @__PURE__ */ new Map([
|
|
|
295
295
|
y2: 1e4
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
|
-
}, we =
|
|
298
|
+
}, we = ht(he, At, mt, dt, Dt);
|
|
299
299
|
var ae = /* @__PURE__ */ ((e) => (e.Move = "move", e.Resize = "resize", e))(ae || {});
|
|
300
|
-
function
|
|
300
|
+
function St() {
|
|
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 w = t.getUint16(
|
|
330
|
-
if (
|
|
331
|
-
if (t.getUint32(
|
|
325
|
+
const g = t.byteLength;
|
|
326
|
+
let h = 2;
|
|
327
|
+
for (; h < g; ) {
|
|
328
|
+
if (t.getUint16(h + 2, !1) <= 8) return -1;
|
|
329
|
+
const w = t.getUint16(h, !1);
|
|
330
|
+
if (h += 2, w === 65505) {
|
|
331
|
+
if (t.getUint32(h += 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(h += 6, !1) === 18761;
|
|
334
|
+
h += t.getUint32(h + 4, s);
|
|
335
|
+
const p = t.getUint16(h, s);
|
|
336
|
+
h += 2;
|
|
337
|
+
for (let d = 0; d < p; d++)
|
|
338
|
+
if (t.getUint16(h + d * 12, s) === 274)
|
|
339
|
+
return t.getUint16(h + d * 12 + 8, s);
|
|
340
340
|
} else {
|
|
341
341
|
if ((w & 65280) !== 65280)
|
|
342
342
|
break;
|
|
343
|
-
|
|
343
|
+
h += t.getUint16(h, !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 w = 0; w <
|
|
352
|
-
|
|
353
|
-
return
|
|
354
|
-
}
|
|
355
|
-
function
|
|
356
|
-
const
|
|
357
|
-
t = Math.round(t),
|
|
358
|
-
const s =
|
|
350
|
+
const t = atob(o), g = t.length, h = new Uint8Array(g);
|
|
351
|
+
for (let w = 0; w < g; w++)
|
|
352
|
+
h[w] = t.charCodeAt(w);
|
|
353
|
+
return h.buffer;
|
|
354
|
+
}
|
|
355
|
+
function m(o, t, g) {
|
|
356
|
+
const h = o.width, w = o.height;
|
|
357
|
+
t = Math.round(t), g = Math.round(g);
|
|
358
|
+
const s = h / t, p = w / g, d = Math.ceil(s / 2), l = Math.ceil(p / 2), u = o.getContext("2d");
|
|
359
359
|
if (u) {
|
|
360
|
-
const
|
|
361
|
-
for (let R = 0; R <
|
|
362
|
-
for (let
|
|
363
|
-
const
|
|
364
|
-
let
|
|
365
|
-
const
|
|
366
|
-
let
|
|
367
|
-
|
|
368
|
-
for (let
|
|
369
|
-
const
|
|
370
|
-
for (let
|
|
371
|
-
const
|
|
372
|
-
if (
|
|
360
|
+
const T = u.getImageData(0, 0, h, w), M = u.createImageData(t, g), { data: P } = T, W = M.data;
|
|
361
|
+
for (let R = 0; R < g; R++)
|
|
362
|
+
for (let S = 0; S < t; S++) {
|
|
363
|
+
const I = (S + R * t) * 4, x = R * p;
|
|
364
|
+
let C = 0, f = 0, b = 0, V = 0, Q = 0, D = 0, E = 0;
|
|
365
|
+
const U = Math.floor(S * s), B = Math.floor(R * p);
|
|
366
|
+
let q = Math.ceil((S + 1) * s), J = Math.ceil((R + 1) * p);
|
|
367
|
+
q = Math.min(q, h), J = Math.min(J, w);
|
|
368
|
+
for (let L = B; L < J; L++) {
|
|
369
|
+
const z = Math.abs(x - L) / l, ie = S * s, ee = z * z;
|
|
370
|
+
for (let _ = U; _ < q; _++) {
|
|
371
|
+
const j = Math.abs(ie - _) / d, H = Math.sqrt(ee + j * j);
|
|
372
|
+
if (H >= 1)
|
|
373
373
|
continue;
|
|
374
|
-
|
|
375
|
-
const
|
|
376
|
-
|
|
374
|
+
C = 2 * H * H * H - 3 * H * H + 1;
|
|
375
|
+
const N = 4 * (_ + L * h);
|
|
376
|
+
E += C * P[N + 3], b += C, P[N + 3] < 255 && (C = C * P[N + 3] / 250), V += C * P[N], Q += C * P[N + 1], D += C * P[N + 2], f += C;
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
|
|
379
|
+
W[I] = V / f, W[I + 1] = Q / f, W[I + 2] = D / f, W[I + 3] = E / b;
|
|
380
380
|
}
|
|
381
|
-
o.width = t, o.height =
|
|
381
|
+
o.width = t, o.height = g, u.putImageData(M, 0, 0);
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
384
|
return {
|
|
385
|
-
resizeCanvas:
|
|
385
|
+
resizeCanvas: m,
|
|
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, m) {
|
|
390
|
+
function o(l, u) {
|
|
391
|
+
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
392
|
}
|
|
393
|
-
function t(
|
|
394
|
-
e.value.x2 = e.value.x1 + (e.value.y2 - e.value.y1) * r.value,
|
|
393
|
+
function t(l, u) {
|
|
394
|
+
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
395
|
}
|
|
396
|
-
function
|
|
397
|
-
e.value.y1 = e.value.y2 - (e.value.x2 - e.value.x1) / r.value,
|
|
396
|
+
function g(l, u) {
|
|
397
|
+
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
398
|
}
|
|
399
|
-
function
|
|
400
|
-
e.value.y1 = e.value.y2 - (e.value.x2 - e.value.x1) / r.value,
|
|
399
|
+
function h(l, u) {
|
|
400
|
+
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
401
|
}
|
|
402
|
-
function w(
|
|
403
|
-
e.value.y2 = e.value.y1 + (e.value.x2 - e.value.x1) / r.value,
|
|
402
|
+
function w(l, u) {
|
|
403
|
+
e.value.y2 = e.value.y1 + (e.value.x2 - e.value.x1) / 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);
|
|
404
404
|
}
|
|
405
|
-
function s(
|
|
406
|
-
e.value.y2 = e.value.y1 + (e.value.x2 - e.value.x1) / r.value,
|
|
405
|
+
function s(l, u) {
|
|
406
|
+
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
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function p() {
|
|
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 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
|
+
(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
412
|
}
|
|
413
|
-
function
|
|
413
|
+
function d() {
|
|
414
414
|
if (i.value.width && i.value.height)
|
|
415
|
-
switch (
|
|
415
|
+
switch (m.position) {
|
|
416
416
|
case "top":
|
|
417
417
|
o(0, 0);
|
|
418
418
|
break;
|
|
@@ -420,10 +420,10 @@ function Dt(e, i, r, y) {
|
|
|
420
420
|
t(0, 0);
|
|
421
421
|
break;
|
|
422
422
|
case "topleft":
|
|
423
|
-
|
|
423
|
+
g(0, 0);
|
|
424
424
|
break;
|
|
425
425
|
case "topright":
|
|
426
|
-
|
|
426
|
+
h(0, 0);
|
|
427
427
|
break;
|
|
428
428
|
case "right":
|
|
429
429
|
case "bottomright":
|
|
@@ -434,23 +434,23 @@ function Dt(e, i, r, y) {
|
|
|
434
434
|
s(0, 0);
|
|
435
435
|
break;
|
|
436
436
|
case "center":
|
|
437
|
-
|
|
437
|
+
p();
|
|
438
438
|
break;
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
return { checkAspectRatio:
|
|
441
|
+
return { checkAspectRatio: d };
|
|
442
442
|
}
|
|
443
|
-
function
|
|
444
|
-
const { resizeCanvas: r, getTransformationsFromExifData:
|
|
445
|
-
let f,
|
|
446
|
-
const
|
|
447
|
-
let ee,
|
|
448
|
-
const
|
|
449
|
-
function
|
|
450
|
-
|
|
443
|
+
function De(e, i) {
|
|
444
|
+
const { resizeCanvas: r, getTransformationsFromExifData: m } = St(), o = Te("NotifyService"), t = v(e.cropper), g = v(e.transform), h = v(e.cropperMinWidth), w = v(e.maintainAspectRatio), s = v(e.aspectRatio), p = v(e.autoCrop), d = 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), S = v(e.cropperMinHeight), I = v(""), x = v(!0), C = v(!0);
|
|
445
|
+
let f, b, V = 0, Q, D, E;
|
|
446
|
+
const U = v(null), B = v(""), q = v(""), J = v("0px"), L = v(), z = v({ width: 100, height: 100 }), ie = ae;
|
|
447
|
+
let ee, _ = 20, j = 20, H = !1, N = { rotate: 0, flip: !1 }, y = { active: !1, type: null, position: null, x1: 0, y1: 0, x2: 0, y2: 0, clientX: 0, clientY: 0 };
|
|
448
|
+
const ge = v(e.imageChangedEvent), le = v(e.imageURL), Se = v(e.imageBase64), Be = v(e.imageFile);
|
|
449
|
+
function We() {
|
|
450
|
+
q.value = "scaleX(" + (g.value.scale || 1) * (g.value.flipH ? -1 : 1) + ")scaleY(" + (g.value.scale || 1) * (g.value.flipV ? -1 : 1) + ")rotate(" + (g.value.rotate || 0) + "deg)";
|
|
451
451
|
}
|
|
452
452
|
function Y() {
|
|
453
|
-
|
|
453
|
+
C.value = !1, L.value = null, I.value = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=", y = {
|
|
454
454
|
active: !1,
|
|
455
455
|
type: null,
|
|
456
456
|
position: null,
|
|
@@ -460,33 +460,33 @@ function ze(e, i) {
|
|
|
460
460
|
y2: 0,
|
|
461
461
|
clientX: 0,
|
|
462
462
|
clientY: 0
|
|
463
|
-
},
|
|
463
|
+
}, z.value = {
|
|
464
464
|
width: 0,
|
|
465
465
|
height: 0
|
|
466
466
|
}, f = {
|
|
467
467
|
width: 0,
|
|
468
468
|
height: 0
|
|
469
|
-
},
|
|
469
|
+
}, b = {
|
|
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 +=
|
|
477
|
+
function Pe() {
|
|
478
|
+
if (M.value += N.rotate, T.value && f.width && f.height) {
|
|
479
479
|
if (M.value % 2) {
|
|
480
|
-
const c = f.width * s.value,
|
|
480
|
+
const c = f.width * s.value, k = f.height / s.value;
|
|
481
481
|
return {
|
|
482
482
|
width: Math.max(f.height, c),
|
|
483
|
-
height: Math.max(f.width,
|
|
483
|
+
height: Math.max(f.width, k)
|
|
484
484
|
};
|
|
485
485
|
}
|
|
486
|
-
const a = f.height * s.value,
|
|
486
|
+
const a = f.height * s.value, n = 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, n)
|
|
490
490
|
};
|
|
491
491
|
}
|
|
492
492
|
return M.value % 2 ? {
|
|
@@ -497,198 +497,198 @@ function ze(e, i) {
|
|
|
497
497
|
height: f.height
|
|
498
498
|
};
|
|
499
499
|
}
|
|
500
|
-
function
|
|
501
|
-
M.value +=
|
|
502
|
-
const a =
|
|
503
|
-
a.width && a.height && (
|
|
504
|
-
const c =
|
|
505
|
-
return f.width && f.height &&
|
|
506
|
-
}
|
|
507
|
-
function
|
|
508
|
-
return new Promise((
|
|
509
|
-
ee = a,
|
|
510
|
-
var c,
|
|
511
|
-
|
|
512
|
-
},
|
|
500
|
+
function Re() {
|
|
501
|
+
M.value += N.rotate;
|
|
502
|
+
const a = Pe(), n = document.createElement("canvas");
|
|
503
|
+
a.width && a.height && (n.width = a.width, n.height = a.height);
|
|
504
|
+
const c = n.getContext("2d");
|
|
505
|
+
return f.width && f.height && E && (c == null || c.setTransform(N.flip ? -1 : 1, 0, 0, 1, n.width / 2, n.height / 2), c == null || c.rotate(Math.PI * (M.value / 2)), c == null || c.drawImage(E, -f.width / 2, -f.height / 2)), n.toDataURL();
|
|
506
|
+
}
|
|
507
|
+
function He(a) {
|
|
508
|
+
return new Promise((n) => {
|
|
509
|
+
ee = a, I.value = a, L.value = new Image(), L.value.onload = () => {
|
|
510
|
+
var c, k;
|
|
511
|
+
b.width = (c = L.value) == null ? void 0 : c.naturalWidth, b.height = (k = L.value) == null ? void 0 : k.naturalHeight, n();
|
|
512
|
+
}, L.value.src = ee;
|
|
513
513
|
});
|
|
514
514
|
}
|
|
515
|
-
function
|
|
516
|
-
if (!
|
|
515
|
+
function de() {
|
|
516
|
+
if (!E || !E.complete || !N)
|
|
517
517
|
return Promise.reject(new Error("No image loaded"));
|
|
518
|
-
const a =
|
|
519
|
-
return
|
|
518
|
+
const a = Re();
|
|
519
|
+
return He(a);
|
|
520
520
|
}
|
|
521
|
-
function
|
|
522
|
-
const
|
|
521
|
+
function ne(a) {
|
|
522
|
+
const n = (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
|
-
}),
|
|
528
|
+
}), x.value = !1, H = !0, i.emit("loadImageFailed"), E = null, B.value = "";
|
|
529
529
|
};
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
}).catch(
|
|
534
|
-
},
|
|
535
|
-
}
|
|
536
|
-
function
|
|
537
|
-
|
|
530
|
+
E = new Image(), E.onload = () => {
|
|
531
|
+
B.value = a, N = m(a), f.width = E == null ? void 0 : E.naturalWidth, f.height = E == null ? void 0 : E.naturalHeight, de().then(() => {
|
|
532
|
+
H = !1;
|
|
533
|
+
}).catch(n);
|
|
534
|
+
}, E.onerror = n, E.src = a;
|
|
535
|
+
}
|
|
536
|
+
function $e(a, n) {
|
|
537
|
+
Le(n) ? (H = !1, ne(a)) : (o.show({
|
|
538
538
|
showCloseButton: !1,
|
|
539
539
|
timeout: 3e3,
|
|
540
540
|
animate: "fadeIn",
|
|
541
541
|
toasts: [{ type: "string", title: "提示", msg: "图片类型不正确,请重试" }]
|
|
542
|
-
}),
|
|
542
|
+
}), x.value = !1, H = !0, i.emit("loadImageFailed"));
|
|
543
543
|
}
|
|
544
|
-
function
|
|
545
|
-
const
|
|
546
|
-
|
|
544
|
+
function me(a) {
|
|
545
|
+
const n = new FileReader();
|
|
546
|
+
n.onload = (c) => $e(c.target.result, a.type), n.readAsDataURL(a);
|
|
547
547
|
}
|
|
548
|
-
function
|
|
549
|
-
const
|
|
550
|
-
|
|
548
|
+
function pe(a) {
|
|
549
|
+
const n = new Image();
|
|
550
|
+
n.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
|
-
}),
|
|
557
|
-
},
|
|
558
|
-
|
|
559
|
-
const c = document.createElement("canvas"),
|
|
560
|
-
c.width =
|
|
561
|
-
},
|
|
556
|
+
}), x.value = !1, H = !0, i.emit("loadImageFailed");
|
|
557
|
+
}, n.onload = () => {
|
|
558
|
+
H = !1;
|
|
559
|
+
const c = document.createElement("canvas"), k = c.getContext("2d");
|
|
560
|
+
c.width = n.width, c.height = n.height, k == null || k.drawImage(n, 0, 0), ne(c.toDataURL());
|
|
561
|
+
}, n.crossOrigin = "anonymous", n.src = a;
|
|
562
562
|
}
|
|
563
|
-
function
|
|
564
|
-
return
|
|
563
|
+
function Ue() {
|
|
564
|
+
return U.value && U.value && U.value.offsetWidth > 0;
|
|
565
565
|
}
|
|
566
566
|
function ue() {
|
|
567
|
-
if (
|
|
568
|
-
const a =
|
|
569
|
-
|
|
567
|
+
if (U.value) {
|
|
568
|
+
const a = U.value;
|
|
569
|
+
z.value.width = a.offsetWidth, z.value.height = a.offsetHeight, J.value = "calc(50% - " + z.value.width / 2 + "px)";
|
|
570
570
|
}
|
|
571
571
|
}
|
|
572
|
-
function
|
|
573
|
-
|
|
572
|
+
function _e() {
|
|
573
|
+
L.value && z.value.width && (_ = h.value > 0 ? Math.max(20, h.value / L.value.width * z.value.width) : 20);
|
|
574
574
|
}
|
|
575
575
|
function Ie() {
|
|
576
|
-
w.value ?
|
|
576
|
+
w.value ? j = Math.max(20, _ / s.value) : S.value > 0 && L.value && z.value.height ? j = Math.max(20, S.value / L.value.height * z.value.height) : j = 20;
|
|
577
577
|
}
|
|
578
578
|
function re() {
|
|
579
|
-
|
|
579
|
+
L.value ? (_e(), Ie()) : (_ = 20, j = 20);
|
|
580
580
|
}
|
|
581
|
-
function
|
|
582
|
-
const a =
|
|
583
|
-
if (a &&
|
|
584
|
-
const c =
|
|
585
|
-
|
|
581
|
+
function je() {
|
|
582
|
+
const a = U.value, n = v({ x1: 0, x2: 0, y1: 0, y2: 0 });
|
|
583
|
+
if (a && b.width && b.height) {
|
|
584
|
+
const c = b.width / a.offsetWidth;
|
|
585
|
+
n.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
|
+
}, 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
591
|
}
|
|
592
|
-
return
|
|
592
|
+
return n.value;
|
|
593
593
|
}
|
|
594
594
|
function Ne() {
|
|
595
|
-
M.value +=
|
|
596
|
-
const a =
|
|
597
|
-
if (a &&
|
|
598
|
-
const c =
|
|
599
|
-
let
|
|
600
|
-
M.value % 2 ? (
|
|
601
|
-
x1: Math.round(t.value.x1 * c) -
|
|
602
|
-
y1: Math.round(t.value.y1 * c) -
|
|
603
|
-
x2: Math.round(t.value.x2 * c) -
|
|
604
|
-
y2: Math.round(t.value.y2 * c) -
|
|
605
|
-
},
|
|
595
|
+
M.value += N.rotate;
|
|
596
|
+
const a = U.value, n = v({ x1: 0, x2: 0, y1: 0, y2: 0 });
|
|
597
|
+
if (a && b.height && b.width && f.height && f.width) {
|
|
598
|
+
const c = b.width / a.offsetWidth;
|
|
599
|
+
let k, $;
|
|
600
|
+
M.value % 2 ? (k = (b.width - f.height) / 2, $ = (b.height - f.width) / 2) : (k = (b.width - f.width) / 2, $ = (b.height - f.height) / 2), n.value = {
|
|
601
|
+
x1: Math.round(t.value.x1 * c) - k,
|
|
602
|
+
y1: Math.round(t.value.y1 * c) - $,
|
|
603
|
+
x2: Math.round(t.value.x2 * c) - k,
|
|
604
|
+
y2: Math.round(t.value.y2 * c) - $
|
|
605
|
+
}, 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
606
|
}
|
|
607
|
-
return
|
|
608
|
-
}
|
|
609
|
-
function
|
|
610
|
-
if (
|
|
611
|
-
if (!u.value || a >
|
|
612
|
-
return
|
|
613
|
-
} else if (R.value > 0 && (!u.value ||
|
|
614
|
-
return R.value /
|
|
607
|
+
return n.value;
|
|
608
|
+
}
|
|
609
|
+
function Oe(a, n) {
|
|
610
|
+
if (l.value > 0) {
|
|
611
|
+
if (!u.value || a > l.value)
|
|
612
|
+
return l.value / a;
|
|
613
|
+
} else if (R.value > 0 && (!u.value || n > R.value))
|
|
614
|
+
return R.value / n;
|
|
615
615
|
return 1;
|
|
616
616
|
}
|
|
617
617
|
function Ve() {
|
|
618
|
-
return Math.min(1, Math.max(0,
|
|
619
|
-
}
|
|
620
|
-
function
|
|
621
|
-
return a.toDataURL("image/" +
|
|
622
|
-
}
|
|
623
|
-
function
|
|
624
|
-
if (
|
|
625
|
-
const a =
|
|
626
|
-
|
|
627
|
-
const
|
|
628
|
-
if (
|
|
629
|
-
|
|
630
|
-
const
|
|
631
|
-
|
|
632
|
-
const
|
|
633
|
-
width:
|
|
618
|
+
return Math.min(1, Math.max(0, W.value / 100));
|
|
619
|
+
}
|
|
620
|
+
function Fe(a) {
|
|
621
|
+
return a.toDataURL("image/" + P.value, Ve());
|
|
622
|
+
}
|
|
623
|
+
function qe() {
|
|
624
|
+
if (U.value && U.value && L.value != null) {
|
|
625
|
+
const a = je(), n = a.x2 - a.x1, c = a.y2 - a.y1, k = document.createElement("canvas");
|
|
626
|
+
k.width = n, k.height = c;
|
|
627
|
+
const $ = k.getContext("2d");
|
|
628
|
+
if ($) {
|
|
629
|
+
d.value != null && ($.fillStyle = d.value, $.fillRect(0, 0, n, c));
|
|
630
|
+
const G = (g.value.scale || 1) * (g.value.flipH ? -1 : 1), Z = (g.value.scale || 1) * (g.value.flipV ? -1 : 1);
|
|
631
|
+
b.width && b.height && ($.setTransform(G, 0, 0, Z, b.width / 2, b.height / 2), $.translate(-a.x1 / G, -a.y1 / Z), $.rotate((g.value.rotate || 0) * Math.PI / 180), $.drawImage(L.value, -b.width / 2, -b.height / 2));
|
|
632
|
+
const F = {
|
|
633
|
+
width: n,
|
|
634
634
|
height: c,
|
|
635
635
|
imagePosition: a,
|
|
636
636
|
cropperPosition: { ...t.value }
|
|
637
637
|
};
|
|
638
|
-
|
|
639
|
-
const X =
|
|
640
|
-
return X !== 1 && (
|
|
638
|
+
T.value && (F.offsetImagePosition = Ne());
|
|
639
|
+
const X = Oe(n, c);
|
|
640
|
+
return X !== 1 && (F.width = Math.round(n * X), F.height = w.value ? Math.round(F.width / s.value) : Math.round(c * X), r(k, F.width, F.height)), F.base64 = Fe(k), i.emit("imageCropped", F), F;
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
643
|
return null;
|
|
644
644
|
}
|
|
645
645
|
function te() {
|
|
646
|
-
|
|
646
|
+
p.value && qe();
|
|
647
647
|
}
|
|
648
|
-
function
|
|
649
|
-
const a =
|
|
648
|
+
function ye() {
|
|
649
|
+
const a = U.value;
|
|
650
650
|
if (a) {
|
|
651
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 n = a.offsetWidth / s.value;
|
|
656
|
+
t.value.y1 = (a.offsetHeight - n) / 2, t.value.y2 = t.value.y1 + n;
|
|
657
657
|
} else {
|
|
658
658
|
t.value.y1 = 0, t.value.y2 = a.offsetHeight;
|
|
659
|
-
const
|
|
660
|
-
t.value.x1 = (a.offsetWidth -
|
|
659
|
+
const n = a.offsetHeight * s.value;
|
|
660
|
+
t.value.x1 = (a.offsetWidth - n) / 2, t.value.x2 = t.value.x1 + n;
|
|
661
661
|
}
|
|
662
|
-
te(),
|
|
662
|
+
te(), C.value = !0;
|
|
663
663
|
}
|
|
664
664
|
}
|
|
665
|
-
function
|
|
666
|
-
|
|
665
|
+
function xe() {
|
|
666
|
+
V > 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
|
-
P.value != null && (k.value = !1, i.emit("imageLoaded"), B = 0, setTimeout(() => be()));
|
|
671
|
+
}), H = !0, x.value = !1, i.emit("loadImageFailed")) : Ue() ? (H = !1, ue(), re(), ye(), i.emit("cropperReady", { ...z.value })) : (V++, setTimeout(() => xe(), 50));
|
|
675
672
|
}
|
|
676
673
|
function Qe() {
|
|
677
|
-
|
|
678
|
-
|
|
674
|
+
L.value != null && (x.value = !1, i.emit("imageLoaded"), V = 0, setTimeout(() => xe()));
|
|
675
|
+
}
|
|
676
|
+
function Ge() {
|
|
677
|
+
const a = U.value;
|
|
678
|
+
(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
679
|
}
|
|
680
680
|
const Je = () => {
|
|
681
|
-
|
|
682
|
-
},
|
|
683
|
-
clearTimeout(
|
|
681
|
+
Ge(), ue(), re();
|
|
682
|
+
}, be = () => {
|
|
683
|
+
clearTimeout(D), D = setTimeout(Je, 300);
|
|
684
684
|
};
|
|
685
|
-
|
|
686
|
-
window.addEventListener("resize",
|
|
685
|
+
Ae(() => {
|
|
686
|
+
window.addEventListener("resize", be), le.value && (Y(), x.value = !0, pe(le.value));
|
|
687
687
|
}), nt(() => {
|
|
688
|
-
window.removeEventListener("resize",
|
|
688
|
+
window.removeEventListener("resize", be);
|
|
689
689
|
});
|
|
690
|
-
function
|
|
691
|
-
|
|
690
|
+
function Ze() {
|
|
691
|
+
y.active && (y.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, n, c = null) {
|
|
700
|
+
y && y.active || (a.preventDefault && a.preventDefault(), y = {
|
|
701
701
|
active: !0,
|
|
702
|
-
type:
|
|
702
|
+
type: n,
|
|
703
703
|
position: c,
|
|
704
704
|
clientX: se(a),
|
|
705
705
|
clientY: oe(a),
|
|
@@ -707,65 +707,65 @@ function ze(e, i) {
|
|
|
707
707
|
});
|
|
708
708
|
}
|
|
709
709
|
function ce(a = !1) {
|
|
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 >
|
|
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 > 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
711
|
}
|
|
712
|
-
function
|
|
713
|
-
const
|
|
714
|
-
t.value.x1 =
|
|
712
|
+
function Xe(a) {
|
|
713
|
+
const n = se(a) - y.clientX, c = oe(a) - y.clientY;
|
|
714
|
+
t.value.x1 = y.x1 + n, t.value.y1 = y.y1 + c, t.value.x2 = y.x2 + n, t.value.y2 = y.y2 + c;
|
|
715
715
|
}
|
|
716
|
-
const { checkAspectRatio:
|
|
717
|
-
function
|
|
718
|
-
const
|
|
719
|
-
switch (
|
|
716
|
+
const { checkAspectRatio: Ke } = Bt(t, z, s, y);
|
|
717
|
+
function et(a) {
|
|
718
|
+
const n = se(a) - y.clientX, c = oe(a) - y.clientY;
|
|
719
|
+
switch (y.position) {
|
|
720
720
|
case "left":
|
|
721
|
-
t.value.x1 = Math.min(
|
|
721
|
+
t.value.x1 = Math.min(y.x1 + n, t.value.x2 - _);
|
|
722
722
|
break;
|
|
723
723
|
case "topleft":
|
|
724
|
-
t.value.x1 = Math.min(
|
|
724
|
+
t.value.x1 = Math.min(y.x1 + n, t.value.x2 - _), t.value.y1 = Math.min(y.y1 + c, t.value.y2 - j);
|
|
725
725
|
break;
|
|
726
726
|
case "top":
|
|
727
|
-
t.value.y1 = Math.min(
|
|
727
|
+
t.value.y1 = Math.min(y.y1 + c, t.value.y2 - j);
|
|
728
728
|
break;
|
|
729
729
|
case "topright":
|
|
730
|
-
t.value.x2 = Math.max(
|
|
730
|
+
t.value.x2 = Math.max(y.x2 + n, t.value.x1 + _), t.value.y1 = Math.min(y.y1 + c, t.value.y2 - j);
|
|
731
731
|
break;
|
|
732
732
|
case "right":
|
|
733
|
-
t.value.x2 = Math.max(
|
|
733
|
+
t.value.x2 = Math.max(y.x2 + n, t.value.x1 + _);
|
|
734
734
|
break;
|
|
735
735
|
case "bottomright":
|
|
736
|
-
t.value.x2 = Math.max(
|
|
736
|
+
t.value.x2 = Math.max(y.x2 + n, t.value.x1 + _), t.value.y2 = Math.max(y.y2 + c, t.value.y1 + j);
|
|
737
737
|
break;
|
|
738
738
|
case "bottom":
|
|
739
|
-
t.value.y2 = Math.max(
|
|
739
|
+
t.value.y2 = Math.max(y.y2 + c, t.value.y1 + j);
|
|
740
740
|
break;
|
|
741
741
|
case "bottomleft":
|
|
742
|
-
t.value.x1 = Math.min(
|
|
742
|
+
t.value.x1 = Math.min(y.x1 + n, t.value.x2 - _), t.value.y2 = Math.max(y.y2 + c, t.value.y1 + j);
|
|
743
743
|
break;
|
|
744
744
|
case "center":
|
|
745
|
-
const { scale:
|
|
746
|
-
t.value.x1 = Math.min(
|
|
745
|
+
const { scale: k } = a, $ = Math.abs(y.x2 - y.x1) * k, G = Math.abs(y.y2 - y.y1) * k, { x1: Z } = t.value, { y1: F } = t.value;
|
|
746
|
+
t.value.x1 = Math.min(y.clientX - $ / 2, t.value.x2 - _), t.value.y1 = Math.min(y.clientY - G / 2, t.value.y2 - j), t.value.x2 = Math.max(y.clientX + $ / 2, Z + _), t.value.y2 = Math.max(y.clientY + G / 2, F + j);
|
|
747
747
|
break;
|
|
748
748
|
}
|
|
749
|
-
w.value &&
|
|
749
|
+
w.value && Ke();
|
|
750
750
|
}
|
|
751
|
-
function
|
|
752
|
-
|
|
753
|
-
|
|
751
|
+
function tt(a) {
|
|
752
|
+
y && y.active && (a.stopPropagation && a.stopPropagation(), a.preventDefault && a.preventDefault(), clearTimeout(Q), Q = setTimeout(() => {
|
|
753
|
+
y.type === ae.Move ? (Xe(a), ce(!0)) : y.type === ae.Resize && (et(a), ce(!1));
|
|
754
754
|
}, 300));
|
|
755
755
|
}
|
|
756
|
-
return K(
|
|
757
|
-
Y(), a && a.target && a.target.files && a.target.files.length > 0 && (
|
|
758
|
-
}), K(
|
|
759
|
-
a ? (Y(),
|
|
756
|
+
return K(ge, (a) => {
|
|
757
|
+
Y(), a && a.target && a.target.files && a.target.files.length > 0 && (x.value = !0, me(a.target.files[0]));
|
|
758
|
+
}), K(le, (a) => {
|
|
759
|
+
a ? (Y(), x.value = !0, pe(a)) : (o.show({
|
|
760
760
|
showCloseButton: !1,
|
|
761
761
|
timeout: 3e3,
|
|
762
762
|
animate: "fadeIn",
|
|
763
763
|
toasts: [{ type: "string", title: "提示", msg: "图片路径为空" }]
|
|
764
|
-
}),
|
|
765
|
-
}), K(
|
|
766
|
-
Y(),
|
|
767
|
-
}), K(
|
|
768
|
-
Y(), a && (
|
|
764
|
+
}), x.value = !1, H = !0);
|
|
765
|
+
}), K(Se, (a) => {
|
|
766
|
+
Y(), x.value = !0, ne(a);
|
|
767
|
+
}), K(Be, (a) => {
|
|
768
|
+
Y(), a && (x.value = !0, me(a));
|
|
769
769
|
}), K(
|
|
770
770
|
() => [
|
|
771
771
|
e.containWithinAspectRatio,
|
|
@@ -775,108 +775,108 @@ function ze(e, i) {
|
|
|
775
775
|
e.transform,
|
|
776
776
|
e.imageChangedEvent
|
|
777
777
|
],
|
|
778
|
-
([a,
|
|
779
|
-
|
|
778
|
+
([a, n, c, k, $, G], [Z, F, X, at, it, lt]) => {
|
|
779
|
+
E && E.complete && N && (a !== Z || n !== F) && de(), c !== X && (ue(), re(), ce(!1), te()), k !== at && C.value && ye(), $ !== it && (We(), te()), G !== lt && (ge.value = G);
|
|
780
780
|
}
|
|
781
781
|
), {
|
|
782
|
-
uploadError:
|
|
783
|
-
imageVisible:
|
|
784
|
-
backgroundColor:
|
|
785
|
-
sourceImage:
|
|
786
|
-
safeImgDataUrl:
|
|
787
|
-
safeTransformStyle:
|
|
788
|
-
maxSize:
|
|
782
|
+
uploadError: H,
|
|
783
|
+
imageVisible: C,
|
|
784
|
+
backgroundColor: d,
|
|
785
|
+
sourceImage: U,
|
|
786
|
+
safeImgDataUrl: I,
|
|
787
|
+
safeTransformStyle: q,
|
|
788
|
+
maxSize: z,
|
|
789
789
|
cropper: t,
|
|
790
|
-
marginLeft:
|
|
790
|
+
marginLeft: J,
|
|
791
791
|
moveTypes: ie,
|
|
792
|
-
isLoading:
|
|
793
|
-
startMove:
|
|
794
|
-
imageLoadedInView:
|
|
795
|
-
moveStop:
|
|
796
|
-
moveImg:
|
|
792
|
+
isLoading: x,
|
|
793
|
+
startMove: Ye,
|
|
794
|
+
imageLoadedInView: Qe,
|
|
795
|
+
moveStop: Ze,
|
|
796
|
+
moveImg: tt
|
|
797
797
|
};
|
|
798
798
|
}
|
|
799
799
|
const fe = /* @__PURE__ */ Ce({
|
|
800
800
|
name: "FImageCropper",
|
|
801
|
-
props:
|
|
801
|
+
props: he,
|
|
802
802
|
emits: ["imageCropped", "imageLoaded", "cropperReady", "loadImageFailed"],
|
|
803
803
|
setup(e, i) {
|
|
804
|
-
const r = v(e.alignImage),
|
|
804
|
+
const r = v(e.alignImage), m = v(e.roundCropper), o = v(e.hideResizeSquares), t = v(e.loadImageErrorText), g = v(e.disabled), h = v(null), {
|
|
805
805
|
uploadError: w,
|
|
806
806
|
imageVisible: s,
|
|
807
|
-
backgroundColor:
|
|
808
|
-
sourceImage:
|
|
809
|
-
safeImgDataUrl:
|
|
807
|
+
backgroundColor: p,
|
|
808
|
+
sourceImage: d,
|
|
809
|
+
safeImgDataUrl: l,
|
|
810
810
|
safeTransformStyle: u,
|
|
811
|
-
maxSize:
|
|
811
|
+
maxSize: T,
|
|
812
812
|
cropper: M,
|
|
813
|
-
marginLeft:
|
|
814
|
-
moveTypes:
|
|
813
|
+
marginLeft: P,
|
|
814
|
+
moveTypes: W,
|
|
815
815
|
isLoading: R,
|
|
816
|
-
startMove:
|
|
817
|
-
imageLoadedInView:
|
|
818
|
-
moveStop:
|
|
819
|
-
moveImg:
|
|
820
|
-
} =
|
|
821
|
-
function f(
|
|
822
|
-
return
|
|
823
|
-
class: `farris-image-cropper-resize-bar ${
|
|
824
|
-
onMousedown:
|
|
816
|
+
startMove: S,
|
|
817
|
+
imageLoadedInView: I,
|
|
818
|
+
moveStop: x,
|
|
819
|
+
moveImg: C
|
|
820
|
+
} = De(e, i);
|
|
821
|
+
function f(D) {
|
|
822
|
+
return A("span", {
|
|
823
|
+
class: `farris-image-cropper-resize-bar ${D}`,
|
|
824
|
+
onMousedown: O((E) => S(E, W.Resize, D), ["prevent"])
|
|
825
825
|
}, null);
|
|
826
826
|
}
|
|
827
|
-
function
|
|
828
|
-
return
|
|
829
|
-
class: `farris-image-cropper-resize-bar ${
|
|
830
|
-
onMousedown:
|
|
831
|
-
}, [
|
|
827
|
+
function b(D) {
|
|
828
|
+
return A("div", null, [A("span", {
|
|
829
|
+
class: `farris-image-cropper-resize-bar ${D}`,
|
|
830
|
+
onMousedown: O((E) => S(E, W.Resize, D), ["prevent"])
|
|
831
|
+
}, [A("span", {
|
|
832
832
|
class: "farris-image-cropper-square"
|
|
833
|
-
}, null)]),
|
|
833
|
+
}, null)]), A("span", {
|
|
834
834
|
class: "farris-image-cropper-resize top"
|
|
835
|
-
}, [
|
|
835
|
+
}, [A("span", {
|
|
836
836
|
class: "farris-image-cropper-square"
|
|
837
837
|
}, null)])]);
|
|
838
838
|
}
|
|
839
|
-
const
|
|
840
|
-
return () =>
|
|
839
|
+
const V = ["top", "right", "bottom", "left"].map((D) => f(D)), Q = ["topleft", "topright", "bottomright", "bottomleft"].map((D) => b(D));
|
|
840
|
+
return () => A("div", {
|
|
841
841
|
class: ["farris-image-cropper-frame", {
|
|
842
|
-
"farris-image-cropper-disabled":
|
|
842
|
+
"farris-image-cropper-disabled": g.value
|
|
843
843
|
}],
|
|
844
844
|
style: {
|
|
845
845
|
"text-align": r.value
|
|
846
846
|
},
|
|
847
|
-
onMousemove:
|
|
848
|
-
onTouchmove:
|
|
849
|
-
onMouseup:
|
|
850
|
-
onTouchend:
|
|
851
|
-
}, [!w &&
|
|
852
|
-
ref:
|
|
847
|
+
onMousemove: O((D) => C(D), ["prevent"]),
|
|
848
|
+
onTouchmove: O((D) => C(D), ["prevent"]),
|
|
849
|
+
onMouseup: O(() => x(), ["prevent"]),
|
|
850
|
+
onTouchend: O(() => x(), ["prevent"])
|
|
851
|
+
}, [!w && A("div", {
|
|
852
|
+
ref: h,
|
|
853
853
|
class: "farris-image-cropper",
|
|
854
854
|
style: [{
|
|
855
|
-
background: s.value ?
|
|
855
|
+
background: s.value ? p.value : ""
|
|
856
856
|
}]
|
|
857
|
-
}, [
|
|
857
|
+
}, [l.value && A("img", {
|
|
858
858
|
title: "farris-source-image",
|
|
859
|
-
ref:
|
|
859
|
+
ref: d,
|
|
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:
|
|
867
|
-
onLoad: () =>
|
|
868
|
-
}, null),
|
|
866
|
+
src: l.value,
|
|
867
|
+
onLoad: () => I()
|
|
868
|
+
}, null), T.value && A("div", {
|
|
869
869
|
class: "farris-image-overlay",
|
|
870
870
|
style: [{
|
|
871
|
-
width: `${
|
|
871
|
+
width: `${T.value.width || 0}px`
|
|
872
872
|
}, {
|
|
873
|
-
height: `${
|
|
873
|
+
height: `${T.value.height || 0}px`
|
|
874
874
|
}, {
|
|
875
|
-
"margin-left": r.value === "center" ?
|
|
875
|
+
"margin-left": r.value === "center" ? P.value : ""
|
|
876
876
|
}]
|
|
877
|
-
}, null), s.value &&
|
|
877
|
+
}, null), s.value && A("div", {
|
|
878
878
|
class: ["farris-image-cropper-wrapper", {
|
|
879
|
-
"farris-image-cropper-rounded":
|
|
879
|
+
"farris-image-cropper-rounded": m.value
|
|
880
880
|
}],
|
|
881
881
|
style: [{
|
|
882
882
|
top: `${M.value.y1}px`
|
|
@@ -889,27 +889,27 @@ const fe = /* @__PURE__ */ Ce({
|
|
|
889
889
|
}, {
|
|
890
890
|
visibility: s.value ? "visible" : "hidden"
|
|
891
891
|
}, {
|
|
892
|
-
"margin-left": r.value === "center" ?
|
|
892
|
+
"margin-left": r.value === "center" ? P.value : ""
|
|
893
893
|
}],
|
|
894
894
|
tabindex: "0"
|
|
895
|
-
}, [
|
|
895
|
+
}, [A("div", {
|
|
896
896
|
class: "farris-image-cropper-move",
|
|
897
|
-
onMousedown:
|
|
898
|
-
}, null), !o.value &&
|
|
897
|
+
onMousedown: O((D) => S(D, W.Move, "topleft"), ["prevent"])
|
|
898
|
+
}, null), !o.value && A("div", null, [Q, V])])]), R.value && A("div", {
|
|
899
899
|
class: "farris-image-cropper-loading"
|
|
900
|
-
}, [
|
|
900
|
+
}, [A("div", {
|
|
901
901
|
class: "farris-image-cropper-loading-spinner"
|
|
902
|
-
}, null)]), w &&
|
|
902
|
+
}, null)]), w && A("div", {
|
|
903
903
|
class: "farris-image-cropper-error"
|
|
904
904
|
}, [t.value])]);
|
|
905
905
|
}
|
|
906
906
|
});
|
|
907
|
-
function
|
|
908
|
-
var
|
|
909
|
-
function
|
|
907
|
+
function Wt(e, i, r) {
|
|
908
|
+
var I;
|
|
909
|
+
function m() {
|
|
910
910
|
}
|
|
911
|
-
const o = "", t = "",
|
|
912
|
-
function
|
|
911
|
+
const o = "", t = "", g = v();
|
|
912
|
+
function h() {
|
|
913
913
|
return (i == null ? void 0 : i.schema.componentType) !== "frame";
|
|
914
914
|
}
|
|
915
915
|
function w() {
|
|
@@ -918,159 +918,151 @@ function Bt(e, i, r) {
|
|
|
918
918
|
function s() {
|
|
919
919
|
return (i == null ? void 0 : i.schema.componentType) !== "frame";
|
|
920
920
|
}
|
|
921
|
-
function
|
|
921
|
+
function p() {
|
|
922
922
|
return (i == null ? void 0 : i.schema.componentType) === "frame";
|
|
923
923
|
}
|
|
924
|
-
function
|
|
925
|
-
if (!
|
|
924
|
+
function d(x) {
|
|
925
|
+
if (!x || !x.value)
|
|
926
926
|
return null;
|
|
927
|
-
if (
|
|
928
|
-
return
|
|
929
|
-
const
|
|
930
|
-
return
|
|
927
|
+
if (x.value.schema && x.value.schema.type === "component")
|
|
928
|
+
return x.value;
|
|
929
|
+
const C = v(x == null ? void 0 : x.value.parent), f = d(C);
|
|
930
|
+
return f || null;
|
|
931
931
|
}
|
|
932
|
-
function
|
|
933
|
-
const { componentInstance:
|
|
934
|
-
return !
|
|
932
|
+
function l(x = i) {
|
|
933
|
+
const { componentInstance: C, designerItemElementRef: f } = x;
|
|
934
|
+
return !C || !C.value ? null : C.value.canMove ? f : l(x.parent);
|
|
935
935
|
}
|
|
936
|
-
function u(
|
|
936
|
+
function u(x) {
|
|
937
937
|
return !!r;
|
|
938
938
|
}
|
|
939
|
-
function
|
|
939
|
+
function T() {
|
|
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
|
|
945
|
-
}
|
|
946
|
-
function L(p, f) {
|
|
947
|
-
const { componentType: d } = p;
|
|
948
|
-
let B = ve(d, p, f);
|
|
949
|
-
const V = d.toLowerCase().replace("-", "_");
|
|
950
|
-
return B && !B.id && B.type === d && (B.id = `${V}_${Math.random().toString().slice(2, 6)}`), B;
|
|
944
|
+
function P(x, C) {
|
|
951
945
|
}
|
|
952
|
-
function
|
|
953
|
-
const
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
return C && !C.id && C.type === d && (C.id = `${S}_${Math.random().toString().slice(2, 6)}`), C;
|
|
946
|
+
function W(x, C) {
|
|
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;
|
|
958
951
|
}
|
|
959
|
-
function
|
|
952
|
+
function R(x) {
|
|
960
953
|
}
|
|
961
|
-
function
|
|
954
|
+
function S(...x) {
|
|
962
955
|
}
|
|
963
|
-
return
|
|
964
|
-
canMove:
|
|
956
|
+
return g.value = {
|
|
957
|
+
canMove: h(),
|
|
965
958
|
canSelectParent: w(),
|
|
966
959
|
canDelete: s(),
|
|
967
|
-
canNested: !
|
|
960
|
+
canNested: !p(),
|
|
968
961
|
contents: i == null ? void 0 : i.schema.contents,
|
|
969
962
|
elementRef: e,
|
|
970
|
-
parent: (
|
|
963
|
+
parent: (I = i == null ? void 0 : i.parent) == null ? void 0 : I.componentInstance,
|
|
971
964
|
schema: i == null ? void 0 : i.schema,
|
|
972
965
|
styles: o,
|
|
973
966
|
designerClass: t,
|
|
974
967
|
canAccepts: u,
|
|
975
|
-
getBelongedComponentInstance:
|
|
976
|
-
getDraggableDesignItemElement:
|
|
977
|
-
getDraggingDisplayText:
|
|
978
|
-
getPropConfig:
|
|
968
|
+
getBelongedComponentInstance: d,
|
|
969
|
+
getDraggableDesignItemElement: l,
|
|
970
|
+
getDraggingDisplayText: T,
|
|
971
|
+
getPropConfig: S,
|
|
979
972
|
getDragScopeElement: M,
|
|
980
|
-
onAcceptMovedChildElement:
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
updateDragAndDropRules: y,
|
|
973
|
+
onAcceptMovedChildElement: P,
|
|
974
|
+
onChildElementMovedOut: R,
|
|
975
|
+
addNewChildComponentSchema: W,
|
|
976
|
+
updateDragAndDropRules: m,
|
|
985
977
|
triggerBelongedComponentToMoveWhenMoved: v(!1),
|
|
986
978
|
triggerBelongedComponentToDeleteWhenDeleted: v(!1)
|
|
987
|
-
},
|
|
979
|
+
}, g;
|
|
988
980
|
}
|
|
989
|
-
const
|
|
981
|
+
const Lt = /* @__PURE__ */ Ce({
|
|
990
982
|
name: "FImageCropperDesign",
|
|
991
|
-
props:
|
|
983
|
+
props: he,
|
|
992
984
|
emits: ["imageCropped", "imageLoaded", "cropperReady", "loadImageFailed"],
|
|
993
985
|
setup(e, i) {
|
|
994
|
-
const r = v(e.alignImage),
|
|
986
|
+
const r = v(e.alignImage), m = v(e.roundCropper), o = v(e.hideResizeSquares), t = v(e.loadImageErrorText), g = v(e.disabled), h = v(null), {
|
|
995
987
|
uploadError: w,
|
|
996
988
|
imageVisible: s,
|
|
997
|
-
backgroundColor:
|
|
998
|
-
sourceImage:
|
|
999
|
-
safeImgDataUrl:
|
|
989
|
+
backgroundColor: p,
|
|
990
|
+
sourceImage: d,
|
|
991
|
+
safeImgDataUrl: l,
|
|
1000
992
|
safeTransformStyle: u,
|
|
1001
|
-
maxSize:
|
|
993
|
+
maxSize: T,
|
|
1002
994
|
cropper: M,
|
|
1003
|
-
marginLeft:
|
|
1004
|
-
moveTypes:
|
|
995
|
+
marginLeft: P,
|
|
996
|
+
moveTypes: W,
|
|
1005
997
|
isLoading: R,
|
|
1006
|
-
startMove:
|
|
1007
|
-
imageLoadedInView:
|
|
1008
|
-
moveStop:
|
|
1009
|
-
moveImg:
|
|
1010
|
-
} =
|
|
1011
|
-
|
|
1012
|
-
f.value.componentInstance =
|
|
1013
|
-
}), i.expose(
|
|
1014
|
-
function
|
|
1015
|
-
return
|
|
1016
|
-
class: `farris-image-cropper-resize-bar ${
|
|
1017
|
-
onMousedown:
|
|
998
|
+
startMove: S,
|
|
999
|
+
imageLoadedInView: I,
|
|
1000
|
+
moveStop: x,
|
|
1001
|
+
moveImg: C
|
|
1002
|
+
} = De(e, i), f = v(), b = Te("design-item-context"), V = Wt(f, b);
|
|
1003
|
+
Ae(() => {
|
|
1004
|
+
f.value.componentInstance = V;
|
|
1005
|
+
}), i.expose(V.value);
|
|
1006
|
+
function Q(B) {
|
|
1007
|
+
return A("span", {
|
|
1008
|
+
class: `farris-image-cropper-resize-bar ${B}`,
|
|
1009
|
+
onMousedown: O((q) => S(q, W.Resize, B), ["prevent"])
|
|
1018
1010
|
}, null);
|
|
1019
1011
|
}
|
|
1020
|
-
function
|
|
1021
|
-
return
|
|
1022
|
-
class: `farris-image-cropper-resize-bar ${
|
|
1023
|
-
onMousedown:
|
|
1024
|
-
}, [
|
|
1012
|
+
function D(B) {
|
|
1013
|
+
return A("div", null, [A("span", {
|
|
1014
|
+
class: `farris-image-cropper-resize-bar ${B}`,
|
|
1015
|
+
onMousedown: O((q) => S(q, W.Resize, B), ["prevent"])
|
|
1016
|
+
}, [A("span", {
|
|
1025
1017
|
class: "farris-image-cropper-square"
|
|
1026
|
-
}, null)]),
|
|
1018
|
+
}, null)]), A("span", {
|
|
1027
1019
|
class: "farris-image-cropper-resize top"
|
|
1028
|
-
}, [
|
|
1020
|
+
}, [A("span", {
|
|
1029
1021
|
class: "farris-image-cropper-square"
|
|
1030
1022
|
}, null)])]);
|
|
1031
1023
|
}
|
|
1032
|
-
const
|
|
1033
|
-
return () =>
|
|
1024
|
+
const E = ["top", "right", "bottom", "left"].map((B) => Q(B)), U = ["topleft", "topright", "bottomright", "bottomleft"].map((B) => D(B));
|
|
1025
|
+
return () => A("div", {
|
|
1034
1026
|
ref: f,
|
|
1035
1027
|
class: ["farris-image-cropper-frame", {
|
|
1036
|
-
"farris-image-cropper-disabled":
|
|
1028
|
+
"farris-image-cropper-disabled": g.value
|
|
1037
1029
|
}],
|
|
1038
1030
|
style: {
|
|
1039
1031
|
"text-align": r.value
|
|
1040
1032
|
},
|
|
1041
|
-
onMousemove:
|
|
1042
|
-
onTouchmove:
|
|
1043
|
-
onMouseup:
|
|
1044
|
-
onTouchend:
|
|
1045
|
-
}, [!w &&
|
|
1046
|
-
ref:
|
|
1033
|
+
onMousemove: O((B) => C(B), ["prevent"]),
|
|
1034
|
+
onTouchmove: O((B) => C(B), ["prevent"]),
|
|
1035
|
+
onMouseup: O(() => x(), ["prevent"]),
|
|
1036
|
+
onTouchend: O(() => x(), ["prevent"])
|
|
1037
|
+
}, [!w && A("div", {
|
|
1038
|
+
ref: h,
|
|
1047
1039
|
class: "farris-image-cropper",
|
|
1048
1040
|
style: [{
|
|
1049
|
-
background: s.value ?
|
|
1041
|
+
background: s.value ? p.value : ""
|
|
1050
1042
|
}]
|
|
1051
|
-
}, [
|
|
1043
|
+
}, [l.value && A("img", {
|
|
1052
1044
|
title: "farris-source-image",
|
|
1053
|
-
ref:
|
|
1045
|
+
ref: d,
|
|
1054
1046
|
class: "farris-source-image",
|
|
1055
1047
|
style: [{
|
|
1056
1048
|
visibility: s.value ? "visible" : "hidden"
|
|
1057
1049
|
}, {
|
|
1058
1050
|
transform: u.value
|
|
1059
1051
|
}],
|
|
1060
|
-
src:
|
|
1061
|
-
onLoad: () =>
|
|
1062
|
-
}, null),
|
|
1052
|
+
src: l.value,
|
|
1053
|
+
onLoad: () => I()
|
|
1054
|
+
}, null), T.value && A("div", {
|
|
1063
1055
|
class: "farris-image-overlay",
|
|
1064
1056
|
style: [{
|
|
1065
|
-
width: `${
|
|
1057
|
+
width: `${T.value.width || 0}px`
|
|
1066
1058
|
}, {
|
|
1067
|
-
height: `${
|
|
1059
|
+
height: `${T.value.height || 0}px`
|
|
1068
1060
|
}, {
|
|
1069
|
-
"margin-left": r.value === "center" ?
|
|
1061
|
+
"margin-left": r.value === "center" ? P.value : ""
|
|
1070
1062
|
}]
|
|
1071
|
-
}, null), s.value &&
|
|
1063
|
+
}, null), s.value && A("div", {
|
|
1072
1064
|
class: ["farris-image-cropper-wrapper", {
|
|
1073
|
-
"farris-image-cropper-rounded":
|
|
1065
|
+
"farris-image-cropper-rounded": m.value
|
|
1074
1066
|
}],
|
|
1075
1067
|
style: [{
|
|
1076
1068
|
top: `${M.value.y1}px`
|
|
@@ -1083,34 +1075,34 @@ const Wt = /* @__PURE__ */ Ce({
|
|
|
1083
1075
|
}, {
|
|
1084
1076
|
visibility: s.value ? "visible" : "hidden"
|
|
1085
1077
|
}, {
|
|
1086
|
-
"margin-left": r.value === "center" ?
|
|
1078
|
+
"margin-left": r.value === "center" ? P.value : ""
|
|
1087
1079
|
}],
|
|
1088
1080
|
tabindex: "0"
|
|
1089
|
-
}, [
|
|
1081
|
+
}, [A("div", {
|
|
1090
1082
|
class: "farris-image-cropper-move",
|
|
1091
|
-
onMousedown:
|
|
1092
|
-
}, null), !o.value &&
|
|
1083
|
+
onMousedown: O((B) => S(B, W.Move, "topleft"), ["prevent"])
|
|
1084
|
+
}, null), !o.value && A("div", null, [U, E])])]), R.value && A("div", {
|
|
1093
1085
|
class: "farris-image-cropper-loading"
|
|
1094
|
-
}, [
|
|
1086
|
+
}, [A("div", {
|
|
1095
1087
|
class: "farris-image-cropper-loading-spinner"
|
|
1096
|
-
}, null)]), w &&
|
|
1088
|
+
}, null)]), w && A("div", {
|
|
1097
1089
|
class: "farris-image-cropper-error"
|
|
1098
1090
|
}, [t.value])]);
|
|
1099
1091
|
}
|
|
1100
|
-
}),
|
|
1092
|
+
}), Ht = {
|
|
1101
1093
|
install(e) {
|
|
1102
1094
|
e.component(fe.name, fe);
|
|
1103
1095
|
},
|
|
1104
|
-
register(e, i, r,
|
|
1096
|
+
register(e, i, r, m) {
|
|
1105
1097
|
e["image-cropper"] = fe, i["image-cropper"] = we;
|
|
1106
1098
|
},
|
|
1107
1099
|
registerDesigner(e, i, r) {
|
|
1108
|
-
e["image-cropper"] =
|
|
1100
|
+
e["image-cropper"] = Lt, i["image-cropper"] = we;
|
|
1109
1101
|
}
|
|
1110
1102
|
};
|
|
1111
1103
|
export {
|
|
1112
1104
|
fe as ImageCropper,
|
|
1113
|
-
|
|
1114
|
-
|
|
1105
|
+
Ht as default,
|
|
1106
|
+
he as imageCropperProps,
|
|
1115
1107
|
we as propsResolver
|
|
1116
1108
|
};
|