@operato/data-grist 1.5.17 → 1.5.19

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,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ### [1.5.19](https://github.com/hatiolab/operato/compare/v1.5.18...v1.5.19) (2023-11-03)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * add textarea input ([eae0449](https://github.com/hatiolab/operato/commit/eae0449d7b3aeb629d2370a0afa83d5ef98aba55))
12
+
13
+
14
+
6
15
  ### [1.5.17](https://github.com/hatiolab/operato/compare/v1.5.16...v1.5.17) (2023-11-01)
7
16
 
8
17
 
@@ -0,0 +1,5 @@
1
+ import '@operato/input/ox-input-textarea.js';
2
+ import { OxGristEditor } from './ox-grist-editor.js';
3
+ export declare class OxGristEditorTextarea extends OxGristEditor {
4
+ get editorTemplate(): import("lit-html").TemplateResult<1>;
5
+ }
@@ -0,0 +1,15 @@
1
+ import { __decorate } from "tslib";
2
+ import '@operato/input/ox-input-textarea.js';
3
+ import { OxGristEditor } from './ox-grist-editor.js';
4
+ import { customElement } from 'lit/decorators.js';
5
+ import { html } from 'lit';
6
+ let OxGristEditorTextarea = class OxGristEditorTextarea extends OxGristEditor {
7
+ get editorTemplate() {
8
+ return html ` <ox-input-textarea .value=${this.value}></ox-input-textarea> `;
9
+ }
10
+ };
11
+ OxGristEditorTextarea = __decorate([
12
+ customElement('ox-grist-editor-textarea')
13
+ ], OxGristEditorTextarea);
14
+ export { OxGristEditorTextarea };
15
+ //# sourceMappingURL=ox-grist-editor-textarea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-grist-editor-textarea.js","sourceRoot":"","sources":["../../../src/editors/ox-grist-editor-textarea.ts"],"names":[],"mappings":";AAAA,OAAO,qCAAqC,CAAA;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAGnB,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,aAAa;IACtD,IAAI,cAAc;QAChB,OAAO,IAAI,CAAA,8BAA8B,IAAI,CAAC,KAAK,wBAAwB,CAAA;IAC7E,CAAC;CACF,CAAA;AAJY,qBAAqB;IADjC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,qBAAqB,CAIjC","sourcesContent":["import '@operato/input/ox-input-textarea.js'\n\nimport { OxGristEditor } from './ox-grist-editor.js'\nimport { customElement } from 'lit/decorators.js'\nimport { html } from 'lit'\n\n@customElement('ox-grist-editor-textarea')\nexport class OxGristEditorTextarea extends OxGristEditor {\n get editorTemplate() {\n return html` <ox-input-textarea .value=${this.value}></ox-input-textarea> `\n }\n}\n"]}
@@ -11,11 +11,13 @@ import { OxGristEditorPassword } from './ox-grist-editor-password';
11
11
  import { OxGristEditorSelect } from './ox-grist-editor-select';
12
12
  import { OxGristEditorTel } from './ox-grist-editor-tel';
13
13
  import { OxGristEditorText } from './ox-grist-editor-text';
14
+ import { OxGristEditorTextarea } from './ox-grist-editor-textarea';
14
15
  import { OxGristEditorTime } from './ox-grist-editor-time';
15
16
  import { OxGristEditorWeek } from './ox-grist-editor-week';
