vue2-client 1.4.2 → 1.4.3

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 (99) hide show
  1. package/.env +15 -15
  2. package/.eslintrc.js +82 -82
  3. package/index.js +30 -30
  4. package/package.json +78 -78
  5. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +225 -225
  6. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +113 -113
  7. package/src/base-client/components/common/CitySelect/CitySelect.vue +244 -244
  8. package/src/base-client/components/common/CitySelect/index.js +3 -3
  9. package/src/base-client/components/common/CitySelect/index.md +109 -109
  10. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +589 -543
  11. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +777 -777
  12. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +310 -310
  13. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +553 -553
  14. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  15. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  16. package/src/base-client/components/common/PersonSetting/PersonSetting.vue +210 -210
  17. package/src/base-client/components/common/PersonSetting/index.js +3 -3
  18. package/src/base-client/components/common/Upload/index.js +3 -3
  19. package/src/base-client/components/common/XAddForm/XAddForm.vue +354 -354
  20. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +327 -327
  21. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  22. package/src/base-client/components/common/XForm/XForm.vue +274 -274
  23. package/src/base-client/components/common/XForm/XFormItem.vue +389 -389
  24. package/src/base-client/components/common/XFormTable/index.md +96 -96
  25. package/src/base-client/components/common/XTable/XTable.vue +259 -259
  26. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  27. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  28. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  29. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  30. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  31. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  32. package/src/base-client/plugins/AppData.js +69 -69
  33. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  34. package/src/base-client/plugins/PagedList.js +177 -177
  35. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  36. package/src/base-client/plugins/i18n-extend.js +32 -32
  37. package/src/components/Ellipsis/index.md +38 -38
  38. package/src/components/NumberInfo/index.md +43 -43
  39. package/src/components/STable/README.md +341 -341
  40. package/src/components/STable/index.js +318 -318
  41. package/src/components/Trend/index.md +45 -45
  42. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  43. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  44. package/src/components/exception/ExceptionPage.vue +70 -70
  45. package/src/components/form/FormRow.vue +52 -52
  46. package/src/components/index.js +36 -36
  47. package/src/components/menu/SideMenu.vue +62 -62
  48. package/src/components/menu/menu.js +273 -273
  49. package/src/components/setting/Setting.vue +235 -235
  50. package/src/components/table/StandardTable.vue +141 -141
  51. package/src/components/table/advance/ActionColumns.vue +158 -158
  52. package/src/components/table/advance/SearchArea.vue +355 -355
  53. package/src/components/tool/AStepItem.vue +60 -60
  54. package/src/components/tool/AvatarList.vue +68 -68
  55. package/src/components/tool/Drawer.vue +142 -142
  56. package/src/components/tool/TagSelect.vue +83 -83
  57. package/src/components/transition/PageToggleTransition.vue +97 -97
  58. package/src/config/CreateQueryConfig.js +307 -307
  59. package/src/config/replacer/resolve.config.js +67 -67
  60. package/src/layouts/AdminLayout.vue +174 -174
  61. package/src/layouts/header/AdminHeader.vue +104 -104
  62. package/src/layouts/header/HeaderNotice.vue +167 -167
  63. package/src/layouts/header/HeaderSearch.vue +67 -67
  64. package/src/layouts/header/InstitutionDetail.vue +181 -181
  65. package/src/layouts/tabs/TabsHead.vue +190 -190
  66. package/src/layouts/tabs/TabsView.vue +379 -379
  67. package/src/mock/goods/index.js +108 -108
  68. package/src/pages/CreateQueryPage.vue +65 -65
  69. package/src/pages/report/ReportTable.js +124 -124
  70. package/src/pages/report/ReportTableHome.vue +28 -28
  71. package/src/pages/resourceManage/orgListManage.vue +98 -98
  72. package/src/pages/system/dictionary/index.vue +43 -43
  73. package/src/pages/system/file/index.vue +317 -317
  74. package/src/pages/system/queryParams/index.vue +43 -43
  75. package/src/router/async/config.async.js +27 -27
  76. package/src/router/async/router.map.js +2 -0
  77. package/src/router/index.js +27 -27
  78. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  79. package/src/services/api/LogDetailsViewApi.js +10 -10
  80. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  81. package/src/services/api/TicketDetailsViewApi.js +34 -34
  82. package/src/services/api/commonTempTable.js +10 -10
  83. package/src/services/api/index.js +17 -17
  84. package/src/services/api/manage.js +8 -8
  85. package/src/services/api/restTools.js +24 -24
  86. package/src/store/mutation-types.js +2 -2
  87. package/src/theme/default/nprogress.less +76 -76
  88. package/src/theme/default/style.less +47 -47
  89. package/src/utils/colors.js +103 -103
  90. package/src/utils/excel/Blob.js +180 -180
  91. package/src/utils/excel/Export2Excel.js +141 -141
  92. package/src/utils/formatter.js +68 -68
  93. package/src/utils/i18n.js +80 -80
  94. package/src/utils/request.js +225 -225
  95. package/src/utils/routerUtil.js +364 -364
  96. package/src/utils/theme-color-replacer-extend.js +91 -91
  97. package/src/utils/themeUtil.js +100 -100
  98. package/src/utils/util.js +230 -230
  99. package/vue.config.js +2 -2
