@operato/app 1.19.10 → 1.19.13
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/filters-form/filter-code-select.d.ts +3 -0
- package/dist/src/filters-form/filter-code-select.js +6 -0
- package/dist/src/filters-form/filter-code-select.js.map +1 -0
- package/dist/src/filters-form/index.js +3 -0
- package/dist/src/filters-form/index.js.map +1 -1
- package/dist/src/filters-form/ox-input-code-filter.d.ts +17 -0
- package/dist/src/filters-form/ox-input-code-filter.js +137 -0
- package/dist/src/filters-form/ox-input-code-filter.js.map +1 -0
- package/dist/src/input/ox-input-graphql.js +10 -18
- package/dist/src/input/ox-input-graphql.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -9
- package/src/filters-form/filter-code-select.ts +9 -0
- package/src/filters-form/index.ts +3 -0
- package/src/filters-form/ox-input-code-filter.ts +154 -0
- package/src/input/ox-input-graphql.ts +11 -19
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": "1.19.
|
|
5
|
+
"version": "1.19.13",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
7
7
|
"module": "dist/src/index.js",
|
|
8
8
|
"exports": {
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"./grist-editor/ox-grist-editor-resource-object.js": "./dist/src/grist-editor/ox-grist-editor-resource-object.js",
|
|
29
29
|
"./grist-editor/ox-grist-editor-resource-object-legacy.js": "./dist/src/grist-editor/ox-grist-editor-resource-object-legacy.js",
|
|
30
30
|
"./grist-editor/ox-grist-editor-resource-code.js": "./dist/src/grist-editor/ox-grist-editor-resource-code.js",
|
|
31
|
+
"./filters-form/filter-code-select.js": "./dist/src/filters-form/filter-code-select.js",
|
|
31
32
|
"./filter-renderer.js": "./dist/src/filter-renderer/index.js",
|
|
32
33
|
"./filters-form.js": "./dist/src/filters-form/index.js"
|
|
33
34
|
},
|
|
@@ -96,6 +97,12 @@
|
|
|
96
97
|
"grist-editor/ox-grist-editor-resource-code.js": [
|
|
97
98
|
"dist/src/grist-editor/ox-grist-editor-resource-code.d.ts"
|
|
98
99
|
],
|
|
100
|
+
"filters-form/filter-code-select.js": [
|
|
101
|
+
"./dist/src/filters-form/filter-code-select.d.ts"
|
|
102
|
+
],
|
|
103
|
+
"filters-form.js": [
|
|
104
|
+
"dist/src/filters-form/index.d.ts"
|
|
105
|
+
],
|
|
99
106
|
"filter-renderer.js": [
|
|
100
107
|
"dist/src/filter-renderer/index.d.ts"
|
|
101
108
|
]
|
|
@@ -132,19 +139,21 @@
|
|
|
132
139
|
"@codemirror/theme-one-dark": "^6.1.2",
|
|
133
140
|
"@codemirror/view": "^6.22.1",
|
|
134
141
|
"@graphql-tools/delegate": "^10.0.1",
|
|
135
|
-
"@graphql-tools/
|
|
142
|
+
"@graphql-tools/load": "^8.0.12",
|
|
143
|
+
"@graphql-tools/schema": "^10.0.16",
|
|
144
|
+
"@graphql-tools/url-loader": "^8.0.24",
|
|
136
145
|
"@material/mwc-button": "^0.27.0",
|
|
137
146
|
"@material/mwc-icon": "^0.27.0",
|
|
138
147
|
"@material/mwc-icon-button": "^0.27.0",
|
|
139
|
-
"@operato/attachment": "^1.19.
|
|
140
|
-
"@operato/data-grist": "^1.19.
|
|
141
|
-
"@operato/font": "^1.19.
|
|
148
|
+
"@operato/attachment": "^1.19.13",
|
|
149
|
+
"@operato/data-grist": "^1.19.13",
|
|
150
|
+
"@operato/font": "^1.19.13",
|
|
142
151
|
"@operato/form": "^1.19.10",
|
|
143
152
|
"@operato/graphql": "^1.19.10",
|
|
144
153
|
"@operato/i18n": "^1.19.10",
|
|
145
|
-
"@operato/input": "^1.19.
|
|
146
|
-
"@operato/layout": "^1.19.
|
|
147
|
-
"@operato/property-editor": "^1.19.
|
|
154
|
+
"@operato/input": "^1.19.13",
|
|
155
|
+
"@operato/layout": "^1.19.13",
|
|
156
|
+
"@operato/property-editor": "^1.19.13",
|
|
148
157
|
"@operato/shell": "^1.19.10",
|
|
149
158
|
"@operato/styles": "^1.19.10",
|
|
150
159
|
"@operato/utils": "^1.19.10",
|
|
@@ -189,5 +198,5 @@
|
|
|
189
198
|
"prettier --write"
|
|
190
199
|
]
|
|
191
200
|
},
|
|
192
|
-
"gitHead": "
|
|
201
|
+
"gitHead": "20b4eee2566c09eee30456483155e8d3ac7445d5"
|
|
193
202
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import './ox-input-code-filter.js'
|
|
2
|
+
|
|
3
|
+
import { html } from 'lit-html'
|
|
4
|
+
|
|
5
|
+
import { FilterSelectRenderer } from '@operato/data-grist'
|
|
6
|
+
|
|
7
|
+
export const FilterCodeSelect: FilterSelectRenderer = (column, value, owner) => {
|
|
8
|
+
return html` <ox-input-code-filter name=${column?.name} .column=${column} .value=${value}></ox-input-code-filter> `
|
|
9
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { registerFilterRenderer } from '@operato/form'
|
|
2
|
+
import { registerFilterRenderer as dataGristFiltersRenderer } from '@operato/data-grist'
|
|
2
3
|
|
|
3
4
|
import { FilterResourceSelect } from './filter-resource-select.js'
|
|
5
|
+
import { FilterCodeSelect } from './filter-code-select.js'
|
|
4
6
|
|
|
5
7
|
registerFilterRenderer('resource-object', [FilterResourceSelect])
|
|
6
8
|
registerFilterRenderer('resource-id', [FilterResourceSelect])
|
|
9
|
+
dataGristFiltersRenderer('code', [FilterCodeSelect])
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import '@operato/input/ox-select.js'
|
|
2
|
+
|
|
3
|
+
import gql from 'graphql-tag'
|
|
4
|
+
import { css, html } from 'lit'
|
|
5
|
+
import { customElement, property, state } from 'lit/decorators.js'
|
|
6
|
+
|
|
7
|
+
import { i18next } from '@operato/i18n'
|
|
8
|
+
import { FilterConfigObject } from '@operato/data-grist'
|
|
9
|
+
import { client, gqlContext } from '@operato/graphql'
|
|
10
|
+
import { OxFormField } from '@operato/input'
|
|
11
|
+
|
|
12
|
+
type CommonCodeDetail = {
|
|
13
|
+
name: string
|
|
14
|
+
description: string
|
|
15
|
+
rank: number
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const FETCH_COMMON_CODE_GQL = (codeName: string) => gql`
|
|
19
|
+
{
|
|
20
|
+
commonCode(name: "${codeName}") {
|
|
21
|
+
details {
|
|
22
|
+
name
|
|
23
|
+
description
|
|
24
|
+
rank
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`
|
|
29
|
+
|
|
30
|
+
@customElement('ox-input-code-filter')
|
|
31
|
+
export class OxInputCodeFilter extends OxFormField {
|
|
32
|
+
static styles = css`
|
|
33
|
+
:host {
|
|
34
|
+
min-width: 100px;
|
|
35
|
+
}
|
|
36
|
+
`
|
|
37
|
+
|
|
38
|
+
@property({ type: Object }) column: any
|
|
39
|
+
@property({ type: String }) value?: string
|
|
40
|
+
|
|
41
|
+
@state() codes: CommonCodeDetail[] = []
|
|
42
|
+
|
|
43
|
+
render() {
|
|
44
|
+
const { name, filter } = this.column
|
|
45
|
+
const operator = (filter as FilterConfigObject).operator
|
|
46
|
+
const { selectDispOpt = 'code-name' } = this.column.record || {}
|
|
47
|
+
|
|
48
|
+
if (!this.codes || this.codes.length === 0) {
|
|
49
|
+
return html`<p>Loading...</p>`
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return operator === 'in'
|
|
53
|
+
? html`
|
|
54
|
+
<ox-select
|
|
55
|
+
.value=${this.value}
|
|
56
|
+
@change=${(e: CustomEvent) => {
|
|
57
|
+
let val = e.detail
|
|
58
|
+
this.value = val?.length > 0 ? val : undefined
|
|
59
|
+
|
|
60
|
+
this?.dispatchEvent(
|
|
61
|
+
new CustomEvent('change', {
|
|
62
|
+
detail: {
|
|
63
|
+
name,
|
|
64
|
+
operator,
|
|
65
|
+
value: this.value
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
)
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<ox-popup-list multiple attr-selected="checked" with-search align-left>
|
|
72
|
+
<ox-checkbox
|
|
73
|
+
checkAll
|
|
74
|
+
@click=${(e: any) => {
|
|
75
|
+
const checked = e.target.checked
|
|
76
|
+
const val = checked ? this.codes!.map((code: CommonCodeDetail) => code.name) : []
|
|
77
|
+
|
|
78
|
+
e.target?.dispatchEvent(new CustomEvent('select', { bubbles: true, detail: val }))
|
|
79
|
+
}}
|
|
80
|
+
>${i18next.t('label.all')}</ox-checkbox
|
|
81
|
+
>
|
|
82
|
+
${this.codes
|
|
83
|
+
?.filter((code: CommonCodeDetail) => !!code.name)
|
|
84
|
+
.map(
|
|
85
|
+
(code: CommonCodeDetail) => html`
|
|
86
|
+
<ox-checkbox
|
|
87
|
+
option
|
|
88
|
+
value=${code.name}
|
|
89
|
+
@change=${(e: any) => {
|
|
90
|
+
const parent = e.target.parentElement
|
|
91
|
+
const checkCnt = e.target.checked ? 1 : -1
|
|
92
|
+
const checkedLen = parent.querySelectorAll('ox-checkbox[option][checked]').length + checkCnt
|
|
93
|
+
|
|
94
|
+
parent.querySelector('ox-checkbox[checkAll]').checked =
|
|
95
|
+
this.codes.filter((code: CommonCodeDetail) => !!code.name).length === checkedLen
|
|
96
|
+
}}
|
|
97
|
+
>${selectDispOpt.replace('name', code.description).replace('code', code.name)}</ox-checkbox
|
|
98
|
+
>
|
|
99
|
+
`
|
|
100
|
+
)}
|
|
101
|
+
</ox-popup-list>
|
|
102
|
+
</ox-select>
|
|
103
|
+
`
|
|
104
|
+
: html`
|
|
105
|
+
<ox-select
|
|
106
|
+
.value=${this.value}
|
|
107
|
+
@change=${(e: CustomEvent) => {
|
|
108
|
+
this.value = e.detail
|
|
109
|
+
this.dispatchEvent(
|
|
110
|
+
new CustomEvent('change', {
|
|
111
|
+
detail: {
|
|
112
|
+
name,
|
|
113
|
+
operator,
|
|
114
|
+
value: this.value
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
)
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
<ox-popup-list with-search>
|
|
121
|
+
<div option value=""> </div>
|
|
122
|
+
${this.codes?.map(
|
|
123
|
+
(code: CommonCodeDetail) => html`
|
|
124
|
+
<div option value=${code.name}>
|
|
125
|
+
${selectDispOpt.replace('name', code.description).replace('code', code.name)}
|
|
126
|
+
</div>
|
|
127
|
+
`
|
|
128
|
+
)}
|
|
129
|
+
</ox-popup-list>
|
|
130
|
+
</ox-select>
|
|
131
|
+
`
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async fetchCodes() {
|
|
135
|
+
const { codeName } = this.column.record || {}
|
|
136
|
+
|
|
137
|
+
if (codeName) {
|
|
138
|
+
const response = await client.query({
|
|
139
|
+
query: FETCH_COMMON_CODE_GQL(codeName),
|
|
140
|
+
context: gqlContext()
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
this.codes = response?.data?.commonCode.details || []
|
|
144
|
+
|
|
145
|
+
this.requestUpdate()
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
connectedCallback() {
|
|
150
|
+
super.connectedCallback()
|
|
151
|
+
|
|
152
|
+
this.fetchCodes()
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { fetch } from 'cross-fetch'
|
|
6
|
-
import { print } from 'graphql'
|
|
7
5
|
import { css, html, PropertyValues } from 'lit'
|
|
8
6
|
import { customElement, property, query } from 'lit/decorators.js'
|
|
9
7
|
import { graphql } from 'cm6-graphql'
|
|
@@ -14,7 +12,9 @@ import { bracketMatching, syntaxHighlighting } from '@codemirror/language'
|
|
|
14
12
|
import { oneDarkHighlightStyle, oneDark } from '@codemirror/theme-one-dark'
|
|
15
13
|
import { EditorView, highlightActiveLine, keymap } from '@codemirror/view'
|
|
16
14
|
|
|
17
|
-
import {
|
|
15
|
+
import { makeExecutableSchema } from '@graphql-tools/schema'
|
|
16
|
+
import { loadSchema } from '@graphql-tools/load'
|
|
17
|
+
import { UrlLoader } from '@graphql-tools/url-loader'
|
|
18
18
|
import { GRAPHQL_URI } from '@operato/graphql'
|
|
19
19
|
import { OxFormField } from '@operato/input'
|
|
20
20
|
import { togglefullscreen } from '@operato/utils'
|
|
@@ -66,24 +66,16 @@ export default class OxInputGraphql extends OxFormField {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
async getSchema() {
|
|
69
|
-
const
|
|
70
|
-
const query = print(document)
|
|
71
|
-
const uri = this.link || GRAPHQL_URI
|
|
72
|
-
|
|
73
|
-
const fetchResult = await fetch(uri, {
|
|
74
|
-
method: 'POST',
|
|
75
|
-
headers: {
|
|
76
|
-
'Content-Type': 'application/json'
|
|
77
|
-
},
|
|
78
|
-
body: JSON.stringify({ query, variables })
|
|
79
|
-
})
|
|
80
|
-
return fetchResult.json()
|
|
81
|
-
}
|
|
69
|
+
const uri = this.link || GRAPHQL_URI
|
|
82
70
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
71
|
+
const schema = await loadSchema(uri, {
|
|
72
|
+
loaders: [new UrlLoader()],
|
|
73
|
+
headers: {
|
|
74
|
+
'Content-Type': 'application/json'
|
|
75
|
+
}
|
|
86
76
|
})
|
|
77
|
+
|
|
78
|
+
return makeExecutableSchema({ typeDefs: schema, resolvers: {} })
|
|
87
79
|
}
|
|
88
80
|
|
|
89
81
|
async getEditor() {
|