@ajaxjs/ui 1.2.0 → 1.2.2

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 (44) hide show
  1. package/package.json +4 -3
  2. package/src/App.vue +0 -14
  3. package/src/index.ts +0 -50
  4. package/src/main.ts +0 -12
  5. package/src/pages/calendar.vue +0 -33
  6. package/src/pages/form.vue +0 -68
  7. package/src/pages/html-editor.vue +0 -44
  8. package/src/pages/index.vue +0 -150
  9. package/src/pages/play-ground.vue +0 -14
  10. package/src/pages/widgets.vue +0 -183
  11. package/src/router/index.ts +0 -19
  12. package/src/shims-vue.d.ts +0 -4
  13. package/src/style/common-functions.less +0 -294
  14. package/src/style/reset.less +0 -19
  15. package/src/util/cookies.ts +0 -43
  16. package/src/util/dom.ts +0 -47
  17. package/src/util/utils.ts +0 -184
  18. package/src/util/xhr-config.ts +0 -25
  19. package/src/util/xhr.ts +0 -296
  20. package/src/widget/AccordionMenu.vue +0 -140
  21. package/src/widget/AdjustFontSize.vue +0 -65
  22. package/src/widget/Article.vue +0 -59
  23. package/src/widget/EmptyContent.js +0 -4
  24. package/src/widget/Expander.vue +0 -65
  25. package/src/widget/FileUploader/FileUploader.less +0 -68
  26. package/src/widget/FileUploader/FileUploader.ts +0 -156
  27. package/src/widget/FileUploader/FileUploader.vue +0 -43
  28. package/src/widget/HtmlEditor/HtmlEditor.less +0 -345
  29. package/src/widget/HtmlEditor/HtmlEditor.ts +0 -339
  30. package/src/widget/HtmlEditor/HtmlEditor.vue +0 -70
  31. package/src/widget/HtmlEditor/html-editor-HtmlSanitizer.js +0 -103
  32. package/src/widget/ImageEnlarger.vue +0 -105
  33. package/src/widget/OpacityBanner.vue +0 -125
  34. package/src/widget/ProcessLine.vue +0 -133
  35. package/src/widget/Resize.ts +0 -152
  36. package/src/widget/Resize.vue +0 -104
  37. package/src/widget/TreeSelector.vue +0 -4
  38. package/src/widget/calendar/BetweenDate.vue +0 -63
  39. package/src/widget/calendar/Calendar.less +0 -210
  40. package/src/widget/calendar/Calendar.ts +0 -167
  41. package/src/widget/calendar/Calendar.vue +0 -52
  42. package/src/widget/calendar/CalendarInput.vue +0 -71
  43. package/src/widget/form/validator.ts +0 -289
  44. package/src/widget/play-ground/sku.vue +0 -93
