@opengis/gis 0.2.145 → 0.2.146

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 (201) hide show
  1. package/README.md +181 -181
  2. package/dist/{CardIcon-KPdJQSAj.js → CardIcon-BCll_4SB.js} +1 -1
  3. package/dist/{EntityCreatePage-Da8XgBKU.js → EntityCreatePage-Ch8NU_Yw.js} +14 -14
  4. package/dist/{EntityEditPage-QktKEAxz.js → EntityEditPage-CRRcW7FL.js} +27 -27
  5. package/dist/{EntityTablePage-D0CxSITf.js → EntityTablePage-DXJPsOx8.js} +26 -26
  6. package/dist/{ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-B7Nkfd7c.js → ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-BJ-zsrml.js} +1 -1
  7. package/dist/{HeaderActions.vue_vue_type_script_setup_true_lang-9kitzmJK.js → HeaderActions.vue_vue_type_script_setup_true_lang-EZGjVDor.js} +5 -5
  8. package/dist/{MapSettings-CBkp5Cfw.js → MapSettings-CG7u4F4i.js} +33 -33
  9. package/dist/{RastersTablePage-D1k_WisA.js → RastersTablePage-CN5hfj6F.js} +29 -29
  10. package/dist/cartocss-BNVXz6oJ.js +1065 -0
  11. package/dist/{import-utils-CVdAWcDL.js → import-utils-BwcMU3Gp.js} +33 -33
  12. package/dist/{index-DJKZSGVW.js → index-8aAArh78.js} +63 -63
  13. package/dist/index.css +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/index.umd.cjs +35 -35
  16. package/dist/raster-BN1gB-NS.js +804 -0
  17. package/dist/{register-Br5WdQas.js → register-DZ24Z6dC.js} +8 -8
  18. package/dist/{service-1sCTWkzU.js → service-DXLa4AiW.js} +392 -380
  19. package/dist/{vs-datatable-CviY_UkX.js → vs-datatable-DVC6-2mA.js} +28 -28
  20. package/module/cls.json +6 -6
  21. package/module/gis/card/gis.metadata.table/index.yml +22 -22
  22. package/module/gis/card/gis.metadata.table/main_info.hbs +20 -20
  23. package/module/gis/card/gis.metadata.table/metadata_info.hbs +27 -27
  24. package/module/gis/card/gis.metadata.table/other.hbs +25 -25
  25. package/module/gis/card/gis.rasters.table/index.yml +11 -11
  26. package/module/gis/card/gis.rasters.table/main_info.hbs +27 -27
  27. package/module/gis/card/gis.registers.table/cls.hbs +36 -36
  28. package/module/gis/card/gis.registers.table/columns.hbs +89 -89
  29. package/module/gis/card/gis.registers.table/filters.hbs +80 -80
  30. package/module/gis/card/gis.registers.table/index.yml +23 -23
  31. package/module/gis/card/gis.registers.table/main_info.hbs +35 -35
  32. package/module/gis/card/gis.registers.table/source.hbs +45 -45
  33. package/module/gis/card/gis.services.table/attributes.hbs +91 -91
  34. package/module/gis/card/gis.services.table/filters.hbs +83 -83
  35. package/module/gis/card/gis.services.table/index.yml +25 -25
  36. package/module/gis/card/gis.services.table/main_info.hbs +27 -27
  37. package/module/gis/card/gis.services.table/source.hbs +25 -25
  38. package/module/gis/cls/bool.yes_no.json +12 -12
  39. package/module/gis/cls/encoding.json +14 -14
  40. package/module/gis/cls/geom_type.json +14 -14
  41. package/module/gis/cls/gis.column_type.json +34 -34
  42. package/module/gis/cls/gis.column_view_type.json +26 -26
  43. package/module/gis/cls/gis.filter_type.json +22 -22
  44. package/module/gis/cls/language.json +10 -10
  45. package/module/gis/cls/meta.service_type.json +42 -42
  46. package/module/gis/cls/ogc.service.json +21 -21
  47. package/module/gis/cls/service_type.json +42 -42
  48. package/module/gis/cls/source_type.json +10 -10
  49. package/module/gis/cls/standarts.json +6 -6
  50. package/module/gis/cls/topic_category.json +106 -106
  51. package/module/gis/cls/update_frequency.json +29 -29
  52. package/module/gis/cls/view.json +21 -21
  53. package/module/gis/form/feedback.answer.form.json +10 -10
  54. package/module/gis/form/gis.cartocss.form.json +64 -64
  55. package/module/gis/form/gis.group_list.form.json +17 -17
  56. package/module/gis/form/gis.maps.form.json +61 -61
  57. package/module/gis/form/gis.metadata.form.json +240 -240
  58. package/module/gis/form/gis.metadata_new.form.json +195 -195
  59. package/module/gis/form/gis.ogc_service.form.json +51 -51
  60. package/module/gis/form/gis.rasters.form.json +76 -76
  61. package/module/gis/form/gis.registers.form.json +124 -124
  62. package/module/gis/form/gis.registers_column.form.json +84 -84
  63. package/module/gis/form/gis.registers_filter.form.json +65 -65
  64. package/module/gis/form/gis.services.form.json +111 -111
  65. package/module/gis/form/gis.services_attributes.form.json +75 -75
  66. package/module/gis/form/gis.services_filter.form.json +65 -65
  67. package/module/gis/menu.json +43 -43
  68. package/module/gis/select/admin.cls.name.sql +9 -9
  69. package/module/gis/select/layer_list.sql +7 -7
  70. package/module/gis/select/layer_list_text.sql +7 -7
  71. package/module/gis/select/pg.column_name.geometry.sql +12 -12
  72. package/module/gis/select/pg.columns.parent.sql +6 -6
  73. package/module/gis/select/pg.table_name.sql +17 -17
  74. package/module/gis/select/service_id.sql +1 -1
  75. package/module/gis/table/gis.cartocss.table.json +74 -74
  76. package/module/gis/table/gis.group_list.table.json +58 -58
  77. package/module/gis/table/gis.maps.table.json +110 -110
  78. package/module/gis/table/gis.metadata.table.json +70 -70
  79. package/module/gis/table/gis.metadata_new.table.json +137 -137
  80. package/module/gis/table/gis.ogc_service.table.json +100 -100
  81. package/module/gis/table/gis.rasters.table.json +101 -101
  82. package/module/gis/table/gis.registers.table.json +143 -143
  83. package/module/gis/table/gis.services.table.json +120 -120
  84. package/module/gis/table/site.gis.registers.table.json +88 -88
  85. package/module/gis/table/site.gis.services.table.json +106 -106
  86. package/module/gis/templates/ISO19136_2017_gml_template.xml +330 -330
  87. package/module/gis/tokens.yml +5 -5
  88. package/module/permissions/form/permissions.users.form.json +151 -151
  89. package/module/permissions/table/gis.permissions.table.json +97 -97
  90. package/module/test/cls/bp_build_type.json +37 -37
  91. package/module/test/cls/doc_status.json +31 -31
  92. package/module/test/cls/ts.temp_status.json +18 -18
  93. package/module/test/cls/ts.temp_structure.ts_class.json +49 -49
  94. package/module/test/cls/ts.temp_type.json +9 -9
  95. package/module/test/layer/bp.json +59 -59
  96. package/module/test/layer/bp1.yml +33 -33
  97. package/module/test/layer/individual.yml +53 -53
  98. package/module/test/layer/ts.linking_passport.yml +55 -55
  99. package/module/test/layer/ts.temp_structure.yml +50 -50
  100. package/module/test/map/addr.yml +21 -21
  101. package/module/test/map/bp_myo.json +43 -43
  102. package/module/test/map/bpf.json +43 -43
  103. package/module/test/map/main.json +37 -37
  104. package/module/test/map/mbd.json +92 -92
  105. package/module/test/map/ts.json +53 -53
  106. package/module/test/select/address_id.json +2 -2
  107. package/module/test/select/address_id.sql +7 -7
  108. package/module/test/select/core.user_uid.sql +1 -1
  109. package/module/test/table/data_address.street.table.json +69 -69
  110. package/module/test/table/data_bp_myo.bp.table.json +122 -122
  111. package/package.json +75 -75
  112. package/plugin.js +55 -55
  113. package/server/migrations/array_intersect.sql +13 -13
  114. package/server/migrations/cartocss.sql +27 -27
  115. package/server/migrations/group_list.sql +74 -74
  116. package/server/migrations/maps.sql +30 -30
  117. package/server/migrations/metadata.sql +415 -415
  118. package/server/migrations/ogc.sql +106 -106
  119. package/server/migrations/rasters.sql +265 -265
  120. package/server/migrations/services.sql +247 -247
  121. package/server/migrations/services_users_rel.sql +22 -22
  122. package/server/migrations/widgets.sql +20 -20
  123. package/server/plugins/crons.js +21 -21
  124. package/server/plugins/mapnik/funcs/checkRasterFile.js +109 -109
  125. package/server/plugins/mapnik/funcs/mapnik.js +151 -151
  126. package/server/plugins/mapnik/funcs/rootFolder.mjs +8 -8
  127. package/server/plugins/mapnik/map.proto +230 -230
  128. package/server/plugins/vite.js +74 -74
  129. package/server/routes/gis/cartocss/add.cartocss.js +42 -42
  130. package/server/routes/gis/cartocss/get.cartocss.js +59 -59
  131. package/server/routes/gis/checkXML.js +117 -117
  132. package/server/routes/gis/dashboard.js +29 -29
  133. package/server/routes/gis/index.mjs +87 -87
  134. package/server/routes/gis/metadata/editMetadata.js +34 -34
  135. package/server/routes/gis/metadata/metadataXML.js +13 -13
  136. package/server/routes/gis/ogc/map.info.point.js +124 -124
  137. package/server/routes/gis/registers/add.registry.js +35 -35
  138. package/server/routes/gis/registers/del.registry.js +14 -14
  139. package/server/routes/gis/registers/funcs/classifiers.js +100 -100
  140. package/server/routes/gis/registers/funcs/columns.js +3 -3
  141. package/server/routes/gis/registers/funcs/content.type.js +9 -9
  142. package/server/routes/gis/registers/funcs/get.info.js +89 -89
  143. package/server/routes/gis/registers/funcs/handleRegistryRequest.js +146 -146
  144. package/server/routes/gis/registers/gis.export.js +153 -153
  145. package/server/routes/gis/registers/gis.registry.js +64 -64
  146. package/server/routes/gis/registers/gis.registry.list.js +59 -59
  147. package/server/routes/gis/registers/insert.columns.js +107 -107
  148. package/server/routes/gis/registers/insert.filters.js +110 -110
  149. package/server/routes/gis/registers/map.registry.js +79 -79
  150. package/server/routes/gis/services/add.service.js +64 -64
  151. package/server/routes/gis/services/del.service.js +12 -12
  152. package/server/routes/gis/services/get.layer.geom.js +27 -27
  153. package/server/routes/gis/services/get.services.col.js +33 -33
  154. package/server/routes/gis/services/get.services.js +84 -84
  155. package/server/routes/gis/services/legend.auto.js +77 -77
  156. package/server/routes/map/controllers/clearTiles.js +34 -34
  157. package/server/routes/map/controllers/geojson.js +187 -187
  158. package/server/routes/map/controllers/jsonData.js +205 -205
  159. package/server/routes/map/controllers/layerList.js +102 -102
  160. package/server/routes/map/controllers/map.js +123 -123
  161. package/server/routes/map/controllers/mapCatalog.js +72 -72
  162. package/server/routes/map/controllers/mapCatalogAttribute.js +55 -55
  163. package/server/routes/map/controllers/mapFeatures.js +128 -128
  164. package/server/routes/map/controllers/mapFormat.js +234 -234
  165. package/server/routes/map/controllers/mapTiles.js +152 -152
  166. package/server/routes/map/controllers/maps.js +15 -15
  167. package/server/routes/map/controllers/marker_icon.js +43 -43
  168. package/server/routes/map/controllers/vtile.js +172 -172
  169. package/server/routes/map/index.mjs +169 -169
  170. package/server/routes/map/maps/add.map.js +43 -43
  171. package/server/routes/map/maps/del.map.js +18 -18
  172. package/server/routes/map/maps/get.map.js +118 -118
  173. package/server/routes/map/vtile1.js +179 -179
  174. package/server/routes/map/widgets/add.widget.js +38 -38
  175. package/server/routes/map/widgets/del.widget.js +22 -22
  176. package/server/routes/map/widgets/get.widget.js +40 -40
  177. package/server/routes/mapnik/controllers/clearTiles.js +106 -106
  178. package/server/routes/mapnik/controllers/createXml.js +67 -67
  179. package/server/routes/mapnik/controllers/createXmlMulti.js +76 -76
  180. package/server/routes/mapnik/controllers/fileSearch.js +38 -38
  181. package/server/routes/mapnik/controllers/fileStat.js +28 -28
  182. package/server/routes/mapnik/controllers/mapnikLogger.js +29 -29
  183. package/server/routes/mapnik/controllers/mapnikStat.js +19 -19
  184. package/server/routes/mapnik/controllers/pretile.js +144 -144
  185. package/server/routes/mapnik/controllers/rasterInfo.js +57 -57
  186. package/server/routes/mapnik/controllers/readDir.js +22 -22
  187. package/server/routes/mapnik/controllers/rtile.js +150 -150
  188. package/server/routes/mapnik/controllers/uploadRaster.js +157 -157
  189. package/server/routes/mapnik/functions/cartoBounds.js +32 -32
  190. package/server/routes/mapnik/functions/convertBoundToTile.js +27 -27
  191. package/server/routes/mapnik/functions/uploadXML.js +113 -113
  192. package/server/routes/mapnik/index.js +40 -40
  193. package/server/routes/permissions/controllers/catalog.permissions.edit.js +22 -22
  194. package/server/routes/permissions/controllers/catalog.permissions.js +7 -7
  195. package/server/routes/permissions/controllers/gis.catalog.js +80 -80
  196. package/server/routes/permissions/controllers/utils/get.permissions.js +59 -59
  197. package/server/routes/permissions/index.mjs +18 -18
  198. package/server/routes/root.mjs +3 -3
  199. package/utils.js +13 -13
  200. package/dist/cartocss-KfS-aCRn.js +0 -1053
  201. package/dist/raster-CKQiGAgN.js +0 -792
