@operato/grist-editor 1.0.0-alpha.23 → 1.0.0-beta.40
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/.storybook/main.js +2 -2
- package/.storybook/server.mjs +4 -4
- package/CHANGELOG.md +4 -116
- package/LICENSE +2 -2
- package/README.md +29 -9
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +15 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/ox-grist-editor-crontab.d.ts +8 -0
- package/dist/src/ox-grist-editor-crontab.js +50 -0
- package/dist/src/ox-grist-editor-crontab.js.map +1 -0
- package/dist/src/ox-grist-editor-duration.d.ts +8 -0
- package/dist/src/ox-grist-editor-duration.js +50 -0
- package/dist/src/ox-grist-editor-duration.js.map +1 -0
- package/dist/src/ox-grist-editor-parameters.d.ts +12 -0
- package/dist/src/{parameters/parameters-editor.js → ox-grist-editor-parameters.js} +17 -39
- package/dist/src/ox-grist-editor-parameters.js.map +1 -0
- package/dist/src/ox-grist-editor-partition-keys.d.ts +11 -0
- package/dist/src/ox-grist-editor-partition-keys.js +74 -0
- package/dist/src/ox-grist-editor-partition-keys.js.map +1 -0
- package/dist/src/ox-grist-editor-value-map.d.ts +11 -0
- package/dist/src/ox-grist-editor-value-map.js +74 -0
- package/dist/src/ox-grist-editor-value-map.js.map +1 -0
- package/dist/src/ox-grist-renderer-crontab.d.ts +2 -0
- package/dist/src/ox-grist-renderer-crontab.js +26 -0
- package/dist/src/ox-grist-renderer-crontab.js.map +1 -0
- package/dist/src/{parameters/parameters-editor-builder.d.ts → ox-parameters-builder.d.ts} +0 -0
- package/dist/src/{parameters/parameters-editor-builder.js → ox-parameters-builder.js} +12 -14
- package/dist/src/ox-parameters-builder.js.map +1 -0
- package/dist/src/ox-popup-crontab-input.d.ts +11 -0
- package/dist/src/ox-popup-crontab-input.js +75 -0
- package/dist/src/ox-popup-crontab-input.js.map +1 -0
- package/dist/src/ox-popup-duration-input.d.ts +11 -0
- package/dist/src/ox-popup-duration-input.js +75 -0
- package/dist/src/ox-popup-duration-input.js.map +1 -0
- package/dist/src/{parameters/parameters-editor-popup.d.ts → ox-popup-parameters-builder.d.ts} +1 -1
- package/dist/src/{parameters/parameters-editor-popup.js → ox-popup-parameters-builder.js} +20 -19
- package/dist/src/ox-popup-parameters-builder.js.map +1 -0
- package/dist/src/ox-popup-partition-keys-input.d.ts +12 -0
- package/dist/src/ox-popup-partition-keys-input.js +100 -0
- package/dist/src/ox-popup-partition-keys-input.js.map +1 -0
- package/dist/src/ox-popup-value-map-input.d.ts +12 -0
- package/dist/src/ox-popup-value-map-input.js +105 -0
- package/dist/src/ox-popup-value-map-input.js.map +1 -0
- package/dist/stories/ox-grist-editor-crontab.stories.d.ts +24 -0
- package/dist/stories/ox-grist-editor-crontab.stories.js +406 -0
- package/dist/stories/ox-grist-editor-crontab.stories.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +36 -24
- package/src/index.ts +18 -0
- package/src/ox-grist-editor-crontab.ts +62 -0
- package/src/ox-grist-editor-duration.ts +62 -0
- package/src/{parameters/parameters-editor.ts → ox-grist-editor-parameters.ts} +14 -27
- package/src/ox-grist-editor-partition-keys.ts +86 -0
- package/src/ox-grist-editor-value-map.ts +86 -0
- package/src/ox-grist-renderer-crontab.ts +31 -0
- package/src/{parameters/parameters-editor-builder.ts → ox-parameters-builder.ts} +6 -8
- package/src/ox-popup-crontab-input.ts +75 -0
- package/src/ox-popup-duration-input.ts +75 -0
- package/src/{parameters/parameters-editor-popup.ts → ox-popup-parameters-builder.ts} +10 -9
- package/src/ox-popup-partition-keys-input.ts +97 -0
- package/src/ox-popup-value-map-input.ts +102 -0
- package/stories/ox-grist-editor-crontab.stories.ts +429 -0
- package/themes/app-theme.css +142 -0
- package/themes/form-theme.css +75 -0
- package/themes/grist-theme.css +194 -0
- package/themes/oops-theme.css +26 -0
- package/themes/report-theme.css +47 -0
- package/translations/en.json +3 -0
- package/translations/ko.json +3 -0
- package/translations/ms.json +3 -0
- package/translations/zh.json +3 -0
- package/web-dev-server.config.mjs +9 -8
- package/web-test-runner.config.mjs +7 -19
- package/.editorconfig +0 -29
- package/demo/data-grist-test.html +0 -456
- package/demo/index.html +0 -33
- package/dist/src/code/code-editor.d.ts +0 -6
- package/dist/src/code/code-editor.js +0 -50
- package/dist/src/code/code-editor.js.map +0 -1
- package/dist/src/code/index.d.ts +0 -1
- package/dist/src/code/index.js +0 -5
- package/dist/src/code/index.js.map +0 -1
- package/dist/src/id/id-input.d.ts +0 -19
- package/dist/src/id/id-input.js +0 -119
- package/dist/src/id/id-input.js.map +0 -1
- package/dist/src/id/id-renderer.d.ts +0 -2
- package/dist/src/id/id-renderer.js +0 -9
- package/dist/src/id/id-renderer.js.map +0 -1
- package/dist/src/id/id-selector.d.ts +0 -23
- package/dist/src/id/id-selector.js +0 -197
- package/dist/src/id/id-selector.js.map +0 -1
- package/dist/src/id/index.d.ts +0 -1
- package/dist/src/id/index.js +0 -7
- package/dist/src/id/index.js.map +0 -1
- package/dist/src/object/index.d.ts +0 -1
- package/dist/src/object/index.js +0 -6
- package/dist/src/object/index.js.map +0 -1
- package/dist/src/object/object-editor.d.ts +0 -18
- package/dist/src/object/object-editor.js +0 -152
- package/dist/src/object/object-editor.js.map +0 -1
- package/dist/src/object/object-selector.d.ts +0 -38
- package/dist/src/object/object-selector.js +0 -338
- package/dist/src/object/object-selector.js.map +0 -1
- package/dist/src/parameters/index.d.ts +0 -1
- package/dist/src/parameters/index.js +0 -6
- package/dist/src/parameters/index.js.map +0 -1
- package/dist/src/parameters/parameters-editor-builder.js.map +0 -1
- package/dist/src/parameters/parameters-editor-popup.js.map +0 -1
- package/dist/src/parameters/parameters-editor.d.ts +0 -18
- package/dist/src/parameters/parameters-editor.js.map +0 -1
- package/src/code/code-editor.ts +0 -78
- package/src/code/index.ts +0 -6
- package/src/id/id-input.ts +0 -135
- package/src/id/id-renderer.ts +0 -12
- package/src/id/id-selector.ts +0 -189
- package/src/id/index.ts +0 -8
- package/src/object/index.ts +0 -8
- package/src/object/object-editor.ts +0 -162
- package/src/object/object-selector.ts +0 -346
- package/src/parameters/index.ts +0 -8
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import '@operato/input/ox-input-value-map.js';
|
|
3
|
+
import { css, html, LitElement } from 'lit';
|
|
4
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
5
|
+
import { i18next } from '@operato/i18n';
|
|
6
|
+
import { closePopup } from '@operato/popup';
|
|
7
|
+
import { ScrollbarStyles } from '@operato/styles';
|
|
8
|
+
let OxPopupValueMapInput = class OxPopupValueMapInput extends LitElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.valuetype = 'string';
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
14
|
+
return html `
|
|
15
|
+
<ox-input-value-map
|
|
16
|
+
.value=${this.value}
|
|
17
|
+
keytype="string"
|
|
18
|
+
.valuetype=${this.valuetype}
|
|
19
|
+
@change=${this.onChange.bind(this)}
|
|
20
|
+
>
|
|
21
|
+
</ox-input-value-map>
|
|
22
|
+
|
|
23
|
+
<div class="button-container">
|
|
24
|
+
<mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
|
|
25
|
+
<mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
|
|
26
|
+
</div>
|
|
27
|
+
`;
|
|
28
|
+
}
|
|
29
|
+
onChange(e) {
|
|
30
|
+
e.stopPropagation();
|
|
31
|
+
/*
|
|
32
|
+
주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로,
|
|
33
|
+
layout의 구성에 변화가 발생하면, 다시 render된다.
|
|
34
|
+
이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)
|
|
35
|
+
이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,
|
|
36
|
+
만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.
|
|
37
|
+
따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.
|
|
38
|
+
(이 팝업 클래스를 템플릿으로 사용한 곳의 코드를 참조하세요.)
|
|
39
|
+
=>
|
|
40
|
+
이런 이유로, Object.assign(...)을 사용하였다.
|
|
41
|
+
*/
|
|
42
|
+
if (!this.value) {
|
|
43
|
+
this.value = {};
|
|
44
|
+
}
|
|
45
|
+
for (let key in this.value) {
|
|
46
|
+
delete this.value[key];
|
|
47
|
+
}
|
|
48
|
+
Object.assign(this.value, e.detail);
|
|
49
|
+
}
|
|
50
|
+
onCancel(e) {
|
|
51
|
+
closePopup(this);
|
|
52
|
+
}
|
|
53
|
+
onConfirm(e) {
|
|
54
|
+
this.confirmCallback && this.confirmCallback(this.value);
|
|
55
|
+
closePopup(this);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
OxPopupValueMapInput.styles = [
|
|
59
|
+
ScrollbarStyles,
|
|
60
|
+
css `
|
|
61
|
+
:host {
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
|
|
65
|
+
background-color: #fff;
|
|
66
|
+
|
|
67
|
+
width: var(--overlay-center-normal-width, 50%);
|
|
68
|
+
height: var(--overlay-center-normal-height, 50%);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
ox-input-value-map {
|
|
72
|
+
flex: 1;
|
|
73
|
+
overflow-y: auto;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
span {
|
|
77
|
+
flex: 1;
|
|
78
|
+
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
justify-content: center;
|
|
82
|
+
|
|
83
|
+
color: var(--primary-color);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.button-container {
|
|
87
|
+
display: flex;
|
|
88
|
+
margin-left: auto;
|
|
89
|
+
}
|
|
90
|
+
`
|
|
91
|
+
];
|
|
92
|
+
__decorate([
|
|
93
|
+
property({ type: Object })
|
|
94
|
+
], OxPopupValueMapInput.prototype, "value", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
property({ type: String })
|
|
97
|
+
], OxPopupValueMapInput.prototype, "valuetype", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
property({ type: Object })
|
|
100
|
+
], OxPopupValueMapInput.prototype, "confirmCallback", void 0);
|
|
101
|
+
OxPopupValueMapInput = __decorate([
|
|
102
|
+
customElement('ox-popup-value-map-input')
|
|
103
|
+
], OxPopupValueMapInput);
|
|
104
|
+
export { OxPopupValueMapInput };
|
|
105
|
+
//# sourceMappingURL=ox-popup-value-map-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-popup-value-map-input.js","sourceRoot":"","sources":["../../src/ox-popup-value-map-input.ts"],"names":[],"mappings":";AAAA,OAAO,sCAAsC,CAAA;AAE7C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAGjD,IAAa,oBAAoB,GAAjC,MAAa,oBAAqB,SAAQ,UAAU;IAApD;;QAqC8B,cAAS,GAAW,QAAQ,CAAA;IAsD1D,CAAC;IAnDC,MAAM;QACJ,OAAO,IAAI,CAAA;;iBAEE,IAAI,CAAC,KAAK;;qBAEN,IAAI,CAAC,SAAS;kBACjB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;6BAKb,IAAI,CAAC,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AoB","sourcesContent":["import '@operato/input/ox-input-value-map.js'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\nimport { closePopup } from '@operato/popup'\nimport { ScrollbarStyles } from '@operato/styles'\n\n@customElement('ox-popup-value-map-input')\nexport class OxPopupValueMapInput 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-value-map {\n flex: 1;\n overflow-y: auto;\n }\n\n span {\n flex: 1;\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n color: var(--primary-color);\n }\n\n .button-container {\n display: flex;\n margin-left: auto;\n }\n `\n ]\n\n @property({ type: Object }) value: any\n @property({ type: String }) valuetype: string = 'string'\n @property({ type: Object }) confirmCallback!: (newval: any) => void\n\n render() {\n return html`\n <ox-input-value-map\n .value=${this.value}\n keytype=\"string\"\n .valuetype=${this.valuetype}\n @change=${this.onChange.bind(this)}\n >\n </ox-input-value-map>\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 private onChange(e: CustomEvent) {\n e.stopPropagation()\n\n /* \n 주의 : 이 팝업 템플릿은 layout 모듈에 의해서 render 되므로, \n layout의 구성에 변화가 발생하면, 다시 render된다.\n 이 팝업이 떠 있는 상태에서, 또 다른 팝업이 뜨는 경우도 layout 구성의 변화를 야기한다. (overlay의 갯수의 증가)\n 이 경우 value, options, confirmCallback 등 클로져를 사용한 것들이 초기 바인딩된 값으로 다시 바인딩되게 되는데,\n 만약, 템플릿 내부에서 이들 속성의 레퍼런스가 변화했다면, 원래 상태로 되돌아가는 현상이 발생하게 된다.\n 따라서, 가급적 이들 속성의 레퍼런스를 변화시키지 않는 것이 좋다.\n (이 팝업 클래스를 템플릿으로 사용한 곳의 코드를 참조하세요.)\n => \n 이런 이유로, Object.assign(...)을 사용하였다.\n */\n\n if (!this.value) {\n this.value = {}\n }\n\n for (let key in this.value) {\n delete this.value[key]\n }\n\n Object.assign(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"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import '@operato/property-editor/ox-property-editor-checkbox.js';
|
|
2
|
+
import '@operato/property-editor/ox-property-editor-number.js';
|
|
3
|
+
import '@operato/property-editor/ox-property-editor-string.js';
|
|
4
|
+
import '@operato/property-editor/ox-property-editor-options.js';
|
|
5
|
+
import '@operato/property-editor/ox-properties-dynamic-view.js';
|
|
6
|
+
import '@operato/data-grist';
|
|
7
|
+
import '@operato/data-grist/ox-filters-form.js';
|
|
8
|
+
import '@operato/data-grist/ox-sorters-control.js';
|
|
9
|
+
import '@material/mwc-icon';
|
|
10
|
+
import { TemplateResult } from 'lit';
|
|
11
|
+
declare const _default: {
|
|
12
|
+
title: string;
|
|
13
|
+
component: string;
|
|
14
|
+
argTypes: {};
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
17
|
+
interface Story<T> {
|
|
18
|
+
(args: T): TemplateResult;
|
|
19
|
+
args?: Partial<T>;
|
|
20
|
+
argTypes?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
interface ArgTypes {
|
|
23
|
+
}
|
|
24
|
+
export declare const Regular: Story<ArgTypes>;
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import '@operato/property-editor/ox-property-editor-checkbox.js';
|
|
3
|
+
import '@operato/property-editor/ox-property-editor-number.js';
|
|
4
|
+
import '@operato/property-editor/ox-property-editor-string.js';
|
|
5
|
+
import '@operato/property-editor/ox-property-editor-options.js';
|
|
6
|
+
import '@operato/property-editor/ox-properties-dynamic-view.js';
|
|
7
|
+
import '@operato/data-grist';
|
|
8
|
+
import '@operato/data-grist/ox-filters-form.js';
|
|
9
|
+
import '@operato/data-grist/ox-sorters-control.js';
|
|
10
|
+
import '@material/mwc-icon';
|
|
11
|
+
/* set grist-editors */
|
|
12
|
+
import { css, html, LitElement } from 'lit';
|
|
13
|
+
import { state } from 'lit/decorators.js';
|
|
14
|
+
import { OxGristRendererJson5, registerEditor, registerRenderer } from '@operato/data-grist';
|
|
15
|
+
import { i18next } from '@operato/i18n';
|
|
16
|
+
import { OxPropertyEditor } from '@operato/property-editor';
|
|
17
|
+
import { CommonGristStyles } from '@operato/styles';
|
|
18
|
+
import { OxGristEditorCrontab } from '../src/ox-grist-editor-crontab.js';
|
|
19
|
+
import { OxGristEditorDuration } from '../src/ox-grist-editor-duration.js';
|
|
20
|
+
import { OxGristEditorParameters } from '../src/ox-grist-editor-parameters.js';
|
|
21
|
+
import { OxGristEditorPartitionKeys } from '../src/ox-grist-editor-partition-keys.js';
|
|
22
|
+
// import { OxGristRendererCrontab } from '../src/ox-grist-renderer-crontab.js'
|
|
23
|
+
import { OxGristEditorValueMap } from '../src/ox-grist-editor-value-map.js';
|
|
24
|
+
// import { OxGristEditorJson } from './ox-grist-editor-json.js'
|
|
25
|
+
// import { OxGristRendererCrontab } from '../src/ox-grist-renderer-crontab.js'
|
|
26
|
+
OxPropertyEditor.register({
|
|
27
|
+
number: 'ox-property-editor-number',
|
|
28
|
+
string: 'ox-property-editor-string',
|
|
29
|
+
boolean: 'ox-property-editor-checkbox',
|
|
30
|
+
options: 'ox-property-editor-options'
|
|
31
|
+
});
|
|
32
|
+
registerEditor('parameters', OxGristEditorParameters);
|
|
33
|
+
registerEditor('crontab', OxGristEditorCrontab);
|
|
34
|
+
registerEditor('value-map', OxGristEditorValueMap);
|
|
35
|
+
registerEditor('partition-keys', OxGristEditorPartitionKeys);
|
|
36
|
+
/* register grist renderer/editor for id */
|
|
37
|
+
// registerEditor('resource-id', OxGristEditorResourceId)
|
|
38
|
+
// registerEditor('resource-object', OxGristEditorResourceObject)
|
|
39
|
+
// registerEditor('resource-code', OxGristEditorResourceCode)
|
|
40
|
+
registerEditor('parameters', OxGristEditorParameters);
|
|
41
|
+
registerEditor('value-map', OxGristEditorValueMap);
|
|
42
|
+
registerEditor('partition-keys', OxGristEditorPartitionKeys);
|
|
43
|
+
registerEditor('crontab', OxGristEditorCrontab);
|
|
44
|
+
registerEditor('duration', OxGristEditorDuration);
|
|
45
|
+
// registerEditor('json', OxGristEditorJson)
|
|
46
|
+
// registerRenderer('resource-id', OxGristRendererResourceId)
|
|
47
|
+
// registerRenderer('resource-object', OxGristRendererResourceObject)
|
|
48
|
+
registerRenderer('parameters', OxGristRendererJson5);
|
|
49
|
+
registerRenderer('value-map', OxGristRendererJson5);
|
|
50
|
+
registerRenderer('partition-keys', OxGristRendererJson5);
|
|
51
|
+
// registerRenderer('crontab', OxGristRendererCrontab)
|
|
52
|
+
const fetchHandler = async ({ page = 1, limit = 100, sortings = [], filters = [] }) => {
|
|
53
|
+
var total = 10;
|
|
54
|
+
var start = (page - 1) * limit;
|
|
55
|
+
return {
|
|
56
|
+
total,
|
|
57
|
+
records: Array(limit * page > total ? total % limit : limit)
|
|
58
|
+
.fill('')
|
|
59
|
+
.map((item, idx) => {
|
|
60
|
+
return {
|
|
61
|
+
id: idx,
|
|
62
|
+
name: `name-${start + idx + 1}`,
|
|
63
|
+
description: `description-${start + idx + 1}`,
|
|
64
|
+
sequence: idx + 1,
|
|
65
|
+
active: true,
|
|
66
|
+
tag: `tag-${idx + 1}`,
|
|
67
|
+
type: idx % 3 === 0 ? 'select' : idx % 3 === 1 ? 'number' : 'string',
|
|
68
|
+
spec: {
|
|
69
|
+
ccp: {
|
|
70
|
+
criticalLimits: 100,
|
|
71
|
+
targetLimits: 200
|
|
72
|
+
},
|
|
73
|
+
qc: {
|
|
74
|
+
criticalLimits: 300,
|
|
75
|
+
targetLimits: true
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
options: idx % 2 === 0
|
|
79
|
+
? {
|
|
80
|
+
options: [
|
|
81
|
+
{
|
|
82
|
+
text: 'A',
|
|
83
|
+
value: 'a'
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
text: 'B',
|
|
87
|
+
value: 'b'
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
: undefined,
|
|
92
|
+
schedule: '* * * * * *',
|
|
93
|
+
keyvalue: {},
|
|
94
|
+
createdAt: Date.now(),
|
|
95
|
+
updatedAt: Date.now()
|
|
96
|
+
};
|
|
97
|
+
})
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
class GristDemo extends LitElement {
|
|
101
|
+
constructor() {
|
|
102
|
+
super(...arguments);
|
|
103
|
+
this.mode = 'CARD';
|
|
104
|
+
this.config = {
|
|
105
|
+
list: { fields: ['name', 'description', 'active'] },
|
|
106
|
+
columns: [
|
|
107
|
+
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
108
|
+
{
|
|
109
|
+
type: 'gutter',
|
|
110
|
+
gutterName: 'button',
|
|
111
|
+
icon: 'add',
|
|
112
|
+
handlers: {
|
|
113
|
+
click: 'record-copy'
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
117
|
+
{
|
|
118
|
+
type: 'gutter',
|
|
119
|
+
gutterName: 'button',
|
|
120
|
+
icon: 'arrow_upward',
|
|
121
|
+
handlers: {
|
|
122
|
+
click: 'move-up'
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
type: 'gutter',
|
|
127
|
+
gutterName: 'button',
|
|
128
|
+
icon: 'arrow_downward',
|
|
129
|
+
handlers: {
|
|
130
|
+
click: 'move-down'
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
type: 'number',
|
|
135
|
+
name: 'sequence',
|
|
136
|
+
hidden: true
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
type: 'string',
|
|
140
|
+
name: 'id',
|
|
141
|
+
hidden: true
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
type: 'string',
|
|
145
|
+
name: 'name',
|
|
146
|
+
header: i18next.t('field.name'),
|
|
147
|
+
record: {
|
|
148
|
+
editable: true
|
|
149
|
+
},
|
|
150
|
+
width: 140
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
type: 'string',
|
|
154
|
+
name: 'description',
|
|
155
|
+
header: i18next.t('field.description'),
|
|
156
|
+
record: {
|
|
157
|
+
editable: true
|
|
158
|
+
},
|
|
159
|
+
width: 180
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
type: 'checkbox',
|
|
163
|
+
name: 'active',
|
|
164
|
+
label: true,
|
|
165
|
+
header: i18next.t('field.active'),
|
|
166
|
+
record: {
|
|
167
|
+
editable: true
|
|
168
|
+
},
|
|
169
|
+
sortable: true,
|
|
170
|
+
width: 60
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
type: 'string',
|
|
174
|
+
name: 'tag',
|
|
175
|
+
header: i18next.t('field.tag'),
|
|
176
|
+
record: {
|
|
177
|
+
editable: true
|
|
178
|
+
},
|
|
179
|
+
width: 180
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
type: 'select',
|
|
183
|
+
name: 'type',
|
|
184
|
+
header: i18next.t('field.type'),
|
|
185
|
+
record: {
|
|
186
|
+
options: ['', 'number', 'text', 'select', 'boolean', 'file'],
|
|
187
|
+
editable: true
|
|
188
|
+
},
|
|
189
|
+
width: 120
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
type: 'crontab',
|
|
193
|
+
name: 'schedule',
|
|
194
|
+
header: i18next.t('field.schedule'),
|
|
195
|
+
record: {
|
|
196
|
+
editable: true
|
|
197
|
+
},
|
|
198
|
+
width: 120
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
type: 'partition-keys',
|
|
202
|
+
name: 'keyvalue',
|
|
203
|
+
header: i18next.t('field.keyvalue'),
|
|
204
|
+
record: {
|
|
205
|
+
editable: true,
|
|
206
|
+
options: {
|
|
207
|
+
objectified: true,
|
|
208
|
+
valuetype: 'string'
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
width: 120
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
type: 'parameters',
|
|
215
|
+
name: 'options',
|
|
216
|
+
header: i18next.t('field.options'),
|
|
217
|
+
record: {
|
|
218
|
+
editable: true,
|
|
219
|
+
renderer: (value) => {
|
|
220
|
+
return typeof value === 'string' ? value : typeof value === 'object' ? JSON.stringify(value) : '';
|
|
221
|
+
},
|
|
222
|
+
options: async (value, column, record, row, field) => {
|
|
223
|
+
return {
|
|
224
|
+
name: record.type,
|
|
225
|
+
help: '',
|
|
226
|
+
spec: record.type === 'select'
|
|
227
|
+
? [
|
|
228
|
+
{
|
|
229
|
+
type: 'options',
|
|
230
|
+
name: 'options',
|
|
231
|
+
label: 'options'
|
|
232
|
+
}
|
|
233
|
+
]
|
|
234
|
+
: [],
|
|
235
|
+
context: this.grist,
|
|
236
|
+
objectified: true /* tell parameters editor not to need to parse */
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
width: 120
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
type: 'string',
|
|
244
|
+
name: 'unit',
|
|
245
|
+
header: i18next.t('field.unit'),
|
|
246
|
+
record: {
|
|
247
|
+
editable: true
|
|
248
|
+
},
|
|
249
|
+
width: 120
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
type: 'number',
|
|
253
|
+
name: 'quota',
|
|
254
|
+
header: i18next.t('field.quota'),
|
|
255
|
+
record: {
|
|
256
|
+
editable: true
|
|
257
|
+
},
|
|
258
|
+
width: 60
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
type: 'crontab',
|
|
262
|
+
name: 'spec',
|
|
263
|
+
header: i18next.t('field.spec'),
|
|
264
|
+
record: {
|
|
265
|
+
editable: true,
|
|
266
|
+
options: {
|
|
267
|
+
name,
|
|
268
|
+
objectified: true
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
width: 200
|
|
272
|
+
}
|
|
273
|
+
],
|
|
274
|
+
rows: {
|
|
275
|
+
selectable: {
|
|
276
|
+
multiple: true
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
pagination: {
|
|
280
|
+
infinite: true
|
|
281
|
+
},
|
|
282
|
+
sorters: [
|
|
283
|
+
{
|
|
284
|
+
name: 'sequence'
|
|
285
|
+
}
|
|
286
|
+
]
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
get grist() {
|
|
290
|
+
return this.renderRoot.querySelector('ox-grist');
|
|
291
|
+
}
|
|
292
|
+
render() {
|
|
293
|
+
const mode = this.mode || 'CARD';
|
|
294
|
+
return html `
|
|
295
|
+
<ox-grist .config=${this.config} .mode=${mode} auto-fetch .fetchHandler=${fetchHandler}>
|
|
296
|
+
<div id="filters" slot="headroom">
|
|
297
|
+
<ox-filters-form @filters-change=${(e) => console.log('changed', e.detail)}></ox-filters-form>
|
|
298
|
+
</div>
|
|
299
|
+
|
|
300
|
+
<div slot="headroom" id="headroom">
|
|
301
|
+
<div id="modes">
|
|
302
|
+
<mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>view_list</mwc-icon>
|
|
303
|
+
<mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>menu</mwc-icon>
|
|
304
|
+
<mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
</ox-grist>
|
|
308
|
+
`;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
GristDemo.styles = [
|
|
312
|
+
CommonGristStyles,
|
|
313
|
+
css `
|
|
314
|
+
:host {
|
|
315
|
+
display: flex;
|
|
316
|
+
flex-direction: column;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
#tailer {
|
|
320
|
+
display: flex;
|
|
321
|
+
flex-direction: row;
|
|
322
|
+
margin: 0 var(--margin-default);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
#tailer a {
|
|
326
|
+
padding: 0 var(--padding-default) 0 var(--padding-default);
|
|
327
|
+
margin: 0 var(--margin-narrow);
|
|
328
|
+
border-right: 1px solid rgba(0, 0, 0, 0.1);
|
|
329
|
+
font-size: var(--fontsize-default);
|
|
330
|
+
color: var(--primary-color);
|
|
331
|
+
}
|
|
332
|
+
`
|
|
333
|
+
];
|
|
334
|
+
__decorate([
|
|
335
|
+
state()
|
|
336
|
+
], GristDemo.prototype, "mode", void 0);
|
|
337
|
+
customElements.define('ox-grist-demo', GristDemo);
|
|
338
|
+
export default {
|
|
339
|
+
title: 'ox-grist-editor-crontab',
|
|
340
|
+
component: 'ox-grist-editor-crontab',
|
|
341
|
+
argTypes: {}
|
|
342
|
+
};
|
|
343
|
+
const Template = ({}) => html `
|
|
344
|
+
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
|
|
345
|
+
<link href="/themes/app-theme.css" rel="stylesheet" />
|
|
346
|
+
<link href="/themes/oops-theme.css" rel="stylesheet" />
|
|
347
|
+
<link href="/themes/grist-theme.css" rel="stylesheet" />
|
|
348
|
+
|
|
349
|
+
<style>
|
|
350
|
+
[slot='headroom'] {
|
|
351
|
+
display: flex;
|
|
352
|
+
flex-direction: row;
|
|
353
|
+
align-items: center;
|
|
354
|
+
padding: var(--padding-default) var(--padding-wide);
|
|
355
|
+
border-top: 2px solid rgba(0, 0, 0, 0.2);
|
|
356
|
+
background-color: var(--theme-white-color);
|
|
357
|
+
box-shadow: var(--box-shadow);
|
|
358
|
+
|
|
359
|
+
--mdc-icon-size: 24px;
|
|
360
|
+
}
|
|
361
|
+
#sorters mwc-icon,
|
|
362
|
+
#modes mwc-icon {
|
|
363
|
+
--mdc-icon-size: 18px;
|
|
364
|
+
}
|
|
365
|
+
#sorters {
|
|
366
|
+
margin-left: auto;
|
|
367
|
+
margin-right: var(--margin-default);
|
|
368
|
+
padding-left: var(--padding-narrow);
|
|
369
|
+
border-bottom: var(--border-dark-color);
|
|
370
|
+
position: relative;
|
|
371
|
+
color: var(--secondary-color);
|
|
372
|
+
font-size: var(--fontsize-default);
|
|
373
|
+
user-select: none;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
#sorters > * {
|
|
377
|
+
padding: var(--padding-narrow);
|
|
378
|
+
vertical-align: middle;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
#filters {
|
|
382
|
+
display: flex;
|
|
383
|
+
justify-content: center;
|
|
384
|
+
align-items: center;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
#filters * {
|
|
388
|
+
margin-right: var(--margin-default);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
@media only screen and (max-width: 460px) {
|
|
392
|
+
#filters {
|
|
393
|
+
flex-direction: column;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
#modes {
|
|
397
|
+
display: none;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
</style>
|
|
401
|
+
|
|
402
|
+
<ox-grist-demo mode="LIST"></ox-grist-demo>
|
|
403
|
+
`;
|
|
404
|
+
export const Regular = Template.bind({});
|
|
405
|
+
Regular.args = {};
|
|
406
|
+
//# sourceMappingURL=ox-grist-editor-crontab.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-grist-editor-crontab.stories.js","sourceRoot":"","sources":["../../stories/ox-grist-editor-crontab.stories.ts"],"names":[],"mappings":";AAAA,OAAO,yDAAyD,CAAA;AAChE,OAAO,uDAAuD,CAAA;AAC9D,OAAO,uDAAuD,CAAA;AAC9D,OAAO,wDAAwD,CAAA;AAC/D,OAAO,wDAAw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,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG,EAAE,CAAA","sourcesContent":["import '@operato/property-editor/ox-property-editor-checkbox.js'\nimport '@operato/property-editor/ox-property-editor-number.js'\nimport '@operato/property-editor/ox-property-editor-string.js'\nimport '@operato/property-editor/ox-property-editor-options.js'\nimport '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/data-grist'\nimport '@operato/data-grist/ox-filters-form.js'\nimport '@operato/data-grist/ox-sorters-control.js'\nimport '@material/mwc-icon'\n\n/* set grist-editors */\nimport { css, html, LitElement, TemplateResult } from 'lit'\nimport { state } from 'lit/decorators.js'\n\nimport { FetchOption, GristRecord, OxGristRendererJson5, registerEditor, registerRenderer } from '@operato/data-grist'\nimport { i18next } from '@operato/i18n'\nimport { OxPropertyEditor } from '@operato/property-editor'\nimport { CommonGristStyles } from '@operato/styles'\n\nimport { OxGristEditorCrontab } from '../src/ox-grist-editor-crontab.js'\nimport { OxGristEditorDuration } from '../src/ox-grist-editor-duration.js'\nimport { OxGristEditorParameters } from '../src/ox-grist-editor-parameters.js'\nimport { OxGristEditorPartitionKeys } from '../src/ox-grist-editor-partition-keys.js'\n// import { OxGristRendererCrontab } from '../src/ox-grist-renderer-crontab.js'\nimport { OxGristEditorValueMap } from '../src/ox-grist-editor-value-map.js'\n\n// import { OxGristEditorJson } from './ox-grist-editor-json.js'\n// import { OxGristRendererCrontab } from '../src/ox-grist-renderer-crontab.js'\n\nOxPropertyEditor.register({\n number: 'ox-property-editor-number',\n string: 'ox-property-editor-string',\n boolean: 'ox-property-editor-checkbox',\n options: 'ox-property-editor-options'\n})\n\nregisterEditor('parameters', OxGristEditorParameters)\nregisterEditor('crontab', OxGristEditorCrontab)\nregisterEditor('value-map', OxGristEditorValueMap)\nregisterEditor('partition-keys', OxGristEditorPartitionKeys)\n\n/* register grist renderer/editor for id */\n// registerEditor('resource-id', OxGristEditorResourceId)\n// registerEditor('resource-object', OxGristEditorResourceObject)\n// registerEditor('resource-code', OxGristEditorResourceCode)\nregisterEditor('parameters', OxGristEditorParameters)\nregisterEditor('value-map', OxGristEditorValueMap)\nregisterEditor('partition-keys', OxGristEditorPartitionKeys)\nregisterEditor('crontab', OxGristEditorCrontab)\nregisterEditor('duration', OxGristEditorDuration)\n// registerEditor('json', OxGristEditorJson)\n\n// registerRenderer('resource-id', OxGristRendererResourceId)\n// registerRenderer('resource-object', OxGristRendererResourceObject)\nregisterRenderer('parameters', OxGristRendererJson5)\nregisterRenderer('value-map', OxGristRendererJson5)\nregisterRenderer('partition-keys', OxGristRendererJson5)\n// registerRenderer('crontab', OxGristRendererCrontab)\n\nconst fetchHandler = async ({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) => {\n var total = 10\n var start = (page - 1) * limit\n\n return {\n total,\n records: Array(limit * page > total ? total % limit : limit)\n .fill('')\n .map((item, idx) => {\n return {\n id: idx,\n name: `name-${start + idx + 1}`,\n description: `description-${start + idx + 1}`,\n sequence: idx + 1,\n active: true,\n tag: `tag-${idx + 1}`,\n type: idx % 3 === 0 ? 'select' : idx % 3 === 1 ? 'number' : 'string',\n spec: {\n ccp: {\n criticalLimits: 100,\n targetLimits: 200\n },\n qc: {\n criticalLimits: 300,\n targetLimits: true\n }\n },\n options:\n idx % 2 === 0\n ? {\n options: [\n {\n text: 'A',\n value: 'a'\n },\n {\n text: 'B',\n value: 'b'\n }\n ]\n }\n : undefined,\n schedule: '* * * * * *',\n keyvalue: {},\n createdAt: Date.now(),\n updatedAt: Date.now()\n }\n })\n }\n}\n\nclass GristDemo extends LitElement {\n static styles = [\n CommonGristStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n }\n\n #tailer {\n display: flex;\n flex-direction: row;\n margin: 0 var(--margin-default);\n }\n\n #tailer a {\n padding: 0 var(--padding-default) 0 var(--padding-default);\n margin: 0 var(--margin-narrow);\n border-right: 1px solid rgba(0, 0, 0, 0.1);\n font-size: var(--fontsize-default);\n color: var(--primary-color);\n }\n `\n ]\n\n @state() mode: String = 'CARD'\n\n get grist() {\n return this.renderRoot.querySelector('ox-grist')\n }\n\n config: any = {\n list: { fields: ['name', 'description', 'active'] },\n columns: [\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'add',\n handlers: {\n click: 'record-copy'\n }\n },\n { type: 'gutter', gutterName: 'sequence' },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'arrow_upward',\n handlers: {\n click: 'move-up'\n }\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'arrow_downward',\n handlers: {\n click: 'move-down'\n }\n },\n {\n type: 'number',\n name: 'sequence',\n hidden: true\n },\n {\n type: 'string',\n name: 'id',\n hidden: true\n },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: true\n },\n width: 140\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n width: 180\n },\n {\n type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: {\n editable: true\n },\n sortable: true,\n width: 60\n },\n {\n type: 'string',\n name: 'tag',\n header: i18next.t('field.tag'),\n record: {\n editable: true\n },\n width: 180\n },\n {\n type: 'select',\n name: 'type',\n header: i18next.t('field.type'),\n record: {\n options: ['', 'number', 'text', 'select', 'boolean', 'file'],\n editable: true\n },\n width: 120\n },\n {\n type: 'crontab',\n name: 'schedule',\n header: i18next.t('field.schedule'),\n record: {\n editable: true\n },\n width: 120\n },\n {\n type: 'partition-keys',\n name: 'keyvalue',\n header: i18next.t('field.keyvalue'),\n record: {\n editable: true,\n options: {\n objectified: true,\n valuetype: 'string'\n }\n },\n width: 120\n },\n {\n type: 'parameters',\n name: 'options',\n header: i18next.t('field.options'),\n record: {\n editable: true,\n renderer: (value: any) => {\n return typeof value === 'string' ? value : typeof value === 'object' ? JSON.stringify(value) : ''\n },\n options: async (value: any, column: any, record: GristRecord, row: GristRecord, field: any) => {\n return {\n name: record.type,\n help: '',\n spec:\n record.type === 'select'\n ? [\n {\n type: 'options',\n name: 'options',\n label: 'options'\n }\n ]\n : [],\n context: this.grist,\n objectified: true /* tell parameters editor not to need to parse */\n }\n }\n },\n width: 120\n },\n {\n type: 'string',\n name: 'unit',\n header: i18next.t('field.unit'),\n record: {\n editable: true\n },\n width: 120\n },\n {\n type: 'number',\n name: 'quota',\n header: i18next.t('field.quota'),\n record: {\n editable: true\n },\n width: 60\n },\n {\n type: 'crontab',\n name: 'spec',\n header: i18next.t('field.spec'),\n record: {\n editable: true,\n options: {\n name,\n objectified: true\n }\n },\n width: 200\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n pagination: {\n infinite: true\n },\n sorters: [\n {\n name: 'sequence'\n }\n ]\n }\n\n render() {\n const mode = this.mode || 'CARD'\n\n return html`\n <ox-grist .config=${this.config} .mode=${mode} auto-fetch .fetchHandler=${fetchHandler}>\n <div id=\"filters\" slot=\"headroom\">\n <ox-filters-form @filters-change=${(e: CustomEvent) => console.log('changed', e.detail)}></ox-filters-form>\n </div>\n\n <div slot=\"headroom\" id=\"headroom\">\n <div id=\"modes\">\n <mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>view_list</mwc-icon>\n <mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>menu</mwc-icon>\n <mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>\n </div>\n </div>\n </ox-grist>\n `\n }\n}\n\ncustomElements.define('ox-grist-demo', GristDemo)\n\nexport default {\n title: 'ox-grist-editor-crontab',\n component: 'ox-grist-editor-crontab',\n argTypes: {}\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {}\n\nconst Template: Story<ArgTypes> = ({}: ArgTypes) =>\n html`\n <link href=\"https://fonts.googleapis.com/css?family=Material+Icons&display=block\" rel=\"stylesheet\" />\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 border-top: 2px solid rgba(0, 0, 0, 0.2);\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 #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-demo mode=\"LIST\"></ox-grist-demo>\n `\n\nexport const Regular = Template.bind({})\nRegular.args = {}\n"]}
|