@operato/data-grist 8.0.0-alpha.51 → 8.0.0-alpha.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/src/record-view/index.d.ts +1 -1
- package/dist/src/record-view/index.js +1 -1
- package/dist/src/record-view/index.js.map +1 -1
- package/dist/src/record-view/{record-creator.d.ts → ox-record-creator.d.ts} +8 -4
- package/dist/src/record-view/{record-creator.js → ox-record-creator.js} +90 -34
- package/dist/src/record-view/ox-record-creator.js.map +1 -0
- package/dist/stories/accumulator-format.stories.d.ts +1 -1
- package/dist/stories/accumulator-format.stories.js +1 -1
- package/dist/stories/accumulator-format.stories.js.map +1 -1
- package/dist/stories/click-event-custom.stories.d.ts +45 -0
- package/dist/stories/click-event-custom.stories.js +247 -0
- package/dist/stories/click-event-custom.stories.js.map +1 -0
- package/dist/stories/click-event.stories.d.ts +1 -1
- package/dist/stories/click-event.stories.js +1 -1
- package/dist/stories/click-event.stories.js.map +1 -1
- package/dist/stories/fixed-column.stories.d.ts +1 -1
- package/dist/stories/fixed-column.stories.js +1 -1
- package/dist/stories/fixed-column.stories.js.map +1 -1
- package/dist/stories/grid-setting.stories.d.ts +1 -1
- package/dist/stories/grid-setting.stories.js +1 -1
- package/dist/stories/grid-setting.stories.js.map +1 -1
- package/dist/stories/grist-modes.stories.d.ts +1 -1
- package/dist/stories/grist-modes.stories.js +1 -1
- package/dist/stories/grist-modes.stories.js.map +1 -1
- package/dist/stories/group-header.stories.d.ts +1 -1
- package/dist/stories/group-header.stories.js +1 -1
- package/dist/stories/group-header.stories.js.map +1 -1
- package/dist/stories/textarea.stories.d.ts +1 -1
- package/dist/stories/textarea.stories.js +1 -1
- package/dist/stories/textarea.stories.js.map +1 -1
- package/dist/stories/tree-column-with-checkbox.stories.d.ts +1 -1
- package/dist/stories/tree-column-with-checkbox.stories.js +1 -1
- package/dist/stories/tree-column-with-checkbox.stories.js.map +1 -1
- package/dist/stories/tree-column.stories.d.ts +1 -1
- package/dist/stories/tree-column.stories.js +1 -1
- package/dist/stories/tree-column.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/record-view/index.ts +1 -1
- package/src/record-view/{record-creator.ts → ox-record-creator.ts} +104 -41
- package/stories/accumulator-format.stories.ts +1 -1
- package/stories/click-event-custom.stories.ts +287 -0
- package/stories/click-event.stories.ts +1 -1
- package/stories/fixed-column.stories.ts +1 -1
- package/stories/grid-setting.stories.ts +1 -1
- package/stories/grist-modes.stories.ts +1 -1
- package/stories/group-header.stories.ts +1 -1
- package/stories/textarea.stories.ts +1 -1
- package/stories/tree-column-with-checkbox.stories.ts +1 -1
- package/stories/tree-column.stories.ts +1 -1
- package/dist/src/record-view/record-creator.js.map +0 -1
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,24 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [8.0.0-alpha.54](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.53...v8.0.0-alpha.54) (2024-12-09)
|
7
|
+
|
8
|
+
|
9
|
+
### :bug: Bug Fix
|
10
|
+
|
11
|
+
* enhancement of ox-record-creator validation ([5954a73](https://github.com/hatiolab/operato/commit/5954a73b8357f248080d8d30c7dac7f95942e15a))
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
## [8.0.0-alpha.52](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.51...v8.0.0-alpha.52) (2024-12-03)
|
16
|
+
|
17
|
+
|
18
|
+
### :bug: Bug Fix
|
19
|
+
|
20
|
+
* support custom popup for ox-record-create ([18f674c](https://github.com/hatiolab/operato/commit/18f674c4e37127b9e482223e9f29f58f95e598ce))
|
21
|
+
|
22
|
+
|
23
|
+
|
6
24
|
## [8.0.0-alpha.51](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.50...v8.0.0-alpha.51) (2024-11-29)
|
7
25
|
|
8
26
|
**Note:** Version bump only for package @operato/data-grist
|
@@ -1,2 +1,2 @@
|
|
1
1
|
export * from './record-view';
|
2
|
-
export * from './record-creator';
|
2
|
+
export * from './ox-record-creator';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/record-view/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/record-view/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA","sourcesContent":["export * from './record-view'\nexport * from './ox-record-creator'\n"]}
|
@@ -3,11 +3,11 @@ import './record-view';
|
|
3
3
|
import { LitElement } from 'lit';
|
4
4
|
import { DataGrist } from '../data-grist';
|
5
5
|
import { GristRecord, ValidationReason } from '../types';
|
6
|
-
export declare class
|
6
|
+
export declare class OxRecordCreator extends LitElement {
|
7
|
+
static styles: import("lit").CSSResult[];
|
7
8
|
grist?: DataGrist;
|
8
|
-
callback?: (
|
9
|
-
|
10
|
-
}) => boolean;
|
9
|
+
callback?: (record: GristRecord) => boolean;
|
10
|
+
customPopupCallback?: (popup: any) => boolean;
|
11
11
|
lightPopup: boolean;
|
12
12
|
preventCloseOnBlur: boolean;
|
13
13
|
constructor();
|
@@ -17,6 +17,10 @@ export declare class RecordCreator extends LitElement {
|
|
17
17
|
field: string;
|
18
18
|
reason: ValidationReason;
|
19
19
|
}[];
|
20
|
+
openLightPopup(): void;
|
21
|
+
openPopup(): void;
|
20
22
|
lightPopupRecordView(): void;
|
21
23
|
popupRecordView(): void;
|
24
|
+
lightPopupCustomCreator(originalContent: HTMLElement): void;
|
25
|
+
popupCustomCreator(originalContent: HTMLElement): void;
|
22
26
|
}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { __decorate } from "tslib";
|
2
2
|
import '@material/web/icon/icon.js';
|
3
3
|
import './record-view';
|
4
|
-
import { html, LitElement } from 'lit';
|
4
|
+
import { css, html, LitElement } from 'lit';
|
5
5
|
import { customElement, property, state } from 'lit/decorators.js';
|
6
6
|
import { OxPopup } from '@operato/popup';
|
7
7
|
import { ValidationReason } from '../types';
|
8
|
-
let
|
8
|
+
let OxRecordCreator = class OxRecordCreator extends LitElement {
|
9
9
|
constructor() {
|
10
10
|
super();
|
11
11
|
this.lightPopup = false;
|
@@ -14,10 +14,10 @@ let RecordCreator = class RecordCreator extends LitElement {
|
|
14
14
|
e.preventDefault();
|
15
15
|
e.stopPropagation();
|
16
16
|
if (this.lightPopup) {
|
17
|
-
this.
|
17
|
+
this.openLightPopup();
|
18
18
|
}
|
19
19
|
else {
|
20
|
-
this.
|
20
|
+
this.openPopup();
|
21
21
|
}
|
22
22
|
});
|
23
23
|
}
|
@@ -26,23 +26,52 @@ let RecordCreator = class RecordCreator extends LitElement {
|
|
26
26
|
this.grist = this.closest('ox-grist');
|
27
27
|
}
|
28
28
|
render() {
|
29
|
-
return html
|
29
|
+
return html `
|
30
|
+
<slot></slot>
|
31
|
+
<slot name="popup"></slot>
|
32
|
+
`;
|
30
33
|
}
|
31
34
|
validateRecord(record) {
|
32
35
|
const columns = this.grist.compiledConfig.columns;
|
33
36
|
const invalidFields = [];
|
34
|
-
columns
|
37
|
+
columns
|
38
|
+
.filter(column => !column.hidden)
|
39
|
+
.forEach(column => {
|
35
40
|
var _a;
|
36
|
-
if (((_a = column.record) === null || _a === void 0 ? void 0 : _a.mandatory) &&
|
41
|
+
if (((_a = column.record) === null || _a === void 0 ? void 0 : _a.mandatory) &&
|
42
|
+
(record[column.name] === undefined || record[column.name] === null || record[column.name] === '')) {
|
37
43
|
invalidFields.push({
|
38
44
|
field: column.name,
|
39
45
|
reason: ValidationReason.MANDATORY
|
40
46
|
});
|
41
47
|
}
|
42
|
-
// 여기에 추가적인 유효성 검사 규칙을 구현할 수 있습니다.
|
43
48
|
});
|
44
49
|
return invalidFields;
|
45
50
|
}
|
51
|
+
openLightPopup() {
|
52
|
+
var _a;
|
53
|
+
const slot = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(`slot[name='popup']`);
|
54
|
+
const slottedElements = slot === null || slot === void 0 ? void 0 : slot.assignedElements({ flatten: true });
|
55
|
+
const originalContent = slottedElements === null || slottedElements === void 0 ? void 0 : slottedElements[0];
|
56
|
+
if (originalContent) {
|
57
|
+
this.lightPopupCustomCreator(originalContent);
|
58
|
+
}
|
59
|
+
else {
|
60
|
+
this.lightPopupRecordView();
|
61
|
+
}
|
62
|
+
}
|
63
|
+
openPopup() {
|
64
|
+
var _a;
|
65
|
+
const slot = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(`slot[name='popup']`);
|
66
|
+
const slottedElements = slot === null || slot === void 0 ? void 0 : slot.assignedElements({ flatten: true });
|
67
|
+
const originalContent = slottedElements === null || slottedElements === void 0 ? void 0 : slottedElements[0];
|
68
|
+
if (originalContent) {
|
69
|
+
this.popupCustomCreator(originalContent);
|
70
|
+
}
|
71
|
+
else {
|
72
|
+
this.popupRecordView();
|
73
|
+
}
|
74
|
+
}
|
46
75
|
lightPopupRecordView() {
|
47
76
|
const config = this.grist.compiledConfig;
|
48
77
|
var title = 'create';
|
@@ -79,13 +108,8 @@ let RecordCreator = class RecordCreator extends LitElement {
|
|
79
108
|
}}
|
80
109
|
@ok=${async (e) => {
|
81
110
|
const view = e.currentTarget;
|
82
|
-
// 레코드 밸리데이션 체크
|
83
111
|
const invalidFields = await this.validateRecord(view.record);
|
84
112
|
if (invalidFields.length > 0) {
|
85
|
-
// const firstInvalidField = invalidFields[0];
|
86
|
-
// if (firstInvalidField) {
|
87
|
-
// view.setFocus(firstInvalidField.field)
|
88
|
-
// }
|
89
113
|
view.setFocusOnInvalid(invalidFields);
|
90
114
|
return false;
|
91
115
|
}
|
@@ -129,27 +153,18 @@ let RecordCreator = class RecordCreator extends LitElement {
|
|
129
153
|
popup.close();
|
130
154
|
});
|
131
155
|
recordView.addEventListener('ok', async (e) => {
|
132
|
-
var _a
|
156
|
+
var _a;
|
133
157
|
const view = e.currentTarget;
|
134
|
-
// 레코드 밸리데이션 체크
|
135
158
|
const invalidFields = await this.validateRecord(view.record);
|
136
159
|
if (invalidFields.length > 0) {
|
137
|
-
|
138
|
-
if (firstInvalidField) {
|
139
|
-
const fieldElement = (_a = view.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(`[name="${firstInvalidField}"]`);
|
140
|
-
if (fieldElement) {
|
141
|
-
fieldElement.focus();
|
142
|
-
}
|
143
|
-
}
|
160
|
+
view.setFocusOnInvalid(invalidFields);
|
144
161
|
return false;
|
145
162
|
}
|
146
|
-
if (await ((
|
163
|
+
if (await ((_a = this.callback) === null || _a === void 0 ? void 0 : _a.call(this, view.record))) {
|
147
164
|
popup.close();
|
148
165
|
}
|
149
166
|
else {
|
150
|
-
|
151
|
-
console.error('레코드 밸리데이션 실패');
|
152
|
-
// 여기에 사용자에게 오류 메시지를 표시하는 로직을 추가할 수 있습니다.
|
167
|
+
console.error('validation failed');
|
153
168
|
}
|
154
169
|
});
|
155
170
|
recordView.addEventListener('field-change', async (e) => {
|
@@ -171,21 +186,62 @@ let RecordCreator = class RecordCreator extends LitElement {
|
|
171
186
|
}
|
172
187
|
}));
|
173
188
|
}
|
189
|
+
lightPopupCustomCreator(originalContent) {
|
190
|
+
var _a;
|
191
|
+
const title = 'create';
|
192
|
+
const popupContent = originalContent.cloneNode(true);
|
193
|
+
popupContent.removeAttribute('slot');
|
194
|
+
OxPopup.open({
|
195
|
+
template: html `
|
196
|
+
<div title>${title}</div>
|
197
|
+
${popupContent}
|
198
|
+
`,
|
199
|
+
parent: document.body,
|
200
|
+
preventCloseOnBlur: this.preventCloseOnBlur
|
201
|
+
});
|
202
|
+
(_a = this.customPopupCallback) === null || _a === void 0 ? void 0 : _a.call(this, popupContent); // 사용자 정의 팝업용 콜백 실행
|
203
|
+
}
|
204
|
+
popupCustomCreator(originalContent) {
|
205
|
+
const title = 'create';
|
206
|
+
const popupContent = originalContent.cloneNode(true);
|
207
|
+
popupContent.removeAttribute('slot');
|
208
|
+
document.dispatchEvent(new CustomEvent('open-popup', {
|
209
|
+
detail: {
|
210
|
+
template: popupContent,
|
211
|
+
options: {
|
212
|
+
backdrop: true,
|
213
|
+
size: 'large',
|
214
|
+
title
|
215
|
+
},
|
216
|
+
callback: this.customPopupCallback
|
217
|
+
}
|
218
|
+
}));
|
219
|
+
}
|
174
220
|
};
|
221
|
+
OxRecordCreator.styles = [
|
222
|
+
css `
|
223
|
+
::slotted([slot='popup']) {
|
224
|
+
display: none;
|
225
|
+
}
|
226
|
+
`
|
227
|
+
];
|
175
228
|
__decorate([
|
176
229
|
state()
|
177
|
-
],
|
230
|
+
], OxRecordCreator.prototype, "grist", void 0);
|
231
|
+
__decorate([
|
232
|
+
property({ type: Object })
|
233
|
+
], OxRecordCreator.prototype, "callback", void 0);
|
178
234
|
__decorate([
|
179
235
|
property({ type: Object })
|
180
|
-
],
|
236
|
+
], OxRecordCreator.prototype, "customPopupCallback", void 0);
|
181
237
|
__decorate([
|
182
238
|
property({ type: Boolean, attribute: 'light-popup' })
|
183
|
-
],
|
239
|
+
], OxRecordCreator.prototype, "lightPopup", void 0);
|
184
240
|
__decorate([
|
185
241
|
property({ type: Boolean, attribute: 'prevent-close-on-blur' })
|
186
|
-
],
|
187
|
-
|
242
|
+
], OxRecordCreator.prototype, "preventCloseOnBlur", void 0);
|
243
|
+
OxRecordCreator = __decorate([
|
188
244
|
customElement('ox-record-creator')
|
189
|
-
],
|
190
|
-
export {
|
191
|
-
//# sourceMappingURL=record-creator.js.map
|
245
|
+
], OxRecordCreator);
|
246
|
+
export { OxRecordCreator };
|
247
|
+
//# sourceMappingURL=ox-record-creator.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ox-record-creator.js","sourceRoot":"","sources":["../../../src/record-view/ox-record-creator.ts"],"names":[],"mappings":";AAAA,OAA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AgB,CAAA;QACnE,YAAY,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;QAEpC,QAAQ,CAAC,aAAa,CACpB,IAAI,WAAW,CAAC,YAAY,EAAE;YAC5B,MAAM,EAAE;gBACN,QAAQ,EAAE,YAAY;gBACtB,OAAO,EAAE;oBACP,QAAQ,EAAE,IAAI;oBACd,IAAI,EAAE,OAAO;oBACb,KAAK;iBACN;gBACD,QAAQ,EAAE,IAAI,CAAC,mBAAmB;aACnC;SACF,CAAC,CACH,CAAA;IACH,CAAC;;AAjRM,sBAAM,GAAG;IACd,GAAG,CAAA;;;;KAIF;CACF,AANY,CAMZ;AAEQ;IAAR,KAAK,EAAE;8CAAkB;AAEE;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAA4C;AAC3C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAA8C;AAClB;IAAtD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;mDAA4B;AACjB;IAAhE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;2DAA2B;AAdhF,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAmR3B","sourcesContent":["import '@material/web/icon/icon.js'\nimport './record-view'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { OxPopup } from '@operato/popup'\n\nimport { DataGrist } from '../data-grist'\nimport { ColumnConfig, GristRecord, ValidationReason } from '../types'\nimport { RecordView } from './record-view'\n\n@customElement('ox-record-creator')\nexport class OxRecordCreator extends LitElement {\n static styles = [\n css`\n ::slotted([slot='popup']) {\n display: none;\n }\n `\n ]\n\n @state() grist?: DataGrist\n\n @property({ type: Object }) callback?: (record: GristRecord) => boolean\n @property({ type: Object }) customPopupCallback?: (popup: any) => boolean\n @property({ type: Boolean, attribute: 'light-popup' }) lightPopup: boolean = false\n @property({ type: Boolean, attribute: 'prevent-close-on-blur' }) preventCloseOnBlur = false\n\n constructor() {\n super()\n\n this.addEventListener('click', (e: Event) => {\n e.preventDefault()\n e.stopPropagation()\n\n if (this.lightPopup) {\n this.openLightPopup()\n } else {\n this.openPopup()\n }\n })\n }\n\n connectedCallback(): void {\n super.connectedCallback()\n\n this.grist = this.closest('ox-grist') as DataGrist\n }\n\n render() {\n return html`\n <slot></slot>\n <slot name=\"popup\"></slot>\n `\n }\n\n validateRecord(record: GristRecord): { field: string; reason: ValidationReason }[] {\n const columns = this.grist!.compiledConfig.columns\n const invalidFields: { field: string; reason: ValidationReason }[] = []\n\n columns\n .filter(column => !column.hidden)\n .forEach(column => {\n if (\n column.record?.mandatory &&\n (record[column.name] === undefined || record[column.name] === null || record[column.name] === '')\n ) {\n invalidFields.push({\n field: column.name,\n reason: ValidationReason.MANDATORY\n })\n }\n })\n\n return invalidFields\n }\n\n openLightPopup() {\n const slot = this.renderRoot?.querySelector(`slot[name='popup']`) as HTMLSlotElement\n const slottedElements = slot?.assignedElements({ flatten: true })\n const originalContent = slottedElements?.[0] as HTMLElement\n\n if (originalContent) {\n this.lightPopupCustomCreator(originalContent)\n } else {\n this.lightPopupRecordView()\n }\n }\n\n openPopup() {\n const slot = this.renderRoot?.querySelector(`slot[name='popup']`) as HTMLSlotElement\n const slottedElements = slot?.assignedElements({ flatten: true })\n const originalContent = slottedElements?.[0] as HTMLElement\n\n if (originalContent) {\n this.popupCustomCreator(originalContent)\n } else {\n this.popupRecordView()\n }\n }\n\n lightPopupRecordView() {\n const config = this.grist!.compiledConfig\n var title = 'create'\n const rowIndex = -1\n var record: GristRecord = {}\n const columns = config.columns\n\n var popup = OxPopup.open({\n template: html`\n <div title>${title}</div>\n <ox-record-view\n @field-change=${(e: CustomEvent) => {\n const view = e.currentTarget as RecordView\n\n var { after, before, column, record, row } = (e as CustomEvent).detail as {\n after: any\n before: any\n column: ColumnConfig\n record: GristRecord\n row: number\n }\n\n var validation = column.validation\n if (validation && typeof validation == 'function') {\n if (!validation.call(this, after, before, record, column)) {\n return\n }\n }\n\n view.record = {\n ...record,\n [column.name]: after\n }\n }}\n .columns=${columns}\n .record=${record}\n .rowIndex=${rowIndex}\n @reset=${(e: Event) => {\n const view = e.currentTarget as RecordView\n view.record = {}\n }}\n @cancel=${(e: Event) => {\n popup.close()\n }}\n @ok=${async (e: Event) => {\n const view = e.currentTarget as RecordView\n\n const invalidFields = await this.validateRecord(view.record)\n if (invalidFields.length > 0) {\n view.setFocusOnInvalid(invalidFields)\n return false\n }\n\n popup.close()\n\n this.dispatchEvent(\n new CustomEvent('ok', {\n bubbles: true,\n composed: true,\n detail: view.record\n })\n )\n }}\n ></ox-record-view>\n `,\n parent: document.body,\n preventCloseOnBlur: this.preventCloseOnBlur\n })\n }\n\n popupRecordView() {\n const config = this.grist!.compiledConfig\n const rowIndex = -1\n var record: GristRecord = {}\n const columns = config.columns\n\n var title = 'create'\n\n var recordView = document.createElement('ox-record-view') as RecordView\n\n recordView.columns = columns\n recordView.record = record\n recordView.rowIndex = rowIndex\n\n document.dispatchEvent(\n new CustomEvent('open-popup', {\n detail: {\n template: recordView,\n options: {\n backdrop: true,\n size: 'large',\n title\n },\n callback: (popup: any) => {\n recordView.addEventListener('reset', (e: Event) => {\n const view = e.currentTarget as RecordView\n view.record = {}\n })\n\n recordView.addEventListener('cancel', (e: Event) => {\n popup.close()\n })\n\n recordView.addEventListener('ok', async (e: Event) => {\n const view = e.currentTarget as RecordView\n\n const invalidFields = await this.validateRecord(view.record)\n if (invalidFields.length > 0) {\n view.setFocusOnInvalid(invalidFields)\n return false\n }\n\n if (await this.callback?.(view.record)) {\n popup.close()\n } else {\n console.error('validation failed')\n }\n })\n\n recordView.addEventListener('field-change', async (e: Event) => {\n const view = e.currentTarget as RecordView\n\n var { after, before, column, record, row } = (e as CustomEvent).detail as {\n after: any\n before: any\n column: ColumnConfig\n record: GristRecord\n row: number\n }\n\n var validation = column.validation\n if (validation && typeof validation == 'function') {\n if (!(await validation.call(this, after, before, record, column))) {\n return\n }\n }\n\n view.record = {\n ...record,\n [column.name]: after\n }\n })\n\n popup.onclosed = () => {}\n }\n }\n })\n )\n }\n\n lightPopupCustomCreator(originalContent: HTMLElement) {\n const title = 'create'\n const popupContent = originalContent.cloneNode(true) as HTMLElement\n popupContent.removeAttribute('slot')\n\n OxPopup.open({\n template: html`\n <div title>${title}</div>\n ${popupContent}\n `,\n parent: document.body,\n preventCloseOnBlur: this.preventCloseOnBlur\n })\n\n this.customPopupCallback?.(popupContent) // 사용자 정의 팝업용 콜백 실행\n }\n\n popupCustomCreator(originalContent: HTMLElement) {\n const title = 'create'\n const popupContent = originalContent.cloneNode(true) as HTMLElement\n popupContent.removeAttribute('slot')\n\n document.dispatchEvent(\n new CustomEvent('open-popup', {\n detail: {\n template: popupContent,\n options: {\n backdrop: true,\n size: 'large',\n title\n },\n callback: this.customPopupCallback\n }\n })\n )\n }\n}\n"]}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import '../src/index.js';
|
2
2
|
import '../src/filters/filters-form.js';
|
3
3
|
import '../src/sorters/sorters-control.js';
|
4
|
-
import '../src/record-view/record-creator.js';
|
4
|
+
import '../src/record-view/ox-record-creator.js';
|
5
5
|
import '@operato/popup/ox-popup-list.js';
|
6
6
|
import '@material/web/icon/icon.js';
|
7
7
|
import { TemplateResult } from 'lit';
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import '../src/index.js';
|
2
2
|
import '../src/filters/filters-form.js';
|
3
3
|
import '../src/sorters/sorters-control.js';
|
4
|
-
import '../src/record-view/record-creator.js';
|
4
|
+
import '../src/record-view/ox-record-creator.js';
|
5
5
|
import '@operato/popup/ox-popup-list.js';
|
6
6
|
import '@material/web/icon/icon.js';
|
7
7
|
import { html } from 'lit';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"accumulator-format.stories.js","sourceRoot":"","sources":["../../stories/accumulator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AAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG;IACb,MAAM;IACN,YAAY;IACZ,IAAI,EAAE,MAAM;CACb,CAAA","sourcesContent":["import '../src/index.js'\nimport '../src/filters/filters-form.js'\nimport '../src/sorters/sorters-control.js'\nimport '../src/record-view/record-creator.js'\nimport '@operato/popup/ox-popup-list.js'\nimport '@material/web/icon/icon.js'\n\nimport { html, TemplateResult } from 'lit'\nimport { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'\n\nimport {\n ColumnConfig,\n FetchHandler,\n FetchOption,\n GristClassifier,\n GristEventHandlerSet,\n GristRecord,\n ValidationCallback\n} from '../src/types.js'\n\nimport { CommonHeaderStyles, CommonGristStyles } from '@operato/styles'\n\nconst fetchHandler: FetchHandler = async ({ page, limit }: FetchOption) => {\n var total = 25\n var start = (page! - 1) * limit!\n\n await new Promise(resolve => setTimeout(resolve, 500))\n\n return {\n total,\n records: Array(limit! * page! > total ? total % limit! : limit)\n .fill('')\n .map((item, idx) => {\n return {\n id: String(idx),\n name: idx % 2 ? `shnam-${start + idx + 1}` : `heartyoh-${start + idx + 1}`,\n description: idx % 2 ? `hatiolabmanager${start + idx + 1}1234567890` : `hatiosea manager-${start + idx + 1}`,\n accval: Math.random(),\n accval2: Math.round(Math.random() * 15),\n createdAt: Date.now(),\n updatedAt: Date.now()\n }\n })\n }\n}\n\nconst config = {\n columns: [\n {\n type: 'gutter',\n gutterName: 'dirty'\n },\n {\n type: 'gutter',\n gutterName: 'sequence'\n },\n {\n type: 'gutter',\n gutterName: 'row-selector',\n multiple: true\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'add',\n title: 'add',\n handlers: {\n click: 'record-copy'\n }\n },\n {\n type: 'string',\n name: 'id',\n hidden: true\n },\n {\n type: 'string',\n name: 'name',\n label: true,\n header: 'name',\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 120,\n fixed: true\n },\n {\n type: 'string',\n name: 'description',\n header: {\n renderer: () => 'description',\n style: 'text-transform: none;'\n },\n filter: 'search',\n record: {\n editable: true,\n align: 'left'\n },\n width: 200\n },\n {\n type: 'number',\n name: 'accval',\n label: true,\n header: 'accval',\n record: {\n editable: true,\n align: 'right',\n defaultValue: 100,\n format: '+$#,##0.00'\n },\n accumulator: 'avg',\n // accumulator: {\n // type: 'avg',\n // tag: true\n // },\n sortable: true,\n width: 130\n },\n {\n type: 'number',\n name: 'accval2',\n label: true,\n header: 'accval2',\n record: {\n editable: true,\n align: 'right',\n renderer: (value: any, column: any, record: any) => {\n return value && Intl.NumberFormat('en-US').format(value)\n }\n },\n accumulator: {\n type: 'sum',\n tag: true\n },\n sortable: true,\n width: 130\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: 'updated at',\n record: {\n editable: true,\n defaultValue: {\n name: 'now'\n }\n },\n filter: 'between',\n sortable: true,\n width: 180\n },\n {\n type: 'datetime',\n name: 'createdAt',\n header: 'created at',\n record: {\n editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: false\n },\n accumulator: true\n },\n sorters: [\n {\n name: 'name',\n desc: true\n }\n ],\n pagination: {\n pages: [20, 30, 50, 100, 200]\n }\n}\n\nexport default {\n title: 'accumulator format in ox-grist',\n component: 'ox-grist',\n argTypes: {\n config: { control: 'object' },\n mode: { control: 'select', options: ['GRID', 'LIST', 'CARD'] },\n urlParamsSensitive: { control: 'boolean' },\n withoutSearch: { control: 'boolean' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n config: object\n mode: string\n urlParamsSensitive: boolean\n withoutSearch: boolean\n fetchHandler: FetchHandler\n}\n\nconst Template: Story<ArgTypes> = ({\n config,\n mode = 'GRID',\n urlParamsSensitive = false,\n withoutSearch = false,\n fetchHandler\n}: ArgTypes) =>\n html` <link href=\"https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap\" rel=\"stylesheet\" />\n\n <link href=\"/themes/light.css\" rel=\"stylesheet\" />\n <link href=\"/themes/dark.css\" rel=\"stylesheet\" />\n <link href=\"/themes/spacing.css\" rel=\"stylesheet\" />\n <link href=\"/themes/grist-theme.css\" rel=\"stylesheet\" />\n\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n\n <style>\n ${MDTypeScaleStyles.cssText}\n </style>\n\n <style>\n ${CommonGristStyles.cssText}\n ${CommonHeaderStyles.cssText}\n </style>\n\n <style>\n ox-grist {\n height: 600px;\n }\n\n ox-filters-form {\n flex: 1;\n }\n </style>\n\n <ox-grist\n mode=\"GRID\"\n .config=${config}\n .fetchHandler=${fetchHandler}\n ?url-params-sensitive=${urlParamsSensitive}\n @filters-change=${(e: Event) => console.log('filters', (e.target as any).filters)}\n >\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form ?without-search=${withoutSearch} autofocus></ox-filters-form>\n <ox-record-creator id=\"add\" light-popup>\n <button><md-icon>add</md-icon></button>\n </ox-record-creator>\n </div>\n </div>\n </ox-grist>`\n\nexport const Regular = Template.bind({})\nRegular.args = {\n config,\n fetchHandler,\n mode: 'GRID'\n}\n"]}
|
1
|
+
{"version":3,"file":"accumulator-format.stories.js","sourceRoot":"","sources":["../../stories/accumulator-format.stories.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AACxB,OAAO,gCAAgC,CAAA;AACvC,OAAO,mCAAmC,CAAA;AAC1C,OAAO,yCAAyC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AI,EAAE,MAAM;CACb,CAAA","sourcesContent":["import '../src/index.js'\nimport '../src/filters/filters-form.js'\nimport '../src/sorters/sorters-control.js'\nimport '../src/record-view/ox-record-creator.js'\nimport '@operato/popup/ox-popup-list.js'\nimport '@material/web/icon/icon.js'\n\nimport { html, TemplateResult } from 'lit'\nimport { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'\n\nimport {\n ColumnConfig,\n FetchHandler,\n FetchOption,\n GristClassifier,\n GristEventHandlerSet,\n GristRecord,\n ValidationCallback\n} from '../src/types.js'\n\nimport { CommonHeaderStyles, CommonGristStyles } from '@operato/styles'\n\nconst fetchHandler: FetchHandler = async ({ page, limit }: FetchOption) => {\n var total = 25\n var start = (page! - 1) * limit!\n\n await new Promise(resolve => setTimeout(resolve, 500))\n\n return {\n total,\n records: Array(limit! * page! > total ? total % limit! : limit)\n .fill('')\n .map((item, idx) => {\n return {\n id: String(idx),\n name: idx % 2 ? `shnam-${start + idx + 1}` : `heartyoh-${start + idx + 1}`,\n description: idx % 2 ? `hatiolabmanager${start + idx + 1}1234567890` : `hatiosea manager-${start + idx + 1}`,\n accval: Math.random(),\n accval2: Math.round(Math.random() * 15),\n createdAt: Date.now(),\n updatedAt: Date.now()\n }\n })\n }\n}\n\nconst config = {\n columns: [\n {\n type: 'gutter',\n gutterName: 'dirty'\n },\n {\n type: 'gutter',\n gutterName: 'sequence'\n },\n {\n type: 'gutter',\n gutterName: 'row-selector',\n multiple: true\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'add',\n title: 'add',\n handlers: {\n click: 'record-copy'\n }\n },\n {\n type: 'string',\n name: 'id',\n hidden: true\n },\n {\n type: 'string',\n name: 'name',\n label: true,\n header: 'name',\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 120,\n fixed: true\n },\n {\n type: 'string',\n name: 'description',\n header: {\n renderer: () => 'description',\n style: 'text-transform: none;'\n },\n filter: 'search',\n record: {\n editable: true,\n align: 'left'\n },\n width: 200\n },\n {\n type: 'number',\n name: 'accval',\n label: true,\n header: 'accval',\n record: {\n editable: true,\n align: 'right',\n defaultValue: 100,\n format: '+$#,##0.00'\n },\n accumulator: 'avg',\n // accumulator: {\n // type: 'avg',\n // tag: true\n // },\n sortable: true,\n width: 130\n },\n {\n type: 'number',\n name: 'accval2',\n label: true,\n header: 'accval2',\n record: {\n editable: true,\n align: 'right',\n renderer: (value: any, column: any, record: any) => {\n return value && Intl.NumberFormat('en-US').format(value)\n }\n },\n accumulator: {\n type: 'sum',\n tag: true\n },\n sortable: true,\n width: 130\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: 'updated at',\n record: {\n editable: true,\n defaultValue: {\n name: 'now'\n }\n },\n filter: 'between',\n sortable: true,\n width: 180\n },\n {\n type: 'datetime',\n name: 'createdAt',\n header: 'created at',\n record: {\n editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: false\n },\n accumulator: true\n },\n sorters: [\n {\n name: 'name',\n desc: true\n }\n ],\n pagination: {\n pages: [20, 30, 50, 100, 200]\n }\n}\n\nexport default {\n title: 'accumulator format in ox-grist',\n component: 'ox-grist',\n argTypes: {\n config: { control: 'object' },\n mode: { control: 'select', options: ['GRID', 'LIST', 'CARD'] },\n urlParamsSensitive: { control: 'boolean' },\n withoutSearch: { control: 'boolean' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n config: object\n mode: string\n urlParamsSensitive: boolean\n withoutSearch: boolean\n fetchHandler: FetchHandler\n}\n\nconst Template: Story<ArgTypes> = ({\n config,\n mode = 'GRID',\n urlParamsSensitive = false,\n withoutSearch = false,\n fetchHandler\n}: ArgTypes) =>\n html` <link href=\"https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap\" rel=\"stylesheet\" />\n\n <link href=\"/themes/light.css\" rel=\"stylesheet\" />\n <link href=\"/themes/dark.css\" rel=\"stylesheet\" />\n <link href=\"/themes/spacing.css\" rel=\"stylesheet\" />\n <link href=\"/themes/grist-theme.css\" rel=\"stylesheet\" />\n\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n\n <style>\n ${MDTypeScaleStyles.cssText}\n </style>\n\n <style>\n ${CommonGristStyles.cssText}\n ${CommonHeaderStyles.cssText}\n </style>\n\n <style>\n ox-grist {\n height: 600px;\n }\n\n ox-filters-form {\n flex: 1;\n }\n </style>\n\n <ox-grist\n mode=\"GRID\"\n .config=${config}\n .fetchHandler=${fetchHandler}\n ?url-params-sensitive=${urlParamsSensitive}\n @filters-change=${(e: Event) => console.log('filters', (e.target as any).filters)}\n >\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form ?without-search=${withoutSearch} autofocus></ox-filters-form>\n <ox-record-creator id=\"add\" light-popup>\n <button><md-icon>add</md-icon></button>\n </ox-record-creator>\n </div>\n </div>\n </ox-grist>`\n\nexport const Regular = Template.bind({})\nRegular.args = {\n config,\n fetchHandler,\n mode: 'GRID'\n}\n"]}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import '../src/index.js';
|
2
|
+
import '../src/filters/filters-form.js';
|
3
|
+
import '../src/sorters/sorters-control.js';
|
4
|
+
import '../src/record-view/ox-record-creator.js';
|
5
|
+
import '@operato/popup/ox-popup-list.js';
|
6
|
+
import '@material/web/icon/icon.js';
|
7
|
+
import { TemplateResult } from 'lit';
|
8
|
+
import { FetchHandler } from '../src/types.js';
|
9
|
+
declare const _default: {
|
10
|
+
title: string;
|
11
|
+
component: string;
|
12
|
+
argTypes: {
|
13
|
+
config: {
|
14
|
+
control: string;
|
15
|
+
};
|
16
|
+
mode: {
|
17
|
+
control: string;
|
18
|
+
options: string[];
|
19
|
+
};
|
20
|
+
urlParamsSensitive: {
|
21
|
+
control: string;
|
22
|
+
};
|
23
|
+
withoutSearch: {
|
24
|
+
control: string;
|
25
|
+
};
|
26
|
+
preventCloseOnBlur: {
|
27
|
+
control: string;
|
28
|
+
};
|
29
|
+
};
|
30
|
+
};
|
31
|
+
export default _default;
|
32
|
+
interface Story<T> {
|
33
|
+
(args: T): TemplateResult;
|
34
|
+
args?: Partial<T>;
|
35
|
+
argTypes?: Record<string, unknown>;
|
36
|
+
}
|
37
|
+
interface ArgTypes {
|
38
|
+
config: object;
|
39
|
+
mode: 'GRID' | 'LIST' | 'CARD';
|
40
|
+
urlParamsSensitive: boolean;
|
41
|
+
withoutSearch: boolean;
|
42
|
+
preventCloseOnBlur: boolean;
|
43
|
+
fetchHandler: FetchHandler;
|
44
|
+
}
|
45
|
+
export declare const Regular: Story<ArgTypes>;
|