@proteinjs/db-ui 1.5.17 → 1.5.19
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 +11 -0
- package/dist/generated/index.js +1 -1
- package/dist/generated/index.js.map +1 -1
- package/dist/src/form/RecordForm.d.ts.map +1 -1
- package/dist/src/form/RecordForm.js +80 -6
- package/dist/src/form/RecordForm.js.map +1 -1
- package/dist/src/table/RecordTable.d.ts.map +1 -1
- package/dist/src/table/RecordTable.js +20 -4
- package/dist/src/table/RecordTable.js.map +1 -1
- package/generated/index.ts +1 -1
- package/package.json +6 -6
- package/src/form/RecordForm.tsx +115 -7
- package/src/table/RecordTable.tsx +34 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.5.18](https://github.com/proteinjs/db/compare/@proteinjs/db-ui@1.5.17...@proteinjs/db-ui@1.5.18) (2026-03-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* `RecordTable` should gracefully handle reference columns that for some reason don't identify as `ReferenceColumn` via `isInstanceOf`. ([83be615](https://github.com/proteinjs/db/commit/83be61590f63e71a49efe452cef4f6a9ec66f945))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [1.5.16](https://github.com/proteinjs/db/compare/@proteinjs/db-ui@1.5.15...@proteinjs/db-ui@1.5.16) (2026-02-12)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @proteinjs/db-ui
|
package/dist/generated/index.js
CHANGED
|
@@ -28,7 +28,7 @@ require("react");
|
|
|
28
28
|
require("string");
|
|
29
29
|
require("uuid");
|
|
30
30
|
/** Generate Source Graph */
|
|
31
|
-
var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-ui/QueryTableLoader\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"QueryTableLoader\",\"filePath\":\"/Users/brentbahry/repos/n3xa/packages/proteinjs/packages/db/packages/ui/src/table/QueryTableLoader.ts\",\"qualifiedName\":\"@proteinjs/db-ui/QueryTableLoader\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"rowCountQb\",\"type\":{\"packageName\":\"\",\"name\":\"QueryBuilder<T>\",\"filePath\":null,\"qualifiedName\":\"/QueryBuilder<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"paginationQb\",\"type\":{\"packageName\":\"\",\"name\":\"QueryBuilder<T>\",\"filePath\":null,\"qualifiedName\":\"/QueryBuilder<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"reactQueryKeys\",\"type\":{\"packageName\":\"\",\"name\":\"TableLoader<T>['reactQueryKeys']\",\"filePath\":null,\"qualifiedName\":\"/TableLoader<T>['reactQueryKeys']\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<T>\",\"filePath\":null,\"qualifiedName\":\"/Table<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"query\",\"type\":{\"packageName\":\"\",\"name\":\"Query<T>\",\"filePath\":null,\"qualifiedName\":\"/Query<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"sort\",\"type\":{\"packageName\":\"\",\"name\":\"SortCriteria<T>[]\",\"filePath\":null,\"qualifiedName\":\"/SortCriteria<T>[]\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"queryOptions\",\"type\":{\"packageName\":\"\",\"name\":\"QueryOptions<T>\",\"filePath\":null,\"qualifiedName\":\"/QueryOptions<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"}],\"methods\":[{\"name\":\"load\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<RowWindow<T>>\",\"filePath\":null,\"qualifiedName\":\"/Promise<RowWindow<T>>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"startIndex\",\"type\":{\"packageName\":\"\",\"name\":\"number\",\"filePath\":null,\"qualifiedName\":\"/number\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"endIndex\",\"type\":{\"packageName\":\"\",\"name\":\"number\",\"filePath\":null,\"qualifiedName\":\"/number\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"skipRowCount\",\"type\":{\"packageName\":\"\",\"name\":\"boolean\",\"filePath\":null,\"qualifiedName\":\"/boolean\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[\"/T extends Record\"],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"TableLoader\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/TableLoader\",\"properties\":[],\"methods\":[],\"typeParameters\":[\"/T\"],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/ui/TableLoader\"},{\"v\":\"@proteinjs/db-ui/RecordFormCustomization\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"RecordFormCustomization\",\"filePath\":\"/Users/brentbahry/repos/n3xa/packages/proteinjs/packages/db/packages/ui/src/form/RecordFormCustomization.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/RecordFormCustomization\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>\",\"filePath\":null,\"qualifiedName\":\"/Table<any>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"getFormButtons\",\"returnType\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"record\",\"type\":{\"packageName\":\"\",\"name\":\"any\",\"filePath\":null,\"qualifiedName\":\"/any\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"defaultFormButtons\",\"type\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"@proteinjs/db-ui/SpecificTableProps\"},{\"v\":\"@proteinjs/db-ui/hashGeneratorPage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"hashGeneratorPage\",\"filePath\":\"/Users/brentbahry/repos/n3xa/packages/proteinjs/packages/db/packages/ui/src/pages/HashGeneratorPage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/hashGeneratorPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/ui/Page\"},{\"v\":\"@proteinjs/db-ui/recordFormPage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"recordFormPage\",\"filePath\":\"/Users/brentbahry/repos/n3xa/packages/proteinjs/packages/db/packages/ui/src/pages/RecordFormPage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/recordFormPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/db-ui/recordTablePage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"recordTablePage\",\"filePath\":\"/Users/brentbahry/repos/n3xa/packages/proteinjs/packages/db/packages/ui/src/pages/RecordTablePage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/recordTablePage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/db-ui/tablesPage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"tablesPage\",\"filePath\":\"/Users/brentbahry/repos/n3xa/packages/proteinjs/packages/db/packages/ui/src/pages/TablesPage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/tablesPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/db-ui/uuidGeneratorPage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"uuidGeneratorPage\",\"filePath\":\"/Users/brentbahry/repos/n3xa/packages/proteinjs/packages/db/packages/ui/src/pages/UuidGeneratorPage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/uuidGeneratorPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/db-ui/MigrationRecordFormCustomization\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"MigrationRecordFormCustomization\",\"filePath\":\"/Users/brentbahry/repos/n3xa/packages/proteinjs/packages/db/packages/ui/src/form/customizations/MigrationRecordFormCustomization.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/MigrationRecordFormCustomization\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"table\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"getFormButtons\",\"returnType\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"migration\",\"type\":{\"packageName\":\"@proteinjs/db\",\"name\":\"Migration\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Migration\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"defaultFormButtons\",\"type\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"RecordFormCustomization\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-ui/RecordFormCustomization\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}}],\"edges\":[{\"v\":\"@proteinjs/db-ui/QueryTableLoader\",\"w\":\"@proteinjs/ui/TableLoader\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/db-ui/RecordFormCustomization\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/db-ui/hashGeneratorPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/recordFormPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/recordTablePage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/tablesPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/uuidGeneratorPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/MigrationRecordFormCustomization\",\"w\":\"@proteinjs/db-ui/RecordFormCustomization\",\"value\":\"extends class\"}]}";
|
|
31
|
+
var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-ui/QueryTableLoader\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"QueryTableLoader\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa4/packages/proteinjs/packages/db/packages/ui/src/table/QueryTableLoader.ts\",\"qualifiedName\":\"@proteinjs/db-ui/QueryTableLoader\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"rowCountQb\",\"type\":{\"packageName\":\"\",\"name\":\"QueryBuilder<T>\",\"filePath\":null,\"qualifiedName\":\"/QueryBuilder<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"paginationQb\",\"type\":{\"packageName\":\"\",\"name\":\"QueryBuilder<T>\",\"filePath\":null,\"qualifiedName\":\"/QueryBuilder<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"reactQueryKeys\",\"type\":{\"packageName\":\"\",\"name\":\"TableLoader<T>['reactQueryKeys']\",\"filePath\":null,\"qualifiedName\":\"/TableLoader<T>['reactQueryKeys']\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<T>\",\"filePath\":null,\"qualifiedName\":\"/Table<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"query\",\"type\":{\"packageName\":\"\",\"name\":\"Query<T>\",\"filePath\":null,\"qualifiedName\":\"/Query<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"sort\",\"type\":{\"packageName\":\"\",\"name\":\"SortCriteria<T>[]\",\"filePath\":null,\"qualifiedName\":\"/SortCriteria<T>[]\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"queryOptions\",\"type\":{\"packageName\":\"\",\"name\":\"QueryOptions<T>\",\"filePath\":null,\"qualifiedName\":\"/QueryOptions<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"}],\"methods\":[{\"name\":\"load\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<RowWindow<T>>\",\"filePath\":null,\"qualifiedName\":\"/Promise<RowWindow<T>>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"startIndex\",\"type\":{\"packageName\":\"\",\"name\":\"number\",\"filePath\":null,\"qualifiedName\":\"/number\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"endIndex\",\"type\":{\"packageName\":\"\",\"name\":\"number\",\"filePath\":null,\"qualifiedName\":\"/number\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"skipRowCount\",\"type\":{\"packageName\":\"\",\"name\":\"boolean\",\"filePath\":null,\"qualifiedName\":\"/boolean\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[\"/T extends Record\"],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"TableLoader\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/TableLoader\",\"properties\":[],\"methods\":[],\"typeParameters\":[\"/T\"],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/ui/TableLoader\"},{\"v\":\"@proteinjs/db-ui/RecordFormCustomization\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"RecordFormCustomization\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa4/packages/proteinjs/packages/db/packages/ui/src/form/RecordFormCustomization.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/RecordFormCustomization\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>\",\"filePath\":null,\"qualifiedName\":\"/Table<any>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"getFormButtons\",\"returnType\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"record\",\"type\":{\"packageName\":\"\",\"name\":\"any\",\"filePath\":null,\"qualifiedName\":\"/any\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"defaultFormButtons\",\"type\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"@proteinjs/db-ui/hashGeneratorPage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"hashGeneratorPage\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa4/packages/proteinjs/packages/db/packages/ui/src/pages/HashGeneratorPage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/hashGeneratorPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/ui/Page\"},{\"v\":\"@proteinjs/db-ui/recordFormPage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"recordFormPage\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa4/packages/proteinjs/packages/db/packages/ui/src/pages/RecordFormPage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/recordFormPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/db-ui/recordTablePage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"recordTablePage\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa4/packages/proteinjs/packages/db/packages/ui/src/pages/RecordTablePage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/recordTablePage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/db-ui/tablesPage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"tablesPage\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa4/packages/proteinjs/packages/db/packages/ui/src/pages/TablesPage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/tablesPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/db-ui/uuidGeneratorPage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"uuidGeneratorPage\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa4/packages/proteinjs/packages/db/packages/ui/src/pages/UuidGeneratorPage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/uuidGeneratorPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/db-ui/SpecificTableProps\"},{\"v\":\"@proteinjs/db-ui/MigrationRecordFormCustomization\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"MigrationRecordFormCustomization\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa4/packages/proteinjs/packages/db/packages/ui/src/form/customizations/MigrationRecordFormCustomization.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/MigrationRecordFormCustomization\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"table\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"getFormButtons\",\"returnType\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"migration\",\"type\":{\"packageName\":\"@proteinjs/db\",\"name\":\"Migration\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Migration\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"defaultFormButtons\",\"type\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"RecordFormCustomization\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-ui/RecordFormCustomization\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}}],\"edges\":[{\"v\":\"@proteinjs/db-ui/QueryTableLoader\",\"w\":\"@proteinjs/ui/TableLoader\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/db-ui/RecordFormCustomization\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/db-ui/hashGeneratorPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/recordFormPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/recordTablePage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/tablesPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/uuidGeneratorPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/MigrationRecordFormCustomization\",\"w\":\"@proteinjs/db-ui/RecordFormCustomization\",\"value\":\"extends class\"}]}";
|
|
32
32
|
/** Generate Source Links */
|
|
33
33
|
var QueryTableLoader_1 = require("../src/table/QueryTableLoader");
|
|
34
34
|
var RecordFormCustomization_1 = require("../src/form/RecordFormCustomization");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,0BAAwB;AACxB,2BAAyB;AACzB,+BAA6B;AAC7B,yBAAuB;AACvB,yBAAuB;AACvB,iCAA+B;AAC/B,yBAAuB;AACvB,2BAAyB;AACzB,kBAAgB;AAChB,iBAAe;AACf,kBAAgB;AAChB,gBAAc;AAGd,4BAA4B;AAE5B,IAAM,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,0BAAwB;AACxB,2BAAyB;AACzB,+BAA6B;AAC7B,yBAAuB;AACvB,yBAAuB;AACvB,iCAA+B;AAC/B,yBAAuB;AACvB,2BAAyB;AACzB,kBAAgB;AAChB,iBAAe;AACf,kBAAgB;AAChB,gBAAc;AAGd,4BAA4B;AAE5B,IAAM,WAAW,GAAG,quWAAquW,CAAC;AAG1vW,4BAA4B;AAE5B,kEAAiE;AACjE,+EAA8E;AAC9E,oEAAmE;AACnE,8DAA6D;AAC7D,gEAA+D;AAC/D,sDAAqD;AACrD,oEAAmE;AACnE,gHAA+G;AAE/G,IAAM,WAAW,GAAG;IACnB,mCAAmC,EAAE,mCAAgB;IACrD,0CAA0C,EAAE,iDAAuB;IACnE,oCAAoC,EAAE,qCAAiB;IACvD,iCAAiC,EAAE,+BAAc;IACjD,kCAAkC,EAAE,iCAAe;IACnD,6BAA6B,EAAE,uBAAU;IACzC,oCAAoC,EAAE,qCAAiB;IACvD,mDAAmD,EAAE,mEAAgC;CACrF,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordForm.d.ts","sourceRoot":"","sources":["../../../src/form/RecordForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,
|
|
1
|
+
{"version":3,"file":"RecordForm.d.ts","sourceRoot":"","sources":["../../../src/form/RecordForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EACL,KAAK,EACL,MAAM,EASP,MAAM,eAAe,CAAC;AAKvB,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,IAAI;IAC9C,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChB,MAAM,CAAC,EAAE,CAAC,CAAC;CACZ,CAAC;AA4DF,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC,qBAoOjF"}
|
|
@@ -49,11 +49,57 @@ var db_1 = require("@proteinjs/db");
|
|
|
49
49
|
var RecordTablePage_1 = require("../pages/RecordTablePage");
|
|
50
50
|
var RecordFormPage_1 = require("../pages/RecordFormPage");
|
|
51
51
|
var RecordFormCustomization_1 = require("./RecordFormCustomization");
|
|
52
|
+
function isObject(value) {
|
|
53
|
+
return typeof value === 'object' && value !== null;
|
|
54
|
+
}
|
|
55
|
+
function isReferenceValue(value) {
|
|
56
|
+
return (isObject(value) &&
|
|
57
|
+
typeof value['_table'] === 'string' &&
|
|
58
|
+
(typeof value['_id'] === 'string' || value['_id'] === null));
|
|
59
|
+
}
|
|
60
|
+
function isReferenceArrayValue(value) {
|
|
61
|
+
return isObject(value) && typeof value['_table'] === 'string' && Array.isArray(value['_ids']);
|
|
62
|
+
}
|
|
63
|
+
function parseReferenceId(value) {
|
|
64
|
+
if (typeof value !== 'string') {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
var id = value.trim();
|
|
68
|
+
return id ? id : null;
|
|
69
|
+
}
|
|
70
|
+
function parseReferenceIds(value) {
|
|
71
|
+
if (typeof value !== 'string') {
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
return value
|
|
75
|
+
.split(',')
|
|
76
|
+
.map(function (id) { return id.trim(); })
|
|
77
|
+
.filter(Boolean);
|
|
78
|
+
}
|
|
79
|
+
function parseBooleanValue(value) {
|
|
80
|
+
if (typeof value === 'boolean') {
|
|
81
|
+
return value;
|
|
82
|
+
}
|
|
83
|
+
if (typeof value !== 'string') {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
var normalized = value.trim().toLowerCase();
|
|
87
|
+
if (normalized === 'true') {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
if (normalized === 'false') {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
52
95
|
function RecordForm(_a) {
|
|
53
96
|
var table = _a.table, record = _a.record;
|
|
54
97
|
var isNewRecord = typeof record === 'undefined';
|
|
55
98
|
var recordFormCustomization = (0, RecordFormCustomization_1.getRecordFormCustomization)(table.name);
|
|
56
99
|
return (react_1.default.createElement(ui_1.Form, { name: (0, string_1.default)(table.name).humanize().s, createFields: createFields(), fieldLayout: fieldLayout(), buttons: (recordFormCustomization === null || recordFormCustomization === void 0 ? void 0 : recordFormCustomization.getFormButtons) ? recordFormCustomization.getFormButtons(record, buttons()) : buttons(), onLoad: onLoad, onLoadProgressMessage: "Loading ".concat((0, string_1.default)(table.name).humanize().s) }));
|
|
100
|
+
function getColumn(columnPropertyName) {
|
|
101
|
+
return table.columns[columnPropertyName];
|
|
102
|
+
}
|
|
57
103
|
function getColumns() {
|
|
58
104
|
var _a, _b;
|
|
59
105
|
var columns = {};
|
|
@@ -62,7 +108,7 @@ function RecordForm(_a) {
|
|
|
62
108
|
columns['name'] = nameColumn;
|
|
63
109
|
}
|
|
64
110
|
for (var columnPropertyName in table.columns) {
|
|
65
|
-
var column =
|
|
111
|
+
var column = getColumn(columnPropertyName);
|
|
66
112
|
if (columnPropertyName == 'name' || columnPropertyName == 'created' || columnPropertyName == 'updated') {
|
|
67
113
|
continue;
|
|
68
114
|
}
|
|
@@ -72,8 +118,8 @@ function RecordForm(_a) {
|
|
|
72
118
|
columns[columnPropertyName] = column;
|
|
73
119
|
}
|
|
74
120
|
if (!isNewRecord) {
|
|
75
|
-
columns['created'] =
|
|
76
|
-
columns['updated'] =
|
|
121
|
+
columns['created'] = getColumn('created');
|
|
122
|
+
columns['updated'] = getColumn('updated');
|
|
77
123
|
}
|
|
78
124
|
return columns;
|
|
79
125
|
}
|
|
@@ -104,6 +150,28 @@ function RecordForm(_a) {
|
|
|
104
150
|
}
|
|
105
151
|
return Object.keys(columns);
|
|
106
152
|
}
|
|
153
|
+
function getFieldValue(columnPropertyName, fieldValue) {
|
|
154
|
+
var column = getColumn(columnPropertyName);
|
|
155
|
+
var currentValue = record ? record[columnPropertyName] : undefined;
|
|
156
|
+
if (isReferenceValue(currentValue)) {
|
|
157
|
+
var id = parseReferenceId(fieldValue);
|
|
158
|
+
return id ? new db_1.Reference(currentValue._table, id) : null;
|
|
159
|
+
}
|
|
160
|
+
if (isReferenceArrayValue(currentValue)) {
|
|
161
|
+
return new db_1.ReferenceArray(currentValue._table, parseReferenceIds(fieldValue));
|
|
162
|
+
}
|
|
163
|
+
if ((0, util_1.isInstanceOf)(column, db_1.ReferenceColumn)) {
|
|
164
|
+
var id = parseReferenceId(fieldValue);
|
|
165
|
+
return id ? new db_1.Reference(column.referenceTable, id) : null;
|
|
166
|
+
}
|
|
167
|
+
if ((0, util_1.isInstanceOf)(column, db_1.ReferenceArrayColumn)) {
|
|
168
|
+
return new db_1.ReferenceArray(column.referenceTable, parseReferenceIds(fieldValue));
|
|
169
|
+
}
|
|
170
|
+
if ((0, util_1.isInstanceOf)(column, db_1.BooleanColumn)) {
|
|
171
|
+
return parseBooleanValue(fieldValue);
|
|
172
|
+
}
|
|
173
|
+
return fieldValue;
|
|
174
|
+
}
|
|
107
175
|
function buttons() {
|
|
108
176
|
var _this = this;
|
|
109
177
|
var newRecord;
|
|
@@ -159,7 +227,7 @@ function RecordForm(_a) {
|
|
|
159
227
|
}
|
|
160
228
|
for (columnPropertyName in fields) {
|
|
161
229
|
field = fields[columnPropertyName];
|
|
162
|
-
record[columnPropertyName] = field.field.value;
|
|
230
|
+
record[columnPropertyName] = getFieldValue(columnPropertyName, field.field.value);
|
|
163
231
|
}
|
|
164
232
|
return [4 /*yield*/, (0, db_1.getDbService)().update(table, record)];
|
|
165
233
|
case 1:
|
|
@@ -194,7 +262,7 @@ function RecordForm(_a) {
|
|
|
194
262
|
record = {};
|
|
195
263
|
for (columnPropertyName in fields) {
|
|
196
264
|
field = fields[columnPropertyName];
|
|
197
|
-
record[columnPropertyName] = field.field.value;
|
|
265
|
+
record[columnPropertyName] = getFieldValue(columnPropertyName, field.field.value);
|
|
198
266
|
}
|
|
199
267
|
return [4 /*yield*/, (0, db_1.getDbService)().insert(table, record)];
|
|
200
268
|
case 1:
|
|
@@ -217,12 +285,18 @@ function RecordForm(_a) {
|
|
|
217
285
|
return [2 /*return*/];
|
|
218
286
|
}
|
|
219
287
|
for (columnPropertyName in fields) {
|
|
220
|
-
column =
|
|
288
|
+
column = getColumn(columnPropertyName);
|
|
221
289
|
field = fields[columnPropertyName].field;
|
|
222
290
|
fieldValue = record[columnPropertyName];
|
|
223
291
|
if (moment_1.default.isMoment(fieldValue)) {
|
|
224
292
|
fieldValue = fieldValue.format('ddd, MMM Do YY, h:mm:ss a');
|
|
225
293
|
}
|
|
294
|
+
else if (isReferenceValue(fieldValue)) {
|
|
295
|
+
fieldValue = fieldValue._id || '';
|
|
296
|
+
}
|
|
297
|
+
else if (isReferenceArrayValue(fieldValue)) {
|
|
298
|
+
fieldValue = fieldValue._ids.join(', ');
|
|
299
|
+
}
|
|
226
300
|
else if ((0, util_1.isInstanceOf)(column, db_1.BooleanColumn)) {
|
|
227
301
|
fieldValue = fieldValue == true ? 'True' : 'False';
|
|
228
302
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordForm.js","sourceRoot":"","sources":["../../../src/form/RecordForm.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,kDAAuB;AACvB,kDAA4B;AAC5B,wCAA2D;AAC3D,oCAAqE;AACrE,
|
|
1
|
+
{"version":3,"file":"RecordForm.js","sourceRoot":"","sources":["../../../src/form/RecordForm.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,kDAAuB;AACvB,kDAA4B;AAC5B,wCAA2D;AAC3D,oCAAqE;AACrE,oCAWuB;AACvB,4DAA2D;AAC3D,0DAAyD;AACzD,qEAAuE;AASvE,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,CACL,QAAQ,CAAC,KAAK,CAAC;QACf,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,QAAQ;QACnC,CAAC,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,QAAQ,IAAI,KAAK,CAAC,KA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UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;qBACpD;oBAED,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC;oBACzB,IACE,kBAAkB,IAAI,SAAS;wBAC/B,kBAAkB,IAAI,SAAS;wBAC/B,kBAAkB,IAAI,IAAI;wBAC1B,IAAA,mBAAY,EAAC,MAAM,EAAE,mBAAc,CAAC,EACpC;wBACA,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE;4BACxB,KAAK,CAAC,aAAa,GAAG,EAAE,CAAC;yBAC1B;wBAED,KAAK,CAAC,aAAa,CAAC,QAAQ,GAAG,IAAI,CAAC;qBACrC;iBACF;;;;KACF;AACH,CAAC;AApOD,gCAoOC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordTable.d.ts","sourceRoot":"","sources":["../../../src/table/RecordTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAwD,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC9G,OAAO,
|
|
1
|
+
{"version":3,"file":"RecordTable.d.ts","sourceRoot":"","sources":["../../../src/table/RecordTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAwD,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC9G,OAAO,EAGL,MAAM,EAGN,KAAK,EAEN,MAAM,eAAe,CAAC;AAkBvB,KAAK,gBAAgB,GAAG,aAAa,GAAG,SAAS,CAAC;AAClD,KAAK,kBAAkB,CAAC,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC;AAEnE,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,IAAI;IAC/C,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChB,WAAW,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;AAkC1B,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,qBAyIvE"}
|
|
@@ -145,13 +145,32 @@ function RecordTable(props) {
|
|
|
145
145
|
}
|
|
146
146
|
function getDefaultRenderer(column) {
|
|
147
147
|
return function (value) {
|
|
148
|
+
var _a, _b;
|
|
149
|
+
console.log((_a = column.constructor) === null || _a === void 0 ? void 0 : _a.name, (0, util_1.isInstanceOf)(column, db_1.ReferenceColumn), (0, util_1.isInstanceOf)(column, db_1.ReferenceArrayColumn), (0, util_1.isInstanceOf)(column, db_2.ObjectColumn), (0, util_1.isInstanceOf)(column, db_2.StringColumn));
|
|
150
|
+
if ((0, util_1.isInstanceOf)(column, db_1.ReferenceColumn)) {
|
|
151
|
+
return (value === null || value === void 0 ? void 0 : value._id) || '';
|
|
152
|
+
}
|
|
153
|
+
if ((0, util_1.isInstanceOf)(column, db_1.ReferenceArrayColumn)) {
|
|
154
|
+
return ((_b = value === null || value === void 0 ? void 0 : value._ids) === null || _b === void 0 ? void 0 : _b.join(', ')) || '';
|
|
155
|
+
}
|
|
156
|
+
if (value && typeof value === 'object') {
|
|
157
|
+
if ('_id' in value && typeof value._id === 'string') {
|
|
158
|
+
return value._id;
|
|
159
|
+
}
|
|
160
|
+
if ('_ids' in value && Array.isArray(value._ids)) {
|
|
161
|
+
return value._ids.join(', ');
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if ((0, util_1.isInstanceOf)(column, db_2.ObjectColumn) || (0, util_1.isInstanceOf)(column, db_2.ArrayColumn)) {
|
|
165
|
+
return JSON.stringify(value);
|
|
166
|
+
}
|
|
148
167
|
if ((0, util_1.isInstanceOf)(column, db_2.IntegerColumn) ||
|
|
149
168
|
(0, util_1.isInstanceOf)(column, db_2.FloatColumn) ||
|
|
150
169
|
(0, util_1.isInstanceOf)(column, db_2.DecimalColumn)) {
|
|
151
170
|
return value != null ? value.toString() : '';
|
|
152
171
|
}
|
|
153
172
|
if ((0, util_1.isInstanceOf)(column, db_2.StringColumn)) {
|
|
154
|
-
return value
|
|
173
|
+
return value != null ? String(value) : '';
|
|
155
174
|
}
|
|
156
175
|
if ((0, util_1.isInstanceOf)(column, db_2.BooleanColumn)) {
|
|
157
176
|
return value ? '✅' : '❌';
|
|
@@ -162,9 +181,6 @@ function RecordTable(props) {
|
|
|
162
181
|
if ((0, util_1.isInstanceOf)(column, db_2.DateTimeColumn)) {
|
|
163
182
|
return value ? (0, moment_1.default)(value).format('YYYY-MM-DD HH:mm:ss') : '';
|
|
164
183
|
}
|
|
165
|
-
if ((0, util_1.isInstanceOf)(column, db_2.ObjectColumn) || (0, util_1.isInstanceOf)(column, db_2.ArrayColumn)) {
|
|
166
|
-
return JSON.stringify(value);
|
|
167
|
-
}
|
|
168
184
|
return value != null ? value.toString() : '';
|
|
169
185
|
};
|
|
170
186
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordTable.js","sourceRoot":"","sources":["../../../src/table/RecordTable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,sDAAkD;AAClD,kDAAuB;AACvB,oCAA8G;AAC9G,
|
|
1
|
+
{"version":3,"file":"RecordTable.js","sourceRoot":"","sources":["../../../src/table/RecordTable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,sDAAkD;AAClD,kDAAuB;AACvB,oCAA8G;AAC9G,oCAQuB;AACvB,uDAA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EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,kBAAkB,EAAE,EACzE,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,4BAA4B,EAC9E,OAAO,EAAE,OAAO,EAAE,IACd,WAAW,EACf,CACH,CAAC;AACJ,CAAC;AAzID,kCAyIC"}
|
package/generated/index.ts
CHANGED
|
@@ -16,7 +16,7 @@ import 'uuid';
|
|
|
16
16
|
|
|
17
17
|
/** Generate Source Graph */
|
|
18
18
|
|
|
19
|
-
const sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-ui/QueryTableLoader\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"QueryTableLoader\",\"filePath\":\"/Users/brentbahry/repos/n3xa/packages/proteinjs/packages/db/packages/ui/src/table/QueryTableLoader.ts\",\"qualifiedName\":\"@proteinjs/db-ui/QueryTableLoader\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"rowCountQb\",\"type\":{\"packageName\":\"\",\"name\":\"QueryBuilder<T>\",\"filePath\":null,\"qualifiedName\":\"/QueryBuilder<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"paginationQb\",\"type\":{\"packageName\":\"\",\"name\":\"QueryBuilder<T>\",\"filePath\":null,\"qualifiedName\":\"/QueryBuilder<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"reactQueryKeys\",\"type\":{\"packageName\":\"\",\"name\":\"TableLoader<T>['reactQueryKeys']\",\"filePath\":null,\"qualifiedName\":\"/TableLoader<T>['reactQueryKeys']\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<T>\",\"filePath\":null,\"qualifiedName\":\"/Table<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"query\",\"type\":{\"packageName\":\"\",\"name\":\"Query<T>\",\"filePath\":null,\"qualifiedName\":\"/Query<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"sort\",\"type\":{\"packageName\":\"\",\"name\":\"SortCriteria<T>[]\",\"filePath\":null,\"qualifiedName\":\"/SortCriteria<T>[]\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"queryOptions\",\"type\":{\"packageName\":\"\",\"name\":\"QueryOptions<T>\",\"filePath\":null,\"qualifiedName\":\"/QueryOptions<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"}],\"methods\":[{\"name\":\"load\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<RowWindow<T>>\",\"filePath\":null,\"qualifiedName\":\"/Promise<RowWindow<T>>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"startIndex\",\"type\":{\"packageName\":\"\",\"name\":\"number\",\"filePath\":null,\"qualifiedName\":\"/number\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"endIndex\",\"type\":{\"packageName\":\"\",\"name\":\"number\",\"filePath\":null,\"qualifiedName\":\"/number\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"skipRowCount\",\"type\":{\"packageName\":\"\",\"name\":\"boolean\",\"filePath\":null,\"qualifiedName\":\"/boolean\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[\"/T extends Record\"],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"TableLoader\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/TableLoader\",\"properties\":[],\"methods\":[],\"typeParameters\":[\"/T\"],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/ui/TableLoader\"},{\"v\":\"@proteinjs/db-ui/RecordFormCustomization\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"RecordFormCustomization\",\"filePath\":\"/Users/brentbahry/repos/n3xa/packages/proteinjs/packages/db/packages/ui/src/form/RecordFormCustomization.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/RecordFormCustomization\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>\",\"filePath\":null,\"qualifiedName\":\"/Table<any>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"getFormButtons\",\"returnType\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"record\",\"type\":{\"packageName\":\"\",\"name\":\"any\",\"filePath\":null,\"qualifiedName\":\"/any\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"defaultFormButtons\",\"type\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"@proteinjs/db-ui/SpecificTableProps\"},{\"v\":\"@proteinjs/db-ui/hashGeneratorPage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"hashGeneratorPage\",\"filePath\":\"/Users/brentbahry/repos/n3xa/packages/proteinjs/packages/db/packages/ui/src/pages/HashGeneratorPage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/hashGeneratorPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/ui/Page\"},{\"v\":\"@proteinjs/db-ui/recordFormPage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"recordFormPage\",\"filePath\":\"/Users/brentbahry/repos/n3xa/packages/proteinjs/packages/db/packages/ui/src/pages/RecordFormPage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/recordFormPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/db-ui/recordTablePage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"recordTablePage\",\"filePath\":\"/Users/brentbahry/repos/n3xa/packages/proteinjs/packages/db/packages/ui/src/pages/RecordTablePage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/recordTablePage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/db-ui/tablesPage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"tablesPage\",\"filePath\":\"/Users/brentbahry/repos/n3xa/packages/proteinjs/packages/db/packages/ui/src/pages/TablesPage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/tablesPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/db-ui/uuidGeneratorPage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"uuidGeneratorPage\",\"filePath\":\"/Users/brentbahry/repos/n3xa/packages/proteinjs/packages/db/packages/ui/src/pages/UuidGeneratorPage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/uuidGeneratorPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/db-ui/MigrationRecordFormCustomization\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"MigrationRecordFormCustomization\",\"filePath\":\"/Users/brentbahry/repos/n3xa/packages/proteinjs/packages/db/packages/ui/src/form/customizations/MigrationRecordFormCustomization.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/MigrationRecordFormCustomization\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"table\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"getFormButtons\",\"returnType\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"migration\",\"type\":{\"packageName\":\"@proteinjs/db\",\"name\":\"Migration\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Migration\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"defaultFormButtons\",\"type\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"RecordFormCustomization\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-ui/RecordFormCustomization\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}}],\"edges\":[{\"v\":\"@proteinjs/db-ui/QueryTableLoader\",\"w\":\"@proteinjs/ui/TableLoader\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/db-ui/RecordFormCustomization\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/db-ui/hashGeneratorPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/recordFormPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/recordTablePage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/tablesPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/uuidGeneratorPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/MigrationRecordFormCustomization\",\"w\":\"@proteinjs/db-ui/RecordFormCustomization\",\"value\":\"extends class\"}]}";
|
|
19
|
+
const sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/db-ui/QueryTableLoader\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"QueryTableLoader\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa4/packages/proteinjs/packages/db/packages/ui/src/table/QueryTableLoader.ts\",\"qualifiedName\":\"@proteinjs/db-ui/QueryTableLoader\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"rowCountQb\",\"type\":{\"packageName\":\"\",\"name\":\"QueryBuilder<T>\",\"filePath\":null,\"qualifiedName\":\"/QueryBuilder<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"paginationQb\",\"type\":{\"packageName\":\"\",\"name\":\"QueryBuilder<T>\",\"filePath\":null,\"qualifiedName\":\"/QueryBuilder<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"reactQueryKeys\",\"type\":{\"packageName\":\"\",\"name\":\"TableLoader<T>['reactQueryKeys']\",\"filePath\":null,\"qualifiedName\":\"/TableLoader<T>['reactQueryKeys']\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<T>\",\"filePath\":null,\"qualifiedName\":\"/Table<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"query\",\"type\":{\"packageName\":\"\",\"name\":\"Query<T>\",\"filePath\":null,\"qualifiedName\":\"/Query<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"sort\",\"type\":{\"packageName\":\"\",\"name\":\"SortCriteria<T>[]\",\"filePath\":null,\"qualifiedName\":\"/SortCriteria<T>[]\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"},{\"name\":\"queryOptions\",\"type\":{\"packageName\":\"\",\"name\":\"QueryOptions<T>\",\"filePath\":null,\"qualifiedName\":\"/QueryOptions<T>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"private\"}],\"methods\":[{\"name\":\"load\",\"returnType\":{\"packageName\":\"\",\"name\":\"Promise<RowWindow<T>>\",\"filePath\":null,\"qualifiedName\":\"/Promise<RowWindow<T>>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":true,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"startIndex\",\"type\":{\"packageName\":\"\",\"name\":\"number\",\"filePath\":null,\"qualifiedName\":\"/number\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"endIndex\",\"type\":{\"packageName\":\"\",\"name\":\"number\",\"filePath\":null,\"qualifiedName\":\"/number\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"skipRowCount\",\"type\":{\"packageName\":\"\",\"name\":\"boolean\",\"filePath\":null,\"qualifiedName\":\"/boolean\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[\"/T extends Record\"],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"TableLoader\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/TableLoader\",\"properties\":[],\"methods\":[],\"typeParameters\":[\"/T\"],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/ui/TableLoader\"},{\"v\":\"@proteinjs/db-ui/RecordFormCustomization\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"RecordFormCustomization\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa4/packages/proteinjs/packages/db/packages/ui/src/form/RecordFormCustomization.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/RecordFormCustomization\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"table\",\"type\":{\"packageName\":\"\",\"name\":\"Table<any>\",\"filePath\":null,\"qualifiedName\":\"/Table<any>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"getFormButtons\",\"returnType\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"record\",\"type\":{\"packageName\":\"\",\"name\":\"any\",\"filePath\":null,\"qualifiedName\":\"/any\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"defaultFormButtons\",\"type\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"directParentClasses\":[],\"sourceType\":2}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"@proteinjs/db-ui/hashGeneratorPage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"hashGeneratorPage\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa4/packages/proteinjs/packages/db/packages/ui/src/pages/HashGeneratorPage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/hashGeneratorPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/ui/Page\"},{\"v\":\"@proteinjs/db-ui/recordFormPage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"recordFormPage\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa4/packages/proteinjs/packages/db/packages/ui/src/pages/RecordFormPage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/recordFormPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/db-ui/recordTablePage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"recordTablePage\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa4/packages/proteinjs/packages/db/packages/ui/src/pages/RecordTablePage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/recordTablePage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/db-ui/tablesPage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"tablesPage\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa4/packages/proteinjs/packages/db/packages/ui/src/pages/TablesPage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/tablesPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/db-ui/uuidGeneratorPage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"uuidGeneratorPage\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa4/packages/proteinjs/packages/db/packages/ui/src/pages/UuidGeneratorPage.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/uuidGeneratorPage\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/Page\",\"typeParameters\":[],\"directParents\":null}]},\"isExported\":true,\"isConst\":true,\"sourceType\":0}},{\"v\":\"@proteinjs/db-ui/SpecificTableProps\"},{\"v\":\"@proteinjs/db-ui/MigrationRecordFormCustomization\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"MigrationRecordFormCustomization\",\"filePath\":\"/Users/brentbahry/repos/farm/n3xa4/packages/proteinjs/packages/db/packages/ui/src/form/customizations/MigrationRecordFormCustomization.tsx\",\"qualifiedName\":\"@proteinjs/db-ui/MigrationRecordFormCustomization\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"name\":\"table\",\"type\":null,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[{\"name\":\"getFormButtons\",\"returnType\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null},\"isAsync\":false,\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"parameters\":[{\"name\":\"migration\",\"type\":{\"packageName\":\"@proteinjs/db\",\"name\":\"Migration\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db/Migration\",\"typeParameters\":null,\"directParents\":null}},{\"name\":\"defaultFormButtons\",\"type\":{\"packageName\":\"\",\"name\":\"FormButtons<any>\",\"filePath\":null,\"qualifiedName\":\"/FormButtons<any>\",\"typeParameters\":null,\"directParents\":null}}]}],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"RecordFormCustomization\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/db-ui/RecordFormCustomization\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParentInterfaces\":[],\"directParentClasses\":[]}],\"sourceType\":2}}],\"edges\":[{\"v\":\"@proteinjs/db-ui/QueryTableLoader\",\"w\":\"@proteinjs/ui/TableLoader\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/db-ui/RecordFormCustomization\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"implements interface\"},{\"v\":\"@proteinjs/db-ui/hashGeneratorPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/recordFormPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/recordTablePage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/tablesPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/uuidGeneratorPage\",\"w\":\"@proteinjs/ui/Page\",\"value\":\"has type\"},{\"v\":\"@proteinjs/db-ui/MigrationRecordFormCustomization\",\"w\":\"@proteinjs/db-ui/RecordFormCustomization\",\"value\":\"extends class\"}]}";
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
/** Generate Source Links */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proteinjs/db-ui",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.19",
|
|
4
4
|
"description": "Db ui components",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
"@emotion/styled": "11.11.0",
|
|
26
26
|
"@mui/icons-material": "5.14.11",
|
|
27
27
|
"@mui/material": "5.14.11",
|
|
28
|
-
"@proteinjs/db": "^1.21.
|
|
29
|
-
"@proteinjs/reflection": "1.1.
|
|
30
|
-
"@proteinjs/ui": "4.3.
|
|
31
|
-
"@proteinjs/util": "1.
|
|
28
|
+
"@proteinjs/db": "^1.21.3",
|
|
29
|
+
"@proteinjs/reflection": "^1.1.11",
|
|
30
|
+
"@proteinjs/ui": "^4.3.2",
|
|
31
|
+
"@proteinjs/util": "^1.6.0",
|
|
32
32
|
"moment": "2.29.4",
|
|
33
33
|
"react": "18.2.0",
|
|
34
34
|
"string": "3.3.3",
|
|
35
35
|
"uuid": "8.3.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@proteinjs/reflection-build": "1.4.
|
|
38
|
+
"@proteinjs/reflection-build": "^1.4.3",
|
|
39
39
|
"@types/jest": "29.5.5",
|
|
40
40
|
"@types/node": "14.0.27",
|
|
41
41
|
"@types/react": "18.2.23",
|
package/src/form/RecordForm.tsx
CHANGED
|
@@ -3,7 +3,18 @@ import S from 'string';
|
|
|
3
3
|
import moment from 'moment';
|
|
4
4
|
import { StringUtil, isInstanceOf } from '@proteinjs/util';
|
|
5
5
|
import { Form, Fields, textField, FormButtons } from '@proteinjs/ui';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
Table,
|
|
8
|
+
Record,
|
|
9
|
+
Column,
|
|
10
|
+
getDbService,
|
|
11
|
+
DateTimeColumn,
|
|
12
|
+
BooleanColumn,
|
|
13
|
+
Reference,
|
|
14
|
+
ReferenceArray,
|
|
15
|
+
ReferenceColumn,
|
|
16
|
+
ReferenceArrayColumn,
|
|
17
|
+
} from '@proteinjs/db';
|
|
7
18
|
import { recordTableLink } from '../pages/RecordTablePage';
|
|
8
19
|
import { recordFormLink } from '../pages/RecordFormPage';
|
|
9
20
|
import { getRecordFormCustomization } from './RecordFormCustomization';
|
|
@@ -13,9 +24,68 @@ export type RecordFormProps<T extends Record> = {
|
|
|
13
24
|
record?: T;
|
|
14
25
|
};
|
|
15
26
|
|
|
27
|
+
type PlainObject = { [key: string]: unknown };
|
|
28
|
+
|
|
29
|
+
function isObject(value: unknown): value is PlainObject {
|
|
30
|
+
return typeof value === 'object' && value !== null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function isReferenceValue(value: unknown): value is { _table: string; _id: string | null } {
|
|
34
|
+
return (
|
|
35
|
+
isObject(value) &&
|
|
36
|
+
typeof value['_table'] === 'string' &&
|
|
37
|
+
(typeof value['_id'] === 'string' || value['_id'] === null)
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function isReferenceArrayValue(value: unknown): value is { _table: string; _ids: string[] } {
|
|
42
|
+
return isObject(value) && typeof value['_table'] === 'string' && Array.isArray(value['_ids']);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function parseReferenceId(value: unknown): string | null {
|
|
46
|
+
if (typeof value !== 'string') {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const id = value.trim();
|
|
51
|
+
return id ? id : null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function parseReferenceIds(value: unknown): string[] {
|
|
55
|
+
if (typeof value !== 'string') {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return value
|
|
60
|
+
.split(',')
|
|
61
|
+
.map((id) => id.trim())
|
|
62
|
+
.filter(Boolean);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function parseBooleanValue(value: unknown): boolean | null {
|
|
66
|
+
if (typeof value === 'boolean') {
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (typeof value !== 'string') {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const normalized = value.trim().toLowerCase();
|
|
75
|
+
if (normalized === 'true') {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
if (normalized === 'false') {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
|
|
16
85
|
export function RecordForm<T extends Record>({ table, record }: RecordFormProps<T>) {
|
|
17
86
|
const isNewRecord = typeof record === 'undefined';
|
|
18
87
|
const recordFormCustomization = getRecordFormCustomization(table.name);
|
|
88
|
+
|
|
19
89
|
return (
|
|
20
90
|
<Form
|
|
21
91
|
name={S(table.name).humanize().s}
|
|
@@ -29,6 +99,10 @@ export function RecordForm<T extends Record>({ table, record }: RecordFormProps<
|
|
|
29
99
|
/>
|
|
30
100
|
);
|
|
31
101
|
|
|
102
|
+
function getColumn(columnPropertyName: string) {
|
|
103
|
+
return (table.columns as any)[columnPropertyName] as Column<T, any>;
|
|
104
|
+
}
|
|
105
|
+
|
|
32
106
|
function getColumns() {
|
|
33
107
|
const columns: { [columnPropertyName: string]: Column<T, any> } = {};
|
|
34
108
|
const nameColumn = (table.columns as any)['name'] as Column<T, any>;
|
|
@@ -37,7 +111,7 @@ export function RecordForm<T extends Record>({ table, record }: RecordFormProps<
|
|
|
37
111
|
}
|
|
38
112
|
|
|
39
113
|
for (const columnPropertyName in table.columns) {
|
|
40
|
-
const column = (
|
|
114
|
+
const column = getColumn(columnPropertyName);
|
|
41
115
|
if (columnPropertyName == 'name' || columnPropertyName == 'created' || columnPropertyName == 'updated') {
|
|
42
116
|
continue;
|
|
43
117
|
}
|
|
@@ -50,8 +124,8 @@ export function RecordForm<T extends Record>({ table, record }: RecordFormProps<
|
|
|
50
124
|
}
|
|
51
125
|
|
|
52
126
|
if (!isNewRecord) {
|
|
53
|
-
columns['created'] = (
|
|
54
|
-
columns['updated'] = (
|
|
127
|
+
columns['created'] = getColumn('created');
|
|
128
|
+
columns['updated'] = getColumn('updated');
|
|
55
129
|
}
|
|
56
130
|
|
|
57
131
|
return columns;
|
|
@@ -90,6 +164,35 @@ export function RecordForm<T extends Record>({ table, record }: RecordFormProps<
|
|
|
90
164
|
return Object.keys(columns) as (keyof T)[];
|
|
91
165
|
}
|
|
92
166
|
|
|
167
|
+
function getFieldValue(columnPropertyName: string, fieldValue: unknown) {
|
|
168
|
+
const column = getColumn(columnPropertyName);
|
|
169
|
+
const currentValue = record ? (record as any)[columnPropertyName] : undefined;
|
|
170
|
+
|
|
171
|
+
if (isReferenceValue(currentValue)) {
|
|
172
|
+
const id = parseReferenceId(fieldValue);
|
|
173
|
+
return id ? new Reference(currentValue._table, id) : null;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (isReferenceArrayValue(currentValue)) {
|
|
177
|
+
return new ReferenceArray(currentValue._table, parseReferenceIds(fieldValue));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (isInstanceOf(column, ReferenceColumn)) {
|
|
181
|
+
const id = parseReferenceId(fieldValue);
|
|
182
|
+
return id ? new Reference(column.referenceTable, id) : null;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (isInstanceOf(column, ReferenceArrayColumn)) {
|
|
186
|
+
return new ReferenceArray(column.referenceTable, parseReferenceIds(fieldValue));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (isInstanceOf(column, BooleanColumn)) {
|
|
190
|
+
return parseBooleanValue(fieldValue);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return fieldValue;
|
|
194
|
+
}
|
|
195
|
+
|
|
93
196
|
function buttons(): FormButtons<any> {
|
|
94
197
|
let newRecord: T;
|
|
95
198
|
return {
|
|
@@ -133,7 +236,7 @@ export function RecordForm<T extends Record>({ table, record }: RecordFormProps<
|
|
|
133
236
|
|
|
134
237
|
for (const columnPropertyName in fields) {
|
|
135
238
|
const field = fields[columnPropertyName];
|
|
136
|
-
(record as any)[columnPropertyName] = field.field.value;
|
|
239
|
+
(record as any)[columnPropertyName] = getFieldValue(columnPropertyName, field.field.value);
|
|
137
240
|
}
|
|
138
241
|
|
|
139
242
|
await getDbService().update(table, record);
|
|
@@ -159,7 +262,7 @@ export function RecordForm<T extends Record>({ table, record }: RecordFormProps<
|
|
|
159
262
|
const record: any = {};
|
|
160
263
|
for (const columnPropertyName in fields) {
|
|
161
264
|
const field = fields[columnPropertyName];
|
|
162
|
-
|
|
265
|
+
record[columnPropertyName] = getFieldValue(columnPropertyName, field.field.value);
|
|
163
266
|
}
|
|
164
267
|
|
|
165
268
|
newRecord = await getDbService().insert(table, record);
|
|
@@ -178,11 +281,16 @@ export function RecordForm<T extends Record>({ table, record }: RecordFormProps<
|
|
|
178
281
|
}
|
|
179
282
|
|
|
180
283
|
for (const columnPropertyName in fields) {
|
|
181
|
-
const column = (
|
|
284
|
+
const column = getColumn(columnPropertyName);
|
|
182
285
|
const field = fields[columnPropertyName].field;
|
|
183
286
|
let fieldValue = (record as any)[columnPropertyName];
|
|
287
|
+
|
|
184
288
|
if (moment.isMoment(fieldValue)) {
|
|
185
289
|
fieldValue = fieldValue.format('ddd, MMM Do YY, h:mm:ss a');
|
|
290
|
+
} else if (isReferenceValue(fieldValue)) {
|
|
291
|
+
fieldValue = fieldValue._id || '';
|
|
292
|
+
} else if (isReferenceArrayValue(fieldValue)) {
|
|
293
|
+
fieldValue = fieldValue._ids.join(', ');
|
|
186
294
|
} else if (isInstanceOf(column, BooleanColumn)) {
|
|
187
295
|
fieldValue = fieldValue == true ? 'True' : 'False';
|
|
188
296
|
}
|
|
@@ -2,7 +2,15 @@ import React from 'react';
|
|
|
2
2
|
import { Delete, Add } from '@mui/icons-material';
|
|
3
3
|
import S from 'string';
|
|
4
4
|
import { CustomRenderer, TableButton, Table as TableComponent, TableLoader, TableProps } from '@proteinjs/ui';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
Column,
|
|
7
|
+
QueryBuilderFactory,
|
|
8
|
+
Record,
|
|
9
|
+
ReferenceArrayColumn,
|
|
10
|
+
ReferenceColumn,
|
|
11
|
+
Table,
|
|
12
|
+
getDb,
|
|
13
|
+
} from '@proteinjs/db';
|
|
6
14
|
import { QueryTableLoader } from './QueryTableLoader';
|
|
7
15
|
import { newRecordFormLink, recordFormLink } from '../pages/RecordFormPage';
|
|
8
16
|
import { recordTableLink } from '../pages/RecordTablePage';
|
|
@@ -95,6 +103,30 @@ export function RecordTable<T extends Record>(props: RecordTableProps<T>) {
|
|
|
95
103
|
|
|
96
104
|
function getDefaultRenderer(column: Column<any, any>): CustomRenderer<T, any> {
|
|
97
105
|
return (value: any) => {
|
|
106
|
+
console.log(
|
|
107
|
+
column.constructor?.name,
|
|
108
|
+
isInstanceOf(column, ReferenceColumn),
|
|
109
|
+
isInstanceOf(column, ReferenceArrayColumn),
|
|
110
|
+
isInstanceOf(column, ObjectColumn),
|
|
111
|
+
isInstanceOf(column, StringColumn)
|
|
112
|
+
);
|
|
113
|
+
if (isInstanceOf(column, ReferenceColumn)) {
|
|
114
|
+
return value?._id || '';
|
|
115
|
+
}
|
|
116
|
+
if (isInstanceOf(column, ReferenceArrayColumn)) {
|
|
117
|
+
return value?._ids?.join(', ') || '';
|
|
118
|
+
}
|
|
119
|
+
if (value && typeof value === 'object') {
|
|
120
|
+
if ('_id' in value && typeof value._id === 'string') {
|
|
121
|
+
return value._id;
|
|
122
|
+
}
|
|
123
|
+
if ('_ids' in value && Array.isArray(value._ids)) {
|
|
124
|
+
return value._ids.join(', ');
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (isInstanceOf(column, ObjectColumn) || isInstanceOf(column, ArrayColumn)) {
|
|
128
|
+
return JSON.stringify(value);
|
|
129
|
+
}
|
|
98
130
|
if (
|
|
99
131
|
isInstanceOf(column, IntegerColumn) ||
|
|
100
132
|
isInstanceOf(column, FloatColumn) ||
|
|
@@ -103,7 +135,7 @@ export function RecordTable<T extends Record>(props: RecordTableProps<T>) {
|
|
|
103
135
|
return value != null ? value.toString() : '';
|
|
104
136
|
}
|
|
105
137
|
if (isInstanceOf(column, StringColumn)) {
|
|
106
|
-
return value
|
|
138
|
+
return value != null ? String(value) : '';
|
|
107
139
|
}
|
|
108
140
|
if (isInstanceOf(column, BooleanColumn)) {
|
|
109
141
|
return value ? '✅' : '❌';
|
|
@@ -114,9 +146,6 @@ export function RecordTable<T extends Record>(props: RecordTableProps<T>) {
|
|
|
114
146
|
if (isInstanceOf(column, DateTimeColumn)) {
|
|
115
147
|
return value ? moment(value).format('YYYY-MM-DD HH:mm:ss') : '';
|
|
116
148
|
}
|
|
117
|
-
if (isInstanceOf(column, ObjectColumn) || isInstanceOf(column, ArrayColumn)) {
|
|
118
|
-
return JSON.stringify(value);
|
|
119
|
-
}
|
|
120
149
|
return value != null ? value.toString() : '';
|
|
121
150
|
};
|
|
122
151
|
}
|