@next-core/runtime 1.4.3 → 1.5.1

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.
Files changed (102) hide show
  1. package/dist/cjs/Dialog.js +2 -3
  2. package/dist/cjs/Dialog.js.map +1 -1
  3. package/dist/cjs/Notification.js +2 -3
  4. package/dist/cjs/Notification.js.map +1 -1
  5. package/dist/cjs/index.js.map +1 -1
  6. package/dist/cjs/internal/CustomTemplates/expandCustomTemplate.js +2 -1
  7. package/dist/cjs/internal/CustomTemplates/expandCustomTemplate.js.map +1 -1
  8. package/dist/cjs/internal/CustomTemplates/utils.js.map +1 -1
  9. package/dist/cjs/internal/FormRenderer/constants.js +11 -0
  10. package/dist/cjs/internal/FormRenderer/constants.js.map +1 -0
  11. package/dist/cjs/internal/FormRenderer/expandFormRenderer.js +122 -0
  12. package/dist/cjs/internal/FormRenderer/expandFormRenderer.js.map +1 -0
  13. package/dist/cjs/internal/FormRenderer/getDefaultProperties.js +165 -0
  14. package/dist/cjs/internal/FormRenderer/getDefaultProperties.js.map +1 -0
  15. package/dist/cjs/internal/FormRenderer/interfaces.js +6 -0
  16. package/dist/cjs/internal/FormRenderer/interfaces.js.map +1 -0
  17. package/dist/cjs/internal/FormRenderer/utils.js +20 -0
  18. package/dist/cjs/internal/FormRenderer/utils.js.map +1 -0
  19. package/dist/cjs/internal/Renderer.js +38 -9
  20. package/dist/cjs/internal/Renderer.js.map +1 -1
  21. package/dist/cjs/internal/Router.js +5 -4
  22. package/dist/cjs/internal/Router.js.map +1 -1
  23. package/dist/cjs/internal/Runtime.js +72 -32
  24. package/dist/cjs/internal/Runtime.js.map +1 -1
  25. package/dist/cjs/internal/bindListeners.js +9 -2
  26. package/dist/cjs/internal/bindListeners.js.map +1 -1
  27. package/dist/cjs/internal/bootstrapData.js.map +1 -1
  28. package/dist/cjs/internal/compute/evaluate.js +21 -6
  29. package/dist/cjs/internal/compute/evaluate.js.map +1 -1
  30. package/dist/cjs/internal/compute/listenOnTrackingContext.js +7 -9
  31. package/dist/cjs/internal/compute/listenOnTrackingContext.js.map +1 -1
  32. package/dist/cjs/internal/data/DataStore.js +2 -2
  33. package/dist/cjs/internal/data/DataStore.js.map +1 -1
  34. package/dist/cjs/internal/fulfilStoryboard.js +27 -0
  35. package/dist/cjs/internal/fulfilStoryboard.js.map +1 -0
  36. package/dist/cjs/internal/interfaces.js.map +1 -1
  37. package/dist/cjs/internal/secret_internals.js +6 -15
  38. package/dist/cjs/internal/secret_internals.js.map +1 -1
  39. package/dist/esm/Dialog.js +2 -3
  40. package/dist/esm/Dialog.js.map +1 -1
  41. package/dist/esm/Notification.js +2 -3
  42. package/dist/esm/Notification.js.map +1 -1
  43. package/dist/esm/index.js.map +1 -1
  44. package/dist/esm/internal/CustomTemplates/expandCustomTemplate.js +2 -1
  45. package/dist/esm/internal/CustomTemplates/expandCustomTemplate.js.map +1 -1
  46. package/dist/esm/internal/CustomTemplates/utils.js.map +1 -1
  47. package/dist/esm/internal/FormRenderer/constants.js +3 -0
  48. package/dist/esm/internal/FormRenderer/constants.js.map +1 -0
  49. package/dist/esm/internal/FormRenderer/expandFormRenderer.js +111 -0
  50. package/dist/esm/internal/FormRenderer/expandFormRenderer.js.map +1 -0
  51. package/dist/esm/internal/FormRenderer/getDefaultProperties.js +136 -0
  52. package/dist/esm/internal/FormRenderer/getDefaultProperties.js.map +1 -0
  53. package/dist/esm/internal/FormRenderer/interfaces.js +2 -0
  54. package/dist/esm/internal/FormRenderer/interfaces.js.map +1 -0
  55. package/dist/esm/internal/FormRenderer/utils.js +15 -0
  56. package/dist/esm/internal/FormRenderer/utils.js.map +1 -0
  57. package/dist/esm/internal/Renderer.js +48 -16
  58. package/dist/esm/internal/Renderer.js.map +1 -1
  59. package/dist/esm/internal/Router.js +4 -3
  60. package/dist/esm/internal/Router.js.map +1 -1
  61. package/dist/esm/internal/Runtime.js +70 -29
  62. package/dist/esm/internal/Runtime.js.map +1 -1
  63. package/dist/esm/internal/bindListeners.js +9 -2
  64. package/dist/esm/internal/bindListeners.js.map +1 -1
  65. package/dist/esm/internal/bootstrapData.js.map +1 -1
  66. package/dist/esm/internal/compute/evaluate.js +22 -9
  67. package/dist/esm/internal/compute/evaluate.js.map +1 -1
  68. package/dist/esm/internal/compute/listenOnTrackingContext.js +7 -9
  69. package/dist/esm/internal/compute/listenOnTrackingContext.js.map +1 -1
  70. package/dist/esm/internal/data/DataStore.js +2 -2
  71. package/dist/esm/internal/data/DataStore.js.map +1 -1
  72. package/dist/esm/internal/fulfilStoryboard.js +34 -0
  73. package/dist/esm/internal/fulfilStoryboard.js.map +1 -0
  74. package/dist/esm/internal/interfaces.js.map +1 -1
  75. package/dist/esm/internal/secret_internals.js +7 -13
  76. package/dist/esm/internal/secret_internals.js.map +1 -1
  77. package/dist/types/Dialog.d.ts +1 -1
  78. package/dist/types/Notification.d.ts +1 -1
  79. package/dist/types/index.d.ts +1 -1
  80. package/dist/types/internal/CustomTemplates/expandCustomTemplate.d.ts +1 -1
  81. package/dist/types/internal/FormRenderer/constants.d.ts +7 -0
  82. package/dist/types/internal/FormRenderer/expandFormRenderer.d.ts +3 -0
  83. package/dist/types/internal/FormRenderer/getDefaultProperties.d.ts +2 -0
  84. package/dist/types/internal/FormRenderer/interfaces.d.ts +30 -0
  85. package/dist/types/internal/FormRenderer/utils.d.ts +5 -0
  86. package/dist/types/internal/Renderer.d.ts +2 -3
  87. package/dist/types/internal/Runtime.d.ts +11 -2
  88. package/dist/types/internal/bootstrapData.d.ts +1 -1
  89. package/dist/types/internal/fulfilStoryboard.d.ts +2 -0
  90. package/dist/types/internal/interfaces.d.ts +6 -0
  91. package/dist/types/internal/secret_internals.d.ts +1 -4
  92. package/package.json +6 -6
  93. package/dist/cjs/internal/loadBootstrapData.js +0 -227
  94. package/dist/cjs/internal/loadBootstrapData.js.map +0 -1
  95. package/dist/cjs/internal/loadCheckLogin.js +0 -17
  96. package/dist/cjs/internal/loadCheckLogin.js.map +0 -1
  97. package/dist/esm/internal/loadBootstrapData.js +0 -244
  98. package/dist/esm/internal/loadBootstrapData.js.map +0 -1
  99. package/dist/esm/internal/loadCheckLogin.js +0 -18
  100. package/dist/esm/internal/loadCheckLogin.js.map +0 -1
  101. package/dist/types/internal/loadBootstrapData.d.ts +0 -10
  102. package/dist/types/internal/loadCheckLogin.d.ts +0 -1
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Dialog = void 0;
7
7
  exports.loadDialogService = loadDialogService;
8
- var _Runtime = require("./internal/Runtime.js");
9
8
  let brick;
10
9
  function show(options) {
11
10
  if (brick) {
@@ -29,8 +28,8 @@ function show(options) {
29
28
  }
30
29
  }
31
30
  }