@@ -1,1053 +0,0 @@
1
- import { openBlock as w, createElementBlock as z, createElementVNode as o, defineComponent as W, computed as M, createTextVNode as Le, createVNode as E, mergeModels as Ye, defineAsyncComponent as me, useModel as Ge, ref as b, withCtx as G, toDisplayString as U, unref as le, watch as T, onUnmounted as We, createCommentVNode as B, onBeforeUnmount as Me, onMounted as Xe, withDirectives as Ze, vModelText as Ke, createBlock as P, normalizeClass as ke, normalizeStyle as et, Fragment as Ce, renderList as tt, resolveDynamicComponent as at } from "vue";
2
- import { useRouter as ot, useRoute as nt } from "vue-router";
3
- import { notify as D } from "@opengis/core";
4
- import { _ as st, f as ze, o as lt, p as rt, q as ut, M as it, i as ct, j as Se, m as dt } from "./index-DJKZSGVW.js";
5
- import { S as ft, C as mt } from "./CardIcon-KPdJQSAj.js";
6
- import { _ as pt, a as yt, b as vt, c as gt } from "./HeaderActions.vue_vue_type_script_setup_true_lang-9kitzmJK.js";
7
- import { _ as Ee } from "./MonacoEditor.vue_vue_type_script_setup_true_lang-D3ZPeXMw.js";
8
- import { V as ht } from "./vs-datatable-CviY_UkX.js";
9
- import { _ as $e } from "./ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-B7Nkfd7c.js";
10
- const bt = {}, xt = {
11
- xmlns: "http://www.w3.org/2000/svg",
12
- width: "24",
13
- height: "24",
14
- viewBox: "0 0 24 24",
15
- fill: "none",
16
- stroke: "currentColor",
17
- "stroke-width": "2",
18
- "stroke-linecap": "round",
19
- "stroke-linejoin": "round",
20
- class: "lucide lucide-table"
21
- };
22
- function wt(A, u) {
23
- return w(), z("svg", xt, [...u[0] || (u[0] = [
24
- o("path", { d: "M12 3v18" }, null, -1),
25
- o("rect", {
26
- width: "18",
27
- height: "18",
28
- x: "3",
29
- y: "3",
30
- rx: "2"
31
- }, null, -1),
32
- o("path", { d: "M3 9h18" }, null, -1),
33
- o("path", { d: "M3 15h18" }, null, -1)
34
- ])]);
35
- }
36
- const _t = /* @__PURE__ */ st(bt, [["render", wt]]), kt = { class: "flex flex-col h-full" }, Ct = { class: "flex justify-end mb-3 gap-2" }, St = /* @__PURE__ */ W({
37
- __name: "cartocss-css-tab",
38
- props: {
39
- modelValue: {}
40
- },
41
- emits: ["update:modelValue", "save"],
42
- setup(A, { emit: u }) {
43
- const i = A, j = u, S = M({
44
- get: () => i.modelValue,
45
- set: (x) => j("update:modelValue", x)
46
- });
47
- return (x, c) => (w(), z("div", kt, [
48
- o("div", Ct, [
49
- o("button", {
50
- type: "button",
51
- class: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium bg-gradient-to-r from-sky-400 to-blue-400 hover:from-sky-500 hover:to-blue-500 text-white shadow-sm px-4 py-2 h-9 text-xs transition-all duration-300",
52
- onClick: c[0] || (c[0] = (d) => x.$emit("save"))
53
- }, [...c[2] || (c[2] = [
54
- o("svg", {
55
- xmlns: "http://www.w3.org/2000/svg",
56
- width: "24",
57
- height: "24",
58
- viewBox: "0 0 24 24",
59
- fill: "none",
60
- stroke: "currentColor",
61
- "stroke-width": "2",
62
- "stroke-linecap": "round",
63
- "stroke-linejoin": "round",
64
- class: "h-3.5 w-3.5"
65
- }, [
66
- o("path", { d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a 2 2 0 0 1-2-2V5a 2 2 0 0 1 2-2z" }),
67
- o("path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a 1 1 0 0 0-1 1v7" }),
68
- o("path", { d: "M7 3v4a1 1 0 0 0 1 1h7" })
69
- ], -1),
70
- Le(" Зберегти ", -1)
71
- ])])
72
- ]),
73
- E(Ee, {
74
- modelValue: S.value,
75
- "onUpdate:modelValue": c[1] || (c[1] = (d) => S.value = d),
76
- language: "cartocss",
77
- class: "flex-1 rounded-lg overflow-hidden"
78
- }, null, 8, ["modelValue"])
79
- ]));
80
- }
81
- }), $t = { class: "flex flex-col flex-1 min-h-0" }, Vt = { class: "flex justify-between mb-3 gap-2" }, Lt = { class: "text-left" }, Mt = { class: "font-medium text-gray-900" }, zt = { class: "text-xs text-gray-500" }, Et = { class: "flex justify-center gap-2" }, jt = ["checked", "onChange"], At = { class: "text-sm font-medium text-gray-900" }, Nt = /* @__PURE__ */ W({
82
- __name: "cartocss-data-tab",
83
- props: {
84
- modelValue: { default: [] },
85
- modelModifiers: {}
86
- },
87
- emits: /* @__PURE__ */ Ye(["save"], ["update:modelValue"]),
88
- setup(A, { emit: u }) {
89
- const i = [
90
- { key: "table", label: "Таблиця", slot: "datasetCell" },
91
- {
92
- key: "active",
93
- label: "Активний",
94
- slot: "activeCell",
95
- width: "140px"
96
- },
97
- {
98
- key: "zoom",
99
- label: "Min Зум",
100
- slot: "zoomCell",
101
- width: "140px"
102
- }
103
- ], j = me(
104
- () => import("@opengis/core").then((_) => _.VsModal)
105
- ), S = me(() => import("@opengis/form")), x = Ge(A, "modelValue"), c = u, d = b(!1), s = b({
106
- table: "",
107
- query: "",
108
- srid: "",
109
- key: "",
110
- columns: "",
111
- gcol: "",
112
- minzoom: "",
113
- maxzoom: "",
114
- proj4text: "",
115
- active: !0
116
- }), m = {
117
- table: { type: "text", label: "Таблиця", validators: ["required"] },
118
- key: { type: "text", label: "Ключ", validators: ["required"] },
119
- query: { type: "text", label: "Query" },
120
- columns: { type: "text", label: "Колонки" },
121
- gcol: { type: "text", label: "Колонка geometry" },
122
- srid: { type: "number", label: "SRID" },
123
- proj4text: { type: "text", label: "PROJ4" },
124
- active: { type: "switcher", label: "Активна" },
125
- minzoom: { type: "number", label: "Min Зум", col: 6 },
126
- maxzoom: { type: "number", label: "Max Зум", col: 6 }
127
- };
128
- function r() {
129
- s.value = {
130
- table: "",
131
- query: "",
132
- srid: "",
133
- key: "",
134
- columns: "",
135
- gcol: "",
136
- minzoom: "",
137
- maxzoom: "",
138
- proj4text: "",
139
- active: !0
140
- }, d.value = !0;
141
- }
142
- function $() {
143
- d.value = !1;
144
- }
145
- function N() {
146
- var f, k;
147
- const _ = (f = s.value.table) == null ? void 0 : f.trim(), v = (k = s.value.key) == null ? void 0 : k.trim();
148
- if (!_ || !v) {
149
- D({
150
- type: "warning",
151
- title: "Перевірка",
152
- message: "Вкажіть таблицю та підпис"
153
- });
154
- return;
155
- }
156
- x.value = [
157
- ...Array.isArray(x.value) ? x.value : [],
158
- { ...s.value, table: _, key: v }
159
- ], d.value = !1;
160
- }
161
- function p(_, v) {
162
- var k;
163
- const f = ((k = v == null ? void 0 : v.target) == null ? void 0 : k.checked) ?? !1;
164
- _.active = f, x.value = Array.isArray(x.value) ? [...x.value] : [];
165
- }
166
- return (_, v) => (w(), z("div", $t, [
167
- o("div", Vt, [
168
- o("button", {
169
- type: "button",
170
- class: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium bg-gradient-to-r from-gray-500 to-gray-400 text-white h-9 px-4 py-2 hover:from-gray-600 hover:to-gray-500",
171
- onClick: r
172
- }, " Додати таблицю "),
173
- o("button", {
174
- type: "button",
175
- class: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium bg-gradient-to-r from-sky-400 to-blue-400 hover:from-sky-500 hover:to-blue-500 text-white shadow-sm px-4 py-2 h-9 text-xs transition-all duration-300",
176
- onClick: v[0] || (v[0] = (f) => c("save"))
177
- }, " Зберегти ")
178
- ]),
179
- E(ht, {
180
- modelValue: x.value,
181
- "onUpdate:modelValue": v[1] || (v[1] = (f) => x.value = f),
182
- "columns-scheme": i,
183
- "form-scheme": m,
184
- "add-button": !1,
185
- "main-col-width": "260px"
186
- }, {
187
- datasetCell: G(({ row: f }) => [
188
- o("div", Lt, [
189
- o("div", Mt, U(f.table), 1),
190
- o("div", zt, U(f.key), 1)
191
- ])
192
- ]),
193
- activeCell: G(({ row: f }) => [
194
- o("label", Et, [
195
- o("input", {
196
- type: "checkbox",
197
- class: "h-4 w-4 text-sky-500 border-gray-300 rounded focus:ring-sky-300",
198
- checked: f.active,
199
- onChange: (k) => p(f, k)
200
- }, null, 40, jt)
201
- ])
202
- ]),
203
- zoomCell: G(({ row: f }) => [
204
- o("div", At, U(f.zoom), 1)
205
- ]),
206
- _: 1
207
- }, 8, ["modelValue"]),
208
- E(le(j), {
209
- teleport: "#modal",
210
- visible: d.value,
211
- "onUpdate:visible": v[3] || (v[3] = (f) => d.value = f),
212
- title: "Нова таблиця CartoCSS"
213
- }, {
214
- footer: G(() => [
215
- o("div", { class: "flex justify-end gap-2 p-4 border-т" }, [
216
- o("button", {
217
- type: "button",
218
- class: "px-4 py-2 rounded bg-gray-100 text-gray-700",
219
- onClick: $
220
- }, " Скасувати "),
221
- o("button", {
222
- type: "button",
223
- class: "px-4 py-2 rounded bg-blue-600 text-white",
224
- onClick: N
225
- }, " Додати ")
226
- ])
227
- ]),
228
- default: G(() => [
229
- E(le(S), {
230
- values: s.value,
231
- "onUpdate:values": v[2] || (v[2] = (f) => s.value = f),
232
- schema: m
233
- }, null, 8, ["values"])
234
- ]),
235
- _: 1
236
- }, 8, ["visible"])
237
- ]));
238
- }
239
- }), Bt = { class: "flex flex-col flex-1 min-h-0 gap-4" }, qt = { class: "h-[calc(100vh-230px)] rounded-md border border-gray-200 bg-white" }, Tt = /* @__PURE__ */ W({
240
- __name: "cartocss-card-tab",
241
- props: {
242
- card: {},
243
- table: {}
244
- },
245
- emits: ["save"],
246
- setup(A, { emit: u }) {
247
- const i = A, j = u, S = b(i.table), x = b(i.card), c = me(() => import("@opengis/form").then((s) => s.VsInputText));
248
- function d() {
249
- j("save", {
250
- card_html: x.value,
251
- card_table: S.value
252
- });
253
- }
254
- return (s, m) => (w(), z("div", Bt, [
255
- o("div", { class: "flex items-center justify-end gap-3" }, [
256
- o("button", {
257
- type: "button",
258
- class: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium bg-gradient-to-r from-sky-400 to-blue-400 hover:from-sky-500 hover:to-blue-500 text-white shadow-sm px-4 py-2 h-9 text-xs transition-all duration-300",
259
- onClick: d
260
- }, [...m[2] || (m[2] = [
261
- o("svg", {
262
- xmlns: "http://www.w3.org/2000/svg",
263
- width: "24",
264
- height: "24",
265
- viewBox: "0 0 24 24",
266
- fill: "none",
267
- stroke: "currentColor",
268
- "stroke-width": "2",
269
- "stroke-linecap": "round",
270
- "stroke-linejoin": "round",
271
- class: "h-3.5 w-3.5"
272
- }, [
273
- o("path", { d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a 2 2 0 0 1-2-2V5a 2 2 0 0 1 2-2z" }),
274
- o("path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a 1 1 0 0 0-1 1v7" }),
275
- o("path", { d: "M7 3v4a1 1 0 0 0 1 1h7" })
276
- ], -1),
277
- Le(" Зберегти картку ", -1)
278
- ])])
279
- ]),
280
- o("div", null, [
281
- E(le(c), {
282
- modelValue: S.value,
283
- "onUpdate:modelValue": m[0] || (m[0] = (r) => S.value = r)
284
- }, null, 8, ["modelValue"])
285
- ]),
286
- o("div", qt, [
287
- E(Ee, {
288
- modelValue: x.value,
289
- "onUpdate:modelValue": m[1] || (m[1] = (r) => x.value = r),
290
- language: "html",
291
- theme: "vs-light",
292
- class: "h-full w-full rounded-md"
293
- }, null, 8, ["modelValue"])
294
- ])
295
- ]));
296
- }
297
- }), Dt = /* @__PURE__ */ W({
298
- __name: "CartocssLayerLoader",
299
- props: {
300
- layerId: { type: String, required: !0 },
301
- tileUrl: { type: String, default: "" },
302
- title: { type: String, default: "" },
303
- active: { type: Boolean, default: !1 },
304
- owner: { type: String, default: "" },
305
- opacity: { type: Number, default: 1 }
306
- },
307
- setup(A) {
308
- const u = A, i = ze(), {
309
- activateTemporaryLayer: j,
310
- deactivateTemporaryLayer: S,
311
- setTemporaryLayerOpacity: x
312
- } = lt(i.map), c = M(() => {
313
- var $;
314
- const r = `${($ = u == null ? void 0 : u.tileUrl) == null ? void 0 : $.trim()}`;
315
- return r ? typeof window > "u" || typeof location > "u" || /^https?:\/\//i.test(r) ? r : r.startsWith("//") ? `${window.location.protocol}${r}` : r.startsWith("/") ? `${location.origin}${r}` : `${location.origin}/${r}` : "";
316
- });
317
- let d = "", s = "";
318
- function m() {
319
- const r = u.active && !!c.value;
320
- d && (!r || d !== u.layerId) && (S(d, s || void 0), d = "", s = ""), r && (j(
321
- {
322
- id: u.layerId,
323
- title: u.title || u.layerId,
324
- url: c.value,
325
- opacity: u.opacity
326
- },
327
- {},
328
- u.owner
329
- ), d = u.layerId, s = u.owner || "");
330
- }
331
- return T(
332
- () => [u.layerId, c.value, u.active, u.owner],
333
- m,
334
- { immediate: !0 }
335
- ), T(
336
- () => u.opacity,
337
- (r) => {
338
- !d || !u.active || x(d, r, s || void 0);
339
- },
340
- { immediate: !0 }
341
- ), We(() => {
342
- d && (S(d, s || void 0), d = "", s = "");
343
- }), (r, $) => B("", !0);
344
- }
345
- }), Ut = /* @__PURE__ */ W({
346
- __name: "CartocssMapClickListener",
347
- props: {
348
- cartocssId: {},
349
- infoEnabled: { type: [Boolean, null] }
350
- },
351
- setup(A) {
352
- const u = A, i = M(() => u.cartocssId ?? null), j = M(() => !!u.infoEnabled), { map: S, ready: x } = ze(), c = (p) => {
353
- !p || typeof window > "u" || window.dispatchEvent(
354
- new CustomEvent(ut, { detail: p })
355
- );
356
- }, d = async (p) => {
357
- const _ = await fetch(`/api/map-format?${p.toString()}`);
358
- if (!_.ok)
359
- throw new Error(`API returned ${_.status}`);
360
- return _.json();
361
- };
362
- let s = null, m = null;
363
- const r = (p) => {
364
- if (!p) return null;
365
- if (typeof p == "string")
366
- try {
367
- return JSON.parse(p);
368
- } catch {
369
- return null;
370
- }
371
- return p;
372
- }, $ = async (p, _) => {
373
- var k;
374
- const v = i.value ? `external:${i.value},${String(p)}` : null, f = new URLSearchParams({
375
- layer: i.value ?? "",
376
- id: String(p)
377
- });
378
- try {
379
- const V = await d(f), F = typeof V.html == "string" ? V.html : null, R = r(
380
- ((k = V == null ? void 0 : V.data) == null ? void 0 : k.geom) ?? (V == null ? void 0 : V.geom) ?? null
381
- );
382
- (F || R) && c({
383
- html: F,
384
- geometry: R ?? _,
385
- infoToken: v
386
- });
387
- } catch (V) {
388
- console.warn("CartoCSS map-format (id) error", V);
389
- }
390
- }, N = async (p) => {
391
- var k, V, F, R;
392
- if (!i.value) return;
393
- if (!j.value) {
394
- D({
395
- type: "error",
396
- title: "CartoCSS",
397
- message: "Картка не налаштована"
398
- });
399
- return;
400
- }
401
- const _ = (k = p == null ? void 0 : p.lngLat) == null ? void 0 : k.lng, v = (V = p == null ? void 0 : p.lngLat) == null ? void 0 : V.lat;
402
- if (typeof _ != "number" || typeof v != "number") return;
403
- const f = new URLSearchParams({
404
- layer: i.value,
405
- lat: v.toFixed(6),
406
- lng: _.toFixed(6)
407
- });
408
- try {
409
- const y = await d(f), Q = r(
410
- ((F = y == null ? void 0 : y.data) == null ? void 0 : F.geom) ?? (y == null ? void 0 : y.geom) ?? null
411
- ), H = ((R = y == null ? void 0 : y.data) == null ? void 0 : R.id) ?? (y == null ? void 0 : y.id);
412
- if (H != null) {
413
- await $(H, Q);
414
- return;
415
- }
416
- rt({ html: y == null ? void 0 : y.html }) && c({
417
- html: y == null ? void 0 : y.html,
418
- geometry: Q,
419
- infoToken: null
420
- });
421
- } catch (y) {
422
- console.warn("CartoCSS map-format error", y);
423
- }
424
- };
425
- return x().then(() => {
426
- m = S.value, m && (m.on("click", N), s = () => m == null ? void 0 : m.off("click", N));
427
- }), Me(() => {
428
- s == null || s(), s = null, m = null;
429
- }), () => {
430
- };
431
- }
432
- }), It = { class: "flex h-full bg-gradient-to-br from-slate-50 to-white" }, Ot = { class: "flex-1 relative overflow-hidden" }, Pt = { class: "absolute top-0 left-0 w-full z-20" }, Ft = { class: "px-4 sm:px-6 py-4 border-b border-gray-200 bg-white shadow-sm" }, Rt = { class: "flex items-start justify-between gap-4" }, Qt = { class: "flex-1 min-w-0" }, Ht = { class: "flex items-center text-sm text-gray-500 mb-3" }, Jt = { class: "text-gray-900 font-medium truncate max-w-xs" }, Yt = { class: "flex items-center justify-between gap-4" }, Gt = { class: "flex-1 min-w-0" }, Wt = { class: "flex items-center gap-3 mb-1" }, Xt = { class: "text-base font-semibold text-gray-900 truncate" }, Zt = {
433
- key: 0,
434
- class: "px-2 py-0.5 bg-green-50 border border-green-200 rounded flex-shrink-0"
435
- }, Kt = { class: "text-xs font-medium text-green-700" }, ea = ["title"], ta = { class: "w-full h-full bg-gradient-to-br from-sky-50 via-white to-blue-50 flex items-center justify-center relative pt-[115px]" }, aa = { class: "relative w-full h-full" }, oa = { class: "absolute top-[5.5rem] left-4 z-30 flex flex-col items-start gap-2" }, na = { class: "rounded-2xl bg-white/90 px-3 py-2 text-xs font-medium text-slate-600 shadow-sm backdrop-blur" }, sa = { class: "flex items-center gap-2" }, la = { class: "rounded-2xl bg-white/90 px-3 py-2 text-xs font-medium text-slate-600 shadow-sm backdrop-blur" }, ra = { class: "inline-flex items-center gap-2 text-[11px] text-slate-600" }, ua = ["checked"], ia = { class: "absolute top-4 left-4 z-20" }, ca = { class: "absolute top-[6.5rem] right-2 space-y-1 z-20" }, da = {
436
- key: 0,
437
- class: "absolute bottom-4 left-1/2 z-30 -translate-x-1/2 rounded-2xl border border-sky-200 bg-white/95 px-4 py-2 text-xs font-medium text-slate-700 shadow-lg backdrop-blur"
438
- }, fa = { class: "flex-1 flex flex-col h-full" }, ma = {
439
- key: 0,
440
- class: "px-3 pt-3 pb-2 border-b border-gray-100"
441
- }, pa = ["aria-selected", "onClick"], ya = { class: "leading-none" }, va = { class: "flex flex-col flex-1 overflow-y-hidden p-3" }, ga = {
442
- key: 0,
443
- class: "flex-1 flex items-center justify-center text-sm text-gray-500"
444
- }, ha = "cartocss-demo-001", ba = "OpenGIS", Ve = 2, se = 5, xa = 5, Ea = /* @__PURE__ */ W({
445
- __name: "cartocss",
446
- setup(A) {
447
- const u = ot(), i = nt(), j = b(null), S = [
448
- { key: "css", label: "CSS", icon: ft },
449
- { key: "data", label: "Дані", icon: _t },
450
- { key: "metadata", label: "Метадані", icon: gt },
451
- { key: "card", label: "Картка", icon: mt }
452
- ], x = S.map((e) => e.key), c = b(
453
- x.includes(i.query.tab) ? i.query.tab : "css"
454
- ), d = b(!0), s = b(null), m = M(
455
- () => {
456
- var e;
457
- return (e = s.value) != null && e.source_path ? S.filter((a) => a.key === "card" || a.key === "metadata") : S;
458
- }
459
- ), r = M(
460
- () => i.params.id || ha
461
- ), $ = b({
462
- id: r.value,
463
- name: "",
464
- description: ""
465
- });
466
- let N = null;
467
- const p = b(!1);
468
- function _(e) {
469
- if (Array.isArray(e)) return _(e[0]);
470
- if (typeof e != "string" && typeof e != "number") return null;
471
- const a = typeof e == "number" ? e : Number(e.trim());
472
- return Number.isFinite(a) ? a : null;
473
- }
474
- function v(e, a) {
475
- return e.toFixed(a);
476
- }
477
- function f(e, a, t) {
478
- const n = 0.5 * 10 ** -t;
479
- return Math.abs(e - a) > n;
480
- }
481
- function k() {
482
- var e;
483
- return (e = j.value) == null ? void 0 : e.ctx;
484
- }
485
- function V() {
486
- var g, C, O, q;
487
- const e = (C = (g = k()) == null ? void 0 : g.map) == null ? void 0 : C.value;
488
- if (!e) return;
489
- const a = _(i.query.z), t = _(i.query.x), n = _(i.query.y);
490
- if (a == null || t == null || n == null) return;
491
- const l = (O = e.getCenter) == null ? void 0 : O.call(e), h = (q = e.getZoom) == null ? void 0 : q.call(e);
492
- (!l || f(l.lng, t, se) || f(l.lat, n, se) || f(h ?? 0, a, Ve)) && (p.value = !0, e.jumpTo({ center: [t, n], zoom: a }), p.value = !1);
493
- }
494
- function F() {
495
- var l, h, L, g;
496
- if (p.value) return;
497
- const e = (h = (l = k()) == null ? void 0 : l.map) == null ? void 0 : h.value;
498
- if (!e) return;
499
- const a = (L = e.getCenter) == null ? void 0 : L.call(e), t = (g = e.getZoom) == null ? void 0 : g.call(e);
500
- if (!a || t == null) return;
501
- const n = {
502
- ...i.query,
503
- z: v(t, Ve),
504
- x: v(a.lng, se),
505
- y: v(a.lat, se)
506
- };
507
- i.query.z === n.z && i.query.x === n.x && i.query.y === n.y || u.replace({ query: n });
508
- }
509
- function R(e) {
510
- typeof document > "u" || (document.title = e ? `${e} — CartoCSS` : ba);
511
- }
512
- const y = b(""), Q = b([]), H = b(!1), K = b(!1), re = b(""), ue = b(0), ee = b(!1), te = b(1), ie = b(!0), I = b(!1), X = b(null), je = M(() => `cartocss-layer-${r.value}`), Ae = M(
513
- () => `${Math.round(te.value * 100)}%`
514
- ), Ne = M(
515
- () => `cartocss-extent-${r.value}`
516
- ), Be = M(
517
- () => `cartocss-extent-draft-${r.value}`
518
- ), pe = M(() => {
519
- var l;
520
- const e = (l = re.value) == null ? void 0 : l.trim();
521
- if (!e) return "";
522
- const a = e.includes("?") ? "&" : "?", t = `${e}${a}nottl=1`, n = ue.value;
523
- return n ? `${e}${a}ts=${n}&nocache=1` : t;
524
- }), ye = b(""), ve = b(""), ge = M(() => {
525
- var h;
526
- const e = (h = s.value) == null ? void 0 : h.bounds;
527
- if (!Array.isArray(e) || e.length < 4) return null;
528
- const [a, t, n, l] = e;
529
- return [a, t, n, l].some(
530
- (L) => typeof L != "number" || Number.isNaN(L)
531
- ) ? null : [(a + n) / 2, (t + l) / 2];
532
- }), qe = M(() => {
533
- var h;
534
- const e = (h = s.value) == null ? void 0 : h.bounds;
535
- if (!Array.isArray(e) || e.length < 4) return null;
536
- const [a, t, n, l] = e;
537
- return [a, t, n, l].some(
538
- (L) => typeof L != "number" || Number.isNaN(L)
539
- ) ? null : [a, t, n, l];
540
- }), ce = M(() => {
541
- const e = s.value;
542
- return e ? [
543
- e.description,
544
- e.group_id ? `Група: ${e.group_id}` : null,
545
- e.source_path ? `Шлях: ${e.source_path}` : null,
546
- e.is_public === !0 ? "Публічний" : "Не публічний",
547
- e.enabled === !0 ? "Активний" : "Неактивний"
548
- ].filter(Boolean).join(", ") : "";
549
- }), he = M(() => {
550
- var a;
551
- const e = (a = s.value) == null ? void 0 : a.group_id;
552
- return e ? String(e).toUpperCase() : "";
553
- });
554
- let J = null, Z = !1, Y = null;
555
- function ae(e) {
556
- return Number(e.toFixed(xa));
557
- }
558
- function be(e, a) {
559
- const [t, n] = e, [l, h] = a;
560
- return [
561
- ae(Math.min(t, l)),
562
- ae(Math.min(n, h)),
563
- ae(Math.max(t, l)),
564
- ae(Math.max(n, h))
565
- ];
566
- }
567
- function Te(e) {
568
- const [a, t, n, l] = e;
569
- return {
570
- type: "Polygon",
571
- coordinates: [
572
- [
573
- [a, t],
574
- [n, t],
575
- [n, l],
576
- [a, l],
577
- [a, t]
578
- ]
579
- ]
580
- };
581
- }
582
- function de(e) {
583
- var n, l, h;
584
- const a = (l = (n = k()) == null ? void 0 : n.map) == null ? void 0 : l.value, t = (h = a == null ? void 0 : a.getCanvas) == null ? void 0 : h.call(a);
585
- t != null && t.style && (t.style.cursor = e);
586
- }
587
- async function De(e, a) {
588
- if (!(!r.value || !s.value)) {
589
- K.value = !0;
590
- try {
591
- const t = Te(e), n = await fetch(`/api/gis-css/${r.value}`, {
592
- method: "POST",
593
- headers: { "Content-Type": "application/json" },
594
- body: JSON.stringify({ geom: t })
595
- });
596
- if (!n.ok)
597
- throw new Error(`Failed to save cartocss bounds: ${n.status}`);
598
- D({
599
- type: "success",
600
- title: "Bounds збережено",
601
- message: "Нові межі успішно збережено."
602
- }), await oe(r.value, { bustCache: !0 });
603
- } catch (t) {
604
- console.error("Failed to save CartoCSS bounds", t), s.value && (s.value = {
605
- ...s.value,
606
- bounds: a ? [...a] : null
607
- }), D({
608
- type: "error",
609
- title: "Помилка",
610
- message: "Не вдалося зберегти Bounds"
611
- });
612
- } finally {
613
- K.value = !1;
614
- }
615
- }
616
- }
617
- function xe(e) {
618
- var t, n, l;
619
- const a = (n = (t = k()) == null ? void 0 : t.map) == null ? void 0 : n.value;
620
- if ((l = a == null ? void 0 : a.dragPan) != null && l.enable && a.dragPan.enable(), (e == null ? void 0 : e.length) === 4 && s.value) {
621
- const h = Array.isArray(s.value.bounds) ? [...s.value.bounds] : null;
622
- s.value = {
623
- ...s.value,
624
- bounds: [...e]
625
- }, De(e, h);
626
- }
627
- J = null, Z = !1, X.value = null, I.value = !1, de("");
628
- }
629
- function fe() {
630
- xe(null);
631
- }
632
- function Ue() {
633
- var h, L;
634
- const e = (L = (h = k()) == null ? void 0 : h.map) == null ? void 0 : L.value;
635
- if (!e) return;
636
- const a = (g) => {
637
- var O, q, ne;
638
- if (!I.value || ((O = g == null ? void 0 : g.originalEvent) == null ? void 0 : O.button) != null && g.originalEvent.button !== 0)
639
- return;
640
- const C = g == null ? void 0 : g.lngLat;
641
- C && (J = [C.lng, C.lat], Z = !0, X.value = [C.lng, C.lat, C.lng, C.lat], (ne = (q = e.dragPan) == null ? void 0 : q.disable) == null || ne.call(q));
642
- }, t = (g) => {
643
- if (!I.value || !Z || !J)
644
- return;
645
- const C = g == null ? void 0 : g.lngLat;
646
- C && (X.value = be(J, [
647
- C.lng,
648
- C.lat
649
- ]));
650
- }, n = (g) => {
651
- if (!I.value || !Z || !J)
652
- return;
653
- const C = g == null ? void 0 : g.lngLat;
654
- if (!C) {
655
- fe();
656
- return;
657
- }
658
- const O = be(J, [
659
- C.lng,
660
- C.lat
661
- ]), [q, ne, He, Je] = O;
662
- if (!(Math.abs(He - q) > 0 && Math.abs(Je - ne) > 0)) {
663
- D({
664
- type: "warning",
665
- title: "Bounds не змінено",
666
- message: "Потрібно протягнути прямокутник з ненульовою площею."
667
- }), fe();
668
- return;
669
- }
670
- xe(O);
671
- }, l = (g) => {
672
- I.value && g.key === "Escape" && (g.preventDefault(), fe());
673
- };
674
- e.on("mousedown", a), e.on("mousemove", t), e.on("mouseup", n), window.addEventListener("keydown", l), Y = () => {
675
- e.off("mousedown", a), e.off("mousemove", t), e.off("mouseup", n), window.removeEventListener("keydown", l);
676
- };
677
- }
678
- async function Ie() {
679
- var t;
680
- const e = k();
681
- !(e != null && e.ready) || (await e.ready(), !((t = e.map) == null ? void 0 : t.value)) || (Y || Ue(), I.value = !0, Z = !1, J = null, X.value = null, de("crosshair"), D({
682
- type: "info",
683
- title: "Редагування Bounds",
684
- message: "Протягніть прямокутник на карті, щоб задати нові межі."
685
- }));
686
- }
687
- T(
688
- r,
689
- (e) => {
690
- e && oe(e);
691
- },
692
- { immediate: !0 }
693
- ), T(
694
- () => {
695
- var e;
696
- return (e = $.value) == null ? void 0 : e.name;
697
- },
698
- (e) => R(e),
699
- { immediate: !0 }
700
- );
701
- async function Oe() {
702
- var n;
703
- const e = k();
704
- if (!(e != null && e.ready)) return;
705
- await e.ready(), V();
706
- const a = (n = e.map) == null ? void 0 : n.value;
707
- if (!a) return;
708
- const t = () => F();
709
- a.on("moveend", t), a.on("zoomend", t), N = () => {
710
- a.off("moveend", t), a.off("zoomend", t);
711
- };
712
- }
713
- T(
714
- () => [i.query.z, i.query.x, i.query.y],
715
- () => {
716
- V();
717
- }
718
- ), Xe(() => {
719
- Oe();
720
- }), Me(() => {
721
- N == null || N(), N = null, Y == null || Y(), Y = null, de("");
722
- }), T(
723
- () => i.query.tab,
724
- (e) => {
725
- e && m.value.some((a) => a.key === e) && c.value !== e && (c.value = e);
726
- }
727
- ), T(
728
- m,
729
- (e) => {
730
- e.length && !e.some((a) => a.key === c.value) && (c.value = e[0].key);
731
- },
732
- { immediate: !0 }
733
- ), T(c, (e) => {
734
- i.query.tab !== e && m.value.some((a) => a.key === e) && u.replace({ query: { ...i.query, tab: e } });
735
- }), T(
736
- () => s.value,
737
- (e) => {
738
- const a = e == null ? void 0 : e.card_html;
739
- ye.value = a, ve.value = e == null ? void 0 : e.card_table;
740
- },
741
- { immediate: !0 }
742
- );
743
- function we() {
744
- r.value && oe(r.value, { bustCache: !0 });
745
- }
746
- async function Pe(e, a) {
747
- if (r.value) {
748
- K.value = !0;
749
- try {
750
- const t = await fetch(`/api/gis-css/${r.value}`, {
751
- method: "POST",
752
- headers: { "Content-Type": "application/json" },
753
- body: JSON.stringify(e)
754
- });
755
- if (!t.ok) throw new Error(`Failed to save cartocss: ${t.status}`);
756
- D({ type: "success", title: "Збережено", message: a }), await oe(r.value, { bustCache: !0 });
757
- } catch (t) {
758
- console.error("Failed to save CartoCSS", t), D({
759
- type: "error",
760
- title: "Помилка",
761
- message: "Не вдалося зберегти CartoCSS"
762
- });
763
- } finally {
764
- K.value = !1;
765
- }
766
- }
767
- }
768
- function Fe(e) {
769
- if (!e) return null;
770
- if (typeof e == "string")
771
- try {
772
- return JSON.parse(e);
773
- } catch (a) {
774
- return console.warn("Failed to parse CartoCSS config", a), null;
775
- }
776
- return typeof e == "object" ? e : null;
777
- }
778
- function Re(e) {
779
- const a = Array.isArray(e) ? e : e == null ? void 0 : e.datasets;
780
- return Array.isArray(a) ? a.map((t, n) => ({
781
- table: (t == null ? void 0 : t.table) || (t == null ? void 0 : t.id) || `dataset_${n + 1}`,
782
- query: (t == null ? void 0 : t.query) || "",
783
- srid: (t == null ? void 0 : t.srid) || "",
784
- gcol: (t == null ? void 0 : t.gcol) || "",
785
- key: (t == null ? void 0 : t.key) || (t == null ? void 0 : t.label) || "Без підпису",
786
- active: typeof (t == null ? void 0 : t.active) == "boolean" ? t.active : !0,
787
- minzoom: typeof (t == null ? void 0 : t.zoom) > "u" ? "" : String(t.zoom),
788
- maxzoom: typeof (t == null ? void 0 : t.maxzoom) > "u" ? "" : String(t.maxzoom),
789
- columns: (t == null ? void 0 : t.columns) || "",
790
- proj4text: (t == null ? void 0 : t.proj4text) || ""
791
- })) : [];
792
- }
793
- async function oe(e, a) {
794
- H.value = !0;
795
- try {
796
- const t = await fetch(`/api/gis-css/${e}`);
797
- if (!t.ok) throw new Error(`Failed to load cartocss: ${t.status}`);
798
- const n = await t.json(), l = (n == null ? void 0 : n.message) || n || {};
799
- s.value = l, $.value = {
800
- id: l.cartocss_key || e,
801
- name: l.name || $.value.name,
802
- description: l.description || $.value.description
803
- }, y.value = typeof l.style == "string" ? l.style : "";
804
- const h = Fe(l.config ?? []);
805
- Q.value = Re(h);
806
- const L = typeof l.url == "string" ? l.url : "";
807
- re.value = L, ee.value = !!(L && l.enabled !== !1), ue.value = a != null && a.bustCache ? Date.now() : 0;
808
- } catch (t) {
809
- console.error("Failed to fetch CartoCSS", t), ee.value = !1, re.value = "", ue.value = 0, s.value = null;
810
- } finally {
811
- H.value = !1;
812
- }
813
- }
814
- async function _e() {
815
- await Pe(
816
- {
817
- style: y.value || "",
818
- config: Q.value
819
- },
820
- "CartoCSS оновлено"
821
- );
822
- }
823
- async function Qe(e) {
824
- const a = await fetch(`/api/gis-css/${r.value}`, {
825
- method: "POST",
826
- headers: { "Content-Type": "application/json" },
827
- body: JSON.stringify(e)
828
- });
829
- if (!a.ok) throw new Error(`Failed to save cartocss: ${a.status}`);
830
- D({
831
- type: "success",
832
- title: "Збережено",
833
- message: "Картка CartoCSS оновлена"
834
- });
835
- }
836
- return (e, a) => (w(), z("div", It, [
837
- o("div", Ot, [
838
- o("div", Pt, [
839
- o("div", Ft, [
840
- o("div", Rt, [
841
- o("div", Qt, [
842
- o("div", Ht, [
843
- o("button", {
844
- type: "button",
845
- class: "hover:text-gray-700 cursor-pointer transition-colors",
846
- onClick: a[0] || (a[0] = (t) => le(u).push("/gis.cartocss"))
847
- }, " CartoCSS "),
848
- a[6] || (a[6] = o("svg", {
849
- xmlns: "http://www.w3.org/2000/svg",
850
- width: "24",
851
- height: "24",
852
- viewBox: "0 0 24 24",
853
- fill: "none",
854
- stroke: "currentColor",
855
- "stroke-width": "2",
856
- "stroke-linecap": "round",
857
- "stroke-linejoin": "round",
858
- class: "lucide lucide-chevron-right w-4 h-4 mx-1"
859
- }, [
860
- o("path", { d: "m9 18 6-6-6-6" })
861
- ], -1)),
862
- o("span", Jt, U($.value.name || "CartoCSS"), 1)
863
- ]),
864
- o("div", Yt, [
865
- o("div", Gt, [
866
- o("div", Wt, [
867
- o("h1", Xt, U($.value.name || "CartoCSS"), 1),
868
- he.value ? (w(), z("div", Zt, [
869
- o("span", Kt, U(he.value), 1)
870
- ])) : B("", !0)
871
- ]),
872
- ce.value ? (w(), z("p", {
873
- key: 0,
874
- class: "text-xs text-gray-500 truncate",
875
- title: ce.value
876
- }, U(ce.value), 9, ea)) : B("", !0)
877
- ])
878
- ])
879
- ]),
880
- E(pt, {
881
- class: "flex-shrink-0",
882
- "entity-id": r.value,
883
- "entity-info": $.value,
884
- "form-endpoint": (t) => `/api/form/gis.cartocss.table/${t}`,
885
- "save-endpoint": (t) => `/api/gis-css/${t}`,
886
- "entity-label": "CartoCSS",
887
- "save-method": "post",
888
- onSaved: we
889
- }, null, 8, ["entity-id", "entity-info", "form-endpoint", "save-endpoint"])
890
- ])
891
- ])
892
- ]),
893
- o("div", ta, [
894
- o("div", aa, [
895
- E(it, {
896
- ref_key: "mapViewRef",
897
- ref: j
898
- }, {
899
- default: G(() => {
900
- var t, n;
901
- return [
902
- o("div", oa, [
903
- o("div", na, [
904
- o("div", sa, [
905
- a[7] || (a[7] = o("span", null, "Прозорість:", -1)),
906
- Ze(o("input", {
907
- "onUpdate:modelValue": a[1] || (a[1] = (l) => te.value = l),
908
- type: "range",
909
- min: "0",
910
- max: "1",
911
- step: "0.01",
912
- class: "h-1 w-28 cursor-pointer appearance-none rounded-full bg-slate-300 focus:outline-none",
913
- style: { "accent-color": "#3b82f6" }
914
- }, null, 512), [
915
- [
916
- Ke,
917
- te.value,
918
- void 0,
919
- { number: !0 }
920
- ]
921
- ]),
922
- o("span", null, U(Ae.value), 1)
923
- ])
924
- ]),
925
- o("div", la, [
926
- o("label", ra, [
927
- o("input", {
928
- type: "checkbox",
929
- class: "h-3.5 w-3.5 rounded border-slate-300 text-blue-600 focus:ring-blue-200",
930
- checked: ie.value,
931
- onChange: a[2] || (a[2] = (l) => ie.value = l.target.checked)
932
- }, null, 40, ua),
933
- a[8] || (a[8] = o("span", null, "Межі css", -1))
934
- ])
935
- ])
936
- ]),
937
- o("div", ia, [
938
- E(ct)
939
- ]),
940
- o("div", ca, [
941
- E(Se),
942
- ge.value ? (w(), P(Se, {
943
- key: 0,
944
- targetCenter: ge.value,
945
- targetLabel: "Центр даних",
946
- targetAriaLabel: "Перейти до центру даних"
947
- }, null, 8, ["targetCenter"])) : B("", !0)
948
- ]),
949
- I.value ? (w(), z("div", da, " Потягніть на карті, щоб намалювати нові Bounds. Esc скасовує редагування. ")) : B("", !0),
950
- pe.value ? (w(), P(Dt, {
951
- key: 1,
952
- "layer-id": je.value,
953
- "tile-url": pe.value,
954
- active: ee.value,
955
- opacity: te.value,
956
- title: $.value.name,
957
- owner: r.value
958
- }, null, 8, ["layer-id", "tile-url", "active", "opacity", "title", "owner"])) : B("", !0),
959
- E($e, {
960
- extent: ie.value ? qe.value : null,
961
- "layer-id": Ne.value
962
- }, null, 8, ["extent", "layer-id"]),
963
- E($e, {
964
- extent: X.value,
965
- "layer-id": Be.value,
966
- "line-color": "#0ea5e9",
967
- "line-width": 3
968
- }, null, 8, ["extent", "layer-id"]),
969
- E(Ut, {
970
- "cartocss-id": r.value,
971
- bounds: ((t = s.value) == null ? void 0 : t.bounds) ?? null,
972
- active: ee.value && !I.value,
973
- "info-enabled": (n = s.value) == null ? void 0 : n.info
974
- }, null, 8, ["cartocss-id", "bounds", "active", "info-enabled"]),
975
- E(dt, { "map-id": r.value }, null, 8, ["map-id"])
976
- ];
977
- }),
978
- _: 1
979
- }, 512)
980
- ])
981
- ]),
982
- s.value ? (w(), P(yt, {
983
- key: 0,
984
- open: d.value,
985
- onToggle: a[3] || (a[3] = (t) => d.value = !d.value)
986
- }, null, 8, ["open"])) : B("", !0)
987
- ]),
988
- s.value ? (w(), z("div", {
989
- key: 0,
990
- class: ke(["bg-white border-l border-gray-100 flex flex-col overflow-hidden shadow-lg flex-shrink-0 transition-[width] duration-100 ease-in-out", d.value ? "w-[650px]" : "w-0"])
991
- }, [
992
- o("div", fa, [
993
- m.value.length > 1 ? (w(), z("div", ma, [
994
- o("div", {
995
- class: "items-center justify-center text-muted-foreground grid w-full h-12 p-1 bg-gray-50 rounded-xl shadow-sm",
996
- style: et({
997
- gridTemplateColumns: `repeat(${m.value.length}, minmax(0, 1fr))`
998
- })
999
- }, [
1000
- (w(!0), z(Ce, null, tt(m.value, (t) => (w(), z("button", {
1001
- key: t.key,
1002
- type: "button",
1003
- role: "tab",
1004
- "aria-selected": c.value === t.key,
1005
- class: ke([
1006
- "whitespace-nowrap flex flex-col items-center justify-center gap-0.5 py-1 px-1 text-[9px] font-medium transition-all duration-300 hover:bg-white/70 rounded-lg group",
1007
- c.value === t.key ? "bg-white shadow-sm text-gray-700" : ""
1008
- ]),
1009
- onClick: (n) => c.value = t.key
1010
- }, [
1011
- (w(), P(at(t.icon), { class: "h-3.5 w-3.5 mb-0.5" })),
1012
- o("span", ya, U(t.label), 1)
1013
- ], 10, pa))), 128))
1014
- ], 4)
1015
- ])) : B("", !0),
1016
- o("div", va, [
1017
- H.value ? (w(), z("div", ga, " Завантаження стилю… ")) : (w(), z(Ce, { key: 1 }, [
1018
- c.value === "css" ? (w(), P(St, {
1019
- key: 0,
1020
- modelValue: y.value,
1021
- "onUpdate:modelValue": a[4] || (a[4] = (t) => y.value = t),
1022
- class: "flex-1 min-h-0",
1023
- onSave: _e
1024
- }, null, 8, ["modelValue"])) : c.value === "data" ? (w(), P(Nt, {
1025
- key: 1,
1026
- modelValue: Q.value,
1027
- "onUpdate:modelValue": a[5] || (a[5] = (t) => Q.value = t),
1028
- class: "flex-1 min-h-0 flex flex-col",
1029
- onSave: _e
1030
- }, null, 8, ["modelValue"])) : c.value === "card" ? (w(), P(Tt, {
1031
- key: 2,
1032
- card: ye.value,
1033
- table: ve.value,
1034
- class: "flex-1 min-h-0",
1035
- onSave: Qe
1036
- }, null, 8, ["card", "table"])) : c.value === "metadata" ? (w(), P(vt, {
1037
- key: 3,
1038
- data: s.value,
1039
- "entity-id": r.value,
1040
- "entity-type": "css",
1041
- onSaved: we,
1042
- onEditCssBounds: Ie
1043
- }, null, 8, ["data", "entity-id"])) : B("", !0)
1044
- ], 64))
1045
- ])
1046
- ])
1047
- ], 2)) : B("", !0)
1048
- ]));
1049
- }
1050
- });
1051
- export {
1052
- Ea as default
1053
- };