@vunk/form 0.0.1-alpha.50 → 0.0.1-alpha.52

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.
@@ -17,6 +17,10 @@
17
17
  min-width: 100px;
18
18
  }
19
19
 
20
+ .vkf-upload.is-limit .el-upload{
21
+ display: none;
22
+ }
23
+
20
24
 
21
25
  .el-upload-list__item-status-label{
22
26
  z-index: 1;
@@ -412,13 +412,13 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
412
412
  !_ctx.disabled ? (openBlock(), createBlock(_component_el_icon, {
413
413
  key: 2,
414
414
  class: normalizeClass(_ctx.nsIcon.m("close")),
415
- onClick: _ctx.handleRemove
415
+ onClick: _cache[2] || (_cache[2] = ($event) => _ctx.handleRemove(_ctx.file))
416
416
  }, {
417
417
  default: withCtx(() => [
418
418
  createVNode(_component_Close)
419
419
  ]),
420
420
  _: 1
421
- }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
421
+ }, 8, ["class"])) : createCommentVNode("v-if", true),
422
422
  createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
423
423
  createCommentVNode(" This is a bug which needs to be fixed "),
424
424
  createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
@@ -433,7 +433,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
433
433
  _ctx.preview ? (openBlock(), createElementBlock("span", {
434
434
  key: 0,
435
435
  class: normalizeClass(_ctx.nsUpload.be("list", "item-preview")),
436
- onClick: _cache[2] || (_cache[2] = ($event) => _ctx.onPreview(_ctx.file))
436
+ onClick: _cache[3] || (_cache[3] = ($event) => _ctx.onPreview(_ctx.file))
437
437
  }, [
438
438
  createVNode(_component_el_icon, {
439
439
  class: normalizeClass(_ctx.nsIcon.m("zoom-in"))
@@ -447,7 +447,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
447
447
  createCommentVNode(" \u4E0B\u8F7D "),
448
448
  createElementVNode("span", {
449
449
  class: normalizeClass(_ctx.nsUpload.be("list", "item-download")),
450
- onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleDownload(_ctx.file))
450
+ onClick: _cache[4] || (_cache[4] = ($event) => _ctx.handleDownload(_ctx.file))
451
451
  }, [
452
452
  createVNode(_component_el_icon, {
453
453
  class: normalizeClass(_ctx.nsIcon.m("download"))
@@ -461,7 +461,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
461
461
  !_ctx.disabled ? (openBlock(), createElementBlock("span", {
462
462
  key: 1,
463
463
  class: normalizeClass(_ctx.nsUpload.be("list", "item-delete")),
464
- onClick: _cache[4] || (_cache[4] = ($event) => _ctx.handleRemove(_ctx.file))
464
+ onClick: _cache[5] || (_cache[5] = ($event) => _ctx.handleRemove(_ctx.file))
465
465
  }, [
466
466
  createVNode(_component_el_icon, {
467
467
  class: normalizeClass(_ctx.nsIcon.m("delete"))
@@ -487,12 +487,14 @@ const _sfc_main = defineComponent({
487
487
  },
488
488
  emits,
489
489
  props,
490
- setup(props2) {
490
+ setup(props2, { emit }) {
491
491
  const formItemBindProps = _VkfFormItemCtx.createBindProps(props2);
492
492
  const coreBindProps = createUploadBindProps(props2, ["disabled", "fileList", "beforeUpload", "onSuccess"]);
493
493
  const uploadRef = shallowRef();
494
494
  const handleRemove = (file) => {
495
495
  uploadRef.value?.handleRemove(file);
496
+ uploadRef.value?.abort(file);
497
+ emit("update:fileList", props2.fileList);
496
498
  };
497
499
  const readonly = useComputedReadonly(props2);
498
500
  const onSuccess = (response, uploadFile, uploadFiles) => {
@@ -542,7 +544,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
542
544
  createVNode(_component_ElUpload, mergeProps({
543
545
  class: ["vkf-upload", {
544
546
  "is-readonly": _ctx.readonly,
545
- "is-empty": _ctx.fileList?.length === 0
547
+ "is-empty": _ctx.fileList?.length === 0,
548
+ "is-limit": _ctx.limit && _ctx.fileList?.length >= _ctx.limit
546
549
  }]
547
550
  }, _ctx.coreBindProps, {
548
551
  fileList: _ctx.fileList ?? [],
@@ -209,6 +209,7 @@ declare const _default: import("vue").DefineComponent<{
209
209
  }>;
210
210
  uploadRef: import("vue").ShallowRef<{
211
211
  handleRemove: AnyFunc;
212
+ abort: AnyFunc;
212
213
  } | undefined>;
213
214
  handleRemove: (file: UploadFile) => void;
214
215
  readonly: import("vue").ComputedRef<boolean>;
package/index.css CHANGED
@@ -139,6 +139,10 @@
139
139
  min-width: 100px;
140
140
  }
141
141
 
142
+ .vkf-upload.is-limit .el-upload{
143
+ display: none;
144
+ }
145
+
142
146
 
143
147
  .el-upload-list__item-status-label{
144
148
  z-index: 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vunk/form",
3
- "version": "0.0.1-alpha.50",
3
+ "version": "0.0.1-alpha.52",
4
4
  "description": "",
5
5
  "main": "index.esm.js",
6
6
  "scripts": {