@operato/input 9.0.0-beta.10 → 9.0.0-beta.11
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/CHANGELOG.md +9 -0
- package/dist/src/ox-buttons-radio.js +12 -10
- package/dist/src/ox-buttons-radio.js.map +1 -1
- package/dist/src/ox-checkbox.js +10 -7
- package/dist/src/ox-checkbox.js.map +1 -1
- package/dist/src/ox-form-field.js +5 -5
- package/dist/src/ox-form-field.js.map +1 -1
- package/dist/src/ox-input-3axis.js +2 -2
- package/dist/src/ox-input-3axis.js.map +1 -1
- package/dist/src/ox-input-3dish.js +2 -6
- package/dist/src/ox-input-3dish.js.map +1 -1
- package/dist/src/ox-input-angle.js +2 -4
- package/dist/src/ox-input-angle.js.map +1 -1
- package/dist/src/ox-input-barcode.js +7 -26
- package/dist/src/ox-input-barcode.js.map +1 -1
- package/dist/src/ox-input-code.js +13 -11
- package/dist/src/ox-input-code.js.map +1 -1
- package/dist/src/ox-input-color-gradient.js +10 -7
- package/dist/src/ox-input-color-gradient.js.map +1 -1
- package/dist/src/ox-input-color-stops.js +24 -29
- package/dist/src/ox-input-color-stops.js.map +1 -1
- package/dist/src/ox-input-color.js +6 -4
- package/dist/src/ox-input-color.js.map +1 -1
- package/dist/src/ox-input-container.js +0 -1
- package/dist/src/ox-input-container.js.map +1 -1
- package/dist/src/ox-input-crontab.js +7 -10
- package/dist/src/ox-input-crontab.js.map +1 -1
- package/dist/src/ox-input-data.js +2 -2
- package/dist/src/ox-input-data.js.map +1 -1
- package/dist/src/ox-input-direction.js +7 -4
- package/dist/src/ox-input-direction.js.map +1 -1
- package/dist/src/ox-input-duration.js +6 -7
- package/dist/src/ox-input-duration.js.map +1 -1
- package/dist/src/ox-input-file.js +9 -10
- package/dist/src/ox-input-file.js.map +1 -1
- package/dist/src/ox-input-hashtags.js +7 -6
- package/dist/src/ox-input-hashtags.js.map +1 -1
- package/dist/src/ox-input-i18n-label.js +8 -6
- package/dist/src/ox-input-i18n-label.js.map +1 -1
- package/dist/src/ox-input-image.js +2 -3
- package/dist/src/ox-input-image.js.map +1 -1
- package/dist/src/ox-input-key-values.js +8 -6
- package/dist/src/ox-input-key-values.js.map +1 -1
- package/dist/src/ox-input-layout/ox-input-card-layout.js +6 -4
- package/dist/src/ox-input-layout/ox-input-card-layout.js.map +1 -1
- package/dist/src/ox-input-layout/ox-input-grid-layout.js +6 -4
- package/dist/src/ox-input-layout/ox-input-grid-layout.js.map +1 -1
- package/dist/src/ox-input-layout/ox-input-layout.js +6 -3
- package/dist/src/ox-input-layout/ox-input-layout.js.map +1 -1
- package/dist/src/ox-input-mass-fraction.js +10 -8
- package/dist/src/ox-input-mass-fraction.js.map +1 -1
- package/dist/src/ox-input-multiple-colors.js +6 -5
- package/dist/src/ox-input-multiple-colors.js.map +1 -1
- package/dist/src/ox-input-options.js +7 -4
- package/dist/src/ox-input-options.js.map +1 -1
- package/dist/src/ox-input-partition-keys.js +7 -5
- package/dist/src/ox-input-partition-keys.js.map +1 -1
- package/dist/src/ox-input-privilege.js +7 -5
- package/dist/src/ox-input-privilege.js.map +1 -1
- package/dist/src/ox-input-quantifier.js +6 -4
- package/dist/src/ox-input-quantifier.js.map +1 -1
- package/dist/src/ox-input-range.js +9 -6
- package/dist/src/ox-input-range.js.map +1 -1
- package/dist/src/ox-input-scene-component-id.js +6 -4
- package/dist/src/ox-input-scene-component-id.js.map +1 -1
- package/dist/src/ox-input-search.js +2 -5
- package/dist/src/ox-input-search.js.map +1 -1
- package/dist/src/ox-input-select-buttons.js +8 -5
- package/dist/src/ox-input-select-buttons.js.map +1 -1
- package/dist/src/ox-input-signature.js +7 -8
- package/dist/src/ox-input-signature.js.map +1 -1
- package/dist/src/ox-input-stack.js +9 -6
- package/dist/src/ox-input-stack.js.map +1 -1
- package/dist/src/ox-input-switch.js +8 -5
- package/dist/src/ox-input-switch.js.map +1 -1
- package/dist/src/ox-input-table-column-config.js +6 -3
- package/dist/src/ox-input-table-column-config.js.map +1 -1
- package/dist/src/ox-input-table.js +7 -5
- package/dist/src/ox-input-table.js.map +1 -1
- package/dist/src/ox-input-textarea.js +6 -4
- package/dist/src/ox-input-textarea.js.map +1 -1
- package/dist/src/ox-input-unit-number.js +2 -7
- package/dist/src/ox-input-unit-number.js.map +1 -1
- package/dist/src/ox-input-value-map.js +9 -7
- package/dist/src/ox-input-value-map.js.map +1 -1
- package/dist/src/ox-input-value-ranges.js +9 -7
- package/dist/src/ox-input-value-ranges.js.map +1 -1
- package/dist/src/ox-input-work-shift.js +7 -4
- package/dist/src/ox-input-work-shift.js.map +1 -1
- package/dist/src/ox-select-floor.js +13 -11
- package/dist/src/ox-select-floor.js.map +1 -1
- package/dist/src/ox-select.js +10 -7
- package/dist/src/ox-select.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ox-input-color-gradient.js","sourceRoot":"","sources":["../../src/ox-input-color-gradient.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,0BAA0B,CAAA;AACjC,OAAO,qDAAqD,CAAA;AAC5D,OAAO,yCAAyC,CAAA;AAChD,OAAO,mCAAmC,CAAA;AAC1C,OAAO,kCAAkC,CAAA;AACzC,OAAO,wCAAwC,CAAA;AAE/C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAqBzC,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,WAAW;IACnD,MAAM,CAAC,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AS,CAAC,CAAC,CAAC;;;;wBAIvC,KAAK,CAAC,MAAM,IAAI,QAAQ;;;;;;;;;;;;;;;iBAe/B,KAAK,CAAC,UAAU;oBACb,IAAI,CAAC,QAAQ;;;KAG5B,CAAA;IACH,CAAC;IAED,2BAA2B,CAAC,SAAiB;QAC3C,IAAI,QAAQ,CAAA;QACZ,QAAQ,SAAS,EAAE,CAAC;YAClB,KAAK,wBAAwB;gBAC3B,QAAQ,GAAG,EAAE,CAAA;gBACb,MAAK;YACP,KAAK,eAAe;gBAClB,QAAQ,GAAG,EAAE,CAAA;gBACb,MAAK;YACP,KAAK,wBAAwB;gBAC3B,QAAQ,GAAG,GAAG,CAAA;gBACd,MAAK;YACP,KAAK,eAAe;gBAClB,QAAQ,GAAG,GAAG,CAAA;gBACd,MAAK;YACP,KAAK,wBAAwB;gBAC3B,QAAQ,GAAG,GAAG,CAAA;gBACd,MAAK;YACP,KAAK,eAAe;gBAClB,QAAQ,GAAG,GAAG,CAAA;gBACd,MAAK;YACP,KAAK,wBAAwB;gBAC3B,QAAQ,GAAG,GAAG,CAAA;gBACd,MAAK;YACP,KAAK,eAAe,CAAC;YACrB;gBACE,QAAQ,GAAG,CAAC,CAAA;gBACZ,MAAK;QACT,CAAC;QAED,OAAO,CAAC,QAAQ,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAA;IACvC,CAAC;;AAvK2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAI1B;AApJU,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAwThC","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@operato/i18n/ox-i18n.js'\nimport '@polymer/paper-dropdown-menu/paper-dropdown-menu.js'\nimport '@polymer/paper-listbox/paper-listbox.js'\nimport '@polymer/paper-item/paper-item.js'\nimport '@operato/input/ox-input-angle.js'\nimport '@operato/input/ox-input-color-stops.js'\n\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { ColorStop } from './ox-input-color-stops.js'\nimport { OxFormField } from './ox-form-field.js'\n\nexport type GradientOption = {\n type: 'linear' | 'radial'\n rotation: number\n direction?:\n | 'left-to-right'\n | 'lefttop-to-rightbottom'\n | 'top-to-bottom'\n | 'righttop-to-leftbottom'\n | 'right-to-left'\n | 'rightbottom-to-lefttop'\n | 'bottom-to-top'\n | 'leftbottom-to-righttop'\n | 'left-to-right'\n | 'center-to-corner'\n center?: 'center' | 'left-top' | 'right-top' | 'right-bottom' | 'left-bottom'\n colorStops?: ColorStop[]\n}\n\n@customElement('ox-input-color-gradient')\nexport class OxInputColorGradient extends OxFormField {\n static styles = css`\n :host {\n display: grid;\n\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 :host > * {\n align-self: stretch;\n }\n\n :host > label {\n grid-column: span 2;\n text-align: right;\n text-transform: capitalize;\n align-self: center;\n }\n\n :host > .icon-only-label {\n grid-column: span 1;\n }\n\n :host > input,\n :host > [editors] {\n grid-column: span 8;\n }\n\n :host > select {\n grid-column: span 4;\n height: 100%;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n\n :host > ox-input-angle {\n grid-column: span 3;\n }\n\n ox-input-color-stops {\n grid-column: span 10;\n }\n\n .host > input[type='checkbox'] {\n grid-column: 3 / 4;\n }\n\n .host > input[type='checkbox'] ~ label {\n grid-column: span 7;\n text-align: left;\n }\n\n [editors] > :not([active-selector]) {\n display: none;\n }\n\n [gradient-direction] {\n overflow: hidden;\n max-width: 210px;\n }\n\n [gradient-direction] paper-item {\n background: url(/assets/images/icon-editor-gradient-direction.png) 50% 0 no-repeat;\n min-height: 32px;\n padding: 3px 5px;\n width: 30px;\n float: left;\n }\n\n [gradient-direction] [name='lefttop-to-rightbottom'] {\n background-position: 50% 4px;\n }\n\n [gradient-direction] [name='left-top'] {\n background-position: 50% 4px;\n }\n\n [gradient-direction] [name='top-to-bottom'] {\n background-position: 50% -46px;\n }\n\n [gradient-direction] [name='righttop-to-leftbottom'] {\n background-position: 50% -96px;\n }\n\n [gradient-direction] [name='right-top'] {\n background-position: 50% -96px;\n }\n\n [gradient-direction] [name='right-to-left'] {\n background-position: 50% -146px;\n }\n\n [gradient-direction] [name='rightbottom-to-lefttop'] {\n background-position: 50% -196px;\n }\n\n [gradient-direction] [name='right-bottom'] {\n background-position: 50% -196px;\n }\n\n [gradient-direction] [name='bottom-to-top'] {\n background-position: 50% -246px;\n }\n\n [gradient-direction] [name='leftbottom-to-righttop'] {\n background-position: 50% -296px;\n }\n\n [gradient-direction] [name='left-bottom'] {\n background-position: 50% -296px;\n }\n\n [gradient-direction] [name='left-to-right'] {\n background-position: 50% -346px;\n }\n\n [gradient-direction] [name='center-to-corner'] {\n background-position: 50% -396px;\n }\n\n [gradient-direction] [name='center'] {\n background-position: 50% -396px;\n }\n\n [gradient-direction] paper-item[focused] {\n background-color: rgba(255, 246, 143, 0.5);\n }\n\n .icon-only-label {\n top: 0 !important;\n width: 30px !important;\n height: 24px;\n background: url(/assets/images/icon-properties-label.png) no-repeat;\n }\n\n .icon-only-label.color {\n background-position: 70% -198px;\n }\n `\n\n @property({ type: Object }) value: GradientOption = {\n type: 'linear',\n direction: 'left-to-right',\n rotation: 0\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 HTMLElement & { type: string }\n var key = element.getAttribute('value-key')\n\n if (!key) {\n return\n }\n\n var value\n\n switch (element.tagName) {\n case 'INPUT':\n switch (element.type) {\n case 'checkbox':\n value = (element as HTMLInputElement).checked\n break\n case 'number':\n value = Number((element as HTMLInputElement).value) || 0\n break\n case 'text':\n value = String((element as HTMLInputElement).value)\n }\n break\n\n case 'PAPER-BUTTON':\n value = (element as any).active\n break\n\n case 'PAPER-LISTBOX':\n value = (element as any).selected\n break\n\n default:\n value = (element as HTMLInputElement).value\n break\n }\n\n if (key === 'rotation') {\n this.value = {\n ...this.value,\n rotation: value,\n direction: undefined\n }\n } else if (key === 'direction') {\n if (value) {\n this.value = {\n ...this.value,\n direction: value,\n rotation: this._convertDirectionToRotation(value)\n }\n }\n } else {\n this.value = {\n ...this.value,\n [key]: value\n }\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n render() {\n var selector = (this.value && this.value.type) || 'linear'\n var value = this.value || {}\n\n return html`\n <label> <ox-i18n msgid=\"label.type\">type</ox-i18n> </label>\n <select value-key=\"type\" .value=${value.type || 'linear'} ?disabled=${this.disabled}>\n <option>linear</option>\n <option>radial</option>\n </select>\n\n <label class=\"icon-only-label color\"></label>\n <ox-input-angle value-key=\"rotation\" .value=${value.rotation || 0} ?disabled=${this.disabled}> </ox-input-angle>\n\n <label> <ox-i18n msgid=\"label.direction\">direction</ox-i18n> </label>\n <div editors>\n <paper-dropdown-menu no-label-float=\"true\" ?active-selector=${selector == 'linear'} .value=${value.direction}>\n <paper-listbox\n @selected-changed=${(e: Event) => this._onChange(e)}\n value-key=\"direction\"\n slot=\"dropdown-content\"\n gradient-direction\n .selected=${value.direction}\n attr-for-selected=\"name\"\n >\n <paper-item name=\"lefttop-to-rightbottom\"></paper-item>\n <paper-item name=\"top-to-bottom\"></paper-item>\n <paper-item name=\"righttop-to-leftbottom\"></paper-item>\n <paper-item name=\"right-to-left\"></paper-item>\n <paper-item name=\"rightbottom-to-lefttop\"></paper-item>\n <paper-item name=\"bottom-to-top\"></paper-item>\n <paper-item name=\"leftbottom-to-righttop\"></paper-item>\n <paper-item name=\"left-to-right\"></paper-item>\n <paper-item name=\"center-to-corner\"></paper-item>\n </paper-listbox>\n </paper-dropdown-menu>\n\n <paper-dropdown-menu no-label-float=\"true\" ?active-selector=${selector == 'radial'} .value=${value.center}>\n <paper-listbox\n @selected-changed=${(e: Event) => this._onChange(e)}\n value-key=\"center\"\n slot=\"dropdown-content\"\n gradient-direction\n .selected=${value.center || 'center'}\n attr-for-selected=\"name\"\n >\n <paper-item name=\"center\"></paper-item>\n <paper-item name=\"left-top\"></paper-item>\n <paper-item name=\"right-top\"></paper-item>\n <paper-item name=\"right-bottom\"></paper-item>\n <paper-item name=\"left-bottom\"></paper-item>\n </paper-listbox>\n </paper-dropdown-menu>\n </div>\n\n <ox-input-color-stops\n value-key=\"colorStops\"\n type=\"gradient\"\n .value=${value.colorStops}\n ?disabled=${this.disabled}\n >\n </ox-input-color-stops>\n `\n }\n\n _convertDirectionToRotation(direction: string): number {\n var rotation\n switch (direction) {\n case 'lefttop-to-rightbottom':\n rotation = 45\n break\n case 'top-to-bottom':\n rotation = 90\n break\n case 'righttop-to-leftbottom':\n rotation = 135\n break\n case 'right-to-left':\n rotation = 180\n break\n case 'rightbottom-to-lefttop':\n rotation = 215\n break\n case 'bottom-to-top':\n rotation = 270\n break\n case 'leftbottom-to-righttop':\n rotation = 315\n break\n case 'left-to-right':\n default:\n rotation = 0\n break\n }\n\n return (rotation / 360) * Math.PI * 2\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"ox-input-color-gradient.js","sourceRoot":"","sources":["../../src/ox-input-color-gradient.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,0BAA0B,CAAA;AACjC,OAAO,qDAAqD,CAAA;AAC5D,OAAO,yCAAyC,CAAA;AAChD,OAAO,mCAAmC,CAAA;AAC1C,OAAO,kCAAkC,CAAA;AACzC,OAAO,wCAAwC,CAAA;AAE/C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAqBzC,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,WAAW;IAA9C;;QAgJuB,UAAK,GAAmB;YAClD,IAAI,EAAE,QAAQ;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18n.js'\nimport '@polymer/paper-dropdown-menu/paper-dropdown-menu.js'\nimport '@polymer/paper-listbox/paper-listbox.js'\nimport '@polymer/paper-item/paper-item.js'\nimport '@operato/input/ox-input-angle.js'\nimport '@operato/input/ox-input-color-stops.js'\n\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { ColorStop } from './ox-input-color-stops.js'\nimport { OxFormField } from './ox-form-field.js'\n\nexport type GradientOption = {\n type: 'linear' | 'radial'\n rotation: number\n direction?:\n | 'left-to-right'\n | 'lefttop-to-rightbottom'\n | 'top-to-bottom'\n | 'righttop-to-leftbottom'\n | 'right-to-left'\n | 'rightbottom-to-lefttop'\n | 'bottom-to-top'\n | 'leftbottom-to-righttop'\n | 'left-to-right'\n | 'center-to-corner'\n center?: 'center' | 'left-top' | 'right-top' | 'right-bottom' | 'left-bottom'\n colorStops?: ColorStop[]\n}\n\n@customElement('ox-input-color-gradient')\nexport class OxInputColorGradient extends OxFormField {\n static styles = css`\n :host {\n display: grid;\n\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 :host > * {\n align-self: stretch;\n }\n\n :host > label {\n grid-column: span 2;\n text-align: right;\n text-transform: capitalize;\n align-self: center;\n }\n\n :host > .icon-only-label {\n grid-column: span 1;\n }\n\n :host > input,\n :host > [editors] {\n grid-column: span 8;\n }\n\n :host > select {\n grid-column: span 4;\n height: 100%;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n\n :host > ox-input-angle {\n grid-column: span 3;\n }\n\n ox-input-color-stops {\n grid-column: span 10;\n }\n\n .host > input[type='checkbox'] {\n grid-column: 3 / 4;\n }\n\n .host > input[type='checkbox'] ~ label {\n grid-column: span 7;\n text-align: left;\n }\n\n [editors] > :not([active-selector]) {\n display: none;\n }\n\n [gradient-direction] {\n overflow: hidden;\n max-width: 210px;\n }\n\n [gradient-direction] paper-item {\n background: url(/assets/images/icon-editor-gradient-direction.png) 50% 0 no-repeat;\n min-height: 32px;\n padding: 3px 5px;\n width: 30px;\n float: left;\n }\n\n [gradient-direction] [name='lefttop-to-rightbottom'] {\n background-position: 50% 4px;\n }\n\n [gradient-direction] [name='left-top'] {\n background-position: 50% 4px;\n }\n\n [gradient-direction] [name='top-to-bottom'] {\n background-position: 50% -46px;\n }\n\n [gradient-direction] [name='righttop-to-leftbottom'] {\n background-position: 50% -96px;\n }\n\n [gradient-direction] [name='right-top'] {\n background-position: 50% -96px;\n }\n\n [gradient-direction] [name='right-to-left'] {\n background-position: 50% -146px;\n }\n\n [gradient-direction] [name='rightbottom-to-lefttop'] {\n background-position: 50% -196px;\n }\n\n [gradient-direction] [name='right-bottom'] {\n background-position: 50% -196px;\n }\n\n [gradient-direction] [name='bottom-to-top'] {\n background-position: 50% -246px;\n }\n\n [gradient-direction] [name='leftbottom-to-righttop'] {\n background-position: 50% -296px;\n }\n\n [gradient-direction] [name='left-bottom'] {\n background-position: 50% -296px;\n }\n\n [gradient-direction] [name='left-to-right'] {\n background-position: 50% -346px;\n }\n\n [gradient-direction] [name='center-to-corner'] {\n background-position: 50% -396px;\n }\n\n [gradient-direction] [name='center'] {\n background-position: 50% -396px;\n }\n\n [gradient-direction] paper-item[focused] {\n background-color: rgba(255, 246, 143, 0.5);\n }\n\n .icon-only-label {\n top: 0 !important;\n width: 30px !important;\n height: 24px;\n background: url(/assets/images/icon-properties-label.png) no-repeat;\n }\n\n .icon-only-label.color {\n background-position: 70% -198px;\n }\n `\n\n @property({ type: Object }) value: GradientOption = {\n type: 'linear',\n direction: 'left-to-right',\n rotation: 0\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 HTMLElement & { type: string }\n var key = element.getAttribute('value-key')\n\n if (!key) {\n return\n }\n\n var value\n\n switch (element.tagName) {\n case 'INPUT':\n switch (element.type) {\n case 'checkbox':\n value = (element as HTMLInputElement).checked\n break\n case 'number':\n value = Number((element as HTMLInputElement).value) || 0\n break\n case 'text':\n value = String((element as HTMLInputElement).value)\n }\n break\n\n case 'PAPER-BUTTON':\n value = (element as any).active\n break\n\n case 'PAPER-LISTBOX':\n value = (element as any).selected\n break\n\n default:\n value = (element as HTMLInputElement).value\n break\n }\n\n if (key === 'rotation') {\n this.value = {\n ...this.value,\n rotation: value,\n direction: undefined\n }\n } else if (key === 'direction') {\n if (value) {\n this.value = {\n ...this.value,\n direction: value,\n rotation: this._convertDirectionToRotation(value)\n }\n }\n } else {\n this.value = {\n ...this.value,\n [key]: value\n }\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n render() {\n var selector = (this.value && this.value.type) || 'linear'\n var value = this.value || {}\n\n return html`\n <label> <ox-i18n msgid=\"label.type\">type</ox-i18n> </label>\n <select value-key=\"type\" .value=${value.type || 'linear'} ?disabled=${this.disabled}>\n <option>linear</option>\n <option>radial</option>\n </select>\n\n <label class=\"icon-only-label color\"></label>\n <ox-input-angle value-key=\"rotation\" .value=${value.rotation || 0} ?disabled=${this.disabled}> </ox-input-angle>\n\n <label> <ox-i18n msgid=\"label.direction\">direction</ox-i18n> </label>\n <div editors>\n <paper-dropdown-menu no-label-float=\"true\" ?active-selector=${selector == 'linear'} .value=${value.direction}>\n <paper-listbox\n @selected-changed=${(e: Event) => this._onChange(e)}\n value-key=\"direction\"\n slot=\"dropdown-content\"\n gradient-direction\n .selected=${value.direction}\n attr-for-selected=\"name\"\n >\n <paper-item name=\"lefttop-to-rightbottom\"></paper-item>\n <paper-item name=\"top-to-bottom\"></paper-item>\n <paper-item name=\"righttop-to-leftbottom\"></paper-item>\n <paper-item name=\"right-to-left\"></paper-item>\n <paper-item name=\"rightbottom-to-lefttop\"></paper-item>\n <paper-item name=\"bottom-to-top\"></paper-item>\n <paper-item name=\"leftbottom-to-righttop\"></paper-item>\n <paper-item name=\"left-to-right\"></paper-item>\n <paper-item name=\"center-to-corner\"></paper-item>\n </paper-listbox>\n </paper-dropdown-menu>\n\n <paper-dropdown-menu no-label-float=\"true\" ?active-selector=${selector == 'radial'} .value=${value.center}>\n <paper-listbox\n @selected-changed=${(e: Event) => this._onChange(e)}\n value-key=\"center\"\n slot=\"dropdown-content\"\n gradient-direction\n .selected=${value.center || 'center'}\n attr-for-selected=\"name\"\n >\n <paper-item name=\"center\"></paper-item>\n <paper-item name=\"left-top\"></paper-item>\n <paper-item name=\"right-top\"></paper-item>\n <paper-item name=\"right-bottom\"></paper-item>\n <paper-item name=\"left-bottom\"></paper-item>\n </paper-listbox>\n </paper-dropdown-menu>\n </div>\n\n <ox-input-color-stops\n value-key=\"colorStops\"\n type=\"gradient\"\n .value=${value.colorStops}\n ?disabled=${this.disabled}\n >\n </ox-input-color-stops>\n `\n }\n\n _convertDirectionToRotation(direction: string): number {\n var rotation\n switch (direction) {\n case 'lefttop-to-rightbottom':\n rotation = 45\n break\n case 'top-to-bottom':\n rotation = 90\n break\n case 'righttop-to-leftbottom':\n rotation = 135\n break\n case 'right-to-left':\n rotation = 180\n break\n case 'rightbottom-to-lefttop':\n rotation = 215\n break\n case 'bottom-to-top':\n rotation = 270\n break\n case 'leftbottom-to-righttop':\n rotation = 315\n break\n case 'left-to-right':\n default:\n rotation = 0\n break\n }\n\n return (rotation / 360) * Math.PI * 2\n }\n}\n"]}
|
@@ -23,7 +23,29 @@ import deepEquals from 'lodash-es/isEqual.js';
|
|
23
23
|
* </ox-input-color-stops>
|
24
24
|
*/
|
25
25
|
let OxInputColorStops = class OxInputColorStops extends OxFormField {
|
26
|
-
|
26
|
+
constructor() {
|
27
|
+
super(...arguments);
|
28
|
+
/**
|
29
|
+
* `type` indicates how the color-stop bar is displayed.
|
30
|
+
* - 'solid': Fills with solid color from one color stop to the next.
|
31
|
+
* - 'gradient': Fills with gradient color from one color stop to the next.
|
32
|
+
*/
|
33
|
+
this.type = 'solid';
|
34
|
+
/**
|
35
|
+
* `min` indicates the minimum value of the color-stop bar's position range.
|
36
|
+
*/
|
37
|
+
this.min = 0;
|
38
|
+
/**
|
39
|
+
* `max` indicates the maximum value of the color-stop bar's position range.
|
40
|
+
*/
|
41
|
+
this.max = 1;
|
42
|
+
/**
|
43
|
+
* `value` maintains the array of color stops created by the color-stops.
|
44
|
+
*/
|
45
|
+
this.value = undefined;
|
46
|
+
this.dragstart = { position: 0, x: 0, y: 0 };
|
47
|
+
}
|
48
|
+
static { this.styles = css `
|
27
49
|
:host {
|
28
50
|
display: grid;
|
29
51
|
grid-template-columns: repeat(10, 1fr);
|
@@ -118,33 +140,7 @@ let OxInputColorStops = class OxInputColorStops extends OxFormField {
|
|
118
140
|
grid-row: 2;
|
119
141
|
border: 1px solid rgba(0, 0, 0, 0.2);
|
120
142
|
}
|
121
|
-
`;
|
122
|
-
/**
|
123
|
-
* `type` indicates how the color-stop bar is displayed.
|
124
|
-
* - 'solid': Fills with solid color from one color stop to the next.
|
125
|
-
* - 'gradient': Fills with gradient color from one color stop to the next.
|
126
|
-
*/
|
127
|
-
type = 'solid';
|
128
|
-
/**
|
129
|
-
* `min` indicates the minimum value of the color-stop bar's position range.
|
130
|
-
*/
|
131
|
-
min = 0;
|
132
|
-
/**
|
133
|
-
* `max` indicates the maximum value of the color-stop bar's position range.
|
134
|
-
*/
|
135
|
-
max = 1;
|
136
|
-
/**
|
137
|
-
* `value` maintains the array of color stops created by the color-stops.
|
138
|
-
*/
|
139
|
-
value = undefined;
|
140
|
-
/**
|
141
|
-
* Represents the focused state of the input component.
|
142
|
-
* This property can be of any type.
|
143
|
-
*/
|
144
|
-
focused;
|
145
|
-
colorbar;
|
146
|
-
colorEditor;
|
147
|
-
_dragImage;
|
143
|
+
`; }
|
148
144
|
connectedCallback() {
|
149
145
|
super.connectedCallback();
|
150
146
|
this._dragImage = new Image();
|
@@ -375,7 +371,6 @@ let OxInputColorStops = class OxInputColorStops extends OxFormField {
|
|
375
371
|
var index = marker.getAttribute('marker-index');
|
376
372
|
this._setFocused(Number(index));
|
377
373
|
}
|
378
|
-
dragstart = { position: 0, x: 0, y: 0 };
|
379
374
|
_onDragStart(e) {
|
380
375
|
if (this.disabled) {
|
381
376
|
return;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ox-input-color-stops.js","sourceRoot":"","sources":["../../src/ox-input-color-stops.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,UAAU,MAAM,sBAAsB,CAAA;AAO7C;;;;;;;;;;;;;;GAcG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,WAAW;IAChD,MAAM,CAAC,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+FlB,CAAA;IAED;;;;OAIG;IACyB,IAAI,GAAyB,OAAO,CAAA;IAChE;;OAEG;IACyB,GAAG,GAAW,CAAC,CAAA;IAC3C;;OAEG;IACyB,GAAG,GAAW,CAAC,CAAA;IAC3C;;OAEG;IACwB,KAAK,GAAiB,SAAS,CAAA;IAC1D;;;OAGG;IACyB,OAAO,CAAK;IAEpB,QAAQ,CAAc;IAClB,WAAW,CAAe;IAE1C,UAAU,CAAmB;IAErC,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAA;QAEzB,IAAI,CAAC,UAAU,GAAG,IAAI,KAAK,EAAE,CAAA;QAC7B,IAAI,CAAC,UAAU,CAAC,GAAG,GAAG,oFAAoF,CAAA;IAC5G,CAAC;IAED,YAAY;QACV,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EA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,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CACvG,CAAA;IACH,CAAC;;AArY2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAqC;AAIpC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAgB;AAIf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAgB;AAIhB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;gDAAgC;AAK9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAa;AAEpB;IAAnB,KAAK,CAAC,WAAW,CAAC;mDAAuB;AAClB;IAAvB,KAAK,CAAC,eAAe,CAAC;sDAA2B;AA3HvC,iBAAiB;IAD7B,aAAa,CAAC,sBAAsB,CAAC;GACzB,iBAAiB,CA6e7B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport './ox-input-color.js'\n\nimport { PropertyValues, css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field.js'\nimport { OxInputColor } from './ox-input-color.js'\nimport deepEquals from 'lodash-es/isEqual.js'\n\nexport type ColorStop = {\n color: string\n position: number\n}\n\n/**\n * This component allows editing an array of color sets (position and color) within a range.\n *\n * The preview bar shows the color sets in gradient or solid form.\n *\n * To add a new color set, double-click the preview bar.\n * To remove a color set, drag the color set marker downward.\n * To move the position of a color set, drag the color set marker left or right, or select the color set marker with the mouse and directly edit the position in the position input editor.\n * To change the color of a color set, double-click the color set marker to pop up the color palette and select a color, or directly edit the color in the color input editor.\n *\n * Example:\n *\n * <ox-input-color-stops type=\"gradient\" .value=${gradient.colorStops}>\n * </ox-input-color-stops>\n */\n@customElement('ox-input-color-stops')\nexport class OxInputColorStops extends OxFormField {\n static styles = css`\n :host {\n display: grid;\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 0;\n grid-auto-rows: minmax(0, auto);\n }\n\n #color-stops {\n grid-column: 1 / 11;\n grid-row: 1;\n\n clear: both;\n margin-bottom: -3px;\n }\n\n #colorbar {\n width: 95%;\n height: 12px;\n margin: auto;\n margin-bottom: 25px;\n border: 1px solid #ccc;\n }\n\n #markers {\n position: relative;\n top: 30px;\n }\n\n #markers div {\n width: 10px;\n height: 10px;\n margin-top: -15px;\n position: absolute;\n border: 2px solid #fff;\n cursor: pointer;\n -webkit-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n -moz-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n }\n\n #markers div::before {\n border-bottom: 6px solid #fff;\n border-left: 7px solid transparent;\n border-right: 7px solid transparent;\n content: '';\n width: 0;\n height: 0;\n left: -2px;\n position: absolute;\n top: -8px;\n }\n\n #markers div[focused] {\n border-color: var(--things-editor-colorbar-marker-focused-color, #585858);\n }\n\n #markers div[focused]:before {\n border-bottom: 7px solid var(--things-editor-colorbar-marker-focused-color, #585858);\n }\n\n .icon-only-label {\n background: url(/assets/images/icon-properties-label.png) no-repeat;\n width: 30px;\n height: 24px;\n }\n\n .icon-only-label.color {\n grid-column: 1 / 2;\n grid-row: 2;\n\n background-position: 70% -498px;\n float: left;\n margin-top: 0;\n }\n\n .icon-only-label.position {\n grid-column: 7 / 8;\n grid-row: 2;\n\n background-position: 70% -797px;\n float: left;\n margin-top: 0;\n }\n\n ox-input-color {\n grid-column: 2 / 7;\n grid-row: 2;\n }\n\n input[type='number'] {\n grid-column: 8 / 11;\n grid-row: 2;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n `\n\n /**\n * `type` indicates how the color-stop bar is displayed.\n * - 'solid': Fills with solid color from one color stop to the next.\n * - 'gradient': Fills with gradient color from one color stop to the next.\n */\n @property({ type: String }) type: 'solid' | 'gradient' = 'solid'\n /**\n * `min` indicates the minimum value of the color-stop bar's position range.\n */\n @property({ type: Number }) min: number = 0\n /**\n * `max` indicates the maximum value of the color-stop bar's position range.\n */\n @property({ type: Number }) max: number = 1\n /**\n * `value` maintains the array of color stops created by the color-stops.\n */\n @property({ type: Array }) value?: ColorStop[] = undefined\n /**\n * Represents the focused state of the input component.\n * This property can be of any type.\n */\n @property({ type: Object }) focused: any\n\n @query('#colorbar') colorbar!: HTMLElement\n @query('#color-editor') colorEditor!: OxInputColor\n\n private _dragImage?: HTMLImageElement\n\n connectedCallback() {\n super.connectedCallback()\n\n this._dragImage = new Image()\n this._dragImage.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='\n }\n\n firstUpdated() {\n window.addEventListener('resize', () => {\n this.requestUpdate()\n })\n }\n\n updated(changes: PropertyValues<this>) {\n var needRerenderColorBar = false\n\n if (changes.has('value') && this.value instanceof Array) {\n var oldValue = changes.get('value')\n if (\n this.focused &&\n (!oldValue ||\n this.value.findIndex(v => v.position == this.focused.position && v.color == this.focused.color) == -1)\n ) {\n /* Clear focused if there was no previous value.\n * Even if there was a previous value, focused can only be selected and modified within this editor, so if there is no value with the same position, it is considered that a new editor has started and focused is cleared.\n */\n this.focused = null\n }\n\n if (!deepEquals(oldValue, this.value)) {\n needRerenderColorBar = true\n }\n }\n\n if (needRerenderColorBar || changes.has('min') || changes.has('max')) {\n if (!this.value) {\n this.value = [\n { color: 'white', position: this.min },\n { color: 'white', position: this.max }\n ]\n }\n\n this._renderColorBar(this.min, this.max, this.type)\n this.requestUpdate()\n }\n }\n\n render() {\n return html`\n <div id=\"color-stops\">\n <div id=\"colorbar\" @dblclick=${(e: MouseEvent) => this._onDblClickColorbar(e)}>\n <div\n id=\"markers\"\n @dblclick=${(e: MouseEvent) => this._onDblClickMarkers(e)}\n @pointerdown=${(e: PointerEvent) => this._onPointerDown(e)}\n @dragstart=${(e: DragEvent) => this._onDragStart(e)}\n @drag=${this._throttled(100, this._onDrag.bind(this))}\n @dragend=${(e: DragEvent) => this._onDragEnd(e)}\n >\n ${this._refinedValue(this.value).map(\n (item, index) => html`\n <div\n .style=\"background-color:${item.color};margin-left:${this._calculatePosition(\n item.position,\n this.min,\n this.max\n )}px;\"\n marker-index=${index}\n draggable=\"true\"\n ></div>\n `\n )}\n </div>\n </div>\n </div>\n\n <label class=\"icon-only-label color\"></label>\n <ox-input-color\n id=\"color-editor\"\n .value=${this.focused && this.focused.color}\n @change=${(e: Event) => this._onChangeSubComponent(e)}\n ?disabled=${this.disabled}\n >\n </ox-input-color>\n\n <label class=\"icon-only-label position\"></label>\n <input\n type=\"number\"\n id=\"color-position\"\n .value=${this.focused && this.focused.position}\n @change=${(e: Event) => this._onChangeSubComponent(e)}\n step=\"0.01\"\n ?disabled=${this.disabled}\n />\n `\n }\n\n _refinedValue(value: any) {\n return value instanceof Array ? value : []\n }\n\n _setFocused(index: number) {\n if (this.focused && this.focused.index === index) {\n return\n }\n\n var marker = this.renderRoot.querySelector(`#markers div[marker-index='${index}']`) as HTMLElement\n var olds = this.renderRoot.querySelectorAll('#markers div[focused]')\n olds.length > 0 && olds.forEach(old => old.removeAttribute('focused'))\n marker && marker.setAttribute('focused', '')\n\n if (!marker) {\n this.focused = null\n return\n }\n\n var colorStop = this.value![index]\n\n this._changeFocused({\n index: index,\n color: colorStop.color,\n position: Math.max(this.min, Math.min(colorStop.position, this.max))\n })\n }\n\n _changeFocused(focused: any) {\n if (!focused) {\n this._setFocused(-1) // clear focused marker\n\n return\n }\n\n this.focused = focused\n\n this.value = this.value!.map((colorStop, index): ColorStop => {\n if (index != focused.index) {\n return colorStop\n }\n\n return {\n color: focused.color,\n position: focused.position\n }\n }).sort((a: ColorStop, b: ColorStop) => {\n return b.position < a.position ? 1 : -1\n })\n\n var colorStop = this.value[focused.index]\n\n if (focused.position != colorStop.position || focused.color != colorStop.color) {\n var index = -1\n for (var i = 0; i < this.value.length; i++) {\n colorStop = this.value[i]\n if (focused.position == colorStop.position && focused.color == colorStop.color) {\n index = i\n break\n }\n }\n\n this._setFocused(index)\n }\n }\n\n _renderColorBar(min: number, max: number, type: 'solid' | 'gradient') {\n var value = this._refinedValue(this.value)\n var gradient = ''\n\n if (value instanceof Array && value.length > 0) {\n if (this.type == 'gradient') {\n var stopsStrings = (value || []).map(function (stop) {\n var position = (stop.position - min) / (max - min)\n return `${stop.color} ${position * 100}%`\n })\n } else {\n var stops = value || []\n var last: ColorStop | undefined\n var last_position = 0\n var stopsStrings = stops.map(function (stop) {\n var stop_position = (stop.position - min) / (max - min)\n if (last) {\n last_position = (last.position - min) / (max - min)\n var step = `${stop.color} ${last_position * 100}%, ${stop.color} ${stop_position * 100}%`\n } else {\n var step = `${stop.color} ${stop_position * 100}%`\n }\n last = stop\n return step\n })\n if (last) {\n last_position = (last.position - min) / (max - min)\n stopsStrings.push(`${last.color} ${last_position * 100}%, white ${last_position * 100}%, white 100%`)\n }\n }\n\n gradient = stopsStrings.join(',')\n } else {\n gradient = 'black 0%, black 100%'\n }\n\n this.colorbar!.style.background = `linear-gradient(to right, ${gradient})`\n /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */\n }\n\n _onChangeSubComponent(e: Event) {\n var element = e.target as HTMLInputElement\n var id = element.id\n\n if (!this.focused) {\n return\n }\n\n switch (id) {\n case 'color-editor':\n this._changeFocused({\n ...this.focused,\n color: element.value\n })\n break\n case 'color-position':\n this._changeFocused({\n ...this.focused,\n position: Math.max(this.min, Math.min(Number(element.value), this.max))\n })\n break\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onDblClickColorbar(e: MouseEvent) {\n if (this.disabled) {\n return\n }\n\n /* Filter out cases where the marker is clicked. */\n if (e.target !== this.colorbar) return\n\n var width = this.colorbar.offsetWidth\n var position = this.min + (this.max - this.min) * (e.offsetX / width)\n var colorStops = this.value ? this.value.slice() : []\n\n for (var i = 0; i < colorStops.length; i++) {\n if (colorStops[i].position > position) break\n }\n\n colorStops.splice(i, 0, {\n position: position,\n color: '#fff'\n })\n\n this.value = colorStops\n\n this.focused = null\n this._setFocused(i)\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onDblClickMarkers(e: MouseEvent) {\n if (this.disabled) {\n return\n }\n\n this.colorEditor.showPicker()\n }\n\n _onPointerDown(e: PointerEvent) {\n if (this.disabled) {\n return\n }\n\n var marker = e.target as HTMLElement\n var index = marker.getAttribute('marker-index')\n\n this._setFocused(Number(index))\n }\n\n private dragstart: { position: number; x: number; y: number } = { position: 0, x: 0, y: 0 }\n\n _onDragStart(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n /* Prevent ghost image from appearing during drag */\n e.dataTransfer?.setDragImage(this._dragImage!, 0, 0)\n\n this.dragstart = {\n position: this.focused.position,\n x: e.clientX,\n y: e.clientY\n }\n }\n\n // TODO onDrag event keeps occurring, causing performance degradation. So throttling is applied.\n _throttled(delay: number, fn: (...args: any[]) => any) {\n let lastCall = 0\n return function (...args: any[]) {\n const now = new Date().getTime()\n if (now - lastCall < delay) {\n return\n }\n lastCall = now\n return fn(...args)\n }\n }\n\n _onDrag(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n if (e.clientX <= 0) {\n return\n }\n\n var width = this.colorbar.offsetWidth\n var position = this.dragstart.position + ((e.clientX - this.dragstart.x) / width) * (this.max - this.min)\n\n if (position != this.focused.position) {\n this._changeFocused({\n ...this.focused,\n position: Math.max(this.min, Math.min(position, this.max))\n })\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n\n _onDragEnd(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n if (e.clientY - this.dragstart.y > 40) {\n this.value!.splice(this.focused.index, 1)\n this.value = this.value!.slice()\n\n this._setFocused(-1)\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n\n _calculatePosition(position: number, min: number, max: number) {\n /* TODO 7 ==> Should be calculated as half the marker width. */\n var calculated = position\n\n if (calculated > this.max) calculated = this.max\n else if (calculated < this.min) calculated = this.min\n\n var width = (this.colorbar && this.colorbar.offsetWidth) || 0\n\n return ((calculated - this.min) / (this.max - this.min)) * width - 7\n }\n\n protected appendFormData({ formData }: FormDataEvent): void {\n if (!this.name) return\n\n const value = this.value\n\n formData.append(\n this.name!,\n typeof value === 'string' ? value : value === undefined || value === null ? '' : JSON.stringify(value)\n )\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"ox-input-color-stops.js","sourceRoot":"","sources":["../../src/ox-input-color-stops.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,UAAU,MAAM,sBAAsB,CAAA;AAO7C;;;;;;;;;;;;;;GAcG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,WAAW;IAA3C;;QAkGL;;;;WAIG;QACyB,SAAI,GAAyB,OAAO,CAAA;QAChE;;WAEG;QACyB,QAAG,GAAW,CAAC,CAAA;QAC3C;;WAEG;QACyB,QAAG,GAAW,CAAC,CAAA;QAC3C;;WAEG;QACwB,UAAK,GAAiB,SAAS,CAAA;QAiSlD,cAAS,GAA+C,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;IAyF7F,CAAC;aA5eQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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YAAE,OAAM;QAEtB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;QAExB,QAAQ,CAAC,MAAM,CACb,IAAI,CAAC,IAAK,EACV,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CACvG,CAAA;IACH,CAAC;;AArY2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAqC;AAIpC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAgB;AAIf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAgB;AAIhB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;gDAAgC;AAK9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAa;AAEpB;IAAnB,KAAK,CAAC,WAAW,CAAC;mDAAuB;AAClB;IAAvB,KAAK,CAAC,eAAe,CAAC;sDAA2B;AA3HvC,iBAAiB;IAD7B,aAAa,CAAC,sBAAsB,CAAC;GACzB,iBAAiB,CA6e7B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport './ox-input-color.js'\n\nimport { PropertyValues, css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field.js'\nimport { OxInputColor } from './ox-input-color.js'\nimport deepEquals from 'lodash-es/isEqual.js'\n\nexport type ColorStop = {\n color: string\n position: number\n}\n\n/**\n * This component allows editing an array of color sets (position and color) within a range.\n *\n * The preview bar shows the color sets in gradient or solid form.\n *\n * To add a new color set, double-click the preview bar.\n * To remove a color set, drag the color set marker downward.\n * To move the position of a color set, drag the color set marker left or right, or select the color set marker with the mouse and directly edit the position in the position input editor.\n * To change the color of a color set, double-click the color set marker to pop up the color palette and select a color, or directly edit the color in the color input editor.\n *\n * Example:\n *\n * <ox-input-color-stops type=\"gradient\" .value=${gradient.colorStops}>\n * </ox-input-color-stops>\n */\n@customElement('ox-input-color-stops')\nexport class OxInputColorStops extends OxFormField {\n static styles = css`\n :host {\n display: grid;\n grid-template-columns: repeat(10, 1fr);\n grid-gap: 0;\n grid-auto-rows: minmax(0, auto);\n }\n\n #color-stops {\n grid-column: 1 / 11;\n grid-row: 1;\n\n clear: both;\n margin-bottom: -3px;\n }\n\n #colorbar {\n width: 95%;\n height: 12px;\n margin: auto;\n margin-bottom: 25px;\n border: 1px solid #ccc;\n }\n\n #markers {\n position: relative;\n top: 30px;\n }\n\n #markers div {\n width: 10px;\n height: 10px;\n margin-top: -15px;\n position: absolute;\n border: 2px solid #fff;\n cursor: pointer;\n -webkit-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n -moz-box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n box-shadow: 1px 1px 1px 0px rgba(0, 0, 0, 0.2);\n }\n\n #markers div::before {\n border-bottom: 6px solid #fff;\n border-left: 7px solid transparent;\n border-right: 7px solid transparent;\n content: '';\n width: 0;\n height: 0;\n left: -2px;\n position: absolute;\n top: -8px;\n }\n\n #markers div[focused] {\n border-color: var(--things-editor-colorbar-marker-focused-color, #585858);\n }\n\n #markers div[focused]:before {\n border-bottom: 7px solid var(--things-editor-colorbar-marker-focused-color, #585858);\n }\n\n .icon-only-label {\n background: url(/assets/images/icon-properties-label.png) no-repeat;\n width: 30px;\n height: 24px;\n }\n\n .icon-only-label.color {\n grid-column: 1 / 2;\n grid-row: 2;\n\n background-position: 70% -498px;\n float: left;\n margin-top: 0;\n }\n\n .icon-only-label.position {\n grid-column: 7 / 8;\n grid-row: 2;\n\n background-position: 70% -797px;\n float: left;\n margin-top: 0;\n }\n\n ox-input-color {\n grid-column: 2 / 7;\n grid-row: 2;\n }\n\n input[type='number'] {\n grid-column: 8 / 11;\n grid-row: 2;\n border: 1px solid rgba(0, 0, 0, 0.2);\n }\n `\n\n /**\n * `type` indicates how the color-stop bar is displayed.\n * - 'solid': Fills with solid color from one color stop to the next.\n * - 'gradient': Fills with gradient color from one color stop to the next.\n */\n @property({ type: String }) type: 'solid' | 'gradient' = 'solid'\n /**\n * `min` indicates the minimum value of the color-stop bar's position range.\n */\n @property({ type: Number }) min: number = 0\n /**\n * `max` indicates the maximum value of the color-stop bar's position range.\n */\n @property({ type: Number }) max: number = 1\n /**\n * `value` maintains the array of color stops created by the color-stops.\n */\n @property({ type: Array }) value?: ColorStop[] = undefined\n /**\n * Represents the focused state of the input component.\n * This property can be of any type.\n */\n @property({ type: Object }) focused: any\n\n @query('#colorbar') colorbar!: HTMLElement\n @query('#color-editor') colorEditor!: OxInputColor\n\n private _dragImage?: HTMLImageElement\n\n connectedCallback() {\n super.connectedCallback()\n\n this._dragImage = new Image()\n this._dragImage.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='\n }\n\n firstUpdated() {\n window.addEventListener('resize', () => {\n this.requestUpdate()\n })\n }\n\n updated(changes: PropertyValues<this>) {\n var needRerenderColorBar = false\n\n if (changes.has('value') && this.value instanceof Array) {\n var oldValue = changes.get('value')\n if (\n this.focused &&\n (!oldValue ||\n this.value.findIndex(v => v.position == this.focused.position && v.color == this.focused.color) == -1)\n ) {\n /* Clear focused if there was no previous value.\n * Even if there was a previous value, focused can only be selected and modified within this editor, so if there is no value with the same position, it is considered that a new editor has started and focused is cleared.\n */\n this.focused = null\n }\n\n if (!deepEquals(oldValue, this.value)) {\n needRerenderColorBar = true\n }\n }\n\n if (needRerenderColorBar || changes.has('min') || changes.has('max')) {\n if (!this.value) {\n this.value = [\n { color: 'white', position: this.min },\n { color: 'white', position: this.max }\n ]\n }\n\n this._renderColorBar(this.min, this.max, this.type)\n this.requestUpdate()\n }\n }\n\n render() {\n return html`\n <div id=\"color-stops\">\n <div id=\"colorbar\" @dblclick=${(e: MouseEvent) => this._onDblClickColorbar(e)}>\n <div\n id=\"markers\"\n @dblclick=${(e: MouseEvent) => this._onDblClickMarkers(e)}\n @pointerdown=${(e: PointerEvent) => this._onPointerDown(e)}\n @dragstart=${(e: DragEvent) => this._onDragStart(e)}\n @drag=${this._throttled(100, this._onDrag.bind(this))}\n @dragend=${(e: DragEvent) => this._onDragEnd(e)}\n >\n ${this._refinedValue(this.value).map(\n (item, index) => html`\n <div\n .style=\"background-color:${item.color};margin-left:${this._calculatePosition(\n item.position,\n this.min,\n this.max\n )}px;\"\n marker-index=${index}\n draggable=\"true\"\n ></div>\n `\n )}\n </div>\n </div>\n </div>\n\n <label class=\"icon-only-label color\"></label>\n <ox-input-color\n id=\"color-editor\"\n .value=${this.focused && this.focused.color}\n @change=${(e: Event) => this._onChangeSubComponent(e)}\n ?disabled=${this.disabled}\n >\n </ox-input-color>\n\n <label class=\"icon-only-label position\"></label>\n <input\n type=\"number\"\n id=\"color-position\"\n .value=${this.focused && this.focused.position}\n @change=${(e: Event) => this._onChangeSubComponent(e)}\n step=\"0.01\"\n ?disabled=${this.disabled}\n />\n `\n }\n\n _refinedValue(value: any) {\n return value instanceof Array ? value : []\n }\n\n _setFocused(index: number) {\n if (this.focused && this.focused.index === index) {\n return\n }\n\n var marker = this.renderRoot.querySelector(`#markers div[marker-index='${index}']`) as HTMLElement\n var olds = this.renderRoot.querySelectorAll('#markers div[focused]')\n olds.length > 0 && olds.forEach(old => old.removeAttribute('focused'))\n marker && marker.setAttribute('focused', '')\n\n if (!marker) {\n this.focused = null\n return\n }\n\n var colorStop = this.value![index]\n\n this._changeFocused({\n index: index,\n color: colorStop.color,\n position: Math.max(this.min, Math.min(colorStop.position, this.max))\n })\n }\n\n _changeFocused(focused: any) {\n if (!focused) {\n this._setFocused(-1) // clear focused marker\n\n return\n }\n\n this.focused = focused\n\n this.value = this.value!.map((colorStop, index): ColorStop => {\n if (index != focused.index) {\n return colorStop\n }\n\n return {\n color: focused.color,\n position: focused.position\n }\n }).sort((a: ColorStop, b: ColorStop) => {\n return b.position < a.position ? 1 : -1\n })\n\n var colorStop = this.value[focused.index]\n\n if (focused.position != colorStop.position || focused.color != colorStop.color) {\n var index = -1\n for (var i = 0; i < this.value.length; i++) {\n colorStop = this.value[i]\n if (focused.position == colorStop.position && focused.color == colorStop.color) {\n index = i\n break\n }\n }\n\n this._setFocused(index)\n }\n }\n\n _renderColorBar(min: number, max: number, type: 'solid' | 'gradient') {\n var value = this._refinedValue(this.value)\n var gradient = ''\n\n if (value instanceof Array && value.length > 0) {\n if (this.type == 'gradient') {\n var stopsStrings = (value || []).map(function (stop) {\n var position = (stop.position - min) / (max - min)\n return `${stop.color} ${position * 100}%`\n })\n } else {\n var stops = value || []\n var last: ColorStop | undefined\n var last_position = 0\n var stopsStrings = stops.map(function (stop) {\n var stop_position = (stop.position - min) / (max - min)\n if (last) {\n last_position = (last.position - min) / (max - min)\n var step = `${stop.color} ${last_position * 100}%, ${stop.color} ${stop_position * 100}%`\n } else {\n var step = `${stop.color} ${stop_position * 100}%`\n }\n last = stop\n return step\n })\n if (last) {\n last_position = (last.position - min) / (max - min)\n stopsStrings.push(`${last.color} ${last_position * 100}%, white ${last_position * 100}%, white 100%`)\n }\n }\n\n gradient = stopsStrings.join(',')\n } else {\n gradient = 'black 0%, black 100%'\n }\n\n this.colorbar!.style.background = `linear-gradient(to right, ${gradient})`\n /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */\n }\n\n _onChangeSubComponent(e: Event) {\n var element = e.target as HTMLInputElement\n var id = element.id\n\n if (!this.focused) {\n return\n }\n\n switch (id) {\n case 'color-editor':\n this._changeFocused({\n ...this.focused,\n color: element.value\n })\n break\n case 'color-position':\n this._changeFocused({\n ...this.focused,\n position: Math.max(this.min, Math.min(Number(element.value), this.max))\n })\n break\n }\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onDblClickColorbar(e: MouseEvent) {\n if (this.disabled) {\n return\n }\n\n /* Filter out cases where the marker is clicked. */\n if (e.target !== this.colorbar) return\n\n var width = this.colorbar.offsetWidth\n var position = this.min + (this.max - this.min) * (e.offsetX / width)\n var colorStops = this.value ? this.value.slice() : []\n\n for (var i = 0; i < colorStops.length; i++) {\n if (colorStops[i].position > position) break\n }\n\n colorStops.splice(i, 0, {\n position: position,\n color: '#fff'\n })\n\n this.value = colorStops\n\n this.focused = null\n this._setFocused(i)\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n _onDblClickMarkers(e: MouseEvent) {\n if (this.disabled) {\n return\n }\n\n this.colorEditor.showPicker()\n }\n\n _onPointerDown(e: PointerEvent) {\n if (this.disabled) {\n return\n }\n\n var marker = e.target as HTMLElement\n var index = marker.getAttribute('marker-index')\n\n this._setFocused(Number(index))\n }\n\n private dragstart: { position: number; x: number; y: number } = { position: 0, x: 0, y: 0 }\n\n _onDragStart(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n /* Prevent ghost image from appearing during drag */\n e.dataTransfer?.setDragImage(this._dragImage!, 0, 0)\n\n this.dragstart = {\n position: this.focused.position,\n x: e.clientX,\n y: e.clientY\n }\n }\n\n // TODO onDrag event keeps occurring, causing performance degradation. So throttling is applied.\n _throttled(delay: number, fn: (...args: any[]) => any) {\n let lastCall = 0\n return function (...args: any[]) {\n const now = new Date().getTime()\n if (now - lastCall < delay) {\n return\n }\n lastCall = now\n return fn(...args)\n }\n }\n\n _onDrag(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n if (e.clientX <= 0) {\n return\n }\n\n var width = this.colorbar.offsetWidth\n var position = this.dragstart.position + ((e.clientX - this.dragstart.x) / width) * (this.max - this.min)\n\n if (position != this.focused.position) {\n this._changeFocused({\n ...this.focused,\n position: Math.max(this.min, Math.min(position, this.max))\n })\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n\n _onDragEnd(e: DragEvent) {\n if (this.disabled) {\n return\n }\n\n if (e.clientY - this.dragstart.y > 40) {\n this.value!.splice(this.focused.index, 1)\n this.value = this.value!.slice()\n\n this._setFocused(-1)\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n\n _calculatePosition(position: number, min: number, max: number) {\n /* TODO 7 ==> Should be calculated as half the marker width. */\n var calculated = position\n\n if (calculated > this.max) calculated = this.max\n else if (calculated < this.min) calculated = this.min\n\n var width = (this.colorbar && this.colorbar.offsetWidth) || 0\n\n return ((calculated - this.min) / (this.max - this.min)) * width - 7\n }\n\n protected appendFormData({ formData }: FormDataEvent): void {\n if (!this.name) return\n\n const value = this.value\n\n formData.append(\n this.name!,\n typeof value === 'string' ? value : value === undefined || value === null ? '' : JSON.stringify(value)\n )\n }\n}\n"]}
|
@@ -166,7 +166,11 @@ Example:
|
|
166
166
|
</ox-input-color>
|
167
167
|
*/
|
168
168
|
let OxInputColor = class OxInputColor extends OxFormField {
|
169
|
-
|
169
|
+
constructor() {
|
170
|
+
super(...arguments);
|
171
|
+
this.value = undefined;
|
172
|
+
}
|
173
|
+
static { this.styles = css `
|
170
174
|
:host {
|
171
175
|
position: relative;
|
172
176
|
display: inline-flex;
|
@@ -215,9 +219,7 @@ let OxInputColor = class OxInputColor extends OxFormField {
|
|
215
219
|
9px 9px;
|
216
220
|
background-size: 18px 18px;
|
217
221
|
}
|
218
|
-
`;
|
219
|
-
value = undefined;
|
220
|
-
properties;
|
222
|
+
`; }
|
221
223
|
render() {
|
222
224
|
return html `
|
223
225
|
<input
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ox-input-color.js","sourceRoot":"","sources":["../../src/ox-input-color.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,6CAA6C,CAAA;AAEpD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAA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AC,CAAA;QACxC,CAAC,CAAA;QACD,MAAM,CAAC,gBAAgB,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAA;QAEjD,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;IACjC,CAAC;;AA/G2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAgB;AArDhC,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CAoKxB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@operato/color-picker/paper-color-picker.js'\n\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { tinycolor } from '@thebespokepixel/es-tinycolor'\n\nimport { OxFormField } from './ox-form-field.js'\n\n/**\n색상을 입력하는데 사용되는 입력 컴포넌트이다.\n화면상에는 두개의 입력 필드가 보이며, 하나는 색상값을 키보드로 직접 입력하는 입력 픽드이며,\n다른 하나는 마우스로 클릭하여 컬러 파레트를 팝업 시키는 입력 필드이다.\n컬러 파레트를 팝업시키는 입력필드는 현재 입력된 색상으로 표시된다.\n\n색상값을 직접 입력하는 필드에서는 'white', 'red', 'yellow' 등 색상의미 단어를 사용할 수도 있고,\n#fff, #123456 와 같이 스타일에서 지정하는 방식의 3자리 및 6자리 숫자 표현도 가능하다.\n컬러 파레트를 팝업시키는 입력 필드에서 색상을 지정하게되면, 모두 6자리 숫자 표현방식만을 사용한다.\n\n의미 단어를 지원하는 색상은 다음과 같다.\n\naliceblue : #f0f8ff<br>\nantiquewhite : #faebd7<br>\naqua : #00ffff<br>\naquamarine : #7fffd4<br>\nazure : #f0ffff<br>\nbeige : #f5f5dc<br>\nbisque : #ffe4c4<br>\nblack : #000000<br>\nblanchedalmond : #ffebcd<br>\nblue : #0000ff<br>\nblueviolet : #8a2be2<br>\nbrown : #a52a2a<br>\nburlywood : #deb887<br>\ncadetblue : #5f9ea0<br>\nchartreuse : #7fff00<br>\nchocolate : #d2691e<br>\ncoral : #ff7f50<br>\ncornflowerblue : #6495ed<br>\ncornsilk : #fff8dc<br>\ncrimson : #dc143c<br>\ncyan : #00ffff<br>\ndarkblue : #00008b<br>\ndarkcyan : #008b8b<br>\ndarkgoldenrod : #b8860b<br>\ndarkgray : #a9a9a9<br>\ndarkgreen : #006400<br>\ndarkkhaki : #bdb76b<br>\ndarkmagenta : #8b008b<br>\ndarkolivegreen : #556b2f<br>\ndarkorange : #ff8c00<br>\ndarkorchid : #9932cc<br>\ndarkred : #8b0000<br>\ndarksalmon : #e9967a<br>\ndarkseagreen : #8fbc8f<br>\ndarkslateblue : #483d8b<br>\ndarkslategray : #2f4f4f<br>\ndarkturquoise : #00ced1<br>\ndarkviolet : #9400d3<br>\ndeeppink : #ff1493<br>\ndeepskyblue : #00bfff<br>\ndimgray : #696969<br>\ndodgerblue : #1e90ff<br>\nfirebrick : #b22222<br>\nfloralwhite : #fffaf0<br>\nforestgreen : #228b22<br>\nfuchsia : #ff00ff<br>\ngainsboro : #dcdcdc<br>\nghostwhite : #f8f8ff<br>\ngold : #ffd700<br>\ngoldenrod : #daa520<br>\ngray : #808080<br>\ngreen : #008000<br>\ngreenyellow : #adff2f<br>\nhoneydew : #f0fff0<br>\nhotpink : #ff69b4<br>\nindianred : #cd5c5c<br>\nindigo : #4b0082<br>\nivory : #fffff0<br>\nkhaki : #f0e68c<br>\nlavender : #e6e6fa<br>\nlavenderblush : #fff0f5<br>\nlawngreen : #7cfc00<br>\nlemonchiffon : #fffacd<br>\nlightblue : #add8e6<br>\nlightcoral : #f08080<br>\nlightcyan : #e0ffff<br>\nlightgoldenrodyellow : #fafad2<br>\nlightgrey : #d3d3d3<br>\nlightgreen : #90ee90<br>\nlightpink : #ffb6c1<br>\nlightsalmon : #ffa07a<br>\nlightseagreen : #20b2aa<br>\nlightskyblue : #87cefa<br>\nlightslategray : #778899<br>\nlightsteelblue : #b0c4de<br>\nlightyellow : #ffffe0<br>\nlime : #00ff00<br>\nlimegreen : #32cd32<br>\nlinen : #faf0e6<br>\nmagenta : #ff00ff<br>\nmaroon : #800000<br>\nmediumaquamarine : #66cdaa<br>\nmediumblue : #0000cd<br>\nmediumorchid : #ba55d3<br>\nmediumpurple : #9370d8<br>\nmediumseagreen : #3cb371<br>\nmediumslateblue : #7b68ee<br>\nmediumspringgreen : #00fa9a<br>\nmediumturquoise : #48d1cc<br>\nmediumvioletred : #c71585<br>\nmidnightblue : #191970<br>\nmintcream : #f5fffa<br>\nmistyrose : #ffe4e1<br>\nmoccasin : #ffe4b5<br>\nnavajowhite : #ffdead<br>\nnavy : #000080<br>\noldlace : #fdf5e6<br>\nolive : #808000<br>\nolivedrab : #6b8e23<br>\norange : #ffa500<br>\norangered : #ff4500<br>\norchid : #da70d6<br>\npalegoldenrod : #eee8aa<br>\npalegreen : #98fb98<br>\npaleturquoise : #afeeee<br>\npalevioletred : #d87093<br>\npapayawhip : #ffefd5<br>\npeachpuff : #ffdab9<br>\nperu : #cd853f<br>\npink : #ffc0cb<br>\nplum : #dda0dd<br>\npowderblue : #b0e0e6<br>\npurple : #800080<br>\nred : #ff0000<br>\nrosybrown : #bc8f8f<br>\nroyalblue : #4169e1<br>\nsaddlebrown : #8b4513<br>\nsalmon : #fa8072<br>\nsandybrown : #f4a460<br>\nseagreen : #2e8b57<br>\nseashell : #fff5ee<br>\nsienna : #a0522d<br>\nsilver : #c0c0c0<br>\nskyblue : #87ceeb<br>\nslateblue : #6a5acd<br>\nslategray : #708090<br>\nsnow : #fffafa<br>\nspringgreen : #00ff7f<br>\nsteelblue : #4682b4<br>\ntan : #d2b48c<br>\nteal : #008080<br>\nthistle : #d8bfd8<br>\ntomato : #ff6347<br>\nturquoise : #40e0d0<br>\nviolet : #ee82ee<br>\nwheat : #f5deb3<br>\nwhite : #ffffff<br>\nwhitesmoke : #f5f5f5<br>\nyellow : #ffff00<br>\nyellowgreen : #9acd32<br>\n\nExample:\n\n <ox-input-color .value=${color}>\n </ox-input-color>\n*/\n\n@customElement('ox-input-color')\nexport class OxInputColor extends OxFormField {\n static styles = css`\n :host {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: flex-end;\n }\n\n input[type='text'] {\n width: 100%;\n border: 0;\n border-bottom: 1px solid rgba(0, 0, 0, 0.15);\n padding: var(--spacing-tiny);\n font: var(--input-font);\n color: var(--md-sys-color-on-primary-container);\n padding-right: 35px;\n }\n input:focus {\n outline: none;\n border-bottom: 1px solid var(--md-sys-color-on-primary-container);\n }\n\n a {\n -webkit-appearance: none;\n display: flex;\n position: absolute;\n width: 35px;\n height: 100%;\n box-sizing: border-box;\n align-items: center;\n justify-content: center;\n }\n\n span {\n width: 80%;\n height: 60%;\n border: 1px solid rgba(0, 0, 0, 0.15);\n border-radius: var(--border-radius);\n }\n\n span.transparent {\n background-color: #fefefe;\n background-image: linear-gradient(45deg, #cbcbcb 25%, transparent 25%, transparent 75%, #cbcbcb 75%, #cbcbcb),\n linear-gradient(45deg, #cbcbcb 25%, transparent 25%, transparent 75%, #cbcbcb 75%, #cbcbcb);\n background-position:\n 0 0,\n 9px 9px;\n background-size: 18px 18px;\n }\n `\n\n @property({ type: String }) value?: string = undefined\n @property({ type: Object }) properties: any\n\n render() {\n return html`\n <input\n id=\"text\"\n type=\"text\"\n .value=${this.value || ''}\n @change=${(e: Event) => this._onInputChanged(e)}\n .placeholder=${this.getAttribute('placeholder') || ''}\n ?disabled=${this.disabled}\n />\n\n <a @click=${(e: MouseEvent) => this.showPicker()}>\n <span id=\"color-thumbnail\" .style=\"background-color:${this._thumbnail()}\" class=${this._thumbnail()}> </span>\n </a>\n `\n }\n\n set colorString(colorString: string) {\n var color = tinycolor(colorString, {})\n var { withoutAlpha, valueType } = this.properties || {}\n\n if (color.isValid()) {\n if (valueType == 'hex' || withoutAlpha) {\n this.value = color.toHexString(false)\n } else this.value = color.toRgbString()\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n\n _thumbnail() {\n return tinycolor(this.value || 'transparent', {}).toRgbString()\n }\n\n _onInputChanged(e: Event) {\n e.stopPropagation()\n this.value = (e.target as HTMLInputElement).value\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n /**\n * 외부에서 호출 가능한 메쏘드임.\n */\n showPicker() {\n if (this.disabled) {\n return\n }\n\n var { withoutAlpha } = this.properties || {}\n\n var color = tinycolor(this.value, {})\n\n var picker = document.createElement('paper-color-picker') as HTMLElement & {\n shape: string\n color: any\n colorAsString: string\n allowAlpha: boolean\n alwaysShowAlpha: boolean\n type: string\n _initialAlphaValueHack: number\n set: (name: string, value: number) => void\n open: () => void\n }\n\n picker.shape = 'huebox'\n picker.color = color\n picker.colorAsString = color.toRgbString()\n if (!withoutAlpha) {\n picker.allowAlpha = true\n picker.alwaysShowAlpha = true\n }\n picker.type = 'hsl'\n picker.style.setProperty('--paper-input-container-color', 'var(--md-sys-color-primary, gray)')\n picker.style.setProperty('--primary-text-color', 'var(--md-sys-color-primary, gray)')\n\n if (color.isValid()) {\n let rgb = color.toRgb() as { r: number; g: number; b: number }\n let alpha = color.getAlpha()\n\n picker._initialAlphaValueHack = alpha\n\n picker.set('immediateColor.red', rgb.r)\n picker.set('immediateColor.green', rgb.g)\n picker.set('immediateColor.blue', rgb.b)\n\n if (alpha != undefined) {\n picker.set('immediateColor.alpha', alpha)\n }\n }\n\n document.body.appendChild(picker)\n\n var _ = (e: Event) => {\n if (!(e as CustomEvent)?.detail?.confirmed) {\n return\n }\n\n if (picker.colorAsString) {\n this.colorString = picker.colorAsString\n }\n\n picker.removeEventListener('iron-overlay-closed', _)\n picker.parentNode?.removeChild(picker)\n }\n picker.addEventListener('iron-overlay-closed', _)\n\n setTimeout(() => picker.open())\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"ox-input-color.js","sourceRoot":"","sources":["../../src/ox-input-color.ts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AAC,aAAa,CAAA;YACzC,CAAC;YAED,MAAM,CAAC,mBAAmB,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAA;YACpD,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;QACxC,CAAC,CAAA;QACD,MAAM,CAAC,gBAAgB,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAA;QAEjD,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;IACjC,CAAC;;AA/G2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAgB;AArDhC,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CAoKxB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@operato/color-picker/paper-color-picker.js'\n\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { tinycolor } from '@thebespokepixel/es-tinycolor'\n\nimport { OxFormField } from './ox-form-field.js'\n\n/**\n색상을 입력하는데 사용되는 입력 컴포넌트이다.\n화면상에는 두개의 입력 필드가 보이며, 하나는 색상값을 키보드로 직접 입력하는 입력 픽드이며,\n다른 하나는 마우스로 클릭하여 컬러 파레트를 팝업 시키는 입력 필드이다.\n컬러 파레트를 팝업시키는 입력필드는 현재 입력된 색상으로 표시된다.\n\n색상값을 직접 입력하는 필드에서는 'white', 'red', 'yellow' 등 색상의미 단어를 사용할 수도 있고,\n#fff, #123456 와 같이 스타일에서 지정하는 방식의 3자리 및 6자리 숫자 표현도 가능하다.\n컬러 파레트를 팝업시키는 입력 필드에서 색상을 지정하게되면, 모두 6자리 숫자 표현방식만을 사용한다.\n\n의미 단어를 지원하는 색상은 다음과 같다.\n\naliceblue : #f0f8ff<br>\nantiquewhite : #faebd7<br>\naqua : #00ffff<br>\naquamarine : #7fffd4<br>\nazure : #f0ffff<br>\nbeige : #f5f5dc<br>\nbisque : #ffe4c4<br>\nblack : #000000<br>\nblanchedalmond : #ffebcd<br>\nblue : #0000ff<br>\nblueviolet : #8a2be2<br>\nbrown : #a52a2a<br>\nburlywood : #deb887<br>\ncadetblue : #5f9ea0<br>\nchartreuse : #7fff00<br>\nchocolate : #d2691e<br>\ncoral : #ff7f50<br>\ncornflowerblue : #6495ed<br>\ncornsilk : #fff8dc<br>\ncrimson : #dc143c<br>\ncyan : #00ffff<br>\ndarkblue : #00008b<br>\ndarkcyan : #008b8b<br>\ndarkgoldenrod : #b8860b<br>\ndarkgray : #a9a9a9<br>\ndarkgreen : #006400<br>\ndarkkhaki : #bdb76b<br>\ndarkmagenta : #8b008b<br>\ndarkolivegreen : #556b2f<br>\ndarkorange : #ff8c00<br>\ndarkorchid : #9932cc<br>\ndarkred : #8b0000<br>\ndarksalmon : #e9967a<br>\ndarkseagreen : #8fbc8f<br>\ndarkslateblue : #483d8b<br>\ndarkslategray : #2f4f4f<br>\ndarkturquoise : #00ced1<br>\ndarkviolet : #9400d3<br>\ndeeppink : #ff1493<br>\ndeepskyblue : #00bfff<br>\ndimgray : #696969<br>\ndodgerblue : #1e90ff<br>\nfirebrick : #b22222<br>\nfloralwhite : #fffaf0<br>\nforestgreen : #228b22<br>\nfuchsia : #ff00ff<br>\ngainsboro : #dcdcdc<br>\nghostwhite : #f8f8ff<br>\ngold : #ffd700<br>\ngoldenrod : #daa520<br>\ngray : #808080<br>\ngreen : #008000<br>\ngreenyellow : #adff2f<br>\nhoneydew : #f0fff0<br>\nhotpink : #ff69b4<br>\nindianred : #cd5c5c<br>\nindigo : #4b0082<br>\nivory : #fffff0<br>\nkhaki : #f0e68c<br>\nlavender : #e6e6fa<br>\nlavenderblush : #fff0f5<br>\nlawngreen : #7cfc00<br>\nlemonchiffon : #fffacd<br>\nlightblue : #add8e6<br>\nlightcoral : #f08080<br>\nlightcyan : #e0ffff<br>\nlightgoldenrodyellow : #fafad2<br>\nlightgrey : #d3d3d3<br>\nlightgreen : #90ee90<br>\nlightpink : #ffb6c1<br>\nlightsalmon : #ffa07a<br>\nlightseagreen : #20b2aa<br>\nlightskyblue : #87cefa<br>\nlightslategray : #778899<br>\nlightsteelblue : #b0c4de<br>\nlightyellow : #ffffe0<br>\nlime : #00ff00<br>\nlimegreen : #32cd32<br>\nlinen : #faf0e6<br>\nmagenta : #ff00ff<br>\nmaroon : #800000<br>\nmediumaquamarine : #66cdaa<br>\nmediumblue : #0000cd<br>\nmediumorchid : #ba55d3<br>\nmediumpurple : #9370d8<br>\nmediumseagreen : #3cb371<br>\nmediumslateblue : #7b68ee<br>\nmediumspringgreen : #00fa9a<br>\nmediumturquoise : #48d1cc<br>\nmediumvioletred : #c71585<br>\nmidnightblue : #191970<br>\nmintcream : #f5fffa<br>\nmistyrose : #ffe4e1<br>\nmoccasin : #ffe4b5<br>\nnavajowhite : #ffdead<br>\nnavy : #000080<br>\noldlace : #fdf5e6<br>\nolive : #808000<br>\nolivedrab : #6b8e23<br>\norange : #ffa500<br>\norangered : #ff4500<br>\norchid : #da70d6<br>\npalegoldenrod : #eee8aa<br>\npalegreen : #98fb98<br>\npaleturquoise : #afeeee<br>\npalevioletred : #d87093<br>\npapayawhip : #ffefd5<br>\npeachpuff : #ffdab9<br>\nperu : #cd853f<br>\npink : #ffc0cb<br>\nplum : #dda0dd<br>\npowderblue : #b0e0e6<br>\npurple : #800080<br>\nred : #ff0000<br>\nrosybrown : #bc8f8f<br>\nroyalblue : #4169e1<br>\nsaddlebrown : #8b4513<br>\nsalmon : #fa8072<br>\nsandybrown : #f4a460<br>\nseagreen : #2e8b57<br>\nseashell : #fff5ee<br>\nsienna : #a0522d<br>\nsilver : #c0c0c0<br>\nskyblue : #87ceeb<br>\nslateblue : #6a5acd<br>\nslategray : #708090<br>\nsnow : #fffafa<br>\nspringgreen : #00ff7f<br>\nsteelblue : #4682b4<br>\ntan : #d2b48c<br>\nteal : #008080<br>\nthistle : #d8bfd8<br>\ntomato : #ff6347<br>\nturquoise : #40e0d0<br>\nviolet : #ee82ee<br>\nwheat : #f5deb3<br>\nwhite : #ffffff<br>\nwhitesmoke : #f5f5f5<br>\nyellow : #ffff00<br>\nyellowgreen : #9acd32<br>\n\nExample:\n\n <ox-input-color .value=${color}>\n </ox-input-color>\n*/\n\n@customElement('ox-input-color')\nexport class OxInputColor extends OxFormField {\n static styles = css`\n :host {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: flex-end;\n }\n\n input[type='text'] {\n width: 100%;\n border: 0;\n border-bottom: 1px solid rgba(0, 0, 0, 0.15);\n padding: var(--spacing-tiny);\n font: var(--input-font);\n color: var(--md-sys-color-on-primary-container);\n padding-right: 35px;\n }\n input:focus {\n outline: none;\n border-bottom: 1px solid var(--md-sys-color-on-primary-container);\n }\n\n a {\n -webkit-appearance: none;\n display: flex;\n position: absolute;\n width: 35px;\n height: 100%;\n box-sizing: border-box;\n align-items: center;\n justify-content: center;\n }\n\n span {\n width: 80%;\n height: 60%;\n border: 1px solid rgba(0, 0, 0, 0.15);\n border-radius: var(--border-radius);\n }\n\n span.transparent {\n background-color: #fefefe;\n background-image: linear-gradient(45deg, #cbcbcb 25%, transparent 25%, transparent 75%, #cbcbcb 75%, #cbcbcb),\n linear-gradient(45deg, #cbcbcb 25%, transparent 25%, transparent 75%, #cbcbcb 75%, #cbcbcb);\n background-position:\n 0 0,\n 9px 9px;\n background-size: 18px 18px;\n }\n `\n\n @property({ type: String }) value?: string = undefined\n @property({ type: Object }) properties: any\n\n render() {\n return html`\n <input\n id=\"text\"\n type=\"text\"\n .value=${this.value || ''}\n @change=${(e: Event) => this._onInputChanged(e)}\n .placeholder=${this.getAttribute('placeholder') || ''}\n ?disabled=${this.disabled}\n />\n\n <a @click=${(e: MouseEvent) => this.showPicker()}>\n <span id=\"color-thumbnail\" .style=\"background-color:${this._thumbnail()}\" class=${this._thumbnail()}> </span>\n </a>\n `\n }\n\n set colorString(colorString: string) {\n var color = tinycolor(colorString, {})\n var { withoutAlpha, valueType } = this.properties || {}\n\n if (color.isValid()) {\n if (valueType == 'hex' || withoutAlpha) {\n this.value = color.toHexString(false)\n } else this.value = color.toRgbString()\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n }\n\n _thumbnail() {\n return tinycolor(this.value || 'transparent', {}).toRgbString()\n }\n\n _onInputChanged(e: Event) {\n e.stopPropagation()\n this.value = (e.target as HTMLInputElement).value\n\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))\n }\n\n /**\n * 외부에서 호출 가능한 메쏘드임.\n */\n showPicker() {\n if (this.disabled) {\n return\n }\n\n var { withoutAlpha } = this.properties || {}\n\n var color = tinycolor(this.value, {})\n\n var picker = document.createElement('paper-color-picker') as HTMLElement & {\n shape: string\n color: any\n colorAsString: string\n allowAlpha: boolean\n alwaysShowAlpha: boolean\n type: string\n _initialAlphaValueHack: number\n set: (name: string, value: number) => void\n open: () => void\n }\n\n picker.shape = 'huebox'\n picker.color = color\n picker.colorAsString = color.toRgbString()\n if (!withoutAlpha) {\n picker.allowAlpha = true\n picker.alwaysShowAlpha = true\n }\n picker.type = 'hsl'\n picker.style.setProperty('--paper-input-container-color', 'var(--md-sys-color-primary, gray)')\n picker.style.setProperty('--primary-text-color', 'var(--md-sys-color-primary, gray)')\n\n if (color.isValid()) {\n let rgb = color.toRgb() as { r: number; g: number; b: number }\n let alpha = color.getAlpha()\n\n picker._initialAlphaValueHack = alpha\n\n picker.set('immediateColor.red', rgb.r)\n picker.set('immediateColor.green', rgb.g)\n picker.set('immediateColor.blue', rgb.b)\n\n if (alpha != undefined) {\n picker.set('immediateColor.alpha', alpha)\n }\n }\n\n document.body.appendChild(picker)\n\n var _ = (e: Event) => {\n if (!(e as CustomEvent)?.detail?.confirmed) {\n return\n }\n\n if (picker.colorAsString) {\n this.colorString = picker.colorAsString\n }\n\n picker.removeEventListener('iron-overlay-closed', _)\n picker.parentNode?.removeChild(picker)\n }\n picker.addEventListener('iron-overlay-closed', _)\n\n setTimeout(() => picker.open())\n }\n}\n"]}
|
@@ -7,7 +7,6 @@ import '@operato/popup/ox-popup-list.js';
|
|
7
7
|
import { html, LitElement } from 'lit';
|
8
8
|
import { customElement, query } from 'lit/decorators.js';
|
9
9
|
let OxInputContainer = class OxInputContainer extends LitElement {
|
10
|
-
popupList;
|
11
10
|
render() {
|
12
11
|
return html `
|
13
12
|
<slot> </slot>
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ox-input-container.js","sourceRoot":"","sources":["../../src/ox-input-container.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,4BAA4B,CAAA;AACnC,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAO,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAKjD,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,UAAU;
|
1
|
+
{"version":3,"file":"ox-input-container.js","sourceRoot":"","sources":["../../src/ox-input-container.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,4BAA4B,CAAA;AACnC,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAO,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAKjD,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,UAAU;IAG9C,MAAM;QACJ,OAAO,IAAI,CAAA;;wBAES,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;;;KAGhD,CAAA;IACH,CAAC;IAED,aAAa,CAAC,CAAa;QACzB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;YAClB,IAAI,EAAE,CAAC;YACP,GAAG,EAAE,CAAC;SACP,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAjByB;IAAvB,KAAK,CAAC,eAAe,CAAC;mDAAwB;AADpC,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAkB5B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/web/icon/icon.js'\nimport '@operato/popup/ox-popup-list.js'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, query } from 'lit/decorators.js'\n\nimport { OxPopupList } from '@operato/popup'\n\n@customElement('ox-input-container')\nexport class OxInputContainer extends LitElement {\n @query('ox-popup-list') popupList!: OxPopupList\n\n render() {\n return html`\n <slot> </slot>\n <md-icon @click=${this.openPopupList.bind(this)}>menu</md-icon>\n\n <ox-popup-list></ox-popup-list>\n `\n }\n\n openPopupList(e: MouseEvent) {\n this.popupList.open({\n left: 0,\n top: 0\n })\n }\n}\n"]}
|
@@ -73,7 +73,12 @@ function createCronRegex(type) {
|
|
73
73
|
return `^${regexByField[type]}$`;
|
74
74
|
}
|
75
75
|
let OxInputCrontab = class OxInputCrontab extends OxFormField {
|
76
|
-
|
76
|
+
constructor() {
|
77
|
+
super(...arguments);
|
78
|
+
this.value = undefined;
|
79
|
+
this.tooltip = [];
|
80
|
+
}
|
81
|
+
static { this.styles = css `
|
77
82
|
:host {
|
78
83
|
position: relative;
|
79
84
|
display: block;
|
@@ -219,15 +224,7 @@ let OxInputCrontab = class OxInputCrontab extends OxFormField {
|
|
219
224
|
md-icon {
|
220
225
|
font-size: 24px;
|
221
226
|
}
|
222
|
-
`;
|
223
|
-
value = undefined;
|
224
|
-
second;
|
225
|
-
minute;
|
226
|
-
hour;
|
227
|
-
dayOfMonth;
|
228
|
-
month;
|
229
|
-
dayOfWeek;
|
230
|
-
tooltip = [];
|
227
|
+
`; }
|
231
228
|
render() {
|
232
229
|
return html `
|
233
230
|
<form>
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ox-input-crontab.js","sourceRoot":"","sources":["../../src/ox-input-cr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AE,MAAM,EAAE,CAAC;4CAAc;AACb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAoB;AACnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAmB;AAErC;IAAR,KAAK,EAAE;+CAAuD;AA7JpD,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CA8f1B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, html, PropertyValues } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\n\nimport { OxFormField } from './ox-form-field.js'\n\nimport '@material/web/fab/fab.js'\nimport '@material/web/icon/icon.js'\n\nfunction createCronRegex(type: 'sec' | 'min' | 'hour' | 'day' | 'month' | 'dayOfWeek') {\n // https://gist.github.com/dkandalov/a2aed17cfdeb65243022\n var regexByField = {} as any\n regexByField['sec'] = '[0-5]?\\\\d'\n regexByField['min'] = '[0-5]?\\\\d'\n regexByField['hour'] = '[01]?\\\\d|2[0-3]'\n regexByField['day'] = '0?[1-9]|[12]\\\\d|3[01]'\n regexByField['month'] = '[1-9]|1[012]'\n regexByField['dayOfWeek'] = '[0-7]'\n\n var crontabFields = [type]\n if (!type) crontabFields = ['sec', 'min', 'hour', 'day', 'month', 'dayOfWeek']\n\n crontabFields.forEach(field => {\n var number = regexByField[field]\n var range =\n '(?:' +\n number +\n ')' +\n '(?:' +\n '(?:-|/|,' +\n ('dayOfWeek' === field ? '|#' : '') +\n ')' +\n '(?:' +\n number +\n ')' +\n ')?'\n if (field === 'dayOfWeek') range += '(?:L)?'\n if (field === 'month') range += '(?:L|W)?'\n regexByField[field] = '\\\\?|\\\\*|' + range + '(?:,' + range + ')*'\n })\n\n var monthValues = 'JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC'\n var monthRange = '(?:' + monthValues + ')(?:(?:-)(?:' + monthValues + '))?'\n regexByField['month'] += '|\\\\?|\\\\*|' + monthRange + '(?:,' + monthRange + ')*'\n\n var dayOfWeekValues = 'MON|TUE|WED|THU|FRI|SAT|SUN'\n var dayOfWeekRange = '(?:' + dayOfWeekValues + ')(?:(?:-)(?:' + dayOfWeekValues + '))?'\n regexByField['dayOfWeek'] += '|\\\\?|\\\\*|' + dayOfWeekRange + '(?:,' + dayOfWeekRange + ')*'\n\n if (!type)\n return (\n '^\\\\s*($' +\n '|#' +\n '|\\\\w+\\\\s*=' +\n '|' +\n '(' +\n regexByField['sec'] +\n ')\\\\s+' +\n '(' +\n regexByField['min'] +\n ')\\\\s+' +\n '(' +\n regexByField['hour'] +\n ')\\\\s+' +\n '(' +\n regexByField['day'] +\n ')\\\\s+' +\n '(' +\n regexByField['month'] +\n ')\\\\s+' +\n '(' +\n regexByField['dayOfWeek'] +\n ')(|\\\\s)+' +\n ')$'\n )\n else return `^${regexByField[type]}$`\n}\n\n@customElement('ox-input-crontab')\nexport class OxInputCrontab extends OxFormField {\n static styles = css`\n :host {\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n border: 0;\n }\n\n :host * {\n box-sizing: border-box;\n }\n :host *:focus {\n outline: none;\n }\n\n form {\n display: grid;\n width: 100%;\n height: 100%;\n padding: 1rem;\n grid-template: auto auto 1fr auto / repeat(6, 1fr);\n grid-gap: 0.5rem;\n justify-content: center;\n align-items: center;\n overflow: auto;\n }\n\n label[for='example'] {\n text-align: right;\n grid-column: 3;\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n text-transform: capitalize;\n }\n\n #example {\n grid-column: 4 / span 3;\n width: 100%;\n box-sizing: border-box;\n padding: 0 var(--spacing-small);\n height: var(--form-element-height-medium);\n border: 1px solid var(--md-sys-color-outline);\n border-radius: var(--md-sys-shape-corner-small);\n background-color: var(--md-sys-color-on-primary);\n text-transform: capitalize;\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n }\n\n input {\n width: 100%;\n box-sizing: border-box;\n padding: 0 var(--spacing-small);\n height: var(--form-element-height-medium);\n border: 1px solid var(--md-sys-color-outline);\n border-radius: var(--md-sys-shape-corner-small);\n background-color: var(--md-sys-color-on-primary);\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n }\n\n input:focus {\n outline: none;\n border-color: var(--md-sys-color-secondary-fixed-dim);\n }\n\n input:invalid {\n border-color: var(--md-sys-color-error);\n color: var(--md-sys-color-error);\n }\n\n label {\n width: 100%;\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n }\n\n label:not([for='example']) {\n text-align: center;\n }\n\n #input-wrapper {\n grid-column: span 6;\n display: flex;\n flex-wrap: wrap;\n margin: 0 -0.25rem;\n }\n\n #input-wrapper > div {\n flex: 1;\n display: grid;\n grid-template-rows: 1fr auto;\n grid-gap: var(--spacing-small);\n min-width: 60px;\n max-width: 33%;\n margin: 0.25rem;\n }\n\n #tooltip {\n grid-column: span 6;\n display: grid;\n grid-template-columns: auto 1fr;\n grid-gap: 0;\n margin: auto;\n grid-auto-rows: min-content;\n align-self: center;\n align-items: center;\n }\n\n #tooltip > div {\n padding: 0.25rem 0.5rem;\n border-bottom: var(--md-sys-color-on-surface-variant) 1px dashed;\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n }\n\n #tooltip > .crontab-value {\n text-align: right;\n color: var(--md-sys-color-surface-tint);\n }\n\n #tooltip > .crontab-description {\n text-align: left;\n color: var (--md-sys-color-on-primary-container);\n }\n\n #button-wrapper {\n grid-column: 1 / span 6;\n display: flex;\n flex-wrap: wrap-reverse;\n flex-direction: row-reverse;\n margin: -0.25rem;\n }\n\n md-fab {\n margin: 0.25rem;\n position: absolute;\n bottom: 1rem;\n left: 1rem;\n color: var(--md-sys-color-on-primary);\n }\n\n md-icon {\n font-size: 24px;\n }\n `\n\n @property({ type: String }) value?: string = undefined\n @property({ type: String }) second?: string\n @property({ type: String }) minute?: string\n @property({ type: String }) hour?: string\n @property({ type: String }) dayOfMonth?: string\n @property({ type: String }) month?: string\n @property({ type: String }) dayOfWeek?: string\n\n @state() tooltip: { value: string; description: string }[] = []\n\n render() {\n return html`\n <form>\n <label for=\"example\">${i18next.t('label.examples')}</label>\n <select\n id=\"example\"\n @change=${(e: Event) => (this.value = (e.currentTarget as HTMLInputElement).value)}\n .value=${this.value || ''}\n >\n <optgroup label=\"String(${i18next.t('label.second by second')})\">\n <option value=\"* * * * * *\">${i18next.t('text.every second')}</option>\n <option value=\"0/2 * * * * *\">${i18next.t('text.every 2 seconds')}</option>\n <option value=\"0/15 * * * * *\">${i18next.t('text.every 15 seconds')}</option>\n <option value=\"0/30 * * * * *\">${i18next.t('text.every 30 seconds')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.minute by minute')})\">\n <option value=\"0 * * * * *\">${i18next.t('text.every minute')}</option>\n <option value=\"0 0/2 * * * *\">${i18next.t('text.every 2 minutes')}</option>\n <option value=\"0 0/15 * * * *\">${i18next.t('text.every 15 minutes')}</option>\n <option value=\"0 0/30 * * * *\">${i18next.t('text.every half hour')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.hourly')})\">\n <option value=\"0 0 * * * *\">${i18next.t('text.every hour')}</option>\n <option value=\"0 0 0/2 * * *\">${i18next.t('text.every 2 hours')}</option>\n <option value=\"0 0 0/12 * * *\">${i18next.t('text.every 12 hours')}</option>\n <option value=\"0 0 10-19 * * *\">${i18next.t('text.every hour during working time')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.daily')})\">\n <option value=\"0 0 0 * * *\">${i18next.t('text.every day')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.weekly')})\">\n <option value=\"0 0 0 * * SUN\">${i18next.t('text.every sunday')}</option>\n <option value=\"0 0 0 * * 0\">${i18next.t('text.every sunday')}(2)</option>\n <option value=\"0 0 0 * * 1-5\">${i18next.t('text.every weekday')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.monthly')})\">\n <option value=\"0 0 0 1 * *\">${i18next.t('text.the first day of every month')}</option>\n <option value=\"0 0 10 21 * *\">${i18next.t('text.10 am on every payday')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.yearly')})\">\n <option value=\"0 0 0 1 1 *\">${i18next.t('text.the first day of every year')}</option>\n <option value=\"0 0 0 25 12 *\">${i18next.t('text.every christmas')}</option>\n </optgroup>\n </select>\n <div id=\"input-wrapper\">\n <div>\n <input\n id=\"second-input\"\n class=\"second\"\n type=\"text\"\n .value=${this.second || ''}\n @input=${(e: Event) => (this.second = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('second')\n }}\n pattern=${createCronRegex('sec')}\n required\n />\n <label for=\"second-input\" class=\"second\">${i18next.t('label.second')}</label>\n </div>\n <div>\n <input\n id=\"minute-input\"\n class=\"minute\"\n type=\"text\"\n .value=${this.minute || ''}\n @input=${(e: Event) => (this.minute = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('minute')\n }}\n pattern=${createCronRegex('min')}\n required\n />\n <label for=\"minute-input\" class=\"minute\">${i18next.t('label.minute')}</label>\n </div>\n <div>\n <input\n id=\"hour-input\"\n class=\"hour\"\n type=\"text\"\n .value=${this.hour || ''}\n @input=${(e: Event) => (this.hour = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('hour')\n }}\n pattern=${createCronRegex('hour')}\n required\n />\n <label for=\"hour-input\" class=\"hour\">${i18next.t('label.hour')}</label>\n </div>\n <div>\n <input\n id=\"day-of-month-input\"\n class=\"day-of-month\"\n type=\"text\"\n .value=${this.dayOfMonth || ''}\n @input=${(e: Event) => (this.dayOfMonth = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('dayOfMonth')\n }}\n pattern=${createCronRegex('day')}\n required\n />\n <label for=\"day-of-month-input\" class=\"day-of-month\">${i18next.t('label.day-of-month')}</label>\n </div>\n <div>\n <input\n id=\"month-input\"\n class=\"month\"\n type=\"text\"\n .value=${this.month || ''}\n @input=${(e: Event) => (this.month = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('month')\n }}\n pattern=${createCronRegex('month')}\n required\n />\n <label for=\"month-input\" class=\"month\">${i18next.t('label.month')}</label>\n </div>\n <div>\n <input\n id=\"day-of-week-input\"\n class=\"day-of-week\"\n type=\"text\"\n .value=${this.dayOfWeek || ''}\n @input=${(e: Event) => (this.dayOfWeek = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('dayOfWeek')\n }}\n pattern=${createCronRegex('dayOfWeek')}\n required\n />\n <label for=\"day-of-week-input\" class=\"day-of-week\">${i18next.t('label.day-of-week')}</label>\n </div>\n </div>\n <div id=\"tooltip\">\n ${this.tooltip.map(\n tip => html`\n <div class=\"crontab-value\">${tip.value}</div>\n <div class=\"crontab-description\">${i18next.t(`text.${tip.description}`)}</div>\n `\n )}\n </div>\n <div id=\"button-wrapper\">\n <md-fab\n title=\"clear\"\n @click=${(e: Event) => {\n e.preventDefault()\n e.stopPropagation()\n this.value = ''\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }}\n >\n <md-icon slot=\"icon\">delete</md-icon>\n </md-fab>\n </div>\n </form>\n `\n }\n\n get focusableElements(): HTMLElement[] {\n return Array.from(this.renderRoot.querySelectorAll('select, input, button'))\n }\n\n firstUpdated() {\n ;(this.renderRoot.querySelector('input') as HTMLInputElement).focus()\n this.renderRoot.addEventListener('change', this.onChange.bind(this))\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value')) {\n var values = (this.value || '').split(' ')\n\n if (values.length == 1) values = ['*', '*', '*', '*', '*', '*']\n else if (values.length == 5) values = ['0'].concat(values)\n\n this.second = values[0]\n this.minute = values[1]\n this.hour = values[2]\n this.dayOfMonth = values[3]\n this.month = values[4]\n this.dayOfWeek = values[5]\n }\n }\n\n showTooltip(type: 'second' | 'minute' | 'hour' | 'dayOfMonth' | 'month' | 'dayOfWeek') {\n switch (type) {\n case 'second':\n case 'minute':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '0-59',\n description: 'allowed values'\n }\n ]\n break\n case 'hour':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '0-23',\n description: 'allowed values'\n }\n ]\n break\n\n case 'dayOfMonth':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '1-31',\n description: 'allowed values'\n }\n ]\n break\n\n case 'month':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '1-12',\n description: 'allowed values'\n },\n {\n value: 'JAN-DEC',\n description: 'alternative single values'\n }\n ]\n break\n\n case 'dayOfWeek':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '0-6',\n description: 'allowed values'\n },\n {\n value: 'SUN-SAT',\n description: 'alternative single values'\n }\n ]\n break\n\n default:\n this.tooltip = []\n break\n }\n }\n\n onChange() {\n var form = this.renderRoot.querySelector('form') as HTMLFormElement\n var valid = form.checkValidity()\n if (!valid) {\n form.reportValidity()\n return\n }\n\n this.value = `${this.second} ${this.minute} ${this.hour} ${this.dayOfMonth} ${this.month} ${this.dayOfWeek}`\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"ox-input-crontab.js","sourceRoot":"","sources":["../../src/ox-input-crontab.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,0BAA0B,CAAA;AACjC,OAAO,4BAA4B,CAAA;AAEnC,SAAS,eAAe,CAAC,IAA4D;IACnF,yDAAyD;IACzD,IAAI,YAAY,GAAG,EAAS,CAAA;IAC5B,YAAY,CAAC,KAAK,CAAC,GAAG,WAAW,CAAA;IACjC,YAAY,CAAC,KAAK,CAAC,GAAG,WAAW,CAAA;IACjC,YAAY,CAAC,MAAM,CAAC,GAAG,iBAAiB,CAAA;IACxC,YAAY,CAAC,KAAK,CAAC,GAAG,uBAAuB,CAAA;IAC7C,YAAY,CAAC,OAAO,CAAC,GAAG,cAAc,CAAA;IACtC,YAAY,CAAC,WAAW,CAAC,GAAG,OAAO,CAAA;IAEnC,IAAI,aAAa,GAAG,CAAC,IAAI,CAAC,CAAA;IAC1B,IAAI,CAAC,IAAI;QAAE,aAAa,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,CAAA;IAE9E,aAAa,CAAC,OAAO,CAAC,KAA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CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAgB;AACf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAgB;AACf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAc;AACb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAoB;AACnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAmB;AAErC;IAAR,KAAK,EAAE;+CAAuD;AA7JpD,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CA8f1B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, html, PropertyValues } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\n\nimport { OxFormField } from './ox-form-field.js'\n\nimport '@material/web/fab/fab.js'\nimport '@material/web/icon/icon.js'\n\nfunction createCronRegex(type: 'sec' | 'min' | 'hour' | 'day' | 'month' | 'dayOfWeek') {\n // https://gist.github.com/dkandalov/a2aed17cfdeb65243022\n var regexByField = {} as any\n regexByField['sec'] = '[0-5]?\\\\d'\n regexByField['min'] = '[0-5]?\\\\d'\n regexByField['hour'] = '[01]?\\\\d|2[0-3]'\n regexByField['day'] = '0?[1-9]|[12]\\\\d|3[01]'\n regexByField['month'] = '[1-9]|1[012]'\n regexByField['dayOfWeek'] = '[0-7]'\n\n var crontabFields = [type]\n if (!type) crontabFields = ['sec', 'min', 'hour', 'day', 'month', 'dayOfWeek']\n\n crontabFields.forEach(field => {\n var number = regexByField[field]\n var range =\n '(?:' +\n number +\n ')' +\n '(?:' +\n '(?:-|/|,' +\n ('dayOfWeek' === field ? '|#' : '') +\n ')' +\n '(?:' +\n number +\n ')' +\n ')?'\n if (field === 'dayOfWeek') range += '(?:L)?'\n if (field === 'month') range += '(?:L|W)?'\n regexByField[field] = '\\\\?|\\\\*|' + range + '(?:,' + range + ')*'\n })\n\n var monthValues = 'JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC'\n var monthRange = '(?:' + monthValues + ')(?:(?:-)(?:' + monthValues + '))?'\n regexByField['month'] += '|\\\\?|\\\\*|' + monthRange + '(?:,' + monthRange + ')*'\n\n var dayOfWeekValues = 'MON|TUE|WED|THU|FRI|SAT|SUN'\n var dayOfWeekRange = '(?:' + dayOfWeekValues + ')(?:(?:-)(?:' + dayOfWeekValues + '))?'\n regexByField['dayOfWeek'] += '|\\\\?|\\\\*|' + dayOfWeekRange + '(?:,' + dayOfWeekRange + ')*'\n\n if (!type)\n return (\n '^\\\\s*($' +\n '|#' +\n '|\\\\w+\\\\s*=' +\n '|' +\n '(' +\n regexByField['sec'] +\n ')\\\\s+' +\n '(' +\n regexByField['min'] +\n ')\\\\s+' +\n '(' +\n regexByField['hour'] +\n ')\\\\s+' +\n '(' +\n regexByField['day'] +\n ')\\\\s+' +\n '(' +\n regexByField['month'] +\n ')\\\\s+' +\n '(' +\n regexByField['dayOfWeek'] +\n ')(|\\\\s)+' +\n ')$'\n )\n else return `^${regexByField[type]}$`\n}\n\n@customElement('ox-input-crontab')\nexport class OxInputCrontab extends OxFormField {\n static styles = css`\n :host {\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n border: 0;\n }\n\n :host * {\n box-sizing: border-box;\n }\n :host *:focus {\n outline: none;\n }\n\n form {\n display: grid;\n width: 100%;\n height: 100%;\n padding: 1rem;\n grid-template: auto auto 1fr auto / repeat(6, 1fr);\n grid-gap: 0.5rem;\n justify-content: center;\n align-items: center;\n overflow: auto;\n }\n\n label[for='example'] {\n text-align: right;\n grid-column: 3;\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n text-transform: capitalize;\n }\n\n #example {\n grid-column: 4 / span 3;\n width: 100%;\n box-sizing: border-box;\n padding: 0 var(--spacing-small);\n height: var(--form-element-height-medium);\n border: 1px solid var(--md-sys-color-outline);\n border-radius: var(--md-sys-shape-corner-small);\n background-color: var(--md-sys-color-on-primary);\n text-transform: capitalize;\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n }\n\n input {\n width: 100%;\n box-sizing: border-box;\n padding: 0 var(--spacing-small);\n height: var(--form-element-height-medium);\n border: 1px solid var(--md-sys-color-outline);\n border-radius: var(--md-sys-shape-corner-small);\n background-color: var(--md-sys-color-on-primary);\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n }\n\n input:focus {\n outline: none;\n border-color: var(--md-sys-color-secondary-fixed-dim);\n }\n\n input:invalid {\n border-color: var(--md-sys-color-error);\n color: var(--md-sys-color-error);\n }\n\n label {\n width: 100%;\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n }\n\n label:not([for='example']) {\n text-align: center;\n }\n\n #input-wrapper {\n grid-column: span 6;\n display: flex;\n flex-wrap: wrap;\n margin: 0 -0.25rem;\n }\n\n #input-wrapper > div {\n flex: 1;\n display: grid;\n grid-template-rows: 1fr auto;\n grid-gap: var(--spacing-small);\n min-width: 60px;\n max-width: 33%;\n margin: 0.25rem;\n }\n\n #tooltip {\n grid-column: span 6;\n display: grid;\n grid-template-columns: auto 1fr;\n grid-gap: 0;\n margin: auto;\n grid-auto-rows: min-content;\n align-self: center;\n align-items: center;\n }\n\n #tooltip > div {\n padding: 0.25rem 0.5rem;\n border-bottom: var(--md-sys-color-on-surface-variant) 1px dashed;\n font-size: var(--md-sys-typescale-label-large-size, 0.875rem);\n color: var(--md-sys-color-on-primary-container);\n }\n\n #tooltip > .crontab-value {\n text-align: right;\n color: var(--md-sys-color-surface-tint);\n }\n\n #tooltip > .crontab-description {\n text-align: left;\n color: var (--md-sys-color-on-primary-container);\n }\n\n #button-wrapper {\n grid-column: 1 / span 6;\n display: flex;\n flex-wrap: wrap-reverse;\n flex-direction: row-reverse;\n margin: -0.25rem;\n }\n\n md-fab {\n margin: 0.25rem;\n position: absolute;\n bottom: 1rem;\n left: 1rem;\n color: var(--md-sys-color-on-primary);\n }\n\n md-icon {\n font-size: 24px;\n }\n `\n\n @property({ type: String }) value?: string = undefined\n @property({ type: String }) second?: string\n @property({ type: String }) minute?: string\n @property({ type: String }) hour?: string\n @property({ type: String }) dayOfMonth?: string\n @property({ type: String }) month?: string\n @property({ type: String }) dayOfWeek?: string\n\n @state() tooltip: { value: string; description: string }[] = []\n\n render() {\n return html`\n <form>\n <label for=\"example\">${i18next.t('label.examples')}</label>\n <select\n id=\"example\"\n @change=${(e: Event) => (this.value = (e.currentTarget as HTMLInputElement).value)}\n .value=${this.value || ''}\n >\n <optgroup label=\"String(${i18next.t('label.second by second')})\">\n <option value=\"* * * * * *\">${i18next.t('text.every second')}</option>\n <option value=\"0/2 * * * * *\">${i18next.t('text.every 2 seconds')}</option>\n <option value=\"0/15 * * * * *\">${i18next.t('text.every 15 seconds')}</option>\n <option value=\"0/30 * * * * *\">${i18next.t('text.every 30 seconds')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.minute by minute')})\">\n <option value=\"0 * * * * *\">${i18next.t('text.every minute')}</option>\n <option value=\"0 0/2 * * * *\">${i18next.t('text.every 2 minutes')}</option>\n <option value=\"0 0/15 * * * *\">${i18next.t('text.every 15 minutes')}</option>\n <option value=\"0 0/30 * * * *\">${i18next.t('text.every half hour')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.hourly')})\">\n <option value=\"0 0 * * * *\">${i18next.t('text.every hour')}</option>\n <option value=\"0 0 0/2 * * *\">${i18next.t('text.every 2 hours')}</option>\n <option value=\"0 0 0/12 * * *\">${i18next.t('text.every 12 hours')}</option>\n <option value=\"0 0 10-19 * * *\">${i18next.t('text.every hour during working time')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.daily')})\">\n <option value=\"0 0 0 * * *\">${i18next.t('text.every day')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.weekly')})\">\n <option value=\"0 0 0 * * SUN\">${i18next.t('text.every sunday')}</option>\n <option value=\"0 0 0 * * 0\">${i18next.t('text.every sunday')}(2)</option>\n <option value=\"0 0 0 * * 1-5\">${i18next.t('text.every weekday')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.monthly')})\">\n <option value=\"0 0 0 1 * *\">${i18next.t('text.the first day of every month')}</option>\n <option value=\"0 0 10 21 * *\">${i18next.t('text.10 am on every payday')}</option>\n </optgroup>\n <optgroup label=\"String(${i18next.t('label.yearly')})\">\n <option value=\"0 0 0 1 1 *\">${i18next.t('text.the first day of every year')}</option>\n <option value=\"0 0 0 25 12 *\">${i18next.t('text.every christmas')}</option>\n </optgroup>\n </select>\n <div id=\"input-wrapper\">\n <div>\n <input\n id=\"second-input\"\n class=\"second\"\n type=\"text\"\n .value=${this.second || ''}\n @input=${(e: Event) => (this.second = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('second')\n }}\n pattern=${createCronRegex('sec')}\n required\n />\n <label for=\"second-input\" class=\"second\">${i18next.t('label.second')}</label>\n </div>\n <div>\n <input\n id=\"minute-input\"\n class=\"minute\"\n type=\"text\"\n .value=${this.minute || ''}\n @input=${(e: Event) => (this.minute = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('minute')\n }}\n pattern=${createCronRegex('min')}\n required\n />\n <label for=\"minute-input\" class=\"minute\">${i18next.t('label.minute')}</label>\n </div>\n <div>\n <input\n id=\"hour-input\"\n class=\"hour\"\n type=\"text\"\n .value=${this.hour || ''}\n @input=${(e: Event) => (this.hour = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('hour')\n }}\n pattern=${createCronRegex('hour')}\n required\n />\n <label for=\"hour-input\" class=\"hour\">${i18next.t('label.hour')}</label>\n </div>\n <div>\n <input\n id=\"day-of-month-input\"\n class=\"day-of-month\"\n type=\"text\"\n .value=${this.dayOfMonth || ''}\n @input=${(e: Event) => (this.dayOfMonth = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('dayOfMonth')\n }}\n pattern=${createCronRegex('day')}\n required\n />\n <label for=\"day-of-month-input\" class=\"day-of-month\">${i18next.t('label.day-of-month')}</label>\n </div>\n <div>\n <input\n id=\"month-input\"\n class=\"month\"\n type=\"text\"\n .value=${this.month || ''}\n @input=${(e: Event) => (this.month = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('month')\n }}\n pattern=${createCronRegex('month')}\n required\n />\n <label for=\"month-input\" class=\"month\">${i18next.t('label.month')}</label>\n </div>\n <div>\n <input\n id=\"day-of-week-input\"\n class=\"day-of-week\"\n type=\"text\"\n .value=${this.dayOfWeek || ''}\n @input=${(e: Event) => (this.dayOfWeek = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('dayOfWeek')\n }}\n pattern=${createCronRegex('dayOfWeek')}\n required\n />\n <label for=\"day-of-week-input\" class=\"day-of-week\">${i18next.t('label.day-of-week')}</label>\n </div>\n </div>\n <div id=\"tooltip\">\n ${this.tooltip.map(\n tip => html`\n <div class=\"crontab-value\">${tip.value}</div>\n <div class=\"crontab-description\">${i18next.t(`text.${tip.description}`)}</div>\n `\n )}\n </div>\n <div id=\"button-wrapper\">\n <md-fab\n title=\"clear\"\n @click=${(e: Event) => {\n e.preventDefault()\n e.stopPropagation()\n this.value = ''\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }}\n >\n <md-icon slot=\"icon\">delete</md-icon>\n </md-fab>\n </div>\n </form>\n `\n }\n\n get focusableElements(): HTMLElement[] {\n return Array.from(this.renderRoot.querySelectorAll('select, input, button'))\n }\n\n firstUpdated() {\n ;(this.renderRoot.querySelector('input') as HTMLInputElement).focus()\n this.renderRoot.addEventListener('change', this.onChange.bind(this))\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value')) {\n var values = (this.value || '').split(' ')\n\n if (values.length == 1) values = ['*', '*', '*', '*', '*', '*']\n else if (values.length == 5) values = ['0'].concat(values)\n\n this.second = values[0]\n this.minute = values[1]\n this.hour = values[2]\n this.dayOfMonth = values[3]\n this.month = values[4]\n this.dayOfWeek = values[5]\n }\n }\n\n showTooltip(type: 'second' | 'minute' | 'hour' | 'dayOfMonth' | 'month' | 'dayOfWeek') {\n switch (type) {\n case 'second':\n case 'minute':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '0-59',\n description: 'allowed values'\n }\n ]\n break\n case 'hour':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '0-23',\n description: 'allowed values'\n }\n ]\n break\n\n case 'dayOfMonth':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '1-31',\n description: 'allowed values'\n }\n ]\n break\n\n case 'month':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '1-12',\n description: 'allowed values'\n },\n {\n value: 'JAN-DEC',\n description: 'alternative single values'\n }\n ]\n break\n\n case 'dayOfWeek':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '0-6',\n description: 'allowed values'\n },\n {\n value: 'SUN-SAT',\n description: 'alternative single values'\n }\n ]\n break\n\n default:\n this.tooltip = []\n break\n }\n }\n\n onChange() {\n var form = this.renderRoot.querySelector('form') as HTMLFormElement\n var valid = form.checkValidity()\n if (!valid) {\n form.reportValidity()\n return\n }\n\n this.value = `${this.second} ${this.minute} ${this.hour} ${this.dayOfMonth} ${this.month} ${this.dayOfWeek}`\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
|
@@ -15,7 +15,7 @@ Example:
|
|
15
15
|
</ox-input-data>
|
16
16
|
*/
|
17
17
|
let OxInputData = class OxInputData extends OxFormField {
|
18
|
-
static styles = [
|
18
|
+
static { this.styles = [
|
19
19
|
css `
|
20
20
|
:host {
|
21
21
|
display: flex;
|
@@ -50,7 +50,7 @@ let OxInputData = class OxInputData extends OxFormField {
|
|
50
50
|
overflow: auto;
|
51
51
|
}
|
52
52
|
`
|
53
|
-
];
|
53
|
+
]; }
|
54
54
|
render() {
|
55
55
|
const valueType = typeof this.value;
|
56
56
|
return html `
|