@things-factory/lite-menu 4.0.40 → 4.0.44

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,11 +1,14 @@
1
- import { html } from 'lit-element'
1
+ import '../viewparts/lite-menu-part'
2
+ import '@material/mwc-icon'
3
+
2
4
  import gql from 'graphql-tag'
3
- import { client, store } from '@things-factory/shell'
4
- import { isMobileDevice } from '@things-factory/utils'
5
- import { appendViewpart, toggleOverlay, TOOL_POSITION, VIEWPART_POSITION } from '@things-factory/layout-base'
6
- import { APPEND_APP_TOOL, REMOVE_APP_TOOL } from '@things-factory/apptool-base'
5
+ import { html } from 'lit'
7
6
 
8
- import '../viewparts/lite-menu-portrait'
7
+ import { client } from '@operato/graphql'
8
+ import { appendViewpart, toggleOverlay, TOOL_POSITION, VIEWPART_POSITION } from '@operato/layout'
9
+ import { store } from '@operato/shell'
10
+ import { isMobileDevice } from '@operato/utils'
11
+ import { APPEND_APP_TOOL, REMOVE_APP_TOOL } from '@things-factory/apptool-base'
9
12
 
10
13
  export const UPDATE_ADDON_MENUS = 'UPDATE_ADDON_MENUS'
11
14
  export const UPDATE_MENU_TEMPLATE = 'UPDATE_MENU_TEMPLATE'
@@ -13,16 +16,17 @@ export const UPDATE_MENU_TEMPLATE = 'UPDATE_MENU_TEMPLATE'
13
16
  var HAMBURGER
14
17
 
