@things-factory/organization 6.1.18 → 6.1.23

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 (36) hide show
  1. package/client/bootstrap.ts +4 -0
  2. package/client/component/index.ts +4 -0
  3. package/client/component/recipients-editor-popup.ts +75 -0
  4. package/client/component/recipients-editor.ts +214 -0
  5. package/client/component/recipients-view.ts +55 -0
  6. package/client/grist-editor/grist-editor-recipients.ts +75 -0
  7. package/client/grist-editor/grist-renderer-recipients.ts +12 -0
  8. package/client/tsconfig.json +2 -0
  9. package/client/types/org-member.ts +6 -0
  10. package/dist-client/bootstrap.js +4 -0
  11. package/dist-client/bootstrap.js.map +1 -1
  12. package/dist-client/component/index.d.ts +3 -0
  13. package/dist-client/component/index.js +3 -0
  14. package/dist-client/component/index.js.map +1 -1
  15. package/dist-client/component/recipients-editor-popup.d.ts +20 -0
  16. package/dist-client/component/recipients-editor-popup.js +81 -0
  17. package/dist-client/component/recipients-editor-popup.js.map +1 -0
  18. package/dist-client/component/recipients-editor.d.ts +27 -0
  19. package/dist-client/component/recipients-editor.js +210 -0
  20. package/dist-client/component/recipients-editor.js.map +1 -0
  21. package/dist-client/component/recipients-view.d.ts +10 -0
  22. package/dist-client/component/recipients-view.js +55 -0
  23. package/dist-client/component/recipients-view.js.map +1 -0
  24. package/dist-client/grist-editor/grist-editor-recipients.d.ts +11 -0
  25. package/dist-client/grist-editor/grist-editor-recipients.js +64 -0
  26. package/dist-client/grist-editor/grist-editor-recipients.js.map +1 -0
  27. package/dist-client/grist-editor/grist-renderer-recipients.d.ts +3 -0
  28. package/dist-client/grist-editor/grist-renderer-recipients.js +10 -0
  29. package/dist-client/grist-editor/grist-renderer-recipients.js.map +1 -0
  30. package/dist-client/route.d.ts +1 -1
  31. package/dist-client/tsconfig.tsbuildinfo +1 -1
  32. package/dist-client/types/org-member.d.ts +5 -0
  33. package/dist-client/types/org-member.js +2 -0
  34. package/dist-client/types/org-member.js.map +1 -1
  35. package/dist-server/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +5 -5
