backend-management-ui 1.3.2 → 1.3.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.
@@ -200,6 +200,26 @@ module.exports = function (it, Prototype) {
200
200
  };
201
201
 
202
202
 
203
+ /***/ }),
204
+
205
+ /***/ 684:
206
+ /***/ (function(module) {
207
+
208
+ "use strict";
209
+
210
+ // Should throw an error on invalid iterator
211
+ // https://issues.chromium.org/issues/336839115
212
+ module.exports = function (methodName, argument) {
213
+ // eslint-disable-next-line es/no-iterator -- required for testing
214
+ var method = typeof Iterator == 'function' && Iterator.prototype[methodName];
215
+ if (method) try {
216
+ method.call({ next: null }, argument).next();
217
+ } catch (error) {
218
+ return true;
219
+ }
220
+ };
221
+
222
+
203
223
  /***/ }),
204
224
 
205
225
  /***/ 741:
@@ -418,6 +438,30 @@ module.exports = function (argument) {
418
438
  };
419
439
 
420
440
 
441
+ /***/ }),
442
+
443
+ /***/ 1385:
444
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
445
+
446
+ "use strict";
447
+
448
+ var iteratorClose = __webpack_require__(9539);
449
+
450
+ module.exports = function (iters, kind, value) {
451
+ for (var i = iters.length - 1; i >= 0; i--) {
452
+ if (iters[i] === undefined) continue;
453
+ try {
454
+ value = iteratorClose(iters[i].iterator, kind, value);
455
+ } catch (error) {
456
+ kind = 'throw';
457
+ value = error;
458
+ }
459
+ }
460
+ if (kind === 'throw') throw value;
461
+ return value;
462
+ };
463
+
464
+
421
465
  /***/ }),
422
466
 
423
467
  /***/ 1548:
@@ -475,6 +519,58 @@ $({ target: 'Set', proto: true, real: true, forced: FORCED }, {
475
519
  });
476
520
 
477
521
 
522
+ /***/ }),
523
+
524
+ /***/ 1701:
525
+ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
526
+
527
+ "use strict";
528
+
529
+ var $ = __webpack_require__(6518);
530
+ var call = __webpack_require__(9565);
531
+ var aCallable = __webpack_require__(9306);
532
+ var anObject = __webpack_require__(8551);
533
+ var getIteratorDirect = __webpack_require__(1767);
534
+ var createIteratorProxy = __webpack_require__(9462);
535
+ var callWithSafeIterationClosing = __webpack_require__(6319);
536
+ var iteratorClose = __webpack_require__(9539);
537
+ var iteratorHelperThrowsOnInvalidIterator = __webpack_require__(684);
538
+ var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549);
539
+ var IS_PURE = __webpack_require__(6395);
540
+
541
+ var MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR = !IS_PURE && !iteratorHelperThrowsOnInvalidIterator('map', function () { /* empty */ });
542
+ var mapWithoutClosingOnEarlyError = !IS_PURE && !MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR
543
+ && iteratorHelperWithoutClosingOnEarlyError('map', TypeError);
544
+
545
+ var FORCED = IS_PURE || MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR || mapWithoutClosingOnEarlyError;
546
+
547
+ var IteratorProxy = createIteratorProxy(function () {
548
+ var iterator = this.iterator;
549
+ var result = anObject(call(this.next, iterator));
550
+ var done = this.done = !!result.done;
551
+ if (!done) return callWithSafeIterationClosing(iterator, this.mapper, [result.value, this.counter++], true);
552
+ });
553
+
554
+ // `Iterator.prototype.map` method
555
+ // https://tc39.es/ecma262/#sec-iterator.prototype.map
556
+ $({ target: 'Iterator', proto: true, real: true, forced: FORCED }, {
557
+ map: function map(mapper) {
558
+ anObject(this);
559
+ try {
560
+ aCallable(mapper);
561
+ } catch (error) {
562
+ iteratorClose(this, 'throw', error);
563
+ }
564
+
565
+ if (mapWithoutClosingOnEarlyError) return call(mapWithoutClosingOnEarlyError, this, mapper);
566
+
567
+ return new IteratorProxy(getIteratorDirect(this), {
568
+ mapper: mapper
569
+ });
570
+ }
571
+ });
572
+
573
+
478
574
  /***/ }),
479
575
 
480
576
  /***/ 1767:
@@ -493,6 +589,29 @@ module.exports = function (obj) {
493
589
  };
494
590
 
495
591
 
592
+ /***/ }),
593
+
594
+ /***/ 1810:
595
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
596
+
597
+ "use strict";
598
+
599
+ var globalThis = __webpack_require__(4576);
600
+ var IS_NODE = __webpack_require__(6193);
601
+
602
+ module.exports = function (name) {
603
+ if (IS_NODE) {
604
+ try {
605
+ return globalThis.process.getBuiltinModule(name);
606
+ } catch (error) { /* empty */ }
607
+ try {
608
+ // eslint-disable-next-line no-new-func -- safe
609
+ return Function('return require("' + name + '")')();
610
+ } catch (error) { /* empty */ }
611
+ }
612
+ };
613
+
614
+
496
615
  /***/ }),
497
616
 
498
617
  /***/ 1828:
@@ -705,6 +824,79 @@ $({ target: 'Set', proto: true, real: true, forced: INCORRECT }, {
705
824
  });
706
825
 
707
826
 
827
+ /***/ }),
828
+
829
+ /***/ 2489:
830
+ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
831
+
832
+ "use strict";
833
+
834
+ var $ = __webpack_require__(6518);
835
+ var call = __webpack_require__(9565);
836
+ var aCallable = __webpack_require__(9306);
837
+ var anObject = __webpack_require__(8551);
838
+ var getIteratorDirect = __webpack_require__(1767);
839
+ var createIteratorProxy = __webpack_require__(9462);
840
+ var callWithSafeIterationClosing = __webpack_require__(6319);
841
+ var IS_PURE = __webpack_require__(6395);
842
+ var iteratorClose = __webpack_require__(9539);
843
+ var iteratorHelperThrowsOnInvalidIterator = __webpack_require__(684);
844
+ var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549);
845
+
846
+ var FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR = !IS_PURE && !iteratorHelperThrowsOnInvalidIterator('filter', function () { /* empty */ });
847
+ var filterWithoutClosingOnEarlyError = !IS_PURE && !FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR
848
+ && iteratorHelperWithoutClosingOnEarlyError('filter', TypeError);
849
+
850
+ var FORCED = IS_PURE || FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR || filterWithoutClosingOnEarlyError;
851
+
852
+ var IteratorProxy = createIteratorProxy(function () {
853
+ var iterator = this.iterator;
854
+ var predicate = this.predicate;
855
+ var next = this.next;
856
+ var result, done, value;
857
+ while (true) {
858
+ result = anObject(call(next, iterator));
859
+ done = this.done = !!result.done;
860
+ if (done) return;
861
+ value = result.value;
862
+ if (callWithSafeIterationClosing(iterator, predicate, [value, this.counter++], true)) return value;
863
+ }
864
+ });
865
+
866
+ // `Iterator.prototype.filter` method
867
+ // https://tc39.es/ecma262/#sec-iterator.prototype.filter
868
+ $({ target: 'Iterator', proto: true, real: true, forced: FORCED }, {
869
+ filter: function filter(predicate) {
870
+ anObject(this);
871
+ try {
872
+ aCallable(predicate);
873
+ } catch (error) {
874
+ iteratorClose(this, 'throw', error);
875
+ }
876
+
877
+ if (filterWithoutClosingOnEarlyError) return call(filterWithoutClosingOnEarlyError, this, predicate);
878
+
879
+ return new IteratorProxy(getIteratorDirect(this), {
880
+ predicate: predicate
881
+ });
882
+ }
883
+ });
884
+
885
+
886
+ /***/ }),
887
+
888
+ /***/ 2529:
889
+ /***/ (function(module) {
890
+
891
+ "use strict";
892
+
893
+ // `CreateIterResultObject` abstract operation
894
+ // https://tc39.es/ecma262/#sec-createiterresultobject
895
+ module.exports = function (value, done) {
896
+ return { value: value, done: done };
897
+ };
898
+
899
+
708
900
  /***/ }),
709
901
 
710
902
  /***/ 2652:
@@ -1203,6 +1395,14 @@ module.exports = function (it) {
1203
1395
  };
1204
1396
 
1205
1397
 
1398
+ /***/ }),
1399
+
1400
+ /***/ 4100:
1401
+ /***/ (function(module) {
1402
+
1403
+ "use strict";
1404
+ module.exports = require("vue");
1405
+
1206
1406
  /***/ }),
1207
1407
 
1208
1408
  /***/ 4114:
@@ -1442,7 +1642,7 @@ module.exports = function isDisjointFrom(other) {
1442
1642
  "use strict";
1443
1643
 
1444
1644
  var globalThis = __webpack_require__(4576);
1445
- var getBuiltInNodeModule = __webpack_require__(9429);
1645
+ var getBuiltInNodeModule = __webpack_require__(1810);
1446
1646
  var PROPER_STRUCTURED_CLONE_TRANSFER = __webpack_require__(1548);
1447
1647
 
1448
1648
  var structuredClone = globalThis.structuredClone;
@@ -2068,6 +2268,41 @@ module.exports = function (obj) {
2068
2268
  module.exports = {};
2069
2269
 
2070
2270
 
2271
+ /***/ }),
2272
+
2273
+ /***/ 6279:
2274
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
2275
+
2276
+ "use strict";
2277
+
2278
+ var defineBuiltIn = __webpack_require__(6840);
2279
+
2280
+ module.exports = function (target, src, options) {
2281
+ for (var key in src) defineBuiltIn(target, key, src[key], options);
2282
+ return target;
2283
+ };
2284
+
2285
+
2286
+ /***/ }),
2287
+
2288
+ /***/ 6319:
2289
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
2290
+
2291
+ "use strict";
2292
+
2293
+ var anObject = __webpack_require__(8551);
2294
+ var iteratorClose = __webpack_require__(9539);
2295
+
2296
+ // call something on iterator step with safe closing on error
2297
+ module.exports = function (iterator, fn, value, ENTRIES) {
2298
+ try {
2299
+ return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
2300
+ } catch (error) {
2301
+ iteratorClose(iterator, 'throw', error);
2302
+ }
2303
+ };
2304
+
2305
+
2071
2306
  /***/ }),
