sh-view 2.6.2 → 2.6.3

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 (38) 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/table.vue +218 -217
  8. package/packages/components/other-components/sh-cron-modal/mixin/cron-hooks.js +179 -177
  9. package/packages/components/other-components/sh-cron-modal/tabs/cron-day-box.vue +101 -99
  10. package/packages/components/other-components/sh-cron-modal/tabs/cron-hour-box.vue +68 -66
  11. package/packages/components/other-components/sh-cron-modal/tabs/cron-minute-box.vue +68 -66
  12. package/packages/components/other-components/sh-cron-modal/tabs/cron-month-box.vue +68 -66
  13. package/packages/components/other-components/sh-cron-modal/tabs/cron-second-box.vue +68 -66
  14. package/packages/components/other-components/sh-cron-modal/tabs/cron-week-box.vue +126 -125
  15. package/packages/components/other-components/sh-cron-modal/tabs/cron-year-box.vue +59 -57
  16. package/packages/components/other-components/sh-preview/components/sh-excel.vue +929 -927
  17. package/packages/components/other-components/sh-preview/components/sh-word.vue +78 -76
  18. package/packages/vxeTable/render/cell/vxe-render-checkbox.vue +28 -26
  19. package/packages/vxeTable/render/cell/vxe-render-checkgroup.vue +43 -42
  20. package/packages/vxeTable/render/cell/vxe-render-code.vue +36 -34
  21. package/packages/vxeTable/render/cell/vxe-render-goption.vue +104 -103
  22. package/packages/vxeTable/render/cell/vxe-render-href.vue +21 -19
  23. package/packages/vxeTable/render/cell/vxe-render-input.vue +53 -52
  24. package/packages/vxeTable/render/cell/vxe-render-money.vue +33 -31
  25. package/packages/vxeTable/render/cell/vxe-render-progress.vue +28 -26
  26. package/packages/vxeTable/render/cell/vxe-render-radio.vue +28 -26
  27. package/packages/vxeTable/render/cell/vxe-render-radiogroup.vue +43 -42
  28. package/packages/vxeTable/render/cell/vxe-render-select.vue +52 -51
  29. package/packages/vxeTable/render/cell/vxe-render-switch.vue +28 -26
  30. package/packages/vxeTable/render/cell/vxe-render-table.vue +51 -50
  31. package/packages/vxeTable/render/cell/vxe-render-textarea.vue +28 -26
  32. package/packages/vxeTable/render/cell/vxe-render-time.vue +44 -41
  33. package/packages/vxeTable/render/cell/vxe-render-tree.vue +63 -60
  34. package/packages/vxeTable/render/cell/vxe-render-upload.vue +28 -26
  35. package/packages/vxeTable/render/filters/vxe-filter-input.vue +25 -23
  36. package/packages/vxeTable/render/footer/vxe-footer-input.vue +23 -21
  37. package/packages/vxeTable/render/footer/vxe-footer-money.vue +30 -28
  38. package/packages/vxeTable/render/header/vxe-header-money.vue +31 -29
