@10yun/cv-pc-ui 0.4.6 → 0.4.8

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/lib/cv-ui.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! cvPcUI v0.4.6 */
1
+ /*! cvPcUI v0.4.8 */
2
2
  import { ClickOutside as e, ElAutocomplete as t, ElAvatar as n, ElBadge as r, ElButton as i, ElButton as a, ElCascader as o, ElCheckbox as s, ElCheckboxButton as c, ElCheckboxGroup as l, ElDatePicker as u, ElDialog as d, ElDrawer as f, ElForm as p, ElFormItem as m, ElIcon as ee, ElImage as te, ElInput as ne, ElInput as h, ElInputNumber as re, ElMessage as ie, ElMessage as g, ElMessageBox as ae, ElMessageBox as oe, ElOption as se, ElPagination as ce, ElPopover as le, ElScrollbar as ue, ElSelect as de, ElSwitch as fe, ElTable as pe, ElTableColumn as _, ElTag as me, ElTimePicker as he } from "element-plus";
3
3
  import { Fragment as v, Transition as ge, TransitionGroup as _e, computed as ve, createBlock as y, createCommentVNode as b, createElementBlock as x, createElementVNode as S, createSlots as ye, createTextVNode as C, createVNode as w, defineComponent as be, getCurrentInstance as xe, getCurrentScope as Se, guardReactiveProps as T, h as Ce, inject as we, markRaw as Te, mergeProps as E, nextTick as Ee, normalizeClass as D, normalizeProps as O, normalizeStyle as k, onBeforeUnmount as De, onMounted as Oe, onScopeDispose as ke, onUnmounted as Ae, openBlock as A, provide as je, reactive as Me, ref as j, render as Ne, renderList as M, renderSlot as N, resolveComponent as P, resolveDirective as Pe, resolveDynamicComponent as Fe, shallowReadonly as Ie, shallowRef as Le, toDisplayString as F, toHandlers as Re, toRaw as ze, toRefs as Be, toValue as Ve, unref as I, useCssVars as He, useSlots as Ue, vModelText as We, vShow as L, watch as Ge, withCtx as R, withDirectives as z, withKeys as Ke, withModifiers as qe } from "vue";
4
4
  import { basicSetup as Je } from "codemirror";
@@ -3805,6 +3805,9 @@ var fa = {
3805
3805
  };
3806
3806
  },
3807
3807
  computed: {
3808
+ isMultiValue() {
3809
+ return !!this.multiple || parseInt(this.allowFileNum) > 1;
3810
+ },
3808
3811
  fileTypeStr() {
3809
3812
  return this.allowFileType.join(",");
3810
3813
  },
@@ -3817,7 +3820,7 @@ var fa = {
3817
3820
  fileSize: this.allowFileSize || "",
3818
3821
  fileUnit: this.fileUnit,
3819
3822
  multiple: this?.multiple || !1,
3820
- limit: this.allowFileNum ? parseInt(this.allowFileNum) : 5
3823
+ limit: this.allowFileNum ? parseInt(this.allowFileNum) : 1
3821
3824
  };
3822
3825
  },
3823
3826
  mergeAttrs() {
@@ -4401,11 +4404,11 @@ function Na(e) {
4401
4404
  }
4402
4405
  function Pa(e, t) {
4403
4406
  let n = [];
4404
- Array.isArray(e) && e.length > 0 && n.push(...e), Array.isArray(t) && t.length > 0 && n.push(...t), typeof t == "string" && n.push(t);
4407
+ Array.isArray(e) && e.length > 0 && n.push(...e), Array.isArray(t) && t.length > 0 && n.push(...t), (typeof t == "string" || typeof t == "number") && n.push(t);
4405
4408
  let r = [];
4406
4409
  for (let e in n) {
4407
4410
  let t = n[e], i = Object.prototype.toString.call(t);
4408
- i === "[object String]" ? r.push(t) : i === "[object Object]" && t.url && r.push(t.url);
4411
+ i === "[object String]" ? r.push(t) : i === "[object Number]" ? r.push(String(t)) : i === "[object Object]" && t.url && r.push(t.url);
4409
4412
  }
4410
4413
  return r;
4411
4414
  }
@@ -4557,11 +4560,11 @@ var Fa = {
4557
4560
  }
4558
4561
  },