2072
2307
 
2073
2308
  /***/ 6395:
@@ -3664,63 +3899,1102 @@ module.exports = function (argument) {
3664
3899
 
3665
3900
  /***/ }),
3666
3901
 
3667
- /***/ 8100:
3668
- /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
3902
+ /***/ 8054:
3903
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
3669
3904
 
3670
- "use strict";
3905
+ __webpack_require__(4114);
3906
+ __webpack_require__(8111);
3907
+ __webpack_require__(2489);
3908
+ __webpack_require__(7588);
3909
+ __webpack_require__(1701);
3910
+ __webpack_require__(8237);
3911
+ /*!
3912
+ * vue-virtual-scroll-list v2.3.4
3913
+ * open source under the MIT license
3914
+ * https://github.com/tangbc/vue-virtual-scroll-list#readme
3915
+ */
3671
3916
 
3672
- var $ = __webpack_require__(6518);
3673
- var $transfer = __webpack_require__(5636);
3917
+ (function (global, factory) {
3918
+ true ? module.exports = factory(__webpack_require__(4100)) : 0;
3919
+ })(this, function (Vue) {
3920
+ 'use strict';
3674
3921
 
3675
- // `ArrayBuffer.prototype.transfer` method
3676
- // https://tc39.es/ecma262/#sec-arraybuffer.prototype.transfer
3677
- if ($transfer) $({ target: 'ArrayBuffer', proto: true }, {
3678
- transfer: function transfer() {
3679
- return $transfer(this, arguments.length ? arguments[0] : undefined, true);
3922
+ Vue = Vue && Object.prototype.hasOwnProperty.call(Vue, 'default') ? Vue['default'] : Vue;
3923
+ function ownKeys(object, enumerableOnly) {
3924
+ var keys = Object.keys(object);
3925
+ if (Object.getOwnPropertySymbols) {
3926
+ var symbols = Object.getOwnPropertySymbols(object);
3927
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
3928
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3929
+ })), keys.push.apply(keys, symbols);
3930
+ }
3931
+ return keys;
3932
+ }
3933
+ function _objectSpread2(target) {
3934
+ for (var i = 1; i < arguments.length; i++) {
3935
+ var source = null != arguments[i] ? arguments[i] : {};
3936
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
3937
+ _defineProperty(target, key, source[key]);
3938
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
3939
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3940
+ });
3941
+ }
3942
+ return target;
3943
+ }
3944
+ function _classCallCheck(instance, Constructor) {
3945
+ if (!(instance instanceof Constructor)) {
3946
+ throw new TypeError("Cannot call a class as a function");
3947
+ }
3948
+ }
3949
+ function _defineProperties(target, props) {
3950
+ for (var i = 0; i < props.length; i++) {
3951
+ var descriptor = props[i];
3952
+ descriptor.enumerable = descriptor.enumerable || false;
3953
+ descriptor.configurable = true;
3954
+ if ("value" in descriptor) descriptor.writable = true;
3955
+ Object.defineProperty(target, descriptor.key, descriptor);
3956
+ }
3957
+ }
3958
+ function _createClass(Constructor, protoProps, staticProps) {
3959
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
3960
+ if (staticProps) _defineProperties(Constructor, staticProps);
3961
+ Object.defineProperty(Constructor, "prototype", {
3962
+ writable: false
3963
+ });
3964
+ return Constructor;
3965
+ }
3966
+ function _defineProperty(obj, key, value) {
3967
+ if (key in obj) {
3968
+ Object.defineProperty(obj, key, {
3969
+ value: value,
3970
+ enumerable: true,
3971
+ configurable: true,
3972
+ writable: true
3973
+ });
3974
+ } else {
3975
+ obj[key] = value;
3976
+ }
3977
+ return obj;
3978
+ }
3979
+ function _toConsumableArray(arr) {
3980
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
3981
+ }
3982
+ function _arrayWithoutHoles(arr) {
3983
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
3984
+ }
3985
+ function _iterableToArray(iter) {
3986
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3987
+ }
3988
+ function _unsupportedIterableToArray(o, minLen) {
3989
+ if (!o) return;
3990
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
3991
+ var n = Object.prototype.toString.call(o).slice(8, -1);
3992
+ if (n === "Object" && o.constructor) n = o.constructor.name;
3993
+ if (n === "Map" || n === "Set") return Array.from(o);
3994
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
3995
+ }
3996
+ function _arrayLikeToArray(arr, len) {
3997
+ if (len == null || len > arr.length) len = arr.length;
3998
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
3999
+ return arr2;
4000
+ }
4001
+ function _nonIterableSpread() {
4002
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3680
4003
  }
3681
- });
3682
-
3683
4004
 
3684
- /***/ }),
4005
+ /**
4006
+ * virtual list core calculating center
4007
+ */
3685
4008
 
