@things-factory/organization 10.1.79 → 10.1.84
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/dist-client/bootstrap.js +2 -0
- package/dist-client/bootstrap.js.map +1 -1
- package/dist-client/component/department-selector.d.ts +1 -1
- package/dist-client/component/department-selector.js +9 -6
- package/dist-client/component/department-selector.js.map +1 -1
- package/dist-client/entity360/department-360.d.ts +28 -0
- package/dist-client/entity360/department-360.js +111 -0
- package/dist-client/entity360/department-360.js.map +1 -0
- package/dist-client/entity360/person-membership-section.d.ts +2 -0
- package/dist-client/entity360/person-membership-section.js +10 -8
- package/dist-client/entity360/person-membership-section.js.map +1 -1
- package/dist-client/grist-editor/grist-renderer-department-object.js +2 -1
- package/dist-client/grist-editor/grist-renderer-department-object.js.map +1 -1
- package/dist-client/pages/department/department-list-page.js +13 -10
- package/dist-client/pages/department/department-list-page.js.map +1 -1
- package/dist-client/pages/department/department-patch.d.ts +9 -0
- package/dist-client/pages/department/department-patch.js +22 -0
- package/dist-client/pages/department/department-patch.js.map +1 -0
- package/dist-client/pages/employee/employee-list-page.js +1 -0
- package/dist-client/pages/employee/employee-list-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/department/department-mutation.js +14 -3
- package/dist-server/service/department/department-mutation.js.map +1 -1
- package/dist-server/service/department/department-parent.d.ts +10 -0
- package/dist-server/service/department/department-parent.js +35 -0
- package/dist-server/service/department/department-parent.js.map +1 -0
- package/dist-server/service/employee/employee-day.d.ts +5 -0
- package/dist-server/service/employee/employee-day.js +33 -0
- package/dist-server/service/employee/employee-day.js.map +1 -0
- package/dist-server/service/employee/employee-history.d.ts +2 -2
- package/dist-server/service/employee/employee-history.js +4 -4
- package/dist-server/service/employee/employee-history.js.map +1 -1
- package/dist-server/service/employee/employee-mutation.js +6 -5
- package/dist-server/service/employee/employee-mutation.js.map +1 -1
- package/dist-server/service/employee/employee-type.d.ts +5 -5
- package/dist-server/service/employee/employee-type.js +10 -10
- package/dist-server/service/employee/employee-type.js.map +1 -1
- package/dist-server/service/employee/employee.d.ts +2 -2
- package/dist-server/service/employee/employee.js +4 -4
- package/dist-server/service/employee/employee.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/spec/unit/employee.spec.ts +2 -2
- package/tests/department-parent.test.ts +185 -0
- package/tests/department-patch.test.ts +52 -0
- package/tests/employee-day.test.ts +163 -0
- package/tests/entity360.test.ts +36 -0
- package/translations/en.json +1 -0
- package/translations/ja.json +1 -0
- package/translations/ko.json +1 -0
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
- package/dist-client/tsconfig.chk.tsbuildinfo +0 -1
package/dist-client/bootstrap.js
CHANGED
|
@@ -10,8 +10,10 @@ import { GristEditorRecipients } from './grist-editor/grist-editor-recipients';
|
|
|
10
10
|
import { GristRendererRecipients } from './grist-editor/grist-renderer-recipients';
|
|
11
11
|
import { GristEditorApprovalLine } from './grist-editor/grist-editor-approval-line';
|
|
12
12
|
import { GristRendererApprovalLine } from './grist-editor/grist-renderer-approval-line';
|
|
13
|
+
import { registerDepartmentKind } from './entity360/department-360.js';
|
|
13
14
|
import { registerPersonMembershipSection } from './entity360/person-membership-section.js';
|
|
14
15
|
export default function bootstrap() {
|
|
16
|
+
registerDepartmentKind();
|
|
15
17
|
registerPersonMembershipSection();
|
|
16
18
|
/* register grist renderer/editor for id */
|
|
17
19
|
registerEditor('department-object', GristEditorDepartmentObject);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAE9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAA;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAA;AAC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AA;IACjE,sBAAsB,CAAC,mBAAmB,EAAE,CAAC,sBAAsB,CAAC,CAAC,CAAA;AACvE,CAAC","sourcesContent":["import { registerEditor, registerRenderer, registerFilterRenderer } from '@operato/data-grist'\n\nimport { FilterResourceCode } from '@operato/app/filters-form/filter-resource-code.js'\nimport { FilterResourceObject } from '@operato/app/filters-form/filter-resource-object.js'\nimport { FilterDepartmentObject } from './filters-form/filter-department-object.js'\n\nimport { GristRendererDepartmentObject } from './grist-editor/grist-renderer-department-object'\nimport { GristEditorDepartmentObject } from './grist-editor/grist-editor-department-object'\nimport { GristEditorAssignees } from './grist-editor/grist-editor-assignees'\nimport { GristRendererAssignees } from './grist-editor/grist-renderer-assignees'\nimport { GristEditorRecipients } from './grist-editor/grist-editor-recipients'\nimport { GristRendererRecipients } from './grist-editor/grist-renderer-recipients'\nimport { GristEditorApprovalLine } from './grist-editor/grist-editor-approval-line'\nimport { GristRendererApprovalLine } from './grist-editor/grist-renderer-approval-line'\nimport { registerPersonMembershipSection } from './entity360/person-membership-section.js'\n\nexport default function bootstrap() {\n registerPersonMembershipSection()\n\n /* register grist renderer/editor for id */\n registerEditor('department-object', GristEditorDepartmentObject)\n registerEditor('approval-line', GristEditorApprovalLine)\n registerEditor('assignees', GristEditorAssignees)\n registerEditor('recipients', GristEditorRecipients)\n\n registerRenderer('department-object', GristRendererDepartmentObject)\n registerRenderer('approval-line', GristRendererApprovalLine)\n registerRenderer('assignees', GristRendererAssignees)\n registerRenderer('recipients', GristRendererRecipients)\n\n registerFilterRenderer('code', [FilterResourceCode])\n registerFilterRenderer('object', [FilterResourceObject])\n registerFilterRenderer('resource-object', [FilterResourceObject])\n registerFilterRenderer('department-object', [FilterDepartmentObject])\n}\n"]}
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAE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AAsB,CAAC,MAAM,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAA;IACpD,sBAAsB,CAAC,QAAQ,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAA;IACxD,sBAAsB,CAAC,iBAAiB,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAA;IACjE,sBAAsB,CAAC,mBAAmB,EAAE,CAAC,sBAAsB,CAAC,CAAC,CAAA;AACvE,CAAC","sourcesContent":["import { registerEditor, registerRenderer, registerFilterRenderer } from '@operato/data-grist'\n\nimport { FilterResourceCode } from '@operato/app/filters-form/filter-resource-code.js'\nimport { FilterResourceObject } from '@operato/app/filters-form/filter-resource-object.js'\nimport { FilterDepartmentObject } from './filters-form/filter-department-object.js'\n\nimport { GristRendererDepartmentObject } from './grist-editor/grist-renderer-department-object'\nimport { GristEditorDepartmentObject } from './grist-editor/grist-editor-department-object'\nimport { GristEditorAssignees } from './grist-editor/grist-editor-assignees'\nimport { GristRendererAssignees } from './grist-editor/grist-renderer-assignees'\nimport { GristEditorRecipients } from './grist-editor/grist-editor-recipients'\nimport { GristRendererRecipients } from './grist-editor/grist-renderer-recipients'\nimport { GristEditorApprovalLine } from './grist-editor/grist-editor-approval-line'\nimport { GristRendererApprovalLine } from './grist-editor/grist-renderer-approval-line'\nimport { registerDepartmentKind } from './entity360/department-360.js'\nimport { registerPersonMembershipSection } from './entity360/person-membership-section.js'\n\nexport default function bootstrap() {\n registerDepartmentKind()\n registerPersonMembershipSection()\n\n /* register grist renderer/editor for id */\n registerEditor('department-object', GristEditorDepartmentObject)\n registerEditor('approval-line', GristEditorApprovalLine)\n registerEditor('assignees', GristEditorAssignees)\n registerEditor('recipients', GristEditorRecipients)\n\n registerRenderer('department-object', GristRendererDepartmentObject)\n registerRenderer('approval-line', GristRendererApprovalLine)\n registerRenderer('assignees', GristRendererAssignees)\n registerRenderer('recipients', GristRendererRecipients)\n\n registerFilterRenderer('code', [FilterResourceCode])\n registerFilterRenderer('object', [FilterResourceObject])\n registerFilterRenderer('resource-object', [FilterResourceObject])\n registerFilterRenderer('department-object', [FilterDepartmentObject])\n}\n"]}
|
|
@@ -9,7 +9,7 @@ export declare class DepartmentSelector extends LitElement {
|
|
|
9
9
|
static styles: import("lit").CSSResult[];
|
|
10
10
|
confirmCallback?: (selected?: any) => void;
|
|
11
11
|
value?: Department;
|
|
12
|
-
|
|
12
|
+
roots?: Department[];
|
|
13
13
|
render(): import("lit-html").TemplateResult<1>;
|
|
14
14
|
onSelect(e: CustomEvent, confirm?: boolean): void;
|
|
15
15
|
onEmpty(): void;
|
|
@@ -75,11 +75,11 @@ let DepartmentSelector = class DepartmentSelector extends LitElement {
|
|
|
75
75
|
render() {
|
|
76
76
|
return html `
|
|
77
77
|
<ox-tree-vertical
|
|
78
|
-
.data=${this.
|
|
78
|
+
.data=${this.roots}
|
|
79
79
|
.selected=${this.value}
|
|
80
80
|
@select=${e => this.onSelect(e, false)}
|
|
81
81
|
@select-confirm=${e => this.onSelect(e, true)}
|
|
82
|
-
id-property="
|
|
82
|
+
id-property="id"
|
|
83
83
|
label-property="name"
|
|
84
84
|
description-property="description"
|
|
85
85
|
></ox-tree-vertical>
|
|
@@ -143,8 +143,11 @@ let DepartmentSelector = class DepartmentSelector extends LitElement {
|
|
|
143
143
|
${departmentFragment}
|
|
144
144
|
`
|
|
145
145
|
});
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
/*
|
|
147
|
+
* Every top-level department, each with its subtree. This kept records[0] only, so an organization with
|
|
148
|
+
* more than one top-level department could pick from the first one alone (OA: five, all top-level).
|
|
149
|
+
*/
|
|
150
|
+
this.roots = response.data.responses.items;
|
|
148
151
|
}
|
|
149
152
|
};
|
|
150
153
|
__decorate([
|
|
@@ -157,8 +160,8 @@ __decorate([
|
|
|
157
160
|
], DepartmentSelector.prototype, "value", void 0);
|
|
158
161
|
__decorate([
|
|
159
162
|
state(),
|
|
160
|
-
__metadata("design:type",
|
|
161
|
-
], DepartmentSelector.prototype, "
|
|
163
|
+
__metadata("design:type", Array)
|
|
164
|
+
], DepartmentSelector.prototype, "roots", void 0);
|
|
162
165
|
DepartmentSelector = __decorate([
|
|
163
166
|
customElement('department-selector')
|
|
164
167
|
], DepartmentSelector);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"department-selector.js","sourceRoot":"","sources":["../../client/component/department-selector.ts"],"names":[],"mappings":";AAAA,OAAO,oCAAoC,CAAA;AAC3C,OAAO,4BAA4B,CAAA;AACnC,OAAO,qCAAqC,CAAA;AAC5C,OAAO,uCAAuC,CAAA;AAC9C,OAAO,oBAAoB,CAAA;AAE3B,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAEvE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD,MAAM,kBAAkB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;CAuB7B,CAAA;AAGM,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,UAAU;aACzC,WAAM,GAAG;QACd,kBAAkB;QAClB,iBAAiB;QACjB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BF;KACF,AAlCY,CAkCZ;IAOD,MAAM;QACJ,OAAO,IAAI,CAAA;;gBAEC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"department-selector.js","sourceRoot":"","sources":["../../client/component/department-selector.ts"],"names":[],"mappings":";AA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AErC;IAAR,KAAK,EAAE;;iDAAqB;AAxClB,kBAAkB;IAD9B,aAAa,CAAC,qBAAqB,CAAC;GACxB,kBAAkB,CA8H9B","sourcesContent":["import '@operato/popup/ox-popup-actions.js'\nimport '@material/web/icon/icon.js'\nimport '@material/web/button/text-button.js'\nimport '@material/web/button/filled-button.js'\nimport '@operato/data-tree'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { closePopup } from '@operato/popup'\nimport { CommonHeaderStyles, CommonPopupStyles } from '@operato/styles'\n\nimport { Department } from '../types/department'\n\nconst departmentFragment = gql`\n fragment SubDepartment on Department {\n id\n controlNo\n name\n description\n\n manager {\n id\n name\n controlNo\n photo\n email\n }\n active\n picture\n\n updater {\n id\n name\n }\n updatedAt\n }\n`\n\n@customElement('department-selector')\nexport class DepartmentSelector extends LitElement {\n static styles = [\n CommonHeaderStyles,\n CommonPopupStyles,\n css`\n /*\n * 단추 줄은 **제품의 팝업 규약**을 쓴다(CommonPopupStyles 의 .buttons).\n *\n * 전에는 손으로 만든 .footer 였고 organization 의 팝업 다섯이 그것을 복사해 갖고 있었다.\n * 규약이 주는 것을 다 놓쳤다 — 팝업 안 단추의 알약 모서리(담는 카드가 둥그니 그 안도\n * 둥글다), 마우스와 손가락을 가르는 갈래(손가락에서는 카드 아래 폭을 채우는 액션바가 된다),\n * 단추 높이 통일.\n *\n * 단추는 Material 것으로 쓴다. 규약의 마우스 갈래는 **md-*-button 의 토큰으로만** 모양을\n * 말한다 — 평범한 button 을 두면 모서리가 0 으로 남는다(실측: 알약이어야 할 자리에 0px).\n * 제품의 다른 팝업도 같은 관용구다(operato-plant 의 maintenance-dialog).\n *\n * 「비우기」는 왼쪽에 둔다 — 되돌리는 것이라 저지르는 것들과 같은 자리에 두지 않는다.\n */\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 overflow: auto;\n }\n\n ox-tree-vertical {\n flex: 1;\n }\n `\n ]\n\n @property({ type: Object }) confirmCallback?: (selected?: any) => void\n @property({ type: Object }) value?: Department\n\n @state() roots?: Department[]\n\n render() {\n return html`\n <ox-tree-vertical\n .data=${this.roots}\n .selected=${this.value}\n @select=${e => this.onSelect(e, false)}\n @select-confirm=${e => this.onSelect(e, true)}\n id-property=\"id\"\n label-property=\"name\"\n description-property=\"description\"\n ></ox-tree-vertical>\n\n <ox-popup-actions>\n <md-text-button slot=\"start\" @click=${this.onEmpty.bind(this)}>\n ${i18next.t('button.empty', { defaultValue: 'empty' })}\n </md-text-button>\n <md-text-button slot=\"cancel\" @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</md-text-button>\n <md-filled-button slot=\"confirm\" @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm', { defaultValue: 'confirm' })}</md-filled-button>\n </ox-popup-actions>\n `\n }\n\n onSelect(e: CustomEvent, confirm?: boolean) {\n this.value = e.detail as Department\n\n if (confirm) {\n this.onConfirm()\n }\n }\n\n onEmpty() {\n this.confirmCallback && this.confirmCallback(null)\n closePopup(this)\n }\n\n onCancel() {\n closePopup(this)\n }\n\n onConfirm() {\n this.confirmCallback && this.confirmCallback(this.value)\n closePopup(this)\n }\n\n async firstUpdated() {\n const response = await client.query({\n query: gql`\n query {\n responses: departmentRoots {\n total\n items {\n ...SubDepartment\n children {\n ...SubDepartment\n children {\n ...SubDepartment\n children {\n ...SubDepartment\n children {\n ...SubDepartment\n children {\n ...SubDepartment\n children {\n ...SubDepartment\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n ${departmentFragment}\n `\n })\n\n /*\n * Every top-level department, each with its subtree. This kept records[0] only, so an organization with\n * more than one top-level department could pick from the first one alone (OA: five, all top-level).\n */\n this.roots = response.data.responses.items\n }\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { type Entity360DoorAnswer, type Entity360Subject } from '@operato/layout';
|
|
3
|
+
type Department = {
|
|
4
|
+
id: string;
|
|
5
|
+
controlNo?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
active?: boolean;
|
|
9
|
+
parent?: {
|
|
10
|
+
id: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
__typename?: string;
|
|
13
|
+
};
|
|
14
|
+
manager?: {
|
|
15
|
+
name?: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
/** A department is a shared organizational fact: it can open from a person's membership and from generic object cells. */
|
|
19
|
+
export declare function registerDepartmentKind(): void;
|
|
20
|
+
export declare class DepartmentOverviewSection extends LitElement {
|
|
21
|
+
static styles: import("lit").CSSResult;
|
|
22
|
+
subject?: Entity360Subject;
|
|
23
|
+
answer?: Entity360DoorAnswer<Department | undefined>;
|
|
24
|
+
updated(changed: Map<string, unknown>): void;
|
|
25
|
+
private read;
|
|
26
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import gql from 'graphql-tag';
|
|
3
|
+
import { css, html, LitElement } from 'lit';
|
|
4
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
5
|
+
import { client } from '@operato/graphql';
|
|
6
|
+
import { i18next } from '@operato/i18n';
|
|
7
|
+
import { entity360Name, readEntity360Door, registerEntity360Kind, registerEntity360Section } from '@operato/layout';
|
|
8
|
+
/** A department is a shared organizational fact: it can open from a person's membership and from generic object cells. */
|
|
9
|
+
export function registerDepartmentKind() {
|
|
10
|
+
registerEntity360Kind({
|
|
11
|
+
kind: 'department',
|
|
12
|
+
typenames: ['Department'],
|
|
13
|
+
title: ({ value }) => value.name || value.controlNo || '',
|
|
14
|
+
context: ({ value }) => value.controlNo || ''
|
|
15
|
+
});
|
|
16
|
+
registerEntity360Section('department', {
|
|
17
|
+
name: 'overview',
|
|
18
|
+
order: 10,
|
|
19
|
+
render: subject => html `<department-overview-section .subject=${subject}></department-overview-section>`
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
let DepartmentOverviewSection = class DepartmentOverviewSection extends LitElement {
|
|
23
|
+
static { this.styles = css `
|
|
24
|
+
dl {
|
|
25
|
+
margin: 0;
|
|
26
|
+
display: grid;
|
|
27
|
+
grid-template-columns: max-content 1fr;
|
|
28
|
+
gap: 4px 12px;
|
|
29
|
+
font: 13px/1.5 sans-serif;
|
|
30
|
+
}
|
|
31
|
+
dt {
|
|
32
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
33
|
+
}
|
|
34
|
+
dd {
|
|
35
|
+
margin: 0;
|
|
36
|
+
color: var(--md-sys-color-on-surface);
|
|
37
|
+
overflow-wrap: anywhere;
|
|
38
|
+
}
|
|
39
|
+
`; }
|
|
40
|
+
updated(changed) {
|
|
41
|
+
if (changed.has('subject'))
|
|
42
|
+
this.read();
|
|
43
|
+
}
|
|
44
|
+
async read() {
|
|
45
|
+
const id = this.subject?.id;
|
|
46
|
+
this.answer = undefined;
|
|
47
|
+
if (!id)
|
|
48
|
+
return;
|
|
49
|
+
const response = await client.query({
|
|
50
|
+
query: gql `
|
|
51
|
+
query ($id: String!) {
|
|
52
|
+
department(id: $id) {
|
|
53
|
+
id
|
|
54
|
+
controlNo
|
|
55
|
+
name
|
|
56
|
+
description
|
|
57
|
+
active
|
|
58
|
+
parent {
|
|
59
|
+
id
|
|
60
|
+
__typename
|
|
61
|
+
name
|
|
62
|
+
}
|
|
63
|
+
manager {
|
|
64
|
+
name
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
`,
|
|
69
|
+
variables: { id }
|
|
70
|
+
});
|
|
71
|
+
if (this.subject?.id !== id)
|
|
72
|
+
return;
|
|
73
|
+
this.answer = readEntity360Door(response, data => data?.department);
|
|
74
|
+
}
|
|
75
|
+
render() {
|
|
76
|
+
const answer = this.answer;
|
|
77
|
+
const department = answer?.data;
|
|
78
|
+
const none = i18next.t('text.entity360-none', { defaultValue: 'none' });
|
|
79
|
+
return html `<ox-entity360-section
|
|
80
|
+
.heading=${i18next.t('title.department list', { defaultValue: 'department' })}
|
|
81
|
+
.state=${answer?.state ?? 'loading'}
|
|
82
|
+
.message=${answer?.message ?? ''}
|
|
83
|
+
>
|
|
84
|
+
${department
|
|
85
|
+
? html `<dl>
|
|
86
|
+
<dt>${i18next.t('label.control-no')}</dt>
|
|
87
|
+
<dd>${department.controlNo || none}</dd>
|
|
88
|
+
<dt>${i18next.t('label.description')}</dt>
|
|
89
|
+
<dd>${department.description || none}</dd>
|
|
90
|
+
<dt>${i18next.t('label.department')}</dt>
|
|
91
|
+
<dd>${department.parent ? entity360Name(department.parent, department.parent.name || none) : none}</dd>
|
|
92
|
+
<dt>${i18next.t('label.manager')}</dt>
|
|
93
|
+
<dd>${department.manager?.name || none}</dd>
|
|
94
|
+
</dl>`
|
|
95
|
+
: ''}
|
|
96
|
+
</ox-entity360-section>`;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
__decorate([
|
|
100
|
+
property({ attribute: false }),
|
|
101
|
+
__metadata("design:type", Object)
|
|
102
|
+
], DepartmentOverviewSection.prototype, "subject", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
state(),
|
|
105
|
+
__metadata("design:type", Object)
|
|
106
|
+
], DepartmentOverviewSection.prototype, "answer", void 0);
|
|
107
|
+
DepartmentOverviewSection = __decorate([
|
|
108
|
+
customElement('department-overview-section')
|
|
109
|
+
], DepartmentOverviewSection);
|
|
110
|
+
export { DepartmentOverviewSection };
|
|
111
|
+
//# sourceMappingURL=department-360.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"department-360.js","sourceRoot":"","sources":["../../client/entity360/department-360.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,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AI;oBAC3F,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;oBAC1B,UAAU,CAAC,OAAO,EAAE,IAAI,IAAI,IAAI;kBAClC;YACR,CAAC,CAAC,EACN;4BACsB,CAAA;IAC1B,CAAC;;AAhE+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;0DAA2B;AACjD;IAAR,KAAK,EAAE;;yDAAqD;AApBlD,yBAAyB;IADrC,aAAa,CAAC,6BAA6B,CAAC;GAChC,yBAAyB,CAoFrC","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport {\n entity360Name,\n readEntity360Door,\n registerEntity360Kind,\n registerEntity360Section,\n type Entity360DoorAnswer,\n type Entity360Subject\n} from '@operato/layout'\n\ntype Department = {\n id: string\n controlNo?: string\n name?: string\n description?: string\n active?: boolean\n parent?: { id: string; name?: string; __typename?: string }\n manager?: { name?: string }\n}\n\n/** A department is a shared organizational fact: it can open from a person's membership and from generic object cells. */\nexport function registerDepartmentKind() {\n registerEntity360Kind({\n kind: 'department',\n typenames: ['Department'],\n title: ({ value }) => value.name || value.controlNo || '',\n context: ({ value }) => value.controlNo || ''\n })\n\n registerEntity360Section('department', {\n name: 'overview',\n order: 10,\n render: subject => html`<department-overview-section .subject=${subject}></department-overview-section>`\n })\n}\n\n@customElement('department-overview-section')\nexport class DepartmentOverviewSection extends LitElement {\n static styles = css`\n dl {\n margin: 0;\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: 4px 12px;\n font: 13px/1.5 sans-serif;\n }\n dt {\n color: var(--md-sys-color-on-surface-variant);\n }\n dd {\n margin: 0;\n color: var(--md-sys-color-on-surface);\n overflow-wrap: anywhere;\n }\n `\n\n @property({ attribute: false }) subject?: Entity360Subject\n @state() answer?: Entity360DoorAnswer<Department | undefined>\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('subject')) this.read()\n }\n\n private async read() {\n const id = this.subject?.id\n this.answer = undefined\n if (!id) return\n\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n department(id: $id) {\n id\n controlNo\n name\n description\n active\n parent {\n id\n __typename\n name\n }\n manager {\n name\n }\n }\n }\n `,\n variables: { id }\n })\n\n if (this.subject?.id !== id) return\n this.answer = readEntity360Door(response, data => data?.department)\n }\n\n render() {\n const answer = this.answer\n const department = answer?.data\n const none = i18next.t('text.entity360-none', { defaultValue: 'none' })\n\n return html`<ox-entity360-section\n .heading=${i18next.t('title.department list', { defaultValue: 'department' })}\n .state=${answer?.state ?? 'loading'}\n .message=${answer?.message ?? ''}\n >\n ${\n department\n ? html`<dl>\n <dt>${i18next.t('label.control-no')}</dt>\n <dd>${department.controlNo || none}</dd>\n <dt>${i18next.t('label.description')}</dt>\n <dd>${department.description || none}</dd>\n <dt>${i18next.t('label.department')}</dt>\n <dd>${department.parent ? entity360Name(department.parent, department.parent.name || none) : none}</dd>\n <dt>${i18next.t('label.manager')}</dt>\n <dd>${department.manager?.name || none}</dd>\n </dl>`\n : ''\n }\n </ox-entity360-section>`\n }\n}\n"]}
|
|
@@ -4,7 +4,7 @@ import { css, html, LitElement } from 'lit';
|
|
|
4
4
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
5
5
|
import { client } from '@operato/graphql';
|
|
6
6
|
import { i18next } from '@operato/i18n';
|
|
7
|
-
import { readEntity360Door, registerEntity360Section } from '@operato/layout';
|
|
7
|
+
import { entity360Name, readEntity360Door, registerEntity360Section } from '@operato/layout';
|
|
8
8
|
export function registerPersonMembershipSection() {
|
|
9
9
|
registerEntity360Section('person', {
|
|
10
10
|
name: 'membership',
|
|
@@ -53,6 +53,8 @@ let PersonMembershipSection = class PersonMembershipSection extends LitElement {
|
|
|
53
53
|
name
|
|
54
54
|
jobPosition
|
|
55
55
|
department {
|
|
56
|
+
id
|
|
57
|
+
__typename
|
|
56
58
|
name
|
|
57
59
|
}
|
|
58
60
|
supervisor {
|
|
@@ -79,13 +81,13 @@ let PersonMembershipSection = class PersonMembershipSection extends LitElement {
|
|
|
79
81
|
.message=${answer?.message ?? ''}
|
|
80
82
|
>
|
|
81
83
|
${(answer?.data || []).map(one => html `<dl>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
<dt>${i18next.t('label.department')}</dt>
|
|
85
|
+
<dd>${one.department ? entity360Name(one.department, one.department.name || none) : none}</dd>
|
|
86
|
+
<dt>${i18next.t('label.job-position')}</dt>
|
|
87
|
+
<dd>${one.jobPosition || none}</dd>
|
|
88
|
+
<dt>${i18next.t('label.supervisor-person', { defaultValue: 'supervisor' })}</dt>
|
|
89
|
+
<dd>${one.supervisor?.name || none}</dd>
|
|
90
|
+
</dl>`)}
|
|
89
91
|
</ox-entity360-section>`;
|
|
90
92
|
}
|
|
91
93
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"person-membership-section.js","sourceRoot":"","sources":["../../client/entity360/person-membership-section.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,
|
|
1
|
+
{"version":3,"file":"person-membership-section.js","sourceRoot":"","sources":["../../client/entity360/person-membership-section.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAA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graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport {\n entity360Name,\n readEntity360Door,\n registerEntity360Section,\n type Entity360DoorAnswer,\n type Entity360Subject\n} from '@operato/layout'\n\n/**\n * The person 360's membership section (ADR-0067, design/ui/entity360-person.md §3): department,\n * position and supervisor, from the person's employee records in this domain.\n *\n * Read through `employees`, which asks `employee:query` - someone without it is told they may not\n * see this, never \"none\". A user can hold more than one employee record here (there is no unique\n * constraint on domain and user - `myEmployees` says why), so every record is shown.\n */\n\ntype Membership = {\n id: string\n name?: string\n jobPosition?: string\n department?: { id: string; name?: string; __typename?: string }\n supervisor?: { name?: string }\n}\n\nexport function registerPersonMembershipSection() {\n registerEntity360Section('person', {\n name: 'membership',\n order: 10,\n render: subject => html`<person-membership-section .subject=${subject}></person-membership-section>`\n })\n}\n\n@customElement('person-membership-section')\nexport class PersonMembershipSection extends LitElement {\n static styles = css`\n dl {\n margin: 0;\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: 4px 12px;\n font: 13px/1.5 sans-serif;\n }\n dl + dl {\n margin-top: 8px;\n padding-top: 8px;\n border-top: 1px dashed var(--md-sys-color-outline-variant);\n }\n dt {\n color: var(--md-sys-color-on-surface-variant);\n }\n dd {\n margin: 0;\n color: var(--md-sys-color-on-surface);\n overflow-wrap: anywhere;\n }\n `\n\n @property({ attribute: false }) subject?: Entity360Subject\n @state() answer?: Entity360DoorAnswer<Membership[]>\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('subject')) this.read()\n }\n\n private async read() {\n const id = this.subject?.id\n this.answer = undefined\n if (!id) return\n\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!]) {\n employees(filters: $filters) {\n items {\n id\n name\n jobPosition\n department {\n id\n __typename\n name\n }\n supervisor {\n name\n }\n }\n }\n }\n `,\n variables: { filters: [{ name: 'userId', operator: 'eq', value: id }] }\n })\n\n /* A later subject may have arrived while this one was being read. */\n if (this.subject?.id !== id) return\n this.answer = readEntity360Door(response, data => data?.employees?.items || [])\n }\n\n render() {\n const answer = this.answer\n /* A blank field says 「없음」 in its own row - leaving it out would read as \"not asked\". */\n const none = i18next.t('text.entity360-none', { defaultValue: 'none' })\n\n return html`<ox-entity360-section\n .heading=${i18next.t('title.person-membership', { defaultValue: 'membership' })}\n .state=${answer?.state ?? 'loading'}\n .message=${answer?.message ?? ''}\n >\n ${(answer?.data || []).map(\n one =>\n html`<dl>\n <dt>${i18next.t('label.department')}</dt>\n <dd>${one.department ? entity360Name(one.department, one.department.name || none) : none}</dd>\n <dt>${i18next.t('label.job-position')}</dt>\n <dd>${one.jobPosition || none}</dd>\n <dt>${i18next.t('label.supervisor-person', { defaultValue: 'supervisor' })}</dt>\n <dd>${one.supervisor?.name || none}</dd>\n </dl>`\n )}\n </ox-entity360-section>`\n }\n}\n"]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { html } from 'lit-html';
|
|
2
|
+
import { entity360Name } from '@operato/layout';
|
|
2
3
|
export const GristRendererDepartmentObject = (value, column, record, rowIndex, field) => {
|
|
3
4
|
if (!value) {
|
|
4
5
|
return '';
|
|
5
6
|
}
|
|
6
7
|
const { name, description } = value;
|
|
7
|
-
return html `<span>${name || ''}${(description && `(${description})`) || ''}</span> `;
|
|
8
|
+
return html `<span>${entity360Name(value, name || '')}${(description && `(${description})`) || ''}</span> `;
|
|
8
9
|
};
|
|
9
10
|
//# sourceMappingURL=grist-renderer-department-object.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grist-renderer-department-object.js","sourceRoot":"","sources":["../../client/grist-editor/grist-renderer-department-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"grist-renderer-department-object.js","sourceRoot":"","sources":["../../client/grist-editor/grist-renderer-department-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAG/B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,MAAM,CAAC,MAAM,6BAA6B,GAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IACrG,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,CAAA;IACX,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,KAAK,CAAA;IAEnC,OAAO,IAAI,CAAA,SAAS,aAAa,CAAC,KAAK,EAAE,IAAI,IAAI,EAAE,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,WAAW,GAAG,CAAC,IAAI,EAAE,UAAU,CAAA;AAC5G,CAAC,CAAA","sourcesContent":["import { html } from 'lit-html'\n\nimport { FieldRenderer } from '@operato/data-grist'\nimport { entity360Name } from '@operato/layout'\n\nexport const GristRendererDepartmentObject: FieldRenderer = (value, column, record, rowIndex, field) => {\n if (!value) {\n return ''\n }\n\n const { name, description } = value\n\n return html`<span>${entity360Name(value, name || '')}${(description && `(${description})`) || ''}</span> `\n}\n"]}
|
|
@@ -14,6 +14,7 @@ import { notify } from '@operato/layout';
|
|
|
14
14
|
import { OxPrompt } from '@operato/popup/ox-prompt.js';
|
|
15
15
|
import gql from 'graphql-tag';
|
|
16
16
|
import { DepartmentImporter } from './department-importer';
|
|
17
|
+
import { toDepartmentPatch } from './department-patch';
|
|
17
18
|
import { Department } from '../../types/department';
|
|
18
19
|
const SubDepartmentFragment = gql `
|
|
19
20
|
fragment SubDepartmentFragment on Department { id
|
|
@@ -21,6 +22,10 @@ const SubDepartmentFragment = gql `
|
|
|
21
22
|
name
|
|
22
23
|
description
|
|
23
24
|
|
|
25
|
+
parent { id
|
|
26
|
+
name
|
|
27
|
+
}
|
|
28
|
+
|
|
24
29
|
manager { id
|
|
25
30
|
name
|
|
26
31
|
controlNo
|
|
@@ -183,6 +188,13 @@ let DepartmentListPage = class DepartmentListPage extends localize(i18next)(Scop
|
|
|
183
188
|
/* 부서 코드는 본부-팀-조까지 이어 붙는다(MFG-ASSY-A) — 110px 에서는 잘렸다. */
|
|
184
189
|
width: 150
|
|
185
190
|
},
|
|
191
|
+
{ type: 'department-object',
|
|
192
|
+
name: 'parent',
|
|
193
|
+
header: i18next.t('field.parent-department'),
|
|
194
|
+
record: { editable: true
|
|
195
|
+
},
|
|
196
|
+
width: 150
|
|
197
|
+
},
|
|
186
198
|
{ type: 'string',
|
|
187
199
|
name: 'description',
|
|
188
200
|
header: i18next.t('label.description', { defaultValue: 'description' }),
|
|
@@ -327,16 +339,7 @@ let DepartmentListPage = class DepartmentListPage extends localize(i18next)(Scop
|
|
|
327
339
|
async save() {
|
|
328
340
|
let patches = this.grist.dirtyRecords;
|
|
329
341
|
if (patches && patches.length) {
|
|
330
|
-
patches = patches.map(
|
|
331
|
-
let patchField = patch.id ? { id: patch.id } : {};
|
|
332
|
-
const dirtyFields = patch.__dirtyfields__;
|
|
333
|
-
for (let key in dirtyFields) {
|
|
334
|
-
patchField[key] = dirtyFields[key].after;
|
|
335
|
-
}
|
|
336
|
-
patchField.parent = patch.parent;
|
|
337
|
-
patchField.cuFlag = patch.__dirty__;
|
|
338
|
-
return patchField;
|
|
339
|
-
});
|
|
342
|
+
patches = patches.map(toDepartmentPatch);
|
|
340
343
|
const response = await client.mutate({ mutation: gql `
|
|
341
344
|
mutation ($patches: [DepartmentPatch!]!) { updateMultipleDepartment(patches: $patches) { name
|
|
342
345
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"department-list-page.js","sourceRoot":"","sources":["../../../client/pages/department/department-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,0CAA0C,CAAA;AAEjD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAC5F,OAAO,EAAE,QAA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W,CAAC,GAAG,CAAC,CAAC,KAAK,CAAA;gBACxF,CAAC;gBACM,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAA;gBAChC,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,SAAS,CAAA;gBAEnC,OAAO,UAAU,CAAA;YACxB,CAAC,CAAC,CAAA;YAEG,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,EAAU,QAAQ,EAAE,GAAG,CAAA;;;;SAIzD;gBACD,SAAS,EAAE,EAAY,OAAO;iBACpC;gBACM,OAAO,EAAE,EAAY,SAAS,EAAE,IAAI;iBAC1C;aACA,CAAC,CAAA;YAEG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;gBAAS,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;YACvD,CAAC;QACD,CAAC;IACD,CAAC;;AAhTS;IAAR,KAAK,EAAE;8BAAQ,UAAU;gDAAA;AACjB;IAAR,KAAK,EAAE;8BAAY,UAAU;oDAAA;AAEH;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;iDAAA;AAsChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uDAAiB;AA7DjC,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAqU9B","sourcesContent":["import '@operato/data-tree'\nimport '@operato/data-grist/ox-record-creator.js'\n\nimport { CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { PageView } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { isMobileDevice } from '@operato/utils'\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { notify } from '@operato/layout'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\n\nimport gql from 'graphql-tag'\n\nimport { DepartmentImporter } from './department-importer'\nimport { Department } from '../../types/department'\n\nconst SubDepartmentFragment = gql`\n fragment SubDepartmentFragment on Department { id\n controlNo\n name\n description\n\n manager { id\n name\n controlNo\n photo\n email\n }\n active\n picture\n\n updater { id\n name\n }\n updatedAt\n }\n`\n\n@customElement('department-list-page')\nexport class DepartmentListPage extends localize(i18next)(ScopedElementsMixin(PageView)) { static styles = [\n /* The work surface frame for a list screen (ADR-0060 decision 8). */\n WorkSurfacePageStyles,\n ScrollbarStyles,\n CommonHeaderStyles,\n css`\n :host {\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n .header { grid-template-areas: 'filters';\n }\n `\n ]\n\n static get scopedElements() { return { 'department-importer': DepartmentImporter\n }\n }\n\n @state() root?: Department\n @state() selected?: Department\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() { return {\n /*\n * Full text search sits in the title bar, the way these applications carry it\n * (ADR-0060 decision 9; user instruction 2026-09-18 - framework screens included).\n * It searches the columns that declare a search filter.\n */\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n }, title: i18next.t('title.department list'),\n help: 'organization/department',\n actions: [\n { icon: 'add',\n title: i18next.t('button.add', { defaultValue: 'add' }),\n action: () => this.grist.addRecord()\n },\n // { // icon: 'add',\n // title: i18next.t('button.add-sibling-dept'),\n // action: () => this.grist.addSiblingNodes()\n // },\n { icon: 'save',\n title: i18next.t('button.save'),\n action: this.save.bind(this)\n },\n { icon: 'delete',\n title: i18next.t('button.delete'),\n action: this.delete.bind(this),\n emphasis: { danger: true\n }\n }\n ].filter(Boolean)\n }\n }\n\n @property({ type: Object }) gristConfig: any\n\n render() { const mode = isMobileDevice() ? 'CARD' : 'GRID'\n\n return html`\n <ox-grist class=\"page-fill\" .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form class=\"filter\" autofocus without-search></ox-filters-form>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) { const response = await client.query({ query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: departmentRoots(filters: $filters, pagination: $pagination, sortings: $sortings) { total\n items { ...SubDepartmentFragment\n children(filters: $filters, sortings: $sortings) { ...SubDepartmentFragment\n children(filters: $filters, sortings: $sortings) { ...SubDepartmentFragment\n children(filters: $filters, sortings: $sortings) { ...SubDepartmentFragment\n children(filters: $filters, sortings: $sortings) { ...SubDepartmentFragment\n children(filters: $filters, sortings: $sortings) { ...SubDepartmentFragment\n children(filters: $filters, sortings: $sortings) { ...SubDepartmentFragment\n children(filters: $filters, sortings: $sortings) { ...SubDepartmentFragment\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n ${SubDepartmentFragment}\n `,\n variables: { filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n const { items: records } = response.data.responses\n\n /*\n * Count every row the screen draws, not the roots.\n *\n * `departmentRoots` counts what it returns - top level departments - and this screen draws each\n * root with its whole subtree underneath. With one root and thirty eight departments the pager\n * said \"1 in total\" under thirty eight visible rows.\n */\n const countTree = (list: any[]): number =>\n (list || []).reduce((sum, record) => sum + 1 + countTree(record.children), 0)\n\n return { total: countTree(records),\n records\n }\n }\n\n async pageInitialized(lifecycle: any) { this.gristConfig = { pagination: { pages: [50, 100, 200] },\n list: { thumbnail: 'profile',\n fields: ['controlNo', 'name'],\n details: ['email', 'manager', 'updatedAt']\n },\n columns: [\n { type: 'gutter',\n gutterName: 'dirty',\n fixed: true\n },\n { type: 'tree',\n name: 'name',\n label: true,\n header: i18next.t('label.name', { defaultValue: 'name' }),\n record: { editable: true,\n options: { selectable: true\n }\n },\n filter: 'search',\n sortable: true,\n width: 200,\n fixed: true,\n handlers: { contextmenu: 'contextmenu-tree-mutation'\n }\n },\n { name: 'id', hidden: true },\n { type: 'string',\n name: 'controlNo',\n header: i18next.t('label.control-no'),\n record: { editable: true\n },\n filter: 'search',\n sortable: true,\n /* 부서 코드는 본부-팀-조까지 이어 붙는다(MFG-ASSY-A) — 110px 에서는 잘렸다. */\n width: 150\n },\n { type: 'string',\n name: 'description',\n header: i18next.t('label.description', { defaultValue: 'description' }),\n record: { editable: true\n },\n filter: 'search',\n sortable: true,\n width: 200\n },\n { type: 'resource-object',\n name: 'manager',\n header: i18next.t('label.manager'),\n record: { editable: true,\n options: { title: i18next.t('title.employee list'),\n queryName: 'employees',\n pagination: { pages: [50, 100, 200] },\n basicArgs: { filters: [\n { name: 'active',\n operator: 'eq',\n value: true\n }\n ]\n },\n list: { fields: ['controlNo', 'name', 'email'] },\n columns: [\n { name: 'id', hidden: true },\n { name: 'controlNo',\n width: 120,\n header: { renderer: () => i18next.t('field.control-no') },\n filter: 'search',\n sortable: true\n },\n { name: 'name',\n width: 120,\n header: { renderer: () => i18next.t('field.name') },\n filter: 'search',\n sortable: true\n },\n { name: 'email',\n width: 150,\n header: { renderer: () => i18next.t('label.email', { defaultValue: 'email' }) },\n filter: false,\n sortable: true\n }\n ],\n valueField: 'id',\n nameField: 'name',\n descriptionField: 'controlNo'\n }\n },\n sortable: true,\n width: 120\n },\n { type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n width: 70,\n record: { align: 'center',\n editable: true\n },\n filter: true,\n sortable: true\n },\n { type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n width: 90,\n sortable: false\n },\n { type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n width: 180,\n sortable: true\n },\n { type: 'image',\n name: 'picture',\n record: { renderer: function (value, column, record, rowIndex, field) { return html`<ox-pfp-view\n style=\"height:90%; width: unset; aspect-ratio: 1 / 1;\"\n .profile=${record.picture}\n .name=${record.name}\n ></ox-pfp-view>`\n }\n },\n hidden: true\n }\n ],\n rows: { appendable: false,\n selectable: { multiple: true\n }\n },\n sorters: [\n { name: 'controlNo'\n }\n ],\n tree: { childrenProperty: 'children',\n expanded: () => true\n }\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) { if (this.active) { // do something here when this page just became as active\n }\n }\n\n async delete() { if (!this.grist.selected || this.grist.selected.length == 0) { await OxPrompt.open({ title: i18next.t('text.department-not-selected'),\n confirmButton: { text: i18next.t('button.confirm', { defaultValue: 'confirm' }) }\n })\n return\n }\n\n if (this.grist.selected.find(selected => selected.children && selected.children.length > 0)) { await OxPrompt.open({ title: i18next.t('text.department-with-children-cannot-be-deleted'),\n confirmButton: { text: i18next.t('button.confirm', { defaultValue: 'confirm' }) }\n })\n return\n }\n\n if (await OxPrompt.confirmDelete({ count: this.grist.selected.length })) { const temporaries = this.grist.selected.filter(record => !record.id)\n\n if (temporaries && temporaries.length > 0) { this.grist.fetch()\n }\n\n const ids = this.grist.selected.filter(record => record.id).map(record => record.id)\n\n if (ids && ids.length > 0) { const response = await client.mutate({ mutation: gql`\n mutation ($ids: [String!]!) { deleteDepartments(ids: $ids)\n }\n `,\n variables: { ids\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n notify({ message: i18next.t('text.deleted')\n })\n }\n }\n }\n }\n\n async save() { let patches = this.grist.dirtyRecords\n if (patches && patches.length) { patches = patches.map(patch => { let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) { patchField[key] = dirtyFields[key].after\n }\n patchField.parent = patch.parent\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({ mutation: gql`\n mutation ($patches: [DepartmentPatch!]!) { updateMultipleDepartment(patches: $patches) { name\n }\n }\n `,\n variables: { patches\n },\n context: { hasUpload: true\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"department-list-page.js","sourceRoot":"","sources":["../../../client/pages/department/department-list-page.ts"],"names":[],"mappings":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CAAC,KAAK,CAAC,YAAY,CAAA;QACtD,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YAAO,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;YAE7E,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,EAAU,QAAQ,EAAE,GAAG,CAAA;;;;SAIzD;gBACD,SAAS,EAAE,EAAY,OAAO;iBACpC;gBACM,OAAO,EAAE,EAAY,SAAS,EAAE,IAAI;iBAC1C;aACA,CAAC,CAAA;YAEG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;gBAAS,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;YACvD,CAAC;QACD,CAAC;IACD,CAAC;;AA/SS;IAAR,KAAK,EAAE;8BAAQ,UAAU;gDAAA;AACjB;IAAR,KAAK,EAAE;8BAAY,UAAU;oDAAA;AAEH;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;iDAAA;AAsChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uDAAiB;AA7DjC,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAoU9B","sourcesContent":["import '@operato/data-tree'\nimport '@operato/data-grist/ox-record-creator.js'\n\nimport { CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { PageView } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { isMobileDevice } from '@operato/utils'\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { notify } from '@operato/layout'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\n\nimport gql from 'graphql-tag'\n\nimport { DepartmentImporter } from './department-importer'\nimport { toDepartmentPatch } from './department-patch'\nimport { Department } from '../../types/department'\n\nconst SubDepartmentFragment = gql`\n fragment SubDepartmentFragment on Department { id\n controlNo\n name\n description\n\n parent { id\n name\n }\n\n manager { id\n name\n controlNo\n photo\n email\n }\n active\n picture\n\n updater { id\n name\n }\n updatedAt\n }\n`\n\n@customElement('department-list-page')\nexport class DepartmentListPage extends localize(i18next)(ScopedElementsMixin(PageView)) { static styles = [\n /* The work surface frame for a list screen (ADR-0060 decision 8). */\n WorkSurfacePageStyles,\n ScrollbarStyles,\n CommonHeaderStyles,\n css`\n :host {\n --grid-record-emphasized-background-color: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n .header { grid-template-areas: 'filters';\n }\n `\n ]\n\n static get scopedElements() { return { 'department-importer': DepartmentImporter\n }\n }\n\n @state() root?: Department\n @state() selected?: Department\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() { return {\n /*\n * Full text search sits in the title bar, the way these applications carry it\n * (ADR-0060 decision 9; user instruction 2026-09-18 - framework screens included).\n * It searches the columns that declare a search filter.\n */\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n }, title: i18next.t('title.department list'),\n help: 'organization/department',\n actions: [\n { icon: 'add',\n title: i18next.t('button.add', { defaultValue: 'add' }),\n action: () => this.grist.addRecord()\n },\n // { // icon: 'add',\n // title: i18next.t('button.add-sibling-dept'),\n // action: () => this.grist.addSiblingNodes()\n // },\n { icon: 'save',\n title: i18next.t('button.save'),\n action: this.save.bind(this)\n },\n { icon: 'delete',\n title: i18next.t('button.delete'),\n action: this.delete.bind(this),\n emphasis: { danger: true\n }\n }\n ].filter(Boolean)\n }\n }\n\n @property({ type: Object }) gristConfig: any\n\n render() { const mode = isMobileDevice() ? 'CARD' : 'GRID'\n\n return html`\n <ox-grist class=\"page-fill\" .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form class=\"filter\" autofocus without-search></ox-filters-form>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) { const response = await client.query({ query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) { responses: departmentRoots(filters: $filters, pagination: $pagination, sortings: $sortings) { total\n items { ...SubDepartmentFragment\n children(filters: $filters, sortings: $sortings) { ...SubDepartmentFragment\n children(filters: $filters, sortings: $sortings) { ...SubDepartmentFragment\n children(filters: $filters, sortings: $sortings) { ...SubDepartmentFragment\n children(filters: $filters, sortings: $sortings) { ...SubDepartmentFragment\n children(filters: $filters, sortings: $sortings) { ...SubDepartmentFragment\n children(filters: $filters, sortings: $sortings) { ...SubDepartmentFragment\n children(filters: $filters, sortings: $sortings) { ...SubDepartmentFragment\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n ${SubDepartmentFragment}\n `,\n variables: { filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n const { items: records } = response.data.responses\n\n /*\n * Count every row the screen draws, not the roots.\n *\n * `departmentRoots` counts what it returns - top level departments - and this screen draws each\n * root with its whole subtree underneath. With one root and thirty eight departments the pager\n * said \"1 in total\" under thirty eight visible rows.\n */\n const countTree = (list: any[]): number =>\n (list || []).reduce((sum, record) => sum + 1 + countTree(record.children), 0)\n\n return { total: countTree(records),\n records\n }\n }\n\n async pageInitialized(lifecycle: any) { this.gristConfig = { pagination: { pages: [50, 100, 200] },\n list: { thumbnail: 'profile',\n fields: ['controlNo', 'name'],\n details: ['email', 'manager', 'updatedAt']\n },\n columns: [\n { type: 'gutter',\n gutterName: 'dirty',\n fixed: true\n },\n { type: 'tree',\n name: 'name',\n label: true,\n header: i18next.t('label.name', { defaultValue: 'name' }),\n record: { editable: true,\n options: { selectable: true\n }\n },\n filter: 'search',\n sortable: true,\n width: 200,\n fixed: true,\n handlers: { contextmenu: 'contextmenu-tree-mutation'\n }\n },\n { name: 'id', hidden: true },\n { type: 'string',\n name: 'controlNo',\n header: i18next.t('label.control-no'),\n record: { editable: true\n },\n filter: 'search',\n sortable: true,\n /* 부서 코드는 본부-팀-조까지 이어 붙는다(MFG-ASSY-A) — 110px 에서는 잘렸다. */\n width: 150\n },\n { type: 'department-object',\n name: 'parent',\n header: i18next.t('field.parent-department'),\n record: { editable: true\n },\n width: 150\n },\n { type: 'string',\n name: 'description',\n header: i18next.t('label.description', { defaultValue: 'description' }),\n record: { editable: true\n },\n filter: 'search',\n sortable: true,\n width: 200\n },\n { type: 'resource-object',\n name: 'manager',\n header: i18next.t('label.manager'),\n record: { editable: true,\n options: { title: i18next.t('title.employee list'),\n queryName: 'employees',\n pagination: { pages: [50, 100, 200] },\n basicArgs: { filters: [\n { name: 'active',\n operator: 'eq',\n value: true\n }\n ]\n },\n list: { fields: ['controlNo', 'name', 'email'] },\n columns: [\n { name: 'id', hidden: true },\n { name: 'controlNo',\n width: 120,\n header: { renderer: () => i18next.t('field.control-no') },\n filter: 'search',\n sortable: true\n },\n { name: 'name',\n width: 120,\n header: { renderer: () => i18next.t('field.name') },\n filter: 'search',\n sortable: true\n },\n { name: 'email',\n width: 150,\n header: { renderer: () => i18next.t('label.email', { defaultValue: 'email' }) },\n filter: false,\n sortable: true\n }\n ],\n valueField: 'id',\n nameField: 'name',\n descriptionField: 'controlNo'\n }\n },\n sortable: true,\n width: 120\n },\n { type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n width: 70,\n record: { align: 'center',\n editable: true\n },\n filter: true,\n sortable: true\n },\n { type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n width: 90,\n sortable: false\n },\n { type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n width: 180,\n sortable: true\n },\n { type: 'image',\n name: 'picture',\n record: { renderer: function (value, column, record, rowIndex, field) { return html`<ox-pfp-view\n style=\"height:90%; width: unset; aspect-ratio: 1 / 1;\"\n .profile=${record.picture}\n .name=${record.name}\n ></ox-pfp-view>`\n }\n },\n hidden: true\n }\n ],\n rows: { appendable: false,\n selectable: { multiple: true\n }\n },\n sorters: [\n { name: 'controlNo'\n }\n ],\n tree: { childrenProperty: 'children',\n expanded: () => true\n }\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) { if (this.active) { // do something here when this page just became as active\n }\n }\n\n async delete() { if (!this.grist.selected || this.grist.selected.length == 0) { await OxPrompt.open({ title: i18next.t('text.department-not-selected'),\n confirmButton: { text: i18next.t('button.confirm', { defaultValue: 'confirm' }) }\n })\n return\n }\n\n if (this.grist.selected.find(selected => selected.children && selected.children.length > 0)) { await OxPrompt.open({ title: i18next.t('text.department-with-children-cannot-be-deleted'),\n confirmButton: { text: i18next.t('button.confirm', { defaultValue: 'confirm' }) }\n })\n return\n }\n\n if (await OxPrompt.confirmDelete({ count: this.grist.selected.length })) { const temporaries = this.grist.selected.filter(record => !record.id)\n\n if (temporaries && temporaries.length > 0) { this.grist.fetch()\n }\n\n const ids = this.grist.selected.filter(record => record.id).map(record => record.id)\n\n if (ids && ids.length > 0) { const response = await client.mutate({ mutation: gql`\n mutation ($ids: [String!]!) { deleteDepartments(ids: $ids)\n }\n `,\n variables: { ids\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n notify({ message: i18next.t('text.deleted')\n })\n }\n }\n }\n }\n\n async save() { let patches = this.grist.dirtyRecords\n if (patches && patches.length) { patches = patches.map(toDepartmentPatch)\n\n const response = await client.mutate({ mutation: gql`\n mutation ($patches: [DepartmentPatch!]!) { updateMultipleDepartment(patches: $patches) { name\n }\n }\n `,\n variables: { patches\n },\n context: { hasUpload: true\n }\n })\n\n if (!response.errors) { this.grist.fetch()\n }\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the department list sends for one edited row: the cells that changed, and the parent as a reference.
|
|
3
|
+
*
|
|
4
|
+
* The parent cell's selector hands back the department it drew (id, code, name, description), and
|
|
5
|
+
* DepartmentPatch.parent takes only { id }; null makes the department top-level. A row added with
|
|
6
|
+
* "add child node" carries its parent from the start, so a new row sends it even when the cell was not
|
|
7
|
+
* touched.
|
|
8
|
+
*/
|
|
9
|
+
export declare function toDepartmentPatch(record: any): any;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the department list sends for one edited row: the cells that changed, and the parent as a reference.
|
|
3
|
+
*
|
|
4
|
+
* The parent cell's selector hands back the department it drew (id, code, name, description), and
|
|
5
|
+
* DepartmentPatch.parent takes only { id }; null makes the department top-level. A row added with
|
|
6
|
+
* "add child node" carries its parent from the start, so a new row sends it even when the cell was not
|
|
7
|
+
* touched.
|
|
8
|
+
*/
|
|
9
|
+
export function toDepartmentPatch(record) {
|
|
10
|
+
const patch = record.id ? { id: record.id } : {};
|
|
11
|
+
const dirtyFields = record.__dirtyfields__ || {};
|
|
12
|
+
for (const key in dirtyFields) {
|
|
13
|
+
patch[key] = dirtyFields[key].after;
|
|
14
|
+
}
|
|
15
|
+
const parent = 'parent' in dirtyFields ? dirtyFields.parent.after : record.__dirty__ == '+' ? record.parent : undefined;
|
|
16
|
+
if (parent !== undefined) {
|
|
17
|
+
patch.parent = parent?.id ? { id: parent.id } : null;
|
|
18
|
+
}
|
|
19
|
+
patch.cuFlag = record.__dirty__;
|
|
20
|
+
return patch;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=department-patch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"department-patch.js","sourceRoot":"","sources":["../../../client/pages/department/department-patch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAW;IAC3C,MAAM,KAAK,GAAQ,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IACrD,MAAM,WAAW,GAAG,MAAM,CAAC,eAAe,IAAI,EAAE,CAAA;IAEhD,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QAC9B,KAAK,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,CAAA;IACrC,CAAC;IAED,MAAM,MAAM,GAAG,QAAQ,IAAI,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,IAAI,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;IAEvH,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,KAAK,CAAC,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;IACtD,CAAC;IAED,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,SAAS,CAAA;IAE/B,OAAO,KAAK,CAAA;AACd,CAAC","sourcesContent":["/**\n * What the department list sends for one edited row: the cells that changed, and the parent as a reference.\n *\n * The parent cell's selector hands back the department it drew (id, code, name, description), and\n * DepartmentPatch.parent takes only { id }; null makes the department top-level. A row added with\n * \"add child node\" carries its parent from the start, so a new row sends it even when the cell was not\n * touched.\n */\nexport function toDepartmentPatch(record: any): any {\n const patch: any = record.id ? { id: record.id } : {}\n const dirtyFields = record.__dirtyfields__ || {}\n\n for (const key in dirtyFields) {\n patch[key] = dirtyFields[key].after\n }\n\n const parent = 'parent' in dirtyFields ? dirtyFields.parent.after : record.__dirty__ == '+' ? record.parent : undefined\n\n if (parent !== undefined) {\n patch.parent = parent?.id ? { id: parent.id } : null\n }\n\n patch.cuFlag = record.__dirty__\n\n return patch\n}\n"]}
|