@@ -1,47 +1,47 @@
1
- .week-mode{
2
- overflow: hidden;
3
- filter: invert(80%);
4
- }
5
- .beauty-scroll{
6
- scrollbar-color: @primary-color @primary-2;
7
- scrollbar-width: thin;
8
- -ms-overflow-style:none;
9
- position: relative;
10
- &::-webkit-scrollbar{
11
- width: 3px;
12
- height: 1px;
13
- }
14
- &::-webkit-scrollbar-thumb {
15
- border-radius: 3px;
16
- background: @primary-color;
17
- }
18
- &::-webkit-scrollbar-track {
19
- -webkit-box-shadow: inset 0 0 1px rgba(0,0,0,0);
20
- border-radius: 3px;
21
- background: @primary-3;
22
- }
23
- }
24
- .split-right{
25
- &:not(:last-child) {
26
- border-right: 1px solid rgba(98, 98, 98, 0.2);
27
- }
28
- }
29
- .disabled{
30
- cursor: not-allowed;
31
- color: @disabled-color;
32
- pointer-events: none;
33
- }
34
-
35
- ::-webkit-scrollbar{
36
- width: 5px;
37
- height: 5px;
38
- }
39
- ::-webkit-scrollbar-thumb {
40
- border-radius: 3px;
41
- background: @primary-3;
42
- }
43
- ::-webkit-scrollbar-track {
44
- -webkit-box-shadow: inset 0 0 1px rgba(0,0,0,0);
45
- border-radius: 3px;
46
- background: @primary-1;
47
- }
1
+ .week-mode{
2
+ overflow: hidden;
3
+ filter: invert(80%);
4
+ }
5
+ .beauty-scroll{
6
+ scrollbar-color: @primary-color @primary-2;
7
+ scrollbar-width: thin;
8
+ -ms-overflow-style:none;
9
+ position: relative;
10
+ &::-webkit-scrollbar{
11
+ width: 3px;
12
+ height: 1px;
13
+ }
14
+ &::-webkit-scrollbar-thumb {
15
+ border-radius: 3px;
16
+ background: @primary-color;
17
+ }
18
+ &::-webkit-scrollbar-track {
19
+ -webkit-box-shadow: inset 0 0 1px rgba(0,0,0,0);
20
+ border-radius: 3px;
21
+ background: @primary-3;
22
+ }
23
+ }
24
+ .split-right{
25
+ &:not(:last-child) {
26
+ border-right: 1px solid rgba(98, 98, 98, 0.2);
27
+ }
28
+ }
29
+ .disabled{
30
+ cursor: not-allowed;
31
+ color: @disabled-color;
32
+ pointer-events: none;
33
+ }
34
+
35
+ ::-webkit-scrollbar{
36
+ width: 5px;
37
+ height: 5px;
38
+ }
39
+ ::-webkit-scrollbar-thumb {
40
+ border-radius: 3px;
41
+ background: @primary-3;
42
+ }
43
+ ::-webkit-scrollbar-track {
44
+ -webkit-box-shadow: inset 0 0 1px rgba(0,0,0,0);
45
+ border-radius: 3px;
46
+ background: @primary-1;
47
+ }
@@ -1,103 +1,103 @@
1
- const varyColor = require('webpack-theme-color-replacer/client/varyColor')
2
- const { generate } = require('@ant-design/colors')
3
- const { ADMIN, ANTD } = require('../config/default')
4
- const Config = require('../config')
5
-
6
- const themeMode = ADMIN.theme.mode
7
-
8
- // 获取 ant design 色系
9
- function getAntdColors (color, mode) {
10
- const options = mode && (mode === themeMode.NIGHT) ? { theme: 'dark' } : undefined
11
- return generate(color, options)
12
- }
13
-
14
- // 获取功能性颜色
15
- function getFunctionalColors (mode) {
16
- const options = mode && (mode === themeMode.NIGHT) ? { theme: 'dark' } : undefined
17
- let { success, warning, error } = ANTD.primary
18
- const { success: s1, warning: w1, error: e1 } = Config.theme
19
- success = success && s1
20
- warning = success && w1
21
- error = success && e1
22
- const successColors = generate(success, options)
23
- const warningColors = generate(warning, options)
24
- const errorColors = generate(error, options)
25
- return {
26
- success: successColors,
27
- warning: warningColors,
28
- error: errorColors
29
- }
30
- }
31
-
32
- // 获取菜单色系
33
- function getMenuColors (color, mode) {
34
- if (mode === themeMode.NIGHT) {
35
- return ANTD.primary.night.menuColors
36
- } else if (color === ANTD.primary.color) {
37
- return ANTD.primary.dark.menuColors
38
- } else {
39
- return [varyColor.darken(color, 0.93), varyColor.darken(color, 0.83), varyColor.darken(color, 0.73)]
40
- }
41
- }
42
-
43
- // 获取主题模式切换色系
44
- function getThemeToggleColors (color, mode) {
45
- // 主色系
46
- const mainColors = getAntdColors(color, mode)
47
- const primary = mainColors[5]
48
- // 辅助色系,因为 antd 目前没针对夜间模式设计,所以增加辅助色系以保证夜间模式的正常切换
49
- const subColors = getAntdColors(primary, themeMode.LIGHT)
50
- // 菜单色系
51
- const menuColors = getMenuColors(color, mode)
52
- // 内容色系(包含背景色、文字颜色等)
53
- const themeCfg = ANTD.theme[mode]
54
- let contentColors = Object.keys(themeCfg)
55
- .map(key => themeCfg[key])
56
- .map(color => isHex(color) ? color : toNum3(color).join(','))
57
- // 内容色去重
58
- contentColors = [...new Set(contentColors)]
59
- // rgb 格式的主题色
60
- const rgbColors = [toNum3(primary).join(',')]
61
- const functionalColors = getFunctionalColors(mode)
62
- return { primary, mainColors, subColors, menuColors, contentColors, rgbColors, functionalColors }
63
- }
64
-
65
- function toNum3 (color) {
66
- if (isHex(color)) {
67
- return varyColor.toNum3(color)
68
- }
69
- let colorStr = ''
70
- if (isRgb(color)) {
71
- colorStr = color.slice(5, color.length)
72
- } else if (isRgba(color)) {
73
- colorStr = color.slice(6, color.lastIndexOf(','))
74
- }
75
- const rgb = colorStr.split(',')
76
- const r = parseInt(rgb[0])
77
- const g = parseInt(rgb[1])
78
- const b = parseInt(rgb[2])
79
- return [r, g, b]
80
- }
81
-
82
- function isHex (color) {
83
- return color.length >= 4 && color[0] === '#'
84
- }
85
-
86
- function isRgb (color) {
87
- return color.length >= 10 && color.slice(0, 3) === 'rgb'
88
- }
89
-
90
- function isRgba (color) {
91
- return color.length >= 13 && color.slice(0, 4) === 'rgba'
92
- }
93
-
94
- module.exports = {
95
- isHex,
96
- isRgb,
97
- isRgba,
98
- toNum3,
99
- getAntdColors,
100
- getMenuColors,
101
- getThemeToggleColors,
102
- getFunctionalColors
103
- }
1
+ const varyColor = require('webpack-theme-color-replacer/client/varyColor')
2
+ const { generate } = require('@ant-design/colors')
3
+ const { ADMIN, ANTD } = require('../config/default')
4
+ const Config = require('../config')
5
+
6
+ const themeMode = ADMIN.theme.mode
7
+
8
+ // 获取 ant design 色系
9
+ function getAntdColors (color, mode) {
10
+ const options = mode && (mode === themeMode.NIGHT) ? { theme: 'dark' } : undefined
11
+ return generate(color, options)
12
+ }
13
+
14
+ // 获取功能性颜色
15
+ function getFunctionalColors (mode) {
16
+ const options = mode && (mode === themeMode.NIGHT) ? { theme: 'dark' } : undefined
17
+ let { success, warning, error } = ANTD.primary
18
+ const { success: s1, warning: w1, error: e1 } = Config.theme
19
+ success = success && s1
20
+ warning = success && w1
21
+ error = success && e1
22
+ const successColors = generate(success, options)
23
+ const warningColors = generate(warning, options)
24
+ const errorColors = generate(error, options)
25
+ return {
26
+ success: successColors,
27
+ warning: warningColors,
28
+ error: errorColors
29
+ }
30
+ }
31
+
32
+ // 获取菜单色系
33
+ function getMenuColors (color, mode) {
34
+ if (mode === themeMode.NIGHT) {
35
+ return ANTD.primary.night.menuColors
36
+ } else if (color === ANTD.primary.color) {
37
+ return ANTD.primary.dark.menuColors
38
+ } else {
39
+ return [varyColor.darken(color, 0.93), varyColor.darken(color, 0.83), varyColor.darken(color, 0.73)]
40
+ }
41
+ }
42
+
43
+ // 获取主题模式切换色系
44
+ function getThemeToggleColors (color, mode) {
45
+ // 主色系
46
+ const mainColors = getAntdColors(color, mode)
47
+ const primary = mainColors[5]
48
+ // 辅助色系,因为 antd 目前没针对夜间模式设计,所以增加辅助色系以保证夜间模式的正常切换
49
+ const subColors = getAntdColors(primary, themeMode.LIGHT)
50
+ // 菜单色系
51
+ const menuColors = getMenuColors(color, mode)
52
+ // 内容色系(包含背景色、文字颜色等)
53
+ const themeCfg = ANTD.theme[mode]
54
+ let contentColors = Object.keys(themeCfg)
55
+ .map(key => themeCfg[key])
56
+ .map(color => isHex(color) ? color : toNum3(color).join(','))
57
+ // 内容色去重
58
+ contentColors = [...new Set(contentColors)]
59
+ // rgb 格式的主题色
60
+ const rgbColors = [toNum3(primary).join(',')]
61
+ const functionalColors = getFunctionalColors(mode)
62
+ return { primary, mainColors, subColors, menuColors, contentColors, rgbColors, functionalColors }
63
+ }
64
+
65
+ function toNum3 (color) {
66
+ if (isHex(color)) {
67
+ return varyColor.toNum3(color)
68
+ }
69
+ let colorStr = ''
70
+ if (isRgb(color)) {
71
+ colorStr = color.slice(5, color.length)
72
+ } else if (isRgba(color)) {
73
+ colorStr = color.slice(6, color.lastIndexOf(','))
74
+ }
75
+ const rgb = colorStr.split(',')
76
+ const r = parseInt(rgb[0])
77
+ const g = parseInt(rgb[1])
78
+ const b = parseInt(rgb[2])
79
+ return [r, g, b]
80
+ }
81
+
82
+ function isHex (color) {
83
+ return color.length >= 4 && color[0] === '#'
84
+ }
85
+
86
+ function isRgb (color) {
87
+ return color.length >= 10 && color.slice(0, 3) === 'rgb'
88
+ }
89
+
90
+ function isRgba (color) {
91
+ return color.length >= 13 && color.slice(0, 4) === 'rgba'
92
+ }
93
+
94
+ module.exports = {
95
+ isHex,
96
+ isRgb,
97
+ isRgba,
98
+ toNum3,
99
+ getAntdColors,
100
+ getMenuColors,
101
+ getThemeToggleColors,
102
+ getFunctionalColors
103
+ }
@@ -1,180 +1,180 @@
1
- /* eslint-disable */
2
- /* Blob.js
3
- * A Blob implementation.
4
- * 2014-05-27
5
- *
6
- * By Eli Grey, http://eligrey.com
7
- * By Devin Samarin, https://github.com/eboyjr
8
- * License: X11/MIT
9
- * See LICENSE.md
10
- */
11
-
12
- /*global self, unescape */
13
- /*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
14
- plusplus: true */
15
-
16
- /*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */
17
-
18
- (function (view) {
19
- "use strict";
20
-
21
- view.URL = view.URL || view.webkitURL;
22
-
23
- if (view.Blob && view.URL) {
24
- try {
25
- new Blob;
26
- return;
27
- } catch (e) {
28
- }
29
- }
30
-
31
- // Internally we use a BlobBuilder implementation to base Blob off of
32
- // in order to support older browsers that only have BlobBuilder
33
- const BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || (function (view) {
34
- const get_class = function (object) {
35
- return Object.prototype.toString.call(object).match(/^\[object\s(.*)]$/)[1];
36
- }
37
- , FakeBlobBuilder = function BlobBuilder() {
38
- this.data = [];
39
- }
40
- , FakeBlob = function Blob(data, type, encoding) {
41
- this.data = data;
42
- this.size = data.length;
43
- this.type = type;
44
- this.encoding = encoding;
45
- }
46
- , FBB_proto = FakeBlobBuilder.prototype
47
- , FB_proto = FakeBlob.prototype
48
- , FileReaderSync = view.FileReaderSync
49
- , FileException = function (type) {
50
- this.code = this[this.name = type];
51
- }
52
- , file_ex_codes = (
53
- "NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR "
54
- + "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR"
55
- ).split(" ")
56
- ;let file_ex_code = file_ex_codes.length
57
- ;const real_URL = view.URL || view.webkitURL || view
58
- , real_create_object_URL = real_URL.createObjectURL
59
- , real_revoke_object_URL = real_URL.revokeObjectURL
60
- ;let URL = real_URL
61
- ;const btoa = view.btoa
62
- , atob = view.atob
63
-
64
- , ArrayBuffer = view.ArrayBuffer
65
- , Uint8Array = view.Uint8Array
66
- ;
67
- FakeBlob.fake = FB_proto.fake = true;
68
- while (file_ex_code--) {
69
- FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1;
70
- }
71
- if (!real_URL.createObjectURL) {
72
- URL = view.URL = {};
73
- }
74
- URL.createObjectURL = function (blob) {
75
- let type = blob.type
76
- , data_URI_header
77
- ;
78
- if (type === null) {
79
- type = "application/octet-stream";
80
- }
81
- if (blob instanceof FakeBlob) {
82
- data_URI_header = "data:" + type;
83
- if (blob.encoding === "base64") {
84
- return data_URI_header + ";base64," + blob.data;
85
- } else if (blob.encoding === "URI") {
86
- return data_URI_header + "," + decodeURIComponent(blob.data);
87
- }
88
- if (btoa) {
89
- return data_URI_header + ";base64," + btoa(blob.data);
90
- } else {
91
- return data_URI_header + "," + encodeURIComponent(blob.data);
92
- }
93
- } else if (real_create_object_URL) {
94
- return real_create_object_URL.call(real_URL, blob);
95
- }
96
- };
97
- URL.revokeObjectURL = function (object_URL) {
98
- if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) {
99
- real_revoke_object_URL.call(real_URL, object_URL);
100
- }
101
- };
102
- FBB_proto.append = function (data/*, endings*/) {
103
- const bb = this.data;
104
- // decode data to a binary string
105
- if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) {
106
- let str = ""
107
- ;const buf = new Uint8Array(data)
108
- ;let i = 0
109
- ;const buf_len = buf.length
110
- ;
111
- for (; i < buf_len; i++) {
112
- str += String.fromCharCode(buf[i]);
113
- }
114
- bb.push(str);
115
- } else if (get_class(data) === "Blob" || get_class(data) === "File") {
116
- if (FileReaderSync) {
117
- const fr = new FileReaderSync;
118
- bb.push(fr.readAsBinaryString(data));
119
- } else {
120
- // async FileReader won't work as BlobBuilder is sync
121
- throw new FileException("NOT_READABLE_ERR");
122
- }
123
- } else if (data instanceof FakeBlob) {
124
- if (data.encoding === "base64" && atob) {
125
- bb.push(atob(data.data));
126
- } else if (data.encoding === "URI") {
127
- bb.push(decodeURIComponent(data.data));
128
- } else if (data.encoding === "raw") {
129
- bb.push(data.data);
130
- }
131
- } else {
132
- if (typeof data !== "string") {
133
- data += ""; // convert unsupported types to strings
134
- }
135
- // decode UTF-16 to binary string
136
- bb.push(unescape(encodeURIComponent(data)));
137
- }
138
- };
139
- FBB_proto.getBlob = function (type) {
140
- if (!arguments.length) {
141
- type = null;
142
- }
143
- return new FakeBlob(this.data.join(""), type, "raw");
144
- };
145
- FBB_proto.toString = function () {
146
- return "[object BlobBuilder]";
147
- };
148
- FB_proto.slice = function (start, end, type) {
149
- const args = arguments.length;
150
- if (args < 3) {
151
- type = null;
152
- }
153
- return new FakeBlob(
154
- this.data.slice(start, args > 1 ? end : this.data.length)
155
- , type
156
- , this.encoding
157
- );
158
- };
159
- FB_proto.toString = function () {
160
- return "[object Blob]";
161
- };
162
- FB_proto.close = function () {
163
- this.size = this.data.length = 0;
164
- };
165
- return FakeBlobBuilder;
166
- }(view));
167
-
168
- view.Blob = function Blob(blobParts, options) {
169
- const type = options ? (options.type || "") : "";
170
- const builder = new BlobBuilder();
171
- if (blobParts) {
172
- let i = 0;
173
- const len = blobParts.length;
174
- for (; i < len; i++) {
175
- builder.append(blobParts[i]);
176
- }
177
- }
178
- return builder.getBlob(type);
179
- };
180
- }(typeof self !== "undefined" && self || typeof window !== "undefined" && window || this.content || this));
1
+ /* eslint-disable */
2
+ /* Blob.js
3
+ * A Blob implementation.
4
+ * 2014-05-27
5
+ *
6
+ * By Eli Grey, http://eligrey.com
7
+ * By Devin Samarin, https://github.com/eboyjr
8
+ * License: X11/MIT
9
+ * See LICENSE.md
10
+ */
11
+
12
+ /*global self, unescape */
13
+ /*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
14
+ plusplus: true */
15
+
16
+ /*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */
17
+
18
+ (function (view) {
19
+ "use strict";
20
+
21
+ view.URL = view.URL || view.webkitURL;
22
+
23
+ if (view.Blob && view.URL) {
24
+ try {
25
+ new Blob;
26
+ return;
27
+ } catch (e) {
28
+ }
29
+ }
30
+
31
+ // Internally we use a BlobBuilder implementation to base Blob off of
32
+ // in order to support older browsers that only have BlobBuilder
33
+ const BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || (function (view) {
34
+ const get_class = function (object) {
35
+ return Object.prototype.toString.call(object).match(/^\[object\s(.*)]$/)[1];
36
+ }
37
+ , FakeBlobBuilder = function BlobBuilder() {
38
+ this.data = [];
39
+ }
40
+ , FakeBlob = function Blob(data, type, encoding) {
41
+ this.data = data;
42
+ this.size = data.length;
43
+ this.type = type;
44
+ this.encoding = encoding;
45
+ }
46
+ , FBB_proto = FakeBlobBuilder.prototype
47
+ , FB_proto = FakeBlob.prototype
48
+ , FileReaderSync = view.FileReaderSync
49
+ , FileException = function (type) {
50
+ this.code = this[this.name = type];
51
+ }
52
+ , file_ex_codes = (
53
+ "NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR "
54
+ + "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR"
55
+ ).split(" ")
56
+ ;let file_ex_code = file_ex_codes.length
57
+ ;const real_URL = view.URL || view.webkitURL || view
58
+ , real_create_object_URL = real_URL.createObjectURL
59
+ , real_revoke_object_URL = real_URL.revokeObjectURL
60
+ ;let URL = real_URL
61
+ ;const btoa = view.btoa
62
+ , atob = view.atob
63
+
64
+ , ArrayBuffer = view.ArrayBuffer
65
+ , Uint8Array = view.Uint8Array
66
+ ;
67
+ FakeBlob.fake = FB_proto.fake = true;
68
+ while (file_ex_code--) {
69
+ FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1;
70
+ }
71
+ if (!real_URL.createObjectURL) {
72
+ URL = view.URL = {};
73
+ }
74
+ URL.createObjectURL = function (blob) {
75
+ let type = blob.type
76
+ , data_URI_header
77
+ ;
78
+ if (type === null) {
79
+ type = "application/octet-stream";
80
+ }
81
+ if (blob instanceof FakeBlob) {
82
+ data_URI_header = "data:" + type;
83
+ if (blob.encoding === "base64") {
84
+ return data_URI_header + ";base64," + blob.data;
85
+ } else if (blob.encoding === "URI") {
86
+ return data_URI_header + "," + decodeURIComponent(blob.data);
87
+ }
88
+ if (btoa) {
89
+ return data_URI_header + ";base64," + btoa(blob.data);
90
+ } else {
91
+ return data_URI_header + "," + encodeURIComponent(blob.data);
92
+ }
93
+ } else if (real_create_object_URL) {
94
+ return real_create_object_URL.call(real_URL, blob);
95
+ }
96
+ };
97
+ URL.revokeObjectURL = function (object_URL) {
98
+ if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) {
99
+ real_revoke_object_URL.call(real_URL, object_URL);
100
+ }
101
+ };
102
+ FBB_proto.append = function (data/*, endings*/) {
103
+ const bb = this.data;
104
+ // decode data to a binary string
105
+ if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) {
106
+ let str = ""
107
+ ;const buf = new Uint8Array(data)
108
+ ;let i = 0
109
+ ;const buf_len = buf.length
110
+ ;
111
+ for (; i < buf_len; i++) {
112
+ str += String.fromCharCode(buf[i]);
113
+ }
114
+ bb.push(str);
115
+ } else if (get_class(data) === "Blob" || get_class(data) === "File") {
116
+ if (FileReaderSync) {
117
+ const fr = new FileReaderSync;
118
+ bb.push(fr.readAsBinaryString(data));
119
+ } else {
120
+ // async FileReader won't work as BlobBuilder is sync
121
+ throw new FileException("NOT_READABLE_ERR");
122
+ }
123
+ } else if (data instanceof FakeBlob) {
124
+ if (data.encoding === "base64" && atob) {
125
+ bb.push(atob(data.data));
126
+ } else if (data.encoding === "URI") {
127
+ bb.push(decodeURIComponent(data.data));
128
+ } else if (data.encoding === "raw") {
129
+ bb.push(data.data);
130
+ }
131
+ } else {
132
+ if (typeof data !== "string") {
133
+ data += ""; // convert unsupported types to strings
134
+ }
135
+ // decode UTF-16 to binary string
136
+ bb.push(unescape(encodeURIComponent(data)));
137
+ }
138
+ };
139
+ FBB_proto.getBlob = function (type) {
140
+ if (!arguments.length) {
141
+ type = null;
142
+ }
143
+ return new FakeBlob(this.data.join(""), type, "raw");
144
+ };
145
+ FBB_proto.toString = function () {
146
+ return "[object BlobBuilder]";
147
+ };
148
+ FB_proto.slice = function (start, end, type) {
149
+ const args = arguments.length;
150
+ if (args < 3) {
151
+ type = null;
152
+ }
153
+ return new FakeBlob(
154
+ this.data.slice(start, args > 1 ? end : this.data.length)
155
+ , type
156
+ , this.encoding
157
+ );
158
+ };
159
+ FB_proto.toString = function () {
160
+ return "[object Blob]";
161
+ };
162
+ FB_proto.close = function () {
163
+ this.size = this.data.length = 0;
164
+ };
165
+ return FakeBlobBuilder;
166
+ }(view));
167
+
168
+ view.Blob = function Blob(blobParts, options) {
169
+ const type = options ? (options.type || "") : "";
170
+ const builder = new BlobBuilder();
171
+ if (blobParts) {
172
+ let i = 0;
173
+ const len = blobParts.length;
174
+ for (; i < len; i++) {
175
+ builder.append(blobParts[i]);
176
+ }
177
+ }
178
+ return builder.getBlob(type);
179
+ };
180
+ }(typeof self !== "undefined" && self || typeof window !== "undefined" && window || this.content || this));