sh-view 2.6.2 → 2.6.4

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.
Files changed (40) hide show
  1. package/package.json +1 -1
  2. package/packages/components/global-components/sh-form/form.vue +110 -108
  3. package/packages/components/global-components/sh-form/js/useForm.js +3 -0
  4. package/packages/components/global-components/sh-form/query.vue +70 -68
  5. package/packages/components/global-components/sh-table/components/sh-column.vue +69 -69
  6. package/packages/components/global-components/sh-table/grid.vue +160 -159
  7. package/packages/components/global-components/sh-table/js/useTable.js +12 -6
  8. package/packages/components/global-components/sh-table/table.vue +218 -217
  9. package/packages/components/other-components/sh-cron-modal/mixin/cron-hooks.js +179 -177
  10. package/packages/components/other-components/sh-cron-modal/tabs/cron-day-box.vue +101 -99
  11. package/packages/components/other-components/sh-cron-modal/tabs/cron-hour-box.vue +68 -66
  12. package/packages/components/other-components/sh-cron-modal/tabs/cron-minute-box.vue +68 -66
  13. package/packages/components/other-components/sh-cron-modal/tabs/cron-month-box.vue +68 -66
  14. package/packages/components/other-components/sh-cron-modal/tabs/cron-second-box.vue +68 -66
  15. package/packages/components/other-components/sh-cron-modal/tabs/cron-week-box.vue +126 -125
  16. package/packages/components/other-components/sh-cron-modal/tabs/cron-year-box.vue +59 -57
  17. package/packages/components/other-components/sh-preview/components/sh-excel.vue +929 -927
  18. package/packages/components/other-components/sh-preview/components/sh-word.vue +78 -76
  19. package/packages/vxeTable/render/cell/vxe-render-checkbox.vue +28 -26
  20. package/packages/vxeTable/render/cell/vxe-render-checkgroup.vue +43 -42
  21. package/packages/vxeTable/render/cell/vxe-render-code.vue +36 -34
  22. package/packages/vxeTable/render/cell/vxe-render-goption.vue +104 -103
  23. package/packages/vxeTable/render/cell/vxe-render-href.vue +21 -19
  24. package/packages/vxeTable/render/cell/vxe-render-input.vue +53 -52
  25. package/packages/vxeTable/render/cell/vxe-render-money.vue +33 -31
  26. package/packages/vxeTable/render/cell/vxe-render-progress.vue +28 -26
  27. package/packages/vxeTable/render/cell/vxe-render-radio.vue +28 -26
  28. package/packages/vxeTable/render/cell/vxe-render-radiogroup.vue +43 -42
  29. package/packages/vxeTable/render/cell/vxe-render-select.vue +52 -51
  30. package/packages/vxeTable/render/cell/vxe-render-switch.vue +28 -26
  31. package/packages/vxeTable/render/cell/vxe-render-table.vue +51 -50
  32. package/packages/vxeTable/render/cell/vxe-render-textarea.vue +28 -26
  33. package/packages/vxeTable/render/cell/vxe-render-time.vue +44 -41
  34. package/packages/vxeTable/render/cell/vxe-render-tree.vue +63 -60
  35. package/packages/vxeTable/render/cell/vxe-render-upload.vue +28 -26
  36. package/packages/vxeTable/render/filters/vxe-filter-input.vue +25 -23
  37. package/packages/vxeTable/render/footer/vxe-footer-input.vue +23 -21
  38. package/packages/vxeTable/render/footer/vxe-footer-money.vue +30 -28
  39. package/packages/vxeTable/render/header/vxe-header-money.vue +31 -29
  40. package/packages/vxeTable/render/mixin/cell-hooks.js +4 -1
