@operato/app 8.0.0-alpha.15 → 8.0.0-alpha.19

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/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": "8.0.0-alpha.15",
5
+ "version": "8.0.0-alpha.19",
6
6
  "main": "dist/src/index.js",
7
7
  "module": "dist/src/index.js",
8
8
  "exports": {
@@ -147,15 +147,15 @@
147
147
  "@graphql-tools/delegate": "^10.0.1",
148
148
  "@graphql-tools/wrap": "^8.5.0",
149
149
  "@material/web": "^2.0.0",
150
- "@operato/attachment": "^8.0.0-alpha.10",
151
- "@operato/data-grist": "^8.0.0-alpha.10",
152
- "@operato/font": "^8.0.0-alpha.10",
153
- "@operato/form": "^8.0.0-alpha.11",
150
+ "@operato/attachment": "^8.0.0-alpha.19",
151
+ "@operato/data-grist": "^8.0.0-alpha.19",
152
+ "@operato/font": "^8.0.0-alpha.19",
153
+ "@operato/form": "^8.0.0-alpha.19",
154
154
  "@operato/graphql": "^8.0.0-alpha.0",
155
155
  "@operato/i18n": "^8.0.0-alpha.0",
156
- "@operato/input": "^8.0.0-alpha.10",
156
+ "@operato/input": "^8.0.0-alpha.19",
157
157
  "@operato/layout": "^8.0.0-alpha.4",
158
- "@operato/property-editor": "^8.0.0-alpha.10",
158
+ "@operato/property-editor": "^8.0.0-alpha.19",
159
159
  "@operato/shell": "^8.0.0-alpha.4",
160
160
  "@operato/styles": "^8.0.0-alpha.4",
161
161
  "@operato/utils": "^8.0.0-alpha.0",
@@ -199,5 +199,5 @@
199
199
  "prettier --write"
200
200
  ]
201
201
  },
202
- "gitHead": "5ec48dd6e6f1d751e3c780e8634b23599b2f170c"
202
+ "gitHead": "9656b17ec8476c2eeace042a4e561161539e81e7"
203
203
  }
@@ -1,7 +1,7 @@
1
1
  import '../selector/ox-selector-resource-object.js'
2
2
 
3
- import { css, html, TemplateResult } from 'lit'
4
- import { customElement, property } from 'lit/decorators.js'
3
+ import { css, html } from 'lit'
4
+ import { customElement, property, state } from 'lit/decorators.js'
5
5
 
6
6
  import { i18next } from '@operato/i18n'
7
7
  import { openPopup, PopupHandle } from '@operato/layout'
@@ -9,21 +9,68 @@ import { OxFormField } from '@operato/input'
9
9
 
10
10
  @customElement('ox-filter-resource-object')
11
11
  export class OxFilterResourceObject extends OxFormField {
12
- static styles = css`
13
- :host {
14
- min-width: 100px;
15
- }
16
- `
12
+ static styles = [
13
+ css`
14
+ :host {
15
+ display: block;
16
+ position: relative;
17
+ border-bottom: 1px solid rgba(0, 0, 0, 0.15);
18
+ min-width: 100px;
19
+
20
+ --ox-select-padding: var(--spacing-tiny);
21
+ --ox-select-font: var(--input-font);
22
+ --ox-select-color: var(--input-color, var(--md-sys-color-on-surface-variant));
23
+ --ox-select-icon-color: var(--theme-primary-text-color, var(--md-sys-color-on-surface-variant));
24
+ --ox-select-icon-hover-color: var(--md-sys-color-on-primary-container, #3c3938);
25
+ }
26
+
27
+ div {
28
+ width: 100%;
29
+ box-sizing: border-box;
30
+
31
+ display: flex;
32
+ flex-direction: row;
33
+ align-items: center;
34
+ justify-content: center;
35
+ cursor: pointer;
36
+ padding: var(--ox-select-padding);
37
+ font: var(--ox-select-font);
38
+ color: var(--ox-select-color);
39
+ }
40
+
41
+ span {
42
+ flex: 1;
43
+ overflow: hidden;
44
+ text-overflow: ellipsis;
45
+ white-space: nowrap;
46
+ gap: 4px;
47
+ }
48
+
49
+ md-icon {
50
+ --md-icon-size: 16px;
51
+ display: block;
52
+ text-align: right;
53
+ color: var(--ox-select-icon-color);
54
+ opacity: 0.7;
55
+ }
56
+
57
+ div:hover md-icon {
58
+ color: var(--md-sys-color-on-primary-container);
59
+ }
60
+ `
61
+ ]
17
62
 
18
63
  @property({ type: Object }) column: any
19
- @property({ type: Object }) value?: any
64
+ @property({ type: String }) value?: string
65
+
66
+ @state() resourceObject?: any
20
67
 
21
68
  private popup?: PopupHandle
22
69
 
23
70
  render() {
24
- var value = this.value || {}
25
71
  var { nameField = 'name', descriptionField = 'description' } = this.column.record.options || {}
26
72
 
73
+ var value = this.resourceObject || {}
27
74
  var name, description
28
75
 
29
76
  if (typeof nameField === 'function') {
@@ -39,9 +86,10 @@ export class OxFilterResourceObject extends OxFormField {
39
86
  }
40
87
 
41
88
  return html`
42
- ${!value
43
- ? html`<span tabindex="0"></span>`
44
- : html` <span tabindex="0" style="flex:1">${name || ''}${description || ''}</span> `}
89
+ <div @click=${this._onclick} @keydown=${this._onkeydown}>
90
+ <span tabindex="0" style="flex:1">${name || ''}${(description && `(${description})`) || ''}</span>
91
+ <md-icon>search</md-icon>
92
+ </div>
45
93
  `
46
94
  }
47
95
 
@@ -86,7 +134,26 @@ export class OxFilterResourceObject extends OxFormField {
86
134
  columns = columns || select
87
135
 
88
136
  const confirmCallback = (selected?: { [field: string]: any }) => {
89
- this.value = selected
137
+ // this.department = selected
138
+ // ? {
139
+ // id: selected.id,
140
+ // controlNo: selected.controlNo,
141
+ // name: selected.name,
142
+ // description: selected.description
143
+ // }
144
+ // : null
145
+
146
+ // this.value = this.department?.name
147
+
148
+ // this.dispatchEvent(
149
+ // new CustomEvent('change', {
150
+ // bubbles: true,
151
+ // composed: true,
152
+ // detail: this.value
153
+ // })
154
+ // )
155
+
156
+ this.resourceObject = selected
90
157
  ? {
91
158
  ...(columns || [])
92
159
  .map((field: any) => field.name)
@@ -105,6 +172,8 @@ export class OxFilterResourceObject extends OxFormField {
105
172
  }
106
173
  : null
107
174
 
175
+ this.value = this.resourceObject?.[nameField]
176
+
108
177
  this.dispatchEvent(
109
178
  new CustomEvent('change', {
110
179
  detail: this.value
@@ -112,7 +181,7 @@ export class OxFilterResourceObject extends OxFormField {
112
181
  )
113
182
  }
114
183
 
115
- var value = this.value || {}
184
+ var value = this.resourceObject || {}
116
185
  var actualValue
117
186
  if (typeof valueField === 'function') {
118
187
  actualValue = valueField(value)