qidian-vue-ui 2.0.66 → 2.1.1
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-27ca87c9] {
|
|
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-27ca87c9] {
|
|
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-27ca87c9] > .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-27ca87c9] > .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-27ca87c9] {
|
|
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-27ca87c9] {
|
|
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-27ca87c9] > .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-27ca87c9] > .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-27ca87c9] {
|
|
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-27ca87c9] {
|
|
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-27ca87c9] {
|
|
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-27ca87c9"]]);
|
|
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"
|
|
@@ -410,14 +410,29 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
410
410
|
passive: true
|
|
411
411
|
});
|
|
412
412
|
const {
|
|
413
|
-
t
|
|
413
|
+
t,
|
|
414
|
+
size: globalComponentSize
|
|
414
415
|
} = useConfig("crud");
|
|
416
|
+
const {
|
|
417
|
+
global: tableGlobalConfig
|
|
418
|
+
} = useConfig("table");
|
|
415
419
|
const {
|
|
416
420
|
msgError,
|
|
417
421
|
msgSuccess,
|
|
418
422
|
alertWarning,
|
|
419
423
|
confirm
|
|
420
424
|
} = useModal();
|
|
425
|
+
const COMPONENT_FONT_MAP = {
|
|
426
|
+
large: 16,
|
|
427
|
+
medium: 14,
|
|
428
|
+
small: 12
|
|
429
|
+
};
|
|
430
|
+
const SIZE_PADDING_MAP = {
|
|
431
|
+
large: 48,
|
|
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,15 @@ 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";
|
|
543
|
+
const operationFontSize = COMPONENT_FONT_MAP[globalComponentSize.value ?? "medium"] ?? 14;
|
|
527
544
|
const operationIdx = reColumns.findIndex((item) => item.colKey === "operation");
|
|
528
545
|
const defaultOperation = {
|
|
529
546
|
title: t("operationText"),
|
|
530
547
|
colKey: "operation",
|
|
531
548
|
align: "center",
|
|
532
549
|
fixed: "right",
|
|
533
|
-
width:
|
|
550
|
+
width: calcOperationWidth(reRowActions, data.value, operationSize, operationFontSize)
|
|
534
551
|
};
|
|
535
552
|
if (operationIdx > -1) {
|
|
536
553
|
reColumns[operationIdx] = {
|
|
@@ -579,7 +596,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
579
596
|
rowActions: reRowActions,
|
|
580
597
|
tools: reTools,
|
|
581
598
|
models: {
|
|
582
|
-
data:
|
|
599
|
+
data: propsData,
|
|
583
600
|
searchData: inSearchData,
|
|
584
601
|
selectedRowKeys: selectedRowKeys2,
|
|
585
602
|
activeRowKeys: activeRowKeys2,
|
|
@@ -740,6 +757,60 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
740
757
|
if (!hasChanged) return;
|
|
741
758
|
mergeColumns.value = newColumns;
|
|
742
759
|
};
|
|
760
|
+
function calcTextWidth(text, fontSize) {
|
|
761
|
+
return [...text].reduce((width, char) => {
|
|
762
|
+
if (char.charCodeAt(0) > 255) return width + fontSize;
|
|
763
|
+
return width + Math.round(fontSize * (/[A-Z]/.test(char) ? 0.79 : 0.57));
|
|
764
|
+
}, 0);
|
|
765
|
+
}
|
|
766
|
+
function getActionWidth(action, row, fontSize = 14) {
|
|
767
|
+
if (action.component) return Math.round(fontSize * 2);
|
|
768
|
+
let iconWidth = 0;
|
|
769
|
+
if (action.prefixIcon) {
|
|
770
|
+
const icon = action.prefixIcon?.__qdCompute && row !== void 0 ? action.prefixIcon(getConfigRendererCtx(action, {
|
|
771
|
+
row
|
|
772
|
+
}), void 0) : action.prefixIcon;
|
|
773
|
+
iconWidth = icon ? Math.round(fontSize * 1.43) : 0;
|
|
774
|
+
}
|
|
775
|
+
const {
|
|
776
|
+
content
|
|
777
|
+
} = action;
|
|
778
|
+
if (typeof content === "string") return calcTextWidth(content, fontSize) + iconWidth;
|
|
779
|
+
if (row !== void 0 && content?.__qdCompute) {
|
|
780
|
+
const text = content(getConfigRendererCtx(action, {
|
|
781
|
+
row
|
|
782
|
+
}), void 0);
|
|
783
|
+
return typeof text === "string" ? calcTextWidth(text, fontSize) + iconWidth : Math.round(fontSize * 2) + iconWidth;
|
|
784
|
+
}
|
|
785
|
+
return content === void 0 && !iconWidth ? 0 : Math.round(fontSize * 1.14);
|
|
786
|
+
}
|
|
787
|
+
function isActionVisible(action, row) {
|
|
788
|
+
if (!hasPermiOr(action.permi, false)) return false;
|
|
789
|
+
const {
|
|
790
|
+
ifRender
|
|
791
|
+
} = action;
|
|
792
|
+
if (ifRender?.__qdCompute) {
|
|
793
|
+
return ifRender(getConfigRendererCtx(action, {
|
|
794
|
+
row
|
|
795
|
+
}), void 0) !== false;
|
|
796
|
+
}
|
|
797
|
+
return ifRender !== false;
|
|
798
|
+
}
|
|
799
|
+
function calcOperationWidth(rowActions, rows, size = "medium", fontSize = 14) {
|
|
800
|
+
const permittedActions = rowActions.filter((action) => hasPermiOr(action.permi, false));
|
|
801
|
+
if (!permittedActions.length) return 0;
|
|
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 + 8;
|
|
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({
|