jobsys-explore 4.0.21 → 4.0.23

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.
@@ -0,0 +1,5 @@
1
+ ---
2
+ "jobsys-explore": patch
3
+ ---
4
+
5
+ date default value
@@ -0,0 +1,5 @@
1
+ ---
2
+ "jobsys-explore": patch
3
+ ---
4
+
5
+ help add function
package/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # jobsys-explore
2
2
 
3
+ ## 4.0.23
4
+
5
+ ### Patch Changes
6
+
7
+ - address
8
+ - form loading status
9
+ - fixed date modelValue
10
+ - date default value
11
+ - y
12
+ - add exPros parameter
13
+ - select add textInValue
14
+ - option fetch data only once
15
+ - add form reset
16
+ - fixed
17
+ - add sm2 encrypt
18
+ - form expose fetchItem method
19
+ - fixed address modelValue
20
+ - fixed textInValue
21
+ - fixed textInValue
22
+ - help add function
23
+ - add key_cn
24
+ - search watch model value
25
+ - address
26
+ - cascader
27
+ - e
28
+
29
+ ## 4.0.22
30
+
31
+ ### Patch Changes
32
+
33
+ - address
34
+ - form loading status
35
+ - fixed date modelValue
36
+ - date default value
37
+ - y
38
+ - add exPros parameter
39
+ - select add textInValue
40
+ - option fetch data only once
41
+ - add form reset
42
+ - fixed
43
+ - add sm2 encrypt
44
+ - form expose fetchItem method
45
+ - fixed address modelValue
46
+ - fixed textInValue
47
+ - fixed textInValue
48
+ - add key_cn
49
+ - search watch model value
50
+ - address
51
+ - cascader
52
+ - e
53
+
3
54
  ## 4.0.21
4
55
 
5
56
  ### Patch Changes
@@ -15,7 +15,7 @@ export default defineComponent({
15
15
  props: {
16
16
  ...defaultFieldProps,
17
17
 
18
- modelValue: { type: [Date, String], default: () => null },
18
+ modelValue: { type: [Date, String, Object], default: () => null },
19
19
 
20
20
  /**
21
21
  * 标题
@@ -26,6 +26,16 @@ export default defineComponent({
26
26
  setup(props, { emit, slots, expose }) {
27
27
  const columnsType = props.defaultProps?.columnsType || ["year", "month", "day"]
28
28
 
29
+ const getYear = (value) => {
30
+ return isDayjs(value) ? value.year() : value.getFullYear()
31
+ }
32
+ const getMonth = (value) => {
33
+ return isDayjs(value) ? value.month() + 1 : value.getMonth() + 1
34
+ }
35
+ const getDate = (value) => {
36
+ return isDayjs(value) ? value.date() : value.getDate()
37
+ }
38
+
29
39
  const _setValueByColumns = (columnsType, value, date) => {
30
40
  columnsType.forEach((column) => {
31
41
  if (column === "year") {
@@ -66,16 +76,6 @@ export default defineComponent({
66
76
 
67
77
  const pickerRef = ref(null)
68
78
 
69
- const getYear = (value) => {
70
- return isDayjs(value) ? value.year() : value.getFullYear()
71
- }
72
- const getMonth = (value) => {
73
- return isDayjs(value) ? value.month() + 1 : value.getMonth() + 1
74
- }
75
- const getDate = (value) => {
76
- return isDayjs(value) ? value.date() : value.getDate()
77
- }
78
-
79
79
  const displayText = computed(() => {
80
80
  if (props.modelValue) {
81
81
  let text = ""
@@ -94,7 +94,6 @@ export default defineComponent({
94
94
  text += padZero(getDate(props.modelValue), 2)
95
95
  }
96
96
  })
97
-
98
97
  return text
99
98
  }
100
99
 
@@ -53,21 +53,29 @@ export default defineComponent({
53
53
 
54
54
  /****************** render **********************/
55
55
 
56
+ const helpElem = () => {
57
+ if (props.append) {
58
+ return (
59
+ <Popover v-model:show={state.showHelp} theme={"dark"} placement={"bottom-start"}>
60
+ {{
61
+ default: () => <div class={"ex-field__help"}>{isString(props.help) ? props.help : props.help()}</div>,
62
+ reference: () =>
63
+ props.help ? (
64
+ <span class={"ex-field__help-handler"}>
65
+ <Icon name={"warning-o"}></Icon>
66
+ </span>
67
+ ) : null,
68
+ }}
69
+ </Popover>
70
+ )
71
+ }
72
+ return null
73
+ }
56
74
  const labelElem = () => (
57
75
  <div class={"ex-field__label"}>
58
76
  <span>{props.label || slots.label?.()}</span>
59
77
 
60
- <Popover v-model:show={state.showHelp} theme={"dark"} placement={"bottom-start"}>
61
- {{
62
- default: () => <div class={"ex-field__help"}>{props.help}</div>,
63
- reference: () =>
64
- props.help ? (
65
- <span class={"ex-field__help-handler"}>
66
- <Icon name={"warning-o"}></Icon>
67
- </span>
68
- ) : null,
69
- }}
70
- </Popover>
78
+ {helpElem()}
71
79
  </div>
72
80
  )
73
81
 
@@ -1,5 +1,6 @@
1
1
  import { isArray, isDate, isFunction, isUndefined } from "lodash-es"
2
2
  import { useAddressFullCode } from "./ExAddress.jsx"
3
+ import { isDayjs } from "dayjs"
3
4
 
4
5
  /**
5
6
  * 初始化表单项默认值
@@ -30,7 +31,7 @@ const initItemDefaultValue = (item, existingData, submitForm, provider) => {
30
31
  } else if (item.type === "switch") {
31
32
  value = value === "true" || value === 1 || value === "1" || value === true
32
33
  } else if (item.type === "date" || item.type === "datetime") {
33
- value = isDate(value) ? value : null
34
+ value = isDate(value) || isDayjs(value) ? value : null
34
35
  } else if (item.type === "checkbox" || item.type === "group" || item.type === "cascade") {
35
36
  value = value || []
36
37
  } else if (item.type === "address") {
@@ -24,7 +24,7 @@ export const defaultFieldProps = {
24
24
  /**
25
25
  * 提示文案
26
26
  */
27
- help: { type: String, default: "" },
27
+ help: { type: [String, Function], default: "" },
28
28
 
29
29
  /**
30
30
  * 元素的append slot