@operato/app 1.0.0-beta.11 → 1.0.0-beta.14
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 +29 -0
- package/dist/src/filters-form/filter-resource-select.d.ts +4 -0
- package/dist/src/filters-form/filter-resource-select.js +78 -0
- package/dist/src/filters-form/filter-resource-select.js.map +1 -0
- package/dist/src/filters-form/index.d.ts +1 -0
- package/dist/src/filters-form/index.js +5 -0
- package/dist/src/filters-form/index.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-renderer-resource-id.js +5 -2
- package/dist/src/grist-editor/ox-grist-renderer-resource-id.js.map +1 -1
- package/dist/src/grist-editor/ox-popup-partition-keys-input.js +3 -2
- package/dist/src/grist-editor/ox-popup-partition-keys-input.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -16
- package/src/filters-form/filter-resource-select.ts +94 -0
- package/src/filters-form/index.ts +6 -0
- package/src/grist-editor/ox-grist-renderer-resource-id.ts +6 -2
- package/src/grist-editor/ox-popup-partition-keys-input.ts +3 -2
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "WebApplication production supporting components following open-wc recommendations",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "heartyoh",
|
|
6
|
-
"version": "1.0.0-beta.
|
|
6
|
+
"version": "1.0.0-beta.14",
|
|
7
7
|
"main": "dist/src/index.js",
|
|
8
8
|
"module": "dist/src/index.js",
|
|
9
9
|
"exports": {
|
|
@@ -59,18 +59,18 @@
|
|
|
59
59
|
"@material/mwc-button": "^0.25.3",
|
|
60
60
|
"@material/mwc-icon": "^0.25.3",
|
|
61
61
|
"@material/mwc-icon-button": "^0.25.3",
|
|
62
|
-
"@operato/attachment": "^1.0.0-beta.
|
|
63
|
-
"@operato/data-grist": "^1.0.0-beta.
|
|
64
|
-
"@operato/font": "^1.0.0-beta.
|
|
65
|
-
"@operato/form": "^1.0.0-beta.
|
|
66
|
-
"@operato/graphql": "^1.0.0-beta.
|
|
67
|
-
"@operato/i18n": "^1.0.0-beta.
|
|
68
|
-
"@operato/input": "^1.0.0-beta.
|
|
69
|
-
"@operato/layout": "^1.0.0-beta.
|
|
70
|
-
"@operato/property-editor": "^1.0.0-beta.
|
|
71
|
-
"@operato/shell": "^1.0.0-beta.
|
|
72
|
-
"@operato/styles": "^1.0.0-beta.
|
|
73
|
-
"@operato/utils": "^1.0.0-beta.
|
|
62
|
+
"@operato/attachment": "^1.0.0-beta.14",
|
|
63
|
+
"@operato/data-grist": "^1.0.0-beta.14",
|
|
64
|
+
"@operato/font": "^1.0.0-beta.14",
|
|
65
|
+
"@operato/form": "^1.0.0-beta.14",
|
|
66
|
+
"@operato/graphql": "^1.0.0-beta.14",
|
|
67
|
+
"@operato/i18n": "^1.0.0-beta.14",
|
|
68
|
+
"@operato/input": "^1.0.0-beta.14",
|
|
69
|
+
"@operato/layout": "^1.0.0-beta.14",
|
|
70
|
+
"@operato/property-editor": "^1.0.0-beta.14",
|
|
71
|
+
"@operato/shell": "^1.0.0-beta.14",
|
|
72
|
+
"@operato/styles": "^1.0.0-beta.14",
|
|
73
|
+
"@operato/utils": "^1.0.0-beta.14",
|
|
74
74
|
"codemirror": "^5.59.1",
|
|
75
75
|
"codemirror-graphql": "^0.15.2",
|
|
76
76
|
"cronstrue": "^2.2.0",
|
|
@@ -87,12 +87,12 @@
|
|
|
87
87
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
88
88
|
"@typescript-eslint/parser": "^4.33.0",
|
|
89
89
|
"@web/dev-server": "^0.1.29",
|
|
90
|
-
"@web/dev-server-storybook": "
|
|
90
|
+
"@web/dev-server-storybook": "^0.5.0",
|
|
91
91
|
"@web/test-runner": "next",
|
|
92
92
|
"concurrently": "^5.3.0",
|
|
93
93
|
"eslint": "^7.32.0",
|
|
94
94
|
"eslint-config-prettier": "^8.3.0",
|
|
95
|
-
"husky": "^
|
|
95
|
+
"husky": "^7.0.2",
|
|
96
96
|
"lint-staged": "^10.5.4",
|
|
97
97
|
"prettier": "^2.4.1",
|
|
98
98
|
"tslib": "^2.3.1",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"prettier --write"
|
|
112
112
|
]
|
|
113
113
|
},
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "80963937b40ceba3615f3dd6e3353a033f9d14ec"
|
|
115
115
|
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import '@operato/input/ox-checkbox.js'
|
|
2
|
+
import '../grist-editor/ox-selector-resource-id'
|
|
3
|
+
|
|
4
|
+
import { html } from 'lit-html'
|
|
5
|
+
|
|
6
|
+
import { FilterConfig, FilterSelectRenderer } from '@operato/form'
|
|
7
|
+
import { i18next } from '@operato/i18n'
|
|
8
|
+
import { openPopup } from '@operato/layout'
|
|
9
|
+
|
|
10
|
+
type SelectedCallback = (value: { id: string; name: string; description: string }) => void
|
|
11
|
+
|
|
12
|
+
function openResourceSelector(filter: FilterConfig, value: any, confirmCallback: SelectedCallback) {
|
|
13
|
+
const { queryName, select, list, basicArgs, valueField = 'id' } = filter.options || {}
|
|
14
|
+
|
|
15
|
+
var actualValue
|
|
16
|
+
if (typeof valueField === 'function') {
|
|
17
|
+
actualValue = valueField(value)
|
|
18
|
+
} else {
|
|
19
|
+
actualValue = value?.[valueField]
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var template = html`
|
|
23
|
+
<ox-selector-resource-id
|
|
24
|
+
.value=${actualValue}
|
|
25
|
+
.confirmCallback=${confirmCallback}
|
|
26
|
+
.queryName=${queryName}
|
|
27
|
+
.select=${select}
|
|
28
|
+
.list=${list}
|
|
29
|
+
.basicArgs=${basicArgs}
|
|
30
|
+
.valueField=${valueField}
|
|
31
|
+
></ox-selector-resource-id>
|
|
32
|
+
`
|
|
33
|
+
|
|
34
|
+
const popup = openPopup(template, {
|
|
35
|
+
backdrop: true,
|
|
36
|
+
size: 'large',
|
|
37
|
+
title: i18next.t('title.select_item')
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const FilterResourceSelect: FilterSelectRenderer = (filter, value, owner) => {
|
|
42
|
+
const { name, operator = 'like' } = filter
|
|
43
|
+
|
|
44
|
+
return operator === 'like'
|
|
45
|
+
? html` <input
|
|
46
|
+
type="text"
|
|
47
|
+
name=${name}
|
|
48
|
+
.value=${value}
|
|
49
|
+
@change=${(e: CustomEvent) => {
|
|
50
|
+
const input = e.target as HTMLInputElement
|
|
51
|
+
input.dispatchEvent(
|
|
52
|
+
new CustomEvent('filter-change', {
|
|
53
|
+
bubbles: true,
|
|
54
|
+
composed: true,
|
|
55
|
+
detail: {
|
|
56
|
+
name,
|
|
57
|
+
operator,
|
|
58
|
+
value: input.value
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
)
|
|
62
|
+
}}
|
|
63
|
+
/>`
|
|
64
|
+
: operator == 'in'
|
|
65
|
+
? html``
|
|
66
|
+
: operator === 'eq'
|
|
67
|
+
? html`
|
|
68
|
+
<input
|
|
69
|
+
style="min-width: 100px; min-height: 24px"
|
|
70
|
+
type="text"
|
|
71
|
+
name=${name}
|
|
72
|
+
.value=${value}
|
|
73
|
+
readonly
|
|
74
|
+
@click=${(e: Event) => {
|
|
75
|
+
e.stopPropagation()
|
|
76
|
+
|
|
77
|
+
const confirmCallback = (selected?: { [field: string]: any }) => {
|
|
78
|
+
var { idField = 'id', nameField = 'name', descriptionField = 'description' } = filter.options || {}
|
|
79
|
+
|
|
80
|
+
owner.dispatchEvent(
|
|
81
|
+
new CustomEvent('filter-change', {
|
|
82
|
+
bubbles: true,
|
|
83
|
+
composed: true,
|
|
84
|
+
detail: selected ? selected[idField] : ''
|
|
85
|
+
})
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
openResourceSelector(filter, value, confirmCallback)
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
`
|
|
93
|
+
: html``
|
|
94
|
+
}
|
|
@@ -7,7 +7,11 @@ export const OxGristRendererResourceId: FieldRenderer = (value, column, record,
|
|
|
7
7
|
return ''
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const { nameField = 'name', descriptionField = 'description' } = column.record.options || {}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const name = value[nameField] || ''
|
|
13
|
+
const description = value[descriptionField] || ''
|
|
14
|
+
const suffix = description ? `(${description})` : ''
|
|
15
|
+
|
|
16
|
+
return html`<span>${name}${suffix}</span> `
|
|
13
17
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import '@operato/input/ox-input-partition-keys.js'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { css, html, LitElement } from 'lit'
|
|
4
4
|
import { customElement, property } from 'lit/decorators.js'
|
|
5
5
|
|
|
6
|
-
import { ScrollbarStyles } from '@operato/styles'
|
|
7
6
|
import { i18next } from '@operato/i18n'
|
|
7
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
8
8
|
|
|
9
9
|
@customElement('ox-popup-partition-keys-input')
|
|
10
10
|
export class OxPopupPartitionKeysInput extends LitElement {
|
|
@@ -24,6 +24,7 @@ export class OxPopupPartitionKeysInput extends LitElement {
|
|
|
24
24
|
ox-input-partition-keys {
|
|
25
25
|
flex: 1;
|
|
26
26
|
overflow-y: auto;
|
|
27
|
+
padding: 10px;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
span {
|