cosey 0.2.12 → 0.2.13

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.
@@ -76,7 +76,7 @@ export { defaultBreakpoints, defaultRowProps, generateAlgorithms, rowColumns, ro
76
76
  export { snugMenuContextSymbol } from './snug-menu/snug-menu.js';
77
77
  export { getFocusVisibleStyle, getLineClampStyle, getTruncateStyle } from './style/mixins.js';
78
78
  export { contrarotation, rotation, rotation45, spinner } from './style/animation.js';
79
- export { defaultPaginationProps, defaultTableConfig, elSlotsName, omittedTableProps, tableExposeKeys, tableProps } from './table/table.js';
79
+ export { defaultTableConfig, elSlotsName, omittedTableProps, tableExposeKeys, tableProps } from './table/table.js';
80
80
  export { useTable } from './table/useTable.js';
81
81
  export { defaultTableActionProps } from './table-action/table-action.js';
82
82
  export { StyleCache, StyleProvider } from './theme/StyleContext.js';
@@ -1,6 +1,6 @@
1
1
  import { withInstall } from '../utils.js';
2
2
  import stdin_default$1 from './table.vue.js';
3
- export { defaultPaginationProps, defaultTableConfig, elSlotsName, omittedTableProps, tableExposeKeys, tableProps } from './table.js';
3
+ export { defaultTableConfig, elSlotsName, omittedTableProps, tableExposeKeys, tableProps } from './table.js';
4
4
  export { useTable } from './useTable.js';
5
5
 
6
6
  const _Table = withInstall(stdin_default$1);
@@ -145,9 +145,6 @@ export interface TableSlots {
145
145
  export declare const elSlotsName: readonly ["default", "append", "empty"];
146
146
  type TableEmitEvents = 'select-all' | 'expand-change' | 'current-change' | 'select' | 'selection-change' | 'cell-mouse-enter' | 'cell-mouse-leave' | 'cell-contextmenu' | 'cell-click' | 'cell-dblclick' | 'row-click' | 'row-contextmenu' | 'row-dblclick' | 'header-click' | 'header-contextmenu' | 'sort-change' | 'filter-change' | 'header-dragend';
147
147
  export type TableEmits = (event: TableEmitEvents, ...args: any[]) => void;
148
- export declare const defaultPaginationProps: {
149
- layout: string;
150
- };
151
148
  export interface TableCustomExpose {
152
149
  reload: () => void;
153
150
  expandAll: () => void;
@@ -208,6 +205,11 @@ export declare const defaultTableConfig: {
208
205
  */
209
206
  desc: string;
210
207
  };
208
+ pagination: {
209
+ layout: string;
210
+ currentPage: number;
211
+ pageSize: number;
212
+ };
211
213
  };
212
214
  export interface TableConfig {
213
215
  keys?: {
@@ -220,5 +222,6 @@ export interface TableConfig {
220
222
  asc?: string;
221
223
  desc?: string;
222
224
  };
225
+ pagination?: Partial<PaginationProps>;
223
226
  }
224
227
  export {};
@@ -47,9 +47,6 @@ const tableProps = {
47
47
  };
48
48
  const omittedTableProps = Object.keys(tableExtraProps);
49
49
  const elSlotsName = ["default", "append", "empty"];
50
- const defaultPaginationProps = {
51
- layout: "prev, pager, next, sizes, jumper, total"
52
- };
53
50
  const elTableExposeKeys = [
54
51
  "clearSelection",
55
52
  "getSelectionRows",
@@ -110,7 +107,12 @@ const defaultTableConfig = {
110
107
  * 排序方向中“降序”的值
111
108
  */
112
109
  desc: "desc"
110
+ },
111
+ pagination: {
112
+ layout: "prev, pager, next, sizes, jumper, total",
113
+ currentPage: 1,
114
+ pageSize: 10
113
115
  }
114
116
  };
115
117
 
116
- export { defaultPaginationProps, defaultTableConfig, elSlotsName, omittedTableProps, tableExposeKeys, tableProps };
118
+ export { defaultTableConfig, elSlotsName, omittedTableProps, tableExposeKeys, tableProps };
@@ -2,7 +2,7 @@ import { defineComponent, useSlots, unref, computed, ref, useTemplateRef, mergeP
2
2
  import { merge, cloneDeep, get } from 'lodash-es';
3
3
  import { reactiveComputed, reactiveOmit } from '@vueuse/core';
4
4
  import { useZIndex, ElButton } from 'element-plus';
5
- import { tableProps, defaultTableConfig, elSlotsName, omittedTableProps, defaultPaginationProps, tableExposeKeys } from './table.js';
5
+ import { tableProps, defaultTableConfig, elSlotsName, omittedTableProps, tableExposeKeys } from './table.js';
6
6
  import stdin_default$6 from './table-column/table-column.vue.js';
7
7
  import stdin_default$5 from './table-column-editor/table-column-editor.vue.js';
8
8
  import stdin_default$2 from './table-query/table-query.vue.js';
@@ -11,7 +11,7 @@ import stdin_default$3 from '../icon/icon.vue.js';
11
11
  import { filterEmptyFormValue } from './utils.js';
12
12
  import stdin_default$1 from './style/index.js';
13
13
  import { useComponentConfig, useConfig } from '../config-provider/config-provider.js';
14
- import { isNullish, isFunction } from '../../utils/is.js';
14
+ import { isNullish, isObject, isFunction } from '../../utils/is.js';
15
15
  import { useFetch } from '../../hooks/useFetch.js';
16
16
  import { useFullPage } from '../../hooks/useFullPage.js';
17
17
  import { useLocale } from '../../hooks/useLocale.js';
@@ -52,10 +52,10 @@ var stdin_default = /* @__PURE__ */defineComponent({
52
52
  hashId
53
53
  } = stdin_default$1(prefixCls);
54
54
  const {
55
- table
55
+ table: tableConfig
56
56
  } = useConfig();
57
57
  const tableKeys = reactiveComputed(() => {
58
- return merge({}, defaultTableConfig.keys, unref(table)?.keys, props.keys);
58
+ return merge({}, defaultTableConfig.keys, unref(tableConfig)?.keys, props.keys);
59
59
  });
60
60
  const passedElSlotsName = computed(() => {
61
61
  return elSlotsName.filter(name => !!slots[name]);
@@ -140,16 +140,18 @@ var stdin_default = /* @__PURE__ */defineComponent({
140
140
  execute();
141
141
  }
142
142
  });
143
+ const pagination = reactiveComputed(() => {
144
+ return merge({}, defaultTableConfig.pagination, unref(tableConfig)?.pagination, isObject(props.pagination) ? props.pagination : null);
145
+ });
143
146
  const total = ref(0);
144
- const page = ref(1);
145
- const pageSize = ref(10);
147
+ const page = ref(pagination.currentPage);
148
+ const pageSize = ref(pagination.pageSize);
146
149
  const paginationProps = computed(() => {
147
150
  if (props.pagination === false) {
148
151
  return false;
149
152
  }
150
153
  return {
151
- ...defaultPaginationProps,
152
- ...(typeof props.pagination === "object" ? props.pagination : null),
154
+ ...pagination,
153
155
  total: total.value
154
156
  };
155
157
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cosey",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "description": "基于 Vue3 + vite 的后台管理系统框架",
5
5
  "type": "module",
6
6
  "main": "index.js",