完全跑通1.0版本
This commit is contained in:
85
frontend/node_modules/element-plus/lib/components/table/src/table-footer/index.d.ts
generated
vendored
Normal file
85
frontend/node_modules/element-plus/lib/components/table/src/table-footer/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
import { TableColumnCtx } from "../table-column/defaults.js";
|
||||
import TableLayout from "../table-layout.js";
|
||||
import { DefaultRow, Sort, SummaryMethod } from "../table/defaults.js";
|
||||
import { Store } from "../store/index.js";
|
||||
import * as _$vue from "vue";
|
||||
import { PropType } from "vue";
|
||||
|
||||
//#region ../../packages/components/table/src/table-footer/index.d.ts
|
||||
interface TableFooter<T extends DefaultRow> {
|
||||
fixed: string;
|
||||
store: Store<T>;
|
||||
summaryMethod: SummaryMethod<T>;
|
||||
sumText: string;
|
||||
border: boolean;
|
||||
defaultSort: Sort;
|
||||
}
|
||||
declare const _default: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
||||
fixed: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
store: {
|
||||
required: true;
|
||||
type: PropType<TableFooter<any>["store"]>;
|
||||
};
|
||||
summaryMethod: PropType<TableFooter<any>["summaryMethod"]>;
|
||||
sumText: StringConstructor;
|
||||
border: BooleanConstructor;
|
||||
defaultSort: {
|
||||
type: PropType<TableFooter<any>["defaultSort"]>;
|
||||
default: () => {
|
||||
prop: string;
|
||||
order: string;
|
||||
};
|
||||
};
|
||||
}>, {
|
||||
ns: {
|
||||
namespace: _$vue.ComputedRef<string>;
|
||||
b: (blockSuffix?: string) => string;
|
||||
e: (element?: string) => string;
|
||||
m: (modifier?: string) => string;
|
||||
be: (blockSuffix?: string, element?: string) => string;
|
||||
em: (element?: string, modifier?: string) => string;
|
||||
bm: (blockSuffix?: string, modifier?: string) => string;
|
||||
bem: (blockSuffix?: string, element?: string, modifier?: string) => string;
|
||||
is: {
|
||||
(name: string, state: boolean | undefined): string;
|
||||
(name: string): string;
|
||||
};
|
||||
cssVar: (object: Record<string, string>) => Record<string, string>;
|
||||
cssVarName: (name: string) => string;
|
||||
cssVarBlock: (object: Record<string, string>) => Record<string, string>;
|
||||
cssVarBlockName: (name: string) => string;
|
||||
};
|
||||
onScrollableChange: (layout: TableLayout<any>) => void;
|
||||
onColumnsChange: (layout: TableLayout<any>) => void;
|
||||
getCellClasses: (columns: TableColumnCtx<any>[], cellIndex: number) => string[];
|
||||
getCellStyles: (column: TableColumnCtx<any>, cellIndex: number) => _$vue.CSSProperties | undefined;
|
||||
columns: _$vue.ComputedRef<TableColumnCtx<DefaultRow>[]>;
|
||||
}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{
|
||||
fixed: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
store: {
|
||||
required: true;
|
||||
type: PropType<TableFooter<any>["store"]>;
|
||||
};
|
||||
summaryMethod: PropType<TableFooter<any>["summaryMethod"]>;
|
||||
sumText: StringConstructor;
|
||||
border: BooleanConstructor;
|
||||
defaultSort: {
|
||||
type: PropType<TableFooter<any>["defaultSort"]>;
|
||||
default: () => {
|
||||
prop: string;
|
||||
order: string;
|
||||
};
|
||||
};
|
||||
}>> & Readonly<{}>, {
|
||||
fixed: string;
|
||||
border: boolean;
|
||||
defaultSort: Sort;
|
||||
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
|
||||
//#endregion
|
||||
export { TableFooter, _default as default };
|
||||
93
frontend/node_modules/element-plus/lib/components/table/src/table-footer/index.js
generated
vendored
Normal file
93
frontend/node_modules/element-plus/lib/components/table/src/table-footer/index.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
Object.defineProperties(exports, {
|
||||
__esModule: { value: true },
|
||||
[Symbol.toStringTag]: { value: "Module" }
|
||||
});
|
||||
require("../../../../_virtual/_rolldown/runtime.js");
|
||||
const require_index = require("../../../../hooks/use-namespace/index.js");
|
||||
const require_layout_observer = require("../layout-observer.js");
|
||||
const require_tokens = require("../tokens.js");
|
||||
const require_style_helper = require("./style-helper.js");
|
||||
let vue = require("vue");
|
||||
//#region ../../packages/components/table/src/table-footer/index.ts
|
||||
var table_footer_default = (0, vue.defineComponent)({
|
||||
name: "ElTableFooter",
|
||||
props: {
|
||||
fixed: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
store: {
|
||||
required: true,
|
||||
type: Object
|
||||
},
|
||||
summaryMethod: Function,
|
||||
sumText: String,
|
||||
border: Boolean,
|
||||
defaultSort: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
prop: "",
|
||||
order: ""
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
setup(props) {
|
||||
const parent = (0, vue.inject)(require_tokens.TABLE_INJECTION_KEY);
|
||||
const ns = require_index.useNamespace("table");
|
||||
const { getCellClasses, getCellStyles, columns } = require_style_helper.default(props);
|
||||
const { onScrollableChange, onColumnsChange } = require_layout_observer.default(parent);
|
||||
return {
|
||||
ns,
|
||||
onScrollableChange,
|
||||
onColumnsChange,
|
||||
getCellClasses,
|
||||
getCellStyles,
|
||||
columns
|
||||
};
|
||||
},
|
||||
render() {
|
||||
const { columns, getCellStyles, getCellClasses, summaryMethod, sumText } = this;
|
||||
const data = this.store.states.data.value;
|
||||
let sums = [];
|
||||
if (summaryMethod) sums = summaryMethod({
|
||||
columns,
|
||||
data
|
||||
});
|
||||
else columns.forEach((column, index) => {
|
||||
if (index === 0) {
|
||||
sums[index] = sumText;
|
||||
return;
|
||||
}
|
||||
const values = data.map((item) => Number(item[column.property]));
|
||||
const precisions = [];
|
||||
let notNumber = true;
|
||||
values.forEach((value) => {
|
||||
if (!Number.isNaN(+value)) {
|
||||
notNumber = false;
|
||||
const decimal = `${value}`.split(".")[1];
|
||||
precisions.push(decimal ? decimal.length : 0);
|
||||
}
|
||||
});
|
||||
const precision = Math.max.apply(null, precisions);
|
||||
if (!notNumber) sums[index] = values.reduce((prev, curr) => {
|
||||
const value = Number(curr);
|
||||
if (!Number.isNaN(+value)) return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
|
||||
else return prev;
|
||||
}, 0);
|
||||
else sums[index] = "";
|
||||
});
|
||||
return (0, vue.h)((0, vue.h)("tfoot", [(0, vue.h)("tr", {}, [...columns.map((column, cellIndex) => (0, vue.h)("td", {
|
||||
key: cellIndex,
|
||||
colspan: column.colSpan,
|
||||
rowspan: column.rowSpan,
|
||||
class: getCellClasses(columns, cellIndex),
|
||||
style: getCellStyles(column, cellIndex)
|
||||
}, [(0, vue.h)("div", { class: ["cell", column.labelClassName] }, [sums[cellIndex]])]))])]));
|
||||
}
|
||||
});
|
||||
//#endregion
|
||||
exports.default = table_footer_default;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
frontend/node_modules/element-plus/lib/components/table/src/table-footer/index.js.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/lib/components/table/src/table-footer/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
15
frontend/node_modules/element-plus/lib/components/table/src/table-footer/mapState-helper.d.ts
generated
vendored
Normal file
15
frontend/node_modules/element-plus/lib/components/table/src/table-footer/mapState-helper.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { TableColumnCtx } from "../table-column/defaults.js";
|
||||
import { DefaultRow } from "../table/defaults.js";
|
||||
import * as _$vue from "vue";
|
||||
|
||||
//#region ../../packages/components/table/src/table-footer/mapState-helper.d.ts
|
||||
declare function useMapState(): {
|
||||
leftFixedLeafCount: _$vue.ComputedRef<number>;
|
||||
rightFixedLeafCount: _$vue.ComputedRef<number>;
|
||||
columnsCount: _$vue.ComputedRef<number>;
|
||||
leftFixedCount: _$vue.ComputedRef<number>;
|
||||
rightFixedCount: _$vue.ComputedRef<number>;
|
||||
columns: _$vue.ComputedRef<TableColumnCtx<DefaultRow>[]>;
|
||||
};
|
||||
//#endregion
|
||||
export { useMapState as default };
|
||||
33
frontend/node_modules/element-plus/lib/components/table/src/table-footer/mapState-helper.js
generated
vendored
Normal file
33
frontend/node_modules/element-plus/lib/components/table/src/table-footer/mapState-helper.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
Object.defineProperties(exports, {
|
||||
__esModule: { value: true },
|
||||
[Symbol.toStringTag]: { value: "Module" }
|
||||
});
|
||||
require("../../../../_virtual/_rolldown/runtime.js");
|
||||
const require_tokens = require("../tokens.js");
|
||||
let vue = require("vue");
|
||||
//#region ../../packages/components/table/src/table-footer/mapState-helper.ts
|
||||
function useMapState() {
|
||||
const store = (0, vue.inject)(require_tokens.TABLE_INJECTION_KEY)?.store;
|
||||
return {
|
||||
leftFixedLeafCount: (0, vue.computed)(() => {
|
||||
return store?.states.fixedLeafColumnsLength.value ?? 0;
|
||||
}),
|
||||
rightFixedLeafCount: (0, vue.computed)(() => {
|
||||
return store?.states.rightFixedColumns.value.length ?? 0;
|
||||
}),
|
||||
columnsCount: (0, vue.computed)(() => {
|
||||
return store?.states.columns.value.length ?? 0;
|
||||
}),
|
||||
leftFixedCount: (0, vue.computed)(() => {
|
||||
return store?.states.fixedColumns.value.length ?? 0;
|
||||
}),
|
||||
rightFixedCount: (0, vue.computed)(() => {
|
||||
return store?.states.rightFixedColumns.value.length ?? 0;
|
||||
}),
|
||||
columns: (0, vue.computed)(() => store?.states.columns.value ?? [])
|
||||
};
|
||||
}
|
||||
//#endregion
|
||||
exports.default = useMapState;
|
||||
|
||||
//# sourceMappingURL=mapState-helper.js.map
|
||||
1
frontend/node_modules/element-plus/lib/components/table/src/table-footer/mapState-helper.js.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/lib/components/table/src/table-footer/mapState-helper.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"mapState-helper.js","names":["TABLE_INJECTION_KEY"],"sources":["../../../../../../../packages/components/table/src/table-footer/mapState-helper.ts"],"sourcesContent":["import { computed, inject } from 'vue'\nimport { TABLE_INJECTION_KEY } from '../tokens'\n\nfunction useMapState() {\n const table = inject(TABLE_INJECTION_KEY)\n const store = table?.store\n const leftFixedLeafCount = computed(() => {\n return store?.states.fixedLeafColumnsLength.value ?? 0\n })\n const rightFixedLeafCount = computed(() => {\n return store?.states.rightFixedColumns.value.length ?? 0\n })\n const columnsCount = computed(() => {\n return store?.states.columns.value.length ?? 0\n })\n const leftFixedCount = computed(() => {\n return store?.states.fixedColumns.value.length ?? 0\n })\n const rightFixedCount = computed(() => {\n return store?.states.rightFixedColumns.value.length ?? 0\n })\n\n return {\n leftFixedLeafCount,\n rightFixedLeafCount,\n columnsCount,\n leftFixedCount,\n rightFixedCount,\n columns: computed(() => store?.states.columns.value ?? []),\n }\n}\n\nexport default useMapState\n"],"mappings":";;;;;;;;AAGA,SAAS,cAAc;CAErB,MAAM,SAAA,GAAA,IAAA,QADeA,eAAAA,oBACF,EAAE;CAiBrB,OAAO;EACL,qBAAA,GAAA,IAAA,gBAjBwC;GACxC,OAAO,OAAO,OAAO,uBAAuB,SAAS;IAgBnC;EAClB,sBAAA,GAAA,IAAA,gBAfyC;GACzC,OAAO,OAAO,OAAO,kBAAkB,MAAM,UAAU;IAcpC;EACnB,eAAA,GAAA,IAAA,gBAbkC;GAClC,OAAO,OAAO,OAAO,QAAQ,MAAM,UAAU;IAYjC;EACZ,iBAAA,GAAA,IAAA,gBAXoC;GACpC,OAAO,OAAO,OAAO,aAAa,MAAM,UAAU;IAUpC;EACd,kBAAA,GAAA,IAAA,gBATqC;GACrC,OAAO,OAAO,OAAO,kBAAkB,MAAM,UAAU;IAQxC;EACf,UAAA,GAAA,IAAA,gBAAwB,OAAO,OAAO,QAAQ,SAAS,EAAE,CAAC;EAC3D"}
|
||||
13
frontend/node_modules/element-plus/lib/components/table/src/table-footer/style-helper.d.ts
generated
vendored
Normal file
13
frontend/node_modules/element-plus/lib/components/table/src/table-footer/style-helper.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { TableColumnCtx } from "../table-column/defaults.js";
|
||||
import { DefaultRow } from "../table/defaults.js";
|
||||
import { TableFooter } from "./index.js";
|
||||
import * as _$vue from "vue";
|
||||
|
||||
//#region ../../packages/components/table/src/table-footer/style-helper.d.ts
|
||||
declare function useStyle<T extends DefaultRow>(props: TableFooter<T>): {
|
||||
getCellClasses: (columns: TableColumnCtx<T>[], cellIndex: number) => string[];
|
||||
getCellStyles: (column: TableColumnCtx<T>, cellIndex: number) => _$vue.CSSProperties | undefined;
|
||||
columns: _$vue.ComputedRef<TableColumnCtx<DefaultRow>[]>;
|
||||
};
|
||||
//#endregion
|
||||
export { useStyle as default };
|
||||
40
frontend/node_modules/element-plus/lib/components/table/src/table-footer/style-helper.js
generated
vendored
Normal file
40
frontend/node_modules/element-plus/lib/components/table/src/table-footer/style-helper.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
Object.defineProperties(exports, {
|
||||
__esModule: { value: true },
|
||||
[Symbol.toStringTag]: { value: "Module" }
|
||||
});
|
||||
const require_index = require("../../../../hooks/use-namespace/index.js");
|
||||
const require_util = require("../util.js");
|
||||
const require_mapState_helper = require("./mapState-helper.js");
|
||||
//#region ../../packages/components/table/src/table-footer/style-helper.ts
|
||||
function useStyle(props) {
|
||||
const { columns } = require_mapState_helper.default();
|
||||
const ns = require_index.useNamespace("table");
|
||||
const getCellClasses = (columns, cellIndex) => {
|
||||
const column = columns[cellIndex];
|
||||
const classes = [
|
||||
ns.e("cell"),
|
||||
column.id,
|
||||
column.align,
|
||||
column.labelClassName,
|
||||
...require_util.getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
|
||||
];
|
||||
if (column.className) classes.push(column.className);
|
||||
if (!column.children) classes.push(ns.is("leaf"));
|
||||
return classes;
|
||||
};
|
||||
const getCellStyles = (column, cellIndex) => {
|
||||
const fixedStyle = require_util.getFixedColumnOffset(cellIndex, column.fixed, props.store);
|
||||
require_util.ensurePosition(fixedStyle, "left");
|
||||
require_util.ensurePosition(fixedStyle, "right");
|
||||
return fixedStyle;
|
||||
};
|
||||
return {
|
||||
getCellClasses,
|
||||
getCellStyles,
|
||||
columns
|
||||
};
|
||||
}
|
||||
//#endregion
|
||||
exports.default = useStyle;
|
||||
|
||||
//# sourceMappingURL=style-helper.js.map
|
||||
1
frontend/node_modules/element-plus/lib/components/table/src/table-footer/style-helper.js.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/lib/components/table/src/table-footer/style-helper.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"style-helper.js","names":["useMapState","useNamespace","getFixedColumnsClass","getFixedColumnOffset"],"sources":["../../../../../../../packages/components/table/src/table-footer/style-helper.ts"],"sourcesContent":["import { useNamespace } from '@element-plus/hooks'\nimport {\n ensurePosition,\n getFixedColumnOffset,\n getFixedColumnsClass,\n} from '../util'\nimport useMapState from './mapState-helper'\n\nimport type { TableColumnCtx } from '../table-column/defaults'\nimport type { DefaultRow } from '../table/defaults'\nimport type { TableFooter } from '.'\n\nfunction useStyle<T extends DefaultRow>(props: TableFooter<T>) {\n const { columns } = useMapState()\n const ns = useNamespace('table')\n\n const getCellClasses = (columns: TableColumnCtx<T>[], cellIndex: number) => {\n const column = columns[cellIndex]\n const classes = [\n ns.e('cell'),\n column.id,\n column.align,\n column.labelClassName,\n ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store),\n ]\n if (column.className) {\n classes.push(column.className)\n }\n if (!column.children) {\n classes.push(ns.is('leaf'))\n }\n return classes\n }\n\n const getCellStyles = (column: TableColumnCtx<T>, cellIndex: number) => {\n const fixedStyle = getFixedColumnOffset(\n cellIndex,\n column.fixed,\n props.store\n )\n ensurePosition(fixedStyle, 'left')\n ensurePosition(fixedStyle, 'right')\n return fixedStyle\n }\n\n return {\n getCellClasses,\n getCellStyles,\n columns,\n }\n}\n\nexport default useStyle\n"],"mappings":";;;;;;;;AAYA,SAAS,SAA+B,OAAuB;CAC7D,MAAM,EAAE,YAAYA,wBAAAA,SAAa;CACjC,MAAM,KAAKC,cAAAA,aAAa,QAAQ;CAEhC,MAAM,kBAAkB,SAA8B,cAAsB;EAC1E,MAAM,SAAS,QAAQ;EACvB,MAAM,UAAU;GACd,GAAG,EAAE,OAAO;GACZ,OAAO;GACP,OAAO;GACP,OAAO;GACP,GAAGC,aAAAA,qBAAqB,GAAG,GAAG,EAAE,WAAW,OAAO,OAAO,MAAM,MAAM;GACtE;EACD,IAAI,OAAO,WACT,QAAQ,KAAK,OAAO,UAAU;EAEhC,IAAI,CAAC,OAAO,UACV,QAAQ,KAAK,GAAG,GAAG,OAAO,CAAC;EAE7B,OAAO;;CAGT,MAAM,iBAAiB,QAA2B,cAAsB;EACtE,MAAM,aAAaC,aAAAA,qBACjB,WACA,OAAO,OACP,MAAM,MACP;EACD,aAAA,eAAe,YAAY,OAAO;EAClC,aAAA,eAAe,YAAY,QAAQ;EACnC,OAAO;;CAGT,OAAO;EACL;EACA;EACA;EACD"}
|
||||
Reference in New Issue
Block a user