@newview/file-ui 1.1.22 → 1.1.23

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/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.1.23
2
+ 1. UploadFileList 新增分页控制
3
+
1
4
  ## 1.1.22
2
5
  1. 控制 UploadFileList 附件按钮显隐
3
6
 
package/dist/file-ui.js CHANGED
@@ -18976,6 +18976,16 @@ const propDefine$1 = {
18976
18976
  //只读状态且无附件信息下的显示
18977
18977
  type: String,
18978
18978
  default: "暂无附件"
18979
+ },
18980
+ // 分页配置
18981
+ paginationSet: {
18982
+ type: Object,
18983
+ default: {
18984
+ /** 是否开启分页 */
18985
+ isPagination: false,
18986
+ /** 开启分页后每页的条数 每页的条数 */
18987
+ pageSize: 10
18988
+ }
18979
18989
  }
18980
18990
  };
18981
18991
  const _sfc_main$1 = defineComponent({
@@ -19003,6 +19013,10 @@ class UploadFileInstance2 extends BaseInstance {
19003
19013
  // private business2Test1: number = 0;
19004
19014
  // 响应属性 | ref、reactive、computed、watch
19005
19015
  // refTest2 = ref(0);
19016
+ /** 是否开启分页 */
19017
+ __publicField(this, "isOpenPagination", ref(false));
19018
+ /** 每页条数 */
19019
+ __publicField(this, "gridPageSize", ref(10));
19006
19020
  /** 是否显示预览 */
19007
19021
  __publicField(this, "isShowEye", ref(true));
19008
19022
  /** 是否显示删除 */
@@ -19019,7 +19033,8 @@ class UploadFileInstance2 extends BaseInstance {
19019
19033
  labelWidth: 120,
19020
19034
  defaultShowSearch: false
19021
19035
  },
19022
- isPagination: false,
19036
+ isPagination: this.isOpenPagination.value,
19037
+ pageSize: this.gridPageSize.value,
19023
19038
  toolbarConfig: {
19024
19039
  isButtonGroup: false
19025
19040
  },
@@ -19143,8 +19158,20 @@ class UploadFileInstance2 extends BaseInstance {
19143
19158
  /** 附件列表赋值 */
19144
19159
  __publicField(this, "loadUploadListData", () => {
19145
19160
  let uploadListData = this.getGroupFiles("默认");
19161
+ let groupArr = this.arrayGroup(uploadListData, this.gridPageSize.value);
19146
19162
  this.uploadListGridRef.value[0].loadData(async (options) => {
19147
- options.success(uploadListData);
19163
+ if (this.isOpenPagination.value) {
19164
+ let newArr = groupArr[options.page - 1];
19165
+ let gridObj = {
19166
+ Datas: newArr,
19167
+ TotalItemCount: uploadListData.length,
19168
+ CurrentPageIndex: options.page,
19169
+ TotalPageCount: this.gridPageSize.value
19170
+ };
19171
+ options.success(gridObj);
19172
+ } else {
19173
+ options.success(uploadListData);
19174
+ }
19148
19175
  });
19149
19176
  });
19150
19177
  /** 附件列表保存 */
@@ -19424,6 +19451,14 @@ class UploadFileInstance2 extends BaseInstance {
19424
19451
  this.ctx = ctx;
19425
19452
  this.useUploadFile();
19426
19453
  }
19454
+ /** 将数组分为几组 */
19455
+ arrayGroup(data, num) {
19456
+ let newArray = [];
19457
+ for (let i = 0, len = data.length; i < len; i += num) {
19458
+ newArray.push(data.slice(i, i + num));
19459
+ }
19460
+ return newArray;
19461
+ }
19427
19462
  // 私有方法 | private 方法名() {}
19428
19463
  /**
19429
19464
  * 初始化文件上传附件
@@ -19436,6 +19471,12 @@ class UploadFileInstance2 extends BaseInstance {
19436
19471
  watchEffect(() => {
19437
19472
  this.isShowtrash.value = this.props.readonly;
19438
19473
  });
19474
+ watchEffect(() => {
19475
+ this.isOpenPagination.value = this.props.paginationSet.isPagination;
19476
+ this.gridPageSize.value = this.props.paginationSet.pageSize;
19477
+ this.uploadListGridOption.setting.isPagination = this.isOpenPagination.value;
19478
+ this.uploadListGridOption.setting.pageSize = this.gridPageSize.value;
19479
+ });
19439
19480
  this.setCurrentToken();
19440
19481
  this.setUploadFilePos();
19441
19482
  this.headers.value.Authorization = `Bearer ${this.storageInfo.getToken()}`;
@@ -19703,6 +19744,28 @@ class ComFormInstance extends BaseInstance {
19703
19744
  __publicField(this, "getPropValue", (prop, propName, defaultValue) => {
19704
19745
  return this.utilities.isNull(prop) ? defaultValue : prop[propName];
19705
19746
  });
19747
+ __publicField(this, "getPaginationSet", (item) => {
19748
+ if (this.utilities.isNull(item.uploadFileListProp)) {
19749
+ return null;
19750
+ } else {
19751
+ return {
19752
+ isPagination: item.uploadFileListProp.isOpenPagination,
19753
+ pageSize: item.uploadFileListProp.pageSize ?? 10
19754
+ };
19755
+ }
19756
+ });
19757
+ __publicField(this, "uploadFileListStyle", (item) => {
19758
+ var _a;
19759
+ if (this.utilities.isNull(item.uploadFileListProp)) {
19760
+ return {
19761
+ height: "200px"
19762
+ };
19763
+ } else {
19764
+ return {
19765
+ height: ((_a = item.uploadFileListProp) == null ? void 0 : _a.isOpenPagination) ? "300px" : "200px"
19766
+ };
19767
+ }
19768
+ });
19706
19769
  this.props = props;
19707
19770
  this.ctx = ctx;
19708
19771
  }
@@ -19762,11 +19825,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
19762
19825
  }, null, 8, ["readonly", "dataValue", "multiple", "selType", "onOnChange"])) : createCommentVNode("", true),
19763
19826
  item.type === "UploadFileList" ? (openBlock(), createBlock(_component_UploadFileList, {
19764
19827
  key: 5,
19765
- style: { "height": "200px" },
19828
+ style: normalizeStyle(_ctx.uploadFileListStyle(item)),
19766
19829
  readonly: _ctx.getPropValue(item.uploadFileListProp, "readonly") || _ctx.onlyView,
19767
19830
  token: _ctx.formModel[item.model],
19831
+ paginationSet: _ctx.getPaginationSet(item),
19768
19832
  onReturnFileList: ($event) => _ctx.tokenList($event, item)
19769
- }, null, 8, ["readonly", "token", "onReturnFileList"])) : createCommentVNode("", true)
19833
+ }, null, 8, ["style", "readonly", "token", "paginationSet", "onReturnFileList"])) : createCommentVNode("", true)
19770
19834
  ]),
19771
19835
  _: 1
19772
19836
  }, 8, ["onlyView", "formItems", "formModel"]);