@@ -1,177 +1,179 @@
1
- import { computed, ref, reactive } from 'vue'
2
-
3
- const TypeEnum = {
4
- unset: 'UNSET',
5
- every: 'EVERY',
6
- range: 'RANGE',
7
- loop: 'LOOP',
8
- work: 'WORK',
9
- last: 'LAST',
10
- specify: 'SPECIFY'
11
- }
12
-
13
- export default function (props, context, proxy, state) {
14
- const { emit, slots } = context
15
- const { $vUtils } = proxy
16
-
17
- const type = ref(TypeEnum.every)
18
- const defaultValue = ref(state.defaultValue)
19
- const minValue = ref(state.minValue)
20
- const maxValue = ref(state.maxValue)
21
- const valueRange = reactive(state.valueRange)
22
- const valueLoop = reactive(state.valueLoop)
23
- const valueWork = ref(1)
24
- const valueList = ref([])
25
-
26
- const beforeRadioAttrs = computed(() => {
27
- return {
28
- class: ['choice'],
29
- disabled: props.disabled
30
- }
31
- })
32
- const inputNumberAttrs = computed(() => {
33
- return {
34
- class: ['cron-item-input'],
35
- type: 'integer',
36
- size: 'mini'
37
- }
38
- })
39
- const typeRangeAttrs = computed(() => {
40
- return Object.assign(inputNumberAttrs.value, {
41
- disabled: type.value !== TypeEnum.range || props.disabled
42
- })
43
- })
44
- const typeLoopAttrs = computed(() => {
45
- return Object.assign(inputNumberAttrs.value, {
46
- disabled: type.value !== TypeEnum.loop || props.disabled
47
- })
48
- })
49
- const typeSpecifyAttrs = computed(() => {
50
- return {
51
- class: ['list-check-item'],
52
- disabled: type.value !== TypeEnum.specify || props.disabled
53
- }
54
- })
55
- const specifyRange = computed(() => {
56
- let range = []
57
- if (maxValue.value != null) {
58
- for (let i = minValue.value; i <= maxValue.value; i++) {
59
- range.push(i)
60
- }
61
- }
62
- return range
63
- })
64
- // 根据不同的类型计算出的value
65
- const computeValue = computed(() => {
66
- let valueArray = []
67
- switch (type.value) {
68
- case TypeEnum.unset:
69
- valueArray.push('?')
70
- break
71
- case TypeEnum.every:
72
- valueArray.push('*')
73
- break
74
- case TypeEnum.range:
75
- valueArray.push(`${valueRange.start}-${valueRange.end}`)
76
- break
77
- case TypeEnum.loop:
78
- valueArray.push(`${valueLoop.start}/${valueLoop.interval}`)
79
- break
80
- case TypeEnum.work:
81
- valueArray.push(`${valueWork.value}W`)
82
- break
83
- case TypeEnum.last:
84
- valueArray.push('L')
85
- break
86
- case TypeEnum.specify:
87
- if (valueList.value.length === 0) {
88
- valueList.value.push(minValue)
89
- }
90
- valueArray.push(valueList.value.join(','))
91
- break
92
- default:
93
- valueArray.push(defaultValue.value)
94
- break
95
- }
96
- return valueArray.length > 0 ? valueArray.join('') : defaultValue.value
97
- })
98
- const parseValue = value => {
99
- if (value === computeValue.value) {
100
- return
101
- }
102
- try {
103
- if (!value || value === defaultValue.value) {
104
- type.value = TypeEnum.every
105
- } else if (value.indexOf('?') >= 0) {
106
- type.value = TypeEnum.unset
107
- } else if (value.indexOf('-') >= 0) {
108
- type.value = TypeEnum.range
109
- const values = value.split('-')
110
- if (values.length >= 2) {
111
- valueRange.start = parseInt(values[0])
112
- valueRange.end = parseInt(values[1])
113
- }
114
- } else if (value.indexOf('/') >= 0) {
115
- type.value = TypeEnum.loop
116
- const values = value.split('/')
117
- if (values.length >= 2) {
118
- valueLoop.start = value[0] === '*' ? 0 : parseInt(values[0])
119
- valueLoop.interval = parseInt(values[1])
120
- }
121
- } else if (value.indexOf('W') >= 0) {
122
- type.value = TypeEnum.work
123
- const values = value.split('W')
124
- if (!values[0] && !isNaN(values[0])) {
125
- valueWork.value = parseInt(values[0])
126
- }
127
- } else if (value.indexOf('L') >= 0) {
128
- type.value = TypeEnum.last
129
- } else if (value.indexOf(',') >= 0 || !isNaN(value)) {
130
- type.value = TypeEnum.specify
131
- valueList.value = value.split(',').map(item => parseInt(item))
132
- } else {
133
- type.value = TypeEnum.every
134
- }
135
- } catch (e) {
136
- type.value = TypeEnum.every
137
- }
138
- }
139
- const updateValue = value => {
140
- emit('change', value)
141
- emit('update:modelValue', value)
142
- }
143
-
144
- watch(
145
- () => props.modelValue,
146
- val => {
147
- if (val !== computeValue.value) {
148
- parseValue(val)
149
- }
150
- },
151
- { immediate: true }
152
- )
153
-
154
- watch(
155
- () => computeValue.value,
156
- val => {
157
- updateValue(v)
158
- }
159
- )
160
-
161
- return {
162
- TypeEnum,
163
- type,
164
- valueRange,
165
- valueLoop,
166
- valueWork,
167
- valueList,
168
- specifyRange,
169
- computeValue,
170
- inputNumberAttrs,
171
- beforeRadioAttrs,
172
- typeRangeAttrs,
173
- typeLoopAttrs,
174
- typeSpecifyAttrs,
175
- updateValue
176
- }
177
- }
1
+ import { computed, ref, reactive } from 'vue'
2
+
3
+ const TypeEnum = {
4
+ unset: 'UNSET',
5
+ every: 'EVERY',
6
+ range: 'RANGE',
7
+ loop: 'LOOP',
8
+ work: 'WORK',
9
+ last: 'LAST',
10
+ specify: 'SPECIFY'
11
+ }
12
+
13
+ export default function (props, context, proxy, state) {
14
+ const { emit, slots } = context
15
+ const { $vUtils } = proxy
16
+
17
+ const type = ref(TypeEnum.every)
18
+ const defaultValue = ref(state.defaultValue)
19
+ const minValue = ref(state.minValue)
20
+ const maxValue = ref(state.maxValue)
21
+ const valueRange = reactive(state.valueRange)
22
+ const valueLoop = reactive(state.valueLoop)
23
+ const valueWork = ref(1)
24
+ const valueList = ref([])
25
+
26
+ const beforeRadioAttrs = computed(() => {
27
+ return {
28
+ class: ['choice'],
29
+ disabled: props.disabled
30
+ }
31
+ })
32
+ const inputNumberAttrs = computed(() => {
33
+ return {
34
+ class: ['cron-item-input'],
35
+ type: 'integer',
36
+ size: 'mini'
37
+ }
38
+ })
39
+ const typeRangeAttrs = computed(() => {
40
+ return {
41
+ ...inputNumberAttrs.value,
42
+ disabled: type.value !== TypeEnum.range || props.disabled
43
+ }
44
+ })
45
+ const typeLoopAttrs = computed(() => {
46
+ return {
47
+ ...inputNumberAttrs.value,
48
+ disabled: type.value !== TypeEnum.loop || props.disabled
49
+ }
50
+ })
51
+ const typeSpecifyAttrs = computed(() => {
52
+ return {
53
+ class: ['list-check-item'],
54
+ disabled: type.value !== TypeEnum.specify || props.disabled
55
+ }
56
+ })
57
+ const specifyRange = computed(() => {
58
+ let range = []
59
+ if (maxValue.value != null) {
60
+ for (let i = minValue.value; i <= maxValue.value; i++) {
61
+ range.push(i)
62
+ }
63
+ }
64
+ return range
65
+ })
66
+ // 根据不同的类型计算出的value
67
+ const computeValue = computed(() => {
68
+ let valueArray = []
69
+ switch (type.value) {
70
+ case TypeEnum.unset:
71
+ valueArray.push('?')
72
+ break
73
+ case TypeEnum.every:
74
+ valueArray.push('*')
75
+ break
76
+ case TypeEnum.range:
77
+ valueArray.push(`${valueRange.start}-${valueRange.end}`)
78
+ break
79
+ case TypeEnum.loop:
80
+ valueArray.push(`${valueLoop.start}/${valueLoop.interval}`)
81
+ break
82
+ case TypeEnum.work:
83
+ valueArray.push(`${valueWork.value}W`)
84
+ break
85
+ case TypeEnum.last:
86
+ valueArray.push('L')
87
+ break
88
+ case TypeEnum.specify:
89
+ if (valueList.value.length === 0) {
90
+ valueList.value.push(minValue)
91
+ }
92
+ valueArray.push(valueList.value.join(','))
93
+ break
94
+ default:
95
+ valueArray.push(defaultValue.value)
96
+ break
97
+ }
98
+ return valueArray.length > 0 ? valueArray.join('') : defaultValue.value
99
+ })
100
+ const parseValue = value => {
101
+ if (value === computeValue.value) {
102
+ return
103
+ }
104
+ try {
105
+ if (!value || value === defaultValue.value) {
106
+ type.value = TypeEnum.every
107
+ } else if (value.indexOf('?') >= 0) {
108
+ type.value = TypeEnum.unset
109
+ } else if (value.indexOf('-') >= 0) {
110
+ type.value = TypeEnum.range
111
+ const values = value.split('-')
112
+ if (values.length >= 2) {
113
+ valueRange.start = parseInt(values[0])
114
+ valueRange.end = parseInt(values[1])
115
+ }
116
+ } else if (value.indexOf('/') >= 0) {
117
+ type.value = TypeEnum.loop
118
+ const values = value.split('/')
119
+ if (values.length >= 2) {
120
+ valueLoop.start = value[0] === '*' ? 0 : parseInt(values[0])
121
+ valueLoop.interval = parseInt(values[1])
122
+ }
123
+ } else if (value.indexOf('W') >= 0) {
124
+ type.value = TypeEnum.work
125
+ const values = value.split('W')
126
+ if (!values[0] && !isNaN(values[0])) {
127
+ valueWork.value = parseInt(values[0])
128
+ }
129
+ } else if (value.indexOf('L') >= 0) {
130
+ type.value = TypeEnum.last
131
+ } else if (value.indexOf(',') >= 0 || !isNaN(value)) {
132
+ type.value = TypeEnum.specify
133
+ valueList.value = value.split(',').map(item => parseInt(item))
134
+ } else {
135
+ type.value = TypeEnum.every
136
+ }
137
+ } catch (e) {
138
+ type.value = TypeEnum.every
139
+ }
140
+ }
141
+ const updateValue = value => {
142
+ emit('change', value)
143
+ emit('update:modelValue', value)
144
+ }
145
+
146
+ watch(
147
+ () => props.modelValue,
148
+ val => {
149
+ if (val !== computeValue.value) {
150
+ parseValue(val)
151
+ }
152
+ },
153
+ { immediate: true }
154
+ )
155
+
156
+ watch(
157
+ () => computeValue.value,
158
+ val => {
159
+ updateValue(v)
160
+ }
161
+ )
162
+
163
+ return {
164
+ TypeEnum,
165
+ type,
166
+ valueRange,
167
+ valueLoop,
168
+ valueWork,
169
+ valueList,
170
+ specifyRange,
171
+ computeValue,
172
+ inputNumberAttrs,
173
+ beforeRadioAttrs,
174
+ typeRangeAttrs,
175
+ typeLoopAttrs,
176
+ typeSpecifyAttrs,
177
+ updateValue
178
+ }
179
+ }
@@ -1,99 +1,101 @@
1
- <template>
2
- <div class="sh-cron-config-list">
3
- <vxe-radio-group v-model="type">
4
- <div class="item">
5
- <vxe-radio :value="TypeEnum.unset" v-bind="beforeRadioAttrs">不设置</vxe-radio>
6
- <span class="tip-info">日和周只能设置其中之一</span>
7
- </div>
8
- <div class="item">
9
- <vxe-radio :label="TypeEnum.every" v-bind="beforeRadioAttrs">每日</vxe-radio>
10
- </div>
11
- <div class="item">
12
- <vxe-radio :label="TypeEnum.range" v-bind="beforeRadioAttrs">区间</vxe-radio>
13
- <span> 从 </span>
14
- <vxe-input v-model="valueRange.start" v-bind="typeRangeAttrs" />
15
- <span> 日 至 </span>
16
- <vxe-input v-model="valueRange.end" v-bind="typeRangeAttrs" />
17
- <span> 日 </span>
18
- </div>
19
- <div class="item">
20
- <vxe-radio :label="TypeEnum.loop" v-bind="beforeRadioAttrs">循环</vxe-radio>
21
- <span> 从 </span>
22
- <vxe-input v-model="valueLoop.start" v-bind="typeLoopAttrs" />
23
- <span> 日开始,间隔 </span>
24
- <vxe-input v-model="valueLoop.interval" v-bind="typeLoopAttrs" />
25
- <span> 日 </span>
26
- </div>
27
- <div class="item">
28
- <vxe-radio :label="TypeEnum.work" v-bind="beforeRadioAttrs">工作日</vxe-radio>
29
- <span> 本月 </span>
30
- <vxe-input v-model="valueWork" v-bind="typeWorkAttrs" />
31
- <span> 日,最近的工作日 </span>
32
- </div>
33
- <div class="item">
34
- <vxe-radio :label="TypeEnum.last" v-bind="beforeRadioAttrs">最后一日</vxe-radio>
35
- </div>
36
- <div class="item">
37
- <vxe-radio :label="TypeEnum.specify" v-bind="beforeRadioAttrs">指定</vxe-radio>
38
- <div class="list">
39
- <vxe-checkbox-group v-model="valueList">
40
- <template v-for="i in specifyRange" :key="i">
41
- <vxe-checkbox :label="i" v-bind="typeSpecifyAttrs">{{ i }}</vxe-checkbox>
42
- </template>
43
- </vxe-checkbox-group>
44
- </div>
45
- </div>
46
- </vxe-radio-group>
47
- </div>
48
- </template>
49
-
50
- <script>
51
- import { defineComponent, computed, getCurrentInstance, watch, emits } from 'vue'
52
- import cronProps from '../mixin/cron-props'
53
- import cronEmits from '../mixin/cron-emits'
54
- import cronHooks from '../mixin/cron-hooks'
55
- export default defineComponent({
56
- name: 'CronDayBox',
57
- props: {
58
- ...cronProps,
59
- week: {
60
- type: String,
61
- default: '?'
62
- }
63
- },
64
- emits: cronEmits,
65
- setup(props, context) {
66
- const { proxy } = getCurrentInstance()
67
- const { $vUtils } = proxy
68
- const { emit, slots } = context
69
-
70
- const useCron = cronHooks(props, context, proxy, {
71
- defaultValue: '*',
72
- minValue: 1,
73
- maxValue: 31,
74
- valueRange: { start: 1, end: 31 },
75
- valueLoop: { start: 1, interval: 1 }
76
- })
77
-
78
- const disabledChoice = computed(() => (props.week && props.week !== '?') || props.disabled)
79
- const typeWorkAttrs = computed(() => {
80
- return Object.assign(useCron.inputNumberAttrs, {
81
- disabled: useCron.type.value !== useCron.TypeEnum.work || props.disabled || disabledChoice.value
82
- })
83
- })
84
-
85
- watch(
86
- () => props.week,
87
- () => {
88
- useCron.updateValue(disabledChoice.value ? '?' : useCron.computeValue.value)
89
- }
90
- )
91
-
92
- return Object.assign({}, useCron, {
93
- typeWorkAttrs
94
- })
95
- }
96
- })
97
- </script>
98
-
99
- <style scoped></style>
1
+ <template>
2
+ <div class="sh-cron-config-list">
3
+ <vxe-radio-group v-model="type">
4
+ <div class="item">
5
+ <vxe-radio :value="TypeEnum.unset" v-bind="beforeRadioAttrs">不设置</vxe-radio>
6
+ <span class="tip-info">日和周只能设置其中之一</span>
7
+ </div>
8
+ <div class="item">
9
+ <vxe-radio :label="TypeEnum.every" v-bind="beforeRadioAttrs">每日</vxe-radio>
10
+ </div>
11
+ <div class="item">
12
+ <vxe-radio :label="TypeEnum.range" v-bind="beforeRadioAttrs">区间</vxe-radio>
13
+ <span> 从 </span>
14
+ <vxe-input v-model="valueRange.start" v-bind="typeRangeAttrs" />
15
+ <span> 日 至 </span>
16
+ <vxe-input v-model="valueRange.end" v-bind="typeRangeAttrs" />
17
+ <span> 日 </span>
18
+ </div>
19
+ <div class="item">
20
+ <vxe-radio :label="TypeEnum.loop" v-bind="beforeRadioAttrs">循环</vxe-radio>
21
+ <span> 从 </span>
22
+ <vxe-input v-model="valueLoop.start" v-bind="typeLoopAttrs" />
23
+ <span> 日开始,间隔 </span>
24
+ <vxe-input v-model="valueLoop.interval" v-bind="typeLoopAttrs" />
25
+ <span> 日 </span>
26
+ </div>
27
+ <div class="item">
28
+ <vxe-radio :label="TypeEnum.work" v-bind="beforeRadioAttrs">工作日</vxe-radio>
29
+ <span> 本月 </span>
30
+ <vxe-input v-model="valueWork" v-bind="typeWorkAttrs" />
31
+ <span> 日,最近的工作日 </span>
32
+ </div>
33
+ <div class="item">
34
+ <vxe-radio :label="TypeEnum.last" v-bind="beforeRadioAttrs">最后一日</vxe-radio>
35
+ </div>
36
+ <div class="item">
37
+ <vxe-radio :label="TypeEnum.specify" v-bind="beforeRadioAttrs">指定</vxe-radio>
38
+ <div class="list">
39
+ <vxe-checkbox-group v-model="valueList">
40
+ <template v-for="i in specifyRange" :key="i">
41
+ <vxe-checkbox :label="i" v-bind="typeSpecifyAttrs">{{ i }}</vxe-checkbox>
42
+ </template>
43
+ </vxe-checkbox-group>
44
+ </div>
45
+ </div>
46
+ </vxe-radio-group>
47
+ </div>
48
+ </template>
49
+
50
+ <script>
51
+ import { defineComponent, computed, getCurrentInstance, watch, emits } from 'vue'
52
+ import cronProps from '../mixin/cron-props'
53
+ import cronEmits from '../mixin/cron-emits'
54
+ import cronHooks from '../mixin/cron-hooks'
55
+ export default defineComponent({
56
+ name: 'CronDayBox',
57
+ props: {
58
+ ...cronProps,
59
+ week: {
60
+ type: String,
61
+ default: '?'
62
+ }
63
+ },
64
+ emits: cronEmits,
65
+ setup(props, context) {
66
+ const { proxy } = getCurrentInstance()
67
+ const { $vUtils } = proxy
68
+ const { emit, slots } = context
69
+
70
+ const useCron = cronHooks(props, context, proxy, {
71
+ defaultValue: '*',
72
+ minValue: 1,
73
+ maxValue: 31,
74
+ valueRange: { start: 1, end: 31 },
75
+ valueLoop: { start: 1, interval: 1 }
76
+ })
77
+
78
+ const disabledChoice = computed(() => (props.week && props.week !== '?') || props.disabled)
79
+ const typeWorkAttrs = computed(() => {
80
+ return {
81
+ ...useCron.inputNumberAttrs,
82
+ disabled: useCron.type.value !== useCron.TypeEnum.work || props.disabled || disabledChoice.value
83
+ }
84
+ })
85
+
86
+ watch(
87
+ () => props.week,
88
+ () => {
89
+ useCron.updateValue(disabledChoice.value ? '?' : useCron.computeValue.value)
90
+ }
91
+ )
92
+
93
+ return {
94
+ ...useCron,
95
+ typeWorkAttrs
96
+ }
97
+ }
98
+ })
99
+ </script>
100
+
101
+ <style scoped></style>