@neatui/nuxt 0.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.
- package/README.md +3 -0
- package/package.json +43 -0
- package/rollup.config.js +35 -0
- package/src/components/basic/IDraggable.vue +84 -0
- package/src/components/basic/IDraggable@b.vue +80 -0
- package/src/components/basic/IFollowView.vue +211 -0
- package/src/components/basic/IPickerView.vue +351 -0
- package/src/components/basic/IRouterView.vue +360 -0
- package/src/components/basic/IScrollView.vue +127 -0
- package/src/components/basic/Icon.vue +54 -0
- package/src/components/basic/LayerView/Layer.vue +339 -0
- package/src/components/basic/LayerView/index.ts +5 -0
- package/src/components/basic/index.ts +7 -0
- package/src/components/display/Avatar.vue +1 -0
- package/src/components/display/Badge.vue +1 -0
- package/src/components/display/Calendar.vue +245 -0
- package/src/components/display/CalendarReg.vue +245 -0
- package/src/components/display/Card.vue +1 -0
- package/src/components/display/Carousel.vue +1 -0
- package/src/components/display/ChartView.vue +123 -0
- package/src/components/display/Collapse.vue +1 -0
- package/src/components/display/Desriptions.vue +1 -0
- package/src/components/display/Empty.vue +1 -0
- package/src/components/display/Image.vue +112 -0
- package/src/components/display/List.vue +1 -0
- package/src/components/display/PhotoEditor.vue +181 -0
- package/src/components/display/PhotoViewer.vue +50 -0
- package/src/components/display/Popover.vue +1 -0
- package/src/components/display/QRCode.vue +1 -0
- package/src/components/display/Segmented.vue +1 -0
- package/src/components/display/Statistic.vue +1 -0
- package/src/components/display/Table.vue +1 -0
- package/src/components/display/Tabs.vue +1 -0
- package/src/components/display/Tag.vue +1 -0
- package/src/components/display/Timeline.vue +1 -0
- package/src/components/display/Tooltip.vue +1 -0
- package/src/components/display/Tour.vue +1 -0
- package/src/components/display/Tree.vue +431 -0
- package/src/components/display/TreeView.vue +225 -0
- package/src/components/display/index.ts +8 -0
- package/src/components/form/Cascader.vue +435 -0
- package/src/components/form/DatePicker.vue +124 -0
- package/src/components/form/DateRangePicker@v2.vue.backup +224 -0
- package/src/components/form/DateRangePicker@v3.vue +116 -0
- package/src/components/form/DateRangeView@v3.vue +386 -0
- package/src/components/form/DateView.vue +229 -0
- package/src/components/form/DateView@v2.vue +386 -0
- package/src/components/form/DateView@v3.vue +471 -0
- package/src/components/form/EditUpload.vue +4 -0
- package/src/components/form/ImgUpload.vue +174 -0
- package/src/components/form/Input.vue.backup +230 -0
- package/src/components/form/Input@v3.vue +267 -0
- package/src/components/form/InputNumber.vue +200 -0
- package/src/components/form/InputRange.vue +235 -0
- package/src/components/form/MoreSelect.vue.backup +144 -0
- package/src/components/form/MoreSelect@v3.vue +195 -0
- package/src/components/form/MoreSelectList.vue +125 -0
- package/src/components/form/MoreSelectPanel@v3.vue +190 -0
- package/src/components/form/MoreSelectPicker.vue +124 -0
- package/src/components/form/MoreSelectTags.vue +124 -0
- package/src/components/form/PageMoreSelect.vue +187 -0
- package/src/components/form/PageSelect.vue +189 -0
- package/src/components/form/SearchMoreSelect.vue +173 -0
- package/src/components/form/SearchSelect.vue.backup +194 -0
- package/src/components/form/SearchSelect@v3.vue +202 -0
- package/src/components/form/Select@v3.vue +201 -0
- package/src/components/form/SelectList.vue +58 -0
- package/src/components/form/SelectPicker.vue +97 -0
- package/src/components/form/SelectTags.vue +52 -0
- package/src/components/form/SelectTree/SelectTree@v1.vue +227 -0
- package/src/components/form/Switch.vue +135 -0
- package/src/components/form/TextArea.vue +193 -0
- package/src/components/form/TimePicker.vue +11 -0
- package/src/components/form/TimeView.vue +244 -0
- package/src/components/form/Upload.vue +346 -0
- package/src/components/form/index.ts +82 -0
- package/src/components/loader/FormLoader/FormLoader@v2.vue +422 -0
- package/src/components/loader/FormLoader/FormLoader@v3.vue.backup +318 -0
- package/src/components/loader/FormLoader/index.ts +2 -0
- package/src/components/loader/FormLoader@v1/FormLoader.vue +506 -0
- package/src/components/loader/FormLoader@v1/FormRender.vue +277 -0
- package/src/components/loader/LimitLoader/LimitLoader.vue.backup +131 -0
- package/src/components/loader/LimitLoader/LimitLoader@v2.vue.backup +174 -0
- package/src/components/loader/LimitLoader/LimitLoader@v3.vue +183 -0
- package/src/components/loader/LimitLoader/index.ts +2 -0
- package/src/components/loader/TableLoader/TableColView.vue +115 -0
- package/src/components/loader/TableLoader/TableLoader.vue +360 -0
- package/src/components/loader/TableLoader/index.ts +2 -0
- package/src/components/loader/ViewLoader/ViewLoader@v1.vue +256 -0
- package/src/components/loader/ViewLoader/index.ts +2 -0
- package/src/components/loader/index.ts +5 -0
- package/src/components/tools/FormDraftsView.vue +330 -0
- package/src/components/tools/FormVerifyView.vue +206 -0
- package/src/components/tools/MoreTools.vue +74 -0
- package/src/components/tools/MoreTools@v2.vue +74 -0
- package/src/components/tools/Pagination@a.vue +222 -0
- package/src/components/tools/Pagination@b.vue +221 -0
- package/src/components/tools/index.ts +5 -0
- package/src/index.ts +9 -0
- package/src/shims-vue.d.ts +5 -0
- package/src/store/myui.ts +50 -0
- package/tsconfig.json +24 -0
@@ -0,0 +1,245 @@
|
|
1
|
+
<template>
|
2
|
+
<div :class="`${frame ? 'b-solid bk-line b-xs r-sm' : ''}`" ui-flex="col xy">
|
3
|
+
<div ui-calendar-head="" class="nx-sl ny-sm b-solid bk-line bb-xs">
|
4
|
+
<div ui-flex="row lm"></div>
|
5
|
+
<div ui-flex="row cm" class="nx-ss-sub">
|
6
|
+
<p class="mx-ss-sub">
|
7
|
+
<b>{{ curr.y }}年</b>
|
8
|
+
<b>{{ curr.m }}月</b>
|
9
|
+
<b>{{ curr.d }}日</b>
|
10
|
+
</p>
|
11
|
+
</div>
|
12
|
+
<div ui-flex="row rm"></div>
|
13
|
+
</div>
|
14
|
+
<div ui-flex="row am" class="fs-xs bold nx-sl nt-sm"><span>日</span><span>一</span><span>二</span><span>三</span><span>四</span><span>五</span><span>六</span></div>
|
15
|
+
<div>
|
16
|
+
<ul ui-calendar-days="" ui-flex="row lm" class="flex-wrap nx-sm">
|
17
|
+
<li class="ew7 n-sm ux-none" v-for="(item, idx) in curr.days" :key="idx">
|
18
|
+
<div v-if="item.day" @click="change(item)" ui-cover="-xs">
|
19
|
+
<div
|
20
|
+
ui-flex="col cm"
|
21
|
+
class="r-ss b-solid bk-none b-xs"
|
22
|
+
:class="`${item.isToday ? 'bk-main-ls' : item.isLastMonth || item.isNextMonth ? 'co-note' : item.isHoliday ? 'co-risk' : ''} ${
|
23
|
+
state.selected && state.selected === item.date ? 'active bg-main-ls co-fore' : 'hover-bg-weak'
|
24
|
+
}`"
|
25
|
+
>
|
26
|
+
<span>{{ item.day }}</span>
|
27
|
+
<sup style="font-size: 0.6em; margin-top: -0.3em; position: absolute; left: 100%; top: 0" v-if="item.holiday" class="lh-ss">休</sup>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
</li>
|
31
|
+
</ul>
|
32
|
+
</div>
|
33
|
+
<div ui-calendar-foot="" ui-flex="row xm" class="nx-sl nb-sl">
|
34
|
+
<div ui-flex="row lm">
|
35
|
+
<div ui-btn="@a s none :square" @click="prev('y')">
|
36
|
+
<svg style="width: 1em; height: 1em" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
|
37
|
+
<path
|
38
|
+
d="M220.1 481.5L502 199.3c7.6-7.6 17.8-11.8 28.5-11.8s20.9 4.2 28.5 11.8c7.5 7.6 11.8 17.8 11.8 28.5s-4.2 20.9-11.8 28.5L305.5 510l253.4 253.7c7.3 7.6 11.4 17.8 11.3 28.4-0.1 10.6-4.3 20.7-11.8 28.2-7.5 7.5-17.6 11.7-28.1 11.8-10.6 0.1-20.7-4-28.3-11.3L220.1 538.5c-7.5-7.6-11.8-17.8-11.8-28.5s4.2-21 11.8-28.5z"
|
39
|
+
p-id="3429"
|
40
|
+
></path>
|
41
|
+
<path
|
42
|
+
d="M453.3 514.5c0-10.7 4.2-20.9 11.8-28.5L747 203.9c7.6-7.6 17.8-11.8 28.5-11.8s20.9 4.2 28.5 11.8c7.5 7.6 11.8 17.8 11.8 28.5s-4.2 20.9-11.8 28.5L550.5 514.5l253.4 253.7c7.3 7.6 11.4 17.8 11.3 28.4-0.1 10.6-4.3 20.7-11.8 28.2-7.5 7.5-17.6 11.7-28.1 11.8-10.6 0.1-20.7-4-28.3-11.3L465.1 543c-7.5-7.5-11.8-17.8-11.8-28.5z"
|
43
|
+
p-id="3430"
|
44
|
+
></path>
|
45
|
+
</svg>
|
46
|
+
</div>
|
47
|
+
<div ui-btn="@a s none :square" @click="prev('m')">
|
48
|
+
<svg style="width: 1em; height: 1em" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
|
49
|
+
<path
|
50
|
+
d="M684.2 827.6c-7.7 7.7-18.1 12-28.9 12-10.9 0-21.3-4.3-28.9-12L339.8 540.7c-7.7-7.7-12-18.1-12-29 0-10.9 4.3-21.3 12-29l286.6-286.9c7.7-7.5 18.1-11.6 28.8-11.5 10.7 0.1 21 4.4 28.6 12 7.6 7.6 11.9 17.9 12 28.6 0.1 10.7-4 21.1-11.5 28.8L426.6 511.8l257.6 257.9c7.7 7.7 12 18.1 12 29s-4.3 21.2-12 28.9z"
|
51
|
+
p-id="1281"
|
52
|
+
></path>
|
53
|
+
</svg>
|
54
|
+
</div>
|
55
|
+
</div>
|
56
|
+
<div ui-flex="row cm" class="nx-ss-sub">
|
57
|
+
<ul class="fs-xs n-sm-sub" ui-flex="row lm">
|
58
|
+
<li ui-btn="@a s none">年</li>
|
59
|
+
<li ui-btn="@a s none">月</li>
|
60
|
+
<li ui-btn="@a s none">日</li>
|
61
|
+
<!-- <li ui-btn="@a s none">时</li> -->
|
62
|
+
</ul>
|
63
|
+
</div>
|
64
|
+
<div ui-flex="row rm">
|
65
|
+
<div ui-btn="@a s none :square" @click="next('m')">
|
66
|
+
<svg style="width: 1em; height: 1em" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
|
67
|
+
<path
|
68
|
+
d="M339.8 827.6c-7.7-7.7-12-18.1-12-29s4.3-21.3 12-29l257.6-257.9-257.6-257.9c-7.5-7.7-11.6-18.1-11.5-28.8 0.1-10.7 4.4-21 12-28.6 7.6-7.6 17.9-11.9 28.6-12 10.7-0.1 21.1 4 28.8 11.5l286.6 286.9c7.7 7.7 12 18.1 12 29 0 10.9-4.3 21.3-12 29L397.7 827.6c-7.7 7.7-18.1 12-28.9 12-10.9 0-21.4-4.3-29-12z"
|
69
|
+
p-id="3084"
|
70
|
+
></path>
|
71
|
+
</svg>
|
72
|
+
</div>
|
73
|
+
<div ui-btn="@a s none :square" @click="next('y')">
|
74
|
+
<svg style="width: 1em; height: 1em" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
|
75
|
+
<path
|
76
|
+
d="M803.9 481.5L522.1 199.3a40.18 40.18 0 0 0-28.5-11.8c-10.7 0-20.9 4.2-28.5 11.8-7.5 7.6-11.8 17.8-11.8 28.5s4.2 20.9 11.8 28.5L718.5 510 465.1 763.6c-7.3 7.6-11.4 17.8-11.3 28.4 0.1 10.6 4.3 20.7 11.8 28.2 7.5 7.5 17.6 11.7 28.1 11.8 10.6 0.1 20.7-4 28.3-11.3l281.9-282.2c7.5-7.6 11.8-17.8 11.8-28.5s-4.2-21-11.8-28.5z"
|
77
|
+
p-id="3256"
|
78
|
+
></path>
|
79
|
+
<path
|
80
|
+
d="M570.7 514.5c0-10.7-4.2-20.9-11.8-28.5L277 203.9a40.18 40.18 0 0 0-28.5-11.8c-10.7 0-20.9 4.2-28.5 11.8-7.5 7.6-11.8 17.8-11.8 28.5s4.2 20.9 11.8 28.5l253.4 253.7-253.3 253.6c-7.3 7.6-11.4 17.8-11.3 28.4 0.1 10.6 4.3 20.7 11.8 28.2 7.5 7.5 17.6 11.7 28.1 11.8 10.6 0.1 20.7-4 28.3-11.3L558.9 543c7.5-7.5 11.8-17.8 11.8-28.5z"
|
81
|
+
p-id="3257"
|
82
|
+
></path>
|
83
|
+
</svg>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
</div>
|
87
|
+
</div>
|
88
|
+
</template>
|
89
|
+
<script setup lang="ts">
|
90
|
+
import { computed, reactive, toRefs } from 'vue';
|
91
|
+
import { idate } from '@fekit/utils';
|
92
|
+
// 创建日期
|
93
|
+
const cDate = (date: any = null) => {
|
94
|
+
const _date = new Date(date);
|
95
|
+
return date && _date instanceof Date && !isNaN(_date.getTime()) ? _date : new Date();
|
96
|
+
};
|
97
|
+
// 个位补零
|
98
|
+
const numfill = (num: string | number = '') => {
|
99
|
+
return Number(num) < 10 ? `0${num}` : num;
|
100
|
+
};
|
101
|
+
// 外部入参
|
102
|
+
const props = defineProps({
|
103
|
+
frame: { type: Boolean, default: false },
|
104
|
+
theme: { type: String, default: '@a' },
|
105
|
+
sz: { type: String, default: 'm' },
|
106
|
+
co: { type: String, default: '' },
|
107
|
+
block: { type: Boolean, default: true },
|
108
|
+
// 提示文案
|
109
|
+
tips: {
|
110
|
+
type: String,
|
111
|
+
default: ''
|
112
|
+
},
|
113
|
+
// 提示文案
|
114
|
+
placeholder: {
|
115
|
+
type: String,
|
116
|
+
default: ''
|
117
|
+
},
|
118
|
+
// 格式
|
119
|
+
format: {
|
120
|
+
type: String,
|
121
|
+
default: ''
|
122
|
+
},
|
123
|
+
// 值
|
124
|
+
value: {
|
125
|
+
type: [String, Number],
|
126
|
+
default: ''
|
127
|
+
},
|
128
|
+
// 值
|
129
|
+
modelValue: { type: [String, Number], default: '' },
|
130
|
+
// 节假日
|
131
|
+
holiday: {
|
132
|
+
type: Object,
|
133
|
+
default: () => ({})
|
134
|
+
},
|
135
|
+
// 校验规则
|
136
|
+
rules: {
|
137
|
+
type: Array,
|
138
|
+
default: () => []
|
139
|
+
},
|
140
|
+
// 是否是示校验图标
|
141
|
+
verify: {
|
142
|
+
type: Boolean,
|
143
|
+
default: false
|
144
|
+
}
|
145
|
+
});
|
146
|
+
|
147
|
+
// 内部数据
|
148
|
+
const state: any = reactive({
|
149
|
+
view: 1,
|
150
|
+
show: 0,
|
151
|
+
pos: 'bl',
|
152
|
+
selected: '',
|
153
|
+
date: props.value,
|
154
|
+
curr: computed(() => {
|
155
|
+
const date = cDate(state.date);
|
156
|
+
const calendar = [];
|
157
|
+
// 年
|
158
|
+
const y: any = date.getFullYear();
|
159
|
+
// 月
|
160
|
+
const m: any = date.getMonth() + 1;
|
161
|
+
// 日
|
162
|
+
const d: any = date.getDate();
|
163
|
+
// 本月第一天星期几
|
164
|
+
const w = new Date(`${y}-${m}-1`).getDay();
|
165
|
+
// 当前月份一共几天
|
166
|
+
const days = new Date(y, m, 0).getDate();
|
167
|
+
|
168
|
+
// 当前
|
169
|
+
const curr = new Date();
|
170
|
+
const curr_y = curr.getFullYear();
|
171
|
+
const curr_m = curr.getMonth() + 1;
|
172
|
+
const curr_d = curr.getDate();
|
173
|
+
|
174
|
+
// 上月
|
175
|
+
const last = new Date(y, m - 1, 0);
|
176
|
+
const last_y = last.getFullYear();
|
177
|
+
const last_m = last.getMonth() + 1;
|
178
|
+
|
179
|
+
// 下月
|
180
|
+
const next = new Date(y, m + 1, 0);
|
181
|
+
const next_y = next.getFullYear();
|
182
|
+
const next_m = next.getMonth() + 1;
|
183
|
+
let prevdays = last.getDate();
|
184
|
+
|
185
|
+
for (let i = 0; i < w; i++) {
|
186
|
+
calendar.unshift({
|
187
|
+
date: `${last_y}-${last_m}-${prevdays}`,
|
188
|
+
day: prevdays,
|
189
|
+
isLastMonth: 1
|
190
|
+
});
|
191
|
+
prevdays = prevdays - 1;
|
192
|
+
}
|
193
|
+
for (let i = 1; i <= days; i++) {
|
194
|
+
const _i = i;
|
195
|
+
calendar.push({
|
196
|
+
date: `${y}-${m}-${_i}`,
|
197
|
+
day: _i,
|
198
|
+
isToday: curr_y === y && curr_m === m && curr_d === i,
|
199
|
+
isHoliday: props.holiday[`${y}-${m}-${_i}`]?.name ? 1 : 0,
|
200
|
+
holiday: props.holiday[`${y}-${m}-${_i}`]?.name
|
201
|
+
});
|
202
|
+
}
|
203
|
+
for (let i = 1; calendar.length < 42; i++) {
|
204
|
+
const _i = i;
|
205
|
+
calendar.push({
|
206
|
+
date: `${next_y}-${next_m}-${_i}`,
|
207
|
+
day: _i,
|
208
|
+
isNextMonth: 1
|
209
|
+
});
|
210
|
+
}
|
211
|
+
return { days: calendar, y, m, d };
|
212
|
+
}),
|
213
|
+
value: computed(() => {
|
214
|
+
return props.format ? idate(state.selected || props.value).format(props.format) : state.selected || props.value;
|
215
|
+
})
|
216
|
+
});
|
217
|
+
const { curr = {} }: any = toRefs(state);
|
218
|
+
|
219
|
+
const upload = (a: any = 'm', b: any = 1) => {
|
220
|
+
const date = cDate(state.date);
|
221
|
+
if (a === 'm') {
|
222
|
+
date.setMonth(date.getMonth() + b);
|
223
|
+
} else {
|
224
|
+
date.setFullYear(date.getFullYear() + b);
|
225
|
+
}
|
226
|
+
return date.toISOString().substring(0, 10);
|
227
|
+
};
|
228
|
+
|
229
|
+
// 日期前翻
|
230
|
+
const prev = (type: any = 'm') => {
|
231
|
+
state.date = upload(type, -1);
|
232
|
+
};
|
233
|
+
// 日期后翻
|
234
|
+
const next = (type: any = 'm') => {
|
235
|
+
state.date = upload(type, 1);
|
236
|
+
};
|
237
|
+
|
238
|
+
// 向外通信
|
239
|
+
const emits = defineEmits(['change']);
|
240
|
+
const change = (item: any) => {
|
241
|
+
state.selected = item.date;
|
242
|
+
state.date = item.date;
|
243
|
+
emits('change', item.date);
|
244
|
+
};
|
245
|
+
</script>
|
@@ -0,0 +1,245 @@
|
|
1
|
+
<template>
|
2
|
+
<div :class="`${frame ? 'b-solid bk-line b-xs r-sm' : ''}`" ui-flex="col xy">
|
3
|
+
<div ui-calendar-head="" class="nx-sl ny-sm b-solid bk-line bb-xs">
|
4
|
+
<div ui-flex="row lm"></div>
|
5
|
+
<div ui-flex="row cm" class="nx-ss-sub">
|
6
|
+
<p class="mx-ss-sub">
|
7
|
+
<b>{{ curr.y }}年</b>
|
8
|
+
<b>{{ curr.m }}月</b>
|
9
|
+
<b>{{ curr.d }}日</b>
|
10
|
+
</p>
|
11
|
+
</div>
|
12
|
+
<div ui-flex="row rm"></div>
|
13
|
+
</div>
|
14
|
+
<div ui-flex="row am" class="fs-xs bold nx-sl nt-sm"><span>日</span><span>一</span><span>二</span><span>三</span><span>四</span><span>五</span><span>六</span></div>
|
15
|
+
<div>
|
16
|
+
<ul ui-calendar-days="" ui-flex="row lm" class="flex-wrap nx-sm">
|
17
|
+
<li class="ew7 n-sm ux-none" v-for="(item, idx) in curr.days" :key="idx">
|
18
|
+
<div v-if="item.day" @click="change(item)" ui-cover="-xs">
|
19
|
+
<div
|
20
|
+
ui-flex="col cm"
|
21
|
+
class="r-ss b-solid bk-none b-xs"
|
22
|
+
:class="`${item.isToday ? 'bk-main-ls' : item.isLastMonth || item.isNextMonth ? 'co-note' : item.isHoliday ? 'co-risk' : ''} ${
|
23
|
+
state.selected && state.selected === item.date ? 'active bg-main-ls co-fore' : 'hover-bg-weak'
|
24
|
+
}`"
|
25
|
+
>
|
26
|
+
<span>{{ item.day }}</span>
|
27
|
+
<sup style="font-size: 0.6em; margin-top: -0.3em; position: absolute; left: 100%; top: 0" v-if="item.holiday" class="lh-ss">休</sup>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
</li>
|
31
|
+
</ul>
|
32
|
+
</div>
|
33
|
+
<div ui-calendar-foot="" ui-flex="row xm" class="nx-sl nb-sl">
|
34
|
+
<div ui-flex="row lm">
|
35
|
+
<div ui-btn="@a s none :square" @click="prev('y')">
|
36
|
+
<svg style="width: 1em; height: 1em" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
|
37
|
+
<path
|
38
|
+
d="M220.1 481.5L502 199.3c7.6-7.6 17.8-11.8 28.5-11.8s20.9 4.2 28.5 11.8c7.5 7.6 11.8 17.8 11.8 28.5s-4.2 20.9-11.8 28.5L305.5 510l253.4 253.7c7.3 7.6 11.4 17.8 11.3 28.4-0.1 10.6-4.3 20.7-11.8 28.2-7.5 7.5-17.6 11.7-28.1 11.8-10.6 0.1-20.7-4-28.3-11.3L220.1 538.5c-7.5-7.6-11.8-17.8-11.8-28.5s4.2-21 11.8-28.5z"
|
39
|
+
p-id="3429"
|
40
|
+
></path>
|
41
|
+
<path
|
42
|
+
d="M453.3 514.5c0-10.7 4.2-20.9 11.8-28.5L747 203.9c7.6-7.6 17.8-11.8 28.5-11.8s20.9 4.2 28.5 11.8c7.5 7.6 11.8 17.8 11.8 28.5s-4.2 20.9-11.8 28.5L550.5 514.5l253.4 253.7c7.3 7.6 11.4 17.8 11.3 28.4-0.1 10.6-4.3 20.7-11.8 28.2-7.5 7.5-17.6 11.7-28.1 11.8-10.6 0.1-20.7-4-28.3-11.3L465.1 543c-7.5-7.5-11.8-17.8-11.8-28.5z"
|
43
|
+
p-id="3430"
|
44
|
+
></path>
|
45
|
+
</svg>
|
46
|
+
</div>
|
47
|
+
<div ui-btn="@a s none :square" @click="prev('m')">
|
48
|
+
<svg style="width: 1em; height: 1em" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
|
49
|
+
<path
|
50
|
+
d="M684.2 827.6c-7.7 7.7-18.1 12-28.9 12-10.9 0-21.3-4.3-28.9-12L339.8 540.7c-7.7-7.7-12-18.1-12-29 0-10.9 4.3-21.3 12-29l286.6-286.9c7.7-7.5 18.1-11.6 28.8-11.5 10.7 0.1 21 4.4 28.6 12 7.6 7.6 11.9 17.9 12 28.6 0.1 10.7-4 21.1-11.5 28.8L426.6 511.8l257.6 257.9c7.7 7.7 12 18.1 12 29s-4.3 21.2-12 28.9z"
|
51
|
+
p-id="1281"
|
52
|
+
></path>
|
53
|
+
</svg>
|
54
|
+
</div>
|
55
|
+
</div>
|
56
|
+
<div ui-flex="row cm" class="nx-ss-sub">
|
57
|
+
<ul class="fs-xs n-sm-sub" ui-flex="row lm">
|
58
|
+
<li ui-btn="@a s none">年</li>
|
59
|
+
<li ui-btn="@a s none">月</li>
|
60
|
+
<li ui-btn="@a s none">日</li>
|
61
|
+
<!-- <li ui-btn="@a s none">时</li> -->
|
62
|
+
</ul>
|
63
|
+
</div>
|
64
|
+
<div ui-flex="row rm">
|
65
|
+
<div ui-btn="@a s none :square" @click="next('m')">
|
66
|
+
<svg style="width: 1em; height: 1em" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
|
67
|
+
<path
|
68
|
+
d="M339.8 827.6c-7.7-7.7-12-18.1-12-29s4.3-21.3 12-29l257.6-257.9-257.6-257.9c-7.5-7.7-11.6-18.1-11.5-28.8 0.1-10.7 4.4-21 12-28.6 7.6-7.6 17.9-11.9 28.6-12 10.7-0.1 21.1 4 28.8 11.5l286.6 286.9c7.7 7.7 12 18.1 12 29 0 10.9-4.3 21.3-12 29L397.7 827.6c-7.7 7.7-18.1 12-28.9 12-10.9 0-21.4-4.3-29-12z"
|
69
|
+
p-id="3084"
|
70
|
+
></path>
|
71
|
+
</svg>
|
72
|
+
</div>
|
73
|
+
<div ui-btn="@a s none :square" @click="next('y')">
|
74
|
+
<svg style="width: 1em; height: 1em" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
|
75
|
+
<path
|
76
|
+
d="M803.9 481.5L522.1 199.3a40.18 40.18 0 0 0-28.5-11.8c-10.7 0-20.9 4.2-28.5 11.8-7.5 7.6-11.8 17.8-11.8 28.5s4.2 20.9 11.8 28.5L718.5 510 465.1 763.6c-7.3 7.6-11.4 17.8-11.3 28.4 0.1 10.6 4.3 20.7 11.8 28.2 7.5 7.5 17.6 11.7 28.1 11.8 10.6 0.1 20.7-4 28.3-11.3l281.9-282.2c7.5-7.6 11.8-17.8 11.8-28.5s-4.2-21-11.8-28.5z"
|
77
|
+
p-id="3256"
|
78
|
+
></path>
|
79
|
+
<path
|
80
|
+
d="M570.7 514.5c0-10.7-4.2-20.9-11.8-28.5L277 203.9a40.18 40.18 0 0 0-28.5-11.8c-10.7 0-20.9 4.2-28.5 11.8-7.5 7.6-11.8 17.8-11.8 28.5s4.2 20.9 11.8 28.5l253.4 253.7-253.3 253.6c-7.3 7.6-11.4 17.8-11.3 28.4 0.1 10.6 4.3 20.7 11.8 28.2 7.5 7.5 17.6 11.7 28.1 11.8 10.6 0.1 20.7-4 28.3-11.3L558.9 543c7.5-7.5 11.8-17.8 11.8-28.5z"
|
81
|
+
p-id="3257"
|
82
|
+
></path>
|
83
|
+
</svg>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
</div>
|
87
|
+
</div>
|
88
|
+
</template>
|
89
|
+
<script setup lang="ts">
|
90
|
+
import { computed, reactive, toRefs } from 'vue';
|
91
|
+
import { idate } from '@fekit/utils';
|
92
|
+
// 创建日期
|
93
|
+
const cDate = (date: any = null) => {
|
94
|
+
const _date = new Date(date);
|
95
|
+
return date && _date instanceof Date && !isNaN(_date.getTime()) ? _date : new Date();
|
96
|
+
};
|
97
|
+
// 个位补零
|
98
|
+
const numfill = (num: string | number = '') => {
|
99
|
+
return Number(num) < 10 ? `0${num}` : num;
|
100
|
+
};
|
101
|
+
// 外部入参
|
102
|
+
const props = defineProps({
|
103
|
+
frame: { type: Boolean, default: false },
|
104
|
+
theme: { type: String, default: '@a' },
|
105
|
+
sz: { type: String, default: 'm' },
|
106
|
+
co: { type: String, default: '' },
|
107
|
+
block: { type: Boolean, default: true },
|
108
|
+
// 提示文案
|
109
|
+
tips: {
|
110
|
+
type: String,
|
111
|
+
default: ''
|
112
|
+
},
|
113
|
+
// 提示文案
|
114
|
+
placeholder: {
|
115
|
+
type: String,
|
116
|
+
default: ''
|
117
|
+
},
|
118
|
+
// 格式
|
119
|
+
format: {
|
120
|
+
type: String,
|
121
|
+
default: ''
|
122
|
+
},
|
123
|
+
// 值
|
124
|
+
value: {
|
125
|
+
type: [String, Number],
|
126
|
+
default: ''
|
127
|
+
},
|
128
|
+
// 值
|
129
|
+
modelValue: { type: [String, Number], default: '' },
|
130
|
+
// 节假日
|
131
|
+
holiday: {
|
132
|
+
type: Object,
|
133
|
+
default: () => ({})
|
134
|
+
},
|
135
|
+
// 校验规则
|
136
|
+
rules: {
|
137
|
+
type: Array,
|
138
|
+
default: () => []
|
139
|
+
},
|
140
|
+
// 是否是示校验图标
|
141
|
+
verify: {
|
142
|
+
type: Boolean,
|
143
|
+
default: false
|
144
|
+
}
|
145
|
+
});
|
146
|
+
|
147
|
+
// 内部数据
|
148
|
+
const state: any = reactive({
|
149
|
+
view: 1,
|
150
|
+
show: 0,
|
151
|
+
pos: 'bl',
|
152
|
+
selected: '',
|
153
|
+
date: props.value,
|
154
|
+
curr: computed(() => {
|
155
|
+
const date = cDate(state.date);
|
156
|
+
const calendar = [];
|
157
|
+
// 年
|
158
|
+
const y: any = date.getFullYear();
|
159
|
+
// 月
|
160
|
+
const m: any = date.getMonth() + 1;
|
161
|
+
// 日
|
162
|
+
const d: any = date.getDate();
|
163
|
+
// 本月第一天星期几
|
164
|
+
const w = new Date(`${y}-${m}-1`).getDay();
|
165
|
+
// 当前月份一共几天
|
166
|
+
const days = new Date(y, m, 0).getDate();
|
167
|
+
|
168
|
+
// 当前
|
169
|
+
const curr = new Date();
|
170
|
+
const curr_y = curr.getFullYear();
|
171
|
+
const curr_m = curr.getMonth() + 1;
|
172
|
+
const curr_d = curr.getDate();
|
173
|
+
|
174
|
+
// 上月
|
175
|
+
const last = new Date(y, m - 1, 0);
|
176
|
+
const last_y = last.getFullYear();
|
177
|
+
const last_m = last.getMonth() + 1;
|
178
|
+
|
179
|
+
// 下月
|
180
|
+
const next = new Date(y, m + 1, 0);
|
181
|
+
const next_y = next.getFullYear();
|
182
|
+
const next_m = next.getMonth() + 1;
|
183
|
+
let prevdays = last.getDate();
|
184
|
+
|
185
|
+
for (let i = 0; i < w; i++) {
|
186
|
+
calendar.unshift({
|
187
|
+
date: `${last_y}-${last_m}-${prevdays}`,
|
188
|
+
day: prevdays,
|
189
|
+
isLastMonth: 1
|
190
|
+
});
|
191
|
+
prevdays = prevdays - 1;
|
192
|
+
}
|
193
|
+
for (let i = 1; i <= days; i++) {
|
194
|
+
const _i = i;
|
195
|
+
calendar.push({
|
196
|
+
date: `${y}-${m}-${_i}`,
|
197
|
+
day: _i,
|
198
|
+
isToday: curr_y === y && curr_m === m && curr_d === i,
|
199
|
+
isHoliday: props.holiday[`${y}-${m}-${_i}`]?.name ? 1 : 0,
|
200
|
+
holiday: props.holiday[`${y}-${m}-${_i}`]?.name
|
201
|
+
});
|
202
|
+
}
|
203
|
+
for (let i = 1; calendar.length < 42; i++) {
|
204
|
+
const _i = i;
|
205
|
+
calendar.push({
|
206
|
+
date: `${next_y}-${next_m}-${_i}`,
|
207
|
+
day: _i,
|
208
|
+
isNextMonth: 1
|
209
|
+
});
|
210
|
+
}
|
211
|
+
return { days: calendar, y, m, d };
|
212
|
+
}),
|
213
|
+
value: computed(() => {
|
214
|
+
return props.format ? idate(state.selected || props.value).format(props.format) : state.selected || props.value;
|
215
|
+
})
|
216
|
+
});
|
217
|
+
const { curr = {} }: any = toRefs(state);
|
218
|
+
|
219
|
+
const upload = (a: any = 'm', b: any = 1) => {
|
220
|
+
const date = cDate(state.date);
|
221
|
+
if (a === 'm') {
|
222
|
+
date.setMonth(date.getMonth() + b);
|
223
|
+
} else {
|
224
|
+
date.setFullYear(date.getFullYear() + b);
|
225
|
+
}
|
226
|
+
return date.toISOString().substring(0, 10);
|
227
|
+
};
|
228
|
+
|
229
|
+
// 日期前翻
|
230
|
+
const prev = (type: any = 'm') => {
|
231
|
+
state.date = upload(type, -1);
|
232
|
+
};
|
233
|
+
// 日期后翻
|
234
|
+
const next = (type: any = 'm') => {
|
235
|
+
state.date = upload(type, 1);
|
236
|
+
};
|
237
|
+
|
238
|
+
// 向外通信
|
239
|
+
const emits = defineEmits(['change']);
|
240
|
+
const change = (item: any) => {
|
241
|
+
state.selected = item.date;
|
242
|
+
state.date = item.date;
|
243
|
+
emits('change', item.date);
|
244
|
+
};
|
245
|
+
</script>
|
@@ -0,0 +1 @@
|
|
1
|
+
<template><div></div></template>
|
@@ -0,0 +1 @@
|
|
1
|
+
<template><div></div></template>
|
@@ -0,0 +1,123 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="neatui-charts-view">
|
3
|
+
<div :style="`padding-top: ${size * 100}%;`">
|
4
|
+
<div ref="dom"></div>
|
5
|
+
</div>
|
6
|
+
</div>
|
7
|
+
</template>
|
8
|
+
<script setup lang="ts">
|
9
|
+
import { ref, watch, reactive, onMounted, onBeforeUnmount } from 'vue';
|
10
|
+
import ResizeObserver from 'resize-observer-polyfill';
|
11
|
+
import * as echarts from 'echarts';
|
12
|
+
import { isArray, isObject, isString, deepcopy } from '@fekit/utils';
|
13
|
+
import { useMyuiStore } from '@neatui/vue';
|
14
|
+
|
15
|
+
// 框架数据
|
16
|
+
const myui: any = useMyuiStore();
|
17
|
+
|
18
|
+
// 类型
|
19
|
+
interface Props {
|
20
|
+
data?: object;
|
21
|
+
size?: number;
|
22
|
+
}
|
23
|
+
|
24
|
+
// 入参
|
25
|
+
const props: any = withDefaults(defineProps<Props>(), {
|
26
|
+
data: () => ({}),
|
27
|
+
size: 1
|
28
|
+
});
|
29
|
+
|
30
|
+
const dom: any = ref(null);
|
31
|
+
let obs: any = null;
|
32
|
+
let ex: any = null;
|
33
|
+
let timer: any = null;
|
34
|
+
|
35
|
+
const status: any = reactive({});
|
36
|
+
|
37
|
+
// 设置颜色
|
38
|
+
const color = (obj: any) => {
|
39
|
+
if (isArray(obj)) {
|
40
|
+
const _obj = obj.map((i: any) => {
|
41
|
+
return color(i);
|
42
|
+
});
|
43
|
+
return _obj;
|
44
|
+
} else if (isObject(obj)) {
|
45
|
+
const _obj: any = {};
|
46
|
+
for (const key in obj) {
|
47
|
+
_obj[key] = color(obj[key]);
|
48
|
+
}
|
49
|
+
return _obj;
|
50
|
+
} else {
|
51
|
+
if (isString(obj)) {
|
52
|
+
if (isArray(myui.themes)) {
|
53
|
+
const _theme: any = myui.themes[myui.theme] || myui.themes[Object.keys(myui.themes)[0]] || {};
|
54
|
+
if (_theme) {
|
55
|
+
obj = obj?.replace(/^co\((\w*)\)$/, (res: any, co: any) => {
|
56
|
+
return _theme[co] || '';
|
57
|
+
});
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
return obj;
|
62
|
+
}
|
63
|
+
};
|
64
|
+
|
65
|
+
// 重绘
|
66
|
+
const redraw = () => {
|
67
|
+
if (ex) {
|
68
|
+
clearTimeout(timer);
|
69
|
+
timer = setTimeout(() => {
|
70
|
+
ex?.resize();
|
71
|
+
}, 3);
|
72
|
+
}
|
73
|
+
};
|
74
|
+
|
75
|
+
// 设置
|
76
|
+
const config = () => {
|
77
|
+
if (ex) {
|
78
|
+
const data = color(deepcopy(props.data));
|
79
|
+
ex?.setOption(data);
|
80
|
+
}
|
81
|
+
};
|
82
|
+
|
83
|
+
watch(
|
84
|
+
[() => props.data, () => myui.theme],
|
85
|
+
() => {
|
86
|
+
config();
|
87
|
+
},
|
88
|
+
{ deep: true }
|
89
|
+
);
|
90
|
+
|
91
|
+
onMounted(() => {
|
92
|
+
if (dom.value) {
|
93
|
+
ex = echarts.init(dom.value);
|
94
|
+
config();
|
95
|
+
|
96
|
+
// 监听参考元素变化
|
97
|
+
obs = new ResizeObserver(redraw);
|
98
|
+
obs?.observe(dom.value);
|
99
|
+
}
|
100
|
+
});
|
101
|
+
|
102
|
+
onBeforeUnmount(() => {
|
103
|
+
// 清除监听参考元素变化;
|
104
|
+
obs?.disconnect();
|
105
|
+
});
|
106
|
+
</script>
|
107
|
+
<style lang="scss">
|
108
|
+
.neatui-charts-view {
|
109
|
+
position: relative;
|
110
|
+
& > * {
|
111
|
+
width: 100%;
|
112
|
+
box-sizing: content-box;
|
113
|
+
height: 0;
|
114
|
+
& > * {
|
115
|
+
position: absolute;
|
116
|
+
width: 100%;
|
117
|
+
height: 100%;
|
118
|
+
left: 0;
|
119
|
+
top: 0;
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
123
|
+
</style>
|
@@ -0,0 +1 @@
|
|
1
|
+
<template><div></div></template>
|
@@ -0,0 +1 @@
|
|
1
|
+
<template><div></div></template>
|
@@ -0,0 +1 @@
|
|
1
|
+
<template><div></div></template>
|