3686
- /***/ 8111:
3687
- /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
4009
+ var DIRECTION_TYPE = {
4010
+ FRONT: 'FRONT',
4011
+ // scroll up or left
4012
+ BEHIND: 'BEHIND' // scroll down or right
4013
+ };
4014
+ var CALC_TYPE = {
4015
+ INIT: 'INIT',
4016
+ FIXED: 'FIXED',
4017
+ DYNAMIC: 'DYNAMIC'
4018
+ };
4019
+ var LEADING_BUFFER = 0;
4020
+ var Virtual = /*#__PURE__*/function () {
4021
+ function Virtual(param, callUpdate) {
4022
+ _classCallCheck(this, Virtual);
4023
+ this.init(param, callUpdate);
4024
+ }
4025
+ _createClass(Virtual, [{
4026
+ key: "init",
4027
+ value: function init(param, callUpdate) {
4028
+ // param data
4029
+ this.param = param;
4030
+ this.callUpdate = callUpdate;
4031
+
4032
+ // size data
4033
+ this.sizes = new Map();
4034
+ this.firstRangeTotalSize = 0;
4035
+ this.firstRangeAverageSize = 0;
4036
+ this.fixedSizeValue = 0;
4037
+ this.calcType = CALC_TYPE.INIT;
4038
+
4039
+ // scroll data
4040
+ this.offset = 0;
4041
+ this.direction = '';
4042
+
4043
+ // range data
4044
+ this.range = Object.create(null);
4045
+ if (param) {
4046
+ this.checkRange(0, param.keeps - 1);
4047
+ }
3688
4048
 
3689
- "use strict";
4049
+ // benchmark test data
4050
+ // this.__bsearchCalls = 0
4051
+ // this.__getIndexOffsetCalls = 0
4052
+ }
4053
+ }, {
4054
+ key: "destroy",
4055
+ value: function destroy() {
4056
+ this.init(null, null);
4057
+ }
3690
4058
 
3691
- var $ = __webpack_require__(6518);
3692
- var globalThis = __webpack_require__(4576);
3693
- var anInstance = __webpack_require__(679);
3694
- var anObject = __webpack_require__(8551);
3695
- var isCallable = __webpack_require__(4901);
3696
- var getPrototypeOf = __webpack_require__(2787);
3697
- var defineBuiltInAccessor = __webpack_require__(2106);
3698
- var createProperty = __webpack_require__(4659);
3699
- var fails = __webpack_require__(9039);
3700
- var hasOwn = __webpack_require__(9297);
3701
- var wellKnownSymbol = __webpack_require__(8227);
3702
- var IteratorPrototype = (__webpack_require__(7657).IteratorPrototype);
3703
- var DESCRIPTORS = __webpack_require__(3724);
3704
- var IS_PURE = __webpack_require__(6395);
4059
+ // return current render range
4060
+ }, {
4061
+ key: "getRange",
4062
+ value: function getRange() {
4063
+ var range = Object.create(null);
4064
+ range.start = this.range.start;
4065
+ range.end = this.range.end;
4066
+ range.padFront = this.range.padFront;
4067
+ range.padBehind = this.range.padBehind;
4068
+ return range;
4069
+ }
4070
+ }, {
4071
+ key: "isBehind",
4072
+ value: function isBehind() {
4073
+ return this.direction === DIRECTION_TYPE.BEHIND;
4074
+ }
4075
+ }, {
4076
+ key: "isFront",
4077
+ value: function isFront() {
4078
+ return this.direction === DIRECTION_TYPE.FRONT;
4079
+ }
3705
4080
 
3706
- var CONSTRUCTOR = 'constructor';
3707
- var ITERATOR = 'Iterator';
3708
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
4081
+ // return start index offset
4082
+ }, {
4083
+ key: "getOffset",
4084
+ value: function getOffset(start) {
4085
+ return (start < 1 ? 0 : this.getIndexOffset(start)) + this.param.slotHeaderSize;
4086
+ }
4087
+ }, {
4088
+ key: "updateParam",
4089
+ value: function updateParam(key, value) {
4090
+ var _this = this;
4091
+ if (this.param && key in this.param) {
4092
+ // if uniqueIds change, find out deleted id and remove from size map
4093
+ if (key === 'uniqueIds') {
4094
+ this.sizes.forEach(function (v, key) {
4095
+ if (!value.includes(key)) {
4096
+ _this.sizes["delete"](key);
4097
+ }
4098
+ });
4099
+ }
4100
+ this.param[key] = value;
4101
+ }
4102
+ }
3709
4103
 
3710
- var $TypeError = TypeError;
3711
- var NativeIterator = globalThis[ITERATOR];
4104
+ // save each size map by id
4105
+ }, {
4106
+ key: "saveSize",
4107
+ value: function saveSize(id, size) {
4108
+ this.sizes.set(id, size);
4109
+
4110
+ // we assume size type is fixed at the beginning and remember first size value
4111
+ // if there is no size value different from this at next comming saving
4112
+ // we think it's a fixed size list, otherwise is dynamic size list
4113
+ if (this.calcType === CALC_TYPE.INIT) {
4114
+ this.fixedSizeValue = size;
4115
+ this.calcType = CALC_TYPE.FIXED;
4116
+ } else if (this.calcType === CALC_TYPE.FIXED && this.fixedSizeValue !== size) {
4117
+ this.calcType = CALC_TYPE.DYNAMIC;
4118
+ // it's no use at all
4119
+ delete this.fixedSizeValue;
4120
+ }
3712
4121
 
3713
- // FF56- have non-standard global helper `Iterator`
3714
- var FORCED = IS_PURE
3715
- || !isCallable(NativeIterator)
3716
- || NativeIterator.prototype !== IteratorPrototype
3717
- // FF44- non-standard `Iterator` passes previous tests
3718
- || !fails(function () { NativeIterator({}); });
4122
+ // calculate the average size only in the first range
4123
+ if (this.calcType !== CALC_TYPE.FIXED && typeof this.firstRangeTotalSize !== 'undefined') {
4124
+ if (this.sizes.size < Math.min(this.param.keeps, this.param.uniqueIds.length)) {
4125
+ this.firstRangeTotalSize = _toConsumableArray(this.sizes.values()).reduce(function (acc, val) {
4126
+ return acc + val;
4127
+ }, 0);
4128
+ this.firstRangeAverageSize = Math.round(this.firstRangeTotalSize / this.sizes.size);
4129
+ } else {
4130
+ // it's done using
4131
+ delete this.firstRangeTotalSize;
4132
+ }
4133
+ }
4134
+ }
3719
4135
 
3720
- var IteratorConstructor = function Iterator() {
3721
- anInstance(this, IteratorPrototype);
3722
- if (getPrototypeOf(this) === IteratorPrototype) throw new $TypeError('Abstract class Iterator not directly constructable');
3723
- };
4136
+ // in some special situation (e.g. length change) we need to update in a row
4137
+ // try goiong to render next range by a leading buffer according to current direction
4138
+ }, {
4139
+ key: "handleDataSourcesChange",
4140
+ value: function handleDataSourcesChange() {
4141
+ var start = this.range.start;
4142
+ if (this.isFront()) {
4143
+ start = start - LEADING_BUFFER;
4144
+ } else if (this.isBehind()) {
4145
+ start = start + LEADING_BUFFER;
4146
+ }
4147
+ start = Math.max(start, 0);
4148
+ this.updateRange(this.range.start, this.getEndByStart(start));
4149
+ }
4150
+
4151
+ // when slot size change, we also need force update
4152
+ }, {
4153
+ key: "handleSlotSizeChange",
4154
+ value: function handleSlotSizeChange() {
4155
+ this.handleDataSourcesChange();
4156
+ }
4157
+
4158
+ // calculating range on scroll
4159
+ }, {
4160
+ key: "handleScroll",
4161
+ value: function handleScroll(offset) {
4162
+ this.direction = offset < this.offset || offset === 0 ? DIRECTION_TYPE.FRONT : DIRECTION_TYPE.BEHIND;
4163
+ this.offset = offset;
4164
+ if (!this.param) {
4165
+ return;
4166
+ }
4167
+ if (this.direction === DIRECTION_TYPE.FRONT) {
4168
+ this.handleFront();
4169
+ } else if (this.direction === DIRECTION_TYPE.BEHIND) {
4170
+ this.handleBehind();
4171
+ }
4172
+ }
4173
+
4174
+ // ----------- public method end -----------
4175
+ }, {
4176
+ key: "handleFront",
4177
+ value: function handleFront() {
4178
+ var overs = this.getScrollOvers();
4179
+ // should not change range if start doesn't exceed overs
4180
+ if (overs > this.range.start) {
4181
+ return;
4182
+ }
4183
+
4184
+ // move up start by a buffer length, and make sure its safety
4185
+ var start = Math.max(overs - this.param.buffer, 0);
4186
+ this.checkRange(start, this.getEndByStart(start));
4187
+ }
4188
+ }, {
4189
+ key: "handleBehind",
4190
+ value: function handleBehind() {
4191
+ var overs = this.getScrollOvers();
4192
+ // range should not change if scroll overs within buffer
4193
+ if (overs < this.range.start + this.param.buffer) {
4194
+ return;
4195
+ }
4196
+ this.checkRange(overs, this.getEndByStart(overs));
4197
+ }
4198
+
4199
+ // return the pass overs according to current scroll offset
4200
+ }, {
4201
+ key: "getScrollOvers",
4202
+ value: function getScrollOvers() {
4203
+ // if slot header exist, we need subtract its size
4204
+ var offset = this.offset - this.param.slotHeaderSize;
4205
+ if (offset <= 0) {
4206
+ return 0;
4207
+ }
4208
+
4209
+ // if is fixed type, that can be easily
4210
+ if (this.isFixedType()) {
4211
+ return Math.floor(offset / this.fixedSizeValue);
4212
+ }
4213
+ var low = 0;
4214
+ var middle = 0;
4215
+ var middleOffset = 0;
4216
+ var high = this.param.uniqueIds.length;
4217
+ while (low <= high) {
4218
+ // this.__bsearchCalls++
4219
+ middle = low + Math.floor((high - low) / 2);
4220
+ middleOffset = this.getIndexOffset(middle);
4221
+ if (middleOffset === offset) {
4222
+ return middle;
4223
+ } else if (middleOffset < offset) {
4224
+ low = middle + 1;
4225
+ } else if (middleOffset > offset) {
4226
+ high = middle - 1;
4227
+ }
4228
+ }
4229
+ return low > 0 ? --low : 0;
4230
+ }
4231
+
4232
+ // return a scroll offset from given index, can efficiency be improved more here?
4233
+ // although the call frequency is very high, its only a superposition of numbers
4234
+ }, {
4235
+ key: "getIndexOffset",
4236
+ value: function getIndexOffset(givenIndex) {
4237
+ if (!givenIndex) {
4238
+ return 0;
4239
+ }
4240
+ var offset = 0;
4241
+ var indexSize = 0;
4242
+ for (var index = 0; index < givenIndex; index++) {
4243
+ // this.__getIndexOffsetCalls++
4244
+ indexSize = this.sizes.get(this.param.uniqueIds[index]);
4245
+ offset = offset + (typeof indexSize === 'number' ? indexSize : this.getEstimateSize());
4246
+ }
4247
+ return offset;
4248
+ }
4249
+
4250
+ // is fixed size type
4251
+ }, {
4252
+ key: "isFixedType",
4253
+ value: function isFixedType() {
4254
+ return this.calcType === CALC_TYPE.FIXED;
4255
+ }
4256
+
4257
+ // return the real last index
4258
+ }, {
4259
+ key: "getLastIndex",
4260
+ value: function getLastIndex() {
4261
+ return this.param.uniqueIds.length - 1;
4262
+ }
4263
+
4264
+ // in some conditions range is broke, we need correct it
4265
+ // and then decide whether need update to next range
4266
+ }, {
4267
+ key: "checkRange",
4268
+ value: function checkRange(start, end) {
4269
+ var keeps = this.param.keeps;
4270
+ var total = this.param.uniqueIds.length;
4271
+
4272
+ // datas less than keeps, render all
4273
+ if (total <= keeps) {
4274
+ start = 0;
4275
+ end = this.getLastIndex();
4276
+ } else if (end - start < keeps - 1) {
4277
+ // if range length is less than keeps, corrent it base on end
4278
+ start = end - keeps + 1;
4279
+ }
4280
+ if (this.range.start !== start) {
4281
+ this.updateRange(start, end);
4282
+ }
4283
+ }
4284
+
4285
+ // setting to a new range and rerender
4286
+ }, {
4287
+ key: "updateRange",
4288
+ value: function updateRange(start, end) {
4289
+ this.range.start = start;
4290
+ this.range.end = end;
4291
+ this.range.padFront = this.getPadFront();
4292
+ this.range.padBehind = this.getPadBehind();
4293
+ this.callUpdate(this.getRange());
4294
+ }
4295
+
4296
+ // return end base on start
4297
+ }, {
4298
+ key: "getEndByStart",
4299
+ value: function getEndByStart(start) {
4300
+ var theoryEnd = start + this.param.keeps - 1;
4301
+ var truelyEnd = Math.min(theoryEnd, this.getLastIndex());
4302
+ return truelyEnd;
4303
+ }
4304
+
4305
+ // return total front offset
4306
+ }, {
4307
+ key: "getPadFront",
4308
+ value: function getPadFront() {
4309
+ if (this.isFixedType()) {
4310
+ return this.fixedSizeValue * this.range.start;
4311
+ } else {
4312
+ return this.getIndexOffset(this.range.start);
4313
+ }
4314
+ }
4315
+
4316
+ // return total behind offset
4317
+ }, {
4318
+ key: "getPadBehind",
4319
+ value: function getPadBehind() {
4320
+ var end = this.range.end;
4321
+ var lastIndex = this.getLastIndex();
4322
+ if (this.isFixedType()) {
4323
+ return (lastIndex - end) * this.fixedSizeValue;
4324
+ }
4325
+ return (lastIndex - end) * this.getEstimateSize();
4326
+ }
4327
+
4328
+ // get the item estimate size
4329
+ }, {
4330
+ key: "getEstimateSize",
4331
+ value: function getEstimateSize() {
4332
+ return this.isFixedType() ? this.fixedSizeValue : this.firstRangeAverageSize || this.param.estimateSize;
4333
+ }
4334
+ }]);
4335
+ return Virtual;
4336
+ }();
4337
+
4338
+ /**
4339
+ * props declaration for default, item and slot component
4340
+ */
4341
+
4342
+ var VirtualProps = {
4343
+ dataKey: {
4344
+ type: [String, Function],
4345
+ required: true
4346
+ },
4347
+ dataSources: {
4348
+ type: Array,
4349
+ required: true
4350
+ },
4351
+ dataComponent: {
4352
+ type: [Object, Function],
4353
+ required: true
4354
+ },
4355
+ keeps: {
4356
+ type: Number,
4357
+ "default": 30
4358
+ },
4359
+ extraProps: {
4360
+ type: Object
4361
+ },
4362
+ estimateSize: {
4363
+ type: Number,
4364
+ "default": 50
4365
+ },
4366
+ direction: {
4367
+ type: String,
4368
+ "default": 'vertical' // the other value is horizontal
4369
+ },
4370
+ start: {
4371
+ type: Number,
4372
+ "default": 0
4373
+ },
4374
+ offset: {
4375
+ type: Number,
4376
+ "default": 0
4377
+ },
4378
+ topThreshold: {
4379
+ type: Number,
4380
+ "default": 0
4381
+ },
4382
+ bottomThreshold: {
4383
+ type: Number,
4384
+ "default": 0
4385
+ },
4386
+ pageMode: {
4387
+ type: Boolean,
4388
+ "default": false
4389
+ },
4390
+ rootTag: {
4391
+ type: String,
4392
+ "default": 'div'
4393
+ },
4394
+ wrapTag: {
4395
+ type: String,
4396
+ "default": 'div'
4397
+ },
4398
+ wrapClass: {
4399
+ type: String,
4400
+ "default": ''
4401
+ },
4402
+ wrapStyle: {
4403
+ type: Object
4404
+ },
4405
+ itemTag: {
4406
+ type: String,
4407
+ "default": 'div'
4408
+ },
4409
+ itemClass: {
4410
+ type: String,
4411
+ "default": ''
4412
+ },
4413
+ itemClassAdd: {
4414
+ type: Function
4415
+ },
4416
+ itemStyle: {
4417
+ type: Object
4418
+ },
4419
+ headerTag: {
4420
+ type: String,
4421
+ "default": 'div'
4422
+ },
4423
+ headerClass: {
4424
+ type: String,
4425
+ "default": ''
4426
+ },
4427
+ headerStyle: {
4428
+ type: Object
4429
+ },
4430
+ footerTag: {
4431
+ type: String,
4432
+ "default": 'div'
4433
+ },
4434
+ footerClass: {
4435
+ type: String,
4436
+ "default": ''
4437
+ },
4438
+ footerStyle: {
4439
+ type: Object
4440
+ },
4441
+ itemScopedSlots: {
4442
+ type: Object
4443
+ }
4444
+ };
4445
+ var ItemProps = {
4446
+ index: {
4447
+ type: Number
4448
+ },
4449
+ event: {
4450
+ type: String
4451
+ },
4452
+ tag: {
4453
+ type: String
4454
+ },
4455
+ horizontal: {
4456
+ type: Boolean
4457
+ },
4458
+ source: {
4459
+ type: Object
4460
+ },
4461
+ component: {
4462
+ type: [Object, Function]
4463
+ },
4464
+ slotComponent: {
4465
+ type: Function
4466
+ },
4467
+ uniqueKey: {
4468
+ type: [String, Number]
4469
+ },
4470
+ extraProps: {
4471
+ type: Object
4472
+ },
4473
+ scopedSlots: {
4474
+ type: Object
4475
+ }
4476
+ };
4477
+ var SlotProps = {
4478
+ event: {
4479
+ type: String
4480
+ },
4481
+ uniqueKey: {
4482
+ type: String
4483
+ },
4484
+ tag: {
4485
+ type: String
4486
+ },
4487
+ horizontal: {
4488
+ type: Boolean
4489
+ }
4490
+ };
4491
+ var Wrapper = {
4492
+ created: function created() {
4493
+ this.shapeKey = this.horizontal ? 'offsetWidth' : 'offsetHeight';
4494
+ },
4495
+ mounted: function mounted() {
4496
+ var _this = this;
4497
+ if (typeof ResizeObserver !== 'undefined') {
4498
+ this.resizeObserver = new ResizeObserver(function () {
4499
+ _this.dispatchSizeChange();
4500
+ });
4501
+ this.resizeObserver.observe(this.$el);
4502
+ }
4503
+ },
4504
+ // since componet will be reused, so disptach when updated
4505
+ updated: function updated() {
4506
+ // this.dispatchSizeChange()
4507
+ this.resizeObserver.observe(this.$el);
4508
+ },
4509
+ beforeDestroy: function beforeDestroy() {
4510
+ if (this.resizeObserver) {
4511
+ this.resizeObserver.disconnect();
4512
+ this.resizeObserver = null;
4513
+ }
4514
+ },
4515
+ methods: {
4516
+ getCurrentSize: function getCurrentSize() {
4517
+ return this.$el ? this.$el[this.shapeKey] : 0;
4518
+ },
4519
+ // tell parent current size identify by unqiue key
4520
+ dispatchSizeChange: function dispatchSizeChange() {
4521
+ this.$parent.$emit(this.event, this.uniqueKey, this.getCurrentSize(), this.hasInitial);
4522
+ }
4523
+ }
4524
+ };
4525
+
4526
+ // wrapping for item
4527
+ var Item = Vue.component('virtual-list-item', {
4528
+ mixins: [Wrapper],
4529
+ props: ItemProps,
4530
+ render: function render(h) {
4531
+ var tag = this.tag,
4532
+ component = this.component,
4533
+ _this$extraProps = this.extraProps,
4534
+ extraProps = _this$extraProps === void 0 ? {} : _this$extraProps,
4535
+ index = this.index,
4536
+ source = this.source,
4537
+ _this$scopedSlots = this.scopedSlots,
4538
+ scopedSlots = _this$scopedSlots === void 0 ? {} : _this$scopedSlots,
4539
+ uniqueKey = this.uniqueKey,
4540
+ slotComponent = this.slotComponent;
4541
+ var props = _objectSpread2(_objectSpread2({}, extraProps), {}, {
4542
+ source: source,
4543
+ index: index
4544
+ });
4545
+ return h(tag, {
4546
+ key: uniqueKey,
4547
+ attrs: {
4548
+ role: 'listitem'
4549
+ }
4550
+ }, [slotComponent ? slotComponent({
4551
+ item: source,
4552
+ index: index,
4553
+ scope: props
4554
+ }) : h(component, {
4555
+ props: props,
4556
+ scopedSlots: scopedSlots
4557
+ })]);
4558
+ }
4559
+ });
4560
+
4561
+ // wrapping for slot
4562
+ var Slot = Vue.component('virtual-list-slot', {
4563
+ mixins: [Wrapper],
4564
+ props: SlotProps,
4565
+ render: function render(h) {
4566
+ var tag = this.tag,
4567
+ uniqueKey = this.uniqueKey;
4568
+ return h(tag, {
4569
+ key: uniqueKey,
4570
+ attrs: {
4571
+ role: uniqueKey
4572
+ }
4573
+ }, this.$slots["default"]);
4574
+ }
4575
+ });
4576
+
4577
+ /**
4578
+ * virtual list default component
4579
+ */
4580
+ var EVENT_TYPE = {
4581
+ ITEM: 'item_resize',
4582
+ SLOT: 'slot_resize'
4583
+ };
4584
+ var SLOT_TYPE = {
4585
+ HEADER: 'thead',
4586
+ // string value also use for aria role attribute
4587
+ FOOTER: 'tfoot'
4588
+ };
4589
+ var VirtualList = Vue.component('virtual-list', {
4590
+ props: VirtualProps,
4591
+ data: function data() {
4592
+ return {
4593
+ range: null
4594
+ };
4595
+ },
4596
+ watch: {
4597
+ 'dataSources.length': function dataSourcesLength() {
4598
+ this.virtual.updateParam('uniqueIds', this.getUniqueIdFromDataSources());
4599
+ this.virtual.handleDataSourcesChange();
4600
+ },
4601
+ keeps: function keeps(newValue) {
4602
+ this.virtual.updateParam('keeps', newValue);
4603
+ this.virtual.handleSlotSizeChange();
4604
+ },
4605
+ start: function start(newValue) {
4606
+ this.scrollToIndex(newValue);
4607
+ },
4608
+ offset: function offset(newValue) {
4609
+ this.scrollToOffset(newValue);
4610
+ }
4611
+ },
4612
+ created: function created() {
4613
+ this.isHorizontal = this.direction === 'horizontal';
4614
+ this.directionKey = this.isHorizontal ? 'scrollLeft' : 'scrollTop';
4615
+ this.installVirtual();
4616
+
4617
+ // listen item size change
4618
+ this.$on(EVENT_TYPE.ITEM, this.onItemResized);
4619
+
4620
+ // listen slot size change
4621
+ if (this.$slots.header || this.$slots.footer) {
4622
+ this.$on(EVENT_TYPE.SLOT, this.onSlotResized);
4623
+ }
4624
+ },
4625
+ activated: function activated() {
4626
+ // set back offset when awake from keep-alive
4627
+ this.scrollToOffset(this.virtual.offset);
4628
+ if (this.pageMode) {
4629
+ document.addEventListener('scroll', this.onScroll, {
4630
+ passive: false
4631
+ });
4632
+ }
4633
+ },
4634
+ deactivated: function deactivated() {
4635
+ if (this.pageMode) {
4636
+ document.removeEventListener('scroll', this.onScroll);
4637
+ }
4638
+ },
4639
+ mounted: function mounted() {
4640
+ // set position
4641
+ if (this.start) {
4642
+ this.scrollToIndex(this.start);
4643
+ } else if (this.offset) {
4644
+ this.scrollToOffset(this.offset);
4645
+ }
4646
+
4647
+ // in page mode we bind scroll event to document
4648
+ if (this.pageMode) {
4649
+ this.updatePageModeFront();
4650
+ document.addEventListener('scroll', this.onScroll, {
4651
+ passive: false
4652
+ });
4653
+ }
4654
+ },
4655
+ beforeDestroy: function beforeDestroy() {
4656
+ this.virtual.destroy();
4657
+ if (this.pageMode) {
4658
+ document.removeEventListener('scroll', this.onScroll);
4659
+ }
4660
+ },
4661
+ methods: {
4662
+ // get item size by id
4663
+ getSize: function getSize(id) {
4664
+ return this.virtual.sizes.get(id);
4665
+ },
4666
+ // get the total number of stored (rendered) items
4667
+ getSizes: function getSizes() {
4668
+ return this.virtual.sizes.size;
4669
+ },
4670
+ // return current scroll offset
4671
+ getOffset: function getOffset() {
4672
+ if (this.pageMode) {
4673
+ return document.documentElement[this.directionKey] || document.body[this.directionKey];
4674
+ } else {
4675
+ var root = this.$refs.root;
4676
+ return root ? Math.ceil(root[this.directionKey]) : 0;
4677
+ }
4678
+ },
4679
+ // return client viewport size
4680
+ getClientSize: function getClientSize() {
4681
+ var key = this.isHorizontal ? 'clientWidth' : 'clientHeight';
4682
+ if (this.pageMode) {
4683
+ return document.documentElement[key] || document.body[key];
4684
+ } else {
4685
+ var root = this.$refs.root;
4686
+ return root ? Math.ceil(root[key]) : 0;
4687
+ }
4688
+ },
4689
+ // return all scroll size
4690
+ getScrollSize: function getScrollSize() {
4691
+ var key = this.isHorizontal ? 'scrollWidth' : 'scrollHeight';
4692
+ if (this.pageMode) {
4693
+ return document.documentElement[key] || document.body[key];
4694
+ } else {
4695
+ var root = this.$refs.root;
4696
+ return root ? Math.ceil(root[key]) : 0;
4697
+ }
4698
+ },
4699
+ // set current scroll position to a expectant offset
4700
+ scrollToOffset: function scrollToOffset(offset) {
4701
+ if (this.pageMode) {
4702
+ document.body[this.directionKey] = offset;
4703
+ document.documentElement[this.directionKey] = offset;
4704
+ } else {
4705
+ var root = this.$refs.root;
4706
+ if (root) {
4707
+ root[this.directionKey] = offset;
4708
+ }
4709
+ }
4710
+ },
4711
+ // set current scroll position to a expectant index
4712
+ scrollToIndex: function scrollToIndex(index) {
4713
+ // scroll to bottom
4714
+ if (index >= this.dataSources.length - 1) {
4715
+ this.scrollToBottom();
4716
+ } else {
4717
+ var offset = this.virtual.getOffset(index);
4718
+ this.scrollToOffset(offset);
4719
+ }
4720
+ },
4721
+ // set current scroll position to bottom
4722
+ scrollToBottom: function scrollToBottom() {
4723
+ var _this = this;
4724
+ var shepherd = this.$refs.shepherd;
4725
+ if (shepherd) {
4726
+ var offset = shepherd[this.isHorizontal ? 'offsetLeft' : 'offsetTop'];
4727
+ this.scrollToOffset(offset);
4728
+
4729
+ // check if it's really scrolled to the bottom
4730
+ // maybe list doesn't render and calculate to last range
4731
+ // so we need retry in next event loop until it really at bottom
4732
+ setTimeout(function () {
4733
+ if (_this.getOffset() + _this.getClientSize() + 1 < _this.getScrollSize()) {
4734
+ _this.scrollToBottom();
4735
+ }
4736
+ }, 3);
4737
+ }
4738
+ },
4739
+ // when using page mode we need update slot header size manually
4740
+ // taking root offset relative to the browser as slot header size
4741
+ updatePageModeFront: function updatePageModeFront() {
4742
+ var root = this.$refs.root;
4743
+ if (root) {
4744
+ var rect = root.getBoundingClientRect();
4745
+ var defaultView = root.ownerDocument.defaultView;
4746
+ var offsetFront = this.isHorizontal ? rect.left + defaultView.pageXOffset : rect.top + defaultView.pageYOffset;
4747
+ this.virtual.updateParam('slotHeaderSize', offsetFront);
4748
+ }
4749
+ },
4750
+ // reset all state back to initial
4751
+ reset: function reset() {
4752
+ this.virtual.destroy();
4753
+ this.scrollToOffset(0);
4754
+ this.installVirtual();
4755
+ },
4756
+ // ----------- public method end -----------
4757
+ installVirtual: function installVirtual() {
4758
+ this.virtual = new Virtual({
4759
+ slotHeaderSize: 0,
4760
+ slotFooterSize: 0,
4761
+ keeps: this.keeps,
4762
+ estimateSize: this.estimateSize,
4763
+ buffer: Math.round(this.keeps / 3),
4764
+ // recommend for a third of keeps
4765
+ uniqueIds: this.getUniqueIdFromDataSources()
4766
+ }, this.onRangeChanged);
4767
+
4768
+ // sync initial range
4769
+ this.range = this.virtual.getRange();
4770
+ },
4771
+ getUniqueIdFromDataSources: function getUniqueIdFromDataSources() {
4772
+ var dataKey = this.dataKey;
4773
+ return this.dataSources.map(function (dataSource) {
4774
+ return typeof dataKey === 'function' ? dataKey(dataSource) : dataSource[dataKey];
4775
+ });
4776
+ },
4777
+ // event called when each item mounted or size changed
4778
+ onItemResized: function onItemResized(id, size) {
4779
+ this.virtual.saveSize(id, size);
4780
+ this.$emit('resized', id, size);
4781
+ },
4782
+ // event called when slot mounted or size changed
4783
+ onSlotResized: function onSlotResized(type, size, hasInit) {
4784
+ if (type === SLOT_TYPE.HEADER) {
4785
+ this.virtual.updateParam('slotHeaderSize', size);
4786
+ } else if (type === SLOT_TYPE.FOOTER) {
4787
+ this.virtual.updateParam('slotFooterSize', size);
4788
+ }
4789
+ if (hasInit) {
4790
+ this.virtual.handleSlotSizeChange();
4791
+ }
4792
+ },
4793
+ // here is the rerendering entry
4794
+ onRangeChanged: function onRangeChanged(range) {
4795
+ this.range = range;
4796
+ },
4797
+ onScroll: function onScroll(evt) {
4798
+ var offset = this.getOffset();
4799
+ var clientSize = this.getClientSize();
4800
+ var scrollSize = this.getScrollSize();
4801
+
4802
+ // iOS scroll-spring-back behavior will make direction mistake
4803
+ if (offset < 0 || offset + clientSize > scrollSize + 1 || !scrollSize) {
4804
+ return;
4805
+ }
4806
+ this.virtual.handleScroll(offset);
4807
+ this.emitEvent(offset, clientSize, scrollSize, evt);
4808
+ },
4809
+ // emit event in special position
4810
+ emitEvent: function emitEvent(offset, clientSize, scrollSize, evt) {
4811
+ this.$emit('scroll', evt, this.virtual.getRange());
4812
+ if (this.virtual.isFront() && !!this.dataSources.length && offset - this.topThreshold <= 0) {
4813
+ this.$emit('totop');
4814
+ } else if (this.virtual.isBehind() && offset + clientSize + this.bottomThreshold >= scrollSize) {
4815
+ this.$emit('tobottom');
4816
+ }
4817
+ },
4818
+ // get the real render slots based on range data
4819
+ // in-place patch strategy will try to reuse components as possible
4820
+ // so those components that are reused will not trigger lifecycle mounted
4821
+ getRenderSlots: function getRenderSlots(h) {
4822
+ var slots = [];
4823
+ var _this$range = this.range,
4824
+ start = _this$range.start,
4825
+ end = _this$range.end;
4826
+ var dataSources = this.dataSources,
4827
+ dataKey = this.dataKey,
4828
+ itemClass = this.itemClass,
4829
+ itemTag = this.itemTag,
4830
+ itemStyle = this.itemStyle,
4831
+ isHorizontal = this.isHorizontal,
4832
+ extraProps = this.extraProps,
4833
+ dataComponent = this.dataComponent,
4834
+ itemScopedSlots = this.itemScopedSlots;
4835
+ var slotComponent = this.$scopedSlots && this.$scopedSlots.item;
4836
+ for (var index = start; index <= end; index++) {
4837
+ var dataSource = dataSources[index];
4838
+ if (dataSource) {
4839
+ var uniqueKey = typeof dataKey === 'function' ? dataKey(dataSource) : dataSource[dataKey];
4840
+ if (typeof uniqueKey === 'string' || typeof uniqueKey === 'number') {
4841
+ slots.push(h(Item, {
4842
+ props: {
4843
+ index: index,
4844
+ tag: itemTag,
4845
+ event: EVENT_TYPE.ITEM,
4846
+ horizontal: isHorizontal,
4847
+ uniqueKey: uniqueKey,
4848
+ source: dataSource,
4849
+ extraProps: extraProps,
4850
+ component: dataComponent,
4851
+ slotComponent: slotComponent,
4852
+ scopedSlots: itemScopedSlots
4853
+ },
4854
+ style: itemStyle,
4855
+ "class": "".concat(itemClass).concat(this.itemClassAdd ? ' ' + this.itemClassAdd(index) : '')
4856
+ }));
4857
+ } else {
4858
+ console.warn("Cannot get the data-key '".concat(dataKey, "' from data-sources."));
4859
+ }
4860
+ } else {
4861
+ console.warn("Cannot get the index '".concat(index, "' from data-sources."));
4862
+ }
4863
+ }
4864
+ return slots;
4865
+ }
4866
+ },
4867
+ // render function, a closer-to-the-compiler alternative to templates
4868
+ // https://vuejs.org/v2/guide/render-function.html#The-Data-Object-In-Depth
4869
+ render: function render(h) {
4870
+ var _this$$slots = this.$slots,
4871
+ header = _this$$slots.header,
4872
+ footer = _this$$slots.footer;
4873
+ var _this$range2 = this.range,
4874
+ padFront = _this$range2.padFront,
4875
+ padBehind = _this$range2.padBehind;
4876
+ var isHorizontal = this.isHorizontal,
4877
+ pageMode = this.pageMode,
4878
+ rootTag = this.rootTag,
4879
+ wrapTag = this.wrapTag,
4880
+ wrapClass = this.wrapClass,
4881
+ wrapStyle = this.wrapStyle,
4882
+ headerTag = this.headerTag,
4883
+ headerClass = this.headerClass,
4884
+ headerStyle = this.headerStyle,
4885
+ footerTag = this.footerTag,
4886
+ footerClass = this.footerClass,
4887
+ footerStyle = this.footerStyle;
4888
+ var paddingStyle = {
4889
+ padding: isHorizontal ? "0px ".concat(padBehind, "px 0px ").concat(padFront, "px") : "".concat(padFront, "px 0px ").concat(padBehind, "px")
4890
+ };
4891
+ var wrapperStyle = wrapStyle ? Object.assign({}, wrapStyle, paddingStyle) : paddingStyle;
4892
+ return h(rootTag, {
4893
+ ref: 'root',
4894
+ on: {
4895
+ '&scroll': !pageMode && this.onScroll
4896
+ }
4897
+ }, [
4898
+ // header slot
4899
+ header ? h(Slot, {
4900
+ "class": headerClass,
4901
+ style: headerStyle,
4902
+ props: {
4903
+ tag: headerTag,
4904
+ event: EVENT_TYPE.SLOT,
4905
+ uniqueKey: SLOT_TYPE.HEADER
4906
+ }
4907
+ }, header) : null,
4908
+ // main list
4909
+ h(wrapTag, {
4910
+ "class": wrapClass,
4911
+ attrs: {
4912
+ role: 'group'
4913
+ },
4914
+ style: wrapperStyle
4915
+ }, this.getRenderSlots(h)),
4916
+ // footer slot
4917
+ footer ? h(Slot, {
4918
+ "class": footerClass,
4919
+ style: footerStyle,
4920
+ props: {
4921
+ tag: footerTag,
4922
+ event: EVENT_TYPE.SLOT,
4923
+ uniqueKey: SLOT_TYPE.FOOTER
4924
+ }
4925
+ }, footer) : null,
4926
+ // an empty element use to scroll to bottom
4927
+ h('div', {
4928
+ ref: 'shepherd',
4929
+ style: {
4930
+ width: isHorizontal ? '0px' : '100%',
4931
+ height: isHorizontal ? '100%' : '0px'
4932
+ }
4933
+ })]);
4934
+ }
4935
+ });
4936
+ return VirtualList;
4937
+ });
4938
+
4939
+ /***/ }),
4940
+
4941
+ /***/ 8100:
4942
+ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
4943
+
4944
+ "use strict";
4945
+
4946
+ var $ = __webpack_require__(6518);
4947
+ var $transfer = __webpack_require__(5636);
4948
+
4949
+ // `ArrayBuffer.prototype.transfer` method
4950
+ // https://tc39.es/ecma262/#sec-arraybuffer.prototype.transfer
4951
+ if ($transfer) $({ target: 'ArrayBuffer', proto: true }, {
4952
+ transfer: function transfer() {
4953
+ return $transfer(this, arguments.length ? arguments[0] : undefined, true);
4954
+ }
4955
+ });
4956
+
4957
+
4958
+ /***/ }),
4959
+
4960
+ /***/ 8111:
4961
+ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
4962
+
4963
+ "use strict";
4964
+
4965
+ var $ = __webpack_require__(6518);
4966
+ var globalThis = __webpack_require__(4576);
4967
+ var anInstance = __webpack_require__(679);
4968
+ var anObject = __webpack_require__(8551);
4969
+ var isCallable = __webpack_require__(4901);
4970
+ var getPrototypeOf = __webpack_require__(2787);
4971
+ var defineBuiltInAccessor = __webpack_require__(2106);
4972
+ var createProperty = __webpack_require__(4659);
4973
+ var fails = __webpack_require__(9039);
4974
+ var hasOwn = __webpack_require__(9297);
4975
+ var wellKnownSymbol = __webpack_require__(8227);
4976
+ var IteratorPrototype = (__webpack_require__(7657).IteratorPrototype);
4977
+ var DESCRIPTORS = __webpack_require__(3724);
4978
+ var IS_PURE = __webpack_require__(6395);
4979
+
4980
+ var CONSTRUCTOR = 'constructor';
4981
+ var ITERATOR = 'Iterator';
4982
+ var TO_STRING_TAG = wellKnownSymbol('toStringTag');
4983
+
4984
+ var $TypeError = TypeError;
4985
+ var NativeIterator = globalThis[ITERATOR];
4986
+
4987
+ // FF56- have non-standard global helper `Iterator`
4988
+ var FORCED = IS_PURE
4989
+ || !isCallable(NativeIterator)
4990
+ || NativeIterator.prototype !== IteratorPrototype
4991
+ // FF44- non-standard `Iterator` passes previous tests
4992
+ || !fails(function () { NativeIterator({}); });
4993
+
4994
+ var IteratorConstructor = function Iterator() {
4995
+ anInstance(this, IteratorPrototype);
4996
+ if (getPrototypeOf(this) === IteratorPrototype) throw new $TypeError('Abstract class Iterator not directly constructable');
4997
+ };
3724
4998
 
