jobsys-explore 4.2.15 → 4.2.17
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/.changeset/twenty-dolls-fix.md +5 -0
- package/CHANGELOG.md +17 -0
- package/components/form/ExDatetime.jsx +38 -20
- package/components/form/ExSelect.jsx +2 -2
- package/components/pagination/ExPagination.jsx +11 -5
- package/components/search/ExSearch.jsx +3 -2
- package/components/uploader/ExUploader.jsx +2 -2
- package/components/utils.js +2 -2
- package/dist/jobsys-explore.cjs +6 -6
- package/dist/jobsys-explore.cjs.map +1 -1
- package/dist/jobsys-explore.js +1004 -987
- 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 +14 -1
- package/playground/TestSearch.vue +2 -1
- package/playground/TestUploader.vue +13 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# jobsys-explore
|
|
2
2
|
|
|
3
|
+
## 4.2.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- datetime and pagination search
|
|
8
|
+
- empty zero
|
|
9
|
+
- e
|
|
10
|
+
- exuploader fixed disabled
|
|
11
|
+
|
|
12
|
+
## 4.2.16
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- datetime and pagination search
|
|
17
|
+
- empty zero
|
|
18
|
+
- e
|
|
19
|
+
|
|
3
20
|
## 4.2.15
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -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}
|
|
@@ -3,7 +3,7 @@ import PickerWrapper, { pickerSlots } from "./PickerWrapper.jsx"
|
|
|
3
3
|
import { Button, Picker, Search } from "vant"
|
|
4
4
|
import { defaultFieldProps, defaultOptionsProps } from "../utils"
|
|
5
5
|
import { useFetch } from "../../hooks"
|
|
6
|
-
import { cloneDeep, find, isArray, isFunction, isString } from "lodash-es"
|
|
6
|
+
import { cloneDeep, find, isArray, isFunction, isNumber, isString } from "lodash-es"
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* ExSelect 下拉选择
|
|
@@ -113,7 +113,7 @@ export default defineComponent({
|
|
|
113
113
|
options = options.map((option) => {
|
|
114
114
|
if (isArray(option)) {
|
|
115
115
|
return option.map((op) => {
|
|
116
|
-
return isString(op) ? { value: op, label: op, text: op } : { text: op.label, ...op }
|
|
116
|
+
return isString(op) || isNumber(op) ? { value: op, label: op, text: op } : { text: op.label, ...op }
|
|
117
117
|
})
|
|
118
118
|
}
|
|
119
119
|
|
|
@@ -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
|
>
|
|
@@ -98,7 +98,7 @@ export default defineComponent({
|
|
|
98
98
|
value = isFunction(item.defaultValue) ? item.defaultValue() : item.defaultValue
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
if (item.type === "date" && !value) {
|
|
101
|
+
if ((item.type === "date" || item.type === "datetime") && !value) {
|
|
102
102
|
return null
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -120,6 +120,7 @@ export default defineComponent({
|
|
|
120
120
|
props.columns.forEach((item) => {
|
|
121
121
|
form[item.key] = searchItemDefaultValue(item)
|
|
122
122
|
})
|
|
123
|
+
console.log(props.columns, form)
|
|
123
124
|
state.queryForm = form
|
|
124
125
|
}
|
|
125
126
|
|
|
@@ -182,7 +183,7 @@ export default defineComponent({
|
|
|
182
183
|
componentValue.value = ""
|
|
183
184
|
}
|
|
184
185
|
|
|
185
|
-
expose({ reset })
|
|
186
|
+
expose({ reset, getQueryForm })
|
|
186
187
|
|
|
187
188
|
/******************* render *********************/
|
|
188
189
|
|
|
@@ -243,9 +243,9 @@ export default defineComponent({
|
|
|
243
243
|
accetp={props.accept}
|
|
244
244
|
uploadText={props.uploadText}
|
|
245
245
|
uploadIcon={props.uploadIcon}
|
|
246
|
-
|
|
246
|
+
disabled={props.disabled}
|
|
247
247
|
readonly={props.readonly}
|
|
248
|
-
deletable={!props.readonly}
|
|
248
|
+
deletable={!(props.readonly || props.disabled)}
|
|
249
249
|
showUpload={!props.readonly && !props.disabled}
|
|
250
250
|
afterRead={onSubmit}
|
|
251
251
|
onOversize={onOversize}
|
package/components/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cloneDeep, isFunction, isString } from "lodash-es"
|
|
1
|
+
import { cloneDeep, isFunction, isNumber, isString } from "lodash-es"
|
|
2
2
|
import { watch } from "vue"
|
|
3
3
|
import { useCache, useFetch } from "../hooks"
|
|
4
4
|
|
|
@@ -118,7 +118,7 @@ export const prepareOptions = (options) => {
|
|
|
118
118
|
if (op.children?.length) {
|
|
119
119
|
op.children = prepareOptions(op.children)
|
|
120
120
|
}
|
|
121
|
-
return isString(op) ? { value: op, label: op, text: op } : { text: op.label, ...op }
|
|
121
|
+
return isString(op) || isNumber(op) ? { value: op, label: op, text: op } : { text: op.label, ...op }
|
|
122
122
|
})
|
|
123
123
|
return options
|
|
124
124
|
}
|