@operato/app 1.0.0-alpha.9 → 1.0.0-beta.0

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.
Files changed (144) hide show
  1. package/@types/global/index.d.ts +2 -0
  2. package/CHANGELOG.md +318 -17
  3. package/demo/data-grist-test.html +15 -10
  4. package/demo/index.html +1 -10
  5. package/dist/src/{grist → grist-editor}/index.d.ts +0 -0
  6. package/dist/src/grist-editor/index.js +28 -0
  7. package/dist/src/grist-editor/index.js.map +1 -0
  8. package/dist/src/grist-editor/ox-grist-editor-code.d.ts +7 -0
  9. package/dist/src/grist-editor/ox-grist-editor-code.js +56 -0
  10. package/dist/src/grist-editor/ox-grist-editor-code.js.map +1 -0
  11. package/dist/src/grist-editor/ox-grist-editor-crontab.d.ts +8 -0
  12. package/dist/src/grist-editor/ox-grist-editor-crontab.js +50 -0
  13. package/dist/src/grist-editor/ox-grist-editor-crontab.js.map +1 -0
  14. package/dist/src/grist-editor/ox-grist-editor-json.d.ts +7 -0
  15. package/dist/src/grist-editor/ox-grist-editor-json.js +54 -0
  16. package/dist/src/grist-editor/ox-grist-editor-json.js.map +1 -0
  17. package/dist/src/grist-editor/ox-grist-editor-parameters.d.ts +12 -0
  18. package/dist/src/{grist/parameters-editor.js → grist-editor/ox-grist-editor-parameters.js} +16 -37
  19. package/dist/src/grist-editor/ox-grist-editor-parameters.js.map +1 -0
  20. package/dist/src/grist-editor/ox-grist-editor-partition-keys.d.ts +11 -0
  21. package/dist/src/grist-editor/ox-grist-editor-partition-keys.js +74 -0
  22. package/dist/src/grist-editor/ox-grist-editor-partition-keys.js.map +1 -0
  23. package/dist/src/{grist/code-editor.d.ts → grist-editor/ox-grist-editor-resource-code.d.ts} +2 -2
  24. package/dist/src/{grist/code-editor.js → grist-editor/ox-grist-editor-resource-code.js} +10 -5
  25. package/dist/src/grist-editor/ox-grist-editor-resource-code.js.map +1 -0
  26. package/dist/src/grist-editor/ox-grist-editor-resource-id.d.ts +10 -0
  27. package/dist/src/{grist/id-input.js → grist-editor/ox-grist-editor-resource-id.js} +18 -67
  28. package/dist/src/grist-editor/ox-grist-editor-resource-id.js.map +1 -0
  29. package/dist/src/grist-editor/ox-grist-editor-resource-object.d.ts +11 -0
  30. package/dist/src/{grist/object-editor.js → grist-editor/ox-grist-editor-resource-object.js} +14 -64
  31. package/dist/src/grist-editor/ox-grist-editor-resource-object.js.map +1 -0
  32. package/dist/src/grist-editor/ox-grist-editor-value-map.d.ts +11 -0
  33. package/dist/src/grist-editor/ox-grist-editor-value-map.js +74 -0
  34. package/dist/src/grist-editor/ox-grist-editor-value-map.js.map +1 -0
  35. package/dist/src/grist-editor/ox-grist-renderer-crontab.d.ts +2 -0
  36. package/dist/src/grist-editor/ox-grist-renderer-crontab.js +26 -0
  37. package/dist/src/grist-editor/ox-grist-renderer-crontab.js.map +1 -0
  38. package/dist/src/grist-editor/ox-grist-renderer-resource-id.d.ts +2 -0
  39. package/dist/src/grist-editor/ox-grist-renderer-resource-id.js +9 -0
  40. package/dist/src/grist-editor/ox-grist-renderer-resource-id.js.map +1 -0
  41. package/dist/src/grist-editor/ox-grist-renderer-resource-object.d.ts +2 -0
  42. package/dist/src/grist-editor/ox-grist-renderer-resource-object.js +22 -0
  43. package/dist/src/grist-editor/ox-grist-renderer-resource-object.js.map +1 -0
  44. package/dist/src/{grist/parameters-editor-builder.d.ts → grist-editor/ox-parameters-builder.d.ts} +1 -1
  45. package/dist/src/{grist/parameters-editor-builder.js → grist-editor/ox-parameters-builder.js} +10 -11
  46. package/dist/src/grist-editor/ox-parameters-builder.js.map +1 -0
  47. package/dist/src/grist-editor/ox-popup-code-input.d.ts +12 -0
  48. package/dist/src/grist-editor/ox-popup-code-input.js +71 -0
  49. package/dist/src/grist-editor/ox-popup-code-input.js.map +1 -0
  50. package/dist/src/grist-editor/ox-popup-crontab-input.d.ts +11 -0
  51. package/dist/src/grist-editor/ox-popup-crontab-input.js +74 -0
  52. package/dist/src/grist-editor/ox-popup-crontab-input.js.map +1 -0
  53. package/dist/src/{grist/parameters-editor-popup.d.ts → grist-editor/ox-popup-parameters-builder.d.ts} +1 -1
  54. package/dist/src/{grist/parameters-editor-popup.js → grist-editor/ox-popup-parameters-builder.js} +15 -15
  55. package/dist/src/grist-editor/ox-popup-parameters-builder.js.map +1 -0
  56. package/dist/src/grist-editor/ox-popup-partition-keys-input.d.ts +12 -0
  57. package/dist/src/grist-editor/ox-popup-partition-keys-input.js +98 -0
  58. package/dist/src/grist-editor/ox-popup-partition-keys-input.js.map +1 -0
  59. package/dist/src/grist-editor/ox-popup-value-map-input.d.ts +12 -0
  60. package/dist/src/grist-editor/ox-popup-value-map-input.js +104 -0
  61. package/dist/src/grist-editor/ox-popup-value-map-input.js.map +1 -0
  62. package/dist/src/{grist/id-selector.d.ts → grist-editor/ox-selector-resource-id.d.ts} +1 -1
  63. package/dist/src/{grist/id-selector.js → grist-editor/ox-selector-resource-id.js} +15 -15
  64. package/dist/src/grist-editor/ox-selector-resource-id.js.map +1 -0
  65. package/dist/src/{grist/object-selector.d.ts → grist-editor/ox-selector-resource-object.d.ts} +1 -1
  66. package/dist/src/{grist/object-selector.js → grist-editor/ox-selector-resource-object.js} +22 -22
  67. package/dist/src/grist-editor/ox-selector-resource-object.js.map +1 -0
  68. package/dist/src/index.d.ts +3 -1
  69. package/dist/src/index.js +3 -1
  70. package/dist/src/index.js.map +1 -1
  71. package/dist/src/input/index.d.ts +3 -0
  72. package/dist/src/input/index.js +4 -0
  73. package/dist/src/input/index.js.map +1 -0
  74. package/dist/src/input/ox-input-background-pattern.d.ts +1 -1
  75. package/dist/src/input/ox-input-background-pattern.js +6 -3
  76. package/dist/src/input/ox-input-background-pattern.js.map +1 -1
  77. package/dist/src/input/ox-input-fill-style.d.ts +2 -3
  78. package/dist/src/input/ox-input-fill-style.js +2 -2
  79. package/dist/src/input/ox-input-fill-style.js.map +1 -1
  80. package/dist/src/input/ox-input-graphql.d.ts +36 -0
  81. package/dist/src/input/ox-input-graphql.js +161 -0
  82. package/dist/src/input/ox-input-graphql.js.map +1 -0
  83. package/dist/src/property-editor/index.d.ts +24 -0
  84. package/dist/src/property-editor/index.js +58 -0
  85. package/dist/src/property-editor/index.js.map +1 -0
  86. package/dist/src/property-editor/ox-property-editor-graphql.d.ts +5 -0
  87. package/dist/src/property-editor/ox-property-editor-graphql.js +15 -0
  88. package/dist/src/property-editor/ox-property-editor-graphql.js.map +1 -0
  89. package/dist/tsconfig.tsbuildinfo +1 -1
  90. package/package.json +44 -22
  91. package/src/grist-editor/index.ts +30 -0
  92. package/src/grist-editor/ox-grist-editor-code.ts +64 -0
  93. package/src/grist-editor/ox-grist-editor-crontab.ts +62 -0
  94. package/src/grist-editor/ox-grist-editor-json.ts +62 -0
  95. package/src/{grist/parameters-editor.ts → grist-editor/ox-grist-editor-parameters.ts} +13 -26
  96. package/src/grist-editor/ox-grist-editor-partition-keys.ts +86 -0
  97. package/src/{grist/code-editor.ts → grist-editor/ox-grist-editor-resource-code.ts} +4 -5
  98. package/src/grist-editor/ox-grist-editor-resource-id.ts +83 -0
  99. package/src/{grist/object-editor.ts → grist-editor/ox-grist-editor-resource-object.ts} +11 -48
  100. package/src/grist-editor/ox-grist-editor-value-map.ts +86 -0
  101. package/src/grist-editor/ox-grist-renderer-crontab.ts +30 -0
  102. package/src/{grist/id-renderer.ts → grist-editor/ox-grist-renderer-resource-id.ts} +4 -3
  103. package/src/grist-editor/ox-grist-renderer-resource-object.ts +26 -0
  104. package/src/{grist/parameters-editor-builder.ts → grist-editor/ox-parameters-builder.ts} +4 -6
  105. package/src/grist-editor/ox-popup-code-input.ts +65 -0
  106. package/src/grist-editor/ox-popup-crontab-input.ts +74 -0
  107. package/src/{grist/parameters-editor-popup.ts → grist-editor/ox-popup-parameters-builder.ts} +5 -5
  108. package/src/grist-editor/ox-popup-partition-keys-input.ts +95 -0
  109. package/src/grist-editor/ox-popup-value-map-input.ts +101 -0
  110. package/src/{grist/id-selector.ts → grist-editor/ox-selector-resource-id.ts} +2 -2
  111. package/src/{grist/object-selector.ts → grist-editor/ox-selector-resource-object.ts} +4 -4
  112. package/src/index.ts +3 -1
  113. package/src/input/index.ts +3 -0
  114. package/src/input/ox-input-background-pattern.ts +6 -3
  115. package/src/input/ox-input-fill-style.ts +3 -4
  116. package/src/input/ox-input-graphql.ts +169 -0
  117. package/src/property-editor/index.ts +59 -0
  118. package/src/property-editor/ox-property-editor-graphql.ts +12 -0
  119. package/themes/app-theme.css +142 -0
  120. package/themes/grist-theme.css +194 -0
  121. package/themes/oops-theme.css +26 -0
  122. package/themes/report-theme.css +47 -0
  123. package/dist/src/grist/code-editor.js.map +0 -1
  124. package/dist/src/grist/id-input.d.ts +0 -19
  125. package/dist/src/grist/id-input.js.map +0 -1
  126. package/dist/src/grist/id-renderer.d.ts +0 -2
  127. package/dist/src/grist/id-renderer.js +0 -9
  128. package/dist/src/grist/id-renderer.js.map +0 -1
  129. package/dist/src/grist/id-selector.js.map +0 -1
  130. package/dist/src/grist/index.js +0 -11
  131. package/dist/src/grist/index.js.map +0 -1
  132. package/dist/src/grist/object-editor.d.ts +0 -18
  133. package/dist/src/grist/object-editor.js.map +0 -1
  134. package/dist/src/grist/object-selector.js.map +0 -1
  135. package/dist/src/grist/parameters-editor-builder.js.map +0 -1
  136. package/dist/src/grist/parameters-editor-popup.js.map +0 -1
  137. package/dist/src/grist/parameters-editor.d.ts +0 -19
  138. package/dist/src/grist/parameters-editor.js.map +0 -1
  139. package/dist/src/input/ox-input-color-gradient.d.ts +0 -25
  140. package/dist/src/input/ox-input-color-gradient.js +0 -318
  141. package/dist/src/input/ox-input-color-gradient.js.map +0 -1
  142. package/src/grist/id-input.ts +0 -135
  143. package/src/grist/index.ts +0 -13
  144. package/src/input/ox-input-color-gradient.ts +0 -341