3725
4999
  var defineIteratorPrototypeAccessor = function (key, value) {
3726
5000
  if (DESCRIPTORS) {
@@ -3781,6 +5055,66 @@ module.exports = function (name) {
3781
5055
  };
3782
5056
 
3783
5057
 
5058
+ /***/ }),
5059
+
5060
+ /***/ 8237:
5061
+ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
5062
+
5063
+ "use strict";
5064
+
5065
+ var $ = __webpack_require__(6518);
5066
+ var iterate = __webpack_require__(2652);
5067
+ var aCallable = __webpack_require__(9306);
5068
+ var anObject = __webpack_require__(8551);
5069
+ var getIteratorDirect = __webpack_require__(1767);
5070
+ var iteratorClose = __webpack_require__(9539);
5071
+ var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549);
5072
+ var apply = __webpack_require__(8745);
5073
+ var fails = __webpack_require__(9039);
5074
+
5075
+ var $TypeError = TypeError;
5076
+
5077
+ // https://bugs.webkit.org/show_bug.cgi?id=291651
5078
+ var FAILS_ON_INITIAL_UNDEFINED = fails(function () {
5079
+ // eslint-disable-next-line es/no-iterator-prototype-reduce, es/no-array-prototype-keys, array-callback-return -- required for testing
5080
+ [].keys().reduce(function () { /* empty */ }, undefined);
5081
+ });
5082
+
5083
+ var reduceWithoutClosingOnEarlyError = !FAILS_ON_INITIAL_UNDEFINED && iteratorHelperWithoutClosingOnEarlyError('reduce', $TypeError);
5084
+
5085
+ // `Iterator.prototype.reduce` method
5086
+ // https://tc39.es/ecma262/#sec-iterator.prototype.reduce
5087
+ $({ target: 'Iterator', proto: true, real: true, forced: FAILS_ON_INITIAL_UNDEFINED || reduceWithoutClosingOnEarlyError }, {
5088
+ reduce: function reduce(reducer /* , initialValue */) {
5089
+ anObject(this);
5090
+ try {
5091
+ aCallable(reducer);
5092
+ } catch (error) {
5093
+ iteratorClose(this, 'throw', error);
5094
+ }
5095
+
5096
+ var noInitial = arguments.length < 2;
5097
+ var accumulator = noInitial ? undefined : arguments[1];
5098
+ if (reduceWithoutClosingOnEarlyError) {
5099
+ return apply(reduceWithoutClosingOnEarlyError, this, noInitial ? [reducer] : [reducer, accumulator]);
5100
+ }
5101
+ var record = getIteratorDirect(this);
5102
+ var counter = 0;
5103
+ iterate(record, function (value) {
5104
+ if (noInitial) {
5105
+ noInitial = false;
5106
+ accumulator = value;
5107
+ } else {
5108
+ accumulator = reducer(accumulator, value, counter);
5109
+ }
5110
+ counter++;
5111
+ }, { IS_RECORD: true });
5112
+ if (noInitial) throw new $TypeError('Reduce of empty iterator with no initial value');
5113
+ return accumulator;
5114
+ }
5115
+ });
5116
+
5117
+
3784
5118
  /***/ }),
