bard-attachment_field 0.2.2 → 0.2.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32a9e349c2ce7715b8a5732e730bbd96efb6c50f542b0f39fd470a1b39b2952e
4
- data.tar.gz: 1da2861ccab4b81ffc92f0dc6b933c9266b07ba2b96747469d3030de9f44f9f2
3
+ metadata.gz: f90a71ce6a8e66e423b7d1c0572338ea641b3d29704d06de113774ca7901ced6
4
+ data.tar.gz: b69e032e14d92fd4937ff88d49d4f5f7b4868c34090cb447be1e2f1007254c3f
5
5
  SHA512:
6
- metadata.gz: 26808a1afc2c0156726a2fb3443a600efb194bdf87ad4d9a284896e0a53ed24ba3cae9170875fa7bb27cc933de8eafa71fc5116669531ab3431329c59ec6c323
7
- data.tar.gz: 0f48786c5c1eea01995a6e8d04e41f3cb24c5866456b99068d1a4cf6bbedf41e5879df2d02b4f28b02bb5b939f454a9230e2f7bf7e0a49c5a09ef618b200a2cd
6
+ metadata.gz: '024812352cff6f20ec51c90306f0ec7ed742370e049c3f01bdcdfbff0a715287de5e2cf630aa54c742622aff242f1cd77ed9519c44a58e0d361b4dc8b887ba15'
7
+ data.tar.gz: 0c13befd976e56516a7819386cd872d41620db300b3d4663d5613fcaa4e16ca1c9bae1c27acd819b41f6f950b50eff1fe014bdde18298407fd04853724fea570
@@ -5320,6 +5320,7 @@ var AttachmentFile = /* @__PURE__ */ proxyCustomElement(class AttachmentFile2 ex
5320
5320
  this.__attachShadow();
5321
5321
  this.removeEvent = createEvent(this, "attachment-file:remove", 7);
5322
5322
  this.validationEvent = createEvent(this, "attachment-file:validation", 7);
5323
+ this.readyEvent = createEvent(this, "attachment-file:ready", 7);
5323
5324
  }
5324
5325
  get el() {
5325
5326
  return this;
@@ -5339,6 +5340,7 @@ var AttachmentFile = /* @__PURE__ */ proxyCustomElement(class AttachmentFile2 ex
5339
5340
  validationMessage;
5340
5341
  removeEvent;
5341
5342
  validationEvent;
5343
+ readyEvent;
5342
5344
  removeClicked = (event) => {
5343
5345
  event.stopPropagation();
5344
5346
  event.preventDefault();
@@ -5382,6 +5384,7 @@ var AttachmentFile = /* @__PURE__ */ proxyCustomElement(class AttachmentFile2 ex
5382
5384
  this.state = "complete";
5383
5385
  this.percent = 100;
5384
5386
  this.value = val;
5387
+ this.readyEvent.emit(this);
5385
5388
  });
5386
5389
  }
5387
5390
  }
@@ -5411,7 +5414,7 @@ var AttachmentFile = /* @__PURE__ */ proxyCustomElement(class AttachmentFile2 ex
5411
5414
  }
5412
5415
  }
