@operato/data-grist 2.0.0-alpha.139 → 2.0.0-alpha.141
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/data-manipulator.d.ts +1 -1
- package/dist/src/data-manipulator.js +5 -5
- package/dist/src/data-manipulator.js.map +1 -1
- package/dist/src/record-view/record-creator.js +2 -2
- package/dist/src/record-view/record-creator.js.map +1 -1
- package/dist/src/types.d.ts +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/stories/fixed-column.stories.js +9 -9
- package/dist/stories/fixed-column.stories.js.map +1 -1
- package/dist/stories/grid-setting.stories.js +9 -9
- package/dist/stories/grid-setting.stories.js.map +1 -1
- package/dist/stories/grist-modes.stories.js +9 -9
- package/dist/stories/grist-modes.stories.js.map +1 -1
- package/dist/stories/group-header.stories.js +9 -9
- package/dist/stories/group-header.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/data-manipulator.ts +5 -5
- package/src/record-view/record-creator.ts +2 -2
- package/src/types.ts +6 -1
- package/stories/fixed-column.stories.ts +10 -11
- package/stories/grid-setting.stories.ts +9 -11
- package/stories/grist-modes.stories.ts +9 -11
- package/stories/group-header.stories.ts +9 -11
package/src/data-manipulator.ts
CHANGED
@@ -22,7 +22,7 @@ export class DataManipulator extends LitElement {
|
|
22
22
|
constructor() {
|
23
23
|
super()
|
24
24
|
|
25
|
-
this.addEventListener('select-record-change', e => {
|
25
|
+
this.addEventListener('select-record-change', async e => {
|
26
26
|
var {
|
27
27
|
records: selectedRecords,
|
28
28
|
added = [],
|
@@ -41,7 +41,7 @@ export class DataManipulator extends LitElement {
|
|
41
41
|
})
|
42
42
|
|
43
43
|
/* field change processing */
|
44
|
-
this.addEventListener('field-change', e => {
|
44
|
+
this.addEventListener('field-change', async e => {
|
45
45
|
var { after, before, column, record, row } = (e as CustomEvent).detail as {
|
46
46
|
after: any
|
47
47
|
before: any
|
@@ -50,7 +50,7 @@ export class DataManipulator extends LitElement {
|
|
50
50
|
row: number
|
51
51
|
}
|
52
52
|
|
53
|
-
this.onFieldChange({ after, before, column, record, row })
|
53
|
+
await this.onFieldChange({ after, before, column, record, row })
|
54
54
|
})
|
55
55
|
|
56
56
|
/* record reset processing */
|
@@ -76,7 +76,7 @@ export class DataManipulator extends LitElement {
|
|
76
76
|
this.addEventListener('add-child-node', (e: Event) => this.addChildNode((e as CustomEvent).detail as GristRecord))
|
77
77
|
}
|
78
78
|
|
79
|
-
onFieldChange({
|
79
|
+
async onFieldChange({
|
80
80
|
after,
|
81
81
|
before,
|
82
82
|
column,
|
@@ -96,7 +96,7 @@ export class DataManipulator extends LitElement {
|
|
96
96
|
|
97
97
|
var validation = column.validation
|
98
98
|
if (validation && typeof validation == 'function') {
|
99
|
-
if (!validation.call(this, after, before, record, column)) {
|
99
|
+
if (!(await validation.call(this, after, before, record, column))) {
|
100
100
|
return
|
101
101
|
}
|
102
102
|
}
|
@@ -145,7 +145,7 @@ export class RecordCreator extends LitElement {
|
|
145
145
|
}
|
146
146
|
})
|
147
147
|
|
148
|
-
recordView.addEventListener('field-change', (e: Event) => {
|
148
|
+
recordView.addEventListener('field-change', async (e: Event) => {
|
149
149
|
const view = e.currentTarget as RecordView
|
150
150
|
|
151
151
|
var { after, before, column, record, row } = (e as CustomEvent).detail as {
|
@@ -158,7 +158,7 @@ export class RecordCreator extends LitElement {
|
|
158
158
|
|
159
159
|
var validation = column.validation
|
160
160
|
if (validation && typeof validation == 'function') {
|
161
|
-
if (!validation.call(this, after, before, record, column)) {
|
161
|
+
if (!(await validation.call(this, after, before, record, column))) {
|
162
162
|
return
|
163
163
|
}
|
164
164
|
}
|
package/src/types.ts
CHANGED
@@ -377,7 +377,12 @@ export type ColumnConfig = {
|
|
377
377
|
* @param {ColumnConfig} column - The configuration of the column being edited.
|
378
378
|
* @returns {boolean} - Returns `true` if the value is valid, `false` otherwise.
|
379
379
|
*/
|
380
|
-
export type ValidationCallback = (
|
380
|
+
export type ValidationCallback = (
|
381
|
+
after: any,
|
382
|
+
before: any,
|
383
|
+
record: GristRecord,
|
384
|
+
column: ColumnConfig
|
385
|
+
) => boolean | Promise<boolean>
|
381
386
|
|
382
387
|
/**
|
383
388
|
* Configuration options for column labels.
|
@@ -17,6 +17,7 @@ import {
|
|
17
17
|
} from '../src/types.js'
|
18
18
|
|
19
19
|
import { CommonHeaderStyles, CommonGristStyles } from '@operato/styles'
|
20
|
+
import { OxPrompt } from '@operato/popup'
|
20
21
|
|
21
22
|
const fetchHandler: FetchHandler = async ({ page, limit }) => {
|
22
23
|
var total = 120993
|
@@ -176,20 +177,18 @@ const config = {
|
|
176
177
|
filter: 'search',
|
177
178
|
sortable: true,
|
178
179
|
width: 130,
|
179
|
-
validation:
|
180
|
+
validation: (async (after, before, record, column) => {
|
180
181
|
if (after.indexOf('@') == -1) {
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
})
|
188
|
-
)
|
189
|
-
return false
|
182
|
+
return await OxPrompt.open({
|
183
|
+
title: '잘못된 이메일 포맷',
|
184
|
+
text: '그래도 변경하시겠습니까?',
|
185
|
+
cancelButton: { text: 'No' },
|
186
|
+
confirmButton: { text: 'Yes' }
|
187
|
+
})
|
190
188
|
}
|
189
|
+
|
191
190
|
return true
|
192
|
-
} as ValidationCallback
|
191
|
+
}) as ValidationCallback
|
193
192
|
},
|
194
193
|
{
|
195
194
|
type: 'boolean',
|
@@ -23,6 +23,7 @@ import {
|
|
23
23
|
PersonalGristPreference,
|
24
24
|
ValidationCallback
|
25
25
|
} from '../src/types.js'
|
26
|
+
import { OxPrompt } from '@operato/popup'
|
26
27
|
|
27
28
|
const fetchHandler: FetchHandler = async ({ page, limit }) => {
|
28
29
|
var total = 120993
|
@@ -181,20 +182,17 @@ const config = {
|
|
181
182
|
filter: 'search',
|
182
183
|
sortable: true,
|
183
184
|
width: 130,
|
184
|
-
validation:
|
185
|
+
validation: (async (after, before, record, column) => {
|
185
186
|
if (after.indexOf('@') == -1) {
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
})
|
193
|
-
)
|
194
|
-
return false
|
187
|
+
return await OxPrompt.open({
|
188
|
+
title: '잘못된 이메일 포맷',
|
189
|
+
text: '그래도 변경하시겠습니까?',
|
190
|
+
cancelButton: { text: 'No' },
|
191
|
+
confirmButton: { text: 'Yes' }
|
192
|
+
})
|
195
193
|
}
|
196
194
|
return true
|
197
|
-
} as ValidationCallback
|
195
|
+
}) as ValidationCallback
|
198
196
|
},
|
199
197
|
{
|
200
198
|
type: 'boolean',
|
@@ -17,6 +17,7 @@ import {
|
|
17
17
|
GristRecord,
|
18
18
|
ValidationCallback
|
19
19
|
} from '../src/types.js'
|
20
|
+
import { OxPrompt } from '@operato/popup'
|
20
21
|
|
21
22
|
const fetchHandler: FetchHandler = async ({ page, limit }) => {
|
22
23
|
var total = 120993
|
@@ -175,20 +176,17 @@ const config = {
|
|
175
176
|
filter: 'search',
|
176
177
|
sortable: true,
|
177
178
|
width: 130,
|
178
|
-
validation:
|
179
|
+
validation: (async (after, before, record, column) => {
|
179
180
|
if (after.indexOf('@') == -1) {
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
})
|
187
|
-
)
|
188
|
-
return false
|
181
|
+
return await OxPrompt.open({
|
182
|
+
title: '잘못된 이메일 포맷',
|
183
|
+
text: '그래도 변경하시겠습니까?',
|
184
|
+
cancelButton: { text: 'No' },
|
185
|
+
confirmButton: { text: 'Yes' }
|
186
|
+
})
|
189
187
|
}
|
190
188
|
return true
|
191
|
-
} as ValidationCallback
|
189
|
+
}) as ValidationCallback
|
192
190
|
},
|
193
191
|
{
|
194
192
|
type: 'boolean',
|
@@ -17,6 +17,7 @@ import {
|
|
17
17
|
GristRecord,
|
18
18
|
ValidationCallback
|
19
19
|
} from '../src/types.js'
|
20
|
+
import { OxPrompt } from '@operato/popup'
|
20
21
|
|
21
22
|
const fetchHandler: FetchHandler = async ({ page, limit }) => {
|
22
23
|
var total = 120993
|
@@ -186,20 +187,17 @@ const config = {
|
|
186
187
|
filter: 'search',
|
187
188
|
sortable: true,
|
188
189
|
width: 130,
|
189
|
-
validation:
|
190
|
+
validation: (async (after, before, record, column) => {
|
190
191
|
if (after.indexOf('@') == -1) {
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
})
|
198
|
-
)
|
199
|
-
return false
|
192
|
+
return await OxPrompt.open({
|
193
|
+
title: '잘못된 이메일 포맷',
|
194
|
+
text: '그래도 변경하시겠습니까?',
|
195
|
+
cancelButton: { text: 'No' },
|
196
|
+
confirmButton: { text: 'Yes' }
|
197
|
+
})
|
200
198
|
}
|
201
199
|
return true
|
202
|
-
} as ValidationCallback
|
200
|
+
}) as ValidationCallback
|
203
201
|
},
|
204
202
|
{
|
205
203
|
type: 'boolean',
|