3785
5119
 
3786
5120
  /***/ 8469:
@@ -3924,6 +5258,25 @@ module.exports = [
3924
5258
  ];
3925
5259
 
3926
5260
 
5261
+ /***/ }),
5262
+
5263
+ /***/ 8745:
5264
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
5265
+
5266
+ "use strict";
5267
+
5268
+ var NATIVE_BIND = __webpack_require__(616);
5269
+
5270
+ var FunctionPrototype = Function.prototype;
5271
+ var apply = FunctionPrototype.apply;
5272
+ var call = FunctionPrototype.call;
5273
+
5274
+ // eslint-disable-next-line es/no-function-prototype-bind, es/no-reflect -- safe
5275
+ module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {
5276
+ return call.apply(apply, arguments);
5277
+ });
5278
+
5279
+
3927
5280
  /***/ }),
3928
5281
 
3929
5282
  /***/ 8750:
@@ -4082,45 +5435,116 @@ module.exports = function (argument) {
4082
5435
 
4083
5436
  /***/ }),
4084
5437
 
4085
- /***/ 9429:
5438
+ /***/ 9433:
4086
5439
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
4087
5440
 
4088
5441
  "use strict";
4089
5442
 
4090
5443
  var globalThis = __webpack_require__(4576);
4091
- var IS_NODE = __webpack_require__(6193);
4092
5444
 
