eoss-ui 0.4.10 → 0.4.14

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 (67) hide show
  1. package/lib/button-group.js +96 -14
  2. package/lib/button.js +98 -16
  3. package/lib/ca-login.js +326 -0
  4. package/lib/card.js +2 -2
  5. package/lib/cascader.js +2 -2
  6. package/lib/checkbox-group.js +96 -14
  7. package/lib/clients.js +2 -2
  8. package/lib/data-table-form.js +96 -14
  9. package/lib/data-table.js +134 -34
  10. package/lib/date-picker.js +98 -16
  11. package/lib/dialog.js +99 -16
  12. package/lib/enterprise.js +2 -2
  13. package/lib/eoss-ui.common.js +275 -52
  14. package/lib/error-page.js +2 -2
  15. package/lib/flow-group.js +98 -16
  16. package/lib/flow-list.js +96 -14
  17. package/lib/flow.js +96 -14
  18. package/lib/form.js +110 -25
  19. package/lib/handle-user.js +98 -16
  20. package/lib/handler.js +98 -16
  21. package/lib/index.js +1 -1
  22. package/lib/input-number.js +98 -16
  23. package/lib/input.js +98 -16
  24. package/lib/label.js +2 -2
  25. package/lib/login.js +96 -14
  26. package/lib/main.js +96 -14
  27. package/lib/mainComp.js +96 -14
  28. package/lib/menu.js +2 -2
  29. package/lib/nav.js +98 -16
  30. package/lib/notify.js +2 -2
  31. package/lib/page.js +98 -16
  32. package/lib/pagination.js +2 -2
  33. package/lib/player.js +98 -16
  34. package/lib/qr-code.js +105 -23
  35. package/lib/radio-group.js +98 -16
  36. package/lib/select-ganged.js +98 -16
  37. package/lib/select.js +105 -23
  38. package/lib/selector-panel.js +96 -14
  39. package/lib/selector.js +98 -16
  40. package/lib/sizer.js +98 -16
  41. package/lib/steps.js +98 -16
  42. package/lib/switch.js +98 -16
  43. package/lib/table-form.js +105 -23
  44. package/lib/tabs-panel.js +2 -2
  45. package/lib/tabs.js +98 -16
  46. package/lib/theme-chalk/ca-login.css +1 -0
  47. package/lib/theme-chalk/index.css +1 -1
  48. package/lib/tips.js +98 -16
  49. package/lib/toolbar.js +2 -2
  50. package/lib/tree-group.js +98 -16
  51. package/lib/tree.js +98 -16
  52. package/lib/upload.js +96 -14
  53. package/lib/utils/util.js +96 -14
  54. package/lib/wujie.js +98 -16
  55. package/lib/wxlogin.js +98 -16
  56. package/package.json +2 -2
  57. package/packages/ca-login/index.js +5 -0
  58. package/packages/ca-login/src/main.vue +62 -0
  59. package/packages/data-table/src/column.vue +20 -7
  60. package/packages/data-table/src/main.vue +2 -1
  61. package/packages/form/src/main.vue +17 -7
  62. package/packages/theme-chalk/lib/ca-login.css +1 -0
  63. package/packages/theme-chalk/lib/index.css +1 -1
  64. package/packages/theme-chalk/src/ca-login.scss +4 -0
  65. package/packages/theme-chalk/src/index.scss +1 -0
  66. package/src/index.js +4 -1
  67. package/src/utils/util.js +107 -35
@@ -0,0 +1,4 @@
1
+ @import './common/var.scss';
2
+ .es-ca-login {
3
+ cursor: pointer;
4
+ }
@@ -2,6 +2,7 @@
2
2
  @import "./button.scss";
3
3
  @import "./button-group.scss";
4
4
  @import "./checkbox-group.scss";
5
+ @import "./ca-login.scss";
5
6
  @import "./card.scss";
6
7
  @import "./cascader.scss";
7
8
  @import "./clients.scss";
package/src/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  import Button from '../packages/button/index.js';
4
4
  import ButtonGroup from '../packages/button-group/index.js';
5
5
  import CheckboxGroup from '../packages/checkbox-group/index.js';
6
+ import CaLogin from '../packages/ca-login/index.js';
6
7
  import Card from '../packages/card/index.js';
7
8
  import Cascader from '../packages/cascader/index.js';
8
9
  import Clients from '../packages/clients/index.js';
