@operato/process 1.5.25 → 1.5.26
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/CHANGELOG.md +9 -0
- package/dist/src/ox-process-list.js +4 -3
- package/dist/src/ox-process-list.js.map +1 -1
- package/dist/src/ox-process-template-list.d.ts +108 -0
- package/dist/src/ox-process-template-list.js +242 -0
- package/dist/src/ox-process-template-list.js.map +1 -0
- package/dist/src/selector/ox-process-creation-card.js +4 -2
- package/dist/src/selector/ox-process-creation-card.js.map +1 -1
- package/dist/src/selector/ox-process-selector.d.ts +1 -1
- package/dist/src/selector/ox-process-selector.js +4 -4
- package/dist/src/selector/ox-process-selector.js.map +1 -1
- package/dist/src/selector/process-creation-popup.d.ts +4 -1
- package/dist/src/selector/process-creation-popup.js +62 -24
- package/dist/src/selector/process-creation-popup.js.map +1 -1
- package/dist/src/types.d.ts +1 -0
- package/dist/src/types.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/ox-process-list.ts +5 -3
- package/src/ox-process-template-list.ts +265 -0
- package/src/selector/ox-process-creation-card.ts +4 -2
- package/src/selector/ox-process-selector.ts +10 -8
- package/src/selector/process-creation-popup.ts +65 -26
- package/src/types.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
### [1.5.26](https://github.com/heartyoh/ioperato/compare/v1.5.25...v1.5.26) (2023-11-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### :bug: Bug Fix
|
|
10
|
+
|
|
11
|
+
* process and process-template ([6345e3a](https://github.com/heartyoh/ioperato/commit/6345e3ad565550ee2dcb1e5d303f5316ea71db7a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
### [1.5.25](https://github.com/heartyoh/ioperato/compare/v1.5.24...v1.5.25) (2023-11-05)
|
|
7
16
|
|
|
8
17
|
**Note:** Version bump only for package @operato/process
|
|
@@ -236,15 +236,16 @@ let ProcessList = class ProcessList extends LitElement {
|
|
|
236
236
|
.groups=${this.groups}
|
|
237
237
|
@create-process=${async (e) => {
|
|
238
238
|
try {
|
|
239
|
-
var { name, description, groupId } = e.detail;
|
|
239
|
+
var { name, description, groupId, model, thumbnail } = e.detail;
|
|
240
240
|
var process = {
|
|
241
241
|
name,
|
|
242
242
|
description,
|
|
243
243
|
groupId,
|
|
244
|
-
model: {
|
|
244
|
+
model: model || {
|
|
245
245
|
width: 1200,
|
|
246
246
|
height: 800
|
|
247
|
-
}
|
|
247
|
+
},
|
|
248
|
+
thumbnail
|
|
248
249
|
};
|
|
249
250
|
const { createProcess: created } = await createProcess(process);
|
|
250
251
|
// this.popup && this.popup.close()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-process-list.js","sourceRoot":"","sources":["../../src/ox-process-list.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAGzE,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAExC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAI/D,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QAwH+B,cAAS,GAAY,KAAK,CAAA;QAG3B,SAAI,GAA6B,MAAM,CAAA;QAExC,WAAM,GAAU,E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 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { ColumnConfig, DataGrist, GristData, GristRecord, SortersConfig } from '@operato/data-grist'\nimport { OxPopup } from '@operato/popup'\n\nimport { createProcess, fetchProcessList } from './graphql/process'\nimport { fetchFavoriteProcessList } from './graphql/favorite-process'\nimport { fetchProcessGroupList } from './graphql/process-group'\nimport { Process } from './types'\n\n@customElement('ox-process-list')\nclass ProcessList extends LitElement {\n static styles = css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: red;\n --grid-record-emphasized-color: yellow;\n }\n\n ox-grist {\n flex: 1;\n overflow-y: auto;\n\n --grid-record-emphasized-background-color: red;\n --grid-record-emphasized-color: yellow;\n }\n\n #headroom {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: var(--padding-default) var(--padding-wide);\n border-top: 2px solid rgba(0, 0, 0, 0.2);\n background-color: var(--theme-white-color);\n box-shadow: var(--box-shadow);\n }\n\n #filters {\n flex: 1;\n --mdc-icon-size: 20px;\n }\n #mode {\n width: 100px;\n }\n #add {\n width: 50px;\n text-align: right;\n }\n\n #modes > * {\n padding: var(--padding-narrow);\n font-size: 1em;\n opacity: 0.5;\n color: var(--primary-text-color);\n cursor: pointer;\n }\n\n #modes > mwc-icon[active] {\n border-radius: 9px;\n background-color: rgba(var(--primary-color-rgb), 0.05);\n opacity: 1;\n color: var(--secondary-text-color);\n cursor: default;\n }\n #modes > mwc-icon:hover {\n opacity: 1;\n color: var(--secondary-text-color);\n }\n\n #add button {\n background-color: var(--primary-color);\n border: 0;\n border-radius: 50%;\n padding: 5px;\n width: 36px;\n height: 36px;\n cursor: pointer;\n }\n #add button:hover {\n background-color: var(--focus-background-color);\n box-shadow: var(--box-shadow);\n }\n #add button mwc-icon {\n font-size: 2em;\n color: var(--theme-white-color);\n }\n\n #filters {\n position: relative;\n }\n #filters [type='text'] {\n background-color: transparent;\n border: 0;\n border-bottom: var(--border-dark-color);\n padding: var(--padding-narrow) var(--padding-narrow) 7px 25px;\n font-size: var(--fontsize-large);\n }\n #filters [type='text']:focus {\n outline: none;\n }\n #filters mwc-icon {\n position: absolute;\n top: 3px;\n color: var(--secondary-color);\n }\n #filters * {\n margin-right: var(--margin-default);\n }\n\n oops-spinner {\n display: none;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n\n oops-spinner[show] {\n display: block;\n }\n\n @media only screen and (max-width: 460px) {\n #modes {\n display: none;\n }\n }\n `\n\n @property({ type: Boolean }) creatable: boolean = false\n @property({ type: Object }) config: any\n @property({ type: Object }) data: any\n @property({ type: String }) mode: 'GRID' | 'LIST' | 'CARD' = 'CARD'\n @property({ type: String }) groupId?: string\n @property({ type: Array }) groups: any[] = []\n @property({ type: Array }) favorites: any[] = []\n\n @state() _showSpinner: boolean = false\n\n @query('ox-grist') grist!: DataGrist\n\n render() {\n const mode = this.mode || 'CARD'\n\n return html`\n <ox-grist .config=${this.config} .mode=${mode} auto-fetch .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" id=\"headroom\">\n <div id=\"filters\">\n <mwc-icon>search</mwc-icon>\n <input type=\"text\" />\n\n <select\n @change=${(e: Event) => {\n this.groupId = (e.currentTarget as HTMLInputElement).value\n this.requestUpdate()\n }}\n >\n <option value=\"\">*</option>\n ${this.groups.map(\n group =>\n html` <option value=${group.id} ?selected=${group.id === this.groupId}>${group.description}</option> `\n )}\n </select>\n </div>\n\n <div id=\"modes\">\n <mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>\n <mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>\n <mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>\n </div>\n\n ${this.creatable\n ? html`\n <div id=\"add\">\n <button><mwc-icon @click=${() => this.onCreateProcess()}>add</mwc-icon></button>\n </div>\n `\n : undefined}\n </div>\n </ox-grist>\n\n <oops-spinner ?show=${this._showSpinner}></oops-spinner>\n `\n }\n\n async fetchHandler({ page, limit, sorters = [] }: { page: number; limit: number; sorters: SortersConfig }) {\n this._showSpinner = true\n\n const { items: records, total } = await this.getProcesses({ page, limit, sorters })\n\n this._showSpinner = false\n\n return {\n total,\n records\n }\n }\n\n get gristConfig() {\n return {\n list: {\n thumbnail: function (record: GristRecord, rowIndex: number) {\n return html` <img src=${record.thumbnail} style=\"width: 100%; height: 100%;\" /> `\n },\n fields: ['name', 'description'],\n details: ['updatedAt']\n },\n columns: [\n {\n type: 'gutter',\n gutterName: 'dirty'\n },\n {\n type: 'gutter',\n gutterName: 'sequence'\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'star_border',\n handlers: {\n click: (\n columns: ColumnConfig[],\n data: GristData,\n column: ColumnConfig,\n record: GristRecord,\n rowIndex: number\n ): void => {}\n }\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'drive_file_rename_outline',\n handlers: {\n click: (\n columns: ColumnConfig[],\n data: GristData,\n column: ColumnConfig,\n record: GristRecord,\n rowIndex: number\n ): void => {}\n }\n },\n {\n type: 'string',\n name: 'id',\n hidden: true\n },\n {\n type: 'string',\n name: 'name',\n header: 'name',\n record: {\n editable: true,\n align: 'left'\n },\n width: 200,\n sortable: true\n },\n {\n type: 'string',\n name: 'description',\n header: 'description',\n record: {\n editable: true,\n align: 'left'\n },\n width: 200,\n handlers: {\n dblclick: (\n columns: ColumnConfig[],\n data: GristData,\n column: ColumnConfig,\n record: GristRecord,\n rowIndex: number\n ): void => {\n alert(`${column.name} ${record[column.name]}, row : ${rowIndex}`)\n }\n }\n },\n {\n type: 'boolean',\n name: 'active',\n header: 'active',\n record: {\n editable: true\n },\n sortable: true,\n width: 60\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: 'updated at',\n record: {\n editable: true\n },\n sortable: true,\n width: 180\n },\n {\n type: 'datetime',\n name: 'createdAt',\n header: 'created at',\n record: {\n editable: true\n },\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n },\n handlers: {},\n classifier: function (\n record: GristRecord,\n rowIndex: number\n ): { emphasized?: boolean | string | string[]; [key: string]: any } | void {}\n },\n sorters: [\n {\n name: 'name',\n desc: false\n }\n ],\n pagination: {\n pages: [20, 30, 50, 100, 200]\n }\n }\n }\n\n async refresh() {\n this.groups = (await fetchProcessGroupList()).processGroups.items\n\n if (this.groups) {\n await this.refreshProcesses()\n }\n }\n\n async getProcesses({\n page = 1,\n limit = 30,\n sorters = []\n }: { page?: number; limit?: number; sorters?: SortersConfig } = {}) {\n if (this.groupId && this.groupId == 'favor')\n return await this.getFavoriteProcesses({\n page,\n limit\n })\n\n var listParam = {\n filters: this.groupId\n ? [\n {\n name: 'groupId',\n operator: 'eq',\n value: this.groupId\n }\n ]\n : [],\n sortings: sorters,\n pagination: {\n page,\n limit\n }\n }\n\n return (await fetchProcessList(listParam)).processes\n }\n\n async getFavoriteProcesses({ page = 1, limit = 30 } = {}) {\n var listParam = {\n pagination: {\n page,\n limit\n }\n }\n\n return (await fetchFavoriteProcessList(listParam)).favoriteProcesses\n }\n\n async refreshProcesses() {\n if (!this.groups) {\n await this.refresh()\n return\n }\n\n this.grist.fetch()\n }\n\n async onCreateProcess() {\n /*\n * 기존 설정된 이미지가 선택된 상태가 되게 하기 위해서는 selector에 value를 전달해줄 필요가 있음.\n * 주의. value는 object일 수도 있고, string일 수도 있다.\n * string인 경우에는 해당 보드의 id로 해석한다.\n */\n var template = html`\n <process-creation-popup\n .defaultGroup=${this.groupId}\n .groups=${this.groups}\n @create-process=${async (e: CustomEvent) => {\n try {\n var { name, description, groupId } = e.detail\n var process: Process = {\n name,\n description,\n groupId,\n model: {\n width: 1200,\n height: 800\n }\n }\n\n const { createProcess: created } = await createProcess(process)\n\n // this.popup && this.popup.close()\n\n // await sleep(100)\n\n this.notify('info', 'new process created')\n } catch (ex: Error | any) {\n console.error(ex)\n this.notify('error', ex, ex)\n }\n }}\n ></process-creation-popup>\n `\n\n OxPopup.open({\n template,\n parent: this.renderRoot as Element\n })\n\n requestAnimationFrame(() => {\n dispatchEvent(new Event('resize'))\n })\n }\n\n notify(level: 'warn' | 'error' | 'info', message: any, ex?: Error) {\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level,\n message,\n ex\n }\n })\n )\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ox-process-list.js","sourceRoot":"","sources":["../../src/ox-process-list.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAGzE,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAExC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAI/D,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QAwH+B,cAAS,GAAY,KAAK,CAAA;QAG3B,SAAI,GAA6B,MAAM,CAAA;QAExC,WAAM,GAAU,EAAE,CAAA;QAClB,cAAS,GAAU,EAAE,CAAA;QAEvC,iBAAY,GAAY,KAAK,CAAA;IA6TxC,CAAC;IAzTC,MAAM;QACJ,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,MAAM,CAAA;QAEhC,OAAO,IAAI,CAAA;0BACW,IAAI,CAAC,MAAM,UAAU,IAAI,6BAA6B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;wBAOpF,CAAC,CAAQ,EAAE,EAAE;YACrB,IAAI,C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E;aACH;SACF,CAAC,CACH,CAAA;IACH,CAAC;;AA3bM,kBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqHlB,AArHY,CAqHZ;AAE4B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8CAA2B;AAC3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAY;AACX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAU;AACT;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAwC;AACvC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAiB;AACjB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;2CAAmB;AAClB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;8CAAsB;AAEvC;IAAR,KAAK,EAAE;iDAA8B;AAEnB;IAAlB,KAAK,CAAC,UAAU,CAAC;0CAAkB;AAlIhC,WAAW;IADhB,aAAa,CAAC,iBAAiB,CAAC;GAC3B,WAAW,CA6bhB","sourcesContent":["import '@operato/popup/ox-popup.js'\nimport '@operato/data-grist'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { ColumnConfig, DataGrist, GristData, GristRecord, SortersConfig } from '@operato/data-grist'\nimport { OxPopup } from '@operato/popup'\n\nimport { createProcess, fetchProcessList } from './graphql/process'\nimport { fetchFavoriteProcessList } from './graphql/favorite-process'\nimport { fetchProcessGroupList } from './graphql/process-group'\nimport { Process } from './types'\n\n@customElement('ox-process-list')\nclass ProcessList extends LitElement {\n static styles = css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: red;\n --grid-record-emphasized-color: yellow;\n }\n\n ox-grist {\n flex: 1;\n overflow-y: auto;\n\n --grid-record-emphasized-background-color: red;\n --grid-record-emphasized-color: yellow;\n }\n\n #headroom {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: var(--padding-default) var(--padding-wide);\n border-top: 2px solid rgba(0, 0, 0, 0.2);\n background-color: var(--theme-white-color);\n box-shadow: var(--box-shadow);\n }\n\n #filters {\n flex: 1;\n --mdc-icon-size: 20px;\n }\n #mode {\n width: 100px;\n }\n #add {\n width: 50px;\n text-align: right;\n }\n\n #modes > * {\n padding: var(--padding-narrow);\n font-size: 1em;\n opacity: 0.5;\n color: var(--primary-text-color);\n cursor: pointer;\n }\n\n #modes > mwc-icon[active] {\n border-radius: 9px;\n background-color: rgba(var(--primary-color-rgb), 0.05);\n opacity: 1;\n color: var(--secondary-text-color);\n cursor: default;\n }\n #modes > mwc-icon:hover {\n opacity: 1;\n color: var(--secondary-text-color);\n }\n\n #add button {\n background-color: var(--primary-color);\n border: 0;\n border-radius: 50%;\n padding: 5px;\n width: 36px;\n height: 36px;\n cursor: pointer;\n }\n #add button:hover {\n background-color: var(--focus-background-color);\n box-shadow: var(--box-shadow);\n }\n #add button mwc-icon {\n font-size: 2em;\n color: var(--theme-white-color);\n }\n\n #filters {\n position: relative;\n }\n #filters [type='text'] {\n background-color: transparent;\n border: 0;\n border-bottom: var(--border-dark-color);\n padding: var(--padding-narrow) var(--padding-narrow) 7px 25px;\n font-size: var(--fontsize-large);\n }\n #filters [type='text']:focus {\n outline: none;\n }\n #filters mwc-icon {\n position: absolute;\n top: 3px;\n color: var(--secondary-color);\n }\n #filters * {\n margin-right: var(--margin-default);\n }\n\n oops-spinner {\n display: none;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n\n oops-spinner[show] {\n display: block;\n }\n\n @media only screen and (max-width: 460px) {\n #modes {\n display: none;\n }\n }\n `\n\n @property({ type: Boolean }) creatable: boolean = false\n @property({ type: Object }) config: any\n @property({ type: Object }) data: any\n @property({ type: String }) mode: 'GRID' | 'LIST' | 'CARD' = 'CARD'\n @property({ type: String }) groupId?: string\n @property({ type: Array }) groups: any[] = []\n @property({ type: Array }) favorites: any[] = []\n\n @state() _showSpinner: boolean = false\n\n @query('ox-grist') grist!: DataGrist\n\n render() {\n const mode = this.mode || 'CARD'\n\n return html`\n <ox-grist .config=${this.config} .mode=${mode} auto-fetch .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" id=\"headroom\">\n <div id=\"filters\">\n <mwc-icon>search</mwc-icon>\n <input type=\"text\" />\n\n <select\n @change=${(e: Event) => {\n this.groupId = (e.currentTarget as HTMLInputElement).value\n this.requestUpdate()\n }}\n >\n <option value=\"\">*</option>\n ${this.groups.map(\n group =>\n html` <option value=${group.id} ?selected=${group.id === this.groupId}>${group.description}</option> `\n )}\n </select>\n </div>\n\n <div id=\"modes\">\n <mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>\n <mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>\n <mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>\n </div>\n\n ${this.creatable\n ? html`\n <div id=\"add\">\n <button><mwc-icon @click=${() => this.onCreateProcess()}>add</mwc-icon></button>\n </div>\n `\n : undefined}\n </div>\n </ox-grist>\n\n <oops-spinner ?show=${this._showSpinner}></oops-spinner>\n `\n }\n\n async fetchHandler({ page, limit, sorters = [] }: { page: number; limit: number; sorters: SortersConfig }) {\n this._showSpinner = true\n\n const { items: records, total } = await this.getProcesses({ page, limit, sorters })\n\n this._showSpinner = false\n\n return {\n total,\n records\n }\n }\n\n get gristConfig() {\n return {\n list: {\n thumbnail: function (record: GristRecord, rowIndex: number) {\n return html` <img src=${record.thumbnail} style=\"width: 100%; height: 100%;\" /> `\n },\n fields: ['name', 'description'],\n details: ['updatedAt']\n },\n columns: [\n {\n type: 'gutter',\n gutterName: 'dirty'\n },\n {\n type: 'gutter',\n gutterName: 'sequence'\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'star_border',\n handlers: {\n click: (\n columns: ColumnConfig[],\n data: GristData,\n column: ColumnConfig,\n record: GristRecord,\n rowIndex: number\n ): void => {}\n }\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'drive_file_rename_outline',\n handlers: {\n click: (\n columns: ColumnConfig[],\n data: GristData,\n column: ColumnConfig,\n record: GristRecord,\n rowIndex: number\n ): void => {}\n }\n },\n {\n type: 'string',\n name: 'id',\n hidden: true\n },\n {\n type: 'string',\n name: 'name',\n header: 'name',\n record: {\n editable: true,\n align: 'left'\n },\n width: 200,\n sortable: true\n },\n {\n type: 'string',\n name: 'description',\n header: 'description',\n record: {\n editable: true,\n align: 'left'\n },\n width: 200,\n handlers: {\n dblclick: (\n columns: ColumnConfig[],\n data: GristData,\n column: ColumnConfig,\n record: GristRecord,\n rowIndex: number\n ): void => {\n alert(`${column.name} ${record[column.name]}, row : ${rowIndex}`)\n }\n }\n },\n {\n type: 'boolean',\n name: 'active',\n header: 'active',\n record: {\n editable: true\n },\n sortable: true,\n width: 60\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: 'updated at',\n record: {\n editable: true\n },\n sortable: true,\n width: 180\n },\n {\n type: 'datetime',\n name: 'createdAt',\n header: 'created at',\n record: {\n editable: true\n },\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n },\n handlers: {},\n classifier: function (\n record: GristRecord,\n rowIndex: number\n ): { emphasized?: boolean | string | string[]; [key: string]: any } | void {}\n },\n sorters: [\n {\n name: 'name',\n desc: false\n }\n ],\n pagination: {\n pages: [20, 30, 50, 100, 200]\n }\n }\n }\n\n async refresh() {\n this.groups = (await fetchProcessGroupList()).processGroups.items\n\n if (this.groups) {\n await this.refreshProcesses()\n }\n }\n\n async getProcesses({\n page = 1,\n limit = 30,\n sorters = []\n }: { page?: number; limit?: number; sorters?: SortersConfig } = {}) {\n if (this.groupId && this.groupId == 'favor')\n return await this.getFavoriteProcesses({\n page,\n limit\n })\n\n var listParam = {\n filters: this.groupId\n ? [\n {\n name: 'groupId',\n operator: 'eq',\n value: this.groupId\n }\n ]\n : [],\n sortings: sorters,\n pagination: {\n page,\n limit\n }\n }\n\n return (await fetchProcessList(listParam)).processes\n }\n\n async getFavoriteProcesses({ page = 1, limit = 30 } = {}) {\n var listParam = {\n pagination: {\n page,\n limit\n }\n }\n\n return (await fetchFavoriteProcessList(listParam)).favoriteProcesses\n }\n\n async refreshProcesses() {\n if (!this.groups) {\n await this.refresh()\n return\n }\n\n this.grist.fetch()\n }\n\n async onCreateProcess() {\n /*\n * 기존 설정된 이미지가 선택된 상태가 되게 하기 위해서는 selector에 value를 전달해줄 필요가 있음.\n * 주의. value는 object일 수도 있고, string일 수도 있다.\n * string인 경우에는 해당 보드의 id로 해석한다.\n */\n var template = html`\n <process-creation-popup\n .defaultGroup=${this.groupId}\n .groups=${this.groups}\n @create-process=${async (e: CustomEvent) => {\n try {\n var { name, description, groupId, model, thumbnail } = e.detail\n\n var process: Process = {\n name,\n description,\n groupId,\n model: model || {\n width: 1200,\n height: 800\n },\n thumbnail\n }\n\n const { createProcess: created } = await createProcess(process)\n\n // this.popup && this.popup.close()\n\n // await sleep(100)\n\n this.notify('info', 'new process created')\n } catch (ex: Error | any) {\n console.error(ex)\n this.notify('error', ex, ex)\n }\n }}\n ></process-creation-popup>\n `\n\n OxPopup.open({\n template,\n parent: this.renderRoot as Element\n })\n\n requestAnimationFrame(() => {\n dispatchEvent(new Event('resize'))\n })\n }\n\n notify(level: 'warn' | 'error' | 'info', message: any, ex?: Error) {\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level,\n message,\n ex\n }\n })\n )\n }\n}\n"]}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import '@operato/data-grist';
|
|
2
|
+
import '@operato/input/ox-input-file.js';
|
|
3
|
+
import { LitElement } from 'lit';
|
|
4
|
+
import { DataGrist, FetchOption, FilterValue, SortersConfig } from '@operato/data-grist';
|
|
5
|
+
export declare class OxProcessTemplateList extends LitElement {
|
|
6
|
+
static styles: import("lit").CSSResult[];
|
|
7
|
+
withoutSearch: boolean;
|
|
8
|
+
grist: DataGrist;
|
|
9
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
+
fetchHandler({ page, limit, sortings, filters }: FetchOption): Promise<{
|
|
11
|
+
total: any;
|
|
12
|
+
records: any;
|
|
13
|
+
}>;
|
|
14
|
+
get gristConfig(): {
|
|
15
|
+
list: {
|
|
16
|
+
thumbnail: string;
|
|
17
|
+
fields: string[];
|
|
18
|
+
details: string[];
|
|
19
|
+
};
|
|
20
|
+
columns: ({
|
|
21
|
+
type: string;
|
|
22
|
+
name: string;
|
|
23
|
+
hidden: boolean;
|
|
24
|
+
header?: undefined;
|
|
25
|
+
record?: undefined;
|
|
26
|
+
width?: undefined;
|
|
27
|
+
filter?: undefined;
|
|
28
|
+
sortable?: undefined;
|
|
29
|
+
} | {
|
|
30
|
+
type: string;
|
|
31
|
+
name: string;
|
|
32
|
+
header: string;
|
|
33
|
+
record: {
|
|
34
|
+
editable: boolean;
|
|
35
|
+
align: string;
|
|
36
|
+
};
|
|
37
|
+
width: number;
|
|
38
|
+
filter: string;
|
|
39
|
+
sortable: boolean;
|
|
40
|
+
hidden?: undefined;
|
|
41
|
+
} | {
|
|
42
|
+
type: string;
|
|
43
|
+
name: string;
|
|
44
|
+
header: string;
|
|
45
|
+
record: {
|
|
46
|
+
editable: boolean;
|
|
47
|
+
align: string;
|
|
48
|
+
};
|
|
49
|
+
width: number;
|
|
50
|
+
filter: string;
|
|
51
|
+
hidden?: undefined;
|
|
52
|
+
sortable?: undefined;
|
|
53
|
+
} | {
|
|
54
|
+
type: string;
|
|
55
|
+
name: string;
|
|
56
|
+
header: string;
|
|
57
|
+
record: {
|
|
58
|
+
editable: boolean;
|
|
59
|
+
align?: undefined;
|
|
60
|
+
};
|
|
61
|
+
hidden: boolean;
|
|
62
|
+
filter: {
|
|
63
|
+
operator: string;
|
|
64
|
+
options: string[];
|
|
65
|
+
label: string;
|
|
66
|
+
};
|
|
67
|
+
width?: undefined;
|
|
68
|
+
sortable?: undefined;
|
|
69
|
+
} | {
|
|
70
|
+
type: string;
|
|
71
|
+
name: string;
|
|
72
|
+
hidden: boolean;
|
|
73
|
+
record: {
|
|
74
|
+
editable: boolean;
|
|
75
|
+
align?: undefined;
|
|
76
|
+
};
|
|
77
|
+
header?: undefined;
|
|
78
|
+
width?: undefined;
|
|
79
|
+
filter?: undefined;
|
|
80
|
+
sortable?: undefined;
|
|
81
|
+
})[];
|
|
82
|
+
rows: {
|
|
83
|
+
appendable: boolean;
|
|
84
|
+
selectable: {
|
|
85
|
+
multiple: boolean;
|
|
86
|
+
};
|
|
87
|
+
handlers: {
|
|
88
|
+
click: string;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
sorters: {
|
|
92
|
+
name: string;
|
|
93
|
+
desc: boolean;
|
|
94
|
+
}[];
|
|
95
|
+
pagination: {
|
|
96
|
+
pages: number[];
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
firstUpdated(): Promise<void>;
|
|
100
|
+
getSelected(): Promise<any>;
|
|
101
|
+
refreshProcessTemplates(): Promise<void>;
|
|
102
|
+
getProcessTemplates({ page, limit, filters, sortings }?: {
|
|
103
|
+
page?: number;
|
|
104
|
+
limit?: number;
|
|
105
|
+
filters?: FilterValue[];
|
|
106
|
+
sortings?: SortersConfig;
|
|
107
|
+
}): Promise<any>;
|
|
108
|
+
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import '@operato/data-grist';
|
|
3
|
+
import '@operato/input/ox-input-file.js';
|
|
4
|
+
import gql from 'graphql-tag';
|
|
5
|
+
import { css, html, LitElement } from 'lit';
|
|
6
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
7
|
+
import { buildArgs, client } from '@operato/graphql';
|
|
8
|
+
import { ScrollbarStyles, TooltipStyles } from '@operato/styles';
|
|
9
|
+
const FETCH_PROCESS_TEMPLATE_LIST_GQL = (listParam) => {
|
|
10
|
+
return gql `
|
|
11
|
+
{
|
|
12
|
+
processTemplates(${buildArgs(listParam)}) {
|
|
13
|
+
items {
|
|
14
|
+
id
|
|
15
|
+
name
|
|
16
|
+
description
|
|
17
|
+
visibility
|
|
18
|
+
thumbnail
|
|
19
|
+
}
|
|
20
|
+
total
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
};
|
|
25
|
+
const FETCH_PROCESS_TEMPLATE_GQL = (id) => {
|
|
26
|
+
return gql `
|
|
27
|
+
{
|
|
28
|
+
processTemplate(id: "${id}") {
|
|
29
|
+
id
|
|
30
|
+
name
|
|
31
|
+
description
|
|
32
|
+
visibility
|
|
33
|
+
model
|
|
34
|
+
thumbnail
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
};
|
|
39
|
+
let OxProcessTemplateList = class OxProcessTemplateList extends LitElement {
|
|
40
|
+
constructor() {
|
|
41
|
+
super(...arguments);
|
|
42
|
+
this.withoutSearch = false;
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
return html `
|
|
46
|
+
<ox-grist .config=${this.gristConfig} .mode=${'CARD'} auto-fetch .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
47
|
+
<div slot="headroom" id="headroom">
|
|
48
|
+
<div id="filters">
|
|
49
|
+
<ox-filters-form autofocus .withoutSearch=${this.withoutSearch}></ox-filters-form>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</ox-grist>
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }) {
|
|
56
|
+
const { items: records, total } = await this.getProcessTemplates({ page, limit, filters, sortings });
|
|
57
|
+
return {
|
|
58
|
+
total,
|
|
59
|
+
records
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
get gristConfig() {
|
|
63
|
+
return {
|
|
64
|
+
list: {
|
|
65
|
+
thumbnail: 'thumbnail',
|
|
66
|
+
fields: ['name'],
|
|
67
|
+
details: ['description']
|
|
68
|
+
},
|
|
69
|
+
columns: [
|
|
70
|
+
{
|
|
71
|
+
type: 'string',
|
|
72
|
+
name: 'id',
|
|
73
|
+
hidden: true
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: 'string',
|
|
77
|
+
name: 'name',
|
|
78
|
+
header: 'name',
|
|
79
|
+
record: {
|
|
80
|
+
editable: true,
|
|
81
|
+
align: 'left'
|
|
82
|
+
},
|
|
83
|
+
width: 200,
|
|
84
|
+
filter: 'search',
|
|
85
|
+
sortable: true
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
type: 'string',
|
|
89
|
+
name: 'description',
|
|
90
|
+
header: 'description',
|
|
91
|
+
record: {
|
|
92
|
+
editable: true,
|
|
93
|
+
align: 'left'
|
|
94
|
+
},
|
|
95
|
+
width: 200,
|
|
96
|
+
filter: 'search'
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: 'select-buttons',
|
|
100
|
+
name: 'visibility',
|
|
101
|
+
header: 'visibility',
|
|
102
|
+
record: {
|
|
103
|
+
editable: false
|
|
104
|
+
},
|
|
105
|
+
hidden: true,
|
|
106
|
+
filter: {
|
|
107
|
+
operator: 'in',
|
|
108
|
+
options: ['private', 'domain', 'public'],
|
|
109
|
+
label: ''
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
type: 'image',
|
|
114
|
+
name: 'thumbnail',
|
|
115
|
+
hidden: true,
|
|
116
|
+
record: {
|
|
117
|
+
editable: false
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
rows: {
|
|
122
|
+
appendable: false,
|
|
123
|
+
selectable: {
|
|
124
|
+
multiple: false
|
|
125
|
+
},
|
|
126
|
+
handlers: {
|
|
127
|
+
click: 'select-row-toggle'
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
sorters: [
|
|
131
|
+
{
|
|
132
|
+
name: 'name',
|
|
133
|
+
desc: false
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
pagination: {
|
|
137
|
+
pages: [20, 30, 50, 100, 200]
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
async firstUpdated() {
|
|
142
|
+
this.refreshProcessTemplates();
|
|
143
|
+
}
|
|
144
|
+
async getSelected() {
|
|
145
|
+
var _a, _b;
|
|
146
|
+
const selected = this.grist.selected;
|
|
147
|
+
const templateId = selected && ((_a = selected[0]) === null || _a === void 0 ? void 0 : _a.id);
|
|
148
|
+
if (!templateId) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
var processTemplateResponse = await client.query({
|
|
152
|
+
query: FETCH_PROCESS_TEMPLATE_GQL(templateId)
|
|
153
|
+
});
|
|
154
|
+
var template = (_b = processTemplateResponse.data) === null || _b === void 0 ? void 0 : _b.processTemplate;
|
|
155
|
+
if (template) {
|
|
156
|
+
template = {
|
|
157
|
+
...template,
|
|
158
|
+
model: JSON.parse(template.model)
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
return template;
|
|
162
|
+
}
|
|
163
|
+
async refreshProcessTemplates() {
|
|
164
|
+
this.grist.fetch();
|
|
165
|
+
}
|
|
166
|
+
async getProcessTemplates({ page = 1, limit = 30, filters = [], sortings = [] } = {}) {
|
|
167
|
+
var _a;
|
|
168
|
+
var pagination = {
|
|
169
|
+
limit,
|
|
170
|
+
page
|
|
171
|
+
};
|
|
172
|
+
var params = {
|
|
173
|
+
filters,
|
|
174
|
+
sortings,
|
|
175
|
+
pagination
|
|
176
|
+
};
|
|
177
|
+
var processTemplateListResponse = await client.query({
|
|
178
|
+
query: FETCH_PROCESS_TEMPLATE_LIST_GQL(params)
|
|
179
|
+
});
|
|
180
|
+
return ((_a = processTemplateListResponse === null || processTemplateListResponse === void 0 ? void 0 : processTemplateListResponse.data) === null || _a === void 0 ? void 0 : _a.processTemplates) || {};
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
OxProcessTemplateList.styles = [
|
|
184
|
+
ScrollbarStyles,
|
|
185
|
+
TooltipStyles,
|
|
186
|
+
css `
|
|
187
|
+
:host {
|
|
188
|
+
display: flex;
|
|
189
|
+
|
|
190
|
+
width: 100%;
|
|
191
|
+
|
|
192
|
+
--grid-record-emphasized-background-color: red;
|
|
193
|
+
--grid-record-emphasized-color: yellow;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
ox-grist {
|
|
197
|
+
flex: 1;
|
|
198
|
+
overflow-y: auto;
|
|
199
|
+
|
|
200
|
+
--grid-record-emphasized-background-color: red;
|
|
201
|
+
--grid-record-emphasized-color: yellow;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
#headroom {
|
|
205
|
+
align-items: center;
|
|
206
|
+
padding: var(--padding-default) var(--padding-wide);
|
|
207
|
+
border-top: 2px solid rgba(0, 0, 0, 0.2);
|
|
208
|
+
background-color: var(--theme-white-color);
|
|
209
|
+
box-shadow: var(--box-shadow);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
#filters {
|
|
213
|
+
display: flex;
|
|
214
|
+
flex-direction: row;
|
|
215
|
+
place-content: space-between;
|
|
216
|
+
margin: var(--margin-default) 0;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
select {
|
|
220
|
+
border: 0;
|
|
221
|
+
outline: none;
|
|
222
|
+
text-align: right;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
@media only screen and (max-width: 460px) {
|
|
226
|
+
#filters {
|
|
227
|
+
flex-direction: column;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
`
|
|
231
|
+
];
|
|
232
|
+
__decorate([
|
|
233
|
+
property({ type: Boolean, attribute: 'without-search' })
|
|
234
|
+
], OxProcessTemplateList.prototype, "withoutSearch", void 0);
|
|
235
|
+
__decorate([
|
|
236
|
+
query('ox-grist')
|
|
237
|
+
], OxProcessTemplateList.prototype, "grist", void 0);
|
|
238
|
+
OxProcessTemplateList = __decorate([
|
|
239
|
+
customElement('ox-process-template-list')
|
|
240
|
+
], OxProcessTemplateList);
|
|
241
|
+
export { OxProcessTemplateList };
|
|
242
|
+
//# sourceMappingURL=ox-process-template-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-process-template-list.js","sourceRoot":"","sources":["../../src/ox-process-template-list.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,iCAAiC,CAAA;AAExC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAS,MAAM,mBAAmB,CAAA;AAYzE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEhE,MAAM,+BAA+B,GAAG,CAAC,SAAc,EAAE,EAAE;IACzD,OAAO,GAAG,CAAA;;uBAEW,SAAS,CAAC,SAAS,CAAC;;;;;;;;;;;CAW1C,CAAA;AACD,CAAC,CAAA;AAED,MAAM,0BAA0B,GAAG,CAAC,EAAU,EAAE,EAAE;IAChD,OAAO,GAAG,CAAA;;2BAEe,EAAE;;;;;;;;;CAS5B,CAAA;AACD,CAAC,CAAA;AAGM,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU;IAA9C;;QAmDqD,kBAAa,GAAY,KAAK,CAAA;IAgK1F,CAAC;IA5JC,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port '@operato/input/ox-input-file.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport {\n ColumnConfig,\n DataGrist,\n FetchOption,\n FilterValue,\n GristData,\n GristRecord,\n PaginationConfig,\n SortersConfig\n} from '@operato/data-grist'\nimport { buildArgs, client } from '@operato/graphql'\nimport { ScrollbarStyles, TooltipStyles } from '@operato/styles'\n\nconst FETCH_PROCESS_TEMPLATE_LIST_GQL = (listParam: any) => {\n return gql`\n {\n processTemplates(${buildArgs(listParam)}) {\n items {\n id\n name\n description\n visibility\n thumbnail\n }\n total\n }\n }\n`\n}\n\nconst FETCH_PROCESS_TEMPLATE_GQL = (id: string) => {\n return gql`\n {\n processTemplate(id: \"${id}\") {\n id\n name\n description\n visibility\n model\n thumbnail\n }\n }\n`\n}\n\n@customElement('ox-process-template-list')\nexport class OxProcessTemplateList extends LitElement {\n static styles = [\n ScrollbarStyles,\n TooltipStyles,\n css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: red;\n --grid-record-emphasized-color: yellow;\n }\n\n ox-grist {\n flex: 1;\n overflow-y: auto;\n\n --grid-record-emphasized-background-color: red;\n --grid-record-emphasized-color: yellow;\n }\n\n #headroom {\n align-items: center;\n padding: var(--padding-default) var(--padding-wide);\n border-top: 2px solid rgba(0, 0, 0, 0.2);\n background-color: var(--theme-white-color);\n box-shadow: var(--box-shadow);\n }\n\n #filters {\n display: flex;\n flex-direction: row;\n place-content: space-between;\n margin: var(--margin-default) 0;\n }\n\n select {\n border: 0;\n outline: none;\n text-align: right;\n }\n\n @media only screen and (max-width: 460px) {\n #filters {\n flex-direction: column;\n }\n }\n `\n ]\n\n @property({ type: Boolean, attribute: 'without-search' }) withoutSearch: boolean = false\n\n @query('ox-grist') grist!: DataGrist\n\n render() {\n return html`\n <ox-grist .config=${this.gristConfig} .mode=${'CARD'} auto-fetch .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" id=\"headroom\">\n <div id=\"filters\">\n <ox-filters-form autofocus .withoutSearch=${this.withoutSearch}></ox-filters-form>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const { items: records, total } = await this.getProcessTemplates({ page, limit, filters, sortings })\n\n return {\n total,\n records\n }\n }\n\n get gristConfig() {\n return {\n list: {\n thumbnail: 'thumbnail',\n fields: ['name'],\n details: ['description']\n },\n columns: [\n {\n type: 'string',\n name: 'id',\n hidden: true\n },\n {\n type: 'string',\n name: 'name',\n header: 'name',\n record: {\n editable: true,\n align: 'left'\n },\n width: 200,\n filter: 'search',\n sortable: true\n },\n {\n type: 'string',\n name: 'description',\n header: 'description',\n record: {\n editable: true,\n align: 'left'\n },\n width: 200,\n filter: 'search'\n },\n {\n type: 'select-buttons',\n name: 'visibility',\n header: 'visibility',\n record: {\n editable: false\n },\n hidden: true,\n filter: {\n operator: 'in',\n options: ['private', 'domain', 'public'],\n label: ''\n }\n },\n {\n type: 'image',\n name: 'thumbnail',\n hidden: true,\n record: {\n editable: false\n }\n }\n ],\n rows: {\n appendable: false,\n selectable: {\n multiple: false\n },\n handlers: {\n click: 'select-row-toggle'\n }\n },\n sorters: [\n {\n name: 'name',\n desc: false\n }\n ],\n pagination: {\n pages: [20, 30, 50, 100, 200]\n }\n }\n }\n\n async firstUpdated() {\n this.refreshProcessTemplates()\n }\n\n async getSelected() {\n const selected = this.grist.selected\n const templateId = selected && selected[0]?.id\n\n if (!templateId) {\n return\n }\n\n var processTemplateResponse = await client.query({\n query: FETCH_PROCESS_TEMPLATE_GQL(templateId)\n })\n\n var template = processTemplateResponse.data?.processTemplate\n\n if (template) {\n template = {\n ...template,\n model: JSON.parse(template.model)\n }\n }\n\n return template\n }\n\n async refreshProcessTemplates() {\n this.grist.fetch()\n }\n\n async getProcessTemplates({\n page = 1,\n limit = 30,\n filters = [],\n sortings = []\n }: { page?: number; limit?: number; filters?: FilterValue[]; sortings?: SortersConfig } = {}) {\n var pagination: PaginationConfig = {\n limit,\n page\n }\n\n var params = {\n filters,\n sortings,\n pagination\n }\n\n var processTemplateListResponse = await client.query({\n query: FETCH_PROCESS_TEMPLATE_LIST_GQL(params)\n })\n\n return processTemplateListResponse?.data?.processTemplates || {}\n }\n}\n"]}
|
|
@@ -54,12 +54,14 @@ let ProcessCreationCard = class ProcessCreationCard extends localize(i18next)(Li
|
|
|
54
54
|
.defaultGroup=${this.defaultGroup}
|
|
55
55
|
.groups=${this.groups}
|
|
56
56
|
@create-process=${async (e) => {
|
|
57
|
-
var { name, description, groupId } = e.detail;
|
|
57
|
+
var { name, description, groupId, model, thumbnail } = e.detail;
|
|
58
58
|
this.dispatchEvent(new CustomEvent('create-process', {
|
|
59
59
|
detail: {
|
|
60
60
|
name,
|
|
61
61
|
description,
|
|
62
|
-
groupId
|
|
62
|
+
groupId,
|
|
63
|
+
model,
|
|
64
|
+
thumbnail
|
|
63
65
|
}
|
|
64
66
|
}));
|
|
65
67
|
this.popup && this.popup.close();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-process-creation-card.js","sourceRoot":"","sources":["../../../src/selector/ox-process-creation-card.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAGpC,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IACpE,MAAM,KAAK,MAAM;QACf,OAAO;YACL,GAAG,CAAA;;;;;;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AI,CAAC,KAAK,EAAE;YACd,OAAO,IAAI,CAAC,KAAK,CAAA;SAClB;QAED;;;;WAIG;QACH,IAAI,QAAQ,GAAG,IAAI,CAAA;;wBAEC,IAAI,CAAC,YAAY;kBACvB,IAAI,CAAC,MAAM;0BACH,KAAK,EAAE,CAAc,EAAE,EAAE;YACzC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC,MAAM,CAAA;YAE/D,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,gBAAgB,EAAE;gBAChC,MAAM,EAAE;oBACN,IAAI;oBACJ,WAAW;oBACX,OAAO;oBACP,KAAK;oBACL,SAAS;iBACV;aACF,CAAC,CACH,CAAA;YAED,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QAClC,CAAC;;KAEJ,CAAA;QAED,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,EAAE;YAC/B,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAAC;SACzC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,KAAI,CAAC;CACX,CAAA;AArD6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDAAsB;AACtB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;mDAAY;AAjC3B,mBAAmB;IAD/B,aAAa,CAAC,0BAA0B,CAAC;GAC7B,mBAAmB,CAqF/B","sourcesContent":["import '@material/mwc-icon'\nimport './process-creation-popup'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\n\n@customElement('ox-process-creation-card')\nexport class ProcessCreationCard extends localize(i18next)(LitElement) {\n static get styles() {\n return [\n css`\n :host {\n display: flex;\n border: var(--card-list-create-border);\n border-radius: var(--card-list-create-border-radius);\n\n background-color: #fff;\n\n align-content: center;\n justify-content: center;\n }\n\n div {\n text-align: center;\n font-size: 0.8em;\n color: var(--card-list-create-color);\n text-transform: capitalize;\n }\n\n mwc-icon {\n display: block;\n font-size: 3.5em;\n color: var(--card-list-create-icon-color);\n }\n `\n ]\n }\n\n /* default group id */\n @property({ type: String }) defaultGroup?: string\n @property({ type: Array }) groups: any\n\n private popup: any\n\n render() {\n return html`<div @click=${(e: Event) => this.onClick()}>\n <mwc-icon>add_circle_outline</mwc-icon>create process\n </div> `\n }\n\n onClick() {\n if (this.popup) {\n delete this.popup\n }\n\n /*\n * 기존 설정된 이미지가 선택된 상태가 되게 하기 위해서는 selector에 value를 전달해줄 필요가 있음.\n * 주의. value는 object일 수도 있고, string일 수도 있다.\n * string인 경우에는 해당 보드의 id로 해석한다.\n */\n var template = html`\n <process-creation-popup\n .defaultGroup=${this.defaultGroup}\n .groups=${this.groups}\n @create-process=${async (e: CustomEvent) => {\n var { name, description, groupId, model, thumbnail } = e.detail\n\n this.dispatchEvent(\n new CustomEvent('create-process', {\n detail: {\n name,\n description,\n groupId,\n model,\n thumbnail\n }\n })\n )\n\n this.popup && this.popup.close()\n }}\n ></process-creation-popup>\n `\n\n this.popup = openPopup(template, {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.create-process')\n })\n }\n\n reset() {}\n}\n"]}
|
|
@@ -38,6 +38,6 @@ export declare class ProcessSelector extends ProcessSelector_base {
|
|
|
38
38
|
page?: number | undefined;
|
|
39
39
|
limit?: number | undefined;
|
|
40
40
|
}): Promise<any>;
|
|
41
|
-
createProcess(name: string, description: string, groupId: string): Promise<any>;
|
|
41
|
+
createProcess(name: string, description: string, groupId: string, modelTemplate: any, thumbnail: string): Promise<any>;
|
|
42
42
|
}
|
|
43
43
|
export {};
|
|
@@ -207,8 +207,8 @@ let ProcessSelector = class ProcessSelector extends InfiniteScrollable(localize(
|
|
|
207
207
|
}));
|
|
208
208
|
}
|
|
209
209
|
async onCreateProcess(e) {
|
|
210
|
-
var { name, description, groupId } = e.detail;
|
|
211
|
-
await this.createProcess(name, description, groupId);
|
|
210
|
+
var { name, description, groupId, model, thumbnail } = e.detail;
|
|
211
|
+
await this.createProcess(name, description, groupId, model, thumbnail);
|
|
212
212
|
this.refreshProcesses();
|
|
213
213
|
}
|
|
214
214
|
async refreshGroups() {
|
|
@@ -263,8 +263,8 @@ let ProcessSelector = class ProcessSelector extends InfiniteScrollable(localize(
|
|
|
263
263
|
this._page = page;
|
|
264
264
|
return processListResponse.data.processes.items;
|
|
265
265
|
}
|
|
266
|
-
async createProcess(name, description, groupId) {
|
|
267
|
-
var model = JSON.stringify({
|
|
266
|
+
async createProcess(name, description, groupId, modelTemplate, thumbnail) {
|
|
267
|
+
var model = JSON.stringify(modelTemplate || {
|
|
268
268
|
width: 1200,
|
|
269
269
|
height: 800,
|
|
270
270
|
fillStyle: 'white'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-process-selector.js","sourceRoot":"","sources":["../../../src/selector/ox-process-selector.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,kBAAkB,MAAM,8CAA8C,CAAA;AAE7E,MAAM,sBAAsB,GAAG,CAAC,SAAc,EAAE,EAAE;IAChD,OAAO,GAAG,CAAA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nC,QAAQ,EAAE,kBAAkB;YAC5B,SAAS,EAAE;gBACT,OAAO,EAAE;oBACP,IAAI;oBACJ,WAAW;oBACX,OAAO;oBACP,KAAK;iBACN;aACF;YACD,OAAO,EAAE,UAAU,EAAE;SACtB,CAAC,CAAA;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAA;IACtB,CAAC;CACF,CAAA;AAtL4B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;+CAAiE;AAChE;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;kDAAsB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAe;AACb;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAA2B;AAC3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAe;AAxF/B,eAAe;IAD3B,aAAa,CAAC,qBAAqB,CAAC;GACxB,eAAe,CA0Q3B","sourcesContent":["import './ox-process-creation-card'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { buildArgs, client, gqlContext } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\nimport InfiniteScrollable from '@operato/utils/mixins/infinite-scrollable.js'\n\nconst FETCH_PROCESS_LIST_GQL = (listParam: any) => {\n return gql`\n {\n processes(${buildArgs(listParam)}) {\n items {\n id\n name\n description\n thumbnail\n }\n total\n }\n }\n`\n}\n\nconst FETCH_PROCESS_GROUP_LIST_GQL = gql`\n {\n processGroups {\n items {\n id\n name\n description\n }\n total\n }\n }\n`\n\nconst CREATE_PROCESS_GQL = gql`\n mutation CreateProcess($process: NewProcess!) {\n createProcess(process: $process) {\n id\n name\n description\n model\n createdAt\n updatedAt\n }\n }\n`\n\n@customElement('ox-process-selector')\nexport class ProcessSelector extends InfiniteScrollable(localize(i18next)(LitElement)) {\n static get styles() {\n return [\n ScrollbarStyles,\n css`\n :host {\n display: grid;\n grid-template-rows: auto auto 1fr;\n overflow: hidden;\n background-color: var(--popup-content-background-color);\n }\n\n #main {\n overflow: auto;\n padding: var(--popup-content-padding);\n display: grid;\n grid-template-columns: var(--card-list-template);\n grid-auto-rows: var(--card-list-rows-height);\n grid-gap: 20px;\n }\n\n .card {\n display: flex;\n flex-direction: column;\n align-items: center;\n overflow: hidden;\n border-radius: var(--card-list-border-radius);\n background-color: var(--card-list-background-color);\n }\n\n .card[selected] {\n border: red solid;\n }\n\n .card.create {\n overflow: visible;\n }\n\n .card:hover {\n cursor: pointer;\n }\n\n .card > .name {\n background-color: var(--board-renderer-name-background-color);\n opacity: 0.8;\n margin-top: -35px;\n width: 100%;\n color: #fff;\n font-weight: bolder;\n font-size: 13px;\n text-indent: 7px;\n }\n\n .card > .description {\n background-color: rgba(0, 0, 0, 0.7);\n width: 100%;\n min-height: 15px;\n font-size: 0.6rem;\n color: #fff;\n text-indent: 7px;\n }\n .card img {\n max-height: 100%;\n min-height: 100%;\n }\n\n #filter {\n padding: var(--popup-content-padding);\n background-color: #fff;\n box-shadow: var(--box-shadow);\n }\n\n #filter * {\n font-size: 15px;\n }\n\n select {\n text-transform: capitalize;\n float: right;\n }\n `\n ]\n }\n\n @property({ type: Array }) groups: { id: string; name: string; description: string }[] = []\n @property({ type: Array }) processes: any[] = []\n @property({ type: String }) group?: string\n @property({ type: Boolean }) creatable: boolean = false\n @property({ type: String }) value?: string\n\n private _page: number = 1\n private _total: number = 0\n\n constructor() {\n super()\n\n this._infiniteScrollOptions.limit = 20\n }\n\n render() {\n return html`\n <div id=\"filter\">\n <select\n @change=${(e: Event) => {\n this.group = (e.currentTarget as any)?.value\n this.requestUpdate()\n }}\n >\n <option value=\"\">${i18next.t('label.all')}</option>\n ${this.groups.map(group => html` <option value=${group.id}>${group.description}</option> `)}\n </select>\n </div>\n\n <div\n id=\"main\"\n @scroll=${(e: Event) => {\n this.onScroll(e)\n }}\n >\n ${this.creatable\n ? html`\n <ox-process-creation-card\n class=\"card create\"\n .groups=${this.groups}\n .defaultGroup=${this.group}\n @create-process=${(e: CustomEvent) => this.onCreateProcess(e)}\n ></ox-process-creation-card>\n `\n : html``}\n ${this.processes.map(\n process => html`\n <div\n class=\"card\"\n @click=${(e: Event) => this.onClickSelect(process)}\n ?selected=${this.value === process.id}\n >\n <img src=${process.thumbnail} />\n <div class=\"name\">${process.name}</div>\n <div class=\"description\">${process.description}</div>\n </div>\n `\n )}\n </div>\n `\n }\n\n get scrollTargetEl(): HTMLElement | null {\n return this.renderRoot.querySelector('#main') as HTMLElement\n }\n\n async scrollAction() {\n return this.appendProcesses()\n }\n\n firstUpdated() {\n this.refreshGroups()\n }\n\n async updated(changed: PropertyValues<this>) {\n if (changed.has('group')) {\n this.refreshProcesses()\n }\n }\n\n onClickSelect(process: any) {\n this.dispatchEvent(\n new CustomEvent('process-selected', {\n composed: true,\n bubbles: true,\n detail: {\n process\n }\n })\n )\n }\n\n async onCreateProcess(e: CustomEvent) {\n var { name, description, groupId } = e.detail\n\n await this.createProcess(name, description, groupId)\n this.refreshProcesses()\n }\n\n async refreshGroups() {\n var groupListResponse = await client.query({\n query: FETCH_PROCESS_GROUP_LIST_GQL,\n context: gqlContext()\n })\n\n if (!groupListResponse || !groupListResponse.data) return\n\n var groups = groupListResponse.data.processGroups.items\n this.groups = [...groups]\n\n this.group = groups.filter((group: { id: string }) => group.id == this.group).length > 0 ? this.group : ''\n }\n\n async refreshProcesses() {\n var processes = await this.getProcesses()\n this.processes = [...processes]\n\n var creationCard = this.renderRoot.querySelector('ox-process-creation-card')\n if (creationCard) {\n ;(creationCard as any).reset()\n }\n }\n\n async appendProcesses() {\n var processes = await this.getProcesses({ page: this._page + 1 })\n this.processes = [...this.processes, ...processes]\n }\n\n async getProcesses({ page = 1, limit = this._infiniteScrollOptions.limit } = {}) {\n var filters = []\n var sortings = [] as any[]\n var pagination = {\n limit,\n page\n }\n\n if (this.group)\n filters.push({\n name: 'groupId',\n operator: 'eq',\n value: this.group\n })\n\n var params = {\n filters,\n sortings,\n pagination\n }\n var processListResponse = await client.query({\n query: FETCH_PROCESS_LIST_GQL(params),\n context: gqlContext()\n })\n\n if (!processListResponse || !processListResponse.data) return []\n this._total = processListResponse.data.processes.total\n this._page = page\n\n return processListResponse.data.processes.items\n }\n\n async createProcess(name: string, description: string, groupId: string) {\n var model = JSON.stringify({\n width: 1200,\n height: 800,\n fillStyle: 'white'\n })\n\n const response = await client.mutate({\n mutation: CREATE_PROCESS_GQL,\n variables: {\n process: {\n name,\n description,\n groupId,\n model\n }\n },\n context: gqlContext()\n })\n\n return response.data\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ox-process-selector.js","sourceRoot":"","sources":["../../../src/selector/ox-process-selector.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,kBAAkB,MAAM,8CAA8C,CAAA;AAE7E,MAAM,sBAAsB,GAAG,CAAC,SAAc,EAAE,EAAE;IAChD,OAAO,GAAG,CAAA;;gBAEI,SAAS,CAAC,SAAS,CAAC;;;;;;;;;;CAUnC,CAAA;AACD,CAAC,CAAA;AAED,MAAM,4BAA4B,GAAG,GAAG,CAAA;;;;;;;;;;;CAWvC,CAAA;AAED,MAAM,kBAAkB,G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;oBACJ,WAAW;oBACX,OAAO;oBACP,KAAK;iBACN;aACF;YACD,OAAO,EAAE,UAAU,EAAE;SACtB,CAAC,CAAA;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAA;IACtB,CAAC;CACF,CAAA;AAxL4B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;+CAAiE;AAChE;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;kDAAsB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAe;AACb;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAA2B;AAC3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAe;AAxF/B,eAAe;IAD3B,aAAa,CAAC,qBAAqB,CAAC;GACxB,eAAe,CA4Q3B","sourcesContent":["import './ox-process-creation-card'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { buildArgs, client, gqlContext } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\nimport InfiniteScrollable from '@operato/utils/mixins/infinite-scrollable.js'\n\nconst FETCH_PROCESS_LIST_GQL = (listParam: any) => {\n return gql`\n {\n processes(${buildArgs(listParam)}) {\n items {\n id\n name\n description\n thumbnail\n }\n total\n }\n }\n`\n}\n\nconst FETCH_PROCESS_GROUP_LIST_GQL = gql`\n {\n processGroups {\n items {\n id\n name\n description\n }\n total\n }\n }\n`\n\nconst CREATE_PROCESS_GQL = gql`\n mutation CreateProcess($process: NewProcess!) {\n createProcess(process: $process) {\n id\n name\n description\n model\n createdAt\n updatedAt\n }\n }\n`\n\n@customElement('ox-process-selector')\nexport class ProcessSelector extends InfiniteScrollable(localize(i18next)(LitElement)) {\n static get styles() {\n return [\n ScrollbarStyles,\n css`\n :host {\n display: grid;\n grid-template-rows: auto auto 1fr;\n overflow: hidden;\n background-color: var(--popup-content-background-color);\n }\n\n #main {\n overflow: auto;\n padding: var(--popup-content-padding);\n display: grid;\n grid-template-columns: var(--card-list-template);\n grid-auto-rows: var(--card-list-rows-height);\n grid-gap: 20px;\n }\n\n .card {\n display: flex;\n flex-direction: column;\n align-items: center;\n overflow: hidden;\n border-radius: var(--card-list-border-radius);\n background-color: var(--card-list-background-color);\n }\n\n .card[selected] {\n border: red solid;\n }\n\n .card.create {\n overflow: visible;\n }\n\n .card:hover {\n cursor: pointer;\n }\n\n .card > .name {\n background-color: var(--board-renderer-name-background-color);\n opacity: 0.8;\n margin-top: -35px;\n width: 100%;\n color: #fff;\n font-weight: bolder;\n font-size: 13px;\n text-indent: 7px;\n }\n\n .card > .description {\n background-color: rgba(0, 0, 0, 0.7);\n width: 100%;\n min-height: 15px;\n font-size: 0.6rem;\n color: #fff;\n text-indent: 7px;\n }\n .card img {\n max-height: 100%;\n min-height: 100%;\n }\n\n #filter {\n padding: var(--popup-content-padding);\n background-color: #fff;\n box-shadow: var(--box-shadow);\n }\n\n #filter * {\n font-size: 15px;\n }\n\n select {\n text-transform: capitalize;\n float: right;\n }\n `\n ]\n }\n\n @property({ type: Array }) groups: { id: string; name: string; description: string }[] = []\n @property({ type: Array }) processes: any[] = []\n @property({ type: String }) group?: string\n @property({ type: Boolean }) creatable: boolean = false\n @property({ type: String }) value?: string\n\n private _page: number = 1\n private _total: number = 0\n\n constructor() {\n super()\n\n this._infiniteScrollOptions.limit = 20\n }\n\n render() {\n return html`\n <div id=\"filter\">\n <select\n @change=${(e: Event) => {\n this.group = (e.currentTarget as any)?.value\n this.requestUpdate()\n }}\n >\n <option value=\"\">${i18next.t('label.all')}</option>\n ${this.groups.map(group => html` <option value=${group.id}>${group.description}</option> `)}\n </select>\n </div>\n\n <div\n id=\"main\"\n @scroll=${(e: Event) => {\n this.onScroll(e)\n }}\n >\n ${this.creatable\n ? html`\n <ox-process-creation-card\n class=\"card create\"\n .groups=${this.groups}\n .defaultGroup=${this.group}\n @create-process=${(e: CustomEvent) => this.onCreateProcess(e)}\n ></ox-process-creation-card>\n `\n : html``}\n ${this.processes.map(\n process => html`\n <div\n class=\"card\"\n @click=${(e: Event) => this.onClickSelect(process)}\n ?selected=${this.value === process.id}\n >\n <img src=${process.thumbnail} />\n <div class=\"name\">${process.name}</div>\n <div class=\"description\">${process.description}</div>\n </div>\n `\n )}\n </div>\n `\n }\n\n get scrollTargetEl(): HTMLElement | null {\n return this.renderRoot.querySelector('#main') as HTMLElement\n }\n\n async scrollAction() {\n return this.appendProcesses()\n }\n\n firstUpdated() {\n this.refreshGroups()\n }\n\n async updated(changed: PropertyValues<this>) {\n if (changed.has('group')) {\n this.refreshProcesses()\n }\n }\n\n onClickSelect(process: any) {\n this.dispatchEvent(\n new CustomEvent('process-selected', {\n composed: true,\n bubbles: true,\n detail: {\n process\n }\n })\n )\n }\n\n async onCreateProcess(e: CustomEvent) {\n var { name, description, groupId, model, thumbnail } = e.detail\n\n await this.createProcess(name, description, groupId, model, thumbnail)\n this.refreshProcesses()\n }\n\n async refreshGroups() {\n var groupListResponse = await client.query({\n query: FETCH_PROCESS_GROUP_LIST_GQL,\n context: gqlContext()\n })\n\n if (!groupListResponse || !groupListResponse.data) return\n\n var groups = groupListResponse.data.processGroups.items\n this.groups = [...groups]\n\n this.group = groups.filter((group: { id: string }) => group.id == this.group).length > 0 ? this.group : ''\n }\n\n async refreshProcesses() {\n var processes = await this.getProcesses()\n this.processes = [...processes]\n\n var creationCard = this.renderRoot.querySelector('ox-process-creation-card')\n if (creationCard) {\n ;(creationCard as any).reset()\n }\n }\n\n async appendProcesses() {\n var processes = await this.getProcesses({ page: this._page + 1 })\n this.processes = [...this.processes, ...processes]\n }\n\n async getProcesses({ page = 1, limit = this._infiniteScrollOptions.limit } = {}) {\n var filters = []\n var sortings = [] as any[]\n var pagination = {\n limit,\n page\n }\n\n if (this.group)\n filters.push({\n name: 'groupId',\n operator: 'eq',\n value: this.group\n })\n\n var params = {\n filters,\n sortings,\n pagination\n }\n var processListResponse = await client.query({\n query: FETCH_PROCESS_LIST_GQL(params),\n context: gqlContext()\n })\n\n if (!processListResponse || !processListResponse.data) return []\n this._total = processListResponse.data.processes.total\n this._page = page\n\n return processListResponse.data.processes.items\n }\n\n async createProcess(name: string, description: string, groupId: string, modelTemplate: any, thumbnail: string) {\n var model = JSON.stringify(\n modelTemplate || {\n width: 1200,\n height: 800,\n fillStyle: 'white'\n }\n )\n\n const response = await client.mutate({\n mutation: CREATE_PROCESS_GQL,\n variables: {\n process: {\n name,\n description,\n groupId,\n model\n }\n },\n context: gqlContext()\n })\n\n return response.data\n }\n}\n"]}
|