4093
- module.exports = function (name) {
4094
- if (IS_NODE) {
4095
- try {
4096
- return globalThis.process.getBuiltinModule(name);
4097
- } catch (error) { /* empty */ }
4098
- try {
4099
- // eslint-disable-next-line no-new-func -- safe
4100
- return Function('return require("' + name + '")')();
4101
- } catch (error) { /* empty */ }
4102
- }
5445
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
5446
+ var defineProperty = Object.defineProperty;
5447
+
5448
+ module.exports = function (key, value) {
5449
+ try {
5450
+ defineProperty(globalThis, key, { value: value, configurable: true, writable: true });
5451
+ } catch (error) {
5452
+ globalThis[key] = value;
5453
+ } return value;
4103
5454
  };
4104
5455
 
4105
5456
 
4106
5457
  /***/ }),
4107
5458
 
4108
- /***/ 9433:
5459
+ /***/ 9462:
4109
5460
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
4110
5461
 
4111
5462
  "use strict";
4112
5463
 
4113
- var globalThis = __webpack_require__(4576);
5464
+ var call = __webpack_require__(9565);
5465
+ var create = __webpack_require__(2360);
5466
+ var createNonEnumerableProperty = __webpack_require__(6699);
5467
+ var defineBuiltIns = __webpack_require__(6279);
5468
+ var wellKnownSymbol = __webpack_require__(8227);
5469
+ var InternalStateModule = __webpack_require__(1181);
5470
+ var getMethod = __webpack_require__(5966);
5471
+ var IteratorPrototype = (__webpack_require__(7657).IteratorPrototype);
5472
+ var createIterResultObject = __webpack_require__(2529);
5473
+ var iteratorClose = __webpack_require__(9539);
5474
+ var iteratorCloseAll = __webpack_require__(1385);
4114
5475
 
