@lambo-design/shared 1.0.0-beta.257 → 1.0.0-beta.258

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.
@@ -101,8 +101,8 @@ vxe-table
101
101
  --padding-md: 16px;
102
102
  --padding-sm: 12px;
103
103
  --padding-xs: 8px;
104
- --border-color-base: #C2D1CC;
105
- --border-color-split: #e0e0e0;
104
+ --border-color-base: #E5E8EF;
105
+ --border-color-split: #E5E8EF;
106
106
  --border-width-base: 1px;
107
107
  --border-style-base: solid;
108
108
  --background-color-base: #F3F8F7;
@@ -144,16 +144,16 @@ vxe-table
144
144
  --btn-group-border: #0a8682;
145
145
  --btn-disable-color: #86909C;
146
146
  --btn-disable-bg: #F3F8F7;
147
- --btn-disable-border: #C2D1CC;
147
+ --btn-disable-border: #E5E8EF;
148
148
  --btn-default-color: #1D2129;
149
149
  --btn-default-color-tint-20: #4a4d54;
150
150
  --btn-default-color-shade-5: #1c1f27;
151
151
  --btn-default-bg: #fff;
152
152
  --btn-default-bg-tint-20: #ffffff;
153
153
  --btn-default-bg-shade-5: #f2f2f2;
154
- --btn-default-border: #C2D1CC;
155
- --btn-default-border-tint-20: #cedad6;
156
- --btn-default-border-shade-5: #b8c7c2;
154
+ --btn-default-border: #E5E8EF;
155
+ --btn-default-border-tint-20: #eaedf2;
156
+ --btn-default-border-shade-5: #dadce3;
157
157
  --btn-primary-color: #fff;
158
158
  --btn-primary-color-tint-20: #ffffff;
159
159
  --btn-primary-color-tint-5: #ffffff;
@@ -168,9 +168,9 @@ vxe-table
168
168
  --btn-ghost-bg: #fff;
169
169
  --btn-ghost-bg-tint-20: #ffffff;
170
170
  --btn-ghost-bg-shade-5: #f2f2f2;
171
- --btn-ghost-border: #C2D1CC;
172
- --btn-ghost-border-tint-20: #cedad6;
173
- --btn-ghost-border-shade-5: #b8c7c2;
171
+ --btn-ghost-border: #E5E8EF;
172
+ --btn-ghost-border-tint-20: #eaedf2;
173
+ --btn-ghost-border-shade-5: #dadce3;
174
174
  --btn-circle-size: 32px;
175
175
  --btn-circle-size-large: 40px;
176
176
  --btn-circle-size-small: 24px;
@@ -195,7 +195,7 @@ vxe-table
195
195
  --layout-active-color: #0A8D89;
196
196
  --layout-header-color: #FFFFFF;
197
197
  --layout-header-active-color: #fff;
198
- --layout-header-nav-fontSize: 20px;
198
+ --layout-header-nav-fontSize: 18px;
199
199
  --layout-header-nav-color: #FFFFFF;
200
200
  --layout-header-nav-active-color: #0A8D89;
201
201
  --layout-header-nav-active-font-weight: bold;
@@ -234,8 +234,8 @@ vxe-table
234
234
  --input-padding-vertical-large: 6px;
235
235
  --input-placeholder-color: #86909C;
236
236
  --input-color: #1D2129;
237
- --input-border-color: #C2D1CC;
238
- --input-border-color-tint-20: #cedad6;
237
+ --input-border-color: #E5E8EF;
238
+ --input-border-color-tint-20: #eaedf2;
239
239
  --input-border-radius: 4px;
240
240
  --input-border-radius-small: 3px;
241
241
  --input-bg: #fff;
@@ -315,9 +315,9 @@ vxe-table
315
315
  --table-cell-padding-right: 9px;
316
316
  --table-header-text-align: center;
317
317
  --table-data-text-align: left;
318
- --table-border-color-base: #fff;
319
- --table-border-bottom-color-base: #F3F3F3;
320
- --table-border-width-base: 0;
318
+ --table-border-color-base: #E5E8EF;
319
+ --table-border-bottom-color-base: #E5E8EF;
320
+ --table-border-width-base: 1px;
321
321
  --select-dropdown-max-height: 400px;
322
322
  --tab-card-bg: #ECF5F4;
323
323
  --form-item-label-font-weight: normal;
@@ -339,7 +339,7 @@ vxe-table
339
339
  --vxe-border-radius: 12px;
340
340
  --vxe-border-width: 1px;
341
341
  --vxe-border-style: solid;
342
- --vxe-border-color: #C2D1CC;
342
+ --vxe-border-color: #E5E8EF;
343
343
  /*icon*/
344
344
  --vxe-icon-font-family: Verdana, Arial, Tahoma;
345
345
  --vxe-icon-background-color: #fff;
@@ -370,22 +370,22 @@ vxe-table
370
370
  --vxe-warning-disabled-color: #ffb166;
371
371
  --vxe-danger-disabled-color: #faa0a0;
372
372
  /*input/radio/checkbox*/
373
- --vxe-input-border-color: #C2D1CC;
373
+ --vxe-input-border-color: #E5E8EF;
374
374
  --vxe-input-disabled-color: #86909C;
