@hzab/form-render 1.7.18 → 1.7.19
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/CHANGELOG.md +3 -3
- package/LICENSE +21 -0
- package/dist/common/date-utils.d.ts +1 -0
- package/dist/common/event.d.ts +5 -0
- package/dist/common/formily-utils.d.ts +54 -0
- package/dist/common/global-props-context.d.ts +8 -0
- package/dist/common/location-utils.d.ts +6 -0
- package/dist/common/schema-handler.d.ts +90 -0
- package/dist/common/schema-merge.d.ts +12 -0
- package/dist/components/ArrayBase/index.d.ts +75 -0
- package/dist/components/ArrayBase/style.d.ts +2 -0
- package/dist/components/ArrayCards/index.d.ts +13 -0
- package/dist/components/ArrayCards/style.d.ts +4 -0
- package/dist/components/ArrayTable/index.d.ts +51 -0
- package/dist/components/ArrayTable/style.d.ts +7 -0
- package/dist/components/CheckboxWithTip/index.d.ts +15 -0
- package/dist/components/DatePicker/index.d.ts +5 -0
- package/dist/components/LocationListPicker/components/AddrList/index.d.ts +3 -0
- package/dist/components/LocationListPicker/components/Popup/index.d.ts +15 -0
- package/dist/components/LocationListPicker/index.d.ts +3 -0
- package/dist/components/LocationPicker/Map/AMap/common/loader.d.ts +2 -0
- package/dist/components/LocationPicker/Map/AMap/common/utils.d.ts +130 -0
- package/dist/components/LocationPicker/common/utils.d.ts +19 -0
- package/dist/components/LocationPicker/components/ModalContent/index.d.ts +3 -0
- package/dist/components/LocationPicker/components/Notice/index.d.ts +2 -0
- package/dist/components/LocationPicker/components/PickerInfo/index.d.ts +3 -0
- package/dist/components/LocationPicker/components/ResInfo/index.d.ts +8 -0
- package/dist/components/LocationPicker/index.d.ts +3 -0
- package/dist/components/LocationPicker/servers/index.d.ts +21 -0
- package/dist/components/PersonnelSelect/index.d.ts +6 -0
- package/dist/components/PersonnelSelect/type.d.ts +88 -0
- package/dist/components/RadioGroupWithTip/index.d.ts +14 -0
- package/dist/components/RichEditor/components/handleMobileRem/index.d.ts +3 -0
- package/dist/components/RichEditor/components/handleMobileVw/index.d.ts +3 -0
- package/dist/components/RichEditor/index.d.ts +32 -0
- package/dist/components/Text/index.d.ts +9 -0
- package/dist/components/TreeCheckbox/common/utils.d.ts +74 -0
- package/dist/components/TreeCheckbox/components/CheckboxTable/index.d.ts +2 -0
- package/dist/components/TreeCheckbox/components/Render/index.d.ts +2 -0
- package/dist/components/TreeCheckbox/components/TabsRender/index.d.ts +2 -0
- package/dist/components/TreeCheckbox/index.d.ts +3 -0
- package/dist/components/Upload/common/OfflineUpload.d.ts +3 -0
- package/dist/components/Upload/common/checkFileType.d.ts +3 -0
- package/dist/components/Upload/common/customRequest.d.ts +32 -0
- package/dist/components/Upload/common/fileName.d.ts +3 -0
- package/dist/components/Upload/common/handleIOFileList.d.ts +133 -0
- package/dist/components/Upload/common/nanoid.d.ts +2 -0
- package/dist/components/Upload/components/Image/index.d.ts +3 -0
- package/dist/components/Upload/components/ItemList/ItemRender.d.ts +2 -0
- package/dist/components/Upload/components/ItemList/index.d.ts +2 -0
- package/dist/components/Upload/components/PreviewModal/index.d.ts +5 -0
- package/dist/components/Upload/components/PreviewModal/previewRender.d.ts +12 -0
- package/dist/components/Upload/index.d.ts +2 -0
- package/dist/components/UserSelect/index.d.ts +29 -0
- package/dist/components/index.d.ts +14 -0
- package/dist/globalConfig.d.ts +6 -0
- package/dist/index.cjs +9 -0
- package/dist/index.css +2 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +3227 -0
- package/package.json +79 -72
- package/src/common/schema-handler.ts +2 -2
- package/src/components/ArrayBase/index.tsx +7 -5
- package/src/components/ArrayCards/index.tsx +5 -4
- package/src/components/ArrayTable/index.tsx +9 -7
- package/src/components/DatePicker/index.tsx +1 -1
- package/src/components/LocationListPicker/components/Popup/index.tsx +1 -1
- package/src/components/LocationListPicker/index.tsx +3 -3
- package/src/components/LocationPicker/Map/AMap/common/utils.ts +9 -9
- package/src/components/LocationPicker/common/utils.ts +5 -5
- package/src/components/LocationPicker/components/ModalContent/index.tsx +5 -5
- package/src/components/PersonnelSelect/type.ts +1 -1
- package/src/components/RichEditor/components/handleMobileRem/index.tsx +2 -2
- package/src/components/RichEditor/components/handleMobileVw/index.tsx +1 -1
- package/src/components/RichEditor/index.tsx +1 -1
- package/src/components/TreeCheckbox/common/utils.ts +1 -1
- package/src/components/Upload/common/handleIOFileList.ts +2 -2
- package/src/components/Upload/uploader-input.jsx +1 -1
- package/src/components/Upload/uploader.jsx +6 -12
- package/src/components/UserSelect/index.tsx +1 -1
- package/src/global.d.ts +12 -0
- package/src/index.tsx +2 -2
- package/src/vite-env.d.ts +1 -0
- package/README.md +0 -330
- package/docs/README.md +0 -21
- package/docs/components/ArrayCards.md +0 -68
- package/docs/components/ArrayTable.md +0 -111
- package/docs/components/CheckboxWithTip.md +0 -43
- package/docs/components/DatePicker.md +0 -54
- package/docs/components/LocationListPicker.md +0 -41
- package/docs/components/LocationPicker.md +0 -67
- package/docs/components/PersonnelSelect.md +0 -77
- package/docs/components/RadioGroupWithTip.md +0 -43
- package/docs/components/RichEditor.md +0 -94
- package/docs/components/Text.md +0 -26
- package/docs/components/TreeCheckbox.md +0 -52
- package/docs/components/Upload.md +0 -77
- package/docs/components/UserSelect.md +0 -59
package/dist/index.js
ADDED
|
@@ -0,0 +1,3227 @@
|
|
|
1
|
+
import e, { Fragment as t, createContext as n, createElement as r, forwardRef as i, useCallback as a, useContext as o, useEffect as s, useImperativeHandle as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
2
|
+
import { createForm as f, onFieldValueChange as p, onFormValuesChange as m } from "@formily/core";
|
|
3
|
+
import { RecursionField as h, connect as g, createSchemaField as v, mapProps as y, observer as b, useField as x, useFieldSchema as S } from "@formily/react";
|
|
4
|
+
import { ArrayCards as C, ArrayTable as w, Cascader as T, Checkbox as E, DatePicker as D, Editable as O, Form as k, FormCollapse as A, FormGrid as j, FormItem as M, FormLayout as N, FormTab as P, Input as F, NumberPicker as I, Password as L, PreviewText as R, Radio as ee, Reset as z, Select as B, Space as V, Submit as H, Switch as U, TimePicker as W, Transfer as te, TreeSelect as ne } from "c-formily-antd";
|
|
5
|
+
import { Alert as re, AutoComplete as ie, Avatar as G, Badge as ae, Button as K, Card as oe, Checkbox as se, Empty as ce, Input as le, InputNumber as ue, List as de, Modal as fe, Pagination as pe, Popconfirm as me, Radio as he, Rate as ge, Select as _e, Slider as ve, Space as ye, Spin as be, Table as xe, Tabs as Se, Upload as Ce, message as we } from "antd";
|
|
6
|
+
import { getFormilyGlobalComponents as Te } from "@hzab/utils/src/formily/global-components";
|
|
7
|
+
import q from "classnames";
|
|
8
|
+
import { SortableContainer as Ee, SortableElement as De, SortableHandle as Oe, usePrefixCls as J } from "c-formily-antd/lib/__builtins__";
|
|
9
|
+
import { c as Y } from "react/compiler-runtime";
|
|
10
|
+
import { CopyOutlined as ke, DeleteOutlined as Ae, DownOutlined as je, EditOutlined as Me, FileExcelTwoTone as Ne, FilePdfTwoTone as Pe, FileWordTwoTone as Fe, MenuOutlined as Ie, PaperClipOutlined as Le, PlusOutlined as Re, UpOutlined as ze, UploadOutlined as Be, VideoCameraTwoTone as Ve } from "@ant-design/icons";
|
|
11
|
+
import { clone as He, isArr as Ue, isBool as We, isFn as Ge, isUndef as Ke, isValid as qe } from "@formily/shared";
|
|
12
|
+
import { Fragment as X, jsx as Z, jsxs as Q } from "react/jsx-runtime";
|
|
13
|
+
import { getFileURL as Je } from "@hzab/utils/src/file/file";
|
|
14
|
+
import { TYPE_AUDIO as Ye, TYPE_IMG as Xe, TYPE_VIDEO as Ze, checkAudioUrl as Qe, checkImageUrl as $e, checkVideoUrl as et, getFileType as tt, getFileTypeStr as nt, isValidMediaType as rt } from "@hzab/utils/src/file/fileType";
|
|
15
|
+
import { getFileExt as it, getFileName as at, getFullFileName as ot, getUFileName as st } from "@hzab/utils/src/file/fileName";
|
|
16
|
+
import { getFileNameObj as ct, mergePreviewConfig as lt, mergePreviewConfig as ut } from "@hzab/utils/src/upload/uploadUtils";
|
|
17
|
+
import { nanoidNumALetters as dt } from "@hzab/utils/src/nanoid";
|
|
18
|
+
import { addQuery as ft } from "@hzab/utils/src/url";
|
|
19
|
+
import pt from "@hzab/utils/src/upload/ossUpload";
|
|
20
|
+
import "@hzab/utils/src/upload/OssUploadUtil";
|
|
21
|
+
import { OfflineUpload as mt } from "@hzab/utils/src/upload/OfflineUpload";
|
|
22
|
+
import { observer as ht } from "@formily/reactive-react";
|
|
23
|
+
import gt, { debounce as _t, isObject as vt, merge as yt } from "lodash";
|
|
24
|
+
import bt from "dayjs";
|
|
25
|
+
import xt from "dayjs/plugin/weekday";
|
|
26
|
+
import St from "dayjs/plugin/weekYear";
|
|
27
|
+
import Ct from "dayjs/plugin/weekOfYear";
|
|
28
|
+
import wt from "dayjs/plugin/quarterOfYear";
|
|
29
|
+
import Tt from "dayjs/plugin/customParseFormat";
|
|
30
|
+
import * as Et from "@turf/turf";
|
|
31
|
+
import { customAlphabet as Dt, nanoid as Ot } from "nanoid";
|
|
32
|
+
import kt from "@amap/amap-jsapi-loader";
|
|
33
|
+
import { createPortal as At } from "react-dom";
|
|
34
|
+
import "@wangeditor/editor/dist/css/style.css";
|
|
35
|
+
import { Editor as jt, Toolbar as Mt } from "@wangeditor/editor-for-react";
|
|
36
|
+
//#region \0rolldown/runtime.js
|
|
37
|
+
var Nt = Object.defineProperty, Pt = Object.getOwnPropertyDescriptor, Ft = Object.getOwnPropertyNames, It = Object.prototype.hasOwnProperty, Lt = (e, t) => {
|
|
38
|
+
let n = {};
|
|
39
|
+
for (var r in e) Nt(n, r, {
|
|
40
|
+
get: e[r],
|
|
41
|
+
enumerable: !0
|
|
42
|
+
});
|
|
43
|
+
return t || Nt(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
44
|
+
}, Rt = (e, t, n, r) => {
|
|
45
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i = Ft(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !It.call(e, s) && s !== n && Nt(e, s, {
|
|
46
|
+
get: ((e) => t[e]).bind(null, s),
|
|
47
|
+
enumerable: !(r = Pt(t, s)) || r.enumerable
|
|
48
|
+
});
|
|
49
|
+
return e;
|
|
50
|
+
}, zt = (e, t, n) => (Rt(e, t, "default"), n && Rt(n, t, "default"));
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/components/Text/index.tsx
|
|
53
|
+
function Bt({ value: t, mode: n, content: r, className: i, ...a }) {
|
|
54
|
+
let o = n === "normal" || !n ? "div" : n;
|
|
55
|
+
return e.createElement(o, {
|
|
56
|
+
className: `formily-text ${i}`,
|
|
57
|
+
...a
|
|
58
|
+
}, t || r);
|
|
59
|
+
}
|
|
60
|
+
var Vt = g(Bt, y((e, t) => ({
|
|
61
|
+
...e,
|
|
62
|
+
form: t.form,
|
|
63
|
+
field: t
|
|
64
|
+
}))), Ht = n(null), Ut = n(null), Wt = (e, t) => typeof e == "function" ? e(t) : e, Gt = () => o(Ht), Kt = (e) => {
|
|
65
|
+
let t = o(Ut);
|
|
66
|
+
return t ? t.index : e;
|
|
67
|
+
}, qt = (e) => {
|
|
68
|
+
let t = Y(3), n = o(Ut), r = n ? n.record : e, i = n?.index, a;
|
|
69
|
+
return t[0] !== r || t[1] !== i ? (a = Wt(r, i), t[0] = r, t[1] = i, t[2] = a) : a = t[2], a;
|
|
70
|
+
}, Jt = (e) => {
|
|
71
|
+
if (e?.type === "array") return [];
|
|
72
|
+
if (e?.type === "object") return {};
|
|
73
|
+
if (e?.type === "void") for (let t in e.properties) {
|
|
74
|
+
let n = Jt(e.properties[t]);
|
|
75
|
+
if (qe(n)) return n;
|
|
76
|
+
}
|
|
77
|
+
}, Yt = (e, t) => qe(e) ? He(e) : Array.isArray(t?.items) ? Jt(t?.items[0]) : Jt(t?.items), $ = (e) => {
|
|
78
|
+
let t = Y(7), n = x(), r = S(), i;
|
|
79
|
+
t[0] !== n || t[1] !== e || t[2] !== r ? (i = {
|
|
80
|
+
field: n,
|
|
81
|
+
schema: r,
|
|
82
|
+
props: e
|
|
83
|
+
}, t[0] = n, t[1] = e, t[2] = r, t[3] = i) : i = t[3];
|
|
84
|
+
let a;
|
|
85
|
+
return t[4] !== e.children || t[5] !== i ? (a = /* @__PURE__ */ Z(Ht.Provider, {
|
|
86
|
+
value: i,
|
|
87
|
+
children: e.children
|
|
88
|
+
}), t[4] = e.children, t[5] = i, t[6] = a) : a = t[6], a;
|
|
89
|
+
};
|
|
90
|
+
$.Item = ({ children: e, ...t }) => /* @__PURE__ */ Z(Ut.Provider, {
|
|
91
|
+
value: t,
|
|
92
|
+
children: e
|
|
93
|
+
});
|
|
94
|
+
var Xt = Oe((e) => {
|
|
95
|
+
let t = J("formily-array-base");
|
|
96
|
+
return /* @__PURE__ */ Z(Ie, {
|
|
97
|
+
...e,
|
|
98
|
+
className: q(`${t}-sort-handle`, e.className),
|
|
99
|
+
style: { ...e.style }
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
$.SortHandle = (e) => {
|
|
103
|
+
let t = Gt();
|
|
104
|
+
return !t || t.field?.pattern !== "editable" ? null : /* @__PURE__ */ Z(Xt, { ...e });
|
|
105
|
+
}, $.Index = (e) => {
|
|
106
|
+
let t = Kt(), n = J("formily-array-base");
|
|
107
|
+
return /* @__PURE__ */ Q("span", {
|
|
108
|
+
...e,
|
|
109
|
+
className: `${n}-index`,
|
|
110
|
+
children: [
|
|
111
|
+
"#",
|
|
112
|
+
t + 1,
|
|
113
|
+
"."
|
|
114
|
+
]
|
|
115
|
+
});
|
|
116
|
+
}, $.Addition = (e) => {
|
|
117
|
+
let t = x(), n = Gt(), r = J("formily-array-base");
|
|
118
|
+
return !n || n.field?.pattern !== "editable" && n.field?.pattern !== "disabled" ? null : /* @__PURE__ */ Z(K, {
|
|
119
|
+
type: "dashed",
|
|
120
|
+
block: !0,
|
|
121
|
+
...e,
|
|
122
|
+
disabled: t?.disabled,
|
|
123
|
+
className: q(`${r}-addition`, e.className),
|
|
124
|
+
onClick: (t) => {
|
|
125
|
+
if (n.props?.disabled || e.onClick && (e.onClick(t), t.defaultPrevented)) return;
|
|
126
|
+
let r = Yt(e.defaultValue, n.schema);
|
|
127
|
+
e.method === "unshift" ? (n.field?.unshift?.(r), n.props?.onAdd?.(0)) : (n.field?.push?.(r), n.props?.onAdd?.(n?.field?.value?.length - 1));
|
|
128
|
+
},
|
|
129
|
+
icon: Ke(e.icon) ? /* @__PURE__ */ Z(Re, {}) : e.icon,
|
|
130
|
+
children: e.title || t.title
|
|
131
|
+
});
|
|
132
|
+
}, $.Copy = e.forwardRef((e, t) => {
|
|
133
|
+
let n = Y(20), r = x(), i = Gt(), a = Kt(e.index), o = J("formily-array-base");
|
|
134
|
+
if (!i || i.field?.pattern !== "editable") return null;
|
|
135
|
+
let s = r?.disabled, c = `${o}-copy`, l = r?.disabled ? `${o}-copy-disabled` : "", u;
|
|
136
|
+
n[0] !== e.className || n[1] !== c || n[2] !== l ? (u = q(c, l, e.className), n[0] = e.className, n[1] = c, n[2] = l, n[3] = u) : u = n[3];
|
|
137
|
+
let d;
|
|
138
|
+
n[4] !== i.field || n[5] !== i.props || n[6] !== a || n[7] !== e || n[8] !== r?.disabled ? (d = (t) => {
|
|
139
|
+
if (r?.disabled || (t.stopPropagation(), i.props?.disabled) || e.onClick && (e.onClick(t), t.defaultPrevented)) return;
|
|
140
|
+
let n = He(i?.field?.value[a]), o = a + 1;
|
|
141
|
+
i.field?.insert?.(o, n), i.props?.onCopy?.(o);
|
|
142
|
+
}, n[4] = i.field, n[5] = i.props, n[6] = a, n[7] = e, n[8] = r?.disabled, n[9] = d) : d = n[9];
|
|
143
|
+
let f;
|
|
144
|
+
n[10] === e.icon ? f = n[11] : (f = Ke(e.icon) ? /* @__PURE__ */ Z(ke, {}) : e.icon, n[10] = e.icon, n[11] = f);
|
|
145
|
+
let p = e.title || r.title, m;
|
|
146
|
+
return n[12] !== e || n[13] !== t || n[14] !== s || n[15] !== u || n[16] !== d || n[17] !== f || n[18] !== p ? (m = /* @__PURE__ */ Z(K, {
|
|
147
|
+
type: "text",
|
|
148
|
+
...e,
|
|
149
|
+
disabled: s,
|
|
150
|
+
className: u,
|
|
151
|
+
ref: t,
|
|
152
|
+
onClick: d,
|
|
153
|
+
icon: f,
|
|
154
|
+
children: p
|
|
155
|
+
}), n[12] = e, n[13] = t, n[14] = s, n[15] = u, n[16] = d, n[17] = f, n[18] = p, n[19] = m) : m = n[19], m;
|
|
156
|
+
}), $.Remove = e.forwardRef((e, t) => {
|
|
157
|
+
let n = Y(8), r = Kt(e.index), i = x(), a = Gt(), o = J("formily-array-base");
|
|
158
|
+
if (!a || a.field?.pattern !== "editable") return null;
|
|
159
|
+
let s;
|
|
160
|
+
return n[0] !== a.field || n[1] !== a.props || n[2] !== r || n[3] !== o || n[4] !== e || n[5] !== t || n[6] !== i ? (s = /* @__PURE__ */ Z(X, { children: a.props?.deletePopconfirm && !i?.disabled ? /* @__PURE__ */ Z(me, {
|
|
161
|
+
...a.props,
|
|
162
|
+
title: a.props?.deletePopconfirmTitle() || null,
|
|
163
|
+
onConfirm: () => {
|
|
164
|
+
i?.disabled || (a.field?.remove?.(r), a.props?.onRemove?.(r));
|
|
165
|
+
},
|
|
166
|
+
children: /* @__PURE__ */ Z(K, {
|
|
167
|
+
type: "text",
|
|
168
|
+
...e,
|
|
169
|
+
disabled: i?.disabled,
|
|
170
|
+
className: q(`${o}-remove`, i?.disabled ? `${o}-remove-disabled` : "", e.className),
|
|
171
|
+
ref: t,
|
|
172
|
+
icon: Ke(e.icon) ? /* @__PURE__ */ Z(Ae, {}) : e.icon,
|
|
173
|
+
children: e.title || i.title
|
|
174
|
+
})
|
|
175
|
+
}) : /* @__PURE__ */ Z(K, {
|
|
176
|
+
type: "text",
|
|
177
|
+
...e,
|
|
178
|
+
disabled: i?.disabled,
|
|
179
|
+
className: q(`${o}-remove`, i?.disabled ? `${o}-remove-disabled` : "", e.className),
|
|
180
|
+
ref: t,
|
|
181
|
+
onClick: (t) => {
|
|
182
|
+
i?.disabled || (t.stopPropagation(), !(e.onClick && (e.onClick(t), t.defaultPrevented)) && (a.field?.remove?.(r), a.props?.onRemove?.(r)));
|
|
183
|
+
},
|
|
184
|
+
icon: Ke(e.icon) ? /* @__PURE__ */ Z(Ae, {}) : e.icon,
|
|
185
|
+
children: e.title || i.title
|
|
186
|
+
}) }), n[0] = a.field, n[1] = a.props, n[2] = r, n[3] = o, n[4] = e, n[5] = t, n[6] = i, n[7] = s) : s = n[7], s;
|
|
187
|
+
}), $.MoveDown = e.forwardRef((e, t) => {
|
|
188
|
+
let n = Y(20), r = Kt(e.index), i = x(), a = Gt(), o = J("formily-array-base");
|
|
189
|
+
if (!a || a.field?.pattern !== "editable") return null;
|
|
190
|
+
let s = i?.disabled, c = `${o}-move-down`, l = i?.disabled ? `${o}-move-down-disabled` : "", u;
|
|
191
|
+
n[0] !== e.className || n[1] !== c || n[2] !== l ? (u = q(c, l, e.className), n[0] = e.className, n[1] = c, n[2] = l, n[3] = u) : u = n[3];
|
|
192
|
+
let d;
|
|
193
|
+
n[4] !== a.field || n[5] !== a.props || n[6] !== r || n[7] !== e || n[8] !== i?.disabled ? (d = (t) => {
|
|
194
|
+
i?.disabled || (t.stopPropagation(), !(e.onClick && (e.onClick(t), t.defaultPrevented)) && (a.field?.moveDown?.(r), a.props?.onMoveDown?.(r)));
|
|
195
|
+
}, n[4] = a.field, n[5] = a.props, n[6] = r, n[7] = e, n[8] = i?.disabled, n[9] = d) : d = n[9];
|
|
196
|
+
let f;
|
|
197
|
+
n[10] === e.icon ? f = n[11] : (f = Ke(e.icon) ? /* @__PURE__ */ Z(je, {}) : e.icon, n[10] = e.icon, n[11] = f);
|
|
198
|
+
let p = e.title || i.title, m;
|
|
199
|
+
return n[12] !== e || n[13] !== t || n[14] !== s || n[15] !== u || n[16] !== d || n[17] !== f || n[18] !== p ? (m = /* @__PURE__ */ Z(K, {
|
|
200
|
+
type: "text",
|
|
201
|
+
...e,
|
|
202
|
+
disabled: s,
|
|
203
|
+
className: u,
|
|
204
|
+
ref: t,
|
|
205
|
+
onClick: d,
|
|
206
|
+
icon: f,
|
|
207
|
+
children: p
|
|
208
|
+
}), n[12] = e, n[13] = t, n[14] = s, n[15] = u, n[16] = d, n[17] = f, n[18] = p, n[19] = m) : m = n[19], m;
|
|
209
|
+
}), $.MoveUp = e.forwardRef((e, t) => {
|
|
210
|
+
let n = Y(20), r = Kt(e.index), i = x(), a = Gt(), o = J("formily-array-base");
|
|
211
|
+
if (!a || a.field?.pattern !== "editable") return null;
|
|
212
|
+
let s = i?.disabled, c = `${o}-move-up`, l = i?.disabled ? `${o}-move-up-disabled` : "", u;
|
|
213
|
+
n[0] !== e.className || n[1] !== c || n[2] !== l ? (u = q(c, l, e.className), n[0] = e.className, n[1] = c, n[2] = l, n[3] = u) : u = n[3];
|
|
214
|
+
let d;
|
|
215
|
+
n[4] !== a.field || n[5] !== a.props || n[6] !== r || n[7] !== e || n[8] !== i?.disabled ? (d = (t) => {
|
|
216
|
+
i?.disabled || (t.stopPropagation(), !(e.onClick && (e.onClick(t), t.defaultPrevented)) && (a?.field?.moveUp(r), a?.props?.onMoveUp?.(r)));
|
|
217
|
+
}, n[4] = a.field, n[5] = a.props, n[6] = r, n[7] = e, n[8] = i?.disabled, n[9] = d) : d = n[9];
|
|
218
|
+
let f;
|
|
219
|
+
n[10] === e.icon ? f = n[11] : (f = Ke(e.icon) ? /* @__PURE__ */ Z(ze, {}) : e.icon, n[10] = e.icon, n[11] = f);
|
|
220
|
+
let p = e.title || i.title, m;
|
|
221
|
+
return n[12] !== e || n[13] !== t || n[14] !== s || n[15] !== u || n[16] !== d || n[17] !== f || n[18] !== p ? (m = /* @__PURE__ */ Z(K, {
|
|
222
|
+
type: "text",
|
|
223
|
+
...e,
|
|
224
|
+
disabled: s,
|
|
225
|
+
className: u,
|
|
226
|
+
ref: t,
|
|
227
|
+
onClick: d,
|
|
228
|
+
icon: f,
|
|
229
|
+
children: p
|
|
230
|
+
}), n[12] = e, n[13] = t, n[14] = s, n[15] = u, n[16] = d, n[17] = f, n[18] = p, n[19] = m) : m = n[19], m;
|
|
231
|
+
}), $.useArray = Gt, $.useIndex = Kt, $.useRecord = qt, $.mixin = (e) => (e.Index = $.Index, e.SortHandle = $.SortHandle, e.Addition = $.Addition, e.Copy = $.Copy, e.Remove = $.Remove, e.MoveDown = $.MoveDown, e.MoveUp = $.MoveUp, e.useArray = $.useArray, e.useIndex = $.useIndex, e.useRecord = $.useRecord, e);
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region src/components/ArrayCards/index.tsx
|
|
234
|
+
var Zt = (e) => e["x-component"]?.indexOf("Addition") > -1, Qt = (e) => e["x-component"]?.indexOf?.("Index") > -1, $t = (e) => e["x-component"]?.indexOf?.("Remove") > -1, en = (e) => e["x-component"]?.indexOf?.("Copy") > -1, tn = (e) => e["x-component"]?.indexOf?.("MoveUp") > -1, nn = (e) => e["x-component"]?.indexOf?.("MoveDown") > -1, rn = (e) => Zt(e) || $t(e) || en(e) || nn(e) || tn(e), an = b((e) => {
|
|
235
|
+
let t = x(), n = S(), r = Array.isArray(t.value) ? t.value : [], i = J("formily-array-cards", e), { onAdd: a, onCopy: o, onRemove: s, onMoveDown: c, onMoveUp: l, deletePopconfirm: u, deletePopconfirmTitle: d } = e;
|
|
236
|
+
if (!n) throw Error("can not found schema object");
|
|
237
|
+
let f = () => r?.map((r, a) => {
|
|
238
|
+
let o = Array.isArray(n.items) ? n.items[a] || n.items[0] : n.items, s = /* @__PURE__ */ Q("span", { children: [/* @__PURE__ */ Z(h, {
|
|
239
|
+
schema: o,
|
|
240
|
+
name: a,
|
|
241
|
+
filterProperties: (e) => !!Qt(e),
|
|
242
|
+
onlyRenderProperties: !0
|
|
243
|
+
}), e.title || t.title] }), c = /* @__PURE__ */ Q("span", { children: [/* @__PURE__ */ Z(h, {
|
|
244
|
+
schema: o,
|
|
245
|
+
name: a,
|
|
246
|
+
filterProperties: (e) => !!rn(e),
|
|
247
|
+
onlyRenderProperties: !0
|
|
248
|
+
}), e.extra] }), l = /* @__PURE__ */ Z(h, {
|
|
249
|
+
schema: o,
|
|
250
|
+
name: a,
|
|
251
|
+
filterProperties: (e) => !(Qt(e) || rn(e))
|
|
252
|
+
});
|
|
253
|
+
return /* @__PURE__ */ Z($.Item, {
|
|
254
|
+
index: a,
|
|
255
|
+
record: () => t.value?.[a],
|
|
256
|
+
children: /* @__PURE__ */ Z(oe, {
|
|
257
|
+
...e,
|
|
258
|
+
onChange: () => {},
|
|
259
|
+
className: q(`${i}-item`, e.className),
|
|
260
|
+
title: s,
|
|
261
|
+
extra: c,
|
|
262
|
+
children: l
|
|
263
|
+
})
|
|
264
|
+
}, a);
|
|
265
|
+
}), p = () => n.reduceProperties((e, t, n) => Zt(t) ? /* @__PURE__ */ Z(h, {
|
|
266
|
+
schema: t,
|
|
267
|
+
name: n
|
|
268
|
+
}) : e, null), m = () => {
|
|
269
|
+
if (!r?.length) return /* @__PURE__ */ Z(oe, {
|
|
270
|
+
...e,
|
|
271
|
+
onChange: () => {},
|
|
272
|
+
className: q(`${i}-item`, e.className),
|
|
273
|
+
title: e.title || t.title,
|
|
274
|
+
children: /* @__PURE__ */ Z(ce, {})
|
|
275
|
+
});
|
|
276
|
+
};
|
|
277
|
+
return /* @__PURE__ */ Q($, {
|
|
278
|
+
...e,
|
|
279
|
+
onAdd: a,
|
|
280
|
+
onCopy: o,
|
|
281
|
+
onRemove: s,
|
|
282
|
+
onMoveUp: l,
|
|
283
|
+
onMoveDown: c,
|
|
284
|
+
children: [
|
|
285
|
+
m(),
|
|
286
|
+
f(),
|
|
287
|
+
p()
|
|
288
|
+
]
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
an.displayName = "ArrayCards", $.mixin(an);
|
|
292
|
+
//#endregion
|
|
293
|
+
//#region src/components/ArrayTable/index.tsx
|
|
294
|
+
var on = De((e) => /* @__PURE__ */ Z("tr", { ...e })), sn = Ee((e) => /* @__PURE__ */ Z("tbody", { ...e })), cn = (e) => e["x-component"]?.indexOf("Column") > -1, ln = (e) => e["x-component"]?.indexOf("Operations") > -1, un = (e) => e["x-component"]?.indexOf("Addition") > -1, dn = () => {
|
|
295
|
+
let e = Y(3), t = x(), n = S(), r;
|
|
296
|
+
if (e[0] !== t || e[1] !== n) {
|
|
297
|
+
let i = (e) => {
|
|
298
|
+
if (cn(e) || ln(e) || un(e)) {
|
|
299
|
+
if (!e["x-component-props"]?.dataIndex && !e.name) return [];
|
|
300
|
+
let n = e["x-component-props"]?.dataIndex || e.name, r = t.query(t.address.concat(n)).take(), i = r?.component?.[1] || e["x-component-props"] || {};
|
|
301
|
+
return [{
|
|
302
|
+
name: n,
|
|
303
|
+
display: r?.display || e["x-display"] || "visible",
|
|
304
|
+
field: r,
|
|
305
|
+
schema: e,
|
|
306
|
+
columnProps: i
|
|
307
|
+
}];
|
|
308
|
+
}
|
|
309
|
+
if (e.properties) return e.reduceProperties((e, t) => e.concat(i(t)), []);
|
|
310
|
+
}, a = (e) => e ? (Ue(e) ? e : [e]).reduce((e, t) => {
|
|
311
|
+
let n = i(t);
|
|
312
|
+
return n ? e.concat(n) : e;
|
|
313
|
+
}, []) : [];
|
|
314
|
+
if (!n) throw Error("can not found schema object");
|
|
315
|
+
r = a(n.items), e[0] = t, e[1] = n, e[2] = r;
|
|
316
|
+
} else r = e[2];
|
|
317
|
+
return r;
|
|
318
|
+
}, fn = (e, t, n) => n.reduce((n, { name: r, columnProps: i, schema: a, display: o }, s) => o !== "visible" || !cn(a) ? n : n.concat({
|
|
319
|
+
...i,
|
|
320
|
+
key: s,
|
|
321
|
+
dataIndex: r,
|
|
322
|
+
render: (n, r) => {
|
|
323
|
+
let i = e?.indexOf(r);
|
|
324
|
+
return /* @__PURE__ */ Z($.Item, {
|
|
325
|
+
index: i,
|
|
326
|
+
record: () => t?.value?.[i],
|
|
327
|
+
children: /* @__PURE__ */ Z(h, {
|
|
328
|
+
schema: a,
|
|
329
|
+
name: i,
|
|
330
|
+
onlyRenderProperties: !0
|
|
331
|
+
})
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
}), []), pn = () => {
|
|
335
|
+
let e = Y(2), t = S(), n;
|
|
336
|
+
return e[0] === t ? n = e[1] : (n = t.reduceProperties(Sn, null), e[0] = t, e[1] = n), n;
|
|
337
|
+
}, mn = { request: null }, hn = b((e) => {
|
|
338
|
+
let t = x(), n = J("formily-array-table"), r = t.errors, i = (e) => Number(e.slice(e.indexOf(t.address.toString()) + 1).match(/(\d+)/)?.[1]), a = e.options?.map(({ label: t, value: n }) => {
|
|
339
|
+
let a = Number(n);
|
|
340
|
+
return {
|
|
341
|
+
label: r.some(({ address: t }) => {
|
|
342
|
+
let n = i(t), r = (a - 1) * e.pageSize, o = a * e.pageSize;
|
|
343
|
+
return n >= r && n <= o;
|
|
344
|
+
}) ? /* @__PURE__ */ Z(ae, {
|
|
345
|
+
dot: !0,
|
|
346
|
+
children: t
|
|
347
|
+
}) : t,
|
|
348
|
+
value: n
|
|
349
|
+
};
|
|
350
|
+
}), o = String(a?.length).length * 15;
|
|
351
|
+
return /* @__PURE__ */ Z(_e, {
|
|
352
|
+
value: e.value,
|
|
353
|
+
onChange: e.onChange,
|
|
354
|
+
options: a,
|
|
355
|
+
virtual: !0,
|
|
356
|
+
style: { width: o < 60 ? 60 : o },
|
|
357
|
+
className: q(`${n}-status-select`, { "has-error": r?.length })
|
|
358
|
+
});
|
|
359
|
+
}, { scheduler: (e) => {
|
|
360
|
+
clearTimeout(mn.request), mn.request = setTimeout(() => {
|
|
361
|
+
e();
|
|
362
|
+
}, 100);
|
|
363
|
+
} }), gn = n({}), _n = () => o(gn), vn = (e) => {
|
|
364
|
+
let n = Y(18), [r, i] = d(1), a = J("formily-array-table"), o = e.showPagination ?? !0, c = e.pageSize || 10, l = e.size || "default", u = e.dataSource || [], f = (r - 1) * c, p = f + c - 1, m = u?.length || 0, h = Math.ceil(m / c), g;
|
|
365
|
+
n[0] === h ? g = n[1] : (g = Array.from(Array(h)).map(Cn), n[0] = h, n[1] = g);
|
|
366
|
+
let v = g, y;
|
|
367
|
+
n[2] === Symbol.for("react.memo_cache_sentinel") ? (y = (e) => {
|
|
368
|
+
i(e);
|
|
369
|
+
}, n[2] = y) : y = n[2];
|
|
370
|
+
let b = y, x, S;
|
|
371
|
+
n[3] !== r || n[4] !== h ? (x = () => {
|
|
372
|
+
h > 0 && h < r && b(h);
|
|
373
|
+
}, S = [h, r], n[3] = r, n[4] = h, n[5] = x, n[6] = S) : (x = n[5], S = n[6]), s(x, S);
|
|
374
|
+
let C = () => {
|
|
375
|
+
if (!(h <= 1 || !o)) return /* @__PURE__ */ Z("div", {
|
|
376
|
+
className: `${a}-pagination`,
|
|
377
|
+
children: /* @__PURE__ */ Q(ye, { children: [/* @__PURE__ */ Z(hn, {
|
|
378
|
+
value: r,
|
|
379
|
+
pageSize: c,
|
|
380
|
+
onChange: b,
|
|
381
|
+
options: v,
|
|
382
|
+
notFoundContent: !1
|
|
383
|
+
}), /* @__PURE__ */ Z(pe, {
|
|
384
|
+
...e,
|
|
385
|
+
pageSize: c,
|
|
386
|
+
current: r,
|
|
387
|
+
total: u.length,
|
|
388
|
+
size: l,
|
|
389
|
+
showSizeChanger: !1,
|
|
390
|
+
onChange: b
|
|
391
|
+
})] })
|
|
392
|
+
});
|
|
393
|
+
}, w = t, T = gn, E;
|
|
394
|
+
n[7] !== c || n[8] !== o || n[9] !== h ? (E = {
|
|
395
|
+
totalPage: h,
|
|
396
|
+
pageSize: c,
|
|
397
|
+
changePage: b,
|
|
398
|
+
showPagination: o
|
|
399
|
+
}, n[7] = c, n[8] = o, n[9] = h, n[10] = E) : E = n[10];
|
|
400
|
+
let D = e.children?.(o ? u?.slice(f, p + 1) : u, C(), { startIndex: f }), O;
|
|
401
|
+
n[11] !== T.Provider || n[12] !== E || n[13] !== D ? (O = /* @__PURE__ */ Z(T.Provider, {
|
|
402
|
+
value: E,
|
|
403
|
+
children: D
|
|
404
|
+
}), n[11] = T.Provider, n[12] = E, n[13] = D, n[14] = O) : O = n[14];
|
|
405
|
+
let k;
|
|
406
|
+
return n[15] !== w || n[16] !== O ? (k = /* @__PURE__ */ Z(w, { children: O }), n[15] = w, n[16] = O, n[17] = k) : k = n[17], k;
|
|
407
|
+
}, yn = (e) => {
|
|
408
|
+
let t = Y(7), n = J("formily-array-table"), r = e["data-row-key"] || 0, i = `${n}-row-${r + 1}`, a;
|
|
409
|
+
t[0] !== e.className || t[1] !== i ? (a = q(e.className, i), t[0] = e.className, t[1] = i, t[2] = a) : a = t[2];
|
|
410
|
+
let o;
|
|
411
|
+
return t[3] !== r || t[4] !== e || t[5] !== a ? (o = /* @__PURE__ */ Z(on, {
|
|
412
|
+
lockAxis: "y",
|
|
413
|
+
...e,
|
|
414
|
+
index: r,
|
|
415
|
+
className: a
|
|
416
|
+
}), t[3] = r, t[4] = e, t[5] = a, t[6] = o) : o = t[6], o;
|
|
417
|
+
}, bn = b((t) => {
|
|
418
|
+
let n = u(), r = x(), i = J("formily-array-table"), o = Array.isArray(r.value) ? r.value.slice() : [], s = dn(), c = fn(o, r, s), l = We(t.pagination) ? { showPagination: t.pagination } : t.pagination, d = pn(), { onAdd: f, onCopy: p, onRemove: m, onMoveDown: g, onMoveUp: v, deletePopconfirm: y, deletePopconfirmTitle: b } = t, S = (e) => o.indexOf(e), C = (e) => {
|
|
419
|
+
let t = n.current?.querySelector(`.${i}-row-${e}`), r = document.body.querySelector(`.${i}-sort-helper`);
|
|
420
|
+
if (!r) return;
|
|
421
|
+
let a = t?.querySelectorAll("td");
|
|
422
|
+
a && requestAnimationFrame(() => {
|
|
423
|
+
r.querySelectorAll("td").forEach((e, t) => {
|
|
424
|
+
a[t] && (e.style.width = getComputedStyle(a[t]).width);
|
|
425
|
+
});
|
|
426
|
+
});
|
|
427
|
+
}, w = a((e, a) => (o) => /* @__PURE__ */ Z(sn, {
|
|
428
|
+
...o,
|
|
429
|
+
start: a,
|
|
430
|
+
list: e.slice(),
|
|
431
|
+
accessibility: { container: n.current || void 0 },
|
|
432
|
+
onSortStart: (e) => {
|
|
433
|
+
C(e.active.id), t.onSortStart && t.onSortStart(e);
|
|
434
|
+
},
|
|
435
|
+
onSortEnd: (e) => {
|
|
436
|
+
let { oldIndex: n, newIndex: i } = e;
|
|
437
|
+
r.move(n, i), t.onSortEnd && t.onSortEnd(e);
|
|
438
|
+
},
|
|
439
|
+
className: q(`${i}-sort-helper`, o.className)
|
|
440
|
+
}), [r]);
|
|
441
|
+
return /* @__PURE__ */ Z(vn, {
|
|
442
|
+
...l,
|
|
443
|
+
dataSource: o,
|
|
444
|
+
children: (r, a, { startIndex: o }) => /* @__PURE__ */ Z("div", {
|
|
445
|
+
ref: n,
|
|
446
|
+
className: i,
|
|
447
|
+
children: /* @__PURE__ */ Q($, {
|
|
448
|
+
...t,
|
|
449
|
+
onAdd: f,
|
|
450
|
+
onCopy: p,
|
|
451
|
+
onRemove: m,
|
|
452
|
+
onMoveUp: v,
|
|
453
|
+
onMoveDown: g,
|
|
454
|
+
children: [
|
|
455
|
+
/* @__PURE__ */ Z(xe, {
|
|
456
|
+
size: "small",
|
|
457
|
+
bordered: !0,
|
|
458
|
+
rowKey: S,
|
|
459
|
+
...t,
|
|
460
|
+
onChange: () => {},
|
|
461
|
+
pagination: !1,
|
|
462
|
+
columns: c,
|
|
463
|
+
dataSource: r,
|
|
464
|
+
components: { body: {
|
|
465
|
+
wrapper: w(r, o),
|
|
466
|
+
row: yn
|
|
467
|
+
} }
|
|
468
|
+
}),
|
|
469
|
+
/* @__PURE__ */ Z("div", {
|
|
470
|
+
style: {
|
|
471
|
+
marginTop: 5,
|
|
472
|
+
marginBottom: 5
|
|
473
|
+
},
|
|
474
|
+
children: a
|
|
475
|
+
}),
|
|
476
|
+
s.map((t, n) => {
|
|
477
|
+
if (cn(t.schema)) return e.createElement(h, {
|
|
478
|
+
name: t.name,
|
|
479
|
+
schema: t.schema,
|
|
480
|
+
onlyRenderSelf: !0,
|
|
481
|
+
key: n
|
|
482
|
+
});
|
|
483
|
+
}),
|
|
484
|
+
d
|
|
485
|
+
]
|
|
486
|
+
})
|
|
487
|
+
})
|
|
488
|
+
});
|
|
489
|
+
});
|
|
490
|
+
bn.displayName = "ArrayTable", bn.Column = () => /* @__PURE__ */ Z(t, {}), $.mixin(bn);
|
|
491
|
+
var xn = (e) => {
|
|
492
|
+
let t = Y(10), n = $.useArray(), { totalPage: r, pageSize: i, changePage: a, showPagination: o } = _n(), s = r === void 0 ? 0 : r, c = i === void 0 ? 10 : i, l;
|
|
493
|
+
t[0] !== n?.field?.value?.length || t[1] !== a || t[2] !== c || t[3] !== e || t[4] !== o || t[5] !== s ? (l = (t) => {
|
|
494
|
+
let r = n?.field?.value?.length || 0;
|
|
495
|
+
o && r === s * c + 1 && Ge(a) && a(s + 1), e.onClick?.(t);
|
|
496
|
+
}, t[0] = n?.field?.value?.length, t[1] = a, t[2] = c, t[3] = e, t[4] = o, t[5] = s, t[6] = l) : l = t[6];
|
|
497
|
+
let u;
|
|
498
|
+
return t[7] !== e || t[8] !== l ? (u = /* @__PURE__ */ Z($.Addition, {
|
|
499
|
+
...e,
|
|
500
|
+
onClick: l
|
|
501
|
+
}), t[7] = e, t[8] = l, t[9] = u) : u = t[9], u;
|
|
502
|
+
};
|
|
503
|
+
bn.Addition = xn;
|
|
504
|
+
function Sn(e, t, n) {
|
|
505
|
+
return un(t) ? /* @__PURE__ */ Z(h, {
|
|
506
|
+
schema: t,
|
|
507
|
+
name: n
|
|
508
|
+
}) : e;
|
|
509
|
+
}
|
|
510
|
+
function Cn(e, t) {
|
|
511
|
+
let n = t + 1;
|
|
512
|
+
return {
|
|
513
|
+
label: n,
|
|
514
|
+
value: n
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
//#endregion
|
|
518
|
+
//#region src/globalConfig.ts
|
|
519
|
+
window.formRenderPCGlobalServeConfig = {};
|
|
520
|
+
function wn() {
|
|
521
|
+
return window.formRenderPCGlobalServeConfig || {};
|
|
522
|
+
}
|
|
523
|
+
//#endregion
|
|
524
|
+
//#region src/components/Upload/common/handleIOFileList.ts
|
|
525
|
+
var Tn = {
|
|
526
|
+
uid: "",
|
|
527
|
+
id: "",
|
|
528
|
+
url: "",
|
|
529
|
+
storeUrl: "",
|
|
530
|
+
name: "",
|
|
531
|
+
filename: "",
|
|
532
|
+
originalFilename: "",
|
|
533
|
+
basePath: "",
|
|
534
|
+
path: "",
|
|
535
|
+
ext: "",
|
|
536
|
+
type: "",
|
|
537
|
+
contentType: "",
|
|
538
|
+
previewUrl: void 0,
|
|
539
|
+
size: void 0,
|
|
540
|
+
platform: void 0,
|
|
541
|
+
lastModified: void 0,
|
|
542
|
+
createTime: void 0,
|
|
543
|
+
originFileObj: void 0
|
|
544
|
+
}, En = function(e) {
|
|
545
|
+
let t = e;
|
|
546
|
+
if (typeof t == "object") return t;
|
|
547
|
+
if (typeof t == "string" && (t = t.trim(), /^\[.*\]$|^\{.*\}$/.test(t))) try {
|
|
548
|
+
t = JSON.parse(t);
|
|
549
|
+
} catch (e) {
|
|
550
|
+
console.error(e);
|
|
551
|
+
}
|
|
552
|
+
return t;
|
|
553
|
+
}, Dn = (e, t) => {
|
|
554
|
+
if (!e) return console.warn("Upload handleInputData 请传入正确的数据"), e;
|
|
555
|
+
let { thumbnailParams: n } = t, r = { ...Tn }, i = En(e);
|
|
556
|
+
if (typeof i == "string") r.id = ct(i)?.id, r.uid = r.id, r.url = i, r.storeUrl = i, r.name = ot(r.url), r.filename = r.name, r.originalFilename = ot(r.url), r.type = tt(r.url), r.ext = it(r.url), wn()?.showThumbnail && (r.thumbUrl = ft(i, n));
|
|
557
|
+
else if (typeof i == "object") {
|
|
558
|
+
let t = i.originFileObj || i;
|
|
559
|
+
r.id = i.id || i.uid, r.url = t.url || t.ossUrl, wn()?.showThumbnail && (r.thumbUrl = ft(r.url, n)), r.storeUrl = r.url, r.originalFilename = i.originalFilename || ot(r.url) || i.name, r.name = i.filename || i.name || ot(r.url), r.filename = r.name, r.originFileObj = e instanceof File ? e : void 0, r.lastModified = i.lastModified, r.basePath = i.basePath, r.path = i.path, r.ext = it(r.url), r.type = i.contentType || i.type, r.contentType = r.type, r.size = i.size, r.platform = i.platform, r.createTime = i.createTime;
|
|
560
|
+
}
|
|
561
|
+
r.id ||= r.uid || `${at(r.url || r.name || r.filename) || "rc-upload"}-${Date.now()}-${dt()}`, r.name ||= r.id, r.filename ||= r.name, r.storeUrl ||= r.url;
|
|
562
|
+
let { previewConfig: a } = t || {};
|
|
563
|
+
return r.previewUrl = ut(r, a), r;
|
|
564
|
+
}, On = (e, t) => {
|
|
565
|
+
if (!e) return [];
|
|
566
|
+
let n = e, { listMode: r, split: i } = t || {};
|
|
567
|
+
if ((r === "splitStr" || r === "jsonStr") && typeof n == "string" && (r === "splitStr" && (n = n?.split(i ?? ", ")), r === "jsonStr" && (n = En(n))), n != null && !Array.isArray(n) && (n = [n]), Array.isArray(n)) {
|
|
568
|
+
let e = [];
|
|
569
|
+
return n.forEach((n) => {
|
|
570
|
+
let r = Dn(n, t);
|
|
571
|
+
r && e.push(r);
|
|
572
|
+
}), e;
|
|
573
|
+
}
|
|
574
|
+
return n;
|
|
575
|
+
}, kn = function(e) {
|
|
576
|
+
let t = e.storeUrl || e.url || (e instanceof File ? Je(e) : e.url), n = e.uid ?? e.id ?? st(e.name || e.filename), r = e.filename || e.uploadInfo?.filename || (e.url ? ot(e.url) : e.name), i = {
|
|
577
|
+
uid: n,
|
|
578
|
+
id: n,
|
|
579
|
+
url: t,
|
|
580
|
+
name: r,
|
|
581
|
+
filename: r,
|
|
582
|
+
originalFilename: e.originalFilename || e.uploadInfo?.originalFilename || e.name || e.filename,
|
|
583
|
+
basePath: e.basePath || e.uploadInfo?.basePath,
|
|
584
|
+
path: e.path || e.uploadInfo?.path,
|
|
585
|
+
ext: e.ext || e.uploadInfo?.ext || it(t),
|
|
586
|
+
type: e.type,
|
|
587
|
+
contentType: e.type,
|
|
588
|
+
size: e.size,
|
|
589
|
+
platform: e.platform || e.uploadInfo?.platform,
|
|
590
|
+
lastModified: e.lastModified,
|
|
591
|
+
createTime: e.createTime || e.uploadInfo?.createTime,
|
|
592
|
+
originFileObj: e instanceof File ? e : void 0
|
|
593
|
+
};
|
|
594
|
+
return i.name ||= i.id ?? i.uid, i.filename ||= i.id ?? i.uid, i.originalFilename ||= i.name || i.filename, i;
|
|
595
|
+
}, An = function(e, t) {
|
|
596
|
+
let { itemMode: n = "object" } = t || {};
|
|
597
|
+
if (n === "file") return e?.originFileObj || e;
|
|
598
|
+
if (n === "object") return kn(e);
|
|
599
|
+
if (n === "jsonStr" && typeof e != "string") {
|
|
600
|
+
let { originFileObj: t, ...n } = kn(e);
|
|
601
|
+
return JSON.stringify({ ...n });
|
|
602
|
+
}
|
|
603
|
+
return n === "url" ? typeof e == "string" ? e : e.originFileObj?.url || e?.url : e;
|
|
604
|
+
}, jn = function(e, t) {
|
|
605
|
+
if (!e) return;
|
|
606
|
+
let { listMode: n, split: r } = t || {}, i = e;
|
|
607
|
+
if (i && !Array.isArray(i) && (i = [e]), n === "array") {
|
|
608
|
+
let { isResRemoveArr: e, maxCount: n } = t || {}, r = i?.map((e) => An(e, t));
|
|
609
|
+
return e && n === 1 && (r = r[0]), r;
|
|
610
|
+
}
|
|
611
|
+
if (n === "jsonStr") return JSON.stringify(i?.map((e) => An(e, t)));
|
|
612
|
+
if (n === "splitStr") return i?.map((e) => An(e, t)).filter((e) => e).join(r ?? ", ");
|
|
613
|
+
}, Mn = {
|
|
614
|
+
[Ze]: Rn,
|
|
615
|
+
[Xe]: zn,
|
|
616
|
+
[Ye]: Bn
|
|
617
|
+
};
|
|
618
|
+
function Nn(e) {
|
|
619
|
+
return !!Mn[nt(e)];
|
|
620
|
+
}
|
|
621
|
+
function Pn(e) {
|
|
622
|
+
let t = e.split(",").map((e) => e.trim())[0], n = t.indexOf("/");
|
|
623
|
+
return n !== -1 && (t = t.substring(0, n)), t;
|
|
624
|
+
}
|
|
625
|
+
function Fn(e) {
|
|
626
|
+
return rt(e) || $e(e) || et(e) || Qe(e);
|
|
627
|
+
}
|
|
628
|
+
function In(e, t) {
|
|
629
|
+
let n = nt(e), r = null;
|
|
630
|
+
return n && (r = Mn[nt(e)]), t && (r = Mn[Pn(t)]), r ||= () => e?.name ? e.name : e, r;
|
|
631
|
+
}
|
|
632
|
+
function Ln(e, t) {
|
|
633
|
+
let n = In(e, t);
|
|
634
|
+
return n ||= () => e?.name || e, n(e?.url || e);
|
|
635
|
+
}
|
|
636
|
+
function Rn(e) {
|
|
637
|
+
return /* @__PURE__ */ Q("video", {
|
|
638
|
+
className: "upload-preview-video",
|
|
639
|
+
src: e,
|
|
640
|
+
controls: !0,
|
|
641
|
+
children: [
|
|
642
|
+
"抱歉,您的浏览器不支持内嵌视频,不过不用担心,你可以",
|
|
643
|
+
/* @__PURE__ */ Z("a", {
|
|
644
|
+
href: e,
|
|
645
|
+
children: "下载"
|
|
646
|
+
}),
|
|
647
|
+
"并用你喜欢的播放器观看!"
|
|
648
|
+
]
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
function zn(e) {
|
|
652
|
+
return /* @__PURE__ */ Z("img", {
|
|
653
|
+
className: "upload-preview-img",
|
|
654
|
+
src: e
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
function Bn(e) {
|
|
658
|
+
return /* @__PURE__ */ Z("audio", {
|
|
659
|
+
className: "upload-preview-img",
|
|
660
|
+
src: e,
|
|
661
|
+
controls: !0
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
//#endregion
|
|
665
|
+
//#region src/components/Upload/components/PreviewModal/index.tsx
|
|
666
|
+
var Vn = (e) => {
|
|
667
|
+
let t = Y(21), { previewFile: n, setPreviewFile: r, title: i, accept: a } = e, [o, c] = d(!1), l, u;
|
|
668
|
+
t[0] === n ? (l = t[1], u = t[2]) : (l = () => {
|
|
669
|
+
c(!!n || !1);
|
|
670
|
+
}, u = [n], t[0] = n, t[1] = l, t[2] = u), s(l, u);
|
|
671
|
+
let f;
|
|
672
|
+
t[3] === r ? f = t[4] : (f = function() {
|
|
673
|
+
c(!1), r && r(null);
|
|
674
|
+
}, t[3] = r, t[4] = f);
|
|
675
|
+
let p = f, m;
|
|
676
|
+
t[5] === Symbol.for("react.memo_cache_sentinel") ? (m = function(e) {
|
|
677
|
+
return e && typeof e == "object" && e.name ? e.name : "预览";
|
|
678
|
+
}, t[5] = m) : m = t[5];
|
|
679
|
+
let h = m, g;
|
|
680
|
+
t[6] !== n || t[7] !== i ? (g = i || h(n), t[6] = n, t[7] = i, t[8] = g) : g = t[8];
|
|
681
|
+
let v;
|
|
682
|
+
t[9] === p ? v = t[10] : (v = [/* @__PURE__ */ Z(K, {
|
|
683
|
+
onClick: p,
|
|
684
|
+
children: "关闭"
|
|
685
|
+
}, "back")], t[9] = p, t[10] = v);
|
|
686
|
+
let y = e.modalConf, b;
|
|
687
|
+
t[11] !== a || t[12] !== n ? (b = Ln(n, a), t[11] = a, t[12] = n, t[13] = b) : b = t[13];
|
|
688
|
+
let x;
|
|
689
|
+
return t[14] !== p || t[15] !== o || t[16] !== e.modalConf || t[17] !== g || t[18] !== v || t[19] !== b ? (x = /* @__PURE__ */ Z(fe, {
|
|
690
|
+
wrapClassName: "upload-preview-modal-wrap",
|
|
691
|
+
className: "upload-preview-modal",
|
|
692
|
+
title: g,
|
|
693
|
+
visible: o,
|
|
694
|
+
width: "auto",
|
|
695
|
+
onCancel: p,
|
|
696
|
+
footer: v,
|
|
697
|
+
...y,
|
|
698
|
+
children: b
|
|
699
|
+
}), t[14] = p, t[15] = o, t[16] = e.modalConf, t[17] = g, t[18] = v, t[19] = b, t[20] = x) : x = t[20], x;
|
|
700
|
+
}, Hn = pt, Un = /* @__PURE__ */ Lt({ default: () => Gn });
|
|
701
|
+
import * as Wn from "@hzab/utils/src/upload/OfflineUpload";
|
|
702
|
+
zt(Un, Wn);
|
|
703
|
+
var Gn = mt, Kn = (e) => {
|
|
704
|
+
let { isPrivateStore: t, UploadOss: n, offlineServerUrl: r, offlineUploadUrl: i, offlinePreviewUrl: a, ossOpt: o, params: s, useHashName: c = !0 } = e || {};
|
|
705
|
+
return ({ action: e, data: t, file: l, filename: u, headers: d, method: f, onSuccess: p, onProgress: m, onError: h }) => {
|
|
706
|
+
l.ossPromise = new (n || Gn)({
|
|
707
|
+
serverUrl: r,
|
|
708
|
+
previewUrl: a,
|
|
709
|
+
...o
|
|
710
|
+
}).upload(l, {
|
|
711
|
+
uploadUrl: i,
|
|
712
|
+
useHashName: c,
|
|
713
|
+
params: { ...s || {} }
|
|
714
|
+
}).then((e) => (l.uploadInfo = e, l.storeUrl = e.url, l.previewUrl = e.presignedUrl || e.url, l.url = l.previewUrl, p(e), e)).catch(h);
|
|
715
|
+
};
|
|
716
|
+
}, qn = (e) => {
|
|
717
|
+
let { UploadOss: t, ossServerUrl: n, ossOpt: r, params: i, useHashName: a = !0 } = e || {};
|
|
718
|
+
return ({ action: e, data: o, file: s, filename: c, headers: l, method: u, onSuccess: d, onProgress: f, onError: p }) => {
|
|
719
|
+
s.ossPromise = new (t || Hn)({
|
|
720
|
+
serverUrl: n,
|
|
721
|
+
...r
|
|
722
|
+
}).upload(s, {
|
|
723
|
+
useHashName: a,
|
|
724
|
+
params: { ...i || {} }
|
|
725
|
+
}).then((e) => (s.url = e?.data?.data?.fileUrl ?? e?.data?.fileUrl ?? e?.fileUrl, s.ossUrl = s.url, d(s), s)).catch(p);
|
|
726
|
+
};
|
|
727
|
+
}, Jn = {
|
|
728
|
+
listMode: "array",
|
|
729
|
+
split: ", ",
|
|
730
|
+
itemMode: "url"
|
|
731
|
+
};
|
|
732
|
+
function Yn({ onChange: e, ...t }) {
|
|
733
|
+
let { uploadMode: n = "oss", name: r = "file", multiple: i = !1, accept: a, value: o, btnText: c = t.textContent || "上传", maxCount: u = Infinity, maxSize: f, listType: p = "text", disabled: m = !1, readOnly: h = !1, ossServerUrl: g = wn()?.serverUrl || "/api/v1/user/oss/getWebOssConfig", isOssUpload: v = !0, isStrRes: y, isResRemoveArr: b = !0, previewConfig: x = {}, previewBaseUrl: S = wn()?.previewBaseUrl || "", onCountExceed: C, templateUrl: w, beforeUploadCheck: T, templateDownloadText: E = "模板下载", isFileObj: D = !1, isFileJson: O = !1, thumbnailParams: k = { image_process: "resize,w_200" }, readPretty: A, afterUpload: j } = t, M = t.uploadParams?.fileAcl === "private" || t.ossOpt?.signatureParams?.fileAcl === "private", N = l(() => {
|
|
734
|
+
let e = x?.url || S, { query: t, search: n, ...r } = x || {}, i = t && typeof t == "object", a = typeof t == "string" ? t.trim() : "", o = (n || a || "").replace(/^\?/, "") || void 0, s = i ? t : void 0;
|
|
735
|
+
return !e && !s && !o ? x || {} : {
|
|
736
|
+
...r,
|
|
737
|
+
url: e,
|
|
738
|
+
...s ? { query: s } : {},
|
|
739
|
+
...o ? { search: o } : {}
|
|
740
|
+
};
|
|
741
|
+
}, [
|
|
742
|
+
x.url,
|
|
743
|
+
x.query,
|
|
744
|
+
x.search,
|
|
745
|
+
S
|
|
746
|
+
]), P = {
|
|
747
|
+
...Jn,
|
|
748
|
+
...t.fileListConf
|
|
749
|
+
}, F = v === !0 && n === void 0 ? "oss" : n;
|
|
750
|
+
!P.itemMode && y === !0 && D === !1 && (P.itemMode = "url"), !P.listMode && O === !0 && (P.listMode = "jsonStr"), !P.itemMode && D === !0 && (P.itemMode = "object");
|
|
751
|
+
let [I, L] = d([]), [R, ee] = d(), [z, B] = d(!1), V = async ({ fileList: t, file: n, event: r }) => {
|
|
752
|
+
if (L(t), n.status !== "done") return;
|
|
753
|
+
let i = [...t];
|
|
754
|
+
for (let e = 0; e < i.length; e++) {
|
|
755
|
+
let t = i[e]?.originFileObj || i[e];
|
|
756
|
+
if (!t.url) {
|
|
757
|
+
let n = await t.ossPromise;
|
|
758
|
+
t.url = "", typeof n == "object" ? t.url = n.url : (n || t.ossUrl || typeof t == "string") && (t.url = t), typeof t.url == "string" ? i[e].url = t.url : typeof t?.url?.ossUrl == "string" && (t.url = t?.url?.ossUrl, i[e].url = t?.url?.ossUrl);
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
i = jn(i, {
|
|
762
|
+
isResRemoveArr: b,
|
|
763
|
+
maxCount: u,
|
|
764
|
+
...P
|
|
765
|
+
}), e && e?.(i), j && await j({
|
|
766
|
+
files: t,
|
|
767
|
+
urls: i
|
|
768
|
+
}), B(!1);
|
|
769
|
+
};
|
|
770
|
+
s(() => {
|
|
771
|
+
let e = On(o, {
|
|
772
|
+
...P,
|
|
773
|
+
maxCount: u,
|
|
774
|
+
previewConfig: N,
|
|
775
|
+
thumbnailParams: k
|
|
776
|
+
});
|
|
777
|
+
async function n() {
|
|
778
|
+
await (0, Un.handlePreviewUrls)(e, {
|
|
779
|
+
...t.ossOpt?.previewOpt,
|
|
780
|
+
previewUrl: t.offlinePreviewUrl
|
|
781
|
+
}), L(e);
|
|
782
|
+
}
|
|
783
|
+
F === "offline" && M ? n() : L(e);
|
|
784
|
+
}, [o, N]);
|
|
785
|
+
let H = l(() => !N?.url || !I?.length ? I : I.map((e) => {
|
|
786
|
+
if (!e || typeof e != "object") return e;
|
|
787
|
+
let t = lt(e.url || e, N), n = e.thumbUrl ? lt(e.thumbUrl, N) : t;
|
|
788
|
+
return {
|
|
789
|
+
...e,
|
|
790
|
+
previewUrl: t,
|
|
791
|
+
thumbUrl: n
|
|
792
|
+
};
|
|
793
|
+
}), [I, N]), U = (t) => {
|
|
794
|
+
let n = jn((I || []).filter((e) => e.url !== t.url), { ...P });
|
|
795
|
+
e && e(n);
|
|
796
|
+
}, W = t.customRequest;
|
|
797
|
+
F === "oss" ? W = qn({
|
|
798
|
+
...t,
|
|
799
|
+
isPrivateStore: M,
|
|
800
|
+
params: t.uploadParams || t.params,
|
|
801
|
+
ossServerUrl: g || t.ossUrl
|
|
802
|
+
}) : F === "offline" && (W = Kn({
|
|
803
|
+
...t,
|
|
804
|
+
isPrivateStore: M,
|
|
805
|
+
params: t.uploadParams,
|
|
806
|
+
ossServerUrl: g || t.ossUrl,
|
|
807
|
+
offlinePreviewUrl: t.offlinePreviewUrl
|
|
808
|
+
}));
|
|
809
|
+
let te = {
|
|
810
|
+
iconRender: (e) => e?.type == "application/pdf" ? /* @__PURE__ */ Z(Pe, { twoToneColor: "#DD4B43" }) : e?.type?.startsWith("video/") ? /* @__PURE__ */ Z(Ve, { twoToneColor: "#3C87F7" }) : e?.type == "application/vnd.ms-excel" || e?.type == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ? /* @__PURE__ */ Z(Ne, { twoToneColor: "#68B27C" }) : e?.type == "application/vnd.openxmlformats-officedocument.wordprocessingml.document" || e?.type == "application/msword" ? /* @__PURE__ */ Z(Fe, { twoToneColor: "#88CCF5" }) : /* @__PURE__ */ Z(Le, {}),
|
|
811
|
+
name: r,
|
|
812
|
+
accept: a,
|
|
813
|
+
multiple: i,
|
|
814
|
+
listType: p,
|
|
815
|
+
maxCount: u,
|
|
816
|
+
fileList: H,
|
|
817
|
+
onChange: V,
|
|
818
|
+
disabled: m,
|
|
819
|
+
readOnly: h,
|
|
820
|
+
onRemove: U,
|
|
821
|
+
async beforeUpload(e, t) {
|
|
822
|
+
B(!0);
|
|
823
|
+
let n = !1;
|
|
824
|
+
if (t.forEach((e) => {
|
|
825
|
+
f && e.size > f && (we.error(`${e.name} 文件大小超出限制,文件大小:${e.size}; `), n = !0);
|
|
826
|
+
}), n) return B(!1), Ce.LIST_IGNORE;
|
|
827
|
+
if (u > 0 && I.length >= u) return C && C(I.length - u), I.length = u, we.error("文件个数超出限制"), B(!1), Ce.LIST_IGNORE;
|
|
828
|
+
if (T) try {
|
|
829
|
+
await T(t);
|
|
830
|
+
} catch (e) {
|
|
831
|
+
return console.error(e), B(!1), Ce.LIST_IGNORE;
|
|
832
|
+
}
|
|
833
|
+
},
|
|
834
|
+
customRequest: W,
|
|
835
|
+
...t || {},
|
|
836
|
+
fileList: H,
|
|
837
|
+
onPreview(e) {
|
|
838
|
+
let n = Nn(e) || Fn(t.accept), r = lt(e.url || e, N);
|
|
839
|
+
n ? ee({
|
|
840
|
+
...e,
|
|
841
|
+
url: r
|
|
842
|
+
}) : window.open(r);
|
|
843
|
+
},
|
|
844
|
+
...t || {}
|
|
845
|
+
}, ne = l(() => m || h || A ? null : u && u > I.length ? p === "picture-card" ? z ? "检测中" : c : /* @__PURE__ */ Z(K, {
|
|
846
|
+
loading: z,
|
|
847
|
+
icon: /* @__PURE__ */ Z(Be, {}),
|
|
848
|
+
children: c
|
|
849
|
+
}) : null, [
|
|
850
|
+
u,
|
|
851
|
+
I,
|
|
852
|
+
m,
|
|
853
|
+
h,
|
|
854
|
+
A,
|
|
855
|
+
z,
|
|
856
|
+
c,
|
|
857
|
+
p
|
|
858
|
+
]);
|
|
859
|
+
return /* @__PURE__ */ Q(X, { children: [
|
|
860
|
+
/* @__PURE__ */ Z(Ce, {
|
|
861
|
+
className: "oss-uploader",
|
|
862
|
+
...te,
|
|
863
|
+
children: ne
|
|
864
|
+
}),
|
|
865
|
+
w ? /* @__PURE__ */ Z("a", {
|
|
866
|
+
className: "uploader-template-download-btn",
|
|
867
|
+
href: w,
|
|
868
|
+
children: E
|
|
869
|
+
}) : null,
|
|
870
|
+
/* @__PURE__ */ Z(Vn, {
|
|
871
|
+
previewFile: R,
|
|
872
|
+
accept: t?.accept,
|
|
873
|
+
setPreviewFile: ee,
|
|
874
|
+
modalConf: t.modalConf,
|
|
875
|
+
previewConfig: N
|
|
876
|
+
})
|
|
877
|
+
] });
|
|
878
|
+
}
|
|
879
|
+
//#endregion
|
|
880
|
+
//#region src/common/global-props-context.ts
|
|
881
|
+
var Xn = n(null), Zn = () => o(Xn), Qn = (e) => {
|
|
882
|
+
let t = Y(4), n = Zn() || {}, r = n?.axios, i = n?.axiosConf, a;
|
|
883
|
+
if (t[0] !== e || t[1] !== r || t[2] !== i) {
|
|
884
|
+
let n = {
|
|
885
|
+
axios: r,
|
|
886
|
+
axiosConf: i,
|
|
887
|
+
...e
|
|
888
|
+
};
|
|
889
|
+
a = /* @__PURE__ */ Z(Yn, { ...n }), t[0] = e, t[1] = r, t[2] = i, t[3] = a;
|
|
890
|
+
} else a = t[3];
|
|
891
|
+
return a;
|
|
892
|
+
}, $n = {
|
|
893
|
+
"user-select-option": "_user-select-option_icbw9_1",
|
|
894
|
+
"user-select-option__avatar": "_user-select-option__avatar_icbw9_4",
|
|
895
|
+
"option-info": "_option-info_icbw9_7",
|
|
896
|
+
"option-info-name": "_option-info-name_icbw9_11",
|
|
897
|
+
"option-info__idCard": "_option-info__idCard_icbw9_18"
|
|
898
|
+
};
|
|
899
|
+
//#endregion
|
|
900
|
+
//#region src/components/UserSelect/index.tsx
|
|
901
|
+
function er() {
|
|
902
|
+
return `hsl(${Math.random() * 360}, ${Math.random() * 20 + 70}%, ${Math.random() * 20 + 70}%)`;
|
|
903
|
+
}
|
|
904
|
+
var tr = ht((e) => {
|
|
905
|
+
let t = x(), n = S(), r = t.dataSource || n["x-component-props"]?.options || [], { options: i, isAvatar: o, configKey: s, InfoRender: c, avatarSize: u = "default", ...d } = e, f = l(() => r.map((e) => ({
|
|
906
|
+
...e,
|
|
907
|
+
avatarColor: er()
|
|
908
|
+
})), [r]), p = a((e, t, n) => t ? e[t] : e[n], []), m = (e, t) => (t?.label ?? "").includes(e);
|
|
909
|
+
return /* @__PURE__ */ Z(_e, {
|
|
910
|
+
className: $n["user-select"],
|
|
911
|
+
...d,
|
|
912
|
+
value: t.value,
|
|
913
|
+
onChange: t.setValue,
|
|
914
|
+
optionLabelProp: "label",
|
|
915
|
+
filterOption: m,
|
|
916
|
+
loading: t.loading,
|
|
917
|
+
children: f.map((e, t) => /* @__PURE__ */ Z(_e.Option, {
|
|
918
|
+
label: e.label,
|
|
919
|
+
value: e.value,
|
|
920
|
+
className: $n["user-select-option"],
|
|
921
|
+
children: /* @__PURE__ */ Q(X, { children: [o && /* @__PURE__ */ Z("span", {
|
|
922
|
+
className: $n["user-select-option__avatar"],
|
|
923
|
+
children: e.avatar ? /* @__PURE__ */ Z(G, {
|
|
924
|
+
src: e.avatar,
|
|
925
|
+
size: u
|
|
926
|
+
}) : /* @__PURE__ */ Z(G, {
|
|
927
|
+
style: {
|
|
928
|
+
verticalAlign: "middle",
|
|
929
|
+
backgroundColor: e.avatarColor
|
|
930
|
+
},
|
|
931
|
+
size: u,
|
|
932
|
+
children: e.label
|
|
933
|
+
})
|
|
934
|
+
}), /* @__PURE__ */ Z("div", {
|
|
935
|
+
className: $n["option-info"],
|
|
936
|
+
children: c ? /* @__PURE__ */ Z(c, { ...e }) : /* @__PURE__ */ Q(X, { children: [
|
|
937
|
+
/* @__PURE__ */ Z("div", {
|
|
938
|
+
className: $n["option-info-name"],
|
|
939
|
+
children: /* @__PURE__ */ Q("span", {
|
|
940
|
+
className: $n["option-info-name__label"],
|
|
941
|
+
children: [e.label, " "]
|
|
942
|
+
})
|
|
943
|
+
}, "tagLabel"),
|
|
944
|
+
/* @__PURE__ */ Q("span", {
|
|
945
|
+
className: $n["option-info__idCard"],
|
|
946
|
+
children: ["手机号:", p(e, s?.phoneKey, "phone")]
|
|
947
|
+
}),
|
|
948
|
+
/* @__PURE__ */ Q("span", {
|
|
949
|
+
className: $n["option-info__idCard"],
|
|
950
|
+
children: ["身份证号:", p(e, s?.idCardKey, "idCard")]
|
|
951
|
+
})
|
|
952
|
+
] })
|
|
953
|
+
})] })
|
|
954
|
+
}, t))
|
|
955
|
+
});
|
|
956
|
+
}), nr = [
|
|
957
|
+
{
|
|
958
|
+
label: "姓名:",
|
|
959
|
+
key: "userName"
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
label: "主部门:",
|
|
963
|
+
key: "parentName"
|
|
964
|
+
},
|
|
965
|
+
{
|
|
966
|
+
label: "主驻点:",
|
|
967
|
+
key: "orgName"
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
label: "手机号:",
|
|
971
|
+
key: "phoneNumber"
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
label: "身份证号:",
|
|
975
|
+
key: "idnumber"
|
|
976
|
+
}
|
|
977
|
+
], rr = (e, t, n) => {
|
|
978
|
+
try {
|
|
979
|
+
return e.map((e) => ({
|
|
980
|
+
...e,
|
|
981
|
+
label: e?.[t],
|
|
982
|
+
value: e?.[n]
|
|
983
|
+
}));
|
|
984
|
+
} catch (t) {
|
|
985
|
+
return console.error(t), e;
|
|
986
|
+
}
|
|
987
|
+
}, ir = ({ loadData: e, searchData: t, renderItem: n, listItemConfigs: r, labelKey: i = "userName", valueKey: o = "userId", disabledKey: c = "disabled", initialPagination: f = {}, avataProps: p = {}, disabledStyle: m, customItemNode: h, labelInValue: g = !1, isClearable: v = !1, ...y }) => {
|
|
988
|
+
let [b, x] = d(""), [S, C] = d(!1), [w, T] = d(!1), [E, D] = d([]), [O, k] = d({
|
|
989
|
+
pageNum: 1,
|
|
990
|
+
pageSize: 10,
|
|
991
|
+
...f
|
|
992
|
+
}), A = u(null), j = u(0), M = u(!0), N = _t(async (t = !1) => {
|
|
993
|
+
try {
|
|
994
|
+
t ? T(!0) : C(!0);
|
|
995
|
+
let { list: n, pagination: r } = await e(b, {
|
|
996
|
+
...O,
|
|
997
|
+
pageNum: t ? O.pageNum + 1 : 1
|
|
998
|
+
});
|
|
999
|
+
j.current = r.total;
|
|
1000
|
+
let a = rr(n, i, o);
|
|
1001
|
+
D((e) => t ? [...e, ...a] : a);
|
|
1002
|
+
} finally {
|
|
1003
|
+
t ? T(!1) : C(!1);
|
|
1004
|
+
}
|
|
1005
|
+
}, 500), P = async (e) => {
|
|
1006
|
+
let { scrollTop: t, clientHeight: n, scrollHeight: r } = e.currentTarget;
|
|
1007
|
+
r - t - n < 30 && !w && E.length <= j.current && (await F(!0), k((e) => ({
|
|
1008
|
+
...e,
|
|
1009
|
+
pageNum: O.pageNum + 1
|
|
1010
|
+
})));
|
|
1011
|
+
}, F = a(N, [
|
|
1012
|
+
b,
|
|
1013
|
+
O,
|
|
1014
|
+
e
|
|
1015
|
+
]), I = a(P, [
|
|
1016
|
+
b,
|
|
1017
|
+
w,
|
|
1018
|
+
e
|
|
1019
|
+
]), L = () => {
|
|
1020
|
+
let e = document.getElementById("abt-list");
|
|
1021
|
+
e && e.scrollTo({
|
|
1022
|
+
top: 0,
|
|
1023
|
+
behavior: "auto"
|
|
1024
|
+
});
|
|
1025
|
+
}, R = _t((e) => {
|
|
1026
|
+
L(), x(e), k((e) => ({
|
|
1027
|
+
...e,
|
|
1028
|
+
pageNum: 1
|
|
1029
|
+
}));
|
|
1030
|
+
}, 1e3), ee = (e) => {
|
|
1031
|
+
v && (e ? F() : z());
|
|
1032
|
+
}, z = () => {
|
|
1033
|
+
x(""), L(), D([]), k((e) => ({
|
|
1034
|
+
...e,
|
|
1035
|
+
pageNum: 1
|
|
1036
|
+
}));
|
|
1037
|
+
}, B = (e) => {
|
|
1038
|
+
let { value: t, mode: n, onChange: r } = y, i = e.value, a = () => {
|
|
1039
|
+
let n = Array.isArray(t) ? t : [t];
|
|
1040
|
+
return g ? n.some((e) => e.value === i) ? n.filter((e) => e.value !== i) : [...n, e] : n.some((e) => e === i) ? n.filter((e) => e !== i) : [...n, e];
|
|
1041
|
+
}, o = () => t?.value === i ? void 0 : e, s, c = n === "multiple" ? a() : o();
|
|
1042
|
+
s = n === "multiple" ? g ? c : c.map((e) => typeof e == "object" ? e?.value : e) : g ? c : c.value, r?.(s, t), n !== "multiple" && A.current && A.current.blur();
|
|
1043
|
+
}, V = l(() => Array.isArray(r) && r?.length ? r : nr, [r]);
|
|
1044
|
+
s(() => {
|
|
1045
|
+
F();
|
|
1046
|
+
}, [b]), s(() => {
|
|
1047
|
+
y.value && typeof t == "function" && M.current && (t?.(y.value).then((e) => {
|
|
1048
|
+
let t = rr(e.list || [], i, o);
|
|
1049
|
+
D(t);
|
|
1050
|
+
}), M.current = !1);
|
|
1051
|
+
}, [y.value]);
|
|
1052
|
+
let H = a((e) => {
|
|
1053
|
+
let { mode: t, value: n } = y, { value: r, [c]: i = !1 } = e, a = () => t === "multiple" ? Array.isArray(n) ? ((n || [])?.map((e) => vt(e) ? e?.value ?? e?.value : e)).includes(r) : !1 : vt(n) ? n?.value === r : n === r, o = (e) => typeof m == "function" ? m(e) : {
|
|
1054
|
+
cursor: e ? "not-allowed" : "pointer",
|
|
1055
|
+
backgroundColor: e ? "#f0f0f0" : a() ? "#e6f7ff" : "inherit",
|
|
1056
|
+
color: e ? "#999" : "inherit",
|
|
1057
|
+
filter: e ? "grayscale(100%)" : "none"
|
|
1058
|
+
}, s = /* @__PURE__ */ Z(G, {
|
|
1059
|
+
alt: e.userName,
|
|
1060
|
+
size: 60,
|
|
1061
|
+
...p,
|
|
1062
|
+
src: e.avatar
|
|
1063
|
+
}), l = /* @__PURE__ */ Z("ul", {
|
|
1064
|
+
className: "abt-user-item-info",
|
|
1065
|
+
children: V.map((t, n) => /* @__PURE__ */ Q("li", {
|
|
1066
|
+
className: "abt-user-item-info__item",
|
|
1067
|
+
children: [/* @__PURE__ */ Z("span", { children: t?.label }), /* @__PURE__ */ Z("span", { children: e?.[t.key] })]
|
|
1068
|
+
}, t?.key || n))
|
|
1069
|
+
}), u = o(i), d = typeof h == "function" ? h?.(e, u) : null;
|
|
1070
|
+
return /* @__PURE__ */ Z(de.Item, {
|
|
1071
|
+
onClick: () => !i && B(e),
|
|
1072
|
+
style: u,
|
|
1073
|
+
children: d || /* @__PURE__ */ Q("div", {
|
|
1074
|
+
className: "abt-user-item",
|
|
1075
|
+
children: [/* @__PURE__ */ Z("div", {
|
|
1076
|
+
className: "abt-user-item-avatar",
|
|
1077
|
+
children: s
|
|
1078
|
+
}), l]
|
|
1079
|
+
}, e?.value)
|
|
1080
|
+
}, r);
|
|
1081
|
+
}, [y.value, E?.length]), U = () => /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(be, {
|
|
1082
|
+
spinning: S,
|
|
1083
|
+
children: /* @__PURE__ */ Z(de, {
|
|
1084
|
+
id: "abt-list",
|
|
1085
|
+
loading: w,
|
|
1086
|
+
dataSource: E,
|
|
1087
|
+
renderItem: n || H,
|
|
1088
|
+
onScroll: I,
|
|
1089
|
+
style: {
|
|
1090
|
+
maxHeight: 250,
|
|
1091
|
+
overflowY: "auto"
|
|
1092
|
+
}
|
|
1093
|
+
})
|
|
1094
|
+
}) });
|
|
1095
|
+
return /* @__PURE__ */ Z(_e, {
|
|
1096
|
+
filterOption: !1,
|
|
1097
|
+
showSearch: !0,
|
|
1098
|
+
placeholder: "请选择人员",
|
|
1099
|
+
...y,
|
|
1100
|
+
ref: A,
|
|
1101
|
+
onDropdownVisibleChange: ee,
|
|
1102
|
+
onSearch: R,
|
|
1103
|
+
dropdownRender: U,
|
|
1104
|
+
options: E.map((e) => ({
|
|
1105
|
+
value: e?.[o] || e?.userId,
|
|
1106
|
+
label: e?.[i] || e.userName,
|
|
1107
|
+
...e
|
|
1108
|
+
}))
|
|
1109
|
+
});
|
|
1110
|
+
}, ar = g(ir, y({ loading: !0 }, (e) => ({ ...e }))), or = (e) => {
|
|
1111
|
+
let t = Y(5), { data: n, onChange: r } = e, i;
|
|
1112
|
+
t[0] !== n || t[1] !== r ? (i = n?.map((e, t) => /* @__PURE__ */ Z("tr", {
|
|
1113
|
+
className: `tree-checkbox-row tree-checkbox-row-${t}`,
|
|
1114
|
+
children: e?.map((e, t) => {
|
|
1115
|
+
if (e === !1) return null;
|
|
1116
|
+
let n = e?.value;
|
|
1117
|
+
return /* @__PURE__ */ Z("td", {
|
|
1118
|
+
className: `tree-checkbox-col tree-checkbox-col-${t}`,
|
|
1119
|
+
rowSpan: e?._maxRow > 1 ? e?._maxRow : null,
|
|
1120
|
+
children: Array.isArray(e) ? /* @__PURE__ */ Z(X, { children: e?.map((e, t) => {
|
|
1121
|
+
let n = e?.value;
|
|
1122
|
+
return e && (e?.readOnly ? /* @__PURE__ */ Z("span", {
|
|
1123
|
+
className: "tree-checkbox-read-only",
|
|
1124
|
+
children: e.label
|
|
1125
|
+
}) : /* @__PURE__ */ Z(se, {
|
|
1126
|
+
onChange: r,
|
|
1127
|
+
value: n,
|
|
1128
|
+
children: e.label
|
|
1129
|
+
}, n));
|
|
1130
|
+
}) }) : e && (e?.readOnly ? /* @__PURE__ */ Z("span", {
|
|
1131
|
+
className: "tree-checkbox-read-only",
|
|
1132
|
+
children: e.label
|
|
1133
|
+
}) : /* @__PURE__ */ Z(se, {
|
|
1134
|
+
onChange: r,
|
|
1135
|
+
value: n,
|
|
1136
|
+
children: e.label
|
|
1137
|
+
}, n))
|
|
1138
|
+
}, t);
|
|
1139
|
+
})
|
|
1140
|
+
}, t)), t[0] = n, t[1] = r, t[2] = i) : i = t[2];
|
|
1141
|
+
let a;
|
|
1142
|
+
return t[3] === i ? a = t[4] : (a = /* @__PURE__ */ Z("table", {
|
|
1143
|
+
className: "tree-checkbox-table",
|
|
1144
|
+
children: /* @__PURE__ */ Z("tbody", { children: i })
|
|
1145
|
+
}), t[3] = i, t[4] = a), a;
|
|
1146
|
+
}, sr = function(e) {
|
|
1147
|
+
return e.stopPropagation(), e;
|
|
1148
|
+
}, { TabPane: cr } = Se, lr = (e) => {
|
|
1149
|
+
let t = Y(23), { item: n, index: r, fieldNames: i, tabConfList: a } = e, o;
|
|
1150
|
+
t[0] === a ? o = t[1] : (o = a === void 0 ? [] : a, t[0] = a, t[1] = o);
|
|
1151
|
+
let c = o, l;
|
|
1152
|
+
t[2] === i ? l = t[3] : (l = i || {}, t[2] = i, t[3] = l);
|
|
1153
|
+
let { label: u, value: f, children: p } = l, { level: m } = n, h;
|
|
1154
|
+
t[4] !== m || t[5] !== c ? (h = m >= 0 ? c[m] : {}, t[4] = m, t[5] = c, t[6] = h) : h = t[6];
|
|
1155
|
+
let g = h, [v, y] = d("" + n.defaultActiveKey), b, x;
|
|
1156
|
+
t[7] === n.defaultActiveKey ? (b = t[8], x = t[9]) : (b = () => {
|
|
1157
|
+
y("" + n.defaultActiveKey);
|
|
1158
|
+
}, x = [n.defaultActiveKey], t[7] = n.defaultActiveKey, t[8] = b, t[9] = x), s(b, x);
|
|
1159
|
+
let S = `tab-level-${m}`, C = "" + n.defaultActiveKey, w;
|
|
1160
|
+
t[10] !== p || t[11] !== n.tabList || t[12] !== u || t[13] !== e || t[14] !== f ? (w = n.tabList?.map((t, n) => t ? /* @__PURE__ */ Z(cr, {
|
|
1161
|
+
forceRender: !0,
|
|
1162
|
+
tab: /* @__PURE__ */ Q(X, { children: [!t?.readOnly && /* @__PURE__ */ Z(se, {
|
|
1163
|
+
className: "tab-level-checkbox-item",
|
|
1164
|
+
value: t[f],
|
|
1165
|
+
onChange: e?.onChange,
|
|
1166
|
+
onClick: sr
|
|
1167
|
+
}, t[f]), t[u]] }),
|
|
1168
|
+
children: /* @__PURE__ */ Z(ur, {
|
|
1169
|
+
...e,
|
|
1170
|
+
list: t[p]
|
|
1171
|
+
})
|
|
1172
|
+
}, "" + t[f]) : null), t[10] = p, t[11] = n.tabList, t[12] = u, t[13] = e, t[14] = f, t[15] = w) : w = t[15];
|
|
1173
|
+
let T;
|
|
1174
|
+
return t[16] !== v || t[17] !== r || t[18] !== S || t[19] !== C || t[20] !== w || t[21] !== g ? (T = /* @__PURE__ */ Z(Se, {
|
|
1175
|
+
className: S,
|
|
1176
|
+
accessKey: v,
|
|
1177
|
+
defaultActiveKey: C,
|
|
1178
|
+
...g,
|
|
1179
|
+
children: w
|
|
1180
|
+
}, r), t[16] = v, t[17] = r, t[18] = S, t[19] = C, t[20] = w, t[21] = g, t[22] = T) : T = t[22], T;
|
|
1181
|
+
}, ur = (e) => {
|
|
1182
|
+
let t = Y(7), { list: n, fieldNames: i, tabConfList: a, emptyNode: o } = e, s = o === void 0 ? "暂无数据" : o;
|
|
1183
|
+
if (!n) {
|
|
1184
|
+
let e;
|
|
1185
|
+
return t[0] === s ? e = t[1] : (e = /* @__PURE__ */ Z("div", {
|
|
1186
|
+
className: "tree-checkbox-empty",
|
|
1187
|
+
children: s
|
|
1188
|
+
}), t[0] = s, t[1] = e), e;
|
|
1189
|
+
}
|
|
1190
|
+
let c;
|
|
1191
|
+
t[2] !== n || t[3] !== e ? (c = n?.map((t, n) => t?.tabList ? /* @__PURE__ */ r(lr, {
|
|
1192
|
+
...e,
|
|
1193
|
+
key: n,
|
|
1194
|
+
item: t,
|
|
1195
|
+
index: n
|
|
1196
|
+
}) : t.tableData ? /* @__PURE__ */ Z(or, {
|
|
1197
|
+
...e,
|
|
1198
|
+
data: t.tableData || []
|
|
1199
|
+
}, n) : null), t[2] = n, t[3] = e, t[4] = c) : c = t[4];
|
|
1200
|
+
let l;
|
|
1201
|
+
return t[5] === c ? l = t[6] : (l = /* @__PURE__ */ Z(X, { children: c }), t[5] = c, t[6] = l), l;
|
|
1202
|
+
};
|
|
1203
|
+
//#endregion
|
|
1204
|
+
//#region src/components/TreeCheckbox/common/utils.ts
|
|
1205
|
+
function dr(e = [], t = {}) {
|
|
1206
|
+
let n = gt.cloneDeep(e), { tabLevel: r = 0, _level: i = 0, fieldNames: a } = t || {}, { value: o, children: s } = a || {}, c = [];
|
|
1207
|
+
return i < r ? (c.push({
|
|
1208
|
+
level: i,
|
|
1209
|
+
defaultActiveKey: n[0]?.[o],
|
|
1210
|
+
tabList: n
|
|
1211
|
+
}), n?.forEach((e) => {
|
|
1212
|
+
e[s]?.length > 0 && (e[s] = dr(e[s], {
|
|
1213
|
+
...t,
|
|
1214
|
+
_level: i + 1
|
|
1215
|
+
}));
|
|
1216
|
+
})) : c.push({
|
|
1217
|
+
level: i,
|
|
1218
|
+
tableData: fr(n, {
|
|
1219
|
+
...t,
|
|
1220
|
+
level: void 0
|
|
1221
|
+
})
|
|
1222
|
+
}), c;
|
|
1223
|
+
}
|
|
1224
|
+
function fr(e = [], t = {}) {
|
|
1225
|
+
let { resList: n, maxCol: r } = pr(e, t);
|
|
1226
|
+
return n?.forEach((e) => {
|
|
1227
|
+
mr(r, e);
|
|
1228
|
+
}), n;
|
|
1229
|
+
}
|
|
1230
|
+
function pr(e = [], t = {}) {
|
|
1231
|
+
let { resList: n = [], preCol: r = 0, mergeLeaf: i, mergeFullLeaf: a, level: o = 0, fieldNames: s } = t || {}, { value: c = "value", children: l = "children", label: u = "label" } = s || {}, d = r + 1, f = 0, p = [], m = [], h = !1;
|
|
1232
|
+
e?.forEach((e, t) => {
|
|
1233
|
+
e && Array.isArray(e[l]) && e[l].length > 0 ? h = !0 : (p.push(t), m.push(e));
|
|
1234
|
+
});
|
|
1235
|
+
let g = n.length > 0 ? n.length - 1 : 0;
|
|
1236
|
+
if (a === !0 && !h && o > 0) return n[g].push([...e?.map((e) => ({
|
|
1237
|
+
...e,
|
|
1238
|
+
label: e[u],
|
|
1239
|
+
value: e[c]
|
|
1240
|
+
}))]), {
|
|
1241
|
+
resList: n,
|
|
1242
|
+
maxCol: d,
|
|
1243
|
+
maxRow: 1
|
|
1244
|
+
};
|
|
1245
|
+
if (i === !0 && p.length > 0) {
|
|
1246
|
+
for (let t = p.length - 1; t >= 0; t--) {
|
|
1247
|
+
let n = p[t];
|
|
1248
|
+
e.splice(n, 1);
|
|
1249
|
+
}
|
|
1250
|
+
e.push({
|
|
1251
|
+
_type_: "leafList",
|
|
1252
|
+
leafList: m?.map((e) => ({
|
|
1253
|
+
...e,
|
|
1254
|
+
label: e[u],
|
|
1255
|
+
value: e[c]
|
|
1256
|
+
}))
|
|
1257
|
+
});
|
|
1258
|
+
}
|
|
1259
|
+
return e?.forEach((e, i) => {
|
|
1260
|
+
let a = null;
|
|
1261
|
+
a = e._type_ === "leafList" ? e.leafList : {
|
|
1262
|
+
...e,
|
|
1263
|
+
value: e[c],
|
|
1264
|
+
label: e[u]
|
|
1265
|
+
};
|
|
1266
|
+
let s = a[l] || [], p = s?.length;
|
|
1267
|
+
if (i > 0 && n.push(mr(r, [], { content: !1 })), g = n.length > 0 ? n.length - 1 : 0, n[g] || (n[g] = []), n[g].push(a), p > 0) {
|
|
1268
|
+
let e = pr(s, {
|
|
1269
|
+
...t,
|
|
1270
|
+
resList: n,
|
|
1271
|
+
preCol: r + 1,
|
|
1272
|
+
level: o + 1
|
|
1273
|
+
});
|
|
1274
|
+
d < e.maxCol && (d = e.maxCol), f += e.maxRow, a._maxRow = e.maxRow;
|
|
1275
|
+
} else a._maxRow = 1, f += 1;
|
|
1276
|
+
}), {
|
|
1277
|
+
resList: n,
|
|
1278
|
+
maxCol: d,
|
|
1279
|
+
maxRow: f
|
|
1280
|
+
};
|
|
1281
|
+
}
|
|
1282
|
+
function mr(e, t = [], n = {}) {
|
|
1283
|
+
let { content: r } = n || {};
|
|
1284
|
+
if (t.length < e) for (let n = t.length; n < e; n++) t.push(r);
|
|
1285
|
+
return t;
|
|
1286
|
+
}
|
|
1287
|
+
//#endregion
|
|
1288
|
+
//#region src/components/TreeCheckbox/index.tsx
|
|
1289
|
+
var hr = (e) => {
|
|
1290
|
+
let t = x(), { dataSource: n = t.dataSource || [], disabled: r, readOnly: i, value: a, onChange: o, mergeLeaf: s = !0, mergeFullLeaf: c = !0, fieldNames: u = {
|
|
1291
|
+
label: e.labelKey ?? "label",
|
|
1292
|
+
value: e.valueKey ?? "value",
|
|
1293
|
+
children: e.childrenKey ?? "children"
|
|
1294
|
+
}, tabBox: d = !1, tabConfList: f } = e, p = d === !0 ? 1 : f?.length ?? e.tabLevel, m = l(() => dr(n || [], {
|
|
1295
|
+
mergeLeaf: s,
|
|
1296
|
+
mergeFullLeaf: c,
|
|
1297
|
+
fieldNames: u,
|
|
1298
|
+
tabLevel: p
|
|
1299
|
+
}), [n]), h = {
|
|
1300
|
+
...e,
|
|
1301
|
+
fieldNames: u,
|
|
1302
|
+
tabLevel: p
|
|
1303
|
+
};
|
|
1304
|
+
return /* @__PURE__ */ Z(se.Group, {
|
|
1305
|
+
className: "tree-checkbox",
|
|
1306
|
+
disabled: r || i,
|
|
1307
|
+
value: a,
|
|
1308
|
+
children: /* @__PURE__ */ Z(ur, {
|
|
1309
|
+
...h,
|
|
1310
|
+
onChange: (e) => {
|
|
1311
|
+
let t = a && Array.isArray(a) ? a : [];
|
|
1312
|
+
t = e.target.checked ? [...t.filter((t) => t != e.target.value), e.target.value] : [...t.filter((t) => t != e.target.value)], o(t);
|
|
1313
|
+
},
|
|
1314
|
+
list: m
|
|
1315
|
+
})
|
|
1316
|
+
});
|
|
1317
|
+
};
|
|
1318
|
+
//#endregion
|
|
1319
|
+
//#region src/common/formily-utils.ts
|
|
1320
|
+
function gr(e) {
|
|
1321
|
+
return _r(e, -1);
|
|
1322
|
+
}
|
|
1323
|
+
function _r(e, t) {
|
|
1324
|
+
if (typeof e != "object" || !e.form || !e.path) {
|
|
1325
|
+
console.warn("Warn setCurLevelData: field 入参不是一个正确的 formily field 数据");
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
let n = [...e.path.segments];
|
|
1329
|
+
if (Math.abs(t) > n.length) {
|
|
1330
|
+
console.info("Info setCurLevelData: level 层级超出路径长度不进行设置");
|
|
1331
|
+
return;
|
|
1332
|
+
}
|
|
1333
|
+
return typeof t == "number" && (n = n.slice(0, t)), gt.get(e.form.values, n.join("."));
|
|
1334
|
+
}
|
|
1335
|
+
bt.extend(xt), bt.extend(St), bt.extend(Ct), bt.extend(wt), bt.extend(Tt);
|
|
1336
|
+
var vr = (e, t) => Array.isArray(e) ? e.map((e) => e && bt(e, t).format(t)) : e && bt(e, t).format(t), { RangePicker: yr } = D, br = (e) => {
|
|
1337
|
+
let t = e.format || ((e) => e.picker === "month" ? "YYYY-MM" : e.picker === "quarter" ? "YYYY-\\QQ" : e.picker === "year" ? "YYYY" : e.picker === "week" ? "gggg-wo" : e.showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD")(e);
|
|
1338
|
+
return {
|
|
1339
|
+
...e,
|
|
1340
|
+
format: t,
|
|
1341
|
+
value: vr(e.value, t === "gggg-wo" ? "gggg-ww" : t)
|
|
1342
|
+
};
|
|
1343
|
+
}, xr = g(D, y((e) => br(e)));
|
|
1344
|
+
xr.RangePicker = g((e) => {
|
|
1345
|
+
let t = x(), n = S(), { isSplitTimes: r = !1, startKey: i = "startTime", endKey: a = "endTime" } = e, o = (e, r) => {
|
|
1346
|
+
let o = {
|
|
1347
|
+
[i]: e,
|
|
1348
|
+
[a]: r
|
|
1349
|
+
};
|
|
1350
|
+
if (!t.parent) t.form.setValues(o);
|
|
1351
|
+
else if (t.parent && n.parent) {
|
|
1352
|
+
let e = gr(t);
|
|
1353
|
+
Object.keys(o).forEach((t) => {
|
|
1354
|
+
e[t] = o[t];
|
|
1355
|
+
});
|
|
1356
|
+
}
|
|
1357
|
+
}, s = (t, n) => {
|
|
1358
|
+
if (e.onChange && e.onChange(t), !r) return;
|
|
1359
|
+
if (!t || !t.length) {
|
|
1360
|
+
o(void 0, void 0);
|
|
1361
|
+
return;
|
|
1362
|
+
}
|
|
1363
|
+
let i = t[0], a = t[1];
|
|
1364
|
+
if ((e.pick === "date" || !e.pick) && !e.showTime) {
|
|
1365
|
+
o(i + " 00:00:00", a + " 23:59:59");
|
|
1366
|
+
return;
|
|
1367
|
+
}
|
|
1368
|
+
o(i, a);
|
|
1369
|
+
};
|
|
1370
|
+
return /* @__PURE__ */ Z(yr, {
|
|
1371
|
+
...e,
|
|
1372
|
+
onChange: (e, t) => s(e, t)
|
|
1373
|
+
});
|
|
1374
|
+
}, y((e) => br(e)));
|
|
1375
|
+
//#endregion
|
|
1376
|
+
//#region src/components/LocationPicker/assets/svg-icon.jsx
|
|
1377
|
+
var Sr = "data:image/svg+xml;charset=utf-8;base64,ICA8c3ZnCiAgICB0PSIxNzA4NDk3MTY0NjU0IgogICAgY2xhc3M9Imljb24iCiAgICB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IgogICAgdmVyc2lvbj0iMS4xIgogICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICAgcC1pZD0iODQ4OSIKICAgIHdpZHRoPSIyMDAiCiAgICBoZWlnaHQ9IjIwMCIKICA+CiAgICA8cGF0aAogICAgICBkPSJNNTEyIDEwMjRjLTIwNS43Ni0yNDEuNDcyLTMyNi4yNzItNDExLjcxMi0zNjEuNjY0LTUxMC43MmEzODQgMzg0IDAgMSAxIDcyMy4wNzIgMC44MzJDODM3Ljc2IDYxMi45MjggNzE3LjMxMiA3ODIuODQ4IDUxMiAxMDI0LjA2NHogbTAtNTEyYTEyOCAxMjggMCAxIDAgMC0yNTYgMTI4IDEyOCAwIDAgMCAwIDI1NnoiCiAgICAgIGZpbGw9IiMxNjc3ZmYiCiAgICAgIHAtaWQ9Ijg0OTAiCiAgICA+PC9wYXRoPgogIDwvc3ZnPg==", Cr = /* @__PURE__ */ Q("svg", {
|
|
1378
|
+
t: "1708305242338",
|
|
1379
|
+
className: "picker-icon",
|
|
1380
|
+
viewBox: "0 0 1088 1024",
|
|
1381
|
+
version: "1.1",
|
|
1382
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1383
|
+
"p-id": "1494",
|
|
1384
|
+
width: "200",
|
|
1385
|
+
height: "200",
|
|
1386
|
+
children: [/* @__PURE__ */ Z("path", {
|
|
1387
|
+
d: "M812.224 416a288 288 0 1 0-576 0c0 118.144 94.528 272.128 288 456.576 193.472-184.448 288-338.432 288-456.576z m-288 544c-234.688-213.312-352-394.688-352-544a352 352 0 1 1 704 0c0 149.312-117.312 330.688-352 544z",
|
|
1388
|
+
fill: "#1677ff",
|
|
1389
|
+
"p-id": "1495"
|
|
1390
|
+
}), /* @__PURE__ */ Z("path", {
|
|
1391
|
+
d: "M524.224 448a64 64 0 1 0 0-128 64 64 0 0 0 0 128z m0 64a128 128 0 1 1 0-256 128 128 0 0 1 0 256z m345.6 192l102.4 256h-288v-64h-320v64h-288l102.4-256h691.2z m-68.928 0H247.552l-76.8 192h706.944l-76.8-192z",
|
|
1392
|
+
fill: "#1677ff",
|
|
1393
|
+
"p-id": "1496"
|
|
1394
|
+
})]
|
|
1395
|
+
}), wr = /* @__PURE__ */ Z("svg", {
|
|
1396
|
+
t: "1708478996666",
|
|
1397
|
+
className: "position-icon",
|
|
1398
|
+
viewBox: "0 0 1024 1024",
|
|
1399
|
+
version: "1.1",
|
|
1400
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1401
|
+
"p-id": "6897",
|
|
1402
|
+
width: "200",
|
|
1403
|
+
height: "200",
|
|
1404
|
+
children: /* @__PURE__ */ Z("path", {
|
|
1405
|
+
d: "M895.044488 550.176484l-42.200124 0C834.62235 708.540282 709.048353 834.001715 550.718325 852.244194l0 42.258453c0 21.946848-17.790178 39.730886-39.729863 39.730886s-39.729863-17.784038-39.729863-39.730886l0-42.258453C312.926524 834.001715 187.354574 708.540282 169.131537 550.176484l-42.199101 0c-21.940708 0-39.730886-17.786085-39.730886-39.729863 0-21.940708 17.789155-39.726793 39.730886-39.726793l42.257429 0c18.24248-158.335145 143.711076-283.907095 302.068733-302.126039l0-42.200124c0-21.940708 17.789155-39.730886 39.729863-39.730886s39.729863 17.789155 39.729863 39.730886l0 42.258453c158.331052 18.241456 283.904025 143.706983 302.126039 302.06771l42.200124 0c21.940708 0 39.729863 17.786085 39.729863 39.726793C934.774351 532.390399 916.986219 550.176484 895.044488 550.176484zM696.395172 470.719828l76.16161 0c-17.251919-114.39847-107.492176-204.651007-221.838458-221.913159l0 76.236312c0 21.939685-17.790178 39.726793-39.729863 39.726793s-39.729863-17.787108-39.729863-39.726793l0-76.165704c-114.39233 17.256012-204.644867 107.495246-221.910089 221.842551l76.233242 0c21.946848 0 39.729863 17.786085 39.729863 39.726793 0 21.943778-17.781992 39.729863-39.729863 39.729863l-76.162634 0c17.251919 114.39847 107.498316 204.649983 221.839481 221.910089l0-76.234265c0-21.943778 17.789155-39.72577 39.729863-39.72577s39.729863 17.781992 39.729863 39.72577l0 76.234265c114.346281-17.260106 204.586538-107.511619 221.838458-221.910089l-76.16161 0c-21.941732 0-39.729863-17.786085-39.729863-39.729863C656.665309 488.505913 674.453441 470.719828 696.395172 470.719828zM510.988462 550.176484c-21.939685 0-39.729863-17.786085-39.729863-39.729863 0-21.940708 17.789155-39.726793 39.729863-39.726793s39.729863 17.786085 39.729863 39.726793C550.718325 532.390399 532.928147 550.176484 510.988462 550.176484z",
|
|
1406
|
+
fill: "#000000",
|
|
1407
|
+
"p-id": "6898"
|
|
1408
|
+
})
|
|
1409
|
+
}), Tr = /* @__PURE__ */ Q("svg", {
|
|
1410
|
+
t: "1708485324277",
|
|
1411
|
+
className: "reset-icon",
|
|
1412
|
+
viewBox: "0 0 1024 1024",
|
|
1413
|
+
version: "1.1",
|
|
1414
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1415
|
+
"p-id": "7503",
|
|
1416
|
+
width: "200",
|
|
1417
|
+
height: "200",
|
|
1418
|
+
children: [/* @__PURE__ */ Z("path", {
|
|
1419
|
+
d: "M512 682.666667c71.296 0 128-56.789333 128-128s-56.704-128-128-128-128 56.789333-128 128 56.704 128 128 128z",
|
|
1420
|
+
"p-id": "7504"
|
|
1421
|
+
}), /* @__PURE__ */ Z("path", {
|
|
1422
|
+
d: "M888.192 477.269333a381.44 381.44 0 0 0-57.813333-137.344 386.261333 386.261333 0 0 0-103.68-103.68 381.866667 381.866667 0 0 0-137.344-57.813333 385.194667 385.194667 0 0 0-78.421334-7.68V85.333333L341.333333 213.333333l169.6 128V256.085333c20.650667-0.085333 41.301333 1.877333 61.226667 5.973334a297.002667 297.002667 0 0 1 106.752 44.928 298.88 298.88 0 0 1 80.725333 80.725333A297.258667 297.258667 0 0 1 810.666667 554.666667a300.032 300.032 0 0 1-23.466667 116.266666 303.36 303.36 0 0 1-27.477333 50.688 307.2 307.2 0 0 1-36.608 44.330667 299.861333 299.861333 0 0 1-150.869334 81.365333 304.213333 304.213333 0 0 1-120.405333 0 297.002667 297.002667 0 0 1-106.794667-44.970666 298.752 298.752 0 0 1-80.64-80.64A298.496 298.496 0 0 1 213.333333 554.666667H128a384.853333 384.853333 0 0 0 65.664 214.784 388.096 388.096 0 0 0 103.594667 103.594666A381.866667 381.866667 0 0 0 512 938.666667a387.84 387.84 0 0 0 77.397333-7.808 384.597333 384.597333 0 0 0 137.301334-57.813334 379.136 379.136 0 0 0 56.789333-46.890666 393.728 393.728 0 0 0 46.933333-56.832A381.952 381.952 0 0 0 896 554.666667a387.84 387.84 0 0 0-7.808-77.397334z",
|
|
1423
|
+
"p-id": "7505"
|
|
1424
|
+
})]
|
|
1425
|
+
});
|
|
1426
|
+
//#endregion
|
|
1427
|
+
//#region src/components/LocationPicker/common/utils.ts
|
|
1428
|
+
function Er(e = {}, t) {
|
|
1429
|
+
let { lonKey: n = "longitude", latKey: r = "latitude", addrKey: i = "address", pointsKey: a = "points", rangeKey: o = "range" } = t || {};
|
|
1430
|
+
return {
|
|
1431
|
+
lon: e[n],
|
|
1432
|
+
lat: e[r],
|
|
1433
|
+
addr: e[i],
|
|
1434
|
+
points: e[a],
|
|
1435
|
+
range: e[o]
|
|
1436
|
+
};
|
|
1437
|
+
}
|
|
1438
|
+
//#endregion
|
|
1439
|
+
//#region src/components/LocationPicker/components/ResInfo/index.tsx
|
|
1440
|
+
var Dr = b((e) => {
|
|
1441
|
+
let { onShow: t, lonKey: n, latKey: r, addrKey: i, pointsKey: a, value: o, pickerIcon: s, element: c } = e || {}, u = l(() => Er(o, {
|
|
1442
|
+
lonKey: n,
|
|
1443
|
+
latKey: r,
|
|
1444
|
+
addrKey: i,
|
|
1445
|
+
pointsKey: a
|
|
1446
|
+
}), [
|
|
1447
|
+
n,
|
|
1448
|
+
r,
|
|
1449
|
+
i,
|
|
1450
|
+
o,
|
|
1451
|
+
a,
|
|
1452
|
+
o?.[a],
|
|
1453
|
+
o?.[n],
|
|
1454
|
+
o?.[r],
|
|
1455
|
+
o?.[i]
|
|
1456
|
+
]);
|
|
1457
|
+
return /* @__PURE__ */ Z("div", {
|
|
1458
|
+
className: "location-value-box",
|
|
1459
|
+
children: /* @__PURE__ */ Q("div", {
|
|
1460
|
+
className: "location-value-head-box",
|
|
1461
|
+
children: [/* @__PURE__ */ Z("div", {
|
|
1462
|
+
className: "location-lon-lat",
|
|
1463
|
+
children: c === "Polyline" ? /* @__PURE__ */ Q("div", { children: [
|
|
1464
|
+
"经纬度:[ ",
|
|
1465
|
+
((e) => {
|
|
1466
|
+
if (e && e.length > 0) return e.join(", ");
|
|
1467
|
+
})(u.points),
|
|
1468
|
+
" ]"
|
|
1469
|
+
] }) : /* @__PURE__ */ Q("div", { children: [
|
|
1470
|
+
/* @__PURE__ */ Q("div", { children: [
|
|
1471
|
+
"经度:",
|
|
1472
|
+
u.lon,
|
|
1473
|
+
" "
|
|
1474
|
+
] }),
|
|
1475
|
+
/* @__PURE__ */ Q("div", { children: ["纬度:", u.lat] }),
|
|
1476
|
+
/* @__PURE__ */ Q("div", { children: ["地址:", u.addr] })
|
|
1477
|
+
] })
|
|
1478
|
+
}), /* @__PURE__ */ Q(K, {
|
|
1479
|
+
className: "location-btn",
|
|
1480
|
+
color: "primary",
|
|
1481
|
+
type: "text",
|
|
1482
|
+
onClick: t,
|
|
1483
|
+
children: [/* @__PURE__ */ Z("span", {
|
|
1484
|
+
className: "location-picker-icon-box",
|
|
1485
|
+
children: typeof s == "string" ? /* @__PURE__ */ Z("img", {
|
|
1486
|
+
className: "location-picker-icon",
|
|
1487
|
+
src: s
|
|
1488
|
+
}) : s || Cr
|
|
1489
|
+
}), /* @__PURE__ */ Z("span", {
|
|
1490
|
+
className: "location-picker-text",
|
|
1491
|
+
children: c === "Polypoint" ? "选点" : "绘制"
|
|
1492
|
+
})]
|
|
1493
|
+
})]
|
|
1494
|
+
})
|
|
1495
|
+
});
|
|
1496
|
+
}), Or = (e) => {
|
|
1497
|
+
let t = Y(48), { element: n, pickInfo: r, setPickInfo: i, setPoint: a, addrLoading: o, defaultLocation: s, disabled: c, readOnly: l } = e;
|
|
1498
|
+
if (n === "Polyline") {
|
|
1499
|
+
let e = kr, n;
|
|
1500
|
+
t[0] === r.points ? n = t[1] : (n = e(r.points), t[0] = r.points, t[1] = n);
|
|
1501
|
+
let i;
|
|
1502
|
+
return t[2] === n ? i = t[3] : (i = /* @__PURE__ */ Q("div", { children: [
|
|
1503
|
+
"经纬度:[ ",
|
|
1504
|
+
n,
|
|
1505
|
+
" ]"
|
|
1506
|
+
] }), t[2] = n, t[3] = i), i;
|
|
1507
|
+
}
|
|
1508
|
+
let u;
|
|
1509
|
+
t[4] === i ? u = t[5] : (u = function(e) {
|
|
1510
|
+
let t = e?.target?.value ?? e, n = null;
|
|
1511
|
+
return i((e) => (n = {
|
|
1512
|
+
...e,
|
|
1513
|
+
lon: t
|
|
1514
|
+
}, n)), n;
|
|
1515
|
+
}, t[4] = i, t[5] = u);
|
|
1516
|
+
let d = u, f;
|
|
1517
|
+
t[6] === i ? f = t[7] : (f = function(e) {
|
|
1518
|
+
let t = e?.target?.value ?? e, n = null;
|
|
1519
|
+
return i((e) => (n = {
|
|
1520
|
+
...e,
|
|
1521
|
+
lat: t
|
|
1522
|
+
}, n)), n;
|
|
1523
|
+
}, t[6] = i, t[7] = f);
|
|
1524
|
+
let p = f, m;
|
|
1525
|
+
t[8] !== s || t[9] !== d || t[10] !== a ? (m = function(e) {
|
|
1526
|
+
let t = d(e);
|
|
1527
|
+
a && a(t.lon || s.lon, t.lat || s.lat, { changeCenter: !0 });
|
|
1528
|
+
}, t[8] = s, t[9] = d, t[10] = a, t[11] = m) : m = t[11];
|
|
1529
|
+
let h = m, g;
|
|
1530
|
+
t[12] !== s || t[13] !== p || t[14] !== a ? (g = function(e) {
|
|
1531
|
+
let t = p(e);
|
|
1532
|
+
a && a(t.lon || s.lon, t.lat || s.lat, { changeCenter: !0 });
|
|
1533
|
+
}, t[12] = s, t[13] = p, t[14] = a, t[15] = g) : g = t[15];
|
|
1534
|
+
let v = g, y;
|
|
1535
|
+
t[16] === Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ Z("div", {
|
|
1536
|
+
className: "picker-info-label",
|
|
1537
|
+
children: "经度:"
|
|
1538
|
+
}), t[16] = y) : y = t[16];
|
|
1539
|
+
let b;
|
|
1540
|
+
t[17] !== o || t[18] !== c || t[19] !== h || t[20] !== d || t[21] !== r.lon || t[22] !== l ? (b = l ? r.lon : /* @__PURE__ */ Z(ue, {
|
|
1541
|
+
className: "picker-info-input",
|
|
1542
|
+
disabled: c || o,
|
|
1543
|
+
max: 180,
|
|
1544
|
+
min: -180,
|
|
1545
|
+
controls: !1,
|
|
1546
|
+
value: r.lon,
|
|
1547
|
+
onChange: d,
|
|
1548
|
+
onBlur: h,
|
|
1549
|
+
onPressEnter: h
|
|
1550
|
+
}), t[17] = o, t[18] = c, t[19] = h, t[20] = d, t[21] = r.lon, t[22] = l, t[23] = b) : b = t[23];
|
|
1551
|
+
let x;
|
|
1552
|
+
t[24] === b ? x = t[25] : (x = /* @__PURE__ */ Q("div", {
|
|
1553
|
+
className: "picker-info-lon",
|
|
1554
|
+
children: [y, b]
|
|
1555
|
+
}), t[24] = b, t[25] = x);
|
|
1556
|
+
let S;
|
|
1557
|
+
t[26] === Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ Z("div", {
|
|
1558
|
+
className: "picker-info-label",
|
|
1559
|
+
children: "纬度:"
|
|
1560
|
+
}), t[26] = S) : S = t[26];
|
|
1561
|
+
let C;
|
|
1562
|
+
t[27] !== o || t[28] !== c || t[29] !== v || t[30] !== p || t[31] !== r.lat || t[32] !== l ? (C = l ? r.lat : /* @__PURE__ */ Z(ue, {
|
|
1563
|
+
className: "picker-info-input",
|
|
1564
|
+
disabled: c || o,
|
|
1565
|
+
max: 90,
|
|
1566
|
+
min: -90,
|
|
1567
|
+
controls: !1,
|
|
1568
|
+
value: r.lat,
|
|
1569
|
+
onChange: p,
|
|
1570
|
+
onBlur: v,
|
|
1571
|
+
onPressEnter: v
|
|
1572
|
+
}), t[27] = o, t[28] = c, t[29] = v, t[30] = p, t[31] = r.lat, t[32] = l, t[33] = C) : C = t[33];
|
|
1573
|
+
let w;
|
|
1574
|
+
t[34] === C ? w = t[35] : (w = /* @__PURE__ */ Q("div", {
|
|
1575
|
+
className: "picker-info-lat",
|
|
1576
|
+
children: [S, C]
|
|
1577
|
+
}), t[34] = C, t[35] = w);
|
|
1578
|
+
let T;
|
|
1579
|
+
t[36] !== x || t[37] !== w ? (T = /* @__PURE__ */ Q("div", {
|
|
1580
|
+
className: "picker-info-position",
|
|
1581
|
+
children: [x, w]
|
|
1582
|
+
}), t[36] = x, t[37] = w, t[38] = T) : T = t[38];
|
|
1583
|
+
let E;
|
|
1584
|
+
t[39] === Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ Z("div", {
|
|
1585
|
+
className: "picker-info-label",
|
|
1586
|
+
children: "地址:"
|
|
1587
|
+
}), t[39] = E) : E = t[39];
|
|
1588
|
+
let D;
|
|
1589
|
+
t[40] !== o || t[41] !== r.addr ? (D = o ? /* @__PURE__ */ Z(be, { size: "small" }) : r.addr, t[40] = o, t[41] = r.addr, t[42] = D) : D = t[42];
|
|
1590
|
+
let O;
|
|
1591
|
+
t[43] === D ? O = t[44] : (O = /* @__PURE__ */ Q("div", {
|
|
1592
|
+
className: "picker-info-addr",
|
|
1593
|
+
children: [E, D]
|
|
1594
|
+
}), t[43] = D, t[44] = O);
|
|
1595
|
+
let k;
|
|
1596
|
+
return t[45] !== T || t[46] !== O ? (k = /* @__PURE__ */ Q("div", {
|
|
1597
|
+
className: "location-picker-info",
|
|
1598
|
+
children: [T, O]
|
|
1599
|
+
}), t[45] = T, t[46] = O, t[47] = k) : k = t[47], k;
|
|
1600
|
+
};
|
|
1601
|
+
function kr(e) {
|
|
1602
|
+
if (e && e.length > 0) return e.join(", ");
|
|
1603
|
+
}
|
|
1604
|
+
//#endregion
|
|
1605
|
+
//#region src/components/LocationPicker/Map/AMap/common/loader.ts
|
|
1606
|
+
var Ar = "2.0", jr = [
|
|
1607
|
+
"AMap.Geocoder",
|
|
1608
|
+
"AMap.AutoComplete",
|
|
1609
|
+
"AMap.PolygonEditor",
|
|
1610
|
+
"AMap.PolylineEditor"
|
|
1611
|
+
];
|
|
1612
|
+
window._AMapLoaderTemp || (window._AMapLoaderTemp = {}), window._AMapLoaderTemp.loading = !1;
|
|
1613
|
+
function Mr(e) {
|
|
1614
|
+
window.AMap || (window._AMapSecurityConfig = { securityJsCode: e.securityJsCode || window._AMapLoaderTemp.securityJsCode });
|
|
1615
|
+
let { key: t, version: n, plugins: r } = e || {};
|
|
1616
|
+
return new Promise((e, i) => {
|
|
1617
|
+
if (window._AMapLoaderTemp.loading && window._AMapLoaderTemp.promise) {
|
|
1618
|
+
window._AMapLoaderTemp.promise.then((t) => {
|
|
1619
|
+
e(window.AMap);
|
|
1620
|
+
});
|
|
1621
|
+
return;
|
|
1622
|
+
}
|
|
1623
|
+
if (window.AMap && !r || window.AMap && r && JSON.stringify(window._AMapLoaderTemp.plugins) === JSON.stringify(r)) {
|
|
1624
|
+
e(window.AMap);
|
|
1625
|
+
return;
|
|
1626
|
+
}
|
|
1627
|
+
window._AMapLoaderTemp.plugins = r ? [...jr, ...r || []] : jr, window._AMapLoaderTemp.loading = !0, window._AMapLoaderTemp.promise = kt.load({
|
|
1628
|
+
key: t || window._AMapLoaderTemp.key,
|
|
1629
|
+
version: n || Ar,
|
|
1630
|
+
plugins: window._AMapLoaderTemp.plugins
|
|
1631
|
+
}).then((t) => (window.AMap = t, e(window.AMap), window._AMapLoaderTemp.loading = !1, t)).catch((e) => {
|
|
1632
|
+
i(e), console.error("AMap loader: ", e);
|
|
1633
|
+
});
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1636
|
+
//#endregion
|
|
1637
|
+
//#region src/components/LocationPicker/Map/AMap/common/utils.ts
|
|
1638
|
+
window._AMapLoaderTemp || (window._AMapLoaderTemp = {});
|
|
1639
|
+
var Nr = class {
|
|
1640
|
+
map;
|
|
1641
|
+
AMap;
|
|
1642
|
+
markers = {};
|
|
1643
|
+
circles = {};
|
|
1644
|
+
pickerMarker;
|
|
1645
|
+
markerIconConf;
|
|
1646
|
+
markerConf;
|
|
1647
|
+
polyEditor = {
|
|
1648
|
+
PolygonEditor: void 0,
|
|
1649
|
+
PolylineEditor: void 0
|
|
1650
|
+
};
|
|
1651
|
+
polygonEnum = {};
|
|
1652
|
+
polygonConf;
|
|
1653
|
+
mapDomRef;
|
|
1654
|
+
constructor({ map: e, AMap: t, mapDomRef: n, markerIconConf: r, markerConf: i, polygonConf: a }) {
|
|
1655
|
+
if (!e) throw Error("请传入地图实例");
|
|
1656
|
+
this.map = e, this.AMap = t, this.markerIconConf = r || {}, this.markerConf = i || {}, this.polygonEnum = {}, this.polygonConf = a || {}, this.mapDomRef = n;
|
|
1657
|
+
}
|
|
1658
|
+
getCenter(e = this.map) {
|
|
1659
|
+
if (!e) throw Error("请传入地图实例和 AMap");
|
|
1660
|
+
return e && e.getCenter && e.getCenter();
|
|
1661
|
+
}
|
|
1662
|
+
setCenter(e, t, n = {
|
|
1663
|
+
immediately: void 0,
|
|
1664
|
+
duration: void 0,
|
|
1665
|
+
map: this.map,
|
|
1666
|
+
AMap: this.AMap || window.AMap
|
|
1667
|
+
}) {
|
|
1668
|
+
let { map: r = this.map, AMap: i = this.AMap || window.AMap, immediately: a, duration: o } = n || {};
|
|
1669
|
+
if (!(i && r)) throw Error("请传入地图实例和 AMap");
|
|
1670
|
+
let s = new window.AMap.LngLat(e, t);
|
|
1671
|
+
r.setCenter(s, a, o);
|
|
1672
|
+
}
|
|
1673
|
+
setFitView() {
|
|
1674
|
+
this.map.setFitView();
|
|
1675
|
+
}
|
|
1676
|
+
setMarker(e, t, n) {
|
|
1677
|
+
let { data: r, id: i = Ot(), marker: a, map: o = this.map, AMap: s = this.AMap, markerIconConf: c = {}, markerConf: l = {}, onClick: u } = n || {};
|
|
1678
|
+
if (!(s && o)) throw Error("请传入地图实例和 AMap");
|
|
1679
|
+
if (e == null || t == null) {
|
|
1680
|
+
console.warn("setMarker 请传入正确的经纬度");
|
|
1681
|
+
return;
|
|
1682
|
+
}
|
|
1683
|
+
let d = new s.LngLat(e, t), f = a || this.markers[i];
|
|
1684
|
+
if (f) return f.setPosition(d), f;
|
|
1685
|
+
let p = new s.Size(34, 34), m = new s.Icon({
|
|
1686
|
+
size: p,
|
|
1687
|
+
image: Sr,
|
|
1688
|
+
imageSize: p,
|
|
1689
|
+
...this.markerIconConf,
|
|
1690
|
+
...c
|
|
1691
|
+
}), h = new s.Marker({
|
|
1692
|
+
offset: new s.Pixel(-17, -34),
|
|
1693
|
+
icon: m,
|
|
1694
|
+
position: d,
|
|
1695
|
+
extData: {
|
|
1696
|
+
id: i,
|
|
1697
|
+
data: r
|
|
1698
|
+
},
|
|
1699
|
+
...this.markerConf,
|
|
1700
|
+
...l
|
|
1701
|
+
});
|
|
1702
|
+
return this.markers[i] = h, u && h.on("click", u), o?.add(h), h;
|
|
1703
|
+
}
|
|
1704
|
+
createPoly(e) {
|
|
1705
|
+
if (e !== "Polypoint") {
|
|
1706
|
+
if (this.polyEditor[`${e}Editor`]) return this.polyEditor[`${e}Editor`];
|
|
1707
|
+
this.polyEditor[`${e}Editor`] = new this.AMap[`${e}Editor`](this.map, void 0, {
|
|
1708
|
+
createOptions: {
|
|
1709
|
+
strokeColor: "#1791fc",
|
|
1710
|
+
strokeWeight: 2,
|
|
1711
|
+
fillOpacity: .4,
|
|
1712
|
+
fillColor: "#1791fc"
|
|
1713
|
+
},
|
|
1714
|
+
editOptions: {
|
|
1715
|
+
strokeColor: "#1791fc",
|
|
1716
|
+
strokeWeight: 2,
|
|
1717
|
+
fillOpacity: .4,
|
|
1718
|
+
fillColor: "#1791fc"
|
|
1719
|
+
},
|
|
1720
|
+
...this.polygonConf
|
|
1721
|
+
});
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
setPolygon(e) {
|
|
1725
|
+
let { points: t, id: n, onClick: r, element: i = "Polygon", map: a = this.map, AMap: o = this.AMap } = e;
|
|
1726
|
+
if (!(o && a)) throw Error("请传入地图实例和 AMap");
|
|
1727
|
+
if (this.polygonEnum[n]) return;
|
|
1728
|
+
let s = new this.AMap[i]({
|
|
1729
|
+
path: t,
|
|
1730
|
+
strokeColor: "#1791fc",
|
|
1731
|
+
strokeWeight: 2,
|
|
1732
|
+
fillOpacity: .4,
|
|
1733
|
+
fillColor: "#1791fc"
|
|
1734
|
+
});
|
|
1735
|
+
s.id = n, s.path = t, s.center = this.getPolygonCenter(t), this.polygonEnum[n] = s, this.map.add([s]), s.on("click", r);
|
|
1736
|
+
}
|
|
1737
|
+
startPolygon(e) {
|
|
1738
|
+
let { onClick: t, element: n = "Polygon" } = e;
|
|
1739
|
+
this.polyEditor[`${n}Editor`].on("add", (e) => {
|
|
1740
|
+
let n = Ot();
|
|
1741
|
+
e.target.id = n;
|
|
1742
|
+
let r = e.target;
|
|
1743
|
+
this.polygonEnum[n] = r, r.on("click", t);
|
|
1744
|
+
}), this.polyEditor[`${n}Editor`].on("end", (e) => {
|
|
1745
|
+
let t = e.target;
|
|
1746
|
+
t.type === "AMap.Overlay" && (t.path = t.getPath().map((e) => [e.lng, e.lat]), t.center = this.getPolygonCenter(t.path));
|
|
1747
|
+
});
|
|
1748
|
+
}
|
|
1749
|
+
setDrawPolygon({ map: e = this.map, AMap: t = this.AMap, element: n = "Polygon" }) {
|
|
1750
|
+
if (!(t && e)) throw Error("请传入地图实例和 AMap");
|
|
1751
|
+
this.polyEditor[`${n}Editor`].close(), this.polyEditor[`${n}Editor`].setTarget(), this.polyEditor[`${n}Editor`].open();
|
|
1752
|
+
}
|
|
1753
|
+
setEditPolygon({ id: e, element: t = "Polygon" }) {
|
|
1754
|
+
let n = this.polygonEnum[e];
|
|
1755
|
+
if (!n) {
|
|
1756
|
+
console.warn("setEditPolygon 找不到目标对象:", e);
|
|
1757
|
+
return;
|
|
1758
|
+
}
|
|
1759
|
+
this.polyEditor[`${t}Editor`].setTarget(n), this.polyEditor[`${t}Editor`].open();
|
|
1760
|
+
}
|
|
1761
|
+
setMarkerIcon(e, t = {
|
|
1762
|
+
size: null,
|
|
1763
|
+
image: null,
|
|
1764
|
+
offset: null
|
|
1765
|
+
}) {
|
|
1766
|
+
let n = this.markers[e];
|
|
1767
|
+
if (!n) return;
|
|
1768
|
+
let { image: r, offset: i } = t || {}, a = this.AMap, o = new a.Size(...t?.size), s = new a.Icon({
|
|
1769
|
+
size: o,
|
|
1770
|
+
image: r,
|
|
1771
|
+
imageSize: o
|
|
1772
|
+
});
|
|
1773
|
+
n.setIcon(s), n.setSize(o), n.setOffset(new a.Pixel(...i));
|
|
1774
|
+
}
|
|
1775
|
+
rmPolygon(e, t = "Polygon") {
|
|
1776
|
+
this.map.remove(this.polygonEnum[e]), this.polyEditor[`${t}Editor`].close(), this.polyEditor[`${t}Editor`].setTarget(), delete this.polygonEnum[e];
|
|
1777
|
+
}
|
|
1778
|
+
rmMarker(e) {
|
|
1779
|
+
this.map.remove(this.markers[e]), delete this.markers[e];
|
|
1780
|
+
}
|
|
1781
|
+
setCircle(e, t, n, r) {
|
|
1782
|
+
let { id: i = Ot(), circle: a, map: o = this.map, AMap: s = this.AMap, onClick: c, circleConf: l = {} } = r || {};
|
|
1783
|
+
if (!(s && o)) throw Error("请传入地图实例和 AMap");
|
|
1784
|
+
if (e == null || t == null) {
|
|
1785
|
+
console.warn("setMarker 请传入正确的经纬度");
|
|
1786
|
+
return;
|
|
1787
|
+
}
|
|
1788
|
+
let u = new s.LngLat(e, t), d = a || this.circles[i];
|
|
1789
|
+
if (d) return d.setCenter(u), d.setRadius(n), d;
|
|
1790
|
+
let f = new s.Circle({
|
|
1791
|
+
center: u,
|
|
1792
|
+
radius: n,
|
|
1793
|
+
borderWeight: 1,
|
|
1794
|
+
strokeColor: "#0080FF",
|
|
1795
|
+
strokeWeight: 1,
|
|
1796
|
+
fillOpacity: .1,
|
|
1797
|
+
fillColor: "#0080FF",
|
|
1798
|
+
zIndex: 100,
|
|
1799
|
+
...l
|
|
1800
|
+
});
|
|
1801
|
+
return f.on("click", c), this.circles[i] = f, o?.add(f), f;
|
|
1802
|
+
}
|
|
1803
|
+
rmCircle(e) {
|
|
1804
|
+
this.map.remove(this.circles[e]), delete this.circles[e];
|
|
1805
|
+
}
|
|
1806
|
+
isContains(e, t) {
|
|
1807
|
+
let n = {
|
|
1808
|
+
...this.circles,
|
|
1809
|
+
...this.polygonEnum
|
|
1810
|
+
}, { lng: r, lat: i } = e.lnglat || {}, a = new this.AMap.LngLat(r, i), o = Object.keys(n).some((e) => n[e].contains(a));
|
|
1811
|
+
return o || t && t(e), o;
|
|
1812
|
+
}
|
|
1813
|
+
setPickerMarker(e, t, n) {
|
|
1814
|
+
if (e && t) {
|
|
1815
|
+
let { marker: r = this.pickerMarker } = n || {};
|
|
1816
|
+
this.pickerMarker = this.setMarker(e, t, {
|
|
1817
|
+
...n,
|
|
1818
|
+
marker: r
|
|
1819
|
+
});
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
getPolygonCenter(e) {
|
|
1823
|
+
if (e.length > 0) {
|
|
1824
|
+
let t = Et.featureCollection(e.map((e) => Et.point(e)));
|
|
1825
|
+
return Et.center(t).geometry.coordinates;
|
|
1826
|
+
}
|
|
1827
|
+
return [];
|
|
1828
|
+
}
|
|
1829
|
+
on(...e) {
|
|
1830
|
+
return this.map?.on(...e);
|
|
1831
|
+
}
|
|
1832
|
+
off(...e) {
|
|
1833
|
+
return this.map?.off(...e);
|
|
1834
|
+
}
|
|
1835
|
+
};
|
|
1836
|
+
//#endregion
|
|
1837
|
+
//#region src/components/LocationPicker/Map/AMap/index.jsx
|
|
1838
|
+
window._AMapLoaderTemp && window._AMapLoaderTemp.key && Mr({
|
|
1839
|
+
key: window._AMapLoaderTemp.key,
|
|
1840
|
+
securityJsCode: window._AMapLoaderTemp.securityJsCode
|
|
1841
|
+
});
|
|
1842
|
+
function Pr(e) {
|
|
1843
|
+
let t = Y(8), n = u(), r = u(), i;
|
|
1844
|
+
t[0] === e ? i = t[1] : (i = () => {
|
|
1845
|
+
let { key: t, securityJsCode: i, plugins: a, markerIconConf: o } = e;
|
|
1846
|
+
Mr({
|
|
1847
|
+
key: t,
|
|
1848
|
+
securityJsCode: i,
|
|
1849
|
+
plugins: a
|
|
1850
|
+
}).then((t) => {
|
|
1851
|
+
let { zoom: i, center: a, init: s } = e;
|
|
1852
|
+
n.current = new t.Map(r.current, {
|
|
1853
|
+
zoom: i || 14,
|
|
1854
|
+
center: a || [120.160217, 30.243861],
|
|
1855
|
+
doubleClickZoom: !1
|
|
1856
|
+
}), s && s({
|
|
1857
|
+
mapDomRef: r,
|
|
1858
|
+
map: n.current,
|
|
1859
|
+
mapUtils: new Nr({
|
|
1860
|
+
map: n.current,
|
|
1861
|
+
AMap: t,
|
|
1862
|
+
markerIconConf: o,
|
|
1863
|
+
mapDomRef: r
|
|
1864
|
+
}),
|
|
1865
|
+
AMap: t
|
|
1866
|
+
});
|
|
1867
|
+
});
|
|
1868
|
+
}, t[0] = e, t[1] = i);
|
|
1869
|
+
let a;
|
|
1870
|
+
t[2] === Symbol.for("react.memo_cache_sentinel") ? (a = [], t[2] = a) : a = t[2], s(i, a);
|
|
1871
|
+
let o, c;
|
|
1872
|
+
t[3] === e.center ? (o = t[4], c = t[5]) : (o = () => {
|
|
1873
|
+
Array.isArray(e.center) && e.center.length > 1 && n.current?.setCenter(e.center);
|
|
1874
|
+
}, c = [e.center], t[3] = e.center, t[4] = o, t[5] = c), s(o, c);
|
|
1875
|
+
let l;
|
|
1876
|
+
return t[6] === e.style ? l = t[7] : (l = /* @__PURE__ */ Z("div", {
|
|
1877
|
+
ref: r,
|
|
1878
|
+
className: "a-map-container",
|
|
1879
|
+
style: e.style
|
|
1880
|
+
}), t[6] = e.style, t[7] = l), l;
|
|
1881
|
+
}
|
|
1882
|
+
//#endregion
|
|
1883
|
+
//#region src/components/LocationPicker/components/Notice/index.tsx
|
|
1884
|
+
var Fr = (e) => {
|
|
1885
|
+
let t = Y(1), n;
|
|
1886
|
+
return t[0] === Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ Z(re, {
|
|
1887
|
+
className: "location-picker-notice-bar",
|
|
1888
|
+
message: "点击地图上的位置,选择目标地址",
|
|
1889
|
+
type: "info",
|
|
1890
|
+
showIcon: !0
|
|
1891
|
+
}), t[0] = n) : n = t[0], n;
|
|
1892
|
+
};
|
|
1893
|
+
//#endregion
|
|
1894
|
+
//#region src/components/LocationPicker/servers/index.ts
|
|
1895
|
+
function Ir(e, t) {
|
|
1896
|
+
return new Promise((n, r) => {
|
|
1897
|
+
Lr(e, t).then(n).catch((i) => {
|
|
1898
|
+
i.result === "USER_DAILY_QUERY_OVER_LIMIT" || i.result === "A_MAP_GEOCODER_IS_NOT_DEFINED" ? Rr(e, t).then(n).catch(r) : r(i);
|
|
1899
|
+
});
|
|
1900
|
+
});
|
|
1901
|
+
}
|
|
1902
|
+
var Lr = function(e, t) {
|
|
1903
|
+
return new Promise((n, r) => {
|
|
1904
|
+
if (!window.AMap?.Geocoder) {
|
|
1905
|
+
let e = Error("Error getAddress window.AMap.Geocoder is not defined.");
|
|
1906
|
+
e.result = "A_MAP_GEOCODER_IS_NOT_DEFINED", r(e);
|
|
1907
|
+
return;
|
|
1908
|
+
}
|
|
1909
|
+
new window.AMap.Geocoder({}).getAddress([e, t], function(e, t) {
|
|
1910
|
+
if (e === "complete" && t.info === "OK") {
|
|
1911
|
+
let e = t?.regeocode?.formattedAddress;
|
|
1912
|
+
return n(e), e;
|
|
1913
|
+
}
|
|
1914
|
+
if (t === "USER_DAILY_QUERY_OVER_LIMIT") {
|
|
1915
|
+
let e = /* @__PURE__ */ Error("超出使用限制,请联系管理员");
|
|
1916
|
+
e.result = t, r(e);
|
|
1917
|
+
} else r(t);
|
|
1918
|
+
});
|
|
1919
|
+
});
|
|
1920
|
+
}, Rr = function(e, t) {
|
|
1921
|
+
return new Promise((n, r) => {
|
|
1922
|
+
if (!window._AMapLoaderTemp?.serverKey) {
|
|
1923
|
+
r(/* @__PURE__ */ Error("请配置 serverKey"));
|
|
1924
|
+
return;
|
|
1925
|
+
}
|
|
1926
|
+
fetch(`https://restapi.amap.com/v3/geocode/regeo?location=${e?.toFixed(6)},${t?.toFixed(6)}&key=${window._AMapLoaderTemp.serverKey}`, { mode: "cors" }).then((e) => e.json()).then((e) => {
|
|
1927
|
+
e.status === "1" ? n(e.regeocode?.formatted_address) : (console.warn("Warn getAddressByFetch: ", e), r(Error(e.info)));
|
|
1928
|
+
}).catch(r);
|
|
1929
|
+
});
|
|
1930
|
+
};
|
|
1931
|
+
function zr(e, t = "0571") {
|
|
1932
|
+
return new Promise((n, r) => {
|
|
1933
|
+
if (!window.AMap) {
|
|
1934
|
+
r(Error("Error getSearchTips window.AMap is not defined."));
|
|
1935
|
+
return;
|
|
1936
|
+
}
|
|
1937
|
+
window.AMap.AutoComplete ? Br(e, t).then(n).catch((i) => {
|
|
1938
|
+
i.result === "USER_DAILY_QUERY_OVER_LIMIT" || i.result === "A_MAP_AUTO_COMPLETE_IS_NOT_DEFINED" ? Vr(e, t).then(n).catch(r) : r(i);
|
|
1939
|
+
}) : Vr(e, t).then(n).catch(r);
|
|
1940
|
+
});
|
|
1941
|
+
}
|
|
1942
|
+
function Br(e, t = "0571") {
|
|
1943
|
+
return new Promise((n, r) => {
|
|
1944
|
+
if (!window.AMap?.Autocomplete) {
|
|
1945
|
+
let e = Error("Error getSearchTips window.AMap.Autocomplete is not defined.");
|
|
1946
|
+
e.result = "A_MAP_AUTO_COMPLETE_IS_NOT_DEFINED", r(e);
|
|
1947
|
+
return;
|
|
1948
|
+
}
|
|
1949
|
+
new window.AMap.Autocomplete({ city: t }).search(e, function(e, t) {
|
|
1950
|
+
e === "complete" && t.info === "OK" ? n(t.tips?.map((e) => {
|
|
1951
|
+
let { lng: t, lat: n } = e?.location || {};
|
|
1952
|
+
return {
|
|
1953
|
+
...e,
|
|
1954
|
+
label: e.name,
|
|
1955
|
+
value: e.id,
|
|
1956
|
+
lon: +t,
|
|
1957
|
+
lng: +t,
|
|
1958
|
+
lat: +n
|
|
1959
|
+
};
|
|
1960
|
+
})) : r(t);
|
|
1961
|
+
});
|
|
1962
|
+
});
|
|
1963
|
+
}
|
|
1964
|
+
function Vr(e, t = "0571") {
|
|
1965
|
+
return new Promise((n, r) => {
|
|
1966
|
+
if (!window._AMapLoaderTemp?.serverKey) {
|
|
1967
|
+
r(/* @__PURE__ */ Error("请配置 serverKey"));
|
|
1968
|
+
return;
|
|
1969
|
+
}
|
|
1970
|
+
fetch(`https://restapi.amap.com/v3/assistant/inputtips?key=${window._AMapLoaderTemp.serverKey}&keywords=${e}&city=${t}`, { mode: "cors" }).then((e) => e.json()).then((e) => {
|
|
1971
|
+
e.status === "1" ? n(e.tips?.map((e) => {
|
|
1972
|
+
let [t, n] = e.location?.split(",");
|
|
1973
|
+
return {
|
|
1974
|
+
...e,
|
|
1975
|
+
label: e.name,
|
|
1976
|
+
value: e.id,
|
|
1977
|
+
lng: +t,
|
|
1978
|
+
lon: +t,
|
|
1979
|
+
lat: +n
|
|
1980
|
+
};
|
|
1981
|
+
})) : (console.warn("Warn getSearchTips fetch: ", e), r(Error(e.info)));
|
|
1982
|
+
}).catch(r);
|
|
1983
|
+
});
|
|
1984
|
+
}
|
|
1985
|
+
//#endregion
|
|
1986
|
+
//#region src/components/LocationPicker/components/MapSearch/index.jsx
|
|
1987
|
+
var Hr = "0571";
|
|
1988
|
+
function Ur(e) {
|
|
1989
|
+
let t = Y(15), [n, r] = d(!1), i;
|
|
1990
|
+
t[0] === Symbol.for("react.memo_cache_sentinel") ? (i = [], t[0] = i) : i = t[0];
|
|
1991
|
+
let [a, o] = d(i), s;
|
|
1992
|
+
t[1] === e ? s = t[2] : (s = function(t, n) {
|
|
1993
|
+
let { lng: r, lat: i } = n || {};
|
|
1994
|
+
e.setPoint && e.setPoint(r, i, { changeCenter: !0 });
|
|
1995
|
+
}, t[1] = e, t[2] = s);
|
|
1996
|
+
let c = s, l;
|
|
1997
|
+
t[3] === e.cityCode ? l = t[4] : (l = function(t) {
|
|
1998
|
+
if (!t) {
|
|
1999
|
+
o([]);
|
|
2000
|
+
return;
|
|
2001
|
+
}
|
|
2002
|
+
r(!0), zr(t, e.cityCode || Hr).then((e) => {
|
|
2003
|
+
o(e?.map(Wr)), r(!1);
|
|
2004
|
+
}).catch((e) => {
|
|
2005
|
+
r(!1);
|
|
2006
|
+
});
|
|
2007
|
+
}, t[3] = e.cityCode, t[4] = l);
|
|
2008
|
+
let u = l, f;
|
|
2009
|
+
t[5] === u ? f = t[6] : (f = _.debounce(u, 500), t[5] = u, t[6] = f);
|
|
2010
|
+
let p;
|
|
2011
|
+
t[7] === Symbol.for("react.memo_cache_sentinel") ? (p = () => {
|
|
2012
|
+
o([]);
|
|
2013
|
+
}, t[7] = p) : p = t[7];
|
|
2014
|
+
let m;
|
|
2015
|
+
t[8] === n ? m = t[9] : (m = /* @__PURE__ */ Z(le.Search, {
|
|
2016
|
+
allowClear: !0,
|
|
2017
|
+
loading: n,
|
|
2018
|
+
placeholder: "请输入"
|
|
2019
|
+
}), t[8] = n, t[9] = m);
|
|
2020
|
+
let h;
|
|
2021
|
+
return t[10] !== c || t[11] !== f || t[12] !== m || t[13] !== a ? (h = /* @__PURE__ */ Z(ie, {
|
|
2022
|
+
className: "location-map-search",
|
|
2023
|
+
options: a,
|
|
2024
|
+
onSelect: c,
|
|
2025
|
+
onSearch: f,
|
|
2026
|
+
onClear: p,
|
|
2027
|
+
children: m
|
|
2028
|
+
}), t[10] = c, t[11] = f, t[12] = m, t[13] = a, t[14] = h) : h = t[14], h;
|
|
2029
|
+
}
|
|
2030
|
+
function Wr(e) {
|
|
2031
|
+
return {
|
|
2032
|
+
...e,
|
|
2033
|
+
label: e.name,
|
|
2034
|
+
value: e.name
|
|
2035
|
+
};
|
|
2036
|
+
}
|
|
2037
|
+
//#endregion
|
|
2038
|
+
//#region src/common/location-utils.ts
|
|
2039
|
+
function Gr(e) {
|
|
2040
|
+
return new Promise((t, n) => {
|
|
2041
|
+
navigator?.geolocation?.getCurrentPosition((e) => {
|
|
2042
|
+
t(e);
|
|
2043
|
+
}, n, {
|
|
2044
|
+
enableHighAccuracy: !0,
|
|
2045
|
+
timeout: 5e3,
|
|
2046
|
+
...e
|
|
2047
|
+
});
|
|
2048
|
+
});
|
|
2049
|
+
}
|
|
2050
|
+
//#endregion
|
|
2051
|
+
//#region src/components/LocationPicker/components/ModalContent/index.tsx
|
|
2052
|
+
var Kr = b((e) => {
|
|
2053
|
+
let { mode: t, element: n = "Polypoint", layout: r = "ver", hasSearch: i = !0, isAutoFixAddr: a = !1, lonKey: o = "longitude", latKey: c = "latitude", addrKey: f = "address", pointsKey: p = "points", rangeKey: m = "range", value: h, isAutoSearch: g = !0, visible: v, visibleKey: y, defaultLocation: b = {}, disabled: x, readOnly: S, icons: C, markerIconConf: w, getCurPositionConf: T, init: E } = e, D = u(), O = l(() => Er(h, {
|
|
2054
|
+
lonKey: o,
|
|
2055
|
+
latKey: c,
|
|
2056
|
+
addrKey: f,
|
|
2057
|
+
pointsKey: p,
|
|
2058
|
+
rangeKey: m
|
|
2059
|
+
}), [
|
|
2060
|
+
o,
|
|
2061
|
+
c,
|
|
2062
|
+
f,
|
|
2063
|
+
p,
|
|
2064
|
+
m,
|
|
2065
|
+
h,
|
|
2066
|
+
h?.[m],
|
|
2067
|
+
h?.[p],
|
|
2068
|
+
h?.[o],
|
|
2069
|
+
h?.[c],
|
|
2070
|
+
h?.[f]
|
|
2071
|
+
]), [k, A] = d(e.loading || !1), [j, M] = d(!1), [N, P] = d(O), F = u(N), I = u(O), L = t === "show";
|
|
2072
|
+
s(() => {
|
|
2073
|
+
A(e.loading);
|
|
2074
|
+
}, [e.loading]), s(() => {
|
|
2075
|
+
if (L) {
|
|
2076
|
+
let e = O.lon, t = O.lat, r = O.points;
|
|
2077
|
+
I.current = { ...O }, e && t && e !== N.lon && t !== N.lat && (window.AMap && window.AMap.LngLat ? (H(e, t), n === "Polypoint" ? U(e, t, {
|
|
2078
|
+
isAutoFixAddr: !1,
|
|
2079
|
+
addr: O.addr
|
|
2080
|
+
}) : B(r || [])) : window._AMapLoaderTemp?.promise?.then(() => {
|
|
2081
|
+
H(e, t), n === "Polypoint" ? U(e, t, {
|
|
2082
|
+
isAutoFixAddr: !1,
|
|
2083
|
+
addr: O.addr
|
|
2084
|
+
}) : B(r || []);
|
|
2085
|
+
}));
|
|
2086
|
+
} else if (y) {
|
|
2087
|
+
let e = b.lon, t = b.lat, r = b.points || [], i = b.addr;
|
|
2088
|
+
O.lon && O.lat && (e = O.lon, t = O.lat, i = O.addr), window.AMap && window.AMap.LngLat ? H(e, t) : window._AMapLoaderTemp?.promise?.then(() => {
|
|
2089
|
+
H(e, t);
|
|
2090
|
+
}), e && t && e !== F.current?.lon && t !== F.current?.lat && (n === "Polypoint" ? U(e, t, {
|
|
2091
|
+
isAutoFixAddr: !1,
|
|
2092
|
+
addr: i
|
|
2093
|
+
}) : B(r || []));
|
|
2094
|
+
}
|
|
2095
|
+
return E({ editDone: R }), () => {
|
|
2096
|
+
D.current?.off("dblclick", R), D.current?.off("click", z);
|
|
2097
|
+
};
|
|
2098
|
+
}, []);
|
|
2099
|
+
async function R() {
|
|
2100
|
+
if (n !== "Polypoint") {
|
|
2101
|
+
let t = D.current.polyEditor[`${n}Editor`].getTarget();
|
|
2102
|
+
if (t) {
|
|
2103
|
+
let r = t.getPath().map((e) => [e.lng, e.lat]), i = D.current.getPolygonCenter(r), a = await W(i[0], i[1]);
|
|
2104
|
+
D.current.polyEditor[`${n}Editor`].close(), D.current.polyEditor[`${n}Editor`].setTarget(), e.setPickInfo && e.setPickInfo({
|
|
2105
|
+
points: r,
|
|
2106
|
+
addr: a,
|
|
2107
|
+
lon: i[0],
|
|
2108
|
+
lat: i[1]
|
|
2109
|
+
}), P({
|
|
2110
|
+
points: r,
|
|
2111
|
+
addr: a,
|
|
2112
|
+
lon: i[0],
|
|
2113
|
+
lat: i[1],
|
|
2114
|
+
range: 0
|
|
2115
|
+
});
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
function ee({ map: t, mapUtils: r }) {
|
|
2120
|
+
D.current = r, D.current.on("dblclick", R);
|
|
2121
|
+
let i = b.lon, a = b.lat, o = b.points, s = b.range;
|
|
2122
|
+
N.lon && N.lat ? (i = N.lon, a = N.lat, o = N.points, s = N.range) : I.current?.lon && I.current?.lat && (i = I.current?.lon, a = I.current?.lat, o = I.current?.points, s = I.current?.range), H(i, a), A(e.loading || !1), x || S ? n === "Polypoint" ? (D.current?.setPickerMarker(i, a), D.current.setCircle(i, a, s)) : B(o, !0) : n === "Polypoint" ? (D.current?.setPickerMarker(i, a), D.current.on("click", z)) : (D.current?.createPoly(n), o.length == 0 && (D.current?.startPolygon({
|
|
2123
|
+
onClick: V,
|
|
2124
|
+
element: n
|
|
2125
|
+
}), D.current.setDrawPolygon({ element: n })), B(o));
|
|
2126
|
+
}
|
|
2127
|
+
function z(e) {
|
|
2128
|
+
let { lng: t, lat: r } = e.lnglat || {};
|
|
2129
|
+
n === "Polypoint" && U(t, r, { changeCenter: !0 });
|
|
2130
|
+
}
|
|
2131
|
+
function B(e, t = !1) {
|
|
2132
|
+
D.current && (D.current?.createPoly(n), e && e.length > 0 && D.current?.setPolygon({
|
|
2133
|
+
points: e,
|
|
2134
|
+
id: "setDrawEditor",
|
|
2135
|
+
element: n,
|
|
2136
|
+
onClick: !t && V
|
|
2137
|
+
}));
|
|
2138
|
+
}
|
|
2139
|
+
function V(e) {
|
|
2140
|
+
D.current.setEditPolygon({
|
|
2141
|
+
...e.target,
|
|
2142
|
+
element: n
|
|
2143
|
+
});
|
|
2144
|
+
}
|
|
2145
|
+
function H(e = N.lon, t = N.lat) {
|
|
2146
|
+
e && t && D.current?.setCenter(e, t);
|
|
2147
|
+
}
|
|
2148
|
+
async function U(t, n, r) {
|
|
2149
|
+
let { isAutoFixAddr: i = a || !0, changeCenter: o, addr: s } = r || {}, c = t || N.lon, l = n || N.lat, u = s;
|
|
2150
|
+
D.current?.setPickerMarker(t, n), o && H(t, n), i && !u && (u = await W(c, l));
|
|
2151
|
+
let d = {
|
|
2152
|
+
...N,
|
|
2153
|
+
lon: c,
|
|
2154
|
+
lat: l,
|
|
2155
|
+
addr: u
|
|
2156
|
+
};
|
|
2157
|
+
P(d), F.current = d, e.setPickInfo && e.setPickInfo(d);
|
|
2158
|
+
}
|
|
2159
|
+
function W(e, t) {
|
|
2160
|
+
return new Promise((n, r) => {
|
|
2161
|
+
if (!window.AMap) return r(), /* @__PURE__ */ Error("window.AMap is not defined");
|
|
2162
|
+
M(!0), Ir(e, t).then((e) => {
|
|
2163
|
+
M(!1), P((t) => (F.current = {
|
|
2164
|
+
...t,
|
|
2165
|
+
addr: e
|
|
2166
|
+
}, F.current)), n(e);
|
|
2167
|
+
}).catch((e) => {
|
|
2168
|
+
r(e), we.error(e), M(!1);
|
|
2169
|
+
});
|
|
2170
|
+
});
|
|
2171
|
+
}
|
|
2172
|
+
function te() {
|
|
2173
|
+
H();
|
|
2174
|
+
}
|
|
2175
|
+
function ne() {
|
|
2176
|
+
A(!0), Gr(T).then((e) => {
|
|
2177
|
+
let { coords: t = {} } = e;
|
|
2178
|
+
U(t.longitude, t.latitude, { changeCenter: !0 }), A(!1);
|
|
2179
|
+
}).catch((e) => {
|
|
2180
|
+
A(!1), we.error("定位获取失败"), console.warn("Error getCurrentPosition e: ", e);
|
|
2181
|
+
});
|
|
2182
|
+
}
|
|
2183
|
+
let re = e.showGetPositionBtn !== !1 && !(x || S), { markerIcon: ie, positionIcon: G, resetIcon: ae } = C || {};
|
|
2184
|
+
return /* @__PURE__ */ Q("div", {
|
|
2185
|
+
className: `location-picker-modal-content location-mode-${t} location-modal-content-layout-${r}`,
|
|
2186
|
+
children: [
|
|
2187
|
+
/* @__PURE__ */ Z(Or, {
|
|
2188
|
+
element: n,
|
|
2189
|
+
pickInfo: N,
|
|
2190
|
+
setPickInfo: P,
|
|
2191
|
+
setPoint: U,
|
|
2192
|
+
addrLoading: j,
|
|
2193
|
+
defaultLocation: b,
|
|
2194
|
+
disabled: x,
|
|
2195
|
+
readOnly: n !== "Polypoint" || S
|
|
2196
|
+
}),
|
|
2197
|
+
/* @__PURE__ */ Q("div", {
|
|
2198
|
+
className: "location-picker-map-wrap",
|
|
2199
|
+
children: [/* @__PURE__ */ Q("div", {
|
|
2200
|
+
className: "location-picker-map",
|
|
2201
|
+
children: [
|
|
2202
|
+
i && !x && !S ? /* @__PURE__ */ Z(Ur, {
|
|
2203
|
+
setPoint: n !== "Polypoint" && (S || x) ? H : U,
|
|
2204
|
+
isAutoSearch: g
|
|
2205
|
+
}, v) : null,
|
|
2206
|
+
/* @__PURE__ */ Z(Pr, {
|
|
2207
|
+
init: ee,
|
|
2208
|
+
loading: k,
|
|
2209
|
+
markerIconConf: w
|
|
2210
|
+
}),
|
|
2211
|
+
/* @__PURE__ */ Q("div", {
|
|
2212
|
+
className: "set-map-actions",
|
|
2213
|
+
children: [/* @__PURE__ */ Z("div", {
|
|
2214
|
+
className: "actions-icon-box reset-icon-box",
|
|
2215
|
+
onClick: te,
|
|
2216
|
+
children: typeof ae == "string" ? /* @__PURE__ */ Z("img", {
|
|
2217
|
+
className: "reset-icon",
|
|
2218
|
+
src: ae
|
|
2219
|
+
}) : ae || Tr
|
|
2220
|
+
}), re && n === "Polypoint" ? /* @__PURE__ */ Z("div", {
|
|
2221
|
+
className: "actions-icon-box center-icon-box",
|
|
2222
|
+
onClick: ne,
|
|
2223
|
+
children: typeof G == "string" ? /* @__PURE__ */ Z("img", {
|
|
2224
|
+
className: "center-icon",
|
|
2225
|
+
src: G
|
|
2226
|
+
}) : G || wr
|
|
2227
|
+
}) : null]
|
|
2228
|
+
})
|
|
2229
|
+
]
|
|
2230
|
+
}), x || S ? null : /* @__PURE__ */ Z(Fr, {})]
|
|
2231
|
+
}),
|
|
2232
|
+
k && /* @__PURE__ */ Z("div", {
|
|
2233
|
+
className: "spin-loading-wrap",
|
|
2234
|
+
children: /* @__PURE__ */ Z(be, { className: "spin-loading" })
|
|
2235
|
+
})
|
|
2236
|
+
]
|
|
2237
|
+
});
|
|
2238
|
+
}), qr = b(function(e) {
|
|
2239
|
+
let { mode: t = "dialog", element: n = "Polypoint", layout: r = "ver", hasSearch: i = !0, isAutoFixAddr: a = !1, lonKey: o = "longitude", latKey: c = "latitude", addrKey: l = "address", pointsKey: f = "points", value: p, isAutoSearch: m = !0, modalConf: h = {}, icons: g = {}, getCurPositionConf: v } = e, [y, b] = d(!1), [x, S] = d({
|
|
2240
|
+
lon: "",
|
|
2241
|
+
lat: "",
|
|
2242
|
+
addr: "",
|
|
2243
|
+
points: []
|
|
2244
|
+
}), [C, w] = d(t === "show"), [T, E] = d(0), D = u(x), O = u();
|
|
2245
|
+
s(() => {
|
|
2246
|
+
let e = Er(p, {
|
|
2247
|
+
lonKey: o,
|
|
2248
|
+
latKey: c,
|
|
2249
|
+
addrKey: l,
|
|
2250
|
+
pointsKey: f
|
|
2251
|
+
});
|
|
2252
|
+
P(e), !e.lon || !e.lat ? (b(!0), Gr(v).then(async (e) => {
|
|
2253
|
+
let { coords: t = {} } = e, n = t.longitude, r = t.latitude, i = await Ir(n, r).then((e) => e);
|
|
2254
|
+
D.current = {
|
|
2255
|
+
lon: n,
|
|
2256
|
+
lat: r,
|
|
2257
|
+
addr: i,
|
|
2258
|
+
points: []
|
|
2259
|
+
}, S(D.current), b(!1);
|
|
2260
|
+
}).catch((e) => {
|
|
2261
|
+
console.warn("Error LocationPicker getCurrentPosition e: ", e), b(!1);
|
|
2262
|
+
})) : b(!1);
|
|
2263
|
+
}, []);
|
|
2264
|
+
function k() {
|
|
2265
|
+
w(!0), E(Date.now());
|
|
2266
|
+
}
|
|
2267
|
+
function A() {
|
|
2268
|
+
w(!1), E(Date.now());
|
|
2269
|
+
}
|
|
2270
|
+
function j(t = D.current) {
|
|
2271
|
+
let n = t || D.current, r = {
|
|
2272
|
+
[o]: n.lon,
|
|
2273
|
+
[c]: n.lat,
|
|
2274
|
+
[l]: n.addr,
|
|
2275
|
+
[f]: n.points
|
|
2276
|
+
};
|
|
2277
|
+
e.onChange && e.onChange(r);
|
|
2278
|
+
}
|
|
2279
|
+
async function M() {
|
|
2280
|
+
n !== "Polypoint" && await O.current?.editDone(), j(), A();
|
|
2281
|
+
}
|
|
2282
|
+
function N(e) {
|
|
2283
|
+
P(e), j(e);
|
|
2284
|
+
}
|
|
2285
|
+
function P(e) {
|
|
2286
|
+
D.current = e;
|
|
2287
|
+
}
|
|
2288
|
+
let F = r === "hor" || r === "hor-reverse", I = {
|
|
2289
|
+
...e,
|
|
2290
|
+
mode: t ?? "dialog",
|
|
2291
|
+
element: n ?? "Polypoint",
|
|
2292
|
+
layout: r ?? "ver",
|
|
2293
|
+
hasSearch: i ?? !0,
|
|
2294
|
+
isAutoFixAddr: a ?? !1,
|
|
2295
|
+
lonKey: o ?? "longitude",
|
|
2296
|
+
latKey: c ?? "latitude",
|
|
2297
|
+
addrKey: l ?? "address",
|
|
2298
|
+
pointsKey: f ?? "points",
|
|
2299
|
+
isAutoSearch: m ?? !0,
|
|
2300
|
+
visible: C,
|
|
2301
|
+
visibleKey: T,
|
|
2302
|
+
defaultLocation: x,
|
|
2303
|
+
loading: y,
|
|
2304
|
+
setLoading: b
|
|
2305
|
+
};
|
|
2306
|
+
function L(e) {
|
|
2307
|
+
O.current = e;
|
|
2308
|
+
}
|
|
2309
|
+
return /* @__PURE__ */ Q("div", {
|
|
2310
|
+
className: "location-picker",
|
|
2311
|
+
children: [t === "show" && /* @__PURE__ */ Z(Kr, {
|
|
2312
|
+
...I,
|
|
2313
|
+
setPickInfo: N,
|
|
2314
|
+
init: L
|
|
2315
|
+
}), t === "dialog" && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(Dr, {
|
|
2316
|
+
...I,
|
|
2317
|
+
onShow: k,
|
|
2318
|
+
pickerIcon: g.pickerIcon
|
|
2319
|
+
}), /* @__PURE__ */ Z(fe, {
|
|
2320
|
+
className: "location-picker-modal",
|
|
2321
|
+
title: "地图选点",
|
|
2322
|
+
onCancel: A,
|
|
2323
|
+
onOk: M,
|
|
2324
|
+
visible: C,
|
|
2325
|
+
width: h?.width || F ? "1024px" : "720px",
|
|
2326
|
+
children: /* @__PURE__ */ Z(Kr, {
|
|
2327
|
+
...I,
|
|
2328
|
+
setPickInfo: P,
|
|
2329
|
+
init: L
|
|
2330
|
+
})
|
|
2331
|
+
})] })]
|
|
2332
|
+
});
|
|
2333
|
+
}), Jr = (e) => {
|
|
2334
|
+
let t = Y(14), { readOnly: n, disabled: r, list: i, ItemRender: a, onItemClick: o, onEdit: s, onDel: c, hasAction: l, activeId: u, onDelClick: d, onDelCancel: f } = e, p = l === void 0 || l, m = a ?? Yr, h;
|
|
2335
|
+
t[0] !== m || t[1] !== u || t[2] !== r || t[3] !== p || t[4] !== i || t[5] !== c || t[6] !== f || t[7] !== d || t[8] !== s || t[9] !== o || t[10] !== n ? (h = i?.map((e, t) => {
|
|
2336
|
+
let i = /* @__PURE__ */ Z(Ae, {
|
|
2337
|
+
className: `action-btn del-btn ${r ? "disabled" : ""}`,
|
|
2338
|
+
onClick: (n) => !r && d && d(e, t, n)
|
|
2339
|
+
});
|
|
2340
|
+
return /* @__PURE__ */ Q("div", {
|
|
2341
|
+
className: `addr-item ${u === e.id ? "active" : ""}`,
|
|
2342
|
+
children: [/* @__PURE__ */ Z("div", {
|
|
2343
|
+
className: "addr-item-content",
|
|
2344
|
+
onClick: (n) => o(e, t, n),
|
|
2345
|
+
children: /* @__PURE__ */ Z(m, {
|
|
2346
|
+
item: e,
|
|
2347
|
+
index: t
|
|
2348
|
+
})
|
|
2349
|
+
}), !n && p && /* @__PURE__ */ Q("div", {
|
|
2350
|
+
className: "action-box",
|
|
2351
|
+
children: [/* @__PURE__ */ Z(Me, {
|
|
2352
|
+
className: `action-btn edit-btn ${r ? "disabled" : ""}`,
|
|
2353
|
+
onClick: (n) => !r && s && s(e, t, n)
|
|
2354
|
+
}), r ? i : /* @__PURE__ */ Z(me, {
|
|
2355
|
+
title: "确认删除当前项?",
|
|
2356
|
+
onConfirm: (n) => c && c(e, t, n),
|
|
2357
|
+
onOpenChange: (n) => n === !1 && f && f(e, t),
|
|
2358
|
+
children: i
|
|
2359
|
+
})]
|
|
2360
|
+
})]
|
|
2361
|
+
}, e.id ?? t);
|
|
2362
|
+
}), t[0] = m, t[1] = u, t[2] = r, t[3] = p, t[4] = i, t[5] = c, t[6] = f, t[7] = d, t[8] = s, t[9] = o, t[10] = n, t[11] = h) : h = t[11];
|
|
2363
|
+
let g;
|
|
2364
|
+
return t[12] === h ? g = t[13] : (g = /* @__PURE__ */ Z("div", {
|
|
2365
|
+
className: "addr-list",
|
|
2366
|
+
children: h
|
|
2367
|
+
}), t[12] = h, t[13] = g), g;
|
|
2368
|
+
};
|
|
2369
|
+
function Yr(e) {
|
|
2370
|
+
let t = Y(9), { item: n } = e, r;
|
|
2371
|
+
t[0] === n ? r = t[1] : (r = n || {}, t[0] = n, t[1] = r);
|
|
2372
|
+
let { address: i, range: a } = r, o;
|
|
2373
|
+
t[2] === i ? o = t[3] : (o = /* @__PURE__ */ Z("div", {
|
|
2374
|
+
className: "item-addr",
|
|
2375
|
+
children: i
|
|
2376
|
+
}), t[2] = i, t[3] = o);
|
|
2377
|
+
let s;
|
|
2378
|
+
t[4] === a ? s = t[5] : (s = a && /* @__PURE__ */ Q("span", {
|
|
2379
|
+
className: "item-range",
|
|
2380
|
+
children: [
|
|
2381
|
+
"(范围:",
|
|
2382
|
+
a,
|
|
2383
|
+
")"
|
|
2384
|
+
]
|
|
2385
|
+
}), t[4] = a, t[5] = s);
|
|
2386
|
+
let c;
|
|
2387
|
+
return t[6] !== o || t[7] !== s ? (c = /* @__PURE__ */ Q("div", {
|
|
2388
|
+
className: "item-content",
|
|
2389
|
+
children: [o, s]
|
|
2390
|
+
}), t[6] = o, t[7] = s, t[8] = c) : c = t[8], c;
|
|
2391
|
+
}
|
|
2392
|
+
var Xr = Dt("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 20), Zr = [
|
|
2393
|
+
"$form",
|
|
2394
|
+
"$self",
|
|
2395
|
+
"$observable",
|
|
2396
|
+
"$effect",
|
|
2397
|
+
"$memo",
|
|
2398
|
+
"$props",
|
|
2399
|
+
"$values"
|
|
2400
|
+
], Qr = ["ArrayTable", "ArrayCards"], $r = ["FormCollapse", "FormCollapse.CollapsePanel"], ei = (e, t) => {
|
|
2401
|
+
let { schemaScope: n, onChange: r, formRender: i, parent: a, isCloneDeep: o = !0 } = t || {}, s = o ? gt.cloneDeep(e) : e;
|
|
2402
|
+
return s = s.schema || s, Object.keys(s.properties || {})?.forEach((e) => {
|
|
2403
|
+
let o = s.properties[e];
|
|
2404
|
+
if (!o) return;
|
|
2405
|
+
let c = o["x-component"];
|
|
2406
|
+
o.name = e;
|
|
2407
|
+
let l = o?.["x-component-props"];
|
|
2408
|
+
l ? oi(l, n) && (o["x-component-props"] = si(l, n) || {}) : o["x-component-props"] = {};
|
|
2409
|
+
let u = {
|
|
2410
|
+
componentName: c,
|
|
2411
|
+
target: o["x-component-props"],
|
|
2412
|
+
targetKey: e,
|
|
2413
|
+
targetId: e,
|
|
2414
|
+
formOnChange: r,
|
|
2415
|
+
schemaScope: n,
|
|
2416
|
+
formRender: i,
|
|
2417
|
+
parent: a
|
|
2418
|
+
};
|
|
2419
|
+
$r.includes(c) || ti({
|
|
2420
|
+
...u,
|
|
2421
|
+
actionName: "onChange"
|
|
2422
|
+
}), Qr.includes(c) && (ei(o.items, {
|
|
2423
|
+
...t,
|
|
2424
|
+
parent: o,
|
|
2425
|
+
isCloneDeep: !1
|
|
2426
|
+
}), [
|
|
2427
|
+
"onAdd",
|
|
2428
|
+
"onCopy",
|
|
2429
|
+
"onRemove",
|
|
2430
|
+
"onMoveDown",
|
|
2431
|
+
"onMoveUp"
|
|
2432
|
+
].forEach((e) => {
|
|
2433
|
+
ti({
|
|
2434
|
+
...u,
|
|
2435
|
+
actionName: e
|
|
2436
|
+
});
|
|
2437
|
+
})), o.properties && ei(o, {
|
|
2438
|
+
...t,
|
|
2439
|
+
isCloneDeep: !1
|
|
2440
|
+
});
|
|
2441
|
+
}), s;
|
|
2442
|
+
}, ti = (e) => {
|
|
2443
|
+
let { target: t, actionName: n, schemaScope: r, formOnChange: i } = e || {}, a = t[n];
|
|
2444
|
+
r._$tempData ||= {};
|
|
2445
|
+
let o = "fnKey_" + Xr();
|
|
2446
|
+
r._$tempData[o] = function(t, n) {
|
|
2447
|
+
let { $form: o, $self: s, $observable: c, $effect: l, $memo: u, $props: d, $values: f } = t, p = ni({
|
|
2448
|
+
...e,
|
|
2449
|
+
sourceArgs: n
|
|
2450
|
+
});
|
|
2451
|
+
if (ri(a)) {
|
|
2452
|
+
let e = ai(a, {
|
|
2453
|
+
...t,
|
|
2454
|
+
...r
|
|
2455
|
+
});
|
|
2456
|
+
typeof e == "function" && e(...n, p);
|
|
2457
|
+
} else typeof a == "function" && a(...n, p);
|
|
2458
|
+
i && i(p);
|
|
2459
|
+
}, t[n] = `{{
|
|
2460
|
+
function t() {
|
|
2461
|
+
// 执行 ${o} 唯一函数,formily 当前函数作用域相关参数
|
|
2462
|
+
return _$tempData && _$tempData.${o} && _$tempData.${o}(
|
|
2463
|
+
{ ${Zr.join(", ")} },
|
|
2464
|
+
arguments
|
|
2465
|
+
);
|
|
2466
|
+
}
|
|
2467
|
+
}}`;
|
|
2468
|
+
}, ni = (e) => {
|
|
2469
|
+
let { formRender: t, targetKey: n, actionName: r, sourceArgs: i } = e || {};
|
|
2470
|
+
return {
|
|
2471
|
+
key: n,
|
|
2472
|
+
actionName: r,
|
|
2473
|
+
formRender: t,
|
|
2474
|
+
formValues: t.values,
|
|
2475
|
+
sourceArgs: i
|
|
2476
|
+
};
|
|
2477
|
+
}, ri = (e) => {
|
|
2478
|
+
if (typeof e != "string") return !1;
|
|
2479
|
+
let t = e.trim();
|
|
2480
|
+
return t.startsWith("{{") && t.endsWith("}}");
|
|
2481
|
+
}, ii = (e) => ri(e) ? e.trim().replace(/^\{\{/, "").replace(/\}\}$/, "") : "", ai = (e, t) => {
|
|
2482
|
+
let n = ii(e);
|
|
2483
|
+
return n ? si(n, t) || Function("$root", `with($root) { return (${n}) }`)(t) : e;
|
|
2484
|
+
}, oi = (e, t) => {
|
|
2485
|
+
let n = ii(e);
|
|
2486
|
+
if (!t || typeof t != "object") throw Error("请传入正确的 schema scope");
|
|
2487
|
+
return t?.[n] ? n : !1;
|
|
2488
|
+
}, si = (e, t) => oi(e, t) ? t[ii(e)] : "", ci = i((e, t) => {
|
|
2489
|
+
let n = u({
|
|
2490
|
+
scenario: "form-render",
|
|
2491
|
+
_$tempData: {},
|
|
2492
|
+
...e.schemaScope
|
|
2493
|
+
}), r = a(v({
|
|
2494
|
+
components: {
|
|
2495
|
+
ArrayTable: w,
|
|
2496
|
+
ArrayCards: C,
|
|
2497
|
+
Space: V,
|
|
2498
|
+
FormGrid: j,
|
|
2499
|
+
FormLayout: N,
|
|
2500
|
+
FormTab: P,
|
|
2501
|
+
FormCollapse: A,
|
|
2502
|
+
FormItem: M,
|
|
2503
|
+
DatePicker: D,
|
|
2504
|
+
Checkbox: E,
|
|
2505
|
+
Cascader: T,
|
|
2506
|
+
Editable: O,
|
|
2507
|
+
Input: F,
|
|
2508
|
+
NumberPicker: I,
|
|
2509
|
+
Switch: U,
|
|
2510
|
+
Password: L,
|
|
2511
|
+
PreviewText: R,
|
|
2512
|
+
Radio: ee,
|
|
2513
|
+
Reset: z,
|
|
2514
|
+
Select: B,
|
|
2515
|
+
Submit: H,
|
|
2516
|
+
TimePicker: W,
|
|
2517
|
+
Transfer: te,
|
|
2518
|
+
TreeSelect: ne,
|
|
2519
|
+
Card: oe,
|
|
2520
|
+
Slider: ve,
|
|
2521
|
+
Rate: ge,
|
|
2522
|
+
...vi,
|
|
2523
|
+
...Te(),
|
|
2524
|
+
...e.components
|
|
2525
|
+
},
|
|
2526
|
+
scope: n.current
|
|
2527
|
+
}), []), i = l(() => f({
|
|
2528
|
+
initialValues: e.initialValues,
|
|
2529
|
+
readOnly: e.readOnly,
|
|
2530
|
+
disabled: e.disabled,
|
|
2531
|
+
...e.formOptions || {},
|
|
2532
|
+
effects(...t) {
|
|
2533
|
+
e.onFormValuesChange && m(e.onFormValuesChange), e.onFieldValueChange && p("*", e.onFieldValueChange), e.formOptions?.effects && e.formOptions?.effects(...t);
|
|
2534
|
+
}
|
|
2535
|
+
}), []), o = (t) => {
|
|
2536
|
+
e.onSubmit(t);
|
|
2537
|
+
}, d = (t) => {
|
|
2538
|
+
e.onSubmitFailed(t);
|
|
2539
|
+
};
|
|
2540
|
+
c(t, () => ({ formRender: i })), s(() => {
|
|
2541
|
+
e.init && e.init(i);
|
|
2542
|
+
}, []);
|
|
2543
|
+
let h = l(() => {
|
|
2544
|
+
let { Slots: t } = e;
|
|
2545
|
+
if (typeof t == "function") return /* @__PURE__ */ Z(t, {});
|
|
2546
|
+
if (typeof t?.footer == "function") return /* @__PURE__ */ Z(t.footer, {});
|
|
2547
|
+
}, [e.Slots]), g = { ...e.schema?.form }, y = l(() => ei(e.schema, {
|
|
2548
|
+
schemaScope: n.current,
|
|
2549
|
+
onChange: e.onChange,
|
|
2550
|
+
formRender: i
|
|
2551
|
+
}), []);
|
|
2552
|
+
return /* @__PURE__ */ Z(Xn.Provider, {
|
|
2553
|
+
value: e,
|
|
2554
|
+
children: /* @__PURE__ */ Z(k, {
|
|
2555
|
+
className: `form-render ${e.className}`,
|
|
2556
|
+
layout: e.layout,
|
|
2557
|
+
form: i,
|
|
2558
|
+
labelCol: e.schema.form.labelCol,
|
|
2559
|
+
wrapperCol: e.schema.form.wrapperCol,
|
|
2560
|
+
onAutoSubmit: o,
|
|
2561
|
+
onAutoSubmitFailed: d,
|
|
2562
|
+
previewTextPlaceholder: e?.emptyValue,
|
|
2563
|
+
children: /* @__PURE__ */ Q(N, {
|
|
2564
|
+
...g,
|
|
2565
|
+
children: [/* @__PURE__ */ Z(r, { schema: y }), /* @__PURE__ */ Z("div", {
|
|
2566
|
+
className: "form-render-footer xxm",
|
|
2567
|
+
children: h
|
|
2568
|
+
})]
|
|
2569
|
+
})
|
|
2570
|
+
})
|
|
2571
|
+
});
|
|
2572
|
+
});
|
|
2573
|
+
//#endregion
|
|
2574
|
+
//#region src/common/schema-merge.ts
|
|
2575
|
+
function li(e, t, n = "") {
|
|
2576
|
+
let r = {
|
|
2577
|
+
form: e.form,
|
|
2578
|
+
schema: gt.cloneDeep(e.schema)
|
|
2579
|
+
}, i = Object.keys(r.schema.properties).length;
|
|
2580
|
+
return n && (r.schema.properties.insideTitle = {
|
|
2581
|
+
type: "string",
|
|
2582
|
+
"x-component": "Text",
|
|
2583
|
+
"x-component-props": { content: n || "内部情况" },
|
|
2584
|
+
"x-designable-id": "insideTitle" + i,
|
|
2585
|
+
"x-index": i
|
|
2586
|
+
}), Object.keys(t.schema.properties).forEach((e) => {
|
|
2587
|
+
let n = t.schema.properties[e];
|
|
2588
|
+
i += 1, n["x-index"] = i, r.schema.properties[e] = n;
|
|
2589
|
+
}), r;
|
|
2590
|
+
}
|
|
2591
|
+
var ui = {
|
|
2592
|
+
form: {},
|
|
2593
|
+
schema: {
|
|
2594
|
+
type: "object",
|
|
2595
|
+
properties: { range: {
|
|
2596
|
+
type: "string",
|
|
2597
|
+
title: "范围",
|
|
2598
|
+
"x-decorator": "FormItem",
|
|
2599
|
+
"x-component": "Input",
|
|
2600
|
+
"x-validator": [],
|
|
2601
|
+
"x-component-props": {},
|
|
2602
|
+
"x-decorator-props": {},
|
|
2603
|
+
"x-designable-id": "range",
|
|
2604
|
+
name: "range",
|
|
2605
|
+
"x-index": 0
|
|
2606
|
+
} },
|
|
2607
|
+
"x-designable-id": "o6m980wykh1"
|
|
2608
|
+
}
|
|
2609
|
+
}, di = i((e, t) => {
|
|
2610
|
+
let { formProps: n = { schema: ui }, mountElement: r } = e, [i, a] = d(), o = u(), s = u(), l = u();
|
|
2611
|
+
c(t, () => ({
|
|
2612
|
+
onShow: f,
|
|
2613
|
+
onCancel: p
|
|
2614
|
+
}));
|
|
2615
|
+
function f(e) {
|
|
2616
|
+
return a(e ?? {}), new Promise((e, t) => {
|
|
2617
|
+
s.current = e, l.current = t;
|
|
2618
|
+
});
|
|
2619
|
+
}
|
|
2620
|
+
function p() {
|
|
2621
|
+
a(null), l.current && l.current();
|
|
2622
|
+
}
|
|
2623
|
+
function m() {
|
|
2624
|
+
o.current?.formRender?.validate().then(() => {
|
|
2625
|
+
s.current(o.current.formRender.values), a(null);
|
|
2626
|
+
}).catch(() => {});
|
|
2627
|
+
}
|
|
2628
|
+
let h = li(ui, n?.schema ?? ui);
|
|
2629
|
+
return i ? At(/* @__PURE__ */ Q("div", {
|
|
2630
|
+
className: "popup-box",
|
|
2631
|
+
children: [/* @__PURE__ */ Q("div", {
|
|
2632
|
+
className: "popup-body",
|
|
2633
|
+
children: [/* @__PURE__ */ Q("div", { children: ["地址:", i?.address] }), /* @__PURE__ */ Z(ci, {
|
|
2634
|
+
ref: o,
|
|
2635
|
+
...n,
|
|
2636
|
+
schema: h,
|
|
2637
|
+
initialValues: {
|
|
2638
|
+
...n?.initialValues,
|
|
2639
|
+
...i
|
|
2640
|
+
}
|
|
2641
|
+
})]
|
|
2642
|
+
}), /* @__PURE__ */ Q("div", {
|
|
2643
|
+
className: "popup-footer",
|
|
2644
|
+
children: [/* @__PURE__ */ Z(K, {
|
|
2645
|
+
type: "primary",
|
|
2646
|
+
onClick: m,
|
|
2647
|
+
children: "确定"
|
|
2648
|
+
}), /* @__PURE__ */ Z(K, {
|
|
2649
|
+
onClick: p,
|
|
2650
|
+
children: "取消"
|
|
2651
|
+
})]
|
|
2652
|
+
})]
|
|
2653
|
+
}), r || document.body) : null;
|
|
2654
|
+
}), fi = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJQSURBVGhD3ZrrdcIwDIVldw26R+kesEdZALJA2QMGgT3KGq2razk4cV4OSYPd7w92yznRtSUrslA0B3uzohd6pW/a8OyNFI+JVvZ/nhsZutiRpjPt1dmOJzJNQGE2bNQnj0Jj4zAsZKKY8QKw2sRGK7va82HoSIXauVk04wQU5sOt+N+haMc7cnSzQeIEYNWV9d/HXGUsEitb3pGb/KEb7T67gZ8r+uLRMsYDRWv7TDx7gH4B4jInN1sePBs29NDtQkv4eyw9cdEuQI7H5618G4pjouW4bQqQgIXPp4fhBBkEdlsMpLXyVeQkrFEXAL/HCZAuqzCo6y50MMaN0qbiSn4H9iaNEyeOu61egKLe8zYpKu9hIiAi4yWHs1kE/Mz8ZrkELslKEOcSvCEczDpL9ynhKlBn6T4lXMLWE1l+vOnEM28/Ci60ZKEyP6vcXSh4mcuQfyFgsPJPmJvmbJZm9RWDoQt24CqzPNGcjme5ZH0Kms6a03G+LrRXLEBKs/wCGTfbjByjuDjKDVzLM76oz60mOChru09kbkuyAL0Eh9+BlG/kQtzqA78DCOYcYiGw0e9AycEs2wsYAxofhXp3M4vfgRKTdIGzdZ93mgLElRpffDqwKbiZBk0BAPfwKcWDNDhaT8lmDFRJoUsjxnd2LfsFgGd2azq6MlWGBQBpbp/420sFOH6WsG7z+ZA4ASVLuNSAy4SME1CCXsLc1/HyKrOLWfUqjwkoQXzgavLx301I9h/w8z6mCahSigESK2E2h18jy19tFYhCauRqNyH6BUPQrVUSJvRPAAAAAElFTkSuQmCC", pi = b((e) => {
|
|
2655
|
+
let { value: t, readOnly: n, disabled: r, listProps: i, popupProps: a, ItemRender: o, markerIconConf: c, isAutoSearch: l, hasPolygon: f, hasPoint: p = !0, onChange: m } = e, [h, g] = d(e.loading || !1), [v, y] = d(!1), [b, x] = d("点击选择地址"), [S, C] = d({}), [w, T] = d(), E = u(), D = u(), O = u(t), k = u(), A = u("marker"), j = u(), M = u(), N = u(), P = u(null);
|
|
2656
|
+
s(() => () => {
|
|
2657
|
+
D.current?.off("click", U), D.current?.off("dblclick", B), E.current?.current?.removeEventListener?.("mousemove", me);
|
|
2658
|
+
}, []), s(() => {
|
|
2659
|
+
!Array.isArray(t) || t?.length == 0 || (t?.forEach((e) => {
|
|
2660
|
+
e.id ||= Ot();
|
|
2661
|
+
}), O.current = t || [], D.current && F());
|
|
2662
|
+
}, [t]);
|
|
2663
|
+
function F() {
|
|
2664
|
+
O.current?.forEach((e) => {
|
|
2665
|
+
e.type === "polygon" ? D.current.setPolygon({
|
|
2666
|
+
...e,
|
|
2667
|
+
onClick: te
|
|
2668
|
+
}) : (D.current.setMarker(e.longitude, e.latitude, {
|
|
2669
|
+
...e,
|
|
2670
|
+
data: e,
|
|
2671
|
+
onClick: ne
|
|
2672
|
+
}), D.current.setCircle(e.longitude, e.latitude, e.range, {
|
|
2673
|
+
...e,
|
|
2674
|
+
onClick: W
|
|
2675
|
+
}));
|
|
2676
|
+
}), D.current.setFitView(), G();
|
|
2677
|
+
}
|
|
2678
|
+
function I({ map: e, mapUtils: t, mapDomRef: n }) {
|
|
2679
|
+
E.current = n, n.current.addEventListener("mousemove", me), D.current = t, D.current?.createPoly("Polygon"), D.current.on("click", U), D.current.on("dblclick", B), D.current.startPolygon({ onClick: te }), F();
|
|
2680
|
+
}
|
|
2681
|
+
function L() {
|
|
2682
|
+
if (N.current) {
|
|
2683
|
+
we.warn("请先完成上次操作");
|
|
2684
|
+
return;
|
|
2685
|
+
}
|
|
2686
|
+
G(), x("点击选择地址"), y(!0), A.current = "marker", k.current = "add";
|
|
2687
|
+
}
|
|
2688
|
+
function R() {
|
|
2689
|
+
if (N.current) {
|
|
2690
|
+
we.warn("请先完成上次操作");
|
|
2691
|
+
return;
|
|
2692
|
+
}
|
|
2693
|
+
N.current = !0, x("点击绘制区域 双击完成绘制"), ee(), y(!0), A.current = "polygon", k.current = "add";
|
|
2694
|
+
}
|
|
2695
|
+
function ee() {
|
|
2696
|
+
D.current.setDrawPolygon({});
|
|
2697
|
+
}
|
|
2698
|
+
function z(e) {
|
|
2699
|
+
D.current.setEditPolygon(e);
|
|
2700
|
+
}
|
|
2701
|
+
function B(e) {
|
|
2702
|
+
if (A.current !== "polygon") return;
|
|
2703
|
+
let t = D.current.polyEditor?.PolygonEditor?.getTarget();
|
|
2704
|
+
if (t) {
|
|
2705
|
+
let e = [], n = [];
|
|
2706
|
+
if (t.getPath().length > 0) {
|
|
2707
|
+
let r = t.getPath().map((e) => [e.lng, e.lat]);
|
|
2708
|
+
e = r, n = V(r);
|
|
2709
|
+
}
|
|
2710
|
+
D.current.polyEditor?.PolygonEditor?.close(), D.current.polyEditor?.PolygonEditor?.setTarget(), H({
|
|
2711
|
+
type: "polygon",
|
|
2712
|
+
id: t.id,
|
|
2713
|
+
points: e,
|
|
2714
|
+
longitude: n[0],
|
|
2715
|
+
latitude: n[1]
|
|
2716
|
+
});
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
function V(e) {
|
|
2720
|
+
if (e.length > 0) {
|
|
2721
|
+
let t = Et.featureCollection(e.map((e) => Et.point(e)));
|
|
2722
|
+
return Et.center(t).geometry.coordinates;
|
|
2723
|
+
}
|
|
2724
|
+
return [];
|
|
2725
|
+
}
|
|
2726
|
+
async function H(e) {
|
|
2727
|
+
let t = k.current, n = t === "add", r = t === "edit";
|
|
2728
|
+
n && (j.current = e), e.address = await Ir(e.longitude, e.latitude);
|
|
2729
|
+
let i = [...O.current || []];
|
|
2730
|
+
if (n) i.push(e);
|
|
2731
|
+
else if (r) {
|
|
2732
|
+
let t = i.findIndex((t) => t.id === e.id);
|
|
2733
|
+
i.splice(t, 1, e);
|
|
2734
|
+
}
|
|
2735
|
+
m && m(i), oe();
|
|
2736
|
+
}
|
|
2737
|
+
function U(e) {
|
|
2738
|
+
D.current.isContains(e, W);
|
|
2739
|
+
}
|
|
2740
|
+
async function W(e) {
|
|
2741
|
+
if (A.current !== "marker") return;
|
|
2742
|
+
let t = k.current, n = t === "add", r = t === "edit";
|
|
2743
|
+
if (y(!1), !n && !r) return;
|
|
2744
|
+
N.current = !0;
|
|
2745
|
+
let { lng: i, lat: a } = e.lnglat || {}, o = j.current, s = n ? Ot() : o?.id, c = {
|
|
2746
|
+
id: s,
|
|
2747
|
+
longitude: i,
|
|
2748
|
+
latitude: a,
|
|
2749
|
+
address: "",
|
|
2750
|
+
range: "",
|
|
2751
|
+
...o
|
|
2752
|
+
};
|
|
2753
|
+
c.address = await Ir(i, a), n && (c.longitude = i, c.latitude = a, j.current = c), D.current.setMarker(i, a, {
|
|
2754
|
+
...c,
|
|
2755
|
+
onClick: ne,
|
|
2756
|
+
data: c
|
|
2757
|
+
}), D.current.setCircle(i, a, c.range, { ...c });
|
|
2758
|
+
let { x: l, y: u } = D.current.map.lngLatToContainer([i, a]), d = E.current?.current?.getBoundingClientRect(), f = d?.left + l, p = d?.top + u, h = {};
|
|
2759
|
+
try {
|
|
2760
|
+
h = await M.current?.onShow({
|
|
2761
|
+
type: "marker",
|
|
2762
|
+
top: p,
|
|
2763
|
+
left: f,
|
|
2764
|
+
address: c.address,
|
|
2765
|
+
range: c.range,
|
|
2766
|
+
item: c
|
|
2767
|
+
});
|
|
2768
|
+
} catch {
|
|
2769
|
+
n && D.current.rmMarker(c.id), r && (D.current.setMarker(o.longitude, o.latitude, {
|
|
2770
|
+
...o,
|
|
2771
|
+
data: c
|
|
2772
|
+
}), D.current.setCircle(o.longitude, o.latitude, o.range, { ...o })), oe(c.id);
|
|
2773
|
+
return;
|
|
2774
|
+
}
|
|
2775
|
+
D.current.setCircle(i, a, h.range, { ...c }), c = Object.assign(c, h);
|
|
2776
|
+
let g = [...O.current || []];
|
|
2777
|
+
if (n) g.push(c);
|
|
2778
|
+
else if (r) {
|
|
2779
|
+
let e = g.findIndex((e) => e.id === s);
|
|
2780
|
+
g.splice(e, 1, c);
|
|
2781
|
+
}
|
|
2782
|
+
m && m(g), oe();
|
|
2783
|
+
}
|
|
2784
|
+
function te(e) {
|
|
2785
|
+
if (!N.current && k.current !== "add") {
|
|
2786
|
+
A.current = "polygon";
|
|
2787
|
+
let t = e.target.id;
|
|
2788
|
+
ae(t), T(t), ie(e.target);
|
|
2789
|
+
} else k.current === "add" && W(e);
|
|
2790
|
+
}
|
|
2791
|
+
function ne(e, ...t) {
|
|
2792
|
+
if (G(), !N.current && k.current !== "add") {
|
|
2793
|
+
y(!1), N.current = !1;
|
|
2794
|
+
let { id: t } = e.target.getExtData() || {};
|
|
2795
|
+
T(t), ce(t);
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
function ie(e) {
|
|
2799
|
+
G();
|
|
2800
|
+
let t = D.current.polygonEnum[e.id], n = D.current.getPolygonCenter(t.getPath()?.map((e) => [e.lng, e.lat]));
|
|
2801
|
+
D.current.setCenter(n?.[0], n?.[1]), t?.setOptions({
|
|
2802
|
+
strokeColor: "#403ef5",
|
|
2803
|
+
strokeWeight: 4
|
|
2804
|
+
});
|
|
2805
|
+
}
|
|
2806
|
+
function G() {
|
|
2807
|
+
Object.keys(D.current.polygonEnum).forEach((e) => {
|
|
2808
|
+
D.current.polygonEnum[e]?.setOptions({
|
|
2809
|
+
strokeColor: "#1791fc",
|
|
2810
|
+
strokeWeight: 2
|
|
2811
|
+
});
|
|
2812
|
+
}), Object.keys(D.current.markers).forEach((e) => {
|
|
2813
|
+
D.current.setMarkerIcon(e, {
|
|
2814
|
+
image: fi,
|
|
2815
|
+
size: [12, 12],
|
|
2816
|
+
offset: [-6, -6]
|
|
2817
|
+
});
|
|
2818
|
+
});
|
|
2819
|
+
}
|
|
2820
|
+
function ae(e) {
|
|
2821
|
+
D.current.polyEditor?.PolygonEditor?.close(), D.current.polyEditor?.PolygonEditor?.setTarget();
|
|
2822
|
+
}
|
|
2823
|
+
function oe(e) {
|
|
2824
|
+
G(), N.current = !1, k.current = null, j.current = null, y(!1), M.current.onCancel();
|
|
2825
|
+
}
|
|
2826
|
+
function se(e, t) {
|
|
2827
|
+
A.current = e.type || "marker", G(), oe(e.id), T(e.id);
|
|
2828
|
+
let n = D.current;
|
|
2829
|
+
if (e.type == "polygon") ie(e);
|
|
2830
|
+
else {
|
|
2831
|
+
let t = n.markers[e.id]?.getPosition();
|
|
2832
|
+
t && n.setCenter(t.lng, t.lat), ce(e.id);
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
function ce(e) {
|
|
2836
|
+
D.current.setMarkerIcon(e, {
|
|
2837
|
+
image: Sr,
|
|
2838
|
+
size: [34, 34],
|
|
2839
|
+
offset: [-17, -34]
|
|
2840
|
+
});
|
|
2841
|
+
}
|
|
2842
|
+
function le(e, t) {
|
|
2843
|
+
if (N.current) {
|
|
2844
|
+
we.warn("请先完成上次操作");
|
|
2845
|
+
return;
|
|
2846
|
+
}
|
|
2847
|
+
G(), A.current = e.type || "marker", y(!0), D.current.setCenter(e.longitude, e.latitude, { immediately: !0 }), ae(e.id), k.current = "edit", j.current = e, e.type == "polygon" ? (x("点击绘制区域 双击完成绘制"), z(e), N.current = !0) : (x("点击选择地址"), ce(e.id), W({ lnglat: {
|
|
2848
|
+
lng: e.longitude,
|
|
2849
|
+
lat: e.latitude
|
|
2850
|
+
} }));
|
|
2851
|
+
}
|
|
2852
|
+
function ue(e, t) {
|
|
2853
|
+
G(), A.current = e.type || "marker", D.current.setCenter(e.longitude, e.latitude, { immediately: !0 }), e.type !== "polygon" && (T(e.id), ce(e.id));
|
|
2854
|
+
}
|
|
2855
|
+
function de(e, t) {
|
|
2856
|
+
A.current = e.type || "marker";
|
|
2857
|
+
let n = [...O.current || []];
|
|
2858
|
+
O.current?.splice(t, 1), n?.splice(t, 1), m && m(n), e.type === "polygon" ? D.current.rmPolygon(e.id) : (D.current.rmMarker(e.id), D.current.rmCircle(e.id));
|
|
2859
|
+
}
|
|
2860
|
+
function fe(e, t) {
|
|
2861
|
+
A.current = e.type || "marker", e.type !== "polygon" && (G(), T(null));
|
|
2862
|
+
}
|
|
2863
|
+
function pe(e, t) {
|
|
2864
|
+
D.current.setCenter(e, t, { immediately: !0 }), k.current = "add", j.current = null, M.current?.onCancel(), W({ lnglat: {
|
|
2865
|
+
lng: e,
|
|
2866
|
+
lat: t
|
|
2867
|
+
} });
|
|
2868
|
+
}
|
|
2869
|
+
function me(e) {
|
|
2870
|
+
let { offsetX: t, offsetY: n } = e;
|
|
2871
|
+
C({
|
|
2872
|
+
left: t + 10,
|
|
2873
|
+
top: n + 10
|
|
2874
|
+
});
|
|
2875
|
+
}
|
|
2876
|
+
return /* @__PURE__ */ Q("div", {
|
|
2877
|
+
className: "location-list-picker",
|
|
2878
|
+
children: [/* @__PURE__ */ Q("div", {
|
|
2879
|
+
className: "map-box",
|
|
2880
|
+
ref: P,
|
|
2881
|
+
children: [
|
|
2882
|
+
/* @__PURE__ */ Z(Pr, {
|
|
2883
|
+
init: I,
|
|
2884
|
+
loading: h,
|
|
2885
|
+
markerIconConf: c
|
|
2886
|
+
}),
|
|
2887
|
+
!n && !r && /* @__PURE__ */ Z(Ur, {
|
|
2888
|
+
setPoint: pe,
|
|
2889
|
+
isAutoSearch: l
|
|
2890
|
+
}),
|
|
2891
|
+
v && /* @__PURE__ */ Z(re, {
|
|
2892
|
+
className: "location-list-picker-notice-bar",
|
|
2893
|
+
message: b,
|
|
2894
|
+
type: "info",
|
|
2895
|
+
style: S
|
|
2896
|
+
}),
|
|
2897
|
+
f && !n && /* @__PURE__ */ Z(K, {
|
|
2898
|
+
className: "add-polygon-btn",
|
|
2899
|
+
onClick: R,
|
|
2900
|
+
disabled: r,
|
|
2901
|
+
children: "新增区域"
|
|
2902
|
+
}),
|
|
2903
|
+
p !== !1 && !n && /* @__PURE__ */ Z(K, {
|
|
2904
|
+
className: "add-btn",
|
|
2905
|
+
onClick: L,
|
|
2906
|
+
disabled: r,
|
|
2907
|
+
children: "新增地址"
|
|
2908
|
+
}),
|
|
2909
|
+
/* @__PURE__ */ Z(di, {
|
|
2910
|
+
ref: M,
|
|
2911
|
+
mountElement: P.current,
|
|
2912
|
+
...a
|
|
2913
|
+
})
|
|
2914
|
+
]
|
|
2915
|
+
}), /* @__PURE__ */ Z(Jr, {
|
|
2916
|
+
...i,
|
|
2917
|
+
readOnly: n,
|
|
2918
|
+
disabled: r,
|
|
2919
|
+
mapUtilsRef: D,
|
|
2920
|
+
activeId: w,
|
|
2921
|
+
list: t,
|
|
2922
|
+
ItemRender: o,
|
|
2923
|
+
onItemClick: se,
|
|
2924
|
+
onEdit: le,
|
|
2925
|
+
onDel: de,
|
|
2926
|
+
onDelClick: ue,
|
|
2927
|
+
onDelCancel: fe
|
|
2928
|
+
})]
|
|
2929
|
+
});
|
|
2930
|
+
}), mi = b(function(e, t) {
|
|
2931
|
+
let { toolbarConfig: n, editorConfig: r, height: i, onChange: a, value: o, ossOpt: l, uploadMode: u = "oss", offlinePreviewUrl: f = "", offlineServerUrl: p = "", uploadParams: m = {}, ossServerUrl: h = wn()?.serverUrl || "/api/v1/user/oss/getWebOssConfig", ossUrl: g = wn()?.serverUrl || "/api/v1/user/oss/getWebOssConfig", zIndex: v = 9999 } = e, y = e.uploadParams?.fileAcl === "private" || e.ossOpt?.signatureParams?.fileAcl === "private";
|
|
2932
|
+
c(t, () => ({
|
|
2933
|
+
setEditorContent: O,
|
|
2934
|
+
getEditorContent: k
|
|
2935
|
+
}));
|
|
2936
|
+
let b = x(), [S, C] = d(null), [w, T] = d(""), [E, D] = d(!1), O = (e) => {
|
|
2937
|
+
T(e);
|
|
2938
|
+
}, k = () => w, A = async (t, n) => {
|
|
2939
|
+
let r = e.customRequest;
|
|
2940
|
+
u === "oss" ? r = qn({
|
|
2941
|
+
...e,
|
|
2942
|
+
isPrivateStore: y,
|
|
2943
|
+
params: m,
|
|
2944
|
+
ossServerUrl: h || g
|
|
2945
|
+
}) : u === "offline" && (r = Kn({
|
|
2946
|
+
...e,
|
|
2947
|
+
isPrivateStore: y,
|
|
2948
|
+
params: m,
|
|
2949
|
+
offlineServerUrl: p || g,
|
|
2950
|
+
offlinePreviewUrl: f
|
|
2951
|
+
})), D(!0), r({
|
|
2952
|
+
file: t,
|
|
2953
|
+
onSuccess: (e) => {
|
|
2954
|
+
D(!1), n(e.url, "", "");
|
|
2955
|
+
},
|
|
2956
|
+
onError: () => {
|
|
2957
|
+
D(!1), we.error(`${t.name} 上传失败`);
|
|
2958
|
+
}
|
|
2959
|
+
});
|
|
2960
|
+
}, j = {
|
|
2961
|
+
placeholder: "请输入内容...",
|
|
2962
|
+
MENU_CONF: {
|
|
2963
|
+
uploadImage: {
|
|
2964
|
+
fieldName: "wangeditor-uploaded-image",
|
|
2965
|
+
maxFileSize: 1048576,
|
|
2966
|
+
maxNumberOfFiles: 1,
|
|
2967
|
+
allowedFileTypes: ["image/*"],
|
|
2968
|
+
withCredentials: !1,
|
|
2969
|
+
timeout: 5e3,
|
|
2970
|
+
customUpload: A
|
|
2971
|
+
},
|
|
2972
|
+
uploadVideo: {
|
|
2973
|
+
fieldName: "wangeditor-uploaded-video",
|
|
2974
|
+
maxNumberOfFiles: 1,
|
|
2975
|
+
allowedFileTypes: ["video/*"],
|
|
2976
|
+
withCredentials: !1,
|
|
2977
|
+
customUpload: A
|
|
2978
|
+
}
|
|
2979
|
+
},
|
|
2980
|
+
...yt(r, { MENU_CONF: {
|
|
2981
|
+
uploadImage: {
|
|
2982
|
+
fieldName: "wangeditor-uploaded-image",
|
|
2983
|
+
maxFileSize: 1048576,
|
|
2984
|
+
maxNumberOfFiles: 1,
|
|
2985
|
+
allowedFileTypes: ["image/*"],
|
|
2986
|
+
withCredentials: !1,
|
|
2987
|
+
timeout: 5e3,
|
|
2988
|
+
customUpload: A
|
|
2989
|
+
},
|
|
2990
|
+
uploadVideo: {
|
|
2991
|
+
fieldName: "wangeditor-uploaded-video",
|
|
2992
|
+
maxNumberOfFiles: 1,
|
|
2993
|
+
allowedFileTypes: ["video/*"],
|
|
2994
|
+
withCredentials: !1,
|
|
2995
|
+
customUpload: A
|
|
2996
|
+
}
|
|
2997
|
+
} })
|
|
2998
|
+
}, M = (e) => {
|
|
2999
|
+
let t = e.getHtml();
|
|
3000
|
+
T(t), a && a(t);
|
|
3001
|
+
};
|
|
3002
|
+
return s(() => () => {
|
|
3003
|
+
S != null && (S.destroy(), C(null));
|
|
3004
|
+
}, [S]), s(() => {
|
|
3005
|
+
O(o);
|
|
3006
|
+
}, [o]), /* @__PURE__ */ Z(X, { children: /* @__PURE__ */ Q("div", {
|
|
3007
|
+
className: "wang-editor-warpper",
|
|
3008
|
+
style: { zIndex: v },
|
|
3009
|
+
children: [
|
|
3010
|
+
E && /* @__PURE__ */ Z("div", {
|
|
3011
|
+
className: "spin-content",
|
|
3012
|
+
children: /* @__PURE__ */ Z(be, { tip: "Loading..." })
|
|
3013
|
+
}),
|
|
3014
|
+
/* @__PURE__ */ Z(Mt, {
|
|
3015
|
+
editor: S,
|
|
3016
|
+
defaultConfig: n,
|
|
3017
|
+
mode: "default",
|
|
3018
|
+
style: { borderBottom: "1px solid #ccc" }
|
|
3019
|
+
}),
|
|
3020
|
+
/* @__PURE__ */ Z(jt, {
|
|
3021
|
+
defaultConfig: j,
|
|
3022
|
+
value: w,
|
|
3023
|
+
onCreated: (e) => {
|
|
3024
|
+
C(e), b.editor = e;
|
|
3025
|
+
},
|
|
3026
|
+
onChange: (e) => M(e),
|
|
3027
|
+
mode: "default",
|
|
3028
|
+
style: { height: i }
|
|
3029
|
+
})
|
|
3030
|
+
]
|
|
3031
|
+
}) });
|
|
3032
|
+
});
|
|
3033
|
+
g(mi, y((e, t) => ({
|
|
3034
|
+
...e,
|
|
3035
|
+
form: t.form,
|
|
3036
|
+
field: t
|
|
3037
|
+
})));
|
|
3038
|
+
var hi = jt, gi = (e) => {
|
|
3039
|
+
let t = x(), { value: n, onChange: r, dataSource: i = t?.dataSource || [], ...a } = e, o = (e) => {
|
|
3040
|
+
r?.(e);
|
|
3041
|
+
};
|
|
3042
|
+
return /* @__PURE__ */ Z(he.Group, {
|
|
3043
|
+
className: "radio-group-tip",
|
|
3044
|
+
value: n,
|
|
3045
|
+
onChange: (e) => o(e.target.value),
|
|
3046
|
+
...a,
|
|
3047
|
+
children: i.map((e, t) => /* @__PURE__ */ Q(he, {
|
|
3048
|
+
value: e?.value,
|
|
3049
|
+
className: "radio-item",
|
|
3050
|
+
disabled: e?.disabled,
|
|
3051
|
+
children: [/* @__PURE__ */ Z("div", {
|
|
3052
|
+
className: "radio-title",
|
|
3053
|
+
children: e?.label
|
|
3054
|
+
}), /* @__PURE__ */ Z("div", {
|
|
3055
|
+
className: "radio-desc",
|
|
3056
|
+
children: e?.desc
|
|
3057
|
+
})]
|
|
3058
|
+
}, t))
|
|
3059
|
+
});
|
|
3060
|
+
}, _i = (e) => {
|
|
3061
|
+
let t = x(), { value: n, onChange: r, dataSource: i = t?.dataSource || [], ...a } = e;
|
|
3062
|
+
return /* @__PURE__ */ Z(se.Group, {
|
|
3063
|
+
value: n,
|
|
3064
|
+
onChange: (e) => r?.(e),
|
|
3065
|
+
className: "checkbox-desc",
|
|
3066
|
+
...a,
|
|
3067
|
+
children: i.map((e, t) => /* @__PURE__ */ Q(se, {
|
|
3068
|
+
className: "check-item",
|
|
3069
|
+
value: e?.value,
|
|
3070
|
+
disabled: e?.disabled,
|
|
3071
|
+
children: [/* @__PURE__ */ Z("div", {
|
|
3072
|
+
className: "label-text",
|
|
3073
|
+
children: e?.label
|
|
3074
|
+
}), /* @__PURE__ */ Z("div", {
|
|
3075
|
+
className: "desc-text",
|
|
3076
|
+
children: e?.desc
|
|
3077
|
+
})]
|
|
3078
|
+
}, t))
|
|
3079
|
+
});
|
|
3080
|
+
}, vi = /* @__PURE__ */ Lt({
|
|
3081
|
+
Addition: () => xn,
|
|
3082
|
+
ArrayCards: () => an,
|
|
3083
|
+
ArrayTable: () => bn,
|
|
3084
|
+
CheckboxWithTip: () => _i,
|
|
3085
|
+
DatePicker: () => xr,
|
|
3086
|
+
Editor: () => hi,
|
|
3087
|
+
LocationListPicker: () => pi,
|
|
3088
|
+
LocationPicker: () => qr,
|
|
3089
|
+
PaginationContext: () => gn,
|
|
3090
|
+
PersonnelSelect: () => ar,
|
|
3091
|
+
RadioGroupWithTip: () => gi,
|
|
3092
|
+
RemoteSelect: () => ir,
|
|
3093
|
+
RichEditor: () => mi,
|
|
3094
|
+
SortableBody: () => sn,
|
|
3095
|
+
SortableRow: () => on,
|
|
3096
|
+
StatusSelect: () => hn,
|
|
3097
|
+
Text: () => Vt,
|
|
3098
|
+
TreeCheckbox: () => hr,
|
|
3099
|
+
Upload: () => Qn,
|
|
3100
|
+
UserSelect: () => tr,
|
|
3101
|
+
isAdditionComponent: () => un,
|
|
3102
|
+
isColumnComponent: () => cn,
|
|
3103
|
+
isCopyComponent: () => en,
|
|
3104
|
+
isIndexComponent: () => Qt,
|
|
3105
|
+
isMoveDownComponent: () => nn,
|
|
3106
|
+
isMoveUpComponent: () => tn,
|
|
3107
|
+
isOperationComponent: () => rn,
|
|
3108
|
+
isOperationsComponent: () => ln,
|
|
3109
|
+
isRemoveComponent: () => $t,
|
|
3110
|
+
schedulerRequest: () => mn,
|
|
3111
|
+
useAddition: () => pn,
|
|
3112
|
+
useArrayTableColumns: () => fn,
|
|
3113
|
+
useArrayTableSources: () => dn,
|
|
3114
|
+
usePagination: () => _n
|
|
3115
|
+
}), yi = {
|
|
3116
|
+
Form: k,
|
|
3117
|
+
FormItem: M,
|
|
3118
|
+
DatePicker: D,
|
|
3119
|
+
Checkbox: E,
|
|
3120
|
+
Cascader: T,
|
|
3121
|
+
Editable: O,
|
|
3122
|
+
Input: F,
|
|
3123
|
+
NumberPicker: I,
|
|
3124
|
+
Switch: U,
|
|
3125
|
+
Password: L,
|
|
3126
|
+
PreviewText: R,
|
|
3127
|
+
Radio: ee,
|
|
3128
|
+
Reset: z,
|
|
3129
|
+
Select: B,
|
|
3130
|
+
Space: V,
|
|
3131
|
+
Submit: H,
|
|
3132
|
+
TimePicker: W,
|
|
3133
|
+
Transfer: te,
|
|
3134
|
+
TreeSelect: ne,
|
|
3135
|
+
FormGrid: j,
|
|
3136
|
+
FormLayout: N,
|
|
3137
|
+
FormTab: P,
|
|
3138
|
+
FormCollapse: A,
|
|
3139
|
+
ArrayTable: w,
|
|
3140
|
+
ArrayCards: C
|
|
3141
|
+
}, bi = i((e, t) => {
|
|
3142
|
+
let n = u({
|
|
3143
|
+
scenario: "form-render",
|
|
3144
|
+
_$tempData: {},
|
|
3145
|
+
...e.schemaScope
|
|
3146
|
+
}), r = a(v({
|
|
3147
|
+
components: {
|
|
3148
|
+
ArrayTable: w,
|
|
3149
|
+
ArrayCards: C,
|
|
3150
|
+
Space: V,
|
|
3151
|
+
FormGrid: j,
|
|
3152
|
+
FormLayout: N,
|
|
3153
|
+
FormTab: P,
|
|
3154
|
+
FormCollapse: A,
|
|
3155
|
+
FormItem: M,
|
|
3156
|
+
DatePicker: D,
|
|
3157
|
+
Checkbox: E,
|
|
3158
|
+
Cascader: T,
|
|
3159
|
+
Editable: O,
|
|
3160
|
+
Input: F,
|
|
3161
|
+
NumberPicker: I,
|
|
3162
|
+
Switch: U,
|
|
3163
|
+
Password: L,
|
|
3164
|
+
PreviewText: R,
|
|
3165
|
+
Radio: ee,
|
|
3166
|
+
Reset: z,
|
|
3167
|
+
Select: B,
|
|
3168
|
+
Submit: H,
|
|
3169
|
+
TimePicker: W,
|
|
3170
|
+
Transfer: te,
|
|
3171
|
+
TreeSelect: ne,
|
|
3172
|
+
Card: oe,
|
|
3173
|
+
Slider: ve,
|
|
3174
|
+
Rate: ge,
|
|
3175
|
+
...vi,
|
|
3176
|
+
...Te(),
|
|
3177
|
+
...e.components
|
|
3178
|
+
},
|
|
3179
|
+
scope: n.current
|
|
3180
|
+
}), []), i = l(() => f({
|
|
3181
|
+
initialValues: e.initialValues,
|
|
3182
|
+
readOnly: e.readOnly,
|
|
3183
|
+
disabled: e.disabled,
|
|
3184
|
+
...e.formOptions || {},
|
|
3185
|
+
effects(...t) {
|
|
3186
|
+
e.onFormValuesChange && m(e.onFormValuesChange), e.onFieldValueChange && p("*", e.onFieldValueChange), e.formOptions?.effects && e.formOptions?.effects(...t);
|
|
3187
|
+
}
|
|
3188
|
+
}), []), o = (t) => {
|
|
3189
|
+
e.onSubmit(t);
|
|
3190
|
+
}, d = (t) => {
|
|
3191
|
+
e.onSubmitFailed(t);
|
|
3192
|
+
};
|
|
3193
|
+
c(t, () => ({ formRender: i })), s(() => {
|
|
3194
|
+
e.init && e.init(i);
|
|
3195
|
+
}, []);
|
|
3196
|
+
let h = l(() => {
|
|
3197
|
+
let { Slots: t } = e;
|
|
3198
|
+
if (typeof t == "function") return /* @__PURE__ */ Z(t, {});
|
|
3199
|
+
if (typeof t?.footer == "function") return /* @__PURE__ */ Z(t.footer, {});
|
|
3200
|
+
}, [e.Slots]), g = { ...e.schema?.form }, y = l(() => ei(e.schema, {
|
|
3201
|
+
schemaScope: n.current,
|
|
3202
|
+
onChange: e.onChange,
|
|
3203
|
+
formRender: i
|
|
3204
|
+
}), []);
|
|
3205
|
+
return /* @__PURE__ */ Z(Xn.Provider, {
|
|
3206
|
+
value: e,
|
|
3207
|
+
children: /* @__PURE__ */ Z(k, {
|
|
3208
|
+
className: `form-render ${e.className}`,
|
|
3209
|
+
layout: e.layout,
|
|
3210
|
+
form: i,
|
|
3211
|
+
labelCol: e.schema.form.labelCol,
|
|
3212
|
+
wrapperCol: e.schema.form.wrapperCol,
|
|
3213
|
+
onAutoSubmit: o,
|
|
3214
|
+
onAutoSubmitFailed: d,
|
|
3215
|
+
previewTextPlaceholder: e?.emptyValue,
|
|
3216
|
+
children: /* @__PURE__ */ Q(N, {
|
|
3217
|
+
...g,
|
|
3218
|
+
children: [/* @__PURE__ */ Z(r, { schema: y }), /* @__PURE__ */ Z("div", {
|
|
3219
|
+
className: "form-render-footer xxm",
|
|
3220
|
+
children: h
|
|
3221
|
+
})]
|
|
3222
|
+
})
|
|
3223
|
+
})
|
|
3224
|
+
});
|
|
3225
|
+
});
|
|
3226
|
+
//#endregion
|
|
3227
|
+
export { yi as antdComponents, vi as customComponents, bi as default };
|