32
- function loadDialogService(tagName) {
33
- (0, _Runtime._internalApiLoadBricks)([tagName]).then(() => {
31
+ function loadDialogService(tagName, loader) {
32
+ loader([tagName]).then(() => {
34
33
  brick = document.createElement(tagName);
35
34
  }, error => {
36
35
  // eslint-disable-next-line no-console
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","names":["_Runtime","require","brick","show","options","resolve","type","confirm","content","Promise","setTimeout","reject","alert","loadDialogService","tagName","_internalApiLoadBricks","then","document","createElement","error","console","Dialog","Object","freeze","exports"],"sources":["../../src/Dialog.ts"],"sourcesContent":["import { _internalApiLoadBricks } from \"./internal/Runtime.js\";\n\nlet brick: {\n resolve(options: DialogOptions): Promise<void>;\n};\n\nfunction show(options: DialogOptions): Promise<void> {\n if (brick) {\n return brick.resolve(options);\n } else {\n if (options.type === \"confirm\") {\n if (confirm(options.content)) {\n return new Promise((resolve) =>\n setTimeout(() => {\n resolve();\n }, 1)\n );\n } else {\n return new Promise((resolve, reject) =>\n setTimeout(() => {\n reject();\n }, 1)\n );\n }\n } else {\n alert(options.content);\n return new Promise((resolve) =>\n setTimeout(() => {\n resolve();\n }, 1000)\n );\n }\n }\n}\n\nexport function loadDialogService(tagName: string) {\n _internalApiLoadBricks([tagName]).then(\n () => {\n brick = document.createElement(tagName) as any;\n },\n (error: unknown) => {\n // eslint-disable-next-line no-console\n console.error(\"Load dialog service failed:\", error);\n }\n );\n}\n\nexport interface DialogOptions {\n type?: \"success\" | \"error\" | \"warn\" | \"info\" | \"confirm\";\n title?: string | null;\n content: string;\n contentStyle?: object;\n}\n\nexport const Dialog = Object.freeze({\n show,\n});\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAIC,KAEH;AAED,SAASC,IAAIA,CAACC,OAAsB,EAAiB;EACnD,IAAIF,KAAK,EAAE;IACT,OAAOA,KAAK,CAACG,OAAO,CAACD,OAAO,CAAC;EAC/B,CAAC,MAAM;IACL,IAAIA,OAAO,CAACE,IAAI,KAAK,SAAS,EAAE;MAC9B,IAAIC,OAAO,CAACH,OAAO,CAACI,OAAO,CAAC,EAAE;QAC5B,OAAO,IAAIC,OAAO,CAAEJ,OAAO,IACzBK,UAAU,CAAC,MAAM;UACfL,OAAO,EAAE;QACX,CAAC,EAAE,CAAC,CAAC,CACN;MACH,CAAC,MAAM;QACL,OAAO,IAAII,OAAO,CAAC,CAACJ,OAAO,EAAEM,MAAM,KACjCD,UAAU,CAAC,MAAM;UACfC,MAAM,EAAE;QACV,CAAC,EAAE,CAAC,CAAC,CACN;MACH;IACF,CAAC,MAAM;MACLC,KAAK,CAACR,OAAO,CAACI,OAAO,CAAC;MACtB,OAAO,IAAIC,OAAO,CAAEJ,OAAO,IACzBK,UAAU,CAAC,MAAM;QACfL,OAAO,EAAE;MACX,CAAC,EAAE,IAAI,CAAC,CACT;IACH;EACF;AACF;AAEO,SAASQ,iBAAiBA,CAACC,OAAe,EAAE;EACjD,IAAAC,+BAAsB,EAAC,CAACD,OAAO,CAAC,CAAC,CAACE,IAAI,CACpC,MAAM;IACJd,KAAK,GAAGe,QAAQ,CAACC,aAAa,CAACJ,OAAO,CAAQ;EAChD,CAAC,EACAK,KAAc,IAAK;IAClB;IACAC,OAAO,CAACD,KAAK,CAAC,6BAA6B,EAAEA,KAAK,CAAC;EACrD,CAAC,CACF;AACH;AASO,MAAME,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAC;EAClCpB;AACF,CAAC,CAAC;AAACqB,OAAA,CAAAH,MAAA,GAAAA,MAAA"}
1
+ {"version":3,"file":"Dialog.js","names":["brick","show","options","resolve","type","confirm","content","Promise","setTimeout","reject","alert","loadDialogService","tagName","loader","then","document","createElement","error","console","Dialog","Object","freeze","exports"],"sources":["../../src/Dialog.ts"],"sourcesContent":["let brick: {\n resolve(options: DialogOptions): Promise<void>;\n};\n\nfunction show(options: DialogOptions): Promise<void> {\n if (brick) {\n return brick.resolve(options);\n } else {\n if (options.type === \"confirm\") {\n if (confirm(options.content)) {\n return new Promise((resolve) =>\n setTimeout(() => {\n resolve();\n }, 1)\n );\n } else {\n return new Promise((resolve, reject) =>\n setTimeout(() => {\n reject();\n }, 1)\n );\n }\n } else {\n alert(options.content);\n return new Promise((resolve) =>\n setTimeout(() => {\n resolve();\n }, 1000)\n );\n }\n }\n}\n\nexport function loadDialogService(\n tagName: string,\n loader: (bricks: string[]) => Promise<void>\n) {\n loader([tagName]).then(\n () => {\n brick = document.createElement(tagName) as any;\n },\n (error: unknown) => {\n // eslint-disable-next-line no-console\n console.error(\"Load dialog service failed:\", error);\n }\n );\n}\n\nexport interface DialogOptions {\n type?: \"success\" | \"error\" | \"warn\" | \"info\" | \"confirm\";\n title?: string | null;\n content: string;\n contentStyle?: object;\n}\n\nexport const Dialog = Object.freeze({\n show,\n});\n"],"mappings":";;;;;;;AAAA,IAAIA,KAEH;AAED,SAASC,IAAIA,CAACC,OAAsB,EAAiB;EACnD,IAAIF,KAAK,EAAE;IACT,OAAOA,KAAK,CAACG,OAAO,CAACD,OAAO,CAAC;EAC/B,CAAC,MAAM;IACL,IAAIA,OAAO,CAACE,IAAI,KAAK,SAAS,EAAE;MAC9B,IAAIC,OAAO,CAACH,OAAO,CAACI,OAAO,CAAC,EAAE;QAC5B,OAAO,IAAIC,OAAO,CAAEJ,OAAO,IACzBK,UAAU,CAAC,MAAM;UACfL,OAAO,EAAE;QACX,CAAC,EAAE,CAAC,CAAC,CACN;MACH,CAAC,MAAM;QACL,OAAO,IAAII,OAAO,CAAC,CAACJ,OAAO,EAAEM,MAAM,KACjCD,UAAU,CAAC,MAAM;UACfC,MAAM,EAAE;QACV,CAAC,EAAE,CAAC,CAAC,CACN;MACH;IACF,CAAC,MAAM;MACLC,KAAK,CAACR,OAAO,CAACI,OAAO,CAAC;MACtB,OAAO,IAAIC,OAAO,CAAEJ,OAAO,IACzBK,UAAU,CAAC,MAAM;QACfL,OAAO,EAAE;MACX,CAAC,EAAE,IAAI,CAAC,CACT;IACH;EACF;AACF;AAEO,SAASQ,iBAAiBA,CAC/BC,OAAe,EACfC,MAA2C,EAC3C;EACAA,MAAM,CAAC,CAACD,OAAO,CAAC,CAAC,CAACE,IAAI,CACpB,MAAM;IACJd,KAAK,GAAGe,QAAQ,CAACC,aAAa,CAACJ,OAAO,CAAQ;EAChD,CAAC,EACAK,KAAc,IAAK;IAClB;IACAC,OAAO,CAACD,KAAK,CAAC,6BAA6B,EAAEA,KAAK,CAAC;EACrD,CAAC,CACF;AACH;AASO,MAAME,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAC;EAClCpB;AACF,CAAC,CAAC;AAACqB,OAAA,CAAAH,MAAA,GAAAA,MAAA"}
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Notification = void 0;
7
7
  exports.loadNotificationService = loadNotificationService;
8
- var _Runtime = require("./internal/Runtime.js");
9
8
  let brick;
10
9
  function show(options) {
11
10
  if (brick) {
@@ -14,8 +13,8 @@ function show(options) {
14
13
  alert(options.message);
15
14
  }
16
15
  }
17
- function loadNotificationService(tagName) {
18
- (0, _Runtime._internalApiLoadBricks)([tagName]).then(() => {
16
+ function loadNotificationService(tagName, loader) {
17
+ loader([tagName]).then(() => {
19
18
  brick = document.createElement(tagName);
20
19
  }, error => {
21
20
  // eslint-disable-next-line no-console
@@ -1 +1 @@
1
- {"version":3,"file":"Notification.js","names":["_Runtime","require","brick","show","options","resolve","alert","message","loadNotificationService","tagName","_internalApiLoadBricks","then","document","createElement","error","console","Notification","Object","freeze","exports"],"sources":["../../src/Notification.ts"],"sourcesContent":["import { _internalApiLoadBricks } from \"./internal/Runtime.js\";\n\nlet brick: {\n resolve(options: NotificationOptions): void;\n};\n\nfunction show(options: NotificationOptions) {\n if (brick) {\n brick.resolve(options);\n } else {\n alert(options.message);\n }\n}\n\nexport function loadNotificationService(tagName: string) {\n _internalApiLoadBricks([tagName]).then(\n () => {\n brick = document.createElement(tagName) as any;\n },\n (error: unknown) => {\n // eslint-disable-next-line no-console\n console.error(\"Load notification service failed:\", error);\n }\n );\n}\n\nexport interface NotificationOptions {\n type?: \"success\" | \"error\" | \"warn\" | \"info\";\n message: string;\n}\n\nexport const Notification = Object.freeze({\n show,\n});\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAIC,KAEH;AAED,SAASC,IAAIA,CAACC,OAA4B,EAAE;EAC1C,IAAIF,KAAK,EAAE;IACTA,KAAK,CAACG,OAAO,CAACD,OAAO,CAAC;EACxB,CAAC,MAAM;IACLE,KAAK,CAACF,OAAO,CAACG,OAAO,CAAC;EACxB;AACF;AAEO,SAASC,uBAAuBA,CAACC,OAAe,EAAE;EACvD,IAAAC,+BAAsB,EAAC,CAACD,OAAO,CAAC,CAAC,CAACE,IAAI,CACpC,MAAM;IACJT,KAAK,GAAGU,QAAQ,CAACC,aAAa,CAACJ,OAAO,CAAQ;EAChD,CAAC,EACAK,KAAc,IAAK;IAClB;IACAC,OAAO,CAACD,KAAK,CAAC,mCAAmC,EAAEA,KAAK,CAAC;EAC3D,CAAC,CACF;AACH;AAOO,MAAME,YAAY,GAAGC,MAAM,CAACC,MAAM,CAAC;EACxCf;AACF,CAAC,CAAC;AAACgB,OAAA,CAAAH,YAAA,GAAAA,YAAA"}
1
+ {"version":3,"file":"Notification.js","names":["brick","show","options","resolve","alert","message","loadNotificationService","tagName","loader","then","document","createElement","error","console","Notification","Object","freeze","exports"],"sources":["../../src/Notification.ts"],"sourcesContent":["let brick: {\n resolve(options: NotificationOptions): void;\n};\n\nfunction show(options: NotificationOptions) {\n if (brick) {\n brick.resolve(options);\n } else {\n alert(options.message);\n }\n}\n\nexport function loadNotificationService(\n tagName: string,\n loader: (bricks: string[]) => Promise<void>\n) {\n loader([tagName]).then(\n () => {\n brick = document.createElement(tagName) as any;\n },\n (error: unknown) => {\n // eslint-disable-next-line no-console\n console.error(\"Load notification service failed:\", error);\n }\n );\n}\n\nexport interface NotificationOptions {\n type?: \"success\" | \"error\" | \"warn\" | \"info\";\n message: string;\n}\n\nexport const Notification = Object.freeze({\n show,\n});\n"],"mappings":";;;;;;;AAAA,IAAIA,KAEH;AAED,SAASC,IAAIA,CAACC,OAA4B,EAAE;EAC1C,IAAIF,KAAK,EAAE;IACTA,KAAK,CAACG,OAAO,CAACD,OAAO,CAAC;EACxB,CAAC,MAAM;IACLE,KAAK,CAACF,OAAO,CAACG,OAAO,CAAC;EACxB;AACF;AAEO,SAASC,uBAAuBA,CACrCC,OAAe,EACfC,MAA2C,EAC3C;EACAA,MAAM,CAAC,CAACD,OAAO,CAAC,CAAC,CAACE,IAAI,CACpB,MAAM;IACJT,KAAK,GAAGU,QAAQ,CAACC,aAAa,CAACJ,OAAO,CAAQ;EAChD,CAAC,EACAK,KAAc,IAAK;IAClB;IACAC,OAAO,CAACD,KAAK,CAAC,mCAAmC,EAAEA,KAAK,CAAC;EAC3D,CAAC,CACF;AACH;AAOO,MAAME,YAAY,GAAGC,MAAM,CAACC,MAAM,CAAC;EACxCf;AACF,CAAC,CAAC;AAACgB,OAAA,CAAAH,YAAA,GAAAA,YAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_auth","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_CustomProcessors","_CustomTemplates","_fetchByProvider","_getBasePath","_getPageInfo","_handleHttpError","_history","_createRoot","_Runtime","__secret_internals","_interopRequireWildcard","_themeAndMode","_checkIf","_WidgetFunctions","_WidgetI18n","_StoryboardFunctionRegistry","_matchPath","_Notification","_Dialog"],"sources":["../../src/index.ts"],"sourcesContent":["export * from \"./auth.js\";\nexport * from \"./CustomProcessors.js\";\nexport * from \"./CustomTemplates.js\";\nexport * from \"./fetchByProvider.js\";\nexport * from \"./getBasePath.js\";\nexport * from \"./getPageInfo.js\";\nexport * from \"./handleHttpError.js\";\nexport * from \"./history.js\";\nexport * from \"./createRoot.js\";\nexport { createRuntime, getRuntime } from \"./internal/Runtime.js\";\nimport * as __secret_internals from \"./internal/secret_internals.js\";\nexport { __secret_internals };\nexport {\n getCssPropertyValue,\n getCurrentTheme,\n getCurrentMode,\n batchSetAppsLocalTheme,\n applyTheme,\n} from \"./themeAndMode.js\";\nexport {\n checkIfOfComputed,\n checkIfByTransform,\n} from \"./internal/compute/checkIf.js\";\nexport { registerWidgetFunctions } from \"./internal/compute/WidgetFunctions.js\";\nexport { registerWidgetI18n } from \"./internal/compute/WidgetI18n.js\";\nexport { StoryboardFunctionRegistryFactory } from \"./StoryboardFunctionRegistry.js\";\nexport { matchPath } from \"./internal/matchPath.js\";\nexport { Notification, type NotificationOptions } from \"./Notification.js\";\nexport { Dialog, type DialogOptions } from \"./Dialog.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EA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hB,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAQ,WAAA,CAAAhB,GAAA;IAAA;EAAA;AAAA;AACA,IAAAiB,QAAA,GAAArB,OAAA;AACA,IAAAsB,kBAAA,GAAAC,uBAAA,CAAAvB,OAAA;AAAqES,OAAA,CAAAa,kBAAA,GAAAA,kBAAA;AAErE,IAAAE,aAAA,GAAAxB,OAAA;AAOA,IAAAyB,QAAA,GAAAzB,OAAA;AAIA,IAAA0B,gBAAA,GAAA1B,OAAA;AACA,IAAA2B,WAAA,GAAA3B,OAAA;AACA,IAAA4B,2BAAA,GAAA5B,OAAA;AACA,IAAA6B,UAAA,GAAA7B,OAAA;AACA,IAAA8B,aAAA,GAAA9B,OAAA;AACA,IAAA+B,OAAA,GAAA/B,OAAA"}
1
+ {"version":3,"file":"index.js","names":["_auth","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_CustomProcessors","_CustomTemplates","_fetchByProvider","_getBasePath","_getPageInfo","_handleHttpError","_history","_createRoot","_Runtime","__secret_internals","_interopRequireWildcard","_themeAndMode","_checkIf","_WidgetFunctions","_WidgetI18n","_StoryboardFunctionRegistry","_matchPath","_Notification","_Dialog"],"sources":["../../src/index.ts"],"sourcesContent":["export * from \"./auth.js\";\nexport * from \"./CustomProcessors.js\";\nexport * from \"./CustomTemplates.js\";\nexport * from \"./fetchByProvider.js\";\nexport * from \"./getBasePath.js\";\nexport * from \"./getPageInfo.js\";\nexport * from \"./handleHttpError.js\";\nexport * from \"./history.js\";\nexport * from \"./createRoot.js\";\nexport {\n createRuntime,\n getRuntime,\n type RuntimeOptions,\n type RuntimeHooks,\n} from \"./internal/Runtime.js\";\nimport * as __secret_internals from \"./internal/secret_internals.js\";\nexport { __secret_internals };\nexport {\n getCssPropertyValue,\n getCurrentTheme,\n getCurrentMode,\n batchSetAppsLocalTheme,\n applyTheme,\n} from \"./themeAndMode.js\";\nexport {\n checkIfOfComputed,\n checkIfByTransform,\n} from \"./internal/compute/checkIf.js\";\nexport { registerWidgetFunctions } from \"./internal/compute/WidgetFunctions.js\";\nexport { registerWidgetI18n } from \"./internal/compute/WidgetI18n.js\";\nexport { StoryboardFunctionRegistryFactory } from \"./StoryboardFunctionRegistry.js\";\nexport { matchPath } from \"./internal/matchPath.js\";\nexport { Notification, type NotificationOptions } from \"./Notification.js\";\nexport { Dialog, type DialogOptions } from \"./Dialog.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,iBAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,iBAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,iBAAA,CAAAT,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AAA/B,OAAA"}
@@ -18,8 +18,9 @@ function expandCustomTemplate(tplTagName, brickConf, hostBrick, asyncHostPropert
18
18
  tplStateStoreId
19
19
  };
20
20
 
21
- // There is a boundary for `forEachItem` between template internals and externals.
21
+ // There is a boundary for `forEachItem` and `FORM_STATE` between template internals and externals.
22
22
  delete runtimeContext.forEachItem;
23
+ delete runtimeContext.formStateStoreId;
23
24
  const tplStateStore = new _DataStore.DataStore("STATE", hostBrick);
24
25
  runtimeContext.tplStateStoreMap.set(tplStateStoreId, tplStateStore);
25
26
  if (runtimeContext.tplStateStoreScope) {
@@ -1 +1 @@
1
- {"version":3,"file":"expandCustomTemplate.js","names":["_lodash","require","_CustomTemplates","_DataStore","_setupTemplateProxy","_setupUseBrickInTemplate","_Renderer","_CollectContracts","expandCustomTemplate","tplTagName","brickConf","hostBrick","asyncHostProperties","tplStateStoreId","uniqueId","runtimeContext","forEachItem","tplStateStore","DataStore","tplStateStoreMap","set","tplStateStoreScope","push","bricks","proxy","state","contracts","customTemplates","get","collectWidgetContract","define","slots","originalExternalSlots","children","externalChildren","restBrickConf","newBrickConf","brick","tplHostMetadata","internalBricksByRef","Map","reversedProxies","properties","from","to","Object","entries","proxies","ref","hostContext","externalSlots","childrenToSlots","type","map","item","expandBrickInTemplate","brickConfInTemplate","if","slotsInTemplate","childrenInTemplate","restBrickConfInTemplate","transpiledSlots","fromEntries","slotName","slotConf","_slotConf$bricks","setupUseBrickInTemplate","setupTemplateProxy"],"sources":["../../../../src/internal/CustomTemplates/expandCustomTemplate.ts"],"sourcesContent":["import type {\n BrickConf,\n BrickConfInTemplate,\n SlotsConfInTemplate,\n SlotsConfOfBricks,\n UseSingleBrickConf,\n} from \"@next-core/types\";\nimport { uniqueId } from \"lodash\";\nimport { customTemplates } from \"../../CustomTemplates.js\";\nimport { DataStore } from \"../data/DataStore.js\";\nimport { RuntimeBrickConfWithTplSymbols } from \"./constants.js\";\nimport { setupTemplateProxy } from \"./setupTemplateProxy.js\";\nimport type {\n AsyncProperties,\n RuntimeBrick,\n TemplateHostBrick,\n TemplateHostContext,\n} from \"../interfaces.js\";\nimport { setupUseBrickInTemplate } from \"./setupUseBrickInTemplate.js\";\nimport { childrenToSlots } from \"../Renderer.js\";\nimport { collectWidgetContract } from \"../data/CollectContracts.js\";\n\nexport function expandCustomTemplate<T extends BrickConf | UseSingleBrickConf>(\n tplTagName: string,\n brickConf: T,\n hostBrick: RuntimeBrick,\n asyncHostProperties: AsyncProperties | undefined\n): T {\n const tplStateStoreId = uniqueId(\"tpl-state-\");\n const runtimeContext = {\n ...hostBrick.runtimeContext,\n tplStateStoreId,\n };\n\n // There is a boundary for `forEachItem` between template internals and externals.\n delete runtimeContext.forEachItem;\n\n const tplStateStore = new DataStore(\"STATE\", hostBrick);\n runtimeContext.tplStateStoreMap.set(tplStateStoreId, tplStateStore);\n if (runtimeContext.tplStateStoreScope) {\n runtimeContext.tplStateStoreScope.push(tplStateStore);\n }\n\n const { bricks, proxy, state, contracts } = customTemplates.get(tplTagName)!;\n collectWidgetContract(contracts);\n tplStateStore.define(state, runtimeContext, asyncHostProperties);\n\n const {\n slots: originalExternalSlots,\n children: externalChildren,\n ...restBrickConf\n } = brickConf;\n\n const newBrickConf = {\n ...restBrickConf,\n brick: tplTagName,\n } as T;\n\n hostBrick.tplHostMetadata = {\n internalBricksByRef: new Map(),\n tplStateStoreId,\n proxy,\n };\n\n // Reversed proxies are used for expand storyboard before rendering page.\n const reversedProxies: TemplateHostContext[\"reversedProxies\"] = {\n properties: new Map(),\n slots: new Map(),\n // mergeBases: new Map(),\n };\n\n if (proxy?.properties) {\n for (const [from, to] of Object.entries(proxy.properties)) {\n let proxies = reversedProxies.properties.get(to.ref);\n if (!proxies) {\n proxies = [];\n reversedProxies.properties.set(to.ref, proxies);\n }\n proxies.push({\n from,\n to,\n });\n }\n }\n\n if (proxy?.slots) {\n for (const [from, to] of Object.entries(proxy.slots)) {\n let proxies = reversedProxies.slots.get(to.ref);\n if (!proxies) {\n proxies = [];\n reversedProxies.slots.set(to.ref, proxies);\n }\n proxies.push({\n from,\n to,\n });\n }\n }\n\n const hostContext: TemplateHostContext = {\n reversedProxies,\n asyncHostProperties,\n externalSlots: childrenToSlots(externalChildren, originalExternalSlots) as\n | SlotsConfOfBricks\n | undefined,\n tplStateStoreId,\n hostBrick: hostBrick as TemplateHostBrick,\n };\n\n newBrickConf.slots = {\n \"\": {\n type: \"bricks\",\n bricks: bricks.map((item) => expandBrickInTemplate(item, hostContext)),\n },\n };\n\n return newBrickConf;\n}\n\nfunction expandBrickInTemplate(\n brickConfInTemplate: BrickConfInTemplate,\n hostContext: TemplateHostContext\n): RuntimeBrickConfWithTplSymbols {\n // Ignore `if: null` to make `looseCheckIf` working.\n if (brickConfInTemplate.if === null) {\n delete brickConfInTemplate.if;\n }\n const {\n properties,\n slots: slotsInTemplate,\n children: childrenInTemplate,\n ...restBrickConfInTemplate\n } = brickConfInTemplate;\n\n const transpiledSlots = childrenToSlots(\n childrenInTemplate,\n slotsInTemplate\n ) as SlotsConfInTemplate | undefined;\n\n const slots: SlotsConfOfBricks = Object.fromEntries(\n Object.entries(transpiledSlots ?? {}).map(([slotName, slotConf]) => [\n slotName,\n {\n type: \"bricks\",\n bricks: (slotConf.bricks ?? []).map((item) =>\n expandBrickInTemplate(item, hostContext)\n ),\n },\n ])\n );\n\n return {\n ...restBrickConfInTemplate,\n properties: setupUseBrickInTemplate(properties, hostContext),\n slots,\n ...setupTemplateProxy(hostContext, restBrickConfInTemplate.ref, slots),\n };\n}\n"],"mappings":";;;;;;AAOA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEA,IAAAG,mBAAA,GAAAH,OAAA;AAOA,IAAAI,wBAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AAEO,SAASO,oBAAoBA,CAClCC,UAAkB,EAClBC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Y;AACrB;AAEA,SAASmB,qBAAqBA,CAC5BC,mBAAwC,EACxCP,WAAgC,EACA;EAChC;EACA,IAAIO,mBAAmB,CAACC,EAAE,KAAK,IAAI,EAAE;IACnC,OAAOD,mBAAmB,CAACC,EAAE;EAC/B;EACA,MAAM;IACJf,UAAU;IACVX,KAAK,EAAE2B,eAAe;IACtBzB,QAAQ,EAAE0B,kBAAkB;IAC5B,GAAGC;EACL,CAAC,GAAGJ,mBAAmB;EAEvB,MAAMK,eAAe,GAAG,IAAAV,yBAAe,EACrCQ,kBAAkB,EAClBD,eAAe,CACmB;EAEpC,MAAM3B,KAAwB,GAAGc,MAAM,CAACiB,WAAW,CACjDjB,MAAM,CAACC,OAAO,CAACe,eAAe,aAAfA,eAAe,cAAfA,eAAe,GAAI,CAAC,CAAC,CAAC,CAACR,GAAG,CAAC,CAAC,CAACU,QAAQ,EAAEC,QAAQ,CAAC;IAAA,IAAAC,gBAAA;IAAA,OAAK,CAClEF,QAAQ,EACR;MACEX,IAAI,EAAE,QAAQ;MACd7B,MAAM,EAAE,EAAA0C,gBAAA,GAACD,QAAQ,CAACzC,MAAM,cAAA0C,gBAAA,cAAAA,gBAAA,GAAI,EAAE,EAAEZ,GAAG,CAAEC,IAAI,IACvCC,qBAAqB,CAACD,IAAI,EAAEL,WAAW,CAAC;IAE5C,CAAC,CACF;EAAA,EAAC,CACH;EAED,OAAO;IACL,GAAGW,uBAAuB;IAC1BlB,UAAU,EAAE,IAAAwB,gDAAuB,EAACxB,UAAU,EAAEO,WAAW,CAAC;IAC5DlB,KAAK;IACL,GAAG,IAAAoC,sCAAkB,EAAClB,WAAW,EAAEW,uBAAuB,CAACZ,GAAG,EAAEjB,KAAK;EACvE,CAAC;AACH"}
1
+ {"version":3,"file":"expandCustomTemplate.js","names":["_lodash","require","_CustomTemplates","_DataStore","_setupTemplateProxy","_setupUseBrickInTemplate","_Renderer","_CollectContracts","expandCustomTemplate","tplTagName","brickConf","hostBrick","asyncHostProperties","tplStateStoreId","uniqueId","runtimeContext","forEachItem","formStateStoreId","tplStateStore","DataStore","tplStateStoreMap","set","tplStateStoreScope","push","bricks","proxy","state","contracts","customTemplates","get","collectWidgetContract","define","slots","originalExternalSlots","children","externalChildren","restBrickConf","newBrickConf","brick","tplHostMetadata","internalBricksByRef","Map","reversedProxies","properties","from","to","Object","entries","proxies","ref","hostContext","externalSlots","childrenToSlots","type","map","item","expandBrickInTemplate","brickConfInTemplate","if","slotsInTemplate","childrenInTemplate","restBrickConfInTemplate","transpiledSlots","fromEntries","slotName","slotConf","_slotConf$bricks","setupUseBrickInTemplate","setupTemplateProxy"],"sources":["../../../../src/internal/CustomTemplates/expandCustomTemplate.ts"],"sourcesContent":["import type {\n BrickConf,\n BrickConfInTemplate,\n SlotsConfInTemplate,\n SlotsConfOfBricks,\n UseSingleBrickConf,\n} from \"@next-core/types\";\nimport { uniqueId } from \"lodash\";\nimport { customTemplates } from \"../../CustomTemplates.js\";\nimport { DataStore } from \"../data/DataStore.js\";\nimport { RuntimeBrickConfWithTplSymbols } from \"./constants.js\";\nimport { setupTemplateProxy } from \"./setupTemplateProxy.js\";\nimport type {\n AsyncProperties,\n RuntimeBrick,\n TemplateHostBrick,\n TemplateHostContext,\n} from \"../interfaces.js\";\nimport { setupUseBrickInTemplate } from \"./setupUseBrickInTemplate.js\";\nimport { childrenToSlots } from \"../Renderer.js\";\nimport { collectWidgetContract } from \"../data/CollectContracts.js\";\n\nexport function expandCustomTemplate<T extends BrickConf | UseSingleBrickConf>(\n tplTagName: string,\n brickConf: T,\n hostBrick: RuntimeBrick,\n asyncHostProperties: AsyncProperties\n): T {\n const tplStateStoreId = uniqueId(\"tpl-state-\");\n const runtimeContext = {\n ...hostBrick.runtimeContext,\n tplStateStoreId,\n };\n\n // There is a boundary for `forEachItem` and `FORM_STATE` between template internals and externals.\n delete runtimeContext.forEachItem;\n delete runtimeContext.formStateStoreId;\n\n const tplStateStore = new DataStore(\"STATE\", hostBrick);\n runtimeContext.tplStateStoreMap.set(tplStateStoreId, tplStateStore);\n if (runtimeContext.tplStateStoreScope) {\n runtimeContext.tplStateStoreScope.push(tplStateStore);\n }\n\n const { bricks, proxy, state, contracts } = customTemplates.get(tplTagName)!;\n collectWidgetContract(contracts);\n tplStateStore.define(state, runtimeContext, asyncHostProperties);\n\n const {\n slots: originalExternalSlots,\n children: externalChildren,\n ...restBrickConf\n } = brickConf;\n\n const newBrickConf = {\n ...restBrickConf,\n brick: tplTagName,\n } as T;\n\n hostBrick.tplHostMetadata = {\n internalBricksByRef: new Map(),\n tplStateStoreId,\n proxy,\n };\n\n // Reversed proxies are used for expand storyboard before rendering page.\n const reversedProxies: TemplateHostContext[\"reversedProxies\"] = {\n properties: new Map(),\n slots: new Map(),\n // mergeBases: new Map(),\n };\n\n if (proxy?.properties) {\n for (const [from, to] of Object.entries(proxy.properties)) {\n let proxies = reversedProxies.properties.get(to.ref);\n if (!proxies) {\n proxies = [];\n reversedProxies.properties.set(to.ref, proxies);\n }\n proxies.push({\n from,\n to,\n });\n }\n }\n\n if (proxy?.slots) {\n for (const [from, to] of Object.entries(proxy.slots)) {\n let proxies = reversedProxies.slots.get(to.ref);\n if (!proxies) {\n proxies = [];\n reversedProxies.slots.set(to.ref, proxies);\n }\n proxies.push({\n from,\n to,\n });\n }\n }\n\n const hostContext: TemplateHostContext = {\n reversedProxies,\n asyncHostProperties,\n externalSlots: childrenToSlots(externalChildren, originalExternalSlots) as\n | SlotsConfOfBricks\n | undefined,\n tplStateStoreId,\n hostBrick: hostBrick as TemplateHostBrick,\n };\n\n newBrickConf.slots = {\n \"\": {\n type: \"bricks\",\n bricks: bricks.map((item) => expandBrickInTemplate(item, hostContext)),\n },\n };\n\n return newBrickConf;\n}\n\nfunction expandBrickInTemplate(\n brickConfInTemplate: BrickConfInTemplate,\n hostContext: TemplateHostContext\n): RuntimeBrickConfWithTplSymbols {\n // Ignore `if: null` to make `looseCheckIf` working.\n if (brickConfInTemplate.if === null) {\n delete brickConfInTemplate.if;\n }\n const {\n properties,\n slots: slotsInTemplate,\n children: childrenInTemplate,\n ...restBrickConfInTemplate\n } = brickConfInTemplate;\n\n const transpiledSlots = childrenToSlots(\n childrenInTemplate,\n slotsInTemplate\n ) as SlotsConfInTemplate | undefined;\n\n const slots: SlotsConfOfBricks = Object.fromEntries(\n Object.entries(transpiledSlots ?? {}).map(([slotName, slotConf]) => [\n slotName,\n {\n type: \"bricks\",\n bricks: (slotConf.bricks ?? []).map((item) =>\n expandBrickInTemplate(item, hostContext)\n ),\n },\n ])\n );\n\n return {\n ...restBrickConfInTemplate,\n properties: setupUseBrickInTemplate(properties, hostContext),\n slots,\n ...setupTemplateProxy(hostContext, restBrickConfInTemplate.ref, slots),\n };\n}\n"],"mappings":";;;;;;AAOA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEA,IAAAG,mBAAA,GAAAH,OAAA;AAOA,IAAAI,wBAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AAEO,SAASO,oBAAoBA,CAClCC,UAAkB,EAClBC,SAAY,EACZC,SAAuB,EACvBC,mBAAoC,EACjC;EACH,MAAMC,eAAe,GAAG,IAAAC,gBAAQ,EAAC,YAAY,CAAC;EAC9C,MAAMC,cAAc,GAAG;IACrB,GAAGJ,SAAS,CAACI,cAAc;IAC3BF;EACF,CAAC;;EAED;EACA,OAAOE,cAAc,CAACC,WAAW;EACjC,OAAOD,cAAc,CAACE,gBAAgB;EAEtC,MAAMC,aAAa,GAAG,IAAIC,oBAAS,CAAC,OAAO,EAAER,SAAS,CAAC;EACvDI,cAAc,CAACK,gBAAgB,CAACC,GAAG,CAACR,eAAe,EAAEK,aAAa,CAAC;EACnE,IAAIH,cAAc,CAACO,kBAAkB,EAAE;IACrCP,cAAc,CAACO,kBAAkB,CAACC,IAAI,CAACL,aAAa,CAAC;EACvD;EAEA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AAfA,eAAe,GAAI,CAAC,CAAC,CAAC,CAACR,GAAG,CAAC,CAAC,CAACU,QAAQ,EAAEC,QAAQ,CAAC;IAAA,IAAAC,gBAAA;IAAA,OAAK,CAClEF,QAAQ,EACR;MACEX,IAAI,EAAE,QAAQ;MACd7B,MAAM,EAAE,EAAA0C,gBAAA,GAACD,QAAQ,CAACzC,MAAM,cAAA0C,gBAAA,cAAAA,gBAAA,GAAI,EAAE,EAAEZ,GAAG,CAAEC,IAAI,IACvCC,qBAAqB,CAACD,IAAI,EAAEL,WAAW,CAAC;IAE5C,CAAC,CACF;EAAA,EAAC,CACH;EAED,OAAO;IACL,GAAGW,uBAAuB;IAC1BlB,UAAU,EAAE,IAAAwB,gDAAuB,EAACxB,UAAU,EAAEO,WAAW,CAAC;IAC5DlB,KAAK;IACL,GAAG,IAAAoC,sCAAkB,EAAClB,WAAW,EAAEW,uBAAuB,CAACZ,GAAG,EAAEjB,KAAK;EACvE,CAAC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["_CustomTemplates","require","getTplStateStore","tplStateStoreId","tplStateStoreMap","using","extraInfo","Error","store","get","getTplHostElement","runtimeContext","hostElement","hostBrick","element","getTagNameOfCustomTemplate","brick","appId","includes","startsWith","tagName","customTemplates"],"sources":["../../../../src/internal/CustomTemplates/utils.ts"],"sourcesContent":["import type { DataStore } from \"../data/DataStore.js\";\nimport type { RuntimeBrickElement, RuntimeContext } from \"../interfaces.js\";\nimport { customTemplates } from \"../../CustomTemplates.js\";\n\ntype MinimalTplStateStoreContext = Pick<\n RuntimeContext,\n \"tplStateStoreId\" | \"tplStateStoreMap\"\n>;\n\nexport function getTplStateStore(\n { tplStateStoreId, tplStateStoreMap }: MinimalTplStateStoreContext,\n using: string,\n extraInfo?: string\n): DataStore<\"STATE\"> {\n if (!tplStateStoreId) {\n throw new Error(\n `Using \"${using}\" outside of a custom template${extraInfo ?? \"\"}`\n );\n }\n const store = tplStateStoreMap.get(tplStateStoreId);\n if (!store) {\n throw new Error(\n `Template state store is not found when using \"${using}\"${\n extraInfo ?? \"\"\n }.\\nThis is a bug of Brick Next, please report it.`\n );\n }\n return store!;\n}\n\nexport function getTplHostElement(\n runtimeContext: MinimalTplStateStoreContext,\n using: string,\n extraInfo?: string\n): RuntimeBrickElement {\n const store = getTplStateStore(runtimeContext, using, extraInfo);\n const hostElement = store.hostBrick!.element;\n if (!hostElement) {\n throw new Error(\n `Template host element is gone when using \"${using}\"${\n extraInfo ?? \"\"\n }.\\nThis is a bug of Brick Next, please report it.`\n );\n }\n return hostElement!;\n}\n\nexport function getTagNameOfCustomTemplate(\n brick: string,\n appId?: string\n): false | string {\n // When a template is registered by an app, it's namespace maybe missed.\n if (!brick.includes(\".\") && brick.startsWith(\"tpl-\") && appId) {\n const tagName = `${appId}.${brick}`;\n if (customTemplates.get(tagName)) {\n return tagName;\n }\n }\n if (customTemplates.get(brick)) {\n return brick;\n }\n return false;\n}\n"],"mappings":";;;;;;;;AAEA,IAAAA,gBAAA,GAAAC,OAAA;AAOO,SAASC,gBAAgBA,CAC9B;EAAEC,eAAe;EAAEC;AAA8C,CAAC,EAClEC,KAAa,EACbC,SAAkB,EACE;EACpB,IAAI,CAACH,eAAe,EAAE;IACpB,MAAM,IAAII,KAAK,CACZ,UAASF,KAAM,iCAAgCC,SAAS,aAATA,SAAS,cAATA,SAAS,GAAI,EAAG,EAAC,CAClE;EACH;EACA,MAAME,KAAK,GAAGJ,gBAAgB,CAACK,GAAG,CAACN,eAAe,CAAC;EACnD,IAAI,CAACK,KAAK,EAAE;IACV,MAAM,IAAID,KAAK,CACZ,iDAAgDF,KAAM,IACrDC,SAAS,aAATA,SAAS,cAATA,SAAS,GAAI,EACd,mDAAkD,CACpD;EACH;EACA,OAAOE,KAAK;AACd;AAEO,SAASE,iBAAiBA,CAC/BC,cAA2C,EAC3CN,KAAa,EACbC,SAAkB,EACG;EACrB,MAAME,KAAK,GAAGN,gBAAgB,CAACS,cAAc,EAAEN,KAAK,EAAEC,SAAS,CAAC;EAChE,MAAMM,WAAW,GAAGJ,KAAK,CAACK,SAAS,CAAEC,OAAO;EAC5C,IAAI,CAACF,WAAW,EAAE;IAChB,MAAM,IAAIL,KAAK,CACZ,6CAA4CF,KAAM,IACjDC,SAAS,aAATA,SAAS,cAATA,SAAS,GAAI,EACd,mDAAkD,CACpD;EACH;EACA,OAAOM,WAAW;AACpB;AAEO,SAASG,0BAA0BA,CACxCC,KAAa,EACbC,KAAc,EACE;EAChB;EACA,IAAI,CAACD,KAAK,CAACE,QAAQ,CAAC,GAAG,CAAC,IAAIF,KAAK,CAACG,UAAU,CAAC,MAAM,CAAC,IAAIF,KAAK,EAAE;IAC7D,MAAMG,OAAO,GAAI,GAAEH,KAAM,IAAGD,KAAM,EAAC;IACnC,IAAIK,gCAAe,CAACZ,GAAG,CAACW,OAAO,CAAC,EAAE;MAChC,OAAOA,OAAO;IAChB;EACF;EACA,IAAIC,gCAAe,CAACZ,GAAG,CAACO,KAAK,CAAC,EAAE;IAC9B,OAAOA,KAAK;EACd;EACA,OAAO,KAAK;AACd"}
1
+ {"version":3,"file":"utils.js","names":["_CustomTemplates","require","getTplStateStore","tplStateStoreId","tplStateStoreMap","using","extraInfo","Error","store","get","getTplHostElement","runtimeContext","hostElement","hostBrick","element","getTagNameOfCustomTemplate","brick","appId","includes","startsWith","tagName","customTemplates"],"sources":["../../../../src/internal/CustomTemplates/utils.ts"],"sourcesContent":["import type { DataStore } from \"../data/DataStore.js\";\nimport type { RuntimeBrickElement, RuntimeContext } from \"../interfaces.js\";\nimport { customTemplates } from \"../../CustomTemplates.js\";\n\ntype MinimalTplStateStoreContext = Pick<\n RuntimeContext,\n \"tplStateStoreId\" | \"tplStateStoreMap\"\n>;\n\nexport function getTplStateStore(\n { tplStateStoreId, tplStateStoreMap }: MinimalTplStateStoreContext,\n using: string,\n extraInfo?: string\n): DataStore<\"STATE\"> {\n if (!tplStateStoreId) {\n throw new Error(\n `Using \"${using}\" outside of a custom template${extraInfo ?? \"\"}`\n );\n }\n const store = tplStateStoreMap.get(tplStateStoreId);\n if (!store) {\n throw new Error(\n `Template state store is not found when using \"${using}\"${\n extraInfo ?? \"\"\n }.\\nThis is a bug of Brick Next, please report it.`\n );\n }\n return store;\n}\n\nexport function getTplHostElement(\n runtimeContext: MinimalTplStateStoreContext,\n using: string,\n extraInfo?: string\n): RuntimeBrickElement {\n const store = getTplStateStore(runtimeContext, using, extraInfo);\n const hostElement = store.hostBrick!.element;\n if (!hostElement) {\n throw new Error(\n `Template host element is gone when using \"${using}\"${\n extraInfo ?? \"\"\n }.\\nThis is a bug of Brick Next, please report it.`\n );\n }\n return hostElement;\n}\n\nexport function getTagNameOfCustomTemplate(\n brick: string,\n appId?: string\n): false | string {\n // When a template is registered by an app, it's namespace maybe missed.\n if (!brick.includes(\".\") && brick.startsWith(\"tpl-\") && appId) {\n const tagName = `${appId}.${brick}`;\n if (customTemplates.get(tagName)) {\n return tagName;\n }\n }\n if (customTemplates.get(brick)) {\n return brick;\n }\n return false;\n}\n"],"mappings":";;;;;;;;AAEA,IAAAA,gBAAA,GAAAC,OAAA;AAOO,SAASC,gBAAgBA,CAC9B;EAAEC,eAAe;EAAEC;AAA8C,CAAC,EAClEC,KAAa,EACbC,SAAkB,EACE;EACpB,IAAI,CAACH,eAAe,EAAE;IACpB,MAAM,IAAII,KAAK,CACZ,UAASF,KAAM,iCAAgCC,SAAS,aAATA,SAAS,cAATA,SAAS,GAAI,EAAG,EAAC,CAClE;EACH;EACA,MAAME,KAAK,GAAGJ,gBAAgB,CAACK,GAAG,CAACN,eAAe,CAAC;EACnD,IAAI,CAACK,KAAK,EAAE;IACV,MAAM,IAAID,KAAK,CACZ,iDAAgDF,KAAM,IACrDC,SAAS,aAATA,SAAS,cAATA,SAAS,GAAI,EACd,mDAAkD,CACpD;EACH;EACA,OAAOE,KAAK;AACd;AAEO,SAASE,iBAAiBA,CAC/BC,cAA2C,EAC3CN,KAAa,EACbC,SAAkB,EACG;EACrB,MAAME,KAAK,GAAGN,gBAAgB,CAACS,cAAc,EAAEN,KAAK,EAAEC,SAAS,CAAC;EAChE,MAAMM,WAAW,GAAGJ,KAAK,CAACK,SAAS,CAAEC,OAAO;EAC5C,IAAI,CAACF,WAAW,EAAE;IAChB,MAAM,IAAIL,KAAK,CACZ,6CAA4CF,KAAM,IACjDC,SAAS,aAATA,SAAS,cAATA,SAAS,GAAI,EACd,mDAAkD,CACpD;EACH;EACA,OAAOM,WAAW;AACpB;AAEO,SAASG,0BAA0BA,CACxCC,KAAa,EACbC,KAAc,EACE;EAChB;EACA,IAAI,CAACD,KAAK,CAACE,QAAQ,CAAC,GAAG,CAAC,IAAIF,KAAK,CAACG,UAAU,CAAC,MAAM,CAAC,IAAIF,KAAK,EAAE;IAC7D,MAAMG,OAAO,GAAI,GAAEH,KAAM,IAAGD,KAAM,EAAC;IACnC,IAAIK,gCAAe,CAACZ,GAAG,CAACW,OAAO,CAAC,EAAE;MAChC,OAAOA,OAAO;IAChB;EACF;EACA,IAAIC,gCAAe,CAACZ,GAAG,CAACO,KAAK,CAAC,EAAE;IAC9B,OAAOA,KAAK;EACd;EACA,OAAO,KAAK;AACd"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.symbolForFormStateStoreId = exports.FORM_RENDERER = void 0;
7
+ const FORM_RENDERER = "form-renderer.form-renderer";
8
+ exports.FORM_RENDERER = FORM_RENDERER;
9
+ const symbolForFormStateStoreId = Symbol.for("form.stateStoreId");
10
+ exports.symbolForFormStateStoreId = symbolForFormStateStoreId;
11
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","names":["FORM_RENDERER","exports","symbolForFormStateStoreId","Symbol","for"],"sources":["../../../../src/internal/FormRenderer/constants.ts"],"sourcesContent":["import type { BrickConf } from \"@next-core/types\";\n\nexport const FORM_RENDERER = \"form-renderer.form-renderer\";\nexport const symbolForFormStateStoreId = Symbol.for(\"form.stateStoreId\");\n\nexport type RuntimeBrickConfWithFormSymbols = BrickConf &\n RuntimeBrickConfOfFormSymbols;\n\nexport interface RuntimeBrickConfOfFormSymbols {\n [symbolForFormStateStoreId]?: string;\n}\n"],"mappings":";;;;;;AAEO,MAAMA,aAAa,GAAG,6BAA6B;AAACC,OAAA,CAAAD,aAAA,GAAAA,aAAA;AACpD,MAAME,yBAAyB,GAAGC,MAAM,CAACC,GAAG,CAAC,mBAAmB,CAAC;AAACH,OAAA,CAAAC,yBAAA,GAAAA,yBAAA"}
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.expandFormRenderer = expandFormRenderer;
7
+ var _general = require("@next-core/utils/general");
8
+ var _lodash = require("lodash");
9
+ var _DataStore = require("../data/DataStore.js");
10
+ var _getDefaultProperties = require("./getDefaultProperties.js");
11
+ var _constants = require("./constants.js");
12
+ function expandFormRenderer(formData, hostBrickConf, hostBrick, asyncHostProperties) {
13
+ var _normalizedFormData$c, _hostBrickConf$proper;
14
+ const normalizedFormData = typeof formData === "string" ? JSON.parse(formData) : formData;
15
+ const formStateStoreId = (0, _lodash.uniqueId)("form-state-");
16
+ const runtimeContext = {
17
+ ...hostBrick.runtimeContext,
18
+ formStateStoreId
19
+ };
20
+
21
+ // There is a boundary for `forEachItem` and `STATE` between form internals and externals.
22
+ delete runtimeContext.forEachItem;
23
+ delete runtimeContext.tplStateStoreId;
24
+ const formStateStore = new _DataStore.DataStore("FORM_STATE");
25
+ runtimeContext.formStateStoreMap.set(formStateStoreId, formStateStore);
26
+ if (runtimeContext.formStateStoreScope) {
27
+ runtimeContext.formStateStoreScope.push(formStateStore);
28
+ }
29
+
30
+ // Always add a state of `params`.
31
+ const context = (_normalizedFormData$c = normalizedFormData.context) !== null && _normalizedFormData$c !== void 0 ? _normalizedFormData$c : [];
32
+ if (!context.some(ctx => ctx.name === "params")) {
33
+ context.push({
34
+ name: "params"
35
+ });
36
+ }
37
+ formStateStore.define(context, runtimeContext, asyncHostProperties);
38
+ const formConf = formSchemaToBrick(normalizedFormData.formSchema, normalizedFormData.fields, formStateStoreId);
39
+ if (formConf.brick === "forms.general-form" && hostBrickConf.events) {
40
+ formConf.events = mergeEvents(formConf.events, hostBrickConf.events);
41
+ }
42
+ const renderRoot = typeof ((_hostBrickConf$proper = hostBrickConf.properties) === null || _hostBrickConf$proper === void 0 ? void 0 : _hostBrickConf$proper.renderRoot) !== "boolean" || hostBrickConf.properties.renderRoot;
43
+ if (renderRoot) {
44
+ return {
45
+ ...hostBrickConf,
46
+ slots: undefined,
47
+ children: [{
48
+ brick: "basic-bricks.micro-view",
49
+ properties: {
50
+ style: {
51
+ padding: "12px"
52
+ }
53
+ },
54
+ slots: {
55
+ content: {
56
+ bricks: [formConf],
57
+ type: "bricks"
58
+ }
59
+ }
60
+ }]
61
+ };
62
+ }
63
+ return {
64
+ ...hostBrickConf,
65
+ slots: undefined,
66
+ children: [formConf]
67
+ };
68
+ }
69
+ function formSchemaToBrick(schema, fields, formStateStoreId) {
70
+ const {
71
+ id,
72
+ bricks,
73
+ events,
74
+ context,
75
+ mountPoint,
76
+ instanceId: iid
77
+ } = schema;
78
+ let {
79
+ brick,
80
+ properties
81
+ } = schema;
82
+
83
+ // 根据字段类型获取默认配置
84
+ const field = fields.find(item => item.fieldId === id);
85
+ if (field) {
86
+ const defaults = (0, _getDefaultProperties.getDefaultProperties)(field);
87
+ if (!brick) {
88
+ brick = defaults.brick;
89
+ }
90
+ properties = {
91
+ ...defaults.properties,
92
+ ...properties
93
+ };
94
+ }
95
+ const brickConf = {
96
+ brick,
97
+ properties,
98
+ iid,
99
+ slot: mountPoint,
100
+ events,
101
+ context,
102
+ children: formSchemasToBricks(bricks, fields, formStateStoreId),
103
+ [_constants.symbolForFormStateStoreId]: formStateStoreId
104
+ };
105
+ if ((0, _general.hasOwnProperty)(schema, "if")) {
106
+ brickConf.if = schema.if;
107
+ }
108
+ return brickConf;
109
+ }
110
+ function formSchemasToBricks(schemas, fields, formStateStoreId) {
111
+ if (Array.isArray(schemas)) {
112
+ return schemas.map(schema => formSchemaToBrick(schema, fields, formStateStoreId));
113
+ }
114
+ }
115
+ function mergeEvents(targetEvents, sourceEvents) {
116
+ const events = targetEvents !== null && targetEvents !== void 0 ? targetEvents : {};
117
+ for (const [eventType, handlers] of Object.entries(sourceEvents)) {
118
+ events[eventType] = (0, _general.hasOwnProperty)(events, eventType) ? [events[eventType], handlers].flat() : handlers;
119
+ }
120
+ return events;
121
+ }
122
+ //# sourceMappingURL=expandFormRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expandFormRenderer.js","names":["_general","require","_lodash","_DataStore","_getDefaultProperties","_constants","expandFormRenderer","formData","hostBrickConf","hostBrick","asyncHostProperties","_normalizedFormData$c","_hostBrickConf$proper","normalizedFormData","JSON","parse","formStateStoreId","uniqueId","runtimeContext","forEachItem","tplStateStoreId","formStateStore","DataStore","formStateStoreMap","set","formStateStoreScope","push","context","some","ctx","name","define","formConf","formSchemaToBrick","formSchema","fields","brick","events","mergeEvents","renderRoot","properties","slots","undefined","children","style","padding","content","bricks","type","schema","id","mountPoint","instanceId","iid","field","find","item","fieldId","defaults","getDefaultProperties","brickConf","slot","formSchemasToBricks","symbolForFormStateStoreId","hasOwnProperty","if","schemas","Array","isArray","map","targetEvents","sourceEvents","eventType","handlers","Object","entries","flat"],"sources":["../../../../src/internal/FormRenderer/expandFormRenderer.ts"],"sourcesContent":["import type { BrickConf, BrickEventsMap } from \"@next-core/types\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nimport { uniqueId } from \"lodash\";\nimport { DataStore } from \"../data/DataStore.js\";\nimport type { AsyncProperties, RuntimeBrick } from \"../interfaces.js\";\nimport type {\n FieldProperties,\n FormDataProperties,\n FormSchemaProperties,\n} from \"./interfaces.js\";\nimport { getDefaultProperties } from \"./getDefaultProperties.js\";\nimport { symbolForFormStateStoreId } from \"./constants.js\";\n\nexport function expandFormRenderer(\n formData: unknown,\n hostBrickConf: BrickConf,\n hostBrick: RuntimeBrick,\n asyncHostProperties: AsyncProperties\n): BrickConf {\n const normalizedFormData = (\n typeof formData === \"string\" ? JSON.parse(formData) : formData\n ) as FormDataProperties;\n\n const formStateStoreId = uniqueId(\"form-state-\");\n const runtimeContext = {\n ...hostBrick.runtimeContext,\n formStateStoreId,\n };\n\n // There is a boundary for `forEachItem` and `STATE` between form internals and externals.\n delete runtimeContext.forEachItem;\n delete runtimeContext.tplStateStoreId;\n\n const formStateStore = new DataStore(\"FORM_STATE\");\n runtimeContext.formStateStoreMap.set(formStateStoreId, formStateStore);\n if (runtimeContext.formStateStoreScope) {\n runtimeContext.formStateStoreScope.push(formStateStore);\n }\n\n // Always add a state of `params`.\n const context = normalizedFormData.context ?? [];\n if (!context.some((ctx) => ctx.name === \"params\")) {\n context.push({ name: \"params\" });\n }\n\n formStateStore.define(context, runtimeContext, asyncHostProperties);\n\n const formConf = formSchemaToBrick(\n normalizedFormData.formSchema,\n normalizedFormData.fields,\n formStateStoreId\n );\n\n if (formConf.brick === \"forms.general-form\" && hostBrickConf.events) {\n formConf.events = mergeEvents(formConf.events, hostBrickConf.events);\n }\n\n const renderRoot =\n typeof hostBrickConf.properties?.renderRoot !== \"boolean\" ||\n hostBrickConf.properties.renderRoot;\n\n if (renderRoot) {\n return {\n ...hostBrickConf,\n slots: undefined,\n children: [\n {\n brick: \"basic-bricks.micro-view\",\n properties: { style: { padding: \"12px\" } },\n slots: {\n content: { bricks: [formConf], type: \"bricks\" },\n },\n },\n ],\n };\n }\n\n return {\n ...hostBrickConf,\n slots: undefined,\n children: [formConf],\n };\n}\n\nfunction formSchemaToBrick(\n schema: FormSchemaProperties,\n fields: FieldProperties[],\n formStateStoreId: string\n): BrickConf {\n const { id, bricks, events, context, mountPoint, instanceId: iid } = schema;\n let { brick, properties } = schema;\n\n // 根据字段类型获取默认配置\n const field = fields.find((item: FieldProperties) => item.fieldId === id);\n if (field) {\n const defaults = getDefaultProperties(field);\n if (!brick) {\n brick = defaults.brick;\n }\n properties = {\n ...defaults.properties,\n ...properties,\n };\n }\n\n const brickConf = {\n brick,\n properties,\n iid,\n slot: mountPoint,\n events,\n context,\n children: formSchemasToBricks(bricks, fields, formStateStoreId),\n [symbolForFormStateStoreId]: formStateStoreId,\n } as BrickConf;\n\n if (hasOwnProperty(schema, \"if\")) {\n brickConf.if = schema.if;\n }\n\n return brickConf;\n}\n\nfunction formSchemasToBricks(\n schemas: FormSchemaProperties[] | undefined,\n fields: FieldProperties[],\n formStateStoreId: string\n): BrickConf[] | undefined {\n if (Array.isArray(schemas)) {\n return schemas.map((schema) =>\n formSchemaToBrick(schema, fields, formStateStoreId)\n );\n }\n}\n\nfunction mergeEvents(\n targetEvents: BrickEventsMap | undefined,\n sourceEvents: BrickEventsMap\n): BrickEventsMap {\n const events = targetEvents ?? {};\n\n for (const [eventType, handlers] of Object.entries(sourceEvents)) {\n events[eventType] = hasOwnProperty(events, eventType)\n ? [events[eventType], handlers].flat()\n : handlers;\n }\n\n return events;\n}\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAOA,IAAAG,qBAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAEO,SAASK,kBAAkBA,CAChCC,QAAiB,EACjBC,aAAwB,EACxBC,SAAuB,EACvBC,mBAAoC,EACzB;EAAA,IAAAC,qBAAA,EAAAC,qBAAA;EACX,MAAMC,kBAAkB,GACtB,OAAON,QAAQ,KAAK,QAAQ,GAAGO,IAAI,CAACC,KAAK,CAACR,QAAQ,CAAC,GAAGA,QACjC;EAEvB,MAAMS,gBAAgB,GAAG,IAAAC,gBAAQ,EAAC,aAAa,CAAC;EAChD,MAAMC,cAAc,GAAG;IACrB,GAAGT,SAAS,CAACS,cAAc;IAC3BF;EACF,CAA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AAI,IAAAgD,uBAAc,EAACf,MAAM,EAAE,IAAI,CAAC,EAAE;IAChCW,SAAS,CAACK,EAAE,GAAGhB,MAAM,CAACgB,EAAE;EAC1B;EAEA,OAAOL,SAAS;AAClB;AAEA,SAASE,mBAAmBA,CAC1BI,OAA2C,EAC3C/B,MAAyB,EACzBnB,gBAAwB,EACC;EACzB,IAAImD,KAAK,CAACC,OAAO,CAACF,OAAO,CAAC,EAAE;IAC1B,OAAOA,OAAO,CAACG,GAAG,CAAEpB,MAAM,IACxBhB,iBAAiB,CAACgB,MAAM,EAAEd,MAAM,EAAEnB,gBAAgB,CAAC,CACpD;EACH;AACF;AAEA,SAASsB,WAAWA,CAClBgC,YAAwC,EACxCC,YAA4B,EACZ;EAChB,MAAMlC,MAAM,GAAGiC,YAAY,aAAZA,YAAY,cAAZA,YAAY,GAAI,CAAC,CAAC;EAEjC,KAAK,MAAM,CAACE,SAAS,EAAEC,QAAQ,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACJ,YAAY,CAAC,EAAE;IAChElC,MAAM,CAACmC,SAAS,CAAC,GAAG,IAAAR,uBAAc,EAAC3B,MAAM,EAAEmC,SAAS,CAAC,GACjD,CAACnC,MAAM,CAACmC,SAAS,CAAC,EAAEC,QAAQ,CAAC,CAACG,IAAI,EAAE,GACpCH,QAAQ;EACd;EAEA,OAAOpC,MAAM;AACf"}
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getDefaultProperties = getDefaultProperties;
7
+ function getDefaultProperties(field) {
8
+ let defaultValue;
9
+ const commonProps = {
10
+ id: field.fieldId,
11
+ name: field.fieldId,
12
+ label: field.name,
13
+ dataset: {
14
+ testid: field.fieldId
15
+ }
16
+ };
17
+ const getReadOnlyAndRequired = () => {
18
+ var _field$limit, _field$limit2;
19
+ return {
20
+ readOnly: (_field$limit = field.limit) === null || _field$limit === void 0 ? void 0 : _field$limit.includes("READONLY"),
21
+ required: (_field$limit2 = field.limit) === null || _field$limit2 === void 0 ? void 0 : _field$limit2.includes("REQUIRED")
22
+ };
23
+ };
24
+ switch (field.fieldType) {
25
+ case "INT":
26
+ defaultValue = {
27
+ brick: "forms.general-input-number",
28
+ properties: {
29
+ ...commonProps,
30
+ ...getReadOnlyAndRequired(),
31
+ placeholder: field.description,
32
+ precision: 0,
33
+ inputBoxStyle: {
34
+ width: "100%"
35
+ }
36
+ }
37
+ };
38
+ break;
39
+ case "BOOLEAN":
40
+ defaultValue = {
41
+ brick: "forms.general-switch",
42
+ properties: {
43
+ ...commonProps,
44
+ ...getReadOnlyAndRequired()
45
+ }
46
+ };
47
+ break;
48
+ case "FLOAT":
49
+ defaultValue = {
50
+ brick: "forms.general-input-number",
51
+ properties: {
52
+ ...commonProps,
53
+ ...getReadOnlyAndRequired(),
54
+ placeholder: field.description,
55
+ inputBoxStyle: {
56
+ width: "100%"
57
+ }
58
+ }
59
+ };
60
+ break;
61
+ case "ENUM":
62
+ defaultValue = {
63
+ brick: "forms.general-select",
64
+ properties: {
65
+ ...commonProps,
66
+ ...getReadOnlyAndRequired(),
67
+ options: [{
68
+ label: "选项一",
69
+ value: 1
70
+ }, {
71
+ label: "选项二",
72
+ value: 2
73
+ }],
74
+ placeholder: field.description,
75
+ inputBoxStyle: {
76
+ width: "100%"
77
+ }
78
+ }
79
+ };
80
+ break;
81
+ case "ENUMS":
82
+ defaultValue = {
83
+ brick: "forms.general-select",
84
+ properties: {
85
+ ...commonProps,
86
+ ...getReadOnlyAndRequired(),
87
+ mode: "multiple",
88
+ options: [{
89
+ label: "选项一",
90
+ value: 1
91
+ }, {
92
+ label: "选项二",
93
+ value: 2
94
+ }],
95
+ placeholder: field.description,
96
+ inputBoxStyle: {
97
+ width: "100%"
98
+ }
99
+ }
100
+ };
101
+ break;
102
+ case "DATE":
103
+ case "TIME":
104
+ defaultValue = {
105
+ brick: "forms.general-date-picker",
106
+ properties: {
107
+ ...commonProps,
108
+ ...getReadOnlyAndRequired(),
109
+ placeholder: field.description
110
+ }
111
+ };
112
+ break;
113
+ case "IP":
114
+ defaultValue = {
115
+ brick: "forms.general-input",
116
+ properties: {
117
+ ...commonProps,
118
+ ...getReadOnlyAndRequired(),
119
+ placeholder: field.description,
120
+ pattern: "((^s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))s*$)|(^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*$))",
121
+ message: {
122
+ pattern: "输入字符不匹配IP格式"
123
+ }
124
+ }
125
+ };
126
+ break;
127
+ case "JSON":
128
+ defaultValue = {
129
+ brick: "forms.general-textarea",
130
+ properties: {
131
+ ...commonProps
132
+ }
133
+ };
134
+ break;
135
+ case "ARRAY":
136
+ defaultValue = {
137
+ brick: "forms.general-select",
138
+ properties: {
139
+ ...commonProps
140
+ }
141
+ };
142
+ break;
143
+ case "STRUCTURE":
144
+ case "STRUCTURE_ARRAY":
145
+ defaultValue = {
146
+ brick: "forms.cmdb-instance-select-panel",
147
+ properties: {
148
+ ...commonProps,
149
+ ...getReadOnlyAndRequired()
150
+ }
151
+ };
152
+ break;
153
+ default:
154
+ defaultValue = {
155
+ brick: "forms.general-input",
156
+ properties: {
157
+ ...commonProps,
158
+ ...getReadOnlyAndRequired(),
159
+ placeholder: field.description
160
+ }
161
+ };
162
+ }
163
+ return defaultValue;
164
+ }
165
+ //# sourceMappingURL=getDefaultProperties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDefaultProperties.js","names":["getDefaultProperties","field","defaultValue","commonProps","id","fieldId","name","label","dataset","testid","getReadOnlyAndRequired","_field$limit","_field$limit2","readOnly","limit","includes","required","fieldType","brick","properties","placeholder","description","precision","inputBoxStyle","width","options","value","mode","pattern","message"],"sources":["../../../../src/internal/FormRenderer/getDefaultProperties.ts"],"sourcesContent":["import type { DefaultFieldProperties, FieldProperties } from \"./interfaces.js\";\n\nexport function getDefaultProperties(\n field: FieldProperties\n): DefaultFieldProperties {\n let defaultValue: DefaultFieldProperties;\n const commonProps = {\n id: field.fieldId,\n name: field.fieldId,\n label: field.name,\n dataset: {\n testid: field.fieldId,\n },\n };\n const getReadOnlyAndRequired = () => ({\n readOnly: field.limit?.includes(\"READONLY\"),\n required: field.limit?.includes(\"REQUIRED\"),\n });\n switch (field.fieldType) {\n case \"INT\":\n defaultValue = {\n brick: \"forms.general-input-number\",\n properties: {\n ...commonProps,\n ...getReadOnlyAndRequired(),\n placeholder: field.description,\n precision: 0,\n inputBoxStyle: { width: \"100%\" },\n },\n };\n break;\n case \"BOOLEAN\":\n defaultValue = {\n brick: \"forms.general-switch\",\n properties: {\n ...commonProps,\n ...getReadOnlyAndRequired(),\n },\n };\n break;\n case \"FLOAT\":\n defaultValue = {\n brick: \"forms.general-input-number\",\n properties: {\n ...commonProps,\n ...getReadOnlyAndRequired(),\n placeholder: field.description,\n inputBoxStyle: { width: \"100%\" },\n },\n };\n break;\n case \"ENUM\":\n defaultValue = {\n brick: \"forms.general-select\",\n properties: {\n ...commonProps,\n ...getReadOnlyAndRequired(),\n options: [\n { label: \"选项一\", value: 1 },\n { label: \"选项二\", value: 2 },\n ],\n placeholder: field.description,\n inputBoxStyle: { width: \"100%\" },\n },\n };\n break;\n case \"ENUMS\":\n defaultValue = {\n brick: \"forms.general-select\",\n properties: {\n ...commonProps,\n ...getReadOnlyAndRequired(),\n mode: \"multiple\",\n options: [\n { label: \"选项一\", value: 1 },\n { label: \"选项二\", value: 2 },\n ],\n placeholder: field.description,\n inputBoxStyle: { width: \"100%\" },\n },\n };\n break;\n case \"DATE\":\n case \"TIME\":\n defaultValue = {\n brick: \"forms.general-date-picker\",\n properties: {\n ...commonProps,\n ...getReadOnlyAndRequired(),\n placeholder: field.description,\n },\n };\n break;\n case \"IP\":\n defaultValue = {\n brick: \"forms.general-input\",\n properties: {\n ...commonProps,\n ...getReadOnlyAndRequired(),\n placeholder: field.description,\n pattern:\n \"((^s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))s*$)|(^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*$))\",\n message: {\n pattern: \"输入字符不匹配IP格式\",\n },\n },\n };\n break;\n case \"JSON\":\n defaultValue = {\n brick: \"forms.general-textarea\",\n properties: {\n ...commonProps,\n },\n };\n break;\n case \"ARRAY\":\n defaultValue = {\n brick: \"forms.general-select\",\n properties: {\n ...commonProps,\n },\n };\n break;\n case \"STRUCTURE\":\n case \"STRUCTURE_ARRAY\":\n defaultValue = {\n brick: \"forms.cmdb-instance-select-panel\",\n properties: {\n ...commonProps,\n ...getReadOnlyAndRequired(),\n },\n };\n break;\n default:\n defaultValue = {\n brick: \"forms.general-input\",\n properties: {\n ...commonProps,\n ...getReadOnlyAndRequired(),\n placeholder: field.description,\n },\n };\n }\n return defaultValue;\n}\n"],"mappings":";;;;;;AAEO,SAASA,oBAAoBA,CAClCC,KAAsB,EACE;EACxB,IAAIC,YAAoC;EACxC,MAAMC,WAAW,GAAG;IAClBC,EAAE,EAAEH,KAAK,CAACI,OAAO;IACjBC,IAAI,EAAEL,KAAK,CAACI,OAAO;IACnBE,KAAK,EAAEN,KAAK,CAACK,IAAI;IACjBE,OAAO,EAAE;MACPC,MAAM,EAAER,KAAK,CAACI;IAChB;EACF,CAAC;EACD,MAAMK,sBAAsB,GAAGA,CAAA;IAAA,IAAAC,YAAA,EAAAC,aAAA;IAAA,OAAO;MACpCC,QAAQ,GAAAF,YAAA,GAAEV,KAAK,CAACa,KAAK,cAAAH,YAAA,uBAAXA,YAAA,CAAaI,QAAQ,CAAC,UAAU,CAAC;MAC3CC,QAAQ,GAAAJ,aAAA,GAAEX,KAAK,CAACa,KAAK,cAAAF,aAAA,uBAAXA,aAAA,CAAaG,QAAQ,CAAC,UAAU;IAC5C,CAAC;EAAA,CAAC;EACF,QAAQd,KAAK,CAACgB,SAAS;IACrB,KAAK,KAAK;MACRf,YAAY,GAAG;QACbgB,KAAK,EAAE,4BAA4B;QACnCC,UAAU,EAAE;UACV,GAAGhB,WAAW;UACd,GAAGO,sBAAsB,EAAE;UAC3BU,WAAW,EAAEnB,KAAK,CAACoB,WAAW;UAC9BC,SAAS,EAAE,CAAC;UACZC,aAAa,EAAE;YAAEC,KAAK,E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F,KAAK,MAAM;IACX,KAAK,MAAM;MACTtB,YAAY,GAAG;QACbgB,KAAK,EAAE,2BAA2B;QAClCC,UAAU,EAAE;UACV,GAAGhB,WAAW;UACd,GAAGO,sBAAsB,EAAE;UAC3BU,WAAW,EAAEnB,KAAK,CAACoB;QACrB;MACF,CAAC;MACD;IACF,KAAK,IAAI;MACPnB,YAAY,GAAG;QACbgB,KAAK,EAAE,qBAAqB;QAC5BC,UAAU,EAAE;UACV,GAAGhB,WAAW;UACd,GAAGO,sBAAsB,EAAE;UAC3BU,WAAW,EAAEnB,KAAK,CAACoB,WAAW;UAC9BO,OAAO,EACL,6mCAA6mC;UAC/mCC,OAAO,EAAE;YACPD,OAAO,EAAE;UACX;QACF;MACF,CAAC;MACD;IACF,KAAK,MAAM;MACT1B,YAAY,GAAG;QACbgB,KAAK,EAAE,wBAAwB;QAC/BC,UAAU,EAAE;UACV,GAAGhB;QACL;MACF,CAAC;MACD;IACF,KAAK,OAAO;MACVD,YAAY,GAAG;QACbgB,KAAK,EAAE,sBAAsB;QAC7BC,UAAU,EAAE;UACV,GAAGhB;QACL;MACF,CAAC;MACD;IACF,KAAK,WAAW;IAChB,KAAK,iBAAiB;MACpBD,YAAY,GAAG;QACbgB,KAAK,EAAE,kCAAkC;QACzCC,UAAU,EAAE;UACV,GAAGhB,WAAW;UACd,GAAGO,sBAAsB;QAC3B;MACF,CAAC;MACD;IACF;MACER,YAAY,GAAG;QACbgB,KAAK,EAAE,qBAAqB;QAC5BC,UAAU,EAAE;UACV,GAAGhB,WAAW;UACd,GAAGO,sBAAsB,EAAE;UAC3BU,WAAW,EAAEnB,KAAK,CAACoB;QACrB;MACF,CAAC;EAAC;EAEN,OAAOnB,YAAY;AACrB"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","names":[],"sources":["../../../../src/internal/FormRenderer/interfaces.ts"],"sourcesContent":["import type {\n BrickEventsMap,\n ContextConf,\n ResolveConf,\n} from \"@next-core/types\";\n\nexport interface FormDataProperties {\n formSchema: FormSchemaProperties;\n fields: FieldProperties[];\n context?: ContextConf[];\n // [key: string]: any;\n}\n\nexport interface FormSchemaProperties {\n id: string;\n brick?: string;\n sort?: number;\n mountPoint?: string;\n events?: BrickEventsMap;\n properties?: Record<string, unknown>;\n if?: string | boolean | ResolveConf;\n instanceId?: string;\n context?: ContextConf[];\n bricks?: FormSchemaProperties[];\n // [key: string]: any;\n}\n\nexport interface FieldProperties {\n defaultValue?: string;\n description?: string;\n fieldId: string;\n limit?: string[];\n name: string;\n fieldType: string;\n // [key: string]: any;\n}\n\nexport interface DefaultFieldProperties {\n brick: string;\n properties: Record<string, unknown>;\n}\n"],"mappings":""}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getFormStateStore = getFormStateStore;
7
+ function getFormStateStore({
8
+ formStateStoreId,
9
+ formStateStoreMap
10
+ }, using, extraInfo) {
11
+ if (!formStateStoreId) {
12
+ throw new Error(`Using "${using}" outside of form renderer${extraInfo !== null && extraInfo !== void 0 ? extraInfo : ""}`);
13
+ }
14
+ const store = formStateStoreMap.get(formStateStoreId);
15
+ if (!store) {
16
+ throw new Error(`Form state store is not found when using "${using}"${extraInfo !== null && extraInfo !== void 0 ? extraInfo : ""}.\nThis is a bug of Brick Next, please report it.`);
17
+ }
18
+ return store;
19
+ }
20
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":["getFormStateStore","formStateStoreId","formStateStoreMap","using","extraInfo","Error","store","get"],"sources":["../../../../src/internal/FormRenderer/utils.ts"],"sourcesContent":["import type { DataStore } from \"../data/DataStore.js\";\nimport type { RuntimeContext } from \"../interfaces.js\";\n\ntype MinimalTplStateStoreContext = Pick<\n RuntimeContext,\n \"formStateStoreId\" | \"formStateStoreMap\"\n>;\n\nexport function getFormStateStore(\n { formStateStoreId, formStateStoreMap }: MinimalTplStateStoreContext,\n using: string,\n extraInfo?: string\n): DataStore<\"FORM_STATE\"> {\n if (!formStateStoreId) {\n throw new Error(\n `Using \"${using}\" outside of form renderer${extraInfo ?? \"\"}`\n );\n }\n const store = formStateStoreMap.get(formStateStoreId);\n if (!store) {\n throw new Error(\n `Form state store is not found when using \"${using}\"${\n extraInfo ?? \"\"\n }.\\nThis is a bug of Brick Next, please report it.`\n );\n }\n return store;\n}\n"],"mappings":";;;;;;AAQO,SAASA,iBAAiBA,CAC/B;EAAEC,gBAAgB;EAAEC;AAA+C,CAAC,EACpEC,KAAa,EACbC,SAAkB,EACO;EACzB,IAAI,CAACH,gBAAgB,EAAE;IACrB,MAAM,IAAII,KAAK,CACZ,UAASF,KAAM,6BAA4BC,SAAS,aAATA,SAAS,cAATA,SAAS,GAAI,EAAG,EAAC,CAC9D;EACH;EACA,MAAME,KAAK,GAAGJ,iBAAiB,CAACK,GAAG,CAACN,gBAAgB,CAAC;EACrD,IAAI,CAACK,KAAK,EAAE;IACV,MAAM,IAAID,KAAK,CACZ,6CAA4CF,KAAM,IACjDC,SAAS,aAATA,SAAS,cAATA,SAAS,GAAI,EACd,mDAAkD,CACpD;EACH;EACA,OAAOE,KAAK;AACd"}