4115
- // eslint-disable-next-line es/no-object-defineproperty -- safe
4116
- var defineProperty = Object.defineProperty;
5476
+ var TO_STRING_TAG = wellKnownSymbol('toStringTag');
5477
+ var ITERATOR_HELPER = 'IteratorHelper';
5478
+ var WRAP_FOR_VALID_ITERATOR = 'WrapForValidIterator';
5479
+ var NORMAL = 'normal';
5480
+ var THROW = 'throw';
5481
+ var setInternalState = InternalStateModule.set;
5482
+
5483
+ var createIteratorProxyPrototype = function (IS_ITERATOR) {
5484
+ var getInternalState = InternalStateModule.getterFor(IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER);
5485
+
5486
+ return defineBuiltIns(create(IteratorPrototype), {
5487
+ next: function next() {
5488
+ var state = getInternalState(this);
5489
+ // for simplification:
5490
+ // for `%WrapForValidIteratorPrototype%.next` or with `state.returnHandlerResult` our `nextHandler` returns `IterResultObject`
5491
+ // for `%IteratorHelperPrototype%.next` - just a value
5492
+ if (IS_ITERATOR) return state.nextHandler();
5493
+ if (state.done) return createIterResultObject(undefined, true);
5494
+ try {
5495
+ var result = state.nextHandler();
5496
+ return state.returnHandlerResult ? result : createIterResultObject(result, state.done);
5497
+ } catch (error) {
5498
+ state.done = true;
5499
+ throw error;
5500
+ }
5501
+ },
5502
+ 'return': function () {
5503
+ var state = getInternalState(this);
5504
+ var iterator = state.iterator;
5505
+ state.done = true;
5506
+ if (IS_ITERATOR) {
5507
+ var returnMethod = getMethod(iterator, 'return');
5508
+ return returnMethod ? call(returnMethod, iterator) : createIterResultObject(undefined, true);
5509
+ }
5510
+ if (state.inner) try {
5511
+ iteratorClose(state.inner.iterator, NORMAL);
5512
+ } catch (error) {
5513
+ return iteratorClose(iterator, THROW, error);
5514
+ }
5515
+ if (state.openIters) try {
5516
+ iteratorCloseAll(state.openIters, NORMAL);
5517
+ } catch (error) {
5518
+ return iteratorClose(iterator, THROW, error);
5519
+ }
5520
+ if (iterator) iteratorClose(iterator, NORMAL);
5521
+ return createIterResultObject(undefined, true);
5522
+ }
5523
+ });
5524
+ };
4117
5525
 
