@panpanzhao/component-ui 0.0.13 → 0.0.15

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.
@@ -200,350 +200,9 @@ function normalizeComponent(
200
200
  /***/ }),
201
201
 
202
202
  /***/ 20:
203
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
204
-
205
- "use strict";
206
-
207
- // EXPORTS
208
- __webpack_require__.d(__webpack_exports__, "e", function() { return /* reexport */ uuid; });
209
- __webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ eachTree; });
210
- __webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ findTree; });
211
- __webpack_require__.d(__webpack_exports__, "c", function() { return /* reexport */ findTreeIndex; });
212
- __webpack_require__.d(__webpack_exports__, "d", function() { return /* reexport */ spliceTreeSelf; });
213
-
214
- // UNUSED EXPORTS: mapTree, getTree, filterTree, everyTree, someTree, spliceTree, getTreeDepth, getTreeAncestors, getTreeParent
215
-
216
- // CONCATENATED MODULE: ./src/utils/helper.js
217
- // 参考 https://github.com/streamich/v4-uuid
218
- var str = function str() {
219
- return ('00000000000000000' + (Math.random() * 0xffffffffffffffff).toString(16)).slice(-16);
220
- };
221
- var uuid = function uuid() {
222
- var a = str();
223
- var b = str();
224
- return a.slice(0, 8) + '-' + a.slice(8, 12) + '-4' + a.slice(13) + '-a' + b.slice(1, 4) + '-' + b.slice(4);
225
- };
226
- // CONCATENATED MODULE: ./src/utils/tree.js
227
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
228
- /**
229
- * 类似于 arr.map 方法,此方法主要针对类似下面示例的树形结构。
230
- * [
231
- * {
232
- * children: []
233
- * },
234
- * // 其他成员
235
- * ]
236
- *
237
- * @param {Tree} tree 树形数据
238
- * @param {Function} iterator 处理函数,返回的数据会被替换成新的。
239
- * @return {Tree} 返回处理过的 tree
240
- */
241
- function mapTree(tree, iterator, level, depthFirst, paths) {
242
- if (level === void 0) {
243
- level = 1;
244
- }
245
- if (depthFirst === void 0) {
246
- depthFirst = false;
247
- }
248
- if (paths === void 0) {
249
- paths = [];
250
- }
251
- return tree.map(function (item, index) {
252
- if (depthFirst) {
253
- var children = item.children ? mapTree(item.children, iterator, level + 1, depthFirst, paths.concat(item)) : undefined;
254
- children && (item = _extends({}, item, {
255
- children: children
256
- }));
257
- item = iterator(item, index, level, paths) || _extends({}, item);
258
- return item;
259
- }
260
- item = iterator(item, index, level, paths) || _extends({}, item);
261
- if (item.children && item.children.splice) {
262
- item.children = mapTree(item.children, iterator, level + 1, depthFirst, paths.concat(item));
263
- }
264
- return item;
265
- });
266
- }
267
-
268
- /**
269
- * 遍历树
270
- * @param tree
271
- * @param iterator
272
- */
273
- function eachTree(tree, iterator, level, paths) {
274
- if (level === void 0) {
275
- level = 1;
276
- }
277
- if (paths === void 0) {
278
- paths = [];
279
- }
280
- tree.map(function (item, index) {
281
- var currentPath = paths.concat(item);
282
- iterator(item, index, level, currentPath);
283
- if (item.children && item.children.splice) {
284
- eachTree(item.children, iterator, level + 1, currentPath);
285
- }
286
- });
287
- }
288
- /**
289
- * 在树中查找节点。
290
- * @param tree
291
- * @param iterator
292
- */
293
- function findTree(tree, iterator) {
294
- var result = null;
295
- everyTree(tree, function (item, key, level, paths) {
296
- if (iterator(item, key, level, paths)) {
297
- result = item;
298
- return false;
299
- }
300
- return true;
301
- });
302
- return result;
303
- }
304
-
305
- /**
306
- * 在树中查找节点, 返回下标数组。
307
- * @param tree
308
- * @param iterator
309
- */
310
- function findTreeIndex(tree, iterator) {
311
- var idx = [];
312
- findTree(tree, function (item, index, level, paths) {
313
- if (iterator(item, index, level, paths)) {
314
- idx = [index];
315
- paths = paths.concat();
316
- paths.unshift({
317
- children: tree
318
- });
319
- for (var i = paths.length - 1; i > 0; i--) {
320
- var prev = paths[i - 1];
321
- var current = paths[i];
322
- idx.unshift(prev.children && prev.children.indexOf(current));
323
- }
324
- return true;
325
- }
326
- return false;
327
- });
328
- return idx.length ? idx : undefined;
329
- }
330
- function getTree(tree, idx) {
331
- var indexes = Array.isArray(idx) ? idx.concat() : [idx];
332
- var lastIndex = indexes.pop();
333
- var list = tree;
334
- for (var i = 0, len = indexes.length; i < len; i++) {
335
- var index = indexes[i];
336
- if (!list || !list[index]) {
337
- list = null;
338
- break;
339
- }
340
- list = list[index].children;
341
- }
342
- return list ? list[lastIndex] : undefined;
343
- }
344
- /**
345
- * 过滤树节点
346
- *
347
- * @param tree
348
- * @param iterator
349
- */
350
- function filterTree(tree, iterator, level, depthFirst) {
351
- if (level === void 0) {
352
- level = 1;
353
- }
354
- if (depthFirst === void 0) {
355
- depthFirst = false;
356
- }
357
- if (depthFirst) {
358
- return tree.map(function (item) {
359
- var children = item.children ? filterTree(item.children, iterator, level + 1, depthFirst) : undefined;
360
- if (Array.isArray(children) && Array.isArray(item.children)) {
361
- item = _extends({}, item, {
362
- children: children
363
- });
364
- }
365
- return item;
366
- }).filter(function (item, index) {
367
- return iterator(item, index, level);
368
- });
369
- }
370
- return tree.filter(function (item, index) {
371
- return iterator(item, index, level);
372
- }).map(function (item) {
373
- if (item.children && item.children.splice) {
374
- var children = filterTree(item.children, iterator, level + 1, depthFirst);
375
- if (Array.isArray(children) && Array.isArray(item.children)) {
376
- item = _extends({}, item, {
377
- children: children
378
- });
379
- }
380
- }
381
- return item;
382
- });
383
- }
384
-
385
- /**
386
- * 判断树中每个节点是否满足某个条件。
387
- * @param tree
388
- * @param iterator
389
- */
390
- function everyTree(tree, iterator, level, paths, indexes) {
391
- if (level === void 0) {
392
- level = 1;
393
- }
394
- if (paths === void 0) {
395
- paths = [];
396
- }
397
- if (indexes === void 0) {
398
- indexes = [];
399
- }
400
- if (!Array.isArray(tree)) {
401
- return false;
402
- }
403
- return tree.every(function (item, index) {
404
- var value = iterator(item, index, level, paths, indexes);
405
- if (value && item.children && item.children.splice) {
406
- return everyTree(item.children, iterator, level + 1, paths.concat(item), indexes.concat(index));
407
- }
408
- return value;
409
- });
410
- }
411
-
412
- /**
413
- * 判断树中是否有某些节点满足某个条件。
414
- * @param tree
415
- * @param iterator
416
- */
417
- function someTree(tree, iterator) {
418
- var result = false;
419
- everyTree(tree, function (item, key, level, paths) {
420
- if (iterator(item, key, level, paths)) {
421
- result = true;
422
- return false;
423
- }
424
- return true;
425
- });
426
- return result;
427
- }
428
-
429
- /**
430
- * 操作树,遵循 imutable, 每次返回一个新的树。
431
- * 类似数组的 splice 不同的地方这个方法不修改原始数据,
432
- * 同时第二个参数不是下标,而是下标数组,分别代表每一层的下标。
433
- *
434
- * 至于如何获取下标数组,请查看 findTreeIndex
435
- *
436
- * @param tree
437
- * @param idx
438
- * @param deleteCount
439
- * @param ...items
440
- */
441
- function spliceTree(tree, idx, deleteCount) {
442
- if (deleteCount === void 0) {
443
- deleteCount = 0;
444
- }
445
- var list = tree.concat();
446
- for (var _len = arguments.length, items = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
447
- items[_key - 3] = arguments[_key];
448
- }
449
- if (typeof idx === 'number') {
450
- list.splice.apply(list, [idx, deleteCount].concat(items));
451
- } else if (Array.isArray(idx) && idx.length) {
452
- idx = idx.concat();
453
- var lastIdx = idx.pop();
454
- var host = idx.reduce(function (list, idx) {
455
- var child = _extends({}, list[idx], {
456
- children: list[idx].children ? list[idx].children.concat() : []
457
- });
458
- list[idx] = child;
459
- return child.children;
460
- }, list);
461
- host.splice.apply(host, [lastIdx, deleteCount].concat(items));
462
- }
463
- return list;
464
- }
465
-
466
- /**
467
- * 计算树的深度
468
- * @param tree
469
- */
470
- function getTreeDepth(tree) {
471
- return Math.max.apply(Math, tree.map(function (item) {
472
- if (Array.isArray(item.children)) {
473
- return 1 + getTreeDepth(item.children);
474
- }
475
- return 1;
476
- }));
477
- }
478
-
479
- /**
480
- * 从树中获取某个值的所有祖先
481
- * @param tree
482
- * @param value
483
- */
484
- function getTreeAncestors(tree, value, includeSelf) {
485
- if (includeSelf === void 0) {
486
- includeSelf = false;
487
- }
488
- var ancestors = null;
489
- findTree(tree, function (item, index, level, paths) {
490
- if (item === value) {
491
- ancestors = paths;
492
- if (includeSelf) {
493
- ancestors.push(item);
494
- }
495
- return true;
496
- }
497
- return false;
498
- });
499
- return ancestors;
500
- }
501
-
502
- /**
503
- * 从树中获取某个值的上级
504
- * @param tree
505
- * @param value
506
- */
507
- function getTreeParent(tree, value) {
508
- var ancestors = getTreeAncestors(tree, value);
509
- return ancestors && ancestors.length ? ancestors[ancestors.length - 1] : null;
510
- }
511
-
512
- /**
513
- * 操作树,修车原来的树, 返回修改后的树。
514
- * 类似数组的 splice 修改原始数据,
515
- * 同时第二个参数不是下标,而是下标数组,分别代表每一层的下标。
516
- *
517
- * 至于如何获取下标数组,请查看 findTreeIndex
518
- *
519
- * @param tree
520
- * @param idx
521
- * @param deleteCount
522
- * @param ...items
523
- */
524
- function spliceTreeSelf(tree, idx, deleteCount) {
525
- if (deleteCount === void 0) {
526
- deleteCount = 0;
527
- }
528
- var list = tree;
529
- for (var _len2 = arguments.length, items = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
530
- items[_key2 - 3] = arguments[_key2];
531
- }
532
- if (typeof idx === 'number') {
533
- list.splice.apply(list, [idx, deleteCount].concat(items));
534
- } else if (Array.isArray(idx) && idx.length) {
535
- idx = idx.concat();
536
- var lastIdx = idx.pop();
537
- var host = idx.reduce(function (list, idx) {
538
- return list[idx] && list[idx].children || [];
539
- }, list);
540
- host.splice.apply(host, [lastIdx, deleteCount].concat(items));
541
- }
542
- return list;
543
- }
544
- // CONCATENATED MODULE: ./src/utils/index.js
545
-
203
+ /***/ (function(module, exports) {
546
204
 
205
+ module.exports = require("@panpanzhao/component-ui/lib/utils/index");
547
206
 
548
207
  /***/ }),