375
375
  --vxe-input-disabled-background-color: #f3f3f3;
376
376
  --vxe-input-placeholder-color: #86909C;
377
377
  /*popup*/
378
- --vxe-table-popup-border-color: #C2D1CC;
378
+ --vxe-table-popup-border-color: #E5E8EF;
379
379
  /*table*/
380
380
  --vxe-table-font-color: #1D2129;
381
381
  --vxe-table-font-lighten-color-20: #475165;
382
382
  --vxe-table-header-font-color: #899D98;
383
383
  --vxe-table-footer-font-color: #1D2129;
384
384
  --vxe-table-border-radius: 12px;
385
- --vxe-table-border-width: 0;
385
+ --vxe-table-border-width: 1px;
386
386
  --vxe-table-border-style: solid;
387
- --vxe-table-border-color: #C2D1CC;
388
- --vxe-table-resizable-line-color: #e0e0e0;
387
+ --vxe-table-border-color: #E5E8EF;
388
+ --vxe-table-resizable-line-color: #E5E8EF;
389
389
  --vxe-table-resizable-drag-line-color: #0A8D89;
390
390
  --vxe-table-header-background-color: #ECF5F4;
391
391
  --vxe-table-body-background-color: #fff;
@@ -393,7 +393,7 @@ vxe-table
393
393
  --vxe-table-tree-node-line-color: #909399;
394
394
  --vxe-table-tree-node-line-style: dotted;
395
395
  --vxe-table-header-font-weight: bold;
396
- --vxe-table-border-bottom-width: 1px;
396
+ --vxe-table-border-bottom-width: 0;
397
397
  --vxe-table-row-height-default: 48px;
398
398
  --vxe-table-row-height-medium: 44px;
399
399
  --vxe-table-row-height-small: 40px;
@@ -416,7 +416,7 @@ vxe-table
416
416
  --vxe-table-column-current-background-color: #F8FBFB;
417
417
  --vxe-table-column-icon-border-color: #c0c4cc;
418
418
  --vxe-table-column-icon-border-hover-color: #515A6E;