@@ -1,135 +0,0 @@
1
- import '@material/mwc-icon'
2
- import './id-selector.js'
3
-
4
- import { ColumnConfig, GristRecord, InputEditor } from '@operato/data-grist'
5
- import { TemplateResult, css, html } from 'lit'
6
- import { customElement, property } from 'lit/decorators.js'
7
-
8
- import { openPopup } from '@operato/layout'
9
-
10
- @customElement('ox-id-input')
11
- export class IdInput extends InputEditor {
12
- static styles = css`
13
- :host {
14
- display: flex;
15
- flex-flow: row nowrap;
16
- align-items: center;
17
-
18
- padding: 7px 0px;
19
- box-sizing: border-box;
20
-
21
- width: 100%;
22
- height: 100%;
23
-
24
- border: 0;
25
- background-color: transparent;
26
-
27
- font: var(--grist-object-editor-font);
28
- color: var(--grist-object-editor-color);
29
-
30
- justify-content: inherit;
31
- }
32
-
33
- span {
34
- display: flex;
35
- flex: auto;
36
-
37
- justify-content: inherit;
38
- }
39
-
40
- mwc-icon {
41
- width: 20px;
42
- font-size: 1.5em;
43
- margin-left: auto;
44
- }
45
- `
46
-
47
- @property({ type: Object }) value?: { id?: string; [propany: string]: any }
48
- @property({ type: Object }) column!: ColumnConfig
49
- @property({ type: Object }) record!: GristRecord
50
- @property({ type: Number }) row!: number
51
-
52
- private popup?: {
53
- name: string
54
- close: () => void
55
- closed: boolean
56
- onclosed?: (() => void) | undefined
57
- }
58
-
59
- private template?: TemplateResult
60
-
61
- render() {
62
- var { nameField = 'name', descriptionField = 'description' } = this.column.record.options || {}
63
- var value = this.value
64
-
65
- return html`
66
- ${!value ? html`` : html` <span>${value[nameField]} (${value[descriptionField]})</span> `}
67
- <mwc-icon>arrow_drop_down</mwc-icon>
68
- `
69
- }
70
-
71
- async firstUpdated() {
72
- this.value = this.record[this.column.name]
73
- this.template = ((this.column.record || {}).options || {}).template
74
-
75
- await this.updateComplete
76
-
77
- this.renderRoot.addEventListener('click', e => {
78
- e.stopPropagation()
79
-
80
- this.openSelector()
81
- })
82
-
83
- this.openSelector()
84
- }
85
-
86
- openSelector() {
87
- if (this.popup) {
88
- delete this.popup
89
- }
90
-
91
- const confirmCallback: (record: GristRecord | undefined) => void = selected => {
92
- if (!selected) {
93
- return
94
- }
95
-
96
- var { idField = 'id', nameField = 'name', descriptionField = 'description' } = this.column.record.options || {}
97
-
98
- this.dispatchEvent(
99
- new CustomEvent('field-change', {
100
- bubbles: true,
101
- composed: true,
102
- detail: {
103
- before: this.value,
104
- after: {
105
- [idField]: selected[idField],
106
- [nameField]: selected[nameField],
107
- [descriptionField]: selected[descriptionField]
108
- },
109
- record: this.record,
110
- column: this.column,
111
- row: this.row
112
- }
113
- })
114
- )
115
- }
116
-
117
- var value = this.value || {}
118
- var template =
119
- this.template ||
120
- html`
121
- <ox-id-selector
122
- .value=${value.id}
123
- .confirmCallback=${confirmCallback.bind(this)}
124
- .queryName=${this.column.record.options.queryName}
125
- .basicArgs=${this.column.record.options.basicArgs}
126
- ></ox-id-selector>
127
- `
128
-
129
- this.popup = openPopup(template, {
130
- backdrop: true,
131
- size: 'large',
132
- title: 'select item'
133
- })
134
- }
135
- }
@@ -1,13 +0,0 @@
1
- import { registerEditor, registerRenderer } from '@operato/data-grist'
2
-
3
- import { CodeEditor } from './code-editor'
4
- import { IdInput } from './id-input.js'
5
- import { IdRenderer } from './id-renderer.js'
6
- import { ObjectEditor } from './object-editor'
7
-
8
- /* register grist renderer/editor for id */
9
- registerEditor('id', IdInput)
10
- registerEditor('object', ObjectEditor as any)
11
- registerEditor('code', CodeEditor)
12
-
13
- registerRenderer('id', IdRenderer)
@@ -1,341 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import '@operato/i18n/ox-i18n.js'
6
- import '@polymer/paper-dropdown-menu/paper-dropdown-menu'
7
- import '@polymer/paper-listbox/paper-listbox'
8
- import '@polymer/paper-item/paper-item'
9
- import '@operato/input/ox-input-angle.js'
10
- import '@operato/input/ox-input-color-stops.js'
11
-
12
- import { ColorStop, OxFormField } from '@operato/input'
13
- import { css, html } from 'lit'
14
- import { customElement, property } from 'lit/decorators.js'
15
-
16
- export type GradientOption = {
17
- type: 'linear' | 'radial'
18
- rotation: number
19
- direction?:
20
- | 'left-to-right'
21
- | 'lefttop-to-rightbottom'
22
- | 'top-to-bottom'
23
- | 'righttop-to-leftbottom'
24
- | 'right-to-left'
25
- | 'rightbottom-to-lefttop'
26
- | 'bottom-to-top'
27
- | 'leftbottom-to-righttop'
28
- | 'left-to-right'
29
- | 'center-to-corner'
30
- center?: 'center' | 'left-top' | 'right-top' | 'right-bottom' | 'left-bottom'
31
- colorStops?: ColorStop[]
32
- }
33
-
34
- @customElement('ox-input-color-gradient')
35
- export class OxInputColorGradient extends OxFormField {
36
- static styles = css`
37
- :host {
38
- display: grid;
39
-
40
- grid-template-columns: repeat(10, 1fr);
41
- grid-gap: 5px;
42
- grid-auto-rows: minmax(24px, auto);
43
-
44
- align-items: center;
45
- }
46
-
47
- :host > * {
48
- align-self: stretch;
49
- }
50
-
51
- :host > label {
52
- grid-column: span 2;
53
- text-align: right;
54
- text-transform: capitalize;
55
- align-self: center;
56
- }
57
-
58
- :host > .icon-only-label {
59
- grid-column: span 1;
60
- }
61
-
62
- :host > input,
63
- :host > [editors] {
64
- grid-column: span 8;
65
- }
66
-
67
- :host > select {
68
- grid-column: span 4;
69
- height: 100%;
70
- border: 1px solid rgba(0, 0, 0, 0.2);
71
- }
72
-
73
- :host > ox-input-angle {
74
- grid-column: span 3;
75
- }
76
-
77
- ox-input-color-stops {
78
- grid-column: span 10;
79
- }
80
-
81
- .host > input[type='checkbox'] {
82
- grid-column: 3 / 4;
83
- }
84
-
85
- .host > input[type='checkbox'] ~ label {
86
- grid-column: span 7;
87
- text-align: left;
88
- }
89
-
90
- [editors] > :not([active-selector]) {
91
- display: none;
92
- }
93
-
94
- [gradient-direction] {
95
- overflow: hidden;
96
- max-width: 210px;
97
- }
98
-
99
- [gradient-direction] paper-item {
100
- background: url(/assets/images/icon-editor-gradient-direction.png) 50% 0 no-repeat;
101
- min-height: 32px;
102
- padding: 3px 5px;
103
- width: 30px;
104
- float: left;
105
- }
106
-
107
- [gradient-direction] [name='lefttop-to-rightbottom'] {
108
- background-position: 50% 4px;
109
- }
110
-
111
- [gradient-direction] [name='left-top'] {
112
- background-position: 50% 4px;
113
- }
114
-
115
- [gradient-direction] [name='top-to-bottom'] {
116
- background-position: 50% -46px;
117
- }
118
-
119
- [gradient-direction] [name='righttop-to-leftbottom'] {
120
- background-position: 50% -96px;
121
- }
122
-
123
- [gradient-direction] [name='right-top'] {
124
- background-position: 50% -96px;
125
- }
126
-
127
- [gradient-direction] [name='right-to-left'] {
128
- background-position: 50% -146px;
129
- }
130
-
131
- [gradient-direction] [name='rightbottom-to-lefttop'] {
132
- background-position: 50% -196px;
133
- }
134
-
135
- [gradient-direction] [name='right-bottom'] {
136
- background-position: 50% -196px;
137
- }
138
-
139
- [gradient-direction] [name='bottom-to-top'] {
140
- background-position: 50% -246px;
141
- }
142
-
143
- [gradient-direction] [name='leftbottom-to-righttop'] {
144
- background-position: 50% -296px;
145
- }
146
-
147
- [gradient-direction] [name='left-bottom'] {
148
- background-position: 50% -296px;
149
- }
150
-
151
- [gradient-direction] [name='left-to-right'] {
152
- background-position: 50% -346px;
153
- }
154
-
155
- [gradient-direction] [name='center-to-corner'] {
156
- background-position: 50% -396px;
157
- }
158
-
159
- [gradient-direction] [name='center'] {
160
- background-position: 50% -396px;
161
- }
162
-
163
- [gradient-direction] paper-item[focused] {
164
- background-color: rgba(255, 246, 143, 0.5);
165
- }
166
-
167
- .icon-only-label {
168
- top: 0 !important;
169
- width: 30px !important;
170
- height: 24px;
171
- background: url(/assets/images/icon-properties-label.png) no-repeat;
172
- }
173
-
174
- .icon-only-label.color {
175
- background-position: 70% -198px;
176
- }
177
- `
178
-
179
- @property({ type: Object }) value: GradientOption = {
180
- type: 'linear',
181
- direction: 'left-to-right',
182
- rotation: 0
183
- }
184
-
185
- firstUpdated() {
186
- this.renderRoot.addEventListener('change', this._onChange.bind(this))
187
- }
188
-
189
- _onChange(e: Event) {
190
- var element = e.target as HTMLElement & { type: string }
191
- var key = element.getAttribute('value-key')
192
-
193
- if (!key) {
194
- return
195
- }
196
-
197
- var value
198
-
199
- switch (element.tagName) {
200
- case 'INPUT':
201
- switch (element.type) {
202
- case 'checkbox':
203
- value = (element as HTMLInputElement).checked
204
- break
205
- case 'number':
206
- value = Number((element as HTMLInputElement).value) || 0
207
- break
208
- case 'text':
209
- value = String((element as HTMLInputElement).value)
210
- }
211
- break
212
-
213
- case 'PAPER-BUTTON':
214
- value = (element as any).active
215
- break
216
-
217
- case 'PAPER-LISTBOX':
218
- value = (element as any).selected
219
- break
220
-
221
- default:
222
- value = (element as HTMLInputElement).value
223
- break
224
- }
225
-
226
- if (key === 'rotation') {
227
- this.value = {
228
- ...this.value,
229
- rotation: value,
230
- direction: undefined
231
- }
232
- } else if (key === 'direction') {
233
- if (value) {
234
- this.value = {
235
- ...this.value,
236
- direction: value,
237
- rotation: this._convertDirectionToRotation(value)
238
- }
239
- }
240
- } else {
241
- this.value = {
242
- ...this.value,
243
- [key]: value
244
- }
245
- }
246
-
247
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
248
- }
249
-
250
- render() {
251
- var selector = (this.value && this.value.type) || 'linear'
252
- var value = this.value || {}
253
-
254
- return html`
255
- <label> <ox-i18n msgid="label.type">type</ox-i18n> </label>
256
- <select value-key="type" .value=${value.type || 'linear'}>
257
- <option>linear</option>
258
- <option>radial</option>
259
- </select>
260
-
261
- <label class="icon-only-label color"></label>
262
- <ox-input-angle value-key="rotation" .value=${value.rotation || 0}> </ox-input-angle>
263
-
264
- <label> <ox-i18n msgid="label.direction">direction</ox-i18n> </label>
265
- <div editors>
266
- <paper-dropdown-menu no-label-float="true" ?active-selector=${selector == 'linear'} .value=${value.direction}>
267
- <paper-listbox
268
- @selected-changed=${(e: Event) => this._onChange(e)}
269
- value-key="direction"
270
- slot="dropdown-content"
271
- gradient-direction
272
- .selected=${value.direction}
273
- attr-for-selected="name"
274
- >
275
- <paper-item name="lefttop-to-rightbottom"></paper-item>
276
- <paper-item name="top-to-bottom"></paper-item>
277
- <paper-item name="righttop-to-leftbottom"></paper-item>
278
- <paper-item name="right-to-left"></paper-item>
279
- <paper-item name="rightbottom-to-lefttop"></paper-item>
280
- <paper-item name="bottom-to-top"></paper-item>
281
- <paper-item name="leftbottom-to-righttop"></paper-item>
282
- <paper-item name="left-to-right"></paper-item>
283
- <paper-item name="center-to-corner"></paper-item>
284
- </paper-listbox>
285
- </paper-dropdown-menu>
286
-
287
- <paper-dropdown-menu no-label-float="true" ?active-selector=${selector == 'radial'} .value=${value.center}>
288
- <paper-listbox
289
- @selected-changed=${(e: Event) => this._onChange(e)}
290
- value-key="center"
291
- slot="dropdown-content"
292
- gradient-direction
293
- .selected=${value.center || 'center'}
294
- attr-for-selected="name"
295
- >
296
- <paper-item name="center"></paper-item>
297
- <paper-item name="left-top"></paper-item>
298
- <paper-item name="right-top"></paper-item>
299
- <paper-item name="right-bottom"></paper-item>
300
- <paper-item name="left-bottom"></paper-item>
301
- </paper-listbox>
302
- </paper-dropdown-menu>
303
- </div>
304
-
305
- <ox-input-color-stops value-key="colorStops" type="gradient" .value=${value.colorStops}> </ox-input-color-stops>
306
- `
307
- }
308
-
309
- _convertDirectionToRotation(direction: string): number {
310
- var rotation
311
- switch (direction) {
312
- case 'lefttop-to-rightbottom':
313
- rotation = 45
314
- break
315
- case 'top-to-bottom':
316
- rotation = 90
317
- break
318
- case 'righttop-to-leftbottom':
319
- rotation = 135
320
- break
321
- case 'right-to-left':
322
- rotation = 180
323
- break
324
- case 'rightbottom-to-lefttop':
325
- rotation = 215
326
- break
327
- case 'bottom-to-top':
328
- rotation = 270
329
- break
330
- case 'leftbottom-to-righttop':
331
- rotation = 315
332
- break
333
- case 'left-to-right':
334
- default:
335
- rotation = 0
336
- break
337
- }
338
-
339
- return (rotation / 360) * Math.PI * 2
340
- }
341
- }