@things-factory/auth-ui 9.1.19 → 10.0.0-beta.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.
Files changed (47) hide show
  1. package/dist-client/bootstrap.js +24 -0
  2. package/dist-client/bootstrap.js.map +1 -1
  3. package/dist-client/components/domain-switch.d.ts +2 -12
  4. package/dist-client/components/domain-switch.js +5 -18
  5. package/dist-client/components/domain-switch.js.map +1 -1
  6. package/dist-client/components/user-role-editor.js +13 -4
  7. package/dist-client/components/user-role-editor.js.map +1 -1
  8. package/dist-client/pages/app-binding/app-binding.js +66 -111
  9. package/dist-client/pages/app-binding/app-binding.js.map +1 -1
  10. package/dist-client/pages/app-binding/app-bindings.js +38 -59
  11. package/dist-client/pages/app-binding/app-bindings.js.map +1 -1
  12. package/dist-client/pages/appliance/appliance.js +72 -120
  13. package/dist-client/pages/appliance/appliance.js.map +1 -1
  14. package/dist-client/pages/appliance/home.js +39 -61
  15. package/dist-client/pages/appliance/home.js.map +1 -1
  16. package/dist-client/pages/appliance/register.js +33 -52
  17. package/dist-client/pages/appliance/register.js.map +1 -1
  18. package/dist-client/pages/application/application.js +67 -107
  19. package/dist-client/pages/application/application.js.map +1 -1
  20. package/dist-client/pages/application/applications.js +38 -59
  21. package/dist-client/pages/application/applications.js.map +1 -1
  22. package/dist-client/pages/application/register.js +41 -64
  23. package/dist-client/pages/application/register.js.map +1 -1
  24. package/dist-client/pages/attribute/attribute-set-management.d.ts +0 -6
  25. package/dist-client/pages/attribute/attribute-set-management.js +46 -87
  26. package/dist-client/pages/attribute/attribute-set-management.js.map +1 -1
  27. package/dist-client/pages/auth-provider/auth-provider-management.d.ts +0 -6
  28. package/dist-client/pages/auth-provider/auth-provider-management.js +67 -127
  29. package/dist-client/pages/auth-provider/auth-provider-management.js.map +1 -1
  30. package/dist-client/pages/domain/domain-management.d.ts +0 -6
  31. package/dist-client/pages/domain/domain-management.js +74 -118
  32. package/dist-client/pages/domain/domain-management.js.map +1 -1
  33. package/dist-client/pages/domain-link/domain-link-management.d.ts +1 -7
  34. package/dist-client/pages/domain-link/domain-link-management.js +67 -125
  35. package/dist-client/pages/domain-link/domain-link-management.js.map +1 -1
  36. package/dist-client/pages/env-var/env-var-list-page.d.ts +0 -6
  37. package/dist-client/pages/env-var/env-var-list-page.js +44 -82
  38. package/dist-client/pages/env-var/env-var-list-page.js.map +1 -1
  39. package/dist-client/pages/partner/partner-management.js +17 -28
  40. package/dist-client/pages/partner/partner-management.js.map +1 -1
  41. package/dist-client/pages/role/role-management.js +20 -33
  42. package/dist-client/pages/role/role-management.js.map +1 -1
  43. package/dist-client/tsconfig.tsbuildinfo +1 -1
  44. package/dist-server/tsconfig.tsbuildinfo +1 -1
  45. package/package.json +12 -12
  46. package/views/auth-page.html +1 -1
  47. package/views/oauth2-page.html +1 -1
@@ -2,52 +2,44 @@ import { __decorate, __metadata } from "tslib";
2
2
  import gql from 'graphql-tag';
3
3
  import { css, html } from 'lit';
4
4
  import { customElement, property, query, state } from 'lit/decorators.js';
5
- import { connect } from 'pwa-helpers/connect-mixin.js';
6
5
  import { client } from '@operato/graphql';
