@things-factory/contact 7.0.64 → 7.0.66

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.
@@ -151,6 +151,7 @@ export class ContactPopup extends LitElement {
151
151
  name
152
152
  company
153
153
  email
154
+ phone
154
155
  note
155
156
  items {
156
157
  label
@@ -183,6 +184,7 @@ export class ContactPopup extends LitElement {
183
184
  name
184
185
  company
185
186
  email
187
+ phone
186
188
  note
187
189
  items {
188
190
  label
@@ -119,6 +119,7 @@ let ContactPopup = class ContactPopup extends LitElement {
119
119
  name
120
120
  company
121
121
  email
122
+ phone
122
123
  note
123
124
  items {
124
125
  label
@@ -152,6 +153,7 @@ let ContactPopup = class ContactPopup extends LitElement {
152
153
  name
153
154
  company
154
155
  email
156
+ phone
155
157
  note
156
158
  items {
157
159
  label
@@ -1 +1 @@
1
- {"version":3,"file":"contact-popup.js","sourceRoot":"","sources":["../../client/components/contact-popup.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,qCAAqC,CAAA;AAC5C,OAAO,qCAAqC,CAAA;AAE5C,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AAG5D,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAArC;;QAqBgD,aAAQ,GAAa,KAAK,CAAA;QAClD,eAAU,GAAa,KAAK,CAAA;QA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AAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;gBACjC,QAAQ,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;SAqBZ;gBACD,SAAS,EAAE;oBACT,OAAO;iBACR;gBACD,OAAO,EAAE;oBACP,SAAS,EAAE,IAAI;iBAChB;aACF,CAAC,CAAA;QACJ,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAA;QAEpC,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,MAAM,EAAE,IAAI,CAAC,OAAO;SACrB,CAAC,CACH,CAAA;IACH,CAAC;;AAxMM,mBAAM,GAAG;IACd,eAAe;IACf,kBAAkB;IAClB,GAAG,CAAA;;;;;;;;;;;;;KAaF;CACF,AAjBY,CAiBZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAmB;AACO;IAApD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;;8CAA2B;AAClD;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;gDAA6B;AAC7B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAmD;AAErE;IAAR,KAAK,EAAE;;6CAAsB;AAEJ;IAAzB,KAAK,CAAC,iBAAiB,CAAC;8BAAU,aAAa;4CAAA;AA3BrC,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA0MxB","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/contact/ox-contact-view.js'\nimport '@operato/contact/ox-contact-edit.js'\n\nimport { html, css, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport gql from 'graphql-tag'\n\nimport { client } from '@operato/graphql'\nimport { Contact } from '@operato/contact/ox-contact.js'\nimport { i18next } from '@operato/i18n'\nimport { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { OxContactEdit } from '@operato/contact/ox-contact-edit.js'\n\n@customElement('contact-popup')\nexport class ContactPopup extends LitElement {\n static styles = [\n ScrollbarStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n color: var(--popup-content-color);\n background-color: var(--popup-content-background-color);\n }\n\n [content] {\n flex: 1;\n padding: var(--spacing-medium);\n overflow: auto;\n }\n `\n ]\n\n @property({ type: String }) contactId?: string\n @property({ type: Boolean, attribute: 'edit-mode' }) editMode?: boolean = false\n @property({ type: Boolean }) detachable?: boolean = false\n @property({ type: Object }) closeCallback?: (contact?: Contact | null) => void\n\n @state() contact: Contact = {}\n\n @query('ox-contact-edit') editor!: OxContactEdit\n\n render() {\n return html`\n <div content>\n ${this.editMode\n ? html`<ox-contact-edit\n .contact=${this.contact}\n @edit-cancel=${() => (this.editMode = false)}\n @edit-done=${(e: CustomEvent) => {\n this.updateContact(e.detail)\n this.editMode = false\n }}\n ></ox-contact-edit>`\n : html` <ox-contact-view .contact=${this.contact}></ox-contact-view>`}\n </div>\n\n <div class=\"footer\">\n ${!this.editMode\n ? html`\n ${this.detachable\n ? html`\n <button\n danger\n @click=${() => {\n this.dispatchEvent(new CustomEvent('detach'))\n history.back()\n }}\n >\n <md-icon>link_off</md-icon>\n ${i18next.t('button.detach')}\n </button>\n `\n : html``}\n <div filler></div>\n <button @click=${() => (this.editMode = true)}><md-icon>edit</md-icon>${i18next.t('button.edit')}</button>\n <button @click=${this.onClose} ok><md-icon>close</md-icon>${i18next.t('button.close')}</button>\n `\n : html`\n <button @click=${() => this.editor.reset()}>\n <md-icon>restart_alt</md-icon>${i18next.t('button.reset')}\n </button>\n <div filler></div>\n <button @click=${() => this.editor.cancel()}>\n <md-icon>cancel</md-icon>${i18next.t('button.cancel')}\n </button>\n <button @click=${() => this.editor.save()} ok><md-icon>save</md-icon>${i18next.t('button.save')}</button>\n `}\n </div>\n `\n }\n\n onClose() {\n this.closeCallback && this.closeCallback(this.contact?.id ? this.contact : null)\n\n history.back()\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('contactId') && this.contactId) {\n this.fetchContact()\n }\n }\n\n async fetchContact() {\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n contact(id: $id) {\n id\n name\n company\n department\n email\n phone\n address\n note\n items {\n type\n label\n value\n }\n profile {\n left\n top\n zoom\n picture\n }\n }\n }\n `,\n variables: {\n id: this.contactId\n }\n })\n\n this.contact = response.data.contact\n }\n\n async updateContact(contact: Contact) {\n if (contact.id) {\n var { id, ...patch } = contact\n\n var response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $patch: ContactPatch!) {\n contact: updateContact(id: $id, patch: $patch) {\n id\n name\n company\n email\n note\n items {\n label\n type\n value\n }\n profile {\n left\n top\n zoom\n picture\n }\n }\n }\n `,\n variables: {\n id,\n patch\n },\n context: {\n hasUpload: true\n }\n })\n } else {\n var response = await client.mutate({\n mutation: gql`\n mutation ($contact: NewContact!) {\n contact: createContact(contact: $contact) {\n id\n name\n company\n email\n note\n items {\n label\n type\n value\n }\n profile {\n left\n top\n zoom\n picture\n }\n }\n }\n `,\n variables: {\n contact\n },\n context: {\n hasUpload: true\n }\n })\n }\n\n this.contact = response.data.contact\n\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: this.contact\n })\n )\n }\n}\n"]}
1
+ {"version":3,"file":"contact-popup.js","sourceRoot":"","sources":["../../client/components/contact-popup.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,qCAAqC,CAAA;AAC5C,OAAO,qCAAqC,CAAA;AAE5C,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,C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AI,EAAE,MAAM,EAAE,CAAC;;mDAAmD;AAErE;IAAR,KAAK,EAAE;;6CAAsB;AAEJ;IAAzB,KAAK,CAAC,iBAAiB,CAAC;8BAAU,aAAa;4CAAA;AA3BrC,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA4MxB","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/contact/ox-contact-view.js'\nimport '@operato/contact/ox-contact-edit.js'\n\nimport { html, css, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport gql from 'graphql-tag'\n\nimport { client } from '@operato/graphql'\nimport { Contact } from '@operato/contact/ox-contact.js'\nimport { i18next } from '@operato/i18n'\nimport { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { OxContactEdit } from '@operato/contact/ox-contact-edit.js'\n\n@customElement('contact-popup')\nexport class ContactPopup extends LitElement {\n static styles = [\n ScrollbarStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n color: var(--popup-content-color);\n background-color: var(--popup-content-background-color);\n }\n\n [content] {\n flex: 1;\n padding: var(--spacing-medium);\n overflow: auto;\n }\n `\n ]\n\n @property({ type: String }) contactId?: string\n @property({ type: Boolean, attribute: 'edit-mode' }) editMode?: boolean = false\n @property({ type: Boolean }) detachable?: boolean = false\n @property({ type: Object }) closeCallback?: (contact?: Contact | null) => void\n\n @state() contact: Contact = {}\n\n @query('ox-contact-edit') editor!: OxContactEdit\n\n render() {\n return html`\n <div content>\n ${this.editMode\n ? html`<ox-contact-edit\n .contact=${this.contact}\n @edit-cancel=${() => (this.editMode = false)}\n @edit-done=${(e: CustomEvent) => {\n this.updateContact(e.detail)\n this.editMode = false\n }}\n ></ox-contact-edit>`\n : html` <ox-contact-view .contact=${this.contact}></ox-contact-view>`}\n </div>\n\n <div class=\"footer\">\n ${!this.editMode\n ? html`\n ${this.detachable\n ? html`\n <button\n danger\n @click=${() => {\n this.dispatchEvent(new CustomEvent('detach'))\n history.back()\n }}\n >\n <md-icon>link_off</md-icon>\n ${i18next.t('button.detach')}\n </button>\n `\n : html``}\n <div filler></div>\n <button @click=${() => (this.editMode = true)}><md-icon>edit</md-icon>${i18next.t('button.edit')}</button>\n <button @click=${this.onClose} ok><md-icon>close</md-icon>${i18next.t('button.close')}</button>\n `\n : html`\n <button @click=${() => this.editor.reset()}>\n <md-icon>restart_alt</md-icon>${i18next.t('button.reset')}\n </button>\n <div filler></div>\n <button @click=${() => this.editor.cancel()}>\n <md-icon>cancel</md-icon>${i18next.t('button.cancel')}\n </button>\n <button @click=${() => this.editor.save()} ok><md-icon>save</md-icon>${i18next.t('button.save')}</button>\n `}\n </div>\n `\n }\n\n onClose() {\n this.closeCallback && this.closeCallback(this.contact?.id ? this.contact : null)\n\n history.back()\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('contactId') && this.contactId) {\n this.fetchContact()\n }\n }\n\n async fetchContact() {\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n contact(id: $id) {\n id\n name\n company\n department\n email\n phone\n address\n note\n items {\n type\n label\n value\n }\n profile {\n left\n top\n zoom\n picture\n }\n }\n }\n `,\n variables: {\n id: this.contactId\n }\n })\n\n this.contact = response.data.contact\n }\n\n async updateContact(contact: Contact) {\n if (contact.id) {\n var { id, ...patch } = contact\n\n var response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $patch: ContactPatch!) {\n contact: updateContact(id: $id, patch: $patch) {\n id\n name\n company\n email\n phone\n note\n items {\n label\n type\n value\n }\n profile {\n left\n top\n zoom\n picture\n }\n }\n }\n `,\n variables: {\n id,\n patch\n },\n context: {\n hasUpload: true\n }\n })\n } else {\n var response = await client.mutate({\n mutation: gql`\n mutation ($contact: NewContact!) {\n contact: createContact(contact: $contact) {\n id\n name\n company\n email\n phone\n note\n items {\n label\n type\n value\n }\n profile {\n left\n top\n zoom\n picture\n }\n }\n }\n `,\n variables: {\n contact\n },\n context: {\n hasUpload: true\n }\n })\n }\n\n this.contact = response.data.contact\n\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: this.contact\n })\n )\n }\n}\n"]}