@operato/app 1.0.0-alpha.9 → 1.0.0-beta.2
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/@types/global/index.d.ts +2 -0
- package/CHANGELOG.md +335 -17
- package/demo/data-grist-test.html +15 -10
- package/demo/index.html +1 -10
- package/dist/src/{grist → grist-editor}/index.d.ts +0 -0
- package/dist/src/grist-editor/index.js +28 -0
- package/dist/src/grist-editor/index.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-code.d.ts +7 -0
- package/dist/src/grist-editor/ox-grist-editor-code.js +53 -0
- package/dist/src/grist-editor/ox-grist-editor-code.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-crontab.d.ts +8 -0
- package/dist/src/grist-editor/ox-grist-editor-crontab.js +50 -0
- package/dist/src/grist-editor/ox-grist-editor-crontab.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-json.d.ts +7 -0
- package/dist/src/grist-editor/ox-grist-editor-json.js +54 -0
- package/dist/src/grist-editor/ox-grist-editor-json.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-parameters.d.ts +12 -0
- package/dist/src/{grist/parameters-editor.js → grist-editor/ox-grist-editor-parameters.js} +16 -37
- package/dist/src/grist-editor/ox-grist-editor-parameters.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-partition-keys.d.ts +11 -0
- package/dist/src/grist-editor/ox-grist-editor-partition-keys.js +74 -0
- package/dist/src/grist-editor/ox-grist-editor-partition-keys.js.map +1 -0
- package/dist/src/{grist/code-editor.d.ts → grist-editor/ox-grist-editor-resource-code.d.ts} +2 -2
- package/dist/src/{grist/code-editor.js → grist-editor/ox-grist-editor-resource-code.js} +10 -5
- package/dist/src/grist-editor/ox-grist-editor-resource-code.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-resource-id.d.ts +9 -0
- package/dist/src/grist-editor/ox-grist-editor-resource-id.js +72 -0
- package/dist/src/grist-editor/ox-grist-editor-resource-id.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-resource-object.d.ts +11 -0
- package/dist/src/{grist/object-editor.js → grist-editor/ox-grist-editor-resource-object.js} +30 -78
- package/dist/src/grist-editor/ox-grist-editor-resource-object.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-value-map.d.ts +11 -0
- package/dist/src/grist-editor/ox-grist-editor-value-map.js +74 -0
- package/dist/src/grist-editor/ox-grist-editor-value-map.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-renderer-crontab.d.ts +2 -0
- package/dist/src/grist-editor/ox-grist-renderer-crontab.js +26 -0
- package/dist/src/grist-editor/ox-grist-renderer-crontab.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-renderer-resource-id.d.ts +2 -0
- package/dist/src/grist-editor/ox-grist-renderer-resource-id.js +9 -0
- package/dist/src/grist-editor/ox-grist-renderer-resource-id.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-renderer-resource-object.d.ts +2 -0
- package/dist/src/grist-editor/ox-grist-renderer-resource-object.js +22 -0
- package/dist/src/grist-editor/ox-grist-renderer-resource-object.js.map +1 -0
- package/dist/src/{grist/parameters-editor-builder.d.ts → grist-editor/ox-parameters-builder.d.ts} +1 -1
- package/dist/src/{grist/parameters-editor-builder.js → grist-editor/ox-parameters-builder.js} +10 -11
- package/dist/src/grist-editor/ox-parameters-builder.js.map +1 -0
- package/dist/src/grist-editor/ox-popup-code-input.d.ts +12 -0
- package/dist/src/grist-editor/ox-popup-code-input.js +71 -0
- package/dist/src/grist-editor/ox-popup-code-input.js.map +1 -0
- package/dist/src/grist-editor/ox-popup-crontab-input.d.ts +11 -0
- package/dist/src/grist-editor/ox-popup-crontab-input.js +74 -0
- package/dist/src/grist-editor/ox-popup-crontab-input.js.map +1 -0
- package/dist/src/{grist/parameters-editor-popup.d.ts → grist-editor/ox-popup-parameters-builder.d.ts} +1 -1
- package/dist/src/{grist/parameters-editor-popup.js → grist-editor/ox-popup-parameters-builder.js} +15 -15
- package/dist/src/grist-editor/ox-popup-parameters-builder.js.map +1 -0
- package/dist/src/grist-editor/ox-popup-partition-keys-input.d.ts +12 -0
- package/dist/src/grist-editor/ox-popup-partition-keys-input.js +98 -0
- package/dist/src/grist-editor/ox-popup-partition-keys-input.js.map +1 -0
- package/dist/src/grist-editor/ox-popup-value-map-input.d.ts +12 -0
- package/dist/src/grist-editor/ox-popup-value-map-input.js +104 -0
- package/dist/src/grist-editor/ox-popup-value-map-input.js.map +1 -0
- package/dist/src/{grist/id-selector.d.ts → grist-editor/ox-selector-resource-id.d.ts} +4 -3
- package/dist/src/{grist/id-selector.js → grist-editor/ox-selector-resource-id.js} +23 -18
- package/dist/src/grist-editor/ox-selector-resource-id.js.map +1 -0
- package/dist/src/{grist/object-selector.d.ts → grist-editor/ox-selector-resource-object.d.ts} +4 -3
- package/dist/src/{grist/object-selector.js → grist-editor/ox-selector-resource-object.js} +30 -25
- package/dist/src/grist-editor/ox-selector-resource-object.js.map +1 -0
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.js +3 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/input/index.d.ts +3 -0
- package/dist/src/input/index.js +4 -0
- package/dist/src/input/index.js.map +1 -0
- package/dist/src/input/ox-input-background-pattern.d.ts +1 -1
- package/dist/src/input/ox-input-background-pattern.js +6 -3
- package/dist/src/input/ox-input-background-pattern.js.map +1 -1
- package/dist/src/input/ox-input-fill-style.d.ts +2 -3
- package/dist/src/input/ox-input-fill-style.js +2 -2
- package/dist/src/input/ox-input-fill-style.js.map +1 -1
- package/dist/src/input/ox-input-graphql.d.ts +36 -0
- package/dist/src/input/ox-input-graphql.js +161 -0
- package/dist/src/input/ox-input-graphql.js.map +1 -0
- package/dist/src/property-editor/index.d.ts +24 -0
- package/dist/src/property-editor/index.js +58 -0
- package/dist/src/property-editor/index.js.map +1 -0
- package/dist/src/property-editor/ox-property-editor-graphql.d.ts +5 -0
- package/dist/src/property-editor/ox-property-editor-graphql.js +15 -0
- package/dist/src/property-editor/ox-property-editor-graphql.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +44 -22
- package/src/grist-editor/index.ts +30 -0
- package/src/grist-editor/ox-grist-editor-code.ts +62 -0
- package/src/grist-editor/ox-grist-editor-crontab.ts +62 -0
- package/src/grist-editor/ox-grist-editor-json.ts +62 -0
- package/src/{grist/parameters-editor.ts → grist-editor/ox-grist-editor-parameters.ts} +13 -26
- package/src/grist-editor/ox-grist-editor-partition-keys.ts +86 -0
- package/src/{grist/code-editor.ts → grist-editor/ox-grist-editor-resource-code.ts} +4 -5
- package/src/grist-editor/ox-grist-editor-resource-id.ts +85 -0
- package/src/{grist/object-editor.ts → grist-editor/ox-grist-editor-resource-object.ts} +28 -63
- package/src/grist-editor/ox-grist-editor-value-map.ts +86 -0
- package/src/grist-editor/ox-grist-renderer-crontab.ts +30 -0
- package/src/{grist/id-renderer.ts → grist-editor/ox-grist-renderer-resource-id.ts} +4 -3
- package/src/grist-editor/ox-grist-renderer-resource-object.ts +26 -0
- package/src/{grist/parameters-editor-builder.ts → grist-editor/ox-parameters-builder.ts} +4 -6
- package/src/grist-editor/ox-popup-code-input.ts +65 -0
- package/src/grist-editor/ox-popup-crontab-input.ts +74 -0
- package/src/{grist/parameters-editor-popup.ts → grist-editor/ox-popup-parameters-builder.ts} +5 -5
- package/src/grist-editor/ox-popup-partition-keys-input.ts +95 -0
- package/src/grist-editor/ox-popup-value-map-input.ts +101 -0
- package/src/{grist/id-selector.ts → grist-editor/ox-selector-resource-id.ts} +12 -6
- package/src/{grist/object-selector.ts → grist-editor/ox-selector-resource-object.ts} +15 -9
- package/src/index.ts +3 -1
- package/src/input/index.ts +3 -0
- package/src/input/ox-input-background-pattern.ts +6 -3
- package/src/input/ox-input-fill-style.ts +3 -4
- package/src/input/ox-input-graphql.ts +169 -0
- package/src/property-editor/index.ts +59 -0
- package/src/property-editor/ox-property-editor-graphql.ts +12 -0
- package/themes/app-theme.css +142 -0
- package/themes/grist-theme.css +194 -0
- package/themes/oops-theme.css +26 -0
- package/themes/report-theme.css +47 -0
- package/dist/src/grist/code-editor.js.map +0 -1
- package/dist/src/grist/id-input.d.ts +0 -19
- package/dist/src/grist/id-input.js +0 -119
- package/dist/src/grist/id-input.js.map +0 -1
- package/dist/src/grist/id-renderer.d.ts +0 -2
- package/dist/src/grist/id-renderer.js +0 -9
- package/dist/src/grist/id-renderer.js.map +0 -1
- package/dist/src/grist/id-selector.js.map +0 -1
- package/dist/src/grist/index.js +0 -11
- package/dist/src/grist/index.js.map +0 -1
- package/dist/src/grist/object-editor.d.ts +0 -18
- package/dist/src/grist/object-editor.js.map +0 -1
- package/dist/src/grist/object-selector.js.map +0 -1
- package/dist/src/grist/parameters-editor-builder.js.map +0 -1
- package/dist/src/grist/parameters-editor-popup.js.map +0 -1
- package/dist/src/grist/parameters-editor.d.ts +0 -19
- package/dist/src/grist/parameters-editor.js.map +0 -1
- package/dist/src/input/ox-input-color-gradient.d.ts +0 -25
- package/dist/src/input/ox-input-color-gradient.js +0 -318
- package/dist/src/input/ox-input-color-gradient.js.map +0 -1
- package/src/grist/id-input.ts +0 -135
- package/src/grist/index.ts +0 -13
- package/src/input/ox-input-color-gradient.ts +0 -341
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-selector-resource-object.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-selector-resource-object.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,iCAAiC,CAAA;AAExC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAQL,SAAS,EACV,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,qBAAqB,EAAc,MAAM,eAAe,CAAA;AACj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CAAA;IAClE,CAAC;CACF,CAAA;AAvUQ,+BAAM,GAAG;IACd,qBAAqB;IACrB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;KAyBF;CACF,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAAY;AACX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAA4B;AAC3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAAmB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iEAAwD;AACxD;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;iEAAoC;AAEnC;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;8DAAkB;AACjB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;wDASlB;AACoB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAU;AACT;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAAiD;AAEzD;IAAlB,KAAK,CAAC,UAAU,CAAC;uDAAkB;AACX;IAAxB,KAAK,CAAC,gBAAgB,CAAC;4DAAwB;AAtDrC,wBAAwB;IADpC,aAAa,CAAC,6BAA6B,CAAC;GAChC,wBAAwB,CAwUpC;SAxUY,wBAAwB","sourcesContent":["import '@operato/data-grist'\nimport '@operato/form/ox-search-form.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport {\n ColumnConfig,\n DataGrist,\n FetchHandler,\n FetchOption,\n GristData,\n GristEventHandler,\n GristRecord,\n ZERO_DATA\n} from '@operato/data-grist'\nimport { MultiColumnFormStyles, SearchForm } from '@operato/form'\nimport { buildArgs, client, gqlContext } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { isMobileDevice } from '@operato/utils'\n\n@customElement('ox-selector-resource-object')\nexport class OxSelectorResourceObject extends LitElement {\n static styles = [\n MultiColumnFormStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n }\n\n ox-grist {\n flex: 1;\n }\n\n .button-container {\n display: flex;\n margin-left: auto;\n }\n\n form {\n position: relative;\n }\n\n [search] {\n position: absolute;\n right: 0;\n }\n `\n ]\n\n @property({ type: String }) value?: string\n @property({ type: Object }) config: any\n @property({ type: Object }) data: GristData = ZERO_DATA\n @property({ type: String }) queryName!: string\n @property({ type: Object }) basicArgs: any\n @property({ type: Object }) confirmCallback?: (record?: GristRecord | null) => void\n @property({ type: Array }) selectedRecords: GristRecord[] = []\n\n @property({ type: Array }) searchFields: any\n @property({ type: Array }) select: {\n type: string\n name: string\n header: string\n subFields?: string[]\n hidden: boolean\n ignoreCondition: boolean\n queryName: string\n width: number\n }[] = []\n @property({ type: Object }) list: any\n @property({ type: String }) valueField: string | ((item: any) => any) = 'id'\n\n @query('ox-grist') grist!: DataGrist\n @query('ox-search-form') searchForm!: SearchForm\n\n render() {\n return html`\n <ox-search-form\n id=\"search-form\"\n @keypress=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n this.grist.fetch()\n }\n }}\n @submit=${(e: SubmitEvent) => this.grist.fetch()}\n .fields=${this.searchFields}\n ></ox-search-form>\n\n <ox-grist\n .mode=${isMobileDevice() ? 'LIST' : 'GRID'}\n .config=${this.config}\n .data=${this.data}\n .fetchHandler=${this.fetchHandler.bind(this)}\n .selectedRecords=${this.selectedRecords}\n ></ox-grist>\n\n <div class=\"button-container\">\n <mwc-button @click=${this.onempty.bind(this)}>${i18next.t('button.empty')}</mwc-button>\n <mwc-button @click=${this.oncancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>\n <mwc-button @click=${this.onconfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>\n </div>\n `\n }\n\n onempty() {\n this.confirmCallback && this.confirmCallback()\n history.back()\n }\n\n oncancel() {\n history.back()\n }\n\n onconfirm() {\n this.confirmCallback && this.confirmCallback(this.selected)\n history.back()\n }\n\n fetchHandler: FetchHandler = async ({ filters, page, limit, sorters = [] }) => {\n const response = await client.query({\n query: gql`\n query {\n fetch: ${this.queryName} (${buildArgs(await this._buildConditions({ filters, page, limit, sorters }))}) {\n ${this.getSelectFields()}\n }\n }\n `,\n context: gqlContext()\n })\n\n if (!response.errors) {\n const records = response.data.fetch.items.map((item: any) => {\n let rowValue\n\n if (this.valueField && typeof this.valueField === 'function') {\n rowValue = this.valueField(item)\n } else if (this.valueField) {\n rowValue = item[this.valueField]\n } else {\n rowValue = item.id\n }\n\n if (this.value && this.value === rowValue) {\n this.selectedRecords = [item]\n item['__selected__'] = true\n }\n\n return item\n })\n const total = response.data.fetch.total\n\n return {\n records,\n total,\n limit,\n page\n }\n }\n }\n\n async firstUpdated() {\n this.config = {\n columns: [\n {\n type: 'gutter',\n gutterName: 'sequence'\n },\n {\n type: 'gutter',\n gutterName: 'row-selector',\n multiple: false\n }\n ],\n rows: {\n selectable: {\n multiple: false\n },\n handlers: {\n click: 'select-row',\n dblclick: ((columns, data, column, record, rowIndex, field) => {\n this.onconfirm()\n }) as GristEventHandler\n },\n appendable: false\n }\n }\n\n if (this.select && this.select.length > 0) {\n let _searchFields = this.select.filter(selectField => !selectField.hidden && !selectField.ignoreCondition)\n if (this.list && this.list.fields && this.list.fields.length > 0) {\n _searchFields = _searchFields.filter(searchField => this.list.fields.indexOf(searchField.name) >= 0)\n } else {\n _searchFields = _searchFields.slice(0, 4)\n }\n\n this.searchFields = _searchFields.map(selectField => {\n const fieldType = (selectField.type && selectField.type.toLowerCase()) || 'string'\n const numberTypes = ['integer', 'float']\n return {\n label: selectField.header || i18next.t(`field.${selectField.name}`),\n name: selectField.name,\n type:\n fieldType === 'string'\n ? 'text'\n : numberTypes.indexOf(fieldType) >= 0\n ? 'number'\n : fieldType === 'boolean'\n ? 'checkbox'\n : fieldType,\n queryName: selectField.queryName,\n props:\n fieldType === 'string'\n ? { searchOper: 'i_like' }\n : fieldType === 'object'\n ? { searchOper: 'in' }\n : { searchOper: 'eq' },\n attrs: fieldType === 'boolean' ? ['indeterminated'] : []\n }\n })\n this.config = {\n ...this.config,\n columns: [\n ...this.config.columns,\n ...this.select.map(selectField => {\n return {\n ...selectField,\n type: selectField.type || 'string',\n width: selectField.width || 160,\n header: selectField.header || i18next.t(`field.${selectField.name}`)\n }\n })\n ]\n }\n } else {\n this.searchFields = [\n {\n label: i18next.t('field.name'),\n name: 'name',\n type: 'text',\n props: { searchOper: 'i_like' }\n },\n {\n label: i18next.t('field.description'),\n name: 'description',\n type: 'text',\n props: { searchOper: 'i_like' }\n }\n ]\n\n this.config = {\n ...this.config,\n columns: [\n ...this.config.columns,\n {\n type: 'string',\n name: 'id',\n header: i18next.t('field.id'),\n hidden: true\n },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n align: 'left'\n },\n sortable: true,\n width: 160\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n align: 'left'\n },\n sortable: true,\n width: 300\n }\n ]\n }\n }\n\n this.config = {\n ...this.config,\n list: {\n ...this.list,\n fields:\n this.list && this.list.fields && this.list.fields.length > 0\n ? this.list.fields\n : (this.config.columns as ColumnConfig[])\n .filter(column => column.type !== 'gutter')\n .slice(0, 3)\n .map(column => column.name)\n }\n }\n\n await this.updateComplete\n this.grist && this.grist.focus()\n }\n\n getSelectFields() {\n if (this.select && this.select.length > 0) {\n return `items {\n ${this.select.map(selectField => {\n return selectField.type === 'object'\n ? `${selectField.name} { ${\n selectField.subFields && selectField.subFields.length > 0\n ? selectField.subFields.join(' ')\n : `id name description`\n } }`\n : `${selectField.name}`\n })}\n }\n total`\n } else {\n return `\n items {\n id\n name\n description\n }\n total\n `\n }\n }\n\n async _buildConditions({ filters, page, limit, sorters }: FetchOption) {\n const queryConditions = {\n filters: [],\n ...this.basicArgs\n }\n\n queryConditions.filters = [...queryConditions.filters, ...(await this.searchForm.getQueryFilters())]\n queryConditions.pagination = { page, limit }\n queryConditions.sortings = sorters\n\n return queryConditions\n }\n\n get selected() {\n var grist = this.renderRoot.querySelector('ox-grist') as DataGrist\n\n var selected = grist.selected\n\n return selected && selected.length > 0 ? selected[0] : undefined\n }\n}\n"]}
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA","sourcesContent":["export * from './grist/index.js'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA","sourcesContent":["export * from './input/index.js'\nexport * from './property-editor'\nexport * from './grist-editor/index.js'\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/input/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA","sourcesContent":["export * from './ox-input-background-pattern.js'\nexport * from './ox-input-fill-style.js'\nexport * from './ox-input-graphql.js'\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
import '@operato/i18n/ox-i18n.js';
|
|
5
|
-
import '@operato/attachment/ox-attachment-
|
|
5
|
+
import '@operato/attachment/ox-attachment-selector.js';
|
|
6
6
|
import { OxFormField } from '@operato/input';
|
|
7
7
|
export declare type BackgroundPatternOption = {
|
|
8
8
|
image?: HTMLImageElement | string;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __decorate } from "tslib";
|
|
5
5
|
import '@operato/i18n/ox-i18n.js';
|
|
6
|
-
import '@operato/attachment/ox-attachment-
|
|
6
|
+
import '@operato/attachment/ox-attachment-selector.js';
|
|
7
7
|
import { css, html } from 'lit';
|
|
8
8
|
import { customElement, property } from 'lit/decorators.js';
|
|
9
9
|
import { OxFormField } from '@operato/input';
|
|
@@ -22,11 +22,14 @@ let OxInputBackgroundPattern = class OxInputBackgroundPattern extends OxFormFiel
|
|
|
22
22
|
return html `
|
|
23
23
|
<label> <ox-i18n msgid="label.image" auto="">image</ox-i18n> </label>
|
|
24
24
|
|
|
25
|
-
<ox-
|
|
25
|
+
<ox-attachment-selector
|
|
26
26
|
value-key="image"
|
|
27
27
|
.value=${value.image || ''}
|
|
28
|
+
.properties=${{
|
|
29
|
+
category: 'image'
|
|
30
|
+
}}
|
|
28
31
|
custom-editor
|
|
29
|
-
></ox-
|
|
32
|
+
></ox-attachment-selector>
|
|
30
33
|
|
|
31
34
|
<label> <ox-i18n msgid="label.align" auto="">align</ox-i18n> </label>
|
|
32
35
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-input-background-pattern.js","sourceRoot":"","sources":["../../../src/input/ox-input-background-pattern.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,0BAA0B,CAAA;AACjC,OAAO,
|
|
1
|
+
{"version":3,"file":"ox-input-background-pattern.js","sourceRoot":"","sources":["../../../src/input/ox-input-background-pattern.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,0BAA0B,CAAA;AACjC,OAAO,+CAA+C,CAAA;AAEtD,OAAO,EAAE,GAAG,EAAE,IAAI,E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E,IAAI,EAAE,CAAC,CAAC,CAAA;IAClF,CAAC;CACF,CAAA;AAnIQ,+BAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDlB,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAgC;AA5DhD,wBAAwB;IADpC,aAAa,CAAC,6BAA6B,CAAC;GAChC,wBAAwB,CAoIpC;SApIY,wBAAwB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@operato/i18n/ox-i18n.js'\nimport '@operato/attachment/ox-attachment-selector.js'\n\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { OxFormField } from '@operato/input'\n\nexport type BackgroundPatternOption = {\n image?: HTMLImageElement | string\n align?: 'left-top' | 'top' | 'right-top' | 'left' | 'center' | 'right' | 'left-bottom' | 'bottom' | 'right-bottom'\n offsetX?: number\n offsetY?: number\n width?: number\n height?: number\n fitPattern?: boolean\n}\n\n/**\n * 컴포넌트의 fill pattern을 편집하는 element\n *\n * Example:\n * <ox-input-background-pattern\n * @change=\"${e => { this.pattern = e.target.value }}\"\n * .value=${this.pattern}\"\n * ></ox-input-background-pattern>\n */\n\n@customElement('ox-input-background-pattern')\nexport class OxInputBackgroundPattern extends OxFormField {\n static styles = css`\n :host,\n .grid-10 {\n display: grid;\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 5px;\n grid-auto-rows: minmax(24px, auto);\n\n align-items: center;\n }\n\n * {\n align-self: stretch;\n }\n\n label {\n grid-column: span 2;\n text-align: right;\n text-transform: capitalize;\n\n align-self: center;\n }\n\n .grid-10 {\n grid-column: span 10;\n }\n\n select,\n input,\n [custom-editor] {\n grid-column: span 8;\n }\n\n select {\n height: 100%;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n\n input[type='checkbox'] {\n grid-column: 3 / 4;\n align-self: center;\n }\n\n input[type='checkbox'] ~ label {\n grid-column: span 7;\n text-align: left;\n }\n\n .grid-10 > input[type='number'] {\n grid-column: span 3;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n\n .grid-10 > label {\n grid-column: span 2;\n text-align: right;\n }\n `\n\n @property({ type: Object }) value?: BackgroundPatternOption\n\n render() {\n const value = this.value || ({} as BackgroundPatternOption)\n\n return html`\n <label> <ox-i18n msgid=\"label.image\" auto=\"\">image</ox-i18n> </label>\n\n <ox-attachment-selector\n value-key=\"image\"\n .value=${value.image || ''}\n .properties=${{\n category: 'image'\n }}\n custom-editor\n ></ox-attachment-selector>\n\n <label> <ox-i18n msgid=\"label.align\" auto=\"\">align</ox-i18n> </label>\n\n <select value-key=\"align\" class=\"select-content\" .value=${value.align}>\n <option value=\"left-top\">Left Top</option>\n <option value=\"top\">Top</option>\n <option value=\"right-top\">Right Top</option>\n <option value=\"left\">Left</option>\n <option value=\"center\">Center</option>\n <option value=\"right\">Right</option>\n <option value=\"left-bottom\">Left Bottom</option>\n <option value=\"bottom\">Bottom</option>\n <option value=\"right-bottom\">Right Bottom</option>\n </select>\n\n <div class=\"grid-10\">\n <label> <ox-i18n msgid=\"label.offset-x\" auto=\"\">offsetX</ox-i18n> </label>\n <input type=\"number\" value-key=\"offsetX\" .value=${value.offsetX} />\n\n <label> <ox-i18n msgid=\"label.offset-y\" auto=\"\">offsetY</ox-i18n> </label>\n <input type=\"number\" value-key=\"offsetY\" .value=${value.offsetY} />\n\n <label> <ox-i18n msgid=\"label.width\" auto=\"\">width</ox-i18n> </label>\n <input type=\"number\" value-key=\"width\" .value=${value.width} />\n\n <label> <ox-i18n msgid=\"label.height\" auto=\"\">height</ox-i18n> </label>\n <input type=\"number\" value-key=\"height\" .value=${value.height} />\n </div>\n\n <div class=\"grid-10\">\n <input value-key=\"fitPattern\" type=\"checkbox\" .checked=${value.fitPattern} required />\n <label> <ox-i18n msgid=\"label.fit\" auto=\"\">Fit</ox-i18n> </label>\n </div>\n `\n }\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', this._onChange.bind(this))\n }\n\n _onChange(e: Event) {\n var element = e.target as HTMLInputElement\n var key = element.getAttribute('value-key')\n var value: any = element.value\n\n if (key == 'fitPattern') {\n value = element.checked\n }\n\n this.value = {\n ...this.value,\n [key!]: value\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n}\n"]}
|
|
@@ -4,11 +4,10 @@
|
|
|
4
4
|
import '@operato/i18n/ox-i18n.js';
|
|
5
5
|
import '@operato/input/ox-input-color.js';
|
|
6
6
|
import '@operato/input/ox-input-color-stops.js';
|
|
7
|
-
import '
|
|
7
|
+
import '@operato/input/ox-input-color-gradient.js';
|
|
8
8
|
import './ox-input-background-pattern.js';
|
|
9
9
|
import { BackgroundPatternOption } from './ox-input-background-pattern.js';
|
|
10
|
-
import { ColorStop, OxFormField } from '@operato/input';
|
|
11
|
-
import { GradientOption } from './ox-input-color-gradient.js';
|
|
10
|
+
import { ColorStop, GradientOption, OxFormField } from '@operato/input';
|
|
12
11
|
import { PropertyValues } from 'lit';
|
|
13
12
|
export declare type FillStyle = {
|
|
14
13
|
type?: 'no' | 'solid' | 'gradient' | 'pattern';
|
|
@@ -5,7 +5,7 @@ import { __decorate } from "tslib";
|
|
|
5
5
|
import '@operato/i18n/ox-i18n.js';
|
|
6
6
|
import '@operato/input/ox-input-color.js';
|
|
7
7
|
import '@operato/input/ox-input-color-stops.js';
|
|
8
|
-
import '
|
|
8
|
+
import '@operato/input/ox-input-color-gradient.js';
|
|
9
9
|
import './ox-input-background-pattern.js';
|
|
10
10
|
import { OxFormField } from '@operato/input';
|
|
11
11
|
import { css, html } from 'lit';
|
|
@@ -319,7 +319,7 @@ __decorate([
|
|
|
319
319
|
property({ type: Object })
|
|
320
320
|
], OxInputColorStyle.prototype, "pattern", void 0);
|
|
321
321
|
OxInputColorStyle = __decorate([
|
|
322
|
-
customElement('ox-input-
|
|
322
|
+
customElement('ox-input-fill-style')
|
|
323
323
|
], OxInputColorStyle);
|
|
324
324
|
export { OxInputColorStyle };
|
|
325
325
|
//# sourceMappingURL=ox-input-fill-style.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-input-fill-style.js","sourceRoot":"","sources":["../../../src/input/ox-input-fill-style.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,0BAA0B,CAAA;AACjC,OAAO,kCAAkC,CAAA;AACzC,OAAO,wCAAwC,CAAA;AAC/C,OAAO,8BAA8B,CAAA;AACrC,OAAO,kCAAkC,CAAA;AAGzC,OAAO,EAAa,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEvD,OAAO,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,MAAM,mBAAmB,CAAA;AAqBlE,IAAa,iBAAiB,GAA9B,MAAa,iBAAkB,SAAQ,WAAW;IAAlD;;QAsDU,iBAAY,GAAY,KAAK,CAAA;IA8QvC,CAAC;IA5QC,OAAO,CAAC,OAA6B;QACnC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAA;IAChE,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;qBACM,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;;;;;;qBAMxC,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI;;;2FAG+B,IAAI,CAAC,QAAQ,IAAI,OAAO;;;;;;;qBAO9F,IAAI,CAAC,QAAQ,IAAI,UAAU;;;;;;;;qBAQ3B,IAAI,CAAC,QAAQ,IAAI,SAAS;;;;;;uBAMxB,IAAI,CAAC,QAAQ,IAAI,IAAI;;uCAEL,IAAI,CAAC,QAAQ,IAAI,OAAO;;oCAE3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\nimport '@operato/input/ox-input-color.js'\nimport '@operato/input/ox-input-color-stops.js'\nimport './ox-input-color-gradient.js'\nimport './ox-input-background-pattern.js'\n\nimport { BackgroundPatternOption, OxInputBackgroundPattern } from './ox-input-background-pattern.js'\nimport { ColorStop, OxFormField } from '@operato/input'\nimport { GradientOption, OxInputColorGradient } from './ox-input-color-gradient.js'\nimport { PropertyValues, css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nexport type FillStyle =\n | {\n type?: 'no' | 'solid' | 'gradient' | 'pattern'\n gradientType?: 'linear' | 'radial'\n colorStops?: ColorStop[]\n rotation?: number\n center?: 'center' | 'left-top' | 'right-top' | 'right-bottom' | 'left-bottom'\n image?: HTMLImageElement | string\n offsetX?: number\n offsetY?: number\n width?: number\n height?: number\n align?: 'left-top' | 'top' | 'right-top' | 'left' | 'center' | 'right' | 'left-bottom' | 'bottom' | 'right-bottom'\n fitPattern?: boolean\n }\n | 'no'\n | string\n\n@customElement('ox-input-color-style')\nexport class OxInputColorStyle extends OxFormField {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n }\n\n [fill-type] {\n display: flex;\n margin: 0 0 14px 0;\n }\n\n [fill-type] * {\n flex: auto;\n margin: 0;\n text-align: left;\n align-self: center;\n }\n\n .grid-10 {\n display: grid;\n\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 5px;\n grid-auto-rows: minmax(24px, auto);\n }\n\n .grid-10 > ox-input-color {\n grid-column: span 4;\n }\n\n .grid-10 > .icon-only-label {\n grid-column: span 1;\n\n background: url(/assets/images/icon-properties-label.png) no-repeat;\n float: left;\n margin: 0;\n }\n\n .icon-only-label.color {\n background-position: 70% -498px;\n }\n\n [editors] > :not([active]) {\n display: none;\n }\n `\n\n @property({ type: Object }) value?: FillStyle\n @property({ type: String }) fillType?: string\n @property({ type: String }) solid?: string\n @property({ type: Object }) gradient?: GradientOption\n @property({ type: Object }) pattern?: BackgroundPatternOption\n\n private _block_reset: boolean = false\n\n updated(changes: PropertyValues<this>) {\n changes.has('value') && this._onChangedValue(this.value || {})\n }\n\n render() {\n return html`\n <div @change=${(e: Event) => this._onChangedFillType(e)} fill-type>\n <input\n type=\"radio\"\n id=\"fill-type-no\"\n name=\"fill-type\"\n value=\"no\"\n .checked=${!this.fillType || this.fillType == 'no'}\n />\n <label for=\"fill-type-no\"><ox-i18n msgid=\"label.no-fill\">no fill</ox-i18n></label>\n <input type=\"radio\" id=\"fill-type-solid\" name=\"fill-type\" value=\"solid\" .checked=${this.fillType == 'solid'} />\n <label for=\"fill-type-solid\"><ox-i18n msgid=\"label.solid\">solid</ox-i18n></label>\n <input\n type=\"radio\"\n id=\"fill-type-gradient\"\n name=\"fill-type\"\n value=\"gradient\"\n .checked=${this.fillType == 'gradient'}\n />\n <label for=\"fill-type-gradient\"><ox-i18n msgid=\"label.gradient\">gradient</ox-i18n></label>\n <input\n type=\"radio\"\n id=\"fill-type-pattern\"\n name=\"fill-type\"\n value=\"pattern\"\n .checked=${this.fillType == 'pattern'}\n />\n <label for=\"fill-type-pattern\"><ox-i18n msgid=\"label.pattern\">pattern</ox-i18n></label>\n </div>\n\n <div editors>\n <div ?active=${this.fillType == 'no'}></div>\n\n <div class=\"grid-10\" ?active=${this.fillType == 'solid'}>\n <label class=\"icon-only-label color\"></label>\n <ox-input-color @change=${(e: Event) => this._onChangedSolid(e)} .value=${this.solid}> </ox-input-color>\n </div>\n\n <div ?active=${this.fillType == 'gradient'}>\n <ox-input-color-gradient @change=${(e: Event) => this._onChandedGradient(e)} .value=${this.gradient}>\n </ox-input-color-gradient>\n </div>\n\n <div ?active=${this.fillType == 'pattern'}>\n <ox-input-background-pattern @change=${(e: Event) => this._onChangedPattern(e)} .value=${this.pattern}>\n </ox-input-background-pattern>\n </div>\n </div>\n `\n }\n\n async _onChangedValue(value: FillStyle) {\n /*\n * this._block_reset의 역할은 내부 사용자 인터렉션에 의한 value의 변경시에는 각 type별 이전값을 유지하기 위함이다.\n */\n await this.requestUpdate()\n\n /* 설정 값에 따라서, 멤버 속성을 설정한다. */\n if (!value) {\n this.fillType = 'no'\n\n if (!this._block_reset) {\n this.solid = undefined\n this.gradient = undefined\n this.pattern = undefined\n }\n\n this._block_reset = false\n return\n }\n\n switch (typeof value) {\n case 'string':\n this.fillType = 'solid'\n this.solid = value\n\n if (!this._block_reset) {\n this.gradient = undefined\n this.pattern = undefined\n }\n break\n case 'object':\n this.fillType = value.type\n\n if (value.type === 'gradient') {\n this.gradient = {\n type: value.gradientType || 'linear',\n colorStops: value.colorStops || [\n {\n position: 0,\n color: this.solid || '#000000'\n },\n {\n position: 1,\n color: this.solid || '#FFFFFF'\n }\n ],\n rotation: Number(value.rotation) || 0,\n center: value.center\n }\n\n if (!this._block_reset) {\n this.pattern = undefined\n this.solid = undefined\n }\n } else if (value.type === 'pattern') {\n this.pattern = {\n image: value.image,\n offsetX: Number(value.offsetX) || 0,\n offsetY: Number(value.offsetY) || 0,\n width: Number(value.width),\n height: Number(value.height),\n align: value.align,\n fitPattern: value.fitPattern\n }\n\n if (!this._block_reset) {\n this.gradient = undefined\n this.solid = undefined\n }\n }\n\n break\n default:\n }\n\n this._block_reset = false\n }\n\n _onChangedFillType(e: Event) {\n const element = e.target as HTMLInputElement\n this.fillType = element.value\n\n switch (this.fillType) {\n case 'gradient':\n if (!this.gradient) {\n this.gradient = {\n type: 'linear',\n colorStops: [\n {\n position: 0,\n color: this.solid || '#000000'\n },\n {\n position: 1,\n color: this.solid || '#FFFFFF'\n }\n ],\n rotation: 0,\n center: 'center'\n }\n }\n\n this.value = {\n type: 'gradient',\n gradientType: this.gradient.type || 'linear',\n colorStops: this.gradient.colorStops || [\n {\n position: 0,\n color: this.solid || '#000000'\n },\n {\n position: 1,\n color: this.solid || '#FFFFFF'\n }\n ],\n rotation: Number(this.gradient.rotation) || 0,\n center: this.gradient.center\n }\n break\n\n case 'pattern':\n if (!this.pattern) this.pattern = {}\n\n this.value = {\n type: 'pattern',\n image: this.pattern.image,\n offsetX: Number(this.pattern.offsetX) || 0,\n offsetY: Number(this.pattern.offsetY) || 0,\n width: Number(this.pattern.width),\n height: Number(this.pattern.height),\n align: this.pattern.align,\n fitPattern: this.pattern.fitPattern\n }\n break\n\n case 'solid':\n if (!this.solid) this.solid = '#fff'\n this.value = this.solid\n break\n\n case 'no':\n this.value = ''\n break\n }\n\n this._block_reset = true\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onChangedSolid(e: Event) {\n if (this.fillType !== 'solid') return\n\n this.solid = (e.target as HTMLInputElement).value\n\n this.value = this.solid\n\n this._block_reset = true\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onChandedGradient(e: Event) {\n /*\n * TODO Gradient의 rotation은 symmetry 기능 등으로 외부에서 변경될 수도 있다.\n * 이 점을 감안해서, 외부 변경에 대한 대응을 해야 한다.\n */\n\n if (this.fillType !== 'gradient') {\n return\n }\n\n this.gradient = (e.target as OxInputColorGradient).value\n\n this.value = {\n type: 'gradient',\n gradientType: this.gradient.type || 'linear',\n colorStops: this.gradient.colorStops || [\n {\n position: 0,\n color: this.solid || '#000000'\n },\n {\n position: 1,\n color: this.solid || '#FFFFFF'\n }\n ],\n rotation: Number(this.gradient.rotation) || 0,\n center: this.gradient.center\n }\n\n this._block_reset = true\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onChangedPattern(e: Event) {\n if (this.fillType !== 'pattern') return\n\n this.pattern = (e.target as OxInputBackgroundPattern).value\n\n this.value = {\n type: 'pattern',\n image: this.pattern?.image,\n offsetX: Number(this.pattern?.offsetX) || 0,\n offsetY: Number(this.pattern?.offsetY) || 0,\n width: Number(this.pattern?.width),\n height: Number(this.pattern?.height),\n align: this.pattern?.align,\n fitPattern: this.pattern?.fitPattern\n }\n\n this._block_reset = true\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ox-input-fill-style.js","sourceR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,CAAC,MAAA,IAAI,CAAC,OAAO,0CAAE,KAAK,CAAC;YAClC,MAAM,EAAE,MAAM,CAAC,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,CAAC;YACpC,KAAK,EAAE,MAAA,IAAI,CAAC,OAAO,0CAAE,KAAK;YAC1B,UAAU,EAAE,MAAA,IAAI,CAAC,OAAO,0CAAE,UAAU;SACrC,CAAA;QAED,IAAI,CAAC,YAAY,GAAG,IAAI,CAAA;QACxB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IAClF,CAAC;CACF,CAAA;AAnUQ,wBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6ClB,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAA0B;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAkC;AApDlD,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CAoU7B;SApUY,iBAAiB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@operato/i18n/ox-i18n.js'\nimport '@operato/input/ox-input-color.js'\nimport '@operato/input/ox-input-color-stops.js'\nimport '@operato/input/ox-input-color-gradient.js'\nimport './ox-input-background-pattern.js'\n\nimport { BackgroundPatternOption, OxInputBackgroundPattern } from './ox-input-background-pattern.js'\nimport { ColorStop, GradientOption, OxFormField, OxInputColorGradient } from '@operato/input'\nimport { PropertyValues, css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nexport type FillStyle =\n | {\n type?: 'no' | 'solid' | 'gradient' | 'pattern'\n gradientType?: 'linear' | 'radial'\n colorStops?: ColorStop[]\n rotation?: number\n center?: 'center' | 'left-top' | 'right-top' | 'right-bottom' | 'left-bottom'\n image?: HTMLImageElement | string\n offsetX?: number\n offsetY?: number\n width?: number\n height?: number\n align?: 'left-top' | 'top' | 'right-top' | 'left' | 'center' | 'right' | 'left-bottom' | 'bottom' | 'right-bottom'\n fitPattern?: boolean\n }\n | 'no'\n | string\n\n@customElement('ox-input-fill-style')\nexport class OxInputColorStyle extends OxFormField {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n }\n\n [fill-type] {\n display: flex;\n margin: 0 0 14px 0;\n }\n\n [fill-type] * {\n flex: auto;\n margin: 0;\n text-align: left;\n align-self: center;\n }\n\n .grid-10 {\n display: grid;\n\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 5px;\n grid-auto-rows: minmax(24px, auto);\n }\n\n .grid-10 > ox-input-color {\n grid-column: span 4;\n }\n\n .grid-10 > .icon-only-label {\n grid-column: span 1;\n\n background: url(/assets/images/icon-properties-label.png) no-repeat;\n float: left;\n margin: 0;\n }\n\n .icon-only-label.color {\n background-position: 70% -498px;\n }\n\n [editors] > :not([active]) {\n display: none;\n }\n `\n\n @property({ type: Object }) value?: FillStyle\n @property({ type: String }) fillType?: string\n @property({ type: String }) solid?: string\n @property({ type: Object }) gradient?: GradientOption\n @property({ type: Object }) pattern?: BackgroundPatternOption\n\n private _block_reset: boolean = false\n\n updated(changes: PropertyValues<this>) {\n changes.has('value') && this._onChangedValue(this.value || {})\n }\n\n render() {\n return html`\n <div @change=${(e: Event) => this._onChangedFillType(e)} fill-type>\n <input\n type=\"radio\"\n id=\"fill-type-no\"\n name=\"fill-type\"\n value=\"no\"\n .checked=${!this.fillType || this.fillType == 'no'}\n />\n <label for=\"fill-type-no\"><ox-i18n msgid=\"label.no-fill\">no fill</ox-i18n></label>\n <input type=\"radio\" id=\"fill-type-solid\" name=\"fill-type\" value=\"solid\" .checked=${this.fillType == 'solid'} />\n <label for=\"fill-type-solid\"><ox-i18n msgid=\"label.solid\">solid</ox-i18n></label>\n <input\n type=\"radio\"\n id=\"fill-type-gradient\"\n name=\"fill-type\"\n value=\"gradient\"\n .checked=${this.fillType == 'gradient'}\n />\n <label for=\"fill-type-gradient\"><ox-i18n msgid=\"label.gradient\">gradient</ox-i18n></label>\n <input\n type=\"radio\"\n id=\"fill-type-pattern\"\n name=\"fill-type\"\n value=\"pattern\"\n .checked=${this.fillType == 'pattern'}\n />\n <label for=\"fill-type-pattern\"><ox-i18n msgid=\"label.pattern\">pattern</ox-i18n></label>\n </div>\n\n <div editors>\n <div ?active=${this.fillType == 'no'}></div>\n\n <div class=\"grid-10\" ?active=${this.fillType == 'solid'}>\n <label class=\"icon-only-label color\"></label>\n <ox-input-color @change=${(e: Event) => this._onChangedSolid(e)} .value=${this.solid}> </ox-input-color>\n </div>\n\n <div ?active=${this.fillType == 'gradient'}>\n <ox-input-color-gradient @change=${(e: Event) => this._onChandedGradient(e)} .value=${this.gradient}>\n </ox-input-color-gradient>\n </div>\n\n <div ?active=${this.fillType == 'pattern'}>\n <ox-input-background-pattern @change=${(e: Event) => this._onChangedPattern(e)} .value=${this.pattern}>\n </ox-input-background-pattern>\n </div>\n </div>\n `\n }\n\n async _onChangedValue(value: FillStyle) {\n /*\n * this._block_reset의 역할은 내부 사용자 인터렉션에 의한 value의 변경시에는 각 type별 이전값을 유지하기 위함이다.\n */\n await this.requestUpdate()\n\n /* 설정 값에 따라서, 멤버 속성을 설정한다. */\n if (!value) {\n this.fillType = 'no'\n\n if (!this._block_reset) {\n this.solid = undefined\n this.gradient = undefined\n this.pattern = undefined\n }\n\n this._block_reset = false\n return\n }\n\n switch (typeof value) {\n case 'string':\n this.fillType = 'solid'\n this.solid = value\n\n if (!this._block_reset) {\n this.gradient = undefined\n this.pattern = undefined\n }\n break\n case 'object':\n this.fillType = value.type\n\n if (value.type === 'gradient') {\n this.gradient = {\n type: value.gradientType || 'linear',\n colorStops: value.colorStops || [\n {\n position: 0,\n color: this.solid || '#000000'\n },\n {\n position: 1,\n color: this.solid || '#FFFFFF'\n }\n ],\n rotation: Number(value.rotation) || 0,\n center: value.center\n }\n\n if (!this._block_reset) {\n this.pattern = undefined\n this.solid = undefined\n }\n } else if (value.type === 'pattern') {\n this.pattern = {\n image: value.image,\n offsetX: Number(value.offsetX) || 0,\n offsetY: Number(value.offsetY) || 0,\n width: Number(value.width),\n height: Number(value.height),\n align: value.align,\n fitPattern: value.fitPattern\n }\n\n if (!this._block_reset) {\n this.gradient = undefined\n this.solid = undefined\n }\n }\n\n break\n default:\n }\n\n this._block_reset = false\n }\n\n _onChangedFillType(e: Event) {\n const element = e.target as HTMLInputElement\n this.fillType = element.value\n\n switch (this.fillType) {\n case 'gradient':\n if (!this.gradient) {\n this.gradient = {\n type: 'linear',\n colorStops: [\n {\n position: 0,\n color: this.solid || '#000000'\n },\n {\n position: 1,\n color: this.solid || '#FFFFFF'\n }\n ],\n rotation: 0,\n center: 'center'\n }\n }\n\n this.value = {\n type: 'gradient',\n gradientType: this.gradient.type || 'linear',\n colorStops: this.gradient.colorStops || [\n {\n position: 0,\n color: this.solid || '#000000'\n },\n {\n position: 1,\n color: this.solid || '#FFFFFF'\n }\n ],\n rotation: Number(this.gradient.rotation) || 0,\n center: this.gradient.center\n }\n break\n\n case 'pattern':\n if (!this.pattern) this.pattern = {}\n\n this.value = {\n type: 'pattern',\n image: this.pattern.image,\n offsetX: Number(this.pattern.offsetX) || 0,\n offsetY: Number(this.pattern.offsetY) || 0,\n width: Number(this.pattern.width),\n height: Number(this.pattern.height),\n align: this.pattern.align,\n fitPattern: this.pattern.fitPattern\n }\n break\n\n case 'solid':\n if (!this.solid) this.solid = '#fff'\n this.value = this.solid\n break\n\n case 'no':\n this.value = ''\n break\n }\n\n this._block_reset = true\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onChangedSolid(e: Event) {\n if (this.fillType !== 'solid') return\n\n this.solid = (e.target as HTMLInputElement).value\n\n this.value = this.solid\n\n this._block_reset = true\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onChandedGradient(e: Event) {\n /*\n * TODO Gradient의 rotation은 symmetry 기능 등으로 외부에서 변경될 수도 있다.\n * 이 점을 감안해서, 외부 변경에 대한 대응을 해야 한다.\n */\n\n if (this.fillType !== 'gradient') {\n return\n }\n\n this.gradient = (e.target as OxInputColorGradient).value\n\n this.value = {\n type: 'gradient',\n gradientType: this.gradient.type || 'linear',\n colorStops: this.gradient.colorStops || [\n {\n position: 0,\n color: this.solid || '#000000'\n },\n {\n position: 1,\n color: this.solid || '#FFFFFF'\n }\n ],\n rotation: Number(this.gradient.rotation) || 0,\n center: this.gradient.center\n }\n\n this._block_reset = true\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onChangedPattern(e: Event) {\n if (this.fillType !== 'pattern') return\n\n this.pattern = (e.target as OxInputBackgroundPattern).value\n\n this.value = {\n type: 'pattern',\n image: this.pattern?.image,\n offsetX: Number(this.pattern?.offsetX) || 0,\n offsetY: Number(this.pattern?.offsetY) || 0,\n width: Number(this.pattern?.width),\n height: Number(this.pattern?.height),\n align: this.pattern?.align,\n fitPattern: this.pattern?.fitPattern\n }\n\n this._block_reset = true\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n}\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import 'codemirror/addon/display/fullscreen';
|
|
5
|
+
import 'codemirror/addon/display/autorefresh';
|
|
6
|
+
import 'codemirror/addon/hint/show-hint';
|
|
7
|
+
import 'codemirror/addon/lint/lint';
|
|
8
|
+
import 'codemirror-graphql/hint';
|
|
9
|
+
import 'codemirror-graphql/lint';
|
|
10
|
+
import 'codemirror-graphql/mode';
|
|
11
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
12
|
+
import CodeMirror from 'codemirror';
|
|
13
|
+
/**
|
|
14
|
+
WEB Component for code-mirror graphql editor.
|
|
15
|
+
|
|
16
|
+
Example:
|
|
17
|
+
|
|
18
|
+
<ox-input-graphql value=${text} link=${link}>
|
|
19
|
+
</ox-input-graphql>
|
|
20
|
+
*/
|
|
21
|
+
export default class OxInputGraphql extends LitElement {
|
|
22
|
+
static styles: import("lit").CSSResult[];
|
|
23
|
+
/**
|
|
24
|
+
* `value`는 에디터에서 작성중인 contents이다.
|
|
25
|
+
*/
|
|
26
|
+
value?: string;
|
|
27
|
+
link?: string;
|
|
28
|
+
textarea: HTMLTextAreaElement;
|
|
29
|
+
private _self_changing;
|
|
30
|
+
private _changed;
|
|
31
|
+
private _editor?;
|
|
32
|
+
updated(changes: PropertyValues<this>): Promise<void>;
|
|
33
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
34
|
+
getSchema(): Promise<import("graphql").GraphQLSchema>;
|
|
35
|
+
getEditor(): Promise<CodeMirror.EditorFromTextArea | undefined>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { __decorate } from "tslib";
|
|
5
|
+
import 'codemirror/addon/display/fullscreen';
|
|
6
|
+
import 'codemirror/addon/display/autorefresh';
|
|
7
|
+
import 'codemirror/addon/hint/show-hint';
|
|
8
|
+
import 'codemirror/addon/lint/lint';
|
|
9
|
+
import 'codemirror-graphql/hint';
|
|
10
|
+
import 'codemirror-graphql/lint';
|
|
11
|
+
import 'codemirror-graphql/mode';
|
|
12
|
+
import { GRAPHQL_URI } from '@operato/graphql';
|
|
13
|
+
import { LitElement, css, html, unsafeCSS } from 'lit';
|
|
14
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
15
|
+
import { introspectSchema, wrapSchema } from '@graphql-tools/wrap';
|
|
16
|
+
import CodeMirror from 'codemirror';
|
|
17
|
+
import CodeMirrorStyle from '!!text-loader!codemirror/lib/codemirror.css';
|
|
18
|
+
import FullScreenStyle from '!!text-loader!codemirror/addon/display/fullscreen.css';
|
|
19
|
+
import LintStyle from '!!text-loader!codemirror/addon/lint/lint.css';
|
|
20
|
+
import NightThemeStyle from '!!text-loader!codemirror/theme/night.css';
|
|
21
|
+
import ShowHintStyle from '!!text-loader!codemirror/addon/hint/show-hint.css';
|
|
22
|
+
import { fetch } from 'cross-fetch';
|
|
23
|
+
import { print } from 'graphql';
|
|
24
|
+
/**
|
|
25
|
+
WEB Component for code-mirror graphql editor.
|
|
26
|
+
|
|
27
|
+
Example:
|
|
28
|
+
|
|
29
|
+
<ox-input-graphql value=${text} link=${link}>
|
|
30
|
+
</ox-input-graphql>
|
|
31
|
+
*/
|
|
32
|
+
let OxInputGraphql = class OxInputGraphql extends LitElement {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments);
|
|
35
|
+
this._self_changing = false;
|
|
36
|
+
this._changed = false;
|
|
37
|
+
}
|
|
38
|
+
async updated(changes) {
|
|
39
|
+
if ((!this._editor || changes.has('value') || changes.has('link')) && !this._self_changing) {
|
|
40
|
+
if (changes.has('link')) {
|
|
41
|
+
this._editor = undefined;
|
|
42
|
+
}
|
|
43
|
+
;
|
|
44
|
+
(await this.getEditor()).setValue(this.value === undefined ? '' : String(this.value));
|
|
45
|
+
// ;(await this.getEditor()).refresh()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
render() {
|
|
49
|
+
return html ` <textarea></textarea> `;
|
|
50
|
+
}
|
|
51
|
+
async getSchema() {
|
|
52
|
+
const executor = async ({ document, variables }) => {
|
|
53
|
+
const query = print(document);
|
|
54
|
+
const uri = this.link || GRAPHQL_URI;
|
|
55
|
+
const fetchResult = await fetch(uri, {
|
|
56
|
+
method: 'POST',
|
|
57
|
+
headers: {
|
|
58
|
+
'Content-Type': 'application/json'
|
|
59
|
+
},
|
|
60
|
+
body: JSON.stringify({ query, variables })
|
|
61
|
+
});
|
|
62
|
+
return fetchResult.json();
|
|
63
|
+
};
|
|
64
|
+
return await wrapSchema({
|
|
65
|
+
schema: await introspectSchema(executor),
|
|
66
|
+
executor
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async getEditor() {
|
|
70
|
+
if (!this._editor) {
|
|
71
|
+
try {
|
|
72
|
+
var schema = await this.getSchema();
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
console.error(err);
|
|
76
|
+
}
|
|
77
|
+
if (this.textarea) {
|
|
78
|
+
this._editor = CodeMirror.fromTextArea(this.textarea, {
|
|
79
|
+
value: this.value,
|
|
80
|
+
mode: 'graphql',
|
|
81
|
+
lint: {
|
|
82
|
+
//@ts-ignore
|
|
83
|
+
schema
|
|
84
|
+
},
|
|
85
|
+
hintOptions: {
|
|
86
|
+
//@ts-ignore
|
|
87
|
+
schema
|
|
88
|
+
},
|
|
89
|
+
tabSize: 2,
|
|
90
|
+
lineNumbers: false,
|
|
91
|
+
showCursorWhenSelecting: true,
|
|
92
|
+
theme: 'night',
|
|
93
|
+
extraKeys: {
|
|
94
|
+
F11: function (cm) {
|
|
95
|
+
cm.setOption('fullScreen', !cm.getOption('fullScreen'));
|
|
96
|
+
},
|
|
97
|
+
Esc: function (cm) {
|
|
98
|
+
cm.setOption('fullScreen', !cm.getOption('fullScreen'));
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
autoRefresh: {
|
|
102
|
+
delay: 500
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
this._editor.on('blur', (editor, e) => {
|
|
106
|
+
if (!this._changed)
|
|
107
|
+
return;
|
|
108
|
+
this.value = editor.getValue();
|
|
109
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));
|
|
110
|
+
});
|
|
111
|
+
this._editor.on('change', async (editor, changeObj) => {
|
|
112
|
+
this._self_changing = true;
|
|
113
|
+
this._changed = true;
|
|
114
|
+
await this.requestUpdate();
|
|
115
|
+
this._self_changing = false;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return this._editor;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
OxInputGraphql.styles = [
|
|
123
|
+
css `
|
|
124
|
+
${unsafeCSS(CodeMirrorStyle)}
|
|
125
|
+
${unsafeCSS(FullScreenStyle)}
|
|
126
|
+
${unsafeCSS(NightThemeStyle)}
|
|
127
|
+
${unsafeCSS(LintStyle)}
|
|
128
|
+
${unsafeCSS(ShowHintStyle)}
|
|
129
|
+
`,
|
|
130
|
+
css `
|
|
131
|
+
:host {
|
|
132
|
+
display: block;
|
|
133
|
+
position: relative;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
textarea {
|
|
137
|
+
display: block;
|
|
138
|
+
height: 100%;
|
|
139
|
+
width: 100%;
|
|
140
|
+
resize: none;
|
|
141
|
+
font-size: 16px;
|
|
142
|
+
line-height: 20px;
|
|
143
|
+
border: 0px;
|
|
144
|
+
padding: 0px;
|
|
145
|
+
}
|
|
146
|
+
`
|
|
147
|
+
];
|
|
148
|
+
__decorate([
|
|
149
|
+
property({ type: String })
|
|
150
|
+
], OxInputGraphql.prototype, "value", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
property({ type: String })
|
|
153
|
+
], OxInputGraphql.prototype, "link", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
query('textarea')
|
|
156
|
+
], OxInputGraphql.prototype, "textarea", void 0);
|
|
157
|
+
OxInputGraphql = __decorate([
|
|
158
|
+
customElement('ox-input-graphql')
|
|
159
|
+
], OxInputGraphql);
|
|
160
|
+
export default OxInputGraphql;
|
|
161
|
+
//# sourceMappingURL=ox-input-graphql.js.map
|
|
@@ -0,0 +1 @@
|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K,EAAE,MAAyB,EAAE,SAAkC,EAAE,EAAE;oBAChG,IAAI,CAAC,cAAc,GAAG,IAAI,CAAA;oBAE1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;oBAEpB,MAAM,IAAI,CAAC,aAAa,EAAE,CAAA;oBAE1B,IAAI,CAAC,cAAc,GAAG,KAAK,CAAA;gBAC7B,CAAC,CAAC,CAAA;aACH;SACF;QAED,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;CACF,CAAA;AApIQ,qBAAM,GAAG;IACd,GAAG,CAAA;QACC,SAAS,CAAC,eAAe,CAAC;QAC1B,SAAS,CAAC,eAAe,CAAC;WACvB,SAAS,CAAC,eAAe,CAAC;WAC1B,SAAS,CAAC,SAAS,CAAC;WACpB,SAAS,CAAC,aAAa,CAAC;KAC9B;IACD,GAAG,CAAA;;;;;;;;;;;;;;;;KAgBF;CACF,CAAA;AAK2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAc;AAEtB;IAAlB,KAAK,CAAC,UAAU,CAAC;gDAA+B;AAlC9B,cAAc;IADlC,aAAa,CAAC,kBAAkB,CAAC;GACb,cAAc,CAqIlC;eArIoB,cAAc","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport 'codemirror/addon/display/fullscreen'\nimport 'codemirror/addon/display/autorefresh'\nimport 'codemirror/addon/hint/show-hint'\nimport 'codemirror/addon/lint/lint'\nimport 'codemirror-graphql/hint'\nimport 'codemirror-graphql/lint'\nimport 'codemirror-graphql/mode'\n\nimport { GRAPHQL_URI, client } from '@operato/graphql'\nimport { LitElement, PropertyValues, css, html, unsafeCSS } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { introspectSchema, wrapSchema } from '@graphql-tools/wrap'\n\nimport CodeMirror from 'codemirror'\nimport CodeMirrorStyle from '!!text-loader!codemirror/lib/codemirror.css'\nimport FullScreenStyle from '!!text-loader!codemirror/addon/display/fullscreen.css'\nimport LintStyle from '!!text-loader!codemirror/addon/lint/lint.css'\nimport NightThemeStyle from '!!text-loader!codemirror/theme/night.css'\nimport ShowHintStyle from '!!text-loader!codemirror/addon/hint/show-hint.css'\nimport { fetch } from 'cross-fetch'\nimport { print } from 'graphql'\n\n/**\n WEB Component for code-mirror graphql editor.\n \n Example:\n \n <ox-input-graphql value=${text} link=${link}>\n </ox-input-graphql>\n */\n@customElement('ox-input-graphql')\nexport default class OxInputGraphql extends LitElement {\n static styles = [\n css`\n ${unsafeCSS(CodeMirrorStyle)}\n ${unsafeCSS(FullScreenStyle)}\n ${unsafeCSS(NightThemeStyle)}\n ${unsafeCSS(LintStyle)}\n ${unsafeCSS(ShowHintStyle)}\n `,\n css`\n :host {\n display: block;\n position: relative;\n }\n\n textarea {\n display: block;\n height: 100%;\n width: 100%;\n resize: none;\n font-size: 16px;\n line-height: 20px;\n border: 0px;\n padding: 0px;\n }\n `\n ]\n\n /**\n * `value`는 에디터에서 작성중인 contents이다.\n */\n @property({ type: String }) value?: string\n @property({ type: String }) link?: string\n\n @query('textarea') textarea!: HTMLTextAreaElement\n\n private _self_changing: boolean = false\n private _changed: boolean = false\n private _editor?: CodeMirror.EditorFromTextArea\n\n async updated(changes: PropertyValues<this>) {\n if ((!this._editor || changes.has('value') || changes.has('link')) && !this._self_changing) {\n if (changes.has('link')) {\n this._editor = undefined\n }\n ;(await this.getEditor())!.setValue(this.value === undefined ? '' : String(this.value))\n // ;(await this.getEditor()).refresh()\n }\n }\n\n render() {\n return html` <textarea></textarea> `\n }\n\n async getSchema() {\n const executor = async ({ document, variables }: any) => {\n const query = print(document)\n const uri = this.link || GRAPHQL_URI\n\n const fetchResult = await fetch(uri, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({ query, variables })\n })\n return fetchResult.json()\n }\n\n return await wrapSchema({\n schema: await introspectSchema(executor),\n executor\n })\n }\n\n async getEditor() {\n if (!this._editor) {\n try {\n var schema = await this.getSchema()\n } catch (err) {\n console.error(err)\n }\n\n if (this.textarea) {\n this._editor = CodeMirror.fromTextArea(this.textarea, {\n value: this.value,\n mode: 'graphql',\n lint: {\n //@ts-ignore\n schema\n },\n hintOptions: {\n //@ts-ignore\n schema\n },\n tabSize: 2,\n lineNumbers: false,\n showCursorWhenSelecting: true,\n theme: 'night',\n extraKeys: {\n F11: function (cm) {\n cm.setOption('fullScreen', !cm.getOption('fullScreen'))\n },\n Esc: function (cm) {\n cm.setOption('fullScreen', !cm.getOption('fullScreen'))\n }\n },\n autoRefresh: {\n delay: 500\n }\n })\n\n this._editor.on('blur', (editor: CodeMirror.Editor, e: FocusEvent) => {\n if (!this._changed) return\n\n this.value = editor.getValue()\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n })\n\n this._editor.on('change', async (editor: CodeMirror.Editor, changeObj: CodeMirror.EditorChange) => {\n this._self_changing = true\n\n this._changed = true\n\n await this.requestUpdate()\n\n this._self_changing = false\n })\n }\n }\n\n return this._editor\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import '@operato/property-editor/ox-property-editor-legend.js';
|
|
2
|
+
import '@operato/property-editor/ox-property-editor-number.js';
|
|
3
|
+
import '@operato/property-editor/ox-property-editor-password.js';
|
|
4
|
+
import '@operato/property-editor/ox-property-editor-angle.js';
|
|
5
|
+
import '@operato/property-editor/ox-property-editor-string.js';
|
|
6
|
+
import '@operato/property-editor/ox-property-editor-data.js';
|
|
7
|
+
import '@operato/property-editor/ox-property-editor-date.js';
|
|
8
|
+
import '@operato/property-editor/ox-property-editor-checkbox.js';
|
|
9
|
+
import '@operato/property-editor/ox-property-editor-options.js';
|
|
10
|
+
import '@operato/property-editor/ox-property-editor-select.js';
|
|
11
|
+
import '@operato/property-editor/ox-property-editor-scene-component-id.js';
|
|
12
|
+
import '@operato/property-editor/ox-property-editor-color.js';
|
|
13
|
+
import '@operato/property-editor/ox-property-editor-multiple-colors.js';
|
|
14
|
+
import '@operato/property-editor/ox-property-editor-solid-colorstops.js';
|
|
15
|
+
import '@operato/property-editor/ox-property-editor-gradient-colorstops.js';
|
|
16
|
+
import '@operato/property-editor/ox-property-editor-gradient-colorstops.js';
|
|
17
|
+
import '@operato/property-editor/ox-property-editor-textarea.js';
|
|
18
|
+
import '@operato/property-editor/ox-property-editor-table.js';
|
|
19
|
+
import '@operato/property-editor/ox-property-editor-value-map.js';
|
|
20
|
+
import '@operato/property-editor/ox-property-editor-value-ranges.js';
|
|
21
|
+
import '@operato/attachment/ox-property-editor-attachment-selector.js';
|
|
22
|
+
import '@operato/attachment/ox-property-editor-image-selector.js';
|
|
23
|
+
import '@operato/font/ox-property-editor-font-selector.js';
|
|
24
|
+
import './ox-property-editor-graphql.js';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import '@operato/property-editor/ox-property-editor-legend.js';
|
|
2
|
+
import '@operato/property-editor/ox-property-editor-number.js';
|
|
3
|
+
import '@operato/property-editor/ox-property-editor-password.js';
|
|
4
|
+
import '@operato/property-editor/ox-property-editor-angle.js';
|
|
5
|
+
import '@operato/property-editor/ox-property-editor-string.js';
|
|
6
|
+
import '@operato/property-editor/ox-property-editor-data.js';
|
|
7
|
+
import '@operato/property-editor/ox-property-editor-date.js';
|
|
8
|
+
import '@operato/property-editor/ox-property-editor-checkbox.js';
|
|
9
|
+
import '@operato/property-editor/ox-property-editor-options.js';
|
|
10
|
+
import '@operato/property-editor/ox-property-editor-select.js';
|
|
11
|
+
import '@operato/property-editor/ox-property-editor-scene-component-id.js';
|
|
12
|
+
import '@operato/property-editor/ox-property-editor-color.js';
|
|
13
|
+
import '@operato/property-editor/ox-property-editor-multiple-colors.js';
|
|
14
|
+
import '@operato/property-editor/ox-property-editor-solid-colorstops.js';
|
|
15
|
+
import '@operato/property-editor/ox-property-editor-gradient-colorstops.js';
|
|
16
|
+
import '@operato/property-editor/ox-property-editor-gradient-colorstops.js';
|
|
17
|
+
import '@operato/property-editor/ox-property-editor-textarea.js';
|
|
18
|
+
import '@operato/property-editor/ox-property-editor-table.js';
|
|
19
|
+
import '@operato/property-editor/ox-property-editor-value-map.js';
|
|
20
|
+
import '@operato/property-editor/ox-property-editor-value-ranges.js';
|
|
21
|
+
import '@operato/attachment/ox-property-editor-attachment-selector.js';
|
|
22
|
+
import '@operato/attachment/ox-property-editor-image-selector.js';
|
|
23
|
+
import '@operato/font/ox-property-editor-font-selector.js';
|
|
24
|
+
import './ox-property-editor-graphql.js';
|
|
25
|
+
import { OxPropertyEditor } from '@operato/property-editor';
|
|
26
|
+
OxPropertyEditor.register({
|
|
27
|
+
legend: 'ox-property-editor-legend',
|
|
28
|
+
number: 'ox-property-editor-number',
|
|
29
|
+
slider: 'ox-property-editor-range',
|
|
30
|
+
password: 'ox-property-editor-password',
|
|
31
|
+
angle: 'ox-property-editor-angle',
|
|
32
|
+
string: 'ox-property-editor-string',
|
|
33
|
+
textarea: 'ox-property-editor-textarea',
|
|
34
|
+
javascript: 'ox-property-editor-textarea',
|
|
35
|
+
checkbox: 'ox-property-editor-checkbox',
|
|
36
|
+
boolean: 'ox-property-editor-checkbox',
|
|
37
|
+
select: 'ox-property-editor-select',
|
|
38
|
+
date: 'ox-property-editor-date',
|
|
39
|
+
options: 'ox-property-editor-options',
|
|
40
|
+
data: 'ox-property-editor-data',
|
|
41
|
+
file: 'ox-property-editor-file',
|
|
42
|
+
image: 'ox-property-editor-image',
|
|
43
|
+
'range-input': 'ox-property-editor-range',
|
|
44
|
+
'attachment-selector': 'ox-property-editor-attachment-selector',
|
|
45
|
+
'gltf-selector': 'ox-property-editor-attachment-selector',
|
|
46
|
+
'image-selector': 'ox-property-editor-image-selector',
|
|
47
|
+
color: 'ox-property-editor-color',
|
|
48
|
+
'solid-color-stops': 'ox-property-editor-solid-colorstops',
|
|
49
|
+
'gradient-color-stops': 'ox-property-editor-gradient-colorstops',
|
|
50
|
+
'multiple-color': 'ox-property-editor-multiple-colors',
|
|
51
|
+
map: 'ox-property-editor-value-map',
|
|
52
|
+
range: 'ox-property-editor-value-ranges',
|
|
53
|
+
graphql: 'ox-property-editor-graphql',
|
|
54
|
+
'editor-table': 'ox-property-editor-table',
|
|
55
|
+
'id-input': 'ox-property-editor-scene-component-id',
|
|
56
|
+
'font-selector': 'ox-property-editor-font-selector'
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/property-editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,uDAAuD,CAAA;AAC9D,OAAO,uDAAuD,CAAA;AAC9D,OAAO,yDAAyD,CAAA;AAChE,OAAO,sDAAsD,CAAA;AAC7D,OAAO,uDAAuD,CAAA;AAC9D,OAAO,qDAAqD,CAAA;AAC5D,OAAO,qDAAqD,CAAA;AAC5D,OAAO,yDAAyD,CAAA;AAChE,OAAO,wDAAwD,CAAA;AAC/D,OAAO,uDAAuD,CAAA;AAC9D,OAAO,mEAAmE,CAAA;AAC1E,OAAO,sDAAsD,CAAA;AAC7D,OAAO,gEAAgE,CAAA;AACvE,OAAO,iEAAiE,CAAA;AACxE,OAAO,oEAAoE,CAAA;AAC3E,OAAO,oEAAoE,CAAA;AAC3E,OAAO,yDAAyD,CAAA;AAChE,OAAO,sDAAsD,CAAA;AAC7D,OAAO,0DAA0D,CAAA;AACjE,OAAO,6DAA6D,CAAA;AACpE,OAAO,+DAA+D,CAAA;AACtE,OAAO,0DAA0D,CAAA;AACjE,OAAO,mDAAmD,CAAA;AAC1D,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAE3D,gBAAgB,CAAC,QAAQ,CAAC;IACxB,MAAM,EAAE,2BAA2B;IACnC,MAAM,EAAE,2BAA2B;IACnC,MAAM,EAAE,0BAA0B;IAClC,QAAQ,EAAE,6BAA6B;IACvC,KAAK,EAAE,0BAA0B;IACjC,MAAM,EAAE,2BAA2B;IACnC,QAAQ,EAAE,6BAA6B;IACvC,UAAU,EAAE,6BAA6B;IACzC,QAAQ,EAAE,6BAA6B;IACvC,OAAO,EAAE,6BAA6B;IACtC,MAAM,EAAE,2BAA2B;IACnC,IAAI,EAAE,yBAAyB;IAC/B,OAAO,EAAE,4BAA4B;IACrC,IAAI,EAAE,yBAAyB;IAC/B,IAAI,EAAE,yBAAyB;IAC/B,KAAK,EAAE,0BAA0B;IACjC,aAAa,EAAE,0BAA0B;IACzC,qBAAqB,EAAE,wCAAwC;IAC/D,eAAe,EAAE,wCAAwC;IACzD,gBAAgB,EAAE,mCAAmC;IACrD,KAAK,EAAE,0BAA0B;IACjC,mBAAmB,EAAE,qCAAqC;IAC1D,sBAAsB,EAAE,wCAAwC;IAChE,gBAAgB,EAAE,oCAAoC;IACtD,GAAG,EAAE,8BAA8B;IACnC,KAAK,EAAE,iCAAiC;IACxC,OAAO,EAAE,4BAA4B;IACrC,cAAc,EAAE,0BAA0B;IAC1C,UAAU,EAAE,uCAAuC;IACnD,eAAe,EAAE,kCAAkC;CACpD,CAAC,CAAA","sourcesContent":["import '@operato/property-editor/ox-property-editor-legend.js'\nimport '@operato/property-editor/ox-property-editor-number.js'\nimport '@operato/property-editor/ox-property-editor-password.js'\nimport '@operato/property-editor/ox-property-editor-angle.js'\nimport '@operato/property-editor/ox-property-editor-string.js'\nimport '@operato/property-editor/ox-property-editor-data.js'\nimport '@operato/property-editor/ox-property-editor-date.js'\nimport '@operato/property-editor/ox-property-editor-checkbox.js'\nimport '@operato/property-editor/ox-property-editor-options.js'\nimport '@operato/property-editor/ox-property-editor-select.js'\nimport '@operato/property-editor/ox-property-editor-scene-component-id.js'\nimport '@operato/property-editor/ox-property-editor-color.js'\nimport '@operato/property-editor/ox-property-editor-multiple-colors.js'\nimport '@operato/property-editor/ox-property-editor-solid-colorstops.js'\nimport '@operato/property-editor/ox-property-editor-gradient-colorstops.js'\nimport '@operato/property-editor/ox-property-editor-gradient-colorstops.js'\nimport '@operato/property-editor/ox-property-editor-textarea.js'\nimport '@operato/property-editor/ox-property-editor-table.js'\nimport '@operato/property-editor/ox-property-editor-value-map.js'\nimport '@operato/property-editor/ox-property-editor-value-ranges.js'\nimport '@operato/attachment/ox-property-editor-attachment-selector.js'\nimport '@operato/attachment/ox-property-editor-image-selector.js'\nimport '@operato/font/ox-property-editor-font-selector.js'\nimport './ox-property-editor-graphql.js'\n\nimport { OxPropertyEditor } from '@operato/property-editor'\n\nOxPropertyEditor.register({\n legend: 'ox-property-editor-legend',\n number: 'ox-property-editor-number',\n slider: 'ox-property-editor-range',\n password: 'ox-property-editor-password',\n angle: 'ox-property-editor-angle',\n string: 'ox-property-editor-string',\n textarea: 'ox-property-editor-textarea',\n javascript: 'ox-property-editor-textarea',\n checkbox: 'ox-property-editor-checkbox',\n boolean: 'ox-property-editor-checkbox',\n select: 'ox-property-editor-select',\n date: 'ox-property-editor-date',\n options: 'ox-property-editor-options',\n data: 'ox-property-editor-data',\n file: 'ox-property-editor-file',\n image: 'ox-property-editor-image',\n 'range-input': 'ox-property-editor-range',\n 'attachment-selector': 'ox-property-editor-attachment-selector',\n 'gltf-selector': 'ox-property-editor-attachment-selector',\n 'image-selector': 'ox-property-editor-image-selector',\n color: 'ox-property-editor-color',\n 'solid-color-stops': 'ox-property-editor-solid-colorstops',\n 'gradient-color-stops': 'ox-property-editor-gradient-colorstops',\n 'multiple-color': 'ox-property-editor-multiple-colors',\n map: 'ox-property-editor-value-map',\n range: 'ox-property-editor-value-ranges',\n graphql: 'ox-property-editor-graphql',\n 'editor-table': 'ox-property-editor-table',\n 'id-input': 'ox-property-editor-scene-component-id',\n 'font-selector': 'ox-property-editor-font-selector'\n})\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import '../input/ox-input-graphql.js';
|
|
3
|
+
import { OxPropertyEditor } from '@operato/property-editor';
|
|
4
|
+
import { customElement } from 'lit/decorators.js';
|
|
5
|
+
import { html } from 'lit';
|
|
6
|
+
let OxPropertyEditorGraphQL = class OxPropertyEditorGraphQL extends OxPropertyEditor {
|
|
7
|
+
editorTemplate() {
|
|
8
|
+
return html ` <ox-input-graphql id="editor" .value=${this.value} fullwidth> </ox-input-graphql> `;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
OxPropertyEditorGraphQL = __decorate([
|
|
12
|
+
customElement('ox-property-editor-graphql')
|
|
13
|
+
], OxPropertyEditorGraphQL);
|
|
14
|
+
export { OxPropertyEditorGraphQL };
|
|
15
|
+
//# sourceMappingURL=ox-property-editor-graphql.js.map
|