@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,323 @@
|
|
|
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 _select = _interopRequireDefault(require("antd/lib/select"));
|
|
13
|
+
|
|
14
|
+
var _useSimpleRes2 = _interopRequireDefault(require("../use-simple-res"));
|
|
15
|
+
|
|
16
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
27
|
+
|
|
28
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
29
|
+
|
|
30
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
31
|
+
|
|
32
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
33
|
+
|
|
34
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
35
|
+
|
|
36
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
37
|
+
|
|
38
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
39
|
+
|
|
40
|
+
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."); }
|
|
41
|
+
|
|
42
|
+
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); }
|
|
43
|
+
|
|
44
|
+
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; }
|
|
45
|
+
|
|
46
|
+
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; }
|
|
47
|
+
|
|
48
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
49
|
+
|
|
50
|
+
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
51
|
+
function adopt(value) {
|
|
52
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
53
|
+
resolve(value);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
58
|
+
function fulfilled(value) {
|
|
59
|
+
try {
|
|
60
|
+
step(generator.next(value));
|
|
61
|
+
} catch (e) {
|
|
62
|
+
reject(e);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function rejected(value) {
|
|
67
|
+
try {
|
|
68
|
+
step(generator["throw"](value));
|
|
69
|
+
} catch (e) {
|
|
70
|
+
reject(e);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function step(result) {
|
|
75
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
83
|
+
var t = {};
|
|
84
|
+
|
|
85
|
+
for (var p in s) {
|
|
86
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
90
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
91
|
+
}
|
|
92
|
+
return t;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
var Option = _select["default"].Option;
|
|
96
|
+
|
|
97
|
+
var _default = function _default(props) {
|
|
98
|
+
var _useState = (0, _react.useState)([]),
|
|
99
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
100
|
+
dataList = _useState2[0],
|
|
101
|
+
setDataList = _useState2[1]; // 存储下拉数值
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
var _useState3 = (0, _react.useState)(1),
|
|
105
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
106
|
+
page = _useState4[0],
|
|
107
|
+
setPage = _useState4[1]; // 记录滚动时需要查询的页数
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
var _useState5 = (0, _react.useState)(0),
|
|
111
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
112
|
+
total = _useState6[0],
|
|
113
|
+
setTotal = _useState6[1]; // 返回接口返回的total值
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
var _useState7 = (0, _react.useState)(false),
|
|
117
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
118
|
+
isLoadData = _useState8[0],
|
|
119
|
+
setIsLoadData = _useState8[1];
|
|
120
|
+
|
|
121
|
+
var requestOption = props.requestOption,
|
|
122
|
+
_props$requestParams = props.requestParams,
|
|
123
|
+
requestParams = _props$requestParams === void 0 ? {} : _props$requestParams,
|
|
124
|
+
_onChange = props.onChange,
|
|
125
|
+
searchField = props.searchField,
|
|
126
|
+
_props$setValueLabel = props.setValueLabel,
|
|
127
|
+
setValueLabel = _props$setValueLabel === void 0 ? {
|
|
128
|
+
label: 'name',
|
|
129
|
+
value: 'id'
|
|
130
|
+
} : _props$setValueLabel,
|
|
131
|
+
rest = __rest(props, ["requestOption", "requestParams", "onChange", "searchField", "setValueLabel"]);
|
|
132
|
+
|
|
133
|
+
var _useSimpleRes = (0, _useSimpleRes2["default"])(requestOption),
|
|
134
|
+
run = _useSimpleRes.run,
|
|
135
|
+
loading = _useSimpleRes.loading;
|
|
136
|
+
/**
|
|
137
|
+
* @param {boolean} isClear 是否清空之前的值
|
|
138
|
+
* @param {number} page 分页
|
|
139
|
+
* @param {string} searchString 搜索的值
|
|
140
|
+
*/
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
var loadData = function loadData() {
|
|
144
|
+
var isClear = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
145
|
+
var page = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
146
|
+
var searchString = arguments.length > 2 ? arguments[2] : undefined;
|
|
147
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
148
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, res, newData, label, value, oldDataList, newArray, _iterator, _step, item;
|
|
149
|
+
|
|
150
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
151
|
+
while (1) {
|
|
152
|
+
switch (_context.prev = _context.next) {
|
|
153
|
+
case 0:
|
|
154
|
+
_context.next = 2;
|
|
155
|
+
return run(Object.assign(Object.assign({
|
|
156
|
+
rows: 10
|
|
157
|
+
}, requestParams), _defineProperty({
|
|
158
|
+
page: page
|
|
159
|
+
}, searchField, searchString ? searchString : undefined)));
|
|
160
|
+
|
|
161
|
+
case 2:
|
|
162
|
+
res = _context.sent;
|
|
163
|
+
newData = [];
|
|
164
|
+
|
|
165
|
+
if (Array.isArray((_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.rows)) {
|
|
166
|
+
newData = (_d = (_c = res === null || res === void 0 ? void 0 : res.data) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.rows;
|
|
167
|
+
} else if (Array.isArray((_e = res === null || res === void 0 ? void 0 : res.data) === null || _e === void 0 ? void 0 : _e.rows)) {
|
|
168
|
+
newData = (_f = res === null || res === void 0 ? void 0 : res.data) === null || _f === void 0 ? void 0 : _f.rows;
|
|
169
|
+
} else if (Array.isArray((_g = res === null || res === void 0 ? void 0 : res.data) === null || _g === void 0 ? void 0 : _g.data)) {
|
|
170
|
+
newData = (_h = res === null || res === void 0 ? void 0 : res.data) === null || _h === void 0 ? void 0 : _h.data;
|
|
171
|
+
} else if (Array.isArray(res === null || res === void 0 ? void 0 : res.data)) {
|
|
172
|
+
newData = res === null || res === void 0 ? void 0 : res.data;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
_context.next = 7;
|
|
176
|
+
return setTotal(newData.length);
|
|
177
|
+
|
|
178
|
+
case 7:
|
|
179
|
+
label = setValueLabel.label;
|
|
180
|
+
value = setValueLabel.value;
|
|
181
|
+
oldDataList = _toConsumableArray(dataList);
|
|
182
|
+
newArray = [];
|
|
183
|
+
|
|
184
|
+
if (Array.isArray(newData) && newData.length) {
|
|
185
|
+
_iterator = _createForOfIteratorHelper(newData);
|
|
186
|
+
|
|
187
|
+
try {
|
|
188
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
189
|
+
item = _step.value;
|
|
190
|
+
newArray.push(Object.assign(Object.assign({}, item), {
|
|
191
|
+
selectName: item[label],
|
|
192
|
+
selectId: item[value]
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
} catch (err) {
|
|
196
|
+
_iterator.e(err);
|
|
197
|
+
} finally {
|
|
198
|
+
_iterator.f();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (isClear) {
|
|
203
|
+
setDataList([].concat(newArray));
|
|
204
|
+
} else {
|
|
205
|
+
setDataList([].concat(_toConsumableArray(oldDataList), newArray));
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
setIsLoadData(true);
|
|
209
|
+
|
|
210
|
+
case 14:
|
|
211
|
+
case "end":
|
|
212
|
+
return _context.stop();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}, _callee);
|
|
216
|
+
}));
|
|
217
|
+
}; // 参数改变的时候 组件 恢复未加载数据状态
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
(0, _react.useEffect)(function () {
|
|
221
|
+
setIsLoadData(false);
|
|
222
|
+
}, [props]);
|
|
223
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
224
|
+
className: 'env-scroll-select'
|
|
225
|
+
}, /*#__PURE__*/_react["default"].createElement(_select["default"], Object.assign({
|
|
226
|
+
onChange: function onChange(value, option) {
|
|
227
|
+
_onChange && _onChange(value, option);
|
|
228
|
+
},
|
|
229
|
+
style: {
|
|
230
|
+
width: "100%"
|
|
231
|
+
},
|
|
232
|
+
showSearch: true,
|
|
233
|
+
showArrow: true,
|
|
234
|
+
labelInValue: true,
|
|
235
|
+
loading: loading,
|
|
236
|
+
optionFilterProp: "children",
|
|
237
|
+
onDropdownVisibleChange: function onDropdownVisibleChange(open) {
|
|
238
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
239
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
240
|
+
while (1) {
|
|
241
|
+
switch (_context2.prev = _context2.next) {
|
|
242
|
+
case 0:
|
|
243
|
+
if (!(open && !isLoadData)) {
|
|
244
|
+
_context2.next = 4;
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
_context2.next = 3;
|
|
249
|
+
return setPage(1);
|
|
250
|
+
|
|
251
|
+
case 3:
|
|
252
|
+
loadData(true, 1);
|
|
253
|
+
|
|
254
|
+
case 4:
|
|
255
|
+
case "end":
|
|
256
|
+
return _context2.stop();
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}, _callee2);
|
|
260
|
+
}));
|
|
261
|
+
},
|
|
262
|
+
onSearch: _lodash["default"].debounce(function (name) {
|
|
263
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
264
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
265
|
+
while (1) {
|
|
266
|
+
switch (_context3.prev = _context3.next) {
|
|
267
|
+
case 0:
|
|
268
|
+
_context3.next = 2;
|
|
269
|
+
return setPage(1);
|
|
270
|
+
|
|
271
|
+
case 2:
|
|
272
|
+
loadData(true, 1, name);
|
|
273
|
+
|
|
274
|
+
case 3:
|
|
275
|
+
case "end":
|
|
276
|
+
return _context3.stop();
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}, _callee3);
|
|
280
|
+
}));
|
|
281
|
+
}, 500),
|
|
282
|
+
onPopupScroll: function onPopupScroll(e) {
|
|
283
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
284
|
+
var target, nextScrollPage;
|
|
285
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
286
|
+
while (1) {
|
|
287
|
+
switch (_context4.prev = _context4.next) {
|
|
288
|
+
case 0:
|
|
289
|
+
e.persist();
|
|
290
|
+
target = e.target;
|
|
291
|
+
|
|
292
|
+
if (!( // target.scrollTop + target.offsetHeight >= target.scrollHeight-6 &&
|
|
293
|
+
target.scrollTop + target.offsetHeight === target.scrollHeight && total > 0)) {
|
|
294
|
+
_context4.next = 7;
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
nextScrollPage = page + 1;
|
|
299
|
+
_context4.next = 6;
|
|
300
|
+
return setPage(nextScrollPage);
|
|
301
|
+
|
|
302
|
+
case 6:
|
|
303
|
+
loadData(false, nextScrollPage);
|
|
304
|
+
|
|
305
|
+
case 7:
|
|
306
|
+
case "end":
|
|
307
|
+
return _context4.stop();
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}, _callee4);
|
|
311
|
+
}));
|
|
312
|
+
}
|
|
313
|
+
}, rest), dataList.map(function (item) {
|
|
314
|
+
return /*#__PURE__*/_react["default"].createElement(Option, {
|
|
315
|
+
value: item.selectId,
|
|
316
|
+
key: item.selectId,
|
|
317
|
+
"data-item": item
|
|
318
|
+
}, item.selectName);
|
|
319
|
+
})));
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
exports["default"] = _default;
|
|
323
|
+
//# sourceMappingURL=scrollSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scrollSelect.js","names":["__awaiter","thisArg","_arguments","P","generator","adopt","value","resolve","Promise","reject","fulfilled","step","next","e","rejected","result","done","then","apply","__rest","s","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","Option","Select","props","useState","dataList","setDataList","page","setPage","total","setTotal","isLoadData","setIsLoadData","requestOption","requestParams","onChange","searchField","setValueLabel","label","rest","useSimpleRes","run","loading","loadData","isClear","searchString","assign","rows","undefined","res","newData","Array","isArray","_b","_a","data","_d","_c","_e","_f","_g","_h","oldDataList","newArray","item","push","selectName","selectId","useEffect","React","createElement","className","option","style","width","showSearch","showArrow","labelInValue","optionFilterProp","onDropdownVisibleChange","open","onSearch","_","debounce","name","onPopupScroll","persist","target","scrollTop","offsetHeight","scrollHeight","nextScrollPage","map","key"],"sources":["scroll-select/scrollSelect.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};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport React, { useState, useEffect } from 'react';\nimport Select from 'antd/lib/select';\nimport useSimpleRes from '../use-simple-res';\nimport _ from 'lodash';\nconst { Option } = Select;\nexport default (props) => {\n const [dataList, setDataList] = useState([]); // 存储下拉数值\n const [page, setPage] = useState(1); // 记录滚动时需要查询的页数\n const [total, setTotal] = useState(0); // 返回接口返回的total值\n const [isLoadData, setIsLoadData] = useState(false);\n const { requestOption, requestParams = {}, onChange, searchField, // 查询的字段\n setValueLabel = {\n label: 'name',\n value: 'id',\n } } = props, rest = __rest(props, [\"requestOption\", \"requestParams\", \"onChange\", \"searchField\", \"setValueLabel\"]);\n const { run, loading } = useSimpleRes(requestOption);\n /**\n * @param {boolean} isClear 是否清空之前的值\n * @param {number} page 分页\n * @param {string} searchString 搜索的值\n */\n const loadData = (isClear = true, page = 1, searchString) => __awaiter(void 0, void 0, void 0, function* () {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n const res = yield run(Object.assign(Object.assign({ rows: 10 }, requestParams), { page: page, [searchField]: searchString ? searchString : undefined }));\n let newData = [];\n if (Array.isArray((_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.rows)) {\n newData = (_d = (_c = res === null || res === void 0 ? void 0 : res.data) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.rows;\n }\n else if (Array.isArray((_e = res === null || res === void 0 ? void 0 : res.data) === null || _e === void 0 ? void 0 : _e.rows)) {\n newData = (_f = res === null || res === void 0 ? void 0 : res.data) === null || _f === void 0 ? void 0 : _f.rows;\n }\n else if (Array.isArray((_g = res === null || res === void 0 ? void 0 : res.data) === null || _g === void 0 ? void 0 : _g.data)) {\n newData = (_h = res === null || res === void 0 ? void 0 : res.data) === null || _h === void 0 ? void 0 : _h.data;\n }\n else if (Array.isArray(res === null || res === void 0 ? void 0 : res.data)) {\n newData = res === null || res === void 0 ? void 0 : res.data;\n }\n yield setTotal(newData.length);\n const label = setValueLabel.label;\n const value = setValueLabel.value;\n const oldDataList = [...dataList];\n const newArray = [];\n if (Array.isArray(newData) && newData.length) {\n for (const item of newData) {\n newArray.push(Object.assign(Object.assign({}, item), { selectName: item[label], selectId: item[value] }));\n }\n }\n if (isClear) {\n setDataList([...newArray]);\n }\n else {\n setDataList([...oldDataList, ...newArray]);\n }\n setIsLoadData(true);\n });\n // 参数改变的时候 组件 恢复未加载数据状态\n useEffect(() => {\n setIsLoadData(false);\n }, [props]);\n return (React.createElement(\"div\", { className: 'env-scroll-select' },\n React.createElement(Select, Object.assign({ onChange: (value, option) => {\n onChange && onChange(value, option);\n }, style: { width: `100%` }, showSearch: true, showArrow: true, labelInValue: true, loading: loading, optionFilterProp: \"children\", onDropdownVisibleChange: (open) => __awaiter(void 0, void 0, void 0, function* () {\n if (open && !isLoadData) {\n yield setPage(1);\n loadData(true, 1);\n }\n }), onSearch: _.debounce((name) => __awaiter(void 0, void 0, void 0, function* () {\n yield setPage(1);\n loadData(true, 1, name);\n }), 500), onPopupScroll: (e) => __awaiter(void 0, void 0, void 0, function* () {\n e.persist();\n const { target } = e;\n if (\n // target.scrollTop + target.offsetHeight >= target.scrollHeight-6 &&\n target.scrollTop + target.offsetHeight\n === target.scrollHeight\n && total > 0) {\n const nextScrollPage = page + 1;\n yield setPage(nextScrollPage);\n loadData(false, nextScrollPage);\n }\n }) }, rest), dataList.map((item) => {\n return (React.createElement(Option, { value: item.selectId, key: item.selectId, \"data-item\": item }, item.selectName));\n }))));\n};\n"],"mappings":";;;;;;;;;AAoBA;;AACA;;AACA;;AACA;;;;;;;;+CAtBA,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,CAA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,CAAzB,EAAnB;IAAA,CAAX,EAGV,GAHU,CAPwB;IAU5BC,aAAa,EAAE,uBAACnF,CAAD;MAAA,OAAOb,SAAS,CAAC,KAAK,CAAN,EAAS,KAAK,CAAd,EAAiB,KAAK,CAAtB,0CAAyB;QAAA;QAAA;UAAA;YAAA;cAAA;gBAC9Da,CAAC,CAACoF,OAAF;gBACQC,MAFsD,GAE3CrF,CAF2C,CAEtDqF,MAFsD;;gBAAA,OAI9D;gBACAA,MAAM,CAACC,SAAP,GAAmBD,MAAM,CAACE,YAA1B,KACQF,MAAM,CAACG,YADf,IAEO7D,KAAK,GAAG,CAP+C;kBAAA;kBAAA;gBAAA;;gBAQpD8D,cARoD,GAQnChE,IAAI,GAAG,CAR4B;gBAAA;gBAS1D,OAAMC,OAAO,CAAC+D,cAAD,CAAb;;cAT0D;gBAU1DhD,QAAQ,CAAC,KAAD,EAAQgD,cAAR,CAAR;;cAV0D;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,CAAzB,EAAhB;IAAA;EAVa,CAAd,EAsBlBpD,IAtBkB,CAA5B,EAsBiBd,QAAQ,CAACmE,GAAT,CAAa,UAAC5B,IAAD,EAAU;IACpC,oBAAQK,iBAAA,CAAMC,aAAN,CAAoBjD,MAApB,EAA4B;MAAE1B,KAAK,EAAEqE,IAAI,CAACG,QAAd;MAAwB0B,GAAG,EAAE7B,IAAI,CAACG,QAAlC;MAA4C,aAAaH;IAAzD,CAA5B,EAA6FA,IAAI,CAACE,UAAlG,CAAR;EACH,CAFgB,CAtBjB,CADI,CAAR;AA0BH,C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css.js","names":[],"sources":["scroll-select/style/index.js"],"sourcesContent":["import 'antd/lib/select/style';\nimport './index.less';\n"],"mappings":";;AAAA;;AACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["scroll-select/style/index.js"],"sourcesContent":["import 'antd/lib/select/style';\nimport './index.less';\n"],"mappings":";;AAAA;;AACA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _table = _interopRequireDefault(require("./table"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _table["default"];
|
|
13
|
+
exports["default"] = _default;
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["Table"],"sources":["table/index.js"],"sourcesContent":["import Table from './table';\nexport default Table;\n"],"mappings":";;;;;;;AAAA;;;;eACeA,iB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css.js","names":[],"sources":["table/style/index.js"],"sourcesContent":["import 'antd/lib/table/style';\nimport './index.less';\n"],"mappings":";;AAAA;;AACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["table/style/index.js"],"sourcesContent":["import 'antd/lib/table/style';\nimport './index.less';\n"],"mappings":";;AAAA;;AACA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TableProps as AntTableProps } from 'antd/lib/table';
|
|
3
|
+
export interface TableProps<T extends object = any> extends AntTableProps<T> {
|
|
4
|
+
wrapClassName?: string;
|
|
5
|
+
autoScroll?: boolean;
|
|
6
|
+
onReachBottom?: (e: Event) => any;
|
|
7
|
+
/**
|
|
8
|
+
* 表格的间距, 自动滚动的时候, 若设置了这个属性, 会导致卡顿一下
|
|
9
|
+
* 所以需要设置
|
|
10
|
+
*/
|
|
11
|
+
rowSpacing?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface TableControl {
|
|
14
|
+
scrollToTop: () => any;
|
|
15
|
+
}
|
|
16
|
+
declare const _default: React.ForwardRefExoticComponent<TableProps<any> & React.RefAttributes<TableControl>>;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,162 @@
|
|
|
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 _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
var _table = _interopRequireDefault(require("antd/lib/table"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
23
|
+
var t = {};
|
|
24
|
+
|
|
25
|
+
for (var p in s) {
|
|
26
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
30
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
31
|
+
}
|
|
32
|
+
return t;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var Table = function Table(props, ref) {
|
|
36
|
+
var timer = null;
|
|
37
|
+
var wrapRef = React.useRef(null);
|
|
38
|
+
|
|
39
|
+
var scrollToTop = function scrollToTop() {
|
|
40
|
+
var current = wrapRef.current;
|
|
41
|
+
var wrapper = current === null || current === void 0 ? void 0 : current.querySelector('.ant-table-body');
|
|
42
|
+
|
|
43
|
+
if (!wrapper) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
wrapper.scrollTop = 0;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
(0, React.useImperativeHandle)(ref, function () {
|
|
51
|
+
return {
|
|
52
|
+
scrollToTop: scrollToTop
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
var clearTimer = function clearTimer() {
|
|
57
|
+
if (timer) {
|
|
58
|
+
clearInterval(timer);
|
|
59
|
+
timer = null;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
var wrapClassName = props.wrapClassName,
|
|
64
|
+
dataSource = props.dataSource,
|
|
65
|
+
className = props.className,
|
|
66
|
+
onReachBottom = props.onReachBottom,
|
|
67
|
+
autoScroll = props.autoScroll,
|
|
68
|
+
rowSpacing = props.rowSpacing,
|
|
69
|
+
rest = __rest(props, ["wrapClassName", "dataSource", "className", "onReachBottom", "autoScroll", "rowSpacing"]);
|
|
70
|
+
|
|
71
|
+
React.useEffect(function () {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
|
|
74
|
+
if (!props.autoScroll) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
var current = wrapRef.current;
|
|
79
|
+
var wrapper = current === null || current === void 0 ? void 0 : current.querySelector('.ant-table-body');
|
|
80
|
+
var table = wrapper === null || wrapper === void 0 ? void 0 : wrapper.querySelector('table');
|
|
81
|
+
var tbody = table === null || table === void 0 ? void 0 : table.querySelector('tbody');
|
|
82
|
+
|
|
83
|
+
if (!tbody || !table || !wrapper) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (!((_a = props.scroll) === null || _a === void 0 ? void 0 : _a.y) || tbody.scrollHeight <= ((_b = props.scroll) === null || _b === void 0 ? void 0 : _b.y)) {
|
|
88
|
+
return;
|
|
89
|
+
} // 创建一个tbody的拷贝, 为了滑动时的流畅性
|
|
90
|
+
// 去除上一次创建的拷贝
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
var copyEl = table === null || table === void 0 ? void 0 : table.querySelector('.ant-table-tbody.copy');
|
|
94
|
+
copyEl === null || copyEl === void 0 ? void 0 : copyEl.remove(); // 创建新的dom
|
|
95
|
+
// TODO: 操作了dom, 感觉性能不是很好可以优化
|
|
96
|
+
|
|
97
|
+
var tbodyEl = document.createElement('tbody');
|
|
98
|
+
tbodyEl.classList.add('ant-table-tbody');
|
|
99
|
+
tbodyEl.classList.add('copy');
|
|
100
|
+
tbodyEl.innerHTML = tbody.innerHTML;
|
|
101
|
+
table === null || table === void 0 ? void 0 : table.appendChild(tbodyEl); // 设置滚动定时器
|
|
102
|
+
|
|
103
|
+
clearTimer();
|
|
104
|
+
timer = setInterval(function () {
|
|
105
|
+
if (wrapper.scrollTop >= tbody.scrollHeight) {
|
|
106
|
+
wrapper.scrollTop = 0;
|
|
107
|
+
} else {
|
|
108
|
+
wrapper.scrollTop++;
|
|
109
|
+
}
|
|
110
|
+
}, 20);
|
|
111
|
+
return function () {
|
|
112
|
+
clearTimer();
|
|
113
|
+
};
|
|
114
|
+
}, [dataSource]);
|
|
115
|
+
var scrollEventCallback = React.useCallback(function (e) {
|
|
116
|
+
var current = wrapRef.current;
|
|
117
|
+
var wrapper = current === null || current === void 0 ? void 0 : current.querySelector('.ant-table-body');
|
|
118
|
+
var table = wrapper === null || wrapper === void 0 ? void 0 : wrapper.querySelector('table');
|
|
119
|
+
var tbody = table === null || table === void 0 ? void 0 : table.querySelector('tbody');
|
|
120
|
+
|
|
121
|
+
if (!tbody || !table || !wrapper) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (wrapper.scrollTop === 0) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (wrapper.scrollTop + wrapper.clientHeight === tbody.scrollHeight) {
|
|
130
|
+
onReachBottom && onReachBottom(e);
|
|
131
|
+
}
|
|
132
|
+
}, []);
|
|
133
|
+
React.useEffect(function () {
|
|
134
|
+
// 当自动滚动的时候或者没有设置该事件, 不触发`onReachBottom`事件
|
|
135
|
+
if (!onReachBottom || autoScroll) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
var current = wrapRef.current;
|
|
140
|
+
var wrapper = current === null || current === void 0 ? void 0 : current.querySelector('.ant-table-body'); // 添加滚动监听事件
|
|
141
|
+
|
|
142
|
+
wrapper.addEventListener('scroll', scrollEventCallback);
|
|
143
|
+
return function () {
|
|
144
|
+
wrapper.removeEventListener('scroll', scrollEventCallback);
|
|
145
|
+
};
|
|
146
|
+
}, [dataSource]);
|
|
147
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
148
|
+
className: wrapClassName,
|
|
149
|
+
ref: wrapRef
|
|
150
|
+
}, /*#__PURE__*/React.createElement(_table["default"], Object.assign({
|
|
151
|
+
className: (0, _classnames["default"])('env-table', className, {
|
|
152
|
+
'env-table__spacing': rowSpacing
|
|
153
|
+
}),
|
|
154
|
+
pagination: false,
|
|
155
|
+
dataSource: dataSource
|
|
156
|
+
}, rest)));
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
var _default = /*#__PURE__*/(0, React.forwardRef)(Table);
|
|
160
|
+
|
|
161
|
+
exports["default"] = _default;
|
|
162
|
+
//# sourceMappingURL=table.js.map
|