jobsys-explore 4.2.15 → 4.2.16
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/.changeset/chatty-eels-vanish.md +5 -0
- package/CHANGELOG.md +8 -0
- package/components/form/ExDatetime.jsx +38 -20
- package/components/pagination/ExPagination.jsx +11 -5
- package/components/search/ExSearch.jsx +1 -1
- package/dist/jobsys-explore.cjs +6 -6
- package/dist/jobsys-explore.cjs.map +1 -1
- package/dist/jobsys-explore.js +805 -788
- package/dist/jobsys-explore.js.map +1 -1
- package/package.json +1 -1
- package/playground/App.vue +2 -2
- package/playground/TestForm.vue +4 -4
- package/playground/TestPagination.vue +9 -1
- package/playground/TestSearch.vue +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,7 @@ import { Calendar, Collapse, CollapseItem, TimePicker } from "vant"
|
|
|
4
4
|
import ExButton from "../button/ExButton.jsx"
|
|
5
5
|
import { padZero } from "vant/es/utils"
|
|
6
6
|
import { defaultFieldProps } from "../utils"
|
|
7
|
+
import { cloneDeep } from "lodash-es"
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* ExDatetime 日期时间选择器
|
|
@@ -20,25 +21,7 @@ export default defineComponent({
|
|
|
20
21
|
setup(props, { slots, emit, expose }) {
|
|
21
22
|
const dateValue = ref(null)
|
|
22
23
|
const timeValue = ref(null)
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
* @param {Date|null} date
|
|
27
|
-
*/
|
|
28
|
-
const prepareDate = (date) => {
|
|
29
|
-
if (date) {
|
|
30
|
-
dateValue.value = date
|
|
31
|
-
timeValue.value = `${padZero(date.getHours(), 2)}:${padZero(date.getMinutes(), 2)}`
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
prepareDate(props.modelValue)
|
|
36
|
-
|
|
37
|
-
watch(
|
|
38
|
-
() => props.modelValue,
|
|
39
|
-
() => prepareDate(props.modelValue),
|
|
40
|
-
)
|
|
41
|
-
|
|
24
|
+
const displayText = ref(null)
|
|
42
25
|
const pickerRef = ref()
|
|
43
26
|
|
|
44
27
|
const activeName = ref("date")
|
|
@@ -62,8 +45,37 @@ export default defineComponent({
|
|
|
62
45
|
}
|
|
63
46
|
return "请选择时间"
|
|
64
47
|
})
|
|
48
|
+
const timeModel = computed(() => {
|
|
49
|
+
if (timeValue.value) {
|
|
50
|
+
const [hours, minutes] = timeValue.value.split(":")
|
|
51
|
+
return [hours, minutes]
|
|
52
|
+
}
|
|
53
|
+
return []
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const defaultDate = ref(props.modelValue || new Date())
|
|
57
|
+
|
|
58
|
+
const setDisplayText = () => {
|
|
59
|
+
displayText.value = dateValue.value && timeValue.value ? `${dateText.value} ${timeText.value}` : ""
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @param {Date|null} date
|
|
64
|
+
*/
|
|
65
|
+
const prepareDate = (date) => {
|
|
66
|
+
if (date) {
|
|
67
|
+
dateValue.value = cloneDeep(date)
|
|
68
|
+
timeValue.value = `${padZero(date.getHours(), 2)}:${padZero(date.getMinutes(), 2)}`
|
|
69
|
+
}
|
|
70
|
+
setDisplayText()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
prepareDate(props.modelValue)
|
|
65
74
|
|
|
66
|
-
|
|
75
|
+
watch(
|
|
76
|
+
() => props.modelValue,
|
|
77
|
+
() => prepareDate(props.modelValue),
|
|
78
|
+
)
|
|
67
79
|
|
|
68
80
|
expose({ displayText })
|
|
69
81
|
|
|
@@ -76,6 +88,9 @@ export default defineComponent({
|
|
|
76
88
|
}
|
|
77
89
|
|
|
78
90
|
const onConfirm = () => {
|
|
91
|
+
if (!dateValue.value) {
|
|
92
|
+
dateValue.value = new Date()
|
|
93
|
+
}
|
|
79
94
|
let dateString = `${dateValue.value.getFullYear()}/${dateValue.value.getMonth() + 1}/${dateValue.value.getDate()}`
|
|
80
95
|
|
|
81
96
|
if (!timeValue.value) {
|
|
@@ -85,6 +100,7 @@ export default defineComponent({
|
|
|
85
100
|
}
|
|
86
101
|
|
|
87
102
|
pickerRef.value.close()
|
|
103
|
+
setDisplayText()
|
|
88
104
|
|
|
89
105
|
emit("update:modelValue", new Date(dateString))
|
|
90
106
|
}
|
|
@@ -108,6 +124,7 @@ export default defineComponent({
|
|
|
108
124
|
maxDate={maxDate}
|
|
109
125
|
showSubtitle={false}
|
|
110
126
|
showConfirm={false}
|
|
127
|
+
defaultDate={defaultDate.value}
|
|
111
128
|
poppable={false}
|
|
112
129
|
showTitle={false}
|
|
113
130
|
lazyRender={true}
|
|
@@ -125,6 +142,7 @@ export default defineComponent({
|
|
|
125
142
|
default: () => (
|
|
126
143
|
<div>
|
|
127
144
|
<TimePicker
|
|
145
|
+
modelValue={timeModel.value}
|
|
128
146
|
showToolbar={false}
|
|
129
147
|
onChange={onTimeChange}
|
|
130
148
|
{...props.defaultProps.timeProps}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, inject, reactive, nextTick } from "vue"
|
|
1
|
+
import { defineComponent, inject, reactive, nextTick, ref } from "vue"
|
|
2
2
|
import { useFetch } from "../../hooks"
|
|
3
3
|
import { Empty, List, PullRefresh, Sticky } from "vant"
|
|
4
4
|
import ExSearch from "../search/ExSearch.jsx"
|
|
@@ -22,7 +22,7 @@ export default defineComponent({
|
|
|
22
22
|
pullRefresh: { type: [Boolean, Object], default: true },
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* ExSearch
|
|
25
|
+
* ExSearch 搜索配置
|
|
26
26
|
*/
|
|
27
27
|
search: { type: Object, default: null },
|
|
28
28
|
|
|
@@ -93,6 +93,7 @@ export default defineComponent({
|
|
|
93
93
|
},
|
|
94
94
|
setup(props, { expose, slots }) {
|
|
95
95
|
const paginationProvider = inject(EX_PAGINATION, () => ({}))
|
|
96
|
+
const searchRef = ref(null)
|
|
96
97
|
|
|
97
98
|
const { currentPage: currentPageKey, pageSize: pageSizeKey } = paginationProvider.requestKeys
|
|
98
99
|
|
|
@@ -195,6 +196,11 @@ export default defineComponent({
|
|
|
195
196
|
})
|
|
196
197
|
}
|
|
197
198
|
|
|
199
|
+
const onFirstLoad = () => {
|
|
200
|
+
state.searchParams = searchRef.value?.getQueryForm() || {}
|
|
201
|
+
loadMore(false)
|
|
202
|
+
}
|
|
203
|
+
|
|
198
204
|
/****************** exposed ******************/
|
|
199
205
|
|
|
200
206
|
const items = () => {
|
|
@@ -219,14 +225,14 @@ export default defineComponent({
|
|
|
219
225
|
return (
|
|
220
226
|
<Sticky {...stickyObj}>
|
|
221
227
|
<div class={`ex-pagination__search`}>
|
|
222
|
-
<ExSearch {...props.search} onSearch={onSearch}></ExSearch>
|
|
228
|
+
<ExSearch ref={searchRef} {...props.search} onSearch={onSearch}></ExSearch>
|
|
223
229
|
</div>
|
|
224
230
|
</Sticky>
|
|
225
231
|
)
|
|
226
232
|
} else {
|
|
227
233
|
return (
|
|
228
234
|
<div class={`ex-pagination__search`}>
|
|
229
|
-
<ExSearch {...props.search} onSearch={onSearch}></ExSearch>
|
|
235
|
+
<ExSearch ref={searchRef} {...props.search} onSearch={onSearch}></ExSearch>
|
|
230
236
|
</div>
|
|
231
237
|
)
|
|
232
238
|
}
|
|
@@ -252,7 +258,7 @@ export default defineComponent({
|
|
|
252
258
|
finished={state.finished}
|
|
253
259
|
finishedText={props.finishText}
|
|
254
260
|
errorText={state.errorMessage || props.errorText}
|
|
255
|
-
onLoad={
|
|
261
|
+
onLoad={onFirstLoad}
|
|
256
262
|
offset={props.offset}
|
|
257
263
|
{...props.defaultProps}
|
|
258
264
|
>
|