@gravity-ui/page-constructor 7.16.0 → 7.18.0
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/build/cjs/blocks/Map/schema.d.ts +0 -6
- package/build/cjs/components/Map/YMap/YMap.d.ts +1 -1
- package/build/cjs/components/Map/YMap/YMap.js +33 -14
- package/build/cjs/components/Map/YMap/YMap.js.map +1 -1
- package/build/cjs/components/Map/YMap/YandexMap.js +5 -3
- package/build/cjs/components/Map/YMap/YandexMap.js.map +1 -1
- package/build/cjs/components/Map/YMap/utils.d.ts +8 -0
- package/build/cjs/components/Map/YMap/utils.js +96 -0
- package/build/cjs/components/Map/YMap/utils.js.map +1 -0
- package/build/cjs/models/constructor-items/blocks.d.ts +1 -1
- package/build/cjs/models/constructor-items/blocks.js.map +1 -1
- package/build/cjs/models/constructor-items/common.d.ts +10 -1
- package/build/cjs/models/constructor-items/common.js.map +1 -1
- package/build/cjs/schema/validators/common.d.ts +0 -3
- package/build/cjs/schema/validators/common.js +0 -3
- package/build/cjs/schema/validators/common.js.map +1 -1
- package/build/esm/blocks/Map/schema.d.ts +0 -6
- package/build/esm/components/Map/YMap/YMap.d.ts +1 -1
- package/build/esm/components/Map/YMap/YMap.js +33 -14
- package/build/esm/components/Map/YMap/YMap.js.map +1 -1
- package/build/esm/components/Map/YMap/YandexMap.js +5 -3
- package/build/esm/components/Map/YMap/YandexMap.js.map +1 -1
- package/build/esm/components/Map/YMap/utils.d.ts +8 -0
- package/build/esm/components/Map/YMap/utils.js +90 -0
- package/build/esm/components/Map/YMap/utils.js.map +1 -0
- package/build/esm/models/constructor-items/blocks.d.ts +1 -1
- package/build/esm/models/constructor-items/blocks.js.map +1 -1
- package/build/esm/models/constructor-items/common.d.ts +10 -1
- package/build/esm/models/constructor-items/common.js.map +1 -1
- package/build/esm/schema/validators/common.d.ts +0 -3
- package/build/esm/schema/validators/common.js +0 -3
- package/build/esm/schema/validators/common.js.map +1 -1
- package/package.json +1 -1
- package/schema/index.js +1 -1
- package/server/models/constructor-items/blocks.d.ts +1 -1
- package/server/models/constructor-items/common.d.ts +10 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"../../../../src","sources":["schema/validators/common.ts"],"names":[],"mappings":";;;;AA4cA,8BAsBC;AAleD,6DAAyD;AACzD,kDAMsB;AAEtB,sCAA6C;AAEhC,QAAA,cAAc,GAAG,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;AACpD,QAAA,QAAQ,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACvC,QAAA,mBAAmB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AACtD,QAAA,gBAAgB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC5C,QAAA,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAC/B,QAAA,gBAAgB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAEnC,QAAA,UAAU,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AACnC,QAAA,aAAa,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AACpC,QAAA,cAAc,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAClC,QAAA,kBAAkB,GAAG,CAAC,+BAAsB,CAAC,OAAO,EAAE,+BAAsB,CAAC,MAAM,CAAC,CAAC;AACrF,QAAA,aAAa,GAAG,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAE3C,QAAA,WAAW,GAAG,EAAC,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CA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;aACrB;YACD;gBACI,GAAG,kBAAU;gBACb,UAAU,EAAE,SAAS;aACxB;SACJ;KACJ;IACD,WAAW,EAAE;QACT,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,KAAK;QAClB,SAAS,EAAE,UAAU;KACxB;CACJ,CAAC;AAEW,QAAA,gBAAgB,GAAG;IAC5B,KAAK,EAAE;QACH;YACI,IAAI,EAAE,QAAQ;SACjB;QACD;YACI,IAAI,EAAE,QAAQ;YACd,oBAAoB,EAAE,KAAK;YAC3B,QAAQ,EAAE,CAAC,MAAM,CAAC;YAClB,UAAU,EAAE;gBACR,IAAI,EAAE;oBACF,IAAI,EAAE,QAAQ;iBACjB;gBACD,KAAK,EAAE;oBACH,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC;iBAChC;aACJ;SACJ;KACJ;CACJ,CAAC","sourcesContent":["import {ImageProps} from '../../components/Image/schema';\nimport {\n CustomControlsButtonPositioning,\n CustomControlsType,\n MediaVideoControlsType,\n QuoteType,\n Theme,\n} from '../../models';\n\nimport {AnalyticsEventSchema} from './event';\n\nexport const mediaDirection = ['media-content', 'content-media'];\nexport const textSize = ['xs', 's', 'sm', 'm', 'l'];\nexport const containerSizesArray = ['sm', 'md', 'lg', 'xl', 'all'];\nexport const sliderSizesArray = ['sm', 'md', 'lg', 'xl'];\nexport const contentSizes = ['s', 'm', 'l'];\nexport const contentTextWidth = ['s', 'm', 'l'];\n\nexport const videoTypes = ['default', 'player'];\nexport const playIconTypes = ['default', 'text'];\nexport const playIconThemes = ['blue', 'grey'];\nexport const videoControlsTypes = [MediaVideoControlsType.Default, MediaVideoControlsType.Custom];\nexport const fileLinkTypes = ['vertical', 'horizontal'];\n\nexport const dividerEnum = {enum: ['0', 'xxs', 'xs', 's', 'm', 'l', 'xl', 'xxl', 'xxxl']};\nexport const sizeNumber = {type: 'number', maximum: 12, minimum: 1};\nexport const contentThemes = ['default', 'dark', 'light'];\nexport const quoteTypes = Object.values(QuoteType);\nexport const mediaView = ['fit', 'full'];\nexport const customControlsType = [\n CustomControlsType.WithMuteButton,\n CustomControlsType.WithPlayPauseButton,\n];\nexport const customControlsButtonPositioning = [\n CustomControlsButtonPositioning.Center,\n CustomControlsButtonPositioning.Left,\n CustomControlsButtonPositioning.Right,\n];\n\nexport const BaseProps = {\n type: {},\n when: {\n type: 'string',\n },\n};\n\nexport const CardLayoutProps = {\n controlPosition: {\n type: 'string',\n enum: ['content', 'footer'],\n },\n};\n\nexport const containerSizesObject = {\n type: 'object',\n additionalProperties: false,\n properties: containerSizesArray.reduce((acc, size) => ({...acc, [size]: sizeNumber}), {}),\n};\n\nexport const sliderSizesObject = {\n oneOf: [\n {\n type: 'object',\n additionalProperties: false,\n properties: sliderSizesArray.reduce((acc, size) => ({...acc, [size]: sizeNumber}), {}),\n optionName: 'custom',\n },\n {\n type: 'number',\n optionName: 'constant',\n },\n ],\n};\n\nexport const AnimatableProps = {\n animated: {\n type: 'boolean',\n },\n};\n\nexport const ChildrenProps = {\n type: 'array',\n items: {$ref: 'self#/definitions/children'},\n};\n\nexport const ChildrenCardsProps = {\n type: 'array',\n items: {$ref: 'self#/definitions/cards'},\n};\n\nexport const LoopProps = {\n type: 'object',\n additionalProperties: false,\n required: ['start'],\n properties: {\n start: {\n type: 'number',\n },\n end: {\n type: 'number',\n },\n },\n};\n\nexport const PlayButtonProps = {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: {\n type: 'string',\n enum: playIconTypes,\n },\n theme: {\n type: 'string',\n enum: playIconThemes,\n },\n text: {\n type: 'string',\n contentType: 'text',\n },\n },\n};\n\nexport const CustomControlsOptionsProps = {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: {\n type: 'string',\n enum: customControlsType,\n },\n muteButtonShown: {\n type: 'boolean',\n },\n positioning: {\n type: 'string',\n enum: customControlsButtonPositioning,\n },\n },\n};\n\nexport const VideoProps = {\n type: 'object',\n additionalProperties: false,\n required: ['src'],\n properties: {\n src: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n loop: {\n oneOf: [\n {\n ...LoopProps,\n optionName: 'options',\n },\n {\n type: 'boolean',\n optionName: 'enabled',\n },\n ],\n },\n type: {\n type: 'string',\n enum: videoTypes,\n },\n muted: {\n type: 'boolean',\n },\n autoplay: {\n type: 'boolean',\n },\n elapsedTime: {\n type: 'number',\n },\n playButton: PlayButtonProps,\n controls: {\n type: 'string',\n enum: videoControlsTypes,\n },\n customControlsOptions: CustomControlsOptionsProps,\n ariaLabel: {\n type: 'string',\n },\n contain: {\n type: 'boolean',\n },\n },\n};\n\nexport const ThemeProps = {\n type: 'string',\n enum: ['light', 'dark'],\n};\n\nexport const JustifyProps = {\n type: 'string',\n enum: ['start', 'center', 'end'],\n};\n\nexport const DataLensObjectProps = {\n type: 'object',\n additionalProperties: false,\n required: ['id'],\n properties: {\n id: {\n type: 'string',\n },\n theme: ThemeProps,\n },\n};\n\nexport const DataLensProps = {\n oneOf: [\n {\n type: 'string',\n optionName: 'id',\n },\n {\n ...DataLensObjectProps,\n optionName: 'options',\n },\n ],\n};\n\nexport const BackgroundProps = {\n additionalProperties: false,\n properties: {\n ...AnimatableProps,\n image: ImageProps,\n color: {\n type: 'string',\n },\n video: VideoProps,\n height: {\n type: 'number',\n },\n size: {\n type: 'string',\n enum: ['contain', 'cover'],\n },\n parallax: {\n type: 'boolean',\n },\n fullWidthMedia: {\n type: 'boolean',\n },\n },\n};\n\nexport const LinkProps = {\n type: 'object',\n additionalProperties: false,\n required: ['text', 'url'],\n properties: {\n ...BaseProps,\n text: {\n type: 'string',\n contentType: 'text',\n },\n url: {\n type: 'string',\n },\n urlTitle: {\n type: 'string',\n },\n arrow: {\n type: 'boolean',\n },\n theme: {\n type: 'string',\n enum: ['back', 'file-link', 'normal'],\n },\n textSize: {\n type: 'string',\n enum: textSize,\n },\n target: {\n type: 'string',\n enum: ['_blank', '_parent', '_top', '_self'],\n },\n analyticsEvents: {\n oneOf: [\n {\n ...AnalyticsEventSchema,\n optionName: 'single',\n },\n {\n type: 'array',\n items: AnalyticsEventSchema,\n optionName: 'list',\n },\n ],\n },\n },\n};\n\nexport const FileLinkProps = {\n type: 'object',\n additionalProperties: false,\n required: ['href', 'text'],\n properties: {\n href: {\n type: 'string',\n },\n text: {\n type: 'string',\n contentType: 'text',\n },\n type: {\n type: 'string',\n enum: fileLinkTypes,\n },\n textSize: {\n type: 'string',\n enum: textSize,\n },\n theme: {\n type: 'string',\n enum: contentThemes,\n },\n },\n};\n\nexport const authorItem = {\n type: 'object',\n required: ['firstName', 'secondName'],\n properties: {\n firstName: {\n type: 'string',\n contentType: 'text',\n },\n secondName: {\n type: 'string',\n contentType: 'text',\n },\n avatar: ImageProps,\n description: {\n type: 'string',\n contentType: 'yfm',\n },\n },\n};\n\nexport const ButtonProps = {\n text: {\n type: 'string',\n contentType: 'text',\n },\n url: {\n type: 'string',\n },\n urlTitle: {\n type: 'string',\n },\n primary: {\n type: 'boolean',\n },\n size: {\n type: 'string',\n enum: [\n 'xs', // deprecated, use 's'\n 'ns', // deprecated, use 's'\n 's',\n 'n', // deprecated, use 'l'\n 'm',\n 'l',\n 'xl',\n 'head', // deprecated, use 'l'\n 'promo', // deprecated, use 'xl'\n ],\n },\n theme: {\n type: 'string',\n enum: [\n 'normal',\n 'action',\n 'outlined',\n 'outlined-info',\n 'outlined-danger',\n 'raised',\n 'flat',\n 'flat-info',\n 'flat-danger',\n 'flat-secondary',\n 'clear',\n 'normal-contrast',\n 'outlined-contrast',\n 'flat-contrast',\n 'link', // deprecated, use 'outlined-info'\n 'pseudo', // deprecated, use 'outlined'\n 'pseudo-special', // deprecated, use 'outlined-contrast'\n 'websearch', // deprecated, use 'action'\n 'normal-dark', // deprecated, use 'outlined-contrast'\n 'normal-special', // deprecated, use 'normal-contrast'\n 'accent', // deprecated, use 'action'\n 'dark-grey', // deprecated, use 'github'\n 'app-store',\n 'google-play',\n 'scale',\n 'github',\n 'monochrome',\n ],\n },\n img: {\n oneOf: [\n {\n type: 'string',\n optionName: 'url',\n },\n {\n type: 'object',\n additionalProperties: false,\n required: ['data'],\n properties: {\n data: {\n type: 'string',\n },\n position: {\n type: 'string',\n enum: ['left', 'right'],\n },\n alt: {\n type: 'string',\n contentType: 'text',\n },\n },\n optionName: 'options',\n },\n ],\n },\n analyticsEvents: {\n oneOf: [\n {...AnalyticsEventSchema, optionName: 'single'},\n {type: 'array', items: AnalyticsEventSchema, optionName: 'list'},\n ],\n },\n target: {\n type: 'string',\n enum: ['_self', '_blank', '_parent', '_top'],\n },\n width: {\n type: 'string',\n enum: ['auto', 'max'],\n },\n};\n\nexport const MenuProps = {\n type: 'object',\n additionalProperties: false,\n properties: {\n title: {\n type: 'string',\n contentType: 'text',\n },\n },\n};\n\nexport function withTheme<T extends object>(value: T) {\n return {\n oneOf: [\n {\n ...value,\n optionName: 'no theme',\n },\n {\n type: 'object',\n additionalProperties: false,\n required: [Theme.Light],\n properties: Object.values(Theme).reduce(\n (result, themeName) => ({\n ...result,\n [themeName]: value,\n }),\n {},\n ),\n optionName: 'themes',\n },\n ],\n };\n}\n\nexport const AnchorProps = {\n type: 'object',\n additionalProperties: false,\n required: ['text', 'url'],\n properties: {\n text: {\n type: 'string',\n contentType: 'text',\n },\n url: {\n type: 'string',\n },\n urlTitle: {\n type: 'string',\n },\n },\n};\n\nexport const BlockBaseProps = {\n ...BaseProps,\n anchor: AnchorProps,\n visible: {\n type: 'string',\n enum: containerSizesArray,\n },\n resetPaddings: {\n type: 'boolean',\n },\n context: {\n type: 'string',\n },\n indent: {\n type: 'object',\n additionalProperties: false,\n properties: {\n top: dividerEnum,\n bottom: dividerEnum,\n },\n },\n};\n\nexport const TitleProps = {\n type: 'object',\n additionalProperties: false,\n required: ['text'],\n properties: {\n text: {\n type: 'string',\n contentType: 'text',\n },\n textSize: {\n type: 'string',\n enum: textSize,\n },\n url: {\n type: 'string',\n },\n urlTitle: {\n type: 'string',\n },\n resetMargin: {\n type: 'boolean',\n },\n },\n};\n\nexport const ButtonBlock = {\n type: 'object',\n additionalProperties: false,\n properties: ButtonProps,\n if: {\n properties: {\n theme: {\n enum: ['app-store', 'google-play'],\n },\n },\n },\n then: {\n required: ['url'],\n },\n else: {\n required: ['text', 'url'],\n },\n};\n\nconst IframeProps = {\n type: 'object',\n additionalProperties: false,\n required: ['src'],\n properties: {\n src: {\n type: 'string',\n },\n name: {\n type: 'string',\n },\n title: {\n type: 'string',\n },\n height: {\n type: 'number',\n },\n width: {\n type: 'number',\n },\n },\n};\n\nexport const MediaProps = {\n color: {\n type: 'string',\n },\n image: {\n oneOf: [\n {...ImageProps, optionName: 'single'},\n {type: 'array', items: ImageProps, optionName: 'list'},\n ],\n },\n disableImageSliderForArrayInput: {\n type: 'boolean',\n },\n video: VideoProps,\n youtube: {\n type: 'string',\n },\n videoIframe: {\n type: 'string',\n },\n autoplay: {\n type: 'boolean',\n },\n parallax: {\n type: 'boolean',\n },\n height: {\n type: 'number',\n },\n previewImg: {\n type: 'string',\n },\n dataLens: DataLensProps,\n fullscreen: {\n type: 'boolean',\n },\n analyticsEvents: {\n anyOf: [AnalyticsEventSchema, {type: 'array', items: AnalyticsEventSchema}],\n },\n ratio: {\n type: ['number', 'string'],\n pattern: '^auto$',\n },\n iframe: {\n ...IframeProps,\n },\n margins: {\n type: 'boolean',\n },\n};\n\nconst YMapXY = {\n type: 'array',\n items: {type: 'number'},\n minItems: 2,\n maxItems: 2,\n};\n\nexport const YMapMarkerLabel = {\n type: 'object',\n required: [],\n properties: {\n iconCaption: {\n type: 'string',\n },\n iconContent: {\n type: 'string',\n },\n iconColor: {\n type: 'string',\n },\n iconImageHref: {\n type: 'string',\n },\n iconImageSize: YMapXY,\n iconImageOffset: YMapXY,\n iconImageClipRect: {\n type: 'array',\n items: YMapXY,\n minItems: 2,\n maxItems: 2,\n },\n iconLayout: {\n type: 'string',\n },\n iconShape: {\n type: 'object',\n additionalProperties: true,\n },\n preset: {\n type: 'string',\n },\n },\n};\n\nexport const YMapMarker = {\n type: 'object',\n additionalProperties: false,\n required: [],\n properties: {\n coordinate: {\n type: 'array',\n items: {type: 'number'},\n },\n address: {\n type: 'string',\n },\n label: YMapMarkerLabel,\n },\n};\n\nexport const MapProps = {\n zoom: {\n type: 'number',\n },\n address: {\n type: 'string',\n },\n id: {\n type: 'string',\n },\n markers: {\n type: 'array',\n items: YMapMarker,\n },\n forceAspectRatio: {\n type: 'boolean',\n },\n disableControls: {\n type: 'boolean',\n },\n disableBalloons: {\n type: 'boolean',\n },\n};\n\nexport const BorderProps = {\n type: 'string',\n enum: ['line', 'shadow', 'none'],\n};\n\nexport const CardBase = {\n border: BorderProps,\n};\n\nexport const BlockHeaderProps = {\n title: {\n oneOf: [\n {\n type: 'string',\n optionName: 'text',\n },\n {\n ...TitleProps,\n optionName: 'options',\n },\n ],\n },\n description: {\n type: 'string',\n contentType: 'yfm',\n inputType: 'textarea',\n },\n};\n\nexport const GravityIconProps = {\n oneOf: [\n {\n type: 'string',\n },\n {\n type: 'object',\n additionalProperties: false,\n required: ['name'],\n properties: {\n name: {\n type: 'string',\n },\n color: {\n type: 'string',\n enum: ['brand', 'text-color'],\n },\n },\n },\n ],\n};\n"]}
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"../../../../src","sources":["schema/validators/common.ts"],"names":[],"mappings":";;;;AA4cA,8BAsBC;AAleD,6DAAyD;AACzD,kDAMsB;AAEtB,sCAA6C;AAEhC,QAAA,cAAc,GAAG,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;AACpD,QAAA,QAAQ,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACvC,QAAA,mBAAmB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AACtD,QAAA,gBAAgB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC5C,QAAA,YAAY,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jB;IACD,OAAO,EAAE;QACL,IAAI,EAAE,QAAQ;KACjB;IACD,EAAE,EAAE;QACA,IAAI,EAAE,QAAQ;KACjB;IACD,OAAO,EAAE;QACL,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,kBAAU;KACpB;IACD,eAAe,EAAE;QACb,IAAI,EAAE,SAAS;KAClB;IACD,eAAe,EAAE;QACb,IAAI,EAAE,SAAS;KAClB;CACJ,CAAC;AAEW,QAAA,WAAW,GAAG;IACvB,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC;CACnC,CAAC;AAEW,QAAA,QAAQ,GAAG;IACpB,MAAM,EAAE,mBAAW;CACtB,CAAC;AAEW,QAAA,gBAAgB,GAAG;IAC5B,KAAK,EAAE;QACH,KAAK,EAAE;YACH;gBACI,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE,MAAM;aACrB;YACD;gBACI,GAAG,kBAAU;gBACb,UAAU,EAAE,SAAS;aACxB;SACJ;KACJ;IACD,WAAW,EAAE;QACT,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,KAAK;QAClB,SAAS,EAAE,UAAU;KACxB;CACJ,CAAC;AAEW,QAAA,gBAAgB,GAAG;IAC5B,KAAK,EAAE;QACH;YACI,IAAI,EAAE,QAAQ;SACjB;QACD;YACI,IAAI,EAAE,QAAQ;YACd,oBAAoB,EAAE,KAAK;YAC3B,QAAQ,EAAE,CAAC,MAAM,CAAC;YAClB,UAAU,EAAE;gBACR,IAAI,EAAE;oBACF,IAAI,EAAE,QAAQ;iBACjB;gBACD,KAAK,EAAE;oBACH,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,OAAO,EAAE,YAAY,CAAC;iBAChC;aACJ;SACJ;KACJ;CACJ,CAAC","sourcesContent":["import {ImageProps} from '../../components/Image/schema';\nimport {\n CustomControlsButtonPositioning,\n CustomControlsType,\n MediaVideoControlsType,\n QuoteType,\n Theme,\n} from '../../models';\n\nimport {AnalyticsEventSchema} from './event';\n\nexport const mediaDirection = ['media-content', 'content-media'];\nexport const textSize = ['xs', 's', 'sm', 'm', 'l'];\nexport const containerSizesArray = ['sm', 'md', 'lg', 'xl', 'all'];\nexport const sliderSizesArray = ['sm', 'md', 'lg', 'xl'];\nexport const contentSizes = ['s', 'm', 'l'];\nexport const contentTextWidth = ['s', 'm', 'l'];\n\nexport const videoTypes = ['default', 'player'];\nexport const playIconTypes = ['default', 'text'];\nexport const playIconThemes = ['blue', 'grey'];\nexport const videoControlsTypes = [MediaVideoControlsType.Default, MediaVideoControlsType.Custom];\nexport const fileLinkTypes = ['vertical', 'horizontal'];\n\nexport const dividerEnum = {enum: ['0', 'xxs', 'xs', 's', 'm', 'l', 'xl', 'xxl', 'xxxl']};\nexport const sizeNumber = {type: 'number', maximum: 12, minimum: 1};\nexport const contentThemes = ['default', 'dark', 'light'];\nexport const quoteTypes = Object.values(QuoteType);\nexport const mediaView = ['fit', 'full'];\nexport const customControlsType = [\n CustomControlsType.WithMuteButton,\n CustomControlsType.WithPlayPauseButton,\n];\nexport const customControlsButtonPositioning = [\n CustomControlsButtonPositioning.Center,\n CustomControlsButtonPositioning.Left,\n CustomControlsButtonPositioning.Right,\n];\n\nexport const BaseProps = {\n type: {},\n when: {\n type: 'string',\n },\n};\n\nexport const CardLayoutProps = {\n controlPosition: {\n type: 'string',\n enum: ['content', 'footer'],\n },\n};\n\nexport const containerSizesObject = {\n type: 'object',\n additionalProperties: false,\n properties: containerSizesArray.reduce((acc, size) => ({...acc, [size]: sizeNumber}), {}),\n};\n\nexport const sliderSizesObject = {\n oneOf: [\n {\n type: 'object',\n additionalProperties: false,\n properties: sliderSizesArray.reduce((acc, size) => ({...acc, [size]: sizeNumber}), {}),\n optionName: 'custom',\n },\n {\n type: 'number',\n optionName: 'constant',\n },\n ],\n};\n\nexport const AnimatableProps = {\n animated: {\n type: 'boolean',\n },\n};\n\nexport const ChildrenProps = {\n type: 'array',\n items: {$ref: 'self#/definitions/children'},\n};\n\nexport const ChildrenCardsProps = {\n type: 'array',\n items: {$ref: 'self#/definitions/cards'},\n};\n\nexport const LoopProps = {\n type: 'object',\n additionalProperties: false,\n required: ['start'],\n properties: {\n start: {\n type: 'number',\n },\n end: {\n type: 'number',\n },\n },\n};\n\nexport const PlayButtonProps = {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: {\n type: 'string',\n enum: playIconTypes,\n },\n theme: {\n type: 'string',\n enum: playIconThemes,\n },\n text: {\n type: 'string',\n contentType: 'text',\n },\n },\n};\n\nexport const CustomControlsOptionsProps = {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: {\n type: 'string',\n enum: customControlsType,\n },\n muteButtonShown: {\n type: 'boolean',\n },\n positioning: {\n type: 'string',\n enum: customControlsButtonPositioning,\n },\n },\n};\n\nexport const VideoProps = {\n type: 'object',\n additionalProperties: false,\n required: ['src'],\n properties: {\n src: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n loop: {\n oneOf: [\n {\n ...LoopProps,\n optionName: 'options',\n },\n {\n type: 'boolean',\n optionName: 'enabled',\n },\n ],\n },\n type: {\n type: 'string',\n enum: videoTypes,\n },\n muted: {\n type: 'boolean',\n },\n autoplay: {\n type: 'boolean',\n },\n elapsedTime: {\n type: 'number',\n },\n playButton: PlayButtonProps,\n controls: {\n type: 'string',\n enum: videoControlsTypes,\n },\n customControlsOptions: CustomControlsOptionsProps,\n ariaLabel: {\n type: 'string',\n },\n contain: {\n type: 'boolean',\n },\n },\n};\n\nexport const ThemeProps = {\n type: 'string',\n enum: ['light', 'dark'],\n};\n\nexport const JustifyProps = {\n type: 'string',\n enum: ['start', 'center', 'end'],\n};\n\nexport const DataLensObjectProps = {\n type: 'object',\n additionalProperties: false,\n required: ['id'],\n properties: {\n id: {\n type: 'string',\n },\n theme: ThemeProps,\n },\n};\n\nexport const DataLensProps = {\n oneOf: [\n {\n type: 'string',\n optionName: 'id',\n },\n {\n ...DataLensObjectProps,\n optionName: 'options',\n },\n ],\n};\n\nexport const BackgroundProps = {\n additionalProperties: false,\n properties: {\n ...AnimatableProps,\n image: ImageProps,\n color: {\n type: 'string',\n },\n video: VideoProps,\n height: {\n type: 'number',\n },\n size: {\n type: 'string',\n enum: ['contain', 'cover'],\n },\n parallax: {\n type: 'boolean',\n },\n fullWidthMedia: {\n type: 'boolean',\n },\n },\n};\n\nexport const LinkProps = {\n type: 'object',\n additionalProperties: false,\n required: ['text', 'url'],\n properties: {\n ...BaseProps,\n text: {\n type: 'string',\n contentType: 'text',\n },\n url: {\n type: 'string',\n },\n urlTitle: {\n type: 'string',\n },\n arrow: {\n type: 'boolean',\n },\n theme: {\n type: 'string',\n enum: ['back', 'file-link', 'normal'],\n },\n textSize: {\n type: 'string',\n enum: textSize,\n },\n target: {\n type: 'string',\n enum: ['_blank', '_parent', '_top', '_self'],\n },\n analyticsEvents: {\n oneOf: [\n {\n ...AnalyticsEventSchema,\n optionName: 'single',\n },\n {\n type: 'array',\n items: AnalyticsEventSchema,\n optionName: 'list',\n },\n ],\n },\n },\n};\n\nexport const FileLinkProps = {\n type: 'object',\n additionalProperties: false,\n required: ['href', 'text'],\n properties: {\n href: {\n type: 'string',\n },\n text: {\n type: 'string',\n contentType: 'text',\n },\n type: {\n type: 'string',\n enum: fileLinkTypes,\n },\n textSize: {\n type: 'string',\n enum: textSize,\n },\n theme: {\n type: 'string',\n enum: contentThemes,\n },\n },\n};\n\nexport const authorItem = {\n type: 'object',\n required: ['firstName', 'secondName'],\n properties: {\n firstName: {\n type: 'string',\n contentType: 'text',\n },\n secondName: {\n type: 'string',\n contentType: 'text',\n },\n avatar: ImageProps,\n description: {\n type: 'string',\n contentType: 'yfm',\n },\n },\n};\n\nexport const ButtonProps = {\n text: {\n type: 'string',\n contentType: 'text',\n },\n url: {\n type: 'string',\n },\n urlTitle: {\n type: 'string',\n },\n primary: {\n type: 'boolean',\n },\n size: {\n type: 'string',\n enum: [\n 'xs', // deprecated, use 's'\n 'ns', // deprecated, use 's'\n 's',\n 'n', // deprecated, use 'l'\n 'm',\n 'l',\n 'xl',\n 'head', // deprecated, use 'l'\n 'promo', // deprecated, use 'xl'\n ],\n },\n theme: {\n type: 'string',\n enum: [\n 'normal',\n 'action',\n 'outlined',\n 'outlined-info',\n 'outlined-danger',\n 'raised',\n 'flat',\n 'flat-info',\n 'flat-danger',\n 'flat-secondary',\n 'clear',\n 'normal-contrast',\n 'outlined-contrast',\n 'flat-contrast',\n 'link', // deprecated, use 'outlined-info'\n 'pseudo', // deprecated, use 'outlined'\n 'pseudo-special', // deprecated, use 'outlined-contrast'\n 'websearch', // deprecated, use 'action'\n 'normal-dark', // deprecated, use 'outlined-contrast'\n 'normal-special', // deprecated, use 'normal-contrast'\n 'accent', // deprecated, use 'action'\n 'dark-grey', // deprecated, use 'github'\n 'app-store',\n 'google-play',\n 'scale',\n 'github',\n 'monochrome',\n ],\n },\n img: {\n oneOf: [\n {\n type: 'string',\n optionName: 'url',\n },\n {\n type: 'object',\n additionalProperties: false,\n required: ['data'],\n properties: {\n data: {\n type: 'string',\n },\n position: {\n type: 'string',\n enum: ['left', 'right'],\n },\n alt: {\n type: 'string',\n contentType: 'text',\n },\n },\n optionName: 'options',\n },\n ],\n },\n analyticsEvents: {\n oneOf: [\n {...AnalyticsEventSchema, optionName: 'single'},\n {type: 'array', items: AnalyticsEventSchema, optionName: 'list'},\n ],\n },\n target: {\n type: 'string',\n enum: ['_self', '_blank', '_parent', '_top'],\n },\n width: {\n type: 'string',\n enum: ['auto', 'max'],\n },\n};\n\nexport const MenuProps = {\n type: 'object',\n additionalProperties: false,\n properties: {\n title: {\n type: 'string',\n contentType: 'text',\n },\n },\n};\n\nexport function withTheme<T extends object>(value: T) {\n return {\n oneOf: [\n {\n ...value,\n optionName: 'no theme',\n },\n {\n type: 'object',\n additionalProperties: false,\n required: [Theme.Light],\n properties: Object.values(Theme).reduce(\n (result, themeName) => ({\n ...result,\n [themeName]: value,\n }),\n {},\n ),\n optionName: 'themes',\n },\n ],\n };\n}\n\nexport const AnchorProps = {\n type: 'object',\n additionalProperties: false,\n required: ['text', 'url'],\n properties: {\n text: {\n type: 'string',\n contentType: 'text',\n },\n url: {\n type: 'string',\n },\n urlTitle: {\n type: 'string',\n },\n },\n};\n\nexport const BlockBaseProps = {\n ...BaseProps,\n anchor: AnchorProps,\n visible: {\n type: 'string',\n enum: containerSizesArray,\n },\n resetPaddings: {\n type: 'boolean',\n },\n context: {\n type: 'string',\n },\n indent: {\n type: 'object',\n additionalProperties: false,\n properties: {\n top: dividerEnum,\n bottom: dividerEnum,\n },\n },\n};\n\nexport const TitleProps = {\n type: 'object',\n additionalProperties: false,\n required: ['text'],\n properties: {\n text: {\n type: 'string',\n contentType: 'text',\n },\n textSize: {\n type: 'string',\n enum: textSize,\n },\n url: {\n type: 'string',\n },\n urlTitle: {\n type: 'string',\n },\n resetMargin: {\n type: 'boolean',\n },\n },\n};\n\nexport const ButtonBlock = {\n type: 'object',\n additionalProperties: false,\n properties: ButtonProps,\n if: {\n properties: {\n theme: {\n enum: ['app-store', 'google-play'],\n },\n },\n },\n then: {\n required: ['url'],\n },\n else: {\n required: ['text', 'url'],\n },\n};\n\nconst IframeProps = {\n type: 'object',\n additionalProperties: false,\n required: ['src'],\n properties: {\n src: {\n type: 'string',\n },\n name: {\n type: 'string',\n },\n title: {\n type: 'string',\n },\n height: {\n type: 'number',\n },\n width: {\n type: 'number',\n },\n },\n};\n\nexport const MediaProps = {\n color: {\n type: 'string',\n },\n image: {\n oneOf: [\n {...ImageProps, optionName: 'single'},\n {type: 'array', items: ImageProps, optionName: 'list'},\n ],\n },\n disableImageSliderForArrayInput: {\n type: 'boolean',\n },\n video: VideoProps,\n youtube: {\n type: 'string',\n },\n videoIframe: {\n type: 'string',\n },\n autoplay: {\n type: 'boolean',\n },\n parallax: {\n type: 'boolean',\n },\n height: {\n type: 'number',\n },\n previewImg: {\n type: 'string',\n },\n dataLens: DataLensProps,\n fullscreen: {\n type: 'boolean',\n },\n analyticsEvents: {\n anyOf: [AnalyticsEventSchema, {type: 'array', items: AnalyticsEventSchema}],\n },\n ratio: {\n type: ['number', 'string'],\n pattern: '^auto$',\n },\n iframe: {\n ...IframeProps,\n },\n margins: {\n type: 'boolean',\n },\n};\n\nconst YMapXY = {\n type: 'array',\n items: {type: 'number'},\n minItems: 2,\n maxItems: 2,\n};\n\nexport const YMapMarkerLabel = {\n type: 'object',\n required: [],\n properties: {\n iconCaption: {\n type: 'string',\n },\n iconContent: {\n type: 'string',\n },\n iconColor: {\n type: 'string',\n },\n iconImageHref: {\n type: 'string',\n },\n iconImageSize: YMapXY,\n iconImageOffset: YMapXY,\n iconImageClipRect: {\n type: 'array',\n items: YMapXY,\n minItems: 2,\n maxItems: 2,\n },\n iconLayout: {\n type: 'string',\n },\n iconShape: {\n type: 'object',\n additionalProperties: true,\n },\n preset: {\n type: 'string',\n },\n },\n};\n\nexport const YMapMarker = {\n type: 'object',\n additionalProperties: false,\n required: [],\n properties: {\n coordinate: {\n type: 'array',\n items: {type: 'number'},\n },\n address: {\n type: 'string',\n },\n label: YMapMarkerLabel,\n },\n};\n\nexport const MapProps = {\n zoom: {\n type: 'number',\n },\n address: {\n type: 'string',\n },\n id: {\n type: 'string',\n },\n markers: {\n type: 'array',\n items: YMapMarker,\n },\n disableControls: {\n type: 'boolean',\n },\n disableBalloons: {\n type: 'boolean',\n },\n};\n\nexport const BorderProps = {\n type: 'string',\n enum: ['line', 'shadow', 'none'],\n};\n\nexport const CardBase = {\n border: BorderProps,\n};\n\nexport const BlockHeaderProps = {\n title: {\n oneOf: [\n {\n type: 'string',\n optionName: 'text',\n },\n {\n ...TitleProps,\n optionName: 'options',\n },\n ],\n },\n description: {\n type: 'string',\n contentType: 'yfm',\n inputType: 'textarea',\n },\n};\n\nexport const GravityIconProps = {\n oneOf: [\n {\n type: 'string',\n },\n {\n type: 'object',\n additionalProperties: false,\n required: ['name'],\n properties: {\n name: {\n type: 'string',\n },\n color: {\n type: 'string',\n enum: ['brand', 'text-color'],\n },\n },\n },\n ],\n};\n"]}
|
|
@@ -88,9 +88,6 @@ export declare const Map: {
|
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
90
|
};
|
|
91
|
-
forceAspectRatio: {
|
|
92
|
-
type: string;
|
|
93
|
-
};
|
|
94
91
|
disableControls: {
|
|
95
92
|
type: string;
|
|
96
93
|
};
|
|
@@ -194,9 +191,6 @@ export declare const MapBlock: {
|
|
|
194
191
|
};
|
|
195
192
|
};
|
|
196
193
|
};
|
|
197
|
-
forceAspectRatio: {
|
|
198
|
-
type: string;
|
|
199
|
-
};
|
|
200
194
|
disableControls: {
|
|
201
195
|
type: string;
|
|
202
196
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { YMapMarkerPrivate, YMapProps } from "../../../models/index.js";
|
|
2
|
-
type PlacemarksProps = Pick<YMapProps, 'zoom' | 'markers'>;
|
|
2
|
+
type PlacemarksProps = Pick<YMapProps, 'zoom' | 'markers' | 'areaMargin'>;
|
|
3
3
|
export declare class YMap {
|
|
4
4
|
private ymap;
|
|
5
5
|
private mapRef;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { calculateMapParamsWithMarginAndZoom, parseMargin } from "./utils.js";
|
|
1
2
|
var GeoObjectTypes;
|
|
2
3
|
(function (GeoObjectTypes) {
|
|
3
4
|
GeoObjectTypes["Properties"] = "properties";
|
|
@@ -76,33 +77,51 @@ export class YMap {
|
|
|
76
77
|
}
|
|
77
78
|
});
|
|
78
79
|
}
|
|
80
|
+
// eslint-disable-next-line complexity
|
|
79
81
|
recalcZoomAndCenter(props) {
|
|
80
82
|
const coordsLength = this.coords.length;
|
|
81
|
-
const { zoom = 0 } = props;
|
|
83
|
+
const { zoom = 0, areaMargin } = props;
|
|
82
84
|
if (!coordsLength) {
|
|
83
85
|
return;
|
|
84
86
|
}
|
|
85
|
-
|
|
86
|
-
this.coords
|
|
87
|
-
leftBottom = [Math.min(leftBottom[0], point[0]), Math.min(leftBottom[1], point[1])];
|
|
88
|
-
rightTop = [Math.max(rightTop[0], point[0]), Math.max(rightTop[1], point[1])];
|
|
89
|
-
});
|
|
87
|
+
const utils = window.ymaps.util.bounds;
|
|
88
|
+
const [leftTop, rightBottom] = utils.fromPoints(this.coords);
|
|
90
89
|
let newMapParams = {
|
|
91
90
|
zoom,
|
|
92
91
|
center: [],
|
|
93
92
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
const parsedAreaMargin = areaMargin
|
|
94
|
+
? parseMargin(areaMargin)
|
|
95
|
+
: [0, 0, 0, 0];
|
|
96
|
+
const hasZoom = Boolean(zoom);
|
|
97
|
+
const hasAreaMargin = parsedAreaMargin.some(Boolean);
|
|
98
|
+
const containerSize = [
|
|
99
|
+
this.mapRef?.clientWidth ?? 0,
|
|
100
|
+
this.mapRef?.clientHeight ?? 0,
|
|
101
|
+
];
|
|
102
|
+
switch (true) {
|
|
103
|
+
case hasAreaMargin && hasZoom:
|
|
104
|
+
// calculate center and zoom in accordace with current zoom and margin
|
|
105
|
+
newMapParams = calculateMapParamsWithMarginAndZoom([leftTop, rightBottom], zoom, parsedAreaMargin, containerSize);
|
|
106
|
+
break;
|
|
107
|
+
case hasAreaMargin:
|
|
108
|
+
// calculate center and zoom with custom margin
|
|
109
|
+
newMapParams = utils.getCenterAndZoom([leftTop, rightBottom], containerSize, undefined, { margin: areaMargin, preciseZoom: true });
|
|
110
|
+
break;
|
|
111
|
+
case hasZoom:
|
|
112
|
+
// calculate only center
|
|
113
|
+
newMapParams.center = utils.getCenter([leftTop, rightBottom]);
|
|
114
|
+
break;
|
|
115
|
+
default:
|
|
116
|
+
// calculate center and zoom with default margin
|
|
117
|
+
newMapParams = utils.getCenterAndZoom([leftTop, rightBottom], containerSize, undefined, { margin: DEFAULT_MAP_CONTROL_BUTTON_HEIGHT });
|
|
100
118
|
}
|
|
101
119
|
this.ymap.setCenter(newMapParams.center);
|
|
102
120
|
// Use default zoom for one placemark
|
|
103
|
-
if (coordsLength
|
|
104
|
-
|
|
121
|
+
if (coordsLength <= 1 && !hasAreaMargin && hasZoom) {
|
|
122
|
+
return;
|
|
105
123
|
}
|
|
124
|
+
this.ymap.setZoom(newMapParams.zoom);
|
|
106
125
|
}
|
|
107
126
|
clearOldPlacemarks() {
|
|
108
127
|
if (this.coords.length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YMap.js","sourceRoot":"../../../../../src","sources":["components/Map/YMap/YMap.ts"],"names":[],"mappings":"AAGA,IAAK,cAGJ;AAHD,WAAK,cAAc;IACf,2CAAyB,CAAA;IACzB,qCAAmB,CAAA;AACvB,CAAC,EAHI,cAAc,KAAd,cAAc,QAGlB;AAED,MAAM,wBAAwB,GAAG,SAAS,CAAC;AAC3C,mGAAmG;AACnG,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AACpD,MAAM,iCAAiC,GAAG,EAAE,CAAC;AAE7C,MAAM,wBAAwB,GAAyD;IACnF,MAAM,EAAE,cAAc,CAAC,OAAO;IAC9B,WAAW,EAAE,cAAc,CAAC,UAAU;IACtC,WAAW,EAAE,cAAc,CAAC,UAAU;IACtC,SAAS,EAAE,cAAc,CAAC,OAAO;IACjC,aAAa,EAAE,cAAc,CAAC,OAAO;IACrC,aAAa,EAAE,cAAc,CAAC,OAAO;IACrC,eAAe,EAAE,cAAc,CAAC,OAAO;IACvC,iBAAiB,EAAE,cAAc,CAAC,OAAO;IACzC,UAAU,EAAE,cAAc,CAAC,OAAO;IAClC,SAAS,EAAE,cAAc,CAAC,OAAO;IACjC,kBAAkB,EAAE,cAAc,CAAC,OAAO;IAC1C,MAAM,EAAE,cAAc,CAAC,OAAO;CACjC,CAAC;AAIF,MAAM,OAAO,IAAI;IACL,IAAI,CAAY;IAChB,MAAM,CAAwB;IAC9B,MAAM,GAAiB,EAAE,CAAC;IAElC,YAAY,IAAe,EAAE,MAA6B;QACtD,IAAI,CAAC,I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AAI,CAAC,IAAI,EAAE,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACzC,CAAC;IACL,CAAC;IAEO,kBAAkB;QACtB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACrB,CAAC;CACJ","sourcesContent":["import {YMapMarkerLabelPrivate, YMapMarkerPrivate, YMapProps} from '../../../models';\nimport {Coordinate} from '../../../models/constructor-items/common';\n\nenum GeoObjectTypes {\n Properties = 'properties',\n Options = 'options',\n}\n\nconst DEFAULT_PLACEMARKS_COLOR = '#dc534b';\n// presetStorage: https://yandex.com/dev/maps/jsapi/doc/2.1/ref/reference/option.presetStorage.html\nconst DEFAULT_PLACEMARKS_PRESET = 'islands#dotIcon';\nconst DEFAULT_MAP_CONTROL_BUTTON_HEIGHT = 30;\n\nconst geoObjectPropsAndOptions: Record<keyof YMapMarkerLabelPrivate, GeoObjectTypes> = {\n cursor: GeoObjectTypes.Options,\n iconCaption: GeoObjectTypes.Properties,\n iconContent: GeoObjectTypes.Properties,\n iconColor: GeoObjectTypes.Options,\n iconImageHref: GeoObjectTypes.Options,\n iconImageSize: GeoObjectTypes.Options,\n iconImageOffset: GeoObjectTypes.Options,\n iconImageClipRect: GeoObjectTypes.Options,\n iconLayout: GeoObjectTypes.Options,\n iconShape: GeoObjectTypes.Options,\n interactivityModel: GeoObjectTypes.Options,\n preset: GeoObjectTypes.Options,\n};\n\ntype PlacemarksProps = Pick<YMapProps, 'zoom' | 'markers'>;\n\nexport class YMap {\n private ymap: Ymaps.Map;\n private mapRef: HTMLDivElement | null;\n private coords: Coordinate[] = [];\n\n constructor(ymap: Ymaps.Map, mapRef: HTMLDivElement | null) {\n this.ymap = ymap;\n this.mapRef = mapRef;\n }\n\n async showPlacemarks(props: PlacemarksProps) {\n this.clearOldPlacemarks();\n\n for (const marker of props.markers) {\n if (marker.address) {\n await this.findAddress(marker);\n } else if (marker.coordinate) {\n this.findCoordinate(marker);\n }\n }\n\n this.recalcZoomAndCenter(props);\n }\n\n async findAddress(marker: YMapMarkerPrivate) {\n try {\n const res = await window.ymaps.geocode(marker.address, {results: 1});\n const geoObject = res.geoObjects.get(0);\n const coordinate = geoObject.geometry.getCoordinates();\n\n this.coords.push(coordinate);\n\n this.drawPlaceMarkStyle(geoObject, marker);\n\n this.ymap.geoObjects.add(geoObject);\n } catch {} // If error - placemark will not be displayed\n }\n\n findCoordinate(marker: YMapMarkerPrivate) {\n const geoObject = new window.ymaps.Placemark(marker.coordinate, {});\n\n this.coords.push(marker.coordinate as Coordinate);\n this.drawPlaceMarkStyle(geoObject, marker);\n this.ymap.geoObjects.add(geoObject);\n }\n\n private drawPlaceMarkStyle(geoObject: Ymaps.GeoObject, marker: YMapMarkerPrivate) {\n const {iconColor, preset = DEFAULT_PLACEMARKS_PRESET} = marker.label || {};\n let localIconColor: string | undefined = iconColor;\n\n // You can set the preset option together with the iconColor option only if it not a 'Stretchy' preset\n if (!preset.includes('Stretchy') && !iconColor) {\n localIconColor = DEFAULT_PLACEMARKS_COLOR;\n }\n\n Object.entries({\n ...marker.label,\n iconColor: localIconColor,\n preset,\n }).forEach(([key, value]) => {\n const geoObjectParamType: GeoObjectTypes | undefined =\n geoObjectPropsAndOptions[key as keyof YMapMarkerLabelPrivate];\n\n if (value && geoObjectParamType) {\n geoObject[geoObjectParamType].set(key, value);\n }\n });\n }\n\n private recalcZoomAndCenter(props: PlacemarksProps) {\n const coordsLength = this.coords.length;\n const {zoom = 0} = props;\n\n if (!coordsLength) {\n return;\n }\n\n let leftBottom = [Infinity, Infinity],\n rightTop = [-Infinity, -Infinity];\n\n this.coords.forEach((point) => {\n leftBottom = [Math.min(leftBottom[0], point[0]), Math.min(leftBottom[1], point[1])];\n rightTop = [Math.max(rightTop[0], point[0]), Math.max(rightTop[1], point[1])];\n });\n\n let newMapParams = {\n zoom,\n center: [],\n };\n\n if (zoom) {\n // compute only the center\n newMapParams.center = window.ymaps.util.bounds.getCenter([leftBottom, rightTop]);\n } else {\n newMapParams = window.ymaps.util.bounds.getCenterAndZoom(\n [leftBottom, rightTop],\n [this.mapRef?.clientWidth, this.mapRef?.clientHeight],\n undefined,\n {margin: DEFAULT_MAP_CONTROL_BUTTON_HEIGHT},\n );\n }\n\n this.ymap.setCenter(newMapParams.center);\n\n // Use default zoom for one placemark\n if (coordsLength > 1 && !zoom) {\n this.ymap.setZoom(newMapParams.zoom);\n }\n }\n\n private clearOldPlacemarks() {\n if (this.coords.length === 0) {\n return;\n }\n\n this.ymap.geoObjects.removeAll();\n this.coords = [];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"YMap.js","sourceRoot":"../../../../../src","sources":["components/Map/YMap/YMap.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,mCAAmC,EAAE,WAAW,EAAC,mBAAgB;AAEvF,IAAK,cAGJ;AAHD,WAAK,cAAc;IACf,2CAAyB,CAAA;IACzB,qCAAmB,CAAA;AACvB,CAAC,EAHI,cAAc,KAAd,cAAc,QAGlB;AAED,MAAM,wBAAwB,GAAG,SAAS,CAAC;AAC3C,mGAAmG;AACnG,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AACpD,MAAM,iCAAiC,GAAG,EAAE,CAAC;AAE7C,MAAM,wBAAwB,GAAyD;IACnF,MAAM,EAAE,cAAc,CAAC,OAAO;IAC9B,WAAW,EAAE,cAAc,CAAC,UAAU;IACtC,WAAW,EAAE,cAAc,CAAC,UAAU;IACtC,SAAS,EAAE,cAAc,CAAC,OAAO;IACjC,aAAa,EAAE,cAAc,CAAC,OAAO;IACrC,aAAa,EAAE,cAAc,CAAC,OAAO;IACrC,eAAe,EAAE,cAAc,CAAC,OAAO;IACvC,iBAAiB,EAAE,cAAc,CAAC,O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C,EACtB,aAAa,EACb,SAAS,EACT,EAAC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAC,CAC1C,CAAC;gBACF,MAAM;YACV,KAAK,OAAO;gBACR,wBAAwB;gBACxB,YAAY,CAAC,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;gBAC9D,MAAM;YACV;gBACI,gDAAgD;gBAChD,YAAY,GAAG,KAAK,CAAC,gBAAgB,CACjC,CAAC,OAAO,EAAE,WAAW,CAAC,EACtB,aAAa,EACb,SAAS,EACT,EAAC,MAAM,EAAE,iCAAiC,EAAC,CAC9C,CAAC;QACV,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAEzC,qCAAqC;QACrC,IAAI,YAAY,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,OAAO,EAAE,CAAC;YACjD,OAAO;QACX,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAEO,kBAAkB;QACtB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACrB,CAAC;CACJ","sourcesContent":["import {YMapMarkerLabelPrivate, YMapMarkerPrivate, YMapProps} from '../../../models';\nimport {Coordinate} from '../../../models/constructor-items/common';\n\nimport {ParsedMargin, calculateMapParamsWithMarginAndZoom, parseMargin} from './utils';\n\nenum GeoObjectTypes {\n Properties = 'properties',\n Options = 'options',\n}\n\nconst DEFAULT_PLACEMARKS_COLOR = '#dc534b';\n// presetStorage: https://yandex.com/dev/maps/jsapi/doc/2.1/ref/reference/option.presetStorage.html\nconst DEFAULT_PLACEMARKS_PRESET = 'islands#dotIcon';\nconst DEFAULT_MAP_CONTROL_BUTTON_HEIGHT = 30;\n\nconst geoObjectPropsAndOptions: Record<keyof YMapMarkerLabelPrivate, GeoObjectTypes> = {\n cursor: GeoObjectTypes.Options,\n iconCaption: GeoObjectTypes.Properties,\n iconContent: GeoObjectTypes.Properties,\n iconColor: GeoObjectTypes.Options,\n iconImageHref: GeoObjectTypes.Options,\n iconImageSize: GeoObjectTypes.Options,\n iconImageOffset: GeoObjectTypes.Options,\n iconImageClipRect: GeoObjectTypes.Options,\n iconLayout: GeoObjectTypes.Options,\n iconShape: GeoObjectTypes.Options,\n interactivityModel: GeoObjectTypes.Options,\n preset: GeoObjectTypes.Options,\n};\n\ntype PlacemarksProps = Pick<YMapProps, 'zoom' | 'markers' | 'areaMargin'>;\n\nexport class YMap {\n private ymap: Ymaps.Map;\n private mapRef: HTMLDivElement | null;\n private coords: Coordinate[] = [];\n\n constructor(ymap: Ymaps.Map, mapRef: HTMLDivElement | null) {\n this.ymap = ymap;\n this.mapRef = mapRef;\n }\n\n async showPlacemarks(props: PlacemarksProps) {\n this.clearOldPlacemarks();\n\n for (const marker of props.markers) {\n if (marker.address) {\n await this.findAddress(marker);\n } else if (marker.coordinate) {\n this.findCoordinate(marker);\n }\n }\n\n this.recalcZoomAndCenter(props);\n }\n\n async findAddress(marker: YMapMarkerPrivate) {\n try {\n const res = await window.ymaps.geocode(marker.address, {results: 1});\n const geoObject = res.geoObjects.get(0);\n const coordinate = geoObject.geometry.getCoordinates();\n\n this.coords.push(coordinate);\n\n this.drawPlaceMarkStyle(geoObject, marker);\n\n this.ymap.geoObjects.add(geoObject);\n } catch {} // If error - placemark will not be displayed\n }\n\n findCoordinate(marker: YMapMarkerPrivate) {\n const geoObject = new window.ymaps.Placemark(marker.coordinate, {});\n\n this.coords.push(marker.coordinate as Coordinate);\n this.drawPlaceMarkStyle(geoObject, marker);\n this.ymap.geoObjects.add(geoObject);\n }\n\n private drawPlaceMarkStyle(geoObject: Ymaps.GeoObject, marker: YMapMarkerPrivate) {\n const {iconColor, preset = DEFAULT_PLACEMARKS_PRESET} = marker.label || {};\n let localIconColor: string | undefined = iconColor;\n\n // You can set the preset option together with the iconColor option only if it not a 'Stretchy' preset\n if (!preset.includes('Stretchy') && !iconColor) {\n localIconColor = DEFAULT_PLACEMARKS_COLOR;\n }\n\n Object.entries({\n ...marker.label,\n iconColor: localIconColor,\n preset,\n }).forEach(([key, value]) => {\n const geoObjectParamType: GeoObjectTypes | undefined =\n geoObjectPropsAndOptions[key as keyof YMapMarkerLabelPrivate];\n\n if (value && geoObjectParamType) {\n geoObject[geoObjectParamType].set(key, value);\n }\n });\n }\n\n // eslint-disable-next-line complexity\n private recalcZoomAndCenter(props: PlacemarksProps) {\n const coordsLength = this.coords.length;\n const {zoom = 0, areaMargin} = props;\n\n if (!coordsLength) {\n return;\n }\n\n const utils = window.ymaps.util.bounds;\n\n const [leftTop, rightBottom] = utils.fromPoints(this.coords);\n\n let newMapParams = {\n zoom,\n center: [],\n };\n\n const parsedAreaMargin = areaMargin\n ? parseMargin(areaMargin)\n : ([0, 0, 0, 0] as ParsedMargin);\n\n const hasZoom = Boolean(zoom);\n const hasAreaMargin = parsedAreaMargin.some(Boolean);\n const containerSize = [\n this.mapRef?.clientWidth ?? 0,\n this.mapRef?.clientHeight ?? 0,\n ] as Coordinate;\n\n switch (true) {\n case hasAreaMargin && hasZoom:\n // calculate center and zoom in accordace with current zoom and margin\n newMapParams = calculateMapParamsWithMarginAndZoom(\n [leftTop, rightBottom],\n zoom,\n parsedAreaMargin,\n containerSize,\n );\n break;\n case hasAreaMargin:\n // calculate center and zoom with custom margin\n newMapParams = utils.getCenterAndZoom(\n [leftTop, rightBottom],\n containerSize,\n undefined,\n {margin: areaMargin, preciseZoom: true},\n );\n break;\n case hasZoom:\n // calculate only center\n newMapParams.center = utils.getCenter([leftTop, rightBottom]);\n break;\n default:\n // calculate center and zoom with default margin\n newMapParams = utils.getCenterAndZoom(\n [leftTop, rightBottom],\n containerSize,\n undefined,\n {margin: DEFAULT_MAP_CONTROL_BUTTON_HEIGHT},\n );\n }\n\n this.ymap.setCenter(newMapParams.center);\n\n // Use default zoom for one placemark\n if (coordsLength <= 1 && !hasAreaMargin && hasZoom) {\n return;\n }\n\n this.ymap.setZoom(newMapParams.zoom);\n }\n\n private clearOldPlacemarks() {\n if (this.coords.length === 0) {\n return;\n }\n\n this.ymap.geoObjects.removeAll();\n this.coords = [];\n }\n}\n"]}
|
|
@@ -23,7 +23,7 @@ const BALLOON_DISABLING_MARKER_OPTIONS = {
|
|
|
23
23
|
interactivityModel: 'default#silent',
|
|
24
24
|
};
|
|
25
25
|
const YandexMap = (props) => {
|
|
26
|
-
const { markers, zoom, id, disableControls = false, disableBalloons = false, className, forceAspectRatio = true, } = props;
|
|
26
|
+
const { markers, zoom, id, disableControls = false, disableBalloons = false, areaMargin, copyrightPosition, className, forceAspectRatio = true, } = props;
|
|
27
27
|
const { apiKey, scriptSrc, nonce } = React.useContext(MapsContext);
|
|
28
28
|
const isMobile = React.useContext(MobileContext);
|
|
29
29
|
const { lang = 'ru' } = React.useContext(LocaleContext);
|
|
@@ -50,6 +50,7 @@ const YandexMap = (props) => {
|
|
|
50
50
|
autoFitToViewport: 'always',
|
|
51
51
|
suppressMapOpenBlock: disableControls,
|
|
52
52
|
yandexMapDisablePoiInteractivity: disableControls,
|
|
53
|
+
copyrightPosition,
|
|
53
54
|
}), ref.current));
|
|
54
55
|
});
|
|
55
56
|
setLoading(false);
|
|
@@ -64,6 +65,7 @@ const YandexMap = (props) => {
|
|
|
64
65
|
attemptsIndex,
|
|
65
66
|
setLoading,
|
|
66
67
|
disableControls,
|
|
68
|
+
copyrightPosition,
|
|
67
69
|
]);
|
|
68
70
|
React.useEffect(() => {
|
|
69
71
|
if (!forceAspectRatio) {
|
|
@@ -91,12 +93,12 @@ const YandexMap = (props) => {
|
|
|
91
93
|
label: { ...label, ...BALLOON_DISABLING_MARKER_OPTIONS },
|
|
92
94
|
}))
|
|
93
95
|
: markers;
|
|
94
|
-
await ymap.showPlacemarks({ markers: privateMarkers, zoom });
|
|
96
|
+
await ymap.showPlacemarks({ markers: privateMarkers, zoom, areaMargin });
|
|
95
97
|
setReady(true);
|
|
96
98
|
};
|
|
97
99
|
showPlacemarks();
|
|
98
100
|
}
|
|
99
|
-
}, [ymap, markers, zoom, disableBalloons]);
|
|
101
|
+
}, [ymap, markers, zoom, disableBalloons, areaMargin]);
|
|
100
102
|
if (!markers)
|
|
101
103
|
return null;
|
|
102
104
|
return (_jsx(ErrorWrapper, { isError: YMapsApiLoader.status === MapApiStatus.Error, text: i18n('map-load-error'), buttonText: i18n('map-try-again'), handler: onTryAgain, className: b('wrapper'), children: _jsxs("div", { className: b('wrapper'), children: [_jsx("div", { id: containerId, className: b({ hidden: !ready }, className), ref: ref, style: { height } }), loading ? _jsx(Spin, { size: "xl", className: b('spinner') }) : null] }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YandexMap.js","sourceRoot":"../../../../../src","sources":["components/Map/YMap/YandexMap.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AACvC,OAAO,QAAQ,2BAAwB;AAEvC,OAAO,EAAC,aAAa,EAAC,wDAAqD;AAC3E,OAAO,EAAC,WAAW,EAAC,oDAAiD;AACrE,OAAO,EAAC,aAAa,EAAC,gDAAuC;AAE7D,OAAO,EAAC,KAAK,EAAC,gCAAuB;AACrC,OAAO,YAAY,2CAAwC;AAC3D,OAAO,EAAC,YAAY,EAAC,sBAAmB;AAExC,OAAO,EAAC,IAAI,EAAC,kBAAe;AAC5B,OAAO,EAAC,YAAY,EAAE,cAAc,EAAC,gCAA6B;AAClE,OAAO,EAAC,IAAI,EAAC,wBAAe;AAE5B,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;AACvB,MAAM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AAO;QAAE,OAAO,IAAI,CAAC;IAE1B,OAAO,CACH,KAAC,YAAY,IACT,OAAO,EAAE,cAAc,CAAC,MAAM,KAAK,YAAY,CAAC,KAAK,EACrD,IAAI,EAAE,IAAI,CAAC,gBAAgB,CAAC,EAC5B,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,EACjC,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,YAEvB,eAAK,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,aAExB,cACI,EAAE,EAAE,WAAW,EACf,SAAS,EAAE,CAAC,CAAC,EAAC,MAAM,EAAE,CAAC,KAAK,EAAC,EAAE,SAAS,CAAC,EACzC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,EAAC,MAAM,EAAC,GACjB,EACD,OAAO,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAC,IAAI,EAAC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,GAAI,CAAC,CAAC,CAAC,IAAI,IAC3D,GACK,CAClB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {Spin} from '@gravity-ui/uikit';\nimport debounce from 'lodash/debounce';\n\nimport {LocaleContext} from '../../../context/localeContext/localeContext';\nimport {MapsContext} from '../../../context/mapsContext/mapsContext';\nimport {MobileContext} from '../../../context/mobileContext';\nimport {YMapMarkerLabelPrivate, YMapMarkerPrivate, YMapProps} from '../../../models';\nimport {block} from '../../../utils';\nimport ErrorWrapper from '../../ErrorWrapper/ErrorWrapper';\nimport {getMapHeight} from '../helpers';\n\nimport {YMap} from './YMap';\nimport {MapApiStatus, YMapsApiLoader} from './YandexMapApiLoader';\nimport {i18n} from './i18n';\n\nconst b = block('map');\nconst DEFAULT_CONTAINER_ID = 'ymap';\nconst DEFAULT_ZOOM = 9;\n// Center - is a required parameter for creating a new map\n// We use this init center to create a map\n// The real center of the map will be calculated later, using the coordinates of the markers\nconst INITIAL_CENTER = [0, 0];\n\nconst BALLOON_DISABLING_MARKER_OPTIONS: YMapMarkerLabelPrivate = {\n cursor: 'drag',\n interactivityModel: 'default#silent',\n};\n\nconst YandexMap = (props: YMapProps) => {\n const {\n markers,\n zoom,\n id,\n disableControls = false,\n disableBalloons = false,\n className,\n forceAspectRatio = true,\n } = props;\n const {apiKey, scriptSrc, nonce} = React.useContext(MapsContext);\n const isMobile = React.useContext(MobileContext);\n\n const {lang = 'ru'} = React.useContext(LocaleContext);\n const containerId = `${DEFAULT_CONTAINER_ID}-${id}`;\n\n const [ymap, setYmaps] = React.useState<YMap | null>(null);\n const [height, setHeight] = React.useState<number | undefined>(undefined);\n const ref = React.useRef<HTMLDivElement>(null);\n\n const [loading, setLoading] = React.useState<boolean>(false);\n const [ready, setReady] = React.useState<boolean>(false);\n const [attemptsIndex, setAttemptsIndex] = React.useState<number>(0);\n const onTryAgain = React.useCallback(() => {\n setAttemptsIndex(attemptsIndex + 1);\n }, [attemptsIndex]);\n\n React.useEffect(() => {\n (async function () {\n setLoading(true);\n\n await YMapsApiLoader.loadApi(apiKey, scriptSrc, lang, nonce);\n\n window.ymaps?.ready(() => {\n setYmaps(\n new YMap(\n new window.ymaps.Map(\n containerId,\n {\n center: INITIAL_CENTER,\n zoom: zoom || DEFAULT_ZOOM,\n controls: disableControls ? [] : undefined,\n },\n {\n autoFitToViewport: 'always',\n suppressMapOpenBlock: disableControls,\n yandexMapDisablePoiInteractivity: disableControls,\n },\n ),\n ref.current,\n ),\n );\n });\n\n setLoading(false);\n })();\n }, [\n apiKey,\n lang,\n scriptSrc,\n containerId,\n zoom,\n nonce,\n attemptsIndex,\n setLoading,\n disableControls,\n ]);\n\n React.useEffect(() => {\n if (!forceAspectRatio) {\n return;\n }\n\n const updateSize = debounce(() => {\n if (ref.current) {\n setHeight(Math.round(getMapHeight(ref.current.offsetWidth, isMobile)));\n }\n }, 100);\n\n updateSize();\n window.addEventListener('resize', updateSize, {passive: true});\n\n // eslint-disable-next-line consistent-return\n return () => {\n window.removeEventListener('resize', updateSize);\n };\n }, [isMobile, forceAspectRatio]);\n\n React.useEffect(() => {\n if (ymap) {\n // show with computed center and placemarks\n const showPlacemarks = async () => {\n const privateMarkers: YMapMarkerPrivate[] = disableBalloons\n ? markers.map(({label, ...marker}) => ({\n ...marker,\n label: {...label, ...BALLOON_DISABLING_MARKER_OPTIONS},\n }))\n : markers;\n\n await ymap.showPlacemarks({markers: privateMarkers, zoom});\n\n setReady(true);\n };\n\n showPlacemarks();\n }\n }, [ymap, markers, zoom, disableBalloons]);\n\n if (!markers) return null;\n\n return (\n <ErrorWrapper\n isError={YMapsApiLoader.status === MapApiStatus.Error}\n text={i18n('map-load-error')}\n buttonText={i18n('map-try-again')}\n handler={onTryAgain}\n className={b('wrapper')}\n >\n <div className={b('wrapper')}>\n {/* hidden - to show the map after calculating the center */}\n <div\n id={containerId}\n className={b({hidden: !ready}, className)}\n ref={ref}\n style={{height}}\n />\n {loading ? <Spin size=\"xl\" className={b('spinner')} /> : null}\n </div>\n </ErrorWrapper>\n );\n};\n\nexport default YandexMap;\n"]}
|
|
1
|
+
{"version":3,"file":"YandexMap.js","sourceRoot":"../../../../../src","sources":["components/Map/YMap/YandexMap.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AACvC,OAAO,QAAQ,2BAAwB;AAEvC,OAAO,EAAC,aAAa,EAAC,wDAAqD;AAC3E,OAAO,EAAC,WAAW,EAAC,oDAAiD;AACrE,OAAO,EAAC,aAAa,EAAC,gDAAuC;AAE7D,OAAO,EAAC,KAAK,EAAC,gCAAuB;AACrC,OAAO,YAAY,2CAAwC;AAC3D,OAAO,EAAC,YAAY,EAAC,sBAAmB;AAExC,OAAO,EAAC,IAAI,EAAC,kBAAe;AAC5B,OAAO,EAAC,YAAY,EAAE,cAAc,EAAC,gCAA6B;AAClE,OAAO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;YACnB,CAAC,CAAC;YAEF,cAAc,EAAE,CAAC;QACrB,CAAC;IACL,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC,CAAC;IAEvD,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAE1B,OAAO,CACH,KAAC,YAAY,IACT,OAAO,EAAE,cAAc,CAAC,MAAM,KAAK,YAAY,CAAC,KAAK,EACrD,IAAI,EAAE,IAAI,CAAC,gBAAgB,CAAC,EAC5B,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,EACjC,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,YAEvB,eAAK,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,aAExB,cACI,EAAE,EAAE,WAAW,EACf,SAAS,EAAE,CAAC,CAAC,EAAC,MAAM,EAAE,CAAC,KAAK,EAAC,EAAE,SAAS,CAAC,EACzC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,EAAC,MAAM,EAAC,GACjB,EACD,OAAO,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAC,IAAI,EAAC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,GAAI,CAAC,CAAC,CAAC,IAAI,IAC3D,GACK,CAClB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {Spin} from '@gravity-ui/uikit';\nimport debounce from 'lodash/debounce';\n\nimport {LocaleContext} from '../../../context/localeContext/localeContext';\nimport {MapsContext} from '../../../context/mapsContext/mapsContext';\nimport {MobileContext} from '../../../context/mobileContext';\nimport {YMapMarkerLabelPrivate, YMapMarkerPrivate, YMapProps} from '../../../models';\nimport {block} from '../../../utils';\nimport ErrorWrapper from '../../ErrorWrapper/ErrorWrapper';\nimport {getMapHeight} from '../helpers';\n\nimport {YMap} from './YMap';\nimport {MapApiStatus, YMapsApiLoader} from './YandexMapApiLoader';\nimport {i18n} from './i18n';\n\nconst b = block('map');\nconst DEFAULT_CONTAINER_ID = 'ymap';\nconst DEFAULT_ZOOM = 9;\n// Center - is a required parameter for creating a new map\n// We use this init center to create a map\n// The real center of the map will be calculated later, using the coordinates of the markers\nconst INITIAL_CENTER = [0, 0];\n\nconst BALLOON_DISABLING_MARKER_OPTIONS: YMapMarkerLabelPrivate = {\n cursor: 'drag',\n interactivityModel: 'default#silent',\n};\n\nconst YandexMap = (props: YMapProps) => {\n const {\n markers,\n zoom,\n id,\n disableControls = false,\n disableBalloons = false,\n areaMargin,\n copyrightPosition,\n className,\n forceAspectRatio = true,\n } = props;\n const {apiKey, scriptSrc, nonce} = React.useContext(MapsContext);\n const isMobile = React.useContext(MobileContext);\n\n const {lang = 'ru'} = React.useContext(LocaleContext);\n const containerId = `${DEFAULT_CONTAINER_ID}-${id}`;\n\n const [ymap, setYmaps] = React.useState<YMap | null>(null);\n const [height, setHeight] = React.useState<number | undefined>(undefined);\n const ref = React.useRef<HTMLDivElement>(null);\n\n const [loading, setLoading] = React.useState<boolean>(false);\n const [ready, setReady] = React.useState<boolean>(false);\n const [attemptsIndex, setAttemptsIndex] = React.useState<number>(0);\n const onTryAgain = React.useCallback(() => {\n setAttemptsIndex(attemptsIndex + 1);\n }, [attemptsIndex]);\n\n React.useEffect(() => {\n (async function () {\n setLoading(true);\n\n await YMapsApiLoader.loadApi(apiKey, scriptSrc, lang, nonce);\n\n window.ymaps?.ready(() => {\n setYmaps(\n new YMap(\n new window.ymaps.Map(\n containerId,\n {\n center: INITIAL_CENTER,\n zoom: zoom || DEFAULT_ZOOM,\n controls: disableControls ? [] : undefined,\n },\n {\n autoFitToViewport: 'always',\n suppressMapOpenBlock: disableControls,\n yandexMapDisablePoiInteractivity: disableControls,\n copyrightPosition,\n },\n ),\n ref.current,\n ),\n );\n });\n\n setLoading(false);\n })();\n }, [\n apiKey,\n lang,\n scriptSrc,\n containerId,\n zoom,\n nonce,\n attemptsIndex,\n setLoading,\n disableControls,\n copyrightPosition,\n ]);\n\n React.useEffect(() => {\n if (!forceAspectRatio) {\n return;\n }\n\n const updateSize = debounce(() => {\n if (ref.current) {\n setHeight(Math.round(getMapHeight(ref.current.offsetWidth, isMobile)));\n }\n }, 100);\n\n updateSize();\n window.addEventListener('resize', updateSize, {passive: true});\n\n // eslint-disable-next-line consistent-return\n return () => {\n window.removeEventListener('resize', updateSize);\n };\n }, [isMobile, forceAspectRatio]);\n\n React.useEffect(() => {\n if (ymap) {\n // show with computed center and placemarks\n const showPlacemarks = async () => {\n const privateMarkers: YMapMarkerPrivate[] = disableBalloons\n ? markers.map(({label, ...marker}) => ({\n ...marker,\n label: {...label, ...BALLOON_DISABLING_MARKER_OPTIONS},\n }))\n : markers;\n\n await ymap.showPlacemarks({markers: privateMarkers, zoom, areaMargin});\n\n setReady(true);\n };\n\n showPlacemarks();\n }\n }, [ymap, markers, zoom, disableBalloons, areaMargin]);\n\n if (!markers) return null;\n\n return (\n <ErrorWrapper\n isError={YMapsApiLoader.status === MapApiStatus.Error}\n text={i18n('map-load-error')}\n buttonText={i18n('map-try-again')}\n handler={onTryAgain}\n className={b('wrapper')}\n >\n <div className={b('wrapper')}>\n {/* hidden - to show the map after calculating the center */}\n <div\n id={containerId}\n className={b({hidden: !ready}, className)}\n ref={ref}\n style={{height}}\n />\n {loading ? <Spin size=\"xl\" className={b('spinner')} /> : null}\n </div>\n </ErrorWrapper>\n );\n};\n\nexport default YandexMap;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Coordinate, YMapMargin } from "../../../models/index.js";
|
|
2
|
+
export type ParsedMargin = [top: number, right: number, bottom: number, left: number];
|
|
3
|
+
export declare const parseMargin: (margin: YMapMargin) => ParsedMargin;
|
|
4
|
+
export declare const calcPixelBounds: ([leftTop, rightBottom]: [Coordinate, Coordinate], zoom: number, containerSize: Coordinate) => number[][];
|
|
5
|
+
export declare const calculateMapParamsWithMarginAndZoom: ([leftTop, rightBottom]: [Coordinate, Coordinate], zoom: number, areaMargin: ParsedMargin, containerSize: Coordinate) => {
|
|
6
|
+
center: any;
|
|
7
|
+
zoom: number;
|
|
8
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export const parseMargin = (margin) => {
|
|
2
|
+
if (!Array.isArray(margin)) {
|
|
3
|
+
return [margin, margin, margin, margin];
|
|
4
|
+
}
|
|
5
|
+
if (margin.length === 2) {
|
|
6
|
+
return [margin[0], margin[1], margin[0], margin[1]];
|
|
7
|
+
}
|
|
8
|
+
return margin;
|
|
9
|
+
};
|
|
10
|
+
export const calcPixelBounds = ([leftTop, rightBottom], zoom, containerSize) => {
|
|
11
|
+
const utils = window.ymaps.util.bounds;
|
|
12
|
+
let [[leftPx, topPx], [rightPx, bottomPx]] = utils.toGlobalPixelBounds([leftTop, rightBottom], zoom);
|
|
13
|
+
// fall back to container size in case there is only one marker and area is 0
|
|
14
|
+
if (rightPx - leftPx <= 0) {
|
|
15
|
+
const halfX = containerSize[0] / 2;
|
|
16
|
+
leftPx -= halfX;
|
|
17
|
+
rightPx += halfX;
|
|
18
|
+
}
|
|
19
|
+
if (bottomPx - topPx <= 0) {
|
|
20
|
+
const halfY = containerSize[1] / 2;
|
|
21
|
+
topPx -= halfY;
|
|
22
|
+
bottomPx += halfY;
|
|
23
|
+
}
|
|
24
|
+
return [
|
|
25
|
+
[leftPx, topPx],
|
|
26
|
+
[rightPx, bottomPx],
|
|
27
|
+
];
|
|
28
|
+
};
|
|
29
|
+
const calcNewZoom = (l, zoom, marginSum) => {
|
|
30
|
+
return Math.log2((Math.pow(2, zoom) * (l - marginSum)) / l);
|
|
31
|
+
};
|
|
32
|
+
export const calculateMapParamsWithMarginAndZoom = ([leftTop, rightBottom], zoom, areaMargin, containerSize) => {
|
|
33
|
+
const utils = window.ymaps.util.bounds;
|
|
34
|
+
// calculate pixel bounds with current zoom
|
|
35
|
+
let [[leftPx, topPx], [rightPx, bottomPx]] = calcPixelBounds([leftTop, rightBottom], zoom, containerSize);
|
|
36
|
+
const [topMargin, rightMargin, bottomMargin, leftMargin] = areaMargin;
|
|
37
|
+
let zoomV;
|
|
38
|
+
let zoomH;
|
|
39
|
+
// calculate new zoom value after margins are applied
|
|
40
|
+
if (leftMargin && rightMargin) {
|
|
41
|
+
zoomH = calcNewZoom(rightPx - leftPx, zoom, leftMargin + rightMargin);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
zoomH = zoom;
|
|
45
|
+
}
|
|
46
|
+
if (topMargin && bottomMargin) {
|
|
47
|
+
zoomV = calcNewZoom(bottomPx - topPx, zoom, topMargin + bottomMargin);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
zoomV = zoom;
|
|
51
|
+
}
|
|
52
|
+
const newZoom = Math.min(zoomV, zoomH);
|
|
53
|
+
// calculate pixel bounds with new zoom
|
|
54
|
+
[[leftPx, topPx], [rightPx, bottomPx]] = calcPixelBounds([leftTop, rightBottom], newZoom, containerSize);
|
|
55
|
+
// calculate new bounds (scale if both size are present, otherwise shift the map)
|
|
56
|
+
if (leftMargin && rightMargin) {
|
|
57
|
+
leftPx -= leftMargin;
|
|
58
|
+
rightPx += rightMargin;
|
|
59
|
+
}
|
|
60
|
+
else if (leftMargin) {
|
|
61
|
+
leftPx -= leftMargin;
|
|
62
|
+
rightPx -= leftMargin;
|
|
63
|
+
}
|
|
64
|
+
else if (rightMargin) {
|
|
65
|
+
leftPx += rightMargin;
|
|
66
|
+
rightPx += rightMargin;
|
|
67
|
+
}
|
|
68
|
+
if (topMargin && bottomMargin) {
|
|
69
|
+
topPx -= topMargin;
|
|
70
|
+
bottomPx += bottomMargin;
|
|
71
|
+
}
|
|
72
|
+
else if (topMargin) {
|
|
73
|
+
topPx -= topMargin;
|
|
74
|
+
bottomPx -= topMargin;
|
|
75
|
+
}
|
|
76
|
+
else if (bottomMargin) {
|
|
77
|
+
topPx += bottomMargin;
|
|
78
|
+
bottomPx += bottomMargin;
|
|
79
|
+
}
|
|
80
|
+
// transform new bounds into coordinates
|
|
81
|
+
const [newLeftTop, newRightBottom] = utils.fromGlobalPixelBounds([
|
|
82
|
+
[leftPx, topPx],
|
|
83
|
+
[rightPx, bottomPx],
|
|
84
|
+
], newZoom);
|
|
85
|
+
return {
|
|
86
|
+
center: utils.getCenter([newLeftTop, newRightBottom]),
|
|
87
|
+
zoom: newZoom,
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"../../../../../src","sources":["components/Map/YMap/utils.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAkB,EAAgB,EAAE;IAC5D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAC3B,CAAC,OAAO,EAAE,WAAW,CAA2B,EAChD,IAAY,EACZ,aAAyB,EAC3B,EAAE;IACA,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;IAEvC,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,GAAG,KAAK,CAAC,mBAAmB,CAClE,CAAC,OAAO,EAAE,WAAW,CAAC,EACtB,IAAI,CACqB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AAC;QACnB,KAAK,IAAI,SAAS,CAAC;QACnB,QAAQ,IAAI,SAAS,CAAC;IAC1B,CAAC;SAAM,IAAI,YAAY,EAAE,CAAC;QACtB,KAAK,IAAI,YAAY,CAAC;QACtB,QAAQ,IAAI,YAAY,CAAC;IAC7B,CAAC;IAED,wCAAwC;IACxC,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,qBAAqB,CAC5D;QACI,CAAC,MAAM,EAAE,KAAK,CAAC;QACf,CAAC,OAAO,EAAE,QAAQ,CAAC;KACtB,EACD,OAAO,CACV,CAAC;IAEF,OAAO;QACH,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QACrD,IAAI,EAAE,OAAO;KAChB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import {Coordinate, YMapMargin} from '../../../models';\n\nexport type ParsedMargin = [top: number, right: number, bottom: number, left: number];\n\nexport const parseMargin = (margin: YMapMargin): ParsedMargin => {\n if (!Array.isArray(margin)) {\n return [margin, margin, margin, margin];\n }\n\n if (margin.length === 2) {\n return [margin[0], margin[1], margin[0], margin[1]];\n }\n\n return margin;\n};\n\nexport const calcPixelBounds = (\n [leftTop, rightBottom]: [Coordinate, Coordinate],\n zoom: number,\n containerSize: Coordinate,\n) => {\n const utils = window.ymaps.util.bounds;\n\n let [[leftPx, topPx], [rightPx, bottomPx]] = utils.toGlobalPixelBounds(\n [leftTop, rightBottom],\n zoom,\n ) as [Coordinate, Coordinate];\n\n // fall back to container size in case there is only one marker and area is 0\n if (rightPx - leftPx <= 0) {\n const halfX = containerSize[0] / 2;\n leftPx -= halfX;\n rightPx += halfX;\n }\n\n if (bottomPx - topPx <= 0) {\n const halfY = containerSize[1] / 2;\n topPx -= halfY;\n bottomPx += halfY;\n }\n\n return [\n [leftPx, topPx],\n [rightPx, bottomPx],\n ];\n};\n\nconst calcNewZoom = (l: number, zoom: number, marginSum: number) => {\n return Math.log2((Math.pow(2, zoom) * (l - marginSum)) / l);\n};\n\nexport const calculateMapParamsWithMarginAndZoom = (\n [leftTop, rightBottom]: [Coordinate, Coordinate],\n zoom: number,\n areaMargin: ParsedMargin,\n containerSize: Coordinate,\n) => {\n const utils = window.ymaps.util.bounds;\n\n // calculate pixel bounds with current zoom\n let [[leftPx, topPx], [rightPx, bottomPx]] = calcPixelBounds(\n [leftTop, rightBottom],\n zoom,\n containerSize,\n );\n\n const [topMargin, rightMargin, bottomMargin, leftMargin] = areaMargin;\n\n let zoomV: number;\n let zoomH: number;\n\n // calculate new zoom value after margins are applied\n if (leftMargin && rightMargin) {\n zoomH = calcNewZoom(rightPx - leftPx, zoom, leftMargin + rightMargin);\n } else {\n zoomH = zoom;\n }\n\n if (topMargin && bottomMargin) {\n zoomV = calcNewZoom(bottomPx - topPx, zoom, topMargin + bottomMargin);\n } else {\n zoomV = zoom;\n }\n\n const newZoom = Math.min(zoomV, zoomH);\n\n // calculate pixel bounds with new zoom\n [[leftPx, topPx], [rightPx, bottomPx]] = calcPixelBounds(\n [leftTop, rightBottom],\n newZoom,\n containerSize,\n );\n\n // calculate new bounds (scale if both size are present, otherwise shift the map)\n if (leftMargin && rightMargin) {\n leftPx -= leftMargin;\n rightPx += rightMargin;\n } else if (leftMargin) {\n leftPx -= leftMargin;\n rightPx -= leftMargin;\n } else if (rightMargin) {\n leftPx += rightMargin;\n rightPx += rightMargin;\n }\n\n if (topMargin && bottomMargin) {\n topPx -= topMargin;\n bottomPx += bottomMargin;\n } else if (topMargin) {\n topPx -= topMargin;\n bottomPx -= topMargin;\n } else if (bottomMargin) {\n topPx += bottomMargin;\n bottomPx += bottomMargin;\n }\n\n // transform new bounds into coordinates\n const [newLeftTop, newRightBottom] = utils.fromGlobalPixelBounds(\n [\n [leftPx, topPx],\n [rightPx, bottomPx],\n ],\n newZoom,\n );\n\n return {\n center: utils.getCenter([newLeftTop, newRightBottom]),\n zoom: newZoom,\n };\n};\n"]}
|
|
@@ -217,7 +217,7 @@ export interface MediaBlockProps extends MediaBaseBlockProps, WithBorder {
|
|
|
217
217
|
media: ThemeSupporting<MediaProps>;
|
|
218
218
|
}
|
|
219
219
|
export interface MapBlockProps extends MediaBaseBlockProps, WithBorder {
|
|
220
|
-
map: Omit<MapProps, 'forceAspectRatio'>;
|
|
220
|
+
map: Omit<MapProps, 'forceAspectRatio' | 'areaMargin' | 'copyrightPosition'>;
|
|
221
221
|
}
|
|
222
222
|
export interface InfoBlockProps {
|
|
223
223
|
theme?: TextTheme;
|