@operato/app 1.5.22 → 1.5.24
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/grist-editor/ox-grist-editor-permission.d.ts +8 -0
- package/dist/src/grist-editor/ox-grist-editor-permission.js +54 -0
- package/dist/src/grist-editor/ox-grist-editor-permission.js.map +1 -0
- package/dist/src/grist-editor/ox-popup-permission-input.d.ts +23 -0
- package/dist/src/grist-editor/ox-popup-permission-input.js +101 -0
- package/dist/src/grist-editor/ox-popup-permission-input.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -7
- package/src/grist-editor/ox-grist-editor-permission.ts +61 -0
- package/src/grist-editor/ox-popup-permission-input.ts +100 -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.5.
|
|
5
|
+
"version": "1.5.24",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
7
7
|
"module": "dist/src/index.js",
|
|
8
8
|
"exports": {
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"./grist-editor/ox-grist-renderer-crontab.js": "./dist/src/grist-editor/ox-grist-renderer-crontab.js",
|
|
25
25
|
"./grist-editor/ox-grist-editor-json.js": "./dist/src/grist-editor/ox-grist-editor-json.js",
|
|
26
26
|
"./grist-editor/ox-grist-editor-code.js": "./dist/src/grist-editor/ox-grist-editor-code.js",
|
|
27
|
+
"./grist-editor/ox-grist-editor-permission.js": "./dist/src/grist-editor/ox-grist-editor-permission.js",
|
|
27
28
|
"./grist-editor/ox-grist-editor-resource-object.js": "./dist/src/grist-editor/ox-grist-editor-resource-object.js",
|
|
28
29
|
"./grist-editor/ox-grist-editor-resource-object-legacy.js": "./dist/src/grist-editor/ox-grist-editor-resource-object-legacy.js",
|
|
29
30
|
"./grist-editor/ox-grist-editor-resource-code.js": "./dist/src/grist-editor/ox-grist-editor-resource-code.js",
|
|
@@ -83,6 +84,9 @@
|
|
|
83
84
|
"grist-editor/ox-grist-editor-code.js": [
|
|
84
85
|
"dist/src/grist-editor/ox-grist-editor-code.d.ts"
|
|
85
86
|
],
|
|
87
|
+
"grist-editor/ox-grist-editor-permission.js": [
|
|
88
|
+
"dist/src/grist-editor/ox-grist-editor-permission.d.ts"
|
|
89
|
+
],
|
|
86
90
|
"grist-editor/ox-grist-editor-resource-object.js": [
|
|
87
91
|
"dist/src/grist-editor/ox-grist-editor-resource-object.d.ts"
|
|
88
92
|
],
|
|
@@ -125,15 +129,15 @@
|
|
|
125
129
|
"@material/mwc-button": "^0.27.0",
|
|
126
130
|
"@material/mwc-icon": "^0.27.0",
|
|
127
131
|
"@material/mwc-icon-button": "^0.27.0",
|
|
128
|
-
"@operato/attachment": "^1.5.
|
|
129
|
-
"@operato/data-grist": "^1.5.
|
|
130
|
-
"@operato/font": "^1.5.
|
|
132
|
+
"@operato/attachment": "^1.5.24",
|
|
133
|
+
"@operato/data-grist": "^1.5.24",
|
|
134
|
+
"@operato/font": "^1.5.24",
|
|
131
135
|
"@operato/form": "^1.4.77",
|
|
132
136
|
"@operato/graphql": "^1.4.76",
|
|
133
137
|
"@operato/i18n": "^1.5.14",
|
|
134
|
-
"@operato/input": "^1.5.
|
|
138
|
+
"@operato/input": "^1.5.24",
|
|
135
139
|
"@operato/layout": "^1.5.15",
|
|
136
|
-
"@operato/property-editor": "^1.5.
|
|
140
|
+
"@operato/property-editor": "^1.5.24",
|
|
137
141
|
"@operato/shell": "^1.4.87",
|
|
138
142
|
"@operato/styles": "^1.4.64",
|
|
139
143
|
"@operato/utils": "^1.4.64",
|
|
@@ -178,5 +182,5 @@
|
|
|
178
182
|
"prettier --write"
|
|
179
183
|
]
|
|
180
184
|
},
|
|
181
|
-
"gitHead": "
|
|
185
|
+
"gitHead": "840159e3db256c4a8d35fb3461e590729587742e"
|
|
182
186
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import './ox-popup-permission-input.js'
|
|
2
|
+
|
|
3
|
+
import { html } 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 } from '@operato/layout'
|
|
9
|
+
|
|
10
|
+
@customElement('ox-grist-editor-permission')
|
|
11
|
+
export class OxGristEditorPermission extends OxGristEditor {
|
|
12
|
+
get editorTemplate() {
|
|
13
|
+
return html` <div tabindex="0">${this.value || ''}</div> `
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
_onclick(e: Event): void {
|
|
17
|
+
e.stopPropagation()
|
|
18
|
+
this.showEditorPopup()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
_onkeydown(e: KeyboardEvent): void {
|
|
22
|
+
const key = e.key
|
|
23
|
+
if (key == 'Enter') {
|
|
24
|
+
e.stopPropagation()
|
|
25
|
+
this.showEditorPopup()
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
showEditorPopup() {
|
|
30
|
+
var change = (value: string) => {
|
|
31
|
+
this.dispatchEvent(
|
|
32
|
+
new CustomEvent('field-change', {
|
|
33
|
+
bubbles: true,
|
|
34
|
+
composed: true,
|
|
35
|
+
detail: {
|
|
36
|
+
before: this.value,
|
|
37
|
+
after: value,
|
|
38
|
+
column: this.column,
|
|
39
|
+
record: this.record,
|
|
40
|
+
row: this.row
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var popup = openPopup(
|
|
47
|
+
html`
|
|
48
|
+
<ox-popup-permission-input
|
|
49
|
+
.value=${this.value}
|
|
50
|
+
.confirmCallback=${change.bind(this)}
|
|
51
|
+
></ox-popup-permission-input>
|
|
52
|
+
`,
|
|
53
|
+
{
|
|
54
|
+
backdrop: true,
|
|
55
|
+
title: i18next.t('title.edit permission'),
|
|
56
|
+
size: 'small',
|
|
57
|
+
help: 'data-grist/grist-editor/permission'
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import '@operato/input/ox-input-permission.js'
|
|
2
|
+
|
|
3
|
+
import gql from 'graphql-tag'
|
|
4
|
+
import { css, html, LitElement, PropertyValueMap } from 'lit'
|
|
5
|
+
import { customElement, property, state } from 'lit/decorators.js'
|
|
6
|
+
|
|
7
|
+
import { i18next } from '@operato/i18n'
|
|
8
|
+
import { closePopup } from '@operato/popup'
|
|
9
|
+
import { ScrollbarStyles } from '@operato/styles'
|
|
10
|
+
import { client } from '@operato/graphql'
|
|
11
|
+
|
|
12
|
+
@customElement('ox-popup-permission-input')
|
|
13
|
+
export class OxPopupPermissionInput extends LitElement {
|
|
14
|
+
static styles = [
|
|
15
|
+
ScrollbarStyles,
|
|
16
|
+
css`
|
|
17
|
+
:host {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
|
|
21
|
+
background-color: #fff;
|
|
22
|
+
|
|
23
|
+
width: var(--overlay-center-normal-width, 50%);
|
|
24
|
+
height: var(--overlay-center-normal-height, 50%);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
ox-input-permission {
|
|
28
|
+
flex: 1;
|
|
29
|
+
overflow-y: auto;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.button-container {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: row;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
div[padding] {
|
|
38
|
+
flex: 1;
|
|
39
|
+
}
|
|
40
|
+
`
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
@property({ type: Object }) value?: { category: string; privilege: string; owner: boolean; super: boolean } | null
|
|
44
|
+
|
|
45
|
+
@property({ type: Object }) confirmCallback!: (newval: any) => void
|
|
46
|
+
|
|
47
|
+
@state() privileges: { name: string; category: string; description: string }[] = []
|
|
48
|
+
|
|
49
|
+
render() {
|
|
50
|
+
return html`
|
|
51
|
+
<ox-input-permission .value=${this.value} .privileges=${this.privileges} @change=${this.onChange.bind(this)}>
|
|
52
|
+
</ox-input-permission>
|
|
53
|
+
|
|
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>
|
|
59
|
+
</div>
|
|
60
|
+
`
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): Promise<void> {
|
|
64
|
+
const response = await client.query({
|
|
65
|
+
query: gql`
|
|
66
|
+
query privileges {
|
|
67
|
+
privileges {
|
|
68
|
+
items {
|
|
69
|
+
name
|
|
70
|
+
category
|
|
71
|
+
description
|
|
72
|
+
}
|
|
73
|
+
total
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
`
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
this.privileges = response.data.privileges.items
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private onChange(e: CustomEvent) {
|
|
83
|
+
e.stopPropagation()
|
|
84
|
+
|
|
85
|
+
this.value = e.detail
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private onReset(e: Event) {
|
|
89
|
+
this.value = null
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private onCancel(e: Event) {
|
|
93
|
+
closePopup(this)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private onConfirm(e: Event) {
|
|
97
|
+
this.confirmCallback && this.confirmCallback(this.value)
|
|
98
|
+
closePopup(this)
|
|
99
|
+
}
|
|
100
|
+
}
|