16
17
  var EDITORS = {
17
18
  string: OxGristEditorText,
18
19
  text: OxGristEditorText,
20
+ textarea: OxGristEditorTextarea,
19
21
  email: OxGristEditorEmail,
20
22
  tel: OxGristEditorTel,
21
23
  password: OxGristEditorPassword,
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/editors/registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,E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IACvB,KAAK,EAAE,kBAAkB;IACzB,IAAI,EAAE,iBAAiB;CACxB,CAAA;AAED,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,MAAiC;IAC5E,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAA;AACxB,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,OAAO,OAAO,CAAC,IAAI,CAAC,CAAA;AACtB,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,EAAE,GAAG,OAAO,EAAE,CAAA;AACvB,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,IAAI,OAAO,IAAI,IAAI,UAAU,EAAE;QAC7B,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,UAAU,KAAU,EAAE,MAAoB,EAAE,MAAmB,EAAE,QAAgB,EAAE,KAAoB;QAC5G,IAAI,KAAK,GAAG,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,iBAAiB,CAAA;QAExD,IAAI,OAAO,GAAG,IAAI,KAAK,EAAE,CAAA;QAEzB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;QACrB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAA;QACvB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAA;QACvB,OAAO,CAAC,GAAG,GAAG,QAAQ,CAAA;QACtB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;QAErB,OAAO,OAAO,CAAA;IAChB,CAAC,CAAA;AACH,CAAC","sourcesContent":["import { DataGridField } from '../data-grid/data-grid-field'\nimport { ColumnConfig, FieldEditor, GristRecord } from '../types'\nimport { OxGristEditor } from './ox-grist-editor'\nimport { OxGristEditorCheckbox } from './ox-grist-editor-checkbox'\nimport { OxGristEditorColor } from './ox-grist-editor-color'\nimport { OxGristEditorDate } from './ox-grist-editor-date'\nimport { OxGristEditorDateTime } from './ox-grist-editor-datetime'\nimport { OxGristEditorEmail } from './ox-grist-editor-email'\nimport { OxGristEditorFile } from './ox-grist-editor-file'\nimport { OxGristEditorImage } from './ox-grist-editor-image'\nimport { OxGristEditorMonth } from './ox-grist-editor-month'\nimport { OxGristEditorNumber } from './ox-grist-editor-number'\nimport { OxGristEditorPassword } from './ox-grist-editor-password'\nimport { OxGristEditorSelect } from './ox-grist-editor-select'\nimport { OxGristEditorTel } from './ox-grist-editor-tel'\nimport { OxGristEditorText } from './ox-grist-editor-text'\nimport { OxGristEditorTime } from './ox-grist-editor-time'\nimport { OxGristEditorWeek } from './ox-grist-editor-week'\n\nvar EDITORS: { [name: string]: { new (): OxGristEditor } } = {\n string: OxGristEditorText,\n text: OxGristEditorText,\n email: OxGristEditorEmail,\n tel: OxGristEditorTel,\n password: OxGristEditorPassword,\n integer: OxGristEditorNumber,\n float: OxGristEditorNumber,\n number: OxGristEditorNumber,\n select: OxGristEditorSelect,\n boolean: OxGristEditorCheckbox,\n checkbox: OxGristEditorCheckbox,\n month: OxGristEditorMonth,\n week: OxGristEditorWeek,\n date: OxGristEditorDate,\n time: OxGristEditorTime,\n datetime: OxGristEditorDateTime,\n color: OxGristEditorColor,\n progress: OxGristEditorNumber,\n link: OxGristEditorText,\n image: OxGristEditorImage,\n file: OxGristEditorFile\n}\n\nexport function registerEditor(type: string, editor: { new (): OxGristEditor }) {\n EDITORS[type] = editor\n}\n\nexport function unregisterEditor(type: string) {\n delete EDITORS[type]\n}\n\nexport function getEditors(): { [name: string]: { new (): OxGristEditor } } {\n return { ...EDITORS }\n}\n\nexport function getEditor(type: string): FieldEditor {\n if (typeof type == 'function') {\n return type\n }\n\n return function (value: any, column: ColumnConfig, record: GristRecord, rowIndex: number, field: DataGridField) {\n var clazz = EDITORS[type || 'text'] || OxGristEditorText\n\n var element = new clazz()\n\n element.value = value\n element.record = record\n element.column = column\n element.row = rowIndex\n element.field = field\n\n return element\n }\n}\n"]}
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/editors/registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,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AE,iBAAiB;IACvB,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,iBAAiB;IACvB,QAAQ,EAAE,qBAAqB;IAC/B,KAAK,EAAE,kBAAkB;IACzB,QAAQ,EAAE,mBAAmB;IAC7B,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,kBAAkB;IACzB,IAAI,EAAE,iBAAiB;CACxB,CAAA;AAED,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,MAAiC;IAC5E,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAA;AACxB,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,OAAO,OAAO,CAAC,IAAI,CAAC,CAAA;AACtB,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,EAAE,GAAG,OAAO,EAAE,CAAA;AACvB,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,IAAI,OAAO,IAAI,IAAI,UAAU,EAAE;QAC7B,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,UAAU,KAAU,EAAE,MAAoB,EAAE,MAAmB,EAAE,QAAgB,EAAE,KAAoB;QAC5G,IAAI,KAAK,GAAG,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,iBAAiB,CAAA;QAExD,IAAI,OAAO,GAAG,IAAI,KAAK,EAAE,CAAA;QAEzB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;QACrB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAA;QACvB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAA;QACvB,OAAO,CAAC,GAAG,GAAG,QAAQ,CAAA;QACtB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;QAErB,OAAO,OAAO,CAAA;IAChB,CAAC,CAAA;AACH,CAAC","sourcesContent":["import { DataGridField } from '../data-grid/data-grid-field'\nimport { ColumnConfig, FieldEditor, GristRecord } from '../types'\nimport { OxGristEditor } from './ox-grist-editor'\nimport { OxGristEditorCheckbox } from './ox-grist-editor-checkbox'\nimport { OxGristEditorColor } from './ox-grist-editor-color'\nimport { OxGristEditorDate } from './ox-grist-editor-date'\nimport { OxGristEditorDateTime } from './ox-grist-editor-datetime'\nimport { OxGristEditorEmail } from './ox-grist-editor-email'\nimport { OxGristEditorFile } from './ox-grist-editor-file'\nimport { OxGristEditorImage } from './ox-grist-editor-image'\nimport { OxGristEditorMonth } from './ox-grist-editor-month'\nimport { OxGristEditorNumber } from './ox-grist-editor-number'\nimport { OxGristEditorPassword } from './ox-grist-editor-password'\nimport { OxGristEditorSelect } from './ox-grist-editor-select'\nimport { OxGristEditorTel } from './ox-grist-editor-tel'\nimport { OxGristEditorText } from './ox-grist-editor-text'\nimport { OxGristEditorTextarea } from './ox-grist-editor-textarea'\nimport { OxGristEditorTime } from './ox-grist-editor-time'\nimport { OxGristEditorWeek } from './ox-grist-editor-week'\n\nvar EDITORS: { [name: string]: { new (): OxGristEditor } } = {\n string: OxGristEditorText,\n text: OxGristEditorText,\n textarea: OxGristEditorTextarea,\n email: OxGristEditorEmail,\n tel: OxGristEditorTel,\n password: OxGristEditorPassword,\n integer: OxGristEditorNumber,\n float: OxGristEditorNumber,\n number: OxGristEditorNumber,\n select: OxGristEditorSelect,\n boolean: OxGristEditorCheckbox,\n checkbox: OxGristEditorCheckbox,\n month: OxGristEditorMonth,\n week: OxGristEditorWeek,\n date: OxGristEditorDate,\n time: OxGristEditorTime,\n datetime: OxGristEditorDateTime,\n color: OxGristEditorColor,\n progress: OxGristEditorNumber,\n link: OxGristEditorText,\n image: OxGristEditorImage,\n file: OxGristEditorFile\n}\n\nexport function registerEditor(type: string, editor: { new (): OxGristEditor }) {\n EDITORS[type] = editor\n}\n\nexport function unregisterEditor(type: string) {\n delete EDITORS[type]\n}\n\nexport function getEditors(): { [name: string]: { new (): OxGristEditor } } {\n return { ...EDITORS }\n}\n\nexport function getEditor(type: string): FieldEditor {\n if (typeof type == 'function') {\n return type\n }\n\n return function (value: any, column: ColumnConfig, record: GristRecord, rowIndex: number, field: DataGridField) {\n var clazz = EDITORS[type || 'text'] || OxGristEditorText\n\n var element = new clazz()\n\n element.value = value\n element.record = record\n element.column = column\n element.row = rowIndex\n element.field = field\n\n return element\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import { FieldRenderer } from '../types';
2
+ export declare const OxGristRendererText: FieldRenderer;
@@ -0,0 +1,21 @@
1
+ import { html } from 'lit';
2
+ import { detectOverflow, format as formatter } from '@operato/utils';
3
+ function onmouseover(e) {
4
+ const element = e.target;
5
+ if (detectOverflow(element)) {
6
+ element.setAttribute('data-tooltip', element.textContent);
7
+ }
8
+ }
9
+ function onmouseout(e) {
10
+ const element = e.target;
11
+ element.removeAttribute('data-tooltip');
12
+ }
13
+ export const OxGristRendererText = (value, column, record, rowIndex, field) => {
14
+ var { format } = column.record || {};
15
+ var text = value == null ? '' : value;
16
+ if (format) {
17
+ text = formatter(format, text);
18
+ }
19
+ return html `<span @mouseover=${onmouseover} @mouseout=${onmouseout}>${text}&nbsp;</span>`;
20
+ };
21
+ //# sourceMappingURL=ox-grist-renderer-text%20copy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-grist-renderer-text copy.js","sourceRoot":"","sources":["../../../src/renderers/ox-grist-renderer-text copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAIpE,SAAS,WAAW,CAAC,CAAQ;IAC3B,MAAM,OAAO,GAAG,CAAC,CAAC,MAAyB,CAAA;IAC3C,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE;QAC3B,OAAO,CAAC,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,WAAY,CAAC,CAAA;KAC3D;AACH,CAAC;AAED,SAAS,UAAU,CAAC,CAAQ;IAC1B,MAAM,OAAO,GAAG,CAAC,CAAC,MAAyB,CAAA;IAC3C,OAAO,CAAC,eAAe,CAAC,cAAc,CAAC,CAAA;AACzC,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IAC3F,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAA;IAEpC,IAAI,IAAI,GAAG,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;IACrC,IAAI,MAAM,EAAE;QACV,IAAI,GAAG,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;KAC/B;IAED,OAAO,IAAI,CAAA,oBAAoB,WAAW,cAAc,UAAU,IAAI,IAAI,eAAe,CAAA;AAC3F,CAAC,CAAA","sourcesContent":["import { html } from 'lit'\n\nimport { detectOverflow, format as formatter } from '@operato/utils'\n\nimport { FieldRenderer } from '../types'\n\nfunction onmouseover(e: Event) {\n const element = e.target as HTMLSpanElement\n if (detectOverflow(element)) {\n element.setAttribute('data-tooltip', element.textContent!)\n }\n}\n\nfunction onmouseout(e: Event) {\n const element = e.target as HTMLSpanElement\n element.removeAttribute('data-tooltip')\n}\n\nexport const OxGristRendererText: FieldRenderer = (value, column, record, rowIndex, field) => {\n var { format } = column.record || {}\n\n var text = value == null ? '' : value\n if (format) {\n text = formatter(format, text)\n }\n\n return html`<span @mouseover=${onmouseover} @mouseout=${onmouseout}>${text}&nbsp;</span>`\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import { FieldRenderer } from '../types';
2
+ export declare const OxGristRendererTextarea: FieldRenderer;
@@ -0,0 +1,5 @@
1
+ import { html } from 'lit';
2
+ export const OxGristRendererTextarea = (value, column, record, rowIndex, field) => {
3
+ return html `<span style="height:auto;white-space: pre-wrap;word-wrap:break-word;">${value}&nbsp;</span>`;
4
+ };
5
+ //# sourceMappingURL=ox-grist-renderer-textarea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-grist-renderer-textarea.js","sourceRoot":"","sources":["../../../src/renderers/ox-grist-renderer-textarea.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAI1B,MAAM,CAAC,MAAM,uBAAuB,GAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IAC/F,OAAO,IAAI,CAAA,yEAAyE,KAAK,eAAe,CAAA;AAC1G,CAAC,CAAA","sourcesContent":["import { html } from 'lit'\n\nimport { FieldRenderer } from '../types'\n\nexport const OxGristRendererTextarea: FieldRenderer = (value, column, record, rowIndex, field) => {\n return html`<span style=\"height:auto;white-space: pre-wrap;word-wrap:break-word;\">${value}&nbsp;</span>`\n}\n"]}
@@ -9,12 +9,14 @@ import { OxGristRendererPassword } from './ox-grist-renderer-password.js';
9
9
  import { OxGristRendererProgress } from './ox-grist-renderer-progress.js';
10
10
  import { OxGristRendererSelect } from './ox-grist-renderer-select.js';
11
11
  import { OxGristRendererText } from './ox-grist-renderer-text.js';
12
+ import { OxGristRendererTextarea } from './ox-grist-renderer-textarea.js';
12
13
  function isClass(func) {
13
14
  return typeof func === 'function' && /^class\s/.test(Function.prototype.toString.call(func));
14
15
  }
15
16
  var RENDERERS = {
16
17
  string: OxGristRendererText,
17
18
  text: OxGristRendererText,
19
+ textarea: OxGristRendererTextarea,
18
20
  email: OxGristRendererText,
19
21
  tel: OxGristRendererText,
20
22
  password: OxGristRendererPassword,
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/renderers/registry.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6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AAY,EAAE,QAAuB;IACpE,SAAS,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAA;AAC5B,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,SAAS,CAAC,IAAI,CAAC,CAAA;AACxB,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,EAAE,GAAG,SAAS,EAAE,CAAA;AACzB,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAA4B;IACtD,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;QAC9B,OAAO,IAAI,CAAA;KACZ;IAED,IAAI,QAAQ,GAA+C,SAAS,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,mBAAmB,CAAA;IAE3G,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QACtB,OAAO,QAAyB,CAAA;KACjC;IAED,OAAO,UACL,KAAU,EACV,MAAoB,EACpB,MAAmB,EACnB,QAAgB,EAChB,KASW;QAEX,IAAI,OAAO,GAAoB,IAAK,QAAuC,EAAS,CAAA;QAEpF,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;QACrB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAA;QACvB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAA;QACvB,OAAO,CAAC,GAAG,GAAG,QAAQ,CAAA;QACtB,OAAO,CAAC,KAAK,GAAG,KAAsB,CAAA;QAEtC,OAAO,OAA0B,CAAA;IACnC,CAAC,CAAA;AACH,CAAC","sourcesContent":["import { DataCardField } from '../data-card/data-card-field.js'\nimport { DataCardGutter } from '../data-card/data-card-gutter.js'\nimport { RecordCard } from '../data-card/record-card.js'\nimport { DataGridField } from '../data-grid/data-grid-field.js'\nimport { DataListField } from '../data-list/data-list-field.js'\nimport { DataListGutter } from '../data-list/data-list-gutter.js'\nimport { RecordPartial } from '../data-list/record-partial.js'\nimport { DataReportField } from '../data-report/data-report-field.js'\nimport { ColumnConfig, FieldRenderer, GristRecord } from '../types.js'\nimport { OxGristRendererBoolean } from './ox-grist-renderer-boolean.js'\nimport { OxGristRendererColor } from './ox-grist-renderer-color.js'\nimport { OxGristRendererDate } from './ox-grist-renderer-date.js'\nimport { OxGristRendererFile } from './ox-grist-renderer-file.js'\nimport { OxGristRendererImage } from './ox-grist-renderer-image.js'\nimport { OxGristRendererJson5 } from './ox-grist-renderer-json5.js'\nimport { OxGristRendererLink } from './ox-grist-renderer-link.js'\nimport { OxGristRendererPassword } from './ox-grist-renderer-password.js'\nimport { OxGristRendererProgress } from './ox-grist-renderer-progress.js'\nimport { OxGristRendererSelect } from './ox-grist-renderer-select.js'\nimport { OxGristRendererText } from './ox-grist-renderer-text.js'\nimport { OxGristRenderer } from './ox-grist-renderer.js'\n\ninterface OxGristRendererConstructor {\n new (): OxGristRenderer\n}\n\nfunction isClass(func: Function) {\n return typeof func === 'function' && /^class\\s/.test(Function.prototype.toString.call(func))\n}\n\nvar RENDERERS: {\n [name: string]: FieldRenderer | OxGristRendererConstructor\n} = {\n string: OxGristRendererText,\n text: OxGristRendererText,\n email: OxGristRendererText,\n tel: OxGristRendererText,\n password: OxGristRendererPassword,\n integer: OxGristRendererText,\n float: OxGristRendererText,\n number: OxGristRendererText,\n select: OxGristRendererSelect,\n boolean: OxGristRendererBoolean,\n checkbox: OxGristRendererBoolean,\n month: OxGristRendererText,\n week: OxGristRendererText,\n date: OxGristRendererDate,\n time: OxGristRendererDate,\n datetime: OxGristRendererDate,\n color: OxGristRendererColor,\n progress: OxGristRendererProgress,\n link: OxGristRendererLink,\n image: OxGristRendererImage,\n file: OxGristRendererFile,\n json5: OxGristRendererJson5\n}\n\nexport function registerRenderer(type: string, renderer: FieldRenderer) {\n RENDERERS[type] = renderer\n}\n\nexport function unregisterRenderer(type: string): void {\n delete RENDERERS[type]\n}\n\nexport function getRenderers(): { [name: string]: FieldRenderer | OxGristRendererConstructor } {\n return { ...RENDERERS }\n}\n\nexport function getRenderer(type: string | FieldRenderer): FieldRenderer {\n if (typeof type === 'function') {\n return type\n }\n\n var renderer: FieldRenderer | OxGristRendererConstructor = RENDERERS[type || 'text'] || OxGristRendererText\n\n if (!isClass(renderer)) {\n return renderer as FieldRenderer\n }\n\n return function (\n value: any,\n column: ColumnConfig,\n record: GristRecord,\n rowIndex: number,\n field:\n | DataGridField\n | RecordCard\n | DataCardGutter\n | DataCardField\n | DataListGutter\n | DataListField\n | RecordPartial\n | DataReportField\n | Element\n ) {\n var element: OxGristRenderer = new (renderer as OxGristRendererConstructor)() as any\n\n element.value = value\n element.record = record\n element.column = column\n element.row = rowIndex\n element.field = field as DataGridField\n\n return element as OxGristRenderer\n }\n}\n"]}
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/renderers/registry.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAA;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAA;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAA;AAOzE,SAAS,OAAO,CAAC,IAAc;IAC7B,OAAO,OAAO,IAAI,KAAK,UAAU,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,I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AE;QACtB,OAAO,QAAyB,CAAA;KACjC;IAED,OAAO,UACL,KAAU,EACV,MAAoB,EACpB,MAAmB,EACnB,QAAgB,EAChB,KASW;QAEX,IAAI,OAAO,GAAoB,IAAK,QAAuC,EAAS,CAAA;QAEpF,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;QACrB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAA;QACvB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAA;QACvB,OAAO,CAAC,GAAG,GAAG,QAAQ,CAAA;QACtB,OAAO,CAAC,KAAK,GAAG,KAAsB,CAAA;QAEtC,OAAO,OAA0B,CAAA;IACnC,CAAC,CAAA;AACH,CAAC","sourcesContent":["import { DataCardField } from '../data-card/data-card-field.js'\nimport { DataCardGutter } from '../data-card/data-card-gutter.js'\nimport { RecordCard } from '../data-card/record-card.js'\nimport { DataGridField } from '../data-grid/data-grid-field.js'\nimport { DataListField } from '../data-list/data-list-field.js'\nimport { DataListGutter } from '../data-list/data-list-gutter.js'\nimport { RecordPartial } from '../data-list/record-partial.js'\nimport { DataReportField } from '../data-report/data-report-field.js'\nimport { ColumnConfig, FieldRenderer, GristRecord } from '../types.js'\nimport { OxGristRendererBoolean } from './ox-grist-renderer-boolean.js'\nimport { OxGristRendererColor } from './ox-grist-renderer-color.js'\nimport { OxGristRendererDate } from './ox-grist-renderer-date.js'\nimport { OxGristRendererFile } from './ox-grist-renderer-file.js'\nimport { OxGristRendererImage } from './ox-grist-renderer-image.js'\nimport { OxGristRendererJson5 } from './ox-grist-renderer-json5.js'\nimport { OxGristRendererLink } from './ox-grist-renderer-link.js'\nimport { OxGristRendererPassword } from './ox-grist-renderer-password.js'\nimport { OxGristRendererProgress } from './ox-grist-renderer-progress.js'\nimport { OxGristRendererSelect } from './ox-grist-renderer-select.js'\nimport { OxGristRendererText } from './ox-grist-renderer-text.js'\nimport { OxGristRendererTextarea } from './ox-grist-renderer-textarea.js'\nimport { OxGristRenderer } from './ox-grist-renderer.js'\n\ninterface OxGristRendererConstructor {\n new (): OxGristRenderer\n}\n\nfunction isClass(func: Function) {\n return typeof func === 'function' && /^class\\s/.test(Function.prototype.toString.call(func))\n}\n\nvar RENDERERS: {\n [name: string]: FieldRenderer | OxGristRendererConstructor\n} = {\n string: OxGristRendererText,\n text: OxGristRendererText,\n textarea: OxGristRendererTextarea,\n email: OxGristRendererText,\n tel: OxGristRendererText,\n password: OxGristRendererPassword,\n integer: OxGristRendererText,\n float: OxGristRendererText,\n number: OxGristRendererText,\n select: OxGristRendererSelect,\n boolean: OxGristRendererBoolean,\n checkbox: OxGristRendererBoolean,\n month: OxGristRendererText,\n week: OxGristRendererText,\n date: OxGristRendererDate,\n time: OxGristRendererDate,\n datetime: OxGristRendererDate,\n color: OxGristRendererColor,\n progress: OxGristRendererProgress,\n link: OxGristRendererLink,\n image: OxGristRendererImage,\n file: OxGristRendererFile,\n json5: OxGristRendererJson5\n}\n\nexport function registerRenderer(type: string, renderer: FieldRenderer) {\n RENDERERS[type] = renderer\n}\n\nexport function unregisterRenderer(type: string): void {\n delete RENDERERS[type]\n}\n\nexport function getRenderers(): { [name: string]: FieldRenderer | OxGristRendererConstructor } {\n return { ...RENDERERS }\n}\n\nexport function getRenderer(type: string | FieldRenderer): FieldRenderer {\n if (typeof type === 'function') {\n return type\n }\n\n var renderer: FieldRenderer | OxGristRendererConstructor = RENDERERS[type || 'text'] || OxGristRendererText\n\n if (!isClass(renderer)) {\n return renderer as FieldRenderer\n }\n\n return function (\n value: any,\n column: ColumnConfig,\n record: GristRecord,\n rowIndex: number,\n field:\n | DataGridField\n | RecordCard\n | DataCardGutter\n | DataCardField\n | DataListGutter\n | DataListField\n | RecordPartial\n | DataReportField\n | Element\n ) {\n var element: OxGristRenderer = new (renderer as OxGristRendererConstructor)() as any\n\n element.value = value\n element.record = record\n element.column = column\n element.row = rowIndex\n element.field = field as DataGridField\n\n return element as OxGristRenderer\n }\n}\n"]}
@@ -0,0 +1,36 @@
1
+ import '../src/index.js';
2
+ import '../src/filters/filters-form.js';
3
+ import '../src/sorters/sorters-control.js';
4
+ import '../src/record-view/record-creator.js';
5
+ import '@operato/popup/ox-popup-list.js';
6
+ import '@material/mwc-icon';
7
+ import { TemplateResult } from 'lit';
8
+ declare const _default: {
9
+ title: string;
10
+ component: string;
11
+ argTypes: {
12
+ config: {
13
+ control: string;
14
+ };
15
+ mode: {
16
+ control: string;
17
+ options: string[];
18
+ };
19
+ urlParamsSensitive: {
20
+ control: string;
21
+ };
22
+ };
23
+ };
24
+ export default _default;
25
+ interface Story<T> {
26
+ (args: T): TemplateResult;
27
+ args?: Partial<T>;
28
+ argTypes?: Record<string, unknown>;
29
+ }
30
+ interface ArgTypes {
31
+ config: object;
32
+ mode: string;
33
+ urlParamsSensitive: boolean;
34
+ fetchHandler: object;
35
+ }
36
+ export declare const Regular: Story<ArgTypes>;
@@ -0,0 +1,291 @@
1
+ import '../src/index.js';
2
+ import '../src/filters/filters-form.js';
3
+ import '../src/sorters/sorters-control.js';
4
+ import '../src/record-view/record-creator.js';
5
+ import '@operato/popup/ox-popup-list.js';
6
+ import '@material/mwc-icon';
7
+ import { html } from 'lit';
8
+ const fetchHandler = async ({ page, limit }) => {
9
+ var total = 3;
10
+ var start = (page - 1) * limit;
11
+ await new Promise(resolve => setTimeout(resolve, 500));
12
+ return {
13
+ total,
14
+ records: Array(limit * page > total ? total % limit : limit)
15
+ .fill('')
16
+ .map((item, idx) => {
17
+ return {
18
+ id: String(idx),
19
+ name: idx % 2 ? `shnam-${start + idx + 1}` : `heartyoh-${start + idx + 1}`,
20
+ description: idx % 2 ? `hatiolabmanager${start + idx + 1}1234567890` : `hatiosea manager-${start + idx + 1}`,
21
+ textarea: `
22
+ long long long text
23
+ long long long text
24
+ long long long text
25
+ long long long text
26
+ long long long text white-space: pre-wrap;white-space: pre-wrap;white-space: pre-wrap;
27
+ long long long text
28
+ long long long text
29
+ long long long text
30
+ long long long text
31
+ long long long text
32
+ `,
33
+ createdAt: Date.now(),
34
+ updatedAt: Date.now()
35
+ };
36
+ })
37
+ };
38
+ };
39
+ const config = {
40
+ list: {
41
+ thumbnail: 'thumbnail',
42
+ fields: ['name', 'description'],
43
+ details: ['role', 'email']
44
+ },
45
+ columns: [
46
+ {
47
+ type: 'gutter',
48
+ gutterName: 'dirty'
49
+ },
50
+ {
51
+ type: 'gutter',
52
+ gutterName: 'sequence'
53
+ },
54
+ {
55
+ type: 'gutter',
56
+ gutterName: 'row-selector',
57
+ multiple: true
58
+ },
59
+ {
60
+ type: 'gutter',
61
+ gutterName: 'button',
62
+ icon: 'add',
63
+ title: 'add',
64
+ handlers: {
65
+ click: 'record-copy'
66
+ }
67
+ },
68
+ {
69
+ type: 'string',
70
+ name: 'id',
71
+ hidden: true
72
+ },
73
+ {
74
+ type: 'string',
75
+ name: 'name',
76
+ label: true,
77
+ header: 'name',
78
+ record: {
79
+ editable: true
80
+ },
81
+ filter: 'search',
82
+ sortable: true,
83
+ width: 120
84
+ },
85
+ {
86
+ type: 'string',
87
+ name: 'description',
88
+ header: 'description',
89
+ filter: 'search',
90
+ record: {
91
+ editable: true,
92
+ align: 'left'
93
+ },
94
+ width: 200
95
+ },
96
+ {
97
+ type: 'textarea',
98
+ name: 'textarea',
99
+ label: true,
100
+ header: 'textarea',
101
+ record: {
102
+ editable: true
103
+ },
104
+ filter: 'search',
105
+ sortable: true,
106
+ width: 130
107
+ },
108
+ {
109
+ type: 'datetime',
110
+ name: 'updatedAt',
111
+ header: 'updated at',
112
+ record: {
113
+ editable: true,
114
+ defaultValue: {
115
+ name: 'now'
116
+ }
117
+ },
118
+ filter: 'between',
119
+ sortable: true,
120
+ width: 180
121
+ },
122
+ {
123
+ type: 'datetime',
124
+ name: 'createdAt',
125
+ header: 'created at',
126
+ record: {
127
+ editable: false
128
+ },
129
+ sortable: true,
130
+ width: 180
131
+ }
132
+ ],
133
+ rows: {
134
+ selectable: {
135
+ multiple: false
136
+ },
137
+ handlers: {
138
+ focus: 'select-row'
139
+ }
140
+ },
141
+ sorters: [
142
+ {
143
+ name: 'name',
144
+ desc: true
145
+ },
146
+ {
147
+ name: 'email'
148
+ }
149
+ ],
150
+ pagination: {
151
+ pages: [20, 30, 50, 100, 200]
152
+ }
153
+ };
154
+ export default {
155
+ title: 'textarea in ox-grist',
156
+ component: 'ox-grist',
157
+ argTypes: {
158
+ config: { control: 'object' },
159
+ mode: { control: 'select', options: ['GRID', 'LIST', 'CARD'] },
160
+ urlParamsSensitive: { control: 'boolean' }
161
+ }
162
+ };
163
+ const Template = ({ config, mode = 'GRID', urlParamsSensitive = false, fetchHandler }) => html ` <link
164
+ href="https://fonts.googleapis.com/css?family=Material+Icons&display=block"
165
+ rel="stylesheet"
166
+ />
167
+ <link href="/themes/app-theme.css" rel="stylesheet" />
168
+ <link href="/themes/oops-theme.css" rel="stylesheet" />
169
+ <link href="/themes/grist-theme.css" rel="stylesheet" />
170
+
171
+ <style>
172
+ [slot='headroom'] {
173
+ display: flex;
174
+ flex-direction: row;
175
+ align-items: center;
176
+ padding: var(--padding-default) var(--padding-wide);
177
+ background-color: var(--theme-white-color);
178
+ box-shadow: var(--box-shadow);
179
+
180
+ --mdc-icon-size: 24px;
181
+ }
182
+ #sorters mwc-icon,
183
+ #modes mwc-icon {
184
+ --mdc-icon-size: 18px;
185
+ }
186
+ #sorters {
187
+ margin-left: auto;
188
+ margin-right: var(--margin-default);
189
+ padding-left: var(--padding-narrow);
190
+ border-bottom: var(--border-dark-color);
191
+ position: relative;
192
+ color: var(--secondary-color);
193
+ font-size: var(--fontsize-default);
194
+ user-select: none;
195
+ }
196
+
197
+ #sorters > * {
198
+ padding: var(--padding-narrow);
199
+ vertical-align: middle;
200
+ }
201
+
202
+ #modes > * {
203
+ padding: var(--padding-narrow);
204
+ opacity: 0.5;
205
+ color: var(--primary-text-color);
206
+ cursor: pointer;
207
+ }
208
+
209
+ #modes > mwc-icon[active] {
210
+ border-radius: 9px;
211
+ background-color: rgba(var(--primary-color-rgb), 0.05);
212
+ opacity: 1;
213
+ color: var(--secondary-text-color);
214
+ cursor: default;
215
+ }
216
+
217
+ #modes > mwc-icon:hover {
218
+ opacity: 1;
219
+ color: var(--secondary-text-color);
220
+ }
221
+
222
+ #add {
223
+ width: 50px;
224
+ text-align: right;
225
+ }
226
+
227
+ #add button {
228
+ background-color: var(--status-success-color);
229
+ border: 0;
230
+ border-radius: 50%;
231
+ padding: 5px;
232
+ width: 36px;
233
+ height: 36px;
234
+ cursor: pointer;
235
+ }
236
+
237
+ #add button:hover {
238
+ background-color: var(--focus-background-color);
239
+ box-shadow: var(--box-shadow);
240
+ }
241
+
242
+ #add button mwc-icon {
243
+ font-size: 2em;
244
+ color: var(--theme-white-color);
245
+ }
246
+
247
+ #filters {
248
+ display: flex;
249
+ justify-content: center;
250
+ align-items: center;
251
+ }
252
+
253
+ #filters * {
254
+ margin-right: var(--margin-default);
255
+ }
256
+
257
+ @media only screen and (max-width: 460px) {
258
+ #filters {
259
+ flex-direction: column;
260
+ }
261
+
262
+ #modes {
263
+ display: none;
264
+ }
265
+ }
266
+ </style>
267
+
268
+ <ox-grist
269
+ .config=${config}
270
+ .mode=${mode}
271
+ .fetchHandler=${fetchHandler}
272
+ ?url-params-sensitive=${urlParamsSensitive}
273
+ @filters-change=${(e) => console.log('filters', e.target.filters)}
274
+ >
275
+ <div slot="headroom">
276
+ <div id="filters">
277
+ <ox-filters-form autofocus></ox-filters-form>
278
+ </div>
279
+
280
+ <ox-record-creator id="add" light-popup>
281
+ <button><mwc-icon>add</mwc-icon></button>
282
+ </ox-record-creator>
283
+ </div>
284
+ </ox-grist>`;
285
+ export const Regular = Template.bind({});
286
+ Regular.args = {
287
+ config,
288
+ fetchHandler,
289
+ mode: 'GRID'
290
+ };
291
+ //# sourceMappingURL=textarea.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textarea.stories.js","sourceRoot":"","sources":["../../stories/textarea.stories.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AACxB,OAAO,gCA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EAC1B,YAAY,EACH,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0GN,MAAM;YACR,IAAI;oBACI,YAAY;4BACJ,kBAAkB;sBACxB,CAAC,CAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAG,CAAC,CAAC,MAAc,CAAC,OAAO,CAAC;;;;;;;;;;;cAWvE,CAAA;AAEd,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG;IACb,MAAM;IACN,YAAY;IACZ,IAAI,EAAE,MAAM;CACb,CAAA","sourcesContent":["import '../src/index.js'\nimport '../src/filters/filters-form.js'\nimport '../src/sorters/sorters-control.js'\nimport '../src/record-view/record-creator.js'\nimport '@operato/popup/ox-popup-list.js'\nimport '@material/mwc-icon'\n\nimport { html, TemplateResult } from 'lit'\n\nimport {\n ColumnConfig,\n FetchHandler,\n GristClassifier,\n GristEventHandlerSet,\n GristRecord,\n ValidationCallback\n} from '../src/types.js'\n\nconst fetchHandler: FetchHandler = async ({ page, limit }) => {\n var total = 3\n var start = (page! - 1) * limit!\n\n await new Promise(resolve => setTimeout(resolve, 500))\n\n return {\n total,\n records: Array(limit! * page! > total ? total % limit! : limit)\n .fill('')\n .map((item, idx) => {\n return {\n id: String(idx),\n name: idx % 2 ? `shnam-${start + idx + 1}` : `heartyoh-${start + idx + 1}`,\n description: idx % 2 ? `hatiolabmanager${start + idx + 1}1234567890` : `hatiosea manager-${start + idx + 1}`,\n textarea: `\nlong long long text\nlong long long text\nlong long long text\nlong long long text\nlong long long text white-space: pre-wrap;white-space: pre-wrap;white-space: pre-wrap;\nlong long long text\nlong long long text\nlong long long text\nlong long long text\nlong long long text\n`,\n createdAt: Date.now(),\n updatedAt: Date.now()\n }\n })\n }\n}\n\nconst config = {\n list: {\n thumbnail: 'thumbnail',\n fields: ['name', 'description'],\n details: ['role', 'email']\n },\n columns: [\n {\n type: 'gutter',\n gutterName: 'dirty'\n },\n {\n type: 'gutter',\n gutterName: 'sequence'\n },\n {\n type: 'gutter',\n gutterName: 'row-selector',\n multiple: true\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'add',\n title: 'add',\n handlers: {\n click: 'record-copy'\n }\n },\n {\n type: 'string',\n name: 'id',\n hidden: true\n },\n {\n type: 'string',\n name: 'name',\n label: true,\n header: 'name',\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 120\n },\n {\n type: 'string',\n name: 'description',\n header: 'description',\n filter: 'search',\n record: {\n editable: true,\n align: 'left'\n },\n width: 200\n },\n {\n type: 'textarea',\n name: 'textarea',\n label: true,\n header: 'textarea',\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 130\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: 'updated at',\n record: {\n editable: true,\n defaultValue: {\n name: 'now'\n }\n },\n filter: 'between',\n sortable: true,\n width: 180\n },\n {\n type: 'datetime',\n name: 'createdAt',\n header: 'created at',\n record: {\n editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: false\n },\n handlers: {\n focus: 'select-row'\n }\n },\n sorters: [\n {\n name: 'name',\n desc: true\n },\n {\n name: 'email'\n }\n ],\n pagination: {\n pages: [20, 30, 50, 100, 200]\n }\n}\n\nexport default {\n title: 'textarea in ox-grist',\n component: 'ox-grist',\n argTypes: {\n config: { control: 'object' },\n mode: { control: 'select', options: ['GRID', 'LIST', 'CARD'] },\n urlParamsSensitive: { control: 'boolean' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n config: object\n mode: string\n urlParamsSensitive: boolean\n fetchHandler: object\n}\n\nconst Template: Story<ArgTypes> = ({\n config,\n mode = 'GRID',\n urlParamsSensitive = false,\n fetchHandler\n}: ArgTypes) => html` <link\n href=\"https://fonts.googleapis.com/css?family=Material+Icons&display=block\"\n rel=\"stylesheet\"\n />\n <link href=\"/themes/app-theme.css\" rel=\"stylesheet\" />\n <link href=\"/themes/oops-theme.css\" rel=\"stylesheet\" />\n <link href=\"/themes/grist-theme.css\" rel=\"stylesheet\" />\n\n <style>\n [slot='headroom'] {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: var(--padding-default) var(--padding-wide);\n background-color: var(--theme-white-color);\n box-shadow: var(--box-shadow);\n\n --mdc-icon-size: 24px;\n }\n #sorters mwc-icon,\n #modes mwc-icon {\n --mdc-icon-size: 18px;\n }\n #sorters {\n margin-left: auto;\n margin-right: var(--margin-default);\n padding-left: var(--padding-narrow);\n border-bottom: var(--border-dark-color);\n position: relative;\n color: var(--secondary-color);\n font-size: var(--fontsize-default);\n user-select: none;\n }\n\n #sorters > * {\n padding: var(--padding-narrow);\n vertical-align: middle;\n }\n\n #modes > * {\n padding: var(--padding-narrow);\n opacity: 0.5;\n color: var(--primary-text-color);\n cursor: pointer;\n }\n\n #modes > mwc-icon[active] {\n border-radius: 9px;\n background-color: rgba(var(--primary-color-rgb), 0.05);\n opacity: 1;\n color: var(--secondary-text-color);\n cursor: default;\n }\n\n #modes > mwc-icon:hover {\n opacity: 1;\n color: var(--secondary-text-color);\n }\n\n #add {\n width: 50px;\n text-align: right;\n }\n\n #add button {\n background-color: var(--status-success-color);\n border: 0;\n border-radius: 50%;\n padding: 5px;\n width: 36px;\n height: 36px;\n cursor: pointer;\n }\n\n #add button:hover {\n background-color: var(--focus-background-color);\n box-shadow: var(--box-shadow);\n }\n\n #add button mwc-icon {\n font-size: 2em;\n color: var(--theme-white-color);\n }\n\n #filters {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n #filters * {\n margin-right: var(--margin-default);\n }\n\n @media only screen and (max-width: 460px) {\n #filters {\n flex-direction: column;\n }\n\n #modes {\n display: none;\n }\n }\n </style>\n\n <ox-grist\n .config=${config}\n .mode=${mode}\n .fetchHandler=${fetchHandler}\n ?url-params-sensitive=${urlParamsSensitive}\n @filters-change=${(e: Event) => console.log('filters', (e.target as any).filters)}\n >\n <div slot=\"headroom\">\n <div id=\"filters\">\n <ox-filters-form autofocus></ox-filters-form>\n </div>\n\n <ox-record-creator id=\"add\" light-popup>\n <button><mwc-icon>add</mwc-icon></button>\n </ox-record-creator>\n </div>\n </ox-grist>`\n\nexport const Regular = Template.bind({})\nRegular.args = {\n config,\n fetchHandler,\n mode: 'GRID'\n}\n"]}