@operato/app 1.5.23 → 1.5.25

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 CHANGED
@@ -3,6 +3,24 @@
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.25](https://github.com/hatiolab/operato/compare/v1.5.24...v1.5.25) (2023-11-05)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * ox-input-permissoin => ox-input-privilege ([9a478f7](https://github.com/hatiolab/operato/commit/9a478f71f78e2c96509599967f24b55ff04c5244))
12
+
13
+
14
+
15
+ ### [1.5.24](https://github.com/hatiolab/operato/compare/v1.5.23...v1.5.24) (2023-11-05)
16
+
17
+
18
+ ### :bug: Bug Fix
19
+
20
+ * ox-input-permission and ox-grist-editor-permission ([3c36f61](https://github.com/hatiolab/operato/commit/3c36f617003fdccd5b38bb8f8f02fcdd4dff3f75))
21
+
22
+
23
+
6
24
  ### [1.5.23](https://github.com/hatiolab/operato/compare/v1.5.22...v1.5.23) (2023-11-05)
7
25
 
8
26
 
@@ -0,0 +1,8 @@
1
+ import './ox-popup-privilege-input.js';
2
+ import { OxGristEditor } from '@operato/data-grist';
3
+ export declare class OxGristEditorPrivilege extends OxGristEditor {
4
+ get editorTemplate(): import("lit-html").TemplateResult<1>;
5
+ _onclick(e: Event): void;
6
+ _onkeydown(e: KeyboardEvent): void;
7
+ showEditorPopup(): void;
8
+ }
@@ -0,0 +1,51 @@
1
+ import { __decorate } from "tslib";
2
+ import './ox-popup-privilege-input.js';
3
+ import { html } from 'lit';
4
+ import { customElement } from 'lit/decorators.js';
5
+ import { OxGristEditor } from '@operato/data-grist';
6
+ import { i18next } from '@operato/i18n';
7
+ import { openPopup } from '@operato/layout';
8
+ let OxGristEditorPrivilege = class OxGristEditorPrivilege extends OxGristEditor {
9
+ get editorTemplate() {
10
+ return html ` <div tabindex="0">...</div> `;
11
+ }
12
+ _onclick(e) {
13
+ e.stopPropagation();
14
+ this.showEditorPopup();
15
+ }
16
+ _onkeydown(e) {
17
+ const key = e.key;
18
+ if (key == 'Enter') {
19
+ e.stopPropagation();
20
+ this.showEditorPopup();
21
+ }
22
+ }
23
+ showEditorPopup() {
24
+ var change = (value) => {
25
+ this.dispatchEvent(new CustomEvent('field-change', {
26
+ bubbles: true,
27
+ composed: true,
28
+ detail: {
29
+ before: this.value,
30
+ after: value,
31
+ column: this.column,
32
+ record: this.record,
33
+ row: this.row
34
+ }
35
+ }));
36
+ };
37
+ var popup = openPopup(html `
38
+ <ox-popup-privilege-input .value=${this.value} .confirmCallback=${change.bind(this)}></ox-popup-privilege-input>
39
+ `, {
40
+ backdrop: true,
41
+ title: i18next.t('title.edit privilege'),
42
+ size: 'medium',
43
+ help: 'data-grist/grist-editor/privilege'
44
+ });
45
+ }
46
+ };
47
+ OxGristEditorPrivilege = __decorate([
48
+ customElement('ox-grist-editor-privilege')
49
+ ], OxGristEditorPrivilege);
50
+ export { OxGristEditorPrivilege };
51
+ //# sourceMappingURL=ox-grist-editor-privilege.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-grist-editor-privilege.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-grist-editor-privilege.ts"],"names":[],"mappings":";AAAA,OAAO,+BAA+B,CAAA;AAEtC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAGpC,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,aAAa;IACvD,IAAI,cAAc;QAChB,OAAO,IAAI,CAAA,+BAA+B,CAAA;IAC5C,CAAC;IAED,QAAQ,CAAC,CAAQ;QACf,CAAC,CAAC,eAAe,EAAE,CAAA;QACnB,IAAI,CAAC,eAAe,EAAE,CAAA;IACxB,CAAC;IAED,UAAU,CAAC,CAAgB;QACzB,MAAM,GAAG,GAAG,CAAC,CAAC,GAAG,CAAA;QACjB,IAAI,GAAG,IAAI,OAAO,EAAE;YAClB,CAAC,CAAC,eAAe,EAAE,CAAA;YACnB,IAAI,CAAC,eAAe,EAAE,CAAA;SACvB;IACH,CAAC;IAED,eAAe;QACb,IAAI,MAAM,GAAG,CAAC,KAAa,EAAE,EAAE;YAC7B,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,cAAc,EAAE;gBAC9B,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE;oBACN,MAAM,EAAE,IAAI,CAAC,KAAK;oBAClB,KAAK,EAAE,KAAK;oBACZ,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,GAAG,EAAE,IAAI,CAAC,GAAG;iBACd;aACF,CAAC,CACH,CAAA;QACH,CAAC,CAAA;QAED,IAAI,KAAK,GAAG,SAAS,CACnB,IAAI,CAAA;2CACiC,IAAI,CAAC,KAAK,qBAAqB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;OACpF,EACD;YACE,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAAC;YACxC,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,mCAAmC;SAC1C,CACF,CAAA;IACH,CAAC;CACF,CAAA;AA/CY,sBAAsB;IADlC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,sBAAsB,CA+ClC","sourcesContent":["import './ox-popup-privilege-input.js'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxGristEditor } from '@operato/data-grist'\nimport { i18next } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\n\n@customElement('ox-grist-editor-privilege')\nexport class OxGristEditorPrivilege extends OxGristEditor {\n get editorTemplate() {\n return html` <div tabindex=\"0\">...</div> `\n }\n\n _onclick(e: Event): void {\n e.stopPropagation()\n this.showEditorPopup()\n }\n\n _onkeydown(e: KeyboardEvent): void {\n const key = e.key\n if (key == 'Enter') {\n e.stopPropagation()\n this.showEditorPopup()\n }\n }\n\n showEditorPopup() {\n var change = (value: string) => {\n this.dispatchEvent(\n new CustomEvent('field-change', {\n bubbles: true,\n composed: true,\n detail: {\n before: this.value,\n after: value,\n column: this.column,\n record: this.record,\n row: this.row\n }\n })\n )\n }\n\n var popup = openPopup(\n html`\n <ox-popup-privilege-input .value=${this.value} .confirmCallback=${change.bind(this)}></ox-popup-privilege-input>\n `,\n {\n backdrop: true,\n title: i18next.t('title.edit privilege'),\n size: 'medium',\n help: 'data-grist/grist-editor/privilege'\n }\n )\n }\n}\n"]}
@@ -17,6 +17,7 @@ export declare class OxPopupPermissionInput extends LitElement {
17
17
  render(): import("lit-html").TemplateResult<1>;
18
18
  firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): Promise<void>;
19
19
  private onChange;
20
+ private onReset;
20
21
  private onCancel;
21
22
  private onConfirm;
22
23
  }
@@ -18,6 +18,8 @@ let OxPopupPermissionInput = class OxPopupPermissionInput extends LitElement {
18
18
  </ox-input-permission>
19
19
 
20
20
  <div class="button-container">
21
+ <mwc-button @click=${this.onReset.bind(this)}>${i18next.t('button.reset')}</mwc-button>
22
+ <div padding></div>
21
23
  <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
22
24
  <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
23
25
  </div>
@@ -31,6 +33,7 @@ let OxPopupPermissionInput = class OxPopupPermissionInput extends LitElement {
31
33
  items {
32
34
  name
33
35
  category
36
+ description
34
37
  }
35
38
  total
36
39
  }
@@ -43,6 +46,9 @@ let OxPopupPermissionInput = class OxPopupPermissionInput extends LitElement {
43
46
  e.stopPropagation();
44
47
  this.value = e.detail;
45
48
  }
49
+ onReset(e) {
50
+ this.value = null;
51
+ }
46
52
  onCancel(e) {
47
53
  closePopup(this);
48
54
  }
@@ -71,7 +77,11 @@ OxPopupPermissionInput.styles = [
71
77
 
72
78
  .button-container {
73
79
  display: flex;
74
- margin-left: auto;
80
+ flex-direction: row;
81
+ }
82
+
83
+ div[padding] {
84
+ flex: 1;
75
85
  }
76
86
  `
77
87
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"ox-popup-permission-input.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-popup-permission-input.ts"],"names":[],"mappings":";AAAA,OAAO,uCAAuC,CAAA;AAE9C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAoB,MAAM,KAAK,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAGlC,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,UAAU;IAA/C;;QA8BI,eAAU,GAA8D,EAAE,CAAA;IA8CrF,CAAC;IA5CC,MAAM;QACJ,OAAO,IAAI,CAAA;oCACqB,IAAI,CAAC,KAAK,gBAAgB,IAAI,CAAC,UAAU,YAAY,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;;;;6BAIpF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;6BACtD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC;;KAEhF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,kBAAqE;QACtF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;YAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;OAUT;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAA;IAClD,CAAC;IAEO,QAAQ,CAAC,CAAc;QAC7B,CAAC,CAAC,eAAe,EAAE,CAAA;QAEnB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,MAAM,CAAA;IACvB,CAAC;IAEO,QAAQ,CAAC,CAAQ;QACvB,UAAU,CAAC,IAAI,CAAC,CAAA;IAClB,CAAC;IAEO,SAAS,CAAC,CAAQ;QACxB,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACxD,UAAU,CAAC,IAAI,CAAC,CAAA;IAClB,CAAC;;AA1EM,6BAAM,GAAG;IACd,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;KAoBF;CACF,AAvBY,CAuBZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAuF;AAEtF;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+DAAwC;AAE1D;IAAR,KAAK,EAAE;0DAA2E;AA9BxE,sBAAsB;IADlC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,sBAAsB,CA4ElC","sourcesContent":["import '@operato/input/ox-input-permission.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement, PropertyValueMap } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\nimport { closePopup } from '@operato/popup'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { client } from '@operato/graphql'\n\n@customElement('ox-popup-permission-input')\nexport class OxPopupPermissionInput extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n\n width: var(--overlay-center-normal-width, 50%);\n height: var(--overlay-center-normal-height, 50%);\n }\n\n ox-input-permission {\n flex: 1;\n overflow-y: auto;\n }\n\n .button-container {\n display: flex;\n margin-left: auto;\n }\n `\n ]\n\n @property({ type: Object }) value?: { category: string; privilege: string; owner: boolean; super: boolean } | null\n\n @property({ type: Object }) confirmCallback!: (newval: any) => void\n\n @state() privileges: { name: string; category: string; description: string }[] = []\n\n render() {\n return html`\n <ox-input-permission .value=${this.value} .privileges=${this.privileges} @change=${this.onChange.bind(this)}>\n </ox-input-permission>\n\n <div class=\"button-container\">\n <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>\n <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>\n </div>\n `\n }\n\n async firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): Promise<void> {\n const response = await client.query({\n query: gql`\n query privileges {\n privileges {\n items {\n name\n category\n }\n total\n }\n }\n `\n })\n\n this.privileges = response.data.privileges.items\n }\n\n private onChange(e: CustomEvent) {\n e.stopPropagation()\n\n this.value = e.detail\n }\n\n private onCancel(e: Event) {\n closePopup(this)\n }\n\n private onConfirm(e: Event) {\n this.confirmCallback && this.confirmCallback(this.value)\n closePopup(this)\n }\n}\n"]}
1
+ {"version":3,"file":"ox-popup-permission-input.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-popup-permission-input.ts"],"names":[],"mappings":";AAAA,OAAO,uCAAuC,CAAA;AAE9C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAoB,MAAM,KAAK,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,QA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;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;IACnB,CAAC;IAEO,QAAQ,CAAC,CAAQ;QACvB,UAAU,CAAC,IAAI,CAAC,CAAA;IAClB,CAAC;IAEO,SAAS,CAAC,CAAQ;QACxB,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACxD,UAAU,CAAC,IAAI,CAAC,CAAA;IAClB,CAAC;;AArFM,6BAAM,GAAG;IACd,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;KAwBF;CACF,AA3BY,CA2BZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAuF;AAEtF;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+DAAwC;AAE1D;IAAR,KAAK,EAAE;0DAA2E;AAlCxE,sBAAsB;IADlC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,sBAAsB,CAuFlC","sourcesContent":["import '@operato/input/ox-input-permission.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement, PropertyValueMap } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\nimport { closePopup } from '@operato/popup'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { client } from '@operato/graphql'\n\n@customElement('ox-popup-permission-input')\nexport class OxPopupPermissionInput extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n\n width: var(--overlay-center-normal-width, 50%);\n height: var(--overlay-center-normal-height, 50%);\n }\n\n ox-input-permission {\n flex: 1;\n overflow-y: auto;\n }\n\n .button-container {\n display: flex;\n flex-direction: row;\n }\n\n div[padding] {\n flex: 1;\n }\n `\n ]\n\n @property({ type: Object }) value?: { category: string; privilege: string; owner: boolean; super: boolean } | null\n\n @property({ type: Object }) confirmCallback!: (newval: any) => void\n\n @state() privileges: { name: string; category: string; description: string }[] = []\n\n render() {\n return html`\n <ox-input-permission .value=${this.value} .privileges=${this.privileges} @change=${this.onChange.bind(this)}>\n </ox-input-permission>\n\n <div class=\"button-container\">\n <mwc-button @click=${this.onReset.bind(this)}>${i18next.t('button.reset')}</mwc-button>\n <div padding></div>\n <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>\n <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>\n </div>\n `\n }\n\n async firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): Promise<void> {\n const response = await client.query({\n query: gql`\n query privileges {\n privileges {\n items {\n name\n category\n description\n }\n total\n }\n }\n `\n })\n\n this.privileges = response.data.privileges.items\n }\n\n private onChange(e: CustomEvent) {\n e.stopPropagation()\n\n this.value = e.detail\n }\n\n private onReset(e: Event) {\n this.value = null\n }\n\n private onCancel(e: Event) {\n closePopup(this)\n }\n\n private onConfirm(e: Event) {\n this.confirmCallback && this.confirmCallback(this.value)\n closePopup(this)\n }\n}\n"]}
@@ -0,0 +1,23 @@
1
+ import '@operato/input/ox-input-privilege.js';
2
+ import { LitElement, PropertyValueMap } from 'lit';
3
+ export declare class OxPopupPrivilegeInput extends LitElement {
4
+ static styles: import("lit").CSSResult[];
5
+ value?: {
6
+ category: string;
7
+ privilege: string;
8
+ owner: boolean;
9
+ super: boolean;
10
+ } | null;
11
+ confirmCallback: (newval: any) => void;
12
+ privileges: {
13
+ name: string;
14
+ category: string;
15
+ description: string;
16
+ }[];
17
+ render(): import("lit-html").TemplateResult<1>;
18
+ firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): Promise<void>;
19
+ private onChange;
20
+ private onReset;
21
+ private onCancel;
22
+ private onConfirm;
23
+ }
@@ -0,0 +1,101 @@
1
+ import { __decorate } from "tslib";
2
+ import '@operato/input/ox-input-privilege.js';
3
+ import gql from 'graphql-tag';
4
+ import { css, html, LitElement } from 'lit';
5
+ import { customElement, property, state } from 'lit/decorators.js';
6
+ import { i18next } from '@operato/i18n';
7
+ import { closePopup } from '@operato/popup';
8
+ import { ScrollbarStyles } from '@operato/styles';
9
+ import { client } from '@operato/graphql';
10
+ let OxPopupPrivilegeInput = class OxPopupPrivilegeInput extends LitElement {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.privileges = [];
14
+ }
15
+ render() {
16
+ return html `
17
+ <ox-input-privilege .value=${this.value} .privileges=${this.privileges} @change=${this.onChange.bind(this)}>
18
+ </ox-input-privilege>
19
+
20
+ <div class="button-container">
21
+ <mwc-button @click=${this.onReset.bind(this)}>${i18next.t('button.reset')}</mwc-button>
22
+ <div padding></div>
23
+ <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
24
+ <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
25
+ </div>
26
+ `;
27
+ }
28
+ async firstUpdated(_changedProperties) {
29
+ const response = await client.query({
30
+ query: gql `
31
+ query privileges {
32
+ privileges {
33
+ items {
34
+ name
35
+ category
36
+ description
37
+ }
38
+ total
39
+ }
40
+ }
41
+ `
42
+ });
43
+ this.privileges = response.data.privileges.items;
44
+ }
45
+ onChange(e) {
46
+ e.stopPropagation();
47
+ this.value = e.detail;
48
+ }
49
+ onReset(e) {
50
+ this.value = null;
51
+ }
52
+ onCancel(e) {
53
+ closePopup(this);
54
+ }
55
+ onConfirm(e) {
56
+ this.confirmCallback && this.confirmCallback(this.value);
57
+ closePopup(this);
58
+ }
59
+ };
60
+ OxPopupPrivilegeInput.styles = [
61
+ ScrollbarStyles,
62
+ css `
63
+ :host {
64
+ display: flex;
65
+ flex-direction: column;
66
+
67
+ background-color: #fff;
68
+
69
+ width: var(--overlay-center-normal-width, 50%);
70
+ height: var(--overlay-center-normal-height, 50%);
71
+ }
72
+
73
+ ox-input-privilege {
74
+ flex: 1;
75
+ overflow-y: auto;
76
+ }
77
+
78
+ .button-container {
79
+ display: flex;
80
+ flex-direction: row;
81
+ }
82
+
83
+ div[padding] {
84
+ flex: 1;
85
+ }
86
+ `
87
+ ];
88
+ __decorate([
89
+ property({ type: Object })
90
+ ], OxPopupPrivilegeInput.prototype, "value", void 0);
91
+ __decorate([
92
+ property({ type: Object })
93
+ ], OxPopupPrivilegeInput.prototype, "confirmCallback", void 0);
94
+ __decorate([
95
+ state()
96
+ ], OxPopupPrivilegeInput.prototype, "privileges", void 0);
97
+ OxPopupPrivilegeInput = __decorate([
98
+ customElement('ox-popup-privilege-input')
99
+ ], OxPopupPrivilegeInput);
100
+ export { OxPopupPrivilegeInput };
101
+ //# sourceMappingURL=ox-popup-privilege-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-popup-privilege-input.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-popup-privilege-input.ts"],"names":[],"mappings":";AAAA,OAAO,sCAAsC,CAAA;AAE7C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAoB,MAAM,KAAK,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAGlC,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU;IAA9C;;QAkCI,eAAU,GAA8D,EAAE,CAAA;IAqDrF,CAAC;IAnDC,MAAM;QACJ,OAAO,IAAI,CAAA;mCACoB,IAAI,CAAC,KAAK,gBAAgB,IAAI,CAAC,UAAU,YAAY,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;;;;6BAIn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AAM,EAAE,CAAC;8DAAwC;AAE1D;IAAR,KAAK,EAAE;yDAA2E;AAlCxE,qBAAqB;IADjC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,qBAAqB,CAuFjC","sourcesContent":["import '@operato/input/ox-input-privilege.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement, PropertyValueMap } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\nimport { closePopup } from '@operato/popup'\nimport { ScrollbarStyles } from '@operato/styles'\nimport { client } from '@operato/graphql'\n\n@customElement('ox-popup-privilege-input')\nexport class OxPopupPrivilegeInput extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n\n width: var(--overlay-center-normal-width, 50%);\n height: var(--overlay-center-normal-height, 50%);\n }\n\n ox-input-privilege {\n flex: 1;\n overflow-y: auto;\n }\n\n .button-container {\n display: flex;\n flex-direction: row;\n }\n\n div[padding] {\n flex: 1;\n }\n `\n ]\n\n @property({ type: Object }) value?: { category: string; privilege: string; owner: boolean; super: boolean } | null\n\n @property({ type: Object }) confirmCallback!: (newval: any) => void\n\n @state() privileges: { name: string; category: string; description: string }[] = []\n\n render() {\n return html`\n <ox-input-privilege .value=${this.value} .privileges=${this.privileges} @change=${this.onChange.bind(this)}>\n </ox-input-privilege>\n\n <div class=\"button-container\">\n <mwc-button @click=${this.onReset.bind(this)}>${i18next.t('button.reset')}</mwc-button>\n <div padding></div>\n <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>\n <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>\n </div>\n `\n }\n\n async firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): Promise<void> {\n const response = await client.query({\n query: gql`\n query privileges {\n privileges {\n items {\n name\n category\n description\n }\n total\n }\n }\n `\n })\n\n this.privileges = response.data.privileges.items\n }\n\n private onChange(e: CustomEvent) {\n e.stopPropagation()\n\n this.value = e.detail\n }\n\n private onReset(e: Event) {\n this.value = null\n }\n\n private onCancel(e: Event) {\n closePopup(this)\n }\n\n private onConfirm(e: Event) {\n this.confirmCallback && this.confirmCallback(this.value)\n closePopup(this)\n }\n}\n"]}