@operato/app 1.19.9 → 1.19.12
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/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -14
- 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/tsconfig.json +1 -0
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.12",
|
|
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
|
]
|
|
@@ -136,18 +143,18 @@
|
|
|
136
143
|
"@material/mwc-button": "^0.27.0",
|
|
137
144
|
"@material/mwc-icon": "^0.27.0",
|
|
138
145
|
"@material/mwc-icon-button": "^0.27.0",
|
|
139
|
-
"@operato/attachment": "^1.19.
|
|
140
|
-
"@operato/data-grist": "^1.19.
|
|
141
|
-
"@operato/font": "^1.19.
|
|
142
|
-
"@operato/form": "^1.19.
|
|
143
|
-
"@operato/graphql": "^1.19.
|
|
144
|
-
"@operato/i18n": "^1.
|
|
145
|
-
"@operato/input": "^1.19.
|
|
146
|
-
"@operato/layout": "^1.19.
|
|
147
|
-
"@operato/property-editor": "^1.19.
|
|
148
|
-
"@operato/shell": "^1.19.
|
|
149
|
-
"@operato/styles": "^1.
|
|
150
|
-
"@operato/utils": "^1.19.
|
|
146
|
+
"@operato/attachment": "^1.19.10",
|
|
147
|
+
"@operato/data-grist": "^1.19.10",
|
|
148
|
+
"@operato/font": "^1.19.10",
|
|
149
|
+
"@operato/form": "^1.19.10",
|
|
150
|
+
"@operato/graphql": "^1.19.10",
|
|
151
|
+
"@operato/i18n": "^1.19.10",
|
|
152
|
+
"@operato/input": "^1.19.10",
|
|
153
|
+
"@operato/layout": "^1.19.10",
|
|
154
|
+
"@operato/property-editor": "^1.19.10",
|
|
155
|
+
"@operato/shell": "^1.19.10",
|
|
156
|
+
"@operato/styles": "^1.19.10",
|
|
157
|
+
"@operato/utils": "^1.19.10",
|
|
151
158
|
"cm6-graphql": "^0.0.12",
|
|
152
159
|
"codemirror": "^6.0.1",
|
|
153
160
|
"cronstrue": "^2.2.0",
|
|
@@ -189,5 +196,5 @@
|
|
|
189
196
|
"prettier --write"
|
|
190
197
|
]
|
|
191
198
|
},
|
|
192
|
-
"gitHead": "
|
|
199
|
+
"gitHead": "79699426eaf4d1b0d476385e44dff8f5f57ff2a7"
|
|
193
200
|
}
|
|
@@ -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
|
+
}
|