@operato/input 10.9.0 → 10.10.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 (35) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/src/image-selector.d.ts +14 -0
  3. package/dist/src/image-selector.js +61 -0
  4. package/dist/src/image-selector.js.map +1 -0
  5. package/dist/src/index.d.ts +1 -0
  6. package/dist/src/index.js +1 -0
  7. package/dist/src/index.js.map +1 -1
  8. package/dist/src/ox-input-background-pattern.d.ts +15 -2
  9. package/dist/src/ox-input-background-pattern.js +47 -10
  10. package/dist/src/ox-input-background-pattern.js.map +1 -1
  11. package/dist/src/ox-input-color-stops.d.ts +2 -1
  12. package/dist/src/ox-input-color-stops.js +10 -4
  13. package/dist/src/ox-input-color-stops.js.map +1 -1
  14. package/dist/src/ox-input-container.js +18 -1
  15. package/dist/src/ox-input-container.js.map +1 -1
  16. package/dist/src/ox-input-formula.d.ts +1 -1
  17. package/dist/src/ox-input-formula.js +14 -2
  18. package/dist/src/ox-input-formula.js.map +1 -1
  19. package/dist/src/ox-input-search.js +15 -1
  20. package/dist/src/ox-input-search.js.map +1 -1
  21. package/dist/src/ox-input-secret.js +14 -0
  22. package/dist/src/ox-input-secret.js.map +1 -1
  23. package/dist/src/ox-input-select-buttons.js +1 -1
  24. package/dist/src/ox-input-select-buttons.js.map +1 -1
  25. package/dist/test/image-selector.test.d.ts +1 -0
  26. package/dist/test/image-selector.test.js +63 -0
  27. package/dist/test/image-selector.test.js.map +1 -0
  28. package/dist/tsconfig.tsbuildinfo +1 -1
  29. package/package.json +9 -5
  30. package/test/image-selector.test.ts +81 -0
  31. package/translations/en.json +6 -5
  32. package/translations/ja.json +6 -5
  33. package/translations/ko.json +6 -5
  34. package/translations/ms.json +6 -5
  35. package/translations/zh.json +6 -5
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@operato/input",
3
3
  "description": "Webcomponents for input following open-wc recommendations",
4
4
  "author": "heartyoh@hatiolab.com",
5
- "version": "10.9.0",
5
+ "version": "10.10.0",
6
6
  "type": "module",
7
7
  "main": "dist/src/index.js",
8
8
  "module": "dist/src/index.js",
@@ -69,7 +69,8 @@
69
69
  "./ox-input-video.js": "./dist/src/ox-input-video.js",
70
70
  "./ox-input-work-shift.js": "./dist/src/ox-input-work-shift.js",
71
71
  "./ox-select-floor.js": "./dist/src/ox-select-floor.js",
72
- "./ox-select.js": "./dist/src/ox-select.js"
72
+ "./ox-select.js": "./dist/src/ox-select.js",
73
+ "./image-selector.js": "./dist/src/image-selector.js"
73
74
  },
74
75
  "typesVersions": {
75
76
  "*": {
@@ -216,6 +217,9 @@
216
217
  ],
217
218
  "./ox-input-table.js": [
218
219
  "./dist/src/ox-input-table.d.ts"
220
+ ],
221
+ "./image-selector.js": [
222
+ "./dist/src/image-selector.d.ts"
219
223
  ]
220
224
  }
221
225
  },
@@ -247,8 +251,8 @@
247
251
  "@material/web": "^2.0.0",
248
252
  "@operato/i18n": "^10.0.0",
249
253
  "@operato/pickr": "^10.0.0",
250
- "@operato/popup": "^10.9.0",
251
- "@operato/styles": "^10.9.0",
254
+ "@operato/popup": "^10.10.0",
255
+ "@operato/styles": "^10.10.0",
252
256
  "@operato/utils": "^10.7.0",
253
257
  "@types/codemirror": "^5.60.5",
254
258
  "@undecaf/zbar-wasm": "^0.11.0",
@@ -290,5 +294,5 @@
290
294
  "prettier --write"
291
295
  ]
292
296
  },
293
- "gitHead": "5282356a0fbf7601a1bd023cf65ba5dc60986337"
297
+ "gitHead": "15f722c8131e5a04b5b4186ac71ada9f94ef9a4f"
294
298
  }
