@operato/grist-editor 8.0.0-alpha.9 → 8.0.0-beta.1
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 +187 -0
- package/dist/src/ox-grist-renderer-hashtags.js +0 -1
- package/dist/src/ox-grist-renderer-hashtags.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -17
- package/.storybook/main.js +0 -3
- package/.storybook/preview.js +0 -52
- package/.storybook/server.mjs +0 -8
- package/src/index.ts +0 -40
- package/src/ox-grist-editor-crontab.ts +0 -63
- package/src/ox-grist-editor-duration.ts +0 -63
- package/src/ox-grist-editor-hashtags.ts +0 -68
- package/src/ox-grist-editor-i18n-label.ts +0 -101
- package/src/ox-grist-editor-parameters.ts +0 -100
- package/src/ox-grist-editor-partition-keys.ts +0 -88
- package/src/ox-grist-editor-quantifier.ts +0 -13
- package/src/ox-grist-editor-signature.ts +0 -13
- package/src/ox-grist-editor-value-map.ts +0 -97
- package/src/ox-grist-editor-value-ranges.ts +0 -96
- package/src/ox-grist-renderer-crontab.ts +0 -18
- package/src/ox-grist-renderer-duration.ts +0 -31
- package/src/ox-grist-renderer-hashtags.ts +0 -14
- package/src/ox-grist-renderer-i18n-label.ts +0 -12
- package/src/ox-grist-renderer-partition-keys.ts +0 -29
- package/src/ox-grist-renderer-quantifier.ts +0 -9
- package/src/ox-grist-renderer-signature.ts +0 -9
- package/src/ox-parameters-builder.ts +0 -134
- package/src/ox-popup-crontab-input.ts +0 -75
- package/src/ox-popup-duration-input.ts +0 -65
- package/src/ox-popup-hashtags-input.ts +0 -66
- package/src/ox-popup-i18n-label-input.ts +0 -98
- package/src/ox-popup-parameters-builder.ts +0 -112
- package/src/ox-popup-partition-keys-input.ts +0 -97
- package/src/ox-popup-value-map-input.ts +0 -105
- package/src/ox-popup-value-ranges-input.ts +0 -104
- package/stories/ox-grist-editor-crontab.stories.ts +0 -451
- package/tsconfig.json +0 -24
- package/web-dev-server.config.mjs +0 -28
- package/web-test-runner.config.mjs +0 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/grist-editor",
|
|
3
|
-
"version": "8.0.0-
|
|
3
|
+
"version": "8.0.0-beta.1",
|
|
4
4
|
"description": "Webcomponent for grist-editor following open-wc recommendations",
|
|
5
5
|
"author": "heartyoh",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -110,32 +110,32 @@
|
|
|
110
110
|
},
|
|
111
111
|
"dependencies": {
|
|
112
112
|
"@material/web": "^2.0.0",
|
|
113
|
-
"@operato/data-grist": "^8.0.0-
|
|
114
|
-
"@operato/help": "^8.0.0-
|
|
115
|
-
"@operato/i18n": "^8.0.0-
|
|
116
|
-
"@operato/input": "^8.0.0-
|
|
117
|
-
"@operato/popup": "^8.0.0-
|
|
118
|
-
"@operato/property-editor": "^8.0.0-
|
|
119
|
-
"@operato/styles": "^8.0.0-
|
|
113
|
+
"@operato/data-grist": "^8.0.0-beta.1",
|
|
114
|
+
"@operato/help": "^8.0.0-beta.1",
|
|
115
|
+
"@operato/i18n": "^8.0.0-beta.1",
|
|
116
|
+
"@operato/input": "^8.0.0-beta.1",
|
|
117
|
+
"@operato/popup": "^8.0.0-beta.1",
|
|
118
|
+
"@operato/property-editor": "^8.0.0-beta.1",
|
|
119
|
+
"@operato/styles": "^8.0.0-beta.1",
|
|
120
120
|
"cronstrue": "^2.2.0",
|
|
121
121
|
"cross-fetch": "^3.1.5",
|
|
122
122
|
"lit": "^3.1.2",
|
|
123
123
|
"lodash-es": "^4.17.21"
|
|
124
124
|
},
|
|
125
125
|
"devDependencies": {
|
|
126
|
-
"@custom-elements-manifest/analyzer": "^0.
|
|
126
|
+
"@custom-elements-manifest/analyzer": "^0.10.0",
|
|
127
127
|
"@hatiolab/prettier-config": "^1.0.0",
|
|
128
128
|
"@open-wc/eslint-config": "^12.0.3",
|
|
129
|
-
"@open-wc/testing": "^
|
|
129
|
+
"@open-wc/testing": "^4.0.0",
|
|
130
130
|
"@types/lodash-es": "^4.17.5",
|
|
131
131
|
"@types/w3c-web-usb": "^1.0.5",
|
|
132
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
133
|
-
"@typescript-eslint/parser": "^
|
|
134
|
-
"@web/dev-server": "^0.
|
|
132
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
133
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
134
|
+
"@web/dev-server": "^0.4.0",
|
|
135
135
|
"@web/dev-server-storybook": "^2.0.1",
|
|
136
|
-
"@web/test-runner": "^0.
|
|
137
|
-
"concurrently": "^
|
|
138
|
-
"eslint": "^
|
|
136
|
+
"@web/test-runner": "^0.19.0",
|
|
137
|
+
"concurrently": "^9.0.0",
|
|
138
|
+
"eslint": "^9.0.0",
|
|
139
139
|
"eslint-config-prettier": "^9.1.0",
|
|
140
140
|
"husky": "^9.0.11",
|
|
141
141
|
"lint-staged": "^15.2.2",
|
|
@@ -156,5 +156,5 @@
|
|
|
156
156
|
"prettier --write"
|
|
157
157
|
]
|
|
158
158
|
},
|
|
159
|
-
"gitHead": "
|
|
159
|
+
"gitHead": "d5b28a2e9deb632c0dc80132f6a7196dd6fe4220"
|
|
160
160
|
}
|
package/.storybook/main.js
DELETED
package/.storybook/preview.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { i18next } from '@operato/i18n'
|
|
2
|
-
|
|
3
|
-
export const globalTypes = {
|
|
4
|
-
locale: {
|
|
5
|
-
name: 'Locale',
|
|
6
|
-
description: 'Internationalization locale',
|
|
7
|
-
toolbar: {
|
|
8
|
-
icon: 'globe',
|
|
9
|
-
items: [
|
|
10
|
-
{ value: 'en', right: '🇺🇸', title: 'English' },
|
|
11
|
-
{ value: 'ko', right: '🇰🇷', title: '한국어' },
|
|
12
|
-
{ value: 'zh', right: '🇨🇳', title: '中文' },
|
|
13
|
-
{ value: 'ja', right: '🇯🇵', title: '日本語' },
|
|
14
|
-
{ value: 'ms', right: '🇲🇾', title: 'Bahasa Melayu' }
|
|
15
|
-
],
|
|
16
|
-
showName: true
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
theme: {
|
|
20
|
-
name: 'Theme',
|
|
21
|
-
description: 'Global theme for components',
|
|
22
|
-
toolbar: {
|
|
23
|
-
icon: 'paintbrush',
|
|
24
|
-
items: [
|
|
25
|
-
{ value: 'light', title: 'Light' },
|
|
26
|
-
{ value: 'dark', title: 'Dark' }
|
|
27
|
-
],
|
|
28
|
-
showName: true
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export const decorators = [
|
|
34
|
-
(Story, context) => {
|
|
35
|
-
const { locale, theme } = context.globals
|
|
36
|
-
|
|
37
|
-
if (locale) {
|
|
38
|
-
i18next.changeLanguage(locale)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Set the theme class for the document
|
|
42
|
-
if (theme === 'dark') {
|
|
43
|
-
document.documentElement.classList.add('dark')
|
|
44
|
-
document.documentElement.classList.remove('light')
|
|
45
|
-
} else {
|
|
46
|
-
document.documentElement.classList.add('light')
|
|
47
|
-
document.documentElement.classList.remove('dark')
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return Story()
|
|
51
|
-
}
|
|
52
|
-
]
|
package/.storybook/server.mjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { storybookPlugin } from '@web/dev-server-storybook'
|
|
2
|
-
import baseConfig from '../web-dev-server.config.mjs'
|
|
3
|
-
|
|
4
|
-
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
|
5
|
-
...baseConfig,
|
|
6
|
-
open: '/',
|
|
7
|
-
plugins: [storybookPlugin({ type: 'web-components' }), ...baseConfig.plugins]
|
|
8
|
-
})
|
package/src/index.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { OxGristRendererJson5, registerEditor, registerRenderer } from '@operato/data-grist'
|
|
2
|
-
|
|
3
|
-
import { OxGristEditorCrontab } from './ox-grist-editor-crontab.js'
|
|
4
|
-
import { OxGristEditorDuration } from './ox-grist-editor-duration.js'
|
|
5
|
-
import { OxGristEditorHashtags } from './ox-grist-editor-hashtags.js'
|
|
6
|
-
import { OxGristEditorParameters } from './ox-grist-editor-parameters.js'
|
|
7
|
-
import { OxGristEditorPartitionKeys } from './ox-grist-editor-partition-keys.js'
|
|
8
|
-
import { OxGristEditorQuantifier } from './ox-grist-editor-quantifier.js'
|
|
9
|
-
import { OxGristEditorValueMap } from './ox-grist-editor-value-map.js'
|
|
10
|
-
import { OxGristRendererDuration } from './ox-grist-renderer-duration.js'
|
|
11
|
-
import { OxGristRendererQuantifier } from './ox-grist-renderer-quantifier'
|
|
12
|
-
import { OxGristRendererHashtags } from './ox-grist-renderer-hashtags'
|
|
13
|
-
import { OxGristRendererPartitionKeys } from './ox-grist-renderer-partition-keys.js'
|
|
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'
|
|
17
|
-
import { OxGristRendererSignature } from './ox-grist-renderer-signature.js'
|
|
18
|
-
import { OxGristEditorSignature } from './ox-grist-editor-signature.js'
|
|
19
|
-
|
|
20
|
-
/* register grist renderer/editor for id */
|
|
21
|
-
registerEditor('parameters', OxGristEditorParameters)
|
|
22
|
-
registerEditor('value-map', OxGristEditorValueMap)
|
|
23
|
-
registerEditor('value-ranges', OxGristEditorValueRanges)
|
|
24
|
-
registerEditor('partition-keys', OxGristEditorPartitionKeys)
|
|
25
|
-
registerEditor('crontab', OxGristEditorCrontab)
|
|
26
|
-
registerEditor('duration', OxGristEditorDuration)
|
|
27
|
-
registerEditor('quantifier', OxGristEditorQuantifier)
|
|
28
|
-
registerEditor('hashtags', OxGristEditorHashtags)
|
|
29
|
-
registerEditor('i18n-label', OxGristEditorI18nLabel)
|
|
30
|
-
registerEditor('signature', OxGristEditorSignature)
|
|
31
|
-
|
|
32
|
-
registerRenderer('parameters', OxGristRendererJson5)
|
|
33
|
-
registerRenderer('value-map', OxGristRendererJson5)
|
|
34
|
-
registerRenderer('value-ranges', OxGristRendererJson5)
|
|
35
|
-
registerRenderer('partition-keys', OxGristRendererPartitionKeys)
|
|
36
|
-
registerRenderer('duration', OxGristRendererDuration)
|
|
37
|
-
registerRenderer('quantifier', OxGristRendererQuantifier)
|
|
38
|
-
registerRenderer('hashtags', OxGristRendererHashtags)
|
|
39
|
-
registerRenderer('i18n-label', OxGristRendererI18nLabel)
|
|
40
|
-
registerRenderer('signature', OxGristRendererSignature)
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import './ox-popup-crontab-input.js'
|
|
2
|
-
|
|
3
|
-
import { html } from 'lit'
|
|
4
|
-
import { customElement } from 'lit/decorators.js'
|
|
5
|
-
|
|
6
|
-
import { OxGristEditor } from '@operato/data-grist'
|
|
7
|
-
import { i18next } from '@operato/i18n'
|
|
8
|
-
import { openPopup, PopupHandle } from '@operato/popup'
|
|
9
|
-
|
|
10
|
-
@customElement('ox-grist-editor-crontab')
|
|
11
|
-
export class OxGristEditorCrontab extends OxGristEditor {
|
|
12
|
-
private popup?: PopupHandle
|
|
13
|
-
|
|
14
|
-
get editorTemplate() {
|
|
15
|
-
return html` <div tabindex="0">${this.value || ''}</div> `
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
_onclick(e: Event): void {
|
|
19
|
-
e.stopPropagation()
|
|
20
|
-
this.showEditorPopup()
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
_onkeydown(e: KeyboardEvent): void {
|
|
24
|
-
const key = e.key
|
|
25
|
-
if (key == 'Enter') {
|
|
26
|
-
e.stopPropagation()
|
|
27
|
-
this.showEditorPopup()
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
showEditorPopup() {
|
|
32
|
-
if (this.popup) {
|
|
33
|
-
delete this.popup
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const confirmCallback = (newval: any) => {
|
|
37
|
-
this.dispatchEvent(
|
|
38
|
-
new CustomEvent('field-change', {
|
|
39
|
-
bubbles: true,
|
|
40
|
-
composed: true,
|
|
41
|
-
detail: {
|
|
42
|
-
before: this.value,
|
|
43
|
-
after: newval,
|
|
44
|
-
record: this.record,
|
|
45
|
-
column: this.column,
|
|
46
|
-
row: this.row
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
this.popup = openPopup(
|
|
53
|
-
html`
|
|
54
|
-
<ox-popup-crontab-input .value=${this.value} .confirmCallback=${confirmCallback}></ox-popup-crontab-input>
|
|
55
|
-
`,
|
|
56
|
-
{
|
|
57
|
-
backdrop: true,
|
|
58
|
-
title: i18next.t('title.setting schedule'),
|
|
59
|
-
help: 'data-grist/grist-editor/crontab'
|
|
60
|
-
}
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import './ox-popup-duration-input.js'
|
|
2
|
-
|
|
3
|
-
import { html } from 'lit'
|
|
4
|
-
import { customElement } from 'lit/decorators.js'
|
|
5
|
-
|
|
6
|
-
import { OxGristEditor } from '@operato/data-grist'
|
|
7
|
-
import { i18next } from '@operato/i18n'
|
|
8
|
-
import { openPopup, PopupHandle } from '@operato/popup'
|
|
9
|
-
|
|
10
|
-
@customElement('ox-grist-editor-duration')
|
|
11
|
-
export class OxGristEditorDuration extends OxGristEditor {
|
|
12
|
-
private popup?: PopupHandle
|
|
13
|
-
|
|
14
|
-
get editorTemplate() {
|
|
15
|
-
return html` <div tabindex="0">${this.value || ''}</div> `
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
_onclick(e: Event): void {
|
|
19
|
-
e.stopPropagation()
|
|
20
|
-
this.showEditorPopup()
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
_onkeydown(e: KeyboardEvent): void {
|
|
24
|
-
const key = e.key
|
|
25
|
-
if (key == 'Enter') {
|
|
26
|
-
e.stopPropagation()
|
|
27
|
-
this.showEditorPopup()
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
showEditorPopup() {
|
|
32
|
-
if (this.popup) {
|
|
33
|
-
delete this.popup
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const confirmCallback = (newval: any) => {
|
|
37
|
-
this.dispatchEvent(
|
|
38
|
-
new CustomEvent('field-change', {
|
|
39
|
-
bubbles: true,
|
|
40
|
-
composed: true,
|
|
41
|
-
detail: {
|
|
42
|
-
before: this.value,
|
|
43
|
-
after: newval,
|
|
44
|
-
record: this.record,
|
|
45
|
-
column: this.column,
|
|
46
|
-
row: this.row
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
this.popup = openPopup(
|
|
53
|
-
html`
|
|
54
|
-
<ox-popup-duration-input .value=${this.value} .confirmCallback=${confirmCallback}></ox-popup-duration-input>
|
|
55
|
-
`,
|
|
56
|
-
{
|
|
57
|
-
backdrop: true,
|
|
58
|
-
title: i18next.t('title.edit duration'),
|
|
59
|
-
help: 'data-grist/grist-editor/duration'
|
|
60
|
-
}
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import './ox-popup-hashtags-input.js'
|
|
2
|
-
|
|
3
|
-
import { html } from 'lit'
|
|
4
|
-
import { customElement } from 'lit/decorators.js'
|
|
5
|
-
|
|
6
|
-
import { OxGristEditor } from '@operato/data-grist'
|
|
7
|
-
import { i18next } from '@operato/i18n'
|
|
8
|
-
import { openPopup, PopupHandle } from '@operato/popup'
|
|
9
|
-
|
|
10
|
-
@customElement('ox-grist-editor-hashtags')
|
|
11
|
-
export class OxGristEditorHashtags extends OxGristEditor {
|
|
12
|
-
private popup?: PopupHandle
|
|
13
|
-
|
|
14
|
-
get editorTemplate() {
|
|
15
|
-
const value = this.value
|
|
16
|
-
|
|
17
|
-
return html`
|
|
18
|
-
<div tabindex="0">
|
|
19
|
-
${value && value.length > 0 ? (value as string[]).map(x => `#${x}`).join(' ') : '\u00A0' /* */}
|
|
20
|
-
</div>
|
|
21
|
-
`
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
_onclick(e: Event): void {
|
|
25
|
-
e.stopPropagation()
|
|
26
|
-
this.showEditorPopup()
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
_onkeydown(e: KeyboardEvent): void {
|
|
30
|
-
const key = e.key
|
|
31
|
-
if (key == 'Enter') {
|
|
32
|
-
e.stopPropagation()
|
|
33
|
-
this.showEditorPopup()
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
showEditorPopup() {
|
|
38
|
-
if (this.popup) {
|
|
39
|
-
delete this.popup
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const confirmCallback = (newval: any) => {
|
|
43
|
-
this.dispatchEvent(
|
|
44
|
-
new CustomEvent('field-change', {
|
|
45
|
-
bubbles: true,
|
|
46
|
-
composed: true,
|
|
47
|
-
detail: {
|
|
48
|
-
before: this.value,
|
|
49
|
-
after: newval,
|
|
50
|
-
record: this.record,
|
|
51
|
-
column: this.column,
|
|
52
|
-
row: this.row
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const value = Array.isArray(this.value) ? [...this.value] : []
|
|
59
|
-
|
|
60
|
-
this.popup = openPopup(
|
|
61
|
-
html` <ox-popup-hashtags-input .value=${value} .confirmCallback=${confirmCallback}></ox-popup-hashtags-input> `,
|
|
62
|
-
{
|
|
63
|
-
backdrop: true,
|
|
64
|
-
title: i18next.t('title.edit hashtags')
|
|
65
|
-
}
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import './ox-parameters-builder.js'
|
|
6
|
-
import './ox-popup-parameters-builder.js'
|
|
7
|
-
|
|
8
|
-
import { html } from 'lit'
|
|
9
|
-
import { customElement } from 'lit/decorators.js'
|
|
10
|
-
import { cloneDeep } from 'lodash-es'
|
|
11
|
-
|
|
12
|
-
import { OxGristEditor } from '@operato/data-grist'
|
|
13
|
-
import { i18next } from '@operato/i18n'
|
|
14
|
-
import { openPopup, PopupHandle } from '@operato/popup'
|
|
15
|
-
|
|
16
|
-
@customElement('ox-grist-editor-parameters')
|
|
17
|
-
export class OxGristEditorParameters extends OxGristEditor {
|
|
18
|
-
private popup?: PopupHandle
|
|
19
|
-
|
|
20
|
-
get editorTemplate() {
|
|
21
|
-
const value = this.value && typeof this.value === 'object' ? JSON.stringify(this.value) : this.value
|
|
22
|
-
return html` <div tabindex="0">${value || ''}</div> `
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
_onclick(e: Event): void {
|
|
26
|
-
e.stopPropagation()
|
|
27
|
-
this.openSelector()
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
_onkeydown(e: KeyboardEvent): void {
|
|
31
|
-
const key = e.key
|
|
32
|
-
if (key == 'Enter') {
|
|
33
|
-
e.stopPropagation()
|
|
34
|
-
this.openSelector()
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async openSelector() {
|
|
39
|
-
if (this.popup) {
|
|
40
|
-
delete this.popup
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
var { options } = this.column.record
|
|
44
|
-
|
|
45
|
-
if (typeof options === 'function') {
|
|
46
|
-
options = await options.call(this, this.value, this.column, this.record, this.row, this.field)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const { name, help, spec, context, objectified = false } = options
|
|
50
|
-
|
|
51
|
-
const confirmCallback = (newval: any) => {
|
|
52
|
-
this.dispatchEvent(
|
|
53
|
-
new CustomEvent('field-change', {
|
|
54
|
-
bubbles: true,
|
|
55
|
-
composed: true,
|
|
56
|
-
detail: {
|
|
57
|
-
before: this.value,
|
|
58
|
-
after: !objectified ? JSON.stringify(newval) : newval,
|
|
59
|
-
record: this.record,
|
|
60
|
-
column: this.column,
|
|
61
|
-
row: this.row
|
|
62
|
-
}
|
|
63
|
-
})
|
|
64
|
-
)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
try {
|
|
68
|
-
var value: any =
|
|
69
|
-
!objectified && typeof this.value === 'string' ? JSON.parse(this.value) : cloneDeep(this.value || {})
|
|
70
|
-
} catch (e) {
|
|
71
|
-
var value: any = {}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/*
|
|
75
|
-
주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로,
|
|
76
|
-
layout의 구성에 변화가 발생하면, 다시 render된다.
|
|
77
|
-
이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)
|
|
78
|
-
이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,
|
|
79
|
-
만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.
|
|
80
|
-
따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
|
|
81
|
-
*/
|
|
82
|
-
var template = html`
|
|
83
|
-
<ox-popup-parameters-builder
|
|
84
|
-
.value=${value}
|
|
85
|
-
.props=${spec}
|
|
86
|
-
.host=${this.record}
|
|
87
|
-
.context=${context}
|
|
88
|
-
.confirmCallback=${confirmCallback}
|
|
89
|
-
>
|
|
90
|
-
</ox-popup-parameters-builder>
|
|
91
|
-
`
|
|
92
|
-
|
|
93
|
-
this.popup = openPopup(template, {
|
|
94
|
-
backdrop: true,
|
|
95
|
-
size: 'large',
|
|
96
|
-
title: `${name?.toUpperCase() || ''} ${i18next.t('field.params')}`,
|
|
97
|
-
help
|
|
98
|
-
})
|
|
99
|
-
}
|
|
100
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import './ox-popup-partition-keys-input.js'
|
|
6
|
-
|
|
7
|
-
import { html } from 'lit'
|
|
8
|
-
import { customElement } from 'lit/decorators.js'
|
|
9
|
-
import { cloneDeep } from 'lodash-es'
|
|
10
|
-
|
|
11
|
-
import { OxGristEditor } from '@operato/data-grist'
|
|
12
|
-
import { i18next } from '@operato/i18n'
|
|
13
|
-
import { openPopup, PopupHandle } from '@operato/popup'
|
|
14
|
-
|
|
15
|
-
@customElement('ox-grist-editor-partition-keys')
|
|
16
|
-
export class OxGristEditorPartitionKeys extends OxGristEditor {
|
|
17
|
-
private popup?: PopupHandle
|
|
18
|
-
|
|
19
|
-
get editorTemplate() {
|
|
20
|
-
return this.value && this.value instanceof Array && this.value.length > 0
|
|
21
|
-
? html`<md-icon style="--md-icon-size:1.3em">key</md-icon>`
|
|
22
|
-
: html``
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
_onclick(e: Event): void {
|
|
26
|
-
e.stopPropagation()
|
|
27
|
-
this.openSelector()
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
_onkeydown(e: KeyboardEvent): void {
|
|
31
|
-
const key = e.key
|
|
32
|
-
if (key == 'Enter') {
|
|
33
|
-
e.stopPropagation()
|
|
34
|
-
this.openSelector()
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async openSelector() {
|
|
39
|
-
if (this.popup) {
|
|
40
|
-
delete this.popup
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const { name, help, objectified = false } = this.column.record?.options || {}
|
|
44
|
-
|
|
45
|
-
const confirmCallback = (newval: any) => {
|
|
46
|
-
this.dispatchEvent(
|
|
47
|
-
new CustomEvent('field-change', {
|
|
48
|
-
bubbles: true,
|
|
49
|
-
composed: true,
|
|
50
|
-
detail: {
|
|
51
|
-
before: this.value,
|
|
52
|
-
after: !objectified ? JSON.stringify(newval) : newval,
|
|
53
|
-
record: this.record,
|
|
54
|
-
column: this.column,
|
|
55
|
-
row: this.row
|
|
56
|
-
}
|
|
57
|
-
})
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
var value: any =
|
|
63
|
-
!objectified && typeof this.value === 'string' ? JSON.parse(this.value) : cloneDeep(this.value || {})
|
|
64
|
-
} catch (e) {
|
|
65
|
-
var value: any = {}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/*
|
|
69
|
-
주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로,
|
|
70
|
-
layout의 구성에 변화가 발생하면, 다시 render된다.
|
|
71
|
-
이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)
|
|
72
|
-
이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,
|
|
73
|
-
만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.
|
|
74
|
-
따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
|
|
75
|
-
*/
|
|
76
|
-
var template = html`
|
|
77
|
-
<ox-popup-partition-keys-input .value=${value} .confirmCallback=${confirmCallback}>
|
|
78
|
-
</ox-popup-partition-keys-input>
|
|
79
|
-
`
|
|
80
|
-
|
|
81
|
-
this.popup = openPopup(template, {
|
|
82
|
-
backdrop: true,
|
|
83
|
-
size: 'large',
|
|
84
|
-
title: `${name?.toUpperCase() || i18next.t('field.partition-keys')} `,
|
|
85
|
-
help
|
|
86
|
-
})
|
|
87
|
-
}
|
|
88
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import '@operato/input/ox-input-quantifier.js'
|
|
2
|
-
|
|
3
|
-
import { html } from 'lit'
|
|
4
|
-
import { customElement } from 'lit/decorators.js'
|
|
5
|
-
|
|
6
|
-
import { OxGristEditor } from '@operato/data-grist'
|
|
7
|
-
|
|
8
|
-
@customElement('ox-grist-editor-quantifier')
|
|
9
|
-
export class OxGristEditorQuantifier extends OxGristEditor {
|
|
10
|
-
get editorTemplate() {
|
|
11
|
-
return html` <ox-input-quantifier .value=${this.value}></ox-input-quantifier> `
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import '@operato/input/ox-input-signature.js'
|
|
2
|
-
|
|
3
|
-
import { html } from 'lit'
|
|
4
|
-
import { customElement } from 'lit/decorators.js'
|
|
5
|
-
|
|
6
|
-
import { OxGristEditor } from '@operato/data-grist'
|
|
7
|
-
|
|
8
|
-
@customElement('ox-grist-editor-signature')
|
|
9
|
-
export class OxGristEditorSignature extends OxGristEditor {
|
|
10
|
-
get editorTemplate() {
|
|
11
|
-
return html` <ox-input-signature .value=${this.value}></ox-input-signature> `
|
|
12
|
-
}
|
|
13
|
-
}
|