@ctzy-web-client/plugin-component-vue 1.0.51 → 1.0.53
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/es/data-table/data-table.mjs +3 -59
- package/es/datatable-settings/datatable-settings.mjs +1 -0
- package/es/index.css +1 -0
- package/lib/data-table/data-table.js +2 -58
- package/lib/datatable-settings/datatable-settings.js +1 -0
- package/lib/index.css +1 -0
- package/package.json +1 -1
- package/src/data-table/data-table.vue +4 -67
- package/src/datatable-settings/datatable-settings.vue +1 -1
- package/es/make-installer.css +0 -1
- package/lib/make-installer.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, useAttrs, ref, computed,
|
|
1
|
+
import { defineComponent, useAttrs, ref, computed, unref, watch, provide, reactive, nextTick, onUnmounted, openBlock, createElementBlock, normalizeClass, normalizeStyle, renderSlot, createVNode, mergeProps, withCtx, createBlock, createElementVNode, createCommentVNode, Fragment, renderList, createTextVNode, toDisplayString } from 'vue';
|
|
2
2
|
import { ElMessage, ElTable, ElTableColumn, ElPagination } from 'element-plus';
|
|
3
3
|
import { useService, useGlobalConfig, dataTableKey, useNamespace, useEventDispatcher } from '@ctzy-web-client/web-base-client-vue';
|
|
4
4
|
import DynamicComponent from './dynamic-component.mjs';
|
|
@@ -81,60 +81,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
81
81
|
const dataTable = props.dataTable;
|
|
82
82
|
dataTable._userService = (_a = userService.value) == null ? void 0 : _a.getUserList;
|
|
83
83
|
const dataTableEl = ref(null);
|
|
84
|
-
const realHeight = computed(() =>
|
|
85
|
-
if (props.height !== "auto") {
|
|
86
|
-
return props.height;
|
|
87
|
-
}
|
|
88
|
-
return tableAutoHeight.value;
|
|
89
|
-
});
|
|
90
|
-
const maxHeight = ref(0);
|
|
91
|
-
const maxHeightNumber = ref(0);
|
|
92
|
-
function updateMaxHeight(list) {
|
|
93
|
-
nextTick(() => {
|
|
94
|
-
if (!elTable.value)
|
|
95
|
-
return;
|
|
96
|
-
let h = (list == null ? void 0 : list.length) ? list.length * 40 : void 0;
|
|
97
|
-
maxHeightNumber.value = h;
|
|
98
|
-
if (h) {
|
|
99
|
-
elTable.value.$el.style.maxHeight = h + "px";
|
|
100
|
-
} else {
|
|
101
|
-
elTable.value.$el.style.maxHeight = "";
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
const tableAutoHeight = ref(300);
|
|
106
|
-
const PAGINATION_HEIGHT = 160;
|
|
107
|
-
function calcTableHeight() {
|
|
108
|
-
nextTick(() => {
|
|
109
|
-
if (!dataTableEl.value)
|
|
110
|
-
return;
|
|
111
|
-
const top = dataTableEl.value.offsetTop;
|
|
112
|
-
const viewHeight = window.innerHeight;
|
|
113
|
-
const height = viewHeight - top - PAGINATION_HEIGHT - 40;
|
|
114
|
-
console.log(height);
|
|
115
|
-
tableAutoHeight.value = Math.max(height, 100);
|
|
116
|
-
elTable.value.$el.style.maxHeight = tableAutoHeight.value + "px";
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
let resizeTimer = null;
|
|
120
|
-
function watchResize() {
|
|
121
|
-
clearTimeout(resizeTimer);
|
|
122
|
-
resizeTimer = setTimeout(calcTableHeight, 100);
|
|
123
|
-
}
|
|
124
|
-
onMounted(() => {
|
|
125
|
-
calcTableHeight();
|
|
126
|
-
window.addEventListener("resize", watchResize);
|
|
127
|
-
nextTick(() => {
|
|
128
|
-
var _a2;
|
|
129
|
-
if ((_a2 = props.dataTable.data) == null ? void 0 : _a2.length) {
|
|
130
|
-
updateMaxHeight(props.dataTable.data);
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
onBeforeUnmount(() => {
|
|
135
|
-
window.removeEventListener("resize", watchResize);
|
|
136
|
-
clearTimeout(resizeTimer);
|
|
137
|
-
});
|
|
84
|
+
const realHeight = computed(() => props.height);
|
|
138
85
|
const displayColumns = computed(
|
|
139
86
|
() => unref(dataTable).getDisplayColumns() || []
|
|
140
87
|
);
|
|
@@ -170,7 +117,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
170
117
|
if (res.code != 0) {
|
|
171
118
|
return;
|
|
172
119
|
}
|
|
173
|
-
updateMaxHeight(res.data);
|
|
174
120
|
const _userService = unref(userService);
|
|
175
121
|
if (!_userService) {
|
|
176
122
|
return;
|
|
@@ -236,7 +182,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
236
182
|
if (res.code != 0) {
|
|
237
183
|
ElMessage.error(res.msg);
|
|
238
184
|
}
|
|
239
|
-
updateMaxHeight(res.data);
|
|
240
185
|
});
|
|
241
186
|
function sortColumn(array) {
|
|
242
187
|
array.forEach((item) => {
|
|
@@ -331,7 +276,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
331
276
|
createVNode(unref(ElTable), mergeProps({
|
|
332
277
|
class: "content",
|
|
333
278
|
height: realHeight.value,
|
|
334
|
-
"max-height": maxHeight.value,
|
|
335
279
|
ref_key: "elTable",
|
|
336
280
|
ref: elTable,
|
|
337
281
|
data: data.value,
|
|
@@ -419,7 +363,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
419
363
|
renderSlot(_ctx.$slots, "column-append")
|
|
420
364
|
]),
|
|
421
365
|
_: 3
|
|
422
|
-
}, 16, ["height", "
|
|
366
|
+
}, 16, ["height", "data", "row-key", "onSelectionChange", "border"])
|
|
423
367
|
]),
|
|
424
368
|
__props.showPagination ? (openBlock(), createElementBlock("div", {
|
|
425
369
|
key: 0,
|
|
@@ -318,6 +318,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
318
318
|
createVNode(unref(ElSwitch), {
|
|
319
319
|
modelValue: column.visible,
|
|
320
320
|
"onUpdate:modelValue": ($event) => column.visible = $event,
|
|
321
|
+
size: "small",
|
|
321
322
|
disabled: column.settings.disabled,
|
|
322
323
|
onChange: (val) => handleColumnVisibleChange(column, val)
|
|
323
324
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "onChange"])
|
package/es/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.letter-circle[data-v-9ba46efc]{font-size:14px;height:24px;margin-right:8px;width:24px}.letter-circle[data-v-9ba46efc],.letter-circle[data-v-c1065f11]{align-items:center;border-radius:50%;color:#fff;display:flex;justify-content:center}.letter-circle[data-v-c1065f11]{flex-shrink:0;font-size:12px;height:22px;width:22px}.option-container[data-v-c1065f11]{align-items:center;display:flex;width:100%}.option-text[data-v-c1065f11]{flex:1;margin-left:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pct-select-ellipsis .el-select-dropdown__item{box-sizing:border-box!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;width:100%!important}
|
|
@@ -85,60 +85,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
85
85
|
const dataTable = props.dataTable;
|
|
86
86
|
dataTable._userService = (_a = userService.value) == null ? void 0 : _a.getUserList;
|
|
87
87
|
const dataTableEl = vue.ref(null);
|
|
88
|
-
const realHeight = vue.computed(() =>
|
|
89
|
-
if (props.height !== "auto") {
|
|
90
|
-
return props.height;
|
|
91
|
-
}
|
|
92
|
-
return tableAutoHeight.value;
|
|
93
|
-
});
|
|
94
|
-
const maxHeight = vue.ref(0);
|
|
95
|
-
const maxHeightNumber = vue.ref(0);
|
|
96
|
-
function updateMaxHeight(list) {
|
|
97
|
-
vue.nextTick(() => {
|
|
98
|
-
if (!elTable.value)
|
|
99
|
-
return;
|
|
100
|
-
let h = (list == null ? void 0 : list.length) ? list.length * 40 : void 0;
|
|
101
|
-
maxHeightNumber.value = h;
|
|
102
|
-
if (h) {
|
|
103
|
-
elTable.value.$el.style.maxHeight = h + "px";
|
|
104
|
-
} else {
|
|
105
|
-
elTable.value.$el.style.maxHeight = "";
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
const tableAutoHeight = vue.ref(300);
|
|
110
|
-
const PAGINATION_HEIGHT = 160;
|
|
111
|
-
function calcTableHeight() {
|
|
112
|
-
vue.nextTick(() => {
|
|
113
|
-
if (!dataTableEl.value)
|
|
114
|
-
return;
|
|
115
|
-
const top = dataTableEl.value.offsetTop;
|
|
116
|
-
const viewHeight = window.innerHeight;
|
|
117
|
-
const height = viewHeight - top - PAGINATION_HEIGHT - 40;
|
|
118
|
-
console.log(height);
|
|
119
|
-
tableAutoHeight.value = Math.max(height, 100);
|
|
120
|
-
elTable.value.$el.style.maxHeight = tableAutoHeight.value + "px";
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
let resizeTimer = null;
|
|
124
|
-
function watchResize() {
|
|
125
|
-
clearTimeout(resizeTimer);
|
|
126
|
-
resizeTimer = setTimeout(calcTableHeight, 100);
|
|
127
|
-
}
|
|
128
|
-
vue.onMounted(() => {
|
|
129
|
-
calcTableHeight();
|
|
130
|
-
window.addEventListener("resize", watchResize);
|
|
131
|
-
vue.nextTick(() => {
|
|
132
|
-
var _a2;
|
|
133
|
-
if ((_a2 = props.dataTable.data) == null ? void 0 : _a2.length) {
|
|
134
|
-
updateMaxHeight(props.dataTable.data);
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
vue.onBeforeUnmount(() => {
|
|
139
|
-
window.removeEventListener("resize", watchResize);
|
|
140
|
-
clearTimeout(resizeTimer);
|
|
141
|
-
});
|
|
88
|
+
const realHeight = vue.computed(() => props.height);
|
|
142
89
|
const displayColumns = vue.computed(
|
|
143
90
|
() => vue.unref(dataTable).getDisplayColumns() || []
|
|
144
91
|
);
|
|
@@ -174,7 +121,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
174
121
|
if (res.code != 0) {
|
|
175
122
|
return;
|
|
176
123
|
}
|
|
177
|
-
updateMaxHeight(res.data);
|
|
178
124
|
const _userService = vue.unref(userService);
|
|
179
125
|
if (!_userService) {
|
|
180
126
|
return;
|
|
@@ -240,7 +186,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
240
186
|
if (res.code != 0) {
|
|
241
187
|
ElementPlus.ElMessage.error(res.msg);
|
|
242
188
|
}
|
|
243
|
-
updateMaxHeight(res.data);
|
|
244
189
|
});
|
|
245
190
|
function sortColumn(array) {
|
|
246
191
|
array.forEach((item) => {
|
|
@@ -335,7 +280,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
335
280
|
vue.createVNode(vue.unref(ElementPlus.ElTable), vue.mergeProps({
|
|
336
281
|
class: "content",
|
|
337
282
|
height: realHeight.value,
|
|
338
|
-
"max-height": maxHeight.value,
|
|
339
283
|
ref_key: "elTable",
|
|
340
284
|
ref: elTable,
|
|
341
285
|
data: data.value,
|
|
@@ -423,7 +367,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
423
367
|
vue.renderSlot(_ctx.$slots, "column-append")
|
|
424
368
|
]),
|
|
425
369
|
_: 3
|
|
426
|
-
}, 16, ["height", "
|
|
370
|
+
}, 16, ["height", "data", "row-key", "onSelectionChange", "border"])
|
|
427
371
|
]),
|
|
428
372
|
__props.showPagination ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
429
373
|
key: 0,
|
|
@@ -322,6 +322,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
322
322
|
vue.createVNode(vue.unref(ElementPlus.ElSwitch), {
|
|
323
323
|
modelValue: column.visible,
|
|
324
324
|
"onUpdate:modelValue": ($event) => column.visible = $event,
|
|
325
|
+
size: "small",
|
|
325
326
|
disabled: column.settings.disabled,
|
|
326
327
|
onChange: (val) => handleColumnVisibleChange(column, val)
|
|
327
328
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "onChange"])
|
package/lib/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.letter-circle[data-v-9ba46efc]{font-size:14px;height:24px;margin-right:8px;width:24px}.letter-circle[data-v-9ba46efc],.letter-circle[data-v-c1065f11]{align-items:center;border-radius:50%;color:#fff;display:flex;justify-content:center}.letter-circle[data-v-c1065f11]{flex-shrink:0;font-size:12px;height:22px;width:22px}.option-container[data-v-c1065f11]{align-items:center;display:flex;width:100%}.option-text[data-v-c1065f11]{flex:1;margin-left:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pct-select-ellipsis .el-select-dropdown__item{box-sizing:border-box!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;width:100%!important}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<ElTable
|
|
6
6
|
class="content"
|
|
7
7
|
:height="realHeight"
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
ref="elTable"
|
|
10
10
|
:data="data"
|
|
11
11
|
:row-key="dataTable.primaryKey"
|
|
@@ -204,71 +204,8 @@ dataTable._userService = userService.value?.getUserList
|
|
|
204
204
|
|
|
205
205
|
const dataTableEl = ref(null);
|
|
206
206
|
// const realHeight = computed(() => props.height)
|
|
207
|
-
const realHeight = computed(() =>
|
|
208
|
-
// 如果用户传了 height,就用用户的
|
|
209
|
-
if (props.height !== 'auto') {
|
|
210
|
-
return props.height
|
|
211
|
-
}
|
|
212
|
-
// 否则自动计算表格高度
|
|
213
|
-
return tableAutoHeight.value
|
|
214
|
-
})
|
|
215
|
-
const maxHeight = ref(0)
|
|
216
|
-
const maxHeightNumber = ref(0)
|
|
217
|
-
// 计算最大高度
|
|
218
|
-
function updateMaxHeight(list) {
|
|
219
|
-
nextTick(()=>{
|
|
220
|
-
if(!elTable.value) return
|
|
221
|
-
let h = list?.length ? list.length * 40 : undefined
|
|
222
|
-
maxHeightNumber.value = h
|
|
223
|
-
if(h){
|
|
224
|
-
elTable.value.$el.style.maxHeight = h + 'px'
|
|
225
|
-
}else{
|
|
226
|
-
elTable.value.$el.style.maxHeight = ''
|
|
227
|
-
}
|
|
228
|
-
})
|
|
229
|
-
}
|
|
230
|
-
// ====================
|
|
231
|
-
// 自动高度计算(react-base-table 同款逻辑)
|
|
232
|
-
// ====================
|
|
233
|
-
const tableAutoHeight = ref(300)
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
// 分页高度(固定,根据你的样式调整)
|
|
237
|
-
const PAGINATION_HEIGHT = 160
|
|
238
|
-
|
|
239
|
-
// 计算表格高度 = 屏幕高度 - 自身offsetTop高度 - 分页高度
|
|
240
|
-
function calcTableHeight() {
|
|
241
|
-
nextTick(() => {
|
|
242
|
-
if (!dataTableEl.value) return
|
|
243
|
-
const top = dataTableEl.value.offsetTop // 自动获取顶部距离
|
|
244
|
-
const viewHeight = window.innerHeight
|
|
245
|
-
const height = viewHeight - top - PAGINATION_HEIGHT-40
|
|
246
|
-
console.log(height)
|
|
247
|
-
tableAutoHeight.value = Math.max(height, 100) // 最小200px
|
|
248
|
-
elTable.value.$el.style.maxHeight = tableAutoHeight.value + 'px'
|
|
249
|
-
})
|
|
250
|
-
}
|
|
207
|
+
const realHeight = computed(() => props.height)
|
|
251
208
|
|
|
252
|
-
// 防抖监听窗口缩放
|
|
253
|
-
let resizeTimer = null
|
|
254
|
-
function watchResize() {
|
|
255
|
-
clearTimeout(resizeTimer)
|
|
256
|
-
resizeTimer = setTimeout(calcTableHeight, 100)
|
|
257
|
-
}
|
|
258
|
-
onMounted(() => {
|
|
259
|
-
calcTableHeight()
|
|
260
|
-
window.addEventListener('resize', watchResize)
|
|
261
|
-
nextTick(()=>{
|
|
262
|
-
if(props.dataTable.data?.length){
|
|
263
|
-
updateMaxHeight(props.dataTable.data)
|
|
264
|
-
}
|
|
265
|
-
})
|
|
266
|
-
})
|
|
267
|
-
|
|
268
|
-
onBeforeUnmount(() => {
|
|
269
|
-
window.removeEventListener('resize', watchResize)
|
|
270
|
-
clearTimeout(resizeTimer)
|
|
271
|
-
})
|
|
272
209
|
|
|
273
210
|
const displayColumns = computed(
|
|
274
211
|
() => unref(dataTable).getDisplayColumns() || []
|
|
@@ -316,7 +253,7 @@ useEventDispatcher(dataTable, 'load-successfully', async (res) => {
|
|
|
316
253
|
if (res.code != 0) {
|
|
317
254
|
return;
|
|
318
255
|
}
|
|
319
|
-
|
|
256
|
+
|
|
320
257
|
const _userService = unref(userService);
|
|
321
258
|
|
|
322
259
|
if (!_userService) {
|
|
@@ -410,7 +347,7 @@ useEventDispatcher(dataTable, 'load-successfully', (res) => {
|
|
|
410
347
|
if (res.code != 0) {
|
|
411
348
|
ElMessage.error(res.msg);
|
|
412
349
|
}
|
|
413
|
-
|
|
350
|
+
|
|
414
351
|
});
|
|
415
352
|
|
|
416
353
|
function sortColumn(array) {
|
package/es/make-installer.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.letter-circle[data-v-9ba46efc]{align-items:center;border-radius:50%;color:#fff;display:flex;font-size:14px;height:24px;justify-content:center;margin-right:8px;width:24px}.pct-select-ellipsis .el-select-dropdown__item{box-sizing:border-box!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;width:100%!important}.letter-circle[data-v-c1065f11]{align-items:center;border-radius:50%;color:#fff;display:flex;flex-shrink:0;font-size:12px;height:22px;justify-content:center;width:22px}.option-container[data-v-c1065f11]{align-items:center;display:flex;width:100%}.option-text[data-v-c1065f11]{flex:1;margin-left:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
package/lib/make-installer.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.letter-circle[data-v-9ba46efc]{align-items:center;border-radius:50%;color:#fff;display:flex;font-size:14px;height:24px;justify-content:center;margin-right:8px;width:24px}.pct-select-ellipsis .el-select-dropdown__item{box-sizing:border-box!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;width:100%!important}.letter-circle[data-v-c1065f11]{align-items:center;border-radius:50%;color:#fff;display:flex;flex-shrink:0;font-size:12px;height:22px;justify-content:center;width:22px}.option-container[data-v-c1065f11]{align-items:center;display:flex;width:100%}.option-text[data-v-c1065f11]{flex:1;margin-left:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|