bk-magic-vue 2.5.9-beta.2 → 2.5.9-beta.21

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.
Files changed (113) hide show
  1. package/dist/bk-magic-vue.css +893 -959
  2. package/dist/bk-magic-vue.js +860 -625
  3. package/dist/bk-magic-vue.min.css +1 -1
  4. package/dist/bk-magic-vue.min.css.gz +0 -0
  5. package/dist/bk-magic-vue.min.css.map +1 -1
  6. package/dist/bk-magic-vue.min.js +1 -1
  7. package/dist/bk-magic-vue.min.js.gz +0 -0
  8. package/dist/bk-magic-vue.min.js.map +1 -1
  9. package/lib/card.js +2981 -203
  10. package/lib/cascade.js +6447 -6411
  11. package/lib/date-picker.js +1 -1
  12. package/lib/dialog.js +484 -9
  13. package/lib/info-box.js +484 -9
  14. package/lib/input.js +2942 -164
  15. package/lib/loading.js +7 -4
  16. package/lib/pagination.js +214 -17
  17. package/lib/rate.js +14 -3
  18. package/lib/resize-layout.js +3 -1
  19. package/lib/select.js +40 -9
  20. package/lib/sideslider.js +802 -336
  21. package/lib/slider.js +3270 -3202
  22. package/lib/star.js +13 -2
  23. package/lib/table.js +214 -17
  24. package/lib/tag-input.js +122 -102
  25. package/lib/time-picker.js +1 -1
  26. package/lib/timeline.js +26 -17
  27. package/lib/transfer.js +1886 -1710
  28. package/lib/ui/badge.css +127 -119
  29. package/lib/ui/badge.min.css +1 -1
  30. package/lib/ui/badge.min.css.map +1 -1
  31. package/lib/ui/bk-magic-vue.css +893 -959
  32. package/lib/ui/bk-magic-vue.min.css +1 -1
  33. package/lib/ui/bk-magic-vue.min.css.gz +0 -0
  34. package/lib/ui/bk-magic-vue.min.css.map +1 -1
  35. package/lib/ui/button.css +4 -4
  36. package/lib/ui/button.min.css +1 -1
  37. package/lib/ui/button.min.css.map +1 -1
  38. package/lib/ui/card.css +2 -2
  39. package/lib/ui/card.min.css +1 -1
  40. package/lib/ui/card.min.css.map +1 -1
  41. package/lib/ui/cascade.css +19 -1
  42. package/lib/ui/cascade.min.css +1 -1
  43. package/lib/ui/cascade.min.css.map +1 -1
  44. package/lib/ui/checkbox.css +67 -67
  45. package/lib/ui/checkbox.min.css.map +1 -1
  46. package/lib/ui/dialog.css +4 -4
  47. package/lib/ui/dialog.min.css +1 -1
  48. package/lib/ui/dialog.min.css.map +1 -1
  49. package/lib/ui/exception.css +1 -0
  50. package/lib/ui/exception.min.css +1 -1
  51. package/lib/ui/exception.min.css.map +1 -1
  52. package/lib/ui/form.css +2 -2
  53. package/lib/ui/form.min.css +1 -1
  54. package/lib/ui/form.min.css.map +1 -1
  55. package/lib/ui/info-box.css +4 -4
  56. package/lib/ui/info-box.min.css +1 -1
  57. package/lib/ui/info-box.min.css.map +1 -1
  58. package/lib/ui/input.css +1 -1
  59. package/lib/ui/input.min.css +1 -1
  60. package/lib/ui/input.min.css.map +1 -1
  61. package/lib/ui/link.css +27 -3
  62. package/lib/ui/link.min.css +1 -1
  63. package/lib/ui/link.min.css.map +1 -1
  64. package/lib/ui/loading.css +43 -280
  65. package/lib/ui/loading.min.css +1 -1
  66. package/lib/ui/loading.min.css.map +1 -1
  67. package/lib/ui/notify.css +5 -5
  68. package/lib/ui/notify.min.css +1 -1
  69. package/lib/ui/notify.min.css.map +1 -1
  70. package/lib/ui/overflow-tips.css +3 -2
  71. package/lib/ui/overflow-tips.min.css +1 -1
  72. package/lib/ui/overflow-tips.min.css.map +1 -1
  73. package/lib/ui/pagination.css +1 -1
  74. package/lib/ui/pagination.min.css +1 -1
  75. package/lib/ui/pagination.min.css.map +1 -1
  76. package/lib/ui/popconfirm.css +2 -2
  77. package/lib/ui/popconfirm.min.css +1 -1
  78. package/lib/ui/popconfirm.min.css.map +1 -1
  79. package/lib/ui/popover.css +3 -2
  80. package/lib/ui/popover.min.css +1 -1
  81. package/lib/ui/popover.min.css.map +1 -1
  82. package/lib/ui/process.css +51 -282
  83. package/lib/ui/process.min.css +1 -1
  84. package/lib/ui/process.min.css.map +1 -1
  85. package/lib/ui/progress.css +2 -2
  86. package/lib/ui/progress.min.css +1 -1
  87. package/lib/ui/progress.min.css.map +1 -1
  88. package/lib/ui/radio.css +64 -64
  89. package/lib/ui/radio.min.css +1 -1
  90. package/lib/ui/radio.min.css.map +1 -1
  91. package/lib/ui/resize-layout.css +13 -5
  92. package/lib/ui/resize-layout.min.css +1 -1
  93. package/lib/ui/resize-layout.min.css.map +1 -1
  94. package/lib/ui/sideslider.css +8 -7
  95. package/lib/ui/sideslider.min.css +1 -1
  96. package/lib/ui/sideslider.min.css.map +1 -1
  97. package/lib/ui/star.css +22 -17
  98. package/lib/ui/star.min.css +1 -1
  99. package/lib/ui/star.min.css.map +1 -1
  100. package/lib/ui/steps.css +372 -274
  101. package/lib/ui/steps.min.css +1 -1
  102. package/lib/ui/steps.min.css.map +1 -1
  103. package/lib/ui/tooltips.css +3 -2
  104. package/lib/ui/tooltips.min.css +1 -1
  105. package/lib/ui/tooltips.min.css.map +1 -1
  106. package/lib/ui/transfer.css +122 -121
  107. package/lib/ui/transfer.min.css +1 -1
  108. package/lib/ui/transfer.min.css.map +1 -1
  109. package/lib/ui/tree.css +45 -282
  110. package/lib/ui/tree.min.css +1 -1
  111. package/lib/ui/tree.min.css.map +1 -1
  112. package/lib/version-detail.js +453 -13
  113. package/package.json +3 -4
