@steedos-widgets/amis-object 1.2.15 → 1.2.18

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.
@@ -1,6 +1,6 @@
1
- import React, { useState, useEffect, createElement } from 'react';
1
+ import React, { createContext, useState, useEffect, createElement } from 'react';
2
2
  import * as ___default from 'lodash';
3
- import ___default__default, { isEmpty, isArray, each, find, endsWith, cloneDeep, includes, toArray, mergeWith, isString, union, has, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, map, filter, get, isBoolean, omitBy, isNil, forEach, startsWith, isFunction, compact, difference, keys, pick, first, values, pickBy, random, assign, isNumber } from 'lodash';
3
+ import ___default__default, { isEmpty, isArray, each, find, endsWith, cloneDeep, includes, toArray, mergeWith, isString, union, has, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, map, filter, get as get$1, isBoolean, omitBy, isNil, forEach, startsWith, isFunction, compact, difference, keys, pick, first, values, pickBy, random, assign, isNumber } from 'lodash';
4
4
  import { Dropdown, Tabs, Spin, Badge, Skeleton, Modal as Modal$1, message, notification, Button, Space, Drawer as Drawer$1 } from 'antd';
5
5
  import ReactDOM, { createRoot } from 'react-dom';
6
6
 
@@ -119,8 +119,2805 @@ function __spreadArray(to, from, pack) {
119
119
  return to.concat(ar || Array.prototype.slice.call(from));
120
120
  }
121
121
 