549
208
 
@@ -589,8 +248,8 @@ module.exports = require("async-validator");
589
248
  // ESM COMPAT FLAG
590
249
  __webpack_require__.r(__webpack_exports__);
591
250
 
592
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/vue-loader/lib??vue-loader-options!./src/components/table-editable/src/index.vue?vue&type=template&id=aabdd8e6&
593
- var srcvue_type_template_id_aabdd8e6_render = function render() {
251
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/vue-loader/lib??vue-loader-options!./src/components/table-editable/src/index.vue?vue&type=template&id=6b45ef10&
252
+ var srcvue_type_template_id_6b45ef10_render = function render() {
594
253
  var _vm = this,
595
254
  _c = _vm._self._c
596
255
  return _c(
@@ -633,10 +292,10 @@ var srcvue_type_template_id_aabdd8e6_render = function render() {
633
292
  )
634
293
  }
635
294
  var staticRenderFns = []
636
- srcvue_type_template_id_aabdd8e6_render._withStripped = true
295
+ srcvue_type_template_id_6b45ef10_render._withStripped = true
637
296
 
638
297
 
639
- // CONCATENATED MODULE: ./src/components/table-editable/src/index.vue?vue&type=template&id=aabdd8e6&
298
+ // CONCATENATED MODULE: ./src/components/table-editable/src/index.vue?vue&type=template&id=6b45ef10&
640
299
 
641
300
  // EXTERNAL MODULE: external "element-ui/lib/table"
642
301
  var table_ = __webpack_require__(29);
@@ -1018,8 +677,8 @@ var external_async_validator_default = /*#__PURE__*/__webpack_require__.n(extern
1018
677
  return h(table_column_default.a, babel_helper_vue_jsx_merge_props_default()([{}, param]));
1019
678
  }
1020
679
  });