package/lib/transfer.js CHANGED
@@ -1,10 +1,11 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('bk-magic-vue/lib/locale')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'bk-magic-vue/lib/locale'], factory) :
4
- (global = global || self, factory(global.library = {}, global.locale));
5
- }(this, function (exports, locale) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('bk-magic-vue/lib/locale'), require('vue')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'bk-magic-vue/lib/locale', 'vue'], factory) :
4
+ (global = global || self, factory(global.library = {}, global.locale, global.Vue));
5
+ }(this, function (exports, locale, Vue) { 'use strict';
6
6
 
7
7
  locale = locale && locale.hasOwnProperty('default') ? locale['default'] : locale;
8
+ Vue = Vue && Vue.hasOwnProperty('default') ? Vue['default'] : Vue;
8
9
 
9
10
  function _typeof(obj) {
10
11
  "@babel/helpers - typeof";
@@ -537,803 +538,6 @@
537
538
  }
538
539
  };
539
540
 
540
- var script = {
541
- name: 'bk-input',
542
- mixins: [emitter, locale.mixin],
543
- props: {
544
- type: {
545
- type: String,
546
- default: 'text',
547
- validator: function validator(value) {
548
- return ['text', 'textarea', 'password', 'number', 'email', 'url', 'date'].indexOf(value) > -1;
549
- }
550
- },
551
- value: {
552
- type: [String, Number],
553
- default: ''
554
- },
555
- placeholder: {
556
- type: String,
557
- default: ''
558
- },
559
- disabled: {
560
- type: Boolean,
561
- default: false
562
- },
563
- clearable: {
564
- type: Boolean,
565
- default: false
566
- },
567
- readonly: {
568
- type: Boolean,
569
- default: false
570
- },
571
- name: {
572
- type: String,
573
- default: ''
574
- },
575
- maxlength: {
576
- type: [Number, String]
577
- },
578
- minlength: {
579
- type: [Number, String]
580
- },
581
- min: {
582
- type: Number,
583
- default: minSafeInteger$1
584
- },
585
- max: {
586
- type: Number,
587
- default: maxSafeInteger$1
588
- },
589
- size: {
590
- type: String,
591
- default: '',
592
- validator: function validator(val) {
593
- return ['', 'large', 'small'].includes(val);
594
- }
595
- },
596
- leftIcon: {
597
- type: String,
598
- default: ''
599
- },
600
- rightIcon: {
601
- type: String,
602
- default: ''
603
- },
604
- rows: {
605
- type: Number
606
- },
607
- inputStyle: {
608
- type: Object
609
- },
610
- fontSize: {
611
- type: String,
612
- default: 'normal'
613
- },
614
- precision: Number,
615
- passwordIcon: {
616
- type: Array,
617
- default: function _default() {
618
- return ['icon-eye-slash', 'icon-eye'];
619
- }
620
- },
621
- showControls: {
622
- type: Boolean,
623
- default: true
624
- },
625
- extCls: {
626
- type: String,
627
- default: ''
628
- },
629
- nativeAttributes: {
630
- type: Object,
631
- default: null
632
- },
633
- showWordLimit: {
634
- type: Boolean,
635
- default: undefined
636
- },
637
- behavior: {
638
- type: String,
639
- default: 'normal',
640
- validate: function validate(v) {
641
- return ['simplicity', 'normal'].indexOf(v) > -1;
642
- }
643
- },
644
- showClearOnlyHover: {
645
- type: Boolean,
646
- default: false
647
- },
648
- allowNumberPaste: {
649
- type: Boolean,
650
- default: false
651
- }
652
- },
653
- data: function data() {
654
- return {
655
- hover: false,
656
- curValue: '',
657
- prepend: false,
658
- append: false,
659
- isActive: false,
660
- defaultPlaceholder: '',
661
- rightIconStyle: {
662
- right: '10px'
663
- },
664
- rightPasswordIconStyle: {
665
- right: '10px'
666
- },
667
- inputType: this.type,
668
- inputSize: this.size,
669
- inputPasswordIcon: this.passwordIcon,
670
- inputRightPadding: '10px',
671
- iconAreaSizeObserver: null,
672
- validKeyCodeList: [48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
673
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
674
- 8,
675
- 189,
676
- 109,
677
- 190,
678
- 110,
679
- 38, 40, 37, 39,
680
- 46,
681
- 9
682
- ],
683
- isOnComposition: false
684
- };
685
- },
686
- computed: {
687
- showClearIcon: function showClearIcon() {
688
- return this.clearable && this.curValue && !this.disabled && (this.showClearOnlyHover ? this.hover : true);
689
- },
690
- showPwdVisable: function showPwdVisable() {
691
- return this.type === 'password' && this.curValue && this.inputPasswordIcon.length && !this.readonly && !this.disabled;
692
- },
693
- showInputWordLimit: function showInputWordLimit() {
694
- if (!['text', 'textarea'].includes(this.type)) return false;
695
- return this.type === 'text' ? this.maxlength && this.showWordLimit : this.maxlength && this.showWordLimit !== false;
696
- },
697
- bindAttribute: function bindAttribute() {
698
- return this.getAttributeByType(this.inputType);
699
- },
700
- computedStyle: function computedStyle() {
701
- return _extends(this.inputType === 'textarea' ? {} : {
702
- 'padding-right': this.inputRightPadding
703
- }, this.inputStyle);
704
- },
705
- showLeftIcon: function showLeftIcon() {
706
- return this.leftIcon;
707
- },
708
- showRightIcon: function showRightIcon() {
709
- return this.rightIcon || this.clearable && this.curValue || this.type === 'password' || this.maxlength;
710
- },
711
- showTwoRightIcon: function showTwoRightIcon() {
712
- return this.clearable && this.curValue && this.type === 'password';
713
- },
714
- wrapperClass: function wrapperClass() {
715
- var wrapperClass = ['bk-form-control', {
716
- 'with-left-icon': this.showLeftIcon,
717
- 'with-right-icon': this.showRightIcon,
718
- 'with-two-right-icon': this.showTwoRightIcon,
719
- 'control-prepend-group': this.prepend,
720
- 'control-append-group': this.append,
721
- 'control-active': this.isActive,
722
- 'control-disable': this.disabled
723
- }];
724
- if (this.inputSize) {
725
- wrapperClass.push("bk-input-wrapper-".concat(this.inputSize));
726
- }
727
- return wrapperClass;
728
- },
729
- fontSizeCls: function fontSizeCls() {
730
- var cls = '';
731
- if (this.fontSize === 'medium') {
732
- cls = 'medium-font';
733
- } else if (this.fontSize === 'large') {
734
- cls = 'large-font';
735
- }
736
- return cls;
737
- },
738
- inputSizeCls: function inputSizeCls() {
739
- if (this.inputSize) {
740
- return "bk-input-".concat(this.inputSize);
741
- }
742
- return '';
743
- }
744
- },
745
- watch: {
746
- value: {
747
- handler: function handler(val, old) {
748
- this.setCurValue(val);
749
- old === undefined && this.updateNumberValue(val);
750
- },
751
- immediate: true
752
- },
753
- placeholder: function placeholder(val) {
754
- this.defaultPlaceholder = val || this.t('bk.input.input');
755
- },
756
- type: function type(val) {
757
- this.inputType = val;
758
- },
759
- size: function size(val) {
760
- this.inputSize = val;
761
- }
762
- },
763
- created: function created() {
764
- this.defaultPlaceholder = this.placeholder || this.t('bk.input.input');
765
- },
766
- mounted: function mounted() {
767
- var _this = this;
768
- this.prepend = this.$slots.prepend !== undefined;
769
- this.append = this.$slots.append !== undefined;
770
- if (this.$slots.append) {
771
- this.$nextTick(function () {
772
- var appendWidth = _parseFloat$2(getStyle(_this.$slots.append[0].elm, 'width'));
773
- _this.rightIconStyle = {
774
- right: _parseFloat$2(_this.rightIconStyle.right) + appendWidth + 'px'
775
- };
776
- });
777
- }
778
- if (this.clearable) {
779
- this.rightPasswordIconStyle = {
780
- right: '30px'
781
- };
782
- }
783
- this.observerIconSize();
784
- },
785
- beforeDestroy: function beforeDestroy() {
786
- this.iconAreaSizeObserver && typeof this.iconAreaSizeObserver.disconnect === 'function' && this.iconAreaSizeObserver.disconnect();
787
- this.iconAreaSizeObserver = null;
788
- },
789
- methods: {
790
- observerIconSize: function observerIconSize() {
791
- var _this2 = this;
792
- var element = this.$refs.rightIconArea;
793
- if (!element) return;
794
- if (typeof ResizeObserver !== 'undefined') {
795
- var defaultPadding = 10;
796
- this.iconAreaSizeObserver = new ResizeObserver(function (entries) {
797
- var _iterator = _createForOfIteratorHelper(entries),
798
- _step;
799
- try {
800
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
801
- var entry = _step.value;
802
- var cr = entry.contentRect;
803
- _this2.inputRightPadding = "".concat(cr.width + defaultPadding, "px");
804
- }
805
- } catch (err) {
806
- _iterator.e(err);
807
- } finally {
808
- _iterator.f();
809
- }
810
- });
811
- this.iconAreaSizeObserver.observe(element);
812
- }
813
- },
814
- getAttributeByType: function getAttributeByType() {
815
- var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
816
- var defaultAttr = {
817
- type: type,
818
- name: this.name,
819
- placeholder: this.defaultPlaceholder,
820
- disabled: this.disabled,
821
- readonly: this.readonly,
822
- maxlength: this.maxlength,
823
- minlength: this.minlength,
824
- value: this.curValue
825
- };
826
- type = type.toLocaleLowerCase();
827
- var outputAttr = this.nativeAttributes || {};
828
- switch (type) {
829
- case 'number':
830
- var numberAttr = {
831
- min: this.min,
832
- max: this.max
833
- };
834
- _extends(outputAttr, defaultAttr, numberAttr);
835
- outputAttr.type = 'text';
836
- break;
837
- case 'textarea':
838
- var txtAttr = {
839
- rows: this.rows
840
- };
841
- _extends(outputAttr, defaultAttr, txtAttr);
842
- break;
843
- default:
844
- _extends(outputAttr, defaultAttr);
845
- break;
846
- }
847
- return outputAttr;
848
- },
849
- handleToFixed: function handleToFixed(defaultNumber, length) {
850
- var len = _parseInt$2(length, 10);
851
- var number = Number(defaultNumber);
852
- if (isNaN(number) || number >= Math.pow(10, 21)) {
853
- return number.toString();
854
- }
855
- if (typeof len === 'undefined' || len === 0) {
856
- return Math.round(number).toString();
857
- }
858
- var result = number.toString();
859
- var numberArr = result.split('.');
860
- if (numberArr.length < 2) {
861
- return this.handlePadNum(result, len);
862
- }
863
- var intNum = numberArr[0];
864
- var deciNum = numberArr[1];
865
- var lastNum = deciNum.substr(len, 1);
866
- if (deciNum.length === len) {
867
- return result;
868
- }
869
- if (deciNum.length < len) {
870
- return this.handlePadNum(result, len);
871
- }
872
- result = intNum + '.' + deciNum.substr(0, len);
873
- if (_parseInt$2(lastNum, 10) >= 5) {
874
- var times = Math.pow(10, len);
875
- var changedInt = Number(result.replace('.', ''));
876
- changedInt++;
877
- changedInt /= times;
878
- result = this.handlePadNum(changedInt + '', len);
879
- }
880
- return result;
881
- },
882
- handlePadNum: function handlePadNum(num, len) {
883
- var dotPos = num.indexOf('.');
884
- if (dotPos === -1) {
885
- num += '.';
886
- for (var i = 0; i < len; i++) {
887
- num += '0';
888
- }
889
- return num;
890
- } else {
891
- var need = len - (num.length - dotPos - 1);
892
- for (var j = 0; j < need; j++) {
893
- num += '0';
894
- }
895
- return num;
896
- }
897
- },
898
- handleNumberDelete: function handleNumberDelete(event) {
899
- this.curValue === '' && (this.curValue = this.max);
900
- var curNumberValue = Number(this.curValue);
901
- if (curNumberValue - 1 >= this.min) {
902
- var curLenAfterDot = (String(curNumberValue) || '').split('.')[1] || '';
903
- var newVal = curNumberValue - 1;
904
- if (typeof this.precision !== 'undefined') {
905
- newVal = this.handleToFixed(newVal, Math.min(16, Math.max(curLenAfterDot.length, this.precision)));
906
- }
907
- this.setCurValue(newVal);
908
- this.$emit('input', newVal, event);
909
- this.$emit('change', newVal, event);
910
- this.dispatch('bk-form-item', 'form-change');
911
- }
912
- },
913
- handleNumberAdd: function handleNumberAdd(event) {
914
- this.curValue === '' && (this.curValue = this.min);
915
- var curNumberValue = Number(this.curValue);
916
- if (curNumberValue <= this.max - 1) {
917
- var curLenAfterDot = (String(curNumberValue) || '').split('.')[1] || '';
918
- var newVal = curNumberValue + 1;
919
- if (typeof this.precision !== 'undefined') {
920
- newVal = this.handleToFixed(newVal, Math.min(16, Math.max(curLenAfterDot.length, this.precision)));
921
- }
922
- this.setCurValue(newVal);
923
- this.$emit('input', newVal, event);
924
- this.$emit('change', newVal, event);
925
- this.dispatch('bk-form-item', 'form-change');
926
- }
927
- },
928
- handlerEnter: function handlerEnter(event) {
929
- var value = event.target.value;
930
- this.$emit('enter', value, event);
931
- },
932
- handlerKeyup: function handlerKeyup(event) {
933
- var value = event.target.value;
934
- this.$emit('keyup', value, event);
935
- },
936
- handlerKeypress: function handlerKeypress(event) {
937
- var value = event.target.value;
938
- this.$emit('keypress', value, event);
939
- },
940
- handlerKeydown: function handlerKeydown(event) {
941
- var keyCode = event.keyCode;
942
- var target = event.currentTarget;
943
- var value = target.value;
944
- var isPaste = (event.ctrlKey || event.metaKey) && keyCode === 86;
945
- if (this.inputType === 'number') {
946
- if (!(this.allowNumberPaste && isPaste) && (this.validKeyCodeList.indexOf(keyCode) < 0 || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey)) {
947
- event.stopPropagation();
948
- event.preventDefault();
949
- return false;
950
- }
951
- if (keyCode === 190) {
952
- if (String(value).trim()) {
953
- if (value.indexOf('.') >= 0) {
954
- event.stopPropagation();
955
- event.preventDefault();
956
- return false;
957
- }
958
- }
959
- }
960
- if (event.keyCode === 189) {
961
- if (String(value).trim()) {
962
- if (value.indexOf('-') >= 0) {
963
- event.stopPropagation();
964
- event.preventDefault();
965
- return false;
966
- }
967
- if (document.getSelection().type !== 'Range') {
968
- if (target.selectionEnd !== 0) {
969
- event.stopPropagation();
970
- event.preventDefault();
971
- return false;
972
- }
973
- }
974
- }
975
- }
976
- if (keyCode === 38) {
977
- event.preventDefault();
978
- this.handleNumberAdd(event);
979
- } else if (keyCode === 40) {
980
- event.preventDefault();
981
- this.handleNumberDelete(event);
982
- }
983
- if (document.getSelection().type !== 'Range') {
984
- if (value.indexOf('-') === 0 && target.selectionStart === 0) {
985
- var keyCodeList = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
986
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
987
- 189,
988
- 109,
989
- 190,
990
- 110
991
- ];
992
- if (keyCodeList.indexOf(keyCode) > -1) {
993
- event.stopPropagation();
994
- event.preventDefault();
995
- return false;
996
- }
997
- }
998
- }
999
- }
1000
- this.$emit('keydown', value, event);
1001
- },
1002
- handlerFocus: function handlerFocus(event) {
1003
- var value = event.target.value;
1004
- this.isActive = true;
1005
- this.$emit('focus', value, event);
1006
- this.dispatch('bk-form-item', 'form-focus');
1007
- },
1008
- toPrecision: function toPrecision(num, precision) {
1009
- if (precision === undefined) precision = 0;
1010
- return this.handleToFixed(num, precision);
1011
- },
1012
- handlerBlur: function handlerBlur(event) {
1013
- var value = event.target.value;
1014
- if (/^number$/i.test(this.type) && value !== '') {
1015
- if (isNaN(value)) {
1016
- value = this.min === minSafeInteger$1 ? 0 : this.min;
1017
- }
1018
- if (value !== '' && /^-?\d*(.\d*)?$/i.test(value)) {
1019
- if (value > this.max || value < this.min) {
1020
- value = this.getCurrentNumberValue();
1021
- }
1022
- }
1023
- if (typeof this.precision !== 'undefined') {
1024
- value = this.toPrecision(_parseFloat$2(value), this.precision, true);
1025
- } else {
1026
- value = Number(value);
1027
- }
1028
- if (value + '' !== event.target.value + '') {
1029
- this.setCurValue(value);
1030
- event.target.value = value;
1031
- this.$emit('change', value, event);
1032
- this.$emit('input', value, event);
1033
- }
1034
- }
1035
- this.isActive = false;
1036
- this.$emit('blur', value, event);
1037
- this.dispatch('bk-form-item', 'form-blur');
1038
- },
1039
- handlerPaste: function handlerPaste(event) {
1040
- var value = event.target.value;
1041
- this.$emit('paste', value, event);
1042
- this.$emit('change', value, event);
1043
- this.dispatch('bk-form-item', 'form-change');
1044
- },
1045
- getCurrentNumberValue: function getCurrentNumberValue() {
1046
- var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1047
- val = val === null ? this.curValue : val;
1048
- var value = '';
1049
- if (val !== '' && /^-?\d*(.\d*)?$/i.test(val)) {
1050
- value = Number(val);
1051
- value = value > this.max ? this.max : value;
1052
- value = value < this.min ? this.min : value;
1053
- return value;
1054
- }
1055
- return '';
1056
- },
1057
- handlerCompositionstart: function handlerCompositionstart(e) {
1058
- this.isOnComposition = true;
1059
- },
1060
- handlerCompositionend: function handlerCompositionend(e) {
1061
- if (this.inputType === 'number' && this.isOnComposition) {
1062
- e.target.value = this.curValue;
1063
- this.isOnComposition = false;
1064
- this.handlerInput(e);
1065
- }
1066
- },
1067
- handlerInput: function handlerInput(event) {
1068
- var _this3 = this;
1069
- if (this.inputType === 'number' && this.isOnComposition) {
1070
- return;
1071
- }
1072
- this.$nextTick(function () {
1073
- var value = event.target.value;
1074
- _this3.setCurValue(value);
1075
- _this3.$emit('input', value, event);
1076
- _this3.$emit('change', value, event);
1077
- _this3.dispatch('bk-form-item', 'form-change');
1078
- });
1079
- },
1080
- handlerClear: function handlerClear(event) {
1081
- this.curValue = '';
1082
- this.$emit('input', this.curValue, event);
1083
- this.$emit('change', this.curValue, event);
1084
- this.$emit('clear', this.curValue, event);
1085
- this.dispatch('bk-form-item', 'form-change');
1086
- },
1087
- handlerLeftIcon: function handlerLeftIcon(event) {
1088
- this.$emit('left-icon-click', this.curValue, event);
1089
- },
1090
- handlerRightIcon: function handlerRightIcon(event) {
1091
- this.$emit('right-icon-click', this.curValue, event);
1092
- },
1093
- focus: function focus(event) {
1094
- if (this.type === 'textarea') {
1095
- this.$refs.textarea.focus();
1096
- } else {
1097
- this.$refs.input.focus();
1098
- }
1099
- },
1100
- blur: function blur(event) {
1101
- if (this.type === 'textarea') {
1102
- this.$refs.textarea.blur();
1103
- } else {
1104
- this.$refs.input.blur();
1105
- }
1106
- },
1107
- setCurValue: function setCurValue(val) {
1108
- if (val === this.curValue) {
1109
- return false;
1110
- }
1111
- this.curValue = val;
1112
- },
1113
- updateNumberValue: function updateNumberValue(val) {
1114
- if (val !== '' && /^number$/i.test(this.type) && /^-?\d*(.\d*)?$/i.test(val)) {
1115
- val = this.getCurrentNumberValue(val);
1116
- this.curValue = typeof this.precision === 'number' ? this.toPrecision(Number(val), this.precision) : Number(val);
1117
- }
1118
- },
1119
- togglePass: function togglePass() {
1120
- if (this.inputType === 'password') {
1121
- this.inputType = 'text';
1122
- } else {
1123
- this.inputType = 'password';
1124
- }
1125
- }
1126
- }
1127
- };
1128
-
1129
- function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier
1130
- , shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
1131
- if (typeof shadowMode !== 'boolean') {
1132
- createInjectorSSR = createInjector;
1133
- createInjector = shadowMode;
1134
- shadowMode = false;
1135
- }
1136
- var options = typeof script === 'function' ? script.options : script;
1137
- if (template && template.render) {
1138
- options.render = template.render;
1139
- options.staticRenderFns = template.staticRenderFns;
1140
- options._compiled = true;
1141
- if (isFunctionalTemplate) {
1142
- options.functional = true;
1143
- }
1144
- }
1145
- if (scopeId) {
1146
- options._scopeId = scopeId;
1147
- }
1148
- var hook;
1149
- if (moduleIdentifier) {
1150
- hook = function hook(context) {
1151
- context = context ||
1152
- this.$vnode && this.$vnode.ssrContext ||
1153
- this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
1154
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
1155
- context = __VUE_SSR_CONTEXT__;
1156
- }
1157
- if (style) {
1158
- style.call(this, createInjectorSSR(context));
1159
- }
1160
- if (context && context._registeredComponents) {
1161
- context._registeredComponents.add(moduleIdentifier);
1162
- }
1163
- };
1164
- options._ssrRegister = hook;
1165
- } else if (style) {
1166
- hook = shadowMode ? function () {
1167
- style.call(this, createInjectorShadow(this.$root.$options.shadowRoot));
1168
- } : function (context) {
1169
- style.call(this, createInjector(context));
1170
- };
1171
- }
1172
- if (hook) {
1173
- if (options.functional) {
1174
- var originalRender = options.render;
1175
- options.render = function renderWithStyleInjection(h, context) {
1176
- hook.call(context);
1177
- return originalRender(h, context);
1178
- };
1179
- } else {
1180
- var existing = options.beforeCreate;
1181
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
1182
- }
1183
- }
1184
- return script;
1185
- }
1186
- var normalizeComponent_1 = normalizeComponent;
1187
-
1188
- /* script */
1189
- var __vue_script__ = script;
1190
- /* template */
1191
- var __vue_render__ = function __vue_render__() {
1192
- var _vm = this;
1193
- var _h = _vm.$createElement;
1194
- var _c = _vm._self._c || _h;
1195
- return _c('div', {
1196
- class: [_vm.wrapperClass, _vm.fontSizeCls, _vm.extCls],
1197
- on: {
1198
- "mouseenter": function mouseenter($event) {
1199
- _vm.hover = true;
1200
- },
1201
- "mouseleave": function mouseleave($event) {
1202
- _vm.hover = false;
1203
- }
1204
- }
1205
- }, [_vm.leftIcon ? _c('div', {
1206
- staticClass: "control-icon left-icon",
1207
- on: {
1208
- "click": _vm.handlerLeftIcon
1209
- }
1210
- }, [_c('i', {
1211
- class: ['bk-icon', _vm.leftIcon]
1212
- })]) : _vm._e(), _vm.prepend ? _c('div', {
1213
- staticClass: "group-box group-prepend"
1214
- }, [_vm._t("prepend")], 2) : _vm._e(), _vm.inputType === 'textarea' ? [_c('div', {
1215
- staticClass: "bk-textarea-wrapper"
1216
- }, [_c('textarea', _vm._b({
1217
- ref: "textarea",
1218
- class: ['bk-form-textarea', {
1219
- 'textarea-maxlength': _vm.maxlength
1220
- }],
1221
- style: _vm.computedStyle,
1222
- on: {
1223
- "keyup": function keyup($event) {
1224
- if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")) {
1225
- return null;
1226
- }
1227
- return _vm.handlerEnter.apply(null, arguments);
1228
- },
1229
- "keypress": _vm.handlerKeypress,
1230
- "keydown": _vm.handlerKeydown,
1231
- "focus": _vm.handlerFocus,
1232
- "blur": _vm.handlerBlur,
1233
- "input": _vm.handlerInput,
1234
- "paste": _vm.handlerPaste
1235
- }
1236
- }, 'textarea', _vm.bindAttribute, false)), _vm.showInputWordLimit ? [_c('p', {
1237
- staticClass: "bk-limit-box"
1238
- }, [_c('span', {
1239
- staticClass: "strong"
1240
- }, [_vm._v(_vm._s(_vm.curValue && _vm.curValue.length || 0))]), _vm._v("/"), _c('span', [_vm._v(_vm._s(_vm.maxlength))])])] : _vm._e()], 2)] : [_c('div', {
1241
- class: ["bk-input-" + _vm.type]
1242
- }, [_c('input', _vm._b({
1243
- ref: "input",
1244
- class: ['bk-form-input', _vm.inputSizeCls, {
1245
- 'only-bottom-border': _vm.behavior === 'simplicity'
1246
- }],
1247
- style: _vm.computedStyle,
1248
- on: {
1249
- "keyup": [function ($event) {
1250
- if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")) {
1251
- return null;
1252
- }
1253
- return _vm.handlerEnter.apply(null, arguments);
1254
- }, _vm.handlerKeyup],
1255
- "keypress": _vm.handlerKeypress,
1256
- "keydown": _vm.handlerKeydown,
1257
- "focus": _vm.handlerFocus,
1258
- "blur": _vm.handlerBlur,
1259
- "input": _vm.handlerInput,
1260
- "paste": _vm.handlerPaste,
1261
- "compositionstart": _vm.handlerCompositionstart,
1262
- "compositionend": _vm.handlerCompositionend
1263
- }
1264
- }, 'input', _vm.bindAttribute, false)), /^number$/i.test(_vm.type) && !_vm.disabled && !_vm.readonly ? [_vm.showControls ? _c('span', {
1265
- staticClass: "input-number-option"
1266
- }, [_c('span', {
1267
- staticClass: "number-option-item bk-icon icon-angle-up",
1268
- on: {
1269
- "click": _vm.handleNumberAdd
1270
- }
1271
- }), _c('span', {
1272
- staticClass: "number-option-item bk-icon icon-angle-down",
1273
- on: {
1274
- "click": _vm.handleNumberDelete
1275
- }
1276
- })]) : _vm._e()] : _vm._e()], 2)], _vm.append ? _c('div', {
1277
- staticClass: "group-box group-append"
1278
- }, [_vm._t("append")], 2) : _vm._e(), !/^number$/i.test(_vm.type) ? _c('div', {
1279
- ref: "rightIconArea",
1280
- staticClass: "control-icon right-icon",
1281
- style: _vm.rightIconStyle,
1282
- on: {
1283
- "click": _vm.handlerRightIcon
1284
- }
1285
- }, [_vm.showPwdVisable ? _c('i', {
1286
- class: ['bk-icon', _vm.inputType === 'password' ? _vm.inputPasswordIcon[0] : _vm.inputPasswordIcon[1]],
1287
- on: {
1288
- "click": _vm.togglePass
1289
- }
1290
- }) : _vm._e(), _vm.showClearIcon ? _c('i', {
1291
- staticClass: "bk-icon icon-close-circle-shape clear-icon ml5 mr5",
1292
- on: {
1293
- "click": function click($event) {
1294
- $event.stopPropagation();
1295
- $event.preventDefault();
1296
- return _vm.handlerClear.apply(null, arguments);
1297
- }
1298
- }
1299
- }) : _vm._e(), _vm.rightIcon ? _c('i', {
1300
- class: ['input-right-icon', 'bk-icon', _vm.rightIcon]
1301
- }) : _vm._e(), _vm.type === 'text' ? [_c('p', {
1302
- directives: [{
1303
- name: "show",
1304
- rawName: "v-show",
1305
- value: _vm.showInputWordLimit,
1306
- expression: "showInputWordLimit"
1307
- }],
1308
- staticClass: "bk-limit-box ml5",
1309
- staticStyle: {
1310
- "position": "static"
1311
- }
1312
- }, [_c('span', {
1313
- staticClass: "strong"
1314
- }, [_vm._v(_vm._s(_vm.curValue && _vm.curValue.length || 0))]), _vm._v("/"), _c('span', [_vm._v(_vm._s(_vm.maxlength))])])] : _vm._e()], 2) : _vm._e()], 2);
1315
- };
1316
- var __vue_staticRenderFns__ = [];
1317
-
1318
- /* style */
1319
- var __vue_inject_styles__ = undefined;
1320
- /* scoped */
1321
- var __vue_scope_id__ = undefined;
1322
- /* module identifier */
1323
- var __vue_module_identifier__ = undefined;
1324
- /* functional template */
1325
- var __vue_is_functional_template__ = false;
1326
- /* style inject */
1327
-
1328
- /* style inject SSR */
1329
-
1330
- /* style inject shadow dom */
1331
-
1332
- var __vue_component__ = /*#__PURE__*/normalizeComponent_1({
1333
- render: __vue_render__,
1334
- staticRenderFns: __vue_staticRenderFns__
1335
- }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
1336
-
1337
541
  var _toObject = function (it) {
1338
542
  return Object(_defined(it));
1339
543
  };
@@ -1441,30 +645,6 @@
1441
645
 
1442
646
  var keys$1 = keys;
1443
647
 
1444
- function setInstaller (component, afterInstall) {
1445
- component.install = function (Vue) {
1446
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1447
- var props = component.props || {};
1448
- keys$1(options).forEach(function (key) {
1449
- if (props.hasOwnProperty(key)) {
1450
- if (typeof props[key] === 'function' || props[key] instanceof Array) {
1451
- props[key] = {
1452
- type: props[key],
1453
- default: options[key]
1454
- };
1455
- } else {
1456
- props[key].default = options[key];
1457
- }
1458
- }
1459
- });
1460
- component.name = options.namespace ? component.name.replace('bk', options.namespace) : component.name;
1461
- Vue.component(component.name, component);
1462
- typeof afterInstall === 'function' && afterInstall(Vue, options);
1463
- };
1464
- }
1465
-
1466
- setInstaller(__vue_component__);
1467
-
1468
648
  var f$1 = Object.getOwnPropertySymbols;
1469
649
  var _objectGops = {
1470
650
  f: f$1
@@ -2972,1010 +2152,2006 @@
2972
2152
  }, ms);
2973
2153
  };
2974
2154
  }
