@newview/file-ui 1.1.22 → 1.1.24

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,9 @@
1
+ ## 1.1.24
2
+ 1. UploadFileList 界面调整
3
+
4
+ ## 1.1.23
5
+ 1. UploadFileList 新增分页控制
6
+
1
7
  ## 1.1.22
2
8
  1. 控制 UploadFileList 附件按钮显隐
3
9
 
package/dist/file-ui.js CHANGED
@@ -606,7 +606,7 @@ const UploadFile_vue_vue_type_style_index_0_scoped_0e35ec0f_lang = "";
606
606
  const _withScopeId$1 = (n) => (pushScopeId("data-v-0e35ec0f"), n = n(), popScopeId(), n);
607
607
  const _hoisted_1$3 = { class: "uploadFile uploadPage" };
608
608
  const _hoisted_2$3 = ["onClick", "title"];
609
- const _hoisted_3$2 = { class: "file-upload-list-cover" };
609
+ const _hoisted_3$3 = { class: "file-upload-list-cover" };
610
610
  const _hoisted_4$2 = { class: "file-upload-btn" };
611
611
  const _hoisted_5$2 = {
612
612
  key: 1,
@@ -668,7 +668,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
668
668
  width: "100%",
669
669
  height: "100%"
670
670
  }, null, 8, ["src"]),
