@newview/file-ui 1.1.8 → 1.1.10

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,11 @@
1
- 版本 1.1.8
1
+ ## 1.1.10
2
+ 1. UploadFile 增加只读状态且无附件信息下的显示信息提示
3
+ 2. UploadFile 修改预览图片时,图片显示不对应问题
4
+ 3. UploadFile 修改只读且无附件提示样式
5
+ 4. TextEditor 只读状态下增加显示/隐藏边框配置
6
+ 5. ComFormUp 增加 TextEditor 获取值方法 及 text 改变事件
7
+ 6. ComFormUp 增加附件校验
8
+
9
+ ## 1.1.8
2
10
 
3
11
  1. ComFormUp 添加 TextEditor 组件导出的方法
package/dist/file-ui.js CHANGED
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  import { BaseInstance } from "@newview/base-vue";
8
- import { defineComponent, ref, watch, resolveComponent, openBlock, createElementBlock, Fragment, createVNode, withCtx, createElementVNode, reactive, renderList, createBlock, createSlots, normalizeClass, withModifiers, createCommentVNode, createTextVNode, toDisplayString, onMounted, onBeforeUnmount, nextTick, h, watchEffect, normalizeStyle } from "vue";
8
+ import { defineComponent, ref, watch, resolveComponent, openBlock, createElementBlock, Fragment, createVNode, withCtx, createElementVNode, reactive, renderList, createBlock, createSlots, normalizeClass, withModifiers, createCommentVNode, toDisplayString, createTextVNode, pushScopeId, popScopeId, onMounted, onBeforeUnmount, nextTick, h, watchEffect, normalizeStyle } from "vue";
9
9
  import { QueryWrapper } from "@newview/infrastructure";
10
10
  import { OSSFileApi, FileApi, UploadApi, FileInfoApi } from "@newview/fileservice-api";
11
11
  const propDefine$3 = {
@@ -148,7 +148,7 @@ const _export_sfc = (sfc, props) => {
148
148
  }
149
149
  return target;
150
150
  };
151
- const _hoisted_1$2 = { class: "ifr-container" };
151
+ const _hoisted_1$1 = { class: "ifr-container" };
152
152
  const _hoisted_2$1 = ["src", "title"];
153
153
  function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
154
154
  const _component_ImagePreview = resolveComponent("ImagePreview");
@@ -173,7 +173,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
173
173
  onOnVisibleChange: _ctx.doClose
