ngx-register-base 1.2.3 → 1.3.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 (479) hide show
  1. package/ng-package.json +15 -0
  2. package/package.json +12 -15
  3. package/schematics/ng-update/replace-menu-state-token/index.ts +33 -0
  4. package/schematics/ng-update/update-prefix/index.ts +38 -0
  5. package/schematics/utils/{utils.d.ts → utils.ts} +9 -2
  6. package/src/lib/components/checkbox-selector/checkbox-selector.component.html +91 -0
  7. package/src/lib/components/checkbox-selector/checkbox-selector.component.less +67 -0
  8. package/src/lib/components/checkbox-selector/checkbox-selector.component.ts +176 -0
  9. package/src/lib/components/checkbox-selector/checkbox-selector.types.ts +8 -0
  10. package/src/lib/components/column-settings/column-settings.component.html +160 -0
  11. package/src/lib/components/column-settings/column-settings.component.less +131 -0
  12. package/src/lib/components/column-settings/column-settings.component.ts +352 -0
  13. package/src/lib/components/column-settings/components/column-settings-template/column-settings-template.component.html +65 -0
  14. package/src/lib/components/column-settings/components/column-settings-template/column-settings-template.component.less +79 -0
  15. package/src/lib/components/column-settings/components/column-settings-template/column-settings-template.component.ts +114 -0
  16. package/src/lib/components/column-settings/consts/column-settings.consts.ts +9 -0
  17. package/src/lib/components/column-settings/types/column-settings.types.ts +26 -0
  18. package/src/lib/components/divider/divider.component.html +4 -0
  19. package/src/lib/components/divider/divider.component.less +10 -0
  20. package/src/lib/components/divider/divider.component.ts +12 -0
  21. package/src/lib/components/filter-button/filter-button.component.html +20 -0
  22. package/src/lib/components/filter-button/filter-button.component.less +41 -0
  23. package/src/lib/components/filter-button/filter-button.component.ts +18 -0
  24. package/src/lib/components/filters/components/filter-list/filter-edit/filter-edit.component.html +22 -0
  25. package/src/lib/components/filters/components/filter-list/filter-edit/filter-edit.component.less +23 -0
  26. package/src/lib/components/filters/components/filter-list/filter-edit/filter-edit.component.ts +31 -0
  27. package/src/lib/components/filters/components/filter-list/filter-list-footer/filter-list-footer.component.html +49 -0
  28. package/src/lib/components/filters/components/filter-list/filter-list-footer/filter-list-footer.component.less +37 -0
  29. package/src/lib/components/filters/components/filter-list/filter-list-footer/filter-list-footer.component.ts +66 -0
  30. package/src/lib/components/filters/components/filter-list/filter-list-header/filter-list-header.component.html +147 -0
  31. package/src/lib/components/filters/components/filter-list/filter-list-header/filter-list-header.component.less +45 -0
  32. package/src/lib/components/filters/components/filter-list/filter-list-header/filter-list-header.component.ts +114 -0
  33. package/src/lib/components/filters/components/filter-list/filter-list-saved/filter-list-saved.component.html +44 -0
  34. package/src/lib/components/filters/components/filter-list/filter-list-saved/filter-list-saved.component.less +49 -0
  35. package/src/lib/components/filters/components/filter-list/filter-list-saved/filter-list-saved.component.ts +167 -0
  36. package/src/lib/components/filters/components/filter-list/filter-list.service.ts +97 -0
  37. package/src/lib/components/filters/components/filter-list/filters-section/filters-section.component.html +18 -0
  38. package/src/lib/components/filters/components/filter-list/filters-section/filters-section.component.less +55 -0
  39. package/src/lib/components/filters/components/filter-list/filters-section/filters-section.component.ts +69 -0
  40. package/src/lib/components/filters/components/filter-list.module.ts +29 -0
  41. package/src/lib/components/filters/register-table-filter.component.html +53 -0
  42. package/src/lib/components/filters/register-table-filter.component.less +17 -0
  43. package/src/lib/components/filters/register-table-filter.component.ts +167 -0
  44. package/src/lib/components/filters/register-table-filter.module.ts +22 -0
  45. package/src/lib/components/inputs/inputs.module.ts +104 -0
  46. package/src/lib/components/inputs/param-calendar-year/param-calendar-year.component.html +49 -0
  47. package/src/lib/components/inputs/param-calendar-year/param-calendar-year.component.less +70 -0
  48. package/src/lib/components/inputs/param-calendar-year/param-calendar-year.component.ts +52 -0
  49. package/src/lib/components/inputs/param-custom/param-custom.component.html +1 -0
  50. package/src/lib/components/inputs/param-custom/param-custom.component.ts +9 -0
  51. package/src/lib/components/inputs/param-date/param-date.component.html +55 -0
  52. package/src/lib/components/inputs/param-date/param-date.component.less +67 -0
  53. package/src/lib/components/inputs/param-date/param-date.component.ts +77 -0
  54. package/src/lib/components/inputs/param-date-range/param-date-range.component.html +45 -0
  55. package/src/lib/components/inputs/param-date-range/param-date-range.component.less +75 -0
  56. package/src/lib/components/inputs/param-date-range/param-date-range.component.ts +67 -0
  57. package/src/lib/components/inputs/param-date-time/param-date-time.component.html +70 -0
  58. package/src/lib/components/inputs/param-date-time/param-date-time.component.less +72 -0
  59. package/src/lib/components/inputs/param-date-time/param-date-time.component.ts +101 -0
  60. package/src/lib/components/inputs/param-date-time-range/param-date-time-range.component.html +67 -0
  61. package/src/lib/components/inputs/param-date-time-range/param-date-time-range.component.less +103 -0
  62. package/src/lib/components/inputs/param-date-time-range/param-date-time-range.component.ts +128 -0
  63. package/src/lib/components/inputs/param-month/param-month.component.html +46 -0
  64. package/src/lib/components/inputs/param-month/param-month.component.less +72 -0
  65. package/src/lib/components/inputs/param-month/param-month.component.ts +55 -0
  66. package/src/lib/components/inputs/param-month-range/param-month-range.component.html +39 -0
  67. package/src/lib/components/inputs/param-month-range/param-month-range.component.less +71 -0
  68. package/src/lib/components/inputs/param-month-range/param-month-range.component.ts +76 -0
  69. package/src/lib/components/inputs/param-multi-select/param-multi-select.component.html +84 -0
  70. package/src/lib/components/inputs/param-multi-select/param-multi-select.component.less +108 -0
  71. package/src/lib/components/inputs/param-multi-select/param-multi-select.component.ts +448 -0
  72. package/src/lib/components/inputs/param-select/param-select.component.html +106 -0
  73. package/src/lib/components/inputs/param-select/param-select.component.less +26 -0
  74. package/src/lib/components/inputs/param-select/param-select.component.ts +318 -0
  75. package/src/lib/components/inputs/param-switcher/param-switcher.component.html +8 -0
  76. package/src/lib/components/inputs/param-switcher/param-switcher.component.less +53 -0
  77. package/src/lib/components/inputs/param-switcher/param-switcher.component.ts +13 -0
  78. package/src/lib/components/inputs/param-switcher-date-time-range/consts/param-switcher-date-time-range.consts.ts +29 -0
  79. package/src/lib/components/inputs/param-switcher-date-time-range/param-switcher-date-time-range.component.html +19 -0
  80. package/src/lib/components/inputs/param-switcher-date-time-range/param-switcher-date-time-range.component.less +76 -0
  81. package/src/lib/components/inputs/param-switcher-date-time-range/param-switcher-date-time-range.component.ts +134 -0
  82. package/src/lib/components/inputs/param-switcher-date-time-range/types/param-switcher-date-time-range.types.ts +8 -0
  83. package/src/lib/components/inputs/param-text/param-text.component.html +59 -0
  84. package/src/lib/components/inputs/param-text/param-text.component.less +33 -0
  85. package/src/lib/components/inputs/param-text/param-text.component.ts +36 -0
  86. package/src/lib/components/inputs/param-textarea/param-textarea.component.html +61 -0
  87. package/src/lib/components/inputs/param-textarea/param-textarea.component.less +21 -0
  88. package/src/lib/components/inputs/param-textarea/param-textarea.component.ts +33 -0
  89. package/src/lib/components/inputs/param-toggle/param-toggle.component.html +40 -0
  90. package/src/lib/components/inputs/param-toggle/param-toggle.component.less +69 -0
  91. package/src/lib/components/inputs/param-toggle/param-toggle.component.ts +14 -0
  92. package/src/lib/components/inputs/param-tree/consts/param-tree.consts.ts +59 -0
  93. package/src/lib/components/inputs/param-tree/param-tree.component.html +51 -0
  94. package/src/lib/components/inputs/param-tree/param-tree.component.less +3 -0
  95. package/src/lib/components/inputs/param-tree/param-tree.component.ts +282 -0
  96. package/src/lib/components/inputs/param-tree/services/param-tree.service.ts +176 -0
  97. package/src/lib/components/inputs/param-tree/services/sync-tree-loader.service.ts +18 -0
  98. package/{lib/components/inputs/param-tree/tokens/param-tree.tokens.d.ts → src/lib/components/inputs/param-tree/tokens/param-tree.tokens.ts} +2 -1
  99. package/src/lib/components/inputs/param-tree/types/param-tree.types.ts +39 -0
  100. package/src/lib/components/inputs/param-tree/utils/param-tree.utils.ts +18 -0
  101. package/src/lib/components/inputs/param-tree-multi-select/param-tree-multi-select.component.html +78 -0
  102. package/src/lib/components/inputs/param-tree-multi-select/param-tree-multi-select.component.less +109 -0
  103. package/src/lib/components/inputs/param-tree-multi-select/param-tree-multi-select.component.ts +89 -0
  104. package/src/lib/components/inputs/param-tree-select/param-tree-select.component.html +54 -0
  105. package/src/lib/components/inputs/param-tree-select/param-tree-select.component.less +56 -0
  106. package/src/lib/components/inputs/param-tree-select/param-tree-select.component.ts +91 -0
  107. package/src/lib/components/inputs/sub-components/param-delete-content-icon/param-delete-content-btn.component.html +5 -0
  108. package/src/lib/components/inputs/sub-components/param-delete-content-icon/param-delete-content-btn.component.ts +13 -0
  109. package/src/lib/components/inputs/sub-components/param-invalid-icon/param-invalid-icon.component.html +4 -0
  110. package/src/lib/components/inputs/sub-components/param-invalid-icon/param-invalid-icon.component.ts +11 -0
  111. package/src/lib/components/menu-constructor/sproc-menu-constructor.component.html +95 -0
  112. package/src/lib/components/menu-constructor/sproc-menu-constructor.component.less +183 -0
  113. package/src/lib/components/menu-constructor/sproc-menu-constructor.component.ts +687 -0
  114. package/src/lib/components/menu-constructor/store/sproc-abstract-menu-constructor.store.ts +32 -0
  115. package/src/lib/components/menu-constructor/store/sproc-menu-constructor.consts.ts +46 -0
  116. package/{lib/components/menu-constructor/store/sproc-menu.tokens.d.ts → src/lib/components/menu-constructor/store/sproc-menu.tokens.ts} +4 -1
  117. package/src/lib/components/page-menu/README.md +60 -0
  118. package/src/lib/components/page-menu/schema/sproc-page-menu.consts.ts +8 -0
  119. package/src/lib/components/page-menu/schema/sproc-page-menu.schema.ts +35 -0
  120. package/src/lib/components/page-menu/schema/sproc-page-menu.tokens.ts +5 -0
  121. package/src/lib/components/page-menu/schema/sproc-page-menu.types.ts +42 -0
  122. package/src/lib/components/page-menu/sproc-page-menu.component.html +166 -0
  123. package/src/lib/components/page-menu/sproc-page-menu.component.less +228 -0
  124. package/src/lib/components/page-menu/sproc-page-menu.component.ts +337 -0
  125. package/src/lib/components/paginator/paginator.component.html +97 -0
  126. package/src/lib/components/paginator/paginator.component.less +101 -0
  127. package/src/lib/components/paginator/paginator.component.ts +192 -0
  128. package/src/lib/components/paginator/types/paginator.types.ts +16 -0
  129. package/src/lib/components/register-table/consts/register-table.consts.ts +3 -0
  130. package/src/lib/components/register-table/directives/cell-template.directive.ts +11 -0
  131. package/src/lib/components/register-table/directives/header-template.directive.ts +11 -0
  132. package/src/lib/components/register-table/model/schema.ts +62 -0
  133. package/src/lib/components/register-table/pipes/class-by-type.pipe.ts +28 -0
  134. package/src/lib/components/register-table/pipes/sticky-column.pipe.ts +11 -0
  135. package/src/lib/components/register-table/register-table.component.html +257 -0
  136. package/src/lib/components/register-table/register-table.component.less +151 -0
  137. package/src/lib/components/register-table/register-table.component.ts +743 -0
  138. package/src/lib/components/reset-settings-form/reset-settings-form.component.html +14 -0
  139. package/src/lib/components/reset-settings-form/reset-settings-form.component.less +26 -0
  140. package/src/lib/components/reset-settings-form/reset-settings-form.component.ts +15 -0
  141. package/src/lib/components/search-input/search-input.component.html +6 -0
  142. package/src/lib/components/search-input/search-input.component.less +17 -0
  143. package/src/lib/components/search-input/search-input.component.ts +31 -0
  144. package/src/lib/components/sliding-panel/sliding-panel.component.html +13 -0
  145. package/src/lib/components/sliding-panel/sliding-panel.component.less +112 -0
  146. package/src/lib/components/sliding-panel/sliding-panel.component.ts +36 -0
  147. package/src/lib/components/sliding-panel/sliding-panel.module.ts +11 -0
  148. package/src/lib/consts/date-time.consts.ts +1 -0
  149. package/src/lib/consts/index.ts +8 -0
  150. package/src/lib/consts/inputs.consts.ts +9 -0
  151. package/src/lib/consts/month.consts.ts +82 -0
  152. package/src/lib/consts/params.consts.ts +1 -0
  153. package/src/lib/consts/register-base.consts.ts +40 -0
  154. package/src/lib/core/form-group-wrapper/errors-consts.ts +6 -0
  155. package/src/lib/core/form-group-wrapper/form-group-wrapper.ts +109 -0
  156. package/src/lib/core/input-control/input-control.ts +30 -0
  157. package/src/lib/core/param/param-base.ts +262 -0
  158. package/src/lib/core/param/param-date-base.ts +30 -0
  159. package/src/lib/core/param/param-select-base.ts +118 -0
  160. package/src/lib/core/param/param-text-base.ts +23 -0
  161. package/{lib/core/param/param.tokens.d.ts → src/lib/core/param/param.tokens.ts} +2 -1
  162. package/src/lib/core/register-base/register-base.store.ts +84 -0
  163. package/src/lib/core/register-base/register-base.ts +854 -0
  164. package/src/lib/directives/date/date-time.types.ts +36 -0
  165. package/src/lib/directives/date/format-date.pipe.ts +28 -0
  166. package/src/lib/directives/number/number-only.directive.ts +36 -0
  167. package/src/lib/directives/sticky/sticky-relative.directive.ts +30 -0
  168. package/src/lib/directives/sticky/sticky-relative.service.ts +34 -0
  169. package/src/lib/directives/sticky/sticky.directive.ts +189 -0
  170. package/src/lib/services/date-time.service.ts +399 -0
  171. package/src/lib/services/dialog/dialog.service.ts +62 -0
  172. package/{lib/services/dialog/dialog.types.d.ts → src/lib/services/dialog/dialog.types.ts} +8 -4
  173. package/src/lib/services/dom-intersection.service.ts +23 -0
  174. package/src/lib/services/filter/filters-state.service.ts +83 -0
  175. package/src/lib/services/filter/filters-transmit.service.ts +105 -0
  176. package/src/lib/services/filter/filters.service.ts +21 -0
  177. package/src/lib/services/inputs-state.service.ts +157 -0
  178. package/src/lib/services/inputs.service.ts +114 -0
  179. package/src/lib/services/key-pressed.service.ts +40 -0
  180. package/src/lib/services/resize-window-observer.service.ts +37 -0
  181. package/src/lib/services/selected-objects-state.service.ts +159 -0
  182. package/src/lib/store/fast-query-store.service.ts +132 -0
  183. package/{lib/types/event.types.d.ts → src/lib/types/event.types.ts} +1 -1
  184. package/src/lib/types/hasura.types.ts +41 -0
  185. package/src/lib/types/inputs.types.ts +63 -0
  186. package/src/lib/types/params.types.ts +42 -0
  187. package/src/lib/types/register-base.types.ts +161 -0
  188. package/src/lib/types/sub-types.ts +15 -0
  189. package/src/lib/types/user-profile.types.ts +18 -0
  190. package/src/lib/utils/functions.ts +11 -0
  191. package/src/lib/utils/get-url-segment.ts +46 -0
  192. package/src/lib/utils/prizm.shared.module.ts +176 -0
  193. package/src/lib/utils/rxjs.ts +33 -0
  194. package/src/lib/utils/select-all-utils.ts +16 -0
  195. package/tsconfig.lib.json +16 -0
  196. package/tsconfig.lib.prod.json +11 -0
  197. package/tsconfig.schematics.json +26 -0
  198. package/tsconfig.spec.json +15 -0
  199. package/esm2022/lib/components/checkbox-selector/checkbox-selector.component.mjs +0 -129
  200. package/esm2022/lib/components/checkbox-selector/checkbox-selector.types.mjs +0 -8
  201. package/esm2022/lib/components/column-settings/column-settings.component.mjs +0 -249
  202. package/esm2022/lib/components/column-settings/components/column-settings-template/column-settings-template.component.mjs +0 -80
  203. package/esm2022/lib/components/column-settings/consts/column-settings.consts.mjs +0 -10
  204. package/esm2022/lib/components/column-settings/index.mjs +0 -3
  205. package/esm2022/lib/components/column-settings/types/column-settings.types.mjs +0 -7
  206. package/esm2022/lib/components/divider/divider.component.mjs +0 -16
  207. package/esm2022/lib/components/filter-button/filter-button.component.mjs +0 -19
  208. package/esm2022/lib/components/filters/components/filter-list/filter-edit/filter-edit.component.mjs +0 -31
  209. package/esm2022/lib/components/filters/components/filter-list/filter-list-footer/filter-list-footer.component.mjs +0 -57
  210. package/esm2022/lib/components/filters/components/filter-list/filter-list-header/filter-list-header.component.mjs +0 -110
  211. package/esm2022/lib/components/filters/components/filter-list/filter-list-saved/filter-list-saved.component.mjs +0 -130
  212. package/esm2022/lib/components/filters/components/filter-list/filter-list.service.mjs +0 -89
  213. package/esm2022/lib/components/filters/components/filter-list/filters-section/filters-section.component.mjs +0 -41
  214. package/esm2022/lib/components/filters/components/filter-list.module.mjs +0 -45
  215. package/esm2022/lib/components/filters/index.mjs +0 -3
  216. package/esm2022/lib/components/filters/register-table-filter.component.mjs +0 -155
  217. package/esm2022/lib/components/filters/register-table-filter.module.mjs +0 -39
  218. package/esm2022/lib/components/index.mjs +0 -11
  219. package/esm2022/lib/components/inputs/index.mjs +0 -20
  220. package/esm2022/lib/components/inputs/inputs.module.mjs +0 -166
  221. package/esm2022/lib/components/inputs/param-calendar-year/param-calendar-year.component.mjs +0 -45
  222. package/esm2022/lib/components/inputs/param-custom/param-custom.component.mjs +0 -12
  223. package/esm2022/lib/components/inputs/param-date/param-date.component.mjs +0 -76
  224. package/esm2022/lib/components/inputs/param-date-range/param-date-range.component.mjs +0 -61
  225. package/esm2022/lib/components/inputs/param-date-time/param-date-time.component.mjs +0 -86
  226. package/esm2022/lib/components/inputs/param-date-time-range/param-date-time-range.component.mjs +0 -96
  227. package/esm2022/lib/components/inputs/param-month/param-month.component.mjs +0 -50
  228. package/esm2022/lib/components/inputs/param-month-range/param-month-range.component.mjs +0 -62
  229. package/esm2022/lib/components/inputs/param-multi-select/param-multi-select.component.mjs +0 -309
  230. package/esm2022/lib/components/inputs/param-select/param-select.component.mjs +0 -209
  231. package/esm2022/lib/components/inputs/param-switcher/param-switcher.component.mjs +0 -21
  232. package/esm2022/lib/components/inputs/param-switcher-date-time-range/consts/param-switcher-date-time-range.consts.mjs +0 -28
  233. package/esm2022/lib/components/inputs/param-switcher-date-time-range/index.mjs +0 -3
  234. package/esm2022/lib/components/inputs/param-switcher-date-time-range/param-switcher-date-time-range.component.mjs +0 -105
  235. package/esm2022/lib/components/inputs/param-switcher-date-time-range/types/param-switcher-date-time-range.types.mjs +0 -10
  236. package/esm2022/lib/components/inputs/param-text/param-text.component.mjs +0 -40
  237. package/esm2022/lib/components/inputs/param-textarea/param-textarea.component.mjs +0 -38
  238. package/esm2022/lib/components/inputs/param-toggle/param-toggle.component.mjs +0 -20
  239. package/esm2022/lib/components/inputs/param-tree/consts/param-tree.consts.mjs +0 -37
  240. package/esm2022/lib/components/inputs/param-tree/index.mjs +0 -8
  241. package/esm2022/lib/components/inputs/param-tree/param-tree.component.mjs +0 -207
  242. package/esm2022/lib/components/inputs/param-tree/services/param-tree.service.mjs +0 -116
  243. package/esm2022/lib/components/inputs/param-tree/services/sync-tree-loader.service.mjs +0 -20
  244. package/esm2022/lib/components/inputs/param-tree/tokens/param-tree.tokens.mjs +0 -3
  245. package/esm2022/lib/components/inputs/param-tree/types/param-tree.types.mjs +0 -2
  246. package/esm2022/lib/components/inputs/param-tree/utils/param-tree.utils.mjs +0 -9
  247. package/esm2022/lib/components/inputs/param-tree-multi-select/param-tree-multi-select.component.mjs +0 -80
  248. package/esm2022/lib/components/inputs/param-tree-select/param-tree-select.component.mjs +0 -85
  249. package/esm2022/lib/components/inputs/sub-components/param-delete-content-icon/param-delete-content-btn.component.mjs +0 -15
  250. package/esm2022/lib/components/inputs/sub-components/param-invalid-icon/param-invalid-icon.component.mjs +0 -12
  251. package/esm2022/lib/components/menu-constructor/index.mjs +0 -5
  252. package/esm2022/lib/components/menu-constructor/sproc-menu-constructor.component.mjs +0 -559
  253. package/esm2022/lib/components/menu-constructor/store/sproc-abstract-menu-constructor.store.mjs +0 -3
  254. package/esm2022/lib/components/menu-constructor/store/sproc-menu-constructor.consts.mjs +0 -5
  255. package/esm2022/lib/components/menu-constructor/store/sproc-menu.tokens.mjs +0 -3
  256. package/esm2022/lib/components/page-menu/index.mjs +0 -6
  257. package/esm2022/lib/components/page-menu/schema/sproc-page-menu.consts.mjs +0 -9
  258. package/esm2022/lib/components/page-menu/schema/sproc-page-menu.schema.mjs +0 -2
  259. package/esm2022/lib/components/page-menu/schema/sproc-page-menu.tokens.mjs +0 -4
  260. package/esm2022/lib/components/page-menu/schema/sproc-page-menu.types.mjs +0 -3
  261. package/esm2022/lib/components/page-menu/sproc-page-menu.component.mjs +0 -275
  262. package/esm2022/lib/components/paginator/paginator.component.mjs +0 -159
  263. package/esm2022/lib/components/paginator/types/paginator.types.mjs +0 -2
  264. package/esm2022/lib/components/register-table/consts/register-table.consts.mjs +0 -4
  265. package/esm2022/lib/components/register-table/directives/cell-template.directive.mjs +0 -19
  266. package/esm2022/lib/components/register-table/directives/header-template.directive.mjs +0 -18
  267. package/esm2022/lib/components/register-table/index.mjs +0 -4
  268. package/esm2022/lib/components/register-table/model/schema.mjs +0 -10
  269. package/esm2022/lib/components/register-table/pipes/class-by-type.pipe.mjs +0 -33
  270. package/esm2022/lib/components/register-table/pipes/sticky-column.pipe.mjs +0 -17
  271. package/esm2022/lib/components/register-table/register-table.component.mjs +0 -544
  272. package/esm2022/lib/components/reset-settings-form/reset-settings-form.component.mjs +0 -18
  273. package/esm2022/lib/components/search-input/search-input.component.mjs +0 -28
  274. package/esm2022/lib/components/sliding-panel/sliding-panel.component.mjs +0 -48
  275. package/esm2022/lib/components/sliding-panel/sliding-panel.module.mjs +0 -19
  276. package/esm2022/lib/consts/date-time.consts.mjs +0 -2
  277. package/esm2022/lib/consts/index.mjs +0 -4
  278. package/esm2022/lib/consts/inputs.consts.mjs +0 -4
  279. package/esm2022/lib/consts/month.consts.mjs +0 -77
  280. package/esm2022/lib/consts/params.consts.mjs +0 -2
  281. package/esm2022/lib/consts/register-base.consts.mjs +0 -26
  282. package/esm2022/lib/core/form-group-wrapper/errors-consts.mjs +0 -8
  283. package/esm2022/lib/core/form-group-wrapper/form-group-wrapper.mjs +0 -81
  284. package/esm2022/lib/core/form-group-wrapper/index.mjs +0 -2
  285. package/esm2022/lib/core/index.mjs +0 -5
  286. package/esm2022/lib/core/input-control/index.mjs +0 -2
  287. package/esm2022/lib/core/input-control/input-control.mjs +0 -11
  288. package/esm2022/lib/core/param/index.mjs +0 -6
  289. package/esm2022/lib/core/param/param-base.mjs +0 -215
  290. package/esm2022/lib/core/param/param-date-base.mjs +0 -26
  291. package/esm2022/lib/core/param/param-select-base.mjs +0 -114
  292. package/esm2022/lib/core/param/param-text-base.mjs +0 -25
  293. package/esm2022/lib/core/param/param.tokens.mjs +0 -4
  294. package/esm2022/lib/core/register-base/index.mjs +0 -3
  295. package/esm2022/lib/core/register-base/register-base.mjs +0 -575
  296. package/esm2022/lib/core/register-base/register-base.store.mjs +0 -43
  297. package/esm2022/lib/directives/date/date-time.types.mjs +0 -34
  298. package/esm2022/lib/directives/date/format-date.pipe.mjs +0 -33
  299. package/esm2022/lib/directives/index.mjs +0 -3
  300. package/esm2022/lib/directives/number/number-only.directive.mjs +0 -41
  301. package/esm2022/lib/directives/sticky/index.mjs +0 -3
  302. package/esm2022/lib/directives/sticky/sticky-relative.directive.mjs +0 -32
  303. package/esm2022/lib/directives/sticky/sticky-relative.service.mjs +0 -32
  304. package/esm2022/lib/directives/sticky/sticky.directive.mjs +0 -169
  305. package/esm2022/lib/services/date-time.service.mjs +0 -314
  306. package/esm2022/lib/services/dialog/dialog.service.mjs +0 -53
  307. package/esm2022/lib/services/dialog/dialog.types.mjs +0 -2
  308. package/esm2022/lib/services/dialog/index.mjs +0 -3
  309. package/esm2022/lib/services/dom-intersection.service.mjs +0 -22
  310. package/esm2022/lib/services/filter/filters-state.service.mjs +0 -65
  311. package/esm2022/lib/services/filter/filters-transmit.service.mjs +0 -82
  312. package/esm2022/lib/services/filter/filters.service.mjs +0 -23
  313. package/esm2022/lib/services/index.mjs +0 -8
  314. package/esm2022/lib/services/inputs-state.service.mjs +0 -130
  315. package/esm2022/lib/services/inputs.service.mjs +0 -88
  316. package/esm2022/lib/services/key-pressed.service.mjs +0 -37
  317. package/esm2022/lib/services/resize-window-observer.service.mjs +0 -33
  318. package/esm2022/lib/services/selected-objects-state.service.mjs +0 -123
  319. package/esm2022/lib/store/fast-query-store.service.mjs +0 -110
  320. package/esm2022/lib/store/index.mjs +0 -2
  321. package/esm2022/lib/types/event.types.mjs +0 -2
  322. package/esm2022/lib/types/hasura.types.mjs +0 -2
  323. package/esm2022/lib/types/index.mjs +0 -7
  324. package/esm2022/lib/types/inputs.types.mjs +0 -19
  325. package/esm2022/lib/types/params.types.mjs +0 -2
  326. package/esm2022/lib/types/register-base.types.mjs +0 -6
  327. package/esm2022/lib/types/sub-types.mjs +0 -2
  328. package/esm2022/lib/types/user-profile.types.mjs +0 -2
  329. package/esm2022/lib/utils/functions.mjs +0 -10
  330. package/esm2022/lib/utils/get-url-segment.mjs +0 -35
  331. package/esm2022/lib/utils/index.mjs +0 -5
  332. package/esm2022/lib/utils/prizm.shared.module.mjs +0 -284
  333. package/esm2022/lib/utils/rxjs.mjs +0 -28
  334. package/esm2022/lib/utils/select-all-utils.mjs +0 -11
  335. package/esm2022/ngx-register-base.mjs +0 -5
  336. package/esm2022/public-api.mjs +0 -9
  337. package/fesm2022/ngx-register-base.mjs +0 -7465
  338. package/fesm2022/ngx-register-base.mjs.map +0 -1
  339. package/index.d.ts +0 -5
  340. package/lib/components/checkbox-selector/checkbox-selector.component.d.ts +0 -33
  341. package/lib/components/checkbox-selector/checkbox-selector.types.d.ts +0 -7
  342. package/lib/components/column-settings/column-settings.component.d.ts +0 -80
  343. package/lib/components/column-settings/components/column-settings-template/column-settings-template.component.d.ts +0 -24
  344. package/lib/components/column-settings/consts/column-settings.consts.d.ts +0 -8
  345. package/lib/components/column-settings/types/column-settings.types.d.ts +0 -22
  346. package/lib/components/divider/divider.component.d.ts +0 -6
  347. package/lib/components/filter-button/filter-button.component.d.ts +0 -8
  348. package/lib/components/filters/components/filter-list/filter-edit/filter-edit.component.d.ts +0 -14
  349. package/lib/components/filters/components/filter-list/filter-list-footer/filter-list-footer.component.d.ts +0 -25
  350. package/lib/components/filters/components/filter-list/filter-list-header/filter-list-header.component.d.ts +0 -39
  351. package/lib/components/filters/components/filter-list/filter-list-saved/filter-list-saved.component.d.ts +0 -41
  352. package/lib/components/filters/components/filter-list/filter-list.service.d.ts +0 -20
  353. package/lib/components/filters/components/filter-list/filters-section/filters-section.component.d.ts +0 -15
  354. package/lib/components/filters/components/filter-list.module.d.ts +0 -15
  355. package/lib/components/filters/register-table-filter.component.d.ts +0 -40
  356. package/lib/components/filters/register-table-filter.module.d.ts +0 -13
  357. package/lib/components/inputs/inputs.module.d.ts +0 -31
  358. package/lib/components/inputs/param-calendar-year/param-calendar-year.component.d.ts +0 -19
  359. package/lib/components/inputs/param-custom/param-custom.component.d.ts +0 -6
  360. package/lib/components/inputs/param-date/param-date.component.d.ts +0 -20
  361. package/lib/components/inputs/param-date-range/param-date-range.component.d.ts +0 -26
  362. package/lib/components/inputs/param-date-time/param-date-time.component.d.ts +0 -25
  363. package/lib/components/inputs/param-date-time-range/param-date-time-range.component.d.ts +0 -28
  364. package/lib/components/inputs/param-month/param-month.component.d.ts +0 -18
  365. package/lib/components/inputs/param-month-range/param-month-range.component.d.ts +0 -21
  366. package/lib/components/inputs/param-multi-select/param-multi-select.component.d.ts +0 -46
  367. package/lib/components/inputs/param-select/param-select.component.d.ts +0 -30
  368. package/lib/components/inputs/param-switcher/param-switcher.component.d.ts +0 -8
  369. package/lib/components/inputs/param-switcher-date-time-range/consts/param-switcher-date-time-range.consts.d.ts +0 -2
  370. package/lib/components/inputs/param-switcher-date-time-range/param-switcher-date-time-range.component.d.ts +0 -19
  371. package/lib/components/inputs/param-switcher-date-time-range/types/param-switcher-date-time-range.types.d.ts +0 -8
  372. package/lib/components/inputs/param-text/param-text.component.d.ts +0 -10
  373. package/lib/components/inputs/param-textarea/param-textarea.component.d.ts +0 -10
  374. package/lib/components/inputs/param-toggle/param-toggle.component.d.ts +0 -9
  375. package/lib/components/inputs/param-tree/consts/param-tree.consts.d.ts +0 -7
  376. package/lib/components/inputs/param-tree/param-tree.component.d.ts +0 -41
  377. package/lib/components/inputs/param-tree/services/param-tree.service.d.ts +0 -37
  378. package/lib/components/inputs/param-tree/services/sync-tree-loader.service.d.ts +0 -10
  379. package/lib/components/inputs/param-tree/types/param-tree.types.d.ts +0 -32
  380. package/lib/components/inputs/param-tree/utils/param-tree.utils.d.ts +0 -7
  381. package/lib/components/inputs/param-tree-multi-select/param-tree-multi-select.component.d.ts +0 -31
  382. package/lib/components/inputs/param-tree-select/param-tree-select.component.d.ts +0 -30
  383. package/lib/components/inputs/sub-components/param-delete-content-icon/param-delete-content-btn.component.d.ts +0 -6
  384. package/lib/components/inputs/sub-components/param-invalid-icon/param-invalid-icon.component.d.ts +0 -5
  385. package/lib/components/menu-constructor/sproc-menu-constructor.component.d.ts +0 -113
  386. package/lib/components/menu-constructor/store/sproc-abstract-menu-constructor.store.d.ts +0 -24
  387. package/lib/components/menu-constructor/store/sproc-menu-constructor.consts.d.ts +0 -36
  388. package/lib/components/page-menu/schema/sproc-page-menu.consts.d.ts +0 -7
  389. package/lib/components/page-menu/schema/sproc-page-menu.schema.d.ts +0 -30
  390. package/lib/components/page-menu/schema/sproc-page-menu.tokens.d.ts +0 -3
  391. package/lib/components/page-menu/schema/sproc-page-menu.types.d.ts +0 -36
  392. package/lib/components/page-menu/sproc-page-menu.component.d.ts +0 -48
  393. package/lib/components/paginator/paginator.component.d.ts +0 -52
  394. package/lib/components/paginator/types/paginator.types.d.ts +0 -15
  395. package/lib/components/register-table/consts/register-table.consts.d.ts +0 -3
  396. package/lib/components/register-table/directives/cell-template.directive.d.ts +0 -9
  397. package/lib/components/register-table/directives/header-template.directive.d.ts +0 -9
  398. package/lib/components/register-table/model/schema.d.ts +0 -52
  399. package/lib/components/register-table/pipes/class-by-type.pipe.d.ts +0 -8
  400. package/lib/components/register-table/pipes/sticky-column.pipe.d.ts +0 -7
  401. package/lib/components/register-table/register-table.component.d.ts +0 -165
  402. package/lib/components/reset-settings-form/reset-settings-form.component.d.ts +0 -9
  403. package/lib/components/search-input/search-input.component.d.ts +0 -11
  404. package/lib/components/sliding-panel/sliding-panel.component.d.ts +0 -14
  405. package/lib/components/sliding-panel/sliding-panel.module.d.ts +0 -9
  406. package/lib/consts/date-time.consts.d.ts +0 -1
  407. package/lib/consts/index.d.ts +0 -3
  408. package/lib/consts/inputs.consts.d.ts +0 -4
  409. package/lib/consts/month.consts.d.ts +0 -49
  410. package/lib/consts/params.consts.d.ts +0 -1
  411. package/lib/consts/register-base.consts.d.ts +0 -19
  412. package/lib/core/form-group-wrapper/errors-consts.d.ts +0 -5
  413. package/lib/core/form-group-wrapper/form-group-wrapper.d.ts +0 -15
  414. package/lib/core/input-control/input-control.d.ts +0 -11
  415. package/lib/core/param/param-base.d.ts +0 -68
  416. package/lib/core/param/param-date-base.d.ts +0 -18
  417. package/lib/core/param/param-select-base.d.ts +0 -42
  418. package/lib/core/param/param-text-base.d.ts +0 -15
  419. package/lib/core/register-base/register-base.d.ts +0 -168
  420. package/lib/core/register-base/register-base.store.d.ts +0 -35
  421. package/lib/directives/date/date-time.types.d.ts +0 -32
  422. package/lib/directives/date/format-date.pipe.d.ts +0 -10
  423. package/lib/directives/number/number-only.directive.d.ts +0 -10
  424. package/lib/directives/sticky/sticky-relative.directive.d.ts +0 -13
  425. package/lib/directives/sticky/sticky-relative.service.d.ts +0 -15
  426. package/lib/directives/sticky/sticky.directive.d.ts +0 -27
  427. package/lib/services/date-time.service.d.ts +0 -80
  428. package/lib/services/dialog/dialog.service.d.ts +0 -22
  429. package/lib/services/dom-intersection.service.d.ts +0 -8
  430. package/lib/services/filter/filters-state.service.d.ts +0 -21
  431. package/lib/services/filter/filters-transmit.service.d.ts +0 -28
  432. package/lib/services/filter/filters.service.d.ts +0 -12
  433. package/lib/services/inputs-state.service.d.ts +0 -57
  434. package/lib/services/inputs.service.d.ts +0 -28
  435. package/lib/services/key-pressed.service.d.ts +0 -15
  436. package/lib/services/resize-window-observer.service.d.ts +0 -11
  437. package/lib/services/selected-objects-state.service.d.ts +0 -47
  438. package/lib/store/fast-query-store.service.d.ts +0 -19
  439. package/lib/types/hasura.types.d.ts +0 -35
  440. package/lib/types/inputs.types.d.ts +0 -41
  441. package/lib/types/params.types.d.ts +0 -27
  442. package/lib/types/register-base.types.d.ts +0 -123
  443. package/lib/types/sub-types.d.ts +0 -8
  444. package/lib/types/user-profile.types.d.ts +0 -17
  445. package/lib/utils/functions.d.ts +0 -3
  446. package/lib/utils/get-url-segment.d.ts +0 -7
  447. package/lib/utils/prizm.shared.module.d.ts +0 -14
  448. package/lib/utils/rxjs.d.ts +0 -10
  449. package/lib/utils/select-all-utils.d.ts +0 -8
  450. package/schematics/ng-update/replace-menu-state-token/index.d.ts +0 -2
  451. package/schematics/ng-update/replace-menu-state-token/index.js +0 -29
  452. package/schematics/ng-update/replace-menu-state-token/index.js.map +0 -1
  453. package/schematics/ng-update/update-prefix/index.d.ts +0 -2
  454. package/schematics/ng-update/update-prefix/index.js +0 -33
  455. package/schematics/ng-update/update-prefix/index.js.map +0 -1
  456. package/schematics/utils/utils.js +0 -25
  457. package/schematics/utils/utils.js.map +0 -1
  458. /package/{lib/components/column-settings/index.d.ts → src/lib/components/column-settings/index.ts} +0 -0
  459. /package/{lib/components/filters/index.d.ts → src/lib/components/filters/index.ts} +0 -0
  460. /package/{lib/components/index.d.ts → src/lib/components/index.ts} +0 -0
  461. /package/{lib/components/inputs/index.d.ts → src/lib/components/inputs/index.ts} +0 -0
  462. /package/{lib/components/inputs/param-switcher-date-time-range/index.d.ts → src/lib/components/inputs/param-switcher-date-time-range/index.ts} +0 -0
  463. /package/{lib/components/inputs/param-tree/index.d.ts → src/lib/components/inputs/param-tree/index.ts} +0 -0
  464. /package/{lib/components/menu-constructor/index.d.ts → src/lib/components/menu-constructor/index.ts} +0 -0
  465. /package/{lib/components/page-menu/index.d.ts → src/lib/components/page-menu/index.ts} +0 -0
  466. /package/{lib/components/register-table/index.d.ts → src/lib/components/register-table/index.ts} +0 -0
  467. /package/{lib/core/form-group-wrapper/index.d.ts → src/lib/core/form-group-wrapper/index.ts} +0 -0
  468. /package/{lib/core/index.d.ts → src/lib/core/index.ts} +0 -0
  469. /package/{lib/core/input-control/index.d.ts → src/lib/core/input-control/index.ts} +0 -0
  470. /package/{lib/core/param/index.d.ts → src/lib/core/param/index.ts} +0 -0
  471. /package/{lib/core/register-base/index.d.ts → src/lib/core/register-base/index.ts} +0 -0
  472. /package/{lib/directives/index.d.ts → src/lib/directives/index.ts} +0 -0
  473. /package/{lib/directives/sticky/index.d.ts → src/lib/directives/sticky/index.ts} +0 -0
  474. /package/{lib/services/dialog/index.d.ts → src/lib/services/dialog/index.ts} +0 -0
  475. /package/{lib/services/index.d.ts → src/lib/services/index.ts} +0 -0
  476. /package/{lib/store/index.d.ts → src/lib/store/index.ts} +0 -0
  477. /package/{lib/types/index.d.ts → src/lib/types/index.ts} +0 -0
  478. /package/{lib/utils/index.d.ts → src/lib/utils/index.ts} +0 -0
  479. /package/{public-api.d.ts → src/public-api.ts} +0 -0