@@ -1,217 +1,218 @@
1
- <template>
2
- <div ref="tableWrapRef" class="sh-vxe-table" :class="{ 'sh-table-ghost': tableGlobalConfig.ghost }" :style="{ height: wrapHeight }">
3
- <div v-if="isTopSlot" ref="topSlotRef" v-resize="handleResize" class="sh-table-top"><slot name="top"></slot></div>
4
- <div v-if="isFormSlot" ref="formSlotRef" v-resize="handleResize" class="sh-table-form">
5
- <slot name="form">
6
- <sh-query v-bind="tableQueryConfig" @submit="onFormSubmit" @reset="onFormReset" @collapsed="onFormCollapsed" @edit-closed="onFormEditClosed">
7
- <template #footLeft><slot name="formLeft"></slot></template>
8
- <template #footRight><slot name="formRight"></slot></template>
9
- </sh-query>
10
- </slot>
11
- </div>
12
- <div v-if="isToolbarSlot" ref="toolbarSlotRef" v-resize="handleResize" class="sh-table-toolbar">
13
- <slot name="toolbar">
14
- <div class="sh-table-toolbar-wrap">
15
- <div class="sh-table-toolbar-left">
16
- <div v-if="tableGlobalConfig.title" class="sh-table-toolbar-item">
17
- <h3 class="tableName">{{ tableGlobalConfig.tableName }}</h3>
18
- </div>
19
- <!--ps:全表搜索不支持反转-->
20
- <div v-if="tableGlobalConfig.globalFilter" class="sh-table-toolbar-item">
21
- <vxe-input v-model="tableFilterText" v-bind="tableFilterConfig" @blur="handleTableFilter" @clear="handleTableFilter" @search-click="handleTableFilter" />
22
- <span v-if="tableFilterData">
23
- 共搜索到 <strong>{{ tableFilterData.length }}</strong> 条数据
24
- </span>
25
- </div>
26
- <div v-if="slots.toolbarLeft" class="sh-table-toolbar-item">
27
- <slot name="toolbarLeft"></slot>
28
- </div>
29
- </div>
30
- <div class="sh-table-toolbar-right">
31
- <div v-if="slots.toolbarRight" class="sh-table-toolbar-item">
32
- <slot name="toolbarRight"></slot>
33
- </div>
34
- <template v-for="(tool, toolIndex) in tableTools" :key="toolIndex">
35
- <div class="sh-table-toolbar-item">
36
- <vxe-button v-ripple :size="size" v-bind="tool" @click="handleTableTool(tool)"></vxe-button>
37
- </div>
38
- </template>
39
- </div>
40
- </div>
41
- </slot>
42
- </div>
43
- <div v-if="isHeadSlot" ref="headSlotRef" v-resize="handleResize" class="sh-table-head"><slot name="head"></slot></div>
44
- <vxe-table
45
- :id="id"
46
- ref="tableRef"
47
- :key="renderKey"
48
- :class="{ 'is--hasfooter': showFooter }"
49
- v-bind="tableBindConfig"
50
- :height="tableHeight"
51
- @current-change="onCurrentChange"
52
- @radio-change="onRadioChange"
53
- @checkbox-change="onSelectionChange"
54
- @checkbox-all="onSelectionChange"
55
- @checkbox-range-end="onSelectionChange"
56
- @cell-click="onCellClick"
57
- @cell-dblclick="onCellDblClick"
58
- @header-cell-click="onHeaderCellClick"
59
- @sort-change="onSortChange"
60
- @filter-change="onFilterChange"
61
- @toggle-row-expand="onToggleRowExpand"
62
- @toggle-tree-expand="onToggleTreeExpand"
63
- @edit-closed="onEditClosed"
64
- @edit-actived="onEditActived"
65
- @scroll="onScroll"
66
- @custom="onCustom"
67
- @toolbar-button-click="onToolbarButtonClick"
68
- @toolbar-tool-click="onToolbarToolClick"
69
- @option-click="handleGoptionClick">
70
- <template v-if="customLayout">
71
- <slot></slot>
72
- </template>
73
- <template v-else>
74
- <template v-for="(column, columnIndex) in tablePrevColumns" :key="columnIndex">
75
- <vxe-column v-bind="column"></vxe-column>
76
- </template>
77
- <template v-for="(column, columnIndex) in columns" :key="columnIndex">
78
- <sh-column :column="column"></sh-column>
79
- </template>
80
- </template>
81
- <template #empty>
82
- <sh-empty :icon="emptyIcon" :content="emptyText"></sh-empty>
83
- </template>
84
- </vxe-table>
85
- <div v-if="isFootSlot" ref="footSlotRef" v-resize="handleResize" class="sh-table-foot"><slot name="foot"></slot></div>
86
- <div v-if="isPagerSlot" ref="pagerSlotRef" v-resize="handleResize" class="sh-table-pager">
87
- <vxe-pager ref="pagerSlotRef" v-bind="tablePagerConfig" @page-change="onPageChange">
88
- <template #pagerLeft>
89
- <div v-if="selectionRows.length" class="sh-table-footer-info">
90
- 已选择 <strong>{{ selectionRows.length }}</strong> 项
91
- </div>
92
- <slot name="pagerLeft"></slot>
93
- </template>
94
- <template #pagerRight>
95
- <slot name="pagerRight"></slot>
96
- </template>
97
- </vxe-pager>
98
- </div>
99
- <div v-if="isBottomSlot" ref="bottomSlotRef" v-resize="handleResize" class="sh-table-bottom"><slot name="bottom"></slot></div>
100
- <!--导入弹窗-->
101
- <importModal v-if="importBindConfig.modalConfig.modelValue" v-bind="importBindConfig" @confirm="setImportData"></importModal>
102
- </div>
103
- </template>
104
-
105
- <script>
106
- import { computed, defineComponent, getCurrentInstance, provide, ref, reactive } from 'vue'
107
- import './css/index.scss'
108
-
109
- import props from './js/props'
110
- import shColumn from './components/sh-column.vue'
111
- import importModal from './components/importModal.vue'
112
- import useTable from './js/useTable'
113
- import { turnColumnItemFilters } from './js/tableMethods'
114
- export default defineComponent({
115
- name: 'ShTable',
116
- components: {
117
- shColumn,
118
- importModal
119
- },
120
- props: {
121
- ...props
122
- },
123
- emits: [
124
- 'current-change',
125
- 'radio-change',
126
- 'selection-change',
127
- 'cell-click',
128
- 'cell-dblclick',
129
- 'header-cell-click',
130
- 'sort-change',
131
- 'filter-change',
132
- 'toggle-row-expand',
133
- 'toggle-tree-expand',
134
- 'edit-closed',
135
- 'edit-actived',
136
- 'scroll',
137
- 'custom',
138
- 'page-change',
139
- 'toolbar-button-click',
140
- 'toolbar-tool-click',
141
-
142
- 'form-submit',
143
- 'form-reset',
144
- 'form-edit-closed',
145
- 'form-submit-invalid',
146
- 'import-confirm',
147
- 'globaloption',
148
- 'toolbaroption'
149
- ],
150
- setup(props, context) {
151
- const { proxy } = getCurrentInstance()
152
- const { emit, slots } = context
153
- const tableWrapRef = ref()
154
- const topSlotRef = ref()
155
- const formSlotRef = ref()
156
- const toolbarSlotRef = ref()
157
- const headSlotRef = ref()
158
- const footSlotRef = ref()
159
- const pagerSlotRef = ref()
160
- const bottomSlotRef = ref()
161
- const tableHeight = ref(props.height)
162
-
163
- const useTableHooks = useTable(props, context, proxy)
164
-
165
- const isTopSlot = computed(() => Boolean(slots.top))
166
- const isFormSlot = computed(() => useTableHooks.tableGlobalConfig.value.search || Boolean(slots.form))
167
- const isToolbarSlot = computed(() => {
168
- const { title, globalFilter } = useTableHooks.tableGlobalConfig.value
169
- return title || globalFilter || slots.toolbar || slots.toolbarLeft || slots.toolbarRight || useTableHooks.tableTools.value.length
170
- })
171
- const isHeadSlot = computed(() => Boolean(slots.head))
172
- const isFootSlot = computed(() => Boolean(slots.foot))
173
- const isPagerSlot = computed(() => useTableHooks.tablePagerConfig.value.enabled)
174
- const isBottomSlot = computed(() => Boolean(slots.bottom))
175
-
176
- provide(
177
- 'ShTableInstance',
178
- reactive({
179
- columnObjConfig: useTableHooks.tableColumnObjConfig,
180
- turnColumnItemFilters: useTableHooks.turnColumnItemFilters,
181
- slots: useTableHooks.slots
182
- })
183
- )
184
-
185
- const handleResize = e => {
186
- if (useTableHooks.wrapHeight.value === 'auto') return
187
- let slotRefs = [topSlotRef, formSlotRef, toolbarSlotRef, headSlotRef, footSlotRef, pagerSlotRef, bottomSlotRef]
188
- let otherHeight = 0
189
- let parentHeight = tableWrapRef.value?.offsetHeight
190
- slotRefs.forEach(slotRef => {
191
- otherHeight += slotRef.value?.offsetHeight || 0
192
- })
193
- tableHeight.value = parentHeight - otherHeight
194
- }
195
-
196
- return Object.assign({}, useTableHooks, {
197
- tableWrapRef,
198
- topSlotRef,
199
- formSlotRef,
200
- toolbarSlotRef,
201
- headSlotRef,
202
- footSlotRef,
203
- pagerSlotRef,
204
- bottomSlotRef,
205
- tableHeight,
206
- isTopSlot,
207
- isFormSlot,
208
- isToolbarSlot,
209
- isHeadSlot,
210
- isFootSlot,
211
- isPagerSlot,
212
- isBottomSlot,
213
- handleResize
214
- })
215
- }
216
- })
217
- </script>
1
+ <template>
2
+ <div ref="tableWrapRef" class="sh-vxe-table" :class="{ 'sh-table-ghost': tableGlobalConfig.ghost }" :style="{ height: wrapHeight }">
3
+ <div v-if="isTopSlot" ref="topSlotRef" v-resize="handleResize" class="sh-table-top"><slot name="top"></slot></div>
4
+ <div v-if="isFormSlot" ref="formSlotRef" v-resize="handleResize" class="sh-table-form">
5
+ <slot name="form">
6
+ <sh-query v-bind="tableQueryConfig" @submit="onFormSubmit" @reset="onFormReset" @collapsed="onFormCollapsed" @edit-closed="onFormEditClosed">
7
+ <template #footLeft><slot name="formLeft"></slot></template>
8
+ <template #footRight><slot name="formRight"></slot></template>
9
+ </sh-query>
10
+ </slot>
11
+ </div>
12
+ <div v-if="isToolbarSlot" ref="toolbarSlotRef" v-resize="handleResize" class="sh-table-toolbar">
13
+ <slot name="toolbar">
14
+ <div class="sh-table-toolbar-wrap">
15
+ <div class="sh-table-toolbar-left">
16
+ <div v-if="tableGlobalConfig.title" class="sh-table-toolbar-item">
17
+ <h3 class="tableName">{{ tableGlobalConfig.tableName }}</h3>
18
+ </div>
19
+ <!--ps:全表搜索不支持反转-->
20
+ <div v-if="tableGlobalConfig.globalFilter" class="sh-table-toolbar-item">
21
+ <vxe-input v-model="tableFilterText" v-bind="tableFilterConfig" @blur="handleTableFilter" @clear="handleTableFilter" @search-click="handleTableFilter" />
22
+ <span v-if="tableFilterData">
23
+ 共搜索到 <strong>{{ tableFilterData.length }}</strong> 条数据
24
+ </span>
25
+ </div>
26
+ <div v-if="slots.toolbarLeft" class="sh-table-toolbar-item">
27
+ <slot name="toolbarLeft"></slot>
28
+ </div>
29
+ </div>
30
+ <div class="sh-table-toolbar-right">
31
+ <div v-if="slots.toolbarRight" class="sh-table-toolbar-item">
32
+ <slot name="toolbarRight"></slot>
33
+ </div>
34
+ <template v-for="(tool, toolIndex) in tableTools" :key="toolIndex">
35
+ <div class="sh-table-toolbar-item">
36
+ <vxe-button v-ripple :size="size" v-bind="tool" @click="handleTableTool(tool)"></vxe-button>
37
+ </div>
38
+ </template>
39
+ </div>
40
+ </div>
41
+ </slot>
42
+ </div>
43
+ <div v-if="isHeadSlot" ref="headSlotRef" v-resize="handleResize" class="sh-table-head"><slot name="head"></slot></div>
44
+ <vxe-table
45
+ :id="id"
46
+ ref="tableRef"
47
+ :key="renderKey"
48
+ :class="{ 'is--hasfooter': showFooter }"
49
+ v-bind="tableBindConfig"
50
+ :height="tableHeight"
51
+ @current-change="onCurrentChange"
52
+ @radio-change="onRadioChange"
53
+ @checkbox-change="onSelectionChange"
54
+ @checkbox-all="onSelectionChange"
55
+ @checkbox-range-end="onSelectionChange"
56
+ @cell-click="onCellClick"
57
+ @cell-dblclick="onCellDblClick"
58
+ @header-cell-click="onHeaderCellClick"
59
+ @sort-change="onSortChange"
60
+ @filter-change="onFilterChange"
61
+ @toggle-row-expand="onToggleRowExpand"
62
+ @toggle-tree-expand="onToggleTreeExpand"
63
+ @edit-closed="onEditClosed"
64
+ @edit-actived="onEditActived"
65
+ @scroll="onScroll"
66
+ @custom="onCustom"
67
+ @toolbar-button-click="onToolbarButtonClick"
68
+ @toolbar-tool-click="onToolbarToolClick"
69
+ @option-click="handleGoptionClick">
70
+ <template v-if="customLayout">
71
+ <slot></slot>
72
+ </template>
73
+ <template v-else>
74
+ <template v-for="(column, columnIndex) in tablePrevColumns" :key="columnIndex">
75
+ <vxe-column v-bind="column"></vxe-column>
76
+ </template>
77
+ <template v-for="(column, columnIndex) in columns" :key="columnIndex">
78
+ <sh-column :column="column"></sh-column>
79
+ </template>
80
+ </template>
81
+ <template #empty>
82
+ <sh-empty :icon="emptyIcon" :content="emptyText"></sh-empty>
83
+ </template>
84
+ </vxe-table>
85
+ <div v-if="isFootSlot" ref="footSlotRef" v-resize="handleResize" class="sh-table-foot"><slot name="foot"></slot></div>
86
+ <div v-if="isPagerSlot" ref="pagerSlotRef" v-resize="handleResize" class="sh-table-pager">
87
+ <vxe-pager ref="pagerSlotRef" v-bind="tablePagerConfig" @page-change="onPageChange">
88
+ <template #pagerLeft>
89
+ <div v-if="selectionRows.length" class="sh-table-footer-info">
90
+ 已选择 <strong>{{ selectionRows.length }}</strong> 项
91
+ </div>
92
+ <slot name="pagerLeft"></slot>
93
+ </template>
94
+ <template #pagerRight>
95
+ <slot name="pagerRight"></slot>
96
+ </template>
97
+ </vxe-pager>
98
+ </div>
99
+ <div v-if="isBottomSlot" ref="bottomSlotRef" v-resize="handleResize" class="sh-table-bottom"><slot name="bottom"></slot></div>
100
+ <!--导入弹窗-->
101
+ <importModal v-if="importBindConfig.modalConfig.modelValue" v-bind="importBindConfig" @confirm="setImportData"></importModal>
102
+ </div>
103
+ </template>
104
+
105
+ <script>
106
+ import { computed, defineComponent, getCurrentInstance, provide, ref, reactive } from 'vue'
107
+ import './css/index.scss'
108
+
109
+ import props from './js/props'
110
+ import shColumn from './components/sh-column.vue'
111
+ import importModal from './components/importModal.vue'
112
+ import useTable from './js/useTable'
113
+ import { turnColumnItemFilters } from './js/tableMethods'
114
+ export default defineComponent({
115
+ name: 'ShTable',
116
+ components: {
117
+ shColumn,
118
+ importModal
119
+ },
120
+ props: {
121
+ ...props
122
+ },
123
+ emits: [
124
+ 'current-change',
125
+ 'radio-change',
126
+ 'selection-change',
127
+ 'cell-click',
128
+ 'cell-dblclick',
129
+ 'header-cell-click',
130
+ 'sort-change',
131
+ 'filter-change',
132
+ 'toggle-row-expand',
133
+ 'toggle-tree-expand',
134
+ 'edit-closed',
135
+ 'edit-actived',
136
+ 'scroll',
137
+ 'custom',
138
+ 'page-change',
139
+ 'toolbar-button-click',
140
+ 'toolbar-tool-click',
141
+
142
+ 'form-submit',
143
+ 'form-reset',
144
+ 'form-edit-closed',
145
+ 'form-submit-invalid',
146
+ 'import-confirm',
147
+ 'globaloption',
148
+ 'toolbaroption'
149
+ ],
150
+ setup(props, context) {
151
+ const { proxy } = getCurrentInstance()
152
+ const { emit, slots } = context
153
+ const tableWrapRef = ref()
154
+ const topSlotRef = ref()
155
+ const formSlotRef = ref()
156
+ const toolbarSlotRef = ref()
157
+ const headSlotRef = ref()
158
+ const footSlotRef = ref()
159
+ const pagerSlotRef = ref()
160
+ const bottomSlotRef = ref()
161
+ const tableHeight = ref(props.height)
162
+
163
+ const useTableHooks = useTable(props, context, proxy)
164
+
165
+ const isTopSlot = computed(() => Boolean(slots.top))
166
+ const isFormSlot = computed(() => useTableHooks.tableGlobalConfig.value.search || Boolean(slots.form))
167
+ const isToolbarSlot = computed(() => {
168
+ const { title, globalFilter } = useTableHooks.tableGlobalConfig.value
169
+ return title || globalFilter || slots.toolbar || slots.toolbarLeft || slots.toolbarRight || useTableHooks.tableTools.value.length
170
+ })
171
+ const isHeadSlot = computed(() => Boolean(slots.head))
172
+ const isFootSlot = computed(() => Boolean(slots.foot))
173
+ const isPagerSlot = computed(() => useTableHooks.tablePagerConfig.value.enabled)
174
+ const isBottomSlot = computed(() => Boolean(slots.bottom))
175
+
176
+ provide(
177
+ 'ShTableInstance',
178
+ reactive({
179
+ columnObjConfig: useTableHooks.tableColumnObjConfig,
180
+ turnColumnItemFilters: useTableHooks.turnColumnItemFilters,
181
+ slots: useTableHooks.slots
182
+ })
183
+ )
184
+
185
+ const handleResize = e => {
186
+ if (useTableHooks.wrapHeight.value === 'auto') return
187
+ let slotRefs = [topSlotRef, formSlotRef, toolbarSlotRef, headSlotRef, footSlotRef, pagerSlotRef, bottomSlotRef]
188
+ let otherHeight = 0
189
+ let parentHeight = tableWrapRef.value?.offsetHeight
190
+ slotRefs.forEach(slotRef => {
191
+ otherHeight += slotRef.value?.offsetHeight || 0
192
+ })
193
+ tableHeight.value = parentHeight - otherHeight
194
+ }
195
+
196
+ return {
197
+ ...useTableHooks,
198
+ tableWrapRef,
199
+ topSlotRef,
200
+ formSlotRef,
201
+ toolbarSlotRef,
202
+ headSlotRef,
203
+ footSlotRef,
204
+ pagerSlotRef,
205
+ bottomSlotRef,
206
+ tableHeight,
207
+ isTopSlot,
208
+ isFormSlot,
209
+ isToolbarSlot,
210
+ isHeadSlot,
211
+ isFootSlot,
212
+ isPagerSlot,
213
+ isBottomSlot,
214
+ handleResize
215
+ }
216
+ }
217
+ })
218
+ </script>