@things-factory/board-ui 10.1.244 → 10.1.245
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-client/pages/board-list-page.d.ts +2 -0
- package/dist-client/pages/board-list-page.js +25 -4
- package/dist-client/pages/board-list-page.js.map +1 -1
- package/dist-client/pages/board-template/board-template-list-page.d.ts +2 -0
- package/dist-client/pages/board-template/board-template-list-page.js +24 -4
- package/dist-client/pages/board-template/board-template-list-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
|
@@ -13,6 +13,7 @@ export declare class BoardListPage extends BoardListPageBase {
|
|
|
13
13
|
gristConfig: any;
|
|
14
14
|
get searchText(): string;
|
|
15
15
|
private creatable;
|
|
16
|
+
private counts;
|
|
16
17
|
private get currentGroupId();
|
|
17
18
|
private grist;
|
|
18
19
|
get context(): {
|
|
@@ -30,6 +31,7 @@ export declare class BoardListPage extends BoardListPageBase {
|
|
|
30
31
|
total: any;
|
|
31
32
|
records: any;
|
|
32
33
|
}>;
|
|
34
|
+
private countChips;
|
|
33
35
|
load(): Promise<void>;
|
|
34
36
|
refreshBoards(): Promise<void>;
|
|
35
37
|
private _unsubscribe?;
|
|
@@ -41,6 +41,8 @@ let BoardListPage = class BoardListPage extends BoardListPageBase {
|
|
|
41
41
|
this.groups = [];
|
|
42
42
|
this.favorites = [];
|
|
43
43
|
this.creatable = false;
|
|
44
|
+
/* How many boards each type and state chip would show, under the list's other conditions - counted by the server. */
|
|
45
|
+
this.counts = { type: new Map(), state: new Map() };
|
|
44
46
|
}
|
|
45
47
|
static { this.styles = [
|
|
46
48
|
/* The frame owns the page shell; the grist is the content it sizes (ADR-0060 decision 8). */
|
|
@@ -227,11 +229,11 @@ let BoardListPage = class BoardListPage extends BoardListPageBase {
|
|
|
227
229
|
operator: 'in',
|
|
228
230
|
value: ['main'],
|
|
229
231
|
label: '',
|
|
230
|
-
options: [
|
|
232
|
+
options: () => [
|
|
231
233
|
{ display: i18next.t('label.main', { defaultValue: 'Main' }), value: 'main' },
|
|
232
234
|
{ display: i18next.t('label.sub', { defaultValue: 'Sub' }), value: 'sub' },
|
|
233
235
|
{ display: i18next.t('label.popup', { defaultValue: 'Popup' }), value: 'popup' }
|
|
234
|
-
]
|
|
236
|
+
].map(option => ({ ...option, count: this.counts.type.get(option.value) ?? 0 }))
|
|
235
237
|
}
|
|
236
238
|
},
|
|
237
239
|
{
|
|
@@ -243,10 +245,10 @@ let BoardListPage = class BoardListPage extends BoardListPageBase {
|
|
|
243
245
|
operator: 'in',
|
|
244
246
|
value: [],
|
|
245
247
|
label: '',
|
|
246
|
-
options: [
|
|
248
|
+
options: () => [
|
|
247
249
|
{ display: i18next.t('label.draft', { defaultValue: 'Draft' }), value: 'draft' },
|
|
248
250
|
{ display: i18next.t('label.released', { defaultValue: 'Released' }), value: 'released' }
|
|
249
|
-
]
|
|
251
|
+
].map(option => ({ ...option, count: this.counts.state.get(option.value) ?? 0 }))
|
|
250
252
|
}
|
|
251
253
|
}
|
|
252
254
|
],
|
|
@@ -272,6 +274,7 @@ let BoardListPage = class BoardListPage extends BoardListPageBase {
|
|
|
272
274
|
pagination: { page, limit },
|
|
273
275
|
sortings: sorters.length ? sorters : [{ name: 'sortOrder', desc: false }, { name: 'name', desc: false }]
|
|
274
276
|
};
|
|
277
|
+
this.countChips(special ? group.value : null, query.filters, search);
|
|
275
278
|
const result = group?.value === 'favor'
|
|
276
279
|
? (await fetchFavoriteBoardList(query)).favoriteBoards
|
|
277
280
|
: group?.value === 'mywork'
|
|
@@ -286,6 +289,24 @@ let BoardListPage = class BoardListPage extends BoardListPageBase {
|
|
|
286
289
|
}));
|
|
287
290
|
return { total, records };
|
|
288
291
|
}
|
|
292
|
+
/* The type and state chips' numbers, in the list's scope; the filter form is drawn again to show them. */
|
|
293
|
+
async countChips(scope, filters, search) {
|
|
294
|
+
const response = await client.query({
|
|
295
|
+
query: gql `
|
|
296
|
+
query ($scope: String, $filters: [Filter!], $search: String) {
|
|
297
|
+
type: boardCounts(field: "type", scope: $scope, filters: $filters, search: $search) { value count }
|
|
298
|
+
state: boardCounts(field: "state", scope: $scope, filters: $filters, search: $search) { value count }
|
|
299
|
+
}
|
|
300
|
+
`,
|
|
301
|
+
variables: { scope, filters, search: search || undefined },
|
|
302
|
+
fetchPolicy: 'no-cache'
|
|
303
|
+
});
|
|
304
|
+
if (response.errors?.length)
|
|
305
|
+
return console.error(response.errors);
|
|
306
|
+
const mapOf = (rows) => new Map(rows.map(row => [row.value, row.count]));
|
|
307
|
+
this.counts = { type: mapOf(response.data.type), state: mapOf(response.data.state) };
|
|
308
|
+
this.renderRoot.querySelector('ox-filters-form')?.requestUpdate();
|
|
309
|
+
}
|
|
289
310
|
async load() {
|
|
290
311
|
this.groups = (await fetchGroupList()).groups.items;
|
|
291
312
|
if (this.groups) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board-list-page.js","sourceRoot":"","sources":["../../client/pages/board-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,4BAA4B,CAAA;AACnC,OAAO,qCAAqC,CAAA;AAC5C,OAAO,4BAA4B,CAAA;AACnC,OAAO,4BAA4B,CAAA;AAEnC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B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,CAAC;8BAAiB,SAAS;4CAAA;AA1CjC,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAkrBzB","sourcesContent":["import '@operato/data-grist'\nimport '@material/web/icon/icon.js'\nimport '@material/web/button/text-button.js'\nimport '../viewparts/board-info.js'\nimport '../viewparts/group-info.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\nimport { pulltorefresh } from '@operato/pull-to-refresh'\nimport { navigate, PageView, store } from '@operato/shell'\nimport { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { hasPrivilege } from '@things-factory/auth-base/dist-client/index.js'\nimport { UPDATE_FAVORITES } from '@things-factory/fav-base/client/index.js'\nimport { notify } from '../utils/notify-helper.js'\nimport { boardMeta } from '../utils/board-meta.js'\nimport { CardCatalogStyles } from '@operato/styles'\n\nimport { boardCardThumb } from '../board-list/board-card-thumb.js'\nimport { newBoardModel } from '@operato/board/new-board-model.js'\n\nimport {\n cloneBoard,\n releaseBoard,\n revertBoardVersion,\n createBoard,\n createGroup,\n deleteBoard,\n deleteGroup,\n fetchBoardList,\n fetchFavoriteBoardList,\n fetchMyBoardList,\n fetchGroupList,\n updateBoard,\n updateGroup,\n importBoards\n} from '../graphql'\n\nconst BoardListPageBase = localize(i18next)(PageView) as typeof PageView\n\n/*\n * ox-grist (CARD mode) like figure-list-page and board-template-list-page, instead of the\n * board-only board-tile-list fork - see ADR on shared-component-over-app-fork. Drag-reorder comes\n * from `rows.reorderable`, a capability added to data-grist for this (2026-09-23); it dispatches a\n * `reorder` event and leaves persisting it to us, same contract board-tile-list's `reordered` used.\n *\n * Traded away in the move: the delta-merge `incrementalRefresh()` that patched only changed boards\n * in place with a highlight-flash animation. ox-grist's own pagination (`attach-page`, handled\n * internally by data-provider.ts) replaces the hand-rolled infinite scroll, but a group/search change\n * now does a plain full refetch rather than an in-place merge. Worth revisiting if the flash-on-update\n * cue turns out to matter in practice.\n */\n@customElement('board-list-page')\nexport class BoardListPage extends BoardListPageBase {\n static styles = [\n /* The frame owns the page shell; the grist is the content it sizes (ADR-0060 decision 8). */\n WorkSurfacePageStyles,\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n /* The card itself - every card catalog's (@operato/styles), the FAB with it. */\n CardCatalogStyles,\n css`\n ox-filters-form {\n flex: 1;\n }\n\n /*\n The group actions beside the search read as quiet as the band's buttons above them: outlined icon, muted\n colour. Filled at full ink, \"new group\" stood out against the band (user, 2026-09-25).\n */\n [slot='headroom'] md-text-button {\n --md-text-button-label-text-color: var(--md-sys-color-on-surface-variant);\n --md-text-button-icon-color: var(--md-sys-color-on-surface-variant);\n --md-text-button-icon-size: 18px;\n }\n\n [slot='headroom'] md-text-button md-icon {\n font-variation-settings: 'FILL' 0;\n }\n `\n ]\n\n @property({ type: Array }) groups: any[] = []\n @property({ type: Array }) favorites: any[] = []\n @property({ type: Object }) gristConfig: any\n\n get searchText(): string { return this.grist?.searchText || '' }\n @state() private creatable = false\n /* Prefill board-info from the committed grid filter, never from an unapproved form change. */\n private get currentGroupId(): string {\n const groups = (this.grist?.filters || []).filter(f => f.name === 'group' && f.operator === 'eq')\n return groups.length === 1 && typeof groups[0].value === 'string' ? groups[0].value : ''\n }\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n /* A plain name, no icon - the rail already carries the icon for this screen, and figure's\n * title bar is bare text too. */\n title: i18next.t('title.board list'),\n search: {\n placeholder: i18next.t('text.search boards by name', { defaultValue: 'Search boards by name' }),\n handler: search => { if (this.grist) this.grist.searchText = search },\n value: this.searchText || ''\n },\n board_topmenu: true\n }\n }\n\n render() {\n return html`\n <ox-grist\n class=\"page-fill\"\n mode=\"CARD\"\n url-params-sensitive\n search-mode=\"term\"\n @query-state-change=${() => { this.requestUpdate(); this.updateContext() }}\n .config=${this.gristConfig}\n .fetchHandler=${this.fetchHandler.bind(this)}\n @reorder=${e => this.onReorderBoards(e.detail)}\n >\n <div slot=\"headroom\">\n <ox-filters-form autofocus without-search></ox-filters-form>\n ${this.groups.some(group => group.id === this.currentGroupId)\n ? html`\n <md-text-button @click=${() => this.onInfoGroup(this.currentGroupId)}>\n <md-icon slot=\"icon\">edit</md-icon>\n ${i18next.t('text.edit group', { defaultValue: 'Edit' })}\n </md-text-button>\n `\n : ''}\n <md-text-button @click=${() => this.onInfoGroup(undefined)}>\n <md-icon slot=\"icon\">create_new_folder</md-icon>\n ${i18next.t('text.new group', { defaultValue: 'New Group' })}\n </md-text-button>\n </div>\n </ox-grist>\n\n ${this.creatable\n ? html`\n <button fab title=${i18next.t('text.create board', { defaultValue: 'Create Board' })} @click=${() => navigate('board-create')}>\n <md-icon>add</md-icon>${i18next.t('text.create board', { defaultValue: 'Create Board' })}\n </button>\n `\n : ''}\n `\n }\n\n async pageInitialized() {\n this.creatable = await hasPrivilege({ privilege: 'mutation', category: 'board', domainOwnerGranted: true })\n\n this.gristConfig = {\n list: {\n thumbnail: 'thumbnail',\n /* name, then a quieter \"v3 · 2 days ago\" line - the same two-line rhythm as figure's\n * name-over-type, using what a board actually has (utils/board-meta.ts). */\n fields: ['name', 'meta'],\n details: []\n },\n columns: [\n {\n type: 'image',\n name: 'thumbnail',\n record: {\n editable: false,\n align: 'center',\n renderEmpty: true,\n /* The picture and the draft badge (board-card-thumb.ts); info/favorite are the two gutter\n * columns below, in the information area rather than over the picture. */\n renderer: (value, column, record) => boardCardThumb(record)\n }\n },\n {\n type: 'string',\n name: 'name',\n record: { editable: false }\n },\n {\n type: 'string',\n name: 'meta',\n record: { editable: false }\n },\n {\n type: 'gutter',\n gutterName: 'button',\n name: 'edit',\n /* Edit first, the star last: the star is the one that can stay lit at rest, so it takes\n * the corner where the eye lands. */\n icon: 'edit',\n quiet: true,\n title: i18next.t('button.edit'),\n handlers: {\n click: (_columns, _data, _column, record) => this.onInfoBoard(record)\n }\n },\n {\n type: 'gutter',\n gutterName: 'button',\n name: 'favorite',\n icon: (record?: any) => (record?.favorited ? 'star' : 'star_border'),\n /* A set star is a status and stays; an unset one is an action and waits for hover. */\n quiet: (record?: any) => !record?.favorited,\n title: (record?: any) =>\n i18next.t(record?.favorited ? 'label.unfavorite' : 'label.favorite', {\n defaultValue: record?.favorited ? 'Remove from favorites' : 'Add to favorites'\n }),\n handlers: {\n click: (_columns, _data, _column, record) => this.toggleFavorite(record)\n }\n },\n /*\n * Group and board-type are filter-only facets - they carry no `list.fields`/`list.details`\n * entry, so record-card.ts never draws them on a card. `filters-form`'s delegated `change`\n * listener (filters-form.ts) turns any change into a `fetch-params-change` event that\n * data-provider.ts already listens for, so no extra wiring is needed to refetch.\n */\n {\n type: 'string',\n name: 'group',\n header: i18next.t('field.group', { defaultValue: 'Group' }),\n record: { editable: false },\n filter: {\n type: 'select',\n operator: 'eq',\n value: '',\n label: i18next.t('field.group', { defaultValue: 'Group' }),\n options: () => [\n { value: '', display: i18next.t('label.all', { defaultValue: 'All' }) },\n { value: 'favor', display: i18next.t('label.favorite', { defaultValue: 'Favorite' }) },\n { value: 'mywork', display: i18next.t('label.my-works', { defaultValue: 'My works' }) },\n ...this.groups.map(group => ({ value: group.id, display: group.name }))\n ]\n }\n },\n /*\n * Type and state are chips (select-buttons), the way figure's draft/released facet is - a\n * facet with two or three values is read faster as a row of toggles than as a checkbox\n * or a dropdown. Both are multi-select ('in'), and \"Main\" starts pressed so the default\n * view is the same main-boards-only list as before.\n */\n {\n type: 'select-buttons',\n name: 'type',\n header: i18next.t('field.board-type', { defaultValue: 'Type' }),\n record: { editable: false },\n filter: {\n operator: 'in',\n value: ['main'],\n label: '',\n options: [\n { display: i18next.t('label.main', { defaultValue: 'Main' }), value: 'main' },\n { display: i18next.t('label.sub', { defaultValue: 'Sub' }), value: 'sub' },\n { display: i18next.t('label.popup', { defaultValue: 'Popup' }), value: 'popup' }\n ]\n }\n },\n {\n type: 'select-buttons',\n name: 'state',\n header: i18next.t('field.state', { defaultValue: 'State' }),\n record: { editable: false },\n filter: {\n operator: 'in',\n value: [],\n label: '',\n options: [\n { display: i18next.t('label.draft', { defaultValue: 'Draft' }), value: 'draft' },\n { display: i18next.t('label.released', { defaultValue: 'Released' }), value: 'released' }\n ]\n }\n }\n ],\n rows: {\n selectable: false,\n appendable: false,\n reorderable: true,\n handlers: {\n click: (_columns, _data, _column, record) => navigate(`board-viewer/${record.id}`)\n }\n },\n sorters: []\n }\n\n this.load()\n }\n\n async fetchHandler({ page = 1, limit = 24, filters = [], search = '', sorters = [] }: FetchOption) {\n const groups = filters.filter(f => f.name === 'group' && f.operator === 'eq' && typeof f.value === 'string')\n const group = groups.length === 1 ? groups[0] : undefined\n const special = group?.value === 'favor' || group?.value === 'mywork'\n const query = {\n filters: filters.filter(f => !special || f !== group).map(f => f.name === 'group' ? { ...f, name: 'groupId' } : f),\n search,\n pagination: { page, limit },\n sortings: sorters.length ? sorters : [{ name: 'sortOrder', desc: false }, { name: 'name', desc: false }]\n }\n const result = group?.value === 'favor'\n ? (await fetchFavoriteBoardList(query)).favoriteBoards\n : group?.value === 'mywork'\n ? (await fetchMyBoardList(query)).boardsCreatedByMe\n : (await fetchBoardList(query)).boards\n const { items, total } = result\n const favorites = this.favorites || []\n const records = (items || []).map(board => ({\n ...board,\n favorited: favorites.includes(board.id),\n meta: boardMeta(board)\n }))\n\n return { total, records }\n }\n\n async load() {\n this.groups = (await fetchGroupList()).groups.items\n\n if (this.groups) {\n /* New reference - `options()` on the group filter closes over `this.groups`, but the filter\n * widget only re-reads it if `<ox-grist>`'s own `.config` binding actually changes. */\n this.gristConfig = { ...this.gristConfig }\n await this.refreshBoards()\n }\n }\n\n async refreshBoards() {\n if (!this.groups) {\n await this.load()\n return\n }\n\n this.updateContext()\n this.grist?.fetch()\n\n if (this.grist) {\n this.grist.style.transition = ''\n this.grist.style.transform = `translate3d(0, 0, 0)`\n }\n }\n\n private _unsubscribe?: () => void\n\n connectedCallback() {\n super.connectedCallback()\n\n this._applyState()\n\n this._unsubscribe = store.subscribe(() => this._applyState())\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n\n this._unsubscribe?.()\n }\n\n private _applyState() {\n const __state__ = store.getState() as any\n const favorites = __state__.favorite.favorites\n\n /*\n * `store.subscribe` fires on every dispatch anywhere in the app, not just favorite changes -\n * `favorited` is folded into each record inside `fetchHandler`, so refreshing it means a\n * refetch, and an unconditional one here span a real loop: fetch() completing dispatches through\n * this same store, which re-enters this callback, which calls fetch() again.\n */\n const changed = JSON.stringify(favorites) !== JSON.stringify(this.favorites)\n this.favorites = favorites\n\n if (changed) {\n this.grist?.fetch()\n }\n }\n\n firstUpdated() {\n /* Group used to be a route segment, and swiping moved between routes - now it is one filter\n * among others in the same list, so there is no longer a sequence of screens to swipe between. */\n pulltorefresh({\n container: this.renderRoot,\n scrollable: this.grist,\n refresh: () => {\n return this.load()\n }\n })\n }\n\n async onInfoBoard(board) {\n openPopup(\n html`\n <board-info\n .board=${board}\n .groupId=${this.currentGroupId}\n @clone-board=${e => this.onCloneBoard(e.detail)}\n @release-board=${e => this.onReleaseBoard(e.detail)}\n @revert-board-version=${e => this.onRevertBoardVersion(e.detail)}\n @update-board=${e => this.onUpdateBoard(e.detail)}\n @delete-board=${e => this.onDeleteBoard(e.detail)}\n @join-playgroup=${e => this.onJoinPlayGroup(e.detail)}\n @leave-playgroup=${e => this.onLeavePlayGroup(e.detail)}\n @register-template=${e => this.onRegisterTemplate(e.detail)}\n ></board-info>\n `,\n { backdrop: true, size: 'medium', closable: true, title: board.name }\n )\n }\n\n async onInfoGroup(groupId) {\n const group = this.groups.find(group => group.id == groupId)\n\n openPopup(\n html`\n <group-info\n .groupId=${groupId}\n @update-group=${e => this.onUpdateGroup(e.detail)}\n @delete-group=${e => this.onDeleteGroup(e.detail)}\n @create-group=${e => this.onCreateGroup(e.detail)}\n @import-boards=${e => this.onImportBoards(e.detail)}\n ></group-info>\n `,\n {\n backdrop: true,\n size: 'small',\n closable: true,\n title: group?.name || i18next.t('text.new group', { defaultValue: 'New Group' })\n }\n )\n }\n\n async onCreateGroup(group) {\n try {\n const data = await createGroup(group)\n data && notify('info', i18next.t('text.group created', { group: group.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.load()\n }\n\n async onUpdateGroup(group) {\n try {\n const data = await updateGroup(group)\n data && notify('info', i18next.t('text.group updated', { group: group.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.load()\n }\n\n async onDeleteGroup(group) {\n try {\n const data = await deleteGroup(group.id)\n data && notify('info', i18next.t('text.group deleted', { group: group.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.load()\n }\n\n async onImportBoards({ group, files, overwrite }) {\n try {\n const data = await importBoards({ groupId: group.id, files, overwrite })\n data && notify('info', i18next.t('text.boards imported', { count: files.length, group: group.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.load()\n }\n\n async onReorderBoards({ ids, movedId }: { ids: string[]; movedId: string }) {\n if (!movedId) return\n\n const newIndex = ids.indexOf(movedId)\n const prevId = newIndex > 0 ? ids[newIndex - 1] : undefined\n const nextId = newIndex < ids.length - 1 ? ids[newIndex + 1] : undefined\n\n try {\n await client.mutate({\n mutation: gql`\n mutation ($id: String!, $prevId: String, $nextId: String) {\n reorderBoard(id: $id, prevId: $prevId, nextId: $nextId)\n }\n `,\n variables: { id: movedId, prevId, nextId }\n })\n } catch (ex) {\n notify('error', ex, ex)\n this.refreshBoards()\n }\n }\n\n async onCreateBoard(board) {\n try {\n if (!board.model) {\n board.model = newBoardModel()\n }\n\n const data = await createBoard(board)\n\n data && notify('info', i18next.t('text.board created', { board: board.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.refreshBoards()\n }\n\n async onCloneBoard({ id, name, description, targetSubdomain, targetGroupId }) {\n try {\n const data = await cloneBoard({\n id,\n name,\n description,\n targetSubdomain,\n targetGroupId\n })\n data && notify('info', i18next.t('text.board cloned', { board: name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.refreshBoards()\n }\n\n async onReleaseBoard(board) {\n try {\n const data = await releaseBoard(board, board.comment)\n data && notify('info', i18next.t('text.board released', { board: board.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.refreshBoards()\n }\n\n async onRevertBoardVersion({ id, version }) {\n try {\n const board = await revertBoardVersion(id, version)\n board && notify('info', i18next.t('text.board reverted', { board: board.name, version }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.refreshBoards()\n }\n\n async onUpdateBoard(board) {\n try {\n const data = await updateBoard(board)\n data && notify('info', i18next.t('text.board updated', { board: board.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.refreshBoards()\n }\n\n async onDeleteBoard(board) {\n try {\n const data = await deleteBoard(board.id)\n data && notify('info', i18next.t('text.board deleted', { board: board.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.refreshBoards()\n }\n\n async onJoinPlayGroup({ board, playGroup }) {\n try {\n const { data } = await client.mutate({\n mutation: gql`\n mutation JoinPlayGroup($id: String!, $boardIds: [String!]!) {\n joinPlayGroup(id: $id, boardIds: $boardIds) {\n id\n }\n }\n `,\n variables: {\n id: playGroup.id,\n boardIds: [board.id]\n }\n })\n\n data &&\n notify('info', i18next.t('text.joined into play-group', { board: board.name, playGroup: playGroup.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n }\n\n async onLeavePlayGroup({ board, playGroup }) {\n try {\n const { data } = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $boardIds: [String!]!) {\n leavePlayGroup(id: $id, boardIds: $boardIds) {\n id\n }\n }\n `,\n variables: {\n id: playGroup.id,\n boardIds: [board.id]\n }\n })\n\n data &&\n notify('info', i18next.t('text.leaved from play-group', { board: board.name, playGroup: playGroup.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n }\n\n async onRegisterTemplate({ id, name, description, visibility }) {\n try {\n const { data } = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $name: String!, $description: String!, $visibility: String!) {\n registerBoardAsTemplate(id: $id, name: $name, description: $description, visibility: $visibility) {\n id\n }\n }\n `,\n variables: {\n id,\n name,\n description,\n visibility\n }\n })\n\n data &&\n notify('info', i18next.t('text.info_x_successfully', { x: i18next.t('text.register-template') }), {\n name\n })\n } catch (ex) {\n notify('error', ex, ex)\n }\n }\n\n async toggleFavorite(board) {\n const wasFavorite = (this.favorites || []).includes(board.id)\n\n /*\n * The star answers the click at once; the server round trip only confirms it. Before, nothing\n * moved until the mutation, the favorites re-query, the store dispatch and a full refetch had\n * all come back - a click with no reaction reads as a click that did not land.\n *\n * `favorites` is set locally too, so the store update that follows carries the same list and\n * `_applyState` does not trigger the refetch that would repaint every card.\n */\n this.favorites = wasFavorite\n ? (this.favorites || []).filter(id => id !== board.id)\n : [...(this.favorites || []), board.id]\n this.patchRecord(board.id, { favorited: !wasFavorite })\n\n try {\n if (wasFavorite) {\n await this.removeFavorite(board.id)\n } else {\n await this.addFavorite(board.id)\n }\n\n /* In the Favorite view an unstarred board no longer belongs on the page: refetch so it leaves. */\n if (this.currentGroupId === 'favor') {\n this.grist?.fetch()\n }\n } catch (ex) {\n /* Put it back the way it was and say why. */\n this.favorites = wasFavorite\n ? [...(this.favorites || []), board.id]\n : (this.favorites || []).filter(id => id !== board.id)\n this.patchRecord(board.id, { favorited: wasFavorite })\n notify('error', (ex as any)?.message || String(ex))\n }\n }\n\n /** Replaces one record in the grist in place, so only that card re-renders. */\n private patchRecord(id: string, patch: Record<string, unknown>) {\n const grist = this.grist\n const data = grist?.data\n\n if (!data?.records) {\n return\n }\n\n grist.data = {\n ...data,\n records: data.records.map(record => (record.id === id ? { ...record, ...patch } : record))\n }\n }\n\n async removeFavorite(boardId) {\n await client.mutate({\n mutation: gql`\n mutation {\n deleteFavorite(routing: \"${boardId}\")\n }\n `\n })\n\n this.refreshFavorites()\n }\n\n async addFavorite(boardId) {\n await client.mutate({\n mutation: gql`\n mutation {\n createFavorite(favorite: {\n routing: \"${boardId}\"\n }) {\n id\n routing\n }\n }\n `\n })\n\n this.refreshFavorites()\n }\n\n async refreshFavorites() {\n const { data } = await client.query({\n query: gql`\n query {\n myFavorites {\n id\n routing\n }\n }\n `\n })\n\n data &&\n store.dispatch({\n type: UPDATE_FAVORITES,\n favorites: data.myFavorites.map(favorite => favorite.routing)\n })\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"board-list-page.js","sourceRoot":"","sources":["../../client/pages/board-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,4BAA4B,CAAA;AACnC,OAAO,qCAAqC,CAAA;AAC5C,OAAO,4BAA4B,CAAA;AACnC,OAAO,4BAA4B,CAAA;AAEnC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAC/G,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAA;AAC7E,OAAO,EAAE,gBAAgB,EAAE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B,KAAK,EAAE;;gDAA0B;AASP;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;4CAAA;AA5CjC,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAysBzB","sourcesContent":["import '@operato/data-grist'\nimport '@material/web/icon/icon.js'\nimport '@material/web/button/text-button.js'\nimport '../viewparts/board-info.js'\nimport '../viewparts/group-info.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\nimport { pulltorefresh } from '@operato/pull-to-refresh'\nimport { navigate, PageView, store } from '@operato/shell'\nimport { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { hasPrivilege } from '@things-factory/auth-base/dist-client/index.js'\nimport { UPDATE_FAVORITES } from '@things-factory/fav-base/client/index.js'\nimport { notify } from '../utils/notify-helper.js'\nimport { boardMeta } from '../utils/board-meta.js'\nimport { CardCatalogStyles } from '@operato/styles'\n\nimport { boardCardThumb } from '../board-list/board-card-thumb.js'\nimport { newBoardModel } from '@operato/board/new-board-model.js'\n\nimport {\n cloneBoard,\n releaseBoard,\n revertBoardVersion,\n createBoard,\n createGroup,\n deleteBoard,\n deleteGroup,\n fetchBoardList,\n fetchFavoriteBoardList,\n fetchMyBoardList,\n fetchGroupList,\n updateBoard,\n updateGroup,\n importBoards\n} from '../graphql'\n\nconst BoardListPageBase = localize(i18next)(PageView) as typeof PageView\n\n/*\n * ox-grist (CARD mode) like figure-list-page and board-template-list-page, instead of the\n * board-only board-tile-list fork - see ADR on shared-component-over-app-fork. Drag-reorder comes\n * from `rows.reorderable`, a capability added to data-grist for this (2026-09-23); it dispatches a\n * `reorder` event and leaves persisting it to us, same contract board-tile-list's `reordered` used.\n *\n * Traded away in the move: the delta-merge `incrementalRefresh()` that patched only changed boards\n * in place with a highlight-flash animation. ox-grist's own pagination (`attach-page`, handled\n * internally by data-provider.ts) replaces the hand-rolled infinite scroll, but a group/search change\n * now does a plain full refetch rather than an in-place merge. Worth revisiting if the flash-on-update\n * cue turns out to matter in practice.\n */\n@customElement('board-list-page')\nexport class BoardListPage extends BoardListPageBase {\n static styles = [\n /* The frame owns the page shell; the grist is the content it sizes (ADR-0060 decision 8). */\n WorkSurfacePageStyles,\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n /* The card itself - every card catalog's (@operato/styles), the FAB with it. */\n CardCatalogStyles,\n css`\n ox-filters-form {\n flex: 1;\n }\n\n /*\n The group actions beside the search read as quiet as the band's buttons above them: outlined icon, muted\n colour. Filled at full ink, \"new group\" stood out against the band (user, 2026-09-25).\n */\n [slot='headroom'] md-text-button {\n --md-text-button-label-text-color: var(--md-sys-color-on-surface-variant);\n --md-text-button-icon-color: var(--md-sys-color-on-surface-variant);\n --md-text-button-icon-size: 18px;\n }\n\n [slot='headroom'] md-text-button md-icon {\n font-variation-settings: 'FILL' 0;\n }\n `\n ]\n\n @property({ type: Array }) groups: any[] = []\n @property({ type: Array }) favorites: any[] = []\n @property({ type: Object }) gristConfig: any\n\n get searchText(): string { return this.grist?.searchText || '' }\n @state() private creatable = false\n /* How many boards each type and state chip would show, under the list's other conditions - counted by the server. */\n private counts: Record<'type' | 'state', Map<string, number>> = { type: new Map(), state: new Map() }\n /* Prefill board-info from the committed grid filter, never from an unapproved form change. */\n private get currentGroupId(): string {\n const groups = (this.grist?.filters || []).filter(f => f.name === 'group' && f.operator === 'eq')\n return groups.length === 1 && typeof groups[0].value === 'string' ? groups[0].value : ''\n }\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n /* A plain name, no icon - the rail already carries the icon for this screen, and figure's\n * title bar is bare text too. */\n title: i18next.t('title.board list'),\n search: {\n placeholder: i18next.t('text.search boards by name', { defaultValue: 'Search boards by name' }),\n handler: search => { if (this.grist) this.grist.searchText = search },\n value: this.searchText || ''\n },\n board_topmenu: true\n }\n }\n\n render() {\n return html`\n <ox-grist\n class=\"page-fill\"\n mode=\"CARD\"\n url-params-sensitive\n search-mode=\"term\"\n @query-state-change=${() => { this.requestUpdate(); this.updateContext() }}\n .config=${this.gristConfig}\n .fetchHandler=${this.fetchHandler.bind(this)}\n @reorder=${e => this.onReorderBoards(e.detail)}\n >\n <div slot=\"headroom\">\n <ox-filters-form autofocus without-search></ox-filters-form>\n ${this.groups.some(group => group.id === this.currentGroupId)\n ? html`\n <md-text-button @click=${() => this.onInfoGroup(this.currentGroupId)}>\n <md-icon slot=\"icon\">edit</md-icon>\n ${i18next.t('text.edit group', { defaultValue: 'Edit' })}\n </md-text-button>\n `\n : ''}\n <md-text-button @click=${() => this.onInfoGroup(undefined)}>\n <md-icon slot=\"icon\">create_new_folder</md-icon>\n ${i18next.t('text.new group', { defaultValue: 'New Group' })}\n </md-text-button>\n </div>\n </ox-grist>\n\n ${this.creatable\n ? html`\n <button fab title=${i18next.t('text.create board', { defaultValue: 'Create Board' })} @click=${() => navigate('board-create')}>\n <md-icon>add</md-icon>${i18next.t('text.create board', { defaultValue: 'Create Board' })}\n </button>\n `\n : ''}\n `\n }\n\n async pageInitialized() {\n this.creatable = await hasPrivilege({ privilege: 'mutation', category: 'board', domainOwnerGranted: true })\n\n this.gristConfig = {\n list: {\n thumbnail: 'thumbnail',\n /* name, then a quieter \"v3 · 2 days ago\" line - the same two-line rhythm as figure's\n * name-over-type, using what a board actually has (utils/board-meta.ts). */\n fields: ['name', 'meta'],\n details: []\n },\n columns: [\n {\n type: 'image',\n name: 'thumbnail',\n record: {\n editable: false,\n align: 'center',\n renderEmpty: true,\n /* The picture and the draft badge (board-card-thumb.ts); info/favorite are the two gutter\n * columns below, in the information area rather than over the picture. */\n renderer: (value, column, record) => boardCardThumb(record)\n }\n },\n {\n type: 'string',\n name: 'name',\n record: { editable: false }\n },\n {\n type: 'string',\n name: 'meta',\n record: { editable: false }\n },\n {\n type: 'gutter',\n gutterName: 'button',\n name: 'edit',\n /* Edit first, the star last: the star is the one that can stay lit at rest, so it takes\n * the corner where the eye lands. */\n icon: 'edit',\n quiet: true,\n title: i18next.t('button.edit'),\n handlers: {\n click: (_columns, _data, _column, record) => this.onInfoBoard(record)\n }\n },\n {\n type: 'gutter',\n gutterName: 'button',\n name: 'favorite',\n icon: (record?: any) => (record?.favorited ? 'star' : 'star_border'),\n /* A set star is a status and stays; an unset one is an action and waits for hover. */\n quiet: (record?: any) => !record?.favorited,\n title: (record?: any) =>\n i18next.t(record?.favorited ? 'label.unfavorite' : 'label.favorite', {\n defaultValue: record?.favorited ? 'Remove from favorites' : 'Add to favorites'\n }),\n handlers: {\n click: (_columns, _data, _column, record) => this.toggleFavorite(record)\n }\n },\n /*\n * Group and board-type are filter-only facets - they carry no `list.fields`/`list.details`\n * entry, so record-card.ts never draws them on a card. `filters-form`'s delegated `change`\n * listener (filters-form.ts) turns any change into a `fetch-params-change` event that\n * data-provider.ts already listens for, so no extra wiring is needed to refetch.\n */\n {\n type: 'string',\n name: 'group',\n header: i18next.t('field.group', { defaultValue: 'Group' }),\n record: { editable: false },\n filter: {\n type: 'select',\n operator: 'eq',\n value: '',\n label: i18next.t('field.group', { defaultValue: 'Group' }),\n options: () => [\n { value: '', display: i18next.t('label.all', { defaultValue: 'All' }) },\n { value: 'favor', display: i18next.t('label.favorite', { defaultValue: 'Favorite' }) },\n { value: 'mywork', display: i18next.t('label.my-works', { defaultValue: 'My works' }) },\n ...this.groups.map(group => ({ value: group.id, display: group.name }))\n ]\n }\n },\n /*\n * Type and state are chips (select-buttons), the way figure's draft/released facet is - a\n * facet with two or three values is read faster as a row of toggles than as a checkbox\n * or a dropdown. Both are multi-select ('in'), and \"Main\" starts pressed so the default\n * view is the same main-boards-only list as before.\n */\n {\n type: 'select-buttons',\n name: 'type',\n header: i18next.t('field.board-type', { defaultValue: 'Type' }),\n record: { editable: false },\n filter: {\n operator: 'in',\n value: ['main'],\n label: '',\n options: () =>\n [\n { display: i18next.t('label.main', { defaultValue: 'Main' }), value: 'main' },\n { display: i18next.t('label.sub', { defaultValue: 'Sub' }), value: 'sub' },\n { display: i18next.t('label.popup', { defaultValue: 'Popup' }), value: 'popup' }\n ].map(option => ({ ...option, count: this.counts.type.get(option.value) ?? 0 }))\n }\n },\n {\n type: 'select-buttons',\n name: 'state',\n header: i18next.t('field.state', { defaultValue: 'State' }),\n record: { editable: false },\n filter: {\n operator: 'in',\n value: [],\n label: '',\n options: () =>\n [\n { display: i18next.t('label.draft', { defaultValue: 'Draft' }), value: 'draft' },\n { display: i18next.t('label.released', { defaultValue: 'Released' }), value: 'released' }\n ].map(option => ({ ...option, count: this.counts.state.get(option.value) ?? 0 }))\n }\n }\n ],\n rows: {\n selectable: false,\n appendable: false,\n reorderable: true,\n handlers: {\n click: (_columns, _data, _column, record) => navigate(`board-viewer/${record.id}`)\n }\n },\n sorters: []\n }\n\n this.load()\n }\n\n async fetchHandler({ page = 1, limit = 24, filters = [], search = '', sorters = [] }: FetchOption) {\n const groups = filters.filter(f => f.name === 'group' && f.operator === 'eq' && typeof f.value === 'string')\n const group = groups.length === 1 ? groups[0] : undefined\n const special = group?.value === 'favor' || group?.value === 'mywork'\n const query = {\n filters: filters.filter(f => !special || f !== group).map(f => f.name === 'group' ? { ...f, name: 'groupId' } : f),\n search,\n pagination: { page, limit },\n sortings: sorters.length ? sorters : [{ name: 'sortOrder', desc: false }, { name: 'name', desc: false }]\n }\n this.countChips(special ? (group!.value as string) : null, query.filters, search)\n const result = group?.value === 'favor'\n ? (await fetchFavoriteBoardList(query)).favoriteBoards\n : group?.value === 'mywork'\n ? (await fetchMyBoardList(query)).boardsCreatedByMe\n : (await fetchBoardList(query)).boards\n const { items, total } = result\n const favorites = this.favorites || []\n const records = (items || []).map(board => ({\n ...board,\n favorited: favorites.includes(board.id),\n meta: boardMeta(board)\n }))\n\n return { total, records }\n }\n\n /* The type and state chips' numbers, in the list's scope; the filter form is drawn again to show them. */\n private async countChips(scope: string | null, filters: any[], search?: string) {\n const response = await client.query({\n query: gql`\n query ($scope: String, $filters: [Filter!], $search: String) {\n type: boardCounts(field: \"type\", scope: $scope, filters: $filters, search: $search) { value count }\n state: boardCounts(field: \"state\", scope: $scope, filters: $filters, search: $search) { value count }\n }\n `,\n variables: { scope, filters, search: search || undefined },\n fetchPolicy: 'no-cache'\n })\n if (response.errors?.length) return console.error(response.errors)\n const mapOf = (rows: { value: string; count: number }[]) => new Map(rows.map(row => [row.value, row.count]))\n this.counts = { type: mapOf(response.data.type), state: mapOf(response.data.state) }\n ;(this.renderRoot.querySelector('ox-filters-form') as any)?.requestUpdate()\n }\n\n async load() {\n this.groups = (await fetchGroupList()).groups.items\n\n if (this.groups) {\n /* New reference - `options()` on the group filter closes over `this.groups`, but the filter\n * widget only re-reads it if `<ox-grist>`'s own `.config` binding actually changes. */\n this.gristConfig = { ...this.gristConfig }\n await this.refreshBoards()\n }\n }\n\n async refreshBoards() {\n if (!this.groups) {\n await this.load()\n return\n }\n\n this.updateContext()\n this.grist?.fetch()\n\n if (this.grist) {\n this.grist.style.transition = ''\n this.grist.style.transform = `translate3d(0, 0, 0)`\n }\n }\n\n private _unsubscribe?: () => void\n\n connectedCallback() {\n super.connectedCallback()\n\n this._applyState()\n\n this._unsubscribe = store.subscribe(() => this._applyState())\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n\n this._unsubscribe?.()\n }\n\n private _applyState() {\n const __state__ = store.getState() as any\n const favorites = __state__.favorite.favorites\n\n /*\n * `store.subscribe` fires on every dispatch anywhere in the app, not just favorite changes -\n * `favorited` is folded into each record inside `fetchHandler`, so refreshing it means a\n * refetch, and an unconditional one here span a real loop: fetch() completing dispatches through\n * this same store, which re-enters this callback, which calls fetch() again.\n */\n const changed = JSON.stringify(favorites) !== JSON.stringify(this.favorites)\n this.favorites = favorites\n\n if (changed) {\n this.grist?.fetch()\n }\n }\n\n firstUpdated() {\n /* Group used to be a route segment, and swiping moved between routes - now it is one filter\n * among others in the same list, so there is no longer a sequence of screens to swipe between. */\n pulltorefresh({\n container: this.renderRoot,\n scrollable: this.grist,\n refresh: () => {\n return this.load()\n }\n })\n }\n\n async onInfoBoard(board) {\n openPopup(\n html`\n <board-info\n .board=${board}\n .groupId=${this.currentGroupId}\n @clone-board=${e => this.onCloneBoard(e.detail)}\n @release-board=${e => this.onReleaseBoard(e.detail)}\n @revert-board-version=${e => this.onRevertBoardVersion(e.detail)}\n @update-board=${e => this.onUpdateBoard(e.detail)}\n @delete-board=${e => this.onDeleteBoard(e.detail)}\n @join-playgroup=${e => this.onJoinPlayGroup(e.detail)}\n @leave-playgroup=${e => this.onLeavePlayGroup(e.detail)}\n @register-template=${e => this.onRegisterTemplate(e.detail)}\n ></board-info>\n `,\n { backdrop: true, size: 'medium', closable: true, title: board.name }\n )\n }\n\n async onInfoGroup(groupId) {\n const group = this.groups.find(group => group.id == groupId)\n\n openPopup(\n html`\n <group-info\n .groupId=${groupId}\n @update-group=${e => this.onUpdateGroup(e.detail)}\n @delete-group=${e => this.onDeleteGroup(e.detail)}\n @create-group=${e => this.onCreateGroup(e.detail)}\n @import-boards=${e => this.onImportBoards(e.detail)}\n ></group-info>\n `,\n {\n backdrop: true,\n size: 'small',\n closable: true,\n title: group?.name || i18next.t('text.new group', { defaultValue: 'New Group' })\n }\n )\n }\n\n async onCreateGroup(group) {\n try {\n const data = await createGroup(group)\n data && notify('info', i18next.t('text.group created', { group: group.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.load()\n }\n\n async onUpdateGroup(group) {\n try {\n const data = await updateGroup(group)\n data && notify('info', i18next.t('text.group updated', { group: group.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.load()\n }\n\n async onDeleteGroup(group) {\n try {\n const data = await deleteGroup(group.id)\n data && notify('info', i18next.t('text.group deleted', { group: group.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.load()\n }\n\n async onImportBoards({ group, files, overwrite }) {\n try {\n const data = await importBoards({ groupId: group.id, files, overwrite })\n data && notify('info', i18next.t('text.boards imported', { count: files.length, group: group.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.load()\n }\n\n async onReorderBoards({ ids, movedId }: { ids: string[]; movedId: string }) {\n if (!movedId) return\n\n const newIndex = ids.indexOf(movedId)\n const prevId = newIndex > 0 ? ids[newIndex - 1] : undefined\n const nextId = newIndex < ids.length - 1 ? ids[newIndex + 1] : undefined\n\n try {\n await client.mutate({\n mutation: gql`\n mutation ($id: String!, $prevId: String, $nextId: String) {\n reorderBoard(id: $id, prevId: $prevId, nextId: $nextId)\n }\n `,\n variables: { id: movedId, prevId, nextId }\n })\n } catch (ex) {\n notify('error', ex, ex)\n this.refreshBoards()\n }\n }\n\n async onCreateBoard(board) {\n try {\n if (!board.model) {\n board.model = newBoardModel()\n }\n\n const data = await createBoard(board)\n\n data && notify('info', i18next.t('text.board created', { board: board.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.refreshBoards()\n }\n\n async onCloneBoard({ id, name, description, targetSubdomain, targetGroupId }) {\n try {\n const data = await cloneBoard({\n id,\n name,\n description,\n targetSubdomain,\n targetGroupId\n })\n data && notify('info', i18next.t('text.board cloned', { board: name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.refreshBoards()\n }\n\n async onReleaseBoard(board) {\n try {\n const data = await releaseBoard(board, board.comment)\n data && notify('info', i18next.t('text.board released', { board: board.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.refreshBoards()\n }\n\n async onRevertBoardVersion({ id, version }) {\n try {\n const board = await revertBoardVersion(id, version)\n board && notify('info', i18next.t('text.board reverted', { board: board.name, version }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.refreshBoards()\n }\n\n async onUpdateBoard(board) {\n try {\n const data = await updateBoard(board)\n data && notify('info', i18next.t('text.board updated', { board: board.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.refreshBoards()\n }\n\n async onDeleteBoard(board) {\n try {\n const data = await deleteBoard(board.id)\n data && notify('info', i18next.t('text.board deleted', { board: board.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n\n this.refreshBoards()\n }\n\n async onJoinPlayGroup({ board, playGroup }) {\n try {\n const { data } = await client.mutate({\n mutation: gql`\n mutation JoinPlayGroup($id: String!, $boardIds: [String!]!) {\n joinPlayGroup(id: $id, boardIds: $boardIds) {\n id\n }\n }\n `,\n variables: {\n id: playGroup.id,\n boardIds: [board.id]\n }\n })\n\n data &&\n notify('info', i18next.t('text.joined into play-group', { board: board.name, playGroup: playGroup.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n }\n\n async onLeavePlayGroup({ board, playGroup }) {\n try {\n const { data } = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $boardIds: [String!]!) {\n leavePlayGroup(id: $id, boardIds: $boardIds) {\n id\n }\n }\n `,\n variables: {\n id: playGroup.id,\n boardIds: [board.id]\n }\n })\n\n data &&\n notify('info', i18next.t('text.leaved from play-group', { board: board.name, playGroup: playGroup.name }))\n } catch (ex) {\n notify('error', ex, ex)\n }\n }\n\n async onRegisterTemplate({ id, name, description, visibility }) {\n try {\n const { data } = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $name: String!, $description: String!, $visibility: String!) {\n registerBoardAsTemplate(id: $id, name: $name, description: $description, visibility: $visibility) {\n id\n }\n }\n `,\n variables: {\n id,\n name,\n description,\n visibility\n }\n })\n\n data &&\n notify('info', i18next.t('text.info_x_successfully', { x: i18next.t('text.register-template') }), {\n name\n })\n } catch (ex) {\n notify('error', ex, ex)\n }\n }\n\n async toggleFavorite(board) {\n const wasFavorite = (this.favorites || []).includes(board.id)\n\n /*\n * The star answers the click at once; the server round trip only confirms it. Before, nothing\n * moved until the mutation, the favorites re-query, the store dispatch and a full refetch had\n * all come back - a click with no reaction reads as a click that did not land.\n *\n * `favorites` is set locally too, so the store update that follows carries the same list and\n * `_applyState` does not trigger the refetch that would repaint every card.\n */\n this.favorites = wasFavorite\n ? (this.favorites || []).filter(id => id !== board.id)\n : [...(this.favorites || []), board.id]\n this.patchRecord(board.id, { favorited: !wasFavorite })\n\n try {\n if (wasFavorite) {\n await this.removeFavorite(board.id)\n } else {\n await this.addFavorite(board.id)\n }\n\n /* In the Favorite view an unstarred board no longer belongs on the page: refetch so it leaves. */\n if (this.currentGroupId === 'favor') {\n this.grist?.fetch()\n }\n } catch (ex) {\n /* Put it back the way it was and say why. */\n this.favorites = wasFavorite\n ? [...(this.favorites || []), board.id]\n : (this.favorites || []).filter(id => id !== board.id)\n this.patchRecord(board.id, { favorited: wasFavorite })\n notify('error', (ex as any)?.message || String(ex))\n }\n }\n\n /** Replaces one record in the grist in place, so only that card re-renders. */\n private patchRecord(id: string, patch: Record<string, unknown>) {\n const grist = this.grist\n const data = grist?.data\n\n if (!data?.records) {\n return\n }\n\n grist.data = {\n ...data,\n records: data.records.map(record => (record.id === id ? { ...record, ...patch } : record))\n }\n }\n\n async removeFavorite(boardId) {\n await client.mutate({\n mutation: gql`\n mutation {\n deleteFavorite(routing: \"${boardId}\")\n }\n `\n })\n\n this.refreshFavorites()\n }\n\n async addFavorite(boardId) {\n await client.mutate({\n mutation: gql`\n mutation {\n createFavorite(favorite: {\n routing: \"${boardId}\"\n }) {\n id\n routing\n }\n }\n `\n })\n\n this.refreshFavorites()\n }\n\n async refreshFavorites() {\n const { data } = await client.query({\n query: gql`\n query {\n myFavorites {\n id\n routing\n }\n }\n `\n })\n\n data &&\n store.dispatch({\n type: UPDATE_FAVORITES,\n favorites: data.myFavorites.map(favorite => favorite.routing)\n })\n }\n}\n"]}
|
|
@@ -17,6 +17,7 @@ export declare class BoardTemplateListPage extends BoardTemplateListPageBase {
|
|
|
17
17
|
static styles: import("lit").CSSResult[];
|
|
18
18
|
gristConfig: any;
|
|
19
19
|
visibility: string;
|
|
20
|
+
private counts;
|
|
20
21
|
private grist;
|
|
21
22
|
get context(): {
|
|
22
23
|
title: string;
|
|
@@ -29,6 +30,7 @@ export declare class BoardTemplateListPage extends BoardTemplateListPageBase {
|
|
|
29
30
|
};
|
|
30
31
|
render(): import("lit-html").TemplateResult<1>;
|
|
31
32
|
pageInitialized(): Promise<void>;
|
|
33
|
+
private countChips;
|
|
32
34
|
pageUpdated(): Promise<void>;
|
|
33
35
|
fetchHandler({ page, limit, sortings, filters }: FetchOption): Promise<{
|
|
34
36
|
total: any;
|
|
@@ -28,6 +28,8 @@ let BoardTemplateListPage = class BoardTemplateListPage extends BoardTemplateLis
|
|
|
28
28
|
constructor() {
|
|
29
29
|
super(...arguments);
|
|
30
30
|
this.visibility = '';
|
|
31
|
+
/* How many templates each visibility chip would show, under the list's other conditions - counted by the server. */
|
|
32
|
+
this.counts = new Map();
|
|
31
33
|
}
|
|
32
34
|
static { this.styles = [
|
|
33
35
|
/* The frame owns the page shell; the grist is the content it sizes (ADR-0060 decision 8). */
|
|
@@ -129,11 +131,11 @@ let BoardTemplateListPage = class BoardTemplateListPage extends BoardTemplateLis
|
|
|
129
131
|
operator: 'in',
|
|
130
132
|
value: [],
|
|
131
133
|
label: '',
|
|
132
|
-
options: [
|
|
134
|
+
options: () => [
|
|
133
135
|
{ display: this.visibilityLabel('private'), value: 'private' },
|
|
134
136
|
{ display: this.visibilityLabel('domain'), value: 'domain' },
|
|
135
137
|
{ display: this.visibilityLabel('public'), value: 'public' }
|
|
136
|
-
]
|
|
138
|
+
].map(option => ({ ...option, count: this.counts.get(option.value) ?? 0 }))
|
|
137
139
|
}
|
|
138
140
|
}
|
|
139
141
|
],
|
|
@@ -147,12 +149,31 @@ let BoardTemplateListPage = class BoardTemplateListPage extends BoardTemplateLis
|
|
|
147
149
|
sorters: [{ name: 'name' }]
|
|
148
150
|
};
|
|
149
151
|
}
|
|
152
|
+
/* The visibility chips' numbers; the filter form is drawn again to show them. */
|
|
153
|
+
async countChips(filters) {
|
|
154
|
+
const response = await client.query({
|
|
155
|
+
query: gql `
|
|
156
|
+
query ($filters: [Filter!]) {
|
|
157
|
+
boardTemplateVisibilityCounts(filters: $filters) { value count }
|
|
158
|
+
}
|
|
159
|
+
`,
|
|
160
|
+
variables: { filters },
|
|
161
|
+
fetchPolicy: 'no-cache'
|
|
162
|
+
});
|
|
163
|
+
if (response.errors?.length)
|
|
164
|
+
return console.error(response.errors);
|
|
165
|
+
this.counts = new Map(response.data.boardTemplateVisibilityCounts.map((row) => [row.value, row.count]));
|
|
166
|
+
this.renderRoot.querySelector('ox-filters-form')?.requestUpdate();
|
|
167
|
+
}
|
|
150
168
|
async pageUpdated() {
|
|
151
169
|
if (this.active) {
|
|
152
170
|
this.grist?.fetch();
|
|
153
171
|
}
|
|
154
172
|
}
|
|
155
173
|
async fetchHandler({ page = 1, limit = 24, sortings = [], filters = [] }) {
|
|
174
|
+
/* An empty chip strip would otherwise be sent as `in []` and match nothing. */
|
|
175
|
+
filters = filters.filter(f => !(Array.isArray(f.value) && f.value.length === 0));
|
|
176
|
+
this.countChips(filters);
|
|
156
177
|
const response = await client.query({
|
|
157
178
|
query: gql `
|
|
158
179
|
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
@@ -179,8 +200,7 @@ let BoardTemplateListPage = class BoardTemplateListPage extends BoardTemplateLis
|
|
|
179
200
|
}
|
|
180
201
|
`,
|
|
181
202
|
variables: {
|
|
182
|
-
|
|
183
|
-
filters: filters.filter(f => !(Array.isArray(f.value) && f.value.length === 0)),
|
|
203
|
+
filters,
|
|
184
204
|
pagination: { page, limit },
|
|
185
205
|
sortings
|
|
186
206
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board-template-list-page.js","sourceRoot":"","sources":["../../../client/pages/board-template/board-template-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,4CAA4C,CAAA;AACnD,OAAO,4BAA4B,CAAA;AACnC,OAAO,wCAAwC,CAAA;AAE/C,OAAO,GAAG,MAAM,aAAa,CAA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AAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0DAAiB;AACnC;IAAR,KAAK,EAAE;;yDAAwB;AAEL;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;oDAAA;AAnBjC,qBAAqB;IADjC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,qBAAqB,CAwNjC","sourcesContent":["import '@operato/data-grist'\nimport '@operato/board/ox-board-template-viewer.js'\nimport '@material/web/icon/icon.js'\nimport '../../viewparts/board-template-info.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\nimport { PageView } from '@operato/shell'\nimport { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\n\nimport { CardCatalogStyles } from '@operato/styles'\n\nimport { boardCardThumb } from '../../board-list/board-card-thumb.js'\nimport { timeAgo } from '../../utils/board-meta.js'\n\nconst BoardTemplateListPageBase = localize(i18next)(PageView) as typeof PageView\n\n/**\n * The template catalog - the same card as board-list-page.ts and play-list-page.ts (every card\n * catalog's CardCatalogStyles), because a template *is* a board, only one you start from rather\n * than one you run. Clicking a card previews it; the one gutter action opens the info overlay.\n *\n * A template is made from inside the modeller (\"save as template\"), never from here, so there is\n * no create FAB on this page.\n */\n@customElement('board-template-list-page')\nexport class BoardTemplateListPage extends BoardTemplateListPageBase {\n static styles = [\n /* The frame owns the page shell; the grist is the content it sizes (ADR-0060 decision 8). */\n WorkSurfacePageStyles,\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n /* The card itself - every card catalog's (@operato/styles), the FAB with it. */\n CardCatalogStyles,\n css`\n ox-filters-form {\n flex: 1;\n }\n `\n ]\n\n @property({ type: Object }) gristConfig: any\n @state() visibility: string = ''\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n /* A plain name, no icon - the rail already carries the icon for this screen. */\n title: i18next.t('title.board-template list'),\n search: {\n placeholder: i18next.t('text.search templates by name', { defaultValue: 'Search templates by name' }),\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n board_topmenu: true\n }\n }\n\n render() {\n return html`\n <ox-grist class=\"page-fill\" mode=\"CARD\" .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\">\n <ox-filters-form autofocus without-search></ox-filters-form>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized() {\n this.gristConfig = {\n list: {\n thumbnail: 'thumbnail',\n /* name, then a quieter \"public · who · when\" line - the same two-line rhythm as board-list. */\n fields: ['name', 'meta'],\n details: []\n },\n columns: [\n {\n type: 'image',\n name: 'thumbnail',\n record: {\n editable: false,\n align: 'center',\n renderEmpty: true,\n /* The board's picture (board-card-thumb.ts) with no badge: a template has no draft state.\n * The description rides along as the picture's tooltip - a template's one-line\n * purpose is worth having on hover without spending a third line on every card. */\n renderer: (_value, _column, record) =>\n boardCardThumb(record, { badge: '', title: record.description || '' })\n }\n },\n {\n type: 'string',\n name: 'name',\n record: { editable: false },\n filter: 'search',\n sortable: true\n },\n {\n type: 'string',\n name: 'meta',\n record: { editable: false }\n },\n {\n type: 'string',\n name: 'description',\n hidden: true,\n record: { editable: false },\n filter: 'search'\n },\n {\n type: 'gutter',\n gutterName: 'button',\n name: 'info',\n icon: 'edit',\n quiet: true,\n title: i18next.t('button.edit'),\n handlers: {\n click: (_columns, _data, _column, record) => this.onShowInfo(record)\n }\n },\n /* Visibility is a chip facet, the way board-list's type/state are. Nothing pressed means\n * all three - the server only narrows when the filter carries a value. */\n {\n type: 'select-buttons',\n name: 'visibility',\n header: i18next.t('field.visibility', { defaultValue: 'Visibility' }),\n record: { editable: false },\n filter: {\n operator: 'in',\n value: [],\n label: '',\n options: [\n { display: this.visibilityLabel('private'), value: 'private' },\n { display: this.visibilityLabel('domain'), value: 'domain' },\n { display: this.visibilityLabel('public'), value: 'public' }\n ]\n }\n }\n ],\n rows: {\n selectable: false,\n appendable: false,\n handlers: {\n click: (_columns, _data, _column, record) => this.onPreview(record)\n }\n },\n sorters: [{ name: 'name' }]\n }\n }\n\n async pageUpdated() {\n if (this.active) {\n this.grist?.fetch()\n }\n }\n\n async fetchHandler({ page = 1, limit = 24, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: boardTemplates(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n model\n thumbnail\n visibility\n tags\n mine\n creator {\n id\n username\n name\n }\n createdAt\n updatedAt\n }\n total\n }\n }\n `,\n variables: {\n /* An empty chip strip would otherwise be sent as `in []` and match nothing. */\n filters: filters.filter(f => !(Array.isArray(f.value) && f.value.length === 0)),\n pagination: { page, limit },\n sortings\n }\n })\n\n const records = (response.data.responses.items || []).map(template => ({\n ...template,\n meta: this.templateMeta(template)\n }))\n\n return {\n total: response.data.responses.total || 0,\n records\n }\n }\n\n /** \"public · Hearty · 3 days ago\" - who can see it, who made it, how fresh. */\n private templateMeta(template: any): string {\n return [this.visibilityLabel(template.visibility), template.creator?.name, timeAgo(template.updatedAt || template.createdAt)]\n .filter(part => !!part)\n .join(' · ')\n }\n\n private visibilityLabel(visibility: string): string {\n return i18next.t(`label.visibility-${visibility}`, { defaultValue: visibility })\n }\n\n private onPreview(record: any) {\n const boardTemplate = {\n ...record,\n model: JSON.parse(record.model)\n }\n\n openPopup(html` <ox-board-template-viewer .boardTemplate=${boardTemplate}></ox-board-template-viewer> `, {\n backdrop: true,\n size: 'large',\n title: record.name\n })\n }\n\n private onShowInfo(template: any) {\n openPopup(\n html`\n <board-template-info\n .template=${{ ...template }}\n @updated=${() => this.grist.fetch()}\n @deleted=${() => this.grist.fetch()}\n ></board-template-info>\n `,\n { backdrop: true, size: 'small', closable: true, title: template.name }\n )\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"board-template-list-page.js","sourceRoot":"","sources":["../../../client/pages/board-template/board-template-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,4CAA4C,CAAA;AACnD,OAAO,4BAA4B,CAAA;AACnC,OAAO,wCAAwC,CAAA;AAE/C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAE/G,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAEnD,MAAM,yBAAyB,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAoB,CAAA;AAEhF;;;;;;;GAOG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,yBAAyB;IAA7D;;QAiBI,eAAU,GAAW,EAAE,CAAA;QAChC,oHAAoH;QAC5G,WAAM,GAAG,IAAI,GAAG,EAAkB,CAAA;IA0N5C,CAAC;aA5OQ,WAAM,GAAG;QACd,6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AAM,EAAE,CAAC;;0DAAiB;AACnC;IAAR,KAAK,EAAE;;yDAAwB;AAIL;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;oDAAA;AArBjC,qBAAqB;IADjC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,qBAAqB,CA6OjC","sourcesContent":["import '@operato/data-grist'\nimport '@operato/board/ox-board-template-viewer.js'\nimport '@material/web/icon/icon.js'\nimport '../../viewparts/board-template-info.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\nimport { PageView } from '@operato/shell'\nimport { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\n\nimport { CardCatalogStyles } from '@operato/styles'\n\nimport { boardCardThumb } from '../../board-list/board-card-thumb.js'\nimport { timeAgo } from '../../utils/board-meta.js'\n\nconst BoardTemplateListPageBase = localize(i18next)(PageView) as typeof PageView\n\n/**\n * The template catalog - the same card as board-list-page.ts and play-list-page.ts (every card\n * catalog's CardCatalogStyles), because a template *is* a board, only one you start from rather\n * than one you run. Clicking a card previews it; the one gutter action opens the info overlay.\n *\n * A template is made from inside the modeller (\"save as template\"), never from here, so there is\n * no create FAB on this page.\n */\n@customElement('board-template-list-page')\nexport class BoardTemplateListPage extends BoardTemplateListPageBase {\n static styles = [\n /* The frame owns the page shell; the grist is the content it sizes (ADR-0060 decision 8). */\n WorkSurfacePageStyles,\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n /* The card itself - every card catalog's (@operato/styles), the FAB with it. */\n CardCatalogStyles,\n css`\n ox-filters-form {\n flex: 1;\n }\n `\n ]\n\n @property({ type: Object }) gristConfig: any\n @state() visibility: string = ''\n /* How many templates each visibility chip would show, under the list's other conditions - counted by the server. */\n private counts = new Map<string, number>()\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n /* A plain name, no icon - the rail already carries the icon for this screen. */\n title: i18next.t('title.board-template list'),\n search: {\n placeholder: i18next.t('text.search templates by name', { defaultValue: 'Search templates by name' }),\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n board_topmenu: true\n }\n }\n\n render() {\n return html`\n <ox-grist class=\"page-fill\" mode=\"CARD\" .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\">\n <ox-filters-form autofocus without-search></ox-filters-form>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized() {\n this.gristConfig = {\n list: {\n thumbnail: 'thumbnail',\n /* name, then a quieter \"public · who · when\" line - the same two-line rhythm as board-list. */\n fields: ['name', 'meta'],\n details: []\n },\n columns: [\n {\n type: 'image',\n name: 'thumbnail',\n record: {\n editable: false,\n align: 'center',\n renderEmpty: true,\n /* The board's picture (board-card-thumb.ts) with no badge: a template has no draft state.\n * The description rides along as the picture's tooltip - a template's one-line\n * purpose is worth having on hover without spending a third line on every card. */\n renderer: (_value, _column, record) =>\n boardCardThumb(record, { badge: '', title: record.description || '' })\n }\n },\n {\n type: 'string',\n name: 'name',\n record: { editable: false },\n filter: 'search',\n sortable: true\n },\n {\n type: 'string',\n name: 'meta',\n record: { editable: false }\n },\n {\n type: 'string',\n name: 'description',\n hidden: true,\n record: { editable: false },\n filter: 'search'\n },\n {\n type: 'gutter',\n gutterName: 'button',\n name: 'info',\n icon: 'edit',\n quiet: true,\n title: i18next.t('button.edit'),\n handlers: {\n click: (_columns, _data, _column, record) => this.onShowInfo(record)\n }\n },\n /* Visibility is a chip facet, the way board-list's type/state are. Nothing pressed means\n * all three - the server only narrows when the filter carries a value. */\n {\n type: 'select-buttons',\n name: 'visibility',\n header: i18next.t('field.visibility', { defaultValue: 'Visibility' }),\n record: { editable: false },\n filter: {\n operator: 'in',\n value: [],\n label: '',\n options: () =>\n [\n { display: this.visibilityLabel('private'), value: 'private' },\n { display: this.visibilityLabel('domain'), value: 'domain' },\n { display: this.visibilityLabel('public'), value: 'public' }\n ].map(option => ({ ...option, count: this.counts.get(option.value) ?? 0 }))\n }\n }\n ],\n rows: {\n selectable: false,\n appendable: false,\n handlers: {\n click: (_columns, _data, _column, record) => this.onPreview(record)\n }\n },\n sorters: [{ name: 'name' }]\n }\n }\n\n /* The visibility chips' numbers; the filter form is drawn again to show them. */\n private async countChips(filters: any[]) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!]) {\n boardTemplateVisibilityCounts(filters: $filters) { value count }\n }\n `,\n variables: { filters },\n fetchPolicy: 'no-cache'\n })\n if (response.errors?.length) return console.error(response.errors)\n this.counts = new Map(response.data.boardTemplateVisibilityCounts.map((row: { value: string; count: number }) => [row.value, row.count]))\n ;(this.renderRoot.querySelector('ox-filters-form') as any)?.requestUpdate()\n }\n\n async pageUpdated() {\n if (this.active) {\n this.grist?.fetch()\n }\n }\n\n async fetchHandler({ page = 1, limit = 24, sortings = [], filters = [] }: FetchOption) {\n /* An empty chip strip would otherwise be sent as `in []` and match nothing. */\n filters = filters.filter(f => !(Array.isArray(f.value) && f.value.length === 0))\n this.countChips(filters)\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: boardTemplates(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n model\n thumbnail\n visibility\n tags\n mine\n creator {\n id\n username\n name\n }\n createdAt\n updatedAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n const records = (response.data.responses.items || []).map(template => ({\n ...template,\n meta: this.templateMeta(template)\n }))\n\n return {\n total: response.data.responses.total || 0,\n records\n }\n }\n\n /** \"public · Hearty · 3 days ago\" - who can see it, who made it, how fresh. */\n private templateMeta(template: any): string {\n return [this.visibilityLabel(template.visibility), template.creator?.name, timeAgo(template.updatedAt || template.createdAt)]\n .filter(part => !!part)\n .join(' · ')\n }\n\n private visibilityLabel(visibility: string): string {\n return i18next.t(`label.visibility-${visibility}`, { defaultValue: visibility })\n }\n\n private onPreview(record: any) {\n const boardTemplate = {\n ...record,\n model: JSON.parse(record.model)\n }\n\n openPopup(html` <ox-board-template-viewer .boardTemplate=${boardTemplate}></ox-board-template-viewer> `, {\n backdrop: true,\n size: 'large',\n title: record.name\n })\n }\n\n private onShowInfo(template: any) {\n openPopup(\n html`\n <board-template-info\n .template=${{ ...template }}\n @updated=${() => this.grist.fetch()}\n @deleted=${() => this.grist.fetch()}\n ></board-template-info>\n `,\n { backdrop: true, size: 'small', closable: true, title: template.name }\n )\n }\n}\n"]}
|