@yilianjituan/yilian_dgerm 0.0.1-alpha.31 → 0.0.1-alpha.33
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/.eslintrc.js +0 -0
- package/LICENSE +0 -0
- package/README.md +8 -6
- package/dist/business/Entry/index.d.ts +0 -0
- package/dist/business/Entry/index.interface.d.ts +0 -0
- package/dist/business/Entry/index.interface.js +0 -0
- package/dist/business/Entry/index.js +0 -0
- package/dist/business/Entry/index.scss +0 -0
- package/dist/business/TestBtn/index.d.ts +0 -0
- package/dist/business/TestBtn/index.interface.d.ts +0 -0
- package/dist/business/TestBtn/index.interface.js +0 -0
- package/dist/business/TestBtn/index.js +0 -0
- package/dist/commonAxios/Axios.d.ts +0 -0
- package/dist/commonAxios/Axios.js +0 -0
- package/dist/commonAxios/http.d.ts +0 -0
- package/dist/commonAxios/http.js +0 -0
- package/dist/commonAxios/index.d.ts +0 -0
- package/dist/commonAxios/index.js +0 -0
- package/dist/commonAxios/juicer.d.ts +0 -0
- package/dist/commonAxios/juicer.js +0 -0
- package/dist/commonData/address.d.ts +0 -0
- package/dist/commonData/address.js +0 -0
- package/dist/commonImg/ic_im_no_archives_new.png +0 -0
- package/dist/commonType/globalEnum.d.ts +0 -0
- package/dist/commonType/globalEnum.js +0 -0
- package/dist/commonType/globalFun.d.ts +0 -0
- package/dist/commonType/globalFun.js +0 -0
- package/dist/components/BigImage/index.d.ts +0 -0
- package/dist/components/BigImage/index.interface.d.ts +0 -0
- package/dist/components/BigImage/index.interface.js +0 -0
- package/dist/components/BigImage/index.js +0 -0
- package/dist/components/CustomButtonModal/index.d.ts +4 -0
- package/dist/components/CustomButtonModal/index.interface.d.ts +14 -0
- package/dist/components/CustomButtonModal/index.interface.js +1 -0
- package/dist/components/CustomButtonModal/index.js +69 -0
- package/dist/components/DateTimePicker/index.d.ts +4 -0
- package/dist/components/DateTimePicker/index.interface.d.ts +6 -0
- package/dist/components/DateTimePicker/index.interface.js +1 -0
- package/dist/components/DateTimePicker/index.js +100 -0
- package/dist/components/DropDownSelect/index.d.ts +0 -0
- package/dist/components/DropDownSelect/index.interface.d.ts +4 -0
- package/dist/components/DropDownSelect/index.interface.js +0 -0
- package/dist/components/DropDownSelect/index.js +4 -2
- package/dist/components/EmptyDom/index.d.ts +0 -0
- package/dist/components/EmptyDom/index.interface.d.ts +0 -0
- package/dist/components/EmptyDom/index.interface.js +0 -0
- package/dist/components/EmptyDom/index.js +0 -0
- package/dist/components/Entry/index.d.ts +0 -0
- package/dist/components/Entry/index.interface.d.ts +0 -0
- package/dist/components/Entry/index.interface.js +0 -0
- package/dist/components/Entry/index.js +0 -0
- package/dist/components/Entry/index.scss +0 -0
- package/dist/components/ExportExcels/ExportExcels.scss +0 -0
- package/dist/components/ExportExcels/index.d.ts +0 -0
- package/dist/components/ExportExcels/index.interface.d.ts +0 -0
- package/dist/components/ExportExcels/index.interface.js +0 -0
- package/dist/components/ExportExcels/index.js +0 -0
- package/dist/components/FileUpload/fileUtil.d.ts +0 -0
- package/dist/components/FileUpload/fileUtil.js +0 -0
- package/dist/components/FileUpload/index.d.ts +0 -0
- package/dist/components/FileUpload/index.interface.d.ts +0 -0
- package/dist/components/FileUpload/index.interface.js +0 -0
- package/dist/components/FileUpload/index.js +0 -0
- package/dist/components/FileUpload/index.scss +0 -0
- package/dist/components/FilterRadio/index.d.ts +0 -0
- package/dist/components/FilterRadio/index.interface.d.ts +0 -0
- package/dist/components/FilterRadio/index.interface.js +0 -0
- package/dist/components/FilterRadio/index.js +0 -0
- package/dist/components/FilterRadio/index.scss +0 -0
- package/dist/components/MyBtn/index.d.ts +0 -0
- package/dist/components/MyBtn/index.interface.d.ts +0 -0
- package/dist/components/MyBtn/index.interface.js +0 -0
- package/dist/components/MyBtn/index.js +0 -0
- package/dist/components/NumberInput/index.d.ts +0 -0
- package/dist/components/NumberInput/index.interface.d.ts +0 -0
- package/dist/components/NumberInput/index.interface.js +0 -0
- package/dist/components/NumberInput/index.js +0 -0
- package/dist/components/NumberInput/index.scss +0 -0
- package/dist/components/OcrCommon/index.config.d.ts +18 -0
- package/dist/components/OcrCommon/index.config.js +67 -0
- package/dist/components/OcrCommon/index.d.ts +5 -0
- package/dist/components/OcrCommon/index.interface.d.ts +22 -0
- package/dist/components/OcrCommon/index.interface.js +1 -0
- package/dist/components/OcrCommon/index.js +479 -0
- package/dist/components/OcrCommon/index.scss +128 -0
- package/dist/components/PageTemplate/index.d.ts +0 -0
- package/dist/components/PageTemplate/index.interface.d.ts +0 -0
- package/dist/components/PageTemplate/index.interface.js +0 -0
- package/dist/components/PageTemplate/index.js +0 -0
- package/dist/components/PageTemplate/index.scss +0 -0
- package/dist/components/ReactEcharts/index.d.ts +0 -0
- package/dist/components/ReactEcharts/index.interface.d.ts +0 -0
- package/dist/components/ReactEcharts/index.interface.js +0 -0
- package/dist/components/ReactEcharts/index.js +0 -0
- package/dist/components/SelectMax/index.d.ts +0 -0
- package/dist/components/SelectMax/index.interface.d.ts +0 -0
- package/dist/components/SelectMax/index.interface.js +0 -0
- package/dist/components/SelectMax/index.js +0 -0
- package/dist/components/SelectPosition/index.d.ts +5 -0
- package/dist/components/SelectPosition/index.interface.d.ts +65 -0
- package/dist/components/SelectPosition/index.interface.js +1 -0
- package/dist/components/SelectPosition/index.js +353 -0
- package/dist/components/SelectPosition/index.scss +19 -0
- package/dist/components/SuperCascader/index.d.ts +0 -0
- package/dist/components/SuperCascader/index.interface.d.ts +0 -0
- package/dist/components/SuperCascader/index.interface.js +0 -0
- package/dist/components/SuperCascader/index.js +0 -0
- package/dist/components/SuperInput/index.d.ts +0 -0
- package/dist/components/SuperInput/index.interface.d.ts +0 -0
- package/dist/components/SuperInput/index.interface.js +0 -0
- package/dist/components/SuperInput/index.js +0 -0
- package/dist/components/TabsMode/index.d.ts +0 -0
- package/dist/components/TabsMode/index.interface.d.ts +0 -0
- package/dist/components/TabsMode/index.interface.js +0 -0
- package/dist/components/TabsMode/index.js +0 -0
- package/dist/components/TypographyText/index.d.ts +5 -0
- package/dist/components/TypographyText/index.interface.d.ts +13 -0
- package/dist/components/TypographyText/index.interface.js +1 -0
- package/dist/components/TypographyText/index.js +67 -0
- package/dist/components/TypographyText/index.scss +9 -0
- package/dist/components/VideoProgressModal/index.d.ts +0 -0
- package/dist/components/VideoProgressModal/index.interface.d.ts +0 -0
- package/dist/components/VideoProgressModal/index.interface.js +0 -0
- package/dist/components/VideoProgressModal/index.js +0 -0
- package/dist/components/VideoProgressModal/index.scss +0 -0
- package/dist/components/YLModal/drag.d.ts +0 -0
- package/dist/components/YLModal/drag.js +0 -0
- package/dist/components/YLModal/index.d.ts +0 -0
- package/dist/components/YLModal/index.interface.d.ts +0 -0
- package/dist/components/YLModal/index.interface.js +0 -0
- package/dist/components/YLModal/index.js +0 -0
- package/dist/index.d.ts +17 -12
- package/dist/index.js +17 -12
- package/dist/react-app-env.d.ts +0 -0
- package/dist/utils/common.d.ts +0 -0
- package/dist/utils/common.js +0 -0
- package/dist/utils/index.d.ts +0 -0
- package/dist/utils/index.js +0 -0
- package/dist/utils/notificationHelper.d.ts +0 -0
- package/dist/utils/notificationHelper.js +0 -0
- package/dist/utils/responseMessage.d.ts +0 -0
- package/dist/utils/responseMessage.js +0 -0
- package/dist/utils/userSessionActions.d.ts +0 -0
- package/dist/utils/userSessionActions.js +0 -0
- package/package.json +28 -27
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export interface SelectPositionProps {
|
|
2
|
+
/**
|
|
3
|
+
* @description: 获取省份接口
|
|
4
|
+
*/
|
|
5
|
+
getProvinces: (type?: string) => Promise<any>;
|
|
6
|
+
/**
|
|
7
|
+
* @description: 获取市接口
|
|
8
|
+
*/
|
|
9
|
+
getCityOrDistrict: (value?: string) => Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* @description: 目标表单
|
|
12
|
+
*/
|
|
13
|
+
form?: any;
|
|
14
|
+
/**
|
|
15
|
+
* @description: 师傅必填
|
|
16
|
+
*/
|
|
17
|
+
required?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* @description: 题目id
|
|
20
|
+
*/
|
|
21
|
+
id?: string;
|
|
22
|
+
/**
|
|
23
|
+
* @description: 父级id
|
|
24
|
+
*/
|
|
25
|
+
parentId?: string;
|
|
26
|
+
/**
|
|
27
|
+
* @description: 下标
|
|
28
|
+
*/
|
|
29
|
+
index?: number;
|
|
30
|
+
/**
|
|
31
|
+
* @description: 最大长度
|
|
32
|
+
*/
|
|
33
|
+
maxLength?: number;
|
|
34
|
+
/**
|
|
35
|
+
* @description: 获取省份接口
|
|
36
|
+
* @default: false
|
|
37
|
+
*/
|
|
38
|
+
onlyProvince?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* @description: 是否隐藏
|
|
41
|
+
* @default: false
|
|
42
|
+
*/
|
|
43
|
+
hidden?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* @description: 是否更新
|
|
46
|
+
* @default: false
|
|
47
|
+
*/
|
|
48
|
+
update?: boolean;
|
|
49
|
+
}
|
|
50
|
+
export interface AddressParams {
|
|
51
|
+
code: string;
|
|
52
|
+
areaName: string;
|
|
53
|
+
}
|
|
54
|
+
export interface AddressDataType {
|
|
55
|
+
cityCode?: string;
|
|
56
|
+
cityName?: string;
|
|
57
|
+
detailsAddress?: string;
|
|
58
|
+
districtCode?: string;
|
|
59
|
+
districtName?: string;
|
|
60
|
+
provinceCode?: string;
|
|
61
|
+
provinceName?: string;
|
|
62
|
+
addressInfo?: any;
|
|
63
|
+
particulars?: string;
|
|
64
|
+
}
|
|
65
|
+
export type TypeChangeAreaParamType = "province" | "city" | "district" | "";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
+
/*
|
|
17
|
+
* @Author: zhuyanni
|
|
18
|
+
* @Date: 2024-06-21 17:00:26
|
|
19
|
+
* @Last Modified by: lxx
|
|
20
|
+
* @Last Modified time: 2024-10-31 16:51:09
|
|
21
|
+
* @Desc: 地址题
|
|
22
|
+
*/
|
|
23
|
+
import { Form, Input, Select } from "antd";
|
|
24
|
+
import React, { useEffect, useState } from "react";
|
|
25
|
+
import _ from "lodash";
|
|
26
|
+
import "./index.scss";
|
|
27
|
+
var Option = Select.Option;
|
|
28
|
+
var Index = function Index(props) {
|
|
29
|
+
var getProvinces = props.getProvinces,
|
|
30
|
+
getCityOrDistrict = props.getCityOrDistrict,
|
|
31
|
+
form = props.form,
|
|
32
|
+
required = props.required,
|
|
33
|
+
_props$id = props.id,
|
|
34
|
+
id = _props$id === void 0 ? '' : _props$id,
|
|
35
|
+
parentId = props.parentId,
|
|
36
|
+
_props$index = props.index,
|
|
37
|
+
index = _props$index === void 0 ? 0 : _props$index,
|
|
38
|
+
_props$maxLength = props.maxLength,
|
|
39
|
+
maxLength = _props$maxLength === void 0 ? 0 : _props$maxLength,
|
|
40
|
+
_props$onlyProvince = props.onlyProvince,
|
|
41
|
+
onlyProvince = _props$onlyProvince === void 0 ? false : _props$onlyProvince,
|
|
42
|
+
update = props.update,
|
|
43
|
+
hidden = props.hidden;
|
|
44
|
+
var _name = parentId ? [index, id] : id;
|
|
45
|
+
var _useState = useState([]),
|
|
46
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
+
provinceList = _useState2[0],
|
|
48
|
+
setProvinceList = _useState2[1];
|
|
49
|
+
var _useState3 = useState([]),
|
|
50
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
51
|
+
cityList = _useState4[0],
|
|
52
|
+
setCityList = _useState4[1];
|
|
53
|
+
var _useState5 = useState([]),
|
|
54
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
55
|
+
countryList = _useState6[0],
|
|
56
|
+
setCountryList = _useState6[1];
|
|
57
|
+
var reset = function reset() {
|
|
58
|
+
setFormValue(undefined);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// 设置表单值
|
|
62
|
+
var setFormValue = function setFormValue(value) {
|
|
63
|
+
// 有parentId则是数据元素题,id是数组,,没有parentId,则是正常题
|
|
64
|
+
if (!parentId) {
|
|
65
|
+
form.setFieldsValue(_defineProperty({}, id, value));
|
|
66
|
+
} else {
|
|
67
|
+
var parentValue = _.cloneDeep(form.getFieldValue(parentId));
|
|
68
|
+
// console.log(form.getFieldValue(parentId), "parentValue");
|
|
69
|
+
parentValue[index][id] = value ? _objectSpread(_objectSpread({}, parentValue[index][id]), value) : undefined;
|
|
70
|
+
form.setFieldsValue(_defineProperty({}, parentId, parentValue));
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
useEffect(function () {
|
|
74
|
+
getBaseProvince();
|
|
75
|
+
}, []);
|
|
76
|
+
var getBaseProvince = /*#__PURE__*/function () {
|
|
77
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
78
|
+
var _yield$getProvinces, _yield$getProvinces$d, code, result;
|
|
79
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
80
|
+
while (1) switch (_context.prev = _context.next) {
|
|
81
|
+
case 0:
|
|
82
|
+
_context.prev = 0;
|
|
83
|
+
_context.next = 3;
|
|
84
|
+
return getProvinces("province");
|
|
85
|
+
case 3:
|
|
86
|
+
_yield$getProvinces = _context.sent;
|
|
87
|
+
_yield$getProvinces$d = _yield$getProvinces.data;
|
|
88
|
+
code = _yield$getProvinces$d.code;
|
|
89
|
+
result = _yield$getProvinces$d.result;
|
|
90
|
+
if (code === "OK") {
|
|
91
|
+
setProvinceList(result);
|
|
92
|
+
}
|
|
93
|
+
_context.next = 13;
|
|
94
|
+
break;
|
|
95
|
+
case 10:
|
|
96
|
+
_context.prev = 10;
|
|
97
|
+
_context.t0 = _context["catch"](0);
|
|
98
|
+
console.error(_context.t0, 'error');
|
|
99
|
+
case 13:
|
|
100
|
+
case "end":
|
|
101
|
+
return _context.stop();
|
|
102
|
+
}
|
|
103
|
+
}, _callee, null, [[0, 10]]);
|
|
104
|
+
}));
|
|
105
|
+
return function getBaseProvince() {
|
|
106
|
+
return _ref.apply(this, arguments);
|
|
107
|
+
};
|
|
108
|
+
}();
|
|
109
|
+
useEffect(function () {
|
|
110
|
+
var data = form.getFieldValue(parentId ? [parentId, index, id] : id);
|
|
111
|
+
if (data !== null && data !== void 0 && data.provinceCode) {
|
|
112
|
+
var provinceCode = data.provinceCode,
|
|
113
|
+
provinceName = data.provinceName,
|
|
114
|
+
cityCode = data.cityCode,
|
|
115
|
+
cityName = data.cityName,
|
|
116
|
+
districtCode = data.districtCode,
|
|
117
|
+
districtName = data.districtName;
|
|
118
|
+
setTimeout(function () {
|
|
119
|
+
if (provinceCode) {
|
|
120
|
+
onChangeCityOrDistr({
|
|
121
|
+
label: provinceName,
|
|
122
|
+
value: provinceCode
|
|
123
|
+
}, "city", true);
|
|
124
|
+
}
|
|
125
|
+
}, 100);
|
|
126
|
+
setTimeout(function () {
|
|
127
|
+
if (cityCode) {
|
|
128
|
+
onChangeCityOrDistr({
|
|
129
|
+
label: cityName,
|
|
130
|
+
value: cityCode
|
|
131
|
+
}, "district", true).then(function () {
|
|
132
|
+
if (districtCode) {
|
|
133
|
+
onChangeCityOrDistr({
|
|
134
|
+
label: districtName,
|
|
135
|
+
value: districtCode
|
|
136
|
+
}, "", true);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}, 200);
|
|
141
|
+
}
|
|
142
|
+
}, [update]);
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* 省市区改变
|
|
146
|
+
* @param value 选中的data
|
|
147
|
+
* @param type province/city/district
|
|
148
|
+
* @param isInit 是否是初始化
|
|
149
|
+
* @returns
|
|
150
|
+
*/
|
|
151
|
+
var onChangeCityOrDistr = /*#__PURE__*/function () {
|
|
152
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data, type) {
|
|
153
|
+
var isInit,
|
|
154
|
+
label,
|
|
155
|
+
value,
|
|
156
|
+
_yield$getCityOrDistr,
|
|
157
|
+
_yield$getCityOrDistr2,
|
|
158
|
+
code,
|
|
159
|
+
result,
|
|
160
|
+
array,
|
|
161
|
+
_args2 = arguments;
|
|
162
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
163
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
164
|
+
case 0:
|
|
165
|
+
isInit = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : false;
|
|
166
|
+
if (data) {
|
|
167
|
+
_context2.next = 5;
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
if (type === "city") {
|
|
171
|
+
reset();
|
|
172
|
+
setCityList([]);
|
|
173
|
+
}
|
|
174
|
+
console.log("查询省市区地址,value 丢失");
|
|
175
|
+
return _context2.abrupt("return");
|
|
176
|
+
case 5:
|
|
177
|
+
label = data.label, value = data.value;
|
|
178
|
+
if (!type) {
|
|
179
|
+
_context2.next = 23;
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
_context2.prev = 7;
|
|
183
|
+
_context2.next = 10;
|
|
184
|
+
return getCityOrDistrict(value);
|
|
185
|
+
case 10:
|
|
186
|
+
_yield$getCityOrDistr = _context2.sent;
|
|
187
|
+
_yield$getCityOrDistr2 = _yield$getCityOrDistr.data;
|
|
188
|
+
code = _yield$getCityOrDistr2.code;
|
|
189
|
+
result = _yield$getCityOrDistr2.result;
|
|
190
|
+
console.log("🚀 ~ onChangeCityOrDistr ~ code:", code, result);
|
|
191
|
+
if (code === "OK") {
|
|
192
|
+
array = result || [];
|
|
193
|
+
if (type === "city") {
|
|
194
|
+
setCityList(array);
|
|
195
|
+
setCountryList([]);
|
|
196
|
+
if (!isInit) {
|
|
197
|
+
setFormValue({
|
|
198
|
+
provinceCode: value,
|
|
199
|
+
provinceName: label,
|
|
200
|
+
cityCode: undefined,
|
|
201
|
+
cityName: undefined,
|
|
202
|
+
districtCode: undefined,
|
|
203
|
+
districtName: undefined
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
} else if (type === "district") {
|
|
207
|
+
setCountryList(array);
|
|
208
|
+
if (!isInit) {
|
|
209
|
+
setFormValue({
|
|
210
|
+
cityCode: value,
|
|
211
|
+
cityName: label,
|
|
212
|
+
districtCode: undefined,
|
|
213
|
+
districtName: undefined
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
_context2.next = 21;
|
|
219
|
+
break;
|
|
220
|
+
case 18:
|
|
221
|
+
_context2.prev = 18;
|
|
222
|
+
_context2.t0 = _context2["catch"](7);
|
|
223
|
+
console.error(_context2.t0, 'error');
|
|
224
|
+
case 21:
|
|
225
|
+
_context2.next = 24;
|
|
226
|
+
break;
|
|
227
|
+
case 23:
|
|
228
|
+
if (!isInit) {
|
|
229
|
+
setFormValue({
|
|
230
|
+
districtCode: value,
|
|
231
|
+
districtName: label
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
case 24:
|
|
235
|
+
case "end":
|
|
236
|
+
return _context2.stop();
|
|
237
|
+
}
|
|
238
|
+
}, _callee2, null, [[7, 18]]);
|
|
239
|
+
}));
|
|
240
|
+
return function onChangeCityOrDistr(_x, _x2) {
|
|
241
|
+
return _ref2.apply(this, arguments);
|
|
242
|
+
};
|
|
243
|
+
}();
|
|
244
|
+
return /*#__PURE__*/React.createElement(Form.Item, {
|
|
245
|
+
className: "selectPosition",
|
|
246
|
+
name: _name,
|
|
247
|
+
hidden: hidden
|
|
248
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
249
|
+
className: "selectPosition-box"
|
|
250
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
251
|
+
name: parentId ? [index, id, 'provinceName'] : [id, 'provinceName'],
|
|
252
|
+
rules: [{
|
|
253
|
+
required: required,
|
|
254
|
+
message: '请选择省'
|
|
255
|
+
}]
|
|
256
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
257
|
+
showSearch: true,
|
|
258
|
+
allowClear: true,
|
|
259
|
+
placeholder: "\u8BF7\u9009\u62E9\u7701",
|
|
260
|
+
optionFilterProp: "children",
|
|
261
|
+
filterOption: function filterOption(input, option) {
|
|
262
|
+
return option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
263
|
+
},
|
|
264
|
+
onChange: function onChange(value) {
|
|
265
|
+
return onChangeCityOrDistr(value, "city");
|
|
266
|
+
},
|
|
267
|
+
labelInValue: true
|
|
268
|
+
}, provinceList.map(function (item) {
|
|
269
|
+
return /*#__PURE__*/React.createElement(Option, {
|
|
270
|
+
value: item.code,
|
|
271
|
+
key: item.code
|
|
272
|
+
}, item.areaName);
|
|
273
|
+
}))), /*#__PURE__*/React.createElement(Form.Item, {
|
|
274
|
+
name: parentId ? [index, id, 'provinceCode'] : [id, 'provinceCode'],
|
|
275
|
+
hidden: true
|
|
276
|
+
}), /*#__PURE__*/React.createElement(Form.Item, {
|
|
277
|
+
name: parentId ? [index, id, 'cityName'] : [id, 'cityName'],
|
|
278
|
+
rules: [{
|
|
279
|
+
required: required,
|
|
280
|
+
message: '请选择市'
|
|
281
|
+
}]
|
|
282
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
283
|
+
showSearch: true,
|
|
284
|
+
allowClear: true,
|
|
285
|
+
placeholder: "\u8BF7\u9009\u62E9\u5E02",
|
|
286
|
+
optionFilterProp: "children",
|
|
287
|
+
popupMatchSelectWidth: false,
|
|
288
|
+
filterOption: function filterOption(input, option) {
|
|
289
|
+
return option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
290
|
+
},
|
|
291
|
+
onChange: function onChange(value) {
|
|
292
|
+
return onChangeCityOrDistr(value, "district");
|
|
293
|
+
},
|
|
294
|
+
labelInValue: true
|
|
295
|
+
}, cityList.map(function (item) {
|
|
296
|
+
return /*#__PURE__*/React.createElement(Option, {
|
|
297
|
+
value: item.code,
|
|
298
|
+
key: item.code
|
|
299
|
+
}, item.areaName);
|
|
300
|
+
}))), /*#__PURE__*/React.createElement(Form.Item, {
|
|
301
|
+
name: parentId ? [index, id, 'cityCode'] : [id, 'cityCode'],
|
|
302
|
+
hidden: true
|
|
303
|
+
}), !onlyProvince && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form.Item, {
|
|
304
|
+
name: parentId ? [index, id, 'districtName'] : [id, 'districtName'],
|
|
305
|
+
rules: [{
|
|
306
|
+
required: required,
|
|
307
|
+
message: '请选择区(县)'
|
|
308
|
+
}]
|
|
309
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
310
|
+
showSearch: true,
|
|
311
|
+
allowClear: true,
|
|
312
|
+
placeholder: "\u8BF7\u9009\u62E9\u533A(\u53BF)",
|
|
313
|
+
optionFilterProp: "children",
|
|
314
|
+
filterOption: function filterOption(input, option) {
|
|
315
|
+
return option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
316
|
+
},
|
|
317
|
+
onChange: function onChange(value) {
|
|
318
|
+
return onChangeCityOrDistr(value, "");
|
|
319
|
+
},
|
|
320
|
+
labelInValue: true
|
|
321
|
+
}, countryList.map(function (item) {
|
|
322
|
+
return /*#__PURE__*/React.createElement(Option, {
|
|
323
|
+
value: item.code,
|
|
324
|
+
key: item.code
|
|
325
|
+
}, item.areaName);
|
|
326
|
+
}))), /*#__PURE__*/React.createElement(Form.Item, {
|
|
327
|
+
name: parentId ? [index, id, 'districtCode'] : [id, 'districtCode'],
|
|
328
|
+
hidden: true
|
|
329
|
+
}))), !onlyProvince && /*#__PURE__*/React.createElement("div", {
|
|
330
|
+
className: "mt"
|
|
331
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
332
|
+
name: parentId ? [index, id, 'particulars'] : [id, 'particulars'],
|
|
333
|
+
rules: [{
|
|
334
|
+
required: required,
|
|
335
|
+
message: '请输入详细地址'
|
|
336
|
+
}]
|
|
337
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
338
|
+
placeholder: "\u8BF7\u8F93\u5165\u8BE6\u7EC6\u5730\u5740",
|
|
339
|
+
autoComplete: "off",
|
|
340
|
+
showCount: true,
|
|
341
|
+
allowClear: true,
|
|
342
|
+
maxLength: maxLength || 50,
|
|
343
|
+
onBlur: function onBlur(e) {
|
|
344
|
+
var _id = parentId ? [parentId, index, id] : [id];
|
|
345
|
+
var data = form.getFieldValue(_id) || {};
|
|
346
|
+
// input没有值,并且只有一个当前id只有input一个值时,重置答案
|
|
347
|
+
if (!e.target.value && Object.keys(data).length === 1) {
|
|
348
|
+
reset();
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}))));
|
|
352
|
+
};
|
|
353
|
+
export default Index;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface IndexProps {
|
|
3
|
+
text: string;
|
|
4
|
+
rows?: number;
|
|
5
|
+
copy?: boolean;
|
|
6
|
+
type?: 'secondary' | 'success' | 'warning' | 'danger';
|
|
7
|
+
expandable?: boolean | 'collapsible';
|
|
8
|
+
ellipsis?: {
|
|
9
|
+
suffix?: string;
|
|
10
|
+
symbol?: ReactNode | ((expanded: boolean) => ReactNode);
|
|
11
|
+
onEllipsis?: (ellipsis: any) => void;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["text", "rows", "copy", "type", "expandable", "ellipsis"];
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
17
|
+
import { Tooltip, Typography } from 'antd';
|
|
18
|
+
import React, { useState } from 'react';
|
|
19
|
+
import "./index.scss";
|
|
20
|
+
|
|
21
|
+
// 参考antd的Typography,只能用与Paragraph
|
|
22
|
+
/// 如果需要自定义,则手动传入ellipsis,会覆盖默认值
|
|
23
|
+
var Index = function Index(props) {
|
|
24
|
+
var text = props.text,
|
|
25
|
+
_props$rows = props.rows,
|
|
26
|
+
rows = _props$rows === void 0 ? 1 : _props$rows,
|
|
27
|
+
_props$copy = props.copy,
|
|
28
|
+
copy = _props$copy === void 0 ? false : _props$copy,
|
|
29
|
+
_props$type = props.type,
|
|
30
|
+
type = _props$type === void 0 ? 'secondary' : _props$type,
|
|
31
|
+
_props$expandable = props.expandable,
|
|
32
|
+
expandable = _props$expandable === void 0 ? false : _props$expandable,
|
|
33
|
+
_props$ellipsis = props.ellipsis,
|
|
34
|
+
ellipsis = _props$ellipsis === void 0 ? {} : _props$ellipsis,
|
|
35
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
36
|
+
var _useState = useState(false),
|
|
37
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
38
|
+
expanded = _useState2[0],
|
|
39
|
+
setExpanded = _useState2[1]; // 展开收起
|
|
40
|
+
|
|
41
|
+
var textRender = function textRender() {
|
|
42
|
+
return /*#__PURE__*/React.createElement(Typography.Paragraph, _extends({
|
|
43
|
+
// rows = 1时,需要自行设置css,否则会默认全部展示
|
|
44
|
+
className: rows === 1 && !expanded && !expandable ? 'custom_Typography_row1' : '',
|
|
45
|
+
style: {
|
|
46
|
+
marginBottom: 0
|
|
47
|
+
},
|
|
48
|
+
ellipsis: _objectSpread({
|
|
49
|
+
rows: rows,
|
|
50
|
+
expandable: expandable,
|
|
51
|
+
expanded: expanded,
|
|
52
|
+
onExpand: function onExpand(_, info) {
|
|
53
|
+
return setExpanded(info.expanded);
|
|
54
|
+
},
|
|
55
|
+
symbol: function symbol(expanded) {
|
|
56
|
+
return !expanded ? '展开' : '收起';
|
|
57
|
+
}
|
|
58
|
+
}, ellipsis),
|
|
59
|
+
copyable: copy,
|
|
60
|
+
type: type
|
|
61
|
+
}, rest), /*#__PURE__*/React.createElement(React.Fragment, null, text || ''));
|
|
62
|
+
};
|
|
63
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !expanded ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
64
|
+
title: text
|
|
65
|
+
}, textRender()) : /*#__PURE__*/React.createElement(React.Fragment, null, textRender()));
|
|
66
|
+
};
|
|
67
|
+
export default Index;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|