widget.qw 1.0.71 → 1.0.73

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/build/style.css CHANGED
@@ -412,10 +412,10 @@
412
412
  text-align: center;
413
413
  display: inline-block;
414
414
  border-radius: 2px;
415
- }[data-v-7352dfa0] .label {
415
+ }[data-v-0c20dca4] .label {
416
416
  color: #000 !important;
417
417
  }
418
- [data-v-7352dfa0] .van-field__control:disabled {
418
+ [data-v-0c20dca4] .van-field__control:disabled {
419
419
  color: #000 !important;
420
420
  cursor: not-allowed;
421
421
  opacity: 1;
@@ -840,14 +840,14 @@
840
840
  }
841
841
  .widget .readonly-field[data-v-0c8e09c0] {
842
842
  margin: 4px 0;
843
- }.widget[data-v-1fa437e7] {
843
+ }.widget[data-v-222a5036] {
844
844
  background: #fff;
845
845
  box-sizing: border-box;
846
846
  height: 100%;
847
847
  text-align: left;
848
848
  font-size: 12px;
849
849
  }
850
- .option[data-v-1fa437e7] {
850
+ .option[data-v-222a5036] {
851
851
  margin: 0 8px 8px 0;
852
852
  padding: 5px 10px;
853
853
  border-radius: 6px;
@@ -857,16 +857,16 @@
857
857
  display: inline-block;
858
858
  position: relative;
859
859
  }
860
- [data-v-1fa437e7] .van-field__label {
860
+ [data-v-222a5036] .van-field__label {
861
861
  margin: auto;
862
862
  }
863
- [data-v-1fa437e7] .van-cell {
863
+ [data-v-222a5036] .van-cell {
864
864
  font-size: 12px;
865
865
  padding: 5px 5px;
866
866
  }
867
- [data-v-1fa437e7] .van-icon {
867
+ [data-v-222a5036] .van-icon {
868
868
  font-size: 12px;
869
869
  }
870
- [data-v-1fa437e7] .van-popup .van-cell {
870
+ [data-v-222a5036] .van-popup .van-cell {
871
871
  padding: 5px 25px;
872
872
  }
@@ -18730,21 +18730,25 @@ const _sfc_main$i = {
18730
18730
  }
18731
18731
  };
18732
18732
  var ImagesPicker = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-8fca1c96"]]);
18733
- var FilePicker_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "[data-v-7352dfa0] .label {\n color: #000 !important;\n}\n[data-v-7352dfa0] .van-field__control:disabled {\n color: #000 !important;\n cursor: not-allowed;\n opacity: 1;\n -webkit-text-fill-color: #000;\n}")();
18733
+ var FilePicker_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "[data-v-0c20dca4] .label {\n color: #000 !important;\n}\n[data-v-0c20dca4] .van-field__control:disabled {\n color: #000 !important;\n cursor: not-allowed;\n opacity: 1;\n -webkit-text-fill-color: #000;\n}")();
18734
18734
  const _hoisted_1$b = {
18735
- class: "image-box"
18735
+ class: "file-box"
18736
18736
  };
18737
18737
  const _sfc_main$h = {
18738
18738
  __name: "FilePicker",
18739
18739
  props: {
18740
18740
  modelValue: {
18741
- type: String,
18742
- default: ""
18741
+ type: [String, Array],
18742
+ default: null
18743
18743
  },
18744
18744
  label: {
18745
18745
  type: String,
18746
18746
  default: ""
18747
18747
  },
18748
+ multiple: {
18749
+ type: Boolean,
18750
+ default: false
18751
+ },
18748
18752
  required: {
18749
18753
  type: Boolean,
18750
18754
  default: false
@@ -18791,22 +18795,44 @@ const _sfc_main$h = {
18791
18795
  file: file.file
18792
18796
  };
18793
18797
  return util.file_upload(params).then((res) => {
18794
- modelValue.value = res.data;
18798
+ if (props.multiple)
18799
+ modelValue.value = [...modelValue.value || [], res.data];
18800
+ else
18801
+ modelValue.value = res.data;
18795
18802
  return Promise.resolve(file);
18796
18803
  });
18797
18804
  });
18798
18805
  const onBeforeDelete = (e) => {
18799
- modelValue.value = "";
18806
+ if (props.multiple) {
18807
+ let newUrls = props.modelValue.filter((item) => {
18808
+ return item != e.url;
18809
+ });
18810
+ emit("update:modelValue", newUrls);
18811
+ } else {
18812
+ modelValue.value = "";
18813
+ }
18800
18814
  return Promise.resolve(e);
18801
18815
  };
18802
18816
  watch(() => props.modelValue, (newVal, oldVal) => {
18803
- if (!props.modelValue) {
18804
- files.value = [];
18805
- return;
18817
+ if (props.multiple) {
18818
+ if (!props.modelValue || props.modelValue.length < 1) {
18819
+ files.value = [];
18820
+ return;
18821
+ }
18822
+ files.value = props.modelValue.map((item) => {
18823
+ return {
18824
+ url: item
18825
+ };
18826
+ });
18827
+ } else {
18828
+ if (!props.modelValue) {
18829
+ files.value = [];
18830
+ return;
18831
+ }
18832
+ files.value = [{
18833
+ url: props.modelValue
18834
+ }];
18806
18835
  }
18807
- files.value = [{
18808
- url: props.modelValue
18809
- }];
18810
18836
  }, {
18811
18837
  immediate: true
18812
18838
  });
@@ -18825,20 +18851,20 @@ const _sfc_main$h = {
18825
18851
  input: withCtx(() => [createElementVNode("div", _hoisted_1$b, [createVNode(_component_van_uploader, {
18826
18852
  modelValue: files.value,
18827
18853
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => files.value = $event),
18828
- "max-count": 1,
18854
+ "max-count": props.max,
18829
18855
  afterRead: onAfterRead,
18830
18856
  disabled: unref(isDisabled),
18831
18857
  accept: props.accept,
18832
18858
  "upload-icon": "plus",
18833
18859
  deletable: !unref(isDisabled),
18834
18860
  "before-delete": onBeforeDelete
18835
- }, null, 8, ["modelValue", "disabled", "accept", "deletable"])])]),
18861
+ }, null, 8, ["modelValue", "max-count", "disabled", "accept", "deletable"])])]),
18836
18862
  _: 1
