@juzhenfe/page-model 3.17.6 → 3.17.7
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/dist/components/page-model/constructor.d.ts +4 -0
- package/dist/components/table/constructor.d.ts +0 -8
- package/dist/components/table/type.d.ts +3 -0
- package/dist/components/table/utils/use-static-summary.d.ts +1 -7
- package/dist/index.es.js +34 -46
- package/dist/index.umd.js +3 -3
- package/package.json +1 -1
|
@@ -65,6 +65,10 @@ export default class PageModelManager extends Reflections {
|
|
|
65
65
|
updatedChildrenConfig(): void;
|
|
66
66
|
registerChildManager(managerName: any, manager: TableManager | SearchFormManager | TopTabsManager | FormManager): void;
|
|
67
67
|
handleSubmit(): Promise<boolean>;
|
|
68
|
+
/**
|
|
69
|
+
* 上次请求数据
|
|
70
|
+
*/
|
|
71
|
+
lastReqData: any;
|
|
68
72
|
doGetDataRequest(): Promise<boolean>;
|
|
69
73
|
/**
|
|
70
74
|
* 处理表格数据
|
|
@@ -302,14 +302,6 @@ export default class TableManager extends IManager {
|
|
|
302
302
|
* 更新当前渲染的列元素
|
|
303
303
|
*/
|
|
304
304
|
updateCurrentRenderTableEls(els: PageModel.TableBaseItem[]): void;
|
|
305
|
-
/**
|
|
306
|
-
* 当前elTable渲染的column
|
|
307
|
-
*/
|
|
308
|
-
currentTableColumns: any[];
|
|
309
|
-
/**
|
|
310
|
-
* 更新当前elTable渲染的column
|
|
311
|
-
*/
|
|
312
|
-
updateCurrentTableColumns(columns: any[]): void;
|
|
313
305
|
/**
|
|
314
306
|
* 当前列元素更新
|
|
315
307
|
*/
|
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
* 使用用户配置的汇总
|
|
3
3
|
*/
|
|
4
4
|
import TableManager from '../constructor';
|
|
5
|
-
import EventEmitter from '../../../utils/event-emitter';
|
|
6
|
-
/**
|
|
7
|
-
* 用户汇总配置修改事件
|
|
8
|
-
*/
|
|
9
|
-
declare const userSummaryConfigEmiter: EventEmitter<"change">;
|
|
10
|
-
export { userSummaryConfigEmiter };
|
|
11
5
|
export declare enum SummaryTypeEnum {
|
|
12
6
|
不展示 = 0,
|
|
13
7
|
求和 = 1,
|
|
@@ -18,4 +12,4 @@ export declare enum SummaryTypeEnum {
|
|
|
18
12
|
* @param tableManager
|
|
19
13
|
* @returns
|
|
20
14
|
*/
|
|
21
|
-
export declare function useUserSummary(tableManager: TableManager): boolean;
|
|
15
|
+
export declare function useUserSummary(tableManager: TableManager): () => boolean;
|
package/dist/index.es.js
CHANGED
|
@@ -3746,6 +3746,7 @@ const _PageModelManager = class extends Reflections {
|
|
|
3746
3746
|
__publicField(this, "staticData");
|
|
3747
3747
|
__publicField(this, "id", 0);
|
|
3748
3748
|
__publicField(this, "isTableFullscreen", false);
|
|
3749
|
+
__publicField(this, "lastReqData");
|
|
3749
3750
|
__publicField(this, "isTableSelecting", false);
|
|
3750
3751
|
__publicField(this, "loadingInstance");
|
|
3751
3752
|
__publicField(this, "authButtons", []);
|
|
@@ -3893,6 +3894,7 @@ const _PageModelManager = class extends Reflections {
|
|
|
3893
3894
|
if (typeof config.beforeGetRequest === "function") {
|
|
3894
3895
|
config.beforeGetRequest.call(this, reqData);
|
|
3895
3896
|
}
|
|
3897
|
+
this.lastReqData = reqData;
|
|
3896
3898
|
let reqResult = await _PageModelManager.request[method](
|
|
3897
3899
|
config.getUrl,
|
|
3898
3900
|
reqData
|
|
@@ -4698,7 +4700,6 @@ class TableManager extends IManager {
|
|
|
4698
4700
|
__publicField(this, "radioData", null);
|
|
4699
4701
|
__publicField(this, "currentFilterTableEls", []);
|
|
4700
4702
|
__publicField(this, "currentRenderTableEls");
|
|
4701
|
-
__publicField(this, "currentTableColumns", []);
|
|
4702
4703
|
__publicField(this, "innerFilters", null);
|
|
4703
4704
|
__publicField(this, "saveContentScope");
|
|
4704
4705
|
__publicField(this, "saveContent");
|
|
@@ -5444,9 +5445,6 @@ class TableManager extends IManager {
|
|
|
5444
5445
|
this.currentRenderTableEls = els;
|
|
5445
5446
|
this.onCurrentRenderTableElsChange();
|
|
5446
5447
|
}
|
|
5447
|
-
updateCurrentTableColumns(columns) {
|
|
5448
|
-
this.currentTableColumns = columns;
|
|
5449
|
-
}
|
|
5450
5448
|
onCurrentRenderTableElsChange() {
|
|
5451
5449
|
const propList = this.currentRenderTableEls.map((a) => a.prop).filter((a) => a);
|
|
5452
5450
|
this.columnParamsList = this.columnParamsList.filter((a) => {
|
|
@@ -9038,42 +9036,46 @@ function useTableEls(originTableEls, tableManager) {
|
|
|
9038
9036
|
renderEls
|
|
9039
9037
|
};
|
|
9040
9038
|
}
|
|
9041
|
-
const userSummaryConfigEmiter = new EventEmitter();
|
|
9042
9039
|
var SummaryTypeEnum = /* @__PURE__ */ ((SummaryTypeEnum2) => {
|
|
9043
9040
|
SummaryTypeEnum2[SummaryTypeEnum2["\u4E0D\u5C55\u793A"] = 0] = "\u4E0D\u5C55\u793A";
|
|
9044
9041
|
SummaryTypeEnum2[SummaryTypeEnum2["\u6C42\u548C"] = 1] = "\u6C42\u548C";
|
|
9045
9042
|
SummaryTypeEnum2[SummaryTypeEnum2["\u603B\u6570"] = 2] = "\u603B\u6570";
|
|
9046
9043
|
return SummaryTypeEnum2;
|
|
9047
9044
|
})(SummaryTypeEnum || {});
|
|
9048
|
-
let isHijacked = false;
|
|
9049
|
-
let summaryResult = reactive([]);
|
|
9050
9045
|
function useUserSummary(tableManager) {
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
const
|
|
9060
|
-
|
|
9046
|
+
let isHijacked = false;
|
|
9047
|
+
let summaryResult = reactive([]);
|
|
9048
|
+
let currentTableColumns = [];
|
|
9049
|
+
let lastSummaryColumns = [];
|
|
9050
|
+
return function initSummary() {
|
|
9051
|
+
if (tableManager.tableProps.summaryMethod && !tableManager.tableProps._customSummary) {
|
|
9052
|
+
return false;
|
|
9053
|
+
}
|
|
9054
|
+
const currentRenderTableEls = tableManager.currentRenderTableEls;
|
|
9055
|
+
const isUsingSummary = tableManager.table.showSummary || currentRenderTableEls.filter((a) => a.prop).some((a) => a.showSummary != null);
|
|
9056
|
+
if (!isUsingSummary) {
|
|
9057
|
+
tableManager.tableProps.showSummary = false;
|
|
9058
|
+
tableManager.tableProps.summaryMethod = null;
|
|
9059
|
+
return false;
|
|
9060
|
+
}
|
|
9061
9061
|
tableManager.tableProps.showSummary = true;
|
|
9062
9062
|
tableManager.tableProps._customSummary = true;
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
let lastSummaryColumns = {};
|
|
9066
|
-
const getSummaryData = debounce(async () => {
|
|
9067
|
-
const summaryColumns = tableManager.currentRenderTableEls.filter((a) => a.showSummary != null && a.showSummary !== "").filter((a) => a.prop).map((a) => {
|
|
9063
|
+
const getSummaryEls = () => {
|
|
9064
|
+
return tableManager.currentRenderTableEls.filter((a) => a.showSummary != null && a.showSummary !== "").filter((a) => a.prop).map((a) => {
|
|
9068
9065
|
return {
|
|
9069
9066
|
prop: a.prop,
|
|
9070
9067
|
showSummary: a.showSummary
|
|
9071
9068
|
};
|
|
9072
9069
|
});
|
|
9070
|
+
};
|
|
9071
|
+
const summaryEls = getSummaryEls();
|
|
9072
|
+
const isServerSummary = tableManager.table.useServerSummary && typeof tableManager.table.serverSummaryFn === "function";
|
|
9073
|
+
const getSummaryData = debounce(async () => {
|
|
9074
|
+
const summaryColumns = lastSummaryColumns = getSummaryEls();
|
|
9073
9075
|
const reqResult = tableManager.table.serverSummaryFn.call(
|
|
9074
9076
|
tableManager,
|
|
9075
9077
|
summaryColumns,
|
|
9076
|
-
cloneDeep(
|
|
9078
|
+
cloneDeep(tableManager.manager.lastReqData),
|
|
9077
9079
|
currentTableColumns
|
|
9078
9080
|
);
|
|
9079
9081
|
const _result = await reqResult;
|
|
@@ -9083,17 +9085,14 @@ function useUserSummary(tableManager) {
|
|
|
9083
9085
|
}, 300);
|
|
9084
9086
|
if (isServerSummary) {
|
|
9085
9087
|
if (!isHijacked) {
|
|
9088
|
+
const config = tableManager.manager.config;
|
|
9086
9089
|
let _beforeGetRequest = config.beforeGetRequest;
|
|
9087
9090
|
config.beforeGetRequest = async function(reqParams) {
|
|
9088
9091
|
if (typeof _beforeGetRequest === "function") {
|
|
9089
9092
|
_beforeGetRequest.call(tableManager.manager, reqParams);
|
|
9090
9093
|
}
|
|
9091
|
-
lastSummaryColumns = reqParams;
|
|
9092
9094
|
getSummaryData();
|
|
9093
9095
|
};
|
|
9094
|
-
userSummaryConfigEmiter.on("change", () => {
|
|
9095
|
-
getSummaryData();
|
|
9096
|
-
});
|
|
9097
9096
|
isHijacked = true;
|
|
9098
9097
|
}
|
|
9099
9098
|
}
|
|
@@ -9102,11 +9101,10 @@ function useUserSummary(tableManager) {
|
|
|
9102
9101
|
data
|
|
9103
9102
|
}) {
|
|
9104
9103
|
if (!columns.length) {
|
|
9105
|
-
return
|
|
9104
|
+
return [];
|
|
9106
9105
|
}
|
|
9107
|
-
tableManager.updateCurrentTableColumns(columns);
|
|
9108
9106
|
if (isServerSummary) {
|
|
9109
|
-
if (
|
|
9107
|
+
if (currentTableColumns.length !== columns.length || currentTableColumns.map((a) => a.property).join(",") !== columns.map((a) => a.property).join(",") || getSummaryEls().map((a) => a.showSummary).join(",") !== lastSummaryColumns.map((a) => a.showSummary).join(",")) {
|
|
9110
9108
|
getSummaryData();
|
|
9111
9109
|
}
|
|
9112
9110
|
currentTableColumns = columns;
|
|
@@ -9179,13 +9177,7 @@ function useUserSummary(tableManager) {
|
|
|
9179
9177
|
);
|
|
9180
9178
|
});
|
|
9181
9179
|
};
|
|
9182
|
-
|
|
9183
|
-
tableManager.context.$refs.tableRef.doLayout();
|
|
9184
|
-
}, 20);
|
|
9185
|
-
} else {
|
|
9186
|
-
tableManager.tableProps.showSummary = false;
|
|
9187
|
-
tableManager.tableProps.summaryMethod = null;
|
|
9188
|
-
}
|
|
9180
|
+
};
|
|
9189
9181
|
}
|
|
9190
9182
|
const useExportForm = () => {
|
|
9191
9183
|
const exportFormRef = ref();
|
|
@@ -9487,13 +9479,14 @@ const _sfc_main$n = defineComponent({
|
|
|
9487
9479
|
});
|
|
9488
9480
|
const filteredUserEls = ref([]);
|
|
9489
9481
|
const renderedTableEls = ref();
|
|
9482
|
+
const initSummary = useUserSummary(tableManager);
|
|
9490
9483
|
function setTableEls() {
|
|
9491
9484
|
const result = useTableEls(table.value.els, tableManager);
|
|
9492
9485
|
filteredUserEls.value = result.filteredUserEls;
|
|
9493
9486
|
renderedTableEls.value = result.renderEls;
|
|
9494
9487
|
tableManager.updateCurrentFilterTableEls(cloneDeep(result.filteredUserEls));
|
|
9495
9488
|
tableManager.updateCurrentRenderTableEls(cloneDeep(result.renderEls));
|
|
9496
|
-
|
|
9489
|
+
initSummary();
|
|
9497
9490
|
}
|
|
9498
9491
|
tableUserConfigChangeEmiter.on("change", () => {
|
|
9499
9492
|
setTableEls();
|
|
@@ -9524,7 +9517,6 @@ const _sfc_main$n = defineComponent({
|
|
|
9524
9517
|
};
|
|
9525
9518
|
const onSaveColumns = async (columns) => {
|
|
9526
9519
|
const originColumns = table.value.els;
|
|
9527
|
-
let isSummaryChange = false;
|
|
9528
9520
|
const contents = columns.map((column) => {
|
|
9529
9521
|
const originColumnIndex = originColumns.findIndex((a) => a.label === column.label);
|
|
9530
9522
|
const item = {
|
|
@@ -9539,9 +9531,8 @@ const _sfc_main$n = defineComponent({
|
|
|
9539
9531
|
item.sum = Number(column.showSummary);
|
|
9540
9532
|
}
|
|
9541
9533
|
const renderColumn = filteredUserEls.value.find((a) => a.prop === column.prop);
|
|
9542
|
-
if (column.showSummary !== (renderColumn == null ? void 0 : renderColumn.showSummary))
|
|
9543
|
-
|
|
9544
|
-
}
|
|
9534
|
+
if (column.showSummary !== (renderColumn == null ? void 0 : renderColumn.showSummary))
|
|
9535
|
+
;
|
|
9545
9536
|
return item;
|
|
9546
9537
|
});
|
|
9547
9538
|
const userSetting = PageModelManager.userSetting;
|
|
@@ -9557,9 +9548,6 @@ const _sfc_main$n = defineComponent({
|
|
|
9557
9548
|
} catch (error) {
|
|
9558
9549
|
}
|
|
9559
9550
|
setTableEls();
|
|
9560
|
-
if (isSummaryChange) {
|
|
9561
|
-
userSummaryConfigEmiter.emit("change");
|
|
9562
|
-
}
|
|
9563
9551
|
};
|
|
9564
9552
|
const clearSelection = () => {
|
|
9565
9553
|
tableManager.clearSelection();
|
|
@@ -14903,7 +14891,7 @@ const defineEditableTable = function(config) {
|
|
|
14903
14891
|
};
|
|
14904
14892
|
var iconfont = "";
|
|
14905
14893
|
const name = "@juzhenfe/page-model";
|
|
14906
|
-
const version = "3.17.
|
|
14894
|
+
const version = "3.17.7";
|
|
14907
14895
|
const types = "dist/main.d.ts";
|
|
14908
14896
|
const main = "dist/index.umd.js";
|
|
14909
14897
|
const keywords = [
|