jianghu-ui 1.0.1
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 +376 -0
- package/dist/jianghu-ui.css +2318 -0
- package/dist/jianghu-ui.js +2 -0
- package/dist/jianghu-ui.js.LICENSE.txt +1 -0
- package/package.json +56 -0
- package/src/Design.stories.mdx +195 -0
- package/src/Introduction.stories.mdx +148 -0
- package/src/components/JhAddressSelect/JhAddressSelect.md +250 -0
- package/src/components/JhAddressSelect/JhAddressSelect.stories.js +282 -0
- package/src/components/JhAddressSelect/JhAddressSelect.vue +261 -0
- package/src/components/JhCard/JhCard.md +246 -0
- package/src/components/JhCard/JhCard.stories.js +688 -0
- package/src/components/JhCard/JhCard.vue +604 -0
- package/src/components/JhCheckCard/JhCheckCard.md +245 -0
- package/src/components/JhCheckCard/JhCheckCard.stories.js +750 -0
- package/src/components/JhCheckCard/JhCheckCard.vue +476 -0
- package/src/components/JhConfirmDialog/JhConfirmDialog.md +70 -0
- package/src/components/JhConfirmDialog/JhConfirmDialog.stories.js +550 -0
- package/src/components/JhConfirmDialog/JhConfirmDialog.vue +181 -0
- package/src/components/JhDateRangePicker/JhDateRangePicker.md +56 -0
- package/src/components/JhDateRangePicker/JhDateRangePicker.stories.js +320 -0
- package/src/components/JhDateRangePicker/JhDateRangePicker.vue +307 -0
- package/src/components/JhDescriptions/JhDescriptions.md +724 -0
- package/src/components/JhDescriptions/JhDescriptions.stories.js +858 -0
- package/src/components/JhDescriptions/JhDescriptions.vue +933 -0
- package/src/components/JhDraggable/JhDraggable.md +66 -0
- package/src/components/JhDraggable/JhDraggable.stories.js +161 -0
- package/src/components/JhDraggable/JhDraggable.vue +254 -0
- package/src/components/JhDrawer/JhDrawer.md +68 -0
- package/src/components/JhDrawer/JhDrawer.stories.js +478 -0
- package/src/components/JhDrawer/JhDrawer.vue +281 -0
- package/src/components/JhDrawerForm/JhDrawerForm.md +69 -0
- package/src/components/JhDrawerForm/JhDrawerForm.stories.js +492 -0
- package/src/components/JhDrawerForm/JhDrawerForm.vue +297 -0
- package/src/components/JhEditableTable/JhEditableTable.md +507 -0
- package/src/components/JhEditableTable/JhEditableTable.stories.js +615 -0
- package/src/components/JhEditableTable/JhEditableTable.vue +685 -0
- package/src/components/JhFileInput/JhFileInput.md +56 -0
- package/src/components/JhFileInput/JhFileInput.stories.js +103 -0
- package/src/components/JhFileInput/JhFileInput.vue +253 -0
- package/src/components/JhForm/JhForm.md +676 -0
- package/src/components/JhForm/JhForm.stories.js +1375 -0
- package/src/components/JhForm/JhForm.vue +657 -0
- package/src/components/JhFormField/JhFormField.stories.js +217 -0
- package/src/components/JhFormField/JhFormField.vue +439 -0
- package/src/components/JhFormFields/JhFormFields.md +647 -0
- package/src/components/JhFormFields/JhFormFields.stories.js +922 -0
- package/src/components/JhFormFields/JhFormFields.vue +998 -0
- package/src/components/JhFormList/JhFormList.md +303 -0
- package/src/components/JhFormList/JhFormList.stories.js +661 -0
- package/src/components/JhFormList/JhFormList.vue +1127 -0
- package/src/components/JhJsonEditor/JhJsonEditor.md +54 -0
- package/src/components/JhJsonEditor/JhJsonEditor.stories.js +157 -0
- package/src/components/JhJsonEditor/JhJsonEditor.vue +178 -0
- package/src/components/JhLayout/JhLayout.md +580 -0
- package/src/components/JhLayout/JhLayout.stories.js +414 -0
- package/src/components/JhLayout/JhLayout.vue +387 -0
- package/src/components/JhList/JhList.md +441 -0
- package/src/components/JhList/JhList.stories.js +524 -0
- package/src/components/JhList/JhList.vue +571 -0
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.md +56 -0
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.stories.js +191 -0
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.vue +188 -0
- package/src/components/JhMask/JhMask.md +62 -0
- package/src/components/JhMask/JhMask.stories.js +270 -0
- package/src/components/JhMask/JhMask.vue +123 -0
- package/src/components/JhMenu/JhMenu.md +85 -0
- package/src/components/JhMenu/JhMenu.stories.js +384 -0
- package/src/components/JhMenu/JhMenu.vue +545 -0
- package/src/components/JhModal/JhModal.md +68 -0
- package/src/components/JhModal/JhModal.stories.js +562 -0
- package/src/components/JhModal/JhModal.vue +235 -0
- package/src/components/JhModalForm/JhModalForm.md +69 -0
- package/src/components/JhModalForm/JhModalForm.stories.js +592 -0
- package/src/components/JhModalForm/JhModalForm.vue +298 -0
- package/src/components/JhPageContainer/JhPageContainer.md +409 -0
- package/src/components/JhPageContainer/JhPageContainer.stories.js +209 -0
- package/src/components/JhPageContainer/JhPageContainer.vue +72 -0
- package/src/components/JhQueryFilter/JhQueryFilter.md +77 -0
- package/src/components/JhQueryFilter/JhQueryFilter.stories.js +684 -0
- package/src/components/JhQueryFilter/JhQueryFilter.vue +429 -0
- package/src/components/JhScene/JhScene.md +64 -0
- package/src/components/JhScene/JhScene.stories.js +317 -0
- package/src/components/JhScene/JhScene.vue +376 -0
- package/src/components/JhStatisticCard/JhStatisticCard.md +363 -0
- package/src/components/JhStatisticCard/JhStatisticCard.stories.js +847 -0
- package/src/components/JhStatisticCard/JhStatisticCard.vue +459 -0
- package/src/components/JhStepsForm/JhStepsForm.md +666 -0
- package/src/components/JhStepsForm/JhStepsForm.stories.js +1224 -0
- package/src/components/JhStepsForm/JhStepsForm.vue +749 -0
- package/src/components/JhTable/JhTable.md +730 -0
- package/src/components/JhTable/JhTable.stories.js +1444 -0
- package/src/components/JhTable/JhTable.vue +2298 -0
- package/src/components/JhTableAttachment/JhTableAttachment.md +70 -0
- package/src/components/JhTableAttachment/JhTableAttachment.stories.js +198 -0
- package/src/components/JhTableAttachment/JhTableAttachment.vue +264 -0
- package/src/components/JhToast/JhToast.md +67 -0
- package/src/components/JhToast/JhToast.stories.js +386 -0
- package/src/components/JhToast/JhToast.vue +239 -0
- package/src/components/JhTreeSelect/JhTreeSelect.md +82 -0
- package/src/components/JhTreeSelect/JhTreeSelect.stories.js +391 -0
- package/src/components/JhTreeSelect/JhTreeSelect.vue +727 -0
- package/src/components/JhWaterMark/JhWaterMark.md +190 -0
- package/src/components/JhWaterMark/JhWaterMark.stories.js +675 -0
- package/src/components/JhWaterMark/JhWaterMark.vue +351 -0
- package/src/components/README.md +52 -0
- package/src/index.js +135 -0
- package/src/style/globalCSSJHV4.css +348 -0
- package/src/style/globalCSSVuetifyV4.css +637 -0
- package/src/style/storybook.css +4 -0
- package/src/tailwind.css +3 -0
- package/src/utils/vuetify.js +31 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="date-range-picker-container">
|
|
3
|
+
<v-menu
|
|
4
|
+
v-model="menu"
|
|
5
|
+
:close-on-content-click="false"
|
|
6
|
+
transition="scale-transition"
|
|
7
|
+
offset-y
|
|
8
|
+
min-width="auto"
|
|
9
|
+
max-width="600"
|
|
10
|
+
>
|
|
11
|
+
<template v-slot:activator="{ on, attrs }">
|
|
12
|
+
<v-text-field
|
|
13
|
+
v-model="dateRangeText"
|
|
14
|
+
:prefix="prefix"
|
|
15
|
+
prepend-inner-icon="mdi-calendar"
|
|
16
|
+
readonly
|
|
17
|
+
v-bind="attrs"
|
|
18
|
+
v-on="on"
|
|
19
|
+
:filled="filled"
|
|
20
|
+
:dense="dense"
|
|
21
|
+
:outlined="outlined"
|
|
22
|
+
:hide-details="hideDetails"
|
|
23
|
+
:clearable="clearable"
|
|
24
|
+
@click:clear="clearDateRange"
|
|
25
|
+
></v-text-field>
|
|
26
|
+
</template>
|
|
27
|
+
<v-card>
|
|
28
|
+
<v-card-text class="pa-0">
|
|
29
|
+
<div class="d-flex">
|
|
30
|
+
<!-- 左侧快捷选择菜单 -->
|
|
31
|
+
<v-list dense nav class="quick-select-list">
|
|
32
|
+
<v-list-item
|
|
33
|
+
@click="quickSelect(7)"
|
|
34
|
+
:class="{ 'v-item--active v-list-item--active primary--text': isLast7Days }"
|
|
35
|
+
>
|
|
36
|
+
<v-list-item-title>最近7天</v-list-item-title>
|
|
37
|
+
</v-list-item>
|
|
38
|
+
<v-list-item
|
|
39
|
+
@click="quickSelect(30)"
|
|
40
|
+
:class="{ 'v-item--active v-list-item--active primary--text': isLast30Days }"
|
|
41
|
+
>
|
|
42
|
+
<v-list-item-title>最近30天</v-list-item-title>
|
|
43
|
+
</v-list-item>
|
|
44
|
+
<v-list-item
|
|
45
|
+
@click="quickSelect(90)"
|
|
46
|
+
:class="{ 'v-item--active v-list-item--active primary--text': isLast90Days }"
|
|
47
|
+
>
|
|
48
|
+
<v-list-item-title>最近90天</v-list-item-title>
|
|
49
|
+
</v-list-item>
|
|
50
|
+
<v-list-item
|
|
51
|
+
@click="selectThisMonth"
|
|
52
|
+
:class="{ 'v-item--active v-list-item--active primary--text': isThisMonth }"
|
|
53
|
+
>
|
|
54
|
+
<v-list-item-title>本月</v-list-item-title>
|
|
55
|
+
</v-list-item>
|
|
56
|
+
<v-list-item
|
|
57
|
+
@click="selectLastMonth"
|
|
58
|
+
:class="{ 'v-item--active v-list-item--active primary--text': isLastMonth }"
|
|
59
|
+
>
|
|
60
|
+
<v-list-item-title>上月</v-list-item-title>
|
|
61
|
+
</v-list-item>
|
|
62
|
+
<v-list-item
|
|
63
|
+
@click="quickSelect(365)"
|
|
64
|
+
:class="{ 'v-item--active v-list-item--active primary--text': isLast365Days }"
|
|
65
|
+
>
|
|
66
|
+
<v-list-item-title>最近一年</v-list-item-title>
|
|
67
|
+
</v-list-item>
|
|
68
|
+
</v-list>
|
|
69
|
+
|
|
70
|
+
<!-- 日期选择器 -->
|
|
71
|
+
<v-date-picker v-model="tempDateRange" no-title range color="primary"></v-date-picker>
|
|
72
|
+
</div>
|
|
73
|
+
</v-card-text>
|
|
74
|
+
<v-divider></v-divider>
|
|
75
|
+
<v-card-actions>
|
|
76
|
+
<v-spacer></v-spacer>
|
|
77
|
+
<v-btn text color="grey" @click="cancelDateRange">取消</v-btn>
|
|
78
|
+
<v-btn text color="primary" @click="confirmDateRange">确认</v-btn>
|
|
79
|
+
</v-card-actions>
|
|
80
|
+
</v-card>
|
|
81
|
+
</v-menu>
|
|
82
|
+
</div>
|
|
83
|
+
</template>
|
|
84
|
+
|
|
85
|
+
<script>
|
|
86
|
+
export default {
|
|
87
|
+
name: 'JhDateRangePicker',
|
|
88
|
+
props: {
|
|
89
|
+
// v-model 绑定值
|
|
90
|
+
value: {
|
|
91
|
+
type: Array,
|
|
92
|
+
default: () => [],
|
|
93
|
+
},
|
|
94
|
+
// 前缀文本
|
|
95
|
+
prefix: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: '',
|
|
98
|
+
},
|
|
99
|
+
// 填充样式
|
|
100
|
+
filled: {
|
|
101
|
+
type: Boolean,
|
|
102
|
+
default: true,
|
|
103
|
+
},
|
|
104
|
+
// 紧凑模式
|
|
105
|
+
dense: {
|
|
106
|
+
type: Boolean,
|
|
107
|
+
default: true,
|
|
108
|
+
},
|
|
109
|
+
// 轮廓样式
|
|
110
|
+
outlined: {
|
|
111
|
+
type: Boolean,
|
|
112
|
+
default: false,
|
|
113
|
+
},
|
|
114
|
+
// 隐藏详情
|
|
115
|
+
hideDetails: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
default: true,
|
|
118
|
+
},
|
|
119
|
+
// 是否可清除
|
|
120
|
+
clearable: {
|
|
121
|
+
type: Boolean,
|
|
122
|
+
default: true,
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
data() {
|
|
126
|
+
return {
|
|
127
|
+
menu: false,
|
|
128
|
+
dateRange: [],
|
|
129
|
+
tempDateRange: [],
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
computed: {
|
|
133
|
+
dateRangeText() {
|
|
134
|
+
if (!this.dateRange || this.dateRange.length !== 2) return '';
|
|
135
|
+
return `${this.formatDate(this.dateRange[0])} ~ ${this.formatDate(this.dateRange[1])}`;
|
|
136
|
+
},
|
|
137
|
+
isLast7Days() {
|
|
138
|
+
if (!this.tempDateRange || this.tempDateRange.length !== 2) return false;
|
|
139
|
+
const today = this.getToday();
|
|
140
|
+
const last7Days = this.subtractDays(7);
|
|
141
|
+
return this.tempDateRange[0] === last7Days && this.tempDateRange[1] === today;
|
|
142
|
+
},
|
|
143
|
+
isLast30Days() {
|
|
144
|
+
if (!this.tempDateRange || this.tempDateRange.length !== 2) return false;
|
|
145
|
+
const today = this.getToday();
|
|
146
|
+
const last30Days = this.subtractDays(30);
|
|
147
|
+
return this.tempDateRange[0] === last30Days && this.tempDateRange[1] === today;
|
|
148
|
+
},
|
|
149
|
+
isLast90Days() {
|
|
150
|
+
if (!this.tempDateRange || this.tempDateRange.length !== 2) return false;
|
|
151
|
+
const today = this.getToday();
|
|
152
|
+
const last90Days = this.subtractDays(90);
|
|
153
|
+
return this.tempDateRange[0] === last90Days && this.tempDateRange[1] === today;
|
|
154
|
+
},
|
|
155
|
+
isThisMonth() {
|
|
156
|
+
if (!this.tempDateRange || this.tempDateRange.length !== 2) return false;
|
|
157
|
+
const today = this.getToday();
|
|
158
|
+
const firstDayOfMonth = this.getStartOfMonth();
|
|
159
|
+
return this.tempDateRange[0] === firstDayOfMonth && this.tempDateRange[1] === today;
|
|
160
|
+
},
|
|
161
|
+
isLastMonth() {
|
|
162
|
+
if (!this.tempDateRange || this.tempDateRange.length !== 2) return false;
|
|
163
|
+
const lastMonthStart = this.getStartOfLastMonth();
|
|
164
|
+
const lastMonthEnd = this.getEndOfLastMonth();
|
|
165
|
+
return this.tempDateRange[0] === lastMonthStart && this.tempDateRange[1] === lastMonthEnd;
|
|
166
|
+
},
|
|
167
|
+
isLast365Days() {
|
|
168
|
+
if (!this.tempDateRange || this.tempDateRange.length !== 2) return false;
|
|
169
|
+
const today = this.getToday();
|
|
170
|
+
const last365Days = this.subtractDays(365);
|
|
171
|
+
return this.tempDateRange[0] === last365Days && this.tempDateRange[1] === today;
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
watch: {
|
|
175
|
+
value: {
|
|
176
|
+
handler(newVal) {
|
|
177
|
+
if (newVal && Array.isArray(newVal) && newVal.length === 2) {
|
|
178
|
+
this.dateRange = [...newVal];
|
|
179
|
+
this.tempDateRange = [...newVal];
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
immediate: true,
|
|
183
|
+
},
|
|
184
|
+
menu(val) {
|
|
185
|
+
if (val) {
|
|
186
|
+
// 打开菜单时,将当前选择复制到临时变量
|
|
187
|
+
this.tempDateRange = this.dateRange.length === 2 ? [...this.dateRange] : [];
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
mounted() {
|
|
192
|
+
if (this.value && Array.isArray(this.value) && this.value.length === 2) {
|
|
193
|
+
this.dateRange = [...this.value];
|
|
194
|
+
this.tempDateRange = [...this.value];
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
methods: {
|
|
198
|
+
// 格式化日期
|
|
199
|
+
formatDate(date) {
|
|
200
|
+
if (!date) return '';
|
|
201
|
+
return date;
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
// 获取今天日期
|
|
205
|
+
getToday() {
|
|
206
|
+
const date = new Date();
|
|
207
|
+
return this.toDateString(date);
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
// 减去天数
|
|
211
|
+
subtractDays(days) {
|
|
212
|
+
const date = new Date();
|
|
213
|
+
date.setDate(date.getDate() - days);
|
|
214
|
+
return this.toDateString(date);
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
// 获取本月第一天
|
|
218
|
+
getStartOfMonth() {
|
|
219
|
+
const date = new Date();
|
|
220
|
+
return this.toDateString(new Date(date.getFullYear(), date.getMonth(), 1));
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
// 获取上月第一天
|
|
224
|
+
getStartOfLastMonth() {
|
|
225
|
+
const date = new Date();
|
|
226
|
+
return this.toDateString(new Date(date.getFullYear(), date.getMonth() - 1, 1));
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
// 获取上月最后一天
|
|
230
|
+
getEndOfLastMonth() {
|
|
231
|
+
const date = new Date();
|
|
232
|
+
return this.toDateString(new Date(date.getFullYear(), date.getMonth(), 0));
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
// 转换为日期字符串
|
|
236
|
+
toDateString(date) {
|
|
237
|
+
const year = date.getFullYear();
|
|
238
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
239
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
240
|
+
return `${year}-${month}-${day}`;
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
// 确认日期范围
|
|
244
|
+
confirmDateRange() {
|
|
245
|
+
if (this.tempDateRange && this.tempDateRange.length === 2) {
|
|
246
|
+
// 确保日期顺序正确
|
|
247
|
+
const sortedRange = [...this.tempDateRange].sort();
|
|
248
|
+
this.dateRange = sortedRange;
|
|
249
|
+
this.$emit('input', this.dateRange);
|
|
250
|
+
this.$emit('change', this.dateRange);
|
|
251
|
+
}
|
|
252
|
+
this.menu = false;
|
|
253
|
+
},
|
|
254
|
+
|
|
255
|
+
// 取消选择
|
|
256
|
+
cancelDateRange() {
|
|
257
|
+
// 取消时恢复原来的选择
|
|
258
|
+
this.tempDateRange = this.dateRange.length === 2 ? [...this.dateRange] : [];
|
|
259
|
+
this.menu = false;
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
// 清除日期范围
|
|
263
|
+
clearDateRange() {
|
|
264
|
+
this.dateRange = [];
|
|
265
|
+
this.tempDateRange = [];
|
|
266
|
+
this.$emit('input', []);
|
|
267
|
+
this.$emit('change', []);
|
|
268
|
+
},
|
|
269
|
+
|
|
270
|
+
// 快速选择最近N天
|
|
271
|
+
quickSelect(days) {
|
|
272
|
+
const today = this.getToday();
|
|
273
|
+
const start = this.subtractDays(days);
|
|
274
|
+
this.tempDateRange = [start, today];
|
|
275
|
+
},
|
|
276
|
+
|
|
277
|
+
// 选择本月
|
|
278
|
+
selectThisMonth() {
|
|
279
|
+
const today = this.getToday();
|
|
280
|
+
const start = this.getStartOfMonth();
|
|
281
|
+
this.tempDateRange = [start, today];
|
|
282
|
+
},
|
|
283
|
+
|
|
284
|
+
// 选择上月
|
|
285
|
+
selectLastMonth() {
|
|
286
|
+
const start = this.getStartOfLastMonth();
|
|
287
|
+
const end = this.getEndOfLastMonth();
|
|
288
|
+
this.tempDateRange = [start, end];
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
</script>
|
|
293
|
+
|
|
294
|
+
<style scoped>
|
|
295
|
+
.date-range-picker-container {
|
|
296
|
+
position: relative;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.quick-select-list {
|
|
300
|
+
min-width: 100px;
|
|
301
|
+
border-right: 1px solid #e0e0e0;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.quick-select-list >>> .v-item--active {
|
|
305
|
+
background-color: rgba(25, 118, 210, 0.12);
|
|
306
|
+
}
|
|
307
|
+
</style>
|