174
174
  }, {
175
175
  default: withCtx(() => [
176
- createElementVNode("div", _hoisted_1$2, [
176
+ createElementVNode("div", _hoisted_1$1, [
177
177
  createElementVNode("iframe", {
178
178
  src: _ctx.ifrUrl,
179
179
  class: "ifr-content",
@@ -246,6 +246,11 @@ const propDefine$2 = {
246
246
  // 单文件
247
247
  type: Boolean,
248
248
  default: false
249
+ },
250
+ nullMsg: {
251
+ //只读状态且无附件信息下的显示
252
+ type: String,
253
+ default: "暂无附件"
249
254
  }
250
255
  };
251
256
  const _sfc_main$2 = defineComponent({
@@ -518,6 +523,7 @@ class UploadFileInstance extends BaseInstance {
518
523
  * @param fileInfo
519
524
  */
520
525
  __publicField(this, "doView", (fileInfo) => {
526
+ debugger;
521
527
  this.previewFileInfo = fileInfo;
522
528
  this.previewVisible.value = true;
523
529
  this.previewIndex.value = fileInfo.PreviewIndex;
@@ -581,6 +587,7 @@ class UploadFileInstance extends BaseInstance {
581
587
  */
582
588
  setPreviewList() {
583
589
  let index = 0;
590
+ this.previewList.value = [];
584
591
  for (const fileInfo of this.fileList.value) {
585
592
  if (this.isImage(fileInfo)) {
586
593
  fileInfo.PreviewIndex = index;
@@ -591,13 +598,39 @@ class UploadFileInstance extends BaseInstance {
591
598
  }
592
599
  //#endregion 业务逻辑 文件预览 END
593
600
  }
594
- const UploadFile_vue_vue_type_style_index_0_scoped_decdfed6_lang = "";
595
- const _hoisted_1$1 = { class: "uploadFile" };
601
+ const UploadFile_vue_vue_type_style_index_0_scoped_d6b14e55_lang = "";
602
+ const _withScopeId = (n) => (pushScopeId("data-v-d6b14e55"), n = n(), popScopeId(), n);
603
+ const _hoisted_1 = { class: "uploadFile" };
596
604
  const _hoisted_2 = ["onClick", "title"];
597
605
  const _hoisted_3 = { class: "file-upload-list-cover" };
598
606
  const _hoisted_4 = { class: "file-upload-btn" };
599
- const _hoisted_5 = { class: "file-upload-list-cover" };
600
- const _hoisted_6 = { class: "file-upload-btn" };
607
+ const _hoisted_5 = {
608
+ key: 1,
609
+ class: "nv-flex",
610
+ style: { "color": "#949494", "border": "1px dashed #dcdee2", "height": "60px", "padding": "0 20px", "font-size": "16px", "justify-content": "center" }
611
+ };
612
+ const _hoisted_6 = {
613
+ class: "nv-flex",
614
+ style: { "width": "40px", "margin-right": "6px" }
615
+ };
616
+ const _hoisted_7 = {
617
+ t: "1706683071705",
618
+ class: "icon",
619
+ viewBox: "0 0 1566 1024",
620
+ version: "1.1",
621
+ xmlns: "http://www.w3.org/2000/svg",
622
+ "p-id": "4559",
623
+ style: { "fill": "currentColor" }
624
+ };
625
+ const _hoisted_8 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("path", {
626
+ d: "M156.661991 699.757959h21.096999a10.443999 10.443999 0 0 1 10.235999 10.443999c0 5.765-4.491 10.443999-10.235999 10.444h-21.096999v21.097999a10.443999 10.443999 0 0 1-10.444 10.234999 10.276999 10.276999 0 0 1-10.443999-10.234999v-21.097999h-21.096999a10.443999 10.443999 0 0 1-10.234999-10.444c0-5.765 4.49-10.443999 10.234999-10.443999h21.096999v-21.096999a10.443999 10.443999 0 0 1 10.443999-10.234999c5.765 0 10.443999 4.49 10.444 10.234999v21.096999z m1378.627919-83.552995v-21.096999a10.276999 10.276999 0 0 0-10.443999-10.234999 10.443999 10.443999 0 0 0-10.444 10.234999v21.096999h-21.096998a10.276999 10.276999 0 0 0-10.235 10.443999c0 5.598 4.595 10.443999 10.235 10.444h21.096998v21.096998c0 5.745 4.679 10.235999 10.444 10.236a10.443999 10.443999 0 0 0 10.443999-10.236v-21.096998h21.097999c5.744 0 10.234999-4.679 10.234999-10.444a10.443999 10.443999 0 0 0-10.234999-10.443999h-21.097999zM776.459955 960.861944H250.596985a20.804999 20.804999 0 0 1-20.825998-20.887999c0-11.529999 9.462999-20.888999 20.825998-20.888999h94.727995a83.009995 83.009995 0 0 1-11.112-41.671997v-605.969965a83.489995 83.489995 0 0 1 83.636996-83.447995h62.580996v-20.992999a83.489995 83.489995 0 0 1 83.636995-83.448995h501.151971a83.448995 83.448995 0 0 1 83.636995 83.448995v605.969965c0 15.184999-4.053 29.409998-11.134 41.671997h115.553994c11.551999 0 20.909999 9.273999 20.909998 20.887999 0 11.529999-9.295999 20.887999-20.888998 20.887999h-250.659986v20.992999c0 15.185999-4.052 29.409998-11.132999 41.671997h11.195999c11.488999 0 20.825999 9.274999 20.825999 20.888999 0 11.529999-9.462999 20.887999-20.825999 20.887999H892.807948a41.657998 41.657998 0 0 1-6.413 50.862997 41.671998 41.671998 0 0 1-59.071996 0l-50.862997-50.862997z m76.367995-41.776998h66.423996c22.977999 0 41.609998-18.589999 41.609998-41.879997V270.460984c0-22.559999-18.047999-40.689998-40.313998-40.689997H416.303976c-22.266999 0-40.314998 18.213999-40.314998 40.689997v606.741965c0 23.123999 18.799999 41.880998 41.589998 41.880997h317.083981l-10.736999-10.756999a41.692998 41.692998 0 0 1-10.862-40.376998l-19.718999-19.739999a146.259991 146.259991 0 0 1-190.980988-220.516987 146.217991 146.217991 0 0 1 220.517987 190.980989l19.738998 19.739999a41.629998 41.629998 0 0 1 40.376998 10.839999l69.829996 69.829996z m149.809991-104.440994h62.852997a41.796998 41.796998 0 0 0 41.589997-41.776997v-605.759965c0-23.144999-18.632999-41.776998-41.589997-41.776997H563.774967a41.796998 41.796998 0 0 0-41.566998 41.775997v20.888999h396.793977a83.448995 83.448995 0 0 1 83.636995 83.448995v543.199968zM266.326984 46.998997h31.122999c8.773999 0 15.875999 6.955 15.875999 15.665999 0 8.647999-7.102 15.665999-15.875999 15.665999h-31.122999v31.123999c0 8.772999-6.956 15.874999-15.665999 15.874999a15.769999 15.769999 0 0 1-15.666999-15.874999V78.329995H203.869988a15.728999 15.728999 0 0 1-15.874999-15.665999c0-8.647999 7.102-15.665999 15.874999-15.665999h31.122998V15.874999C234.992986 7.102 241.949986 0 250.659985 0c8.646999 0 15.665999 7.102 15.665999 15.874999V46.999997zM20.887999 939.973945c0-11.529999 9.462999-20.888999 20.825999-20.888999h125.454992c11.488999 0 20.825999 9.274999 20.825999 20.888999 0 11.529999-9.462999 20.887999-20.825999 20.887999H41.713998a20.804999 20.804999 0 0 1-20.825999-20.887999z m658.733961-135.021992A104.441994 104.441994 0 1 0 531.899969 657.229961a104.441994 104.441994 0 0 0 147.721991 147.721992z m-220.079987-491.626971a20.887999 20.887999 0 0 1 20.867999-20.888999h229.791986a20.887999 20.887999 0 1 1 0 41.776997H480.430972a20.825999 20.825999 0 0 1-20.887999-20.887998z m0 104.440994c0-11.529999 9.295999-20.887999 20.742999-20.887999H814.789952c11.446999 0 20.741999 9.273999 20.741999 20.887999 0 11.529999-9.294999 20.887999-20.741999 20.887998H480.284972a20.762999 20.762999 0 0 1-20.741999-20.887998z m0 104.441993c0-11.529999 9.316999-20.888999 20.846999-20.888998h146.301991c11.509999 0 20.845999 9.274999 20.845999 20.888998 0 11.529999-9.315999 20.887999-20.845999 20.887999H480.388972a20.804999 20.804999 0 0 1-20.845999-20.887999zM62.665996 396.877977a62.664996 62.664996 0 1 1 0-125.329993 62.664996 62.664996 0 0 1 0 125.329993z m0-31.332998a31.331998 31.331998 0 1 0 0-62.664997 31.331998 31.331998 0 0 0 0 62.664997z m1295.074924-93.996995a62.664996 62.664996 0 1 1 0-125.329993 62.664996 62.664996 0 0 1 0 125.329993z m0-31.332998a31.331998 31.331998 0 1 0 0-62.663996 31.331998 31.331998 0 0 0 0 62.663996z",
627
+ "p-id": "4560"
628
+ }, null, -1));
629
+ const _hoisted_9 = [
630
+ _hoisted_8
631
+ ];
632
+ const _hoisted_10 = { class: "file-upload-list-cover" };
633
+ const _hoisted_11 = { class: "file-upload-btn" };
601
634
  function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
602
635
  const _component_Image = resolveComponent("Image");
603
636
  const _component_Icon = resolveComponent("Icon");
@@ -606,7 +639,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
606
639
  const _component_Card = resolveComponent("Card");
607
640
  const _component_Spin = resolveComponent("Spin");
608
641
  const _component_filePreview = resolveComponent("filePreview");
609
- return openBlock(), createElementBlock("div", _hoisted_1$1, [
642
+ return openBlock(), createElementBlock("div", _hoisted_1, [
610
643
  !_ctx.single ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.groups, (groupName) => {
611
644
  return openBlock(), createBlock(_component_Card, {
612
645
  "dis-hover": "",
@@ -615,7 +648,9 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
615
648
  default: withCtx(() => [
616
649
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.getGroupFiles(groupName), (item, index) => {
617
650
  return openBlock(), createElementBlock("div", {
618
- class: normalizeClass(_ctx.isImage(item) ? "file-upload-list file-upload-list-bs" : "file-upload-list")
651
+ class: normalizeClass(
652
+ _ctx.isImage(item) ? "file-upload-list file-upload-list-bs" : "file-upload-list"
653
+ )
619
654
  }, [
620
655
  createElementVNode("div", {
621
656
  class: "file-upload-list-content",
@@ -677,7 +712,13 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
677
712
  ])
678
713
  ]),
679
714
  _: 2
680
- }, 1032, ["multiple", "format", "max-size", "action", "headers", "data", "on-success", "on-format-error", "on-exceeded-size", "before-upload"])) : createCommentVNode("", true)
715
+ }, 1032, ["multiple", "format", "max-size", "action", "headers", "data", "on-success", "on-format-error", "on-exceeded-size", "before-upload"])) : createCommentVNode("", true),
716
+ _ctx.readonly && _ctx.fileList.length == 0 ? (openBlock(), createElementBlock("div", _hoisted_5, [
717
+ createElementVNode("i", _hoisted_6, [
718
+ (openBlock(), createElementBlock("svg", _hoisted_7, _hoisted_9))
719
+ ]),
720
+ createElementVNode("div", null, toDisplayString(_ctx.nullMsg), 1)
721
+ ])) : createCommentVNode("", true)
681
722
  ]),
682
723
  _: 2
683
724
  }, [
@@ -702,7 +743,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
702
743
  width: "100%",
703
744
  height: "100%"
704
745
  }, null, 8, ["src"]),
705
- createElementVNode("div", _hoisted_5, [
746
+ createElementVNode("div", _hoisted_10, [
706
747
  createVNode(_component_Space, null, {
707
748
  default: withCtx(() => [
708
749
  createVNode(_component_Icon, {
@@ -745,7 +786,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
745
786
  style: { "display": "inline-block", "width": "78px" }
746
787
  }, {
747
788
  default: withCtx(() => [
748
- createElementVNode("div", _hoisted_6, [
789
+ createElementVNode("div", _hoisted_11, [
749
790
  createVNode(_component_Icon, {
750
791
  type: "ios-camera",
751
792
  size: "20"
@@ -771,7 +812,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
771
812
  }, null, 8, ["modelValue", "preview-list", "preview-index", "file-info"])
772
813
  ]);
773
814
  }
774
- const UploadFile = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-decdfed6"]]);
815
+ const UploadFile = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-d6b14e55"]]);
775
816
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
776
817
  function getDefaultExportFromCjs(x) {
777
818
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -15115,6 +15156,10 @@ const propDefine$1 = {
15115
15156
  readonly: {
15116
15157
  type: Boolean,
15117
15158
  default: false
15159
+ },
15160
+ border: {
15161
+ type: Boolean,
15162
+ default: true
15118
15163
  }
15119
15164
  };
15120
15165
  const _sfc_main$1 = defineComponent({
@@ -15173,6 +15218,13 @@ let TextEditor$1 = class TextEditor extends BaseInstance {
15173
15218
  this.ctx.emit("update:modelValue", this.content.value);
15174
15219
  this.ctx.emit("textChange", this.content.value);
15175
15220
  });
15221
+ /**
15222
+ * 获取长文本
15223
+ * @returns
15224
+ */
15225
+ __publicField(this, "getText", () => {
15226
+ return this.QuillEditorRef.value.getHTML();
15227
+ });
15176
15228
  /**
15177
15229
  * 保存长文本
15178
15230
  */
@@ -15235,11 +15287,13 @@ let TextEditor$1 = class TextEditor extends BaseInstance {
15235
15287
  }
15236
15288
  //#endregion 业务逻辑 END
15237
15289
  };
15238
- const TextEditor_vue_vue_type_style_index_0_scoped_5e7ac7cc_lang = "";
15239
- const _hoisted_1 = { style: { "height": "100%" } };
15290
+ const TextEditor_vue_vue_type_style_index_0_scoped_5812cc0f_lang = "";
15240
15291
  function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
15241
15292
  const _component_QuillEditor = resolveComponent("QuillEditor");
15242
- return openBlock(), createElementBlock("div", _hoisted_1, [
15293
+ return openBlock(), createElementBlock("div", {
15294
+ style: { "height": "100%" },
15295
+ class: normalizeClass({ "text-edit-border": _ctx.border && _ctx.readonly })
15296
+ }, [
15243
15297
  _ctx.componentShow ? (openBlock(), createBlock(_component_QuillEditor, {
15244
15298
  key: 0,
15245
15299
  content: _ctx.content,
@@ -15251,9 +15305,9 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
15251
15305
  ref: "QuillEditorRef",
15252
15306
  options: _ctx.options
15253
15307
  }, null, 8, ["content", "readOnly", "theme", "onTextChange", "options"])) : createCommentVNode("", true)
15254
- ]);
15308
+ ], 2);
15255
15309
  }
15256
- const TextEditor2 = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-5e7ac7cc"]]);
15310
+ const TextEditor2 = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-5812cc0f"]]);
15257
15311
  const propDefine = {
15258
15312
  onlyView: {
15259
15313
  // 是否只读
@@ -15275,7 +15329,7 @@ const propDefine = {
15275
15329
  const _sfc_main = defineComponent({
15276
15330
  name: "NvComFormUp",
15277
15331
  components: { UploadFile, TextEditor: TextEditor2 },
15278
- emits: [""],
15332
+ emits: ["textChange", "TokenChange"],
15279
15333
  props: propDefine,
15280
15334
  setup(props, ctx) {
15281
15335
  return new ComFormInstance(props, ctx);
@@ -15317,6 +15371,31 @@ class ComFormInstance extends BaseInstance {
15317
15371
  __publicField(this, "deleteTextDataByToken", async (Token) => {
15318
15372
  this.textEditorRef.value.deleteTextDataByToken(Token);
15319
15373
  });
15374
+ /**
15375
+ * 获取长文本
15376
+ */
15377
+ __publicField(this, "getText", () => {
15378
+ return this.textEditorRef.value.getText();
15379
+ });
15380
+ /**
15381
+ * 附件校验
15382
+ * @param Token
15383
+ */
15384
+ __publicField(this, "tokenList", (data, item) => {
15385
+ this.ctx.emit("TokenChange", data);
15386
+ if (data.list.length > 0) {
15387
+ this.props.formModel[item.model] = data.token;
15388
+ } else {
15389
+ this.props.formModel[item.model] = "";
15390
+ }
15391
+ });
15392
+ /**
15393
+ * 文本改变
15394
+ * @param data
15395
+ */
15396
+ __publicField(this, "textChange", (data) => {
15397
+ this.ctx.emit("textChange", data);
15398
+ });
15320
15399
  this.props = props;
15321
15400
  this.ctx = ctx;
15322
15401
  }
@@ -15335,15 +15414,18 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
15335
15414
  item.type === "UploadFile" ? (openBlock(), createBlock(_component_UploadFile, {
15336
15415
  key: 0,
15337
15416
  readonly: _ctx.onlyView,
15417
+ onReturnFileList: ($event) => _ctx.tokenList($event, item),
15338
15418
  token: _ctx.formModel[item.model]
15339
- }, null, 8, ["readonly", "token"])) : createCommentVNode("", true),
15419
+ }, null, 8, ["readonly", "onReturnFileList", "token"])) : createCommentVNode("", true),
15340
15420
  item.type === "TextEditor" ? (openBlock(), createBlock(_component_TextEditor, {
15341
15421
  key: 1,
15342
15422
  ref: "textEditorRef",
15343
15423
  readonly: _ctx.onlyView,
15344
15424
  style: normalizeStyle({ height: `${item.textHeight == void 0 ? "300" : item.textHeight}px` }),
15345
- token: _ctx.formModel[item.model]
15346
- }, null, 8, ["readonly", "style", "token"])) : createCommentVNode("", true)
15425
+ token: _ctx.formModel[item.model],
15426
+ border: item.textBorder,
15427
+ onTextChange: _ctx.textChange
15428
+ }, null, 8, ["readonly", "style", "token", "border", "onTextChange"])) : createCommentVNode("", true)
15347
15429
  ]),
15348
15430
  _: 1
15349
15431
  }, 8, ["onlyView", "formItems", "formModel"]);