@proteinjs/db-ui 1.0.33 → 1.1.0
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 +16 -0
- package/LICENSE +21 -0
- package/dist/generated/index.js +1 -1
- package/dist/generated/index.js.map +1 -1
- package/dist/src/pages/RecordFormPage.d.ts.map +1 -1
- package/dist/src/pages/RecordFormPage.js +6 -0
- package/dist/src/pages/RecordFormPage.js.map +1 -1
- package/dist/src/pages/RecordTablePage.d.ts.map +1 -1
- package/dist/src/pages/RecordTablePage.js +10 -3
- package/dist/src/pages/RecordTablePage.js.map +1 -1
- package/dist/src/pages/TablesPage.d.ts.map +1 -1
- package/dist/src/pages/TablesPage.js +14 -5
- package/dist/src/pages/TablesPage.js.map +1 -1
- package/dist/src/pages/UuidGeneratorPage.d.ts.map +1 -1
- package/dist/src/pages/UuidGeneratorPage.js +6 -0
- package/dist/src/pages/UuidGeneratorPage.js.map +1 -1
- package/dist/src/table/QueryTableLoader.d.ts +9 -1
- package/dist/src/table/QueryTableLoader.d.ts.map +1 -1
- package/dist/src/table/QueryTableLoader.js +24 -6
- package/dist/src/table/QueryTableLoader.js.map +1 -1
- package/dist/src/table/RecordTable.d.ts +6 -0
- package/dist/src/table/RecordTable.d.ts.map +1 -1
- package/dist/src/table/RecordTable.js +65 -6
- package/dist/src/table/RecordTable.js.map +1 -1
- package/generated/index.ts +10 -13
- package/package.json +6 -5
- package/src/pages/RecordFormPage.tsx +7 -0
- package/src/pages/RecordTablePage.tsx +13 -4
- package/src/pages/TablesPage.tsx +19 -8
- package/src/pages/UuidGeneratorPage.tsx +7 -0
- package/src/table/QueryTableLoader.ts +32 -8
- package/src/table/RecordTable.tsx +85 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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.1.0](https://github.com/proteinjs/db/compare/@proteinjs/db-ui@1.0.33...@proteinjs/db-ui@1.1.0) (2024-07-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* updating package version for ui ([f670078](https://github.com/proteinjs/db/commit/f670078a684038c9880dcf9a41a65d4eea540b3a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* utilize react query and add infinite scroll to table ([#6](https://github.com/proteinjs/db/issues/6)) ([7244a68](https://github.com/proteinjs/db/commit/7244a68fbce5ca1270321c6c63366ea4f3d97b63))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [1.0.32](https://github.com/proteinjs/db/compare/@proteinjs/db-ui@1.0.31...@proteinjs/db-ui@1.0.32) (2024-06-27)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @proteinjs/db-ui
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Brent Bahry
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
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/veronica/Repositories/n3xa-meta-repo/packages/proteinjs/packages/db/packages/ui/src/table/QueryTableLoader.ts\",\"qualifiedName\":\"@proteinjs/db-ui/QueryTableLoader\",\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\",\"properties\":[{\"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\"}],\"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}}]}],\"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/veronica/Repositories/n3xa-meta-repo/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/recordFormPage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"recordFormPage\",\"filePath\":\"/Users/veronica/Repositories/n3xa-meta-repo/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/ui/Page\"},{\"v\":\"@proteinjs/db-ui/recordTablePage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"recordTablePage\",\"filePath\":\"/Users/veronica/Repositories/n3xa-meta-repo/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/veronica/Repositories/n3xa-meta-repo/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/veronica/Repositories/n3xa-meta-repo/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/veronica/Repositories/n3xa-meta-repo/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/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\":\"/home/runner/work/db/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\"}],\"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\":\"/home/runner/work/db/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/recordFormPage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"recordFormPage\",\"filePath\":\"/home/runner/work/db/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/ui/Page\"},{\"v\":\"@proteinjs/db-ui/recordTablePage\",\"value\":{\"packageName\":\"@proteinjs/db-ui\",\"name\":\"recordTablePage\",\"filePath\":\"/home/runner/work/db/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\":\"/home/runner/work/db/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\":\"/home/runner/work/db/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\":\"/home/runner/work/db/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/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,q2TAAq2T,CAAC;AAG13T,4BAA4B;AAE5B,kEAAiE;AACjE,+EAA8E;AAC9E,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,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":"RecordFormPage.d.ts","sourceRoot":"","sources":["../../../src/pages/RecordFormPage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,IAAI,EAAsB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"RecordFormPage.d.ts","sourceRoot":"","sources":["../../../src/pages/RecordFormPage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,IAAI,EAAsB,MAAM,eAAe,CAAC;AAKnE,eAAO,MAAM,cAAc,EAAE,IAiB5B,CAAC;AAEF,eAAO,MAAM,cAAc,cAAe,MAAM,YAAY,MAAM,WAEjE,CAAC;AAEF,eAAO,MAAM,iBAAiB,cAAe,MAAM,WAElD,CAAC"}
|
|
@@ -72,6 +72,12 @@ exports.recordFormPage = {
|
|
|
72
72
|
auth: {
|
|
73
73
|
allUsers: true,
|
|
74
74
|
},
|
|
75
|
+
pageContainerSxProps: function (theme) {
|
|
76
|
+
return {
|
|
77
|
+
height: '100vh',
|
|
78
|
+
backgroundColor: theme.palette.background.default,
|
|
79
|
+
};
|
|
80
|
+
},
|
|
75
81
|
component: function (_a) {
|
|
76
82
|
var props = __rest(_a, []);
|
|
77
83
|
return (react_1.default.createElement(ui_1.FormPage, null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordFormPage.js","sourceRoot":"","sources":["../../../src/pages/RecordFormPage.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,oCAAmE;AACnE,oCAA0D;AAC1D,iDAAgD;
|
|
1
|
+
{"version":3,"file":"RecordFormPage.js","sourceRoot":"","sources":["../../../src/pages/RecordFormPage.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,oCAAmE;AACnE,oCAA0D;AAC1D,iDAAgD;AAGnC,QAAA,cAAc,GAAS;IAClC,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE;QACJ,QAAQ,EAAE,IAAI;KACf;IACD,oBAAoB,EAAE,UAAC,KAAY;QACjC,OAAO;YACL,MAAM,EAAE,OAAO;YACf,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO;SAClD,CAAC;IACJ,CAAC;IACD,SAAS,EAAE,UAAC,EAAY;YAAP,KAAK,cAAV,EAAY,CAAF;QA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IAAI,KAAK,CAAC;QACV,IAAI,SAAS,EAAE;YACb,IAAI;gBACF,KAAK,GAAG,IAAA,gBAAW,EAAC,SAAS,CAAC,CAAC;aAChC;YAAC,OAAO,KAAK,EAAE;gBACd,wCAAwC;gBACxC,KAAK,GAAG,sCAA+B,SAAS,CAAE,CAAC;aACpD;SACF;aAAM;YACL,KAAK,GAAG,mDAAmD,CAAC;SAC7D;QAED,OAAO,EAAE,KAAK,OAAA,EAAE,KAAK,OAAA,EAAE,CAAC;IAC1B,CAAC;IAED,SAAS,IAAI;QACL,IAAA,KAAmB,QAAQ,EAAE,EAA3B,KAAK,WAAA,EAAE,KAAK,WAAe,CAAC;QACpC,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,2CAAM,KAAK,CAAO,CAAC;SAC3B;QAED,OAAO,8BAAC,uBAAU,IAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAI,CAAC;IACtD,CAAC;IAED,OAAO,8BAAC,IAAI,OAAG,CAAC;AAClB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordTablePage.d.ts","sourceRoot":"","sources":["../../../src/pages/RecordTablePage.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"RecordTablePage.d.ts","sourceRoot":"","sources":["../../../src/pages/RecordTablePage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAsB,MAAM,eAAe,CAAC;AACzD,OAAO,EAAe,KAAK,EAAE,MAAM,eAAe,CAAC;AAInD,eAAO,MAAM,eAAe,EAAE,IAmB7B,CAAC;AAEF,eAAO,MAAM,eAAe,UAAW,MAAM,GAAG,CAAC,WAEhD,CAAC;AAEF,eAAO,MAAM,qBAAqB,cAAe,MAAM,WAEtD,CAAC"}
|
|
@@ -27,19 +27,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
28
|
exports.recordTableLinkByName = exports.recordTableLink = exports.recordTablePage = void 0;
|
|
29
29
|
var react_1 = __importDefault(require("react"));
|
|
30
|
-
var ui_1 = require("@proteinjs/ui");
|
|
31
30
|
var db_1 = require("@proteinjs/db");
|
|
32
31
|
var RecordTable_1 = require("../table/RecordTable");
|
|
32
|
+
var material_1 = require("@mui/material");
|
|
33
33
|
exports.recordTablePage = {
|
|
34
34
|
name: 'Record Table',
|
|
35
35
|
path: 'record/table',
|
|
36
36
|
auth: {
|
|
37
37
|
allUsers: true,
|
|
38
38
|
},
|
|
39
|
+
pageContainerSxProps: function (theme) {
|
|
40
|
+
return {
|
|
41
|
+
height: '100vh',
|
|
42
|
+
backgroundColor: theme.palette.background.default,
|
|
43
|
+
};
|
|
44
|
+
},
|
|
39
45
|
component: function (_a) {
|
|
40
46
|
var props = __rest(_a, []);
|
|
41
|
-
return (react_1.default.createElement(
|
|
42
|
-
react_1.default.createElement(
|
|
47
|
+
return (react_1.default.createElement(material_1.Box, { sx: { display: 'flex', flexGrow: 1, justifyContent: 'center', padding: 4 } },
|
|
48
|
+
react_1.default.createElement(material_1.Paper, { sx: { maxHeight: '80vh' } },
|
|
49
|
+
react_1.default.createElement(DynamicRecordTable, __assign({}, props)))));
|
|
43
50
|
},
|
|
44
51
|
};
|
|
45
52
|
var recordTableLink = function (table) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordTablePage.js","sourceRoot":"","sources":["../../../src/pages/RecordTablePage.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;
|
|
1
|
+
{"version":3,"file":"RecordTablePage.js","sourceRoot":"","sources":["../../../src/pages/RecordTablePage.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAE1B,oCAAmD;AACnD,oDAAmD;AACnD,0CAA2D;AAE9C,QAAA,eAAe,GAAS;IACnC,IAAI,EAAE,cAAc;IACpB,IAAI,E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SACF;aAAM;YACL,YAAY,GAAG,6CAA6C,CAAC;SAC9D;QAED,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,2CAAM,YAAY,CAAO,CAAC;SAClC;QAED,OAAO,8BAAC,yBAAW,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC;IACvC,CAAC;IAED,OAAO,8BAAC,KAAK,OAAG,CAAC;AACnB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TablesPage.d.ts","sourceRoot":"","sources":["../../../src/pages/TablesPage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,IAAI,EAAmD,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"TablesPage.d.ts","sourceRoot":"","sources":["../../../src/pages/TablesPage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,IAAI,EAAmD,MAAM,eAAe,CAAC;AAKhG,eAAO,MAAM,UAAU,EAAE,IAcxB,CAAC"}
|
|
@@ -44,9 +44,16 @@ var react_1 = __importDefault(require("react"));
|
|
|
44
44
|
var ui_1 = require("@proteinjs/ui");
|
|
45
45
|
var db_1 = require("@proteinjs/db");
|
|
46
46
|
var RecordTablePage_1 = require("./RecordTablePage");
|
|
47
|
+
var material_1 = require("@mui/material");
|
|
47
48
|
exports.tablesPage = {
|
|
48
49
|
name: 'Tables',
|
|
49
50
|
path: 'tables',
|
|
51
|
+
pageContainerSxProps: function (theme) {
|
|
52
|
+
return {
|
|
53
|
+
height: '100vh',
|
|
54
|
+
backgroundColor: theme.palette.background.default,
|
|
55
|
+
};
|
|
56
|
+
},
|
|
50
57
|
component: function () { return (react_1.default.createElement(ui_1.FormPage, null,
|
|
51
58
|
react_1.default.createElement(Tables, null))); },
|
|
52
59
|
};
|
|
@@ -84,10 +91,12 @@ var TableSummaryLoader = /** @class */ (function () {
|
|
|
84
91
|
return TableSummaryLoader;
|
|
85
92
|
}());
|
|
86
93
|
var Tables = function () {
|
|
87
|
-
return (react_1.default.createElement(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
return (react_1.default.createElement(material_1.Box, { sx: { display: 'flex', flexGrow: 1 } },
|
|
95
|
+
react_1.default.createElement(material_1.Box, { maxHeight: '80vh' },
|
|
96
|
+
react_1.default.createElement(ui_1.Table, { title: 'Tables', columns: ['name', 'rowCount'], tableLoader: new TableSummaryLoader((0, db_1.getTables)()), rowOnClickRedirectUrl: function (row) { return __awaiter(void 0, void 0, void 0, function () {
|
|
97
|
+
return __generator(this, function (_a) {
|
|
98
|
+
return [2 /*return*/, (0, RecordTablePage_1.recordTableLinkByName)(row.name)];
|
|
99
|
+
});
|
|
100
|
+
}); } }))));
|
|
92
101
|
};
|
|
93
102
|
//# sourceMappingURL=TablesPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TablesPage.js","sourceRoot":"","sources":["../../../src/pages/TablesPage.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,oCAAgG;AAChG,oCAA+D;AAC/D,qDAA0D;AAE7C,QAAA,UAAU,GAAS;IAC9B,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,cAAM,OAAA,CACf,8BAAC,aAAQ;QACP,8BAAC,MAAM,OAAG,CACD,CACZ,EAJgB,CAIhB;CACF,CAAC;AAOF;IACE,4BAAoB,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IAAG,CAAC;IAEtC,iCAAI,GAAV,UAAW,UAAkB,EAAE,QAAgB;;;;;;wBACvC,IAAI,GAA4B,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;wBAC7E,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;wBACjD,SAAS,GAAG,IAAA,iBAAY,GAA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EAAY,IAAI,EAAwC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"UuidGeneratorPage.d.ts","sourceRoot":"","sources":["../../../src/pages/UuidGeneratorPage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,IAAI,EAAwC,MAAM,eAAe,CAAC;AAIrF,eAAO,MAAM,iBAAiB,EAAE,IAmB/B,CAAC"}
|
|
@@ -61,6 +61,12 @@ var uuid_1 = require("uuid");
|
|
|
61
61
|
exports.uuidGeneratorPage = {
|
|
62
62
|
name: 'Uuid Generator',
|
|
63
63
|
path: 'uuid-generator',
|
|
64
|
+
pageContainerSxProps: function (theme) {
|
|
65
|
+
return {
|
|
66
|
+
height: '100vh',
|
|
67
|
+
backgroundColor: theme.palette.background.default,
|
|
68
|
+
};
|
|
69
|
+
},
|
|
64
70
|
component: function () { return (react_1.default.createElement(ui_1.FormPage, null,
|
|
65
71
|
react_1.default.createElement(ui_1.Form, { name: 'Uuid Generator', createFields: function () { return new UuidFields(); }, fieldLayout: ['uuid'], buttons: buttons }))); },
|
|
66
72
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UuidGeneratorPage.js","sourceRoot":"","sources":["../../../src/pages/UuidGeneratorPage.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,oCAAqF;AACrF,6BAAoC;
|
|
1
|
+
{"version":3,"file":"UuidGeneratorPage.js","sourceRoot":"","sources":["../../../src/pages/UuidGeneratorPage.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,oCAAqF;AACrF,6BAAoC;AAGvB,QAAA,iBAAiB,GAAS;IACrC,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE,gBAAgB;IACtB,oBAAoB,EAAE,UAAC,KAAY;QACjC,OAAO;YACL,MAAM,EAAE,OAAO;YACf,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO;SAClD,CAAC;IACJ,CAAC;IACD,SAAS,EAAE,cAAM,OAAA,CACf,8BAAC,aAAQ;QACP,8BAAC,SAAI,IACH,IAAI,EAAC,gBAAgB,EACrB,YAAY,EAAE,cAAM,OAAA,IAAI,UAAU,EAAE,EAAhB,CAAgB,EACpC,WAAW,EAAE,CAAC,MAAM,CAAC,EACrB,OAAO,EAAE,OAAO,GAChB,CACO,CACZ,EATgB,CAShB;CACF,CAAC;AAEF;IAAyB,8BAAM;IAA/B;QAAA,qEAIC;QAHC,UAAI,GAAG,IAAA,cAAS,EAAa;YAC3B,IAAI,EAAE,MAAM;SACb,CAAC,CAAC;;IACL,CAAC;IAAD,iBAAC;AAAD,CAAC,AAJD,CAAyB,WAAM,GAI9B;AAED,IAAM,OAAO,GAA4B;IACvC,QAAQ,EAAE;QACR,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE;YACL,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,WAAW;SACrB;QACD,OAAO,EAAE,UAAO,MAAkB,EAAE,OAAgC;;gBAClE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAA,SAAM,GAAE,CAAC;;;aACpC;KACF;CACF,CAAC"}
|
|
@@ -4,7 +4,15 @@ export declare class QueryTableLoader<T extends Record> implements TableLoader<T
|
|
|
4
4
|
private table;
|
|
5
5
|
private query?;
|
|
6
6
|
private sort?;
|
|
7
|
+
private rowCountQb?;
|
|
8
|
+
private paginationQb?;
|
|
9
|
+
reactQueryKeys: TableLoader<T>['reactQueryKeys'];
|
|
10
|
+
/**
|
|
11
|
+
* @param table the table to load rows from
|
|
12
|
+
* @param query the query to apply to the table
|
|
13
|
+
* @param sort the sort constraints to apply to the query
|
|
14
|
+
*/
|
|
7
15
|
constructor(table: Table<T>, query?: Query<T> | undefined, sort?: SortCriteria<T>[] | undefined);
|
|
8
|
-
load(startIndex: number, endIndex: number): Promise<RowWindow<T>>;
|
|
16
|
+
load(startIndex: number, endIndex: number, skipRowCount?: boolean): Promise<RowWindow<T>>;
|
|
9
17
|
}
|
|
10
18
|
//# sourceMappingURL=QueryTableLoader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryTableLoader.d.ts","sourceRoot":"","sources":["../../../src/table/QueryTableLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"QueryTableLoader.d.ts","sourceRoot":"","sources":["../../../src/table/QueryTableLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAS,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGvD,qBAAa,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAE,YAAW,WAAW,CAAC,CAAC,CAAC;IAWrE,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,KAAK,CAAC;IACd,OAAO,CAAC,IAAI,CAAC;IAZf,OAAO,CAAC,UAAU,CAAC,CAAkB;IACrC,OAAO,CAAC,YAAY,CAAC,CAAkB;IACvC,cAAc,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;IAEjD;;;;OAIG;gBAEO,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EACf,KAAK,CAAC,sBAAU,EAChB,IAAI,CAAC,+BAAmB;IAW5B,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,GAAE,OAAe,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CAmBvG"}
|
|
@@ -39,28 +39,46 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.QueryTableLoader = void 0;
|
|
40
40
|
var db_1 = require("@proteinjs/db");
|
|
41
41
|
var QueryTableLoader = /** @class */ (function () {
|
|
42
|
+
/**
|
|
43
|
+
* @param table the table to load rows from
|
|
44
|
+
* @param query the query to apply to the table
|
|
45
|
+
* @param sort the sort constraints to apply to the query
|
|
46
|
+
*/
|
|
42
47
|
function QueryTableLoader(table, query, sort) {
|
|
43
48
|
this.table = table;
|
|
44
49
|
this.query = query;
|
|
45
50
|
this.sort = sort;
|
|
51
|
+
// Store separate copies of the query for row count and pagination
|
|
52
|
+
this.rowCountQb = new db_1.QueryBuilderFactory().createQueryBuilder(this.table, this.query);
|
|
53
|
+
this.paginationQb = new db_1.QueryBuilderFactory().createQueryBuilder(this.table, this.query);
|
|
54
|
+
this.reactQueryKeys = {
|
|
55
|
+
dataKey: this.table.name,
|
|
56
|
+
dataQueryKey: JSON.stringify(this.query),
|
|
57
|
+
};
|
|
46
58
|
}
|
|
47
|
-
QueryTableLoader.prototype.load = function (startIndex, endIndex) {
|
|
59
|
+
QueryTableLoader.prototype.load = function (startIndex, endIndex, skipRowCount) {
|
|
60
|
+
if (skipRowCount === void 0) { skipRowCount = false; }
|
|
48
61
|
return __awaiter(this, void 0, void 0, function () {
|
|
49
|
-
var db, sort, qb, queryPromise,
|
|
62
|
+
var db, sort, qb, queryPromise, rows, rowCountPromise, _a, rows, totalCount;
|
|
50
63
|
return __generator(this, function (_b) {
|
|
51
64
|
switch (_b.label) {
|
|
52
65
|
case 0:
|
|
53
66
|
db = (0, db_1.getDb)();
|
|
54
67
|
sort = this.sort ? this.sort : [{ field: 'created', desc: true }];
|
|
55
68
|
qb = new db_1.QueryBuilderFactory()
|
|
56
|
-
.
|
|
69
|
+
.createQueryBuilder(this.table, this.paginationQb)
|
|
57
70
|
.sort(sort)
|
|
58
71
|
.paginate({ start: startIndex, end: endIndex });
|
|
59
72
|
queryPromise = db.query(this.table, qb);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return [4 /*yield*/, Promise.all([queryPromise, rowCountPromise])];
|
|
73
|
+
if (!skipRowCount) return [3 /*break*/, 2];
|
|
74
|
+
return [4 /*yield*/, queryPromise];
|
|
63
75
|
case 1:
|
|
76
|
+
rows = _b.sent();
|
|
77
|
+
return [2 /*return*/, { rows: rows, totalCount: 0 }];
|
|
78
|
+
case 2:
|
|
79
|
+
rowCountPromise = db.getRowCount(this.table, this.rowCountQb);
|
|
80
|
+
return [4 /*yield*/, Promise.all([queryPromise, rowCountPromise])];
|
|
81
|
+
case 3:
|
|
64
82
|
_a = _b.sent(), rows = _a[0], totalCount = _a[1];
|
|
65
83
|
return [2 /*return*/, { rows: rows, totalCount: totalCount }];
|
|
66
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryTableLoader.js","sourceRoot":"","sources":["../../../src/table/QueryTableLoader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"QueryTableLoader.js","sourceRoot":"","sources":["../../../src/table/QueryTableLoader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAA6G;AAI7G;IAKE;;;;OAIG;IACH,0BACU,KAAe,EACf,KAAgB,EAChB,IAAwB;QAFxB,UAAK,GAAL,KAAK,CAAU;QACf,UAAK,GAAL,KAAK,CAAW;QAChB,SAAI,GAAJ,IAAI,CAAoB;QAEhC,kEAAkE;QAClE,IAAI,CAAC,UAAU,GAAG,IAAI,wBAAmB,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACvF,IAAI,CAAC,YAAY,GAAG,IAAI,wBAAmB,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACzF,IAAI,CAAC,cAAc,GAAG;YACpB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;YACxB,YAAY,EAAE,IAAI,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type RecordTableProps<T extends Record> = {
|
|
|
7
7
|
title?: TableProps<T>['title'];
|
|
8
8
|
description?: TableProps<T>['description'];
|
|
9
9
|
columns?: TableProps<T>['columns'];
|
|
10
|
+
columnConfig?: TableProps<T>['columnConfig'];
|
|
11
|
+
pagination?: TableProps<T>['pagination'];
|
|
10
12
|
defaultRowsPerPage?: TableProps<T>['defaultRowsPerPage'];
|
|
11
13
|
buttons?: TableProps<T>['buttons'];
|
|
14
|
+
hideButtons?: boolean;
|
|
12
15
|
rowOnClickRedirectUrl?: TableProps<T>['rowOnClickRedirectUrl'];
|
|
16
|
+
toolbarSx?: TableProps<T>['toolbarSx'];
|
|
17
|
+
toolbarContent?: TableProps<T>['toolbarContent'];
|
|
18
|
+
tableContainerSx?: TableProps<T>['tableContainerSx'];
|
|
13
19
|
};
|
|
14
20
|
export declare function RecordTable<T extends Record>(props: RecordTableProps<T>): React.JSX.Element;
|
|
15
21
|
//# sourceMappingURL=RecordTable.d.ts.map
|
|
@@ -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,
|
|
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,EAA+B,MAAM,EAAE,KAAK,EAAS,MAAM,eAAe,CAAC;AAkBlF,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,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAC/B,WAAW,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACnC,YAAY,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;IAC7C,UAAU,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IACzC,kBAAkB,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC;IACzD,OAAO,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qBAAqB,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC;IAC/D,SAAS,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IACvC,cAAc,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;IACjD,gBAAgB,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC;CACtD,CAAC;AAkCF,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,qBAwHvE"}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
14
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
15
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -48,6 +59,9 @@ var db_1 = require("@proteinjs/db");
|
|
|
48
59
|
var QueryTableLoader_1 = require("./QueryTableLoader");
|
|
49
60
|
var RecordFormPage_1 = require("../pages/RecordFormPage");
|
|
50
61
|
var RecordTablePage_1 = require("../pages/RecordTablePage");
|
|
62
|
+
var util_1 = require("@proteinjs/util");
|
|
63
|
+
var db_2 = require("@proteinjs/db");
|
|
64
|
+
var moment_1 = __importDefault(require("moment"));
|
|
51
65
|
function deleteButton(table) {
|
|
52
66
|
var _this = this;
|
|
53
67
|
return {
|
|
@@ -117,6 +131,51 @@ function RecordTable(props) {
|
|
|
117
131
|
columnProperties.push('updated');
|
|
118
132
|
return columnProperties;
|
|
119
133
|
}
|
|
134
|
+
function getDefaultRenderer(column) {
|
|
135
|
+
return function (value) {
|
|
136
|
+
if ((0, util_1.isInstanceOf)(column, db_2.IntegerColumn) ||
|
|
137
|
+
(0, util_1.isInstanceOf)(column, db_2.FloatColumn) ||
|
|
138
|
+
(0, util_1.isInstanceOf)(column, db_2.DecimalColumn)) {
|
|
139
|
+
return value != null ? value.toString() : '';
|
|
140
|
+
}
|
|
141
|
+
if ((0, util_1.isInstanceOf)(column, db_2.StringColumn)) {
|
|
142
|
+
return value || '';
|
|
143
|
+
}
|
|
144
|
+
if ((0, util_1.isInstanceOf)(column, db_2.BooleanColumn)) {
|
|
145
|
+
return value ? '✅' : '❌';
|
|
146
|
+
}
|
|
147
|
+
if ((0, util_1.isInstanceOf)(column, db_2.DateColumn)) {
|
|
148
|
+
return value ? (0, moment_1.default)(value).format('YYYY-MM-DD') : '';
|
|
149
|
+
}
|
|
150
|
+
if ((0, util_1.isInstanceOf)(column, db_2.DateTimeColumn)) {
|
|
151
|
+
return value ? (0, moment_1.default)(value).format('YYYY-MM-DD HH:mm:ss') : '';
|
|
152
|
+
}
|
|
153
|
+
if ((0, util_1.isInstanceOf)(column, db_2.ObjectColumn) || (0, util_1.isInstanceOf)(column, db_2.ArrayColumn)) {
|
|
154
|
+
return JSON.stringify(value);
|
|
155
|
+
}
|
|
156
|
+
return value != null ? value.toString() : '';
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function mergeColumnConfigs() {
|
|
160
|
+
var defaultConfig = {};
|
|
161
|
+
var columns = props.columns || defaultColumns();
|
|
162
|
+
for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
|
|
163
|
+
var columnName = columns_1[_i];
|
|
164
|
+
var column = props.table.columns[columnName];
|
|
165
|
+
defaultConfig[columnName] = {
|
|
166
|
+
renderer: getDefaultRenderer(column),
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
// Merge with provided columnConfig, if any
|
|
170
|
+
if (props.columnConfig) {
|
|
171
|
+
for (var columnName in props.columnConfig) {
|
|
172
|
+
if (defaultConfig[columnName]) {
|
|
173
|
+
defaultConfig[columnName] = __assign(__assign({}, defaultConfig[columnName]), props.columnConfig[columnName]);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return defaultConfig;
|
|
178
|
+
}
|
|
120
179
|
function defaultTableLoader() {
|
|
121
180
|
return new QueryTableLoader_1.QueryTableLoader(props.table, undefined, [{ field: 'updated', desc: true }]);
|
|
122
181
|
}
|
|
@@ -128,15 +187,15 @@ function RecordTable(props) {
|
|
|
128
187
|
});
|
|
129
188
|
}
|
|
130
189
|
function buttons() {
|
|
131
|
-
|
|
190
|
+
if (props.hideButtons) {
|
|
191
|
+
return [];
|
|
192
|
+
}
|
|
132
193
|
if (props.buttons) {
|
|
133
|
-
|
|
194
|
+
return props.buttons;
|
|
134
195
|
}
|
|
135
|
-
|
|
136
|
-
buttons.push(createButton(props.table));
|
|
137
|
-
return buttons;
|
|
196
|
+
return [deleteButton(props.table), createButton(props.table)];
|
|
138
197
|
}
|
|
139
|
-
return (react_1.default.createElement(ui_1.Table, { title: props.title ? props.title : "".concat((0, string_1.default)(props.table.name).humanize().toString(), " Table"), description: props.description, columns: props.columns ? props.columns : defaultColumns(), tableLoader: props.tableLoader ? props.tableLoader : defaultTableLoader(), rowOnClickRedirectUrl: props.rowOnClickRedirectUrl ? props.rowOnClickRedirectUrl : defaultRowOnClickRedirectUrl, defaultRowsPerPage: props.defaultRowsPerPage, buttons: buttons() }));
|
|
198
|
+
return (react_1.default.createElement(ui_1.Table, { title: props.title ? props.title : "".concat((0, string_1.default)(props.table.name).humanize().toString(), " Table"), description: props.description, columns: props.columns ? props.columns : defaultColumns(), columnConfig: mergeColumnConfigs(), tableLoader: props.tableLoader ? props.tableLoader : defaultTableLoader(), rowOnClickRedirectUrl: props.rowOnClickRedirectUrl ? props.rowOnClickRedirectUrl : defaultRowOnClickRedirectUrl, pagination: props.pagination, defaultRowsPerPage: props.defaultRowsPerPage, buttons: buttons(), toolbarSx: props.toolbarSx, toolbarContent: props.toolbarContent, tableContainerSx: props.tableContainerSx }));
|
|
140
199
|
}
|
|
141
200
|
exports.RecordTable = RecordTable;
|
|
142
201
|
//# sourceMappingURL=RecordTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordTable.js","sourceRoot":"","sources":["../../../src/table/RecordTable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RecordTable.js","sourceRoot":"","sources":["../../../src/table/RecordTable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,sDAAkD;AAClD,kDAAuB;AACvB,oCAA8G;AAC9G,oCAAkF;AAClF,uDAAsD;AACtD,0DAA4E;AAC5E,4DAA2D;AAC3D,wCAA+C;AAC/C,oCAUuB;AACvB,kDAA4B;AAmB5B,S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,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,EAAE,EACzD,YAAY,EAAE,kBAAkB,EAAE,EAClC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,kBAAkB,EAAE,EACzE,qBAAqB,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,4BAA4B,EAC/G,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAC5C,OAAO,EAAE,OAAO,EAAE,EAClB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,GACxC,CACH,CAAC;AACJ,CAAC;AAxHD,kCAwHC"}
|
package/generated/index.ts
CHANGED
|
@@ -13,11 +13,10 @@ import 'react';
|
|
|
13
13
|
import 'string';
|
|
14
14
|
import 'uuid';
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
/** Generate Source Graph */
|
|
18
17
|
|
|
19
|
-
const sourceGraph =
|
|
20
|
-
|
|
18
|
+
const sourceGraph =
|
|
19
|
+
'{"options":{"directed":true,"multigraph":false,"compound":false},"nodes":[{"v":"@proteinjs/db-ui/QueryTableLoader","value":{"packageName":"@proteinjs/db-ui","name":"QueryTableLoader","filePath":"/home/runner/work/db/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"}],"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":"/home/runner/work/db/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/recordFormPage","value":{"packageName":"@proteinjs/db-ui","name":"recordFormPage","filePath":"/home/runner/work/db/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/ui/Page"},{"v":"@proteinjs/db-ui/recordTablePage","value":{"packageName":"@proteinjs/db-ui","name":"recordTablePage","filePath":"/home/runner/work/db/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":"/home/runner/work/db/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":"/home/runner/work/db/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":"/home/runner/work/db/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/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"}]}';
|
|
21
20
|
|
|
22
21
|
/** Generate Source Links */
|
|
23
22
|
|
|
@@ -30,20 +29,18 @@ import { uuidGeneratorPage } from '../src/pages/UuidGeneratorPage';
|
|
|
30
29
|
import { MigrationRecordFormCustomization } from '../src/form/customizations/MigrationRecordFormCustomization';
|
|
31
30
|
|
|
32
31
|
const sourceLinks = {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
'@proteinjs/db-ui/QueryTableLoader': QueryTableLoader,
|
|
33
|
+
'@proteinjs/db-ui/RecordFormCustomization': RecordFormCustomization,
|
|
34
|
+
'@proteinjs/db-ui/recordFormPage': recordFormPage,
|
|
35
|
+
'@proteinjs/db-ui/recordTablePage': recordTablePage,
|
|
36
|
+
'@proteinjs/db-ui/tablesPage': tablesPage,
|
|
37
|
+
'@proteinjs/db-ui/uuidGeneratorPage': uuidGeneratorPage,
|
|
38
|
+
'@proteinjs/db-ui/MigrationRecordFormCustomization': MigrationRecordFormCustomization,
|
|
40
39
|
};
|
|
41
40
|
|
|
42
|
-
|
|
43
41
|
/** Load Source Graph and Links */
|
|
44
42
|
|
|
45
43
|
import { SourceRepository } from '@proteinjs/reflection';
|
|
46
44
|
SourceRepository.merge(sourceGraph, sourceLinks);
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
export * from '../index';
|
|
46
|
+
export * from '../index';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proteinjs/db-ui",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Db ui components",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -25,9 +25,9 @@
|
|
|
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.
|
|
28
|
+
"@proteinjs/db": "^1.2.0",
|
|
29
29
|
"@proteinjs/reflection": "1.1.6",
|
|
30
|
-
"@proteinjs/ui": "2.0
|
|
30
|
+
"@proteinjs/ui": "2.1.0",
|
|
31
31
|
"@proteinjs/util": "1.2.0",
|
|
32
32
|
"moment": "2.29.4",
|
|
33
33
|
"react": "18.2.0",
|
|
@@ -51,5 +51,6 @@
|
|
|
51
51
|
"typescript": "5.2.2"
|
|
52
52
|
},
|
|
53
53
|
"main": "./dist/generated/index.js",
|
|
54
|
-
"types": "./dist/generated/index.d.ts"
|
|
55
|
-
|
|
54
|
+
"types": "./dist/generated/index.d.ts",
|
|
55
|
+
"gitHead": "2474491239d73e8a5fe032f2e7b68c704700e482"
|
|
56
|
+
}
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { FormPage, Page, PageComponentProps } from '@proteinjs/ui';
|
|
3
3
|
import { getDbService, tableByName } from '@proteinjs/db';
|
|
4
4
|
import { RecordForm } from '../form/RecordForm';
|
|
5
|
+
import { Theme, SxProps } from '@mui/material';
|
|
5
6
|
|
|
6
7
|
export const recordFormPage: Page = {
|
|
7
8
|
name: 'Record Form',
|
|
@@ -9,6 +10,12 @@ export const recordFormPage: Page = {
|
|
|
9
10
|
auth: {
|
|
10
11
|
allUsers: true,
|
|
11
12
|
},
|
|
13
|
+
pageContainerSxProps: (theme: Theme): SxProps => {
|
|
14
|
+
return {
|
|
15
|
+
height: '100vh',
|
|
16
|
+
backgroundColor: theme.palette.background.default,
|
|
17
|
+
};
|
|
18
|
+
},
|
|
12
19
|
component: ({ ...props }) => (
|
|
13
20
|
<FormPage>
|
|
14
21
|
<DynamicRecordForm {...props} />
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Page, PageComponentProps } from '@proteinjs/ui';
|
|
3
3
|
import { tableByName, Table } from '@proteinjs/db';
|
|
4
4
|
import { RecordTable } from '../table/RecordTable';
|
|
5
|
+
import { Box, Paper, SxProps, Theme } from '@mui/material';
|
|
5
6
|
|
|
6
7
|
export const recordTablePage: Page = {
|
|
7
8
|
name: 'Record Table',
|
|
@@ -9,10 +10,18 @@ export const recordTablePage: Page = {
|
|
|
9
10
|
auth: {
|
|
10
11
|
allUsers: true,
|
|
11
12
|
},
|
|
13
|
+
pageContainerSxProps: (theme: Theme): SxProps => {
|
|
14
|
+
return {
|
|
15
|
+
height: '100vh',
|
|
16
|
+
backgroundColor: theme.palette.background.default,
|
|
17
|
+
};
|
|
18
|
+
},
|
|
12
19
|
component: ({ ...props }) => (
|
|
13
|
-
<
|
|
14
|
-
<
|
|
15
|
-
|
|
20
|
+
<Box sx={{ display: 'flex', flexGrow: 1, justifyContent: 'center', padding: 4 }}>
|
|
21
|
+
<Paper sx={{ maxHeight: '80vh' }}>
|
|
22
|
+
<DynamicRecordTable {...props} />
|
|
23
|
+
</Paper>
|
|
24
|
+
</Box>
|
|
16
25
|
),
|
|
17
26
|
};
|
|
18
27
|
|
package/src/pages/TablesPage.tsx
CHANGED
|
@@ -2,10 +2,17 @@ import React from 'react';
|
|
|
2
2
|
import { FormPage, Page, TableLoader, Table as TableComponent, RowWindow } from '@proteinjs/ui';
|
|
3
3
|
import { getTables, getDbService, Table } from '@proteinjs/db';
|
|
4
4
|
import { recordTableLinkByName } from './RecordTablePage';
|
|
5
|
+
import { Box, Grid, SxProps, Theme } from '@mui/material';
|
|
5
6
|
|
|
6
7
|
export const tablesPage: Page = {
|
|
7
8
|
name: 'Tables',
|
|
8
9
|
path: 'tables',
|
|
10
|
+
pageContainerSxProps: (theme: Theme): SxProps => {
|
|
11
|
+
return {
|
|
12
|
+
height: '100vh',
|
|
13
|
+
backgroundColor: theme.palette.background.default,
|
|
14
|
+
};
|
|
15
|
+
},
|
|
9
16
|
component: () => (
|
|
10
17
|
<FormPage>
|
|
11
18
|
<Tables />
|
|
@@ -36,13 +43,17 @@ class TableSummaryLoader implements TableLoader<TableSummary> {
|
|
|
36
43
|
|
|
37
44
|
const Tables = () => {
|
|
38
45
|
return (
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
<Box sx={{ display: 'flex', flexGrow: 1 }}>
|
|
47
|
+
<Box maxHeight='80vh'>
|
|
48
|
+
<TableComponent
|
|
49
|
+
title='Tables'
|
|
50
|
+
columns={['name', 'rowCount']}
|
|
51
|
+
tableLoader={new TableSummaryLoader(getTables())}
|
|
52
|
+
rowOnClickRedirectUrl={async (row: TableSummary) => {
|
|
53
|
+
return recordTableLinkByName(row.name);
|
|
54
|
+
}}
|
|
55
|
+
/>
|
|
56
|
+
</Box>
|
|
57
|
+
</Box>
|
|
47
58
|
);
|
|
48
59
|
};
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FormPage, Page, Form, Fields, textField, FormButtons } from '@proteinjs/ui';
|
|
3
3
|
import { v1 as uuidv1 } from 'uuid';
|
|
4
|
+
import { SxProps, Theme } from '@mui/material';
|
|
4
5
|
|
|
5
6
|
export const uuidGeneratorPage: Page = {
|
|
6
7
|
name: 'Uuid Generator',
|
|
7
8
|
path: 'uuid-generator',
|
|
9
|
+
pageContainerSxProps: (theme: Theme): SxProps => {
|
|
10
|
+
return {
|
|
11
|
+
height: '100vh',
|
|
12
|
+
backgroundColor: theme.palette.background.default,
|
|
13
|
+
};
|
|
14
|
+
},
|
|
8
15
|
component: () => (
|
|
9
16
|
<FormPage>
|
|
10
17
|
<Form<UuidFields, typeof buttons>
|
|
@@ -1,24 +1,48 @@
|
|
|
1
|
-
import { Query, QueryBuilderFactory, Record, SortCriteria, Table, getDb } from '@proteinjs/db';
|
|
1
|
+
import { Query, QueryBuilder, QueryBuilderFactory, Record, SortCriteria, Table, getDb } from '@proteinjs/db';
|
|
2
2
|
import { RowWindow, TableLoader } from '@proteinjs/ui';
|
|
3
|
+
import { Logger } from '@proteinjs/util';
|
|
3
4
|
|
|
4
5
|
export class QueryTableLoader<T extends Record> implements TableLoader<T> {
|
|
6
|
+
private rowCountQb?: QueryBuilder<T>;
|
|
7
|
+
private paginationQb?: QueryBuilder<T>;
|
|
8
|
+
reactQueryKeys: TableLoader<T>['reactQueryKeys'];
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @param table the table to load rows from
|
|
12
|
+
* @param query the query to apply to the table
|
|
13
|
+
* @param sort the sort constraints to apply to the query
|
|
14
|
+
*/
|
|
5
15
|
constructor(
|
|
6
16
|
private table: Table<T>,
|
|
7
17
|
private query?: Query<T>,
|
|
8
18
|
private sort?: SortCriteria<T>[]
|
|
9
|
-
) {
|
|
19
|
+
) {
|
|
20
|
+
// Store separate copies of the query for row count and pagination
|
|
21
|
+
this.rowCountQb = new QueryBuilderFactory().createQueryBuilder(this.table, this.query);
|
|
22
|
+
this.paginationQb = new QueryBuilderFactory().createQueryBuilder(this.table, this.query);
|
|
23
|
+
this.reactQueryKeys = {
|
|
24
|
+
dataKey: this.table.name,
|
|
25
|
+
dataQueryKey: JSON.stringify(this.query),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
10
28
|
|
|
11
|
-
async load(startIndex: number, endIndex: number): Promise<RowWindow<T>> {
|
|
29
|
+
async load(startIndex: number, endIndex: number, skipRowCount: boolean = false): Promise<RowWindow<T>> {
|
|
12
30
|
const db = getDb();
|
|
13
31
|
const sort: any = this.sort ? this.sort : [{ field: 'created', desc: true }];
|
|
32
|
+
|
|
14
33
|
const qb = new QueryBuilderFactory()
|
|
15
|
-
.
|
|
34
|
+
.createQueryBuilder(this.table, this.paginationQb)
|
|
16
35
|
.sort(sort)
|
|
17
36
|
.paginate({ start: startIndex, end: endIndex });
|
|
18
37
|
const queryPromise = db.query(this.table, qb);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
38
|
+
|
|
39
|
+
if (skipRowCount) {
|
|
40
|
+
const rows = await queryPromise;
|
|
41
|
+
return { rows, totalCount: 0 };
|
|
42
|
+
} else {
|
|
43
|
+
const rowCountPromise = db.getRowCount(this.table, this.rowCountQb);
|
|
44
|
+
const [rows, totalCount] = await Promise.all([queryPromise, rowCountPromise]);
|
|
45
|
+
return { rows, totalCount };
|
|
46
|
+
}
|
|
23
47
|
}
|
|
24
48
|
}
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Delete, Add } from '@mui/icons-material';
|
|
3
3
|
import S from 'string';
|
|
4
|
-
import { TableButton, Table as TableComponent, TableLoader, TableProps } from '@proteinjs/ui';
|
|
4
|
+
import { CustomRenderer, TableButton, Table as TableComponent, TableLoader, TableProps } from '@proteinjs/ui';
|
|
5
5
|
import { Column, QueryBuilderFactory, Record, Table, getDb } from '@proteinjs/db';
|
|
6
6
|
import { QueryTableLoader } from './QueryTableLoader';
|
|
7
7
|
import { newRecordFormLink, recordFormLink } from '../pages/RecordFormPage';
|
|
8
8
|
import { recordTableLink } from '../pages/RecordTablePage';
|
|
9
|
+
import { isInstanceOf } from '@proteinjs/util';
|
|
10
|
+
import {
|
|
11
|
+
IntegerColumn,
|
|
12
|
+
StringColumn,
|
|
13
|
+
FloatColumn,
|
|
14
|
+
DecimalColumn,
|
|
15
|
+
BooleanColumn,
|
|
16
|
+
DateColumn,
|
|
17
|
+
DateTimeColumn,
|
|
18
|
+
ObjectColumn,
|
|
19
|
+
ArrayColumn,
|
|
20
|
+
} from '@proteinjs/db';
|
|
21
|
+
import moment from 'moment';
|
|
9
22
|
|
|
10
23
|
export type RecordTableProps<T extends Record> = {
|
|
11
24
|
table: Table<T>;
|
|
@@ -13,9 +26,15 @@ export type RecordTableProps<T extends Record> = {
|
|
|
13
26
|
title?: TableProps<T>['title'];
|
|
14
27
|
description?: TableProps<T>['description'];
|
|
15
28
|
columns?: TableProps<T>['columns'];
|
|
29
|
+
columnConfig?: TableProps<T>['columnConfig'];
|
|
30
|
+
pagination?: TableProps<T>['pagination'];
|
|
16
31
|
defaultRowsPerPage?: TableProps<T>['defaultRowsPerPage'];
|
|
17
32
|
buttons?: TableProps<T>['buttons'];
|
|
33
|
+
hideButtons?: boolean;
|
|
18
34
|
rowOnClickRedirectUrl?: TableProps<T>['rowOnClickRedirectUrl'];
|
|
35
|
+
toolbarSx?: TableProps<T>['toolbarSx'];
|
|
36
|
+
toolbarContent?: TableProps<T>['toolbarContent'];
|
|
37
|
+
tableContainerSx?: TableProps<T>['tableContainerSx'];
|
|
19
38
|
};
|
|
20
39
|
|
|
21
40
|
function deleteButton<T extends Record>(table: Table<T>): TableButton<T> {
|
|
@@ -80,6 +99,60 @@ export function RecordTable<T extends Record>(props: RecordTableProps<T>) {
|
|
|
80
99
|
return columnProperties;
|
|
81
100
|
}
|
|
82
101
|
|
|
102
|
+
function getDefaultRenderer(column: Column<any, any>): CustomRenderer<T, any> {
|
|
103
|
+
return (value: any) => {
|
|
104
|
+
if (
|
|
105
|
+
isInstanceOf(column, IntegerColumn) ||
|
|
106
|
+
isInstanceOf(column, FloatColumn) ||
|
|
107
|
+
isInstanceOf(column, DecimalColumn)
|
|
108
|
+
) {
|
|
109
|
+
return value != null ? value.toString() : '';
|
|
110
|
+
}
|
|
111
|
+
if (isInstanceOf(column, StringColumn)) {
|
|
112
|
+
return value || '';
|
|
113
|
+
}
|
|
114
|
+
if (isInstanceOf(column, BooleanColumn)) {
|
|
115
|
+
return value ? '✅' : '❌';
|
|
116
|
+
}
|
|
117
|
+
if (isInstanceOf(column, DateColumn)) {
|
|
118
|
+
return value ? moment(value).format('YYYY-MM-DD') : '';
|
|
119
|
+
}
|
|
120
|
+
if (isInstanceOf(column, DateTimeColumn)) {
|
|
121
|
+
return value ? moment(value).format('YYYY-MM-DD HH:mm:ss') : '';
|
|
122
|
+
}
|
|
123
|
+
if (isInstanceOf(column, ObjectColumn) || isInstanceOf(column, ArrayColumn)) {
|
|
124
|
+
return JSON.stringify(value);
|
|
125
|
+
}
|
|
126
|
+
return value != null ? value.toString() : '';
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function mergeColumnConfigs(): TableProps<T>['columnConfig'] {
|
|
131
|
+
const defaultConfig: TableProps<T>['columnConfig'] = {};
|
|
132
|
+
const columns = props.columns || defaultColumns();
|
|
133
|
+
|
|
134
|
+
for (const columnName of columns) {
|
|
135
|
+
const column = (props.table.columns as any)[columnName];
|
|
136
|
+
defaultConfig[columnName] = {
|
|
137
|
+
renderer: getDefaultRenderer(column),
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Merge with provided columnConfig, if any
|
|
142
|
+
if (props.columnConfig) {
|
|
143
|
+
for (const columnName in props.columnConfig) {
|
|
144
|
+
if (defaultConfig[columnName]) {
|
|
145
|
+
defaultConfig[columnName] = {
|
|
146
|
+
...defaultConfig[columnName],
|
|
147
|
+
...props.columnConfig[columnName],
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return defaultConfig;
|
|
154
|
+
}
|
|
155
|
+
|
|
83
156
|
function defaultTableLoader() {
|
|
84
157
|
return new QueryTableLoader(props.table, undefined, [{ field: 'updated', desc: true }]);
|
|
85
158
|
}
|
|
@@ -89,15 +162,15 @@ export function RecordTable<T extends Record>(props: RecordTableProps<T>) {
|
|
|
89
162
|
}
|
|
90
163
|
|
|
91
164
|
function buttons() {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
buttons.push(...props.buttons);
|
|
165
|
+
if (props.hideButtons) {
|
|
166
|
+
return [];
|
|
95
167
|
}
|
|
96
168
|
|
|
97
|
-
|
|
98
|
-
|
|
169
|
+
if (props.buttons) {
|
|
170
|
+
return props.buttons;
|
|
171
|
+
}
|
|
99
172
|
|
|
100
|
-
return
|
|
173
|
+
return [deleteButton(props.table), createButton(props.table)];
|
|
101
174
|
}
|
|
102
175
|
|
|
103
176
|
return (
|
|
@@ -105,10 +178,15 @@ export function RecordTable<T extends Record>(props: RecordTableProps<T>) {
|
|
|
105
178
|
title={props.title ? props.title : `${S(props.table.name).humanize().toString()} Table`}
|
|
106
179
|
description={props.description}
|
|
107
180
|
columns={props.columns ? props.columns : defaultColumns()}
|
|
181
|
+
columnConfig={mergeColumnConfigs()}
|
|
108
182
|
tableLoader={props.tableLoader ? props.tableLoader : defaultTableLoader()}
|
|
109
183
|
rowOnClickRedirectUrl={props.rowOnClickRedirectUrl ? props.rowOnClickRedirectUrl : defaultRowOnClickRedirectUrl}
|
|
184
|
+
pagination={props.pagination}
|
|
110
185
|
defaultRowsPerPage={props.defaultRowsPerPage}
|
|
111
186
|
buttons={buttons()}
|
|
187
|
+
toolbarSx={props.toolbarSx}
|
|
188
|
+
toolbarContent={props.toolbarContent}
|
|
189
|
+
tableContainerSx={props.tableContainerSx}
|
|
112
190
|
/>
|
|
113
191
|
);
|
|
114
192
|
}
|