@operato/app 1.5.30 → 1.5.31
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 +9 -0
- package/dist/src/grist-editor/ox-grist-renderer-resource-code.js +6 -3
- package/dist/src/grist-editor/ox-grist-renderer-resource-code.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/grist-editor/ox-grist-renderer-resource-code.ts +15 -16
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.31](https://github.com/hatiolab/operato/compare/v1.5.30...v1.5.31) (2023-11-16)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### :bug: Bug Fix
|
|
10
|
+
|
|
11
|
+
* avoid error - Cannot read properties of null (reading 'details') ([51ad40e](https://github.com/hatiolab/operato/commit/51ad40e74a836654f6d3c505df5eb13f0326ee0e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
### [1.5.30](https://github.com/hatiolab/operato/compare/v1.5.29...v1.5.30) (2023-11-13)
|
|
7
16
|
|
|
8
17
|
**Note:** Version bump only for package @operato/app
|
|
@@ -28,6 +28,7 @@ function onmouseout(e) {
|
|
|
28
28
|
}
|
|
29
29
|
let OxGristRendererResourceCode = class OxGristRendererResourceCode extends OxGristRenderer {
|
|
30
30
|
async connectedCallback() {
|
|
31
|
+
var _a;
|
|
31
32
|
var { codeName, codes } = this.column.record || {};
|
|
32
33
|
if (!codes && codeName) {
|
|
33
34
|
/* codeName으로 fetch 해와서, this.column.record.codes에 보관한다. */
|
|
@@ -35,8 +36,8 @@ let OxGristRendererResourceCode = class OxGristRendererResourceCode extends OxGr
|
|
|
35
36
|
query: FETCH_COMMON_CODE_GQL(codeName),
|
|
36
37
|
context: gqlContext()
|
|
37
38
|
});
|
|
38
|
-
var commonCode = response
|
|
39
|
-
this.column.record.codes = [{ name: '', description: '' }].concat(commonCode.details.sort(function (a, b) {
|
|
39
|
+
var commonCode = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.commonCode;
|
|
40
|
+
this.column.record.codes = [{ name: '', description: '' }].concat(((commonCode === null || commonCode === void 0 ? void 0 : commonCode.details) || []).sort(function (a, b) {
|
|
40
41
|
return a.rank - b.rank;
|
|
41
42
|
}));
|
|
42
43
|
}
|
|
@@ -51,7 +52,9 @@ let OxGristRendererResourceCode = class OxGristRendererResourceCode extends OxGr
|
|
|
51
52
|
for (let idx = 0; idx < codes.length; idx++) {
|
|
52
53
|
let code = codes[idx];
|
|
53
54
|
if (code.name == this.value) {
|
|
54
|
-
return html `<span @mouseover=${onmouseover} @mouseout=${onmouseout}
|
|
55
|
+
return html `<span @mouseover=${onmouseover} @mouseout=${onmouseout}
|
|
56
|
+
>${code.name == '' ? '' : renderDispOpt.replace('name', code.description).replace('code', code.name)}</span
|
|
57
|
+
> `;
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-grist-renderer-resource-code.js","sourceRoot":"","sources":["../../../src/grist-editor/ox-grist-renderer-resource-code.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAQ/C,MAAM,qBAAqB,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,GAAG,C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GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;gBAC3C,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAA;gBAErB,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;oBAC3B,OAAO,IAAI,CAAA,oBAAoB,WAAW,cAAc,UAAU;eAC7D,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC;aACnG,CAAA;iBACJ;aACF;SACF;QAED,OAAO,IAAI,CAAA,oBAAoB,WAAW,cAAc,UAAU,IAAI,IAAI,CAAC,KAAK,UAAU,CAAA;IAC5F,CAAC;;AAzDM,kCAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;GAalB,AAbY,CAaZ;AAdU,2BAA2B;IADvC,aAAa,CAAC,iCAAiC,CAAC;GACpC,2BAA2B,CA2DvC","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { client, gqlContext } from '@operato/graphql'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxGristRenderer } from '@operato/data-grist'\nimport { detectOverflow } from '@operato/utils'\n\ntype CommonCodeDetail = {\n name: string\n description: string\n rank: number\n}\n\nconst FETCH_COMMON_CODE_GQL = (codeName: string) => gql`\n{\n commonCode(name: \"${codeName}\") {\n details {\n name\n description\n rank\n }\n }\n}\n`\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\n@customElement('ox-grist-renderer-resource-code')\nexport class OxGristRendererResourceCode extends OxGristRenderer {\n static styles = css`\n :host {\n display: block;\n position: relative;\n\n width: 100%;\n }\n\n span {\n text-overflow: ellipsis;\n display: block;\n overflow: hidden;\n }\n `\n\n async connectedCallback() {\n var { codeName, codes } = this.column.record || {}\n\n if (!codes && codeName) {\n /* codeName으로 fetch 해와서, this.column.record.codes에 보관한다. */\n let response = await client.query({\n query: FETCH_COMMON_CODE_GQL(codeName),\n context: gqlContext()\n })\n\n var commonCode = response?.data?.commonCode\n\n this.column.record.codes = [{ name: '', description: '' }].concat(\n (commonCode?.details || []).sort(function (a: CommonCodeDetail, b: CommonCodeDetail) {\n return a.rank - b.rank\n })\n )\n }\n\n super.connectedCallback()\n }\n\n get rendererTemplate() {\n if (!this.value) {\n return html``\n }\n\n var { codes, renderDispOpt = 'name' } = this.column.record || {}\n\n if (codes) {\n for (let idx = 0; idx < codes.length; idx++) {\n let code = codes[idx]\n\n if (code.name == this.value) {\n return html`<span @mouseover=${onmouseover} @mouseout=${onmouseout}\n >${code.name == '' ? '' : renderDispOpt.replace('name', code.description).replace('code', code.name)}</span\n > `\n }\n }\n }\n\n return html`<span @mouseover=${onmouseover} @mouseout=${onmouseout}>${this.value}</span> `\n }\n}\n"]}
|