18837
18863
  }, 8, ["label", "required", "rules", "placeholder"])) : createCommentVNode("", true);
18838
18864
  };
18839
18865
  }
18840
18866
  };
18841
- var FilePicker = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-7352dfa0"]]);
18867
+ var FilePicker = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-0c20dca4"]]);
18842
18868
  var SingleUserSelector_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "\n.user-popup[data-v-a489ca4c] {\r\n width: 100%;\r\n overflow: hidden;\n}\n.department-selector[data-v-a489ca4c] {\r\n padding: 10px;\n}\n.search-buttons[data-v-a489ca4c] {\r\n display: flex;\r\n gap: 10px;\n}\n.clear-btn[data-v-a489ca4c] {\r\n background-color: #f2f3f5;\r\n border: none;\r\n border-radius: 4px;\r\n padding: 4px 8px;\r\n font-size: 14px;\n}\n.confirm-btn[data-v-a489ca4c] {\r\n background-color: #1989fa;\r\n color: white;\r\n border: none;\r\n border-radius: 4px;\r\n padding: 4px 8px;\r\n font-size: 14px;\n}\n.no-results[data-v-a489ca4c] {\r\n text-align: center;\r\n padding: 20px;\r\n color: #969799;\n}\n.picker-header[data-v-a489ca4c] {\r\n padding: 10px;\r\n border-bottom: 1px solid #ebedf0;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\n}\n.current-path[data-v-a489ca4c] {\r\n flex: 1;\r\n font-size: 14px;\r\n color: #323233;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\n}\n.header-right[data-v-a489ca4c] {\r\n display: flex;\r\n gap: 8px;\r\n margin-left: auto;\n}\n.cancel-btn[data-v-a489ca4c] {\r\n color: #969799;\r\n margin-right: 5px;\n}\n.scroll-container[data-v-a489ca4c] {\r\n height: calc(80vh - 150px);\r\n overflow-y: auto;\n}\r\n")();
18843
18869
  const _hoisted_1$a = {
18844
18870
  class: "department-selector"
@@ -20984,7 +21010,7 @@ const _sfc_main$1 = {
20984
21010
  }
20985
21011
  };
20986
21012
  var SingleApiPicker = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-0c8e09c0"]]);
20987
- var ObjsEditor_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => ".widget[data-v-1fa437e7] {\n background: #fff;\n box-sizing: border-box;\n height: 100%;\n text-align: left;\n font-size: 12px;\n}\n.option[data-v-1fa437e7] {\n margin: 0 8px 8px 0;\n padding: 5px 10px;\n border-radius: 6px;\n border: 2px solid #e1e1e1;\n box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);\n color: #666;\n display: inline-block;\n position: relative;\n}\n[data-v-1fa437e7] .van-field__label {\n margin: auto;\n}\n[data-v-1fa437e7] .van-cell {\n font-size: 12px;\n padding: 5px 5px;\n}\n[data-v-1fa437e7] .van-icon {\n font-size: 12px;\n}\n[data-v-1fa437e7] .van-popup .van-cell {\n padding: 5px 25px;\n}")();
21013
+ var ObjsEditor_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => ".widget[data-v-222a5036] {\n background: #fff;\n box-sizing: border-box;\n height: 100%;\n text-align: left;\n font-size: 12px;\n}\n.option[data-v-222a5036] {\n margin: 0 8px 8px 0;\n padding: 5px 10px;\n border-radius: 6px;\n border: 2px solid #e1e1e1;\n box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);\n color: #666;\n display: inline-block;\n position: relative;\n}\n[data-v-222a5036] .van-field__label {\n margin: auto;\n}\n[data-v-222a5036] .van-cell {\n font-size: 12px;\n padding: 5px 5px;\n}\n[data-v-222a5036] .van-icon {\n font-size: 12px;\n}\n[data-v-222a5036] .van-popup .van-cell {\n padding: 5px 25px;\n}")();
20988
21014
  const _hoisted_1 = {
20989
21015
  class: "widget-box"
20990
21016
  };