15
18
  export function setupMenuPart(options) {
16
- const {
17
- hovering = isMobileDevice() ? true : false,
18
- slotTemplate,
19
+ const {
20
+ hovering = isMobileDevice() ? true : false,
21
+ slotTemplate,
19
22
  portraitSlotTemplate,
20
23
  landscapeSlotTemplate,
21
- position = VIEWPART_POSITION.NAVBAR
24
+ position = VIEWPART_POSITION.NAVBAR
22
25
  } = options || {}
23
26
 
24
27
  const orientation = position == VIEWPART_POSITION.HEADERBAR ? 'landscape' : 'portrait'
25
- const orientatedSlotTemplate = (orientation == 'landscape' ? landscapeSlotTemplate : portraitSlotTemplate ) || slotTemplate || html``
28
+ const orientatedSlotTemplate =
29
+ (orientation == 'landscape' ? landscapeSlotTemplate : portraitSlotTemplate) || slotTemplate || html``
26
30
 
27
31
  appendViewpart({
28
32
  name: 'lite-menu-part',
@@ -1,13 +1,16 @@
1
- import { html } from 'lit-element'
2
- import { store, client, navigate } from '@things-factory/shell'
1
+ import './route'
2
+ import '@operato/i18n/ox-i18n.js'
3
+ import '@material/mwc-icon'
4
+
5
+ import { html } from 'lit'
6
+
7
+ import { navigate, store } from '@operato/shell'
3
8
  import { auth } from '@things-factory/auth-base'
4
9
  import { ADD_MORENDA } from '@things-factory/more-base'
5
10
 
6
11
  import { fetchAddonMenus } from './actions/lite-menu'
7
12
  import liteMenu from './reducers/lite-menu'
8
13
 
9
- import './route'
10
-
11
14
  export default function bootstrap() {
12
15
  store.addReducers({ liteMenu })
13
16
 
@@ -20,7 +23,7 @@ export default function bootstrap() {
20
23
  type: ADD_MORENDA,
21
24
  morenda: {
22
25
  icon: html` <mwc-icon>view_list</mwc-icon> `,
23
- name: html` <i18n-msg msgid="text.addon-menu management"></i18n-msg> `,
26
+ name: html` <ox-i18n msgid="text.addon-menu management"></ox-i18n> `,
24
27
  action: () => {
25
28
  navigate('addon-menu-setting')
26
29
  }
@@ -1,33 +1,49 @@
1
- import { html, css } from 'lit-element'
2
- import { connect } from 'pwa-helpers/connect-mixin.js'
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'
4
+ import '@operato/data-grist/ox-record-creator.js'
5
+ import '@operato/popup/ox-popup.js'
6
+ import '@material/mwc-icon'
3
7
 
4
8
  import gql from 'graphql-tag'
5
- import { store, PageView, client } from '@things-factory/shell'
6
- import { isMobileDevice, gqlBuilder } from '@things-factory/utils'
7
- import { CommonButtonStyles } from '@things-factory/styles'
8
- import { i18next, localize } from '@things-factory/i18n-base'
9
- import { getRenderer, getEditor } from '@things-factory/grist-ui'
9
+ import { css, html } from 'lit'
10
+ import { connect } from 'pwa-helpers/connect-mixin.js'
11
+
12
+ import { getEditor, getRenderer } from '@operato/data-grist'
13
+ import { client } from '@operato/graphql'
14
+ import { i18next, localize } from '@operato/i18n'
15
+ import { PageView, store } from '@operato/shell'
16
+ import { CommonButtonStyles, CommonGristStyles } from '@operato/styles'
17
+ import { isMobileDevice } from '@operato/utils'
10
18
 
11
19
  class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
12
20
  static get properties() {
13
21
  return {
14
22
  config: Object,
15
- menus: Array
23
+ menus: Array,
24
+ mode: String
16
25
  }
17
26
  }
18
27
 
19
28
  static get styles() {
20
- return css`
21
- :host {
22
- display: flex;
23
- overflow-x: hidden;
24
- flex-direction: column;
25
- }
29
+ return [
30
+ CommonGristStyles,
31
+ css`
32
+ :host {
33
+ display: flex;
34
+ overflow-x: hidden;
35
+ flex-direction: column;
36
+
37
+ width: 100%;
38
+ }
39
+ `
40
+ ]
41
+ }
26
42
 
27
- data-grist {
28
- flex: 1;
29
- }
30
- `
43
+ constructor() {
44
+ super()
45
+
46
+ this.mode = isMobileDevice() ? 'CARD' : 'GRID'
31
47
  }
32
48
 
33
49
  get context() {
@@ -68,11 +84,34 @@ class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
68
84
 
69
85
  render() {
70
86
  return html`
71
- <data-grist
72
- .mode=${isMobileDevice() ? 'LIST' : 'GRID'}
73
- .config=${this.config}
74
- .fetchHandler=${this.fetchHandler}
75
- ></data-grist>
87
+ <ox-grist .mode=${this.mode} .config=${this.config} .fetchHandler=${this.fetchHandler}>
88
+ <div slot="headroom">
89
+ <div id="filters">
90
+ <ox-filters-form></ox-filters-form>
91
+ </div>
92
+
93
+ <div id="sorters">
94
+ <mwc-icon
95
+ @click=${e => {
96
+ const target = e.currentTarget
97
+ this.renderRoot.querySelector('#sorter-control').open({
98
+ right: 0,
99
+ top: target.offsetTop + target.offsetHeight
100
+ })
101
+ }}
102
+ >sort</mwc-icon
103
+ >
104
+ <ox-popup id="sorter-control">
105
+ <ox-sorters-control> </ox-sorters-control>
106
+ </ox-popup>
107
+ </div>
108
+
109
+ <div id="modes">
110
+ <mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${this.mode == 'GRID'}>grid_on</mwc-icon>
111
+ <mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${this.mode == 'CARD'}>apps</mwc-icon>
112
+ </div>
113
+ </div>
114
+ </ox-grist>
76
115
  `
77
116
  }
78
117
 
@@ -81,7 +120,7 @@ class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
81
120
  }
82
121
 
83
122
  get grist() {
84
- return this.shadowRoot.querySelector('data-grist')
123
+ return this.shadowRoot.querySelector('ox-grist')
85
124
  }
86
125
 
87
126
  async onCommit() {
@@ -113,7 +152,7 @@ class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
113
152
 
114
153
  return await client.mutate({
115
154
  mutation: gql`
116
- mutation($name: String!, $patch: LiteMenuPatch!) {
155
+ mutation ($name: String!, $patch: LiteMenuPatch!) {
117
156
  updateLiteMenu(name: $name, patch: $patch) {
118
157
  id
119
158
  name
@@ -143,7 +182,7 @@ class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
143
182
 
144
183
  return await client.mutate({
145
184
  mutation: gql`
146
- mutation($liteMenu: NewLiteMenu!) {
185
+ mutation ($liteMenu: NewLiteMenu!) {
147
186
  createLiteMenu(liteMenu: $liteMenu) {
148
187
  id
149
188
  name
@@ -175,7 +214,7 @@ class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
175
214
 
176
215
  return await client.mutate({
177
216
  mutation: gql`
178
- mutation($name: String!) {
217
+ mutation ($name: String!) {
179
218
  deleteLiteMenu(name: $name)
180
219
  }
181
220
  `,
@@ -191,6 +230,11 @@ class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
191
230
 
192
231
  async pageInitialized() {
193
232
  this.config = {
233
+ list: {
234
+ thumbnail: 'value',
235
+ fields: ['name', 'description'],
236
+ details: ['type', 'parent', 'rank', 'updatedAt']
237
+ },
194
238
  columns: [
195
239
  {
196
240
  type: 'gutter',
@@ -217,6 +261,7 @@ class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
217
261
  record: {
218
262
  editable: true
219
263
  },
264
+ filter: 'search',
220
265
  sortable: true,
221
266
  width: 120
222
267
  },
@@ -228,11 +273,13 @@ class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
228
273
  align: 'left',
229
274
  editable: true
230
275
  },
276
+ filter: 'search',
231
277
  width: 200
232
278
  },
233
279
  {
234
280
  type: 'select',
235
281
  name: 'parent',
282
+ label: true,
236
283
  header: i18next.t('field.parent-menu'),
237
284
  record: {
238
285
  editable: true,
@@ -247,6 +294,7 @@ class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
247
294
  {
248
295
  type: 'number',
249
296
  name: 'rank',
297
+ label: true,
250
298
  header: i18next.t('field.rank'),
251
299
  record: {
252
300
  align: 'right',
@@ -258,11 +306,17 @@ class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
258
306
  {
259
307
  type: 'select',
260
308
  name: 'type',
309
+ label: true,
261
310
  header: i18next.t('field.type'),
262
311
  record: {
263
312
  editable: true,
264
313
  options: ['', 'group', 'page', 'board']
265
314
  },
315
+ filter: {
316
+ options: ['', 'group', 'page', 'board'],
317
+ multiple: false,
318
+ operator: 'eq'
319
+ },
266
320
  width: 80
267
321
  },
268
322
  {
@@ -295,10 +349,12 @@ class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
295
349
  {
296
350
  type: 'boolean',
297
351
  name: 'active',
352
+ label: true,
298
353
  header: i18next.t('field.active'),
299
354
  record: {
300
355
  editable: true
301
356
  },
357
+ filter: true,
302
358
  sortable: true,
303
359
  width: 60
304
360
  },
@@ -354,52 +410,50 @@ class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
354
410
  }
355
411
  }
356
412
 
357
- async fetchHandler({ page, limit, sorters = [] }) {
413
+ async fetchHandler({ filters = [], page, limit, sortings = [] }) {
358
414
  const response = (
359
415
  await client.query({
360
416
  query: gql`
361
- {
362
- liteMenus(${gqlBuilder.buildArgs({
363
- filters: [],
364
- pagination: {
365
- page,
366
- limit
367
- },
368
- sortings: sorters
369
- })}) {
370
- items {
371
- id
372
- name
373
- description
374
- parent
375
- rank
376
- type
377
- value
378
- board {
417
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
418
+ responses: liteMenus(filters: $filters, pagination: $pagination, sortings: $sortings) {
419
+ items {
379
420
  id
380
421
  name
381
422
  description
382
- thumbnail
383
- }
384
- icon
385
- active
386
- createdAt
387
- updatedAt
388
- creator {
389
- id
390
- name
391
- }
392
- updater {
393
- id
394
- name
423
+ parent
424
+ rank
425
+ type
426
+ value
427
+ board {
428
+ id
429
+ name
430
+ description
431
+ thumbnail
432
+ }
433
+ icon
434
+ active
435
+ createdAt
436
+ updatedAt
437
+ creator {
438
+ id
439
+ name
440
+ }
441
+ updater {
442
+ id
443
+ name
444
+ }
395
445
  }
446
+ total
396
447
  }
397
- total
398
448
  }
449
+ `,
450
+ variables: {
451
+ filters,
452
+ pagination: { page, limit },
453
+ sortings
399
454
  }
400
- `
401
455
  })
402
- ).data.liteMenus
456
+ ).data.responses
403
457
 
404
458
  store.dispatch({
405
459
  type: 'UPDATE_ADDON_MENUS',
@@ -411,6 +465,10 @@ class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
411
465
  total: response.total
412
466
  }
413
467
  }
468
+
469
+ liteMenuCreationCallback(liteMenu) {
470
+ console.warn('not implemented yet.')
471
+ }
414
472
  }
415
473
 
416
474
  window.customElements.define('addon-menu-setting', AddonMenuSetting)
@@ -1,4 +1,4 @@
1
- import { css } from 'lit-element'
1
+ import { css } from 'lit'
2
2
 
3
3
  export const LiteMenuLandscapeStyles = css`
4
4
  :host {
@@ -1,10 +1,10 @@
1
1
  import '@material/mwc-icon'
2
2
 
3
- import { html, LitElement } from 'lit-element'
3
+ import { html, LitElement } from 'lit'
4
4
  import { connect } from 'pwa-helpers'
5
5
 
6
- import { navigate, store } from '@things-factory/shell'
7
- import { ScrollbarStyles } from '@things-factory/styles'
6
+ import { navigate, store } from '@operato/shell'
7
+ import { ScrollbarStyles } from '@operato/styles'
8
8
 
9
9
  import { LiteMenuLandscapeStyles } from './lite-menu-landscape-styles'
10
10
 
@@ -2,11 +2,11 @@ import '@material/mwc-icon'
2
2
  import './lite-menu-portrait'
3
3
  import './lite-menu-landscape'
4
4
 
5
- import { LitElement, css, html } from 'lit-element'
6
-
7
- import { ScrollbarStyles } from '@things-factory/styles'
5
+ import { css, html, LitElement } from 'lit'
8
6
  import { connect } from 'pwa-helpers'
9
- import { store } from '@things-factory/shell'
7
+
8
+ import { store } from '@operato/shell'
9
+ import { ScrollbarStyles } from '@operato/styles'
10
10
 
11
11
  export class LiteMenuPart extends connect(store)(LitElement) {
12
12
  static get properties() {
@@ -1,4 +1,4 @@
1
- import { css } from 'lit-element'
1
+ import { css } from 'lit'
2
2
 
3
3
  export const LiteMenuPortraitStyles = css`
4
4
  :host {
@@ -1,7 +1,10 @@
1
1
  import '@material/mwc-icon'
2
- import { navigate } from '@things-factory/shell'
3
- import { ScrollbarStyles } from '@things-factory/styles'
4
- import { css, html, LitElement } from 'lit-element'
2
+
3
+ import { html, LitElement } from 'lit'
4
+
5
+ import { navigate } from '@operato/shell'
6
+ import { ScrollbarStyles } from '@operato/styles'
7
+
5
8
  import { LiteMenuPortraitStyles } from './lite-menu-portrait-styles'
6
9
 
7
10
  export class LiteMenuPortrait extends LitElement {
@@ -1,10 +1,10 @@
1
1
  import '@material/mwc-icon'
2
2
 
3
- import { css, html, LitElement } from 'lit-element'
3
+ import { css, html, LitElement } from 'lit'
4
4
  import { connect } from 'pwa-helpers'
5
5
 
6
- import { toggleOverlay } from '@things-factory/layout-base'
7
- import { store } from '@things-factory/shell'
6
+ import { toggleOverlay } from '@operato/layout'
7
+ import { store } from '@operato/shell'
8
8
 
9
9
  export class TopMenuBar extends connect(store)(LitElement) {
10
10
  static get styles() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/lite-menu",
3
- "version": "4.0.40",
3
+ "version": "4.0.44",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -24,16 +24,23 @@
24
24
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
25
25
  },
26
26
  "dependencies": {
27
- "@things-factory/apptool-base": "^4.0.40",
28
- "@things-factory/auth-base": "^4.0.40",
29
- "@things-factory/board-service": "^4.0.40",
30
- "@things-factory/board-ui": "^4.0.40",
31
- "@things-factory/grist-ui": "^4.0.40",
32
- "@things-factory/i18n-base": "^4.0.40",
33
- "@things-factory/layout-base": "^4.0.40",
34
- "@things-factory/more-base": "^4.0.40",
35
- "@things-factory/setting-base": "^4.0.40",
36
- "@things-factory/utils": "^4.0.40"
27
+ "@operato/data-grist": "^0.3.27",
28
+ "@operato/graphql": "^0.3.27",
29
+ "@operato/i18n": "^0.3.27",
30
+ "@operato/input": "^0.3.27",
31
+ "@operato/layout": "^0.3.27",
32
+ "@operato/popup": "^0.3.27",
33
+ "@operato/shell": "^0.3.27",
34
+ "@operato/styles": "^0.3.27",
35
+ "@operato/utils": "^0.3.27",
36
+ "@things-factory/apptool-base": "^4.0.44",
37
+ "@things-factory/auth-base": "^4.0.44",
38
+ "@things-factory/board-service": "^4.0.44",
39
+ "@things-factory/board-ui": "^4.0.44",
40
+ "@things-factory/grist-ui": "^4.0.44",
41
+ "@things-factory/more-base": "^4.0.44",
42
+ "@things-factory/setting-base": "^4.0.44",
43
+ "@things-factory/utils": "^4.0.44"
37
44
  },
38
- "gitHead": "f0697b5ab411e4aa1a52de19a6c135f39686eca1"
45
+ "gitHead": "286a037443bfb38c65db964dbfa6c5f2d141d9ac"
39
46
  }