@ibgib/core-gib 0.0.4
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/.vscode/core-gib-snippets.code-snippets +189 -0
- package/.vscode/launch.json +24 -0
- package/.vscode/settings.json +56 -0
- package/.vscode/tasks.json +37 -0
- package/CHANGELOG.md +11 -0
- package/README.md +215 -0
- package/dist/common/aws-constants.d.mts +7 -0
- package/dist/common/aws-constants.d.mts.map +1 -0
- package/dist/common/aws-constants.mjs +7 -0
- package/dist/common/aws-constants.mjs.map +1 -0
- package/dist/common/bin/bin-types.d.mts +17 -0
- package/dist/common/bin/bin-types.d.mts.map +1 -0
- package/dist/common/bin/bin-types.mjs +3 -0
- package/dist/common/bin/bin-types.mjs.map +1 -0
- package/dist/common/cache/cache-types.d.mts +57 -0
- package/dist/common/cache/cache-types.d.mts.map +1 -0
- package/dist/common/cache/cache-types.mjs +2 -0
- package/dist/common/cache/cache-types.mjs.map +1 -0
- package/dist/common/comment/comment-constants.d.mts +11 -0
- package/dist/common/comment/comment-constants.d.mts.map +1 -0
- package/dist/common/comment/comment-constants.mjs +11 -0
- package/dist/common/comment/comment-constants.mjs.map +1 -0
- package/dist/common/comment/comment-helper.d.mts +59 -0
- package/dist/common/comment/comment-helper.d.mts.map +1 -0
- package/dist/common/comment/comment-helper.mjs +173 -0
- package/dist/common/comment/comment-helper.mjs.map +1 -0
- package/dist/common/comment/comment-types.d.mts +16 -0
- package/dist/common/comment/comment-types.d.mts.map +1 -0
- package/dist/common/comment/comment-types.mjs +2 -0
- package/dist/common/comment/comment-types.mjs.map +1 -0
- package/dist/common/display/display-helper.d.mts +19 -0
- package/dist/common/display/display-helper.d.mts.map +1 -0
- package/dist/common/display/display-helper.mjs +68 -0
- package/dist/common/display/display-helper.mjs.map +1 -0
- package/dist/common/display/display-types.d.mts +97 -0
- package/dist/common/display/display-types.d.mts.map +1 -0
- package/dist/common/display/display-types.mjs +37 -0
- package/dist/common/display/display-types.mjs.map +1 -0
- package/dist/common/encrypt/encrypt-constants.d.mts +27 -0
- package/dist/common/encrypt/encrypt-constants.d.mts.map +1 -0
- package/dist/common/encrypt/encrypt-constants.mjs +27 -0
- package/dist/common/encrypt/encrypt-constants.mjs.map +1 -0
- package/dist/common/encrypt/encrypt-types.d.mts +116 -0
- package/dist/common/encrypt/encrypt-types.d.mts.map +1 -0
- package/dist/common/encrypt/encrypt-types.mjs +9 -0
- package/dist/common/encrypt/encrypt-types.mjs.map +1 -0
- package/dist/common/error/error-constants.d.mts +9 -0
- package/dist/common/error/error-constants.d.mts.map +1 -0
- package/dist/common/error/error-constants.mjs +9 -0
- package/dist/common/error/error-constants.mjs.map +1 -0
- package/dist/common/error/error-helper.d.mts +43 -0
- package/dist/common/error/error-helper.d.mts.map +1 -0
- package/dist/common/error/error-helper.mjs +167 -0
- package/dist/common/error/error-helper.mjs.map +1 -0
- package/dist/common/error/error-types.d.mts +58 -0
- package/dist/common/error/error-types.d.mts.map +1 -0
- package/dist/common/error/error-types.mjs +2 -0
- package/dist/common/error/error-types.mjs.map +1 -0
- package/dist/common/form/form-helper.d.mts +97 -0
- package/dist/common/form/form-helper.d.mts.map +1 -0
- package/dist/common/form/form-helper.mjs +185 -0
- package/dist/common/form/form-helper.mjs.map +1 -0
- package/dist/common/form/form-items.d.mts +229 -0
- package/dist/common/form/form-items.d.mts.map +1 -0
- package/dist/common/form/form-items.mjs +63 -0
- package/dist/common/form/form-items.mjs.map +1 -0
- package/dist/common/import-export/import-export-types.d.mts +18 -0
- package/dist/common/import-export/import-export-types.d.mts.map +1 -0
- package/dist/common/import-export/import-export-types.mjs +2 -0
- package/dist/common/import-export/import-export-types.mjs.map +1 -0
- package/dist/common/legacy/legacy-types.d.mts +2 -0
- package/dist/common/legacy/legacy-types.d.mts.map +1 -0
- package/dist/common/legacy/legacy-types.mjs +2 -0
- package/dist/common/legacy/legacy-types.mjs.map +1 -0
- package/dist/common/link/link-constants.d.mts +2 -0
- package/dist/common/link/link-constants.d.mts.map +1 -0
- package/dist/common/link/link-constants.mjs +2 -0
- package/dist/common/link/link-constants.mjs.map +1 -0
- package/dist/common/link/link-helper.d.mts +37 -0
- package/dist/common/link/link-helper.d.mts.map +1 -0
- package/dist/common/link/link-helper.mjs +143 -0
- package/dist/common/link/link-helper.mjs.map +1 -0
- package/dist/common/link/link-types.d.mts +14 -0
- package/dist/common/link/link-types.d.mts.map +1 -0
- package/dist/common/link/link-types.mjs +2 -0
- package/dist/common/link/link-types.mjs.map +1 -0
- package/dist/common/other/graph-helper.d.mts +166 -0
- package/dist/common/other/graph-helper.d.mts.map +1 -0
- package/dist/common/other/graph-helper.mjs +710 -0
- package/dist/common/other/graph-helper.mjs.map +1 -0
- package/dist/common/other/ibgib-helper.d.mts +245 -0
- package/dist/common/other/ibgib-helper.d.mts.map +1 -0
- package/dist/common/other/ibgib-helper.mjs +641 -0
- package/dist/common/other/ibgib-helper.mjs.map +1 -0
- package/dist/common/other/other-constants.d.mts +53 -0
- package/dist/common/other/other-constants.d.mts.map +1 -0
- package/dist/common/other/other-constants.mjs +67 -0
- package/dist/common/other/other-constants.mjs.map +1 -0
- package/dist/common/other/other-types.d.mts +166 -0
- package/dist/common/other/other-types.d.mts.map +1 -0
- package/dist/common/other/other-types.mjs +30 -0
- package/dist/common/other/other-types.mjs.map +1 -0
- package/dist/common/other/svg-constants.d.mts +2 -0
- package/dist/common/other/svg-constants.d.mts.map +1 -0
- package/dist/common/other/svg-constants.mjs +2 -0
- package/dist/common/other/svg-constants.mjs.map +1 -0
- package/dist/common/other/svg-helper.d.mts +54 -0
- package/dist/common/other/svg-helper.d.mts.map +1 -0
- package/dist/common/other/svg-helper.mjs +170 -0
- package/dist/common/other/svg-helper.mjs.map +1 -0
- package/dist/common/pic/pic-constants.d.mts +13 -0
- package/dist/common/pic/pic-constants.d.mts.map +1 -0
- package/dist/common/pic/pic-constants.mjs +13 -0
- package/dist/common/pic/pic-constants.mjs.map +1 -0
- package/dist/common/pic/pic-helper.d.mts +70 -0
- package/dist/common/pic/pic-helper.d.mts.map +1 -0
- package/dist/common/pic/pic-helper.mjs +235 -0
- package/dist/common/pic/pic-helper.mjs.map +1 -0
- package/dist/common/pic/pic-types.d.mts +23 -0
- package/dist/common/pic/pic-types.d.mts.map +1 -0
- package/dist/common/pic/pic-types.mjs +2 -0
- package/dist/common/pic/pic-types.mjs.map +1 -0
- package/dist/common/root/root-constants.d.mts +40 -0
- package/dist/common/root/root-constants.d.mts.map +1 -0
- package/dist/common/root/root-constants.mjs +40 -0
- package/dist/common/root/root-constants.mjs.map +1 -0
- package/dist/common/root/root-types.d.mts +9 -0
- package/dist/common/root/root-types.d.mts.map +1 -0
- package/dist/common/root/root-types.mjs +2 -0
- package/dist/common/root/root-types.mjs.map +1 -0
- package/dist/common/tag/tag-constants.d.mts +21 -0
- package/dist/common/tag/tag-constants.d.mts.map +1 -0
- package/dist/common/tag/tag-constants.mjs +28 -0
- package/dist/common/tag/tag-constants.mjs.map +1 -0
- package/dist/common/tag/tag-types.d.mts +14 -0
- package/dist/common/tag/tag-types.d.mts.map +1 -0
- package/dist/common/tag/tag-types.mjs +2 -0
- package/dist/common/tag/tag-types.mjs.map +1 -0
- package/dist/core-constants.d.mts +89 -0
- package/dist/core-constants.d.mts.map +1 -0
- package/dist/core-constants.mjs +484 -0
- package/dist/core-constants.mjs.map +1 -0
- package/dist/core-helper.d.mts +6 -0
- package/dist/core-helper.d.mts.map +1 -0
- package/dist/core-helper.mjs +28 -0
- package/dist/core-helper.mjs.map +1 -0
- package/dist/core-types.d.mts +520 -0
- package/dist/core-types.d.mts.map +1 -0
- package/dist/core-types.mjs +2 -0
- package/dist/core-types.mjs.map +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -0
- package/dist/witness/app/app-base-v1.d.mts +130 -0
- package/dist/witness/app/app-base-v1.d.mts.map +1 -0
- package/dist/witness/app/app-base-v1.mjs +462 -0
- package/dist/witness/app/app-base-v1.mjs.map +1 -0
- package/dist/witness/app/app-constants.d.mts +10 -0
- package/dist/witness/app/app-constants.d.mts.map +1 -0
- package/dist/witness/app/app-constants.mjs +13 -0
- package/dist/witness/app/app-constants.mjs.map +1 -0
- package/dist/witness/app/app-helper.d.mts +85 -0
- package/dist/witness/app/app-helper.d.mts.map +1 -0
- package/dist/witness/app/app-helper.mjs +258 -0
- package/dist/witness/app/app-helper.mjs.map +1 -0
- package/dist/witness/app/app-types.d.mts +211 -0
- package/dist/witness/app/app-types.d.mts.map +1 -0
- package/dist/witness/app/app-types.mjs +49 -0
- package/dist/witness/app/app-types.mjs.map +1 -0
- package/dist/witness/app/chat-app/chat-app-types.d.mts +18 -0
- package/dist/witness/app/chat-app/chat-app-types.d.mts.map +1 -0
- package/dist/witness/app/chat-app/chat-app-types.mjs +25 -0
- package/dist/witness/app/chat-app/chat-app-types.mjs.map +1 -0
- package/dist/witness/app/flash-app/flash-app-types.d.mts +16 -0
- package/dist/witness/app/flash-app/flash-app-types.d.mts.map +1 -0
- package/dist/witness/app/flash-app/flash-app-types.mjs +23 -0
- package/dist/witness/app/flash-app/flash-app-types.mjs.map +1 -0
- package/dist/witness/app/raw-app/raw-app-types.d.mts +18 -0
- package/dist/witness/app/raw-app/raw-app-types.d.mts.map +1 -0
- package/dist/witness/app/raw-app/raw-app-types.mjs +25 -0
- package/dist/witness/app/raw-app/raw-app-types.mjs.map +1 -0
- package/dist/witness/app/todo-app/todo-app-types.d.ts +33 -0
- package/dist/witness/app/todo-app/todo-app-types.d.ts.map +1 -0
- package/dist/witness/app/todo-app/todo-app-types.js +31 -0
- package/dist/witness/app/todo-app/todo-app-types.js.map +1 -0
- package/dist/witness/robbot/robbot-base-v1.d.ts +432 -0
- package/dist/witness/robbot/robbot-base-v1.d.ts.map +1 -0
- package/dist/witness/robbot/robbot-base-v1.js +1407 -0
- package/dist/witness/robbot/robbot-base-v1.js.map +1 -0
- package/dist/witness/robbot/robbot-constants.d.mts +24 -0
- package/dist/witness/robbot/robbot-constants.d.mts.map +1 -0
- package/dist/witness/robbot/robbot-constants.mjs +24 -0
- package/dist/witness/robbot/robbot-constants.mjs.map +1 -0
- package/dist/witness/robbot/robbot-helper.d.mts +152 -0
- package/dist/witness/robbot/robbot-helper.d.mts.map +1 -0
- package/dist/witness/robbot/robbot-helper.mjs +609 -0
- package/dist/witness/robbot/robbot-helper.mjs.map +1 -0
- package/dist/witness/robbot/robbot-types.d.mts +539 -0
- package/dist/witness/robbot/robbot-types.d.mts.map +1 -0
- package/dist/witness/robbot/robbot-types.mjs +294 -0
- package/dist/witness/robbot/robbot-types.mjs.map +1 -0
- package/dist/witness/space/bootstrap/bootstrap-constants.d.mts +14 -0
- package/dist/witness/space/bootstrap/bootstrap-constants.d.mts.map +1 -0
- package/dist/witness/space/bootstrap/bootstrap-constants.mjs +15 -0
- package/dist/witness/space/bootstrap/bootstrap-constants.mjs.map +1 -0
- package/dist/witness/space/inner-space-v1.d.ts +63 -0
- package/dist/witness/space/inner-space-v1.d.ts.map +1 -0
- package/dist/witness/space/inner-space-v1.js +356 -0
- package/dist/witness/space/inner-space-v1.js.map +1 -0
- package/dist/witness/space/outer-space/outer-space-constants.d.mts +2 -0
- package/dist/witness/space/outer-space/outer-space-constants.d.mts.map +1 -0
- package/dist/witness/space/outer-space/outer-space-constants.mjs +2 -0
- package/dist/witness/space/outer-space/outer-space-constants.mjs.map +1 -0
- package/dist/witness/space/outer-space/outer-space-helper.d.mts +28 -0
- package/dist/witness/space/outer-space/outer-space-helper.d.mts.map +1 -0
- package/dist/witness/space/outer-space/outer-space-helper.mjs +87 -0
- package/dist/witness/space/outer-space/outer-space-helper.mjs.map +1 -0
- package/dist/witness/space/outer-space/outer-space-types.d.mts +548 -0
- package/dist/witness/space/outer-space/outer-space-types.d.mts.map +1 -0
- package/dist/witness/space/outer-space/outer-space-types.mjs +118 -0
- package/dist/witness/space/outer-space/outer-space-types.mjs.map +1 -0
- package/dist/witness/space/space-base-v1.d.mts +147 -0
- package/dist/witness/space/space-base-v1.d.mts.map +1 -0
- package/dist/witness/space/space-base-v1.mjs +350 -0
- package/dist/witness/space/space-base-v1.mjs.map +1 -0
- package/dist/witness/space/space-constants.d.mts +181 -0
- package/dist/witness/space/space-constants.d.mts.map +1 -0
- package/dist/witness/space/space-constants.mjs +192 -0
- package/dist/witness/space/space-constants.mjs.map +1 -0
- package/dist/witness/space/space-helper.d.mts +666 -0
- package/dist/witness/space/space-helper.d.mts.map +1 -0
- package/dist/witness/space/space-helper.mjs +2830 -0
- package/dist/witness/space/space-helper.mjs.map +1 -0
- package/dist/witness/space/space-types.d.mts +422 -0
- package/dist/witness/space/space-types.d.mts.map +1 -0
- package/dist/witness/space/space-types.mjs +52 -0
- package/dist/witness/space/space-types.mjs.map +1 -0
- package/dist/witness/witness-base-v1.d.ts +144 -0
- package/dist/witness/witness-base-v1.d.ts.map +1 -0
- package/dist/witness/witness-base-v1.js +300 -0
- package/dist/witness/witness-base-v1.js.map +1 -0
- package/dist/witness/witness-constants.d.mts +3 -0
- package/dist/witness/witness-constants.d.mts.map +1 -0
- package/dist/witness/witness-constants.mjs +3 -0
- package/dist/witness/witness-constants.mjs.map +1 -0
- package/dist/witness/witness-form-builder.d.mts +45 -0
- package/dist/witness/witness-form-builder.d.mts.map +1 -0
- package/dist/witness/witness-form-builder.mjs +95 -0
- package/dist/witness/witness-form-builder.mjs.map +1 -0
- package/dist/witness/witness-helper.d.mts +89 -0
- package/dist/witness/witness-helper.d.mts.map +1 -0
- package/dist/witness/witness-helper.mjs +229 -0
- package/dist/witness/witness-helper.mjs.map +1 -0
- package/dist/witness/witness-types.d.mts +211 -0
- package/dist/witness/witness-types.d.mts.map +1 -0
- package/dist/witness/witness-types.mjs +2 -0
- package/dist/witness/witness-types.mjs.map +1 -0
- package/jasmine-browser.json +18 -0
- package/jasmine.json +6 -0
- package/package.json +67 -0
- package/src/assumptions.spec.mts +45 -0
- package/src/common/aws-constants.mts +5 -0
- package/src/common/bin/bin-types.mts +17 -0
- package/src/common/cache/cache-types.mts +53 -0
- package/src/common/comment/comment-constants.mts +10 -0
- package/src/common/comment/comment-helper.mts +211 -0
- package/src/common/comment/comment-types.mts +19 -0
- package/src/common/display/display-helper.mts +88 -0
- package/src/common/display/display-types.mts +108 -0
- package/src/common/encrypt/encrypt-constants.mts +28 -0
- package/src/common/encrypt/encrypt-types.mts +130 -0
- package/src/common/error/error-constants.mts +8 -0
- package/src/common/error/error-helper.mts +155 -0
- package/src/common/error/error-types.mts +62 -0
- package/src/common/form/form-helper.mts +253 -0
- package/src/common/form/form-items.mts +236 -0
- package/src/common/import-export/import-export-types.mts +18 -0
- package/src/common/legacy/about-legacy.md +0 -0
- package/src/common/legacy/legacy-types.mts +0 -0
- package/src/common/link/link-constants.mts +1 -0
- package/src/common/link/link-helper.mts +155 -0
- package/src/common/link/link-types.mts +16 -0
- package/src/common/other/graph-helper.mts +853 -0
- package/src/common/other/ibgib-helper.mts +671 -0
- package/src/common/other/other-constants.mts +76 -0
- package/src/common/other/other-types.mts +186 -0
- package/src/common/other/svg-constants.mts +1 -0
- package/src/common/other/svg-helper.mts +238 -0
- package/src/common/pic/pic-constants.mts +13 -0
- package/src/common/pic/pic-helper.mts +295 -0
- package/src/common/pic/pic-types.mts +29 -0
- package/src/common/root/root-constants.mts +41 -0
- package/src/common/root/root-types.mts +8 -0
- package/src/common/tag/tag-constants.mts +34 -0
- package/src/common/tag/tag-types.mts +19 -0
- package/src/core-constants.mts +506 -0
- package/src/core-helper.mts +33 -0
- package/src/core-types.mts +519 -0
- package/src/helper.spec.mts +64 -0
- package/src/index.mts +1 -0
- package/src/witness/app/app-base-v1.mts +584 -0
- package/src/witness/app/app-constants.mts +16 -0
- package/src/witness/app/app-helper.mts +322 -0
- package/src/witness/app/app-types.mts +252 -0
- package/src/witness/app/chat-app/chat-app-types.mts +40 -0
- package/src/witness/app/flash-app/flash-app-types.mts +38 -0
- package/src/witness/app/raw-app/raw-app-types.mts +40 -0
- package/src/witness/app/todo-app/todo-app-types.ts +59 -0
- package/src/witness/robbot/robbot-base-v1.ts +1531 -0
- package/src/witness/robbot/robbot-constants.mts +25 -0
- package/src/witness/robbot/robbot-helper.mts +676 -0
- package/src/witness/robbot/robbot-helper.spec.mts +135 -0
- package/src/witness/robbot/robbot-types.mts +797 -0
- package/src/witness/space/bootstrap/bootstrap-constants.mts +15 -0
- package/src/witness/space/inner-space-v1.ts +372 -0
- package/src/witness/space/outer-space/outer-space-constants.mts +1 -0
- package/src/witness/space/outer-space/outer-space-helper.mts +91 -0
- package/src/witness/space/outer-space/outer-space-types.mts +627 -0
- package/src/witness/space/space-base-v1.mts +414 -0
- package/src/witness/space/space-constants.mts +208 -0
- package/src/witness/space/space-helper.mts +3242 -0
- package/src/witness/space/space-types.mts +476 -0
- package/src/witness/witness-base-v1.ts +325 -0
- package/src/witness/witness-constants.mts +2 -0
- package/src/witness/witness-form-builder.mts +128 -0
- package/src/witness/witness-helper.mts +256 -0
- package/src/witness/witness-types.mts +249 -0
- package/tsconfig.json +15 -0
- package/tsconfig.test.json +10 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
*
|
|
4
|
+
* Types used in bindings for forms/dynamic forms.
|
|
5
|
+
*
|
|
6
|
+
* ## transitioning development
|
|
7
|
+
*
|
|
8
|
+
* I am transitioning from a ad hoc field behavior with angular templated forms
|
|
9
|
+
* to a slightly more powerful dynamic form fields that leverages angular's
|
|
10
|
+
* reactive forms. So many of the later properties of {@link FormItemInfo} are
|
|
11
|
+
* optional for backwards compatibility. These may become required in the
|
|
12
|
+
* future, once I have dynamic forms more fleshed out.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* For when you want options with both a label and icons.
|
|
17
|
+
*/
|
|
18
|
+
export interface SelectOptionWithIcon {
|
|
19
|
+
label: string;
|
|
20
|
+
icon: string;
|
|
21
|
+
value: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Used in modal forms.
|
|
26
|
+
*/
|
|
27
|
+
export interface FormItemInfo {
|
|
28
|
+
/**
|
|
29
|
+
* Property name
|
|
30
|
+
*/
|
|
31
|
+
name: string;
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
value?: string | number | boolean;
|
|
36
|
+
/**
|
|
37
|
+
* If set, the value will default to this.
|
|
38
|
+
*/
|
|
39
|
+
defaultValue?: string | number | boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Label for the property on a form
|
|
42
|
+
*/
|
|
43
|
+
label?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Optional description for the property. Can bind title/hover/tooltip to this.
|
|
46
|
+
*/
|
|
47
|
+
description?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Placeholder when entering the field's data.
|
|
50
|
+
*/
|
|
51
|
+
placeholder?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Validation regular expression
|
|
54
|
+
*
|
|
55
|
+
* If you change this on a field, you should always change
|
|
56
|
+
* the {@link regexpErrorMsg} !
|
|
57
|
+
|
|
58
|
+
* @see {@link regexpErrorMsg}
|
|
59
|
+
*/
|
|
60
|
+
regexp?: RegExp;
|
|
61
|
+
/**
|
|
62
|
+
* If provided, this tries to give guidance on regexp failures.
|
|
63
|
+
*
|
|
64
|
+
* NOTE this can always get out of sync with the regexp!
|
|
65
|
+
* @see {@link regexp}
|
|
66
|
+
*/
|
|
67
|
+
regexpErrorMsg?: string;
|
|
68
|
+
/**
|
|
69
|
+
* regexp.source
|
|
70
|
+
*/
|
|
71
|
+
// regexpSource?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Only required if wanting to do validation beyond regexp/required.
|
|
74
|
+
*/
|
|
75
|
+
fnValid?: (value: string | number) => boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Default error message, often used with {@see fnValid}.
|
|
78
|
+
*
|
|
79
|
+
* @see {@link regexpErrorMsg}
|
|
80
|
+
*
|
|
81
|
+
* ## in the future, this may be changed to a
|
|
82
|
+
* `string | {[error: string]: string}` which would be a better
|
|
83
|
+
* solution probably.
|
|
84
|
+
*/
|
|
85
|
+
defaultErrorMsg?: string;
|
|
86
|
+
/**
|
|
87
|
+
* If the field is required.
|
|
88
|
+
*/
|
|
89
|
+
required?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* If true, will not log field and will use type='password', unless the field
|
|
92
|
+
* is {@link unmasked}.
|
|
93
|
+
*/
|
|
94
|
+
private?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* If true, will reveal a private field.
|
|
97
|
+
*/
|
|
98
|
+
unmasked?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* If true, then regardless of modal state (adding/editing/viewing), this
|
|
101
|
+
* field will always be readonly.
|
|
102
|
+
*/
|
|
103
|
+
readonly?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* If truthy and non-zero, then this is a composite item which contains
|
|
106
|
+
* other items.
|
|
107
|
+
*
|
|
108
|
+
* Basically with angular, this translates to either a `FormGroup` or
|
|
109
|
+
* `FormArray`.
|
|
110
|
+
*/
|
|
111
|
+
items?: FormItemInfo[];
|
|
112
|
+
/**
|
|
113
|
+
* @see {@link FormItemDataType}
|
|
114
|
+
*
|
|
115
|
+
* Only should be set if {@link items} is falsy.
|
|
116
|
+
*/
|
|
117
|
+
dataType?: FormItemDataType;
|
|
118
|
+
/**
|
|
119
|
+
* Options to populate a select drop-down list (valid value list). I believe
|
|
120
|
+
* this can also be populated after the field info has been created but
|
|
121
|
+
* before/while the select list is shown to the user.
|
|
122
|
+
*/
|
|
123
|
+
selectOptions?: string[];
|
|
124
|
+
/**
|
|
125
|
+
* If you want your select options to include icons, use this.
|
|
126
|
+
* @see {@link selectOptions}
|
|
127
|
+
*/
|
|
128
|
+
selectOptionsWithIcons?: SelectOptionWithIcon[];
|
|
129
|
+
/**
|
|
130
|
+
* If set, this will trigger when the item is selected.
|
|
131
|
+
*/
|
|
132
|
+
onSelect?: (event: any, info: FormItemInfo) => Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* If given, should be the min of the field for validation.
|
|
135
|
+
*
|
|
136
|
+
* If the dataType is some kind of text, then this refers to the length of string.
|
|
137
|
+
* If the dataType is some kind of number, then this refers to the value of the number.
|
|
138
|
+
*
|
|
139
|
+
* ## notes
|
|
140
|
+
* * there can be the regex also that looks at this value
|
|
141
|
+
*
|
|
142
|
+
* @optional
|
|
143
|
+
*/
|
|
144
|
+
min?: number;
|
|
145
|
+
/**
|
|
146
|
+
* If given, should be the max of the field for validation.
|
|
147
|
+
*
|
|
148
|
+
* If the dataType is some kind of text, then this refers to the length of string.
|
|
149
|
+
* If the dataType is some kind of number, then this refers to the value of the number.
|
|
150
|
+
*
|
|
151
|
+
* ## notes
|
|
152
|
+
* * there can be the regex also that looks at this value
|
|
153
|
+
*
|
|
154
|
+
* @optional
|
|
155
|
+
*/
|
|
156
|
+
max?: number;
|
|
157
|
+
/**
|
|
158
|
+
* If true, select can select multiple items.
|
|
159
|
+
*
|
|
160
|
+
* If not a select, then not sure what's up.
|
|
161
|
+
*/
|
|
162
|
+
multiple?: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* If control is set, then this should be a randomly generated uuid
|
|
165
|
+
* that can be uniquely associated to the control.
|
|
166
|
+
*/
|
|
167
|
+
uuid?: string;
|
|
168
|
+
/**
|
|
169
|
+
* If true, then the control is errored and contains error information.
|
|
170
|
+
*/
|
|
171
|
+
errored?: boolean;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// /** @see {@link FormItemDataType} */
|
|
175
|
+
export type FormItemDataType =
|
|
176
|
+
'text' | 'textarea' | 'select' | 'toggle' | 'number' | 'form';
|
|
177
|
+
/**
|
|
178
|
+
* Type of the data, to drive what kind of control will be used for data.
|
|
179
|
+
*
|
|
180
|
+
* See individual members for more info.
|
|
181
|
+
*
|
|
182
|
+
* For fields that have auto-generated UI.
|
|
183
|
+
*
|
|
184
|
+
* ATOW Pretty much mirroring html5 input types.
|
|
185
|
+
*
|
|
186
|
+
* @see {@link FormItemDataType.text}
|
|
187
|
+
* @see {@link textarea}
|
|
188
|
+
* @see {@link select}
|
|
189
|
+
* @see {@link toggle}
|
|
190
|
+
* @see {@link number}
|
|
191
|
+
*/
|
|
192
|
+
export const FormItemDataType = {
|
|
193
|
+
/**
|
|
194
|
+
* @example name
|
|
195
|
+
*/
|
|
196
|
+
text: 'text' as FormItemDataType,
|
|
197
|
+
/**
|
|
198
|
+
* @example description
|
|
199
|
+
*/
|
|
200
|
+
textarea: 'textarea' as FormItemDataType,
|
|
201
|
+
/**
|
|
202
|
+
* select string(s) from a list.
|
|
203
|
+
*
|
|
204
|
+
* @example States e.g. TX, TN, NY, etc.
|
|
205
|
+
*
|
|
206
|
+
* @see {@link FormItemInfo.multiple}
|
|
207
|
+
*/
|
|
208
|
+
select: 'select' as FormItemDataType,
|
|
209
|
+
/**
|
|
210
|
+
* Boolean true/false or on/off, etc.
|
|
211
|
+
*/
|
|
212
|
+
toggle: 'toggle' as FormItemDataType,
|
|
213
|
+
/**
|
|
214
|
+
* Number value
|
|
215
|
+
*/
|
|
216
|
+
number: 'number' as FormItemDataType,
|
|
217
|
+
/**
|
|
218
|
+
* The item is a collection of other items.
|
|
219
|
+
*/
|
|
220
|
+
form: 'form' as FormItemDataType,
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* syntactic sugar for `Object.values(FormItemDataType)`
|
|
225
|
+
*/
|
|
226
|
+
export const FORM_ITEM_DATA_TYPES = Object.values(FormItemDataType);
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* A form is basically an array of form items.
|
|
230
|
+
*/
|
|
231
|
+
export interface DynamicForm extends FormItemInfo {
|
|
232
|
+
/**
|
|
233
|
+
* redeclared here to require children items.
|
|
234
|
+
*/
|
|
235
|
+
items: FormItemInfo[];
|
|
236
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IbGibAddr, IbGibRel8ns } from '@ibgib/ts-gib/dist/types.mjs';
|
|
2
|
+
import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/index.mjs';
|
|
3
|
+
|
|
4
|
+
export interface RawExportData_V1 {
|
|
5
|
+
dependencyGraphAsString: string,
|
|
6
|
+
contextIbGibAddr: IbGibAddr;
|
|
7
|
+
tjpAddr?: IbGibAddr;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface RawExportRel8ns_V1 extends IbGibRel8ns { }
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Ibgib that contains an entire export of a given ibgib.
|
|
14
|
+
*
|
|
15
|
+
* This could potentially be huge, so I'm naming it "Raw" in hopes
|
|
16
|
+
* that in the future some type of sharding & compression might happen.
|
|
17
|
+
*/
|
|
18
|
+
export interface RawExportIbGib_V1 extends IbGib_V1<RawExportData_V1, RawExportRel8ns_V1> { }
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const DEFAULT_LINK_TEXT_IB_SUBSTRING_LENGTH = 20;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import * as h from '@ibgib/helper-gib';
|
|
2
|
+
import { Factory_V1 as factory, IbGib_V1 } from '@ibgib/ts-gib/dist/V1/index.mjs';
|
|
3
|
+
import { TransformResult } from '@ibgib/ts-gib';
|
|
4
|
+
|
|
5
|
+
import { IbGibSpaceAny } from '../../witness/space/space-base-v1.mjs';
|
|
6
|
+
// import { persistTransformResult, } from './space.mjs';
|
|
7
|
+
import { persistTransformResult } from '../../witness/space/space-helper.mjs';
|
|
8
|
+
import { DEFAULT_LINK_TEXT_IB_SUBSTRING_LENGTH } from './link-constants.mjs';
|
|
9
|
+
import { ONLY_HAS_NON_ALPHANUMERICS } from '@ibgib/helper-gib';
|
|
10
|
+
import { GLOBAL_LOG_A_LOT } from '../../core-constants.mjs';
|
|
11
|
+
import { LinkData_V1, LinkIbGib_V1 } from './link-types.mjs';
|
|
12
|
+
|
|
13
|
+
const logalot = GLOBAL_LOG_A_LOT || false;
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* generates an ib based on the link text.
|
|
18
|
+
*
|
|
19
|
+
* Basically this gets a short substring of the link text and replaces
|
|
20
|
+
* any non alphanumeric characters.
|
|
21
|
+
*
|
|
22
|
+
* @param linkText link text
|
|
23
|
+
* @returns link ib for the given link text
|
|
24
|
+
*/
|
|
25
|
+
export function getLinkIb(linkText: string): string {
|
|
26
|
+
const lc = `[${getLinkIb.name}]`;
|
|
27
|
+
try {
|
|
28
|
+
if (!linkText) { throw new Error(`linkText required. (E: e131bda0f94e4af1807cda8710e6fb1f)`); }
|
|
29
|
+
let saferText = linkText.replace(/\W/g, '');
|
|
30
|
+
let ibLinkText: string;
|
|
31
|
+
if (saferText.length > DEFAULT_LINK_TEXT_IB_SUBSTRING_LENGTH) {
|
|
32
|
+
ibLinkText =
|
|
33
|
+
saferText.substring(0, DEFAULT_LINK_TEXT_IB_SUBSTRING_LENGTH);
|
|
34
|
+
} else if (saferText.length > 0) {
|
|
35
|
+
ibLinkText = saferText;
|
|
36
|
+
} else {
|
|
37
|
+
// link text only has characters/nonalphanumerics.
|
|
38
|
+
ibLinkText = ONLY_HAS_NON_ALPHANUMERICS;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return `link ${ibLinkText}`;
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error(`${lc} ${error.message}`);
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* creates a link ibgib, returning the transform result,
|
|
50
|
+
* optionally saving it in a given {@link space}.
|
|
51
|
+
*/
|
|
52
|
+
export async function createLinkIbGib({
|
|
53
|
+
text,
|
|
54
|
+
saveInSpace,
|
|
55
|
+
space,
|
|
56
|
+
}: {
|
|
57
|
+
/**
|
|
58
|
+
* link text
|
|
59
|
+
*/
|
|
60
|
+
text: string,
|
|
61
|
+
/**
|
|
62
|
+
* If true, will save the ibgibs created in the given {@link space}.
|
|
63
|
+
*/
|
|
64
|
+
saveInSpace?: boolean,
|
|
65
|
+
/**
|
|
66
|
+
* If {@link saveInSpace}, all ibgibs created in this function will be stored in
|
|
67
|
+
* this space.
|
|
68
|
+
*/
|
|
69
|
+
space?: IbGibSpaceAny,
|
|
70
|
+
}): Promise<TransformResult<LinkIbGib_V1>> {
|
|
71
|
+
const lc = `[${createLinkIbGib.name}]`;
|
|
72
|
+
|
|
73
|
+
if (logalot) { console.log(`${lc} starting...`); }
|
|
74
|
+
try {
|
|
75
|
+
if (!text) { throw new Error(`text required (E: bd9a29193ec7416da588fcd10de182ee)`); }
|
|
76
|
+
|
|
77
|
+
text = text.trim();
|
|
78
|
+
|
|
79
|
+
if (!text) { throw new Error(`text cannot be only whitespace (E: 5fbc0bf22388475da885993a261b01fa)`); }
|
|
80
|
+
|
|
81
|
+
const data: LinkData_V1 = { text, textTimestamp: h.getTimestamp() };
|
|
82
|
+
|
|
83
|
+
// create an ibgib with the filename and ext
|
|
84
|
+
const opts: any = {
|
|
85
|
+
parentIbGib: factory.primitive({ ib: 'link' }),
|
|
86
|
+
ib: getLinkIb(text),
|
|
87
|
+
data,
|
|
88
|
+
dna: true,
|
|
89
|
+
tjp: { uuid: true, timestamp: true },
|
|
90
|
+
nCounter: true,
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// this makes it more difficult to share/sync ibgibs...
|
|
94
|
+
// if (this.addr) { opts.rel8ns = { 'link on': [this.addr] }; }
|
|
95
|
+
|
|
96
|
+
if (logalot) { console.log(`${lc} opts: ${h.pretty(opts)}`); }
|
|
97
|
+
const resLinkIbGib = await factory.firstGen(opts) as TransformResult<LinkIbGib_V1>;
|
|
98
|
+
|
|
99
|
+
if (saveInSpace) {
|
|
100
|
+
if (!space) { throw new Error(`space required if saveInSpace is truthy (E: 19af4790b5744a72bbdd995219d8f1d4)`); }
|
|
101
|
+
await persistTransformResult({ resTransform: resLinkIbGib, space });
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return resLinkIbGib;
|
|
105
|
+
} catch (error) {
|
|
106
|
+
console.error(`${lc} ${error.message}`);
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function isLink({
|
|
112
|
+
ibGib,
|
|
113
|
+
}: {
|
|
114
|
+
ibGib: IbGib_V1,
|
|
115
|
+
}): boolean {
|
|
116
|
+
const lc = `[${isLink.name}]`;
|
|
117
|
+
try {
|
|
118
|
+
if (logalot) { console.log(`${lc} starting...`); }
|
|
119
|
+
|
|
120
|
+
if (!ibGib) { throw new Error(`ibGib required (E: 62e4d60452824d9097702bcc9e8466f4)`); }
|
|
121
|
+
|
|
122
|
+
const { ib, data, rel8ns } = ibGib;
|
|
123
|
+
|
|
124
|
+
// try rel8ns first
|
|
125
|
+
if (!rel8ns) {
|
|
126
|
+
if (logalot) { console.log(`${lc} rel8ns falsy, NOT a link (I: 21c6bebf90a94c11aa0fb5d44501a7d9)`); }
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// descends from link^gib
|
|
131
|
+
const ancestors = rel8ns.ancestor || [];
|
|
132
|
+
if (ancestors && ancestors.includes('link^gib')) {
|
|
133
|
+
if (logalot) { console.log(`${lc} descends from link^gib, YES is a link (I: be91be40214248c394065f8dc7a71e3b)`); }
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// has binary qualities and ib contains 'link'
|
|
138
|
+
if (!data) {
|
|
139
|
+
if (logalot) { console.log(`${lc} data falsy, NOT a link (I: bee06c5c10ea4c04bc5d7e2244840020)`); }
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
if (data.text && ib?.includes('link')) {
|
|
143
|
+
if (logalot) { console.log(`${lc} has text, and ib has 'link', YES is a link (I: 306b6e1f54e94acc91622a93770d0c1e)`); }
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (logalot) { console.log(`${lc} reached end, doesn't have link qualities. NOT a link. (I: 43a983d5acf64970aa4310b41fd93e0f)`); }
|
|
148
|
+
return false;
|
|
149
|
+
} catch (error) {
|
|
150
|
+
console.error(`${lc} ${error.message}`);
|
|
151
|
+
throw error;
|
|
152
|
+
} finally {
|
|
153
|
+
if (logalot) { console.log(`${lc} complete.`); }
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IbGibRel8ns_V1, IbGib_V1 } from '@ibgib/ts-gib/dist/V1/index.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Data for a link ibGib
|
|
5
|
+
*/
|
|
6
|
+
export interface LinkData_V1 {
|
|
7
|
+
text: string;
|
|
8
|
+
textTimestamp?: string;
|
|
9
|
+
timestamp?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface LinkRel8ns_V1 extends IbGibRel8ns_V1 {
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface LinkIbGib_V1 extends IbGib_V1<LinkData_V1, LinkRel8ns_V1> {
|
|
16
|
+
}
|