ele-admin-plus 1.2.2-beta.4 → 1.2.2-beta.5

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.
@@ -20,6 +20,7 @@ declare const _default: import('vue').DefineComponent<{
20
20
  itemClass: StringConstructor;
21
21
  itemStyle: import('vue').PropType<import('../ele-app/types').StyleValue>;
22
22
  row: import('vue').PropType<boolean | import('../ele-app/el').ElRowProps>;
23
+ allowUncheck: BooleanConstructor;
23
24
  }, {
24
25
  isChecked: (item: CheckCardItem) => boolean;
25
26
  handleItemClick: (item: CheckCardItem) => void;
@@ -46,6 +47,7 @@ declare const _default: import('vue').DefineComponent<{
46
47
  itemClass: StringConstructor;
47
48
  itemStyle: import('vue').PropType<import('../ele-app/types').StyleValue>;
48
49
  row: import('vue').PropType<boolean | import('../ele-app/el').ElRowProps>;
50
+ allowUncheck: BooleanConstructor;
49
51
  }>> & {
50
52
  "onUpdate:modelValue"?: ((_value: CheckedValue) => any) | undefined;
51
53
  onChange?: ((_value: CheckedValue) => any) | undefined;
@@ -55,5 +57,6 @@ declare const _default: import('vue').DefineComponent<{
55
57
  bordered: boolean;
56
58
  arrow: boolean;
57
59
  multiple: boolean;
60
+ allowUncheck: boolean;
58
61
  }, {}>;
59
62
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, resolveComponent, openBlock, createElementBlock, createBlock, normalizeProps, mergeProps, withCtx, Fragment, renderList, createVNode, normalizeStyle, normalizeClass, renderSlot, createTextVNode, toDisplayString } from "vue";
2
2
  import { ElRow, ElCol } from "element-plus";
3
- import { useFormValidate, valueIsChanged } from "../ele-basic-select/util";
3
+ import { useFormValidate, isEmptyValue, valueIsChanged } from "../ele-basic-select/util";
4
4
  import CardItem from "./components/card-item";
5
5
  import { checkCardProps, checkCardEmits } from "./props";
6
6
  const _sfc_main = defineComponent({
@@ -34,6 +34,10 @@ const _sfc_main = defineComponent({
34
34
  return;
35
35
  }
36
36
  if (!props.multiple) {
37
+ if (props.allowUncheck && !isEmptyValue(props.modelValue) && props.modelValue === item.value) {
38
+ updateModelValue(null);
39
+ return;
40
+ }
37
41
  updateModelValue(item.value);
38
42
  return;
39
43
  }
@@ -36,6 +36,8 @@ export declare const checkCardProps: {
36
36
  itemStyle: PropType<StyleValue>;
37
37
  /** 是否使用栅格布局 */
38
38
  row: PropType<boolean | ElRowProps>;
39
+ /** 单选时允许取消选中 */
40
+ allowUncheck: BooleanConstructor;
39
41
  };
40
42
  export type CheckCardProps = ExtractPropTypes<typeof checkCardProps>;
41
43
  /**
@@ -29,7 +29,9 @@ const checkCardProps = {
29
29
  /** 自定义卡片样式 */
30
30
  itemStyle: Object,
31
31
  /** 是否使用栅格布局 */
32
- row: [Boolean, Object]
32
+ row: [Boolean, Object],
33
+ /** 单选时允许取消选中 */
34
+ allowUncheck: Boolean
33
35
  };
34
36
  const checkCardEmits = {
35
37
  /** 更新选中值 */
@@ -322,7 +322,7 @@ export interface ExportDataItem {
322
322
  /** 列配置 */
323
323
  column?: Column;
324
324
  /** 文本 */
325
- text?: string;
325
+ text?: string | number | boolean | Record<string, any> | Array<any>;
326
326
  /** 所占列数 */
327
327
  colspan?: number;
328
328
  /** 所占行数 */
@@ -228,7 +228,7 @@ export declare function getRowKey(rowKey?: RowKey): string | ((row: DataItem) =>
228
228
  * @param index 行索引
229
229
  * @param pageIndex 序号列起始索引
230
230
  */
231
- export declare function getCellText(column: Column | undefined, row: DataItem, index: number, pageIndex?: number): string;
231
+ export declare function getCellText(column: Column | undefined, row: DataItem, index: number, pageIndex?: number): string | number | boolean | Record<string, any> | Array<any>;
232
232
  /**
233
233
  * 导出获取表头单元格文本
234
234
  * @param column 列配置
@@ -496,7 +496,7 @@ function getCellText(column, row, index, pageIndex) {
496
496
  if (typeof column.formatter === "function") {
497
497
  return column.formatter(row, column, propValue, index);
498
498
  }
499
- return propValue == null ? "" : String(propValue);
499
+ return propValue == null ? "" : propValue;
500
500
  }
501
501
  function getHeaderCellText(column, index) {
502
502
  if (!column) {
@@ -575,7 +575,7 @@ function getExportData(data, columns, spanMethod, pageIndex, showSummary, sumTex
575
575
  indent: node.level
576
576
  };
577
577
  if (column.type === "expand") {
578
- dataItem.text = showExpandIndex ? String(node.index + 1) : "";
578
+ dataItem.text = showExpandIndex ? node.index + 1 : "";
579
579
  if (showExpandIndex && !expandRowData.length) {
580
580
  dataItem.rowspan = 2;
581
581
  }
@@ -614,7 +614,7 @@ function getExportData(data, columns, spanMethod, pageIndex, showSummary, sumTex
614
614
  bodyRowData.unshift({
615
615
  key: `_index_${index}-${i}`,
616
616
  index,
617
- text: i === node.level ? String(node.index + 1) : void 0,
617
+ text: i === node.level ? node.index + 1 : void 0,
618
618
  colspan,
619
619
  rowspan: i === node.level ? node.childSize + 1 : colspan,
620
620
  isTreeIndex: true,
@@ -65,7 +65,7 @@ declare const _default: import('vue').DefineComponent<{
65
65
  colType: import('vue').ComputedRef<string>;
66
66
  cellClass: import('vue').ComputedRef<string>;
67
67
  cellStyle: import('vue').ComputedRef<StyleValues | undefined>;
68
- cellText: import('vue').ComputedRef<string | undefined>;
68
+ cellText: import('vue').ComputedRef<string | number | undefined>;
69
69
  isExpandCol: import('vue').ComputedRef<boolean>;
70
70
  renderOpt: import('vue').ComputedRef<CustomRenderProps>;
71
71
  handleTextClick: (e: MouseEvent) => void;
@@ -46,7 +46,7 @@ const _sfc_main = defineComponent({
46
46
  },
47
47
  setup(props, { emit }) {
48
48
  const getKey = (column, columnIndex) => {
49
- return props.headerIndex + "-" + (column.key ?? columnIndex);
49
+ return props.headerIndex + "-" + String(column.key ?? columnIndex);
50
50
  };
51
51
  const getFiltered = (column) => {
52
52
  return getColFiltered(column.originalCol, props.filtered);
@@ -223,7 +223,17 @@ export interface CellParams {
223
223
  */
224
224
  export interface CustomRenderProps {
225
225
  /** 自定义渲染方法 */
226
- render?: (...params: any) => string | VNode | VNode[] | number | undefined;
226
+ render?: (
227
+ ...params: any
228
+ ) =>
229
+ | string
230
+ | VNode
231
+ | VNode[]
232
+ | number
233
+ | boolean
234
+ | Record<string, any>
235
+ | Array<any>
236
+ | undefined;
227
237
  /** 自定义渲染参数 */
228
238
  params?: Array<any>;
229
239
  }
@@ -125,9 +125,7 @@ export declare function isAutoRowHeight(hasExpandCol: boolean, bodyCols: BodyCol
125
125
  * @param props 属性
126
126
  * @param ctx SetupContext
127
127
  */
128
- export declare function CellRender(props: CustomRenderProps, ctx: SetupContext): (string | number | VNode<import('vue').RendererNode, import('vue').RendererElement, {
129
- [key: string]: any;
130
- }>)[] | undefined;
128
+ export declare function CellRender(props: CustomRenderProps, ctx: SetupContext): any[] | undefined;
131
129
  /**
132
130
  * 获取表头点击后的排序值
133
131
  * @param current 当前排序值
@@ -176,7 +174,7 @@ export declare function getTreeProps(treeProps?: TreeProps): TreeTableProps;
176
174
  * @param index 自定义起始索引
177
175
  * @param pageIndex 表格分页起始索引
178
176
  */
179
- export declare function getIndexValue(rowIndex: number, index?: ColumnIndex, pageIndex?: number): string;
177
+ export declare function getIndexValue(rowIndex: number, index?: ColumnIndex, pageIndex?: number): number;
180
178
  /**
181
179
  * 获取单元格的跨行和跨列
182
180
  * @param column 列配置
@@ -415,12 +415,12 @@ function getTreeProps(treeProps) {
415
415
  }
416
416
  function getIndexValue(rowIndex, index, pageIndex) {
417
417
  if (index == null) {
418
- return String((pageIndex ?? 1) + rowIndex);
418
+ return (pageIndex ?? 1) + rowIndex;
419
419
  }
420
420
  if (typeof index === "function") {
421
- return String(index(rowIndex));
421
+ return index(rowIndex);
422
422
  }
423
- return String(index + rowIndex);
423
+ return index + rowIndex;
424
424
  }
425
425
  function getCellSpan(params, spanMethod) {
426
426
  var _a;
@@ -35,6 +35,10 @@ const _sfc_main = vue.defineComponent({
35
35
  return;
36
36
  }
37
37
  if (!props2.multiple) {
38
+ if (props2.allowUncheck && !util.isEmptyValue(props2.modelValue) && props2.modelValue === item.value) {
39
+ updateModelValue(null);
40
+ return;
41
+ }
38
42
  updateModelValue(item.value);
39
43
  return;
40
44
  }
@@ -20,6 +20,7 @@ declare const _default: import('vue').DefineComponent<{
20
20
  itemClass: StringConstructor;
21
21
  itemStyle: import('vue').PropType<import('../ele-app/types').StyleValue>;
22
22
  row: import('vue').PropType<boolean | import('../ele-app/el').ElRowProps>;
23
+ allowUncheck: BooleanConstructor;
23
24
  }, {
24
25
  isChecked: (item: CheckCardItem) => boolean;
25
26
  handleItemClick: (item: CheckCardItem) => void;
@@ -46,6 +47,7 @@ declare const _default: import('vue').DefineComponent<{
46
47
  itemClass: StringConstructor;
47
48
  itemStyle: import('vue').PropType<import('../ele-app/types').StyleValue>;
48
49
  row: import('vue').PropType<boolean | import('../ele-app/el').ElRowProps>;
50
+ allowUncheck: BooleanConstructor;
49
51
  }>> & {
50
52
  "onUpdate:modelValue"?: ((_value: CheckedValue) => any) | undefined;
51
53
  onChange?: ((_value: CheckedValue) => any) | undefined;
@@ -55,5 +57,6 @@ declare const _default: import('vue').DefineComponent<{
55
57
  bordered: boolean;
56
58
  arrow: boolean;
57
59
  multiple: boolean;
60
+ allowUncheck: boolean;
58
61
  }, {}>;
59
62
  export default _default;
@@ -31,7 +31,9 @@ const checkCardProps = {
31
31
  /** 自定义卡片样式 */
32
32
  itemStyle: Object,
33
33
  /** 是否使用栅格布局 */
34
- row: [Boolean, Object]
34
+ row: [Boolean, Object],
35
+ /** 单选时允许取消选中 */
36
+ allowUncheck: Boolean
35
37
  };
36
38
  const checkCardEmits = {
37
39
  /** 更新选中值 */
@@ -36,6 +36,8 @@ export declare const checkCardProps: {
36
36
  itemStyle: PropType<StyleValue>;
37
37
  /** 是否使用栅格布局 */
38
38
  row: PropType<boolean | ElRowProps>;
39
+ /** 单选时允许取消选中 */
40
+ allowUncheck: BooleanConstructor;
39
41
  };
40
42
  export type CheckCardProps = ExtractPropTypes<typeof checkCardProps>;
41
43
  /**
@@ -322,7 +322,7 @@ export interface ExportDataItem {
322
322
  /** 列配置 */
323
323
  column?: Column;
324
324
  /** 文本 */
325
- text?: string;
325
+ text?: string | number | boolean | Record<string, any> | Array<any>;
326
326
  /** 所占列数 */
327
327
  colspan?: number;
328
328
  /** 所占行数 */
@@ -498,7 +498,7 @@ function getCellText(column, row, index, pageIndex) {
498
498
  if (typeof column.formatter === "function") {
499
499
  return column.formatter(row, column, propValue, index);
500
500
  }
501
- return propValue == null ? "" : String(propValue);
501
+ return propValue == null ? "" : propValue;
502
502
  }
503
503
  function getHeaderCellText(column, index) {
504
504
  if (!column) {
@@ -577,7 +577,7 @@ function getExportData(data, columns, spanMethod, pageIndex, showSummary, sumTex
577
577
  indent: node.level
578
578
  };
579
579
  if (column.type === "expand") {
580
- dataItem.text = showExpandIndex ? String(node.index + 1) : "";
580
+ dataItem.text = showExpandIndex ? node.index + 1 : "";
581
581
  if (showExpandIndex && !expandRowData.length) {
582
582
  dataItem.rowspan = 2;
583
583
  }
@@ -616,7 +616,7 @@ function getExportData(data, columns, spanMethod, pageIndex, showSummary, sumTex
616
616
  bodyRowData.unshift({
617
617
  key: `_index_${index}-${i}`,
618
618
  index,
619
- text: i === node.level ? String(node.index + 1) : void 0,
619
+ text: i === node.level ? node.index + 1 : void 0,
620
620
  colspan,
621
621
  rowspan: i === node.level ? node.childSize + 1 : colspan,
622
622
  isTreeIndex: true,
@@ -228,7 +228,7 @@ export declare function getRowKey(rowKey?: RowKey): string | ((row: DataItem) =>
228
228
  * @param index 行索引
229
229
  * @param pageIndex 序号列起始索引
230
230
  */
231
- export declare function getCellText(column: Column | undefined, row: DataItem, index: number, pageIndex?: number): string;
231
+ export declare function getCellText(column: Column | undefined, row: DataItem, index: number, pageIndex?: number): string | number | boolean | Record<string, any> | Array<any>;
232
232
  /**
233
233
  * 导出获取表头单元格文本
234
234
  * @param column 列配置
@@ -65,7 +65,7 @@ declare const _default: import('vue').DefineComponent<{
65
65
  colType: import('vue').ComputedRef<string>;
66
66
  cellClass: import('vue').ComputedRef<string>;
67
67
  cellStyle: import('vue').ComputedRef<StyleValues | undefined>;
68
- cellText: import('vue').ComputedRef<string | undefined>;
68
+ cellText: import('vue').ComputedRef<string | number | undefined>;
69
69
  isExpandCol: import('vue').ComputedRef<boolean>;
70
70
  renderOpt: import('vue').ComputedRef<CustomRenderProps>;
71
71
  handleTextClick: (e: MouseEvent) => void;
@@ -47,7 +47,7 @@ const _sfc_main = vue.defineComponent({
47
47
  },
48
48
  setup(props, { emit }) {
49
49
  const getKey = (column, columnIndex) => {
50
- return props.headerIndex + "-" + (column.key ?? columnIndex);
50
+ return props.headerIndex + "-" + String(column.key ?? columnIndex);
51
51
  };
52
52
  const getFiltered = (column) => {
53
53
  return util.getColFiltered(column.originalCol, props.filtered);
@@ -223,7 +223,17 @@ export interface CellParams {
223
223
  */
224
224
  export interface CustomRenderProps {
225
225
  /** 自定义渲染方法 */
226
- render?: (...params: any) => string | VNode | VNode[] | number | undefined;
226
+ render?: (
227
+ ...params: any
228
+ ) =>
229
+ | string
230
+ | VNode
231
+ | VNode[]
232
+ | number
233
+ | boolean
234
+ | Record<string, any>
235
+ | Array<any>
236
+ | undefined;
227
237
  /** 自定义渲染参数 */
228
238
  params?: Array<any>;
229
239
  }
@@ -417,12 +417,12 @@ function getTreeProps(treeProps) {
417
417
  }
418
418
  function getIndexValue(rowIndex, index, pageIndex) {
419
419
  if (index == null) {
420
- return String((pageIndex ?? 1) + rowIndex);
420
+ return (pageIndex ?? 1) + rowIndex;
421
421
  }
422
422
  if (typeof index === "function") {
423
- return String(index(rowIndex));
423
+ return index(rowIndex);
424
424
  }
425
- return String(index + rowIndex);
425
+ return index + rowIndex;
426
426
  }
427
427
  function getCellSpan(params, spanMethod) {
428
428
  var _a;
@@ -125,9 +125,7 @@ export declare function isAutoRowHeight(hasExpandCol: boolean, bodyCols: BodyCol
125
125
  * @param props 属性
126
126
  * @param ctx SetupContext
127
127
  */
128
- export declare function CellRender(props: CustomRenderProps, ctx: SetupContext): (string | number | VNode<import('vue').RendererNode, import('vue').RendererElement, {
129
- [key: string]: any;
130
- }>)[] | undefined;
128
+ export declare function CellRender(props: CustomRenderProps, ctx: SetupContext): any[] | undefined;
131
129
  /**
132
130
  * 获取表头点击后的排序值
133
131
  * @param current 当前排序值
@@ -176,7 +174,7 @@ export declare function getTreeProps(treeProps?: TreeProps): TreeTableProps;
176
174
  * @param index 自定义起始索引
177
175
  * @param pageIndex 表格分页起始索引
178
176
  */
179
- export declare function getIndexValue(rowIndex: number, index?: ColumnIndex, pageIndex?: number): string;
177
+ export declare function getIndexValue(rowIndex: number, index?: ColumnIndex, pageIndex?: number): number;
180
178
  /**
181
179
  * 获取单元格的跨行和跨列
182
180
  * @param column 列配置
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ele-admin-plus",
3
- "version": "1.2.2-beta.4",
3
+ "version": "1.2.2-beta.5",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite --host --config vite.global.ts",