@ajaxjs/util 1.0.9 → 1.1.0

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 (83) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +11 -20
  3. package/dist/index.d.ts +34 -6
  4. package/dist/index.js +45 -8
  5. package/dist/index.js.map +1 -1
  6. package/dist/main.d.ts +1 -0
  7. package/dist/main.js +16 -0
  8. package/dist/main.js.map +1 -0
  9. package/dist/router/index.d.ts +3 -0
  10. package/dist/router/index.js +44 -0
  11. package/dist/router/index.js.map +1 -0
  12. package/dist/shims-vue.d.ts +4 -0
  13. package/dist/util/cookies.d.ts +18 -0
  14. package/dist/util/cookies.js +46 -0
  15. package/dist/util/cookies.js.map +1 -0
  16. package/dist/util/dom.d.ts +17 -0
  17. package/dist/util/dom.js +44 -0
  18. package/dist/util/dom.js.map +1 -0
  19. package/dist/util/utils.d.ts +51 -0
  20. package/dist/util/utils.js +174 -0
  21. package/dist/util/utils.js.map +1 -0
  22. package/dist/{xhr-config.js.map → util/xhr-config.js.map} +1 -1
  23. package/dist/{xhr.d.ts → util/xhr.d.ts} +16 -1
  24. package/dist/{xhr.js → util/xhr.js} +84 -36
  25. package/dist/util/xhr.js.map +1 -0
  26. package/dist/widget/AccordionMenu.vue +140 -0
  27. package/dist/widget/AdjustFontSize.vue +65 -0
  28. package/dist/widget/Article.vue +59 -0
  29. package/dist/widget/EmptyContent.d.ts +5 -0
  30. package/dist/widget/EmptyContent.js +7 -0
  31. package/dist/widget/EmptyContent.js.map +1 -0
  32. package/dist/widget/Expander.vue +65 -0
  33. package/dist/widget/FileUploader/FileUploader.d.ts +70 -0
  34. package/dist/widget/FileUploader/FileUploader.js +139 -0
  35. package/dist/widget/FileUploader/FileUploader.js.map +1 -0
  36. package/dist/widget/FileUploader/FileUploader.less +68 -0
  37. package/dist/widget/FileUploader/FileUploader.ts +156 -0
  38. package/dist/widget/FileUploader/FileUploader.vue +43 -0
  39. package/dist/widget/HtmlEditor/HtmlEditor.d.ts +70 -0
  40. package/dist/widget/HtmlEditor/HtmlEditor.js +287 -0
  41. package/dist/widget/HtmlEditor/HtmlEditor.js.map +1 -0
  42. package/dist/widget/HtmlEditor/HtmlEditor.less +345 -0
  43. package/dist/widget/HtmlEditor/HtmlEditor.ts +339 -0
  44. package/dist/widget/HtmlEditor/HtmlEditor.vue +70 -0
  45. package/dist/widget/HtmlEditor/html-editor-HtmlSanitizer.js +103 -0
  46. package/dist/widget/ImageEnlarger.vue +105 -0
  47. package/dist/widget/OpacityBanner.vue +125 -0
  48. package/dist/widget/ProcessLine.vue +133 -0
  49. package/dist/widget/Resize.d.ts +51 -0
  50. package/dist/widget/Resize.js +133 -0
  51. package/dist/widget/Resize.js.map +1 -0
  52. package/dist/widget/Resize.ts +152 -0
  53. package/dist/widget/Resize.vue +104 -0
  54. package/dist/widget/TreeSelector.vue +4 -0
  55. package/dist/widget/calendar/BetweenDate.vue +63 -0
  56. package/dist/widget/calendar/Calendar.d.ts +55 -0
  57. package/dist/widget/calendar/Calendar.js +145 -0
  58. package/dist/widget/calendar/Calendar.js.map +1 -0
  59. package/dist/widget/calendar/Calendar.less +210 -0
  60. package/dist/widget/calendar/Calendar.ts +167 -0
  61. package/dist/widget/calendar/Calendar.vue +52 -0
  62. package/dist/widget/calendar/CalendarInput.vue +71 -0
  63. package/dist/widget/form/validator.d.ts +70 -0
  64. package/dist/widget/form/validator.js +220 -0
  65. package/dist/widget/form/validator.js.map +1 -0
  66. package/dist/widget/form/validator.ts +289 -0
  67. package/dist/widget/play-ground/sku.vue +93 -0
  68. package/package.json +31 -15
  69. package/dist/base.d.ts +0 -42
  70. package/dist/base.js +0 -133
  71. package/dist/base.js.map +0 -1
  72. package/dist/entity.d.ts +0 -26
  73. package/dist/entity.js +0 -2
  74. package/dist/entity.js.map +0 -1
  75. package/dist/xhr.js.map +0 -1
  76. package/src/base.ts +0 -145
  77. package/src/entity.ts +0 -31
  78. package/src/index.ts +0 -13
  79. package/src/xhr-config.ts +0 -25
  80. package/src/xhr.ts +0 -233
  81. package/tsconfig.json +0 -73
  82. /package/dist/{xhr-config.d.ts → util/xhr-config.d.ts} +0 -0
  83. /package/dist/{xhr-config.js → util/xhr-config.js} +0 -0
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ data() {
5
+ return {
6
+ styleWidth: 0,
7
+ styleHeight: 0,
8
+ styleLeft: 0,
9
+ styleTop: 0,
10
+ sideLeft: 0,
11
+ sideRight: 0,
12
+ sideUp: 0,
13
+ sideDown: 0,
14
+ fixLeft: 0,
15
+ fixTop: 0,
16
+ fn: null,
17
+ LockX: false,
18
+ LockY: false,
19
+ Lock: false,
20
+ scale: {
21
+ enable: true,
22
+ ratio: 0,
23
+ left: 0,
24
+ top: 0,
25
+ },
26
+ min: {
27
+ enable: false,
28
+ height: 100,
29
+ width: 200,
30
+ },
31
+ max: {
32
+ enable: false,
33
+ height: 300,
34
+ width: 500,
35
+ }
36
+ };
37
+ },
38
+ methods: {
39
+ /**
40
+ * 准备拖动
41
+ */
42
+ start(e, fn) {
43
+ this.styleWidth = this.$el.clientWidth;
44
+ this.styleHeight = this.$el.clientHeight;
45
+ this.styleLeft = this.$el.offsetLeft; // 记录鼠标相对拖放对象的位置
46
+ this.styleTop = this.$el.offsetTop;
47
+ this.sideLeft = e.clientX - this.styleWidth;
48
+ this.sideRight = e.clientX + this.styleWidth;
49
+ this.sideUp = e.clientY - this.styleHeight;
50
+ this.sideDown = e.clientY + this.styleHeight;
51
+ this.fixLeft = this.styleWidth + this.styleLeft;
52
+ this.fixTop = this.styleHeight + this.styleTop;
53
+ this.fn = fn;
54
+ if (this.scale.enable) {
55
+ this.scale.ratio = Math.max(this.scale.ratio, 0) || this.styleWidth / this.styleHeight; //设置比例
56
+ this.scale.left = this.styleLeft + this.styleWidth / 2; // left 和 top 的定位坐标
57
+ this.scale.top = this.styleTop + this.styleHeight / 2;
58
+ }
59
+ document.addEventListener("mousemove", this.resize); // mousemove 时移动 mouseup 时停止
60
+ document.addEventListener("mouseup", this.stop);
61
+ },
62
+ // 缩放
63
+ resize(e) {
64
+ window.getSelection().removeAllRanges(); // 清除选择
65
+ this.fn(e);
66
+ if (this.min.enable) {
67
+ if (this.styleHeight <= this.min.height)
68
+ return;
69
+ if (this.styleWidth <= this.min.width)
70
+ return;
71
+ }
72
+ if (this.max.enable) {
73
+ if (this.styleHeight >= this.max.height)
74
+ return;
75
+ if (this.styleWidth >= this.max.width)
76
+ return;
77
+ }
78
+ let s = this.$el.style;
79
+ s.width = this.styleWidth + "px";
80
+ s.height = this.styleHeight + "px";
81
+ s.top = this.styleTop + "px";
82
+ s.left = this.styleLeft + "px";
83
+ },
84
+ // 停止缩放
85
+ stop() {
86
+ document.removeEventListener("mousemove", this.resize);
87
+ document.removeEventListener("mouseup", this.stop);
88
+ },
89
+ //缩放程序
90
+ //上
91
+ up(e) {
92
+ this.styleHeight = Math.max(this.sideDown - e.clientY, 0);
93
+ this.styleTop = this.fixTop - this.styleHeight;
94
+ this.styleLeft = this.scale.left - this.styleWidth / 2;
95
+ console.log(this.styleLeft);
96
+ },
97
+ //下
98
+ down(e) {
99
+ this.styleHeight = Math.max(e.clientY - this.sideUp, 0);
100
+ this.styleLeft = this.scale.left - this.styleWidth / 2;
101
+ },
102
+ //右
103
+ right(e) {
104
+ this.styleWidth = Math.max(e.clientX - this.sideLeft, 0);
105
+ },
106
+ //左
107
+ left(e) {
108
+ this.styleWidth = Math.max(this.sideRight - e.clientX, 0);
109
+ this.styleLeft = this.fixLeft - this.styleWidth;
110
+ },
111
+ //右下
112
+ rightDown(e) {
113
+ this.right(e);
114
+ this.down(e);
115
+ },
116
+ //右上
117
+ rightUp(e) {
118
+ this.right(e);
119
+ this.up(e);
120
+ },
121
+ //左下
122
+ leftDown(e) {
123
+ this.left(e);
124
+ this.down(e);
125
+ },
126
+ //左上
127
+ leftUp(e) {
128
+ this.left(e);
129
+ this.up(e);
130
+ },
131
+ },
132
+ };
133
+ //# sourceMappingURL=Resize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Resize.js","sourceRoot":"","sources":["../../src/widget/Resize.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACX,IAAI;QACA,OAAO;YACH,UAAU,EAAE,CAAC;YACb,WAAW,EAAE,CAAC;YACd,SAAS,EAAE,CAAC;YACZ,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE,CAAC;YACX,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,CAAC;YACT,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,CAAC;YACV,MAAM,EAAE,CAAC;YACT,EAAE,EAAE,IAAI;YAER,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,KAAK;YAEX,KAAK,EAAE;gBACH,MAAM,EAAE,IAAI;gBACZ,KAAK,EAAE,CAAC;gBACR,IAAI,EAAE,CAAC;gBACP,GAAG,EAAE,CAAC;aACT;YAED,GAAG,EAAE;gBACD,MAAM,EAAE,KAAK;gBACb,MAAM,EAAE,GAAG;gBACX,KAAK,EAAE,GAAG;aACb;YACD,GAAG,EAAE;gBACD,MAAM,EAAE,KAAK;gBACb,MAAM,EAAE,GAAG;gBACX,KAAK,EAAE,GAAG;aACb;SAEJ,CAAC;IACN,CAAC;IACD,OAAO,EAAE;QACL;;WAEG;QACH,KAAK,CAAC,CAAa,EAAE,EAAY;YAC7B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC;YACvC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC;YACzC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAS,gBAAgB;YAC9D,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;YAEnC,IAAI,CAAC,QAAQ,GAAG,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b,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;QAED,IAAI;QACJ,MAAM,CAAC,CAAa;YAChB,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACb,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACf,CAAC;KACJ;CACJ,CAAC"}
@@ -0,0 +1,152 @@
1
+ export default {
2
+ data() {
3
+ return {
4
+ styleWidth: 0,// 样式参数值
5
+ styleHeight: 0,
6
+ styleLeft: 0,
7
+ styleTop: 0,
8
+ sideLeft: 0, // 四条边定位坐标
9
+ sideRight: 0,
10
+ sideUp: 0,
11
+ sideDown: 0,
12
+ fixLeft: 0, // top 和 left 定位参数
13
+ fixTop: 0,
14
+ fn: null,
15
+
16
+ LockX: false,// 是否锁定水平方向拖放
17
+ LockY: false,// 是否锁定垂直方向拖放
18
+ Lock: false,// 是否锁定
19
+
20
+ scale: { // 按比例缩放
21
+ enable: true, // 是否按比例缩放
22
+ ratio: 0, // 设置比例(宽/高)
23
+ left: 0,
24
+ top: 0,
25
+ },
26
+
27
+ min: { // 最小控制
28
+ enable: false,
29
+ height: 100,
30
+ width: 200,
31
+ },
32
+ max: { // 最大控制
33
+ enable: false,
34
+ height: 300,
35
+ width: 500,
36
+ }
37
+
38
+ };
39
+ },
40
+ methods: {
41
+ /**
42
+ * 准备拖动
43
+ */
44
+ start(e: MouseEvent, fn: Function): void {
45
+ this.styleWidth = this.$el.clientWidth;
46
+ this.styleHeight = this.$el.clientHeight;
47
+ this.styleLeft = this.$el.offsetLeft; // 记录鼠标相对拖放对象的位置
48
+ this.styleTop = this.$el.offsetTop;
49
+
50
+ this.sideLeft = e.clientX - this.styleWidth;
51
+ this.sideRight = e.clientX + this.styleWidth;
52
+ this.sideUp = e.clientY - this.styleHeight;
53
+ this.sideDown = e.clientY + this.styleHeight;
54
+
55
+ this.fixLeft = this.styleWidth + this.styleLeft;
56
+ this.fixTop = this.styleHeight + this.styleTop;
57
+ this.fn = fn;
58
+
59
+ if (this.scale.enable) {
60
+ this.scale.ratio = Math.max(this.scale.ratio, 0) || this.styleWidth / this.styleHeight; //设置比例
61
+ this.scale.left = this.styleLeft + this.styleWidth / 2;// left 和 top 的定位坐标
62
+ this.scale.top = this.styleTop + this.styleHeight / 2;
63
+ }
64
+
65
+ document.addEventListener("mousemove", this.resize);// mousemove 时移动 mouseup 时停止
66
+ document.addEventListener("mouseup", this.stop);
67
+ },
68
+
69
+ // 缩放
70
+ resize(e: MouseEvent): void {
71
+ window.getSelection().removeAllRanges(); // 清除选择
72
+ this.fn(e);
73
+
74
+ if (this.min.enable) {
75
+ if (this.styleHeight <= this.min.height)
76
+ return;
77
+ if (this.styleWidth <= this.min.width)
78
+ return;
79
+ }
80
+ if (this.max.enable) {
81
+ if (this.styleHeight >= this.max.height)
82
+ return;
83
+ if (this.styleWidth >= this.max.width)
84
+ return;
85
+ }
86
+
87
+ let s = this.$el.style;
88
+ s.width = this.styleWidth + "px";
89
+ s.height = this.styleHeight + "px";
90
+ s.top = this.styleTop + "px";
91
+ s.left = this.styleLeft + "px";
92
+ },
93
+
94
+ // 停止缩放
95
+ stop(): void {
96
+ document.removeEventListener("mousemove", this.resize);
97
+ document.removeEventListener("mouseup", this.stop);
98
+ },
99
+
100
+ //缩放程序
101
+
102
+ //上
103
+ up(e: MouseEvent): void {
104
+ this.styleHeight = Math.max(this.sideDown - e.clientY, 0);
105
+ this.styleTop = this.fixTop - this.styleHeight;
106
+ this.styleLeft = this.scale.left - this.styleWidth / 2;
107
+ console.log(this.styleLeft)
108
+ },
109
+
110
+ //下
111
+ down(e: MouseEvent): void {
112
+ this.styleHeight = Math.max(e.clientY - this.sideUp, 0);
113
+ this.styleLeft = this.scale.left - this.styleWidth / 2;
114
+
115
+ },
116
+
117
+ //右
118
+ right(e: MouseEvent): void {
119
+ this.styleWidth = Math.max(e.clientX - this.sideLeft, 0);
120
+ },
121
+
122
+ //左
123
+ left(e: MouseEvent): void {
124
+ this.styleWidth = Math.max(this.sideRight - e.clientX, 0);
125
+ this.styleLeft = this.fixLeft - this.styleWidth;
126
+ },
127
+
128
+ //右下
129
+ rightDown(e: MouseEvent): void {
130
+ this.right(e);
131
+ this.down(e);
132
+ },
133
+
134
+ //右上
135
+ rightUp(e: MouseEvent): void {
136
+ this.right(e);
137
+ this.up(e);
138
+ },
139
+
140
+ //左下
141
+ leftDown(e: MouseEvent): void {
142
+ this.left(e);
143
+ this.down(e);
144
+ },
145
+
146
+ //左上
147
+ leftUp(e: MouseEvent): void {
148
+ this.left(e);
149
+ this.up(e);
150
+ },
151
+ },
152
+ };
@@ -0,0 +1,104 @@
1
+ <template>
2
+ <!-- 拖拉缩放效果 -->
3
+ <div class="resize-box">
4
+ <div class="rRightDown" @mousedown="start($event, rightDown)"> </div>
5
+ <div class="rLeftDown" @mousedown="start($event, leftDown)"> </div>
6
+ <div class="rRightUp" @mousedown="start($event, rightUp)"> </div>
7
+ <div class="rLeftUp" @mousedown="start($event, leftUp)"> </div>
8
+ <div class="rRight" @mousedown="start($event, right)"> </div>
9
+ <div class="rLeft" @mousedown="start($event, left)"> </div>
10
+ <div class="rDown" @mousedown="start($event, down)"></div>
11
+ <div class="rUp" @mousedown="start($event, up)"> </div>
12
+ </div>
13
+ </template>
14
+
15
+ <script lang="ts" src="./Resize.ts"></script>
16
+
17
+ <style lang="less" scoped>
18
+ .rRightDown,
19
+ .rLeftDown,
20
+ .rLeftUp,
21
+ .rRightUp,
22
+ .rRight,
23
+ .rLeft,
24
+ .rUp,
25
+ .rDown {
26
+ position: absolute;
27
+ background: #c00;
28
+ width: 7px;
29
+ height: 7px;
30
+ z-index: 5;
31
+ font-size: 0;
32
+ }
33
+
34
+ .rLeftDown, .rRightUp {
35
+ cursor: ne-resize;
36
+ }
37
+
38
+ .rRightDown, .rLeftUp {
39
+ cursor: nw-resize;
40
+ }
41
+
42
+ .rRight, .rLeft {
43
+ cursor: e-resize;
44
+ }
45
+
46
+ .rUp, .rDown {
47
+ cursor: n-resize;
48
+ }
49
+
50
+ .rLeftDown {
51
+ left: -4px;
52
+ bottom: -4px;
53
+ }
54
+
55
+ .rRightUp {
56
+ right: -4px;
57
+ top: -4px;
58
+ }
59
+
60
+ .rRightDown {
61
+ right: -4px;
62
+ bottom: -4px;
63
+ background-color: 0f;
64
+ }
65
+
66
+ .rLeftUp {
67
+ left: -4px;
68
+ top: -4px;
69
+ }
70
+
71
+ .rRight {
72
+ right: -4px;
73
+ top: 50%;
74
+ margin-top: -4px;
75
+ }
76
+
77
+ .rLeft {
78
+ left: -4px;
79
+ top: 50%;
80
+ margin-top: -4px;
81
+ }
82
+
83
+ .rUp {
84
+ top: -4px;
85
+ left: 50%;
86
+ margin-left: -4px;
87
+ }
88
+
89
+ .rDown {
90
+ bottom: -4px;
91
+ left: 50%;
92
+ margin-left: -4px;
93
+ }
94
+
95
+ .resize-box {
96
+ border: 1px solid gray;
97
+ width: 100px;
98
+ height: 60px;
99
+ top: 150px;
100
+ left: 550px;
101
+ background: #fff;
102
+ position: absolute;
103
+ }
104
+ </style>
@@ -0,0 +1,4 @@
1
+ <!-- 下拉分类 -->
2
+ <template>
3
+
4
+ </template>
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <form action="." method="GET" class="dateRange" @submit="valid">
3
+ <aj-form-calendar-input
4
+ :date-only="true"
5
+ :position-fixed="true"
6
+ placeholder="起始时间"
7
+ field-name="startDate"
8
+ ></aj-form-calendar-input>
9
+ -
10
+ <aj-form-calendar-input
11
+ :date-only="true"
12
+ :position-fixed="true"
13
+ placeholder="截至时间"
14
+ field-name="endDate"
15
+ ></aj-form-calendar-input>
16
+ <button class="aj-btn">按时间筛选</button>
17
+ </form>
18
+ </template>
19
+
20
+ <script lang="ts">
21
+ /**
22
+ * 起始时间、截止时间的范围选择
23
+ */
24
+ export default {
25
+ props: {
26
+ isAjax: { type: Boolean, default: true }, // 是否 AJAX 模式
27
+ },
28
+ methods: {
29
+ valid(this: Vue, ev: Event): void {
30
+ let start = (<HTMLInputElement>(
31
+ this.$el.querySelector("input[name=startDate]")
32
+ )).value,
33
+ end = (<HTMLInputElement>this.$el.querySelector("input[name=endDate]"))
34
+ .value;
35
+
36
+ if (!start || !end) {
37
+ alert("输入数据不能为空");
38
+ ev.preventDefault();
39
+ return;
40
+ }
41
+
42
+ if (new Date(start) > new Date(end)) {
43
+ alert("起始日期不能晚于结束日期");
44
+ ev.preventDefault();
45
+ return;
46
+ }
47
+
48
+ //@ts-ignore
49
+ if (this.isAjax) {
50
+ ev.preventDefault();
51
+ let grid: any = this.$parent.$parent;
52
+
53
+ Object.assign(grid.$refs.pager.extraParam, {
54
+ startDate: start,
55
+ endDate: end,
56
+ });
57
+
58
+ grid.reload();
59
+ }
60
+ },
61
+ },
62
+ };
63
+ </script>
@@ -0,0 +1,55 @@
1
+ /**
2
+ * 日期选择器
3
+ */
4
+ declare const _default: {
5
+ props: {
6
+ showTime: BooleanConstructor;
7
+ };
8
+ data(): {
9
+ date: Date;
10
+ year: number;
11
+ month: number;
12
+ day: number;
13
+ };
14
+ mounted(): void;
15
+ watch: {
16
+ date(): void;
17
+ };
18
+ methods: {
19
+ /**
20
+ * 画日历
21
+ */
22
+ render(): void;
23
+ /**
24
+ * 获取指定的日期
25
+ *
26
+ * @param dateType
27
+ * @param month
28
+ */
29
+ getDate(dateType: 'preMonth' | 'nextMonth' | 'setMonth' | 'preYear' | 'nextYear', month: number): void;
30
+ /**
31
+ *
32
+ *
33
+ * @param querySelectoreven
34
+ */
35
+ setMonth(ev: Event): void;
36
+ /**
37
+ * 获取空白的非上月天数 + 当月天数
38
+ *
39
+ * @param this
40
+ */
41
+ getDateArr(): number[];
42
+ /**
43
+ * 获取日期
44
+ *
45
+ * @param event
46
+ */
47
+ pickDay(ev: Event): string;
48
+ /**
49
+ *
50
+ * @param event
51
+ */
52
+ pickupTime(event: Event): void;
53
+ };
54
+ };
55
+ export default _default;
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * 日期选择器
5
+ */
6
+ exports.default = {
7
+ props: {
8
+ showTime: Boolean // 是否显示时间,即“时分秒”
9
+ },
10
+ data() {
11
+ let date = new Date;
12
+ return {
13
+ date: date,
14
+ year: date.getFullYear(),
15
+ month: date.getMonth() + 1,
16
+ day: 1
17
+ };
18
+ },
19
+ mounted() {
20
+ this.$options.watch.date.call(this);
21
+ },
22
+ watch: {
23
+ date() {
24
+ this.year = this.date.getFullYear();
25
+ this.month = this.date.getMonth() + 1;
26
+ this.render();
27
+ }
28
+ },
29
+ methods: {
30
+ /**
31
+ * 画日历
32
+ */
33
+ render() {
34
+ let arr = this.getDateArr(), // 用来保存日期列表
35
+ frag = document.createDocumentFragment(); // 插入日期
36
+ while (arr.length) {
37
+ let row = document.createElement("tr"); // 每个星期插入一个 tr
38
+ for (let i = 1; i <= 7; i++) { // 每个星期有7天
39
+ let cell = document.createElement("td");
40
+ if (arr.length) {
41
+ let d = arr.shift();
42
+ if (d) {
43
+ let text = this.year + '-' + this.month + '-' + d;
44
+ cell.title = text; // 保存日期在 title 属性
45
+ cell.className = 'day day_' + text;
46
+ cell.innerHTML = d + "";
47
+ let on = new Date(this.year, this.month - 1, d);
48
+ // 判断是否今日
49
+ if (isSameDay(on, this.date)) {
50
+ cell.classList.add('onToday');
51
+ // this.onToday && this.onToday(cell);// 点击 今天 时候触发的事件
52
+ }
53
+ // 判断是否选择日期
54
+ // this.selectDay && this.onSelectDay && this.isSameDay(on, this.selectDay) && this.onSelectDay(cell);
55
+ }
56
+ }
57
+ row.appendChild(cell);
58
+ }
59
+ frag.appendChild(row);
60
+ }
61
+ // 先清空内容再插入
62
+ let tbody = this.$el.querySelector("table tbody");
63
+ tbody.innerHTML = '';
64
+ tbody.appendChild(frag);
65
+ },
66
+ /**
67
+ * 获取指定的日期
68
+ *
69
+ * @param dateType
70
+ * @param month
71
+ */
72
+ getDate(dateType, month) {
73
+ let nowYear = this.date.getFullYear(), nowMonth = this.date.getMonth() + 1; // 当前日期
74
+ switch (dateType) {
75
+ case 'preMonth': // 上一月
76
+ this.date = new Date(nowYear, nowMonth - 2, 1);
77
+ break;
78
+ case 'nextMonth': // 下一月
79
+ this.date = new Date(nowYear, nowMonth, 1);
80
+ break;
81
+ case 'setMonth': // 指定月份
82
+ this.date = new Date(nowYear, month - 1, 1);
83
+ break;
84
+ case 'preYear': // 上一年
85
+ this.date = new Date(nowYear - 1, nowMonth - 1, 1);
86
+ break;
87
+ case 'nextYear': // 下一年
88
+ this.date = new Date(nowYear + 1, nowMonth - 1, 1);
89
+ break;
90
+ }
91
+ },
92
+ /**
93
+ *
94
+ *
95
+ * @param querySelectoreven
96
+ */
97
+ setMonth(ev) {
98
+ let el = ev.target;
99
+ this.getDate('setMonth', Number(el.selectedOptions[0].value));
100
+ },
101
+ /**
102
+ * 获取空白的非上月天数 + 当月天数
103
+ *
104
+ * @param this
105
+ */
106
+ getDateArr() {
107
+ let arr = [];
108
+ // 算出这个月1号距离前面的星期天有多少天
109
+ for (let i = 1, firstDay = new Date(this.year, this.month - 1, 1).getDay(); i <= firstDay; i++)
110
+ arr.push(0);
111
+ // 这个月有多少天。用上个月然后设置日子参数为 0,就可以得到本月有多天
112
+ for (let i = 1, monthDay = new Date(this.year, this.month, 0).getDate(); i <= monthDay; i++)
113
+ arr.push(i);
114
+ return arr;
115
+ },
116
+ /**
117
+ * 获取日期
118
+ *
119
+ * @param event
120
+ */
121
+ pickDay(ev) {
122
+ let el = ev.target, date = el.title;
123
+ this.$emit('pickdate', date);
124
+ return date;
125
+ },
126
+ /**
127
+ *
128
+ * @param event
129
+ */
130
+ pickupTime(event) {
131
+ let hour = this.$el.querySelector('.hour'), minute = this.$el.querySelector('.minute'), time = hour.selectedOptions[0].value + ':' + minute.selectedOptions[0].value;
132
+ this.$emit('pick-time', time);
133
+ }
134
+ }
135
+ };
136
+ /**
137
+ * 判断两个日期是否同一日
138
+ *
139
+ * @param d1
140
+ * @param d2
141
+ */
142
+ function isSameDay(d1, d2) {
143
+ return (d1.getFullYear() == d2.getFullYear() && d1.getMonth() == d2.getMonth() && d1.getDate() == d2.getDate());
144
+ }
145
+ //# sourceMappingURL=Calendar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Calendar.js","sourceRoot":"","sources":["../../../src/widget/calendar/Calendar.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,kBAAe;IACX,KAAK,EAAE;QACH,QAAQ,EAAE,OAAO,CAAC,gBAAgB;KACrC;IACD,IAAI;QACA,IAAI,IAAI,GAAS,IAAI,IAAI,CAAC;QAC1B,OAAO;YACH,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE;YACxB,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;YAC1B,GAAG,EAAE,CAAC;SACT,CAAC;IACN,CAAC;IACD,OAAO;QACH,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IACD,KAAK,EAAE;QACH,IAAI;YACA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACpC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;YACtC,IAAI,CAAC,MAAM,EAAE,CAAC;QAClB,CAAC;KACJ;IACD,OAAO,EAAE;QACL;;WAEG;QACH,MAAM;YACF,IAAI,GAAG,GAAa,IAAI,CAAC,UAAU,EAAE,EAAC,WAAW;YAC7C,IAAI,GAAqB,QAAQ,CAAC,sBAAsB,EAAE,CAAC,CAAA,OAAO;YAEtE,OAAO,GAAG,CAAC,MAAM,EAAE;gBACf,IAAI,GAAG,GAAwB,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;gBAE3E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,C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