3h1-ui 2.1.13 → 2.1.14

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.
package/es/index.js CHANGED
@@ -20009,6 +20009,37 @@ const usePagination = () => {
20009
20009
  };
20010
20010
  return { page, setPage };
20011
20011
  };
20012
+ const useTableData = (getProps, { setPage, params }) => {
20013
+ const dataSource = ref([]);
20014
+ const setTableData = (data) => {
20015
+ dataSource.value = data.map((item) => {
20016
+ item._isEdit = false;
20017
+ return item;
20018
+ });
20019
+ };
20020
+ const getTableData = () => {
20021
+ return dataSource.value;
20022
+ };
20023
+ const reload = async () => {
20024
+ var _a2;
20025
+ if ((_a2 = getProps.value) == null ? void 0 : _a2.api) {
20026
+ const res = await getProps.value.api(params.value);
20027
+ setTableData(res.records);
20028
+ setPage({ total: (res == null ? void 0 : res.total) || 0 });
20029
+ }
20030
+ };
20031
+ onMounted(async () => {
20032
+ if (getProps.value.isImmediate) {
20033
+ await reload();
20034
+ }
20035
+ });
20036
+ return {
20037
+ dataSource,
20038
+ setTableData,
20039
+ reload,
20040
+ getTableData
20041
+ };
20042
+ };
20012
20043
  const __default__ = defineComponent({
20013
20044
  name: "TablePlus"
20014
20045
  });
@@ -20086,7 +20117,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
20086
20117
  return { ...basicColumn, ...item };
20087
20118
  });
20088
20119
  });
20089
- usePagination();
20120
+ const { page, setPage } = usePagination();
20090
20121
  const getFormConfig = computed(() => {
20091
20122
  return {
20092
20123
  ...getProps.value.formConfig,
@@ -20097,7 +20128,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
20097
20128
  ...basicFormConfig,
20098
20129
  ...getFormConfig.value
20099
20130
  });
20100
- ref({});
20131
+ const formSearch = ref({});
20132
+ const params = computed(() => {
20133
+ return {
20134
+ ...getProps.value.searchInfo,
20135
+ ...formSearch.value,
20136
+ current: page.current,
20137
+ size: page.pageSize
20138
+ };
20139
+ });
20140
+ useTableData(
20141
+ getProps,
20142
+ {
20143
+ setPage,
20144
+ params
20145
+ }
20146
+ );
20101
20147
  const tableRef = ref();
20102
20148
  const getRowSelection = () => {
20103
20149
  if (getProps.value.configRowSelection.type === "checkbox") {
package/lib/index.js CHANGED
@@ -20011,6 +20011,37 @@ const usePagination = () => {
20011
20011
  };
20012
20012
  return { page, setPage };
20013
20013
  };
20014
+ const useTableData = (getProps, { setPage, params }) => {
20015
+ const dataSource = vue.ref([]);
20016
+ const setTableData = (data) => {
20017
+ dataSource.value = data.map((item) => {
20018
+ item._isEdit = false;
20019
+ return item;
20020
+ });
20021
+ };
20022
+ const getTableData = () => {
20023
+ return dataSource.value;
20024
+ };
20025
+ const reload = async () => {
20026
+ var _a2;
20027
+ if ((_a2 = getProps.value) == null ? void 0 : _a2.api) {
20028
+ const res = await getProps.value.api(params.value);
20029
+ setTableData(res.records);
20030
+ setPage({ total: (res == null ? void 0 : res.total) || 0 });
20031
+ }
20032
+ };
20033
+ vue.onMounted(async () => {
20034
+ if (getProps.value.isImmediate) {
20035
+ await reload();
20036
+ }
20037
+ });
20038
+ return {
20039
+ dataSource,
20040
+ setTableData,
20041
+ reload,
20042
+ getTableData
20043
+ };
20044
+ };
20014
20045
  const __default__ = vue.defineComponent({
20015
20046
  name: "TablePlus"
20016
20047
  });
@@ -20088,7 +20119,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
20088
20119
  return { ...basicColumn, ...item };
20089
20120
  });
20090
20121
  });
20091
- usePagination();
20122
+ const { page, setPage } = usePagination();
20092
20123
  const getFormConfig = vue.computed(() => {
20093
20124
  return {
20094
20125
  ...getProps.value.formConfig,
@@ -20099,7 +20130,22 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
20099
20130
  ...basicFormConfig,
20100
20131
  ...getFormConfig.value
20101
20132
  });
20102
- vue.ref({});
20133
+ const formSearch = vue.ref({});
20134
+ const params = vue.computed(() => {
20135
+ return {
20136
+ ...getProps.value.searchInfo,
20137
+ ...formSearch.value,
20138
+ current: page.current,
20139
+ size: page.pageSize
20140
+ };
20141
+ });
20142
+ useTableData(
20143
+ getProps,
20144
+ {
20145
+ setPage,
20146
+ params
20147
+ }
20148
+ );
20103
20149
  const tableRef = vue.ref();
20104
20150
  const getRowSelection = () => {
20105
20151
  if (getProps.value.configRowSelection.type === "checkbox") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "3h1-ui",
3
- "version": "2.1.13",
3
+ "version": "2.1.14",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -31,8 +31,8 @@
31
31
  "vue-types": "^5.0.2",
32
32
  "vxe-table": "^4.3.6",
33
33
  "xe-utils": "^3.5.7",
34
- "@shy-plugins/utils": "1.0.14",
35
- "@shy-plugins/use": "1.0.3"
34
+ "@shy-plugins/use": "1.0.3",
35
+ "@shy-plugins/utils": "1.0.14"
36
36
  },
37
37
  "types": "es/ui/index.d.ts",
38
38
  "devDependencies": {