@@ -21260,12 +21286,14 @@ const _sfc_main = {
21260
21286
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
21261
21287
  return [props.schema[key].type == "String" && !((_b = (_a = props.schema[key]) == null ? void 0 : _a.schema) == null ? void 0 : _b.options) ? (openBlock(), createBlock(_component_van_field, {
21262
21288
  key: 0,
21289
+ disabled: props.schema[key].auth === "readonly",
21263
21290
  modelValue: data2.inputValue[key],
21264
21291
  "onUpdate:modelValue": ($event) => data2.inputValue[key] = $event,
21265
21292
  placeholder: `\u8BF7\u8F93\u5165${key2name(key)}`,
21266
21293
  type: "text"
21267
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : createCommentVNode("", true), props.schema[key].type == "Number" && !((_d = (_c = props.schema[key]) == null ? void 0 : _c.schema) == null ? void 0 : _d.options) ? (openBlock(), createBlock(_component_van_field, {
21294
+ }, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "placeholder"])) : createCommentVNode("", true), props.schema[key].type == "Number" && !((_d = (_c = props.schema[key]) == null ? void 0 : _c.schema) == null ? void 0 : _d.options) ? (openBlock(), createBlock(_component_van_field, {
21268
21295
  key: 1,
21296
+ disabled: props.schema[key].auth === "readonly",
21269
21297
  modelValue: data2.inputValue[key],
21270
21298
  "onUpdate:modelValue": ($event) => data2.inputValue[key] = $event,
21271
21299
  modelModifiers: {
@@ -21273,23 +21301,27 @@ const _sfc_main = {
21273
21301
  },
21274
21302
  placeholder: `\u8BF7\u8F93\u5165${key2name(key)}`,
21275
21303
  type: "number"
21276
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : createCommentVNode("", true), props.schema[key].type == "Boolean" ? (openBlock(), createBlock(_component_van_switch, {
21304
+ }, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "placeholder"])) : createCommentVNode("", true), props.schema[key].type == "Boolean" ? (openBlock(), createBlock(_component_van_switch, {
21277
21305
  key: 2,
21306
+ disabled: props.schema[key].auth === "readonly",
21278
21307
  modelValue: data2.inputValue[key],
21279
21308
  "onUpdate:modelValue": ($event) => data2.inputValue[key] = $event
21280
- }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true), props.schema[key].type == "Datetime" ? (openBlock(), createBlock(_sfc_main$o, {
21309
+ }, null, 8, ["disabled", "modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true), props.schema[key].type == "Datetime" ? (openBlock(), createBlock(_sfc_main$o, {
21281
21310
  key: 3,
21311
+ auth: props.schema[key].auth,
21282
21312
  modelValue: data2.inputValue[key],
21283
21313
  "onUpdate:modelValue": ($event) => data2.inputValue[key] = $event,
21284
21314
  placeholder: "\u9009\u62E9\u65F6\u95F4"
21285
- }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true), props.schema[key].type == "Images" ? (openBlock(), createBlock(ImagesPicker, {
21315
+ }, null, 8, ["auth", "modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true), props.schema[key].type == "Images" ? (openBlock(), createBlock(ImagesPicker, {
21286
21316
  key: 4,
21317
+ auth: props.schema[key].auth,
21287
21318
  modelValue: data2.inputValue[key],
21288
21319
  "onUpdate:modelValue": ($event) => data2.inputValue[key] = $event
21289
- }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true), ((_f = (_e = props.schema[key]) == null ? void 0 : _e.schema) == null ? void 0 : _f.options) ? (openBlock(), createBlock(DataSelector, {
21320
+ }, null, 8, ["auth", "modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true), ((_f = (_e = props.schema[key]) == null ? void 0 : _e.schema) == null ? void 0 : _f.options) ? (openBlock(), createBlock(DataSelector, {
21290
21321
  key: 5,
21291
21322
  modelValue: data2.inputValue[key],
21292
21323
  "onUpdate:modelValue": ($event) => data2.inputValue[key] = $event,
21324
+ auth: props.schema[key].auth,
21293
21325
  options: (_h = (_g = props.schema[key]) == null ? void 0 : _g.schema) == null ? void 0 : _h.options,
21294
21326
  placeholder: `\u8BF7\u8F93\u5165${key2name(key)}`,
21295
21327
  columnsFieldNames: {
@@ -21297,12 +21329,13 @@ const _sfc_main = {
21297
21329
  value: (((_l = (_k = props.schema[key]) == null ? void 0 : _k.schema) == null ? void 0 : _l.options) || []).length > 0 ? Object.keys(props.schema[key].schema.options[0])[1] : ""
21298
21330
  },
21299
21331
  onSelect: ($event) => onChangeOption(key)
21300
- }, null, 8, ["modelValue", "onUpdate:modelValue", "options", "placeholder", "columnsFieldNames", "onSelect"])) : createCommentVNode("", true), props.schema[key].type == "Array" && props.schema[key].auth != "gone" ? (openBlock(), createBlock(_component_ObjsEditor, {
21332
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "auth", "options", "placeholder", "columnsFieldNames", "onSelect"])) : createCommentVNode("", true), props.schema[key].type == "Array" && props.schema[key].auth != "gone" ? (openBlock(), createBlock(_component_ObjsEditor, {
21301
21333
  key: 6,
21334
+ auth: props.schema[key].auth,
21302
21335
  modelValue: data2.inputValue[key],
21303
21336
  "onUpdate:modelValue": ($event) => data2.inputValue[key] = $event,
21304
21337
  schema: props.schema[key].schema
21305
- }, null, 8, ["modelValue", "onUpdate:modelValue", "schema"])) : createCommentVNode("", true)];
21338
+ }, null, 8, ["auth", "modelValue", "onUpdate:modelValue", "schema"])) : createCommentVNode("", true)];
21306
21339
  }),
21307
21340
  _: 2
21308
21341
  }, 1032, ["label", "required", "disabled"])), [[vShow, props.schema[key].auth != "gone"]]);
