@things-factory/meta-ui 10.1.176 → 10.1.178
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/dist-client/component/popup/file-upload-popup.d.ts +1 -0
- package/dist-client/component/popup/file-upload-popup.js +2 -1
- package/dist-client/component/popup/file-upload-popup.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -20
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import '@material/web/icon/icon.js';
|
|
3
|
+
import '@operato/input/ox-input-file.js';
|
|
3
4
|
import { client, gqlContext } from '@things-factory/shell';
|
|
4
5
|
import { css, html, LitElement } from 'lit';
|
|
5
6
|
import { SingleColumnFormStyles } from '@things-factory/form-ui';
|
|
@@ -44,7 +45,7 @@ class FileUploadPopup extends LitElement {
|
|
|
44
45
|
<fieldset>
|
|
45
46
|
<legend>${TermsUtil.tLabel('file_upload')}</legend>
|
|
46
47
|
<label>${TermsUtil.tLabel('file_upload')}</label>
|
|
47
|
-
<file
|
|
48
|
+
<ox-input-file custom-input id="uploadTemplate"></ox-input-file>
|
|
48
49
|
|
|
49
50
|
<label>${TermsUtil.tLabel('category')}</label>
|
|
50
51
|
<select name="category" required>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-upload-popup.js","sourceRoot":"","sources":["../../../client/component/popup/file-upload-popup.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"file-upload-popup.js","sourceRoot":"","sources":["../../../client/component/popup/file-upload-popup.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,4BAA4B,CAAA;AACnC,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,GAAG,EAAE,IA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eAAe,CAAC,UAAU,CAAC,CAAC,KAAK;gBAChD,WAAW,EAAE,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,KAAK;aACvD,CAAA;QACH,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC,CAAA;QACpE,CAAC;IACH,CAAC;IAED,eAAe,CAAC,IAAI;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,eAAe,IAAI,iBAAiB,IAAI,GAAG,CAAC,CAAA;IACnF,CAAC;CACF;AAED,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAA","sourcesContent":["// @ts-nocheck\nimport '@material/web/icon/icon.js'\nimport '@operato/input/ox-input-file.js'\n\nimport { client, gqlContext } from '@things-factory/shell'\nimport { css, html, LitElement } from 'lit'\nimport { SingleColumnFormStyles } from '@things-factory/form-ui'\nimport { CommonHeaderStyles } from '@operato/styles'\nimport gql from 'graphql-tag'\nimport { TermsUtil } from '../../utils/terms-util'\nimport { ServiceUtil } from '../../utils/service-util'\nimport { MetaApi } from '../../utils/meta-api'\n\nclass FileUploadPopup extends LitElement {\n static get styles() {\n return [\n CommonHeaderStyles,\n SingleColumnFormStyles,\n css`\n :host {\n padding: 10px;\n display: flex;\n flex-direction: column;\n overflow-x: overlay;\n background-color: var(--md-sys-color-background);\n }\n\n .input-container {\n display: flex;\n }\n `\n ]\n }\n\n static get properties() {\n return {\n templateTypes: Array\n }\n }\n\n async connectedCallback() {\n super.connectedCallback()\n this.templateTypes = await ServiceUtil.codeItems('TEMPLATE_TYPES')\n }\n\n render() {\n return html`\n <div>\n <form id=\"input-form\" class=\"single-column-form\">\n <fieldset>\n <legend>${TermsUtil.tLabel('file_upload')}</legend>\n <label>${TermsUtil.tLabel('file_upload')}</label>\n <ox-input-file custom-input id=\"uploadTemplate\"></ox-input-file>\n\n <label>${TermsUtil.tLabel('category')}</label>\n <select name=\"category\" required>\n <option value=\"\">${TermsUtil.tText('please_select_upload_category')}</option>\n ${(this.templateTypes || []).map(templateType => {\n const { name, description } = templateType\n return html` <option value=\"${name}\">${name} ${description ? ` (${description})` : ''}</option> `\n })}\n </select>\n\n <label>${TermsUtil.tLabel('description')}</label>\n <input name=\"description\" />\n </fieldset>\n </form>\n </div>\n\n <div class=\"footer\">\n <div filler></div>\n <button @click=${this._createAttachment} done>\n <md-icon>attach_file_add</md-icon>${TermsUtil.tButton('create')}\n </button>\n </div>\n `\n }\n\n get _template() {\n return this.renderRoot.querySelector('#uploadTemplate')\n }\n\n async _createAttachment() {\n try {\n const attachment = this._getAttachmentInfo()\n const response = await client.mutate({\n mutation: gql`\n mutation ($attachment: NewAttachment!) {\n createAttachment(attachment: $attachment) {\n id\n name\n path\n }\n }\n `,\n variables: {\n attachment\n },\n context: {\n ...gqlContext(),\n hasUpload: true\n }\n })\n\n if (!response.errors) {\n history.back()\n this.dispatchEvent(new CustomEvent('template-uploaded', { bubbles: true, composed: true, cancelable: true }))\n }\n } catch (e) {\n MetaApi.showAlertPopup('label.error', e.message, 'error', 'confirm')\n }\n }\n\n _getAttachmentInfo() {\n if (this.renderRoot.querySelector('form').checkValidity()) {\n return {\n file: this._template.files[0],\n category: this._getInputByName('category').value,\n description: this._getInputByName('description').value\n }\n } else {\n throw new Error(TermsUtil.tText('text.attachment_info_not_valid'))\n }\n }\n\n _getInputByName(name) {\n return this.renderRoot.querySelector(`select[name=${name}], input[name=${name}]`)\n }\n}\n\nwindow.customElements.define('file-upload-popup', FileUploadPopup)\n"]}
|