@dt-frames/ui 1.0.54 → 1.0.55

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.
@@ -22,6 +22,7 @@ export declare type SourceType = {
22
22
  baseUrl?: string;
23
23
  exportName?: string | ComputedRef;
24
24
  clearKeys?: Function;
25
+ defaultSize?: number;
25
26
  api: ApiObjType;
26
27
  };
27
28
  export declare type BaseDataType = {
@@ -144,6 +144,9 @@ declare const _default: import("vue").DefineComponent<{
144
144
  }>>>;
145
145
  default: {};
146
146
  };
147
+ pageSize: {
148
+ type: NumberConstructor;
149
+ };
147
150
  loading: {
148
151
  type: BooleanConstructor;
149
152
  default: boolean;
@@ -394,6 +397,7 @@ declare const _default: import("vue").DefineComponent<{
394
397
  indexColumnProps: import("./types/table.type").BasicColumn[];
395
398
  isTreeTable: boolean;
396
399
  toolbar?: import("@dt-frames/core").ButtonProps[];
400
+ pageSize?: number;
397
401
  minWidth?: number;
398
402
  maxWidth?: number;
399
403
  defSort?: any;
@@ -605,6 +609,9 @@ declare const _default: import("vue").DefineComponent<{
605
609
  }>>>;
606
610
  default: {};
607
611
  };
612
+ pageSize: {
613
+ type: NumberConstructor;
614
+ };
608
615
  loading: {
609
616
  type: BooleanConstructor;
610
617
  default: boolean;
@@ -147,6 +147,9 @@ export declare const TableProps: {
147
147
  }>>>;
148
148
  default: {};
149
149
  };
150
+ pageSize: {
151
+ type: NumberConstructor;
152
+ };
150
153
  loading: {
151
154
  type: BooleanConstructor;
152
155
  default: boolean;
package/es/index.js CHANGED
@@ -4962,6 +4962,9 @@ const TableProps = {
4962
4962
  type: [Object, Boolean],
4963
4963
  default: {}
4964
4964
  },
4965
+ pageSize: {
4966
+ type: Number
4967
+ },
4965
4968
  loading: { type: Boolean, default: false },
4966
4969
  rowClassName: { type: Function },
4967
4970
  scroll: {
@@ -5059,7 +5062,7 @@ function usePagination(props) {
5059
5062
  }
5060
5063
  });
5061
5064
  const getPaginationInfo = computed(() => {
5062
- const { pagination } = unref(props);
5065
+ const { pagination, pageSize: tPageSize } = unref(props);
5063
5066
  if (!unref(show) || isBoolean(pagination) && !pagination) {
5064
5067
  return false;
5065
5068
  }
@@ -5067,8 +5070,8 @@ function usePagination(props) {
5067
5070
  const { defaultPageSize, pageSizeOptions } = appConf.ui.table;
5068
5071
  return {
5069
5072
  current: 1,
5070
- pageSize: defaultPageSize,
5071
- defaultPageSize,
5073
+ pageSize: tPageSize || defaultPageSize,
5074
+ defaultPageSize: tPageSize || defaultPageSize,
5072
5075
  showTotal: (total, range) => t("TOTAL_PAGE", { total }),
5073
5076
  showSizeChanger: true,
5074
5077
  pageSizeOptions,
@@ -5130,19 +5133,19 @@ function useDataSource(propsRef, {
5130
5133
  return onTableChange2({
5131
5134
  pagination: {
5132
5135
  current,
5133
- pageSize
5136
+ pageSize: tPageSize || pageSize
5134
5137
  },
5135
5138
  sort: sorter,
5136
5139
  filter: toRaw(unref(params.filterInfo)),
5137
5140
  showBtnLoading: false
5138
5141
  });
5139
5142
  }
5140
- const { defSort, onTableChange } = unref(propsRef);
5143
+ const { defSort, onTableChange, pageSize: tPageSize } = unref(propsRef);
5141
5144
  const { appConf } = useAppStore();
5142
5145
  onTableChange({
5143
5146
  pagination: {
5144
5147
  current: 1,
5145
- pageSize: appConf.ui.table.defaultPageSize
5148
+ pageSize: tPageSize || appConf.ui.table.defaultPageSize
5146
5149
  },
5147
5150
  sort: defSort,
5148
5151
  filter: null,
@@ -5540,7 +5543,7 @@ function sortFixedColumn(columns) {
5540
5543
  function handleIndexColumn(propsRef, getPaginationRef, columns) {
5541
5544
  const { getIsZH } = useHeader();
5542
5545
  const { t } = useI18n("UI");
5543
- const { showIndexColumn, indexColumnProps, isTreeTable } = unref(propsRef);
5546
+ const { showIndexColumn, indexColumnProps, isTreeTable, pageSize: tPageSize } = unref(propsRef);
5544
5547
  let pushIndexColumns = false;
5545
5548
  if (unref(isTreeTable)) {
5546
5549
  return;
@@ -5569,7 +5572,7 @@ function handleIndexColumn(propsRef, getPaginationRef, columns) {
5569
5572
  return `${index2 + 1}`;
5570
5573
  }
5571
5574
  const { current = 1, pageSize = defaultPageSize } = getPagination;
5572
- return ((current < 1 ? 1 : current) - 1) * pageSize + index2 + 1;
5575
+ return ((current < 1 ? 1 : current) - 1) * (tPageSize || pageSize) + index2 + 1;
5573
5576
  },
5574
5577
  ...isFixedLeft ? {
5575
5578
  fixed: "left"
@@ -6944,14 +6947,15 @@ function useDownload(exportUrl, exportName) {
6944
6947
  };
6945
6948
  }
6946
6949
  function useSource(opt) {
6947
- var _a, _b, _c, _d, _e, _f;
6950
+ var _a, _b, _c, _d;
6948
6951
  const { t } = useI18n("UI");
6949
6952
  const loading = {
6950
6953
  onSearch: ref(false),
6951
6954
  onReset: ref(false)
6952
6955
  };
6956
+ const { appConf } = useAppStore();
6953
6957
  const { baseUrl = "", api = {}, exportName = "", clearKeys = () => {
6954
- } } = opt;
6958
+ }, defaultSize = (_b = (_a = appConf == null ? void 0 : appConf.ui) == null ? void 0 : _a.table) == null ? void 0 : _b.defaultPageSize } = opt;
6955
6959
  const { add, deletes, update, queryById, queryPage } = api;
6956
6960
  const { message } = useMessage();
6957
6961
  const apiFul = {};
@@ -6968,10 +6972,9 @@ function useSource(opt) {
6968
6972
  }
6969
6973
  apiPath[it] = isString(api[it]) ? api[it] : api[it].api;
6970
6974
  }
6971
- const { appConf } = useAppStore();
6972
6975
  const pagination = ref({
6973
- current: ((_b = (_a = appConf == null ? void 0 : appConf.ui) == null ? void 0 : _a.table) == null ? void 0 : _b.defaultPageNo) || 1,
6974
- pageSize: ((_d = (_c = appConf == null ? void 0 : appConf.ui) == null ? void 0 : _c.table) == null ? void 0 : _d.defaultPageSize) || 20,
6976
+ current: ((_d = (_c = appConf == null ? void 0 : appConf.ui) == null ? void 0 : _c.table) == null ? void 0 : _d.defaultPageNo) || 1,
6977
+ pageSize: defaultSize || 20,
6975
6978
  total: 0
6976
6979
  });
6977
6980
  const dataSource = ref([]);
@@ -6979,7 +6982,7 @@ function useSource(opt) {
6979
6982
  entityDTO: {},
6980
6983
  pageDTO: {
6981
6984
  pageNo: 0,
6982
- pageSize: (_f = (_e = appConf == null ? void 0 : appConf.ui) == null ? void 0 : _e.table) == null ? void 0 : _f.defaultPageSize
6985
+ pageSize: defaultSize
6983
6986
  },
6984
6987
  orderDTOs: []
6985
6988
  });
@@ -7020,7 +7023,7 @@ function useSource(opt) {
7020
7023
  const { fetch } = useFetch(queryPage, baseUrl);
7021
7024
  loading.onQuerypage.value = true;
7022
7025
  fetch(toRaw(baseData)).then((rsp) => {
7023
- var _a2, _b2, _c2, _d2, _e2;
7026
+ var _a2, _b2, _c2, _d2, _e;
7024
7027
  if (isArray$1(rsp)) {
7025
7028
  dataSource.value.splice(0, dataSource.value.length, ...rsp);
7026
7029
  return;
@@ -7030,7 +7033,7 @@ function useSource(opt) {
7030
7033
  pagination.value = {
7031
7034
  current: ((_a2 = pageDTO == null ? void 0 : pageDTO.pageNo) != null ? _a2 : 0) + 1,
7032
7035
  pageSize: (_d2 = pageDTO == null ? void 0 : pageDTO.pageSize) != null ? _d2 : (_c2 = (_b2 = appConf == null ? void 0 : appConf.ui) == null ? void 0 : _b2.table) == null ? void 0 : _c2.defaultPageSize,
7033
- total: (_e2 = pageDTO == null ? void 0 : pageDTO.totalCount) != null ? _e2 : 0
7036
+ total: (_e = pageDTO == null ? void 0 : pageDTO.totalCount) != null ? _e : 0
7034
7037
  };
7035
7038
  }).finally(() => {
7036
7039
  loading.onSearch.value = false;
@@ -8309,15 +8312,16 @@ function getFilterMenu(filter2 = "", flag = false) {
8309
8312
  return _menus;
8310
8313
  let getTargetMenus = (menusArr) => {
8311
8314
  menusArr.forEach((menu) => {
8315
+ var _a2, _b;
8312
8316
  if (menu.children && menu.children.length) {
8313
8317
  getTargetMenus(menu.children);
8314
8318
  } else {
8315
8319
  let isMatched = false;
8316
8320
  if (!unref(getIsZH)) {
8317
- if ((menu == null ? void 0 : menu.enLabel.toLowerCase().indexOf(filter2.toLowerCase())) !== -1)
8321
+ if (((_a2 = menu.enLabel) == null ? void 0 : _a2.toLowerCase().indexOf(filter2.toLowerCase())) !== -1)
8318
8322
  isMatched = true;
8319
8323
  } else {
8320
- if ((menu == null ? void 0 : menu.label.indexOf(filter2)) !== -1)
8324
+ if (((_b = menu.label) == null ? void 0 : _b.indexOf(filter2)) !== -1)
8321
8325
  isMatched = true;
8322
8326
  }
8323
8327
  if (isMatched || flag && !trim(filter2)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dt-frames/ui",
3
- "version": "1.0.54",
3
+ "version": "1.0.55",
4
4
  "keywords": [
5
5
  "ui",
6
6
  "dt-ui"