@ai-matrx/records-ui 0.115.89 → 0.115.91
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 +22 -2
- package/dist/index.cjs +38 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +38 -15
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +24 -7
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +24 -7
- package/dist/pickers.js.map +1 -1
- package/package.json +4 -4
package/dist/pickers.cjs
CHANGED
|
@@ -4502,13 +4502,10 @@ function formulaSourceArchived(field, document2) {
|
|
|
4502
4502
|
|
|
4503
4503
|
// src/values.tsx
|
|
4504
4504
|
var import_records18 = require("@ai-matrx/records");
|
|
4505
|
+
var import_uuid4 = require("@ai-matrx/kit/uuid");
|
|
4505
4506
|
|
|
4506
4507
|
// src/userIds.ts
|
|
4507
|
-
var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
4508
4508
|
var PERSON_NOT_IN_ORGANIZATION = "A person no longer in this organization";
|
|
4509
|
-
function isUserId(value) {
|
|
4510
|
-
return typeof value === "string" && UUID.test(value);
|
|
4511
|
-
}
|
|
4512
4509
|
|
|
4513
4510
|
// src/personNames.ts
|
|
4514
4511
|
var import_react33 = require("react");
|
|
@@ -4742,6 +4739,7 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
|
|
|
4742
4739
|
}
|
|
4743
4740
|
|
|
4744
4741
|
// src/memberNames.ts
|
|
4742
|
+
var import_uuid3 = require("@ai-matrx/kit/uuid");
|
|
4745
4743
|
function memberWords(member) {
|
|
4746
4744
|
const name = member?.name?.trim();
|
|
4747
4745
|
if (name) return name;
|
|
@@ -4952,7 +4950,7 @@ function LivePersonChip({ id, name }) {
|
|
|
4952
4950
|
var NEVER_AN_ID_KINDS = /* @__PURE__ */ new Set(["member", "person", "number", "currency", "percent", "date", "datetime", "checkbox", "boolean"]);
|
|
4953
4951
|
function personWordsOf(kind, value) {
|
|
4954
4952
|
const items = Array.isArray(value) ? value : [value];
|
|
4955
|
-
const ids = items.filter(
|
|
4953
|
+
const ids = items.filter(import_uuid4.isUuidShape);
|
|
4956
4954
|
if (ids.length === 0) return null;
|
|
4957
4955
|
const wordsColumn = !NEVER_AN_ID_KINDS.has(kind);
|
|
4958
4956
|
const named = ids.map((id) => knownPerson(id));
|
|
@@ -5660,10 +5658,11 @@ var import_react44 = require("@ai-matrx/records/react");
|
|
|
5660
5658
|
var import_design_system25 = require("@ai-matrx/design-system");
|
|
5661
5659
|
|
|
5662
5660
|
// src/personRetype.ts
|
|
5661
|
+
var import_uuid5 = require("@ai-matrx/kit/uuid");
|
|
5663
5662
|
var PAGE = 500;
|
|
5664
5663
|
var CEILING = 2e4;
|
|
5665
5664
|
function idsIn(value) {
|
|
5666
|
-
return (Array.isArray(value) ? value : [value]).filter(
|
|
5665
|
+
return (Array.isArray(value) ? value : [value]).filter(import_uuid5.isUuidShape);
|
|
5667
5666
|
}
|
|
5668
5667
|
async function readPersonColumn(client, tableId, key) {
|
|
5669
5668
|
const out = [];
|
|
@@ -5745,6 +5744,23 @@ function personWordsWritten(rows, people, as) {
|
|
|
5745
5744
|
function personWordsPatches(rows, people, key, as) {
|
|
5746
5745
|
return Object.entries(personWordsWritten(rows, people, as)).map(([recordId, words]) => ({ recordId, patch: { [key]: words } }));
|
|
5747
5746
|
}
|
|
5747
|
+
async function forgetWrittenWords(client, tableId, key, written) {
|
|
5748
|
+
const patches = [];
|
|
5749
|
+
for (let offset = 0; offset < CEILING; offset += PAGE) {
|
|
5750
|
+
const page = await client.list({ table_id: tableId, limit: PAGE, offset });
|
|
5751
|
+
if (!page.ok) throw new Error(refusalSentence(page.error));
|
|
5752
|
+
for (const row of page.data.rows) {
|
|
5753
|
+
const word = written[row.id];
|
|
5754
|
+
const kept = (row.document ?? {})["_retired"];
|
|
5755
|
+
if (word === void 0 || !Array.isArray(kept)) continue;
|
|
5756
|
+
const rest = kept.filter((e) => !(e?.key === key && e?.value === word));
|
|
5757
|
+
if (rest.length !== kept.length) patches.push({ recordId: row.id, patch: { _retired: rest } });
|
|
5758
|
+
}
|
|
5759
|
+
if (page.data.rows.length < PAGE) break;
|
|
5760
|
+
}
|
|
5761
|
+
await writeRecordPatches(client, tableId, patches);
|
|
5762
|
+
return patches.length;
|
|
5763
|
+
}
|
|
5748
5764
|
|
|
5749
5765
|
// src/FieldRetype.tsx
|
|
5750
5766
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
@@ -5874,7 +5890,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
|
|
|
5874
5890
|
noun: "column",
|
|
5875
5891
|
subject: name,
|
|
5876
5892
|
undo: async () => {
|
|
5877
|
-
const back = await client.migrateUndo({ migration_id: migration
|
|
5893
|
+
const back = await client.migrateUndo({ migration_id: migration });
|
|
5878
5894
|
if (!back.ok) throw new Error(refusalSentence(back.error));
|
|
5879
5895
|
if (wasPerson) {
|
|
5880
5896
|
await writeRecordPatches(
|
|
@@ -5882,6 +5898,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
|
|
|
5882
5898
|
tableId,
|
|
5883
5899
|
wasPerson.rows.map((r) => ({ recordId: r.recordId, patch: { [field.key]: field.multi ? r.ids : r.ids[0] ?? null } }))
|
|
5884
5900
|
);
|
|
5901
|
+
if (wordsWritten) await forgetWrittenWords(client, tableId, field.key, wordsWritten);
|
|
5885
5902
|
}
|
|
5886
5903
|
(0, import_react44.tableShapeChanged)(tableId);
|
|
5887
5904
|
onRetyped?.();
|