refactor(core): doc property (#8465)

doc property upgraded to use orm.

The visibility of the property are simplified to three types: `always show`, `always hide`, `hide when empty`, and the default is `always show`.

![CleanShot 2024-10-14 at 15 34 52](https://github.com/user-attachments/assets/748b8b80-061f-4d6a-8579-52e59df717c2)

Added a sidebar view to manage properties
![CleanShot 2024-10-14 at 15 35 58](https://github.com/user-attachments/assets/bffa9b1a-a1a5-4708-b2e8-4963120f3af9)

new property ui in workspace settings
![CleanShot 2024-10-14 at 15 36 44](https://github.com/user-attachments/assets/572d8dcc-9b3d-462a-9bcc-5f5fa8e622da)

Property lists can be collapsed
![CleanShot 2024-10-14 at 15 37 59](https://github.com/user-attachments/assets/2b20be1a-8141-478a-8fe7-405aff6d04fd)
This commit is contained in:
EYHN
2024-10-15 10:17:11 +00:00
parent 13b24eb823
commit 24e0c5797c
88 changed files with 3151 additions and 3617 deletions
@@ -0,0 +1,41 @@
import { expect, test } from 'vitest';
import { generateFractionalIndexingKeyBetween } from '../fractional-indexing';
function gen(a: string | null, b: string | null) {
const result = generateFractionalIndexingKeyBetween(a, b);
expect(
a === null || b === null || (a < result && result < b),
`${a} ${b} ${result}`
).toBe(true);
return result;
}
test('fractional-indexing', () => {
for (let i = 0; i < 100; i++) {
const set = new Set<string>();
let a = null;
let b = null;
for (let i = 0; i < 100; i++) {
const s1 = gen(a, b);
expect(a === null || b === null || (a < s1 && s1 < b)).toBe(true);
const s2 = gen(a, b);
expect(a === null || b === null || (a < s2 && s2 < b)).toBe(true);
if (set.has(s1) || set.has(s2) || s1 === s2) {
throw new Error('Duplicate key, ' + set.size + ', ' + s1 + ', ' + s2);
break;
}
set.add(s1);
set.add(s2);
if (s1 < s2) {
a = s1;
b = s2;
} else {
a = s2;
b = s1;
}
}
}
});