4559
4562
  updateValue(e, t) {
4560
- if (this.multiple) {
4563
+ if (this.isMultiValue) {
4561
4564
  let t = Pa(this.localValue, e).join(",");
4562
4565
  this.$emit("update:modelValue", t);
4563
4566
  } else this.$emit("update:modelValue", e);
4564
- if (this.multiple) {
4567
+ if (this.isMultiValue) {
4565
4568
  let e = Pa(this.localList, t);
4566
4569
  this.$emit("update:initValue", e);
4567
4570
  } else this.$emit("update:initValue", t);
@@ -4570,11 +4573,11 @@ var Fa = {
4570
4573
  e.raw, e.type.includes("image") ? (this.previewTitle = e.name, this.previewUrl = e.url, this.previewShow = !0) : window.open(e.url);
4571
4574
  },
4572
4575
  doRemove(e) {
4573
- this.multiple ? (this.localValue = this.localValue.filter((t, n) => n !== e), this.localList = this.localList.filter((t, n) => n !== e)) : (this.localValue = "", this.localList = []), this.updateValue(null, null);
4576
+ this.isMultiValue ? (this.localValue = this.localValue.filter((t, n) => n !== e), this.localList = this.localList.filter((t, n) => n !== e)) : (this.localValue = "", this.localList = []), this.updateValue(null, null);
4574
4577
  },
4575
4578
  handleItemRemove(e, t) {
4576
4579
  if (this.beforeRemove && typeof this.beforeRemove == "function") {
4577
- let e = this.multiple ? this.localValue[t] : this.localValue, n = this.beforeRemove(e, this.localValue);
4580
+ let e = this.isMultiValue ? this.localValue[t] : this.localValue, n = this.beforeRemove(e, this.localValue);
4578
4581
  n && n.then ? n.then(() => {
4579
4582
  this.doRemove(t);
4580
4583
  }, () => {}) : n !== !1 && this.doRemove(t);
@@ -4922,7 +4925,7 @@ var to = {
4922
4925
  },
4923
4926
  allowFileNum: {
4924
4927
  type: [Number],
4925
- default: 5
4928
+ default: 1
4926
4929
  },
4927
4930
  multiple: {
4928
4931
  type: [Boolean],
@@ -5002,7 +5005,7 @@ var to = {
5002
5005
  }
5003
5006
  },
5004
5007
  updateValue(e, t) {
5005
- if (this.multiple) {
5008
+ if (this.isMultiValue) {
5006
5009
  let n = Pa(this.localValue, e), r = Pa(this.localList, t);
5007
5010
  this.$emit("update:modelValue", n), this.$emit("update:initValue", r);
5008
5011
  } else this.$emit("update:modelValue", e || ""), this.$emit("update:initValue", t || "");
@@ -5017,7 +5020,7 @@ var to = {
5017
5020
  },
5018
5021
  _do_remove(e) {
5019
5022
  let t = this.localList[e];
5020
- if (this.$emit("remove", t, this.localList), this.multiple) {
5023
+ if (this.$emit("remove", t, this.localList), this.isMultiValue) {
5021
5024
  let t = this.localValue.filter((t, n) => n !== e), n = this.localList.filter((t, n) => n !== e).map((e) => e.url);
5022
5025
  this.$emit("update:modelValue", t), this.$emit("update:initValue", n);
5023
5026
  } else this.$emit("update:modelValue", ""), this.$emit("update:initValue", "");
@@ -13217,7 +13220,7 @@ function nm(e, t, n, r, i, a) {
13217
13220
  class: "tinymce-textarea"
13218
13221
  }, null, 8, tm)], 6);
13219
13222
  }
13220
- var rm = /*#__PURE__*/ H(em, [["render", nm], ["__scopeId", "data-v-16673ff9"]]), im = {
13223
+ var rm = /*#__PURE__*/ H(em, [["render", nm], ["__scopeId", "data-v-681627a2"]]), im = {
13221
13224
  name: "cvEditorMarkdown",
13222
13225
  mixins: [
13223
13226
  ap,
@@ -14883,22 +14886,17 @@ var yg = class {
14883
14886
  onClick: e.clickFn
14884
14887
  }, e.text)));
14885
14888
  let a = function(t) {
14886
- e.close();
14889
+ t || e.close();
14887
14890
  }, o = typeof e.boxOptions.beforeClose == "function" ? e.boxOptions.beforeClose : a;
14888
14891
  return w(d, {
14889
14892
  ...e.boxProps.value,
14890
14893
  modelValue: e.boxShow.value,
14891
14894
  beforeClose: (t) => {
14892
- e.boxOptions.closeIsConfirm ? ae.confirm("确认关闭?", "提示").then((e) => {
14895
+ typeof e.boxOptions.beforeClose == "function" ? o(a) : e.boxOptions.closeIsConfirm ? ae.confirm("确认关闭?", "提示").then((e) => {
14893
14896
  o(a);
14894
- }).catch((e) => {
14895
- a();
14896
- }) : o(a);
14897
+ }).catch((e) => {}) : o(a);
14897
14898
  },
14898
- onClosed2(t) {
14899
- e.close();
14900
- },
14901
- onClosed: e.close
14899
+ onClosed: () => e._destroyVm()
14902
14900
  }, { default: () => t });
14903
14901
  }
14904
14902
  };
@@ -14909,7 +14907,10 @@ var yg = class {
14909
14907
  r.appContext = this.WinVue._context, Ne(r, this.vmTargetElement), this.vmApp = r;
14910
14908
  }
14911
14909
  close() {
14912
- this.boxShow && (this.boxShow.value = !1), this.vmTargetElement && (Ne(null, this.vmTargetElement), document.body.removeChild(this.vmTargetElement), this.vmApp = null);
14910
+ this.boxShow.value ? this.boxShow.value = !1 : this._destroyVm();
14911
+ }
14912
+ _destroyVm() {
14913
+ this.vmApp && this.vmTargetElement && (Ne(null, this.vmTargetElement), document.body.removeChild(this.vmTargetElement), this.vmApp = null);
14913
14914
  }
14914
14915
  show() {
14915
14916
  this.boxShow.value = !0;
@@ -14995,22 +14996,17 @@ var xg = class {
14995
14996
  onClick: e.clickFn
14996
14997
  }, e.text)));
14997
14998
  let a = function(t) {
14998
- e.close();
14999
+ t || e.close();
14999
15000
  }, o = typeof e.boxOptions.beforeClose == "function" ? e.boxOptions.beforeClose : a;
15000
15001
  return w(f, {
15001
15002
  ...e.boxProps.value,
15002
15003
  modelValue: e.boxShow.value,
15003
15004
  beforeClose: (t) => {
15004
- e.boxOptions.closeIsConfirm ? ae.confirm("确认关闭?", "提示").then((e) => {
15005
+ typeof e.boxOptions.beforeClose == "function" ? o(a) : e.boxOptions.closeIsConfirm ? ae.confirm("确认关闭?", "提示").then((e) => {
15005
15006
  o(a);
15006
- }).catch((e) => {
15007
- a();
15008
- }) : o(a);
15007
+ }).catch((e) => {}) : o(a);
15009
15008
  },
15010
- onClosed2(e) {
15011
- this.clearVm();
15012
- },
15013
- onClosed: this.clearVm
15009
+ onClosed: () => e._destroyVm()
15014
15010
  }, { default: () => t });
15015
15011
  }