419
- --vxe-table-column-background-image: linear-gradient(#fff, #fff), linear-gradient(#C2D1CC, #C2D1CC);
419
+ --vxe-table-column-background-image: linear-gradient(#E5E8EF, #E5E8EF), linear-gradient(#E5E8EF, #E5E8EF);
420
420
  --vxe-table-cell-placeholder-color: #86909C;
421
421
  --vxe-table-cell-padding-left: 9px;
422
422
  --vxe-table-cell-padding-right: 9px;
@@ -93,8 +93,8 @@
93
93
  @padding-xs: 8px; // small items
94
94
 
95
95
  // Border color
96
- @border-color-base : #C2D1CC; // outside
97
- @border-color-split : #e0e0e0; // inside
96
+ @border-color-base : #E5E8EF; // outside
97
+ @border-color-split : #E5E8EF; // inside
98
98
  @border-width-base : 1px; // width of the border for a component
99
99
  @border-style-base : solid; // style of a components border
100
100
 
@@ -207,7 +207,7 @@
207
207
  @layout-active-color : @primary-color;
208
208
  @layout-header-color : #FFFFFF;
209
209
  @layout-header-active-color : @white;
210
- @layout-header-nav-fontSize : 20px;
210
+ @layout-header-nav-fontSize : 18px;
211
211
  @layout-header-nav-color : #FFFFFF;
212
212
  @layout-header-nav-active-color : @primary-color;
213
213
  @layout-header-nav-active-font-weight : bold;
@@ -366,9 +366,9 @@
366
366
  @table-cell-padding-right : 9px;
367
367
  @table-header-text-align : center;
368
368
  @table-data-text-align : left;
369
- @table-border-color-base : #fff;
370
- @table-border-bottom-color-base :#F3F3F3;
371
- @table-border-width-base : 0;
369
+ @table-border-color-base : #E5E8EF;
370
+ @table-border-bottom-color-base :#E5E8EF;
371
+ @table-border-width-base : 1px;
372
372
 
373
373
  // Select-DropDown
374
374
  @select-dropdown-max-height : 400px;
@@ -454,7 +454,7 @@ vxe-table
454
454
  @vxe-table-header-font-color : @table-header-color;
455
455
  @vxe-table-footer-font-color : @vxe-font-color;
456
456
  @vxe-table-border-radius : @vxe-border-radius;
457
- @vxe-table-border-width : 0;
457
+ @vxe-table-border-width : 1px;
458
458
  @vxe-table-border-style : @table-border-style-base;
459
459
  @vxe-table-border-color : @border-color-base;
460
460
  @vxe-table-resizable-line-color : @border-color-split;
@@ -465,7 +465,7 @@ vxe-table
465
465
  @vxe-table-tree-node-line-color : #909399;
466
466
  @vxe-table-tree-node-line-style : dotted;
467
467
  @vxe-table-header-font-weight : @table-header-font-weight;
468
- @vxe-table-border-bottom-width : 1px;
468
+ @vxe-table-border-bottom-width : 0;
469
469
 
470
470
  @vxe-table-row-height-default : @table-cell-height;
471
471
  @vxe-table-row-height-medium : @table-cell-height - 4px;
@@ -490,7 +490,7 @@ vxe-table
490
490
  @vxe-table-column-current-background-color : @table-td-highlight-bg;
491
491
  @vxe-table-column-icon-border-color : #c0c4cc;
492
492
  @vxe-table-column-icon-border-hover-color : #515A6E;
493
- @vxe-table-column-background-image : linear-gradient(#fff, #fff), linear-gradient(@vxe-table-border-color, @vxe-table-border-color);
493
+ @vxe-table-column-background-image : linear-gradient(@vxe-table-border-color, @vxe-table-border-color), linear-gradient(@vxe-table-border-color, @vxe-table-border-color);
494
494
 
495
495
 
496
496
  @vxe-table-cell-placeholder-color : @input-placeholder-color;
@@ -78,8 +78,8 @@ export default {
78
78
  --padding-md: 16px;
79
79
  --padding-sm: 12px;
80
80
  --padding-xs: 8px;
81
- --border-color-base: #C2D1CC;
82
- --border-color-split: #e0e0e0;
81
+ --border-color-base: #E5E8EF;
82
+ --border-color-split: #E5E8EF;
83
83
  --border-width-base: 1px;
84
84
  --border-style-base: solid;
85
85
  --background-color-base: #F3F8F7;
@@ -121,16 +121,16 @@ export default {
121
121
  --btn-group-border: #0a8682;
122
122
  --btn-disable-color: #86909C;
123
123
  --btn-disable-bg: #F3F8F7;
124
- --btn-disable-border: #C2D1CC;
124
+ --btn-disable-border: #E5E8EF;
125
125
  --btn-default-color: #1D2129;
126
126
  --btn-default-color-tint-20: #4a4d54;
127
127
  --btn-default-color-shade-5: #1c1f27;
128
128
  --btn-default-bg: #fff;
129
129
  --btn-default-bg-tint-20: #ffffff;
130
130
  --btn-default-bg-shade-5: #f2f2f2;
131
- --btn-default-border: #C2D1CC;
132
- --btn-default-border-tint-20: #cedad6;
133
- --btn-default-border-shade-5: #b8c7c2;
131
+ --btn-default-border: #E5E8EF;
132
+ --btn-default-border-tint-20: #eaedf2;
133
+ --btn-default-border-shade-5: #dadce3;
134
134
  --btn-primary-color: #fff;
135
135
  --btn-primary-color-tint-20: #ffffff;
136
136
  --btn-primary-color-tint-5: #ffffff;
@@ -145,9 +145,9 @@ export default {
145
145
  --btn-ghost-bg: #fff;
146
146
  --btn-ghost-bg-tint-20: #ffffff;
147
147
  --btn-ghost-bg-shade-5: #f2f2f2;
148
- --btn-ghost-border: #C2D1CC;
149
- --btn-ghost-border-tint-20: #cedad6;
150
- --btn-ghost-border-shade-5: #b8c7c2;
148
+ --btn-ghost-border: #E5E8EF;
149
+ --btn-ghost-border-tint-20: #eaedf2;
150
+ --btn-ghost-border-shade-5: #dadce3;
151
151
  --btn-circle-size: 32px;
152
152
  --btn-circle-size-large: 40px;
153
153
  --btn-circle-size-small: 24px;
@@ -172,7 +172,7 @@ export default {
172
172
  --layout-active-color: #0A8D89;
173
173
  --layout-header-color: #FFFFFF;
174
174
  --layout-header-active-color: #fff;
175
- --layout-header-nav-fontSize: 20px;
175
+ --layout-header-nav-fontSize: 18px;
176
176
  --layout-header-nav-color: #FFFFFF;
177
177
  --layout-header-nav-active-color: #0A8D89;
178
178
  --layout-header-nav-active-font-weight: bold;
@@ -211,8 +211,8 @@ export default {
211
211
  --input-padding-vertical-large: 6px;
212
212
  --input-placeholder-color: #86909C;
213
213
  --input-color: #1D2129;
214
- --input-border-color: #C2D1CC;
215
- --input-border-color-tint-20: #cedad6;
214
+ --input-border-color: #E5E8EF;
215
+ --input-border-color-tint-20: #eaedf2;
216
216
  --input-border-radius: 4px;
217
217
  --input-border-radius-small: 3px;
218
218
  --input-bg: #fff;
@@ -292,9 +292,9 @@ export default {
292
292
  --table-cell-padding-right: 9px;
293
293
  --table-header-text-align: center;
294
294
  --table-data-text-align: left;
295
- --table-border-color-base: #fff;
296
- --table-border-bottom-color-base: #F3F3F3;
297
- --table-border-width-base: 0;
295
+ --table-border-color-base: #E5E8EF;
296
+ --table-border-bottom-color-base: #E5E8EF;
297
+ --table-border-width-base: 1px;
298
298
  --select-dropdown-max-height: 400px;
299
299
  --tab-card-bg: #ECF5F4;
300
300
  --form-item-label-font-weight: normal;
@@ -316,7 +316,7 @@ export default {
316
316
  --vxe-border-radius: 12px;
317
317
  --vxe-border-width: 1px;
318
318
  --vxe-border-style: solid;
319
- --vxe-border-color: #C2D1CC;
319
+ --vxe-border-color: #E5E8EF;
320
320
  /*icon*/
321
321
  --vxe-icon-font-family: Verdana, Arial, Tahoma;
322
322
  --vxe-icon-background-color: #fff;
@@ -347,22 +347,22 @@ export default {
347
347
  --vxe-warning-disabled-color: #ffb166;
348
348
  --vxe-danger-disabled-color: #faa0a0;
349
349
  /*input/radio/checkbox*/
350
- --vxe-input-border-color: #C2D1CC;
350
+ --vxe-input-border-color: #E5E8EF;
351
351
  --vxe-input-disabled-color: #86909C;
352
352
  --vxe-input-disabled-background-color: #f3f3f3;
353
353
  --vxe-input-placeholder-color: #86909C;
354
354
  /*popup*/
355
- --vxe-table-popup-border-color: #C2D1CC;
355
+ --vxe-table-popup-border-color: #E5E8EF;
356
356
  /*table*/
357
357
  --vxe-table-font-color: #1D2129;
358
358
  --vxe-table-font-lighten-color-20: #475165;
359
359
  --vxe-table-header-font-color: #899D98;
360
360
  --vxe-table-footer-font-color: #1D2129;
361
361
  --vxe-table-border-radius: 12px;
362
- --vxe-table-border-width: 0;
362
+ --vxe-table-border-width: 1px;
363
363
  --vxe-table-border-style: solid;
364
- --vxe-table-border-color: #C2D1CC;
365
- --vxe-table-resizable-line-color: #e0e0e0;
364
+ --vxe-table-border-color: #E5E8EF;
365
+ --vxe-table-resizable-line-color: #E5E8EF;
366
366
  --vxe-table-resizable-drag-line-color: #0A8D89;
367
367
  --vxe-table-header-background-color: #ECF5F4;
368
368
  --vxe-table-body-background-color: #fff;
@@ -370,7 +370,7 @@ export default {
370
370
  --vxe-table-tree-node-line-color: #909399;
371
371
  --vxe-table-tree-node-line-style: dotted;
372
372
  --vxe-table-header-font-weight: bold;
373
- --vxe-table-border-bottom-width: 1px;
373
+ --vxe-table-border-bottom-width: 0;
374
374
  --vxe-table-row-height-default: 48px;
375
375
  --vxe-table-row-height-medium: 44px;
376
376
  --vxe-table-row-height-small: 40px;
@@ -393,7 +393,7 @@ export default {
393
393
  --vxe-table-column-current-background-color: #F8FBFB;
394
394
  --vxe-table-column-icon-border-color: #c0c4cc;
395
395
  --vxe-table-column-icon-border-hover-color: #515A6E;
396
- --vxe-table-column-background-image: linear-gradient(#fff, #fff), linear-gradient(#C2D1CC, #C2D1CC);
396
+ --vxe-table-column-background-image: linear-gradient(#E5E8EF, #E5E8EF), linear-gradient(#E5E8EF, #E5E8EF);
397
397
  --vxe-table-cell-placeholder-color: #86909C;
398
398
  --vxe-table-cell-padding-left: 9px;
399
399
  --vxe-table-cell-padding-right: 9px;
@@ -364,4 +364,12 @@ body > .ivu-tooltip-popper {
364
364
 
365
365
  .ivu-card-extra {
366
366
  top: var(--ivu-card-extra, 3px) !important;
367
+ }
368
+
369
+ .ag-cell, .ivu-table-cell-tooltip-content {
370
+ display: block;
371
+ overflow: hidden;
372
+ text-overflow: ellipsis;
373
+ white-space: nowrap;
374
+ line-height: 1.2;
367
375
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambo-design/shared",
3
- "version": "1.0.0-beta.257",
3
+ "version": "1.0.0-beta.258",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
package/utils/storage.js CHANGED
@@ -1,198 +1,198 @@
1
- /*
2
- * Copyright 2019 WeBank
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- */
17
-
18
- /* \
19
- |*|
20
- |*| :: cookies.js ::
21
- |*|
22
- |*| A complete cookies reader/writer framework with full unicode support.
23
- |*|
24
- |*| https://developer.mozilla.org/en-US/docs/DOM/document.cookie
25
- |*|
26
- |*| This framework is released under the GNU Public License, version 3 or later.
27
- |*| http://www.gnu.org/licenses/gpl-3.0-standalone.html
28
- |*|
29
- |*| Syntaxes:
30
- |*|
31
- |*| * docCookies.setItem(name, value[, end[, path[, domain[, secure]]]])
32
- |*| * docCookies.getItem(name)
33
- |*| * docCookies.removeItem(name[, path], domain)
34
- |*| * docCookies.hasItem(name)
35
- |*| * docCookies.keys()
36
- |*|
37
- \ */
38
-
39
- let docCookies = {
40
- getItem: function(sKey) {
41
- return decodeURIComponent(document.cookie.replace(new RegExp('(?:(?:^|.*;)\\s*' + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, '\\$&') + '\\s*\\=\\s*([^;]*).*$)|^.*$'), '$1')) || null;
42
- },
43
- setItem: function(sKey, sValue, vEnd, sPath, sDomain, bSecure) {
44
- if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) {
45
- return false;
46
- }
47
- let sExpires = '';
48
- if (vEnd) {
49
- switch (vEnd.constructor) {
50
- case Number:
51
- sExpires = vEnd === Infinity ? '; expires=Fri, 31 Dec 9999 23:59:59 GMT' : '; max-age=' + vEnd;
52
- break;
53
- case String:
54
- sExpires = '; expires=' + vEnd;
55
- break;
56
- case Date:
57
- sExpires = '; expires=' + vEnd.toUTCString();
58
- break;
59
- }
60
- }
61
- document.cookie = encodeURIComponent(sKey) + '=' + encodeURIComponent(sValue) + sExpires + (sDomain ? '; domain=' + sDomain : '') + (sPath ? '; path=' + sPath : '') + (bSecure ? '; secure' : '');
62
- return true;
63
- },
64
- removeItem: function(sKey, sPath, sDomain) {
65
- if (!sKey || !this.hasItem(sKey)) {
66
- return false;
67
- }
68
- document.cookie = encodeURIComponent(sKey) + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT' + (sDomain ? '; domain=' + sDomain : '') + (sPath ? '; path=' + sPath : '');
69
- return true;
70
- },
71
- hasItem: function(sKey) {
72
- return (new RegExp('(?:^|;\\s*)' + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, '\\$&') + '\\s*\\=')).test(document.cookie);
73
- },
74
- keys: /* optional method: you can safely remove it! */ function() {
75
- let aKeys = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, '').split(/\s*(?:\=[^;]*)?;\s*/);
76
- for (let nIdx = 0; nIdx < aKeys.length; nIdx++) {
77
- aKeys[nIdx] = decodeURIComponent(aKeys[nIdx]);
78
- }
79
- return aKeys;
80
- },
81
- };
82
-
83
- /**
84
- * 操作cookie、sessionStorage、localStorage、缓存
85
- */
86
-
87
- const
88
- SESSION = 'session';
89
-
90
- const LOCAL = 'local';
91
-
92
- const COOKIE = 'cookie';
93
-
94
- export default {
95
- set: function(key, value, category = SESSION, expired) {
96
- let { storage, isWebStorage = true } = this._map(category);
97
-
98
- if (isWebStorage) {
99
- storageManager.set(key, value, storage);
100
- } else {
101
- cookieManager.set(key, value, expired);
102
- }
103
- },
104
- get: function(key, category = SESSION) {
105
- let { storage, isWebStorage = true } = this._map(category);
106
-
107
- if (isWebStorage) {
108
- return storageManager.get(key, storage);
109
- } else {
110
- return cookieManager.get(key);
111
- }
112
- },
113
- clear: function(category = SESSION) {
114
- let { storage, isWebStorage = true } = this._map(category);
115
-
116
- if (isWebStorage) {
117
- storageManager.clear(storage);
118
- } else {
119
- cookieManager.clear();
120
- }
121
- },
122
- remove: function(key, category = SESSION) {
123
- let { storage, isWebStorage = true } = this._map(category);
124
-
125
- if (isWebStorage) {
126
- storageManager.remove(key, storage);
127
- } else {
128
- cookieManager.remove(key);
129
- }
130
- },
131
- _map: function(category) {
132
- let isWebStorage = true; let storage;
133
-
134
- switch (true) {
135
- case category === SESSION:
136
- storage = 'sessionStorage';
137
- break;
138
- case category === LOCAL:
139
- storage = 'localStorage';
140
- break;
141
- case category === COOKIE:
142
- storage = 'cookie';
143
- isWebStorage = false;
144
- break;
145
- default:
146
- storage = 'sessionStorage';
147
- }
148
-
149
- return { isWebStorage, storage };
150
- },
151
- };
152
-
153
- let isProd = process.env.NODE_ENV === 'production';
154
-
155
- export const storageManager = {
156
- set: function(key, value, storage) {
157
- try {
158
- window[storage].setItem(key, JSON.stringify(value));
159
- } catch (e) {
160
- !isProd && console.error(e);
161
- }
162
- },
163
- get: function(key, storage) {
164
- try {
165
- if (window[storage].getItem(key)) {
166
- return JSON.parse(window[storage].getItem(key));
167
- } else {
168
- return window[storage].getItem(key);
169
- }
170
- } catch (e) {
171
- !isProd && console.error(e, key);
172
- }
173
- },
174
- clear: function(storage) {
175
- window[storage].clear();
176
- },
177
- remove: function(key, storage) {
178
- window[storage].removeItem(key);
179
- },
180
- };
181
-
182
- export const cookieManager = {
183
- set: function(key, value, expired) {
184
- if (expired) docCookies.setItem(key, value, expired);
185
- else docCookies.setItem(key, value);
186
- },
187
- get: function(key) {
188
- return docCookies.getItem(key);
189
- },
190
- clear: function() {
191
- docCookies.keys().forEach((key) => {
192
- docCookies.removeItem(key);
193
- });
194
- },
195
- remove: function(key) {
196
- docCookies.removeItem(key);
197
- },
198
- };
1
+ /*
2
+ * Copyright 2019 WeBank
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ */
17
+
18
+ /* \
19
+ |*|
20
+ |*| :: cookies.js ::
21
+ |*|
22
+ |*| A complete cookies reader/writer framework with full unicode support.
23
+ |*|
24
+ |*| https://developer.mozilla.org/en-US/docs/DOM/document.cookie
25
+ |*|
26
+ |*| This framework is released under the GNU Public License, version 3 or later.
27
+ |*| http://www.gnu.org/licenses/gpl-3.0-standalone.html
28
+ |*|
29
+ |*| Syntaxes:
30
+ |*|
31
+ |*| * docCookies.setItem(name, value[, end[, path[, domain[, secure]]]])
32
+ |*| * docCookies.getItem(name)
33
+ |*| * docCookies.removeItem(name[, path], domain)
34
+ |*| * docCookies.hasItem(name)
35
+ |*| * docCookies.keys()
36
+ |*|
37
+ \ */
38
+
39
+ let docCookies = {
40
+ getItem: function(sKey) {
41
+ return decodeURIComponent(document.cookie.replace(new RegExp('(?:(?:^|.*;)\\s*' + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, '\\$&') + '\\s*\\=\\s*([^;]*).*$)|^.*$'), '$1')) || null;
42
+ },
43
+ setItem: function(sKey, sValue, vEnd, sPath, sDomain, bSecure) {
44
+ if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) {
45
+ return false;
46
+ }
47
+ let sExpires = '';
48
+ if (vEnd) {
49
+ switch (vEnd.constructor) {
50
+ case Number:
51
+ sExpires = vEnd === Infinity ? '; expires=Fri, 31 Dec 9999 23:59:59 GMT' : '; max-age=' + vEnd;
52
+ break;
53
+ case String:
54
+ sExpires = '; expires=' + vEnd;
55
+ break;
56
+ case Date:
57
+ sExpires = '; expires=' + vEnd.toUTCString();
58
+ break;
59
+ }
60
+ }
61
+ document.cookie = encodeURIComponent(sKey) + '=' + encodeURIComponent(sValue) + sExpires + (sDomain ? '; domain=' + sDomain : '') + (sPath ? '; path=' + sPath : '') + (bSecure ? '; secure' : '');
62
+ return true;
63
+ },
64
+ removeItem: function(sKey, sPath, sDomain) {
65
+ if (!sKey || !this.hasItem(sKey)) {
66
+ return false;
67
+ }
68
+ document.cookie = encodeURIComponent(sKey) + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT' + (sDomain ? '; domain=' + sDomain : '') + (sPath ? '; path=' + sPath : '');
69
+ return true;
70
+ },
71
+ hasItem: function(sKey) {
72
+ return (new RegExp('(?:^|;\\s*)' + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, '\\$&') + '\\s*\\=')).test(document.cookie);
73
+ },
74
+ keys: /* optional method: you can safely remove it! */ function() {
75
+ let aKeys = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, '').split(/\s*(?:\=[^;]*)?;\s*/);
76
+ for (let nIdx = 0; nIdx < aKeys.length; nIdx++) {
77
+ aKeys[nIdx] = decodeURIComponent(aKeys[nIdx]);
78
+ }
79
+ return aKeys;
80
+ },
81
+ };
82
+
83
+ /**
84
+ * 操作cookie、sessionStorage、localStorage、缓存
85
+ */
86
+
87
+ const
88
+ SESSION = 'session';
89
+
90
+ const LOCAL = 'local';
91
+
92
+ const COOKIE = 'cookie';
93
+
94
+ export default {
95
+ set: function(key, value, category = SESSION, expired) {
96
+ let { storage, isWebStorage = true } = this._map(category);
97
+
98
+ if (isWebStorage) {
99
+ storageManager.set(key, value, storage);
100
+ } else {
101
+ cookieManager.set(key, value, expired);
102
+ }
103
+ },
104
+ get: function(key, category = SESSION) {
105
+ let { storage, isWebStorage = true } = this._map(category);
106
+
107
+ if (isWebStorage) {
108
+ return storageManager.get(key, storage);
109
+ } else {
110
+ return cookieManager.get(key);
111
+ }
112
+ },
113
+ clear: function(category = SESSION) {
114
+ let { storage, isWebStorage = true } = this._map(category);
115
+
116
+ if (isWebStorage) {
117
+ storageManager.clear(storage);
118
+ } else {
119
+ cookieManager.clear();
120
+ }
121
+ },
122
+ remove: function(key, category = SESSION) {
123
+ let { storage, isWebStorage = true } = this._map(category);
124
+
125
+ if (isWebStorage) {
126
+ storageManager.remove(key, storage);
127
+ } else {
128
+ cookieManager.remove(key);
129
+ }
130
+ },
131
+ _map: function(category) {
132
+ let isWebStorage = true; let storage;
133
+
134
+ switch (true) {
135
+ case category === SESSION:
136
+ storage = 'sessionStorage';
137
+ break;
138
+ case category === LOCAL:
139
+ storage = 'localStorage';
140
+ break;
141
+ case category === COOKIE:
142
+ storage = 'cookie';
143
+ isWebStorage = false;
144
+ break;
145
+ default:
146
+ storage = 'sessionStorage';
147
+ }
148
+
149
+ return { isWebStorage, storage };
150
+ },
151
+ };
152
+
153
+ let isProd = process.env.NODE_ENV === 'production';
154
+
155
+ export const storageManager = {
156
+ set: function(key, value, storage) {
157
+ try {
158
+ window[storage].setItem(key, JSON.stringify(value));
159
+ } catch (e) {
160
+ !isProd && console.error(e);
161
+ }
162
+ },
163
+ get: function(key, storage) {
164
+ try {
165
+ if (window[storage].getItem(key)) {
166
+ return JSON.parse(window[storage].getItem(key));
167
+ } else {
168
+ return window[storage].getItem(key);
169
+ }
170
+ } catch (e) {
171
+ !isProd && console.error(e, key);
172
+ }
173
+ },
174
+ clear: function(storage) {
175
+ window[storage].clear();
176
+ },
177
+ remove: function(key, storage) {
178
+ window[storage].removeItem(key);
179
+ },
180
+ };
181
+
182
+ export const cookieManager = {
183
+ set: function(key, value, expired) {
184
+ if (expired) docCookies.setItem(key, value, expired);
185
+ else docCookies.setItem(key, value);
186
+ },
187
+ get: function(key) {
188
+ return docCookies.getItem(key);
189
+ },
190
+ clear: function() {
191
+ docCookies.keys().forEach((key) => {
192
+ docCookies.removeItem(key);
193
+ });
194
+ },
195
+ remove: function(key) {
196
+ docCookies.removeItem(key);
197
+ },
198
+ };
package/utils/style.js CHANGED
@@ -1,24 +1,24 @@
1
- const SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g
2
- const MOZ_HACK_REGEXP = /^moz([A-Z])/
3
-
4
- function camelCase(name) {
5
- return name
6
- .replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
7
- return offset ? letter.toUpperCase() : letter
8
- })
9
- .replace(MOZ_HACK_REGEXP, 'Moz$1')
10
- }
11
- // getStyle
12
- export function getStyle(element, styleName) {
13
- if (!element || !styleName) return null
14
- styleName = camelCase(styleName)
15
- if (styleName === 'float') {
16
- styleName = 'cssFloat'
17
- }
18
- try {
19
- const computed = document.defaultView.getComputedStyle(element, '')
20
- return element.style[styleName] || computed ? computed[styleName] : null
21
- } catch (e) {
22
- return element.style[styleName]
23
- }
24
- }
1
+ const SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g
2
+ const MOZ_HACK_REGEXP = /^moz([A-Z])/
3
+
4
+ function camelCase(name) {
5
+ return name
6
+ .replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
7
+ return offset ? letter.toUpperCase() : letter
8
+ })
9
+ .replace(MOZ_HACK_REGEXP, 'Moz$1')
10
+ }
11
+ // getStyle
12
+ export function getStyle(element, styleName) {
13
+ if (!element || !styleName) return null
14
+ styleName = camelCase(styleName)
15
+ if (styleName === 'float') {
16
+ styleName = 'cssFloat'
17
+ }
18
+ try {
19
+ const computed = document.defaultView.getComputedStyle(element, '')
20
+ return element.style[styleName] || computed ? computed[styleName] : null
21
+ } catch (e) {
22
+ return element.style[styleName]
23
+ }
24
+ }
@@ -1,7 +1,7 @@
1
- let transferIndex = 1000
2
-
3
- function transferIncrease() {
4
- transferIndex++
5
- }
6
-
7
- export { transferIndex, transferIncrease }
1
+ let transferIndex = 1000
2
+
3
+ function transferIncrease() {
4
+ transferIndex++
5
+ }
6
+
7
+ export { transferIndex, transferIncrease }
package/utils/type.js CHANGED
@@ -1,102 +1,102 @@
1
- /*
2
- * Copyright 2019 WeBank
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- */
17
-
18
- const objectToString = Object.prototype.toString;
19
- const OBJECT_STRING = '[object Object]';
20
-
21
- /**
22
- * 是否是普通对象
23
- * @param {any} obj
24
- * @return {Boolean}
25
- */
26
- export function isPlainObject(obj) {
27
- return objectToString.call(obj) === OBJECT_STRING;
28
- }
29
-
30
- /**
31
- * 是否是数字
32
- * @param {any} value
33
- * @return {Boolean}
34
- */
35
- export function isNumber(value) {
36
- return typeof value === 'number';
37
- }
38
-
39
- /**
40
- * 是否是日期
41
- * @param {any} value
42
- * @return {Boolean}
43
- */
44
- export function isDate(value) {
45
- return objectToString.call(value) === '[object Date]';
46
- }
47
-
48
- /**
49
- * 是否是函数
50
- * @param {any} value
51
- * @return {Boolean}
52
- */
53
- export function isFunction(value) {
54
- return typeof value === 'function';
55
- }
56
-
57
- /**
58
- * 是否是函数
59
- * @param {any} value
60
- * @return {Boolean}
61
- */
62
- export function isObject(value) {
63
- let type = typeof value;
64
- return !!value && (type == 'object' || type == 'function');
65
- }
66
-
67
- /**
68
- * 是否是数组
69
- * @param {any} value
70
- * @return {Boolean}
71
- */
72
- export function isArray(value) {
73
- return Array.isArray(value);
74
- }
75
-
76
- /**
77
- * 是否像对象
78
- * @param {any} value
79
- * @return {Boolean}
80
- */
81
- export function isObjectLike(value) {
82
- return !!value && typeof value == 'object';
83
- }
84
-
85
- /**
86
- * 是否是字符串
87
- * @param {any} value
88
- * @return {Boolean}
89
- */
90
- export function isString(value) {
91
- return typeof value == 'string' ||
92
- (!isArray(value) && isObjectLike(value) && objectToString.call(value) == '[object String]');
93
- }
94
-
95
- /**
96
- * 是否是空的
97
- * @param {any} value
98
- * @return {Boolean}
99
- */
100
- export function isNull(value) {
101
- return value === undefined || value === null || value === '';
102
- }
1
+ /*
2
+ * Copyright 2019 WeBank
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ */
17
+
18
+ const objectToString = Object.prototype.toString;
19
+ const OBJECT_STRING = '[object Object]';
20
+
21
+ /**
22
+ * 是否是普通对象
23
+ * @param {any} obj
24
+ * @return {Boolean}
25
+ */
26
+ export function isPlainObject(obj) {
27
+ return objectToString.call(obj) === OBJECT_STRING;
28
+ }
29
+
30
+ /**
31
+ * 是否是数字
32
+ * @param {any} value
33
+ * @return {Boolean}
34
+ */
35
+ export function isNumber(value) {
36
+ return typeof value === 'number';
37
+ }
38
+
39
+ /**
40
+ * 是否是日期
41
+ * @param {any} value
42
+ * @return {Boolean}
43
+ */
44
+ export function isDate(value) {
45
+ return objectToString.call(value) === '[object Date]';
46
+ }
47
+
48
+ /**
49
+ * 是否是函数
50
+ * @param {any} value
51
+ * @return {Boolean}
52
+ */
53
+ export function isFunction(value) {
54
+ return typeof value === 'function';
55
+ }
56
+
57
+ /**
58
+ * 是否是函数
59
+ * @param {any} value
60
+ * @return {Boolean}
61
+ */
62
+ export function isObject(value) {
63
+ let type = typeof value;
64
+ return !!value && (type == 'object' || type == 'function');
65
+ }
66
+
67
+ /**
68
+ * 是否是数组
69
+ * @param {any} value
70
+ * @return {Boolean}
71
+ */
72
+ export function isArray(value) {
73
+ return Array.isArray(value);
74
+ }
75
+
76
+ /**
77
+ * 是否像对象
78
+ * @param {any} value
79
+ * @return {Boolean}
80
+ */
81
+ export function isObjectLike(value) {
82
+ return !!value && typeof value == 'object';
83
+ }
84
+
85
+ /**
86
+ * 是否是字符串
87
+ * @param {any} value
88
+ * @return {Boolean}
89
+ */
90
+ export function isString(value) {
91
+ return typeof value == 'string' ||
92
+ (!isArray(value) && isObjectLike(value) && objectToString.call(value) == '[object String]');
93
+ }
94
+
95
+ /**
96
+ * 是否是空的
97
+ * @param {any} value
98
+ * @return {Boolean}
99
+ */
100
+ export function isNull(value) {
101
+ return value === undefined || value === null || value === '';
102
+ }
@@ -1,23 +0,0 @@
1
- import * as CryptoJS from 'crypto-js';
2
-
3
- const AES_KEY = 'gYj2iqBV5AzxC8H0';
4
- const AES_IV = 'z5c8fSuHX1PxWtIg';
5
-
6
- crypto.aes = {
7
- encrypt(message) {
8
- return CryptoJS.AES.encrypt(message, AES_KEY, {
9
- mode: CryptoJS.mode.CBC,
10
- padding: CryptoJS.pad.Pkcs7,
11
- iv: AES_IV
12
- })
13
- },
14
- decrypt(ciphertext) {
15
- return CryptoJS.AES.decrypt(ciphertext, AES_KEY, {
16
- mode: CryptoJS.mode.CBC,
17
- padding: CryptoJS.pad.Pkcs7,
18
- iv: AES_IV
19
- }).toString(CryptoJS.enc.Utf8)
20
- }
21
- }
22
-
23
- export default crypto.aes;
@@ -1,16 +0,0 @@
1
- import NodeRSA from "node-rsa";
2
-
3
- const publicKey = `-----BEGIN PUBLIC KEY-----
4
- MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCyhhlApSAjPWRjzg+wSIfALbrC
5
- Ti4GVBYYBjfMYKU0O9z6EGQAXSLPW+S4VYm4LKtKXuKoeF441KU2HvnGM63cTIYt
6
- T4lGbTGeYfsbeWNs1u9G9J+DrfKK8HsVB1IZIqhbMf0x7KGMeoQ2SN4KtbaPIwhl
7
- IPfXzuLZiCW90l+a/wIDAQAB
8
- -----END PUBLIC KEY-----`;
9
-
10
- // 创建NodeRSA实例并指定公钥格式
11
- const key = new NodeRSA(publicKey, "pkcs8-public");
12
-
13
- // 加密函数
14
- function rsa(data) {
15
- return key.encrypt(data, "base64");
16
- }