@operato/app 2.0.0-alpha.11 → 2.0.0-alpha.111

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +589 -0
  2. package/demo/data-grist-test.html +25 -14
  3. package/demo/index.html +13 -2
  4. package/dist/src/filters-form/filter-resource-select.js +13 -16
  5. package/dist/src/filters-form/filter-resource-select.js.map +1 -1
  6. package/dist/src/grist-editor/ox-grist-editor-code.d.ts +1 -1
  7. package/dist/src/grist-editor/ox-grist-editor-json.d.ts +1 -1
  8. package/dist/src/grist-editor/ox-grist-editor-privilege.d.ts +1 -1
  9. package/dist/src/grist-editor/ox-grist-editor-resource-code.d.ts +2 -2
  10. package/dist/src/grist-editor/ox-grist-editor-resource-code.js +2 -2
  11. package/dist/src/grist-editor/ox-grist-editor-resource-code.js.map +1 -1
  12. package/dist/src/grist-editor/ox-grist-editor-resource-id.d.ts +2 -2
  13. package/dist/src/grist-editor/ox-grist-editor-resource-id.js +2 -2
  14. package/dist/src/grist-editor/ox-grist-editor-resource-id.js.map +1 -1
  15. package/dist/src/grist-editor/ox-grist-renderer-resource-code.d.ts +1 -1
  16. package/dist/src/grist-editor/ox-popup-code-input.d.ts +2 -1
  17. package/dist/src/grist-editor/ox-popup-code-input.js +7 -8
  18. package/dist/src/grist-editor/ox-popup-code-input.js.map +1 -1
  19. package/dist/src/grist-editor/ox-popup-privilege-input.d.ts +2 -1
  20. package/dist/src/grist-editor/ox-popup-privilege-input.js +8 -15
  21. package/dist/src/grist-editor/ox-popup-privilege-input.js.map +1 -1
  22. package/dist/src/input/ox-input-background-pattern.d.ts +1 -1
  23. package/dist/src/input/ox-input-fill-style.d.ts +1 -1
  24. package/dist/src/input/ox-input-graphql.d.ts +1 -0
  25. package/dist/src/input/ox-input-graphql.js +6 -2
  26. package/dist/src/input/ox-input-graphql.js.map +1 -1
  27. package/dist/src/selector/ox-selector-resource-id.d.ts +2 -1
  28. package/dist/src/selector/ox-selector-resource-id.js +8 -9
  29. package/dist/src/selector/ox-selector-resource-id.js.map +1 -1
  30. package/dist/src/selector/ox-selector-resource-object-legacy.d.ts +4 -3
  31. package/dist/src/selector/ox-selector-resource-object-legacy.js +8 -9
  32. package/dist/src/selector/ox-selector-resource-object-legacy.js.map +1 -1
  33. package/dist/src/selector/ox-selector-resource-object.d.ts +3 -2
  34. package/dist/src/selector/ox-selector-resource-object.js +9 -10
  35. package/dist/src/selector/ox-selector-resource-object.js.map +1 -1
  36. package/dist/stories/graphql-client.stories.d.ts +26 -0
  37. package/dist/stories/graphql-client.stories.js +55 -0
  38. package/dist/stories/graphql-client.stories.js.map +1 -0
  39. package/dist/stories/ox-input-graphql.stories.js +13 -1
  40. package/dist/stories/ox-input-graphql.stories.js.map +1 -1
  41. package/dist/stories/ox-selector-resource-object.stories.d.ts +29 -0
  42. package/dist/stories/ox-selector-resource-object.stories.js +80 -0
  43. package/dist/stories/ox-selector-resource-object.stories.js.map +1 -0
  44. package/dist/tsconfig.tsbuildinfo +1 -1
  45. package/package.json +27 -30
  46. package/src/filters-form/filter-resource-select.ts +32 -31
  47. package/src/grist-editor/ox-grist-editor-resource-code.ts +2 -2
  48. package/src/grist-editor/ox-grist-editor-resource-id.ts +2 -2
  49. package/src/grist-editor/ox-popup-code-input.ts +7 -8
  50. package/src/grist-editor/ox-popup-privilege-input.ts +8 -15
  51. package/src/input/ox-input-graphql.ts +3 -2
  52. package/src/selector/ox-selector-resource-id.ts +8 -9
  53. package/src/selector/ox-selector-resource-object-legacy.ts +16 -17
  54. package/src/selector/ox-selector-resource-object.ts +10 -11
  55. package/stories/graphql-client.stories.ts +73 -0
  56. package/stories/ox-input-graphql.stories.ts +13 -1
  57. package/stories/ox-selector-resource-object.stories.ts +98 -0
  58. package/themes/app-theme.css +10 -0
  59. package/themes/grist-theme.css +3 -1
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@operato/app",
3
3
  "description": "WebApplication production supporting components following open-wc recommendations",
