@things-factory/calendar 10.1.258 → 10.1.260

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.
Files changed (28) hide show
  1. package/dist-client/pages/calendar/calendar-list-page.d.ts +9 -2
  2. package/dist-client/pages/calendar/calendar-list-page.js +30 -11
  3. package/dist-client/pages/calendar/calendar-list-page.js.map +1 -1
  4. package/dist-client/tsconfig.tsbuildinfo +1 -1
  5. package/dist-server/service/attendee/attendee.d.ts +4 -0
  6. package/dist-server/service/attendee/attendee.js +10 -0
  7. package/dist-server/service/attendee/attendee.js.map +1 -1
  8. package/dist-server/service/calendar/calendar.d.ts +14 -0
  9. package/dist-server/service/calendar/calendar.js +5 -0
  10. package/dist-server/service/calendar/calendar.js.map +1 -1
  11. package/dist-server/service/event/event-import.d.ts +59 -0
  12. package/dist-server/service/event/event-import.js +169 -0
  13. package/dist-server/service/event/event-import.js.map +1 -0
  14. package/dist-server/service/event/event-mutation.d.ts +2 -1
  15. package/dist-server/service/event/event-mutation.js +19 -0
  16. package/dist-server/service/event/event-mutation.js.map +1 -1
  17. package/dist-server/service/event/event-type.d.ts +40 -0
  18. package/dist-server/service/event/event-type.js +149 -1
  19. package/dist-server/service/event/event-type.js.map +1 -1
  20. package/dist-server/service/event/event.d.ts +4 -0
  21. package/dist-server/service/event/event.js +14 -0
  22. package/dist-server/service/event/event.js.map +1 -1
  23. package/dist-server/service/index.d.ts +1 -0
  24. package/dist-server/service/index.js +5 -1
  25. package/dist-server/service/index.js.map +1 -1
  26. package/dist-server/tsconfig.tsbuildinfo +1 -1
  27. package/package.json +6 -4
  28. package/tests/open-doors.test.ts +1 -1
@@ -1,4 +1,5 @@
1
1
  import '@operato/data-grist';
2
+ import '@things-factory/ai-assistant/dist-client/index.js';
2
3
  import { PageView } from '@operato/shell';
3
4
  import { FetchOption } from '@operato/data-grist';
4
5
  declare const CalendarListPage_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
@@ -18,7 +19,12 @@ export declare class CalendarListPage extends CalendarListPage_base {
18
19
  handler: () => void;
19
20
  };
20
21
  help: string;