4118
- module.exports = function (key, value) {
4119
- try {
4120
- defineProperty(globalThis, key, { value: value, configurable: true, writable: true });
4121
- } catch (error) {
4122
- globalThis[key] = value;
4123
- } return value;
5526
+ var WrapForValidIteratorPrototype = createIteratorProxyPrototype(true);
5527
+ var IteratorHelperPrototype = createIteratorProxyPrototype(false);
5528
+
5529
+ createNonEnumerableProperty(IteratorHelperPrototype, TO_STRING_TAG, 'Iterator Helper');
5530
+
5531
+ module.exports = function (nextHandler, IS_ITERATOR, RETURN_HANDLER_RESULT) {
5532
+ var IteratorProxy = function Iterator(record, state) {
5533
+ if (state) {
5534
+ state.iterator = record.iterator;
5535
+ state.next = record.next;
5536
+ } else state = record;
5537
+ state.type = IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER;
5538
+ state.returnHandlerResult = !!RETURN_HANDLER_RESULT;
5539
+ state.nextHandler = nextHandler;
5540
+ state.counter = 0;
5541
+ state.done = false;
5542
+ setInternalState(this, state);
5543
+ };
5544
+
5545
+ IteratorProxy.prototype = IS_ITERATOR ? WrapForValidIteratorPrototype : IteratorHelperPrototype;
5546
+
5547
+ return IteratorProxy;
4124
5548
  };
4125
5549
 
4126
5550
 
@@ -4410,6 +5834,7 @@ __webpack_require__.d(__webpack_exports__, {
4410
5834
  UiDialog: function() { return /* reexport */ ui_dialog; },
4411
5835
  UiForm: function() { return /* reexport */ ui_form; },
4412
5836
  UiTable: function() { return /* reexport */ ui_table; },
5837
+ UiVirtualSelect: function() { return /* reexport */ ui_virtual_select; },
4413
5838
  "default": function() { return /* binding */ entry_lib; }
4414
5839
  });
4415
5840
 
@@ -5420,13 +6845,304 @@ var ui_dialog_component = normalizeComponent(
5420
6845
  )
5421
6846
 
5422
6847
  /* harmony default export */ var ui_dialog = (ui_dialog_component.exports);
6848
+ ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/elementConfig/ui-virtual-select/index.vue?vue&type=template&id=4776e956&scoped=true
6849
+ var ui_virtual_selectvue_type_template_id_4776e956_scoped_true_render = function render() {
6850
+ var _vm = this,
6851
+ _c = _vm._self._c;
6852
+ return _c('div', {
6853
+ staticClass: "select-wrap"
6854
+ }, [_c('el-select', _vm._b({
6855
+ ref: "elSelectRef",
6856
+ attrs: {
6857
+ "value": _vm.innerValue,
6858
+ "popper-class": "virtual-select-popper",
6859
+ "filterable": "",
6860
+ "filter-method": _vm.filterMethod,
6861
+ "popper-append-to-body": true
6862
+ },
6863
+ on: {
6864
+ "visible-change": _vm.handleVisibleChange,
6865
+ "change": _vm.handleSelectChange
6866
+ }
6867
+ }, 'el-select', _vm.$attrs, false), [_c('vue-virtual-scroll-list', {
6868
+ ref: "virtualList",
6869
+ staticClass: "virtual-list",
6870
+ attrs: {
6871
+ "data-key": _vm.fields.value,
6872
+ "data-sources": _vm.filteredData,
6873
+ "data-component": _vm.itemComponent,
6874
+ "keeps": 20,
6875
+ "extra-props": {
6876
+ label: _vm.fields.label,
6877
+ value: _vm.fields.value,
6878
+ rightLabel: _vm.fields.rightLabel
6879
+ },
6880
+ "estimate-size": 34
6881
+ },
6882
+ on: {
6883
+ "item-click": _vm.handleItemClick
6884
+ }
6885
+ })], 1)], 1);
6886
+ };
6887
+ var ui_virtual_selectvue_type_template_id_4776e956_scoped_true_staticRenderFns = [];
6888
+
6889
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
6890
+ var es_array_push = __webpack_require__(4114);
6891
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.filter.js
6892
+ var es_iterator_filter = __webpack_require__(2489);
6893
+ // EXTERNAL MODULE: ./node_modules/vue-virtual-scroll-list/dist/index.js
6894
+ var dist = __webpack_require__(8054);
6895
+ var dist_default = /*#__PURE__*/__webpack_require__.n(dist);
6896
+ ;// ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/elementConfig/ui-virtual-select/itemComponent.vue?vue&type=template&id=68d8f45e&scoped=true
6897
+ var itemComponentvue_type_template_id_68d8f45e_scoped_true_render = function render() {
6898
+ var _vm = this,
6899
+ _c = _vm._self._c;
6900
+ return _c('div', {
6901
+ staticClass: "item",
6902
+ on: {
6903
+ "click": _vm.handleItemClick
6904
+ }
6905
+ }, [_c('el-option', {
6906
+ attrs: {
6907
+ "label": _vm.source[_vm.label],
6908
+ "value": _vm.source[_vm.value]
6909
+ }
6910
+ }, [_c('span', {
6911
+ staticClass: "left-text"
6912
+ }, [_vm._v(_vm._s(_vm.source[_vm.label]))]), _vm.rightLabel ? _c('span', {
6913
+ staticClass: "right-text"
6914
+ }, [_vm._v(_vm._s(_vm.source[_vm.rightLabel]))]) : _vm._e()])], 1);
6915
+ };
6916
+ var itemComponentvue_type_template_id_68d8f45e_scoped_true_staticRenderFns = [];
6917
+
6918
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/elementConfig/ui-virtual-select/itemComponent.vue?vue&type=script&lang=js
6919
+ /* harmony default export */ var itemComponentvue_type_script_lang_js = ({
6920
+ props: {
6921
+ source: {
6922
+ type: Object,
6923
+ default: () => ({})
6924
+ },
6925
+ label: {
6926
+ type: String,
6927
+ required: true
6928
+ },
6929
+ value: {
6930
+ type: String,
6931
+ required: true
6932
+ },
6933
+ rightLabel: {
6934
+ type: String,
6935
+ default: ''
6936
+ }
6937
+ },
6938
+ methods: {
6939
+ // 核心:点击选项时,向上传递选中值
6940
+ handleItemClick() {
6941
+ const selectedValue = this.source[this.value];
6942
+ // 触发自定义事件,将选中值传递给父组件
6943
+ this.$emit('item-click', selectedValue);
6944
+ }
6945
+ }
6946
+ });
6947
+ ;// ./src/elementConfig/ui-virtual-select/itemComponent.vue?vue&type=script&lang=js
6948
+ /* harmony default export */ var ui_virtual_select_itemComponentvue_type_script_lang_js = (itemComponentvue_type_script_lang_js);
6949
+ ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/elementConfig/ui-virtual-select/itemComponent.vue?vue&type=style&index=0&id=68d8f45e&prod&scoped=true&lang=css
6950
+ // extracted by mini-css-extract-plugin
6951
+
6952
+ ;// ./src/elementConfig/ui-virtual-select/itemComponent.vue?vue&type=style&index=0&id=68d8f45e&prod&scoped=true&lang=css
6953
+
6954
+ ;// ./src/elementConfig/ui-virtual-select/itemComponent.vue
6955
+
6956
+
6957
+
6958
+ ;
6959
+
6960
+
6961
+ /* normalize component */
6962
+
6963
+ var itemComponent_component = normalizeComponent(
6964
+ ui_virtual_select_itemComponentvue_type_script_lang_js,
6965
+ itemComponentvue_type_template_id_68d8f45e_scoped_true_render,
6966
+ itemComponentvue_type_template_id_68d8f45e_scoped_true_staticRenderFns,
6967
+ false,
6968
+ null,
6969
+ "68d8f45e",
6970
+ null
6971
+
6972
+ )
6973
+
6974
+ /* harmony default export */ var itemComponent = (itemComponent_component.exports);
6975
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/elementConfig/ui-virtual-select/index.vue?vue&type=script&lang=js
6976
+
6977
+
6978
+
6979
+
6980
+
6981
+
6982
+ /* harmony default export */ var ui_virtual_selectvue_type_script_lang_js = ({
6983
+ name: 'UiVirtualSelect',
6984
+ components: {
6985
+ VueVirtualScrollList: (dist_default())
6986
+ },
6987
+ props: {
6988
+ options: {
6989
+ type: Array,
6990
+ default: () => []
6991
+ },
6992
+ fields: {
6993
+ type: Object,
6994
+ default: () => ({
6995
+ label: 'label',
6996
+ value: 'value'
6997
+ })
6998
+ },
6999
+ value: {
7000
+ type: [String, Array],
7001
+ default: () => []
7002
+ } // 接收父组件v-model传递的值
7003
+ },
7004
+ data() {
7005
+ return {
7006
+ filteredData: [...this.options],
7007
+ maxItemWidth: 0,
7008
+ itemComponent: itemComponent,
7009
+ innerValue: [...this.value] // 内部维护选中值,避免直接修改props
7010
+ };
7011
+ },
7012
+ watch: {
7013
+ // 监听父组件v-model值变化,同步更新内部选中值
7014
+ value: {
7015
+ deep: true,
7016
+ immediate: true,
7017
+ handler(newVal) {
7018
+ this.innerValue = Array.isArray(newVal) ? [...newVal] : newVal;
7019
+ }
7020
+ },
7021
+ options: {
7022
+ deep: true,
7023
+ handler() {
7024
+ this.filteredData = [...this.options];
7025
+ this.calcMaxItemWidth();
7026
+ }
7027
+ }
7028
+ },
7029
+ mounted() {
7030
+ this.calcMaxItemWidth();
7031
+ },
7032
+ methods: {
7033
+ calcMaxItemWidth() {
7034
+ if (!this.options.length) return;
7035
+ const temp = document.createElement('div');
7036
+ temp.style.cssText = `
7037
+ position: absolute;
7038
+ top: -9999px;
7039
+ left: -9999px;
7040
+ white-space: nowrap;
7041
+ padding: 0 20px;
7042
+ font-size: 14px;
7043
+ box-sizing: border-box;
7044
+ `;
7045
+ document.body.appendChild(temp);
7046
+ let maxWidth = 0;
7047
+ this.options.forEach(item => {
7048
+ const label = item[this.fields.label] || '';
7049
+ const rightLabel = item[this.fields.rightLabel] || '';
7050
+ temp.innerHTML = `<span>${label}</span><span style="margin-left:10px;color:#939393">${rightLabel}</span>`;
7051
+ maxWidth = Math.max(maxWidth, temp.offsetWidth);
7052
+ });
7053
+ this.maxItemWidth = maxWidth + 6;
7054
+ document.body.removeChild(temp);
7055
+ this.setPopperWidth();
7056
+ },
7057
+ setPopperWidth() {
7058
+ const popper = document.querySelector('.virtual-select-popper');
7059
+ if (popper) {
7060
+ popper.style.width = `${this.maxItemWidth}px`;
7061
+ popper.style.minWidth = 'unset';
7062
+ popper.style.maxWidth = 'unset';
7063
+ }
7064
+ },
7065
+ filterMethod(query) {
7066
+ this.filteredData = query ? this.options.filter(item => {
7067
+ const labelMatch = item[this.fields.label].toLowerCase().includes(query.toLowerCase());
7068
+ const rightLabelMatch = this.fields.rightLabel ? item[this.fields.rightLabel].toLowerCase().includes(query.toLowerCase()) : false;
7069
+ return labelMatch || rightLabelMatch;
7070
+ }) : [...this.options];
7071
+ this.$nextTick(() => this.$refs.virtualList?.scrollToIndex(0));
7072
+ },
7073
+ handleVisibleChange(visible) {
7074
+ if (visible) {
7075
+ this.$nextTick(() => {
7076
+ this.setPopperWidth();
7077
+ });
7078
+ } else {
7079
+ this.$refs.virtualList?.reset();
7080
+ }
7081
+ },
7082
+ // 核心:接收子组件选中值,更新内部状态并通知el-select
7083
+ handleItemClick(selectedValue) {
7084
+ const isMultiple = this.$attrs.multiple; // 判断是否为多选模式
7085
+
7086
+ if (isMultiple) {
7087
+ // 多选:切换选中状态(存在则移除,不存在则添加)
7088
+ const valueIndex = this.innerValue.findIndex(val => val === selectedValue);
7089
+ if (valueIndex > -1) {
7090
+ this.innerValue.splice(valueIndex, 1);
7091
+ } else {
7092
+ this.innerValue.push(selectedValue);
7093
+ }
7094
+ } else {
7095
+ // 单选:直接赋值,并关闭下拉面板
7096
+ this.innerValue = selectedValue;
7097
+ this.$refs.elSelectRef.visible = false; // 手动关闭下拉
7098
+ }
7099
+
7100
+ // 手动触发el-select的change事件,同步更新状态
7101
+ this.$refs.elSelectRef.$emit('change', isMultiple ? [...this.innerValue] : this.innerValue);
7102
+ },
7103
+ // 监听el-select原生change事件,向父组件传递更新后的值(支持v-model)
7104
+ handleSelectChange(val) {
7105
+ this.$emit('input', val); // v-model的核心:触发input事件更新绑定值
7106
+ this.$emit('change', val); // 保留原有change事件,兼容手动监听
7107
+ }
7108
+ }
7109
+ });
7110
+ ;// ./src/elementConfig/ui-virtual-select/index.vue?vue&type=script&lang=js
7111
+ /* harmony default export */ var elementConfig_ui_virtual_selectvue_type_script_lang_js = (ui_virtual_selectvue_type_script_lang_js);
7112
+ ;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/elementConfig/ui-virtual-select/index.vue?vue&type=style&index=0&id=4776e956&prod&scoped=true&lang=css
7113
+ // extracted by mini-css-extract-plugin
7114
+
7115
+ ;// ./src/elementConfig/ui-virtual-select/index.vue?vue&type=style&index=0&id=4776e956&prod&scoped=true&lang=css
7116
+
7117
+ ;// ./src/elementConfig/ui-virtual-select/index.vue
7118
+
7119
+
7120
+
7121
+ ;
7122
+
7123
+
7124
+ /* normalize component */
7125
+
7126
+ var ui_virtual_select_component = normalizeComponent(
7127
+ elementConfig_ui_virtual_selectvue_type_script_lang_js,
7128
+ ui_virtual_selectvue_type_template_id_4776e956_scoped_true_render,
7129
+ ui_virtual_selectvue_type_template_id_4776e956_scoped_true_staticRenderFns,
7130
+ false,
7131
+ null,
7132
+ "4776e956",
7133
+ null
7134
+
7135
+ )
7136
+
7137
+ /* harmony default export */ var ui_virtual_select = (ui_virtual_select_component.exports);
5423
7138
  ;// ./src/elementConfig/index.js
5424
7139
 
5425
7140
 
5426
7141
 
5427
7142
 
5428
7143
 
5429
- const components = [ui_form, ui_table, ui_btns, business_status, ui_dialog];
7144
+
7145
+ const components = [ui_form, ui_table, ui_btns, business_status, ui_dialog, ui_virtual_select];
5430
7146
  const install = function (Vue) {
5431
7147
  components.forEach(component => {
5432
7148
  Vue.component(component.name, component);