@things-factory/work-shift 6.2.70 → 6.2.77

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.
@@ -0,0 +1 @@
1
+ export default function bootstrap() {}
File without changes
@@ -1,36 +1,39 @@
1
1
  import '@operato/input/ox-input-work-shift.js'
2
+ import '@operato/context/ox-context-page-toolbar.js'
2
3
 
3
- import { PageView, store } from '@things-factory/shell'
4
4
  import { css, html } from 'lit'
5
+ import { customElement, query, state } from 'lit/decorators.js'
6
+ import gql from 'graphql-tag'
5
7
 
6
- import { CommonButtonStyles } from '@operato/styles'
8
+ import { OxFormField } from '@operato/input'
9
+ import { PageView, store } from '@operato/shell'
10
+ import { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'
7
11
  import { client } from '@operato/graphql'
8
12
  import { connect } from 'pwa-helpers/connect-mixin.js'
9
- import gql from 'graphql-tag'
10
13
  import { i18next } from '@operato/i18n'
11
14
 
15
+ @customElement('work-shift')
12
16
  class WorkShift extends connect(store)(PageView) {
13
- constructor() {
14
- super()
15
-
16
- this.workShifts = []
17
- }
18
-
19
- static get styles() {
20
- return css`
17
+ static styles = [
18
+ ScrollbarStyles,
19
+ CommonHeaderStyles,
20
+ css`
21
21
  :host {
22
22
  background-color: var(--main-section-background-color);
23
23
  padding: var(--padding-wide);
24
24
  overflow: auto;
25
25
  }
26
+
27
+ ox-input-work-shift {
28
+ overflow-y: auto;
29
+ flex: 1;
30
+ }
26
31
  `
27
- }
32
+ ]
28
33
 
29
- static get properties() {
30
- return {
31
- workShifts: Object
32
- }
33
- }
34
+ @state() private workShifts: any[] = []
35
+
36
+ @query('ox-input-work-shift') private input!: OxFormField
34
37
 
35
38
  get context() {
36
39
  return {
@@ -38,17 +41,26 @@ class WorkShift extends connect(store)(PageView) {
38
41
  actions: [
39
42
  {
40
43
  title: i18next.t('button.update'),
41
- action: this._updateWorkShift.bind(this),
42
- ...CommonButtonStyles.update
44
+ action: this.updateWorkShift.bind(this),
45
+ icon: 'save'
43
46
  }
44
47
  ],
45
- help: 'page/work-shift'
48
+ help: 'page/work-shift',
49
+ toolbar: false
46
50
  }
47
51
  }
48
52
 
49
53
  render() {
50
54
  return html`
51
- <h2>${i18next.t('title.work-shift')}</h2>
55
+ <div class="header">
56
+ <div class="title">
57
+ <mwc-icon>summarize</mwc-icon>
58
+ ${i18next.t('title.work-shift')}
59
+ </div>
60
+
61
+ <ox-context-page-toolbar class="actions" .context=${this.context}> </ox-context-page-toolbar>
62
+ </div>
63
+
52
64
  <ox-input-work-shift .value=${this.workShifts}></ox-input-work-shift>
53
65
  `
54
66
  }
@@ -76,9 +88,7 @@ class WorkShift extends connect(store)(PageView) {
76
88
  }
77
89
  }
78
90
 
79
- async _updateWorkShift() {
80
- const input = this.renderRoot.querySelector('ox-input-work-shift')
81
-
91
+ private async updateWorkShift() {
82
92
  const response = await client.mutate({
83
93
  mutation: gql`
84
94
  mutation ($patches: [WorkShiftPatch!]!) {
@@ -92,14 +102,10 @@ class WorkShift extends connect(store)(PageView) {
92
102
  }
93
103
  `,
94
104
  variables: {
95
- patches: input.value
105
+ patches: this.input.value
96
106
  }
97
107
  })
98
108
 
99
109
  this.workShifts = response.data.updateMultipleWorkShift
100
110
  }
101
-
102
- stateChanged(state) {}
103
111
  }
104
-
105
- window.customElements.define('work-shift', WorkShift)
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "../../tsconfig-base.json",
3
+ "compilerOptions": {
4
+ "experimentalDecorators": true,
5
+ "skipLibCheck": true,
6
+ "strict": true,
7
+ "declaration": true,
8
+ "module": "esnext",
9
+ "outDir": "../dist-client",
10
+ "baseUrl": "./"
11
+ },
12
+ "include": ["./**/*"]
13
+ }
@@ -0,0 +1 @@
1
+ export default function bootstrap(): void;
@@ -0,0 +1,2 @@
1
+ export default function bootstrap() { }
2
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,SAAS,KAAI,CAAC","sourcesContent":["export default function bootstrap() {}\n"]}
File without changes
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"","sourcesContent":[""]}
@@ -0,0 +1,2 @@
1
+ import '@operato/input/ox-input-work-shift.js';
2
+ import '@operato/context/ox-context-page-toolbar.js';
@@ -0,0 +1,114 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@operato/input/ox-input-work-shift.js';
3
+ import '@operato/context/ox-context-page-toolbar.js';
4
+ import { css, html } from 'lit';
5
+ import { customElement, query, state } from 'lit/decorators.js';
6
+ import gql from 'graphql-tag';
7
+ import { OxFormField } from '@operato/input';
8
+ import { PageView, store } from '@operato/shell';
9
+ import { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles';
10
+ import { client } from '@operato/graphql';
11
+ import { connect } from 'pwa-helpers/connect-mixin.js';
12
+ import { i18next } from '@operato/i18n';
13
+ let WorkShift = class WorkShift extends connect(store)(PageView) {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.workShifts = [];
17
+ }
18
+ get context() {
19
+ return {
20
+ title: i18next.t('title.work-shift'),
21
+ actions: [
22
+ {
23
+ title: i18next.t('button.update'),
24
+ action: this.updateWorkShift.bind(this),
25
+ icon: 'save'
26
+ }
27
+ ],
28
+ help: 'page/work-shift',
29
+ toolbar: false
30
+ };
31
+ }
32
+ render() {
33
+ return html `
34
+ <div class="header">
35
+ <div class="title">
36
+ <mwc-icon>summarize</mwc-icon>
37
+ ${i18next.t('title.work-shift')}
38
+ </div>
39
+
40
+ <ox-context-page-toolbar class="actions" .context=${this.context}> </ox-context-page-toolbar>
41
+ </div>
42
+
43
+ <ox-input-work-shift .value=${this.workShifts}></ox-input-work-shift>
44
+ `;
45
+ }
46
+ async pageUpdated(changes, after, before) {
47
+ /* refresh always page revisited */
48
+ if (this.active) {
49
+ const response = await client.query({
50
+ query: gql `
51
+ query {
52
+ workShifts(sortings: [{ name: "fromDate" }, { name: "fromTime" }]) {
53
+ items {
54
+ name
55
+ fromDate
56
+ fromTime
57
+ toDate
58
+ toTime
59
+ }
60
+ }
61
+ }
62
+ `
63
+ });
64
+ this.workShifts = response.data.workShifts.items;
65
+ }
66
+ }
67
+ async updateWorkShift() {
68
+ const response = await client.mutate({
69
+ mutation: gql `
70
+ mutation ($patches: [WorkShiftPatch!]!) {
71
+ updateMultipleWorkShift(patches: $patches) {
72
+ name
73
+ fromDate
74
+ fromTime
75
+ toDate
76
+ toTime
77
+ }
78
+ }
79
+ `,
80
+ variables: {
81
+ patches: this.input.value
82
+ }
83
+ });
84
+ this.workShifts = response.data.updateMultipleWorkShift;
85
+ }
86
+ };
87
+ WorkShift.styles = [
88
+ ScrollbarStyles,
89
+ CommonHeaderStyles,
90
+ css `
91
+ :host {
92
+ background-color: var(--main-section-background-color);
93
+ padding: var(--padding-wide);
94
+ overflow: auto;
95
+ }
96
+
97
+ ox-input-work-shift {
98
+ overflow-y: auto;
99
+ flex: 1;
100
+ }
101
+ `
102
+ ];
103
+ __decorate([
104
+ state(),
105
+ __metadata("design:type", Array)
106
+ ], WorkShift.prototype, "workShifts", void 0);
107
+ __decorate([
108
+ query('ox-input-work-shift'),
109
+ __metadata("design:type", OxFormField)
110
+ ], WorkShift.prototype, "input", void 0);
111
+ WorkShift = __decorate([
112
+ customElement('work-shift')
113
+ ], WorkShift);
114
+ //# sourceMappingURL=work-shift.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"work-shift.js","sourceRoot":"","sources":["../../client/pages/work-shift.ts"],"names":[],"mappings":";AAAA,OAAO,uCAAuC,CAAA;AAC9C,OAAO,6CAA6C,CAAA;AAEpD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EA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,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;SAYT;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAA;SACjD;IACH,CAAC;IAEO,KAAK,CAAC,eAAe;QAC3B,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;;;;;;;;;OAUZ;YACD,SAAS,EAAE;gBACT,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK;aAC1B;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,uBAAuB,CAAA;IACzD,CAAC;;AA7FM,gBAAM,GAAG;IACd,eAAe;IACf,kBAAkB;IAClB,GAAG,CAAA;;;;;;;;;;;KAWF;CACF,CAAA;AAED;IAAC,KAAK,EAAE;;6CAA+B;AAEvC;IAAC,KAAK,CAAC,qBAAqB,CAAC;8BAAiB,WAAW;wCAAA;AApBrD,SAAS;IADd,aAAa,CAAC,YAAY,CAAC;GACtB,SAAS,CA+Fd","sourcesContent":["import '@operato/input/ox-input-work-shift.js'\nimport '@operato/context/ox-context-page-toolbar.js'\n\nimport { css, html } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\nimport gql from 'graphql-tag'\n\nimport { OxFormField } from '@operato/input'\nimport { PageView, store } from '@operato/shell'\nimport { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { client } from '@operato/graphql'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\nimport { i18next } from '@operato/i18n'\n\n@customElement('work-shift')\nclass WorkShift extends connect(store)(PageView) {\n static styles = [\n ScrollbarStyles,\n CommonHeaderStyles,\n css`\n :host {\n background-color: var(--main-section-background-color);\n padding: var(--padding-wide);\n overflow: auto;\n }\n\n ox-input-work-shift {\n overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n @state() private workShifts: any[] = []\n\n @query('ox-input-work-shift') private input!: OxFormField\n\n get context() {\n return {\n title: i18next.t('title.work-shift'),\n actions: [\n {\n title: i18next.t('button.update'),\n action: this.updateWorkShift.bind(this),\n icon: 'save'\n }\n ],\n help: 'page/work-shift',\n toolbar: false\n }\n }\n\n render() {\n return html`\n <div class=\"header\">\n <div class=\"title\">\n <mwc-icon>summarize</mwc-icon>\n ${i18next.t('title.work-shift')}\n </div>\n\n <ox-context-page-toolbar class=\"actions\" .context=${this.context}> </ox-context-page-toolbar>\n </div>\n\n <ox-input-work-shift .value=${this.workShifts}></ox-input-work-shift>\n `\n }\n\n async pageUpdated(changes, after, before) {\n /* refresh always page revisited */\n if (this.active) {\n const response = await client.query({\n query: gql`\n query {\n workShifts(sortings: [{ name: \"fromDate\" }, { name: \"fromTime\" }]) {\n items {\n name\n fromDate\n fromTime\n toDate\n toTime\n }\n }\n }\n `\n })\n\n this.workShifts = response.data.workShifts.items\n }\n }\n\n private async updateWorkShift() {\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [WorkShiftPatch!]!) {\n updateMultipleWorkShift(patches: $patches) {\n name\n fromDate\n fromTime\n toDate\n toTime\n }\n }\n `,\n variables: {\n patches: this.input.value\n }\n })\n\n this.workShifts = response.data.updateMultipleWorkShift\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export default function route(page: any): any;
@@ -0,0 +1,8 @@
1
+ export default function route(page) {
2
+ switch (page) {
3
+ case 'work-shift':
4
+ import('./pages/work-shift');
5
+ return page;
6
+ }
7
+ }
8
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../client/route.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,IAAI;IAChC,QAAQ,IAAI,EAAE;QACZ,KAAK,YAAY;YACf,MAAM,CAAC,oBAAoB,CAAC,CAAA;YAC5B,OAAO,IAAI,CAAA;KACd;AACH,CAAC","sourcesContent":["export default function route(page) {\n switch (page) {\n case 'work-shift':\n import('./pages/work-shift')\n return page\n }\n}\n"]}