@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,210 +0,0 @@
1
- // 日历选择器
2
- .aj-form-calendar {
3
- font-family : Verdana;
4
- font-size : .8rem;
5
- background-color : white;
6
- border : 1px solid lightgray;
7
- border-radius : 5px;
8
- box-shadow : 0 5px 10px rgba(0, 0, 0, 0.2);
9
- text-align : center;
10
- width : 320px;
11
- -webkit-user-select: none;
12
- -moz-user-select : none;
13
- user-select : none;
14
- padding : 10px;
15
- line-height : 1.5em;
16
-
17
- a {
18
- color: #1e5494;
19
- text-decoration: none;
20
- }
21
-
22
- .selectYearMonth {
23
- float: right;
24
- width: 100px;
25
-
26
- div {
27
- display: inline-block;
28
- }
29
- }
30
-
31
- .showCurrentYearMonth {
32
- text-align: left;
33
- color : lightgray;
34
- font-size : 1.6rem;
35
- padding : 5% 0;
36
- }
37
-
38
- table {
39
- width : 100%;
40
- border : 0;
41
- border-spacing : 0;
42
- border-collapse: collapse;
43
-
44
- thead {
45
- tr {
46
- color : #acacac;
47
- border-bottom: 1px solid lightgray;
48
- margin-bottom: 15px;
49
- }
50
- }
51
-
52
- td {
53
- font-size : .8rem;
54
- padding : .4rem;
55
- letter-spacing : 1px;
56
- border : 0;
57
- background-color: white;
58
- text-align : center;
59
-
60
- &.day {
61
- cursor : pointer;
62
- transition: background-color 190ms ease-in-out;
63
- }
64
-
65
- &.onToday {
66
- font-weight: bold;
67
- color : #C60;
68
- }
69
-
70
- &.onSelect {
71
- font-weight: bold;
72
- }
73
-
74
- &.day:hover {
75
- color : darken(#e0ecf9, 50%);
76
- background-color: #e9e9e9;
77
- }
78
- }
79
- }
80
-
81
- .idCalendarPre,
82
- .idCalendarNext {
83
- cursor : pointer;
84
- font-size : 1.2rem;
85
- text-align : center;
86
- border-radius: 3px;
87
- padding : 2px 5px;
88
-
89
- &:hover {
90
- background-color: #e9e9e9;
91
- }
92
- }
93
-
94
- .idCalendarPre {
95
- float: left;
96
- }
97
-
98
- .idCalendarNext {
99
- float: right;
100
- }
101
-
102
- .btns {
103
- position: absolute;
104
- left : 15px;
105
- bottom : 5px;
106
-
107
- input[type=button] {
108
- font-size: .8rem;
109
- padding : 2px 4px;
110
- margin : 1px;
111
- }
112
- }
113
- .showTime{
114
- margin-top: 5%;
115
- select {
116
- min-width:50px;
117
- text-align: center;
118
- }
119
- }
120
- }
121
-
122
- // 日历 悬浮出现
123
- .aj-form-calendar-input {
124
- position: relative;
125
- width : 125px;
126
- line-height: 19px;
127
-
128
- &.show-time {
129
- width: 170px;
130
- }
131
-
132
- display: inline-block;
133
-
134
- input[type=text] {
135
- // .aj-input-base();
136
- max-width: 100% ! important;
137
- width : 100% ! important;
138
-
139
- }
140
-
141
- .icon {
142
- position : absolute;
143
- width : 17px;
144
- height : 16px;
145
- right : 5px;
146
- top : 6px;
147
- opacity : .6;
148
- cursor : pointer;
149
- // .menu {
150
- // color: #000;
151
- // position: absolute;
152
- // margin-left: 2px;
153
- // margin-top: 8px;
154
- // width: 17px;
155
- // height: 1px;
156
- // background-color: currentColor;
157
- // &:before {
158
- // content: '';
159
- // position: absolute;
160
- // top: -5px;
161
- // left: 0;
162
- // width: 17px;
163
- // height: 1px;
164
- // background-color: currentColor;
165
- // }
166
- //
167
- // &:after {
168
- // content: '';
169
- // position: absolute;
170
- // top: 5px;
171
- // left: 0;
172
- // width: 17px;
173
- // height: 1px;
174
- // background-color: currentColor;
175
- // }
176
- // }
177
- }
178
-
179
- .aj-form-calendar {
180
- z-index : 999999999;
181
- display : none;
182
- position: absolute;
183
-
184
- &.positionFixed {
185
- // 若父元素 overflow:hidden,则 position: absolute 不能完整显示,故 fixed
186
- position: fixed;
187
- }
188
-
189
- right: -3px;
190
- top : 25px;
191
- }
192
-
193
- &:hover .aj-form-calendar,
194
- .aj-form-calendar:hover {
195
- display: block;
196
-
197
- .icon {
198
- opacity: .5;
199
- }
200
- }
201
-
202
- &:hover .icon {
203
- opacity: 1;
204
- }
205
-
206
- .selectYearMonth select {
207
- min-width: 65px;
208
- outline: none;
209
- }
210
- }
@@ -1,167 +0,0 @@
1
- /**
2
- * 日期选择器
3
- */
4
- export default {
5
- props: {
6
- showTime: Boolean // 是否显示时间,即“时分秒”
7
- },
8
- data() {
9
- let date: Date = new Date;
10
- return {
11
- date: date,
12
- year: date.getFullYear(),
13
- month: date.getMonth() + 1,
14
- day: 1
15
- };
16
- },
17
- mounted(): void {
18
- this.$options.watch.date.call(this);
19
- },
20
- watch: {
21
- date(): void {
22
- this.year = this.date.getFullYear();
23
- this.month = this.date.getMonth() + 1;
24
- this.render();
25
- }
26
- },
27
- methods: {
28
- /**
29
- * 画日历
30
- */
31
- render(): void {
32
- let arr: number[] = this.getDateArr(),// 用来保存日期列表
33
- frag: DocumentFragment = document.createDocumentFragment();// 插入日期
34
-
35
- while (arr.length) {
36
- let row: HTMLTableRowElement = document.createElement("tr"); // 每个星期插入一个 tr
37
-
38
- for (let i = 1; i <= 7; i++) { // 每个星期有7天
39
- let cell: HTMLTableCellElement = document.createElement("td");
40
-
41
- if (arr.length) {
42
- let d: number = arr.shift();
43
-
44
- if (d) {
45
- let text: string = this.year + '-' + this.month + '-' + d;
46
- cell.title = text; // 保存日期在 title 属性
47
- cell.className = 'day day_' + text;
48
- cell.innerHTML = d + "";
49
-
50
- let on: Date = new Date(this.year, this.month - 1, d);
51
-
52
- // 判断是否今日
53
- if (isSameDay(on, this.date)) {
54
- cell.classList.add('onToday');
55
- // this.onToday && this.onToday(cell);// 点击 今天 时候触发的事件
56
- }
57
- // 判断是否选择日期
58
- // this.selectDay && this.onSelectDay && this.isSameDay(on, this.selectDay) && this.onSelectDay(cell);
59
- }
60
- }
61
-
62
- row.appendChild(cell);
63
- }
64
-
65
- frag.appendChild(row);
66
- }
67
-
68
- // 先清空内容再插入
69
- let tbody = <HTMLElement>this.$el.querySelector("table tbody");
70
- tbody.innerHTML = '';
71
- tbody.appendChild(frag);
72
- },
73
-
74
- /**
75
- * 获取指定的日期
76
- *
77
- * @param dateType
78
- * @param month
79
- */
80
- getDate(dateType: 'preMonth' | 'nextMonth' | 'setMonth' | 'preYear' | 'nextYear', month: number): void {
81
- let nowYear: number = this.date.getFullYear(),
82
- nowMonth: number = this.date.getMonth() + 1; // 当前日期
83
-
84
- switch (dateType) {
85
- case 'preMonth':// 上一月
86
- this.date = new Date(nowYear, nowMonth - 2, 1);
87
- break;
88
- case 'nextMonth':// 下一月
89
- this.date = new Date(nowYear, nowMonth, 1);
90
- break;
91
- case 'setMonth':// 指定月份
92
- this.date = new Date(nowYear, month - 1, 1);
93
- break;
94
- case 'preYear':// 上一年
95
- this.date = new Date(nowYear - 1, nowMonth - 1, 1);
96
- break;
97
- case 'nextYear':// 下一年
98
- this.date = new Date(nowYear + 1, nowMonth - 1, 1);
99
- break;
100
- }
101
- },
102
-
103
- /**
104
- *
105
- *
106
- * @param querySelectoreven
107
- */
108
- setMonth(ev: Event): void {
109
- let el: HTMLSelectElement = <HTMLSelectElement>ev.target;
110
- this.getDate('setMonth', Number(el.selectedOptions[0].value));
111
- },
112
-
113
- /**
114
- * 获取空白的非上月天数 + 当月天数
115
- *
116
- * @param this
117
- */
118
- getDateArr(): number[] {
119
- let arr: number[] = [];
120
-
121
- // 算出这个月1号距离前面的星期天有多少天
122
- for (let i = 1, firstDay: number = new Date(this.year, this.month - 1, 1).getDay(); i <= firstDay; i++)
123
- arr.push(0);
124
-
125
- // 这个月有多少天。用上个月然后设置日子参数为 0,就可以得到本月有多天
126
- for (let i = 1, monthDay: number = new Date(this.year, this.month, 0).getDate(); i <= monthDay; i++)
127
- arr.push(i);
128
-
129
- return arr;
130
- },
131
-
132
- /**
133
- * 获取日期
134
- *
135
- * @param event
136
- */
137
- pickDay(ev: Event): string {
138
- let el: HTMLElement = <HTMLElement>ev.target,
139
- date: string = el.title;
140
- this.$emit('pickdate', date);
141
-
142
- return date;
143
- },
144
-
145
- /**
146
- *
147
- * @param event
148
- */
149
- pickupTime(event: Event): void {
150
- let hour: HTMLSelectElement = <HTMLSelectElement>this.$el.querySelector('.hour'),
151
- minute: HTMLSelectElement = <HTMLSelectElement>this.$el.querySelector('.minute'),
152
- time = hour.selectedOptions[0].value + ':' + minute.selectedOptions[0].value;
153
-
154
- this.$emit('pick-time', time);
155
- }
156
- }
157
- };
158
-
159
- /**
160
- * 判断两个日期是否同一日
161
- *
162
- * @param d1
163
- * @param d2
164
- */
165
- function isSameDay(d1: Date, d2: Date): boolean {
166
- return (d1.getFullYear() == d2.getFullYear() && d1.getMonth() == d2.getMonth() && d1.getDate() == d2.getDate());
167
- }
@@ -1,52 +0,0 @@
1
- <template>
2
- <div class="aj-form-calendar">
3
- <div class="selectYearMonth">
4
- <a href="###" @click="getDate('preYear')" class="preYear" title="上一年"> &#171; <!-- &lt; --></a>
5
- <select @change="setMonth" v-model="month">
6
- <option value="1">一月</option>
7
- <option value="2">二月</option>
8
- <option value="3">三月</option>
9
- <option value="4">四月</option>
10
- <option value="5">五月</option>
11
- <option value="6">六月</option>
12
- <option value="7">七月</option>
13
- <option value="8">八月</option>
14
- <option value="9">九月</option>
15
- <option value="10">十月</option>
16
- <option value="11">十一月</option>
17
- <option value="12">十二月</option>
18
- </select>
19
- <a href="###" @click="getDate('nextYear')" class="nextYear" title="下一年"> &#187;<!-- &gt; --> </a>
20
- </div>
21
- <div class="showCurrentYearMonth">
22
- <span class="showYear">{{year}}</span>/<span class="showMonth">{{month}}</span>
23
- </div>
24
- <table>
25
- <thead>
26
- <tr>
27
- <td>日</td>
28
- <td>一</td>
29
- <td>二</td>
30
- <td>三</td>
31
- <td>四</td>
32
- <td>五</td>
33
- <td>六</td>
34
- </tr>
35
- </thead>
36
- <tbody @click="pickDay"></tbody>
37
- </table>
38
- <div v-if="showTime" class="showTime">
39
- 时 <select class="hour aj-select">
40
- <option v-for="n in 24" :key="n">{{n}}</option>
41
- </select>
42
- 分 <select class="minute aj-select">
43
- <option v-for="n in 61" :key="n">{{n - 1}}</option>
44
- </select>
45
- <a href="#" @click="pickupTime">选择时间</a>
46
- </div>
47
- </div>
48
- </template>
49
-
50
- <script lang="ts" src="./Calendar.ts"></script>
51
-
52
- <style lang="less" scoped src="./Calendar.less"></style>
@@ -1,71 +0,0 @@
1
- <template>
2
- <div class="aj-form-calendar-input" :class="{'show-time': showTime}" @mouseover="onMouseOver">
3
- <div class="icon fa fa-calendar"></div>
4
- <input :placeholder="placeholder" size="12" :name="fieldName" :value="date + (dateOnly ? '' : ' ' + time)" type="text" autocomplete="off" />
5
- <aj-form-calendar ref="calendar" :show-time="showTime" @pick-date="recEvent" @pick-time="recTimeEvent">
6
- </aj-form-calendar>
7
- </div>
8
- </template>
9
-
10
- <script lang="ts">
11
- /**
12
- * 帶有 input 輸入框的
13
- */
14
- export default {
15
- data() {
16
- return {
17
- date: this.fieldValue,
18
- time: "",
19
- };
20
- },
21
- props: {
22
- fieldName: { type: String, required: true }, // 表单 name,字段名
23
- fieldValue: { type: String, required: false, default: "" },
24
- dateOnly: { type: Boolean, required: false, default: true }, // 是否只处理日期,不考虑时间
25
- showTime: { type: Boolean, required: false, default: false },
26
- positionFixed: Boolean, // 是否采用固定定位
27
- placeholder: { type: String, default: "请输入日期" }, // 提示文字
28
- },
29
- watch: {
30
- fieldValue( n: string): void {
31
- this.date = n;
32
- },
33
- },
34
- mounted(): void {
35
- if (this.positionFixed) {
36
- let el: HTMLElement = <HTMLElement>this.$el.$(".aj-form-calendar");
37
- el.classList.add("positionFixed");
38
- }
39
-
40
- // 2012-07-08
41
- // firefox中解析 new Date('2012/12-23') 不兼容,提示invalid date 无效的日期
42
- // Chrome下可以直接将其格式化成日期格式,且时分秒默认为零
43
- // var arr = date.split('-'), now = new Date(arr[0], arr[1] - 1, arr[2],
44
- // " ", "", " ");
45
- if (this.fieldValue) {
46
- let arr: string = this.fieldValue.split(" ")[0],
47
- _arr = arr.split("-");
48
- // @ts-ignore
49
- this.$refs.calendar.date = new Date(arr[0],arr[1] - 1, arr[2]," ", "", " ");
50
- }
51
- },
52
- methods: {
53
- recTimeEvent(time: string): void {
54
- this.time = time;
55
- },
56
- recEvent(date: string): void {
57
- this.date = date.trim();
58
- },
59
- onMouseOver(ev: Event): void {
60
- if (this.positionFixed) {
61
- let el: HTMLElement = <HTMLElement>ev.currentTarget,
62
- b: DOMRect = el.getBoundingClientRect(),
63
- c: HTMLElement = <HTMLElement>this.$el.$(".aj-form-calendar");
64
-
65
- c.style.top = b.top + el.clientHeight - 0 + "px";
66
- c.style.left = b.left - 0 + 0 + "px";
67
- }
68
- },
69
- },
70
- };
71
- </script>