@things-factory/rack-base 9.1.19 → 10.0.0-beta.2
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/dist-client/pages/cell/cell-list-page.d.ts +1 -7
- package/dist-client/pages/cell/cell-list-page.js +46 -87
- package/dist-client/pages/cell/cell-list-page.js.map +1 -1
- package/dist-client/pages/rack/rack-list-page.d.ts +1 -7
- package/dist-client/pages/rack/rack-list-page.js +48 -90
- package/dist-client/pages/rack/rack-list-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -2,13 +2,7 @@ import '@operato/data-grist';
|
|
|
2
2
|
import { PageView } from '@operato/shell';
|
|
3
3
|
import { FetchOption } from '@operato/data-grist';
|
|
4
4
|
import { CellImporter } from './cell-importer';
|
|
5
|
-
declare const CellListPage_base: (new (...args: any[]) =>
|
|
6
|
-
_storeUnsubscribe: import("redux").Unsubscribe;
|
|
7
|
-
connectedCallback(): void;
|
|
8
|
-
disconnectedCallback(): void;
|
|
9
|
-
stateChanged(_state: unknown): void;
|
|
10
|
-
readonly isConnected: boolean;
|
|
11
|
-
}) & (new (...args: any[]) => import("lit").LitElement) & typeof PageView & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
|
|
5
|
+
declare const CellListPage_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
|
|
12
6
|
export declare class CellListPage extends CellListPage_base {
|
|
13
7
|
static styles: import("lit").CSSResult[];
|
|
14
8
|
static get scopedElements(): {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import '@operato/data-grist';
|
|
3
3
|
import { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
|
|
4
|
-
import { PageView
|
|
4
|
+
import { PageView } from '@operato/shell';
|
|
5
5
|
import { css, html } from 'lit';
|
|
6
6
|
import { customElement, property, query } from 'lit/decorators.js';
|
|
7
7
|
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
|
|
@@ -10,10 +10,9 @@ import { client } from '@operato/graphql';
|
|
|
10
10
|
import { i18next, localize } from '@operato/i18n';
|
|
11
11
|
import { notify, openPopup } from '@operato/layout';
|
|
12
12
|
import { isMobileDevice } from '@operato/utils';
|
|
13
|
-
import { connect } from 'pwa-helpers/connect-mixin';
|
|
14
13
|
import gql from 'graphql-tag';
|
|
15
14
|
import { CellImporter } from './cell-importer';
|
|
16
|
-
let CellListPage = class CellListPage extends
|
|
15
|
+
let CellListPage = class CellListPage extends localize(i18next)(ScopedElementsMixin(PageView)) {
|
|
17
16
|
constructor() {
|
|
18
17
|
super(...arguments);
|
|
19
18
|
this.mode = isMobileDevice() ? 'CARD' : 'GRID';
|
|
@@ -23,48 +22,40 @@ let CellListPage = class CellListPage extends connect(store)(localize(i18next)(S
|
|
|
23
22
|
CommonGristStyles,
|
|
24
23
|
CommonHeaderStyles,
|
|
25
24
|
css `
|
|
26
|
-
:host {
|
|
27
|
-
display: flex;
|
|
25
|
+
:host { display: flex;
|
|
28
26
|
|
|
29
27
|
width: 100%;
|
|
30
28
|
|
|
31
29
|
--grid-record-emphasized-background-color: #8b0000;
|
|
32
30
|
--grid-record-emphasized-color: #ff6b6b;
|
|
33
|
-
|
|
31
|
+
}
|
|
34
32
|
|
|
35
|
-
ox-grist {
|
|
36
|
-
overflow-y: auto;
|
|
33
|
+
ox-grist { overflow-y: auto;
|
|
37
34
|
flex: 1;
|
|
38
|
-
|
|
35
|
+
}
|
|
39
36
|
`
|
|
40
37
|
]; }
|
|
41
38
|
static get scopedElements() {
|
|
42
|
-
return {
|
|
43
|
-
'cell-importer': CellImporter
|
|
39
|
+
return { 'cell-importer': CellImporter
|
|
44
40
|
};
|
|
45
41
|
}
|
|
46
42
|
get context() {
|
|
47
|
-
return {
|
|
48
|
-
title: i18next.t('title.cell list'),
|
|
43
|
+
return { title: i18next.t('title.cell list'),
|
|
49
44
|
help: 'rack-base/cell',
|
|
50
45
|
actions: [
|
|
51
|
-
{
|
|
52
|
-
title: i18next.t('button.save'),
|
|
46
|
+
{ title: i18next.t('button.save'),
|
|
53
47
|
action: this._updateCell.bind(this),
|
|
54
48
|
...CommonButtonStyles.save
|
|
55
49
|
},
|
|
56
|
-
{
|
|
57
|
-
title: i18next.t('button.delete'),
|
|
50
|
+
{ title: i18next.t('button.delete'),
|
|
58
51
|
action: this._deleteCell.bind(this),
|
|
59
52
|
...CommonButtonStyles.delete
|
|
60
53
|
}
|
|
61
54
|
],
|
|
62
|
-
exportable: {
|
|
63
|
-
name: i18next.t('title.cell list'),
|
|
55
|
+
exportable: { name: i18next.t('title.cell list'),
|
|
64
56
|
data: this.exportHandler.bind(this)
|
|
65
57
|
},
|
|
66
|
-
importable: {
|
|
67
|
-
handler: this.importHandler.bind(this)
|
|
58
|
+
importable: { handler: this.importHandler.bind(this)
|
|
68
59
|
}
|
|
69
60
|
};
|
|
70
61
|
}
|
|
@@ -87,113 +78,90 @@ let CellListPage = class CellListPage extends connect(store)(localize(i18next)(S
|
|
|
87
78
|
`;
|
|
88
79
|
}
|
|
89
80
|
async pageInitialized(lifecycle) {
|
|
90
|
-
this.gristConfig = {
|
|
91
|
-
list: {
|
|
92
|
-
fields: ['name', 'description'],
|
|
81
|
+
this.gristConfig = { list: { fields: ['name', 'description'],
|
|
93
82
|
details: ['active', 'updatedAt']
|
|
94
83
|
},
|
|
95
84
|
columns: [
|
|
96
85
|
{ type: 'gutter', gutterName: 'sequence' },
|
|
97
86
|
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
98
|
-
{
|
|
99
|
-
type: 'string',
|
|
87
|
+
{ type: 'string',
|
|
100
88
|
name: 'name',
|
|
101
89
|
header: i18next.t('field.name'),
|
|
102
|
-
record: {
|
|
103
|
-
editable: true
|
|
90
|
+
record: { editable: true
|
|
104
91
|
},
|
|
105
92
|
filter: 'search',
|
|
106
93
|
sortable: true,
|
|
107
94
|
width: 150
|
|
108
95
|
},
|
|
109
|
-
{
|
|
110
|
-
type: 'string',
|
|
96
|
+
{ type: 'string',
|
|
111
97
|
name: 'description',
|
|
112
98
|
header: i18next.t('field.description'),
|
|
113
|
-
record: {
|
|
114
|
-
editable: true
|
|
99
|
+
record: { editable: true
|
|
115
100
|
},
|
|
116
101
|
filter: 'search',
|
|
117
102
|
width: 200
|
|
118
103
|
},
|
|
119
|
-
{
|
|
120
|
-
type: 'checkbox',
|
|
104
|
+
{ type: 'checkbox',
|
|
121
105
|
name: 'active',
|
|
122
106
|
label: true,
|
|
123
107
|
header: i18next.t('field.active'),
|
|
124
|
-
record: {
|
|
125
|
-
editable: true
|
|
108
|
+
record: { editable: true
|
|
126
109
|
},
|
|
127
110
|
filter: true,
|
|
128
111
|
sortable: true,
|
|
129
112
|
width: 60
|
|
130
113
|
},
|
|
131
|
-
{
|
|
132
|
-
type: 'resource-object',
|
|
114
|
+
{ type: 'resource-object',
|
|
133
115
|
name: 'updater',
|
|
134
116
|
header: i18next.t('field.updater'),
|
|
135
|
-
record: {
|
|
136
|
-
editable: false
|
|
117
|
+
record: { editable: false
|
|
137
118
|
},
|
|
138
119
|
sortable: true,
|
|
139
120
|
width: 120
|
|
140
121
|
},
|
|
141
|
-
{
|
|
142
|
-
type: 'datetime',
|
|
122
|
+
{ type: 'datetime',
|
|
143
123
|
name: 'updatedAt',
|
|
144
124
|
header: i18next.t('field.updated_at'),
|
|
145
|
-
record: {
|
|
146
|
-
editable: false
|
|
125
|
+
record: { editable: false
|
|
147
126
|
},
|
|
148
127
|
sortable: true,
|
|
149
128
|
width: 180
|
|
150
129
|
}
|
|
151
130
|
],
|
|
152
|
-
rows: {
|
|
153
|
-
selectable: {
|
|
154
|
-
multiple: true
|
|
131
|
+
rows: { selectable: { multiple: true
|
|
155
132
|
}
|
|
156
133
|
},
|
|
157
134
|
sorters: [
|
|
158
|
-
{
|
|
159
|
-
name: 'name'
|
|
135
|
+
{ name: 'name'
|
|
160
136
|
}
|
|
161
137
|
]
|
|
162
138
|
};
|
|
163
139
|
}
|
|
164
140
|
async pageUpdated(changes, lifecycle) {
|
|
165
|
-
if (this.active) {
|
|
166
|
-
// do something here when this page just became as active
|
|
141
|
+
if (this.active) { // do something here when this page just became as active
|
|
167
142
|
}
|
|
168
143
|
}
|
|
169
144
|
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }) {
|
|
170
|
-
const response = await client.query({
|
|
171
|
-
|
|
172
|
-
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
173
|
-
responses: cells(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
174
|
-
items {
|
|
175
|
-
id
|
|
145
|
+
const response = await client.query({ query: gql `
|
|
146
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: cells(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id
|
|
176
147
|
name
|
|
177
148
|
description
|
|
178
149
|
active
|
|
179
|
-
updater {
|
|
180
|
-
id
|
|
150
|
+
updater { id
|
|
181
151
|
name
|
|
182
|
-
|
|
152
|
+
}
|
|
183
153
|
updatedAt
|
|
184
|
-
|
|
154
|
+
}
|
|
185
155
|
total
|
|
186
|
-
|
|
187
|
-
|
|
156
|
+
}
|
|
157
|
+
}
|
|
188
158
|
`,
|
|
189
|
-
variables: {
|
|
190
|
-
filters,
|
|
159
|
+
variables: { filters,
|
|
191
160
|
pagination: { page, limit },
|
|
192
161
|
sortings
|
|
193
162
|
}
|
|
194
163
|
});
|
|
195
|
-
return {
|
|
196
|
-
total: response.data.responses.total || 0,
|
|
164
|
+
return { total: response.data.responses.total || 0,
|
|
197
165
|
records: response.data.responses.items || []
|
|
198
166
|
};
|
|
199
167
|
}
|
|
@@ -201,20 +169,16 @@ let CellListPage = class CellListPage extends connect(store)(localize(i18next)(S
|
|
|
201
169
|
if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
|
|
202
170
|
const ids = this.grist.selected.map(record => record.id);
|
|
203
171
|
if (ids && ids.length > 0) {
|
|
204
|
-
const response = await client.mutate({
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
deleteCells(ids: $ids)
|
|
208
|
-
}
|
|
172
|
+
const response = await client.mutate({ mutation: gql `
|
|
173
|
+
mutation ($ids: [String!]!) { deleteCells(ids: $ids)
|
|
174
|
+
}
|
|
209
175
|
`,
|
|
210
|
-
variables: {
|
|
211
|
-
ids
|
|
176
|
+
variables: { ids
|
|
212
177
|
}
|
|
213
178
|
});
|
|
214
179
|
if (!response.errors) {
|
|
215
180
|
this.grist.fetch();
|
|
216
|
-
notify({
|
|
217
|
-
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
181
|
+
notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
218
182
|
});
|
|
219
183
|
}
|
|
220
184
|
}
|
|
@@ -232,16 +196,12 @@ let CellListPage = class CellListPage extends connect(store)(localize(i18next)(S
|
|
|
232
196
|
patchField.cuFlag = patch.__dirty__;
|
|
233
197
|
return patchField;
|
|
234
198
|
});
|
|
235
|
-
const response = await client.mutate({
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
name
|
|
240
|
-
}
|
|
241
|
-
}
|
|
199
|
+
const response = await client.mutate({ mutation: gql `
|
|
200
|
+
mutation ($patches: [CellPatch!]!) { updateMultipleCell(patches: $patches) { name
|
|
201
|
+
}
|
|
202
|
+
}
|
|
242
203
|
`,
|
|
243
|
-
variables: {
|
|
244
|
-
patches
|
|
204
|
+
variables: { patches
|
|
245
205
|
}
|
|
246
206
|
});
|
|
247
207
|
if (!response.errors) {
|
|
@@ -269,8 +229,7 @@ let CellListPage = class CellListPage extends connect(store)(localize(i18next)(S
|
|
|
269
229
|
this.grist.fetch();
|
|
270
230
|
}}
|
|
271
231
|
></cell-importer>
|
|
272
|
-
`, {
|
|
273
|
-
backdrop: true,
|
|
232
|
+
`, { backdrop: true,
|
|
274
233
|
size: 'large',
|
|
275
234
|
title: i18next.t('title.import cell')
|
|
276
235
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell-list-page.js","sourceRoot":"","sources":["../../../client/pages/cell/cell-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC5G,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAgB,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAGvC,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAA3F;;QA6BuB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,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAA;YAC9B,CAAC;YAED,OAAO,OAAO,CAAA;QAChB,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAAO;QACzB,MAAM,KAAK,GAAG,SAAS,CACrB,IAAI,CAAA;;mBAES,OAAO;sBACJ,GAAG,EAAE;YACf,OAAO,CAAC,IAAI,EAAE,CAAA;YACd,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QACpB,CAAC;;OAEJ,EACD;YACE,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,mBAAmB,CAAC;SACtC,CACF,CAAA;QAED,KAAK,CAAC,QAAQ,GAAG,GAAG,EAAE;YACpB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QACpB,CAAC,CAAA;IACH,CAAC;;AAnQ2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CAAoE;AAEpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;2CAAA;AA/BjC,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CAgSxB","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView, store } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { ColumnConfig, DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { connect } from 'pwa-helpers/connect-mixin'\nimport gql from 'graphql-tag'\n\nimport { CellImporter } from './cell-importer'\n\n@customElement('cell-list-page')\nexport class CellListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n static get scopedElements() {\n return {\n 'cell-importer': CellImporter\n }\n }\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.cell list'),\n help: 'rack-base/cell',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateCell.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteCell.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: {\n name: i18next.t('title.cell list'),\n data: this.exportHandler.bind(this)\n },\n importable: {\n handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form autofocus></ox-filters-form>\n\n <div id=\"modes\">\n <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>\n <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>\n <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>\n </div>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n list: {\n fields: ['name', 'description'],\n details: ['active', 'updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n filter: 'search',\n width: 200\n },\n {\n type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: {\n editable: true\n },\n filter: true,\n sortable: true,\n width: 60\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: {\n editable: false\n },\n sortable: true,\n width: 120\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: {\n editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'name'\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (this.active) {\n // do something here when this page just became as active\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: cells(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n active\n updater {\n id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteCell() {\n if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {\n const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteCells(ids: $ids)\n }\n `,\n variables: {\n ids\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _updateCell() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [CellPatch!]!) {\n updateMultipleCell(patches: $patches) {\n name\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n }\n }\n }\n\n async exportHandler() {\n const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set(['id', 'name', 'description', 'active'])\n\n return exportTargets.map(cell => {\n let tempObj = {}\n for (const field of targetFieldSet) {\n tempObj[field] = cell[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) {\n const popup = openPopup(\n html`\n <cell-importer\n .cells=${records}\n @imported=${() => {\n history.back()\n this.grist.fetch()\n }}\n ></cell-importer>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.import cell')\n }\n )\n\n popup.onclosed = () => {\n this.grist.fetch()\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cell-list-page.js","sourceRoot":"","sources":["../../../client/pages/cell/cell-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC5G,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAm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AAE,MAAM,EAAE,CAAC;;iDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CAAoE;AAEpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;2CAAA;AA1BjC,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CAkOxB","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { ColumnConfig, DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { isMobileDevice } from '@operato/utils'\n\nimport gql from 'graphql-tag'\n\nimport { CellImporter } from './cell-importer'\n\n@customElement('cell-list-page')\nexport class CellListPage extends localize(i18next)(ScopedElementsMixin(PageView)) { static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host { display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n ox-grist { overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n static get scopedElements() { return { 'cell-importer': CellImporter\n }\n }\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() { return { title: i18next.t('title.cell list'),\n help: 'rack-base/cell',\n actions: [\n { title: i18next.t('button.save'),\n action: this._updateCell.bind(this),\n ...CommonButtonStyles.save\n },\n { title: i18next.t('button.delete'),\n action: this._deleteCell.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: { name: i18next.t('title.cell list'),\n data: this.exportHandler.bind(this)\n },\n importable: { handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() { const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form autofocus></ox-filters-form>\n\n <div id=\"modes\">\n <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>\n <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>\n <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>\n </div>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) { this.gristConfig = { list: { fields: ['name', 'description'],\n details: ['active', 'updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n { type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: { editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n { type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: { editable: true\n },\n filter: 'search',\n width: 200\n },\n { type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: { editable: true\n },\n filter: true,\n sortable: true,\n width: 60\n },\n { type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: { editable: false\n },\n sortable: true,\n width: 120\n },\n { type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: { editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: { selectable: { multiple: true\n }\n },\n sorters: [\n { name: 'name'\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) { if (this.active) { // do something here when this page just became as active\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) { const response = await client.query({ query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: cells(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id\n name\n description\n active\n updater { id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: { filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return { total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteCell() { if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) { const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) { const response = await client.mutate({ mutation: gql`\n mutation ($ids: [String!]!) { deleteCells(ids: $ids)\n }\n `,\n variables: { ids\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _updateCell() { let patches = this.grist.dirtyRecords\n if (patches && patches.length) { patches = patches.map(patch => { let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) { patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({ mutation: gql`\n mutation ($patches: [CellPatch!]!) { updateMultipleCell(patches: $patches) { name\n }\n }\n `,\n variables: { patches\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n }\n }\n }\n\n async exportHandler() { const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set(['id', 'name', 'description', 'active'])\n\n return exportTargets.map(cell => { let tempObj = {}\n for (const field of targetFieldSet) { tempObj[field] = cell[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) { const popup = openPopup(\n html`\n <cell-importer\n .cells=${records}\n @imported=${() => { history.back()\n this.grist.fetch()\n }}\n ></cell-importer>\n `,\n { backdrop: true,\n size: 'large',\n title: i18next.t('title.import cell')\n }\n )\n\n popup.onclosed = () => { this.grist.fetch()\n }\n }\n}\n"]}
|
|
@@ -2,13 +2,7 @@ import '@operato/data-grist';
|
|
|
2
2
|
import { PageView } from '@operato/shell';
|
|
3
3
|
import { FetchOption } from '@operato/data-grist';
|
|
4
4
|
import { RackImporter } from './rack-importer';
|
|
5
|
-
declare const RackListPage_base: (new (...args: any[]) =>
|
|
6
|
-
_storeUnsubscribe: import("redux").Unsubscribe;
|
|
7
|
-
connectedCallback(): void;
|
|
8
|
-
disconnectedCallback(): void;
|
|
9
|
-
stateChanged(_state: unknown): void;
|
|
10
|
-
readonly isConnected: boolean;
|
|
11
|
-
}) & (new (...args: any[]) => import("lit").LitElement) & typeof PageView & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
|
|
5
|
+
declare const RackListPage_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
|
|
12
6
|
export declare class RackListPage extends RackListPage_base {
|
|
13
7
|
static styles: import("lit").CSSResult[];
|
|
14
8
|
static get scopedElements(): {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import '@operato/data-grist';
|
|
3
3
|
import { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
|
|
4
|
-
import { PageView
|
|
4
|
+
import { PageView } from '@operato/shell';
|
|
5
5
|
import { css, html } from 'lit';
|
|
6
6
|
import { customElement, property, query } from 'lit/decorators.js';
|
|
7
7
|
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
|
|
@@ -10,10 +10,9 @@ import { client } from '@operato/graphql';
|
|
|
10
10
|
import { i18next, localize } from '@operato/i18n';
|
|
11
11
|
import { notify, openPopup } from '@operato/layout';
|
|
12
12
|
import { isMobileDevice } from '@operato/utils';
|
|
13
|
-
import { connect } from 'pwa-helpers/connect-mixin';
|
|
14
13
|
import gql from 'graphql-tag';
|
|
15
14
|
import { RackImporter } from './rack-importer';
|
|
16
|
-
let RackListPage = class RackListPage extends
|
|
15
|
+
let RackListPage = class RackListPage extends localize(i18next)(ScopedElementsMixin(PageView)) {
|
|
17
16
|
constructor() {
|
|
18
17
|
super(...arguments);
|
|
19
18
|
this.mode = isMobileDevice() ? 'CARD' : 'GRID';
|
|
@@ -23,52 +22,43 @@ let RackListPage = class RackListPage extends connect(store)(localize(i18next)(S
|
|
|
23
22
|
CommonGristStyles,
|
|
24
23
|
CommonHeaderStyles,
|
|
25
24
|
css `
|
|
26
|
-
:host {
|
|
27
|
-
display: flex;
|
|
25
|
+
:host { display: flex;
|
|
28
26
|
|
|
29
27
|
width: 100%;
|
|
30
28
|
|
|
31
29
|
--grid-record-emphasized-background-color: #8b0000;
|
|
32
30
|
--grid-record-emphasized-color: #ff6b6b;
|
|
33
|
-
|
|
31
|
+
}
|
|
34
32
|
|
|
35
|
-
ox-grist {
|
|
36
|
-
overflow-y: auto;
|
|
33
|
+
ox-grist { overflow-y: auto;
|
|
37
34
|
flex: 1;
|
|
38
|
-
|
|
35
|
+
}
|
|
39
36
|
|
|
40
|
-
ox-filters-form {
|
|
41
|
-
|
|
42
|
-
}
|
|
37
|
+
ox-filters-form { flex: 1;
|
|
38
|
+
}
|
|
43
39
|
`
|
|
44
40
|
]; }
|
|
45
41
|
static get scopedElements() {
|
|
46
|
-
return {
|
|
47
|
-
'rack-importer': RackImporter
|
|
42
|
+
return { 'rack-importer': RackImporter
|
|
48
43
|
};
|
|
49
44
|
}
|
|
50
45
|
get context() {
|
|
51
|
-
return {
|
|
52
|
-
title: i18next.t('title.rack list'),
|
|
46
|
+
return { title: i18next.t('title.rack list'),
|
|
53
47
|
help: 'rack-base/rack',
|
|
54
48
|
actions: [
|
|
55
|
-
{
|
|
56
|
-
title: i18next.t('button.save'),
|
|
49
|
+
{ title: i18next.t('button.save'),
|
|
57
50
|
action: this._updateRack.bind(this),
|
|
58
51
|
...CommonButtonStyles.save
|
|
59
52
|
},
|
|
60
|
-
{
|
|
61
|
-
title: i18next.t('button.delete'),
|
|
53
|
+
{ title: i18next.t('button.delete'),
|
|
62
54
|
action: this._deleteRack.bind(this),
|
|
63
55
|
...CommonButtonStyles.delete
|
|
64
56
|
}
|
|
65
57
|
],
|
|
66
|
-
exportable: {
|
|
67
|
-
name: i18next.t('title.rack list'),
|
|
58
|
+
exportable: { name: i18next.t('title.rack list'),
|
|
68
59
|
data: this.exportHandler.bind(this)
|
|
69
60
|
},
|
|
70
|
-
importable: {
|
|
71
|
-
handler: this.importHandler.bind(this)
|
|
61
|
+
importable: { handler: this.importHandler.bind(this)
|
|
72
62
|
}
|
|
73
63
|
};
|
|
74
64
|
}
|
|
@@ -91,113 +81,90 @@ let RackListPage = class RackListPage extends connect(store)(localize(i18next)(S
|
|
|
91
81
|
`;
|
|
92
82
|
}
|
|
93
83
|
async pageInitialized(lifecycle) {
|
|
94
|
-
this.gristConfig = {
|
|
95
|
-
list: {
|
|
96
|
-
fields: ['name', 'description'],
|
|
84
|
+
this.gristConfig = { list: { fields: ['name', 'description'],
|
|
97
85
|
details: ['active', 'updatedAt']
|
|
98
86
|
},
|
|
99
87
|
columns: [
|
|
100
88
|
{ type: 'gutter', gutterName: 'sequence' },
|
|
101
89
|
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
102
|
-
{
|
|
103
|
-
type: 'string',
|
|
90
|
+
{ type: 'string',
|
|
104
91
|
name: 'name',
|
|
105
92
|
header: i18next.t('field.name'),
|
|
106
|
-
record: {
|
|
107
|
-
editable: true
|
|
93
|
+
record: { editable: true
|
|
108
94
|
},
|
|
109
95
|
filter: 'search',
|
|
110
96
|
sortable: true,
|
|
111
97
|
width: 150
|
|
112
98
|
},
|
|
113
|
-
{
|
|
114
|
-
type: 'string',
|
|
99
|
+
{ type: 'string',
|
|
115
100
|
name: 'description',
|
|
116
101
|
header: i18next.t('field.description'),
|
|
117
|
-
record: {
|
|
118
|
-
editable: true
|
|
102
|
+
record: { editable: true
|
|
119
103
|
},
|
|
120
104
|
filter: 'search',
|
|
121
105
|
width: 200
|
|
122
106
|
},
|
|
123
|
-
{
|
|
124
|
-
type: 'checkbox',
|
|
107
|
+
{ type: 'checkbox',
|
|
125
108
|
name: 'active',
|
|
126
109
|
label: true,
|
|
127
110
|
header: i18next.t('field.active'),
|
|
128
|
-
record: {
|
|
129
|
-
editable: true
|
|
111
|
+
record: { editable: true
|
|
130
112
|
},
|
|
131
113
|
filter: true,
|
|
132
114
|
sortable: true,
|
|
133
115
|
width: 60
|
|
134
116
|
},
|
|
135
|
-
{
|
|
136
|
-
type: 'resource-object',
|
|
117
|
+
{ type: 'resource-object',
|
|
137
118
|
name: 'updater',
|
|
138
119
|
header: i18next.t('field.updater'),
|
|
139
|
-
record: {
|
|
140
|
-
editable: false
|
|
120
|
+
record: { editable: false
|
|
141
121
|
},
|
|
142
122
|
sortable: true,
|
|
143
123
|
width: 120
|
|
144
124
|
},
|
|
145
|
-
{
|
|
146
|
-
type: 'datetime',
|
|
125
|
+
{ type: 'datetime',
|
|
147
126
|
name: 'updatedAt',
|
|
148
127
|
header: i18next.t('field.updated_at'),
|
|
149
|
-
record: {
|
|
150
|
-
editable: false
|
|
128
|
+
record: { editable: false
|
|
151
129
|
},
|
|
152
130
|
sortable: true,
|
|
153
131
|
width: 180
|
|
154
132
|
}
|
|
155
133
|
],
|
|
156
|
-
rows: {
|
|
157
|
-
selectable: {
|
|
158
|
-
multiple: true
|
|
134
|
+
rows: { selectable: { multiple: true
|
|
159
135
|
}
|
|
160
136
|
},
|
|
161
137
|
sorters: [
|
|
162
|
-
{
|
|
163
|
-
name: 'name'
|
|
138
|
+
{ name: 'name'
|
|
164
139
|
}
|
|
165
140
|
]
|
|
166
141
|
};
|
|
167
142
|
}
|
|
168
143
|
async pageUpdated(changes, lifecycle) {
|
|
169
|
-
if (this.active) {
|
|
170
|
-
// do something here when this page just became as active
|
|
144
|
+
if (this.active) { // do something here when this page just became as active
|
|
171
145
|
}
|
|
172
146
|
}
|
|
173
147
|
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }) {
|
|
174
|
-
const response = await client.query({
|
|
175
|
-
|
|
176
|
-
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
177
|
-
responses: racks(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
178
|
-
items {
|
|
179
|
-
id
|
|
148
|
+
const response = await client.query({ query: gql `
|
|
149
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: racks(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id
|
|
180
150
|
name
|
|
181
151
|
description
|
|
182
152
|
active
|
|
183
|
-
updater {
|
|
184
|
-
id
|
|
153
|
+
updater { id
|
|
185
154
|
name
|
|
186
|
-
|
|
155
|
+
}
|
|
187
156
|
updatedAt
|
|
188
|
-
|
|
157
|
+
}
|
|
189
158
|
total
|
|
190
|
-
|
|
191
|
-
|
|
159
|
+
}
|
|
160
|
+
}
|
|
192
161
|
`,
|
|
193
|
-
variables: {
|
|
194
|
-
filters,
|
|
162
|
+
variables: { filters,
|
|
195
163
|
pagination: { page, limit },
|
|
196
164
|
sortings
|
|
197
165
|
}
|
|
198
166
|
});
|
|
199
|
-
return {
|
|
200
|
-
total: response.data.responses.total || 0,
|
|
167
|
+
return { total: response.data.responses.total || 0,
|
|
201
168
|
records: response.data.responses.items || []
|
|
202
169
|
};
|
|
203
170
|
}
|
|
@@ -205,20 +172,16 @@ let RackListPage = class RackListPage extends connect(store)(localize(i18next)(S
|
|
|
205
172
|
if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
|
|
206
173
|
const ids = this.grist.selected.map(record => record.id);
|
|
207
174
|
if (ids && ids.length > 0) {
|
|
208
|
-
const response = await client.mutate({
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
deleteRacks(ids: $ids)
|
|
212
|
-
}
|
|
175
|
+
const response = await client.mutate({ mutation: gql `
|
|
176
|
+
mutation ($ids: [String!]!) { deleteRacks(ids: $ids)
|
|
177
|
+
}
|
|
213
178
|
`,
|
|
214
|
-
variables: {
|
|
215
|
-
ids
|
|
179
|
+
variables: { ids
|
|
216
180
|
}
|
|
217
181
|
});
|
|
218
182
|
if (!response.errors) {
|
|
219
183
|
this.grist.fetch();
|
|
220
|
-
notify({
|
|
221
|
-
message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
184
|
+
notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
|
|
222
185
|
});
|
|
223
186
|
}
|
|
224
187
|
}
|
|
@@ -236,16 +199,12 @@ let RackListPage = class RackListPage extends connect(store)(localize(i18next)(S
|
|
|
236
199
|
patchField.cuFlag = patch.__dirty__;
|
|
237
200
|
return patchField;
|
|
238
201
|
});
|
|
239
|
-
const response = await client.mutate({
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
name
|
|
244
|
-
}
|
|
245
|
-
}
|
|
202
|
+
const response = await client.mutate({ mutation: gql `
|
|
203
|
+
mutation ($patches: [RackPatch!]!) { updateMultipleRack(patches: $patches) { name
|
|
204
|
+
}
|
|
205
|
+
}
|
|
246
206
|
`,
|
|
247
|
-
variables: {
|
|
248
|
-
patches
|
|
207
|
+
variables: { patches
|
|
249
208
|
}
|
|
250
209
|
});
|
|
251
210
|
if (!response.errors) {
|
|
@@ -273,8 +232,7 @@ let RackListPage = class RackListPage extends connect(store)(localize(i18next)(S
|
|
|
273
232
|
this.grist.fetch();
|
|
274
233
|
}}
|
|
275
234
|
></rack-importer>
|
|
276
|
-
`, {
|
|
277
|
-
backdrop: true,
|
|
235
|
+
`, { backdrop: true,
|
|
278
236
|
size: 'large',
|
|
279
237
|
title: i18next.t('title.import rack')
|
|
280
238
|
});
|