@things-factory/organization 6.0.24 → 6.0.25

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.
Files changed (40) hide show
  1. package/client/component/approval-line-items-editor.ts +4 -2
  2. package/client/component/assignees-editor-popup.ts +75 -0
  3. package/client/component/assignees-editor.ts +211 -0
  4. package/client/component/assignees-view.ts +55 -0
  5. package/client/component/index.ts +5 -1
  6. package/client/model/approval-line.ts +3 -15
  7. package/client/model/org-member.ts +21 -0
  8. package/dist-client/component/approval-line-items-editor.js +4 -2
  9. package/dist-client/component/approval-line-items-editor.js.map +1 -1
  10. package/dist-client/component/assignees-editor-popup.d.ts +20 -0
  11. package/dist-client/component/assignees-editor-popup.js +81 -0
  12. package/dist-client/component/assignees-editor-popup.js.map +1 -0
  13. package/dist-client/component/assignees-editor.d.ts +27 -0
  14. package/dist-client/component/assignees-editor.js +208 -0
  15. package/dist-client/component/assignees-editor.js.map +1 -0
  16. package/dist-client/component/assignees-view.d.ts +10 -0
  17. package/dist-client/component/assignees-view.js +55 -0
  18. package/dist-client/component/assignees-view.js.map +1 -0
  19. package/dist-client/component/index.d.ts +3 -0
  20. package/dist-client/component/index.js +3 -0
  21. package/dist-client/component/index.js.map +1 -1
  22. package/dist-client/model/approval-line.d.ts +3 -13
  23. package/dist-client/model/approval-line.js +0 -8
  24. package/dist-client/model/approval-line.js.map +1 -1
  25. package/dist-client/model/org-member.d.ts +19 -0
  26. package/dist-client/model/org-member.js +14 -0
  27. package/dist-client/model/org-member.js.map +1 -0
  28. package/dist-client/tsconfig.tsbuildinfo +1 -1
  29. package/dist-server/service/approval-line/approval-line-item.js +22 -31
  30. package/dist-server/service/approval-line/approval-line-item.js.map +1 -1
  31. package/dist-server/service/approval-line/approval-line-query.js +7 -1
  32. package/dist-server/service/approval-line/approval-line-query.js.map +1 -1
  33. package/dist-server/tsconfig.tsbuildinfo +1 -1
  34. package/package.json +5 -5
  35. package/server/service/approval-line/approval-line-item.ts +12 -26
  36. package/server/service/approval-line/approval-line-query.ts +7 -1
  37. package/translations/en.json +1 -0
  38. package/translations/ko.json +1 -0
  39. package/translations/ms.json +1 -0
  40. package/translations/zh.json +1 -0
