@things-factory/quotation 9.0.0-beta.8 → 9.0.0-beta.80

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.
@@ -13,6 +13,23 @@ import { i18next, localize } from '@operato/i18n';
13
13
  import { ScrollbarStyles } from '@operato/styles';
14
14
  // import { QuotationView } from '../components/quotation-edit.js'
15
15
  let ActivityQuotationView = class ActivityQuotationView extends localize(i18next)(LitElement) {
16
+ static { this.styles = [
17
+ ScrollbarStyles,
18
+ css `
19
+ :host {
20
+ display: flex;
21
+ flex-direction: column;
22
+
23
+ background-color: var(--md-sys-color-surface);
24
+ }
25
+
26
+ quotation-edit {
27
+ flex: 1;
28
+ padding: 10px;
29
+ overflow: auto;
30
+ }
31
+ `
32
+ ]; }
16
33
  // @query('quotation-edit') quotationView!: QuotationView
17
34
  render() {
18
35
  return html `
@@ -51,23 +68,6 @@ let ActivityQuotationView = class ActivityQuotationView extends localize(i18next
51
68
  }
52
69
  }
53
70
  };
54
- ActivityQuotationView.styles = [
55
- ScrollbarStyles,
56
- css `
57
- :host {
58
- display: flex;
59
- flex-direction: column;
60
-
61
- background-color: var(--md-sys-color-surface);
62
- }
63
-
64
- quotation-edit {
65
- flex: 1;
66
- padding: 10px;
67
- overflow: auto;
68
- }
69
- `
70
- ];
71
71
  __decorate([
72
72
  property({ type: Object }),
73
73
  __metadata("design:type", Object)
@@ -1 +1 @@
1
- {"version":3,"file":"activity-quotation-edit.js","sourceRoot":"","sources":["../../client/activities/activity-quotation-edit.ts"],"names":[],"mappings":"AAAA;;;;EAIE;;AAEF,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,EAAS,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,MAAM,EAAE,M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A3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAAa;AAE/B;IAAR,KAAK,EAAE;;wDAAgB;AAtBb,qBAAqB;IADjC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,qBAAqB,CAsEjC","sourcesContent":["/* \nAdd the following line to clinet/bootstrap.ts so that activity editor can be registered when loading a module.\n--\nimport './activities/quotation-edit.js' // refered by the activity template (activity-quotation) on server\n*/\n\nimport '../components/quotation-edit.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\n\n// import { QuotationView } from '../components/quotation-edit.js'\n\n@customElement('activity-quotation-edit')\nexport class ActivityQuotationView extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: var(--md-sys-color-surface);\n }\n\n quotation-edit {\n flex: 1;\n padding: 10px;\n overflow: auto;\n }\n `\n ]\n\n @property({ type: Object }) input?: any\n @property({ type: Object }) output?: any\n\n @state() quotation?: any //Quotation\n\n // @query('quotation-edit') quotationView!: QuotationView\n\n render() {\n return html`\n <quotation-edit .quotation=${this.quotation} .value=${this.output} @change=${this.onChange}></quotation-edit>\n `\n }\n\n async onChange() {\n // this.output = this.quotationView.value\n\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: this.output\n })\n )\n }\n\n updated(changes) {\n if (changes.has('input')) {\n this.fetchQuotation()\n }\n }\n\n async fetchQuotation() {\n const id = this.input.quotationId\n\n if (id) {\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n quotation(id: $id) {\n id\n name\n description\n }\n }\n `,\n variables: {\n id\n }\n })\n\n this.quotation = response.data.quotation\n }\n }\n}\n"]}
1
+ {"version":3,"file":"activity-quotation-edit.js","sourceRoot":"","sources":["../../client/activities/activity-quotation-edit.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CAAC;gBAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;SAQT;gBACD,SAAS,EAAE;oBACT,EAAE;iBACH;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAA;QAC1C,CAAC;IACH,CAAC;;AAlD2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAY;AACX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAAa;AAE/B;IAAR,KAAK,EAAE;;wDAAgB;AAtBb,qBAAqB;IADjC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,qBAAqB,CAsEjC","sourcesContent":["/* \nAdd the following line to clinet/bootstrap.ts so that activity editor can be registered when loading a module.\n--\nimport './activities/quotation-edit.js' // refered by the activity template (activity-quotation) on server\n*/\n\nimport '../components/quotation-edit.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\n\n// import { QuotationView } from '../components/quotation-edit.js'\n\n@customElement('activity-quotation-edit')\nexport class ActivityQuotationView extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: var(--md-sys-color-surface);\n }\n\n quotation-edit {\n flex: 1;\n padding: 10px;\n overflow: auto;\n }\n `\n ]\n\n @property({ type: Object }) input?: any\n @property({ type: Object }) output?: any\n\n @state() quotation?: any //Quotation\n\n // @query('quotation-edit') quotationView!: QuotationView\n\n render() {\n return html`\n <quotation-edit .quotation=${this.quotation} .value=${this.output} @change=${this.onChange}></quotation-edit>\n `\n }\n\n async onChange() {\n // this.output = this.quotationView.value\n\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: this.output\n })\n )\n }\n\n updated(changes) {\n if (changes.has('input')) {\n this.fetchQuotation()\n }\n }\n\n async fetchQuotation() {\n const id = this.input.quotationId\n\n if (id) {\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n quotation(id: $id) {\n id\n name\n description\n }\n }\n `,\n variables: {\n id\n }\n })\n\n this.quotation = response.data.quotation\n }\n }\n}\n"]}
@@ -13,6 +13,23 @@ import { i18next, localize } from '@operato/i18n';
13
13
  import { ScrollbarStyles } from '@operato/styles';
14
14
  // import { QuotationView } from '../components/quotation-view.js'
15
15
  let ActivityQuotationView = class ActivityQuotationView extends localize(i18next)(LitElement) {
16
+ static { this.styles = [
17
+ ScrollbarStyles,
18
+ css `
19
+ :host {
20
+ display: flex;
21
+ flex-direction: column;
22
+
23
+ background-color: var(--md-sys-color-surface);
24
+ }
25
+
26
+ quotation-view {
27
+ flex: 1;
28
+ padding: 10px;
29
+ overflow: auto;
30
+ }
31
+ `
32
+ ]; }
16
33
  // @query('quotation-view') quotationView!: QuotationView
17
34
  render() {
18
35
  return html `
@@ -51,23 +68,6 @@ let ActivityQuotationView = class ActivityQuotationView extends localize(i18next
51
68
  }
52
69
  }
53
70
  };
54
- ActivityQuotationView.styles = [
55
- ScrollbarStyles,
56
- css `
57
- :host {
58
- display: flex;
59
- flex-direction: column;
60
-
61
- background-color: var(--md-sys-color-surface);
62
- }
63
-
64
- quotation-view {
65
- flex: 1;
66
- padding: 10px;
67
- overflow: auto;
68
- }
69
- `
70
- ];
71
71
  __decorate([
72
72
  property({ type: Object }),
73
73
  __metadata("design:type", Object)
@@ -1 +1 @@
1
- {"version":3,"file":"activity-quotation-view.js","sourceRoot":"","sources":["../../client/activities/activity-quotation-view.ts"],"names":[],"mappings":"AAAA;;;;EAIE;;AAEF,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,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AE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAY;AACX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAAa;AAE/B;IAAR,KAAK,EAAE;;wDAAgB;AAtBb,qBAAqB;IADjC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,qBAAqB,CAsEjC","sourcesContent":["/* \nAdd the following line to clinet/bootstrap.ts so that activity view can be registered when loading a module.\n--\nimport './activities/quotation-view.js' // refered by the activity template (activity-data-collect) on server\n*/\n\nimport '../components/quotation-view.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\n\n// import { QuotationView } from '../components/quotation-view.js'\n\n@customElement('activity-quotation-view')\nexport class ActivityQuotationView extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: var(--md-sys-color-surface);\n }\n\n quotation-view {\n flex: 1;\n padding: 10px;\n overflow: auto;\n }\n `\n ]\n\n @property({ type: Object }) input?: any\n @property({ type: Object }) output?: any\n\n @state() quotation?: any //Quotation\n\n // @query('quotation-view') quotationView!: QuotationView\n\n render() {\n return html`\n <quotation-view .quotation=${this.quotation} .value=${this.output} @change=${this.onChange}></quotation-view>\n `\n }\n\n async onChange() {\n // this.output = this.quotationView.value\n\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: this.output\n })\n )\n }\n\n updated(changes) {\n if (changes.has('input')) {\n this.fetchQuotation()\n }\n }\n\n async fetchQuotation() {\n const id = this.input.quotationId\n\n if (id) {\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n quotation(id: $id) {\n id\n name\n description\n }\n }\n `,\n variables: {\n id\n }\n })\n\n this.quotation = response.data.quotation\n }\n }\n}\n"]}
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EAAE,EAAE,CAAC;YACP,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;gBAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;SAQT;gBACD,SAAS,EAAE;oBACT,EAAE;iBACH;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAA;QAC1C,CAAC;IACH,CAAC;;AAlD2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAY;AACX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAAa;AAE/B;IAAR,KAAK,EAAE;;wDAAgB;AAtBb,qBAAqB;IADjC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,qBAAqB,CAsEjC","sourcesContent":["/* \nAdd the following line to clinet/bootstrap.ts so that activity view can be registered when loading a module.\n--\nimport './activities/quotation-view.js' // refered by the activity template (activity-data-collect) on server\n*/\n\nimport '../components/quotation-view.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { ScrollbarStyles } from '@operato/styles'\n\n// import { QuotationView } from '../components/quotation-view.js'\n\n@customElement('activity-quotation-view')\nexport class ActivityQuotationView extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: var(--md-sys-color-surface);\n }\n\n quotation-view {\n flex: 1;\n padding: 10px;\n overflow: auto;\n }\n `\n ]\n\n @property({ type: Object }) input?: any\n @property({ type: Object }) output?: any\n\n @state() quotation?: any //Quotation\n\n // @query('quotation-view') quotationView!: QuotationView\n\n render() {\n return html`\n <quotation-view .quotation=${this.quotation} .value=${this.output} @change=${this.onChange}></quotation-view>\n `\n }\n\n async onChange() {\n // this.output = this.quotationView.value\n\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: this.output\n })\n )\n }\n\n updated(changes) {\n if (changes.has('input')) {\n this.fetchQuotation()\n }\n }\n\n async fetchQuotation() {\n const id = this.input.quotationId\n\n if (id) {\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n quotation(id: $id) {\n id\n name\n description\n }\n }\n `,\n variables: {\n id\n }\n })\n\n this.quotation = response.data.quotation\n }\n }\n}\n"]}
@@ -37,6 +37,21 @@ export class QuotationImporter extends LitElement {
37
37
  ]
38
38
  };
39
39
  }
40
+ static { this.styles = [
41
+ CommonHeaderStyles,
42
+ css `
43
+ :host {
44
+ display: flex;
45
+ flex-direction: column;
46
+
47
+ background-color: var(--md-sys-color-surface);
48
+ }
49
+
50
+ ox-grist {
51
+ flex: 1;
52
+ }
53
+ `
54
+ ]; }
40
55
  render() {
41
56
  return html `
42
57
  <ox-grist
@@ -54,7 +69,6 @@ export class QuotationImporter extends LitElement {
54
69
  `;
55
70
  }
56
71
  async save() {
57
- var _a;
58
72
  const response = await client.mutate({
59
73
  mutation: gql `
60
74
  mutation importQuotations($quotations: [QuotationPatch!]!) {
@@ -63,26 +77,11 @@ export class QuotationImporter extends LitElement {
63
77
  `,
64
78
  variables: { quotations: this.quotations }
65
79
  });
66
- if ((_a = response.errors) === null || _a === void 0 ? void 0 : _a.length)
80
+ if (response.errors?.length)
67
81
  return;
68
82
  this.dispatchEvent(new CustomEvent('imported'));
69
83
  }
70
84
  }
