@visactor/vrender-components 0.17.0-alpha.1 → 0.17.0-alpha.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/cjs/axis/circle.d.ts +2 -1
- package/cjs/axis/circle.js +2 -2
- package/cjs/axis/circle.js.map +1 -1
- package/cjs/axis/grid/base.js +2 -2
- package/cjs/axis/grid/base.js.map +1 -1
- package/cjs/axis/grid/circle.d.ts +2 -1
- package/cjs/axis/grid/circle.js +2 -2
- package/cjs/axis/grid/circle.js.map +1 -1
- package/cjs/axis/grid/line.d.ts +2 -1
- package/cjs/axis/grid/line.js +2 -3
- package/cjs/axis/grid/line.js.map +1 -1
- package/cjs/axis/line.d.ts +2 -1
- package/cjs/axis/line.js +2 -2
- package/cjs/axis/line.js.map +1 -1
- package/cjs/brush/brush.d.ts +2 -1
- package/cjs/brush/brush.js +3 -3
- package/cjs/brush/brush.js.map +1 -1
- package/cjs/checkbox/checkbox.d.ts +2 -1
- package/cjs/checkbox/checkbox.js +3 -3
- package/cjs/checkbox/checkbox.js.map +1 -1
- package/cjs/core/base.d.ts +4 -2
- package/cjs/core/base.js +4 -2
- package/cjs/core/base.js.map +1 -1
- package/cjs/crosshair/circle.d.ts +2 -1
- package/cjs/crosshair/circle.js +2 -2
- package/cjs/crosshair/circle.js.map +1 -1
- package/cjs/crosshair/line.d.ts +2 -1
- package/cjs/crosshair/line.js +2 -2
- package/cjs/crosshair/line.js.map +1 -1
- package/cjs/crosshair/polygon.d.ts +2 -1
- package/cjs/crosshair/polygon.js +2 -2
- package/cjs/crosshair/polygon.js.map +1 -1
- package/cjs/crosshair/rect.d.ts +2 -1
- package/cjs/crosshair/rect.js +2 -2
- package/cjs/crosshair/rect.js.map +1 -1
- package/cjs/crosshair/sector.d.ts +2 -1
- package/cjs/crosshair/sector.js +2 -2
- package/cjs/crosshair/sector.js.map +1 -1
- package/cjs/data-zoom/config.d.ts +6 -0
- package/cjs/data-zoom/config.js +7 -1
- package/cjs/data-zoom/config.js.map +1 -1
- package/cjs/data-zoom/data-zoom.d.ts +4 -4
- package/cjs/data-zoom/data-zoom.js +18 -22
- package/cjs/data-zoom/data-zoom.js.map +1 -1
- package/cjs/data-zoom/type.d.ts +0 -6
- package/cjs/data-zoom/type.js +1 -6
- package/cjs/data-zoom/type.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/interface.d.ts +4 -0
- package/cjs/interface.js.map +1 -1
- package/cjs/label/arc.d.ts +2 -1
- package/cjs/label/arc.js +3 -3
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/base.d.ts +2 -1
- package/cjs/label/base.js +3 -3
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/dataLabel.d.ts +2 -1
- package/cjs/label/dataLabel.js +3 -2
- package/cjs/label/dataLabel.js.map +1 -1
- package/cjs/label/line-data.d.ts +2 -1
- package/cjs/label/line-data.js +3 -2
- package/cjs/label/line-data.js.map +1 -1
- package/cjs/label/line.d.ts +2 -1
- package/cjs/label/line.js +3 -2
- package/cjs/label/line.js.map +1 -1
- package/cjs/label/polygon.d.ts +2 -1
- package/cjs/label/polygon.js +3 -2
- package/cjs/label/polygon.js.map +1 -1
- package/cjs/label/rect.d.ts +2 -1
- package/cjs/label/rect.js +2 -2
- package/cjs/label/rect.js.map +1 -1
- package/cjs/label/symbol.d.ts +2 -1
- package/cjs/label/symbol.js +3 -2
- package/cjs/label/symbol.js.map +1 -1
- package/cjs/legend/color/color.d.ts +2 -1
- package/cjs/legend/color/color.js +2 -2
- package/cjs/legend/color/color.js.map +1 -1
- package/cjs/legend/discrete/discrete.d.ts +2 -1
- package/cjs/legend/discrete/discrete.js +4 -4
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/cjs/legend/size/size.d.ts +2 -2
- package/cjs/legend/size/size.js +2 -2
- package/cjs/legend/size/size.js.map +1 -1
- package/cjs/link-path/link-path.d.ts +2 -1
- package/cjs/link-path/link-path.js +2 -2
- package/cjs/link-path/link-path.js.map +1 -1
- package/cjs/marker/area.d.ts +2 -1
- package/cjs/marker/area.js +3 -2
- package/cjs/marker/area.js.map +1 -1
- package/cjs/marker/line.d.ts +2 -1
- package/cjs/marker/line.js +3 -2
- package/cjs/marker/line.js.map +1 -1
- package/cjs/marker/point.d.ts +2 -1
- package/cjs/marker/point.js +3 -2
- package/cjs/marker/point.js.map +1 -1
- package/cjs/pager/pager.d.ts +2 -1
- package/cjs/pager/pager.js +3 -3
- package/cjs/pager/pager.js.map +1 -1
- package/cjs/player/base-player.d.ts +2 -1
- package/cjs/player/base-player.js +3 -3
- package/cjs/player/base-player.js.map +1 -1
- package/cjs/player/controller/controller.d.ts +2 -1
- package/cjs/player/controller/controller.js +3 -3
- package/cjs/player/controller/controller.js.map +1 -1
- package/cjs/player/discrete-player.d.ts +2 -1
- package/cjs/player/discrete-player.js +3 -3
- package/cjs/player/discrete-player.js.map +1 -1
- package/cjs/poptip/poptip.d.ts +2 -1
- package/cjs/poptip/poptip.js +3 -3
- package/cjs/poptip/poptip.js.map +1 -1
- package/cjs/scrollbar/scrollbar.d.ts +2 -1
- package/cjs/scrollbar/scrollbar.js +3 -3
- package/cjs/scrollbar/scrollbar.js.map +1 -1
- package/cjs/segment/segment.d.ts +2 -1
- package/cjs/segment/segment.js +3 -2
- package/cjs/segment/segment.js.map +1 -1
- package/cjs/slider/slider.d.ts +2 -1
- package/cjs/slider/slider.js +5 -5
- package/cjs/slider/slider.js.map +1 -1
- package/cjs/tag/tag.d.ts +2 -1
- package/cjs/tag/tag.js +3 -2
- package/cjs/tag/tag.js.map +1 -1
- package/cjs/title/title.d.ts +2 -1
- package/cjs/title/title.js +3 -2
- package/cjs/title/title.js.map +1 -1
- package/cjs/tooltip/tooltip.d.ts +2 -1
- package/cjs/tooltip/tooltip.js +4 -3
- package/cjs/tooltip/tooltip.js.map +1 -1
- package/dist/index.js +1095 -2178
- package/dist/index.min.js +1 -1
- package/es/axis/circle.d.ts +2 -1
- package/es/axis/circle.js +2 -2
- package/es/axis/circle.js.map +1 -1
- package/es/axis/grid/base.js +2 -2
- package/es/axis/grid/base.js.map +1 -1
- package/es/axis/grid/circle.d.ts +2 -1
- package/es/axis/grid/circle.js +2 -2
- package/es/axis/grid/circle.js.map +1 -1
- package/es/axis/grid/line.d.ts +2 -1
- package/es/axis/grid/line.js +2 -2
- package/es/axis/grid/line.js.map +1 -1
- package/es/axis/line.d.ts +2 -1
- package/es/axis/line.js +2 -2
- package/es/axis/line.js.map +1 -1
- package/es/brush/brush.d.ts +2 -1
- package/es/brush/brush.js +6 -6
- package/es/brush/brush.js.map +1 -1
- package/es/checkbox/checkbox.d.ts +2 -1
- package/es/checkbox/checkbox.js +3 -2
- package/es/checkbox/checkbox.js.map +1 -1
- package/es/core/base.d.ts +4 -2
- package/es/core/base.js +4 -2
- package/es/core/base.js.map +1 -1
- package/es/crosshair/circle.d.ts +2 -1
- package/es/crosshair/circle.js +2 -2
- package/es/crosshair/circle.js.map +1 -1
- package/es/crosshair/line.d.ts +2 -1
- package/es/crosshair/line.js +2 -2
- package/es/crosshair/line.js.map +1 -1
- package/es/crosshair/polygon.d.ts +2 -1
- package/es/crosshair/polygon.js +2 -2
- package/es/crosshair/polygon.js.map +1 -1
- package/es/crosshair/rect.d.ts +2 -1
- package/es/crosshair/rect.js +2 -2
- package/es/crosshair/rect.js.map +1 -1
- package/es/crosshair/sector.d.ts +2 -1
- package/es/crosshair/sector.js +2 -2
- package/es/crosshair/sector.js.map +1 -1
- package/es/data-zoom/config.d.ts +6 -0
- package/es/data-zoom/config.js +7 -0
- package/es/data-zoom/config.js.map +1 -1
- package/es/data-zoom/data-zoom.d.ts +4 -4
- package/es/data-zoom/data-zoom.js +7 -13
- package/es/data-zoom/data-zoom.js.map +1 -1
- package/es/data-zoom/type.d.ts +0 -6
- package/es/data-zoom/type.js +1 -6
- package/es/data-zoom/type.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/interface.d.ts +4 -0
- package/es/interface.js.map +1 -1
- package/es/label/arc.d.ts +2 -1
- package/es/label/arc.js +3 -3
- package/es/label/arc.js.map +1 -1
- package/es/label/base.d.ts +2 -1
- package/es/label/base.js +3 -3
- package/es/label/base.js.map +1 -1
- package/es/label/dataLabel.d.ts +2 -1
- package/es/label/dataLabel.js +3 -2
- package/es/label/dataLabel.js.map +1 -1
- package/es/label/line-data.d.ts +2 -1
- package/es/label/line-data.js +3 -2
- package/es/label/line-data.js.map +1 -1
- package/es/label/line.d.ts +2 -1
- package/es/label/line.js +3 -2
- package/es/label/line.js.map +1 -1
- package/es/label/polygon.d.ts +2 -1
- package/es/label/polygon.js +3 -2
- package/es/label/polygon.js.map +1 -1
- package/es/label/rect.d.ts +2 -1
- package/es/label/rect.js +2 -2
- package/es/label/rect.js.map +1 -1
- package/es/label/symbol.d.ts +2 -1
- package/es/label/symbol.js +3 -2
- package/es/label/symbol.js.map +1 -1
- package/es/legend/color/color.d.ts +2 -1
- package/es/legend/color/color.js +3 -3
- package/es/legend/color/color.js.map +1 -1
- package/es/legend/discrete/discrete.d.ts +2 -1
- package/es/legend/discrete/discrete.js +4 -4
- package/es/legend/discrete/discrete.js.map +1 -1
- package/es/legend/size/size.d.ts +2 -2
- package/es/legend/size/size.js +3 -3
- package/es/legend/size/size.js.map +1 -1
- package/es/link-path/link-path.d.ts +2 -1
- package/es/link-path/link-path.js +2 -2
- package/es/link-path/link-path.js.map +1 -1
- package/es/marker/area.d.ts +2 -1
- package/es/marker/area.js +3 -2
- package/es/marker/area.js.map +1 -1
- package/es/marker/line.d.ts +2 -1
- package/es/marker/line.js +3 -2
- package/es/marker/line.js.map +1 -1
- package/es/marker/point.d.ts +2 -1
- package/es/marker/point.js +3 -2
- package/es/marker/point.js.map +1 -1
- package/es/pager/pager.d.ts +2 -1
- package/es/pager/pager.js +3 -3
- package/es/pager/pager.js.map +1 -1
- package/es/player/base-player.d.ts +2 -1
- package/es/player/base-player.js +3 -3
- package/es/player/base-player.js.map +1 -1
- package/es/player/controller/controller.d.ts +2 -1
- package/es/player/controller/controller.js +3 -3
- package/es/player/controller/controller.js.map +1 -1
- package/es/player/discrete-player.d.ts +2 -1
- package/es/player/discrete-player.js +3 -2
- package/es/player/discrete-player.js.map +1 -1
- package/es/poptip/poptip.d.ts +2 -1
- package/es/poptip/poptip.js +3 -2
- package/es/poptip/poptip.js.map +1 -1
- package/es/scrollbar/scrollbar.d.ts +2 -1
- package/es/scrollbar/scrollbar.js +3 -3
- package/es/scrollbar/scrollbar.js.map +1 -1
- package/es/segment/segment.d.ts +2 -1
- package/es/segment/segment.js +3 -2
- package/es/segment/segment.js.map +1 -1
- package/es/slider/slider.d.ts +2 -1
- package/es/slider/slider.js +5 -5
- package/es/slider/slider.js.map +1 -1
- package/es/tag/tag.d.ts +2 -1
- package/es/tag/tag.js +3 -2
- package/es/tag/tag.js.map +1 -1
- package/es/title/title.d.ts +2 -1
- package/es/title/title.js +3 -2
- package/es/title/title.js.map +1 -1
- package/es/tooltip/tooltip.d.ts +2 -1
- package/es/tooltip/tooltip.js +5 -4
- package/es/tooltip/tooltip.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -517,57 +517,6 @@
|
|
|
517
517
|
function _nonIterableRest() {
|
|
518
518
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
519
519
|
}
|
|
520
|
-
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
521
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
522
|
-
if (!it) {
|
|
523
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
524
|
-
if (it) o = it;
|
|
525
|
-
var i = 0;
|
|
526
|
-
var F = function () {};
|
|
527
|
-
return {
|
|
528
|
-
s: F,
|
|
529
|
-
n: function () {
|
|
530
|
-
if (i >= o.length) return {
|
|
531
|
-
done: true
|
|
532
|
-
};
|
|
533
|
-
return {
|
|
534
|
-
done: false,
|
|
535
|
-
value: o[i++]
|
|
536
|
-
};
|
|
537
|
-
},
|
|
538
|
-
e: function (e) {
|
|
539
|
-
throw e;
|
|
540
|
-
},
|
|
541
|
-
f: F
|
|
542
|
-
};
|
|
543
|
-
}
|
|
544
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
545
|
-
}
|
|
546
|
-
var normalCompletion = true,
|
|
547
|
-
didErr = false,
|
|
548
|
-
err;
|
|
549
|
-
return {
|
|
550
|
-
s: function () {
|
|
551
|
-
it = it.call(o);
|
|
552
|
-
},
|
|
553
|
-
n: function () {
|
|
554
|
-
var step = it.next();
|
|
555
|
-
normalCompletion = step.done;
|
|
556
|
-
return step;
|
|
557
|
-
},
|
|
558
|
-
e: function (e) {
|
|
559
|
-
didErr = true;
|
|
560
|
-
err = e;
|
|
561
|
-
},
|
|
562
|
-
f: function () {
|
|
563
|
-
try {
|
|
564
|
-
if (!normalCompletion && it.return != null) it.return();
|
|
565
|
-
} finally {
|
|
566
|
-
if (didErr) throw err;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
};
|
|
570
|
-
}
|
|
571
520
|
function _toPrimitive(input, hint) {
|
|
572
521
|
if (typeof input !== "object" || input === null) return input;
|
|
573
522
|
var prim = input[Symbol.toPrimitive];
|
|
@@ -583,64 +532,30 @@
|
|
|
583
532
|
return typeof key === "symbol" ? key : String(key);
|
|
584
533
|
}
|
|
585
534
|
|
|
586
|
-
var
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
535
|
+
var Generator = /*#__PURE__*/function () {
|
|
536
|
+
function Generator() {
|
|
537
|
+
_classCallCheck(this, Generator);
|
|
538
|
+
}
|
|
539
|
+
_createClass(Generator, null, [{
|
|
540
|
+
key: "GenAutoIncrementId",
|
|
541
|
+
value: function GenAutoIncrementId() {
|
|
542
|
+
return Generator.auto_increment_id++;
|
|
543
|
+
}
|
|
544
|
+
}]);
|
|
545
|
+
return Generator;
|
|
546
|
+
}();
|
|
547
|
+
Generator.auto_increment_id = 0;
|
|
590
548
|
|
|
591
549
|
var ContainerModule = /*#__PURE__*/_createClass(function ContainerModule(registry) {
|
|
592
550
|
_classCallCheck(this, ContainerModule);
|
|
593
|
-
this.id =
|
|
551
|
+
this.id = Generator.GenAutoIncrementId(), this.registry = registry;
|
|
594
552
|
});
|
|
595
553
|
|
|
596
554
|
var NAMED_TAG = "named";
|
|
597
|
-
var NAME_TAG = "name";
|
|
598
|
-
var UNMANAGED_TAG = "unmanaged";
|
|
599
|
-
var OPTIONAL_TAG = "optional";
|
|
600
555
|
var INJECT_TAG = "inject";
|
|
601
556
|
var MULTI_INJECT_TAG = "multi_inject";
|
|
602
557
|
var TAGGED = "inversify:tagged";
|
|
603
|
-
var TAGGED_PROP = "inversify:tagged_props";
|
|
604
558
|
var PARAM_TYPES = "inversify:paramtypes";
|
|
605
|
-
var DESIGN_PARAM_TYPES = "design:paramtypes";
|
|
606
|
-
var POST_CONSTRUCT = "post_construct";
|
|
607
|
-
var PRE_DESTROY = "pre_destroy";
|
|
608
|
-
function getNonCustomTagKeys() {
|
|
609
|
-
return ["inject", "multi_inject", "name", "unmanaged", "named", "optional"];
|
|
610
|
-
}
|
|
611
|
-
var NON_CUSTOM_TAG_KEYS = getNonCustomTagKeys();
|
|
612
|
-
|
|
613
|
-
var DUPLICATED_INJECTABLE_DECORATOR = "Cannot apply @injectable decorator multiple times.";
|
|
614
|
-
var DUPLICATED_METADATA = "Metadata key was used more than once in a parameter:";
|
|
615
|
-
var NULL_ARGUMENT = "NULL argument";
|
|
616
|
-
var KEY_NOT_FOUND = "Key Not Found";
|
|
617
|
-
var AMBIGUOUS_MATCH = "Ambiguous match found for serviceIdentifier:";
|
|
618
|
-
var CANNOT_UNBIND = "Could not unbind serviceIdentifier:";
|
|
619
|
-
var NOT_REGISTERED = "No matching bindings found for serviceIdentifier:";
|
|
620
|
-
var MISSING_INJECTABLE_ANNOTATION = "Missing required @injectable annotation in:";
|
|
621
|
-
var MISSING_INJECT_ANNOTATION = "Missing required @inject or @multiInject annotation in:";
|
|
622
|
-
var UNDEFINED_INJECT_ANNOTATION = function UNDEFINED_INJECT_ANNOTATION(name) {
|
|
623
|
-
return "@inject called with undefined this could mean that the class ".concat(name, " has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation.");
|
|
624
|
-
};
|
|
625
|
-
var INVALID_BINDING_TYPE = "Invalid binding type:";
|
|
626
|
-
var INVALID_FUNCTION_BINDING = "Value provided to function binding must be a function!";
|
|
627
|
-
var INVALID_TO_SELF_VALUE = "The toSelf function can only be applied when a constructor is used as service identifier";
|
|
628
|
-
var INVALID_DECORATOR_OPERATION = "The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.";
|
|
629
|
-
var ARGUMENTS_LENGTH_MISMATCH = function ARGUMENTS_LENGTH_MISMATCH() {
|
|
630
|
-
return "The number of constructor arguments in the derived class ".concat(arguments.length <= 0 ? undefined : arguments[0], " must be >= than the number of constructor arguments of its base class.");
|
|
631
|
-
};
|
|
632
|
-
var CONTAINER_OPTIONS_MUST_BE_AN_OBJECT = "Invalid Container constructor argument. Container options must be an object.";
|
|
633
|
-
var CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE = 'Invalid Container option. Default scope must be a string ("singleton" or "transient").';
|
|
634
|
-
var CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE = "Invalid Container option. Auto bind injectable must be a boolean";
|
|
635
|
-
var CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK = "Invalid Container option. Skip base check must be a boolean";
|
|
636
|
-
var MULTIPLE_POST_CONSTRUCT_METHODS = "Cannot apply @postConstruct decorator multiple times in the same class";
|
|
637
|
-
var ASYNC_UNBIND_REQUIRED = "Attempting to unbind dependency with asynchronous destruction (@preDestroy or onDeactivation)";
|
|
638
|
-
var PRE_DESTROY_ERROR = function PRE_DESTROY_ERROR(clazz, errorMessage) {
|
|
639
|
-
return "@preDestroy error in class ".concat(clazz, ": ").concat(errorMessage);
|
|
640
|
-
};
|
|
641
|
-
var ON_DEACTIVATION_ERROR = function ON_DEACTIVATION_ERROR(clazz, errorMessage) {
|
|
642
|
-
return "onDeactivation() error in class ".concat(clazz, ": ").concat(errorMessage);
|
|
643
|
-
};
|
|
644
559
|
|
|
645
560
|
var Metadata = /*#__PURE__*/function () {
|
|
646
561
|
function Metadata(key, value) {
|
|
@@ -656,474 +571,405 @@
|
|
|
656
571
|
return Metadata;
|
|
657
572
|
}();
|
|
658
573
|
|
|
659
|
-
function
|
|
660
|
-
var
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
var exporter = makeExporter(Reflect);
|
|
681
|
-
function makeExporter(target, previous) {
|
|
682
|
-
return function (key, value) {
|
|
683
|
-
"function" != typeof target[key] && Object.defineProperty(target, key, {
|
|
684
|
-
configurable: !0,
|
|
685
|
-
writable: !0,
|
|
686
|
-
value: value
|
|
687
|
-
}), previous && previous(key, value);
|
|
688
|
-
};
|
|
689
|
-
}
|
|
690
|
-
void 0 === root.Reflect ? root.Reflect = Reflect : exporter = makeExporter(root.Reflect, exporter), function (exporter) {
|
|
691
|
-
var hasOwn = Object.prototype.hasOwnProperty,
|
|
692
|
-
supportsSymbol = "function" == typeof Symbol,
|
|
693
|
-
toPrimitiveSymbol = supportsSymbol && void 0 !== Symbol.toPrimitive ? Symbol.toPrimitive : "@@toPrimitive",
|
|
694
|
-
iteratorSymbol = supportsSymbol && void 0 !== Symbol.iterator ? Symbol.iterator : "@@iterator",
|
|
695
|
-
supportsCreate = "function" == typeof Object.create,
|
|
696
|
-
supportsProto = {
|
|
697
|
-
__proto__: []
|
|
698
|
-
} instanceof Array,
|
|
699
|
-
downLevel = !supportsCreate && !supportsProto,
|
|
700
|
-
HashMap = {
|
|
701
|
-
create: supportsCreate ? function () {
|
|
702
|
-
return MakeDictionary(Object.create(null));
|
|
703
|
-
} : supportsProto ? function () {
|
|
704
|
-
return MakeDictionary({
|
|
705
|
-
__proto__: null
|
|
706
|
-
});
|
|
707
|
-
} : function () {
|
|
708
|
-
return MakeDictionary({});
|
|
709
|
-
},
|
|
710
|
-
has: downLevel ? function (map, key) {
|
|
711
|
-
return hasOwn.call(map, key);
|
|
712
|
-
} : function (map, key) {
|
|
713
|
-
return key in map;
|
|
714
|
-
},
|
|
715
|
-
get: downLevel ? function (map, key) {
|
|
716
|
-
return hasOwn.call(map, key) ? map[key] : void 0;
|
|
717
|
-
} : function (map, key) {
|
|
718
|
-
return map[key];
|
|
719
|
-
}
|
|
574
|
+
var Reflect$1 = (function (Reflect) {
|
|
575
|
+
var target;
|
|
576
|
+
return function (exporter) {
|
|
577
|
+
var hasOwn = Object.prototype.hasOwnProperty,
|
|
578
|
+
supportsSymbol = "function" == typeof Symbol,
|
|
579
|
+
toPrimitiveSymbol = supportsSymbol && void 0 !== Symbol.toPrimitive ? Symbol.toPrimitive : "@@toPrimitive",
|
|
580
|
+
iteratorSymbol = supportsSymbol && void 0 !== Symbol.iterator ? Symbol.iterator : "@@iterator",
|
|
581
|
+
supportsCreate = "function" == typeof Object.create,
|
|
582
|
+
supportsProto = {
|
|
583
|
+
__proto__: []
|
|
584
|
+
} instanceof Array,
|
|
585
|
+
downLevel = !supportsCreate && !supportsProto,
|
|
586
|
+
HashMap = {
|
|
587
|
+
create: supportsCreate ? function () {
|
|
588
|
+
return MakeDictionary(Object.create(null));
|
|
589
|
+
} : supportsProto ? function () {
|
|
590
|
+
return MakeDictionary({
|
|
591
|
+
__proto__: null
|
|
592
|
+
});
|
|
593
|
+
} : function () {
|
|
594
|
+
return MakeDictionary({});
|
|
720
595
|
},
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
if (
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
596
|
+
has: downLevel ? function (map, key) {
|
|
597
|
+
return hasOwn.call(map, key);
|
|
598
|
+
} : function (map, key) {
|
|
599
|
+
return key in map;
|
|
600
|
+
},
|
|
601
|
+
get: downLevel ? function (map, key) {
|
|
602
|
+
return hasOwn.call(map, key) ? map[key] : void 0;
|
|
603
|
+
} : function (map, key) {
|
|
604
|
+
return map[key];
|
|
605
|
+
}
|
|
606
|
+
},
|
|
607
|
+
functionPrototype = Object.getPrototypeOf(Function),
|
|
608
|
+
usePolyfill = "object" == (typeof process === "undefined" ? "undefined" : _typeof(process)) && process.env && "true" === process.env.REFLECT_METADATA_USE_MAP_POLYFILL,
|
|
609
|
+
_Map = usePolyfill || "function" != typeof Map || "function" != typeof Map.prototype.entries ? CreateMapPolyfill() : Map,
|
|
610
|
+
Metadata = (usePolyfill || "function" != typeof Set || "function" != typeof Set.prototype.entries ? CreateSetPolyfill() : Set, new (usePolyfill || "function" != typeof WeakMap ? CreateWeakMapPolyfill() : WeakMap)());
|
|
611
|
+
function defineMetadata(metadataKey, metadataValue, target, propertyKey) {
|
|
612
|
+
if (!IsObject(target)) throw new TypeError();
|
|
613
|
+
return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
|
|
614
|
+
}
|
|
615
|
+
function hasMetadata(metadataKey, target, propertyKey) {
|
|
616
|
+
if (!IsObject(target)) throw new TypeError();
|
|
617
|
+
return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryHasMetadata(metadataKey, target, propertyKey);
|
|
618
|
+
}
|
|
619
|
+
function hasOwnMetadata(metadataKey, target, propertyKey) {
|
|
620
|
+
if (!IsObject(target)) throw new TypeError();
|
|
621
|
+
return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);
|
|
622
|
+
}
|
|
623
|
+
function getMetadata(metadataKey, target, propertyKey) {
|
|
624
|
+
if (!IsObject(target)) throw new TypeError();
|
|
625
|
+
return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryGetMetadata(metadataKey, target, propertyKey);
|
|
626
|
+
}
|
|
627
|
+
function GetOrCreateMetadataMap(O, P, Create) {
|
|
628
|
+
var targetMetadata = Metadata.get(O);
|
|
629
|
+
if (IsUndefined(targetMetadata)) {
|
|
630
|
+
if (!Create) return;
|
|
631
|
+
targetMetadata = new _Map(), Metadata.set(O, targetMetadata);
|
|
632
|
+
}
|
|
633
|
+
var metadataMap = targetMetadata.get(P);
|
|
634
|
+
if (IsUndefined(metadataMap)) {
|
|
635
|
+
if (!Create) return;
|
|
636
|
+
metadataMap = new _Map(), targetMetadata.set(P, metadataMap);
|
|
637
|
+
}
|
|
638
|
+
return metadataMap;
|
|
639
|
+
}
|
|
640
|
+
function OrdinaryHasMetadata(MetadataKey, O, P) {
|
|
641
|
+
if (OrdinaryHasOwnMetadata(MetadataKey, O, P)) return !0;
|
|
642
|
+
var parent = OrdinaryGetPrototypeOf(O);
|
|
643
|
+
return !IsNull(parent) && OrdinaryHasMetadata(MetadataKey, parent, P);
|
|
644
|
+
}
|
|
645
|
+
function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
|
|
646
|
+
var metadataMap = GetOrCreateMetadataMap(O, P, !1);
|
|
647
|
+
return !IsUndefined(metadataMap) && ToBoolean(metadataMap.has(MetadataKey));
|
|
648
|
+
}
|
|
649
|
+
function OrdinaryGetMetadata(MetadataKey, O, P) {
|
|
650
|
+
if (OrdinaryHasOwnMetadata(MetadataKey, O, P)) return OrdinaryGetOwnMetadata(MetadataKey, O, P);
|
|
651
|
+
var parent = OrdinaryGetPrototypeOf(O);
|
|
652
|
+
return IsNull(parent) ? void 0 : OrdinaryGetMetadata(MetadataKey, parent, P);
|
|
653
|
+
}
|
|
654
|
+
function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
|
|
655
|
+
var metadataMap = GetOrCreateMetadataMap(O, P, !1);
|
|
656
|
+
if (!IsUndefined(metadataMap)) return metadataMap.get(MetadataKey);
|
|
657
|
+
}
|
|
658
|
+
function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
|
|
659
|
+
GetOrCreateMetadataMap(O, P, !0).set(MetadataKey, MetadataValue);
|
|
660
|
+
}
|
|
661
|
+
function Type(x) {
|
|
662
|
+
if (null === x) return 1;
|
|
663
|
+
switch (_typeof(x)) {
|
|
664
|
+
case "undefined":
|
|
665
|
+
return 0;
|
|
666
|
+
case "boolean":
|
|
667
|
+
return 2;
|
|
668
|
+
case "string":
|
|
669
|
+
return 3;
|
|
670
|
+
case "symbol":
|
|
671
|
+
return 4;
|
|
672
|
+
case "number":
|
|
673
|
+
return 5;
|
|
674
|
+
case "object":
|
|
675
|
+
return null === x ? 1 : 6;
|
|
676
|
+
default:
|
|
677
|
+
return 6;
|
|
802
678
|
}
|
|
803
|
-
|
|
804
|
-
|
|
679
|
+
}
|
|
680
|
+
function IsUndefined(x) {
|
|
681
|
+
return void 0 === x;
|
|
682
|
+
}
|
|
683
|
+
function IsNull(x) {
|
|
684
|
+
return null === x;
|
|
685
|
+
}
|
|
686
|
+
function IsSymbol(x) {
|
|
687
|
+
return "symbol" == _typeof(x);
|
|
688
|
+
}
|
|
689
|
+
function IsObject(x) {
|
|
690
|
+
return "object" == _typeof(x) ? null !== x : "function" == typeof x;
|
|
691
|
+
}
|
|
692
|
+
function ToPrimitive(input, PreferredType) {
|
|
693
|
+
switch (Type(input)) {
|
|
694
|
+
case 0:
|
|
695
|
+
case 1:
|
|
696
|
+
case 2:
|
|
697
|
+
case 3:
|
|
698
|
+
case 4:
|
|
699
|
+
case 5:
|
|
700
|
+
return input;
|
|
805
701
|
}
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
case 4:
|
|
813
|
-
case 5:
|
|
814
|
-
return input;
|
|
815
|
-
}
|
|
816
|
-
var hint = 3 === PreferredType ? "string" : 5 === PreferredType ? "number" : "default",
|
|
817
|
-
exoticToPrim = GetMethod(input, toPrimitiveSymbol);
|
|
818
|
-
if (void 0 !== exoticToPrim) {
|
|
819
|
-
var result = exoticToPrim.call(input, hint);
|
|
820
|
-
if (IsObject(result)) throw new TypeError();
|
|
821
|
-
return result;
|
|
822
|
-
}
|
|
823
|
-
return OrdinaryToPrimitive(input, "default" === hint ? "number" : hint);
|
|
702
|
+
var hint = 3 === PreferredType ? "string" : 5 === PreferredType ? "number" : "default",
|
|
703
|
+
exoticToPrim = GetMethod(input, toPrimitiveSymbol);
|
|
704
|
+
if (void 0 !== exoticToPrim) {
|
|
705
|
+
var result = exoticToPrim.call(input, hint);
|
|
706
|
+
if (IsObject(result)) throw new TypeError();
|
|
707
|
+
return result;
|
|
824
708
|
}
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
if (IsCallable(_valueOf)) {
|
|
834
|
-
var _result = _valueOf.call(O);
|
|
835
|
-
if (!IsObject(_result)) return _result;
|
|
836
|
-
}
|
|
837
|
-
} else {
|
|
838
|
-
var _valueOf2 = O.valueOf;
|
|
839
|
-
if (IsCallable(_valueOf2)) {
|
|
840
|
-
var _result2 = _valueOf2.call(O);
|
|
841
|
-
if (!IsObject(_result2)) return _result2;
|
|
842
|
-
}
|
|
843
|
-
var toString_2 = O.toString;
|
|
844
|
-
if (IsCallable(toString_2)) {
|
|
845
|
-
var _result3 = toString_2.call(O);
|
|
846
|
-
if (!IsObject(_result3)) return _result3;
|
|
847
|
-
}
|
|
709
|
+
return OrdinaryToPrimitive(input, "default" === hint ? "number" : hint);
|
|
710
|
+
}
|
|
711
|
+
function OrdinaryToPrimitive(O, hint) {
|
|
712
|
+
if ("string" === hint) {
|
|
713
|
+
var toString_1 = O.toString;
|
|
714
|
+
if (IsCallable(toString_1)) {
|
|
715
|
+
var result = toString_1.call(O);
|
|
716
|
+
if (!IsObject(result)) return result;
|
|
848
717
|
}
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
}
|
|
854
|
-
function ToString(argument) {
|
|
855
|
-
return "" + argument;
|
|
856
|
-
}
|
|
857
|
-
function ToPropertyKey(argument) {
|
|
858
|
-
var key = ToPrimitive(argument, 3);
|
|
859
|
-
return IsSymbol(key) ? key : ToString(key);
|
|
860
|
-
}
|
|
861
|
-
function IsCallable(argument) {
|
|
862
|
-
return "function" == typeof argument;
|
|
863
|
-
}
|
|
864
|
-
function GetMethod(V, P) {
|
|
865
|
-
var func = V[P];
|
|
866
|
-
if (null != func) {
|
|
867
|
-
if (!IsCallable(func)) throw new TypeError();
|
|
868
|
-
return func;
|
|
718
|
+
var _valueOf = O.valueOf;
|
|
719
|
+
if (IsCallable(_valueOf)) {
|
|
720
|
+
var _result = _valueOf.call(O);
|
|
721
|
+
if (!IsObject(_result)) return _result;
|
|
869
722
|
}
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
if (
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
723
|
+
} else {
|
|
724
|
+
var _valueOf2 = O.valueOf;
|
|
725
|
+
if (IsCallable(_valueOf2)) {
|
|
726
|
+
var _result2 = _valueOf2.call(O);
|
|
727
|
+
if (!IsObject(_result2)) return _result2;
|
|
728
|
+
}
|
|
729
|
+
var toString_2 = O.toString;
|
|
730
|
+
if (IsCallable(toString_2)) {
|
|
731
|
+
var _result3 = toString_2.call(O);
|
|
732
|
+
if (!IsObject(_result3)) return _result3;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
throw new TypeError();
|
|
736
|
+
}
|
|
737
|
+
function ToBoolean(argument) {
|
|
738
|
+
return !!argument;
|
|
739
|
+
}
|
|
740
|
+
function ToString(argument) {
|
|
741
|
+
return "" + argument;
|
|
742
|
+
}
|
|
743
|
+
function ToPropertyKey(argument) {
|
|
744
|
+
var key = ToPrimitive(argument, 3);
|
|
745
|
+
return IsSymbol(key) ? key : ToString(key);
|
|
746
|
+
}
|
|
747
|
+
function IsCallable(argument) {
|
|
748
|
+
return "function" == typeof argument;
|
|
749
|
+
}
|
|
750
|
+
function GetMethod(V, P) {
|
|
751
|
+
var func = V[P];
|
|
752
|
+
if (null != func) {
|
|
753
|
+
if (!IsCallable(func)) throw new TypeError();
|
|
754
|
+
return func;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
function OrdinaryGetPrototypeOf(O) {
|
|
758
|
+
var proto = Object.getPrototypeOf(O);
|
|
759
|
+
if ("function" != typeof O || O === functionPrototype) return proto;
|
|
760
|
+
if (proto !== functionPrototype) return proto;
|
|
761
|
+
var prototype = O.prototype,
|
|
762
|
+
prototypeProto = prototype && Object.getPrototypeOf(prototype);
|
|
763
|
+
if (null == prototypeProto || prototypeProto === Object.prototype) return proto;
|
|
764
|
+
var constructor = prototypeProto.constructor;
|
|
765
|
+
return "function" != typeof constructor || constructor === O ? proto : constructor;
|
|
766
|
+
}
|
|
767
|
+
function CreateMapPolyfill() {
|
|
768
|
+
var cacheSentinel = {},
|
|
769
|
+
arraySentinel = [],
|
|
770
|
+
MapIterator = function () {
|
|
771
|
+
function MapIterator(keys, values, selector) {
|
|
772
|
+
this._index = 0, this._keys = keys, this._values = values, this._selector = selector;
|
|
917
773
|
}
|
|
918
|
-
return
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
return
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
},
|
|
943
|
-
return new MapIterator(this._keys, this._values, getKey);
|
|
944
|
-
}, Map.prototype.values = function () {
|
|
945
|
-
return new MapIterator(this._keys, this._values, getValue);
|
|
946
|
-
}, Map.prototype.entries = function () {
|
|
947
|
-
return new MapIterator(this._keys, this._values, getEntry);
|
|
948
|
-
}, Map.prototype["@@iterator"] = function () {
|
|
949
|
-
return this.entries();
|
|
950
|
-
}, Map.prototype[iteratorSymbol] = function () {
|
|
951
|
-
return this.entries();
|
|
952
|
-
}, Map.prototype._find = function (key, insert) {
|
|
953
|
-
return this._cacheKey !== key && (this._cacheIndex = this._keys.indexOf(this._cacheKey = key)), this._cacheIndex < 0 && insert && (this._cacheIndex = this._keys.length, this._keys.push(key), this._values.push(void 0)), this._cacheIndex;
|
|
954
|
-
}, Map;
|
|
774
|
+
return MapIterator.prototype["@@iterator"] = function () {
|
|
775
|
+
return this;
|
|
776
|
+
}, MapIterator.prototype[iteratorSymbol] = function () {
|
|
777
|
+
return this;
|
|
778
|
+
}, MapIterator.prototype.next = function () {
|
|
779
|
+
var index = this._index;
|
|
780
|
+
if (index >= 0 && index < this._keys.length) {
|
|
781
|
+
var result = this._selector(this._keys[index], this._values[index]);
|
|
782
|
+
return index + 1 >= this._keys.length ? (this._index = -1, this._keys = arraySentinel, this._values = arraySentinel) : this._index++, {
|
|
783
|
+
value: result,
|
|
784
|
+
done: !1
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
return {
|
|
788
|
+
value: void 0,
|
|
789
|
+
done: !0
|
|
790
|
+
};
|
|
791
|
+
}, MapIterator.prototype["throw"] = function (error) {
|
|
792
|
+
throw this._index >= 0 && (this._index = -1, this._keys = arraySentinel, this._values = arraySentinel), error;
|
|
793
|
+
}, MapIterator.prototype["return"] = function (value) {
|
|
794
|
+
return this._index >= 0 && (this._index = -1, this._keys = arraySentinel, this._values = arraySentinel), {
|
|
795
|
+
value: value,
|
|
796
|
+
done: !0
|
|
797
|
+
};
|
|
798
|
+
}, MapIterator;
|
|
955
799
|
}();
|
|
956
|
-
|
|
957
|
-
|
|
800
|
+
return function () {
|
|
801
|
+
function Map() {
|
|
802
|
+
this._keys = [], this._values = [], this._cacheKey = cacheSentinel, this._cacheIndex = -2;
|
|
958
803
|
}
|
|
959
|
-
|
|
960
|
-
|
|
804
|
+
return Object.defineProperty(Map.prototype, "size", {
|
|
805
|
+
get: function get() {
|
|
806
|
+
return this._keys.length;
|
|
807
|
+
},
|
|
808
|
+
enumerable: !0,
|
|
809
|
+
configurable: !0
|
|
810
|
+
}), Map.prototype.has = function (key) {
|
|
811
|
+
return this._find(key, !1) >= 0;
|
|
812
|
+
}, Map.prototype.get = function (key) {
|
|
813
|
+
var index = this._find(key, !1);
|
|
814
|
+
return index >= 0 ? this._values[index] : void 0;
|
|
815
|
+
}, Map.prototype.set = function (key, value) {
|
|
816
|
+
var index = this._find(key, !0);
|
|
817
|
+
return this._values[index] = value, this;
|
|
818
|
+
}, Map.prototype["delete"] = function (key) {
|
|
819
|
+
var index = this._find(key, !1);
|
|
820
|
+
if (index >= 0) {
|
|
821
|
+
var size = this._keys.length;
|
|
822
|
+
for (var i = index + 1; i < size; i++) this._keys[i - 1] = this._keys[i], this._values[i - 1] = this._values[i];
|
|
823
|
+
return this._keys.length--, this._values.length--, key === this._cacheKey && (this._cacheKey = cacheSentinel, this._cacheIndex = -2), !0;
|
|
824
|
+
}
|
|
825
|
+
return !1;
|
|
826
|
+
}, Map.prototype.clear = function () {
|
|
827
|
+
this._keys.length = 0, this._values.length = 0, this._cacheKey = cacheSentinel, this._cacheIndex = -2;
|
|
828
|
+
}, Map.prototype.keys = function () {
|
|
829
|
+
return new MapIterator(this._keys, this._values, getKey);
|
|
830
|
+
}, Map.prototype.values = function () {
|
|
831
|
+
return new MapIterator(this._keys, this._values, getValue);
|
|
832
|
+
}, Map.prototype.entries = function () {
|
|
833
|
+
return new MapIterator(this._keys, this._values, getEntry);
|
|
834
|
+
}, Map.prototype["@@iterator"] = function () {
|
|
835
|
+
return this.entries();
|
|
836
|
+
}, Map.prototype[iteratorSymbol] = function () {
|
|
837
|
+
return this.entries();
|
|
838
|
+
}, Map.prototype._find = function (key, insert) {
|
|
839
|
+
return this._cacheKey !== key && (this._cacheIndex = this._keys.indexOf(this._cacheKey = key)), this._cacheIndex < 0 && insert && (this._cacheIndex = this._keys.length, this._keys.push(key), this._values.push(void 0)), this._cacheIndex;
|
|
840
|
+
}, Map;
|
|
841
|
+
}();
|
|
842
|
+
function getKey(key, _) {
|
|
843
|
+
return key;
|
|
844
|
+
}
|
|
845
|
+
function getValue(_, value) {
|
|
846
|
+
return value;
|
|
847
|
+
}
|
|
848
|
+
function getEntry(key, value) {
|
|
849
|
+
return [key, value];
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
function CreateSetPolyfill() {
|
|
853
|
+
return function () {
|
|
854
|
+
function Set() {
|
|
855
|
+
this._map = new _Map();
|
|
961
856
|
}
|
|
962
|
-
|
|
963
|
-
|
|
857
|
+
return Object.defineProperty(Set.prototype, "size", {
|
|
858
|
+
get: function get() {
|
|
859
|
+
return this._map.size;
|
|
860
|
+
},
|
|
861
|
+
enumerable: !0,
|
|
862
|
+
configurable: !0
|
|
863
|
+
}), Set.prototype.has = function (value) {
|
|
864
|
+
return this._map.has(value);
|
|
865
|
+
}, Set.prototype.add = function (value) {
|
|
866
|
+
return this._map.set(value, value), this;
|
|
867
|
+
}, Set.prototype["delete"] = function (value) {
|
|
868
|
+
return this._map["delete"](value);
|
|
869
|
+
}, Set.prototype.clear = function () {
|
|
870
|
+
this._map.clear();
|
|
871
|
+
}, Set.prototype.keys = function () {
|
|
872
|
+
return this._map.keys();
|
|
873
|
+
}, Set.prototype.values = function () {
|
|
874
|
+
return this._map.values();
|
|
875
|
+
}, Set.prototype.entries = function () {
|
|
876
|
+
return this._map.entries();
|
|
877
|
+
}, Set.prototype["@@iterator"] = function () {
|
|
878
|
+
return this.keys();
|
|
879
|
+
}, Set.prototype[iteratorSymbol] = function () {
|
|
880
|
+
return this.keys();
|
|
881
|
+
}, Set;
|
|
882
|
+
}();
|
|
883
|
+
}
|
|
884
|
+
function CreateWeakMapPolyfill() {
|
|
885
|
+
var UUID_SIZE = 16,
|
|
886
|
+
keys = HashMap.create(),
|
|
887
|
+
rootKey = CreateUniqueKey();
|
|
888
|
+
return function () {
|
|
889
|
+
function WeakMap() {
|
|
890
|
+
this._key = CreateUniqueKey();
|
|
891
|
+
}
|
|
892
|
+
return WeakMap.prototype.has = function (target) {
|
|
893
|
+
var table = GetOrCreateWeakMapTable(target, !1);
|
|
894
|
+
return void 0 !== table && HashMap.has(table, this._key);
|
|
895
|
+
}, WeakMap.prototype.get = function (target) {
|
|
896
|
+
var table = GetOrCreateWeakMapTable(target, !1);
|
|
897
|
+
return void 0 !== table ? HashMap.get(table, this._key) : void 0;
|
|
898
|
+
}, WeakMap.prototype.set = function (target, value) {
|
|
899
|
+
return GetOrCreateWeakMapTable(target, !0)[this._key] = value, this;
|
|
900
|
+
}, WeakMap.prototype["delete"] = function (target) {
|
|
901
|
+
var table = GetOrCreateWeakMapTable(target, !1);
|
|
902
|
+
return void 0 !== table && delete table[this._key];
|
|
903
|
+
}, WeakMap.prototype.clear = function () {
|
|
904
|
+
this._key = CreateUniqueKey();
|
|
905
|
+
}, WeakMap;
|
|
906
|
+
}();
|
|
907
|
+
function CreateUniqueKey() {
|
|
908
|
+
var key;
|
|
909
|
+
do {
|
|
910
|
+
key = "@@WeakMap@@" + CreateUUID();
|
|
911
|
+
} while (HashMap.has(keys, key));
|
|
912
|
+
return keys[key] = !0, key;
|
|
913
|
+
}
|
|
914
|
+
function GetOrCreateWeakMapTable(target, create) {
|
|
915
|
+
if (!hasOwn.call(target, rootKey)) {
|
|
916
|
+
if (!create) return;
|
|
917
|
+
Object.defineProperty(target, rootKey, {
|
|
918
|
+
value: HashMap.create()
|
|
919
|
+
});
|
|
964
920
|
}
|
|
921
|
+
return target[rootKey];
|
|
965
922
|
}
|
|
966
|
-
function
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
this._map = new _Map();
|
|
970
|
-
}
|
|
971
|
-
return Object.defineProperty(Set.prototype, "size", {
|
|
972
|
-
get: function get() {
|
|
973
|
-
return this._map.size;
|
|
974
|
-
},
|
|
975
|
-
enumerable: !0,
|
|
976
|
-
configurable: !0
|
|
977
|
-
}), Set.prototype.has = function (value) {
|
|
978
|
-
return this._map.has(value);
|
|
979
|
-
}, Set.prototype.add = function (value) {
|
|
980
|
-
return this._map.set(value, value), this;
|
|
981
|
-
}, Set.prototype["delete"] = function (value) {
|
|
982
|
-
return this._map["delete"](value);
|
|
983
|
-
}, Set.prototype.clear = function () {
|
|
984
|
-
this._map.clear();
|
|
985
|
-
}, Set.prototype.keys = function () {
|
|
986
|
-
return this._map.keys();
|
|
987
|
-
}, Set.prototype.values = function () {
|
|
988
|
-
return this._map.values();
|
|
989
|
-
}, Set.prototype.entries = function () {
|
|
990
|
-
return this._map.entries();
|
|
991
|
-
}, Set.prototype["@@iterator"] = function () {
|
|
992
|
-
return this.keys();
|
|
993
|
-
}, Set.prototype[iteratorSymbol] = function () {
|
|
994
|
-
return this.keys();
|
|
995
|
-
}, Set;
|
|
996
|
-
}();
|
|
923
|
+
function FillRandomBytes(buffer, size) {
|
|
924
|
+
for (var i = 0; i < size; ++i) buffer[i] = 255 * Math.random() | 0;
|
|
925
|
+
return buffer;
|
|
997
926
|
}
|
|
998
|
-
function
|
|
999
|
-
|
|
1000
|
-
keys = HashMap.create(),
|
|
1001
|
-
rootKey = CreateUniqueKey();
|
|
1002
|
-
return function () {
|
|
1003
|
-
function WeakMap() {
|
|
1004
|
-
this._key = CreateUniqueKey();
|
|
1005
|
-
}
|
|
1006
|
-
return WeakMap.prototype.has = function (target) {
|
|
1007
|
-
var table = GetOrCreateWeakMapTable(target, !1);
|
|
1008
|
-
return void 0 !== table && HashMap.has(table, this._key);
|
|
1009
|
-
}, WeakMap.prototype.get = function (target) {
|
|
1010
|
-
var table = GetOrCreateWeakMapTable(target, !1);
|
|
1011
|
-
return void 0 !== table ? HashMap.get(table, this._key) : void 0;
|
|
1012
|
-
}, WeakMap.prototype.set = function (target, value) {
|
|
1013
|
-
return GetOrCreateWeakMapTable(target, !0)[this._key] = value, this;
|
|
1014
|
-
}, WeakMap.prototype["delete"] = function (target) {
|
|
1015
|
-
var table = GetOrCreateWeakMapTable(target, !1);
|
|
1016
|
-
return void 0 !== table && delete table[this._key];
|
|
1017
|
-
}, WeakMap.prototype.clear = function () {
|
|
1018
|
-
this._key = CreateUniqueKey();
|
|
1019
|
-
}, WeakMap;
|
|
1020
|
-
}();
|
|
1021
|
-
function CreateUniqueKey() {
|
|
1022
|
-
var key;
|
|
1023
|
-
do {
|
|
1024
|
-
key = "@@WeakMap@@" + CreateUUID();
|
|
1025
|
-
} while (HashMap.has(keys, key));
|
|
1026
|
-
return keys[key] = !0, key;
|
|
1027
|
-
}
|
|
1028
|
-
function GetOrCreateWeakMapTable(target, create) {
|
|
1029
|
-
if (!hasOwn.call(target, rootKey)) {
|
|
1030
|
-
if (!create) return;
|
|
1031
|
-
Object.defineProperty(target, rootKey, {
|
|
1032
|
-
value: HashMap.create()
|
|
1033
|
-
});
|
|
1034
|
-
}
|
|
1035
|
-
return target[rootKey];
|
|
1036
|
-
}
|
|
1037
|
-
function FillRandomBytes(buffer, size) {
|
|
1038
|
-
for (var i = 0; i < size; ++i) buffer[i] = 255 * Math.random() | 0;
|
|
1039
|
-
return buffer;
|
|
1040
|
-
}
|
|
1041
|
-
function GenRandomBytes(size) {
|
|
1042
|
-
return "function" == typeof Uint8Array ? "undefined" != typeof crypto ? crypto.getRandomValues(new Uint8Array(size)) : FillRandomBytes(new Uint8Array(size), size) : FillRandomBytes(new Array(size), size);
|
|
1043
|
-
}
|
|
1044
|
-
function CreateUUID() {
|
|
1045
|
-
var data = GenRandomBytes(UUID_SIZE);
|
|
1046
|
-
data[6] = 79 & data[6] | 64, data[8] = 191 & data[8] | 128;
|
|
1047
|
-
var result = "";
|
|
1048
|
-
for (var offset = 0; offset < UUID_SIZE; ++offset) {
|
|
1049
|
-
var _byte = data[offset];
|
|
1050
|
-
4 !== offset && 6 !== offset && 8 !== offset || (result += "-"), _byte < 16 && (result += "0"), result += _byte.toString(16).toLowerCase();
|
|
1051
|
-
}
|
|
1052
|
-
return result;
|
|
1053
|
-
}
|
|
927
|
+
function GenRandomBytes(size) {
|
|
928
|
+
return "function" == typeof Uint8Array ? "undefined" != typeof crypto ? crypto.getRandomValues(new Uint8Array(size)) : FillRandomBytes(new Uint8Array(size), size) : FillRandomBytes(new Array(size), size);
|
|
1054
929
|
}
|
|
1055
|
-
function
|
|
1056
|
-
|
|
930
|
+
function CreateUUID() {
|
|
931
|
+
var data = GenRandomBytes(UUID_SIZE);
|
|
932
|
+
data[6] = 79 & data[6] | 64, data[8] = 191 & data[8] | 128;
|
|
933
|
+
var result = "";
|
|
934
|
+
for (var offset = 0; offset < UUID_SIZE; ++offset) {
|
|
935
|
+
var _byte = data[offset];
|
|
936
|
+
4 !== offset && 6 !== offset && 8 !== offset || (result += "-"), _byte < 16 && (result += "0"), result += _byte.toString(16).toLowerCase();
|
|
937
|
+
}
|
|
938
|
+
return result;
|
|
1057
939
|
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
940
|
+
}
|
|
941
|
+
function MakeDictionary(obj) {
|
|
942
|
+
return obj.__ = void 0, delete obj.__, obj;
|
|
943
|
+
}
|
|
944
|
+
exporter("defineMetadata", defineMetadata), exporter("hasMetadata", hasMetadata), exporter("hasOwnMetadata", hasOwnMetadata), exporter("getMetadata", getMetadata);
|
|
945
|
+
}((target = Reflect, function (key, value) {
|
|
946
|
+
"function" != typeof target[key] && Object.defineProperty(target, key, {
|
|
947
|
+
configurable: !0,
|
|
948
|
+
writable: !0,
|
|
949
|
+
value: value
|
|
950
|
+
});
|
|
951
|
+
})), Reflect;
|
|
952
|
+
})({});
|
|
1062
953
|
|
|
1063
|
-
function targetIsConstructorFunction(target) {
|
|
1064
|
-
return void 0 !== target.prototype;
|
|
1065
|
-
}
|
|
1066
|
-
function _throwIfMethodParameter(parameterName) {
|
|
1067
|
-
if (void 0 !== parameterName) throw new Error(INVALID_DECORATOR_OPERATION);
|
|
1068
|
-
}
|
|
1069
|
-
function tagParameter(annotationTarget, parameterName, parameterIndex, metadata) {
|
|
1070
|
-
_throwIfMethodParameter(parameterName), _tagParameterOrProperty(TAGGED, annotationTarget, parameterIndex.toString(), metadata);
|
|
1071
|
-
}
|
|
1072
|
-
function tagProperty(annotationTarget, propertyName, metadata) {
|
|
1073
|
-
if (targetIsConstructorFunction(annotationTarget)) throw new Error(INVALID_DECORATOR_OPERATION);
|
|
1074
|
-
_tagParameterOrProperty(TAGGED_PROP, annotationTarget.constructor, propertyName, metadata);
|
|
1075
|
-
}
|
|
1076
|
-
function _ensureNoMetadataKeyDuplicates(metadata) {
|
|
1077
|
-
var metadatas = [];
|
|
1078
|
-
if (Array.isArray(metadata)) {
|
|
1079
|
-
metadatas = metadata;
|
|
1080
|
-
var duplicate = getFirstArrayDuplicate(metadatas.map(function (md) {
|
|
1081
|
-
return md.key;
|
|
1082
|
-
}));
|
|
1083
|
-
if (void 0 !== duplicate) throw new Error("".concat(DUPLICATED_METADATA, " ").concat(duplicate.toString()));
|
|
1084
|
-
} else metadatas = [metadata];
|
|
1085
|
-
return metadatas;
|
|
1086
|
-
}
|
|
1087
954
|
function _tagParameterOrProperty(metadataKey, annotationTarget, key, metadata) {
|
|
1088
955
|
var _paramOrPropertyMetad;
|
|
1089
|
-
var metadatas =
|
|
956
|
+
var metadatas = [metadata];
|
|
1090
957
|
var paramsOrPropertiesMetadata = {};
|
|
1091
|
-
Reflect$
|
|
958
|
+
Reflect$1.hasOwnMetadata(metadataKey, annotationTarget) && (paramsOrPropertiesMetadata = Reflect$1.getMetadata(metadataKey, annotationTarget));
|
|
1092
959
|
var paramOrPropertyMetadata = paramsOrPropertiesMetadata[key];
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
var _loop = function _loop() {
|
|
1098
|
-
var m = _step.value;
|
|
1099
|
-
if (metadatas.some(function (md) {
|
|
1100
|
-
return md.key === m.key;
|
|
1101
|
-
})) throw new Error("".concat(DUPLICATED_METADATA, " ").concat(m.key.toString()));
|
|
1102
|
-
};
|
|
1103
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1104
|
-
_loop();
|
|
1105
|
-
}
|
|
1106
|
-
} catch (err) {
|
|
1107
|
-
_iterator.e(err);
|
|
1108
|
-
} finally {
|
|
1109
|
-
_iterator.f();
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
(_paramOrPropertyMetad = paramOrPropertyMetadata).push.apply(_paramOrPropertyMetad, _toConsumableArray(metadatas)), paramsOrPropertiesMetadata[key] = paramOrPropertyMetadata, Reflect$2.defineMetadata(metadataKey, paramsOrPropertiesMetadata, annotationTarget);
|
|
960
|
+
void 0 === paramOrPropertyMetadata && (paramOrPropertyMetadata = []), (_paramOrPropertyMetad = paramOrPropertyMetadata).push.apply(_paramOrPropertyMetad, metadatas), paramsOrPropertiesMetadata[key] = paramOrPropertyMetadata, Reflect$1.defineMetadata(metadataKey, paramsOrPropertiesMetadata, annotationTarget);
|
|
961
|
+
}
|
|
962
|
+
function tagParameter(annotationTarget, parameterName, parameterIndex, metadata) {
|
|
963
|
+
_tagParameterOrProperty(TAGGED, annotationTarget, parameterIndex.toString(), metadata);
|
|
1113
964
|
}
|
|
1114
965
|
function createTaggedDecorator(metadata) {
|
|
1115
966
|
return function (target, targetKey, indexOrPropertyDescriptor) {
|
|
1116
|
-
|
|
967
|
+
tagParameter(target, targetKey, indexOrPropertyDescriptor, metadata);
|
|
1117
968
|
};
|
|
1118
969
|
}
|
|
1119
|
-
|
|
1120
970
|
function injectBase(metadataKey) {
|
|
1121
971
|
return function (serviceIdentifier) {
|
|
1122
972
|
return function (target, targetKey, indexOrPropertyDescriptor) {
|
|
1123
|
-
if (void 0 === serviceIdentifier) {
|
|
1124
|
-
var className = "function" == typeof target ? target.name : target.constructor.name;
|
|
1125
|
-
throw new Error(UNDEFINED_INJECT_ANNOTATION(className));
|
|
1126
|
-
}
|
|
1127
973
|
return createTaggedDecorator(new Metadata(metadataKey, serviceIdentifier))(target, targetKey, indexOrPropertyDescriptor);
|
|
1128
974
|
};
|
|
1129
975
|
};
|
|
@@ -1135,9 +981,7 @@
|
|
|
1135
981
|
|
|
1136
982
|
function injectable() {
|
|
1137
983
|
return function (target) {
|
|
1138
|
-
|
|
1139
|
-
var types = Reflect$2.getMetadata(DESIGN_PARAM_TYPES, target) || [];
|
|
1140
|
-
return Reflect$2.defineMetadata(PARAM_TYPES, types, target), target;
|
|
984
|
+
return Reflect$1.defineMetadata(PARAM_TYPES, null, target), target;
|
|
1141
985
|
};
|
|
1142
986
|
}
|
|
1143
987
|
|
|
@@ -1146,7 +990,6 @@
|
|
|
1146
990
|
}
|
|
1147
991
|
|
|
1148
992
|
var BindingScopeEnum = {
|
|
1149
|
-
Request: "Request",
|
|
1150
993
|
Singleton: "Singleton",
|
|
1151
994
|
Transient: "Transient"
|
|
1152
995
|
},
|
|
@@ -1159,25 +1002,20 @@
|
|
|
1159
1002
|
Instance: "Instance",
|
|
1160
1003
|
Invalid: "Invalid",
|
|
1161
1004
|
Provider: "Provider"
|
|
1162
|
-
},
|
|
1163
|
-
TargetTypeEnum = {
|
|
1164
|
-
ClassProperty: "ClassProperty",
|
|
1165
|
-
ConstructorArgument: "ConstructorArgument",
|
|
1166
|
-
Variable: "Variable"
|
|
1167
1005
|
};
|
|
1168
1006
|
|
|
1169
1007
|
var Binding = /*#__PURE__*/function () {
|
|
1170
1008
|
function Binding(serviceIdentifier, scope) {
|
|
1171
1009
|
_classCallCheck(this, Binding);
|
|
1172
|
-
this.id =
|
|
1010
|
+
this.id = Generator.GenAutoIncrementId(), this.activated = !1, this.serviceIdentifier = serviceIdentifier, this.scope = scope, this.type = BindingTypeEnum.Invalid, this.constraint = function (request) {
|
|
1173
1011
|
return !0;
|
|
1174
|
-
}, this.implementationType = null, this.cache = null, this.factory = null, this.provider = null, this.
|
|
1012
|
+
}, this.implementationType = null, this.cache = null, this.factory = null, this.provider = null, this.dynamicValue = null;
|
|
1175
1013
|
}
|
|
1176
1014
|
_createClass(Binding, [{
|
|
1177
1015
|
key: "clone",
|
|
1178
1016
|
value: function clone() {
|
|
1179
1017
|
var clone = new Binding(this.serviceIdentifier, this.scope);
|
|
1180
|
-
return clone.activated = clone.scope === BindingScopeEnum.Singleton && this.activated, clone.implementationType = this.implementationType, clone.dynamicValue = this.dynamicValue, clone.scope = this.scope, clone.type = this.type, clone.
|
|
1018
|
+
return clone.activated = clone.scope === BindingScopeEnum.Singleton && this.activated, clone.implementationType = this.implementationType, clone.dynamicValue = this.dynamicValue, clone.scope = this.scope, clone.type = this.type, clone.provider = this.provider, clone.constraint = this.constraint, clone.cache = this.cache, clone;
|
|
1181
1019
|
}
|
|
1182
1020
|
}]);
|
|
1183
1021
|
return Binding;
|
|
@@ -1191,1285 +1029,187 @@
|
|
|
1191
1029
|
key: "getConstructorMetadata",
|
|
1192
1030
|
value: function getConstructorMetadata(constructorFunc) {
|
|
1193
1031
|
return {
|
|
1194
|
-
compilerGeneratedMetadata: Reflect$
|
|
1195
|
-
userGeneratedMetadata: Reflect$
|
|
1032
|
+
compilerGeneratedMetadata: Reflect$1.getMetadata(PARAM_TYPES, constructorFunc),
|
|
1033
|
+
userGeneratedMetadata: Reflect$1.getMetadata(TAGGED, constructorFunc) || {}
|
|
1196
1034
|
};
|
|
1197
1035
|
}
|
|
1198
1036
|
}, {
|
|
1199
1037
|
key: "getPropertiesMetadata",
|
|
1200
1038
|
value: function getPropertiesMetadata(constructorFunc) {
|
|
1201
|
-
|
|
1039
|
+
throw new Error("暂未实现");
|
|
1202
1040
|
}
|
|
1203
1041
|
}]);
|
|
1204
1042
|
return MetadataReader;
|
|
1205
1043
|
}();
|
|
1206
1044
|
|
|
1207
|
-
var
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1045
|
+
var taggedConstraint = function taggedConstraint(key) {
|
|
1046
|
+
return function (value) {
|
|
1047
|
+
var constraint = function constraint(request) {
|
|
1048
|
+
if (null == request || null == request.constructorArgsMetadata) return !1;
|
|
1049
|
+
var constructorArgsMetadata = request.constructorArgsMetadata;
|
|
1050
|
+
for (var i = 0; i < constructorArgsMetadata.length; i++) if (constructorArgsMetadata[i].key === key && constructorArgsMetadata[i].value === value) return !0;
|
|
1051
|
+
return !1;
|
|
1052
|
+
};
|
|
1053
|
+
return constraint.metaData = new Metadata(key, value), constraint;
|
|
1054
|
+
};
|
|
1211
1055
|
};
|
|
1056
|
+
var namedConstraint = taggedConstraint(NAMED_TAG);
|
|
1212
1057
|
|
|
1213
|
-
function
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
if ("symbol" == _typeof(serviceIdentifier)) return serviceIdentifier.toString();
|
|
1218
|
-
return serviceIdentifier;
|
|
1219
|
-
}
|
|
1220
|
-
function listRegisteredBindingsForServiceIdentifier(container, serviceIdentifier, getBindings) {
|
|
1221
|
-
var registeredBindingsList = "";
|
|
1222
|
-
var registeredBindings = getBindings(container, serviceIdentifier);
|
|
1223
|
-
return 0 !== registeredBindings.length && (registeredBindingsList = "\nRegistered bindings:", registeredBindings.forEach(function (binding) {
|
|
1224
|
-
var name = "Object";
|
|
1225
|
-
null !== binding.implementationType && (name = getFunctionName(binding.implementationType)), registeredBindingsList = "".concat(registeredBindingsList, "\n ").concat(name), binding.constraint.metaData && (registeredBindingsList = "".concat(registeredBindingsList, " - ").concat(binding.constraint.metaData));
|
|
1226
|
-
})), registeredBindingsList;
|
|
1227
|
-
}
|
|
1228
|
-
function listMetadataForTarget(serviceIdentifierString, target) {
|
|
1229
|
-
if (target.isTagged() || target.isNamed()) {
|
|
1230
|
-
var m = "";
|
|
1231
|
-
var namedTag = target.getNamedTag(),
|
|
1232
|
-
otherTags = target.getCustomTags();
|
|
1233
|
-
return null !== namedTag && (m += namedTag.toString() + "\n"), null !== otherTags && otherTags.forEach(function (tag) {
|
|
1234
|
-
m += tag.toString() + "\n";
|
|
1235
|
-
}), " ".concat(serviceIdentifierString, "\n ").concat(serviceIdentifierString, " - ").concat(m);
|
|
1236
|
-
}
|
|
1237
|
-
return " ".concat(serviceIdentifierString);
|
|
1238
|
-
}
|
|
1239
|
-
function getFunctionName(func) {
|
|
1240
|
-
if (func.name) return func.name;
|
|
1241
|
-
var name = func.toString(),
|
|
1242
|
-
match = name.match(/^function\s*([^\s(]+)/);
|
|
1243
|
-
return match ? match[1] : "Anonymous function: ".concat(name);
|
|
1244
|
-
}
|
|
1245
|
-
function getSymbolDescription(symbol) {
|
|
1246
|
-
return symbol.toString().slice(7, -1);
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
var Context = /*#__PURE__*/function () {
|
|
1250
|
-
function Context(container) {
|
|
1251
|
-
_classCallCheck(this, Context);
|
|
1252
|
-
this.id = id(), this.container = container;
|
|
1058
|
+
var BindingInSyntax = /*#__PURE__*/function () {
|
|
1059
|
+
function BindingInSyntax(binding) {
|
|
1060
|
+
_classCallCheck(this, BindingInSyntax);
|
|
1061
|
+
this._binding = binding;
|
|
1253
1062
|
}
|
|
1254
|
-
_createClass(
|
|
1255
|
-
key: "
|
|
1256
|
-
value: function
|
|
1257
|
-
|
|
1063
|
+
_createClass(BindingInSyntax, [{
|
|
1064
|
+
key: "inRequestScope",
|
|
1065
|
+
value: function inRequestScope() {
|
|
1066
|
+
throw new Error("暂未实现");
|
|
1258
1067
|
}
|
|
1259
1068
|
}, {
|
|
1260
|
-
key: "
|
|
1261
|
-
value: function
|
|
1262
|
-
this.
|
|
1069
|
+
key: "inSingletonScope",
|
|
1070
|
+
value: function inSingletonScope() {
|
|
1071
|
+
return this._binding.scope = BindingScopeEnum.Singleton, this;
|
|
1263
1072
|
}
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
var LazyServiceIdentifer = /*#__PURE__*/function () {
|
|
1274
|
-
function LazyServiceIdentifer(cb) {
|
|
1275
|
-
_classCallCheck(this, LazyServiceIdentifer);
|
|
1276
|
-
this._cb = cb;
|
|
1277
|
-
}
|
|
1278
|
-
_createClass(LazyServiceIdentifer, [{
|
|
1279
|
-
key: "unwrap",
|
|
1280
|
-
value: function unwrap() {
|
|
1281
|
-
return this._cb();
|
|
1073
|
+
}, {
|
|
1074
|
+
key: "inTransientScope",
|
|
1075
|
+
value: function inTransientScope() {
|
|
1076
|
+
return this._binding.scope = BindingScopeEnum.Transient, this;
|
|
1077
|
+
}
|
|
1078
|
+
}, {
|
|
1079
|
+
key: "whenTargetNamed",
|
|
1080
|
+
value: function whenTargetNamed(name) {
|
|
1081
|
+
return this._binding.constraint = namedConstraint(name), this;
|
|
1282
1082
|
}
|
|
1283
1083
|
}]);
|
|
1284
|
-
return
|
|
1084
|
+
return BindingInSyntax;
|
|
1285
1085
|
}();
|
|
1286
1086
|
|
|
1287
|
-
var
|
|
1288
|
-
function
|
|
1289
|
-
_classCallCheck(this,
|
|
1290
|
-
this.
|
|
1087
|
+
var BindingToSyntax = /*#__PURE__*/function () {
|
|
1088
|
+
function BindingToSyntax(binding) {
|
|
1089
|
+
_classCallCheck(this, BindingToSyntax);
|
|
1090
|
+
this._binding = binding;
|
|
1291
1091
|
}
|
|
1292
|
-
_createClass(
|
|
1293
|
-
key: "
|
|
1294
|
-
value: function
|
|
1295
|
-
return
|
|
1092
|
+
_createClass(BindingToSyntax, [{
|
|
1093
|
+
key: "to",
|
|
1094
|
+
value: function to(constructor) {
|
|
1095
|
+
return this._binding.type = BindingTypeEnum.Instance, this._binding.implementationType = constructor, new BindingInSyntax(this._binding);
|
|
1096
|
+
}
|
|
1097
|
+
}, {
|
|
1098
|
+
key: "toSelf",
|
|
1099
|
+
value: function toSelf() {
|
|
1100
|
+
var self = this._binding.serviceIdentifier;
|
|
1101
|
+
return this.to(self);
|
|
1102
|
+
}
|
|
1103
|
+
}, {
|
|
1104
|
+
key: "toDynamicValue",
|
|
1105
|
+
value: function toDynamicValue(func) {
|
|
1106
|
+
return this._binding.type = BindingTypeEnum.DynamicValue, this._binding.cache = null, this._binding.dynamicValue = func, this._binding.implementationType = null, new BindingInSyntax(this._binding);
|
|
1107
|
+
}
|
|
1108
|
+
}, {
|
|
1109
|
+
key: "toConstantValue",
|
|
1110
|
+
value: function toConstantValue(value) {
|
|
1111
|
+
return this._binding.type = BindingTypeEnum.ConstantValue, this._binding.cache = value, this._binding.dynamicValue = null, this._binding.implementationType = null, this._binding.scope = BindingScopeEnum.Singleton, new BindingInSyntax(this._binding);
|
|
1296
1112
|
}
|
|
1297
1113
|
}, {
|
|
1298
|
-
key: "
|
|
1299
|
-
value: function
|
|
1300
|
-
return this.
|
|
1114
|
+
key: "toFactory",
|
|
1115
|
+
value: function toFactory(factory) {
|
|
1116
|
+
return this._binding.type = BindingTypeEnum.Factory, this._binding.factory = factory, this._binding.scope = BindingScopeEnum.Singleton, new BindingInSyntax(this._binding);
|
|
1301
1117
|
}
|
|
1302
1118
|
}, {
|
|
1303
|
-
key: "
|
|
1304
|
-
value: function
|
|
1305
|
-
|
|
1119
|
+
key: "toService",
|
|
1120
|
+
value: function toService(service) {
|
|
1121
|
+
this.toDynamicValue(function (context) {
|
|
1122
|
+
return context.container.get(service);
|
|
1123
|
+
});
|
|
1306
1124
|
}
|
|
1307
1125
|
}]);
|
|
1308
|
-
return
|
|
1126
|
+
return BindingToSyntax;
|
|
1309
1127
|
}();
|
|
1310
1128
|
|
|
1311
|
-
var
|
|
1312
|
-
function
|
|
1313
|
-
_classCallCheck(this,
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
"
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
value: function hasTag(key) {
|
|
1323
|
-
var _iterator = _createForOfIteratorHelper(this.metadata),
|
|
1324
|
-
_step;
|
|
1325
|
-
try {
|
|
1326
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1327
|
-
var m = _step.value;
|
|
1328
|
-
if (m.key === key) return !0;
|
|
1329
|
-
}
|
|
1330
|
-
} catch (err) {
|
|
1331
|
-
_iterator.e(err);
|
|
1332
|
-
} finally {
|
|
1333
|
-
_iterator.f();
|
|
1334
|
-
}
|
|
1335
|
-
return !1;
|
|
1129
|
+
var Container = /*#__PURE__*/function () {
|
|
1130
|
+
function Container(containerOptions) {
|
|
1131
|
+
_classCallCheck(this, Container);
|
|
1132
|
+
var options = containerOptions || {};
|
|
1133
|
+
options.defaultScope = options.defaultScope || BindingScopeEnum.Transient, this.options = options, this.id = Generator.GenAutoIncrementId(), this._bindingDictionary = new Map(), this._metadataReader = new MetadataReader();
|
|
1134
|
+
}
|
|
1135
|
+
_createClass(Container, [{
|
|
1136
|
+
key: "load",
|
|
1137
|
+
value: function load(module) {
|
|
1138
|
+
var containerModuleHelpers = this._getContainerModuleHelpersFactory()(module.id);
|
|
1139
|
+
module.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction);
|
|
1336
1140
|
}
|
|
1337
1141
|
}, {
|
|
1338
|
-
key: "
|
|
1339
|
-
value: function
|
|
1340
|
-
|
|
1142
|
+
key: "get",
|
|
1143
|
+
value: function get(serviceIdentifier) {
|
|
1144
|
+
var getArgs = this._getNotAllArgs(serviceIdentifier, !1);
|
|
1145
|
+
return this._get(getArgs);
|
|
1341
1146
|
}
|
|
1342
1147
|
}, {
|
|
1343
|
-
key: "
|
|
1344
|
-
value: function
|
|
1345
|
-
|
|
1148
|
+
key: "getAll",
|
|
1149
|
+
value: function getAll(serviceIdentifier) {
|
|
1150
|
+
var getArgs = this._getAllArgs(serviceIdentifier);
|
|
1151
|
+
return this._get(getArgs);
|
|
1346
1152
|
}
|
|
1347
1153
|
}, {
|
|
1348
|
-
key: "
|
|
1349
|
-
value: function
|
|
1350
|
-
|
|
1154
|
+
key: "getTagged",
|
|
1155
|
+
value: function getTagged(serviceIdentifier, key, value) {
|
|
1156
|
+
var getArgs = this._getNotAllArgs(serviceIdentifier, !1, key, value);
|
|
1157
|
+
return this._get(getArgs);
|
|
1351
1158
|
}
|
|
1352
1159
|
}, {
|
|
1353
|
-
key: "
|
|
1354
|
-
value: function
|
|
1355
|
-
return this.
|
|
1356
|
-
return NON_CUSTOM_TAG_KEYS.every(function (key) {
|
|
1357
|
-
return metadata.key !== key;
|
|
1358
|
-
});
|
|
1359
|
-
});
|
|
1160
|
+
key: "getNamed",
|
|
1161
|
+
value: function getNamed(serviceIdentifier, named) {
|
|
1162
|
+
return this.getTagged(serviceIdentifier, NAMED_TAG, named);
|
|
1360
1163
|
}
|
|
1361
1164
|
}, {
|
|
1362
|
-
key: "
|
|
1363
|
-
value: function
|
|
1364
|
-
return this.
|
|
1165
|
+
key: "isBound",
|
|
1166
|
+
value: function isBound(serviceIdentifier) {
|
|
1167
|
+
return this._bindingDictionary.has(serviceIdentifier);
|
|
1365
1168
|
}
|
|
1366
1169
|
}, {
|
|
1367
|
-
key: "
|
|
1368
|
-
value: function
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1170
|
+
key: "bind",
|
|
1171
|
+
value: function bind(serviceIdentifier) {
|
|
1172
|
+
var scope = this.options.defaultScope,
|
|
1173
|
+
binding = new Binding(serviceIdentifier, scope),
|
|
1174
|
+
list = this._bindingDictionary.get(serviceIdentifier) || [];
|
|
1175
|
+
return list.push(binding), this._bindingDictionary.set(serviceIdentifier, list), new BindingToSyntax(binding);
|
|
1372
1176
|
}
|
|
1373
1177
|
}, {
|
|
1374
|
-
key: "
|
|
1375
|
-
value: function
|
|
1376
|
-
|
|
1377
|
-
return NON_CUSTOM_TAG_KEYS.every(function (key) {
|
|
1378
|
-
return metadata.key !== key;
|
|
1379
|
-
});
|
|
1380
|
-
}) : null;
|
|
1178
|
+
key: "unbind",
|
|
1179
|
+
value: function unbind(serviceIdentifier) {
|
|
1180
|
+
this._bindingDictionary["delete"](serviceIdentifier);
|
|
1381
1181
|
}
|
|
1382
1182
|
}, {
|
|
1383
|
-
key: "
|
|
1384
|
-
value: function
|
|
1385
|
-
return this.
|
|
1183
|
+
key: "rebind",
|
|
1184
|
+
value: function rebind(serviceIdentifier) {
|
|
1185
|
+
return this.unbind(serviceIdentifier), this.bind(serviceIdentifier);
|
|
1386
1186
|
}
|
|
1387
1187
|
}, {
|
|
1388
|
-
key: "
|
|
1389
|
-
value: function
|
|
1188
|
+
key: "_getContainerModuleHelpersFactory",
|
|
1189
|
+
value: function _getContainerModuleHelpersFactory() {
|
|
1390
1190
|
var _this = this;
|
|
1391
|
-
return function (value) {
|
|
1392
|
-
var _iterator2 = _createForOfIteratorHelper(_this.metadata),
|
|
1393
|
-
_step2;
|
|
1394
|
-
try {
|
|
1395
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1396
|
-
var m = _step2.value;
|
|
1397
|
-
if (m.key === key && m.value === value) return !0;
|
|
1398
|
-
}
|
|
1399
|
-
} catch (err) {
|
|
1400
|
-
_iterator2.e(err);
|
|
1401
|
-
} finally {
|
|
1402
|
-
_iterator2.f();
|
|
1403
|
-
}
|
|
1404
|
-
return !1;
|
|
1405
|
-
};
|
|
1406
|
-
}
|
|
1407
|
-
}]);
|
|
1408
|
-
return Target;
|
|
1409
|
-
}();
|
|
1410
|
-
|
|
1411
|
-
function getDependencies(metadataReader, func) {
|
|
1412
|
-
return getTargets(metadataReader, getFunctionName(func), func, !1);
|
|
1413
|
-
}
|
|
1414
|
-
function getTargets(metadataReader, constructorName, func, isBaseClass) {
|
|
1415
|
-
var metadata = metadataReader.getConstructorMetadata(func),
|
|
1416
|
-
serviceIdentifiers = metadata.compilerGeneratedMetadata;
|
|
1417
|
-
if (void 0 === serviceIdentifiers) {
|
|
1418
|
-
var msg = "".concat(MISSING_INJECTABLE_ANNOTATION, " ").concat(constructorName, ".");
|
|
1419
|
-
throw new Error(msg);
|
|
1420
|
-
}
|
|
1421
|
-
var constructorArgsMetadata = metadata.userGeneratedMetadata,
|
|
1422
|
-
keys = Object.keys(constructorArgsMetadata),
|
|
1423
|
-
hasUserDeclaredUnknownInjections = 0 === func.length && keys.length > 0,
|
|
1424
|
-
hasOptionalParameters = keys.length > func.length;
|
|
1425
|
-
return [].concat(_toConsumableArray(getConstructorArgsAsTargets(isBaseClass, constructorName, serviceIdentifiers, constructorArgsMetadata, hasUserDeclaredUnknownInjections || hasOptionalParameters ? keys.length : func.length)), _toConsumableArray(getClassPropsAsTargets(metadataReader, func, constructorName)));
|
|
1426
|
-
}
|
|
1427
|
-
function getConstructorArgsAsTarget(index, isBaseClass, constructorName, serviceIdentifiers, constructorArgsMetadata) {
|
|
1428
|
-
var targetMetadata = constructorArgsMetadata[index.toString()] || [],
|
|
1429
|
-
metadata = formatTargetMetadata(targetMetadata),
|
|
1430
|
-
isManaged = !0 !== metadata.unmanaged;
|
|
1431
|
-
var serviceIdentifier = serviceIdentifiers[index];
|
|
1432
|
-
var injectIdentifier = metadata.inject || metadata.multiInject;
|
|
1433
|
-
if (serviceIdentifier = injectIdentifier || serviceIdentifier, serviceIdentifier instanceof LazyServiceIdentifer && (serviceIdentifier = serviceIdentifier.unwrap()), isManaged) {
|
|
1434
|
-
if (!isBaseClass && (serviceIdentifier === Object || serviceIdentifier === Function || void 0 === serviceIdentifier)) {
|
|
1435
|
-
var msg = "".concat(MISSING_INJECT_ANNOTATION, " argument ").concat(index, " in class ").concat(constructorName, ".");
|
|
1436
|
-
throw new Error(msg);
|
|
1437
|
-
}
|
|
1438
|
-
var target = new Target(TargetTypeEnum.ConstructorArgument, metadata.targetName, serviceIdentifier);
|
|
1439
|
-
return target.metadata = targetMetadata, target;
|
|
1440
|
-
}
|
|
1441
|
-
return null;
|
|
1442
|
-
}
|
|
1443
|
-
function getConstructorArgsAsTargets(isBaseClass, constructorName, serviceIdentifiers, constructorArgsMetadata, iterations) {
|
|
1444
|
-
var targets = [];
|
|
1445
|
-
for (var i = 0; i < iterations; i++) {
|
|
1446
|
-
var target = getConstructorArgsAsTarget(i, isBaseClass, constructorName, serviceIdentifiers, constructorArgsMetadata);
|
|
1447
|
-
null !== target && targets.push(target);
|
|
1448
|
-
}
|
|
1449
|
-
return targets;
|
|
1450
|
-
}
|
|
1451
|
-
function _getServiceIdentifierForProperty(inject, multiInject, propertyName, className) {
|
|
1452
|
-
var serviceIdentifier = inject || multiInject;
|
|
1453
|
-
if (void 0 === serviceIdentifier) {
|
|
1454
|
-
var msg = "".concat(MISSING_INJECTABLE_ANNOTATION, " for property ").concat(String(propertyName), " in class ").concat(className, ".");
|
|
1455
|
-
throw new Error(msg);
|
|
1456
|
-
}
|
|
1457
|
-
return serviceIdentifier;
|
|
1458
|
-
}
|
|
1459
|
-
function getClassPropsAsTargets(metadataReader, constructorFunc, constructorName) {
|
|
1460
|
-
var classPropsMetadata = metadataReader.getPropertiesMetadata(constructorFunc);
|
|
1461
|
-
var targets = [];
|
|
1462
|
-
var symbolKeys = Object.getOwnPropertySymbols(classPropsMetadata),
|
|
1463
|
-
keys = Object.keys(classPropsMetadata).concat(symbolKeys);
|
|
1464
|
-
var _iterator = _createForOfIteratorHelper(keys),
|
|
1465
|
-
_step;
|
|
1466
|
-
try {
|
|
1467
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1468
|
-
var key = _step.value;
|
|
1469
|
-
var targetMetadata = classPropsMetadata[key],
|
|
1470
|
-
metadata = formatTargetMetadata(targetMetadata),
|
|
1471
|
-
identifier = metadata.targetName || key,
|
|
1472
|
-
serviceIdentifier = _getServiceIdentifierForProperty(metadata.inject, metadata.multiInject, key, constructorName),
|
|
1473
|
-
target = new Target(TargetTypeEnum.ClassProperty, identifier, serviceIdentifier);
|
|
1474
|
-
target.metadata = targetMetadata, targets.push(target);
|
|
1475
|
-
}
|
|
1476
|
-
} catch (err) {
|
|
1477
|
-
_iterator.e(err);
|
|
1478
|
-
} finally {
|
|
1479
|
-
_iterator.f();
|
|
1480
|
-
}
|
|
1481
|
-
var baseConstructor = Object.getPrototypeOf(constructorFunc.prototype).constructor;
|
|
1482
|
-
if (baseConstructor !== Object) {
|
|
1483
|
-
var baseTargets = getClassPropsAsTargets(metadataReader, baseConstructor, constructorName);
|
|
1484
|
-
targets = [].concat(_toConsumableArray(targets), _toConsumableArray(baseTargets));
|
|
1485
|
-
}
|
|
1486
|
-
return targets;
|
|
1487
|
-
}
|
|
1488
|
-
function getBaseClassDependencyCount(metadataReader, func) {
|
|
1489
|
-
var baseConstructor = Object.getPrototypeOf(func.prototype).constructor;
|
|
1490
|
-
if (baseConstructor !== Object) {
|
|
1491
|
-
var targets = getTargets(metadataReader, getFunctionName(baseConstructor), baseConstructor, !0),
|
|
1492
|
-
metadata = targets.map(function (t) {
|
|
1493
|
-
return t.metadata.filter(function (m) {
|
|
1494
|
-
return m.key === UNMANAGED_TAG;
|
|
1495
|
-
});
|
|
1496
|
-
}),
|
|
1497
|
-
unmanagedCount = [].concat.apply([], metadata).length,
|
|
1498
|
-
dependencyCount = targets.length - unmanagedCount;
|
|
1499
|
-
return dependencyCount > 0 ? dependencyCount : getBaseClassDependencyCount(metadataReader, baseConstructor);
|
|
1500
|
-
}
|
|
1501
|
-
return 0;
|
|
1502
|
-
}
|
|
1503
|
-
function formatTargetMetadata(targetMetadata) {
|
|
1504
|
-
var targetMetadataMap = {};
|
|
1505
|
-
return targetMetadata.forEach(function (m) {
|
|
1506
|
-
targetMetadataMap[m.key.toString()] = m.value;
|
|
1507
|
-
}), {
|
|
1508
|
-
inject: targetMetadataMap[INJECT_TAG],
|
|
1509
|
-
multiInject: targetMetadataMap[MULTI_INJECT_TAG],
|
|
1510
|
-
targetName: targetMetadataMap[NAME_TAG],
|
|
1511
|
-
unmanaged: targetMetadataMap[UNMANAGED_TAG]
|
|
1512
|
-
};
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
var Request = /*#__PURE__*/function () {
|
|
1516
|
-
function Request(serviceIdentifier, parentContext, parentRequest, bindings, target) {
|
|
1517
|
-
_classCallCheck(this, Request);
|
|
1518
|
-
this.id = id(), this.serviceIdentifier = serviceIdentifier, this.parentContext = parentContext, this.parentRequest = parentRequest, this.target = target, this.childRequests = [], this.bindings = Array.isArray(bindings) ? bindings : [bindings], this.requestScope = null === parentRequest ? new Map() : null;
|
|
1519
|
-
}
|
|
1520
|
-
_createClass(Request, [{
|
|
1521
|
-
key: "addChildRequest",
|
|
1522
|
-
value: function addChildRequest(serviceIdentifier, bindings, target) {
|
|
1523
|
-
var child = new Request(serviceIdentifier, this.parentContext, this, bindings, target);
|
|
1524
|
-
return this.childRequests.push(child), child;
|
|
1525
|
-
}
|
|
1526
|
-
}]);
|
|
1527
|
-
return Request;
|
|
1528
|
-
}();
|
|
1529
|
-
|
|
1530
|
-
function getBindingDictionary(cntnr) {
|
|
1531
|
-
return cntnr._bindingDictionary;
|
|
1532
|
-
}
|
|
1533
|
-
function _createTarget(isMultiInject, targetType, serviceIdentifier, name, key, value) {
|
|
1534
|
-
var metadataKey = isMultiInject ? MULTI_INJECT_TAG : INJECT_TAG,
|
|
1535
|
-
injectMetadata = new Metadata(metadataKey, serviceIdentifier),
|
|
1536
|
-
target = new Target(targetType, name, serviceIdentifier, injectMetadata);
|
|
1537
|
-
if (void 0 !== key) {
|
|
1538
|
-
var tagMetadata = new Metadata(key, value);
|
|
1539
|
-
target.metadata.push(tagMetadata);
|
|
1540
|
-
}
|
|
1541
|
-
return target;
|
|
1542
|
-
}
|
|
1543
|
-
function _getActiveBindings(metadataReader, avoidConstraints, context, parentRequest, target) {
|
|
1544
|
-
var bindings = getBindings(context.container, target.serviceIdentifier),
|
|
1545
|
-
activeBindings = [];
|
|
1546
|
-
return bindings.length === BindingCount.NoBindingsAvailable && context.container.options.autoBindInjectable && "function" == typeof target.serviceIdentifier && metadataReader.getConstructorMetadata(target.serviceIdentifier).compilerGeneratedMetadata && (context.container.bind(target.serviceIdentifier).toSelf(), bindings = getBindings(context.container, target.serviceIdentifier)), activeBindings = avoidConstraints ? bindings : bindings.filter(function (binding) {
|
|
1547
|
-
var request = new Request(binding.serviceIdentifier, context, parentRequest, binding, target);
|
|
1548
|
-
return binding.constraint(request);
|
|
1549
|
-
}), _validateActiveBindingCount(target.serviceIdentifier, activeBindings, target, context.container), activeBindings;
|
|
1550
|
-
}
|
|
1551
|
-
function _validateActiveBindingCount(serviceIdentifier, bindings, target, container) {
|
|
1552
|
-
switch (bindings.length) {
|
|
1553
|
-
case BindingCount.NoBindingsAvailable:
|
|
1554
|
-
if (target.isOptional()) return bindings;
|
|
1555
|
-
var serviceIdentifierString = getServiceIdentifierAsString(serviceIdentifier);
|
|
1556
|
-
var msg = NOT_REGISTERED;
|
|
1557
|
-
throw msg += listMetadataForTarget(serviceIdentifierString, target), msg += listRegisteredBindingsForServiceIdentifier(container, serviceIdentifierString, getBindings), new Error(msg);
|
|
1558
|
-
case BindingCount.OnlyOneBindingAvailable:
|
|
1559
|
-
return bindings;
|
|
1560
|
-
case BindingCount.MultipleBindingsAvailable:
|
|
1561
|
-
default:
|
|
1562
|
-
if (target.isArray()) return bindings;
|
|
1563
|
-
{
|
|
1564
|
-
var _serviceIdentifierString = getServiceIdentifierAsString(serviceIdentifier);
|
|
1565
|
-
var _msg = "".concat(AMBIGUOUS_MATCH, " ").concat(_serviceIdentifierString);
|
|
1566
|
-
throw _msg += listRegisteredBindingsForServiceIdentifier(container, _serviceIdentifierString, getBindings), new Error(_msg);
|
|
1567
|
-
}
|
|
1568
|
-
}
|
|
1569
|
-
}
|
|
1570
|
-
function _createSubRequests(metadataReader, avoidConstraints, serviceIdentifier, context, parentRequest, target) {
|
|
1571
|
-
var activeBindings, childRequest;
|
|
1572
|
-
if (null === parentRequest) {
|
|
1573
|
-
activeBindings = _getActiveBindings(metadataReader, avoidConstraints, context, null, target), childRequest = new Request(serviceIdentifier, context, null, activeBindings, target);
|
|
1574
|
-
var thePlan = new Plan(context, childRequest);
|
|
1575
|
-
context.addPlan(thePlan);
|
|
1576
|
-
} else activeBindings = _getActiveBindings(metadataReader, avoidConstraints, context, parentRequest, target), childRequest = parentRequest.addChildRequest(target.serviceIdentifier, activeBindings, target);
|
|
1577
|
-
activeBindings.forEach(function (binding) {
|
|
1578
|
-
var subChildRequest = null;
|
|
1579
|
-
if (target.isArray()) subChildRequest = childRequest.addChildRequest(binding.serviceIdentifier, binding, target);else {
|
|
1580
|
-
if (binding.cache) return;
|
|
1581
|
-
subChildRequest = childRequest;
|
|
1582
|
-
}
|
|
1583
|
-
if (binding.type === BindingTypeEnum.Instance && null !== binding.implementationType) {
|
|
1584
|
-
var dependencies = getDependencies(metadataReader, binding.implementationType);
|
|
1585
|
-
if (!context.container.options.skipBaseClassChecks) {
|
|
1586
|
-
var baseClassDependencyCount = getBaseClassDependencyCount(metadataReader, binding.implementationType);
|
|
1587
|
-
if (dependencies.length < baseClassDependencyCount) {
|
|
1588
|
-
var error = ARGUMENTS_LENGTH_MISMATCH(getFunctionName(binding.implementationType));
|
|
1589
|
-
throw new Error(error);
|
|
1590
|
-
}
|
|
1591
|
-
}
|
|
1592
|
-
dependencies.forEach(function (dependency) {
|
|
1593
|
-
_createSubRequests(metadataReader, !1, dependency.serviceIdentifier, context, subChildRequest, dependency);
|
|
1594
|
-
});
|
|
1595
|
-
}
|
|
1596
|
-
});
|
|
1597
|
-
}
|
|
1598
|
-
function getBindings(container, serviceIdentifier) {
|
|
1599
|
-
var bindings = [];
|
|
1600
|
-
var bindingDictionary = getBindingDictionary(container);
|
|
1601
|
-
return bindingDictionary.hasKey(serviceIdentifier) ? bindings = bindingDictionary.get(serviceIdentifier) : null !== container.parent && (bindings = getBindings(container.parent, serviceIdentifier)), bindings;
|
|
1602
|
-
}
|
|
1603
|
-
function plan(metadataReader, container, isMultiInject, targetType, serviceIdentifier, key, value) {
|
|
1604
|
-
var avoidConstraints = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : !1;
|
|
1605
|
-
var context = new Context(container);
|
|
1606
|
-
return _createSubRequests(metadataReader, avoidConstraints, serviceIdentifier, context, null, _createTarget(isMultiInject, targetType, serviceIdentifier, "", key, value)), context;
|
|
1607
|
-
}
|
|
1608
|
-
function createMockRequest(container, serviceIdentifier, key, value) {
|
|
1609
|
-
var target = new Target(TargetTypeEnum.Variable, "", serviceIdentifier, new Metadata(key, value)),
|
|
1610
|
-
context = new Context(container);
|
|
1611
|
-
return new Request(serviceIdentifier, context, null, [], target);
|
|
1612
|
-
}
|
|
1613
|
-
|
|
1614
|
-
function isPromise(object) {
|
|
1615
|
-
return ("object" == _typeof(object) && null !== object || "function" == typeof object) && "function" == typeof object.then;
|
|
1616
|
-
}
|
|
1617
|
-
function isPromiseOrContainsPromise(object) {
|
|
1618
|
-
return !!isPromise(object) || Array.isArray(object) && object.some(isPromise);
|
|
1619
|
-
}
|
|
1620
|
-
|
|
1621
|
-
var __awaiter$6 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
1622
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1623
|
-
function fulfilled(value) {
|
|
1624
|
-
try {
|
|
1625
|
-
step(generator.next(value));
|
|
1626
|
-
} catch (e) {
|
|
1627
|
-
reject(e);
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
function rejected(value) {
|
|
1631
|
-
try {
|
|
1632
|
-
step(generator["throw"](value));
|
|
1633
|
-
} catch (e) {
|
|
1634
|
-
reject(e);
|
|
1635
|
-
}
|
|
1636
|
-
}
|
|
1637
|
-
function step(result) {
|
|
1638
|
-
var value;
|
|
1639
|
-
result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P(function (resolve) {
|
|
1640
|
-
resolve(value);
|
|
1641
|
-
})).then(fulfilled, rejected);
|
|
1642
|
-
}
|
|
1643
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1644
|
-
});
|
|
1645
|
-
};
|
|
1646
|
-
var tryGetFromScope = function tryGetFromScope(requestScope, binding) {
|
|
1647
|
-
return binding.scope === BindingScopeEnum.Singleton && binding.activated ? binding.cache : binding.scope === BindingScopeEnum.Request && requestScope.has(binding.id) ? requestScope.get(binding.id) : null;
|
|
1648
|
-
};
|
|
1649
|
-
var saveToScope = function saveToScope(requestScope, binding, result) {
|
|
1650
|
-
binding.scope === BindingScopeEnum.Singleton && _saveToSingletonScope(binding, result), binding.scope === BindingScopeEnum.Request && _saveToRequestScope(requestScope, binding, result);
|
|
1651
|
-
};
|
|
1652
|
-
var _saveToRequestScope = function _saveToRequestScope(requestScope, binding, result) {
|
|
1653
|
-
requestScope.has(binding.id) || requestScope.set(binding.id, result);
|
|
1654
|
-
},
|
|
1655
|
-
_saveToSingletonScope = function _saveToSingletonScope(binding, result) {
|
|
1656
|
-
binding.cache = result, binding.activated = !0, isPromise(result) && _saveAsyncResultToSingletonScope(binding, result);
|
|
1657
|
-
},
|
|
1658
|
-
_saveAsyncResultToSingletonScope = function _saveAsyncResultToSingletonScope(binding, asyncResult) {
|
|
1659
|
-
return __awaiter$6(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1660
|
-
var result;
|
|
1661
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1662
|
-
while (1) switch (_context.prev = _context.next) {
|
|
1663
|
-
case 0:
|
|
1664
|
-
_context.prev = 0;
|
|
1665
|
-
_context.next = 3;
|
|
1666
|
-
return asyncResult;
|
|
1667
|
-
case 3:
|
|
1668
|
-
result = _context.sent;
|
|
1669
|
-
binding.cache = result;
|
|
1670
|
-
_context.next = 10;
|
|
1671
|
-
break;
|
|
1672
|
-
case 7:
|
|
1673
|
-
_context.prev = 7;
|
|
1674
|
-
_context.t0 = _context["catch"](0);
|
|
1675
|
-
throw binding.cache = null, binding.activated = !1, _context.t0;
|
|
1676
|
-
case 10:
|
|
1677
|
-
case "end":
|
|
1678
|
-
return _context.stop();
|
|
1679
|
-
}
|
|
1680
|
-
}, _callee, null, [[0, 7]]);
|
|
1681
|
-
}));
|
|
1682
|
-
};
|
|
1683
|
-
|
|
1684
|
-
var FactoryType;
|
|
1685
|
-
!function (FactoryType) {
|
|
1686
|
-
FactoryType.DynamicValue = "toDynamicValue", FactoryType.Factory = "toFactory", FactoryType.Provider = "toProvider";
|
|
1687
|
-
}(FactoryType || (FactoryType = {}));
|
|
1688
|
-
|
|
1689
|
-
var ensureFullyBound = function ensureFullyBound(binding) {
|
|
1690
|
-
var boundValue = null;
|
|
1691
|
-
switch (binding.type) {
|
|
1692
|
-
case BindingTypeEnum.ConstantValue:
|
|
1693
|
-
case BindingTypeEnum.Function:
|
|
1694
|
-
boundValue = binding.cache;
|
|
1695
|
-
break;
|
|
1696
|
-
case BindingTypeEnum.Constructor:
|
|
1697
|
-
case BindingTypeEnum.Instance:
|
|
1698
|
-
boundValue = binding.implementationType;
|
|
1699
|
-
break;
|
|
1700
|
-
case BindingTypeEnum.DynamicValue:
|
|
1701
|
-
boundValue = binding.dynamicValue;
|
|
1702
|
-
break;
|
|
1703
|
-
case BindingTypeEnum.Provider:
|
|
1704
|
-
boundValue = binding.provider;
|
|
1705
|
-
break;
|
|
1706
|
-
case BindingTypeEnum.Factory:
|
|
1707
|
-
boundValue = binding.factory;
|
|
1708
|
-
}
|
|
1709
|
-
if (null === boundValue) {
|
|
1710
|
-
var serviceIdentifierAsString = getServiceIdentifierAsString(binding.serviceIdentifier);
|
|
1711
|
-
throw new Error("".concat(INVALID_BINDING_TYPE, " ").concat(serviceIdentifierAsString));
|
|
1712
|
-
}
|
|
1713
|
-
};
|
|
1714
|
-
var getFactoryDetails = function getFactoryDetails(binding) {
|
|
1715
|
-
switch (binding.type) {
|
|
1716
|
-
case BindingTypeEnum.Factory:
|
|
1717
|
-
return {
|
|
1718
|
-
factory: binding.factory,
|
|
1719
|
-
factoryType: FactoryType.Factory
|
|
1720
|
-
};
|
|
1721
|
-
case BindingTypeEnum.Provider:
|
|
1722
|
-
return {
|
|
1723
|
-
factory: binding.provider,
|
|
1724
|
-
factoryType: FactoryType.Provider
|
|
1725
|
-
};
|
|
1726
|
-
case BindingTypeEnum.DynamicValue:
|
|
1727
|
-
return {
|
|
1728
|
-
factory: binding.dynamicValue,
|
|
1729
|
-
factoryType: FactoryType.DynamicValue
|
|
1730
|
-
};
|
|
1731
|
-
default:
|
|
1732
|
-
throw new Error("Unexpected factory type ".concat(binding.type));
|
|
1733
|
-
}
|
|
1734
|
-
};
|
|
1735
|
-
|
|
1736
|
-
var tryAndThrowErrorIfStackOverflow = function tryAndThrowErrorIfStackOverflow(fn, errorCallback) {
|
|
1737
|
-
return fn();
|
|
1738
|
-
};
|
|
1739
|
-
|
|
1740
|
-
var __awaiter$5 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
1741
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1742
|
-
function fulfilled(value) {
|
|
1743
|
-
try {
|
|
1744
|
-
step(generator.next(value));
|
|
1745
|
-
} catch (e) {
|
|
1746
|
-
reject(e);
|
|
1747
|
-
}
|
|
1748
|
-
}
|
|
1749
|
-
function rejected(value) {
|
|
1750
|
-
try {
|
|
1751
|
-
step(generator["throw"](value));
|
|
1752
|
-
} catch (e) {
|
|
1753
|
-
reject(e);
|
|
1754
|
-
}
|
|
1755
|
-
}
|
|
1756
|
-
function step(result) {
|
|
1757
|
-
var value;
|
|
1758
|
-
result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P(function (resolve) {
|
|
1759
|
-
resolve(value);
|
|
1760
|
-
})).then(fulfilled, rejected);
|
|
1761
|
-
}
|
|
1762
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1763
|
-
});
|
|
1764
|
-
};
|
|
1765
|
-
function _resolveRequests(childRequests, resolveRequest) {
|
|
1766
|
-
return childRequests.reduce(function (resolvedRequests, childRequest) {
|
|
1767
|
-
var injection = resolveRequest(childRequest);
|
|
1768
|
-
return childRequest.target.type === TargetTypeEnum.ConstructorArgument ? resolvedRequests.constructorInjections.push(injection) : (resolvedRequests.propertyRequests.push(childRequest), resolvedRequests.propertyInjections.push(injection)), resolvedRequests.isAsync || (resolvedRequests.isAsync = isPromiseOrContainsPromise(injection)), resolvedRequests;
|
|
1769
|
-
}, {
|
|
1770
|
-
constructorInjections: [],
|
|
1771
|
-
propertyInjections: [],
|
|
1772
|
-
propertyRequests: [],
|
|
1773
|
-
isAsync: !1
|
|
1774
|
-
});
|
|
1775
|
-
}
|
|
1776
|
-
function _createInstance(constr, childRequests, resolveRequest) {
|
|
1777
|
-
var result;
|
|
1778
|
-
if (childRequests.length > 0) {
|
|
1779
|
-
var resolved = _resolveRequests(childRequests, resolveRequest),
|
|
1780
|
-
createInstanceWithInjectionsArg = Object.assign(Object.assign({}, resolved), {
|
|
1781
|
-
constr: constr
|
|
1782
|
-
});
|
|
1783
|
-
result = resolved.isAsync ? createInstanceWithInjectionsAsync(createInstanceWithInjectionsArg) : createInstanceWithInjections(createInstanceWithInjectionsArg);
|
|
1784
|
-
} else result = new constr();
|
|
1785
|
-
return result;
|
|
1786
|
-
}
|
|
1787
|
-
function createInstanceWithInjections(args) {
|
|
1788
|
-
var instance = _construct(args.constr, _toConsumableArray(args.constructorInjections));
|
|
1789
|
-
return args.propertyRequests.forEach(function (r, index) {
|
|
1790
|
-
var property = r.target.identifier,
|
|
1791
|
-
injection = args.propertyInjections[index];
|
|
1792
|
-
instance[property] = injection;
|
|
1793
|
-
}), instance;
|
|
1794
|
-
}
|
|
1795
|
-
function createInstanceWithInjectionsAsync(args) {
|
|
1796
|
-
return __awaiter$5(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1797
|
-
var constructorInjections, propertyInjections;
|
|
1798
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1799
|
-
while (1) switch (_context.prev = _context.next) {
|
|
1800
|
-
case 0:
|
|
1801
|
-
_context.next = 2;
|
|
1802
|
-
return possiblyWaitInjections(args.constructorInjections);
|
|
1803
|
-
case 2:
|
|
1804
|
-
constructorInjections = _context.sent;
|
|
1805
|
-
_context.next = 5;
|
|
1806
|
-
return possiblyWaitInjections(args.propertyInjections);
|
|
1807
|
-
case 5:
|
|
1808
|
-
propertyInjections = _context.sent;
|
|
1809
|
-
return _context.abrupt("return", createInstanceWithInjections(Object.assign(Object.assign({}, args), {
|
|
1810
|
-
constructorInjections: constructorInjections,
|
|
1811
|
-
propertyInjections: propertyInjections
|
|
1812
|
-
})));
|
|
1813
|
-
case 7:
|
|
1814
|
-
case "end":
|
|
1815
|
-
return _context.stop();
|
|
1816
|
-
}
|
|
1817
|
-
}, _callee);
|
|
1818
|
-
}));
|
|
1819
|
-
}
|
|
1820
|
-
function possiblyWaitInjections(possiblePromiseinjections) {
|
|
1821
|
-
return __awaiter$5(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
1822
|
-
var injections, _iterator, _step, injection;
|
|
1823
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1824
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
1825
|
-
case 0:
|
|
1826
|
-
injections = [];
|
|
1827
|
-
_iterator = _createForOfIteratorHelper(possiblePromiseinjections);
|
|
1828
|
-
try {
|
|
1829
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1830
|
-
injection = _step.value;
|
|
1831
|
-
Array.isArray(injection) ? injections.push(Promise.all(injection)) : injections.push(injection);
|
|
1832
|
-
}
|
|
1833
|
-
} catch (err) {
|
|
1834
|
-
_iterator.e(err);
|
|
1835
|
-
} finally {
|
|
1836
|
-
_iterator.f();
|
|
1837
|
-
}
|
|
1838
|
-
return _context2.abrupt("return", Promise.all(injections));
|
|
1839
|
-
case 4:
|
|
1840
|
-
case "end":
|
|
1841
|
-
return _context2.stop();
|
|
1842
|
-
}
|
|
1843
|
-
}, _callee2);
|
|
1844
|
-
}));
|
|
1845
|
-
}
|
|
1846
|
-
function _getInstanceAfterPostConstruct(constr, result) {
|
|
1847
|
-
var postConstructResult = _postConstruct(constr, result);
|
|
1848
|
-
return isPromise(postConstructResult) ? postConstructResult.then(function () {
|
|
1849
|
-
return result;
|
|
1850
|
-
}) : result;
|
|
1851
|
-
}
|
|
1852
|
-
function _postConstruct(constr, instance) {
|
|
1853
|
-
var _a, _b;
|
|
1854
|
-
if (Reflect$2.hasMetadata(POST_CONSTRUCT, constr)) {
|
|
1855
|
-
return null === (_b = (_a = instance)[Reflect$2.getMetadata(POST_CONSTRUCT, constr).value]) || void 0 === _b ? void 0 : _b.call(_a);
|
|
1856
|
-
}
|
|
1857
|
-
}
|
|
1858
|
-
function _validateInstanceResolution(binding, constr) {
|
|
1859
|
-
binding.scope !== BindingScopeEnum.Singleton && _throwIfHandlingDeactivation(binding, constr);
|
|
1860
|
-
}
|
|
1861
|
-
function _throwIfHandlingDeactivation(binding, constr) {
|
|
1862
|
-
var scopeErrorMessage = "Class cannot be instantiated in ".concat(binding.scope === BindingScopeEnum.Request ? "request" : "transient", " scope.");
|
|
1863
|
-
if ("function" == typeof binding.onDeactivation) throw new Error(ON_DEACTIVATION_ERROR(constr.name, scopeErrorMessage));
|
|
1864
|
-
if (Reflect$2.hasMetadata(PRE_DESTROY, constr)) throw new Error(PRE_DESTROY_ERROR(constr.name, scopeErrorMessage));
|
|
1865
|
-
}
|
|
1866
|
-
function resolveInstance(binding, constr, childRequests, resolveRequest) {
|
|
1867
|
-
_validateInstanceResolution(binding, constr);
|
|
1868
|
-
var result = _createInstance(constr, childRequests, resolveRequest);
|
|
1869
|
-
return isPromise(result) ? result.then(function (resolvedResult) {
|
|
1870
|
-
return _getInstanceAfterPostConstruct(constr, resolvedResult);
|
|
1871
|
-
}) : _getInstanceAfterPostConstruct(constr, result);
|
|
1872
|
-
}
|
|
1873
|
-
|
|
1874
|
-
var _resolveRequest = function _resolveRequest(requestScope) {
|
|
1875
|
-
return function (request) {
|
|
1876
|
-
request.parentContext.setCurrentRequest(request);
|
|
1877
|
-
var bindings = request.bindings,
|
|
1878
|
-
childRequests = request.childRequests,
|
|
1879
|
-
targetIsAnArray = request.target && request.target.isArray(),
|
|
1880
|
-
targetParentIsNotAnArray = !(request.parentRequest && request.parentRequest.target && request.target && request.parentRequest.target.matchesArray(request.target.serviceIdentifier));
|
|
1881
|
-
if (targetIsAnArray && targetParentIsNotAnArray) return childRequests.map(function (childRequest) {
|
|
1882
|
-
return _resolveRequest(requestScope)(childRequest);
|
|
1883
|
-
});
|
|
1884
|
-
if (request.target.isOptional() && 0 === bindings.length) return;
|
|
1885
|
-
var binding = bindings[0];
|
|
1886
|
-
return _resolveBinding(requestScope, request, binding);
|
|
1887
|
-
};
|
|
1888
|
-
},
|
|
1889
|
-
_resolveFactoryFromBinding = function _resolveFactoryFromBinding(binding, context) {
|
|
1890
|
-
var factoryDetails = getFactoryDetails(binding);
|
|
1891
|
-
return tryAndThrowErrorIfStackOverflow(function () {
|
|
1892
|
-
return factoryDetails.factory.bind(binding)(context);
|
|
1893
|
-
});
|
|
1894
|
-
},
|
|
1895
|
-
_getResolvedFromBinding = function _getResolvedFromBinding(requestScope, request, binding) {
|
|
1896
|
-
var result;
|
|
1897
|
-
var childRequests = request.childRequests;
|
|
1898
|
-
switch (ensureFullyBound(binding), binding.type) {
|
|
1899
|
-
case BindingTypeEnum.ConstantValue:
|
|
1900
|
-
case BindingTypeEnum.Function:
|
|
1901
|
-
result = binding.cache;
|
|
1902
|
-
break;
|
|
1903
|
-
case BindingTypeEnum.Constructor:
|
|
1904
|
-
result = binding.implementationType;
|
|
1905
|
-
break;
|
|
1906
|
-
case BindingTypeEnum.Instance:
|
|
1907
|
-
result = resolveInstance(binding, binding.implementationType, childRequests, _resolveRequest(requestScope));
|
|
1908
|
-
break;
|
|
1909
|
-
default:
|
|
1910
|
-
result = _resolveFactoryFromBinding(binding, request.parentContext);
|
|
1911
|
-
}
|
|
1912
|
-
return result;
|
|
1913
|
-
},
|
|
1914
|
-
_resolveInScope = function _resolveInScope(requestScope, binding, resolveFromBinding) {
|
|
1915
|
-
var result = tryGetFromScope(requestScope, binding);
|
|
1916
|
-
return null !== result || (result = resolveFromBinding(), saveToScope(requestScope, binding, result)), result;
|
|
1917
|
-
},
|
|
1918
|
-
_resolveBinding = function _resolveBinding(requestScope, request, binding) {
|
|
1919
|
-
return _resolveInScope(requestScope, binding, function () {
|
|
1920
|
-
return _getResolvedFromBinding(requestScope, request, binding);
|
|
1921
|
-
});
|
|
1922
|
-
};
|
|
1923
|
-
function resolve(context) {
|
|
1924
|
-
return _resolveRequest(context.plan.rootRequest.requestScope)(context.plan.rootRequest);
|
|
1925
|
-
}
|
|
1926
|
-
|
|
1927
|
-
var BindingOnSyntax = /*#__PURE__*/_createClass(function BindingOnSyntax(binding) {
|
|
1928
|
-
_classCallCheck(this, BindingOnSyntax);
|
|
1929
|
-
this._binding = binding;
|
|
1930
|
-
});
|
|
1931
|
-
|
|
1932
|
-
var taggedConstraint = function taggedConstraint(key) {
|
|
1933
|
-
return function (value) {
|
|
1934
|
-
var constraint = function constraint(request) {
|
|
1935
|
-
return null !== request && null !== request.target && request.target.matchesTag(key)(value);
|
|
1936
|
-
};
|
|
1937
|
-
return constraint.metaData = new Metadata(key, value), constraint;
|
|
1938
|
-
};
|
|
1939
|
-
},
|
|
1940
|
-
namedConstraint = taggedConstraint(NAMED_TAG);
|
|
1941
|
-
|
|
1942
|
-
var BindingWhenSyntax = /*#__PURE__*/function () {
|
|
1943
|
-
function BindingWhenSyntax(binding) {
|
|
1944
|
-
_classCallCheck(this, BindingWhenSyntax);
|
|
1945
|
-
this._binding = binding;
|
|
1946
|
-
}
|
|
1947
|
-
_createClass(BindingWhenSyntax, [{
|
|
1948
|
-
key: "whenTargetNamed",
|
|
1949
|
-
value: function whenTargetNamed(name) {
|
|
1950
|
-
return this._binding.constraint = namedConstraint(name), new BindingOnSyntax(this._binding);
|
|
1951
|
-
}
|
|
1952
|
-
}]);
|
|
1953
|
-
return BindingWhenSyntax;
|
|
1954
|
-
}();
|
|
1955
|
-
|
|
1956
|
-
var BindingWhenOnSyntax = /*#__PURE__*/function () {
|
|
1957
|
-
function BindingWhenOnSyntax(binding) {
|
|
1958
|
-
_classCallCheck(this, BindingWhenOnSyntax);
|
|
1959
|
-
this._binding = binding, this._bindingWhenSyntax = new BindingWhenSyntax(this._binding);
|
|
1960
|
-
}
|
|
1961
|
-
_createClass(BindingWhenOnSyntax, [{
|
|
1962
|
-
key: "whenTargetNamed",
|
|
1963
|
-
value: function whenTargetNamed(name) {
|
|
1964
|
-
return this._bindingWhenSyntax.whenTargetNamed(name);
|
|
1965
|
-
}
|
|
1966
|
-
}]);
|
|
1967
|
-
return BindingWhenOnSyntax;
|
|
1968
|
-
}();
|
|
1969
|
-
|
|
1970
|
-
var BindingInSyntax = /*#__PURE__*/function () {
|
|
1971
|
-
function BindingInSyntax(binding) {
|
|
1972
|
-
_classCallCheck(this, BindingInSyntax);
|
|
1973
|
-
this._binding = binding;
|
|
1974
|
-
}
|
|
1975
|
-
_createClass(BindingInSyntax, [{
|
|
1976
|
-
key: "inRequestScope",
|
|
1977
|
-
value: function inRequestScope() {
|
|
1978
|
-
return this._binding.scope = BindingScopeEnum.Request, new BindingWhenOnSyntax(this._binding);
|
|
1979
|
-
}
|
|
1980
|
-
}, {
|
|
1981
|
-
key: "inSingletonScope",
|
|
1982
|
-
value: function inSingletonScope() {
|
|
1983
|
-
return this._binding.scope = BindingScopeEnum.Singleton, new BindingWhenOnSyntax(this._binding);
|
|
1984
|
-
}
|
|
1985
|
-
}, {
|
|
1986
|
-
key: "inTransientScope",
|
|
1987
|
-
value: function inTransientScope() {
|
|
1988
|
-
return this._binding.scope = BindingScopeEnum.Transient, new BindingWhenOnSyntax(this._binding);
|
|
1989
|
-
}
|
|
1990
|
-
}]);
|
|
1991
|
-
return BindingInSyntax;
|
|
1992
|
-
}();
|
|
1993
|
-
|
|
1994
|
-
var BindingInWhenOnSyntax = /*#__PURE__*/function () {
|
|
1995
|
-
function BindingInWhenOnSyntax(binding) {
|
|
1996
|
-
_classCallCheck(this, BindingInWhenOnSyntax);
|
|
1997
|
-
this._binding = binding, this._bindingWhenSyntax = new BindingWhenSyntax(this._binding), this._bindingInSyntax = new BindingInSyntax(binding);
|
|
1998
|
-
}
|
|
1999
|
-
_createClass(BindingInWhenOnSyntax, [{
|
|
2000
|
-
key: "inRequestScope",
|
|
2001
|
-
value: function inRequestScope() {
|
|
2002
|
-
return this._bindingInSyntax.inRequestScope();
|
|
2003
|
-
}
|
|
2004
|
-
}, {
|
|
2005
|
-
key: "inSingletonScope",
|
|
2006
|
-
value: function inSingletonScope() {
|
|
2007
|
-
return this._bindingInSyntax.inSingletonScope();
|
|
2008
|
-
}
|
|
2009
|
-
}, {
|
|
2010
|
-
key: "inTransientScope",
|
|
2011
|
-
value: function inTransientScope() {
|
|
2012
|
-
return this._bindingInSyntax.inTransientScope();
|
|
2013
|
-
}
|
|
2014
|
-
}, {
|
|
2015
|
-
key: "whenTargetNamed",
|
|
2016
|
-
value: function whenTargetNamed(name) {
|
|
2017
|
-
return this._bindingWhenSyntax.whenTargetNamed(name);
|
|
2018
|
-
}
|
|
2019
|
-
}]);
|
|
2020
|
-
return BindingInWhenOnSyntax;
|
|
2021
|
-
}();
|
|
2022
|
-
|
|
2023
|
-
var BindingToSyntax = /*#__PURE__*/function () {
|
|
2024
|
-
function BindingToSyntax(binding) {
|
|
2025
|
-
_classCallCheck(this, BindingToSyntax);
|
|
2026
|
-
this._binding = binding;
|
|
2027
|
-
}
|
|
2028
|
-
_createClass(BindingToSyntax, [{
|
|
2029
|
-
key: "to",
|
|
2030
|
-
value: function to(constructor) {
|
|
2031
|
-
return this._binding.type = BindingTypeEnum.Instance, this._binding.implementationType = constructor, new BindingInWhenOnSyntax(this._binding);
|
|
2032
|
-
}
|
|
2033
|
-
}, {
|
|
2034
|
-
key: "toSelf",
|
|
2035
|
-
value: function toSelf() {
|
|
2036
|
-
if ("function" != typeof this._binding.serviceIdentifier) throw new Error("".concat(INVALID_TO_SELF_VALUE));
|
|
2037
|
-
var self = this._binding.serviceIdentifier;
|
|
2038
|
-
return this.to(self);
|
|
2039
|
-
}
|
|
2040
|
-
}, {
|
|
2041
|
-
key: "toConstantValue",
|
|
2042
|
-
value: function toConstantValue(value) {
|
|
2043
|
-
return this._binding.type = BindingTypeEnum.ConstantValue, this._binding.cache = value, this._binding.dynamicValue = null, this._binding.implementationType = null, this._binding.scope = BindingScopeEnum.Singleton, new BindingWhenOnSyntax(this._binding);
|
|
2044
|
-
}
|
|
2045
|
-
}, {
|
|
2046
|
-
key: "toDynamicValue",
|
|
2047
|
-
value: function toDynamicValue(func) {
|
|
2048
|
-
return this._binding.type = BindingTypeEnum.DynamicValue, this._binding.cache = null, this._binding.dynamicValue = func, this._binding.implementationType = null, new BindingInWhenOnSyntax(this._binding);
|
|
2049
|
-
}
|
|
2050
|
-
}, {
|
|
2051
|
-
key: "toConstructor",
|
|
2052
|
-
value: function toConstructor(constructor) {
|
|
2053
|
-
return this._binding.type = BindingTypeEnum.Constructor, this._binding.implementationType = constructor, this._binding.scope = BindingScopeEnum.Singleton, new BindingWhenOnSyntax(this._binding);
|
|
2054
|
-
}
|
|
2055
|
-
}, {
|
|
2056
|
-
key: "toFactory",
|
|
2057
|
-
value: function toFactory(factory) {
|
|
2058
|
-
return this._binding.type = BindingTypeEnum.Factory, this._binding.factory = factory, this._binding.scope = BindingScopeEnum.Singleton, new BindingWhenOnSyntax(this._binding);
|
|
2059
|
-
}
|
|
2060
|
-
}, {
|
|
2061
|
-
key: "toFunction",
|
|
2062
|
-
value: function toFunction(func) {
|
|
2063
|
-
if ("function" != typeof func) throw new Error(INVALID_FUNCTION_BINDING);
|
|
2064
|
-
var bindingWhenOnSyntax = this.toConstantValue(func);
|
|
2065
|
-
return this._binding.type = BindingTypeEnum.Function, this._binding.scope = BindingScopeEnum.Singleton, bindingWhenOnSyntax;
|
|
2066
|
-
}
|
|
2067
|
-
}, {
|
|
2068
|
-
key: "toAutoFactory",
|
|
2069
|
-
value: function toAutoFactory(serviceIdentifier) {
|
|
2070
|
-
return this._binding.type = BindingTypeEnum.Factory, this._binding.factory = function (context) {
|
|
2071
|
-
return function () {
|
|
2072
|
-
return context.container.get(serviceIdentifier);
|
|
2073
|
-
};
|
|
2074
|
-
}, this._binding.scope = BindingScopeEnum.Singleton, new BindingWhenOnSyntax(this._binding);
|
|
2075
|
-
}
|
|
2076
|
-
}, {
|
|
2077
|
-
key: "toAutoNamedFactory",
|
|
2078
|
-
value: function toAutoNamedFactory(serviceIdentifier) {
|
|
2079
|
-
return this._binding.type = BindingTypeEnum.Factory, this._binding.factory = function (context) {
|
|
2080
|
-
return function (named) {
|
|
2081
|
-
return context.container.getNamed(serviceIdentifier, named);
|
|
2082
|
-
};
|
|
2083
|
-
}, new BindingWhenOnSyntax(this._binding);
|
|
2084
|
-
}
|
|
2085
|
-
}, {
|
|
2086
|
-
key: "toProvider",
|
|
2087
|
-
value: function toProvider(provider) {
|
|
2088
|
-
return this._binding.type = BindingTypeEnum.Provider, this._binding.provider = provider, this._binding.scope = BindingScopeEnum.Singleton, new BindingWhenOnSyntax(this._binding);
|
|
2089
|
-
}
|
|
2090
|
-
}, {
|
|
2091
|
-
key: "toService",
|
|
2092
|
-
value: function toService(service) {
|
|
2093
|
-
this.toDynamicValue(function (context) {
|
|
2094
|
-
return context.container.get(service);
|
|
2095
|
-
});
|
|
2096
|
-
}
|
|
2097
|
-
}]);
|
|
2098
|
-
return BindingToSyntax;
|
|
2099
|
-
}();
|
|
2100
|
-
|
|
2101
|
-
function isClonable(obj) {
|
|
2102
|
-
return "object" == _typeof(obj) && null !== obj && "clone" in obj && "function" == typeof obj.clone;
|
|
2103
|
-
}
|
|
2104
|
-
|
|
2105
|
-
var Lookup = /*#__PURE__*/function () {
|
|
2106
|
-
function Lookup() {
|
|
2107
|
-
_classCallCheck(this, Lookup);
|
|
2108
|
-
this._map = new Map();
|
|
2109
|
-
}
|
|
2110
|
-
_createClass(Lookup, [{
|
|
2111
|
-
key: "getMap",
|
|
2112
|
-
value: function getMap() {
|
|
2113
|
-
return this._map;
|
|
2114
|
-
}
|
|
2115
|
-
}, {
|
|
2116
|
-
key: "add",
|
|
2117
|
-
value: function add(serviceIdentifier, value) {
|
|
2118
|
-
if (null == serviceIdentifier) throw new Error(NULL_ARGUMENT);
|
|
2119
|
-
if (null == value) throw new Error(NULL_ARGUMENT);
|
|
2120
|
-
var entry = this._map.get(serviceIdentifier);
|
|
2121
|
-
void 0 !== entry ? entry.push(value) : this._map.set(serviceIdentifier, [value]);
|
|
2122
|
-
}
|
|
2123
|
-
}, {
|
|
2124
|
-
key: "get",
|
|
2125
|
-
value: function get(serviceIdentifier) {
|
|
2126
|
-
if (null == serviceIdentifier) throw new Error(NULL_ARGUMENT);
|
|
2127
|
-
var entry = this._map.get(serviceIdentifier);
|
|
2128
|
-
if (void 0 !== entry) return entry;
|
|
2129
|
-
throw new Error(KEY_NOT_FOUND);
|
|
2130
|
-
}
|
|
2131
|
-
}, {
|
|
2132
|
-
key: "remove",
|
|
2133
|
-
value: function remove(serviceIdentifier) {
|
|
2134
|
-
if (null == serviceIdentifier) throw new Error(NULL_ARGUMENT);
|
|
2135
|
-
if (!this._map["delete"](serviceIdentifier)) throw new Error(KEY_NOT_FOUND);
|
|
2136
|
-
}
|
|
2137
|
-
}, {
|
|
2138
|
-
key: "removeIntersection",
|
|
2139
|
-
value: function removeIntersection(lookup) {
|
|
2140
|
-
var _this = this;
|
|
2141
|
-
this.traverse(function (serviceIdentifier, value) {
|
|
2142
|
-
var lookupActivations = lookup.hasKey(serviceIdentifier) ? lookup.get(serviceIdentifier) : void 0;
|
|
2143
|
-
if (void 0 !== lookupActivations) {
|
|
2144
|
-
var filteredValues = value.filter(function (lookupValue) {
|
|
2145
|
-
return !lookupActivations.some(function (moduleActivation) {
|
|
2146
|
-
return lookupValue === moduleActivation;
|
|
2147
|
-
});
|
|
2148
|
-
});
|
|
2149
|
-
_this._setValue(serviceIdentifier, filteredValues);
|
|
2150
|
-
}
|
|
2151
|
-
});
|
|
2152
|
-
}
|
|
2153
|
-
}, {
|
|
2154
|
-
key: "removeByCondition",
|
|
2155
|
-
value: function removeByCondition(condition) {
|
|
2156
|
-
var _this2 = this;
|
|
2157
|
-
var removals = [];
|
|
2158
|
-
return this._map.forEach(function (entries, key) {
|
|
2159
|
-
var updatedEntries = [];
|
|
2160
|
-
var _iterator = _createForOfIteratorHelper(entries),
|
|
2161
|
-
_step;
|
|
2162
|
-
try {
|
|
2163
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2164
|
-
var entry = _step.value;
|
|
2165
|
-
condition(entry) ? removals.push(entry) : updatedEntries.push(entry);
|
|
2166
|
-
}
|
|
2167
|
-
} catch (err) {
|
|
2168
|
-
_iterator.e(err);
|
|
2169
|
-
} finally {
|
|
2170
|
-
_iterator.f();
|
|
2171
|
-
}
|
|
2172
|
-
_this2._setValue(key, updatedEntries);
|
|
2173
|
-
}), removals;
|
|
2174
|
-
}
|
|
2175
|
-
}, {
|
|
2176
|
-
key: "hasKey",
|
|
2177
|
-
value: function hasKey(serviceIdentifier) {
|
|
2178
|
-
if (null == serviceIdentifier) throw new Error(NULL_ARGUMENT);
|
|
2179
|
-
return this._map.has(serviceIdentifier);
|
|
2180
|
-
}
|
|
2181
|
-
}, {
|
|
2182
|
-
key: "clone",
|
|
2183
|
-
value: function clone() {
|
|
2184
|
-
var copy = new Lookup();
|
|
2185
|
-
return this._map.forEach(function (value, key) {
|
|
2186
|
-
value.forEach(function (b) {
|
|
2187
|
-
return copy.add(key, isClonable(b) ? b.clone() : b);
|
|
2188
|
-
});
|
|
2189
|
-
}), copy;
|
|
2190
|
-
}
|
|
2191
|
-
}, {
|
|
2192
|
-
key: "traverse",
|
|
2193
|
-
value: function traverse(func) {
|
|
2194
|
-
this._map.forEach(function (value, key) {
|
|
2195
|
-
func(key, value);
|
|
2196
|
-
});
|
|
2197
|
-
}
|
|
2198
|
-
}, {
|
|
2199
|
-
key: "_setValue",
|
|
2200
|
-
value: function _setValue(serviceIdentifier, value) {
|
|
2201
|
-
value.length > 0 ? this._map.set(serviceIdentifier, value) : this._map["delete"](serviceIdentifier);
|
|
2202
|
-
}
|
|
2203
|
-
}]);
|
|
2204
|
-
return Lookup;
|
|
2205
|
-
}();
|
|
2206
|
-
|
|
2207
|
-
var __awaiter$4 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
2208
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2209
|
-
function fulfilled(value) {
|
|
2210
|
-
try {
|
|
2211
|
-
step(generator.next(value));
|
|
2212
|
-
} catch (e) {
|
|
2213
|
-
reject(e);
|
|
2214
|
-
}
|
|
2215
|
-
}
|
|
2216
|
-
function rejected(value) {
|
|
2217
|
-
try {
|
|
2218
|
-
step(generator["throw"](value));
|
|
2219
|
-
} catch (e) {
|
|
2220
|
-
reject(e);
|
|
2221
|
-
}
|
|
2222
|
-
}
|
|
2223
|
-
function step(result) {
|
|
2224
|
-
var value;
|
|
2225
|
-
result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P(function (resolve) {
|
|
2226
|
-
resolve(value);
|
|
2227
|
-
})).then(fulfilled, rejected);
|
|
2228
|
-
}
|
|
2229
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2230
|
-
});
|
|
2231
|
-
};
|
|
2232
|
-
var Container = /*#__PURE__*/function () {
|
|
2233
|
-
function Container(containerOptions) {
|
|
2234
|
-
_classCallCheck(this, Container);
|
|
2235
|
-
var options = containerOptions || {};
|
|
2236
|
-
if ("object" != _typeof(options)) throw new Error("".concat(CONTAINER_OPTIONS_MUST_BE_AN_OBJECT));
|
|
2237
|
-
if (void 0 === options.defaultScope) options.defaultScope = BindingScopeEnum.Transient;else if (options.defaultScope !== BindingScopeEnum.Singleton && options.defaultScope !== BindingScopeEnum.Transient && options.defaultScope !== BindingScopeEnum.Request) throw new Error("".concat(CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE));
|
|
2238
|
-
if (void 0 === options.autoBindInjectable) options.autoBindInjectable = !1;else if ("boolean" != typeof options.autoBindInjectable) throw new Error("".concat(CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE));
|
|
2239
|
-
if (void 0 === options.skipBaseClassChecks) options.skipBaseClassChecks = !1;else if ("boolean" != typeof options.skipBaseClassChecks) throw new Error("".concat(CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK));
|
|
2240
|
-
this.options = {
|
|
2241
|
-
autoBindInjectable: options.autoBindInjectable,
|
|
2242
|
-
defaultScope: options.defaultScope,
|
|
2243
|
-
skipBaseClassChecks: options.skipBaseClassChecks
|
|
2244
|
-
}, this.id = id(), this._bindingDictionary = new Lookup(), this.parent = null, this._metadataReader = new MetadataReader();
|
|
2245
|
-
}
|
|
2246
|
-
_createClass(Container, [{
|
|
2247
|
-
key: "load",
|
|
2248
|
-
value: function load() {
|
|
2249
|
-
var getHelpers = this._getContainerModuleHelpersFactory();
|
|
2250
|
-
for (var _len = arguments.length, modules = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
|
2251
|
-
modules[_key2] = arguments[_key2];
|
|
2252
|
-
}
|
|
2253
|
-
for (var _i = 0, _modules = modules; _i < _modules.length; _i++) {
|
|
2254
|
-
var currentModule = _modules[_i];
|
|
2255
|
-
var containerModuleHelpers = getHelpers(currentModule.id);
|
|
2256
|
-
currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction);
|
|
2257
|
-
}
|
|
2258
|
-
}
|
|
2259
|
-
}, {
|
|
2260
|
-
key: "unload",
|
|
2261
|
-
value: function unload() {
|
|
2262
|
-
var _this = this;
|
|
2263
|
-
for (var _len2 = arguments.length, modules = new Array(_len2), _key3 = 0; _key3 < _len2; _key3++) {
|
|
2264
|
-
modules[_key3] = arguments[_key3];
|
|
2265
|
-
}
|
|
2266
|
-
modules.forEach(function (module) {
|
|
2267
|
-
var deactivations = _this._removeModuleBindings(module.id);
|
|
2268
|
-
_this._deactivateSingletons(deactivations);
|
|
2269
|
-
});
|
|
2270
|
-
}
|
|
2271
|
-
}, {
|
|
2272
|
-
key: "bind",
|
|
2273
|
-
value: function bind(serviceIdentifier) {
|
|
2274
|
-
var scope = this.options.defaultScope || BindingScopeEnum.Transient,
|
|
2275
|
-
binding = new Binding(serviceIdentifier, scope);
|
|
2276
|
-
return this._bindingDictionary.add(serviceIdentifier, binding), new BindingToSyntax(binding);
|
|
2277
|
-
}
|
|
2278
|
-
}, {
|
|
2279
|
-
key: "rebind",
|
|
2280
|
-
value: function rebind(serviceIdentifier) {
|
|
2281
|
-
return this.unbind(serviceIdentifier), this.bind(serviceIdentifier);
|
|
2282
|
-
}
|
|
2283
|
-
}, {
|
|
2284
|
-
key: "unbind",
|
|
2285
|
-
value: function unbind(serviceIdentifier) {
|
|
2286
|
-
if (this._bindingDictionary.hasKey(serviceIdentifier)) {
|
|
2287
|
-
var bindings = this._bindingDictionary.get(serviceIdentifier);
|
|
2288
|
-
this._deactivateSingletons(bindings);
|
|
2289
|
-
}
|
|
2290
|
-
this._removeServiceFromDictionary(serviceIdentifier);
|
|
2291
|
-
}
|
|
2292
|
-
}, {
|
|
2293
|
-
key: "unbindAll",
|
|
2294
|
-
value: function unbindAll() {
|
|
2295
|
-
var _this2 = this;
|
|
2296
|
-
this._bindingDictionary.traverse(function (_key, value) {
|
|
2297
|
-
_this2._deactivateSingletons(value);
|
|
2298
|
-
}), this._bindingDictionary = new Lookup();
|
|
2299
|
-
}
|
|
2300
|
-
}, {
|
|
2301
|
-
key: "isBound",
|
|
2302
|
-
value: function isBound(serviceIdentifier) {
|
|
2303
|
-
var bound = this._bindingDictionary.hasKey(serviceIdentifier);
|
|
2304
|
-
return !bound && this.parent && (bound = this.parent.isBound(serviceIdentifier)), bound;
|
|
2305
|
-
}
|
|
2306
|
-
}, {
|
|
2307
|
-
key: "isCurrentBound",
|
|
2308
|
-
value: function isCurrentBound(serviceIdentifier) {
|
|
2309
|
-
return this._bindingDictionary.hasKey(serviceIdentifier);
|
|
2310
|
-
}
|
|
2311
|
-
}, {
|
|
2312
|
-
key: "isBoundNamed",
|
|
2313
|
-
value: function isBoundNamed(serviceIdentifier, named) {
|
|
2314
|
-
return this.isBoundTagged(serviceIdentifier, NAMED_TAG, named);
|
|
2315
|
-
}
|
|
2316
|
-
}, {
|
|
2317
|
-
key: "isBoundTagged",
|
|
2318
|
-
value: function isBoundTagged(serviceIdentifier, key, value) {
|
|
2319
|
-
var bound = !1;
|
|
2320
|
-
if (this._bindingDictionary.hasKey(serviceIdentifier)) {
|
|
2321
|
-
var bindings = this._bindingDictionary.get(serviceIdentifier),
|
|
2322
|
-
request = createMockRequest(this, serviceIdentifier, key, value);
|
|
2323
|
-
bound = bindings.some(function (b) {
|
|
2324
|
-
return b.constraint(request);
|
|
2325
|
-
});
|
|
2326
|
-
}
|
|
2327
|
-
return !bound && this.parent && (bound = this.parent.isBoundTagged(serviceIdentifier, key, value)), bound;
|
|
2328
|
-
}
|
|
2329
|
-
}, {
|
|
2330
|
-
key: "applyCustomMetadataReader",
|
|
2331
|
-
value: function applyCustomMetadataReader(metadataReader) {
|
|
2332
|
-
this._metadataReader = metadataReader;
|
|
2333
|
-
}
|
|
2334
|
-
}, {
|
|
2335
|
-
key: "get",
|
|
2336
|
-
value: function get(serviceIdentifier) {
|
|
2337
|
-
var getArgs = this._getNotAllArgs(serviceIdentifier, !1);
|
|
2338
|
-
return this._getButThrowIfAsync(getArgs);
|
|
2339
|
-
}
|
|
2340
|
-
}, {
|
|
2341
|
-
key: "getAsync",
|
|
2342
|
-
value: function getAsync(serviceIdentifier) {
|
|
2343
|
-
return __awaiter$4(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
2344
|
-
var getArgs;
|
|
2345
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2346
|
-
while (1) switch (_context.prev = _context.next) {
|
|
2347
|
-
case 0:
|
|
2348
|
-
getArgs = this._getNotAllArgs(serviceIdentifier, !1);
|
|
2349
|
-
return _context.abrupt("return", this._get(getArgs));
|
|
2350
|
-
case 2:
|
|
2351
|
-
case "end":
|
|
2352
|
-
return _context.stop();
|
|
2353
|
-
}
|
|
2354
|
-
}, _callee, this);
|
|
2355
|
-
}));
|
|
2356
|
-
}
|
|
2357
|
-
}, {
|
|
2358
|
-
key: "getTagged",
|
|
2359
|
-
value: function getTagged(serviceIdentifier, key, value) {
|
|
2360
|
-
var getArgs = this._getNotAllArgs(serviceIdentifier, !1, key, value);
|
|
2361
|
-
return this._getButThrowIfAsync(getArgs);
|
|
2362
|
-
}
|
|
2363
|
-
}, {
|
|
2364
|
-
key: "getNamed",
|
|
2365
|
-
value: function getNamed(serviceIdentifier, named) {
|
|
2366
|
-
return this.getTagged(serviceIdentifier, NAMED_TAG, named);
|
|
2367
|
-
}
|
|
2368
|
-
}, {
|
|
2369
|
-
key: "getAll",
|
|
2370
|
-
value: function getAll(serviceIdentifier) {
|
|
2371
|
-
var getArgs = this._getAllArgs(serviceIdentifier);
|
|
2372
|
-
return this._getButThrowIfAsync(getArgs);
|
|
2373
|
-
}
|
|
2374
|
-
}, {
|
|
2375
|
-
key: "getAllTagged",
|
|
2376
|
-
value: function getAllTagged(serviceIdentifier, key, value) {
|
|
2377
|
-
var getArgs = this._getNotAllArgs(serviceIdentifier, !0, key, value);
|
|
2378
|
-
return this._getButThrowIfAsync(getArgs);
|
|
2379
|
-
}
|
|
2380
|
-
}, {
|
|
2381
|
-
key: "getAllNamed",
|
|
2382
|
-
value: function getAllNamed(serviceIdentifier, named) {
|
|
2383
|
-
return this.getAllTagged(serviceIdentifier, NAMED_TAG, named);
|
|
2384
|
-
}
|
|
2385
|
-
}, {
|
|
2386
|
-
key: "resolve",
|
|
2387
|
-
value: function resolve(constructorFunction) {
|
|
2388
|
-
var isBound = this.isBound(constructorFunction);
|
|
2389
|
-
isBound || this.bind(constructorFunction).toSelf();
|
|
2390
|
-
var resolved = this.get(constructorFunction);
|
|
2391
|
-
return isBound || this.unbind(constructorFunction), resolved;
|
|
2392
|
-
}
|
|
2393
|
-
}, {
|
|
2394
|
-
key: "_preDestroy",
|
|
2395
|
-
value: function _preDestroy(constructor, instance) {
|
|
2396
|
-
var _a, _b;
|
|
2397
|
-
if (Reflect$2.hasMetadata(PRE_DESTROY, constructor)) {
|
|
2398
|
-
return null === (_b = (_a = instance)[Reflect$2.getMetadata(PRE_DESTROY, constructor).value]) || void 0 === _b ? void 0 : _b.call(_a);
|
|
2399
|
-
}
|
|
2400
|
-
}
|
|
2401
|
-
}, {
|
|
2402
|
-
key: "_removeModuleBindings",
|
|
2403
|
-
value: function _removeModuleBindings(moduleId) {
|
|
2404
|
-
return this._bindingDictionary.removeByCondition(function (binding) {
|
|
2405
|
-
return binding.moduleId === moduleId;
|
|
2406
|
-
});
|
|
2407
|
-
}
|
|
2408
|
-
}, {
|
|
2409
|
-
key: "_deactivate",
|
|
2410
|
-
value: function _deactivate(binding, instance) {
|
|
2411
|
-
var constructor = Object.getPrototypeOf(instance).constructor;
|
|
2412
|
-
try {
|
|
2413
|
-
var propagateDeactivationResult = this._propagateContainerDeactivationThenBindingAndPreDestroy(binding, instance, constructor);
|
|
2414
|
-
if (isPromise(propagateDeactivationResult)) return this._handleDeactivationError(propagateDeactivationResult, constructor);
|
|
2415
|
-
} catch (ex) {
|
|
2416
|
-
if (ex instanceof Error) throw new Error(ON_DEACTIVATION_ERROR(constructor.name, ex.message));
|
|
2417
|
-
}
|
|
2418
|
-
}
|
|
2419
|
-
}, {
|
|
2420
|
-
key: "_handleDeactivationError",
|
|
2421
|
-
value: function _handleDeactivationError(asyncResult, constructor) {
|
|
2422
|
-
return __awaiter$4(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
2423
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2424
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
2425
|
-
case 0:
|
|
2426
|
-
_context2.prev = 0;
|
|
2427
|
-
_context2.next = 3;
|
|
2428
|
-
return asyncResult;
|
|
2429
|
-
case 3:
|
|
2430
|
-
_context2.next = 9;
|
|
2431
|
-
break;
|
|
2432
|
-
case 5:
|
|
2433
|
-
_context2.prev = 5;
|
|
2434
|
-
_context2.t0 = _context2["catch"](0);
|
|
2435
|
-
if (!(_context2.t0 instanceof Error)) {
|
|
2436
|
-
_context2.next = 9;
|
|
2437
|
-
break;
|
|
2438
|
-
}
|
|
2439
|
-
throw new Error(ON_DEACTIVATION_ERROR(constructor.name, _context2.t0.message));
|
|
2440
|
-
case 9:
|
|
2441
|
-
case "end":
|
|
2442
|
-
return _context2.stop();
|
|
2443
|
-
}
|
|
2444
|
-
}, _callee2, null, [[0, 5]]);
|
|
2445
|
-
}));
|
|
2446
|
-
}
|
|
2447
|
-
}, {
|
|
2448
|
-
key: "_getContainerModuleHelpersFactory",
|
|
2449
|
-
value: function _getContainerModuleHelpersFactory() {
|
|
2450
|
-
var _this3 = this;
|
|
2451
1191
|
var setModuleId = function setModuleId(bindingToSyntax, moduleId) {
|
|
2452
1192
|
bindingToSyntax._binding.moduleId = moduleId;
|
|
2453
1193
|
},
|
|
2454
1194
|
getBindFunction = function getBindFunction(moduleId) {
|
|
2455
1195
|
return function (serviceIdentifier) {
|
|
2456
|
-
var bindingToSyntax =
|
|
1196
|
+
var bindingToSyntax = _this.bind(serviceIdentifier);
|
|
2457
1197
|
return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
|
|
2458
1198
|
};
|
|
2459
1199
|
},
|
|
2460
1200
|
getUnbindFunction = function getUnbindFunction() {
|
|
2461
1201
|
return function (serviceIdentifier) {
|
|
2462
|
-
return
|
|
1202
|
+
return _this.unbind(serviceIdentifier);
|
|
2463
1203
|
};
|
|
2464
1204
|
},
|
|
2465
1205
|
getIsboundFunction = function getIsboundFunction() {
|
|
2466
1206
|
return function (serviceIdentifier) {
|
|
2467
|
-
return
|
|
1207
|
+
return _this.isBound(serviceIdentifier);
|
|
2468
1208
|
};
|
|
2469
1209
|
},
|
|
2470
1210
|
getRebindFunction = function getRebindFunction(moduleId) {
|
|
2471
1211
|
return function (serviceIdentifier) {
|
|
2472
|
-
var bindingToSyntax =
|
|
1212
|
+
var bindingToSyntax = _this.rebind(serviceIdentifier);
|
|
2473
1213
|
return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
|
|
2474
1214
|
};
|
|
2475
1215
|
};
|
|
@@ -2485,31 +1225,6 @@
|
|
|
2485
1225
|
};
|
|
2486
1226
|
};
|
|
2487
1227
|
}
|
|
2488
|
-
}, {
|
|
2489
|
-
key: "_get",
|
|
2490
|
-
value: function _get(getArgs) {
|
|
2491
|
-
var planAndResolveArgs = Object.assign(Object.assign({}, getArgs), {
|
|
2492
|
-
contextInterceptor: function contextInterceptor(context) {
|
|
2493
|
-
return context;
|
|
2494
|
-
},
|
|
2495
|
-
targetType: TargetTypeEnum.Variable
|
|
2496
|
-
});
|
|
2497
|
-
return this._planAndResolve()(planAndResolveArgs);
|
|
2498
|
-
}
|
|
2499
|
-
}, {
|
|
2500
|
-
key: "_getButThrowIfAsync",
|
|
2501
|
-
value: function _getButThrowIfAsync(getArgs) {
|
|
2502
|
-
return this._get(getArgs);
|
|
2503
|
-
}
|
|
2504
|
-
}, {
|
|
2505
|
-
key: "_getAllArgs",
|
|
2506
|
-
value: function _getAllArgs(serviceIdentifier) {
|
|
2507
|
-
return {
|
|
2508
|
-
avoidConstraints: !0,
|
|
2509
|
-
isMultiInject: !0,
|
|
2510
|
-
serviceIdentifier: serviceIdentifier
|
|
2511
|
-
};
|
|
2512
|
-
}
|
|
2513
1228
|
}, {
|
|
2514
1229
|
key: "_getNotAllArgs",
|
|
2515
1230
|
value: function _getNotAllArgs(serviceIdentifier, isMultiInject, key, value) {
|
|
@@ -2522,125 +1237,119 @@
|
|
|
2522
1237
|
};
|
|
2523
1238
|
}
|
|
2524
1239
|
}, {
|
|
2525
|
-
key: "
|
|
2526
|
-
value: function
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
return resolve(context);
|
|
1240
|
+
key: "_getAllArgs",
|
|
1241
|
+
value: function _getAllArgs(serviceIdentifier) {
|
|
1242
|
+
return {
|
|
1243
|
+
avoidConstraints: !0,
|
|
1244
|
+
isMultiInject: !0,
|
|
1245
|
+
serviceIdentifier: serviceIdentifier
|
|
2532
1246
|
};
|
|
2533
1247
|
}
|
|
2534
1248
|
}, {
|
|
2535
|
-
key: "
|
|
2536
|
-
value: function
|
|
2537
|
-
var
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
1249
|
+
key: "_get",
|
|
1250
|
+
value: function _get(getArgs) {
|
|
1251
|
+
var _this2 = this;
|
|
1252
|
+
var result = [];
|
|
1253
|
+
return this._bindingDictionary.get(getArgs.serviceIdentifier).forEach(function (binding) {
|
|
1254
|
+
result.push(_this2._resolveFromBinding(binding));
|
|
1255
|
+
}), getArgs.isMultiInject || 1 !== result.length ? result : result[0];
|
|
2541
1256
|
}
|
|
2542
1257
|
}, {
|
|
2543
|
-
key: "
|
|
2544
|
-
value: function
|
|
2545
|
-
var
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
1258
|
+
key: "_getChildRequest",
|
|
1259
|
+
value: function _getChildRequest(binding) {
|
|
1260
|
+
var _this3 = this;
|
|
1261
|
+
var constr = binding.implementationType,
|
|
1262
|
+
_this$_metadataReader = this._metadataReader.getConstructorMetadata(constr),
|
|
1263
|
+
userGeneratedMetadata = _this$_metadataReader.userGeneratedMetadata,
|
|
1264
|
+
keys = Object.keys(userGeneratedMetadata),
|
|
1265
|
+
arr = [];
|
|
1266
|
+
var _loop = function _loop() {
|
|
1267
|
+
var constructorArgsMetadata = userGeneratedMetadata[i],
|
|
1268
|
+
targetMetadataMap = {};
|
|
1269
|
+
constructorArgsMetadata.forEach(function (md) {
|
|
1270
|
+
targetMetadataMap[md.key] = md.value;
|
|
1271
|
+
});
|
|
1272
|
+
var metadata = {
|
|
1273
|
+
inject: targetMetadataMap[INJECT_TAG],
|
|
1274
|
+
multiInject: targetMetadataMap[MULTI_INJECT_TAG]
|
|
1275
|
+
},
|
|
1276
|
+
injectIdentifier = metadata.inject || metadata.multiInject,
|
|
1277
|
+
target = {
|
|
1278
|
+
serviceIdentifier: injectIdentifier,
|
|
1279
|
+
constructorArgsMetadata: constructorArgsMetadata
|
|
1280
|
+
},
|
|
1281
|
+
request = {
|
|
1282
|
+
injectIdentifier: injectIdentifier,
|
|
1283
|
+
metadata: constructorArgsMetadata,
|
|
1284
|
+
bindings: _this3._bindingDictionary.get(injectIdentifier).filter(function (b) {
|
|
1285
|
+
return b.constraint(target);
|
|
1286
|
+
})
|
|
1287
|
+
};
|
|
1288
|
+
arr.push(request);
|
|
1289
|
+
};
|
|
1290
|
+
for (var i = 0; i < keys.length; i++) {
|
|
1291
|
+
_loop();
|
|
2557
1292
|
}
|
|
1293
|
+
return arr;
|
|
2558
1294
|
}
|
|
2559
1295
|
}, {
|
|
2560
|
-
key: "
|
|
2561
|
-
value: function
|
|
2562
|
-
|
|
1296
|
+
key: "_resolveFromBinding",
|
|
1297
|
+
value: function _resolveFromBinding(binding) {
|
|
1298
|
+
var result = this._getResolvedFromBinding(binding);
|
|
1299
|
+
return this._saveToScope(binding, result), result;
|
|
2563
1300
|
}
|
|
2564
1301
|
}, {
|
|
2565
|
-
key: "
|
|
2566
|
-
value: function
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
1302
|
+
key: "_getResolvedFromBinding",
|
|
1303
|
+
value: function _getResolvedFromBinding(binding) {
|
|
1304
|
+
var result;
|
|
1305
|
+
switch (binding.type) {
|
|
1306
|
+
case BindingTypeEnum.ConstantValue:
|
|
1307
|
+
case BindingTypeEnum.Function:
|
|
1308
|
+
result = binding.cache;
|
|
1309
|
+
break;
|
|
1310
|
+
case BindingTypeEnum.Instance:
|
|
1311
|
+
result = this._resolveInstance(binding, binding.implementationType);
|
|
1312
|
+
break;
|
|
1313
|
+
default:
|
|
1314
|
+
result = binding.dynamicValue({
|
|
1315
|
+
container: this
|
|
1316
|
+
});
|
|
2571
1317
|
}
|
|
1318
|
+
return result;
|
|
2572
1319
|
}
|
|
2573
1320
|
}, {
|
|
2574
|
-
key: "
|
|
2575
|
-
value: function
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
1321
|
+
key: "_resolveInstance",
|
|
1322
|
+
value: function _resolveInstance(binding, constr) {
|
|
1323
|
+
if (binding.activated) return binding.cache;
|
|
1324
|
+
var childRequests = this._getChildRequest(binding);
|
|
1325
|
+
return this._createInstance(constr, childRequests);
|
|
1326
|
+
}
|
|
1327
|
+
}, {
|
|
1328
|
+
key: "_createInstance",
|
|
1329
|
+
value: function _createInstance(constr, childRequests) {
|
|
1330
|
+
if (childRequests.length) {
|
|
1331
|
+
return _construct(constr, _toConsumableArray(this._resolveRequests(childRequests)));
|
|
2582
1332
|
}
|
|
2583
|
-
return
|
|
1333
|
+
return new constr();
|
|
2584
1334
|
}
|
|
2585
1335
|
}, {
|
|
2586
|
-
key: "
|
|
2587
|
-
value: function
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
_context3.next = 4;
|
|
2595
|
-
break;
|
|
2596
|
-
}
|
|
2597
|
-
_context3.next = 4;
|
|
2598
|
-
return binding.onDeactivation(instance);
|
|
2599
|
-
case 4:
|
|
2600
|
-
_context3.next = 6;
|
|
2601
|
-
return this._preDestroy(constructor, instance);
|
|
2602
|
-
case 6:
|
|
2603
|
-
case "end":
|
|
2604
|
-
return _context3.stop();
|
|
2605
|
-
}
|
|
2606
|
-
}, _callee3, this);
|
|
2607
|
-
}));
|
|
1336
|
+
key: "_resolveRequests",
|
|
1337
|
+
value: function _resolveRequests(childRequests) {
|
|
1338
|
+
var _this4 = this;
|
|
1339
|
+
return childRequests.map(function (request) {
|
|
1340
|
+
return request.bindings.length > 1 ? request.bindings.map(function (binding) {
|
|
1341
|
+
return _this4._resolveFromBinding(binding);
|
|
1342
|
+
}) : _this4._resolveFromBinding(request.bindings[0]);
|
|
1343
|
+
});
|
|
2608
1344
|
}
|
|
2609
|
-
}
|
|
2610
|
-
key: "
|
|
2611
|
-
value: function
|
|
2612
|
-
|
|
2613
|
-
containers[_key4 - 2] = arguments[_key4];
|
|
2614
|
-
}
|
|
2615
|
-
var container = new Container(),
|
|
2616
|
-
targetContainers = [container1, container2].concat(containers).map(function (targetContainer) {
|
|
2617
|
-
return getBindingDictionary(targetContainer);
|
|
2618
|
-
}),
|
|
2619
|
-
bindingDictionary = getBindingDictionary(container);
|
|
2620
|
-
return targetContainers.forEach(function (targetBindingDictionary) {
|
|
2621
|
-
var destination;
|
|
2622
|
-
destination = bindingDictionary, targetBindingDictionary.traverse(function (_key, value) {
|
|
2623
|
-
value.forEach(function (binding) {
|
|
2624
|
-
destination.add(binding.serviceIdentifier, binding.clone());
|
|
2625
|
-
});
|
|
2626
|
-
});
|
|
2627
|
-
}), container;
|
|
1345
|
+
}, {
|
|
1346
|
+
key: "_saveToScope",
|
|
1347
|
+
value: function _saveToScope(binding, result) {
|
|
1348
|
+
binding.scope === BindingScopeEnum.Singleton && (binding.cache = result, binding.activated = !0);
|
|
2628
1349
|
}
|
|
2629
|
-
}]);
|
|
2630
|
-
return Container;
|
|
2631
|
-
}();
|
|
2632
|
-
|
|
2633
|
-
function propertyEventDecorator(eventKey, errorMessage) {
|
|
2634
|
-
return function () {
|
|
2635
|
-
return function (target, propertyKey) {
|
|
2636
|
-
var metadata = new Metadata(eventKey, propertyKey);
|
|
2637
|
-
if (Reflect$2.hasOwnMetadata(eventKey, target.constructor)) throw new Error(errorMessage);
|
|
2638
|
-
Reflect$2.defineMetadata(eventKey, metadata, target.constructor);
|
|
2639
|
-
};
|
|
2640
|
-
};
|
|
2641
|
-
}
|
|
2642
|
-
|
|
2643
|
-
var postConstruct = propertyEventDecorator(POST_CONSTRUCT, MULTIPLE_POST_CONSTRUCT_METHODS);
|
|
1350
|
+
}]);
|
|
1351
|
+
return Container;
|
|
1352
|
+
}();
|
|
2644
1353
|
|
|
2645
1354
|
var ContributionProvider = Symbol("ContributionProvider");
|
|
2646
1355
|
var ContributionProviderCache = /*#__PURE__*/function () {
|
|
@@ -2763,7 +1472,7 @@
|
|
|
2763
1472
|
var EnvContribution = Symbol["for"]("EnvContribution");
|
|
2764
1473
|
var VGlobal = Symbol["for"]("VGlobal");
|
|
2765
1474
|
|
|
2766
|
-
var __decorate$
|
|
1475
|
+
var __decorate$G = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
2767
1476
|
var d,
|
|
2768
1477
|
c = arguments.length,
|
|
2769
1478
|
r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
@@ -2781,9 +1490,9 @@
|
|
|
2781
1490
|
var DefaultGlobal = /*#__PURE__*/function () {
|
|
2782
1491
|
function DefaultGlobal(contributions) {
|
|
2783
1492
|
_classCallCheck(this, DefaultGlobal);
|
|
2784
|
-
this.contributions = contributions, this.hooks = {
|
|
1493
|
+
this.contributions = contributions, this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
2785
1494
|
onSetEnv: new SyncHook(["lastEnv", "env", "global"])
|
|
2786
|
-
}, this.measureTextMethod = "native", this.optimizeVisible = !1;
|
|
1495
|
+
}, this.measureTextMethod = "native", this.optimizeVisible = !1, this.optmizeSkipCheckBoundariesThreshold = 0;
|
|
2787
1496
|
}
|
|
2788
1497
|
_createClass(DefaultGlobal, [{
|
|
2789
1498
|
key: "env",
|
|
@@ -3013,7 +1722,7 @@
|
|
|
3013
1722
|
}]);
|
|
3014
1723
|
return DefaultGlobal;
|
|
3015
1724
|
}();
|
|
3016
|
-
DefaultGlobal = __decorate$
|
|
1725
|
+
DefaultGlobal = __decorate$G([injectable(), __param$i(0, inject(ContributionProvider)), __param$i(0, named(EnvContribution)), __metadata$r("design:paramtypes", [Object])], DefaultGlobal);
|
|
3017
1726
|
|
|
3018
1727
|
var circleThreshold = vutils.tau - 1e-8;
|
|
3019
1728
|
var BoundsContext = /*#__PURE__*/function () {
|
|
@@ -4451,7 +3160,10 @@
|
|
|
4451
3160
|
direction: "horizontal",
|
|
4452
3161
|
wordBreak: "break-all",
|
|
4453
3162
|
ignoreBuf: !1,
|
|
4454
|
-
verticalMode: 0
|
|
3163
|
+
verticalMode: 0,
|
|
3164
|
+
whiteSpace: "no-wrap",
|
|
3165
|
+
heightLimit: 1 / 0,
|
|
3166
|
+
lineClamp: 1 / 0
|
|
4455
3167
|
};
|
|
4456
3168
|
var DefaultStyle = Object.assign(Object.assign(Object.assign({
|
|
4457
3169
|
opacity: 1,
|
|
@@ -4733,7 +3445,7 @@
|
|
|
4733
3445
|
return "number" != typeof measurement.actualBoundingBoxAscent || "number" != typeof measurement.actualBoundingBoxDescent ? (result.width = Math.floor(measurement.width), result.height = character.fontSize || 0, result.ascent = result.height, result.descent = 0) : (result.width = Math.floor(measurement.width), result.height = Math.floor(measurement.actualBoundingBoxAscent + measurement.actualBoundingBoxDescent), result.ascent = Math.floor(measurement.actualBoundingBoxAscent), result.descent = result.height - result.ascent), result;
|
|
4734
3446
|
}
|
|
4735
3447
|
|
|
4736
|
-
var __decorate$
|
|
3448
|
+
var __decorate$F = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
4737
3449
|
var d,
|
|
4738
3450
|
c = arguments.length,
|
|
4739
3451
|
r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
@@ -4939,9 +3651,9 @@
|
|
|
4939
3651
|
}]);
|
|
4940
3652
|
return ATextMeasure;
|
|
4941
3653
|
}();
|
|
4942
|
-
ATextMeasure = __decorate$
|
|
3654
|
+
ATextMeasure = __decorate$F([injectable()], ATextMeasure);
|
|
4943
3655
|
|
|
4944
|
-
var __decorate$
|
|
3656
|
+
var __decorate$E = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
4945
3657
|
var d,
|
|
4946
3658
|
c = arguments.length,
|
|
4947
3659
|
r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
@@ -4958,7 +3670,7 @@
|
|
|
4958
3670
|
}
|
|
4959
3671
|
return _createClass(DefaultTextMeasureContribution);
|
|
4960
3672
|
}(ATextMeasure);
|
|
4961
|
-
DefaultTextMeasureContribution = __decorate$
|
|
3673
|
+
DefaultTextMeasureContribution = __decorate$E([injectable()], DefaultTextMeasureContribution);
|
|
4962
3674
|
|
|
4963
3675
|
var container = new Container();
|
|
4964
3676
|
|
|
@@ -5329,9 +4041,14 @@
|
|
|
5329
4041
|
var DefaultCanvasAllocate = /*#__PURE__*/function () {
|
|
5330
4042
|
function DefaultCanvasAllocate() {
|
|
5331
4043
|
_classCallCheck(this, DefaultCanvasAllocate);
|
|
5332
|
-
this.pools = [];
|
|
4044
|
+
this.pools = [], this.allocatedCanvas = [];
|
|
5333
4045
|
}
|
|
5334
4046
|
_createClass(DefaultCanvasAllocate, [{
|
|
4047
|
+
key: "shareCanvas",
|
|
4048
|
+
value: function shareCanvas() {
|
|
4049
|
+
return this.allocatedCanvas.length ? this.allocatedCanvas[0] : this.getCommonCanvas();
|
|
4050
|
+
}
|
|
4051
|
+
}, {
|
|
5335
4052
|
key: "getCommonCanvas",
|
|
5336
4053
|
value: function getCommonCanvas() {
|
|
5337
4054
|
return this._commonCanvas || (this._commonCanvas = this.allocate({
|
|
@@ -5343,9 +4060,12 @@
|
|
|
5343
4060
|
}, {
|
|
5344
4061
|
key: "allocate",
|
|
5345
4062
|
value: function allocate(data) {
|
|
5346
|
-
if (!this.pools.length)
|
|
5347
|
-
|
|
5348
|
-
|
|
4063
|
+
if (!this.pools.length) {
|
|
4064
|
+
var c = wrapCanvas(Object.assign({
|
|
4065
|
+
nativeCanvas: application.global.createCanvas(data)
|
|
4066
|
+
}, data));
|
|
4067
|
+
return this.allocatedCanvas.push(c), c;
|
|
4068
|
+
}
|
|
5349
4069
|
var m = this.pools.pop();
|
|
5350
4070
|
return m.resize(data.width, data.height), m.dpr = data.dpr, m;
|
|
5351
4071
|
}
|
|
@@ -5354,13 +4074,14 @@
|
|
|
5354
4074
|
value: function allocateByObj(canvas) {
|
|
5355
4075
|
if (!this.pools.length) {
|
|
5356
4076
|
var data = {
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
4077
|
+
width: canvas.width / canvas.dpr,
|
|
4078
|
+
height: canvas.height / canvas.dpr,
|
|
4079
|
+
dpr: canvas.dpr
|
|
4080
|
+
},
|
|
4081
|
+
c = wrapCanvas(Object.assign({
|
|
4082
|
+
nativeCanvas: application.global.createCanvas(data)
|
|
4083
|
+
}, data));
|
|
4084
|
+
return this.allocatedCanvas.push(c), c;
|
|
5364
4085
|
}
|
|
5365
4086
|
var m = this.pools.pop();
|
|
5366
4087
|
return m.width = canvas.width, m.height = canvas.height, m;
|
|
@@ -5385,7 +4106,7 @@
|
|
|
5385
4106
|
}();
|
|
5386
4107
|
var canvasAllocate = new DefaultCanvasAllocate();
|
|
5387
4108
|
|
|
5388
|
-
var __decorate$
|
|
4109
|
+
var __decorate$D = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
5389
4110
|
var d,
|
|
5390
4111
|
c = arguments.length,
|
|
5391
4112
|
r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
@@ -5409,6 +4130,16 @@
|
|
|
5409
4130
|
});
|
|
5410
4131
|
}
|
|
5411
4132
|
_createClass(DefaultGraphicUtil, [{
|
|
4133
|
+
key: "canvas",
|
|
4134
|
+
get: function get() {
|
|
4135
|
+
return this.tryInitCanvas(), this._canvas;
|
|
4136
|
+
}
|
|
4137
|
+
}, {
|
|
4138
|
+
key: "context",
|
|
4139
|
+
get: function get() {
|
|
4140
|
+
return this.tryInitCanvas(), this._context;
|
|
4141
|
+
}
|
|
4142
|
+
}, {
|
|
5412
4143
|
key: "textMeasure",
|
|
5413
4144
|
get: function get() {
|
|
5414
4145
|
return this._textMeasure || this.configure(this.global, this.global.env), this._textMeasure;
|
|
@@ -5417,11 +4148,17 @@
|
|
|
5417
4148
|
key: "configure",
|
|
5418
4149
|
value: function configure(global, env) {
|
|
5419
4150
|
var _this2 = this;
|
|
5420
|
-
|
|
5421
|
-
var canvas = canvasAllocate.getCommonCanvas();
|
|
5422
|
-
this.canvas = canvas, this.context = canvas.getContext("2d"), this.contributions.getContributions().forEach(function (contribution) {
|
|
4151
|
+
this.configured || (this.contributions.getContributions().forEach(function (contribution) {
|
|
5423
4152
|
contribution.configure(_this2, env);
|
|
5424
|
-
}), this.configured = !0;
|
|
4153
|
+
}), this.configured = !0);
|
|
4154
|
+
}
|
|
4155
|
+
}, {
|
|
4156
|
+
key: "tryInitCanvas",
|
|
4157
|
+
value: function tryInitCanvas() {
|
|
4158
|
+
if (!this._canvas) {
|
|
4159
|
+
var canvas = canvasAllocate.shareCanvas();
|
|
4160
|
+
this._canvas = canvas, this._context = canvas.getContext("2d");
|
|
4161
|
+
}
|
|
5425
4162
|
}
|
|
5426
4163
|
}, {
|
|
5427
4164
|
key: "bindTextMeasure",
|
|
@@ -5461,7 +4198,7 @@
|
|
|
5461
4198
|
}]);
|
|
5462
4199
|
return DefaultGraphicUtil;
|
|
5463
4200
|
}();
|
|
5464
|
-
DefaultGraphicUtil = __decorate$
|
|
4201
|
+
DefaultGraphicUtil = __decorate$D([injectable(), __param$h(0, inject(ContributionProvider)), __param$h(0, named(TextMeasureContribution)), __metadata$q("design:paramtypes", [Object])], DefaultGraphicUtil);
|
|
5465
4202
|
var TransformMode;
|
|
5466
4203
|
!function (TransformMode) {
|
|
5467
4204
|
TransformMode[TransformMode.transform = 0] = "transform", TransformMode[TransformMode.matrix = 1] = "matrix";
|
|
@@ -5538,7 +4275,7 @@
|
|
|
5538
4275
|
}]);
|
|
5539
4276
|
return DefaultTransformUtil;
|
|
5540
4277
|
}();
|
|
5541
|
-
DefaultTransformUtil = __decorate$
|
|
4278
|
+
DefaultTransformUtil = __decorate$D([injectable(), __metadata$q("design:paramtypes", [])], DefaultTransformUtil);
|
|
5542
4279
|
|
|
5543
4280
|
var defaultThemeObj = {
|
|
5544
4281
|
arc: DefaultArcAttribute,
|
|
@@ -5675,20 +4412,6 @@
|
|
|
5675
4412
|
return null;
|
|
5676
4413
|
}
|
|
5677
4414
|
|
|
5678
|
-
var Generator = /*#__PURE__*/function () {
|
|
5679
|
-
function Generator() {
|
|
5680
|
-
_classCallCheck(this, Generator);
|
|
5681
|
-
}
|
|
5682
|
-
_createClass(Generator, null, [{
|
|
5683
|
-
key: "GenAutoIncrementId",
|
|
5684
|
-
value: function GenAutoIncrementId() {
|
|
5685
|
-
return Generator.auto_increment_id++;
|
|
5686
|
-
}
|
|
5687
|
-
}]);
|
|
5688
|
-
return Generator;
|
|
5689
|
-
}();
|
|
5690
|
-
Generator.auto_increment_id = 0;
|
|
5691
|
-
|
|
5692
4415
|
var __awaiter$3 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
5693
4416
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5694
4417
|
function fulfilled(value) {
|
|
@@ -7492,6 +6215,12 @@
|
|
|
7492
6215
|
}();
|
|
7493
6216
|
RafBasedSTO.TimeOut = 1e3 / 60;
|
|
7494
6217
|
new RafBasedSTO();
|
|
6218
|
+
var calculateLineHeight = function calculateLineHeight(lineHeight, fontSize) {
|
|
6219
|
+
if (vutils.isString(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
|
|
6220
|
+
return fontSize * (Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100);
|
|
6221
|
+
}
|
|
6222
|
+
return lineHeight;
|
|
6223
|
+
};
|
|
7495
6224
|
|
|
7496
6225
|
var IncreaseCount = /*#__PURE__*/function (_ACustomAnimate) {
|
|
7497
6226
|
_inherits(IncreaseCount, _ACustomAnimate);
|
|
@@ -8609,8 +7338,7 @@
|
|
|
8609
7338
|
}, {
|
|
8610
7339
|
key: "addChild",
|
|
8611
7340
|
value: function addChild(node) {
|
|
8612
|
-
|
|
8613
|
-
"__proto__" === node.tagname && (node.tagname = "#__proto__"), node[":@"] && Object.keys(node[":@"]).length > 0 ? this.child.push((_this$child$push2 = {}, _defineProperty(_this$child$push2, node.tagname, node.child), _defineProperty(_this$child$push2, ":@", node[":@"]), _this$child$push2)) : this.child.push(_defineProperty({}, node.tagname, node.child));
|
|
7341
|
+
"__proto__" === node.tagname && (node.tagname = "#__proto__"), node[":@"] && Object.keys(node[":@"]).length > 0 ? this.child.push(_defineProperty(_defineProperty({}, node.tagname, node.child), ":@", node[":@"])) : this.child.push(_defineProperty({}, node.tagname, node.child));
|
|
8614
7342
|
}
|
|
8615
7343
|
}]);
|
|
8616
7344
|
return XmlNode;
|
|
@@ -9353,7 +8081,7 @@
|
|
|
9353
8081
|
var DynamicLayerHandlerContribution = Symbol["for"]("DynamicLayerHandlerContribution");
|
|
9354
8082
|
var VirtualLayerHandlerContribution = Symbol["for"]("VirtualLayerHandlerContribution");
|
|
9355
8083
|
|
|
9356
|
-
var __decorate$
|
|
8084
|
+
var __decorate$C = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
9357
8085
|
var d,
|
|
9358
8086
|
c = arguments.length,
|
|
9359
8087
|
r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
@@ -9440,9 +8168,9 @@
|
|
|
9440
8168
|
}]);
|
|
9441
8169
|
return DefaultLayerService;
|
|
9442
8170
|
}();
|
|
9443
|
-
DefaultLayerService = __decorate$
|
|
8171
|
+
DefaultLayerService = __decorate$C([injectable(), __metadata$p("design:paramtypes", [])], DefaultLayerService);
|
|
9444
8172
|
|
|
9445
|
-
var __decorate$
|
|
8173
|
+
var __decorate$B = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
9446
8174
|
var d,
|
|
9447
8175
|
c = arguments.length,
|
|
9448
8176
|
r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
@@ -9459,7 +8187,7 @@
|
|
|
9459
8187
|
_classCallCheck(this, DefaultWindow);
|
|
9460
8188
|
this.hooks = {
|
|
9461
8189
|
onChange: new SyncHook(["x", "y", "width", "height"])
|
|
9462
|
-
}, this._uid = Generator.GenAutoIncrementId(), this.global = application.global;
|
|
8190
|
+
}, this._uid = Generator.GenAutoIncrementId(), this.global = application.global, this.postInit();
|
|
9463
8191
|
}
|
|
9464
8192
|
_createClass(DefaultWindow, [{
|
|
9465
8193
|
key: "width",
|
|
@@ -9602,7 +8330,7 @@
|
|
|
9602
8330
|
}]);
|
|
9603
8331
|
return DefaultWindow;
|
|
9604
8332
|
}();
|
|
9605
|
-
|
|
8333
|
+
DefaultWindow = __decorate$B([injectable(), __metadata$o("design:paramtypes", [])], DefaultWindow);
|
|
9606
8334
|
|
|
9607
8335
|
var coreModule = new ContainerModule(function (bind) {
|
|
9608
8336
|
bind(VGlobal).to(DefaultGlobal).inSingletonScope(), bind(VWindow).to(DefaultWindow), bind(GraphicUtil).to(DefaultGraphicUtil).inSingletonScope(), bind(TransformUtil).to(DefaultTransformUtil).inSingletonScope(), bind(LayerService).to(DefaultLayerService).inSingletonScope();
|
|
@@ -10008,7 +8736,7 @@
|
|
|
10008
8736
|
return CanvasTextLayout;
|
|
10009
8737
|
}();
|
|
10010
8738
|
|
|
10011
|
-
var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
8739
|
+
var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
10012
8740
|
var Text = /*#__PURE__*/function (_Graphic) {
|
|
10013
8741
|
_inherits(Text, _Graphic);
|
|
10014
8742
|
var _super = _createSuper(Text);
|
|
@@ -10082,6 +8810,117 @@
|
|
|
10082
8810
|
paddingArray = parsePadding(boundsPadding);
|
|
10083
8811
|
return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(), bounds;
|
|
10084
8812
|
}
|
|
8813
|
+
}, {
|
|
8814
|
+
key: "updateWrapAABBBounds",
|
|
8815
|
+
value: function updateWrapAABBBounds(text) {
|
|
8816
|
+
var _a, _b, _c, _d;
|
|
8817
|
+
var textTheme = getTheme(this).text,
|
|
8818
|
+
_this$attribute = this.attribute,
|
|
8819
|
+
_this$attribute$fontF = _this$attribute.fontFamily,
|
|
8820
|
+
fontFamily = _this$attribute$fontF === void 0 ? textTheme.fontFamily : _this$attribute$fontF,
|
|
8821
|
+
_this$attribute$textA = _this$attribute.textAlign,
|
|
8822
|
+
textAlign = _this$attribute$textA === void 0 ? textTheme.textAlign : _this$attribute$textA,
|
|
8823
|
+
_this$attribute$textB = _this$attribute.textBaseline,
|
|
8824
|
+
textBaseline = _this$attribute$textB === void 0 ? textTheme.textBaseline : _this$attribute$textB,
|
|
8825
|
+
_this$attribute$fontS = _this$attribute.fontSize,
|
|
8826
|
+
fontSize = _this$attribute$fontS === void 0 ? textTheme.fontSize : _this$attribute$fontS,
|
|
8827
|
+
_this$attribute$ellip = _this$attribute.ellipsis,
|
|
8828
|
+
ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
|
|
8829
|
+
maxLineWidth = _this$attribute.maxLineWidth,
|
|
8830
|
+
_this$attribute$strok = _this$attribute.stroke,
|
|
8831
|
+
stroke = _this$attribute$strok === void 0 ? textTheme.stroke : _this$attribute$strok,
|
|
8832
|
+
_this$attribute$lineW = _this$attribute.lineWidth,
|
|
8833
|
+
lineWidth = _this$attribute$lineW === void 0 ? textTheme.lineWidth : _this$attribute$lineW,
|
|
8834
|
+
_this$attribute$wordB = _this$attribute.wordBreak,
|
|
8835
|
+
wordBreak = _this$attribute$wordB === void 0 ? textTheme.wordBreak : _this$attribute$wordB,
|
|
8836
|
+
_this$attribute$fontW = _this$attribute.fontWeight,
|
|
8837
|
+
fontWeight = _this$attribute$fontW === void 0 ? textTheme.fontWeight : _this$attribute$fontW,
|
|
8838
|
+
_this$attribute$ignor = _this$attribute.ignoreBuf,
|
|
8839
|
+
ignoreBuf = _this$attribute$ignor === void 0 ? textTheme.ignoreBuf : _this$attribute$ignor,
|
|
8840
|
+
_this$attribute$heigh = _this$attribute.heightLimit,
|
|
8841
|
+
heightLimit = _this$attribute$heigh === void 0 ? 0 : _this$attribute$heigh,
|
|
8842
|
+
lineClamp = _this$attribute.lineClamp,
|
|
8843
|
+
lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
|
|
8844
|
+
buf = ignoreBuf ? 0 : 2;
|
|
8845
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
8846
|
+
var _bbox = this.cache.layoutData.bbox;
|
|
8847
|
+
return this._AABBBounds.set(_bbox.xOffset, _bbox.yOffset, _bbox.xOffset + _bbox.width, _bbox.yOffset + _bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
8848
|
+
}
|
|
8849
|
+
var textMeasure = application.graphicUtil.textMeasure,
|
|
8850
|
+
layoutObj = new CanvasTextLayout(fontFamily, {
|
|
8851
|
+
fontSize: fontSize,
|
|
8852
|
+
fontWeight: fontWeight,
|
|
8853
|
+
fontFamily: fontFamily
|
|
8854
|
+
}, textMeasure),
|
|
8855
|
+
lines = vutils.isArray(text) ? text.map(function (l) {
|
|
8856
|
+
return l.toString();
|
|
8857
|
+
}) : [text.toString()],
|
|
8858
|
+
linesLayout = [],
|
|
8859
|
+
bboxWH = [0, 0];
|
|
8860
|
+
var lineCountLimit = 1 / 0;
|
|
8861
|
+
if (heightLimit > 0 && (lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1)), lineClamp && (lineCountLimit = Math.min(lineCountLimit, lineClamp)), "number" == typeof maxLineWidth && maxLineWidth !== 1 / 0) {
|
|
8862
|
+
if (maxLineWidth > 0) for (var i = 0; i < lines.length; i++) {
|
|
8863
|
+
var str = lines[i];
|
|
8864
|
+
var needCut = !0;
|
|
8865
|
+
if (i === lineCountLimit - 1) {
|
|
8866
|
+
var _clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
8867
|
+
linesLayout.push({
|
|
8868
|
+
str: _clip.str,
|
|
8869
|
+
width: _clip.width
|
|
8870
|
+
});
|
|
8871
|
+
break;
|
|
8872
|
+
}
|
|
8873
|
+
var clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, "break-word" === wordBreak);
|
|
8874
|
+
if ("" !== str && "" === clip.str) {
|
|
8875
|
+
if (ellipsis) {
|
|
8876
|
+
var clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
8877
|
+
clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
|
|
8878
|
+
} else clip.str = "", clip.width = 0;
|
|
8879
|
+
needCut = !1;
|
|
8880
|
+
}
|
|
8881
|
+
if (linesLayout.push({
|
|
8882
|
+
str: clip.str,
|
|
8883
|
+
width: clip.width
|
|
8884
|
+
}), clip.str.length === str.length) ;else if (needCut) {
|
|
8885
|
+
var newStr = str.substring(clip.str.length);
|
|
8886
|
+
lines.splice(i + 1, 0, newStr);
|
|
8887
|
+
}
|
|
8888
|
+
}
|
|
8889
|
+
var maxWidth = 0;
|
|
8890
|
+
linesLayout.forEach(function (layout) {
|
|
8891
|
+
maxWidth = Math.max(maxWidth, layout.width);
|
|
8892
|
+
}), bboxWH[0] = maxWidth;
|
|
8893
|
+
} else {
|
|
8894
|
+
var width,
|
|
8895
|
+
_text,
|
|
8896
|
+
_lineWidth = 0;
|
|
8897
|
+
for (var _i = 0, len = lines.length; _i < len; _i++) {
|
|
8898
|
+
if (_i === lineCountLimit - 1) {
|
|
8899
|
+
var _clip2 = layoutObj.textMeasure.clipTextWithSuffix(lines[_i], layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
8900
|
+
linesLayout.push({
|
|
8901
|
+
str: _clip2.str,
|
|
8902
|
+
width: _clip2.width
|
|
8903
|
+
}), _lineWidth = Math.max(_lineWidth, _clip2.width);
|
|
8904
|
+
break;
|
|
8905
|
+
}
|
|
8906
|
+
_text = lines[_i], width = layoutObj.textMeasure.measureTextWidth(_text, layoutObj.textOptions, "break-word" === wordBreak), _lineWidth = Math.max(_lineWidth, width), linesLayout.push({
|
|
8907
|
+
str: _text,
|
|
8908
|
+
width: width
|
|
8909
|
+
});
|
|
8910
|
+
}
|
|
8911
|
+
bboxWH[0] = _lineWidth;
|
|
8912
|
+
}
|
|
8913
|
+
bboxWH[1] = linesLayout.length * (lineHeight + buf);
|
|
8914
|
+
var bbox = {
|
|
8915
|
+
xOffset: 0,
|
|
8916
|
+
yOffset: 0,
|
|
8917
|
+
width: bboxWH[0],
|
|
8918
|
+
height: bboxWH[1]
|
|
8919
|
+
};
|
|
8920
|
+
layoutObj.LayoutBBox(bbox, textAlign, textBaseline);
|
|
8921
|
+
var layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
|
|
8922
|
+
return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
8923
|
+
}
|
|
10085
8924
|
}, {
|
|
10086
8925
|
key: "updateSingallineAABBBounds",
|
|
10087
8926
|
value: function updateSingallineAABBBounds(text) {
|
|
@@ -10128,9 +8967,12 @@
|
|
|
10128
8967
|
_attribute$wordBreak === void 0 ? textTheme.wordBreak : _attribute$wordBreak;
|
|
10129
8968
|
var _attribute$ignoreBuf = attribute.ignoreBuf,
|
|
10130
8969
|
ignoreBuf = _attribute$ignoreBuf === void 0 ? textTheme.ignoreBuf : _attribute$ignoreBuf,
|
|
10131
|
-
|
|
10132
|
-
_attribute$
|
|
10133
|
-
|
|
8970
|
+
_attribute$whiteSpace = attribute.whiteSpace,
|
|
8971
|
+
whiteSpace = _attribute$whiteSpace === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace;
|
|
8972
|
+
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
8973
|
+
var buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
|
|
8974
|
+
textFontSize = attribute.fontSize || textTheme.fontSize,
|
|
8975
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, textFontSize)) && void 0 !== _a ? _a : textFontSize + buf;
|
|
10134
8976
|
if (!this.shouldUpdateShape() && this.cache) {
|
|
10135
8977
|
width = null !== (_b = this.cache.clipedWidth) && void 0 !== _b ? _b : 0;
|
|
10136
8978
|
var _dx = textDrawOffsetX(textAlign, width),
|
|
@@ -10200,12 +9042,11 @@
|
|
|
10200
9042
|
fontFamily = _attribute$fontFamily2 === void 0 ? textTheme.fontFamily : _attribute$fontFamily2,
|
|
10201
9043
|
_attribute$stroke2 = attribute.stroke,
|
|
10202
9044
|
stroke = _attribute$stroke2 === void 0 ? textTheme.stroke : _attribute$stroke2,
|
|
10203
|
-
_attribute$lineHeight2 = attribute.lineHeight,
|
|
10204
|
-
lineHeight = _attribute$lineHeight2 === void 0 ? null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight2,
|
|
10205
9045
|
_attribute$lineWidth2 = attribute.lineWidth,
|
|
10206
9046
|
lineWidth = _attribute$lineWidth2 === void 0 ? textTheme.lineWidth : _attribute$lineWidth2,
|
|
10207
9047
|
_attribute$verticalMo = attribute.verticalMode,
|
|
10208
|
-
verticalMode = _attribute$verticalMo === void 0 ? textTheme.verticalMode : _attribute$verticalMo
|
|
9048
|
+
verticalMode = _attribute$verticalMo === void 0 ? textTheme.verticalMode : _attribute$verticalMo,
|
|
9049
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
10209
9050
|
var _attribute$textAlign2 = attribute.textAlign,
|
|
10210
9051
|
textAlign = _attribute$textAlign2 === void 0 ? textTheme.textAlign : _attribute$textAlign2,
|
|
10211
9052
|
_attribute$textBaseli2 = attribute.textBaseline,
|
|
@@ -10255,7 +9096,7 @@
|
|
|
10255
9096
|
}, {
|
|
10256
9097
|
key: "updateHorizontalMultilineAABBBounds",
|
|
10257
9098
|
value: function updateHorizontalMultilineAABBBounds(text) {
|
|
10258
|
-
var _a;
|
|
9099
|
+
var _a, _b;
|
|
10259
9100
|
var textTheme = getTheme(this).text,
|
|
10260
9101
|
attribute = this.attribute,
|
|
10261
9102
|
_attribute$fontFamily3 = attribute.fontFamily,
|
|
@@ -10268,8 +9109,6 @@
|
|
|
10268
9109
|
fontSize = _attribute$fontSize3 === void 0 ? textTheme.fontSize : _attribute$fontSize3,
|
|
10269
9110
|
_attribute$fontWeight3 = attribute.fontWeight,
|
|
10270
9111
|
fontWeight = _attribute$fontWeight3 === void 0 ? textTheme.fontWeight : _attribute$fontWeight3,
|
|
10271
|
-
_attribute$lineHeight3 = attribute.lineHeight,
|
|
10272
|
-
lineHeight = _attribute$lineHeight3 === void 0 ? attribute.lineHeight || attribute.fontSize || textTheme.fontSize : _attribute$lineHeight3,
|
|
10273
9112
|
_attribute$ellipsis3 = attribute.ellipsis,
|
|
10274
9113
|
ellipsis = _attribute$ellipsis3 === void 0 ? textTheme.ellipsis : _attribute$ellipsis3,
|
|
10275
9114
|
maxLineWidth = attribute.maxLineWidth,
|
|
@@ -10277,11 +9116,13 @@
|
|
|
10277
9116
|
stroke = _attribute$stroke3 === void 0 ? textTheme.stroke : _attribute$stroke3,
|
|
10278
9117
|
_attribute$lineWidth3 = attribute.lineWidth,
|
|
10279
9118
|
lineWidth = _attribute$lineWidth3 === void 0 ? textTheme.lineWidth : _attribute$lineWidth3,
|
|
10280
|
-
_attribute$
|
|
10281
|
-
_attribute$
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
9119
|
+
_attribute$whiteSpace2 = attribute.whiteSpace,
|
|
9120
|
+
whiteSpace = _attribute$whiteSpace2 === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace2,
|
|
9121
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
|
|
9122
|
+
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
9123
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
9124
|
+
var _bbox2 = this.cache.layoutData.bbox;
|
|
9125
|
+
return this._AABBBounds.set(_bbox2.xOffset, _bbox2.yOffset, _bbox2.xOffset + _bbox2.width, _bbox2.yOffset + _bbox2.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10285
9126
|
}
|
|
10286
9127
|
var textMeasure = application.graphicUtil.textMeasure,
|
|
10287
9128
|
layoutData = new CanvasTextLayout(fontFamily, {
|
|
@@ -10315,12 +9156,11 @@
|
|
|
10315
9156
|
fontWeight = _attribute$fontWeight4 === void 0 ? textTheme.fontWeight : _attribute$fontWeight4,
|
|
10316
9157
|
_attribute$stroke4 = attribute.stroke,
|
|
10317
9158
|
stroke = _attribute$stroke4 === void 0 ? textTheme.stroke : _attribute$stroke4,
|
|
10318
|
-
_attribute$lineHeight4 = attribute.lineHeight,
|
|
10319
|
-
lineHeight = _attribute$lineHeight4 === void 0 ? null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight4,
|
|
10320
9159
|
_attribute$lineWidth4 = attribute.lineWidth,
|
|
10321
9160
|
lineWidth = _attribute$lineWidth4 === void 0 ? textTheme.lineWidth : _attribute$lineWidth4,
|
|
10322
9161
|
_attribute$verticalMo2 = attribute.verticalMode,
|
|
10323
|
-
verticalMode = _attribute$verticalMo2 === void 0 ? textTheme.verticalMode : _attribute$verticalMo2
|
|
9162
|
+
verticalMode = _attribute$verticalMo2 === void 0 ? textTheme.verticalMode : _attribute$verticalMo2,
|
|
9163
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
10324
9164
|
var _attribute$textAlign4 = attribute.textAlign,
|
|
10325
9165
|
textAlign = _attribute$textAlign4 === void 0 ? textTheme.textAlign : _attribute$textAlign4,
|
|
10326
9166
|
_attribute$textBaseli4 = attribute.textBaseline,
|
|
@@ -10453,7 +9293,7 @@
|
|
|
10453
9293
|
}, {
|
|
10454
9294
|
key: "updateMultilineAABBBounds",
|
|
10455
9295
|
value: function updateMultilineAABBBounds(text) {
|
|
10456
|
-
var _a, _b, _c;
|
|
9296
|
+
var _a, _b, _c, _d;
|
|
10457
9297
|
var textTheme = getTheme(this).text,
|
|
10458
9298
|
_this$attribute = this.attribute,
|
|
10459
9299
|
_this$attribute$fontF = _this$attribute.fontFamily,
|
|
@@ -10464,8 +9304,6 @@
|
|
|
10464
9304
|
textBaseline = _this$attribute$textB === void 0 ? textTheme.textBaseline : _this$attribute$textB,
|
|
10465
9305
|
_this$attribute$fontS = _this$attribute.fontSize,
|
|
10466
9306
|
fontSize = _this$attribute$fontS === void 0 ? textTheme.fontSize : _this$attribute$fontS,
|
|
10467
|
-
_this$attribute$lineH = _this$attribute.lineHeight,
|
|
10468
|
-
lineHeight = _this$attribute$lineH === void 0 ? this.attribute.lineHeight || this.attribute.fontSize || textTheme.fontSize : _this$attribute$lineH,
|
|
10469
9307
|
_this$attribute$ellip = _this$attribute.ellipsis,
|
|
10470
9308
|
ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
|
|
10471
9309
|
maxLineWidth = _this$attribute.maxLineWidth,
|
|
@@ -10482,8 +9320,9 @@
|
|
|
10482
9320
|
_this$attribute$heigh = _this$attribute.heightLimit,
|
|
10483
9321
|
heightLimit = _this$attribute$heigh === void 0 ? 0 : _this$attribute$heigh,
|
|
10484
9322
|
lineClamp = _this$attribute.lineClamp,
|
|
9323
|
+
lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
|
|
10485
9324
|
buf = ignoreBuf ? 0 : 2;
|
|
10486
|
-
if (!this.shouldUpdateShape() && (null === (
|
|
9325
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
10487
9326
|
var _bbox = this.cache.layoutData.bbox;
|
|
10488
9327
|
return this._AABBBounds.set(_bbox.xOffset, _bbox.yOffset, _bbox.xOffset + _bbox.width, _bbox.yOffset + _bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
10489
9328
|
}
|
|
@@ -10515,7 +9354,7 @@
|
|
|
10515
9354
|
if ("" !== str && "" === clip.str) {
|
|
10516
9355
|
if (ellipsis) {
|
|
10517
9356
|
var clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
10518
|
-
clip.str = null !== (
|
|
9357
|
+
clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
|
|
10519
9358
|
} else clip.str = "", clip.width = 0;
|
|
10520
9359
|
needCut = !1;
|
|
10521
9360
|
}
|
|
@@ -11331,6 +10170,13 @@
|
|
|
11331
10170
|
builtinSymbols.forEach(function (symbol) {
|
|
11332
10171
|
builtinSymbolsMap[symbol.type] = symbol;
|
|
11333
10172
|
});
|
|
10173
|
+
var builtInSymbolStrMap = {
|
|
10174
|
+
arrowLeft: "M 0.25 -0.5 L -0.25 0 l 0.5 0.5",
|
|
10175
|
+
arrowRight: "M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",
|
|
10176
|
+
rect: "M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",
|
|
10177
|
+
rectRound: "M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",
|
|
10178
|
+
roundLine: "M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"
|
|
10179
|
+
};
|
|
11334
10180
|
|
|
11335
10181
|
var _tempBounds = new vutils.AABBBounds(),
|
|
11336
10182
|
SYMBOL_UPDATE_TAG_KEY = ["symbolType", "size"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
@@ -11365,12 +10211,13 @@
|
|
|
11365
10211
|
}, {
|
|
11366
10212
|
key: "doUpdateParsedPath",
|
|
11367
10213
|
value: function doUpdateParsedPath() {
|
|
11368
|
-
var symbolTheme = getTheme(this).symbol
|
|
11369
|
-
|
|
11370
|
-
symbolType = _this$attribute$symbo === void 0 ? symbolTheme.symbolType : _this$attribute$symbo
|
|
11371
|
-
|
|
10214
|
+
var symbolTheme = getTheme(this).symbol;
|
|
10215
|
+
var _this$attribute$symbo = this.attribute.symbolType,
|
|
10216
|
+
symbolType = _this$attribute$symbo === void 0 ? symbolTheme.symbolType : _this$attribute$symbo,
|
|
10217
|
+
path = builtinSymbolsMap[symbolType];
|
|
11372
10218
|
if (path) return this._parsedPath = path, path;
|
|
11373
10219
|
if (path = _Symbol.userSymbolMap[symbolType], path) return this._parsedPath = path, path;
|
|
10220
|
+
symbolType = builtInSymbolStrMap[symbolType] || symbolType;
|
|
11374
10221
|
if (!0 === isSvg(symbolType)) {
|
|
11375
10222
|
var parser = new XMLParser(),
|
|
11376
10223
|
_parser$parse = parser.parse(symbolType),
|
|
@@ -11856,7 +10703,9 @@
|
|
|
11856
10703
|
var Paragraph = /*#__PURE__*/function () {
|
|
11857
10704
|
function Paragraph(text, newLine, character) {
|
|
11858
10705
|
_classCallCheck(this, Paragraph);
|
|
11859
|
-
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic"
|
|
10706
|
+
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic";
|
|
10707
|
+
var lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
|
|
10708
|
+
this.lineHeight = "number" == typeof lineHeight ? lineHeight > this.fontSize ? lineHeight : this.fontSize : Math.floor(1.2 * this.fontSize), this.height = this.lineHeight;
|
|
11860
10709
|
var _measureTextCanvas = measureTextCanvas(text, character),
|
|
11861
10710
|
ascent = _measureTextCanvas.ascent,
|
|
11862
10711
|
height = _measureTextCanvas.height,
|
|
@@ -13116,7 +11965,7 @@
|
|
|
13116
11965
|
var matrixAllocate = new DefaultMatrixAllocate();
|
|
13117
11966
|
var mat4Allocate = new DefaultMat4Allocate();
|
|
13118
11967
|
|
|
13119
|
-
var __decorate$
|
|
11968
|
+
var __decorate$A = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
13120
11969
|
var d,
|
|
13121
11970
|
c = arguments.length,
|
|
13122
11971
|
r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
@@ -13753,7 +12602,7 @@
|
|
|
13753
12602
|
}]);
|
|
13754
12603
|
return DefaultGraphicService;
|
|
13755
12604
|
}();
|
|
13756
|
-
DefaultGraphicService = __decorate$
|
|
12605
|
+
DefaultGraphicService = __decorate$A([injectable(), __param$g(0, inject(GraphicCreator)), __metadata$n("design:paramtypes", [Object])], DefaultGraphicService);
|
|
13757
12606
|
|
|
13758
12607
|
var ShadowRoot = /*#__PURE__*/function (_Group) {
|
|
13759
12608
|
_inherits(ShadowRoot, _Group);
|
|
@@ -13875,13 +12724,6 @@
|
|
|
13875
12724
|
}
|
|
13876
12725
|
createRichText({});
|
|
13877
12726
|
|
|
13878
|
-
var __decorate$A = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
13879
|
-
var d,
|
|
13880
|
-
c = arguments.length,
|
|
13881
|
-
r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
13882
|
-
if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
13883
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
13884
|
-
};
|
|
13885
12727
|
var BaseRender = /*#__PURE__*/function () {
|
|
13886
12728
|
function BaseRender() {
|
|
13887
12729
|
_classCallCheck(this, BaseRender);
|
|
@@ -14048,7 +12890,6 @@
|
|
|
14048
12890
|
}]);
|
|
14049
12891
|
return BaseRender;
|
|
14050
12892
|
}();
|
|
14051
|
-
BaseRender = __decorate$A([injectable()], BaseRender);
|
|
14052
12893
|
|
|
14053
12894
|
function getScaledStroke(context, width, dpr) {
|
|
14054
12895
|
var strokeWidth = width;
|
|
@@ -15253,33 +14094,64 @@
|
|
|
15253
14094
|
}
|
|
15254
14095
|
return !1;
|
|
15255
14096
|
}
|
|
14097
|
+
}, {
|
|
14098
|
+
key: "drawLinearLineHighPerformance",
|
|
14099
|
+
value: function drawLinearLineHighPerformance(line, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, lineAttribute, drawContext, params, fillCb, strokeCb) {
|
|
14100
|
+
var _a;
|
|
14101
|
+
context.beginPath();
|
|
14102
|
+
var z = null !== (_a = this.z) && void 0 !== _a ? _a : 0,
|
|
14103
|
+
points = line.attribute.points,
|
|
14104
|
+
startP = points[0];
|
|
14105
|
+
context.moveTo(startP.x, startP.y, z);
|
|
14106
|
+
for (var i = 1; i < points.length; i++) {
|
|
14107
|
+
var p = points[i];
|
|
14108
|
+
context.lineTo(p.x, p.y, z);
|
|
14109
|
+
}
|
|
14110
|
+
context.setShadowBlendStyle && context.setShadowBlendStyle(line, line.attribute, lineAttribute);
|
|
14111
|
+
var _line$attribute = line.attribute,
|
|
14112
|
+
_line$attribute$x = _line$attribute.x,
|
|
14113
|
+
originX = _line$attribute$x === void 0 ? 0 : _line$attribute$x,
|
|
14114
|
+
_line$attribute$x2 = _line$attribute.x,
|
|
14115
|
+
originY = _line$attribute$x2 === void 0 ? 0 : _line$attribute$x2;
|
|
14116
|
+
!1 !== fill && (fillCb ? fillCb(context, line.attribute, lineAttribute) : fillOpacity && (context.setCommonStyle(line, line.attribute, originX - offsetX, originY - offsetY, lineAttribute), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, line.attribute, lineAttribute) : strokeOpacity && (context.setStrokeStyle(line, line.attribute, originX - offsetX, originY - offsetY, lineAttribute), context.stroke()));
|
|
14117
|
+
}
|
|
15256
14118
|
}, {
|
|
15257
14119
|
key: "drawShape",
|
|
15258
14120
|
value: function drawShape(line, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
15259
14121
|
var _this2 = this;
|
|
15260
14122
|
var lineAttribute = getTheme(line, null == params ? void 0 : params.theme).line,
|
|
15261
|
-
_line$
|
|
15262
|
-
_line$
|
|
15263
|
-
fill = _line$
|
|
15264
|
-
_line$
|
|
15265
|
-
stroke = _line$
|
|
15266
|
-
_line$
|
|
15267
|
-
fillOpacity = _line$
|
|
15268
|
-
_line$
|
|
15269
|
-
strokeOpacity = _line$
|
|
14123
|
+
_line$attribute2 = line.attribute,
|
|
14124
|
+
_line$attribute2$fill = _line$attribute2.fill,
|
|
14125
|
+
fill = _line$attribute2$fill === void 0 ? lineAttribute.fill : _line$attribute2$fill,
|
|
14126
|
+
_line$attribute2$stro = _line$attribute2.stroke,
|
|
14127
|
+
stroke = _line$attribute2$stro === void 0 ? lineAttribute.stroke : _line$attribute2$stro,
|
|
14128
|
+
_line$attribute2$fill2 = _line$attribute2.fillOpacity,
|
|
14129
|
+
fillOpacity = _line$attribute2$fill2 === void 0 ? lineAttribute.fillOpacity : _line$attribute2$fill2,
|
|
14130
|
+
_line$attribute2$stro2 = _line$attribute2.strokeOpacity,
|
|
14131
|
+
strokeOpacity = _line$attribute2$stro2 === void 0 ? lineAttribute.strokeOpacity : _line$attribute2$stro2,
|
|
14132
|
+
segments = _line$attribute2.segments,
|
|
14133
|
+
points = _line$attribute2.points,
|
|
14134
|
+
closePath = _line$attribute2.closePath;
|
|
15270
14135
|
if (!this.valid(line, lineAttribute, fillCb, strokeCb)) return;
|
|
14136
|
+
var _line$attribute$curve = line.attribute.curveType,
|
|
14137
|
+
curveType = _line$attribute$curve === void 0 ? lineAttribute.curveType : _line$attribute$curve;
|
|
14138
|
+
closePath && "linear" === curveType && (curveType = "linearClosed");
|
|
14139
|
+
var _line$attribute3 = line.attribute,
|
|
14140
|
+
_line$attribute3$clip = _line$attribute3.clipRange,
|
|
14141
|
+
clipRange = _line$attribute3$clip === void 0 ? lineAttribute.clipRange : _line$attribute3$clip,
|
|
14142
|
+
_line$attribute3$clip2 = _line$attribute3.clipRangeByDimension,
|
|
14143
|
+
clipRangeByDimension = _line$attribute3$clip2 === void 0 ? lineAttribute.clipRangeByDimension : _line$attribute3$clip2;
|
|
14144
|
+
if (1 === clipRange && !segments && !points.some(function (p) {
|
|
14145
|
+
return !1 === p.defined;
|
|
14146
|
+
}) && "linear" === curveType) return this.drawLinearLineHighPerformance(line, context, !!fill, !!stroke, fillOpacity, strokeOpacity, x, y, lineAttribute, drawContext, params, fillCb, strokeCb);
|
|
15271
14147
|
if (line.shouldUpdateShape()) {
|
|
15272
|
-
var _line$
|
|
15273
|
-
|
|
15274
|
-
|
|
15275
|
-
|
|
15276
|
-
|
|
15277
|
-
curveType = _line$attribute$curve === void 0 ? lineAttribute.curveType : _line$attribute$curve;
|
|
15278
|
-
closePath && "linear" === curveType && (curveType = "linearClosed");
|
|
15279
|
-
var _points = points;
|
|
15280
|
-
if (segments && segments.length) {
|
|
14148
|
+
var _line$attribute4 = line.attribute,
|
|
14149
|
+
_points2 = _line$attribute4.points,
|
|
14150
|
+
_segments = _line$attribute4.segments,
|
|
14151
|
+
_points = _points2;
|
|
14152
|
+
if (_segments && _segments.length) {
|
|
15281
14153
|
var startPoint, lastSeg;
|
|
15282
|
-
if (line.cache =
|
|
14154
|
+
if (line.cache = _segments.map(function (seg, index) {
|
|
15283
14155
|
if (seg.points.length <= 1 && 0 === index) return seg.points[0] && (lastSeg = {
|
|
15284
14156
|
endX: seg.points[0].x,
|
|
15285
14157
|
endY: seg.points[0].y,
|
|
@@ -15311,24 +14183,19 @@
|
|
|
15311
14183
|
line.cache[line.cache.length - 1] && line.cache[line.cache.length - 1].lineTo(startP.x, startP.y, !0);
|
|
15312
14184
|
}
|
|
15313
14185
|
} else {
|
|
15314
|
-
if (!
|
|
14186
|
+
if (!_points2 || !_points2.length) return line.cache = null, void line.clearUpdateShapeTag();
|
|
15315
14187
|
line.cache = calcLineCache$1(_points, curveType);
|
|
15316
14188
|
}
|
|
15317
14189
|
line.clearUpdateShapeTag();
|
|
15318
14190
|
}
|
|
15319
|
-
var _line$attribute3 = line.attribute,
|
|
15320
|
-
_line$attribute3$clip = _line$attribute3.clipRange,
|
|
15321
|
-
clipRange = _line$attribute3$clip === void 0 ? lineAttribute.clipRange : _line$attribute3$clip,
|
|
15322
|
-
_line$attribute3$clip2 = _line$attribute3.clipRangeByDimension,
|
|
15323
|
-
clipRangeByDimension = _line$attribute3$clip2 === void 0 ? lineAttribute.clipRangeByDimension : _line$attribute3$clip2;
|
|
15324
14191
|
if (Array.isArray(line.cache)) {
|
|
15325
|
-
var
|
|
14192
|
+
var _segments2 = line.attribute.segments.filter(function (item) {
|
|
15326
14193
|
return item.points.length;
|
|
15327
14194
|
});
|
|
15328
|
-
if (1 ===
|
|
14195
|
+
if (1 === _segments2[0].points.length && _segments2.shift(), 1 === clipRange) {
|
|
15329
14196
|
var skip = !1;
|
|
15330
14197
|
line.cache.forEach(function (cache, index) {
|
|
15331
|
-
skip || (skip = _this2.drawSegmentItem(context, cache, !!fill, !!stroke, fillOpacity, strokeOpacity,
|
|
14198
|
+
skip || (skip = _this2.drawSegmentItem(context, cache, !!fill, !!stroke, fillOpacity, strokeOpacity, _segments2[index], [lineAttribute, line.attribute], clipRange, clipRangeByDimension, x, y, line, fillCb, strokeCb));
|
|
15332
14199
|
});
|
|
15333
14200
|
} else {
|
|
15334
14201
|
var totalLength = line.cache.reduce(function (l, c) {
|
|
@@ -15341,7 +14208,7 @@
|
|
|
15341
14208
|
if (_skip) return;
|
|
15342
14209
|
var curSegLength = cache.getLength(),
|
|
15343
14210
|
_cr = (totalDrawLength - drawedLengthUntilLast) / curSegLength;
|
|
15344
|
-
drawedLengthUntilLast += curSegLength, _cr > 0 && (_skip = _this2.drawSegmentItem(context, cache, !!fill, !!stroke, fillOpacity, strokeOpacity,
|
|
14211
|
+
drawedLengthUntilLast += curSegLength, _cr > 0 && (_skip = _this2.drawSegmentItem(context, cache, !!fill, !!stroke, fillOpacity, strokeOpacity, _segments2[index], [lineAttribute, line.attribute], vutils.min(_cr, 1), clipRangeByDimension, x, y, line, fillCb, strokeCb));
|
|
15345
14212
|
});
|
|
15346
14213
|
}
|
|
15347
14214
|
} else this.drawSegmentItem(context, line.cache, !!fill, !!stroke, fillOpacity, strokeOpacity, line.attribute, lineAttribute, clipRange, clipRangeByDimension, x, y, line, fillCb, strokeCb);
|
|
@@ -15596,32 +14463,82 @@
|
|
|
15596
14463
|
return _this;
|
|
15597
14464
|
}
|
|
15598
14465
|
_createClass(DefaultCanvasAreaRender, [{
|
|
14466
|
+
key: "drawLinearAreaHighPerformance",
|
|
14467
|
+
value: function drawLinearAreaHighPerformance(area, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, areaAttribute, drawContext, params, fillCb, strokeCb) {
|
|
14468
|
+
var _a, _b, _c, _d, _e;
|
|
14469
|
+
context.beginPath();
|
|
14470
|
+
var z = null !== (_a = this.z) && void 0 !== _a ? _a : 0,
|
|
14471
|
+
points = area.attribute.points,
|
|
14472
|
+
startP = points[0];
|
|
14473
|
+
context.moveTo(startP.x, startP.y, z);
|
|
14474
|
+
for (var i = 1; i < points.length; i++) {
|
|
14475
|
+
var p = points[i];
|
|
14476
|
+
context.lineTo(p.x, p.y, z);
|
|
14477
|
+
}
|
|
14478
|
+
for (var _i = points.length - 1; _i >= 0; _i--) {
|
|
14479
|
+
var _p = points[_i];
|
|
14480
|
+
context.lineTo(null !== (_b = _p.x1) && void 0 !== _b ? _b : _p.x, null !== (_c = _p.y1) && void 0 !== _c ? _c : _p.y, z);
|
|
14481
|
+
}
|
|
14482
|
+
context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(area, area.attribute, areaAttribute);
|
|
14483
|
+
var _area$attribute = area.attribute,
|
|
14484
|
+
_area$attribute$x = _area$attribute.x,
|
|
14485
|
+
originX = _area$attribute$x === void 0 ? 0 : _area$attribute$x,
|
|
14486
|
+
_area$attribute$x2 = _area$attribute.x,
|
|
14487
|
+
originY = _area$attribute$x2 === void 0 ? 0 : _area$attribute$x2;
|
|
14488
|
+
if (!1 !== fill && (fillCb ? fillCb(context, area.attribute, areaAttribute) : fillOpacity && (context.setCommonStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.fill())), stroke) {
|
|
14489
|
+
var _area$attribute$strok = area.attribute.stroke,
|
|
14490
|
+
_stroke = _area$attribute$strok === void 0 ? areaAttribute && areaAttribute.stroke : _area$attribute$strok;
|
|
14491
|
+
if (vutils.isArray(_stroke) && (_stroke[0] || _stroke[2]) && !1 === _stroke[1]) if (context.beginPath(), _stroke[0]) {
|
|
14492
|
+
context.moveTo(startP.x, startP.y, z);
|
|
14493
|
+
for (var _i2 = 1; _i2 < points.length; _i2++) {
|
|
14494
|
+
var _p2 = points[_i2];
|
|
14495
|
+
context.lineTo(_p2.x, _p2.y, z);
|
|
14496
|
+
}
|
|
14497
|
+
} else if (_stroke[2]) {
|
|
14498
|
+
var endP = points[points.length - 1];
|
|
14499
|
+
context.moveTo(endP.x, endP.y, z);
|
|
14500
|
+
for (var _i3 = points.length - 2; _i3 >= 0; _i3--) {
|
|
14501
|
+
var _p3 = points[_i3];
|
|
14502
|
+
context.lineTo(null !== (_d = _p3.x1) && void 0 !== _d ? _d : _p3.x, null !== (_e = _p3.y1) && void 0 !== _e ? _e : _p3.y, z);
|
|
14503
|
+
}
|
|
14504
|
+
}
|
|
14505
|
+
context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.stroke();
|
|
14506
|
+
}
|
|
14507
|
+
}
|
|
14508
|
+
}, {
|
|
15599
14509
|
key: "drawShape",
|
|
15600
14510
|
value: function drawShape(area, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
15601
14511
|
var _this2 = this;
|
|
15602
14512
|
var _a, _b, _c, _d, _e, _f;
|
|
15603
14513
|
var areaAttribute = getTheme(area, null == params ? void 0 : params.theme).area,
|
|
15604
|
-
_area$
|
|
15605
|
-
_area$
|
|
15606
|
-
|
|
15607
|
-
_area$
|
|
15608
|
-
|
|
15609
|
-
_area$
|
|
15610
|
-
|
|
14514
|
+
_area$attribute2 = area.attribute,
|
|
14515
|
+
_area$attribute2$fill = _area$attribute2.fill,
|
|
14516
|
+
fill = _area$attribute2$fill === void 0 ? areaAttribute.fill : _area$attribute2$fill,
|
|
14517
|
+
_area$attribute2$stro = _area$attribute2.stroke;
|
|
14518
|
+
_area$attribute2$stro === void 0 ? areaAttribute.stroke : _area$attribute2$stro;
|
|
14519
|
+
var _area$attribute2$fill2 = _area$attribute2.fillOpacity,
|
|
14520
|
+
fillOpacity = _area$attribute2$fill2 === void 0 ? areaAttribute.fillOpacity : _area$attribute2$fill2,
|
|
14521
|
+
_area$attribute2$z = _area$attribute2.z,
|
|
14522
|
+
z = _area$attribute2$z === void 0 ? areaAttribute.z : _area$attribute2$z,
|
|
14523
|
+
_area$attribute2$stro2 = _area$attribute2.strokeOpacity,
|
|
14524
|
+
strokeOpacity = _area$attribute2$stro2 === void 0 ? areaAttribute.strokeOpacity : _area$attribute2$stro2,
|
|
15611
14525
|
data = this.valid(area, areaAttribute, fillCb, strokeCb);
|
|
15612
14526
|
if (!data) return;
|
|
15613
14527
|
var doFill = data.doFill,
|
|
15614
14528
|
doStroke = data.doStroke,
|
|
15615
|
-
_area$
|
|
15616
|
-
|
|
14529
|
+
_area$attribute3 = area.attribute,
|
|
14530
|
+
_area$attribute3$clip = _area$attribute3.clipRange,
|
|
14531
|
+
clipRange = _area$attribute3$clip === void 0 ? areaAttribute.clipRange : _area$attribute3$clip,
|
|
14532
|
+
closePath = _area$attribute3.closePath,
|
|
14533
|
+
points = _area$attribute3.points,
|
|
14534
|
+
segments = _area$attribute3.segments;
|
|
14535
|
+
var _area$attribute$curve = area.attribute.curveType,
|
|
14536
|
+
curveType = _area$attribute$curve === void 0 ? areaAttribute.curveType : _area$attribute$curve;
|
|
14537
|
+
if (closePath && "linear" === curveType && (curveType = "linearClosed"), 1 === clipRange && !segments && !points.some(function (p) {
|
|
14538
|
+
return !1 === p.defined;
|
|
14539
|
+
}) && "linear" === curveType) return this.drawLinearAreaHighPerformance(area, context, !!fill, doStroke, fillOpacity, strokeOpacity, x, y, areaAttribute, drawContext, params, fillCb, strokeCb);
|
|
15617
14540
|
if (area.shouldUpdateShape()) {
|
|
15618
|
-
|
|
15619
|
-
points = _area$attribute2.points,
|
|
15620
|
-
segments = _area$attribute2.segments,
|
|
15621
|
-
closePath = _area$attribute2.closePath;
|
|
15622
|
-
var _area$attribute$curve = area.attribute.curveType,
|
|
15623
|
-
curveType = _area$attribute$curve === void 0 ? areaAttribute.curveType : _area$attribute$curve;
|
|
15624
|
-
if (closePath && "linear" === curveType && (curveType = "linearClosed"), segments && segments.length) {
|
|
14541
|
+
if (segments && segments.length) {
|
|
15625
14542
|
var startPoint, lastTopSeg;
|
|
15626
14543
|
var topCaches = segments.map(function (seg, index) {
|
|
15627
14544
|
if (seg.points.length <= 1 && 0 === index) return seg.points[0] && (lastTopSeg = {
|
|
@@ -15644,9 +14561,9 @@
|
|
|
15644
14561
|
for (var i = segments.length - 1; i >= 0; i--) {
|
|
15645
14562
|
var _points = segments[i].points,
|
|
15646
14563
|
bottomPoints = [];
|
|
15647
|
-
for (var
|
|
15648
|
-
x: null !== (_a = _points[
|
|
15649
|
-
y: null !== (_b = _points[
|
|
14564
|
+
for (var _i4 = _points.length - 1; _i4 >= 0; _i4--) bottomPoints.push({
|
|
14565
|
+
x: null !== (_a = _points[_i4].x1) && void 0 !== _a ? _a : _points[_i4].x,
|
|
14566
|
+
y: null !== (_b = _points[_i4].y1) && void 0 !== _b ? _b : _points[_i4].y
|
|
15650
14567
|
});
|
|
15651
14568
|
if (0 !== i) {
|
|
15652
14569
|
var lastSegmentPoints = segments[i - 1].points,
|
|
@@ -15669,9 +14586,9 @@
|
|
|
15669
14586
|
{
|
|
15670
14587
|
var topPoints = points,
|
|
15671
14588
|
_bottomPoints = [];
|
|
15672
|
-
for (var
|
|
15673
|
-
x: null !== (_e = points[
|
|
15674
|
-
y: null !== (_f = points[
|
|
14589
|
+
for (var _i5 = points.length - 1; _i5 >= 0; _i5--) _bottomPoints.push({
|
|
14590
|
+
x: null !== (_e = points[_i5].x1) && void 0 !== _e ? _e : points[_i5].x,
|
|
14591
|
+
y: null !== (_f = points[_i5].y1) && void 0 !== _f ? _f : points[_i5].y
|
|
15675
14592
|
});
|
|
15676
14593
|
var topCache = calcLineCache(topPoints, curveType),
|
|
15677
14594
|
bottomCache = calcLineCache(_bottomPoints, "stepBefore" === curveType ? "stepAfter" : "stepAfter" === curveType ? "stepBefore" : curveType);
|
|
@@ -15734,9 +14651,9 @@
|
|
|
15734
14651
|
}) : da.push(defaultAttribute), da.push(attribute)), connect && "none" === connectedType) return !1;
|
|
15735
14652
|
if (!cache) return;
|
|
15736
14653
|
context.beginPath();
|
|
15737
|
-
var _area$
|
|
15738
|
-
points = _area$
|
|
15739
|
-
segments = _area$
|
|
14654
|
+
var _area$attribute4 = area.attribute,
|
|
14655
|
+
points = _area$attribute4.points,
|
|
14656
|
+
segments = _area$attribute4.segments;
|
|
15740
14657
|
var endP,
|
|
15741
14658
|
startP,
|
|
15742
14659
|
direction = Direction$1.ROW;
|
|
@@ -15764,8 +14681,8 @@
|
|
|
15764
14681
|
attribute: attribute
|
|
15765
14682
|
}), !1 !== stroke) if (strokeCb) strokeCb(context, attribute, defaultAttribute);else {
|
|
15766
14683
|
var _attribute$stroke = attribute.stroke,
|
|
15767
|
-
|
|
15768
|
-
vutils.isArray(
|
|
14684
|
+
_stroke2 = _attribute$stroke === void 0 ? defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke : _attribute$stroke;
|
|
14685
|
+
vutils.isArray(_stroke2) && (_stroke2[0] || _stroke2[2]) && !1 === _stroke2[1] && (context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, _stroke2[0] ? cache.top : cache.bottom, clipRange, direction === Direction$1.ROW ? "x" : "y", {
|
|
15769
14686
|
offsetX: offsetX,
|
|
15770
14687
|
offsetY: offsetY,
|
|
15771
14688
|
offsetZ: offsetZ,
|
|
@@ -16029,21 +14946,7 @@
|
|
|
16029
14946
|
var textAttribute = getTheme(text, null == params ? void 0 : params.theme).text,
|
|
16030
14947
|
_text$attribute = text.attribute,
|
|
16031
14948
|
str = _text$attribute.text,
|
|
16032
|
-
_text$attribute$
|
|
16033
|
-
_text$attribute$fill === void 0 ? textAttribute.fill : _text$attribute$fill;
|
|
16034
|
-
var _text$attribute$strok = _text$attribute.stroke;
|
|
16035
|
-
_text$attribute$strok === void 0 ? textAttribute.stroke : _text$attribute$strok;
|
|
16036
|
-
var _text$attribute$fillO = _text$attribute.fillOpacity;
|
|
16037
|
-
_text$attribute$fillO === void 0 ? textAttribute.fillOpacity : _text$attribute$fillO;
|
|
16038
|
-
var _text$attribute$strok2 = _text$attribute.strokeOpacity;
|
|
16039
|
-
_text$attribute$strok2 === void 0 ? textAttribute.strokeOpacity : _text$attribute$strok2;
|
|
16040
|
-
var _text$attribute$opaci = _text$attribute.opacity;
|
|
16041
|
-
_text$attribute$opaci === void 0 ? textAttribute.opacity : _text$attribute$opaci;
|
|
16042
|
-
var _text$attribute$lineW = _text$attribute.lineWidth;
|
|
16043
|
-
_text$attribute$lineW === void 0 ? textAttribute.lineWidth : _text$attribute$lineW;
|
|
16044
|
-
var _text$attribute$visib = _text$attribute.visible;
|
|
16045
|
-
_text$attribute$visib === void 0 ? textAttribute.visible : _text$attribute$visib;
|
|
16046
|
-
var _text$attribute$under = _text$attribute.underline,
|
|
14949
|
+
_text$attribute$under = _text$attribute.underline,
|
|
16047
14950
|
underline = _text$attribute$under === void 0 ? textAttribute.underline : _text$attribute$under,
|
|
16048
14951
|
_text$attribute$lineT = _text$attribute.lineThrough,
|
|
16049
14952
|
lineThrough = _text$attribute$lineT === void 0 ? textAttribute.lineThrough : _text$attribute$lineT,
|
|
@@ -16068,7 +14971,7 @@
|
|
|
16068
14971
|
var t = textAlign;
|
|
16069
14972
|
textAlign = null !== (_a = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = text.getAlignMapBaseline()[t]) && void 0 !== _b ? _b : "top";
|
|
16070
14973
|
}
|
|
16071
|
-
var lineHeight = null !== (_c = text.attribute.lineHeight) && void 0 !== _c ? _c : fontSize,
|
|
14974
|
+
var lineHeight = null !== (_c = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _c ? _c : fontSize,
|
|
16072
14975
|
data = this.valid(text, textAttribute, fillCb, strokeCb);
|
|
16073
14976
|
if (!data) return;
|
|
16074
14977
|
var fVisible = data.fVisible,
|
|
@@ -16101,6 +15004,7 @@
|
|
|
16101
15004
|
context.fillText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z), _this2.drawMultiUnderLine(underline, lineThrough, text, (line.leftOffset || 0) + x, (line.topOffset || 0) + yOffset + y, z, line.width, textAttribute, context);
|
|
16102
15005
|
})));
|
|
16103
15006
|
} else {
|
|
15007
|
+
text.tryUpdateAABBBounds();
|
|
16104
15008
|
var cache = text.cache,
|
|
16105
15009
|
verticalList = cache.verticalList;
|
|
16106
15010
|
context.textAlign = "left", context.textBaseline = "top";
|
|
@@ -16128,14 +15032,15 @@
|
|
|
16128
15032
|
});
|
|
16129
15033
|
});
|
|
16130
15034
|
}
|
|
15035
|
+
} else if ("horizontal" === direction) {
|
|
15036
|
+
context.setTextStyle(text.attribute, textAttribute, z);
|
|
15037
|
+
var _t = text.clipedText;
|
|
15038
|
+
var dy = 0;
|
|
15039
|
+
lineHeight !== fontSize && ("top" === textBaseline ? dy = (lineHeight - fontSize) / 2 : "middle" === textBaseline || "bottom" === textBaseline && (dy = -(lineHeight - fontSize) / 2)), drawText(_t, 0, dy, 0);
|
|
16131
15040
|
} else {
|
|
15041
|
+
text.tryUpdateAABBBounds();
|
|
16132
15042
|
var _cache = text.cache;
|
|
16133
|
-
if (
|
|
16134
|
-
context.setTextStyle(text.attribute, textAttribute, z);
|
|
16135
|
-
var _t = text.clipedText;
|
|
16136
|
-
var dy = 0;
|
|
16137
|
-
lineHeight !== fontSize && ("top" === textBaseline ? dy = (lineHeight - fontSize) / 2 : "middle" === textBaseline || "bottom" === textBaseline && (dy = -(lineHeight - fontSize) / 2)), drawText(_t, 0, dy, 0);
|
|
16138
|
-
} else if (_cache) {
|
|
15043
|
+
if (_cache) {
|
|
16139
15044
|
context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z);
|
|
16140
15045
|
var _verticalList = _cache.verticalList;
|
|
16141
15046
|
var _offsetY = 0;
|
|
@@ -17437,7 +16342,7 @@
|
|
|
17437
16342
|
var DefaultDrawContribution = /*#__PURE__*/function () {
|
|
17438
16343
|
function DefaultDrawContribution(contributions, drawItemInterceptorContributions) {
|
|
17439
16344
|
_classCallCheck(this, DefaultDrawContribution);
|
|
17440
|
-
this.contributions = contributions, this.drawItemInterceptorContributions = drawItemInterceptorContributions, this.currentRenderMap = new Map(), this.defaultRenderMap = new Map(), this.styleRenderMap = new Map(), this.dirtyBounds = new vutils.Bounds(), this.backupDirtyBounds = new vutils.Bounds(), this.global = application.global, this.layerService = application.layerService;
|
|
16345
|
+
this.contributions = contributions, this.drawItemInterceptorContributions = drawItemInterceptorContributions, this.currentRenderMap = new Map(), this.defaultRenderMap = new Map(), this.styleRenderMap = new Map(), this.dirtyBounds = new vutils.Bounds(), this.backupDirtyBounds = new vutils.Bounds(), this.global = application.global, this.layerService = application.layerService, this.init();
|
|
17441
16346
|
}
|
|
17442
16347
|
_createClass(DefaultDrawContribution, [{
|
|
17443
16348
|
key: "init",
|
|
@@ -17452,11 +16357,18 @@
|
|
|
17452
16357
|
return a.order - b.order;
|
|
17453
16358
|
});
|
|
17454
16359
|
}
|
|
16360
|
+
}, {
|
|
16361
|
+
key: "prepareForDraw",
|
|
16362
|
+
value: function prepareForDraw(renderService, drawContext) {
|
|
16363
|
+
renderService.renderTreeRoots.reduce(function (a, b) {
|
|
16364
|
+
return a + b.count;
|
|
16365
|
+
}, 0) < this.global.optmizeSkipCheckBoundariesThreshold ? this.useDirtyBounds = !1 : this.useDirtyBounds = !0;
|
|
16366
|
+
}
|
|
17455
16367
|
}, {
|
|
17456
16368
|
key: "draw",
|
|
17457
16369
|
value: function draw(renderService, drawContext) {
|
|
17458
16370
|
var _this2 = this;
|
|
17459
|
-
drawContext.drawContribution = this, this.currentRenderMap = this.styleRenderMap.get(drawContext.renderStyle) || this.defaultRenderMap, this.currentRenderService = renderService;
|
|
16371
|
+
this.prepareForDraw(renderService, drawContext), drawContext.drawContribution = this, this.currentRenderMap = this.styleRenderMap.get(drawContext.renderStyle) || this.defaultRenderMap, this.currentRenderService = renderService;
|
|
17460
16372
|
var context = drawContext.context,
|
|
17461
16373
|
stage = drawContext.stage,
|
|
17462
16374
|
_drawContext$x = drawContext.x,
|
|
@@ -17503,11 +16415,14 @@
|
|
|
17503
16415
|
var _this3 = this;
|
|
17504
16416
|
if (drawContext["break"] || !1 === group.attribute.visibleAll) return;
|
|
17505
16417
|
if (group.incremental && (null == drawContext.startAtId || drawContext.startAtId === group._uid)) return drawContext["break"] = !0, void this._increaseRender(group, drawContext);
|
|
17506
|
-
if (!vutils.isRectIntersect(group.AABBBounds, this.dirtyBounds, !1)) return;
|
|
17507
|
-
var tempBounds
|
|
17508
|
-
|
|
17509
|
-
|
|
17510
|
-
|
|
16418
|
+
if (this.useDirtyBounds && !vutils.isRectIntersect(group.AABBBounds, this.dirtyBounds, !1)) return;
|
|
16419
|
+
var nextM, tempBounds;
|
|
16420
|
+
if (this.useDirtyBounds) {
|
|
16421
|
+
tempBounds = boundsAllocate.allocateByObj(this.dirtyBounds);
|
|
16422
|
+
var gm = group.transMatrix;
|
|
16423
|
+
nextM = matrixAllocate.allocateByObj(parentMatrix).multiply(gm.a, gm.b, gm.c, gm.d, gm.e, gm.f), this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(nextM.getInverse());
|
|
16424
|
+
}
|
|
16425
|
+
this.renderItem(group, drawContext, {
|
|
17511
16426
|
drawingCb: function drawingCb() {
|
|
17512
16427
|
var _a;
|
|
17513
16428
|
skipSort ? group.forEachChildren(function (item) {
|
|
@@ -17516,7 +16431,7 @@
|
|
|
17516
16431
|
drawContext["break"] || (item.isContainer ? _this3.renderGroup(item, drawContext, nextM) : _this3.renderItem(item, drawContext));
|
|
17517
16432
|
}, !1, !!(null === (_a = drawContext.context) || void 0 === _a ? void 0 : _a.camera));
|
|
17518
16433
|
}
|
|
17519
|
-
}), this.dirtyBounds.copy(tempBounds), boundsAllocate.free(tempBounds), matrixAllocate.free(nextM);
|
|
16434
|
+
}), this.useDirtyBounds && (this.dirtyBounds.copy(tempBounds), boundsAllocate.free(tempBounds), matrixAllocate.free(nextM));
|
|
17520
16435
|
}
|
|
17521
16436
|
}, {
|
|
17522
16437
|
key: "_increaseRender",
|
|
@@ -17587,7 +16502,7 @@
|
|
|
17587
16502
|
this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(m), this.dirtyBounds.translate(-scrollX, -scrollY);
|
|
17588
16503
|
}
|
|
17589
16504
|
}
|
|
17590
|
-
if (!graphic.isContainer && !vutils.isRectIntersect(graphic.AABBBounds, this.dirtyBounds, !1)) return void (retrans && this.dirtyBounds.copy(tempBounds));
|
|
16505
|
+
if (this.useDirtyBounds && !graphic.isContainer && !vutils.isRectIntersect(graphic.AABBBounds, this.dirtyBounds, !1)) return void (retrans && this.dirtyBounds.copy(tempBounds));
|
|
17591
16506
|
var skipDraw = null != drawContext.startAtId && graphic._uid !== drawContext.startAtId;
|
|
17592
16507
|
if (graphic._uid === drawContext.startAtId && (drawContext.startAtId = null), params && (params.skipDraw = skipDraw), skipDraw ? graphic.isContainer && renderer.draw(graphic, this.currentRenderService, drawContext, params) : renderer.draw(graphic, this.currentRenderService, drawContext, params), retrans && this.dirtyBounds.copy(tempBounds), this.InterceptorContributions.length) for (var _i = 0; _i < this.InterceptorContributions.length; _i++) {
|
|
17593
16508
|
var _drawContribution = this.InterceptorContributions[_i];
|
|
@@ -17638,7 +16553,7 @@
|
|
|
17638
16553
|
}]);
|
|
17639
16554
|
return DefaultDrawContribution;
|
|
17640
16555
|
}();
|
|
17641
|
-
|
|
16556
|
+
DefaultDrawContribution = __decorate$g([injectable(), __param$3(0, multiInject(GraphicRender)), __param$3(1, inject(ContributionProvider)), __param$3(1, named(DrawItemInterceptor)), __metadata$7("design:paramtypes", [Array, Object])], DefaultDrawContribution);
|
|
17642
16557
|
|
|
17643
16558
|
var __decorate$f = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
17644
16559
|
var d,
|
|
@@ -18769,7 +17684,7 @@
|
|
|
18769
17684
|
DefaultCanvasPyramid3dRender = __decorate$7([injectable()], DefaultCanvasPyramid3dRender);
|
|
18770
17685
|
|
|
18771
17686
|
var renderModule = new ContainerModule(function (bind) {
|
|
18772
|
-
bind(DefaultBaseBackgroundRenderContribution).toSelf().inSingletonScope(), bind(DefaultBaseTextureRenderContribution).toSelf().inSingletonScope(), bind(DrawContribution).to(DefaultDrawContribution), bind(IncrementalDrawContribution).to(DefaultIncrementalDrawContribution), bind(CircleRender).to(DefaultCanvasCircleRender).inSingletonScope(), bind(GraphicRender).toService(CircleRender), bindContributionProvider(bind, CircleRenderContribution), bind(RectRender).to(DefaultCanvasRectRender).inSingletonScope(), bind(GraphicRender).toService(RectRender), bind(Rect3DRender).to(DefaultCanvasRect3dRender).inSingletonScope(), bind(GraphicRender).toService(Rect3DRender), bindContributionProvider(bind, RectRenderContribution), bind(TextRender).to(DefaultCanvasTextRender).inSingletonScope(), bind(GraphicRender).toService(TextRender), bindContributionProvider(bind, TextRenderContribution), bind(PathRender).to(DefaultCanvasPathRender).inSingletonScope(), bind(GraphicRender).toService(PathRender), bindContributionProvider(bind, PathRenderContribution), bind(SymbolRender).to(DefaultCanvasSymbolRender).inSingletonScope(), bind(GraphicRender).toService(SymbolRender), bindContributionProvider(bind, SymbolRenderContribution), bind(ArcRender).to(DefaultCanvasArcRender).inSingletonScope(), bind(GraphicRender).toService(ArcRender), bind(Arc3dRender).to(DefaultCanvasArc3DRender).inSingletonScope(), bind(GraphicRender).toService(Arc3dRender), bindContributionProvider(bind, ArcRenderContribution), bind(LineRender).to(DefaultCanvasLineRender).inSingletonScope(), bind(GraphicRender).toService(LineRender), bind(DefaultIncrementalCanvasLineRender).toSelf().inSingletonScope(), bind(DefaultIncrementalCanvasAreaRender).toSelf().inSingletonScope(), bind(AreaRender).to(DefaultCanvasAreaRender).inSingletonScope(), bind(GraphicRender).toService(AreaRender), bindContributionProvider(bind, AreaRenderContribution), bind(GroupRender).to(DefaultCanvasGroupRender).inSingletonScope(), bind(GraphicRender).toService(GroupRender), bindContributionProvider(bind, GroupRenderContribution), bind(PolygonRender).to(DefaultCanvasPolygonRender).inSingletonScope(), bind(GraphicRender).toService(PolygonRender), bindContributionProvider(bind, PolygonRenderContribution), bind(GlyphRender).to(DefaultCanvasGlyphRender).inSingletonScope(), bind(GraphicRender).toService(GlyphRender), bind(ImageRender).to(DefaultCanvasImageRender).inSingletonScope(), bind(GraphicRender).toService(ImageRender), bindContributionProvider(bind, ImageRenderContribution), bind(RichTextRender).to(DefaultCanvasRichTextRender).inSingletonScope(), bind(GraphicRender).toService(RichTextRender), bind(Pyramid3dRender).to(DefaultCanvasPyramid3dRender).inSingletonScope(), bind(GraphicRender).toService(Pyramid3dRender), bind(DefaultBaseInteractiveRenderContribution).toSelf().inSingletonScope(), bind(TextRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bind(ArcRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bind(PathRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bind(SymbolRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bind(RectRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bind(ImageRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bind(CircleRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bind(AreaRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bind(PolygonRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, InteractiveSubRenderContribution), bindContributionProvider(bind, GraphicRender), bind(ShadowRootDrawItemInterceptorContribution).toSelf().inSingletonScope(), bind(DrawItemInterceptor).toService(ShadowRootDrawItemInterceptorContribution), bind(CommonDrawItemInterceptorContribution).toSelf().inSingletonScope(), bind(DrawItemInterceptor).toService(CommonDrawItemInterceptorContribution), bind(Canvas3DDrawItemInterceptor).toSelf().inSingletonScope(), bind(DrawItemInterceptor).toService(Canvas3DDrawItemInterceptor), bind(InteractiveDrawItemInterceptorContribution).toSelf().inSingletonScope(), bind(DrawItemInterceptor).toService(InteractiveDrawItemInterceptorContribution), bindContributionProvider(bind, DrawItemInterceptor);
|
|
17687
|
+
bind(DefaultBaseBackgroundRenderContribution).toSelf().inSingletonScope(), bind(DefaultBaseTextureRenderContribution).toSelf().inSingletonScope(), bind(DrawContribution).to(DefaultDrawContribution), bind(IncrementalDrawContribution).to(DefaultIncrementalDrawContribution), bind(DefaultCanvasCircleRender).toSelf().inSingletonScope(), bind(CircleRender).to(DefaultCanvasCircleRender).inSingletonScope(), bind(GraphicRender).toService(CircleRender), bindContributionProvider(bind, CircleRenderContribution), bind(DefaultCanvasRectRender).toSelf().inSingletonScope(), bind(RectRender).to(DefaultCanvasRectRender).inSingletonScope(), bind(GraphicRender).toService(RectRender), bind(Rect3DRender).to(DefaultCanvasRect3dRender).inSingletonScope(), bind(GraphicRender).toService(Rect3DRender), bindContributionProvider(bind, RectRenderContribution), bind(TextRender).to(DefaultCanvasTextRender).inSingletonScope(), bind(GraphicRender).toService(TextRender), bindContributionProvider(bind, TextRenderContribution), bind(DefaultCanvasPathRender).toSelf().inSingletonScope(), bind(PathRender).to(DefaultCanvasPathRender).inSingletonScope(), bind(GraphicRender).toService(PathRender), bindContributionProvider(bind, PathRenderContribution), bind(DefaultCanvasSymbolRender).toSelf().inSingletonScope(), bind(SymbolRender).to(DefaultCanvasSymbolRender).inSingletonScope(), bind(GraphicRender).toService(SymbolRender), bindContributionProvider(bind, SymbolRenderContribution), bind(DefaultCanvasArcRender).toSelf().inSingletonScope(), bind(ArcRender).to(DefaultCanvasArcRender).inSingletonScope(), bind(GraphicRender).toService(ArcRender), bind(Arc3dRender).to(DefaultCanvasArc3DRender).inSingletonScope(), bind(GraphicRender).toService(Arc3dRender), bindContributionProvider(bind, ArcRenderContribution), bind(DefaultCanvasLineRender).toSelf().inSingletonScope(), bind(LineRender).to(DefaultCanvasLineRender).inSingletonScope(), bind(GraphicRender).toService(LineRender), bind(DefaultIncrementalCanvasLineRender).toSelf().inSingletonScope(), bind(DefaultIncrementalCanvasAreaRender).toSelf().inSingletonScope(), bind(DefaultCanvasAreaRender).toSelf().inSingletonScope(), bind(AreaRender).to(DefaultCanvasAreaRender).inSingletonScope(), bind(GraphicRender).toService(AreaRender), bindContributionProvider(bind, AreaRenderContribution), bind(GroupRender).to(DefaultCanvasGroupRender).inSingletonScope(), bind(GraphicRender).toService(GroupRender), bindContributionProvider(bind, GroupRenderContribution), bind(PolygonRender).to(DefaultCanvasPolygonRender).inSingletonScope(), bind(GraphicRender).toService(PolygonRender), bindContributionProvider(bind, PolygonRenderContribution), bind(GlyphRender).to(DefaultCanvasGlyphRender).inSingletonScope(), bind(GraphicRender).toService(GlyphRender), bind(ImageRender).to(DefaultCanvasImageRender).inSingletonScope(), bind(GraphicRender).toService(ImageRender), bindContributionProvider(bind, ImageRenderContribution), bind(RichTextRender).to(DefaultCanvasRichTextRender).inSingletonScope(), bind(GraphicRender).toService(RichTextRender), bind(Pyramid3dRender).to(DefaultCanvasPyramid3dRender).inSingletonScope(), bind(GraphicRender).toService(Pyramid3dRender), bind(DefaultBaseInteractiveRenderContribution).toSelf().inSingletonScope(), bind(TextRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bind(ArcRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bind(PathRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bind(SymbolRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bind(RectRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bind(ImageRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bind(CircleRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bind(AreaRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bind(PolygonRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, InteractiveSubRenderContribution), bindContributionProvider(bind, GraphicRender), bind(ShadowRootDrawItemInterceptorContribution).toSelf().inSingletonScope(), bind(DrawItemInterceptor).toService(ShadowRootDrawItemInterceptorContribution), bind(CommonDrawItemInterceptorContribution).toSelf().inSingletonScope(), bind(DrawItemInterceptor).toService(CommonDrawItemInterceptorContribution), bind(Canvas3DDrawItemInterceptor).toSelf().inSingletonScope(), bind(DrawItemInterceptor).toService(Canvas3DDrawItemInterceptor), bind(InteractiveDrawItemInterceptorContribution).toSelf().inSingletonScope(), bind(DrawItemInterceptor).toService(InteractiveDrawItemInterceptorContribution), bindContributionProvider(bind, DrawItemInterceptor);
|
|
18773
17688
|
});
|
|
18774
17689
|
|
|
18775
17690
|
function load(container) {
|
|
@@ -19979,9 +18894,15 @@
|
|
|
19979
18894
|
'cursor'
|
|
19980
18895
|
];
|
|
19981
18896
|
class AbstractComponent extends Group {
|
|
19982
|
-
constructor(attributes,
|
|
18897
|
+
constructor(attributes, options) {
|
|
19983
18898
|
super(attributes);
|
|
19984
|
-
|
|
18899
|
+
if (options === null || options === void 0 ? void 0 : options.mode) {
|
|
18900
|
+
this.mode = options.mode;
|
|
18901
|
+
this.setMode(options.mode);
|
|
18902
|
+
}
|
|
18903
|
+
if (options === null || options === void 0 ? void 0 : options.skipDefault) {
|
|
18904
|
+
this.skipDefault = true;
|
|
18905
|
+
}
|
|
19985
18906
|
this.setTheme({
|
|
19986
18907
|
common: {
|
|
19987
18908
|
strokeBoundsBuffer: 0
|
|
@@ -20058,8 +18979,8 @@
|
|
|
20058
18979
|
throttle: vutils.throttle
|
|
20059
18980
|
};
|
|
20060
18981
|
class ScrollBar extends AbstractComponent {
|
|
20061
|
-
constructor(attributes) {
|
|
20062
|
-
super(vutils.merge({}, ScrollBar.defaultAttributes, attributes));
|
|
18982
|
+
constructor(attributes, options) {
|
|
18983
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, ScrollBar.defaultAttributes, attributes));
|
|
20063
18984
|
this.name = 'scrollbar';
|
|
20064
18985
|
this._onRailPointerDown = (e) => {
|
|
20065
18986
|
var _a, _b;
|
|
@@ -20802,8 +19723,8 @@
|
|
|
20802
19723
|
}
|
|
20803
19724
|
|
|
20804
19725
|
class Tag extends AbstractComponent {
|
|
20805
|
-
constructor(attributes) {
|
|
20806
|
-
super(vutils.merge({}, Tag.defaultAttributes, attributes));
|
|
19726
|
+
constructor(attributes, options) {
|
|
19727
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, Tag.defaultAttributes, attributes));
|
|
20807
19728
|
this.name = 'tag';
|
|
20808
19729
|
}
|
|
20809
19730
|
render() {
|
|
@@ -20920,8 +19841,8 @@
|
|
|
20920
19841
|
|
|
20921
19842
|
const _tBounds = new vutils.AABBBounds();
|
|
20922
19843
|
class PopTip extends AbstractComponent {
|
|
20923
|
-
constructor(attributes) {
|
|
20924
|
-
super(vutils.merge({}, PopTip.defaultAttributes, attributes));
|
|
19844
|
+
constructor(attributes, options) {
|
|
19845
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, PopTip.defaultAttributes, attributes));
|
|
20925
19846
|
this.name = 'poptip';
|
|
20926
19847
|
this.positionList = ['top', 'tl', 'tr', 'bottom', 'bl', 'br', 'left', 'lt', 'lb', 'right', 'rt', 'rb'];
|
|
20927
19848
|
}
|
|
@@ -21322,8 +20243,8 @@
|
|
|
21322
20243
|
}
|
|
21323
20244
|
|
|
21324
20245
|
class LineCrosshair extends CrosshairBase {
|
|
21325
|
-
constructor(attributes) {
|
|
21326
|
-
super(vutils.merge({}, LineCrosshair.defaultAttributes, attributes));
|
|
20246
|
+
constructor(attributes, options) {
|
|
20247
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, LineCrosshair.defaultAttributes, attributes));
|
|
21327
20248
|
}
|
|
21328
20249
|
renderCrosshair(container) {
|
|
21329
20250
|
const { start, end, lineStyle } = this.attribute;
|
|
@@ -21347,8 +20268,8 @@
|
|
|
21347
20268
|
};
|
|
21348
20269
|
|
|
21349
20270
|
class RectCrosshair extends CrosshairBase {
|
|
21350
|
-
constructor(attributes) {
|
|
21351
|
-
super(vutils.merge({}, RectCrosshair.defaultAttributes, attributes));
|
|
20271
|
+
constructor(attributes, options) {
|
|
20272
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, RectCrosshair.defaultAttributes, attributes));
|
|
21352
20273
|
}
|
|
21353
20274
|
renderCrosshair(container) {
|
|
21354
20275
|
const { start, end, rectStyle } = this.attribute;
|
|
@@ -21371,8 +20292,8 @@
|
|
|
21371
20292
|
};
|
|
21372
20293
|
|
|
21373
20294
|
class CircleCrosshair extends CrosshairBase {
|
|
21374
|
-
constructor(attributes) {
|
|
21375
|
-
super(vutils.merge({}, CircleCrosshair.defaultAttributes, attributes));
|
|
20295
|
+
constructor(attributes, options) {
|
|
20296
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, CircleCrosshair.defaultAttributes, attributes));
|
|
21376
20297
|
}
|
|
21377
20298
|
renderCrosshair(container) {
|
|
21378
20299
|
const { center, radius, lineStyle } = this.attribute;
|
|
@@ -21394,8 +20315,8 @@
|
|
|
21394
20315
|
};
|
|
21395
20316
|
|
|
21396
20317
|
class SectorCrosshair extends CrosshairBase {
|
|
21397
|
-
constructor(attributes) {
|
|
21398
|
-
super(vutils.merge({}, SectorCrosshair.defaultAttributes, attributes));
|
|
20318
|
+
constructor(attributes, options) {
|
|
20319
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, SectorCrosshair.defaultAttributes, attributes));
|
|
21399
20320
|
}
|
|
21400
20321
|
renderCrosshair(container) {
|
|
21401
20322
|
const { center, radius, innerRadius = 0, sectorStyle } = this.attribute;
|
|
@@ -21423,8 +20344,8 @@
|
|
|
21423
20344
|
};
|
|
21424
20345
|
|
|
21425
20346
|
class PolygonCrosshair extends CrosshairBase {
|
|
21426
|
-
constructor(attributes) {
|
|
21427
|
-
super(vutils.merge({}, PolygonCrosshair.defaultAttributes, attributes));
|
|
20347
|
+
constructor(attributes, options) {
|
|
20348
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, PolygonCrosshair.defaultAttributes, attributes));
|
|
21428
20349
|
}
|
|
21429
20350
|
renderCrosshair(container) {
|
|
21430
20351
|
const { center, radius, sides = 6, lineStyle } = this.attribute;
|
|
@@ -21971,8 +20892,8 @@
|
|
|
21971
20892
|
setBitmapTool(bmpTool) {
|
|
21972
20893
|
this._bmpTool = bmpTool;
|
|
21973
20894
|
}
|
|
21974
|
-
constructor(attributes) {
|
|
21975
|
-
super(vutils.merge({}, LabelBase.defaultAttributes, attributes));
|
|
20895
|
+
constructor(attributes, options) {
|
|
20896
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, LabelBase.defaultAttributes, attributes));
|
|
21976
20897
|
this.name = 'label';
|
|
21977
20898
|
this._onHover = (e) => {
|
|
21978
20899
|
const target = e.target;
|
|
@@ -22584,8 +21505,8 @@
|
|
|
22584
21505
|
};
|
|
22585
21506
|
|
|
22586
21507
|
class SymbolLabel extends LabelBase {
|
|
22587
|
-
constructor(attributes) {
|
|
22588
|
-
super(vutils.merge({}, SymbolLabel.defaultAttributes, attributes));
|
|
21508
|
+
constructor(attributes, options) {
|
|
21509
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, SymbolLabel.defaultAttributes, attributes));
|
|
22589
21510
|
this.name = 'symbol-label';
|
|
22590
21511
|
}
|
|
22591
21512
|
labeling(textBounds, graphicBounds, position = 'top', offset = 0) {
|
|
@@ -22606,8 +21527,8 @@
|
|
|
22606
21527
|
};
|
|
22607
21528
|
|
|
22608
21529
|
class RectLabel extends LabelBase {
|
|
22609
|
-
constructor(attributes) {
|
|
22610
|
-
super(vutils.merge({}, RectLabel.defaultAttributes, attributes));
|
|
21530
|
+
constructor(attributes, options) {
|
|
21531
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, RectLabel.defaultAttributes, attributes));
|
|
22611
21532
|
}
|
|
22612
21533
|
labeling(textBounds, graphicBounds, position = 'top', offset = 0) {
|
|
22613
21534
|
if (!textBounds || !graphicBounds) {
|
|
@@ -22702,8 +21623,8 @@
|
|
|
22702
21623
|
};
|
|
22703
21624
|
|
|
22704
21625
|
class LineLabel extends LabelBase {
|
|
22705
|
-
constructor(attributes) {
|
|
22706
|
-
super(vutils.merge({}, LineLabel.defaultAttributes, attributes));
|
|
21626
|
+
constructor(attributes, options) {
|
|
21627
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, LineLabel.defaultAttributes, attributes));
|
|
22707
21628
|
this.name = 'line-label';
|
|
22708
21629
|
}
|
|
22709
21630
|
getGraphicBounds(graphic, point = {}) {
|
|
@@ -22780,8 +21701,8 @@
|
|
|
22780
21701
|
}
|
|
22781
21702
|
}
|
|
22782
21703
|
class ArcLabel extends LabelBase {
|
|
22783
|
-
constructor(attributes) {
|
|
22784
|
-
super(vutils.merge({}, ArcLabel.defaultAttributes, attributes));
|
|
21704
|
+
constructor(attributes, options) {
|
|
21705
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, ArcLabel.defaultAttributes, attributes));
|
|
22785
21706
|
this.name = 'arc-label';
|
|
22786
21707
|
this._ellipsisWidth = 0;
|
|
22787
21708
|
this._arcLeft = new Map();
|
|
@@ -23478,8 +22399,8 @@
|
|
|
23478
22399
|
};
|
|
23479
22400
|
|
|
23480
22401
|
class LineDataLabel extends LabelBase {
|
|
23481
|
-
constructor(attributes) {
|
|
23482
|
-
super(vutils.merge({}, LineDataLabel.defaultAttributes, attributes));
|
|
22402
|
+
constructor(attributes, options) {
|
|
22403
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, LineDataLabel.defaultAttributes, attributes));
|
|
23483
22404
|
this.name = 'line-data-label';
|
|
23484
22405
|
}
|
|
23485
22406
|
labeling(textBounds, graphicBounds, position = 'top', offset = 0) {
|
|
@@ -23506,8 +22427,8 @@
|
|
|
23506
22427
|
'line-data': LineDataLabel
|
|
23507
22428
|
};
|
|
23508
22429
|
class DataLabel extends AbstractComponent {
|
|
23509
|
-
constructor(attributes) {
|
|
23510
|
-
super(vutils.merge({}, DataLabel.defaultAttributes, attributes));
|
|
22430
|
+
constructor(attributes, options) {
|
|
22431
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, DataLabel.defaultAttributes, attributes));
|
|
23511
22432
|
this.name = 'data-label';
|
|
23512
22433
|
}
|
|
23513
22434
|
render() {
|
|
@@ -23582,8 +22503,8 @@
|
|
|
23582
22503
|
getMainSegmentPoints() {
|
|
23583
22504
|
return this._mainSegmentPoints;
|
|
23584
22505
|
}
|
|
23585
|
-
constructor(attributes) {
|
|
23586
|
-
super(vutils.merge({}, Segment.defaultAttributes, attributes));
|
|
22506
|
+
constructor(attributes, options) {
|
|
22507
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, Segment.defaultAttributes, attributes));
|
|
23587
22508
|
this.name = 'segment';
|
|
23588
22509
|
}
|
|
23589
22510
|
render() {
|
|
@@ -24609,11 +23530,8 @@
|
|
|
24609
23530
|
}
|
|
24610
23531
|
|
|
24611
23532
|
class LineAxis extends AxisBase {
|
|
24612
|
-
constructor(attributes,
|
|
24613
|
-
super(vutils.merge({}, LineAxis.defaultAttributes, attributes),
|
|
24614
|
-
if (mode === '3d') {
|
|
24615
|
-
this.setMode(mode);
|
|
24616
|
-
}
|
|
23533
|
+
constructor(attributes, options) {
|
|
23534
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, LineAxis.defaultAttributes, attributes), options);
|
|
24617
23535
|
}
|
|
24618
23536
|
_renderInner(container) {
|
|
24619
23537
|
var _a;
|
|
@@ -25093,8 +24011,8 @@
|
|
|
25093
24011
|
}
|
|
25094
24012
|
|
|
25095
24013
|
class CircleAxis extends AxisBase {
|
|
25096
|
-
constructor(attributes) {
|
|
25097
|
-
super(vutils.merge({}, CircleAxis.defaultAttributes, attributes));
|
|
24014
|
+
constructor(attributes, options) {
|
|
24015
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, CircleAxis.defaultAttributes, attributes));
|
|
25098
24016
|
}
|
|
25099
24017
|
renderLine(container) {
|
|
25100
24018
|
const { startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE, radius, center, innerRadius = 0, line, inside = false } = this.attribute;
|
|
@@ -25520,7 +24438,9 @@
|
|
|
25520
24438
|
const { center } = this.attribute;
|
|
25521
24439
|
path = getArcPath(center, points, false, !!closed);
|
|
25522
24440
|
}
|
|
25523
|
-
const shape = createPath(Object.assign({ path, z: depth }, (vutils.isFunction(style)
|
|
24441
|
+
const shape = createPath(Object.assign({ path, z: depth }, (vutils.isFunction(style)
|
|
24442
|
+
? vutils.merge({}, this.skipDefault ? null : BaseGrid.defaultAttributes.style, style(item, index))
|
|
24443
|
+
: style)));
|
|
25524
24444
|
shape.name = `${name}-line`;
|
|
25525
24445
|
shape.id = this._getNodeId(`${name}-path-${id}`);
|
|
25526
24446
|
container.add(shape);
|
|
@@ -25537,7 +24457,9 @@
|
|
|
25537
24457
|
const path = getLinePath(nextPoints, !!closed);
|
|
25538
24458
|
const deltaX = vutils.abs(nextPoints[0].x - nextPoints[1].x);
|
|
25539
24459
|
const deltaY = vutils.abs(nextPoints[0].y - nextPoints[1].y);
|
|
25540
|
-
const shape = createPath(Object.assign({ path, z: 0, alpha: deltaX > deltaY ? ((points[1].x - points[0].x > 0 ? -1 : 1) * vutils.pi) / 2 : 0, beta: deltaX < deltaY ? -vutils.pi / 2 : 0, anchor3d: deltaX > deltaY ? [nextPoints[0].x, 0] : [0, nextPoints[0].y] }, (vutils.isFunction(style)
|
|
24460
|
+
const shape = createPath(Object.assign({ path, z: 0, alpha: deltaX > deltaY ? ((points[1].x - points[0].x > 0 ? -1 : 1) * vutils.pi) / 2 : 0, beta: deltaX < deltaY ? -vutils.pi / 2 : 0, anchor3d: deltaX > deltaY ? [nextPoints[0].x, 0] : [0, nextPoints[0].y] }, (vutils.isFunction(style)
|
|
24461
|
+
? vutils.merge({}, this.skipDefault ? null : BaseGrid.defaultAttributes.style, style(item, index))
|
|
24462
|
+
: style)));
|
|
25541
24463
|
shape.name = `${name}-line`;
|
|
25542
24464
|
shape.id = this._getNodeId(`${name}-path-${id}`);
|
|
25543
24465
|
container.add(shape);
|
|
@@ -25593,11 +24515,8 @@
|
|
|
25593
24515
|
return points;
|
|
25594
24516
|
}
|
|
25595
24517
|
class LineAxisGrid extends BaseGrid {
|
|
25596
|
-
constructor(attributes,
|
|
25597
|
-
super(vutils.merge({}, BaseGrid.defaultAttributes, attributes),
|
|
25598
|
-
if (mode === '3d') {
|
|
25599
|
-
this.setMode(mode);
|
|
25600
|
-
}
|
|
24518
|
+
constructor(attributes, options) {
|
|
24519
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, BaseGrid.defaultAttributes, attributes), options);
|
|
25601
24520
|
}
|
|
25602
24521
|
_getGridPoint(gridType, point) {
|
|
25603
24522
|
let gridPoints;
|
|
@@ -25697,8 +24616,8 @@
|
|
|
25697
24616
|
vutils.mixin(LineAxisGrid, LineAxisMixin);
|
|
25698
24617
|
|
|
25699
24618
|
class CircleAxisGrid extends BaseGrid {
|
|
25700
|
-
constructor(attributes) {
|
|
25701
|
-
super(vutils.merge({}, BaseGrid.defaultAttributes, attributes));
|
|
24619
|
+
constructor(attributes, options) {
|
|
24620
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, BaseGrid.defaultAttributes, attributes), options);
|
|
25702
24621
|
}
|
|
25703
24622
|
getGridAttribute(isSubGrid) {
|
|
25704
24623
|
let gridAttribute;
|
|
@@ -25791,6 +24710,13 @@
|
|
|
25791
24710
|
}
|
|
25792
24711
|
vutils.mixin(CircleAxisGrid, CircleAxisMixin);
|
|
25793
24712
|
|
|
24713
|
+
var DataZoomActiveTag;
|
|
24714
|
+
(function (DataZoomActiveTag) {
|
|
24715
|
+
DataZoomActiveTag["startHandler"] = "startHandler";
|
|
24716
|
+
DataZoomActiveTag["endHandler"] = "endHandler";
|
|
24717
|
+
DataZoomActiveTag["middleHandler"] = "middleHandler";
|
|
24718
|
+
DataZoomActiveTag["background"] = "background";
|
|
24719
|
+
})(DataZoomActiveTag || (DataZoomActiveTag = {}));
|
|
25794
24720
|
const DEFAULT_DATA_ZOOM_ATTRIBUTES = {
|
|
25795
24721
|
orient: 'bottom',
|
|
25796
24722
|
showDetail: 'auto',
|
|
@@ -25889,21 +24815,13 @@
|
|
|
25889
24815
|
}
|
|
25890
24816
|
};
|
|
25891
24817
|
|
|
25892
|
-
exports.DataZoomActiveTag = void 0;
|
|
25893
|
-
(function (DataZoomActiveTag) {
|
|
25894
|
-
DataZoomActiveTag["startHandler"] = "startHandler";
|
|
25895
|
-
DataZoomActiveTag["endHandler"] = "endHandler";
|
|
25896
|
-
DataZoomActiveTag["middleHandler"] = "middleHandler";
|
|
25897
|
-
DataZoomActiveTag["background"] = "background";
|
|
25898
|
-
})(exports.DataZoomActiveTag || (exports.DataZoomActiveTag = {}));
|
|
25899
|
-
|
|
25900
24818
|
const delayMap$1 = {
|
|
25901
24819
|
debounce: vutils.debounce,
|
|
25902
24820
|
throttle: vutils.throttle
|
|
25903
24821
|
};
|
|
25904
24822
|
class DataZoom extends AbstractComponent {
|
|
25905
|
-
constructor(attributes) {
|
|
25906
|
-
super(vutils.merge({}, DataZoom.defaultAttributes, attributes));
|
|
24823
|
+
constructor(attributes, options) {
|
|
24824
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, DataZoom.defaultAttributes, attributes));
|
|
25907
24825
|
this.name = 'dataZoom';
|
|
25908
24826
|
this._previewData = [];
|
|
25909
24827
|
this._activeState = false;
|
|
@@ -25924,23 +24842,23 @@
|
|
|
25924
24842
|
this._onHandlerPointerDown = (e, tag) => {
|
|
25925
24843
|
e.stopPropagation();
|
|
25926
24844
|
if (tag === 'start') {
|
|
25927
|
-
this._activeTag =
|
|
24845
|
+
this._activeTag = DataZoomActiveTag.startHandler;
|
|
25928
24846
|
this._activeItem = this._startHandler;
|
|
25929
24847
|
}
|
|
25930
24848
|
else if (tag === 'end') {
|
|
25931
|
-
this._activeTag =
|
|
24849
|
+
this._activeTag = DataZoomActiveTag.endHandler;
|
|
25932
24850
|
this._activeItem = this._endHandler;
|
|
25933
24851
|
}
|
|
25934
24852
|
else if (tag === 'middleRect') {
|
|
25935
|
-
this._activeTag =
|
|
24853
|
+
this._activeTag = DataZoomActiveTag.middleHandler;
|
|
25936
24854
|
this._activeItem = this._middleHandlerRect;
|
|
25937
24855
|
}
|
|
25938
24856
|
else if (tag === 'middleSymbol') {
|
|
25939
|
-
this._activeTag =
|
|
24857
|
+
this._activeTag = DataZoomActiveTag.middleHandler;
|
|
25940
24858
|
this._activeItem = this._middleHandlerSymbol;
|
|
25941
24859
|
}
|
|
25942
24860
|
else if (tag === 'background') {
|
|
25943
|
-
this._activeTag =
|
|
24861
|
+
this._activeTag = DataZoomActiveTag.background;
|
|
25944
24862
|
this._activeItem = this._background;
|
|
25945
24863
|
}
|
|
25946
24864
|
this._activeState = true;
|
|
@@ -25948,7 +24866,6 @@
|
|
|
25948
24866
|
this._activeCache.lastPos = this.eventPosToStagePos(e);
|
|
25949
24867
|
};
|
|
25950
24868
|
this._onHandlerPointerMove = (e) => {
|
|
25951
|
-
var _a;
|
|
25952
24869
|
e.stopPropagation();
|
|
25953
24870
|
const { start: startAttr, end: endAttr, brushSelect, realTime = true } = this.attribute;
|
|
25954
24871
|
const pos = this.eventPosToStagePos(e);
|
|
@@ -25956,24 +24873,24 @@
|
|
|
25956
24873
|
const dis = (pos[attPos] - this._activeCache.lastPos[attPos]) / max;
|
|
25957
24874
|
let { start, end } = this.state;
|
|
25958
24875
|
if (this._activeState) {
|
|
25959
|
-
if (this._activeTag ===
|
|
24876
|
+
if (this._activeTag === DataZoomActiveTag.middleHandler) {
|
|
25960
24877
|
this.moveZoomWithMiddle((this.state.start + this.state.end) / 2 + dis);
|
|
25961
24878
|
}
|
|
25962
|
-
else if (this._activeTag ===
|
|
24879
|
+
else if (this._activeTag === DataZoomActiveTag.startHandler) {
|
|
25963
24880
|
if (start + dis > end) {
|
|
25964
24881
|
start = end;
|
|
25965
24882
|
end = start + dis;
|
|
25966
|
-
this._activeTag =
|
|
24883
|
+
this._activeTag = DataZoomActiveTag.endHandler;
|
|
25967
24884
|
}
|
|
25968
24885
|
else {
|
|
25969
24886
|
start = start + dis;
|
|
25970
24887
|
}
|
|
25971
24888
|
}
|
|
25972
|
-
else if (this._activeTag ===
|
|
24889
|
+
else if (this._activeTag === DataZoomActiveTag.endHandler) {
|
|
25973
24890
|
if (end + dis < start) {
|
|
25974
24891
|
end = start;
|
|
25975
24892
|
start = end + dis;
|
|
25976
|
-
this._activeTag =
|
|
24893
|
+
this._activeTag = DataZoomActiveTag.startHandler;
|
|
25977
24894
|
}
|
|
25978
24895
|
else {
|
|
25979
24896
|
end = end + dis;
|
|
@@ -25986,7 +24903,7 @@
|
|
|
25986
24903
|
end = Math.min(Math.max(end, 0), 1);
|
|
25987
24904
|
if (startAttr !== start || endAttr !== end) {
|
|
25988
24905
|
this.setStateAttr(start, end, true);
|
|
25989
|
-
realTime &&
|
|
24906
|
+
realTime && this._updateStateCallback && this._updateStateCallback(start, end);
|
|
25990
24907
|
this._dispatchChangeEvent(start, end);
|
|
25991
24908
|
}
|
|
25992
24909
|
};
|
|
@@ -26091,11 +25008,10 @@
|
|
|
26091
25008
|
};
|
|
26092
25009
|
}
|
|
26093
25010
|
_onHandlerPointerUp(e) {
|
|
26094
|
-
var _a;
|
|
26095
25011
|
e.preventDefault();
|
|
26096
25012
|
const { start, end, brushSelect, realTime = true } = this.attribute;
|
|
26097
25013
|
if (this._activeState) {
|
|
26098
|
-
if (this._activeTag ===
|
|
25014
|
+
if (this._activeTag === DataZoomActiveTag.background) {
|
|
26099
25015
|
const pos = this.eventPosToStagePos(e);
|
|
26100
25016
|
this.backgroundDragZoom(this._activeCache.startPos, pos);
|
|
26101
25017
|
}
|
|
@@ -26104,7 +25020,7 @@
|
|
|
26104
25020
|
brushSelect && this.renderDragMask();
|
|
26105
25021
|
if (!realTime || start !== this.state.start || end !== this.state.end) {
|
|
26106
25022
|
this.setStateAttr(this.state.start, this.state.end, true);
|
|
26107
|
-
|
|
25023
|
+
this._updateStateCallback && this._updateStateCallback(this.state.start, this.state.end);
|
|
26108
25024
|
this._dispatchChangeEvent(this.state.start, this.state.end);
|
|
26109
25025
|
}
|
|
26110
25026
|
}
|
|
@@ -26154,11 +25070,11 @@
|
|
|
26154
25070
|
const { dragMaskStyle } = this.attribute;
|
|
26155
25071
|
const { position, width, height } = this.getLayoutAttrFromConfig();
|
|
26156
25072
|
if (this._isHorizontal) {
|
|
26157
|
-
this._dragMask = this._container.createOrUpdateChild('dragMask', Object.assign({ x: vutils.clamp(this.dragMaskSize() < 0 ? this._activeCache.lastPos.x : this._activeCache.startPos.x, position.x, position.x + width), y: position.y, width: (this._activeState && this._activeTag ===
|
|
25073
|
+
this._dragMask = this._container.createOrUpdateChild('dragMask', Object.assign({ x: vutils.clamp(this.dragMaskSize() < 0 ? this._activeCache.lastPos.x : this._activeCache.startPos.x, position.x, position.x + width), y: position.y, width: (this._activeState && this._activeTag === DataZoomActiveTag.background && Math.abs(this.dragMaskSize())) ||
|
|
26158
25074
|
0, height }, dragMaskStyle), 'rect');
|
|
26159
25075
|
}
|
|
26160
25076
|
else {
|
|
26161
|
-
this._dragMask = this._container.createOrUpdateChild('dragMask', Object.assign({ x: position.x, y: vutils.clamp(this.dragMaskSize() < 0 ? this._activeCache.lastPos.y : this._activeCache.startPos.y, position.y, position.y + height), width, height: (this._activeState && this._activeTag ===
|
|
25077
|
+
this._dragMask = this._container.createOrUpdateChild('dragMask', Object.assign({ x: position.x, y: vutils.clamp(this.dragMaskSize() < 0 ? this._activeCache.lastPos.y : this._activeCache.startPos.y, position.y, position.y + height), width, height: (this._activeState && this._activeTag === DataZoomActiveTag.background && Math.abs(this.dragMaskSize())) ||
|
|
26162
25078
|
0 }, dragMaskStyle), 'rect');
|
|
26163
25079
|
}
|
|
26164
25080
|
}
|
|
@@ -26477,14 +25393,13 @@
|
|
|
26477
25393
|
this.dispatchEvent(changeEvent);
|
|
26478
25394
|
}
|
|
26479
25395
|
setStartAndEnd(start, end) {
|
|
26480
|
-
var _a;
|
|
26481
25396
|
const { start: startAttr, end: endAttr } = this.attribute;
|
|
26482
25397
|
if (vutils.isValid(start) && vutils.isValid(end) && (start !== this.state.start || end !== this.state.end)) {
|
|
26483
25398
|
this.state.start = start;
|
|
26484
25399
|
this.state.end = end;
|
|
26485
25400
|
if (startAttr !== this.state.start || endAttr !== this.state.end) {
|
|
26486
25401
|
this.setStateAttr(start, end, true);
|
|
26487
|
-
|
|
25402
|
+
this._updateStateCallback && this._updateStateCallback(start, end);
|
|
26488
25403
|
this._dispatchChangeEvent(start, end);
|
|
26489
25404
|
}
|
|
26490
25405
|
}
|
|
@@ -26892,8 +25807,8 @@
|
|
|
26892
25807
|
getLabel() {
|
|
26893
25808
|
return this._label;
|
|
26894
25809
|
}
|
|
26895
|
-
constructor(attributes) {
|
|
26896
|
-
super(vutils.merge({}, MarkLine.defaultAttributes, attributes));
|
|
25810
|
+
constructor(attributes, options) {
|
|
25811
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, MarkLine.defaultAttributes, attributes));
|
|
26897
25812
|
this.name = 'markLine';
|
|
26898
25813
|
}
|
|
26899
25814
|
setLabelPos() {
|
|
@@ -26987,8 +25902,8 @@
|
|
|
26987
25902
|
getLabel() {
|
|
26988
25903
|
return this._label;
|
|
26989
25904
|
}
|
|
26990
|
-
constructor(attributes) {
|
|
26991
|
-
super(vutils.merge({}, MarkArea.defaultAttributes, attributes));
|
|
25905
|
+
constructor(attributes, options) {
|
|
25906
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, MarkArea.defaultAttributes, attributes));
|
|
26992
25907
|
this.name = 'markArea';
|
|
26993
25908
|
}
|
|
26994
25909
|
_getPositionByDirection(area, direction) {
|
|
@@ -27070,8 +25985,8 @@
|
|
|
27070
25985
|
MarkArea.defaultAttributes = DEFAULT_MARK_AREA_THEME;
|
|
27071
25986
|
|
|
27072
25987
|
class MarkPoint extends Marker {
|
|
27073
|
-
constructor(attributes) {
|
|
27074
|
-
super(vutils.merge({}, MarkPoint.defaultAttributes, attributes));
|
|
25988
|
+
constructor(attributes, options) {
|
|
25989
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, MarkPoint.defaultAttributes, attributes));
|
|
27075
25990
|
this.name = 'markPoint';
|
|
27076
25991
|
}
|
|
27077
25992
|
setLabelPos() {
|
|
@@ -27292,8 +26207,8 @@
|
|
|
27292
26207
|
getCurrent() {
|
|
27293
26208
|
return this._current;
|
|
27294
26209
|
}
|
|
27295
|
-
constructor(attributes) {
|
|
27296
|
-
super(vutils.merge({}, Pager.defaultAttributes, attributes));
|
|
26210
|
+
constructor(attributes, options) {
|
|
26211
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, Pager.defaultAttributes, attributes));
|
|
27297
26212
|
this.name = 'pager';
|
|
27298
26213
|
this._current = 1;
|
|
27299
26214
|
this._onHover = (e) => {
|
|
@@ -27559,8 +26474,8 @@
|
|
|
27559
26474
|
[exports.LegendStateValue.unSelectedHover]: {}
|
|
27560
26475
|
};
|
|
27561
26476
|
class DiscreteLegend extends LegendBase {
|
|
27562
|
-
constructor(attributes) {
|
|
27563
|
-
super(vutils.merge({}, DiscreteLegend.defaultAttributes, attributes));
|
|
26477
|
+
constructor(attributes, options) {
|
|
26478
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, DiscreteLegend.defaultAttributes, attributes));
|
|
27564
26479
|
this.name = 'discreteLegend';
|
|
27565
26480
|
this._itemsContainer = null;
|
|
27566
26481
|
this._itemHeightByUser = undefined;
|
|
@@ -28277,8 +27192,8 @@
|
|
|
28277
27192
|
get endHandler() {
|
|
28278
27193
|
return this._endHandler;
|
|
28279
27194
|
}
|
|
28280
|
-
constructor(attributes) {
|
|
28281
|
-
super(vutils.merge({}, Slider.defaultAttributes, attributes));
|
|
27195
|
+
constructor(attributes, options) {
|
|
27196
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, Slider.defaultAttributes, attributes));
|
|
28282
27197
|
this.name = 'slider';
|
|
28283
27198
|
this._isHorizontal = true;
|
|
28284
27199
|
this._startHandler = null;
|
|
@@ -28897,8 +27812,8 @@
|
|
|
28897
27812
|
};
|
|
28898
27813
|
|
|
28899
27814
|
class ColorContinuousLegend extends LegendBase {
|
|
28900
|
-
constructor(attributes) {
|
|
28901
|
-
super(vutils.merge({}, ColorContinuousLegend.defaultAttributes, attributes));
|
|
27815
|
+
constructor(attributes, options) {
|
|
27816
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, ColorContinuousLegend.defaultAttributes, attributes));
|
|
28902
27817
|
this.name = 'colorLegend';
|
|
28903
27818
|
this._onSliderChange = (e) => {
|
|
28904
27819
|
this._updateColor();
|
|
@@ -29093,8 +28008,8 @@
|
|
|
29093
28008
|
`;
|
|
29094
28009
|
}
|
|
29095
28010
|
class SizeContinuousLegend extends LegendBase {
|
|
29096
|
-
constructor(attributes) {
|
|
29097
|
-
super(vutils.merge({}, SizeContinuousLegend.defaultAttributes, attributes));
|
|
28011
|
+
constructor(attributes, options) {
|
|
28012
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, SizeContinuousLegend.defaultAttributes, attributes));
|
|
29098
28013
|
this.name = 'sizeLegend';
|
|
29099
28014
|
this._onSliderChange = (e) => {
|
|
29100
28015
|
this.dispatchEvent(e);
|
|
@@ -29203,8 +28118,8 @@
|
|
|
29203
28118
|
};
|
|
29204
28119
|
|
|
29205
28120
|
class Title extends AbstractComponent {
|
|
29206
|
-
constructor(attributes) {
|
|
29207
|
-
super(vutils.merge({}, Title.defaultAttributes, attributes));
|
|
28121
|
+
constructor(attributes, options) {
|
|
28122
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, Title.defaultAttributes, attributes));
|
|
29208
28123
|
this.name = 'title';
|
|
29209
28124
|
}
|
|
29210
28125
|
render() {
|
|
@@ -29563,8 +28478,8 @@
|
|
|
29563
28478
|
Z`;
|
|
29564
28479
|
};
|
|
29565
28480
|
class LinkPath extends AbstractComponent {
|
|
29566
|
-
constructor(attributes) {
|
|
29567
|
-
super(vutils.merge({}, LinkPath.defaultAttributes, attributes));
|
|
28481
|
+
constructor(attributes, options) {
|
|
28482
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, LinkPath.defaultAttributes, attributes));
|
|
29568
28483
|
}
|
|
29569
28484
|
render() {
|
|
29570
28485
|
const { direction = 'horizontal' } = this.attribute;
|
|
@@ -29642,8 +28557,8 @@
|
|
|
29642
28557
|
})(ControllerTypeEnum || (ControllerTypeEnum = {}));
|
|
29643
28558
|
|
|
29644
28559
|
class Controller extends AbstractComponent {
|
|
29645
|
-
constructor(attributes) {
|
|
29646
|
-
super(vutils.merge({}, Controller.defaultAttributes, attributes));
|
|
28560
|
+
constructor(attributes, options) {
|
|
28561
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, Controller.defaultAttributes, attributes));
|
|
29647
28562
|
this._isPaused = true;
|
|
29648
28563
|
this.updateAttributes = () => {
|
|
29649
28564
|
this._startAttr = {
|
|
@@ -29861,8 +28776,8 @@
|
|
|
29861
28776
|
};
|
|
29862
28777
|
|
|
29863
28778
|
class BasePlayer extends AbstractComponent {
|
|
29864
|
-
constructor(attributes) {
|
|
29865
|
-
super(vutils.merge({}, BasePlayer.defaultAttributes, attributes));
|
|
28779
|
+
constructor(attributes, options) {
|
|
28780
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, BasePlayer.defaultAttributes, attributes));
|
|
29866
28781
|
this._data = [];
|
|
29867
28782
|
this._layoutInfo = {};
|
|
29868
28783
|
this._updateSliderAttrs = () => {
|
|
@@ -30062,8 +28977,8 @@
|
|
|
30062
28977
|
};
|
|
30063
28978
|
|
|
30064
28979
|
class DiscretePlayer extends BasePlayer {
|
|
30065
|
-
constructor(attributes) {
|
|
30066
|
-
super(vutils.merge({}, attributes));
|
|
28980
|
+
constructor(attributes, options) {
|
|
28981
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, attributes));
|
|
30067
28982
|
this._activeIndex = -1;
|
|
30068
28983
|
this._isReachEnd = false;
|
|
30069
28984
|
this._initAttributes = () => {
|
|
@@ -30403,8 +29318,8 @@
|
|
|
30403
29318
|
throttle: vutils.throttle
|
|
30404
29319
|
};
|
|
30405
29320
|
class Brush extends AbstractComponent {
|
|
30406
|
-
constructor(attributes) {
|
|
30407
|
-
super(vutils.merge({}, Brush.defaultAttributes, attributes));
|
|
29321
|
+
constructor(attributes, options) {
|
|
29322
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, Brush.defaultAttributes, attributes));
|
|
30408
29323
|
this.name = 'brush';
|
|
30409
29324
|
this._activeDrawState = false;
|
|
30410
29325
|
this._cacheDrawPoints = [];
|
|
@@ -30794,8 +29709,8 @@
|
|
|
30794
29709
|
const TOOLTIP_KEY_NAME_SUFFIX = 'key';
|
|
30795
29710
|
const TOOLTIP_VALUE_NAME_SUFFIX = 'value';
|
|
30796
29711
|
class Tooltip extends AbstractComponent {
|
|
30797
|
-
constructor(attributes) {
|
|
30798
|
-
super(vutils.merge({}, Tooltip.defaultAttributes, attributes));
|
|
29712
|
+
constructor(attributes, options) {
|
|
29713
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, Tooltip.defaultAttributes, attributes), options);
|
|
30799
29714
|
this.name = 'tooltip';
|
|
30800
29715
|
}
|
|
30801
29716
|
render() {
|
|
@@ -30862,7 +29777,9 @@
|
|
|
30862
29777
|
let x = 0;
|
|
30863
29778
|
if (isVisible(itemAttr.shape)) {
|
|
30864
29779
|
itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_SHAPE_NAME_SUFFIX}`, Object.assign({ visible: true, x: itemAttr.shape.size / 2, y: itemAttr.shape.size / 2 +
|
|
30865
|
-
(((_a = itemAttr.key.lineHeight) !== null && _a !== void 0 ? _a : itemAttr.key.fontSize) -
|
|
29780
|
+
(((_a = calculateLineHeight(itemAttr.key.lineHeight, itemAttr.key.fontSize)) !== null && _a !== void 0 ? _a : itemAttr.key.fontSize) -
|
|
29781
|
+
itemAttr.shape.size) /
|
|
29782
|
+
2 }, itemAttr.shape), 'symbol');
|
|
30866
29783
|
}
|
|
30867
29784
|
if (hasContentShape) {
|
|
30868
29785
|
x += itemAttr.shape.size + itemAttr.shape.spacing;
|
|
@@ -31080,8 +29997,8 @@
|
|
|
31080
29997
|
const checkSvg = '<svg width="200" height="200" viewBox="0 0 1024 1024" fill="#fff" xmlns="http://www.w3.org/2000/svg"><path d="M877.44815445 206.10060629a64.72691371 64.72691371 0 0 0-95.14856334 4.01306852L380.73381888 685.46812814 235.22771741 533.48933518a64.72691371 64.72691371 0 0 0-92.43003222-1.03563036l-45.82665557 45.82665443a64.72691371 64.72691371 0 0 0-0.90617629 90.61767965l239.61903446 250.10479331a64.72691371 64.72691371 0 0 0 71.19960405 15.14609778 64.33855261 64.33855261 0 0 0 35.08198741-21.23042702l36.24707186-42.71976334 40.5190474-40.77795556-3.36579926-3.49525333 411.40426297-486.74638962a64.72691371 64.72691371 0 0 0-3.88361443-87.64024149l-45.3088404-45.43829334z"></path></svg>';
|
|
31081
29998
|
const indeterminateSvg = '<svg width="200" height="200" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="none"><path stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="5" d="M5 12h14"/></svg>';
|
|
31082
29999
|
class CheckBox extends AbstractComponent {
|
|
31083
|
-
constructor(attributes) {
|
|
31084
|
-
super(vutils.merge({}, CheckBox.defaultAttributes, attributes));
|
|
30000
|
+
constructor(attributes, options) {
|
|
30001
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, CheckBox.defaultAttributes, attributes));
|
|
31085
30002
|
this.renderGroup();
|
|
31086
30003
|
this.onBeforeAttributeUpdate = (val, attributes, key) => {
|
|
31087
30004
|
if ('interactive' in val) {
|
|
@@ -31243,7 +30160,7 @@
|
|
|
31243
30160
|
}
|
|
31244
30161
|
};
|
|
31245
30162
|
|
|
31246
|
-
const version = "0.17.0-alpha.
|
|
30163
|
+
const version = "0.17.0-alpha.3";
|
|
31247
30164
|
|
|
31248
30165
|
exports.AbstractComponent = AbstractComponent;
|
|
31249
30166
|
exports.ArcInfo = ArcInfo;
|