5413
5416
  render() {
5414
- return h(Host, { key: "048e2ff577fe17addf864b61d83a039108016a12" }, h("slot", { key: "8be67080894acaff712da3384fc8d801a29ec577" }), h("figure", { key: "272c3a327466f2da4654e13627cdd724b5f0cd6a" }, h("div", { key: "cd4d689a99ee9f24c1440905e9c127b5aca2d54f", class: "progress-details" }, h("progress-bar", { key: "b96ddb30bf8bec245ebd2905df0eca909774a9f0", percent: this.percent, class: this.state }, h("a", { key: "a7999fb28b349a78705d8d3babc57d731e7161b4", class: "download-link", href: this.src, download: this.filename, onClick: (e) => e.stopPropagation() }, this.filename)), h("span", { key: "ea430736922cbb19e797796555be2316fc4a7615", class: "progress-icon" }), h("a", { key: "ad2af0cbdd7fffb8fd1b3250d82fa6e2f46c0147", class: "remove-media", onClick: this.removeClicked, href: "#" }, h("span", { key: "5a1bfd7c33320b96472910b127c9f1d8c124e004" }, "Remove media")), this.uploadError && this._file ? h("a", { class: "retry-media", onClick: this.retryClicked, href: "#" }, h("span", null, "Retry upload")) : ""), this.validationError || this.uploadError ? h("p", { class: "validation-error" }, this.validationError || this.uploadError) : "", this.preview ? h("attachment-preview", { src: this.src, filetype: this.filetype }) : ""));
5417
+ return h(Host, { key: "1af2d43e01a8714c658ea70a9ca68cce57bbda12" }, h("slot", { key: "deadfff4a159e17d52ed8f66d5d18aecc71fb44d" }), h("figure", { key: "7319a724f2d51c396734dacd7528b1864fb8e980" }, h("div", { key: "ce0794f4062073a8fc28e4f2398a91d711f00521", class: "progress-details" }, h("progress-bar", { key: "30c130654e71e87036beaaf02f15453e1d35ab7a", percent: this.percent, class: this.state }, h("a", { key: "12dcf70078803fe226e9abf265dcaacd0241bfe3", class: "download-link", href: this.src, download: this.filename, onClick: (e) => e.stopPropagation() }, this.filename)), h("span", { key: "e736b315d4e0c3ec601c0fdec08ce7cce5665bef", class: "progress-icon" }), h("a", { key: "dd356dcc5f72ad33a5a52de080aa60f4af7df284", class: "remove-media", onClick: this.removeClicked, href: "#" }, h("span", { key: "c9976fdb30e8d3fa78bfc838eba1e8c33ff11c04" }, "Remove media")), this.uploadError && this._file ? h("a", { class: "retry-media", onClick: this.retryClicked, href: "#" }, h("span", null, "Retry upload")) : ""), this.validationError || this.uploadError ? h("p", { class: "validation-error" }, this.validationError || this.uploadError) : "", this.preview ? h("attachment-preview", { src: this.src, filetype: this.filetype }) : ""));
5415
5418
  }
