@operato/app 1.0.0-beta.9 → 1.0.2
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 +379 -0
- package/demo/data-grist-test.html +1 -1
- 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/index.js +1 -9
- package/dist/src/grist-editor/index.js.map +1 -1
- package/dist/src/grist-editor/ox-grist-editor-resource-object-legacy.d.ts +10 -0
- package/dist/src/grist-editor/ox-grist-editor-resource-object-legacy.js +99 -0
- package/dist/src/grist-editor/ox-grist-editor-resource-object-legacy.js.map +1 -0
- package/dist/src/grist-editor/ox-grist-editor-resource-object.d.ts +0 -1
- package/dist/src/grist-editor/ox-grist-editor-resource-object.js +10 -13
- package/dist/src/grist-editor/ox-grist-editor-resource-object.js.map +1 -1
- package/dist/src/grist-editor/ox-grist-renderer-crontab.js +3 -3
- package/dist/src/grist-editor/ox-grist-renderer-crontab.js.map +1 -1
- 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-code-input.js +5 -4
- package/dist/src/grist-editor/ox-popup-code-input.js.map +1 -1
- package/dist/src/grist-editor/ox-selector-resource-id.js +5 -4
- package/dist/src/grist-editor/ox-selector-resource-id.js.map +1 -1
- package/dist/src/grist-editor/ox-selector-resource-object-adv.d.ts +36 -0
- package/dist/src/grist-editor/ox-selector-resource-object-adv.js +270 -0
- package/dist/src/grist-editor/ox-selector-resource-object-adv.js.map +1 -0
- package/dist/src/grist-editor/ox-selector-resource-object-legacy.d.ts +39 -0
- package/dist/src/grist-editor/ox-selector-resource-object-legacy.js +351 -0
- package/dist/src/grist-editor/ox-selector-resource-object-legacy.js.map +1 -0
- package/dist/src/grist-editor/ox-selector-resource-object.d.ts +3 -8
- package/dist/src/grist-editor/ox-selector-resource-object.js +76 -152
- package/dist/src/grist-editor/ox-selector-resource-object.js.map +1 -1
- package/dist/src/input/ox-input-background-pattern.d.ts +3 -0
- package/dist/src/input/ox-input-background-pattern.js +35 -7
- package/dist/src/input/ox-input-background-pattern.js.map +1 -1
- package/dist/src/input/ox-input-fill-style.d.ts +4 -2
- package/dist/src/input/ox-input-fill-style.js +13 -7
- package/dist/src/input/ox-input-fill-style.js.map +1 -1
- package/dist/src/input/ox-input-graphql.d.ts +1 -1
- package/dist/src/input/ox-input-graphql.js +7 -7
- package/dist/src/input/ox-input-graphql.js.map +1 -1
- package/dist/src/property-editor/index.d.ts +2 -1
- package/dist/src/property-editor/index.js +5 -2
- package/dist/src/property-editor/index.js.map +1 -1
- package/dist/src/property-editor/ox-property-editor-graphql.d.ts +2 -2
- package/dist/src/property-editor/ox-property-editor-graphql.js +4 -4
- package/dist/src/property-editor/ox-property-editor-graphql.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +25 -30
- package/src/filters-form/filter-resource-select.ts +94 -0
- package/src/filters-form/index.ts +6 -0
- package/src/grist-editor/index.ts +1 -9
- package/src/grist-editor/ox-grist-editor-resource-object-legacy.ts +123 -0
- package/src/grist-editor/ox-grist-editor-resource-object.ts +22 -14
- package/src/grist-editor/ox-grist-renderer-crontab.ts +5 -4
- package/src/grist-editor/ox-grist-renderer-resource-id.ts +6 -2
- package/src/grist-editor/ox-popup-code-input.ts +5 -4
- package/src/grist-editor/ox-selector-resource-id.ts +5 -4
- package/src/grist-editor/ox-selector-resource-object-legacy.ts +360 -0
- package/src/grist-editor/ox-selector-resource-object.ts +76 -166
- package/src/input/ox-input-background-pattern.ts +37 -7
- package/src/input/ox-input-fill-style.ts +18 -8
- package/src/input/ox-input-graphql.ts +8 -8
- package/src/property-editor/index.ts +5 -2
- package/src/property-editor/ox-property-editor-graphql.ts +5 -4
- package/dist/src/grist-editor/ox-grist-editor-crontab.d.ts +0 -8
- package/dist/src/grist-editor/ox-grist-editor-crontab.js +0 -50
- package/dist/src/grist-editor/ox-grist-editor-crontab.js.map +0 -1
- package/dist/src/grist-editor/ox-grist-editor-parameters.d.ts +0 -12
- package/dist/src/grist-editor/ox-grist-editor-parameters.js +0 -84
- package/dist/src/grist-editor/ox-grist-editor-parameters.js.map +0 -1
- package/dist/src/grist-editor/ox-grist-editor-partition-keys.d.ts +0 -11
- package/dist/src/grist-editor/ox-grist-editor-partition-keys.js +0 -74
- package/dist/src/grist-editor/ox-grist-editor-partition-keys.js.map +0 -1
- package/dist/src/grist-editor/ox-grist-editor-value-map.d.ts +0 -11
- package/dist/src/grist-editor/ox-grist-editor-value-map.js +0 -74
- package/dist/src/grist-editor/ox-grist-editor-value-map.js.map +0 -1
- package/dist/src/grist-editor/ox-parameters-builder.d.ts +0 -4
- package/dist/src/grist-editor/ox-parameters-builder.js +0 -118
- package/dist/src/grist-editor/ox-parameters-builder.js.map +0 -1
- package/dist/src/grist-editor/ox-popup-crontab-input.d.ts +0 -11
- package/dist/src/grist-editor/ox-popup-crontab-input.js +0 -74
- package/dist/src/grist-editor/ox-popup-crontab-input.js.map +0 -1
- package/dist/src/grist-editor/ox-popup-parameters-builder.d.ts +0 -13
- package/dist/src/grist-editor/ox-popup-parameters-builder.js +0 -111
- package/dist/src/grist-editor/ox-popup-parameters-builder.js.map +0 -1
- package/dist/src/grist-editor/ox-popup-partition-keys-input.d.ts +0 -12
- package/dist/src/grist-editor/ox-popup-partition-keys-input.js +0 -98
- package/dist/src/grist-editor/ox-popup-partition-keys-input.js.map +0 -1
- package/dist/src/grist-editor/ox-popup-value-map-input.d.ts +0 -12
- package/dist/src/grist-editor/ox-popup-value-map-input.js +0 -104
- package/dist/src/grist-editor/ox-popup-value-map-input.js.map +0 -1
- package/src/grist-editor/ox-grist-editor-crontab.ts +0 -62
- package/src/grist-editor/ox-grist-editor-parameters.ts +0 -99
- package/src/grist-editor/ox-grist-editor-partition-keys.ts +0 -86
- package/src/grist-editor/ox-grist-editor-value-map.ts +0 -86
- package/src/grist-editor/ox-parameters-builder.ts +0 -128
- package/src/grist-editor/ox-popup-crontab-input.ts +0 -74
- package/src/grist-editor/ox-popup-parameters-builder.ts +0 -106
- package/src/grist-editor/ox-popup-partition-keys-input.ts +0 -95
- package/src/grist-editor/ox-popup-value-map-input.ts +0 -101
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.
|
|
6
|
+
"version": "1.0.2",
|
|
7
7
|
"main": "dist/src/index.js",
|
|
8
8
|
"module": "dist/src/index.js",
|
|
9
9
|
"exports": {
|
|
@@ -20,15 +20,12 @@
|
|
|
20
20
|
"./grist-editor/ox-grist-renderer-resource-id.js": "./dist/src/grist-editor/ox-grist-renderer-resource-id.js",
|
|
21
21
|
"./grist-editor/ox-selector-resource-object.js": "./dist/src/grist-editor/ox-selector-resource-object.js",
|
|
22
22
|
"./grist-editor/ox-grist-renderer-resource-object.js": "./dist/src/grist-editor/ox-grist-renderer-resource-object.js",
|
|
23
|
-
"./grist-editor/ox-grist-editor-crontab.js": "./dist/src/grist-editor/ox-grist-editor-crontab.js",
|
|
24
23
|
"./grist-editor/ox-grist-renderer-crontab.js": "./dist/src/grist-editor/ox-grist-renderer-crontab.js",
|
|
25
24
|
"./grist-editor/ox-grist-editor-json.js": "./dist/src/grist-editor/ox-grist-editor-json.js",
|
|
26
25
|
"./grist-editor/ox-grist-editor-code.js": "./dist/src/grist-editor/ox-grist-editor-code.js",
|
|
27
26
|
"./grist-editor/ox-grist-editor-resource-object.js": "./dist/src/grist-editor/ox-grist-editor-resource-object.js",
|
|
27
|
+
"./grist-editor/ox-grist-editor-resource-object-legacy.js": "./dist/src/grist-editor/ox-grist-editor-resource-object-legacy.js",
|
|
28
28
|
"./grist-editor/ox-grist-editor-resource-code.js": "./dist/src/grist-editor/ox-grist-editor-resource-code.js",
|
|
29
|
-
"./grist-editor/ox-grist-editor-parameters.js": "./dist/src/grist-editor/ox-grist-editor-parameters.js",
|
|
30
|
-
"./grist-editor/ox-grist-editor-value-map.js": "./dist/src/grist-editor/ox-grist-editor-value-map.js",
|
|
31
|
-
"./grist-editor/ox-grist-editor-partition-keys.js": "./dist/src/grist-editor/ox-grist-editor-partition-keys.js",
|
|
32
29
|
"./filter-renderer.js": "./dist/src/filter-renderer/index.js"
|
|
33
30
|
},
|
|
34
31
|
"publishConfig": {
|
|
@@ -53,31 +50,29 @@
|
|
|
53
50
|
"storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook"
|
|
54
51
|
},
|
|
55
52
|
"dependencies": {
|
|
56
|
-
"@graphql-tools/
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"@material/mwc-button": "^0.
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
62
|
-
"@operato/
|
|
63
|
-
"@operato/
|
|
64
|
-
"@operato/
|
|
65
|
-
"@operato/
|
|
66
|
-
"@operato/
|
|
67
|
-
"@operato/
|
|
68
|
-
"@operato/
|
|
69
|
-
"@operato/
|
|
70
|
-
"@operato/
|
|
71
|
-
"@operato/
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"codemirror": "^5.59.1",
|
|
75
|
-
"codemirror-graphql": "^0.15.2",
|
|
53
|
+
"@graphql-tools/wrap": "^8.5.0",
|
|
54
|
+
"@material/mwc-button": "^0.26.1",
|
|
55
|
+
"@material/mwc-icon": "^0.26.1",
|
|
56
|
+
"@material/mwc-icon-button": "^0.26.1",
|
|
57
|
+
"@operato/attachment": "^1.0.1",
|
|
58
|
+
"@operato/data-grist": "^1.0.1",
|
|
59
|
+
"@operato/font": "^1.0.1",
|
|
60
|
+
"@operato/form": "^1.0.1",
|
|
61
|
+
"@operato/graphql": "^1.0.0",
|
|
62
|
+
"@operato/i18n": "^1.0.0",
|
|
63
|
+
"@operato/input": "^1.0.1",
|
|
64
|
+
"@operato/layout": "^1.0.1",
|
|
65
|
+
"@operato/property-editor": "^1.0.1",
|
|
66
|
+
"@operato/shell": "^1.0.1",
|
|
67
|
+
"@operato/styles": "^1.0.0",
|
|
68
|
+
"@operato/utils": "^1.0.1",
|
|
69
|
+
"codemirror": "^5.64.0",
|
|
70
|
+
"codemirror-graphql": "^1.3.2",
|
|
76
71
|
"cronstrue": "^2.2.0",
|
|
77
72
|
"cross-fetch": "^3.1.5",
|
|
78
|
-
"graphql": "^
|
|
73
|
+
"graphql": "^16.5.0",
|
|
79
74
|
"graphql-tag": "^2.12.6",
|
|
80
|
-
"lit": "^2.2.
|
|
75
|
+
"lit": "^2.2.7"
|
|
81
76
|
},
|
|
82
77
|
"devDependencies": {
|
|
83
78
|
"@custom-elements-manifest/analyzer": "^0.4.17",
|
|
@@ -87,12 +82,12 @@
|
|
|
87
82
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
88
83
|
"@typescript-eslint/parser": "^4.33.0",
|
|
89
84
|
"@web/dev-server": "^0.1.29",
|
|
90
|
-
"@web/dev-server-storybook": "
|
|
85
|
+
"@web/dev-server-storybook": "^0.5.0",
|
|
91
86
|
"@web/test-runner": "next",
|
|
92
87
|
"concurrently": "^5.3.0",
|
|
93
88
|
"eslint": "^7.32.0",
|
|
94
89
|
"eslint-config-prettier": "^8.3.0",
|
|
95
|
-
"husky": "^
|
|
90
|
+
"husky": "^7.0.2",
|
|
96
91
|
"lint-staged": "^10.5.4",
|
|
97
92
|
"prettier": "^2.4.1",
|
|
98
93
|
"tslib": "^2.3.1",
|
|
@@ -111,5 +106,5 @@
|
|
|
111
106
|
"prettier --write"
|
|
112
107
|
]
|
|
113
108
|
},
|
|
114
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "dcd7b17f0019192e7c052bcf524acc2902e16367"
|
|
115
110
|
}
|
|
@@ -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
|
+
}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { OxGristRendererJson5, registerEditor, registerRenderer } from '@operato/data-grist'
|
|
2
2
|
|
|
3
|
-
import { OxGristEditorCrontab } from './ox-grist-editor-crontab.js'
|
|
4
3
|
import { OxGristEditorJson } from './ox-grist-editor-json.js'
|
|
5
|
-
import { OxGristEditorParameters } from './ox-grist-editor-parameters.js'
|
|
6
|
-
import { OxGristEditorPartitionKeys } from './ox-grist-editor-partition-keys.js'
|
|
7
4
|
import { OxGristEditorResourceCode } from './ox-grist-editor-resource-code.js'
|
|
8
5
|
import { OxGristEditorResourceId } from './ox-grist-editor-resource-id.js'
|
|
9
6
|
import { OxGristEditorResourceObject } from './ox-grist-editor-resource-object.js'
|
|
10
|
-
import {
|
|
11
|
-
import { OxGristRendererCrontab } from './ox-grist-renderer-crontab.js'
|
|
7
|
+
import { OxGristRendererCrontab } from './ox-grist-renderer-crontab'
|
|
12
8
|
import { OxGristRendererResourceId } from './ox-grist-renderer-resource-id.js'
|
|
13
9
|
import { OxGristRendererResourceObject } from './ox-grist-renderer-resource-object.js'
|
|
14
10
|
|
|
@@ -16,10 +12,6 @@ import { OxGristRendererResourceObject } from './ox-grist-renderer-resource-obje
|
|
|
16
12
|
registerEditor('resource-id', OxGristEditorResourceId)
|
|
17
13
|
registerEditor('resource-object', OxGristEditorResourceObject)
|
|
18
14
|
registerEditor('resource-code', OxGristEditorResourceCode)
|
|
19
|
-
registerEditor('parameters', OxGristEditorParameters)
|
|
20
|
-
registerEditor('value-map', OxGristEditorValueMap)
|
|
21
|
-
registerEditor('partition-keys', OxGristEditorPartitionKeys)
|
|
22
|
-
registerEditor('crontab', OxGristEditorCrontab)
|
|
23
15
|
registerEditor('json', OxGristEditorJson)
|
|
24
16
|
|
|
25
17
|
registerRenderer('resource-id', OxGristRendererResourceId)
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import './ox-selector-resource-object-legacy.js'
|
|
2
|
+
|
|
3
|
+
import { html, TemplateResult } from 'lit'
|
|
4
|
+
import { customElement } from 'lit/decorators.js'
|
|
5
|
+
|
|
6
|
+
import { OxGristEditor } from '@operato/data-grist'
|
|
7
|
+
import { i18next } from '@operato/i18n'
|
|
8
|
+
import { openPopup, PopupHandle } from '@operato/layout'
|
|
9
|
+
|
|
10
|
+
@customElement('ox-grist-editor-resource-object-legacy')
|
|
11
|
+
export class OxGristEditorResourceObjectLegacy extends OxGristEditor {
|
|
12
|
+
private popup?: PopupHandle
|
|
13
|
+
private template?: TemplateResult
|
|
14
|
+
|
|
15
|
+
get editorTemplate() {
|
|
16
|
+
var value = this.value || {}
|
|
17
|
+
|
|
18
|
+
var { nameField = 'name', descriptionField = 'description' } = this.column.record.options || {}
|
|
19
|
+
var name, description
|
|
20
|
+
if (typeof nameField === 'function') {
|
|
21
|
+
name = nameField(value)
|
|
22
|
+
} else {
|
|
23
|
+
name = value[nameField]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (typeof descriptionField === 'function') {
|
|
27
|
+
description = descriptionField(value)
|
|
28
|
+
} else {
|
|
29
|
+
description = value[descriptionField] && `(${value[descriptionField]})`
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return html` ${!value ? html`` : html` <span style="flex:1">${name || ''}${description || ''}</span> `} `
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async firstUpdated() {
|
|
36
|
+
this.template = ((this.column.record || {}).options || {}).template
|
|
37
|
+
|
|
38
|
+
await this.updateComplete
|
|
39
|
+
|
|
40
|
+
this.renderRoot.addEventListener('click', e => {
|
|
41
|
+
e.stopPropagation()
|
|
42
|
+
|
|
43
|
+
this.openSelector()
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
this.openSelector()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
openSelector() {
|
|
50
|
+
if (this.popup) {
|
|
51
|
+
delete this.popup
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
var {
|
|
55
|
+
idField = 'id',
|
|
56
|
+
nameField = 'name',
|
|
57
|
+
descriptionField = 'description',
|
|
58
|
+
valueField = 'id',
|
|
59
|
+
queryName,
|
|
60
|
+
basicArgs,
|
|
61
|
+
select,
|
|
62
|
+
list
|
|
63
|
+
} = this.column.record.options || {}
|
|
64
|
+
|
|
65
|
+
const confirmCallback = (selected?: { [field: string]: any }) => {
|
|
66
|
+
this.dispatchEvent(
|
|
67
|
+
new CustomEvent('field-change', {
|
|
68
|
+
bubbles: true,
|
|
69
|
+
composed: true,
|
|
70
|
+
detail: {
|
|
71
|
+
before: this.value,
|
|
72
|
+
after: selected
|
|
73
|
+
? {
|
|
74
|
+
...(this.column.record.options.select || [])
|
|
75
|
+
.map((field: any) => field.name)
|
|
76
|
+
.reduce((obj: { [field: string]: any }, fieldName: string) => {
|
|
77
|
+
return (obj = {
|
|
78
|
+
...obj,
|
|
79
|
+
[fieldName]: selected[fieldName]
|
|
80
|
+
})
|
|
81
|
+
}, {} as { [field: string]: any }),
|
|
82
|
+
[idField]: selected[idField],
|
|
83
|
+
[nameField]: selected[nameField],
|
|
84
|
+
[descriptionField]: selected[descriptionField]
|
|
85
|
+
}
|
|
86
|
+
: null,
|
|
87
|
+
record: this.record,
|
|
88
|
+
column: this.column,
|
|
89
|
+
row: this.row
|
|
90
|
+
}
|
|
91
|
+
})
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
var value = this.value || {}
|
|
96
|
+
var actualValue
|
|
97
|
+
if (typeof valueField === 'function') {
|
|
98
|
+
actualValue = valueField(value)
|
|
99
|
+
} else {
|
|
100
|
+
actualValue = value[valueField]
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
var template =
|
|
104
|
+
this.template ||
|
|
105
|
+
html`
|
|
106
|
+
<ox-selector-resource-object-legacy
|
|
107
|
+
.value=${actualValue}
|
|
108
|
+
.confirmCallback=${confirmCallback.bind(this)}
|
|
109
|
+
.queryName=${queryName}
|
|
110
|
+
.select=${select}
|
|
111
|
+
.list=${list}
|
|
112
|
+
.basicArgs=${basicArgs}
|
|
113
|
+
.valueField=${valueField}
|
|
114
|
+
></ox-selector-resource-object-legacy>
|
|
115
|
+
`
|
|
116
|
+
|
|
117
|
+
this.popup = openPopup(template, {
|
|
118
|
+
backdrop: true,
|
|
119
|
+
size: 'large',
|
|
120
|
+
title: i18next.t('title.select_item')
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import '@material/mwc-icon'
|
|
2
1
|
import './ox-selector-resource-object.js'
|
|
3
2
|
|
|
4
3
|
import { html, TemplateResult } from 'lit'
|
|
@@ -30,10 +29,7 @@ export class OxGristEditorResourceObject extends OxGristEditor {
|
|
|
30
29
|
description = value[descriptionField] && `(${value[descriptionField]})`
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
return html`
|
|
34
|
-
${!value ? html`` : html` <span>${name || ''}${description || ''}</span> `}
|
|
35
|
-
<mwc-icon>arrow_drop_down</mwc-icon>
|
|
36
|
-
`
|
|
32
|
+
return html` ${!value ? html`` : html` <span style="flex:1">${name || ''}${description || ''}</span> `} `
|
|
37
33
|
}
|
|
38
34
|
|
|
39
35
|
async firstUpdated() {
|
|
@@ -55,9 +51,22 @@ export class OxGristEditorResourceObject extends OxGristEditor {
|
|
|
55
51
|
delete this.popup
|
|
56
52
|
}
|
|
57
53
|
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
var {
|
|
55
|
+
idField = 'id',
|
|
56
|
+
nameField = 'name',
|
|
57
|
+
descriptionField = 'description',
|
|
58
|
+
valueField = 'id',
|
|
59
|
+
queryName,
|
|
60
|
+
basicArgs,
|
|
61
|
+
select,
|
|
62
|
+
columns,
|
|
63
|
+
list
|
|
64
|
+
} = this.column.record.options || {}
|
|
65
|
+
|
|
66
|
+
/* select options is only for compatability, it might be able to be deprecated. */
|
|
67
|
+
columns = columns || select
|
|
60
68
|
|
|
69
|
+
const confirmCallback = (selected?: { [field: string]: any }) => {
|
|
61
70
|
this.dispatchEvent(
|
|
62
71
|
new CustomEvent('field-change', {
|
|
63
72
|
bubbles: true,
|
|
@@ -66,7 +75,7 @@ export class OxGristEditorResourceObject extends OxGristEditor {
|
|
|
66
75
|
before: this.value,
|
|
67
76
|
after: selected
|
|
68
77
|
? {
|
|
69
|
-
...(
|
|
78
|
+
...(columns || [])
|
|
70
79
|
.map((field: any) => field.name)
|
|
71
80
|
.reduce((obj: { [field: string]: any }, fieldName: string) => {
|
|
72
81
|
return (obj = {
|
|
@@ -88,7 +97,6 @@ export class OxGristEditorResourceObject extends OxGristEditor {
|
|
|
88
97
|
}
|
|
89
98
|
|
|
90
99
|
var value = this.value || {}
|
|
91
|
-
var valueField: string | ((item: any) => any) = this.column.record.options.valueField || 'id'
|
|
92
100
|
var actualValue
|
|
93
101
|
if (typeof valueField === 'function') {
|
|
94
102
|
actualValue = valueField(value)
|
|
@@ -102,11 +110,11 @@ export class OxGristEditorResourceObject extends OxGristEditor {
|
|
|
102
110
|
<ox-selector-resource-object
|
|
103
111
|
.value=${actualValue}
|
|
104
112
|
.confirmCallback=${confirmCallback.bind(this)}
|
|
105
|
-
.queryName=${
|
|
106
|
-
.
|
|
107
|
-
.list=${
|
|
108
|
-
.basicArgs=${
|
|
109
|
-
.valueField=${
|
|
113
|
+
.queryName=${queryName}
|
|
114
|
+
.columns=${columns}
|
|
115
|
+
.list=${list}
|
|
116
|
+
.basicArgs=${basicArgs}
|
|
117
|
+
.valueField=${valueField}
|
|
110
118
|
></ox-selector-resource-object>
|
|
111
119
|
`
|
|
112
120
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { FieldRenderer } from '@operato/data-grist'
|
|
2
1
|
import cronstrue from 'cronstrue/i18n'
|
|
3
|
-
import { detectOverflow } from '@operato/utils'
|
|
4
|
-
import { html } from 'lit'
|
|
5
2
|
import i18next from 'i18next'
|
|
3
|
+
import { html } from 'lit'
|
|
4
|
+
|
|
5
|
+
import { FieldRenderer } from '@operato/data-grist'
|
|
6
|
+
import { detectOverflow } from '@operato/utils'
|
|
6
7
|
|
|
7
8
|
function onmouseover(e: Event) {
|
|
8
9
|
const element = e.target as HTMLSpanElement
|
|
@@ -21,7 +22,7 @@ export const OxGristRendererCrontab: FieldRenderer = (value, column, record, row
|
|
|
21
22
|
|
|
22
23
|
try {
|
|
23
24
|
const language = (i18next.language || 'en').substring(0, 2)
|
|
24
|
-
text = value
|
|
25
|
+
text = !value ? '' : cronstrue.toString(value, { locale: language || 'en' })
|
|
25
26
|
} catch (e) {
|
|
26
27
|
console.error(e)
|
|
27
28
|
}
|
|
@@ -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,11 @@
|
|
|
1
1
|
import '@operato/input/ox-input-code.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 { closePopup } from '@operato/popup'
|
|
8
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
8
9
|
|
|
9
10
|
@customElement('ox-popup-code-input')
|
|
10
11
|
export class OxPopupCodeInput extends LitElement {
|
|
@@ -55,11 +56,11 @@ export class OxPopupCodeInput extends LitElement {
|
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
private onCancel(e: Event) {
|
|
58
|
-
|
|
59
|
+
closePopup(this)
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
private onConfirm(e: Event) {
|
|
62
63
|
this.confirmCallback && this.confirmCallback(this.value)
|
|
63
|
-
|
|
64
|
+
closePopup(this)
|
|
64
65
|
}
|
|
65
66
|
}
|
|
@@ -7,6 +7,7 @@ import { customElement, property, query } from 'lit/decorators.js'
|
|
|
7
7
|
import { DataGrist, FetchOption, GristData, GristRecord, ZERO_DATA } from '@operato/data-grist'
|
|
8
8
|
import { client } from '@operato/graphql'
|
|
9
9
|
import { i18next } from '@operato/i18n'
|
|
10
|
+
import { closePopup } from '@operato/popup'
|
|
10
11
|
import { isMobileDevice } from '@operato/utils'
|
|
11
12
|
|
|
12
13
|
@customElement('ox-selector-resource-id')
|
|
@@ -61,7 +62,7 @@ export class OxSelectorResourceId extends LitElement {
|
|
|
61
62
|
.selectedRecords=${this.selectedRecords}
|
|
62
63
|
>
|
|
63
64
|
<div id="filters" slot="headroom">
|
|
64
|
-
<ox-filters-form></ox-filters-form>
|
|
65
|
+
<ox-filters-form autofocus></ox-filters-form>
|
|
65
66
|
</div>
|
|
66
67
|
</ox-grist>
|
|
67
68
|
|
|
@@ -75,16 +76,16 @@ export class OxSelectorResourceId extends LitElement {
|
|
|
75
76
|
|
|
76
77
|
onempty() {
|
|
77
78
|
this.confirmCallback && this.confirmCallback()
|
|
78
|
-
|
|
79
|
+
closePopup(this)
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
oncancel() {
|
|
82
|
-
|
|
83
|
+
closePopup(this)
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
onconfirm() {
|
|
86
87
|
this.confirmCallback && this.confirmCallback(this.selected)
|
|
87
|
-
|
|
88
|
+
closePopup(this)
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
async firstUpdated() {
|