3h1-ui 2.1.13 → 2.1.15
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 +71 -3
- package/lib/index.js +71 -3
- package/package.json +1 -1
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,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
20086
20117
|
return { ...basicColumn, ...item };
|
|
20087
20118
|
});
|
|
20088
20119
|
});
|
|
20089
|
-
usePagination();
|
|
20120
|
+
const { page, setPage } = usePagination();
|
|
20121
|
+
const handlePageChange = (current, pageSize) => {
|
|
20122
|
+
setPage({ current, pageSize });
|
|
20123
|
+
reload();
|
|
20124
|
+
};
|
|
20090
20125
|
const getFormConfig = computed(() => {
|
|
20091
20126
|
return {
|
|
20092
20127
|
...getProps.value.formConfig,
|
|
@@ -20097,7 +20132,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
20097
20132
|
...basicFormConfig,
|
|
20098
20133
|
...getFormConfig.value
|
|
20099
20134
|
});
|
|
20100
|
-
ref({});
|
|
20135
|
+
const formSearch = ref({});
|
|
20136
|
+
const params = computed(() => {
|
|
20137
|
+
return {
|
|
20138
|
+
...getProps.value.searchInfo,
|
|
20139
|
+
...formSearch.value,
|
|
20140
|
+
current: page.current,
|
|
20141
|
+
size: page.pageSize
|
|
20142
|
+
};
|
|
20143
|
+
});
|
|
20144
|
+
const { dataSource, setTableData, reload, getTableData } = useTableData(
|
|
20145
|
+
getProps,
|
|
20146
|
+
{
|
|
20147
|
+
setPage,
|
|
20148
|
+
params
|
|
20149
|
+
}
|
|
20150
|
+
);
|
|
20101
20151
|
const tableRef = ref();
|
|
20102
20152
|
const getRowSelection = () => {
|
|
20103
20153
|
if (getProps.value.configRowSelection.type === "checkbox") {
|
|
@@ -20125,7 +20175,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
20125
20175
|
}, [
|
|
20126
20176
|
createElementVNode("div", {
|
|
20127
20177
|
class: normalizeClass(getClassName("body"))
|
|
20128
|
-
}, null, 2)
|
|
20178
|
+
}, null, 2),
|
|
20179
|
+
unref(page).total !== 0 && unref(getProps).isShowPagination ? (openBlock(), createElementBlock("div", {
|
|
20180
|
+
key: 0,
|
|
20181
|
+
class: normalizeClass(getClassName("pagination"))
|
|
20182
|
+
}, [
|
|
20183
|
+
createVNode(unref(Pagination), {
|
|
20184
|
+
size: "small",
|
|
20185
|
+
total: unref(page).total,
|
|
20186
|
+
current: unref(page).current,
|
|
20187
|
+
"onUpdate:current": _cache[0] || (_cache[0] = ($event) => unref(page).current = $event),
|
|
20188
|
+
"page-size": unref(page).pageSize,
|
|
20189
|
+
"onUpdate:page-size": _cache[1] || (_cache[1] = ($event) => unref(page).pageSize = $event),
|
|
20190
|
+
pageSizeOptions: unref(page).pageSizeOptions,
|
|
20191
|
+
"show-size-changer": "",
|
|
20192
|
+
"show-quick-jumper": "",
|
|
20193
|
+
"show-total": (total) => `共 ${total} 条数据`,
|
|
20194
|
+
onChange: handlePageChange
|
|
20195
|
+
}, null, 8, ["total", "current", "page-size", "pageSizeOptions", "show-total"])
|
|
20196
|
+
], 2)) : createCommentVNode("", true)
|
|
20129
20197
|
], 2);
|
|
20130
20198
|
};
|
|
20131
20199
|
}
|
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,11 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
20088
20119
|
return { ...basicColumn, ...item };
|
|
20089
20120
|
});
|
|
20090
20121
|
});
|
|
20091
|
-
usePagination();
|
|
20122
|
+
const { page, setPage } = usePagination();
|
|
20123
|
+
const handlePageChange = (current, pageSize) => {
|
|
20124
|
+
setPage({ current, pageSize });
|
|
20125
|
+
reload();
|
|
20126
|
+
};
|
|
20092
20127
|
const getFormConfig = vue.computed(() => {
|
|
20093
20128
|
return {
|
|
20094
20129
|
...getProps.value.formConfig,
|
|
@@ -20099,7 +20134,22 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
20099
20134
|
...basicFormConfig,
|
|
20100
20135
|
...getFormConfig.value
|
|
20101
20136
|
});
|
|
20102
|
-
vue.ref({});
|
|
20137
|
+
const formSearch = vue.ref({});
|
|
20138
|
+
const params = vue.computed(() => {
|
|
20139
|
+
return {
|
|
20140
|
+
...getProps.value.searchInfo,
|
|
20141
|
+
...formSearch.value,
|
|
20142
|
+
current: page.current,
|
|
20143
|
+
size: page.pageSize
|
|
20144
|
+
};
|
|
20145
|
+
});
|
|
20146
|
+
const { dataSource, setTableData, reload, getTableData } = useTableData(
|
|
20147
|
+
getProps,
|
|
20148
|
+
{
|
|
20149
|
+
setPage,
|
|
20150
|
+
params
|
|
20151
|
+
}
|
|
20152
|
+
);
|
|
20103
20153
|
const tableRef = vue.ref();
|
|
20104
20154
|
const getRowSelection = () => {
|
|
20105
20155
|
if (getProps.value.configRowSelection.type === "checkbox") {
|
|
@@ -20127,7 +20177,25 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
20127
20177
|
}, [
|
|
20128
20178
|
vue.createElementVNode("div", {
|
|
20129
20179
|
class: vue.normalizeClass(getClassName("body"))
|
|
20130
|
-
}, null, 2)
|
|
20180
|
+
}, null, 2),
|
|
20181
|
+
vue.unref(page).total !== 0 && vue.unref(getProps).isShowPagination ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
20182
|
+
key: 0,
|
|
20183
|
+
class: vue.normalizeClass(getClassName("pagination"))
|
|
20184
|
+
}, [
|
|
20185
|
+
vue.createVNode(vue.unref(antDesignVue.Pagination), {
|
|
20186
|
+
size: "small",
|
|
20187
|
+
total: vue.unref(page).total,
|
|
20188
|
+
current: vue.unref(page).current,
|
|
20189
|
+
"onUpdate:current": _cache[0] || (_cache[0] = ($event) => vue.unref(page).current = $event),
|
|
20190
|
+
"page-size": vue.unref(page).pageSize,
|
|
20191
|
+
"onUpdate:page-size": _cache[1] || (_cache[1] = ($event) => vue.unref(page).pageSize = $event),
|
|
20192
|
+
pageSizeOptions: vue.unref(page).pageSizeOptions,
|
|
20193
|
+
"show-size-changer": "",
|
|
20194
|
+
"show-quick-jumper": "",
|
|
20195
|
+
"show-total": (total) => `共 ${total} 条数据`,
|
|
20196
|
+
onChange: handlePageChange
|
|
20197
|
+
}, null, 8, ["total", "current", "page-size", "pageSizeOptions", "show-total"])
|
|
20198
|
+
], 2)) : vue.createCommentVNode("", true)
|
|
20131
20199
|
], 2);
|
|
20132
20200
|
};
|
|
20133
20201
|
}
|