@@ -21333,7 +21366,7 @@ const _sfc_main = {
21333
21366
  };
21334
21367
  }
21335
21368
  };
21336
- var ObjsEditor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-1fa437e7"]]);
21369
+ var ObjsEditor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-222a5036"]]);
21337
21370
  const secret_notify = () => {
21338
21371
  showNotify({ type: "danger", message: "\u4E25\u683C\u6267\u884C\u4FE1\u606F\u4FDD\u5BC6\u8981\u6C42\uFF0C\u5207\u5B9E\u9632\u8303\u4F01\u4E1A\u6CC4\u5BC6\u98CE\u9669", duration: 3e3 });
21339
21372
  };
@@ -18733,21 +18733,25 @@ var __async = (__this, __arguments, generator) => {
18733
18733
  }
18734
18734
  };
18735
18735
  var ImagesPicker = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-8fca1c96"]]);
18736
- var FilePicker_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "[data-v-7352dfa0] .label {\n color: #000 !important;\n}\n[data-v-7352dfa0] .van-field__control:disabled {\n color: #000 !important;\n cursor: not-allowed;\n opacity: 1;\n -webkit-text-fill-color: #000;\n}")();
18736
+ var FilePicker_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "[data-v-0c20dca4] .label {\n color: #000 !important;\n}\n[data-v-0c20dca4] .van-field__control:disabled {\n color: #000 !important;\n cursor: not-allowed;\n opacity: 1;\n -webkit-text-fill-color: #000;\n}")();
18737
18737
  const _hoisted_1$b = {
18738
- class: "image-box"
18738
+ class: "file-box"
18739
18739
  };
18740
18740
  const _sfc_main$h = {
18741
18741
  __name: "FilePicker",
18742
18742
  props: {
18743
18743
  modelValue: {
18744
- type: String,
18745
- default: ""
18744
+ type: [String, Array],
18745
+ default: null
18746
18746
  },
18747
18747
  label: {
18748
18748
  type: String,
18749
18749
  default: ""
18750
18750
  },
18751
+ multiple: {
18752
+ type: Boolean,
18753
+ default: false
18754
+ },
18751
18755
  required: {
18752
18756
  type: Boolean,
18753
18757
  default: false
@@ -18794,22 +18798,44 @@ var __async = (__this, __arguments, generator) => {
18794
18798
  file: file.file
18795
18799
  };
18796
18800
  return util.file_upload(params).then((res) => {
18797
- modelValue.value = res.data;
18801
+ if (props.multiple)
18802
+ modelValue.value = [...modelValue.value || [], res.data];
18803
+ else
18804
+ modelValue.value = res.data;
18798
18805
  return Promise.resolve(file);
18799
18806
  });
18800
18807
  });
18801
18808
  const onBeforeDelete = (e) => {
18802
- modelValue.value = "";
18809
+ if (props.multiple) {
18810
+ let newUrls = props.modelValue.filter((item) => {
18811
+ return item != e.url;
18812
+ });
18813
+ emit("update:modelValue", newUrls);
18814
+ } else {
18815
+ modelValue.value = "";
18816
+ }
18803
18817
  return Promise.resolve(e);
18804
18818
  };
18805
18819
  vue.watch(() => props.modelValue, (newVal, oldVal) => {
18806
- if (!props.modelValue) {
18807
- files.value = [];
18808
- return;
18820
+ if (props.multiple) {
18821
+ if (!props.modelValue || props.modelValue.length < 1) {
18822
+ files.value = [];
18823
+ return;
18824
+ }
18825
+ files.value = props.modelValue.map((item) => {
18826
+ return {
18827
+ url: item
18828
+ };
18829
+ });
18830
+ } else {
18831
+ if (!props.modelValue) {
18832
+ files.value = [];
18833
+ return;
18834
+ }
18835
+ files.value = [{
18836
+ url: props.modelValue
18837
+ }];
18809
18838
  }
18810
- files.value = [{
18811
- url: props.modelValue
18812
- }];
18813
18839
  }, {
18814
18840
  immediate: true
18815
18841
  });
@@ -18828,20 +18854,20 @@ var __async = (__this, __arguments, generator) => {
18828
18854
  input: vue.withCtx(() => [vue.createElementVNode("div", _hoisted_1$b, [vue.createVNode(_component_van_uploader, {
18829
18855
  modelValue: files.value,
18830
18856
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => files.value = $event),
18831
- "max-count": 1,
18857
+ "max-count": props.max,
18832
18858
  afterRead: onAfterRead,
18833
18859
  disabled: vue.unref(isDisabled),
18834
18860
  accept: props.accept,
18835
18861
  "upload-icon": "plus",
18836
18862
  deletable: !vue.unref(isDisabled),
18837
18863
  "before-delete": onBeforeDelete
18838
- }, null, 8, ["modelValue", "disabled", "accept", "deletable"])])]),
18864
+ }, null, 8, ["modelValue", "max-count", "disabled", "accept", "deletable"])])]),
18839
18865
  _: 1