122
+ function _typeof$1(obj) {
123
+ "@babel/helpers - typeof";
124
+
125
+ return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
126
+ return typeof obj;
127
+ } : function (obj) {
128
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
129
+ }, _typeof$1(obj);
130
+ }
131
+
132
+ function _classCallCheck$1(instance, Constructor) {
133
+ if (!(instance instanceof Constructor)) {
134
+ throw new TypeError("Cannot call a class as a function");
135
+ }
136
+ }
137
+
138
+ function _toPrimitive$1(input, hint) {
139
+ if (_typeof$1(input) !== "object" || input === null) return input;
140
+ var prim = input[Symbol.toPrimitive];
141
+ if (prim !== undefined) {
142
+ var res = prim.call(input, hint || "default");
143
+ if (_typeof$1(res) !== "object") return res;
144
+ throw new TypeError("@@toPrimitive must return a primitive value.");
145
+ }
146
+ return (hint === "string" ? String : Number)(input);
147
+ }
148
+
149
+ function _toPropertyKey$1(arg) {
150
+ var key = _toPrimitive$1(arg, "string");
151
+ return _typeof$1(key) === "symbol" ? key : String(key);
152
+ }
153
+
154
+ function _defineProperties$1(target, props) {
155
+ for (var i = 0; i < props.length; i++) {
156
+ var descriptor = props[i];
157
+ descriptor.enumerable = descriptor.enumerable || false;
158
+ descriptor.configurable = true;
159
+ if ("value" in descriptor) descriptor.writable = true;
160
+ Object.defineProperty(target, _toPropertyKey$1(descriptor.key), descriptor);
161
+ }
162
+ }
163
+ function _createClass$1(Constructor, protoProps, staticProps) {
164
+ if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
165
+ if (staticProps) _defineProperties$1(Constructor, staticProps);
166
+ Object.defineProperty(Constructor, "prototype", {
167
+ writable: false
168
+ });
169
+ return Constructor;
170
+ }
171
+
172
+ function _assertThisInitialized(self) {
173
+ if (self === void 0) {
174
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
175
+ }
176
+ return self;
177
+ }
178
+
179
+ function _setPrototypeOf(o, p) {
180
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
181
+ o.__proto__ = p;
182
+ return o;
183
+ };
184
+ return _setPrototypeOf(o, p);
185
+ }
186
+
187
+ function _inherits(subClass, superClass) {
188
+ if (typeof superClass !== "function" && superClass !== null) {
189
+ throw new TypeError("Super expression must either be null or a function");
190
+ }
191
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
192
+ constructor: {
193
+ value: subClass,
194
+ writable: true,
195
+ configurable: true
196
+ }
197
+ });
198
+ Object.defineProperty(subClass, "prototype", {
199
+ writable: false
200
+ });
201
+ if (superClass) _setPrototypeOf(subClass, superClass);
202
+ }
203
+
204
+ function _possibleConstructorReturn(self, call) {
205
+ if (call && (_typeof$1(call) === "object" || typeof call === "function")) {
206
+ return call;
207
+ } else if (call !== void 0) {
208
+ throw new TypeError("Derived constructors may only return object or undefined");
209
+ }
210
+ return _assertThisInitialized(self);
211
+ }
212
+
213
+ function _getPrototypeOf(o) {
214
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
215
+ return o.__proto__ || Object.getPrototypeOf(o);
216
+ };
217
+ return _getPrototypeOf(o);
218
+ }
219
+
220
+ function _defineProperty$1(obj, key, value) {
221
+ key = _toPropertyKey$1(key);
222
+ if (key in obj) {
223
+ Object.defineProperty(obj, key, {
224
+ value: value,
225
+ enumerable: true,
226
+ configurable: true,
227
+ writable: true
228
+ });
229
+ } else {
230
+ obj[key] = value;
231
+ }
232
+ return obj;
233
+ }
234
+
235
+ function _arrayWithHoles(arr) {
236
+ if (Array.isArray(arr)) return arr;
237
+ }
238
+
239
+ function _iterableToArray(iter) {
240
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
241
+ }
242
+
243
+ function _arrayLikeToArray(arr, len) {
244
+ if (len == null || len > arr.length) len = arr.length;
245
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
246
+ return arr2;
247
+ }
248
+
249
+ function _unsupportedIterableToArray(o, minLen) {
250
+ if (!o) return;
251
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
252
+ var n = Object.prototype.toString.call(o).slice(8, -1);
253
+ if (n === "Object" && o.constructor) n = o.constructor.name;
254
+ if (n === "Map" || n === "Set") return Array.from(o);
255
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
256
+ }
257
+
258
+ function _nonIterableRest() {
259
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
260
+ }
261
+
262
+ function _toArray(arr) {
263
+ return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
264
+ }
265
+
266
+ function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
267
+ function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$6(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
268
+ var consoleLogger = {
269
+ type: 'logger',
270
+ log: function log(args) {
271
+ this.output('log', args);
272
+ },
273
+ warn: function warn(args) {
274
+ this.output('warn', args);
275
+ },
276
+ error: function error(args) {
277
+ this.output('error', args);
278
+ },
279
+ output: function output(type, args) {
280
+ if (console && console[type]) console[type].apply(console, args);
281
+ }
282
+ };
283
+ var Logger = function () {
284
+ function Logger(concreteLogger) {
285
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
286
+ _classCallCheck$1(this, Logger);
287
+ this.init(concreteLogger, options);
288
+ }
289
+ _createClass$1(Logger, [{
290
+ key: "init",
291
+ value: function init(concreteLogger) {
292
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
293
+ this.prefix = options.prefix || 'i18next:';
294
+ this.logger = concreteLogger || consoleLogger;
295
+ this.options = options;
296
+ this.debug = options.debug;
297
+ }
298
+ }, {
299
+ key: "setDebug",
300
+ value: function setDebug(bool) {
301
+ this.debug = bool;
302
+ }
303
+ }, {
304
+ key: "log",
305
+ value: function log() {
306
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
307
+ args[_key] = arguments[_key];
308
+ }
309
+ return this.forward(args, 'log', '', true);
310
+ }
311
+ }, {
312
+ key: "warn",
313
+ value: function warn() {
314
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
315
+ args[_key2] = arguments[_key2];
316
+ }
317
+ return this.forward(args, 'warn', '', true);
318
+ }
319
+ }, {
320
+ key: "error",
321
+ value: function error() {
322
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
323
+ args[_key3] = arguments[_key3];
324
+ }
325
+ return this.forward(args, 'error', '');
326
+ }
327
+ }, {
328
+ key: "deprecate",
329
+ value: function deprecate() {
330
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
331
+ args[_key4] = arguments[_key4];
332
+ }
333
+ return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);
334
+ }
335
+ }, {
336
+ key: "forward",
337
+ value: function forward(args, lvl, prefix, debugOnly) {
338
+ if (debugOnly && !this.debug) return null;
339
+ if (typeof args[0] === 'string') args[0] = "".concat(prefix).concat(this.prefix, " ").concat(args[0]);
340
+ return this.logger[lvl](args);
341
+ }
342
+ }, {
343
+ key: "create",
344
+ value: function create(moduleName) {
345
+ return new Logger(this.logger, _objectSpread$6(_objectSpread$6({}, {
346
+ prefix: "".concat(this.prefix, ":").concat(moduleName, ":")
347
+ }), this.options));
348
+ }
349
+ }, {
350
+ key: "clone",
351
+ value: function clone(options) {
352
+ options = options || this.options;
353
+ options.prefix = options.prefix || this.prefix;
354
+ return new Logger(this.logger, options);
355
+ }
356
+ }]);
357
+ return Logger;
358
+ }();
359
+ var baseLogger = new Logger();
360
+
361
+ var EventEmitter = function () {
362
+ function EventEmitter() {
363
+ _classCallCheck$1(this, EventEmitter);
364
+ this.observers = {};
365
+ }
366
+ _createClass$1(EventEmitter, [{
367
+ key: "on",
368
+ value: function on(events, listener) {
369
+ var _this = this;
370
+ events.split(' ').forEach(function (event) {
371
+ _this.observers[event] = _this.observers[event] || [];
372
+ _this.observers[event].push(listener);
373
+ });
374
+ return this;
375
+ }
376
+ }, {
377
+ key: "off",
378
+ value: function off(event, listener) {
379
+ if (!this.observers[event]) return;
380
+ if (!listener) {
381
+ delete this.observers[event];
382
+ return;
383
+ }
384
+ this.observers[event] = this.observers[event].filter(function (l) {
385
+ return l !== listener;
386
+ });
387
+ }
388
+ }, {
389
+ key: "emit",
390
+ value: function emit(event) {
391
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
392
+ args[_key - 1] = arguments[_key];
393
+ }
394
+ if (this.observers[event]) {
395
+ var cloned = [].concat(this.observers[event]);
396
+ cloned.forEach(function (observer) {
397
+ observer.apply(void 0, args);
398
+ });
399
+ }
400
+ if (this.observers['*']) {
401
+ var _cloned = [].concat(this.observers['*']);
402
+ _cloned.forEach(function (observer) {
403
+ observer.apply(observer, [event].concat(args));
404
+ });
405
+ }
406
+ }
407
+ }]);
408
+ return EventEmitter;
409
+ }();
410
+
411
+ function defer() {
412
+ var res;
413
+ var rej;
414
+ var promise = new Promise(function (resolve, reject) {
415
+ res = resolve;
416
+ rej = reject;
417
+ });
418
+ promise.resolve = res;
419
+ promise.reject = rej;
420
+ return promise;
421
+ }
422
+ function makeString(object) {
423
+ if (object == null) return '';
424
+ return '' + object;
425
+ }
426
+ function copy(a, s, t) {
427
+ a.forEach(function (m) {
428
+ if (s[m]) t[m] = s[m];
429
+ });
430
+ }
431
+ function getLastOfPath(object, path, Empty) {
432
+ function cleanKey(key) {
433
+ return key && key.indexOf('###') > -1 ? key.replace(/###/g, '.') : key;
434
+ }
435
+ function canNotTraverseDeeper() {
436
+ return !object || typeof object === 'string';
437
+ }
438
+ var stack = typeof path !== 'string' ? [].concat(path) : path.split('.');
439
+ while (stack.length > 1) {
440
+ if (canNotTraverseDeeper()) return {};
441
+ var key = cleanKey(stack.shift());
442
+ if (!object[key] && Empty) object[key] = new Empty();
443
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
444
+ object = object[key];
445
+ } else {
446
+ object = {};
447
+ }
448
+ }
449
+ if (canNotTraverseDeeper()) return {};
450
+ return {
451
+ obj: object,
452
+ k: cleanKey(stack.shift())
453
+ };
454
+ }
455
+ function setPath(object, path, newValue) {
456
+ var _getLastOfPath = getLastOfPath(object, path, Object),
457
+ obj = _getLastOfPath.obj,
458
+ k = _getLastOfPath.k;
459
+ obj[k] = newValue;
460
+ }
461
+ function pushPath(object, path, newValue, concat) {
462
+ var _getLastOfPath2 = getLastOfPath(object, path, Object),
463
+ obj = _getLastOfPath2.obj,
464
+ k = _getLastOfPath2.k;
465
+ obj[k] = obj[k] || [];
466
+ if (concat) obj[k] = obj[k].concat(newValue);
467
+ if (!concat) obj[k].push(newValue);
468
+ }
469
+ function getPath(object, path) {
470
+ var _getLastOfPath3 = getLastOfPath(object, path),
471
+ obj = _getLastOfPath3.obj,
472
+ k = _getLastOfPath3.k;
473
+ if (!obj) return undefined;
474
+ return obj[k];
475
+ }
476
+ function getPathWithDefaults(data, defaultData, key) {
477
+ var value = getPath(data, key);
478
+ if (value !== undefined) {
479
+ return value;
480
+ }
481
+ return getPath(defaultData, key);
482
+ }
483
+ function deepExtend(target, source, overwrite) {
484
+ for (var prop in source) {
485
+ if (prop !== '__proto__' && prop !== 'constructor') {
486
+ if (prop in target) {
487
+ if (typeof target[prop] === 'string' || target[prop] instanceof String || typeof source[prop] === 'string' || source[prop] instanceof String) {
488
+ if (overwrite) target[prop] = source[prop];
489
+ } else {
490
+ deepExtend(target[prop], source[prop], overwrite);
491
+ }
492
+ } else {
493
+ target[prop] = source[prop];
494
+ }
495
+ }
496
+ }
497
+ return target;
498
+ }
499
+ function regexEscape(str) {
500
+ return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
501
+ }
502
+ var _entityMap = {
503
+ '&': '&amp;',
504
+ '<': '&lt;',
505
+ '>': '&gt;',
506
+ '"': '&quot;',
507
+ "'": '&#39;',
508
+ '/': '&#x2F;'
509
+ };
510
+ function escape(data) {
511
+ if (typeof data === 'string') {
512
+ return data.replace(/[&<>"'\/]/g, function (s) {
513
+ return _entityMap[s];
514
+ });
515
+ }
516
+ return data;
517
+ }
518
+ var isIE10 = typeof window !== 'undefined' && window.navigator && typeof window.navigator.userAgentData === 'undefined' && window.navigator.userAgent && window.navigator.userAgent.indexOf('MSIE') > -1;
519
+ var chars = [' ', ',', '?', '!', ';'];
520
+ function looksLikeObjectPath(key, nsSeparator, keySeparator) {
521
+ nsSeparator = nsSeparator || '';
522
+ keySeparator = keySeparator || '';
523
+ var possibleChars = chars.filter(function (c) {
524
+ return nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0;
525
+ });
526
+ if (possibleChars.length === 0) return true;
527
+ var r = new RegExp("(".concat(possibleChars.map(function (c) {
528
+ return c === '?' ? '\\?' : c;
529
+ }).join('|'), ")"));
530
+ var matched = !r.test(key);
531
+ if (!matched) {
532
+ var ki = key.indexOf(keySeparator);
533
+ if (ki > 0 && !r.test(key.substring(0, ki))) {
534
+ matched = true;
535
+ }
536
+ }
537
+ return matched;
538
+ }
539
+ function deepFind(obj, path) {
540
+ var keySeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';
541
+ if (!obj) return undefined;
542
+ if (obj[path]) return obj[path];
543
+ var paths = path.split(keySeparator);
544
+ var current = obj;
545
+ for (var i = 0; i < paths.length; ++i) {
546
+ if (!current) return undefined;
547
+ if (typeof current[paths[i]] === 'string' && i + 1 < paths.length) {
548
+ return undefined;
549
+ }
550
+ if (current[paths[i]] === undefined) {
551
+ var j = 2;
552
+ var p = paths.slice(i, i + j).join(keySeparator);
553
+ var mix = current[p];
554
+ while (mix === undefined && paths.length > i + j) {
555
+ j++;
556
+ p = paths.slice(i, i + j).join(keySeparator);
557
+ mix = current[p];
558
+ }
559
+ if (mix === undefined) return undefined;
560
+ if (mix === null) return null;
561
+ if (path.endsWith(p)) {
562
+ if (typeof mix === 'string') return mix;
563
+ if (p && typeof mix[p] === 'string') return mix[p];
564
+ }
565
+ var joinedPath = paths.slice(i + j).join(keySeparator);
566
+ if (joinedPath) return deepFind(mix, joinedPath, keySeparator);
567
+ return undefined;
568
+ }
569
+ current = current[paths[i]];
570
+ }
571
+ return current;
572
+ }
573
+
574
+ function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
575
+ function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
576
+ function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
577
+ function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
578
+ var ResourceStore = function (_EventEmitter) {
579
+ _inherits(ResourceStore, _EventEmitter);
580
+ var _super = _createSuper$3(ResourceStore);
581
+ function ResourceStore(data) {
582
+ var _this;
583
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
584
+ ns: ['translation'],
585
+ defaultNS: 'translation'
586
+ };
587
+ _classCallCheck$1(this, ResourceStore);
588
+ _this = _super.call(this);
589
+ if (isIE10) {
590
+ EventEmitter.call(_assertThisInitialized(_this));
591
+ }
592
+ _this.data = data || {};
593
+ _this.options = options;
594
+ if (_this.options.keySeparator === undefined) {
595
+ _this.options.keySeparator = '.';
596
+ }
597
+ if (_this.options.ignoreJSONStructure === undefined) {
598
+ _this.options.ignoreJSONStructure = true;
599
+ }
600
+ return _this;
601
+ }
602
+ _createClass$1(ResourceStore, [{
603
+ key: "addNamespaces",
604
+ value: function addNamespaces(ns) {
605
+ if (this.options.ns.indexOf(ns) < 0) {
606
+ this.options.ns.push(ns);
607
+ }
608
+ }
609
+ }, {
610
+ key: "removeNamespaces",
611
+ value: function removeNamespaces(ns) {
612
+ var index = this.options.ns.indexOf(ns);
613
+ if (index > -1) {
614
+ this.options.ns.splice(index, 1);
615
+ }
616
+ }
617
+ }, {
618
+ key: "getResource",
619
+ value: function getResource(lng, ns, key) {
620
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
621
+ var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
622
+ var ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
623
+ var path = [lng, ns];
624
+ if (key && typeof key !== 'string') path = path.concat(key);
625
+ if (key && typeof key === 'string') path = path.concat(keySeparator ? key.split(keySeparator) : key);
626
+ if (lng.indexOf('.') > -1) {
627
+ path = lng.split('.');
628
+ }
629
+ var result = getPath(this.data, path);
630
+ if (result || !ignoreJSONStructure || typeof key !== 'string') return result;
631
+ return deepFind(this.data && this.data[lng] && this.data[lng][ns], key, keySeparator);
632
+ }
633
+ }, {
634
+ key: "addResource",
635
+ value: function addResource(lng, ns, key, value) {
636
+ var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
637
+ silent: false
638
+ };
639
+ var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
640
+ var path = [lng, ns];
641
+ if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
642
+ if (lng.indexOf('.') > -1) {
643
+ path = lng.split('.');
644
+ value = ns;
645
+ ns = path[1];
646
+ }
647
+ this.addNamespaces(ns);
648
+ setPath(this.data, path, value);
649
+ if (!options.silent) this.emit('added', lng, ns, key, value);
650
+ }
651
+ }, {
652
+ key: "addResources",
653
+ value: function addResources(lng, ns, resources) {
654
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
655
+ silent: false
656
+ };
657
+ for (var m in resources) {
658
+ if (typeof resources[m] === 'string' || Object.prototype.toString.apply(resources[m]) === '[object Array]') this.addResource(lng, ns, m, resources[m], {
659
+ silent: true
660
+ });
661
+ }
662
+ if (!options.silent) this.emit('added', lng, ns, resources);
663
+ }
664
+ }, {
665
+ key: "addResourceBundle",
666
+ value: function addResourceBundle(lng, ns, resources, deep, overwrite) {
667
+ var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {
668
+ silent: false
669
+ };
670
+ var path = [lng, ns];
671
+ if (lng.indexOf('.') > -1) {
672
+ path = lng.split('.');
673
+ deep = resources;
674
+ resources = ns;
675
+ ns = path[1];
676
+ }
677
+ this.addNamespaces(ns);
678
+ var pack = getPath(this.data, path) || {};
679
+ if (deep) {
680
+ deepExtend(pack, resources, overwrite);
681
+ } else {
682
+ pack = _objectSpread$5(_objectSpread$5({}, pack), resources);
683
+ }
684
+ setPath(this.data, path, pack);
685
+ if (!options.silent) this.emit('added', lng, ns, resources);
686
+ }
687
+ }, {
688
+ key: "removeResourceBundle",
689
+ value: function removeResourceBundle(lng, ns) {
690
+ if (this.hasResourceBundle(lng, ns)) {
691
+ delete this.data[lng][ns];
692
+ }
693
+ this.removeNamespaces(ns);
694
+ this.emit('removed', lng, ns);
695
+ }
696
+ }, {
697
+ key: "hasResourceBundle",
698
+ value: function hasResourceBundle(lng, ns) {
699
+ return this.getResource(lng, ns) !== undefined;
700
+ }
701
+ }, {
702
+ key: "getResourceBundle",
703
+ value: function getResourceBundle(lng, ns) {
704
+ if (!ns) ns = this.options.defaultNS;
705
+ if (this.options.compatibilityAPI === 'v1') return _objectSpread$5(_objectSpread$5({}, {}), this.getResource(lng, ns));
706
+ return this.getResource(lng, ns);
707
+ }
708
+ }, {
709
+ key: "getDataByLanguage",
710
+ value: function getDataByLanguage(lng) {
711
+ return this.data[lng];
712
+ }
713
+ }, {
714
+ key: "hasLanguageSomeTranslations",
715
+ value: function hasLanguageSomeTranslations(lng) {
716
+ var data = this.getDataByLanguage(lng);
717
+ var n = data && Object.keys(data) || [];
718
+ return !!n.find(function (v) {
719
+ return data[v] && Object.keys(data[v]).length > 0;
720
+ });
721
+ }
722
+ }, {
723
+ key: "toJSON",
724
+ value: function toJSON() {
725
+ return this.data;
726
+ }
727
+ }]);
728
+ return ResourceStore;
729
+ }(EventEmitter);
730
+
731
+ var postProcessor = {
732
+ processors: {},
733
+ addPostProcessor: function addPostProcessor(module) {
734
+ this.processors[module.name] = module;
735
+ },
736
+ handle: function handle(processors, value, key, options, translator) {
737
+ var _this = this;
738
+ processors.forEach(function (processor) {
739
+ if (_this.processors[processor]) value = _this.processors[processor].process(value, key, options, translator);
740
+ });
741
+ return value;
742
+ }
743
+ };
744
+
745
+ function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
746
+ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
747
+ function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
748
+ function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
749
+ var checkedLoadedFor = {};
750
+ var Translator = function (_EventEmitter) {
751
+ _inherits(Translator, _EventEmitter);
752
+ var _super = _createSuper$2(Translator);
753
+ function Translator(services) {
754
+ var _this;
755
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
756
+ _classCallCheck$1(this, Translator);
757
+ _this = _super.call(this);
758
+ if (isIE10) {
759
+ EventEmitter.call(_assertThisInitialized(_this));
760
+ }
761
+ copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, _assertThisInitialized(_this));
762
+ _this.options = options;
763
+ if (_this.options.keySeparator === undefined) {
764
+ _this.options.keySeparator = '.';
765
+ }
766
+ _this.logger = baseLogger.create('translator');
767
+ return _this;
768
+ }
769
+ _createClass$1(Translator, [{
770
+ key: "changeLanguage",
771
+ value: function changeLanguage(lng) {
772
+ if (lng) this.language = lng;
773
+ }
774
+ }, {
775
+ key: "exists",
776
+ value: function exists(key) {
777
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
778
+ interpolation: {}
779
+ };
780
+ if (key === undefined || key === null) {
781
+ return false;
782
+ }
783
+ var resolved = this.resolve(key, options);
784
+ return resolved && resolved.res !== undefined;
785
+ }
786
+ }, {
787
+ key: "extractFromKey",
788
+ value: function extractFromKey(key, options) {
789
+ var nsSeparator = options.nsSeparator !== undefined ? options.nsSeparator : this.options.nsSeparator;
790
+ if (nsSeparator === undefined) nsSeparator = ':';
791
+ var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
792
+ var namespaces = options.ns || this.options.defaultNS || [];
793
+ var wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
794
+ var seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !options.keySeparator && !this.options.userDefinedNsSeparator && !options.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
795
+ if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
796
+ var m = key.match(this.interpolator.nestingRegexp);
797
+ if (m && m.length > 0) {
798
+ return {
799
+ key: key,
800
+ namespaces: namespaces
801
+ };
802
+ }
803
+ var parts = key.split(nsSeparator);
804
+ if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
805
+ key = parts.join(keySeparator);
806
+ }
807
+ if (typeof namespaces === 'string') namespaces = [namespaces];
808
+ return {
809
+ key: key,
810
+ namespaces: namespaces
811
+ };
812
+ }
813
+ }, {
814
+ key: "translate",
815
+ value: function translate(keys, options, lastKey) {
816
+ var _this2 = this;
817
+ if (_typeof$1(options) !== 'object' && this.options.overloadTranslationOptionHandler) {
818
+ options = this.options.overloadTranslationOptionHandler(arguments);
819
+ }
820
+ if (_typeof$1(options) === 'object') options = _objectSpread$4({}, options);
821
+ if (!options) options = {};
822
+ if (keys === undefined || keys === null) return '';
823
+ if (!Array.isArray(keys)) keys = [String(keys)];
824
+ var returnDetails = options.returnDetails !== undefined ? options.returnDetails : this.options.returnDetails;
825
+ var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
826
+ var _this$extractFromKey = this.extractFromKey(keys[keys.length - 1], options),
827
+ key = _this$extractFromKey.key,
828
+ namespaces = _this$extractFromKey.namespaces;
829
+ var namespace = namespaces[namespaces.length - 1];
830
+ var lng = options.lng || this.language;
831
+ var appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
832
+ if (lng && lng.toLowerCase() === 'cimode') {
833
+ if (appendNamespaceToCIMode) {
834
+ var nsSeparator = options.nsSeparator || this.options.nsSeparator;
835
+ if (returnDetails) {
836
+ return {
837
+ res: "".concat(namespace).concat(nsSeparator).concat(key),
838
+ usedKey: key,
839
+ exactUsedKey: key,
840
+ usedLng: lng,
841
+ usedNS: namespace
842
+ };
843
+ }
844
+ return "".concat(namespace).concat(nsSeparator).concat(key);
845
+ }
846
+ if (returnDetails) {
847
+ return {
848
+ res: key,
849
+ usedKey: key,
850
+ exactUsedKey: key,
851
+ usedLng: lng,
852
+ usedNS: namespace
853
+ };
854
+ }
855
+ return key;
856
+ }
857
+ var resolved = this.resolve(keys, options);
858
+ var res = resolved && resolved.res;
859
+ var resUsedKey = resolved && resolved.usedKey || key;
860
+ var resExactUsedKey = resolved && resolved.exactUsedKey || key;
861
+ var resType = Object.prototype.toString.apply(res);
862
+ var noObject = ['[object Number]', '[object Function]', '[object RegExp]'];
863
+ var joinArrays = options.joinArrays !== undefined ? options.joinArrays : this.options.joinArrays;
864
+ var handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
865
+ var handleAsObject = typeof res !== 'string' && typeof res !== 'boolean' && typeof res !== 'number';
866
+ if (handleAsObjectInI18nFormat && res && handleAsObject && noObject.indexOf(resType) < 0 && !(typeof joinArrays === 'string' && resType === '[object Array]')) {
867
+ if (!options.returnObjects && !this.options.returnObjects) {
868
+ if (!this.options.returnedObjectHandler) {
869
+ this.logger.warn('accessing an object - but returnObjects options is not enabled!');
870
+ }
871
+ var r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, _objectSpread$4(_objectSpread$4({}, options), {}, {
872
+ ns: namespaces
873
+ })) : "key '".concat(key, " (").concat(this.language, ")' returned an object instead of string.");
874
+ if (returnDetails) {
875
+ resolved.res = r;
876
+ return resolved;
877
+ }
878
+ return r;
879
+ }
880
+ if (keySeparator) {
881
+ var resTypeIsArray = resType === '[object Array]';
882
+ var copy = resTypeIsArray ? [] : {};
883
+ var newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
884
+ for (var m in res) {
885
+ if (Object.prototype.hasOwnProperty.call(res, m)) {
886
+ var deepKey = "".concat(newKeyToUse).concat(keySeparator).concat(m);
887
+ copy[m] = this.translate(deepKey, _objectSpread$4(_objectSpread$4({}, options), {
888
+ joinArrays: false,
889
+ ns: namespaces
890
+ }));
891
+ if (copy[m] === deepKey) copy[m] = res[m];
892
+ }
893
+ }
894
+ res = copy;
895
+ }
896
+ } else if (handleAsObjectInI18nFormat && typeof joinArrays === 'string' && resType === '[object Array]') {
897
+ res = res.join(joinArrays);
898
+ if (res) res = this.extendTranslation(res, keys, options, lastKey);
899
+ } else {
900
+ var usedDefault = false;
901
+ var usedKey = false;
902
+ var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
903
+ var hasDefaultValue = Translator.hasDefaultValue(options);
904
+ var defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, options) : '';
905
+ var defaultValue = options["defaultValue".concat(defaultValueSuffix)] || options.defaultValue;
906
+ if (!this.isValidLookup(res) && hasDefaultValue) {
907
+ usedDefault = true;
908
+ res = defaultValue;
909
+ }
910
+ if (!this.isValidLookup(res)) {
911
+ usedKey = true;
912
+ res = key;
913
+ }
914
+ var missingKeyNoValueFallbackToKey = options.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
915
+ var resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;
916
+ var updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
917
+ if (usedKey || usedDefault || updateMissing) {
918
+ this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res);
919
+ if (keySeparator) {
920
+ var fk = this.resolve(key, _objectSpread$4(_objectSpread$4({}, options), {}, {
921
+ keySeparator: false
922
+ }));
923
+ if (fk && fk.res) this.logger.warn('Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.');
924
+ }
925
+ var lngs = [];
926
+ var fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language);
927
+ if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {
928
+ for (var i = 0; i < fallbackLngs.length; i++) {
929
+ lngs.push(fallbackLngs[i]);
930
+ }
931
+ } else if (this.options.saveMissingTo === 'all') {
932
+ lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language);
933
+ } else {
934
+ lngs.push(options.lng || this.language);
935
+ }
936
+ var send = function send(l, k, specificDefaultValue) {
937
+ var defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
938
+ if (_this2.options.missingKeyHandler) {
939
+ _this2.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, options);
940
+ } else if (_this2.backendConnector && _this2.backendConnector.saveMissing) {
941
+ _this2.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, options);
942
+ }
943
+ _this2.emit('missingKey', l, namespace, k, res);
944
+ };
945
+ if (this.options.saveMissing) {
946
+ if (this.options.saveMissingPlurals && needsPluralHandling) {
947
+ lngs.forEach(function (language) {
948
+ _this2.pluralResolver.getSuffixes(language, options).forEach(function (suffix) {
949
+ send([language], key + suffix, options["defaultValue".concat(suffix)] || defaultValue);
950
+ });
951
+ });
952
+ } else {
953
+ send(lngs, key, defaultValue);
954
+ }
955
+ }
956
+ }
957
+ res = this.extendTranslation(res, keys, options, resolved, lastKey);
958
+ if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = "".concat(namespace, ":").concat(key);
959
+ if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
960
+ if (this.options.compatibilityAPI !== 'v1') {
961
+ res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? "".concat(namespace, ":").concat(key) : key, usedDefault ? res : undefined);
962
+ } else {
963
+ res = this.options.parseMissingKeyHandler(res);
964
+ }
965
+ }
966
+ }
967
+ if (returnDetails) {
968
+ resolved.res = res;
969
+ return resolved;
970
+ }
971
+ return res;
972
+ }
973
+ }, {
974
+ key: "extendTranslation",
975
+ value: function extendTranslation(res, key, options, resolved, lastKey) {
976
+ var _this3 = this;
977
+ if (this.i18nFormat && this.i18nFormat.parse) {
978
+ res = this.i18nFormat.parse(res, _objectSpread$4(_objectSpread$4({}, this.options.interpolation.defaultVariables), options), resolved.usedLng, resolved.usedNS, resolved.usedKey, {
979
+ resolved: resolved
980
+ });
981
+ } else if (!options.skipInterpolation) {
982
+ if (options.interpolation) this.interpolator.init(_objectSpread$4(_objectSpread$4({}, options), {
983
+ interpolation: _objectSpread$4(_objectSpread$4({}, this.options.interpolation), options.interpolation)
984
+ }));
985
+ var skipOnVariables = typeof res === 'string' && (options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
986
+ var nestBef;
987
+ if (skipOnVariables) {
988
+ var nb = res.match(this.interpolator.nestingRegexp);
989
+ nestBef = nb && nb.length;
990
+ }
991
+ var data = options.replace && typeof options.replace !== 'string' ? options.replace : options;
992
+ if (this.options.interpolation.defaultVariables) data = _objectSpread$4(_objectSpread$4({}, this.options.interpolation.defaultVariables), data);
993
+ res = this.interpolator.interpolate(res, data, options.lng || this.language, options);
994
+ if (skipOnVariables) {
995
+ var na = res.match(this.interpolator.nestingRegexp);
996
+ var nestAft = na && na.length;
997
+ if (nestBef < nestAft) options.nest = false;
998
+ }
999
+ if (!options.lng && this.options.compatibilityAPI !== 'v1' && resolved && resolved.res) options.lng = resolved.usedLng;
1000
+ if (options.nest !== false) res = this.interpolator.nest(res, function () {
1001
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1002
+ args[_key] = arguments[_key];
1003
+ }
1004
+ if (lastKey && lastKey[0] === args[0] && !options.context) {
1005
+ _this3.logger.warn("It seems you are nesting recursively key: ".concat(args[0], " in key: ").concat(key[0]));
1006
+ return null;
1007
+ }
1008
+ return _this3.translate.apply(_this3, args.concat([key]));
1009
+ }, options);
1010
+ if (options.interpolation) this.interpolator.reset();
1011
+ }
1012
+ var postProcess = options.postProcess || this.options.postProcess;
1013
+ var postProcessorNames = typeof postProcess === 'string' ? [postProcess] : postProcess;
1014
+ if (res !== undefined && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) {
1015
+ res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? _objectSpread$4({
1016
+ i18nResolved: resolved
1017
+ }, options) : options, this);
1018
+ }
1019
+ return res;
1020
+ }
1021
+ }, {
1022
+ key: "resolve",
1023
+ value: function resolve(keys) {
1024
+ var _this4 = this;
1025
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1026
+ var found;
1027
+ var usedKey;
1028
+ var exactUsedKey;
1029
+ var usedLng;
1030
+ var usedNS;
1031
+ if (typeof keys === 'string') keys = [keys];
1032
+ keys.forEach(function (k) {
1033
+ if (_this4.isValidLookup(found)) return;
1034
+ var extracted = _this4.extractFromKey(k, options);
1035
+ var key = extracted.key;
1036
+ usedKey = key;
1037
+ var namespaces = extracted.namespaces;
1038
+ if (_this4.options.fallbackNS) namespaces = namespaces.concat(_this4.options.fallbackNS);
1039
+ var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
1040
+ var needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0 && _this4.pluralResolver.shouldUseIntlApi();
1041
+ var needsContextHandling = options.context !== undefined && (typeof options.context === 'string' || typeof options.context === 'number') && options.context !== '';
1042
+ var codes = options.lngs ? options.lngs : _this4.languageUtils.toResolveHierarchy(options.lng || _this4.language, options.fallbackLng);
1043
+ namespaces.forEach(function (ns) {
1044
+ if (_this4.isValidLookup(found)) return;
1045
+ usedNS = ns;
1046
+ if (!checkedLoadedFor["".concat(codes[0], "-").concat(ns)] && _this4.utils && _this4.utils.hasLoadedNamespace && !_this4.utils.hasLoadedNamespace(usedNS)) {
1047
+ checkedLoadedFor["".concat(codes[0], "-").concat(ns)] = true;
1048
+ _this4.logger.warn("key \"".concat(usedKey, "\" for languages \"").concat(codes.join(', '), "\" won't get resolved as namespace \"").concat(usedNS, "\" was not yet loaded"), 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!');
1049
+ }
1050
+ codes.forEach(function (code) {
1051
+ if (_this4.isValidLookup(found)) return;
1052
+ usedLng = code;
1053
+ var finalKeys = [key];
1054
+ if (_this4.i18nFormat && _this4.i18nFormat.addLookupKeys) {
1055
+ _this4.i18nFormat.addLookupKeys(finalKeys, key, code, ns, options);
1056
+ } else {
1057
+ var pluralSuffix;
1058
+ if (needsPluralHandling) pluralSuffix = _this4.pluralResolver.getSuffix(code, options.count, options);
1059
+ var zeroSuffix = "".concat(_this4.options.pluralSeparator, "zero");
1060
+ if (needsPluralHandling) {
1061
+ finalKeys.push(key + pluralSuffix);
1062
+ if (needsZeroSuffixLookup) {
1063
+ finalKeys.push(key + zeroSuffix);
1064
+ }
1065
+ }
1066
+ if (needsContextHandling) {
1067
+ var contextKey = "".concat(key).concat(_this4.options.contextSeparator).concat(options.context);
1068
+ finalKeys.push(contextKey);
1069
+ if (needsPluralHandling) {
1070
+ finalKeys.push(contextKey + pluralSuffix);
1071
+ if (needsZeroSuffixLookup) {
1072
+ finalKeys.push(contextKey + zeroSuffix);
1073
+ }
1074
+ }
1075
+ }
1076
+ }
1077
+ var possibleKey;
1078
+ while (possibleKey = finalKeys.pop()) {
1079
+ if (!_this4.isValidLookup(found)) {
1080
+ exactUsedKey = possibleKey;
1081
+ found = _this4.getResource(code, ns, possibleKey, options);
1082
+ }
1083
+ }
1084
+ });
1085
+ });
1086
+ });
1087
+ return {
1088
+ res: found,
1089
+ usedKey: usedKey,
1090
+ exactUsedKey: exactUsedKey,
1091
+ usedLng: usedLng,
1092
+ usedNS: usedNS
1093
+ };
1094
+ }
1095
+ }, {
1096
+ key: "isValidLookup",
1097
+ value: function isValidLookup(res) {
1098
+ return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === '');
1099
+ }
1100
+ }, {
1101
+ key: "getResource",
1102
+ value: function getResource(code, ns, key) {
1103
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1104
+ if (this.i18nFormat && this.i18nFormat.getResource) return this.i18nFormat.getResource(code, ns, key, options);
1105
+ return this.resourceStore.getResource(code, ns, key, options);
1106
+ }
1107
+ }], [{
1108
+ key: "hasDefaultValue",
1109
+ value: function hasDefaultValue(options) {
1110
+ var prefix = 'defaultValue';
1111
+ for (var option in options) {
1112
+ if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {
1113
+ return true;
1114
+ }
1115
+ }
1116
+ return false;
1117
+ }
1118
+ }]);
1119
+ return Translator;
1120
+ }(EventEmitter);
1121
+
1122
+ function capitalize(string) {
1123
+ return string.charAt(0).toUpperCase() + string.slice(1);
1124
+ }
1125
+ var LanguageUtil = function () {
1126
+ function LanguageUtil(options) {
1127
+ _classCallCheck$1(this, LanguageUtil);
1128
+ this.options = options;
1129
+ this.supportedLngs = this.options.supportedLngs || false;
1130
+ this.logger = baseLogger.create('languageUtils');
1131
+ }
1132
+ _createClass$1(LanguageUtil, [{
1133
+ key: "getScriptPartFromCode",
1134
+ value: function getScriptPartFromCode(code) {
1135
+ if (!code || code.indexOf('-') < 0) return null;
1136
+ var p = code.split('-');
1137
+ if (p.length === 2) return null;
1138
+ p.pop();
1139
+ if (p[p.length - 1].toLowerCase() === 'x') return null;
1140
+ return this.formatLanguageCode(p.join('-'));
1141
+ }
1142
+ }, {
1143
+ key: "getLanguagePartFromCode",
1144
+ value: function getLanguagePartFromCode(code) {
1145
+ if (!code || code.indexOf('-') < 0) return code;
1146
+ var p = code.split('-');
1147
+ return this.formatLanguageCode(p[0]);
1148
+ }
1149
+ }, {
1150
+ key: "formatLanguageCode",
1151
+ value: function formatLanguageCode(code) {
1152
+ if (typeof code === 'string' && code.indexOf('-') > -1) {
1153
+ var specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab'];
1154
+ var p = code.split('-');
1155
+ if (this.options.lowerCaseLng) {
1156
+ p = p.map(function (part) {
1157
+ return part.toLowerCase();
1158
+ });
1159
+ } else if (p.length === 2) {
1160
+ p[0] = p[0].toLowerCase();
1161
+ p[1] = p[1].toUpperCase();
1162
+ if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());
1163
+ } else if (p.length === 3) {
1164
+ p[0] = p[0].toLowerCase();
1165
+ if (p[1].length === 2) p[1] = p[1].toUpperCase();
1166
+ if (p[0] !== 'sgn' && p[2].length === 2) p[2] = p[2].toUpperCase();
1167
+ if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());
1168
+ if (specialCases.indexOf(p[2].toLowerCase()) > -1) p[2] = capitalize(p[2].toLowerCase());
1169
+ }
1170
+ return p.join('-');
1171
+ }
1172
+ return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
1173
+ }
1174
+ }, {
1175
+ key: "isSupportedCode",
1176
+ value: function isSupportedCode(code) {
1177
+ if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {
1178
+ code = this.getLanguagePartFromCode(code);
1179
+ }
1180
+ return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
1181
+ }
1182
+ }, {
1183
+ key: "getBestMatchFromCodes",
1184
+ value: function getBestMatchFromCodes(codes) {
1185
+ var _this = this;
1186
+ if (!codes) return null;
1187
+ var found;
1188
+ codes.forEach(function (code) {
1189
+ if (found) return;
1190
+ var cleanedLng = _this.formatLanguageCode(code);
1191
+ if (!_this.options.supportedLngs || _this.isSupportedCode(cleanedLng)) found = cleanedLng;
1192
+ });
1193
+ if (!found && this.options.supportedLngs) {
1194
+ codes.forEach(function (code) {
1195
+ if (found) return;
1196
+ var lngOnly = _this.getLanguagePartFromCode(code);
1197
+ if (_this.isSupportedCode(lngOnly)) return found = lngOnly;
1198
+ found = _this.options.supportedLngs.find(function (supportedLng) {
1199
+ if (supportedLng === lngOnly) return supportedLng;
1200
+ if (supportedLng.indexOf('-') < 0 && lngOnly.indexOf('-') < 0) return;
1201
+ if (supportedLng.indexOf(lngOnly) === 0) return supportedLng;
1202
+ });
1203
+ });
1204
+ }
1205
+ if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];
1206
+ return found;
1207
+ }
1208
+ }, {
1209
+ key: "getFallbackCodes",
1210
+ value: function getFallbackCodes(fallbacks, code) {
1211
+ if (!fallbacks) return [];
1212
+ if (typeof fallbacks === 'function') fallbacks = fallbacks(code);
1213
+ if (typeof fallbacks === 'string') fallbacks = [fallbacks];
1214
+ if (Object.prototype.toString.apply(fallbacks) === '[object Array]') return fallbacks;
1215
+ if (!code) return fallbacks["default"] || [];
1216
+ var found = fallbacks[code];
1217
+ if (!found) found = fallbacks[this.getScriptPartFromCode(code)];
1218
+ if (!found) found = fallbacks[this.formatLanguageCode(code)];
1219
+ if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];
1220
+ if (!found) found = fallbacks["default"];
1221
+ return found || [];
1222
+ }
1223
+ }, {
1224
+ key: "toResolveHierarchy",
1225
+ value: function toResolveHierarchy(code, fallbackCode) {
1226
+ var _this2 = this;
1227
+ var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);
1228
+ var codes = [];
1229
+ var addCode = function addCode(c) {
1230
+ if (!c) return;
1231
+ if (_this2.isSupportedCode(c)) {
1232
+ codes.push(c);
1233
+ } else {
1234
+ _this2.logger.warn("rejecting language code not found in supportedLngs: ".concat(c));
1235
+ }
1236
+ };
1237
+ if (typeof code === 'string' && code.indexOf('-') > -1) {
1238
+ if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
1239
+ if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
1240
+ if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));
1241
+ } else if (typeof code === 'string') {
1242
+ addCode(this.formatLanguageCode(code));
1243
+ }
1244
+ fallbackCodes.forEach(function (fc) {
1245
+ if (codes.indexOf(fc) < 0) addCode(_this2.formatLanguageCode(fc));
1246
+ });
1247
+ return codes;
1248
+ }
1249
+ }]);
1250
+ return LanguageUtil;
1251
+ }();
1252
+
1253
+ var sets = [{
1254
+ lngs: ['ach', 'ak', 'am', 'arn', 'br', 'fil', 'gun', 'ln', 'mfe', 'mg', 'mi', 'oc', 'pt', 'pt-BR', 'tg', 'tl', 'ti', 'tr', 'uz', 'wa'],
1255
+ nr: [1, 2],
1256
+ fc: 1
1257
+ }, {
1258
+ lngs: ['af', 'an', 'ast', 'az', 'bg', 'bn', 'ca', 'da', 'de', 'dev', 'el', 'en', 'eo', 'es', 'et', 'eu', 'fi', 'fo', 'fur', 'fy', 'gl', 'gu', 'ha', 'hi', 'hu', 'hy', 'ia', 'it', 'kk', 'kn', 'ku', 'lb', 'mai', 'ml', 'mn', 'mr', 'nah', 'nap', 'nb', 'ne', 'nl', 'nn', 'no', 'nso', 'pa', 'pap', 'pms', 'ps', 'pt-PT', 'rm', 'sco', 'se', 'si', 'so', 'son', 'sq', 'sv', 'sw', 'ta', 'te', 'tk', 'ur', 'yo'],
1259
+ nr: [1, 2],
1260
+ fc: 2
1261
+ }, {
1262
+ lngs: ['ay', 'bo', 'cgg', 'fa', 'ht', 'id', 'ja', 'jbo', 'ka', 'km', 'ko', 'ky', 'lo', 'ms', 'sah', 'su', 'th', 'tt', 'ug', 'vi', 'wo', 'zh'],
1263
+ nr: [1],
1264
+ fc: 3
1265
+ }, {
1266
+ lngs: ['be', 'bs', 'cnr', 'dz', 'hr', 'ru', 'sr', 'uk'],
1267
+ nr: [1, 2, 5],
1268
+ fc: 4
1269
+ }, {
1270
+ lngs: ['ar'],
1271
+ nr: [0, 1, 2, 3, 11, 100],
1272
+ fc: 5
1273
+ }, {
1274
+ lngs: ['cs', 'sk'],
1275
+ nr: [1, 2, 5],
1276
+ fc: 6
1277
+ }, {
1278
+ lngs: ['csb', 'pl'],
1279
+ nr: [1, 2, 5],
1280
+ fc: 7
1281
+ }, {
1282
+ lngs: ['cy'],
1283
+ nr: [1, 2, 3, 8],
1284
+ fc: 8
1285
+ }, {
1286
+ lngs: ['fr'],
1287
+ nr: [1, 2],
1288
+ fc: 9
1289
+ }, {
1290
+ lngs: ['ga'],
1291
+ nr: [1, 2, 3, 7, 11],
1292
+ fc: 10
1293
+ }, {
1294
+ lngs: ['gd'],
1295
+ nr: [1, 2, 3, 20],
1296
+ fc: 11
1297
+ }, {
1298
+ lngs: ['is'],
1299
+ nr: [1, 2],
1300
+ fc: 12
1301
+ }, {
1302
+ lngs: ['jv'],
1303
+ nr: [0, 1],
1304
+ fc: 13
1305
+ }, {
1306
+ lngs: ['kw'],
1307
+ nr: [1, 2, 3, 4],
1308
+ fc: 14
1309
+ }, {
1310
+ lngs: ['lt'],
1311
+ nr: [1, 2, 10],
1312
+ fc: 15
1313
+ }, {
1314
+ lngs: ['lv'],
1315
+ nr: [1, 2, 0],
1316
+ fc: 16
1317
+ }, {
1318
+ lngs: ['mk'],
1319
+ nr: [1, 2],
1320
+ fc: 17
1321
+ }, {
1322
+ lngs: ['mnk'],
1323
+ nr: [0, 1, 2],
1324
+ fc: 18
1325
+ }, {
1326
+ lngs: ['mt'],
1327
+ nr: [1, 2, 11, 20],
1328
+ fc: 19
1329
+ }, {
1330
+ lngs: ['or'],
1331
+ nr: [2, 1],
1332
+ fc: 2
1333
+ }, {
1334
+ lngs: ['ro'],
1335
+ nr: [1, 2, 20],
1336
+ fc: 20
1337
+ }, {
1338
+ lngs: ['sl'],
1339
+ nr: [5, 1, 2, 3],
1340
+ fc: 21
1341
+ }, {
1342
+ lngs: ['he', 'iw'],
1343
+ nr: [1, 2, 20, 21],
1344
+ fc: 22
1345
+ }];
1346
+ var _rulesPluralsTypes = {
1347
+ 1: function _(n) {
1348
+ return Number(n > 1);
1349
+ },
1350
+ 2: function _(n) {
1351
+ return Number(n != 1);
1352
+ },
1353
+ 3: function _(n) {
1354
+ return 0;
1355
+ },
1356
+ 4: function _(n) {
1357
+ return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
1358
+ },
1359
+ 5: function _(n) {
1360
+ return Number(n == 0 ? 0 : n == 1 ? 1 : n == 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5);
1361
+ },
1362
+ 6: function _(n) {
1363
+ return Number(n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2);
1364
+ },
1365
+ 7: function _(n) {
1366
+ return Number(n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
1367
+ },
1368
+ 8: function _(n) {
1369
+ return Number(n == 1 ? 0 : n == 2 ? 1 : n != 8 && n != 11 ? 2 : 3);
1370
+ },
1371
+ 9: function _(n) {
1372
+ return Number(n >= 2);
1373
+ },
1374
+ 10: function _(n) {
1375
+ return Number(n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4);
1376
+ },
1377
+ 11: function _(n) {
1378
+ return Number(n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 2 && n < 20 ? 2 : 3);
1379
+ },
1380
+ 12: function _(n) {
1381
+ return Number(n % 10 != 1 || n % 100 == 11);
1382
+ },
1383
+ 13: function _(n) {
1384
+ return Number(n !== 0);
1385
+ },
1386
+ 14: function _(n) {
1387
+ return Number(n == 1 ? 0 : n == 2 ? 1 : n == 3 ? 2 : 3);
1388
+ },
1389
+ 15: function _(n) {
1390
+ return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
1391
+ },
1392
+ 16: function _(n) {
1393
+ return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n !== 0 ? 1 : 2);
1394
+ },
1395
+ 17: function _(n) {
1396
+ return Number(n == 1 || n % 10 == 1 && n % 100 != 11 ? 0 : 1);
1397
+ },
1398
+ 18: function _(n) {
1399
+ return Number(n == 0 ? 0 : n == 1 ? 1 : 2);
1400
+ },
1401
+ 19: function _(n) {
1402
+ return Number(n == 1 ? 0 : n == 0 || n % 100 > 1 && n % 100 < 11 ? 1 : n % 100 > 10 && n % 100 < 20 ? 2 : 3);
1403
+ },
1404
+ 20: function _(n) {
1405
+ return Number(n == 1 ? 0 : n == 0 || n % 100 > 0 && n % 100 < 20 ? 1 : 2);
1406
+ },
1407
+ 21: function _(n) {
1408
+ return Number(n % 100 == 1 ? 1 : n % 100 == 2 ? 2 : n % 100 == 3 || n % 100 == 4 ? 3 : 0);
1409
+ },
1410
+ 22: function _(n) {
1411
+ return Number(n == 1 ? 0 : n == 2 ? 1 : (n < 0 || n > 10) && n % 10 == 0 ? 2 : 3);
1412
+ }
1413
+ };
1414
+ var deprecatedJsonVersions = ['v1', 'v2', 'v3'];
1415
+ var suffixesOrder = {
1416
+ zero: 0,
1417
+ one: 1,
1418
+ two: 2,
1419
+ few: 3,
1420
+ many: 4,
1421
+ other: 5
1422
+ };
1423
+ function createRules() {
1424
+ var rules = {};
1425
+ sets.forEach(function (set) {
1426
+ set.lngs.forEach(function (l) {
1427
+ rules[l] = {
1428
+ numbers: set.nr,
1429
+ plurals: _rulesPluralsTypes[set.fc]
1430
+ };
1431
+ });
1432
+ });
1433
+ return rules;
1434
+ }
1435
+ var PluralResolver = function () {
1436
+ function PluralResolver(languageUtils) {
1437
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1438
+ _classCallCheck$1(this, PluralResolver);
1439
+ this.languageUtils = languageUtils;
1440
+ this.options = options;
1441
+ this.logger = baseLogger.create('pluralResolver');
1442
+ if ((!this.options.compatibilityJSON || this.options.compatibilityJSON === 'v4') && (typeof Intl === 'undefined' || !Intl.PluralRules)) {
1443
+ this.options.compatibilityJSON = 'v3';
1444
+ this.logger.error('Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.');
1445
+ }
1446
+ this.rules = createRules();
1447
+ }
1448
+ _createClass$1(PluralResolver, [{
1449
+ key: "addRule",
1450
+ value: function addRule(lng, obj) {
1451
+ this.rules[lng] = obj;
1452
+ }
1453
+ }, {
1454
+ key: "getRule",
1455
+ value: function getRule(code) {
1456
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1457
+ if (this.shouldUseIntlApi()) {
1458
+ try {
1459
+ return new Intl.PluralRules(code, {
1460
+ type: options.ordinal ? 'ordinal' : 'cardinal'
1461
+ });
1462
+ } catch (_unused) {
1463
+ return;
1464
+ }
1465
+ }
1466
+ return this.rules[code] || this.rules[this.languageUtils.getLanguagePartFromCode(code)];
1467
+ }
1468
+ }, {
1469
+ key: "needsPlural",
1470
+ value: function needsPlural(code) {
1471
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1472
+ var rule = this.getRule(code, options);
1473
+ if (this.shouldUseIntlApi()) {
1474
+ return rule && rule.resolvedOptions().pluralCategories.length > 1;
1475
+ }
1476
+ return rule && rule.numbers.length > 1;
1477
+ }
1478
+ }, {
1479
+ key: "getPluralFormsOfKey",
1480
+ value: function getPluralFormsOfKey(code, key) {
1481
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1482
+ return this.getSuffixes(code, options).map(function (suffix) {
1483
+ return "".concat(key).concat(suffix);
1484
+ });
1485
+ }
1486
+ }, {
1487
+ key: "getSuffixes",
1488
+ value: function getSuffixes(code) {
1489
+ var _this = this;
1490
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1491
+ var rule = this.getRule(code, options);
1492
+ if (!rule) {
1493
+ return [];
1494
+ }
1495
+ if (this.shouldUseIntlApi()) {
1496
+ return rule.resolvedOptions().pluralCategories.sort(function (pluralCategory1, pluralCategory2) {
1497
+ return suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2];
1498
+ }).map(function (pluralCategory) {
1499
+ return "".concat(_this.options.prepend).concat(pluralCategory);
1500
+ });
1501
+ }
1502
+ return rule.numbers.map(function (number) {
1503
+ return _this.getSuffix(code, number, options);
1504
+ });
1505
+ }
1506
+ }, {
1507
+ key: "getSuffix",
1508
+ value: function getSuffix(code, count) {
1509
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1510
+ var rule = this.getRule(code, options);
1511
+ if (rule) {
1512
+ if (this.shouldUseIntlApi()) {
1513
+ return "".concat(this.options.prepend).concat(rule.select(count));
1514
+ }
1515
+ return this.getSuffixRetroCompatible(rule, count);
1516
+ }
1517
+ this.logger.warn("no plural rule found for: ".concat(code));
1518
+ return '';
1519
+ }
1520
+ }, {
1521
+ key: "getSuffixRetroCompatible",
1522
+ value: function getSuffixRetroCompatible(rule, count) {
1523
+ var _this2 = this;
1524
+ var idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));
1525
+ var suffix = rule.numbers[idx];
1526
+ if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
1527
+ if (suffix === 2) {
1528
+ suffix = 'plural';
1529
+ } else if (suffix === 1) {
1530
+ suffix = '';
1531
+ }
1532
+ }
1533
+ var returnSuffix = function returnSuffix() {
1534
+ return _this2.options.prepend && suffix.toString() ? _this2.options.prepend + suffix.toString() : suffix.toString();
1535
+ };
1536
+ if (this.options.compatibilityJSON === 'v1') {
1537
+ if (suffix === 1) return '';
1538
+ if (typeof suffix === 'number') return "_plural_".concat(suffix.toString());
1539
+ return returnSuffix();
1540
+ } else if (this.options.compatibilityJSON === 'v2') {
1541
+ return returnSuffix();
1542
+ } else if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
1543
+ return returnSuffix();
1544
+ }
1545
+ return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString();
1546
+ }
1547
+ }, {
1548
+ key: "shouldUseIntlApi",
1549
+ value: function shouldUseIntlApi() {
1550
+ return !deprecatedJsonVersions.includes(this.options.compatibilityJSON);
1551
+ }
1552
+ }]);
1553
+ return PluralResolver;
1554
+ }();
1555
+
1556
+ function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1557
+ function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1558
+ function deepFindWithDefaults(data, defaultData, key) {
1559
+ var keySeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '.';
1560
+ var ignoreJSONStructure = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
1561
+ var path = getPathWithDefaults(data, defaultData, key);
1562
+ if (!path && ignoreJSONStructure && typeof key === 'string') {
1563
+ path = deepFind(data, key, keySeparator);
1564
+ if (path === undefined) path = deepFind(defaultData, key, keySeparator);
1565
+ }
1566
+ return path;
1567
+ }
1568
+ var Interpolator = function () {
1569
+ function Interpolator() {
1570
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1571
+ _classCallCheck$1(this, Interpolator);
1572
+ this.logger = baseLogger.create('interpolator');
1573
+ this.options = options;
1574
+ this.format = options.interpolation && options.interpolation.format || function (value) {
1575
+ return value;
1576
+ };
1577
+ this.init(options);
1578
+ }
1579
+ _createClass$1(Interpolator, [{
1580
+ key: "init",
1581
+ value: function init() {
1582
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1583
+ if (!options.interpolation) options.interpolation = {
1584
+ escapeValue: true
1585
+ };
1586
+ var iOpts = options.interpolation;
1587
+ this.escape = iOpts.escape !== undefined ? iOpts.escape : escape;
1588
+ this.escapeValue = iOpts.escapeValue !== undefined ? iOpts.escapeValue : true;
1589
+ this.useRawValueToEscape = iOpts.useRawValueToEscape !== undefined ? iOpts.useRawValueToEscape : false;
1590
+ this.prefix = iOpts.prefix ? regexEscape(iOpts.prefix) : iOpts.prefixEscaped || '{{';
1591
+ this.suffix = iOpts.suffix ? regexEscape(iOpts.suffix) : iOpts.suffixEscaped || '}}';
1592
+ this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';
1593
+ this.unescapePrefix = iOpts.unescapeSuffix ? '' : iOpts.unescapePrefix || '-';
1594
+ this.unescapeSuffix = this.unescapePrefix ? '' : iOpts.unescapeSuffix || '';
1595
+ this.nestingPrefix = iOpts.nestingPrefix ? regexEscape(iOpts.nestingPrefix) : iOpts.nestingPrefixEscaped || regexEscape('$t(');
1596
+ this.nestingSuffix = iOpts.nestingSuffix ? regexEscape(iOpts.nestingSuffix) : iOpts.nestingSuffixEscaped || regexEscape(')');
1597
+ this.nestingOptionsSeparator = iOpts.nestingOptionsSeparator ? iOpts.nestingOptionsSeparator : iOpts.nestingOptionsSeparator || ',';
1598
+ this.maxReplaces = iOpts.maxReplaces ? iOpts.maxReplaces : 1000;
1599
+ this.alwaysFormat = iOpts.alwaysFormat !== undefined ? iOpts.alwaysFormat : false;
1600
+ this.resetRegExp();
1601
+ }
1602
+ }, {
1603
+ key: "reset",
1604
+ value: function reset() {
1605
+ if (this.options) this.init(this.options);
1606
+ }
1607
+ }, {
1608
+ key: "resetRegExp",
1609
+ value: function resetRegExp() {
1610
+ var regexpStr = "".concat(this.prefix, "(.+?)").concat(this.suffix);
1611
+ this.regexp = new RegExp(regexpStr, 'g');
1612
+ var regexpUnescapeStr = "".concat(this.prefix).concat(this.unescapePrefix, "(.+?)").concat(this.unescapeSuffix).concat(this.suffix);
1613
+ this.regexpUnescape = new RegExp(regexpUnescapeStr, 'g');
1614
+ var nestingRegexpStr = "".concat(this.nestingPrefix, "(.+?)").concat(this.nestingSuffix);
1615
+ this.nestingRegexp = new RegExp(nestingRegexpStr, 'g');
1616
+ }
1617
+ }, {
1618
+ key: "interpolate",
1619
+ value: function interpolate(str, data, lng, options) {
1620
+ var _this = this;
1621
+ var match;
1622
+ var value;
1623
+ var replaces;
1624
+ var defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
1625
+ function regexSafe(val) {
1626
+ return val.replace(/\$/g, '$$$$');
1627
+ }
1628
+ var handleFormat = function handleFormat(key) {
1629
+ if (key.indexOf(_this.formatSeparator) < 0) {
1630
+ var path = deepFindWithDefaults(data, defaultData, key, _this.options.keySeparator, _this.options.ignoreJSONStructure);
1631
+ return _this.alwaysFormat ? _this.format(path, undefined, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
1632
+ interpolationkey: key
1633
+ })) : path;
1634
+ }
1635
+ var p = key.split(_this.formatSeparator);
1636
+ var k = p.shift().trim();
1637
+ var f = p.join(_this.formatSeparator).trim();
1638
+ return _this.format(deepFindWithDefaults(data, defaultData, k, _this.options.keySeparator, _this.options.ignoreJSONStructure), f, lng, _objectSpread$3(_objectSpread$3(_objectSpread$3({}, options), data), {}, {
1639
+ interpolationkey: k
1640
+ }));
1641
+ };
1642
+ this.resetRegExp();
1643
+ var missingInterpolationHandler = options && options.missingInterpolationHandler || this.options.missingInterpolationHandler;
1644
+ var skipOnVariables = options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
1645
+ var todos = [{
1646
+ regex: this.regexpUnescape,
1647
+ safeValue: function safeValue(val) {
1648
+ return regexSafe(val);
1649
+ }
1650
+ }, {
1651
+ regex: this.regexp,
1652
+ safeValue: function safeValue(val) {
1653
+ return _this.escapeValue ? regexSafe(_this.escape(val)) : regexSafe(val);
1654
+ }
1655
+ }];
1656
+ todos.forEach(function (todo) {
1657
+ replaces = 0;
1658
+ while (match = todo.regex.exec(str)) {
1659
+ var matchedVar = match[1].trim();
1660
+ value = handleFormat(matchedVar);
1661
+ if (value === undefined) {
1662
+ if (typeof missingInterpolationHandler === 'function') {
1663
+ var temp = missingInterpolationHandler(str, match, options);
1664
+ value = typeof temp === 'string' ? temp : '';
1665
+ } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
1666
+ value = '';
1667
+ } else if (skipOnVariables) {
1668
+ value = match[0];
1669
+ continue;
1670
+ } else {
1671
+ _this.logger.warn("missed to pass in variable ".concat(matchedVar, " for interpolating ").concat(str));
1672
+ value = '';
1673
+ }
1674
+ } else if (typeof value !== 'string' && !_this.useRawValueToEscape) {
1675
+ value = makeString(value);
1676
+ }
1677
+ var safeValue = todo.safeValue(value);
1678
+ str = str.replace(match[0], safeValue);
1679
+ if (skipOnVariables) {
1680
+ todo.regex.lastIndex += value.length;
1681
+ todo.regex.lastIndex -= match[0].length;
1682
+ } else {
1683
+ todo.regex.lastIndex = 0;
1684
+ }
1685
+ replaces++;
1686
+ if (replaces >= _this.maxReplaces) {
1687
+ break;
1688
+ }
1689
+ }
1690
+ });
1691
+ return str;
1692
+ }
1693
+ }, {
1694
+ key: "nest",
1695
+ value: function nest(str, fc) {
1696
+ var _this2 = this;
1697
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1698
+ var match;
1699
+ var value;
1700
+ var clonedOptions;
1701
+ function handleHasOptions(key, inheritedOptions) {
1702
+ var sep = this.nestingOptionsSeparator;
1703
+ if (key.indexOf(sep) < 0) return key;
1704
+ var c = key.split(new RegExp("".concat(sep, "[ ]*{")));
1705
+ var optionsString = "{".concat(c[1]);
1706
+ key = c[0];
1707
+ optionsString = this.interpolate(optionsString, clonedOptions);
1708
+ var matchedSingleQuotes = optionsString.match(/'/g);
1709
+ var matchedDoubleQuotes = optionsString.match(/"/g);
1710
+ if (matchedSingleQuotes && matchedSingleQuotes.length % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {
1711
+ optionsString = optionsString.replace(/'/g, '"');
1712
+ }
1713
+ try {
1714
+ clonedOptions = JSON.parse(optionsString);
1715
+ if (inheritedOptions) clonedOptions = _objectSpread$3(_objectSpread$3({}, inheritedOptions), clonedOptions);
1716
+ } catch (e) {
1717
+ this.logger.warn("failed parsing options string in nesting for key ".concat(key), e);
1718
+ return "".concat(key).concat(sep).concat(optionsString);
1719
+ }
1720
+ delete clonedOptions.defaultValue;
1721
+ return key;
1722
+ }
1723
+ while (match = this.nestingRegexp.exec(str)) {
1724
+ var formatters = [];
1725
+ clonedOptions = _objectSpread$3({}, options);
1726
+ clonedOptions = clonedOptions.replace && typeof clonedOptions.replace !== 'string' ? clonedOptions.replace : clonedOptions;
1727
+ clonedOptions.applyPostProcessor = false;
1728
+ delete clonedOptions.defaultValue;
1729
+ var doReduce = false;
1730
+ if (match[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(match[1])) {
1731
+ var r = match[1].split(this.formatSeparator).map(function (elem) {
1732
+ return elem.trim();
1733
+ });
1734
+ match[1] = r.shift();
1735
+ formatters = r;
1736
+ doReduce = true;
1737
+ }
1738
+ value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
1739
+ if (value && match[0] === str && typeof value !== 'string') return value;
1740
+ if (typeof value !== 'string') value = makeString(value);
1741
+ if (!value) {
1742
+ this.logger.warn("missed to resolve ".concat(match[1], " for nesting ").concat(str));
1743
+ value = '';
1744
+ }
1745
+ if (doReduce) {
1746
+ value = formatters.reduce(function (v, f) {
1747
+ return _this2.format(v, f, options.lng, _objectSpread$3(_objectSpread$3({}, options), {}, {
1748
+ interpolationkey: match[1].trim()
1749
+ }));
1750
+ }, value.trim());
1751
+ }
1752
+ str = str.replace(match[0], value);
1753
+ this.regexp.lastIndex = 0;
1754
+ }
1755
+ return str;
1756
+ }
1757
+ }]);
1758
+ return Interpolator;
1759
+ }();
1760
+
1761
+ function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1762
+ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1763
+ function parseFormatStr(formatStr) {
1764
+ var formatName = formatStr.toLowerCase().trim();
1765
+ var formatOptions = {};
1766
+ if (formatStr.indexOf('(') > -1) {
1767
+ var p = formatStr.split('(');
1768
+ formatName = p[0].toLowerCase().trim();
1769
+ var optStr = p[1].substring(0, p[1].length - 1);
1770
+ if (formatName === 'currency' && optStr.indexOf(':') < 0) {
1771
+ if (!formatOptions.currency) formatOptions.currency = optStr.trim();
1772
+ } else if (formatName === 'relativetime' && optStr.indexOf(':') < 0) {
1773
+ if (!formatOptions.range) formatOptions.range = optStr.trim();
1774
+ } else {
1775
+ var opts = optStr.split(';');
1776
+ opts.forEach(function (opt) {
1777
+ if (!opt) return;
1778
+ var _opt$split = opt.split(':'),
1779
+ _opt$split2 = _toArray(_opt$split),
1780
+ key = _opt$split2[0],
1781
+ rest = _opt$split2.slice(1);
1782
+ var val = rest.join(':').trim().replace(/^'+|'+$/g, '');
1783
+ if (!formatOptions[key.trim()]) formatOptions[key.trim()] = val;
1784
+ if (val === 'false') formatOptions[key.trim()] = false;
1785
+ if (val === 'true') formatOptions[key.trim()] = true;
1786
+ if (!isNaN(val)) formatOptions[key.trim()] = parseInt(val, 10);
1787
+ });
1788
+ }
1789
+ }
1790
+ return {
1791
+ formatName: formatName,
1792
+ formatOptions: formatOptions
1793
+ };
1794
+ }
1795
+ function createCachedFormatter(fn) {
1796
+ var cache = {};
1797
+ return function invokeFormatter(val, lng, options) {
1798
+ var key = lng + JSON.stringify(options);
1799
+ var formatter = cache[key];
1800
+ if (!formatter) {
1801
+ formatter = fn(lng, options);
1802
+ cache[key] = formatter;
1803
+ }
1804
+ return formatter(val);
1805
+ };
1806
+ }
1807
+ var Formatter = function () {
1808
+ function Formatter() {
1809
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1810
+ _classCallCheck$1(this, Formatter);
1811
+ this.logger = baseLogger.create('formatter');
1812
+ this.options = options;
1813
+ this.formats = {
1814
+ number: createCachedFormatter(function (lng, opt) {
1815
+ var formatter = new Intl.NumberFormat(lng, _objectSpread$2({}, opt));
1816
+ return function (val) {
1817
+ return formatter.format(val);
1818
+ };
1819
+ }),
1820
+ currency: createCachedFormatter(function (lng, opt) {
1821
+ var formatter = new Intl.NumberFormat(lng, _objectSpread$2(_objectSpread$2({}, opt), {}, {
1822
+ style: 'currency'
1823
+ }));
1824
+ return function (val) {
1825
+ return formatter.format(val);
1826
+ };
1827
+ }),
1828
+ datetime: createCachedFormatter(function (lng, opt) {
1829
+ var formatter = new Intl.DateTimeFormat(lng, _objectSpread$2({}, opt));
1830
+ return function (val) {
1831
+ return formatter.format(val);
1832
+ };
1833
+ }),
1834
+ relativetime: createCachedFormatter(function (lng, opt) {
1835
+ var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread$2({}, opt));
1836
+ return function (val) {
1837
+ return formatter.format(val, opt.range || 'day');
1838
+ };
1839
+ }),
1840
+ list: createCachedFormatter(function (lng, opt) {
1841
+ var formatter = new Intl.ListFormat(lng, _objectSpread$2({}, opt));
1842
+ return function (val) {
1843
+ return formatter.format(val);
1844
+ };
1845
+ })
1846
+ };
1847
+ this.init(options);
1848
+ }
1849
+ _createClass$1(Formatter, [{
1850
+ key: "init",
1851
+ value: function init(services) {
1852
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
1853
+ interpolation: {}
1854
+ };
1855
+ var iOpts = options.interpolation;
1856
+ this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';
1857
+ }
1858
+ }, {
1859
+ key: "add",
1860
+ value: function add(name, fc) {
1861
+ this.formats[name.toLowerCase().trim()] = fc;
1862
+ }
1863
+ }, {
1864
+ key: "addCached",
1865
+ value: function addCached(name, fc) {
1866
+ this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
1867
+ }
1868
+ }, {
1869
+ key: "format",
1870
+ value: function format(value, _format, lng) {
1871
+ var _this = this;
1872
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1873
+ var formats = _format.split(this.formatSeparator);
1874
+ var result = formats.reduce(function (mem, f) {
1875
+ var _parseFormatStr = parseFormatStr(f),
1876
+ formatName = _parseFormatStr.formatName,
1877
+ formatOptions = _parseFormatStr.formatOptions;
1878
+ if (_this.formats[formatName]) {
1879
+ var formatted = mem;
1880
+ try {
1881
+ var valOptions = options && options.formatParams && options.formatParams[options.interpolationkey] || {};
1882
+ var l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
1883
+ formatted = _this.formats[formatName](mem, l, _objectSpread$2(_objectSpread$2(_objectSpread$2({}, formatOptions), options), valOptions));
1884
+ } catch (error) {
1885
+ _this.logger.warn(error);
1886
+ }
1887
+ return formatted;
1888
+ } else {
1889
+ _this.logger.warn("there was no format function for ".concat(formatName));
1890
+ }
1891
+ return mem;
1892
+ }, value);
1893
+ return result;
1894
+ }
1895
+ }]);
1896
+ return Formatter;
1897
+ }();
1898
+
1899
+ function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1900
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1901
+ function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1902
+ function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1903
+ function removePending(q, name) {
1904
+ if (q.pending[name] !== undefined) {
1905
+ delete q.pending[name];
1906
+ q.pendingCount--;
1907
+ }
1908
+ }
1909
+ var Connector = function (_EventEmitter) {
1910
+ _inherits(Connector, _EventEmitter);
1911
+ var _super = _createSuper$1(Connector);
1912
+ function Connector(backend, store, services) {
1913
+ var _this;
1914
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1915
+ _classCallCheck$1(this, Connector);
1916
+ _this = _super.call(this);
1917
+ if (isIE10) {
1918
+ EventEmitter.call(_assertThisInitialized(_this));
1919
+ }
1920
+ _this.backend = backend;
1921
+ _this.store = store;
1922
+ _this.services = services;
1923
+ _this.languageUtils = services.languageUtils;
1924
+ _this.options = options;
1925
+ _this.logger = baseLogger.create('backendConnector');
1926
+ _this.waitingReads = [];
1927
+ _this.maxParallelReads = options.maxParallelReads || 10;
1928
+ _this.readingCalls = 0;
1929
+ _this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
1930
+ _this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
1931
+ _this.state = {};
1932
+ _this.queue = [];
1933
+ if (_this.backend && _this.backend.init) {
1934
+ _this.backend.init(services, options.backend, options);
1935
+ }
1936
+ return _this;
1937
+ }
1938
+ _createClass$1(Connector, [{
1939
+ key: "queueLoad",
1940
+ value: function queueLoad(languages, namespaces, options, callback) {
1941
+ var _this2 = this;
1942
+ var toLoad = {};
1943
+ var pending = {};
1944
+ var toLoadLanguages = {};
1945
+ var toLoadNamespaces = {};
1946
+ languages.forEach(function (lng) {
1947
+ var hasAllNamespaces = true;
1948
+ namespaces.forEach(function (ns) {
1949
+ var name = "".concat(lng, "|").concat(ns);
1950
+ if (!options.reload && _this2.store.hasResourceBundle(lng, ns)) {
1951
+ _this2.state[name] = 2;
1952
+ } else if (_this2.state[name] < 0) ; else if (_this2.state[name] === 1) {
1953
+ if (pending[name] === undefined) pending[name] = true;
1954
+ } else {
1955
+ _this2.state[name] = 1;
1956
+ hasAllNamespaces = false;
1957
+ if (pending[name] === undefined) pending[name] = true;
1958
+ if (toLoad[name] === undefined) toLoad[name] = true;
1959
+ if (toLoadNamespaces[ns] === undefined) toLoadNamespaces[ns] = true;
1960
+ }
1961
+ });
1962
+ if (!hasAllNamespaces) toLoadLanguages[lng] = true;
1963
+ });
1964
+ if (Object.keys(toLoad).length || Object.keys(pending).length) {
1965
+ this.queue.push({
1966
+ pending: pending,
1967
+ pendingCount: Object.keys(pending).length,
1968
+ loaded: {},
1969
+ errors: [],
1970
+ callback: callback
1971
+ });
1972
+ }
1973
+ return {
1974
+ toLoad: Object.keys(toLoad),
1975
+ pending: Object.keys(pending),
1976
+ toLoadLanguages: Object.keys(toLoadLanguages),
1977
+ toLoadNamespaces: Object.keys(toLoadNamespaces)
1978
+ };
1979
+ }
1980
+ }, {
1981
+ key: "loaded",
1982
+ value: function loaded(name, err, data) {
1983
+ var s = name.split('|');
1984
+ var lng = s[0];
1985
+ var ns = s[1];
1986
+ if (err) this.emit('failedLoading', lng, ns, err);
1987
+ if (data) {
1988
+ this.store.addResourceBundle(lng, ns, data);
1989
+ }
1990
+ this.state[name] = err ? -1 : 2;
1991
+ var loaded = {};
1992
+ this.queue.forEach(function (q) {
1993
+ pushPath(q.loaded, [lng], ns);
1994
+ removePending(q, name);
1995
+ if (err) q.errors.push(err);
1996
+ if (q.pendingCount === 0 && !q.done) {
1997
+ Object.keys(q.loaded).forEach(function (l) {
1998
+ if (!loaded[l]) loaded[l] = {};
1999
+ var loadedKeys = q.loaded[l];
2000
+ if (loadedKeys.length) {
2001
+ loadedKeys.forEach(function (n) {
2002
+ if (loaded[l][n] === undefined) loaded[l][n] = true;
2003
+ });
2004
+ }
2005
+ });
2006
+ q.done = true;
2007
+ if (q.errors.length) {
2008
+ q.callback(q.errors);
2009
+ } else {
2010
+ q.callback();
2011
+ }
2012
+ }
2013
+ });
2014
+ this.emit('loaded', loaded);
2015
+ this.queue = this.queue.filter(function (q) {
2016
+ return !q.done;
2017
+ });
2018
+ }
2019
+ }, {
2020
+ key: "read",
2021
+ value: function read(lng, ns, fcName) {
2022
+ var _this3 = this;
2023
+ var tried = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
2024
+ var wait = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : this.retryTimeout;
2025
+ var callback = arguments.length > 5 ? arguments[5] : undefined;
2026
+ if (!lng.length) return callback(null, {});
2027
+ if (this.readingCalls >= this.maxParallelReads) {
2028
+ this.waitingReads.push({
2029
+ lng: lng,
2030
+ ns: ns,
2031
+ fcName: fcName,
2032
+ tried: tried,
2033
+ wait: wait,
2034
+ callback: callback
2035
+ });
2036
+ return;
2037
+ }
2038
+ this.readingCalls++;
2039
+ var resolver = function resolver(err, data) {
2040
+ _this3.readingCalls--;
2041
+ if (_this3.waitingReads.length > 0) {
2042
+ var next = _this3.waitingReads.shift();
2043
+ _this3.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
2044
+ }
2045
+ if (err && data && tried < _this3.maxRetries) {
2046
+ setTimeout(function () {
2047
+ _this3.read.call(_this3, lng, ns, fcName, tried + 1, wait * 2, callback);
2048
+ }, wait);
2049
+ return;
2050
+ }
2051
+ callback(err, data);
2052
+ };
2053
+ var fc = this.backend[fcName].bind(this.backend);
2054
+ if (fc.length === 2) {
2055
+ try {
2056
+ var r = fc(lng, ns);
2057
+ if (r && typeof r.then === 'function') {
2058
+ r.then(function (data) {
2059
+ return resolver(null, data);
2060
+ })["catch"](resolver);
2061
+ } else {
2062
+ resolver(null, r);
2063
+ }
2064
+ } catch (err) {
2065
+ resolver(err);
2066
+ }
2067
+ return;
2068
+ }
2069
+ return fc(lng, ns, resolver);
2070
+ }
2071
+ }, {
2072
+ key: "prepareLoading",
2073
+ value: function prepareLoading(languages, namespaces) {
2074
+ var _this4 = this;
2075
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2076
+ var callback = arguments.length > 3 ? arguments[3] : undefined;
2077
+ if (!this.backend) {
2078
+ this.logger.warn('No backend was added via i18next.use. Will not load resources.');
2079
+ return callback && callback();
2080
+ }
2081
+ if (typeof languages === 'string') languages = this.languageUtils.toResolveHierarchy(languages);
2082
+ if (typeof namespaces === 'string') namespaces = [namespaces];
2083
+ var toLoad = this.queueLoad(languages, namespaces, options, callback);
2084
+ if (!toLoad.toLoad.length) {
2085
+ if (!toLoad.pending.length) callback();
2086
+ return null;
2087
+ }
2088
+ toLoad.toLoad.forEach(function (name) {
2089
+ _this4.loadOne(name);
2090
+ });
2091
+ }
2092
+ }, {
2093
+ key: "load",
2094
+ value: function load(languages, namespaces, callback) {
2095
+ this.prepareLoading(languages, namespaces, {}, callback);
2096
+ }
2097
+ }, {
2098
+ key: "reload",
2099
+ value: function reload(languages, namespaces, callback) {
2100
+ this.prepareLoading(languages, namespaces, {
2101
+ reload: true
2102
+ }, callback);
2103
+ }
2104
+ }, {
2105
+ key: "loadOne",
2106
+ value: function loadOne(name) {
2107
+ var _this5 = this;
2108
+ var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
2109
+ var s = name.split('|');
2110
+ var lng = s[0];
2111
+ var ns = s[1];
2112
+ this.read(lng, ns, 'read', undefined, undefined, function (err, data) {
2113
+ if (err) _this5.logger.warn("".concat(prefix, "loading namespace ").concat(ns, " for language ").concat(lng, " failed"), err);
2114
+ if (!err && data) _this5.logger.log("".concat(prefix, "loaded namespace ").concat(ns, " for language ").concat(lng), data);
2115
+ _this5.loaded(name, err, data);
2116
+ });
2117
+ }
2118
+ }, {
2119
+ key: "saveMissing",
2120
+ value: function saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
2121
+ var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
2122
+ var clb = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : function () {};
2123
+ if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(namespace)) {
2124
+ this.logger.warn("did not save key \"".concat(key, "\" as the namespace \"").concat(namespace, "\" was not yet loaded"), 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!');
2125
+ return;
2126
+ }
2127
+ if (key === undefined || key === null || key === '') return;
2128
+ if (this.backend && this.backend.create) {
2129
+ var opts = _objectSpread$1(_objectSpread$1({}, options), {}, {
2130
+ isUpdate: isUpdate
2131
+ });
2132
+ var fc = this.backend.create.bind(this.backend);
2133
+ if (fc.length < 6) {
2134
+ try {
2135
+ var r;
2136
+ if (fc.length === 5) {
2137
+ r = fc(languages, namespace, key, fallbackValue, opts);
2138
+ } else {
2139
+ r = fc(languages, namespace, key, fallbackValue);
2140
+ }
2141
+ if (r && typeof r.then === 'function') {
2142
+ r.then(function (data) {
2143
+ return clb(null, data);
2144
+ })["catch"](clb);
2145
+ } else {
2146
+ clb(null, r);
2147
+ }
2148
+ } catch (err) {
2149
+ clb(err);
2150
+ }
2151
+ } else {
2152
+ fc(languages, namespace, key, fallbackValue, clb, opts);
2153
+ }
2154
+ }
2155
+ if (!languages || !languages[0]) return;
2156
+ this.store.addResource(languages[0], namespace, key, fallbackValue);
2157
+ }
2158
+ }]);
2159
+ return Connector;
2160
+ }(EventEmitter);
2161
+
2162
+ function get() {
2163
+ return {
2164
+ debug: false,
2165
+ initImmediate: true,
2166
+ ns: ['translation'],
2167
+ defaultNS: ['translation'],
2168
+ fallbackLng: ['dev'],
2169
+ fallbackNS: false,
2170
+ supportedLngs: false,
2171
+ nonExplicitSupportedLngs: false,
2172
+ load: 'all',
2173
+ preload: false,
2174
+ simplifyPluralSuffix: true,
2175
+ keySeparator: '.',
2176
+ nsSeparator: ':',
2177
+ pluralSeparator: '_',
2178
+ contextSeparator: '_',
2179
+ partialBundledLanguages: false,
2180
+ saveMissing: false,
2181
+ updateMissing: false,
2182
+ saveMissingTo: 'fallback',
2183
+ saveMissingPlurals: true,
2184
+ missingKeyHandler: false,
2185
+ missingInterpolationHandler: false,
2186
+ postProcess: false,
2187
+ postProcessPassResolved: false,
2188
+ returnNull: true,
2189
+ returnEmptyString: true,
2190
+ returnObjects: false,
2191
+ joinArrays: false,
2192
+ returnedObjectHandler: false,
2193
+ parseMissingKeyHandler: false,
2194
+ appendNamespaceToMissingKey: false,
2195
+ appendNamespaceToCIMode: false,
2196
+ overloadTranslationOptionHandler: function handle(args) {
2197
+ var ret = {};
2198
+ if (_typeof$1(args[1]) === 'object') ret = args[1];
2199
+ if (typeof args[1] === 'string') ret.defaultValue = args[1];
2200
+ if (typeof args[2] === 'string') ret.tDescription = args[2];
2201
+ if (_typeof$1(args[2]) === 'object' || _typeof$1(args[3]) === 'object') {
2202
+ var options = args[3] || args[2];
2203
+ Object.keys(options).forEach(function (key) {
2204
+ ret[key] = options[key];
2205
+ });
2206
+ }
2207
+ return ret;
2208
+ },
2209
+ interpolation: {
2210
+ escapeValue: true,
2211
+ format: function format(value, _format, lng, options) {
2212
+ return value;
2213
+ },
2214
+ prefix: '{{',
2215
+ suffix: '}}',
2216
+ formatSeparator: ',',
2217
+ unescapePrefix: '-',
2218
+ nestingPrefix: '$t(',
2219
+ nestingSuffix: ')',
2220
+ nestingOptionsSeparator: ',',
2221
+ maxReplaces: 1000,
2222
+ skipOnVariables: true
2223
+ }
2224
+ };
2225
+ }
2226
+ function transformOptions(options) {
2227
+ if (typeof options.ns === 'string') options.ns = [options.ns];
2228
+ if (typeof options.fallbackLng === 'string') options.fallbackLng = [options.fallbackLng];
2229
+ if (typeof options.fallbackNS === 'string') options.fallbackNS = [options.fallbackNS];
2230
+ if (options.supportedLngs && options.supportedLngs.indexOf('cimode') < 0) {
2231
+ options.supportedLngs = options.supportedLngs.concat(['cimode']);
2232
+ }
2233
+ return options;
2234
+ }
2235
+
2236
+ function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2237
+ function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$7(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2238
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
2239
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
2240
+ function noop() {}
2241
+ function bindMemberFunctions(inst) {
2242
+ var mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
2243
+ mems.forEach(function (mem) {
2244
+ if (typeof inst[mem] === 'function') {
2245
+ inst[mem] = inst[mem].bind(inst);
2246
+ }
2247
+ });
2248
+ }
2249
+ var I18n = function (_EventEmitter) {
2250
+ _inherits(I18n, _EventEmitter);
2251
+ var _super = _createSuper(I18n);
2252
+ function I18n() {
2253
+ var _this;
2254
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2255
+ var callback = arguments.length > 1 ? arguments[1] : undefined;
2256
+ _classCallCheck$1(this, I18n);
2257
+ _this = _super.call(this);
2258
+ if (isIE10) {
2259
+ EventEmitter.call(_assertThisInitialized(_this));
2260
+ }
2261
+ _this.options = transformOptions(options);
2262
+ _this.services = {};
2263
+ _this.logger = baseLogger;
2264
+ _this.modules = {
2265
+ external: []
2266
+ };
2267
+ bindMemberFunctions(_assertThisInitialized(_this));
2268
+ if (callback && !_this.isInitialized && !options.isClone) {
2269
+ if (!_this.options.initImmediate) {
2270
+ _this.init(options, callback);
2271
+ return _possibleConstructorReturn(_this, _assertThisInitialized(_this));
2272
+ }
2273
+ setTimeout(function () {
2274
+ _this.init(options, callback);
2275
+ }, 0);
2276
+ }
2277
+ return _this;
2278
+ }
2279
+ _createClass$1(I18n, [{
2280
+ key: "init",
2281
+ value: function init() {
2282
+ var _this2 = this;
2283
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2284
+ var callback = arguments.length > 1 ? arguments[1] : undefined;
2285
+ if (typeof options === 'function') {
2286
+ callback = options;
2287
+ options = {};
2288
+ }
2289
+ if (!options.defaultNS && options.defaultNS !== false && options.ns) {
2290
+ if (typeof options.ns === 'string') {
2291
+ options.defaultNS = options.ns;
2292
+ } else if (options.ns.indexOf('translation') < 0) {
2293
+ options.defaultNS = options.ns[0];
2294
+ }
2295
+ }
2296
+ var defOpts = get();
2297
+ this.options = _objectSpread$7(_objectSpread$7(_objectSpread$7({}, defOpts), this.options), transformOptions(options));
2298
+ if (this.options.compatibilityAPI !== 'v1') {
2299
+ this.options.interpolation = _objectSpread$7(_objectSpread$7({}, defOpts.interpolation), this.options.interpolation);
2300
+ }
2301
+ if (options.keySeparator !== undefined) {
2302
+ this.options.userDefinedKeySeparator = options.keySeparator;
2303
+ }
2304
+ if (options.nsSeparator !== undefined) {
2305
+ this.options.userDefinedNsSeparator = options.nsSeparator;
2306
+ }
2307
+ function createClassOnDemand(ClassOrObject) {
2308
+ if (!ClassOrObject) return null;
2309
+ if (typeof ClassOrObject === 'function') return new ClassOrObject();
2310
+ return ClassOrObject;
2311
+ }
2312
+ if (!this.options.isClone) {
2313
+ if (this.modules.logger) {
2314
+ baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
2315
+ } else {
2316
+ baseLogger.init(null, this.options);
2317
+ }
2318
+ var formatter;
2319
+ if (this.modules.formatter) {
2320
+ formatter = this.modules.formatter;
2321
+ } else if (typeof Intl !== 'undefined') {
2322
+ formatter = Formatter;
2323
+ }
2324
+ var lu = new LanguageUtil(this.options);
2325
+ this.store = new ResourceStore(this.options.resources, this.options);
2326
+ var s = this.services;
2327
+ s.logger = baseLogger;
2328
+ s.resourceStore = this.store;
2329
+ s.languageUtils = lu;
2330
+ s.pluralResolver = new PluralResolver(lu, {
2331
+ prepend: this.options.pluralSeparator,
2332
+ compatibilityJSON: this.options.compatibilityJSON,
2333
+ simplifyPluralSuffix: this.options.simplifyPluralSuffix
2334
+ });
2335
+ if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
2336
+ s.formatter = createClassOnDemand(formatter);
2337
+ s.formatter.init(s, this.options);
2338
+ this.options.interpolation.format = s.formatter.format.bind(s.formatter);
2339
+ }
2340
+ s.interpolator = new Interpolator(this.options);
2341
+ s.utils = {
2342
+ hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
2343
+ };
2344
+ s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
2345
+ s.backendConnector.on('*', function (event) {
2346
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2347
+ args[_key - 1] = arguments[_key];
2348
+ }
2349
+ _this2.emit.apply(_this2, [event].concat(args));
2350
+ });
2351
+ if (this.modules.languageDetector) {
2352
+ s.languageDetector = createClassOnDemand(this.modules.languageDetector);
2353
+ if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options);
2354
+ }
2355
+ if (this.modules.i18nFormat) {
2356
+ s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
2357
+ if (s.i18nFormat.init) s.i18nFormat.init(this);
2358
+ }
2359
+ this.translator = new Translator(this.services, this.options);
2360
+ this.translator.on('*', function (event) {
2361
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2362
+ args[_key2 - 1] = arguments[_key2];
2363
+ }
2364
+ _this2.emit.apply(_this2, [event].concat(args));
2365
+ });
2366
+ this.modules.external.forEach(function (m) {
2367
+ if (m.init) m.init(_this2);
2368
+ });
2369
+ }
2370
+ this.format = this.options.interpolation.format;
2371
+ if (!callback) callback = noop;
2372
+ if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
2373
+ var codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
2374
+ if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0];
2375
+ }
2376
+ if (!this.services.languageDetector && !this.options.lng) {
2377
+ this.logger.warn('init: no languageDetector is used and no lng is defined');
2378
+ }
2379
+ var storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];
2380
+ storeApi.forEach(function (fcName) {
2381
+ _this2[fcName] = function () {
2382
+ var _this2$store;
2383
+ return (_this2$store = _this2.store)[fcName].apply(_this2$store, arguments);
2384
+ };
2385
+ });
2386
+ var storeApiChained = ['addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle'];
2387
+ storeApiChained.forEach(function (fcName) {
2388
+ _this2[fcName] = function () {
2389
+ var _this2$store2;
2390
+ (_this2$store2 = _this2.store)[fcName].apply(_this2$store2, arguments);
2391
+ return _this2;
2392
+ };
2393
+ });
2394
+ var deferred = defer();
2395
+ var load = function load() {
2396
+ var finish = function finish(err, t) {
2397
+ if (_this2.isInitialized && !_this2.initializedStoreOnce) _this2.logger.warn('init: i18next is already initialized. You should call init just once!');
2398
+ _this2.isInitialized = true;
2399
+ if (!_this2.options.isClone) _this2.logger.log('initialized', _this2.options);
2400
+ _this2.emit('initialized', _this2.options);
2401
+ deferred.resolve(t);
2402
+ callback(err, t);
2403
+ };
2404
+ if (_this2.languages && _this2.options.compatibilityAPI !== 'v1' && !_this2.isInitialized) return finish(null, _this2.t.bind(_this2));
2405
+ _this2.changeLanguage(_this2.options.lng, finish);
2406
+ };
2407
+ if (this.options.resources || !this.options.initImmediate) {
2408
+ load();
2409
+ } else {
2410
+ setTimeout(load, 0);
2411
+ }
2412
+ return deferred;
2413
+ }
2414
+ }, {
2415
+ key: "loadResources",
2416
+ value: function loadResources(language) {
2417
+ var _this3 = this;
2418
+ var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
2419
+ var usedCallback = callback;
2420
+ var usedLng = typeof language === 'string' ? language : this.language;
2421
+ if (typeof language === 'function') usedCallback = language;
2422
+ if (!this.options.resources || this.options.partialBundledLanguages) {
2423
+ if (usedLng && usedLng.toLowerCase() === 'cimode') return usedCallback();
2424
+ var toLoad = [];
2425
+ var append = function append(lng) {
2426
+ if (!lng) return;
2427
+ var lngs = _this3.services.languageUtils.toResolveHierarchy(lng);
2428
+ lngs.forEach(function (l) {
2429
+ if (toLoad.indexOf(l) < 0) toLoad.push(l);
2430
+ });
2431
+ };
2432
+ if (!usedLng) {
2433
+ var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
2434
+ fallbacks.forEach(function (l) {
2435
+ return append(l);
2436
+ });
2437
+ } else {
2438
+ append(usedLng);
2439
+ }
2440
+ if (this.options.preload) {
2441
+ this.options.preload.forEach(function (l) {
2442
+ return append(l);
2443
+ });
2444
+ }
2445
+ this.services.backendConnector.load(toLoad, this.options.ns, function (e) {
2446
+ if (!e && !_this3.resolvedLanguage && _this3.language) _this3.setResolvedLanguage(_this3.language);
2447
+ usedCallback(e);
2448
+ });
2449
+ } else {
2450
+ usedCallback(null);
2451
+ }
2452
+ }
2453
+ }, {
2454
+ key: "reloadResources",
2455
+ value: function reloadResources(lngs, ns, callback) {
2456
+ var deferred = defer();
2457
+ if (!lngs) lngs = this.languages;
2458
+ if (!ns) ns = this.options.ns;
2459
+ if (!callback) callback = noop;
2460
+ this.services.backendConnector.reload(lngs, ns, function (err) {
2461
+ deferred.resolve();
2462
+ callback(err);
2463
+ });
2464
+ return deferred;
2465
+ }
2466
+ }, {
2467
+ key: "use",
2468
+ value: function use(module) {
2469
+ if (!module) throw new Error('You are passing an undefined module! Please check the object you are passing to i18next.use()');
2470
+ if (!module.type) throw new Error('You are passing a wrong module! Please check the object you are passing to i18next.use()');
2471
+ if (module.type === 'backend') {
2472
+ this.modules.backend = module;
2473
+ }
2474
+ if (module.type === 'logger' || module.log && module.warn && module.error) {
2475
+ this.modules.logger = module;
2476
+ }
2477
+ if (module.type === 'languageDetector') {
2478
+ this.modules.languageDetector = module;
2479
+ }
2480
+ if (module.type === 'i18nFormat') {
2481
+ this.modules.i18nFormat = module;
2482
+ }
2483
+ if (module.type === 'postProcessor') {
2484
+ postProcessor.addPostProcessor(module);
2485
+ }
2486
+ if (module.type === 'formatter') {
2487
+ this.modules.formatter = module;
2488
+ }
2489
+ if (module.type === '3rdParty') {
2490
+ this.modules.external.push(module);
2491
+ }
2492
+ return this;
2493
+ }
2494
+ }, {
2495
+ key: "setResolvedLanguage",
2496
+ value: function setResolvedLanguage(l) {
2497
+ if (!l || !this.languages) return;
2498
+ if (['cimode', 'dev'].indexOf(l) > -1) return;
2499
+ for (var li = 0; li < this.languages.length; li++) {
2500
+ var lngInLngs = this.languages[li];
2501
+ if (['cimode', 'dev'].indexOf(lngInLngs) > -1) continue;
2502
+ if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
2503
+ this.resolvedLanguage = lngInLngs;
2504
+ break;
2505
+ }
2506
+ }
2507
+ }
2508
+ }, {
2509
+ key: "changeLanguage",
2510
+ value: function changeLanguage(lng, callback) {
2511
+ var _this4 = this;
2512
+ this.isLanguageChangingTo = lng;
2513
+ var deferred = defer();
2514
+ this.emit('languageChanging', lng);
2515
+ var setLngProps = function setLngProps(l) {
2516
+ _this4.language = l;
2517
+ _this4.languages = _this4.services.languageUtils.toResolveHierarchy(l);
2518
+ _this4.resolvedLanguage = undefined;
2519
+ _this4.setResolvedLanguage(l);
2520
+ };
2521
+ var done = function done(err, l) {
2522
+ if (l) {
2523
+ setLngProps(l);
2524
+ _this4.translator.changeLanguage(l);
2525
+ _this4.isLanguageChangingTo = undefined;
2526
+ _this4.emit('languageChanged', l);
2527
+ _this4.logger.log('languageChanged', l);
2528
+ } else {
2529
+ _this4.isLanguageChangingTo = undefined;
2530
+ }
2531
+ deferred.resolve(function () {
2532
+ return _this4.t.apply(_this4, arguments);
2533
+ });
2534
+ if (callback) callback(err, function () {
2535
+ return _this4.t.apply(_this4, arguments);
2536
+ });
2537
+ };
2538
+ var setLng = function setLng(lngs) {
2539
+ if (!lng && !lngs && _this4.services.languageDetector) lngs = [];
2540
+ var l = typeof lngs === 'string' ? lngs : _this4.services.languageUtils.getBestMatchFromCodes(lngs);
2541
+ if (l) {
2542
+ if (!_this4.language) {
2543
+ setLngProps(l);
2544
+ }
2545
+ if (!_this4.translator.language) _this4.translator.changeLanguage(l);
2546
+ if (_this4.services.languageDetector && _this4.services.languageDetector.cacheUserLanguage) _this4.services.languageDetector.cacheUserLanguage(l);
2547
+ }
2548
+ _this4.loadResources(l, function (err) {
2549
+ done(err, l);
2550
+ });
2551
+ };
2552
+ if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
2553
+ setLng(this.services.languageDetector.detect());
2554
+ } else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
2555
+ if (this.services.languageDetector.detect.length === 0) {
2556
+ this.services.languageDetector.detect().then(setLng);
2557
+ } else {
2558
+ this.services.languageDetector.detect(setLng);
2559
+ }
2560
+ } else {
2561
+ setLng(lng);
2562
+ }
2563
+ return deferred;
2564
+ }
2565
+ }, {
2566
+ key: "getFixedT",
2567
+ value: function getFixedT(lng, ns, keyPrefix) {
2568
+ var _this5 = this;
2569
+ var fixedT = function fixedT(key, opts) {
2570
+ var options;
2571
+ if (_typeof$1(opts) !== 'object') {
2572
+ for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
2573
+ rest[_key3 - 2] = arguments[_key3];
2574
+ }
2575
+ options = _this5.options.overloadTranslationOptionHandler([key, opts].concat(rest));
2576
+ } else {
2577
+ options = _objectSpread$7({}, opts);
2578
+ }
2579
+ options.lng = options.lng || fixedT.lng;
2580
+ options.lngs = options.lngs || fixedT.lngs;
2581
+ options.ns = options.ns || fixedT.ns;
2582
+ options.keyPrefix = options.keyPrefix || keyPrefix || fixedT.keyPrefix;
2583
+ var keySeparator = _this5.options.keySeparator || '.';
2584
+ var resultKey;
2585
+ if (options.keyPrefix && Array.isArray(key)) {
2586
+ resultKey = key.map(function (k) {
2587
+ return "".concat(options.keyPrefix).concat(keySeparator).concat(k);
2588
+ });
2589
+ } else {
2590
+ resultKey = options.keyPrefix ? "".concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
2591
+ }
2592
+ return _this5.t(resultKey, options);
2593
+ };
2594
+ if (typeof lng === 'string') {
2595
+ fixedT.lng = lng;
2596
+ } else {
2597
+ fixedT.lngs = lng;
2598
+ }
2599
+ fixedT.ns = ns;
2600
+ fixedT.keyPrefix = keyPrefix;
2601
+ return fixedT;
2602
+ }
2603
+ }, {
2604
+ key: "t",
2605
+ value: function t() {
2606
+ var _this$translator;
2607
+ return this.translator && (_this$translator = this.translator).translate.apply(_this$translator, arguments);
2608
+ }
2609
+ }, {
2610
+ key: "exists",
2611
+ value: function exists() {
2612
+ var _this$translator2;
2613
+ return this.translator && (_this$translator2 = this.translator).exists.apply(_this$translator2, arguments);
2614
+ }
2615
+ }, {
2616
+ key: "setDefaultNamespace",
2617
+ value: function setDefaultNamespace(ns) {
2618
+ this.options.defaultNS = ns;
2619
+ }
2620
+ }, {
2621
+ key: "hasLoadedNamespace",
2622
+ value: function hasLoadedNamespace(ns) {
2623
+ var _this6 = this;
2624
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2625
+ if (!this.isInitialized) {
2626
+ this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);
2627
+ return false;
2628
+ }
2629
+ if (!this.languages || !this.languages.length) {
2630
+ this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);
2631
+ return false;
2632
+ }
2633
+ var lng = options.lng || this.resolvedLanguage || this.languages[0];
2634
+ var fallbackLng = this.options ? this.options.fallbackLng : false;
2635
+ var lastLng = this.languages[this.languages.length - 1];
2636
+ if (lng.toLowerCase() === 'cimode') return true;
2637
+ var loadNotPending = function loadNotPending(l, n) {
2638
+ var loadState = _this6.services.backendConnector.state["".concat(l, "|").concat(n)];
2639
+ return loadState === -1 || loadState === 2;
2640
+ };
2641
+ if (options.precheck) {
2642
+ var preResult = options.precheck(this, loadNotPending);
2643
+ if (preResult !== undefined) return preResult;
2644
+ }
2645
+ if (this.hasResourceBundle(lng, ns)) return true;
2646
+ if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return true;
2647
+ if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
2648
+ return false;
2649
+ }
2650
+ }, {
2651
+ key: "loadNamespaces",
2652
+ value: function loadNamespaces(ns, callback) {
2653
+ var _this7 = this;
2654
+ var deferred = defer();
2655
+ if (!this.options.ns) {
2656
+ if (callback) callback();
2657
+ return Promise.resolve();
2658
+ }
2659
+ if (typeof ns === 'string') ns = [ns];
2660
+ ns.forEach(function (n) {
2661
+ if (_this7.options.ns.indexOf(n) < 0) _this7.options.ns.push(n);
2662
+ });
2663
+ this.loadResources(function (err) {
2664
+ deferred.resolve();
2665
+ if (callback) callback(err);
2666
+ });
2667
+ return deferred;
2668
+ }
2669
+ }, {
2670
+ key: "loadLanguages",
2671
+ value: function loadLanguages(lngs, callback) {
2672
+ var deferred = defer();
2673
+ if (typeof lngs === 'string') lngs = [lngs];
2674
+ var preloaded = this.options.preload || [];
2675
+ var newLngs = lngs.filter(function (lng) {
2676
+ return preloaded.indexOf(lng) < 0;
2677
+ });
2678
+ if (!newLngs.length) {
2679
+ if (callback) callback();
2680
+ return Promise.resolve();
2681
+ }
2682
+ this.options.preload = preloaded.concat(newLngs);
2683
+ this.loadResources(function (err) {
2684
+ deferred.resolve();
2685
+ if (callback) callback(err);
2686
+ });
2687
+ return deferred;
2688
+ }
2689
+ }, {
2690
+ key: "dir",
2691
+ value: function dir(lng) {
2692
+ if (!lng) lng = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language);
2693
+ if (!lng) return 'rtl';
2694
+ var rtlLngs = ['ar', 'shu', 'sqr', 'ssh', 'xaa', 'yhd', 'yud', 'aao', 'abh', 'abv', 'acm', 'acq', 'acw', 'acx', 'acy', 'adf', 'ads', 'aeb', 'aec', 'afb', 'ajp', 'apc', 'apd', 'arb', 'arq', 'ars', 'ary', 'arz', 'auz', 'avl', 'ayh', 'ayl', 'ayn', 'ayp', 'bbz', 'pga', 'he', 'iw', 'ps', 'pbt', 'pbu', 'pst', 'prp', 'prd', 'ug', 'ur', 'ydd', 'yds', 'yih', 'ji', 'yi', 'hbo', 'men', 'xmn', 'fa', 'jpr', 'peo', 'pes', 'prs', 'dv', 'sam', 'ckb'];
2695
+ var languageUtils = this.services && this.services.languageUtils || new LanguageUtil(get());
2696
+ return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';
2697
+ }
2698
+ }, {
2699
+ key: "cloneInstance",
2700
+ value: function cloneInstance() {
2701
+ var _this8 = this;
2702
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2703
+ var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
2704
+ var mergedOptions = _objectSpread$7(_objectSpread$7(_objectSpread$7({}, this.options), options), {
2705
+ isClone: true
2706
+ });
2707
+ var clone = new I18n(mergedOptions);
2708
+ if (options.debug !== undefined || options.prefix !== undefined) {
2709
+ clone.logger = clone.logger.clone(options);
2710
+ }
2711
+ var membersToCopy = ['store', 'services', 'language'];
2712
+ membersToCopy.forEach(function (m) {
2713
+ clone[m] = _this8[m];
2714
+ });
2715
+ clone.services = _objectSpread$7({}, this.services);
2716
+ clone.services.utils = {
2717
+ hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
2718
+ };
2719
+ clone.translator = new Translator(clone.services, clone.options);
2720
+ clone.translator.on('*', function (event) {
2721
+ for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
2722
+ args[_key4 - 1] = arguments[_key4];
2723
+ }
2724
+ clone.emit.apply(clone, [event].concat(args));
2725
+ });
2726
+ clone.init(mergedOptions, callback);
2727
+ clone.translator.options = clone.options;
2728
+ clone.translator.backendConnector.services.utils = {
2729
+ hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
2730
+ };
2731
+ return clone;
2732
+ }
2733
+ }, {
2734
+ key: "toJSON",
2735
+ value: function toJSON() {
2736
+ return {
2737
+ options: this.options,
2738
+ store: this.store,
2739
+ language: this.language,
2740
+ languages: this.languages,
2741
+ resolvedLanguage: this.resolvedLanguage
2742
+ };
2743
+ }
2744
+ }]);
2745
+ return I18n;
2746
+ }(EventEmitter);
2747
+ _defineProperty$1(I18n, "createInstance", function () {
2748
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2749
+ var callback = arguments.length > 1 ? arguments[1] : undefined;
2750
+ return new I18n(options, callback);
2751
+ });
2752
+ var instance = I18n.createInstance();
2753
+ instance.createInstance = I18n.createInstance;
2754
+
2755
+ instance.createInstance;
2756
+ instance.dir;
2757
+ instance.init;
2758
+ instance.loadResources;
2759
+ instance.reloadResources;
2760
+ instance.use;
2761
+ instance.changeLanguage;
2762
+ instance.getFixedT;
2763
+ instance.t;
2764
+ instance.exists;
2765
+ instance.setDefaultNamespace;
2766
+ instance.hasLoadedNamespace;
2767
+ instance.loadNamespaces;
2768
+ instance.loadLanguages;
2769
+
2770
+ function _typeof(obj) {
2771
+ "@babel/helpers - typeof";
2772
+
2773
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
2774
+ return typeof obj;
2775
+ } : function (obj) {
2776
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2777
+ }, _typeof(obj);
2778
+ }
2779
+
2780
+ function _toPrimitive(input, hint) {
2781
+ if (_typeof(input) !== "object" || input === null) return input;
2782
+ var prim = input[Symbol.toPrimitive];
2783
+ if (prim !== undefined) {
2784
+ var res = prim.call(input, hint || "default");
2785
+ if (_typeof(res) !== "object") return res;
2786
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2787
+ }
2788
+ return (hint === "string" ? String : Number)(input);
2789
+ }
2790
+
2791
+ function _toPropertyKey(arg) {
2792
+ var key = _toPrimitive(arg, "string");
2793
+ return _typeof(key) === "symbol" ? key : String(key);
2794
+ }
2795
+
2796
+ function _defineProperty(obj, key, value) {
2797
+ key = _toPropertyKey(key);
2798
+ if (key in obj) {
2799
+ Object.defineProperty(obj, key, {
2800
+ value: value,
2801
+ enumerable: true,
2802
+ configurable: true,
2803
+ writable: true
2804
+ });
2805
+ } else {
2806
+ obj[key] = value;
2807
+ }
2808
+ return obj;
2809
+ }
2810
+
122
2811
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
123
2812
 
