@things-factory/integration-ui 9.0.1 → 9.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,7 @@ import {
11
11
  import { OxGristEditorCrontab } from '@operato/grist-editor/ox-grist-editor-crontab.js'
12
12
  import { OxGristEditorPrivilege } from '@operato/app/grist-editor/ox-grist-editor-privilege.js'
13
13
  import { OxGristEditorParameters } from '@operato/grist-editor/ox-grist-editor-parameters.js'
14
+ import { OxGristEditorData } from '@operato/grist-editor/ox-grist-editor-data.js'
14
15
  import { OxPropertyEditor } from '@operato/property-editor'
15
16
 
16
17
  import { ConnectionSelector } from './grist/connection-selector.js'
@@ -24,8 +25,10 @@ export default function bootstrap() {
24
25
  registerGristEditor('json', OxGristEditorJson)
25
26
  registerGristEditor('parameters', OxGristEditorParameters)
26
27
  registerGristEditor('crontab', OxGristEditorCrontab)
28
+ registerGristEditor('data', OxGristEditorData)
27
29
 
28
30
  registerGristRenderer('crontab', OxGristRendererCrontab)
31
+ registerGristRenderer('data', OxGristRendererJson5)
29
32
 
30
33
  OxPropertyEditor.register({
31
34
  'http-headers': 'property-editor-http-headers',
@@ -101,7 +101,8 @@ export class StateRegisterListPage extends connect(store)(p13n(localize(i18next)
101
101
  },
102
102
  filter: 'search',
103
103
  sortable: true,
104
- width: 150
104
+ width: 150,
105
+ description: i18next.t('field.name-publish-tag-desc') // name이 publish tag 역할을 한다는 설명
105
106
  },
106
107
  {
107
108
  type: 'string',
@@ -125,11 +126,35 @@ export class StateRegisterListPage extends connect(store)(p13n(localize(i18next)
125
126
  width: 150
126
127
  },
127
128
  {
128
- type: 'string',
129
+ type: 'boolean',
130
+ name: 'autoPublish',
131
+ header: i18next.t('field.auto-publish'),
132
+ record: {
133
+ editable: true
134
+ },
135
+ width: 120
136
+ },
137
+ {
138
+ type: 'select',
129
139
  name: 'type',
130
140
  header: i18next.t('field.type'),
131
141
  record: {
132
- editable: true
142
+ editable: true,
143
+ options: [
144
+ {},
145
+ {
146
+ display: 'text',
147
+ value: 'text'
148
+ },
149
+ {
150
+ display: 'number',
151
+ value: 'number'
152
+ },
153
+ {
154
+ display: 'object',
155
+ value: 'object'
156
+ }
157
+ ]
133
158
  },
134
159
  filter: 'search',
135
160
  sortable: true,
@@ -145,11 +170,11 @@ export class StateRegisterListPage extends connect(store)(p13n(localize(i18next)
145
170
  width: 100
146
171
  },
147
172
  {
148
- type: 'json5',
173
+ type: 'data',
149
174
  name: 'state',
150
175
  header: i18next.t('field.state-value'),
151
176
  record: {
152
- editable: false
177
+ editable: true // 사용자가 state를 편집할 수 있도록 변경
153
178
  },
154
179
  width: 200
155
180
  },
@@ -192,12 +217,13 @@ export class StateRegisterListPage extends connect(store)(p13n(localize(i18next)
192
217
  id
193
218
  name
194
219
  description
195
- type
196
220
  group
221
+ type
197
222
  place
198
223
  unit
199
224
  ttl
200
225
  state
226
+ autoPublish
201
227
  writer {
202
228
  id
203
229
  name
@@ -2,9 +2,10 @@ import './editors/entity-editor.js';
2
2
  import './editors/property-editor.js';
3
3
  import { OxGristEditorJson } from '@operato/app/grist-editor/ox-grist-editor-json.js';
4
4
  import { OxGristRendererCrontab } from '@operato/app/grist-editor/ox-grist-renderer-crontab.js';
5
- import { registerEditor as registerGristEditor, registerRenderer as registerGristRenderer } from '@operato/data-grist';
5
+ import { registerEditor as registerGristEditor, registerRenderer as registerGristRenderer, OxGristRendererJson5 } from '@operato/data-grist';
6
6
  import { OxGristEditorCrontab } from '@operato/grist-editor/ox-grist-editor-crontab.js';
7
7
  import { OxGristEditorParameters } from '@operato/grist-editor/ox-grist-editor-parameters.js';
8
+ import { OxGristEditorData } from '@operato/grist-editor/ox-grist-editor-data.js';
8
9
  import { OxPropertyEditor } from '@operato/property-editor';
9
10
  import { ConnectionSelector } from './grist/connection-selector.js';
10
11
  import { ConnectorSelector } from './grist/connector-selector.js';
@@ -16,7 +17,9 @@ export default function bootstrap() {
16
17
  registerGristEditor('json', OxGristEditorJson);
17
18
  registerGristEditor('parameters', OxGristEditorParameters);
18
19
  registerGristEditor('crontab', OxGristEditorCrontab);
20
+ registerGristEditor('data', OxGristEditorData);
19
21
  registerGristRenderer('crontab', OxGristRendererCrontab);
22
+ registerGristRenderer('data', OxGristRendererJson5);
20
23
  OxPropertyEditor.register({
21
24
  'http-headers': 'property-editor-http-headers',
22
25
  'http-parameters': 'property-editor-http-parameters',
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,8BAA8B,CAAA;AAErC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mDAAmD,CAAA;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,wDAAwD,CAAA;AAC/F,OAAO,EACL,cAAc,IAAI,mBAAmB,EACrC,gBAAgB,IAAI,qBAAqB,EAE1C,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAA;AAEvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAEhE,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,mBAAmB,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAA;IAClD,mBAAmB,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAA;IACnD,mBAAmB,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAA;IACrD,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;IAC9C,mBAAmB,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAAA;IAC1D,mBAAmB,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAA;IAEpD,qBAAqB,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAA;IAExD,gBAAgB,CAAC,QAAQ,CAAC;QACxB,cAAc,EAAE,8BAA8B;QAC9C,iBAAiB,EAAE,iCAAiC;QACpD,WAAW,EAAE,2BAA2B;QACxC,iBAAiB,EAAE,iCAAiC;QACpD,qBAAqB,EAAE,qCAAqC;QAC5D,eAAe,EAAE,+BAA+B;QAChD,sBAAsB,EAAE,sCAAsC;KAC/D,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import './editors/entity-editor.js'\nimport './editors/property-editor.js'\n\nimport { OxGristEditorJson } from '@operato/app/grist-editor/ox-grist-editor-json.js'\nimport { OxGristRendererCrontab } from '@operato/app/grist-editor/ox-grist-renderer-crontab.js'\nimport {\n registerEditor as registerGristEditor,\n registerRenderer as registerGristRenderer,\n OxGristRendererJson5\n} from '@operato/data-grist'\nimport { OxGristEditorCrontab } from '@operato/grist-editor/ox-grist-editor-crontab.js'\nimport { OxGristEditorPrivilege } from '@operato/app/grist-editor/ox-grist-editor-privilege.js'\nimport { OxGristEditorParameters } from '@operato/grist-editor/ox-grist-editor-parameters.js'\nimport { OxPropertyEditor } from '@operato/property-editor'\n\nimport { ConnectionSelector } from './grist/connection-selector.js'\nimport { ConnectorSelector } from './grist/connector-selector.js'\nimport { TaskTypeSelector } from './grist/task-type-selector.js'\n\nexport default function bootstrap() {\n registerGristEditor('task-type', TaskTypeSelector)\n registerGristEditor('connector', ConnectorSelector)\n registerGristEditor('connection', ConnectionSelector)\n registerGristEditor('json', OxGristEditorJson)\n registerGristEditor('parameters', OxGristEditorParameters)\n registerGristEditor('crontab', OxGristEditorCrontab)\n\n registerGristRenderer('crontab', OxGristRendererCrontab)\n\n OxPropertyEditor.register({\n 'http-headers': 'property-editor-http-headers',\n 'http-parameters': 'property-editor-http-parameters',\n 'http-body': 'property-editor-http-body',\n 'entity-selector': 'property-editor-entity-selector',\n 'scenario-step-input': 'property-editor-scenario-step-input',\n 'tag-scenarios': 'property-editor-tag-scenarios',\n 'procedure-parameters': 'property-editor-procedure-parameters'\n })\n}\n"]}
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,8BAA8B,CAAA;AAErC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mDAAmD,CAAA;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,wDAAwD,CAAA;AAC/F,OAAO,EACL,cAAc,IAAI,mBAAmB,EACrC,gBAAgB,IAAI,qBAAqB,EACzC,oBAAoB,EACrB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAA;AAEvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAA;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAEhE,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,mBAAmB,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAA;IAClD,mBAAmB,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAA;IACnD,mBAAmB,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAA;IACrD,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;IAC9C,mBAAmB,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAAA;IAC1D,mBAAmB,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAA;IACpD,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;IAE9C,qBAAqB,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAA;IACxD,qBAAqB,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAA;IAEnD,gBAAgB,CAAC,QAAQ,CAAC;QACxB,cAAc,EAAE,8BAA8B;QAC9C,iBAAiB,EAAE,iCAAiC;QACpD,WAAW,EAAE,2BAA2B;QACxC,iBAAiB,EAAE,iCAAiC;QACpD,qBAAqB,EAAE,qCAAqC;QAC5D,eAAe,EAAE,+BAA+B;QAChD,sBAAsB,EAAE,sCAAsC;KAC/D,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import './editors/entity-editor.js'\nimport './editors/property-editor.js'\n\nimport { OxGristEditorJson } from '@operato/app/grist-editor/ox-grist-editor-json.js'\nimport { OxGristRendererCrontab } from '@operato/app/grist-editor/ox-grist-renderer-crontab.js'\nimport {\n registerEditor as registerGristEditor,\n registerRenderer as registerGristRenderer,\n OxGristRendererJson5\n} from '@operato/data-grist'\nimport { OxGristEditorCrontab } from '@operato/grist-editor/ox-grist-editor-crontab.js'\nimport { OxGristEditorPrivilege } from '@operato/app/grist-editor/ox-grist-editor-privilege.js'\nimport { OxGristEditorParameters } from '@operato/grist-editor/ox-grist-editor-parameters.js'\nimport { OxGristEditorData } from '@operato/grist-editor/ox-grist-editor-data.js'\nimport { OxPropertyEditor } from '@operato/property-editor'\n\nimport { ConnectionSelector } from './grist/connection-selector.js'\nimport { ConnectorSelector } from './grist/connector-selector.js'\nimport { TaskTypeSelector } from './grist/task-type-selector.js'\n\nexport default function bootstrap() {\n registerGristEditor('task-type', TaskTypeSelector)\n registerGristEditor('connector', ConnectorSelector)\n registerGristEditor('connection', ConnectionSelector)\n registerGristEditor('json', OxGristEditorJson)\n registerGristEditor('parameters', OxGristEditorParameters)\n registerGristEditor('crontab', OxGristEditorCrontab)\n registerGristEditor('data', OxGristEditorData)\n\n registerGristRenderer('crontab', OxGristRendererCrontab)\n registerGristRenderer('data', OxGristRendererJson5)\n\n OxPropertyEditor.register({\n 'http-headers': 'property-editor-http-headers',\n 'http-parameters': 'property-editor-http-parameters',\n 'http-body': 'property-editor-http-body',\n 'entity-selector': 'property-editor-entity-selector',\n 'scenario-step-input': 'property-editor-scenario-step-input',\n 'tag-scenarios': 'property-editor-tag-scenarios',\n 'procedure-parameters': 'property-editor-procedure-parameters'\n })\n}\n"]}
@@ -93,7 +93,8 @@ let StateRegisterListPage = class StateRegisterListPage extends connect(store)(p
93
93
  },
94
94
  filter: 'search',
95
95
  sortable: true,
96
- width: 150
96
+ width: 150,
97
+ description: i18next.t('field.name-publish-tag-desc') // name이 publish tag 역할을 한다는 설명
97
98
  },
98
99
  {
99
100
  type: 'string',
@@ -117,11 +118,35 @@ let StateRegisterListPage = class StateRegisterListPage extends connect(store)(p
117
118
  width: 150
118
119
  },
119
120
  {
120
- type: 'string',
121
+ type: 'boolean',
122
+ name: 'autoPublish',
123
+ header: i18next.t('field.auto-publish'),
124
+ record: {
125
+ editable: true
126
+ },
127
+ width: 120
128
+ },
129
+ {
130
+ type: 'select',
121
131
  name: 'type',
122
132
  header: i18next.t('field.type'),
123
133
  record: {
124
- editable: true
134
+ editable: true,
135
+ options: [
136
+ {},
137
+ {
138
+ display: 'text',
139
+ value: 'text'
140
+ },
141
+ {
142
+ display: 'number',
143
+ value: 'number'
144
+ },
145
+ {
146
+ display: 'object',
147
+ value: 'object'
148
+ }
149
+ ]
125
150
  },
126
151
  filter: 'search',
127
152
  sortable: true,
@@ -137,11 +162,11 @@ let StateRegisterListPage = class StateRegisterListPage extends connect(store)(p
137
162
  width: 100
138
163
  },
139
164
  {
140
- type: 'json5',
165
+ type: 'data',
141
166
  name: 'state',
142
167
  header: i18next.t('field.state-value'),
143
168
  record: {
144
- editable: false
169
+ editable: true // 사용자가 state를 편집할 수 있도록 변경
145
170
  },
146
171
  width: 200
147
172
  },
@@ -182,12 +207,13 @@ let StateRegisterListPage = class StateRegisterListPage extends connect(store)(p
182
207
  id
183
208
  name
184
209
  description
185
- type
186
210
  group
211
+ type
187
212
  place
188
213
  unit
189
214
  ttl
190
215
  state
216
+ autoPublish
191
217
  writer {
192
218
  id
193
219
  name
@@ -1 +1 @@
1
- {"version":3,"file":"state-register.js","sourceRoot":"","sources":["../../client/pages/state-register.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AACtD,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC5G,OAAO,EAAgB,SAAS,EAA+B,MAAM,qBAAqB,CAAA;AAC1F,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAa,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAW,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAG7B,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IAArF;;QAuBuB,SAAI,GAA6B,cAAc,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAA;IAsPjG,CAAC;aA5QQ,WAA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QjC","sourcesContent":["import '@operato/data-grist'\n\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\nimport gql from 'graphql-tag'\n\nimport { PageView, store } from '@operato/shell'\nimport { CommonHeaderStyles, CommonGristStyles, CommonButtonStyles, ScrollbarStyles } from '@operato/styles'\nimport { ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { OxPopup, OxPrompt } from '@operato/popup'\nimport { isMobileDevice } from '@operato/utils'\nimport { p13n } from '@operato/p13n'\n\n@customElement('state-register-page')\nexport class StateRegisterListPage extends connect(store)(p13n(localize(i18next)(PageView))) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.state-register'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist.searchText\n },\n help: 'integration/ui/state-register',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateStateRegister.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteStateRegister.bind(this),\n ...CommonButtonStyles.delete\n }\n ]\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist\n .mode=${mode}\n .config=${this.gristConfig}\n .fetchHandler=${this.fetchHandler.bind(this)}\n .personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}\n >\n <ox-grist-personalizer slot=\"setting\"></ox-grist-personalizer>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n list: {\n fields: ['name', 'description'],\n details: ['type', 'state', 'wroteAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n filter: 'search',\n width: 200\n },\n {\n type: 'string',\n name: 'group',\n header: i18next.t('field.group'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n {\n type: 'string',\n name: 'type',\n header: i18next.t('field.type'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n {\n type: 'number',\n name: 'ttl',\n header: i18next.t('field.ttl-seconds'),\n record: {\n editable: true\n },\n width: 100\n },\n {\n type: 'json5',\n name: 'state',\n header: i18next.t('field.state-value'),\n record: {\n editable: false\n },\n width: 200\n },\n {\n type: 'datetime',\n name: 'wroteAt',\n header: i18next.t('field.wrote-at'),\n record: {\n editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'name'\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (this.active) {\n // do something here when this page just became as active\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: stateRegisters(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n type\n group\n place\n unit\n ttl\n state\n writer {\n id\n name\n }\n wroteAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteStateRegister() {\n if (\n await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) {\n const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteStateRegisters(ids: $ids)\n }\n `,\n variables: {\n ids\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _updateStateRegister() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [StateRegisterPatch!]!) {\n updateMultipleStateRegister(patches: $patches) {\n name\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"state-register.js","sourceRoot":"","sources":["../../client/pages/state-register.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AACtD,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,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,CAAC;GACxB,qBAAqB,CAuSjC","sourcesContent":["import '@operato/data-grist'\n\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\nimport gql from 'graphql-tag'\n\nimport { PageView, store } from '@operato/shell'\nimport { CommonHeaderStyles, CommonGristStyles, CommonButtonStyles, ScrollbarStyles } from '@operato/styles'\nimport { ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { OxPopup, OxPrompt } from '@operato/popup'\nimport { isMobileDevice } from '@operato/utils'\nimport { p13n } from '@operato/p13n'\n\n@customElement('state-register-page')\nexport class StateRegisterListPage extends connect(store)(p13n(localize(i18next)(PageView))) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.state-register'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist.searchText\n },\n help: 'integration/ui/state-register',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateStateRegister.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteStateRegister.bind(this),\n ...CommonButtonStyles.delete\n }\n ]\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist\n .mode=${mode}\n .config=${this.gristConfig}\n .fetchHandler=${this.fetchHandler.bind(this)}\n .personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}\n >\n <ox-grist-personalizer slot=\"setting\"></ox-grist-personalizer>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n list: {\n fields: ['name', 'description'],\n details: ['type', 'state', 'wroteAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150,\n description: i18next.t('field.name-publish-tag-desc') // name이 publish tag 역할을 한다는 설명\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n filter: 'search',\n width: 200\n },\n {\n type: 'string',\n name: 'group',\n header: i18next.t('field.group'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n {\n type: 'boolean',\n name: 'autoPublish',\n header: i18next.t('field.auto-publish'),\n record: {\n editable: true\n },\n width: 120\n },\n {\n type: 'select',\n name: 'type',\n header: i18next.t('field.type'),\n record: {\n editable: true,\n options: [\n {},\n {\n display: 'text',\n value: 'text'\n },\n {\n display: 'number',\n value: 'number'\n },\n {\n display: 'object',\n value: 'object'\n }\n ]\n },\n filter: 'search',\n sortable: true,\n width: 150\n },\n {\n type: 'number',\n name: 'ttl',\n header: i18next.t('field.ttl-seconds'),\n record: {\n editable: true\n },\n width: 100\n },\n {\n type: 'data',\n name: 'state',\n header: i18next.t('field.state-value'),\n record: {\n editable: true // 사용자가 state를 편집할 수 있도록 변경\n },\n width: 200\n },\n {\n type: 'datetime',\n name: 'wroteAt',\n header: i18next.t('field.wrote-at'),\n record: {\n editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'name'\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (this.active) {\n // do something here when this page just became as active\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: stateRegisters(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n group\n type\n place\n unit\n ttl\n state\n autoPublish\n writer {\n id\n name\n }\n wroteAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async _deleteStateRegister() {\n if (\n await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) {\n const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteStateRegisters(ids: $ids)\n }\n `,\n variables: {\n ids\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async _updateStateRegister() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [StateRegisterPatch!]!) {\n updateMultipleStateRegister(patches: $patches) {\n name\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n }\n }\n }\n}\n"]}