@things-factory/board-ui 10.1.223 → 10.1.226

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.
@@ -1,4 +1,5 @@
1
1
  import '@operato/board/ox-property-editor-board-selector.js';
2
+ import { useThemes } from '@operato/board';
2
3
  import { OxPropertyEditor } from '@operato/property-editor';
3
4
  import { OxGristRendererJson5, registerEditor, registerRenderer } from '@operato/data-grist';
4
5
  import { appendViewpart, VIEWPART_POSITION } from '@operato/layout';
@@ -8,15 +9,19 @@ import { BoardEditor } from './data-grist/board-editor.js';
8
9
  import { BoardRenderer } from './data-grist/board-renderer.js';
9
10
  import { ColorMapEditor } from './data-grist/color-map-editor.js';
10
11
  import { ColorRangesEditor } from './data-grist/color-ranges-editor.js';
12
+ import { fetchDomainThemes } from './themes/domain-themes.js';
11
13
  export default function bootstrap() {
12
14
  registerRenderer('board', BoardRenderer);
13
15
  registerRenderer('color-map', OxGristRendererJson5);
14
16
  registerRenderer('color-ranges', OxGristRendererJson5);
17
+ registerRenderer('animation-map', OxGristRendererJson5);
15
18
  registerRenderer('hashtags', OxGristRendererHashtags);
16
19
  registerEditor('board', BoardEditor);
17
20
  registerEditor('color-map', ColorMapEditor);
18
21
  registerEditor('color-ranges', ColorRangesEditor);
19
22
  registerEditor('hashtags', OxGristEditorHashtags);
23
+ /* Every scene a board opens is given the domain's active themes: the legends a figure's table may show by (ADR-0166 7). */
24
+ useThemes(fetchDomainThemes);
20
25
  OxPropertyEditor.register({
21
26
  'board-selector': 'ox-property-editor-board-selector'
22
27
  });
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,qDAAqD,CAAA;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC5F,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAA;AAE7F,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AAEvE,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,gBAAgB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;IACxC,gBAAgB,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAA;IACnD,gBAAgB,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAA;IACtD,gBAAgB,CAAC,UAAU,EAAE,uBAAuB,CAAC,CAAA;IAErD,cAAc,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;IACpC,cAAc,CAAC,WAAW,EAAE,cAAc,CAAC,CAAA;IAC3C,cAAc,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAA;IACjD,cAAc,CAAC,UAAU,EAAE,qBAAqB,CAAC,CAAA;IAGjD,gBAAgB,CAAC,QAAQ,CAAC;QACxB,gBAAgB,EAAE,mCAAmC;KACtD,CAAC,CAAA;IAEF,wCAAwC;IACxC,cAAc,CAAC;QACb,IAAI,EAAE,eAAe;QACrB,QAAQ,EAAE;YACR,IAAI,EAAE,KAAK;YACX,QAAQ,EAAE,MAAM;YAChB,QAAQ,EAAE,IAAI;SACf;QACD,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;KACrC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import '@operato/board/ox-property-editor-board-selector.js'\n\nimport { OxPropertyEditor } from '@operato/property-editor'\nimport { OxGristRendererJson5, registerEditor, registerRenderer } from '@operato/data-grist'\nimport { appendViewpart, VIEWPART_POSITION } from '@operato/layout'\nimport { OxGristEditorHashtags } from '@operato/grist-editor/ox-grist-editor-hashtags.js'\nimport { OxGristRendererHashtags } from '@operato/grist-editor/ox-grist-renderer-hashtags.js'\n\nimport { BoardEditor } from './data-grist/board-editor.js'\nimport { BoardRenderer } from './data-grist/board-renderer.js'\nimport { ColorMapEditor } from './data-grist/color-map-editor.js'\nimport { ColorRangesEditor } from './data-grist/color-ranges-editor.js'\n\nexport default function bootstrap() {\n registerRenderer('board', BoardRenderer)\n registerRenderer('color-map', OxGristRendererJson5)\n registerRenderer('color-ranges', OxGristRendererJson5)\n registerRenderer('hashtags', OxGristRendererHashtags)\n\n registerEditor('board', BoardEditor)\n registerEditor('color-map', ColorMapEditor)\n registerEditor('color-ranges', ColorRangesEditor)\n registerEditor('hashtags', OxGristEditorHashtags)\n\n\n OxPropertyEditor.register({\n 'board-selector': 'ox-property-editor-board-selector'\n })\n\n /* append viewpart anchor to asidebar */\n appendViewpart({\n name: 'viewpart-info',\n viewpart: {\n show: false,\n hovering: 'edge',\n backdrop: true\n },\n position: VIEWPART_POSITION.ASIDEBAR\n })\n}\n"]}
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,qDAAqD,CAAA;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC5F,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAA;AAE7F,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAE7D,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,gBAAgB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;IACxC,gBAAgB,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAA;IACnD,gBAAgB,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAA;IACtD,gBAAgB,CAAC,eAAe,EAAE,oBAAoB,CAAC,CAAA;IACvD,gBAAgB,CAAC,UAAU,EAAE,uBAAuB,CAAC,CAAA;IAErD,cAAc,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;IACpC,cAAc,CAAC,WAAW,EAAE,cAAc,CAAC,CAAA;IAC3C,cAAc,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAA;IACjD,cAAc,CAAC,UAAU,EAAE,qBAAqB,CAAC,CAAA;IAEjD,2HAA2H;IAC3H,SAAS,CAAC,iBAAiB,CAAC,CAAA;IAG5B,gBAAgB,CAAC,QAAQ,CAAC;QACxB,gBAAgB,EAAE,mCAAmC;KACtD,CAAC,CAAA;IAEF,wCAAwC;IACxC,cAAc,CAAC;QACb,IAAI,EAAE,eAAe;QACrB,QAAQ,EAAE;YACR,IAAI,EAAE,KAAK;YACX,QAAQ,EAAE,MAAM;YAChB,QAAQ,EAAE,IAAI;SACf;QACD,QAAQ,EAAE,iBAAiB,CAAC,QAAQ;KACrC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import '@operato/board/ox-property-editor-board-selector.js'\n\nimport { useThemes } from '@operato/board'\n\nimport { OxPropertyEditor } from '@operato/property-editor'\nimport { OxGristRendererJson5, registerEditor, registerRenderer } from '@operato/data-grist'\nimport { appendViewpart, VIEWPART_POSITION } from '@operato/layout'\nimport { OxGristEditorHashtags } from '@operato/grist-editor/ox-grist-editor-hashtags.js'\nimport { OxGristRendererHashtags } from '@operato/grist-editor/ox-grist-renderer-hashtags.js'\n\nimport { BoardEditor } from './data-grist/board-editor.js'\nimport { BoardRenderer } from './data-grist/board-renderer.js'\nimport { ColorMapEditor } from './data-grist/color-map-editor.js'\nimport { ColorRangesEditor } from './data-grist/color-ranges-editor.js'\nimport { fetchDomainThemes } from './themes/domain-themes.js'\n\nexport default function bootstrap() {\n registerRenderer('board', BoardRenderer)\n registerRenderer('color-map', OxGristRendererJson5)\n registerRenderer('color-ranges', OxGristRendererJson5)\n registerRenderer('animation-map', OxGristRendererJson5)\n registerRenderer('hashtags', OxGristRendererHashtags)\n\n registerEditor('board', BoardEditor)\n registerEditor('color-map', ColorMapEditor)\n registerEditor('color-ranges', ColorRangesEditor)\n registerEditor('hashtags', OxGristEditorHashtags)\n\n /* Every scene a board opens is given the domain's active themes: the legends a figure's table may show by (ADR-0166 7). */\n useThemes(fetchDomainThemes)\n\n\n OxPropertyEditor.register({\n 'board-selector': 'ox-property-editor-board-selector'\n })\n\n /* append viewpart anchor to asidebar */\n appendViewpart({\n name: 'viewpart-info',\n viewpart: {\n show: false,\n hovering: 'edge',\n backdrop: true\n },\n position: VIEWPART_POSITION.ASIDEBAR\n })\n}\n"]}
@@ -6,7 +6,7 @@ import { css, html } from 'lit';
6
6
  import { customElement, property, query } from 'lit/decorators.js';
7
7
  import gql from 'graphql-tag';
8
8
  import { ScopedElementsMixin } from '@open-wc/scoped-elements';
9
- import { DataGrist, getEditor, getRenderer } from '@operato/data-grist';
9
+ import { DataGrist, getEditor, getEditors, getRenderer } from '@operato/data-grist';
10
10
  import { client } from '@operato/graphql';
11
11
  import { i18next, localize } from '@operato/i18n';
12
12
  import { notify } from '@operato/layout';
@@ -113,7 +113,7 @@ let ThemeListPage = class ThemeListPage extends localize(i18next)(ScopedElements
113
113
  { type: 'select',
114
114
  name: 'type',
115
115
  header: i18next.t('field.type'),
116
- record: { options: ['', 'color-map', 'color-ranges', 'color', 'text', 'item-types'],
116
+ record: { options: ['', 'color-map', 'animation-map', 'color-ranges', 'color', 'text', 'item-types'],
117
117
  editable: true
118
118
  },
119
119
  width: 120
@@ -122,7 +122,7 @@ let ThemeListPage = class ThemeListPage extends localize(i18next)(ScopedElements
122
122
  name: 'value',
123
123
  header: i18next.t('field.value'),
124
124
  record: { editor: function (value, column, record, rowIndex, field) {
125
- return getEditor(record.type || 'text')(value, column, record, rowIndex, field);
125
+ return getEditor(legendEditorOf(record.type) || record.type || 'text')(value, column, record, rowIndex, field);
126
126
  },
127
127
  renderer: function (value, column, record, rowIndex, field) {
128
128
  return getRenderer(record.type || 'text')(value, column, record, rowIndex, field);
@@ -255,4 +255,13 @@ ThemeListPage = __decorate([
255
255
  customElement('theme-list-page')
256
256
  ], ThemeListPage);
257
257
  export { ThemeListPage };
258
+ /** The kinds of theme that are legends (ADR-0166 7): a code map, a code map with 2D animation, a range map. */
259
+ const LEGEND_KINDS = ['color-map', 'animation-map', 'color-ranges'];
260
+ /**
261
+ * A legend's editor: the one that edits each code's look -- colour, effect, values (ADR-0166 11) -- when an app's module
262
+ * registers it (`legend-looks`, the figure library), else the kind's own.
263
+ */
264
+ function legendEditorOf(type) {
265
+ return type && LEGEND_KINDS.includes(type) && getEditors()['legend-looks'] ? 'legend-looks' : undefined;
266
+ }
258
267
  //# sourceMappingURL=theme-list-page.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"theme-list-page.js","sourceRoot":"","sources":["../../../client/pages/theme/theme-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AACnI,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,IA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,CAAC;QACD,CAAC;IACD,CAAC;;AAxM4B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CAAoE;AAEpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;4CAAA;AApBjC,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CA0NzB","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonButtonStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { PageView } from '@operato/shell'\nimport { css, html } from 'lit'\n\nimport { customElement, property, query } from 'lit/decorators.js'\nimport gql from 'graphql-tag'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { DataGrist, FetchOption, getEditor, getRenderer } from '@operato/data-grist'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify } from '@operato/layout'\nimport { isMobileDevice } from '@operato/utils'\n\n// export interface ThemeType { // name: string\n// propType: string\n// }\n\n// var ThemeTypes: { [name: string]: ThemeType } = { // Legend: { // name: 'Legend',\n// propType: 'legend'\n// }\n// }\n\n@customElement('theme-list-page')\nexport class ThemeListPage extends localize(i18next)(ScopedElementsMixin(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.theme list'),\n search: { handler: (search: string) => { this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: { handler: () => { this.grist.toggleHeadroom()\n }\n },\n help: 'board-service/theme',\n actions: [\n { title: i18next.t('button.save'),\n action: this._updateTheme.bind(this),\n ...CommonButtonStyles.save\n },\n { title: i18next.t('button.delete'),\n action: this._deleteTheme.bind(this),\n ...CommonButtonStyles.delete\n }\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 autofocus without-search></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: ['type', 'updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n { type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: { editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n { type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: { editable: true\n },\n filter: 'search',\n width: 200\n },\n { type: 'checkbox',\n name: 'active',\n header: i18next.t('field.active'),\n record: { editable: true\n },\n width: 60\n },\n { type: 'select',\n name: 'type',\n header: i18next.t('field.type'),\n record: { options: ['', 'color-map', 'color-ranges', 'color', 'text', 'item-types'],\n editable: true\n },\n width: 120\n },\n { type: 'object',\n name: 'value',\n header: i18next.t('field.value'),\n record: { editor: function (value, column, record, rowIndex, field) { return getEditor(record.type || 'text')(value, column, record, rowIndex, field)\n },\n renderer: function (value, column, record, rowIndex, field) { return getRenderer(record.type || 'text')(value, column, record, rowIndex, field)\n },\n editable: true,\n options: { objectified: true\n }\n },\n sortable: true,\n width: 180\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: themes(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id\n name\n description\n active\n type\n value\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 _deleteTheme() { if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('button.delete') }))) { const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n /* A hook of React cannot be called here (useMutation): this page is a Lit element. */\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteThemes(ids: $ids)\n }\n `,\n variables: { ids }\n })\n\n if (!response.errors) { this.grist.fetch()\n notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('button.delete') })\n })\n }\n }\n }\n }\n\n async _updateTheme() { 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({\n mutation: gql`\n mutation ($patches: [ThemePatch!]!) {\n updateMultipleTheme(patches: $patches) {\n name\n }\n }\n `,\n variables: { patches }\n })\n\n if (!response.errors) { this.grist.fetch()\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"theme-list-page.js","sourceRoot":"","sources":["../../../client/pages/theme/theme-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AACnI,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAe,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEhG,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,iDAAiD;AACjD,qBAAqB;AACrB,IAAI;AAEJ,0FAA0F;AAC1F,yBAAyB;AACzB,IAAI;AACJ,IAAI;AAGG,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAA5E;;QAkBuB,SAAI,GAA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Styles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { PageView } from '@operato/shell'\nimport { css, html } from 'lit'\n\nimport { customElement, property, query } from 'lit/decorators.js'\nimport gql from 'graphql-tag'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { DataGrist, FetchOption, getEditor, getEditors, getRenderer } from '@operato/data-grist'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify } from '@operato/layout'\nimport { isMobileDevice } from '@operato/utils'\n\n// export interface ThemeType { // name: string\n// propType: string\n// }\n\n// var ThemeTypes: { [name: string]: ThemeType } = { // Legend: { // name: 'Legend',\n// propType: 'legend'\n// }\n// }\n\n@customElement('theme-list-page')\nexport class ThemeListPage extends localize(i18next)(ScopedElementsMixin(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.theme list'),\n search: { handler: (search: string) => { this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: { handler: () => { this.grist.toggleHeadroom()\n }\n },\n help: 'board-service/theme',\n actions: [\n { title: i18next.t('button.save'),\n action: this._updateTheme.bind(this),\n ...CommonButtonStyles.save\n },\n { title: i18next.t('button.delete'),\n action: this._deleteTheme.bind(this),\n ...CommonButtonStyles.delete\n }\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 autofocus without-search></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: ['type', 'updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n { type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: { editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n { type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: { editable: true\n },\n filter: 'search',\n width: 200\n },\n { type: 'checkbox',\n name: 'active',\n header: i18next.t('field.active'),\n record: { editable: true\n },\n width: 60\n },\n { type: 'select',\n name: 'type',\n header: i18next.t('field.type'),\n record: { options: ['', 'color-map', 'animation-map', 'color-ranges', 'color', 'text', 'item-types'],\n editable: true\n },\n width: 120\n },\n { type: 'object',\n name: 'value',\n header: i18next.t('field.value'),\n record: { editor: function (value, column, record, rowIndex, field) { return getEditor(legendEditorOf(record.type) || record.type || 'text')(value, column, record, rowIndex, field)\n },\n renderer: function (value, column, record, rowIndex, field) { return getRenderer(record.type || 'text')(value, column, record, rowIndex, field)\n },\n editable: true,\n options: { objectified: true\n }\n },\n sortable: true,\n width: 180\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: themes(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id\n name\n description\n active\n type\n value\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 _deleteTheme() { if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('button.delete') }))) { const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n /* A hook of React cannot be called here (useMutation): this page is a Lit element. */\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteThemes(ids: $ids)\n }\n `,\n variables: { ids }\n })\n\n if (!response.errors) { this.grist.fetch()\n notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('button.delete') })\n })\n }\n }\n }\n }\n\n async _updateTheme() { 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({\n mutation: gql`\n mutation ($patches: [ThemePatch!]!) {\n updateMultipleTheme(patches: $patches) {\n name\n }\n }\n `,\n variables: { patches }\n })\n\n if (!response.errors) { this.grist.fetch()\n }\n }\n }\n}\n\n/** The kinds of theme that are legends (ADR-0166 7): a code map, a code map with 2D animation, a range map. */\nconst LEGEND_KINDS = ['color-map', 'animation-map', 'color-ranges']\n\n/**\n * A legend's editor: the one that edits each code's look -- colour, effect, values (ADR-0166 11) -- when an app's module\n * registers it (`legend-looks`, the figure library), else the kind's own.\n */\nfunction legendEditorOf(type: string | undefined): string | undefined {\n return type && LEGEND_KINDS.includes(type) && getEditors()['legend-looks'] ? 'legend-looks' : undefined\n}\n"]}
@@ -0,0 +1,2 @@
1
+ /** The domain's active themes by name; none when they cannot be read -- the figures' own tables then show. */
2
+ export declare function fetchDomainThemes(): Promise<Record<string, unknown>>;
@@ -0,0 +1,27 @@
1
+ /*
2
+ * The domain's themes as a scene is given them (ADR-0166 7): every active one, name → value, whatever its kind -- a
3
+ * figure's table finds the legend chosen for its role among them by name. Asked each time a scene opens.
4
+ */
5
+ import gql from 'graphql-tag';
6
+ import { client } from '@operato/graphql';
7
+ const ACTIVE_THEMES = gql `
8
+ query ($filters: [Filter!]) {
9
+ themes(filters: $filters) {
10
+ items {
11
+ name
12
+ value
13
+ }
14
+ }
15
+ }
16
+ `;
17
+ /** The domain's active themes by name; none when they cannot be read -- the figures' own tables then show. */
18
+ export async function fetchDomainThemes() {
19
+ try {
20
+ const { data } = await client.query({ query: ACTIVE_THEMES, variables: { filters: [{ name: 'active', operator: 'eq', value: true }] }, fetchPolicy: 'network-only' });
21
+ return Object.fromEntries((data?.themes?.items ?? []).filter((t) => typeof t?.name === 'string').map((t) => [t.name, t.value]));
22
+ }
23
+ catch {
24
+ return {};
25
+ }
26
+ }
27
+ //# sourceMappingURL=domain-themes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-themes.js","sourceRoot":"","sources":["../../client/themes/domain-themes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEzC,MAAM,aAAa,GAAG,GAAG,CAAA;;;;;;;;;CASxB,CAAA;AAED,8GAA8G;AAC9G,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,IAAI,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAAA;QACrK,OAAO,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAqB,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAmC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACvL,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC","sourcesContent":["/*\n * The domain's themes as a scene is given them (ADR-0166 7): every active one, name → value, whatever its kind -- a\n * figure's table finds the legend chosen for its role among them by name. Asked each time a scene opens.\n */\nimport gql from 'graphql-tag'\n\nimport { client } from '@operato/graphql'\n\nconst ACTIVE_THEMES = gql`\n query ($filters: [Filter!]) {\n themes(filters: $filters) {\n items {\n name\n value\n }\n }\n }\n`\n\n/** The domain's active themes by name; none when they cannot be read -- the figures' own tables then show. */\nexport async function fetchDomainThemes(): Promise<Record<string, unknown>> {\n try {\n const { data } = await client.query({ query: ACTIVE_THEMES, variables: { filters: [{ name: 'active', operator: 'eq', value: true }] }, fetchPolicy: 'network-only' })\n return Object.fromEntries((data?.themes?.items ?? []).filter((t: { name?: unknown }) => typeof t?.name === 'string').map((t: { name: string; value: unknown }) => [t.name, t.value]))\n } catch {\n return {}\n }\n}\n"]}