@things-factory/auth-ui 4.0.42 → 4.1.1

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.
@@ -1,4 +1,6 @@
1
- import '@operato/data-grist'
1
+ import '@operato/data-grist/ox-grist.js'
2
+ import '@operato/data-grist/ox-filters-form.js'
3
+ import '@operato/data-grist/ox-sorters-control.js'
2
4
  import '../../components/create-domain-popup'
3
5
 
4
6
  import gql from 'graphql-tag'
@@ -7,7 +9,7 @@ import { connect } from 'pwa-helpers/connect-mixin'
7
9
 
8
10
  import { i18next, localize } from '@operato/i18n'
9
11
  import { openPopup } from '@operato/layout'
10
- import { CommonButtonStyles, ScrollbarStyles } from '@operato/styles'
12
+ import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
11
13
  import { isMobileDevice } from '@operato/utils'
12
14
  import { client, PageView, store } from '@things-factory/shell'
13
15
 
@@ -15,12 +17,14 @@ export class DomainManagement extends connect(store)(localize(i18next)(PageView)
15
17
  static get properties() {
16
18
  return {
17
19
  active: String,
18
- config: Object
20
+ config: Object,
21
+ mode: String
19
22
  }
20
23
  }
21
24
 
22
25
  static get styles() {
23
26
  return [
27
+ CommonGristStyles,
24
28
  ScrollbarStyles,
25
29
  css`
26
30
  :host {
@@ -29,25 +33,16 @@ export class DomainManagement extends connect(store)(localize(i18next)(PageView)
29
33
 
30
34
  overflow: hidden;
31
35
  }
32
-
33
- ox-grist {
34
- overflow-y: auto;
35
- flex: 1;
36
- }
37
-
38
- #filters {
39
- display: flex;
40
- flex-direction: row;
41
- justify-content: space-between;
42
- }
43
-
44
- #filters > * {
45
- padding: var(--padding-default) var(--padding-wide);
46
- }
47
36
  `
48
37
  ]
49
38
  }
50
39
 
40
+ constructor() {
41
+ super()
42
+
43
+ this.mode = isMobileDevice() ? 'LIST' : 'GRID'
44
+ }
45
+
51
46
  get context() {
52
47
  return {
53
48
  title: i18next.t('text.domain management'),
@@ -56,11 +51,6 @@ export class DomainManagement extends connect(store)(localize(i18next)(PageView)
56
51
  title: i18next.t('button.save'),
57
52
  action: this.onUpdateDomains.bind(this),
58
53
  ...CommonButtonStyles.save
59
- },
60
- {
61
- title: i18next.t('button.add'),
62
- action: this.onCreateDomain.bind(this),
63
- ...CommonButtonStyles.add
64
54
  }
65
55
  ]
66
56
  }
@@ -68,22 +58,45 @@ export class DomainManagement extends connect(store)(localize(i18next)(PageView)
68
58
 
69
59
  render() {
70
60
  return html`
71
- <ox-grist
72
- .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
73
- .config=${this.config}
74
- .fetchHandler="${this.fetchHandler.bind(this)}"
75
- >
76
- <div id="filters" slot="headroom">
77
- <ox-filters-form @change=${e => this.dataGrist.fetch()}></ox-filters-form>
61
+ <ox-grist .mode=${this.mode} .config=${this.config} .fetchHandler=${this.fetchHandler.bind(this)}>
62
+ <div slot="headroom">
63
+ <div id="filters">
64
+ <ox-filters-form></ox-filters-form>
65
+ </div>
66
+
67
+ <div id="sorters">
68
+ Sort
69
+ <mwc-icon
70
+ @click=${e => {
71
+ const target = e.currentTarget
72
+ this.renderRoot.querySelector('#sorter-control').open({
73
+ right: 0,
74
+ top: target.offsetTop + target.offsetHeight
75
+ })
76
+ }}
77
+ >expand_more</mwc-icon
78
+ >
79
+ <ox-popup id="sorter-control">
80
+ <ox-sorters-control> </ox-sorters-control>
81
+ </ox-popup>
82
+ </div>
83
+
84
+ <div id="modes">
85
+ <mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${this.mode == 'GRID'}>grid_on</mwc-icon>
86
+ <mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${this.mode == 'LIST'}
87
+ >format_list_bulleted</mwc-icon
88
+ >
89
+ <mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${this.mode == 'CARD'}>apps</mwc-icon>
90
+ </div>
91
+
92
+ <div id="add">
93
+ <button><mwc-icon @click=${this.onCreateDomain.bind(this)}>add</mwc-icon></button>
94
+ </div>
78
95
  </div>
79
96
  </ox-grist>
80
97
  `
81
98
  }
82
99
 
83
- get searchForm() {
84
- return this.renderRoot.querySelector('ox-filters-form')
85
- }
86
-
87
100
  get dataGrist() {
88
101
  return this.renderRoot.querySelector('ox-grist')
89
102
  }
@@ -116,6 +129,7 @@ export class DomainManagement extends connect(store)(localize(i18next)(PageView)
116
129
  editable: false
117
130
  },
118
131
  filter: 'search',
132
+ sortable: true,
119
133
  width: 200
120
134
  },
121
135
  {
@@ -170,9 +184,7 @@ export class DomainManagement extends connect(store)(localize(i18next)(PageView)
170
184
  }
171
185
  }
172
186
 
173
- async fetchHandler({ page, limit, sorters = [] }) {
174
- const filters = (await this.searchForm.getQueryFilters()) || []
175
-
187
+ async fetchHandler({ page, limit, sortings = [], filters = [] }) {
176
188
  const response = await client.query({
177
189
  query: gql`
178
190
  query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
@@ -192,7 +204,7 @@ export class DomainManagement extends connect(store)(localize(i18next)(PageView)
192
204
  variables: {
193
205
  filters,
194
206
  pagination: { page, limit },
195
- sortings: sorters
207
+ sortings
196
208
  }
197
209
  })
198
210
 
@@ -228,6 +240,7 @@ export class DomainManagement extends connect(store)(localize(i18next)(PageView)
228
240
  })
229
241
 
230
242
  if (!response.errors) {
243
+ this.dataGrist.fetch()
231
244
  return this.showToast(i18next.t('text.updated_successfully'))
232
245
  }
233
246
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/auth-ui",
3
- "version": "4.0.42",
3
+ "version": "4.1.1",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -30,14 +30,14 @@
30
30
  "@material/mwc-icon-button": "^0.25.3",
31
31
  "@material/mwc-textarea": "^0.25.3",
32
32
  "@material/mwc-textfield": "^0.25.3",
33
- "@operato/data-grist": "^0.3.24",
34
- "@operato/i18n": "^0.3.24",
35
- "@operato/layout": "^0.3.24",
36
- "@operato/lottie-player": "^0.3.24",
37
- "@things-factory/auth-base": "^4.0.42",
38
- "@things-factory/i18n-base": "^4.0.42",
39
- "@things-factory/more-base": "^4.0.42",
33
+ "@operato/data-grist": "^0.3.28",
34
+ "@operato/i18n": "^0.3.28",
35
+ "@operato/layout": "^0.3.28",
36
+ "@operato/lottie-player": "^0.3.28",
37
+ "@things-factory/auth-base": "^4.1.1",
38
+ "@things-factory/i18n-base": "^4.1.1",
39
+ "@things-factory/more-base": "^4.1.1",
40
40
  "clipboard": "^2.0.6"
41
41
  },
42
- "gitHead": "794709ebadf4ae0f89a107a86a41a381ce26b465"
42
+ "gitHead": "09378a57e788038c086c6c40e6135cf14082b185"
43
43
  }