@@ -0,0 +1,81 @@
1
+ import { expect, fixture } from '@open-wc/testing'
2
+ import { html } from 'lit'
3
+
4
+ import '../src/ox-input-background-pattern.js'
5
+ import { registerImageSelector } from '../src/image-selector.js'
6
+
7
+ /**
8
+ * 그림 고르는 칸의 자리.
9
+ *
10
+ * ## 왜 시험이 필요한가
11
+ *
12
+ * `@operato/input` 이 `@operato/attachment` 를 직접 부르고 있었다. 가장 아래의 부품이 위의 기능을
13
+ * 아는 모양이라 고리가 생겼고(input ▶ attachment ▶ data-grist ▶ input), 그 고리 때문에 이 package
14
+ * 는 **빌드되지 않았다**(TS5055 일곱 건, noEmitOnError).
15
+ *
16
+ * 화살표를 뒤집으면서 두 가지가 지켜져야 한다.
17
+ *
18
+ * ```
19
+ * 비지 않는다 등록이 없어도 칸이 있어야 한다. 등록 안 된 custom element 는 소리 없이 빈 상자다
20
+ * 값이 담긴다 어느 갈래가 그려지든 value-key 와 change 로 값이 같은 길을 지나야 한다
21
+ * ```
22
+ */
23
+ describe('그림 고르는 칸은 위 layer 가 채운다', () => {
24
+ async function pattern(value: any = {}) {
25
+ const el: any = await fixture(html`<ox-input-background-pattern .value=${value}></ox-input-background-pattern>`)
26
+ await el.updateComplete
27
+ return el
28
+ }
29
+
30
+ it('등록이 없으면 글자 칸이다 — 빈 자리로 두지 않는다', async () => {
31
+ const el = await pattern({ image: 'https://example.com/a.png' })
32
+
33
+ const field = el.renderRoot.querySelector('[value-key="image"]') as HTMLInputElement
34
+
35
+ expect(field, '그림 칸이 아예 없다').to.exist
36
+ expect(field.tagName).to.equal('INPUT')
37
+ expect(field.value, '적혀 있던 주소가 칸에 실리지 않았다').to.equal('https://example.com/a.png')
38
+ })
39
+
40
+ it('글자 칸에 적은 주소가 값으로 담긴다', async () => {
41
+ const el = await pattern({})
42
+
43
+ const field = el.renderRoot.querySelector('[value-key="image"]') as HTMLInputElement
44
+ field.value = 'https://example.com/b.png'
45
+ field.dispatchEvent(new Event('change', { bubbles: true, composed: true }))
46
+
47
+ expect(el.value.image).to.equal('https://example.com/b.png')
48
+ })
49
+
50
+ it('그림을 가진 쪽이 자기 칸을 등록하면 그것으로 바뀐다', async () => {
51
+ class FakeSelector extends HTMLElement {
52
+ value: any
53
+ properties: any
54
+ }
55
+ customElements.define('test-image-selector', FakeSelector)
56
+
57
+ const el = await pattern({ image: 'https://example.com/c.png' })
58
+
59
+ /* 요소가 먼저 그려지고 등록이 나중에 와도 자리가 글자 칸으로 남아 있으면 안 된다. */
60
+ registerImageSelector('test-image-selector')
61
+ await el.updateComplete
62
+
63
+ const field = el.renderRoot.querySelector('[value-key="image"]') as any
64
+
65
+ expect(field.tagName).to.equal('TEST-IMAGE-SELECTOR')
66
+ expect(field.value).to.equal('https://example.com/c.png')
67
+ expect(field.properties).to.deep.equal({ category: 'image' })
68
+ })
69
+
70
+ it('등록된 칸이 올린 change 도 같은 길로 값이 담긴다', async () => {
71
+ registerImageSelector('test-image-selector')
72
+
73
+ const el = await pattern({})
74
+ const field = el.renderRoot.querySelector('[value-key="image"]') as any
75
+
76
+ field.value = 'https://example.com/d.png'
77
+ field.dispatchEvent(new Event('change', { bubbles: true, composed: true }))
78
+
79
+ expect(el.value.image).to.equal('https://example.com/d.png')
80
+ })
81
+ })
@@ -20,6 +20,7 @@
20
20
  "label.operators": "operators",
21
21
  "label.privilege": "privilege",
22
22
  "label.protected-request-ip": "safe request IP",
23
+ "label.search": "search",
23
24
  "label.second": "second",
24
25
  "label.second by second": "second by second",
25
26
  "label.seconds": "seconds",
@@ -45,13 +46,13 @@
45
46
  "text.every second": "every second",
46
47
  "text.every sunday": "every sunday",
47
48
  "text.every weekday": "every weekday",
49
+ "text.input-secret-hide": "hide",
50
+ "text.input-secret-placeholder": "enter secret information",
51
+ "text.input-secret-show": "show",
52
+ "text.input-secret-toggle": "show/hide",
48
53
  "text.range of values": "range of values",
49
54
  "text.step values": "step values",
50
55
  "text.the first day of every month": "the first day of every month",
51
56
  "text.the first day of every year": "the first day of every year",
52
- "text.value list separator": "value list separator",
53
- "text.input-secret-placeholder": "enter secret information",
54
- "text.input-secret-show": "show",
55
- "text.input-secret-hide": "hide",
56
- "text.input-secret-toggle": "show/hide"
57
+ "text.value list separator": "value list separator"
57
58
  }
@@ -19,6 +19,7 @@
19
19
  "label.operators": "演算子",
20
20
  "label.privilege": "権限",
21
21
  "label.protected-request-ip": "安全なリクエスト IP",
22
+ "label.search": "検索キーワード",
22
23
  "label.second": "秒",
23
24
  "label.seconds": "秒",
24
25
  "label.superuser": "スーパーユーザー",
@@ -43,13 +44,13 @@
43
44
  "text.every second": "毎秒",
