@operato/data-grist 8.2.19 → 8.2.22
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 +25 -0
- package/dist/src/data-grid/data-grid-body-style.js +1 -1
- package/dist/src/data-grid/data-grid-body-style.js.map +1 -1
- package/dist/src/data-grid/data-grid-body.d.ts +15 -1
- package/dist/src/data-grid/data-grid-body.js +274 -49
- package/dist/src/data-grid/data-grid-body.js.map +1 -1
- package/dist/src/data-grid/event-handlers/data-grid-body-keydown-handler.js +36 -5
- package/dist/src/data-grid/event-handlers/data-grid-body-keydown-handler.js.map +1 -1
- package/dist/src/editors/ox-grist-editor.js +3 -0
- package/dist/src/editors/ox-grist-editor.js.map +1 -1
- package/dist/src/gutters/gutter-row-selector.js +4 -0
- package/dist/src/gutters/gutter-row-selector.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/src/editors/ox-grist-editor-json5.d.ts +0 -8
- package/dist/src/editors/ox-grist-editor-json5.js +0 -66
- package/dist/src/editors/ox-grist-editor-json5.js.map +0 -1
- package/dist/src/editors/ox-grist-editor-secret.d.ts +0 -5
- package/dist/src/editors/ox-grist-editor-secret.js +0 -23
- package/dist/src/editors/ox-grist-editor-secret.js.map +0 -1
- package/dist/src/editors/ox-grist-editor-timezone.d.ts +0 -6
- package/dist/src/editors/ox-grist-editor-timezone.js +0 -41
- package/dist/src/editors/ox-grist-editor-timezone.js.map +0 -1
- package/dist/src/editors/ox-popup-code-input.d.ts +0 -14
- package/dist/src/editors/ox-popup-code-input.js +0 -78
- package/dist/src/editors/ox-popup-code-input.js.map +0 -1
- package/dist/src/renderers/ox-grist-renderer-secret.d.ts +0 -2
- package/dist/src/renderers/ox-grist-renderer-secret.js +0 -77
- package/dist/src/renderers/ox-grist-renderer-secret.js.map +0 -1
- package/dist/stories/append-position.stories.d.ts +0 -8
- package/dist/stories/append-position.stories.js +0 -183
- package/dist/stories/append-position.stories.js.map +0 -1
- package/dist/stories/secret.stories.d.ts +0 -37
- package/dist/stories/secret.stories.js +0 -219
- package/dist/stories/secret.stories.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/data-grist",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.22",
|
|
4
4
|
"description": "User interface for grid (desktop) and list (mobile)",
|
|
5
5
|
"author": "heartyoh",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"prettier --write"
|
|
109
109
|
]
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "20482100c0d80ab15d0b19dafe9c07ae3dedffec"
|
|
112
112
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import './ox-popup-code-input.js';
|
|
2
|
-
import { OxGristEditor } from './ox-grist-editor.js';
|
|
3
|
-
export declare class OxGristEditorJson5 extends OxGristEditor {
|
|
4
|
-
get editorTemplate(): import("lit-html").TemplateResult<1>;
|
|
5
|
-
_onclick(e: Event): void;
|
|
6
|
-
_onkeydown(e: KeyboardEvent): void;
|
|
7
|
-
showEditorPopup(): void;
|
|
8
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import './ox-popup-code-input.js';
|
|
3
|
-
import { html } from 'lit';
|
|
4
|
-
import { customElement } from 'lit/decorators.js';
|
|
5
|
-
import JSON5 from 'json5';
|
|
6
|
-
import { OxGristEditor } from './ox-grist-editor.js';
|
|
7
|
-
import { i18next } from '@operato/i18n';
|
|
8
|
-
import { openPopup } from '@operato/layout';
|
|
9
|
-
let OxGristEditorJson5 = class OxGristEditorJson5 extends OxGristEditor {
|
|
10
|
-
get editorTemplate() {
|
|
11
|
-
var parsed = this.value;
|
|
12
|
-
if (typeof this.value === 'string') {
|
|
13
|
-
try {
|
|
14
|
-
parsed = JSON5.parse(this.value);
|
|
15
|
-
}
|
|
16
|
-
catch (_a) { }
|
|
17
|
-
}
|
|
18
|
-
const text = parsed == null ? '' : JSON5.stringify(parsed);
|
|
19
|
-
return html ` <div tabindex="0">${text}</div> `;
|
|
20
|
-
}
|
|
21
|
-
_onclick(e) {
|
|
22
|
-
e.stopPropagation();
|
|
23
|
-
this.showEditorPopup();
|
|
24
|
-
}
|
|
25
|
-
_onkeydown(e) {
|
|
26
|
-
const key = e.key;
|
|
27
|
-
if (key == 'Enter') {
|
|
28
|
-
e.stopPropagation();
|
|
29
|
-
this.showEditorPopup();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
showEditorPopup() {
|
|
33
|
-
var _a;
|
|
34
|
-
var { mode, language = 'javascript' } = ((_a = this.column.record) === null || _a === void 0 ? void 0 : _a.options) || {};
|
|
35
|
-
var change = (value) => {
|
|
36
|
-
this.dispatchEvent(new CustomEvent('field-change', {
|
|
37
|
-
bubbles: true,
|
|
38
|
-
composed: true,
|
|
39
|
-
detail: {
|
|
40
|
-
before: this.value,
|
|
41
|
-
after: value,
|
|
42
|
-
column: this.column,
|
|
43
|
-
record: this.record,
|
|
44
|
-
row: this.row
|
|
45
|
-
}
|
|
46
|
-
}));
|
|
47
|
-
};
|
|
48
|
-
var popup = openPopup(html `
|
|
49
|
-
<ox-popup-code-input
|
|
50
|
-
.value=${this.value}
|
|
51
|
-
mode=${mode}
|
|
52
|
-
.confirmCallback=${change.bind(this)}
|
|
53
|
-
language=${language}
|
|
54
|
-
></ox-popup-code-input>
|
|
55
|
-
`, {
|
|
56
|
-
backdrop: true,
|
|
57
|
-
title: i18next.t('title.edit code'),
|
|
58
|
-
help: 'data-grist/grist-editor/code'
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
OxGristEditorJson5 = __decorate([
|
|
63
|
-
customElement('ox-grist-editor-json5')
|
|
64
|
-
], OxGristEditorJson5);
|
|
65
|
-
export { OxGristEditorJson5 };
|
|
66
|
-
//# sourceMappingURL=ox-grist-editor-json5.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ox-grist-editor-json5.js","sourceRoot":"","sources":["../../../src/editors/ox-grist-editor-json5.ts"],"names":[],"mappings":";AAAA,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAGpC,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,aAAa;IACnD,IAAI,cAAc;QAChB,IAAI,MAAM,GAAQ,IAAI,CAAC,KAAK,CAAA;QAE5B,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;YACnC,IAAI,CAAC;gBACH,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YAClC,CAAC;YAAC,WAAM,CAAC,CAAA,CAAC;QACZ,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QAE1D,OAAO,IAAI,CAAA,sBAAsB,IAAI,SAAS,CAAA;IAChD,CAAC;IAED,QAAQ,CAAC,CAAQ;QACf,CAAC,CAAC,eAAe,EAAE,CAAA;QACnB,IAAI,CAAC,eAAe,EAAE,CAAA;IACxB,CAAC;IAED,UAAU,CAAC,CAAgB;QACzB,MAAM,GAAG,GAAG,CAAC,CAAC,GAAG,CAAA;QACjB,IAAI,GAAG,IAAI,OAAO,EAAE,CAAC;YACnB,CAAC,CAAC,eAAe,EAAE,CAAA;YACnB,IAAI,CAAC,eAAe,EAAE,CAAA;QACxB,CAAC;IACH,CAAC;IAED,eAAe;;QACb,IAAI,EAAE,IAAI,EAAE,QAAQ,GAAG,YAAY,EAAE,GAAG,CAAA,MAAA,IAAI,CAAC,MAAM,CAAC,MAAM,0CAAE,OAAO,KAAI,EAAE,CAAA;QAEzE,IAAI,MAAM,GAAG,CAAC,KAAa,EAAE,EAAE;YAC7B,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,cAAc,EAAE;gBAC9B,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE;oBACN,MAAM,EAAE,IAAI,CAAC,KAAK;oBAClB,KAAK,EAAE,KAAK;oBACZ,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,GAAG,EAAE,IAAI,CAAC,GAAG;iBACd;aACF,CAAC,CACH,CAAA;QACH,CAAC,CAAA;QAED,IAAI,KAAK,GAAG,SAAS,CACnB,IAAI,CAAA;;mBAES,IAAI,CAAC,KAAK;iBACZ,IAAI;6BACQ,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;qBACzB,QAAQ;;OAEtB,EACD;YACE,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC;YACnC,IAAI,EAAE,8BAA8B;SACrC,CACF,CAAA;IACH,CAAC;CACF,CAAA;AA/DY,kBAAkB;IAD9B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,kBAAkB,CA+D9B","sourcesContent":["import './ox-popup-code-input.js'\n\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport JSON5 from 'json5'\n\nimport { OxGristEditor } from './ox-grist-editor.js'\nimport { i18next } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\n\n@customElement('ox-grist-editor-json5')\nexport class OxGristEditorJson5 extends OxGristEditor {\n get editorTemplate() {\n var parsed: any = this.value\n\n if (typeof this.value === 'string') {\n try {\n parsed = JSON5.parse(this.value)\n } catch {}\n }\n\n const text = parsed == null ? '' : JSON5.stringify(parsed)\n\n return html` <div tabindex=\"0\">${text}</div> `\n }\n\n _onclick(e: Event): void {\n e.stopPropagation()\n this.showEditorPopup()\n }\n\n _onkeydown(e: KeyboardEvent): void {\n const key = e.key\n if (key == 'Enter') {\n e.stopPropagation()\n this.showEditorPopup()\n }\n }\n\n showEditorPopup() {\n var { mode, language = 'javascript' } = this.column.record?.options || {}\n\n var change = (value: string) => {\n this.dispatchEvent(\n new CustomEvent('field-change', {\n bubbles: true,\n composed: true,\n detail: {\n before: this.value,\n after: value,\n column: this.column,\n record: this.record,\n row: this.row\n }\n })\n )\n }\n\n var popup = openPopup(\n html`\n <ox-popup-code-input\n .value=${this.value}\n mode=${mode}\n .confirmCallback=${change.bind(this)}\n language=${language}\n ></ox-popup-code-input>\n `,\n {\n backdrop: true,\n title: i18next.t('title.edit code'),\n help: 'data-grist/grist-editor/code'\n }\n )\n }\n}\n"]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import '@operato/input/ox-input-secret.js';
|
|
3
|
-
import { OxGristEditor } from './ox-grist-editor.js';
|
|
4
|
-
import { customElement } from 'lit/decorators.js';
|
|
5
|
-
import { html } from 'lit';
|
|
6
|
-
let OxGristEditorSecret = class OxGristEditorSecret extends OxGristEditor {
|
|
7
|
-
get editorTemplate() {
|
|
8
|
-
return html `
|
|
9
|
-
<ox-input-secret
|
|
10
|
-
.value=${this.value}
|
|
11
|
-
@change=${this._onchange}
|
|
12
|
-
@keydown=${this._onkeydown}
|
|
13
|
-
@focusout=${this._onfocusout}
|
|
14
|
-
>
|
|
15
|
-
</ox-input-secret>
|
|
16
|
-
`;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
OxGristEditorSecret = __decorate([
|
|
20
|
-
customElement('ox-grist-editor-secret')
|
|
21
|
-
], OxGristEditorSecret);
|
|
22
|
-
export { OxGristEditorSecret };
|
|
23
|
-
//# sourceMappingURL=ox-grist-editor-secret.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ox-grist-editor-secret.js","sourceRoot":"","sources":["../../../src/editors/ox-grist-editor-secret.ts"],"names":[],"mappings":";AAAA,OAAO,mCAAmC,CAAA;AAE1C,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,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,aAAa;IACpD,IAAI,cAAc;QAChB,OAAO,IAAI,CAAA;;iBAEE,IAAI,CAAC,KAAK;kBACT,IAAI,CAAC,SAAS;mBACb,IAAI,CAAC,UAAU;oBACd,IAAI,CAAC,WAAW;;;KAG/B,CAAA;IACH,CAAC;CACF,CAAA;AAZY,mBAAmB;IAD/B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,mBAAmB,CAY/B","sourcesContent":["import '@operato/input/ox-input-secret.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-secret')\nexport class OxGristEditorSecret extends OxGristEditor {\n get editorTemplate() {\n return html`\n <ox-input-secret\n .value=${this.value}\n @change=${this._onchange}\n @keydown=${this._onkeydown}\n @focusout=${this._onfocusout}\n >\n </ox-input-secret>\n `\n }\n}\n"]}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
var OxGristEditorTimezone_1;
|
|
2
|
-
import { __decorate } from "tslib";
|
|
3
|
-
import { OxGristEditor } from './ox-grist-editor.js';
|
|
4
|
-
import { customElement } from 'lit/decorators.js';
|
|
5
|
-
import { html } from 'lit';
|
|
6
|
-
import moment from '@operato/moment-timezone-es';
|
|
7
|
-
function getSystemTimeZone() {
|
|
8
|
-
try {
|
|
9
|
-
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
10
|
-
if (!timeZone) {
|
|
11
|
-
throw new Error('Unable to resolve timeZone');
|
|
12
|
-
}
|
|
13
|
-
return timeZone;
|
|
14
|
-
}
|
|
15
|
-
catch (e) {
|
|
16
|
-
console.warn('Failed to get system timeZone, falling back to UTC.', e);
|
|
17
|
-
return 'UTC';
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
let OxGristEditorTimezone = OxGristEditorTimezone_1 = class OxGristEditorTimezone extends OxGristEditor {
|
|
21
|
-
static get TIMEZONE_OPTIONS() {
|
|
22
|
-
if (!this._timezoneOptions) {
|
|
23
|
-
const DEFAULT_TZ = getSystemTimeZone();
|
|
24
|
-
this._timezoneOptions = ['', DEFAULT_TZ, ...moment.tz.names().filter((tz) => tz !== DEFAULT_TZ)];
|
|
25
|
-
}
|
|
26
|
-
return this._timezoneOptions;
|
|
27
|
-
}
|
|
28
|
-
get editorTemplate() {
|
|
29
|
-
return html `
|
|
30
|
-
<select>
|
|
31
|
-
${OxGristEditorTimezone_1.TIMEZONE_OPTIONS.map((tz) => html ` <option ?selected=${tz == this.value} value=${tz}>${tz}</option> `)}
|
|
32
|
-
</select>
|
|
33
|
-
`;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
OxGristEditorTimezone._timezoneOptions = null;
|
|
37
|
-
OxGristEditorTimezone = OxGristEditorTimezone_1 = __decorate([
|
|
38
|
-
customElement('ox-grist-editor-timezone')
|
|
39
|
-
], OxGristEditorTimezone);
|
|
40
|
-
export { OxGristEditorTimezone };
|
|
41
|
-
//# sourceMappingURL=ox-grist-editor-timezone.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ox-grist-editor-timezone.js","sourceRoot":"","sources":["../../../src/editors/ox-grist-editor-timezone.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,aAAa,EAA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,sCAAgB,GAAoB,IAAI,AAAxB,CAAwB;AAD5C,qBAAqB;IADjC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,qBAAqB,CAoBjC","sourcesContent":["import { OxGristEditor } from './ox-grist-editor.js'\nimport { customElement } from 'lit/decorators.js'\nimport { html } from 'lit'\nimport moment from '@operato/moment-timezone-es'\n\nfunction getSystemTimeZone(): string {\n try {\n const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone\n if (!timeZone) {\n throw new Error('Unable to resolve timeZone')\n }\n return timeZone\n } catch (e) {\n console.warn('Failed to get system timeZone, falling back to UTC.', e)\n return 'UTC'\n }\n}\n\n@customElement('ox-grist-editor-timezone')\nexport class OxGristEditorTimezone extends OxGristEditor {\n private static _timezoneOptions: string[] | null = null\n\n private static get TIMEZONE_OPTIONS() {\n if (!this._timezoneOptions) {\n const DEFAULT_TZ = getSystemTimeZone()\n this._timezoneOptions = ['', DEFAULT_TZ, ...moment.tz.names().filter((tz: string) => tz !== DEFAULT_TZ)]\n }\n return this._timezoneOptions\n }\n\n get editorTemplate() {\n return html`\n <select>\n ${OxGristEditorTimezone.TIMEZONE_OPTIONS.map(\n (tz: any) => html` <option ?selected=${tz == this.value} value=${tz}>${tz}</option> `\n )}\n </select>\n `\n }\n}\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import '@material/web/icon/icon.js';
|
|
2
|
-
import '@operato/input/ox-input-code.js';
|
|
3
|
-
import { LitElement } from 'lit';
|
|
4
|
-
export declare class OxPopupCodeInput extends LitElement {
|
|
5
|
-
static styles: import("lit").CSSResult[];
|
|
6
|
-
value: any;
|
|
7
|
-
mode: string;
|
|
8
|
-
confirmCallback: (newval: any) => void;
|
|
9
|
-
language?: string;
|
|
10
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
11
|
-
private onChange;
|
|
12
|
-
private onCancel;
|
|
13
|
-
private onConfirm;
|
|
14
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import '@material/web/icon/icon.js';
|
|
3
|
-
import '@operato/input/ox-input-code.js';
|
|
4
|
-
import { css, html, LitElement } from 'lit';
|
|
5
|
-
import { customElement, property } from 'lit/decorators.js';
|
|
6
|
-
import { i18next } from '@operato/i18n';
|
|
7
|
-
import { closePopup } from '@operato/popup';
|
|
8
|
-
import { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles';
|
|
9
|
-
let OxPopupCodeInput = class OxPopupCodeInput extends LitElement {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
this.mode = 'javascript';
|
|
13
|
-
this.language = 'javascript';
|
|
14
|
-
}
|
|
15
|
-
render() {
|
|
16
|
-
return html `
|
|
17
|
-
<ox-input-code .value=${this.value} @change=${this.onChange.bind(this)} .language=${this.language}>
|
|
18
|
-
</ox-input-code>
|
|
19
|
-
|
|
20
|
-
<div class="footer">
|
|
21
|
-
<div filler></div>
|
|
22
|
-
<button @click=${this.onCancel.bind(this)} danger>
|
|
23
|
-
<md-icon>cancel</md-icon>${i18next.t('button.cancel')}
|
|
24
|
-
</button>
|
|
25
|
-
<button @click=${this.onConfirm.bind(this)} done><md-icon>done</md-icon>${i18next.t('button.confirm')}</button>
|
|
26
|
-
</div>
|
|
27
|
-
`;
|
|
28
|
-
}
|
|
29
|
-
onChange(e) {
|
|
30
|
-
e.stopPropagation();
|
|
31
|
-
this.value = e.detail;
|
|
32
|
-
}
|
|
33
|
-
onCancel(e) {
|
|
34
|
-
closePopup(this);
|
|
35
|
-
}
|
|
36
|
-
onConfirm(e) {
|
|
37
|
-
this.confirmCallback && this.confirmCallback(this.value);
|
|
38
|
-
closePopup(this);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
OxPopupCodeInput.styles = [
|
|
42
|
-
CommonHeaderStyles,
|
|
43
|
-
ScrollbarStyles,
|
|
44
|
-
css `
|
|
45
|
-
:host {
|
|
46
|
-
display: flex;
|
|
47
|
-
flex-direction: column;
|
|
48
|
-
|
|
49
|
-
background-color: var(--md-sys-color-surface);
|
|
50
|
-
|
|
51
|
-
width: var(--overlay-center-normal-width, 50%);
|
|
52
|
-
height: var(--overlay-center-normal-height, 50%);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
ox-input-code {
|
|
56
|
-
flex: 1;
|
|
57
|
-
overflow-y: auto;
|
|
58
|
-
margin: var(--spacing-small);
|
|
59
|
-
}
|
|
60
|
-
`
|
|
61
|
-
];
|
|
62
|
-
__decorate([
|
|
63
|
-
property({ type: Object })
|
|
64
|
-
], OxPopupCodeInput.prototype, "value", void 0);
|
|
65
|
-
__decorate([
|
|
66
|
-
property({ type: String })
|
|
67
|
-
], OxPopupCodeInput.prototype, "mode", void 0);
|
|
68
|
-
__decorate([
|
|
69
|
-
property({ type: Object })
|
|
70
|
-
], OxPopupCodeInput.prototype, "confirmCallback", void 0);
|
|
71
|
-
__decorate([
|
|
72
|
-
property({ type: String })
|
|
73
|
-
], OxPopupCodeInput.prototype, "language", void 0);
|
|
74
|
-
OxPopupCodeInput = __decorate([
|
|
75
|
-
customElement('ox-popup-code-input')
|
|
76
|
-
], OxPopupCodeInput);
|
|
77
|
-
export { OxPopupCodeInput };
|
|
78
|
-
//# sourceMappingURL=ox-popup-code-input.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ox-popup-code-input.js","sourceRoot":"","sources":["../../../src/editors/ox-popup-code-input.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,iCAAiC,CAAA;AAExC,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,kBAAkB,E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;yDAAwC;AACvC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAiC;AA1BjD,gBAAgB;IAD5B,aAAa,CAAC,qBAAqB,CAAC;GACxB,gBAAgB,CAyD5B","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/input/ox-input-code.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 { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\n\n@customElement('ox-popup-code-input')\nexport class OxPopupCodeInput extends LitElement {\n static styles = [\n CommonHeaderStyles,\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: var(--md-sys-color-surface);\n\n width: var(--overlay-center-normal-width, 50%);\n height: var(--overlay-center-normal-height, 50%);\n }\n\n ox-input-code {\n flex: 1;\n overflow-y: auto;\n margin: var(--spacing-small);\n }\n `\n ]\n\n @property({ type: Object }) value: any\n @property({ type: String }) mode: string = 'javascript'\n @property({ type: Object }) confirmCallback!: (newval: any) => void\n @property({ type: String }) language?: string = 'javascript'\n\n render() {\n return html`\n <ox-input-code .value=${this.value} @change=${this.onChange.bind(this)} .language=${this.language}>\n </ox-input-code>\n\n <div class=\"footer\">\n <div filler></div>\n <button @click=${this.onCancel.bind(this)} danger>\n <md-icon>cancel</md-icon>${i18next.t('button.cancel')}\n </button>\n <button @click=${this.onConfirm.bind(this)} done><md-icon>done</md-icon>${i18next.t('button.confirm')}</button>\n </div>\n `\n }\n\n private onChange(e: CustomEvent) {\n e.stopPropagation()\n\n this.value = e.detail\n }\n\n private onCancel(e: Event) {\n closePopup(this)\n }\n\n private onConfirm(e: Event) {\n this.confirmCallback && this.confirmCallback(this.value)\n closePopup(this)\n }\n}\n"]}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { html, css } from 'lit';
|
|
2
|
-
import { i18next } from '@operato/i18n';
|
|
3
|
-
const STYLE = css `
|
|
4
|
-
.secret-container {
|
|
5
|
-
flex: 1;
|
|
6
|
-
display: flex;
|
|
7
|
-
align-items: center;
|
|
8
|
-
justify-content: space-between;
|
|
9
|
-
position: relative;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.secret-value {
|
|
13
|
-
flex: 1;
|
|
14
|
-
overflow: hidden;
|
|
15
|
-
text-overflow: ellipsis;
|
|
16
|
-
white-space: nowrap;
|
|
17
|
-
color: var(--md-sys-color-on-background);
|
|
18
|
-
font-family: inherit;
|
|
19
|
-
font-size: inherit;
|
|
20
|
-
letter-spacing: 0.5px;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.secret-toggle {
|
|
24
|
-
position: absolute;
|
|
25
|
-
right: 4px;
|
|
26
|
-
cursor: pointer;
|
|
27
|
-
font-size: 16px;
|
|
28
|
-
color: var(--md-sys-color-on-surface-variant);
|
|
29
|
-
user-select: none;
|
|
30
|
-
opacity: 0.7;
|
|
31
|
-
transition: opacity 0.2s;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.secret-toggle:hover {
|
|
35
|
-
opacity: 1;
|
|
36
|
-
color: var(--md-sys-color-primary);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.secret-container:hover .secret-toggle {
|
|
40
|
-
opacity: 1;
|
|
41
|
-
}
|
|
42
|
-
`;
|
|
43
|
-
export const OxGristRendererSecret = (value, column, record, rowIndex, field) => {
|
|
44
|
-
if (!value) {
|
|
45
|
-
return html `<span>-</span>`;
|
|
46
|
-
}
|
|
47
|
-
const toggleVisibility = (event) => {
|
|
48
|
-
event.stopPropagation();
|
|
49
|
-
const container = event.target.closest('.secret-container');
|
|
50
|
-
const valueSpan = container === null || container === void 0 ? void 0 : container.querySelector('.secret-value');
|
|
51
|
-
const icon = event.target;
|
|
52
|
-
if (!valueSpan || !icon)
|
|
53
|
-
return;
|
|
54
|
-
if (valueSpan.textContent === '••••••••••••••••') {
|
|
55
|
-
valueSpan.textContent = value;
|
|
56
|
-
icon.textContent = 'visibility';
|
|
57
|
-
icon.title = i18next.t('text.input-secret-hide');
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
valueSpan.textContent = '••••••••••••••••';
|
|
61
|
-
icon.textContent = 'visibility_off';
|
|
62
|
-
icon.title = i18next.t('text.input-secret-show');
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
return html `
|
|
66
|
-
<style>
|
|
67
|
-
${STYLE}
|
|
68
|
-
</style>
|
|
69
|
-
<div class="secret-container">
|
|
70
|
-
<span class="secret-value" title=${i18next.t('text.input-secret-placeholder')}>••••••••••••••••</span>
|
|
71
|
-
<md-icon class="secret-toggle" @click=${toggleVisibility} title=${i18next.t('text.input-secret-toggle')}>
|
|
72
|
-
visibility_off
|
|
73
|
-
</md-icon>
|
|
74
|
-
</div>
|
|
75
|
-
`;
|
|
76
|
-
};
|
|
77
|
-
//# sourceMappingURL=ox-grist-renderer-secret.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ox-grist-renderer-secret.js","sourceRoot":"","sources":["../../../src/renderers/ox-grist-renderer-secret.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAIvC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuChB,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IAC7F,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,CAAA,gBAAgB,CAAA;IAC7B,CAAC;IAED,MAAM,gBAAgB,GAAG,CAAC,KAAY,EAAE,EAAE;QACxC,KAAK,CAAC,eAAe,EAAE,CAAA;QAEvB,MAAM,SAAS,GAAI,KAAK,CAAC,MAAsB,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAA;QAC5E,MAAM,SAAS,GAAG,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,aAAa,CAAC,eAAe,CAAgB,CAAA;QAC1E,MAAM,IAAI,GAAG,KAAK,CAAC,MAAqB,CAAA;QAExC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI;YAAE,OAAM;QAE/B,IAAI,SAAS,CAAC,WAAW,KAAK,kBAAkB,EAAE,CAAC;YACjD,SAAS,CAAC,WAAW,GAAG,KAAK,CAAA;YAC7B,IAAI,CAAC,WAAW,GAAG,YAAY,CAAA;YAC/B,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAA;QAClD,CAAC;aAAM,CAAC;YACN,SAAS,CAAC,WAAW,GAAG,kBAAkB,CAAA;YAC1C,IAAI,CAAC,WAAW,GAAG,gBAAgB,CAAA;YACnC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAA;QAClD,CAAC;IACH,CAAC,CAAA;IAED,OAAO,IAAI,CAAA;;QAEL,KAAK;;;yCAG4B,OAAO,CAAC,CAAC,CAAC,+BAA+B,CAAC;8CACrC,gBAAgB,UAAU,OAAO,CAAC,CAAC,CAAC,0BAA0B,CAAC;;;;GAI1G,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { html, css } from 'lit'\nimport { i18next } from '@operato/i18n'\n\nimport { FieldRenderer } from '../types.js'\n\nconst STYLE = css`\n .secret-container {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: space-between;\n position: relative;\n }\n\n .secret-value {\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--md-sys-color-on-background);\n font-family: inherit;\n font-size: inherit;\n letter-spacing: 0.5px;\n }\n\n .secret-toggle {\n position: absolute;\n right: 4px;\n cursor: pointer;\n font-size: 16px;\n color: var(--md-sys-color-on-surface-variant);\n user-select: none;\n opacity: 0.7;\n transition: opacity 0.2s;\n }\n\n .secret-toggle:hover {\n opacity: 1;\n color: var(--md-sys-color-primary);\n }\n\n .secret-container:hover .secret-toggle {\n opacity: 1;\n }\n`\n\nexport const OxGristRendererSecret: FieldRenderer = (value, column, record, rowIndex, field) => {\n if (!value) {\n return html`<span>-</span>`\n }\n\n const toggleVisibility = (event: Event) => {\n event.stopPropagation()\n\n const container = (event.target as HTMLElement).closest('.secret-container')\n const valueSpan = container?.querySelector('.secret-value') as HTMLElement\n const icon = event.target as HTMLElement\n\n if (!valueSpan || !icon) return\n\n if (valueSpan.textContent === '••••••••••••••••') {\n valueSpan.textContent = value\n icon.textContent = 'visibility'\n icon.title = i18next.t('text.input-secret-hide')\n } else {\n valueSpan.textContent = '••••••••••••••••'\n icon.textContent = 'visibility_off'\n icon.title = i18next.t('text.input-secret-show')\n }\n }\n\n return html`\n <style>\n ${STYLE}\n </style>\n <div class=\"secret-container\">\n <span class=\"secret-value\" title=${i18next.t('text.input-secret-placeholder')}>••••••••••••••••</span>\n <md-icon class=\"secret-toggle\" @click=${toggleVisibility} title=${i18next.t('text.input-secret-toggle')}>\n visibility_off\n </md-icon>\n </div>\n `\n}\n"]}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import '../src/data-grist.js';
|
|
2
|
-
import { html } from 'lit';
|
|
3
|
-
import { CommonHeaderStyles, CommonGristStyles } from '@operato/styles';
|
|
4
|
-
import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles.js';
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Data-grist/append record position',
|
|
7
|
-
component: 'ox-grist',
|
|
8
|
-
argTypes: {}
|
|
9
|
-
};
|
|
10
|
-
const fetchHandler = async (param) => {
|
|
11
|
-
const { page = 1, limit = 10 } = param;
|
|
12
|
-
const total = 10;
|
|
13
|
-
const start = (page - 1) * limit;
|
|
14
|
-
await new Promise(resolve => setTimeout(resolve, 500));
|
|
15
|
-
return {
|
|
16
|
-
total,
|
|
17
|
-
records: Array(Math.min(limit, total - start))
|
|
18
|
-
.fill('')
|
|
19
|
-
.map((item, idx) => {
|
|
20
|
-
return {
|
|
21
|
-
id: String(start + idx + 1),
|
|
22
|
-
name: `Record ${start + idx + 1}`,
|
|
23
|
-
description: `Description for record ${start + idx + 1}`,
|
|
24
|
-
price: Math.round(Math.random() * 100000),
|
|
25
|
-
qty: Math.round(Math.random() * 10)
|
|
26
|
-
};
|
|
27
|
-
})
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
const config = {
|
|
31
|
-
list: {
|
|
32
|
-
fields: ['name', 'description']
|
|
33
|
-
},
|
|
34
|
-
pagination: {
|
|
35
|
-
infinite: false,
|
|
36
|
-
page: 1,
|
|
37
|
-
limit: 5
|
|
38
|
-
},
|
|
39
|
-
rows: {
|
|
40
|
-
selectable: {
|
|
41
|
-
multiple: true
|
|
42
|
-
},
|
|
43
|
-
appendable: false,
|
|
44
|
-
editable: true,
|
|
45
|
-
classifier: () => { },
|
|
46
|
-
handlers: {},
|
|
47
|
-
groups: [],
|
|
48
|
-
totals: []
|
|
49
|
-
},
|
|
50
|
-
columns: [
|
|
51
|
-
{
|
|
52
|
-
type: 'gutter',
|
|
53
|
-
gutterName: 'sequence'
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
type: 'gutter',
|
|
57
|
-
gutterName: 'row-selector',
|
|
58
|
-
multiple: true
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
type: 'string',
|
|
62
|
-
name: 'id',
|
|
63
|
-
hidden: true
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
type: 'string',
|
|
67
|
-
name: 'name',
|
|
68
|
-
header: '이름',
|
|
69
|
-
record: {
|
|
70
|
-
editable: true
|
|
71
|
-
},
|
|
72
|
-
sortable: true,
|
|
73
|
-
width: 180
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
type: 'string',
|
|
77
|
-
name: 'description',
|
|
78
|
-
header: '설명',
|
|
79
|
-
record: {
|
|
80
|
-
editable: true
|
|
81
|
-
},
|
|
82
|
-
sortable: true,
|
|
83
|
-
width: 200
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
type: 'number',
|
|
87
|
-
name: 'price',
|
|
88
|
-
header: '가격',
|
|
89
|
-
record: {
|
|
90
|
-
editable: true,
|
|
91
|
-
align: 'right'
|
|
92
|
-
},
|
|
93
|
-
sortable: true,
|
|
94
|
-
width: 100
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
type: 'number',
|
|
98
|
-
name: 'qty',
|
|
99
|
-
header: '수량',
|
|
100
|
-
record: {
|
|
101
|
-
editable: true,
|
|
102
|
-
align: 'right'
|
|
103
|
-
},
|
|
104
|
-
sortable: true,
|
|
105
|
-
width: 80
|
|
106
|
-
}
|
|
107
|
-
]
|
|
108
|
-
};
|
|
109
|
-
export const AddRecordToTop = () => {
|
|
110
|
-
return html `
|
|
111
|
-
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
|
|
112
|
-
|
|
113
|
-
<link href="/themes/light.css" rel="stylesheet" />
|
|
114
|
-
<link href="/themes/dark.css" rel="stylesheet" />
|
|
115
|
-
<link href="/themes/spacing.css" rel="stylesheet" />
|
|
116
|
-
<link href="/themes/grist-theme.css" rel="stylesheet" />
|
|
117
|
-
|
|
118
|
-
<link
|
|
119
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
|
|
120
|
-
rel="stylesheet"
|
|
121
|
-
/>
|
|
122
|
-
<link
|
|
123
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
|
|
124
|
-
rel="stylesheet"
|
|
125
|
-
/>
|
|
126
|
-
<link
|
|
127
|
-
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
|
|
128
|
-
rel="stylesheet"
|
|
129
|
-
/>
|
|
130
|
-
|
|
131
|
-
<style>
|
|
132
|
-
.button-container {
|
|
133
|
-
margin-bottom: 16px;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
button {
|
|
137
|
-
padding: 8px 16px;
|
|
138
|
-
background-color: var(--md-sys-color-primary);
|
|
139
|
-
color: var(--md-sys-color-on-primary);
|
|
140
|
-
border: none;
|
|
141
|
-
border-radius: 4px;
|
|
142
|
-
cursor: pointer;
|
|
143
|
-
font-weight: 500;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
button:hover {
|
|
147
|
-
background-color: var(--md-sys-color-primary-container);
|
|
148
|
-
color: var(--md-sys-color-on-primary-container);
|
|
149
|
-
}
|
|
150
|
-
</style>
|
|
151
|
-
|
|
152
|
-
<style>
|
|
153
|
-
${MDTypeScaleStyles.cssText}
|
|
154
|
-
</style>
|
|
155
|
-
|
|
156
|
-
<style>
|
|
157
|
-
${CommonGristStyles.cssText}
|
|
158
|
-
${CommonHeaderStyles.cssText}
|
|
159
|
-
</style>
|
|
160
|
-
|
|
161
|
-
<h2>addRecordToTop 메서드 사용 예시</h2>
|
|
162
|
-
<p>버튼을 클릭하면 새 레코드가 그리드 최상단에 추가됩니다.</p>
|
|
163
|
-
|
|
164
|
-
<ox-grist .mode=${'GRID'} .config=${config} .fetchHandler=${fetchHandler}>
|
|
165
|
-
<div class="button-container" slot="headroom">
|
|
166
|
-
<button
|
|
167
|
-
@click=${(e) => {
|
|
168
|
-
const grist = e.target.closest('ox-grist');
|
|
169
|
-
grist.addRecordToTop({
|
|
170
|
-
name: `신규 레코드 ${new Date().toLocaleTimeString()}`,
|
|
171
|
-
description: '상단에 추가된 레코드',
|
|
172
|
-
price: Math.round(Math.random() * 100000),
|
|
173
|
-
qty: Math.round(Math.random() * 10)
|
|
174
|
-
});
|
|
175
|
-
}}
|
|
176
|
-
>
|
|
177
|
-
상단에 행 추가
|
|
178
|
-
</button>
|
|
179
|
-
</div>
|
|
180
|
-
</ox-grist>
|
|
181
|
-
`;
|
|
182
|
-
};
|
|
183
|
-
//# sourceMappingURL=append-position.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"append-position.stories.js","sourceRoot":"","sources":["../../stories/append-position.stories.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAA;AAE7B,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAG1B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACvE,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,iDAAiD,CAAA;AAG7F,eAAe;IACb,KAAK,EAAE,mCAAmC;IAC1C,SAAS,EAAE,UAAU;IACrB,QAAQ,EAAE,EAAE;CACb,CAAA;AAED,MAAM,YAAY,GAAiB,KAAK,EAAE,KAAkB,EAAE,EAAE;IAC9D,MAAM,EAAE,IAAI,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,KAAK,CAAA;IACtC,MAAM,KAAK,GAAG,EAAE,CAAA;IAChB,MAAM,KAAK,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAA;IAEhC,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;IAEtD,OAAO;QACL,KAAK;QACL,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,CAAC;aAC3C,IAAI,CAAC,EAAE,CAAC;aACR,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;YACjB,OAAO;gBACL,EAAE,EAAE,MAAM,CAAC,KAAK,GAAG,GAAG,GAAG,CAAC,CAAC;gBAC3B,IAAI,EAAE,UAAU,KAAK,GAAG,GAAG,GAAG,CAAC,EAAE;gBACjC,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 'lit'\nimport { FetchHandler, FetchOption, GristRecord } from '../src/types.js'\n\nimport { CommonHeaderStyles, CommonGristStyles } from '@operato/styles'\nimport { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles.js'\nimport { DataGrist } from '../src/data-grist.js'\n\nexport default {\n title: 'Data-grist/append record position',\n component: 'ox-grist',\n argTypes: {}\n}\n\nconst fetchHandler: FetchHandler = async (param: FetchOption) => {\n const { page = 1, limit = 10 } = param\n const total = 10\n const start = (page - 1) * limit\n\n await new Promise(resolve => setTimeout(resolve, 500))\n\n return {\n total,\n records: Array(Math.min(limit, total - start))\n .fill('')\n .map((item, idx) => {\n return {\n id: String(start + idx + 1),\n name: `Record ${start + idx + 1}`,\n description: `Description for record ${start + idx + 1}`,\n price: Math.round(Math.random() * 100000),\n qty: Math.round(Math.random() * 10)\n } as GristRecord\n })\n }\n}\n\nconst config = {\n list: {\n fields: ['name', 'description']\n },\n pagination: {\n infinite: false,\n page: 1,\n limit: 5\n },\n rows: {\n selectable: {\n multiple: true\n },\n appendable: false,\n editable: true,\n classifier: () => {},\n handlers: {},\n groups: [],\n totals: []\n },\n columns: [\n {\n type: 'gutter',\n gutterName: 'sequence'\n },\n {\n type: 'gutter',\n gutterName: 'row-selector',\n multiple: true\n },\n {\n type: 'string',\n name: 'id',\n hidden: true\n },\n {\n type: 'string',\n name: 'name',\n header: '이름',\n record: {\n editable: true\n },\n sortable: true,\n width: 180\n },\n {\n type: 'string',\n name: 'description',\n header: '설명',\n record: {\n editable: true\n },\n sortable: true,\n width: 200\n },\n {\n type: 'number',\n name: 'price',\n header: '가격',\n record: {\n editable: true,\n align: 'right'\n },\n sortable: true,\n width: 100\n },\n {\n type: 'number',\n name: 'qty',\n header: '수량',\n record: {\n editable: true,\n align: 'right'\n },\n sortable: true,\n width: 80\n }\n ]\n}\n\nexport const AddRecordToTop = () => {\n return html`\n <link href=\"https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap\" rel=\"stylesheet\" />\n\n <link href=\"/themes/light.css\" rel=\"stylesheet\" />\n <link href=\"/themes/dark.css\" rel=\"stylesheet\" />\n <link href=\"/themes/spacing.css\" rel=\"stylesheet\" />\n <link href=\"/themes/grist-theme.css\" rel=\"stylesheet\" />\n\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n\n <style>\n .button-container {\n margin-bottom: 16px;\n }\n\n button {\n padding: 8px 16px;\n background-color: var(--md-sys-color-primary);\n color: var(--md-sys-color-on-primary);\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-weight: 500;\n }\n\n button:hover {\n background-color: var(--md-sys-color-primary-container);\n color: var(--md-sys-color-on-primary-container);\n }\n </style>\n\n <style>\n ${MDTypeScaleStyles.cssText}\n </style>\n\n <style>\n ${CommonGristStyles.cssText}\n ${CommonHeaderStyles.cssText}\n </style>\n\n <h2>addRecordToTop 메서드 사용 예시</h2>\n <p>버튼을 클릭하면 새 레코드가 그리드 최상단에 추가됩니다.</p>\n\n <ox-grist .mode=${'GRID'} .config=${config} .fetchHandler=${fetchHandler}>\n <div class=\"button-container\" slot=\"headroom\">\n <button\n @click=${(e: Event) => {\n const grist = (e.target as HTMLElement).closest('ox-grist') as DataGrist\n grist.addRecordToTop({\n name: `신규 레코드 ${new Date().toLocaleTimeString()}`,\n description: '상단에 추가된 레코드',\n price: Math.round(Math.random() * 100000),\n qty: Math.round(Math.random() * 10)\n })\n }}\n >\n 상단에 행 추가\n </button>\n </div>\n </ox-grist>\n `\n}\n"]}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import '../src/index.js';
|
|
2
|
-
import '../src/filters/filters-form.js';
|
|
3
|
-
import '../src/sorters/sorters-control.js';
|
|
4
|
-
import '../src/record-view/ox-record-creator.js';
|
|
5
|
-
import '@operato/popup/ox-popup-list.js';
|
|
6
|
-
import '@material/web/icon/icon.js';
|
|
7
|
-
import { TemplateResult } from 'lit';
|
|
8
|
-
import { FetchHandler } from '../src/types.js';
|
|
9
|
-
declare const _default: {
|
|
10
|
-
title: string;
|
|
11
|
-
component: string;
|
|
12
|
-
argTypes: {
|
|
13
|
-
config: {
|
|
14
|
-
control: string;
|
|
15
|
-
};
|
|
16
|
-
mode: {
|
|
17
|
-
control: string;
|
|
18
|
-
options: string[];
|
|
19
|
-
};
|
|
20
|
-
urlParamsSensitive: {
|
|
21
|
-
control: string;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export default _default;
|
|
26
|
-
interface Story<T> {
|
|
27
|
-
(args: T): TemplateResult;
|
|
28
|
-
args?: Partial<T>;
|
|
29
|
-
argTypes?: Record<string, unknown>;
|
|
30
|
-
}
|
|
31
|
-
interface ArgTypes {
|
|
32
|
-
config: object;
|
|
33
|
-
mode: 'GRID' | 'LIST' | 'CARD';
|
|
34
|
-
urlParamsSensitive: boolean;
|
|
35
|
-
fetchHandler: FetchHandler;
|
|
36
|
-
}
|
|
37
|
-
export declare const SecretEditor: Story<ArgTypes>;
|