fix(api): use bcrypt directly instead of passlib for compatibility

This commit is contained in:
bwstudio
2026-05-21 22:18:36 +08:00
parent 7f51d200f1
commit 4651781bc3
23511 changed files with 2587254 additions and 8 deletions
@@ -0,0 +1,225 @@
import { TableOverflowTooltipFormatter, TableOverflowTooltipOptions } from "../util.js";
import { DefaultRow, Table, TableSortOrder } from "../table/defaults.js";
import { Store } from "../store/index.js";
import { ComponentInternalInstance, PropType, Ref, VNode } from "vue";
//#region ../../packages/components/table/src/table-column/defaults.d.ts
type CI<T extends DefaultRow> = {
column: TableColumnCtx<T>;
$index: number;
store: Store<T>;
_self: any;
};
type Filters = {
text: string;
value: string;
}[];
type FilterMethods<T extends DefaultRow> = (value: string, row: T, column: TableColumnCtx<T>) => void;
type ValueOf<T> = T[keyof T];
type TableColumnCtx<T extends DefaultRow = DefaultRow> = {
id: string;
realWidth: number | null;
type: string;
label: string;
className: string;
labelClassName: string;
property: string;
prop: string;
width?: string | number;
minWidth: string | number;
renderHeader: (data: CI<T>) => VNode;
sortable: boolean | string;
sortMethod: (a: T, b: T) => number;
sortBy: string | ((row: T, index: number, array?: T[]) => string) | string[];
resizable: boolean;
columnKey: string;
rawColumnKey: string;
align: string;
headerAlign: string;
showOverflowTooltip?: boolean | TableOverflowTooltipOptions;
tooltipFormatter?: TableOverflowTooltipFormatter<T>;
fixed: boolean | string;
formatter: (row: T, column: TableColumnCtx<T>, cellValue: any, index: number) => VNode | string;
selectable: (row: T, index: number) => boolean;
reserveSelection: boolean;
filterMethod: FilterMethods<T>;
filteredValue: string[];
filters: Filters;
filterPlacement: string;
filterMultiple: boolean;
filterClassName: string;
index: number | ((index: number) => number);
sortOrders: (TableSortOrder | null)[];
renderCell: (data: any) => VNode | VNode[];
colSpan: number;
rowSpan: number;
children?: TableColumnCtx<T>[];
level: number;
filterable: boolean | FilterMethods<T> | Filters;
order: TableSortOrder | null;
isColumnGroup: boolean;
isSubColumn: boolean;
columns: TableColumnCtx<T>[];
getColumnIndex: () => number;
no: number;
filterOpened?: boolean;
renderFilterIcon?: (scope: any) => VNode;
renderExpand?: (scope: any) => VNode;
};
interface TableColumn<T extends DefaultRow> extends ComponentInternalInstance {
vnode: {
vParent: TableColumn<T> | Table<T>;
} & VNode;
vParent: TableColumn<T> | Table<T>;
columnId: string;
columnConfig: Ref<Partial<TableColumnCtx<T>>>;
}
declare const _default: {
/**
* @description type of the column. If set to `selection`, the column will display checkbox. If set to `index`, the column will display index of the row (staring from 1). If set to `expand`, the column will display expand icon
*/
type: {
type: StringConstructor;
default: string;
};
/**
* @description column label
*/
label: StringConstructor;
/**
* @description class name of cells in the column
*/
className: StringConstructor;
/**
* @description class name of the label of this column
*/
labelClassName: StringConstructor;
/**
* @description
*/
property: StringConstructor;
/**
* @description field name. You can also use its alias: `property`
*/
prop: StringConstructor;
/**
* @description column width
*/
width: {
type: (StringConstructor | NumberConstructor)[];
default: string;
};
/**
* @description column minimum width. Columns with `width` has a fixed width, while columns with `min-width` has a width that is distributed in proportion
*/
minWidth: {
type: (StringConstructor | NumberConstructor)[];
default: string;
};
/**
* @description render function for table header of this column
*/
renderHeader: PropType<TableColumnCtx<any>["renderHeader"]>;
/**
* @description whether column can be sorted. Remote sorting can be done by setting this attribute to 'custom' and listening to the `sort-change` event of Table
*/
sortable: {
type: (BooleanConstructor | StringConstructor)[];
default: boolean;
};
/**
* @description sorting method, works when `sortable` is `true`. Should return a number, just like Array.sort
*/
sortMethod: PropType<TableColumnCtx<any>["sortMethod"]>;
/**
* @description specify which property to sort by, works when `sortable` is `true` and `sort-method` is `undefined`. If set to an Array, the column will sequentially sort by the next property if the previous one is equal
*/
sortBy: PropType<TableColumnCtx<any>["sortBy"]>;
/**
* @description whether column width can be resized, works when `border` of `el-table` is `true`
*/
resizable: {
type: BooleanConstructor;
default: boolean;
};
/**
* @description column's key. If you need to use the filter-change event, you need this attribute to identify which column is being filtered
*/
columnKey: StringConstructor;
/**
* @description alignment, the value should be 'left' \/ 'center' \/ 'right'
*/
align: StringConstructor;
/**
* @description alignment of the table header. If omitted, the value of the above `align` attribute will be applied, the value should be 'left' \/ 'center' \/ 'right'
*/
headerAlign: StringConstructor;
/**
* @description whether to hide extra content and show them in a tooltip when hovering on the cell
*/
showOverflowTooltip: {
type: PropType<TableColumnCtx<any>["showOverflowTooltip"]>;
default: undefined;
};
/**
* @description function that formats cell tooltip content, works when `show-overflow-tooltip` is `true`
*/
tooltipFormatter: PropType<TableColumnCtx<any>["tooltipFormatter"]>;
/**
* @description whether column is fixed at left / right. Will be fixed at left if `true`
*/
fixed: (BooleanConstructor | StringConstructor)[];
/**
* @description function that formats cell content
*/
formatter: PropType<TableColumnCtx<any>["formatter"]>;
/**
* @description function that determines if a certain row can be selected, works when `type` is 'selection'
*/
selectable: PropType<TableColumnCtx<any>["selectable"]>;
/**
* @description whether to reserve selection after data refreshing, works when `type` is 'selection'. Note that `row-key` is required for this to work
*/
reserveSelection: BooleanConstructor;
/**
* @description data filtering method. If `filter-multiple` is on, this method will be called multiple times for each row, and a row will display if one of the calls returns `true`
*/
filterMethod: PropType<TableColumnCtx<any>["filterMethod"]>;
/**
* @description filter value for selected data, might be useful when table header is rendered with `render-header`
*/
filteredValue: PropType<TableColumnCtx<any>["filteredValue"]>;
/**
* @description an array of data filtering options. For each element in this array, `text` and `value` are required
*/
filters: PropType<TableColumnCtx<any>["filters"]>;
/**
* @description placement for the filter dropdown
*/
filterPlacement: StringConstructor;
/**
* @description whether data filtering supports multiple options
*/
filterMultiple: {
type: BooleanConstructor;
default: boolean;
};
/**
* @description className for the filter dropdown
*/
filterClassName: StringConstructor;
/**
* @description customize indices for each row, works on columns with `type=index`
*/
index: PropType<TableColumnCtx<any>["index"]>;
/**
* @description the order of the sorting strategies used when sorting the data, works when `sortable` is `true`. Accepts an array, as the user clicks on the header, the column is sorted in order of the elements in the array
*/
sortOrders: {
type: PropType<TableColumnCtx<any>["sortOrders"]>;
default: () => (string | null)[];
validator: (val: TableColumnCtx<any>["sortOrders"]) => boolean;
};
};
//#endregion
export { type FilterMethods, type Filters, type TableColumn, type TableColumnCtx, type ValueOf, _default as default };
@@ -0,0 +1,172 @@
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
//#region ../../packages/components/table/src/table-column/defaults.ts
var defaults_default = {
/**
* @description type of the column. If set to `selection`, the column will display checkbox. If set to `index`, the column will display index of the row (staring from 1). If set to `expand`, the column will display expand icon
*/
type: {
type: String,
default: "default"
},
/**
* @description column label
*/
label: String,
/**
* @description class name of cells in the column
*/
className: String,
/**
* @description class name of the label of this column
*/
labelClassName: String,
/**
* @description
*/
property: String,
/**
* @description field name. You can also use its alias: `property`
*/
prop: String,
/**
* @description column width
*/
width: {
type: [String, Number],
default: ""
},
/**
* @description column minimum width. Columns with `width` has a fixed width, while columns with `min-width` has a width that is distributed in proportion
*/
minWidth: {
type: [String, Number],
default: ""
},
/**
* @description render function for table header of this column
*/
renderHeader: Function,
/**
* @description whether column can be sorted. Remote sorting can be done by setting this attribute to 'custom' and listening to the `sort-change` event of Table
*/
sortable: {
type: [Boolean, String],
default: false
},
/**
* @description sorting method, works when `sortable` is `true`. Should return a number, just like Array.sort
*/
sortMethod: Function,
/**
* @description specify which property to sort by, works when `sortable` is `true` and `sort-method` is `undefined`. If set to an Array, the column will sequentially sort by the next property if the previous one is equal
*/
sortBy: [
String,
Function,
Array
],
/**
* @description whether column width can be resized, works when `border` of `el-table` is `true`
*/
resizable: {
type: Boolean,
default: true
},
/**
* @description column's key. If you need to use the filter-change event, you need this attribute to identify which column is being filtered
*/
columnKey: String,
/**
* @description alignment, the value should be 'left' \/ 'center' \/ 'right'
*/
align: String,
/**
* @description alignment of the table header. If omitted, the value of the above `align` attribute will be applied, the value should be 'left' \/ 'center' \/ 'right'
*/
headerAlign: String,
/**
* @description whether to hide extra content and show them in a tooltip when hovering on the cell
*/
showOverflowTooltip: {
type: [Boolean, Object],
default: void 0
},
/**
* @description function that formats cell tooltip content, works when `show-overflow-tooltip` is `true`
*/
tooltipFormatter: Function,
/**
* @description whether column is fixed at left / right. Will be fixed at left if `true`
*/
fixed: [Boolean, String],
/**
* @description function that formats cell content
*/
formatter: Function,
/**
* @description function that determines if a certain row can be selected, works when `type` is 'selection'
*/
selectable: Function,
/**
* @description whether to reserve selection after data refreshing, works when `type` is 'selection'. Note that `row-key` is required for this to work
*/
reserveSelection: Boolean,
/**
* @description data filtering method. If `filter-multiple` is on, this method will be called multiple times for each row, and a row will display if one of the calls returns `true`
*/
filterMethod: Function,
/**
* @description filter value for selected data, might be useful when table header is rendered with `render-header`
*/
filteredValue: Array,
/**
* @description an array of data filtering options. For each element in this array, `text` and `value` are required
*/
filters: Array,
/**
* @description placement for the filter dropdown
*/
filterPlacement: String,
/**
* @description whether data filtering supports multiple options
*/
filterMultiple: {
type: Boolean,
default: true
},
/**
* @description className for the filter dropdown
*/
filterClassName: String,
/**
* @description customize indices for each row, works on columns with `type=index`
*/
index: [Number, Function],
/**
* @description the order of the sorting strategies used when sorting the data, works when `sortable` is `true`. Accepts an array, as the user clicks on the header, the column is sorted in order of the elements in the array
*/
sortOrders: {
type: Array,
default: () => {
return [
"ascending",
"descending",
null
];
},
validator: (val) => {
return val.every((order) => [
"ascending",
"descending",
null
].includes(order));
}
}
};
//#endregion
exports.default = defaults_default;
//# sourceMappingURL=defaults.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,227 @@
import { UseTooltipProps } from "../../../tooltip/src/tooltip.js";
import { CheckboxProps, CheckboxValueType } from "../../../checkbox/src/checkbox.js";
import _default$1 from "../../../checkbox/src/checkbox-button.vue.js";
import _default$2 from "../../../checkbox/src/checkbox-group.vue.js";
import { TableColumnCtx } from "./defaults.js";
import { TableSortOrder } from "../table/defaults.js";
import * as _$vue from "vue";
//#region ../../packages/components/table/src/table-column/index.d.ts
declare const _default: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
type: {
type: StringConstructor;
default: string;
};
label: StringConstructor;
className: StringConstructor;
labelClassName: StringConstructor;
property: StringConstructor;
prop: StringConstructor;
width: {
type: (StringConstructor | NumberConstructor)[];
default: string;
};
minWidth: {
type: (StringConstructor | NumberConstructor)[];
default: string;
};
renderHeader: _$vue.PropType<TableColumnCtx<any>["renderHeader"]>;
sortable: {
type: (BooleanConstructor | StringConstructor)[];
default: boolean;
};
sortMethod: _$vue.PropType<TableColumnCtx<any>["sortMethod"]>;
sortBy: _$vue.PropType<TableColumnCtx<any>["sortBy"]>;
resizable: {
type: BooleanConstructor;
default: boolean;
};
columnKey: StringConstructor;
align: StringConstructor;
headerAlign: StringConstructor;
showOverflowTooltip: {
type: _$vue.PropType<TableColumnCtx<any>["showOverflowTooltip"]>;
default: undefined;
};
tooltipFormatter: _$vue.PropType<TableColumnCtx<any>["tooltipFormatter"]>;
fixed: (BooleanConstructor | StringConstructor)[];
formatter: _$vue.PropType<TableColumnCtx<any>["formatter"]>;
selectable: _$vue.PropType<TableColumnCtx<any>["selectable"]>;
reserveSelection: BooleanConstructor;
filterMethod: _$vue.PropType<TableColumnCtx<any>["filterMethod"]>;
filteredValue: _$vue.PropType<TableColumnCtx<any>["filteredValue"]>;
filters: _$vue.PropType<TableColumnCtx<any>["filters"]>;
filterPlacement: StringConstructor;
filterMultiple: {
type: BooleanConstructor;
default: boolean;
};
filterClassName: StringConstructor;
index: _$vue.PropType<TableColumnCtx<any>["index"]>;
sortOrders: {
type: _$vue.PropType<TableColumnCtx<any>["sortOrders"]>;
default: () => (string | null)[];
validator: (val: TableColumnCtx<any>["sortOrders"]) => boolean;
};
}>, void, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{
type: {
type: StringConstructor;
default: string;
};
label: StringConstructor;
className: StringConstructor;
labelClassName: StringConstructor;
property: StringConstructor;
prop: StringConstructor;
width: {
type: (StringConstructor | NumberConstructor)[];
default: string;
};
minWidth: {
type: (StringConstructor | NumberConstructor)[];
default: string;
};
renderHeader: _$vue.PropType<TableColumnCtx<any>["renderHeader"]>;
sortable: {
type: (BooleanConstructor | StringConstructor)[];
default: boolean;
};
sortMethod: _$vue.PropType<TableColumnCtx<any>["sortMethod"]>;
sortBy: _$vue.PropType<TableColumnCtx<any>["sortBy"]>;
resizable: {
type: BooleanConstructor;
default: boolean;
};
columnKey: StringConstructor;
align: StringConstructor;
headerAlign: StringConstructor;
showOverflowTooltip: {
type: _$vue.PropType<TableColumnCtx<any>["showOverflowTooltip"]>;
default: undefined;
};
tooltipFormatter: _$vue.PropType<TableColumnCtx<any>["tooltipFormatter"]>;
fixed: (BooleanConstructor | StringConstructor)[];
formatter: _$vue.PropType<TableColumnCtx<any>["formatter"]>;
selectable: _$vue.PropType<TableColumnCtx<any>["selectable"]>;
reserveSelection: BooleanConstructor;
filterMethod: _$vue.PropType<TableColumnCtx<any>["filterMethod"]>;
filteredValue: _$vue.PropType<TableColumnCtx<any>["filteredValue"]>;
filters: _$vue.PropType<TableColumnCtx<any>["filters"]>;
filterPlacement: StringConstructor;
filterMultiple: {
type: BooleanConstructor;
default: boolean;
};
filterClassName: StringConstructor;
index: _$vue.PropType<TableColumnCtx<any>["index"]>;
sortOrders: {
type: _$vue.PropType<TableColumnCtx<any>["sortOrders"]>;
default: () => (string | null)[];
validator: (val: TableColumnCtx<any>["sortOrders"]) => boolean;
};
}>> & Readonly<{}>, {
type: string;
minWidth: string | number;
width: string | number;
resizable: boolean;
showOverflowTooltip: boolean | Partial<Pick<UseTooltipProps, "offset" | "appendTo" | "effect" | "enterable" | "popperClass" | "placement" | "popperOptions" | "showArrow" | "transition" | "showAfter" | "hideAfter">> | undefined;
sortOrders: (TableSortOrder | null)[];
sortable: string | boolean;
reserveSelection: boolean;
filterMultiple: boolean;
}, {}, {
ElCheckbox: {
new (...args: any[]): _$vue.CreateComponentPublicInstanceWithMixins<Readonly<CheckboxProps> & Readonly<{
"onUpdate:modelValue"?: ((val: CheckboxValueType) => any) | undefined;
onChange?: ((val: CheckboxValueType) => any) | undefined;
}>, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {
change: (val: CheckboxValueType) => void;
"update:modelValue": (val: CheckboxValueType) => void;
}, _$vue.PublicProps, {
name: string;
label: string | boolean | number | object;
disabled: boolean;
modelValue: number | string | boolean;
id: string;
validateEvent: boolean;
value: string | boolean | number | object;
trueValue: string | number;
falseValue: string | number;
trueLabel: string | number;
falseLabel: string | number;
}, false, {}, {}, _$vue.GlobalComponents, _$vue.GlobalDirectives, string, {}, any, _$vue.ComponentProvideOptions, {
P: {};
B: {};
D: {};
C: {};
M: {};
Defaults: {};
}, Readonly<CheckboxProps> & Readonly<{
"onUpdate:modelValue"?: ((val: CheckboxValueType) => any) | undefined;
onChange?: ((val: CheckboxValueType) => any) | undefined;
}>, {}, {}, {}, {}, {
name: string;
label: string | boolean | number | object;
disabled: boolean;
modelValue: number | string | boolean;
id: string;
validateEvent: boolean;
value: string | boolean | number | object;
trueValue: string | number;
falseValue: string | number;
trueLabel: string | number;
falseLabel: string | number;
}>;
__isFragment?: never;
__isTeleport?: never;
__isSuspense?: never;
} & _$vue.ComponentOptionsBase<Readonly<CheckboxProps> & Readonly<{
"onUpdate:modelValue"?: ((val: CheckboxValueType) => any) | undefined;
onChange?: ((val: CheckboxValueType) => any) | undefined;
}>, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {
change: (val: CheckboxValueType) => void;
"update:modelValue": (val: CheckboxValueType) => void;
}, string, {
name: string;
label: string | boolean | number | object;
disabled: boolean;
modelValue: number | string | boolean;
id: string;
validateEvent: boolean;
value: string | boolean | number | object;
trueValue: string | number;
falseValue: string | number;
trueLabel: string | number;
falseLabel: string | number;
}, {}, string, {}, _$vue.GlobalComponents, _$vue.GlobalDirectives, string, _$vue.ComponentProvideOptions> & _$vue.VNodeProps & _$vue.AllowedComponentProps & _$vue.ComponentCustomProps & (new () => {
$slots: {
default?: (props: {}) => any;
};
}) & _$vue.ObjectPlugin & {
setPropsDefaults: (defaults: {
readonly modelValue?: string | number | boolean | (() => string | number | boolean) | undefined;
readonly label?: string | number | boolean | (() => string | number | boolean | object) | undefined;
readonly value?: string | number | boolean | (() => string | number | boolean | object) | undefined;
readonly indeterminate?: boolean | (() => boolean) | undefined;
readonly disabled?: boolean | (() => boolean) | undefined;
readonly checked?: boolean | (() => boolean) | undefined;
readonly name?: string | (() => string) | undefined;
readonly trueValue?: string | number | (() => string | number) | undefined;
readonly falseValue?: string | number | (() => string | number) | undefined;
readonly trueLabel?: string | number | (() => string | number) | undefined;
readonly falseLabel?: string | number | (() => string | number) | undefined;
readonly id?: string | (() => string) | undefined;
readonly border?: boolean | (() => boolean) | undefined;
readonly size?: "" | "default" | "small" | "large" | (() => "" | "default" | "small" | "large") | undefined;
readonly tabindex?: string | number | (() => string | number) | undefined;
readonly validateEvent?: boolean | (() => boolean) | undefined;
readonly ariaLabel?: string | (() => string) | undefined;
readonly ariaControls?: string | (() => string) | undefined;
}) => void;
} & {
CheckboxButton: typeof _default$1;
CheckboxGroup: typeof _default$2;
};
}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
//#endregion
export { _default as default };
@@ -0,0 +1,127 @@
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
require("../../../../_virtual/_rolldown/runtime.js");
const require_types = require("../../../../utils/types.js");
const require_use_global_config = require("../../../config-provider/src/hooks/use-global-config.js");
const require_index = require("../../../checkbox/index.js");
const require_util = require("../util.js");
const require_config = require("../config.js");
const require_watcher_helper = require("./watcher-helper.js");
const require_render_helper = require("./render-helper.js");
const require_defaults = require("./defaults.js");
let vue = require("vue");
let _vue_shared = require("@vue/shared");
//#region ../../packages/components/table/src/table-column/index.ts
let columnIdSeed = 1;
var table_column_default = (0, vue.defineComponent)({
name: "ElTableColumn",
components: { ElCheckbox: require_index.ElCheckbox },
props: require_defaults.default,
setup(props, { slots }) {
const instance = (0, vue.getCurrentInstance)();
const globalConfig = require_use_global_config.useGlobalConfig("table");
const columnConfig = (0, vue.ref)({});
const owner = (0, vue.computed)(() => {
let parent = instance.parent;
while (parent && !parent.tableId) parent = parent.parent;
return parent;
});
const { registerNormalWatchers, registerComplexWatchers } = require_watcher_helper.default(owner, props);
const { columnId, isSubColumn, realHeaderAlign, columnOrTableParent, setColumnWidth, setColumnForcedProps, setColumnRenders, getPropsData, getColumnElIndex, realAlign, updateColumnOrder } = require_render_helper.default(props, slots, owner);
const parent = columnOrTableParent.value;
columnId.value = `${"tableId" in parent && parent.tableId || "columnId" in parent && parent.columnId}_column_${columnIdSeed++}`;
(0, vue.onBeforeMount)(() => {
isSubColumn.value = owner.value !== parent;
const type = props.type || "default";
const sortable = props.sortable === "" ? true : props.sortable;
const showOverflowTooltip = type === "selection" ? false : require_types.isUndefined(props.showOverflowTooltip) ? parent.props.showOverflowTooltip ?? globalConfig.value?.showOverflowTooltip : props.showOverflowTooltip;
const tooltipFormatter = require_types.isUndefined(props.tooltipFormatter) ? parent.props.tooltipFormatter ?? globalConfig.value?.tooltipFormatter : props.tooltipFormatter;
const defaults = {
...require_config.cellStarts[type],
id: columnId.value,
type,
property: props.prop || props.property,
align: realAlign,
headerAlign: realHeaderAlign,
showOverflowTooltip,
tooltipFormatter,
filterable: props.filters || props.filterMethod,
filteredValue: [],
filterPlacement: "",
filterClassName: "",
isColumnGroup: false,
isSubColumn: false,
filterOpened: false,
sortable,
index: props.index,
rawColumnKey: instance.vnode.key
};
let column = getPropsData([
"columnKey",
"label",
"className",
"labelClassName",
"type",
"renderHeader",
"formatter",
"fixed",
"resizable"
], [
"sortMethod",
"sortBy",
"sortOrders"
], ["selectable", "reserveSelection"], [
"filterMethod",
"filters",
"filterMultiple",
"filterOpened",
"filteredValue",
"filterPlacement",
"filterClassName"
]);
column = require_util.mergeOptions(defaults, column);
column = require_util.compose(setColumnRenders, setColumnWidth, setColumnForcedProps)(column);
columnConfig.value = column;
registerNormalWatchers();
registerComplexWatchers();
});
(0, vue.onMounted)(() => {
const parent = columnOrTableParent.value;
const children = isSubColumn.value ? parent.vnode.el?.children : parent.refs.hiddenColumns?.children;
const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
columnConfig.value.getColumnIndex = getColumnIndex;
getColumnIndex() > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? "columnConfig" in parent && parent.columnConfig.value : null, updateColumnOrder);
});
(0, vue.onBeforeUnmount)(() => {
const getColumnIndex = columnConfig.value.getColumnIndex;
(getColumnIndex ? getColumnIndex() : -1) > -1 && owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? "columnConfig" in parent && parent.columnConfig.value : null, updateColumnOrder);
});
instance.columnId = columnId.value;
instance.columnConfig = columnConfig;
},
render() {
try {
const renderDefault = this.$slots.default?.({
row: {},
column: {},
$index: -1
});
const children = [];
if ((0, _vue_shared.isArray)(renderDefault)) {
for (const childNode of renderDefault) if (childNode.type?.name === "ElTableColumn" || childNode.shapeFlag & 2) children.push(childNode);
else if (childNode.type === vue.Fragment && (0, _vue_shared.isArray)(childNode.children)) childNode.children.forEach((vnode) => {
if (vnode?.patchFlag !== 1024 && !(0, _vue_shared.isString)(vnode?.children)) children.push(vnode);
});
}
return (0, vue.h)("div", children);
} catch {
return (0, vue.h)("div", []);
}
}
});
//#endregion
exports.default = table_column_default;
//# sourceMappingURL=index.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,21 @@
import { TableColumn, TableColumnCtx } from "./defaults.js";
import { DefaultRow, Table } from "../table/defaults.js";
import * as _$vue from "vue";
import { ComputedRef, RendererNode, Slots } from "vue";
//#region ../../packages/components/table/src/table-column/render-helper.d.ts
declare function useRender<T extends DefaultRow>(props: TableColumnCtx<T>, slots: Slots, owner: ComputedRef<Table<T>>): {
columnId: _$vue.Ref<string, string>;
realAlign: _$vue.Ref<string | null | undefined, string | null | undefined>;
isSubColumn: _$vue.Ref<boolean, boolean>;
realHeaderAlign: _$vue.Ref<string | null | undefined, string | null | undefined>;
columnOrTableParent: ComputedRef<Table<T> | TableColumn<T>>;
setColumnWidth: (column: TableColumnCtx<T>) => TableColumnCtx<T>;
setColumnForcedProps: (column: TableColumnCtx<T>) => TableColumnCtx<T>;
setColumnRenders: (column: TableColumnCtx<T>) => TableColumnCtx<T>;
getPropsData: (...propsKey: string[][]) => Record<string, any>;
getColumnElIndex: (children: T[], child: RendererNode | null) => number;
updateColumnOrder: () => void;
};
//#endregion
export { useRender as default };
@@ -0,0 +1,150 @@
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
require("../../../../_virtual/_rolldown/runtime.js");
const require_types = require("../../../../utils/types.js");
const require_error = require("../../../../utils/error.js");
const require_index = require("../../../../hooks/use-namespace/index.js");
const require_util = require("../util.js");
const require_config = require("../config.js");
let vue = require("vue");
let _vue_shared = require("@vue/shared");
//#region ../../packages/components/table/src/table-column/render-helper.ts
function useRender(props, slots, owner) {
const instance = (0, vue.getCurrentInstance)();
const columnId = (0, vue.ref)("");
const isSubColumn = (0, vue.ref)(false);
const realAlign = (0, vue.ref)();
const realHeaderAlign = (0, vue.ref)();
const ns = require_index.useNamespace("table");
(0, vue.watchEffect)(() => {
realAlign.value = props.align ? `is-${props.align}` : null;
realAlign.value;
});
(0, vue.watchEffect)(() => {
realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
realHeaderAlign.value;
});
const columnOrTableParent = (0, vue.computed)(() => {
let parent = instance.vnode.vParent || instance.parent;
while (parent && !parent.tableId && !parent.columnId) parent = parent.vnode.vParent || parent.parent;
return parent;
});
const hasTreeColumn = (0, vue.computed)(() => {
const { store } = instance.parent;
if (!store) return false;
const { treeData } = store.states;
const treeDataValue = treeData.value;
return treeDataValue && Object.keys(treeDataValue).length > 0;
});
const realWidth = (0, vue.ref)(require_util.parseWidth(props.width));
const realMinWidth = (0, vue.ref)(require_util.parseMinWidth(props.minWidth));
const setColumnWidth = (column) => {
if (realWidth.value) column.width = realWidth.value;
if (realMinWidth.value) column.minWidth = realMinWidth.value;
if (!realWidth.value && realMinWidth.value) column.width = void 0;
if (!column.minWidth) column.minWidth = 80;
column.realWidth = Number(require_types.isUndefined(column.width) ? column.minWidth : column.width);
return column;
};
const setColumnForcedProps = (column) => {
const type = column.type;
const source = require_config.cellForced[type] || {};
Object.keys(source).forEach((prop) => {
const value = source[prop];
if (prop !== "className" && !require_types.isUndefined(value)) column[prop] = value;
});
const className = require_config.getDefaultClassName(type);
if (className) {
const forceClass = `${(0, vue.unref)(ns.namespace)}-${className}`;
column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
}
return column;
};
const checkSubColumn = (children) => {
if ((0, _vue_shared.isArray)(children)) children.forEach((child) => check(child));
else check(children);
function check(item) {
if (item?.type?.name === "ElTableColumn") item.vParent = instance;
}
};
const setColumnRenders = (column) => {
if (props.renderHeader) require_error.debugWarn("TableColumn", "Comparing to render-header, scoped-slot header is easier to use. We recommend users to use scoped-slot header.");
else if (column.type !== "selection") column.renderHeader = (scope) => {
instance.columnConfig.value["label"];
if (slots.header) {
const slotResult = slots.header(scope);
if (require_util.ensureValidVNode(slotResult)) return (0, vue.h)(vue.Fragment, slotResult);
}
return (0, vue.createTextVNode)(column.label);
};
if (slots["filter-icon"]) column.renderFilterIcon = (scope) => {
return (0, vue.renderSlot)(slots, "filter-icon", scope);
};
if (slots.expand) column.renderExpand = (scope) => {
return (0, vue.renderSlot)(slots, "expand", scope);
};
let originRenderCell = column.renderCell;
if (column.type === "expand") {
column.renderCell = (data) => (0, vue.h)("div", { class: "cell" }, [originRenderCell(data)]);
owner.value.renderExpanded = (row) => {
return slots.default ? slots.default(row) : slots.default;
};
} else {
originRenderCell = originRenderCell || require_config.defaultRenderCell;
column.renderCell = (data) => {
let children = null;
if (slots.default) {
const vnodes = slots.default(data);
children = vnodes.some((v) => v.type !== vue.Comment) ? vnodes : originRenderCell(data);
} else children = originRenderCell(data);
const { columns } = owner.value.store.states;
const firstUserColumnIndex = columns.value.findIndex((item) => item.type === "default");
const prefix = require_config.treeCellPrefix(data, hasTreeColumn.value && data.cellIndex === firstUserColumnIndex);
const props = {
class: "cell",
style: {}
};
if (column.showOverflowTooltip) {
props.class = `${props.class} ${(0, vue.unref)(ns.namespace)}-tooltip`;
props.style = { width: `${(data.column.realWidth || Number(data.column.width)) - 1}px` };
}
checkSubColumn(children);
return (0, vue.h)("div", props, [prefix, children]);
};
}
return column;
};
const getPropsData = (...propsKey) => {
return propsKey.reduce((prev, cur) => {
if ((0, _vue_shared.isArray)(cur)) cur.forEach((key) => {
prev[key] = props[key];
});
return prev;
}, {});
};
const getColumnElIndex = (children, child) => {
return Array.prototype.indexOf.call(children, child);
};
const updateColumnOrder = () => {
owner.value.store.commit("updateColumnOrder", instance.columnConfig.value);
};
return {
columnId,
realAlign,
isSubColumn,
realHeaderAlign,
columnOrTableParent,
setColumnWidth,
setColumnForcedProps,
setColumnRenders,
getPropsData,
getColumnElIndex,
updateColumnOrder
};
}
//#endregion
exports.default = useRender;
//# sourceMappingURL=render-helper.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
import { TableColumnCtx } from "./defaults.js";
import { DefaultRow } from "../table/defaults.js";
import { ComputedRef } from "vue";
//#region ../../packages/components/table/src/table-column/watcher-helper.d.ts
declare function useWatcher<T extends DefaultRow>(owner: ComputedRef<any>, props_: Partial<TableColumnCtx<T>>): {
registerComplexWatchers: () => void;
registerNormalWatchers: () => void;
};
//#endregion
export { useWatcher as default };
@@ -0,0 +1,92 @@
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
require("../../../../_virtual/_rolldown/runtime.js");
const require_types = require("../../../../utils/types.js");
const require_use_global_config = require("../../../config-provider/src/hooks/use-global-config.js");
const require_util = require("../util.js");
let vue = require("vue");
let _vue_shared = require("@vue/shared");
//#region ../../packages/components/table/src/table-column/watcher-helper.ts
function getAllAliases(props, aliases) {
return props.reduce((prev, cur) => {
prev[cur] = cur;
return prev;
}, aliases);
}
function useWatcher(owner, props_) {
const instance = (0, vue.getCurrentInstance)();
const registerComplexWatchers = () => {
const props = ["fixed"];
const aliases = {
realWidth: "width",
realMinWidth: "minWidth"
};
const allAliases = getAllAliases(props, aliases);
Object.keys(allAliases).forEach((key) => {
const columnKey = aliases[key];
if ((0, _vue_shared.hasOwn)(props_, columnKey)) (0, vue.watch)(() => props_[columnKey], (newVal) => {
let value = newVal;
if (columnKey === "width" && key === "realWidth") value = require_util.parseWidth(newVal);
if (columnKey === "minWidth" && key === "realMinWidth") value = require_util.parseMinWidth(newVal);
instance.columnConfig.value[columnKey] = value;
instance.columnConfig.value[key] = value;
const updateColumns = columnKey === "fixed";
owner.value.store.scheduleLayout(updateColumns);
});
});
};
const registerNormalWatchers = () => {
const props = [
"label",
"filters",
"filterMultiple",
"filteredValue",
"sortable",
"index",
"formatter",
"className",
"labelClassName",
"filterClassName",
"showOverflowTooltip",
"tooltipFormatter",
"resizable"
];
const parentProps = ["showOverflowTooltip"];
const aliases = {
property: "prop",
align: "realAlign",
headerAlign: "realHeaderAlign"
};
const allAliases = getAllAliases(props, aliases);
Object.keys(allAliases).forEach((key) => {
const columnKey = aliases[key];
if ((0, _vue_shared.hasOwn)(props_, columnKey)) (0, vue.watch)(() => props_[columnKey], (newVal) => {
instance.columnConfig.value[key] = newVal;
if (key === "filters" || key === "filterMethod") instance.columnConfig.value["filterable"] = !!(instance.columnConfig.value["filters"] || instance.columnConfig.value["filterMethod"]);
});
});
parentProps.forEach((key) => {
if ((0, _vue_shared.hasOwn)(owner.value.props, key)) (0, vue.watch)(() => owner.value.props[key], (newVal) => {
if (instance.columnConfig.value.type === "selection") return;
if (!require_types.isUndefined(props_[key])) return;
instance.columnConfig.value[key] = newVal;
});
});
const globalConfig = require_use_global_config.useGlobalConfig("table");
if (globalConfig.value && (0, _vue_shared.hasOwn)(globalConfig.value, "showOverflowTooltip")) (0, vue.watch)(() => globalConfig.value?.showOverflowTooltip, (newVal) => {
if (instance.columnConfig.value.type === "selection") return;
if (!require_types.isUndefined(props_.showOverflowTooltip) || !require_types.isUndefined(owner.value.props.showOverflowTooltip)) return;
instance.columnConfig.value.showOverflowTooltip = newVal;
});
};
return {
registerComplexWatchers,
registerNormalWatchers
};
}
//#endregion
exports.default = useWatcher;
//# sourceMappingURL=watcher-helper.js.map
File diff suppressed because one or more lines are too long