2813
+ var matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
2814
+ var htmlEntities = {
2815
+ '&amp;': '&',
2816
+ '&#38;': '&',
2817
+ '&lt;': '<',
2818
+ '&#60;': '<',
2819
+ '&gt;': '>',
2820
+ '&#62;': '>',
2821
+ '&apos;': "'",
2822
+ '&#39;': "'",
2823
+ '&quot;': '"',
2824
+ '&#34;': '"',
2825
+ '&nbsp;': ' ',
2826
+ '&#160;': ' ',
2827
+ '&copy;': '©',
2828
+ '&#169;': '©',
2829
+ '&reg;': '®',
2830
+ '&#174;': '®',
2831
+ '&hellip;': '…',
2832
+ '&#8230;': '…',
2833
+ '&#x2F;': '/',
2834
+ '&#47;': '/'
2835
+ };
2836
+
2837
+ var unescapeHtmlEntity = function unescapeHtmlEntity(m) {
2838
+ return htmlEntities[m];
2839
+ };
2840
+
2841
+ var unescape = function unescape(text) {
2842
+ return text.replace(matchHtmlEntity, unescapeHtmlEntity);
2843
+ };
2844
+
2845
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
2846
+
2847
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2848
+ var defaultOptions = {
2849
+ bindI18n: 'languageChanged',
2850
+ bindI18nStore: '',
2851
+ transEmptyNodeValue: '',
2852
+ transSupportBasicHtmlNodes: true,
2853
+ transWrapTextNodes: '',
2854
+ transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'],
2855
+ useSuspense: true,
2856
+ unescape: unescape
2857
+ };
2858
+ function setDefaults() {
2859
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2860
+ defaultOptions = _objectSpread(_objectSpread({}, defaultOptions), options);
2861
+ }
2862
+
2863
+ function _classCallCheck(instance, Constructor) {
2864
+ if (!(instance instanceof Constructor)) {
2865
+ throw new TypeError("Cannot call a class as a function");
2866
+ }
2867
+ }
2868
+
2869
+ function _defineProperties(target, props) {
2870
+ for (var i = 0; i < props.length; i++) {
2871
+ var descriptor = props[i];
2872
+ descriptor.enumerable = descriptor.enumerable || false;
2873
+ descriptor.configurable = true;
2874
+ if ("value" in descriptor) descriptor.writable = true;
2875
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
2876
+ }
2877
+ }
2878
+ function _createClass(Constructor, protoProps, staticProps) {
2879
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
2880
+ if (staticProps) _defineProperties(Constructor, staticProps);
2881
+ Object.defineProperty(Constructor, "prototype", {
2882
+ writable: false
2883
+ });
2884
+ return Constructor;
2885
+ }
2886
+
2887
+ var initReactI18next = {
2888
+ type: '3rdParty',
2889
+ init: function init(instance) {
2890
+ setDefaults(instance.options.react);
2891
+ }
2892
+ };
2893
+
2894
+ createContext();
2895
+ (function () {
2896
+ function ReportNamespaces() {
2897
+ _classCallCheck(this, ReportNamespaces);
2898
+
2899
+ this.usedNamespaces = {};
2900
+ }
2901
+
2902
+ _createClass(ReportNamespaces, [{
2903
+ key: "addUsedNamespaces",
2904
+ value: function addUsedNamespaces(namespaces) {
2905
+ var _this = this;
2906
+
2907
+ namespaces.forEach(function (ns) {
2908
+ if (!_this.usedNamespaces[ns]) _this.usedNamespaces[ns] = true;
2909
+ });
2910
+ }
2911
+ }, {
2912
+ key: "getUsedNamespaces",
2913
+ value: function getUsedNamespaces() {
2914
+ return Object.keys(this.usedNamespaces);
2915
+ }
2916
+ }]);
2917
+
2918
+ return ReportNamespaces;
2919
+ })();
2920
+
124
2921
  /** Detect free variable `global` from Node.js. */