44
45
  "text.every sunday": "毎週日曜日",
45
46
  "text.every weekday": "平日毎日",
47
+ "text.input-secret-hide": "非表示",
48
+ "text.input-secret-placeholder": "機密情報を入力",
49
+ "text.input-secret-show": "表示",
50
+ "text.input-secret-toggle": "表示/非表示",
46
51
  "text.range of values": "値の範囲",
47
52
  "text.step values": "ステップ値",
48
53
  "text.the first day of every month": "毎月1日",
49
54
  "text.the first day of every year": "毎年1月1日",
50
- "text.value list separator": "値リスト区切り",
51
- "text.input-secret-placeholder": "機密情報を入力",
52
- "text.input-secret-show": "表示",
53
- "text.input-secret-hide": "非表示",
54
- "text.input-secret-toggle": "表示/非表示"
55
+ "text.value list separator": "値リスト区切り"
55
56
  }
@@ -19,6 +19,7 @@
19
19
  "label.operators": "연산자",
20
20
  "label.privilege": "권한",
21
21
  "label.protected-request-ip": "안전한 요청 IP",
22
+ "label.search": "검색어",
22
23
  "label.second": "초",
23
24
  "label.seconds": "초",
24
25
  "label.superuser": "수퍼유저",
@@ -43,13 +44,13 @@
43
44
  "text.every second": "매초",
44
45
  "text.every sunday": "매주 일요일마다",
45
46
  "text.every weekday": "평일마다",
47
+ "text.input-secret-hide": "숨기기",
48
+ "text.input-secret-placeholder": "보안 정보 입력",
49
+ "text.input-secret-show": "보기",
50
+ "text.input-secret-toggle": "보기/숨기기",
46
51
  "text.range of values": "값의 범위",
47
52
  "text.step values": "단계 값",
48
53
  "text.the first day of every month": "매월 1일마다",
49
54
  "text.the first day of every year": "매년 1월 1일마다",
50
- "text.value list separator": "값 구분자",
51
- "text.input-secret-placeholder": "보안 정보 입력",
52
- "text.input-secret-show": "보기",
53
- "text.input-secret-hide": "숨기기",
54
- "text.input-secret-toggle": "보기/숨기기"
55
+ "text.value list separator": "값 구분자"
55
56
  }
@@ -19,6 +19,7 @@
19
19
  "label.operators": "operator",
20
20
  "label.privilege": "keistimewaan",
21
21
  "label.protected-request-ip": "IP permintaan yang selamat",
22
+ "label.search": "carian",
22
23
  "label.second": "saat",
23
24
  "label.seconds": "saat",
24
25
  "label.superuser": "pengguna super",
@@ -43,13 +44,13 @@
43
44
  "text.every second": "setiap saat",
44
45
  "text.every sunday": "setiap hari Ahad",
45
46
  "text.every weekday": "setiap hari minggu",
47
+ "text.input-secret-hide": "Sembunyi",
48
+ "text.input-secret-placeholder": "Masukkan maklumat rahsia",
49
+ "text.input-secret-show": "Tunjuk",
50
+ "text.input-secret-toggle": "Tunjuk/Sembunyi",
46
51
  "text.range of values": "julat nilai",
47
52
  "text.step values": "nilai langkah",
48
53
  "text.the first day of every month": "hari pertama setiap bulan",
49
54
  "text.the first day of every year": "hari pertama setiap tahun",
50
- "text.value list separator": "pemisah senarai nilai",
51
- "text.input-secret-placeholder": "Masukkan maklumat rahsia",
52
- "text.input-secret-show": "Tunjuk",
53
- "text.input-secret-hide": "Sembunyi",
54
- "text.input-secret-toggle": "Tunjuk/Sembunyi"
55
+ "text.value list separator": "pemisah senarai nilai"
55
56
  }
@@ -19,6 +19,7 @@
19
19
  "label.operators": "运算符",
20
20
  "label.privilege": "权限",
21
21
  "label.protected-request-ip": "安全请求 IP",
22
+ "label.search": "搜索关键词",
22
23
  "label.second": "秒",
23
24
  "label.seconds": "秒",
24
25
  "label.superuser": "超级用户",
@@ -43,13 +44,13 @@
43
44
  "text.every second": "每秒",
44
45
  "text.every sunday": "每个星期天",
45
46
  "text.every weekday": "每个工作日",
47
+ "text.input-secret-hide": "隐藏",
48
+ "text.input-secret-placeholder": "输入机密信息",
49
+ "text.input-secret-show": "显示",
50
+ "text.input-secret-toggle": "显示/隐藏",
46
51
  "text.range of values": "值的范围",
47
52
  "text.step values": "步进值",
48
53
  "text.the first day of every month": "每月第一天",
49
54
  "text.the first day of every year": "每年1月1日",
50
- "text.value list separator": "值列表分隔符",
51
- "text.input-secret-placeholder": "输入机密信息",
52
- "text.input-secret-show": "显示",
53
- "text.input-secret-hide": "隐藏",
54
- "text.input-secret-toggle": "显示/隐藏"
55
+ "text.value list separator": "值列表分隔符"
55
56
  }