@movvjs/svelte-schedule-view 0.1.2 → 0.1.3

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 (133) hide show
  1. package/.prettierrc +1 -1
  2. package/.svelte-kit/__package__/schedule-view/BookingInfo.svelte +26 -154
  3. package/.svelte-kit/__package__/schedule-view/Layout.svelte +28 -7
  4. package/.svelte-kit/__package__/schedule-view/Map.svelte +113 -103
  5. package/.svelte-kit/__package__/schedule-view/Plan.svelte +113 -109
  6. package/.svelte-kit/__package__/schedule-view/PlanItem.svelte +86 -85
  7. package/.svelte-kit/__package__/schedule-view/PlanItem.svelte.d.ts +2 -5
  8. package/.svelte-kit/__package__/schedule-view/PlanWaypointAddButton.svelte +34 -0
  9. package/.svelte-kit/__package__/schedule-view/PlanWaypointAddButton.svelte.d.ts +18 -0
  10. package/.svelte-kit/__package__/schedule-view/ServiceZone.svelte +40 -35
  11. package/.svelte-kit/__package__/schedule-view/ServiceZoneItem.svelte +4 -6
  12. package/.svelte-kit/__package__/schedule-view/ServiceZoneItem.svelte.d.ts +1 -3
  13. package/.svelte-kit/__package__/schedule-view/assets/scss/indie_booking.scss +1 -1
  14. package/.svelte-kit/__package__/schedule-view/stores/booking.d.ts +83 -12
  15. package/.svelte-kit/__package__/schedule-view/stores/booking.js +219 -28
  16. package/.svelte-kit/__package__/schedule-view/types/booking.d.ts +5 -1
  17. package/.svelte-kit/__package__/schedule-view/types/booking.js +5 -0
  18. package/.svelte-kit/ambient.d.ts +64 -12
  19. package/.svelte-kit/generated/server/internal.js +1 -1
  20. package/README.md +6 -0
  21. package/dist/schedule-view/BookingInfo.svelte +26 -154
  22. package/dist/schedule-view/Layout.svelte +28 -7
  23. package/dist/schedule-view/Map.svelte +113 -103
  24. package/dist/schedule-view/Plan.svelte +113 -109
  25. package/dist/schedule-view/PlanItem.svelte +86 -85
  26. package/dist/schedule-view/PlanItem.svelte.d.ts +2 -5
  27. package/dist/schedule-view/PlanWaypointAddButton.svelte +34 -0
  28. package/dist/schedule-view/PlanWaypointAddButton.svelte.d.ts +18 -0
  29. package/dist/schedule-view/ServiceZone.svelte +40 -35
  30. package/dist/schedule-view/ServiceZoneItem.svelte +4 -6
  31. package/dist/schedule-view/ServiceZoneItem.svelte.d.ts +1 -3
  32. package/dist/schedule-view/assets/scss/indie_booking.scss +1 -1
  33. package/dist/schedule-view/stores/booking.d.ts +83 -12
  34. package/dist/schedule-view/stores/booking.js +219 -28
  35. package/dist/schedule-view/types/booking.d.ts +5 -1
  36. package/dist/schedule-view/types/booking.js +5 -0
  37. package/package.json +1 -1
  38. package/src/lib/schedule-view/BookingInfo.svelte +26 -151
  39. package/src/lib/schedule-view/Layout.svelte +14 -6
  40. package/src/lib/schedule-view/Map.svelte +124 -116
  41. package/src/lib/schedule-view/Plan.svelte +126 -115
  42. package/src/lib/schedule-view/PlanItem.svelte +87 -89
  43. package/src/lib/schedule-view/PlanWaypointAddButton.svelte +40 -0
  44. package/src/lib/schedule-view/ServiceZone.svelte +40 -35
  45. package/src/lib/schedule-view/ServiceZoneItem.svelte +4 -6
  46. package/src/lib/schedule-view/assets/scss/indie_booking.scss +1 -1
  47. package/src/lib/schedule-view/stores/booking.ts +227 -35
  48. package/src/lib/schedule-view/types/booking.ts +5 -1
  49. package/src/routes/development/+page.svelte +1 -1
  50. package/sync-assets.sh +1 -1
  51. package/.svelte-kit/__package__/schedule-view/stores/environment.d.ts +0 -0
  52. package/.svelte-kit/__package__/schedule-view/stores/environment.js +0 -18
  53. package/.svelte-kit/generated/client-optimized/app.js +0 -25
  54. package/.svelte-kit/generated/client-optimized/matchers.js +0 -1
  55. package/.svelte-kit/generated/client-optimized/nodes/0.js +0 -1
  56. package/.svelte-kit/generated/client-optimized/nodes/1.js +0 -1
  57. package/.svelte-kit/generated/client-optimized/nodes/2.js +0 -1
  58. package/.svelte-kit/generated/client-optimized/nodes/3.js +0 -1
  59. package/.svelte-kit/generated/client-optimized/nodes/4.js +0 -1
  60. package/.svelte-kit/output/client/.vite/manifest.json +0 -228
  61. package/.svelte-kit/output/client/_app/immutable/assets/0.2tW0Oq_7.css +0 -1
  62. package/.svelte-kit/output/client/_app/immutable/assets/3.BdHh-Q2R.css +0 -1
  63. package/.svelte-kit/output/client/_app/immutable/assets/Portal.O7-JvwdH.css +0 -1
  64. package/.svelte-kit/output/client/_app/immutable/assets/_layout.2tW0Oq_7.css +0 -1
  65. package/.svelte-kit/output/client/_app/immutable/assets/_page.BdHh-Q2R.css +0 -1
  66. package/.svelte-kit/output/client/_app/immutable/assets/index.O7-JvwdH.css +0 -1
  67. package/.svelte-kit/output/client/_app/immutable/chunks/en.DWbj_QRd.js +0 -1
  68. package/.svelte-kit/output/client/_app/immutable/chunks/en.DumUXR3E.js +0 -1
  69. package/.svelte-kit/output/client/_app/immutable/chunks/entry.DjKqHYSP.js +0 -3
  70. package/.svelte-kit/output/client/_app/immutable/chunks/index.BGrZCuML.js +0 -4
  71. package/.svelte-kit/output/client/_app/immutable/chunks/index.FOjzEhlA.js +0 -27
  72. package/.svelte-kit/output/client/_app/immutable/chunks/index.hA7qaEVm.js +0 -1
  73. package/.svelte-kit/output/client/_app/immutable/chunks/ko.BzOkZu06.js +0 -1
  74. package/.svelte-kit/output/client/_app/immutable/chunks/ko.CNhOZyI0.js +0 -1
  75. package/.svelte-kit/output/client/_app/immutable/chunks/preload-helper.D6kgxu3v.js +0 -1
  76. package/.svelte-kit/output/client/_app/immutable/chunks/scheduler.CcILbENq.js +0 -1
  77. package/.svelte-kit/output/client/_app/immutable/chunks/stores.CZDfo8ub.js +0 -1
  78. package/.svelte-kit/output/client/_app/immutable/chunks/vi.CRglnhH1.js +0 -1
  79. package/.svelte-kit/output/client/_app/immutable/chunks/vi.DXV3TCy-.js +0 -1
  80. package/.svelte-kit/output/client/_app/immutable/chunks/zh-cn.CQVjpanp.js +0 -1
  81. package/.svelte-kit/output/client/_app/immutable/chunks/zh-cn.HAkARoqw.js +0 -1
  82. package/.svelte-kit/output/client/_app/immutable/chunks/zh-tw.CV5JUqzK.js +0 -1
  83. package/.svelte-kit/output/client/_app/immutable/chunks/zh-tw.Dp49c2YY.js +0 -1
  84. package/.svelte-kit/output/client/_app/immutable/entry/app.uDBBDaZr.js +0 -2
  85. package/.svelte-kit/output/client/_app/immutable/entry/start.CMK9sH2f.js +0 -1
  86. package/.svelte-kit/output/client/_app/immutable/nodes/0.CzVVhlgi.js +0 -1
  87. package/.svelte-kit/output/client/_app/immutable/nodes/1.B7dfh3UY.js +0 -1
  88. package/.svelte-kit/output/client/_app/immutable/nodes/2.BCJwop-e.js +0 -1
  89. package/.svelte-kit/output/client/_app/immutable/nodes/3._ADF1RD-.js +0 -7
  90. package/.svelte-kit/output/client/_app/immutable/nodes/4.BhT6wP8T.js +0 -7
  91. package/.svelte-kit/output/client/_app/version.json +0 -1
  92. package/.svelte-kit/output/client/favicon.png +0 -0
  93. package/.svelte-kit/output/server/.vite/manifest.json +0 -197
  94. package/.svelte-kit/output/server/_app/immutable/assets/Portal.O7-JvwdH.css +0 -1
  95. package/.svelte-kit/output/server/_app/immutable/assets/_layout.2tW0Oq_7.css +0 -1
  96. package/.svelte-kit/output/server/_app/immutable/assets/_page.BdHh-Q2R.css +0 -1
  97. package/.svelte-kit/output/server/chunks/Portal.js +0 -1083
  98. package/.svelte-kit/output/server/chunks/en.js +0 -155
  99. package/.svelte-kit/output/server/chunks/en2.js +0 -155
  100. package/.svelte-kit/output/server/chunks/exports.js +0 -200
  101. package/.svelte-kit/output/server/chunks/index.js +0 -101
  102. package/.svelte-kit/output/server/chunks/internal.js +0 -220
  103. package/.svelte-kit/output/server/chunks/ko.js +0 -126
  104. package/.svelte-kit/output/server/chunks/ko2.js +0 -126
  105. package/.svelte-kit/output/server/chunks/ssr.js +0 -297
  106. package/.svelte-kit/output/server/chunks/stores.js +0 -37
  107. package/.svelte-kit/output/server/chunks/vi.js +0 -126
  108. package/.svelte-kit/output/server/chunks/vi2.js +0 -126
  109. package/.svelte-kit/output/server/chunks/zh-cn.js +0 -126
  110. package/.svelte-kit/output/server/chunks/zh-cn2.js +0 -126
  111. package/.svelte-kit/output/server/chunks/zh-tw.js +0 -126
  112. package/.svelte-kit/output/server/chunks/zh-tw2.js +0 -126
  113. package/.svelte-kit/output/server/entries/fallbacks/error.svelte.js +0 -11
  114. package/.svelte-kit/output/server/entries/pages/_layout.svelte.js +0 -16
  115. package/.svelte-kit/output/server/entries/pages/_page.svelte.js +0 -7
  116. package/.svelte-kit/output/server/entries/pages/development/_page.svelte.js +0 -2919
  117. package/.svelte-kit/output/server/entries/pages/package/_page.svelte.js +0 -2904
  118. package/.svelte-kit/output/server/index.js +0 -2958
  119. package/.svelte-kit/output/server/internal.js +0 -13
  120. package/.svelte-kit/output/server/manifest-full.js +0 -51
  121. package/.svelte-kit/output/server/manifest.js +0 -51
  122. package/.svelte-kit/output/server/nodes/0.js +0 -8
  123. package/.svelte-kit/output/server/nodes/1.js +0 -8
  124. package/.svelte-kit/output/server/nodes/2.js +0 -8
  125. package/.svelte-kit/output/server/nodes/3.js +0 -8
  126. package/.svelte-kit/output/server/nodes/4.js +0 -8
  127. package/dist/schedule-view/stores/environment.d.ts +0 -0
  128. package/dist/schedule-view/stores/environment.js +0 -18
  129. package/src/lib/schedule-view/stores/environment.ts +0 -23
  130. package/test/.npmrc +0 -7
  131. package/test/package.json +0 -9
  132. package/test/yarn-error.log +0 -44
  133. package/test/yarn.lock +0 -596