7
- import { navigate, PageView, store } from '@operato/shell';
8
- let ApplicationRegister = class ApplicationRegister extends connect(store)(PageView) {
6
+ import { navigate, PageView } from '@operato/shell';
7
+ let ApplicationRegister = class ApplicationRegister extends PageView {
9
8
  static { this.styles = [
10
9
  css `
11
- :host {
12
- background-color: var(--md-sys-color-background);
10
+ :host { background-color: var(--md-sys-color-background);
13
11
  padding: var(--spacing-large);
14
12
 
15
13
  position: relative;
16
14
 
17
15
  overflow: auto;
18
- }
19
- h2 {
20
- margin: var(--title-margin);
16
+ }
17
+ h2 { margin: var(--title-margin);
21
18
  font: var(--title-font);
22
19
  color: var(--title-text-color);
23
- }
24
- [page-description] {
25
- margin: var(--page-description-margin);
20
+ }
21
+ [page-description] { margin: var(--page-description-margin);
26
22
  font: var(--page-description-font);
27
23
  color: var(--page-description-color);
28
- }
29
- [icon] {
30
- position: absolute;
24
+ }
25
+ [icon] { position: absolute;
31
26
  top: 10px;
32
27
  right: 10px;
33
28
 
34
29
  max-width: 80px;
35
- }
36
- [icon] img {
37
- max-width: 100%;
30
+ }
31
+ [icon] img { max-width: 100%;
38
32
  max-height: 100%;
39
- }
33
+ }
40
34
 
41
- img[pagedeco] {
42
- width: 150px;
35
+ img[pagedeco] { width: 150px;
43
36
  margin: 0 var(--spacing-large);
44
37
  float: left;
45
38
  position: relative;
46
39
  top: -20px;
47
- }
40
+ }
48
41
 
49
- [form-container] {
50
- background-color: var(--md-sys-color-surface);
42
+ [form-container] { background-color: var(--md-sys-color-surface);
51
43
  padding: var(--spacing-large);
52
44
  border-radius: var(--border-radius);
53
45
  box-shadow: var(--box-shadow);
@@ -55,53 +47,42 @@ let ApplicationRegister = class ApplicationRegister extends connect(store)(PageV
55
47
  position: relative;
56
48
  top: -50px;
57
49
  clear: both;
58
- }
59
- label {
60
- font: var(--label-font);
50
+ }
51
+ label { font: var(--label-font);
61
52
  color: var(--label-color, var(--md-sys-color-on-surface));
62
53
  text-transform: var(--label-text-transform);
63
- }
64
- input {
65
- border: var(--border-dim-color);
54
+ }
55
+ input { border: var(--border-dim-color);
66
56
  border-radius: var(--border-radius);
67
57
  margin: var(--input-margin);
68
58
  padding: var(--input-padding);
69
59
  font: var(--input-font);
70
60
 
71
61
  flex: 1;
72
- }
62
+ }
73
63
  select:focus,
74
- input:focus {
75
- outline: none;
76
- }
77
- [field-2column] {
78
- display: grid;
64
+ input:focus { outline: none;
65
+ }
66
+ [field-2column] { display: grid;
79
67
  grid-template-columns: 1fr 1fr;
80
68
  grid-gap: 15px;
81
- }
82
- [field] {
83
- display: flex;
69
+ }
70
+ [field] { display: flex;
84
71
  flex-direction: column;
85
- }
86
- [grid-span] {
87
- grid-column: span 2;
88
- }
89
- @media screen and (max-width: 480px) {
90
- img[pagedeco] {
91
- display: none;
92
- }
93
- [form-container] {
94
- position: initial;
95
- }
96
- [field] {
97
- grid-column: span 2;
98
- }
99
- }
72
+ }
73
+ [grid-span] { grid-column: span 2;
74
+ }
75
+ @media screen and (max-width: 480px) { img[pagedeco] { display: none;
76
+ }
77
+ [form-container] { position: initial;
78
+ }
79
+ [field] { grid-column: span 2;
80
+ }
81
+ }
100
82
  `
101
83
  ]; }
102
84
  get context() {
103
- return {
104
- title: `application registration`,
85
+ return { title: `application registration`,
105
86
  help: 'auth/application'
106
87
  };
107
88
  }
@@ -168,16 +149,12 @@ let ApplicationRegister = class ApplicationRegister extends connect(store)(PageV
168
149
  application[key] = value;
169
150
  return application;
170
151
  }, {});
171
- const response = await client.mutate({
172
- mutation: gql `
173
- mutation ($application: NewApplication!) {
174
- createApplication(application: $application) {
175
- id
176
- }
177
- }
152
+ const response = await client.mutate({ mutation: gql `
153
+ mutation ($application: NewApplication!) { createApplication(application: $application) { id
154
+ }
155
+ }
178
156
  `,
179
- variables: {
180
- application
157
+ variables: { application
181
158
  }
182
159
  });
183
160
  if (response.errors) {
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../client/pages/application/register.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAG1D,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC;aACjD,WAAM,GAAG;QACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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B,CAAC,CAAA;QAC/B,CAAC;aAAM,CAAC;YACN,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAA;YAC7C,QAAQ,CAAC,eAAe,EAAE,EAAE,CAAC,CAAA;QAC/B,CAAC;IACH,CAAC;IAED,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM;QACpC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAA;QACnB,CAAC;IACH,CAAC;;AAzG2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wDAAiB;AAE7B;IAAd,KAAK,CAAC,MAAM,CAAC;8BAAQ,eAAe;iDAAA;AAE5B;IAAR,KAAK,EAAE;;kDAAe;AAnGnB,mBAAmB;IADxB,aAAa,CAAC,sBAAsB,CAAC;GAChC,mBAAmB,CAyMxB","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\n\nimport { client } from '@operato/graphql'\nimport { navigate, PageView, store } from '@operato/shell'\n\n@customElement('application-register')\nclass ApplicationRegister extends connect(store)(PageView) {\n static styles = [\n css`\n :host {\n background-color: var(--md-sys-color-background);\n padding: var(--spacing-large);\n\n position: relative;\n\n overflow: auto;\n }\n h2 {\n margin: var(--title-margin);\n font: var(--title-font);\n color: var(--title-text-color);\n }\n [page-description] {\n margin: var(--page-description-margin);\n font: var(--page-description-font);\n color: var(--page-description-color);\n }\n [icon] {\n position: absolute;\n top: 10px;\n right: 10px;\n\n max-width: 80px;\n }\n [icon] img {\n max-width: 100%;\n max-height: 100%;\n }\n\n img[pagedeco] {\n width: 150px;\n margin: 0 var(--spacing-large);\n float: left;\n position: relative;\n top: -20px;\n }\n\n [form-container] {\n background-color: var(--md-sys-color-surface);\n padding: var(--spacing-large);\n border-radius: var(--border-radius);\n box-shadow: var(--box-shadow);\n max-width: var(--input-container-max-width);\n position: relative;\n top: -50px;\n clear: both;\n }\n label {\n font: var(--label-font);\n color: var(--label-color, var(--md-sys-color-on-surface));\n text-transform: var(--label-text-transform);\n }\n input {\n border: var(--border-dim-color);\n border-radius: var(--border-radius);\n margin: var(--input-margin);\n padding: var(--input-padding);\n font: var(--input-font);\n\n flex: 1;\n }\n select:focus,\n input:focus {\n outline: none;\n }\n [field-2column] {\n display: grid;\n grid-template-columns: 1fr 1fr;\n grid-gap: 15px;\n }\n [field] {\n display: flex;\n flex-direction: column;\n }\n [grid-span] {\n grid-column: span 2;\n }\n @media screen and (max-width: 480px) {\n img[pagedeco] {\n display: none;\n }\n [form-container] {\n position: initial;\n }\n [field] {\n grid-column: span 2;\n }\n }\n `\n ]\n\n @property({ type: Object }) application: any\n\n @query('form') form!: HTMLFormElement\n\n @state() _icon?: string\n\n get context() {\n return {\n title: `application registration`,\n help: 'auth/application'\n }\n }\n\n render() {\n return html`\n <img src=\"/assets/images/image-api.png\" pagedeco />\n <h2>Register new application</h2>\n <p page-description>\n You can register new application here.<br />\n What type of app are you building? Choose the app type that best suits the audience you’re building for.\n </p>\n\n ${this._icon\n ? html`\n <div icon>\n <img src=${this._icon} />\n </div>\n `\n : html``}\n\n <div form-container>\n <form>\n <div field-2column>\n <div field grid-span>\n <label for=\"name\">name</label>\n <input id=\"name\" type=\"text\" name=\"name\" />\n </div>\n\n <div field grid-span>\n <label for=\"description\">description</label>\n <input id=\"description\" type=\"text\" name=\"description\" />\n </div>\n\n <div field grid-span>\n <label for=\"app-url\">application url</label>\n <input id=\"app-url\" type=\"text\" name=\"url\" />\n </div>\n\n <div field grid-span>\n <label for=\"redirect-url\">redirectUrl</label>\n <input id=\"redirect-url\" type=\"text\" name=\"redirectUrl\" />\n </div>\n\n <div field grid-span>\n <label for=\"icon\">application icon</label>\n <input id=\"icon\" type=\"text\" name=\"icon\" @change=${e => (this._icon = e.target.value)} />\n </div>\n\n <div field grid-span>\n <label for=\"email\">contact email</label>\n <input id=\"email\" type=\"text\" name=\"email\" />\n </div>\n\n <md-elevated-button grid-span @click=${this.createApplication.bind(this)}>register</md-elevated-button>\n </div>\n </form>\n </div>\n `\n }\n\n async createApplication(e) {\n e.preventDefault()\n\n const formData = new FormData(this.form)\n\n const application = Array.from(formData.entries()).reduce((application, [key, value]) => {\n application[key] = value\n return application\n }, {})\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($application: NewApplication!) {\n createApplication(application: $application) {\n id\n }\n }\n `,\n variables: {\n application\n }\n })\n\n if (response.errors) {\n console.log('creation fail.')\n } else {\n const id = response.data.createApplication.id\n navigate(`application/${id}`)\n }\n }\n\n pageUpdated(changes, lifecycle, before) {\n if (this.active) {\n this.form.reset()\n }\n }\n}\n"]}
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../client/pages/application/register.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAGnD,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,QAAQ;aAAY,WAAM,GAAG;QAC3D,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyEF;KACF,AA3EyD,CA2EzD;IAQD,IAAI,OAAO;QAAS,OAAO,EAAQ,KAAK,EAAE,0BAA0B;YAChE,IAAI,EAAE,kBAAkB;SAC5B,CAAA;IACD,CAAC;IAEA,MAAM;QAAS,OAAO,IAAI,CAAA;;;;;;;;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;QAAQ,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAA;QACzF,CAAC;IACD,CAAC;;AA5F4B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wDAAiB;AAE7B;IAAd,KAAK,CAAC,MAAM,CAAC;8BAAQ,eAAe;iDAAA;AAE5B;IAAR,KAAK,EAAE;;kDAAe;AAjFnB,mBAAmB;IADxB,aAAa,CAAC,sBAAsB,CAAC;GAChC,mBAAmB,CA0KxB","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { client } from '@operato/graphql'\nimport { navigate, PageView } from '@operato/shell'\n\n@customElement('application-register')\nclass ApplicationRegister extends PageView { static styles = [\n css`\n :host { background-color: var(--md-sys-color-background);\n padding: var(--spacing-large);\n\n position: relative;\n\n overflow: auto;\n }\n h2 { margin: var(--title-margin);\n font: var(--title-font);\n color: var(--title-text-color);\n }\n [page-description] { margin: var(--page-description-margin);\n font: var(--page-description-font);\n color: var(--page-description-color);\n }\n [icon] { position: absolute;\n top: 10px;\n right: 10px;\n\n max-width: 80px;\n }\n [icon] img { max-width: 100%;\n max-height: 100%;\n }\n\n img[pagedeco] { width: 150px;\n margin: 0 var(--spacing-large);\n float: left;\n position: relative;\n top: -20px;\n }\n\n [form-container] { background-color: var(--md-sys-color-surface);\n padding: var(--spacing-large);\n border-radius: var(--border-radius);\n box-shadow: var(--box-shadow);\n max-width: var(--input-container-max-width);\n position: relative;\n top: -50px;\n clear: both;\n }\n label { font: var(--label-font);\n color: var(--label-color, var(--md-sys-color-on-surface));\n text-transform: var(--label-text-transform);\n }\n input { border: var(--border-dim-color);\n border-radius: var(--border-radius);\n margin: var(--input-margin);\n padding: var(--input-padding);\n font: var(--input-font);\n\n flex: 1;\n }\n select:focus,\n input:focus { outline: none;\n }\n [field-2column] { display: grid;\n grid-template-columns: 1fr 1fr;\n grid-gap: 15px;\n }\n [field] { display: flex;\n flex-direction: column;\n }\n [grid-span] { grid-column: span 2;\n }\n @media screen and (max-width: 480px) { img[pagedeco] { display: none;\n }\n [form-container] { position: initial;\n }\n [field] { grid-column: span 2;\n }\n }\n `\n ]\n\n @property({ type: Object }) application: any\n\n @query('form') form!: HTMLFormElement\n\n @state() _icon?: string\n\n get context() { return { title: `application registration`,\n help: 'auth/application'\n }\n }\n\n render() { return html`\n <img src=\"/assets/images/image-api.png\" pagedeco />\n <h2>Register new application</h2>\n <p page-description>\n You can register new application here.<br />\n What type of app are you building? Choose the app type that best suits the audience you’re building for.\n </p>\n\n ${this._icon\n ? html`\n <div icon>\n <img src=${this._icon} />\n </div>\n `\n : html``}\n\n <div form-container>\n <form>\n <div field-2column>\n <div field grid-span>\n <label for=\"name\">name</label>\n <input id=\"name\" type=\"text\" name=\"name\" />\n </div>\n\n <div field grid-span>\n <label for=\"description\">description</label>\n <input id=\"description\" type=\"text\" name=\"description\" />\n </div>\n\n <div field grid-span>\n <label for=\"app-url\">application url</label>\n <input id=\"app-url\" type=\"text\" name=\"url\" />\n </div>\n\n <div field grid-span>\n <label for=\"redirect-url\">redirectUrl</label>\n <input id=\"redirect-url\" type=\"text\" name=\"redirectUrl\" />\n </div>\n\n <div field grid-span>\n <label for=\"icon\">application icon</label>\n <input id=\"icon\" type=\"text\" name=\"icon\" @change=${e => (this._icon = e.target.value)} />\n </div>\n\n <div field grid-span>\n <label for=\"email\">contact email</label>\n <input id=\"email\" type=\"text\" name=\"email\" />\n </div>\n\n <md-elevated-button grid-span @click=${this.createApplication.bind(this)}>register</md-elevated-button>\n </div>\n </form>\n </div>\n `\n }\n\n async createApplication(e) { e.preventDefault()\n\n const formData = new FormData(this.form)\n\n const application = Array.from(formData.entries()).reduce((application, [key, value]) => { application[key] = value\n return application\n }, {})\n\n const response = await client.mutate({ mutation: gql`\n mutation ($application: NewApplication!) { createApplication(application: $application) { id\n }\n }\n `,\n variables: { application\n }\n })\n\n if (response.errors) { console.log('creation fail.')\n } else { const id = response.data.createApplication.id\n navigate(`application/${id}`)\n }\n }\n\n pageUpdated(changes, lifecycle, before) { if (this.active) { this.form.reset()\n }\n }\n}\n"]}
@@ -5,12 +5,6 @@ import './attribute-set-item-list.js';
5
5
  import { FetchOption } from '@operato/data-grist';
6
6
  import { PageView } from '@operato/shell';
7
7
  declare const AttributeSetManagementPage_base: (new (...args: any[]) => {
8
- _storeUnsubscribe: import("redux").Unsubscribe;
9
- connectedCallback(): void;
10
- disconnectedCallback(): void;
11
- stateChanged(_state: unknown): void;
12
- readonly isConnected: boolean;
13
- }) & (new (...args: any[]) => {
14
8
  __preferenceProviders: {
15
9
  [element: string]: import("@operato/p13n").PagePreferenceProvider;
16
10
  };
@@ -6,16 +6,15 @@ import './attribute-set-item-list.js';
6
6
  import gql from 'graphql-tag';
7
7
  import { css, html } from 'lit';
8
8
  import { customElement, query, state } from 'lit/decorators.js';
9
- import { connect } from 'pwa-helpers/connect-mixin';
10
9
  import { DataGrist } from '@operato/data-grist';
11
10
  import { client } from '@operato/graphql';
12
11
  import { i18next, localize } from '@operato/i18n';
13
12
  import { notify, openPopup } from '@operato/layout';
14
- import { PageView, store } from '@operato/shell';
13
+ import { PageView } from '@operato/shell';
15
14
  import { CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
16
15
  import { isMobileDevice } from '@operato/utils';
17
16
  import { p13n } from '@operato/p13n';
18
- let AttributeSetManagementPage = class AttributeSetManagementPage extends connect(store)(p13n(localize(i18next)(PageView))) {
17
+ let AttributeSetManagementPage = class AttributeSetManagementPage extends p13n(localize(i18next)(PageView)) {
19
18
  constructor() {
20
19
  super(...arguments);
21
20
  this.mode = isMobileDevice() ? 'CARD' : 'GRID';
@@ -25,53 +24,43 @@ let AttributeSetManagementPage = class AttributeSetManagementPage extends connec
25
24
  CommonGristStyles,
26
25
  CommonHeaderStyles,
27
26
  css `
28
- :host {
29
- display: flex;
27
+ :host { display: flex;
30
28
 
31
29
  width: 100%;
32
30
 
33
31
  --grid-record-emphasized-background-color: #8b0000;
34
32
  --grid-record-emphasized-color: #ff6b6b;
35
- }
33
+ }
36
34
 
37
- ox-grist {
38
- overflow-y: auto;
35
+ ox-grist { overflow-y: auto;
39
36
  flex: 1;
40
- }
37
+ }
41
38
  `
42
39
  ]; }
43
40
  get context() {
44
- return {
45
- title: i18next.t('title.attributes'),
46
- search: {
47
- handler: (search) => {
41
+ return { title: i18next.t('title.attributes'),
42
+ search: { handler: (search) => {
48
43
  this.grist.searchText = search;
49
44
  },
50
- value: this.grist?.searchText || ''
51
- },
52
- filter: {
53
- handler: () => {
45
+ value: this.grist?.searchText || '' },
46
+ filter: { handler: () => {
54
47
  this.grist.toggleHeadroom();
55
48
  }
56
49
  },
57
50
  // help: 'system/attribute',
58
51
  actions: [
59
- {
60
- title: i18next.t('button.save'),
52
+ { title: i18next.t('button.save'),
61
53
  action: this.updateAttributeSet.bind(this),
62
54
  icon: 'save'
63
55
  },
64
- {
65
- title: i18next.t('button.delete'),
56
+ { title: i18next.t('button.delete'),
66
57
  action: this.deleteAttributeSet.bind(this),
67
58
  icon: 'delete',
68
- emphasis: {
69
- danger: true
59
+ emphasis: { danger: true
70
60
  }
71
61
  }
72
62
  ],
73
- toolbar: false
74
- };
63
+ toolbar: false };
75
64
  }
76
65
  render() {
77
66
  const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
@@ -94,24 +83,19 @@ let AttributeSetManagementPage = class AttributeSetManagementPage extends connec
94
83
  `;
95
84
  }
96
85
  async pageInitialized(lifecycle) {
97
- this.gristConfig = {
98
- list: {
99
- fields: ['entity', 'description']
86
+ this.gristConfig = { list: { fields: ['entity', 'description']
100
87
  },
101
88
  columns: [
102
89
  { type: 'gutter', gutterName: 'sequence' },
103
90
  { type: 'gutter', gutterName: 'row-selector', multiple: true },
104
- {
105
- type: 'gutter',
91
+ { type: 'gutter',
106
92
  gutterName: 'button',
107
93
  title: i18next.t('title.attribute model'),
108
94
  icon: 'reorder',
109
- handlers: {
110
- click: (columns, data, column, record, rowIndex) => {
95
+ handlers: { click: (columns, data, column, record, rowIndex) => {
111
96
  if (!record.id)
112
97
  return;
113
- const popup = openPopup(html ` <attribute-set-item-list .attribute=${record}></attribute-set-item-list> `, {
114
- backdrop: true,
98
+ const popup = openPopup(html ` <attribute-set-item-list .attribute=${record}></attribute-set-item-list> `, { backdrop: true,
115
99
  help: 'attribute/ui/attribute-set-item-list',
116
100
  size: 'large',
117
101
  title: i18next.t('title.attribute-item list')
@@ -122,82 +106,66 @@ let AttributeSetManagementPage = class AttributeSetManagementPage extends connec
122
106
  }
123
107
  }
124
108
  },
125
- {
126
- type: 'string',
109
+ { type: 'string',
127
110
  name: 'entity',
128
111
  header: i18next.t('field.entity'),
129
- record: {
130
- editable: true
112
+ record: { editable: true
131
113
  },
132
114
  filter: 'search',
133
115
  sortable: true,
134
116
  width: 150
135
117
  },
136
- {
137
- type: 'string',
118
+ { type: 'string',
138
119
  name: 'description',
139
120
  header: i18next.t('field.description'),
140
- record: {
141
- editable: true
121
+ record: { editable: true
142
122
  },
143
123
  filter: 'search',
144
124
  width: 200
145
125
  },
146
- {
147
- type: 'datetime',
126
+ { type: 'datetime',
148
127
  name: 'updatedAt',
149
128
  header: i18next.t('field.updated_at'),
150
- record: {
151
- editable: false
129
+ record: { editable: false
152
130
  },
153
131
  sortable: true,
154
132
  width: 180
155
133
  }
156
134
  ],
157
- rows: {
158
- selectable: {
159
- multiple: true
135
+ rows: { selectable: { multiple: true
160
136
  }
161
137
  },
162
138
  sorters: [
163
- {
164
- name: 'name'
139
+ { name: 'name'
165
140
  }
166
141
  ]
167
142
  };
168
143
  }
169
144
  async fetchHandler({ page, limit, sortings = [], filters = [] }) {
170
- const response = await client.query({
171
- query: gql `
172
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
173
- responses: attributeSets(filters: $filters, pagination: $pagination, sortings: $sortings) {
174
- items {
175
- id
145
+ const response = await client.query({ query: gql `
146
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: attributeSets(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id
176
147
  entity
177
148
  description
178
149
  updatedAt
179
- items {
180
- name
150
+ items { name
181
151
  description
182
152
  tag
183
153
  active
184
154
  hidden
185
155
  type
186
156
  options
187
- }
188
- }
157
+ }
158
+ }
189
159
  total
190
- }
191
- }
160
+ }
161
+ }
192
162
  `,
193
- variables: {
194
- filters,
163
+ variables: { filters,
195
164
  pagination: { page, limit },
196
165
  sortings
197
166
  }
198
167
  });
199
- return {
200
- total: response.data.responses.total || 0,
168
+ return { total: response.data.responses.total || 0,
201
169
  records: response.data.responses.items || []
202
170
  };
203
171
  }
@@ -205,20 +173,16 @@ let AttributeSetManagementPage = class AttributeSetManagementPage extends connec
205
173
  if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {
206
174
  const ids = this.grist.selected.map(record => record.id);
207
175
  if (ids && ids.length > 0) {
208
- const response = await client.mutate({
209
- mutation: gql `
210
- mutation ($ids: [String!]!) {
211
- deleteAttributeSets(ids: $ids)
212
- }
176
+ const response = await client.mutate({ mutation: gql `
177
+ mutation ($ids: [String!]!) { deleteAttributeSets(ids: $ids)
178
+ }
213
179
  `,
214
- variables: {
215
- ids
180
+ variables: { ids
216
181
  }
217
182
  });
218
183
  if (!response.errors) {
219
184
  this.grist.fetch();
220
- notify({
221
- message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
185
+ notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
222
186
  });
223
187
  }
224
188
  }
@@ -239,19 +203,14 @@ let AttributeSetManagementPage = class AttributeSetManagementPage extends connec
239
203
  patchField.cuFlag = patch.__dirty__;
240
204
  return patchField;
241
205
  });
242
- const response = await client.mutate({
243
- mutation: gql `
244
- mutation ($patches: [AttributeSetPatch!]!) {
245
- updateMultipleAttributeSet(patches: $patches) {
246
- entity
247
- }
248
- }
206
+ const response = await client.mutate({ mutation: gql `
207
+ mutation ($patches: [AttributeSetPatch!]!) { updateMultipleAttributeSet(patches: $patches) { entity
208
+ }
209
+ }
249
210
  `,
250
- variables: {
251
- patches
211
+ variables: { patches
252
212
  },
253
- context: {
254
- hasUpload: true
213
+ context: { hasUpload: true
255
214
  }
256
215
  });
257
216
  if (!response.errors) {
@@ -1 +1 @@
1
- {"version":3,"file":"attribute-set-management.js","sourceRoot":"","sources":["../../../client/pages/attribute/attribute-set-management.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,qBAAqB,CAAA;AAC5B,OAAO,6CAA6C,CAAA;AACpD,OAAO,8BAA8B,CAAA;AAErC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAY,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAEnD,OAAO,EAAwC,SAAS,EAA+B,MAAM,qBAAqB,CAAA;AAClH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO,EAAE,cAAc,EAAS,MAAM,gBAAgB,CAAA;AAEtD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAG7B,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,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\nimport './attribute-set-item-list.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin'\n\nimport { getEditor, getRenderer, 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 { PageView, store } from '@operato/shell'\nimport { CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { isMobileDevice, sleep } from '@operato/utils'\nimport { OxPopup } from '@operato/popup'\nimport { p13n } from '@operato/p13n'\n\n@customElement('attribute-set-management')\nexport class AttributeSetManagementPage 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 @state() gristConfig: any\n @state() 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.attributes'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n // help: 'system/attribute',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this.updateAttributeSet.bind(this),\n icon: 'save'\n },\n {\n title: i18next.t('button.delete'),\n action: this.deleteAttributeSet.bind(this),\n icon: 'delete',\n emphasis: {\n danger: true\n }\n }\n ],\n toolbar: false\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 ?url-params-sensitive=${this.active}\n >\n <div slot=\"headroom\" class=\"header\">\n <div class=\"title\">${i18next.t('title.attributes')}</div>\n\n <ox-context-page-toolbar class=\"actions\" .context=${this.context}> </ox-context-page-toolbar>\n </div>\n\n <ox-grist-personalizer slot=\"setting\"></ox-grist-personalizer>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle) {\n this.gristConfig = {\n list: {\n fields: ['entity', 'description']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'gutter',\n gutterName: 'button',\n title: i18next.t('title.attribute model'),\n icon: 'reorder',\n handlers: {\n click: (columns, data, column, record, rowIndex) => {\n if (!record.id) return\n const popup = openPopup(\n html` <attribute-set-item-list .attribute=${record}></attribute-set-item-list> `,\n {\n backdrop: true,\n help: 'attribute/ui/attribute-set-item-list',\n size: 'large',\n title: i18next.t('title.attribute-item list')\n }\n )\n popup.onclosed = () => {\n this.grist.fetch()\n }\n }\n }\n },\n {\n type: 'string',\n name: 'entity',\n header: i18next.t('field.entity'),\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: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_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 fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: attributeSets(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n entity\n description\n updatedAt\n items {\n name\n description\n tag\n active\n hidden\n type\n options\n }\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 private async deleteAttributeSet() {\n if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {\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 deleteAttributeSets(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 private async updateAttributeSet() {\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 if (patchField['reportTemplate'] instanceof FileList) {\n patchField['reportTemplate'] = patchField['reportTemplate'][0]\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [AttributeSetPatch!]!) {\n updateMultipleAttributeSet(patches: $patches) {\n entity\n }\n }\n `,\n variables: {\n patches\n },\n context: {\n hasUpload: true\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"attribute-set-management.js","sourceRoot":"","sources":["../../../client/pages/attribute/attribute-set-management.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,qBAAqB,CAAA;AAC5B,OAAO,6CAA6C,CAAA;AACpD,OAAO,8BAA8B,CAAA;AAErC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAY,KAAK,EAAE,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M,MAAM,CAAC,MAAM,CAAC,EAAU,QAAQ,EAAE,GAAG,CAAA;;;;SAIzD;gBACD,SAAS,EAAE,EAAY,OAAO;iBACpC;gBACM,OAAO,EAAE,EAAY,SAAS,EAAE,IAAI;iBAC1C;aACA,CAAC,CAAA;YAEG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;gBAAS,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;YACvD,CAAC;QACD,CAAC;IACD,CAAC;;AAtLS;IAAR,KAAK,EAAE;;+DAAiB;AAChB;IAAR,KAAK,EAAE;;wDAAoE;AAEjD;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;yDAAA;AAtBjC,0BAA0B;IADtC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,0BAA0B,CA0MtC","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport '@operato/data-grist'\nimport '@operato/context/ox-context-page-toolbar.js'\nimport './attribute-set-item-list.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { getEditor, getRenderer, 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 { PageView } from '@operato/shell'\nimport { CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { isMobileDevice, sleep } from '@operato/utils'\nimport { OxPopup } from '@operato/popup'\nimport { p13n } from '@operato/p13n'\n\n@customElement('attribute-set-management')\nexport class AttributeSetManagementPage extends p13n(localize(i18next)(PageView)) { static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n css`\n :host { 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 { overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n @state() gristConfig: any\n @state() mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() { return { title: i18next.t('title.attributes'),\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: 'system/attribute',\n actions: [\n { title: i18next.t('button.save'),\n action: this.updateAttributeSet.bind(this),\n icon: 'save'\n },\n { title: i18next.t('button.delete'),\n action: this.deleteAttributeSet.bind(this),\n icon: 'delete',\n emphasis: { danger: true\n }\n }\n ],\n toolbar: false\n }\n }\n\n render() { 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 ?url-params-sensitive=${this.active}\n >\n <div slot=\"headroom\" class=\"header\">\n <div class=\"title\">${i18next.t('title.attributes')}</div>\n\n <ox-context-page-toolbar class=\"actions\" .context=${this.context}> </ox-context-page-toolbar>\n </div>\n\n <ox-grist-personalizer slot=\"setting\"></ox-grist-personalizer>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle) { this.gristConfig = { list: { fields: ['entity', 'description']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n { type: 'gutter',\n gutterName: 'button',\n title: i18next.t('title.attribute model'),\n icon: 'reorder',\n handlers: { click: (columns, data, column, record, rowIndex) => { if (!record.id) return\n const popup = openPopup(\n html` <attribute-set-item-list .attribute=${record}></attribute-set-item-list> `,\n { backdrop: true,\n help: 'attribute/ui/attribute-set-item-list',\n size: 'large',\n title: i18next.t('title.attribute-item list')\n }\n )\n popup.onclosed = () => { this.grist.fetch()\n }\n }\n }\n },\n { type: 'string',\n name: 'entity',\n header: i18next.t('field.entity'),\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: '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 fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) { const response = await client.query({ query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: attributeSets(filters: $filters, pagination: $pagination, sortings: $sortings) { items { id\n entity\n description\n updatedAt\n items { name\n description\n tag\n active\n hidden\n type\n options\n }\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 private async deleteAttributeSet() { if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) { const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) { const response = await client.mutate({ mutation: gql`\n mutation ($ids: [String!]!) { deleteAttributeSets(ids: $ids)\n }\n `,\n variables: { ids\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n private async updateAttributeSet() { 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 if (patchField['reportTemplate'] instanceof FileList) { patchField['reportTemplate'] = patchField['reportTemplate'][0]\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({ mutation: gql`\n mutation ($patches: [AttributeSetPatch!]!) { updateMultipleAttributeSet(patches: $patches) { entity\n }\n }\n `,\n variables: { patches\n },\n context: { hasUpload: true\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n }\n }\n }\n}\n"]}
@@ -4,12 +4,6 @@ import '@operato/context/ox-context-page-toolbar.js';
4
4
  import { FetchOption } from '@operato/data-grist';
5
5
  import { PageView } from '@operato/shell';
6
6
  declare const AuthProviderManagementPage_base: (new (...args: any[]) => {
7
- _storeUnsubscribe: import("redux").Unsubscribe;
8
- connectedCallback(): void;
9
- disconnectedCallback(): void;
10
- stateChanged(_state: unknown): void;
11
- readonly isConnected: boolean;
12
- }) & (new (...args: any[]) => {
13
7
  __preferenceProviders: {
14
8
  [element: string]: import("@operato/p13n").PagePreferenceProvider;
15
9
  };