671
- createElementVNode("div", _hoisted_3$2, [
671
+ createElementVNode("div", _hoisted_3$3, [
672
672
  createVNode(_component_Space, null, {
673
673
  default: withCtx(() => [
674
674
  createVNode(_component_Icon, {
@@ -18344,7 +18344,7 @@ const _hoisted_2$2 = {
18344
18344
  ref: "StructureTypeSel",
18345
18345
  style: { "height": "220px", "display": "inline-block" }
18346
18346
  };
18347
- const _hoisted_3$1 = { class: "nv-cascader-box nv-overflow-auto" };
18347
+ const _hoisted_3$2 = { class: "nv-cascader-box nv-overflow-auto" };
18348
18348
  const _hoisted_4$1 = ["onClick"];
18349
18349
  const _hoisted_5$1 = {
18350
18350
  key: 0,
@@ -18389,7 +18389,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
18389
18389
  }, {
18390
18390
  content: withCtx(() => [
18391
18391
  !_ctx.searchValue ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
18392
- createElementVNode("div", _hoisted_3$1, [
18392
+ createElementVNode("div", _hoisted_3$2, [
18393
18393
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.StructureTypeData, (item) => {
18394
18394
  return openBlock(), createElementBlock("div", {
18395
18395
  class: normalizeClass(["nv-c-p nv-cascader-item", { active: _ctx.TypeValue.includes(item.value) }]),
@@ -18729,7 +18729,7 @@ const NvStructureSelect_vue_vue_type_style_index_0_scoped_fbbaca53_lang = "";
18729
18729
  const _withScopeId = (n) => (pushScopeId("data-v-fbbaca53"), n = n(), popScopeId(), n);
18730
18730
  const _hoisted_1$1 = { key: 1 };
18731
18731
  const _hoisted_2$1 = { class: "nv-pos-r" };
18732
- const _hoisted_3 = { class: "nv-c-p structure-sel-box" };
18732
+ const _hoisted_3$1 = { class: "nv-c-p structure-sel-box" };
18733
18733
  const _hoisted_4 = { key: 0 };
18734
18734
  const _hoisted_5 = {
18735
18735
  key: 0,
@@ -18873,7 +18873,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
18873
18873
  ]),
18874
18874
  default: withCtx(() => [
18875
18875
  createElementVNode("div", _hoisted_2$1, [
18876
- createElementVNode("div", _hoisted_3, [
18876
+ createElementVNode("div", _hoisted_3$1, [
18877
18877
  _ctx.StructureInstanceCheckData.length == 0 ? (openBlock(), createElementBlock("div", _hoisted_4, "点击选择构件")) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
18878
18878
  _ctx.multiple ? (openBlock(), createElementBlock("div", _hoisted_5, " 已选择" + toDisplayString(_ctx.StructureInstanceCheckData.length) + "个构件(" + toDisplayString(_ctx.StructureInstanceCheckData.map((e) => e["NodeName"]).toString()) + ") ", 1)) : (openBlock(), createElementBlock("div", _hoisted_6, [
18879
18879
  createTextVNode(toDisplayString(_ctx.StructureInstanceCheckData[0].NodeName) + " ", 1),
@@ -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()}`;
@@ -19497,9 +19538,10 @@ class UploadFileInstance2 extends BaseInstance {
19497
19538
  }
19498
19539
  //#endregion 业务逻辑 文件预览 END
19499
19540
  }
19500
- const UploadFileList_vue_vue_type_style_index_0_scoped_cd979ed3_lang = "";
19541
+ const UploadFileList_vue_vue_type_style_index_0_scoped_f6018903_lang = "";
19501
19542
  const _hoisted_1 = { class: "uploadFileList" };
19502
19543
  const _hoisted_2 = { class: "up-btn-box" };
19544
+ const _hoisted_3 = { class: "nv-flex-1" };
19503
19545
  function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
19504
19546
  const _component_Spin = resolveComponent("Spin");
19505
19547
  const _component_Button = resolveComponent("Button");
@@ -19518,7 +19560,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
19518
19560
  "dis-hover": "",
19519
19561
  key: index,
19520
19562
  style: { "margin-bottom": "8px", "height": "100%" }
19521
- }, createSlots({
19563
+ }, {
19522
19564
  default: withCtx(() => [
19523
19565
  createElementVNode("div", _hoisted_2, [
19524
19566
  !_ctx.isShowtrash ? (openBlock(), createBlock(_component_Upload, {
@@ -19566,22 +19608,16 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
19566
19608
  _: 1
19567
19609
  }, 8, ["onClick"])) : createCommentVNode("", true)
19568
19610
  ]),
19569
- createVNode(_component_NvGrid, {
19570
- ref_for: true,
19571
- ref: (el) => _ctx.getuploadListGridRef(el, index),
19572
- option: _ctx.uploadListGridOption
19573
- }, null, 8, ["option"])
19611
+ createElementVNode("div", _hoisted_3, [
19612
+ createVNode(_component_NvGrid, {
19613
+ ref_for: true,
19614
+ ref: (el) => _ctx.getuploadListGridRef(el, index),
19615
+ option: _ctx.uploadListGridOption
19616
+ }, null, 8, ["option"])
19617
+ ])
19574
19618
  ]),
19575
19619
  _: 2
19576
- }, [
19577
- groupName != "默认" ? {
19578
- name: "title",
19579
- fn: withCtx(() => [
19580
- createTextVNode(toDisplayString(groupName), 1)
19581
- ]),
19582
- key: "0"
19583
- } : void 0
19584
- ]), 1024);
19620
+ }, 1024);
19585
19621
  }), 128)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
19586
19622
  createTextVNode("附件列表暂不支持分组")
19587
19623
  ], 64)),
@@ -19594,7 +19630,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
19594
19630
  }, null, 8, ["modelValue", "preview-list", "preview-index", "file-info"])
19595
19631
  ]);
19596
19632
  }
19597
- const UploadFileList = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-cd979ed3"]]);
19633
+ const UploadFileList = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-f6018903"]]);
19598
19634
  const propDefine = {
19599
19635
  onlyView: {
19600
19636
  // 是否只读
@@ -19703,6 +19739,28 @@ class ComFormInstance extends BaseInstance {
19703
19739
  __publicField(this, "getPropValue", (prop, propName, defaultValue) => {
19704
19740
  return this.utilities.isNull(prop) ? defaultValue : prop[propName];
19705
19741
  });
19742
+ __publicField(this, "getPaginationSet", (item) => {
19743
+ if (this.utilities.isNull(item.uploadFileListProp)) {
19744
+ return null;
19745
+ } else {
19746
+ return {
19747
+ isPagination: item.uploadFileListProp.isOpenPagination,
19748
+ pageSize: item.uploadFileListProp.pageSize ?? 10
19749
+ };
19750
+ }
19751
+ });
19752
+ __publicField(this, "uploadFileListStyle", (item) => {
19753
+ var _a;
19754
+ if (this.utilities.isNull(item.uploadFileListProp)) {
19755
+ return {
19756
+ height: "200px"
19757
+ };
19758
+ } else {
19759
+ return {
19760
+ height: ((_a = item.uploadFileListProp) == null ? void 0 : _a.isOpenPagination) ? "300px" : "200px"
19761
+ };
19762
+ }
19763
+ });
19706
19764
  this.props = props;
19707
19765
  this.ctx = ctx;
19708
19766
  }
@@ -19762,11 +19820,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
19762
19820
  }, null, 8, ["readonly", "dataValue", "multiple", "selType", "onOnChange"])) : createCommentVNode("", true),
19763
19821
  item.type === "UploadFileList" ? (openBlock(), createBlock(_component_UploadFileList, {
19764
19822
  key: 5,
19765
- style: { "height": "200px" },
19823
+ style: normalizeStyle(_ctx.uploadFileListStyle(item)),
19766
19824
  readonly: _ctx.getPropValue(item.uploadFileListProp, "readonly") || _ctx.onlyView,
19767
19825
  token: _ctx.formModel[item.model],
19826
+ paginationSet: _ctx.getPaginationSet(item),
19768
19827
  onReturnFileList: ($event) => _ctx.tokenList($event, item)
19769
- }, null, 8, ["readonly", "token", "onReturnFileList"])) : createCommentVNode("", true)
19828
+ }, null, 8, ["style", "readonly", "token", "paginationSet", "onReturnFileList"])) : createCommentVNode("", true)
19770
19829
  ]),
19771
19830
  _: 1
19772
19831
  }, 8, ["onlyView", "formItems", "formModel"]);