125
2922
 
126
2923
  var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
@@ -542,7 +3339,7 @@ const amisRender = (root, schema, data = {}, env = {}, options) => {
542
3339
  * @Author: baozhoutao@steedos.com
543
3340
  * @Date: 2022-07-04 11:24:28
544
3341
  * @LastEditors: baozhoutao@steedos.com
545
- * @LastEditTime: 2023-02-23 09:20:32
3342
+ * @LastEditTime: 2023-06-12 11:51:15
546
3343
  * @Description:
547
3344
  */
548
3345
 
@@ -572,7 +3369,6 @@ async function fetchAPI(api, options = { credentials: 'include' }) {
572
3369
 
573
3370
  options.headers = Object.assign({}, headers, options.headers);
574
3371
  options.credentials = 'include';
575
-
576
3372
  const res = await fetch(`${getRootUrl()}${api}`, options);
577
3373
 
578
3374
  if(res.status === 401){
@@ -667,7 +3463,7 @@ function getRootUrl(defaultRootUrl){
667
3463
  if(rootUrl){
668
3464
  return rootUrl
669
3465
  }
670
- return defaultRootUrl;
3466
+ return defaultRootUrl || '';
671
3467
  }
672
3468
 
673
3469
  function setRootUrl(rootUrl){
@@ -1699,7 +4495,7 @@ const getValueByPath = function (formData, path) {
1699
4495
  if (path === '#' || !path) {
1700
4496
  return formData || {};
1701
4497
  } else if (typeof path === 'string') {
1702
- return get(formData, path);
4498
+ return get$1(formData, path);
1703
4499
  } else {
1704
4500
  console.error('path has to be a string');
1705
4501
  }
@@ -1742,6 +4538,350 @@ const parseSingleExpression$1 = function (func, formData, dataPath, global, user
1742
4538
  }
1743
4539
  };
1744
4540
 
4541
+ var frontend_field_group_generalization$1 = "Generalization";
4542
+ var frontend_download$1 = "Download";
4543
+ var frontend_form_save$1 = "Save";
4544
+ var frontend_form_save_and_new$1 = "Save and New";
4545
+ var frontend_form_cancel$1 = "Cancel";
4546
+ var frontend_form_new$1 = "New";
4547
+ var frontend_form_edit$1 = "Edit";
4548
+ var frontend_form_select$1 = "Select";
4549
+ var frontend_form_confirm$1 = "Confirm";
4550
+ var frontend_form_delete$1 = "Delete";
4551
+ var frontend_form_view$1 = "view";
4552
+ var frontend_delete_confirm_text$1 = "Are you sure you want to delete this item?";
4553
+ var frontend_delete_many_selected_required$1 = "Please select the item to be deleted";
4554
+ var frontend_delete_many_confirm_text$1 = "Are you sure you want to delete?";
4555
+ var frontend_display_type_is_table$1 = "Table";
4556
+ var frontend_display_type_is_split$1 = "Split View";
4557
+ var frontend_display_as$1 = "Displayed as";
4558
+ var frontend_record_sum$1 = "items";
4559
+ var frontend_button_reload_tooltip$1 = "Refresh";
4560
+ var frontend_button_search_tooltip$1 = "Search";
4561
+ var frontend_fields_filter_button_search$1 = "Search";
4562
+ var frontend_fields_filter_button_settings$1 = "Set search options";
4563
+ var frontend_button_listview_control_tooltip$1 = "List View Controls";
4564
+ var frontend_button_listview_control_label$1 = "LIST VIEW CONTROLS";
4565
+ var frontend_listview_control_columns$1 = "Show List";
4566
+ var frontend_listview_control_columns_mobile_group$1 = "Mobile side";
4567
+ var frontend_listview_control_clone_label$1 = "Clone";
4568
+ var frontend_listview_control_clone_title$1 = "Clone List View";
4569
+ var frontend_listview_control_clone_defaultData_label_start$1 = "Copy of";
4570
+ var frontend_listview_control_clone_defaultData_label_end$1 = "";
4571
+ var frontend_listview_control_delete_label$1 = "Delete";
4572
+ var frontend_listview_control_delete_confirm_text$1 = "If you delete this list view it will be permanently removed for all users with access. Are you sure you want to delete?";
4573
+ var frontend_listview_control_delete_message_success$1 = "Deletion successful";
4574
+ var frontend_listview_control_filters$1 = "Filter settings";
4575
+ var frontend_listview_control_filters_fields_extend$1 = "Conditional component 1";
4576
+ var frontend_listview_control_new_label$1 = "New";
4577
+ var frontend_listview_control_new_title$1 = "New List View";
4578
+ var frontend_listview_control_new_message_success$1 = "Success";
4579
+ var frontend_listview_control_new_message_failed$1 = "Failure";
4580
+ var frontend_listview_control_rename_label$1 = "Rename";
4581
+ var frontend_listview_control_rename_title$1 = "Rename List View";
4582
+ var frontend_listview_control_share$1 = "Sharing Settings";
4583
+ var frontend_listview_control_sort$1 = "Default sorting rule";
4584
+ var frontend_export_excel$1 = "Export Excel";
4585
+ var frontend_ercord_operation$1 = "Operation";
4586
+ var frontend_import_data$1 = "Import data";
4587
+ var frontend_import_data_object_name$1 = "Import object";
4588
+ var frontend_import_data_queue_import$1 = "Data import";
4589
+ var frontend_import_data_queue_import_description$1 = "Import description";
4590
+ var frontend_import_data_queue_import_encoding$1 = "Character code";
4591
+ var frontend_import_data_queue_import_template_url$1 = "Import template";
4592
+ var frontend_import_data_file$1 = "Excel file";
4593
+ var frontend_import_data_message_success$1 = "Importing has started...";
4594
+ var frontend_import_data_message_failed$1 = "Import failed";
4595
+ var frontend_record_detail_tab_detailed$1 = "Details";
4596
+ var frontend_record_detail_tab_related$1 = "Related";
4597
+ var frontend_all_apps$1 = "All apps";
4598
+ var frontend_all_projects$1 = "All projects";
4599
+ var frontend_application_launcher$1 = "Application launcher";
4600
+ var frontend_menu$1 = "Menu";
4601
+ var frontend_help$1 = "Help";
4602
+ var frontend_setup$1 = "Setup";
4603
+ var frontend_notifications$1 = "Notifications";
4604
+ var frontend_notifications_allread$1 = "Mark all as read";
4605
+ var frontend_notifications_allread_message$1 = "All marked as read";
4606
+ var frontend_profile$1 = "Profile";
4607
+ var frontend_about$1 = "About";
4608
+ var frontend_log_out$1 = "Log out";
4609
+ var frontend_listview_warning_start$1 = "The current ";
4610
+ var frontend_listview_warning_end$1 = " view does not exist!";
4611
+ var frontend_record_detail_related_list_warning$1 = "Missing parent object, parent record, or related list object property!";
4612
+ var frontend_record_detail_related_lists_warning$1 = "Missing parent object, or parent record property!";
4613
+ var frontend_record_detail_related_lists_info$1 = "No related child tables found";
4614
+ var frontend_calendar_listWeek$1 = "List";
4615
+ var frontend_message_no_permission_to_edit$1 = "You don't have permission to edit this record!";
4616
+ var frontend_message_modification_successful$1 = "Modification successful!";
4617
+ var frontend_message_modification_failed$1 = "Modification failed!";
4618
+ var en_us = {
4619
+ frontend_field_group_generalization: frontend_field_group_generalization$1,
4620
+ frontend_download: frontend_download$1,
4621
+ frontend_form_save: frontend_form_save$1,
4622
+ frontend_form_save_and_new: frontend_form_save_and_new$1,
4623
+ frontend_form_cancel: frontend_form_cancel$1,
4624
+ frontend_form_new: frontend_form_new$1,
4625
+ frontend_form_edit: frontend_form_edit$1,
4626
+ frontend_form_select: frontend_form_select$1,
4627
+ frontend_form_confirm: frontend_form_confirm$1,
4628
+ frontend_form_delete: frontend_form_delete$1,
4629
+ frontend_form_view: frontend_form_view$1,
4630
+ frontend_delete_confirm_text: frontend_delete_confirm_text$1,
4631
+ frontend_delete_many_selected_required: frontend_delete_many_selected_required$1,
4632
+ frontend_delete_many_confirm_text: frontend_delete_many_confirm_text$1,
4633
+ frontend_display_type_is_table: frontend_display_type_is_table$1,
4634
+ frontend_display_type_is_split: frontend_display_type_is_split$1,
4635
+ frontend_display_as: frontend_display_as$1,
4636
+ frontend_record_sum: frontend_record_sum$1,
4637
+ frontend_button_reload_tooltip: frontend_button_reload_tooltip$1,
4638
+ frontend_button_search_tooltip: frontend_button_search_tooltip$1,
4639
+ frontend_fields_filter_button_search: frontend_fields_filter_button_search$1,
4640
+ frontend_fields_filter_button_settings: frontend_fields_filter_button_settings$1,
4641
+ frontend_button_listview_control_tooltip: frontend_button_listview_control_tooltip$1,
4642
+ frontend_button_listview_control_label: frontend_button_listview_control_label$1,
4643
+ frontend_listview_control_columns: frontend_listview_control_columns$1,
4644
+ frontend_listview_control_columns_mobile_group: frontend_listview_control_columns_mobile_group$1,
4645
+ frontend_listview_control_clone_label: frontend_listview_control_clone_label$1,
4646
+ frontend_listview_control_clone_title: frontend_listview_control_clone_title$1,
4647
+ frontend_listview_control_clone_defaultData_label_start: frontend_listview_control_clone_defaultData_label_start$1,
4648
+ frontend_listview_control_clone_defaultData_label_end: frontend_listview_control_clone_defaultData_label_end$1,
4649
+ frontend_listview_control_delete_label: frontend_listview_control_delete_label$1,
4650
+ frontend_listview_control_delete_confirm_text: frontend_listview_control_delete_confirm_text$1,
4651
+ frontend_listview_control_delete_message_success: frontend_listview_control_delete_message_success$1,
4652
+ frontend_listview_control_filters: frontend_listview_control_filters$1,
4653
+ frontend_listview_control_filters_fields_extend: frontend_listview_control_filters_fields_extend$1,
4654
+ frontend_listview_control_new_label: frontend_listview_control_new_label$1,
4655
+ frontend_listview_control_new_title: frontend_listview_control_new_title$1,
4656
+ frontend_listview_control_new_message_success: frontend_listview_control_new_message_success$1,
4657
+ frontend_listview_control_new_message_failed: frontend_listview_control_new_message_failed$1,
4658
+ frontend_listview_control_rename_label: frontend_listview_control_rename_label$1,
4659
+ frontend_listview_control_rename_title: frontend_listview_control_rename_title$1,
4660
+ frontend_listview_control_share: frontend_listview_control_share$1,
4661
+ frontend_listview_control_sort: frontend_listview_control_sort$1,
4662
+ frontend_export_excel: frontend_export_excel$1,
4663
+ frontend_ercord_operation: frontend_ercord_operation$1,
4664
+ frontend_import_data: frontend_import_data$1,
4665
+ frontend_import_data_object_name: frontend_import_data_object_name$1,
4666
+ frontend_import_data_queue_import: frontend_import_data_queue_import$1,
4667
+ frontend_import_data_queue_import_description: frontend_import_data_queue_import_description$1,
4668
+ frontend_import_data_queue_import_encoding: frontend_import_data_queue_import_encoding$1,
4669
+ frontend_import_data_queue_import_template_url: frontend_import_data_queue_import_template_url$1,
4670
+ frontend_import_data_file: frontend_import_data_file$1,
4671
+ frontend_import_data_message_success: frontend_import_data_message_success$1,
4672
+ frontend_import_data_message_failed: frontend_import_data_message_failed$1,
4673
+ frontend_record_detail_tab_detailed: frontend_record_detail_tab_detailed$1,
4674
+ frontend_record_detail_tab_related: frontend_record_detail_tab_related$1,
4675
+ frontend_all_apps: frontend_all_apps$1,
4676
+ frontend_all_projects: frontend_all_projects$1,
4677
+ frontend_application_launcher: frontend_application_launcher$1,
4678
+ frontend_menu: frontend_menu$1,
4679
+ frontend_help: frontend_help$1,
4680
+ frontend_setup: frontend_setup$1,
4681
+ frontend_notifications: frontend_notifications$1,
4682
+ frontend_notifications_allread: frontend_notifications_allread$1,
4683
+ frontend_notifications_allread_message: frontend_notifications_allread_message$1,
4684
+ frontend_profile: frontend_profile$1,
4685
+ frontend_about: frontend_about$1,
4686
+ frontend_log_out: frontend_log_out$1,
4687
+ frontend_listview_warning_start: frontend_listview_warning_start$1,
4688
+ frontend_listview_warning_end: frontend_listview_warning_end$1,
4689
+ frontend_record_detail_related_list_warning: frontend_record_detail_related_list_warning$1,
4690
+ frontend_record_detail_related_lists_warning: frontend_record_detail_related_lists_warning$1,
4691
+ frontend_record_detail_related_lists_info: frontend_record_detail_related_lists_info$1,
4692
+ frontend_calendar_listWeek: frontend_calendar_listWeek$1,
4693
+ frontend_message_no_permission_to_edit: frontend_message_no_permission_to_edit$1,
4694
+ frontend_message_modification_successful: frontend_message_modification_successful$1,
4695
+ frontend_message_modification_failed: frontend_message_modification_failed$1
4696
+ };
4697
+
4698
+ var frontend_field_group_generalization = "通用";
4699
+ var frontend_download = "下载";
4700
+ var frontend_form_save = "保存";
4701
+ var frontend_form_save_and_new = "保存并新建";
4702
+ var frontend_form_cancel = "取消";
4703
+ var frontend_form_new = "新建";
4704
+ var frontend_form_edit = "编辑";
4705
+ var frontend_form_select = "选择";
4706
+ var frontend_form_confirm = "确认";
4707
+ var frontend_form_delete = "删除";
4708
+ var frontend_form_view = "查看";
4709
+ var frontend_delete_confirm_text = "确定要删除此项目?";
4710
+ var frontend_delete_many_selected_required = "请选择要删除的项";
4711
+ var frontend_delete_many_confirm_text = "确定要删除吗?";
4712
+ var frontend_display_type_is_table = "表格";
4713
+ var frontend_display_type_is_split = "分栏视图";
4714
+ var frontend_display_as = "显示为";
4715
+ var frontend_record_sum = "个项目";
4716
+ var frontend_button_reload_tooltip = "刷新";
4717
+ var frontend_button_search_tooltip = "搜索";
4718
+ var frontend_fields_filter_button_search = "搜索";
4719
+ var frontend_fields_filter_button_settings = "设置搜索项";
4720
+ var frontend_button_listview_control_tooltip = "列表视图控制";
4721
+ var frontend_button_listview_control_label = "列表视图控制";
4722
+ var frontend_listview_control_columns = "显示的列";
4723
+ var frontend_listview_control_columns_mobile_group = "手机端";
4724
+ var frontend_listview_control_clone = "复制";
4725
+ var frontend_listview_control_clone_label = "复制";
4726
+ var frontend_listview_control_clone_title = "复制 列表视图";
4727
+ var frontend_listview_control_clone_defaultData_label_start = "";
4728
+ var frontend_listview_control_clone_defaultData_label_end = "的副本";
4729
+ var frontend_listview_control_delete_label = "删除";
4730
+ var frontend_listview_control_delete_confirm_text = "如果您删除此列表视图,该视图将为所有具备访问权限的用户永久删除。是否确定要删除?";
4731
+ var frontend_listview_control_delete_message_success = "删除成功";
4732
+ var frontend_listview_control_filters = "过滤设置";
4733
+ var frontend_listview_control_filters_fields_extend = "条件组件1";
4734
+ var frontend_listview_control_new_label = "新建";
4735
+ var frontend_listview_control_new_title = "新建 列表视图";
4736
+ var frontend_listview_control_new_message_success = "成功";
4737
+ var frontend_listview_control_new_message_failed = "失败";
4738
+ var frontend_listview_control_rename_label = "重命名";
4739
+ var frontend_listview_control_rename_title = "重命名 列表视图";
4740
+ var frontend_listview_control_share = "共享设置";
4741
+ var frontend_listview_control_sort = "默认排序规则";
4742
+ var frontend_export_excel = "导出";
4743
+ var frontend_ercord_operation = "操作";
4744
+ var frontend_import_data = "导入数据";
4745
+ var frontend_import_data_object_name = "导入对象";
4746
+ var frontend_import_data_queue_import = "数据导入";
4747
+ var frontend_import_data_queue_import_description = "导入描述";
4748
+ var frontend_import_data_queue_import_encoding = "字符代码";
4749
+ var frontend_import_data_queue_import_template_url = "导入模板";
4750
+ var frontend_import_data_file = "Excel文件";
4751
+ var frontend_import_data_message_success = "已开始导入...";
4752
+ var frontend_import_data_message_failed = "导入失败";
4753
+ var frontend_record_detail_tab_detailed = "详细";
4754
+ var frontend_record_detail_tab_related = "相关";
4755
+ var frontend_all_apps = "所有应用";
4756
+ var frontend_all_projects = "所有项目";
4757
+ var frontend_application_launcher = "应用程序启动器";
4758
+ var frontend_menu = "菜单";
4759
+ var frontend_help = "帮助";
4760
+ var frontend_setup = "设置";
4761
+ var frontend_notifications = "通知";
4762
+ var frontend_notifications_allread = "全部标记为已读";
4763
+ var frontend_notifications_allread_message = "已全部标记为已读";
4764
+ var frontend_profile = "个人资料";
4765
+ var frontend_about = "关于";
4766
+ var frontend_log_out = "注销";
4767
+ var frontend_listview_warning_start = "当前";
4768
+ var frontend_listview_warning_end = "视图不存在!";
4769
+ var frontend_record_detail_related_list_warning = "缺少父级对象、父级记录或相关列表对象属性!";
4770
+ var frontend_record_detail_related_lists_warning = "缺少父级对象或父级记录属性!";
4771
+ var frontend_record_detail_related_lists_info = "没有相关子表";
4772
+ var frontend_calendar_listWeek = "列表";
4773
+ var frontend_message_no_permission_to_edit = "您没有编辑该记录的权限!";
4774
+ var frontend_message_modification_successful = "修改成功!";
4775
+ var frontend_message_modification_failed = "修改失败!";
4776
+ var zh_cn = {
4777
+ frontend_field_group_generalization: frontend_field_group_generalization,
4778
+ frontend_download: frontend_download,
4779
+ frontend_form_save: frontend_form_save,
4780
+ frontend_form_save_and_new: frontend_form_save_and_new,
4781
+ frontend_form_cancel: frontend_form_cancel,
4782
+ frontend_form_new: frontend_form_new,
4783
+ frontend_form_edit: frontend_form_edit,
4784
+ frontend_form_select: frontend_form_select,
4785
+ frontend_form_confirm: frontend_form_confirm,
4786
+ frontend_form_delete: frontend_form_delete,
4787
+ frontend_form_view: frontend_form_view,
4788
+ frontend_delete_confirm_text: frontend_delete_confirm_text,
4789
+ frontend_delete_many_selected_required: frontend_delete_many_selected_required,
4790
+ frontend_delete_many_confirm_text: frontend_delete_many_confirm_text,
4791
+ frontend_display_type_is_table: frontend_display_type_is_table,
4792
+ frontend_display_type_is_split: frontend_display_type_is_split,
4793
+ frontend_display_as: frontend_display_as,
4794
+ frontend_record_sum: frontend_record_sum,
4795
+ frontend_button_reload_tooltip: frontend_button_reload_tooltip,
4796
+ frontend_button_search_tooltip: frontend_button_search_tooltip,
4797
+ frontend_fields_filter_button_search: frontend_fields_filter_button_search,
4798
+ frontend_fields_filter_button_settings: frontend_fields_filter_button_settings,
4799
+ frontend_button_listview_control_tooltip: frontend_button_listview_control_tooltip,
4800
+ frontend_button_listview_control_label: frontend_button_listview_control_label,
4801
+ frontend_listview_control_columns: frontend_listview_control_columns,
4802
+ frontend_listview_control_columns_mobile_group: frontend_listview_control_columns_mobile_group,
4803
+ frontend_listview_control_clone: frontend_listview_control_clone,
4804
+ frontend_listview_control_clone_label: frontend_listview_control_clone_label,
4805
+ frontend_listview_control_clone_title: frontend_listview_control_clone_title,
4806
+ frontend_listview_control_clone_defaultData_label_start: frontend_listview_control_clone_defaultData_label_start,
4807
+ frontend_listview_control_clone_defaultData_label_end: frontend_listview_control_clone_defaultData_label_end,
4808
+ frontend_listview_control_delete_label: frontend_listview_control_delete_label,
4809
+ frontend_listview_control_delete_confirm_text: frontend_listview_control_delete_confirm_text,
4810
+ frontend_listview_control_delete_message_success: frontend_listview_control_delete_message_success,
4811
+ frontend_listview_control_filters: frontend_listview_control_filters,
4812
+ frontend_listview_control_filters_fields_extend: frontend_listview_control_filters_fields_extend,
4813
+ frontend_listview_control_new_label: frontend_listview_control_new_label,
4814
+ frontend_listview_control_new_title: frontend_listview_control_new_title,
4815
+ frontend_listview_control_new_message_success: frontend_listview_control_new_message_success,
4816
+ frontend_listview_control_new_message_failed: frontend_listview_control_new_message_failed,
4817
+ frontend_listview_control_rename_label: frontend_listview_control_rename_label,
4818
+ frontend_listview_control_rename_title: frontend_listview_control_rename_title,
4819
+ frontend_listview_control_share: frontend_listview_control_share,
4820
+ frontend_listview_control_sort: frontend_listview_control_sort,
4821
+ frontend_export_excel: frontend_export_excel,
4822
+ frontend_ercord_operation: frontend_ercord_operation,
4823
+ frontend_import_data: frontend_import_data,
4824
+ frontend_import_data_object_name: frontend_import_data_object_name,
4825
+ frontend_import_data_queue_import: frontend_import_data_queue_import,
4826
+ frontend_import_data_queue_import_description: frontend_import_data_queue_import_description,
4827
+ frontend_import_data_queue_import_encoding: frontend_import_data_queue_import_encoding,
4828
+ frontend_import_data_queue_import_template_url: frontend_import_data_queue_import_template_url,
4829
+ frontend_import_data_file: frontend_import_data_file,
4830
+ frontend_import_data_message_success: frontend_import_data_message_success,
4831
+ frontend_import_data_message_failed: frontend_import_data_message_failed,
4832
+ frontend_record_detail_tab_detailed: frontend_record_detail_tab_detailed,
4833
+ frontend_record_detail_tab_related: frontend_record_detail_tab_related,
4834
+ frontend_all_apps: frontend_all_apps,
4835
+ frontend_all_projects: frontend_all_projects,
4836
+ frontend_application_launcher: frontend_application_launcher,
4837
+ frontend_menu: frontend_menu,
4838
+ frontend_help: frontend_help,
4839
+ frontend_setup: frontend_setup,
4840
+ frontend_notifications: frontend_notifications,
4841
+ frontend_notifications_allread: frontend_notifications_allread,
4842
+ frontend_notifications_allread_message: frontend_notifications_allread_message,
4843
+ frontend_profile: frontend_profile,
4844
+ frontend_about: frontend_about,
4845
+ frontend_log_out: frontend_log_out,
4846
+ frontend_listview_warning_start: frontend_listview_warning_start,
4847
+ frontend_listview_warning_end: frontend_listview_warning_end,
4848
+ frontend_record_detail_related_list_warning: frontend_record_detail_related_list_warning,
4849
+ frontend_record_detail_related_lists_warning: frontend_record_detail_related_lists_warning,
4850
+ frontend_record_detail_related_lists_info: frontend_record_detail_related_lists_info,
4851
+ frontend_calendar_listWeek: frontend_calendar_listWeek,
4852
+ frontend_message_no_permission_to_edit: frontend_message_no_permission_to_edit,
4853
+ frontend_message_modification_successful: frontend_message_modification_successful,
4854
+ frontend_message_modification_failed: frontend_message_modification_failed
4855
+ };
4856
+
4857
+ const resources = {
4858
+ "en-US": {
4859
+ translation: en_us
4860
+ },
4861
+ "zh-CN": {
4862
+ translation: zh_cn
4863
+ }
4864
+ };
4865
+ var locale = "zh-CN";
4866
+ if (typeof window != 'undefined') {
4867
+ if (window.Builder?.settings.locale == "en-us") {
4868
+ locale = "en-US";
4869
+ } else if (window.Builder?.settings.locale == "zh-cn") {
4870
+ locale = "zh-CN";
4871
+ }
4872
+ }
4873
+
4874
+
4875
+ instance
4876
+ .use(initReactI18next)
4877
+ .init({
4878
+ resources,
4879
+ lng: locale,
4880
+ interpolation: {
4881
+ escapeValue: false
4882
+ }
4883
+ });
4884
+
1745
4885
  /*
1746
4886
  * @Author: baozhoutao@steedos.com
1747
4887
  * @Date: 2022-11-01 15:51:00
@@ -1750,7 +4890,7 @@ const parseSingleExpression$1 = function (func, formData, dataPath, global, user
1750
4890
  * @Description:
1751
4891
  */
1752
4892
 
1753
- const getSchema$4 = async (uiSchema, ctx) => {
4893
+ const getSchema$5 = async (uiSchema, ctx) => {
1754
4894
  const schemaApiAdaptor = `
1755
4895
  let formSchema = {
1756
4896
  "type": "steedos-object-form",
@@ -1803,7 +4943,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
1803
4943
  "body": [
1804
4944
  {
1805
4945
  "type": "button",
1806
- "label": "新建",
4946
+ "label": instance.t('frontend_form_new'),
1807
4947
  "id": "u:standard_new",
1808
4948
  "level": "default",
1809
4949
  "onEvent": {
@@ -1829,7 +4969,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
1829
4969
  "isLookup": "${isLookup}",
1830
4970
  "listName": "${listName}"
1831
4971
  },
1832
- "title": "新建 ${uiSchema.label | raw}",
4972
+ "title":instance.t('frontend_form_new') + " ${uiSchema.label | raw}",
1833
4973
  "body": [
1834
4974
  {
1835
4975
  "type": "service",
@@ -1862,11 +5002,11 @@ const getSchema$4 = async (uiSchema, ctx) => {
1862
5002
  {
1863
5003
  type: 'button',
1864
5004
  actionType: 'cancel',
1865
- label: "取消"
5005
+ label: instance.t('frontend_form_cancel')
1866
5006
  },
1867
5007
  {
1868
5008
  type: 'button',
1869
- label: "保存并新建",
5009
+ label: instance.t('frontend_form_save_and_new'),
1870
5010
  actionType: 'confirm',
1871
5011
  close: false,
1872
5012
  id: "confirmAndNew"
@@ -1874,7 +5014,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
1874
5014
  {
1875
5015
  type: 'button',
1876
5016
  actionType: 'confirm',
1877
- label: "保存",
5017
+ label: instance.t('frontend_form_save'),
1878
5018
  primary: true
1879
5019
  },
1880
5020
  ]
@@ -1924,8 +5064,8 @@ async function getPage({type, pageId = '', appId, objectName = '', recordId = ''
1924
5064
  * @Description:
1925
5065
  */
1926
5066
 
1927
- const getSchema$3 = async (uiSchema, ctx) => {
1928
- const title = "编辑 " + uiSchema.label;
5067
+ const getSchema$4 = async (uiSchema, ctx) => {
5068
+ const title = instance.t('frontend_form_edit') + " " + uiSchema.label;
1929
5069
 
1930
5070
  const defaultFormSchema = {
1931
5071
  type: "steedos-object-form",
@@ -1955,7 +5095,7 @@ const getSchema$3 = async (uiSchema, ctx) => {
1955
5095
  body: [
1956
5096
  {
1957
5097
  type: "button",
1958
- label: "编辑",
5098
+ label: instance.t('frontend_form_edit'),
1959
5099
  id: "u:standard_edit",
1960
5100
  onEvent: {
1961
5101
  click: {
@@ -1992,15 +5132,15 @@ const getSchema$3 = async (uiSchema, ctx) => {
1992
5132
  * @LastEditors: Please set LastEditors
1993
5133
  * @LastEditTime: 2023-04-12 10:35:36
1994
5134
  */
1995
- const getSchema$2 = (uiSchema)=>{
5135
+ const getSchema$3 = (uiSchema)=>{
1996
5136
  return {
1997
5137
  "type": "service",
1998
5138
  "className": "p-0",
1999
5139
  "body": [
2000
5140
  {
2001
5141
  "type": "button",
2002
- "label": "删除",
2003
- "confirmText": "确定要删除此项目?",
5142
+ "label": instance.t('frontend_form_delete'),
5143
+ "confirmText": instance.t('frontend_delete_many_confirm_text'),
2004
5144
  "onEvent": {
2005
5145
  "click": {
2006
5146
  "actions": [
@@ -2061,13 +5201,13 @@ const getSchema$2 = (uiSchema)=>{
2061
5201
  }
2062
5202
  };
2063
5203
 
2064
- const getSchema$1 = (uiSchema) => {
5204
+ const getSchema$2 = (uiSchema) => {
2065
5205
  return {
2066
5206
  type: "service",
2067
5207
  body: [
2068
5208
  {
2069
5209
  type: "button",
2070
- label: "导入数据",
5210
+ label: instance.t('frontend_import_data'),
2071
5211
  id: "u:import_data",
2072
5212
  onEvent: {
2073
5213
  click: {
@@ -2080,7 +5220,7 @@ const getSchema$1 = (uiSchema) => {
2080
5220
  "object_name": "${objectName}"
2081
5221
  },
2082
5222
  type: "dialog",
2083
- title: "导入数据",
5223
+ title: instance.t('frontend_import_data'),
2084
5224
  body: [
2085
5225
  {
2086
5226
  type: "form",
@@ -2115,12 +5255,12 @@ const getSchema$1 = (uiSchema) => {
2115
5255
  body: [
2116
5256
  {
2117
5257
  type: "fieldSet",
2118
- title: "通用",
5258
+ title: instance.t('frontend_field_group_generalization'),
2119
5259
  collapsable: true,
2120
5260
  body: [
2121
5261
  {
2122
5262
  name: "object_name",
2123
- label: "导入对象",
5263
+ label: instance.t('frontend_import_data_object_name'),
2124
5264
  required: false,
2125
5265
  type: "select",
2126
5266
  joinValues: false,
@@ -2156,7 +5296,7 @@ const getSchema$1 = (uiSchema) => {
2156
5296
  },
2157
5297
  {
2158
5298
  name: "queue_import",
2159
- label: "数据导入",
5299
+ label: instance.t('frontend_import_data_queue_import'),
2160
5300
  required: true,
2161
5301
  type: "picker",
2162
5302
  labelField: "description",
@@ -2202,7 +5342,7 @@ const getSchema$1 = (uiSchema) => {
2202
5342
  },
2203
5343
  {
2204
5344
  name: "description",
2205
- label: "导入描述",
5345
+ label: instance.t('frontend_import_data_queue_import_description'),
2206
5346
  type: "tpl",
2207
5347
  tpl: '<a href="/app/undefined/undefined/view/${undefined}">${description}</a>',
2208
5348
  className: "whitespace-nowrap",
@@ -2210,7 +5350,7 @@ const getSchema$1 = (uiSchema) => {
2210
5350
  },
2211
5351
  {
2212
5352
  name: "object_name",
2213
- label: "导入对象",
5353
+ label: instance.t('frontend_import_data_object_name'),
2214
5354
  type: "tpl",
2215
5355
  tpl: '<a href="/app/undefined/${_display.object_name.objectName}/view/${_display.object_name.value}">${_display.object_name.label}</a>',
2216
5356
  className: "whitespace-nowrap",
@@ -2218,7 +5358,7 @@ const getSchema$1 = (uiSchema) => {
2218
5358
  },
2219
5359
  {
2220
5360
  name: "encoding",
2221
- label: "字符代码",
5361
+ label: instance.t('frontend_import_data_queue_import_encoding'),
2222
5362
  type: "tpl",
2223
5363
  tpl: "<div>${_display.encoding}</div>",
2224
5364
  className: "whitespace-nowrap",
@@ -2226,12 +5366,12 @@ const getSchema$1 = (uiSchema) => {
2226
5366
  },
2227
5367
  {
2228
5368
  name: "template_url",
2229
- label: "导入模板",
5369
+ label: instance.t('frontend_import_data_queue_import_template_url'),
2230
5370
  type: "button-group",
2231
5371
  buttons: [
2232
5372
  {
2233
5373
  type: "button",
2234
- label: "下载",
5374
+ label: instance.t('frontend_download'),
2235
5375
  visibleOn: "${template_url}",
2236
5376
  level: "link",
2237
5377
  actionType: "download",
@@ -2265,7 +5405,7 @@ const getSchema$1 = (uiSchema) => {
2265
5405
  },
2266
5406
  {
2267
5407
  name: "file",
2268
- label: "Excel文件",
5408
+ label: instance.t('frontend_import_data_file'),
2269
5409
  required: true,
2270
5410
  type: "input-file",
2271
5411
  className: "m-1",
@@ -2321,8 +5461,8 @@ const getSchema$1 = (uiSchema) => {
2321
5461
  },
2322
5462
  },
2323
5463
  messages: {
2324
- success: "已开始导入...",
2325
- failed: "导入失败",
5464
+ success: instance.t('frontend_import_data_message_success'),
5465
+ failed: instance.t('frontend_import_data_message_failed'),
2326
5466
  },
2327
5467
  },
2328
5468
  actionType: "ajax",
@@ -2361,14 +5501,15 @@ const getSchema$1 = (uiSchema) => {
2361
5501
  * @LastEditTime: 2022-11-07 17:12:20
2362
5502
  * @Description:
2363
5503
  */
2364
- const getSchema$5 = (uiSchema)=>{
5504
+
5505
+ const getSchema$1 = (uiSchema)=>{
2365
5506
  return {
2366
5507
  "type": "service",
2367
5508
  "className": "p-0",
2368
5509
  "body": [
2369
5510
  {
2370
5511
  "type": "button",
2371
- "label": "查看",
5512
+ "label": instance.t('frontend_form_view'),
2372
5513
  "className": "border-none",
2373
5514
  "onEvent": {
2374
5515
  "click": {
@@ -2393,6 +5534,94 @@ const getSchema$5 = (uiSchema)=>{
2393
5534
  }
2394
5535
  };
2395
5536
 
5537
+ const getSchema$6 = async (uiSchema, ctx) => {
5538
+ const requestAdaptor = `
5539
+ // 获取列表视图的属性
5540
+ let uiSchema = api.body.uiSchema;
5541
+ let list_views = uiSchema.list_views;
5542
+ let list_views_name = api.body.listName;
5543
+ let col = list_views[list_views_name].columns;
5544
+ let sort_test = list_views[list_views_name].sort;
5545
+
5546
+ // 获取下载字段
5547
+ let select = [];
5548
+ _.each(col, (col) => {
5549
+ if (col.field == undefined)
5550
+ select.push(col);
5551
+ else select.push(col.field);
5552
+ });
5553
+
5554
+ // 获取排序字段
5555
+
5556
+ let sort = [];
5557
+ _.forEach(sort_test, (sortField) => {
5558
+ if (sortField.field_name == undefined)
5559
+ sort.push(sortField);
5560
+ else sort.push([sortField.field_name, sortField.order]);
5561
+ })
5562
+
5563
+ let orders = [];
5564
+ _.map(sort, (value) => {
5565
+ let order_tmp = [];
5566
+ if (value[1] == "desc")
5567
+ order_tmp = value[0] + ' desc';
5568
+ else
5569
+ order_tmp = value[0];
5570
+ orders.push(order_tmp);
5571
+ });
5572
+ let order = orders.join(',');
5573
+
5574
+ let filename = uiSchema.label + "-" + list_views[list_views_name].label;
5575
+
5576
+ url_tmp = api.url.split('?')[0];
5577
+ api.url = url_tmp + "?$select=" + select.toString() + "&filename=" + filename;
5578
+
5579
+ // 判断sort 和 filters
5580
+ if (sort.length > 0) {
5581
+ api.url += "&$orderby=" + order;
5582
+ }
5583
+ let filters = list_views[list_views_name].filters;
5584
+ if (filters && filters.length > 0) {
5585
+ api.url = api.url + "&filters=" + JSON.stringify(filters);
5586
+ }
5587
+ return api;
5588
+ `;
5589
+ return {
5590
+ "type": "service",
5591
+ "body": [{
5592
+ "type": "button",
5593
+ "label": instance.t('frontend_export_excel'),
5594
+ "id": "u:standard_export_excel",
5595
+ "level": "default",
5596
+ "onEvent": {
5597
+ "click": {
5598
+ "weight": 0,
5599
+ "actions": [
5600
+ {
5601
+ "args": {
5602
+ "api": {
5603
+ "url": "${context.rootUrl}/api/record/export/${objectName}",
5604
+ "method": "get",
5605
+ "messages": {},
5606
+ "requestAdaptor": requestAdaptor,
5607
+ "data": {
5608
+ "uiSchema": "${uiSchema}",
5609
+ "listName": "${listName}"
5610
+ },
5611
+ "headers": {
5612
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
5613
+ }
5614
+ }
5615
+ },
5616
+ "actionType": "download"
5617
+ }
5618
+ ]
5619
+ }
5620
+ }
5621
+ }]
5622
+ }
5623
+ };
5624
+
2396
5625
  /*
2397
5626
  * @Author: baozhoutao@steedos.com
2398
5627
  * @Date: 2022-11-01 15:53:07
@@ -2405,19 +5634,19 @@ const StandardButtons = {
2405
5634
  getStandardNew: async (uiSchema, ctx)=>{
2406
5635
  return {
2407
5636
  type: 'amis_button',
2408
- amis_schema: await getSchema$4(uiSchema)
5637
+ amis_schema: await getSchema$5(uiSchema)
2409
5638
  }
2410
5639
  },
2411
5640
  getStandardEdit: async (uiSchema, ctx)=>{
2412
5641
  return {
2413
5642
  type: 'amis_button',
2414
- amis_schema: await getSchema$3(uiSchema, ctx)
5643
+ amis_schema: await getSchema$4(uiSchema, ctx)
2415
5644
  }
2416
5645
  },
2417
5646
  getStandardDelete: async (uiSchema, ctx)=>{
2418
5647
  return {
2419
5648
  type: 'amis_button',
2420
- amis_schema: await getSchema$2(uiSchema)
5649
+ amis_schema: await getSchema$3(uiSchema)
2421
5650
  }
2422
5651
  },
2423
5652
  getStandardDeleteMany: async (uiSchema, ctx)=>{
@@ -2439,7 +5668,7 @@ const StandardButtons = {
2439
5668
  "items": [
2440
5669
  {
2441
5670
  "position": "top-right",
2442
- "body": "请选择要删除的项"
5671
+ "body": instance.t('frontend_delete_many_selected_required')
2443
5672
  }
2444
5673
  ]
2445
5674
  }
@@ -2453,13 +5682,19 @@ const StandardButtons = {
2453
5682
  getStandardImportData: async (uiSchema, ctx)=>{
2454
5683
  return {
2455
5684
  type: 'amis_button',
2456
- amis_schema: await getSchema$1()
5685
+ amis_schema: await getSchema$2()
2457
5686
  }
2458
5687
  },
2459
5688
  getStandardOpenView: async (uiSchema, ctx)=>{
2460
5689
  return {
2461
5690
  type: 'amis_button',
2462
- amis_schema: await getSchema$5()
5691
+ amis_schema: await getSchema$1()
5692
+ }
5693
+ },
5694
+ getStandardExportExcel: async (uiSchema, ctx)=>{
5695
+ return {
5696
+ type: 'amis_button',
5697
+ amis_schema: await getSchema$6()
2463
5698
  }
2464
5699
  }
2465
5700
  };
@@ -2721,6 +5956,16 @@ const getButton = async (objectName, buttonName, ctx)=>{
2721
5956
  }
2722
5957
  }
2723
5958
 
5959
+ if(button.name === 'standard_export_excel'){
5960
+ return {
5961
+ label: button.label,
5962
+ name: button.name,
5963
+ on: button.on,
5964
+ sort: button.sort,
5965
+ ...await StandardButtons.getStandardExportExcel(uiSchema, ctx)
5966
+ }
5967
+ }
5968
+
2724
5969
  if(button.name === 'standard_open_view'){
2725
5970
  return {
2726
5971
  label: button.label,
@@ -3215,7 +6460,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3215
6460
  if(_.isEmpty(defaultSearchableFields) && data.uiSchema){
3216
6461
  defaultSearchableFields = _.map(
3217
6462
  _.sortBy(_.filter(_.values(data.uiSchema.fields), (field) => {
3218
- return field.searchable;
6463
+ return field.filterable;
3219
6464
  }), "sort_no"),
3220
6465
  "name"
3221
6466
  );
@@ -3382,7 +6627,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3382
6627
  {
3383
6628
  "type": "button",
3384
6629
  "id": btnSearchId,
3385
- "label": "搜索",
6630
+ "label": instance.t('frontend_fields_filter_button_search'),
3386
6631
  "icon": "fa fa-search",
3387
6632
  // "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
3388
6633
  "onEvent": {
@@ -3398,7 +6643,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3398
6643
  },
3399
6644
  {
3400
6645
  "type": "button",
3401
- "label": "取消",
6646
+ "label": instance.t('frontend_form_cancel'),
3402
6647
  "name": "btn_filter_form_cancel",
3403
6648
  // "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
3404
6649
  "onEvent": {
@@ -3414,7 +6659,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3414
6659
  },
3415
6660
  {
3416
6661
  "type": "button",
3417
- "label": "设置搜索项",
6662
+ "label": instance.t('frontend_fields_filter_button_settings'),
3418
6663
  "onEvent": {
3419
6664
  "click": {
3420
6665
  "actions": [
@@ -3423,7 +6668,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3423
6668
  "dialog": {
3424
6669
  "type": "dialog",
3425
6670
  "size": "md",
3426
- "title": "设置搜索项",
6671
+ "title": instance.t('frontend_fields_filter_button_settings'),
3427
6672
  "body": [
3428
6673
  {
3429
6674
  "type": "form",
@@ -3491,7 +6736,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3491
6736
  "actions": [
3492
6737
  {
3493
6738
  "type": "button",
3494
- "label": "取消",
6739
+ "label": instance.t('frontend_form_cancel'),
3495
6740
  "onEvent": {
3496
6741
  "click": {
3497
6742
  "actions": [
@@ -3507,7 +6752,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
3507
6752
  },
3508
6753
  {
3509
6754
  "type": "button",
3510
- "label": "确认",
6755
+ "label": instance.t('frontend_form_confirm'),
3511
6756
  "onEvent": {
3512
6757
  "click": {
3513
6758
  "actions": [
@@ -4024,7 +7269,7 @@ const getExportExcelToolbarButtonSchema = ()=>{
4024
7269
  "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
4025
7270
  "tooltipPlacement": "bottom",
4026
7271
  "visibleOn": "${!isLookup && global.user.is_space_admin}",
4027
- "tooltip": "导出Excel",
7272
+ "tooltip": instance.t('frontend_export_excel'),
4028
7273
  "onEvent": {
4029
7274
  "click": {
4030
7275
  "weight": 0,
@@ -4110,7 +7355,7 @@ function requestAdaptor$1(){
4110
7355
  const getNewListviewButtonSchema = ()=>{
4111
7356
  return {
4112
7357
  "type": "button",
4113
- "label": "新建",
7358
+ "label": instance.t('frontend_listview_control_new_label'),
4114
7359
  "onEvent": {
4115
7360
  "click": {
4116
7361
  "weight": 0,
@@ -4118,7 +7363,7 @@ const getNewListviewButtonSchema = ()=>{
4118
7363
  {
4119
7364
  "dialog": {
4120
7365
  "type": "dialog",
4121
- "title": "新建 列表视图",
7366
+ "title": instance.t('frontend_listview_control_new_title'),
4122
7367
  "data": {
4123
7368
  //"&":"$$",2.7、2.9、3.0在此处失效
4124
7369
  "all": "${uiSchema.list_views.all}",
@@ -4160,8 +7405,8 @@ const getNewListviewButtonSchema = ()=>{
4160
7405
  }
4161
7406
  },
4162
7407
  "messages": {
4163
- "success": "成功",
4164
- "failed": "失败"
7408
+ "success": instance.t('frontend_listview_control_new_message_success'),
7409
+ "failed": instance.t('frontend_listview_control_new_message_failed')
4165
7410
  },
4166
7411
  }
4167
7412
  ],
@@ -4260,7 +7505,7 @@ function fieldsExtend$4(){
4260
7505
  const getCopyListviewButtonSchema = ()=>{
4261
7506
  return {
4262
7507
  "type": "button",
4263
- "label": "复制",
7508
+ "label": instance.t('frontend_listview_control_clone_label'),
4264
7509
  "onEvent": {
4265
7510
  "click": {
4266
7511
  "weight": 0,
@@ -4268,7 +7513,7 @@ const getCopyListviewButtonSchema = ()=>{
4268
7513
  {
4269
7514
  "dialog": {
4270
7515
  "type": "dialog",
4271
- "title": "复制 列表视图",
7516
+ "title": instance.t('frontend_listview_control_clone_title'),
4272
7517
  "data": {
4273
7518
  //"&":"$$",2.7、2.9、3.0在此处失效
4274
7519
  "listName": "${listName}",
@@ -4288,7 +7533,7 @@ const getCopyListviewButtonSchema = ()=>{
4288
7533
  "defaultData": {
4289
7534
  "&": "${list_view}",
4290
7535
  "name":"",
4291
- "label": "${list_view.label} 的副本",
7536
+ "label": instance.t('frontend_listview_control_clone_defaultData_label_start') + " ${list_view.label} " + instance.t('frontend_listview_control_clone_defaultData_label_end'),
4292
7537
  "shared":false
4293
7538
  },
4294
7539
  "fieldsExtend": fieldsExtend$3(),
@@ -4405,7 +7650,7 @@ function fieldsExtend$3(){
4405
7650
  const getRenameListviewButtonSchema = ()=>{
4406
7651
  return {
4407
7652
  "type": "button",
4408
- "label": "重命名",
7653
+ "label": instance.t('frontend_listview_control_rename_label'),
4409
7654
  "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4410
7655
  "onEvent": {
4411
7656
  "click": {
@@ -4414,7 +7659,7 @@ const getRenameListviewButtonSchema = ()=>{
4414
7659
  {
4415
7660
  "dialog": {
4416
7661
  "type": "dialog",
4417
- "title": "重命名 列表视图",
7662
+ "title": instance.t('frontend_listview_control_rename_title'),
4418
7663
  "data": {
4419
7664
  "targetObjectName": "${objectName}",
4420
7665
  "recordId": "${uiSchema.list_views[listName]._id}",
@@ -4464,7 +7709,7 @@ const getRenameListviewButtonSchema = ()=>{
4464
7709
  const getSetListviewShareButtonSchema = ()=>{
4465
7710
  return {
4466
7711
  "type": "button",
4467
- "label": "共享设置",
7712
+ "label": instance.t('frontend_listview_control_share'),
4468
7713
  "disabledOn": "!(global.user.is_space_admin && !!uiSchema.list_views[listName].owner)",
4469
7714
  "onEvent": {
4470
7715
  "click": {
@@ -4473,7 +7718,7 @@ const getSetListviewShareButtonSchema = ()=>{
4473
7718
  {
4474
7719
  "dialog": {
4475
7720
  "type": "dialog",
4476
- "title": "共享设置",
7721
+ "title": instance.t('frontend_listview_control_share'),
4477
7722
  "data": {
4478
7723
  "recordId": "${uiSchema.list_views[listName]._id}",
4479
7724
  "context": "${context}"
@@ -4508,7 +7753,7 @@ const getSetListviewShareButtonSchema = ()=>{
4508
7753
  const getSetListviewFiltersButtonSchema = ()=>{
4509
7754
  return {
4510
7755
  "type": "button",
4511
- "label": "过滤设置",
7756
+ "label": instance.t('frontend_listview_control_filters'),
4512
7757
  "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4513
7758
  "onEvent": {
4514
7759
  "click": {
@@ -4517,7 +7762,7 @@ const getSetListviewFiltersButtonSchema = ()=>{
4517
7762
  {
4518
7763
  "dialog": {
4519
7764
  "type": "dialog",
4520
- "title": "过滤设置",
7765
+ "title": instance.t('frontend_listview_control_filters'),
4521
7766
  "data": {
4522
7767
  "targetObjectName": "${objectName}",
4523
7768
  "recordId": "${uiSchema.list_views[listName]._id}",
@@ -4638,7 +7883,7 @@ function fieldsExtend$2(){
4638
7883
  "visible_on": "true",
4639
7884
  "amis": {
4640
7885
  "type": "condition-builder",
4641
- "label": "条件组件1",
7886
+ "label": instance.t('frontend_listview_control_filters_fields_extend'),
4642
7887
  "source": {
4643
7888
  "method": "get",
4644
7889
  "url": "${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${targetObjectName}",
@@ -4655,7 +7900,7 @@ function fieldsExtend$2(){
4655
7900
  const getSetListviewColumnsButtonSchema = ()=>{
4656
7901
  return {
4657
7902
  "type": "button",
4658
- "label": "显示的列",
7903
+ "label": instance.t('frontend_listview_control_columns'),
4659
7904
  "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4660
7905
  "onEvent": {
4661
7906
  "click": {
@@ -4665,7 +7910,7 @@ const getSetListviewColumnsButtonSchema = ()=>{
4665
7910
  "args": {},
4666
7911
  "dialog": {
4667
7912
  "type": "dialog",
4668
- "title": "显示的列",
7913
+ "title": instance.t('frontend_listview_control_columns'),
4669
7914
  "data": {
4670
7915
  //"&":"$$",2.7、2.9、3.0在此处失效
4671
7916
  "targetObjectName": "${objectName}",
@@ -4735,7 +7980,7 @@ function fieldsExtend$1(){
4735
7980
  }
4736
7981
  },
4737
7982
  "mobile_columns": {
4738
- "group": "手机端",
7983
+ "group": instance.t('frontend_listview_control_columns_mobile_group'),
4739
7984
  "amis": {
4740
7985
  "type": "transfer",
4741
7986
  "sortable": true,
@@ -4810,7 +8055,7 @@ function apiRequestAdaptor$1(){
4810
8055
  const getSetListviewSortButtonSchema = ()=>{
4811
8056
  return {
4812
8057
  "type": "button",
4813
- "label": "默认排序规则",
8058
+ "label": instance.t('frontend_listview_control_sort'),
4814
8059
  "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4815
8060
  "onEvent": {
4816
8061
  "click": {
@@ -4819,7 +8064,7 @@ const getSetListviewSortButtonSchema = ()=>{
4819
8064
  {
4820
8065
  "dialog": {
4821
8066
  "type": "dialog",
4822
- "title": "默认排序规则",
8067
+ "title": instance.t('frontend_listview_control_sort'),
4823
8068
  "data": {
4824
8069
  //"&":"$$",2.7、2.9、3.0在此处失效
4825
8070
  "targetObjectName": "${objectName}",
@@ -4935,9 +8180,9 @@ function apiRequestAdaptor(){
4935
8180
  const getDeleteListviewButtonSchema = ()=>{
4936
8181
  return {
4937
8182
  "type": "button",
4938
- "label": "删除",
8183
+ "label": instance.t('frontend_listview_control_delete_label'),
4939
8184
  "disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
4940
- "confirmText": "如果您删除此列表视图,该视图将为所有具备访问权限的用户永久删除。是否确定要删除?",
8185
+ "confirmText": instance.t('frontend_listview_control_delete_confirm_text'),
4941
8186
  "onEvent": {
4942
8187
  "click": {
4943
8188
  "actions": [
@@ -4956,7 +8201,7 @@ const getDeleteListviewButtonSchema = ()=>{
4956
8201
  "recordId": "${uiSchema.list_views[listName]._id}"
4957
8202
  },
4958
8203
  "messages": {
4959
- "success": "删除成功"
8204
+ "success": instance.t('frontend_listview_control_delete_message_success')
4960
8205
  },
4961
8206
  "requestAdaptor": requestAdaptor(),
4962
8207
  "adaptor": adaptor(),
@@ -5003,13 +8248,13 @@ const getSettingListviewToolbarButtonSchema = ()=>{
5003
8248
  "type": "dropdown-button",
5004
8249
  "trigger": "click",
5005
8250
  "icon": "fa fa-cog",
5006
- "tooltip": "列表视图控制",
8251
+ "tooltip": instance.t('frontend_button_listview_control_tooltip'),
5007
8252
  "btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
5008
8253
  "align": "right",
5009
8254
  "visibleOn": "${!isLookup}",
5010
8255
  "buttons": [
5011
8256
  {
5012
- "label": "列表视图控制",
8257
+ "label": instance.t('frontend_button_listview_control_label'),
5013
8258
  "children": [
5014
8259
  getNewListviewButtonSchema(),
5015
8260
  getCopyListviewButtonSchema(),
@@ -5030,30 +8275,30 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
5030
8275
  let buttons = [
5031
8276
  {
5032
8277
  "type": "button",
5033
- "label": "表格",
8278
+ "label": instance.t('frontend_display_type_is_table'),
5034
8279
  "onClick": "let url = document.location.pathname; var urlSearch = new URLSearchParams(document.location.search); if(urlSearch.get(\"side_object\") && urlSearch.get(\"side_listview_id\")){url=`/app/${props.data.appId}/${urlSearch.get(\"side_object\")}/grid/${urlSearch.get(\"side_listview_id\")}`;}; props.env.jumpTo(url + '?display=grid');",
5035
8280
  "rightIcon": displayAs != 'split' ? "fa fa-check" : null,
5036
8281
  "rightIconClassName": "m-l-sm"
5037
8282
  },
5038
8283
  {
5039
8284
  "type": "button",
5040
- "label": "分栏视图",
8285
+ "label": instance.t('frontend_display_type_is_split'),
5041
8286
  "onClick": "const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
5042
8287
  "rightIcon": displayAs === 'split' ? "fa fa-check" : null,
5043
8288
  "rightIconClassName": "m-l-sm"
5044
8289
  }
5045
8290
  ];
5046
- const displayAsLabel = displayAs === 'split'? "分栏视图" : "表格";
8291
+ const displayAsLabel = displayAs === 'split'? instance.t('frontend_display_type_is_split') : instance.t('frontend_display_type_is_table');
5047
8292
  return {
5048
8293
  "type": "dropdown-button",
5049
8294
  "icon": "fa fa-table-columns",
5050
- "tooltip": `显示为 ${displayAsLabel}`,
8295
+ "tooltip": `${instance.t('frontend_display_as')} ${displayAsLabel}`,
5051
8296
  "btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
5052
8297
  "align": "right",
5053
8298
  "visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
5054
8299
  "buttons": [
5055
8300
  {
5056
- "label": "显示为",
8301
+ "label": instance.t('frontend_display_as'),
5057
8302
  "children": buttons
5058
8303
  }
5059
8304
  ]
@@ -5121,13 +8366,13 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
5121
8366
  ...(headerToolbarItems || []),
5122
8367
  hiddenCount ? {} :{
5123
8368
  "type": "tpl",
5124
- "tpl": "${count} 个项目"
8369
+ "tpl": "${count} " + instance.t('frontend_record_sum')
5125
8370
  },
5126
8371
  {
5127
8372
  // "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
5128
8373
  "type": "button",
5129
8374
  "align": "right",
5130
- "tooltip": "刷新",
8375
+ "tooltip": instance.t('frontend_button_reload_tooltip'),
5131
8376
  "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
5132
8377
  "label": "",
5133
8378
  "icon": "fa fa-sync",
@@ -5147,7 +8392,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
5147
8392
  "label": "",
5148
8393
  "icon": "fa fa-search",
5149
8394
  "type": "button",
5150
- "tooltip": "搜索",
8395
+ "tooltip": instance.t('frontend_button_search_tooltip'),
5151
8396
  "badge": {
5152
8397
  "offset": [
5153
8398
  -5,
@@ -5187,12 +8432,12 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
5187
8432
  // },
5188
8433
  hiddenCount ? {} : {
5189
8434
  "type": "tpl",
5190
- "tpl": "${count} 个项目"
8435
+ "tpl": "${count} " + instance.t('frontend_record_sum')
5191
8436
  },
5192
8437
  {
5193
8438
  "type": "reload",
5194
8439
  "align": "right",
5195
- "tooltip": "刷新",
8440
+ "tooltip": instance.t('frontend_button_reload_tooltip'),
5196
8441
  "tooltipPlacement": "bottom",
5197
8442
  "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
5198
8443
  },
@@ -5200,7 +8445,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
5200
8445
  filterVisible ? {
5201
8446
  "label": "",
5202
8447
  "icon": "fa fa-search",
5203
- "tooltip": "搜索",
8448
+ "tooltip": instance.t('frontend_button_search_tooltip'),
5204
8449
  "tooltipPlacement": "bottom",
5205
8450
  "type": "button",
5206
8451
  "align": "right",
@@ -5820,7 +9065,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
5820
9065
  pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, ctx.formFactor, { headerToolbarItems });
5821
9066
  const isAllowCreate = refObjectConfig.permissions.allowCreate;
5822
9067
  if (isAllowCreate) {
5823
- const new_button = await getSchema$4(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
9068
+ const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
5824
9069
  new_button.align = "right";
5825
9070
  pickerSchema.headerToolbar.push(new_button);
5826
9071
  }
@@ -7703,7 +10948,7 @@ async function getTableOperation(ctx){
7703
10948
  }
7704
10949
  return {
7705
10950
  type: 'operation',
7706
- label: '操作',
10951
+ label: instance.t('frontend_ercord_operation'),
7707
10952
  fixed: 'right',
7708
10953
  labelClassName: 'text-center',
7709
10954
  className: 'text-center steedos-listview-operation w-20',
@@ -8752,7 +11997,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
8752
11997
  // ObjectForm会认作用域下的变量值
8753
11998
  // TODO: 待组件支持initValues属性后应该改掉,不应该通过data直接传值
8754
11999
  // TODO: 全天事件属性传入doc了但是没有生效,需要手动在ObjectForm中勾选全天事件
8755
- const title = "新建 ${objectSchema.label}";
12000
+ const title = "${instance.t('frontend_form_new')} ${objectSchema.label}";
8756
12001
  doAction(
8757
12002
  {
8758
12003
  "actionType": "dialog",
@@ -8786,33 +12031,6 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
8786
12031
  });
8787
12032
  `;
8788
12033
 
8789
- const onEventClickScript = `
8790
- const data = event.data;
8791
- const eventData = data.event;
8792
- const appId = data.appId;
8793
- const objectName = data.objectName;
8794
- const eventId = data.event && data.event.id;
8795
- doAction({
8796
- "actionType": "dialog",
8797
- "dialog": {
8798
- "type": "dialog",
8799
- "title": "",
8800
- "body": [
8801
- {
8802
- "type": "steedos-record-detail",
8803
- "objectApiName": "\${objectName}",
8804
- "recordId": data.event && data.event.id
8805
- }
8806
- ],
8807
- "closeOnEsc": false,
8808
- "closeOnOutside": false,
8809
- "showCloseButton": true,
8810
- "size": "lg",
8811
- "actions": []
8812
- }
8813
- });
8814
- `;
8815
-
8816
12034
  const recordId = "${event.id}";
8817
12035
  const recordPermissionsApi = getCalendarRecordPermissionsApi(objectSchema, recordId);
8818
12036
  const recordSaveApi = getCalendarRecordSaveApi(objectSchema, calendarOptions);
@@ -8858,11 +12076,10 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
8858
12076
  "weight": 0,
8859
12077
  "actions": [
8860
12078
  {
8861
- "componentId": "",
12079
+ "actionType": "link",
8862
12080
  "args": {
8863
- },
8864
- "actionType": "custom",
8865
- "script": onEventClickScript
12081
+ "link": "/app/${appId}/${objectName}/view/${event.id}"
12082
+ }
8866
12083
  }
8867
12084
  ]
8868
12085
  },
@@ -8892,7 +12109,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
8892
12109
  "expression": "!event.data.editable",
8893
12110
  "args": {
8894
12111
  "msgType": "error",
8895
- "msg": "您没有编辑该记录的权限!",
12112
+ "msg": instance.t('frontend_message_no_permission_to_edit'),
8896
12113
  "position": "top-center"
8897
12114
  }
8898
12115
  },
@@ -8902,8 +12119,8 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
8902
12119
  "args": {
8903
12120
  "api": recordSaveApi,
8904
12121
  "messages": {
8905
- "success": objectSchema.label + "修改成功",
8906
- "failed": objectSchema.label + "修改失败!"
12122
+ "success": objectSchema.label + instance.t('frontend_message_modification_successful'),
12123
+ "failed": objectSchema.label + instance.t('frontend_message_modification_successful')
8907
12124
  }
8908
12125
  }
8909
12126
  }
@@ -8975,7 +12192,12 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
8975
12192
  "initialView": initialView,
8976
12193
  "businessHours": businessHours,
8977
12194
  ...config,
8978
- "onEvent": onEvent
12195
+ "onEvent": onEvent,
12196
+ "views":{
12197
+ listWeek: {
12198
+ buttonText: instance.t('frontend_calendar_listWeek')
12199
+ }
12200
+ }
8979
12201
  };
8980
12202
  return amisSchema;
8981
12203
  }
@@ -8994,7 +12216,7 @@ const getFieldSchemaArray = (formFields) => {
8994
12216
 
8995
12217
  ___default.forEach(formFields, (field) => {
8996
12218
  if (!field.group || field.group == 'null' || field.group == '-')
8997
- field.group = '通用';
12219
+ field.group = instance.t('frontend_field_group_generalization');
8998
12220
  const fieldName = field.name;
8999
12221
  let isObjectField = /\w+\.\w+/.test(fieldName);
9000
12222
  if (field.type == 'grid' || field.type == 'object') {
@@ -9159,7 +12381,7 @@ function getBulkActions(objectSchema){
9159
12381
  "level": "danger",
9160
12382
  "label": "批量删除",
9161
12383
  "actionType": "ajax",
9162
- "confirmText": "确定要删除吗",
12384
+ "confirmText": instance.t('frontend_delete_many_confirm_text'),
9163
12385
  "className": "hidden",
9164
12386
  "id": "batchDelete",
9165
12387
  "api": getBatchDelete(objectSchema.name),
@@ -10438,7 +13660,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
10438
13660
  const uiSchema = await getUISchema(objectName);
10439
13661
  const relatedLists = await getObjectRelatedList(objectName);
10440
13662
  const detailed = {
10441
- "title": "详细",
13663
+ "title": instance.t('frontend_record_detail_tab_detailed'),
10442
13664
  "className": "px-0 py-4",
10443
13665
  "body": [
10444
13666
  {
@@ -10453,7 +13675,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
10453
13675
  "id": "u:5d4e7e3f6ecc"
10454
13676
  };
10455
13677
  const related = {
10456
- "title": "相关",
13678
+ "title": instance.t('frontend_record_detail_tab_related'),
10457
13679
  "className": "px-0 pt-4",
10458
13680
  "body": [
10459
13681
  {
@@ -13510,7 +16732,8 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
13510
16732
  setSteedosAuth: setSteedosAuth,
13511
16733
  setUISchemaFunction: setUISchemaFunction,
13512
16734
  setVariable: setVariable,
13513
- standardButtonsTodo: standardButtonsTodo
16735
+ standardButtonsTodo: standardButtonsTodo,
16736
+ i18next: instance
13514
16737
  });
13515
16738
 
13516
16739
  var getSchema = function (field, value, ctx) { return __awaiter(void 0, void 0, void 0, function () {
@@ -14044,7 +17267,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
14044
17267
  if (!listView) {
14045
17268
  return [2 /*return*/, {
14046
17269
  "type": "alert",
14047
- "body": "\u5F53\u524D".concat(listName, "\u89C6\u56FE\u4E0D\u5B58\u5728\uFF01"),
17270
+ "body": "".concat(instance.t('frontend_listview_warning_start')).concat(listName).concat(instance.t('frontend_listview_warning_end')),
14048
17271
  "level": "warning",
14049
17272
  "showIcon": true,
14050
17273
  "className": "mb-3"
@@ -14373,7 +17596,7 @@ var AmisRecordDetailRelatedList = function (props) { return __awaiter(void 0, vo
14373
17596
  // if(!objectApiName || !relatedObjectApiName || !recordId){
14374
17597
  return [2 /*return*/, {
14375
17598
  "type": "alert",
14376
- "body": "缺少父级对象、父级记录或相关列表对象属性",
17599
+ "body": instance.t('frontend_record_detail_related_list_warning'),
14377
17600
  "level": "warning",
14378
17601
  "showIcon": true,
14379
17602
  "className": "mb-3"
@@ -14411,7 +17634,7 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
14411
17634
  // if(!objectApiName || !recordId){
14412
17635
  return [2 /*return*/, {
14413
17636
  "type": "alert",
14414
- "body": "缺少父级对象或父级记录属性",
17637
+ "body": instance.t('frontend_record_detail_related_lists_warning'),
14415
17638
  "level": "warning",
14416
17639
  "showIcon": true,
14417
17640
  "className": "mb-3"
@@ -14424,7 +17647,7 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
14424
17647
  if (!relatedLists || !relatedLists.length) {
14425
17648
  return [2 /*return*/, {
14426
17649
  "type": "alert",
14427
- "body": "没有相关子表",
17650
+ "body": instance.t('frontend_record_detail_related_lists_info'),
14428
17651
  "level": "info",
14429
17652
  "showIcon": true,
14430
17653
  "className": "mb-3"
@@ -14643,7 +17866,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
14643
17866
  {
14644
17867
  "type": "collapse",
14645
17868
  "key": "1",
14646
- "header": "所有应用",
17869
+ "header": instance.t('frontend_all_apps'),
14647
17870
  "body": [
14648
17871
  {
14649
17872
  "type": "each",
@@ -14712,7 +17935,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
14712
17935
  {
14713
17936
  "type": "collapse",
14714
17937
  "key": "2",
14715
- "header": "所有项目",
17938
+ "header": instance.t('frontend_all_projects'),
14716
17939
  "body": [
14717
17940
  {
14718
17941
  "type": "each",
@@ -14820,7 +18043,7 @@ var AmisAppLauncher = function (props) { return __awaiter(void 0, void 0, void 0
14820
18043
  "size": "xl",
14821
18044
  "title": {
14822
18045
  "type": "tpl",
14823
- "tpl": "应用程序启动器",
18046
+ "tpl": instance.t('frontend_application_launcher'),
14824
18047
  "className": "block text-xl text-center"
14825
18048
  },
14826
18049
  "actions": [],
@@ -14935,7 +18158,7 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
14935
18158
  schemaApi: {
14936
18159
  "method": "get",
14937
18160
  "url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus?mobile=true"),
14938
- "adaptor": "\n try {\n\n if(payload.children.length == 0){\n payload.data = {};\n return payload\n }\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n let sum = 0;\n _.each(payload.children, (tab)=>{\n sum++;\n const classIcon = tab.icon.replace(/_/g,\"-\");\n if(sum >= 5){\n data.nav.push({\n \"label\": {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\"slds-icon slds-icon_container slds-icon-standard-`+classIcon+` flex-shrink-0 h-10 w-10\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg><span>${tab.name}</span><i class=\"fa fa-angle-right\" aria-hidden=\"true\" style=\"position: absolute;right: 20px;color: #bababa;\"></i></span>`,\n className:'h-full flex items-center'\n },\n \"to\": tab.path,\n \"target\":tab.target\n });\n }else{\n data.nav.push({\n \"label\": {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\"slds-icon slds-icon_container slds-icon-standard-`+classIcon+` flex-shrink-0 h-10 w-10\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`,\n className:'h-full flex items-center'\n },\n \"to\": tab.path,\n \"target\":tab.target\n });\n }\n \n })\n\n payload.data = {\n \"type\": \"nav\",\n className: payload.children.length ==1 ? '").concat(className1, "' : '").concat(className, "',\n \"stacked\": ").concat(stacked, ",\n \"overflow\": {\n \"enable\": true,\n \"maxVisibleCount\": 4,\n \"overflowPopoverClassName\": \"steedos-global-footer-popup\",\n \"overflowLabel\":{\n \"type\": 'tpl',\n \"tpl\": `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\" flex-shrink-0 h-10 w-10\" style=\"padding:7px\"><use xlink:href=\"/assets/icons/utility-sprite/svg/symbols.svg#rows\"></use></svg>\u83DC\u5355</span>`,\n \"className\":'h-full flex items-center'\n },\n \"overflowIndicator\":\"\"\n },\n \"indentSize\": ").concat(indentSize, ",\n \"links\": data.nav,\n };\n } catch (error) {\n console.log(`error`, error)\n }\n return payload;\n "),
18161
+ "adaptor": "\n try {\n\n if(payload.children.length == 0){\n payload.data = {};\n return payload\n }\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n let sum = 0;\n _.each(payload.children, (tab)=>{\n sum++;\n const classIcon = tab.icon.replace(/_/g,\"-\");\n if(sum >= 5){\n data.nav.push({\n \"label\": {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\"slds-icon slds-icon_container slds-icon-standard-`+classIcon+` flex-shrink-0 h-10 w-10\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg><span>${tab.name}</span><i class=\"fa fa-angle-right\" aria-hidden=\"true\" style=\"position: absolute;right: 20px;color: #bababa;\"></i></span>`,\n className:'h-full flex items-center'\n },\n \"to\": tab.path,\n \"target\":tab.target\n });\n }else{\n data.nav.push({\n \"label\": {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\"slds-icon slds-icon_container slds-icon-standard-`+classIcon+` flex-shrink-0 h-10 w-10\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`,\n className:'h-full flex items-center'\n },\n \"to\": tab.path,\n \"target\":tab.target\n });\n }\n \n })\n\n payload.data = {\n \"type\": \"nav\",\n className: payload.children.length ==1 ? '").concat(className1, "' : '").concat(className, "',\n \"stacked\": ").concat(stacked, ",\n \"overflow\": {\n \"enable\": true,\n \"maxVisibleCount\": 4,\n \"overflowPopoverClassName\": \"steedos-global-footer-popup\",\n \"overflowLabel\":{\n \"type\": 'tpl',\n \"tpl\": `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[12px] font-medium rounded-md flex-col leading-3 nav-label'><svg class=\" flex-shrink-0 h-10 w-10\" style=\"padding:7px\"><use xlink:href=\"/assets/icons/utility-sprite/svg/symbols.svg#rows\"></use></svg>").concat(instance.t('Menu'), "</span>`,\n \"className\":'h-full flex items-center'\n },\n \"overflowIndicator\":\"\"\n },\n \"indentSize\": ").concat(indentSize, ",\n \"links\": data.nav,\n };\n } catch (error) {\n console.log(`error`, error)\n }\n return payload;\n "),
14939
18162
  "headers": {
14940
18163
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
14941
18164
  }
@@ -14995,7 +18218,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
14995
18218
  "className": "slds-button_icon slds-global-header__icon"
14996
18219
  }
14997
18220
  ],
14998
- "label": "帮助"
18221
+ "label": instance.t('frontend_help')
14999
18222
  },
15000
18223
  {
15001
18224
  "type": "button",
@@ -15024,7 +18247,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
15024
18247
  "className": "slds-button_icon slds-global-header__icon"
15025
18248
  }
15026
18249
  ],
15027
- "label": "设置"
18250
+ "label": instance.t('frontend_setup')
15028
18251
  },
15029
18252
  {
15030
18253
  "type": "steedos-dropdown",
@@ -15086,7 +18309,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
15086
18309
  "body": [
15087
18310
  {
15088
18311
  "type": "panel",
15089
- "title": "通知",
18312
+ "title": instance.t('frontend_notifications'),
15090
18313
  "className": "min-w-[300px] max-w-md",
15091
18314
  "body": [
15092
18315
  {
@@ -15134,7 +18357,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
15134
18357
  actions: [
15135
18358
  {
15136
18359
  "type": "button",
15137
- "label": "全部标记为已读",
18360
+ "label": instance.t('frontend_notifications_allread'),
15138
18361
  "id": "u:5530f3779e3a",
15139
18362
  "onEvent": {
15140
18363
  "click": {
@@ -15150,7 +18373,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
15150
18373
  }
15151
18374
  },
15152
18375
  "messages": {
15153
- "success": "已全部标记为已读"
18376
+ "success": instance.t('frontend_notifications_allread_message')
15154
18377
  }
15155
18378
  },
15156
18379
  "actionType": "ajax"
@@ -15264,7 +18487,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
15264
18487
  },
15265
18488
  {
15266
18489
  "type": "button",
15267
- "label": "个人资料",
18490
+ "label": instance.t('frontend_profile'),
15268
18491
  "className": "flex",
15269
18492
  "onEvent": {
15270
18493
  "click": {
@@ -15283,7 +18506,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
15283
18506
  },
15284
18507
  {
15285
18508
  "type": "button",
15286
- "label": "关于",
18509
+ "label": instance.t('frontend_about'),
15287
18510
  "className": "flex",
15288
18511
  "onEvent": {
15289
18512
  "click": {
@@ -15302,7 +18525,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
15302
18525
  },
15303
18526
  {
15304
18527
  "type": "button",
15305
- "label": "注销",
18528
+ "label": instance.t('frontend_log_out'),
15306
18529
  "className": "flex",
15307
18530
  "onEvent": {
15308
18531
  "click": {
@@ -15881,7 +19104,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
15881
19104
  });
15882
19105
  }); };
15883
19106
 
15884
- var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,r){return !1}},standard_new:{visible:function(e,t,r){return "cms_files"!==e&&"instances"!==e&&(r?r.allowCreate:void 0)}},standard_edit:{visible:function(e,t,r){if(r)return r.allowEdit}},standard_delete:{visible:function(e,t,r){if(r)return r.allowDelete}},standard_import_data:{visible:function(e,t,r){var n=this.object;if(r)return r.allowCreate&&n.hasImportTemplates}},standard_approve:{visible:function(e,t,r){return !1}},standard_view_instance:{visible:function(e,t,r){return !1}},standard_submit_for_approval:{visible:function(e,t,r){return window.Steedos.ProcessManager.allowSubmit.apply(this,[e,t])},todo:function(e,t){return window.Steedos.ProcessManager.submit.apply(this,[e,t])}},standard_follow:{visible:function(e,t,r){return !1}},standard_delete_many:{visible:function(e,t,r){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(r?r.allowDelete:void 0)}}}}},authRequest=function(e,t){var i=null;e=Steedos.absoluteUrl(e);try{var r=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],n={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(r&&r.length)return r.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){i=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(i={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),i}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,r]=useState(!0);var n=()=>{r(!1);};return has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React.createElement(o,_extends({visible:t,onCancel:n,onClose:n},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(r,n)=>(e,t)=>{e.name||(e.name=r+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${r}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${r}-root-`+e.name),document.body.appendChild(t));e=React.createElement(newFunctionComponent(n),e);createRoot(t).render(e);},Modal=assign(newComponentRender("modal",Modal$1),{info:Modal$1.info,success:Modal$1.success,error:Modal$1.error,warning:Modal$1.warning,confirm:Modal$1.confirm}),Drawer=newComponentRender("drawer",Drawer$1),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,r)=>{e=e.replace(/\./g,"_");r=getGraphqlFieldsQuery(r);let n="";t=[`id: "${t}"`];return `{record:${e}__findOne${n=0<t.length?`(${t.join(",")})`:n}{${r}}}`},SObject={getRecord:async(e,t,r)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,r)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:r})=>{canSaveFilter(t);r.filters&&(r.filters=filtersToConditions(r.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:r}){return `/app/${e}/${t}/grid/`+r},getObjectDetailPath({appId:e,objectName:t,recordId:r}){return `/app/${e}/${t}/view/`+r},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:r,objectName:n,foreignKey:o}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=createElement(e,__assign({},t));return ReactDOM.render(e,r)};const safeRunFunction=(t,r,n,o)=>{try{var i=window.Creator;if(!!(!i||!i.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return isNil(r)||(e=isArray(r)?r:[r]),t.bind(o||{})(...e)}catch(e){return console.log(e),n}};function safeEval(js){try{return eval(js)}catch(e){console.error(e,js);}}const isExpression=function(e){var t,r;return "string"==typeof e&&(t=/^{{(function.+)}}$/,r=/^{{(.+=>.+)}}$/,!("string"!=typeof e||!e.match(/^{{(.+)}}$/)||e.match(t)||e.match(r)))},parseSingleExpression=function(t,e,r,n){var o,i=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(r))||{};if("string"!=typeof t)return t;o="__G_L_O_B_A_L__",e="\n return "+t.substring(2,t.length-2).replace(/\bformData\b/g,JSON.stringify(e).replace(/\bglobal\b/g,o)).replace(/\bglobal\b/g,JSON.stringify(n)).replace(new RegExp("\\b"+o+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(i));try{return Function(e)()}catch(e){return console.log(e,t,r),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(e,t)=>{let r=e;return /^\{\w+(\.*\w+)*\}$/.test(e)&&(r=-1<e.indexOf("userId")||-1<e.indexOf("spaceId")||-1<e.indexOf("user.")||-1<e.indexOf("now")?`{${e}}`.replace("{{","{{global."):`{${e}}`.replace("{{","{{formData."),t&&(r=r.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),r},getFieldDefaultValue=(e,t)=>{if(!e)return null;let r=e.defaultValue;e._defaultValue&&(r=safeEval(`(${e._defaultValue})`)),isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);return n&&(r=parseSingleExpression(r,{},"#",t)),"select"===e.type&&(t=e.data_type||"text",!r||n||e.multiple||("text"!==t||isString(r)?"number"!==t||isNumber(r)?"boolean"!==t||isBoolean(r)||(r="true"===r):r=Number(r):r=String(r))),r};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],i=(t,r,n)=>{var e;if(r)return e=_.filter(t,e=>_.includes(r,e[o])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=i(t,e.children,n-1))):e.children&&(e.children=i(t,e.children,n));}),e};for(var a=t,s=0;s<a.length;s++)if(a[s].noParent=0,a[s].unfolded=!1,a[s].parent){let e=1;for(var l=0;l<a.length;l++)a[s].parent==a[l][o]&&(e=0);1==e&&(a[s].noParent=1);}else a[s].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:i(t,e.children,r-1)}))):n.push(Object.assign({},e,{children:i(t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let o=(n=n||{}).name;var e=n.direction||"up";let i=t.getComponents().find(function(e){return e.props.type===r&&(!o||e.props.name===o)});if(i)return i;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(i=getClosestAmisComponentByType(t.children[e],r,n));e++);return i}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,r,n)}function isFilterFormValuesEmpty(e){let t=!0;var e=_.pickBy(e,function(e,t){return /^__searchable__/g.test(t)});return _.isEmpty(e)||(e=_.omitBy(e,function(e){return _.isNil(e)||_.isObject(e)&&_.isEmpty(e)||_.isArray(e)&&_.isEmpty(e.filter(function(e){return !_.isNil(e)}))||_.isString(e)&&0===e.length}),_.isEmpty(e)||(t=!1)),t}const SteedosUI$1=Object.assign({},{render:render,Router:Router,ListView:ListView,Object:SObject,Modal:Modal,Drawer:Drawer,refs:{},getRef(e){return SteedosUI$1.refs[e]},router:{go:(e,t)=>{var r=window.FlowRouter;if(t)return r?r.go(t):window.open(t);r?r.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message:message,notification:notification,components:{Button:Button,Space:Space},getRefId:({type:e,appId:t,name:r})=>{switch(e){case"listview":return `amis-${t}-${r}-listview`;case"form":return `amis-${t}-${r}-form`;case"detail":return `amis-${t}-${r}-detail`;default:return `amis-${t}-${r}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty,getSearchFilter:e=>{var r=[];return _.each(e,(e,t)=>{_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?r.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?r.push([""+t.replace("__searchable__",""),"contains",e]):r.push([""+t.replace("__searchable__",""),"=",e])));}),r}});var getBuilderContext=function(){return "undefined"==typeof window?{}:Builder.settings.context||Builder.settings},Steedos$1=__assign({getRootUrl:function(e){var t=getBuilderContext();return t.rootUrl||("undefined"!=typeof window?window.localStorage.getItem("steedos:rootUrl"):"")||e},absoluteUrl:function(e){return void 0===e&&(e=""),"".concat(Steedos$1.getRootUrl()).concat(e)},getTenantId:function(){try{var e=getBuilderContext().tenantId;return (e=window.location.search&&!e?new URLSearchParams(window.location.search).get("X-Space-Id"):e)?e:null}catch(e){console.error(e);}},getAuthorization:function(){try{var e=getBuilderContext(),t=e.tenantId,r=e.authToken;return t&&r?"Bearer ".concat(t,",").concat(r):null}catch(e){console.error(e);}},authRequest:authRequest,StandardObjects:StandardObjects},Expression);"undefined"==typeof window||window.Steedos||(window.Steedos=Steedos$1),"undefined"==typeof window||window.SteedosUI||(window.SteedosUI=SteedosUI$1);
19107
+ var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,r){return !1}},standard_new:{visible:function(e,t,r){return "cms_files"!==e&&"instances"!==e&&(r?r.allowCreate:void 0)}},standard_edit:{visible:function(e,t,r){if(r)return r.allowEdit}},standard_delete:{visible:function(e,t,r){if(r)return r.allowDelete}},standard_import_data:{visible:function(e,t,r){var n=this.object;if(r)return r.allowCreate&&n.hasImportTemplates}},standard_approve:{visible:function(e,t,r){return !1}},standard_view_instance:{visible:function(e,t,r){return !1}},standard_submit_for_approval:{visible:function(e,t,r){return window.Steedos.ProcessManager.allowSubmit.apply(this,[e,t])},todo:function(e,t){return window.Steedos.ProcessManager.submit.apply(this,[e,t])}},standard_follow:{visible:function(e,t,r){return !1}},standard_delete_many:{visible:function(e,t,r){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(r?r.allowDelete:void 0)}},standard_export_excel:{visible:function(e,t,r){return !1}}}}},authRequest=function(e,t){var i=null;e=Steedos.absoluteUrl(e);try{var r=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],n={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(r&&r.length)return r.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){i=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(i={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),i}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,r]=useState(!0);var n=()=>{r(!1);};return has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React.createElement(o,_extends({visible:t,onCancel:n,onClose:n},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(r,n)=>(e,t)=>{e.name||(e.name=r+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${r}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${r}-root-`+e.name),document.body.appendChild(t));e=React.createElement(newFunctionComponent(n),e);createRoot(t).render(e);},Modal=assign(newComponentRender("modal",Modal$1),{info:Modal$1.info,success:Modal$1.success,error:Modal$1.error,warning:Modal$1.warning,confirm:Modal$1.confirm}),Drawer=newComponentRender("drawer",Drawer$1),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,r)=>{e=e.replace(/\./g,"_");r=getGraphqlFieldsQuery(r);let n="";t=[`id: "${t}"`];return `{record:${e}__findOne${n=0<t.length?`(${t.join(",")})`:n}{${r}}}`},SObject={getRecord:async(e,t,r)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,r)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:r})=>{canSaveFilter(t);r.filters&&(r.filters=filtersToConditions(r.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:r}){return `/app/${e}/${t}/grid/`+r},getObjectDetailPath({appId:e,objectName:t,recordId:r}){return `/app/${e}/${t}/view/`+r},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:r,objectName:n,foreignKey:o}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=createElement(e,__assign({},t));return ReactDOM.render(e,r)};const safeRunFunction=(t,r,n,o)=>{try{var i=window.Creator;if(!!(!i||!i.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return isNil(r)||(e=isArray(r)?r:[r]),t.bind(o||{})(...e)}catch(e){return console.log(e),n}};function safeEval(js){try{return eval(js)}catch(e){console.error(e,js);}}const isExpression=function(e){var t,r;return "string"==typeof e&&(t=/^{{(function.+)}}$/,r=/^{{(.+=>.+)}}$/,!("string"!=typeof e||!e.match(/^{{(.+)}}$/)||e.match(t)||e.match(r)))},parseSingleExpression=function(t,e,r,n){var o,i=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(r))||{};if("string"!=typeof t)return t;o="__G_L_O_B_A_L__",e="\n return "+t.substring(2,t.length-2).replace(/\bformData\b/g,JSON.stringify(e).replace(/\bglobal\b/g,o)).replace(/\bglobal\b/g,JSON.stringify(n)).replace(new RegExp("\\b"+o+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(i));try{return Function(e)()}catch(e){return console.log(e,t,r),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(e,t)=>{let r=e;return /^\{\w+(\.*\w+)*\}$/.test(e)&&(r=-1<e.indexOf("userId")||-1<e.indexOf("spaceId")||-1<e.indexOf("user.")||-1<e.indexOf("now")?`{${e}}`.replace("{{","{{global."):`{${e}}`.replace("{{","{{formData."),t&&(r=r.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),r},getFieldDefaultValue=(e,t)=>{if(!e)return null;let r=e.defaultValue;e._defaultValue&&(r=safeEval(`(${e._defaultValue})`)),isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);return n&&(r=parseSingleExpression(r,{},"#",t)),"select"===e.type&&(t=e.data_type||"text",!r||n||e.multiple||("text"!==t||isString(r)?"number"!==t||isNumber(r)?"boolean"!==t||isBoolean(r)||(r="true"===r):r=Number(r):r=String(r))),r};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],i=(t,r,n)=>{var e;if(r)return e=_.filter(t,e=>_.includes(r,e[o])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=i(t,e.children,n-1))):e.children&&(e.children=i(t,e.children,n));}),e};for(var a=t,s=0;s<a.length;s++)if(a[s].noParent=0,a[s].unfolded=!1,a[s].parent){let e=1;for(var l=0;l<a.length;l++)a[s].parent==a[l][o]&&(e=0);1==e&&(a[s].noParent=1);}else a[s].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:i(t,e.children,r-1)}))):n.push(Object.assign({},e,{children:i(t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let o=(n=n||{}).name;var e=n.direction||"up";let i=t.getComponents().find(function(e){return e.props.type===r&&(!o||e.props.name===o)});if(i)return i;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(i=getClosestAmisComponentByType(t.children[e],r,n));e++);return i}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,r,n)}function isFilterFormValuesEmpty(e){let t=!0;var e=_.pickBy(e,function(e,t){return /^__searchable__/g.test(t)});return _.isEmpty(e)||(e=_.omitBy(e,function(e){return _.isNil(e)||_.isObject(e)&&_.isEmpty(e)||_.isArray(e)&&_.isEmpty(e.filter(function(e){return !_.isNil(e)}))||_.isString(e)&&0===e.length}),_.isEmpty(e)||(t=!1)),t}const SteedosUI$1=Object.assign({},{render:render,Router:Router,ListView:ListView,Object:SObject,Modal:Modal,Drawer:Drawer,refs:{},getRef(e){return SteedosUI$1.refs[e]},router:{go:(e,t)=>{var r=window.FlowRouter;if(t)return r?r.go(t):window.open(t);r?r.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message:message,notification:notification,components:{Button:Button,Space:Space},getRefId:({type:e,appId:t,name:r})=>{switch(e){case"listview":return `amis-${t}-${r}-listview`;case"form":return `amis-${t}-${r}-form`;case"detail":return `amis-${t}-${r}-detail`;default:return `amis-${t}-${r}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty,getSearchFilter:e=>{var o=[];return _.each(e,(e,t)=>{var r,n;_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?o.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?o.push([""+t.replace("__searchable__",""),"contains",e]):_.isObject(e)&&e.o?(n=[[(r=""+t.replace("__searchable__",""))+"/o","=",e.o]],e.ids.length&&n.push([r+"/ids","=",e.ids]),o.push(n)):o.push([""+t.replace("__searchable__",""),"=",e])));}),o}});var getBuilderContext=function(){return "undefined"==typeof window?{}:Builder.settings.context||Builder.settings},Steedos$1=__assign({getRootUrl:function(e){var t=getBuilderContext();return t.rootUrl||("undefined"!=typeof window?window.localStorage.getItem("steedos:rootUrl"):"")||e},absoluteUrl:function(e){return void 0===e&&(e=""),"".concat(Steedos$1.getRootUrl()).concat(e)},getTenantId:function(){try{var e=getBuilderContext().tenantId;return (e=window.location.search&&!e?new URLSearchParams(window.location.search).get("X-Space-Id"):e)?e:null}catch(e){console.error(e);}},getAuthorization:function(){try{var e=getBuilderContext(),t=e.tenantId,r=e.authToken;return t&&r?"Bearer ".concat(t,",").concat(r):null}catch(e){console.error(e);}},authRequest:authRequest,StandardObjects:StandardObjects},Expression);"undefined"==typeof window||window.Steedos||(window.Steedos=Steedos$1),"undefined"==typeof window||window.SteedosUI||(window.SteedosUI=SteedosUI$1);
15885
19108
 
15886
19109
  var index_esm = /*#__PURE__*/Object.freeze({
15887
19110
  __proto__: null,