4
4
  "author": "heartyoh",
5
- "version": "2.0.0-alpha.11",
5
+ "version": "2.0.0-alpha.111",
6
6
  "main": "dist/src/index.js",
7
7
  "module": "dist/src/index.js",
8
8
  "exports": {
@@ -133,46 +133,43 @@
133
133
  "@codemirror/view": "^6.22.1",
134
134
  "@graphql-tools/delegate": "^10.0.1",
135
135
  "@graphql-tools/wrap": "^8.5.0",
136
- "@material/mwc-button": "^0.27.0",
137
- "@material/mwc-icon": "^0.27.0",
138
- "@material/mwc-icon-button": "^0.27.0",
139
- "@operato/attachment": "^2.0.0-alpha.11",
140
- "@operato/data-grist": "^2.0.0-alpha.11",
141
- "@operato/font": "^2.0.0-alpha.11",
142
- "@operato/form": "^2.0.0-alpha.8",
143
- "@operato/graphql": "^2.0.0-alpha.0",
144
- "@operato/i18n": "^2.0.0-alpha.0",
145
- "@operato/input": "^2.0.0-alpha.11",
146
- "@operato/layout": "^2.0.0-alpha.9",
147
- "@operato/property-editor": "^2.0.0-alpha.11",
148
- "@operato/shell": "^2.0.0-alpha.8",
149
- "@operato/styles": "^2.0.0-alpha.0",
150
- "@operato/utils": "^2.0.0-alpha.8",
151
- "cm6-graphql": "^0.0.12",
136
+ "@material/web": "^1.4.0",
137
+ "@operato/attachment": "^2.0.0-alpha.111",
138
+ "@operato/data-grist": "^2.0.0-alpha.111",
139
+ "@operato/font": "^2.0.0-alpha.111",
140
+ "@operato/form": "^2.0.0-alpha.111",
141
+ "@operato/graphql": "^2.0.0-alpha.111",
142
+ "@operato/i18n": "^2.0.0-alpha.111",
143
+ "@operato/input": "^2.0.0-alpha.111",
144
+ "@operato/layout": "^2.0.0-alpha.111",
145
+ "@operato/property-editor": "^2.0.0-alpha.111",
146
+ "@operato/shell": "^2.0.0-alpha.111",
147
+ "@operato/styles": "^2.0.0-alpha.111",
148
+ "@operato/utils": "^2.0.0-alpha.111",
149
+ "cm6-graphql": "^0.0.14",
152
150
  "codemirror": "^6.0.1",
153
151
  "cronstrue": "^2.2.0",
154
- "cross-fetch": "^3.1.5",
155
152
  "graphql": "^16.5.0",
156
153
  "graphql-config": "^5.0.2",
157
154
  "graphql-tag": "^2.12.6",
158
- "lit": "^2.5.0"
155
+ "lit": "^3.1.2"
159
156
  },
