@things-factory/i18n-base 7.0.1-alpha.71 → 7.0.1-alpha.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.
- package/client/page/terminology-page.ts +376 -0
- package/client/route.ts +7 -0
- package/dist-client/page/terminology-page.d.ts +73 -0
- package/dist-client/page/terminology-page.js +363 -0
- package/dist-client/page/terminology-page.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +8 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/terminology/terminology.js +1 -1
- package/dist-server/service/terminology/terminology.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/server/service/index.ts +2 -2
- package/server/service/terminology/terminology.ts +1 -1
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@material/web/icon/icon.js';
|
|
3
|
+
import '@operato/data-grist';
|
|
4
|
+
import '@operato/context/ox-context-page-toolbar.js';
|
|
5
|
+
import '@operato/input/ox-input-select-buttons.js';
|
|
6
|
+
import { css, html } from 'lit';
|
|
7
|
+
import { customElement, query, state } from 'lit/decorators.js';
|
|
8
|
+
import { connect } from 'pwa-helpers/connect-mixin.js';
|
|
9
|
+
import { store, PageView } from '@operato/shell';
|
|
10
|
+
import { DataGrist } from '@operato/data-grist';
|
|
11
|
+
import { i18next, localize } from '@operato/i18n';
|
|
12
|
+
import { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles';
|
|
13
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js';
|
|
14
|
+
import { isMobileDevice } from '@operato/utils';
|
|
15
|
+
let TerminologyPage = class TerminologyPage extends connect(store)(localize(i18next)(PageView)) {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.mode = isMobileDevice() ? 'CARD' : 'GRID';
|
|
19
|
+
}
|
|
20
|
+
get context() {
|
|
21
|
+
var _a;
|
|
22
|
+
return {
|
|
23
|
+
title: i18next.t('menu.Terminology'),
|
|
24
|
+
search: {
|
|
25
|
+
handler: (search) => {
|
|
26
|
+
this.grist.searchText = search;
|
|
27
|
+
},
|
|
28
|
+
value: ((_a = this.grist) === null || _a === void 0 ? void 0 : _a.searchText) || ''
|
|
29
|
+
},
|
|
30
|
+
filter: {
|
|
31
|
+
handler: () => {
|
|
32
|
+
this.grist.toggleHeadroom();
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
help: 'mfg-warehouse/term-page',
|
|
36
|
+
actions: [
|
|
37
|
+
{
|
|
38
|
+
title: i18next.t('button.delete'),
|
|
39
|
+
action: this.delete.bind(this),
|
|
40
|
+
icon: 'delete'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
title: i18next.t('button.save'),
|
|
44
|
+
action: this.save.bind(this),
|
|
45
|
+
icon: 'save'
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
title: i18next.t('button.print'),
|
|
49
|
+
action: this.print.bind(this),
|
|
50
|
+
icon: 'print'
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
exportable: {
|
|
54
|
+
name: i18next.t('button.export'),
|
|
55
|
+
data: this.exportHandler.bind(this)
|
|
56
|
+
},
|
|
57
|
+
toolbar: false
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
getFilterStatus() {
|
|
61
|
+
return [
|
|
62
|
+
{
|
|
63
|
+
display: '한국어',
|
|
64
|
+
value: 'ko-KR'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
display: 'English',
|
|
68
|
+
value: 'en-US'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
display: '中文',
|
|
72
|
+
value: 'zh-CN'
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
display: '日本語',
|
|
76
|
+
value: 'ja-JP'
|
|
77
|
+
}
|
|
78
|
+
];
|
|
79
|
+
}
|
|
80
|
+
render() {
|
|
81
|
+
const mode = this.mode || (isMobileDevice() ? 'LIST' : 'GRID');
|
|
82
|
+
return html `
|
|
83
|
+
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
84
|
+
<div slot="headroom" class="header">
|
|
85
|
+
<div class="title">${i18next.t('title.Terminology')}</div>
|
|
86
|
+
|
|
87
|
+
<div class="filters">
|
|
88
|
+
<ox-input-select-buttons
|
|
89
|
+
.value=${this.state}
|
|
90
|
+
.options=${this.getFilterStatus()}
|
|
91
|
+
@change=${(e) => {
|
|
92
|
+
var _a;
|
|
93
|
+
this.state = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value;
|
|
94
|
+
this.grist.fetch();
|
|
95
|
+
}}
|
|
96
|
+
></ox-input-select-buttons>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
<ox-context-page-toolbar class="actions" .context=${this.context}></ox-context-page-toolbar>
|
|
100
|
+
</div>
|
|
101
|
+
</ox-grist>
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
104
|
+
async pageInitialized(lifecycle) {
|
|
105
|
+
this.gristConfig = {
|
|
106
|
+
list: {
|
|
107
|
+
fields: ['name', 'description'],
|
|
108
|
+
details: ['active', 'updatedAt']
|
|
109
|
+
},
|
|
110
|
+
columns: [
|
|
111
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
112
|
+
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
113
|
+
{
|
|
114
|
+
type: 'string',
|
|
115
|
+
name: 'id',
|
|
116
|
+
header: i18next.t('label.id'),
|
|
117
|
+
hidden: true,
|
|
118
|
+
width: 0
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
type: 'string',
|
|
122
|
+
name: 'name',
|
|
123
|
+
header: i18next.t('label.name'),
|
|
124
|
+
record: {
|
|
125
|
+
editable: true
|
|
126
|
+
},
|
|
127
|
+
filter: 'search',
|
|
128
|
+
sortable: true,
|
|
129
|
+
width: 150
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
type: 'string',
|
|
133
|
+
name: 'locale',
|
|
134
|
+
header: i18next.t('label.locale'),
|
|
135
|
+
record: {
|
|
136
|
+
editable: true
|
|
137
|
+
},
|
|
138
|
+
width: 200
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
type: 'select',
|
|
142
|
+
name: 'category',
|
|
143
|
+
label: true,
|
|
144
|
+
header: i18next.t('label.category'),
|
|
145
|
+
record: {
|
|
146
|
+
editable: false,
|
|
147
|
+
options: [{ display: '', value: '' }, ...this.getFilterStatus()]
|
|
148
|
+
},
|
|
149
|
+
width: 100,
|
|
150
|
+
filter: true,
|
|
151
|
+
imex: true
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
type: 'string',
|
|
155
|
+
name: 'display',
|
|
156
|
+
label: true,
|
|
157
|
+
header: i18next.t('label.display'),
|
|
158
|
+
record: {
|
|
159
|
+
editable: true
|
|
160
|
+
},
|
|
161
|
+
filter: true,
|
|
162
|
+
sortable: true,
|
|
163
|
+
width: 250
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
type: 'resource-object',
|
|
167
|
+
name: 'updater',
|
|
168
|
+
header: i18next.t('label.updater'),
|
|
169
|
+
record: {
|
|
170
|
+
editable: false
|
|
171
|
+
},
|
|
172
|
+
sortable: true,
|
|
173
|
+
width: 120
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
type: 'datetime',
|
|
177
|
+
name: 'updatedAt',
|
|
178
|
+
header: i18next.t('label.updated_at'),
|
|
179
|
+
record: {
|
|
180
|
+
editable: false
|
|
181
|
+
},
|
|
182
|
+
sortable: true,
|
|
183
|
+
width: 180
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
rows: {
|
|
187
|
+
appendable: false,
|
|
188
|
+
selectable: {
|
|
189
|
+
multiple: true
|
|
190
|
+
}
|
|
191
|
+
/*handlers: {
|
|
192
|
+
click: (columns, data, column, record, rowIndex) => {
|
|
193
|
+
// TODO Implement the desired sub-view(like item-view) and use it in the popup content after importing
|
|
194
|
+
const popup = openPopup(html`
|
|
195
|
+
<item-view item-id=${record.id} style="background-color: white;">
|
|
196
|
+
</item-view>
|
|
197
|
+
`, {
|
|
198
|
+
backdrop: true,
|
|
199
|
+
size: 'large',
|
|
200
|
+
title: i18next.t('text.item view')
|
|
201
|
+
})
|
|
202
|
+
popup.onclosed = () => {
|
|
203
|
+
this.grist.fetch()
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}*/
|
|
207
|
+
},
|
|
208
|
+
sorters: [
|
|
209
|
+
{
|
|
210
|
+
name: 'name',
|
|
211
|
+
desc: true
|
|
212
|
+
}
|
|
213
|
+
]
|
|
214
|
+
};
|
|
215
|
+
await this.updateComplete;
|
|
216
|
+
this.grist.fetch();
|
|
217
|
+
}
|
|
218
|
+
async pageUpdated(changes, lifecycle) {
|
|
219
|
+
if (this.active) {
|
|
220
|
+
// do something here when this page just became as active
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }) {
|
|
224
|
+
let url = 'terminologies';
|
|
225
|
+
let selectFields = 'id,name,locale,category,display,created_at,updated_at,creator,updater';
|
|
226
|
+
let result = null; // await ServiceUtil.searchByPagination(url, filters, sortings, page, limit, selectFields)
|
|
227
|
+
return {
|
|
228
|
+
total: result ? result.total : 0,
|
|
229
|
+
records: result ? result.items : []
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
exportHandler() {
|
|
233
|
+
let records = [];
|
|
234
|
+
if (this.grist.selected && this.grist.selected.length > 0) {
|
|
235
|
+
records = this.grist.selected;
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
records = this.grist.data.records;
|
|
239
|
+
}
|
|
240
|
+
var headerSetting = this.grist.compiledConfig.columns
|
|
241
|
+
.filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
|
|
242
|
+
.map(column => {
|
|
243
|
+
return column.imex === true
|
|
244
|
+
? {
|
|
245
|
+
header: column.header.renderer(column),
|
|
246
|
+
key: column.name,
|
|
247
|
+
width: column.width,
|
|
248
|
+
type: column.type
|
|
249
|
+
}
|
|
250
|
+
: column.imex;
|
|
251
|
+
});
|
|
252
|
+
var data = records.map(item => {
|
|
253
|
+
return Object.assign({ id: item.id }, this.gristConfig.columns
|
|
254
|
+
.filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)
|
|
255
|
+
.reduce((record, column) => {
|
|
256
|
+
const key = column.imex === true ? column.name : column.imex.key;
|
|
257
|
+
record[key] = key
|
|
258
|
+
.split('.')
|
|
259
|
+
.reduce((obj, key) => (obj && obj[key] !== 'undefined' ? obj[key] : undefined), item);
|
|
260
|
+
return record;
|
|
261
|
+
}, {}));
|
|
262
|
+
});
|
|
263
|
+
return { header: headerSetting, data: data };
|
|
264
|
+
}
|
|
265
|
+
async delete() {
|
|
266
|
+
const selectedRecords = this.grist.selected;
|
|
267
|
+
if (!selectedRecords || selectedRecords.length == 0) {
|
|
268
|
+
// showToast('info', i18next.t('text.NOTHING_SELECTED'))
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
const answer = null; // await showAlertPopup('button.delete', 'text.are_you_sure', 'question', 'delete', 'cancel')
|
|
272
|
+
if (answer) {
|
|
273
|
+
let patches = selectedRecords.map(record => {
|
|
274
|
+
record['cud_flag_'] = 'd';
|
|
275
|
+
return record;
|
|
276
|
+
});
|
|
277
|
+
return null; // await ServiceUtil.deleteMultiple('terminologies/update_multiple', patches)
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
async save() {
|
|
282
|
+
let changedRecords = this.grist.dirtyRecords;
|
|
283
|
+
if (!changedRecords || changedRecords.length == 0) {
|
|
284
|
+
// showToast('info', i18next.t('text.NOTHING_CHANGED'))
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
let metaFields = [
|
|
288
|
+
'creator',
|
|
289
|
+
'updater',
|
|
290
|
+
'createdAt',
|
|
291
|
+
'updatedAt',
|
|
292
|
+
'__dirty__',
|
|
293
|
+
'__dirtyfields__',
|
|
294
|
+
'__origin__',
|
|
295
|
+
'__seq__',
|
|
296
|
+
'__selected__'
|
|
297
|
+
];
|
|
298
|
+
let patches = changedRecords.map(record => {
|
|
299
|
+
let patchData = record.id ? { id: record.id } : {};
|
|
300
|
+
for (let key in record) {
|
|
301
|
+
if (!metaFields.includes(key)) {
|
|
302
|
+
patchData[key] = record[key];
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
patchData['cud_flag_'] = record['__dirty__'] == 'M' ? 'u' : 'c';
|
|
306
|
+
return patchData;
|
|
307
|
+
});
|
|
308
|
+
//await ServiceUtil.updateMultiple('terminologies/update_multiple', patches)
|
|
309
|
+
this.grist.fetch();
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
print() {
|
|
313
|
+
const selected = this.grist.selected;
|
|
314
|
+
const ids = selected.map(record => record.id).join('|');
|
|
315
|
+
/* TODO Implement the desired functionality */
|
|
316
|
+
OxPrompt.open({
|
|
317
|
+
type: 'success',
|
|
318
|
+
title: i18next.t('text.completed'),
|
|
319
|
+
text: i18next.t('text.printed_successfully'),
|
|
320
|
+
confirmButton: { text: i18next.t('button.confirm') }
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
TerminologyPage.styles = [
|
|
325
|
+
ScrollbarStyles,
|
|
326
|
+
CommonHeaderStyles,
|
|
327
|
+
css `
|
|
328
|
+
:host {
|
|
329
|
+
display: flex;
|
|
330
|
+
flex-direction: column;
|
|
331
|
+
|
|
332
|
+
overflow: hidden;
|
|
333
|
+
|
|
334
|
+
--grid-header-padding: 2px 0 2px 9px;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
ox-grist {
|
|
338
|
+
overflow-y: auto;
|
|
339
|
+
flex: 1;
|
|
340
|
+
}
|
|
341
|
+
`
|
|
342
|
+
];
|
|
343
|
+
__decorate([
|
|
344
|
+
state(),
|
|
345
|
+
__metadata("design:type", Object)
|
|
346
|
+
], TerminologyPage.prototype, "gristConfig", void 0);
|
|
347
|
+
__decorate([
|
|
348
|
+
state(),
|
|
349
|
+
__metadata("design:type", String)
|
|
350
|
+
], TerminologyPage.prototype, "mode", void 0);
|
|
351
|
+
__decorate([
|
|
352
|
+
state(),
|
|
353
|
+
__metadata("design:type", Array)
|
|
354
|
+
], TerminologyPage.prototype, "state", void 0);
|
|
355
|
+
__decorate([
|
|
356
|
+
query('ox-grist'),
|
|
357
|
+
__metadata("design:type", DataGrist)
|
|
358
|
+
], TerminologyPage.prototype, "grist", void 0);
|
|
359
|
+
TerminologyPage = __decorate([
|
|
360
|
+
customElement('terminology-page')
|
|
361
|
+
], TerminologyPage);
|
|
362
|
+
export { TerminologyPage };
|
|
363
|
+
//# sourceMappingURL=terminology-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terminology-page.js","sourceRoot":"","sources":["../../client/page/terminology-page.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,qBAAqB,CAAA;AAC5B,OAAO,6CAA6C,CAAA;AACpD,OAAO,2CAA2C,CAAA;AAElD,OAAO,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAY,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAGtD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEhD,OAAO,EAAE,SAAS,EAA4B,MAAM,qBAAqB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,M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,CAAC,QAAQ,CAAA;QACpC,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAEvD,8CAA8C;QAE9C,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC;YAClC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,2BAA2B,CAAC;YAC5C,aAAa,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,EAAE;SACrD,CAAC,CAAA;IACJ,CAAC;;AAhWM,sBAAM,GAAG;IACd,eAAe;IACf,kBAAkB;IAClB,GAAG,CAAA;;;;;;;;;;;;;;KAcF;CACF,CAAA;AAED;IAAC,KAAK,EAAE;;oDAAyB;AACjC;IAAC,KAAK,EAAE;;6CAA4E;AACpF;IAAC,KAAK,EAAE;;8CAAyB;AAEjC;IAAC,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;8CAAA;AAzBjC,eAAe;IAD3B,aAAa,CAAC,kBAAkB,CAAC;GACrB,eAAe,CAkW3B;SAlWY,eAAe","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport '@operato/data-grist'\nimport '@operato/context/ox-context-page-toolbar.js'\nimport '@operato/input/ox-input-select-buttons.js'\n\nimport { PropertyValues, css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\nimport gql from 'graphql-tag'\n\nimport { store, PageView } from '@operato/shell'\nimport { client } from '@operato/graphql'\nimport { DataGrist, FetchOption, GristRecord } from '@operato/data-grist'\nimport { i18next, localize } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\nimport { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { isMobileDevice } from '@operato/utils'\n\n@customElement('terminology-page')\nexport class TerminologyPage extends connect(store)(localize(i18next)(PageView)) {\n static styles = [\n ScrollbarStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n overflow: hidden;\n\n --grid-header-padding: 2px 0 2px 9px;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n @state() private gristConfig: any\n @state() private mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n @state() private state?: string[]\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('menu.Terminology'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n help: 'mfg-warehouse/term-page',\n actions: [\n {\n title: i18next.t('button.delete'),\n action: this.delete.bind(this),\n icon: 'delete'\n },\n {\n title: i18next.t('button.save'),\n action: this.save.bind(this),\n icon: 'save'\n },\n {\n title: i18next.t('button.print'),\n action: this.print.bind(this),\n icon: 'print'\n }\n ],\n exportable: {\n name: i18next.t('button.export'),\n data: this.exportHandler.bind(this)\n },\n toolbar: false\n }\n }\n\n getFilterStatus() {\n return [\n {\n display: '한국어',\n value: 'ko-KR'\n },\n {\n display: 'English',\n value: 'en-US'\n },\n {\n display: '中文',\n value: 'zh-CN'\n },\n {\n display: '日本語',\n value: 'ja-JP'\n }\n ]\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'LIST' : '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=\"title\">${i18next.t('title.Terminology')}</div>\n\n <div class=\"filters\">\n <ox-input-select-buttons\n .value=${this.state}\n .options=${this.getFilterStatus()}\n @change=${(e: CustomEvent) => {\n this.state = (e.currentTarget as any)?.value\n this.grist.fetch()\n }}\n ></ox-input-select-buttons>\n </div>\n\n <ox-context-page-toolbar class=\"actions\" .context=${this.context}></ox-context-page-toolbar>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle) {\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: 'id',\n header: i18next.t('label.id'),\n hidden: true,\n width: 0\n },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('label.name'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n {\n type: 'string',\n name: 'locale',\n header: i18next.t('label.locale'),\n record: {\n editable: true\n },\n width: 200\n },\n {\n type: 'select',\n name: 'category',\n label: true,\n header: i18next.t('label.category'),\n record: {\n editable: false,\n options: [{ display: '', value: '' }, ...this.getFilterStatus()]\n },\n width: 100,\n filter: true,\n imex: true\n },\n {\n type: 'string',\n name: 'display',\n label: true,\n header: i18next.t('label.display'),\n record: {\n editable: true\n },\n filter: true,\n sortable: true,\n width: 250\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: i18next.t('label.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('label.updated_at'),\n record: {\n editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: {\n appendable: false,\n selectable: {\n multiple: true\n }\n /*handlers: {\n click: (columns, data, column, record, rowIndex) => {\n // TODO Implement the desired sub-view(like item-view) and use it in the popup content after importing\n const popup = openPopup(html` \n <item-view item-id=${record.id} style=\"background-color: white;\">\n </item-view> \n `, {\n backdrop: true,\n size: 'large',\n title: i18next.t('text.item view')\n })\n popup.onclosed = () => {\n this.grist.fetch()\n }\n }\n }*/\n },\n sorters: [\n {\n name: 'name',\n desc: true\n }\n ]\n }\n\n await this.updateComplete\n\n this.grist.fetch()\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 let url = 'terminologies'\n let selectFields = 'id,name,locale,category,display,created_at,updated_at,creator,updater'\n let result = null as any // await ServiceUtil.searchByPagination(url, filters, sortings, page, limit, selectFields)\n\n return {\n total: result ? result.total : 0,\n records: result ? result.items : []\n }\n }\n\n exportHandler() {\n let records = [] as GristRecord\n if (this.grist.selected && this.grist.selected.length > 0) {\n records = this.grist.selected\n } else {\n records = this.grist.data.records\n }\n\n var headerSetting = this.grist.compiledConfig.columns\n .filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)\n .map(column => {\n return column.imex === true\n ? {\n header: column.header.renderer(column),\n key: column.name,\n width: column.width,\n type: column.type\n }\n : column.imex\n })\n\n var data = records.map(item => {\n return {\n id: item.id,\n ...this.gristConfig.columns\n .filter(column => column.type !== 'gutter' && column.record !== undefined && column.imex !== undefined)\n .reduce((record, column) => {\n const key = column.imex === true ? column.name : column.imex.key\n record[key] = key\n .split('.')\n .reduce((obj, key) => (obj && obj[key] !== 'undefined' ? obj[key] : undefined), item)\n return record\n }, {})\n }\n })\n\n return { header: headerSetting, data: data }\n }\n\n async delete() {\n const selectedRecords = this.grist.selected\n\n if (!selectedRecords || selectedRecords.length == 0) {\n // showToast('info', i18next.t('text.NOTHING_SELECTED'))\n } else {\n const answer = null // await showAlertPopup('button.delete', 'text.are_you_sure', 'question', 'delete', 'cancel')\n\n if (answer) {\n let patches = selectedRecords.map(record => {\n record['cud_flag_'] = 'd'\n return record\n })\n\n return null // await ServiceUtil.deleteMultiple('terminologies/update_multiple', patches)\n }\n }\n }\n\n async save() {\n let changedRecords = this.grist.dirtyRecords\n\n if (!changedRecords || changedRecords.length == 0) {\n // showToast('info', i18next.t('text.NOTHING_CHANGED'))\n } else {\n let metaFields = [\n 'creator',\n 'updater',\n 'createdAt',\n 'updatedAt',\n '__dirty__',\n '__dirtyfields__',\n '__origin__',\n '__seq__',\n '__selected__'\n ]\n\n let patches = changedRecords.map(record => {\n let patchData = record.id ? { id: record.id } : {}\n\n for (let key in record) {\n if (!metaFields.includes(key)) {\n patchData[key] = record[key]\n }\n }\n\n patchData['cud_flag_'] = record['__dirty__'] == 'M' ? 'u' : 'c'\n return patchData\n })\n\n //await ServiceUtil.updateMultiple('terminologies/update_multiple', patches)\n this.grist.fetch()\n }\n }\n\n print() {\n const selected = this.grist.selected\n const ids = selected.map(record => record.id).join('|')\n\n /* TODO Implement the desired functionality */\n\n OxPrompt.open({\n type: 'success',\n title: i18next.t('text.completed'),\n text: i18next.t('text.printed_successfully'),\n confirmButton: { text: i18next.t('button.confirm') }\n })\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function route(page: any): any;
|
|
@@ -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,aAAa;YAChB,MAAM,CAAC,4BAA4B,CAAC,CAAA;YACpC,OAAO,IAAI,CAAA;KACd;AACH,CAAC","sourcesContent":["export default function route(page) {\n switch (page) {\n case 'terminology':\n import('./page/terminology-page.js')\n return page\n }\n}\n"]}
|