15016
15012
  };
@@ -15021,7 +15017,10 @@ var xg = class {
15021
15017
  r.appContext = this.WinVue._context, Ne(r, this.vmTargetElement), this.vmApp = r;
15022
15018
  }
15023
15019
  close() {
15024
- this.boxShow.value = !1, Ne(null, this.vmTargetElement);
15020
+ this.boxShow.value ? this.boxShow.value = !1 : this._destroyVm();
15021
+ }
15022
+ _destroyVm() {
15023
+ this.vmApp &&= (Ne(null, this.vmTargetElement), null);
15025
15024
  }
15026
15025
  show() {
15027
15026
  this.boxShow.value = !0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@10yun/cv-pc-ui",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "private": false,
5
5
  "description": "cvjs-pc-ui组件",
6
6
  "homepage": "http://cvjs.cn/cv-pc-ui",
@@ -84,7 +84,7 @@
84
84
  "@vitejs/plugin-vue": "^6.0.10",
85
85
  "rollup-plugin-visualizer": "^7.1.1",
86
86
  "vite": "8.3.5",
87
- "vue-tsc": "^3.3.13"
87
+ "vue-tsc": "^3.3.14"
88
88
  },
89
89
  "peerDependencies": {
90
90
  "element-plus": "^2"
@@ -12,6 +12,14 @@ export function content_to_value(valDef) {
12
12
  return [];
13
13
  }
14
14
  }
15
+ /**
16
+ * 值归并:把「已有列表」与「本次新增」合成一维的值数组(ID 或 url)
17
+ * ⚠️ 数字 ID 必须收下:后端 filelog_id 是整型,而多值字段的 modelValue 全靠这里重算
18
+ * (删除走 updateValue(null, null) → array_to_value(localValue, null)),
19
+ * 原来只认 [object String] 会把整列数字 ID 静默丢光 → 抛出的逗号串变成 '' →
20
+ * 表现为「多值时删一张,值全部清空」;连续上传第二张也会丢(array2 只判 string)
21
+ * 统一转字符串输出,与 content_to_value 的 number 分支口径保持一致
22
+ */
15
23
  export function array_to_value(array1, array2) {
16
24
  let newArr = [];
17
25
  if (Array.isArray(array1) && array1.length > 0) {
@@ -20,7 +28,7 @@ export function array_to_value(array1, array2) {
20
28
  if (Array.isArray(array2) && array2.length > 0) {
21
29
  newArr.push(...array2);
22
30
  }
23
- if (typeof array2 == 'string') {
31
+ if (typeof array2 == 'string' || typeof array2 == 'number') {
24
32
  newArr.push(array2);
25
33
  }
26
34
  let lastArr = [];
@@ -29,6 +37,8 @@ export function array_to_value(array1, array2) {
29
37
  let newType = Object.prototype.toString.call(newItem);
30
38
  if (newType === '[object String]') {
31
39
  lastArr.push(newItem);
40
+ } else if (newType === '[object Number]') {
41
+ lastArr.push(String(newItem));
32
42
  } else if (newType === '[object Object]') {
33
43
  if (newItem.url) {
34
44
  lastArr.push(newItem.url);