18840
18866
  }, 8, ["label", "required", "rules", "placeholder"])) : vue.createCommentVNode("", true);
18841
18867
  };
18842
18868
  }
18843
18869
  };
18844
- var FilePicker = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-7352dfa0"]]);
18870
+ var FilePicker = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-0c20dca4"]]);
18845
18871
  var SingleUserSelector_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => "\n.user-popup[data-v-a489ca4c] {\r\n width: 100%;\r\n overflow: hidden;\n}\n.department-selector[data-v-a489ca4c] {\r\n padding: 10px;\n}\n.search-buttons[data-v-a489ca4c] {\r\n display: flex;\r\n gap: 10px;\n}\n.clear-btn[data-v-a489ca4c] {\r\n background-color: #f2f3f5;\r\n border: none;\r\n border-radius: 4px;\r\n padding: 4px 8px;\r\n font-size: 14px;\n}\n.confirm-btn[data-v-a489ca4c] {\r\n background-color: #1989fa;\r\n color: white;\r\n border: none;\r\n border-radius: 4px;\r\n padding: 4px 8px;\r\n font-size: 14px;\n}\n.no-results[data-v-a489ca4c] {\r\n text-align: center;\r\n padding: 20px;\r\n color: #969799;\n}\n.picker-header[data-v-a489ca4c] {\r\n padding: 10px;\r\n border-bottom: 1px solid #ebedf0;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\n}\n.current-path[data-v-a489ca4c] {\r\n flex: 1;\r\n font-size: 14px;\r\n color: #323233;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\n}\n.header-right[data-v-a489ca4c] {\r\n display: flex;\r\n gap: 8px;\r\n margin-left: auto;\n}\n.cancel-btn[data-v-a489ca4c] {\r\n color: #969799;\r\n margin-right: 5px;\n}\n.scroll-container[data-v-a489ca4c] {\r\n height: calc(80vh - 150px);\r\n overflow-y: auto;\n}\r\n")();
18846
18872
  const _hoisted_1$a = {
18847
18873
  class: "department-selector"
@@ -20987,7 +21013,7 @@ var __async = (__this, __arguments, generator) => {
20987
21013
  }
20988
21014
  };
20989
21015
  var SingleApiPicker = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-0c8e09c0"]]);
20990
- var ObjsEditor_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => ".widget[data-v-1fa437e7] {\n background: #fff;\n box-sizing: border-box;\n height: 100%;\n text-align: left;\n font-size: 12px;\n}\n.option[data-v-1fa437e7] {\n margin: 0 8px 8px 0;\n padding: 5px 10px;\n border-radius: 6px;\n border: 2px solid #e1e1e1;\n box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);\n color: #666;\n display: inline-block;\n position: relative;\n}\n[data-v-1fa437e7] .van-field__label {\n margin: auto;\n}\n[data-v-1fa437e7] .van-cell {\n font-size: 12px;\n padding: 5px 5px;\n}\n[data-v-1fa437e7] .van-icon {\n font-size: 12px;\n}\n[data-v-1fa437e7] .van-popup .van-cell {\n padding: 5px 25px;\n}")();
21016
+ var ObjsEditor_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => ".widget[data-v-222a5036] {\n background: #fff;\n box-sizing: border-box;\n height: 100%;\n text-align: left;\n font-size: 12px;\n}\n.option[data-v-222a5036] {\n margin: 0 8px 8px 0;\n padding: 5px 10px;\n border-radius: 6px;\n border: 2px solid #e1e1e1;\n box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);\n color: #666;\n display: inline-block;\n position: relative;\n}\n[data-v-222a5036] .van-field__label {\n margin: auto;\n}\n[data-v-222a5036] .van-cell {\n font-size: 12px;\n padding: 5px 5px;\n}\n[data-v-222a5036] .van-icon {\n font-size: 12px;\n}\n[data-v-222a5036] .van-popup .van-cell {\n padding: 5px 25px;\n}")();
20991
21017
  const _hoisted_1 = {
20992
21018
  class: "widget-box"
20993
21019
  };
