@qin-ui/element-plus-pro 1.0.0 → 1.0.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.
- package/es/element-plus-pro.css +8 -8
- package/es/index.d.ts +6 -3
- package/es/table/index.js +21 -49
- package/package.json +1 -1
package/es/element-plus-pro.css
CHANGED
|
@@ -34,33 +34,33 @@
|
|
|
34
34
|
.pro-table_size-control_button[data-v-7af52d04] svg {
|
|
35
35
|
transform: scale(1.3);
|
|
36
36
|
}
|
|
37
|
-
.pro-table_column-control_button[data-v-
|
|
37
|
+
.pro-table_column-control_button[data-v-5a488a1c] {
|
|
38
38
|
display: flex;
|
|
39
39
|
align-items: center;
|
|
40
40
|
padding-right: 12px;
|
|
41
41
|
padding-left: 12px;
|
|
42
42
|
}
|
|
43
|
-
.pro-table_column-control_button[data-v-
|
|
43
|
+
.pro-table_column-control_button[data-v-5a488a1c] svg {
|
|
44
44
|
transform: scale(1.2, 1.4);
|
|
45
45
|
}
|
|
46
|
-
.pro-table_header[data-v-
|
|
46
|
+
.pro-table_header[data-v-05f75d0b] {
|
|
47
47
|
display: flex;
|
|
48
48
|
align-items: center;
|
|
49
49
|
justify-content: flex-end;
|
|
50
50
|
}
|
|
51
|
-
.pro-table_header[data-v-
|
|
51
|
+
.pro-table_header[data-v-05f75d0b]:empty {
|
|
52
52
|
display: none;
|
|
53
53
|
}
|
|
54
|
-
.pro-table_header + .pro-table_header_content[data-v-
|
|
54
|
+
.pro-table_header + .pro-table_header_content[data-v-05f75d0b] {
|
|
55
55
|
margin-top: 16px;
|
|
56
56
|
}
|
|
57
|
-
.pro-table_header_button-bar[data-v-
|
|
57
|
+
.pro-table_header_button-bar[data-v-05f75d0b] {
|
|
58
58
|
flex: 1;
|
|
59
59
|
}
|
|
60
|
-
.pro-table_header_toolbar[data-v-
|
|
60
|
+
.pro-table_header_toolbar[data-v-05f75d0b] {
|
|
61
61
|
margin-left: 12px;
|
|
62
62
|
}
|
|
63
|
-
.pro-table_pagination[data-v-
|
|
63
|
+
.pro-table_pagination[data-v-05f75d0b] {
|
|
64
64
|
justify-content: flex-end;
|
|
65
65
|
padding: 16px 0;
|
|
66
66
|
}
|
package/es/index.d.ts
CHANGED
|
@@ -316,16 +316,19 @@ declare type BaseWithoutFields<D extends Data = Data> = BaseCommon<D> & {
|
|
|
316
316
|
modelProp?: string;
|
|
317
317
|
};
|
|
318
318
|
|
|
319
|
+
declare type BivariantRender<D extends Data = Data> = {
|
|
320
|
+
bivarianceHack(scope: ColumnScope<D>): any;
|
|
321
|
+
}['bivarianceHack'];
|
|
322
|
+
|
|
319
323
|
declare type ButtonProps = {
|
|
320
324
|
onClick: () => void;
|
|
321
325
|
};
|
|
322
326
|
|
|
323
|
-
export declare type Column<D extends Data = Data> = Partial<Omit<TableColumnCtx<
|
|
327
|
+
export declare type Column<D extends Data = Data> = Partial<Omit<TableColumnCtx<any>, 'prop' | 'property' | 'children' | 'render'>> & {
|
|
324
328
|
key?: Path<D>;
|
|
325
329
|
prop?: KeyExpandString<Extract<keyof D, string>> | Paths<D>;
|
|
326
330
|
hidden?: boolean;
|
|
327
|
-
|
|
328
|
-
render?: (scope: ColumnScope<D>) => any;
|
|
331
|
+
render?: BivariantRender<D>;
|
|
329
332
|
};
|
|
330
333
|
|
|
331
334
|
declare type ColumnFindBy<D extends Data, C extends BaseColumn<D> = BaseColumn<D>> = (column: Readonly<C>) => boolean;
|
package/es/table/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createElementBlock, openBlock, createElementVNode, defineComponent, ref, computed, watch, watchEffect, createBlock, unref, mergeProps, withKeys, withCtx, createVNode, renderSlot, resolveDynamicComponent, createTextVNode, createCommentVNode, Fragment, toDisplayString, normalizeStyle, useModel, renderList, withModifiers,
|
|
1
|
+
import { createElementBlock, openBlock, createElementVNode, defineComponent, ref, computed, watch, watchEffect, createBlock, unref, mergeProps, withKeys, withCtx, createVNode, renderSlot, resolveDynamicComponent, createTextVNode, createCommentVNode, Fragment, toDisplayString, normalizeStyle, useModel, renderList, withModifiers, mergeModels, inject, useAttrs, useSlots, onMounted, resolveDirective, normalizeClass, withDirectives, createSlots, normalizeProps, guardReactiveProps, nextTick } from "vue";
|
|
2
2
|
import { ElSpace, ElButton, ElDropdown, ElDropdownMenu, ElDropdownItem, ElCheckbox, ElTableColumn, ElTable, ElPagination } from "element-plus";
|
|
3
3
|
import { _ as _export_sfc, a as _sfc_main$a, t as tableProps, p as paginationProps, b as _sfc_main$b } from "../form/index-BvqMIOZ8.js";
|
|
4
4
|
import { INJECT_CONFIG } from "../component-provider/index.js";
|
|
@@ -337,22 +337,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
337
337
|
const open = ref(false);
|
|
338
338
|
const checkAll = ref(false);
|
|
339
339
|
const indeterminate = ref(false);
|
|
340
|
-
const flattenColumns = (cols) => {
|
|
341
|
-
return cols.flatMap((item) => {
|
|
342
|
-
var _a;
|
|
343
|
-
if ((_a = item.children) == null ? void 0 : _a.length) {
|
|
344
|
-
return flattenColumns(item.children);
|
|
345
|
-
}
|
|
346
|
-
return item;
|
|
347
|
-
});
|
|
348
|
-
};
|
|
349
340
|
const getColumnKey = (column, index) => {
|
|
350
341
|
const key = column.key ?? column.prop;
|
|
351
342
|
if (key === void 0 || key === null) return `__idx_${index}`;
|
|
352
343
|
return Array.isArray(key) ? key.join(".") : String(key);
|
|
353
344
|
};
|
|
354
345
|
const checkedColumnsOptions = computed(
|
|
355
|
-
() =>
|
|
346
|
+
() => __props.columns.map((item, index) => ({
|
|
356
347
|
label: String(item.label ?? item.prop ?? `列${index + 1}`),
|
|
357
348
|
value: getColumnKey(item, index),
|
|
358
349
|
checked: !item.hidden,
|
|
@@ -466,7 +457,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
466
457
|
};
|
|
467
458
|
}
|
|
468
459
|
});
|
|
469
|
-
const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
460
|
+
const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-5a488a1c"]]);
|
|
470
461
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
471
462
|
...{ name: "TableColumnRenderer" },
|
|
472
463
|
__name: "TableColumnRenderer",
|
|
@@ -485,19 +476,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
485
476
|
return get(row, toPath(path));
|
|
486
477
|
};
|
|
487
478
|
const normalizedColumns = computed(() => {
|
|
488
|
-
|
|
489
|
-
return source.flatMap((column) => {
|
|
490
|
-
if (column.hidden) return [];
|
|
491
|
-
const children = column.children || [];
|
|
492
|
-
const visibleChildren = children.length > 0 ? loop(children) : [];
|
|
493
|
-
if (children.length > 0 && visibleChildren.length === 0) return [];
|
|
494
|
-
return [{ ...column, children: visibleChildren }];
|
|
495
|
-
});
|
|
496
|
-
};
|
|
497
|
-
return loop(__props.columns);
|
|
479
|
+
return __props.columns.filter((column) => !column.hidden);
|
|
498
480
|
});
|
|
499
481
|
const getColumnProps = (column) => {
|
|
500
|
-
const {
|
|
482
|
+
const { hidden, render, key, ...rest } = column;
|
|
501
483
|
const prop = Array.isArray(column.prop) ? column.prop.join(".") : column.prop ? String(column.prop) : void 0;
|
|
502
484
|
return {
|
|
503
485
|
...rest,
|
|
@@ -506,7 +488,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
506
488
|
};
|
|
507
489
|
};
|
|
508
490
|
return (_ctx, _cache) => {
|
|
509
|
-
const _component_TableColumnRenderer = resolveComponent("TableColumnRenderer", true);
|
|
510
491
|
return openBlock(true), createElementBlock(Fragment, null, renderList(normalizedColumns.value, (column, index) => {
|
|
511
492
|
return openBlock(), createBlock(unref(ElTableColumn), mergeProps({
|
|
512
493
|
key: getColumnKey(column, index),
|
|
@@ -515,16 +496,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
515
496
|
default: withCtx((scope) => {
|
|
516
497
|
var _a;
|
|
517
498
|
return [
|
|
518
|
-
|
|
519
|
-
key: 0,
|
|
520
|
-
columns: column.children || []
|
|
521
|
-
}, null, 8, ["columns"])) : typeof column.render === "function" ? (openBlock(), createBlock(resolveDynamicComponent(
|
|
499
|
+
typeof column.render === "function" ? (openBlock(), createBlock(resolveDynamicComponent(
|
|
522
500
|
(_a = column.render) == null ? void 0 : _a.call(column, {
|
|
523
501
|
...scope,
|
|
524
502
|
column,
|
|
525
503
|
cellValue: getCellValue(scope.row, column)
|
|
526
504
|
})
|
|
527
|
-
), { key:
|
|
505
|
+
), { key: 0 })) : createCommentVNode("", true)
|
|
528
506
|
];
|
|
529
507
|
}),
|
|
530
508
|
_: 2
|
|
@@ -692,25 +670,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
692
670
|
});
|
|
693
671
|
const normalizedRawColumns = computed(() => {
|
|
694
672
|
const source = __props.columns ?? (tableColumns == null ? void 0 : tableColumns.value) ?? [];
|
|
695
|
-
const
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
current.children = normalize(current.children, `${prefix}-${index}`);
|
|
709
|
-
}
|
|
710
|
-
return current;
|
|
711
|
-
});
|
|
712
|
-
};
|
|
713
|
-
const normalized = normalize(source);
|
|
673
|
+
const normalized = source.map((item, index) => {
|
|
674
|
+
const current = { ...item };
|
|
675
|
+
if (current.label === void 0 && current.title !== void 0) {
|
|
676
|
+
current.label = current.title;
|
|
677
|
+
}
|
|
678
|
+
if (current.prop === void 0 && current.dataIndex !== void 0) {
|
|
679
|
+
current.prop = Array.isArray(current.dataIndex) ? current.dataIndex.join(".") : current.dataIndex;
|
|
680
|
+
}
|
|
681
|
+
if (current.key === void 0) {
|
|
682
|
+
current.key = current.prop ?? (typeof current.columnKey === "string" ? current.columnKey : void 0) ?? `col-${index}`;
|
|
683
|
+
}
|
|
684
|
+
return current;
|
|
685
|
+
});
|
|
714
686
|
if (__props.addIndexColumn ?? injectProps.addIndexColumn) {
|
|
715
687
|
return [
|
|
716
688
|
{
|
|
@@ -860,7 +832,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
860
832
|
};
|
|
861
833
|
}
|
|
862
834
|
});
|
|
863
|
-
const BaseTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
835
|
+
const BaseTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-05f75d0b"]]);
|
|
864
836
|
const useTable = (params = {}) => {
|
|
865
837
|
const { data, ...rest } = params;
|
|
866
838
|
const coreTable = useTable$1({
|