@operato/property-editor 10.29.80 → 10.29.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/ox-property-editor-number-map.d.ts +13 -1
- package/dist/src/ox-property-editor-number-map.js +48 -11
- package/dist/stories/ox-properties-dynamic-view.stories.d.ts +60 -0
- package/dist/stories/ox-properties-dynamic-view.stories.js +535 -0
- package/dist/stories/ox-properties-editor-textarea.stories.d.ts +31 -0
- package/dist/stories/ox-properties-editor-textarea.stories.js +76 -0
- package/package.json +21 -6
- package/translations/en.json +2 -1
- package/translations/es.json +2 -1
- package/translations/ko.json +2 -1
- package/translations/ms.json +2 -1
- package/translations/zh.json +2 -1
- package/CHANGELOG.md +0 -6812
- package/dist/src/index.js.map +0 -1
- package/dist/src/ox-properties-dynamic-view.js.map +0 -1
- package/dist/src/ox-property-editor-3axis.js.map +0 -1
- package/dist/src/ox-property-editor-3dish.js.map +0 -1
- package/dist/src/ox-property-editor-action.js.map +0 -1
- package/dist/src/ox-property-editor-angle.js.map +0 -1
- package/dist/src/ox-property-editor-backdrop-faces.js.map +0 -1
- package/dist/src/ox-property-editor-checkbox.js.map +0 -1
- package/dist/src/ox-property-editor-color.js.map +0 -1
- package/dist/src/ox-property-editor-crontab.js.map +0 -1
- package/dist/src/ox-property-editor-data.js.map +0 -1
- package/dist/src/ox-property-editor-date.js.map +0 -1
- package/dist/src/ox-property-editor-datetime.js.map +0 -1
- package/dist/src/ox-property-editor-description.js.map +0 -1
- package/dist/src/ox-property-editor-duration.js.map +0 -1
- package/dist/src/ox-property-editor-file.js.map +0 -1
- package/dist/src/ox-property-editor-fill-style.js.map +0 -1
- package/dist/src/ox-property-editor-gradient-colorstops.js.map +0 -1
- package/dist/src/ox-property-editor-hashtags.js.map +0 -1
- package/dist/src/ox-property-editor-image.js.map +0 -1
- package/dist/src/ox-property-editor-key-values.js.map +0 -1
- package/dist/src/ox-property-editor-legend.js.map +0 -1
- package/dist/src/ox-property-editor-mass-fraction.js.map +0 -1
- package/dist/src/ox-property-editor-month.js.map +0 -1
- package/dist/src/ox-property-editor-multiple-colors.js.map +0 -1
- package/dist/src/ox-property-editor-number-map.js.map +0 -1
- package/dist/src/ox-property-editor-number.js.map +0 -1
- package/dist/src/ox-property-editor-options.js.map +0 -1
- package/dist/src/ox-property-editor-partition-keys.js.map +0 -1
- package/dist/src/ox-property-editor-password.js.map +0 -1
- package/dist/src/ox-property-editor-range.js.map +0 -1
- package/dist/src/ox-property-editor-scene-component-id.js.map +0 -1
- package/dist/src/ox-property-editor-secret.js.map +0 -1
- package/dist/src/ox-property-editor-select.js.map +0 -1
- package/dist/src/ox-property-editor-signature.js.map +0 -1
- package/dist/src/ox-property-editor-solid-colorstops.js.map +0 -1
- package/dist/src/ox-property-editor-string.js.map +0 -1
- package/dist/src/ox-property-editor-table-column-config.js.map +0 -1
- package/dist/src/ox-property-editor-table.js.map +0 -1
- package/dist/src/ox-property-editor-textarea.js.map +0 -1
- package/dist/src/ox-property-editor-time.js.map +0 -1
- package/dist/src/ox-property-editor-unit-number.js.map +0 -1
- package/dist/src/ox-property-editor-value-map.js.map +0 -1
- package/dist/src/ox-property-editor-value-ranges.js.map +0 -1
- package/dist/src/ox-property-editor-work-shift.js.map +0 -1
- package/dist/src/ox-property-editor.js.map +0 -1
- package/dist/src/types.js.map +0 -1
- package/dist/test/date-editors.test.d.ts +0 -2
- package/dist/test/date-editors.test.js +0 -45
- package/dist/test/date-editors.test.js.map +0 -1
- package/dist/test/dynamic-view-copy.test.d.ts +0 -2
- package/dist/test/dynamic-view-copy.test.js +0 -22
- package/dist/test/dynamic-view-copy.test.js.map +0 -1
- package/dist/test/number-map.test.d.ts +0 -1
- package/dist/test/number-map.test.js +0 -117
- package/dist/test/number-map.test.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/test/date-editors.test.ts +0 -50
- package/test/dynamic-view-copy.test.ts +0 -27
- package/test/number-map.test.ts +0 -133
package/test/number-map.test.ts
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { expect, fixture, oneEvent } from '@open-wc/testing'
|
|
2
|
-
import { html } from 'lit'
|
|
3
|
-
|
|
4
|
-
import '../src/ox-property-editor-number-map.js'
|
|
5
|
-
import type { OxPropertyEditorNumberMap } from '../src/ox-property-editor-number-map.js'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Several numbers as one map (ADR-0096): a board's design values for a figure. A value within range becomes part of the
|
|
9
|
-
* map and the whole map is told; one outside its range is not taken and the field shows what the map holds.
|
|
10
|
-
*/
|
|
11
|
-
describe('number-map', () => {
|
|
12
|
-
const entries = [
|
|
13
|
-
{ key: 'pitch', label: '롤러 간격', unit: 'mm', min: 100, max: 400, default: 200 },
|
|
14
|
-
{ key: 'gap', label: '틈', unit: 'mm', min: 0, max: 50, default: 10 }
|
|
15
|
-
]
|
|
16
|
-
const make = () =>
|
|
17
|
-
fixture<OxPropertyEditorNumberMap>(html`<ox-property-editor-number-map name="designInputs" .property=${{ entries }} .value=${{ pitch: 150 }}></ox-property-editor-number-map>`)
|
|
18
|
-
const field = (el: OxPropertyEditorNumberMap, key: string) => el.renderRoot.querySelector(`input[type=number][data-key="${key}"]`) as HTMLInputElement
|
|
19
|
-
|
|
20
|
-
it('shows each value, or its default, with its range', async () => {
|
|
21
|
-
const el = await make()
|
|
22
|
-
expect(field(el, 'pitch').value).to.equal('150')
|
|
23
|
-
expect(field(el, 'gap').value).to.equal('10')
|
|
24
|
-
expect(field(el, 'pitch').placeholder).to.equal('100–400 (200)')
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
it('a value within range: the whole map is told', async () => {
|
|
28
|
-
const el = await make()
|
|
29
|
-
const input = field(el, 'gap')
|
|
30
|
-
input.value = '20'
|
|
31
|
-
const told = oneEvent(el, 'change')
|
|
32
|
-
input.dispatchEvent(new Event('change', { bubbles: true }))
|
|
33
|
-
await told
|
|
34
|
-
expect(el.value).to.deep.equal({ pitch: 150, gap: 20 })
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
it('a value outside its range is not taken: nothing is told, the field shows the map again', async () => {
|
|
38
|
-
const el = await make()
|
|
39
|
-
let told = false
|
|
40
|
-
el.addEventListener('change', () => (told = true))
|
|
41
|
-
const input = field(el, 'pitch')
|
|
42
|
-
input.value = '1000'
|
|
43
|
-
input.dispatchEvent(new Event('change', { bubbles: true }))
|
|
44
|
-
await el.updateComplete
|
|
45
|
-
expect(told).to.equal(false)
|
|
46
|
-
expect(el.value).to.deep.equal({ pitch: 150 })
|
|
47
|
-
expect(input.value).to.equal('150')
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
it('an emptied field is not a number: not taken, the field shows the map again', async () => {
|
|
51
|
-
const el = await make()
|
|
52
|
-
let told = false
|
|
53
|
-
el.addEventListener('change', () => (told = true))
|
|
54
|
-
const input = field(el, 'gap')
|
|
55
|
-
input.value = ''
|
|
56
|
-
input.dispatchEvent(new Event('change', { bubbles: true }))
|
|
57
|
-
await el.updateComplete
|
|
58
|
-
expect(told).to.equal(false)
|
|
59
|
-
expect(el.value).to.deep.equal({ pitch: 150 })
|
|
60
|
-
expect(input.value).to.equal('10')
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it('★ a ranged entry has a slider: every step of a drag is told, and the number follows', async () => {
|
|
64
|
-
const el = await make()
|
|
65
|
-
const slider = el.renderRoot.querySelector('input[type=range][data-key="gap"]') as HTMLInputElement
|
|
66
|
-
let told = 0
|
|
67
|
-
el.addEventListener('change', () => told++)
|
|
68
|
-
slider.value = '30'
|
|
69
|
-
slider.dispatchEvent(new Event('input', { bubbles: true }))
|
|
70
|
-
expect(field(el, 'gap').value).to.equal('30')
|
|
71
|
-
expect(told).to.equal(1)
|
|
72
|
-
expect(el.value).to.deep.equal({ pitch: 150, gap: 30 })
|
|
73
|
-
slider.value = '40'
|
|
74
|
-
slider.dispatchEvent(new Event('input', { bubbles: true }))
|
|
75
|
-
expect(told).to.equal(2)
|
|
76
|
-
expect(el.value).to.deep.equal({ pitch: 150, gap: 40 })
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
it('an entry without a range has no slider; its field takes the room', async () => {
|
|
80
|
-
const el = await fixture<OxPropertyEditorNumberMap>(
|
|
81
|
-
html`<ox-property-editor-number-map name="clips" .property=${{ entries: [{ key: 'run', label: 'run', min: 0 }] }}></ox-property-editor-number-map>`
|
|
82
|
-
)
|
|
83
|
-
expect(el.renderRoot.querySelector('input[type=range]')).to.equal(null)
|
|
84
|
-
expect(field(el, 'run').hasAttribute('wide')).to.equal(true)
|
|
85
|
-
})
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
/** A figure's data values and motion settings (ADR-0051): a boolean, an enum, and a map of maps for the groups. */
|
|
89
|
-
describe('number-map — other kinds and nested keys', () => {
|
|
90
|
-
const field = (el: OxPropertyEditorNumberMap, key: string) => el.renderRoot.querySelector(`[data-key="${key}"]`) as HTMLInputElement & HTMLSelectElement
|
|
91
|
-
|
|
92
|
-
it('a boolean is a checkbox and an enum a choice; each change tells the whole map, false included', async () => {
|
|
93
|
-
const entries = [
|
|
94
|
-
{ key: 'batteryLow', label: '배터리 부족', kind: 'boolean', default: false },
|
|
95
|
-
{ key: 'mode', label: '동작', kind: 'enum', values: ['idle', 'walk', 'run'], default: 'idle' },
|
|
96
|
-
{ key: 'cadence', label: '동작 속도', unit: 'ratio', min: 0, max: 3, default: 1 }
|
|
97
|
-
]
|
|
98
|
-
const el = await fixture<OxPropertyEditorNumberMap>(html`<ox-property-editor-number-map name="figureValues" .property=${{ entries }} .value=${{ batteryLow: true }}></ox-property-editor-number-map>`)
|
|
99
|
-
expect(field(el, 'batteryLow').checked).to.equal(true)
|
|
100
|
-
expect(field(el, 'mode').value).to.equal('idle')
|
|
101
|
-
const box = field(el, 'batteryLow')
|
|
102
|
-
box.checked = false
|
|
103
|
-
let told = oneEvent(el, 'change')
|
|
104
|
-
box.dispatchEvent(new Event('change', { bubbles: true }))
|
|
105
|
-
await told
|
|
106
|
-
expect(el.value).to.deep.equal({ batteryLow: false })
|
|
107
|
-
const choice = field(el, 'mode')
|
|
108
|
-
choice.value = 'run'
|
|
109
|
-
told = oneEvent(el, 'change')
|
|
110
|
-
choice.dispatchEvent(new Event('change', { bubbles: true }))
|
|
111
|
-
await told
|
|
112
|
-
expect(el.value).to.deep.equal({ batteryLow: false, mode: 'run' })
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
it('nested: a key a.b is the value b inside a, and writing one keeps the others of a', async () => {
|
|
116
|
-
const entries = [
|
|
117
|
-
{ key: 'locomotion.clip', label: '보행', kind: 'enum', values: ['idle', 'walk', 'run'], default: 'idle' },
|
|
118
|
-
{ key: 'locomotion.speed', label: '보행', unit: '×', min: 0, max: 3, default: 0 },
|
|
119
|
-
{ key: 'locomotion.paused', label: '보행', kind: 'boolean', default: false }
|
|
120
|
-
]
|
|
121
|
-
const el = await fixture<OxPropertyEditorNumberMap>(
|
|
122
|
-
html`<ox-property-editor-number-map name="motion" .property=${{ entries, nested: true }} .value=${{ locomotion: { clip: 'walk', speed: 1 } }}></ox-property-editor-number-map>`
|
|
123
|
-
)
|
|
124
|
-
expect(field(el, 'locomotion.clip').value).to.equal('walk')
|
|
125
|
-
const speed = el.renderRoot.querySelector('input[type=number][data-key="locomotion.speed"]') as HTMLInputElement
|
|
126
|
-
expect(speed.value).to.equal('1')
|
|
127
|
-
speed.value = '2'
|
|
128
|
-
const told = oneEvent(el, 'change')
|
|
129
|
-
speed.dispatchEvent(new Event('change', { bubbles: true }))
|
|
130
|
-
await told
|
|
131
|
-
expect(el.value).to.deep.equal({ locomotion: { clip: 'walk', speed: 2 } })
|
|
132
|
-
})
|
|
133
|
-
})
|