160
157
  "devDependencies": {
161
- "@custom-elements-manifest/analyzer": "^0.8.1",
158
+ "@custom-elements-manifest/analyzer": "^0.9.2",
162
159
  "@hatiolab/prettier-config": "^1.0.0",
163
- "@open-wc/eslint-config": "^10.0.0",
160
+ "@open-wc/eslint-config": "^12.0.3",
164
161
  "@open-wc/testing": "^3.1.6",
165
- "@typescript-eslint/eslint-plugin": "^5.59.1",
166
- "@typescript-eslint/parser": "^5.59.1",
162
+ "@typescript-eslint/eslint-plugin": "^7.0.1",
163
+ "@typescript-eslint/parser": "^7.0.1",
167
164
  "@web/dev-server": "^0.3.0",
168
- "@web/dev-server-storybook": "^0.7.4",
169
- "@web/test-runner": "^0.17.0",
165
+ "@web/dev-server-storybook": "^2.0.1",
166
+ "@web/test-runner": "^0.18.0",
170
167
  "concurrently": "^8.0.1",
171
168
  "eslint": "^8.39.0",
172
- "eslint-config-prettier": "^8.3.0",
173
- "husky": "^8.0.1",
174
- "lint-staged": "^13.2.2",
175
- "prettier": "^2.4.1",
169
+ "eslint-config-prettier": "^9.1.0",
170
+ "husky": "^9.0.11",
171
+ "lint-staged": "^15.2.2",
172
+ "prettier": "^3.2.5",
176
173
  "tslib": "^2.3.1",
177
174
  "typescript": "^5.0.4"
178
175
  },
@@ -189,5 +186,5 @@
189
186
  "prettier --write"
190
187
  ]
191
188
  },
192
- "gitHead": "5eceb2cf6973a59f0d927801accb2e52afbb5720"
189
+ "gitHead": "3525a4247ad184a8d4de91d81db3f72f0e940c79"
193
190
  }
@@ -6,22 +6,16 @@ import { html } from 'lit-html'
6
6
  import { FilterConfig, FilterSelectRenderer } from '@operato/form'
7
7
  import { i18next } from '@operato/i18n'
8
8
  import { openPopup } from '@operato/layout'
9
+ import { GristRecord } from '@operato/data-grist'
9
10
 
10
- type SelectedCallback = (value: { id: string; name: string; description: string }) => void
11
+ type SelectedCallback = (value?: Partial<GristRecord>) => void
11
12
 
12
13
  function openResourceSelector(filter: FilterConfig, value: any, confirmCallback: SelectedCallback) {
13
- const { queryName, select, list, basicArgs, valueField = 'id', title } = filter.options || {}
14
-
15
- var actualValue
16
- if (typeof valueField === 'function') {
17
- actualValue = valueField(value)
18
- } else {
19
- actualValue = value?.[valueField]
20
- }
14
+ const { queryName, select, list, basicArgs, valueField = 'id', title } = filter.options || ({} as any)
21
15
 
22
16
  var template = html`
23
17
  <ox-selector-resource-object
24
- .value=${actualValue}
18
+ .value=${value}
25
19
  .confirmCallback=${confirmCallback}
26
20
  .queryName=${queryName}
27
21
  .columns=${select}
@@ -53,9 +47,9 @@ function openResourceSelector(filter: FilterConfig, value: any, confirmCallback:
53
47
 
54
48
  export const FilterResourceSelect: FilterSelectRenderer = (filter, value, owner: any) => {
55
49
  const { name, operator = 'like' } = filter
56
- var { idField = 'id', nameField = 'name', descriptionField = 'description' } = filter.options || {};
57
- const hideValue = value ? value[idField] : '';
58
- const text = value ? value[nameField] : '';
50
+ var { idField = 'id', nameField = 'name', descriptionField = 'description' } = filter.options || ({} as any)
51
+ const hideValue = value ? value[idField] : ''
52
+ const text = value ? value[nameField] : ''
59
53
 
60
54
  return operator === 'like'
61
55
  ? html` <input
@@ -78,35 +72,42 @@ export const FilterResourceSelect: FilterSelectRenderer = (filter, value, owner:
78
72
  }}
