@things-factory/lite-menu 6.2.102 → 6.2.103
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/actions/lite-menu.d.ts +7 -0
- package/dist-client/actions/lite-menu.js +114 -0
- package/dist-client/actions/lite-menu.js.map +1 -0
- package/dist-client/bootstrap.d.ts +4 -0
- package/dist-client/bootstrap.js +14 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/index.d.ts +4 -0
- package/dist-client/index.js +5 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/lite-menu-setting-let.d.ts +13 -0
- package/dist-client/lite-menu-setting-let.js +83 -0
- package/dist-client/lite-menu-setting-let.js.map +1 -0
- package/dist-client/pages/addon-menu-setting.d.ts +7 -0
- package/dist-client/pages/addon-menu-setting.js +480 -0
- package/dist-client/pages/addon-menu-setting.js.map +1 -0
- package/dist-client/reducers/lite-menu.d.ts +14 -0
- package/dist-client/reducers/lite-menu.js +60 -0
- package/dist-client/reducers/lite-menu.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 -0
- package/dist-client/viewparts/lite-menu-landscape-styles.d.ts +1 -0
- package/dist-client/viewparts/lite-menu-landscape-styles.js +149 -0
- package/dist-client/viewparts/lite-menu-landscape-styles.js.map +1 -0
- package/dist-client/viewparts/lite-menu-landscape.d.ts +20 -0
- package/dist-client/viewparts/lite-menu-landscape.js +103 -0
- package/dist-client/viewparts/lite-menu-landscape.js.map +1 -0
- package/dist-client/viewparts/lite-menu-part.d.ts +28 -0
- package/dist-client/viewparts/lite-menu-part.js +143 -0
- package/dist-client/viewparts/lite-menu-part.js.map +1 -0
- package/dist-client/viewparts/lite-menu-portrait-styles.d.ts +1 -0
- package/dist-client/viewparts/lite-menu-portrait-styles.js +147 -0
- package/dist-client/viewparts/lite-menu-portrait-styles.js.map +1 -0
- package/dist-client/viewparts/lite-menu-portrait.d.ts +12 -0
- package/dist-client/viewparts/lite-menu-portrait.js +89 -0
- package/dist-client/viewparts/lite-menu-portrait.js.map +1 -0
- package/dist-client/viewparts/top-menu-bar.d.ts +22 -0
- package/dist-client/viewparts/top-menu-bar.js +150 -0
- package/dist-client/viewparts/top-menu-bar.js.map +1 -0
- package/dist-server/index.js +5 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/service/index.js +19 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/lite-menu/index.js +9 -0
- package/dist-server/service/lite-menu/index.js.map +1 -0
- package/dist-server/service/lite-menu/lite-menu-mutation.js +60 -0
- package/dist-server/service/lite-menu/lite-menu-mutation.js.map +1 -0
- package/dist-server/service/lite-menu/lite-menu-query.js +121 -0
- package/dist-server/service/lite-menu/lite-menu-query.js.map +1 -0
- package/dist-server/service/lite-menu/lite-menu-type.js +114 -0
- package/dist-server/service/lite-menu/lite-menu-type.js.map +1 -0
- package/dist-server/service/lite-menu/lite-menu.js +140 -0
- package/dist-server/service/lite-menu/lite-menu.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/package.json +9 -9
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { __decorate, __metadata } from "tslib";
|
|
3
|
+
import '@operato/data-grist/ox-grist.js';
|
|
4
|
+
import '@operato/data-grist/ox-filters-form.js';
|
|
5
|
+
import '@operato/data-grist/ox-sorters-control.js';
|
|
6
|
+
import '@operato/data-grist/ox-record-creator.js';
|
|
7
|
+
import '@operato/popup/ox-popup.js';
|
|
8
|
+
import '@operato/context/ox-context-page-toolbar.js';
|
|
9
|
+
import '@material/mwc-icon';
|
|
10
|
+
import gql from 'graphql-tag';
|
|
11
|
+
import { css, html } from 'lit';
|
|
12
|
+
import { customElement, query, state } from 'lit/decorators.js';
|
|
13
|
+
import { connect } from 'pwa-helpers/connect-mixin.js';
|
|
14
|
+
import { DataGrist, getEditor, getRenderer } from '@operato/data-grist';
|
|
15
|
+
import { client } from '@operato/graphql';
|
|
16
|
+
import { i18next, localize } from '@operato/i18n';
|
|
17
|
+
import { PageView, store } from '@operato/shell';
|
|
18
|
+
import { ScrollbarStyles, CommonHeaderStyles } from '@operato/styles';
|
|
19
|
+
import { isMobileDevice } from '@operato/utils';
|
|
20
|
+
import { fetchAddonMenus } from '../actions/lite-menu';
|
|
21
|
+
const applicationName = (_a = document.querySelector('meta[name="application-name"]')) === null || _a === void 0 ? void 0 : _a.content;
|
|
22
|
+
let AddonMenuSetting = class AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.mode = isMobileDevice() ? 'CARD' : 'GRID';
|
|
26
|
+
this.menus = [];
|
|
27
|
+
}
|
|
28
|
+
get context() {
|
|
29
|
+
return {
|
|
30
|
+
title: i18next.t('text.addon-menu management'),
|
|
31
|
+
actions: [
|
|
32
|
+
{
|
|
33
|
+
title: i18next.t('button.refresh'),
|
|
34
|
+
action: () => {
|
|
35
|
+
this.onReload();
|
|
36
|
+
},
|
|
37
|
+
icon: 'refresh'
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
title: i18next.t('button.delete'),
|
|
41
|
+
action: () => {
|
|
42
|
+
this.onDelete();
|
|
43
|
+
},
|
|
44
|
+
icon: 'delete'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
title: i18next.t('button.save'),
|
|
48
|
+
action: () => {
|
|
49
|
+
this.onCommit();
|
|
50
|
+
},
|
|
51
|
+
icon: 'save'
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
exportable: {
|
|
55
|
+
accept: ['json'],
|
|
56
|
+
name: 'lite-menu-list',
|
|
57
|
+
data: () => {
|
|
58
|
+
return this.grist.data;
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
toolbar: false
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
render() {
|
|
65
|
+
return html `
|
|
66
|
+
<ox-grist .mode=${this.mode} .config=${this.config} .fetchHandler=${this.fetchHandler}>
|
|
67
|
+
<div slot="headroom" class="header">
|
|
68
|
+
<div class="title">
|
|
69
|
+
<mwc-icon>summarize</mwc-icon>
|
|
70
|
+
${i18next.t('text.addon-menu management')}
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div class="filters">
|
|
74
|
+
<ox-filters-form autofocus without-search></ox-filters-form>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<ox-context-page-toolbar class="actions" .context=${this.context}> </ox-context-page-toolbar>
|
|
78
|
+
</div>
|
|
79
|
+
</ox-grist>
|
|
80
|
+
`;
|
|
81
|
+
}
|
|
82
|
+
stateChanged(state) {
|
|
83
|
+
var _a;
|
|
84
|
+
this.menus = (_a = state.liteMenu) === null || _a === void 0 ? void 0 : _a.menus;
|
|
85
|
+
}
|
|
86
|
+
async onCommit() {
|
|
87
|
+
var grist = this.grist;
|
|
88
|
+
var modifiedList = grist.dirtyRecords.filter(record => record['__dirty__'] == 'M');
|
|
89
|
+
var addedList = grist.dirtyRecords.filter(record => record['__dirty__'] == '+');
|
|
90
|
+
await Promise.all(modifiedList.map(async (record) => {
|
|
91
|
+
var id = record.__origin__.id;
|
|
92
|
+
var patch = {
|
|
93
|
+
name: record.name,
|
|
94
|
+
description: record.description,
|
|
95
|
+
appName: record.appName,
|
|
96
|
+
parent: record.parent,
|
|
97
|
+
rank: record.rank,
|
|
98
|
+
active: record.active,
|
|
99
|
+
privilege: record.privilege,
|
|
100
|
+
type: record.type,
|
|
101
|
+
value: record.value,
|
|
102
|
+
icon: record.icon
|
|
103
|
+
};
|
|
104
|
+
if (record.type == 'group') {
|
|
105
|
+
patch = Object.assign(Object.assign({}, patch), { parent: '' });
|
|
106
|
+
}
|
|
107
|
+
return await client.mutate({
|
|
108
|
+
mutation: gql `
|
|
109
|
+
mutation ($id: String!, $patch: LiteMenuPatch!) {
|
|
110
|
+
updateLiteMenu(id: $id, patch: $patch) {
|
|
111
|
+
id
|
|
112
|
+
name
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
`,
|
|
116
|
+
variables: {
|
|
117
|
+
id,
|
|
118
|
+
patch: patch
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}));
|
|
122
|
+
await Promise.all(addedList.map(async (record) => {
|
|
123
|
+
var liteMenu = {
|
|
124
|
+
name: record.name,
|
|
125
|
+
description: record.description,
|
|
126
|
+
appName: record.appName,
|
|
127
|
+
parent: record.parent,
|
|
128
|
+
rank: record.rank,
|
|
129
|
+
active: record.active,
|
|
130
|
+
privilege: record.privilege,
|
|
131
|
+
type: record.type,
|
|
132
|
+
value: record.value,
|
|
133
|
+
icon: record.icon
|
|
134
|
+
};
|
|
135
|
+
return await client.mutate({
|
|
136
|
+
mutation: gql `
|
|
137
|
+
mutation ($liteMenu: NewLiteMenu!) {
|
|
138
|
+
createLiteMenu(liteMenu: $liteMenu) {
|
|
139
|
+
id
|
|
140
|
+
name
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
`,
|
|
144
|
+
variables: {
|
|
145
|
+
liteMenu
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}));
|
|
149
|
+
grist.fetch();
|
|
150
|
+
fetchAddonMenus(); /* update menu-system */
|
|
151
|
+
}
|
|
152
|
+
onReload() {
|
|
153
|
+
this.grist.fetch();
|
|
154
|
+
}
|
|
155
|
+
async onDelete() {
|
|
156
|
+
var grist = this.grist;
|
|
157
|
+
var deletedList = grist.selected;
|
|
158
|
+
await Promise.all(deletedList.map(async (record) => {
|
|
159
|
+
var id = record.id;
|
|
160
|
+
return await client.mutate({
|
|
161
|
+
mutation: gql `
|
|
162
|
+
mutation ($id: String!) {
|
|
163
|
+
deleteLiteMenu(id: $id)
|
|
164
|
+
}
|
|
165
|
+
`,
|
|
166
|
+
variables: {
|
|
167
|
+
id
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}));
|
|
171
|
+
grist.fetch();
|
|
172
|
+
fetchAddonMenus(); /* update menu-system */
|
|
173
|
+
}
|
|
174
|
+
async pageInitialized() {
|
|
175
|
+
this.config = {
|
|
176
|
+
list: {
|
|
177
|
+
thumbnail: 'value',
|
|
178
|
+
fields: ['name', 'description'],
|
|
179
|
+
details: ['type', 'parent', 'rank', 'updatedAt']
|
|
180
|
+
},
|
|
181
|
+
columns: [
|
|
182
|
+
{
|
|
183
|
+
type: 'gutter',
|
|
184
|
+
gutterName: 'dirty',
|
|
185
|
+
fixed: true
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
type: 'gutter',
|
|
189
|
+
gutterName: 'sequence',
|
|
190
|
+
fixed: true
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
type: 'gutter',
|
|
194
|
+
gutterName: 'row-selector',
|
|
195
|
+
multiple: true,
|
|
196
|
+
fixed: true
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
type: 'string',
|
|
200
|
+
name: 'id',
|
|
201
|
+
hidden: true
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
type: 'string',
|
|
205
|
+
name: 'name',
|
|
206
|
+
header: i18next.t('field.name'),
|
|
207
|
+
fixed: true,
|
|
208
|
+
record: {
|
|
209
|
+
editable: true
|
|
210
|
+
},
|
|
211
|
+
filter: 'search',
|
|
212
|
+
sortable: true,
|
|
213
|
+
width: 120
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
type: 'string',
|
|
217
|
+
name: 'description',
|
|
218
|
+
header: i18next.t('field.description'),
|
|
219
|
+
record: {
|
|
220
|
+
align: 'left',
|
|
221
|
+
editable: true
|
|
222
|
+
},
|
|
223
|
+
filter: 'search',
|
|
224
|
+
width: 200
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
type: 'select',
|
|
228
|
+
name: 'appName',
|
|
229
|
+
header: i18next.t('field.app-name'),
|
|
230
|
+
label: true,
|
|
231
|
+
record: {
|
|
232
|
+
align: 'left',
|
|
233
|
+
editable: true,
|
|
234
|
+
options: ['', applicationName]
|
|
235
|
+
},
|
|
236
|
+
filter: {
|
|
237
|
+
options: ['', applicationName],
|
|
238
|
+
multiple: false,
|
|
239
|
+
operator: 'eq'
|
|
240
|
+
},
|
|
241
|
+
width: 200
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
type: 'select',
|
|
245
|
+
name: 'parent',
|
|
246
|
+
label: true,
|
|
247
|
+
header: i18next.t('field.parent-menu'),
|
|
248
|
+
record: {
|
|
249
|
+
editable: true,
|
|
250
|
+
options: () => {
|
|
251
|
+
const menus = this.menus.filter(menu => menu.type !== 'group');
|
|
252
|
+
return ['', ...menus.map(menu => menu.name)];
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
sortable: true,
|
|
256
|
+
width: 120
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
type: 'number',
|
|
260
|
+
name: 'rank',
|
|
261
|
+
label: true,
|
|
262
|
+
header: i18next.t('field.rank'),
|
|
263
|
+
record: {
|
|
264
|
+
align: 'right',
|
|
265
|
+
editable: true
|
|
266
|
+
},
|
|
267
|
+
sortable: true,
|
|
268
|
+
width: 60
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
type: 'select',
|
|
272
|
+
name: 'type',
|
|
273
|
+
label: true,
|
|
274
|
+
header: i18next.t('field.type'),
|
|
275
|
+
record: {
|
|
276
|
+
editable: true,
|
|
277
|
+
options: ['', 'group', 'page', 'board', 'interactive-board']
|
|
278
|
+
},
|
|
279
|
+
filter: {
|
|
280
|
+
options: ['', 'group', 'page', 'board', 'interactive-board'],
|
|
281
|
+
multiple: false,
|
|
282
|
+
operator: 'eq'
|
|
283
|
+
},
|
|
284
|
+
width: 80
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
type: 'string',
|
|
288
|
+
name: 'value',
|
|
289
|
+
header: i18next.t('field.value'),
|
|
290
|
+
record: {
|
|
291
|
+
editable: true,
|
|
292
|
+
editor: function (value, column, record, rowIndex, field) {
|
|
293
|
+
var type = record.type !== 'board' && record.type !== 'interactive-board' ? 'string' : 'board';
|
|
294
|
+
return getEditor(type)(value, column, record, rowIndex, field);
|
|
295
|
+
},
|
|
296
|
+
renderer: function (value, column, record, rowIndex, field) {
|
|
297
|
+
var type = record.type !== 'board' && record.type !== 'interactive-board' ? 'string' : 'board';
|
|
298
|
+
return getRenderer(type)(value, column, record, rowIndex, field);
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
width: 140
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
type: 'string',
|
|
305
|
+
name: 'icon',
|
|
306
|
+
header: i18next.t('field.icon'),
|
|
307
|
+
record: {
|
|
308
|
+
editable: true
|
|
309
|
+
},
|
|
310
|
+
sortable: false,
|
|
311
|
+
width: 120
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
type: 'boolean',
|
|
315
|
+
name: 'active',
|
|
316
|
+
label: true,
|
|
317
|
+
header: i18next.t('field.active'),
|
|
318
|
+
record: {
|
|
319
|
+
editable: true
|
|
320
|
+
},
|
|
321
|
+
filter: true,
|
|
322
|
+
sortable: true,
|
|
323
|
+
width: 60
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
type: 'privilege',
|
|
327
|
+
name: 'privilege',
|
|
328
|
+
label: true,
|
|
329
|
+
header: i18next.t('field.required privilege'),
|
|
330
|
+
record: {
|
|
331
|
+
editable: true
|
|
332
|
+
},
|
|
333
|
+
sortable: true,
|
|
334
|
+
width: 200
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
type: 'datetime',
|
|
338
|
+
name: 'updatedAt',
|
|
339
|
+
header: i18next.t('field.updated_at'),
|
|
340
|
+
width: 180
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
type: 'datetime',
|
|
344
|
+
name: 'createdAt',
|
|
345
|
+
header: i18next.t('field.created_at'),
|
|
346
|
+
width: 180
|
|
347
|
+
}
|
|
348
|
+
],
|
|
349
|
+
rows: {
|
|
350
|
+
selectable: {
|
|
351
|
+
multiple: true
|
|
352
|
+
},
|
|
353
|
+
handlers: {
|
|
354
|
+
click: 'select-row-toggle'
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
sorters: [
|
|
358
|
+
{
|
|
359
|
+
name: 'parent',
|
|
360
|
+
desc: false
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
name: 'rank',
|
|
364
|
+
desc: false
|
|
365
|
+
}
|
|
366
|
+
],
|
|
367
|
+
pagination: {
|
|
368
|
+
pages: [20, 30, 50, 100, 200]
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
async pageUpdated(changes, lifecycle) {
|
|
373
|
+
if (this.active) {
|
|
374
|
+
await this.updateComplete;
|
|
375
|
+
this.grist.fetch();
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
async fetchHandler({ filters = [], page, limit, sortings = [] }) {
|
|
379
|
+
const response = (await client.query({
|
|
380
|
+
query: gql `
|
|
381
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
382
|
+
responses: liteMenus(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
383
|
+
items {
|
|
384
|
+
id
|
|
385
|
+
name
|
|
386
|
+
description
|
|
387
|
+
appName
|
|
388
|
+
parent
|
|
389
|
+
rank
|
|
390
|
+
type
|
|
391
|
+
value
|
|
392
|
+
board {
|
|
393
|
+
id
|
|
394
|
+
name
|
|
395
|
+
description
|
|
396
|
+
thumbnail
|
|
397
|
+
}
|
|
398
|
+
icon
|
|
399
|
+
active
|
|
400
|
+
privilege {
|
|
401
|
+
category
|
|
402
|
+
privilege
|
|
403
|
+
owner
|
|
404
|
+
super
|
|
405
|
+
}
|
|
406
|
+
createdAt
|
|
407
|
+
updatedAt
|
|
408
|
+
creator {
|
|
409
|
+
id
|
|
410
|
+
name
|
|
411
|
+
}
|
|
412
|
+
updater {
|
|
413
|
+
id
|
|
414
|
+
name
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
total
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
`,
|
|
421
|
+
variables: {
|
|
422
|
+
filters: [
|
|
423
|
+
...filters,
|
|
424
|
+
{
|
|
425
|
+
name: 'appName',
|
|
426
|
+
operator: 'in',
|
|
427
|
+
value: ['', applicationName]
|
|
428
|
+
}
|
|
429
|
+
],
|
|
430
|
+
pagination: { page, limit },
|
|
431
|
+
sortings
|
|
432
|
+
}
|
|
433
|
+
})).data.responses;
|
|
434
|
+
return {
|
|
435
|
+
records: response.items,
|
|
436
|
+
total: response.total
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
liteMenuCreationCallback(liteMenu) {
|
|
440
|
+
console.warn('not implemented yet.');
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
AddonMenuSetting.styles = [
|
|
444
|
+
ScrollbarStyles,
|
|
445
|
+
CommonHeaderStyles,
|
|
446
|
+
css `
|
|
447
|
+
:host {
|
|
448
|
+
display: flex;
|
|
449
|
+
overflow-x: hidden;
|
|
450
|
+
flex-direction: column;
|
|
451
|
+
|
|
452
|
+
width: 100%;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
ox-grist {
|
|
456
|
+
overflow-y: auto;
|
|
457
|
+
flex: 1;
|
|
458
|
+
}
|
|
459
|
+
`
|
|
460
|
+
];
|
|
461
|
+
__decorate([
|
|
462
|
+
state(),
|
|
463
|
+
__metadata("design:type", Object)
|
|
464
|
+
], AddonMenuSetting.prototype, "config", void 0);
|
|
465
|
+
__decorate([
|
|
466
|
+
state(),
|
|
467
|
+
__metadata("design:type", String)
|
|
468
|
+
], AddonMenuSetting.prototype, "mode", void 0);
|
|
469
|
+
__decorate([
|
|
470
|
+
state(),
|
|
471
|
+
__metadata("design:type", Array)
|
|
472
|
+
], AddonMenuSetting.prototype, "menus", void 0);
|
|
473
|
+
__decorate([
|
|
474
|
+
query('ox-grist'),
|
|
475
|
+
__metadata("design:type", DataGrist)
|
|
476
|
+
], AddonMenuSetting.prototype, "grist", void 0);
|
|
477
|
+
AddonMenuSetting = __decorate([
|
|
478
|
+
customElement('addon-menu-setting')
|
|
479
|
+
], AddonMenuSetting);
|
|
480
|
+
//# sourceMappingURL=addon-menu-setting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addon-menu-setting.js","sourceRoot":"","sources":["../../client/pages/addon-menu-setting.ts"],"names":[],"mappings":";;AAAA,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAC/C,OAAO,2CAA2C,CAAA;AAClD,OAAO,0CAA0C,CAAA;AACjD,OAAO,4BAA4B,CAAA;AACnC,OAAO,6CAA6C,CAAA;AACpD,OAAO,oBAAoB,CAAA;AAE3B,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAY,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,MAAM,eAAe,GAAG,MAAC,QAAQ,CAAC,aAAa,CAAC,+BAA+B,CAAqB,0CAAE,O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IAAI,CAAC,SAAS,CAAA;QAEhB,OAAO;YACL,OAAO,EAAE,QAAQ,CAAC,KAAK;YACvB,KAAK,EAAE,QAAQ,CAAC,KAAK;SACtB,CAAA;IACH,CAAC;IAED,wBAAwB,CAAC,QAAQ;QAC/B,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAA;IACtC,CAAC;;AAtdM,uBAAM,GAAG;IACd,eAAe;IACf,kBAAkB;IAClB,GAAG,CAAA;;;;;;;;;;;;;KAaF;CACF,CAAA;AAED;IAAC,KAAK,EAAE;;gDAAY;AACpB;IAAC,KAAK,EAAE;;8CAAoE;AAC5E;IAAC,KAAK,EAAE;;+CAAkB;AAE1B;IAAC,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;+CAAA;AAxBxC,gBAAgB;IADrB,aAAa,CAAC,oBAAoB,CAAC;GAC9B,gBAAgB,CAwdrB","sourcesContent":["import '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\nimport '@operato/data-grist/ox-sorters-control.js'\nimport '@operato/data-grist/ox-record-creator.js'\nimport '@operato/popup/ox-popup.js'\nimport '@operato/context/ox-context-page-toolbar.js'\nimport '@material/mwc-icon'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { DataGrist, getEditor, getRenderer } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { PageView, store } from '@operato/shell'\nimport { ScrollbarStyles, CommonHeaderStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { fetchAddonMenus } from '../actions/lite-menu'\n\nconst applicationName = (document.querySelector('meta[name=\"application-name\"]') as HTMLMetaElement)?.content\n\n@customElement('addon-menu-setting')\nclass AddonMenuSetting extends connect(store)(localize(i18next)(PageView)) {\n static styles = [\n ScrollbarStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n overflow-x: hidden;\n flex-direction: column;\n\n width: 100%;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n @state() config: any\n @state() mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n @state() menus: any[] = []\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('text.addon-menu management'),\n actions: [\n {\n title: i18next.t('button.refresh'),\n action: () => {\n this.onReload()\n },\n icon: 'refresh'\n },\n {\n title: i18next.t('button.delete'),\n action: () => {\n this.onDelete()\n },\n icon: 'delete'\n },\n {\n title: i18next.t('button.save'),\n action: () => {\n this.onCommit()\n },\n icon: 'save'\n }\n ],\n exportable: {\n accept: ['json'],\n name: 'lite-menu-list',\n data: () => {\n return this.grist.data\n }\n },\n toolbar: false\n }\n }\n\n render() {\n return html`\n <ox-grist .mode=${this.mode} .config=${this.config} .fetchHandler=${this.fetchHandler}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"title\">\n <mwc-icon>summarize</mwc-icon>\n ${i18next.t('text.addon-menu management')}\n </div>\n\n <div class=\"filters\">\n <ox-filters-form autofocus without-search></ox-filters-form>\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 stateChanged(state) {\n this.menus = state.liteMenu?.menus\n }\n\n async onCommit() {\n var grist = this.grist\n\n var modifiedList = grist.dirtyRecords.filter(record => record['__dirty__'] == 'M')\n var addedList = grist.dirtyRecords.filter(record => record['__dirty__'] == '+')\n\n await Promise.all(\n modifiedList.map(async record => {\n var id = record.__origin__.id\n var patch = {\n name: record.name,\n description: record.description,\n appName: record.appName,\n parent: record.parent,\n rank: record.rank,\n active: record.active,\n privilege: record.privilege,\n type: record.type,\n value: record.value,\n icon: record.icon\n }\n\n if (record.type == 'group') {\n patch = {\n ...patch,\n parent: ''\n }\n }\n\n return await client.mutate({\n mutation: gql`\n mutation ($id: String!, $patch: LiteMenuPatch!) {\n updateLiteMenu(id: $id, patch: $patch) {\n id\n name\n }\n }\n `,\n variables: {\n id,\n patch: patch\n }\n })\n })\n )\n\n await Promise.all(\n addedList.map(async record => {\n var liteMenu = {\n name: record.name,\n description: record.description,\n appName: record.appName,\n parent: record.parent,\n rank: record.rank,\n active: record.active,\n privilege: record.privilege,\n type: record.type,\n value: record.value,\n icon: record.icon\n }\n\n return await client.mutate({\n mutation: gql`\n mutation ($liteMenu: NewLiteMenu!) {\n createLiteMenu(liteMenu: $liteMenu) {\n id\n name\n }\n }\n `,\n variables: {\n liteMenu\n }\n })\n })\n )\n\n grist.fetch()\n fetchAddonMenus() /* update menu-system */\n }\n\n onReload() {\n this.grist.fetch()\n }\n\n async onDelete() {\n var grist = this.grist\n\n var deletedList = grist.selected\n\n await Promise.all(\n deletedList.map(async record => {\n var id = record.id\n\n return await client.mutate({\n mutation: gql`\n mutation ($id: String!) {\n deleteLiteMenu(id: $id)\n }\n `,\n variables: {\n id\n }\n })\n })\n )\n\n grist.fetch()\n fetchAddonMenus() /* update menu-system */\n }\n\n async pageInitialized() {\n this.config = {\n list: {\n thumbnail: 'value',\n fields: ['name', 'description'],\n details: ['type', 'parent', 'rank', 'updatedAt']\n },\n columns: [\n {\n type: 'gutter',\n gutterName: 'dirty',\n fixed: true\n },\n {\n type: 'gutter',\n gutterName: 'sequence',\n fixed: true\n },\n {\n type: 'gutter',\n gutterName: 'row-selector',\n multiple: true,\n fixed: true\n },\n {\n type: 'string',\n name: 'id',\n hidden: true\n },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n fixed: true,\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 120\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n align: 'left',\n editable: true\n },\n filter: 'search',\n width: 200\n },\n {\n type: 'select',\n name: 'appName',\n header: i18next.t('field.app-name'),\n label: true,\n record: {\n align: 'left',\n editable: true,\n options: ['', applicationName]\n },\n filter: {\n options: ['', applicationName],\n multiple: false,\n operator: 'eq'\n },\n width: 200\n },\n {\n type: 'select',\n name: 'parent',\n label: true,\n header: i18next.t('field.parent-menu'),\n record: {\n editable: true,\n options: () => {\n const menus = this.menus.filter(menu => menu.type !== 'group')\n return ['', ...menus.map(menu => menu.name)]\n }\n },\n sortable: true,\n width: 120\n },\n {\n type: 'number',\n name: 'rank',\n label: true,\n header: i18next.t('field.rank'),\n record: {\n align: 'right',\n editable: true\n },\n sortable: true,\n width: 60\n },\n {\n type: 'select',\n name: 'type',\n label: true,\n header: i18next.t('field.type'),\n record: {\n editable: true,\n options: ['', 'group', 'page', 'board', 'interactive-board']\n },\n filter: {\n options: ['', 'group', 'page', 'board', 'interactive-board'],\n multiple: false,\n operator: 'eq'\n },\n width: 80\n },\n {\n type: 'string',\n name: 'value',\n header: i18next.t('field.value'),\n record: {\n editable: true,\n editor: function (value, column, record, rowIndex, field) {\n var type = record.type !== 'board' && record.type !== 'interactive-board' ? 'string' : 'board'\n return getEditor(type)(value, column, record, rowIndex, field)\n },\n renderer: function (value, column, record, rowIndex, field) {\n var type = record.type !== 'board' && record.type !== 'interactive-board' ? 'string' : 'board'\n return getRenderer(type)(value, column, record, rowIndex, field)\n }\n },\n width: 140\n },\n {\n type: 'string',\n name: 'icon',\n header: i18next.t('field.icon'),\n record: {\n editable: true\n },\n sortable: false,\n width: 120\n },\n {\n type: 'boolean',\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: 'privilege',\n name: 'privilege',\n label: true,\n header: i18next.t('field.required privilege'),\n record: {\n editable: true\n },\n sortable: true,\n width: 200\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n width: 180\n },\n {\n type: 'datetime',\n name: 'createdAt',\n header: i18next.t('field.created_at'),\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n },\n handlers: {\n click: 'select-row-toggle'\n }\n },\n sorters: [\n {\n name: 'parent',\n desc: false\n },\n {\n name: 'rank',\n desc: false\n }\n ],\n pagination: {\n pages: [20, 30, 50, 100, 200]\n }\n }\n }\n\n async pageUpdated(changes, lifecycle) {\n if (this.active) {\n await this.updateComplete\n\n this.grist.fetch()\n }\n }\n\n async fetchHandler({ filters = [], page, limit, sortings = [] }) {\n const response = (\n await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: liteMenus(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n appName\n parent\n rank\n type\n value\n board {\n id\n name\n description\n thumbnail\n }\n icon\n active\n privilege {\n category\n privilege\n owner\n super\n }\n createdAt\n updatedAt\n creator {\n id\n name\n }\n updater {\n id\n name\n }\n }\n total\n }\n }\n `,\n variables: {\n filters: [\n ...filters,\n {\n name: 'appName',\n operator: 'in',\n value: ['', applicationName]\n }\n ],\n pagination: { page, limit },\n sortings\n }\n })\n ).data.responses\n\n return {\n records: response.items,\n total: response.total\n }\n }\n\n liteMenuCreationCallback(liteMenu) {\n console.warn('not implemented yet.')\n }\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const liteMenu: (state: {
|
|
2
|
+
template: never[];
|
|
3
|
+
addon: never[];
|
|
4
|
+
menus: never[];
|
|
5
|
+
} | undefined, action: any) => {
|
|
6
|
+
template: any;
|
|
7
|
+
menus: any;
|
|
8
|
+
addon: never[];
|
|
9
|
+
} | {
|
|
10
|
+
addon: any;
|
|
11
|
+
menus: any;
|
|
12
|
+
template: never[];
|
|
13
|
+
};
|
|
14
|
+
export default liteMenu;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import cloneDeep from 'lodash-es/cloneDeep';
|
|
2
|
+
const INITIAL_STATE = {
|
|
3
|
+
template: [],
|
|
4
|
+
addon: [],
|
|
5
|
+
menus: []
|
|
6
|
+
};
|
|
7
|
+
function buildMenus(template, addon) {
|
|
8
|
+
var menus = cloneDeep(template || []);
|
|
9
|
+
addon = addon || [];
|
|
10
|
+
/* make group by parent */
|
|
11
|
+
const groups = addon
|
|
12
|
+
.filter(menu => menu.active)
|
|
13
|
+
.sort((menu1, menu2) => (menu1.parent || '').localeCompare(menu2.parent || '') || menu1.rank - menu2.rank)
|
|
14
|
+
.reduce((arr, menu) => {
|
|
15
|
+
let lastparent = arr.length > 0 && arr[arr.length - 1][0].parent;
|
|
16
|
+
if (!lastparent || lastparent !== menu.parent) {
|
|
17
|
+
arr.push([menu]);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
arr[arr.length - 1].push(menu);
|
|
21
|
+
}
|
|
22
|
+
return arr;
|
|
23
|
+
}, []) || [];
|
|
24
|
+
/* iterate group to put menu into parent menu */
|
|
25
|
+
groups.forEach(group => {
|
|
26
|
+
group.forEach(menu => {
|
|
27
|
+
const { parent, name, rank, type, value, icon } = menu;
|
|
28
|
+
const parentMenu = parent && menus.find(m => m.name === parent);
|
|
29
|
+
if (parentMenu && !parentMenu.menus) {
|
|
30
|
+
parentMenu.menus = [];
|
|
31
|
+
}
|
|
32
|
+
const children = parentMenu ? parentMenu.menus : menus;
|
|
33
|
+
children.push({
|
|
34
|
+
name,
|
|
35
|
+
type,
|
|
36
|
+
path: type === 'page'
|
|
37
|
+
? value
|
|
38
|
+
: type === 'board'
|
|
39
|
+
? `board-viewer/${value}?title=${name}`
|
|
40
|
+
: type === 'interactive-board'
|
|
41
|
+
? `board-viewer/${value}?interactive=true&title=${name}`
|
|
42
|
+
: '',
|
|
43
|
+
icon: icon || (type === 'page' ? 'menu' : type === 'board' || type === 'interactive-board' ? 'dashboard' : '')
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
return menus;
|
|
48
|
+
}
|
|
49
|
+
const liteMenu = (state = INITIAL_STATE, action) => {
|
|
50
|
+
switch (action.type) {
|
|
51
|
+
case 'UPDATE_MENU_TEMPLATE':
|
|
52
|
+
return Object.assign(Object.assign({}, state), { template: action.template, menus: buildMenus(action.template, state.addon) });
|
|
53
|
+
case 'UPDATE_ADDON_MENUS':
|
|
54
|
+
return Object.assign(Object.assign({}, state), { addon: action.addon, menus: buildMenus(state.template, action.addon) });
|
|
55
|
+
default:
|
|
56
|
+
return state;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
export default liteMenu;
|
|
60
|
+
//# sourceMappingURL=lite-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lite-menu.js","sourceRoot":"","sources":["../../client/reducers/lite-menu.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,qBAAqB,CAAA;AAE3C,MAAM,aAAa,GAAG;IACpB,QAAQ,EAAE,EAAE;IACZ,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,EAAE;CACV,CAAA;AAED,SAAS,UAAU,CAAC,QAAQ,EAAE,KAAK;IACjC,IAAI,KAAK,GAAG,SAAS,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAA;IACrC,KAAK,GAAG,KAAK,IAAI,EAAE,CAAA;IAEnB,0BAA0B;IAC1B,MAAM,MAAM,GACV,KAAK;SACF,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC;SAC3B,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;SACzG,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QACpB,IAAI,UAAU,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAA;QAEhE,IAAI,CAAC,UAA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MAAM,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,mBAAmB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;aAC/G,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,OAAO,KAAK,CAAA;AACd,CAAC;AAED,MAAM,QAAQ,GAAG,CAAC,KAAK,GAAG,aAAa,EAAE,MAAM,EAAE,EAAE;IACjD,QAAQ,MAAM,CAAC,IAAI,EAAE;QACnB,KAAK,sBAAsB;YACzB,uCACK,KAAK,KACR,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,IAChD;QAEH,KAAK,oBAAoB;YACvB,uCACK,KAAK,KACR,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,IAChD;QAEH;YACE,OAAO,KAAK,CAAA;KACf;AACH,CAAC,CAAA;AAED,eAAe,QAAQ,CAAA","sourcesContent":["import cloneDeep from 'lodash-es/cloneDeep'\n\nconst INITIAL_STATE = {\n template: [],\n addon: [],\n menus: []\n}\n\nfunction buildMenus(template, addon) {\n var menus = cloneDeep(template || [])\n addon = addon || []\n\n /* make group by parent */\n const groups =\n addon\n .filter(menu => menu.active)\n .sort((menu1, menu2) => (menu1.parent || '').localeCompare(menu2.parent || '') || menu1.rank - menu2.rank)\n .reduce((arr, menu) => {\n let lastparent = arr.length > 0 && arr[arr.length - 1][0].parent\n\n if (!lastparent || lastparent !== menu.parent) {\n arr.push([menu])\n } else {\n arr[arr.length - 1].push(menu)\n }\n\n return arr\n }, []) || []\n\n /* iterate group to put menu into parent menu */\n groups.forEach(group => {\n group.forEach(menu => {\n const { parent, name, rank, type, value, icon } = menu\n\n const parentMenu = parent && menus.find(m => m.name === parent)\n if (parentMenu && !parentMenu.menus) {\n parentMenu.menus = []\n }\n const children = parentMenu ? parentMenu.menus : menus\n children.push({\n name,\n type,\n path:\n type === 'page'\n ? value\n : type === 'board'\n ? `board-viewer/${value}?title=${name}`\n : type === 'interactive-board'\n ? `board-viewer/${value}?interactive=true&title=${name}`\n : '',\n icon: icon || (type === 'page' ? 'menu' : type === 'board' || type === 'interactive-board' ? 'dashboard' : '')\n })\n })\n })\n\n return menus\n}\n\nconst liteMenu = (state = INITIAL_STATE, action) => {\n switch (action.type) {\n case 'UPDATE_MENU_TEMPLATE':\n return {\n ...state,\n template: action.template,\n menus: buildMenus(action.template, state.addon)\n }\n\n case 'UPDATE_ADDON_MENUS':\n return {\n ...state,\n addon: action.addon,\n menus: buildMenus(state.template, action.addon)\n }\n\n default:\n return state\n }\n}\n\nexport default liteMenu\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,oBAAoB;YACvB,MAAM,CAAC,4BAA4B,CAAC,CAAA;YACpC,OAAO,IAAI,CAAA;KACd;AACH,CAAC","sourcesContent":["export default function route(page) {\n switch (page) {\n case 'addon-menu-setting':\n import('./pages/addon-menu-setting')\n return page\n }\n}\n"]}
|