26 lines
955 B
JavaScript
26 lines
955 B
JavaScript
// Generated, do not edit. sha256:0727197b9fd0ac80c6a541e3be09548dc3b7f76576643552b5f17b4dbd19dd61
|
|||
|
|
export function seedSticky({ columns, seeded, remembered, options }) {
|
||
|
|
const out = { ...seeded };
|
||
|
|
if (!remembered) return out;
|
||
|
|
for (const col of columns) {
|
||
|
|
if (!col.edit || !col.edit.sticky) continue;
|
||
|
|
if (!Object.prototype.hasOwnProperty.call(remembered, col.key)) continue;
|
||
|
|
const value = remembered[col.key];
|
||
|
|
if (value === undefined) continue;
|
||
|
|
const list = options && typeof options.get === 'function' ? options.get(col.key) : null;
|
||
|
|
if (list && !list.some(o => String(o.value) === String(value))) continue;
|
||
|
|
out[col.key] = value;
|
||
|
|
}
|
||
|
|
return out;
|
||
|
|
}
|
||
|
|
|
||
|
|
export function harvestSticky(columns, vals) {
|
||
|
|
const out = {};
|
||
|
|
if (!vals) return out;
|
||
|
|
for (const col of columns) {
|
||
|
|
if (!col.edit || !col.edit.sticky) continue;
|
||
|
|
if (vals[col.key] === undefined) continue;
|
||
|
|
out[col.key] = vals[col.key];
|
||
|
|
}
|
||
|
|
return out;
|
||
|
|
}
|