@operato/property-editor 1.0.0-beta.9 → 1.0.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.
- package/CHANGELOG.md +359 -0
- package/demo/index.html +19 -5
- package/dist/src/ox-properties-dynamic-view.js +14 -10
- package/dist/src/ox-properties-dynamic-view.js.map +1 -1
- package/dist/src/ox-property-editor-angle.d.ts +2 -1
- package/dist/src/ox-property-editor-angle.js +4 -6
- package/dist/src/ox-property-editor-angle.js.map +1 -1
- package/dist/src/ox-property-editor-checkbox.d.ts +2 -1
- package/dist/src/ox-property-editor-checkbox.js +4 -4
- package/dist/src/ox-property-editor-checkbox.js.map +1 -1
- package/dist/src/ox-property-editor-color.d.ts +2 -1
- package/dist/src/ox-property-editor-color.js +4 -9
- package/dist/src/ox-property-editor-color.js.map +1 -1
- package/dist/src/ox-property-editor-crontab.d.ts +2 -1
- package/dist/src/ox-property-editor-crontab.js +3 -2
- package/dist/src/ox-property-editor-crontab.js.map +1 -1
- package/dist/src/ox-property-editor-data.d.ts +2 -1
- package/dist/src/ox-property-editor-data.js +5 -4
- package/dist/src/ox-property-editor-data.js.map +1 -1
- package/dist/src/ox-property-editor-date.d.ts +2 -1
- package/dist/src/ox-property-editor-date.js +4 -4
- package/dist/src/ox-property-editor-date.js.map +1 -1
- package/dist/src/ox-property-editor-duration.d.ts +6 -0
- package/dist/src/ox-property-editor-duration.js +16 -0
- package/dist/src/ox-property-editor-duration.js.map +1 -0
- package/dist/src/ox-property-editor-file.d.ts +2 -1
- package/dist/src/ox-property-editor-file.js +8 -5
- package/dist/src/ox-property-editor-file.js.map +1 -1
- package/dist/src/ox-property-editor-gradient-colorstops.d.ts +2 -1
- package/dist/src/ox-property-editor-gradient-colorstops.js +8 -7
- package/dist/src/ox-property-editor-gradient-colorstops.js.map +1 -1
- package/dist/src/ox-property-editor-image.d.ts +2 -1
- package/dist/src/ox-property-editor-image.js +5 -4
- package/dist/src/ox-property-editor-image.js.map +1 -1
- package/dist/src/ox-property-editor-key-values.d.ts +6 -0
- package/dist/src/ox-property-editor-key-values.js +24 -0
- package/dist/src/ox-property-editor-key-values.js.map +1 -0
- package/dist/src/ox-property-editor-legend.d.ts +2 -1
- package/dist/src/ox-property-editor-legend.js +4 -4
- package/dist/src/ox-property-editor-legend.js.map +1 -1
- package/dist/src/ox-property-editor-multiple-colors.d.ts +2 -1
- package/dist/src/ox-property-editor-multiple-colors.js +4 -4
- package/dist/src/ox-property-editor-multiple-colors.js.map +1 -1
- package/dist/src/ox-property-editor-number.d.ts +2 -1
- package/dist/src/ox-property-editor-number.js +6 -6
- package/dist/src/ox-property-editor-number.js.map +1 -1
- package/dist/src/ox-property-editor-options.d.ts +2 -1
- package/dist/src/ox-property-editor-options.js +5 -4
- package/dist/src/ox-property-editor-options.js.map +1 -1
- package/dist/src/ox-property-editor-partition-keys.d.ts +6 -0
- package/dist/src/ox-property-editor-partition-keys.js +18 -0
- package/dist/src/ox-property-editor-partition-keys.js.map +1 -0
- package/dist/src/ox-property-editor-password.d.ts +2 -1
- package/dist/src/ox-property-editor-password.js +4 -4
- package/dist/src/ox-property-editor-password.js.map +1 -1
- package/dist/src/ox-property-editor-range.d.ts +2 -1
- package/dist/src/ox-property-editor-range.js +13 -5
- package/dist/src/ox-property-editor-range.js.map +1 -1
- package/dist/src/ox-property-editor-scene-component-id.d.ts +2 -1
- package/dist/src/ox-property-editor-scene-component-id.js +4 -8
- package/dist/src/ox-property-editor-scene-component-id.js.map +1 -1
- package/dist/src/ox-property-editor-select.d.ts +4 -1
- package/dist/src/ox-property-editor-select.js +11 -5
- package/dist/src/ox-property-editor-select.js.map +1 -1
- package/dist/src/ox-property-editor-solid-colorstops.d.ts +2 -1
- package/dist/src/ox-property-editor-solid-colorstops.js +8 -7
- package/dist/src/ox-property-editor-solid-colorstops.js.map +1 -1
- package/dist/src/ox-property-editor-string.d.ts +2 -1
- package/dist/src/ox-property-editor-string.js +4 -4
- package/dist/src/ox-property-editor-string.js.map +1 -1
- package/dist/src/ox-property-editor-table.d.ts +2 -1
- package/dist/src/ox-property-editor-table.js +5 -4
- package/dist/src/ox-property-editor-table.js.map +1 -1
- package/dist/src/ox-property-editor-textarea.d.ts +2 -1
- package/dist/src/ox-property-editor-textarea.js +9 -8
- package/dist/src/ox-property-editor-textarea.js.map +1 -1
- package/dist/src/ox-property-editor-value-map.d.ts +2 -1
- package/dist/src/ox-property-editor-value-map.js +11 -5
- package/dist/src/ox-property-editor-value-map.js.map +1 -1
- package/dist/src/ox-property-editor-value-ranges.d.ts +2 -1
- package/dist/src/ox-property-editor-value-ranges.js +9 -3
- package/dist/src/ox-property-editor-value-ranges.js.map +1 -1
- package/dist/src/ox-property-editor-work-shift.d.ts +3 -2
- package/dist/src/ox-property-editor-work-shift.js +8 -7
- package/dist/src/ox-property-editor-work-shift.js.map +1 -1
- package/dist/src/ox-property-editor.d.ts +8 -6
- package/dist/src/ox-property-editor.js +60 -7
- package/dist/src/ox-property-editor.js.map +1 -1
- package/dist/src/types.d.ts +5 -0
- package/dist/src/types.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -11
- package/src/ox-properties-dynamic-view.ts +15 -10
- package/src/ox-property-editor-angle.ts +6 -6
- package/src/ox-property-editor-checkbox.ts +6 -4
- package/src/ox-property-editor-color.ts +6 -9
- package/src/ox-property-editor-crontab.ts +5 -2
- package/src/ox-property-editor-data.ts +8 -4
- package/src/ox-property-editor-date.ts +6 -4
- package/src/ox-property-editor-duration.ts +16 -0
- package/src/ox-property-editor-file.ts +11 -5
- package/src/ox-property-editor-gradient-colorstops.ts +11 -7
- package/src/ox-property-editor-image.ts +9 -4
- package/src/ox-property-editor-key-values.ts +24 -0
- package/src/ox-property-editor-legend.ts +6 -4
- package/src/ox-property-editor-multiple-colors.ts +6 -4
- package/src/ox-property-editor-number.ts +8 -6
- package/src/ox-property-editor-options.ts +8 -4
- package/src/ox-property-editor-partition-keys.ts +18 -0
- package/src/ox-property-editor-password.ts +6 -4
- package/src/ox-property-editor-range.ts +15 -5
- package/src/ox-property-editor-scene-component-id.ts +6 -8
- package/src/ox-property-editor-select.ts +12 -6
- package/src/ox-property-editor-solid-colorstops.ts +11 -7
- package/src/ox-property-editor-string.ts +6 -4
- package/src/ox-property-editor-table.ts +8 -4
- package/src/ox-property-editor-textarea.ts +12 -8
- package/src/ox-property-editor-value-map.ts +13 -5
- package/src/ox-property-editor-value-ranges.ts +10 -3
- package/src/ox-property-editor-work-shift.ts +6 -4
- package/src/ox-property-editor.ts +59 -10
- package/src/types.ts +6 -0
- package/yarn-error.log +0 -18150
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import '@operato/input/ox-input-options.js'
|
|
2
2
|
|
|
3
|
-
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
4
|
-
import { customElement } from 'lit/decorators.js'
|
|
5
3
|
import { html } from 'lit'
|
|
4
|
+
import { customElement } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
7
|
+
import { PropertySpec } from './types.js'
|
|
6
8
|
|
|
7
9
|
@customElement('ox-property-editor-options')
|
|
8
10
|
export class OxPropertyEditorOptions extends OxPropertyEditor {
|
|
9
|
-
editorTemplate() {
|
|
10
|
-
|
|
11
|
+
editorTemplate(value: any, spec: PropertySpec) {
|
|
12
|
+
const { fullwidth = false } = spec.editor || {}
|
|
13
|
+
|
|
14
|
+
return html` <ox-input-options id="editor" .value=${value || []} ?fullwidth=${fullwidth}></ox-input-options> `
|
|
11
15
|
}
|
|
12
16
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import '@operato/input/ox-input-partition-keys.js'
|
|
2
|
+
|
|
3
|
+
import { html } from 'lit'
|
|
4
|
+
import { customElement } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
7
|
+
import { PropertySpec } from './types.js'
|
|
8
|
+
|
|
9
|
+
@customElement('ox-property-editor-partition-keys')
|
|
10
|
+
export class OxPropertyEditorPartitionKeys extends OxPropertyEditor {
|
|
11
|
+
editorTemplate(value: any, spec: PropertySpec) {
|
|
12
|
+
const { fullwidth = true } = spec.editor || {}
|
|
13
|
+
|
|
14
|
+
return html`
|
|
15
|
+
<ox-input-partition-keys id="editor" .value=${value} ?fullwidth=${fullwidth}></ox-input-partition-keys>
|
|
16
|
+
`
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
2
|
-
import { customElement } from 'lit/decorators.js'
|
|
3
1
|
import { html } from 'lit'
|
|
2
|
+
import { customElement } from 'lit/decorators.js'
|
|
3
|
+
|
|
4
|
+
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
5
|
+
import { PropertySpec } from './types.js'
|
|
4
6
|
|
|
5
7
|
@customElement('ox-property-editor-password')
|
|
6
8
|
export class OxPropertyEditorPassword extends OxPropertyEditor {
|
|
7
|
-
editorTemplate() {
|
|
8
|
-
return html` <input type="password" id="editor" .value=${
|
|
9
|
+
editorTemplate(value: any, spec: PropertySpec) {
|
|
10
|
+
return html` <input type="password" id="editor" .value=${value} placeholder=${spec.placeholder || ''} /> `
|
|
9
11
|
}
|
|
10
12
|
}
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
import '@operato/input/ox-input-range.js'
|
|
2
2
|
|
|
3
|
-
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
4
|
-
import { customElement } from 'lit/decorators.js'
|
|
5
3
|
import { html } from 'lit'
|
|
4
|
+
import { customElement } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
7
|
+
import { PropertySpec } from './types.js'
|
|
6
8
|
|
|
7
9
|
@customElement('ox-property-editor-range')
|
|
8
10
|
export class OxPropertyEditorRange extends OxPropertyEditor {
|
|
9
|
-
editorTemplate() {
|
|
10
|
-
const { step, min, max } =
|
|
11
|
+
editorTemplate(value: any, spec: PropertySpec) {
|
|
12
|
+
const { step, min, max } = spec.property || {}
|
|
13
|
+
const { fullwidth = false } = spec.editor || {}
|
|
11
14
|
|
|
12
15
|
return html`
|
|
13
|
-
<ox-input-range
|
|
16
|
+
<ox-input-range
|
|
17
|
+
id="editor"
|
|
18
|
+
.value=${value}
|
|
19
|
+
.step=${step}
|
|
20
|
+
.min=${min}
|
|
21
|
+
.max=${max}
|
|
22
|
+
?fullwidth=${fullwidth}
|
|
23
|
+
></ox-input-range>
|
|
14
24
|
`
|
|
15
25
|
}
|
|
16
26
|
}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import '@operato/input/ox-input-scene-component-id.js'
|
|
2
2
|
|
|
3
|
-
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
4
|
-
import { customElement } from 'lit/decorators.js'
|
|
5
3
|
import { html } from 'lit'
|
|
4
|
+
import { customElement } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
7
|
+
import { PropertySpec } from './types.js'
|
|
6
8
|
|
|
7
9
|
@customElement('ox-property-editor-scene-component-id')
|
|
8
10
|
export class OxPropertyEditorSceneComponentId extends OxPropertyEditor {
|
|
9
|
-
editorTemplate() {
|
|
11
|
+
editorTemplate(value: any, spec: PropertySpec) {
|
|
10
12
|
return html`
|
|
11
|
-
<ox-input-scene-component-id
|
|
12
|
-
id="editor"
|
|
13
|
-
.value=${this.value}
|
|
14
|
-
.property=${this.property}
|
|
15
|
-
></ox-input-scene-component-id>
|
|
13
|
+
<ox-input-scene-component-id id="editor" .value=${value} .property=${spec.property}></ox-input-scene-component-id>
|
|
16
14
|
`
|
|
17
15
|
}
|
|
18
16
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import '@operato/input/ox-select.js'
|
|
2
2
|
import '@operato/popup/ox-popup-list.js'
|
|
3
3
|
|
|
4
|
-
import { css, html } from 'lit'
|
|
4
|
+
import { css, html, LitElement } from 'lit'
|
|
5
|
+
import { customElement, query } from 'lit/decorators.js'
|
|
5
6
|
|
|
6
7
|
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
7
|
-
import {
|
|
8
|
+
import { PropertySpec } from './types.js'
|
|
8
9
|
|
|
9
10
|
type Option = { display: string; value: any } | string
|
|
10
11
|
|
|
@@ -22,6 +23,8 @@ export class OxPropertyEditorSelect extends OxPropertyEditor {
|
|
|
22
23
|
`
|
|
23
24
|
]
|
|
24
25
|
|
|
26
|
+
@query('ox-select') oxSelect!: LitElement
|
|
27
|
+
|
|
25
28
|
async connectedCallback() {
|
|
26
29
|
super.connectedCallback()
|
|
27
30
|
|
|
@@ -31,21 +34,24 @@ export class OxPropertyEditorSelect extends OxPropertyEditor {
|
|
|
31
34
|
...this.property,
|
|
32
35
|
options: await options.apply(this)
|
|
33
36
|
}
|
|
37
|
+
await this.updateComplete
|
|
38
|
+
this.oxSelect.requestUpdate()
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
41
|
|
|
37
|
-
editorTemplate() {
|
|
38
|
-
var options =
|
|
42
|
+
editorTemplate(value: any, spec: PropertySpec) {
|
|
43
|
+
var options = spec.property?.options as Option[]
|
|
39
44
|
if (!(options instanceof Array)) {
|
|
40
45
|
options = []
|
|
41
46
|
}
|
|
47
|
+
const { fullwidth = false } = spec.editor || {}
|
|
42
48
|
|
|
43
49
|
return html`
|
|
44
|
-
<ox-select id="editor" .value=${
|
|
50
|
+
<ox-select id="editor" .value=${value} placeholder=${spec.placeholder} ?fullwidth=${fullwidth}>
|
|
45
51
|
<ox-popup-list with-search>
|
|
46
52
|
${options.map(
|
|
47
53
|
item => html`
|
|
48
|
-
<div option value=${this._getOptionValue(item)} ?selected=${this._isSelected(
|
|
54
|
+
<div option value=${this._getOptionValue(item)} ?selected=${this._isSelected(value, item)}>
|
|
49
55
|
${this._getOptionDisplay(item) || html` `}
|
|
50
56
|
</div>
|
|
51
57
|
`
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import '@operato/input/ox-input-color-stops.js'
|
|
2
2
|
|
|
3
|
-
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
4
|
-
import { customElement } from 'lit/decorators.js'
|
|
5
3
|
import { html } from 'lit'
|
|
4
|
+
import { customElement } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
7
|
+
import { PropertySpec } from './types.js'
|
|
6
8
|
|
|
7
9
|
@customElement('ox-property-editor-solid-colorstops')
|
|
8
10
|
export class OxPropertyEditorSolidColorStops extends OxPropertyEditor {
|
|
9
|
-
editorTemplate() {
|
|
11
|
+
editorTemplate(value: any, spec: PropertySpec) {
|
|
12
|
+
const { fullwidth = true } = spec.editor || {}
|
|
13
|
+
|
|
10
14
|
return html`
|
|
11
15
|
<ox-input-color-stops
|
|
12
16
|
id="editor"
|
|
13
17
|
type="solid"
|
|
14
|
-
.value=${
|
|
15
|
-
.min=${
|
|
16
|
-
.max=${
|
|
17
|
-
fullwidth
|
|
18
|
+
.value=${value}
|
|
19
|
+
.min=${spec.property && spec.property.min}
|
|
20
|
+
.max=${spec.property && spec.property.max}
|
|
21
|
+
?fullwidth=${fullwidth}
|
|
18
22
|
>
|
|
19
23
|
</ox-input-color-stops>
|
|
20
24
|
`
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
2
|
-
import { customElement } from 'lit/decorators.js'
|
|
3
1
|
import { html } from 'lit'
|
|
2
|
+
import { customElement } from 'lit/decorators.js'
|
|
3
|
+
|
|
4
|
+
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
5
|
+
import { PropertySpec } from './types.js'
|
|
4
6
|
|
|
5
7
|
@customElement('ox-property-editor-string')
|
|
6
8
|
export class OxPropertyEditorString extends OxPropertyEditor {
|
|
7
|
-
editorTemplate() {
|
|
8
|
-
return html` <input type="text" id="editor" .value=${
|
|
9
|
+
editorTemplate(value: any, spec: PropertySpec) {
|
|
10
|
+
return html` <input type="text" id="editor" .value=${value || ''} placeholder=${spec.placeholder || ''} /> `
|
|
9
11
|
}
|
|
10
12
|
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import '@operato/input/ox-input-table.js'
|
|
2
2
|
|
|
3
|
-
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
4
|
-
import { customElement } from 'lit/decorators.js'
|
|
5
3
|
import { html } from 'lit'
|
|
4
|
+
import { customElement } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
7
|
+
import { PropertySpec } from './types.js'
|
|
6
8
|
|
|
7
9
|
@customElement('ox-property-editor-table')
|
|
8
10
|
export class OxPropertyEditorString extends OxPropertyEditor {
|
|
9
|
-
editorTemplate() {
|
|
10
|
-
|
|
11
|
+
editorTemplate(value: any, spec: PropertySpec) {
|
|
12
|
+
const { fullwidth = true } = spec.editor || {}
|
|
13
|
+
|
|
14
|
+
return html` <ox-input-table id="editor" .property=${spec.property} ?fullwidth=${fullwidth}></ox-input-table> `
|
|
11
15
|
}
|
|
12
16
|
}
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import '@operato/input/ox-input-code.js'
|
|
2
2
|
|
|
3
|
-
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
4
|
-
import { customElement } from 'lit/decorators.js'
|
|
5
3
|
import { html } from 'lit'
|
|
4
|
+
import { customElement } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
7
|
+
import { PropertySpec } from './types.js'
|
|
6
8
|
|
|
7
9
|
@customElement('ox-property-editor-textarea')
|
|
8
10
|
export class OxPropertyEditorTextArea extends OxPropertyEditor {
|
|
9
|
-
editorTemplate() {
|
|
11
|
+
editorTemplate(value: any, spec: PropertySpec) {
|
|
12
|
+
const { fullwidth = true } = spec.editor || {}
|
|
13
|
+
|
|
10
14
|
return html`
|
|
11
15
|
<ox-input-code
|
|
12
16
|
id="editor"
|
|
13
|
-
.value=${
|
|
14
|
-
mode=${
|
|
15
|
-
tab-size=${
|
|
16
|
-
tab-as-space=${
|
|
17
|
-
fullwidth
|
|
17
|
+
.value=${value}
|
|
18
|
+
mode=${spec.property?.mode || ''}
|
|
19
|
+
tab-size=${spec.property?.tabSize || ''}
|
|
20
|
+
tab-as-space=${spec.property?.tabAsSpace || 'false'}
|
|
21
|
+
?fullwidth=${fullwidth}
|
|
18
22
|
>
|
|
19
23
|
</ox-input-code>
|
|
20
24
|
`
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
import '@operato/input/ox-input-value-map.js'
|
|
2
2
|
|
|
3
|
-
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
4
|
-
import { customElement } from 'lit/decorators.js'
|
|
5
3
|
import { html } from 'lit'
|
|
4
|
+
import { customElement } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
7
|
+
import { PropertySpec } from './types.js'
|
|
6
8
|
|
|
7
9
|
@customElement('ox-property-editor-value-map')
|
|
8
10
|
export class OxPropertyEditorValueMap extends OxPropertyEditor {
|
|
9
|
-
editorTemplate() {
|
|
10
|
-
const {
|
|
11
|
+
editorTemplate(value: any, spec: PropertySpec) {
|
|
12
|
+
const { property } = spec
|
|
11
13
|
const valuetype = property?.valuetype || 'string'
|
|
12
14
|
/* IMPLEMENT-ME valuetype 에 editor를 전달할 수 있는 기능 개발 */
|
|
15
|
+
const { fullwidth = true } = spec.editor || {}
|
|
13
16
|
|
|
14
17
|
return html`
|
|
15
|
-
<ox-input-value-map
|
|
18
|
+
<ox-input-value-map
|
|
19
|
+
id="editor"
|
|
20
|
+
.valuetype=${valuetype}
|
|
21
|
+
.value=${value}
|
|
22
|
+
?fullwidth=${fullwidth}
|
|
23
|
+
></ox-input-value-map>
|
|
16
24
|
`
|
|
17
25
|
}
|
|
18
26
|
}
|
|
@@ -4,16 +4,23 @@ import { html } from 'lit'
|
|
|
4
4
|
import { customElement } from 'lit/decorators.js'
|
|
5
5
|
|
|
6
6
|
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
7
|
+
import { PropertySpec } from './types.js'
|
|
7
8
|
|
|
8
9
|
@customElement('ox-property-editor-value-ranges')
|
|
9
10
|
export class OxPropertyEditorValueRanges extends OxPropertyEditor {
|
|
10
|
-
editorTemplate() {
|
|
11
|
-
const {
|
|
11
|
+
editorTemplate(value: any, spec: PropertySpec) {
|
|
12
|
+
const { property } = spec
|
|
12
13
|
const valuetype = property?.valuetype || 'string'
|
|
13
14
|
/* IMPLEMENT-ME valuetype 에 editor를 전달할 수 있는 기능 개발 */
|
|
15
|
+
const { fullwidth = true } = spec.editor || {}
|
|
14
16
|
|
|
15
17
|
return html`
|
|
16
|
-
<ox-input-value-ranges
|
|
18
|
+
<ox-input-value-ranges
|
|
19
|
+
id="editor"
|
|
20
|
+
.valuetype=${valuetype}
|
|
21
|
+
.value=${value}
|
|
22
|
+
?fullwidth=${fullwidth}
|
|
23
|
+
></ox-input-value-ranges>
|
|
17
24
|
`
|
|
18
25
|
}
|
|
19
26
|
}
|
|
@@ -4,12 +4,14 @@ import { html } from 'lit'
|
|
|
4
4
|
import { customElement } from 'lit/decorators.js'
|
|
5
5
|
|
|
6
6
|
import { OxPropertyEditor } from './ox-property-editor.js'
|
|
7
|
+
import { PropertySpec } from './types.js'
|
|
7
8
|
|
|
8
9
|
@customElement('ox-property-editor-work-shift')
|
|
9
|
-
export class
|
|
10
|
-
editorTemplate() {
|
|
11
|
-
const {
|
|
10
|
+
export class OxPropertyEditorWorkShift extends OxPropertyEditor {
|
|
11
|
+
editorTemplate(value: any, spec: PropertySpec) {
|
|
12
|
+
const { editor } = spec
|
|
13
|
+
const { fullwidth = true } = editor || {}
|
|
12
14
|
|
|
13
|
-
return html` <ox-input-work-shift id="editor" .value=${value} fullwidth></ox-input-work-shift> `
|
|
15
|
+
return html` <ox-input-work-shift id="editor" .value=${value} ?fullwidth=${fullwidth}></ox-input-work-shift> `
|
|
14
16
|
}
|
|
15
17
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import '@operato/i18n/ox-i18n.js'
|
|
2
2
|
|
|
3
|
-
import { css, html, LitElement } from 'lit'
|
|
3
|
+
import { css, html, LitElement, TemplateResult } from 'lit'
|
|
4
4
|
import { property, state } from 'lit/decorators.js'
|
|
5
5
|
import deepClone from 'lodash-es/cloneDeep'
|
|
6
6
|
|
|
7
|
+
import { EditorProperty, PropertySpec } from './types'
|
|
8
|
+
|
|
7
9
|
export class OxPropertyEditor extends LitElement {
|
|
8
10
|
static registry: { [type: string]: string } = {}
|
|
9
11
|
|
|
@@ -25,6 +27,7 @@ export class OxPropertyEditor extends LitElement {
|
|
|
25
27
|
display: grid;
|
|
26
28
|
grid-template-columns: repeat(10, 1fr);
|
|
27
29
|
grid-gap: 5px;
|
|
30
|
+
grid-auto-rows: minmax(24px, auto);
|
|
28
31
|
|
|
29
32
|
align-items: center;
|
|
30
33
|
|
|
@@ -60,10 +63,9 @@ export class OxPropertyEditor extends LitElement {
|
|
|
60
63
|
text-align: left;
|
|
61
64
|
}
|
|
62
65
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
:
|
|
66
|
-
:host > input[type='number'] {
|
|
66
|
+
select,
|
|
67
|
+
ox-select,
|
|
68
|
+
input:not([type='checkbox']) {
|
|
67
69
|
border: 1px solid rgba(0, 0, 0, 0.2);
|
|
68
70
|
}
|
|
69
71
|
|
|
@@ -88,15 +90,38 @@ export class OxPropertyEditor extends LitElement {
|
|
|
88
90
|
justify-self: end;
|
|
89
91
|
align-self: center;
|
|
90
92
|
}
|
|
93
|
+
|
|
94
|
+
ox-input-code,
|
|
95
|
+
ox-input-data {
|
|
96
|
+
height: 300px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
:host > div {
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: column;
|
|
102
|
+
gap: 3px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
div[data-index] {
|
|
106
|
+
display: flex;
|
|
107
|
+
min-height: 24px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
div[data-index] > * {
|
|
111
|
+
flex: 1;
|
|
112
|
+
}
|
|
91
113
|
`
|
|
92
114
|
]
|
|
93
115
|
|
|
94
116
|
@property({ type: Object }) value: any
|
|
95
117
|
@property({ type: String }) type!: string
|
|
118
|
+
@property({ type: String, attribute: true, reflect: true }) name!: string
|
|
96
119
|
@property({ type: String }) label!: string
|
|
97
120
|
@property({ type: String }) placeholder?: string
|
|
98
|
-
@property({ type: Object }) property
|
|
121
|
+
@property({ type: Object }) property?: any
|
|
122
|
+
@property({ type: Object }) editor?: EditorProperty
|
|
99
123
|
@property({ type: Object }) host: any
|
|
124
|
+
@property({ type: Array }) quantifier?: [min: number, max: number] = [1, 1]
|
|
100
125
|
@property({ type: Object }) observe?: (value: any) => void
|
|
101
126
|
|
|
102
127
|
connectedCallback() {
|
|
@@ -105,13 +130,26 @@ export class OxPropertyEditor extends LitElement {
|
|
|
105
130
|
this.renderRoot.addEventListener('change', this._valueChanged.bind(this))
|
|
106
131
|
}
|
|
107
132
|
|
|
108
|
-
editorTemplate(
|
|
133
|
+
editorTemplate(value: any, spec: PropertySpec): TemplateResult<1> {
|
|
109
134
|
return html``
|
|
110
135
|
}
|
|
111
136
|
|
|
112
137
|
render() {
|
|
138
|
+
const { value, quantifier } = this
|
|
139
|
+
const [min = 1, max = 1] = quantifier || [1, 1]
|
|
140
|
+
|
|
113
141
|
return html`
|
|
114
|
-
${
|
|
142
|
+
${max <= 1
|
|
143
|
+
? this.editorTemplate(value, this)
|
|
144
|
+
: html`
|
|
145
|
+
<div ?fullwidth=${this.editor?.fullwidth}>
|
|
146
|
+
${new Array(max)
|
|
147
|
+
.fill('')
|
|
148
|
+
.map(
|
|
149
|
+
(_, idx) => html` <div editor data-index=${idx}>${this.editorTemplate(value?.[idx], this)}</div> `
|
|
150
|
+
)}
|
|
151
|
+
</div>
|
|
152
|
+
`}
|
|
115
153
|
${this.label
|
|
116
154
|
? html`
|
|
117
155
|
<label for="editor">
|
|
@@ -154,8 +192,19 @@ export class OxPropertyEditor extends LitElement {
|
|
|
154
192
|
|
|
155
193
|
_valueChanged(e: Event) {
|
|
156
194
|
e.stopPropagation()
|
|
157
|
-
|
|
158
|
-
|
|
195
|
+
const editor = e.target as HTMLInputElement
|
|
196
|
+
|
|
197
|
+
const [min = 1, max = 1] = this.quantifier || []
|
|
198
|
+
const value = this.makeup((editor as any)[this.valueProperty])
|
|
199
|
+
|
|
200
|
+
if (max > 1) {
|
|
201
|
+
const index = Number(editor.closest('[data-index]')?.getAttribute('data-index'))
|
|
202
|
+
var array: any[] = this.value instanceof Array ? [...this.value] : []
|
|
203
|
+
array[index] = value
|
|
204
|
+
this.value = array
|
|
205
|
+
} else {
|
|
206
|
+
this.value = value
|
|
207
|
+
}
|
|
159
208
|
|
|
160
209
|
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
|
161
210
|
|
package/src/types.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
export type EditorProperty = {
|
|
2
|
+
fullwidth?: boolean
|
|
3
|
+
}
|
|
4
|
+
|
|
1
5
|
export type PropertySpec = {
|
|
2
6
|
type: string
|
|
3
7
|
label: string
|
|
4
8
|
name: string
|
|
5
9
|
placeholder?: string
|
|
6
10
|
property?: any
|
|
11
|
+
editor?: EditorProperty
|
|
12
|
+
quantifier?: [min: number, max: number]
|
|
7
13
|
observe?: (value: any) => void
|
|
8
14
|
}
|