@visactor/vrender-components 0.17.0-alpha.1 → 0.17.0-alpha.2
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 +669 -1787
- 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,23 +571,6 @@
|
|
|
656
571
|
return Metadata;
|
|
657
572
|
}();
|
|
658
573
|
|
|
659
|
-
function getFirstArrayDuplicate(array) {
|
|
660
|
-
var seenValues = new Set();
|
|
661
|
-
var _iterator = _createForOfIteratorHelper(array),
|
|
662
|
-
_step;
|
|
663
|
-
try {
|
|
664
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
665
|
-
var entry = _step.value;
|
|
666
|
-
if (seenValues.has(entry)) return entry;
|
|
667
|
-
seenValues.add(entry);
|
|
668
|
-
}
|
|
669
|
-
} catch (err) {
|
|
670
|
-
_iterator.e(err);
|
|
671
|
-
} finally {
|
|
672
|
-
_iterator.f();
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
|
|
676
574
|
var Reflect$1;
|
|
677
575
|
var Reflect$2 = (function (Reflect) {
|
|
678
576
|
return function (factory) {
|
|
@@ -1060,70 +958,25 @@
|
|
|
1060
958
|
}(), Reflect;
|
|
1061
959
|
})(Reflect$1 || (Reflect$1 = {}));
|
|
1062
960
|
|
|
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
961
|
function _tagParameterOrProperty(metadataKey, annotationTarget, key, metadata) {
|
|
1088
962
|
var _paramOrPropertyMetad;
|
|
1089
|
-
var metadatas =
|
|
963
|
+
var metadatas = [metadata];
|
|
1090
964
|
var paramsOrPropertiesMetadata = {};
|
|
1091
965
|
Reflect$2.hasOwnMetadata(metadataKey, annotationTarget) && (paramsOrPropertiesMetadata = Reflect$2.getMetadata(metadataKey, annotationTarget));
|
|
1092
966
|
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);
|
|
967
|
+
void 0 === paramOrPropertyMetadata && (paramOrPropertyMetadata = []), (_paramOrPropertyMetad = paramOrPropertyMetadata).push.apply(_paramOrPropertyMetad, metadatas), paramsOrPropertiesMetadata[key] = paramOrPropertyMetadata, Reflect$2.defineMetadata(metadataKey, paramsOrPropertiesMetadata, annotationTarget);
|
|
968
|
+
}
|
|
969
|
+
function tagParameter(annotationTarget, parameterName, parameterIndex, metadata) {
|
|
970
|
+
_tagParameterOrProperty(TAGGED, annotationTarget, parameterIndex.toString(), metadata);
|
|
1113
971
|
}
|
|
1114
972
|
function createTaggedDecorator(metadata) {
|
|
1115
973
|
return function (target, targetKey, indexOrPropertyDescriptor) {
|
|
1116
|
-
|
|
974
|
+
tagParameter(target, targetKey, indexOrPropertyDescriptor, metadata);
|
|
1117
975
|
};
|
|
1118
976
|
}
|
|
1119
|
-
|
|
1120
977
|
function injectBase(metadataKey) {
|
|
1121
978
|
return function (serviceIdentifier) {
|
|
1122
979
|
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
980
|
return createTaggedDecorator(new Metadata(metadataKey, serviceIdentifier))(target, targetKey, indexOrPropertyDescriptor);
|
|
1128
981
|
};
|
|
1129
982
|
};
|
|
@@ -1135,9 +988,7 @@
|
|
|
1135
988
|
|
|
1136
989
|
function injectable() {
|
|
1137
990
|
return function (target) {
|
|
1138
|
-
|
|
1139
|
-
var types = Reflect$2.getMetadata(DESIGN_PARAM_TYPES, target) || [];
|
|
1140
|
-
return Reflect$2.defineMetadata(PARAM_TYPES, types, target), target;
|
|
991
|
+
return Reflect$2.defineMetadata(PARAM_TYPES, null, target), target;
|
|
1141
992
|
};
|
|
1142
993
|
}
|
|
1143
994
|
|
|
@@ -1146,7 +997,6 @@
|
|
|
1146
997
|
}
|
|
1147
998
|
|
|
1148
999
|
var BindingScopeEnum = {
|
|
1149
|
-
Request: "Request",
|
|
1150
1000
|
Singleton: "Singleton",
|
|
1151
1001
|
Transient: "Transient"
|
|
1152
1002
|
},
|
|
@@ -1159,25 +1009,20 @@
|
|
|
1159
1009
|
Instance: "Instance",
|
|
1160
1010
|
Invalid: "Invalid",
|
|
1161
1011
|
Provider: "Provider"
|
|
1162
|
-
},
|
|
1163
|
-
TargetTypeEnum = {
|
|
1164
|
-
ClassProperty: "ClassProperty",
|
|
1165
|
-
ConstructorArgument: "ConstructorArgument",
|
|
1166
|
-
Variable: "Variable"
|
|
1167
1012
|
};
|
|
1168
1013
|
|
|
1169
1014
|
var Binding = /*#__PURE__*/function () {
|
|
1170
1015
|
function Binding(serviceIdentifier, scope) {
|
|
1171
1016
|
_classCallCheck(this, Binding);
|
|
1172
|
-
this.id =
|
|
1017
|
+
this.id = Generator.GenAutoIncrementId(), this.activated = !1, this.serviceIdentifier = serviceIdentifier, this.scope = scope, this.type = BindingTypeEnum.Invalid, this.constraint = function (request) {
|
|
1173
1018
|
return !0;
|
|
1174
|
-
}, this.implementationType = null, this.cache = null, this.factory = null, this.provider = null, this.
|
|
1019
|
+
}, this.implementationType = null, this.cache = null, this.factory = null, this.provider = null, this.dynamicValue = null;
|
|
1175
1020
|
}
|
|
1176
1021
|
_createClass(Binding, [{
|
|
1177
1022
|
key: "clone",
|
|
1178
1023
|
value: function clone() {
|
|
1179
1024
|
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.
|
|
1025
|
+
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
1026
|
}
|
|
1182
1027
|
}]);
|
|
1183
1028
|
return Binding;
|
|
@@ -1198,1450 +1043,321 @@
|
|
|
1198
1043
|
}, {
|
|
1199
1044
|
key: "getPropertiesMetadata",
|
|
1200
1045
|
value: function getPropertiesMetadata(constructorFunc) {
|
|
1201
|
-
|
|
1046
|
+
throw new Error("暂未实现");
|
|
1202
1047
|
}
|
|
1203
1048
|
}]);
|
|
1204
1049
|
return MetadataReader;
|
|
1205
1050
|
}();
|
|
1206
1051
|
|
|
1207
|
-
var
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1052
|
+
var taggedConstraint = function taggedConstraint(key) {
|
|
1053
|
+
return function (value) {
|
|
1054
|
+
var constraint = function constraint(request) {
|
|
1055
|
+
if (null == request || null == request.constructorArgsMetadata) return !1;
|
|
1056
|
+
var constructorArgsMetadata = request.constructorArgsMetadata;
|
|
1057
|
+
for (var i = 0; i < constructorArgsMetadata.length; i++) if (constructorArgsMetadata[i].key === key && constructorArgsMetadata[i].value === value) return !0;
|
|
1058
|
+
return !1;
|
|
1059
|
+
};
|
|
1060
|
+
return constraint.metaData = new Metadata(key, value), constraint;
|
|
1061
|
+
};
|
|
1211
1062
|
};
|
|
1063
|
+
var namedConstraint = taggedConstraint(NAMED_TAG);
|
|
1212
1064
|
|
|
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;
|
|
1065
|
+
var BindingInSyntax = /*#__PURE__*/function () {
|
|
1066
|
+
function BindingInSyntax(binding) {
|
|
1067
|
+
_classCallCheck(this, BindingInSyntax);
|
|
1068
|
+
this._binding = binding;
|
|
1253
1069
|
}
|
|
1254
|
-
_createClass(
|
|
1255
|
-
key: "
|
|
1256
|
-
value: function
|
|
1257
|
-
|
|
1070
|
+
_createClass(BindingInSyntax, [{
|
|
1071
|
+
key: "inRequestScope",
|
|
1072
|
+
value: function inRequestScope() {
|
|
1073
|
+
throw new Error("暂未实现");
|
|
1258
1074
|
}
|
|
1259
1075
|
}, {
|
|
1260
|
-
key: "
|
|
1261
|
-
value: function
|
|
1262
|
-
this.
|
|
1076
|
+
key: "inSingletonScope",
|
|
1077
|
+
value: function inSingletonScope() {
|
|
1078
|
+
return this._binding.scope = BindingScopeEnum.Singleton, this;
|
|
1263
1079
|
}
|
|
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();
|
|
1080
|
+
}, {
|
|
1081
|
+
key: "inTransientScope",
|
|
1082
|
+
value: function inTransientScope() {
|
|
1083
|
+
return this._binding.scope = BindingScopeEnum.Transient, this;
|
|
1084
|
+
}
|
|
1085
|
+
}, {
|
|
1086
|
+
key: "whenTargetNamed",
|
|
1087
|
+
value: function whenTargetNamed(name) {
|
|
1088
|
+
return this._binding.constraint = namedConstraint(name), this;
|
|
1282
1089
|
}
|
|
1283
1090
|
}]);
|
|
1284
|
-
return
|
|
1091
|
+
return BindingInSyntax;
|
|
1285
1092
|
}();
|
|
1286
1093
|
|
|
1287
|
-
var
|
|
1288
|
-
function
|
|
1289
|
-
_classCallCheck(this,
|
|
1290
|
-
this.
|
|
1094
|
+
var BindingToSyntax = /*#__PURE__*/function () {
|
|
1095
|
+
function BindingToSyntax(binding) {
|
|
1096
|
+
_classCallCheck(this, BindingToSyntax);
|
|
1097
|
+
this._binding = binding;
|
|
1291
1098
|
}
|
|
1292
|
-
_createClass(
|
|
1293
|
-
key: "
|
|
1294
|
-
value: function
|
|
1295
|
-
return
|
|
1099
|
+
_createClass(BindingToSyntax, [{
|
|
1100
|
+
key: "to",
|
|
1101
|
+
value: function to(constructor) {
|
|
1102
|
+
return this._binding.type = BindingTypeEnum.Instance, this._binding.implementationType = constructor, new BindingInSyntax(this._binding);
|
|
1103
|
+
}
|
|
1104
|
+
}, {
|
|
1105
|
+
key: "toSelf",
|
|
1106
|
+
value: function toSelf() {
|
|
1107
|
+
var self = this._binding.serviceIdentifier;
|
|
1108
|
+
return this.to(self);
|
|
1109
|
+
}
|
|
1110
|
+
}, {
|
|
1111
|
+
key: "toDynamicValue",
|
|
1112
|
+
value: function toDynamicValue(func) {
|
|
1113
|
+
return this._binding.type = BindingTypeEnum.DynamicValue, this._binding.cache = null, this._binding.dynamicValue = func, this._binding.implementationType = null, new BindingInSyntax(this._binding);
|
|
1114
|
+
}
|
|
1115
|
+
}, {
|
|
1116
|
+
key: "toConstantValue",
|
|
1117
|
+
value: function toConstantValue(value) {
|
|
1118
|
+
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
1119
|
}
|
|
1297
1120
|
}, {
|
|
1298
|
-
key: "
|
|
1299
|
-
value: function
|
|
1300
|
-
return this.
|
|
1121
|
+
key: "toFactory",
|
|
1122
|
+
value: function toFactory(factory) {
|
|
1123
|
+
return this._binding.type = BindingTypeEnum.Factory, this._binding.factory = factory, this._binding.scope = BindingScopeEnum.Singleton, new BindingInSyntax(this._binding);
|
|
1301
1124
|
}
|
|
1302
1125
|
}, {
|
|
1303
|
-
key: "
|
|
1304
|
-
value: function
|
|
1305
|
-
|
|
1126
|
+
key: "toService",
|
|
1127
|
+
value: function toService(service) {
|
|
1128
|
+
this.toDynamicValue(function (context) {
|
|
1129
|
+
return context.container.get(service);
|
|
1130
|
+
});
|
|
1306
1131
|
}
|
|
1307
1132
|
}]);
|
|
1308
|
-
return
|
|
1133
|
+
return BindingToSyntax;
|
|
1309
1134
|
}();
|
|
1310
1135
|
|
|
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;
|
|
1136
|
+
var Container = /*#__PURE__*/function () {
|
|
1137
|
+
function Container(containerOptions) {
|
|
1138
|
+
_classCallCheck(this, Container);
|
|
1139
|
+
var options = containerOptions || {};
|
|
1140
|
+
options.defaultScope = options.defaultScope || BindingScopeEnum.Transient, this.options = options, this.id = Generator.GenAutoIncrementId(), this._bindingDictionary = new Map(), this._metadataReader = new MetadataReader();
|
|
1141
|
+
}
|
|
1142
|
+
_createClass(Container, [{
|
|
1143
|
+
key: "load",
|
|
1144
|
+
value: function load(module) {
|
|
1145
|
+
var containerModuleHelpers = this._getContainerModuleHelpersFactory()(module.id);
|
|
1146
|
+
module.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction);
|
|
1336
1147
|
}
|
|
1337
1148
|
}, {
|
|
1338
|
-
key: "
|
|
1339
|
-
value: function
|
|
1340
|
-
|
|
1149
|
+
key: "get",
|
|
1150
|
+
value: function get(serviceIdentifier) {
|
|
1151
|
+
var getArgs = this._getNotAllArgs(serviceIdentifier, !1);
|
|
1152
|
+
return this._get(getArgs);
|
|
1341
1153
|
}
|
|
1342
1154
|
}, {
|
|
1343
|
-
key: "
|
|
1344
|
-
value: function
|
|
1345
|
-
|
|
1155
|
+
key: "getAll",
|
|
1156
|
+
value: function getAll(serviceIdentifier) {
|
|
1157
|
+
var getArgs = this._getAllArgs(serviceIdentifier);
|
|
1158
|
+
return this._get(getArgs);
|
|
1346
1159
|
}
|
|
1347
1160
|
}, {
|
|
1348
|
-
key: "
|
|
1349
|
-
value: function
|
|
1350
|
-
|
|
1161
|
+
key: "getTagged",
|
|
1162
|
+
value: function getTagged(serviceIdentifier, key, value) {
|
|
1163
|
+
var getArgs = this._getNotAllArgs(serviceIdentifier, !1, key, value);
|
|
1164
|
+
return this._get(getArgs);
|
|
1351
1165
|
}
|
|
1352
1166
|
}, {
|
|
1353
|
-
key: "
|
|
1354
|
-
value: function
|
|
1355
|
-
return this.
|
|
1356
|
-
return NON_CUSTOM_TAG_KEYS.every(function (key) {
|
|
1357
|
-
return metadata.key !== key;
|
|
1358
|
-
});
|
|
1359
|
-
});
|
|
1167
|
+
key: "getNamed",
|
|
1168
|
+
value: function getNamed(serviceIdentifier, named) {
|
|
1169
|
+
return this.getTagged(serviceIdentifier, NAMED_TAG, named);
|
|
1360
1170
|
}
|
|
1361
1171
|
}, {
|
|
1362
|
-
key: "
|
|
1363
|
-
value: function
|
|
1364
|
-
return this.
|
|
1172
|
+
key: "isBound",
|
|
1173
|
+
value: function isBound(serviceIdentifier) {
|
|
1174
|
+
return this._bindingDictionary.has(serviceIdentifier);
|
|
1365
1175
|
}
|
|
1366
1176
|
}, {
|
|
1367
|
-
key: "
|
|
1368
|
-
value: function
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1177
|
+
key: "bind",
|
|
1178
|
+
value: function bind(serviceIdentifier) {
|
|
1179
|
+
var scope = this.options.defaultScope,
|
|
1180
|
+
binding = new Binding(serviceIdentifier, scope),
|
|
1181
|
+
list = this._bindingDictionary.get(serviceIdentifier) || [];
|
|
1182
|
+
return list.push(binding), this._bindingDictionary.set(serviceIdentifier, list), new BindingToSyntax(binding);
|
|
1372
1183
|
}
|
|
1373
1184
|
}, {
|
|
1374
|
-
key: "
|
|
1375
|
-
value: function
|
|
1376
|
-
|
|
1377
|
-
return NON_CUSTOM_TAG_KEYS.every(function (key) {
|
|
1378
|
-
return metadata.key !== key;
|
|
1379
|
-
});
|
|
1380
|
-
}) : null;
|
|
1185
|
+
key: "unbind",
|
|
1186
|
+
value: function unbind(serviceIdentifier) {
|
|
1187
|
+
this._bindingDictionary["delete"](serviceIdentifier);
|
|
1381
1188
|
}
|
|
1382
1189
|
}, {
|
|
1383
|
-
key: "
|
|
1384
|
-
value: function
|
|
1385
|
-
return this.
|
|
1190
|
+
key: "rebind",
|
|
1191
|
+
value: function rebind(serviceIdentifier) {
|
|
1192
|
+
return this.unbind(serviceIdentifier), this.bind(serviceIdentifier);
|
|
1386
1193
|
}
|
|
1387
1194
|
}, {
|
|
1388
|
-
key: "
|
|
1389
|
-
value: function
|
|
1195
|
+
key: "_getContainerModuleHelpersFactory",
|
|
1196
|
+
value: function _getContainerModuleHelpersFactory() {
|
|
1390
1197
|
var _this = this;
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
var
|
|
1397
|
-
|
|
1198
|
+
var setModuleId = function setModuleId(bindingToSyntax, moduleId) {
|
|
1199
|
+
bindingToSyntax._binding.moduleId = moduleId;
|
|
1200
|
+
},
|
|
1201
|
+
getBindFunction = function getBindFunction(moduleId) {
|
|
1202
|
+
return function (serviceIdentifier) {
|
|
1203
|
+
var bindingToSyntax = _this.bind(serviceIdentifier);
|
|
1204
|
+
return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
|
|
1205
|
+
};
|
|
1206
|
+
},
|
|
1207
|
+
getUnbindFunction = function getUnbindFunction() {
|
|
1208
|
+
return function (serviceIdentifier) {
|
|
1209
|
+
return _this.unbind(serviceIdentifier);
|
|
1210
|
+
};
|
|
1211
|
+
},
|
|
1212
|
+
getIsboundFunction = function getIsboundFunction() {
|
|
1213
|
+
return function (serviceIdentifier) {
|
|
1214
|
+
return _this.isBound(serviceIdentifier);
|
|
1215
|
+
};
|
|
1216
|
+
},
|
|
1217
|
+
getRebindFunction = function getRebindFunction(moduleId) {
|
|
1218
|
+
return function (serviceIdentifier) {
|
|
1219
|
+
var bindingToSyntax = _this.rebind(serviceIdentifier);
|
|
1220
|
+
return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
|
|
1221
|
+
};
|
|
1222
|
+
};
|
|
1223
|
+
return function (mId) {
|
|
1224
|
+
return {
|
|
1225
|
+
bindFunction: getBindFunction(mId),
|
|
1226
|
+
isboundFunction: getIsboundFunction(),
|
|
1227
|
+
rebindFunction: getRebindFunction(mId),
|
|
1228
|
+
unbindFunction: getUnbindFunction(),
|
|
1229
|
+
unbindAsyncFunction: function unbindAsyncFunction(serviceIdentifier) {
|
|
1230
|
+
return null;
|
|
1398
1231
|
}
|
|
1399
|
-
}
|
|
1400
|
-
_iterator2.e(err);
|
|
1401
|
-
} finally {
|
|
1402
|
-
_iterator2.f();
|
|
1403
|
-
}
|
|
1404
|
-
return !1;
|
|
1232
|
+
};
|
|
1405
1233
|
};
|
|
1406
1234
|
}
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
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
|
-
});
|
|
1235
|
+
}, {
|
|
1236
|
+
key: "_getNotAllArgs",
|
|
1237
|
+
value: function _getNotAllArgs(serviceIdentifier, isMultiInject, key, value) {
|
|
1238
|
+
return {
|
|
1239
|
+
avoidConstraints: !1,
|
|
1240
|
+
isMultiInject: isMultiInject,
|
|
1241
|
+
serviceIdentifier: serviceIdentifier,
|
|
1242
|
+
key: key,
|
|
1243
|
+
value: value
|
|
1244
|
+
};
|
|
1595
1245
|
}
|
|
1596
|
-
}
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
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);
|
|
1246
|
+
}, {
|
|
1247
|
+
key: "_getAllArgs",
|
|
1248
|
+
value: function _getAllArgs(serviceIdentifier) {
|
|
1249
|
+
return {
|
|
1250
|
+
avoidConstraints: !0,
|
|
1251
|
+
isMultiInject: !0,
|
|
1252
|
+
serviceIdentifier: serviceIdentifier
|
|
1253
|
+
};
|
|
2130
1254
|
}
|
|
2131
1255
|
}, {
|
|
2132
|
-
key: "
|
|
2133
|
-
value: function
|
|
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() {
|
|
1256
|
+
key: "_get",
|
|
1257
|
+
value: function _get(getArgs) {
|
|
2295
1258
|
var _this2 = this;
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
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
|
-
}
|
|
1259
|
+
var result = [];
|
|
1260
|
+
return this._bindingDictionary.get(getArgs.serviceIdentifier).forEach(function (binding) {
|
|
1261
|
+
result.push(_this2._resolveFromBinding(binding));
|
|
1262
|
+
}), getArgs.isMultiInject || 1 !== result.length ? result : result[0];
|
|
2400
1263
|
}
|
|
2401
1264
|
}, {
|
|
2402
|
-
key: "
|
|
2403
|
-
value: function
|
|
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() {
|
|
1265
|
+
key: "_getChildRequest",
|
|
1266
|
+
value: function _getChildRequest(binding) {
|
|
2450
1267
|
var _this3 = this;
|
|
2451
|
-
var
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
};
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
1268
|
+
var constr = binding.implementationType,
|
|
1269
|
+
_this$_metadataReader = this._metadataReader.getConstructorMetadata(constr),
|
|
1270
|
+
userGeneratedMetadata = _this$_metadataReader.userGeneratedMetadata,
|
|
1271
|
+
keys = Object.keys(userGeneratedMetadata),
|
|
1272
|
+
arr = [];
|
|
1273
|
+
var _loop = function _loop() {
|
|
1274
|
+
var constructorArgsMetadata = userGeneratedMetadata[i],
|
|
1275
|
+
targetMetadataMap = {};
|
|
1276
|
+
constructorArgsMetadata.forEach(function (md) {
|
|
1277
|
+
targetMetadataMap[md.key] = md.value;
|
|
1278
|
+
});
|
|
1279
|
+
var metadata = {
|
|
1280
|
+
inject: targetMetadataMap[INJECT_TAG],
|
|
1281
|
+
multiInject: targetMetadataMap[MULTI_INJECT_TAG]
|
|
1282
|
+
},
|
|
1283
|
+
injectIdentifier = metadata.inject || metadata.multiInject,
|
|
1284
|
+
target = {
|
|
1285
|
+
serviceIdentifier: injectIdentifier,
|
|
1286
|
+
constructorArgsMetadata: constructorArgsMetadata
|
|
1287
|
+
},
|
|
1288
|
+
request = {
|
|
1289
|
+
injectIdentifier: injectIdentifier,
|
|
1290
|
+
metadata: constructorArgsMetadata,
|
|
1291
|
+
bindings: _this3._bindingDictionary.get(injectIdentifier).filter(function (b) {
|
|
1292
|
+
return b.constraint(target);
|
|
1293
|
+
})
|
|
2474
1294
|
};
|
|
2475
|
-
|
|
2476
|
-
return function (mId) {
|
|
2477
|
-
return {
|
|
2478
|
-
bindFunction: getBindFunction(mId),
|
|
2479
|
-
isboundFunction: getIsboundFunction(),
|
|
2480
|
-
rebindFunction: getRebindFunction(mId),
|
|
2481
|
-
unbindFunction: getUnbindFunction(),
|
|
2482
|
-
unbindAsyncFunction: function unbindAsyncFunction(serviceIdentifier) {
|
|
2483
|
-
return null;
|
|
2484
|
-
}
|
|
2485
|
-
};
|
|
2486
|
-
};
|
|
2487
|
-
}
|
|
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
|
-
}, {
|
|
2514
|
-
key: "_getNotAllArgs",
|
|
2515
|
-
value: function _getNotAllArgs(serviceIdentifier, isMultiInject, key, value) {
|
|
2516
|
-
return {
|
|
2517
|
-
avoidConstraints: !1,
|
|
2518
|
-
isMultiInject: isMultiInject,
|
|
2519
|
-
serviceIdentifier: serviceIdentifier,
|
|
2520
|
-
key: key,
|
|
2521
|
-
value: value
|
|
2522
|
-
};
|
|
2523
|
-
}
|
|
2524
|
-
}, {
|
|
2525
|
-
key: "_planAndResolve",
|
|
2526
|
-
value: function _planAndResolve() {
|
|
2527
|
-
var _this4 = this;
|
|
2528
|
-
return function (args) {
|
|
2529
|
-
var context = plan(_this4._metadataReader, _this4, args.isMultiInject, args.targetType, args.serviceIdentifier, args.key, args.value, args.avoidConstraints);
|
|
2530
|
-
context = args.contextInterceptor(context);
|
|
2531
|
-
return resolve(context);
|
|
1295
|
+
arr.push(request);
|
|
2532
1296
|
};
|
|
1297
|
+
for (var i = 0; i < keys.length; i++) {
|
|
1298
|
+
_loop();
|
|
1299
|
+
}
|
|
1300
|
+
return arr;
|
|
2533
1301
|
}
|
|
2534
1302
|
}, {
|
|
2535
|
-
key: "
|
|
2536
|
-
value: function
|
|
2537
|
-
var
|
|
2538
|
-
|
|
2539
|
-
return _this5._deactivate(binding, resolved);
|
|
2540
|
-
}) : this._deactivate(binding, binding.cache);
|
|
1303
|
+
key: "_resolveFromBinding",
|
|
1304
|
+
value: function _resolveFromBinding(binding) {
|
|
1305
|
+
var result = this._getResolvedFromBinding(binding);
|
|
1306
|
+
return this._saveToScope(binding, result), result;
|
|
2541
1307
|
}
|
|
2542
1308
|
}, {
|
|
2543
|
-
key: "
|
|
2544
|
-
value: function
|
|
2545
|
-
var
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
1309
|
+
key: "_getResolvedFromBinding",
|
|
1310
|
+
value: function _getResolvedFromBinding(binding) {
|
|
1311
|
+
var result;
|
|
1312
|
+
switch (binding.type) {
|
|
1313
|
+
case BindingTypeEnum.ConstantValue:
|
|
1314
|
+
case BindingTypeEnum.Function:
|
|
1315
|
+
result = binding.cache;
|
|
1316
|
+
break;
|
|
1317
|
+
case BindingTypeEnum.Instance:
|
|
1318
|
+
result = this._resolveInstance(binding, binding.implementationType);
|
|
1319
|
+
break;
|
|
1320
|
+
default:
|
|
1321
|
+
result = binding.dynamicValue({
|
|
1322
|
+
container: this
|
|
1323
|
+
});
|
|
2557
1324
|
}
|
|
1325
|
+
return result;
|
|
2558
1326
|
}
|
|
2559
1327
|
}, {
|
|
2560
|
-
key: "
|
|
2561
|
-
value: function
|
|
2562
|
-
|
|
1328
|
+
key: "_resolveInstance",
|
|
1329
|
+
value: function _resolveInstance(binding, constr) {
|
|
1330
|
+
if (binding.activated) return binding.cache;
|
|
1331
|
+
var childRequests = this._getChildRequest(binding);
|
|
1332
|
+
return this._createInstance(constr, childRequests);
|
|
2563
1333
|
}
|
|
2564
1334
|
}, {
|
|
2565
|
-
key: "
|
|
2566
|
-
value: function
|
|
2567
|
-
|
|
2568
|
-
this.
|
|
2569
|
-
} catch (e) {
|
|
2570
|
-
throw new Error("".concat(CANNOT_UNBIND, " ").concat(getServiceIdentifierAsString(serviceIdentifier)));
|
|
1335
|
+
key: "_createInstance",
|
|
1336
|
+
value: function _createInstance(constr, childRequests) {
|
|
1337
|
+
if (childRequests.length) {
|
|
1338
|
+
return _construct(constr, _toConsumableArray(this._resolveRequests(childRequests)));
|
|
2571
1339
|
}
|
|
1340
|
+
return new constr();
|
|
2572
1341
|
}
|
|
2573
1342
|
}, {
|
|
2574
|
-
key: "
|
|
2575
|
-
value: function
|
|
2576
|
-
var
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
}
|
|
2583
|
-
return this._preDestroy(constructor, instance);
|
|
1343
|
+
key: "_resolveRequests",
|
|
1344
|
+
value: function _resolveRequests(childRequests) {
|
|
1345
|
+
var _this4 = this;
|
|
1346
|
+
return childRequests.map(function (request) {
|
|
1347
|
+
return request.bindings.length > 1 ? request.bindings.map(function (binding) {
|
|
1348
|
+
return _this4._resolveFromBinding(binding);
|
|
1349
|
+
}) : _this4._resolveFromBinding(request.bindings[0]);
|
|
1350
|
+
});
|
|
2584
1351
|
}
|
|
2585
1352
|
}, {
|
|
2586
|
-
key: "
|
|
2587
|
-
value: function
|
|
2588
|
-
|
|
2589
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
2590
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
2591
|
-
case 0:
|
|
2592
|
-
_context3.t0 = "function" == typeof binding.onDeactivation;
|
|
2593
|
-
if (!_context3.t0) {
|
|
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
|
-
}));
|
|
2608
|
-
}
|
|
2609
|
-
}], [{
|
|
2610
|
-
key: "merge",
|
|
2611
|
-
value: function merge(container1, container2) {
|
|
2612
|
-
for (var _len3 = arguments.length, containers = new Array(_len3 > 2 ? _len3 - 2 : 0), _key4 = 2; _key4 < _len3; _key4++) {
|
|
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;
|
|
1353
|
+
key: "_saveToScope",
|
|
1354
|
+
value: function _saveToScope(binding, result) {
|
|
1355
|
+
binding.scope === BindingScopeEnum.Singleton && (binding.cache = result, binding.activated = !0);
|
|
2628
1356
|
}
|
|
2629
1357
|
}]);
|
|
2630
1358
|
return Container;
|
|
2631
1359
|
}();
|
|
2632
1360
|
|
|
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);
|
|
2644
|
-
|
|
2645
1361
|
var ContributionProvider = Symbol("ContributionProvider");
|
|
2646
1362
|
var ContributionProviderCache = /*#__PURE__*/function () {
|
|
2647
1363
|
function ContributionProviderCache(serviceIdentifier, container) {
|
|
@@ -2781,9 +1497,9 @@
|
|
|
2781
1497
|
var DefaultGlobal = /*#__PURE__*/function () {
|
|
2782
1498
|
function DefaultGlobal(contributions) {
|
|
2783
1499
|
_classCallCheck(this, DefaultGlobal);
|
|
2784
|
-
this.contributions = contributions, this.hooks = {
|
|
1500
|
+
this.contributions = contributions, this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
2785
1501
|
onSetEnv: new SyncHook(["lastEnv", "env", "global"])
|
|
2786
|
-
}, this.measureTextMethod = "native", this.optimizeVisible = !1;
|
|
1502
|
+
}, this.measureTextMethod = "native", this.optimizeVisible = !1, this.optmizeSkipCheckBoundariesThreshold = 0;
|
|
2787
1503
|
}
|
|
2788
1504
|
_createClass(DefaultGlobal, [{
|
|
2789
1505
|
key: "env",
|
|
@@ -4451,7 +3167,10 @@
|
|
|
4451
3167
|
direction: "horizontal",
|
|
4452
3168
|
wordBreak: "break-all",
|
|
4453
3169
|
ignoreBuf: !1,
|
|
4454
|
-
verticalMode: 0
|
|
3170
|
+
verticalMode: 0,
|
|
3171
|
+
whiteSpace: "no-wrap",
|
|
3172
|
+
heightLimit: 1 / 0,
|
|
3173
|
+
lineClamp: 1 / 0
|
|
4455
3174
|
};
|
|
4456
3175
|
var DefaultStyle = Object.assign(Object.assign(Object.assign({
|
|
4457
3176
|
opacity: 1,
|
|
@@ -5329,9 +4048,14 @@
|
|
|
5329
4048
|
var DefaultCanvasAllocate = /*#__PURE__*/function () {
|
|
5330
4049
|
function DefaultCanvasAllocate() {
|
|
5331
4050
|
_classCallCheck(this, DefaultCanvasAllocate);
|
|
5332
|
-
this.pools = [];
|
|
4051
|
+
this.pools = [], this.allocatedCanvas = [];
|
|
5333
4052
|
}
|
|
5334
4053
|
_createClass(DefaultCanvasAllocate, [{
|
|
4054
|
+
key: "shareCanvas",
|
|
4055
|
+
value: function shareCanvas() {
|
|
4056
|
+
return this.allocatedCanvas.length ? this.allocatedCanvas[0] : this.getCommonCanvas();
|
|
4057
|
+
}
|
|
4058
|
+
}, {
|
|
5335
4059
|
key: "getCommonCanvas",
|
|
5336
4060
|
value: function getCommonCanvas() {
|
|
5337
4061
|
return this._commonCanvas || (this._commonCanvas = this.allocate({
|
|
@@ -5343,9 +4067,12 @@
|
|
|
5343
4067
|
}, {
|
|
5344
4068
|
key: "allocate",
|
|
5345
4069
|
value: function allocate(data) {
|
|
5346
|
-
if (!this.pools.length)
|
|
5347
|
-
|
|
5348
|
-
|
|
4070
|
+
if (!this.pools.length) {
|
|
4071
|
+
var c = wrapCanvas(Object.assign({
|
|
4072
|
+
nativeCanvas: application.global.createCanvas(data)
|
|
4073
|
+
}, data));
|
|
4074
|
+
return this.allocatedCanvas.push(c), c;
|
|
4075
|
+
}
|
|
5349
4076
|
var m = this.pools.pop();
|
|
5350
4077
|
return m.resize(data.width, data.height), m.dpr = data.dpr, m;
|
|
5351
4078
|
}
|
|
@@ -5354,13 +4081,14 @@
|
|
|
5354
4081
|
value: function allocateByObj(canvas) {
|
|
5355
4082
|
if (!this.pools.length) {
|
|
5356
4083
|
var data = {
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
4084
|
+
width: canvas.width / canvas.dpr,
|
|
4085
|
+
height: canvas.height / canvas.dpr,
|
|
4086
|
+
dpr: canvas.dpr
|
|
4087
|
+
},
|
|
4088
|
+
c = wrapCanvas(Object.assign({
|
|
4089
|
+
nativeCanvas: application.global.createCanvas(data)
|
|
4090
|
+
}, data));
|
|
4091
|
+
return this.allocatedCanvas.push(c), c;
|
|
5364
4092
|
}
|
|
5365
4093
|
var m = this.pools.pop();
|
|
5366
4094
|
return m.width = canvas.width, m.height = canvas.height, m;
|
|
@@ -5409,6 +4137,16 @@
|
|
|
5409
4137
|
});
|
|
5410
4138
|
}
|
|
5411
4139
|
_createClass(DefaultGraphicUtil, [{
|
|
4140
|
+
key: "canvas",
|
|
4141
|
+
get: function get() {
|
|
4142
|
+
return this.tryInitCanvas(), this._canvas;
|
|
4143
|
+
}
|
|
4144
|
+
}, {
|
|
4145
|
+
key: "context",
|
|
4146
|
+
get: function get() {
|
|
4147
|
+
return this.tryInitCanvas(), this._context;
|
|
4148
|
+
}
|
|
4149
|
+
}, {
|
|
5412
4150
|
key: "textMeasure",
|
|
5413
4151
|
get: function get() {
|
|
5414
4152
|
return this._textMeasure || this.configure(this.global, this.global.env), this._textMeasure;
|
|
@@ -5417,11 +4155,17 @@
|
|
|
5417
4155
|
key: "configure",
|
|
5418
4156
|
value: function configure(global, env) {
|
|
5419
4157
|
var _this2 = this;
|
|
5420
|
-
|
|
5421
|
-
var canvas = canvasAllocate.getCommonCanvas();
|
|
5422
|
-
this.canvas = canvas, this.context = canvas.getContext("2d"), this.contributions.getContributions().forEach(function (contribution) {
|
|
4158
|
+
this.configured || (this.contributions.getContributions().forEach(function (contribution) {
|
|
5423
4159
|
contribution.configure(_this2, env);
|
|
5424
|
-
}), this.configured = !0;
|
|
4160
|
+
}), this.configured = !0);
|
|
4161
|
+
}
|
|
4162
|
+
}, {
|
|
4163
|
+
key: "tryInitCanvas",
|
|
4164
|
+
value: function tryInitCanvas() {
|
|
4165
|
+
if (!this._canvas) {
|
|
4166
|
+
var canvas = canvasAllocate.shareCanvas();
|
|
4167
|
+
this._canvas = canvas, this._context = canvas.getContext("2d");
|
|
4168
|
+
}
|
|
5425
4169
|
}
|
|
5426
4170
|
}, {
|
|
5427
4171
|
key: "bindTextMeasure",
|
|
@@ -5675,20 +4419,6 @@
|
|
|
5675
4419
|
return null;
|
|
5676
4420
|
}
|
|
5677
4421
|
|
|
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
4422
|
var __awaiter$3 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
5693
4423
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5694
4424
|
function fulfilled(value) {
|
|
@@ -7492,6 +6222,12 @@
|
|
|
7492
6222
|
}();
|
|
7493
6223
|
RafBasedSTO.TimeOut = 1e3 / 60;
|
|
7494
6224
|
new RafBasedSTO();
|
|
6225
|
+
var calculateLineHeight = function calculateLineHeight(lineHeight, fontSize) {
|
|
6226
|
+
if (vutils.isString(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
|
|
6227
|
+
return fontSize * (Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100);
|
|
6228
|
+
}
|
|
6229
|
+
return lineHeight;
|
|
6230
|
+
};
|
|
7495
6231
|
|
|
7496
6232
|
var IncreaseCount = /*#__PURE__*/function (_ACustomAnimate) {
|
|
7497
6233
|
_inherits(IncreaseCount, _ACustomAnimate);
|
|
@@ -8609,8 +7345,7 @@
|
|
|
8609
7345
|
}, {
|
|
8610
7346
|
key: "addChild",
|
|
8611
7347
|
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));
|
|
7348
|
+
"__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
7349
|
}
|
|
8615
7350
|
}]);
|
|
8616
7351
|
return XmlNode;
|
|
@@ -9459,7 +8194,7 @@
|
|
|
9459
8194
|
_classCallCheck(this, DefaultWindow);
|
|
9460
8195
|
this.hooks = {
|
|
9461
8196
|
onChange: new SyncHook(["x", "y", "width", "height"])
|
|
9462
|
-
}, this._uid = Generator.GenAutoIncrementId(), this.global = application.global;
|
|
8197
|
+
}, this._uid = Generator.GenAutoIncrementId(), this.global = application.global, this.postInit();
|
|
9463
8198
|
}
|
|
9464
8199
|
_createClass(DefaultWindow, [{
|
|
9465
8200
|
key: "width",
|
|
@@ -9602,7 +8337,7 @@
|
|
|
9602
8337
|
}]);
|
|
9603
8338
|
return DefaultWindow;
|
|
9604
8339
|
}();
|
|
9605
|
-
|
|
8340
|
+
DefaultWindow = __decorate$C([injectable(), __metadata$o("design:paramtypes", [])], DefaultWindow);
|
|
9606
8341
|
|
|
9607
8342
|
var coreModule = new ContainerModule(function (bind) {
|
|
9608
8343
|
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 +8743,7 @@
|
|
|
10008
8743
|
return CanvasTextLayout;
|
|
10009
8744
|
}();
|
|
10010
8745
|
|
|
10011
|
-
var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
8746
|
+
var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
10012
8747
|
var Text = /*#__PURE__*/function (_Graphic) {
|
|
10013
8748
|
_inherits(Text, _Graphic);
|
|
10014
8749
|
var _super = _createSuper(Text);
|
|
@@ -10082,6 +8817,117 @@
|
|
|
10082
8817
|
paddingArray = parsePadding(boundsPadding);
|
|
10083
8818
|
return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(), bounds;
|
|
10084
8819
|
}
|
|
8820
|
+
}, {
|
|
8821
|
+
key: "updateWrapAABBBounds",
|
|
8822
|
+
value: function updateWrapAABBBounds(text) {
|
|
8823
|
+
var _a, _b, _c, _d;
|
|
8824
|
+
var textTheme = getTheme(this).text,
|
|
8825
|
+
_this$attribute = this.attribute,
|
|
8826
|
+
_this$attribute$fontF = _this$attribute.fontFamily,
|
|
8827
|
+
fontFamily = _this$attribute$fontF === void 0 ? textTheme.fontFamily : _this$attribute$fontF,
|
|
8828
|
+
_this$attribute$textA = _this$attribute.textAlign,
|
|
8829
|
+
textAlign = _this$attribute$textA === void 0 ? textTheme.textAlign : _this$attribute$textA,
|
|
8830
|
+
_this$attribute$textB = _this$attribute.textBaseline,
|
|
8831
|
+
textBaseline = _this$attribute$textB === void 0 ? textTheme.textBaseline : _this$attribute$textB,
|
|
8832
|
+
_this$attribute$fontS = _this$attribute.fontSize,
|
|
8833
|
+
fontSize = _this$attribute$fontS === void 0 ? textTheme.fontSize : _this$attribute$fontS,
|
|
8834
|
+
_this$attribute$ellip = _this$attribute.ellipsis,
|
|
8835
|
+
ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
|
|
8836
|
+
maxLineWidth = _this$attribute.maxLineWidth,
|
|
8837
|
+
_this$attribute$strok = _this$attribute.stroke,
|
|
8838
|
+
stroke = _this$attribute$strok === void 0 ? textTheme.stroke : _this$attribute$strok,
|
|
8839
|
+
_this$attribute$lineW = _this$attribute.lineWidth,
|
|
8840
|
+
lineWidth = _this$attribute$lineW === void 0 ? textTheme.lineWidth : _this$attribute$lineW,
|
|
8841
|
+
_this$attribute$wordB = _this$attribute.wordBreak,
|
|
8842
|
+
wordBreak = _this$attribute$wordB === void 0 ? textTheme.wordBreak : _this$attribute$wordB,
|
|
8843
|
+
_this$attribute$fontW = _this$attribute.fontWeight,
|
|
8844
|
+
fontWeight = _this$attribute$fontW === void 0 ? textTheme.fontWeight : _this$attribute$fontW,
|
|
8845
|
+
_this$attribute$ignor = _this$attribute.ignoreBuf,
|
|
8846
|
+
ignoreBuf = _this$attribute$ignor === void 0 ? textTheme.ignoreBuf : _this$attribute$ignor,
|
|
8847
|
+
_this$attribute$heigh = _this$attribute.heightLimit,
|
|
8848
|
+
heightLimit = _this$attribute$heigh === void 0 ? 0 : _this$attribute$heigh,
|
|
8849
|
+
lineClamp = _this$attribute.lineClamp,
|
|
8850
|
+
lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
|
|
8851
|
+
buf = ignoreBuf ? 0 : 2;
|
|
8852
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
8853
|
+
var _bbox = this.cache.layoutData.bbox;
|
|
8854
|
+
return this._AABBBounds.set(_bbox.xOffset, _bbox.yOffset, _bbox.xOffset + _bbox.width, _bbox.yOffset + _bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
8855
|
+
}
|
|
8856
|
+
var textMeasure = application.graphicUtil.textMeasure,
|
|
8857
|
+
layoutObj = new CanvasTextLayout(fontFamily, {
|
|
8858
|
+
fontSize: fontSize,
|
|
8859
|
+
fontWeight: fontWeight,
|
|
8860
|
+
fontFamily: fontFamily
|
|
8861
|
+
}, textMeasure),
|
|
8862
|
+
lines = vutils.isArray(text) ? text.map(function (l) {
|
|
8863
|
+
return l.toString();
|
|
8864
|
+
}) : [text.toString()],
|
|
8865
|
+
linesLayout = [],
|
|
8866
|
+
bboxWH = [0, 0];
|
|
8867
|
+
var lineCountLimit = 1 / 0;
|
|
8868
|
+
if (heightLimit > 0 && (lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1)), lineClamp && (lineCountLimit = Math.min(lineCountLimit, lineClamp)), "number" == typeof maxLineWidth && maxLineWidth !== 1 / 0) {
|
|
8869
|
+
if (maxLineWidth > 0) for (var i = 0; i < lines.length; i++) {
|
|
8870
|
+
var str = lines[i];
|
|
8871
|
+
var needCut = !0;
|
|
8872
|
+
if (i === lineCountLimit - 1) {
|
|
8873
|
+
var _clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
8874
|
+
linesLayout.push({
|
|
8875
|
+
str: _clip.str,
|
|
8876
|
+
width: _clip.width
|
|
8877
|
+
});
|
|
8878
|
+
break;
|
|
8879
|
+
}
|
|
8880
|
+
var clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, "break-word" === wordBreak);
|
|
8881
|
+
if ("" !== str && "" === clip.str) {
|
|
8882
|
+
if (ellipsis) {
|
|
8883
|
+
var clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
8884
|
+
clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
|
|
8885
|
+
} else clip.str = "", clip.width = 0;
|
|
8886
|
+
needCut = !1;
|
|
8887
|
+
}
|
|
8888
|
+
if (linesLayout.push({
|
|
8889
|
+
str: clip.str,
|
|
8890
|
+
width: clip.width
|
|
8891
|
+
}), clip.str.length === str.length) ;else if (needCut) {
|
|
8892
|
+
var newStr = str.substring(clip.str.length);
|
|
8893
|
+
lines.splice(i + 1, 0, newStr);
|
|
8894
|
+
}
|
|
8895
|
+
}
|
|
8896
|
+
var maxWidth = 0;
|
|
8897
|
+
linesLayout.forEach(function (layout) {
|
|
8898
|
+
maxWidth = Math.max(maxWidth, layout.width);
|
|
8899
|
+
}), bboxWH[0] = maxWidth;
|
|
8900
|
+
} else {
|
|
8901
|
+
var width,
|
|
8902
|
+
_text,
|
|
8903
|
+
_lineWidth = 0;
|
|
8904
|
+
for (var _i = 0, len = lines.length; _i < len; _i++) {
|
|
8905
|
+
if (_i === lineCountLimit - 1) {
|
|
8906
|
+
var _clip2 = layoutObj.textMeasure.clipTextWithSuffix(lines[_i], layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
8907
|
+
linesLayout.push({
|
|
8908
|
+
str: _clip2.str,
|
|
8909
|
+
width: _clip2.width
|
|
8910
|
+
}), _lineWidth = Math.max(_lineWidth, _clip2.width);
|
|
8911
|
+
break;
|
|
8912
|
+
}
|
|
8913
|
+
_text = lines[_i], width = layoutObj.textMeasure.measureTextWidth(_text, layoutObj.textOptions, "break-word" === wordBreak), _lineWidth = Math.max(_lineWidth, width), linesLayout.push({
|
|
8914
|
+
str: _text,
|
|
8915
|
+
width: width
|
|
8916
|
+
});
|
|
8917
|
+
}
|
|
8918
|
+
bboxWH[0] = _lineWidth;
|
|
8919
|
+
}
|
|
8920
|
+
bboxWH[1] = linesLayout.length * (lineHeight + buf);
|
|
8921
|
+
var bbox = {
|
|
8922
|
+
xOffset: 0,
|
|
8923
|
+
yOffset: 0,
|
|
8924
|
+
width: bboxWH[0],
|
|
8925
|
+
height: bboxWH[1]
|
|
8926
|
+
};
|
|
8927
|
+
layoutObj.LayoutBBox(bbox, textAlign, textBaseline);
|
|
8928
|
+
var layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
|
|
8929
|
+
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;
|
|
8930
|
+
}
|
|
10085
8931
|
}, {
|
|
10086
8932
|
key: "updateSingallineAABBBounds",
|
|
10087
8933
|
value: function updateSingallineAABBBounds(text) {
|
|
@@ -10128,9 +8974,12 @@
|
|
|
10128
8974
|
_attribute$wordBreak === void 0 ? textTheme.wordBreak : _attribute$wordBreak;
|
|
10129
8975
|
var _attribute$ignoreBuf = attribute.ignoreBuf,
|
|
10130
8976
|
ignoreBuf = _attribute$ignoreBuf === void 0 ? textTheme.ignoreBuf : _attribute$ignoreBuf,
|
|
10131
|
-
|
|
10132
|
-
_attribute$
|
|
10133
|
-
|
|
8977
|
+
_attribute$whiteSpace = attribute.whiteSpace,
|
|
8978
|
+
whiteSpace = _attribute$whiteSpace === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace;
|
|
8979
|
+
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
8980
|
+
var buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
|
|
8981
|
+
textFontSize = attribute.fontSize || textTheme.fontSize,
|
|
8982
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, textFontSize)) && void 0 !== _a ? _a : textFontSize + buf;
|
|
10134
8983
|
if (!this.shouldUpdateShape() && this.cache) {
|
|
10135
8984
|
width = null !== (_b = this.cache.clipedWidth) && void 0 !== _b ? _b : 0;
|
|
10136
8985
|
var _dx = textDrawOffsetX(textAlign, width),
|
|
@@ -10200,12 +9049,11 @@
|
|
|
10200
9049
|
fontFamily = _attribute$fontFamily2 === void 0 ? textTheme.fontFamily : _attribute$fontFamily2,
|
|
10201
9050
|
_attribute$stroke2 = attribute.stroke,
|
|
10202
9051
|
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
9052
|
_attribute$lineWidth2 = attribute.lineWidth,
|
|
10206
9053
|
lineWidth = _attribute$lineWidth2 === void 0 ? textTheme.lineWidth : _attribute$lineWidth2,
|
|
10207
9054
|
_attribute$verticalMo = attribute.verticalMode,
|
|
10208
|
-
verticalMode = _attribute$verticalMo === void 0 ? textTheme.verticalMode : _attribute$verticalMo
|
|
9055
|
+
verticalMode = _attribute$verticalMo === void 0 ? textTheme.verticalMode : _attribute$verticalMo,
|
|
9056
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
10209
9057
|
var _attribute$textAlign2 = attribute.textAlign,
|
|
10210
9058
|
textAlign = _attribute$textAlign2 === void 0 ? textTheme.textAlign : _attribute$textAlign2,
|
|
10211
9059
|
_attribute$textBaseli2 = attribute.textBaseline,
|
|
@@ -10255,7 +9103,7 @@
|
|
|
10255
9103
|
}, {
|
|
10256
9104
|
key: "updateHorizontalMultilineAABBBounds",
|
|
10257
9105
|
value: function updateHorizontalMultilineAABBBounds(text) {
|
|
10258
|
-
var _a;
|
|
9106
|
+
var _a, _b;
|
|
10259
9107
|
var textTheme = getTheme(this).text,
|
|
10260
9108
|
attribute = this.attribute,
|
|
10261
9109
|
_attribute$fontFamily3 = attribute.fontFamily,
|
|
@@ -10268,8 +9116,6 @@
|
|
|
10268
9116
|
fontSize = _attribute$fontSize3 === void 0 ? textTheme.fontSize : _attribute$fontSize3,
|
|
10269
9117
|
_attribute$fontWeight3 = attribute.fontWeight,
|
|
10270
9118
|
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
9119
|
_attribute$ellipsis3 = attribute.ellipsis,
|
|
10274
9120
|
ellipsis = _attribute$ellipsis3 === void 0 ? textTheme.ellipsis : _attribute$ellipsis3,
|
|
10275
9121
|
maxLineWidth = attribute.maxLineWidth,
|
|
@@ -10277,11 +9123,13 @@
|
|
|
10277
9123
|
stroke = _attribute$stroke3 === void 0 ? textTheme.stroke : _attribute$stroke3,
|
|
10278
9124
|
_attribute$lineWidth3 = attribute.lineWidth,
|
|
10279
9125
|
lineWidth = _attribute$lineWidth3 === void 0 ? textTheme.lineWidth : _attribute$lineWidth3,
|
|
10280
|
-
_attribute$
|
|
10281
|
-
_attribute$
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
9126
|
+
_attribute$whiteSpace2 = attribute.whiteSpace,
|
|
9127
|
+
whiteSpace = _attribute$whiteSpace2 === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace2,
|
|
9128
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
|
|
9129
|
+
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
9130
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
9131
|
+
var _bbox2 = this.cache.layoutData.bbox;
|
|
9132
|
+
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
9133
|
}
|
|
10286
9134
|
var textMeasure = application.graphicUtil.textMeasure,
|
|
10287
9135
|
layoutData = new CanvasTextLayout(fontFamily, {
|
|
@@ -10315,12 +9163,11 @@
|
|
|
10315
9163
|
fontWeight = _attribute$fontWeight4 === void 0 ? textTheme.fontWeight : _attribute$fontWeight4,
|
|
10316
9164
|
_attribute$stroke4 = attribute.stroke,
|
|
10317
9165
|
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
9166
|
_attribute$lineWidth4 = attribute.lineWidth,
|
|
10321
9167
|
lineWidth = _attribute$lineWidth4 === void 0 ? textTheme.lineWidth : _attribute$lineWidth4,
|
|
10322
9168
|
_attribute$verticalMo2 = attribute.verticalMode,
|
|
10323
|
-
verticalMode = _attribute$verticalMo2 === void 0 ? textTheme.verticalMode : _attribute$verticalMo2
|
|
9169
|
+
verticalMode = _attribute$verticalMo2 === void 0 ? textTheme.verticalMode : _attribute$verticalMo2,
|
|
9170
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
10324
9171
|
var _attribute$textAlign4 = attribute.textAlign,
|
|
10325
9172
|
textAlign = _attribute$textAlign4 === void 0 ? textTheme.textAlign : _attribute$textAlign4,
|
|
10326
9173
|
_attribute$textBaseli4 = attribute.textBaseline,
|
|
@@ -10453,7 +9300,7 @@
|
|
|
10453
9300
|
}, {
|
|
10454
9301
|
key: "updateMultilineAABBBounds",
|
|
10455
9302
|
value: function updateMultilineAABBBounds(text) {
|
|
10456
|
-
var _a, _b, _c;
|
|
9303
|
+
var _a, _b, _c, _d;
|
|
10457
9304
|
var textTheme = getTheme(this).text,
|
|
10458
9305
|
_this$attribute = this.attribute,
|
|
10459
9306
|
_this$attribute$fontF = _this$attribute.fontFamily,
|
|
@@ -10464,8 +9311,6 @@
|
|
|
10464
9311
|
textBaseline = _this$attribute$textB === void 0 ? textTheme.textBaseline : _this$attribute$textB,
|
|
10465
9312
|
_this$attribute$fontS = _this$attribute.fontSize,
|
|
10466
9313
|
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
9314
|
_this$attribute$ellip = _this$attribute.ellipsis,
|
|
10470
9315
|
ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
|
|
10471
9316
|
maxLineWidth = _this$attribute.maxLineWidth,
|
|
@@ -10482,8 +9327,9 @@
|
|
|
10482
9327
|
_this$attribute$heigh = _this$attribute.heightLimit,
|
|
10483
9328
|
heightLimit = _this$attribute$heigh === void 0 ? 0 : _this$attribute$heigh,
|
|
10484
9329
|
lineClamp = _this$attribute.lineClamp,
|
|
9330
|
+
lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
|
|
10485
9331
|
buf = ignoreBuf ? 0 : 2;
|
|
10486
|
-
if (!this.shouldUpdateShape() && (null === (
|
|
9332
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
10487
9333
|
var _bbox = this.cache.layoutData.bbox;
|
|
10488
9334
|
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
9335
|
}
|
|
@@ -10515,7 +9361,7 @@
|
|
|
10515
9361
|
if ("" !== str && "" === clip.str) {
|
|
10516
9362
|
if (ellipsis) {
|
|
10517
9363
|
var clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
10518
|
-
clip.str = null !== (
|
|
9364
|
+
clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
|
|
10519
9365
|
} else clip.str = "", clip.width = 0;
|
|
10520
9366
|
needCut = !1;
|
|
10521
9367
|
}
|
|
@@ -11331,6 +10177,13 @@
|
|
|
11331
10177
|
builtinSymbols.forEach(function (symbol) {
|
|
11332
10178
|
builtinSymbolsMap[symbol.type] = symbol;
|
|
11333
10179
|
});
|
|
10180
|
+
var builtInSymbolStrMap = {
|
|
10181
|
+
arrowLeft: "M 0.25 -0.5 L -0.25 0 l 0.5 0.5",
|
|
10182
|
+
arrowRight: "M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",
|
|
10183
|
+
rect: "M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",
|
|
10184
|
+
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",
|
|
10185
|
+
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"
|
|
10186
|
+
};
|
|
11334
10187
|
|
|
11335
10188
|
var _tempBounds = new vutils.AABBBounds(),
|
|
11336
10189
|
SYMBOL_UPDATE_TAG_KEY = ["symbolType", "size"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
@@ -11365,12 +10218,13 @@
|
|
|
11365
10218
|
}, {
|
|
11366
10219
|
key: "doUpdateParsedPath",
|
|
11367
10220
|
value: function doUpdateParsedPath() {
|
|
11368
|
-
var symbolTheme = getTheme(this).symbol
|
|
11369
|
-
|
|
11370
|
-
symbolType = _this$attribute$symbo === void 0 ? symbolTheme.symbolType : _this$attribute$symbo
|
|
11371
|
-
|
|
10221
|
+
var symbolTheme = getTheme(this).symbol;
|
|
10222
|
+
var _this$attribute$symbo = this.attribute.symbolType,
|
|
10223
|
+
symbolType = _this$attribute$symbo === void 0 ? symbolTheme.symbolType : _this$attribute$symbo,
|
|
10224
|
+
path = builtinSymbolsMap[symbolType];
|
|
11372
10225
|
if (path) return this._parsedPath = path, path;
|
|
11373
10226
|
if (path = _Symbol.userSymbolMap[symbolType], path) return this._parsedPath = path, path;
|
|
10227
|
+
symbolType = builtInSymbolStrMap[symbolType] || symbolType;
|
|
11374
10228
|
if (!0 === isSvg(symbolType)) {
|
|
11375
10229
|
var parser = new XMLParser(),
|
|
11376
10230
|
_parser$parse = parser.parse(symbolType),
|
|
@@ -11856,7 +10710,9 @@
|
|
|
11856
10710
|
var Paragraph = /*#__PURE__*/function () {
|
|
11857
10711
|
function Paragraph(text, newLine, character) {
|
|
11858
10712
|
_classCallCheck(this, Paragraph);
|
|
11859
|
-
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic"
|
|
10713
|
+
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic";
|
|
10714
|
+
var lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
|
|
10715
|
+
this.lineHeight = "number" == typeof lineHeight ? lineHeight > this.fontSize ? lineHeight : this.fontSize : Math.floor(1.2 * this.fontSize), this.height = this.lineHeight;
|
|
11860
10716
|
var _measureTextCanvas = measureTextCanvas(text, character),
|
|
11861
10717
|
ascent = _measureTextCanvas.ascent,
|
|
11862
10718
|
height = _measureTextCanvas.height,
|
|
@@ -15253,33 +14109,64 @@
|
|
|
15253
14109
|
}
|
|
15254
14110
|
return !1;
|
|
15255
14111
|
}
|
|
14112
|
+
}, {
|
|
14113
|
+
key: "drawLinearLineHighPerformance",
|
|
14114
|
+
value: function drawLinearLineHighPerformance(line, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, lineAttribute, drawContext, params, fillCb, strokeCb) {
|
|
14115
|
+
var _a;
|
|
14116
|
+
context.beginPath();
|
|
14117
|
+
var z = null !== (_a = this.z) && void 0 !== _a ? _a : 0,
|
|
14118
|
+
points = line.attribute.points,
|
|
14119
|
+
startP = points[0];
|
|
14120
|
+
context.moveTo(startP.x, startP.y, z);
|
|
14121
|
+
for (var i = 1; i < points.length; i++) {
|
|
14122
|
+
var p = points[i];
|
|
14123
|
+
context.lineTo(p.x, p.y, z);
|
|
14124
|
+
}
|
|
14125
|
+
context.setShadowBlendStyle && context.setShadowBlendStyle(line, line.attribute, lineAttribute);
|
|
14126
|
+
var _line$attribute = line.attribute,
|
|
14127
|
+
_line$attribute$x = _line$attribute.x,
|
|
14128
|
+
originX = _line$attribute$x === void 0 ? 0 : _line$attribute$x,
|
|
14129
|
+
_line$attribute$x2 = _line$attribute.x,
|
|
14130
|
+
originY = _line$attribute$x2 === void 0 ? 0 : _line$attribute$x2;
|
|
14131
|
+
!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()));
|
|
14132
|
+
}
|
|
15256
14133
|
}, {
|
|
15257
14134
|
key: "drawShape",
|
|
15258
14135
|
value: function drawShape(line, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
15259
14136
|
var _this2 = this;
|
|
15260
14137
|
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$
|
|
14138
|
+
_line$attribute2 = line.attribute,
|
|
14139
|
+
_line$attribute2$fill = _line$attribute2.fill,
|
|
14140
|
+
fill = _line$attribute2$fill === void 0 ? lineAttribute.fill : _line$attribute2$fill,
|
|
14141
|
+
_line$attribute2$stro = _line$attribute2.stroke,
|
|
14142
|
+
stroke = _line$attribute2$stro === void 0 ? lineAttribute.stroke : _line$attribute2$stro,
|
|
14143
|
+
_line$attribute2$fill2 = _line$attribute2.fillOpacity,
|
|
14144
|
+
fillOpacity = _line$attribute2$fill2 === void 0 ? lineAttribute.fillOpacity : _line$attribute2$fill2,
|
|
14145
|
+
_line$attribute2$stro2 = _line$attribute2.strokeOpacity,
|
|
14146
|
+
strokeOpacity = _line$attribute2$stro2 === void 0 ? lineAttribute.strokeOpacity : _line$attribute2$stro2,
|
|
14147
|
+
segments = _line$attribute2.segments,
|
|
14148
|
+
points = _line$attribute2.points,
|
|
14149
|
+
closePath = _line$attribute2.closePath;
|
|
15270
14150
|
if (!this.valid(line, lineAttribute, fillCb, strokeCb)) return;
|
|
14151
|
+
var _line$attribute$curve = line.attribute.curveType,
|
|
14152
|
+
curveType = _line$attribute$curve === void 0 ? lineAttribute.curveType : _line$attribute$curve;
|
|
14153
|
+
closePath && "linear" === curveType && (curveType = "linearClosed");
|
|
14154
|
+
var _line$attribute3 = line.attribute,
|
|
14155
|
+
_line$attribute3$clip = _line$attribute3.clipRange,
|
|
14156
|
+
clipRange = _line$attribute3$clip === void 0 ? lineAttribute.clipRange : _line$attribute3$clip,
|
|
14157
|
+
_line$attribute3$clip2 = _line$attribute3.clipRangeByDimension,
|
|
14158
|
+
clipRangeByDimension = _line$attribute3$clip2 === void 0 ? lineAttribute.clipRangeByDimension : _line$attribute3$clip2;
|
|
14159
|
+
if (1 === clipRange && !segments && !points.some(function (p) {
|
|
14160
|
+
return !1 === p.defined;
|
|
14161
|
+
}) && "linear" === curveType) return this.drawLinearLineHighPerformance(line, context, !!fill, !!stroke, fillOpacity, strokeOpacity, x, y, lineAttribute, drawContext, params, fillCb, strokeCb);
|
|
15271
14162
|
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) {
|
|
14163
|
+
var _line$attribute4 = line.attribute,
|
|
14164
|
+
_points2 = _line$attribute4.points,
|
|
14165
|
+
_segments = _line$attribute4.segments,
|
|
14166
|
+
_points = _points2;
|
|
14167
|
+
if (_segments && _segments.length) {
|
|
15281
14168
|
var startPoint, lastSeg;
|
|
15282
|
-
if (line.cache =
|
|
14169
|
+
if (line.cache = _segments.map(function (seg, index) {
|
|
15283
14170
|
if (seg.points.length <= 1 && 0 === index) return seg.points[0] && (lastSeg = {
|
|
15284
14171
|
endX: seg.points[0].x,
|
|
15285
14172
|
endY: seg.points[0].y,
|
|
@@ -15311,24 +14198,19 @@
|
|
|
15311
14198
|
line.cache[line.cache.length - 1] && line.cache[line.cache.length - 1].lineTo(startP.x, startP.y, !0);
|
|
15312
14199
|
}
|
|
15313
14200
|
} else {
|
|
15314
|
-
if (!
|
|
14201
|
+
if (!_points2 || !_points2.length) return line.cache = null, void line.clearUpdateShapeTag();
|
|
15315
14202
|
line.cache = calcLineCache$1(_points, curveType);
|
|
15316
14203
|
}
|
|
15317
14204
|
line.clearUpdateShapeTag();
|
|
15318
14205
|
}
|
|
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
14206
|
if (Array.isArray(line.cache)) {
|
|
15325
|
-
var
|
|
14207
|
+
var _segments2 = line.attribute.segments.filter(function (item) {
|
|
15326
14208
|
return item.points.length;
|
|
15327
14209
|
});
|
|
15328
|
-
if (1 ===
|
|
14210
|
+
if (1 === _segments2[0].points.length && _segments2.shift(), 1 === clipRange) {
|
|
15329
14211
|
var skip = !1;
|
|
15330
14212
|
line.cache.forEach(function (cache, index) {
|
|
15331
|
-
skip || (skip = _this2.drawSegmentItem(context, cache, !!fill, !!stroke, fillOpacity, strokeOpacity,
|
|
14213
|
+
skip || (skip = _this2.drawSegmentItem(context, cache, !!fill, !!stroke, fillOpacity, strokeOpacity, _segments2[index], [lineAttribute, line.attribute], clipRange, clipRangeByDimension, x, y, line, fillCb, strokeCb));
|
|
15332
14214
|
});
|
|
15333
14215
|
} else {
|
|
15334
14216
|
var totalLength = line.cache.reduce(function (l, c) {
|
|
@@ -15341,7 +14223,7 @@
|
|
|
15341
14223
|
if (_skip) return;
|
|
15342
14224
|
var curSegLength = cache.getLength(),
|
|
15343
14225
|
_cr = (totalDrawLength - drawedLengthUntilLast) / curSegLength;
|
|
15344
|
-
drawedLengthUntilLast += curSegLength, _cr > 0 && (_skip = _this2.drawSegmentItem(context, cache, !!fill, !!stroke, fillOpacity, strokeOpacity,
|
|
14226
|
+
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
14227
|
});
|
|
15346
14228
|
}
|
|
15347
14229
|
} else this.drawSegmentItem(context, line.cache, !!fill, !!stroke, fillOpacity, strokeOpacity, line.attribute, lineAttribute, clipRange, clipRangeByDimension, x, y, line, fillCb, strokeCb);
|
|
@@ -16029,21 +14911,7 @@
|
|
|
16029
14911
|
var textAttribute = getTheme(text, null == params ? void 0 : params.theme).text,
|
|
16030
14912
|
_text$attribute = text.attribute,
|
|
16031
14913
|
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,
|
|
14914
|
+
_text$attribute$under = _text$attribute.underline,
|
|
16047
14915
|
underline = _text$attribute$under === void 0 ? textAttribute.underline : _text$attribute$under,
|
|
16048
14916
|
_text$attribute$lineT = _text$attribute.lineThrough,
|
|
16049
14917
|
lineThrough = _text$attribute$lineT === void 0 ? textAttribute.lineThrough : _text$attribute$lineT,
|
|
@@ -16068,7 +14936,7 @@
|
|
|
16068
14936
|
var t = textAlign;
|
|
16069
14937
|
textAlign = null !== (_a = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = text.getAlignMapBaseline()[t]) && void 0 !== _b ? _b : "top";
|
|
16070
14938
|
}
|
|
16071
|
-
var lineHeight = null !== (_c = text.attribute.lineHeight) && void 0 !== _c ? _c : fontSize,
|
|
14939
|
+
var lineHeight = null !== (_c = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _c ? _c : fontSize,
|
|
16072
14940
|
data = this.valid(text, textAttribute, fillCb, strokeCb);
|
|
16073
14941
|
if (!data) return;
|
|
16074
14942
|
var fVisible = data.fVisible,
|
|
@@ -16101,6 +14969,7 @@
|
|
|
16101
14969
|
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
14970
|
})));
|
|
16103
14971
|
} else {
|
|
14972
|
+
text.tryUpdateAABBBounds();
|
|
16104
14973
|
var cache = text.cache,
|
|
16105
14974
|
verticalList = cache.verticalList;
|
|
16106
14975
|
context.textAlign = "left", context.textBaseline = "top";
|
|
@@ -16128,14 +14997,15 @@
|
|
|
16128
14997
|
});
|
|
16129
14998
|
});
|
|
16130
14999
|
}
|
|
15000
|
+
} else if ("horizontal" === direction) {
|
|
15001
|
+
context.setTextStyle(text.attribute, textAttribute, z);
|
|
15002
|
+
var _t = text.clipedText;
|
|
15003
|
+
var dy = 0;
|
|
15004
|
+
lineHeight !== fontSize && ("top" === textBaseline ? dy = (lineHeight - fontSize) / 2 : "middle" === textBaseline || "bottom" === textBaseline && (dy = -(lineHeight - fontSize) / 2)), drawText(_t, 0, dy, 0);
|
|
16131
15005
|
} else {
|
|
15006
|
+
text.tryUpdateAABBBounds();
|
|
16132
15007
|
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) {
|
|
15008
|
+
if (_cache) {
|
|
16139
15009
|
context.setTextStyleWithoutAlignBaseline(text.attribute, textAttribute, z);
|
|
16140
15010
|
var _verticalList = _cache.verticalList;
|
|
16141
15011
|
var _offsetY = 0;
|
|
@@ -17437,7 +16307,7 @@
|
|
|
17437
16307
|
var DefaultDrawContribution = /*#__PURE__*/function () {
|
|
17438
16308
|
function DefaultDrawContribution(contributions, drawItemInterceptorContributions) {
|
|
17439
16309
|
_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;
|
|
16310
|
+
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
16311
|
}
|
|
17442
16312
|
_createClass(DefaultDrawContribution, [{
|
|
17443
16313
|
key: "init",
|
|
@@ -17452,11 +16322,18 @@
|
|
|
17452
16322
|
return a.order - b.order;
|
|
17453
16323
|
});
|
|
17454
16324
|
}
|
|
16325
|
+
}, {
|
|
16326
|
+
key: "prepareForDraw",
|
|
16327
|
+
value: function prepareForDraw(renderService, drawContext) {
|
|
16328
|
+
renderService.renderTreeRoots.reduce(function (a, b) {
|
|
16329
|
+
return a + b.count;
|
|
16330
|
+
}, 0) < this.global.optmizeSkipCheckBoundariesThreshold ? this.useDirtyBounds = !1 : this.useDirtyBounds = !0;
|
|
16331
|
+
}
|
|
17455
16332
|
}, {
|
|
17456
16333
|
key: "draw",
|
|
17457
16334
|
value: function draw(renderService, drawContext) {
|
|
17458
16335
|
var _this2 = this;
|
|
17459
|
-
drawContext.drawContribution = this, this.currentRenderMap = this.styleRenderMap.get(drawContext.renderStyle) || this.defaultRenderMap, this.currentRenderService = renderService;
|
|
16336
|
+
this.prepareForDraw(renderService, drawContext), drawContext.drawContribution = this, this.currentRenderMap = this.styleRenderMap.get(drawContext.renderStyle) || this.defaultRenderMap, this.currentRenderService = renderService;
|
|
17460
16337
|
var context = drawContext.context,
|
|
17461
16338
|
stage = drawContext.stage,
|
|
17462
16339
|
_drawContext$x = drawContext.x,
|
|
@@ -17503,11 +16380,14 @@
|
|
|
17503
16380
|
var _this3 = this;
|
|
17504
16381
|
if (drawContext["break"] || !1 === group.attribute.visibleAll) return;
|
|
17505
16382
|
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
|
-
|
|
16383
|
+
if (this.useDirtyBounds && !vutils.isRectIntersect(group.AABBBounds, this.dirtyBounds, !1)) return;
|
|
16384
|
+
var nextM, tempBounds;
|
|
16385
|
+
if (this.useDirtyBounds) {
|
|
16386
|
+
tempBounds = boundsAllocate.allocateByObj(this.dirtyBounds);
|
|
16387
|
+
var gm = group.transMatrix;
|
|
16388
|
+
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());
|
|
16389
|
+
}
|
|
16390
|
+
this.renderItem(group, drawContext, {
|
|
17511
16391
|
drawingCb: function drawingCb() {
|
|
17512
16392
|
var _a;
|
|
17513
16393
|
skipSort ? group.forEachChildren(function (item) {
|
|
@@ -17516,7 +16396,7 @@
|
|
|
17516
16396
|
drawContext["break"] || (item.isContainer ? _this3.renderGroup(item, drawContext, nextM) : _this3.renderItem(item, drawContext));
|
|
17517
16397
|
}, !1, !!(null === (_a = drawContext.context) || void 0 === _a ? void 0 : _a.camera));
|
|
17518
16398
|
}
|
|
17519
|
-
}), this.dirtyBounds.copy(tempBounds), boundsAllocate.free(tempBounds), matrixAllocate.free(nextM);
|
|
16399
|
+
}), this.useDirtyBounds && (this.dirtyBounds.copy(tempBounds), boundsAllocate.free(tempBounds), matrixAllocate.free(nextM));
|
|
17520
16400
|
}
|
|
17521
16401
|
}, {
|
|
17522
16402
|
key: "_increaseRender",
|
|
@@ -17587,7 +16467,7 @@
|
|
|
17587
16467
|
this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(m), this.dirtyBounds.translate(-scrollX, -scrollY);
|
|
17588
16468
|
}
|
|
17589
16469
|
}
|
|
17590
|
-
if (!graphic.isContainer && !vutils.isRectIntersect(graphic.AABBBounds, this.dirtyBounds, !1)) return void (retrans && this.dirtyBounds.copy(tempBounds));
|
|
16470
|
+
if (this.useDirtyBounds && !graphic.isContainer && !vutils.isRectIntersect(graphic.AABBBounds, this.dirtyBounds, !1)) return void (retrans && this.dirtyBounds.copy(tempBounds));
|
|
17591
16471
|
var skipDraw = null != drawContext.startAtId && graphic._uid !== drawContext.startAtId;
|
|
17592
16472
|
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
16473
|
var _drawContribution = this.InterceptorContributions[_i];
|
|
@@ -17638,7 +16518,7 @@
|
|
|
17638
16518
|
}]);
|
|
17639
16519
|
return DefaultDrawContribution;
|
|
17640
16520
|
}();
|
|
17641
|
-
|
|
16521
|
+
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
16522
|
|
|
17643
16523
|
var __decorate$f = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
17644
16524
|
var d,
|
|
@@ -19979,9 +18859,15 @@
|
|
|
19979
18859
|
'cursor'
|
|
19980
18860
|
];
|
|
19981
18861
|
class AbstractComponent extends Group {
|
|
19982
|
-
constructor(attributes,
|
|
18862
|
+
constructor(attributes, options) {
|
|
19983
18863
|
super(attributes);
|
|
19984
|
-
|
|
18864
|
+
if (options === null || options === void 0 ? void 0 : options.mode) {
|
|
18865
|
+
this.mode = options.mode;
|
|
18866
|
+
this.setMode(options.mode);
|
|
18867
|
+
}
|
|
18868
|
+
if (options === null || options === void 0 ? void 0 : options.skipDefault) {
|
|
18869
|
+
this.skipDefault = true;
|
|
18870
|
+
}
|
|
19985
18871
|
this.setTheme({
|
|
19986
18872
|
common: {
|
|
19987
18873
|
strokeBoundsBuffer: 0
|
|
@@ -20058,8 +18944,8 @@
|
|
|
20058
18944
|
throttle: vutils.throttle
|
|
20059
18945
|
};
|
|
20060
18946
|
class ScrollBar extends AbstractComponent {
|
|
20061
|
-
constructor(attributes) {
|
|
20062
|
-
super(vutils.merge({}, ScrollBar.defaultAttributes, attributes));
|
|
18947
|
+
constructor(attributes, options) {
|
|
18948
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, ScrollBar.defaultAttributes, attributes));
|
|
20063
18949
|
this.name = 'scrollbar';
|
|
20064
18950
|
this._onRailPointerDown = (e) => {
|
|
20065
18951
|
var _a, _b;
|
|
@@ -20802,8 +19688,8 @@
|
|
|
20802
19688
|
}
|
|
20803
19689
|
|
|
20804
19690
|
class Tag extends AbstractComponent {
|
|
20805
|
-
constructor(attributes) {
|
|
20806
|
-
super(vutils.merge({}, Tag.defaultAttributes, attributes));
|
|
19691
|
+
constructor(attributes, options) {
|
|
19692
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, Tag.defaultAttributes, attributes));
|
|
20807
19693
|
this.name = 'tag';
|
|
20808
19694
|
}
|
|
20809
19695
|
render() {
|
|
@@ -20920,8 +19806,8 @@
|
|
|
20920
19806
|
|
|
20921
19807
|
const _tBounds = new vutils.AABBBounds();
|
|
20922
19808
|
class PopTip extends AbstractComponent {
|
|
20923
|
-
constructor(attributes) {
|
|
20924
|
-
super(vutils.merge({}, PopTip.defaultAttributes, attributes));
|
|
19809
|
+
constructor(attributes, options) {
|
|
19810
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, PopTip.defaultAttributes, attributes));
|
|
20925
19811
|
this.name = 'poptip';
|
|
20926
19812
|
this.positionList = ['top', 'tl', 'tr', 'bottom', 'bl', 'br', 'left', 'lt', 'lb', 'right', 'rt', 'rb'];
|
|
20927
19813
|
}
|
|
@@ -21322,8 +20208,8 @@
|
|
|
21322
20208
|
}
|
|
21323
20209
|
|
|
21324
20210
|
class LineCrosshair extends CrosshairBase {
|
|
21325
|
-
constructor(attributes) {
|
|
21326
|
-
super(vutils.merge({}, LineCrosshair.defaultAttributes, attributes));
|
|
20211
|
+
constructor(attributes, options) {
|
|
20212
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, LineCrosshair.defaultAttributes, attributes));
|
|
21327
20213
|
}
|
|
21328
20214
|
renderCrosshair(container) {
|
|
21329
20215
|
const { start, end, lineStyle } = this.attribute;
|
|
@@ -21347,8 +20233,8 @@
|
|
|
21347
20233
|
};
|
|
21348
20234
|
|
|
21349
20235
|
class RectCrosshair extends CrosshairBase {
|
|
21350
|
-
constructor(attributes) {
|
|
21351
|
-
super(vutils.merge({}, RectCrosshair.defaultAttributes, attributes));
|
|
20236
|
+
constructor(attributes, options) {
|
|
20237
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, RectCrosshair.defaultAttributes, attributes));
|
|
21352
20238
|
}
|
|
21353
20239
|
renderCrosshair(container) {
|
|
21354
20240
|
const { start, end, rectStyle } = this.attribute;
|
|
@@ -21371,8 +20257,8 @@
|
|
|
21371
20257
|
};
|
|
21372
20258
|
|
|
21373
20259
|
class CircleCrosshair extends CrosshairBase {
|
|
21374
|
-
constructor(attributes) {
|
|
21375
|
-
super(vutils.merge({}, CircleCrosshair.defaultAttributes, attributes));
|
|
20260
|
+
constructor(attributes, options) {
|
|
20261
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, CircleCrosshair.defaultAttributes, attributes));
|
|
21376
20262
|
}
|
|
21377
20263
|
renderCrosshair(container) {
|
|
21378
20264
|
const { center, radius, lineStyle } = this.attribute;
|
|
@@ -21394,8 +20280,8 @@
|
|
|
21394
20280
|
};
|
|
21395
20281
|
|
|
21396
20282
|
class SectorCrosshair extends CrosshairBase {
|
|
21397
|
-
constructor(attributes) {
|
|
21398
|
-
super(vutils.merge({}, SectorCrosshair.defaultAttributes, attributes));
|
|
20283
|
+
constructor(attributes, options) {
|
|
20284
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, SectorCrosshair.defaultAttributes, attributes));
|
|
21399
20285
|
}
|
|
21400
20286
|
renderCrosshair(container) {
|
|
21401
20287
|
const { center, radius, innerRadius = 0, sectorStyle } = this.attribute;
|
|
@@ -21423,8 +20309,8 @@
|
|
|
21423
20309
|
};
|
|
21424
20310
|
|
|
21425
20311
|
class PolygonCrosshair extends CrosshairBase {
|
|
21426
|
-
constructor(attributes) {
|
|
21427
|
-
super(vutils.merge({}, PolygonCrosshair.defaultAttributes, attributes));
|
|
20312
|
+
constructor(attributes, options) {
|
|
20313
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, PolygonCrosshair.defaultAttributes, attributes));
|
|
21428
20314
|
}
|
|
21429
20315
|
renderCrosshair(container) {
|
|
21430
20316
|
const { center, radius, sides = 6, lineStyle } = this.attribute;
|
|
@@ -21971,8 +20857,8 @@
|
|
|
21971
20857
|
setBitmapTool(bmpTool) {
|
|
21972
20858
|
this._bmpTool = bmpTool;
|
|
21973
20859
|
}
|
|
21974
|
-
constructor(attributes) {
|
|
21975
|
-
super(vutils.merge({}, LabelBase.defaultAttributes, attributes));
|
|
20860
|
+
constructor(attributes, options) {
|
|
20861
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, LabelBase.defaultAttributes, attributes));
|
|
21976
20862
|
this.name = 'label';
|
|
21977
20863
|
this._onHover = (e) => {
|
|
21978
20864
|
const target = e.target;
|
|
@@ -22584,8 +21470,8 @@
|
|
|
22584
21470
|
};
|
|
22585
21471
|
|
|
22586
21472
|
class SymbolLabel extends LabelBase {
|
|
22587
|
-
constructor(attributes) {
|
|
22588
|
-
super(vutils.merge({}, SymbolLabel.defaultAttributes, attributes));
|
|
21473
|
+
constructor(attributes, options) {
|
|
21474
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, SymbolLabel.defaultAttributes, attributes));
|
|
22589
21475
|
this.name = 'symbol-label';
|
|
22590
21476
|
}
|
|
22591
21477
|
labeling(textBounds, graphicBounds, position = 'top', offset = 0) {
|
|
@@ -22606,8 +21492,8 @@
|
|
|
22606
21492
|
};
|
|
22607
21493
|
|
|
22608
21494
|
class RectLabel extends LabelBase {
|
|
22609
|
-
constructor(attributes) {
|
|
22610
|
-
super(vutils.merge({}, RectLabel.defaultAttributes, attributes));
|
|
21495
|
+
constructor(attributes, options) {
|
|
21496
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, RectLabel.defaultAttributes, attributes));
|
|
22611
21497
|
}
|
|
22612
21498
|
labeling(textBounds, graphicBounds, position = 'top', offset = 0) {
|
|
22613
21499
|
if (!textBounds || !graphicBounds) {
|
|
@@ -22702,8 +21588,8 @@
|
|
|
22702
21588
|
};
|
|
22703
21589
|
|
|
22704
21590
|
class LineLabel extends LabelBase {
|
|
22705
|
-
constructor(attributes) {
|
|
22706
|
-
super(vutils.merge({}, LineLabel.defaultAttributes, attributes));
|
|
21591
|
+
constructor(attributes, options) {
|
|
21592
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, LineLabel.defaultAttributes, attributes));
|
|
22707
21593
|
this.name = 'line-label';
|
|
22708
21594
|
}
|
|
22709
21595
|
getGraphicBounds(graphic, point = {}) {
|
|
@@ -22780,8 +21666,8 @@
|
|
|
22780
21666
|
}
|
|
22781
21667
|
}
|
|
22782
21668
|
class ArcLabel extends LabelBase {
|
|
22783
|
-
constructor(attributes) {
|
|
22784
|
-
super(vutils.merge({}, ArcLabel.defaultAttributes, attributes));
|
|
21669
|
+
constructor(attributes, options) {
|
|
21670
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, ArcLabel.defaultAttributes, attributes));
|
|
22785
21671
|
this.name = 'arc-label';
|
|
22786
21672
|
this._ellipsisWidth = 0;
|
|
22787
21673
|
this._arcLeft = new Map();
|
|
@@ -23478,8 +22364,8 @@
|
|
|
23478
22364
|
};
|
|
23479
22365
|
|
|
23480
22366
|
class LineDataLabel extends LabelBase {
|
|
23481
|
-
constructor(attributes) {
|
|
23482
|
-
super(vutils.merge({}, LineDataLabel.defaultAttributes, attributes));
|
|
22367
|
+
constructor(attributes, options) {
|
|
22368
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, LineDataLabel.defaultAttributes, attributes));
|
|
23483
22369
|
this.name = 'line-data-label';
|
|
23484
22370
|
}
|
|
23485
22371
|
labeling(textBounds, graphicBounds, position = 'top', offset = 0) {
|
|
@@ -23506,8 +22392,8 @@
|
|
|
23506
22392
|
'line-data': LineDataLabel
|
|
23507
22393
|
};
|
|
23508
22394
|
class DataLabel extends AbstractComponent {
|
|
23509
|
-
constructor(attributes) {
|
|
23510
|
-
super(vutils.merge({}, DataLabel.defaultAttributes, attributes));
|
|
22395
|
+
constructor(attributes, options) {
|
|
22396
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, DataLabel.defaultAttributes, attributes));
|
|
23511
22397
|
this.name = 'data-label';
|
|
23512
22398
|
}
|
|
23513
22399
|
render() {
|
|
@@ -23582,8 +22468,8 @@
|
|
|
23582
22468
|
getMainSegmentPoints() {
|
|
23583
22469
|
return this._mainSegmentPoints;
|
|
23584
22470
|
}
|
|
23585
|
-
constructor(attributes) {
|
|
23586
|
-
super(vutils.merge({}, Segment.defaultAttributes, attributes));
|
|
22471
|
+
constructor(attributes, options) {
|
|
22472
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, Segment.defaultAttributes, attributes));
|
|
23587
22473
|
this.name = 'segment';
|
|
23588
22474
|
}
|
|
23589
22475
|
render() {
|
|
@@ -24609,11 +23495,8 @@
|
|
|
24609
23495
|
}
|
|
24610
23496
|
|
|
24611
23497
|
class LineAxis extends AxisBase {
|
|
24612
|
-
constructor(attributes,
|
|
24613
|
-
super(vutils.merge({}, LineAxis.defaultAttributes, attributes),
|
|
24614
|
-
if (mode === '3d') {
|
|
24615
|
-
this.setMode(mode);
|
|
24616
|
-
}
|
|
23498
|
+
constructor(attributes, options) {
|
|
23499
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, LineAxis.defaultAttributes, attributes), options);
|
|
24617
23500
|
}
|
|
24618
23501
|
_renderInner(container) {
|
|
24619
23502
|
var _a;
|
|
@@ -25093,8 +23976,8 @@
|
|
|
25093
23976
|
}
|
|
25094
23977
|
|
|
25095
23978
|
class CircleAxis extends AxisBase {
|
|
25096
|
-
constructor(attributes) {
|
|
25097
|
-
super(vutils.merge({}, CircleAxis.defaultAttributes, attributes));
|
|
23979
|
+
constructor(attributes, options) {
|
|
23980
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, CircleAxis.defaultAttributes, attributes));
|
|
25098
23981
|
}
|
|
25099
23982
|
renderLine(container) {
|
|
25100
23983
|
const { startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE, radius, center, innerRadius = 0, line, inside = false } = this.attribute;
|
|
@@ -25520,7 +24403,9 @@
|
|
|
25520
24403
|
const { center } = this.attribute;
|
|
25521
24404
|
path = getArcPath(center, points, false, !!closed);
|
|
25522
24405
|
}
|
|
25523
|
-
const shape = createPath(Object.assign({ path, z: depth }, (vutils.isFunction(style)
|
|
24406
|
+
const shape = createPath(Object.assign({ path, z: depth }, (vutils.isFunction(style)
|
|
24407
|
+
? vutils.merge({}, this.skipDefault ? null : BaseGrid.defaultAttributes.style, style(item, index))
|
|
24408
|
+
: style)));
|
|
25524
24409
|
shape.name = `${name}-line`;
|
|
25525
24410
|
shape.id = this._getNodeId(`${name}-path-${id}`);
|
|
25526
24411
|
container.add(shape);
|
|
@@ -25537,7 +24422,9 @@
|
|
|
25537
24422
|
const path = getLinePath(nextPoints, !!closed);
|
|
25538
24423
|
const deltaX = vutils.abs(nextPoints[0].x - nextPoints[1].x);
|
|
25539
24424
|
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)
|
|
24425
|
+
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)
|
|
24426
|
+
? vutils.merge({}, this.skipDefault ? null : BaseGrid.defaultAttributes.style, style(item, index))
|
|
24427
|
+
: style)));
|
|
25541
24428
|
shape.name = `${name}-line`;
|
|
25542
24429
|
shape.id = this._getNodeId(`${name}-path-${id}`);
|
|
25543
24430
|
container.add(shape);
|
|
@@ -25593,11 +24480,8 @@
|
|
|
25593
24480
|
return points;
|
|
25594
24481
|
}
|
|
25595
24482
|
class LineAxisGrid extends BaseGrid {
|
|
25596
|
-
constructor(attributes,
|
|
25597
|
-
super(vutils.merge({}, BaseGrid.defaultAttributes, attributes),
|
|
25598
|
-
if (mode === '3d') {
|
|
25599
|
-
this.setMode(mode);
|
|
25600
|
-
}
|
|
24483
|
+
constructor(attributes, options) {
|
|
24484
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, BaseGrid.defaultAttributes, attributes), options);
|
|
25601
24485
|
}
|
|
25602
24486
|
_getGridPoint(gridType, point) {
|
|
25603
24487
|
let gridPoints;
|
|
@@ -25697,8 +24581,8 @@
|
|
|
25697
24581
|
vutils.mixin(LineAxisGrid, LineAxisMixin);
|
|
25698
24582
|
|
|
25699
24583
|
class CircleAxisGrid extends BaseGrid {
|
|
25700
|
-
constructor(attributes) {
|
|
25701
|
-
super(vutils.merge({}, BaseGrid.defaultAttributes, attributes));
|
|
24584
|
+
constructor(attributes, options) {
|
|
24585
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, BaseGrid.defaultAttributes, attributes), options);
|
|
25702
24586
|
}
|
|
25703
24587
|
getGridAttribute(isSubGrid) {
|
|
25704
24588
|
let gridAttribute;
|
|
@@ -25791,6 +24675,13 @@
|
|
|
25791
24675
|
}
|
|
25792
24676
|
vutils.mixin(CircleAxisGrid, CircleAxisMixin);
|
|
25793
24677
|
|
|
24678
|
+
var DataZoomActiveTag;
|
|
24679
|
+
(function (DataZoomActiveTag) {
|
|
24680
|
+
DataZoomActiveTag["startHandler"] = "startHandler";
|
|
24681
|
+
DataZoomActiveTag["endHandler"] = "endHandler";
|
|
24682
|
+
DataZoomActiveTag["middleHandler"] = "middleHandler";
|
|
24683
|
+
DataZoomActiveTag["background"] = "background";
|
|
24684
|
+
})(DataZoomActiveTag || (DataZoomActiveTag = {}));
|
|
25794
24685
|
const DEFAULT_DATA_ZOOM_ATTRIBUTES = {
|
|
25795
24686
|
orient: 'bottom',
|
|
25796
24687
|
showDetail: 'auto',
|
|
@@ -25889,21 +24780,13 @@
|
|
|
25889
24780
|
}
|
|
25890
24781
|
};
|
|
25891
24782
|
|
|
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
24783
|
const delayMap$1 = {
|
|
25901
24784
|
debounce: vutils.debounce,
|
|
25902
24785
|
throttle: vutils.throttle
|
|
25903
24786
|
};
|
|
25904
24787
|
class DataZoom extends AbstractComponent {
|
|
25905
|
-
constructor(attributes) {
|
|
25906
|
-
super(vutils.merge({}, DataZoom.defaultAttributes, attributes));
|
|
24788
|
+
constructor(attributes, options) {
|
|
24789
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, DataZoom.defaultAttributes, attributes));
|
|
25907
24790
|
this.name = 'dataZoom';
|
|
25908
24791
|
this._previewData = [];
|
|
25909
24792
|
this._activeState = false;
|
|
@@ -25924,23 +24807,23 @@
|
|
|
25924
24807
|
this._onHandlerPointerDown = (e, tag) => {
|
|
25925
24808
|
e.stopPropagation();
|
|
25926
24809
|
if (tag === 'start') {
|
|
25927
|
-
this._activeTag =
|
|
24810
|
+
this._activeTag = DataZoomActiveTag.startHandler;
|
|
25928
24811
|
this._activeItem = this._startHandler;
|
|
25929
24812
|
}
|
|
25930
24813
|
else if (tag === 'end') {
|
|
25931
|
-
this._activeTag =
|
|
24814
|
+
this._activeTag = DataZoomActiveTag.endHandler;
|
|
25932
24815
|
this._activeItem = this._endHandler;
|
|
25933
24816
|
}
|
|
25934
24817
|
else if (tag === 'middleRect') {
|
|
25935
|
-
this._activeTag =
|
|
24818
|
+
this._activeTag = DataZoomActiveTag.middleHandler;
|
|
25936
24819
|
this._activeItem = this._middleHandlerRect;
|
|
25937
24820
|
}
|
|
25938
24821
|
else if (tag === 'middleSymbol') {
|
|
25939
|
-
this._activeTag =
|
|
24822
|
+
this._activeTag = DataZoomActiveTag.middleHandler;
|
|
25940
24823
|
this._activeItem = this._middleHandlerSymbol;
|
|
25941
24824
|
}
|
|
25942
24825
|
else if (tag === 'background') {
|
|
25943
|
-
this._activeTag =
|
|
24826
|
+
this._activeTag = DataZoomActiveTag.background;
|
|
25944
24827
|
this._activeItem = this._background;
|
|
25945
24828
|
}
|
|
25946
24829
|
this._activeState = true;
|
|
@@ -25948,7 +24831,6 @@
|
|
|
25948
24831
|
this._activeCache.lastPos = this.eventPosToStagePos(e);
|
|
25949
24832
|
};
|
|
25950
24833
|
this._onHandlerPointerMove = (e) => {
|
|
25951
|
-
var _a;
|
|
25952
24834
|
e.stopPropagation();
|
|
25953
24835
|
const { start: startAttr, end: endAttr, brushSelect, realTime = true } = this.attribute;
|
|
25954
24836
|
const pos = this.eventPosToStagePos(e);
|
|
@@ -25956,24 +24838,24 @@
|
|
|
25956
24838
|
const dis = (pos[attPos] - this._activeCache.lastPos[attPos]) / max;
|
|
25957
24839
|
let { start, end } = this.state;
|
|
25958
24840
|
if (this._activeState) {
|
|
25959
|
-
if (this._activeTag ===
|
|
24841
|
+
if (this._activeTag === DataZoomActiveTag.middleHandler) {
|
|
25960
24842
|
this.moveZoomWithMiddle((this.state.start + this.state.end) / 2 + dis);
|
|
25961
24843
|
}
|
|
25962
|
-
else if (this._activeTag ===
|
|
24844
|
+
else if (this._activeTag === DataZoomActiveTag.startHandler) {
|
|
25963
24845
|
if (start + dis > end) {
|
|
25964
24846
|
start = end;
|
|
25965
24847
|
end = start + dis;
|
|
25966
|
-
this._activeTag =
|
|
24848
|
+
this._activeTag = DataZoomActiveTag.endHandler;
|
|
25967
24849
|
}
|
|
25968
24850
|
else {
|
|
25969
24851
|
start = start + dis;
|
|
25970
24852
|
}
|
|
25971
24853
|
}
|
|
25972
|
-
else if (this._activeTag ===
|
|
24854
|
+
else if (this._activeTag === DataZoomActiveTag.endHandler) {
|
|
25973
24855
|
if (end + dis < start) {
|
|
25974
24856
|
end = start;
|
|
25975
24857
|
start = end + dis;
|
|
25976
|
-
this._activeTag =
|
|
24858
|
+
this._activeTag = DataZoomActiveTag.startHandler;
|
|
25977
24859
|
}
|
|
25978
24860
|
else {
|
|
25979
24861
|
end = end + dis;
|
|
@@ -25986,7 +24868,7 @@
|
|
|
25986
24868
|
end = Math.min(Math.max(end, 0), 1);
|
|
25987
24869
|
if (startAttr !== start || endAttr !== end) {
|
|
25988
24870
|
this.setStateAttr(start, end, true);
|
|
25989
|
-
realTime &&
|
|
24871
|
+
realTime && this._updateStateCallback && this._updateStateCallback(start, end);
|
|
25990
24872
|
this._dispatchChangeEvent(start, end);
|
|
25991
24873
|
}
|
|
25992
24874
|
};
|
|
@@ -26091,11 +24973,10 @@
|
|
|
26091
24973
|
};
|
|
26092
24974
|
}
|
|
26093
24975
|
_onHandlerPointerUp(e) {
|
|
26094
|
-
var _a;
|
|
26095
24976
|
e.preventDefault();
|
|
26096
24977
|
const { start, end, brushSelect, realTime = true } = this.attribute;
|
|
26097
24978
|
if (this._activeState) {
|
|
26098
|
-
if (this._activeTag ===
|
|
24979
|
+
if (this._activeTag === DataZoomActiveTag.background) {
|
|
26099
24980
|
const pos = this.eventPosToStagePos(e);
|
|
26100
24981
|
this.backgroundDragZoom(this._activeCache.startPos, pos);
|
|
26101
24982
|
}
|
|
@@ -26104,7 +24985,7 @@
|
|
|
26104
24985
|
brushSelect && this.renderDragMask();
|
|
26105
24986
|
if (!realTime || start !== this.state.start || end !== this.state.end) {
|
|
26106
24987
|
this.setStateAttr(this.state.start, this.state.end, true);
|
|
26107
|
-
|
|
24988
|
+
this._updateStateCallback && this._updateStateCallback(this.state.start, this.state.end);
|
|
26108
24989
|
this._dispatchChangeEvent(this.state.start, this.state.end);
|
|
26109
24990
|
}
|
|
26110
24991
|
}
|
|
@@ -26154,11 +25035,11 @@
|
|
|
26154
25035
|
const { dragMaskStyle } = this.attribute;
|
|
26155
25036
|
const { position, width, height } = this.getLayoutAttrFromConfig();
|
|
26156
25037
|
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 ===
|
|
25038
|
+
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
25039
|
0, height }, dragMaskStyle), 'rect');
|
|
26159
25040
|
}
|
|
26160
25041
|
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 ===
|
|
25042
|
+
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
25043
|
0 }, dragMaskStyle), 'rect');
|
|
26163
25044
|
}
|
|
26164
25045
|
}
|
|
@@ -26477,14 +25358,13 @@
|
|
|
26477
25358
|
this.dispatchEvent(changeEvent);
|
|
26478
25359
|
}
|
|
26479
25360
|
setStartAndEnd(start, end) {
|
|
26480
|
-
var _a;
|
|
26481
25361
|
const { start: startAttr, end: endAttr } = this.attribute;
|
|
26482
25362
|
if (vutils.isValid(start) && vutils.isValid(end) && (start !== this.state.start || end !== this.state.end)) {
|
|
26483
25363
|
this.state.start = start;
|
|
26484
25364
|
this.state.end = end;
|
|
26485
25365
|
if (startAttr !== this.state.start || endAttr !== this.state.end) {
|
|
26486
25366
|
this.setStateAttr(start, end, true);
|
|
26487
|
-
|
|
25367
|
+
this._updateStateCallback && this._updateStateCallback(start, end);
|
|
26488
25368
|
this._dispatchChangeEvent(start, end);
|
|
26489
25369
|
}
|
|
26490
25370
|
}
|
|
@@ -26892,8 +25772,8 @@
|
|
|
26892
25772
|
getLabel() {
|
|
26893
25773
|
return this._label;
|
|
26894
25774
|
}
|
|
26895
|
-
constructor(attributes) {
|
|
26896
|
-
super(vutils.merge({}, MarkLine.defaultAttributes, attributes));
|
|
25775
|
+
constructor(attributes, options) {
|
|
25776
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, MarkLine.defaultAttributes, attributes));
|
|
26897
25777
|
this.name = 'markLine';
|
|
26898
25778
|
}
|
|
26899
25779
|
setLabelPos() {
|
|
@@ -26987,8 +25867,8 @@
|
|
|
26987
25867
|
getLabel() {
|
|
26988
25868
|
return this._label;
|
|
26989
25869
|
}
|
|
26990
|
-
constructor(attributes) {
|
|
26991
|
-
super(vutils.merge({}, MarkArea.defaultAttributes, attributes));
|
|
25870
|
+
constructor(attributes, options) {
|
|
25871
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, MarkArea.defaultAttributes, attributes));
|
|
26992
25872
|
this.name = 'markArea';
|
|
26993
25873
|
}
|
|
26994
25874
|
_getPositionByDirection(area, direction) {
|
|
@@ -27070,8 +25950,8 @@
|
|
|
27070
25950
|
MarkArea.defaultAttributes = DEFAULT_MARK_AREA_THEME;
|
|
27071
25951
|
|
|
27072
25952
|
class MarkPoint extends Marker {
|
|
27073
|
-
constructor(attributes) {
|
|
27074
|
-
super(vutils.merge({}, MarkPoint.defaultAttributes, attributes));
|
|
25953
|
+
constructor(attributes, options) {
|
|
25954
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, MarkPoint.defaultAttributes, attributes));
|
|
27075
25955
|
this.name = 'markPoint';
|
|
27076
25956
|
}
|
|
27077
25957
|
setLabelPos() {
|
|
@@ -27292,8 +26172,8 @@
|
|
|
27292
26172
|
getCurrent() {
|
|
27293
26173
|
return this._current;
|
|
27294
26174
|
}
|
|
27295
|
-
constructor(attributes) {
|
|
27296
|
-
super(vutils.merge({}, Pager.defaultAttributes, attributes));
|
|
26175
|
+
constructor(attributes, options) {
|
|
26176
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, Pager.defaultAttributes, attributes));
|
|
27297
26177
|
this.name = 'pager';
|
|
27298
26178
|
this._current = 1;
|
|
27299
26179
|
this._onHover = (e) => {
|
|
@@ -27559,8 +26439,8 @@
|
|
|
27559
26439
|
[exports.LegendStateValue.unSelectedHover]: {}
|
|
27560
26440
|
};
|
|
27561
26441
|
class DiscreteLegend extends LegendBase {
|
|
27562
|
-
constructor(attributes) {
|
|
27563
|
-
super(vutils.merge({}, DiscreteLegend.defaultAttributes, attributes));
|
|
26442
|
+
constructor(attributes, options) {
|
|
26443
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, DiscreteLegend.defaultAttributes, attributes));
|
|
27564
26444
|
this.name = 'discreteLegend';
|
|
27565
26445
|
this._itemsContainer = null;
|
|
27566
26446
|
this._itemHeightByUser = undefined;
|
|
@@ -28277,8 +27157,8 @@
|
|
|
28277
27157
|
get endHandler() {
|
|
28278
27158
|
return this._endHandler;
|
|
28279
27159
|
}
|
|
28280
|
-
constructor(attributes) {
|
|
28281
|
-
super(vutils.merge({}, Slider.defaultAttributes, attributes));
|
|
27160
|
+
constructor(attributes, options) {
|
|
27161
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, Slider.defaultAttributes, attributes));
|
|
28282
27162
|
this.name = 'slider';
|
|
28283
27163
|
this._isHorizontal = true;
|
|
28284
27164
|
this._startHandler = null;
|
|
@@ -28897,8 +27777,8 @@
|
|
|
28897
27777
|
};
|
|
28898
27778
|
|
|
28899
27779
|
class ColorContinuousLegend extends LegendBase {
|
|
28900
|
-
constructor(attributes) {
|
|
28901
|
-
super(vutils.merge({}, ColorContinuousLegend.defaultAttributes, attributes));
|
|
27780
|
+
constructor(attributes, options) {
|
|
27781
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, ColorContinuousLegend.defaultAttributes, attributes));
|
|
28902
27782
|
this.name = 'colorLegend';
|
|
28903
27783
|
this._onSliderChange = (e) => {
|
|
28904
27784
|
this._updateColor();
|
|
@@ -29093,8 +27973,8 @@
|
|
|
29093
27973
|
`;
|
|
29094
27974
|
}
|
|
29095
27975
|
class SizeContinuousLegend extends LegendBase {
|
|
29096
|
-
constructor(attributes) {
|
|
29097
|
-
super(vutils.merge({}, SizeContinuousLegend.defaultAttributes, attributes));
|
|
27976
|
+
constructor(attributes, options) {
|
|
27977
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, SizeContinuousLegend.defaultAttributes, attributes));
|
|
29098
27978
|
this.name = 'sizeLegend';
|
|
29099
27979
|
this._onSliderChange = (e) => {
|
|
29100
27980
|
this.dispatchEvent(e);
|
|
@@ -29203,8 +28083,8 @@
|
|
|
29203
28083
|
};
|
|
29204
28084
|
|
|
29205
28085
|
class Title extends AbstractComponent {
|
|
29206
|
-
constructor(attributes) {
|
|
29207
|
-
super(vutils.merge({}, Title.defaultAttributes, attributes));
|
|
28086
|
+
constructor(attributes, options) {
|
|
28087
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, Title.defaultAttributes, attributes));
|
|
29208
28088
|
this.name = 'title';
|
|
29209
28089
|
}
|
|
29210
28090
|
render() {
|
|
@@ -29563,8 +28443,8 @@
|
|
|
29563
28443
|
Z`;
|
|
29564
28444
|
};
|
|
29565
28445
|
class LinkPath extends AbstractComponent {
|
|
29566
|
-
constructor(attributes) {
|
|
29567
|
-
super(vutils.merge({}, LinkPath.defaultAttributes, attributes));
|
|
28446
|
+
constructor(attributes, options) {
|
|
28447
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, LinkPath.defaultAttributes, attributes));
|
|
29568
28448
|
}
|
|
29569
28449
|
render() {
|
|
29570
28450
|
const { direction = 'horizontal' } = this.attribute;
|
|
@@ -29642,8 +28522,8 @@
|
|
|
29642
28522
|
})(ControllerTypeEnum || (ControllerTypeEnum = {}));
|
|
29643
28523
|
|
|
29644
28524
|
class Controller extends AbstractComponent {
|
|
29645
|
-
constructor(attributes) {
|
|
29646
|
-
super(vutils.merge({}, Controller.defaultAttributes, attributes));
|
|
28525
|
+
constructor(attributes, options) {
|
|
28526
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, Controller.defaultAttributes, attributes));
|
|
29647
28527
|
this._isPaused = true;
|
|
29648
28528
|
this.updateAttributes = () => {
|
|
29649
28529
|
this._startAttr = {
|
|
@@ -29861,8 +28741,8 @@
|
|
|
29861
28741
|
};
|
|
29862
28742
|
|
|
29863
28743
|
class BasePlayer extends AbstractComponent {
|
|
29864
|
-
constructor(attributes) {
|
|
29865
|
-
super(vutils.merge({}, BasePlayer.defaultAttributes, attributes));
|
|
28744
|
+
constructor(attributes, options) {
|
|
28745
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, BasePlayer.defaultAttributes, attributes));
|
|
29866
28746
|
this._data = [];
|
|
29867
28747
|
this._layoutInfo = {};
|
|
29868
28748
|
this._updateSliderAttrs = () => {
|
|
@@ -30062,8 +28942,8 @@
|
|
|
30062
28942
|
};
|
|
30063
28943
|
|
|
30064
28944
|
class DiscretePlayer extends BasePlayer {
|
|
30065
|
-
constructor(attributes) {
|
|
30066
|
-
super(vutils.merge({}, attributes));
|
|
28945
|
+
constructor(attributes, options) {
|
|
28946
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, attributes));
|
|
30067
28947
|
this._activeIndex = -1;
|
|
30068
28948
|
this._isReachEnd = false;
|
|
30069
28949
|
this._initAttributes = () => {
|
|
@@ -30403,8 +29283,8 @@
|
|
|
30403
29283
|
throttle: vutils.throttle
|
|
30404
29284
|
};
|
|
30405
29285
|
class Brush extends AbstractComponent {
|
|
30406
|
-
constructor(attributes) {
|
|
30407
|
-
super(vutils.merge({}, Brush.defaultAttributes, attributes));
|
|
29286
|
+
constructor(attributes, options) {
|
|
29287
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, Brush.defaultAttributes, attributes));
|
|
30408
29288
|
this.name = 'brush';
|
|
30409
29289
|
this._activeDrawState = false;
|
|
30410
29290
|
this._cacheDrawPoints = [];
|
|
@@ -30794,8 +29674,8 @@
|
|
|
30794
29674
|
const TOOLTIP_KEY_NAME_SUFFIX = 'key';
|
|
30795
29675
|
const TOOLTIP_VALUE_NAME_SUFFIX = 'value';
|
|
30796
29676
|
class Tooltip extends AbstractComponent {
|
|
30797
|
-
constructor(attributes) {
|
|
30798
|
-
super(vutils.merge({}, Tooltip.defaultAttributes, attributes));
|
|
29677
|
+
constructor(attributes, options) {
|
|
29678
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, Tooltip.defaultAttributes, attributes), options);
|
|
30799
29679
|
this.name = 'tooltip';
|
|
30800
29680
|
}
|
|
30801
29681
|
render() {
|
|
@@ -30862,7 +29742,9 @@
|
|
|
30862
29742
|
let x = 0;
|
|
30863
29743
|
if (isVisible(itemAttr.shape)) {
|
|
30864
29744
|
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) -
|
|
29745
|
+
(((_a = calculateLineHeight(itemAttr.key.lineHeight, itemAttr.key.fontSize)) !== null && _a !== void 0 ? _a : itemAttr.key.fontSize) -
|
|
29746
|
+
itemAttr.shape.size) /
|
|
29747
|
+
2 }, itemAttr.shape), 'symbol');
|
|
30866
29748
|
}
|
|
30867
29749
|
if (hasContentShape) {
|
|
30868
29750
|
x += itemAttr.shape.size + itemAttr.shape.spacing;
|
|
@@ -31080,8 +29962,8 @@
|
|
|
31080
29962
|
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
29963
|
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
29964
|
class CheckBox extends AbstractComponent {
|
|
31083
|
-
constructor(attributes) {
|
|
31084
|
-
super(vutils.merge({}, CheckBox.defaultAttributes, attributes));
|
|
29965
|
+
constructor(attributes, options) {
|
|
29966
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : vutils.merge({}, CheckBox.defaultAttributes, attributes));
|
|
31085
29967
|
this.renderGroup();
|
|
31086
29968
|
this.onBeforeAttributeUpdate = (val, attributes, key) => {
|
|
31087
29969
|
if ('interactive' in val) {
|
|
@@ -31243,7 +30125,7 @@
|
|
|
31243
30125
|
}
|
|
31244
30126
|
};
|
|
31245
30127
|
|
|
31246
|
-
const version = "0.17.0-alpha.
|
|
30128
|
+
const version = "0.17.0-alpha.2";
|
|
31247
30129
|
|
|
31248
30130
|
exports.AbstractComponent = AbstractComponent;
|
|
31249
30131
|
exports.ArcInfo = ArcInfo;
|