1021
- // EXTERNAL MODULE: ./src/utils/index.js + 2 modules
1022
- var utils = __webpack_require__(20);
680
+ // EXTERNAL MODULE: external "@panpanzhao/component-ui/lib/utils/index"
681
+ var index_ = __webpack_require__(20);
1023
682
 
1024
683
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/table-editable/src/index.vue?vue&type=script&lang=js&
1025
684
 
@@ -1277,7 +936,7 @@ var utils = __webpack_require__(20);
1277
936
  },
1278
937
  addRow: function addRow(data, parentRow) {
1279
938
  var _Object$assign;
1280
- var rowData = Object.assign((_Object$assign = {}, _Object$assign[this.rowKey] = Object(utils["e" /* uuid */])(), _Object$assign), this.rowData, data);
939
+ var rowData = Object.assign((_Object$assign = {}, _Object$assign[this.rowKey] = Object(index_["uuid"])(), _Object$assign), this.rowData, data);
1281
940
  if (this.hasChildren && !rowData.children) {
1282
941
  rowData.children = [];
1283
942
  }
@@ -1295,7 +954,7 @@ var utils = __webpack_require__(20);
1295
954
  },
1296
955
  deleteByRow: function deleteByRow(row, id) {
1297
956
  var refId = row[this.rowKey] ? this.rowKey : "id";
1298
- Object(utils["d" /* spliceTreeSelf */])(this.data, Object(utils["c" /* findTreeIndex */])(this.data, function (item) {
957
+ Object(index_["spliceTreeSelf"])(this.data, Object(index_["findTreeIndex"])(this.data, function (item) {
1299
958
  return item[id || refId] === row[id || refId];
1300
959
  }), 1);
1301
960
  }
@@ -1316,7 +975,7 @@ var componentNormalizer = __webpack_require__(1);
1316
975
 
1317
976
  var component = Object(componentNormalizer["a" /* default */])(
1318
977
  table_editable_srcvue_type_script_lang_js_,
1319
- srcvue_type_template_id_aabdd8e6_render,
978
+ srcvue_type_template_id_6b45ef10_render,
1320
979
  staticRenderFns,
1321
980
  false,
1322
981
  null,