@@ -0,0 +1,687 @@
1
+ import { Component, computed, DestroyRef, inject, OnInit, output, signal } from '@angular/core';
2
+ import { FormsModule } from '@angular/forms';
3
+ import {
4
+ CdkDrag,
5
+ CdkDragDrop,
6
+ CdkDragHandle,
7
+ CdkDragPreview,
8
+ CdkDropList,
9
+ } from '@angular/cdk/drag-drop';
10
+ import { AsyncPipe, NgForOf } from '@angular/common';
11
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
12
+ import { filter } from 'rxjs';
13
+ import { SprocAbstractMenuConstructorStore } from './store/sproc-abstract-menu-constructor.store';
14
+ import {
15
+ EMPTY_UUID,
16
+ FlatNode,
17
+ IClsMenuItemInput,
18
+ IMenuConstructorError,
19
+ MIGRATION_HINT,
20
+ NEW_ITEM_PREFIX,
21
+ ROOT_TITLE,
22
+ } from './store/sproc-menu-constructor.consts';
23
+ import { IClsMenuItem } from '../page-menu';
24
+ import { MENU_CONSTRUCTOR_STORE_TOKEN } from './store/sproc-menu.tokens';
25
+
26
+ @Component({
27
+ standalone: true,
28
+ selector: 'sproc-menu-constructor',
29
+ templateUrl: './sproc-menu-constructor.component.html',
30
+ styleUrls: ['./sproc-menu-constructor.component.less'],
31
+ imports: [CdkDrag, CdkDropList, NgForOf, FormsModule, CdkDragPreview, CdkDragHandle, AsyncPipe],
32
+ })
33
+ export class SprocMenuConstructorComponent implements OnInit {
34
+ private _store = inject(MENU_CONSTRUCTOR_STORE_TOKEN);
35
+ private _ref = inject(DestroyRef);
36
+
37
+ protected ROOT_TITLE = ROOT_TITLE;
38
+ protected loading$ = this._store.loading$;
39
+ protected originalTree: Map<string, FlatNode> = new Map([]);
40
+ protected MIGRATION_HINT = MIGRATION_HINT;
41
+ private deletedIds: string[] = [];
42
+
43
+ public errorMsgOutput = output<IMenuConstructorError>();
44
+
45
+ // плоское представление иерархического меню
46
+ protected flatTree = signal<FlatNode[]>([]);
47
+
48
+ // ветка элементов, которая перетаскивается
49
+ protected draggedBranch = signal<FlatNode[]>([]);
50
+
51
+ // вычисляемое свойство, возвращающее только видимые (не свернутые) элементы
52
+ protected visibleFlatTree = computed<FlatNode[]>(() => {
53
+ const flatTree = this.flatTree();
54
+ return this._getVisibleFrom(flatTree);
55
+ });
56
+
57
+ private _pendingRecalc = false;
58
+
59
+ ngOnInit(): void {
60
+ this._store.menuItems$
61
+ .pipe(
62
+ filter((arr) => Array.isArray(arr) && arr.length > 0),
63
+ takeUntilDestroyed(this._ref)
64
+ )
65
+ .subscribe((value) => {
66
+ this.flatTree.set(this._convertToFlatNode(value));
67
+ this.originalTree = new Map(this.flatTree().map((item) => [item.id, { ...item }]));
68
+ });
69
+ }
70
+
71
+ /**
72
+ * Переключает состояние свернутости узла (collapse/expand)
73
+ * После изменения создает новый массив для триггера обновления сигнала
74
+ */
75
+ protected toggleCollapse(node: FlatNode): void {
76
+ node.collapsed = !node.collapsed;
77
+ this.flatTree.set([...this.flatTree()]);
78
+ }
79
+
80
+ /**
81
+ * Начало перетаскивания: сохраняет всю ветку узла, которую тянут
82
+ */
83
+ protected dragStarted(node: FlatNode): void {
84
+ const branch = this._collectBranch(this.flatTree(), node);
85
+ this.draggedBranch.set(branch);
86
+ }
87
+
88
+ /**
89
+ * Завершение перетаскивания: очищает информацию о текущей ветке
90
+ */
91
+ protected dragEnded(): void {
92
+ this.draggedBranch.set([]);
93
+ }
94
+
95
+ /**
96
+ * Основная логика drag&drop при отпускании элемента
97
+ * Определяет новую позицию узла, пересчитывает глубины и связи
98
+ */
99
+ protected drop(event: CdkDragDrop<FlatNode[]>): void {
100
+ const before = [...this.flatTree()];
101
+ const visibleBefore = this._getVisibleFrom(before);
102
+ const prevIdx = event.previousIndex;
103
+ const currIdx = event.currentIndex;
104
+
105
+ // Получает перетаскиваемый элемент из списка видимых
106
+ const draggedVisible = visibleBefore[prevIdx];
107
+ if (!draggedVisible) {
108
+ return;
109
+ }
110
+
111
+ // Находит индекс узла в полном массиве
112
+ const start = before.findIndex((n) => n.id === draggedVisible.id);
113
+ if (start < 0) {
114
+ return;
115
+ }
116
+
117
+ // Собирает всю ветку, начинающуюся с перетаскиваемого узла
118
+ const branch = this._collectBranch(before, before[start]);
119
+ const branchIds = new Set(branch.map((n) => n.id));
120
+
121
+ // Убирает ветку из исходного списка
122
+ const full = before.filter((n) => !branchIds.has(n.id));
123
+
124
+ // Определяет видимые элементы после удаления ветки
125
+ const visible = this._getVisibleFrom(full);
126
+ const prevVisible = visible[currIdx - 1] ?? null;
127
+ const nextVisible = visible[currIdx] ?? null;
128
+
129
+ // Индекс вставки ветки в новый список
130
+ const insert = nextVisible ? full.findIndex((n) => n.id === nextVisible.id) : full.length;
131
+
132
+ // Рассчитывает глубину вставляемой ветки в зависимости от соседей
133
+ let targetDepth;
134
+ if (prevVisible && nextVisible) {
135
+ targetDepth =
136
+ prevVisible.depth < nextVisible.depth ? prevVisible.depth + 1 : nextVisible.depth;
137
+ } else if (prevVisible && !nextVisible) {
138
+ targetDepth = prevVisible.depth;
139
+ } else if (!prevVisible && nextVisible) {
140
+ targetDepth = nextVisible.depth;
141
+ } else {
142
+ targetDepth = 0;
143
+ }
144
+
145
+ // Вставляет ветку в новое место
146
+ full.splice(insert, 0, ...branch);
147
+ // Сдвигает глубину всей ветки
148
+ this._applyDepthShift(branch, targetDepth - branch[0].depth);
149
+
150
+ // Планирует пересчет структуры дерева
151
+ this._scheduleRecalc(full);
152
+ }
153
+
154
+ /**
155
+ * Увеличивает глубину (depth) конкретного узла, если возможно
156
+ */
157
+ protected indent(node: FlatNode): void {
158
+ const arr = [...this.flatTree()];
159
+ const index = arr.indexOf(node);
160
+ if (index === -1) {
161
+ return;
162
+ }
163
+
164
+ const proposedDepth = node.depth + 1;
165
+ // Ищет подходящего родителя с нужной глубиной
166
+ const parentCandidate = [...arr]
167
+ .slice(0, index)
168
+ .reverse()
169
+ .find((n) => n.depth === proposedDepth - 1);
170
+
171
+ if (!parentCandidate) {
172
+ return;
173
+ }
174
+
175
+ node.depth = proposedDepth;
176
+ this._scheduleRecalc(arr);
177
+ }
178
+
179
+ /**
180
+ * Уменьшает глубину (depth) узла + по возможности превращает его в родителя
181
+ */
182
+ protected outdent(node: FlatNode): void {
183
+ const arr = [...this.flatTree()];
184
+ const index = arr.indexOf(node);
185
+ if (index === -1 || node.depth <= 0) {
186
+ return;
187
+ }
188
+ node.depth = Math.max(0, node.depth - 1);
189
+ this._scheduleRecalc(arr);
190
+ }
191
+
192
+ /**
193
+ * Увеличивает глубину всей ветки узла (вместе с потомками)
194
+ */
195
+ protected indentBranch(node: FlatNode): void {
196
+ const arr = [...this.flatTree()];
197
+ const index = arr.indexOf(node);
198
+ if (index === -1) {
199
+ return;
200
+ }
201
+ const proposedDepth = node.depth + 1;
202
+ const parentCandidate = [...arr]
203
+ .slice(0, index)
204
+ .reverse()
205
+ .find((n) => n.depth === proposedDepth - 1);
206
+
207
+ if (!parentCandidate) {
208
+ return;
209
+ }
210
+
211
+ const branch = this._collectBranch(arr, node);
212
+ this._applyDepthShift(branch, 1);
213
+
214
+ this._scheduleRecalc(arr);
215
+ }
216
+
217
+ /**
218
+ * Уменьшает глубину всей ветки узла
219
+ */
220
+ protected outdentBranch(node: FlatNode): void {
221
+ const arr = [...this.flatTree()];
222
+ const branch = this._collectBranch(arr, node);
223
+ this._applyDepthShift(branch, -1);
224
+ this._scheduleRecalc(arr);
225
+ }
226
+
227
+ /**
228
+ * Проверяет, есть ли у узла дочерние элементы
229
+ */
230
+ protected hasChildren(node: FlatNode): boolean {
231
+ const arr = this.flatTree();
232
+ const idx = arr.indexOf(node);
233
+ if (idx === -1) {
234
+ return false;
235
+ }
236
+ for (let i = idx + 1; i < arr.length; i++) {
237
+ const next = arr[i];
238
+ if (next.depth <= node.depth) {
239
+ break;
240
+ }
241
+ if (next.depth === node.depth + 1) {
242
+ return true;
243
+ }
244
+ }
245
+ return false;
246
+ }
247
+
248
+ protected save(): void {
249
+ // Флаг для логгирования на время отладки
250
+ const logging = false;
251
+
252
+ const changedElements = this.flatTree().filter((newItem) => {
253
+ const originalItem = this.originalTree.get(newItem.id);
254
+
255
+ // Новый элемент
256
+ if (!originalItem) {
257
+ if (logging) {
258
+ console.log(`Новый элемент ${newItem.title}`);
259
+ }
260
+
261
+ return true;
262
+ }
263
+
264
+ const {
265
+ order_num: originalOrderNum,
266
+ id_parent: originalIdParent,
267
+ title: originalTitle,
268
+ allowed_roles: originalRoles,
269
+ code: originalCode,
270
+ route: originalRoute,
271
+ icon: originalIcon,
272
+ } = originalItem;
273
+
274
+ const {
275
+ order_num: newOrderNum,
276
+ id_parent: newIdParent,
277
+ title: newTitle,
278
+ allowed_roles: newRoles,
279
+ code: newCode,
280
+ route: newRoute,
281
+ icon: newIcon,
282
+ } = newItem;
283
+
284
+ const changedFields: string[] = [];
285
+
286
+ if (originalOrderNum !== newOrderNum) {
287
+ changedFields.push(`order_num: ${originalOrderNum} → ${newOrderNum}`);
288
+ }
289
+ if (originalIdParent !== newIdParent) {
290
+ changedFields.push(`id_parent: ${originalIdParent} → ${newIdParent}`);
291
+ }
292
+ if (originalTitle !== newTitle) {
293
+ changedFields.push(`title: ${originalTitle} → ${newTitle}`);
294
+ }
295
+ if (originalCode !== newCode) {
296
+ changedFields.push(`code: ${originalCode} → ${newCode}`);
297
+ }
298
+ if (originalRoute !== newRoute) {
299
+ changedFields.push(`route: ${originalRoute} → ${newRoute}`);
300
+ }
301
+ if (originalIcon !== newIcon) {
302
+ changedFields.push(`icon: ${originalIcon} → ${newIcon}`);
303
+ }
304
+ if (JSON.stringify(originalRoles) !== JSON.stringify(newRoles)) {
305
+ changedFields.push(`allowed_roles: ${originalRoles} → ${newRoles}`);
306
+ }
307
+
308
+ return changedFields.length > 0;
309
+ });
310
+
311
+ const isBlank = (s: unknown): boolean => typeof s !== 'string' || s.trim() === '';
312
+
313
+ const isRouteValid = ({ route, code }: FlatNode): boolean => {
314
+ // route считается заданным, только если это непустая строка
315
+ const hasRoute = route.trim() !== '';
316
+
317
+ return !hasRoute || route === code;
318
+ };
319
+
320
+ const invalidCodeTitles: string[] = [];
321
+ const invalidRouteTitles: FlatNode[] = [];
322
+
323
+ for (const el of changedElements) {
324
+ if (isBlank(el.code)) {
325
+ invalidCodeTitles.push(el.title ?? '(без названия)');
326
+ }
327
+
328
+ if (!isRouteValid(el)) {
329
+ invalidRouteTitles.push(el);
330
+ }
331
+ }
332
+
333
+ if (invalidCodeTitles.length > 0) {
334
+ this.errorMsgOutput.emit({
335
+ label: 'Конструктор меню',
336
+ appearance: 'negative',
337
+ // eslint-disable-next-line xss/no-mixed-html
338
+ content: `Все поля code должны быть заполнены. </br>
339
+ Исправьте следующие поля: </br>
340
+ ${invalidCodeTitles.map((t) => `- ${t}`).join('</br>')}
341
+ `,
342
+ });
343
+
344
+ return;
345
+ }
346
+
347
+ if (invalidRouteTitles.length > 0) {
348
+ this.errorMsgOutput.emit({
349
+ label: 'Конструктор меню',
350
+ appearance: 'negative',
351
+ // eslint-disable-next-line xss/no-mixed-html
352
+ content: `Все поля code должны быть равны полю route. </br>
353
+ Исправьте следующие поля: </br>
354
+ ${invalidRouteTitles.map((t) => `- ${t.title} (${t.code} | ${t.route})`).join('</br>')}
355
+ `,
356
+ });
357
+
358
+ return;
359
+ }
360
+
361
+ const elRoute = (route: string): string | null => (route === '' ? null : route);
362
+
363
+ const normalizeElement = (el: FlatNode): IClsMenuItemInput => ({
364
+ title: el.title.trim(),
365
+ route: elRoute(el.route.trim()),
366
+ code: el.code,
367
+ icon: el.icon,
368
+ order_num: el.order_num,
369
+ allowed_roles: el.allowed_roles
370
+ ? el.allowed_roles.split(',').map((value) => value.trim())
371
+ : null,
372
+ id_parent: el.id_parent,
373
+ });
374
+
375
+ const objectsToSave = changedElements
376
+ .filter(({ id }) => !id.includes(NEW_ITEM_PREFIX))
377
+ .map((el) => ({
378
+ _set: normalizeElement(el),
379
+ where: { id: { _eq: el.id } },
380
+ }));
381
+
382
+ const objectsToInsert = changedElements
383
+ .filter(({ id }) => id.includes(NEW_ITEM_PREFIX))
384
+ .map((element) => {
385
+ element.id = EMPTY_UUID;
386
+
387
+ return normalizeElement(element);
388
+ });
389
+
390
+ const objectsToDelete = [...this.deletedIds];
391
+
392
+ if (logging) {
393
+ console.log(`Измененные элементы`, objectsToSave);
394
+ console.log(`Новые элементы`, objectsToInsert);
395
+ console.log('Удалённые элементы:', objectsToDelete);
396
+ }
397
+
398
+ this._store.updateMenu(objectsToSave, objectsToInsert, objectsToDelete);
399
+
400
+ this.deletedIds = [];
401
+ }
402
+
403
+ protected handleFold(state: boolean): void {
404
+ for (const element of this.flatTree()) {
405
+ if (element.title !== ROOT_TITLE) {
406
+ element.collapsed = state;
407
+ }
408
+ }
409
+
410
+ this.flatTree.set([...this.flatTree()]);
411
+ }
412
+
413
+ /**
414
+ * Удаляет один элемент из дерева.
415
+ * Потомки становятся дочерними элементами родителя удалённого узла.
416
+ */
417
+ protected deleteItem(node: FlatNode): void {
418
+ const arr = [...this.flatTree()];
419
+ const index = arr.indexOf(node);
420
+ if (index === -1) {
421
+ return;
422
+ }
423
+
424
+ const parentId = node.id_parent;
425
+ const nodeDepth = node.depth;
426
+
427
+ // Находим потомков, которые были напрямую под этим узлом
428
+ for (let i = index + 1; i < arr.length; i++) {
429
+ const next = arr[i];
430
+ if (next.depth <= nodeDepth) {
431
+ break;
432
+ }
433
+ if (next.depth === nodeDepth + 1) {
434
+ // потомок становится ребёнком родителя удалённого узла
435
+ next.id_parent = parentId ?? null;
436
+ next.depth = nodeDepth; // поднимаем на один уровень вверх
437
+ } else if (next.depth > nodeDepth + 1) {
438
+ // поднимаем остальные на один уровень вверх
439
+ next.depth -= 1;
440
+ }
441
+ }
442
+
443
+ // Удаляем сам элемент
444
+ arr.splice(index, 1);
445
+
446
+ // Если id не временный — добавляем в список на удаление
447
+ if (!node.id.includes(NEW_ITEM_PREFIX)) {
448
+ this.deletedIds.push(node.id);
449
+ }
450
+
451
+ this._scheduleRecalc(arr);
452
+ }
453
+
454
+ /**
455
+ * Добавляет новый элемент в дерево.
456
+ * По умолчанию он создаётся как дочерний элемент root.
457
+ */
458
+ protected addNewItem(): void {
459
+ const arr = [...this.flatTree()];
460
+
461
+ const rootNode = arr.find((n) => n.title === this.ROOT_TITLE);
462
+
463
+ if (!rootNode) {
464
+ console.error('Root элемент не найден. Новый пункт не может быть добавлен.');
465
+ return;
466
+ }
467
+
468
+ const newNode: FlatNode = {
469
+ id: `${NEW_ITEM_PREFIX}${crypto.randomUUID()}`,
470
+ id_parent: rootNode.id,
471
+ title: 'Новый пункт меню',
472
+ route: '',
473
+ icon: '',
474
+ order_num: 1,
475
+ allowed_roles: null,
476
+ collapsed: true,
477
+ code: '',
478
+ depth: rootNode.depth + 1,
479
+ };
480
+
481
+ const insertIndex = arr.findIndex((n) => n.id === rootNode.id) + 1;
482
+ arr.splice(insertIndex, 0, newNode);
483
+
484
+ this._scheduleRecalc(arr);
485
+ }
486
+
487
+ /**
488
+ * Сбрасывает текущее состояние в исходное
489
+ */
490
+ protected reset(): void {
491
+ const originalMenu = structuredClone(this._store.originalMenu);
492
+ this.flatTree.set(this._convertToFlatNode(originalMenu));
493
+ this.deletedIds = [];
494
+ }
495
+
496
+ /**
497
+ * Проверяет, находится ли элемент в текущей перетаскиваемой ветке
498
+ */
499
+ protected isDragged(node: FlatNode): boolean {
500
+ return this.draggedBranch().some((n) => n.id === node.id);
501
+ }
502
+
503
+ /**
504
+ * Собирает всю ветку элементов начиная с указанного узла (включая потомков)
505
+ */
506
+ private _collectBranch(arr: FlatNode[], root: FlatNode): FlatNode[] {
507
+ const start = arr.indexOf(root);
508
+ if (start < 0) {
509
+ return [];
510
+ }
511
+ const branch: FlatNode[] = [{ ...root }];
512
+ for (let i = start + 1; i < arr.length; i++) {
513
+ const n = arr[i];
514
+ if (n.depth > root.depth) {
515
+ branch.push(n);
516
+ } else {
517
+ break;
518
+ }
519
+ }
520
+ return branch;
521
+ }
522
+
523
+ /**
524
+ * Сдвигает глубину всех элементов ветки на указанную разницу
525
+ * Не допускает отрицательных глубин
526
+ */
527
+ private _applyDepthShift(branch: FlatNode[], diff: number): void {
528
+ if (diff === 0) {
529
+ return;
530
+ }
531
+ for (const n of branch) {
532
+ n.depth = Math.max(0, n.depth + diff);
533
+ }
534
+ }
535
+
536
+ /**
537
+ * Преобразует иерархический JSON в плоский массив FlatNode[]
538
+ * Сохраняет порядок элементов и их вложенность
539
+ */
540
+ private _convertToFlatNode(data: IClsMenuItem[]): FlatNode[] {
541
+ // Глубокая копия, чтобы не портить оригинал
542
+ const cloned = structuredClone(data);
543
+
544
+ const map = new Map<string, IClsMenuItem>();
545
+ const roots: IClsMenuItem[] = [];
546
+
547
+ for (const item of cloned) {
548
+ map.set(item.id, item);
549
+ }
550
+
551
+ for (const item of cloned) {
552
+ if (item.id_parent && map.has(item.id_parent)) {
553
+ const parent = map.get(item.id_parent)!;
554
+ if (!parent.children) {
555
+ parent.children = [];
556
+ }
557
+ parent.children.push(item);
558
+ } else {
559
+ roots.push(item);
560
+ }
561
+ }
562
+
563
+ const flat: FlatNode[] = [];
564
+ const walk = (node: IClsMenuItem, depth: number): void => {
565
+ flat.push({
566
+ id: node.id,
567
+ id_parent: node.id_parent,
568
+ title: node.title ?? '',
569
+ route: node.route ?? '',
570
+ icon: node.icon ?? '',
571
+ order_num: node.order_num ?? 0,
572
+ allowed_roles: node.allowed_roles?.join(',') ?? null,
573
+ collapsed: node.title !== ROOT_TITLE,
574
+ code: node.code ?? '',
575
+ depth,
576
+ });
577
+
578
+ if (node.children?.length) {
579
+ const sortedChildren = [...node.children].sort(
580
+ (a, b) => (a.order_num ?? 0) - (b.order_num ?? 0)
581
+ );
582
+ for (const child of sortedChildren) {
583
+ walk(child, depth + 1);
584
+ }
585
+ }
586
+ };
587
+
588
+ const sortedRoots = [...roots].sort((a, b) => (a.order_num ?? 0) - (b.order_num ?? 0));
589
+ for (const root of sortedRoots) {
590
+ walk(root, 0);
591
+ }
592
+
593
+ return flat;
594
+ }
595
+
596
+ /**
597
+ * Возвращает список видимых элементов на основе флагов collapsed
598
+ * Использует стек для отслеживания свернутости на каждом уровне
599
+ */
600
+ private _getVisibleFrom(arr: FlatNode[] | (() => FlatNode[])): FlatNode[] {
601
+ const source = typeof arr === 'function' ? arr() : arr;
602
+ const out: FlatNode[] = [];
603
+ const collapsedStack: boolean[] = [];
604
+
605
+ for (const n of source) {
606
+ while (collapsedStack.length > n.depth) {
607
+ collapsedStack.pop();
608
+ }
609
+
610
+ if (!collapsedStack.includes(true)) {
611
+ out.push(n);
612
+ collapsedStack[n.depth] = !!n.collapsed;
613
+ }
614
+ }
615
+
616
+ return out;
617
+ }
618
+
619
+ /**
620
+ * Пересчитывает order_num и id_parent у всех элементов массива
621
+ * После перемещений поддерживает корректную структуру дерева
622
+ * order_num назначается относительно родителя (1..N)
623
+ */
624
+ private _recalculateTree(arr: FlatNode[]): void {
625
+ const parents: FlatNode[] = [];
626
+ const childCounters = new Map<string | null, number>();
627
+
628
+ for (const node of arr) {
629
+ while (parents.length > 0 && parents[parents.length - 1].depth >= node.depth) {
630
+ parents.pop();
631
+ }
632
+
633
+ const parent = parents.length > 0 ? parents[parents.length - 1] : null;
634
+ node.id_parent = parent ? parent.id : null;
635
+
636
+ // вычисляем порядковый номер среди братьев
637
+ if (node.title !== ROOT_TITLE) {
638
+ const parentId = node.id_parent ?? null;
639
+ const currentCount = childCounters.get(parentId) ?? 1;
640
+ node.order_num = currentCount;
641
+ childCounters.set(parentId, currentCount + 1);
642
+ }
643
+
644
+ parents.push(node);
645
+ }
646
+ }
647
+
648
+ /**
649
+ * Асинхронно планирует пересчет дерева через requestAnimationFrame
650
+ * Это предотвращает множественные лишние пересчеты при частых изменениях
651
+ */
652
+ private _scheduleRecalc(arr: FlatNode[]): void {
653
+ if (this._pendingRecalc) {
654
+ return;
655
+ }
656
+
657
+ this._pendingRecalc = true;
658
+ requestAnimationFrame(() => {
659
+ this._recalculateTree([...arr]);
660
+ const current = this.flatTree();
661
+ if (!this._arraysEqual(current, arr)) {
662
+ this.flatTree.set([...arr]);
663
+ }
664
+ this._pendingRecalc = false;
665
+ });
666
+ }
667
+
668
+ /**
669
+ * Проверяет равенство двух массивов FlatNode по ключевым свойствам
670
+ */
671
+ private _arraysEqual(a: FlatNode[], b: FlatNode[]): boolean {
672
+ if (a.length !== b.length) {
673
+ return false;
674
+ }
675
+ for (const [i, element] of a.entries()) {
676
+ if (
677
+ element.id !== b[i].id ||
678
+ element.depth !== b[i].depth ||
679
+ element.order_num !== b[i].order_num
680
+ ) {
681
+ return false;
682
+ }
683
+ }
684
+
685
+ return true;
686
+ }
687
+ }