package/.prettierrc CHANGED
@@ -2,7 +2,7 @@
2
2
  "semi": false,
3
3
  "singleQuote": true,
4
4
  "tabWidth": 2,
5
- "printWidth": 170,
5
+ "printWidth": 150,
6
6
  "useTabs": true,
7
7
  "proseWrap": "preserve",
8
8
  "arrowParens": "avoid",
@@ -4,7 +4,7 @@ import { dayjs } from "../dayjs";
4
4
  import { axios } from "../axios";
5
5
  import { t } from "../i18n";
6
6
  import { env } from "../store/env";
7
- import { BookingServiceType, ExtraServiceType, FileType } from "./types";
7
+ import { BookingServiceType, FileType } from "./types";
8
8
  import { isEdit } from "./Schedule.svelte";
9
9
  import { getCarName } from "./utils";
10
10
  import { copiedBooking, originalBooking } from "./stores/booking";
@@ -19,7 +19,9 @@ const {
19
19
  withPreserveAndPreview,
20
20
  hour,
21
21
  minute,
22
- pax: editPax,
22
+ firstName,
23
+ lastName,
24
+ pax: copiedBookingPax,
23
25
  telNumber,
24
26
  telCountryCode,
25
27
  isPicketServiceAvailable,
@@ -27,151 +29,14 @@ const {
27
29
  isBabySeatServiceAvailable,
28
30
  defaultFiles,
29
31
  picketFiles,
30
- extraServices: editExtraServices,
31
32
  isAutoPicketFile,
32
- availableExtraServices,
33
- selectedPrice
33
+ selectedPrice,
34
+ isBabySeatService,
35
+ isPicketService,
36
+ addTime
34
37
  } = copiedBooking;
35
38
  let translation$;
36
39
  let flightSearch$;
37
- $:
38
- mutation = {
39
- get hour() {
40
- return $hour;
41
- },
42
- set hour(h) {
43
- withPreserveAndPreview(() => {
44
- copiedBooking.update(($booking) => {
45
- $booking.ymd = dayjs($booking.ymd).hour(h).format("YYYY-MM-DD HH:mm:ss");
46
- return $booking;
47
- });
48
- });
49
- },
50
- get minute() {
51
- return $minute;
52
- },
53
- set minute(m) {
54
- withPreserveAndPreview(() => {
55
- copiedBooking.update(($booking) => {
56
- $booking.ymd = dayjs($booking.ymd).minute(m).format("YYYY-MM-DD HH:mm:ss");
57
- return $booking;
58
- });
59
- });
60
- },
61
- get firstName() {
62
- return $copiedBooking?.firstName ?? "";
63
- },
64
- set firstName(value) {
65
- copiedBooking.update(($booking) => {
66
- $booking.firstName = value;
67
- $booking.name = `${value} ${$booking.lastName}`;
68
- return $booking;
69
- });
70
- },
71
- get lastName() {
72
- return $copiedBooking?.lastName ?? "";
73
- },
74
- set lastName(value) {
75
- copiedBooking.update(($booking) => {
76
- $booking.lastName = value;
77
- $booking.name = `${$booking.firstName} ${value}`;
78
- return $booking;
79
- });
80
- },
81
- get pax() {
82
- return $editPax;
83
- },
84
- set pax(value) {
85
- withPreserveAndPreview(() => {
86
- copiedBooking.update(($booking) => {
87
- $booking.person.adult = value;
88
- return $booking;
89
- });
90
- });
91
- },
92
- get telCountryCode() {
93
- return $telCountryCode ?? null;
94
- },
95
- set telCountryCode(value) {
96
- copiedBooking.update(($booking) => {
97
- const tels = [];
98
- if (value)
99
- tels.push(value);
100
- if ($telNumber)
101
- tels.push($telNumber);
102
- $booking.tel = tels.join(" ");
103
- return $booking;
104
- });
105
- },
106
- get telNumber() {
107
- return $telNumber ?? null;
108
- },
109
- set telNumber(value) {
110
- copiedBooking.update(($booking) => {
111
- const tels = [];
112
- if ($telCountryCode)
113
- tels.push($telCountryCode);
114
- if (value)
115
- tels.push(value);
116
- $booking.tel = tels.join(" ");
117
- return $booking;
118
- });
119
- },
120
- extraServices: {
121
- get babySeat() {
122
- const service = $editExtraServices.find((extra) => extra.type === ExtraServiceType.baby) ?? null;
123
- return !!service;
124
- },
125
- set babySeat(checked) {
126
- withPreserveAndPreview(() => {
127
- copiedBooking.update(($booking) => {
128
- let extra = $editExtraServices;
129
- const addService = $availableExtraServices.find((extra2) => extra2.type === ExtraServiceType.baby);
130
- if (checked) {
131
- extra = extra.filter((extra2) => extra2.type !== ExtraServiceType.baby);
132
- extra = [...extra, addService];
133
- } else {
134
- extra = extra.filter((extra2) => extra2.type !== ExtraServiceType.baby);
135
- }
136
- $booking.extra = extra;
137
- return $booking;
138
- });
139
- });
140
- },
141
- get picket() {
142
- const service = $editExtraServices.find((extra) => extra.type === ExtraServiceType.picket) ?? null;
143
- return !!service;
144
- },
145
- set picket(checked) {
146
- withPreserveAndPreview(() => {
147
- copiedBooking.update(($booking) => {
148
- let extra = $editExtraServices;
149
- const addService = $availableExtraServices.find((extra2) => extra2.type === ExtraServiceType.picket);
150
- if (checked) {
151
- extra = extra.filter((extra2) => extra2.type !== ExtraServiceType.picket);
152
- extra = [...extra, addService];
153
- } else {
154
- extra = extra.filter((extra2) => extra2.type !== ExtraServiceType.picket);
155
- $booking.files = $booking.files.filter((f) => f.type !== FileType.picket);
156
- }
157
- $booking.extra = extra;
158
- return $booking;
159
- });
160
- });
161
- }
162
- },
163
- get addTime() {
164
- return $copiedBooking?.addTime ?? 0;
165
- },
166
- set addTime(hour2) {
167
- withPreserveAndPreview(() => {
168
- copiedBooking.update(($booking) => {
169
- $booking.addTime = hour2;
170
- return $booking;
171
- });
172
- });
173
- }
174
- };
175
40
  async function copyContents() {
176
41
  const texts = [];
177
42
  texts.push(`FMS CODE : ${$originalBooking.code}`);
@@ -280,13 +145,13 @@ function openFlightSearch() {
280
145
  <p class="value-txt">{dayjs($stdt).format('HH:mm')}</p>
281
146
  {:else}
282
147
  <div class="indie_time_select_box sm">
283
- <select bind:value={mutation.hour}>
148
+ <select bind:value={$hour}>
284
149
  {#each range(0, 24, 1) as hour}
285
150
  <option value={hour}>{padStart(`${hour}`, 2, '0')}</option>
286
151
  {/each}
287
152
  </select>
288
153
  <span>:</span>
289
- <select bind:value={mutation.minute}>
154
+ <select bind:value={$minute}>
290
155
  {#each range(0, 60, 1) as minute}
291
156
  <option value={minute}>{padStart(`${minute}`, 2, '0')}</option>
292
157
  {/each}
@@ -354,8 +219,8 @@ function openFlightSearch() {
354
219
  <p class="value-txt">{$originalBooking.name}</p>
355
220
  {:else}
356
221
  <div class="f-row gap">
357
- <input bind:value={mutation.firstName} type="text" class="indie_text_nor flexOne" placeholder={$t('booking.firstName')} />
358
- <input bind:value={mutation.lastName} type="text" class="indie_text_nor flexOne" placeholder={$t('booking.lastName')} />
222
+ <input bind:value={$firstName} type="text" class="indie_text_nor flexOne" placeholder={$t('booking.firstName')} />
223
+ <input bind:value={$lastName} type="text" class="indie_text_nor flexOne" placeholder={$t('booking.lastName')} />
359
224
  </div>
360
225
  {/if}
361
226
  </td>
@@ -378,7 +243,7 @@ function openFlightSearch() {
378
243
  {#if !$isEdit}
379
244
  <p class="value-txt">{$originalBooking.tel || '- -'}</p>
380
245
  {:else}
381
- <PhoneNumberInput bind:telCountryCode={mutation.telCountryCode} bind:telNumber={mutation.telNumber} />
246
+ <PhoneNumberInput bind:telCountryCode={$telCountryCode} bind:telNumber={$telNumber} />
382
247
  {/if}
383
248
  </td>
384
249
  </tr>
@@ -389,7 +254,7 @@ function openFlightSearch() {
389
254
  {#if !$isEdit}
390
255
  <p class="value-txt">{$pax}</p>
391
256
  {:else}
392
- <select bind:value={mutation.pax} class="indie_select_nor xs3">
257
+ <select bind:value={$copiedBookingPax} class="indie_select_nor xs3">
393
258
  {#each range(1, 30, 1) as number}
394
259
  <option value={number}>{number}</option>
395
260
  {/each}
@@ -411,14 +276,14 @@ function openFlightSearch() {
411
276
  <div class="indie_f-row mgt5">
412
277
  {#if $isBabySeatServiceAvailable}
413
278
  <span>
414
- <input bind:checked={mutation.extraServices.babySeat} type="checkbox" class="indie_check_base fz xs color" id="check_extra_baby" />
279
+ <input bind:checked={$isBabySeatService} type="checkbox" class="indie_check_base fz xs color" id="check_extra_baby" />
415
280
  <label for="check_extra_baby">{$t('extraServiceType.BABY')}</label>
416
281
  </span>
417
282
  {/if}
418
283
 
419
284
  {#if $isPicketServiceAvailable}
420
285
  <span>
421
- <input bind:checked={mutation.extraServices.picket} type="checkbox" class="indie_check_base fz xs color" id="check_extra_picket" />
286
+ <input bind:checked={$isPicketService} type="checkbox" class="indie_check_base fz xs color" id="check_extra_picket" />
422
287
  <label for="check_extra_picket">{$t('extraServiceType.PICKET')}</label>
423
288
  </span>
424
289
  {/if}
@@ -426,7 +291,13 @@ function openFlightSearch() {
426
291
  <!-- ! AUTO 기능은 FMS만 가능 (임시) -->
427
292
  {#if $isPicketServiceSelected && $env.target === 'FMS'}
428
293
  <p class="switchs mg-l-auto">
429
- <input checked={$isAutoPicketFile} type="checkbox" name="confirm" class="indie_switch_type_5" id="picket_auto" on:input={toggleAutoPicket} />
294
+ <input
295
+ checked={$isAutoPicketFile}
296
+ type="checkbox"
297
+ name="confirm"
298
+ class="indie_switch_type_5"
299
+ id="picket_auto"
300
+ on:input={toggleAutoPicket} />
430
301
  <label for="picket_auto">{$t('booking.autoPicket')}</label>
431
302
  </p>
432
303
  {/if}
@@ -485,7 +356,8 @@ function openFlightSearch() {
485
356
  {$originalBooking.memo || '- -'}
486
357
  </p>
487
358
  {#if $originalBooking.memo}
488
- <button type="button" class="indie_btn_translation_nor" on:click={() => translation$.open($originalBooking.memo)}>{$t('booking.translate')}</button>
359
+ <button type="button" class="indie_btn_translation_nor" on:click={() => translation$.open($originalBooking.memo)}
360
+ >{$t('booking.translate')}</button>
489
361
  {/if}
490
362
  {:else}
491
363
  <textarea bind:value={$copiedBooking.memo} class="modify-textarea" />
@@ -511,7 +383,7 @@ function openFlightSearch() {
511
383
  <option value={h}>{$t('booking.hours', { values: { hour: h } })}</option>
512
384
  {/each}
513
385
  </select>
514
- <select bind:value={mutation.addTime} class="indie_select_nor xs3 col">
386
+ <select bind:value={$addTime} class="indie_select_nor xs3 col">
515
387
  <option value={0}>{$t('booking.extraHours')}</option>
516
388
  {#each range(1, 15, 1) as h}
517
389
  <option value={h}>{$t('booking.hours', { values: { hour: h } })}</option>
@@ -15,13 +15,34 @@ env.subscribe(($env) => {
15
15
  dayjs.locale($env.locale);
16
16
  });
17
17
  onMount(() => {
18
- if (window.google && window.google.maps)
19
- return;
20
- const script = document.createElement("script");
21
- script.src = "https://maps.googleapis.com/maps/api/js?key=AIzaSyAYfGXhjCqlD5FlfmdtzkMSD7XONh0HS6s&region=kr&libraries=geometry";
22
- script.async = true;
23
- script.defer = true;
24
- document.head.appendChild(script);
18
+ googleMaps();
19
+ function googleMaps() {
20
+ ;
21
+ ((g) => {
22
+ var h, a, k, p = "The Google Maps JavaScript API", c = "google", l = "importLibrary", q = "__ib__", m = document, b = window;
23
+ b = b[c] || (b[c] = {});
24
+ var d = b.maps || (b.maps = {}), r = /* @__PURE__ */ new Set(), e = new URLSearchParams(), u = () => h || (h = new Promise(async (f, n) => {
25
+ await (a = m.createElement("script"));
26
+ e.set("libraries", [...r] + "");
27
+ for (k in g)
28
+ e.set(k.replace(/[A-Z]/g, (t) => "_" + t[0].toLowerCase()), g[k]);
29
+ e.set("callback", c + ".maps." + q);
30
+ a.src = `https://maps.${c}apis.com/maps/api/js?` + e;
31
+ d[q] = f;
32
+ a.onerror = () => h = n(Error(p + " could not load."));
33
+ a.nonce = m.querySelector("script[nonce]")?.nonce || "";
34
+ m.head.append(a);
35
+ }));
36
+ d[l] ? console.warn(p + " only loads once. Ignoring:", g) : d[l] = (f, ...n) => r.add(f) && u().then(() => d[l](f, ...n));
37
+ })({
38
+ key: "AIzaSyAYfGXhjCqlD5FlfmdtzkMSD7XONh0HS6s",
39
+ v: "weekly",
40
+ region: "kr",
41
+ language: navigator?.language || "en"
42
+ // Use the 'v' parameter to indicate the version to use (weekly, beta, alpha, etc.).
43
+ // Add other bootstrap parameters as needed, using camel case.
44
+ });
45
+ }
25
46
  });
26
47
  </script>
27
48
 
@@ -1,72 +1,124 @@
1
- <script>import { isEqual } from "lodash-es";
2
- import { onMount, tick } from "svelte";
3
- import startIcon from "./assets/icon/start.png";
4
- import destIcon from "./assets/icon/dest.png";
5
- import placeIcon from "./assets/icon/place.png";
6
- import { randomize } from "./utils";
1
+ <script>import { onMount } from "svelte";
7
2
  import { copiedBooking, originalBooking } from "./stores/booking";
8
3
  import { isEdit } from "./Schedule.svelte";
9
- let container$;
10
- let map;
4
+ import { isEqual } from "lodash-es";
5
+ onMount(() => init());
11
6
  const { coordinates: originalCoordinates } = originalBooking;
12
7
  const { coordinates: editCoordinates } = copiedBooking;
8
+ let container$;
9
+ let map;
13
10
  $:
14
- coordinates = !$isEdit ? $originalCoordinates : $editCoordinates;
15
- $:
16
- id = `${randomize(10)}_map`;
17
- $:
18
- markers = (() => {
19
- if (!map)
20
- return;
21
- if (markers) {
22
- const currentCoordinate = markers?.map((o) => ({ lat: o.getPosition().lat(), lng: o.getPosition().lng() }));
23
- const newCoordinate = coordinates.map((o) => ({ lat: o.lat, lng: o.lng }));
24
- if (isEqual(currentCoordinate, newCoordinate)) {
25
- return markers;
26
- }
27
- }
28
- markers?.forEach((o) => o.setMap(null));
29
- const data = coordinates.map((loc, i) => {
30
- const label = i === 0 ? "origin" : i === coordinates.length - 1 ? "dest" : "place";
31
- return markerInit(map, loc, label, label === "place" ? `${i}` : "");
32
- });
33
- const bounds = new google.maps.LatLngBounds();
34
- data.forEach((o) => bounds.extend(o.getPosition()));
35
- tick().then(() => map.fitBounds(bounds, { bottom: 50, left: 50, right: 50, top: 50 }));
36
- return data;
37
- })();
38
- $:
39
- routePolyLine = (() => {
40
- routePolyLine?.setMap(null);
41
- const lineSymbol = {
42
- path: "M -1,1 1,1",
43
- strokeOpacity: 1,
44
- scale: 3,
45
- strokeWeight: 3
46
- };
47
- return new google.maps.Polyline({
48
- map,
49
- path: coordinates,
50
- strokeOpacity: 0,
51
- icons: [
52
- {
53
- icon: lineSymbol,
54
- offset: "0",
55
- repeat: "9px"
11
+ coordinates = (() => {
12
+ let list = $isEdit ? $editCoordinates : $originalCoordinates;
13
+ return list.map((data, idx) => {
14
+ let duplicateCount = 0;
15
+ for (let i = 0; i < idx; i++) {
16
+ if (list[i].lat === list[idx].lat && list[i].lng === list[idx].lng) {
17
+ duplicateCount++;
56
18
  }
57
- ]
19
+ }
20
+ return {
21
+ ...data,
22
+ lng: data.lng + duplicateCount * 1e-4
23
+ };
58
24
  });
59
25
  })();
60
- onMount(() => {
61
- init();
62
- });
63
- function init() {
64
- map = new google.maps.Map(document.getElementById(id), {
26
+ let prevCoordinates = [];
27
+ $: {
28
+ if (map && coordinates) {
29
+ const prev = prevCoordinates.map(({ lat, lng }) => ({ lat, lng }));
30
+ const current = coordinates.map(({ lat, lng }) => ({ lat, lng }));
31
+ if (!isEqual(prev, current)) {
32
+ LAYER.render();
33
+ LAYER.bounding();
34
+ }
35
+ prevCoordinates = coordinates;
36
+ }
37
+ }
38
+ const LAYER = {
39
+ marker: {
40
+ list: [],
41
+ create(options, data) {
42
+ const pin$ = document.createElement("span");
43
+ pin$.className = "indie_ic_map_loca";
44
+ if (data.type === "START") {
45
+ pin$.classList.add("start");
46
+ options.zIndex = 3;
47
+ } else if (data.type === "END") {
48
+ pin$.classList.add("end");
49
+ options.zIndex = 2;
50
+ } else {
51
+ options.zIndex = 1;
52
+ }
53
+ if (data.text) {
54
+ pin$.innerText = data.text;
55
+ }
56
+ return new google.maps.marker.AdvancedMarkerElement({
57
+ ...options,
58
+ content: pin$
59
+ });
60
+ },
61
+ render() {
62
+ LAYER.marker.clear();
63
+ LAYER.marker.list = coordinates.map((loc, i) => {
64
+ const type = i === 0 ? "START" : i === coordinates.length - 1 ? "END" : "PLACE";
65
+ return LAYER.marker.create({ position: loc, map }, { type, text: type === "PLACE" ? `${i}` : "" });
66
+ });
67
+ },
68
+ clear() {
69
+ LAYER.marker.list.forEach((marker) => marker.map = null);
70
+ }
71
+ },
72
+ polyline: {
73
+ route: null,
74
+ create() {
75
+ return new google.maps.Polyline({
76
+ map,
77
+ path: coordinates,
78
+ strokeOpacity: 0,
79
+ icons: [
80
+ {
81
+ icon: {
82
+ path: "M -1,1 1,1",
83
+ strokeOpacity: 1,
84
+ scale: 3,
85
+ strokeWeight: 3
86
+ },
87
+ offset: "0",
88
+ repeat: "9px"
89
+ }
90
+ ]
91
+ });
92
+ },
93
+ render() {
94
+ LAYER.polyline.clear();
95
+ LAYER.polyline.route = LAYER.polyline.create();
96
+ },
97
+ clear() {
98
+ LAYER.polyline.route?.setMap(null);
99
+ }
100
+ },
101
+ render() {
102
+ LAYER.marker.render();
103
+ LAYER.polyline.render();
104
+ },
105
+ bounding() {
106
+ const bounds = new google.maps.LatLngBounds();
107
+ LAYER.marker.list.forEach((o) => bounds.extend(o.position));
108
+ LAYER.polyline.route?.getPath().forEach((o) => bounds.extend(o));
109
+ map.fitBounds(bounds, { bottom: 50, left: 50, right: 50, top: 50 });
110
+ }
111
+ };
112
+ async function init() {
113
+ const { Map } = await google.maps.importLibrary("maps");
114
+ await google.maps.importLibrary("marker");
115
+ map = new Map(container$, {
116
+ mapId: "8a7fcbff5a94d6f9",
65
117
  center: new google.maps.LatLng({
66
- lat: 0,
67
- lng: 0
118
+ lat: 33,
119
+ lng: 121
68
120
  }),
69
- zoom: 3,
121
+ zoom: 10,
70
122
  disableDefaultUI: true,
71
123
  panControl: false,
72
124
  zoomControl: false,
@@ -74,50 +126,8 @@ function init() {
74
126
  scaleControl: false,
75
127
  streetViewControl: false,
76
128
  rotateControl: false,
77
- styles: [
78
- // { elementType: 'geometry', stylers: [{ color: '#ebe3cd' }] },
79
- // { elementType: 'labels.text.fill', stylers: [{ color: '#523735' }] },
80
- // { elementType: 'labels.text.stroke', stylers: [{ color: '#f5f1e6' }] },
81
- ]
82
- });
83
- map.addListener("click", (e) => {
84
- if (e.placeId) {
85
- e.stop();
86
- }
87
- });
88
- }
89
- function markerInit(map2, loc, type, text) {
90
- const icons = {
91
- origin: {
92
- url: startIcon,
93
- scaledSize: new google.maps.Size(26, 30)
94
- },
95
- dest: {
96
- url: destIcon,
97
- scaledSize: new google.maps.Size(26, 30)
98
- },
99
- place: {
100
- url: placeIcon,
101
- scaledSize: new google.maps.Size(26, 30)
102
- }
103
- };
104
- const zIndex = {
105
- place: 1,
106
- origin: 3,
107
- dest: 2
108
- };
109
- const marker = new google.maps.Marker({
110
- position: loc,
111
- map: map2,
112
- icon: icons[type],
113
- zIndex: zIndex[type],
114
- label: text ? {
115
- text,
116
- color: "white"
117
- } : void 0
129
+ clickableIcons: false
118
130
  });
119
- marker.setAnimation(null);
120
- return marker;
121
131
  }
122
132
  </script>
123
133
 
@@ -128,5 +138,5 @@ function markerInit(map2, loc, type, text) {
128
138
  <span class="ic_map_loca end" style="left: 90px;"></span> -->
129
139
 
130
140
  <!-- 지도 넣는 부분 -->
131
- <div {id} class="put_map_box" bind:this={container$}></div>
141
+ <div class="put_map_box" bind:this={container$}></div>
132
142
  </div>