@operato/grist-editor 2.0.0-alpha.9 → 2.0.0-alpha.90
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 +420 -0
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/ox-grist-editor-crontab.d.ts +1 -1
- package/dist/src/ox-grist-editor-duration.d.ts +1 -1
- package/dist/src/ox-grist-editor-hashtags.d.ts +1 -1
- package/dist/src/ox-grist-editor-i18n-label.d.ts +13 -0
- package/dist/src/ox-grist-editor-i18n-label.js +85 -0
- package/dist/src/ox-grist-editor-i18n-label.js.map +1 -0
- package/dist/src/ox-grist-editor-parameters.d.ts +1 -1
- package/dist/src/ox-grist-editor-partition-keys.d.ts +1 -1
- package/dist/src/ox-grist-editor-partition-keys.js +1 -1
- package/dist/src/ox-grist-editor-partition-keys.js.map +1 -1
- package/dist/src/ox-grist-editor-quantifier.d.ts +1 -1
- package/dist/src/ox-grist-editor-value-map.d.ts +1 -1
- package/dist/src/ox-grist-editor-value-ranges.d.ts +1 -1
- package/dist/src/ox-grist-renderer-i18n-label.d.ts +2 -0
- package/dist/src/ox-grist-renderer-i18n-label.js +9 -0
- package/dist/src/ox-grist-renderer-i18n-label.js.map +1 -0
- package/dist/src/ox-grist-renderer-partition-keys.d.ts +1 -1
- package/dist/src/ox-grist-renderer-partition-keys.js +4 -4
- package/dist/src/ox-grist-renderer-partition-keys.js.map +1 -1
- package/dist/src/ox-popup-crontab-input.d.ts +2 -1
- package/dist/src/ox-popup-crontab-input.js +7 -8
- package/dist/src/ox-popup-crontab-input.js.map +1 -1
- package/dist/src/ox-popup-duration-input.d.ts +2 -1
- package/dist/src/ox-popup-duration-input.js +7 -8
- package/dist/src/ox-popup-duration-input.js.map +1 -1
- package/dist/src/ox-popup-hashtags-input.d.ts +2 -1
- package/dist/src/ox-popup-hashtags-input.js +8 -9
- package/dist/src/ox-popup-hashtags-input.js.map +1 -1
- package/dist/src/ox-popup-i18n-label-input.d.ts +16 -0
- package/dist/src/ox-popup-i18n-label-input.js +100 -0
- package/dist/src/ox-popup-i18n-label-input.js.map +1 -0
- package/dist/src/ox-popup-parameters-builder.d.ts +2 -1
- package/dist/src/ox-popup-parameters-builder.js +7 -8
- package/dist/src/ox-popup-parameters-builder.js.map +1 -1
- package/dist/src/ox-popup-partition-keys-input.d.ts +2 -1
- package/dist/src/ox-popup-partition-keys-input.js +7 -8
- package/dist/src/ox-popup-partition-keys-input.js.map +1 -1
- package/dist/src/ox-popup-value-map-input.d.ts +2 -1
- package/dist/src/ox-popup-value-map-input.js +7 -8
- package/dist/src/ox-popup-value-map-input.js.map +1 -1
- package/dist/src/ox-popup-value-ranges-input.d.ts +2 -1
- package/dist/src/ox-popup-value-ranges-input.js +7 -8
- package/dist/src/ox-popup-value-ranges-input.js.map +1 -1
- package/dist/stories/ox-grist-editor-crontab.stories.d.ts +1 -1
- package/dist/stories/ox-grist-editor-crontab.stories.js +66 -54
- package/dist/stories/ox-grist-editor-crontab.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +44 -36
- package/src/index.ts +4 -0
- package/src/ox-grist-editor-i18n-label.ts +101 -0
- package/src/ox-grist-editor-partition-keys.ts +1 -1
- package/src/ox-grist-renderer-i18n-label.ts +12 -0
- package/src/ox-grist-renderer-partition-keys.ts +4 -4
- package/src/ox-popup-crontab-input.ts +7 -8
- package/src/ox-popup-duration-input.ts +7 -8
- package/src/ox-popup-hashtags-input.ts +8 -9
- package/src/ox-popup-i18n-label-input.ts +97 -0
- package/src/ox-popup-parameters-builder.ts +7 -8
- package/src/ox-popup-partition-keys-input.ts +7 -8
- package/src/ox-popup-value-map-input.ts +8 -8
- package/src/ox-popup-value-ranges-input.ts +7 -8
- package/stories/ox-grist-editor-crontab.stories.ts +71 -60
- package/themes/grist-theme.css +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/grist-editor",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.90",
|
|
4
4
|
"description": "Webcomponent for grist-editor following open-wc recommendations",
|
|
5
5
|
"author": "heartyoh",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -17,42 +17,51 @@
|
|
|
17
17
|
},
|
|
18
18
|
"exports": {
|
|
19
19
|
".": "./dist/src/index.js",
|
|
20
|
-
"./ox-grist-editor-duration.js": "./dist/src/ox-grist-editor-duration.js",
|
|
21
20
|
"./ox-grist-editor-crontab.js": "./dist/src/ox-grist-editor-crontab.js",
|
|
21
|
+
"./ox-grist-editor-duration.js": "./dist/src/ox-grist-editor-duration.js",
|
|
22
|
+
"./ox-grist-editor-hashtags.js": "./dist/src/ox-grist-editor-hashtags.js",
|
|
23
|
+
"./ox-grist-editor-i18n-label.js": "./dist/src/ox-grist-editor-i18n-label.js",
|
|
22
24
|
"./ox-grist-editor-parameters.js": "./dist/src/ox-grist-editor-parameters.js",
|
|
23
|
-
"./ox-grist-editor-value-map.js": "./dist/src/ox-grist-editor-value-map.js",
|
|
24
|
-
"./ox-grist-editor-value-ranges.js": "./dist/src/ox-grist-editor-value-ranges.js",
|
|
25
25
|
"./ox-grist-editor-partition-keys.js": "./dist/src/ox-grist-editor-partition-keys.js",
|
|
26
26
|
"./ox-grist-editor-quantifier.js": "./dist/src/ox-grist-editor-quantifier.js",
|
|
27
|
+
"./ox-grist-editor-value-map.js": "./dist/src/ox-grist-editor-value-map.js",
|
|
28
|
+
"./ox-grist-editor-value-ranges.js": "./dist/src/ox-grist-editor-value-ranges.js",
|
|
27
29
|
"./ox-grist-renderer-crontab.js": "./dist/src/ox-grist-renderer-crontab.js",
|
|
28
30
|
"./ox-grist-renderer-duration.js": "./dist/src/ox-grist-renderer-duration.js",
|
|
29
31
|
"./ox-grist-renderer-hashtags.js": "./dist/src/ox-grist-renderer-hashtags.js",
|
|
32
|
+
"./ox-grist-renderer-i18n-label.js": "./dist/src/ox-grist-renderer-i18n-label.js",
|
|
30
33
|
"./ox-grist-renderer-partition-keys.js": "./dist/src/ox-grist-renderer-partition-keys.js",
|
|
31
34
|
"./ox-grist-renderer-quantifier.js": "./dist/src/ox-grist-renderer-quantifier.js"
|
|
32
35
|
},
|
|
33
36
|
"typesVersions": {
|
|
34
37
|
"*": {
|
|
38
|
+
"ox-grist-editor-crontab.js": [
|
|
39
|
+
"dist/src/ox-grist-editor-crontab.d.ts"
|
|
40
|
+
],
|
|
35
41
|
"ox-grist-editor-duration.js": [
|
|
36
42
|
"dist/src/ox-grist-editor-duration.d.ts"
|
|
37
43
|
],
|
|
38
|
-
"ox-grist-editor-
|
|
39
|
-
"dist/src/ox-grist-editor-
|
|
44
|
+
"ox-grist-editor-hashtags.js": [
|
|
45
|
+
"dist/src/ox-grist-editor-hashtags.d.ts"
|
|
46
|
+
],
|
|
47
|
+
"ox-grist-editor-i18n-label.js": [
|
|
48
|
+
"dist/src/ox-grist-editor-i18n-label.d.ts"
|
|
40
49
|
],
|
|
41
50
|
"ox-grist-editor-parameters.js": [
|
|
42
51
|
"dist/src/ox-grist-editor-parameters.d.ts"
|
|
43
52
|
],
|
|
44
|
-
"ox-grist-editor-value-map.js": [
|
|
45
|
-
"dist/src/ox-grist-editor-value-map.d.ts"
|
|
46
|
-
],
|
|
47
|
-
"ox-grist-editor-value-ranges.js": [
|
|
48
|
-
"dist/src/ox-grist-editor-value-ranges.d.ts"
|
|
49
|
-
],
|
|
50
53
|
"ox-grist-editor-partition-keys.js": [
|
|
51
54
|
"dist/src/ox-grist-editor-partition-keys.d.ts"
|
|
52
55
|
],
|
|
53
56
|
"ox-grist-editor-quantifier.js": [
|
|
54
57
|
"dist/src/ox-grist-editor-quantifier.d.ts"
|
|
55
58
|
],
|
|
59
|
+
"ox-grist-editor-value-map.js": [
|
|
60
|
+
"dist/src/ox-grist-editor-value-map.d.ts"
|
|
61
|
+
],
|
|
62
|
+
"ox-grist-editor-value-ranges.js": [
|
|
63
|
+
"dist/src/ox-grist-editor-value-ranges.d.ts"
|
|
64
|
+
],
|
|
56
65
|
"ox-grist-renderer-crontab.js": [
|
|
57
66
|
"dist/src/ox-grist-renderer-crontab.d.ts"
|
|
58
67
|
],
|
|
@@ -62,6 +71,9 @@
|
|
|
62
71
|
"ox-grist-renderer-hashtags.js": [
|
|
63
72
|
"dist/src/ox-grist-renderer-hashtags.d.ts"
|
|
64
73
|
],
|
|
74
|
+
"ox-grist-renderer-i18n-label.js": [
|
|
75
|
+
"dist/src/ox-grist-renderer-i18n-label.d.ts"
|
|
76
|
+
],
|
|
65
77
|
"ox-grist-renderer-partition-keys.js": [
|
|
66
78
|
"dist/src/ox-grist-renderer-partition-keys.d.ts"
|
|
67
79
|
],
|
|
@@ -83,41 +95,37 @@
|
|
|
83
95
|
"storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook"
|
|
84
96
|
},
|
|
85
97
|
"dependencies": {
|
|
86
|
-
"@material/
|
|
87
|
-
"@
|
|
88
|
-
"@
|
|
89
|
-
"@operato/
|
|
90
|
-
"@operato/
|
|
91
|
-
"@operato/
|
|
92
|
-
"@operato/
|
|
93
|
-
"@operato/
|
|
94
|
-
"@operato/property-editor": "^2.0.0-alpha.9",
|
|
95
|
-
"@operato/styles": "^2.0.0-alpha.0",
|
|
98
|
+
"@material/web": "^1.4.0",
|
|
99
|
+
"@operato/data-grist": "^2.0.0-alpha.90",
|
|
100
|
+
"@operato/help": "^2.0.0-alpha.90",
|
|
101
|
+
"@operato/i18n": "^2.0.0-alpha.59",
|
|
102
|
+
"@operato/input": "^2.0.0-alpha.90",
|
|
103
|
+
"@operato/popup": "^2.0.0-alpha.90",
|
|
104
|
+
"@operato/property-editor": "^2.0.0-alpha.90",
|
|
105
|
+
"@operato/styles": "^2.0.0-alpha.90",
|
|
96
106
|
"cronstrue": "^2.2.0",
|
|
97
107
|
"cross-fetch": "^3.1.5",
|
|
98
|
-
"lit": "^
|
|
108
|
+
"lit": "^3.1.2",
|
|
99
109
|
"lodash-es": "^4.17.21"
|
|
100
110
|
},
|
|
101
111
|
"devDependencies": {
|
|
102
|
-
"@custom-elements-manifest/analyzer": "^0.
|
|
112
|
+
"@custom-elements-manifest/analyzer": "^0.9.2",
|
|
103
113
|
"@hatiolab/prettier-config": "^1.0.0",
|
|
104
|
-
"@
|
|
105
|
-
"@material/mwc-icon": "^0.27.0",
|
|
106
|
-
"@open-wc/eslint-config": "^10.0.0",
|
|
114
|
+
"@open-wc/eslint-config": "^12.0.3",
|
|
107
115
|
"@open-wc/testing": "^3.1.6",
|
|
108
116
|
"@types/lodash-es": "^4.17.5",
|
|
109
117
|
"@types/w3c-web-usb": "^1.0.5",
|
|
110
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
111
|
-
"@typescript-eslint/parser": "^
|
|
118
|
+
"@typescript-eslint/eslint-plugin": "^7.0.1",
|
|
119
|
+
"@typescript-eslint/parser": "^7.0.1",
|
|
112
120
|
"@web/dev-server": "^0.3.0",
|
|
113
|
-
"@web/dev-server-storybook": "^0.
|
|
114
|
-
"@web/test-runner": "^0.
|
|
121
|
+
"@web/dev-server-storybook": "^2.0.1",
|
|
122
|
+
"@web/test-runner": "^0.18.0",
|
|
115
123
|
"concurrently": "^8.0.1",
|
|
116
124
|
"eslint": "^8.39.0",
|
|
117
|
-
"eslint-config-prettier": "^
|
|
118
|
-
"husky": "^
|
|
119
|
-
"lint-staged": "^
|
|
120
|
-
"prettier": "^2.
|
|
125
|
+
"eslint-config-prettier": "^9.1.0",
|
|
126
|
+
"husky": "^9.0.11",
|
|
127
|
+
"lint-staged": "^15.2.2",
|
|
128
|
+
"prettier": "^3.2.5",
|
|
121
129
|
"tslib": "^2.3.1",
|
|
122
130
|
"typescript": "^5.0.4"
|
|
123
131
|
},
|
|
@@ -134,5 +142,5 @@
|
|
|
134
142
|
"prettier --write"
|
|
135
143
|
]
|
|
136
144
|
},
|
|
137
|
-
"gitHead": "
|
|
145
|
+
"gitHead": "a01f651e658c5941911d30daa015b4dc5e20257c"
|
|
138
146
|
}
|
package/src/index.ts
CHANGED
|
@@ -12,6 +12,8 @@ import { OxGristRendererQuantifier } from './ox-grist-renderer-quantifier'
|
|
|
12
12
|
import { OxGristRendererHashtags } from './ox-grist-renderer-hashtags'
|
|
13
13
|
import { OxGristRendererPartitionKeys } from './ox-grist-renderer-partition-keys.js'
|
|
14
14
|
import { OxGristEditorValueRanges } from './ox-grist-editor-value-ranges.js'
|
|
15
|
+
import { OxGristEditorI18nLabel } from './ox-grist-editor-i18n-label.js'
|
|
16
|
+
import { OxGristRendererI18nLabel } from './ox-grist-renderer-i18n-label.js'
|
|
15
17
|
|
|
16
18
|
/* register grist renderer/editor for id */
|
|
17
19
|
registerEditor('parameters', OxGristEditorParameters)
|
|
@@ -22,6 +24,7 @@ registerEditor('crontab', OxGristEditorCrontab)
|
|
|
22
24
|
registerEditor('duration', OxGristEditorDuration)
|
|
23
25
|
registerEditor('quantifier', OxGristEditorQuantifier)
|
|
24
26
|
registerEditor('hashtags', OxGristEditorHashtags)
|
|
27
|
+
registerEditor('i18n-label', OxGristEditorI18nLabel)
|
|
25
28
|
|
|
26
29
|
registerRenderer('parameters', OxGristRendererJson5)
|
|
27
30
|
registerRenderer('value-map', OxGristRendererJson5)
|
|
@@ -30,3 +33,4 @@ registerRenderer('partition-keys', OxGristRendererPartitionKeys)
|
|
|
30
33
|
registerRenderer('duration', OxGristRendererDuration)
|
|
31
34
|
registerRenderer('quantifier', OxGristRendererQuantifier)
|
|
32
35
|
registerRenderer('hashtags', OxGristRendererHashtags)
|
|
36
|
+
registerRenderer('i18n-label', OxGristRendererI18nLabel)
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import './ox-popup-i18n-label-input.js'
|
|
6
|
+
|
|
7
|
+
import { html } from 'lit'
|
|
8
|
+
import { customElement } from 'lit/decorators.js'
|
|
9
|
+
import json5 from 'json5'
|
|
10
|
+
|
|
11
|
+
import { cloneDeep } from 'lodash-es'
|
|
12
|
+
|
|
13
|
+
import { OxGristEditor } from '@operato/data-grist'
|
|
14
|
+
import { i18next } from '@operato/i18n'
|
|
15
|
+
import { openPopup, PopupHandle } from '@operato/popup'
|
|
16
|
+
|
|
17
|
+
@customElement('ox-grist-editor-i18n-label')
|
|
18
|
+
export class OxGristEditorI18nLabel extends OxGristEditor {
|
|
19
|
+
private popup?: PopupHandle
|
|
20
|
+
|
|
21
|
+
get options() {
|
|
22
|
+
return this.column.record?.options || {}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get editorTemplate() {
|
|
26
|
+
const { displayColumn } = this.column.record.options || {}
|
|
27
|
+
|
|
28
|
+
const value =
|
|
29
|
+
this.value && typeof this.value === 'object'
|
|
30
|
+
? this.value[i18next.language || 'en-US']
|
|
31
|
+
: displayColumn
|
|
32
|
+
? this.record[displayColumn]
|
|
33
|
+
: ''
|
|
34
|
+
|
|
35
|
+
return html`<div tabindex="0">${value || ''}</div>`
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
_onclick(e: Event): void {
|
|
39
|
+
e.stopPropagation()
|
|
40
|
+
this.openSelector()
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
_onkeydown(e: KeyboardEvent): void {
|
|
44
|
+
const key = e.key
|
|
45
|
+
if (key == 'Enter') {
|
|
46
|
+
e.stopPropagation()
|
|
47
|
+
this.openSelector()
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async openSelector() {
|
|
52
|
+
if (this.popup) {
|
|
53
|
+
delete this.popup
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const { name, help, languages, objectified = false } = this.options || {}
|
|
57
|
+
|
|
58
|
+
const confirmCallback = (newval: any) => {
|
|
59
|
+
this.dispatchEvent(
|
|
60
|
+
new CustomEvent('field-change', {
|
|
61
|
+
bubbles: true,
|
|
62
|
+
composed: true,
|
|
63
|
+
detail: {
|
|
64
|
+
before: this.value,
|
|
65
|
+
after: !objectified ? JSON.stringify(newval) : newval,
|
|
66
|
+
record: this.record,
|
|
67
|
+
column: this.column,
|
|
68
|
+
row: this.row
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
var value: any =
|
|
76
|
+
!objectified && typeof this.value === 'string' ? JSON.parse(this.value) : cloneDeep(this.value || {})
|
|
77
|
+
} catch (e) {
|
|
78
|
+
var value: any = {}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/*
|
|
82
|
+
주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로,
|
|
83
|
+
layout의 구성에 변화가 발생하면, 다시 render된다.
|
|
84
|
+
이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)
|
|
85
|
+
이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,
|
|
86
|
+
만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.
|
|
87
|
+
따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
|
|
88
|
+
*/
|
|
89
|
+
var template = html`
|
|
90
|
+
<ox-popup-i18n-label-input .value=${value} .languages=${languages} .confirmCallback=${confirmCallback}>
|
|
91
|
+
</ox-popup-i18n-label-input>
|
|
92
|
+
`
|
|
93
|
+
|
|
94
|
+
this.popup = openPopup(template, {
|
|
95
|
+
backdrop: true,
|
|
96
|
+
size: 'large',
|
|
97
|
+
title: `${name?.toUpperCase() || i18next.t('title.i18n-label')} `,
|
|
98
|
+
help
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -18,7 +18,7 @@ export class OxGristEditorPartitionKeys extends OxGristEditor {
|
|
|
18
18
|
|
|
19
19
|
get editorTemplate() {
|
|
20
20
|
return this.value && this.value instanceof Array && this.value.length > 0
|
|
21
|
-
? html`<
|
|
21
|
+
? html`<md-icon style="--md-icon-size:1.3em">key</md-icon>`
|
|
22
22
|
: html``
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { html } from 'lit'
|
|
2
|
+
|
|
3
|
+
import { FieldRenderer } from '@operato/data-grist'
|
|
4
|
+
import i18next from 'i18next'
|
|
5
|
+
|
|
6
|
+
export const OxGristRendererI18nLabel: FieldRenderer = (value, column, record, rowIndex, field) => {
|
|
7
|
+
const language = i18next.language || 'en-US'
|
|
8
|
+
const labels = value || {}
|
|
9
|
+
const label = labels[language] || labels[language.substring(0, 2)] || labels['en'] || ''
|
|
10
|
+
|
|
11
|
+
return html`<span>${label}</span>`
|
|
12
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import '@material/
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
2
|
import { html } from 'lit'
|
|
3
3
|
import { FieldRenderer } from '@operato/data-grist'
|
|
4
4
|
|
|
@@ -15,11 +15,11 @@ function onmouseout(e: MouseEvent) {
|
|
|
15
15
|
|
|
16
16
|
export const OxGristRendererPartitionKeys: FieldRenderer = (value, column, record, rowIndex, field) => {
|
|
17
17
|
return value && value instanceof Array && value.length > 0
|
|
18
|
-
? html`<
|
|
19
|
-
style="--
|
|
18
|
+
? html`<md-icon
|
|
19
|
+
style="--md-icon-size:1.3em"
|
|
20
20
|
@mouseover=${(e: MouseEvent) => onmouseover(e, value)}
|
|
21
21
|
@mouseout=${onmouseout}
|
|
22
|
-
>key</
|
|
22
|
+
>key</md-icon
|
|
23
23
|
>`
|
|
24
24
|
: html``
|
|
25
25
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
1
2
|
import '@operato/input/ox-input-crontab.js'
|
|
2
3
|
|
|
3
4
|
import { css, html, LitElement } from 'lit'
|
|
@@ -5,11 +6,12 @@ import { customElement, property } from 'lit/decorators.js'
|
|
|
5
6
|
|
|
6
7
|
import { i18next } from '@operato/i18n'
|
|
7
8
|
import { closePopup } from '@operato/popup'
|
|
8
|
-
import { ScrollbarStyles } from '@operato/styles'
|
|
9
|
+
import { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles'
|
|
9
10
|
|
|
10
11
|
@customElement('ox-popup-crontab-input')
|
|
11
12
|
export class OxPopupCrontabInput extends LitElement {
|
|
12
13
|
static styles = [
|
|
14
|
+
ButtonContainerStyles,
|
|
13
15
|
ScrollbarStyles,
|
|
14
16
|
css`
|
|
15
17
|
:host {
|
|
@@ -36,11 +38,6 @@ export class OxPopupCrontabInput extends LitElement {
|
|
|
36
38
|
|
|
37
39
|
color: var(--primary-color);
|
|
38
40
|
}
|
|
39
|
-
|
|
40
|
-
.button-container {
|
|
41
|
-
display: flex;
|
|
42
|
-
margin-left: auto;
|
|
43
|
-
}
|
|
44
41
|
`
|
|
45
42
|
]
|
|
46
43
|
|
|
@@ -52,8 +49,10 @@ export class OxPopupCrontabInput extends LitElement {
|
|
|
52
49
|
<ox-input-crontab .value=${this.value} @change=${this.onChange.bind(this)}> </ox-input-crontab>
|
|
53
50
|
|
|
54
51
|
<div class="button-container">
|
|
55
|
-
<
|
|
56
|
-
|
|
52
|
+
<button @click=${this.onCancel.bind(this)} danger>
|
|
53
|
+
<md-icon>cancel</md-icon>${i18next.t('button.cancel')}
|
|
54
|
+
</button>
|
|
55
|
+
<button @click=${this.onConfirm.bind(this)}><md-icon>done</md-icon>${i18next.t('button.confirm')}</button>
|
|
57
56
|
</div>
|
|
58
57
|
`
|
|
59
58
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
1
2
|
import '@operato/input/ox-input-duration.js'
|
|
2
3
|
|
|
3
4
|
import { css, html, LitElement } from 'lit'
|
|
@@ -5,11 +6,12 @@ import { customElement, property } from 'lit/decorators.js'
|
|
|
5
6
|
|
|
6
7
|
import { i18next } from '@operato/i18n'
|
|
7
8
|
import { closePopup } from '@operato/popup'
|
|
8
|
-
import { ScrollbarStyles } from '@operato/styles'
|
|
9
|
+
import { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles'
|
|
9
10
|
|
|
10
11
|
@customElement('ox-popup-duration-input')
|
|
11
12
|
export class OxPopupDurationInput extends LitElement {
|
|
12
13
|
static styles = [
|
|
14
|
+
ButtonContainerStyles,
|
|
13
15
|
ScrollbarStyles,
|
|
14
16
|
css`
|
|
15
17
|
:host {
|
|
@@ -26,11 +28,6 @@ export class OxPopupDurationInput extends LitElement {
|
|
|
26
28
|
flex: 1;
|
|
27
29
|
overflow-y: auto;
|
|
28
30
|
}
|
|
29
|
-
|
|
30
|
-
.button-container {
|
|
31
|
-
display: flex;
|
|
32
|
-
margin-left: auto;
|
|
33
|
-
}
|
|
34
31
|
`
|
|
35
32
|
]
|
|
36
33
|
|
|
@@ -42,8 +39,10 @@ export class OxPopupDurationInput extends LitElement {
|
|
|
42
39
|
<ox-input-duration .value=${this.value} @change=${this.onChange.bind(this)}> </ox-input-duration>
|
|
43
40
|
|
|
44
41
|
<div class="button-container">
|
|
45
|
-
<
|
|
46
|
-
|
|
42
|
+
<button @click=${this.onCancel.bind(this)} danger>
|
|
43
|
+
<md-icon>cancel</md-icon>${i18next.t('button.cancel')}
|
|
44
|
+
</button>
|
|
45
|
+
<button @click=${this.onConfirm.bind(this)}><md-icon>done</md-icon>${i18next.t('button.confirm')}</button>
|
|
47
46
|
</div>
|
|
48
47
|
`
|
|
49
48
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
1
2
|
import '@operato/input/ox-input-hashtags.js'
|
|
2
3
|
|
|
3
4
|
import { css, html, LitElement } from 'lit'
|
|
@@ -5,11 +6,12 @@ import { customElement, property } from 'lit/decorators.js'
|
|
|
5
6
|
|
|
6
7
|
import { i18next } from '@operato/i18n'
|
|
7
8
|
import { closePopup } from '@operato/popup'
|
|
8
|
-
import { ScrollbarStyles } from '@operato/styles'
|
|
9
|
+
import { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles'
|
|
9
10
|
|
|
10
11
|
@customElement('ox-popup-hashtags-input')
|
|
11
12
|
export class OxPopupHashtagsInput extends LitElement {
|
|
12
13
|
static styles = [
|
|
14
|
+
ButtonContainerStyles,
|
|
13
15
|
ScrollbarStyles,
|
|
14
16
|
css`
|
|
15
17
|
:host {
|
|
@@ -26,15 +28,10 @@ export class OxPopupHashtagsInput extends LitElement {
|
|
|
26
28
|
flex: 1;
|
|
27
29
|
overflow-y: auto;
|
|
28
30
|
}
|
|
29
|
-
|
|
30
|
-
.button-container {
|
|
31
|
-
display: flex;
|
|
32
|
-
margin-left: auto;
|
|
33
|
-
}
|
|
34
31
|
`
|
|
35
32
|
]
|
|
36
33
|
|
|
37
|
-
@property({ type:
|
|
34
|
+
@property({ type: Array }) value: string[] = []
|
|
38
35
|
@property({ type: Object }) confirmCallback!: (newval: any) => void
|
|
39
36
|
|
|
40
37
|
render() {
|
|
@@ -42,8 +39,10 @@ export class OxPopupHashtagsInput extends LitElement {
|
|
|
42
39
|
<ox-input-hashtags .value=${this.value} @change=${this.onChange.bind(this)}> </ox-input-hashtags>
|
|
43
40
|
|
|
44
41
|
<div class="button-container">
|
|
45
|
-
<
|
|
46
|
-
|
|
42
|
+
<button @click=${this.onCancel.bind(this)} danger>
|
|
43
|
+
<md-icon>cancel</md-icon>${i18next.t('button.cancel')}
|
|
44
|
+
</button>
|
|
45
|
+
<button @click=${this.onConfirm.bind(this)}><md-icon>done</md-icon>${i18next.t('button.confirm')}</button>
|
|
47
46
|
</div>
|
|
48
47
|
`
|
|
49
48
|
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
|
+
import '@operato/input/ox-input-i18n-label.js'
|
|
3
|
+
|
|
4
|
+
import { css, html, LitElement } from 'lit'
|
|
5
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
6
|
+
|
|
7
|
+
import { i18next } from '@operato/i18n'
|
|
8
|
+
import { closePopup } from '@operato/popup'
|
|
9
|
+
import { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles'
|
|
10
|
+
|
|
11
|
+
@customElement('ox-popup-i18n-label-input')
|
|
12
|
+
export class OxPopupValueMapInput extends LitElement {
|
|
13
|
+
static styles = [
|
|
14
|
+
ButtonContainerStyles,
|
|
15
|
+
ScrollbarStyles,
|
|
16
|
+
css`
|
|
17
|
+
:host {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
|
|
21
|
+
background-color: #fff;
|
|
22
|
+
|
|
23
|
+
width: var(--overlay-center-normal-width, 50%);
|
|
24
|
+
height: var(--overlay-center-normal-height, 50%);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
ox-input-i18n-label {
|
|
28
|
+
flex: 1;
|
|
29
|
+
overflow-y: auto;
|
|
30
|
+
padding: var(--padding-default);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
span {
|
|
34
|
+
flex: 1;
|
|
35
|
+
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
|
|
40
|
+
color: var(--primary-color);
|
|
41
|
+
}
|
|
42
|
+
`
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
@property({ type: Object }) value: any
|
|
46
|
+
@property({ type: Array }) languages: { code: string; display: string }[] = []
|
|
47
|
+
@property({ type: Object }) confirmCallback!: (newval: any) => void
|
|
48
|
+
|
|
49
|
+
render() {
|
|
50
|
+
return html`
|
|
51
|
+
<ox-input-i18n-label .value=${this.value} .languages=${this.languages} @change=${this.onChange.bind(this)}>
|
|
52
|
+
</ox-input-i18n-label>
|
|
53
|
+
|
|
54
|
+
<div class="button-container">
|
|
55
|
+
<button @click=${this.onCancel.bind(this)} danger>
|
|
56
|
+
<md-icon>cancel</md-icon>${i18next.t('button.cancel')}
|
|
57
|
+
</button>
|
|
58
|
+
<button @click=${this.onConfirm.bind(this)}><md-icon>done</md-icon>${i18next.t('button.confirm')}</button>
|
|
59
|
+
</div>
|
|
60
|
+
`
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private onChange(e: CustomEvent) {
|
|
64
|
+
e.stopPropagation()
|
|
65
|
+
|
|
66
|
+
/*
|
|
67
|
+
주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로,
|
|
68
|
+
layout의 구성에 변화가 발생하면, 다시 render된다.
|
|
69
|
+
이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)
|
|
70
|
+
이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,
|
|
71
|
+
만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.
|
|
72
|
+
따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
|
|
73
|
+
(이 팝업 클래스를 템플릿으로 사용한 곳의 코드를 참조하세요.)
|
|
74
|
+
=>
|
|
75
|
+
이런 이유로, Object.assign(...)을 사용하였다.
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
if (!this.value || typeof this.value !== 'object') {
|
|
79
|
+
this.value = {}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
for (let key in this.value) {
|
|
83
|
+
delete this.value[key]
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
Object.assign(this.value, e.detail)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private onCancel(e: Event) {
|
|
90
|
+
closePopup(this)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private onConfirm(e: Event) {
|
|
94
|
+
this.confirmCallback && this.confirmCallback(this.value)
|
|
95
|
+
closePopup(this)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
1
2
|
import '@operato/i18n/ox-i18n.js'
|
|
2
3
|
|
|
3
4
|
import { css, html, LitElement } from 'lit'
|
|
@@ -5,11 +6,12 @@ import { customElement, property } from 'lit/decorators.js'
|
|
|
5
6
|
|
|
6
7
|
import { i18next } from '@operato/i18n'
|
|
7
8
|
import { closePopup } from '@operato/popup'
|
|
8
|
-
import { ScrollbarStyles } from '@operato/styles'
|
|
9
|
+
import { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles'
|
|
9
10
|
|
|
10
11
|
@customElement('ox-popup-parameters-builder')
|
|
11
12
|
export class OxPopupParametersBuilder extends LitElement {
|
|
12
13
|
static styles = [
|
|
14
|
+
ButtonContainerStyles,
|
|
13
15
|
ScrollbarStyles,
|
|
14
16
|
css`
|
|
15
17
|
:host {
|
|
@@ -36,11 +38,6 @@ export class OxPopupParametersBuilder extends LitElement {
|
|
|
36
38
|
|
|
37
39
|
color: var(--primary-color);
|
|
38
40
|
}
|
|
39
|
-
|
|
40
|
-
.button-container {
|
|
41
|
-
display: flex;
|
|
42
|
-
margin-left: auto;
|
|
43
|
-
}
|
|
44
41
|
`
|
|
45
42
|
]
|
|
46
43
|
|
|
@@ -68,8 +65,10 @@ export class OxPopupParametersBuilder extends LitElement {
|
|
|
68
65
|
: html` <span><ox-i18n msgid="text.no properties to set"></ox-i18n></span> `}
|
|
69
66
|
|
|
70
67
|
<div class="button-container">
|
|
71
|
-
<
|
|
72
|
-
|
|
68
|
+
<button @click=${this.onCancel.bind(this)} danger>
|
|
69
|
+
<md-icon>cancel</md-icon>${i18next.t('button.cancel')}
|
|
70
|
+
</button>
|
|
71
|
+
<button @click=${this.onConfirm.bind(this)}><md-icon>done</md-icon>${i18next.t('button.confirm')}</button>
|
|
73
72
|
</div>
|
|
74
73
|
`
|
|
75
74
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
1
2
|
import '@operato/input/ox-input-partition-keys.js'
|
|
2
3
|
|
|
3
4
|
import { css, html, LitElement } from 'lit'
|
|
@@ -5,11 +6,12 @@ import { customElement, property } from 'lit/decorators.js'
|
|
|
5
6
|
|
|
6
7
|
import { i18next } from '@operato/i18n'
|
|
7
8
|
import { closePopup } from '@operato/popup'
|
|
8
|
-
import { ScrollbarStyles } from '@operato/styles'
|
|
9
|
+
import { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles'
|
|
9
10
|
|
|
10
11
|
@customElement('ox-popup-partition-keys-input')
|
|
11
12
|
export class OxPopupPartitionKeysInput extends LitElement {
|
|
12
13
|
static styles = [
|
|
14
|
+
ButtonContainerStyles,
|
|
13
15
|
ScrollbarStyles,
|
|
14
16
|
css`
|
|
15
17
|
:host {
|
|
@@ -37,11 +39,6 @@ export class OxPopupPartitionKeysInput extends LitElement {
|
|
|
37
39
|
|
|
38
40
|
color: var(--primary-color);
|
|
39
41
|
}
|
|
40
|
-
|
|
41
|
-
.button-container {
|
|
42
|
-
display: flex;
|
|
43
|
-
margin-left: auto;
|
|
44
|
-
}
|
|
45
42
|
`
|
|
46
43
|
]
|
|
47
44
|
|
|
@@ -54,8 +51,10 @@ export class OxPopupPartitionKeysInput extends LitElement {
|
|
|
54
51
|
<ox-input-partition-keys .value=${this.value} @change=${this.onChange.bind(this)}> </ox-input-partition-keys>
|
|
55
52
|
|
|
56
53
|
<div class="button-container">
|
|
57
|
-
<
|
|
58
|
-
|
|
54
|
+
<button @click=${this.onCancel.bind(this)} danger>
|
|
55
|
+
<md-icon>cancel</md-icon>${i18next.t('button.cancel')}
|
|
56
|
+
</button>
|
|
57
|
+
<button @click=${this.onConfirm.bind(this)}><md-icon>done</md-icon>${i18next.t('button.confirm')}</button>
|
|
59
58
|
</div>
|
|
60
59
|
`
|
|
61
60
|
}
|