@lavalogic/scoria 0.37.30 → 0.37.31
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.
|
@@ -179,10 +179,29 @@
|
|
|
179
179
|
// svelecte always emits the full option object regardless of
|
|
180
180
|
// `valueAsObject`. Map to the shape the discriminated variant
|
|
181
181
|
// promised: primitive for AsPrimitive, object for AsObject.
|
|
182
|
+
if (typeof window !== 'undefined') {
|
|
183
|
+
// eslint-disable-next-line no-console
|
|
184
|
+
console.debug('%c[scoria/SingleSelect] svelecte onChange fired', 'color:#a0a', {
|
|
185
|
+
inputId,
|
|
186
|
+
name,
|
|
187
|
+
newValue,
|
|
188
|
+
newValueType: typeof newValue,
|
|
189
|
+
valueAsObject,
|
|
190
|
+
valueProp,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
182
193
|
if (valueAsObject) {
|
|
183
194
|
void (onchange as (v: V | null) => void | Promise<void>)(newValue);
|
|
184
195
|
} else {
|
|
185
196
|
const primitive = newValue == null ? null : newValue[valueProp];
|
|
197
|
+
if (typeof window !== 'undefined') {
|
|
198
|
+
// eslint-disable-next-line no-console
|
|
199
|
+
console.debug(
|
|
200
|
+
'%c[scoria/SingleSelect] calling outer onchange with primitive',
|
|
201
|
+
'color:#a0a',
|
|
202
|
+
{ primitive }
|
|
203
|
+
);
|
|
204
|
+
}
|
|
186
205
|
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
187
206
|
void (onchange as (v: V[VP] | null) => void | Promise<void>)(primitive);
|
|
188
207
|
}
|
|
@@ -145,8 +145,32 @@
|
|
|
145
145
|
// V (from `value: T`) clashes with the option type
|
|
146
146
|
// (`SelectOption<T>`); the casts let `V` be inferred
|
|
147
147
|
// from the explicit `onchange` annotation.
|
|
148
|
+
if (dev) {
|
|
149
|
+
console.debug(
|
|
150
|
+
'%c[scoria/TableSelect] onchange fired',
|
|
151
|
+
'color:#0a0',
|
|
152
|
+
{
|
|
153
|
+
columnId: cell.column.columnDef.id,
|
|
154
|
+
newValue,
|
|
155
|
+
newValueType: typeof newValue,
|
|
156
|
+
oldValue: value,
|
|
157
|
+
optional,
|
|
158
|
+
willEdit: newValue !== value && (optional || newValue != null),
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
}
|
|
148
162
|
if (newValue !== value) {
|
|
149
163
|
if (optional || newValue != null) {
|
|
164
|
+
if (dev) {
|
|
165
|
+
console.debug(
|
|
166
|
+
'%c[scoria/TableSelect] calling tableContext.onEditCell',
|
|
167
|
+
'color:#0a0',
|
|
168
|
+
{
|
|
169
|
+
coords: $state.snapshot(editable.focusDetails.coordinates),
|
|
170
|
+
value: newValue,
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
}
|
|
150
174
|
tableContext
|
|
151
175
|
.onEditCell(cell.row.original, editable.focusDetails.coordinates, newValue ?? null)
|
|
152
176
|
.catch(devCatch);
|
|
@@ -255,9 +255,24 @@ function makeOnEditCell(editHandlers, onAnyEdit) {
|
|
|
255
255
|
}
|
|
256
256
|
return async (item, coords, value) => {
|
|
257
257
|
const handler = editHandlers.get(coords.id);
|
|
258
|
+
if (typeof window !== 'undefined') {
|
|
259
|
+
// eslint-disable-next-line no-console
|
|
260
|
+
console.debug('%c[scoria/makeOnEditCell] dispatching', 'color:#08f', {
|
|
261
|
+
coordsId: coords.id,
|
|
262
|
+
value,
|
|
263
|
+
handlerFound: !!handler,
|
|
264
|
+
registeredHandlerKeys: Array.from(editHandlers.keys()),
|
|
265
|
+
});
|
|
266
|
+
}
|
|
258
267
|
if (handler) {
|
|
259
268
|
try {
|
|
260
269
|
await handler(item, value, coords);
|
|
270
|
+
if (typeof window !== 'undefined') {
|
|
271
|
+
// eslint-disable-next-line no-console
|
|
272
|
+
console.debug('%c[scoria/makeOnEditCell] handler resolved', 'color:#08f', {
|
|
273
|
+
coordsId: coords.id,
|
|
274
|
+
});
|
|
275
|
+
}
|
|
261
276
|
}
|
|
262
277
|
catch (e) {
|
|
263
278
|
devCatch(e);
|