@kepler.gl/schemas 3.3.0-alpha.2 → 3.3.0-alpha.21
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/cjs/dataset-schema.js +307 -0
- package/dist/cjs/dataset-schema.js.map +1 -0
- package/dist/cjs/index.js +225 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/map-state-schema.js +46 -0
- package/dist/cjs/map-state-schema.js.map +1 -0
- package/dist/cjs/map-style-schema.js +90 -0
- package/dist/cjs/map-style-schema.js.map +1 -0
- package/dist/cjs/schema-manager.js +249 -0
- package/dist/cjs/schema-manager.js.map +1 -0
- package/dist/cjs/schema.js +111 -0
- package/dist/cjs/schema.js.map +1 -0
- package/dist/cjs/ui-state-schema.js +79 -0
- package/dist/cjs/ui-state-schema.js.map +1 -0
- package/dist/cjs/versions.js +17 -0
- package/dist/cjs/versions.js.map +1 -0
- package/dist/cjs/vis-state-schema.js +1221 -0
- package/dist/cjs/vis-state-schema.js.map +1 -0
- package/dist/esm/dataset-schema.js +300 -0
- package/dist/esm/dataset-schema.js.map +1 -0
- package/dist/esm/index.js +18 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/map-state-schema.js +42 -0
- package/dist/esm/map-state-schema.js.map +1 -0
- package/dist/esm/map-style-schema.js +87 -0
- package/dist/esm/map-style-schema.js.map +1 -0
- package/dist/esm/schema-manager.js +245 -0
- package/dist/esm/schema-manager.js.map +1 -0
- package/dist/esm/schema.js +107 -0
- package/dist/esm/schema.js.map +1 -0
- package/dist/esm/ui-state-schema.js +72 -0
- package/dist/esm/ui-state-schema.js.map +1 -0
- package/dist/esm/versions.js +10 -0
- package/dist/esm/versions.js.map +1 -0
- package/dist/esm/vis-state-schema.js +1216 -0
- package/dist/esm/vis-state-schema.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/map-state-schema.d.ts +2 -0
- package/dist/schema-manager.d.ts +36 -2
- package/dist/ui-state-schema.d.ts +1 -0
- package/dist/vis-state-schema.d.ts +76 -2
- package/package.json +25 -19
- package/dist/dataset-schema.js +0 -222
- package/dist/index.js +0 -219
- package/dist/map-state-schema.js +0 -42
- package/dist/map-style-schema.js +0 -90
- package/dist/schema-manager.js +0 -248
- package/dist/schema-utils.d.ts +0 -11
- package/dist/schema-utils.js +0 -41
- package/dist/schema.js +0 -111
- package/dist/ui-state-schema.js +0 -48
- package/dist/versions.js +0 -17
- package/dist/vis-state-schema.js +0 -1066
|
@@ -0,0 +1,1221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.visStateSchemaV1 = exports.visStateSchemaV0 = exports.visStateSchema = exports.propertiesV1 = exports.propertiesV0 = exports.layerPropsV1 = exports.layerPropsV0 = exports.filterPropsV1 = exports.filterPropsV0 = exports.effectPropsV1 = exports.dimensionPropsV0 = exports["default"] = exports.chartPropsV1 = exports.VisStateSchemaV1 = exports.SplitMapsSchema = exports.PlotTypeSchema = exports.LayerSchemaV0 = exports.InteractionSchemaV1 = exports.FilterSchemaV0 = exports.EffectsSchema = exports.DimensionFieldSchema = exports.ChartsSchema = exports.AnnotationsSchema = void 0;
|
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
16
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
+
var _pick = _interopRequireDefault(require("es-toolkit/compat/pick"));
|
|
18
|
+
var _versions = require("./versions");
|
|
19
|
+
var _constants = require("@kepler.gl/constants");
|
|
20
|
+
var _layers = require("@kepler.gl/layers");
|
|
21
|
+
var _utils = require("@kepler.gl/utils");
|
|
22
|
+
var _commonUtils = require("@kepler.gl/common-utils");
|
|
23
|
+
var _schema = _interopRequireDefault(require("./schema"));
|
|
24
|
+
var _cloneDeep = _interopRequireDefault(require("es-toolkit/compat/cloneDeep"));
|
|
25
|
+
var _excluded = ["enlarged", "view"];
|
|
26
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
27
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
28
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
29
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } // SPDX-License-Identifier: MIT
|
|
30
|
+
// Copyright contributors to the kepler.gl project
|
|
31
|
+
/**
|
|
32
|
+
* V0 Schema
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
var dimensionPropsV0 = exports.dimensionPropsV0 = ['name', 'type'];
|
|
36
|
+
// in v0 geojson there is only sizeField
|
|
37
|
+
|
|
38
|
+
// in v1 geojson
|
|
39
|
+
// stroke base on -> sizeField
|
|
40
|
+
// height based on -> heightField
|
|
41
|
+
// radius based on -> radiusField
|
|
42
|
+
// here we make our wiredst guess on which channel sizeField belongs to
|
|
43
|
+
function geojsonSizeFieldV0ToV1(config) {
|
|
44
|
+
var defaultRaiuds = 10;
|
|
45
|
+
var defaultRadiusRange = [0, 50];
|
|
46
|
+
|
|
47
|
+
// if extruded, sizeField is most likely used for height
|
|
48
|
+
if (config.visConfig.extruded) {
|
|
49
|
+
return 'heightField';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// if show stroke enabled, sizeField is most likely used for stroke
|
|
53
|
+
if (config.visConfig.stroked) {
|
|
54
|
+
return 'sizeField';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// if radius changed, or radius Range Changed, sizeField is most likely used for radius
|
|
58
|
+
// this is the most unreliable guess, that's why we put it in the end
|
|
59
|
+
if (config.visConfig.radius !== defaultRaiuds || config.visConfig.radiusRange.some(function (d, i) {
|
|
60
|
+
return d !== defaultRadiusRange[i];
|
|
61
|
+
})) {
|
|
62
|
+
return 'radiusField';
|
|
63
|
+
}
|
|
64
|
+
return 'sizeField';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// convert v0 to v1 layer config
|
|
68
|
+
var DimensionFieldSchemaV0 = /*#__PURE__*/function (_Schema) {
|
|
69
|
+
function DimensionFieldSchemaV0() {
|
|
70
|
+
var _this;
|
|
71
|
+
(0, _classCallCheck2["default"])(this, DimensionFieldSchemaV0);
|
|
72
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
73
|
+
args[_key] = arguments[_key];
|
|
74
|
+
}
|
|
75
|
+
_this = _callSuper(this, DimensionFieldSchemaV0, [].concat(args));
|
|
76
|
+
(0, _defineProperty2["default"])(_this, "version", _versions.VERSIONS.v0);
|
|
77
|
+
return _this;
|
|
78
|
+
}
|
|
79
|
+
(0, _inherits2["default"])(DimensionFieldSchemaV0, _Schema);
|
|
80
|
+
return (0, _createClass2["default"])(DimensionFieldSchemaV0, [{
|
|
81
|
+
key: "save",
|
|
82
|
+
value: function save(field) {
|
|
83
|
+
// should not be called anymore
|
|
84
|
+
return (0, _defineProperty2["default"])({}, this.key, field !== null ? this.savePropertiesOrApplySchema(field)[this.key] : null);
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
87
|
+
key: "load",
|
|
88
|
+
value: function load(field, parents, accumulated) {
|
|
89
|
+
var _parents$slice = parents.slice(-1),
|
|
90
|
+
_parents$slice2 = (0, _slicedToArray2["default"])(_parents$slice, 1),
|
|
91
|
+
config = _parents$slice2[0];
|
|
92
|
+
var fieldName = this.key;
|
|
93
|
+
if (config.type === 'geojson' && this.key === 'sizeField' && field) {
|
|
94
|
+
fieldName = geojsonSizeFieldV0ToV1(config);
|
|
95
|
+
}
|
|
96
|
+
// fold into visualChannels to be load by VisualChannelSchemaV1
|
|
97
|
+
return {
|
|
98
|
+
visualChannels: _objectSpread(_objectSpread({}, accumulated.visualChannels || {}), {}, (0, _defineProperty2["default"])({}, fieldName, field))
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}]);
|
|
102
|
+
}(_schema["default"]);
|
|
103
|
+
var DimensionScaleSchemaV0 = /*#__PURE__*/function (_Schema2) {
|
|
104
|
+
function DimensionScaleSchemaV0() {
|
|
105
|
+
var _this2;
|
|
106
|
+
(0, _classCallCheck2["default"])(this, DimensionScaleSchemaV0);
|
|
107
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
108
|
+
args[_key2] = arguments[_key2];
|
|
109
|
+
}
|
|
110
|
+
_this2 = _callSuper(this, DimensionScaleSchemaV0, [].concat(args));
|
|
111
|
+
(0, _defineProperty2["default"])(_this2, "version", _versions.VERSIONS.v0);
|
|
112
|
+
return _this2;
|
|
113
|
+
}
|
|
114
|
+
(0, _inherits2["default"])(DimensionScaleSchemaV0, _Schema2);
|
|
115
|
+
return (0, _createClass2["default"])(DimensionScaleSchemaV0, [{
|
|
116
|
+
key: "save",
|
|
117
|
+
value: function save(scale) {
|
|
118
|
+
return (0, _defineProperty2["default"])({}, this.key, scale);
|
|
119
|
+
}
|
|
120
|
+
}, {
|
|
121
|
+
key: "load",
|
|
122
|
+
value: function load(scale, parents, accumulated) {
|
|
123
|
+
var _parents$slice3 = parents.slice(-1),
|
|
124
|
+
_parents$slice4 = (0, _slicedToArray2["default"])(_parents$slice3, 1),
|
|
125
|
+
config = _parents$slice4[0];
|
|
126
|
+
// fold into visualChannels to be load by VisualChannelSchemaV1
|
|
127
|
+
if (this.key === 'sizeScale' && config.type === 'geojson') {
|
|
128
|
+
// sizeScale now split into radiusScale, heightScale
|
|
129
|
+
// no user customization, just use default
|
|
130
|
+
return {};
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
visualChannels: _objectSpread(_objectSpread({}, accumulated.visualChannels || {}), {}, (0, _defineProperty2["default"])({}, this.key, scale))
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}]);
|
|
137
|
+
}(_schema["default"]); // used to convert v0 to v1 layer config
|
|
138
|
+
var LayerConfigSchemaV0 = /*#__PURE__*/function (_Schema3) {
|
|
139
|
+
function LayerConfigSchemaV0() {
|
|
140
|
+
var _this3;
|
|
141
|
+
(0, _classCallCheck2["default"])(this, LayerConfigSchemaV0);
|
|
142
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
143
|
+
args[_key3] = arguments[_key3];
|
|
144
|
+
}
|
|
145
|
+
_this3 = _callSuper(this, LayerConfigSchemaV0, [].concat(args));
|
|
146
|
+
(0, _defineProperty2["default"])(_this3, "version", _versions.VERSIONS.v0);
|
|
147
|
+
return _this3;
|
|
148
|
+
}
|
|
149
|
+
(0, _inherits2["default"])(LayerConfigSchemaV0, _Schema3);
|
|
150
|
+
return (0, _createClass2["default"])(LayerConfigSchemaV0, [{
|
|
151
|
+
key: "load",
|
|
152
|
+
value: function load(saved, parents, accumulated) {
|
|
153
|
+
// fold v0 layer property into config.key
|
|
154
|
+
return {
|
|
155
|
+
config: _objectSpread(_objectSpread({}, accumulated.config || {}), {}, (0, _defineProperty2["default"])({}, this.key, saved))
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
}]);
|
|
159
|
+
}(_schema["default"]); // used to convert v0 to v1 layer columns
|
|
160
|
+
// only return column value for each column
|
|
161
|
+
var LayerColumnsSchemaV0 = /*#__PURE__*/function (_Schema4) {
|
|
162
|
+
function LayerColumnsSchemaV0() {
|
|
163
|
+
var _this4;
|
|
164
|
+
(0, _classCallCheck2["default"])(this, LayerColumnsSchemaV0);
|
|
165
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
166
|
+
args[_key4] = arguments[_key4];
|
|
167
|
+
}
|
|
168
|
+
_this4 = _callSuper(this, LayerColumnsSchemaV0, [].concat(args));
|
|
169
|
+
(0, _defineProperty2["default"])(_this4, "version", _versions.VERSIONS.v0);
|
|
170
|
+
return _this4;
|
|
171
|
+
}
|
|
172
|
+
(0, _inherits2["default"])(LayerColumnsSchemaV0, _Schema4);
|
|
173
|
+
return (0, _createClass2["default"])(LayerColumnsSchemaV0, [{
|
|
174
|
+
key: "load",
|
|
175
|
+
value: function load(saved, parents, accumulated) {
|
|
176
|
+
// fold v0 layer property into config.key, flatten columns
|
|
177
|
+
return {
|
|
178
|
+
config: _objectSpread(_objectSpread({}, accumulated.config || {}), {}, {
|
|
179
|
+
columns: Object.keys(saved).reduce(function (accu, key) {
|
|
180
|
+
return _objectSpread(_objectSpread({}, accu), {}, (0, _defineProperty2["default"])({}, key, saved[key].value));
|
|
181
|
+
}, {})
|
|
182
|
+
})
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
}]);
|
|
186
|
+
}(_schema["default"]); // used to convert v0 to v1 layer config.visConfig
|
|
187
|
+
var LayerConfigToVisConfigSchemaV0 = /*#__PURE__*/function (_Schema5) {
|
|
188
|
+
function LayerConfigToVisConfigSchemaV0() {
|
|
189
|
+
var _this5;
|
|
190
|
+
(0, _classCallCheck2["default"])(this, LayerConfigToVisConfigSchemaV0);
|
|
191
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
192
|
+
args[_key5] = arguments[_key5];
|
|
193
|
+
}
|
|
194
|
+
_this5 = _callSuper(this, LayerConfigToVisConfigSchemaV0, [].concat(args));
|
|
195
|
+
(0, _defineProperty2["default"])(_this5, "version", _versions.VERSIONS.v0);
|
|
196
|
+
return _this5;
|
|
197
|
+
}
|
|
198
|
+
(0, _inherits2["default"])(LayerConfigToVisConfigSchemaV0, _Schema5);
|
|
199
|
+
return (0, _createClass2["default"])(LayerConfigToVisConfigSchemaV0, [{
|
|
200
|
+
key: "load",
|
|
201
|
+
value: function load(saved, parents, accumulated) {
|
|
202
|
+
// fold v0 layer property into config.visConfig
|
|
203
|
+
var accumulatedConfig = accumulated.config || {};
|
|
204
|
+
return {
|
|
205
|
+
config: _objectSpread(_objectSpread({}, accumulatedConfig), {}, {
|
|
206
|
+
visConfig: _objectSpread(_objectSpread({}, accumulatedConfig.visConfig || {}), {}, (0, _defineProperty2["default"])({}, this.key, saved))
|
|
207
|
+
})
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
}]);
|
|
211
|
+
}(_schema["default"]);
|
|
212
|
+
var LayerVisConfigSchemaV0 = /*#__PURE__*/function (_Schema6) {
|
|
213
|
+
function LayerVisConfigSchemaV0() {
|
|
214
|
+
var _this6;
|
|
215
|
+
(0, _classCallCheck2["default"])(this, LayerVisConfigSchemaV0);
|
|
216
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
217
|
+
args[_key6] = arguments[_key6];
|
|
218
|
+
}
|
|
219
|
+
_this6 = _callSuper(this, LayerVisConfigSchemaV0, [].concat(args));
|
|
220
|
+
(0, _defineProperty2["default"])(_this6, "version", _versions.VERSIONS.v0);
|
|
221
|
+
(0, _defineProperty2["default"])(_this6, "key", 'visConfig');
|
|
222
|
+
return _this6;
|
|
223
|
+
}
|
|
224
|
+
(0, _inherits2["default"])(LayerVisConfigSchemaV0, _Schema6);
|
|
225
|
+
return (0, _createClass2["default"])(LayerVisConfigSchemaV0, [{
|
|
226
|
+
key: "load",
|
|
227
|
+
value: function load(visConfig, parents, accumulator) {
|
|
228
|
+
var _parents$slice5 = parents.slice(-1),
|
|
229
|
+
_parents$slice6 = (0, _slicedToArray2["default"])(_parents$slice5, 1),
|
|
230
|
+
config = _parents$slice6[0];
|
|
231
|
+
var rename = {
|
|
232
|
+
geojson: {
|
|
233
|
+
extruded: 'enable3d',
|
|
234
|
+
elevationRange: 'heightRange'
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
if (config.type in rename) {
|
|
238
|
+
var propToRename = rename[config.type];
|
|
239
|
+
return {
|
|
240
|
+
config: _objectSpread(_objectSpread({}, accumulator.config || {}), {}, {
|
|
241
|
+
visConfig: Object.keys(visConfig).reduce(function (accu, key) {
|
|
242
|
+
return _objectSpread(_objectSpread({}, accu), propToRename[key] ? (0, _defineProperty2["default"])({}, propToRename[key], visConfig[key]) : (0, _defineProperty2["default"])({}, key, visConfig[key]));
|
|
243
|
+
}, {})
|
|
244
|
+
})
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
return {
|
|
248
|
+
config: _objectSpread(_objectSpread({}, accumulator.config || {}), {}, {
|
|
249
|
+
visConfig: visConfig
|
|
250
|
+
})
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
}]);
|
|
254
|
+
}(_schema["default"]);
|
|
255
|
+
var LayerConfigSchemaDeleteV0 = /*#__PURE__*/function (_Schema7) {
|
|
256
|
+
function LayerConfigSchemaDeleteV0() {
|
|
257
|
+
var _this7;
|
|
258
|
+
(0, _classCallCheck2["default"])(this, LayerConfigSchemaDeleteV0);
|
|
259
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
260
|
+
args[_key7] = arguments[_key7];
|
|
261
|
+
}
|
|
262
|
+
_this7 = _callSuper(this, LayerConfigSchemaDeleteV0, [].concat(args));
|
|
263
|
+
(0, _defineProperty2["default"])(_this7, "version", _versions.VERSIONS.v0);
|
|
264
|
+
return _this7;
|
|
265
|
+
}
|
|
266
|
+
(0, _inherits2["default"])(LayerConfigSchemaDeleteV0, _Schema7);
|
|
267
|
+
return (0, _createClass2["default"])(LayerConfigSchemaDeleteV0, [{
|
|
268
|
+
key: "load",
|
|
269
|
+
value: function load() {
|
|
270
|
+
return {};
|
|
271
|
+
}
|
|
272
|
+
}]);
|
|
273
|
+
}(_schema["default"]);
|
|
274
|
+
/**
|
|
275
|
+
* V0 -> V1 Changes
|
|
276
|
+
* - layer is now a class
|
|
277
|
+
* - config saved in a config object
|
|
278
|
+
* - id, type, isAggregated is outside layer.config
|
|
279
|
+
* - visualChannels is outside config, it defines available visual channel and
|
|
280
|
+
* property names for field, scale, domain and range of each visual chanel.
|
|
281
|
+
* - enable3d, colorAggregation and sizeAggregation are moved into visConfig
|
|
282
|
+
* - GeojsonLayer - added height, radius specific properties
|
|
283
|
+
*/
|
|
284
|
+
var layerPropsV0 = exports.layerPropsV0 = {
|
|
285
|
+
id: null,
|
|
286
|
+
type: null,
|
|
287
|
+
// move into layer.config
|
|
288
|
+
dataId: new LayerConfigSchemaV0({
|
|
289
|
+
key: 'dataId'
|
|
290
|
+
}),
|
|
291
|
+
label: new LayerConfigSchemaV0({
|
|
292
|
+
key: 'label'
|
|
293
|
+
}),
|
|
294
|
+
color: new LayerConfigSchemaV0({
|
|
295
|
+
key: 'color'
|
|
296
|
+
}),
|
|
297
|
+
isVisible: new LayerConfigSchemaV0({
|
|
298
|
+
key: 'isVisible'
|
|
299
|
+
}),
|
|
300
|
+
hidden: new LayerConfigSchemaV0({
|
|
301
|
+
key: 'hidden'
|
|
302
|
+
}),
|
|
303
|
+
// convert visConfig
|
|
304
|
+
visConfig: new LayerVisConfigSchemaV0({
|
|
305
|
+
key: 'visConfig'
|
|
306
|
+
}),
|
|
307
|
+
// move into layer.config
|
|
308
|
+
// flatten
|
|
309
|
+
columns: new LayerColumnsSchemaV0(),
|
|
310
|
+
// save into visualChannels
|
|
311
|
+
colorField: new DimensionFieldSchemaV0({
|
|
312
|
+
properties: dimensionPropsV0,
|
|
313
|
+
key: 'colorField'
|
|
314
|
+
}),
|
|
315
|
+
colorScale: new DimensionScaleSchemaV0({
|
|
316
|
+
key: 'colorScale'
|
|
317
|
+
}),
|
|
318
|
+
sizeField: new DimensionFieldSchemaV0({
|
|
319
|
+
properties: dimensionPropsV0,
|
|
320
|
+
key: 'sizeField'
|
|
321
|
+
}),
|
|
322
|
+
sizeScale: new DimensionScaleSchemaV0({
|
|
323
|
+
key: 'sizeScale'
|
|
324
|
+
}),
|
|
325
|
+
// move into config.visConfig
|
|
326
|
+
enable3d: new LayerConfigToVisConfigSchemaV0({
|
|
327
|
+
key: 'enable3d'
|
|
328
|
+
}),
|
|
329
|
+
colorAggregation: new LayerConfigToVisConfigSchemaV0({
|
|
330
|
+
key: 'colorAggregation'
|
|
331
|
+
}),
|
|
332
|
+
sizeAggregation: new LayerConfigToVisConfigSchemaV0({
|
|
333
|
+
key: 'sizeAggregation'
|
|
334
|
+
}),
|
|
335
|
+
// delete
|
|
336
|
+
isAggregated: new LayerConfigSchemaDeleteV0()
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* V1 Schema
|
|
341
|
+
*/
|
|
342
|
+
var ColumnSchemaV1 = /*#__PURE__*/function (_Schema8) {
|
|
343
|
+
function ColumnSchemaV1() {
|
|
344
|
+
(0, _classCallCheck2["default"])(this, ColumnSchemaV1);
|
|
345
|
+
return _callSuper(this, ColumnSchemaV1, arguments);
|
|
346
|
+
}
|
|
347
|
+
(0, _inherits2["default"])(ColumnSchemaV1, _Schema8);
|
|
348
|
+
return (0, _createClass2["default"])(ColumnSchemaV1, [{
|
|
349
|
+
key: "save",
|
|
350
|
+
value: function save(columns) {
|
|
351
|
+
// starting from v1, only save column value
|
|
352
|
+
// fieldIdx will be calculated during merge
|
|
353
|
+
return (0, _defineProperty2["default"])({}, this.key, Object.keys(columns).reduce(function (accu, ckey) {
|
|
354
|
+
var _columns$ckey;
|
|
355
|
+
return _objectSpread(_objectSpread({}, accu), (_columns$ckey = columns[ckey]) !== null && _columns$ckey !== void 0 && _columns$ckey.value ? (0, _defineProperty2["default"])({}, ckey, columns[ckey].value) : {});
|
|
356
|
+
}, {}));
|
|
357
|
+
}
|
|
358
|
+
}, {
|
|
359
|
+
key: "load",
|
|
360
|
+
value: function load(columns) {
|
|
361
|
+
return {
|
|
362
|
+
columns: columns
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
}]);
|
|
366
|
+
}(_schema["default"]);
|
|
367
|
+
var TextLabelSchemaV1 = /*#__PURE__*/function (_Schema9) {
|
|
368
|
+
function TextLabelSchemaV1() {
|
|
369
|
+
(0, _classCallCheck2["default"])(this, TextLabelSchemaV1);
|
|
370
|
+
return _callSuper(this, TextLabelSchemaV1, arguments);
|
|
371
|
+
}
|
|
372
|
+
(0, _inherits2["default"])(TextLabelSchemaV1, _Schema9);
|
|
373
|
+
return (0, _createClass2["default"])(TextLabelSchemaV1, [{
|
|
374
|
+
key: "save",
|
|
375
|
+
value: function save(textLabel) {
|
|
376
|
+
return (0, _defineProperty2["default"])({}, this.key, textLabel.map(function (tl) {
|
|
377
|
+
return _objectSpread(_objectSpread({}, tl), {}, {
|
|
378
|
+
field: tl.field ? (0, _pick["default"])(tl.field, ['name', 'type']) : null
|
|
379
|
+
});
|
|
380
|
+
}));
|
|
381
|
+
}
|
|
382
|
+
}, {
|
|
383
|
+
key: "load",
|
|
384
|
+
value: function load(textLabel) {
|
|
385
|
+
return {
|
|
386
|
+
textLabel: Array.isArray(textLabel) ? textLabel : [textLabel]
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
}]);
|
|
390
|
+
}(_schema["default"]);
|
|
391
|
+
var visualChannelModificationV1 = {
|
|
392
|
+
geojson: function geojson(vc, parents) {
|
|
393
|
+
var _LAYER_VIS_CONFIGS$ra;
|
|
394
|
+
var _parents$slice7 = parents.slice(-1),
|
|
395
|
+
_parents$slice8 = (0, _slicedToArray2["default"])(_parents$slice7, 1),
|
|
396
|
+
layer = _parents$slice8[0];
|
|
397
|
+
var isOld = !Object.prototype.hasOwnProperty.call(vc, 'strokeColorField');
|
|
398
|
+
// make our best guess if this geojson layer contains point
|
|
399
|
+
var isPoint = vc.radiusField || layer.config.visConfig.radius !== ((_LAYER_VIS_CONFIGS$ra = _constants.LAYER_VIS_CONFIGS.radius) === null || _LAYER_VIS_CONFIGS$ra === void 0 ? void 0 : _LAYER_VIS_CONFIGS$ra.defaultValue);
|
|
400
|
+
if (isOld && !isPoint && layer.config.visConfig.stroked) {
|
|
401
|
+
// if stroked is true, copy color config to stroke color config
|
|
402
|
+
return {
|
|
403
|
+
strokeColorField: vc.colorField,
|
|
404
|
+
strokeColorScale: vc.colorScale
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
return {};
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
/**
|
|
411
|
+
* V1: save [field]: {name, type}, [scale]: '' for each channel
|
|
412
|
+
*/
|
|
413
|
+
var VisualChannelSchemaV1 = /*#__PURE__*/function (_Schema0) {
|
|
414
|
+
function VisualChannelSchemaV1() {
|
|
415
|
+
(0, _classCallCheck2["default"])(this, VisualChannelSchemaV1);
|
|
416
|
+
return _callSuper(this, VisualChannelSchemaV1, arguments);
|
|
417
|
+
}
|
|
418
|
+
(0, _inherits2["default"])(VisualChannelSchemaV1, _Schema0);
|
|
419
|
+
return (0, _createClass2["default"])(VisualChannelSchemaV1, [{
|
|
420
|
+
key: "save",
|
|
421
|
+
value: function save(visualChannels, parents) {
|
|
422
|
+
// only save field and scale of each channel
|
|
423
|
+
var _parents$slice9 = parents.slice(-1),
|
|
424
|
+
_parents$slice0 = (0, _slicedToArray2["default"])(_parents$slice9, 1),
|
|
425
|
+
layer = _parents$slice0[0];
|
|
426
|
+
return (0, _defineProperty2["default"])({}, this.key, Object.keys(visualChannels).reduce(
|
|
427
|
+
// save channel to null if didn't select any field
|
|
428
|
+
function (accu, key) {
|
|
429
|
+
return _objectSpread(_objectSpread({}, accu), {}, (0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, visualChannels[key].field, layer.config[visualChannels[key].field] ? (0, _pick["default"])(layer.config[visualChannels[key].field], ['name', 'type']) : null), visualChannels[key].scale, layer.config[visualChannels[key].scale]));
|
|
430
|
+
}, {}));
|
|
431
|
+
}
|
|
432
|
+
}, {
|
|
433
|
+
key: "load",
|
|
434
|
+
value: function load(vc, parents, accumulator) {
|
|
435
|
+
// fold channels into config
|
|
436
|
+
var _parents$slice1 = parents.slice(-1),
|
|
437
|
+
_parents$slice10 = (0, _slicedToArray2["default"])(_parents$slice1, 1),
|
|
438
|
+
layer = _parents$slice10[0];
|
|
439
|
+
var modified = visualChannelModificationV1[layer.type] ? visualChannelModificationV1[layer.type](vc, parents, accumulator) : {};
|
|
440
|
+
return _objectSpread(_objectSpread({}, accumulator), {}, {
|
|
441
|
+
config: _objectSpread(_objectSpread(_objectSpread({}, accumulator.config || {}), vc), modified)
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
}]);
|
|
445
|
+
}(_schema["default"]);
|
|
446
|
+
var visConfigModificationV1 = {
|
|
447
|
+
point: function point(visConfig, parents) {
|
|
448
|
+
var modified = {};
|
|
449
|
+
var _parents$slice11 = parents.slice(-2, -1),
|
|
450
|
+
_parents$slice12 = (0, _slicedToArray2["default"])(_parents$slice11, 1),
|
|
451
|
+
layer = _parents$slice12[0];
|
|
452
|
+
var isOld = !Object.prototype.hasOwnProperty.call(visConfig, 'filled') && !visConfig.strokeColor && !visConfig.strokeColorRange;
|
|
453
|
+
if (isOld) {
|
|
454
|
+
// color color & color range to stroke color
|
|
455
|
+
modified.strokeColor = layer.config.color;
|
|
456
|
+
modified.strokeColorRange = (0, _cloneDeep["default"])(visConfig.colorRange);
|
|
457
|
+
if (visConfig.outline) {
|
|
458
|
+
// point layer now supports both outline and fill
|
|
459
|
+
// for older schema where filled has not been added to point layer
|
|
460
|
+
// set it to false
|
|
461
|
+
modified.filled = false;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
return modified;
|
|
465
|
+
},
|
|
466
|
+
geojson: function geojson(visConfig, parents) {
|
|
467
|
+
var _LAYER_VIS_CONFIGS$ra2;
|
|
468
|
+
// is points?
|
|
469
|
+
var modified = {};
|
|
470
|
+
var _parents$slice13 = parents.slice(-2, -1),
|
|
471
|
+
_parents$slice14 = (0, _slicedToArray2["default"])(_parents$slice13, 1),
|
|
472
|
+
layer = _parents$slice14[0];
|
|
473
|
+
var isOld = layer.visualChannels && !Object.prototype.hasOwnProperty.call(layer.visualChannels, 'strokeColorField') && !visConfig.strokeColor && !visConfig.strokeColorRange;
|
|
474
|
+
// make our best guess if this geojson layer contains point
|
|
475
|
+
var isPoint = layer.visualChannels && layer.visualChannels.radiusField || visConfig && visConfig.radius !== ((_LAYER_VIS_CONFIGS$ra2 = _constants.LAYER_VIS_CONFIGS.radius) === null || _LAYER_VIS_CONFIGS$ra2 === void 0 ? void 0 : _LAYER_VIS_CONFIGS$ra2.defaultValue);
|
|
476
|
+
if (isOld) {
|
|
477
|
+
// color color & color range to stroke color
|
|
478
|
+
modified.strokeColor = layer.config.color;
|
|
479
|
+
modified.strokeColorRange = (0, _cloneDeep["default"])(visConfig.colorRange);
|
|
480
|
+
if (isPoint) {
|
|
481
|
+
// if is point, set stroke to false
|
|
482
|
+
modified.filled = true;
|
|
483
|
+
modified.stroked = false;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return modified;
|
|
487
|
+
},
|
|
488
|
+
'3D': function D(visConfig) {
|
|
489
|
+
var migrated = (0, _layers.migrateLegacyScenegraphVisConfig)(visConfig);
|
|
490
|
+
if (!migrated || migrated.scenegraph === (visConfig === null || visConfig === void 0 ? void 0 : visConfig.scenegraph)) {
|
|
491
|
+
return {};
|
|
492
|
+
}
|
|
493
|
+
return {
|
|
494
|
+
scenegraph: migrated.scenegraph
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
var VisConfigSchemaV1 = /*#__PURE__*/function (_Schema1) {
|
|
499
|
+
function VisConfigSchemaV1() {
|
|
500
|
+
var _this8;
|
|
501
|
+
(0, _classCallCheck2["default"])(this, VisConfigSchemaV1);
|
|
502
|
+
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
|
503
|
+
args[_key8] = arguments[_key8];
|
|
504
|
+
}
|
|
505
|
+
_this8 = _callSuper(this, VisConfigSchemaV1, [].concat(args));
|
|
506
|
+
(0, _defineProperty2["default"])(_this8, "key", 'visConfig');
|
|
507
|
+
return _this8;
|
|
508
|
+
}
|
|
509
|
+
(0, _inherits2["default"])(VisConfigSchemaV1, _Schema1);
|
|
510
|
+
return (0, _createClass2["default"])(VisConfigSchemaV1, [{
|
|
511
|
+
key: "load",
|
|
512
|
+
value:
|
|
513
|
+
// layer.config.visConfig
|
|
514
|
+
// colorRange
|
|
515
|
+
function load(visConfig, parents, accumulated) {
|
|
516
|
+
var _parents$slice15 = parents.slice(-2, -1),
|
|
517
|
+
_parents$slice16 = (0, _slicedToArray2["default"])(_parents$slice15, 1),
|
|
518
|
+
layer = _parents$slice16[0];
|
|
519
|
+
var modified = visConfigModificationV1[layer.type] ? visConfigModificationV1[layer.type](visConfig, parents, accumulated) : {};
|
|
520
|
+
var loadedVisConfig = _objectSpread(_objectSpread({}, visConfig), modified);
|
|
521
|
+
|
|
522
|
+
// backward compatibility, load colorRange and change the name to match new color Palette
|
|
523
|
+
['colorRange', 'strokeColorRange'].forEach(function (prop) {
|
|
524
|
+
if (loadedVisConfig !== null && loadedVisConfig !== void 0 && loadedVisConfig[prop]) {
|
|
525
|
+
loadedVisConfig[prop] = (0, _utils.colorRangeBackwardCompatibility)(loadedVisConfig[prop]);
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
return {
|
|
529
|
+
visConfig: loadedVisConfig
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
}]);
|
|
533
|
+
}(_schema["default"]);
|
|
534
|
+
var layerPropsV1 = exports.layerPropsV1 = {
|
|
535
|
+
id: null,
|
|
536
|
+
type: null,
|
|
537
|
+
config: new _schema["default"]({
|
|
538
|
+
version: _versions.VERSIONS.v1,
|
|
539
|
+
key: 'config',
|
|
540
|
+
properties: {
|
|
541
|
+
dataId: null,
|
|
542
|
+
columnMode: null,
|
|
543
|
+
label: null,
|
|
544
|
+
color: null,
|
|
545
|
+
highlightColor: null,
|
|
546
|
+
uniqueIdField: null,
|
|
547
|
+
columns: new ColumnSchemaV1({
|
|
548
|
+
version: _versions.VERSIONS.v1,
|
|
549
|
+
key: 'columns'
|
|
550
|
+
}),
|
|
551
|
+
isVisible: null,
|
|
552
|
+
isIncludedInLegend: null,
|
|
553
|
+
visConfig: new VisConfigSchemaV1({
|
|
554
|
+
version: _versions.VERSIONS.v1
|
|
555
|
+
}),
|
|
556
|
+
hidden: null,
|
|
557
|
+
textLabel: new TextLabelSchemaV1({
|
|
558
|
+
version: _versions.VERSIONS.v1,
|
|
559
|
+
key: 'textLabel'
|
|
560
|
+
})
|
|
561
|
+
}
|
|
562
|
+
}),
|
|
563
|
+
visualChannels: new VisualChannelSchemaV1({
|
|
564
|
+
version: _versions.VERSIONS.v1,
|
|
565
|
+
key: 'visualChannels'
|
|
566
|
+
})
|
|
567
|
+
};
|
|
568
|
+
var LayerSchemaV0 = exports.LayerSchemaV0 = /*#__PURE__*/function (_Schema10) {
|
|
569
|
+
function LayerSchemaV0() {
|
|
570
|
+
var _this9;
|
|
571
|
+
(0, _classCallCheck2["default"])(this, LayerSchemaV0);
|
|
572
|
+
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
|
573
|
+
args[_key9] = arguments[_key9];
|
|
574
|
+
}
|
|
575
|
+
_this9 = _callSuper(this, LayerSchemaV0, [].concat(args));
|
|
576
|
+
(0, _defineProperty2["default"])(_this9, "key", 'layers');
|
|
577
|
+
return _this9;
|
|
578
|
+
}
|
|
579
|
+
(0, _inherits2["default"])(LayerSchemaV0, _Schema10);
|
|
580
|
+
return (0, _createClass2["default"])(LayerSchemaV0, [{
|
|
581
|
+
key: "save",
|
|
582
|
+
value: function save(layers, parents) {
|
|
583
|
+
var _this0 = this;
|
|
584
|
+
var _parents$slice17 = parents.slice(-1),
|
|
585
|
+
_parents$slice18 = (0, _slicedToArray2["default"])(_parents$slice17, 1),
|
|
586
|
+
visState = _parents$slice18[0];
|
|
587
|
+
return (0, _defineProperty2["default"])({}, this.key, visState.layerOrder.reduce(function (saved, entry) {
|
|
588
|
+
if ((0, _utils.isPlainObject)(entry)) {
|
|
589
|
+
var group = entry;
|
|
590
|
+
var groupLayerOrder = group.layerOrder;
|
|
591
|
+
if (groupLayerOrder) {
|
|
592
|
+
groupLayerOrder.forEach(function (nestedEntry) {
|
|
593
|
+
if (typeof nestedEntry === 'string') {
|
|
594
|
+
var _layer = (0, _utils.findById)(nestedEntry)(layers);
|
|
595
|
+
if (_layer !== null && _layer !== void 0 && _layer.isValidToSave()) {
|
|
596
|
+
saved.push(_this0.savePropertiesOrApplySchema(_layer).layers);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
return saved;
|
|
602
|
+
}
|
|
603
|
+
var layer = (0, _utils.findById)(entry)(layers);
|
|
604
|
+
if (layer !== null && layer !== void 0 && layer.isValidToSave()) {
|
|
605
|
+
saved.push(_this0.savePropertiesOrApplySchema(layer).layers);
|
|
606
|
+
}
|
|
607
|
+
return saved;
|
|
608
|
+
}, []));
|
|
609
|
+
}
|
|
610
|
+
}, {
|
|
611
|
+
key: "load",
|
|
612
|
+
value: function load(layers) {
|
|
613
|
+
var _this1 = this;
|
|
614
|
+
return (0, _defineProperty2["default"])({}, this.key, layers ? layers.map(function (layer) {
|
|
615
|
+
return _this1.loadPropertiesOrApplySchema(layer, layers).layers;
|
|
616
|
+
}) : []);
|
|
617
|
+
}
|
|
618
|
+
}]);
|
|
619
|
+
}(_schema["default"]);
|
|
620
|
+
var FilterSchemaV0 = exports.FilterSchemaV0 = /*#__PURE__*/function (_Schema11) {
|
|
621
|
+
function FilterSchemaV0() {
|
|
622
|
+
var _this10;
|
|
623
|
+
(0, _classCallCheck2["default"])(this, FilterSchemaV0);
|
|
624
|
+
for (var _len0 = arguments.length, args = new Array(_len0), _key0 = 0; _key0 < _len0; _key0++) {
|
|
625
|
+
args[_key0] = arguments[_key0];
|
|
626
|
+
}
|
|
627
|
+
_this10 = _callSuper(this, FilterSchemaV0, [].concat(args));
|
|
628
|
+
(0, _defineProperty2["default"])(_this10, "key", 'filters');
|
|
629
|
+
return _this10;
|
|
630
|
+
}
|
|
631
|
+
(0, _inherits2["default"])(FilterSchemaV0, _Schema11);
|
|
632
|
+
return (0, _createClass2["default"])(FilterSchemaV0, [{
|
|
633
|
+
key: "save",
|
|
634
|
+
value: function save(filters) {
|
|
635
|
+
var _this11 = this;
|
|
636
|
+
return {
|
|
637
|
+
filters: filters.filter(_utils.isFilterValidToSave).map(function (filter) {
|
|
638
|
+
return _this11.savePropertiesOrApplySchema(filter).filters;
|
|
639
|
+
})
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
}, {
|
|
643
|
+
key: "load",
|
|
644
|
+
value: function load(filters) {
|
|
645
|
+
var _this12 = this;
|
|
646
|
+
return {
|
|
647
|
+
filters: filters === null || filters === void 0 ? void 0 : filters.map(function (filter) {
|
|
648
|
+
return _this12.loadPropertiesOrApplySchema(filter).filters;
|
|
649
|
+
})
|
|
650
|
+
// backward compatible convert enlarged to view
|
|
651
|
+
.map(function (filter) {
|
|
652
|
+
var enlarged = filter.enlarged,
|
|
653
|
+
view = filter.view,
|
|
654
|
+
filterProps = (0, _objectWithoutProperties2["default"])(filter, _excluded);
|
|
655
|
+
var newFilter = _objectSpread(_objectSpread({}, filterProps), {}, {
|
|
656
|
+
// if view exist use it otherwise check for enlarged
|
|
657
|
+
view: view ? view : enlarged ? _constants.FILTER_VIEW_TYPES.enlarged : _constants.FILTER_VIEW_TYPES.side
|
|
658
|
+
});
|
|
659
|
+
return newFilter;
|
|
660
|
+
})
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
}]);
|
|
664
|
+
}(_schema["default"]);
|
|
665
|
+
var interactionPropsV0 = ['tooltip', 'brush'];
|
|
666
|
+
var InteractionSchemaV0 = /*#__PURE__*/function (_Schema12) {
|
|
667
|
+
function InteractionSchemaV0() {
|
|
668
|
+
var _this13;
|
|
669
|
+
(0, _classCallCheck2["default"])(this, InteractionSchemaV0);
|
|
670
|
+
for (var _len1 = arguments.length, args = new Array(_len1), _key1 = 0; _key1 < _len1; _key1++) {
|
|
671
|
+
args[_key1] = arguments[_key1];
|
|
672
|
+
}
|
|
673
|
+
_this13 = _callSuper(this, InteractionSchemaV0, [].concat(args));
|
|
674
|
+
(0, _defineProperty2["default"])(_this13, "key", 'interactionConfig');
|
|
675
|
+
return _this13;
|
|
676
|
+
}
|
|
677
|
+
(0, _inherits2["default"])(InteractionSchemaV0, _Schema12);
|
|
678
|
+
return (0, _createClass2["default"])(InteractionSchemaV0, [{
|
|
679
|
+
key: "save",
|
|
680
|
+
value: function save(interactionConfig) {
|
|
681
|
+
return Array.isArray(this.properties) ? (0, _defineProperty2["default"])({}, this.key, this.properties.reduce(function (accu, key) {
|
|
682
|
+
return _objectSpread(_objectSpread({}, accu), interactionConfig[key].enabled ? (0, _defineProperty2["default"])({}, key, interactionConfig[key].config) : {});
|
|
683
|
+
}, {})) : {};
|
|
684
|
+
}
|
|
685
|
+
}, {
|
|
686
|
+
key: "load",
|
|
687
|
+
value: function load(interactionConfig) {
|
|
688
|
+
// convert v0 -> v1
|
|
689
|
+
// return enabled: false if disabled,
|
|
690
|
+
return Array.isArray(this.properties) ? (0, _defineProperty2["default"])({}, this.key, this.properties.reduce(function (accu, key) {
|
|
691
|
+
return _objectSpread(_objectSpread({}, accu), (0, _defineProperty2["default"])({}, key, _objectSpread(_objectSpread({}, interactionConfig[key] || {}), {}, {
|
|
692
|
+
enabled: Boolean(interactionConfig[key])
|
|
693
|
+
})));
|
|
694
|
+
}, {})) : {};
|
|
695
|
+
}
|
|
696
|
+
}]);
|
|
697
|
+
}(_schema["default"]);
|
|
698
|
+
var interactionPropsV1 = ['tooltip', 'legend', 'brush', 'geocoder', 'coordinate', 'annotation', 'zoomOpacity'];
|
|
699
|
+
var InteractionSchemaV1 = exports.InteractionSchemaV1 = /*#__PURE__*/function (_Schema13) {
|
|
700
|
+
function InteractionSchemaV1() {
|
|
701
|
+
var _this14;
|
|
702
|
+
(0, _classCallCheck2["default"])(this, InteractionSchemaV1);
|
|
703
|
+
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
|
704
|
+
args[_key10] = arguments[_key10];
|
|
705
|
+
}
|
|
706
|
+
_this14 = _callSuper(this, InteractionSchemaV1, [].concat(args));
|
|
707
|
+
(0, _defineProperty2["default"])(_this14, "key", 'interactionConfig');
|
|
708
|
+
return _this14;
|
|
709
|
+
}
|
|
710
|
+
(0, _inherits2["default"])(InteractionSchemaV1, _Schema13);
|
|
711
|
+
return (0, _createClass2["default"])(InteractionSchemaV1, [{
|
|
712
|
+
key: "save",
|
|
713
|
+
value: function save(interactionConfig) {
|
|
714
|
+
// save config even if disabled,
|
|
715
|
+
return Array.isArray(this.properties) ? (0, _defineProperty2["default"])({}, this.key, this.properties.reduce(function (accu, key) {
|
|
716
|
+
var interaction = interactionConfig[key];
|
|
717
|
+
// Older saved states may not have annotation or zoomOpacity.
|
|
718
|
+
if (!interaction) {
|
|
719
|
+
return accu;
|
|
720
|
+
}
|
|
721
|
+
var config = 'config' in interaction ? interaction.config : undefined;
|
|
722
|
+
return _objectSpread(_objectSpread({}, accu), {}, (0, _defineProperty2["default"])({}, key, _objectSpread(_objectSpread({}, config || {}), {}, {
|
|
723
|
+
enabled: interaction.enabled
|
|
724
|
+
})));
|
|
725
|
+
}, {})) : {};
|
|
726
|
+
}
|
|
727
|
+
}, {
|
|
728
|
+
key: "load",
|
|
729
|
+
value: function load(interactionConfig) {
|
|
730
|
+
var _this15 = this;
|
|
731
|
+
var modifiedConfig = (0, _cloneDeep["default"])(interactionConfig);
|
|
732
|
+
Object.keys(interactionConfig).forEach(function (configType) {
|
|
733
|
+
if (configType === 'tooltip') {
|
|
734
|
+
var fieldsToShow = modifiedConfig[configType].fieldsToShow;
|
|
735
|
+
if (!(0, _commonUtils.notNullorUndefined)(fieldsToShow)) {
|
|
736
|
+
return (0, _defineProperty2["default"])({}, _this15.key, modifiedConfig);
|
|
737
|
+
}
|
|
738
|
+
Object.keys(fieldsToShow).forEach(function (key) {
|
|
739
|
+
// @ts-expect-error name: fieldData should be string
|
|
740
|
+
fieldsToShow[key] = fieldsToShow[key].map(function (fieldData) {
|
|
741
|
+
if (!fieldData.name) {
|
|
742
|
+
return {
|
|
743
|
+
name: fieldData,
|
|
744
|
+
format: null
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
return fieldData;
|
|
748
|
+
});
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
return;
|
|
752
|
+
});
|
|
753
|
+
return (0, _defineProperty2["default"])({}, this.key, modifiedConfig);
|
|
754
|
+
}
|
|
755
|
+
}]);
|
|
756
|
+
}(_schema["default"]);
|
|
757
|
+
var filterPropsV0 = exports.filterPropsV0 = {
|
|
758
|
+
dataId: null,
|
|
759
|
+
id: null,
|
|
760
|
+
name: null,
|
|
761
|
+
type: null,
|
|
762
|
+
value: null,
|
|
763
|
+
// deprecated
|
|
764
|
+
enlarged: null
|
|
765
|
+
};
|
|
766
|
+
var DimensionFieldSchema = exports.DimensionFieldSchema = /*#__PURE__*/function (_Schema14) {
|
|
767
|
+
function DimensionFieldSchema() {
|
|
768
|
+
(0, _classCallCheck2["default"])(this, DimensionFieldSchema);
|
|
769
|
+
return _callSuper(this, DimensionFieldSchema, arguments);
|
|
770
|
+
}
|
|
771
|
+
(0, _inherits2["default"])(DimensionFieldSchema, _Schema14);
|
|
772
|
+
return (0, _createClass2["default"])(DimensionFieldSchema, [{
|
|
773
|
+
key: "save",
|
|
774
|
+
value: function save(field) {
|
|
775
|
+
return (0, _defineProperty2["default"])({}, this.key, field ? this.savePropertiesOrApplySchema(field)[this.key] : null);
|
|
776
|
+
}
|
|
777
|
+
}, {
|
|
778
|
+
key: "load",
|
|
779
|
+
value: function load(field) {
|
|
780
|
+
return (0, _defineProperty2["default"])({}, this.key, field);
|
|
781
|
+
}
|
|
782
|
+
}]);
|
|
783
|
+
}(_schema["default"]);
|
|
784
|
+
var SplitMapsSchema = exports.SplitMapsSchema = /*#__PURE__*/function (_Schema15) {
|
|
785
|
+
function SplitMapsSchema() {
|
|
786
|
+
(0, _classCallCheck2["default"])(this, SplitMapsSchema);
|
|
787
|
+
return _callSuper(this, SplitMapsSchema, arguments);
|
|
788
|
+
}
|
|
789
|
+
(0, _inherits2["default"])(SplitMapsSchema, _Schema15);
|
|
790
|
+
return (0, _createClass2["default"])(SplitMapsSchema, [{
|
|
791
|
+
key: "convertLayerSettings",
|
|
792
|
+
value: function convertLayerSettings(accu, _ref17) {
|
|
793
|
+
var _ref18 = (0, _slicedToArray2["default"])(_ref17, 2),
|
|
794
|
+
key = _ref18[0],
|
|
795
|
+
value = _ref18[1];
|
|
796
|
+
if (typeof value === 'boolean') {
|
|
797
|
+
return _objectSpread(_objectSpread({}, accu), {}, (0, _defineProperty2["default"])({}, key, value));
|
|
798
|
+
} else if (value && (0, _typeof2["default"])(value) === 'object' && value.isAvailable) {
|
|
799
|
+
return _objectSpread(_objectSpread({}, accu), {}, (0, _defineProperty2["default"])({}, key, Boolean(value.isVisible)));
|
|
800
|
+
}
|
|
801
|
+
return accu;
|
|
802
|
+
}
|
|
803
|
+
}, {
|
|
804
|
+
key: "load",
|
|
805
|
+
value: function load(splitMaps) {
|
|
806
|
+
var _this16 = this;
|
|
807
|
+
// previous splitMaps Schema {layers: {layerId: {isVisible, isAvailable}}}
|
|
808
|
+
|
|
809
|
+
if (!Array.isArray(splitMaps) || !splitMaps.length) {
|
|
810
|
+
return {
|
|
811
|
+
splitMaps: []
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
return {
|
|
815
|
+
splitMaps: splitMaps.map(function (settings) {
|
|
816
|
+
return _objectSpread(_objectSpread({}, settings), {}, {
|
|
817
|
+
layers: Object.entries(settings.layers || {}).reduce(_this16.convertLayerSettings, {})
|
|
818
|
+
});
|
|
819
|
+
})
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
}]);
|
|
823
|
+
}(_schema["default"]);
|
|
824
|
+
var PlotTypeSchema = exports.PlotTypeSchema = /*#__PURE__*/function (_Schema16) {
|
|
825
|
+
function PlotTypeSchema() {
|
|
826
|
+
var _this17;
|
|
827
|
+
(0, _classCallCheck2["default"])(this, PlotTypeSchema);
|
|
828
|
+
for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
|
829
|
+
args[_key11] = arguments[_key11];
|
|
830
|
+
}
|
|
831
|
+
_this17 = _callSuper(this, PlotTypeSchema, [].concat(args));
|
|
832
|
+
(0, _defineProperty2["default"])(_this17, "key", 'plotType');
|
|
833
|
+
return _this17;
|
|
834
|
+
}
|
|
835
|
+
(0, _inherits2["default"])(PlotTypeSchema, _Schema16);
|
|
836
|
+
return (0, _createClass2["default"])(PlotTypeSchema, [{
|
|
837
|
+
key: "load",
|
|
838
|
+
value: function load(plotType) {
|
|
839
|
+
if (typeof plotType === 'string') {
|
|
840
|
+
return {
|
|
841
|
+
plotType: {
|
|
842
|
+
type: plotType
|
|
843
|
+
}
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
return {
|
|
847
|
+
plotType: plotType
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
}]);
|
|
851
|
+
}(_schema["default"]);
|
|
852
|
+
var effectPropsV1 = exports.effectPropsV1 = {
|
|
853
|
+
id: null,
|
|
854
|
+
type: null,
|
|
855
|
+
isEnabled: null,
|
|
856
|
+
parameters: null
|
|
857
|
+
};
|
|
858
|
+
var chartPropsV1 = exports.chartPropsV1 = {
|
|
859
|
+
id: null,
|
|
860
|
+
title: null,
|
|
861
|
+
type: null,
|
|
862
|
+
dataId: null,
|
|
863
|
+
applyFilters: null,
|
|
864
|
+
pinned: null,
|
|
865
|
+
display: null,
|
|
866
|
+
crossFilter: null,
|
|
867
|
+
xAxis: null,
|
|
868
|
+
yAxis: null,
|
|
869
|
+
groupBy: null,
|
|
870
|
+
value: null,
|
|
871
|
+
axis: null,
|
|
872
|
+
numGroups: null,
|
|
873
|
+
groupOthers: null,
|
|
874
|
+
colorBy: null,
|
|
875
|
+
chartDisplay: null,
|
|
876
|
+
layerId: null,
|
|
877
|
+
layerChartType: null
|
|
878
|
+
};
|
|
879
|
+
var ChartsSchema = exports.ChartsSchema = /*#__PURE__*/function (_Schema17) {
|
|
880
|
+
function ChartsSchema() {
|
|
881
|
+
var _this18;
|
|
882
|
+
(0, _classCallCheck2["default"])(this, ChartsSchema);
|
|
883
|
+
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
|
884
|
+
args[_key12] = arguments[_key12];
|
|
885
|
+
}
|
|
886
|
+
_this18 = _callSuper(this, ChartsSchema, [].concat(args));
|
|
887
|
+
(0, _defineProperty2["default"])(_this18, "key", 'charts');
|
|
888
|
+
return _this18;
|
|
889
|
+
}
|
|
890
|
+
(0, _inherits2["default"])(ChartsSchema, _Schema17);
|
|
891
|
+
return (0, _createClass2["default"])(ChartsSchema, [{
|
|
892
|
+
key: "save",
|
|
893
|
+
value: function save(charts) {
|
|
894
|
+
var _this19 = this;
|
|
895
|
+
if (!Array.isArray(charts) || !charts.length) {
|
|
896
|
+
// Keep saved maps unchanged when the charts panel is unused.
|
|
897
|
+
return {};
|
|
898
|
+
}
|
|
899
|
+
return (0, _defineProperty2["default"])({}, this.key, charts.map(function (chart) {
|
|
900
|
+
return _this19.savePropertiesOrApplySchema(_objectSpread(_objectSpread({}, chart), {}, {
|
|
901
|
+
display: _objectSpread(_objectSpread({}, chart.display), {}, {
|
|
902
|
+
isConfigActive: false,
|
|
903
|
+
isJsonEditorActive: false
|
|
904
|
+
})
|
|
905
|
+
})).charts;
|
|
906
|
+
}));
|
|
907
|
+
}
|
|
908
|
+
}, {
|
|
909
|
+
key: "load",
|
|
910
|
+
value: function load(charts) {
|
|
911
|
+
var _this20 = this;
|
|
912
|
+
if (!Array.isArray(charts)) {
|
|
913
|
+
return (0, _defineProperty2["default"])({}, this.key, []);
|
|
914
|
+
}
|
|
915
|
+
return (0, _defineProperty2["default"])({}, this.key, charts.map(function (chart) {
|
|
916
|
+
var loaded = _this20.loadPropertiesOrApplySchema(chart, charts).charts;
|
|
917
|
+
// Older saved maps omit `pinned`; keep charts visible like the legend.
|
|
918
|
+
return _objectSpread(_objectSpread({}, loaded), {}, {
|
|
919
|
+
pinned: loaded.pinned !== false
|
|
920
|
+
});
|
|
921
|
+
}));
|
|
922
|
+
}
|
|
923
|
+
}]);
|
|
924
|
+
}(_schema["default"]);
|
|
925
|
+
var EffectsSchema = exports.EffectsSchema = /*#__PURE__*/function (_Schema18) {
|
|
926
|
+
function EffectsSchema() {
|
|
927
|
+
var _this21;
|
|
928
|
+
(0, _classCallCheck2["default"])(this, EffectsSchema);
|
|
929
|
+
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
|
930
|
+
args[_key13] = arguments[_key13];
|
|
931
|
+
}
|
|
932
|
+
_this21 = _callSuper(this, EffectsSchema, [].concat(args));
|
|
933
|
+
(0, _defineProperty2["default"])(_this21, "key", 'effects');
|
|
934
|
+
return _this21;
|
|
935
|
+
}
|
|
936
|
+
(0, _inherits2["default"])(EffectsSchema, _Schema18);
|
|
937
|
+
return (0, _createClass2["default"])(EffectsSchema, [{
|
|
938
|
+
key: "save",
|
|
939
|
+
value: function save(effects, parents) {
|
|
940
|
+
var _this22 = this;
|
|
941
|
+
var _parents$slice19 = parents.slice(-1),
|
|
942
|
+
_parents$slice20 = (0, _slicedToArray2["default"])(_parents$slice19, 1),
|
|
943
|
+
visState = _parents$slice20[0];
|
|
944
|
+
return (0, _defineProperty2["default"])({}, this.key, visState.effectOrder.reduce(function (saved, effectId) {
|
|
945
|
+
// save effects according to their rendering order
|
|
946
|
+
/**
|
|
947
|
+
* @type {Effect | undefined}
|
|
948
|
+
*/
|
|
949
|
+
var effect = (0, _utils.findById)(effectId)(effects);
|
|
950
|
+
if (effect !== null && effect !== void 0 && effect.isValidToSave()) {
|
|
951
|
+
saved.push(_this22.savePropertiesOrApplySchema(effect).effects);
|
|
952
|
+
}
|
|
953
|
+
return saved;
|
|
954
|
+
}, []));
|
|
955
|
+
}
|
|
956
|
+
}, {
|
|
957
|
+
key: "load",
|
|
958
|
+
value: function load(effects) {
|
|
959
|
+
var _this23 = this;
|
|
960
|
+
return (0, _defineProperty2["default"])({}, this.key, effects.map(function (effect) {
|
|
961
|
+
// handle older configs
|
|
962
|
+
var outEffect = effect.config ? _objectSpread(_objectSpread({
|
|
963
|
+
id: effect.id
|
|
964
|
+
}, effect.config), {}, {
|
|
965
|
+
parameters: _objectSpread({}, effect.config.params || {})
|
|
966
|
+
}) : effect;
|
|
967
|
+
return _this23.loadPropertiesOrApplySchema(outEffect, effects).effects;
|
|
968
|
+
}));
|
|
969
|
+
}
|
|
970
|
+
}]);
|
|
971
|
+
}(_schema["default"]);
|
|
972
|
+
var annotationPropsV1 = {
|
|
973
|
+
id: null,
|
|
974
|
+
kind: null,
|
|
975
|
+
isVisible: null,
|
|
976
|
+
autoSize: null,
|
|
977
|
+
autoSizeY: null,
|
|
978
|
+
anchorPoint: null,
|
|
979
|
+
label: null,
|
|
980
|
+
editorState: null,
|
|
981
|
+
mapIndex: null,
|
|
982
|
+
lineColor: null,
|
|
983
|
+
lineWidth: null,
|
|
984
|
+
textWidth: null,
|
|
985
|
+
textHeight: null,
|
|
986
|
+
textVerticalAlign: null,
|
|
987
|
+
textSide: null,
|
|
988
|
+
textVerticalPosition: null,
|
|
989
|
+
armLength: null,
|
|
990
|
+
angle: null,
|
|
991
|
+
radiusInMeters: null,
|
|
992
|
+
endPoint: null,
|
|
993
|
+
showCustomText: null,
|
|
994
|
+
showDistance: null
|
|
995
|
+
};
|
|
996
|
+
var AnnotationsSchema = exports.AnnotationsSchema = /*#__PURE__*/function (_Schema19) {
|
|
997
|
+
function AnnotationsSchema() {
|
|
998
|
+
var _this24;
|
|
999
|
+
(0, _classCallCheck2["default"])(this, AnnotationsSchema);
|
|
1000
|
+
for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
|
|
1001
|
+
args[_key14] = arguments[_key14];
|
|
1002
|
+
}
|
|
1003
|
+
_this24 = _callSuper(this, AnnotationsSchema, [].concat(args));
|
|
1004
|
+
(0, _defineProperty2["default"])(_this24, "key", 'annotations');
|
|
1005
|
+
return _this24;
|
|
1006
|
+
}
|
|
1007
|
+
(0, _inherits2["default"])(AnnotationsSchema, _Schema19);
|
|
1008
|
+
return (0, _createClass2["default"])(AnnotationsSchema, [{
|
|
1009
|
+
key: "save",
|
|
1010
|
+
value: function save(annotations) {
|
|
1011
|
+
var _this25 = this;
|
|
1012
|
+
return (0, _defineProperty2["default"])({}, this.key, annotations.map(function (annotation) {
|
|
1013
|
+
return _this25.savePropertiesOrApplySchema(annotation).annotations;
|
|
1014
|
+
}));
|
|
1015
|
+
}
|
|
1016
|
+
}, {
|
|
1017
|
+
key: "load",
|
|
1018
|
+
value: function load(annotations) {
|
|
1019
|
+
var _this26 = this;
|
|
1020
|
+
return (0, _defineProperty2["default"])({}, this.key, annotations.map(function (annotation) {
|
|
1021
|
+
return _this26.loadPropertiesOrApplySchema(annotation).annotations;
|
|
1022
|
+
}));
|
|
1023
|
+
}
|
|
1024
|
+
}]);
|
|
1025
|
+
}(_schema["default"]);
|
|
1026
|
+
var filterPropsV1 = exports.filterPropsV1 = _objectSpread(_objectSpread({}, filterPropsV0), {}, {
|
|
1027
|
+
plotType: new PlotTypeSchema({
|
|
1028
|
+
version: _versions.VERSIONS.v1
|
|
1029
|
+
}),
|
|
1030
|
+
animationWindow: null,
|
|
1031
|
+
yAxis: new DimensionFieldSchema({
|
|
1032
|
+
version: _versions.VERSIONS.v1,
|
|
1033
|
+
key: 'yAxis',
|
|
1034
|
+
properties: {
|
|
1035
|
+
name: null,
|
|
1036
|
+
type: null
|
|
1037
|
+
}
|
|
1038
|
+
}),
|
|
1039
|
+
// this replaced enlarged
|
|
1040
|
+
view: null,
|
|
1041
|
+
// polygon filter properties
|
|
1042
|
+
layerId: null,
|
|
1043
|
+
speed: null,
|
|
1044
|
+
// layer timeline
|
|
1045
|
+
syncedWithLayerTimeline: null,
|
|
1046
|
+
syncTimelineMode: null,
|
|
1047
|
+
enabled: null,
|
|
1048
|
+
inverted: null,
|
|
1049
|
+
invertTrendColor: null,
|
|
1050
|
+
timezone: null,
|
|
1051
|
+
// Optional end timestamp for duration-based time animation (#3198)
|
|
1052
|
+
endName: null
|
|
1053
|
+
});
|
|
1054
|
+
var propertiesV0 = exports.propertiesV0 = {
|
|
1055
|
+
filters: new FilterSchemaV0({
|
|
1056
|
+
version: _versions.VERSIONS.v0,
|
|
1057
|
+
properties: filterPropsV0
|
|
1058
|
+
}),
|
|
1059
|
+
layers: new LayerSchemaV0({
|
|
1060
|
+
version: _versions.VERSIONS.v0,
|
|
1061
|
+
properties: layerPropsV0
|
|
1062
|
+
}),
|
|
1063
|
+
interactionConfig: new InteractionSchemaV0({
|
|
1064
|
+
version: _versions.VERSIONS.v0,
|
|
1065
|
+
properties: interactionPropsV0
|
|
1066
|
+
}),
|
|
1067
|
+
layerBlending: null,
|
|
1068
|
+
overlayBlending: null
|
|
1069
|
+
};
|
|
1070
|
+
var CameraBookmarksSchema = /*#__PURE__*/function (_Schema20) {
|
|
1071
|
+
function CameraBookmarksSchema() {
|
|
1072
|
+
var _this27;
|
|
1073
|
+
(0, _classCallCheck2["default"])(this, CameraBookmarksSchema);
|
|
1074
|
+
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
|
1075
|
+
args[_key15] = arguments[_key15];
|
|
1076
|
+
}
|
|
1077
|
+
_this27 = _callSuper(this, CameraBookmarksSchema, [].concat(args));
|
|
1078
|
+
(0, _defineProperty2["default"])(_this27, "key", 'cameraBookmarks');
|
|
1079
|
+
return _this27;
|
|
1080
|
+
}
|
|
1081
|
+
(0, _inherits2["default"])(CameraBookmarksSchema, _Schema20);
|
|
1082
|
+
return (0, _createClass2["default"])(CameraBookmarksSchema, [{
|
|
1083
|
+
key: "save",
|
|
1084
|
+
value: function save(value) {
|
|
1085
|
+
var bookmarks = (0, _utils.normalizeCameraBookmarks)(value);
|
|
1086
|
+
return bookmarks.length ? (0, _defineProperty2["default"])({}, this.key, bookmarks) : {};
|
|
1087
|
+
}
|
|
1088
|
+
}, {
|
|
1089
|
+
key: "load",
|
|
1090
|
+
value: function load(value) {
|
|
1091
|
+
return (0, _defineProperty2["default"])({}, this.key, (0, _utils.normalizeCameraBookmarks)(value));
|
|
1092
|
+
}
|
|
1093
|
+
}]);
|
|
1094
|
+
}(_schema["default"]);
|
|
1095
|
+
var CameraTourSchema = /*#__PURE__*/function (_Schema21) {
|
|
1096
|
+
function CameraTourSchema() {
|
|
1097
|
+
var _this28;
|
|
1098
|
+
(0, _classCallCheck2["default"])(this, CameraTourSchema);
|
|
1099
|
+
for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
|
|
1100
|
+
args[_key16] = arguments[_key16];
|
|
1101
|
+
}
|
|
1102
|
+
_this28 = _callSuper(this, CameraTourSchema, [].concat(args));
|
|
1103
|
+
(0, _defineProperty2["default"])(_this28, "key", 'cameraTour');
|
|
1104
|
+
return _this28;
|
|
1105
|
+
}
|
|
1106
|
+
(0, _inherits2["default"])(CameraTourSchema, _Schema21);
|
|
1107
|
+
return (0, _createClass2["default"])(CameraTourSchema, [{
|
|
1108
|
+
key: "save",
|
|
1109
|
+
value: function save(value) {
|
|
1110
|
+
var tour = (0, _utils.normalizeCameraTour)(value);
|
|
1111
|
+
return tour ? (0, _defineProperty2["default"])({}, this.key, tour) : {};
|
|
1112
|
+
}
|
|
1113
|
+
}, {
|
|
1114
|
+
key: "load",
|
|
1115
|
+
value: function load(value) {
|
|
1116
|
+
return (0, _defineProperty2["default"])({}, this.key, (0, _utils.normalizeCameraTour)(value));
|
|
1117
|
+
}
|
|
1118
|
+
}]);
|
|
1119
|
+
}(_schema["default"]);
|
|
1120
|
+
var propertiesV1 = exports.propertiesV1 = {
|
|
1121
|
+
cameraTour: new CameraTourSchema(),
|
|
1122
|
+
cameraBookmarks: new CameraBookmarksSchema(),
|
|
1123
|
+
filters: new FilterSchemaV0({
|
|
1124
|
+
version: _versions.VERSIONS.v1,
|
|
1125
|
+
properties: filterPropsV1
|
|
1126
|
+
}),
|
|
1127
|
+
layers: new LayerSchemaV0({
|
|
1128
|
+
version: _versions.VERSIONS.v1,
|
|
1129
|
+
properties: layerPropsV1
|
|
1130
|
+
}),
|
|
1131
|
+
effects: new EffectsSchema({
|
|
1132
|
+
version: _versions.VERSIONS.v1,
|
|
1133
|
+
properties: effectPropsV1
|
|
1134
|
+
}),
|
|
1135
|
+
charts: new ChartsSchema({
|
|
1136
|
+
version: _versions.VERSIONS.v1,
|
|
1137
|
+
properties: chartPropsV1
|
|
1138
|
+
}),
|
|
1139
|
+
annotations: new AnnotationsSchema({
|
|
1140
|
+
version: _versions.VERSIONS.v1,
|
|
1141
|
+
properties: annotationPropsV1
|
|
1142
|
+
}),
|
|
1143
|
+
interactionConfig: new InteractionSchemaV1({
|
|
1144
|
+
version: _versions.VERSIONS.v1,
|
|
1145
|
+
properties: interactionPropsV1
|
|
1146
|
+
}),
|
|
1147
|
+
layerBlending: null,
|
|
1148
|
+
overlayBlending: null,
|
|
1149
|
+
splitMaps: new SplitMapsSchema({
|
|
1150
|
+
key: 'splitMaps',
|
|
1151
|
+
version: _versions.VERSIONS.v1
|
|
1152
|
+
}),
|
|
1153
|
+
animationConfig: new _schema["default"]({
|
|
1154
|
+
version: _versions.VERSIONS.v1,
|
|
1155
|
+
properties: {
|
|
1156
|
+
currentTime: null,
|
|
1157
|
+
speed: null,
|
|
1158
|
+
timeFormat: null,
|
|
1159
|
+
timezone: null
|
|
1160
|
+
},
|
|
1161
|
+
key: 'animationConfig'
|
|
1162
|
+
}),
|
|
1163
|
+
editor: new _schema["default"]({
|
|
1164
|
+
version: _versions.VERSIONS.v1,
|
|
1165
|
+
properties: {
|
|
1166
|
+
features: null,
|
|
1167
|
+
visible: null
|
|
1168
|
+
},
|
|
1169
|
+
key: 'editor'
|
|
1170
|
+
}),
|
|
1171
|
+
layerOrder: null,
|
|
1172
|
+
groupBys: null,
|
|
1173
|
+
joins: null
|
|
1174
|
+
// suitabilities is intentionally absent: the op config is ephemeral and only the
|
|
1175
|
+
// derived dataset is persisted. A `null` entry here would write it to saved maps.
|
|
1176
|
+
};
|
|
1177
|
+
var VisStateSchemaV1 = exports.VisStateSchemaV1 = /*#__PURE__*/function (_Schema22) {
|
|
1178
|
+
function VisStateSchemaV1() {
|
|
1179
|
+
(0, _classCallCheck2["default"])(this, VisStateSchemaV1);
|
|
1180
|
+
return _callSuper(this, VisStateSchemaV1, arguments);
|
|
1181
|
+
}
|
|
1182
|
+
(0, _inherits2["default"])(VisStateSchemaV1, _Schema22);
|
|
1183
|
+
return (0, _createClass2["default"])(VisStateSchemaV1, [{
|
|
1184
|
+
key: "save",
|
|
1185
|
+
value: function save(node) {
|
|
1186
|
+
var parents = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
1187
|
+
var accumulator = arguments.length > 2 ? arguments[2] : undefined;
|
|
1188
|
+
// @ts-expect-error
|
|
1189
|
+
return this.savePropertiesOrApplySchema(node, parents, accumulator);
|
|
1190
|
+
}
|
|
1191
|
+
}, {
|
|
1192
|
+
key: "load",
|
|
1193
|
+
value: function load(node) {
|
|
1194
|
+
// @ts-expect-error
|
|
1195
|
+
return this.loadPropertiesOrApplySchema(node);
|
|
1196
|
+
}
|
|
1197
|
+
}]);
|
|
1198
|
+
}(_schema["default"]);
|
|
1199
|
+
var visStateSchemaV0 = exports.visStateSchemaV0 = new _schema["default"]({
|
|
1200
|
+
version: _versions.VERSIONS.v0,
|
|
1201
|
+
properties: propertiesV0,
|
|
1202
|
+
key: 'visState'
|
|
1203
|
+
});
|
|
1204
|
+
var visStateSchemaV1 = exports.visStateSchemaV1 = new VisStateSchemaV1({
|
|
1205
|
+
version: _versions.VERSIONS.v1,
|
|
1206
|
+
properties: propertiesV1,
|
|
1207
|
+
key: 'visState'
|
|
1208
|
+
});
|
|
1209
|
+
var visStateSchema = exports.visStateSchema = (0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, _versions.VERSIONS.v0, {
|
|
1210
|
+
save: function save(toSave) {
|
|
1211
|
+
return visStateSchemaV0.save(toSave);
|
|
1212
|
+
},
|
|
1213
|
+
load: function load(toLoad) {
|
|
1214
|
+
var _visStateSchemaV0$loa;
|
|
1215
|
+
return visStateSchemaV1.load((_visStateSchemaV0$loa = visStateSchemaV0.load(toLoad)) === null || _visStateSchemaV0$loa === void 0 ? void 0 : _visStateSchemaV0$loa.visState);
|
|
1216
|
+
}
|
|
1217
|
+
}), _versions.VERSIONS.v1, visStateSchemaV1);
|
|
1218
|
+
|
|
1219
|
+
// test load v0
|
|
1220
|
+
var _default = exports["default"] = visStateSchema;
|
|
1221
|
+
//# sourceMappingURL=vis-state-schema.js.map
|