my-openlayer 1.0.5 → 1.0.6

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/core/Point.d.ts CHANGED
@@ -48,7 +48,7 @@ export default class Point {
48
48
  * @param pointData
49
49
  * @param type
50
50
  * @param options {
51
- * nameKey: String 数据中的名称的key
51
+ * textKey: String 数据中的文本的key
52
52
  * img: String 图标
53
53
  * }
54
54
  */
package/core/Point.js CHANGED
@@ -61,8 +61,8 @@ export default class Point {
61
61
  */
62
62
  createPointStyle(options, item) {
63
63
  const style = {};
64
- if (options.nameKey && item) {
65
- style.text = this.createTextStyle(options, item[options.nameKey]);
64
+ if (options.textKey && item) {
65
+ style.text = this.createTextStyle(options, item[options.textKey]);
66
66
  }
67
67
  if (options.img) {
68
68
  style.image = this.createIconStyle(options);
@@ -78,7 +78,7 @@ export default class Point {
78
78
  */
79
79
  createClusterStyle(options, name) {
80
80
  const style = {};
81
- if (options.nameKey) {
81
+ if (options.textKey) {
82
82
  style.text = this.createTextStyle(options, name);
83
83
  }
84
84
  if (options.img) {
@@ -101,7 +101,7 @@ export default class Point {
101
101
  * @param pointData
102
102
  * @param type
103
103
  * @param options {
104
- * nameKey: String 数据中的名称的key
104
+ * textKey: String 数据中的文本的key
105
105
  * img: String 图标
106
106
  * }
107
107
  */
@@ -143,7 +143,7 @@ export default class Point {
143
143
  }
144
144
  const pointFeature = new Feature({
145
145
  geometry: new olPoint([item.lgtd, item.lttd]),
146
- name: options.nameKey ? item[options.nameKey] : '',
146
+ name: options.textKey ? item[options.textKey] : '',
147
147
  });
148
148
  pointFeatureList.push(pointFeature);
149
149
  });
@@ -159,7 +159,7 @@ export default class Point {
159
159
  layerName: options.layerName,
160
160
  source: clusterSource,
161
161
  style: (feature) => {
162
- const name = feature.get('features')[0].get(options.nameKey);
162
+ const name = feature.get('features')[0].get(options.textKey);
163
163
  return this.createClusterStyle(options, name);
164
164
  },
165
165
  zIndex: options.zIndex || 21,
package/core/Polygon.js CHANGED
@@ -159,8 +159,8 @@ export default class Polygon {
159
159
  if (options.textCallBack) {
160
160
  return options.textCallBack(feature) || '';
161
161
  }
162
- if (options.nameKey) {
163
- return feature.get(options.nameKey) || '';
162
+ if (options.textKey) {
163
+ return feature.get(options.textKey) || '';
164
164
  }
165
165
  return '';
166
166
  }
@@ -217,7 +217,7 @@ export default class Polygon {
217
217
  * @param options 配置选项
218
218
  */
219
219
  updateSingleFeatureColor(feature, colorObj, options) {
220
- const name = options?.nameKey ? feature.get(options.nameKey) : '';
220
+ const name = options?.textKey ? feature.get(options.textKey) : '';
221
221
  const newColor = colorObj?.[name] || options?.fillColor;
222
222
  const featureStyle = new Style({
223
223
  stroke: new Stroke({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "my-openlayer",
3
3
  "private": false,
4
- "version": "1.0.5",
4
+ "version": "1.0.6",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "types": "index.d.ts",
package/types.d.ts CHANGED
@@ -124,8 +124,8 @@ export interface TextOptions {
124
124
  * 点位选项接口 - 点位图层专用配置
125
125
  */
126
126
  export interface PointOptions extends BaseOptions, StyleOptions, TextOptions {
127
- /** 名称字段键 */
128
- nameKey?: string;
127
+ /** 文本字段键 */
128
+ textKey?: string;
129
129
  /** 图标图片 */
130
130
  img?: string;
131
131
  /** 图标缩放比例 */
@@ -144,8 +144,8 @@ export interface LineOptions extends BaseOptions, StyleOptions, TextOptions {
144
144
  * 多边形选项接口 - 多边形图层专用配置
145
145
  */
146
146
  export interface PolygonOptions extends BaseOptions, StyleOptions, TextOptions {
147
- /** 名称字段键 */
148
- nameKey?: string;
147
+ /** 文本字段键 */
148
+ textKey?: string;
149
149
  /** 是否为蒙版 */
150
150
  mask?: boolean;
151
151
  }
@@ -154,7 +154,7 @@ export interface PolygonOptions extends BaseOptions, StyleOptions, TextOptions {
154
154
  * @deprecated 请使用具体的选项接口:PointOptions, LineOptions, PolygonOptions
155
155
  */
156
156
  export type OptionsType = BaseOptions & StyleOptions & TextOptions & {
157
- nameKey?: string;
157
+ textKey?: string;
158
158
  img?: string;
159
159
  scale?: number;
160
160
  iconColor?: string;
@@ -191,8 +191,8 @@ export interface ColorMap {
191
191
  * 要素颜色更新选项接口
192
192
  */
193
193
  export interface FeatureColorUpdateOptions extends BaseOptions, StyleOptions, TextOptions {
194
- /** 名称字段键 */
195
- nameKey?: string;
194
+ /** 文本字段键 */
195
+ textKey?: string;
196
196
  }
197
197
  /**
198
198
  * 点位数据接口