@@ -21263,12 +21289,14 @@ var __async = (__this, __arguments, generator) => {
21263
21289
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
21264
21290
  return [props.schema[key].type == "String" && !((_b = (_a = props.schema[key]) == null ? void 0 : _a.schema) == null ? void 0 : _b.options) ? (vue.openBlock(), vue.createBlock(_component_van_field, {
21265
21291
  key: 0,
21292
+ disabled: props.schema[key].auth === "readonly",
21266
21293
  modelValue: data2.inputValue[key],
21267
21294
  "onUpdate:modelValue": ($event) => data2.inputValue[key] = $event,
21268
21295
  placeholder: `\u8BF7\u8F93\u5165${key2name(key)}`,
21269
21296
  type: "text"
21270
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : vue.createCommentVNode("", true), props.schema[key].type == "Number" && !((_d = (_c = props.schema[key]) == null ? void 0 : _c.schema) == null ? void 0 : _d.options) ? (vue.openBlock(), vue.createBlock(_component_van_field, {
21297
+ }, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "placeholder"])) : vue.createCommentVNode("", true), props.schema[key].type == "Number" && !((_d = (_c = props.schema[key]) == null ? void 0 : _c.schema) == null ? void 0 : _d.options) ? (vue.openBlock(), vue.createBlock(_component_van_field, {
21271
21298
  key: 1,
21299
+ disabled: props.schema[key].auth === "readonly",
21272
21300
  modelValue: data2.inputValue[key],
21273
21301
  "onUpdate:modelValue": ($event) => data2.inputValue[key] = $event,
21274
21302
  modelModifiers: {
@@ -21276,23 +21304,27 @@ var __async = (__this, __arguments, generator) => {
21276
21304
  },
21277
21305
  placeholder: `\u8BF7\u8F93\u5165${key2name(key)}`,
21278
21306
  type: "number"
21279
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : vue.createCommentVNode("", true), props.schema[key].type == "Boolean" ? (vue.openBlock(), vue.createBlock(_component_van_switch, {
21307
+ }, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "placeholder"])) : vue.createCommentVNode("", true), props.schema[key].type == "Boolean" ? (vue.openBlock(), vue.createBlock(_component_van_switch, {
21280
21308
  key: 2,
21309
+ disabled: props.schema[key].auth === "readonly",
21281
21310
  modelValue: data2.inputValue[key],
21282
21311
  "onUpdate:modelValue": ($event) => data2.inputValue[key] = $event
21283
- }, null, 8, ["modelValue", "onUpdate:modelValue"])) : vue.createCommentVNode("", true), props.schema[key].type == "Datetime" ? (vue.openBlock(), vue.createBlock(_sfc_main$o, {
21312
+ }, null, 8, ["disabled", "modelValue", "onUpdate:modelValue"])) : vue.createCommentVNode("", true), props.schema[key].type == "Datetime" ? (vue.openBlock(), vue.createBlock(_sfc_main$o, {
21284
21313
  key: 3,
21314
+ auth: props.schema[key].auth,
21285
21315
  modelValue: data2.inputValue[key],
21286
21316
  "onUpdate:modelValue": ($event) => data2.inputValue[key] = $event,
21287
21317
  placeholder: "\u9009\u62E9\u65F6\u95F4"
21288
- }, null, 8, ["modelValue", "onUpdate:modelValue"])) : vue.createCommentVNode("", true), props.schema[key].type == "Images" ? (vue.openBlock(), vue.createBlock(ImagesPicker, {
21318
+ }, null, 8, ["auth", "modelValue", "onUpdate:modelValue"])) : vue.createCommentVNode("", true), props.schema[key].type == "Images" ? (vue.openBlock(), vue.createBlock(ImagesPicker, {
21289
21319
  key: 4,
21320
+ auth: props.schema[key].auth,
21290
21321
  modelValue: data2.inputValue[key],
21291
21322
  "onUpdate:modelValue": ($event) => data2.inputValue[key] = $event
21292
- }, null, 8, ["modelValue", "onUpdate:modelValue"])) : vue.createCommentVNode("", true), ((_f = (_e = props.schema[key]) == null ? void 0 : _e.schema) == null ? void 0 : _f.options) ? (vue.openBlock(), vue.createBlock(DataSelector, {
21323
+ }, null, 8, ["auth", "modelValue", "onUpdate:modelValue"])) : vue.createCommentVNode("", true), ((_f = (_e = props.schema[key]) == null ? void 0 : _e.schema) == null ? void 0 : _f.options) ? (vue.openBlock(), vue.createBlock(DataSelector, {
21293
21324
  key: 5,
21294
21325
  modelValue: data2.inputValue[key],
21295
21326
  "onUpdate:modelValue": ($event) => data2.inputValue[key] = $event,
21327
+ auth: props.schema[key].auth,
21296
21328
  options: (_h = (_g = props.schema[key]) == null ? void 0 : _g.schema) == null ? void 0 : _h.options,
21297
21329
  placeholder: `\u8BF7\u8F93\u5165${key2name(key)}`,
21298
21330
  columnsFieldNames: {
@@ -21300,12 +21332,13 @@ var __async = (__this, __arguments, generator) => {
21300
21332
  value: (((_l = (_k = props.schema[key]) == null ? void 0 : _k.schema) == null ? void 0 : _l.options) || []).length > 0 ? Object.keys(props.schema[key].schema.options[0])[1] : ""
21301
21333
  },
21302
21334
  onSelect: ($event) => onChangeOption(key)
21303
- }, null, 8, ["modelValue", "onUpdate:modelValue", "options", "placeholder", "columnsFieldNames", "onSelect"])) : vue.createCommentVNode("", true), props.schema[key].type == "Array" && props.schema[key].auth != "gone" ? (vue.openBlock(), vue.createBlock(_component_ObjsEditor, {
21335
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "auth", "options", "placeholder", "columnsFieldNames", "onSelect"])) : vue.createCommentVNode("", true), props.schema[key].type == "Array" && props.schema[key].auth != "gone" ? (vue.openBlock(), vue.createBlock(_component_ObjsEditor, {
21304
21336
  key: 6,
21337
+ auth: props.schema[key].auth,
21305
21338
  modelValue: data2.inputValue[key],
21306
21339
  "onUpdate:modelValue": ($event) => data2.inputValue[key] = $event,
21307
21340
  schema: props.schema[key].schema
21308
- }, null, 8, ["modelValue", "onUpdate:modelValue", "schema"])) : vue.createCommentVNode("", true)];
21341
+ }, null, 8, ["auth", "modelValue", "onUpdate:modelValue", "schema"])) : vue.createCommentVNode("", true)];
21309
21342
  }),
21310
21343
  _: 2
21311
21344
  }, 1032, ["label", "required", "disabled"])), [[vue.vShow, props.schema[key].auth != "gone"]]);
