bk-magic-vue 2.5.8-beta.6 → 2.5.8-beta.7

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.
@@ -2957,6 +2957,12 @@ url("fonts/iconcool.eot?#iefix") format("embedded-opentype");
2957
2957
  .icon-data-line:before{
2958
2958
  content:"\e20b";
2959
2959
  }
2960
+ .icon-arrow-up:before{
2961
+ content:"\e213";
2962
+ }
2963
+ .icon-arrow-down:before{
2964
+ content:"\e214";
2965
+ }
2960
2966
  .icon-qiehuan:before{
2961
2967
  content:"\e20c";
2962
2968
  }
@@ -2975,6 +2981,15 @@ url("fonts/iconcool.eot?#iefix") format("embedded-opentype");
2975
2981
  .icon-fix-shape:before{
2976
2982
  content:"\e212";
2977
2983
  }
2984
+ .icon-arrow-left:before{
2985
+ content:"\e215";
2986
+ }
2987
+ .icon-arrow-right:before{
2988
+ content:"\e216";
2989
+ }
2990
+ .icon-assistant:before{
2991
+ content:"\e217";
2992
+ }
2978
2993
  .f10{
2979
2994
  font-size:10px!important;
2980
2995
  }
@@ -7217,6 +7232,14 @@ span.bk-date-picker-cells-cell-disabled.bk-date-picker-cells-cell-selected em{
7217
7232
  .bk-message-content.multi .message-detail .message-tree .message-row label::after{
7218
7233
  content:':';
7219
7234
  }
7235
+ .bk-message-content.multi .message-detail .message-tree .message-row .copy-value{
7236
+ padding:0px 4px
7237
+ }
7238
+ .bk-message-content.multi .message-detail .message-tree .message-row .copy-value:hover{
7239
+ background:rgba(186, 188, 192, 0.2);
7240
+ cursor:pointer;
7241
+ border-radius:2px;
7242
+ }
7220
7243
  .bk-message-content.multi .message-detail .message-copy{
7221
7244
  position:absolute;
7222
7245
  top:20px;
@@ -7227,68 +7250,67 @@ span.bk-date-picker-cells-cell-disabled.bk-date-picker-cells-cell-selected em{
7227
7250
  .bk-message-content.multi .message-detail .message-copy:hover span{
7228
7251
  color:#3a84ff;
7229
7252
  }
7230
- .bk-message-content.multi .message-detail .message-copy .copy-status{
7231
- display:none;
7232
- padding-bottom:4px;
7253
+ .bk-message-content.multi .message-detail .copy-status{
7254
+ display:none;
7255
+ padding-bottom:4px;
7256
+ }
7257
+ .bk-message-content.multi .message-detail .copy-status .inner{
7258
+ position:relative;
7259
+ display:-webkit-box;
7260
+ display:-ms-flexbox;
7261
+ display:flex;
7262
+ padding:6px 8px;
7263
+ font-size:12px;
7264
+ line-height:20px;
7265
+ color:#63656e;
7266
+ background:#fff;
7267
+ border:1px solid #dcdee5;
7268
+ -webkit-box-shadow:0 2px 6px 0 rgba(0,0,0,0.10196);
7269
+ box-shadow:0 2px 6px 0 rgba(0,0,0,0.10196);
7270
+ -webkit-box-align:center;
7271
+ -ms-flex-align:center;
7272
+ align-items:center;
7233
7273
  }
7234
- .bk-message-content.multi .message-detail .message-copy .copy-status .inner{
7235
- position:relative;
7236
- display:-webkit-box;
7237
- display:-ms-flexbox;
7238
- display:flex;
7239
- padding:6px 8px;
7240
- font-size:12px;
7241
- line-height:20px;
7242
- color:#63656e;
7274
+ .bk-message-content.multi .message-detail .copy-status .inner span{
7275
+ margin-right:4px;
7276
+ }
7277
+ .bk-message-content.multi .message-detail .copy-status .inner::after{
7278
+ position:absolute;
7279
+ bottom:0;
7280
+ left:50%;
7281
+ width:8px;
7282
+ height:8px;
7243
7283
  background:#fff;
7244
- border:1px solid #dcdee5;
7245
- -webkit-box-shadow:0 2px 6px 0 rgba(0,0,0,0.10196);
7246
- box-shadow:0 2px 6px 0 rgba(0,0,0,0.10196);
7247
- -webkit-box-align:center;
7248
- -ms-flex-align:center;
7249
- align-items:center;
7250
- }
7251
- .bk-message-content.multi .message-detail .message-copy .copy-status .inner span{
7252
- margin-right:4px;
7284
+ border-color:#dcdee5;
7285
+ border-style:solid;
7286
+ border-width:0px 1px 1px 0px;
7287
+ content:'';
7288
+ -webkit-transform:translate(0, 4px) rotate(45deg);
7289
+ transform:translate(0, 4px) rotate(45deg);
7290
+ -webkit-box-shadow:5px 3px 6px 0 rgba(0,0,0,0.10196);
7291
+ box-shadow:5px 3px 6px 0 rgba(0,0,0,0.10196);
7292
+ -webkit-box-sizing:border-box;
7293
+ box-sizing:border-box;
7294
+ }
7295
+ .bk-message-content.multi .message-detail .copy-status.success .inner span{
7296
+ color:#2dcb9d;
7253
7297
  }
7254
- .bk-message-content.multi .message-detail .message-copy .copy-status .inner::after{
7255
- position:absolute;
7256
- bottom:0;
7257
- left:50%;
7258
- width:8px;
7259
- height:8px;
7260
- background:#fff;
7261
- border-color:#dcdee5;
7262
- border-style:solid;
7263
- border-width:0px 1px 1px 0px;
7264
- content:'';
7265
- -webkit-transform:translate(0, 4px) rotate(45deg);
7266
- transform:translate(0, 4px) rotate(45deg);
7267
- -webkit-box-shadow:5px 3px 6px 0 rgba(0,0,0,0.10196);
7268
- box-shadow:5px 3px 6px 0 rgba(0,0,0,0.10196);
7269
- -webkit-box-sizing:border-box;
7270
- box-sizing:border-box;
7298
+ .bk-message-content.multi .message-detail .copy-status.error .inner span{
7299
+ color:#ea3636;
7271
7300
  }
7272
- .bk-message-content.multi .message-detail .message-copy .copy-status.success .inner span{
7273
- color:#2dcb9d;
7274
- }
7275
- .bk-message-content.multi .message-detail .message-copy .copy-status.error .inner span{
7276
- color:#ea3636;
7277
- }
7278
- .bk-message-content.multi .message-detail .message-copy .copy-status.is-show{
7279
- position:absolute;
7280
- top:0;
7281
- left:0;
7282
- display:-webkit-inline-box;
7283
- display:-ms-inline-flexbox;
7284
- display:inline-flex;
7285
- white-space:nowrap;
7286
- -webkit-transform:translate(-50%, -100%);
7287
- transform:translate(-50%, -100%);
7288
- }
7289
- .bk-message-content.multi .message-detail .message-copy .copy-status.is-hidden{
7290
- display:none;
7291
- }
7301
+ .bk-message-content.multi .message-detail .copy-status.is-show{
7302
+ position:absolute;
7303
+ top:0;
7304
+ left:0;
7305
+ display:-webkit-inline-box;
7306
+ display:-ms-inline-flexbox;
7307
+ display:inline-flex;
7308
+ white-space:nowrap;
7309
+ }
7310
+ .bk-message-content.multi .message-detail .copy-status.is-hidden{
7311
+ top:-9999;
7312
+ left:-9999;
7313
+ }
7292
7314
  .bk-notify{
7293
7315
  display:-webkit-box;
7294
7316
  display:-ms-flexbox;
@@ -30942,6 +30942,12 @@
30942
30942
  copyStatusTimer: null
30943
30943
  };
30944
30944
  },
30945
+ mounted: function mounted() {
30946
+ this.addMouseKeyEvent();
30947
+ },
30948
+ beforeDestroy: function beforeDestroy() {
30949
+ this.addMouseKeyEvent(true);
30950
+ },
30945
30951
  computed: {
30946
30952
  defActionList: function defActionList() {
30947
30953
  var _this = this,
@@ -30950,7 +30956,7 @@
30950
30956
  id: IMessageActionType.ASSISTANT,
30951
30957
  icon: function icon(h) {
30952
30958
  return h('span', {
30953
- class: 'bk-icon icon-weixin-pro'
30959
+ class: 'bk-icon icon-assistant'
30954
30960
  });
30955
30961
  },
30956
30962
  text: function text() {
@@ -31045,6 +31051,19 @@
31045
31051
  }
31046
31052
  },
31047
31053
  methods: {
31054
+ addMouseKeyEvent: function addMouseKeyEvent() {
31055
+ var remove = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
31056
+ if (remove) {
31057
+ document.removeEventListener('keydown', this.handleMouseKeyEvent);
31058
+ return;
31059
+ }
31060
+ document.addEventListener('keydown', this.handleMouseKeyEvent);
31061
+ },
31062
+ handleMouseKeyEvent: function handleMouseKeyEvent(e) {
31063
+ if (e.altKey && e.keyCode === 80) {
31064
+ this.fixMesage(e);
31065
+ }
31066
+ },
31048
31067
  handleCloseClick: function handleCloseClick() {
31049
31068
  this.$emit('close');
31050
31069
  },
@@ -31057,15 +31076,24 @@
31057
31076
  var _this3 = this;
31058
31077
  this.toolOperation.isDetailShow = isShow !== undefined ? isShow : !this.toolOperation.isDetailShow;
31059
31078
  this.fixMesage(e, this.toolOperation.isDetailShow);
31060
- if (this.toolOperation.isDetailShow && _typeof(this.message) === 'object' && (this.message.type === MessageContentType.JSON || !this.message.type)) {
31061
- var targetJson = this.parseJson(this.message.details);
31062
- var formatter = new jsonFormatter_umd(targetJson);
31063
- setTimeout(function () {
31064
- if (_this3.$refs.refJsonContent) {
31065
- _this3.$refs.refJsonContent.innerHTML = '';
31066
- _this3.$refs.refJsonContent.append(formatter.render());
31067
- }
31068
- });
31079
+ if (this.toolOperation.isDetailShow && _typeof(this.message) === 'object' && !this.message.hasOwnProperty('componentOptions')) {
31080
+ if (this.message.type === MessageContentType.JSON || !this.message.type) {
31081
+ var targetJson = this.parseJson(this.message.details);
31082
+ var formatter = new jsonFormatter_umd(targetJson);
31083
+ setTimeout(function () {
31084
+ if (_this3.$refs.refJsonContent) {
31085
+ _this3.$refs.refJsonContent.innerHTML = '';
31086
+ _this3.$refs.refJsonContent.append(formatter.render());
31087
+ }
31088
+ _this3.copyMessage();
31089
+ });
31090
+ }
31091
+ if (this.message.type === MessageContentType.KEY_VALUE) {
31092
+ setTimeout(function () {
31093
+ _this3.copyMessage();
31094
+ _this3.setCopyValueItems();
31095
+ });
31096
+ }
31069
31097
  }
31070
31098
  },
31071
31099
  fixMesage: function fixMesage(e, isFix) {
@@ -31083,49 +31111,82 @@
31083
31111
  }
31084
31112
  return targetJson;
31085
31113
  },
31086
- copyMessage: function copyMessage() {
31087
- var _this4 = this;
31088
- if (this.isInstallClipboardJS) {
31089
- return;
31090
- }
31091
- var copyInstance = new ClipboardJS(this.$refs.refCopyMsgDiv, {
31092
- text: function text() {
31093
- return _this4.message.details;
31114
+ setCopyValueItems: function setCopyValueItems() {
31115
+ var copyInstance = new ClipboardJS(this.$refs.refJsonContent.querySelectorAll('span.copy-value'), {
31116
+ text: function text(trigger) {
31117
+ return trigger.innerHTML;
31094
31118
  }
31095
31119
  });
31120
+ this.registerCopyCallback(copyInstance);
31121
+ },
31122
+ registerCopyCallback: function registerCopyCallback(copyInstance, complete) {
31123
+ var _this4 = this;
31096
31124
  ['success', 'error'].forEach(function (theme) {
31097
- copyInstance.on(theme, function () {
31125
+ copyInstance.on(theme, function (e) {
31126
+ console.log('registerCopyCallback theme', theme);
31098
31127
  var target = _this4.$refs.refCopyStatus;
31099
31128
  _this4.copyStatus = theme;
31100
- if (target) {
31101
- var _target$classList, _target$classList2;
31102
- (_target$classList = target.classList).remove.apply(_target$classList, ['success', 'error', 'is-hidden']);
31103
- (_target$classList2 = target.classList).add.apply(_target$classList2, [theme, 'is-show']);
31104
- _this4.copyStatusTimer && clearTimeout(_this4.copyStatusTimer);
31105
- _this4.copyStatusTimer = setTimeout(function () {
31106
- var _target$classList3, _target$classList4;
31107
- (_target$classList3 = target.classList).remove.apply(_target$classList3, ['is-show']);
31108
- (_target$classList4 = target.classList).add.apply(_target$classList4, ['is-hidden']);
31109
- }, 2000);
31110
- }
31111
- });
31112
- _this4.isInstallClipboardJS = true;
31113
- setTimeout(function () {
31114
- _this4.$refs.refCopyMsgDiv.click();
31129
+ _this4.$nextTick(function () {
31130
+ if (target) {
31131
+ var _target$classList, _target$classList2;
31132
+ var _e$trigger = e.trigger,
31133
+ offsetLeft = _e$trigger.offsetLeft,
31134
+ offsetWidth = _e$trigger.offsetWidth,
31135
+ offsetTop = _e$trigger.offsetTop;
31136
+ (_target$classList = target.classList).remove.apply(_target$classList, ['success', 'error', 'is-hidden']);
31137
+ (_target$classList2 = target.classList).add.apply(_target$classList2, [theme, 'is-show']);
31138
+ var msgTree = e.trigger.closest('.message-tree');
31139
+ var msgTreeScrollTop = msgTree ? msgTree.scrollTop : 0;
31140
+ var transX = offsetLeft + offsetWidth / 2 - 41;
31141
+ var transY = offsetTop - msgTreeScrollTop - 40;
31142
+ target.style.setProperty('transform', "translate(".concat(transX, "px, ").concat(transY, "px"));
31143
+ _this4.copyStatusTimer && clearTimeout(_this4.copyStatusTimer);
31144
+ _this4.copyStatusTimer = setTimeout(function () {
31145
+ var _target$classList3, _target$classList4;
31146
+ (_target$classList3 = target.classList).remove.apply(_target$classList3, ['is-show']);
31147
+ (_target$classList4 = target.classList).add.apply(_target$classList4, ['is-hidden']);
31148
+ }, 2000);
31149
+ }
31150
+ if (typeof complete === 'function') {
31151
+ complete();
31152
+ }
31153
+ });
31115
31154
  });
31116
31155
  });
31156
+ },
31157
+ parseToString: function parseToString(value) {
31158
+ var targetStr = value;
31159
+ if (_typeof(value) === 'object') {
31160
+ try {
31161
+ targetStr = stringify$1(value);
31162
+ } catch (e) {
31163
+ console.error("JSON.stringify Error: ".concat(e));
31164
+ }
31165
+ }
31166
+ return targetStr;
31167
+ },
31168
+ copyMessage: function copyMessage() {
31169
+ var _this5 = this;
31170
+ var copyInstance = new ClipboardJS(this.$refs.refCopyMsgDiv, {
31171
+ text: function text() {
31172
+ return _this5.parseToString(_this5.message.details);
31173
+ }
31174
+ });
31175
+ this.registerCopyCallback(copyInstance);
31117
31176
  }
31118
31177
  },
31119
31178
  render: function render(h) {
31120
- var _this5 = this;
31179
+ var _this6 = this;
31121
31180
  var renderMsgDetail = function renderMsgDetail(msg) {
31122
31181
  if (msg.type === MessageContentType.KEY_VALUE) {
31123
- var target = _this5.parseJson(msg.details || {});
31182
+ var target = _this6.parseJson(msg.details || {});
31124
31183
  var keys = keys$1(target);
31125
31184
  return keys.map(function (key) {
31126
31185
  return h('div', {
31127
31186
  class: 'message-row'
31128
- }, [h('label', key), target[key]]);
31187
+ }, [h('label', key), h('span', {
31188
+ class: 'copy-value'
31189
+ }, target[key])]);
31129
31190
  });
31130
31191
  }
31131
31192
  return null;
@@ -31134,7 +31195,7 @@
31134
31195
  var renderIcon = function renderIcon(_ref2) {
31135
31196
  var icon = _ref2.icon;
31136
31197
  if (typeof icon === 'function') {
31137
- return apply$1(icon, _this5, [h]);
31198
+ return apply$1(icon, _this6, [h]);
31138
31199
  }
31139
31200
  return h('span', {
31140
31201
  class: icon
@@ -31144,7 +31205,7 @@
31144
31205
  var text = _ref3.text;
31145
31206
  var content;
31146
31207
  if (typeof text === 'function') {
31147
- content = apply$1(text, _this5, [h]);
31208
+ content = apply$1(text, _this6, [h]);
31148
31209
  }
31149
31210
  if (content === undefined) {
31150
31211
  return;
@@ -31161,16 +31222,16 @@
31161
31222
  return;
31162
31223
  }
31163
31224
  if (typeof action.onClick === 'function') {
31164
- apply$1(action.onClick, _this5, [e, action]);
31225
+ apply$1(action.onClick, _this6, [e, action]);
31165
31226
  }
31166
31227
  };
31167
31228
  var renderActionList = function renderActionList() {
31168
- return _this5.actionList.map(function (action) {
31229
+ return _this6.actionList.map(function (action) {
31169
31230
  if (action.disabled) {
31170
31231
  return null;
31171
31232
  }
31172
31233
  if (typeof action.render === 'function') {
31173
- return apply$1(action.render, _this5, []);
31234
+ return apply$1(action.render, _this6, []);
31174
31235
  }
31175
31236
  var classList = isArray$1(action.classList) ? action.classList.join(' ') : action.classList;
31176
31237
  return h('div', {
@@ -31207,20 +31268,17 @@
31207
31268
  class: 'message-detail'
31208
31269
  }, [h('div', {
31209
31270
  class: 'message-copy',
31210
- ref: 'refCopyMsgDiv',
31211
- on: {
31212
- click: this.copyMessage
31213
- }
31271
+ ref: 'refCopyMsgDiv'
31214
31272
  }, [h('span', {
31215
31273
  class: 'bk-icon icon-copy-shape'
31216
- }), h('div', {
31274
+ })]), h('div', {
31217
31275
  class: ['copy-status', this.copyStatus],
31218
31276
  ref: 'refCopyStatus'
31219
31277
  }, [h('div', {
31220
31278
  class: 'inner'
31221
31279
  }, [h('span', {
31222
31280
  class: [iconMap[this.copyStatus], this.copyStatus]
31223
- }), this.copyStatus === 'success' ? this.t('bk.message.copySuccess') : this.t('bk.message.copyFailed')])])]), h('div', {
31281
+ }), this.copyStatus === 'success' ? this.t('bk.message.copySuccess') : this.t('bk.message.copyFailed')])]), h('div', {
31224
31282
  class: 'message-tree',
31225
31283
  ref: 'refJsonContent'
31226
31284
  }, [renderMsgDetail(this.message)])]) : null]);