@@ -0,0 +1,27 @@
1
+ import './recipients-view';
2
+ import { LitElement } from 'lit';
3
+ import { DataGrist } from '@operato/data-grist';
4
+ import { AssigneeItem } from '../types/org-member';
5
+ declare const RecipientsEditor_base: (new (...args: any[]) => LitElement) & typeof LitElement;
6
+ /**
7
+ * Assignee 리스트를 편집한다.
8
+ */
9
+ export declare class RecipientsEditor extends RecipientsEditor_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 {};
@@ -0,0 +1,210 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import './recipients-view';
3
+ import { css, html, LitElement } from 'lit';
4
+ import { customElement, property, query, state } from 'lit/decorators.js';
5
+ import { i18next, localize } from '@operato/i18n';
6
+ import { DataGrist, getEditor, getRenderer } from '@operato/data-grist';
7
+ import { isMobileDevice } from '@operato/utils';
8
+ import { ButtonContainerStyles } from '@operato/styles';
9
+ /**
10
+ * Assignee 리스트를 편집한다.
11
+ */
12
+ let RecipientsEditor = class RecipientsEditor extends localize(i18next)(LitElement) {
13
+ render() {
14
+ return html `
15
+ <recipients-view .value=${this.value}></recipients-view>
16
+
17
+ <ox-grist
18
+ .mode=${isMobileDevice() ? 'CARD' : 'GRID'}
19
+ .config=${this.gristConfig}
20
+ .fetchHandler=${this.fetchHandler.bind(this)}
21
+ @record-change=${e => {
22
+ var _a;
23
+ this.value = (((_a = this.grist) === null || _a === void 0 ? void 0 : _a._data.records) || [])
24
+ .map(v => {
25
+ return { type: v.type, assignee: v.assignee };
26
+ })
27
+ .filter(v => v.type);
28
+ this.dispatchEvent(new CustomEvent('change', {
29
+ bubbles: true,
30
+ composed: true,
31
+ detail: this.value
32
+ }));
33
+ }}
34
+ >
35
+ <div slot="headroom">
36
+ <div id="select">
37
+ <mwc-button raised danger @click=${() => this.deleteDataItems()}>${i18next.t('button.delete')}</mwc-button>
38
+ </div>
39
+ </div>
40
+ </ox-grist>
41
+ `;
42
+ }
43
+ async firstUpdated() {
44
+ this.gristConfig = {
45
+ list: {
46
+ fields: ['type', 'assignee']
47
+ },
48
+ columns: [
49
+ { type: 'gutter', gutterName: 'row-selector', multiple: true },
50
+ { type: 'gutter', gutterName: 'sequence' },
51
+ {
52
+ type: 'gutter',
53
+ gutterName: 'button',
54
+ icon: 'arrow_upward',
55
+ handlers: {
56
+ click: 'move-up'
57
+ }
58
+ },
59
+ {
60
+ type: 'gutter',
61
+ gutterName: 'button',
62
+ icon: 'arrow_downward',
63
+ handlers: {
64
+ click: 'move-down'
65
+ }
66
+ },
67
+ {
68
+ type: 'select',
69
+ name: 'type',
70
+ header: i18next.t('field.type'),
71
+ record: {
72
+ editable: true,
73
+ options: ['', 'Employee', 'Department', 'Role', 'MyDepartment', 'MySupervisor', 'Myself']
74
+ },
75
+ width: 140
76
+ },
77
+ {
78
+ type: 'resource-object',
79
+ name: 'assignee',
80
+ header: i18next.t('field.assignee'),
81
+ record: {
82
+ editable: true,
83
+ editor: function (value, column, record, rowIndex, field) {
84
+ var options = {};
85
+ switch (record.type) {
86
+ case 'Employee':
87
+ options = {
88
+ title: i18next.t('title.employee list'),
89
+ queryName: 'employees',
90
+ columns: [
91
+ { name: 'id', hidden: true },
92
+ {
93
+ name: 'controlNo',
94
+ header: { renderer: () => i18next.t('field.control-no') },
95
+ filter: 'search'
96
+ },
97
+ { name: 'name', header: { renderer: () => i18next.t('field.name') }, filter: 'search' }
98
+ ],
99
+ list: { fields: ['name', 'control-no'] },
100
+ valueField: 'id',
101
+ nameField: 'name',
102
+ descriptionField: 'controlNo'
103
+ };
104
+ break;
105
+ case 'Department':
106
+ options = {
107
+ title: i18next.t('title.department list'),
108
+ queryName: 'departments'
109
+ };
110
+ break;
111
+ case 'Role':
112
+ options = {
113
+ title: i18next.t('title.lookup role'),
114
+ queryName: 'roles'
115
+ };
116
+ break;
117
+ default:
118
+ options = {};
119
+ }
120
+ var dynamicRecord = Object.assign(Object.assign({}, column.record), { options });
121
+ return getEditor(column.type)(value, Object.assign(Object.assign({}, column), { record: dynamicRecord }), record, rowIndex, field);
122
+ },
123
+ renderer: function (value, column, record, rowIndex, field) {
124
+ var options = {};
125
+ switch (record.type) {
126
+ case 'Employee':
127
+ options = {
128
+ valueField: 'id',
129
+ nameField: 'name',
130
+ descriptionField: 'controlNo'
131
+ };
132
+ break;
133
+ case 'Department':
134
+ case 'Role':
135
+ default:
136
+ break;
137
+ }
138
+ var dynamicRecord = Object.assign(Object.assign({}, column.record), { options });
139
+ return getRenderer(column.type)(value, Object.assign(Object.assign({}, column), { record: dynamicRecord }), record, rowIndex, field);
140
+ }
141
+ },
142
+ width: 180
143
+ }
144
+ ],
145
+ rows: {
146
+ selectable: {
147
+ multiple: true
148
+ }
149
+ },
150
+ pagination: {
151
+ infinite: true
152
+ },
153
+ sorters: []
154
+ };
155
+ }
156
+ async fetchHandler({ filters, page, limit, sortings = [] }) {
157
+ const value = [...(this.value || [])];
158
+ this.value = value;
159
+ return {
160
+ total: value.length,
161
+ records: value
162
+ };
163
+ }
164
+ async deleteDataItems() {
165
+ var _a;
166
+ (_a = this.grist) === null || _a === void 0 ? void 0 : _a.deleteSelectedRecords(false);
167
+ }
168
+ };
169
+ RecipientsEditor.styles = [
170
+ ButtonContainerStyles,
171
+ css `
172
+ :host {
173
+ display: flex;
174
+ flex-direction: column;
175
+
176
+ background-color: #fff;
177
+ }
178
+
179
+ recipients-view {
180
+ min-height: 100px;
181
+ }
182
+
183
+ ox-grist {
184
+ flex: 1;
185
+ }
186
+
187
+ #select {
188
+ display: flex;
189
+ justify-content: end;
190
+ padding: 10px;
191
+ }
192
+ `
193
+ ];
194
+ __decorate([
195
+ property({ type: Object }),
196
+ __metadata("design:type", Array)
197
+ ], RecipientsEditor.prototype, "value", void 0);
198
+ __decorate([
199
+ state(),
200
+ __metadata("design:type", Object)
201
+ ], RecipientsEditor.prototype, "gristConfig", void 0);
202
+ __decorate([
203
+ query('ox-grist'),
204
+ __metadata("design:type", DataGrist)
205
+ ], RecipientsEditor.prototype, "grist", void 0);
206
+ RecipientsEditor = __decorate([
207
+ customElement('recipients-editor')
208
+ ], RecipientsEditor);
209
+ export { RecipientsEditor };
210
+ //# sourceMappingURL=recipients-editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recipients-editor.js","sourceRoot":"","sources":["../../client/component/recipients-editor.ts"],"names":[],"mappings":";AAAA,OAAO,mBAAmB,CAAA;AAE1B,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;AAIvD;;GAEG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAiCjE,MAAM;QACJ,OAAO,IAAI,CAAA;gCACiB,IAAI,CAAC,KAAK;;;gBAG1B,cAAc,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;kBAChC,IAAI,CAAC,WAAW;wBACV,IAAI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,KAAE,MAAM,EAAE,aAAa,KAAI,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAA;wBACvG,CAAC;qBACF;oBACD,KAAK,EAAE,GAAG;iBACX;aACF;YACD,IAAI,EAAE;gBACJ,UAAU,EAAE;oBACV,QAAQ,EAAE,IAAI;iBACf;aACF;YACD,UAAU,EAAE;gBACV,QAAQ,EAAE,IAAI;aACf;YACD,OAAO,EAAE,EAAE;SACZ,CAAA;IACH,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,GAAG,EAAE,EAAE;QACxD,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAA;QACrC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAElB,OAAO;YACL,KAAK,EAAE,KAAK,CAAC,MAAM;YACnB,OAAO,EAAE,KAAK;SACf,CAAA;IACH,CAAC;IAED,KAAK,CAAC,eAAe;;QACnB,MAAA,IAAI,CAAC,KAAK,0CAAE,qBAAqB,CAAC,KAAK,CAAC,CAAA;IAC1C,CAAC;;AAnMM,uBAAM,GAAG;IACd,qBAAqB;IACrB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;KAqBF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CAAuB;AAElD;IAAC,KAAK,EAAE;;qDAAkB;AAE1B;IAAC,KAAK,CAAC,UAAU,CAAC;8BAAS,SAAS;+CAAA;AA/BzB,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CAqM5B;SArMY,gBAAgB","sourcesContent":["import './recipients-view'\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'\n\nimport { AssigneeItem } from '../types/org-member'\n\n/**\n * Assignee 리스트를 편집한다.\n */\n@customElement('recipients-editor')\nexport class RecipientsEditor 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 recipients-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?: AssigneeItem[]\n\n @state() gristConfig?: any\n\n @query('ox-grist') grist?: DataGrist\n\n render() {\n return html`\n <recipients-view .value=${this.value}></recipients-view>\n\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 .map(v => {\n return { type: v.type, assignee: v.assignee }\n })\n .filter(v => v.type)\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 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', 'assignee']\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: 'assignee',\n header: i18next.t('field.assignee'),\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"]}
@@ -0,0 +1,10 @@
1
+ import { LitElement, TemplateResult } from 'lit';
2
+ import { AssigneeItem } from '../types/org-member';
3
+ declare const RecipientsView_base: (new (...args: any[]) => LitElement) & typeof LitElement;
4
+ export declare class RecipientsView extends RecipientsView_base {
5
+ static styles: import("lit").CSSResult[];
6
+ value?: AssigneeItem[];
7
+ render(): TemplateResult<1>;
8
+ renderItem(item: AssigneeItem, order: number): TemplateResult;
9
+ }
10
+ export {};
@@ -0,0 +1,55 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { css, html, LitElement } from 'lit';
3
+ import { customElement, property } from 'lit/decorators.js';
4
+ import { i18next, localize } from '@operato/i18n';
5
+ let RecipientsView = class RecipientsView extends localize(i18next)(LitElement) {
6
+ render() {
7
+ const items = this.value || [];
8
+ return html ` ${items.map((item, order) => this.renderItem(item, order + 1))} `;
9
+ }
10
+ renderItem(item, order) {
11
+ const { type, assignee } = item;
12
+ const { name, description, controlNo } = assignee || {};
13
+ const subname = (description || controlNo) && `(${description || controlNo})`;
14
+ return html `
15
+ <div assignee>
16
+ <div>${type}</div>
17
+ <div><span name>${name}</span>${subname}</div>
18
+ </div>
19
+ `;
20
+ }
21
+ };
22
+ RecipientsView.styles = [
23
+ css `
24
+ :host {
25
+ display: flex;
26
+ flex-direction: row;
27
+ flex-wrap: wrap;
28
+
29
+ gap: 10px;
30
+ padding: 10px;
31
+
32
+ align-items: center;
33
+
34
+ background-color: #fff;
35
+
36
+ --mdc-icon-size: 3em;
37
+ color: var(--secondary-color, black);
38
+ }
39
+
40
+ div[assignee] {
41
+ padding: 5px;
42
+ border-radius: 5px;
43
+ border: 2px solid var(--primary-color, black);
44
+ }
45
+ `
46
+ ];
47
+ __decorate([
48
+ property({ type: Object }),
49
+ __metadata("design:type", Array)
50
+ ], RecipientsView.prototype, "value", void 0);
51
+ RecipientsView = __decorate([
52
+ customElement('recipients-view')
53
+ ], RecipientsView);
54
+ export { RecipientsView };
55
+ //# sourceMappingURL=recipients-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recipients-view.js","sourceRoot":"","sources":["../../client/component/recipients-view.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAI1C,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IA6B/D,MAAM;QACJ,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAA;QAE9B,OAAO,IAAI,CAAA,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;IAChF,CAAC;IAED,UAAU,CAAC,IAAkB,EAAE,KAAa;QAC1C,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAA;QAC/B,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,QAAQ,IAAI,EAAE,CAAA;QACvD,MAAM,OAAO,GAAG,CAAC,WAAW,IAAI,SAAS,CAAC,IAAI,IAAI,WAAW,IAAI,SAAS,GAAG,CAAA;QAE7E,OAAO,IAAI,CAAA;;eAEA,IAAI;0BACO,IAAI,UAAU,OAAO;;KAE1C,CAAA;IACH,CAAC;;AA7CM,qBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;KAsBF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CAAuB;AA3BvC,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CA+C1B;SA/CY,cAAc","sourcesContent":["import { css, html, LitElement, TemplateResult } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { i18next, localize } from '@operato/i18n'\nimport { AssigneeItem } from '../types/org-member'\n\n@customElement('recipients-view')\nexport class RecipientsView extends localize(i18next)(LitElement) {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n\n gap: 10px;\n padding: 10px;\n\n align-items: center;\n\n background-color: #fff;\n\n --mdc-icon-size: 3em;\n color: var(--secondary-color, black);\n }\n\n div[assignee] {\n padding: 5px;\n border-radius: 5px;\n border: 2px solid var(--primary-color, black);\n }\n `\n ]\n\n @property({ type: Object }) value?: AssigneeItem[]\n\n render() {\n const items = this.value || []\n\n return html` ${items.map((item, order) => this.renderItem(item, order + 1))} `\n }\n\n renderItem(item: AssigneeItem, order: number): TemplateResult {\n const { type, assignee } = item\n const { name, description, controlNo } = assignee || {}\n const subname = (description || controlNo) && `(${description || controlNo})`\n\n return html`\n <div assignee>\n <div>${type}</div>\n <div><span name>${name}</span>${subname}</div>\n </div>\n `\n }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import '../component/recipients-editor-popup.js';
2
+ import { TemplateResult } from 'lit';
3
+ import { OxGristEditor } from '@operato/data-grist';
4
+ export declare class GristEditorRecipients extends OxGristEditor {
5
+ private popup?;
6
+ private template?;
7
+ get editorTemplate(): TemplateResult<1>;
8
+ _onclick(e: Event): void;
9
+ _onkeydown(e: KeyboardEvent): void;
10
+ openSelector(): void;
11
+ }
@@ -0,0 +1,64 @@
1
+ import { __decorate } from "tslib";
2
+ import '../component/recipients-editor-popup.js';
3
+ import { html } from 'lit';
4
+ import { customElement } from 'lit/decorators.js';
5
+ import { OxGristEditor } from '@operato/data-grist';
6
+ import { i18next } from '@operato/i18n';
7
+ import { openPopup } from '@operato/layout';
8
+ let GristEditorRecipients = class GristEditorRecipients extends OxGristEditor {
9
+ get editorTemplate() {
10
+ const value = this.value;
11
+ return !value || !(value instanceof Array) || value.length == 0
12
+ ? html ``
13
+ : value.length == 1
14
+ ? html `<mwc-icon style="--mdc-icon-size:1.3em">person</mwc-icon>`
15
+ : html `<mwc-icon style="--mdc-icon-size:1.3em">group</mwc-icon>`;
16
+ }
17
+ _onclick(e) {
18
+ e.stopPropagation();
19
+ this.openSelector();
20
+ }
21
+ _onkeydown(e) {
22
+ const key = e.key;
23
+ if (key == 'Enter') {
24
+ e.stopPropagation();
25
+ this.openSelector();
26
+ }
27
+ }
28
+ openSelector() {
29
+ if (this.popup) {
30
+ delete this.popup;
31
+ }
32
+ const confirmCallback = (selected) => {
33
+ this.dispatchEvent(new CustomEvent('field-change', {
34
+ bubbles: true,
35
+ composed: true,
36
+ detail: {
37
+ before: this.value,
38
+ after: selected || [],
39
+ record: this.record,
40
+ column: this.column,
41
+ row: this.row
42
+ }
43
+ }));
44
+ };
45
+ var value = this.value || [];
46
+ var template = this.template ||
47
+ html `
48
+ <recipients-editor-popup
49
+ .value=${value}
50
+ .confirmCallback=${confirmCallback.bind(this)}
51
+ ></recipients-editor-popup>
52
+ `;
53
+ this.popup = openPopup(template, {
54
+ backdrop: true,
55
+ size: 'large',
56
+ title: i18next.t('title.recipients editor')
57
+ });
58
+ }
59
+ };
60
+ GristEditorRecipients = __decorate([
61
+ customElement('grist-editor-recipients')
62
+ ], GristEditorRecipients);
63
+ export { GristEditorRecipients };
64
+ //# sourceMappingURL=grist-editor-recipients.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grist-editor-recipients.js","sourceRoot":"","sources":["../../client/grist-editor/grist-editor-recipients.ts"],"names":[],"mappings":";AAAA,OAAO,yCAAyC,CAAA;AAEhD,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,SAAS,EAAe,MAAM,iBAAiB,CAAA;AAGjD,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,aAAa;IAItD,IAAI,cAAc;QAChB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;QACxB,OAAO,CAAC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,IAAI,CAAC;;OAEhD,CAAA;QAEH,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,QAAQ,EAAE;YAC/B,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,yBAAyB,CAAC;SAC5C,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAhEY,qBAAqB;IADjC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,qBAAqB,CAgEjC;SAhEY,qBAAqB","sourcesContent":["import '../component/recipients-editor-popup.js'\n\nimport { html, TemplateResult } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\nimport { OxGristEditor } from '@operato/data-grist'\nimport { i18next } from '@operato/i18n'\nimport { openPopup, PopupHandle } from '@operato/layout'\n\n@customElement('grist-editor-recipients')\nexport class GristEditorRecipients extends OxGristEditor {\n private popup?: PopupHandle\n private template?: TemplateResult\n\n get editorTemplate() {\n const value = this.value\n return !value || !(value instanceof Array) || value.length == 0\n ? html``\n : value.length == 1\n ? html`<mwc-icon style=\"--mdc-icon-size:1.3em\">person</mwc-icon>`\n : html`<mwc-icon style=\"--mdc-icon-size:1.3em\">group</mwc-icon>`\n }\n\n _onclick(e: Event): void {\n e.stopPropagation()\n this.openSelector()\n }\n\n _onkeydown(e: KeyboardEvent): void {\n const key = e.key\n if (key == 'Enter') {\n e.stopPropagation()\n this.openSelector()\n }\n }\n\n openSelector() {\n if (this.popup) {\n delete this.popup\n }\n\n const confirmCallback = (selected?: { [field: string]: any }) => {\n this.dispatchEvent(\n new CustomEvent('field-change', {\n bubbles: true,\n composed: true,\n detail: {\n before: this.value,\n after: selected || [],\n record: this.record,\n column: this.column,\n row: this.row\n }\n })\n )\n }\n\n var value = this.value || []\n\n var template =\n this.template ||\n html`\n <recipients-editor-popup\n .value=${value}\n .confirmCallback=${confirmCallback.bind(this)}\n ></recipients-editor-popup>\n `\n\n this.popup = openPopup(template, {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.recipients editor')\n })\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import '@material/mwc-icon';
2
+ import { FieldRenderer } from '@operato/data-grist';
3
+ export declare const GristRendererRecipients: FieldRenderer;
@@ -0,0 +1,10 @@
1
+ import '@material/mwc-icon';
2
+ import { html } from 'lit-html';
3
+ export const GristRendererRecipients = (value, column, record, rowIndex, field) => {
4
+ return !value || !(value instanceof Array) || value.length == 0
5
+ ? html ``
6
+ : value.length == 1
7
+ ? html `<mwc-icon style="--mdc-icon-size:1.3em">person</mwc-icon>`
8
+ : html `<mwc-icon style="--mdc-icon-size:1.3em">group</mwc-icon>`;
9
+ };
10
+ //# sourceMappingURL=grist-renderer-recipients.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grist-renderer-recipients.js","sourceRoot":"","sources":["../../client/grist-editor/grist-renderer-recipients.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAI/B,MAAM,CAAC,MAAM,uBAAuB,GAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IAC/F,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;QAC7D,CAAC,CAAC,IAAI,CAAA,EAAE;QACR,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC;YACnB,CAAC,CAAC,IAAI,CAAA,2DAA2D;YACjE,CAAC,CAAC,IAAI,CAAA,0DAA0D,CAAA;AACpE,CAAC,CAAA","sourcesContent":["import '@material/mwc-icon'\nimport { html } from 'lit-html'\n\nimport { FieldRenderer } from '@operato/data-grist'\n\nexport const GristRendererRecipients: FieldRenderer = (value, column, record, rowIndex, field) => {\n return !value || !(value instanceof Array) || value.length == 0\n ? html``\n : value.length == 1\n ? html`<mwc-icon style=\"--mdc-icon-size:1.3em\">person</mwc-icon>`\n : html`<mwc-icon style=\"--mdc-icon-size:1.3em\">group</mwc-icon>`\n}\n"]}
@@ -1 +1 @@
1
- export default function route(page: string): "employee-list" | "department-list" | "common-approval-line-templates-page" | "my-approval-line-templates-page" | undefined;
1
+ export default function route(page: string): "common-approval-line-templates-page" | "my-approval-line-templates-page" | "employee-list" | "department-list" | undefined;