@@ -54,6 +55,7 @@ const components = [
54
55
  Button,
55
56
  ButtonGroup,
56
57
  CheckboxGroup,
58
+ CaLogin,
57
59
  Card,
58
60
  Cascader,
59
61
  Clients,
@@ -113,11 +115,12 @@ if (typeof window !== 'undefined' && window.Vue) {
113
115
  }
114
116
 
115
117
  export default {
116
- version: '0.4.10',
118
+ version: '0.4.14',
117
119
  install,
118
120
  Button,
119
121
  ButtonGroup,
120
122
  CheckboxGroup,
123
+ CaLogin,
121
124
  Card,
122
125
  Cascader,
123
126
  Clients,
package/src/utils/util.js CHANGED
@@ -326,7 +326,7 @@ const ajax = function ({
326
326
  * @param {String} [key] - 对象子元素的属性名
327
327
  **/
328
328
  const arrUnique = function (data, key) {
329
- var newArr = [];
329
+ let newArr = [];
330
330
  if (key === undefined) {
331
331
  data.sort();
332
332
  newArr = [data[0]];
@@ -336,7 +336,7 @@ const arrUnique = function (data, key) {
336
336
  }
337
337
  }
338
338
  } else {
339
- var obj = {};
339
+ let obj = {};
340
340
  for (let i = 0; i < data.length; i++) {
341
341
  if (!obj[data[i][key]]) {
342
342
  newArr.push(data[i]);
@@ -474,8 +474,8 @@ const esEncode = function (value) {
474
474
  * @param {string} [key] - 私钥
475
475
  **/
476
476
  const esDecode = function (value) {
477
- var kleng = publicKey.length;
478
- var result;
477
+ let kleng = publicKey.length;
478
+ let result;
479
479
  let cat1;
480
480
  let cat2;
481
481
  let cat3;
@@ -483,7 +483,7 @@ const esDecode = function (value) {
483
483
  let arr;
484
484
  arr = new Array(Math.floor(value.length / 3));
485
485
  result = arr.length;
486
- for (var i = 0; i < result; i++) {
486
+ for (let i = 0; i < result; i++) {
487
487
  cat1 = publicKey.indexOf(value.charAt(num));
488
488
  num++;
489
489
  cat2 = publicKey.indexOf(value.charAt(num));
@@ -562,10 +562,11 @@ const exclAttribute = ({ attrs = 'value', data }) => {
562
562
  * @param {name} [string] - 导出文件名
563
563
  * @param {numbers} [boolean] - 序号
564
564
  **/
565
- const exportXls = function ({ thead = [], data = [], name, numbers }) {
565
+ const exportXls = function ({ thead = [], data = [], name, numbers, option }) {
566
566
  let tbody = '';
567
567
  let aligns = [];
568
568
  let fields = [];
569
+ let keys = {};
569
570
  let others = {};
570
571
  let alink = document.createElement('a');
571
572
  for (let i = 0; i < thead.length; i++) {
@@ -573,14 +574,17 @@ const exportXls = function ({ thead = [], data = [], name, numbers }) {
573
574
  if (numbers) {
574
575
  tbody += '<th rowspan="' + thead.length + '"></th>';
575
576
  }
576
- const tr = thead[i];
577
+ let tr = thead[i];
577
578
  let col = 0;
578
579
  for (let x = 0; x < tr.length; x++) {
579
- const td = tr[x];
580
+ let td = tr[x];
580
581
  if (td.property) {
581
582
  if (col === x) {
582
583
  fields.push(td.property);
583
584
  aligns.push(td.align);
585
+ if (td.labelKey && td.valueKey) {
586
+ keys[td.property] = {labelKey: td.labelKey, valueKey: td.valueKey, multiple: !!(td.valueToString || td['value-to-string'])};
587
+ }
584
588
  } else {
585
589
  others[String(col)] = [td.property, td.align];
586
590
  }
@@ -601,16 +605,66 @@ const exportXls = function ({ thead = [], data = [], name, numbers }) {
601
605
  }
602
606
  for (let i = 0; i < data.length; i++) {
603
607
  tbody += '<tr>';
604
- for (var x in fields) {
605
- tbody += '<td align="' + aligns[x] + '">' + data[i][fields[x]] + '</td>';
608
+ for (let x in fields) {
609
+ let field = '';
610
+ let valueKey = keys[fields[x]] && keys[fields[x]].valueKey ? keys[fields[x]].valueKey : 'value';
611
+ let labelKey = keys[fields[x]] && keys[fields[x]].labelKey ? keys[fields[x]].labelKey : 'name';
612
+ if (option[fields[x]]) {
613
+ if (Array.isArray(data[i][fields[x]])) {
614
+ field = [];
615
+ data[i][fields[x]].forEach(ele => {
616
+ option[fields[x]].forEach(item => {
617
+ // eslint-disable-next-line eqeqeq
618
+ if (item[valueKey] == ele) {
619
+ field.push(item[labelKey]);
620
+ return;
621
+ }
622
+ });
623
+ });
624
+ field = field.join(' ');
625
+ } else if (typeof data[i][fields[x]] === 'string' && keys[fields[x]] && keys[fields[x]].multiple) {
626
+ field = [];
627
+ data[i][fields[x]].split(',').forEach(ele => {
628
+ option[fields[x]].forEach(item => {
629
+ // eslint-disable-next-line eqeqeq
630
+ if (item[valueKey] == ele) {
631
+ field.push(item[labelKey]);
632
+ return;
633
+ }
634
+ });
635
+ });
636
+ field = field.join(' ');
637
+ } else {
638
+ option[fields[x]].forEach(item => {
639
+ // eslint-disable-next-line eqeqeq
640
+ if (item[valueKey] == data[i][fields[x]]) {
641
+ field = item[labelKey];
642
+ return;
643
+ }
644
+ });
645
+ }
646
+ } else if (typeof data[i][fields[x]] === 'object' && keys[fields[x]]) {
647
+ if (Array.isArray(data[i][fields[x]])) {
648
+ data[i][fields[x]].forEach(item => {
649
+ field = [];
650
+ field.push({}.toString.call(item) === '[object Object]' ? item[labelKey] : item);
651
+ });
652
+ field = field.join(' ');
653
+ } else {
654
+ field = data[i][fields[x]][labelKey];
655
+ }
656
+ } else {
657
+ field = data[i][fields[x]];
658
+ }
659
+ tbody += '<td align="' + aligns[x] + '">' + field + '</td>';
606
660
  }
607
661
  tbody += '</tr>';
608
662
  }
609
663
  if (!name) {
610
664
  name = 'table_' + new Date().getTime();
611
665
  }
612
- var uri = 'data:application/vnd.ms-excel;base64,';
613
- var template =
666
+ let uri = 'data:application/vnd.ms-excel;base64,';
667
+ let template =
614
668
  '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><meta charset="UTF-8"><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table style="vnd.ms-excel.numberformat:@">' +
615
669
  tbody +
616
670
  '</table></body></html>';
@@ -948,7 +1002,7 @@ const getSaturation = function ($s, $i, $isLight) {
948
1002
  const getScript = function (url, callback) {
949
1003
  // eslint-disable-next-line no-undef
950
1004
  return new Promise((resolve, reject) => {
951
- var xmlHttp = null;
1005
+ let xmlHttp = null;
952
1006
  if (win.XMLHttpRequest) {
953
1007
  xmlHttp = new XMLHttpRequest();
954
1008
  } else if (win.ActiveXObject) {
@@ -1170,15 +1224,15 @@ const getValues = function (obj, flag) {
1170
1224
  **/
1171
1225
 
1172
1226
  const handlerUrl = function (url, before) {
1173
- var arry = url.split('?');
1227
+ let arry = url.split('?');
1174
1228
  if (arry.length > 2) {
1175
1229
  let ary = arry.splice(1, arry.length);
1176
1230
  arry.push(ary.join('?'));
1177
1231
  }
1178
1232
  if (arry.length > 1) {
1179
1233
  if (arry[1].indexOf('_tt') > -1) {
1180
- var search = arry[1].split('&');
1181
- for (var i in search) {
1234
+ let search = arry[1].split('&');
1235
+ for (let i in search) {
1182
1236
  if (search[i].indexOf('_tt') > -1) {
1183
1237
  search[i] = '_tt=' + new Date().getTime();
1184
1238
  }
@@ -1303,7 +1357,7 @@ const identical = function ({
1303
1357
  * @param {String} [key] - 目标对象的属性名
1304
1358
  **/
1305
1359
  const indexOfObj = function (arry, target, key) {
1306
- for (var i = 0; i < arry.length; i++) {
1360
+ for (let i = 0; i < arry.length; i++) {
1307
1361
  if (key) {
1308
1362
  if (typeof target === 'string' && arry[i][key] === target) {
1309
1363
  return i;
@@ -1405,10 +1459,27 @@ const isLogged = function ({
1405
1459
  '{redirectUri}',
1406
1460
  encodeURIComponent(url)
1407
1461
  );
1408
- if (open) {
1409
- win.open(href);
1462
+ if (to.query.openType) {
1463
+ switch (to.query.openType) {
1464
+ case 'self':
1465
+ win.location.href = href;
1466
+ break;
1467
+ case 'blank':
1468
+ win.open(href);
1469
+ break;
1470
+ case 'top':
1471
+ win.top.location.href = href;
1472
+ break;
1473
+ case 'parent':
1474
+ win.parent.location.href = href;
1475
+ break;
1476
+ }
1410
1477
  } else {
1411
- win.top.location.href = href;
1478
+ if (open) {
1479
+ win.open(href);
1480
+ } else {
1481
+ win.top.location.href = href;
1482
+ }
1412
1483
  }
1413
1484
  break;
1414
1485
  }
@@ -1423,12 +1494,13 @@ const isLogged = function ({
1423
1494
  } else if (
1424
1495
  token ||
1425
1496
  to.path === '/' ||
1426
- to.path === '/login' ||
1427
1497
  to.path === '/404' ||
1428
- exclude.indexOf(to.path) > -1 || exclude.indexOf(to.name) > -1
1498
+ exclude.indexOf(to.path) > -1 || exclude.indexOf(to.name) > -1 ||
1499
+ to.path === '/login' ||
1500
+ (token && to.path === '/main')
1429
1501
  ) {
1430
- if (redirect && to.name && (to.name === 'login' || to.name === 'main')) {
1431
- window.location.replace(urlJoinParams({ url: `./${to.name}.html`, param: to.query }));
1502
+ if (redirect && (to.path === '/main' || to.path === '/login')) {
1503
+ window.location.replace(urlJoinParams({ url: `.${to.path}.html`, param: to.query }));
1432
1504
  } else {
1433
1505
  next();
1434
1506
  }
@@ -1593,7 +1665,7 @@ const mixColor = function ($color1, $color2, $n) {
1593
1665
  **/
1594
1666
  const overbrim = function (el) {
1595
1667
  let w = el.offsetWidth;
1596
- var s = el.scrollWidth;
1668
+ let s = el.scrollWidth;
1597
1669
  if (s > w) {
1598
1670
  return true;
1599
1671
  } else {
@@ -1749,7 +1821,7 @@ const sendMessage = function ({ data = {}, url }) {
1749
1821
  * @param {String} [url] - 图标地址
1750
1822
  **/
1751
1823
  const setFavicon = function (url) {
1752
- var link = document.querySelector("link[rel*='icon']");
1824
+ let link = document.querySelector("link[rel*='icon']");
1753
1825
  if (link) {
1754
1826
  link.href = url;
1755
1827
  } else {
@@ -1842,13 +1914,13 @@ const startWith = function (value, reg, or = false) {
1842
1914
  * @param {Number} [wait] - 延迟毫秒数
1843
1915
  **/
1844
1916
  const throttle = function (fn, wait) {
1845
- var timer = null;
1846
- var startTime = Date.now();
1917
+ let timer = null;
1918
+ let startTime = Date.now();
1847
1919
  return function () {
1848
- var curTime = Date.now();
1849
- var remaining = wait - (curTime - startTime);
1850
- var context = this;
1851
- var args = arguments;
1920
+ let curTime = Date.now();
1921
+ let remaining = wait - (curTime - startTime);
1922
+ let context = this;
1923
+ let args = arguments;
1852
1924
  clearTimeout(timer);
1853
1925
  if (remaining <= 0) {
1854
1926
  fn.apply(context, args);
@@ -2037,9 +2109,9 @@ const watermark = function (option) {
2037
2109
  let { rows, cols, html, angle, color, height, lineHeight, opacity, fontSize, fontWeight, fontFamily, textAlign, zIndex } = options;
2038
2110
 
2039
2111
  wrap.style.cssText = 'display: flex;align-items: center;justify-content: flex-start;flex-wrap: wrap;align-content: space-between;position: fixed;left: 50%;top: 50%;transform: translate(-50%, -50%);height: 100vh;width: 100vw;pointer-events: none;overflow: hidden;background: transparent;z-index: ' + zIndex + ';';
2040
- var num = rows * cols;
2041
- for (var i = 0; i < num; i++) {
2042
- var item = document.createElement('div');
2112
+ let num = rows * cols;
2113
+ for (let i = 0; i < num; i++) {
2114
+ let item = document.createElement('div');
2043
2115
  item.innerHTML = html;
2044
2116
  item.style.cssText = 'flex-grow: 1;flex-shrink: 0;color: ' + color + ';text-align: ' + textAlign + ';width: ' + (100 / cols) + '%;height: ' + height + 'px;line-height: ' + lineHeight + 'px;font-size:' + fontSize + 'px;font-weight: ' + fontWeight + ';font-family: ' + fontFamily + ';text-align: ' + textAlign + ';transform: rotate(' + angle + 'deg);opacity: ' + opacity + ';';
2045
2117
  docFrag.appendChild(item);