@things-factory/calendar 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.
@@ -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 { AttendeeImporter } from './attendee-importer';
5
- declare const AttendeeListPage_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 AttendeeListPage_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 AttendeeListPage extends AttendeeListPage_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, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles } from '@operato/styles';
4
- import { PageView, store } from '@operato/shell';
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 { AttendeeImporter } from './attendee-importer';
16
- let AttendeeListPage = class AttendeeListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
15
+ let AttendeeListPage = class AttendeeListPage extends localize(i18next)(ScopedElementsMixin(PageView)) {
17
16
  constructor() {
18
17
  super(...arguments);
19
18
  this.mode = isMobileDevice() ? 'CARD' : 'GRID';
@@ -23,66 +22,53 @@ let AttendeeListPage = class AttendeeListPage extends connect(store)(localize(i1
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
- flex: 1;
42
- }
37
+ ox-filters-form { flex: 1;
38
+ }
43
39
  `
44
40
  ]; }
45
41
  static get scopedElements() {
46
- return {
47
- 'attendee-importer': AttendeeImporter
42
+ return { 'attendee-importer': AttendeeImporter
48
43
  };
49
44
  }
50
45
  get context() {
51
- return {
52
- title: i18next.t('title.attendee list'),
53
- search: {
54
- handler: (search) => {
46
+ return { title: i18next.t('title.attendee list'),
47
+ search: { handler: (search) => {
55
48
  this.grist.searchText = search;
56
49
  },
57
50
  value: this.grist?.searchText || '',
58
- autofocus: true
59
- },
60
- filter: {
61
- handler: () => {
51
+ autofocus: true },
52
+ filter: { handler: () => {
62
53
  this.grist.toggleHeadroom();
63
54
  }
64
55
  },
65
56
  help: 'calendar/attendee',
66
57
  actions: [
67
- {
68
- title: i18next.t('button.save'),
58
+ { title: i18next.t('button.save'),
69
59
  action: this._updateAttendee.bind(this),
70
60
  ...CommonButtonStyles.save
71
61
  },
72
- {
73
- title: i18next.t('button.delete'),
62
+ { title: i18next.t('button.delete'),
74
63
  action: this._deleteAttendee.bind(this),
75
64
  ...CommonButtonStyles.delete
76
65
  }
77
66
  ],
78
- exportable: {
79
- name: i18next.t('title.attendee list'),
67
+ exportable: { name: i18next.t('title.attendee list'),
80
68
  data: this.exportHandler.bind(this)
81
69
  },
82
- importable: {
83
- handler: this.importHandler.bind(this)
84
- }
85
- };
70
+ importable: { handler: this.importHandler.bind(this)
71
+ } };
86
72
  }
87
73
  render() {
88
74
  const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
@@ -103,113 +89,90 @@ let AttendeeListPage = class AttendeeListPage extends connect(store)(localize(i1
103
89
  `;
104
90
  }
105
91
  async pageInitialized(lifecycle) {
106
- this.gristConfig = {
107
- list: {
108
- fields: ['name', 'description'],
92
+ this.gristConfig = { list: { fields: ['name', 'description'],
109
93
  details: ['active', 'updatedAt']
110
94
  },
111
95
  columns: [
112
96
  { type: 'gutter', gutterName: 'sequence' },
113
97
  { type: 'gutter', gutterName: 'row-selector', multiple: true },
114
- {
115
- type: 'string',
98
+ { type: 'string',
116
99
  name: 'name',
117
100
  header: i18next.t('field.name'),
118
- record: {
119
- editable: true
101
+ record: { editable: true
120
102
  },
121
103
  filter: 'search',
122
104
  sortable: true,
123
105
  width: 150
124
106
  },
125
- {
126
- type: 'string',
107
+ { type: 'string',
127
108
  name: 'description',
128
109
  header: i18next.t('field.description'),
129
- record: {
130
- editable: true
110
+ record: { editable: true
131
111
  },
132
112
  filter: 'search',
133
113
  width: 200
134
114
  },
135
- {
136
- type: 'checkbox',
115
+ { type: 'checkbox',
137
116
  name: 'active',
138
117
  label: true,
139
118
  header: i18next.t('field.active'),
140
- record: {
141
- editable: true
119
+ record: { editable: true
142
120
  },
143
121
  filter: true,
144
122
  sortable: true,
145
123
  width: 60
146
124
  },
147
- {
148
- type: 'resource-object',
125
+ { type: 'resource-object',
149
126
  name: 'updater',
150
127
  header: i18next.t('field.updater'),
151
- record: {
152
- editable: false
128
+ record: { editable: false
153
129
  },
154
130
  sortable: true,
155
131
  width: 120
156
132
  },
157
- {
158
- type: 'datetime',
133
+ { type: 'datetime',
159
134
  name: 'updatedAt',
160
135
  header: i18next.t('field.updated_at'),
161
- record: {
162
- editable: false
136
+ record: { editable: false
163
137
  },
164
138
  sortable: true,
165
139
  width: 180
166
140
  }
167
141
  ],
168
- rows: {
169
- selectable: {
170
- multiple: true
142
+ rows: { selectable: { multiple: true
171
143
  }
172
144
  },
173
145
  sorters: [
174
- {
175
- name: 'name'
146
+ { name: 'name'
176
147
  }
177
148
  ]
178
149
  };
179
150
  }
180
151
  async pageUpdated(changes, lifecycle) {
181
- if (this.active) {
182
- // do something here when this page just became as active
152
+ if (this.active) { // do something here when this page just became as active
183
153
  }
184
154
  }
185
155
  async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }) {
186
- const response = await client.query({
187
- query: gql `
188
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
189
- responses: attendees(filters: $filters, pagination: $pagination, sortings: $sortings) {
190
- items {
191
- id
156
+ const response = await client.query({ query: gql `
157
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: attendees(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id
192
158
  name
193
159
  description
194
160
  active
195
- updater {
196
- id
161
+ updater { id
197
162
  name
198
- }
163
+ }
199
164
  updatedAt
200
- }
165
+ }
201
166
  total
202
- }
203
- }
167
+ }
168
+ }
204
169
  `,
205
- variables: {
206
- filters,
170
+ variables: { filters,
207
171
  pagination: { page, limit },
208
172
  sortings
209
173
  }
210
174
  });
211
- return {
212
- total: response.data.responses.total || 0,
175
+ return { total: response.data.responses.total || 0,
213
176
  records: response.data.responses.items || []
214
177
  };
215
178
  }
@@ -217,20 +180,16 @@ let AttendeeListPage = class AttendeeListPage extends connect(store)(localize(i1
217
180
  if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
218
181
  const ids = this.grist.selected.map(record => record.id);
219
182
  if (ids && ids.length > 0) {
220
- const response = await client.mutate({
221
- mutation: gql `
222
- mutation ($ids: [String!]!) {
223
- deleteAttendees(ids: $ids)
224
- }
183
+ const response = await client.mutate({ mutation: gql `
184
+ mutation ($ids: [String!]!) { deleteAttendees(ids: $ids)
185
+ }
225
186
  `,
226
- variables: {
227
- ids
187
+ variables: { ids
228
188
  }
229
189
  });
230
190
  if (!response.errors) {
231
191
  this.grist.fetch();
232
- notify({
233
- message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
192
+ notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
234
193
  });
235
194
  }
236
195
  }
@@ -248,16 +207,12 @@ let AttendeeListPage = class AttendeeListPage extends connect(store)(localize(i1
248
207
  patchField.cuFlag = patch.__dirty__;
249
208
  return patchField;
250
209
  });
251
- const response = await client.mutate({
252
- mutation: gql `
253
- mutation ($patches: [AttendeePatch!]!) {
254
- updateMultipleAttendee(patches: $patches) {
255
- name
256
- }
257
- }
210
+ const response = await client.mutate({ mutation: gql `
211
+ mutation ($patches: [AttendeePatch!]!) { updateMultipleAttendee(patches: $patches) { name
212
+ }
213
+ }
258
214
  `,
259
- variables: {
260
- patches
215
+ variables: { patches
261
216
  }
262
217
  });
263
218
  if (!response.errors) {
@@ -285,8 +240,7 @@ let AttendeeListPage = class AttendeeListPage extends connect(store)(localize(i1
285
240
  this.grist.fetch();
286
241
  }}
287
242
  ></attendee-importer>
288
- `, {
289
- backdrop: true,
243
+ `, { backdrop: true,
290
244
  size: 'large',
291
245
  title: i18next.t('title.import attendee')
292
246
  });
@@ -1 +1 @@
1
- {"version":3,"file":"attendee-list-page.js","sourceRoot":"","sources":["../../../client/pages/attendee/attendee-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,kBAAkB,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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AAM,KAAK,GAAG,SAAS,CACrB,IAAI,CAAA;;uBAEa,OAAO;sBACR,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,uBAAuB,CAAC;SAC1C,CACF,CAAA;QAED,KAAK,CAAC,QAAQ,GAAG,GAAG,EAAE;YACpB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QACpB,CAAC,CAAA;IACH,CAAC;;AA/Q2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAAoE;AAEpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;+CAAA;AAnCjC,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAgT5B","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonButtonStyles, CommonGristStyles, CommonHeaderStyles, 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 { AttendeeImporter } from './attendee-importer'\n\n@customElement('attendee-list-page')\nexport class AttendeeListPage 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 ox-filters-form {\n flex: 1;\n }\n `\n ]\n\n static get scopedElements() {\n return {\n 'attendee-importer': AttendeeImporter\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.attendee list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || '',\n autofocus: true\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n help: 'calendar/attendee',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateAttendee.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteAttendee.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: {\n name: i18next.t('title.attendee 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: attendees(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 _deleteAttendee() {\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 deleteAttendees(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 _updateAttendee() {\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: [AttendeePatch!]!) {\n updateMultipleAttendee(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(attendee => {\n let tempObj = {}\n for (const field of targetFieldSet) {\n tempObj[field] = attendee[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) {\n const popup = openPopup(\n html`\n <attendee-importer\n .attendees=${records}\n @imported=${() => {\n history.back()\n this.grist.fetch()\n }}\n ></attendee-importer>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.import attendee')\n }\n )\n\n popup.onclosed = () => {\n this.grist.fetch()\n }\n }\n}\n"]}
1
+ {"version":3,"file":"attendee-list-page.js","sourceRoot":"","sources":["../../../client/pages/attendee/attendee-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,kBAAkB,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,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AE,CAAA;YAC5C,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QAC7B,CAAC;;OAEK,EACD,EAAU,QAAQ,EAAE,IAAI;YACtB,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,uBAAuB,CAAC;SAC/C,CACG,CAAA;QAED,KAAK,CAAC,QAAQ,GAAG,GAAG,EAAE;YAAS,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QACpD,CAAC,CAAA;IACD,CAAC;;AAlN4B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAAoE;AAEpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;+CAAA;AA7BjC,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CA6O5B","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonButtonStyles, CommonGristStyles, CommonHeaderStyles, 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 { AttendeeImporter } from './attendee-importer'\n\n@customElement('attendee-list-page')\nexport class AttendeeListPage 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 ox-filters-form { flex: 1;\n }\n `\n ]\n\n static get scopedElements() { return { 'attendee-importer': AttendeeImporter\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.attendee list'),\n search: { handler: (search: string) => { this.grist.searchText = search\n },\n value: this.grist?.searchText || '',\n autofocus: true\n },\n filter: { handler: () => { this.grist.toggleHeadroom()\n }\n },\n help: 'calendar/attendee',\n actions: [\n { title: i18next.t('button.save'),\n action: this._updateAttendee.bind(this),\n ...CommonButtonStyles.save\n },\n { title: i18next.t('button.delete'),\n action: this._deleteAttendee.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: { name: i18next.t('title.attendee 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: attendees(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 _deleteAttendee() { 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!]!) { deleteAttendees(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 _updateAttendee() { 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: [AttendeePatch!]!) { updateMultipleAttendee(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(attendee => { let tempObj = {}\n for (const field of targetFieldSet) { tempObj[field] = attendee[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) { const popup = openPopup(\n html`\n <attendee-importer\n .attendees=${records}\n @imported=${() => { history.back()\n this.grist.fetch()\n }}\n ></attendee-importer>\n `,\n { backdrop: true,\n size: 'large',\n title: i18next.t('title.import attendee')\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 { CalendarImporter } from './calendar-importer';
5
- declare const CalendarListPage_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 CalendarListPage_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 CalendarListPage extends CalendarListPage_base {
13
7
  static styles: import("lit").CSSResult[];
14
8
  static get scopedElements(): {