@@ -21336,7 +21369,7 @@ var __async = (__this, __arguments, generator) => {
21336
21369
  };
21337
21370
  }
21338
21371
  };
21339
- var ObjsEditor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-1fa437e7"]]);
21372
+ var ObjsEditor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-222a5036"]]);
21340
21373
  const secret_notify = () => {
21341
21374
  showNotify({ type: "danger", message: "\u4E25\u683C\u6267\u884C\u4FE1\u606F\u4FDD\u5BC6\u8981\u6C42\uFF0C\u5207\u5B9E\u9632\u8303\u4F01\u4E1A\u6CC4\u5BC6\u98CE\u9669", duration: 3e3 });
21342
21375
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "widget.qw",
3
3
  "private": false,
4
- "version": "1.0.71",
4
+ "version": "1.0.73",
5
5
  "description": "marqstree Vue3组件库",
6
6
  "main": "build/widget.qw.es.js",
7
7
  "keywords": [
@@ -2,9 +2,10 @@
2
2
  <van-field v-if="!isGone" name="image" :label="props.label" :required="isRequired" :rules="props.rules"
3
3
  label-class="label" :placeholder="props.placeholder">
4
4
  <template #input>
5
- <div class="image-box">
6
- <van-uploader v-model="files" :max-count="1" :afterRead="onAfterRead" :disabled="isDisabled"
7
- :accept="props.accept" upload-icon="plus" :deletable="!isDisabled" :before-delete="onBeforeDelete" />
5
+ <div class="file-box">
6
+ <van-uploader v-model="files" :max-count="props.max" :afterRead="onAfterRead" :disabled="isDisabled"
7
+ :accept="props.accept" upload-icon="plus" :deletable="!isDisabled"
8
+ :before-delete="onBeforeDelete" />
8
9
  </div>
9
10
  </template>
10
11
  </van-field>
@@ -17,13 +18,17 @@ import { useVModel } from "@vueuse/core"
17
18
 
18
19
  const props = defineProps({
19
20
  modelValue: {
20
- type: String,
21
- default: ''
21
+ type: [String, Array],
22
+ default: null
22
23
  },
23
24
  label: {
24
25
  type: String,
25
26
  default: ''
26
27
  },
28
+ multiple: {
29
+ type: Boolean,
30
+ default: false
31
+ },
27
32
  required: {
28
33
  type: Boolean,
29
34
  default: false
@@ -67,26 +72,50 @@ const onAfterRead = async (file) => {
67
72
  }
68
73
 
69
74
  return util.file_upload(params).then(res => {
70
- modelValue.value = res.data
75
+ if (props.multiple)
76
+ modelValue.value = [...(modelValue.value || []), res.data]
77
+ else
78
+ modelValue.value = res.data
71
79
  return Promise.resolve(file)
72
80
  })
73
81
  }
74
82
 
75
83
  const onBeforeDelete = (e) => {
76
- modelValue.value = ''
84
+ if (props.multiple) {
85
+ let newUrls = props.modelValue.filter(item => {
86
+ return item != e.url
87
+ })
88
+ emit('update:modelValue', newUrls)
89
+ } else {
90
+ modelValue.value = ''
91
+ }
92
+
77
93
  return Promise.resolve(e)
78
94
  }
79
95
 
80
96
  watch(() => props.modelValue,
81
97
  (newVal, oldVal) => {
82
- if (!props.modelValue) {
83
- files.value = []
84
- return
85
- }
98
+ if (props.multiple) {
99
+ if (!props.modelValue || props.modelValue.length < 1) {
100
+ files.value = []
101
+ return
102
+ }
86
103
 
87
- files.value = [{
88
- url: props.modelValue
89
- }]
104
+ files.value = props.modelValue.map(item => {
105
+ return {
106
+ url: item
107
+ }
108
+ })
109
+ } else {
110
+ if (!props.modelValue) {
111
+ files.value = []
112
+ return
113
+ }
114
+
115
+ files.value = [{
116
+ url: props.modelValue
117
+ }]
118
+ }
90
119
  },
91
120
  {
92
121
  immediate: true
@@ -12,7 +12,7 @@
12
12
  {{ `${key2name(k)}:${key2value(k, item)}` }}
13
13
  </div>
14
14
  <div v-else>
15
- <ImagesPicker v-model="item[k]" readonly/>
15
+ <ImagesPicker v-model="item[k]" readonly />
16
16
  </div>
17
17
  </div>
18
18
  </div>
@@ -38,30 +38,34 @@
38
38
  <template #input>
39
39
  <van-field
40
40
  v-if="props.schema[key].type == 'String' && !props.schema[key]?.schema?.options"
41
- v-model="data.inputValue[key]" :placeholder="`请输入${key2name(key)}`" type="text" />
41
+ :disabled="props.schema[key].auth === 'readonly'" v-model="data.inputValue[key]"
42
+ :placeholder="`请输入${key2name(key)}`" type="text" />
42
43
 
43
44
  <van-field
44
45
  v-if="props.schema[key].type == 'Number' && !props.schema[key]?.schema?.options"
46
+ :disabled="props.schema[key].auth === 'readonly'"
45
47
  v-model.number="data.inputValue[key]" :placeholder="`请输入${key2name(key)}`"
46
48
  type="number" />
47
49
 
48
- <van-switch v-if="props.schema[key].type == 'Boolean'" v-model="data.inputValue[key]" />
50
+ <van-switch v-if="props.schema[key].type == 'Boolean'"
51
+ :disabled="props.schema[key].auth === 'readonly'" v-model="data.inputValue[key]" />
49
52
 
50
53
  <DatetimePicker v-if="props.schema[key].type == 'Datetime'"
51
- v-model="data.inputValue[key]" placeholder="选择时间" />
54
+ :auth="props.schema[key].auth" v-model="data.inputValue[key]" placeholder="选择时间" />
52
55
 
53
- <ImagesPicker v-if="props.schema[key].type == 'Images'"
56
+ <ImagesPicker v-if="props.schema[key].type == 'Images'" :auth="props.schema[key].auth"
54
57
  v-model="data.inputValue[key]" />
55
58
 
56
59
  <DateSelector v-if="props.schema[key]?.schema?.options" v-model="data.inputValue[key]"
57
- :options="props.schema[key]?.schema?.options" :placeholder="`请输入${key2name(key)}`"
58
- :columnsFieldNames="{
60
+ :auth="props.schema[key].auth" :options="props.schema[key]?.schema?.options"
61
+ :placeholder="`请输入${key2name(key)}`" :columnsFieldNames="{
59
62
  text: (props.schema[key]?.schema?.options || []).length > 0 ? Object.keys(props.schema[key].schema.options[0])[0] : '',
60
63
  value: (props.schema[key]?.schema?.options || []).length > 0 ? Object.keys(props.schema[key].schema.options[0])[1] : ''
61
64
  }" @select="onChangeOption(key)" />
62
65
 
63
66
  <ObjsEditor v-if="props.schema[key].type == 'Array' && props.schema[key].auth != 'gone'"
64
- v-model="data.inputValue[key]" :schema="props.schema[key].schema" />
67
+ :auth="props.schema[key].auth" v-model="data.inputValue[key]"
68
+ :schema="props.schema[key].schema" />
65
69
  </template>
66
70
  </van-field>
67
71
 
package/src/env.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- /// <reference types="vite/client" />
2
-
3
- declare module '*.vue' {
4
- import type { DefineComponent } from 'vue'
5
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
6
- const component: DefineComponent<{}, {}, any>
7
- export default component
8
- }
1
+ /// <reference types="vite/client" />
2
+
3
+ declare module '*.vue' {
4
+ import type { DefineComponent } from 'vue'
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
6
+ const component: DefineComponent<{}, {}, any>
7
+ export default component
8
+ }
Binary file
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="page">
3
- <widget-qw-file-picker label="文件" v-model="data.url" :auth="data.auth" accept=".xls,.xlsx" />
3
+ <widget-qw-file-picker label="文件" multiple v-model="data.urls" :auth="data.auth" accept=".jpg,.png" />
4
4
  </div>
5
5
  </template>
6
6
 
@@ -8,8 +8,8 @@
8
8
  import { onMounted, reactive, watch } from "vue";
9
9
 
10
10
  const data = reactive({
11
- auth:'readonly',
12
- url: 'https://1.pdf'
11
+ auth:'require',
12
+ urls: ['https://1.pdf']
13
13
  })
14
14
 
15
15
  watch(()=>data.url,(newVal,oldVal)=>{
@@ -51,7 +51,7 @@ const data = reactive({
51
51
  label: '数量',
52
52
  type: 'Number',
53
53
  default: 1,
54
- auth: 'required',
54
+ auth: 'readonly',
55
55
  },
56
56
  images: {
57
57
  label: '图片',
package/tsconfig.json CHANGED
@@ -1,19 +1,19 @@
1
- {
2
- "compilerOptions": {
3
- "target": "esnext",
4
- "useDefineForClassFields": true,
5
- "module": "esnext",
6
- "moduleResolution": "node",
7
- "strict": true,
8
- "jsx": "preserve",
9
- "sourceMap": true,
10
- "resolveJsonModule": true,
11
- "isolatedModules": true,
12
- "esModuleInterop": true,
13
- "lib": ["esnext", "dom"],
14
- "skipLibCheck": true,
15
- "allowJs": true,
16
- },
17
- "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
18
- "references": [{ "path": "./tsconfig.node.json" }]
19
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "esnext",
4
+ "useDefineForClassFields": true,
5
+ "module": "esnext",
6
+ "moduleResolution": "node",
7
+ "strict": true,
8
+ "jsx": "preserve",
9
+ "sourceMap": true,
10
+ "resolveJsonModule": true,
11
+ "isolatedModules": true,
12
+ "esModuleInterop": true,
13
+ "lib": ["esnext", "dom"],
14
+ "skipLibCheck": true,
15
+ "allowJs": true,
16
+ },
17
+ "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
18
+ "references": [{ "path": "./tsconfig.node.json" }]
19
+ }
@@ -1,8 +1,8 @@
1
- {
2
- "compilerOptions": {
3
- "composite": true,
4
- "module": "esnext",
5
- "moduleResolution": "node"
6
- },
7
- "include": ["vite.config.ts"]
8
- }
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "module": "esnext",
5
+ "moduleResolution": "node"
6
+ },
7
+ "include": ["vite.config.ts"]
8
+ }