79
73
  />`
80
74
  : operator == 'in'
81
- ? html``
82
- : operator === 'eq'
83
- ? html`
75
+ ? html``
76
+ : operator === 'eq'
77
+ ? html`
84
78
  <input name='${name}' .value=${hideValue} type="text" hidden></input>
85
79
  <input
86
80
  type="text"
87
81
  name='${name}_disp'
88
82
  .value=${text}
89
83
  readonly
84
+ @change=${() => false}
90
85
  @click=${(e: Event) => {
91
86
  e.stopPropagation()
92
- const input = e.target as HTMLInputElement;
87
+
88
+ const input = e.target as HTMLInputElement
89
+ const codeInput =
90
+ owner.tagName.toLowerCase() == 'ox-grid-header'
91
+ ? owner.renderRoot.querySelector(`[name="${name}"]`)
92
+ : owner.renderRoot.querySelector(`form [name="${name}"]`)
93
93
 
94
94
  const confirmCallback = (selected?: { [field: string]: any }) => {
95
- let disp = selected ? selected[idField] : '';
95
+ let disp = selected ? selected[idField] : ''
96
96
 
97
- if(selected && nameField){
98
- disp = selected[nameField];
97
+ if (selected && nameField) {
98
+ disp = selected[nameField]
99
99
  }
100
- input.value = disp;
101
-
102
- let codeInput = owner.tagName.toLowerCase() == 'ox-grid-header'
103
- ? owner.renderRoot.querySelector(`[name="${name}"]`)
104
- : owner.renderRoot.querySelector(`form [name="${name}"]`);
100
+ input.value = disp
105
101
 
106
- const objectValue = selected ? selected[idField] : '';
107
- codeInput.value = objectValue;
102
+ const value = selected ? selected[idField] : ''
103
+ codeInput.value = value
108
104
 
109
- input.dispatchEvent(new Event('change', { bubbles: true }))
105
+ codeInput.dispatchEvent(
106
+ new Event('change', {
107
+ bubbles: true,
108
+ composed: true
109
+ })
110
+ )
110
111
 
111
112
  owner.dispatchEvent(
112
113
  new CustomEvent('filter-change', {
@@ -115,15 +116,15 @@ export const FilterResourceSelect: FilterSelectRenderer = (filter, value, owner:
115
116
  detail: {
116
117
  name: name,
117
118
  operator,
118
- value: objectValue
119
+ value
119
120
  }
120
121
  })
121
122
  )
122
123
  }
123
124
 
124
- openResourceSelector(filter, value, confirmCallback)
125
+ openResourceSelector(filter, codeInput.value, confirmCallback)
125
126
  }}
126
127
  />
127
128
  `
128
- : html``
129
+ : html``
129
130
  }
@@ -1,4 +1,4 @@
1
- import '@material/mwc-icon'
1
+ import '@material/web/icon/icon.js'
2
2
  import { OxGristEditor, RecordConfig } from '@operato/data-grist'
3
3
 
4
4
  import { customElement } from 'lit/decorators.js'
