pixuireactcomponents 1.3.77 → 1.3.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixuireactcomponents",
3
- "version": "1.3.77",
3
+ "version": "1.3.79",
4
4
  "description": "pixui react components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -43,27 +43,20 @@ var isJssdkEnv = function () {
43
43
  };
44
44
  //动态导入lib_mgr
45
45
  var getLibMgr = function () { return __awaiter(void 0, void 0, void 0, function () {
46
- var LibMgr, module_1, error_1;
46
+ var module_1, error_1;
47
47
  return __generator(this, function (_a) {
48
48
  switch (_a.label) {
49
49
  case 0:
50
- if (!window.require) {
51
- console.error('env error');
52
- return [2 /*return*/, null];
53
- }
54
- _a.label = 1;
55
- case 1:
56
- _a.trys.push([1, 3, , 4]);
50
+ _a.trys.push([0, 2, , 3]);
57
51
  return [4 /*yield*/, import('../../../lib/loadlib/lib_mgr')];
58
- case 2:
52
+ case 1:
59
53
  module_1 = _a.sent();
60
- LibMgr = module_1.LibMgr;
61
- return [3 /*break*/, 4];
62
- case 3:
54
+ return [2 /*return*/, module_1.LibMgr];
55
+ case 2:
63
56
  error_1 = _a.sent();
64
57
  console.error('need puerts env');
65
58
  return [2 /*return*/, null];
66
- case 4: return [2 /*return*/, LibMgr];
59
+ case 3: return [2 /*return*/];
67
60
  }
68
61
  });
69
62
  }); };
@@ -122,6 +122,16 @@ export var tools;
122
122
  for (var i = 1; i <= 10; i++) {
123
123
  _loop_1(i);
124
124
  }
125
+ //每个 p 节点后添加一个 br 节点
126
+ $('p').each(function () {
127
+ $(this).after('<br>');
128
+ });
129
+ //将所有的<p><br></p>改成<br>,否则之后 br 会被套在 div 里失效
130
+ $('p').each(function () {
131
+ if (($(this).html() || '').trim() === '<br>') {
132
+ $(this).replaceWith('<br>');
133
+ }
134
+ });
125
135
  //找到所有的文字节点,外层包裹text标签
126
136
  $('*').each(function () {
127
137
  $(this)
@@ -161,14 +171,17 @@ export var tools;
161
171
  var style = $(this).attr('style') || '';
162
172
  $(this).replaceWith("<text style=\"".concat(style, " flex-shrink: 0;\">").concat(html, "</text>"));
163
173
  });
174
+ //p换成div
164
175
  $('p').each(function () {
165
176
  var html = $(this).html();
166
177
  var style = $(this).attr('style') || '';
167
178
  $(this).replaceWith("<div style=\"".concat(style, " ;flex-shrink: 0;\">").concat(html, "</div>"));
168
179
  });
180
+ //pixui 连续的 br 会被吃掉,用 div 占位
169
181
  $('br').each(function () {
170
- $(this).replaceWith("<br><div style = \"width:50px;height:15px;\" />");
182
+ $(this).replaceWith("<br><div style = \"width:50px; height:15px; flex-shrink: 0;\" />");
171
183
  });
184
+ //补充 flex-shrink: 0
172
185
  ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'a', 'img'].forEach(function (tag) {
173
186
  $("".concat(tag)).each(function () {
174
187
  var style = $(this).attr('style') || '';
@@ -217,6 +230,25 @@ export var tools;
217
230
  $(this).replaceWith("<".concat(tag, " style=\"").concat(tagstyle, "\"><text>").concat(taghtml, "</text></").concat(tag, ">"));
218
231
  });
219
232
  });
233
+ //pixui 的 line-height只在 text 上生效,所以将所有的 div 上的 line-height 转移到父 text 上
234
+ //当前的结构为 div > text > div,只处理一层就行
235
+ //遍历每个 text 的子 div,将其中最大的 line-height 转移到 text 上
236
+ $('text').each(function () {
237
+ var $text = $(this);
238
+ var maxLineHeight = 0;
239
+ $text.children('div').each(function () {
240
+ var lineHeight = $(this).css('line-height') || '0';
241
+ var lineHeightNum = parseInt(lineHeight);
242
+ if (lineHeightNum > maxLineHeight) {
243
+ maxLineHeight = lineHeightNum;
244
+ }
245
+ // $(this).css('line-height', '0');
246
+ });
247
+ if (maxLineHeight > 0) {
248
+ // pixui 中的实际显示的距离与网页中实际显示的距离差距较大,暂时*5rem
249
+ $text.css('line-height', maxLineHeight * 5 + 'rem');
250
+ }
251
+ });
220
252
  if (aLabelData) {
221
253
  $('a').each(function (i, ele) {
222
254
  var id = "PA_RichTextATagId_".concat(i);