21
- actions: {
22
+ actions: ({
23
+ id: string;
24
+ title: string;
25
+ icon: string;
26
+ action: () => import("@operato/data-grist").GristRecord;
27
+ } | {
22
28
  icon: string;
23
29
  emphasis: {
24
30
  raised: boolean;
@@ -26,9 +32,10 @@ export declare class CalendarListPage extends CalendarListPage_base {
26
32
  dense: boolean;
27
33
  danger: boolean;
28
34
  };
35
+ id: string;
29
36
  title: string;
30
37
  action: () => Promise<void>;
31
- }[];
38
+ })[];
32
39
  exportable: {
33
40
  name: string;
34
41
  data: () => Promise<{}[]>;
@@ -1,5 +1,6 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
2
  import '@operato/data-grist';
3
+ import '@things-factory/ai-assistant/dist-client/index.js';
3
4
  import { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
4
5
  import { navigate, PageView } from '@operato/shell';
5
6
  import { css, html } from 'lit';
@@ -45,14 +46,9 @@ let CalendarListPage = class CalendarListPage extends localize(i18next)(PageView
45
46
  },
46
47
  help: 'calendar/calendar',
47
48
  actions: [
48
- { title: i18next.t('button.save'),
49
- action: this._updateCalendar.bind(this),
50
- ...CommonButtonStyles.save
51
- },
52
- { title: i18next.t('button.delete'),
53
- action: this._deleteCalendar.bind(this),
54
- ...CommonButtonStyles.delete
55
- }
49
+ /* The only way to start a calendar - there is no empty row under the records. */
50
+ { id: 'add-row', title: i18next.t('button.add-row'), icon: 'add', action: () => this.grist.addNewRecord() },
51
+ { id: 'save', title: i18next.t('button.save'), action: this._updateCalendar.bind(this), ...CommonButtonStyles.save }
56
52
  ],
57
53
  exportable: { name: i18next.t('title.calendar list'),
58
54
  data: this.exportHandler.bind(this)
@@ -60,8 +56,18 @@ let CalendarListPage = class CalendarListPage extends localize(i18next)(PageView
60
56
  }
61
57
  render() {
62
58
  const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
59
+ /*
60
+ * Deleting the picked calendars is on the selection bar over the list (FOOTER-BUTTON-REVIEW F06). The query - filters,
61
+ * sort, search, page - lives in the address (G09); the grid/list/card mode is how it is drawn, kept by the page.
62
+ */
63
63
  return html `
64
- <ox-grist class="page-fill" .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
64
+ <ox-assistant-selection-bar
65
+ .gridOf=${() => this.grist}
66
+ name=${i18next.t('title.calendar list')}
67
+ .assistant=${false}
68
+ .actions=${[{ id: 'delete', title: i18next.t('button.delete'), icon: 'delete_outline', emphasis: { danger: true }, action: () => this._deleteCalendar() }]}
69
+ ></ox-assistant-selection-bar>
70
+ <ox-grist class="page-fill" .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${this.active}>
65
71
  <div slot="headroom" class="header">
66
72
  <div class="filters">
67
73
  <ox-filters-form without-search autofocus></ox-filters-form>
@@ -81,6 +87,8 @@ let CalendarListPage = class CalendarListPage extends localize(i18next)(PageView
81
87
  details: ['active', 'updatedAt']
82
88
  },
83
89
  columns: [
90
+ /* A row's state (new, changed); a new row's mark removes it until it is saved (data-grist 행 제거). */
91
+ { type: 'gutter', gutterName: 'dirty' },
84
92
  { type: 'gutter', gutterName: 'sequence' },
85
93
  { type: 'gutter', gutterName: 'row-selector', multiple: true },
86
94
  /*
@@ -154,7 +162,10 @@ let CalendarListPage = class CalendarListPage extends localize(i18next)(PageView
154
162
  width: 180
155
163
  }
156
164
  ],
157
- rows: { selectable: { multiple: true
165
+ /* No empty row under the records: 「행 추가」 starts one, and a paste past the last row adds rows. */
166
+ rows: { appendable: false,
167
+ pasteAppendable: true,
168
+ selectable: { multiple: true
158
169
  }
159
170
  },
160
171
  sorters: [
@@ -192,8 +203,12 @@ let CalendarListPage = class CalendarListPage extends localize(i18next)(PageView
192
203
  };
193
204
  }
194
205
  async _deleteCalendar() {
206
+ const ids = this.grist.selected.map(record => record.id).filter(Boolean);
207
+ if (!ids.length) {
208
+ notify({ level: 'info', message: i18next.t('text.select-rows-to-delete') });
209
+ return;
210
+ }
195
211
  if (await sureToDelete()) {
196
- const ids = this.grist.selected.map(record => record.id);
197
212
  if (ids && ids.length > 0) {
198
213
  const response = await client.mutate({ mutation: gql `
199
214
  mutation ($ids: [String!]!) { deleteCalendars(ids: $ids)
@@ -212,6 +227,10 @@ let CalendarListPage = class CalendarListPage extends localize(i18next)(PageView
212
227
  }
213
228
  async _updateCalendar() {
214
229
  let patches = this.grist.dirtyRecords;
230
+ if (!patches?.length) {
231
+ notify({ level: 'info', message: i18next.t('text.nothing-to-save') });
232
+ return;
233
+ }
215
234
  if (patches && patches.length) {
216
235
  patches = patches.map(patch => {
217
236
  let patchField = patch.id ? { id: patch.id } : {};
@@ -1 +1 @@
1
- {"version":3,"file":"calendar-list-page.js","sourceRoot":"","sources":["../../../client/pages/calendar/calendar-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AACnI,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAgB,SAAS,EAA+B,MAAM,qBAAqB,CAAA;AAC1F,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,GAAG,MA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AAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YAAS,IAAI,OAAO,GAAG,EAAE,CAAA;YAC3D,KAAK,MAAM,KAAK,IAAI,cAAc,EAAE,CAAC;gBAAS,OAAO,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;YACnF,CAAC;YAEI,OAAO,OAAO,CAAA;QACnB,CAAC,CAAC,CAAA;IACF,CAAC;;AAxN4B;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;AApBjC,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CA0O5B","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { navigate, PageView } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify } from '@operato/layout'\nimport { isMobileDevice } from '@operato/utils'\n\nimport gql from 'graphql-tag'\n\nimport { sureToDelete } from '../sure-to-delete'\n\n@customElement('calendar-list-page')\nexport class CalendarListPage extends localize(i18next)(PageView) { static styles = [\n /* The work surface frame for a list screen (ADR-0060 decision 8). */\n WorkSurfacePageStyles,\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host {\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n ox-filters-form { flex: 1;\n }\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.calendar 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/calendar',\n actions: [\n { title: i18next.t('button.save'),\n action: this._updateCalendar.bind(this),\n ...CommonButtonStyles.save\n },\n { title: i18next.t('button.delete'),\n action: this._deleteCalendar.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: { name: i18next.t('title.calendar list'),\n data: this.exportHandler.bind(this)\n }\n }\n }\n\n render() { const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist class=\"page-fill\" .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form without-search 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 /*\n * A calendar's days are its events - opened from its row, so which days a calendar holds is one click away. A\n * days-off calendar's days are written there as days off; the others are read on the event list.\n */\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'event_note',\n title: i18next.t('button.calendar-events'),\n handlers: {\n click: (_columns: any, _data: any, _column: any, record: any) => {\n if (record?.id) navigate(record.kind === 'DAYS_OFF' ? `calendar-days-off?calendar=${record.id}` : `event-list?calendar=${record.id}`)\n }\n }\n },\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: 'select',\n name: 'kind',\n header: i18next.t('field.calendar-kind'),\n record: { editable: true,\n hint: i18next.t('text.calendar-kind-hint'),\n options: ['GENERAL', 'DAYS_OFF', 'PUBLIC_HOLIDAYS'].map(value => ({ display: i18next.t(`text.calendar-kind-${value.toLowerCase().replace(/_/g, '-')}`), value }))\n },\n filter: true,\n sortable: true,\n width: 110\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: calendars(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id\n name\n description\n kind\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 _deleteCalendar() { if (await sureToDelete()) { 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!]!) { deleteCalendars(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 _updateCalendar() { 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: [CalendarPatch!]!) { updateMultipleCalendar(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', 'kind', 'active'])\n\n return exportTargets.map(calendar => { let tempObj = {}\n for (const field of targetFieldSet) { tempObj[field] = calendar[field]\n }\n\n return tempObj\n })\n }\n}\n"]}
1
+ {"version":3,"file":"calendar-list-page.js","sourceRoot":"","sources":["../../../client/pages/calendar/calendar-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,mDAAmD,CAAA;AAE1D,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AACnI,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAgB,SAAS,EAA+B,MAAM,qBAAqB,CAAA;AAC1F,OAAO,EAAE,MA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C,EAAE;YAAS,IAAI,OAAO,GAAG,EAAE,CAAA;YAC3D,KAAK,MAAM,KAAK,IAAI,cAAc,EAAE,CAAC;gBAAS,OAAO,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;YACnF,CAAC;YAEI,OAAO,OAAO,CAAA;QACnB,CAAC,CAAC,CAAA;IACF,CAAC;;AA5O4B;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;AApBjC,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CA8P5B","sourcesContent":["import '@operato/data-grist'\nimport '@things-factory/ai-assistant/dist-client/index.js'\n\nimport { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { navigate, PageView } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify } from '@operato/layout'\nimport { isMobileDevice } from '@operato/utils'\n\nimport gql from 'graphql-tag'\n\nimport { sureToDelete } from '../sure-to-delete'\n\n@customElement('calendar-list-page')\nexport class CalendarListPage extends localize(i18next)(PageView) { static styles = [\n /* The work surface frame for a list screen (ADR-0060 decision 8). */\n WorkSurfacePageStyles,\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host {\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n ox-filters-form { flex: 1;\n }\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.calendar 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/calendar',\n actions: [\n /* The only way to start a calendar - there is no empty row under the records. */\n { id: 'add-row', title: i18next.t('button.add-row'), icon: 'add', action: () => this.grist.addNewRecord() },\n { id: 'save', title: i18next.t('button.save'), action: this._updateCalendar.bind(this), ...CommonButtonStyles.save }\n ],\n exportable: { name: i18next.t('title.calendar list'),\n data: this.exportHandler.bind(this)\n }\n }\n }\n\n render() { const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n /*\n * Deleting the picked calendars is on the selection bar over the list (FOOTER-BUTTON-REVIEW F06). The query - filters,\n * sort, search, page - lives in the address (G09); the grid/list/card mode is how it is drawn, kept by the page.\n */\n return html`\n <ox-assistant-selection-bar\n .gridOf=${() => this.grist}\n name=${i18next.t('title.calendar list')}\n .assistant=${false}\n .actions=${[{ id: 'delete', title: i18next.t('button.delete'), icon: 'delete_outline', emphasis: { danger: true }, action: () => this._deleteCalendar() }]}\n ></ox-assistant-selection-bar>\n <ox-grist class=\"page-fill\" .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${this.active}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form without-search 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 /* A row's state (new, changed); a new row's mark removes it until it is saved (data-grist 행 제거). */\n { type: 'gutter', gutterName: 'dirty' },\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n /*\n * A calendar's days are its events - opened from its row, so which days a calendar holds is one click away. A\n * days-off calendar's days are written there as days off; the others are read on the event list.\n */\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'event_note',\n title: i18next.t('button.calendar-events'),\n handlers: {\n click: (_columns: any, _data: any, _column: any, record: any) => {\n if (record?.id) navigate(record.kind === 'DAYS_OFF' ? `calendar-days-off?calendar=${record.id}` : `event-list?calendar=${record.id}`)\n }\n }\n },\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: 'select',\n name: 'kind',\n header: i18next.t('field.calendar-kind'),\n record: { editable: true,\n hint: i18next.t('text.calendar-kind-hint'),\n options: ['GENERAL', 'DAYS_OFF', 'PUBLIC_HOLIDAYS'].map(value => ({ display: i18next.t(`text.calendar-kind-${value.toLowerCase().replace(/_/g, '-')}`), value }))\n },\n filter: true,\n sortable: true,\n width: 110\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 /* No empty row under the records: 「행 추가」 starts one, and a paste past the last row adds rows. */\n rows: { appendable: false,\n pasteAppendable: true,\n 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: calendars(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id\n name\n description\n kind\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 _deleteCalendar() {\n const ids = this.grist.selected.map(record => record.id).filter(Boolean)\n if (!ids.length) {\n notify({ level: 'info', message: i18next.t('text.select-rows-to-delete') })\n return\n }\n if (await sureToDelete()) {\n if (ids && ids.length > 0) { const response = await client.mutate({ mutation: gql`\n mutation ($ids: [String!]!) { deleteCalendars(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 _updateCalendar() { let patches = this.grist.dirtyRecords\n if (!patches?.length) {\n notify({ level: 'info', message: i18next.t('text.nothing-to-save') })\n return\n }\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: [CalendarPatch!]!) { updateMultipleCalendar(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', 'kind', 'active'])\n\n return exportTargets.map(calendar => { let tempObj = {}\n for (const field of targetFieldSet) { tempObj[field] = calendar[field]\n }\n\n return tempObj\n })\n }\n}\n"]}