@@ -20,7 +20,7 @@ export class OxGristEditorResourceCode extends OxGristEditor {
20
20
  ${(codes || []).map(
21
21
  (code: CommonCodeDetail) => html`
22
22
  <option ?selected=${code.name == this.value} value=${code.name}>
23
- ${code.name == '' ? '' : selectDispOpt.replace('name',code.description).replace('code',code.name)}
23
+ ${code.name == '' ? '' : selectDispOpt.replace('name', code.description).replace('code', code.name)}
24
24
  </option>
25
25
  `
26
26
  )}
@@ -1,4 +1,4 @@
1
- import '@material/mwc-icon'
1
+ import '@material/web/icon/icon.js'
2
2
  import '../selector/ox-selector-resource-id.js'
3
3
 
4
4
  import { html } from 'lit'
@@ -19,7 +19,7 @@ export class OxGristEditorResourceId extends OxGristEditor {
19
19
  ${!value
20
20
  ? html`<span tabindex="0"></span>`
21
21
  : html` <span tabindex="0">${value[nameField]} (${value[descriptionField]})</span> `}
22
- <mwc-icon>arrow_drop_down</mwc-icon>
22
+ <md-icon>arrow_drop_down</md-icon>
23
23
  `
24
24
  }
25
25
 
@@ -1,3 +1,4 @@
1
+ import '@material/web/icon/icon.js'
1
2
  import '@operato/input/ox-input-code.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-code-input')
11
12
  export class OxPopupCodeInput extends LitElement {
12
13
  static styles = [
14
+ ButtonContainerStyles,
13
15
  ScrollbarStyles,
14
16
  css`
15
17
  :host {
@@ -26,11 +28,6 @@ export class OxPopupCodeInput 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
 
@@ -45,8 +42,10 @@ export class OxPopupCodeInput extends LitElement {
45
42
  </ox-input-code>
46
43
 
47
44
  <div class="button-container">
48
- <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
49
- <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
45
+ <button @click=${this.onCancel.bind(this)} danger>
46
+ <md-icon>cancel</md-icon>${i18next.t('button.cancel')}
47
+ </button>
48
+ <button @click=${this.onConfirm.bind(this)}><md-icon>done</md-icon>${i18next.t('button.confirm')}</button>
50
49
  </div>
51
50
  `
52
51
  }
@@ -1,3 +1,4 @@
1
+ import '@material/web/icon/icon.js'
1
2
  import '@operato/input/ox-input-privilege.js'
2
3
 
3
4
  import gql from 'graphql-tag'
@@ -6,12 +7,13 @@ import { customElement, property, state } from 'lit/decorators.js'
6
7
 
7
8
  import { i18next } from '@operato/i18n'
8
9
  import { closePopup } from '@operato/popup'
9
- import { ScrollbarStyles } from '@operato/styles'
10
+ import { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles'
10
11
  import { client } from '@operato/graphql'
11
12
 
12
13
  @customElement('ox-popup-privilege-input')
13
14
  export class OxPopupPrivilegeInput extends LitElement {
14
15
  static styles = [
16
+ ButtonContainerStyles,
15
17
  ScrollbarStyles,
16
18
  css`
17
19
  :host {
@@ -28,15 +30,6 @@ export class OxPopupPrivilegeInput extends LitElement {
28
30
  flex: 1;
29
31
  overflow-y: auto;
30
32
  }
31
-
32
- .button-container {
33
- display: flex;
34
- flex-direction: row;
35
- }
36
-
37
- div[padding] {
38
- flex: 1;
39
- }
40
33
  `
41
34
  ]
42
35
 
@@ -51,11 +44,11 @@ export class OxPopupPrivilegeInput extends LitElement {
51
44
  <ox-input-privilege .value=${this.value} .privileges=${this.privileges} @change=${this.onChange.bind(this)}>
52
45
  </ox-input-privilege>
53
46
 
54
- <div class="button-container">
55
- <mwc-button @click=${this.onReset.bind(this)}>${i18next.t('button.reset')}</mwc-button>
56
- <div padding></div>
57
- <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
58
- <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
47
+ <div class="button-container" style="margin-left: unset;">
48
+ <button @click=${this.onReset.bind(this)}><md-icon>restart_alt</md-icon>${i18next.t('button.reset')}</button>
49
+ <div filler></div>
50
+ <button @click=${this.onCancel.bind(this)}><md-icon>cancel</md-icon>${i18next.t('button.cancel')}</button>
51
+ <button @click=${this.onConfirm.bind(this)}><md-icon>done</md-icon>${i18next.t('button.confirm')}</button>
59
52
  </div>
60
53
  `
61
54
  }
@@ -2,7 +2,6 @@
2
2
  * @license Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
4
 
5
- import { fetch } from 'cross-fetch'
6
5
  import { print } from 'graphql'
7
6
  import { css, html, PropertyValues } from 'lit'
8
7
  import { customElement, property, query } from 'lit/decorators.js'
@@ -12,7 +11,7 @@ import { history, historyKeymap, indentWithTab } from '@codemirror/commands'
12
11
  import { autocompletion, closeBrackets } from '@codemirror/autocomplete'
13
12
  import { bracketMatching, syntaxHighlighting } from '@codemirror/language'
14
13
  import { oneDarkHighlightStyle, oneDark } from '@codemirror/theme-one-dark'
15
- import { EditorView, highlightActiveLine, keymap } from '@codemirror/view'
14
+ import { EditorView, highlightActiveLine, keymap, lineNumbers } from '@codemirror/view'
16
15
 
17
16
  import { introspectSchema, wrapSchema } from '@graphql-tools/wrap'
18
17
  import { GRAPHQL_URI } from '@operato/graphql'
@@ -50,6 +49,7 @@ export default class OxInputGraphql extends OxFormField {
50
49
  */
51
50
  @property({ type: String }) value?: string
52
51
  @property({ type: String }) link?: string
52
+ @property({ type: Boolean, attribute: 'show-line-numbers' }) showLineNumbers: boolean = false
53
53
 
54
54
  private _self_changing: boolean = false
55
55
  private _editor?: EditorView
@@ -98,6 +98,7 @@ export default class OxInputGraphql extends OxFormField {
98
98
  this._editor = new EditorView({
99
99
  doc: this.value,
100
100
  extensions: [
101
+ ...(this.showLineNumbers ? [lineNumbers()] : []),
101
102
  bracketMatching(),
102
103
  closeBrackets(),
103
104
  history(),
@@ -1,3 +1,4 @@
1
+ import '@material/web/icon/icon.js'
1
2
  import '@operato/data-grist'
2
3
 
3
4
  import gql from 'graphql-tag'
@@ -39,11 +40,6 @@ export class OxSelectorResourceId extends LitElement {
39
40
  #filters > * {
40
41
  padding: var(--padding-default) var(--padding-wide);
41
42
  }
42
-
43
- .button-container {
44
- display: flex;
45
- margin-left: auto;
46
- }
47
43
  `
48
44
  ]
49
45
 
@@ -71,10 +67,13 @@ export class OxSelectorResourceId extends LitElement {
71
67
  </div>
72
68
  </ox-grist>
73
69
 
74
- <div class="button-container">
75
- <mwc-button @click=${this.onEmpty.bind(this)}>${i18next.t('button.empty')}</mwc-button>
76
- <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
77
- <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
70
+ <div class="button-container" style="margin-left: unset;">
71
+ <button @click=${this.onEmpty.bind(this)}>
72
+ <md-icon>check_box_outline_blank</md-icon>${i18next.t('button.empty')}
73
+ </button>
74
+ <div filler></div>
75
+ <button @click=${this.onCancel.bind(this)}><md-icon>cancel</md-icon>${i18next.t('button.cancel')}</button>
76
+ <button @click=${this.onConfirm.bind(this)}><md-icon>done</md-icon>${i18next.t('button.confirm')}</button>
78
77
  </div>
79
78
  `
80
79
  }
@@ -1,3 +1,4 @@
1
+ import '@material/web/icon/icon.js'
1
2
  import '@operato/data-grist'
2
3
  import '@operato/form/ox-search-form.js'
3
4
 
@@ -16,7 +17,7 @@ import {
16
17
  InheritedValueType,
17
18
  ZERO_DATA
18
19
  } from '@operato/data-grist'
19
- import { MultiColumnFormStyles, SearchForm } from '@operato/form'
20
+ import { MultiColumnFormStyles, OxSearchForm } from '@operato/form'
20
21
  import { buildArgs, client, gqlContext } from '@operato/graphql'
21
22
  import { i18next } from '@operato/i18n'
22
23
  import { closePopup } from '@operato/popup'
@@ -40,11 +41,6 @@ export class OxSelectorResourceObjectLegacy extends LitElement {
40
41
  flex: 1;
41
42
  }
42
43
 
43
- .button-container {
44
- display: flex;
45
- margin-left: auto;
46
- }
47
-
48
44
  form {
49
45
  position: relative;
50
46
  }
@@ -80,7 +76,7 @@ export class OxSelectorResourceObjectLegacy extends LitElement {
80
76
  @property({ type: String }) valueField: string | ((item: any) => any) = 'id'
81
77
 
82
78
  @query('ox-grist') grist!: DataGrist
83
- @query('ox-search-form') searchForm!: SearchForm
79
+ @query('ox-search-form') searchForm!: OxSearchForm
84
80
 
85
81
  render() {
86
82
  return html`
@@ -110,10 +106,13 @@ export class OxSelectorResourceObjectLegacy extends LitElement {
110
106
  </div>
111
107
  </ox-grist>
112
108
 
113
- <div class="button-container">
114
- <mwc-button @click=${this.onEmpty.bind(this)}>${i18next.t('button.empty')}</mwc-button>
115
- <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
116
- <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
109
+ <div class="button-container" style="margin-left: unset;">
110
+ <button @click=${this.onEmpty.bind(this)}>
111
+ <md-icon>check_box_outline_blank</md-icon>${i18next.t('button.empty')}
112
+ </button>
113
+ <div filler></div>
114
+ <button @click=${this.onCancel.bind(this)}><md-icon>cancel</md-icon>${i18next.t('button.cancel')}</button>
115
+ <button @click=${this.onConfirm.bind(this)}><md-icon>done</md-icon>${i18next.t('button.confirm')}</button>
117
116
  </div>
118
117
  `
119
118
  }
@@ -223,17 +222,17 @@ export class OxSelectorResourceObjectLegacy extends LitElement {
223
222
  fieldType === 'string'
224
223
  ? 'text'
225
224
  : numberTypes.indexOf(fieldType) >= 0
226
- ? 'number'
227
- : fieldType === 'boolean'
228
- ? 'checkbox'
229
- : fieldType,
225
+ ? 'number'
226
+ : fieldType === 'boolean'
227
+ ? 'checkbox'
228
+ : fieldType,
230
229
  queryName: selectField.queryName,
231
230
  props:
232
231
  fieldType === 'string'
233
232
  ? { searchOper: 'i_like' }
234
233
  : fieldType === 'object'
235
- ? { searchOper: 'in' }
236
- : { searchOper: 'eq' },
234
+ ? { searchOper: 'in' }
235
+ : { searchOper: 'eq' },
237
236
  attrs: fieldType === 'boolean' ? ['indeterminated'] : []
238
237
  }
239
238
  })
@@ -1,3 +1,4 @@
1
+ import '@material/web/icon/icon.js'
1
2
  import '@operato/data-grist'
2
3
 
3
4
  import gql from 'graphql-tag'
@@ -47,11 +48,6 @@ export class OxSelectorResourceObject extends LitElement {
47
48
  #filters > * {
48
49
  padding: var(--padding-default) var(--padding-wide);
49
50
  }
50
-
51
- .button-container {
52
- display: flex;
53
- margin-left: auto;
54
- }
55
51
  `
56
52
  ]
57
53
 
@@ -61,7 +57,7 @@ export class OxSelectorResourceObject extends LitElement {
61
57
  @property({ type: String }) queryName!: string
62
58
  @property({ type: Object }) basicArgs: any
63
59
  @property({ type: String }) inherited?: InheritedValueType = InheritedValueType.Include
64
- @property({ type: Object }) confirmCallback?: (record?: GristRecord | null) => void
60
+ @property({ type: Object }) confirmCallback?: (record?: Partial<GristRecord>) => void
65
61
  @property({ type: Array }) selectedRecords: GristRecord[] = []
66
62
 
67
63
  @property({ type: Array }) searchFields: any
@@ -97,10 +93,13 @@ export class OxSelectorResourceObject extends LitElement {
97
93
  </div>
98
94
  </ox-grist>
99
95
 
100
- <div class="button-container">
101
- <mwc-button @click=${this.onEmpty.bind(this)}>${i18next.t('button.empty')}</mwc-button>
102
- <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
103
- <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
96
+ <div class="button-container" style="margin-left: unset;">
97
+ <button @click=${this.onEmpty.bind(this)}>
98
+ <md-icon>check_box_outline_blank</md-icon>${i18next.t('button.empty')}
99
+ </button>
100
+ <div filler></div>
101
+ <button @click=${this.onCancel.bind(this)}><md-icon>cancel</md-icon>${i18next.t('button.cancel')}</button>
102
+ <button @click=${this.onConfirm.bind(this)}><md-icon>done</md-icon>${i18next.t('button.confirm')}</button>
104
103
  </div>
105
104
  `
106
105
  }
@@ -114,7 +113,7 @@ export class OxSelectorResourceObject extends LitElement {
114
113
  }
115
114
 
116
115
  onEmpty() {
117
- this.confirmCallback && this.confirmCallback(null)
116
+ this.confirmCallback && this.confirmCallback()
118
117
  closePopup(this)
119
118
  }
120
119
 
@@ -0,0 +1,73 @@
1
+ import { setClientLink, createMockLink } from '@operato/graphql/graphql-env.js'
2
+ import '@operato/graphql/graphql-client.js'
3
+ import '../src/input/ox-input-graphql.js'
4
+
5
+ // TODO cm6-graphql에서 사용하는 nullthrows 관련 모듈 오류로 스토리북 테스트가 안됨.
6
+
7
+ import { html, TemplateResult } from 'lit'
8
+
9
+ setClientLink(
10
+ createMockLink({
11
+ request: {
12
+ query: ''
13
+ },
14
+ result: {
15
+ data: {
16
+ viewer: null
17
+ }
18
+ }
19
+ })
20
+ )
21
+
22
+ export default {
23
+ title: 'graphql-client',
24
+ component: 'graphql-client',
25
+ argTypes: {
26
+ value: { control: 'text' },
27
+ name: { control: 'text' }
28
+ }
29
+ }
30
+
31
+ interface Story<T> {
32
+ (args: T): TemplateResult
33
+ args?: Partial<T>
34
+ argTypes?: Record<string, unknown>
35
+ }
36
+
37
+ interface ArgTypes {
38
+ name?: string
39
+ value?: string
40
+ }
41
+
42
+ const Template: Story<ArgTypes> = ({ name = 'code', value = '' }: ArgTypes) => html`
43
+ <style>
44
+ body {
45
+ }
46
+ </style>
47
+
48
+ <ox-input-graphql
49
+ @change=${(e: Event) => {
50
+ console.log((e.target as HTMLInputElement).value)
51
+ }}
52
+ name=${name}
53
+ .value=${value}
54
+ >
55
+ </ox-input-graphql>
56
+ `
57
+
58
+ export const Regular = Template.bind({})
59
+ Regular.args = {
60
+ name: 'code',
61
+ value: `
62
+ query privileges {
63
+ privileges {
64
+ items {
65
+ privilege
66
+ category
67
+ description
68
+ }
69
+ total
70
+ }
71
+ }
72
+ `
73
+ }
@@ -24,7 +24,19 @@ interface ArgTypes {
24
24
 
25
25
  const Template: Story<ArgTypes> = ({ name = 'code', value = '' }: ArgTypes) => html`
26
26
  <link href="/themes/app-theme.css" rel="stylesheet" />
27
- <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
27
+ <link
28
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
29
+ rel="stylesheet"
30
+ />
31
+ <link
32
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
33
+ rel="stylesheet"
34
+ />
35
+ <link
36
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
37
+ rel="stylesheet"
38
+ />
39
+
28
40
  <style>
29
41
  body {
30
42
  }