hy-dispatch-ui-v3 0.1.5 → 0.2.0
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/README.md +47 -0
- package/dist/tailwind.css +408 -4
- package/es/components/appAudioPlayer/appAudioPlayer.vue.mjs +462 -0
- package/es/components/appAudioPlayer/index.mjs +6 -0
- package/es/components/appAudioPlayer/js/index.mjs +327 -0
- package/es/components/appAudioPlayer/style/appAudioPlayer.scss +319 -0
- package/es/components/appButton/style/appButton.scss +0 -1
- package/es/components/appConfigProvider/appConfigProvider.vue.mjs +25 -4
- package/es/components/appConfirmDialog/appConfirmDialog.vue.mjs +3 -3
- package/es/components/appConfirmDialog/appConfirmMethod.mjs +13 -13
- package/es/components/appCutter/appCutter.vue.mjs +358 -0
- package/es/components/appCutter/index.mjs +6 -0
- package/es/components/appCutter/style/appCutter.scss +51 -0
- package/es/components/appDatePicker/appDatePicker.vue.mjs +1 -1
- package/es/components/appDialog/appDialog.vue.mjs +205 -0
- package/es/components/appDialog/index.mjs +6 -0
- package/es/components/appDialog/style/appDialog.scss +0 -0
- package/es/components/appForm/appForm.vue.mjs +132 -209
- package/es/components/appForm/cpns/appFormItem.vue.mjs +312 -0
- package/es/components/appForm/cpns/arrayItem.vue.mjs +305 -0
- package/es/components/appForm/cpns/extraItem.vue.mjs +140 -0
- package/es/components/appForm/js/index.mjs +46 -24
- package/es/components/appForm/js/useAppForm.mjs +30 -6
- package/es/components/appForm/style/appForm.scss +53 -0
- package/es/components/appIcon/appIcon.vue.mjs +2 -1
- package/es/components/appIconBox/style/appIconBox.scss +0 -1
- package/es/components/appInput/appInput.vue.mjs +99 -0
- package/es/components/appInput/index.mjs +6 -0
- package/es/components/appMenu/appMenu.vue.mjs +129 -0
- package/es/components/appMenu/index.mjs +6 -0
- package/es/components/appMenu/style/appMenu.scss +145 -0
- package/es/components/appOrgCascader/appOrgCascader.vue.mjs +14 -10
- package/es/components/appSearch/appSearch.vue.mjs +55 -211
- package/es/components/appSearch/cpns/appSearchItem.vue.mjs +238 -0
- package/es/components/appSearch/js/index.mjs +20 -8
- package/es/components/appSearch/js/useAppSearch.mjs +10 -5
- package/es/components/appSearch/style/appSearch.scss +10 -0
- package/es/components/appTable/appTable.vue.mjs +313 -159
- package/es/components/appTable/cpns/columnSelect.vue.mjs +151 -156
- package/es/components/appTable/cpns/columnSelectItem.vue2.mjs +104 -110
- package/es/components/appTable/cpns/headerItem.vue.mjs +98 -0
- package/es/components/appTable/cpns/virtualTable.vue.mjs +560 -0
- package/es/components/appTable/js/index.mjs +46 -20
- package/es/components/appTable/js/search.mjs +1 -2
- package/es/components/appTable/js/useAppTable.mjs +58 -14
- package/es/components/appTable/style/appTable.scss +16 -0
- package/es/components/appTooltip/appTooltip.vue.mjs +24 -13
- package/es/components/appTree/appTree.vue.mjs +304 -0
- package/es/components/appTree/index.mjs +6 -0
- package/es/components/appTree/js/index.mjs +531 -0
- package/es/components/appUserAvatar/appUserAvatar.vue.mjs +9 -8
- package/es/components/appUserAvatar/style/appUserAvatar.scss +0 -1
- package/es/components/appVideoPlayer/appVideoPlayer.vue.mjs +647 -0
- package/es/components/appVideoPlayer/cpns/mediaLoading.vue.mjs +35 -0
- package/es/components/appVideoPlayer/index.mjs +6 -0
- package/es/components/appVideoPlayer/js/index.mjs +426 -0
- package/es/components/appVideoPlayer/style/appVideoPlayer.scss +275 -0
- package/es/components/appVideoPlayer/style/mediaLoading.scss +62 -0
- package/es/components/index.mjs +7 -0
- package/es/hooks/index.mjs +3 -0
- package/es/hooks/useApi.mjs +7 -3
- package/es/hooks/useAudioPlayerConfig.mjs +12 -0
- package/es/hooks/useGlobalConfig.mjs +20 -9
- package/es/hooks/useLocale.mjs +10 -8
- package/es/hooks/useMixins.mjs +1 -1
- package/es/hooks/usePermissionMap.mjs +12 -0
- package/es/hooks/useUserAvatarMap.mjs +6 -3
- package/es/hooks/useVideoPlayerConfig.mjs +12 -0
- package/es/index.mjs +16 -3
- package/es/locale/en.mjs +58 -4
- package/es/locale/zh_CN.mjs +56 -6
- package/es/make-installer.mjs +2 -0
- package/es/static/hy-svg-icons.js +462 -0
- package/es/static/protocolcheck.js +247 -0
- package/es/style/element/element.scss +9 -0
- package/es/style/element/index.scss +6 -3
- package/es/style/index.scss +11 -0
- package/es/style/theme.scss +73 -0
- package/es/utils/date.mjs +25 -1
- package/es/utils/file.mjs +69 -0
- package/es/utils/form.mjs +52 -0
- package/es/utils/handler.mjs +22 -2
- package/es/utils/index.mjs +6 -3
- package/es/utils/is.mjs +26 -2
- package/es/utils/loadScript.mjs +33 -0
- package/es/version.mjs +1 -1
- package/lib/components/appAudioPlayer/appAudioPlayer.vue.js +466 -0
- package/lib/components/appAudioPlayer/index.js +11 -0
- package/lib/components/appAudioPlayer/js/index.js +329 -0
- package/lib/components/appAudioPlayer/style/appAudioPlayer.scss +319 -0
- package/lib/components/appButton/style/appButton.scss +0 -1
- package/lib/components/appConfigProvider/appConfigProvider.vue.js +23 -2
- package/lib/components/appConfirmDialog/appConfirmDialog.vue.js +3 -3
- package/lib/components/appConfirmDialog/appConfirmMethod.js +13 -13
- package/lib/components/appCutter/appCutter.vue.js +362 -0
- package/lib/components/appCutter/index.js +11 -0
- package/lib/components/appCutter/style/appCutter.scss +51 -0
- package/lib/components/appDatePicker/appDatePicker.vue.js +1 -1
- package/lib/components/appDialog/appDialog.vue.js +209 -0
- package/lib/components/appDialog/index.js +11 -0
- package/lib/components/appDialog/style/appDialog.scss +0 -0
- package/lib/components/appForm/appForm.vue.js +129 -206
- package/lib/components/appForm/cpns/appFormItem.vue.js +316 -0
- package/lib/components/appForm/cpns/arrayItem.vue.js +309 -0
- package/lib/components/appForm/cpns/extraItem.vue.js +144 -0
- package/lib/components/appForm/js/index.js +48 -23
- package/lib/components/appForm/js/useAppForm.js +30 -6
- package/lib/components/appForm/style/appForm.scss +53 -0
- package/lib/components/appIcon/appIcon.vue.js +2 -1
- package/lib/components/appIconBox/style/appIconBox.scss +0 -1
- package/lib/components/appInput/appInput.vue.js +103 -0
- package/lib/components/appInput/index.js +11 -0
- package/lib/components/appMenu/appMenu.vue.js +133 -0
- package/lib/components/appMenu/index.js +11 -0
- package/lib/components/appMenu/style/appMenu.scss +145 -0
- package/lib/components/appOrgCascader/appOrgCascader.vue.js +14 -10
- package/lib/components/appSearch/appSearch.vue.js +51 -207
- package/lib/components/appSearch/cpns/appSearchItem.vue.js +242 -0
- package/lib/components/appSearch/js/index.js +20 -7
- package/lib/components/appSearch/js/useAppSearch.js +10 -5
- package/lib/components/appSearch/style/appSearch.scss +10 -0
- package/lib/components/appTable/appTable.vue.js +320 -166
- package/lib/components/appTable/cpns/columnSelect.vue.js +151 -156
- package/lib/components/appTable/cpns/columnSelectItem.vue2.js +105 -111
- package/lib/components/appTable/cpns/headerItem.vue.js +102 -0
- package/lib/components/appTable/cpns/virtualTable.vue.js +564 -0
- package/lib/components/appTable/js/index.js +47 -19
- package/lib/components/appTable/js/search.js +1 -2
- package/lib/components/appTable/js/useAppTable.js +57 -13
- package/lib/components/appTable/style/appTable.scss +16 -0
- package/lib/components/appTooltip/appTooltip.vue.js +23 -12
- package/lib/components/appTree/appTree.vue.js +308 -0
- package/lib/components/appTree/index.js +11 -0
- package/lib/components/appTree/js/index.js +533 -0
- package/lib/components/appUserAvatar/appUserAvatar.vue.js +9 -8
- package/lib/components/appUserAvatar/style/appUserAvatar.scss +0 -1
- package/lib/components/appVideoPlayer/appVideoPlayer.vue.js +651 -0
- package/lib/components/appVideoPlayer/cpns/mediaLoading.vue.js +39 -0
- package/lib/components/appVideoPlayer/index.js +11 -0
- package/lib/components/appVideoPlayer/js/index.js +429 -0
- package/lib/components/appVideoPlayer/style/appVideoPlayer.scss +275 -0
- package/lib/components/appVideoPlayer/style/mediaLoading.scss +62 -0
- package/lib/components/index.js +42 -28
- package/lib/hooks/index.js +9 -0
- package/lib/hooks/useApi.js +7 -3
- package/lib/hooks/useAudioPlayerConfig.js +15 -0
- package/lib/hooks/useGlobalConfig.js +18 -7
- package/lib/hooks/useLocale.js +9 -7
- package/lib/hooks/useMixins.js +1 -1
- package/lib/hooks/usePermissionMap.js +15 -0
- package/lib/hooks/useUserAvatarMap.js +5 -2
- package/lib/hooks/useVideoPlayerConfig.js +15 -0
- package/lib/index.js +70 -28
- package/lib/locale/en.js +58 -4
- package/lib/locale/zh_CN.js +56 -6
- package/lib/make-installer.js +2 -0
- package/lib/static/hy-svg-icons.js +459 -8
- package/lib/static/protocolcheck.js +249 -0
- package/lib/style/element/element.scss +9 -0
- package/lib/style/element/index.scss +6 -3
- package/lib/style/index.scss +11 -0
- package/lib/style/theme.scss +73 -0
- package/lib/utils/date.js +25 -0
- package/lib/utils/file.js +76 -0
- package/lib/utils/form.js +57 -0
- package/lib/utils/handler.js +22 -1
- package/lib/utils/index.js +19 -0
- package/lib/utils/is.js +27 -1
- package/lib/utils/loadScript.js +37 -0
- package/lib/version.js +1 -1
- package/package.json +13 -12
- package/es/config/index.mjs +0 -1
- package/es/static/hy-svg-icons.mjs +0 -11
- package/lib/config/index.js +0 -2
|
@@ -29,7 +29,7 @@ function tableColumnsEditableleHandler(columns, columnsEditablele, searchArr) {
|
|
|
29
29
|
searchLabelSet.add(column.label);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
if (
|
|
32
|
+
if (searchArr?.length > 0) {
|
|
33
33
|
searchArr.forEach((item) => {
|
|
34
34
|
searchLabelSet.add(item.label);
|
|
35
35
|
});
|
|
@@ -101,9 +101,11 @@ function operatorFilterHandler(column, scope, type = "all") {
|
|
|
101
101
|
if (type === "all" || operator.length <= 1 && type === "default") {
|
|
102
102
|
return operator;
|
|
103
103
|
}
|
|
104
|
-
const btnWidth =
|
|
104
|
+
const btnWidth = 40;
|
|
105
105
|
const gapWidth = 12;
|
|
106
|
-
const operatorCount = Math.floor(
|
|
106
|
+
const operatorCount = Math.floor(
|
|
107
|
+
(width - 12 * 2 - btnWidth) / (btnWidth + gapWidth) + 1
|
|
108
|
+
);
|
|
107
109
|
if (operatorCount === operator.length) {
|
|
108
110
|
return type === "default" ? operator : [];
|
|
109
111
|
}
|
|
@@ -116,7 +118,22 @@ function operatorFilterHandler(column, scope, type = "all") {
|
|
|
116
118
|
function operatorClickHandler(command, column, scope, type = "all") {
|
|
117
119
|
const operator = operatorFilterHandler(column, scope, type);
|
|
118
120
|
const target = operator[command];
|
|
119
|
-
|
|
121
|
+
target?.handler && target.handler(scope);
|
|
122
|
+
}
|
|
123
|
+
function renderHeaderHandler(column, scope) {
|
|
124
|
+
if (!column) return;
|
|
125
|
+
if (is.isFunction(column.renderHeader)) {
|
|
126
|
+
return column.renderHeader({ ...scope, column });
|
|
127
|
+
}
|
|
128
|
+
return column.label;
|
|
129
|
+
}
|
|
130
|
+
function renderContentHandler(column, scope) {
|
|
131
|
+
const { row } = scope || {};
|
|
132
|
+
if (!column || !row) return;
|
|
133
|
+
if (is.isFunction(column.renderContent)) {
|
|
134
|
+
return column.renderContent({ ...scope, column });
|
|
135
|
+
}
|
|
136
|
+
return row[column.prop];
|
|
120
137
|
}
|
|
121
138
|
const useAppTableWrapper = (hy) => {
|
|
122
139
|
const {
|
|
@@ -147,8 +164,7 @@ const useAppTableWrapper = (hy) => {
|
|
|
147
164
|
sessionStorage.setItem(CACHE_COLUMNS_KEY, JSON.stringify(value));
|
|
148
165
|
}
|
|
149
166
|
function doLayout() {
|
|
150
|
-
|
|
151
|
-
(_a = tableRef.value) == null ? void 0 : _a.doLayout();
|
|
167
|
+
tableRef.value?.doLayout && tableRef.value?.doLayout();
|
|
152
168
|
}
|
|
153
169
|
let loadingInstance, loadingTimer;
|
|
154
170
|
function showAppTableLoading() {
|
|
@@ -169,7 +185,7 @@ const useAppTableWrapper = (hy) => {
|
|
|
169
185
|
}
|
|
170
186
|
function closeAppTableLoading() {
|
|
171
187
|
loadingTimer && clearTimeout(loadingTimer);
|
|
172
|
-
loadingInstance
|
|
188
|
+
loadingInstance?.close();
|
|
173
189
|
loadingInstance = null;
|
|
174
190
|
}
|
|
175
191
|
const tableTriggerPosition = vue.ref({
|
|
@@ -184,7 +200,6 @@ const useAppTableWrapper = (hy) => {
|
|
|
184
200
|
getBoundingClientRect: () => tableTriggerPosition.value
|
|
185
201
|
});
|
|
186
202
|
function onTableRowContextmenuHandler(row, _, event) {
|
|
187
|
-
var _a, _b;
|
|
188
203
|
if (props.onRowContextmenu) {
|
|
189
204
|
props.onRowContextmenu(row, _, event);
|
|
190
205
|
return;
|
|
@@ -195,18 +210,18 @@ const useAppTableWrapper = (hy) => {
|
|
|
195
210
|
y: clientY
|
|
196
211
|
});
|
|
197
212
|
const column = tableColumns.value.find(
|
|
198
|
-
(column2) => column2.
|
|
213
|
+
(column2) => column2.type === "operator"
|
|
199
214
|
);
|
|
200
215
|
const operator = operatorFilterHandler(column, { row });
|
|
201
|
-
if (!
|
|
216
|
+
if (!operator?.length) return;
|
|
202
217
|
tableTriggerRef.value.column = column;
|
|
203
218
|
tableTriggerRef.value.scope = { row };
|
|
204
219
|
event.preventDefault();
|
|
205
|
-
|
|
220
|
+
tableDropdownRef.value?.handleOpen();
|
|
206
221
|
if (is.isArray(operatorDropdownRef.value)) {
|
|
207
222
|
operatorDropdownRef.value.forEach((item) => item.handleClose());
|
|
208
223
|
} else {
|
|
209
|
-
|
|
224
|
+
operatorDropdownRef.value?.handleClose();
|
|
210
225
|
}
|
|
211
226
|
}
|
|
212
227
|
const selectedList = vue.ref([]);
|
|
@@ -216,11 +231,12 @@ const useAppTableWrapper = (hy) => {
|
|
|
216
231
|
return map;
|
|
217
232
|
}, /* @__PURE__ */ new Map());
|
|
218
233
|
});
|
|
234
|
+
const selectionColumn = vue.computed(() => {
|
|
235
|
+
return tableColumns.value.find((item) => item.type === "selection");
|
|
236
|
+
});
|
|
219
237
|
function isSelectable(row) {
|
|
220
|
-
const column =
|
|
221
|
-
|
|
222
|
-
});
|
|
223
|
-
if (!is.isFunction(column == null ? void 0 : column.selectable)) return true;
|
|
238
|
+
const column = selectionColumn.value;
|
|
239
|
+
if (!is.isFunction(column?.selectable)) return true;
|
|
224
240
|
return column.selectable(row);
|
|
225
241
|
}
|
|
226
242
|
function getSelectedIndex(row) {
|
|
@@ -228,8 +244,7 @@ const useAppTableWrapper = (hy) => {
|
|
|
228
244
|
return is.isNumber(index) ? index : -1;
|
|
229
245
|
}
|
|
230
246
|
function clearSelection() {
|
|
231
|
-
|
|
232
|
-
(_a = tableRef.value) == null ? void 0 : _a.clearSelection();
|
|
247
|
+
tableRef.value?.clearSelection();
|
|
233
248
|
}
|
|
234
249
|
function getSelectedList() {
|
|
235
250
|
return selectedList.value;
|
|
@@ -284,6 +299,13 @@ const useAppTableWrapper = (hy) => {
|
|
|
284
299
|
}
|
|
285
300
|
return className.filter(Boolean).join(" ");
|
|
286
301
|
}
|
|
302
|
+
const isSearchFocus = vue.ref(false);
|
|
303
|
+
function onSearchInputHandler() {
|
|
304
|
+
isSearchFocus.value = true;
|
|
305
|
+
}
|
|
306
|
+
function onSearchBlurHandler() {
|
|
307
|
+
isSearchFocus.value = false;
|
|
308
|
+
}
|
|
287
309
|
vue.watchEffect(() => {
|
|
288
310
|
const { columnsList, columnsEditablele, searchText } = tableColumnHandler(
|
|
289
311
|
props.tableColumns,
|
|
@@ -315,7 +337,11 @@ const useAppTableWrapper = (hy) => {
|
|
|
315
337
|
onTableSelectHandler,
|
|
316
338
|
onTableRowContextmenuHandler,
|
|
317
339
|
onTableRowClickHandler,
|
|
318
|
-
onTableColumnsSelectHandler
|
|
340
|
+
onTableColumnsSelectHandler,
|
|
341
|
+
// 搜索选中
|
|
342
|
+
isSearchFocus,
|
|
343
|
+
onSearchInputHandler,
|
|
344
|
+
onSearchBlurHandler
|
|
319
345
|
};
|
|
320
346
|
};
|
|
321
347
|
|
|
@@ -323,6 +349,8 @@ exports.operatorClickHandler = operatorClickHandler;
|
|
|
323
349
|
exports.operatorDisableTextdHandler = operatorDisableTextdHandler;
|
|
324
350
|
exports.operatorDisabledHandler = operatorDisabledHandler;
|
|
325
351
|
exports.operatorFilterHandler = operatorFilterHandler;
|
|
352
|
+
exports.renderContentHandler = renderContentHandler;
|
|
353
|
+
exports.renderHeaderHandler = renderHeaderHandler;
|
|
326
354
|
exports.tableColumnHandler = tableColumnHandler;
|
|
327
355
|
exports.tableColumnShowHandler = tableColumnShowHandler;
|
|
328
356
|
exports.useAppTableWrapper = useAppTableWrapper;
|
|
@@ -47,8 +47,7 @@ function useAppTableSearch(hy) {
|
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
function successFun(res) {
|
|
50
|
-
|
|
51
|
-
if (!((_a = res.data.content) == null ? void 0 : _a.length) && props.filterModel.page !== 1) {
|
|
50
|
+
if (!res.data.content?.length && props.filterModel.page !== 1) {
|
|
52
51
|
getData(1);
|
|
53
52
|
return;
|
|
54
53
|
}
|
|
@@ -6,6 +6,7 @@ var is = require('../../../utils/is.js');
|
|
|
6
6
|
var useLocale = require('../../../hooks/useLocale.js');
|
|
7
7
|
|
|
8
8
|
function getColumnDefaultConfig(column) {
|
|
9
|
+
const { t } = useLocale.useLocale();
|
|
9
10
|
switch (column.type) {
|
|
10
11
|
case "selection":
|
|
11
12
|
return {
|
|
@@ -13,27 +14,40 @@ function getColumnDefaultConfig(column) {
|
|
|
13
14
|
reserveSelection: true
|
|
14
15
|
};
|
|
15
16
|
case "index":
|
|
17
|
+
return {
|
|
18
|
+
props: `${column.type}_prop`,
|
|
19
|
+
label: t("table.index")
|
|
20
|
+
};
|
|
16
21
|
case "expand":
|
|
17
22
|
return {
|
|
18
23
|
prop: `${column.type}_prop`
|
|
19
24
|
};
|
|
25
|
+
case "operator":
|
|
26
|
+
return {
|
|
27
|
+
label: t("table.operator"),
|
|
28
|
+
prop: `operator_prop`
|
|
29
|
+
};
|
|
20
30
|
default:
|
|
21
31
|
return {};
|
|
22
32
|
}
|
|
23
33
|
}
|
|
24
34
|
function getColumnDefaultWidth(column) {
|
|
25
35
|
if (column.width) return column.width;
|
|
36
|
+
if (column.type === "expand" && column.expandType === "expand") return 40;
|
|
37
|
+
if (column.type === "selection") return 40;
|
|
26
38
|
if (column.type === "index") return 80;
|
|
27
|
-
if (column.
|
|
39
|
+
if (column.type === "operator") return 172;
|
|
28
40
|
return;
|
|
29
41
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
42
|
+
function generateColumnItem(column) {
|
|
43
|
+
return {
|
|
44
|
+
...column,
|
|
45
|
+
key: column.prop,
|
|
46
|
+
dataKey: column.prop,
|
|
47
|
+
title: column.label
|
|
48
|
+
};
|
|
35
49
|
}
|
|
36
|
-
function
|
|
50
|
+
function getColumnEditable(column, index) {
|
|
37
51
|
const { editable, type, prop } = column;
|
|
38
52
|
if (is.isBoolean(editable)) {
|
|
39
53
|
return {
|
|
@@ -49,29 +63,55 @@ function getColumnsEditable(column, index) {
|
|
|
49
63
|
index,
|
|
50
64
|
lock: false,
|
|
51
65
|
edit: !type || type === "default",
|
|
52
|
-
checked: !type || type !== "default" ||
|
|
66
|
+
checked: !type || type !== "default" || type === "operator",
|
|
53
67
|
desc: void 0,
|
|
54
68
|
examples: [],
|
|
55
69
|
...editable || {}
|
|
56
70
|
};
|
|
57
71
|
}
|
|
72
|
+
function getColumnSort(column) {
|
|
73
|
+
const sort = {
|
|
74
|
+
prop: column.prop,
|
|
75
|
+
show: false,
|
|
76
|
+
default: ""
|
|
77
|
+
};
|
|
78
|
+
if (is.isBoolean(column.sort)) {
|
|
79
|
+
sort.prop = column.prop;
|
|
80
|
+
sort.show = true;
|
|
81
|
+
} else if (is.isString(column.sort)) {
|
|
82
|
+
sort.prop = column.sort;
|
|
83
|
+
sort.show = true;
|
|
84
|
+
} else if (is.isObject(column.sort)) {
|
|
85
|
+
const { prop, show } = column.sort;
|
|
86
|
+
sort.prop = is.isString(prop) ? prop : sort.prop;
|
|
87
|
+
sort.show = true;
|
|
88
|
+
sort.default = ["desc", "asc"].includes(column.sort.default) ? column.sort.default : sort.default;
|
|
89
|
+
}
|
|
90
|
+
return sort;
|
|
91
|
+
}
|
|
58
92
|
const useAppTable = (config = {}) => {
|
|
59
93
|
const { columns, filterModel, filterColumns } = config || {};
|
|
60
94
|
const tableColumns = [];
|
|
95
|
+
let defaultSortInfo = null;
|
|
61
96
|
try {
|
|
62
|
-
for (let i = 0; i <
|
|
97
|
+
for (let i = 0; i < columns?.length; i++) {
|
|
63
98
|
const column = columns[i];
|
|
64
99
|
if (is.isEmpty(column.prop) && column.type === "default") {
|
|
65
100
|
throw Error("\u3010column.prop\u3011\u4E0D\u80FD\u4E3A\u7A7A");
|
|
66
101
|
}
|
|
67
|
-
|
|
102
|
+
const sort = getColumnSort(column);
|
|
103
|
+
if (!defaultSortInfo && sort.default) {
|
|
104
|
+
defaultSortInfo = sort;
|
|
105
|
+
}
|
|
106
|
+
const target = {
|
|
68
107
|
...getColumnDefaultConfig(column),
|
|
69
108
|
...column,
|
|
70
109
|
type: column.type || "default",
|
|
71
110
|
width: getColumnDefaultWidth(column),
|
|
72
|
-
|
|
73
|
-
editable:
|
|
74
|
-
}
|
|
111
|
+
sort,
|
|
112
|
+
editable: getColumnEditable(column, i)
|
|
113
|
+
};
|
|
114
|
+
tableColumns.push(generateColumnItem(target));
|
|
75
115
|
}
|
|
76
116
|
} catch (err) {
|
|
77
117
|
console.error(err);
|
|
@@ -82,6 +122,10 @@ const useAppTable = (config = {}) => {
|
|
|
82
122
|
// 当前分页数
|
|
83
123
|
size: 15,
|
|
84
124
|
// 每页数量
|
|
125
|
+
sortBy: defaultSortInfo?.prop,
|
|
126
|
+
// 排序字段
|
|
127
|
+
orderSort: defaultSortInfo?.default,
|
|
128
|
+
// 排序方式
|
|
85
129
|
...filterModel
|
|
86
130
|
});
|
|
87
131
|
return {
|
|
@@ -21,4 +21,20 @@
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
.app-table-search {
|
|
25
|
+
width: 160px;
|
|
26
|
+
.hy-el-input__inner::placeholder {
|
|
27
|
+
font-size: 12px;
|
|
28
|
+
}
|
|
29
|
+
.hy-el-input__wrapper {
|
|
30
|
+
box-shadow: none;
|
|
31
|
+
}
|
|
32
|
+
.hy-el-input-group__append {
|
|
33
|
+
color: rgb(var(--hy-main));
|
|
34
|
+
background-color: rgba(var(--hy-background-2));
|
|
35
|
+
box-shadow: none;
|
|
36
|
+
padding: 4px;
|
|
37
|
+
min-height: 100%;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
24
40
|
}
|
|
@@ -18,13 +18,15 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
18
18
|
default: false
|
|
19
19
|
},
|
|
20
20
|
disabled: {
|
|
21
|
-
type: Boolean
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false
|
|
22
23
|
},
|
|
23
24
|
class: {
|
|
24
25
|
type: String
|
|
25
26
|
},
|
|
26
27
|
overLine: {
|
|
27
|
-
type:
|
|
28
|
+
type: Number,
|
|
29
|
+
default: 1
|
|
28
30
|
},
|
|
29
31
|
content: {
|
|
30
32
|
type: String
|
|
@@ -32,7 +34,13 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
32
34
|
},
|
|
33
35
|
setup(__props) {
|
|
34
36
|
const props = __props;
|
|
35
|
-
const
|
|
37
|
+
const isShow = vue.ref(false);
|
|
38
|
+
const isDisabled = vue.computed(() => {
|
|
39
|
+
if (props.disabled || props.isAlways) {
|
|
40
|
+
return props.disabled;
|
|
41
|
+
}
|
|
42
|
+
return isShow.value;
|
|
43
|
+
});
|
|
36
44
|
const appClass = vue.computed(() => {
|
|
37
45
|
const classList = [props.class, "break-all"];
|
|
38
46
|
const overLine = props.overLine;
|
|
@@ -42,11 +50,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
42
50
|
return classList.filter(Boolean);
|
|
43
51
|
});
|
|
44
52
|
function onMouseenterHandler(e) {
|
|
45
|
-
|
|
46
|
-
isDisabled.value = props.disabled;
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
isDisabled.value = !is.isOverflowing(e.target);
|
|
53
|
+
isShow.value = !is.isOverflowing(e.target);
|
|
50
54
|
}
|
|
51
55
|
return (_ctx, _cache) => {
|
|
52
56
|
return vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElTooltip), vue.mergeProps({
|
|
@@ -57,12 +61,19 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
57
61
|
"popper-class": "max-w-[300px]"
|
|
58
62
|
}, _ctx.$attrs, {
|
|
59
63
|
disabled: isDisabled.value,
|
|
60
|
-
content: __props.content
|
|
64
|
+
content: _ctx.$slots.content ? void 0 : __props.content
|
|
61
65
|
}), vue.createSlots({
|
|
62
66
|
default: vue.withCtx(() => [
|
|
63
|
-
vue.
|
|
67
|
+
__props.isAlways ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }, () => [
|
|
68
|
+
vue.createTextVNode(
|
|
69
|
+
vue.toDisplayString(__props.content),
|
|
70
|
+
1
|
|
71
|
+
/* TEXT */
|
|
72
|
+
)
|
|
73
|
+
]) : (vue.openBlock(), vue.createElementBlock(
|
|
64
74
|
"span",
|
|
65
75
|
{
|
|
76
|
+
key: 1,
|
|
66
77
|
class: vue.normalizeClass(appClass.value),
|
|
67
78
|
onMouseenter: onMouseenterHandler
|
|
68
79
|
},
|
|
@@ -77,12 +88,12 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
77
88
|
],
|
|
78
89
|
34
|
|
79
90
|
/* CLASS, NEED_HYDRATION */
|
|
80
|
-
)
|
|
91
|
+
))
|
|
81
92
|
]),
|
|
82
93
|
_: 2
|
|
83
94
|
/* DYNAMIC */
|
|
84
95
|
}, [
|
|
85
|
-
|
|
96
|
+
_ctx.$slots.content ? {
|
|
86
97
|
name: "content",
|
|
87
98
|
fn: vue.withCtx(() => [
|
|
88
99
|
vue.renderSlot(_ctx.$slots, "content")
|