@@ -61,7 +61,9 @@ export class ApprovalLineItemsEditor extends localize(i18next)(LitElement) {
61
61
  .config=${this.gristConfig}
62
62
  .fetchHandler=${this.fetchHandler.bind(this)}
63
63
  @record-change=${e => {
64
- this.value = [...((this.grist as any)?._data.records || [])]
64
+ this.value = ((this.grist as any)?._data.records || []).map(v => {
65
+ return { type: v.type, value: v.value, approver: v.approver }
66
+ })
65
67
  this.dispatchEvent(
66
68
  new CustomEvent('change', {
67
69
  bubbles: true,
@@ -111,7 +113,7 @@ export class ApprovalLineItemsEditor extends localize(i18next)(LitElement) {
111
113
  header: i18next.t('field.type'),
112
114
  record: {
113
115
  editable: true,
114
- options: ['', 'Employee', 'Department', 'Role']
116
+ options: ['', 'Employee', 'Department', 'Role', 'MyDepartment', 'MySupervisor', 'Myself']
115
117
  },
116
118
  width: 140
117
119
  },
@@ -0,0 +1,75 @@
1
+ import { css, html, LitElement } from 'lit'
2
+ import { customElement, property, query, state } from 'lit/decorators.js'
3
+
4
+ import { i18next, localize } from '@operato/i18n'
5
+ import { ButtonContainerStyles } from '@operato/styles'
6
+ import { closePopup } from '@operato/popup'
7
+
8
+ import { AssigneesEditor } from './assignees-editor'
9
+ import { AssigneeItem } from '../model/org-member'
10
+
11
+ /**
12
+ * 결재선의 각 결재자 리스트를 편집한다.
13
+ */
14
+ @customElement('assignees-editor-popup')
15
+ export class AssigneesEditorPopup extends localize(i18next)(LitElement) {
16
+ static styles = [
17
+ ButtonContainerStyles,
18
+ css`
19
+ :host {
20
+ display: flex;
21
+ flex-direction: column;
22
+
23
+ background-color: #fff;
24
+ }
25
+
26
+ assignees-editor {
27
+ flex: 1;
28
+ }
29
+ `
30
+ ]
31
+
32
+ @property({ type: Object }) value?: AssigneeItem[]
33
+
34
+ @property({ type: Object }) confirmCallback?: (value?: AssigneeItem[] | null) => void
35
+ @query('assignees-editor') editor!: AssigneesEditor
36
+
37
+ /* this.value는 (원인불명으로) 값이 Reset되므로, 변화값을 유지하도록 별도로 changedValue를 사용함 */
38
+ private changedValue?: AssigneeItem[] = this.value
39
+
40
+ render() {
41
+ return html`
42
+ <assignees-editor
43
+ .value=${this.value}
44
+ @change=${(e: CustomEvent) => {
45
+ this.changedValue = [...e.detail]
46
+ }}
47
+ ></assignees-editor>
48
+
49
+ <div class="button-container">
50
+ <mwc-button @click=${this.onEmpty.bind(this)}>${i18next.t('button.empty')}</mwc-button>
51
+ <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
52
+ <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
53
+ </div>
54
+ `
55
+ }
56
+
57
+ firstUpdated() {
58
+ this.changedValue = this.value
59
+ }
60
+
61
+ onEmpty() {
62
+ this.confirmCallback && this.confirmCallback(null)
63
+ closePopup(this)
64
+ }
65
+
66
+ onCancel() {
67
+ closePopup(this)
68
+ }
69
+
70
+ onConfirm() {
71
+ this.confirmCallback && this.confirmCallback(this.changedValue)
72
+
73
+ closePopup(this)
74
+ }
75
+ }
@@ -0,0 +1,211 @@
1
+ import './assignees-view'
2
+
3
+ import { css, html, LitElement } from 'lit'
4
+ import { customElement, property, query, state } from 'lit/decorators.js'
5
+
6
+ import { i18next, localize } from '@operato/i18n'
7
+ import { DataGrist, getEditor, getRenderer } from '@operato/data-grist'
8
+ import { isMobileDevice } from '@operato/utils'
9
+ import { ButtonContainerStyles } from '@operato/styles'
10
+
11
+ import { AssigneeItem } from '../model/org-member'
12
+
13
+ /**
14
+ * Assignee 리스트를 편집한다.
15
+ */
16
+ @customElement('assignees-editor')
17
+ export class AssigneesEditor extends localize(i18next)(LitElement) {
18
+ static styles = [
19
+ ButtonContainerStyles,
20
+ css`
21
+ :host {
22
+ display: flex;
23
+ flex-direction: column;
24
+
25
+ background-color: #fff;
26
+ }
27
+
28
+ assignees-view {
29
+ min-height: 100px;
30
+ }
31
+
32
+ ox-grist {
33
+ flex: 1;
34
+ }
35
+
36
+ #select {
37
+ display: flex;
38
+ justify-content: end;
39
+ padding: 10px;
40
+ }
41
+ `
42
+ ]
43
+
44
+ @property({ type: Object }) value?: AssigneeItem[]
45
+
46
+ @state() gristConfig?: any
47
+
48
+ @query('ox-grist') grist?: DataGrist
49
+
50
+ render() {
51
+ return html`
52
+ <assignees-view .value=${this.value}></assignees-view>
53
+
54
+ <ox-grist
55
+ .mode=${isMobileDevice() ? 'CARD' : 'GRID'}
56
+ .config=${this.gristConfig}
57
+ .fetchHandler=${this.fetchHandler.bind(this)}
58
+ @record-change=${e => {
59
+ this.value = ((this.grist as any)?._data.records || []).map(v => {
60
+ return { type: v.type, value: v.value, assignee: v.assignee }
61
+ })
62
+ this.dispatchEvent(
63
+ new CustomEvent('change', {
64
+ bubbles: true,
65
+ composed: true,
66
+ detail: this.value
67
+ })
68
+ )
69
+ }}
70
+ >
71
+ <div slot="headroom">
72
+ <div id="select">
73
+ <mwc-button raised danger @click=${() => this.deleteDataItems()}>${i18next.t('button.delete')}</mwc-button>
74
+ </div>
75
+ </div>
76
+ </ox-grist>
77
+ `
78
+ }
79
+
80
+ async firstUpdated() {
81
+ this.gristConfig = {
82
+ list: {
83
+ fields: ['type', 'assignee']
84
+ },
85
+ columns: [
86
+ { type: 'gutter', gutterName: 'row-selector', multiple: true },
87
+ { type: 'gutter', gutterName: 'sequence' },
88
+ {
89
+ type: 'gutter',
90
+ gutterName: 'button',
91
+ icon: 'arrow_upward',
92
+ handlers: {
93
+ click: 'move-up'
94
+ }
95
+ },
96
+ {
97
+ type: 'gutter',
98
+ gutterName: 'button',
99
+ icon: 'arrow_downward',
100
+ handlers: {
101
+ click: 'move-down'
102
+ }
103
+ },
104
+ {
105
+ type: 'select',
106
+ name: 'type',
107
+ header: i18next.t('field.type'),
108
+ record: {
109
+ editable: true,
110
+ options: ['', 'Employee', 'Department', 'Role', 'MyDepartment', 'MySupervisor', 'Myself']
111
+ },
112
+ width: 140
113
+ },
114
+ {
115
+ type: 'resource-object',
116
+ name: 'assignee',
117
+ header: i18next.t('field.assignee'),
118
+ record: {
119
+ editable: true,
120
+ editor: function (value, column, record, rowIndex, field) {
121
+ var options = {}
122
+ switch (record.type) {
123
+ case 'Employee':
124
+ options = {
125
+ title: i18next.t('title.employee list'),
126
+ queryName: 'employees',
127
+ columns: [
128
+ { name: 'id', hidden: true },
129
+ {
130
+ name: 'controlNo',
131
+ header: { renderer: () => i18next.t('field.control-no') },
132
+ filter: 'search'
133
+ },
134
+ { name: 'name', header: { renderer: () => i18next.t('field.name') }, filter: 'search' }
135
+ ],
136
+ list: { fields: ['name', 'control-no'] },
137
+ valueField: 'id',
138
+ nameField: 'name',
139
+ descriptionField: 'controlNo'
140
+ }
141
+ break
142
+ case 'Department':
143
+ options = {
144
+ title: i18next.t('title.department list'),
145
+ queryName: 'departments'
146
+ }
147
+ break
148
+ case 'Role':
149
+ options = {
150
+ title: i18next.t('title.lookup role'),
151
+ queryName: 'roles'
152
+ }
153
+ break
154
+ default:
155
+ options = {}
156
+ }
157
+
158
+ var dynamicRecord = { ...column.record, options }
159
+
160
+ return getEditor(column.type)(value, { ...column, record: dynamicRecord }, record, rowIndex, field)
161
+ },
162
+ renderer: function (value, column, record, rowIndex, field) {
163
+ var options = {}
164
+ switch (record.type) {
165
+ case 'Employee':
166
+ options = {
167
+ valueField: 'id',
168
+ nameField: 'name',
169
+ descriptionField: 'controlNo'
170
+ }
171
+ break
172
+ case 'Department':
173
+ case 'Role':
174
+ default:
175
+ break
176
+ }
177
+
178
+ var dynamicRecord = { ...column.record, options }
179
+
180
+ return getRenderer(column.type)(value, { ...column, record: dynamicRecord }, record, rowIndex, field)
181
+ }
182
+ },
183
+ width: 180
184
+ }
185
+ ],
186
+ rows: {
187
+ selectable: {
188
+ multiple: true
189
+ }
190
+ },
191
+ pagination: {
192
+ infinite: true
193
+ },
194
+ sorters: []
195
+ }
196
+ }
197
+
198
+ async fetchHandler({ filters, page, limit, sortings = [] }) {
199
+ const value = [...(this.value || [])]
200
+ this.value = value
201
+
202
+ return {
203
+ total: value.length,
204
+ records: value
205
+ }
206
+ }
207
+
208
+ async deleteDataItems() {
209
+ this.grist?.deleteSelectedRecords(false)
210
+ }
211
+ }
@@ -0,0 +1,55 @@
1
+ import { css, html, LitElement, TemplateResult } from 'lit'
2
+ import { customElement, property, query } from 'lit/decorators.js'
3
+
4
+ import { i18next, localize } from '@operato/i18n'
5
+ import { AssigneeItem } from '../model/org-member'
6
+
7
+ @customElement('assignees-view')
8
+ export class AssigneesView extends localize(i18next)(LitElement) {
9
+ static styles = [
10
+ css`
11
+ :host {
12
+ display: flex;
13
+ flex-direction: row;
14
+ flex-wrap: wrap;
15
+
16
+ gap: 10px;
17
+ padding: 10px;
18
+
19
+ align-items: center;
20
+
21
+ background-color: #fff;
22
+
23
+ --mdc-icon-size: 3em;
24
+ color: var(--secondary-color, black);
25
+ }
26
+
27
+ div[assignee] {
28
+ padding: 5px;
29
+ border-radius: 5px;
30
+ border: 2px solid var(--primary-color, black);
31
+ }
32
+ `
33
+ ]
34
+
35
+ @property({ type: Object }) value?: AssigneeItem[]
36
+
37
+ render() {
38
+ const items = this.value || []
39
+
40
+ return html` ${items.map((item, order) => this.renderItem(item, order + 1))} `
41
+ }
42
+
43
+ renderItem(item: AssigneeItem, order: number): TemplateResult {
44
+ const { type, assignee } = item
45
+ const { name, description, controlNo } = assignee || {}
46
+ const subname = (description || controlNo) && `(${description || controlNo})`
47
+
48
+ return html`
49
+ <div assignee>
50
+ <div>${type}</div>
51
+ <div><span name>${name}</span>${subname}</div>
52
+ </div>
53
+ `
54
+ }
55
+ }
@@ -2,7 +2,11 @@ export * from './department-selector'
2
2
  export * from './approval-line-selector'
3
3
 
4
4
  export * from './department-view'
5
- export * from './approval-line-view'
6
5
 
6
+ export * from './approval-line-view'
7
7
  export * from './approval-line-items-editor'
8
8
  export * from './approval-line-items-editor-popup'
9
+
10
+ export * from './assignees-view'
11
+ export * from './assignees-editor'
12
+ export * from './assignees-editor-popup'
@@ -4,29 +4,17 @@ import { Role } from './role'
4
4
 
5
5
  import { Employee } from './employee'
6
6
  import { Department } from './department'
7
-
8
- export enum ApprovalLineItemType {
9
- Employee = 'Employee',
10
- Department = 'Department',
11
- Role = 'Role'
12
- }
7
+ import { OrgMemberTarget, OrgMemberTargetType } from './org-member'
13
8
 
14
9
  export enum ApprovalLineOwnerType {
15
10
  Employee = 'Employee',
16
11
  Common = 'Common'
17
12
  }
18
13
 
19
- export class ApproverTarget {
20
- id?: string
21
- name?: string
22
- description?: string
23
- controlNo?: string
24
- }
25
-
26
14
  export class ApprovalLineItem {
27
- type?: ApprovalLineItemType
15
+ type?: OrgMemberTargetType
28
16
  value?: string
29
- approver?: ApproverTarget
17
+ approver?: OrgMemberTarget
30
18
  }
31
19
 
32
20
  export class ApprovalLine {
@@ -0,0 +1,21 @@
1
+ export enum OrgMemberTargetType {
2
+ Employee = 'Employee',
3
+ Department = 'Department',
4
+ Role = 'Role',
5
+ Myself = 'Myself',
6
+ MyDepartment = 'MyDepartment',
7
+ MySupervisor = 'MySupervisor'
8
+ }
9
+
10
+ export class OrgMemberTarget {
11
+ id?: string
12
+ name?: string
13
+ description?: string
14
+ controlNo?: string
15
+ }
16
+
17
+ export class AssigneeItem {
18
+ type?: OrgMemberTargetType
19
+ value?: string
20
+ assignee?: OrgMemberTarget
21
+ }
@@ -22,7 +22,9 @@ let ApprovalLineItemsEditor = class ApprovalLineItemsEditor extends localize(i18
22
22
  .fetchHandler=${this.fetchHandler.bind(this)}
23
23
  @record-change=${e => {
24
24
  var _a;
25
- this.value = [...(((_a = this.grist) === null || _a === void 0 ? void 0 : _a._data.records) || [])];
25
+ this.value = (((_a = this.grist) === null || _a === void 0 ? void 0 : _a._data.records) || []).map(v => {
26
+ return { type: v.type, value: v.value, approver: v.approver };
27
+ });
26
28
  this.dispatchEvent(new CustomEvent('change', {
27
29
  bubbles: true,
28
30
  composed: true,
@@ -69,7 +71,7 @@ let ApprovalLineItemsEditor = class ApprovalLineItemsEditor extends localize(i18
69
71
  header: i18next.t('field.type'),
70
72
  record: {
71
73
  editable: true,
72
- options: ['', 'Employee', 'Department', 'Role']
74
+ options: ['', 'Employee', 'Department', 'Role', 'MyDepartment', 'MySupervisor', 'Myself']
73
75
  },
74
76
  width: 140
75
77
  },
@@ -1 +1 @@
1
- {"version":3,"file":"approval-line-items-editor.js","sourceRoot":"","sources":["../../client/component/approval-line-items-editor.ts"],"names":[],"mappings":";AAAA,OAAO,sBAAsB,CAAA;AAC7B,OAAO,0BAA0B,CAAA;AAEjC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,EAAE,SAAS,EAAe,MAAM,iBAAiB,CAAA;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAGvD;;GAEG;AAEI,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAoCxE,MAAM;QACJ,OAAO,IAAI,CAAA;mCACoB,IAAI,CAAC,KAAK;;gBAE7B,cAAc,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;kBAChC,IAAI,CAAC,WAAW;wBACV,IAAI,CAAC,YAAY,CAAC,IAAI,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AM,EAAE;gBACN,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,mCAAmC,CAAC;gBAC3D,OAAO,EAAE,CAAC,QAAa,EAAE,KAAU,EAAE,EAAE;oBACrC,iCAAiC;oBACjC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;gBAC5B,CAAC;aACF;SACF,CACF,CAAA;IACH,CAAC;;AApOM,8BAAM,GAAG;IACd,qBAAqB;IACrB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;KAqBF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDAA2B;AAEtD;IAAC,KAAK,EAAE;;4DAAkB;AAE1B;IAAC,KAAK,CAAC,UAAU,CAAC;8BAAS,SAAS;sDAAA;AACpC;IAAC,KAAK,CAAC,oBAAoB,CAAC;8BAAQ,gBAAgB;qDAAA;AAhCzC,uBAAuB;IADnC,aAAa,CAAC,4BAA4B,CAAC;GAC/B,uBAAuB,CAsOnC;SAtOY,uBAAuB","sourcesContent":["import './approval-line-view'\nimport './approval-line-selector'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { DataGrist, getEditor, getRenderer } from '@operato/data-grist'\nimport { isMobileDevice } from '@operato/utils'\nimport { ButtonContainerStyles } from '@operato/styles'\nimport { openPopup, PopupHandle } from '@operato/layout'\n\nimport { ApprovalLineView } from './approval-line-view'\nimport { ApprovalLine, ApprovalLineItem } from '../model/approval-line'\n\n/**\n * 결재선의 각 결재자 리스트를 편집한다.\n */\n@customElement('approval-line-items-editor')\nexport class ApprovalLineItemsEditor extends localize(i18next)(LitElement) {\n static styles = [\n ButtonContainerStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n }\n\n approval-line-view {\n min-height: 100px;\n }\n\n ox-grist {\n flex: 1;\n }\n\n #select {\n display: flex;\n justify-content: end;\n padding: 10px;\n }\n `\n ]\n\n @property({ type: Object }) value?: ApprovalLineItem[]\n\n @state() gristConfig?: any\n\n @query('ox-grist') grist?: DataGrist\n @query('approval-line-view') view?: ApprovalLineView\n\n private popup?: PopupHandle\n\n render() {\n return html`\n <approval-line-view .model=${this.value}></approval-line-view>\n <ox-grist\n .mode=${isMobileDevice() ? 'CARD' : 'GRID'}\n .config=${this.gristConfig}\n .fetchHandler=${this.fetchHandler.bind(this)}\n @record-change=${e => {\n this.value = [...((this.grist as any)?._data.records || [])]\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }}\n >\n <div slot=\"headroom\">\n <div id=\"select\">\n <mwc-button @click=${this.openSelector.bind(this)}>${i18next.t('button.copy from')}</mwc-button>\n <mwc-button raised danger @click=${() => this.deleteDataItems()}>${i18next.t('button.delete')}</mwc-button>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async firstUpdated() {\n this.gristConfig = {\n list: {\n fields: ['type', 'approver']\n },\n columns: [\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n { type: 'gutter', gutterName: 'sequence' },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'arrow_upward',\n handlers: {\n click: 'move-up'\n }\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'arrow_downward',\n handlers: {\n click: 'move-down'\n }\n },\n {\n type: 'select',\n name: 'type',\n header: i18next.t('field.type'),\n record: {\n editable: true,\n options: ['', 'Employee', 'Department', 'Role']\n },\n width: 140\n },\n {\n type: 'resource-object',\n name: 'approver',\n header: i18next.t('field.approver'),\n record: {\n editable: true,\n editor: function (value, column, record, rowIndex, field) {\n var options = {}\n switch (record.type) {\n case 'Employee':\n options = {\n title: i18next.t('title.employee list'),\n queryName: 'employees',\n columns: [\n { name: 'id', hidden: true },\n {\n name: 'controlNo',\n header: { renderer: () => i18next.t('field.control-no') },\n filter: 'search'\n },\n { name: 'name', header: { renderer: () => i18next.t('field.name') }, filter: 'search' }\n ],\n list: { fields: ['name', 'control-no'] },\n valueField: 'id',\n nameField: 'name',\n descriptionField: 'controlNo'\n }\n break\n case 'Department':\n options = {\n title: i18next.t('title.department list'),\n queryName: 'departments'\n }\n break\n case 'Role':\n options = {\n title: i18next.t('title.lookup role'),\n queryName: 'roles'\n }\n break\n default:\n options = {}\n }\n\n var dynamicRecord = { ...column.record, options }\n\n return getEditor(column.type)(value, { ...column, record: dynamicRecord }, record, rowIndex, field)\n },\n renderer: function (value, column, record, rowIndex, field) {\n var options = {}\n switch (record.type) {\n case 'Employee':\n options = {\n valueField: 'id',\n nameField: 'name',\n descriptionField: 'controlNo'\n }\n break\n case 'Department':\n case 'Role':\n default:\n break\n }\n\n var dynamicRecord = { ...column.record, options }\n\n return getRenderer(column.type)(value, { ...column, record: dynamicRecord }, record, rowIndex, field)\n }\n },\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n pagination: {\n infinite: true\n },\n sorters: []\n }\n }\n\n async fetchHandler({ filters, page, limit, sortings = [] }) {\n const value = [...(this.value || [])]\n this.value = value\n\n return {\n total: value.length,\n records: value\n }\n }\n\n async deleteDataItems() {\n this.grist?.deleteSelectedRecords(false)\n }\n\n openSelector() {\n if (this.popup) {\n delete this.popup\n }\n\n const confirmCallback = async (selected?: ApprovalLine) => {\n this.value = [...(selected?.model || [])]\n\n this.grist!.fetch()\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n\n this.popup = openPopup(\n html` <approval-line-selector .confirmCallback=${confirmCallback.bind(this)}></approval-line-selector> `,\n {\n backdrop: true,\n size: 'large',\n search: {\n placeholder: i18next.t('title.approval-line template list'),\n handler: (instance: any, value: any) => {\n /* instance: template instance */\n instance.searchText(value)\n }\n }\n }\n )\n }\n}\n"]}
1
+ {"version":3,"file":"approval-line-items-editor.js","sourceRoot":"","sources":["../../client/component/approval-line-items-editor.ts"],"names":[],"mappings":";AAAA,OAAO,sBAAsB,C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AC,CAAA;gBAC5B,CAAC;aACF;SACF,CACF,CAAA;IACH,CAAC;;AAtOM,8BAAM,GAAG;IACd,qBAAqB;IACrB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;KAqBF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDAA2B;AAEtD;IAAC,KAAK,EAAE;;4DAAkB;AAE1B;IAAC,KAAK,CAAC,UAAU,CAAC;8BAAS,SAAS;sDAAA;AACpC;IAAC,KAAK,CAAC,oBAAoB,CAAC;8BAAQ,gBAAgB;qDAAA;AAhCzC,uBAAuB;IADnC,aAAa,CAAC,4BAA4B,CAAC;GAC/B,uBAAuB,CAwOnC;SAxOY,uBAAuB","sourcesContent":["import './approval-line-view'\nimport './approval-line-selector'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { DataGrist, getEditor, getRenderer } from '@operato/data-grist'\nimport { isMobileDevice } from '@operato/utils'\nimport { ButtonContainerStyles } from '@operato/styles'\nimport { openPopup, PopupHandle } from '@operato/layout'\n\nimport { ApprovalLineView } from './approval-line-view'\nimport { ApprovalLine, ApprovalLineItem } from '../model/approval-line'\n\n/**\n * 결재선의 각 결재자 리스트를 편집한다.\n */\n@customElement('approval-line-items-editor')\nexport class ApprovalLineItemsEditor extends localize(i18next)(LitElement) {\n static styles = [\n ButtonContainerStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n }\n\n approval-line-view {\n min-height: 100px;\n }\n\n ox-grist {\n flex: 1;\n }\n\n #select {\n display: flex;\n justify-content: end;\n padding: 10px;\n }\n `\n ]\n\n @property({ type: Object }) value?: ApprovalLineItem[]\n\n @state() gristConfig?: any\n\n @query('ox-grist') grist?: DataGrist\n @query('approval-line-view') view?: ApprovalLineView\n\n private popup?: PopupHandle\n\n render() {\n return html`\n <approval-line-view .model=${this.value}></approval-line-view>\n <ox-grist\n .mode=${isMobileDevice() ? 'CARD' : 'GRID'}\n .config=${this.gristConfig}\n .fetchHandler=${this.fetchHandler.bind(this)}\n @record-change=${e => {\n this.value = ((this.grist as any)?._data.records || []).map(v => {\n return { type: v.type, value: v.value, approver: v.approver }\n })\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }}\n >\n <div slot=\"headroom\">\n <div id=\"select\">\n <mwc-button @click=${this.openSelector.bind(this)}>${i18next.t('button.copy from')}</mwc-button>\n <mwc-button raised danger @click=${() => this.deleteDataItems()}>${i18next.t('button.delete')}</mwc-button>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async firstUpdated() {\n this.gristConfig = {\n list: {\n fields: ['type', 'approver']\n },\n columns: [\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n { type: 'gutter', gutterName: 'sequence' },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'arrow_upward',\n handlers: {\n click: 'move-up'\n }\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'arrow_downward',\n handlers: {\n click: 'move-down'\n }\n },\n {\n type: 'select',\n name: 'type',\n header: i18next.t('field.type'),\n record: {\n editable: true,\n options: ['', 'Employee', 'Department', 'Role', 'MyDepartment', 'MySupervisor', 'Myself']\n },\n width: 140\n },\n {\n type: 'resource-object',\n name: 'approver',\n header: i18next.t('field.approver'),\n record: {\n editable: true,\n editor: function (value, column, record, rowIndex, field) {\n var options = {}\n switch (record.type) {\n case 'Employee':\n options = {\n title: i18next.t('title.employee list'),\n queryName: 'employees',\n columns: [\n { name: 'id', hidden: true },\n {\n name: 'controlNo',\n header: { renderer: () => i18next.t('field.control-no') },\n filter: 'search'\n },\n { name: 'name', header: { renderer: () => i18next.t('field.name') }, filter: 'search' }\n ],\n list: { fields: ['name', 'control-no'] },\n valueField: 'id',\n nameField: 'name',\n descriptionField: 'controlNo'\n }\n break\n case 'Department':\n options = {\n title: i18next.t('title.department list'),\n queryName: 'departments'\n }\n break\n case 'Role':\n options = {\n title: i18next.t('title.lookup role'),\n queryName: 'roles'\n }\n break\n default:\n options = {}\n }\n\n var dynamicRecord = { ...column.record, options }\n\n return getEditor(column.type)(value, { ...column, record: dynamicRecord }, record, rowIndex, field)\n },\n renderer: function (value, column, record, rowIndex, field) {\n var options = {}\n switch (record.type) {\n case 'Employee':\n options = {\n valueField: 'id',\n nameField: 'name',\n descriptionField: 'controlNo'\n }\n break\n case 'Department':\n case 'Role':\n default:\n break\n }\n\n var dynamicRecord = { ...column.record, options }\n\n return getRenderer(column.type)(value, { ...column, record: dynamicRecord }, record, rowIndex, field)\n }\n },\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n pagination: {\n infinite: true\n },\n sorters: []\n }\n }\n\n async fetchHandler({ filters, page, limit, sortings = [] }) {\n const value = [...(this.value || [])]\n this.value = value\n\n return {\n total: value.length,\n records: value\n }\n }\n\n async deleteDataItems() {\n this.grist?.deleteSelectedRecords(false)\n }\n\n openSelector() {\n if (this.popup) {\n delete this.popup\n }\n\n const confirmCallback = async (selected?: ApprovalLine) => {\n this.value = [...(selected?.model || [])]\n\n this.grist!.fetch()\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n\n this.popup = openPopup(\n html` <approval-line-selector .confirmCallback=${confirmCallback.bind(this)}></approval-line-selector> `,\n {\n backdrop: true,\n size: 'large',\n search: {\n placeholder: i18next.t('title.approval-line template list'),\n handler: (instance: any, value: any) => {\n /* instance: template instance */\n instance.searchText(value)\n }\n }\n }\n )\n }\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import { LitElement } from 'lit';
2
+ import { AssigneesEditor } from './assignees-editor';
3
+ import { AssigneeItem } from '../model/org-member';
4
+ declare const AssigneesEditorPopup_base: (new (...args: any[]) => LitElement) & typeof LitElement;
5
+ /**
6
+ * 결재선의 각 결재자 리스트를 편집한다.
7
+ */
8
+ export declare class AssigneesEditorPopup extends AssigneesEditorPopup_base {
9
+ static styles: import("lit").CSSResult[];
10
+ value?: AssigneeItem[];
11
+ confirmCallback?: (value?: AssigneeItem[] | null) => void;
12
+ editor: AssigneesEditor;
13
+ private changedValue?;
14
+ render(): import("lit-html").TemplateResult<1>;
15
+ firstUpdated(): void;
16
+ onEmpty(): void;
17
+ onCancel(): void;
18
+ onConfirm(): void;
19
+ }
20
+ export {};
@@ -0,0 +1,81 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { css, html, LitElement } from 'lit';
3
+ import { customElement, property, query } from 'lit/decorators.js';
4
+ import { i18next, localize } from '@operato/i18n';
5
+ import { ButtonContainerStyles } from '@operato/styles';
6
+ import { closePopup } from '@operato/popup';
7
+ import { AssigneesEditor } from './assignees-editor';
8
+ /**
9
+ * 결재선의 각 결재자 리스트를 편집한다.
10
+ */
11
+ let AssigneesEditorPopup = class AssigneesEditorPopup extends localize(i18next)(LitElement) {
12
+ constructor() {
13
+ super(...arguments);
14
+ /* this.value는 (원인불명으로) 값이 Reset되므로, 변화값을 유지하도록 별도로 changedValue를 사용함 */
15
+ this.changedValue = this.value;
16
+ }
17
+ render() {
18
+ return html `
19
+ <assignees-editor
20
+ .value=${this.value}
21
+ @change=${(e) => {
22
+ this.changedValue = [...e.detail];
23
+ }}
24
+ ></assignees-editor>
25
+
26
+ <div class="button-container">
27
+ <mwc-button @click=${this.onEmpty.bind(this)}>${i18next.t('button.empty')}</mwc-button>
28
+ <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>
29
+ <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>
30
+ </div>
31
+ `;
32
+ }
33
+ firstUpdated() {
34
+ this.changedValue = this.value;
35
+ }
36
+ onEmpty() {
37
+ this.confirmCallback && this.confirmCallback(null);
38
+ closePopup(this);
39
+ }
40
+ onCancel() {
41
+ closePopup(this);
42
+ }
43
+ onConfirm() {
44
+ this.confirmCallback && this.confirmCallback(this.changedValue);
45
+ closePopup(this);
46
+ }
47
+ };
48
+ AssigneesEditorPopup.styles = [
49
+ ButtonContainerStyles,
50
+ css `
51
+ :host {
52
+ display: flex;
53
+ flex-direction: column;
54
+
55
+ background-color: #fff;
56
+ }
57
+
58
+ assignees-editor {
59
+ flex: 1;
60
+ }
61
+ `
62
+ ];
63
+ __decorate([
64
+ property({ type: Object }),
65
+ __metadata("design:type", Array)
66
+ ], AssigneesEditorPopup.prototype, "value", void 0);
67
+ __decorate([
68
+ property({ type: Object }),
69
+ __metadata("design:type", Function)
70
+ ], AssigneesEditorPopup.prototype, "confirmCallback", void 0);
71
+ __decorate([
72
+ query('assignees-editor'),
73
+ __metadata("design:type", AssigneesEditor
74
+ /* this.value는 (원인불명으로) 값이 Reset되므로, 변화값을 유지하도록 별도로 changedValue를 사용함 */
75
+ )
76
+ ], AssigneesEditorPopup.prototype, "editor", void 0);
77
+ AssigneesEditorPopup = __decorate([
78
+ customElement('assignees-editor-popup')
79
+ ], AssigneesEditorPopup);
80
+ export { AssigneesEditorPopup };
81
+ //# sourceMappingURL=assignees-editor-popup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assignees-editor-popup.js","sourceRoot":"","sources":["../../client/component/assignees-editor-popup.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAS,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGpD;;GAEG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,QAA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AAM,EAAE,CAAC;;6DAA0D;AACrF;IAAC,KAAK,CAAC,kBAAkB,CAAC;8BAAU,eAAe;IAEnD,wEAAwE;;oDAFrB;AApBxC,oBAAoB;IADhC,aAAa,CAAC,wBAAwB,CAAC;GAC3B,oBAAoB,CA4DhC;SA5DY,oBAAoB","sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { ButtonContainerStyles } from '@operato/styles'\nimport { closePopup } from '@operato/popup'\n\nimport { AssigneesEditor } from './assignees-editor'\nimport { AssigneeItem } from '../model/org-member'\n\n/**\n * 결재선의 각 결재자 리스트를 편집한다.\n */\n@customElement('assignees-editor-popup')\nexport class AssigneesEditorPopup extends localize(i18next)(LitElement) {\n static styles = [\n ButtonContainerStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n background-color: #fff;\n }\n\n assignees-editor {\n flex: 1;\n }\n `\n ]\n\n @property({ type: Object }) value?: AssigneeItem[]\n\n @property({ type: Object }) confirmCallback?: (value?: AssigneeItem[] | null) => void\n @query('assignees-editor') editor!: AssigneesEditor\n\n /* this.value는 (원인불명으로) 값이 Reset되므로, 변화값을 유지하도록 별도로 changedValue를 사용함 */\n private changedValue?: AssigneeItem[] = this.value\n\n render() {\n return html`\n <assignees-editor\n .value=${this.value}\n @change=${(e: CustomEvent) => {\n this.changedValue = [...e.detail]\n }}\n ></assignees-editor>\n\n <div class=\"button-container\">\n <mwc-button @click=${this.onEmpty.bind(this)}>${i18next.t('button.empty')}</mwc-button>\n <mwc-button @click=${this.onCancel.bind(this)}>${i18next.t('button.cancel')}</mwc-button>\n <mwc-button @click=${this.onConfirm.bind(this)}>${i18next.t('button.confirm')}</mwc-button>\n </div>\n `\n }\n\n firstUpdated() {\n this.changedValue = this.value\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.changedValue)\n\n closePopup(this)\n }\n}\n"]}
@@ -0,0 +1,27 @@
1
+ import './assignees-view';
2
+ import { LitElement } from 'lit';
3
+ import { DataGrist } from '@operato/data-grist';
4
+ import { AssigneeItem } from '../model/org-member';
5
+ declare const AssigneesEditor_base: (new (...args: any[]) => LitElement) & typeof LitElement;
6
+ /**
7
+ * Assignee 리스트를 편집한다.
8
+ */
9
+ export declare class AssigneesEditor extends AssigneesEditor_base {
10
+ static styles: import("lit").CSSResult[];
11
+ value?: AssigneeItem[];
12
+ gristConfig?: any;
13
+ grist?: DataGrist;
14
+ render(): import("lit-html").TemplateResult<1>;
15
+ firstUpdated(): Promise<void>;
16
+ fetchHandler({ filters, page, limit, sortings }: {
17
+ filters: any;
18
+ page: any;
19
+ limit: any;
20
+ sortings?: never[] | undefined;
21
+ }): Promise<{
22
+ total: number;
23
+ records: AssigneeItem[];
24
+ }>;
25
+ deleteDataItems(): Promise<void>;
26
+ }
27
+ export {};