71
- QuotationImporter.styles = [
72
- CommonHeaderStyles,
73
- css `
74
- :host {
75
- display: flex;
76
- flex-direction: column;
77
-
78
- background-color: var(--md-sys-color-surface);
79
- }
80
-
81
- ox-grist {
82
- flex: 1;
83
- }
84
- `
85
- ];
86
85
  __decorate([
87
86
  property({ type: Array }),
88
87
  __metadata("design:type", Array)
@@ -1 +1 @@
1
- {"version":3,"file":"quotation-importer.js","sourceRoot":"","sources":["../../../client/pages/quotation/quotation-importer.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4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;gBACd;YACN,OAAO,EAAE,IAAI,CAAC,UAAU;SACzB;;;;;yBAKgB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,gCAAgC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC;;KAEhG,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI;;QACR,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;;;OAIZ;YACD,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE;SAC3C,CAAC,CAAA;QAEF,IAAI,MAAA,QAAQ,CAAC,MAAM,0CAAE,MAAM;YAAE,OAAM;QAEnC,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC,CAAA;IACjD,CAAC;;AAxEM,wBAAM,GAAG;IACd,kBAAkB;IAClB,GAAG,CAAA;;;;;;;;;;;KAWF;CACF,AAdY,CAcZ;AAE0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;qDAAuB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAuB1B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/data-grist'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { property } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { isMobileDevice } from '@operato/utils'\nimport { CommonHeaderStyles } from '@operato/styles'\n\nexport class QuotationImporter extends LitElement {\n static styles = [\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: var(--md-sys-color-surface);\n }\n\n ox-grist {\n flex: 1;\n }\n `\n ]\n\n @property({ type: Array }) quotations: any[] = []\n @property({ type: Object }) columns = {\n list: { fields: ['name', 'description'] },\n pagination: { infinite: true },\n columns: [\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n width: 150\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n width: 200\n },\n {\n type: 'checkbox',\n name: 'active',\n header: i18next.t('field.active'),\n width: 60\n }\n ]\n }\n\n render() {\n return html`\n <ox-grist\n .mode=${isMobileDevice() ? 'LIST' : 'GRID'}\n .config=${this.columns}\n .data=${{\n records: this.quotations\n }}\n ></ox-grist>\n\n <div class=\"footer\">\n <div filler></div>\n <button @click=${this.save.bind(this)} done><md-icon>save</md-icon>${i18next.t('button.save')}</button>\n </div>\n `\n }\n\n async save() {\n const response = await client.mutate({\n mutation: gql`\n mutation importQuotations($quotations: [QuotationPatch!]!) {\n importQuotations(quotations: $quotations)\n }\n `,\n variables: { quotations: this.quotations }\n })\n\n if (response.errors?.length) return\n\n this.dispatchEvent(new CustomEvent('imported'))\n }\n}\n"]}
1
+ {"version":3,"file":"quotation-importer.js","sourceRoot":"","sources":["../../../client/pages/quotation/quotation-importer.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,qBAAqB,CAAA;AAE5B,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEpD,MAAM,OAAO,iBAAkB,SAAQ,UAAU;IAAjD;;QAiB6B,eAAU,GAAU,EAAE,CAAA;QACrB,YAAO,GAAG;YACpC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE;YACzC,UAAU,EAA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A;IACjD,CAAC;;AAxD0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;qDAAuB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAuB1B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/data-grist'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { property } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { isMobileDevice } from '@operato/utils'\nimport { CommonHeaderStyles } from '@operato/styles'\n\nexport class QuotationImporter extends LitElement {\n static styles = [\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: var(--md-sys-color-surface);\n }\n\n ox-grist {\n flex: 1;\n }\n `\n ]\n\n @property({ type: Array }) quotations: any[] = []\n @property({ type: Object }) columns = {\n list: { fields: ['name', 'description'] },\n pagination: { infinite: true },\n columns: [\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n width: 150\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n width: 200\n },\n {\n type: 'checkbox',\n name: 'active',\n header: i18next.t('field.active'),\n width: 60\n }\n ]\n }\n\n render() {\n return html`\n <ox-grist\n .mode=${isMobileDevice() ? 'LIST' : 'GRID'}\n .config=${this.columns}\n .data=${{\n records: this.quotations\n }}\n ></ox-grist>\n\n <div class=\"footer\">\n <div filler></div>\n <button @click=${this.save.bind(this)} done><md-icon>save</md-icon>${i18next.t('button.save')}</button>\n </div>\n `\n }\n\n async save() {\n const response = await client.mutate({\n mutation: gql`\n mutation importQuotations($quotations: [QuotationPatch!]!) {\n importQuotations(quotations: $quotations)\n }\n `,\n variables: { quotations: this.quotations }\n })\n\n if (response.errors?.length) return\n\n this.dispatchEvent(new CustomEvent('imported'))\n }\n}\n"]}
@@ -18,20 +18,43 @@ let QuotationListPage = class QuotationListPage extends connect(store)(localize(
18
18
  super(...arguments);
19
19
  this.mode = isMobileDevice() ? 'CARD' : 'GRID';
20
20
  }
21
+ static { this.styles = [
22
+ ScrollbarStyles,
23
+ CommonGristStyles,
24
+ CommonHeaderStyles,
25
+ css `
26
+ :host {
27
+ display: flex;
28
+
29
+ width: 100%;
30
+
31
+ --grid-record-emphasized-background-color: #8b0000;
32
+ --grid-record-emphasized-color: #ff6b6b;
33
+ }
34
+
35
+ ox-grist {
36
+ overflow-y: auto;
37
+ flex: 1;
38
+ }
39
+
40
+ ox-filters-form {
41
+ flex: 1;
42
+ }
43
+ `
44
+ ]; }
21
45
  static get scopedElements() {
22
46
  return {
23
47
  'quotation-importer': QuotationImporter
24
48
  };
25
49
  }
26
50
  get context() {
27
- var _a;
28
51
  return {
29
52
  title: i18next.t('title.quotation list'),
30
53
  search: {
31
54
  handler: (search) => {
32
55
  this.grist.searchText = search;
33
56
  },
34
- value: ((_a = this.grist) === null || _a === void 0 ? void 0 : _a.searchText) || ''
57
+ value: this.grist?.searchText || ''
35
58
  },
36
59
  filter: {
37
60
  handler: () => {
@@ -40,8 +63,16 @@ let QuotationListPage = class QuotationListPage extends connect(store)(localize(
40
63
  },
41
64
  help: 'quotation/quotation',
42
65
  actions: [
43
- Object.assign({ title: i18next.t('button.save'), action: this._updateQuotation.bind(this) }, CommonButtonStyles.save),
44
- Object.assign({ title: i18next.t('button.delete'), action: this._deleteQuotation.bind(this) }, CommonButtonStyles.delete)
66
+ {
67
+ title: i18next.t('button.save'),
68
+ action: this._updateQuotation.bind(this),
69
+ ...CommonButtonStyles.save
70
+ },
71
+ {
72
+ title: i18next.t('button.delete'),
73
+ action: this._deleteQuotation.bind(this),
74
+ ...CommonButtonStyles.delete
75
+ }
45
76
  ],
46
77
  exportable: {
47
78
  name: i18next.t('title.quotation list'),
@@ -263,30 +294,6 @@ let QuotationListPage = class QuotationListPage extends connect(store)(localize(
263
294
  };
264
295
  }
265
296
  };
266
- QuotationListPage.styles = [
267
- ScrollbarStyles,
268
- CommonGristStyles,
269
- CommonHeaderStyles,
270
- css `
271
- :host {
272
- display: flex;
273
-
274
- width: 100%;
275
-
276
- --grid-record-emphasized-background-color: #8b0000;
277
- --grid-record-emphasized-color: #ff6b6b;
278
- }
279
-
280
- ox-grist {
281
- overflow-y: auto;
282
- flex: 1;
283
- }
284
-
285
- ox-filters-form {
286
- flex: 1;
287
- }
288
- `
289
- ];
290
297
  __decorate([
291
298
  property({ type: Object }),
292
299
  __metadata("design:type", Object)
@@ -1 +1 @@
1
- {"version":3,"file":"quotation-list-page.js","sourceRoot":"","sources":["../../../client/pages/quotation/quotation-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC5G,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,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,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAgB,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC1E,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,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAGjD,IAAM,iBAAiB,GAAvB,MAAM,iBAA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AAnCjC,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CA+S7B","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView, store } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { ColumnConfig, DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { connect } from 'pwa-helpers/connect-mixin'\nimport gql from 'graphql-tag'\n\nimport { QuotationImporter } from './quotation-importer'\n\n@customElement('quotation-list-page')\nexport class QuotationListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(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 ox-filters-form {\n flex: 1;\n }\n `\n ]\n\n static get scopedElements() {\n return {\n 'quotation-importer': QuotationImporter\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.quotation list'),\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: 'quotation/quotation',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateQuotation.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteQuotation.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: {\n name: i18next.t('title.quotation list'),\n data: this.exportHandler.bind(this)\n },\n importable: {\n handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form autofocus></ox-filters-form>\n\n <div id=\"modes\">\n <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>\n <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>\n <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>\n </div>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n list: {\n fields: ['name', 'description'],\n details: ['active', 'updatedAt']\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: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: {\n editable: true\n },\n filter: true,\n sortable: true,\n width: 60\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: {\n editable: false\n },\n sortable: true,\n width: 120\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 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: quotations(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n active\n updater {\n id\n name\n }\n updatedAt\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 _deleteQuotation() {\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 deleteQuotations(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 _updateQuotation() {\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: [QuotationPatch!]!) {\n updateMultipleQuotation(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 async exportHandler() {\n const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set(['id', 'name', 'description', 'active'])\n\n return exportTargets.map(quotation => {\n let tempObj = {}\n for (const field of targetFieldSet) {\n tempObj[field] = quotation[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) {\n const popup = openPopup(\n html`\n <quotation-importer\n .quotations=${records}\n @imported=${() => {\n history.back()\n this.grist.fetch()\n }}\n ></quotation-importer>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.import quotation')\n }\n )\n\n popup.onclosed = () => {\n this.grist.fetch()\n }\n }\n}\n"]}
1
+ {"version":3,"file":"quotation-list-page.js","sourceRoot":"","sources":["../../../client/pages/quotation/quotation-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC5G,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,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,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAgB,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC1E,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,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAGjD,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC,QAA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CA+S7B","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView, store } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { ColumnConfig, DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { connect } from 'pwa-helpers/connect-mixin'\nimport gql from 'graphql-tag'\n\nimport { QuotationImporter } from './quotation-importer'\n\n@customElement('quotation-list-page')\nexport class QuotationListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(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 ox-filters-form {\n flex: 1;\n }\n `\n ]\n\n static get scopedElements() {\n return {\n 'quotation-importer': QuotationImporter\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.quotation list'),\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: 'quotation/quotation',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this._updateQuotation.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this._deleteQuotation.bind(this),\n ...CommonButtonStyles.delete\n }\n ],\n exportable: {\n name: i18next.t('title.quotation list'),\n data: this.exportHandler.bind(this)\n },\n importable: {\n handler: this.importHandler.bind(this)\n }\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form autofocus></ox-filters-form>\n\n <div id=\"modes\">\n <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>\n <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>\n <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>\n </div>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n list: {\n fields: ['name', 'description'],\n details: ['active', 'updatedAt']\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: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: {\n editable: true\n },\n filter: true,\n sortable: true,\n width: 60\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: {\n editable: false\n },\n sortable: true,\n width: 120\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 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: quotations(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n active\n updater {\n id\n name\n }\n updatedAt\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 _deleteQuotation() {\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 deleteQuotations(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 _updateQuotation() {\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: [QuotationPatch!]!) {\n updateMultipleQuotation(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 async exportHandler() {\n const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set(['id', 'name', 'description', 'active'])\n\n return exportTargets.map(quotation => {\n let tempObj = {}\n for (const field of targetFieldSet) {\n tempObj[field] = quotation[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) {\n const popup = openPopup(\n html`\n <quotation-importer\n .quotations=${records}\n @imported=${() => {\n history.back()\n this.grist.fetch()\n }}\n ></quotation-importer>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.import quotation')\n }\n )\n\n popup.onclosed = () => {\n this.grist.fetch()\n }\n }\n}\n"]}
@@ -5,7 +5,7 @@ const INITIAL_STATE = {
5
5
  const quotation = (state = INITIAL_STATE, action) => {
6
6
  switch (action.type) {
7
7
  case UPDATE_QUOTATION:
8
- return Object.assign({}, state);
8
+ return { ...state };
9
9
  default:
10
10
  return state;
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../client/reducers/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElD,MAAM,aAAa,GAAG;IACpB,SAAS,EAAE,KAAK;CACjB,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,KAAK,GAAG,aAAa,EAAE,MAAM,EAAE,EAAE;IAClD,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,gBAAgB;YACnB,yBAAY,KAAK,EAAE;QAErB;YACE,OAAO,KAAK,CAAA;IAChB,CAAC;AACH,CAAC,CAAA;AAED,eAAe,SAAS,CAAA","sourcesContent":["import { UPDATE_QUOTATION } from '../actions/main'\n\nconst INITIAL_STATE = {\n quotation: 'ABC'\n}\n\nconst quotation = (state = INITIAL_STATE, action) => {\n switch (action.type) {\n case UPDATE_QUOTATION:\n return { ...state }\n\n default:\n return state\n }\n}\n\nexport default quotation\n"]}
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../client/reducers/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElD,MAAM,aAAa,GAAG;IACpB,SAAS,EAAE,KAAK;CACjB,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,KAAK,GAAG,aAAa,EAAE,MAAM,EAAE,EAAE;IAClD,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,gBAAgB;YACnB,OAAO,EAAE,GAAG,KAAK,EAAE,CAAA;QAErB;YACE,OAAO,KAAK,CAAA;IAChB,CAAC;AACH,CAAC,CAAA;AAED,eAAe,SAAS,CAAA","sourcesContent":["import { UPDATE_QUOTATION } from '../actions/main'\n\nconst INITIAL_STATE = {\n quotation: 'ABC'\n}\n\nconst quotation = (state = INITIAL_STATE, action) => {\n switch (action.type) {\n case UPDATE_QUOTATION:\n return { ...state }\n\n default:\n return state\n }\n}\n\nexport default quotation\n"]}