hrsass-components 2.2.7 → 2.2.9

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.
@@ -65,7 +65,7 @@ var contentStyle = _interopDefault(require('!!raw-loader!tinymce/skins/content/d
65
65
  var SvgPanZoom = _interopDefault(require('svg-pan-zoom'));
66
66
  var saveSvgAsPng = require('save-svg-as-png');
67
67
 
68
- var version = "2.2.7";
68
+ var version = "2.2.9";
69
69
 
70
70
  /**
71
71
  * 版本号
@@ -4080,6 +4080,9 @@ var browserVersion = {
4080
4080
 
4081
4081
  function ownKeys$8(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4082
4082
  function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$8(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4083
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
4084
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4085
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
4083
4086
  console.log('navigator.userAgent', navigator.userAgent);
4084
4087
  if (!browserVersion.ltIe11) {
4085
4088
  // 主题
@@ -4093,11 +4096,72 @@ if (!browserVersion.ltIe11) {
4093
4096
  // import contentStyle from '!!raw-loader!tinymce/skins/content/dark/content.css';
4094
4097
 
4095
4098
  var myStyle = "\ntable tr.hiddenby0{\n display: none;\n}\ntable tr[class*=hiddenby0-]{\n background-color: #fcdcdb;\n}\n";
4099
+ /**
4100
+ *
4101
+ * rtf中提取图片信息
4102
+ * 利用正则从rtf内容中提取到图片的核心信息,得到数组。其中数组中保存的信息有
4103
+ {
4104
+ type: ‘’, //图片类型
4105
+ hex: ‘’ // hex字符串
4106
+ }
4107
+ * @param {*} rtfData
4108
+ */
4109
+ function extractImageDataFromRtf(rtfData) {
4110
+ if (!rtfData) {
4111
+ return [];
4112
+ }
4113
+ var regexPictureHeader = /{\\pict[\s\S]+?({\\\*\\blipuid\s?[\da-fA-F]+)[\s}]*/;
4114
+ var regexPicture = new RegExp('(?:(' + regexPictureHeader.source + '))([\\da-fA-F\\s]+)\\}', 'g');
4115
+ var images = rtfData.match(regexPicture);
4116
+ var result = [];
4117
+ if (images) {
4118
+ var _iterator = _createForOfIteratorHelper(images),
4119
+ _step;
4120
+ try {
4121
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
4122
+ var image = _step.value;
4123
+ var imageType = false;
4124
+ if (image.includes('\\pngblip')) {
4125
+ imageType = 'image/png';
4126
+ } else if (image.includes('\\jpegblip')) {
4127
+ imageType = 'image/jpeg';
4128
+ }
4129
+ if (imageType) {
4130
+ result.push({
4131
+ hex: image.replace(regexPictureHeader, '').replace(/[^\da-fA-F]/g, ''),
4132
+ type: imageType
4133
+ });
4134
+ }
4135
+ }
4136
+ } catch (err) {
4137
+ _iterator.e(err);
4138
+ } finally {
4139
+ _iterator.f();
4140
+ }
4141
+ }
4142
+ return result;
4143
+ }
4144
+ function hexStringToBlob(hexString) {
4145
+ // 将十六进制字符串转换为字节数组
4146
+ var byteArray = new Uint8Array(hexString.match(/.{2}/g).map(function (hexVal) {
4147
+ return parseInt(hexVal, 16);
4148
+ }));
4149
+
4150
+ // 使用二进制数据创建Blob对象
4151
+ var blob = new Blob([byteArray], {
4152
+ type: 'application/octet-stream'
4153
+ });
4154
+ return blob;
4155
+ }
4096
4156
  var HrRichText = {
4097
4157
  props: _objectSpread$8(_objectSpread$8({}, Editor.props), {}, {
4098
4158
  readOnly: {
4099
4159
  type: Boolean,
4100
4160
  "default": false
4161
+ },
4162
+ loading: {
4163
+ type: Boolean,
4164
+ "default": false
4101
4165
  }
4102
4166
  }),
4103
4167
  watch: {
@@ -4119,11 +4183,13 @@ var HrRichText = {
4119
4183
  },
4120
4184
  data: function data() {
4121
4185
  return {
4122
- content_style: ''
4186
+ content_style: '',
4187
+ reloading: false
4123
4188
  };
4124
4189
  },
4125
4190
  computed: {
4126
4191
  initReset: function initReset() {
4192
+ var _this = this;
4127
4193
  return _objectSpread$8({
4128
4194
  // 样式内联填充进去
4129
4195
  content_style: uiStyle.toString() + '\n' + contentStyle.toString() + '\n' + myStyle,
@@ -4132,7 +4198,58 @@ var HrRichText = {
4132
4198
  // 多语言
4133
4199
  language: 'zh_CN',
4134
4200
  branding: false,
4135
- convert_urls: false
4201
+ convert_urls: false,
4202
+ paste_enable_default_filters: false,
4203
+ paste_data_images: true,
4204
+ font_formats: "微软雅黑='微软雅黑';宋体='宋体';黑体='黑体';仿宋='仿宋';楷体='楷体';隶书='隶书';幼圆='幼圆';Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings",
4205
+ images_upload_handler: function images_upload_handler(blobInfo, success, failure) {
4206
+ console.log('images_upload_handler', blobInfo, success, failure);
4207
+ var formData = new FormData();
4208
+ formData.append('file', blobInfo.blob(), blobInfo.filename());
4209
+ _this.$axios({
4210
+ url: _this.init.upload_url || "/file.nolog?method=upload&temp=false&storageType=fileSystem",
4211
+ method: 'post',
4212
+ processData: false,
4213
+ headers: {
4214
+ token: _this.$pq.get('token')
4215
+ },
4216
+ data: formData
4217
+ }).then(function (res) {
4218
+ console.log('res', res);
4219
+ var url = _this.init.preview_url ? "".concat(_this.init.preview_url).concat(_this.init.preview_url.includes('?') ? '&' : '?', "fileId=").concat(res.fileId) : "/platform_web_portal_war_exploded/file.nolog?method=preview&fileId=".concat(res.fileId);
4220
+ success(url);
4221
+ })["catch"](function (err) {
4222
+ console.log('err', err);
4223
+ failure('上传失败');
4224
+ });
4225
+ },
4226
+ init_instance_callback: function init_instance_callback(editor) {
4227
+ var _that = _this;
4228
+ editor.on('paste', function (e) {
4229
+ console.log('paste', e);
4230
+ var data = e.clipboardData.getData('text/rtf');
4231
+ var imagesHex = extractImageDataFromRtf(data);
4232
+ if (imagesHex.length) {
4233
+ editor.dom.select('img').forEach(function (img, i) {
4234
+ var formData = new FormData();
4235
+ formData.append('file', hexStringToBlob(imagesHex[i].hex), "image".concat(i, ".png"));
4236
+ _that.$axios({
4237
+ url: _that.init.upload_url || "/file.nolog?method=upload&temp=false&storageType=fileSystem",
4238
+ method: 'post',
4239
+ processData: false,
4240
+ headers: {
4241
+ token: _that.$pq.get('token')
4242
+ },
4243
+ data: formData
4244
+ }).then(function (res) {
4245
+ editor.dom.setAttribs(img, {
4246
+ src: _that.init.preview_url ? "".concat(_that.init.preview_url).concat(_that.init.preview_url.includes('?') ? '&' : '?', "fileId=").concat(res.fileId) : "/platform_web_portal_war_exploded/file.nolog?method=preview&fileId=".concat(res.fileId)
4247
+ });
4248
+ });
4249
+ });
4250
+ }
4251
+ });
4252
+ }
4136
4253
  }, this.init);
4137
4254
  }
4138
4255
  },
@@ -4148,9 +4265,40 @@ var HrRichText = {
4148
4265
  require("tinymce/plugins/emoticons/js/emojis");
4149
4266
  }
4150
4267
  });
4268
+ },
4269
+ reload: function reload() {
4270
+ var _this2 = this;
4271
+ this.reloading = true;
4272
+ this.$nextTick(function () {
4273
+ _this2.reloading = false;
4274
+ });
4275
+ },
4276
+ getVmParentByName: function getVmParentByName(vm, name) {
4277
+ var parent = vm.$parent;
4278
+ if (parent && parent.$options) {
4279
+ if (parent.$options.name === name) {
4280
+ return parent;
4281
+ } else {
4282
+ var res = this.getVmParentByName(parent, name);
4283
+ if (res) {
4284
+ return res;
4285
+ }
4286
+ }
4287
+ }
4288
+ return null;
4289
+ },
4290
+ initATabsChangeAutoReload: function initATabsChangeAutoReload() {
4291
+ var modal = this.getVmParentByName(this, 'ADrawer') || this.getVmParentByName(this, 'AModal') || this.getVmParentByName(this, 'ATabs');
4292
+ if (modal) {
4293
+ this.reload();
4294
+ }
4151
4295
  }
4152
4296
  },
4153
- mounted: function mounted() {},
4297
+ mounted: function mounted() {
4298
+ console.log('mounted--rich-text', this.$refs);
4299
+ // tinymce.init({});
4300
+ this.initATabsChangeAutoReload();
4301
+ },
4154
4302
  render: function render() {
4155
4303
  var h = arguments[0];
4156
4304
  var props = _objectSpread$8(_objectSpread$8({}, this.$props), {}, {
@@ -4180,12 +4328,24 @@ var HrRichText = {
4180
4328
  });
4181
4329
  }
4182
4330
  } else {
4183
- widget = h("div", {
4184
- "class": "hr-rich-text"
4185
- }, [h(Editor, {
4186
- props: props,
4187
- on: this.$listeners
4188
- })]);
4331
+ if (!this.reloading) {
4332
+ widget = h("div", {
4333
+ "class": "hr-rich-text"
4334
+ }, [h(antDesignVue.Spin, {
4335
+ attrs: {
4336
+ spinning: this.loading,
4337
+ size: "small"
4338
+ }
4339
+ }, [h(Editor, {
4340
+ props: props,
4341
+ on: this.$listeners,
4342
+ ref: 'editor'
4343
+ })])]);
4344
+ } else {
4345
+ widget = h("div", {
4346
+ "class": "hr-rich-text loading"
4347
+ });
4348
+ }
4189
4349
  }
4190
4350
  return widget;
4191
4351
  }
@@ -13234,8 +13394,9 @@ var HrAddrBookCard = {
13234
13394
  console.log(list, sort);
13235
13395
  if (sort.length > 0) {
13236
13396
  list.children.sort(function (a, b) {
13237
- var fieldKeyA = a.data.attrs.fieldKey;
13238
- var fieldKeyB = b.data.attrs.fieldKey;
13397
+ var _a$data, _b$data;
13398
+ var fieldKeyA = (a === null || a === void 0 || (_a$data = a.data) === null || _a$data === void 0 || (_a$data = _a$data.attrs) === null || _a$data === void 0 ? void 0 : _a$data.fieldKey) || -1;
13399
+ var fieldKeyB = (b === null || b === void 0 || (_b$data = b.data) === null || _b$data === void 0 || (_b$data = _b$data.attrs) === null || _b$data === void 0 ? void 0 : _b$data.fieldKey) || -1;
13239
13400
  var indexA = sort.indexOf(fieldKeyA);
13240
13401
  var indexB = sort.indexOf(fieldKeyB);
13241
13402
  if (indexA === -1 && indexB === -1) {