2975
- function getModifier(obj, key) {
2976
- return obj && obj.modifiers && obj.modifiers[key];
2155
+ function getModifier(obj, key) {
2156
+ return obj && obj.modifiers && obj.modifiers[key];
2157
+ }
2158
+ function includes(a, b) {
2159
+ return a.indexOf(b) > -1;
2160
+ }
2161
+ function isRealElement(value) {
2162
+ return value instanceof Element;
2163
+ }
2164
+ function isSingular(value) {
2165
+ return !!(value && hasOwnProperty$1(value, 'isVirtual')) || isRealElement(value);
2166
+ }
2167
+ function innerHTML() {
2168
+ return 'innerHTML';
2169
+ }
2170
+ function invokeWithArgsOrReturn(value, args) {
2171
+ return typeof value === 'function' ? value.apply(null, args) : value;
2172
+ }
2173
+ function setFlipModifierEnabled(modifiers, value) {
2174
+ modifiers.filter(function (m) {
2175
+ return m.name === 'flip';
2176
+ })[0].enabled = value;
2177
+ }
2178
+ function canReceiveFocus(element) {
2179
+ return isRealElement(element) ? matches.call(element, 'a[href],area[href],button,details,input,textarea,select,iframe,[tabindex]') && !element.hasAttribute('disabled') : true;
2180
+ }
2181
+ function div() {
2182
+ return document.createElement('div');
2183
+ }
2184
+ function setTransitionDuration(els, value) {
2185
+ els.forEach(function (el) {
2186
+ if (el) {
2187
+ el.style.transitionDuration = "".concat(value, "ms");
2188
+ }
2189
+ });
2190
+ }
2191
+ function setVisibilityState(els, state) {
2192
+ els.forEach(function (el) {
2193
+ if (el) {
2194
+ el.setAttribute('data-state', state);
2195
+ }
2196
+ });
2197
+ }
2198
+ function evaluateProps(reference, props) {
2199
+ var out = _extends$2({}, props, {
2200
+ content: invokeWithArgsOrReturn(props.content, [reference])
2201
+ }, props.ignoreAttributes ? {} : getDataAttributeOptions(reference));
2202
+ if (out.arrow || isUCBrowser) {
2203
+ out.animateFill = false;
2204
+ }
2205
+ return out;
2206
+ }
2207
+ function validateOptions(options, defaultProps) {
2208
+ keys$1(options).forEach(function (option) {
2209
+ if (!hasOwnProperty$1(defaultProps, option)) {
2210
+ throw new Error("[tippy]: `".concat(option, "` is not a valid option"));
2211
+ }
2212
+ });
2213
+ }
2214
+ function setInnerHTML(element, html) {
2215
+ element[innerHTML()] = isRealElement(html) ? html[innerHTML()] : html;
2216
+ }
2217
+ function setContent(contentEl, props) {
2218
+ if (isRealElement(props.content)) {
2219
+ setInnerHTML(contentEl, '');
2220
+ contentEl.appendChild(props.content);
2221
+ } else if (typeof props.content !== 'function') {
2222
+ var key = props.allowHTML ? 'innerHTML' : 'textContent';
2223
+ contentEl[key] = props.content;
2224
+ }
2225
+ }
2226
+ function getChildren(popper) {
2227
+ return {
2228
+ tooltip: popper.querySelector(TOOLTIP_SELECTOR),
2229
+ backdrop: popper.querySelector(BACKDROP_SELECTOR),
2230
+ content: popper.querySelector(CONTENT_SELECTOR),
2231
+ arrow: popper.querySelector(ARROW_SELECTOR) || popper.querySelector(ROUND_ARROW_SELECTOR)
2232
+ };
2233
+ }
2234
+ function addInertia(tooltip) {
2235
+ tooltip.setAttribute('data-inertia', '');
2236
+ }
2237
+ function removeInertia(tooltip) {
2238
+ tooltip.removeAttribute('data-inertia');
2239
+ }
2240
+ function createArrowElement(arrowType) {
2241
+ var arrow = div();
2242
+ if (arrowType === 'round') {
2243
+ arrow.className = ROUND_ARROW_CLASS;
2244
+ setInnerHTML(arrow, '<svg viewBox="0 0 18 7" xmlns="http://www.w3.org/2000/svg"><path d="M0 7s2.021-.015 5.253-4.218C6.584 1.051 7.797.007 9 0c1.203-.007 2.416 1.035 3.761 2.782C16.012 7.005 18 7 18 7H0z"/></svg>');
2245
+ } else {
2246
+ arrow.className = ARROW_CLASS;
2247
+ }
2248
+ return arrow;
2249
+ }
2250
+ function createBackdropElement() {
2251
+ var backdrop = div();
2252
+ backdrop.className = BACKDROP_CLASS;
2253
+ backdrop.setAttribute('data-state', 'hidden');
2254
+ return backdrop;
2977
2255
  }
2978
- function includes(a, b) {
2979
- return a.indexOf(b) > -1;
2256
+ function addInteractive(popper, tooltip) {
2257
+ popper.setAttribute('tabindex', '-1');
2258
+ tooltip.setAttribute('data-interactive', '');
2980
2259
  }
2981
- function isRealElement(value) {
2982
- return value instanceof Element;
2260
+ function removeInteractive(popper, tooltip) {
2261
+ popper.removeAttribute('tabindex');
2262
+ tooltip.removeAttribute('data-interactive');
2983
2263
  }
2984
- function isSingular(value) {
2985
- return !!(value && hasOwnProperty$1(value, 'isVirtual')) || isRealElement(value);
2264
+ function updateTransitionEndListener(tooltip, action, listener) {
2265
+ var eventName = isUCBrowser && document.body.style.webkitTransition !== undefined ? 'webkitTransitionEnd' : 'transitionend';
2266
+ tooltip[action + 'EventListener'](eventName, listener);
2986
2267
  }
2987
- function innerHTML() {
2988
- return 'innerHTML';
2268
+ function getBasicPlacement(popper) {
2269
+ var fullPlacement = popper.getAttribute(PLACEMENT_ATTRIBUTE);
2270
+ return fullPlacement ? fullPlacement.split('-')[0] : '';
2989
2271
  }
2990
- function invokeWithArgsOrReturn(value, args) {
2991
- return typeof value === 'function' ? value.apply(null, args) : value;
2272
+ function reflow(popper) {
2273
+ void popper.offsetHeight;
2992
2274
  }
2993
- function setFlipModifierEnabled(modifiers, value) {
2994
- modifiers.filter(function (m) {
2995
- return m.name === 'flip';
2996
- })[0].enabled = value;
2275
+ function updateTheme(tooltip, action, theme) {
2276
+ theme.split(' ').forEach(function (themeName) {
2277
+ tooltip.classList[action](themeName + '-theme');
2278
+ });
2997
2279
  }
2998
- function canReceiveFocus(element) {
2999
- return isRealElement(element) ? matches.call(element, 'a[href],area[href],button,details,input,textarea,select,iframe,[tabindex]') && !element.hasAttribute('disabled') : true;
2280
+ function setWidth(tooltip, props, key) {
2281
+ var width = props[key];
2282
+ var parsedWidth = _parseInt$2(width);
2283
+ if (typeof width === 'number') {
2284
+ tooltip.style[key] = width + 'px';
2285
+ } else if (isNaN(parsedWidth)) {
2286
+ tooltip.style[key] = width;
2287
+ } else {
2288
+ tooltip.style[key] = parsedWidth + 'px';
2289
+ }
3000
2290
  }
3001
- function div() {
3002
- return document.createElement('div');
2291
+ function createPopperElement(id, props) {
2292
+ var popper = div();
2293
+ popper.className = POPPER_CLASS + (props.extCls ? " ".concat(props.extCls) : '');
2294
+ popper.id = "tippy-".concat(id);
2295
+ popper.style.zIndex = '' + props.zIndex;
2296
+ popper.style.position = 'absolute';
2297
+ popper.style.top = '0';
2298
+ popper.style.left = '0';
2299
+ if (props.role) {
2300
+ popper.setAttribute('role', props.role);
2301
+ }
2302
+ var tooltip = div();
2303
+ tooltip.className = TOOLTIP_CLASS;
2304
+ setWidth(tooltip, props, 'maxWidth');
2305
+ setWidth(tooltip, props, 'width');
2306
+ tooltip.setAttribute('data-size', props.size);
2307
+ tooltip.setAttribute('data-animation', props.animation);
2308
+ tooltip.setAttribute('data-state', 'hidden');
2309
+ updateTheme(tooltip, 'add', props.theme);
2310
+ var content = div();
2311
+ content.className = CONTENT_CLASS;
2312
+ content.setAttribute('data-state', 'hidden');
2313
+ if (props.interactive) {
2314
+ addInteractive(popper, tooltip);
2315
+ }
2316
+ if (props.arrow) {
2317
+ tooltip.appendChild(createArrowElement(props.arrowType));
2318
+ }
2319
+ if (props.animateFill) {
2320
+ tooltip.appendChild(createBackdropElement());
2321
+ tooltip.setAttribute('data-animatefill', '');
2322
+ }
2323
+ if (props.inertia) {
2324
+ addInertia(tooltip);
2325
+ }
2326
+ setContent(content, props);
2327
+ tooltip.appendChild(content);
2328
+ popper.appendChild(tooltip);
2329
+ return popper;
3003
2330
  }
3004
- function setTransitionDuration(els, value) {
3005
- els.forEach(function (el) {
3006
- if (el) {
3007
- el.style.transitionDuration = "".concat(value, "ms");
3008
- }
3009
- });
2331
+ function updatePopperElement(popper, prevProps, nextProps) {
2332
+ var _getChildren = getChildren(popper),
2333
+ tooltip = _getChildren.tooltip,
2334
+ content = _getChildren.content,
2335
+ backdrop = _getChildren.backdrop,
2336
+ arrow = _getChildren.arrow;
2337
+ popper.style.zIndex = '' + nextProps.zIndex;
2338
+ tooltip.setAttribute('data-size', nextProps.size);
2339
+ tooltip.setAttribute('data-animation', nextProps.animation);
2340
+ tooltip.style.maxWidth = nextProps.maxWidth + (typeof nextProps.maxWidth === 'number' ? 'px' : '');
2341
+ if (nextProps.role) {
2342
+ popper.setAttribute('role', nextProps.role);
2343
+ } else {
2344
+ popper.removeAttribute('role');
2345
+ }
2346
+ if (prevProps.content !== nextProps.content) {
2347
+ setContent(content, nextProps);
2348
+ }
2349
+ if (!prevProps.animateFill && nextProps.animateFill) {
2350
+ tooltip.appendChild(createBackdropElement());
2351
+ tooltip.setAttribute('data-animatefill', '');
2352
+ } else if (prevProps.animateFill && !nextProps.animateFill) {
2353
+ tooltip.removeChild(backdrop);
2354
+ tooltip.removeAttribute('data-animatefill');
2355
+ }
2356
+ if (!prevProps.arrow && nextProps.arrow) {
2357
+ tooltip.appendChild(createArrowElement(nextProps.arrowType));
2358
+ } else if (prevProps.arrow && !nextProps.arrow) {
2359
+ tooltip.removeChild(arrow);
2360
+ }
2361
+ if (prevProps.arrow && nextProps.arrow && prevProps.arrowType !== nextProps.arrowType) {
2362
+ tooltip.replaceChild(createArrowElement(nextProps.arrowType), arrow);
2363
+ }
2364
+ if (!prevProps.interactive && nextProps.interactive) {
2365
+ addInteractive(popper, tooltip);
2366
+ } else if (prevProps.interactive && !nextProps.interactive) {
2367
+ removeInteractive(popper, tooltip);
2368
+ }
2369
+ if (!prevProps.inertia && nextProps.inertia) {
2370
+ addInertia(tooltip);
2371
+ } else if (prevProps.inertia && !nextProps.inertia) {
2372
+ removeInertia(tooltip);
2373
+ }
2374
+ if (prevProps.theme !== nextProps.theme) {
2375
+ updateTheme(tooltip, 'remove', prevProps.theme);
2376
+ updateTheme(tooltip, 'add', nextProps.theme);
2377
+ }
3010
2378
  }
3011
- function setVisibilityState(els, state) {
3012
- els.forEach(function (el) {
3013
- if (el) {
3014
- el.setAttribute('data-state', state);
2379
+ function hideAll() {
2380
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
2381
+ excludedReferenceOrInstance = _ref.exclude,
2382
+ duration = _ref.duration;
2383
+ arrayFrom(document.querySelectorAll(POPPER_SELECTOR)).forEach(function (popper) {
2384
+ var instance = popper._tippy;
2385
+ if (instance) {
2386
+ var isExcluded = false;
2387
+ if (excludedReferenceOrInstance) {
2388
+ isExcluded = isReferenceElement(excludedReferenceOrInstance) ? instance.reference === excludedReferenceOrInstance : popper === excludedReferenceOrInstance.popper;
2389
+ }
2390
+ if (!isExcluded) {
2391
+ instance.hide(duration);
2392
+ }
3015
2393
  }
3016
2394
  });
3017
2395
  }
3018
- function evaluateProps(reference, props) {
3019
- var out = _extends$2({}, props, {
3020
- content: invokeWithArgsOrReturn(props.content, [reference])
3021
- }, props.ignoreAttributes ? {} : getDataAttributeOptions(reference));
3022
- if (out.arrow || isUCBrowser) {
3023
- out.animateFill = false;
2396
+ function isCursorOutsideInteractiveBorder(popperPlacement, popperRect, event, props) {
2397
+ if (!popperPlacement) {
2398
+ return true;
3024
2399
  }
3025
- return out;
2400
+ var x = event.clientX,
2401
+ y = event.clientY;
2402
+ var interactiveBorder = props.interactiveBorder,
2403
+ distance = props.distance;
2404
+ var exceedsTop = popperRect.top - y > (popperPlacement === 'top' ? interactiveBorder + distance : interactiveBorder);
2405
+ var exceedsBottom = y - popperRect.bottom > (popperPlacement === 'bottom' ? interactiveBorder + distance : interactiveBorder);
2406
+ var exceedsLeft = popperRect.left - x > (popperPlacement === 'left' ? interactiveBorder + distance : interactiveBorder);
2407
+ var exceedsRight = x - popperRect.right > (popperPlacement === 'right' ? interactiveBorder + distance : interactiveBorder);
2408
+ return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;
3026
2409
  }
3027
- function validateOptions(options, defaultProps) {
3028
- keys$1(options).forEach(function (option) {
3029
- if (!hasOwnProperty$1(defaultProps, option)) {
3030
- throw new Error("[tippy]: `".concat(option, "` is not a valid option"));
2410
+ function getOffsetDistanceInPx(distance) {
2411
+ return -(distance - 10) + 'px';
2412
+ }
2413
+ var idCounter = 1;
2414
+ var mouseMoveListeners = [];
2415
+ function createTippy(reference, collectionProps) {
2416
+ var props = evaluateProps(reference, collectionProps);
2417
+ if (!props.multiple && reference._tippy) {
2418
+ return null;
2419
+ }
2420
+ var lastTriggerEventType;
2421
+ var lastMouseMoveEvent;
2422
+ var showTimeoutId;
2423
+ var hideTimeoutId;
2424
+ var scheduleHideAnimationFrameId;
2425
+ var isScheduledToShow = false;
2426
+ var isBeingDestroyed = false;
2427
+ var previousPlacement;
2428
+ var wasVisibleDuringPreviousUpdate = false;
2429
+ var hasMountCallbackRun = false;
2430
+ var currentMountCallback;
2431
+ var currentTransitionEndListener;
2432
+ var listeners = [];
2433
+ var currentComputedPadding;
2434
+ var debouncedOnMouseMove = debounce$1(onMouseMove, props.interactiveDebounce);
2435
+ var id = idCounter++;
2436
+ var popper = createPopperElement(id, props);
2437
+ var popperChildren = getChildren(popper);
2438
+ var popperInstance = null;
2439
+ var state = {
2440
+ isEnabled: true,
2441
+ isVisible: false,
2442
+ isDestroyed: false,
2443
+ isMounted: false,
2444
+ isShown: false
2445
+ };
2446
+ var instance = {
2447
+ id: id,
2448
+ reference: reference,
2449
+ popper: popper,
2450
+ popperChildren: popperChildren,
2451
+ popperInstance: popperInstance,
2452
+ props: props,
2453
+ state: state,
2454
+ clearDelayTimeouts: clearDelayTimeouts,
2455
+ set: set,
2456
+ setContent: setContent,
2457
+ show: show,
2458
+ hide: hide,
2459
+ enable: enable,
2460
+ disable: disable,
2461
+ destroy: destroy
2462
+ };
2463
+ reference._tippy = instance;
2464
+ popper._tippy = instance;
2465
+ addTriggersToReference();
2466
+ if (!props.lazy) {
2467
+ createPopperInstance();
2468
+ }
2469
+ if (props.showOnInit) {
2470
+ scheduleShow();
2471
+ }
2472
+ if (props.a11y && !props.target && !canReceiveFocus(getEventListenersTarget())) {
2473
+ getEventListenersTarget().setAttribute('tabindex', '0');
2474
+ }
2475
+ popper.addEventListener('mouseenter', function (event) {
2476
+ if (instance.props.interactive && instance.state.isVisible && lastTriggerEventType === 'mouseenter') {
2477
+ scheduleShow(event, true);
3031
2478
  }
3032
2479
  });
3033
- }
3034
- function setInnerHTML(element, html) {
3035
- element[innerHTML()] = isRealElement(html) ? html[innerHTML()] : html;
3036
- }
3037
- function setContent(contentEl, props) {
3038
- if (isRealElement(props.content)) {
3039
- setInnerHTML(contentEl, '');
3040
- contentEl.appendChild(props.content);
3041
- } else if (typeof props.content !== 'function') {
3042
- var key = props.allowHTML ? 'innerHTML' : 'textContent';
3043
- contentEl[key] = props.content;
2480
+ popper.addEventListener('mouseleave', function () {
2481
+ if (instance.props.interactive && lastTriggerEventType === 'mouseenter') {
2482
+ document.addEventListener('mousemove', debouncedOnMouseMove);
2483
+ }
2484
+ });
2485
+ return instance;
2486
+ function removeFollowCursorListener() {
2487
+ document.removeEventListener('mousemove', positionVirtualReferenceNearCursor);
3044
2488
  }
3045
- }
3046
- function getChildren(popper) {
3047
- return {
3048
- tooltip: popper.querySelector(TOOLTIP_SELECTOR),
3049
- backdrop: popper.querySelector(BACKDROP_SELECTOR),
3050
- content: popper.querySelector(CONTENT_SELECTOR),
3051
- arrow: popper.querySelector(ARROW_SELECTOR) || popper.querySelector(ROUND_ARROW_SELECTOR)
3052
- };
3053
- }
3054
- function addInertia(tooltip) {
3055
- tooltip.setAttribute('data-inertia', '');
3056
- }
3057
- function removeInertia(tooltip) {
3058
- tooltip.removeAttribute('data-inertia');
3059
- }
3060
- function createArrowElement(arrowType) {
3061
- var arrow = div();
3062
- if (arrowType === 'round') {
3063
- arrow.className = ROUND_ARROW_CLASS;
3064
- setInnerHTML(arrow, '<svg viewBox="0 0 18 7" xmlns="http://www.w3.org/2000/svg"><path d="M0 7s2.021-.015 5.253-4.218C6.584 1.051 7.797.007 9 0c1.203-.007 2.416 1.035 3.761 2.782C16.012 7.005 18 7 18 7H0z"/></svg>');
3065
- } else {
3066
- arrow.className = ARROW_CLASS;
2489
+ function cleanupInteractiveMouseListeners() {
2490
+ document.body.removeEventListener('mouseleave', scheduleHide);
2491
+ document.removeEventListener('mousemove', debouncedOnMouseMove);
2492
+ mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
2493
+ return listener !== debouncedOnMouseMove;
2494
+ });
3067
2495
  }
3068
- return arrow;
3069
- }
3070
- function createBackdropElement() {
3071
- var backdrop = div();
3072
- backdrop.className = BACKDROP_CLASS;
3073
- backdrop.setAttribute('data-state', 'hidden');
3074
- return backdrop;
3075
- }
3076
- function addInteractive(popper, tooltip) {
3077
- popper.setAttribute('tabindex', '-1');
3078
- tooltip.setAttribute('data-interactive', '');
3079
- }
3080
- function removeInteractive(popper, tooltip) {
3081
- popper.removeAttribute('tabindex');
3082
- tooltip.removeAttribute('data-interactive');
3083
- }
3084
- function updateTransitionEndListener(tooltip, action, listener) {
3085
- var eventName = isUCBrowser && document.body.style.webkitTransition !== undefined ? 'webkitTransitionEnd' : 'transitionend';
3086
- tooltip[action + 'EventListener'](eventName, listener);
3087
- }
3088
- function getBasicPlacement(popper) {
3089
- var fullPlacement = popper.getAttribute(PLACEMENT_ATTRIBUTE);
3090
- return fullPlacement ? fullPlacement.split('-')[0] : '';
3091
- }
3092
- function reflow(popper) {
3093
- void popper.offsetHeight;
3094
- }
3095
- function updateTheme(tooltip, action, theme) {
3096
- theme.split(' ').forEach(function (themeName) {
3097
- tooltip.classList[action](themeName + '-theme');
3098
- });
3099
- }
3100
- function setWidth(tooltip, props, key) {
3101
- var width = props[key];
3102
- var parsedWidth = _parseInt$2(width);
3103
- if (typeof width === 'number') {
3104
- tooltip.style[key] = width + 'px';
3105
- } else if (isNaN(parsedWidth)) {
3106
- tooltip.style[key] = width;
3107
- } else {
3108
- tooltip.style[key] = parsedWidth + 'px';
2496
+ function getEventListenersTarget() {
2497
+ return instance.props.triggerTarget || reference;
3109
2498
  }
3110
- }
3111
- function createPopperElement(id, props) {
3112
- var popper = div();
3113
- popper.className = POPPER_CLASS + (props.extCls ? " ".concat(props.extCls) : '');
3114
- popper.id = "tippy-".concat(id);
3115
- popper.style.zIndex = '' + props.zIndex;
3116
- popper.style.position = 'absolute';
3117
- popper.style.top = '0';
3118
- popper.style.left = '0';
3119
- if (props.role) {
3120
- popper.setAttribute('role', props.role);
2499
+ function addDocumentClickListener() {
2500
+ document.addEventListener('click', onDocumentClick, true);
3121
2501
  }
3122
- var tooltip = div();
3123
- tooltip.className = TOOLTIP_CLASS;
3124
- setWidth(tooltip, props, 'maxWidth');
3125
- setWidth(tooltip, props, 'width');
3126
- tooltip.setAttribute('data-size', props.size);
3127
- tooltip.setAttribute('data-animation', props.animation);
3128
- tooltip.setAttribute('data-state', 'hidden');
3129
- updateTheme(tooltip, 'add', props.theme);
3130
- var content = div();
3131
- content.className = CONTENT_CLASS;
3132
- content.setAttribute('data-state', 'hidden');
3133
- if (props.interactive) {
3134
- addInteractive(popper, tooltip);
2502
+ function removeDocumentClickListener() {
2503
+ document.removeEventListener('click', onDocumentClick, true);
3135
2504
  }
3136
- if (props.arrow) {
3137
- tooltip.appendChild(createArrowElement(props.arrowType));
2505
+ function getTransitionableElements() {
2506
+ return [instance.popperChildren.tooltip, instance.popperChildren.backdrop, instance.popperChildren.content];
3138
2507
  }
3139
- if (props.animateFill) {
3140
- tooltip.appendChild(createBackdropElement());
3141
- tooltip.setAttribute('data-animatefill', '');
2508
+ function getIsInLooseFollowCursorMode() {
2509
+ var followCursor = instance.props.followCursor;
2510
+ return followCursor && lastTriggerEventType !== 'focus' || isUsingTouch && followCursor === 'initial';
2511
+ }
2512
+ function makeSticky() {
2513
+ setTransitionDuration([popper], isIE$1 ? 0 : instance.props.updateDuration);
2514
+ function updatePosition() {
2515
+ instance.popperInstance.scheduleUpdate();
2516
+ if (instance.state.isMounted) {
2517
+ requestAnimationFrame(updatePosition);
2518
+ } else {
2519
+ setTransitionDuration([popper], 0);
2520
+ }
2521
+ }
2522
+ updatePosition();
2523
+ }
2524
+ function onTransitionedOut(duration, callback) {
2525
+ onTransitionEnd(duration, function () {
2526
+ if (!instance.state.isVisible && popper.parentNode && popper.parentNode.contains(popper)) {
2527
+ callback();
2528
+ }
2529
+ });
2530
+ }
2531
+ function onTransitionedIn(duration, callback) {
2532
+ onTransitionEnd(duration, callback);
2533
+ }
2534
+ function onTransitionEnd(duration, callback) {
2535
+ var tooltip = instance.popperChildren.tooltip;
2536
+ function listener(event) {
2537
+ if (event.target === tooltip) {
2538
+ updateTransitionEndListener(tooltip, 'remove', listener);
2539
+ callback();
2540
+ }
2541
+ }
2542
+ if (duration === 0) {
2543
+ return callback();
2544
+ }
2545
+ updateTransitionEndListener(tooltip, 'remove', currentTransitionEndListener);
2546
+ updateTransitionEndListener(tooltip, 'add', listener);
2547
+ currentTransitionEndListener = listener;
2548
+ }
2549
+ function on(eventType, handler) {
2550
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2551
+ getEventListenersTarget().addEventListener(eventType, handler, options);
2552
+ listeners.push({
2553
+ eventType: eventType,
2554
+ handler: handler,
2555
+ options: options
2556
+ });
2557
+ }
2558
+ function addTriggersToReference() {
2559
+ if (instance.props.touchHold && !instance.props.target) {
2560
+ on('touchstart', onTrigger, PASSIVE);
2561
+ on('touchend', onMouseLeave, PASSIVE);
2562
+ }
2563
+ instance.props.trigger.trim().split(' ').forEach(function (eventType) {
2564
+ if (eventType === 'manual') {
2565
+ return;
2566
+ }
2567
+ if (!instance.props.target) {
2568
+ on(eventType, onTrigger);
2569
+ switch (eventType) {
2570
+ case 'mouseenter':
2571
+ on('mouseleave', onMouseLeave);
2572
+ break;
2573
+ case 'focus':
2574
+ on(isIE$1 ? 'focusout' : 'blur', onBlur);
2575
+ break;
2576
+ }
2577
+ } else {
2578
+ switch (eventType) {
2579
+ case 'mouseenter':
2580
+ on('mouseover', onDelegateShow);
2581
+ on('mouseout', onDelegateHide);
2582
+ break;
2583
+ case 'focus':
2584
+ on('focusin', onDelegateShow);
2585
+ on('focusout', onDelegateHide);
2586
+ break;
2587
+ case 'click':
2588
+ on(eventType, onDelegateShow);
2589
+ break;
2590
+ }
2591
+ }
2592
+ });
2593
+ }
2594
+ function removeTriggersFromReference() {
2595
+ listeners.forEach(function (_ref) {
2596
+ var eventType = _ref.eventType,
2597
+ handler = _ref.handler,
2598
+ options = _ref.options;
2599
+ getEventListenersTarget().removeEventListener(eventType, handler, options);
2600
+ });
2601
+ listeners = [];
2602
+ }
2603
+ function positionVirtualReferenceNearCursor(event) {
2604
+ var _lastMouseMoveEvent = lastMouseMoveEvent = event,
2605
+ x = _lastMouseMoveEvent.clientX,
2606
+ y = _lastMouseMoveEvent.clientY;
2607
+ if (!currentComputedPadding) {
2608
+ return;
2609
+ }
2610
+ var isCursorOverReference = closestCallback(event.target, function (el) {
2611
+ return el === reference;
2612
+ });
2613
+ var rect = reference.getBoundingClientRect();
2614
+ var followCursor = instance.props.followCursor;
2615
+ var isHorizontal = followCursor === 'horizontal';
2616
+ var isVertical = followCursor === 'vertical';
2617
+ var isVerticalPlacement = includes(['top', 'bottom'], getBasicPlacement(popper));
2618
+ var fullPlacement = popper.getAttribute(PLACEMENT_ATTRIBUTE);
2619
+ var isVariation = fullPlacement ? !!fullPlacement.split('-')[1] : false;
2620
+ var size = isVerticalPlacement ? popper.offsetWidth : popper.offsetHeight;
2621
+ var halfSize = size / 2;
2622
+ var verticalIncrease = isVerticalPlacement ? 0 : isVariation ? size : halfSize;
2623
+ var horizontalIncrease = isVerticalPlacement ? isVariation ? size : halfSize : 0;
2624
+ if (isCursorOverReference || !instance.props.interactive) {
2625
+ instance.popperInstance.reference = _extends$2({}, instance.popperInstance.reference, {
2626
+ clientWidth: 0,
2627
+ clientHeight: 0,
2628
+ getBoundingClientRect: function getBoundingClientRect() {
2629
+ return {
2630
+ width: isVerticalPlacement ? size : 0,
2631
+ height: isVerticalPlacement ? 0 : size,
2632
+ top: (isHorizontal ? rect.top : y) - verticalIncrease,
2633
+ bottom: (isHorizontal ? rect.bottom : y) + verticalIncrease,
2634
+ left: (isVertical ? rect.left : x) - horizontalIncrease,
2635
+ right: (isVertical ? rect.right : x) + horizontalIncrease
2636
+ };
2637
+ }
2638
+ });
2639
+ instance.popperInstance.update();
2640
+ }
2641
+ if (followCursor === 'initial' && instance.state.isVisible) {
2642
+ removeFollowCursorListener();
2643
+ }
3142
2644
  }
3143
- if (props.inertia) {
3144
- addInertia(tooltip);
2645
+ function createDelegateChildTippy(event) {
2646
+ if (event) {
2647
+ var targetEl = closest(event.target, instance.props.target);
2648
+ if (targetEl && !targetEl._tippy) {
2649
+ createTippy(targetEl, _extends$2({}, instance.props, {
2650
+ content: invokeWithArgsOrReturn(collectionProps.content, [targetEl]),
2651
+ appendTo: collectionProps.appendTo,
2652
+ target: '',
2653
+ showOnInit: true
2654
+ }));
2655
+ }
2656
+ }
3145
2657
  }
3146
- setContent(content, props);
3147
- tooltip.appendChild(content);
3148
- popper.appendChild(tooltip);
3149
- return popper;
3150
- }
3151
- function updatePopperElement(popper, prevProps, nextProps) {
3152
- var _getChildren = getChildren(popper),
3153
- tooltip = _getChildren.tooltip,
3154
- content = _getChildren.content,
3155
- backdrop = _getChildren.backdrop,
3156
- arrow = _getChildren.arrow;
3157
- popper.style.zIndex = '' + nextProps.zIndex;
3158
- tooltip.setAttribute('data-size', nextProps.size);
3159
- tooltip.setAttribute('data-animation', nextProps.animation);
3160
- tooltip.style.maxWidth = nextProps.maxWidth + (typeof nextProps.maxWidth === 'number' ? 'px' : '');
3161
- if (nextProps.role) {
3162
- popper.setAttribute('role', nextProps.role);
3163
- } else {
3164
- popper.removeAttribute('role');
2658
+ function onTrigger(event) {
2659
+ if (!instance.state.isEnabled || isEventListenerStopped(event)) {
2660
+ return;
2661
+ }
2662
+ if (!instance.state.isVisible) {
2663
+ lastTriggerEventType = event.type;
2664
+ if (event instanceof MouseEvent) {
2665
+ lastMouseMoveEvent = event;
2666
+ mouseMoveListeners.forEach(function (listener) {
2667
+ return listener(event);
2668
+ });
2669
+ }
2670
+ }
2671
+ if (event.type === 'click' && instance.props.hideOnClick !== false && instance.state.isVisible) {
2672
+ scheduleHide();
2673
+ } else {
2674
+ scheduleShow(event);
2675
+ }
3165
2676
  }
3166
- if (prevProps.content !== nextProps.content) {
3167
- setContent(content, nextProps);
2677
+ function onMouseMove(event) {
2678
+ var isCursorOverPopper = closest(event.target, POPPER_SELECTOR) === popper;
2679
+ var isCursorOverReference = closestCallback(event.target, function (el) {
2680
+ return el === reference;
2681
+ });
2682
+ if (isCursorOverPopper || isCursorOverReference) {
2683
+ return;
2684
+ }
2685
+ if (isCursorOutsideInteractiveBorder(getBasicPlacement(popper), popper.getBoundingClientRect(), event, instance.props)) {
2686
+ cleanupInteractiveMouseListeners();
2687
+ scheduleHide();
2688
+ }
3168
2689
  }
3169
- if (!prevProps.animateFill && nextProps.animateFill) {
3170
- tooltip.appendChild(createBackdropElement());
3171
- tooltip.setAttribute('data-animatefill', '');
3172
- } else if (prevProps.animateFill && !nextProps.animateFill) {
3173
- tooltip.removeChild(backdrop);
3174
- tooltip.removeAttribute('data-animatefill');
2690
+ function onMouseLeave(event) {
2691
+ if (isEventListenerStopped(event)) {
2692
+ return;
2693
+ }
2694
+ if (instance.props.interactive) {
2695
+ document.body.addEventListener('mouseleave', scheduleHide);
2696
+ document.addEventListener('mousemove', debouncedOnMouseMove);
2697
+ mouseMoveListeners.push(debouncedOnMouseMove);
2698
+ return;
2699
+ }
2700
+ scheduleHide();
3175
2701
  }
3176
- if (!prevProps.arrow && nextProps.arrow) {
3177
- tooltip.appendChild(createArrowElement(nextProps.arrowType));
3178
- } else if (prevProps.arrow && !nextProps.arrow) {
3179
- tooltip.removeChild(arrow);
2702
+ function onBlur(event) {
2703
+ if (event.target !== getEventListenersTarget()) {
2704
+ return;
2705
+ }
2706
+ if (instance.props.interactive && event.relatedTarget && popper.contains(event.relatedTarget)) {
2707
+ return;
2708
+ }
2709
+ scheduleHide();
3180
2710
  }
3181
- if (prevProps.arrow && nextProps.arrow && prevProps.arrowType !== nextProps.arrowType) {
3182
- tooltip.replaceChild(createArrowElement(nextProps.arrowType), arrow);
2711
+ function onDelegateShow(event) {
2712
+ if (closest(event.target, instance.props.target)) {
2713
+ scheduleShow(event);
2714
+ }
3183
2715
  }
3184
- if (!prevProps.interactive && nextProps.interactive) {
3185
- addInteractive(popper, tooltip);
3186
- } else if (prevProps.interactive && !nextProps.interactive) {
3187
- removeInteractive(popper, tooltip);
2716
+ function onDelegateHide(event) {
2717
+ if (closest(event.target, instance.props.target)) {
2718
+ scheduleHide();
2719
+ }
3188
2720
  }
3189
- if (!prevProps.inertia && nextProps.inertia) {
3190
- addInertia(tooltip);
3191
- } else if (prevProps.inertia && !nextProps.inertia) {
3192
- removeInertia(tooltip);
2721
+ function isEventListenerStopped(event) {
2722
+ var supportsTouch = ('ontouchstart' in window);
2723
+ var isTouchEvent = includes(event.type, 'touch');
2724
+ var touchHold = instance.props.touchHold;
2725
+ return supportsTouch && isUsingTouch && touchHold && !isTouchEvent || isUsingTouch && !touchHold && isTouchEvent;
3193
2726
  }
3194
- if (prevProps.theme !== nextProps.theme) {
3195
- updateTheme(tooltip, 'remove', prevProps.theme);
3196
- updateTheme(tooltip, 'add', nextProps.theme);
2727
+ function runMountCallback() {
2728
+ if (!hasMountCallbackRun && currentMountCallback) {
2729
+ hasMountCallbackRun = true;
2730
+ reflow(popper);
2731
+ currentMountCallback();
2732
+ }
3197
2733
  }
3198
- }
3199
- function hideAll() {
3200
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
3201
- excludedReferenceOrInstance = _ref.exclude,
3202
- duration = _ref.duration;
3203
- arrayFrom(document.querySelectorAll(POPPER_SELECTOR)).forEach(function (popper) {
3204
- var instance = popper._tippy;
3205
- if (instance) {
3206
- var isExcluded = false;
3207
- if (excludedReferenceOrInstance) {
3208
- isExcluded = isReferenceElement(excludedReferenceOrInstance) ? instance.reference === excludedReferenceOrInstance : popper === excludedReferenceOrInstance.popper;
2734
+ function createPopperInstance() {
2735
+ var popperOptions = instance.props.popperOptions;
2736
+ var _instance$popperChild = instance.popperChildren,
2737
+ tooltip = _instance$popperChild.tooltip,
2738
+ arrow = _instance$popperChild.arrow;
2739
+ var preventOverflowModifier = getModifier(popperOptions, 'preventOverflow');
2740
+ function applyMutations(data) {
2741
+ if (instance.props.flip && !instance.props.flipOnUpdate) {
2742
+ if (data.flipped) {
2743
+ instance.popperInstance.options.placement = data.placement;
2744
+ }
2745
+ setFlipModifierEnabled(instance.popperInstance.modifiers, false);
3209
2746
  }
3210
- if (!isExcluded) {
3211
- instance.hide(duration);
2747
+ tooltip.setAttribute(PLACEMENT_ATTRIBUTE, data.placement);
2748
+ if (data.attributes[OUT_OF_BOUNDARIES_ATTRIBUTE] !== false) {
2749
+ tooltip.setAttribute(OUT_OF_BOUNDARIES_ATTRIBUTE, '');
2750
+ } else {
2751
+ tooltip.removeAttribute(OUT_OF_BOUNDARIES_ATTRIBUTE);
3212
2752
  }
3213
- }
3214
- });
3215
- }
3216
- function isCursorOutsideInteractiveBorder(popperPlacement, popperRect, event, props) {
3217
- if (!popperPlacement) {
3218
- return true;
3219
- }
3220
- var x = event.clientX,
3221
- y = event.clientY;
3222
- var interactiveBorder = props.interactiveBorder,
3223
- distance = props.distance;
3224
- var exceedsTop = popperRect.top - y > (popperPlacement === 'top' ? interactiveBorder + distance : interactiveBorder);
3225
- var exceedsBottom = y - popperRect.bottom > (popperPlacement === 'bottom' ? interactiveBorder + distance : interactiveBorder);
3226
- var exceedsLeft = popperRect.left - x > (popperPlacement === 'left' ? interactiveBorder + distance : interactiveBorder);
3227
- var exceedsRight = x - popperRect.right > (popperPlacement === 'right' ? interactiveBorder + distance : interactiveBorder);
3228
- return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;
3229
- }
3230
- function getOffsetDistanceInPx(distance) {
3231
- return -(distance - 10) + 'px';
3232
- }
3233
- var idCounter = 1;
3234
- var mouseMoveListeners = [];
3235
- function createTippy(reference, collectionProps) {
3236
- var props = evaluateProps(reference, collectionProps);
3237
- if (!props.multiple && reference._tippy) {
3238
- return null;
3239
- }
3240
- var lastTriggerEventType;
3241
- var lastMouseMoveEvent;
3242
- var showTimeoutId;
3243
- var hideTimeoutId;
3244
- var scheduleHideAnimationFrameId;
3245
- var isScheduledToShow = false;
3246
- var isBeingDestroyed = false;
3247
- var previousPlacement;
3248
- var wasVisibleDuringPreviousUpdate = false;
3249
- var hasMountCallbackRun = false;
3250
- var currentMountCallback;
3251
- var currentTransitionEndListener;
3252
- var listeners = [];
3253
- var currentComputedPadding;
3254
- var debouncedOnMouseMove = debounce$1(onMouseMove, props.interactiveDebounce);
3255
- var id = idCounter++;
3256
- var popper = createPopperElement(id, props);
3257
- var popperChildren = getChildren(popper);
3258
- var popperInstance = null;
3259
- var state = {
3260
- isEnabled: true,
3261
- isVisible: false,
3262
- isDestroyed: false,
3263
- isMounted: false,
3264
- isShown: false
3265
- };
3266
- var instance = {
3267
- id: id,
3268
- reference: reference,
3269
- popper: popper,
3270
- popperChildren: popperChildren,
3271
- popperInstance: popperInstance,
3272
- props: props,
3273
- state: state,
3274
- clearDelayTimeouts: clearDelayTimeouts,
3275
- set: set,
3276
- setContent: setContent,
3277
- show: show,
3278
- hide: hide,
3279
- enable: enable,
3280
- disable: disable,
3281
- destroy: destroy
3282
- };
3283
- reference._tippy = instance;
3284
- popper._tippy = instance;
3285
- addTriggersToReference();
3286
- if (!props.lazy) {
3287
- createPopperInstance();
3288
- }
3289
- if (props.showOnInit) {
3290
- scheduleShow();
3291
- }
3292
- if (props.a11y && !props.target && !canReceiveFocus(getEventListenersTarget())) {
3293
- getEventListenersTarget().setAttribute('tabindex', '0');
2753
+ if (previousPlacement && previousPlacement !== data.placement && wasVisibleDuringPreviousUpdate) {
2754
+ tooltip.style.transition = 'none';
2755
+ requestAnimationFrame(function () {
2756
+ tooltip.style.transition = '';
2757
+ });
2758
+ }
2759
+ previousPlacement = data.placement;
2760
+ wasVisibleDuringPreviousUpdate = instance.state.isVisible;
2761
+ var basicPlacement = getBasicPlacement(popper);
2762
+ var styles = tooltip.style;
2763
+ styles.top = styles.bottom = styles.left = styles.right = '';
2764
+ styles[basicPlacement] = getOffsetDistanceInPx(instance.props.distance);
2765
+ var padding = preventOverflowModifier && preventOverflowModifier.padding !== undefined ? preventOverflowModifier.padding : PADDING;
2766
+ var isPaddingNumber = typeof padding === 'number';
2767
+ var computedPadding = _extends$2({
2768
+ top: isPaddingNumber ? padding : padding.top,
2769
+ bottom: isPaddingNumber ? padding : padding.bottom,
2770
+ left: isPaddingNumber ? padding : padding.left,
2771
+ right: isPaddingNumber ? padding : padding.right
2772
+ }, !isPaddingNumber && padding);
2773
+ computedPadding[basicPlacement] = isPaddingNumber ? padding + instance.props.distance : (padding[basicPlacement] || 0) + instance.props.distance;
2774
+ instance.popperInstance.modifiers.filter(function (m) {
2775
+ return m.name === 'preventOverflow';
2776
+ })[0].padding = computedPadding;
2777
+ currentComputedPadding = computedPadding;
2778
+ }
2779
+ var config = _extends$2({
2780
+ eventsEnabled: false,
2781
+ placement: instance.props.placement
2782
+ }, popperOptions, {
2783
+ modifiers: _extends$2({}, popperOptions ? popperOptions.modifiers : {}, {
2784
+ preventOverflow: _extends$2({
2785
+ boundariesElement: instance.props.boundary,
2786
+ padding: PADDING
2787
+ }, preventOverflowModifier),
2788
+ arrow: _extends$2({
2789
+ element: arrow,
2790
+ enabled: !!arrow
2791
+ }, getModifier(popperOptions, 'arrow')),
2792
+ flip: _extends$2({
2793
+ enabled: instance.props.flip,
2794
+ padding: instance.props.distance + PADDING,
2795
+ behavior: instance.props.flipBehavior
2796
+ }, getModifier(popperOptions, 'flip')),
2797
+ offset: _extends$2({
2798
+ offset: instance.props.offset
2799
+ }, getModifier(popperOptions, 'offset'))
2800
+ }),
2801
+ onCreate: function onCreate(data) {
2802
+ applyMutations(data);
2803
+ runMountCallback();
2804
+ if (popperOptions && popperOptions.onCreate) {
2805
+ popperOptions.onCreate(data);
2806
+ }
2807
+ },
2808
+ onUpdate: function onUpdate(data) {
2809
+ applyMutations(data);
2810
+ runMountCallback();
2811
+ if (popperOptions && popperOptions.onUpdate) {
2812
+ popperOptions.onUpdate(data);
2813
+ }
2814
+ }
2815
+ });
2816
+ instance.popperInstance = new Popper(reference, popper, config);
3294
2817
  }
3295
- popper.addEventListener('mouseenter', function (event) {
3296
- if (instance.props.interactive && instance.state.isVisible && lastTriggerEventType === 'mouseenter') {
3297
- scheduleShow(event, true);
2818
+ function mount() {
2819
+ hasMountCallbackRun = false;
2820
+ var isInLooseFollowCursorMode = getIsInLooseFollowCursorMode();
2821
+ if (instance.popperInstance) {
2822
+ setFlipModifierEnabled(instance.popperInstance.modifiers, instance.props.flip);
2823
+ if (!isInLooseFollowCursorMode) {
2824
+ instance.popperInstance.reference = reference;
2825
+ instance.popperInstance.enableEventListeners();
2826
+ }
2827
+ instance.popperInstance.scheduleUpdate();
2828
+ } else {
2829
+ createPopperInstance();
2830
+ if (!isInLooseFollowCursorMode) {
2831
+ instance.popperInstance.enableEventListeners();
2832
+ }
3298
2833
  }
3299
- });
3300
- popper.addEventListener('mouseleave', function () {
3301
- if (instance.props.interactive && lastTriggerEventType === 'mouseenter') {
3302
- document.addEventListener('mousemove', debouncedOnMouseMove);
2834
+ var appendTo = instance.props.appendTo;
2835
+ var parentNode = appendTo === 'parent' ? reference.parentNode : invokeWithArgsOrReturn(appendTo, [reference]);
2836
+ if (!parentNode.contains(popper)) {
2837
+ parentNode.appendChild(popper);
2838
+ instance.props.onMount(instance);
2839
+ instance.state.isMounted = true;
3303
2840
  }
3304
- });
3305
- return instance;
3306
- function removeFollowCursorListener() {
3307
- document.removeEventListener('mousemove', positionVirtualReferenceNearCursor);
3308
2841
  }
3309
- function cleanupInteractiveMouseListeners() {
3310
- document.body.removeEventListener('mouseleave', scheduleHide);
3311
- document.removeEventListener('mousemove', debouncedOnMouseMove);
3312
- mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
3313
- return listener !== debouncedOnMouseMove;
3314
- });
2842
+ function scheduleShow(event, shouldAvoidCallingOnTrigger) {
2843
+ clearDelayTimeouts();
2844
+ if (instance.state.isVisible) {
2845
+ return;
2846
+ }
2847
+ if (instance.props.target) {
2848
+ return createDelegateChildTippy(event);
2849
+ }
2850
+ isScheduledToShow = true;
2851
+ if (event && !shouldAvoidCallingOnTrigger) {
2852
+ instance.props.onTrigger(instance, event);
2853
+ }
2854
+ if (instance.props.wait) {
2855
+ return instance.props.wait(instance, event);
2856
+ }
2857
+ if (getIsInLooseFollowCursorMode() && !instance.state.isMounted) {
2858
+ if (!instance.popperInstance) {
2859
+ createPopperInstance();
2860
+ }
2861
+ document.addEventListener('mousemove', positionVirtualReferenceNearCursor);
2862
+ }
2863
+ addDocumentClickListener();
2864
+ var delay = getValue(instance.props.delay, 0, defaultProps.delay);
2865
+ if (delay) {
2866
+ showTimeoutId = setTimeout(function () {
2867
+ show();
2868
+ }, delay);
2869
+ } else {
2870
+ show();
2871
+ }
3315
2872
  }
3316
- function getEventListenersTarget() {
3317
- return instance.props.triggerTarget || reference;
2873
+ function scheduleHide() {
2874
+ clearDelayTimeouts();
2875
+ if (!instance.state.isVisible) {
2876
+ return removeFollowCursorListener();
2877
+ }
2878
+ isScheduledToShow = false;
2879
+ var delay = getValue(instance.props.delay, 1, defaultProps.delay);
2880
+ if (delay) {
2881
+ hideTimeoutId = setTimeout(function () {
2882
+ if (instance.state.isVisible) {
2883
+ hide();
2884
+ }
2885
+ }, delay);
2886
+ } else {
2887
+ scheduleHideAnimationFrameId = requestAnimationFrame(function () {
2888
+ hide();
2889
+ });
2890
+ }
3318
2891
  }
3319
- function addDocumentClickListener() {
3320
- document.addEventListener('click', onDocumentClick, true);
2892
+ function onDocumentClick(event) {
2893
+ if (instance.props.interactive && popper.contains(event.target)) {
2894
+ return;
2895
+ }
2896
+ if (getEventListenersTarget().contains(event.target)) {
2897
+ if (isUsingTouch) {
2898
+ return;
2899
+ }
2900
+ if (instance.state.isVisible && includes(instance.props.trigger, 'click')) {
2901
+ return;
2902
+ }
2903
+ }
2904
+ if (instance.props.hideOnClick === true) {
2905
+ clearDelayTimeouts();
2906
+ hide();
2907
+ }
3321
2908
  }
3322
- function removeDocumentClickListener() {
3323
- document.removeEventListener('click', onDocumentClick, true);
2909
+ function enable() {
2910
+ instance.state.isEnabled = true;
3324
2911
  }
3325
- function getTransitionableElements() {
3326
- return [instance.popperChildren.tooltip, instance.popperChildren.backdrop, instance.popperChildren.content];
2912
+ function disable() {
2913
+ instance.state.isEnabled = false;
3327
2914
  }
3328
- function getIsInLooseFollowCursorMode() {
3329
- var followCursor = instance.props.followCursor;
3330
- return followCursor && lastTriggerEventType !== 'focus' || isUsingTouch && followCursor === 'initial';
2915
+ function clearDelayTimeouts() {
2916
+ clearTimeout(showTimeoutId);
2917
+ clearTimeout(hideTimeoutId);
2918
+ cancelAnimationFrame(scheduleHideAnimationFrameId);
3331
2919
  }
3332
- function makeSticky() {
3333
- setTransitionDuration([popper], isIE$1 ? 0 : instance.props.updateDuration);
3334
- function updatePosition() {
3335
- instance.popperInstance.scheduleUpdate();
3336
- if (instance.state.isMounted) {
3337
- requestAnimationFrame(updatePosition);
2920
+ function set(options) {
2921
+ options = options || {};
2922
+ validateOptions(options, defaultProps);
2923
+ removeTriggersFromReference();
2924
+ var prevProps = instance.props;
2925
+ var nextProps = evaluateProps(reference, _extends$2({}, instance.props, options, {
2926
+ ignoreAttributes: true
2927
+ }));
2928
+ nextProps.ignoreAttributes = hasOwnProperty$1(options, 'ignoreAttributes') ? options.ignoreAttributes || false : prevProps.ignoreAttributes;
2929
+ instance.props = nextProps;
2930
+ addTriggersToReference();
2931
+ cleanupInteractiveMouseListeners();
2932
+ debouncedOnMouseMove = debounce$1(onMouseMove, nextProps.interactiveDebounce);
2933
+ updatePopperElement(popper, prevProps, nextProps);
2934
+ instance.popperChildren = getChildren(popper);
2935
+ if (instance.popperInstance) {
2936
+ if (POPPER_INSTANCE_DEPENDENCIES.some(function (prop) {
2937
+ return hasOwnProperty$1(options, prop) && options[prop] !== prevProps[prop];
2938
+ })) {
2939
+ instance.popperInstance.destroy();
2940
+ createPopperInstance();
2941
+ if (instance.state.isVisible) {
2942
+ instance.popperInstance.enableEventListeners();
2943
+ }
2944
+ if (instance.props.followCursor && lastMouseMoveEvent) {
2945
+ positionVirtualReferenceNearCursor(lastMouseMoveEvent);
2946
+ }
3338
2947
  } else {
3339
- setTransitionDuration([popper], 0);
2948
+ instance.popperInstance.update();
3340
2949
  }
3341
2950
  }
3342
- updatePosition();
3343
2951
  }
3344
- function onTransitionedOut(duration, callback) {
3345
- onTransitionEnd(duration, function () {
3346
- if (!instance.state.isVisible && popper.parentNode && popper.parentNode.contains(popper)) {
3347
- callback();
3348
- }
2952
+ function setContent(content) {
2953
+ set({
2954
+ content: content
3349
2955
  });
3350
2956
  }
3351
- function onTransitionedIn(duration, callback) {
3352
- onTransitionEnd(duration, callback);
3353
- }
3354
- function onTransitionEnd(duration, callback) {
3355
- var tooltip = instance.popperChildren.tooltip;
3356
- function listener(event) {
3357
- if (event.target === tooltip) {
3358
- updateTransitionEndListener(tooltip, 'remove', listener);
3359
- callback();
2957
+ function show() {
2958
+ var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getValue(instance.props.duration, 0, defaultProps.duration[1]);
2959
+ if (instance.state.isDestroyed || !instance.state.isEnabled || isUsingTouch && !instance.props.touch) {
2960
+ return;
2961
+ }
2962
+ if (getEventListenersTarget().hasAttribute('disabled')) {
2963
+ return;
2964
+ }
2965
+ if (instance.props.onShow(instance) === false) {
2966
+ return;
2967
+ }
2968
+ addDocumentClickListener();
2969
+ popper.style.visibility = 'visible';
2970
+ instance.state.isVisible = true;
2971
+ if (instance.props.interactive) {
2972
+ getEventListenersTarget().classList.add(ACTIVE_CLASS);
2973
+ }
2974
+ var transitionableElements = getTransitionableElements();
2975
+ setTransitionDuration(transitionableElements.concat(popper), 0);
2976
+ currentMountCallback = function currentMountCallback() {
2977
+ if (!instance.state.isVisible) {
2978
+ return;
2979
+ }
2980
+ var isInLooseFollowCursorMode = getIsInLooseFollowCursorMode();
2981
+ if (isInLooseFollowCursorMode && lastMouseMoveEvent) {
2982
+ positionVirtualReferenceNearCursor(lastMouseMoveEvent);
2983
+ } else if (!isInLooseFollowCursorMode) {
2984
+ instance.popperInstance.update();
2985
+ }
2986
+ if (instance.popperChildren.backdrop) {
2987
+ instance.popperChildren.content.style.transitionDelay = Math.round(duration / 12) + 'ms';
2988
+ }
2989
+ if (instance.props.sticky) {
2990
+ makeSticky();
3360
2991
  }
2992
+ setTransitionDuration([popper], instance.props.updateDuration);
2993
+ setTransitionDuration(transitionableElements, duration);
2994
+ setVisibilityState(transitionableElements, 'visible');
2995
+ onTransitionedIn(duration, function () {
2996
+ if (instance.props.aria) {
2997
+ getEventListenersTarget().setAttribute("aria-".concat(instance.props.aria), popper.id);
2998
+ }
2999
+ instance.props.onShown(instance);
3000
+ instance.state.isShown = true;
3001
+ });
3002
+ };
3003
+ mount();
3004
+ }
3005
+ function hide() {
3006
+ var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getValue(instance.props.duration, 1, defaultProps.duration[1]);
3007
+ if (instance.state.isDestroyed || !instance.state.isEnabled && !isBeingDestroyed) {
3008
+ return;
3361
3009
  }
3362
- if (duration === 0) {
3363
- return callback();
3010
+ if (instance.props.onHide(instance) === false && !isBeingDestroyed) {
3011
+ return;
3364
3012
  }
3365
- updateTransitionEndListener(tooltip, 'remove', currentTransitionEndListener);
3366
- updateTransitionEndListener(tooltip, 'add', listener);
3367
- currentTransitionEndListener = listener;
3368
- }
3369
- function on(eventType, handler) {
3370
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
3371
- getEventListenersTarget().addEventListener(eventType, handler, options);
3372
- listeners.push({
3373
- eventType: eventType,
3374
- handler: handler,
3375
- options: options
3376
- });
3377
- }
3378
- function addTriggersToReference() {
3379
- if (instance.props.touchHold && !instance.props.target) {
3380
- on('touchstart', onTrigger, PASSIVE);
3381
- on('touchend', onMouseLeave, PASSIVE);
3013
+ removeDocumentClickListener();
3014
+ popper.style.visibility = 'hidden';
3015
+ instance.state.isVisible = false;
3016
+ instance.state.isShown = false;
3017
+ wasVisibleDuringPreviousUpdate = false;
3018
+ if (instance.props.interactive) {
3019
+ getEventListenersTarget().classList.remove(ACTIVE_CLASS);
3382
3020
  }
3383
- instance.props.trigger.trim().split(' ').forEach(function (eventType) {
3384
- if (eventType === 'manual') {
3385
- return;
3021
+ var transitionableElements = getTransitionableElements();
3022
+ setTransitionDuration(transitionableElements, duration);
3023
+ setVisibilityState(transitionableElements, 'hidden');
3024
+ onTransitionedOut(duration, function () {
3025
+ if (!isScheduledToShow) {
3026
+ removeFollowCursorListener();
3386
3027
  }
3387
- if (!instance.props.target) {
3388
- on(eventType, onTrigger);
3389
- switch (eventType) {
3390
- case 'mouseenter':
3391
- on('mouseleave', onMouseLeave);
3392
- break;
3393
- case 'focus':
3394
- on(isIE$1 ? 'focusout' : 'blur', onBlur);
3395
- break;
3396
- }
3397
- } else {
3398
- switch (eventType) {
3399
- case 'mouseenter':
3400
- on('mouseover', onDelegateShow);
3401
- on('mouseout', onDelegateHide);
3402
- break;
3403
- case 'focus':
3404
- on('focusin', onDelegateShow);
3405
- on('focusout', onDelegateHide);
3406
- break;
3407
- case 'click':
3408
- on(eventType, onDelegateShow);
3409
- break;
3410
- }
3028
+ if (instance.props.aria) {
3029
+ getEventListenersTarget().removeAttribute("aria-".concat(instance.props.aria));
3411
3030
  }
3031
+ instance.popperInstance.disableEventListeners();
3032
+ instance.popperInstance.options.placement = instance.props.placement;
3033
+ popper.parentNode.removeChild(popper);
3034
+ instance.props.onHidden(instance);
3035
+ instance.state.isMounted = false;
3412
3036
  });
3413
3037
  }
3414
- function removeTriggersFromReference() {
3415
- listeners.forEach(function (_ref) {
3416
- var eventType = _ref.eventType,
3417
- handler = _ref.handler,
3418
- options = _ref.options;
3419
- getEventListenersTarget().removeEventListener(eventType, handler, options);
3420
- });
3421
- listeners = [];
3422
- }
3423
- function positionVirtualReferenceNearCursor(event) {
3424
- var _lastMouseMoveEvent = lastMouseMoveEvent = event,
3425
- x = _lastMouseMoveEvent.clientX,
3426
- y = _lastMouseMoveEvent.clientY;
3427
- if (!currentComputedPadding) {
3038
+ function destroy(destroyTargetInstances) {
3039
+ if (instance.state.isDestroyed) {
3428
3040
  return;
3429
3041
  }
3430
- var isCursorOverReference = closestCallback(event.target, function (el) {
3431
- return el === reference;
3432
- });
3433
- var rect = reference.getBoundingClientRect();
3434
- var followCursor = instance.props.followCursor;
3435
- var isHorizontal = followCursor === 'horizontal';
3436
- var isVertical = followCursor === 'vertical';
3437
- var isVerticalPlacement = includes(['top', 'bottom'], getBasicPlacement(popper));
3438
- var fullPlacement = popper.getAttribute(PLACEMENT_ATTRIBUTE);
3439
- var isVariation = fullPlacement ? !!fullPlacement.split('-')[1] : false;
3440
- var size = isVerticalPlacement ? popper.offsetWidth : popper.offsetHeight;
3441
- var halfSize = size / 2;
3442
- var verticalIncrease = isVerticalPlacement ? 0 : isVariation ? size : halfSize;
3443
- var horizontalIncrease = isVerticalPlacement ? isVariation ? size : halfSize : 0;
3444
- if (isCursorOverReference || !instance.props.interactive) {
3445
- instance.popperInstance.reference = _extends$2({}, instance.popperInstance.reference, {
3446
- clientWidth: 0,
3447
- clientHeight: 0,
3448
- getBoundingClientRect: function getBoundingClientRect() {
3449
- return {
3450
- width: isVerticalPlacement ? size : 0,
3451
- height: isVerticalPlacement ? 0 : size,
3452
- top: (isHorizontal ? rect.top : y) - verticalIncrease,
3453
- bottom: (isHorizontal ? rect.bottom : y) + verticalIncrease,
3454
- left: (isVertical ? rect.left : x) - horizontalIncrease,
3455
- right: (isVertical ? rect.right : x) + horizontalIncrease
3456
- };
3042
+ isBeingDestroyed = true;
3043
+ if (instance.state.isMounted) {
3044
+ hide(0);
3045
+ }
3046
+ removeTriggersFromReference();
3047
+ delete reference._tippy;
3048
+ var target = instance.props.target;
3049
+ if (target && destroyTargetInstances && isRealElement(reference)) {
3050
+ arrayFrom(reference.querySelectorAll(target)).forEach(function (child) {
3051
+ if (child._tippy) {
3052
+ child._tippy.destroy();
3457
3053
  }
3458
3054
  });
3459
- instance.popperInstance.update();
3460
3055
  }
3461
- if (followCursor === 'initial' && instance.state.isVisible) {
3462
- removeFollowCursorListener();
3056
+ if (instance.popperInstance) {
3057
+ instance.popperInstance.destroy();
3463
3058
  }
3059
+ isBeingDestroyed = false;
3060
+ instance.state.isDestroyed = true;
3464
3061
  }
3465
- function createDelegateChildTippy(event) {
3466
- if (event) {
3467
- var targetEl = closest(event.target, instance.props.target);
3468
- if (targetEl && !targetEl._tippy) {
3469
- createTippy(targetEl, _extends$2({}, instance.props, {
3470
- content: invokeWithArgsOrReturn(collectionProps.content, [targetEl]),
3471
- appendTo: collectionProps.appendTo,
3472
- target: '',
3473
- showOnInit: true
3474
- }));
3475
- }
3062
+ }
3063
+ function group(instances) {
3064
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
3065
+ _ref$delay = _ref.delay,
3066
+ delay = _ref$delay === void 0 ? instances[0].props.delay : _ref$delay,
3067
+ _ref$duration = _ref.duration,
3068
+ duration = _ref$duration === void 0 ? 0 : _ref$duration;
3069
+ var isAnyTippyOpen = false;
3070
+ instances.forEach(function (instance) {
3071
+ if (instance._originalProps) {
3072
+ instance.set(instance._originalProps);
3073
+ } else {
3074
+ instance._originalProps = _extends$2({}, instance.props);
3476
3075
  }
3076
+ });
3077
+ function setIsAnyTippyOpen(value) {
3078
+ isAnyTippyOpen = value;
3079
+ updateInstances();
3477
3080
  }
3478
- function onTrigger(event) {
3479
- if (!instance.state.isEnabled || isEventListenerStopped(event)) {
3480
- return;
3481
- }
3482
- if (!instance.state.isVisible) {
3483
- lastTriggerEventType = event.type;
3484
- if (event instanceof MouseEvent) {
3485
- lastMouseMoveEvent = event;
3486
- mouseMoveListeners.forEach(function (listener) {
3487
- return listener(event);
3488
- });
3081
+ function onShow(instance) {
3082
+ instance._originalProps.onShow(instance);
3083
+ instances.forEach(function (instance) {
3084
+ instance.set({
3085
+ duration: duration
3086
+ });
3087
+ if (instance.state.isVisible) {
3088
+ instance.hide();
3489
3089
  }
3090
+ });
3091
+ setIsAnyTippyOpen(true);
3092
+ }
3093
+ function onHide(instance) {
3094
+ instance._originalProps.onHide(instance);
3095
+ setIsAnyTippyOpen(false);
3096
+ }
3097
+ function onShown(instance) {
3098
+ instance._originalProps.onShown(instance);
3099
+ instance.set({
3100
+ duration: instance._originalProps.duration
3101
+ });
3102
+ }
3103
+ function updateInstances() {
3104
+ instances.forEach(function (instance) {
3105
+ instance.set({
3106
+ onShow: onShow,
3107
+ onShown: onShown,
3108
+ onHide: onHide,
3109
+ delay: isAnyTippyOpen ? [0, isArray$1(delay) ? delay[1] : delay] : delay,
3110
+ duration: isAnyTippyOpen ? duration : instance._originalProps.duration
3111
+ });
3112
+ });
3113
+ }
3114
+ updateInstances();
3115
+ }
3116
+ var globalEventListenersBound = false;
3117
+ function tippy(targets, options) {
3118
+ validateOptions(options || {}, defaultProps);
3119
+ if (!globalEventListenersBound) {
3120
+ bindGlobalEventListeners();
3121
+ globalEventListenersBound = true;
3122
+ }
3123
+ var props = _extends$2({}, defaultProps, options);
3124
+ if (isBareVirtualElement(targets)) {
3125
+ polyfillElementPrototypeProperties(targets);
3126
+ }
3127
+ var instances = getArrayOfElements(targets).reduce(function (acc, reference) {
3128
+ var instance = reference && createTippy(reference, props);
3129
+ if (instance) {
3130
+ acc.push(instance);
3131
+ }
3132
+ return acc;
3133
+ }, []);
3134
+ return isSingular(targets) ? instances[0] : instances;
3135
+ }
3136
+ tippy.version = version;
3137
+ tippy.defaults = defaultProps;
3138
+ tippy.setDefaults = function (partialDefaults) {
3139
+ keys$1(partialDefaults).forEach(function (key) {
3140
+ defaultProps[key] = partialDefaults[key];
3141
+ });
3142
+ };
3143
+ tippy.hideAll = hideAll;
3144
+ tippy.group = group;
3145
+ function autoInit() {
3146
+ arrayFrom(document.querySelectorAll('[data-tippy]')).forEach(function (el) {
3147
+ var content = el.getAttribute('data-tippy');
3148
+ if (content) {
3149
+ tippy(el, {
3150
+ content: content
3151
+ });
3490
3152
  }
3491
- if (event.type === 'click' && instance.props.hideOnClick !== false && instance.state.isVisible) {
3492
- scheduleHide();
3493
- } else {
3494
- scheduleShow(event);
3153
+ });
3154
+ }
3155
+ if (isBrowser$1) {
3156
+ setTimeout(autoInit);
3157
+ }
3158
+ var getValidTippyProps = function getValidTippyProps(props) {
3159
+ var validProps = {};
3160
+ for (var key in props) {
3161
+ if (defaultProps.hasOwnProperty(key)) {
3162
+ validProps[key] = props[key];
3495
3163
  }
3496
3164
  }
3497
- function onMouseMove(event) {
3498
- var isCursorOverPopper = closest(event.target, POPPER_SELECTOR) === popper;
3499
- var isCursorOverReference = closestCallback(event.target, function (el) {
3500
- return el === reference;
3501
- });
3502
- if (isCursorOverPopper || isCursorOverReference) {
3503
- return;
3165
+ return validProps;
3166
+ };
3167
+
3168
+ var defaultOptions = {
3169
+ duration: 0,
3170
+ arrow: true,
3171
+ size: 'small',
3172
+ trigger: 'mouseenter focus',
3173
+ theme: 'dark',
3174
+ interactive: true,
3175
+ boundary: 'window',
3176
+ content: '',
3177
+ allowHTML: true,
3178
+ extCls: ''
3179
+ };
3180
+ var validPlacements$1 = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
3181
+ var createTippy$1 = function createTippy(el, binding) {
3182
+ var value = binding.value;
3183
+ var options = _objectSpread({}, defaultOptions);
3184
+ if (_typeof(value) === 'object') {
3185
+ if (value.allowHtml || value.allowHTML) {
3186
+ value.allowHTML = true;
3504
3187
  }
3505
- if (isCursorOutsideInteractiveBorder(getBasicPlacement(popper), popper.getBoundingClientRect(), event, instance.props)) {
3506
- cleanupInteractiveMouseListeners();
3507
- scheduleHide();
3188
+ _extends(options, value);
3189
+ } else {
3190
+ options.content = value;
3191
+ }
3192
+ var placement = validPlacements$1.find(function (placement) {
3193
+ return binding.modifiers[placement];
3194
+ });
3195
+ options.placement = options.placement || placement || (options.placements || ['top'])[0];
3196
+ var _binding$modifiers = binding.modifiers,
3197
+ click = _binding$modifiers.click,
3198
+ light = _binding$modifiers.light;
3199
+ if (click) {
3200
+ options.trigger = 'click';
3201
+ }
3202
+ if (light) {
3203
+ options.theme = 'light';
3204
+ }
3205
+ if (options.allowHTML) {
3206
+ var selector = options.content;
3207
+ if (selector instanceof Vue) {
3208
+ options.content = selector.$el;
3209
+ } else if (typeof selector === 'string') {
3210
+ try {
3211
+ var element = document.querySelector(selector);
3212
+ if (element) {
3213
+ options.content = element;
3214
+ }
3215
+ } catch (e) {
3216
+ var _element = document.createElement('div');
3217
+ _element.innerHTML = selector;
3218
+ }
3508
3219
  }
3509
3220
  }
3510
- function onMouseLeave(event) {
3511
- if (isEventListenerStopped(event)) {
3512
- return;
3221
+ if (options.html) {
3222
+ options.content = options.html;
3223
+ }
3224
+ if (typeof options.onClose === 'function') {
3225
+ options.onHide = options.onClose;
3226
+ }
3227
+ var validOptions = getValidTippyProps(options);
3228
+ return tippy(el, validOptions);
3229
+ };
3230
+ var bkTooltips = {
3231
+ inserted: function inserted(el, binding) {
3232
+ var disabled = _typeof(binding.value) === 'object' ? binding.value.disabled : false;
3233
+ if (!disabled) {
3234
+ el.tippyInstance = createTippy$1(el, binding);
3513
3235
  }
3514
- if (instance.props.interactive) {
3515
- document.body.addEventListener('mouseleave', scheduleHide);
3516
- document.addEventListener('mousemove', debouncedOnMouseMove);
3517
- mouseMoveListeners.push(debouncedOnMouseMove);
3518
- return;
3236
+ },
3237
+ unbind: function unbind(el) {
3238
+ el._tippy && el._tippy.destroy();
3239
+ el.tippyInstance = null;
3240
+ },
3241
+ update: function update(el, binding) {
3242
+ var value = binding.value;
3243
+ var isObject = _typeof(value) === 'object';
3244
+ var content = isObject ? value.content : value;
3245
+ var disabled = isObject ? value.disabled : false;
3246
+ if (disabled || !content) {
3247
+ el._tippy && el._tippy.destroy();
3248
+ el.tippyInstance = null;
3249
+ } else if (content) {
3250
+ if (!el._tippy) {
3251
+ el.tippyInstance = createTippy$1(el, binding);
3252
+ } else {
3253
+ if (_typeof(value) === 'object' && (binding.value.allowHtml || binding.value.allowHTML)) {
3254
+ el.tippyInstance = createTippy$1(el, binding);
3255
+ } else {
3256
+ el._tippy.setContent(content);
3257
+ }
3258
+ }
3519
3259
  }
3520
- scheduleHide();
3521
3260
  }
3522
- function onBlur(event) {
3523
- if (event.target !== getEventListenersTarget()) {
3524
- return;
3525
- }
3526
- if (instance.props.interactive && event.relatedTarget && popper.contains(event.relatedTarget)) {
3527
- return;
3261
+ };
3262
+ bkTooltips.install = function (Vue) {
3263
+ Vue.directive('bkTooltips', bkTooltips);
3264
+ };
3265
+
3266
+ var script = {
3267
+ name: 'bk-input',
3268
+ directives: {
3269
+ bkTooltips: bkTooltips
3270
+ },
3271
+ mixins: [emitter, locale.mixin],
3272
+ props: {
3273
+ type: {
3274
+ type: String,
3275
+ default: 'text',
3276
+ validator: function validator(value) {
3277
+ return ['text', 'textarea', 'password', 'number', 'email', 'url', 'date'].indexOf(value) > -1;
3278
+ }
3279
+ },
3280
+ value: {
3281
+ type: [String, Number],
3282
+ default: ''
3283
+ },
3284
+ placeholder: {
3285
+ type: String,
3286
+ default: ''
3287
+ },
3288
+ disabled: {
3289
+ type: Boolean,
3290
+ default: false
3291
+ },
3292
+ clearable: {
3293
+ type: Boolean,
3294
+ default: false
3295
+ },
3296
+ readonly: {
3297
+ type: Boolean,
3298
+ default: false
3299
+ },
3300
+ name: {
3301
+ type: String,
3302
+ default: ''
3303
+ },
3304
+ maxlength: {
3305
+ type: [Number, String]
3306
+ },
3307
+ minlength: {
3308
+ type: [Number, String]
3309
+ },
3310
+ min: {
3311
+ type: Number,
3312
+ default: minSafeInteger$1
3313
+ },
3314
+ max: {
3315
+ type: Number,
3316
+ default: maxSafeInteger$1
3317
+ },
3318
+ size: {
3319
+ type: String,
3320
+ default: '',
3321
+ validator: function validator(val) {
3322
+ return ['', 'large', 'small'].includes(val);
3323
+ }
3324
+ },
3325
+ leftIcon: {
3326
+ type: String,
3327
+ default: ''
3328
+ },
3329
+ rightIcon: {
3330
+ type: String,
3331
+ default: ''
3332
+ },
3333
+ rows: {
3334
+ type: Number
3335
+ },
3336
+ inputStyle: {
3337
+ type: Object
3338
+ },
3339
+ fontSize: {
3340
+ type: String,
3341
+ default: 'normal'
3342
+ },
3343
+ precision: Number,
3344
+ passwordIcon: {
3345
+ type: Array,
3346
+ default: function _default() {
3347
+ return ['icon-eye-slash', 'icon-eye'];
3348
+ }
3349
+ },
3350
+ showControls: {
3351
+ type: Boolean,
3352
+ default: true
3353
+ },
3354
+ extCls: {
3355
+ type: String,
3356
+ default: ''
3357
+ },
3358
+ nativeAttributes: {
3359
+ type: Object,
3360
+ default: null
3361
+ },
3362
+ showWordLimit: {
3363
+ type: Boolean,
3364
+ default: undefined
3365
+ },
3366
+ behavior: {
3367
+ type: String,
3368
+ default: 'normal',
3369
+ validate: function validate(v) {
3370
+ return ['simplicity', 'normal'].indexOf(v) > -1;
3371
+ }
3372
+ },
3373
+ showClearOnlyHover: {
3374
+ type: Boolean,
3375
+ default: false
3376
+ },
3377
+ allowNumberPaste: {
3378
+ type: Boolean,
3379
+ default: false
3380
+ },
3381
+ showOverflowTooltips: {
3382
+ type: Boolean,
3383
+ default: false
3384
+ },
3385
+ initialControlValue: Number
3386
+ },
3387
+ data: function data() {
3388
+ return {
3389
+ hover: false,
3390
+ curValue: '',
3391
+ prepend: false,
3392
+ append: false,
3393
+ isActive: false,
3394
+ defaultPlaceholder: '',
3395
+ rightIconStyle: {
3396
+ right: '10px'
3397
+ },
3398
+ rightPasswordIconStyle: {
3399
+ right: '10px'
3400
+ },
3401
+ inputType: this.type,
3402
+ inputSize: this.size,
3403
+ inputPasswordIcon: this.passwordIcon,
3404
+ inputRightPadding: '10px',
3405
+ iconAreaSizeObserver: null,
3406
+ inputResizeObserver: null,
3407
+ isInputOverflow: false,
3408
+ inputClientWidth: null,
3409
+ validKeyCodeList: [48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
3410
+ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
3411
+ 8,
3412
+ 189,
3413
+ 109,
3414
+ 190,
3415
+ 110,
3416
+ 38, 40, 37, 39,
3417
+ 46,
3418
+ 9
3419
+ ],
3420
+ isOnComposition: false
3421
+ };
3422
+ },
3423
+ computed: {
3424
+ showClearIcon: function showClearIcon() {
3425
+ return this.clearable && this.curValue && !this.disabled && (this.showClearOnlyHover ? this.hover : true);
3426
+ },
3427
+ showPwdVisable: function showPwdVisable() {
3428
+ return this.type === 'password' && this.curValue && this.inputPasswordIcon.length && !this.readonly && !this.disabled;
3429
+ },
3430
+ showInputWordLimit: function showInputWordLimit() {
3431
+ if (!['text', 'textarea'].includes(this.type)) return false;
3432
+ return this.type === 'text' ? this.maxlength && this.showWordLimit : this.maxlength && this.showWordLimit !== false;
3433
+ },
3434
+ bindAttribute: function bindAttribute() {
3435
+ return this.getAttributeByType(this.inputType);
3436
+ },
3437
+ computedStyle: function computedStyle() {
3438
+ return _extends(this.inputType === 'textarea' ? {} : {
3439
+ 'padding-right': this.inputRightPadding
3440
+ }, this.inputStyle);
3441
+ },
3442
+ showLeftIcon: function showLeftIcon() {
3443
+ return this.leftIcon;
3444
+ },
3445
+ showRightIcon: function showRightIcon() {
3446
+ return this.rightIcon || this.clearable && this.curValue || this.type === 'password' || this.maxlength;
3447
+ },
3448
+ showTwoRightIcon: function showTwoRightIcon() {
3449
+ return this.clearable && this.curValue && this.type === 'password';
3450
+ },
3451
+ wrapperClass: function wrapperClass() {
3452
+ var wrapperClass = ['bk-form-control', {
3453
+ 'with-left-icon': this.showLeftIcon,
3454
+ 'with-right-icon': this.showRightIcon,
3455
+ 'with-two-right-icon': this.showTwoRightIcon,
3456
+ 'control-prepend-group': this.prepend,
3457
+ 'control-append-group': this.append,
3458
+ 'control-active': this.isActive,
3459
+ 'control-disable': this.disabled
3460
+ }];
3461
+ if (this.inputSize) {
3462
+ wrapperClass.push("bk-input-wrapper-".concat(this.inputSize));
3463
+ }
3464
+ return wrapperClass;
3465
+ },
3466
+ fontSizeCls: function fontSizeCls() {
3467
+ var cls = '';
3468
+ if (this.fontSize === 'medium') {
3469
+ cls = 'medium-font';
3470
+ } else if (this.fontSize === 'large') {
3471
+ cls = 'large-font';
3472
+ }
3473
+ return cls;
3474
+ },
3475
+ inputSizeCls: function inputSizeCls() {
3476
+ if (this.inputSize) {
3477
+ return "bk-input-".concat(this.inputSize);
3478
+ }
3479
+ return '';
3480
+ },
3481
+ inputTooltips: function inputTooltips() {
3482
+ return {
3483
+ content: this.curValue,
3484
+ disabled: !this.showOverflowTooltips || this.type === 'password' || !this.isInputOverflow,
3485
+ width: this.inputClientWidth && this.inputClientWidth
3486
+ };
3528
3487
  }
3529
- scheduleHide();
3530
- }
3531
- function onDelegateShow(event) {
3532
- if (closest(event.target, instance.props.target)) {
3533
- scheduleShow(event);
3488
+ },
3489
+ watch: {
3490
+ value: {
3491
+ handler: function handler(val, old) {
3492
+ this.setCurValue(val);
3493
+ old === undefined && this.updateNumberValue(val);
3494
+ this.setOverflow();
3495
+ },
3496
+ immediate: true
3497
+ },
3498
+ placeholder: function placeholder(val) {
3499
+ this.defaultPlaceholder = val || this.t('bk.input.input');
3500
+ },
3501
+ type: function type(val) {
3502
+ this.inputType = val;
3503
+ },
3504
+ size: function size(val) {
3505
+ this.inputSize = val;
3534
3506
  }
3535
- }
3536
- function onDelegateHide(event) {
3537
- if (closest(event.target, instance.props.target)) {
3538
- scheduleHide();
3507
+ },
3508
+ created: function created() {
3509
+ this.defaultPlaceholder = this.placeholder || this.t('bk.input.input');
3510
+ },
3511
+ mounted: function mounted() {
3512
+ var _this = this;
3513
+ this.prepend = this.$slots.prepend !== undefined;
3514
+ this.append = this.$slots.append !== undefined;
3515
+ if (this.$slots.append) {
3516
+ this.$nextTick(function () {
3517
+ var appendWidth = _parseFloat$2(getStyle(_this.$slots.append[0].elm, 'width'));
3518
+ _this.rightIconStyle = {
3519
+ right: _parseFloat$2(_this.rightIconStyle.right) + appendWidth + 'px'
3520
+ };
3521
+ });
3539
3522
  }
3540
- }
3541
- function isEventListenerStopped(event) {
3542
- var supportsTouch = ('ontouchstart' in window);
3543
- var isTouchEvent = includes(event.type, 'touch');
3544
- var touchHold = instance.props.touchHold;
3545
- return supportsTouch && isUsingTouch && touchHold && !isTouchEvent || isUsingTouch && !touchHold && isTouchEvent;
3546
- }
3547
- function runMountCallback() {
3548
- if (!hasMountCallbackRun && currentMountCallback) {
3549
- hasMountCallbackRun = true;
3550
- reflow(popper);
3551
- currentMountCallback();
3523
+ if (this.clearable) {
3524
+ this.rightPasswordIconStyle = {
3525
+ right: '30px'
3526
+ };
3552
3527
  }
3553
- }
3554
- function createPopperInstance() {
3555
- var popperOptions = instance.props.popperOptions;
3556
- var _instance$popperChild = instance.popperChildren,
3557
- tooltip = _instance$popperChild.tooltip,
3558
- arrow = _instance$popperChild.arrow;
3559
- var preventOverflowModifier = getModifier(popperOptions, 'preventOverflow');
3560
- function applyMutations(data) {
3561
- if (instance.props.flip && !instance.props.flipOnUpdate) {
3562
- if (data.flipped) {
3563
- instance.popperInstance.options.placement = data.placement;
3528
+ this.observerIconSize();
3529
+ this.observerInputSize();
3530
+ },
3531
+ beforeDestroy: function beforeDestroy() {
3532
+ this.iconAreaSizeObserver && typeof this.iconAreaSizeObserver.disconnect === 'function' && this.iconAreaSizeObserver.disconnect();
3533
+ this.iconAreaSizeObserver = null;
3534
+ this.inputResizeObserver && this.inputResizeObserver.disconnect();
3535
+ this.inputResizeObserver = null;
3536
+ },
3537
+ methods: {
3538
+ observerIconSize: function observerIconSize() {
3539
+ var _this2 = this;
3540
+ var element = this.$refs.rightIconArea;
3541
+ if (!element) return;
3542
+ if (typeof ResizeObserver !== 'undefined') {
3543
+ var defaultPadding = 10;
3544
+ this.iconAreaSizeObserver = new ResizeObserver(function (entries) {
3545
+ var _iterator = _createForOfIteratorHelper(entries),
3546
+ _step;
3547
+ try {
3548
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
3549
+ var entry = _step.value;
3550
+ var cr = entry.contentRect;
3551
+ _this2.inputRightPadding = "".concat(cr.width + defaultPadding, "px");
3552
+ }
3553
+ } catch (err) {
3554
+ _iterator.e(err);
3555
+ } finally {
3556
+ _iterator.f();
3557
+ }
3558
+ });
3559
+ this.iconAreaSizeObserver.observe(element);
3560
+ }
3561
+ },
3562
+ observerInputSize: function observerInputSize() {
3563
+ var _this3 = this;
3564
+ var element = this.$refs.input;
3565
+ if (!element) return;
3566
+ this.inputResizeObserver = new ResizeObserver(function (entries) {
3567
+ var _iterator2 = _createForOfIteratorHelper(entries),
3568
+ _step2;
3569
+ try {
3570
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
3571
+ var entry = _step2.value;
3572
+ if (entry.target === element) {
3573
+ _this3.setOverflow();
3574
+ }
3575
+ }
3576
+ } catch (err) {
3577
+ _iterator2.e(err);
3578
+ } finally {
3579
+ _iterator2.f();
3564
3580
  }
3565
- setFlipModifierEnabled(instance.popperInstance.modifiers, false);
3581
+ });
3582
+ this.inputResizeObserver.observe(element);
3583
+ },
3584
+ setOverflow: function setOverflow() {
3585
+ var _this4 = this;
3586
+ setTimeout(function () {
3587
+ var inputEl = _this4.$refs.input;
3588
+ if (inputEl) {
3589
+ _this4.isInputOverflow = inputEl.scrollWidth > inputEl.clientWidth + 2;
3590
+ if (inputEl.clientWidth !== _this4.inputClientWidth) {
3591
+ _this4.$refs.inputWrapper._tippy && _this4.$refs.inputWrapper._tippy.destroy();
3592
+ }
3593
+ _this4.inputClientWidth = inputEl.clientWidth;
3594
+ }
3595
+ });
3596
+ },
3597
+ getAttributeByType: function getAttributeByType() {
3598
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
3599
+ var defaultAttr = {
3600
+ type: type,
3601
+ name: this.name,
3602
+ placeholder: this.defaultPlaceholder,
3603
+ disabled: this.disabled,
3604
+ readonly: this.readonly,
3605
+ maxlength: this.maxlength,
3606
+ minlength: this.minlength,
3607
+ value: this.curValue
3608
+ };
3609
+ type = type.toLocaleLowerCase();
3610
+ var outputAttr = this.nativeAttributes || {};
3611
+ switch (type) {
3612
+ case 'number':
3613
+ var numberAttr = {
3614
+ min: this.min,
3615
+ max: this.max
3616
+ };
3617
+ _extends(outputAttr, defaultAttr, numberAttr);
3618
+ outputAttr.type = 'text';
3619
+ break;
3620
+ case 'textarea':
3621
+ var txtAttr = {
3622
+ rows: this.rows
3623
+ };
3624
+ _extends(outputAttr, defaultAttr, txtAttr);
3625
+ break;
3626
+ default:
3627
+ _extends(outputAttr, defaultAttr);
3628
+ break;
3566
3629
  }
3567
- tooltip.setAttribute(PLACEMENT_ATTRIBUTE, data.placement);
3568
- if (data.attributes[OUT_OF_BOUNDARIES_ATTRIBUTE] !== false) {
3569
- tooltip.setAttribute(OUT_OF_BOUNDARIES_ATTRIBUTE, '');
3570
- } else {
3571
- tooltip.removeAttribute(OUT_OF_BOUNDARIES_ATTRIBUTE);
3630
+ return outputAttr;
3631
+ },
3632
+ handleToFixed: function handleToFixed(defaultNumber, length) {
3633
+ var len = _parseInt$2(length, 10);
3634
+ var number = Number(defaultNumber);
3635
+ if (isNaN(number) || number >= Math.pow(10, 21)) {
3636
+ return number.toString();
3572
3637
  }
3573
- if (previousPlacement && previousPlacement !== data.placement && wasVisibleDuringPreviousUpdate) {
3574
- tooltip.style.transition = 'none';
3575
- requestAnimationFrame(function () {
3576
- tooltip.style.transition = '';
3577
- });
3638
+ if (typeof len === 'undefined' || len === 0) {
3639
+ return Math.round(number).toString();
3578
3640
  }
3579
- previousPlacement = data.placement;
3580
- wasVisibleDuringPreviousUpdate = instance.state.isVisible;
3581
- var basicPlacement = getBasicPlacement(popper);
3582
- var styles = tooltip.style;
3583
- styles.top = styles.bottom = styles.left = styles.right = '';
3584
- styles[basicPlacement] = getOffsetDistanceInPx(instance.props.distance);
3585
- var padding = preventOverflowModifier && preventOverflowModifier.padding !== undefined ? preventOverflowModifier.padding : PADDING;
3586
- var isPaddingNumber = typeof padding === 'number';
3587
- var computedPadding = _extends$2({
3588
- top: isPaddingNumber ? padding : padding.top,
3589
- bottom: isPaddingNumber ? padding : padding.bottom,
3590
- left: isPaddingNumber ? padding : padding.left,
3591
- right: isPaddingNumber ? padding : padding.right
3592
- }, !isPaddingNumber && padding);
3593
- computedPadding[basicPlacement] = isPaddingNumber ? padding + instance.props.distance : (padding[basicPlacement] || 0) + instance.props.distance;
3594
- instance.popperInstance.modifiers.filter(function (m) {
3595
- return m.name === 'preventOverflow';
3596
- })[0].padding = computedPadding;
3597
- currentComputedPadding = computedPadding;
3598
- }
3599
- var config = _extends$2({
3600
- eventsEnabled: false,
3601
- placement: instance.props.placement
3602
- }, popperOptions, {
3603
- modifiers: _extends$2({}, popperOptions ? popperOptions.modifiers : {}, {
3604
- preventOverflow: _extends$2({
3605
- boundariesElement: instance.props.boundary,
3606
- padding: PADDING
3607
- }, preventOverflowModifier),
3608
- arrow: _extends$2({
3609
- element: arrow,
3610
- enabled: !!arrow
3611
- }, getModifier(popperOptions, 'arrow')),
3612
- flip: _extends$2({
3613
- enabled: instance.props.flip,
3614
- padding: instance.props.distance + PADDING,
3615
- behavior: instance.props.flipBehavior
3616
- }, getModifier(popperOptions, 'flip')),
3617
- offset: _extends$2({
3618
- offset: instance.props.offset
3619
- }, getModifier(popperOptions, 'offset'))
3620
- }),
3621
- onCreate: function onCreate(data) {
3622
- applyMutations(data);
3623
- runMountCallback();
3624
- if (popperOptions && popperOptions.onCreate) {
3625
- popperOptions.onCreate(data);
3641
+ var result = number.toString();
3642
+ var numberArr = result.split('.');
3643
+ if (numberArr.length < 2) {
3644
+ return this.handlePadNum(result, len);
3645
+ }
3646
+ var intNum = numberArr[0];
3647
+ var deciNum = numberArr[1];
3648
+ var lastNum = deciNum.substr(len, 1);
3649
+ if (deciNum.length === len) {
3650
+ return result;
3651
+ }
3652
+ if (deciNum.length < len) {
3653
+ return this.handlePadNum(result, len);
3654
+ }
3655
+ result = intNum + '.' + deciNum.substr(0, len);
3656
+ if (_parseInt$2(lastNum, 10) >= 5) {
3657
+ var times = Math.pow(10, len);
3658
+ var changedInt = Number(result.replace('.', ''));
3659
+ changedInt++;
3660
+ changedInt /= times;
3661
+ result = this.handlePadNum(changedInt + '', len);
3662
+ }
3663
+ return result;
3664
+ },
3665
+ handlePadNum: function handlePadNum(num, len) {
3666
+ var dotPos = num.indexOf('.');
3667
+ if (dotPos === -1) {
3668
+ num += '.';
3669
+ for (var i = 0; i < len; i++) {
3670
+ num += '0';
3626
3671
  }
3627
- },
3628
- onUpdate: function onUpdate(data) {
3629
- applyMutations(data);
3630
- runMountCallback();
3631
- if (popperOptions && popperOptions.onUpdate) {
3632
- popperOptions.onUpdate(data);
3672
+ return num;
3673
+ } else {
3674
+ var need = len - (num.length - dotPos - 1);
3675
+ for (var j = 0; j < need; j++) {
3676
+ num += '0';
3633
3677
  }
3678
+ return num;
3634
3679
  }
3635
- });
3636
- instance.popperInstance = new Popper(reference, popper, config);
3637
- }
3638
- function mount() {
3639
- hasMountCallbackRun = false;
3640
- var isInLooseFollowCursorMode = getIsInLooseFollowCursorMode();
3641
- if (instance.popperInstance) {
3642
- setFlipModifierEnabled(instance.popperInstance.modifiers, instance.props.flip);
3643
- if (!isInLooseFollowCursorMode) {
3644
- instance.popperInstance.reference = reference;
3645
- instance.popperInstance.enableEventListeners();
3680
+ },
3681
+ handleNumberDelete: function handleNumberDelete(event) {
3682
+ if (this.curValue === '') {
3683
+ this.curValue = this.initialControlValue === undefined ? this.max : Math.min(this.initialControlValue, this.max);
3646
3684
  }
3647
- instance.popperInstance.scheduleUpdate();
3648
- } else {
3649
- createPopperInstance();
3650
- if (!isInLooseFollowCursorMode) {
3651
- instance.popperInstance.enableEventListeners();
3685
+ var curNumberValue = Number(this.curValue);
3686
+ if (curNumberValue - 1 >= this.min) {
3687
+ var curLenAfterDot = (String(curNumberValue) || '').split('.')[1] || '';
3688
+ var newVal = curNumberValue - 1;
3689
+ if (typeof this.precision !== 'undefined') {
3690
+ newVal = this.handleToFixed(newVal, Math.min(16, Math.max(curLenAfterDot.length, this.precision)));
3691
+ }
3692
+ this.setCurValue(newVal);
3693
+ this.$emit('input', newVal, event);
3694
+ this.$emit('change', newVal, event);
3695
+ this.dispatch('bk-form-item', 'form-change');
3652
3696
  }
3653
- }
3654
- var appendTo = instance.props.appendTo;
3655
- var parentNode = appendTo === 'parent' ? reference.parentNode : invokeWithArgsOrReturn(appendTo, [reference]);
3656
- if (!parentNode.contains(popper)) {
3657
- parentNode.appendChild(popper);
3658
- instance.props.onMount(instance);
3659
- instance.state.isMounted = true;
3660
- }
3661
- }
3662
- function scheduleShow(event, shouldAvoidCallingOnTrigger) {
3663
- clearDelayTimeouts();
3664
- if (instance.state.isVisible) {
3665
- return;
3666
- }
3667
- if (instance.props.target) {
3668
- return createDelegateChildTippy(event);
3669
- }
3670
- isScheduledToShow = true;
3671
- if (event && !shouldAvoidCallingOnTrigger) {
3672
- instance.props.onTrigger(instance, event);
3673
- }
3674
- if (instance.props.wait) {
3675
- return instance.props.wait(instance, event);
3676
- }
3677
- if (getIsInLooseFollowCursorMode() && !instance.state.isMounted) {
3678
- if (!instance.popperInstance) {
3679
- createPopperInstance();
3697
+ },
3698
+ handleNumberAdd: function handleNumberAdd(event) {
3699
+ if (this.curValue === '') {
3700
+ this.curValue = this.initialControlValue === undefined ? this.min : Math.max(this.initialControlValue, this.min);
3680
3701
  }
3681
- document.addEventListener('mousemove', positionVirtualReferenceNearCursor);
3682
- }
3683
- addDocumentClickListener();
3684
- var delay = getValue(instance.props.delay, 0, defaultProps.delay);
3685
- if (delay) {
3686
- showTimeoutId = setTimeout(function () {
3687
- show();
3688
- }, delay);
3689
- } else {
3690
- show();
3691
- }
3692
- }
3693
- function scheduleHide() {
3694
- clearDelayTimeouts();
3695
- if (!instance.state.isVisible) {
3696
- return removeFollowCursorListener();
3697
- }
3698
- isScheduledToShow = false;
3699
- var delay = getValue(instance.props.delay, 1, defaultProps.delay);
3700
- if (delay) {
3701
- hideTimeoutId = setTimeout(function () {
3702
- if (instance.state.isVisible) {
3703
- hide();
3702
+ var curNumberValue = Number(this.curValue);
3703
+ if (curNumberValue <= this.max - 1) {
3704
+ var curLenAfterDot = (String(curNumberValue) || '').split('.')[1] || '';
3705
+ var newVal = curNumberValue + 1;
3706
+ if (typeof this.precision !== 'undefined') {
3707
+ newVal = this.handleToFixed(newVal, Math.min(16, Math.max(curLenAfterDot.length, this.precision)));
3704
3708
  }
3705
- }, delay);
3706
- } else {
3707
- scheduleHideAnimationFrameId = requestAnimationFrame(function () {
3708
- hide();
3709
- });
3710
- }
3711
- }
3712
- function onDocumentClick(event) {
3713
- if (instance.props.interactive && popper.contains(event.target)) {
3714
- return;
3715
- }
3716
- if (getEventListenersTarget().contains(event.target)) {
3717
- if (isUsingTouch) {
3718
- return;
3709
+ this.setCurValue(newVal);
3710
+ this.$emit('input', newVal, event);
3711
+ this.$emit('change', newVal, event);
3712
+ this.dispatch('bk-form-item', 'form-change');
3713
+ }
3714
+ },
3715
+ handlerEnter: function handlerEnter(event) {
3716
+ var value = event.target.value;
3717
+ this.$emit('enter', value, event);
3718
+ },
3719
+ handlerKeyup: function handlerKeyup(event) {
3720
+ var value = event.target.value;
3721
+ this.$emit('keyup', value, event);
3722
+ },
3723
+ handlerKeypress: function handlerKeypress(event) {
3724
+ var value = event.target.value;
3725
+ this.$emit('keypress', value, event);
3726
+ },
3727
+ handlerKeydown: function handlerKeydown(event) {
3728
+ var keyCode = event.keyCode;
3729
+ var target = event.currentTarget;
3730
+ var value = target.value;
3731
+ var isPaste = (event.ctrlKey || event.metaKey) && keyCode === 86;
3732
+ if (this.inputType === 'number') {
3733
+ if (!(this.allowNumberPaste && isPaste) && (this.validKeyCodeList.indexOf(keyCode) < 0 || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey)) {
3734
+ event.stopPropagation();
3735
+ event.preventDefault();
3736
+ return false;
3737
+ }
3738
+ if (keyCode === 190) {
3739
+ if (String(value).trim()) {
3740
+ if (value.indexOf('.') >= 0) {
3741
+ event.stopPropagation();
3742
+ event.preventDefault();
3743
+ return false;
3744
+ }
3745
+ }
3746
+ }
3747
+ if (event.keyCode === 189) {
3748
+ if (String(value).trim()) {
3749
+ if (value.indexOf('-') >= 0) {
3750
+ event.stopPropagation();
3751
+ event.preventDefault();
3752
+ return false;
3753
+ }
3754
+ if (document.getSelection().type !== 'Range') {
3755
+ if (target.selectionEnd !== 0) {
3756
+ event.stopPropagation();
3757
+ event.preventDefault();
3758
+ return false;
3759
+ }
3760
+ }
3761
+ }
3762
+ }
3763
+ if (keyCode === 38) {
3764
+ event.preventDefault();
3765
+ this.handleNumberAdd(event);
3766
+ } else if (keyCode === 40) {
3767
+ event.preventDefault();
3768
+ this.handleNumberDelete(event);
3769
+ }
3770
+ if (document.getSelection().type !== 'Range') {
3771
+ if (value.indexOf('-') === 0 && target.selectionStart === 0) {
3772
+ var keyCodeList = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
3773
+ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
3774
+ 189,
3775
+ 109,
3776
+ 190,
3777
+ 110
3778
+ ];
3779
+ if (keyCodeList.indexOf(keyCode) > -1) {
3780
+ event.stopPropagation();
3781
+ event.preventDefault();
3782
+ return false;
3783
+ }
3784
+ }
3785
+ }
3786
+ }
3787
+ this.$emit('keydown', value, event);
3788
+ },
3789
+ handlerFocus: function handlerFocus(event) {
3790
+ var value = event.target.value;
3791
+ this.isActive = true;
3792
+ this.$emit('focus', value, event);
3793
+ this.dispatch('bk-form-item', 'form-focus');
3794
+ },
3795
+ toPrecision: function toPrecision(num, precision) {
3796
+ if (precision === undefined) precision = 0;
3797
+ return this.handleToFixed(num, precision);
3798
+ },
3799
+ handlerBlur: function handlerBlur(event) {
3800
+ var value = event.target.value;
3801
+ if (/^number$/i.test(this.type) && value !== '') {
3802
+ if (isNaN(value)) {
3803
+ value = this.min === minSafeInteger$1 ? 0 : this.min;
3804
+ }
3805
+ if (value !== '' && /^-?\d*(.\d*)?$/i.test(value)) {
3806
+ if (value > this.max || value < this.min) {
3807
+ value = this.getCurrentNumberValue();
3808
+ }
3809
+ }
3810
+ if (typeof this.precision !== 'undefined') {
3811
+ value = this.toPrecision(_parseFloat$2(value), this.precision, true);
3812
+ } else {
3813
+ value = Number(value);
3814
+ }
3815
+ if (value + '' !== event.target.value + '') {
3816
+ this.setCurValue(value);
3817
+ event.target.value = value;
3818
+ this.$emit('change', value, event);
3819
+ this.$emit('input', value, event);
3820
+ }
3821
+ }
3822
+ this.isActive = false;
3823
+ this.$emit('blur', value, event);
3824
+ this.dispatch('bk-form-item', 'form-blur');
3825
+ },
3826
+ handlerPaste: function handlerPaste(event) {
3827
+ var value = event.target.value;
3828
+ this.$emit('paste', value, event);
3829
+ this.$emit('change', value, event);
3830
+ this.dispatch('bk-form-item', 'form-change');
3831
+ },
3832
+ getCurrentNumberValue: function getCurrentNumberValue() {
3833
+ var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
3834
+ val = val === null ? this.curValue : val;
3835
+ var value = '';
3836
+ if (val !== '' && /^-?\d*(.\d*)?$/i.test(val)) {
3837
+ value = Number(val);
3838
+ value = value > this.max ? this.max : value;
3839
+ value = value < this.min ? this.min : value;
3840
+ return value;
3841
+ }
3842
+ return '';
3843
+ },
3844
+ handlerCompositionstart: function handlerCompositionstart(e) {
3845
+ this.isOnComposition = true;
3846
+ },
3847
+ handlerCompositionend: function handlerCompositionend(e) {
3848
+ if (this.inputType === 'number' && this.isOnComposition) {
3849
+ e.target.value = this.curValue;
3850
+ this.isOnComposition = false;
3851
+ this.handlerInput(e);
3719
3852
  }
3720
- if (instance.state.isVisible && includes(instance.props.trigger, 'click')) {
3853
+ },
3854
+ handlerInput: function handlerInput(event) {
3855
+ var _this5 = this;
3856
+ if (this.inputType === 'number' && this.isOnComposition) {
3721
3857
  return;
3722
3858
  }
3723
- }
3724
- if (instance.props.hideOnClick === true) {
3725
- clearDelayTimeouts();
3726
- hide();
3727
- }
3728
- }
3729
- function enable() {
3730
- instance.state.isEnabled = true;
3731
- }
3732
- function disable() {
3733
- instance.state.isEnabled = false;
3734
- }
3735
- function clearDelayTimeouts() {
3736
- clearTimeout(showTimeoutId);
3737
- clearTimeout(hideTimeoutId);
3738
- cancelAnimationFrame(scheduleHideAnimationFrameId);
3739
- }
3740
- function set(options) {
3741
- options = options || {};
3742
- validateOptions(options, defaultProps);
3743
- removeTriggersFromReference();
3744
- var prevProps = instance.props;
3745
- var nextProps = evaluateProps(reference, _extends$2({}, instance.props, options, {
3746
- ignoreAttributes: true
3747
- }));
3748
- nextProps.ignoreAttributes = hasOwnProperty$1(options, 'ignoreAttributes') ? options.ignoreAttributes || false : prevProps.ignoreAttributes;
3749
- instance.props = nextProps;
3750
- addTriggersToReference();
3751
- cleanupInteractiveMouseListeners();
3752
- debouncedOnMouseMove = debounce$1(onMouseMove, nextProps.interactiveDebounce);
3753
- updatePopperElement(popper, prevProps, nextProps);
3754
- instance.popperChildren = getChildren(popper);
3755
- if (instance.popperInstance) {
3756
- if (POPPER_INSTANCE_DEPENDENCIES.some(function (prop) {
3757
- return hasOwnProperty$1(options, prop) && options[prop] !== prevProps[prop];
3758
- })) {
3759
- instance.popperInstance.destroy();
3760
- createPopperInstance();
3761
- if (instance.state.isVisible) {
3762
- instance.popperInstance.enableEventListeners();
3763
- }
3764
- if (instance.props.followCursor && lastMouseMoveEvent) {
3765
- positionVirtualReferenceNearCursor(lastMouseMoveEvent);
3766
- }
3859
+ this.$nextTick(function () {
3860
+ var value = event.target.value;
3861
+ _this5.setCurValue(value);
3862
+ _this5.$emit('input', value, event);
3863
+ _this5.$emit('change', value, event);
3864
+ _this5.dispatch('bk-form-item', 'form-change');
3865
+ });
3866
+ },
3867
+ handlerClear: function handlerClear(event) {
3868
+ this.curValue = '';
3869
+ this.$emit('input', this.curValue, event);
3870
+ this.$emit('change', this.curValue, event);
3871
+ this.$emit('clear', this.curValue, event);
3872
+ this.dispatch('bk-form-item', 'form-change');
3873
+ },
3874
+ handlerLeftIcon: function handlerLeftIcon(event) {
3875
+ this.$emit('left-icon-click', this.curValue, event);
3876
+ },
3877
+ handlerRightIcon: function handlerRightIcon(event) {
3878
+ this.$emit('right-icon-click', this.curValue, event);
3879
+ },
3880
+ focus: function focus(event) {
3881
+ if (this.type === 'textarea') {
3882
+ this.$refs.textarea.focus();
3767
3883
  } else {
3768
- instance.popperInstance.update();
3884
+ this.$refs.input.focus();
3885
+ }
3886
+ },
3887
+ blur: function blur(event) {
3888
+ if (this.type === 'textarea') {
3889
+ this.$refs.textarea.blur();
3890
+ } else {
3891
+ this.$refs.input.blur();
3892
+ }
3893
+ },
3894
+ setCurValue: function setCurValue(val) {
3895
+ if (val === this.curValue) {
3896
+ return false;
3897
+ }
3898
+ this.curValue = val;
3899
+ },
3900
+ updateNumberValue: function updateNumberValue(val) {
3901
+ if (val !== '' && /^number$/i.test(this.type) && /^-?\d*(.\d*)?$/i.test(val)) {
3902
+ val = this.getCurrentNumberValue(val);
3903
+ this.curValue = typeof this.precision === 'number' ? this.toPrecision(Number(val), this.precision) : Number(val);
3904
+ }
3905
+ },
3906
+ togglePass: function togglePass() {
3907
+ if (this.inputType === 'password') {
3908
+ this.inputType = 'text';
3909
+ } else {
3910
+ this.inputType = 'password';
3769
3911
  }
3770
3912
  }
3771
3913
  }
3772
- function setContent(content) {
3773
- set({
3774
- content: content
3775
- });
3914
+ };
3915
+
3916
+ function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier
3917
+ , shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
3918
+ if (typeof shadowMode !== 'boolean') {
3919
+ createInjectorSSR = createInjector;
3920
+ createInjector = shadowMode;
3921
+ shadowMode = false;
3776
3922
  }
3777
- function show() {
3778
- var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getValue(instance.props.duration, 0, defaultProps.duration[1]);
3779
- if (instance.state.isDestroyed || !instance.state.isEnabled || isUsingTouch && !instance.props.touch) {
3780
- return;
3781
- }
3782
- if (getEventListenersTarget().hasAttribute('disabled')) {
3783
- return;
3784
- }
3785
- if (instance.props.onShow(instance) === false) {
3786
- return;
3787
- }
3788
- addDocumentClickListener();
3789
- popper.style.visibility = 'visible';
3790
- instance.state.isVisible = true;
3791
- if (instance.props.interactive) {
3792
- getEventListenersTarget().classList.add(ACTIVE_CLASS);
3923
+ var options = typeof script === 'function' ? script.options : script;
3924
+ if (template && template.render) {
3925
+ options.render = template.render;
3926
+ options.staticRenderFns = template.staticRenderFns;
3927
+ options._compiled = true;
3928
+ if (isFunctionalTemplate) {
3929
+ options.functional = true;
3793
3930
  }
3794
- var transitionableElements = getTransitionableElements();
3795
- setTransitionDuration(transitionableElements.concat(popper), 0);
3796
- currentMountCallback = function currentMountCallback() {
3797
- if (!instance.state.isVisible) {
3798
- return;
3799
- }
3800
- var isInLooseFollowCursorMode = getIsInLooseFollowCursorMode();
3801
- if (isInLooseFollowCursorMode && lastMouseMoveEvent) {
3802
- positionVirtualReferenceNearCursor(lastMouseMoveEvent);
3803
- } else if (!isInLooseFollowCursorMode) {
3804
- instance.popperInstance.update();
3931
+ }
3932
+ if (scopeId) {
3933
+ options._scopeId = scopeId;
3934
+ }
3935
+ var hook;
3936
+ if (moduleIdentifier) {
3937
+ hook = function hook(context) {
3938
+ context = context ||
3939
+ this.$vnode && this.$vnode.ssrContext ||
3940
+ this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
3941
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
3942
+ context = __VUE_SSR_CONTEXT__;
3805
3943
  }
3806
- if (instance.popperChildren.backdrop) {
3807
- instance.popperChildren.content.style.transitionDelay = Math.round(duration / 12) + 'ms';
3944
+ if (style) {
3945
+ style.call(this, createInjectorSSR(context));
3808
3946
  }
3809
- if (instance.props.sticky) {
3810
- makeSticky();
3947
+ if (context && context._registeredComponents) {
3948
+ context._registeredComponents.add(moduleIdentifier);
3811
3949
  }
3812
- setTransitionDuration([popper], instance.props.updateDuration);
3813
- setTransitionDuration(transitionableElements, duration);
3814
- setVisibilityState(transitionableElements, 'visible');
3815
- onTransitionedIn(duration, function () {
3816
- if (instance.props.aria) {
3817
- getEventListenersTarget().setAttribute("aria-".concat(instance.props.aria), popper.id);
3818
- }
3819
- instance.props.onShown(instance);
3820
- instance.state.isShown = true;
3821
- });
3822
3950
  };
3823
- mount();
3951
+ options._ssrRegister = hook;
3952
+ } else if (style) {
3953
+ hook = shadowMode ? function () {
3954
+ style.call(this, createInjectorShadow(this.$root.$options.shadowRoot));
3955
+ } : function (context) {
3956
+ style.call(this, createInjector(context));
3957
+ };
3824
3958
  }
3825
- function hide() {
3826
- var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getValue(instance.props.duration, 1, defaultProps.duration[1]);
3827
- if (instance.state.isDestroyed || !instance.state.isEnabled && !isBeingDestroyed) {
3828
- return;
3959
+ if (hook) {
3960
+ if (options.functional) {
3961
+ var originalRender = options.render;
3962
+ options.render = function renderWithStyleInjection(h, context) {
3963
+ hook.call(context);
3964
+ return originalRender(h, context);
3965
+ };
3966
+ } else {
3967
+ var existing = options.beforeCreate;
3968
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
3969
+ }
3970
+ }
3971
+ return script;
3972
+ }
3973
+ var normalizeComponent_1 = normalizeComponent;
3974
+
3975
+ /* script */
3976
+ var __vue_script__ = script;
3977
+ /* template */
3978
+ var __vue_render__ = function __vue_render__() {
3979
+ var _vm = this;
3980
+ var _h = _vm.$createElement;
3981
+ var _c = _vm._self._c || _h;
3982
+ return _c('div', {
3983
+ class: [_vm.wrapperClass, _vm.fontSizeCls, _vm.extCls],
3984
+ on: {
3985
+ "mouseenter": function mouseenter($event) {
3986
+ _vm.hover = true;
3987
+ },
3988
+ "mouseleave": function mouseleave($event) {
3989
+ _vm.hover = false;
3990
+ }
3991
+ }
3992
+ }, [_vm.leftIcon ? _c('div', {
3993
+ staticClass: "control-icon left-icon",
3994
+ on: {
3995
+ "click": _vm.handlerLeftIcon
3996
+ }
3997
+ }, [_c('i', {
3998
+ class: ['bk-icon', _vm.leftIcon]
3999
+ })]) : _vm._e(), _vm.prepend ? _c('div', {
4000
+ staticClass: "group-box group-prepend"
4001
+ }, [_vm._t("prepend")], 2) : _vm._e(), _vm.inputType === 'textarea' ? [_c('div', {
4002
+ staticClass: "bk-textarea-wrapper"
4003
+ }, [_c('textarea', _vm._b({
4004
+ ref: "textarea",
4005
+ class: ['bk-form-textarea', {
4006
+ 'textarea-maxlength': _vm.maxlength
4007
+ }],
4008
+ style: _vm.computedStyle,
4009
+ on: {
4010
+ "keyup": function keyup($event) {
4011
+ if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")) {
4012
+ return null;
4013
+ }
4014
+ return _vm.handlerEnter.apply(null, arguments);
4015
+ },
4016
+ "keypress": _vm.handlerKeypress,
4017
+ "keydown": _vm.handlerKeydown,
4018
+ "focus": _vm.handlerFocus,
4019
+ "blur": _vm.handlerBlur,
4020
+ "input": _vm.handlerInput,
4021
+ "paste": _vm.handlerPaste
3829
4022
  }
3830
- if (instance.props.onHide(instance) === false && !isBeingDestroyed) {
3831
- return;
4023
+ }, 'textarea', _vm.bindAttribute, false)), _vm.showInputWordLimit ? [_c('p', {
4024
+ staticClass: "bk-limit-box"
4025
+ }, [_c('span', {
4026
+ staticClass: "strong"
4027
+ }, [_vm._v(_vm._s(_vm.curValue && _vm.curValue.length || 0))]), _vm._v("/"), _c('span', [_vm._v(_vm._s(_vm.maxlength))])])] : _vm._e()], 2)] : [_c('div', {
4028
+ directives: [{
4029
+ name: "bk-tooltips",
4030
+ rawName: "v-bk-tooltips",
4031
+ value: _vm.inputTooltips,
4032
+ expression: "inputTooltips"
4033
+ }],
4034
+ ref: "inputWrapper",
4035
+ class: ["bk-input-" + _vm.type]
4036
+ }, [_c('input', _vm._b({
4037
+ ref: "input",
4038
+ class: ['bk-form-input', _vm.inputSizeCls, {
4039
+ 'only-bottom-border': _vm.behavior === 'simplicity'
4040
+ }],
4041
+ style: _vm.computedStyle,
4042
+ on: {
4043
+ "keyup": [function ($event) {
4044
+ if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")) {
4045
+ return null;
4046
+ }
4047
+ return _vm.handlerEnter.apply(null, arguments);
4048
+ }, _vm.handlerKeyup],
4049
+ "keypress": _vm.handlerKeypress,
4050
+ "keydown": _vm.handlerKeydown,
4051
+ "focus": _vm.handlerFocus,
4052
+ "blur": _vm.handlerBlur,
4053
+ "input": _vm.handlerInput,
4054
+ "paste": _vm.handlerPaste,
4055
+ "compositionstart": _vm.handlerCompositionstart,
4056
+ "compositionend": _vm.handlerCompositionend
3832
4057
  }
3833
- removeDocumentClickListener();
3834
- popper.style.visibility = 'hidden';
3835
- instance.state.isVisible = false;
3836
- instance.state.isShown = false;
3837
- wasVisibleDuringPreviousUpdate = false;
3838
- if (instance.props.interactive) {
3839
- getEventListenersTarget().classList.remove(ACTIVE_CLASS);
4058
+ }, 'input', _vm.bindAttribute, false)), /^number$/i.test(_vm.type) && !_vm.disabled && !_vm.readonly ? [_vm.showControls ? _c('span', {
4059
+ staticClass: "input-number-option"
4060
+ }, [_c('span', {
4061
+ staticClass: "number-option-item bk-icon icon-angle-up",
4062
+ on: {
4063
+ "click": _vm.handleNumberAdd
3840
4064
  }
3841
- var transitionableElements = getTransitionableElements();
3842
- setTransitionDuration(transitionableElements, duration);
3843
- setVisibilityState(transitionableElements, 'hidden');
3844
- onTransitionedOut(duration, function () {
3845
- if (!isScheduledToShow) {
3846
- removeFollowCursorListener();
3847
- }
3848
- if (instance.props.aria) {
3849
- getEventListenersTarget().removeAttribute("aria-".concat(instance.props.aria));
3850
- }
3851
- instance.popperInstance.disableEventListeners();
3852
- instance.popperInstance.options.placement = instance.props.placement;
3853
- popper.parentNode.removeChild(popper);
3854
- instance.props.onHidden(instance);
3855
- instance.state.isMounted = false;
3856
- });
3857
- }
3858
- function destroy(destroyTargetInstances) {
3859
- if (instance.state.isDestroyed) {
3860
- return;
4065
+ }), _c('span', {
4066
+ staticClass: "number-option-item bk-icon icon-angle-down",
4067
+ on: {
4068
+ "click": _vm.handleNumberDelete
3861
4069
  }
3862
- isBeingDestroyed = true;
3863
- if (instance.state.isMounted) {
3864
- hide(0);
4070
+ })]) : _vm._e()] : _vm._e()], 2)], _vm.append ? _c('div', {
4071
+ staticClass: "group-box group-append"
4072
+ }, [_vm._t("append")], 2) : _vm._e(), !/^number$/i.test(_vm.type) ? _c('div', {
4073
+ ref: "rightIconArea",
4074
+ staticClass: "control-icon right-icon",
4075
+ style: _vm.rightIconStyle,
4076
+ on: {
4077
+ "click": _vm.handlerRightIcon
3865
4078
  }
3866
- removeTriggersFromReference();
3867
- delete reference._tippy;
3868
- var target = instance.props.target;
3869
- if (target && destroyTargetInstances && isRealElement(reference)) {
3870
- arrayFrom(reference.querySelectorAll(target)).forEach(function (child) {
3871
- if (child._tippy) {
3872
- child._tippy.destroy();
3873
- }
3874
- });
4079
+ }, [_vm.showPwdVisable ? _c('i', {
4080
+ class: ['bk-icon', _vm.inputType === 'password' ? _vm.inputPasswordIcon[0] : _vm.inputPasswordIcon[1]],
4081
+ on: {
4082
+ "click": _vm.togglePass
3875
4083
  }
3876
- if (instance.popperInstance) {
3877
- instance.popperInstance.destroy();
4084
+ }) : _vm._e(), _vm.showClearIcon ? _c('i', {
4085
+ staticClass: "bk-icon icon-close-circle-shape clear-icon ml5 mr5",
4086
+ on: {
4087
+ "click": function click($event) {
4088
+ $event.stopPropagation();
4089
+ $event.preventDefault();
4090
+ return _vm.handlerClear.apply(null, arguments);
4091
+ }
3878
4092
  }
3879
- isBeingDestroyed = false;
3880
- instance.state.isDestroyed = true;
3881
- }
3882
- }
3883
- function group(instances) {
3884
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
3885
- _ref$delay = _ref.delay,
3886
- delay = _ref$delay === void 0 ? instances[0].props.delay : _ref$delay,
3887
- _ref$duration = _ref.duration,
3888
- duration = _ref$duration === void 0 ? 0 : _ref$duration;
3889
- var isAnyTippyOpen = false;
3890
- instances.forEach(function (instance) {
3891
- if (instance._originalProps) {
3892
- instance.set(instance._originalProps);
3893
- } else {
3894
- instance._originalProps = _extends$2({}, instance.props);
4093
+ }) : _vm._e(), _vm.rightIcon ? _c('i', {
4094
+ class: ['input-right-icon', 'bk-icon', _vm.rightIcon]
4095
+ }) : _vm._e(), _vm.type === 'text' ? [_c('p', {
4096
+ directives: [{
4097
+ name: "show",
4098
+ rawName: "v-show",
4099
+ value: _vm.showInputWordLimit,
4100
+ expression: "showInputWordLimit"
4101
+ }],
4102
+ staticClass: "bk-limit-box ml5",
4103
+ staticStyle: {
4104
+ "position": "static"
3895
4105
  }
3896
- });
3897
- function setIsAnyTippyOpen(value) {
3898
- isAnyTippyOpen = value;
3899
- updateInstances();
3900
- }
3901
- function onShow(instance) {
3902
- instance._originalProps.onShow(instance);
3903
- instances.forEach(function (instance) {
3904
- instance.set({
3905
- duration: duration
3906
- });
3907
- if (instance.state.isVisible) {
3908
- instance.hide();
4106
+ }, [_c('span', {
4107
+ staticClass: "strong"
4108
+ }, [_vm._v(_vm._s(_vm.curValue && _vm.curValue.length || 0))]), _vm._v("/"), _c('span', [_vm._v(_vm._s(_vm.maxlength))])])] : _vm._e()], 2) : _vm._e()], 2);
4109
+ };
4110
+ var __vue_staticRenderFns__ = [];
4111
+
4112
+ /* style */
4113
+ var __vue_inject_styles__ = undefined;
4114
+ /* scoped */
4115
+ var __vue_scope_id__ = undefined;
4116
+ /* module identifier */
4117
+ var __vue_module_identifier__ = undefined;
4118
+ /* functional template */
4119
+ var __vue_is_functional_template__ = false;
4120
+ /* style inject */
4121
+
4122
+ /* style inject SSR */
4123
+
4124
+ /* style inject shadow dom */
4125
+
4126
+ var __vue_component__ = /*#__PURE__*/normalizeComponent_1({
4127
+ render: __vue_render__,
4128
+ staticRenderFns: __vue_staticRenderFns__
4129
+ }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
4130
+
4131
+ function setInstaller (component, afterInstall) {
4132
+ component.install = function (Vue) {
4133
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4134
+ var props = component.props || {};
4135
+ keys$1(options).forEach(function (key) {
4136
+ if (props.hasOwnProperty(key)) {
4137
+ if (typeof props[key] === 'function' || props[key] instanceof Array) {
4138
+ props[key] = {
4139
+ type: props[key],
4140
+ default: options[key]
4141
+ };
4142
+ } else {
4143
+ props[key].default = options[key];
4144
+ }
3909
4145
  }
3910
4146
  });
3911
- setIsAnyTippyOpen(true);
3912
- }
3913
- function onHide(instance) {
3914
- instance._originalProps.onHide(instance);
3915
- setIsAnyTippyOpen(false);
3916
- }
3917
- function onShown(instance) {
3918
- instance._originalProps.onShown(instance);
3919
- instance.set({
3920
- duration: instance._originalProps.duration
3921
- });
3922
- }
3923
- function updateInstances() {
3924
- instances.forEach(function (instance) {
3925
- instance.set({
3926
- onShow: onShow,
3927
- onShown: onShown,
3928
- onHide: onHide,
3929
- delay: isAnyTippyOpen ? [0, isArray$1(delay) ? delay[1] : delay] : delay,
3930
- duration: isAnyTippyOpen ? duration : instance._originalProps.duration
3931
- });
3932
- });
3933
- }
3934
- updateInstances();
3935
- }
3936
- var globalEventListenersBound = false;
3937
- function tippy(targets, options) {
3938
- validateOptions(options || {}, defaultProps);
3939
- if (!globalEventListenersBound) {
3940
- bindGlobalEventListeners();
3941
- globalEventListenersBound = true;
3942
- }
3943
- var props = _extends$2({}, defaultProps, options);
3944
- if (isBareVirtualElement(targets)) {
3945
- polyfillElementPrototypeProperties(targets);
3946
- }
3947
- var instances = getArrayOfElements(targets).reduce(function (acc, reference) {
3948
- var instance = reference && createTippy(reference, props);
3949
- if (instance) {
3950
- acc.push(instance);
3951
- }
3952
- return acc;
3953
- }, []);
3954
- return isSingular(targets) ? instances[0] : instances;
3955
- }
3956
- tippy.version = version;
3957
- tippy.defaults = defaultProps;
3958
- tippy.setDefaults = function (partialDefaults) {
3959
- keys$1(partialDefaults).forEach(function (key) {
3960
- defaultProps[key] = partialDefaults[key];
3961
- });
3962
- };
3963
- tippy.hideAll = hideAll;
3964
- tippy.group = group;
3965
- function autoInit() {
3966
- arrayFrom(document.querySelectorAll('[data-tippy]')).forEach(function (el) {
3967
- var content = el.getAttribute('data-tippy');
3968
- if (content) {
3969
- tippy(el, {
3970
- content: content
3971
- });
3972
- }
3973
- });
3974
- }
3975
- if (isBrowser$1) {
3976
- setTimeout(autoInit);
4147
+ component.name = options.namespace ? component.name.replace('bk', options.namespace) : component.name;
4148
+ Vue.component(component.name, component);
4149
+ typeof afterInstall === 'function' && afterInstall(Vue, options);
4150
+ };
3977
4151
  }
3978
4152
 
4153
+ setInstaller(__vue_component__);
4154
+
3979
4155
  function beforeShow(instance) {
3980
4156
  var reference = instance.reference;
3981
4157
  var props = reference._bk_overflow_tips_.props;