@vortex-ui/env-puzzle 2.0.0-beta.2 → 2.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/b-map/b-map.d.ts +63 -0
- package/lib/b-map/b-map.js +296 -0
- package/lib/b-map/b-map.js.map +1 -0
- package/lib/b-map/custom-overlay.d.ts +13 -0
- package/lib/b-map/custom-overlay.js +84 -0
- package/lib/b-map/custom-overlay.js.map +1 -0
- package/lib/b-map/drawing.d.ts +14 -0
- package/lib/b-map/drawing.js +73 -0
- package/lib/b-map/drawing.js.map +1 -0
- package/lib/b-map/index.d.ts +17 -0
- package/lib/b-map/index.js +35 -0
- package/lib/b-map/index.js.map +1 -0
- package/lib/b-map/js/marker-clusterer.js +158 -42
- package/lib/b-map/js/marker-clusterer.js.map +1 -1
- package/lib/b-map/lushu.d.ts +16 -0
- package/lib/b-map/lushu.js +78 -0
- package/lib/b-map/lushu.js.map +1 -0
- package/lib/b-map/marker-clusterer.d.ts +29 -0
- package/lib/b-map/marker-clusterer.js +52 -0
- package/lib/b-map/marker-clusterer.js.map +1 -0
- package/lib/b-map/marker.d.ts +45 -0
- package/lib/b-map/marker.js +184 -0
- package/lib/b-map/marker.js.map +1 -0
- package/lib/b-map/polygon.d.ts +54 -0
- package/lib/b-map/polygon.js +44 -0
- package/lib/b-map/polygon.js.map +1 -0
- package/lib/b-map/style/css.js +4 -0
- package/lib/b-map/style/css.js.map +1 -0
- package/lib/b-map/style/index.d.ts +1 -0
- package/lib/b-map/style/index.js +4 -0
- package/lib/b-map/style/index.js.map +1 -0
- package/lib/create-modal/create-modal.d.ts +31 -0
- package/lib/create-modal/create-modal.js +653 -0
- package/lib/create-modal/create-modal.js.map +1 -0
- package/lib/create-modal/index.d.ts +3 -0
- package/lib/create-modal/index.js +14 -0
- package/lib/create-modal/index.js.map +1 -0
- package/lib/create-modal/style/css.js +22 -0
- package/lib/create-modal/style/css.js.map +1 -0
- package/lib/create-modal/style/index.d.ts +10 -0
- package/lib/create-modal/style/index.js +22 -0
- package/lib/create-modal/style/index.js.map +1 -0
- package/lib/import-modal/import-modal.d.ts +23 -0
- package/lib/import-modal/import-modal.js +358 -0
- package/lib/import-modal/import-modal.js.map +1 -0
- package/lib/import-modal/index.d.ts +2 -0
- package/lib/import-modal/index.js +14 -0
- package/lib/import-modal/index.js.map +1 -0
- package/lib/import-modal/style/css.js +14 -0
- package/lib/import-modal/style/css.js.map +1 -0
- package/lib/import-modal/style/index.d.ts +6 -0
- package/lib/import-modal/style/index.js +14 -0
- package/lib/import-modal/style/index.js.map +1 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +104 -0
- package/lib/index.js.map +1 -0
- package/lib/interface/index.d.ts +7 -0
- package/lib/interface/index.js +6 -0
- package/lib/interface/index.js.map +1 -0
- package/lib/mapv-Layer/Function.d.ts +1 -0
- package/lib/mapv-Layer/Function.js +2 -0
- package/lib/mapv-Layer/Function.js.map +1 -1
- package/lib/mapv-Layer/index.d.ts +2 -0
- package/lib/mapv-Layer/index.js +14 -0
- package/lib/mapv-Layer/index.js.map +1 -0
- package/lib/mapv-Layer/mapv-Layer.d.ts +7 -0
- package/lib/mapv-Layer/mapv-Layer.js +117 -0
- package/lib/mapv-Layer/mapv-Layer.js.map +1 -0
- package/lib/mapv-Layer/style/css.js +2 -0
- package/lib/mapv-Layer/style/css.js.map +1 -0
- package/lib/mapv-Layer/style/index.d.ts +1 -0
- package/lib/mapv-Layer/style/index.js +2 -0
- package/lib/mapv-Layer/style/index.js.map +1 -0
- package/lib/percent/images/icon-arrow.png +0 -0
- package/lib/percent/index.d.ts +8 -0
- package/lib/percent/index.js +18 -0
- package/lib/percent/index.js.map +1 -0
- package/lib/percent/interface.d.ts +6 -0
- package/lib/percent/interface.js +6 -0
- package/lib/percent/interface.js.map +1 -0
- package/lib/percent/line-percent.d.ts +11 -0
- package/lib/percent/line-percent.js +114 -0
- package/lib/percent/line-percent.js.map +1 -0
- package/lib/percent/percent.d.ts +10 -0
- package/lib/percent/percent.js +139 -0
- package/lib/percent/percent.js.map +1 -0
- package/lib/percent/style/css.js +4 -0
- package/lib/percent/style/css.js.map +1 -0
- package/lib/percent/style/index.d.ts +1 -0
- package/lib/percent/style/index.js +4 -0
- package/lib/percent/style/index.js.map +1 -0
- package/lib/scroll/index.d.ts +2 -0
- package/lib/scroll/index.js +14 -0
- package/lib/scroll/index.js.map +1 -0
- package/lib/scroll/scroll.d.ts +4 -0
- package/lib/scroll/scroll.js +105 -0
- package/lib/scroll/scroll.js.map +1 -0
- package/lib/scroll/style/css.js +4 -0
- package/lib/scroll/style/css.js.map +1 -0
- package/lib/scroll/style/index.d.ts +1 -0
- package/lib/scroll/style/index.js +4 -0
- package/lib/scroll/style/index.js.map +1 -0
- package/lib/scroll-select/index.d.ts +2 -0
- package/lib/scroll-select/index.js +14 -0
- package/lib/scroll-select/index.js.map +1 -0
- package/lib/scroll-select/scrollSelect.d.ts +2 -0
- package/lib/scroll-select/scrollSelect.js +323 -0
- package/lib/scroll-select/scrollSelect.js.map +1 -0
- package/lib/scroll-select/style/css.js +6 -0
- package/lib/scroll-select/style/css.js.map +1 -0
- package/lib/scroll-select/style/index.d.ts +2 -0
- package/lib/scroll-select/style/index.js +6 -0
- package/lib/scroll-select/style/index.js.map +1 -0
- package/lib/table/index.d.ts +2 -0
- package/lib/table/index.js +14 -0
- package/lib/table/index.js.map +1 -0
- package/lib/table/style/css.js +6 -0
- package/lib/table/style/css.js.map +1 -0
- package/lib/table/style/index.d.ts +2 -0
- package/lib/table/style/index.js +6 -0
- package/lib/table/style/index.js.map +1 -0
- package/lib/table/table.d.ts +17 -0
- package/lib/table/table.js +162 -0
- package/lib/table/table.js.map +1 -0
- package/lib/template/action.d.ts +57 -0
- package/lib/template/action.js +265 -0
- package/lib/template/action.js.map +1 -0
- package/lib/template/card-table.d.ts +35 -0
- package/lib/template/card-table.js +193 -0
- package/lib/template/card-table.js.map +1 -0
- package/lib/template/card.d.ts +15 -0
- package/lib/template/card.js +116 -0
- package/lib/template/card.js.map +1 -0
- package/lib/template/check-row.d.ts +6 -0
- package/lib/template/check-row.js +39 -0
- package/lib/template/check-row.js.map +1 -0
- package/lib/template/field.d.ts +6 -0
- package/lib/template/field.js +50 -0
- package/lib/template/field.js.map +1 -0
- package/lib/template/filter.d.ts +13 -0
- package/lib/template/filter.js +146 -0
- package/lib/template/filter.js.map +1 -0
- package/lib/template/icon.d.ts +6 -0
- package/lib/template/icon.js +33 -0
- package/lib/template/icon.js.map +1 -0
- package/lib/template/index.d.ts +13 -0
- package/lib/template/index.js +24 -0
- package/lib/template/index.js.map +1 -0
- package/lib/template/interface.d.ts +4 -0
- package/lib/template/interface.js +6 -0
- package/lib/template/interface.js.map +1 -0
- package/lib/template/renderColumnButtons.d.ts +2 -0
- package/lib/template/renderColumnButtons.js +173 -0
- package/lib/template/renderColumnButtons.js.map +1 -0
- package/lib/template/style/css.js +40 -0
- package/lib/template/style/css.js.map +1 -0
- package/lib/template/style/index.d.ts +19 -0
- package/lib/template/style/index.js +40 -0
- package/lib/template/style/index.js.map +1 -0
- package/lib/template/table.d.ts +44 -0
- package/lib/template/table.js +103 -0
- package/lib/template/table.js.map +1 -0
- package/lib/template/template.d.ts +84 -0
- package/lib/template/template.js +610 -0
- package/lib/template/template.js.map +1 -0
- package/lib/template/toolbar.d.ts +16 -0
- package/lib/template/toolbar.js +102 -0
- package/lib/template/toolbar.js.map +1 -0
- package/lib/to-map/container.d.ts +28 -0
- package/lib/to-map/container.js +295 -0
- package/lib/to-map/container.js.map +1 -0
- package/lib/to-map/draw-area.d.ts +6 -0
- package/lib/to-map/draw-area.js +66 -0
- package/lib/to-map/draw-area.js.map +1 -0
- package/lib/to-map/images/icon-area.png +0 -0
- package/lib/to-map/images/icon-picker.png +0 -0
- package/lib/to-map/index.d.ts +8 -0
- package/lib/to-map/index.js +18 -0
- package/lib/to-map/index.js.map +1 -0
- package/lib/to-map/style/css.js +6 -0
- package/lib/to-map/style/css.js.map +1 -0
- package/lib/to-map/style/index.d.ts +2 -0
- package/lib/to-map/style/index.js +6 -0
- package/lib/to-map/style/index.js.map +1 -0
- package/lib/to-map/to-map.d.ts +12 -0
- package/lib/to-map/to-map.js +120 -0
- package/lib/to-map/to-map.js.map +1 -0
- package/lib/upload/index.d.ts +2 -0
- package/lib/upload/index.js +14 -0
- package/lib/upload/index.js.map +1 -0
- package/lib/upload/style/css.js +10 -0
- package/lib/upload/style/css.js.map +1 -0
- package/lib/upload/style/index.d.ts +4 -0
- package/lib/upload/style/index.js +10 -0
- package/lib/upload/style/index.js.map +1 -0
- package/lib/upload/upload.d.ts +12 -0
- package/lib/upload/upload.js +445 -0
- package/lib/upload/upload.js.map +1 -0
- package/lib/use-simple-res/demos/index.d.ts +2 -0
- package/lib/use-simple-res/demos/index.js +116 -0
- package/lib/use-simple-res/demos/index.js.map +1 -0
- package/lib/use-simple-res/index.d.ts +28 -0
- package/lib/use-simple-res/index.js +99 -0
- package/lib/use-simple-res/index.js.map +1 -0
- package/lib/use-simple-res/style/css.js +4 -0
- package/lib/use-simple-res/style/css.js.map +1 -0
- package/lib/use-simple-res/style/index.d.ts +1 -0
- package/lib/use-simple-res/style/index.js +4 -0
- package/lib/use-simple-res/style/index.js.map +1 -0
- package/lib/utils/dom-util.d.ts +19 -0
- package/lib/utils/dom-util.js +98 -0
- package/lib/utils/dom-util.js.map +1 -0
- package/lib/utils/request-util.d.ts +42 -0
- package/lib/utils/request-util.js +191 -0
- package/lib/utils/request-util.js.map +1 -0
- package/lib/utils/string-util.d.ts +11 -0
- package/lib/utils/string-util.js +47 -0
- package/lib/utils/string-util.js.map +1 -0
- package/lib/view-modal/index.d.ts +2 -0
- package/lib/view-modal/index.js +14 -0
- package/lib/view-modal/index.js.map +1 -0
- package/lib/view-modal/style/css.js +16 -0
- package/lib/view-modal/style/css.js.map +1 -0
- package/lib/view-modal/style/index.d.ts +8 -0
- package/lib/view-modal/style/index.js +16 -0
- package/lib/view-modal/style/index.js.map +1 -0
- package/lib/view-modal/view-modal.d.ts +8 -0
- package/lib/view-modal/view-modal.js +208 -0
- package/lib/view-modal/view-modal.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _biz = require("@vortex-ui/biz");
|
|
13
|
+
|
|
14
|
+
var _antd = require("antd");
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
21
|
+
|
|
22
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
23
|
+
|
|
24
|
+
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."); }
|
|
25
|
+
|
|
26
|
+
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); }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
31
|
+
|
|
32
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
33
|
+
|
|
34
|
+
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
35
|
+
function adopt(value) {
|
|
36
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
37
|
+
resolve(value);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
42
|
+
function fulfilled(value) {
|
|
43
|
+
try {
|
|
44
|
+
step(generator.next(value));
|
|
45
|
+
} catch (e) {
|
|
46
|
+
reject(e);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function rejected(value) {
|
|
51
|
+
try {
|
|
52
|
+
step(generator["throw"](value));
|
|
53
|
+
} catch (e) {
|
|
54
|
+
reject(e);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function step(result) {
|
|
59
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
var _default = function _default() {
|
|
67
|
+
var _useState = (0, _react.useState)(''),
|
|
68
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
69
|
+
showData = _useState2[0],
|
|
70
|
+
setShowData = _useState2[1];
|
|
71
|
+
|
|
72
|
+
var _useSimpleRes = (0, _biz.useSimpleRes)({
|
|
73
|
+
url: '/cloud/yht/v2/web/common/enum/list',
|
|
74
|
+
method: 'post'
|
|
75
|
+
}),
|
|
76
|
+
enumRun = _useSimpleRes.run,
|
|
77
|
+
enumData = _useSimpleRes.data;
|
|
78
|
+
|
|
79
|
+
(0, _react.useEffect)(function () {
|
|
80
|
+
enumRun({
|
|
81
|
+
className: 'AuditStaffTypeEnum'
|
|
82
|
+
});
|
|
83
|
+
}, []);
|
|
84
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_antd.Button, {
|
|
85
|
+
onClick: function onClick() {
|
|
86
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
87
|
+
var dataString;
|
|
88
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
89
|
+
while (1) {
|
|
90
|
+
switch (_context.prev = _context.next) {
|
|
91
|
+
case 0:
|
|
92
|
+
_context.next = 2;
|
|
93
|
+
return enumRun({
|
|
94
|
+
className: 'AuditStaffTypeEnum'
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
case 2:
|
|
98
|
+
dataString = JSON.stringify(enumData);
|
|
99
|
+
setShowData(dataString);
|
|
100
|
+
|
|
101
|
+
case 4:
|
|
102
|
+
case "end":
|
|
103
|
+
return _context.stop();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}, _callee);
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
}, "\u53D1\u9001\u8BF7\u6C42useSimpleRes"), /*#__PURE__*/_react["default"].createElement(_antd.Input.TextArea, {
|
|
110
|
+
value: showData,
|
|
111
|
+
autoSize: true
|
|
112
|
+
}));
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
exports["default"] = _default;
|
|
116
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["__awaiter","thisArg","_arguments","P","generator","adopt","value","resolve","Promise","reject","fulfilled","step","next","e","rejected","result","done","then","apply","useState","showData","setShowData","useSimpleRes","url","method","enumRun","run","enumData","data","useEffect","className","React","createElement","Fragment","Button","onClick","dataString","JSON","stringify","Input","TextArea","autoSize"],"sources":["use-simple-res/demos/index.js"],"sourcesContent":["var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport React, { useState, useEffect } from 'react';\nimport { useSimpleRes } from '@vortex-ui/biz';\nimport { Button, Input } from 'antd';\nexport default () => {\n const [showData, setShowData] = useState('');\n const { run: enumRun, data: enumData } = useSimpleRes({\n url: '/cloud/yht/v2/web/common/enum/list',\n method: 'post',\n });\n useEffect(() => {\n enumRun({\n className: 'AuditStaffTypeEnum',\n });\n }, []);\n return (React.createElement(React.Fragment, null,\n React.createElement(Button, { onClick: () => __awaiter(void 0, void 0, void 0, function* () {\n yield enumRun({\n className: 'AuditStaffTypeEnum',\n });\n const dataString = JSON.stringify(enumData);\n setShowData(dataString);\n }) }, \"\\u53D1\\u9001\\u8BF7\\u6C42useSimpleRes\"),\n React.createElement(Input.TextArea, { value: showData, autoSize: true })));\n};\n"],"mappings":";;;;;;;;;AASA;;AACA;;AACA;;;;;;+CAVA,oJ;;;;;;;;;;;;;;AADA,IAAIA,SAAS,GAAI,UAAQ,SAAKA,SAAd,IAA4B,UAAUC,OAAV,EAAmBC,UAAnB,EAA+BC,CAA/B,EAAkCC,SAAlC,EAA6C;EACrF,SAASC,KAAT,CAAeC,KAAf,EAAsB;IAAE,OAAOA,KAAK,YAAYH,CAAjB,GAAqBG,KAArB,GAA6B,IAAIH,CAAJ,CAAM,UAAUI,OAAV,EAAmB;MAAEA,OAAO,CAACD,KAAD,CAAP;IAAiB,CAA5C,CAApC;EAAoF;;EAC5G,OAAO,KAAKH,CAAC,KAAKA,CAAC,GAAGK,OAAT,CAAN,EAAyB,UAAUD,OAAV,EAAmBE,MAAnB,EAA2B;IACvD,SAASC,SAAT,CAAmBJ,KAAnB,EAA0B;MAAE,IAAI;QAAEK,IAAI,CAACP,SAAS,CAACQ,IAAV,CAAeN,KAAf,CAAD,CAAJ;MAA8B,CAApC,CAAqC,OAAOO,CAAP,EAAU;QAAEJ,MAAM,CAACI,CAAD,CAAN;MAAY;IAAE;;IAC3F,SAASC,QAAT,CAAkBR,KAAlB,EAAyB;MAAE,IAAI;QAAEK,IAAI,CAACP,SAAS,CAAC,OAAD,CAAT,CAAmBE,KAAnB,CAAD,CAAJ;MAAkC,CAAxC,CAAyC,OAAOO,CAAP,EAAU;QAAEJ,MAAM,CAACI,CAAD,CAAN;MAAY;IAAE;;IAC9F,SAASF,IAAT,CAAcI,MAAd,EAAsB;MAAEA,MAAM,CAACC,IAAP,GAAcT,OAAO,CAACQ,MAAM,CAACT,KAAR,CAArB,GAAsCD,KAAK,CAACU,MAAM,CAACT,KAAR,CAAL,CAAoBW,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AAmBqB,QAAQ,EAAE;EAA7B,CAApC,CARI,CAAR;AASH,C"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author maoyungui
|
|
3
|
+
* @description 封装请求相关的钩子函数
|
|
4
|
+
* @param onSuccess 成功回调函数
|
|
5
|
+
* @param onFailed 失败回调函数
|
|
6
|
+
* @param manual true 手动执行 false 自动执行请求
|
|
7
|
+
* @param params 初始传参
|
|
8
|
+
* @param allowMessage 默认为true 允许失败的时候报错
|
|
9
|
+
* @param successText 执行成功时的提示文字
|
|
10
|
+
* @param failedText 执行失败时的提示文字,默认为操作失败
|
|
11
|
+
*/
|
|
12
|
+
import 'antd/lib/message/style';
|
|
13
|
+
export interface configs {
|
|
14
|
+
onSuccess?: any;
|
|
15
|
+
successText?: any;
|
|
16
|
+
onFailed?: any;
|
|
17
|
+
failedText?: any;
|
|
18
|
+
onError?: any;
|
|
19
|
+
manual?: any;
|
|
20
|
+
params?: any;
|
|
21
|
+
allowMessage?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare const useSimpleRes: (option: any, config?: configs) => {
|
|
24
|
+
run: any;
|
|
25
|
+
data: any;
|
|
26
|
+
loading: any;
|
|
27
|
+
};
|
|
28
|
+
export default useSimpleRes;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useSimpleRes = exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _message = _interopRequireDefault(require("antd/lib/message"));
|
|
9
|
+
|
|
10
|
+
require("antd/lib/message/style");
|
|
11
|
+
|
|
12
|
+
var _vtxSndApi = require("vtx-snd-api");
|
|
13
|
+
|
|
14
|
+
var _react = require("react");
|
|
15
|
+
|
|
16
|
+
var _useRequest = _interopRequireDefault(require("@ahooksjs/use-request"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
|
|
20
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
|
+
|
|
22
|
+
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."); }
|
|
23
|
+
|
|
24
|
+
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); }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
29
|
+
|
|
30
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
+
|
|
32
|
+
var useSimpleRes = function useSimpleRes(option) {
|
|
33
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
34
|
+
var _onSuccess = config.onSuccess,
|
|
35
|
+
onFailed = config.onFailed,
|
|
36
|
+
_onError = config.onError,
|
|
37
|
+
_config$manual = config.manual,
|
|
38
|
+
manual = _config$manual === void 0 ? true : _config$manual,
|
|
39
|
+
successText = config.successText,
|
|
40
|
+
failedText = config.failedText,
|
|
41
|
+
params = config.params,
|
|
42
|
+
_config$allowMessage = config.allowMessage,
|
|
43
|
+
allowMessage = _config$allowMessage === void 0 ? true : _config$allowMessage;
|
|
44
|
+
|
|
45
|
+
var _useState = (0, _react.useState)(undefined),
|
|
46
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
+
data = _useState2[0],
|
|
48
|
+
setData = _useState2[1];
|
|
49
|
+
|
|
50
|
+
var _Requesthooks$request = _vtxSndApi.Requesthooks.request({
|
|
51
|
+
params: params,
|
|
52
|
+
useRequest: _useRequest["default"],
|
|
53
|
+
option: option,
|
|
54
|
+
manual: manual,
|
|
55
|
+
fetchKey: function fetchKey(type) {
|
|
56
|
+
return type;
|
|
57
|
+
},
|
|
58
|
+
onSuccess: function onSuccess(res, type) {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
|
|
61
|
+
var result = res === null || res === void 0 ? void 0 : res.data;
|
|
62
|
+
|
|
63
|
+
if ((result === null || result === void 0 ? void 0 : result.result) == 0) {
|
|
64
|
+
if ((_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
65
|
+
setData((_b = result === null || result === void 0 ? void 0 : result.data) === null || _b === void 0 ? void 0 : _b.data);
|
|
66
|
+
} else if (result === null || result === void 0 ? void 0 : result.data) {
|
|
67
|
+
setData(result === null || result === void 0 ? void 0 : result.data);
|
|
68
|
+
} else {
|
|
69
|
+
setData(result);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
successText && _message["default"].success(successText);
|
|
73
|
+
_onSuccess && _onSuccess(res, type);
|
|
74
|
+
} else {
|
|
75
|
+
allowMessage && _message["default"].error((result === null || result === void 0 ? void 0 : result.msg) || failedText || '操作失败');
|
|
76
|
+
onFailed && onFailed(res, type);
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
onError: function onError(res, type) {
|
|
80
|
+
var _a;
|
|
81
|
+
|
|
82
|
+
allowMessage && _message["default"].error(((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.msg) || '服务器异常');
|
|
83
|
+
_onError && _onError(res, type);
|
|
84
|
+
}
|
|
85
|
+
}),
|
|
86
|
+
run = _Requesthooks$request.run,
|
|
87
|
+
loading = _Requesthooks$request.loading;
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
run: run,
|
|
91
|
+
data: data,
|
|
92
|
+
loading: loading
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
exports.useSimpleRes = useSimpleRes;
|
|
97
|
+
var _default = useSimpleRes;
|
|
98
|
+
exports["default"] = _default;
|
|
99
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["useSimpleRes","option","config","onSuccess","onFailed","onError","manual","successText","failedText","params","allowMessage","useState","undefined","data","setData","Requesthooks","request","useRequest","fetchKey","type","res","_a","_b","result","message","success","error","msg","run","loading"],"sources":["use-simple-res/index.js"],"sourcesContent":["/**\n * @author maoyungui\n * @description 封装请求相关的钩子函数\n * @param onSuccess 成功回调函数\n * @param onFailed 失败回调函数\n * @param manual true 手动执行 false 自动执行请求\n * @param params 初始传参\n * @param allowMessage 默认为true 允许失败的时候报错\n * @param successText 执行成功时的提示文字\n * @param failedText 执行失败时的提示文字,默认为操作失败\n */\nimport message from 'antd/lib/message';\nimport 'antd/lib/message/style';\nimport { Requesthooks } from 'vtx-snd-api';\nimport { useState } from 'react';\nimport useRequest from '@ahooksjs/use-request';\nexport const useSimpleRes = (option, config = {}) => {\n const { onSuccess, onFailed, onError, manual = true, successText, failedText, params, allowMessage = true, } = config;\n const [data, setData] = useState(undefined);\n const { run, loading } = Requesthooks.request({\n params,\n useRequest,\n option: option,\n manual: manual,\n fetchKey: (type) => type,\n onSuccess: (res, type) => {\n var _a, _b;\n const result = res === null || res === void 0 ? void 0 : res.data;\n if ((result === null || result === void 0 ? void 0 : result.result) == 0) {\n if ((_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.data) {\n setData((_b = result === null || result === void 0 ? void 0 : result.data) === null || _b === void 0 ? void 0 : _b.data);\n }\n else if (result === null || result === void 0 ? void 0 : result.data) {\n setData(result === null || result === void 0 ? void 0 : result.data);\n }\n else {\n setData(result);\n }\n successText && message.success(successText);\n onSuccess && onSuccess(res, type);\n }\n else {\n allowMessage\n && message.error((result === null || result === void 0 ? void 0 : result.msg) || failedText || '操作失败');\n onFailed && onFailed(res, type);\n }\n },\n onError: (res, type) => {\n var _a;\n allowMessage && message.error(((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.msg) || '服务器异常');\n onError && onError(res, type);\n },\n });\n return { run, data, loading };\n};\nexport default useSimpleRes;\n"],"mappings":";;;;;;;AAWA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;AACO,IAAMA,YAAY,GAAG,SAAfA,YAAe,CAACC,MAAD,EAAyB;EAAA,IAAhBC,MAAgB,uEAAP,EAAO;EACjD,IAAQC,UAAR,GAA+GD,MAA/G,CAAQC,SAAR;EAAA,IAAmBC,QAAnB,GAA+GF,MAA/G,CAAmBE,QAAnB;EAAA,IAA6BC,QAA7B,GAA+GH,MAA/G,CAA6BG,OAA7B;EAAA,qBAA+GH,MAA/G,CAAsCI,MAAtC;EAAA,IAAsCA,MAAtC,+BAA+C,IAA/C;EAAA,IAAqDC,WAArD,GAA+GL,MAA/G,CAAqDK,WAArD;EAAA,IAAkEC,UAAlE,GAA+GN,MAA/G,CAAkEM,UAAlE;EAAA,IAA8EC,MAA9E,GAA+GP,MAA/G,CAA8EO,MAA9E;EAAA,2BAA+GP,MAA/G,CAAsFQ,YAAtF;EAAA,IAAsFA,YAAtF,qCAAqG,IAArG;;EACA,gBAAwB,IAAAC,eAAA,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AtCM;;;eAuCQ7B,Y"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css.js","names":[],"sources":["use-simple-res/style/index.js"],"sourcesContent":["import './index.less';\n"],"mappings":";;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["use-simple-res/style/index.js"],"sourcesContent":["import './index.less';\n"],"mappings":";;AAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 常用的操作DOM的工具类
|
|
3
|
+
*/
|
|
4
|
+
export default class DomUtil {
|
|
5
|
+
/**
|
|
6
|
+
* 使用Promise异步的方式加载js文件
|
|
7
|
+
* @param {string} url 加载的路径
|
|
8
|
+
* @param {string} id script元素的id
|
|
9
|
+
* @return {Promise | undefined}
|
|
10
|
+
*/
|
|
11
|
+
static loadJavascript(url: string, id?: string): Promise<unknown>;
|
|
12
|
+
/**
|
|
13
|
+
* 使用Promise异步的方式加载css文件
|
|
14
|
+
* @param {string} url 加载的css的url
|
|
15
|
+
* @param {string} id link元素的id
|
|
16
|
+
* @return {Promise | undefined}
|
|
17
|
+
*/
|
|
18
|
+
static loadCss(url: string, id?: string): Promise<unknown>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
|
|
10
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
11
|
+
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 常用的操作DOM的工具类
|
|
16
|
+
*/
|
|
17
|
+
var DomUtil = /*#__PURE__*/function () {
|
|
18
|
+
function DomUtil() {
|
|
19
|
+
_classCallCheck(this, DomUtil);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
_createClass(DomUtil, null, [{
|
|
23
|
+
key: "loadJavascript",
|
|
24
|
+
value:
|
|
25
|
+
/**
|
|
26
|
+
* 使用Promise异步的方式加载js文件
|
|
27
|
+
* @param {string} url 加载的路径
|
|
28
|
+
* @param {string} id script元素的id
|
|
29
|
+
* @return {Promise | undefined}
|
|
30
|
+
*/
|
|
31
|
+
function loadJavascript(url, id) {
|
|
32
|
+
if (!url) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (id && document.querySelector("#".concat(id))) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return new Promise(function (resolve) {
|
|
41
|
+
var scriptEl = document.createElement('script');
|
|
42
|
+
|
|
43
|
+
if (id) {
|
|
44
|
+
scriptEl.id = id;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
scriptEl.type = 'text/javascript';
|
|
48
|
+
scriptEl.src = url;
|
|
49
|
+
|
|
50
|
+
scriptEl.onload = function () {
|
|
51
|
+
resolve(null);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
document.body.appendChild(scriptEl);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 使用Promise异步的方式加载css文件
|
|
59
|
+
* @param {string} url 加载的css的url
|
|
60
|
+
* @param {string} id link元素的id
|
|
61
|
+
* @return {Promise | undefined}
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
}, {
|
|
65
|
+
key: "loadCss",
|
|
66
|
+
value: function loadCss(url, id) {
|
|
67
|
+
if (!url) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (id && document.querySelector("#".concat(id))) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return new Promise(function (resolve) {
|
|
76
|
+
var link = document.createElement('link');
|
|
77
|
+
link.rel = 'stylesheet';
|
|
78
|
+
|
|
79
|
+
if (id) {
|
|
80
|
+
link.id = id;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
link.href = url;
|
|
84
|
+
|
|
85
|
+
link.onload = function () {
|
|
86
|
+
resolve(null);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
document.head.appendChild(link);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}]);
|
|
93
|
+
|
|
94
|
+
return DomUtil;
|
|
95
|
+
}();
|
|
96
|
+
|
|
97
|
+
exports["default"] = DomUtil;
|
|
98
|
+
//# sourceMappingURL=dom-util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom-util.js","names":["DomUtil","url","id","document","querySelector","Promise","resolve","scriptEl","createElement","type","src","onload","body","appendChild","link","rel","href","head"],"sources":["utils/dom-util.js"],"sourcesContent":["/**\n * 常用的操作DOM的工具类\n */\nexport default class DomUtil {\n /**\n * 使用Promise异步的方式加载js文件\n * @param {string} url 加载的路径\n * @param {string} id script元素的id\n * @return {Promise | undefined}\n */\n static loadJavascript(url, id) {\n if (!url) {\n return;\n }\n if (id && document.querySelector(`#${id}`)) {\n return;\n }\n return new Promise((resolve) => {\n const scriptEl = document.createElement('script');\n if (id) {\n scriptEl.id = id;\n }\n scriptEl.type = 'text/javascript';\n scriptEl.src = url;\n scriptEl.onload = () => {\n resolve(null);\n };\n document.body.appendChild(scriptEl);\n });\n }\n /**\n * 使用Promise异步的方式加载css文件\n * @param {string} url 加载的css的url\n * @param {string} id link元素的id\n * @return {Promise | undefined}\n */\n static loadCss(url, id) {\n if (!url) {\n return;\n }\n if (id && document.querySelector(`#${id}`)) {\n return;\n }\n return new Promise((resolve) => {\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n if (id) {\n link.id = id;\n }\n link.href = url;\n link.onload = () => {\n resolve(null);\n };\n document.head.appendChild(link);\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;IACqBA,O;;;;;;;;IACjB;AACJ;AACA;AACA;AACA;AACA;IACI,wBAAsBC,GAAtB,EAA2BC,EAA3B,EAA+B;MAC3B,IAAI,CAACD,GAAL,EAAU;QACN;MACH;;MACD,IAAIC,EAAE,IAAIC,QAAQ,CAACC,aAAT,YAA2BF,EAA3B,EAAV,EAA4C;QACxC;MACH;;MACD,OAAO,IAAIG,OAAJ,CAAY,UAACC,OAAD,EAAa;QAC5B,IAAMC,QAAQ,GAAGJ,QAAQ,CAACK,aAAT,CAAuB,QAAvB,CAAjB;;QACA,IAAIN,EAAJ,EAAQ;UACJK,QAAQ,CAACL,EAAT,GAAcA,EAAd;QACH;;QACDK,QAAQ,CAACE,IAAT,GAAgB,iBAAhB;QACAF,QAAQ,CAACG,GAAT,GAAeT,GAAf;;QACAM,QAAQ,CAACI,MAAT,GAAkB,YAAM;UACpBL,OAAO,CAAC,IAAD,CAAP;QACH,CAFD;;QAGAH,QAAQ,CAACS,IAAT,CAAcC,WAAd,CAA0BN,QAA1B;MACH,CAXM,CAAP;IAYH;IACD;AACJ;AACA;AACA;AACA;AACA;;;;WACI,iBAAeN,GAAf,EAAoBC,EAApB,EAAwB;MACpB,IAAI,CAACD,GAAL,EAAU;QACN;MACH;;MACD,IAAIC,EAAE,IAAIC,QAAQ,CAACC,aAAT,YAA2BF,EAA3B,EAAV,EAA4C;QACxC;MACH;;MACD,OAAO,IAAIG,OAAJ,CAAY,UAACC,OAAD,EAAa;QAC5B,IAAMQ,IAAI,GAAGX,QAAQ,CAACK,aAAT,CAAuB,MAAvB,CAAb;QACAM,IAAI,CAACC,GAAL,GAAW,YAAX;;QACA,IAAIb,EAAJ,EAAQ;UACJY,IAAI,CAACZ,EAAL,GAAUA,EAAV;QACH;;QACDY,IAAI,CAACE,IAAL,GAAYf,GAAZ;;QACAa,IAAI,CAACH,MAAL,GAAc,YAAM;UAChBL,OAAO,CAAC,IAAD,CAAP;QACH,CAFD;;QAGAH,QAAQ,CAACc,IAAT,CAAcJ,WAAd,CAA0BC,IAA1B;MACH,CAXM,CAAP;IAYH"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface UploadFileRes {
|
|
2
|
+
result: 0 | 1;
|
|
3
|
+
msg: string;
|
|
4
|
+
exception: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* 接口请求的工具类
|
|
8
|
+
*/
|
|
9
|
+
export default class RequestUtil {
|
|
10
|
+
/**
|
|
11
|
+
* 导出文件专用
|
|
12
|
+
* @param {string} url
|
|
13
|
+
* @param {string} params
|
|
14
|
+
* @return {void}
|
|
15
|
+
*/
|
|
16
|
+
static exportFile(url: any, params: any): void;
|
|
17
|
+
/**
|
|
18
|
+
* 文件下载
|
|
19
|
+
* @param {string} url
|
|
20
|
+
*/
|
|
21
|
+
static downloadFile(url: any): void;
|
|
22
|
+
/**
|
|
23
|
+
* 文件下载
|
|
24
|
+
* @param {string} url
|
|
25
|
+
* @param {string} fileName
|
|
26
|
+
*/
|
|
27
|
+
static downloadFileName(url: any, fileName: any): void;
|
|
28
|
+
/**
|
|
29
|
+
* 文件上传
|
|
30
|
+
* @param {string} url
|
|
31
|
+
* @param {FormData} formData
|
|
32
|
+
* @return {Promise}
|
|
33
|
+
*/
|
|
34
|
+
static uploadFile(url: string, formData: FormData): Promise<UploadFileRes>;
|
|
35
|
+
/**
|
|
36
|
+
* 文件上传
|
|
37
|
+
* @param {string} url
|
|
38
|
+
* @param {object} requestData
|
|
39
|
+
* @return {Promise}
|
|
40
|
+
*/
|
|
41
|
+
static get(url: string, requestData: object): Promise<unknown>;
|
|
42
|
+
}
|