@@ -1,156 +0,0 @@
1
- import Empty from '../EmptyContent';
2
-
3
- export default {
4
- props: {
5
- action: { type: String, required: false }, // 上传路径
6
- limitSize: { type: Number, default: 20000 }, // 文件大小限制
7
- limitFileType: String,
8
- isImgUpload: Boolean,
9
- isShowBtn: { type: Boolean, default: true },
10
- accpectFileType: {
11
- type: String, default() {
12
- if (this.isImgUpload)
13
- return 'image/*';
14
- }
15
- }, // 可以上传类型 如 image/*
16
- buttonBottom: Boolean, // 上传按钮是否位于下方
17
- radomId: {
18
- type: Number, default() { // 不重复的 id,用关于关联 label 与 input[type=file]
19
- return Math.round(Math.random() * 1000);
20
- },
21
- },
22
- },
23
-
24
- data() {
25
- return {
26
- model: { children: [] },
27
- imgSrc: Empty.empty,
28
- open: false,
29
- allowAddNode: false,
30
- // isFolder : false
31
- fileName: '', // 获取文件名称,只能是名称,不能获取完整的文件目录
32
- fileSize: 0, // 文件大小
33
- progress: 0, // 上传进度百分比
34
- errMsg: '', // 错误信息。约定:只有为空字符串,才表示允许上传。
35
- newlyId: '', // 成功上传之后的文件 id
36
- fileObj: null
37
- }
38
- },
39
-
40
- methods: {
41
- /**
42
- * 选择文件后触发的事件
43
- *
44
- * @param ev
45
- */
46
- onUploadInputChange(ev: Event): void {
47
- let fileInput: HTMLInputElement = <HTMLInputElement>ev.target;
48
- if (!fileInput.files || !fileInput.files[0]) return;
49
-
50
- // this.errStatus = [false, false, false];
51
- this.onFileGet(fileInput.files);
52
-
53
- let file: File = fileInput.files[0];
54
- this.fileObj = file;
55
-
56
- if (this.isImgUpload) {
57
- let reader: FileReader = new FileReader();
58
- reader.onload = (e) => {
59
- let imgBase64: string = <string>e.target.result; // 得到了图片的 base64 编码
60
- // alert(imgBase64Str);
61
- this.imgSrc = imgBase64;
62
- }
63
-
64
- reader.readAsDataURL(file);
65
- }
66
- },
67
-
68
- /**
69
- * 返回 File 对象,在表单混合上传时候有用
70
- * @returns
71
- */
72
- getFileObj(): File {
73
- return this.fileObj;
74
- },
75
-
76
- onDrop(ev: DragEvent): void {
77
- ev.preventDefault(); // 阻止进行拖拽时浏览器的默认行为,即自动打开图片
78
-
79
- if (ev.dataTransfer?.files) this.onFileGet(ev.dataTransfer.files);
80
- },
81
-
82
- onFileGet(files: FileList): void {
83
- let file: File = files[0],
84
- fileType: string = file.type;
85
-
86
- this.$fileObj = file;
87
- this.fileName = file.name;
88
- this.fileSize = file.size;
89
- },
90
- /**
91
- * 执行上传
92
- *
93
- * @param this
94
- */
95
- doUpload(): void {
96
- // this.$uploadOk_callback({ isOk: true, msg: "ok!", imgUrl: "fdfdf" });
97
- // return;
98
-
99
- let fd: FormData = new FormData();
100
-
101
- if (this.$blob) fd.append("file", this.$blob, this.fileName);
102
- else if (this.$fileObj) fd.append("file", this.$fileObj);
103
-
104
- let xhr: XMLHttpRequest = new XMLHttpRequest();
105
- //@ts-ignore
106
- xhr.onreadystatechange = aj.xhr.requestHandler.delegate(
107
- null,
108
- this.$uploadOk_callback,
109
- "json"
110
- );
111
- xhr.open("POST", this.action, true);
112
- xhr.onprogress = (ev: ProgressEvent) => {
113
- let progress: number = 0,
114
- p: number = ~~((ev.loaded * 1000) / ev.total);
115
- p = p / 10;
116
-
117
- if (progress !== p) progress = p;
118
-
119
- this.progress = progress;
120
- };
121
-
122
- xhr.send(fd);
123
- },
124
-
125
- changeByte: changeByte
126
- }
127
- }
128
-
129
- /**
130
- * 字节 Byte 转化成 KB,MB,GB
131
- *
132
- * @param limit
133
- */
134
- function changeByte(limit: number): string {
135
- let size: string = "";
136
-
137
- if (limit < 0.1 * 1024)
138
- // 小于 0.1KB,则转化成 B
139
- size = limit.toFixed(2) + "B";
140
- else if (limit < 0.1 * 1024 * 1024)
141
- // 小于 0.1MB,则转化成 KB
142
- size = (limit / 1024).toFixed(2) + "KB";
143
- else if (limit < 0.1 * 1024 * 1024 * 1024)
144
- // 小于 0.1GB,则转化成 MB
145
- size = (limit / (1024 * 1024)).toFixed(2) + "MB";
146
- // 其他转化成 GB
147
- else size = (limit / (1024 * 1024 * 1024)).toFixed(2) + "GB";
148
-
149
- let index = size.indexOf("."); // 获取小数点处的索引
150
-
151
- if (size.substr(index + 1, 2) == "00")
152
- // 获取小数点后两位的值,判断后两位是否为 00,如果是则删除 00
153
- return size.substring(0, index) + size.substr(index + 3, 2);
154
-
155
- return size;
156
- }
@@ -1,43 +0,0 @@
1
- <template>
2
- <div class="aj-file-uploader">
3
- <div v-if="isImgUpload">
4
- <img class="perviewImg" :src='imgSrc' />
5
- <br />
6
- </div>
7
-
8
- <table>
9
- <tr>
10
- <td>
11
- <input type="file" :id="'uploadInput_' + radomId" @change="onUploadInputChange" :accept="accpectFileType" />
12
-
13
- <label class="pseudoFilePicker" :for="'uploadInput_' + radomId">
14
- <div @drop="onDrop" ondragover="event.preventDefault();">
15
- <div>+</div>点击选择文件<br />或拖放到此
16
- </div>
17
- </label>
18
-
19
- </td>
20
- <td>
21
- <div class="msg" v-if="errMsg != ''">
22
- 允许类型:{{limitFileType || '无限制'}}
23
- <br />
24
- 允许大小:{{limitSize ? changeByte(limitSize * 1024) : '无限制'}}
25
- <span class="slot"></span>
26
- </div>
27
-
28
- <div class="msg" v-if="errMsg == ''">
29
- <div class="fileName" :title="'本地文件名: ' + fileName">{{fileName}}</div>
30
- <div v-if="fileSize">{{changeByte(fileSize)}}</div>
31
- <button @click.prevent="doUpload" v-if="isShowBtn">{{progress && progress !== 100 ? '上传中 ' + progress + '%': '上传'}}</button>
32
- </div>
33
- </td>
34
- </tr>
35
-
36
- </table>
37
-
38
- </div>
39
- </template>
40
-
41
- <script lang="ts" src="./FileUploader.ts"></script>
42
-
43
- <style lang="less" src="./FileUploader.less"></style>
@@ -1,345 +0,0 @@
1
- .aj-form-html-editor {
2
- ul.toolbar {
3
- border : 1px solid #C5C5C5;
4
- border-radius : 4px 4px 0 0;
5
- border-bottom : 0;
6
- background-color: #E8E7E4;
7
- width : 100%;
8
- min-height : 30px;
9
- margin : 0;
10
- box-sizing : border-box;
11
- padding : 3px 4px;
12
-
13
- &>li {
14
- list-style: none;
15
- float : left;
16
- cursor : pointer;
17
-
18
- &>i {
19
- border : 1px solid transparent;
20
- min-width : 25px;
21
- height : 20px;
22
- line-height: 20px;
23
- text-align : center;
24
- display : block;
25
-
26
- &.text-icon{
27
- font-family:Times New Roman;font-weight: bold;font-style: normal;
28
- }
29
-
30
- &.fontAwesome{
31
- padding-top: 2px;
32
- font : normal normal normal 18px/1 FontAwesome;
33
- }
34
-
35
- &:hover {
36
- border-right-color : #aaa;
37
- border-bottom-color: #aaa;
38
- border-top-color : #fff;
39
- border-left-color : #fff;
40
- }
41
-
42
- &:active {
43
- border-right-color : #f3f8fc;
44
- border-bottom-color: #f3f8fc;
45
- border-top-color : #ccc;
46
- border-left-color : #ccc;
47
- }
48
- }
49
-
50
- ul li {
51
- padding: 3px;
52
- cursor : pointer;
53
-
54
- &:hover {
55
- background-color: lightgray;
56
- }
57
- }
58
-
59
- .cleanHTML {
60
- background-size: 16px 16px;
61
- }
62
-
63
- .noBg {
64
- background-image: none;
65
- }
66
- }
67
- }
68
-
69
- .editorBody {
70
- iframe,
71
- textarea {
72
- border : 1px solid #C5C5C5;
73
- border-radius : 0 0 4px 4px;
74
- border-top-width: 0;
75
- box-sizing : border-box;
76
- background-color: white;
77
- min-height : 300px;
78
- width : 100%;
79
- }
80
-
81
- iframe.hide{
82
- display: none;
83
- }
84
- textarea {
85
- resize: none;
86
- display: none;
87
- &.show{
88
- display: block;
89
- }
90
- }
91
- }
92
-
93
- .colorPicker {
94
- width : 210px;
95
- border : 1px solid #D3D3D3;
96
- position: absolute;
97
-
98
- table {
99
- border-collapse: collapse;
100
- }
101
-
102
- .colorhead {
103
- height : 23px;
104
- line-height: 23px;
105
- font-weight: bold;
106
- width : 100%;
107
- }
108
-
109
- .colortitle {
110
- margin-left: 6px;
111
- font-size : 12px;
112
- }
113
-
114
- .colorpanel td {
115
- border : 1px solid #000;
116
- height : 10px;
117
- width : 10px;
118
- overflow : hidden;
119
- font-size: 1px;
120
- cursor : pointer;
121
- }
122
- }
123
-
124
- // 字体演示
125
- .fontfamilyChoser,
126
- .fontsizeChoser {
127
- a {
128
- padding-right : 2px;
129
- display : block;
130
- padding-left : 2px;
131
- padding-bottom : 2px;
132
- color : #000;
133
- line-height : 120%;
134
- padding-top : 2px;
135
- text-decoration: none;
136
-
137
- &:hover {
138
- background: #e5e5e5
139
- }
140
- }
141
- }
142
-
143
- // 登录面板 和忘记密码
144
- .dorpdown {
145
- position: relative;
146
-
147
- &:hover .fontfamilyChoser,
148
- .fontfamilyChoser:hover,
149
- &:hover .fontsizeChoser,
150
- .fontsizeChoser:hover,
151
- &:hover .colorPicker,
152
- .colorPicker:hover {
153
- display: block;
154
- }
155
-
156
- &>div {
157
- display : none;
158
- position : absolute;
159
- top : 22px;
160
- left : 0;
161
- background-color: #f5f5f5;
162
- border : 1px solid lightgray;
163
- border-top : 0;
164
- padding : 5px;
165
- width : 230px;
166
- }
167
-
168
- .fontsizeChoser {
169
- top : inherit;
170
- right: 0;
171
- }
172
- }
173
- }.aj-form-html-editor {
174
- ul.toolbar {
175
- border : 1px solid #C5C5C5;
176
- border-radius : 4px 4px 0 0;
177
- border-bottom : 0;
178
- background-color: #E8E7E4;
179
- width : 100%;
180
- min-height : 30px;
181
- margin : 0;
182
- box-sizing : border-box;
183
- padding : 3px 4px;
184
-
185
- &>li {
186
- list-style: none;
187
- float : left;
188
- cursor : pointer;
189
-
190
- &>i {
191
- border : 1px solid transparent;
192
- min-width : 25px;
193
- height : 20px;
194
- line-height: 20px;
195
- text-align : center;
196
- display : block;
197
-
198
- &.text-icon{
199
- font-family:Times New Roman;font-weight: bold;font-style: normal;
200
- }
201
-
202
- &.fontAwesome{
203
- padding-top: 2px;
204
- font : normal normal normal 18px/1 FontAwesome;
205
- }
206
-
207
- &:hover {
208
- border-right-color : #aaa;
209
- border-bottom-color: #aaa;
210
- border-top-color : #fff;
211
- border-left-color : #fff;
212
- }
213
-
214
- &:active {
215
- border-right-color : #f3f8fc;
216
- border-bottom-color: #f3f8fc;
217
- border-top-color : #ccc;
218
- border-left-color : #ccc;
219
- }
220
- }
221
-
222
- ul li {
223
- padding: 3px;
224
- cursor : pointer;
225
-
226
- &:hover {
227
- background-color: lightgray;
228
- }
229
- }
230
-
231
- .cleanHTML {
232
- background-size: 16px 16px;
233
- }
234
-
235
- .noBg {
236
- background-image: none;
237
- }
238
- }
239
- }
240
-
241
- .editorBody {
242
- iframe,
243
- textarea {
244
- border : 1px solid #C5C5C5;
245
- border-radius : 0 0 4px 4px;
246
- border-top-width: 0;
247
- box-sizing : border-box;
248
- background-color: white;
249
- min-height : 300px;
250
- width : 100%;
251
- }
252
-
253
- iframe.hide{
254
- display: none;
255
- }
256
- textarea {
257
- resize: none;
258
- display: none;
259
- &.show{
260
- display: block;
261
- }
262
- }
263
- }
264
-
265
- .colorPicker {
266
- width : 210px;
267
- border : 1px solid #D3D3D3;
268
- position: absolute;
269
-
270
- table {
271
- border-collapse: collapse;
272
- }
273
-
274
- .colorhead {
275
- height : 23px;
276
- line-height: 23px;
277
- font-weight: bold;
278
- width : 100%;
279
- }
280
-
281
- .colortitle {
282
- margin-left: 6px;
283
- font-size : 12px;
284
- }
285
-
286
- .colorpanel td {
287
- border : 1px solid #000;
288
- height : 10px;
289
- width : 10px;
290
- overflow : hidden;
291
- font-size: 1px;
292
- cursor : pointer;
293
- }
294
- }
295
-
296
- // 字体演示
297
- .fontfamilyChoser,
298
- .fontsizeChoser {
299
- a {
300
- padding-right : 2px;
301
- display : block;
302
- padding-left : 2px;
303
- padding-bottom : 2px;
304
- color : #000;
305
- line-height : 120%;
306
- padding-top : 2px;
307
- text-decoration: none;
308
-
309
- &:hover {
310
- background: #e5e5e5
311
- }
312
- }
313
- }
314
-
315
- // 登录面板 和忘记密码
316
- .dorpdown {
317
- position: relative;
318
-
319
- &:hover .fontfamilyChoser,
320
- .fontfamilyChoser:hover,
321
- &:hover .fontsizeChoser,
322
- .fontsizeChoser:hover,
323
- &:hover .colorPicker,
324
- .colorPicker:hover {
325
- display: block;
326
- }
327
-
328
- &>div {
329
- display : none;
330
- position : absolute;
331
- top : 22px;
332
- left : 0;
333
- background-color: #f5f5f5;
334
- border : 1px solid lightgray;
335
- border-top : 0;
336
- padding : 5px;
337
- width : 230px;
338
- }
339
-
340
- .fontsizeChoser {
341
- top : inherit;
342
- right: 0;
343
- }
344
- }
345
- }