@dartcom/ui-kit 10.1.9 → 10.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/layers/leaflet/lib/hooks/useGetLeafletLayer.d.ts +4 -3
- package/dist/components/layers/leaflet/lib/hooks/useGetLeafletLayer.d.ts.map +1 -1
- package/dist/index.cjs +31 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { Nullable } from '../../../../../types';
|
|
2
|
-
import { SourceLayerEventHandlers, TangramCustomLayer, TangramEventConfig, TangramLeafletLayer, TangramSourceConfig } from '../types';
|
|
2
|
+
import { SourceLayerEventHandlers, TangramCustomLayer, TangramEventConfig, TangramLeafletLayer, TangramSourceConfig, TangramSourceNames } from '../types';
|
|
3
3
|
export declare const useGetLeafletLayer: ({ eventHandlers, }: {
|
|
4
4
|
eventHandlers?: SourceLayerEventHandlers;
|
|
5
5
|
}) => {
|
|
6
6
|
layer: Nullable<TangramLeafletLayer>;
|
|
7
7
|
scene: import("..").TangramScene | null;
|
|
8
8
|
config: Nullable<TangramEventConfig>;
|
|
9
|
-
addSource: (
|
|
9
|
+
addSource: (sourceName: TangramSourceNames) => void;
|
|
10
10
|
getSource: (sourceName: TangramSourceConfig["name"]) => {
|
|
11
11
|
tile_size: number;
|
|
12
12
|
type: string;
|
|
13
13
|
url: string;
|
|
14
14
|
} | undefined;
|
|
15
|
-
updateSource: (sourceName: TangramSourceConfig["name"], newUrl: TangramSourceConfig["url"]) =>
|
|
15
|
+
updateSource: (sourceName: TangramSourceConfig["name"], newUrl: TangramSourceConfig["url"]) => void;
|
|
16
|
+
reloadSource: (sourceName: TangramSourceNames) => void;
|
|
16
17
|
addLayer: (layer: TangramCustomLayer) => string[] | undefined;
|
|
17
18
|
removeLayer: (layer: TangramCustomLayer) => string[] | undefined;
|
|
18
19
|
addStyle: ({ name, style }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetLeafletLayer.d.ts","sourceRoot":"","sources":["../../../../../../src/components/layers/leaflet/lib/hooks/useGetLeafletLayer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAKnC,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"useGetLeafletLayer.d.ts","sourceRoot":"","sources":["../../../../../../src/components/layers/leaflet/lib/hooks/useGetLeafletLayer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAKnC,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAGlB,eAAO,MAAM,kBAAkB,GAAI,oBAEhC;IACD,aAAa,CAAC,EAAE,wBAAwB,CAAC;CAC1C;;;;4BAmEgB,kBAAkB;4BAsDlB,mBAAmB,CAAC,MAAM,CAAC;;;;;+BAiB1B,mBAAmB,CAAC,MAAM,CAAC,UAC/B,mBAAmB,CAAC,KAAK,CAAC;+BAyBvB,kBAAkB;sBASvB,kBAAkB;yBAyDlB,kBAAkB;gCA+BR;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;gCAyBzC,kBAAkB;gDAkBL;QAAE,KAAK,EAAE,kBAAkB,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE;;;;CAiIvE,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -30347,7 +30347,7 @@ const useGetLeafletLayer = ({ eventHandlers, }) => {
|
|
|
30347
30347
|
}
|
|
30348
30348
|
});
|
|
30349
30349
|
}, [eventHandlers]);
|
|
30350
|
-
const addSource = React__namespace.useCallback((
|
|
30350
|
+
const addSource = React__namespace.useCallback((sourceName) => {
|
|
30351
30351
|
if (!scene) {
|
|
30352
30352
|
loggerService.warn({
|
|
30353
30353
|
message: 'Scene не инициализирована',
|
|
@@ -30360,10 +30360,29 @@ const useGetLeafletLayer = ({ eventHandlers, }) => {
|
|
|
30360
30360
|
});
|
|
30361
30361
|
return;
|
|
30362
30362
|
}
|
|
30363
|
-
const
|
|
30364
|
-
config.sources[
|
|
30363
|
+
const url = sourceUrl[sourceName];
|
|
30364
|
+
config.sources[sourceName] = {
|
|
30365
|
+
tile_size,
|
|
30366
|
+
url,
|
|
30367
|
+
type: 'MVT',
|
|
30368
|
+
};
|
|
30369
|
+
scene.updateConfig({ rebuild: true });
|
|
30370
|
+
}, [scene, config]);
|
|
30371
|
+
const deleteSource = React__namespace.useCallback((sourceName) => {
|
|
30372
|
+
if (!scene) {
|
|
30373
|
+
loggerService.warn({
|
|
30374
|
+
message: 'Scene не инициализирована',
|
|
30375
|
+
});
|
|
30376
|
+
return;
|
|
30377
|
+
}
|
|
30378
|
+
if (!config) {
|
|
30379
|
+
loggerService.warn({
|
|
30380
|
+
message: 'Config не инициализирована',
|
|
30381
|
+
});
|
|
30382
|
+
return;
|
|
30383
|
+
}
|
|
30384
|
+
delete config.sources[sourceName];
|
|
30365
30385
|
scene.updateConfig({ rebuild: true });
|
|
30366
|
-
return getSources();
|
|
30367
30386
|
}, [scene, config]);
|
|
30368
30387
|
const getSource = React__namespace.useCallback((sourceName) => {
|
|
30369
30388
|
if (!config) {
|
|
@@ -30372,7 +30391,8 @@ const useGetLeafletLayer = ({ eventHandlers, }) => {
|
|
|
30372
30391
|
});
|
|
30373
30392
|
return;
|
|
30374
30393
|
}
|
|
30375
|
-
|
|
30394
|
+
const source = structuredClone(config.sources[sourceName]);
|
|
30395
|
+
return source;
|
|
30376
30396
|
}, [config]);
|
|
30377
30397
|
const updateSource = React__namespace.useCallback((sourceName, newUrl) => {
|
|
30378
30398
|
if (!scene) {
|
|
@@ -30389,8 +30409,11 @@ const useGetLeafletLayer = ({ eventHandlers, }) => {
|
|
|
30389
30409
|
}
|
|
30390
30410
|
config.sources[sourceName].url = newUrl;
|
|
30391
30411
|
scene.updateConfig({ rebuild: true });
|
|
30392
|
-
return getSources();
|
|
30393
30412
|
}, [config, scene]);
|
|
30413
|
+
const reloadSource = React__namespace.useCallback((sourceName) => {
|
|
30414
|
+
deleteSource(sourceName);
|
|
30415
|
+
addSource(sourceName);
|
|
30416
|
+
}, [updateSource]);
|
|
30394
30417
|
const addLayer = React__namespace.useCallback((layer) => {
|
|
30395
30418
|
if (!scene) {
|
|
30396
30419
|
loggerService.warn({
|
|
@@ -30560,15 +30583,7 @@ const useGetLeafletLayer = ({ eventHandlers, }) => {
|
|
|
30560
30583
|
},
|
|
30561
30584
|
},
|
|
30562
30585
|
});
|
|
30563
|
-
Object.values(exports.TangramSourceNames).forEach(
|
|
30564
|
-
const url = sourceUrl[name];
|
|
30565
|
-
addSource({
|
|
30566
|
-
tile_size,
|
|
30567
|
-
name,
|
|
30568
|
-
url,
|
|
30569
|
-
type: 'MVT',
|
|
30570
|
-
});
|
|
30571
|
-
});
|
|
30586
|
+
Object.values(exports.TangramSourceNames).forEach(addSource);
|
|
30572
30587
|
}, [addStyle, addSource]);
|
|
30573
30588
|
return {
|
|
30574
30589
|
layer,
|
|
@@ -30577,6 +30592,7 @@ const useGetLeafletLayer = ({ eventHandlers, }) => {
|
|
|
30577
30592
|
addSource,
|
|
30578
30593
|
getSource,
|
|
30579
30594
|
updateSource,
|
|
30595
|
+
reloadSource,
|
|
30580
30596
|
addLayer,
|
|
30581
30597
|
removeLayer,
|
|
30582
30598
|
addStyle,
|