@operato/input 1.5.48 → 1.5.50
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 +18 -0
- package/dist/src/ox-input-code.d.ts +3 -8
- package/dist/src/ox-input-code.js +47 -99
- package/dist/src/ox-input-code.js.map +1 -1
- package/dist/src/ox-input-graphql.d.ts +29 -0
- package/dist/src/ox-input-graphql.js +108 -0
- package/dist/src/ox-input-graphql.js.map +1 -0
- package/dist/src/ox-input-privilege.js +2 -2
- package/dist/src/ox-input-privilege.js.map +1 -1
- package/dist/stories/ox-input-code.stories.d.ts +25 -0
- package/dist/stories/ox-input-code.stories.js +33 -0
- package/dist/stories/ox-input-code.stories.js.map +1 -0
- package/dist/stories/ox-input-graphql.stories.d.ts +25 -0
- package/dist/stories/ox-input-graphql.stories.js +44 -0
- package/dist/stories/ox-input-graphql.stories.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -3
- package/src/ox-input-code.ts +52 -109
- package/src/ox-input-graphql.ts +99 -0
- package/src/ox-input-privilege.ts +2 -2
- package/stories/{ox-input-code.stories.ts_ → ox-input-code.stories.ts} +4 -8
- package/stories/ox-input-graphql.stories.ts +58 -0
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,24 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
### [1.5.50](https://github.com/hatiolab/operato/compare/v1.5.49...v1.5.50) (2023-12-07)
|
7
|
+
|
8
|
+
|
9
|
+
### :bug: Bug Fix
|
10
|
+
|
11
|
+
* codemirror v6 ([4332ac2](https://github.com/hatiolab/operato/commit/4332ac2fc74ae08bcb3d583a13f5c2469f9a9fcd))
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
### [1.5.49](https://github.com/hatiolab/operato/compare/v1.5.48...v1.5.49) (2023-12-04)
|
16
|
+
|
17
|
+
|
18
|
+
### :bug: Bug Fix
|
19
|
+
|
20
|
+
* ox-input-privilege ([4fd900e](https://github.com/hatiolab/operato/commit/4fd900e860549bc888d7a83a8c8e530d1ce03797))
|
21
|
+
|
22
|
+
|
23
|
+
|
6
24
|
### [1.5.48](https://github.com/hatiolab/operato/compare/v1.5.47...v1.5.48) (2023-12-04)
|
7
25
|
|
8
26
|
**Note:** Version bump only for package @operato/input
|
@@ -1,12 +1,8 @@
|
|
1
1
|
/**
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
3
|
*/
|
4
|
-
import 'codemirror/mode/javascript/javascript';
|
5
|
-
import 'codemirror/mode/python/python';
|
6
|
-
import 'codemirror/addon/display/fullscreen';
|
7
|
-
import 'codemirror/addon/display/autorefresh';
|
8
|
-
import CodeMirror from 'codemirror';
|
9
4
|
import { PropertyValues } from 'lit';
|
5
|
+
import { EditorView } from '@codemirror/view';
|
10
6
|
import { OxFormField } from './ox-form-field';
|
11
7
|
/**
|
12
8
|
WEB Component for code-mirror code editor.
|
@@ -26,9 +22,8 @@ export declare class OxInputCode extends OxFormField {
|
|
26
22
|
tabSize: number;
|
27
23
|
tabAsSpace: boolean;
|
28
24
|
private _self_changing;
|
29
|
-
private _editor
|
25
|
+
private _editor?;
|
30
26
|
private _changed;
|
31
27
|
updated(changes: PropertyValues<this>): void;
|
32
|
-
|
33
|
-
get editor(): CodeMirror.EditorFromTextArea | null | undefined;
|
28
|
+
get editor(): EditorView;
|
34
29
|
}
|
@@ -2,16 +2,14 @@
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
3
|
*/
|
4
4
|
import { __decorate } from "tslib";
|
5
|
-
import '
|
6
|
-
import 'codemirror/mode/python/python';
|
7
|
-
import 'codemirror/addon/display/fullscreen';
|
8
|
-
import 'codemirror/addon/display/autorefresh';
|
9
|
-
import FullScreenStyle from '!!text-loader!codemirror/addon/display/fullscreen.css';
|
10
|
-
import CodeMirrorStyle from '!!text-loader!codemirror/lib/codemirror.css';
|
11
|
-
import NightThemeStyle from '!!text-loader!codemirror/theme/night.css';
|
12
|
-
import CodeMirror from 'codemirror';
|
13
|
-
import { css, html, unsafeCSS } from 'lit';
|
5
|
+
import { css } from 'lit';
|
14
6
|
import { customElement, property } from 'lit/decorators.js';
|
7
|
+
import { history, historyKeymap, indentWithTab } from '@codemirror/commands';
|
8
|
+
import { EditorView, highlightActiveLine, keymap } from '@codemirror/view';
|
9
|
+
import { autocompletion, closeBrackets } from '@codemirror/autocomplete';
|
10
|
+
import { bracketMatching, syntaxHighlighting } from '@codemirror/language';
|
11
|
+
import { oneDarkHighlightStyle, oneDark } from '@codemirror/theme-one-dark';
|
12
|
+
import { javascript } from '@codemirror/lang-javascript';
|
15
13
|
import { ScrollbarStyles } from '@operato/styles';
|
16
14
|
import { togglefullscreen } from '@operato/utils';
|
17
15
|
import { OxFormField } from './ox-form-field';
|
@@ -33,118 +31,68 @@ let OxInputCode = class OxInputCode extends OxFormField {
|
|
33
31
|
this.tabSize = 2;
|
34
32
|
this.tabAsSpace = true;
|
35
33
|
this._self_changing = false;
|
36
|
-
this._editor = null;
|
37
34
|
this._changed = false;
|
38
35
|
}
|
39
36
|
static { this.styles = [
|
40
37
|
ScrollbarStyles,
|
41
38
|
css `
|
42
|
-
${unsafeCSS(CodeMirrorStyle)}
|
43
|
-
${unsafeCSS(FullScreenStyle)}
|
44
|
-
${unsafeCSS(NightThemeStyle)}
|
45
|
-
`,
|
46
|
-
css `
|
47
39
|
:host {
|
48
40
|
display: flex;
|
49
41
|
flex-direction: column;
|
50
42
|
position: relative;
|
43
|
+
background: white;
|
51
44
|
}
|
52
45
|
|
53
|
-
.
|
46
|
+
.cm-editor {
|
54
47
|
flex: 1;
|
55
48
|
}
|
56
|
-
|
57
|
-
textarea {
|
58
|
-
display: block;
|
59
|
-
height: 100%;
|
60
|
-
width: 100%;
|
61
|
-
resize: none;
|
62
|
-
font-size: 16px;
|
63
|
-
line-height: 20px;
|
64
|
-
border: 0px;
|
65
|
-
padding: 0px;
|
66
|
-
}
|
67
|
-
|
68
|
-
#fs-toggle:not(:fullscreen) {
|
69
|
-
background-color: #afa;
|
70
|
-
}
|
71
|
-
|
72
|
-
.CodeMirror-fullscreen {
|
73
|
-
position: fixed;
|
74
|
-
top: 0;
|
75
|
-
left: 0;
|
76
|
-
width: 100%;
|
77
|
-
height: 100%;
|
78
|
-
z-index: 9999;
|
79
|
-
}
|
80
49
|
`
|
81
50
|
]; }
|
82
|
-
// private lint: any
|
83
|
-
// private hintOptions: any
|
84
51
|
updated(changes) {
|
85
52
|
if (changes.has('value') && this.editor && !this._self_changing) {
|
86
|
-
this.editor
|
87
|
-
this.editor
|
53
|
+
const to = this.editor.state.doc.toString().length;
|
54
|
+
this.editor.dispatch({
|
55
|
+
changes: { from: 0, to, insert: this.value === undefined ? '' : String(this.value) }
|
56
|
+
});
|
88
57
|
}
|
89
58
|
}
|
90
|
-
render() {
|
91
|
-
return html ` <textarea></textarea> `;
|
92
|
-
}
|
93
59
|
get editor() {
|
94
60
|
if (!this._editor) {
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
F11: function (cm) {
|
115
|
-
cm.setOption('fullScreen', !cm.getOption('fullScreen'));
|
116
|
-
},
|
117
|
-
Esc: function (cm) {
|
118
|
-
// cm.setOption('fullScreen', !cm.getOption('fullScreen'))
|
119
|
-
togglefullscreen(cm.getWrapperElement());
|
120
|
-
},
|
121
|
-
// https://github.com/codemirror/CodeMirror/issues/988#issuecomment-37095621
|
122
|
-
Tab: tabAsSpace
|
123
|
-
? function (cm) {
|
124
|
-
cm.replaceSelection(Array(cm.getOption('tabSize')).join(' '));
|
61
|
+
this._editor = new EditorView({
|
62
|
+
doc: this.value,
|
63
|
+
extensions: [
|
64
|
+
bracketMatching(),
|
65
|
+
closeBrackets(),
|
66
|
+
history(),
|
67
|
+
autocompletion(),
|
68
|
+
oneDark,
|
69
|
+
syntaxHighlighting(oneDarkHighlightStyle),
|
70
|
+
highlightActiveLine(),
|
71
|
+
javascript(),
|
72
|
+
keymap.of([
|
73
|
+
...historyKeymap,
|
74
|
+
indentWithTab,
|
75
|
+
{
|
76
|
+
key: 'Escape',
|
77
|
+
run: (view) => {
|
78
|
+
togglefullscreen(this);
|
79
|
+
return true;
|
125
80
|
}
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
await this.updateComplete;
|
142
|
-
this._self_changing = false;
|
143
|
-
});
|
144
|
-
this._editor.on('keydown', async (_, e) => {
|
145
|
-
e.stopPropagation();
|
146
|
-
});
|
147
|
-
}
|
81
|
+
}
|
82
|
+
]),
|
83
|
+
EditorView.updateListener.of(v => {
|
84
|
+
if (v.docChanged) {
|
85
|
+
this._self_changing = true;
|
86
|
+
this.value = v.state.doc.toString();
|
87
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }));
|
88
|
+
requestAnimationFrame(() => {
|
89
|
+
this._self_changing = false;
|
90
|
+
});
|
91
|
+
}
|
92
|
+
})
|
93
|
+
],
|
94
|
+
parent: this.renderRoot
|
95
|
+
});
|
148
96
|
}
|
149
97
|
return this._editor;
|
150
98
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ox-input-code.js","sourceRoot":"","sources":["../../src/ox-input-code.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,
|
1
|
+
{"version":3,"file":"ox-input-code.js","sourceRoot":"","sources":["../../src/ox-input-code.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAkB,MAAM,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BACpG,qBAAqB,CAAC,GAAG,EAAE;gCACzB,IAAI,CAAC,cAAc,GAAG,KAAK,CAAA;4BAC7B,CAAC,CAAC,CAAA;wBACJ,CAAC;oBACH,CAAC,CAAC;iBACH;gBACD,MAAM,EAAE,IAAI,CAAC,UAAU;aACxB,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;;AA1D2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAmB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAc;AACU;IAAlD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;4CAAoB;AACd;IAAvD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;+CAA2B;AAvBvE,WAAW;IADvB,aAAa,CAAC,eAAe,CAAC;GAClB,WAAW,CA+EvB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { history, historyKeymap, indentWithTab } from '@codemirror/commands'\nimport { EditorView, highlightActiveLine, keymap } from '@codemirror/view'\nimport { EditorState } from '@codemirror/state'\nimport { autocompletion, closeBrackets } from '@codemirror/autocomplete'\nimport { bracketMatching, syntaxHighlighting } from '@codemirror/language'\nimport { oneDarkHighlightStyle, oneDark } from '@codemirror/theme-one-dark'\n\nimport { javascript } from '@codemirror/lang-javascript'\n\nimport { ScrollbarStyles } from '@operato/styles'\nimport { togglefullscreen } from '@operato/utils'\n\nimport { OxFormField } from './ox-form-field'\n\n/**\nWEB Component for code-mirror code editor.\n\nExample:\n\n <ox-input-code .value=${text} mode=${mode} tab-size=\"4\" tab-as-space=\"true\">\n </ox-input-code>\n*/\n@customElement('ox-input-code')\nexport class OxInputCode extends OxFormField {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n position: relative;\n background: white;\n }\n\n .cm-editor {\n flex: 1;\n }\n `\n ]\n\n /**\n * `value`는 에디터에서 작성중인 contents이다.\n */\n @property({ type: String }) value: string = ''\n @property({ type: String }) mode?: string\n @property({ type: Number, attribute: 'tab-size' }) tabSize: number = 2\n @property({ type: Boolean, attribute: 'tab-as-space' }) tabAsSpace: boolean = true\n\n private _self_changing: boolean = false\n private _editor?: EditorView\n private _changed: boolean = false\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value') && this.editor && !this._self_changing) {\n const to = this.editor.state.doc.toString().length\n this.editor.dispatch({\n changes: { from: 0, to, insert: this.value === undefined ? '' : String(this.value) }\n })\n }\n }\n\n get editor() {\n if (!this._editor) {\n this._editor = new EditorView({\n doc: this.value,\n extensions: [\n bracketMatching(),\n closeBrackets(),\n history(),\n autocompletion(),\n oneDark,\n syntaxHighlighting(oneDarkHighlightStyle),\n highlightActiveLine(),\n javascript(),\n keymap.of([\n ...historyKeymap,\n indentWithTab,\n {\n key: 'Escape',\n run: (view: EditorView) => {\n togglefullscreen(this)\n return true\n }\n }\n ]),\n EditorView.updateListener.of(v => {\n if (v.docChanged) {\n this._self_changing = true\n this.value = v.state.doc.toString()\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n requestAnimationFrame(() => {\n this._self_changing = false\n })\n }\n })\n ],\n parent: this.renderRoot\n })\n }\n\n return this._editor\n }\n}\n"]}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
|
+
*/
|
4
|
+
import { PropertyValues } from 'lit';
|
5
|
+
import { EditorView } from '@codemirror/view';
|
6
|
+
import { OxFormField } from './ox-form-field';
|
7
|
+
/**
|
8
|
+
WEB Component for code-mirror code editor.
|
9
|
+
|
10
|
+
Example:
|
11
|
+
|
12
|
+
<ox-input-code .value=${text} mode=${mode} tab-size="4" tab-as-space="true">
|
13
|
+
</ox-input-code>
|
14
|
+
*/
|
15
|
+
export declare class OxInputCode extends OxFormField {
|
16
|
+
static styles: import("lit").CSSResult[];
|
17
|
+
/**
|
18
|
+
* `value`는 에디터에서 작성중인 contents이다.
|
19
|
+
*/
|
20
|
+
value: string;
|
21
|
+
mode?: string;
|
22
|
+
tabSize: number;
|
23
|
+
tabAsSpace: boolean;
|
24
|
+
private _self_changing;
|
25
|
+
private _editor?;
|
26
|
+
private _changed;
|
27
|
+
updated(changes: PropertyValues<this>): void;
|
28
|
+
get editor(): EditorView;
|
29
|
+
}
|
@@ -0,0 +1,108 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
|
+
*/
|
4
|
+
import { __decorate } from "tslib";
|
5
|
+
import { css } from 'lit';
|
6
|
+
import { customElement, property } from 'lit/decorators.js';
|
7
|
+
import { history, historyKeymap, indentWithTab } from '@codemirror/commands';
|
8
|
+
import { EditorView, highlightActiveLine, keymap } from '@codemirror/view';
|
9
|
+
import { javascript } from '@codemirror/lang-javascript';
|
10
|
+
import { ScrollbarStyles } from '@operato/styles';
|
11
|
+
import { togglefullscreen } from '@operato/utils';
|
12
|
+
import { OxFormField } from './ox-form-field';
|
13
|
+
/**
|
14
|
+
WEB Component for code-mirror code editor.
|
15
|
+
|
16
|
+
Example:
|
17
|
+
|
18
|
+
<ox-input-code .value=${text} mode=${mode} tab-size="4" tab-as-space="true">
|
19
|
+
</ox-input-code>
|
20
|
+
*/
|
21
|
+
let OxInputCode = class OxInputCode extends OxFormField {
|
22
|
+
constructor() {
|
23
|
+
super(...arguments);
|
24
|
+
/**
|
25
|
+
* `value`는 에디터에서 작성중인 contents이다.
|
26
|
+
*/
|
27
|
+
this.value = '';
|
28
|
+
this.tabSize = 2;
|
29
|
+
this.tabAsSpace = true;
|
30
|
+
this._self_changing = false;
|
31
|
+
this._changed = false;
|
32
|
+
}
|
33
|
+
static { this.styles = [
|
34
|
+
ScrollbarStyles,
|
35
|
+
css `
|
36
|
+
:host {
|
37
|
+
display: flex;
|
38
|
+
flex-direction: column;
|
39
|
+
position: relative;
|
40
|
+
background: white;
|
41
|
+
}
|
42
|
+
|
43
|
+
.cm-editor {
|
44
|
+
flex: 1;
|
45
|
+
}
|
46
|
+
`
|
47
|
+
]; }
|
48
|
+
updated(changes) {
|
49
|
+
if (changes.has('value') && this.editor && !this._self_changing) {
|
50
|
+
const to = this.editor.state.doc.toString().length;
|
51
|
+
this.editor.dispatch({
|
52
|
+
changes: { from: 0, to, insert: this.value === undefined ? '' : String(this.value) }
|
53
|
+
});
|
54
|
+
}
|
55
|
+
}
|
56
|
+
get editor() {
|
57
|
+
if (!this._editor) {
|
58
|
+
this._editor = new EditorView({
|
59
|
+
doc: this.value,
|
60
|
+
extensions: [
|
61
|
+
highlightActiveLine(),
|
62
|
+
history(),
|
63
|
+
javascript(),
|
64
|
+
keymap.of([
|
65
|
+
...historyKeymap,
|
66
|
+
indentWithTab,
|
67
|
+
{
|
68
|
+
key: 'Escape',
|
69
|
+
run: (view) => {
|
70
|
+
togglefullscreen(this);
|
71
|
+
return true;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
]),
|
75
|
+
EditorView.updateListener.of(v => {
|
76
|
+
if (v.docChanged) {
|
77
|
+
this._self_changing = true;
|
78
|
+
this.value = v.state.doc.toString();
|
79
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }));
|
80
|
+
requestAnimationFrame(() => {
|
81
|
+
this._self_changing = false;
|
82
|
+
});
|
83
|
+
}
|
84
|
+
})
|
85
|
+
],
|
86
|
+
parent: this.renderRoot
|
87
|
+
});
|
88
|
+
}
|
89
|
+
return this._editor;
|
90
|
+
}
|
91
|
+
};
|
92
|
+
__decorate([
|
93
|
+
property({ type: String })
|
94
|
+
], OxInputCode.prototype, "value", void 0);
|
95
|
+
__decorate([
|
96
|
+
property({ type: String })
|
97
|
+
], OxInputCode.prototype, "mode", void 0);
|
98
|
+
__decorate([
|
99
|
+
property({ type: Number, attribute: 'tab-size' })
|
100
|
+
], OxInputCode.prototype, "tabSize", void 0);
|
101
|
+
__decorate([
|
102
|
+
property({ type: Boolean, attribute: 'tab-as-space' })
|
103
|
+
], OxInputCode.prototype, "tabAsSpace", void 0);
|
104
|
+
OxInputCode = __decorate([
|
105
|
+
customElement('ox-input-code')
|
106
|
+
], OxInputCode);
|
107
|
+
export { OxInputCode };
|
108
|
+
//# sourceMappingURL=ox-input-graphql.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ox-input-graphql.js","sourceRoot":"","sources":["../../src/ox-input-graphql.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAkB,MAAM,KAAK,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAC5E,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C;;;;;;;EAOE;AAEK,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,WAAW;IAArC;;QAiBL;;WAEG;QACyB,UAAK,GAAW,EAAE,CAAA;QAEK,YAAO,GAAW,CAAC,CAAA;QACd,eAAU,GAAY,IAAI,CAAA;QAE1E,mBAAc,GAAY,KAAK,CAAA;QAE/B,aAAQ,GAAY,KAAK,CAAA;IA+CnC,CAAC;aAzEQ,WAAM,GAAG;QACd,eAAe;QACf,GAAG,C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AAQ,EAAE,CAAA;4BACnC,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;4BACpG,qBAAqB,CAAC,GAAG,EAAE;gCACzB,IAAI,CAAC,cAAc,GAAG,KAAK,CAAA;4BAC7B,CAAC,CAAC,CAAA;wBACJ,CAAC;oBACH,CAAC,CAAC;iBACH;gBACD,MAAM,EAAE,IAAI,CAAC,UAAU;aACxB,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;;AArD2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAmB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAc;AACU;IAAlD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;4CAAoB;AACd;IAAvD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;+CAA2B;AAvBvE,WAAW;IADvB,aAAa,CAAC,eAAe,CAAC;GAClB,WAAW,CA0EvB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { history, historyKeymap, indentWithTab } from '@codemirror/commands'\nimport { EditorView, highlightActiveLine, keymap } from '@codemirror/view'\nimport { javascript } from '@codemirror/lang-javascript'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { togglefullscreen } from '@operato/utils'\n\nimport { OxFormField } from './ox-form-field'\n\n/**\nWEB Component for code-mirror code editor.\n\nExample:\n\n <ox-input-code .value=${text} mode=${mode} tab-size=\"4\" tab-as-space=\"true\">\n </ox-input-code>\n*/\n@customElement('ox-input-code')\nexport class OxInputCode extends OxFormField {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n position: relative;\n background: white;\n }\n\n .cm-editor {\n flex: 1;\n }\n `\n ]\n\n /**\n * `value`는 에디터에서 작성중인 contents이다.\n */\n @property({ type: String }) value: string = ''\n @property({ type: String }) mode?: string\n @property({ type: Number, attribute: 'tab-size' }) tabSize: number = 2\n @property({ type: Boolean, attribute: 'tab-as-space' }) tabAsSpace: boolean = true\n\n private _self_changing: boolean = false\n private _editor?: EditorView\n private _changed: boolean = false\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value') && this.editor && !this._self_changing) {\n const to = this.editor.state.doc.toString().length\n this.editor.dispatch({\n changes: { from: 0, to, insert: this.value === undefined ? '' : String(this.value) }\n })\n }\n }\n\n get editor() {\n if (!this._editor) {\n this._editor = new EditorView({\n doc: this.value,\n extensions: [\n highlightActiveLine(),\n history(),\n javascript(),\n keymap.of([\n ...historyKeymap,\n indentWithTab,\n {\n key: 'Escape',\n run: (view: EditorView) => {\n togglefullscreen(this)\n return true\n }\n }\n ]),\n EditorView.updateListener.of(v => {\n if (v.docChanged) {\n this._self_changing = true\n this.value = v.state.doc.toString()\n this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))\n requestAnimationFrame(() => {\n this._self_changing = false\n })\n }\n })\n ],\n parent: this.renderRoot\n })\n }\n\n return this._editor\n }\n}\n"]}
|
@@ -111,7 +111,7 @@ let OxInputPrivilege = class OxInputPrivilege extends OxFormField {
|
|
111
111
|
<select id="privilege" name="privilege" value=${ifDefined(privilege)}>
|
112
112
|
<option value=""> </option>
|
113
113
|
${privileges.map(p => html `<option
|
114
|
-
value=${`${p.category}
|
114
|
+
value=${`${p.category}:${p.privilege}`}
|
115
115
|
?selected=${category == p.category && privilege == p.privilege}
|
116
116
|
>
|
117
117
|
${p.description}
|
@@ -129,7 +129,7 @@ let OxInputPrivilege = class OxInputPrivilege extends OxFormField {
|
|
129
129
|
}
|
130
130
|
buildValue() {
|
131
131
|
const formData = new FormData(this.form);
|
132
|
-
const [category = '', privilege = ''] = formData.get('privilege').split('
|
132
|
+
const [category = '', privilege = ''] = formData.get('privilege').split(':');
|
133
133
|
const owner = formData.get('owner');
|
134
134
|
const superUser = formData.get('super');
|
135
135
|
return {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ox-input-privilege.js","sourceRoot":"","sources":["../../src/ox-input-privilege.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,sBAAsB,CAAA;AAE7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGtC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,WAAW;IAA1C;;QAiGsB,eAAU,GAAmE,EAAE,CAAA;IAmE5G,CAAC;aAnKQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFlB,AAvFY,CAuFZ;IAaD,MAAM;QACJ,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAA;QACzE,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,EAAE,CAAA;QAExC,OAAO,IAAI,CAAA;sBACO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;;wCAEN,OAAO,CAAC,CAAC,CA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YACxB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI,CAAC,KAAK;SACnB,CAAC,CACH,CAAA;IACH,CAAC;;AAzE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAKnB;AAEmB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;oDAAgF;AAEnF;IAAtB,KAAK,CAAC,MAAM,CAAC;8CAA+B;AAnGlC,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAoK5B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/mwc-button'\n\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\n\nimport { i18next } from '@operato/i18n'\n\nimport { OxFormField } from './ox-form-field'\n\n@customElement('ox-input-privilege')\nexport class OxInputPrivilege extends OxFormField {\n static styles = css`\n :host {\n text-align: center;\n padding: 10px;\n }\n\n :host * {\n box-sizing: border-box;\n }\n\n :host *:focus {\n outline: none;\n }\n\n form {\n width: 100%;\n height: 100%;\n }\n\n div[values] {\n display: grid;\n grid-template-columns: 1fr 1fr;\n grid-gap: 10px;\n }\n\n div[values] > [col1] {\n text-align: right;\n align-self: center;\n }\n\n div[values] > [col2] {\n text-align: left;\n align-self: center;\n margin-right: auto;\n }\n\n input {\n border: 0;\n border-bottom: var(--border-dark-color);\n padding: var(--input-padding);\n padding-right: 0;\n max-width: 70px;\n font: var(--input-font);\n color: var(--primary-text-color);\n text-align: right;\n }\n\n input:focus {\n outline: none;\n border-bottom: 1px solid var(--primary-color);\n }\n\n input:invalid {\n border-bottom: 1px solid var(--status-danger-color);\n color: var(--status-danger-color);\n }\n\n label {\n margin-right: var(--margin-default);\n font: normal 0.8em var(--theme-font);\n color: var(--primary-color);\n }\n\n div[buttons] {\n display: flex;\n flex-direction: row;\n justify-content: left;\n padding: 10px;\n }\n\n button {\n border: var(--button-border);\n border-radius: var(--border-radius);\n background-color: var(--button-background-color);\n padding: var(--padding-narrow) var(--padding-default);\n min-height: 35px;\n line-height: 0.8;\n color: var(--button-color);\n cursor: pointer;\n }\n button:focus,\n button:hover,\n button:active {\n border: var(--button-activ-border);\n background-color: var(--button-background-focus-color);\n color: var(--theme-white-color);\n }\n `\n\n @property({ type: Object }) value?: {\n category: string\n privilege: string\n owner?: boolean\n super?: boolean\n } | null\n\n @property({ type: Array }) privileges: { privilege: string; category: string; description: string }[] = []\n\n @query('form') private form!: HTMLFormElement\n\n render() {\n const { category, privilege, owner, super: superUser } = this.value || {}\n const privileges = this.privileges || []\n\n return html`\n <form @change=${this.onChange.bind(this)}>\n <div values>\n <label for=\"privilege\" col1>${i18next.t('label.privilege')}</label>\n <select id=\"privilege\" name=\"privilege\" value=${ifDefined(privilege)}>\n <option value=\"\"> </option>\n ${privileges.map(\n p =>\n html`<option\n value=${`${p.category}
|
1
|
+
{"version":3,"file":"ox-input-privilege.js","sourceRoot":"","sources":["../../src/ox-input-privilege.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,sBAAsB,CAAA;AAE7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGtC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,WAAW;IAA1C;;QAiGsB,eAAU,GAAmE,EAAE,CAAA;IAmE5G,CAAC;aAnKQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,EAAE,KAAK,IAAI,IAAI;YACpB,KAAK,EAAE,SAAS,IAAI,IAAI;SACzB,CAAA;IACH,CAAC;IAED,YAAY;QACV,CAAC;QAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAsB,CAAC,KAAK,EAAE,CAAA;IACvE,CAAC;IAED,QAAQ,CAAC,CAAQ;QACf,CAAC,CAAC,eAAe,EAAE,CAAA;QAEnB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,CAAA;QAE9B,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI,CAAC,KAAK;SACnB,CAAC,CACH,CAAA;IACH,CAAC;;AAzE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAKnB;AAEmB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;oDAAgF;AAEnF;IAAtB,KAAK,CAAC,MAAM,CAAC;8CAA+B;AAnGlC,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAoK5B","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@material/mwc-button'\n\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ifDefined } from 'lit/directives/if-defined.js'\n\nimport { i18next } from '@operato/i18n'\n\nimport { OxFormField } from './ox-form-field'\n\n@customElement('ox-input-privilege')\nexport class OxInputPrivilege extends OxFormField {\n static styles = css`\n :host {\n text-align: center;\n padding: 10px;\n }\n\n :host * {\n box-sizing: border-box;\n }\n\n :host *:focus {\n outline: none;\n }\n\n form {\n width: 100%;\n height: 100%;\n }\n\n div[values] {\n display: grid;\n grid-template-columns: 1fr 1fr;\n grid-gap: 10px;\n }\n\n div[values] > [col1] {\n text-align: right;\n align-self: center;\n }\n\n div[values] > [col2] {\n text-align: left;\n align-self: center;\n margin-right: auto;\n }\n\n input {\n border: 0;\n border-bottom: var(--border-dark-color);\n padding: var(--input-padding);\n padding-right: 0;\n max-width: 70px;\n font: var(--input-font);\n color: var(--primary-text-color);\n text-align: right;\n }\n\n input:focus {\n outline: none;\n border-bottom: 1px solid var(--primary-color);\n }\n\n input:invalid {\n border-bottom: 1px solid var(--status-danger-color);\n color: var(--status-danger-color);\n }\n\n label {\n margin-right: var(--margin-default);\n font: normal 0.8em var(--theme-font);\n color: var(--primary-color);\n }\n\n div[buttons] {\n display: flex;\n flex-direction: row;\n justify-content: left;\n padding: 10px;\n }\n\n button {\n border: var(--button-border);\n border-radius: var(--border-radius);\n background-color: var(--button-background-color);\n padding: var(--padding-narrow) var(--padding-default);\n min-height: 35px;\n line-height: 0.8;\n color: var(--button-color);\n cursor: pointer;\n }\n button:focus,\n button:hover,\n button:active {\n border: var(--button-activ-border);\n background-color: var(--button-background-focus-color);\n color: var(--theme-white-color);\n }\n `\n\n @property({ type: Object }) value?: {\n category: string\n privilege: string\n owner?: boolean\n super?: boolean\n } | null\n\n @property({ type: Array }) privileges: { privilege: string; category: string; description: string }[] = []\n\n @query('form') private form!: HTMLFormElement\n\n render() {\n const { category, privilege, owner, super: superUser } = this.value || {}\n const privileges = this.privileges || []\n\n return html`\n <form @change=${this.onChange.bind(this)}>\n <div values>\n <label for=\"privilege\" col1>${i18next.t('label.privilege')}</label>\n <select id=\"privilege\" name=\"privilege\" value=${ifDefined(privilege)}>\n <option value=\"\"> </option>\n ${privileges.map(\n p =>\n html`<option\n value=${`${p.category}:${p.privilege}`}\n ?selected=${category == p.category && privilege == p.privilege}\n >\n ${p.description}\n </option>`\n )}\n </select>\n\n <label for=\"owner\" col1>${i18next.t('label.domain-owner')}</label>\n <input id=\"owner\" type=\"checkbox\" name=\"owner\" ?checked=${owner} col2></input>\n\n <label for=\"super\" col1>${i18next.t('label.superuser')}</label>\n <input id=\"super\" type=\"checkbox\" name=\"super\" ?checked=${superUser} col2></input>\n </div>\n </form>\n `\n }\n\n buildValue() {\n const formData = new FormData(this.form)\n\n const [category = '', privilege = ''] = (formData.get('privilege') as string).split(':')\n const owner = formData.get('owner') as string\n const superUser = formData.get('super') as string\n\n return {\n category,\n privilege,\n owner: owner == 'on',\n super: superUser == 'on'\n }\n }\n\n firstUpdated() {\n ;(this.renderRoot.querySelector('input') as HTMLInputElement).focus()\n }\n\n onChange(e: Event) {\n e.stopPropagation()\n\n this.value = this.buildValue()\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import '../src/ox-input-code.js';
|
2
|
+
import { TemplateResult } from 'lit';
|
3
|
+
declare const _default: {
|
4
|
+
title: string;
|
5
|
+
component: string;
|
6
|
+
argTypes: {
|
7
|
+
value: {
|
8
|
+
control: string;
|
9
|
+
};
|
10
|
+
name: {
|
11
|
+
control: string;
|
12
|
+
};
|
13
|
+
};
|
14
|
+
};
|
15
|
+
export default _default;
|
16
|
+
interface Story<T> {
|
17
|
+
(args: T): TemplateResult;
|
18
|
+
args?: Partial<T>;
|
19
|
+
argTypes?: Record<string, unknown>;
|
20
|
+
}
|
21
|
+
interface ArgTypes {
|
22
|
+
name?: string;
|
23
|
+
value?: string;
|
24
|
+
}
|
25
|
+
export declare const Regular: Story<ArgTypes>;
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import '../src/ox-input-code.js';
|
2
|
+
import { html } from 'lit';
|
3
|
+
export default {
|
4
|
+
title: 'ox-input-code',
|
5
|
+
component: 'ox-input-code',
|
6
|
+
argTypes: {
|
7
|
+
value: { control: 'text' },
|
8
|
+
name: { control: 'text' }
|
9
|
+
}
|
10
|
+
};
|
11
|
+
const Template = ({ name = 'code', value = '' }) => html `
|
12
|
+
<link href="/themes/app-theme.css" rel="stylesheet" />
|
13
|
+
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
|
14
|
+
<style>
|
15
|
+
body {
|
16
|
+
}
|
17
|
+
</style>
|
18
|
+
|
19
|
+
<ox-input-code
|
20
|
+
@change=${(e) => {
|
21
|
+
console.log(e.target.value);
|
22
|
+
}}
|
23
|
+
name=${name}
|
24
|
+
.value=${value}
|
25
|
+
>
|
26
|
+
</ox-input-code>
|
27
|
+
`;
|
28
|
+
export const Regular = Template.bind({});
|
29
|
+
Regular.args = {
|
30
|
+
name: 'code',
|
31
|
+
value: ''
|
32
|
+
};
|
33
|
+
//# sourceMappingURL=ox-input-code.stories.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ox-input-code.stories.js","sourceRoot":"","sources":["../../stories/ox-input-code.stories.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA;AAEhC,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAE1C,eAAe;IACb,KAAK,EAAE,eAAe;IACtB,SAAS,EAAE,eAAe;IAC1B,QAAQ,EAAE;QACR,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC1B,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;KAC1B;CACF,CAAA;AAaD,MAAM,QAAQ,GAAoB,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,KAAK,GAAG,EAAE,EAAY,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;cASrE,CAAC,CAAQ,EAAE,EAAE;IACrB,OAAO,CAAC,GAAG,CAAE,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC,CAAA;AACnD,CAAC;WACM,IAAI;aACF,KAAK;;;CAGjB,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG;IACb,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,EAAE;CACV,CAAA","sourcesContent":["import '../src/ox-input-code.js'\n\nimport { html, TemplateResult } from 'lit'\n\nexport default {\n title: 'ox-input-code',\n component: 'ox-input-code',\n argTypes: {\n value: { control: 'text' },\n name: { control: 'text' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n name?: string\n value?: string\n}\n\nconst Template: Story<ArgTypes> = ({ name = 'code', value = '' }: ArgTypes) => html`\n <link href=\"/themes/app-theme.css\" rel=\"stylesheet\" />\n <link href=\"https://fonts.googleapis.com/css?family=Material+Icons&display=block\" rel=\"stylesheet\" />\n <style>\n body {\n }\n </style>\n\n <ox-input-code\n @change=${(e: Event) => {\n console.log((e.target as HTMLInputElement).value)\n }}\n name=${name}\n .value=${value}\n >\n </ox-input-code>\n`\n\nexport const Regular = Template.bind({})\nRegular.args = {\n name: 'code',\n value: ''\n}\n"]}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import '../src/ox-input-graphql.js';
|
2
|
+
import { TemplateResult } from 'lit';
|
3
|
+
declare const _default: {
|
4
|
+
title: string;
|
5
|
+
component: string;
|
6
|
+
argTypes: {
|
7
|
+
value: {
|
8
|
+
control: string;
|
9
|
+
};
|
10
|
+
name: {
|
11
|
+
control: string;
|
12
|
+
};
|
13
|
+
};
|
14
|
+
};
|
15
|
+
export default _default;
|
16
|
+
interface Story<T> {
|
17
|
+
(args: T): TemplateResult;
|
18
|
+
args?: Partial<T>;
|
19
|
+
argTypes?: Record<string, unknown>;
|
20
|
+
}
|
21
|
+
interface ArgTypes {
|
22
|
+
name?: string;
|
23
|
+
value?: string;
|
24
|
+
}
|
25
|
+
export declare const Regular: Story<ArgTypes>;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import '../src/ox-input-graphql.js';
|
2
|
+
import { html } from 'lit';
|
3
|
+
export default {
|
4
|
+
title: 'ox-input-graphql',
|
5
|
+
component: 'ox-input-graphql',
|
6
|
+
argTypes: {
|
7
|
+
value: { control: 'text' },
|
8
|
+
name: { control: 'text' }
|
9
|
+
}
|
10
|
+
};
|
11
|
+
const Template = ({ name = 'code', value = '' }) => html `
|
12
|
+
<link href="/themes/app-theme.css" rel="stylesheet" />
|
13
|
+
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
|
14
|
+
<style>
|
15
|
+
body {
|
16
|
+
}
|
17
|
+
</style>
|
18
|
+
|
19
|
+
<ox-input-graphql
|
20
|
+
@change=${(e) => {
|
21
|
+
console.log(e.target.value);
|
22
|
+
}}
|
23
|
+
name=${name}
|
24
|
+
.value=${value}
|
25
|
+
>
|
26
|
+
</ox-input-graphql>
|
27
|
+
`;
|
28
|
+
export const Regular = Template.bind({});
|
29
|
+
Regular.args = {
|
30
|
+
name: 'code',
|
31
|
+
value: `
|
32
|
+
query privileges {
|
33
|
+
privileges {
|
34
|
+
items {
|
35
|
+
privilege
|
36
|
+
category
|
37
|
+
description
|
38
|
+
}
|
39
|
+
total
|
40
|
+
}
|
41
|
+
}
|
42
|
+
`
|
43
|
+
};
|
44
|
+
//# sourceMappingURL=ox-input-graphql.stories.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ox-input-graphql.stories.js","sourceRoot":"","sources":["../../stories/ox-input-graphql.stories.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAE1C,eAAe;IACb,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,kBAAkB;IAC7B,QAAQ,EAAE;QACR,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC1B,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;KAC1B;CACF,CAAA;AAaD,MAAM,QAAQ,GAAoB,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,KAAK,GAAG,EAAE,EAAY,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;cASrE,CAAC,CAAQ,EAAE,EAAE;IACrB,OAAO,CAAC,GAAG,CAAE,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC,CAAA;AACnD,CAAC;WACM,IAAI;aACF,KAAK;;;CAGjB,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG;IACb,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE;;;;;;;;;;;CAWR;CACA,CAAA","sourcesContent":["import '../src/ox-input-graphql.js'\n\nimport { html, TemplateResult } from 'lit'\n\nexport default {\n title: 'ox-input-graphql',\n component: 'ox-input-graphql',\n argTypes: {\n value: { control: 'text' },\n name: { control: 'text' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n name?: string\n value?: string\n}\n\nconst Template: Story<ArgTypes> = ({ name = 'code', value = '' }: ArgTypes) => html`\n <link href=\"/themes/app-theme.css\" rel=\"stylesheet\" />\n <link href=\"https://fonts.googleapis.com/css?family=Material+Icons&display=block\" rel=\"stylesheet\" />\n <style>\n body {\n }\n </style>\n\n <ox-input-graphql\n @change=${(e: Event) => {\n console.log((e.target as HTMLInputElement).value)\n }}\n name=${name}\n .value=${value}\n >\n </ox-input-graphql>\n`\n\nexport const Regular = Template.bind({})\nRegular.args = {\n name: 'code',\n value: `\nquery privileges {\n privileges {\n items {\n privilege\n category\n description\n }\n total\n }\n}\n`\n}\n"]}
|