5416
5419
  componentDidLoad() {
5417
5420
  if (this.state == "pending" && this._file) {
@@ -5948,6 +5951,9 @@ var InputAttachment$1 = /* @__PURE__ */ proxyCustomElement(class InputAttachment
5948
5951
  handleChildValidation(_event) {
5949
5952
  this.updateFormValue();
5950
5953
  }
5954
+ handleChildReady(_event) {
5955
+ this.updateFormValue();
5956
+ }
5951
5957
  fireChangeEvent() {
5952
5958
  requestAnimationFrame(() => {
5953
5959
  this.updateFormValue();
@@ -5959,12 +5965,12 @@ var InputAttachment$1 = /* @__PURE__ */ proxyCustomElement(class InputAttachment
5959
5965
  return this.disabled || !!this.el.closest("fieldset[disabled]");
5960
5966
  }
5961
5967
  render() {
5962
- return h(Host, { key: "4ef61015f6e0abb87d50a3f9ff8e39f01dc44ead" }, h("input", { key: "fc02ff04ff705c2c26ef6bc9e21e23435eefe0d6", ref: (el) => this.fileInput = el, type: "file", multiple: this.multiple, accept: this.accepts, required: this.required && this.files.length === 0, disabled: this.isDisabled, onChange: () => this.handleFileInputChange(), style: {
5968
+ return h(Host, { key: "da0ceb39e5024d0dfe50511a4aa1139188dcb4a2" }, h("input", { key: "b9197faa99dcd580bf7c0fb7f356daa715d901d1", ref: (el) => this.fileInput = el, type: "file", multiple: this.multiple, accept: this.accepts, required: this.required && this.files.length === 0, disabled: this.isDisabled, onChange: () => this.handleFileInputChange(), style: {
5963
5969
  opacity: "0.01",
5964
5970
  width: "1px",
5965
5971
  height: "1px",
5966
5972
  zIndex: "-999"
5967
- } }), h("file-drop", { key: "20ad744ab366a7af2404711a025240515198815f", onClick: () => this.fileInput?.click(), onDrop: this.handleDrop }, h("p", { key: "c5289e9d5b03ced01d95f2d2152ab06dfaaaa8fb", part: "title" }, h("strong", { key: "ed48073458e73fad729caebc1eea8c1ed31fd021" }, "Choose ", this.multiple ? "files" : "file", " "), h("span", { key: "daa4fbd6f33180060a306fdb5ea469d2a68a141b" }, "or drag ", this.multiple ? "them" : "it", " here.")), h("div", { key: "83a5aaf4ee4bc0d7c2917a781ef77568ce9fb9a6", class: `media-preview ${this.multiple ? "-stacked" : ""}` }, h("slot", { key: "8ce39f9805a8f292cc08c9d77c8f91d2754152f7" }))));
5973
+ } }), h("file-drop", { key: "ce0608a99601202d437b7228e87437b510ba639f", onClick: () => this.fileInput?.click(), onDrop: this.handleDrop }, h("p", { key: "658d85fa352e7517789d95ad0c25756dafc79c08", part: "title" }, h("strong", { key: "7a160aa3132cdc8159e4319262cca69aa0b60d63" }, "Choose ", this.multiple ? "files" : "file", " "), h("span", { key: "51ab69b28833c8d442d1907ead5ddc79a6820f53" }, "or drag ", this.multiple ? "them" : "it", " here.")), h("div", { key: "a5bbee999e0575e27f7fc058640d8ee281ee0728", class: `media-preview ${this.multiple ? "-stacked" : ""}` }, h("slot", { key: "3a07d4e5aeaaf80fd5e37e9b135eb820dfcef757" }))));
5968
5974
  }
5969
5975
  componentDidRender() {
5970
5976
  if (this.files.length === 0) {
@@ -6041,7 +6047,7 @@ var InputAttachment$1 = /* @__PURE__ */ proxyCustomElement(class InputAttachment
6041
6047
  "max": [2],
6042
6048
  "preview": [4],
6043
6049
  "disabled": [4]
6044
- }, [[0, "attachment-file:remove", "removeUploadedFile"], [0, "attachment-file:validation", "handleChildValidation"], [0, "direct-upload:end", "fireChangeEvent"]]]);
6050
+ }, [[0, "attachment-file:remove", "removeUploadedFile"], [0, "attachment-file:validation", "handleChildValidation"], [0, "attachment-file:ready", "handleChildReady"], [0, "direct-upload:end", "fireChangeEvent"]]]);
6045
6051
  var InputAttachment2 = InputAttachment$1;
6046
6052
 
6047
6053
  // dist/components/index.js
@@ -32,6 +32,7 @@ export class AttachmentFile {
32
32
 
33
33
  @Event({ eventName: "attachment-file:remove" }) removeEvent: EventEmitter
34
34
  @Event({ eventName: "attachment-file:validation" }) validationEvent: EventEmitter
35
+ @Event({ eventName: "attachment-file:ready" }) readyEvent: EventEmitter
35
36
 
36
37
  private removeClicked = event => {
37
38
  event.stopPropagation()
@@ -82,6 +83,7 @@ export class AttachmentFile {
82
83
  this.state = "complete"
83
84
  this.percent = 100
84
85
  this.value = val
86
+ this.readyEvent.emit(this)
85
87
  })
86
88
  }
87
89
  }
@@ -28,6 +28,7 @@
28
28
 
29
29
  | Event | Description | Type |
30
30
  | ---------------------------- | ----------- | ------------------ |
31
+ | `attachment-file:ready` | | `CustomEvent<any>` |
31
32
  | `attachment-file:remove` | | `CustomEvent<any>` |
32
33
  | `attachment-file:validation` | | `CustomEvent<any>` |
33
34
 
@@ -231,6 +231,11 @@ export class InputAttachment {
231
231
  this.updateFormValue()
232
232
  }
233
233
 
234
+ @Listen("attachment-file:ready")
235
+ handleChildReady(_event) {
236
+ this.updateFormValue()
237
+ }
238
+
234
239
  @Listen("direct-upload:end")
235
240
  fireChangeEvent() {
236
241
  requestAnimationFrame(() => {
@@ -68,6 +68,7 @@ declare global {
68
68
  interface HTMLAttachmentFileElementEventMap {
69
69
  "attachment-file:remove": any;
70
70
  "attachment-file:validation": any;
71
+ "attachment-file:ready": any;
71
72
  }
72
73
  interface HTMLAttachmentFileElement extends Components.AttachmentFile, HTMLStencilElement {
73
74
  addEventListener<K extends keyof HTMLAttachmentFileElementEventMap>(type: K, listener: (this: HTMLAttachmentFileElement, ev: AttachmentFileCustomEvent<HTMLAttachmentFileElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
@@ -108,6 +109,7 @@ declare namespace LocalJSX {
108
109
  "filetype"?: string;
109
110
  "max"?: number;
110
111
  "name"?: string;
112
+ "onAttachment-file:ready"?: (event: AttachmentFileCustomEvent<any>) => void;
111
113
  "onAttachment-file:remove"?: (event: AttachmentFileCustomEvent<any>) => void;
112
114
  "onAttachment-file:validation"?: (event: AttachmentFileCustomEvent<any>) => void;
113
115
  /**
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bard
4
4
  module AttachmentField
5
- VERSION = "0.2.2"
5
+ VERSION = "0.2.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bard-attachment_field
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel