qidian-vue-ui 2.0.66 → 2.1.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.
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
.qd-crud-table[data-v-
|
|
1
|
+
.qd-crud-table[data-v-38df8d6e] {
|
|
2
2
|
width: 100%;
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
}
|
|
6
|
-
.qd-crud-table > .qd-crud-search:not(.qd-crud-search--hide) + .qd-crud-table__body[data-v-
|
|
6
|
+
.qd-crud-table > .qd-crud-search:not(.qd-crud-search--hide) + .qd-crud-table__body[data-v-38df8d6e] {
|
|
7
7
|
margin-top: var(--td-comp-margin-l);
|
|
8
8
|
}
|
|
9
|
-
.qd-crud-table__body[data-v-
|
|
9
|
+
.qd-crud-table__body[data-v-38df8d6e] > .t-loading__parent > .t-card__body {
|
|
10
10
|
display: flex;
|
|
11
11
|
flex-direction: column;
|
|
12
12
|
}
|
|
13
|
-
.qd-crud-table__body[data-v-
|
|
13
|
+
.qd-crud-table__body[data-v-38df8d6e] > .t-loading__parent > .t-card__body > .qd-service-table .t-table__pagination {
|
|
14
14
|
padding-bottom: 0;
|
|
15
15
|
}
|
|
16
|
-
.qd-crud-table--fit-parent-height[data-v-
|
|
16
|
+
.qd-crud-table--fit-parent-height[data-v-38df8d6e] {
|
|
17
17
|
height: 100%;
|
|
18
18
|
}
|
|
19
|
-
.qd-crud-table--fit-parent-height > .qd-crud-table__body[data-v-
|
|
19
|
+
.qd-crud-table--fit-parent-height > .qd-crud-table__body[data-v-38df8d6e] {
|
|
20
20
|
flex: auto;
|
|
21
21
|
}
|
|
22
|
-
.qd-crud-table--fit-parent-height > .qd-crud-table__body[data-v-
|
|
22
|
+
.qd-crud-table--fit-parent-height > .qd-crud-table__body[data-v-38df8d6e] > .t-loading__parent > .t-card__body {
|
|
23
23
|
height: 100%;
|
|
24
24
|
min-height: 443px;
|
|
25
25
|
}
|
|
26
|
-
.qd-crud-table--fit-parent-height > .qd-crud-table__body[data-v-
|
|
26
|
+
.qd-crud-table--fit-parent-height > .qd-crud-table__body[data-v-38df8d6e] > .t-loading__parent > .t-card__body > .qd-service-table {
|
|
27
27
|
flex: 1 1 0;
|
|
28
28
|
overflow: hidden;
|
|
29
29
|
}
|
|
30
|
-
.qd-crud-table__toolbar[data-v-
|
|
30
|
+
.qd-crud-table__toolbar[data-v-38df8d6e] {
|
|
31
31
|
display: flex;
|
|
32
32
|
justify-content: space-between;
|
|
33
33
|
}
|
|
34
|
-
.qd-crud-table__toolbar--has-space-item + .qd-service-table[data-v-
|
|
34
|
+
.qd-crud-table__toolbar--has-space-item + .qd-service-table[data-v-38df8d6e] {
|
|
35
35
|
margin-top: var(--td-comp-margin-l);
|
|
36
36
|
}
|
|
37
|
-
.qd-crud-table__toolbar-separator[data-v-
|
|
37
|
+
.qd-crud-table__toolbar-separator[data-v-38df8d6e] {
|
|
38
38
|
display: inline-block;
|
|
39
39
|
padding-left: var(--td-comp-paddingLR-s);
|
|
40
40
|
}
|
|
@@ -2,7 +2,7 @@ import './index.css'
|
|
|
2
2
|
import _sfc_main from "./index.vue2.mjs";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
5
|
-
const QdCrudTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
5
|
+
const QdCrudTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-38df8d6e"]]);
|
|
6
6
|
export {
|
|
7
7
|
QdCrudTable as default
|
|
8
8
|
};
|
|
@@ -18,8 +18,8 @@ import { hasPermiDirective } from "../../../directive/hasPermi.mjs";
|
|
|
18
18
|
import _sfc_main$2 from "../../dialog/form.vue.mjs";
|
|
19
19
|
import QdColumnsController from "../../columns-controller/index.vue.mjs";
|
|
20
20
|
import get from "../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/get.mjs";
|
|
21
|
-
import QdServiceTable from "../../service/table/index.vue.mjs";
|
|
22
21
|
import { hasPermiOr } from "../../../utils/auth.mjs";
|
|
22
|
+
import QdServiceTable from "../../service/table/index.vue.mjs";
|
|
23
23
|
const _hoisted_1 = {
|
|
24
24
|
key: 0,
|
|
25
25
|
class: "qd-crud-table__toolbar-separator"
|
|
@@ -412,12 +412,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
412
412
|
const {
|
|
413
413
|
t
|
|
414
414
|
} = useConfig("crud");
|
|
415
|
+
const {
|
|
416
|
+
global: tableGlobalConfig
|
|
417
|
+
} = useConfig("table");
|
|
415
418
|
const {
|
|
416
419
|
msgError,
|
|
417
420
|
msgSuccess,
|
|
418
421
|
alertWarning,
|
|
419
422
|
confirm
|
|
420
423
|
} = useModal();
|
|
424
|
+
const SIZE_FONT_MAP = {
|
|
425
|
+
large: 16,
|
|
426
|
+
medium: 14,
|
|
427
|
+
small: 14,
|
|
428
|
+
mini: 12
|
|
429
|
+
};
|
|
430
|
+
const SIZE_PADDING_MAP = {
|
|
431
|
+
large: 40,
|
|
432
|
+
medium: 32,
|
|
433
|
+
small: 16,
|
|
434
|
+
mini: 12
|
|
435
|
+
};
|
|
421
436
|
const treeIsExpand = computed(() => !!expandedTreeNodes.value?.length);
|
|
422
437
|
const dialogFormMap = reactive({});
|
|
423
438
|
const ifRenderMap = reactive({});
|
|
@@ -425,7 +440,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
425
440
|
const shouldValidateInitialSearch = computed(() => !!props.service && props.manual !== true && !!props.search?.items?.length);
|
|
426
441
|
const reProps = computed(() => {
|
|
427
442
|
const {
|
|
428
|
-
data:
|
|
443
|
+
data: propsData,
|
|
429
444
|
searchData: inSearchData,
|
|
430
445
|
selectedRowKeys: selectedRowKeys2,
|
|
431
446
|
activeRowKeys: activeRowKeys2,
|
|
@@ -524,13 +539,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
524
539
|
}
|
|
525
540
|
const operationLength = reRowActions.length;
|
|
526
541
|
if (operationLength) {
|
|
542
|
+
const operationSize = serviceTableOptions.size ?? tableGlobalConfig.value?.size ?? "medium";
|
|
527
543
|
const operationIdx = reColumns.findIndex((item) => item.colKey === "operation");
|
|
528
544
|
const defaultOperation = {
|
|
529
545
|
title: t("operationText"),
|
|
530
546
|
colKey: "operation",
|
|
531
547
|
align: "center",
|
|
532
548
|
fixed: "right",
|
|
533
|
-
width:
|
|
549
|
+
width: calcOperationWidth(reRowActions, data.value, operationSize)
|
|
534
550
|
};
|
|
535
551
|
if (operationIdx > -1) {
|
|
536
552
|
reColumns[operationIdx] = {
|
|
@@ -579,7 +595,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
579
595
|
rowActions: reRowActions,
|
|
580
596
|
tools: reTools,
|
|
581
597
|
models: {
|
|
582
|
-
data:
|
|
598
|
+
data: propsData,
|
|
583
599
|
searchData: inSearchData,
|
|
584
600
|
selectedRowKeys: selectedRowKeys2,
|
|
585
601
|
activeRowKeys: activeRowKeys2,
|
|
@@ -740,6 +756,61 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
740
756
|
if (!hasChanged) return;
|
|
741
757
|
mergeColumns.value = newColumns;
|
|
742
758
|
};
|
|
759
|
+
function calcTextWidth(text, fontSize) {
|
|
760
|
+
return [...text].reduce((width, char) => {
|
|
761
|
+
if (char.charCodeAt(0) > 255) return width + fontSize;
|
|
762
|
+
return width + Math.round(fontSize * (/[A-Z]/.test(char) ? 0.79 : 0.57));
|
|
763
|
+
}, 0);
|
|
764
|
+
}
|
|
765
|
+
function getActionWidth(action, row, fontSize = 14) {
|
|
766
|
+
if (action.component) return Math.round(fontSize * 2);
|
|
767
|
+
let iconWidth = 0;
|
|
768
|
+
if (action.prefixIcon) {
|
|
769
|
+
const icon = action.prefixIcon?.__qdCompute && row !== void 0 ? action.prefixIcon(getConfigRendererCtx(action, {
|
|
770
|
+
row
|
|
771
|
+
}), void 0) : action.prefixIcon;
|
|
772
|
+
iconWidth = icon ? Math.round(fontSize * 1.43) : 0;
|
|
773
|
+
}
|
|
774
|
+
const {
|
|
775
|
+
content
|
|
776
|
+
} = action;
|
|
777
|
+
if (typeof content === "string") return calcTextWidth(content, fontSize) + iconWidth;
|
|
778
|
+
if (row !== void 0 && content?.__qdCompute) {
|
|
779
|
+
const text = content(getConfigRendererCtx(action, {
|
|
780
|
+
row
|
|
781
|
+
}), void 0);
|
|
782
|
+
return typeof text === "string" ? calcTextWidth(text, fontSize) + iconWidth : Math.round(fontSize * 2) + iconWidth;
|
|
783
|
+
}
|
|
784
|
+
return content === void 0 && !iconWidth ? 0 : Math.round(fontSize * 1.14);
|
|
785
|
+
}
|
|
786
|
+
function isActionVisible(action, row) {
|
|
787
|
+
if (!hasPermiOr(action.permi, false)) return false;
|
|
788
|
+
const {
|
|
789
|
+
ifRender
|
|
790
|
+
} = action;
|
|
791
|
+
if (ifRender?.__qdCompute) {
|
|
792
|
+
return ifRender(getConfigRendererCtx(action, {
|
|
793
|
+
row
|
|
794
|
+
}), void 0) !== false;
|
|
795
|
+
}
|
|
796
|
+
return ifRender !== false;
|
|
797
|
+
}
|
|
798
|
+
function calcOperationWidth(rowActions, rows, size = "medium") {
|
|
799
|
+
const permittedActions = rowActions.filter((action) => hasPermiOr(action.permi, false));
|
|
800
|
+
if (!permittedActions.length) return 0;
|
|
801
|
+
const fontSize = SIZE_FONT_MAP[size] ?? 14;
|
|
802
|
+
const cellPadding = SIZE_PADDING_MAP[size] ?? 32;
|
|
803
|
+
const sumWidth = (actions, row) => actions.reduce((width, action) => width + getActionWidth(action, row, fontSize), 0) + (actions.length - 1) * 25 + cellPadding + 5;
|
|
804
|
+
if (!rows?.length) {
|
|
805
|
+
return sumWidth(permittedActions);
|
|
806
|
+
}
|
|
807
|
+
let maxWidth = 0;
|
|
808
|
+
for (const row of rows) {
|
|
809
|
+
const visibleActions = permittedActions.filter((action) => isActionVisible(action, row));
|
|
810
|
+
maxWidth = Math.max(maxWidth, sumWidth(visibleActions, row));
|
|
811
|
+
}
|
|
812
|
+
return maxWidth;
|
|
813
|
+
}
|
|
743
814
|
function buildActions(actions, crudForm) {
|
|
744
815
|
if (!actions) return [];
|
|
745
816
|
return actions.map((item) => mergeAction({
|