@tager/admin-banners 0.3.6 → 1.0.1

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.
Files changed (74) hide show
  1. package/dist/constants/paths.d.ts +5 -10
  2. package/dist/constants/routes.d.ts +4 -4
  3. package/dist/dev/App.vue.d.ts +5 -0
  4. package/dist/dev/config.d.ts +2 -0
  5. package/dist/dev/env.d.ts +1 -0
  6. package/dist/dev/main.d.ts +3 -0
  7. package/dist/hooks/index.d.ts +2 -2
  8. package/dist/hooks/useFetchBanner.d.ts +7 -8
  9. package/dist/hooks/useFetchBanners.d.ts +3 -6
  10. package/dist/hooks/useFetchZoneFields.d.ts +7 -0
  11. package/dist/hooks/useFetchZones.d.ts +3 -6
  12. package/dist/index.mjs +1008 -0
  13. package/dist/locales/apply.d.ts +1 -0
  14. package/dist/locales/en.d.ts +41 -41
  15. package/dist/locales/ru.d.ts +2 -3
  16. package/dist/main.d.ts +3 -4
  17. package/dist/services/requests.d.ts +25 -24
  18. package/dist/style.css +1 -0
  19. package/dist/typings/banners.d.ts +47 -43
  20. package/dist/typings/common.d.ts +1 -1
  21. package/dist/typings/model.d.ts +104 -104
  22. package/dist/typings/zones.d.ts +9 -5
  23. package/dist/utils/common.d.ts +2 -2
  24. package/dist/utils/paths.d.ts +5 -0
  25. package/dist/views/Banners/BannerForm/BannerForm.helpers.d.ts +5 -5
  26. package/dist/views/Banners/BannerForm/BannerForm.vue.d.ts +2694 -83
  27. package/dist/views/Banners/BannerForm/index.d.ts +1 -1
  28. package/dist/views/Banners/BannerList/BannerList.helpers.d.ts +6 -6
  29. package/dist/views/Banners/BannerList/BannerList.vue.d.ts +25 -55
  30. package/dist/views/Banners/BannerList/hooks/index.d.ts +1 -1
  31. package/dist/views/Banners/BannerList/hooks/useAdvancedSearch.d.ts +22 -21
  32. package/dist/views/Banners/BannerList/index.d.ts +1 -1
  33. package/dist/views/Zones/ZoneList/ZoneList.helpers.d.ts +5 -5
  34. package/dist/views/Zones/ZoneList/ZoneList.vue.d.ts +11 -28
  35. package/dist/views/Zones/ZoneList/index.d.ts +1 -1
  36. package/package.json +51 -49
  37. package/src/constants/paths.ts +1 -15
  38. package/src/constants/routes.ts +7 -7
  39. package/src/dev/App.vue +46 -0
  40. package/src/dev/config.ts +23 -0
  41. package/src/dev/env.ts +17 -0
  42. package/src/dev/main.ts +47 -0
  43. package/src/hooks/useFetchBanner.ts +3 -6
  44. package/src/hooks/useFetchBanners.ts +2 -5
  45. package/src/hooks/useFetchZoneFields.ts +39 -0
  46. package/src/hooks/useFetchZones.ts +2 -5
  47. package/src/locales/apply.ts +9 -0
  48. package/src/locales/en.ts +1 -1
  49. package/src/locales/ru.ts +40 -42
  50. package/src/main.ts +3 -8
  51. package/src/services/requests.ts +7 -1
  52. package/src/typings/banners.ts +10 -1
  53. package/src/typings/zones.ts +6 -0
  54. package/src/utils/paths.ts +15 -0
  55. package/src/views/Banners/BannerForm/BannerForm.helpers.ts +7 -1
  56. package/src/views/Banners/BannerForm/BannerForm.vue +183 -137
  57. package/src/views/Banners/BannerList/BannerList.vue +64 -61
  58. package/src/views/Banners/BannerList/hooks/useAdvancedSearch.ts +36 -16
  59. package/src/views/Zones/ZoneList/ZoneList.helpers.ts +1 -1
  60. package/src/views/Zones/ZoneList/ZoneList.vue +18 -19
  61. package/CHANGELOG.md +0 -13
  62. package/dist/constants/menu.d.ts +0 -5
  63. package/dist/dev.d.ts +0 -1
  64. package/dist/index.esm.js +0 -3660
  65. package/dist/index.umd.js +0 -3679
  66. package/dist/router/index.d.ts +0 -4
  67. package/src/constants/menu.ts +0 -26
  68. package/src/dev.ts +0 -34
  69. package/src/router/index.ts +0 -38
  70. package/src/typings/sfc.d.ts +0 -12
  71. package/src/typings/shims-tsx.d.ts +0 -13
  72. package/src/typings/shims-vue.d.ts +0 -11
  73. package/src/views/App.vue +0 -22
  74. package/src/views/Home.vue +0 -37
package/dist/index.umd.js DELETED
@@ -1,3679 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tager/admin-services'), require('@vue/composition-api'), require('@tager/admin-ui'), require('path-to-regexp')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@tager/admin-services', '@vue/composition-api', '@tager/admin-ui', 'path-to-regexp'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TagerAdminBanners = {}, global.adminServices, global.compositionApi, global.adminUi, global.pathToRegexp));
5
- }(this, (function (exports, adminServices, compositionApi, adminUi, pathToRegexp) { 'use strict';
6
-
7
- const EN = {
8
- home: 'Home',
9
- zone: 'Banner zone',
10
- zones: 'Banner zones',
11
- banners: 'Banners',
12
- bannerForm: 'Banner Form',
13
- createBanner: 'Create Banner',
14
- updateBanner: 'Update Banner',
15
- link: 'Link',
16
- image: 'Image',
17
- openNewTab: 'Open new tab',
18
- period: 'Period',
19
- from: 'From',
20
- to: 'To',
21
- disabled: 'Disabled',
22
- comment: 'Comment',
23
- status: 'Status',
24
- bannerZoneIsDeleted: 'Banner zone is deleted',
25
- newTab: 'New Tab',
26
- yes: 'Yes',
27
- no: 'No',
28
- edit: 'Edit',
29
- remove: 'Remove',
30
- actions: 'actions',
31
- date: 'Date',
32
- name: 'Name',
33
- priority: 'Priority',
34
- success: 'Success',
35
- error: 'Error',
36
- statuses: {
37
- waiting: 'Waiting',
38
- archived: 'Archived',
39
- active: 'Active',
40
- disabled: 'Disabled',
41
- },
42
- bannerWasSuccessfullyCreated: 'Banner was successfully created',
43
- bannerWasSuccessfullyUpdated: 'Banner was successfully updated',
44
- bannerCreationWasFailed: 'Banner creation was failed',
45
- bannerUpdateWasFailed: 'Banner update was failed',
46
- };
47
-
48
- const RU = {
49
- home: 'Главная',
50
- zone: 'Баннерная зона',
51
- zones: 'Баннерные зоны',
52
- banners: 'Баннеры',
53
- bannerForm: 'Форма баннера',
54
- createBanner: 'Добавить баннер',
55
- updateBanner: 'Редактировать баннер',
56
- link: 'Ссылка',
57
- image: 'Картинка',
58
- openNewTab: 'Открывать в новой вкладке',
59
- period: 'Срок действия',
60
- from: 'От',
61
- to: 'До',
62
- disabled: 'Выключен',
63
- comment: 'Комментарий',
64
- status: 'Статус',
65
- bannerZoneIsDeleted: 'Баннерная зона удалена',
66
- newTab: 'Новая вкладка',
67
- yes: 'Да',
68
- no: 'Нет',
69
- edit: 'Редактировать',
70
- remove: 'Удалить',
71
- actions: 'Действия',
72
- date: 'Дата',
73
- name: 'Название',
74
- priority: 'Приоритет',
75
- success: 'Успех',
76
- error: 'Ошибка',
77
- statuses: {
78
- waiting: 'В ожидании',
79
- archived: 'Архивный',
80
- active: 'Активный',
81
- disabled: 'Отключен',
82
- },
83
- bannerWasSuccessfullyCreated: 'Баннер успешно создан',
84
- bannerWasSuccessfullyUpdated: 'Баннер успешно обновлен',
85
- bannerCreationWasFailed: 'Не удалось создать баннер',
86
- bannerUpdateWasFailed: 'Не удалось обновить баннер',
87
- };
88
-
89
- /** Zones **/
90
- function getZones(params) {
91
- return adminServices.request.get({ path: '/admin/adv/zones', params });
92
- }
93
- /** Banners **/
94
- function getBanners(params) {
95
- return adminServices.request.get({ path: '/admin/adv', params });
96
- }
97
- function getBanner(bannerId) {
98
- return adminServices.request.get({ path: `/admin/adv/${bannerId}` });
99
- }
100
- function createBanner(payload) {
101
- return adminServices.request.post({ path: '/admin/adv', body: payload });
102
- }
103
- function updateBanner(bannerId, payload) {
104
- return adminServices.request.put({
105
- path: `/admin/adv/${bannerId}`,
106
- body: payload,
107
- });
108
- }
109
- function deleteBanner(bannerId) {
110
- return adminServices.request.delete({ path: `/admin/adv/${bannerId}` });
111
- }
112
- function getBannerCount() {
113
- return adminServices.request.get({ path: '/admin/adv/count' });
114
- }
115
-
116
- const BANNERS_ROUTE_PATHS = {
117
- ZONE_LIST: '/banners/zones',
118
- BANNER_LIST: '/banners',
119
- BANNER_FORM: '/banners/:bannerId',
120
- };
121
- function getBannersZoneListUrl() {
122
- return BANNERS_ROUTE_PATHS.ZONE_LIST;
123
- }
124
- function getBannersBannerListUrl() {
125
- return BANNERS_ROUTE_PATHS.BANNER_LIST;
126
- }
127
- function getBannersBannerFormUrl(params) {
128
- return pathToRegexp.compile(BANNERS_ROUTE_PATHS.BANNER_FORM)(params);
129
- }
130
-
131
- function getColumnDefs(t) {
132
- return [
133
- {
134
- id: 0,
135
- name: 'ID',
136
- field: 'id',
137
- style: { width: '50px', textAlign: 'center' },
138
- headStyle: { width: '50px', textAlign: 'center' },
139
- },
140
- {
141
- id: 1,
142
- name: t('banners:name'),
143
- field: 'name',
144
- type: 'name',
145
- },
146
- {
147
- id: 2,
148
- name: t('banners:banners'),
149
- field: 'bannersCount',
150
- style: { whiteSpace: 'nowrap', width: '130px' },
151
- },
152
- ];
153
- }
154
- function getLinkToBannersByZone(zoneId) {
155
- return `${getBannersBannerListUrl()}?filter[zone]=${zoneId}`;
156
- }
157
-
158
- var script = compositionApi.defineComponent({
159
- name: 'ZoneList',
160
- setup(props, context) {
161
- const { fetchEntityList: fetchZones, isLoading: isZonesLoading, rowData, errorMessage, handleChange, } = adminUi.useDataTable({
162
- fetchEntityList: getZones,
163
- initialValue: [],
164
- context,
165
- resourceName: 'Banner Zones',
166
- });
167
- compositionApi.onMounted(() => {
168
- fetchZones();
169
- });
170
- const columnDefs = compositionApi.computed(() => getColumnDefs(context.root.$t));
171
- return {
172
- columnDefs,
173
- isRowDataLoading: isZonesLoading,
174
- rowData,
175
- errorMessage,
176
- handleChange,
177
- getLinkToBannersByZone,
178
- };
179
- },
180
- });
181
-
182
- function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
183
- if (typeof shadowMode !== 'boolean') {
184
- createInjectorSSR = createInjector;
185
- createInjector = shadowMode;
186
- shadowMode = false;
187
- }
188
- // Vue.extend constructor export interop.
189
- const options = typeof script === 'function' ? script.options : script;
190
- // render functions
191
- if (template && template.render) {
192
- options.render = template.render;
193
- options.staticRenderFns = template.staticRenderFns;
194
- options._compiled = true;
195
- // functional template
196
- if (isFunctionalTemplate) {
197
- options.functional = true;
198
- }
199
- }
200
- // scopedId
201
- if (scopeId) {
202
- options._scopeId = scopeId;
203
- }
204
- let hook;
205
- if (moduleIdentifier) {
206
- // server build
207
- hook = function (context) {
208
- // 2.3 injection
209
- context =
210
- context || // cached call
211
- (this.$vnode && this.$vnode.ssrContext) || // stateful
212
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional
213
- // 2.2 with runInNewContext: true
214
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
215
- context = __VUE_SSR_CONTEXT__;
216
- }
217
- // inject component styles
218
- if (style) {
219
- style.call(this, createInjectorSSR(context));
220
- }
221
- // register component module identifier for async chunk inference
222
- if (context && context._registeredComponents) {
223
- context._registeredComponents.add(moduleIdentifier);
224
- }
225
- };
226
- // used by ssr in case component is cached and beforeCreate
227
- // never gets called
228
- options._ssrRegister = hook;
229
- }
230
- else if (style) {
231
- hook = shadowMode
232
- ? function (context) {
233
- style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
234
- }
235
- : function (context) {
236
- style.call(this, createInjector(context));
237
- };
238
- }
239
- if (hook) {
240
- if (options.functional) {
241
- // register for functional component in vue file
242
- const originalRender = options.render;
243
- options.render = function renderWithStyleInjection(h, context) {
244
- hook.call(context);
245
- return originalRender(h, context);
246
- };
247
- }
248
- else {
249
- // inject component registration as beforeCreate hook
250
- const existing = options.beforeCreate;
251
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
252
- }
253
- }
254
- return script;
255
- }
256
-
257
- /* script */
258
- const __vue_script__ = script;
259
-
260
- /* template */
261
- var __vue_render__ = function () {
262
- var _vm = this;
263
- var _h = _vm.$createElement;
264
- var _c = _vm._self._c || _h;
265
- return _c("page", {
266
- attrs: { title: _vm.$t("banners:zones") },
267
- scopedSlots: _vm._u([
268
- {
269
- key: "content",
270
- fn: function () {
271
- return [
272
- _c("data-table", {
273
- attrs: {
274
- "column-defs": _vm.columnDefs,
275
- "row-data": _vm.rowData,
276
- loading: _vm.isRowDataLoading,
277
- "error-message": _vm.errorMessage,
278
- "data-table": "banners-zones",
279
- "use-search": false,
280
- "use-pagination": false,
281
- },
282
- on: { change: _vm.handleChange },
283
- scopedSlots: _vm._u([
284
- {
285
- key: "cell(banners-count)",
286
- fn: function (ref) {
287
- var row = ref.row;
288
- return [
289
- _c(
290
- "count-button",
291
- {
292
- attrs: {
293
- href: _vm.getLinkToBannersByZone(row.id),
294
- variant: "outline-secondary",
295
- count: row.bannersCount,
296
- },
297
- },
298
- [
299
- _vm._v(
300
- "\n " +
301
- _vm._s(_vm.$t("banners:banners")) +
302
- "\n "
303
- ),
304
- ]
305
- ),
306
- ]
307
- },
308
- },
309
- ]),
310
- }),
311
- ]
312
- },
313
- proxy: true,
314
- },
315
- ]),
316
- })
317
- };
318
- var __vue_staticRenderFns__ = [];
319
- __vue_render__._withStripped = true;
320
-
321
- /* style */
322
- const __vue_inject_styles__ = undefined;
323
- /* scoped */
324
- const __vue_scope_id__ = undefined;
325
- /* module identifier */
326
- const __vue_module_identifier__ = undefined;
327
- /* functional template */
328
- const __vue_is_functional_template__ = false;
329
- /* style inject */
330
-
331
- /* style inject SSR */
332
-
333
- /* style inject shadow dom */
334
-
335
-
336
-
337
- const __vue_component__ = /*#__PURE__*/normalizeComponent(
338
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
339
- __vue_inject_styles__,
340
- __vue_script__,
341
- __vue_scope_id__,
342
- __vue_is_functional_template__,
343
- __vue_module_identifier__,
344
- false,
345
- undefined,
346
- undefined,
347
- undefined
348
- );
349
-
350
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
351
-
352
- function createCommonjsModule(fn, basedir, module) {
353
- return module = {
354
- path: basedir,
355
- exports: {},
356
- require: function (path, base) {
357
- return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
358
- }
359
- }, fn(module, module.exports), module.exports;
360
- }
361
-
362
- function commonjsRequire () {
363
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
364
- }
365
-
366
- var lodash_isequal = createCommonjsModule(function (module, exports) {
367
- /**
368
- * Lodash (Custom Build) <https://lodash.com/>
369
- * Build: `lodash modularize exports="npm" -o ./`
370
- * Copyright JS Foundation and other contributors <https://js.foundation/>
371
- * Released under MIT license <https://lodash.com/license>
372
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
373
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
374
- */
375
-
376
- /** Used as the size to enable large array optimizations. */
377
- var LARGE_ARRAY_SIZE = 200;
378
-
379
- /** Used to stand-in for `undefined` hash values. */
380
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
381
-
382
- /** Used to compose bitmasks for value comparisons. */
383
- var COMPARE_PARTIAL_FLAG = 1,
384
- COMPARE_UNORDERED_FLAG = 2;
385
-
386
- /** Used as references for various `Number` constants. */
387
- var MAX_SAFE_INTEGER = 9007199254740991;
388
-
389
- /** `Object#toString` result references. */
390
- var argsTag = '[object Arguments]',
391
- arrayTag = '[object Array]',
392
- asyncTag = '[object AsyncFunction]',
393
- boolTag = '[object Boolean]',
394
- dateTag = '[object Date]',
395
- errorTag = '[object Error]',
396
- funcTag = '[object Function]',
397
- genTag = '[object GeneratorFunction]',
398
- mapTag = '[object Map]',
399
- numberTag = '[object Number]',
400
- nullTag = '[object Null]',
401
- objectTag = '[object Object]',
402
- promiseTag = '[object Promise]',
403
- proxyTag = '[object Proxy]',
404
- regexpTag = '[object RegExp]',
405
- setTag = '[object Set]',
406
- stringTag = '[object String]',
407
- symbolTag = '[object Symbol]',
408
- undefinedTag = '[object Undefined]',
409
- weakMapTag = '[object WeakMap]';
410
-
411
- var arrayBufferTag = '[object ArrayBuffer]',
412
- dataViewTag = '[object DataView]',
413
- float32Tag = '[object Float32Array]',
414
- float64Tag = '[object Float64Array]',
415
- int8Tag = '[object Int8Array]',
416
- int16Tag = '[object Int16Array]',
417
- int32Tag = '[object Int32Array]',
418
- uint8Tag = '[object Uint8Array]',
419
- uint8ClampedTag = '[object Uint8ClampedArray]',
420
- uint16Tag = '[object Uint16Array]',
421
- uint32Tag = '[object Uint32Array]';
422
-
423
- /**
424
- * Used to match `RegExp`
425
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
426
- */
427
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
428
-
429
- /** Used to detect host constructors (Safari). */
430
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
431
-
432
- /** Used to detect unsigned integer values. */
433
- var reIsUint = /^(?:0|[1-9]\d*)$/;
434
-
435
- /** Used to identify `toStringTag` values of typed arrays. */
436
- var typedArrayTags = {};
437
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
438
- typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
439
- typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
440
- typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
441
- typedArrayTags[uint32Tag] = true;
442
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
443
- typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
444
- typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
445
- typedArrayTags[errorTag] = typedArrayTags[funcTag] =
446
- typedArrayTags[mapTag] = typedArrayTags[numberTag] =
447
- typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
448
- typedArrayTags[setTag] = typedArrayTags[stringTag] =
449
- typedArrayTags[weakMapTag] = false;
450
-
451
- /** Detect free variable `global` from Node.js. */
452
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
453
-
454
- /** Detect free variable `self`. */
455
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
456
-
457
- /** Used as a reference to the global object. */
458
- var root = freeGlobal || freeSelf || Function('return this')();
459
-
460
- /** Detect free variable `exports`. */
461
- var freeExports = exports && !exports.nodeType && exports;
462
-
463
- /** Detect free variable `module`. */
464
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
465
-
466
- /** Detect the popular CommonJS extension `module.exports`. */
467
- var moduleExports = freeModule && freeModule.exports === freeExports;
468
-
469
- /** Detect free variable `process` from Node.js. */
470
- var freeProcess = moduleExports && freeGlobal.process;
471
-
472
- /** Used to access faster Node.js helpers. */
473
- var nodeUtil = (function() {
474
- try {
475
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
476
- } catch (e) {}
477
- }());
478
-
479
- /* Node.js helper references. */
480
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
481
-
482
- /**
483
- * A specialized version of `_.filter` for arrays without support for
484
- * iteratee shorthands.
485
- *
486
- * @private
487
- * @param {Array} [array] The array to iterate over.
488
- * @param {Function} predicate The function invoked per iteration.
489
- * @returns {Array} Returns the new filtered array.
490
- */
491
- function arrayFilter(array, predicate) {
492
- var index = -1,
493
- length = array == null ? 0 : array.length,
494
- resIndex = 0,
495
- result = [];
496
-
497
- while (++index < length) {
498
- var value = array[index];
499
- if (predicate(value, index, array)) {
500
- result[resIndex++] = value;
501
- }
502
- }
503
- return result;
504
- }
505
-
506
- /**
507
- * Appends the elements of `values` to `array`.
508
- *
509
- * @private
510
- * @param {Array} array The array to modify.
511
- * @param {Array} values The values to append.
512
- * @returns {Array} Returns `array`.
513
- */
514
- function arrayPush(array, values) {
515
- var index = -1,
516
- length = values.length,
517
- offset = array.length;
518
-
519
- while (++index < length) {
520
- array[offset + index] = values[index];
521
- }
522
- return array;
523
- }
524
-
525
- /**
526
- * A specialized version of `_.some` for arrays without support for iteratee
527
- * shorthands.
528
- *
529
- * @private
530
- * @param {Array} [array] The array to iterate over.
531
- * @param {Function} predicate The function invoked per iteration.
532
- * @returns {boolean} Returns `true` if any element passes the predicate check,
533
- * else `false`.
534
- */
535
- function arraySome(array, predicate) {
536
- var index = -1,
537
- length = array == null ? 0 : array.length;
538
-
539
- while (++index < length) {
540
- if (predicate(array[index], index, array)) {
541
- return true;
542
- }
543
- }
544
- return false;
545
- }
546
-
547
- /**
548
- * The base implementation of `_.times` without support for iteratee shorthands
549
- * or max array length checks.
550
- *
551
- * @private
552
- * @param {number} n The number of times to invoke `iteratee`.
553
- * @param {Function} iteratee The function invoked per iteration.
554
- * @returns {Array} Returns the array of results.
555
- */
556
- function baseTimes(n, iteratee) {
557
- var index = -1,
558
- result = Array(n);
559
-
560
- while (++index < n) {
561
- result[index] = iteratee(index);
562
- }
563
- return result;
564
- }
565
-
566
- /**
567
- * The base implementation of `_.unary` without support for storing metadata.
568
- *
569
- * @private
570
- * @param {Function} func The function to cap arguments for.
571
- * @returns {Function} Returns the new capped function.
572
- */
573
- function baseUnary(func) {
574
- return function(value) {
575
- return func(value);
576
- };
577
- }
578
-
579
- /**
580
- * Checks if a `cache` value for `key` exists.
581
- *
582
- * @private
583
- * @param {Object} cache The cache to query.
584
- * @param {string} key The key of the entry to check.
585
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
586
- */
587
- function cacheHas(cache, key) {
588
- return cache.has(key);
589
- }
590
-
591
- /**
592
- * Gets the value at `key` of `object`.
593
- *
594
- * @private
595
- * @param {Object} [object] The object to query.
596
- * @param {string} key The key of the property to get.
597
- * @returns {*} Returns the property value.
598
- */
599
- function getValue(object, key) {
600
- return object == null ? undefined : object[key];
601
- }
602
-
603
- /**
604
- * Converts `map` to its key-value pairs.
605
- *
606
- * @private
607
- * @param {Object} map The map to convert.
608
- * @returns {Array} Returns the key-value pairs.
609
- */
610
- function mapToArray(map) {
611
- var index = -1,
612
- result = Array(map.size);
613
-
614
- map.forEach(function(value, key) {
615
- result[++index] = [key, value];
616
- });
617
- return result;
618
- }
619
-
620
- /**
621
- * Creates a unary function that invokes `func` with its argument transformed.
622
- *
623
- * @private
624
- * @param {Function} func The function to wrap.
625
- * @param {Function} transform The argument transform.
626
- * @returns {Function} Returns the new function.
627
- */
628
- function overArg(func, transform) {
629
- return function(arg) {
630
- return func(transform(arg));
631
- };
632
- }
633
-
634
- /**
635
- * Converts `set` to an array of its values.
636
- *
637
- * @private
638
- * @param {Object} set The set to convert.
639
- * @returns {Array} Returns the values.
640
- */
641
- function setToArray(set) {
642
- var index = -1,
643
- result = Array(set.size);
644
-
645
- set.forEach(function(value) {
646
- result[++index] = value;
647
- });
648
- return result;
649
- }
650
-
651
- /** Used for built-in method references. */
652
- var arrayProto = Array.prototype,
653
- funcProto = Function.prototype,
654
- objectProto = Object.prototype;
655
-
656
- /** Used to detect overreaching core-js shims. */
657
- var coreJsData = root['__core-js_shared__'];
658
-
659
- /** Used to resolve the decompiled source of functions. */
660
- var funcToString = funcProto.toString;
661
-
662
- /** Used to check objects for own properties. */
663
- var hasOwnProperty = objectProto.hasOwnProperty;
664
-
665
- /** Used to detect methods masquerading as native. */
666
- var maskSrcKey = (function() {
667
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
668
- return uid ? ('Symbol(src)_1.' + uid) : '';
669
- }());
670
-
671
- /**
672
- * Used to resolve the
673
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
674
- * of values.
675
- */
676
- var nativeObjectToString = objectProto.toString;
677
-
678
- /** Used to detect if a method is native. */
679
- var reIsNative = RegExp('^' +
680
- funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
681
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
682
- );
683
-
684
- /** Built-in value references. */
685
- var Buffer = moduleExports ? root.Buffer : undefined,
686
- Symbol = root.Symbol,
687
- Uint8Array = root.Uint8Array,
688
- propertyIsEnumerable = objectProto.propertyIsEnumerable,
689
- splice = arrayProto.splice,
690
- symToStringTag = Symbol ? Symbol.toStringTag : undefined;
691
-
692
- /* Built-in method references for those with the same name as other `lodash` methods. */
693
- var nativeGetSymbols = Object.getOwnPropertySymbols,
694
- nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
695
- nativeKeys = overArg(Object.keys, Object);
696
-
697
- /* Built-in method references that are verified to be native. */
698
- var DataView = getNative(root, 'DataView'),
699
- Map = getNative(root, 'Map'),
700
- Promise = getNative(root, 'Promise'),
701
- Set = getNative(root, 'Set'),
702
- WeakMap = getNative(root, 'WeakMap'),
703
- nativeCreate = getNative(Object, 'create');
704
-
705
- /** Used to detect maps, sets, and weakmaps. */
706
- var dataViewCtorString = toSource(DataView),
707
- mapCtorString = toSource(Map),
708
- promiseCtorString = toSource(Promise),
709
- setCtorString = toSource(Set),
710
- weakMapCtorString = toSource(WeakMap);
711
-
712
- /** Used to convert symbols to primitives and strings. */
713
- var symbolProto = Symbol ? Symbol.prototype : undefined,
714
- symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
715
-
716
- /**
717
- * Creates a hash object.
718
- *
719
- * @private
720
- * @constructor
721
- * @param {Array} [entries] The key-value pairs to cache.
722
- */
723
- function Hash(entries) {
724
- var index = -1,
725
- length = entries == null ? 0 : entries.length;
726
-
727
- this.clear();
728
- while (++index < length) {
729
- var entry = entries[index];
730
- this.set(entry[0], entry[1]);
731
- }
732
- }
733
-
734
- /**
735
- * Removes all key-value entries from the hash.
736
- *
737
- * @private
738
- * @name clear
739
- * @memberOf Hash
740
- */
741
- function hashClear() {
742
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
743
- this.size = 0;
744
- }
745
-
746
- /**
747
- * Removes `key` and its value from the hash.
748
- *
749
- * @private
750
- * @name delete
751
- * @memberOf Hash
752
- * @param {Object} hash The hash to modify.
753
- * @param {string} key The key of the value to remove.
754
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
755
- */
756
- function hashDelete(key) {
757
- var result = this.has(key) && delete this.__data__[key];
758
- this.size -= result ? 1 : 0;
759
- return result;
760
- }
761
-
762
- /**
763
- * Gets the hash value for `key`.
764
- *
765
- * @private
766
- * @name get
767
- * @memberOf Hash
768
- * @param {string} key The key of the value to get.
769
- * @returns {*} Returns the entry value.
770
- */
771
- function hashGet(key) {
772
- var data = this.__data__;
773
- if (nativeCreate) {
774
- var result = data[key];
775
- return result === HASH_UNDEFINED ? undefined : result;
776
- }
777
- return hasOwnProperty.call(data, key) ? data[key] : undefined;
778
- }
779
-
780
- /**
781
- * Checks if a hash value for `key` exists.
782
- *
783
- * @private
784
- * @name has
785
- * @memberOf Hash
786
- * @param {string} key The key of the entry to check.
787
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
788
- */
789
- function hashHas(key) {
790
- var data = this.__data__;
791
- return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
792
- }
793
-
794
- /**
795
- * Sets the hash `key` to `value`.
796
- *
797
- * @private
798
- * @name set
799
- * @memberOf Hash
800
- * @param {string} key The key of the value to set.
801
- * @param {*} value The value to set.
802
- * @returns {Object} Returns the hash instance.
803
- */
804
- function hashSet(key, value) {
805
- var data = this.__data__;
806
- this.size += this.has(key) ? 0 : 1;
807
- data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
808
- return this;
809
- }
810
-
811
- // Add methods to `Hash`.
812
- Hash.prototype.clear = hashClear;
813
- Hash.prototype['delete'] = hashDelete;
814
- Hash.prototype.get = hashGet;
815
- Hash.prototype.has = hashHas;
816
- Hash.prototype.set = hashSet;
817
-
818
- /**
819
- * Creates an list cache object.
820
- *
821
- * @private
822
- * @constructor
823
- * @param {Array} [entries] The key-value pairs to cache.
824
- */
825
- function ListCache(entries) {
826
- var index = -1,
827
- length = entries == null ? 0 : entries.length;
828
-
829
- this.clear();
830
- while (++index < length) {
831
- var entry = entries[index];
832
- this.set(entry[0], entry[1]);
833
- }
834
- }
835
-
836
- /**
837
- * Removes all key-value entries from the list cache.
838
- *
839
- * @private
840
- * @name clear
841
- * @memberOf ListCache
842
- */
843
- function listCacheClear() {
844
- this.__data__ = [];
845
- this.size = 0;
846
- }
847
-
848
- /**
849
- * Removes `key` and its value from the list cache.
850
- *
851
- * @private
852
- * @name delete
853
- * @memberOf ListCache
854
- * @param {string} key The key of the value to remove.
855
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
856
- */
857
- function listCacheDelete(key) {
858
- var data = this.__data__,
859
- index = assocIndexOf(data, key);
860
-
861
- if (index < 0) {
862
- return false;
863
- }
864
- var lastIndex = data.length - 1;
865
- if (index == lastIndex) {
866
- data.pop();
867
- } else {
868
- splice.call(data, index, 1);
869
- }
870
- --this.size;
871
- return true;
872
- }
873
-
874
- /**
875
- * Gets the list cache value for `key`.
876
- *
877
- * @private
878
- * @name get
879
- * @memberOf ListCache
880
- * @param {string} key The key of the value to get.
881
- * @returns {*} Returns the entry value.
882
- */
883
- function listCacheGet(key) {
884
- var data = this.__data__,
885
- index = assocIndexOf(data, key);
886
-
887
- return index < 0 ? undefined : data[index][1];
888
- }
889
-
890
- /**
891
- * Checks if a list cache value for `key` exists.
892
- *
893
- * @private
894
- * @name has
895
- * @memberOf ListCache
896
- * @param {string} key The key of the entry to check.
897
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
898
- */
899
- function listCacheHas(key) {
900
- return assocIndexOf(this.__data__, key) > -1;
901
- }
902
-
903
- /**
904
- * Sets the list cache `key` to `value`.
905
- *
906
- * @private
907
- * @name set
908
- * @memberOf ListCache
909
- * @param {string} key The key of the value to set.
910
- * @param {*} value The value to set.
911
- * @returns {Object} Returns the list cache instance.
912
- */
913
- function listCacheSet(key, value) {
914
- var data = this.__data__,
915
- index = assocIndexOf(data, key);
916
-
917
- if (index < 0) {
918
- ++this.size;
919
- data.push([key, value]);
920
- } else {
921
- data[index][1] = value;
922
- }
923
- return this;
924
- }
925
-
926
- // Add methods to `ListCache`.
927
- ListCache.prototype.clear = listCacheClear;
928
- ListCache.prototype['delete'] = listCacheDelete;
929
- ListCache.prototype.get = listCacheGet;
930
- ListCache.prototype.has = listCacheHas;
931
- ListCache.prototype.set = listCacheSet;
932
-
933
- /**
934
- * Creates a map cache object to store key-value pairs.
935
- *
936
- * @private
937
- * @constructor
938
- * @param {Array} [entries] The key-value pairs to cache.
939
- */
940
- function MapCache(entries) {
941
- var index = -1,
942
- length = entries == null ? 0 : entries.length;
943
-
944
- this.clear();
945
- while (++index < length) {
946
- var entry = entries[index];
947
- this.set(entry[0], entry[1]);
948
- }
949
- }
950
-
951
- /**
952
- * Removes all key-value entries from the map.
953
- *
954
- * @private
955
- * @name clear
956
- * @memberOf MapCache
957
- */
958
- function mapCacheClear() {
959
- this.size = 0;
960
- this.__data__ = {
961
- 'hash': new Hash,
962
- 'map': new (Map || ListCache),
963
- 'string': new Hash
964
- };
965
- }
966
-
967
- /**
968
- * Removes `key` and its value from the map.
969
- *
970
- * @private
971
- * @name delete
972
- * @memberOf MapCache
973
- * @param {string} key The key of the value to remove.
974
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
975
- */
976
- function mapCacheDelete(key) {
977
- var result = getMapData(this, key)['delete'](key);
978
- this.size -= result ? 1 : 0;
979
- return result;
980
- }
981
-
982
- /**
983
- * Gets the map value for `key`.
984
- *
985
- * @private
986
- * @name get
987
- * @memberOf MapCache
988
- * @param {string} key The key of the value to get.
989
- * @returns {*} Returns the entry value.
990
- */
991
- function mapCacheGet(key) {
992
- return getMapData(this, key).get(key);
993
- }
994
-
995
- /**
996
- * Checks if a map value for `key` exists.
997
- *
998
- * @private
999
- * @name has
1000
- * @memberOf MapCache
1001
- * @param {string} key The key of the entry to check.
1002
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1003
- */
1004
- function mapCacheHas(key) {
1005
- return getMapData(this, key).has(key);
1006
- }
1007
-
1008
- /**
1009
- * Sets the map `key` to `value`.
1010
- *
1011
- * @private
1012
- * @name set
1013
- * @memberOf MapCache
1014
- * @param {string} key The key of the value to set.
1015
- * @param {*} value The value to set.
1016
- * @returns {Object} Returns the map cache instance.
1017
- */
1018
- function mapCacheSet(key, value) {
1019
- var data = getMapData(this, key),
1020
- size = data.size;
1021
-
1022
- data.set(key, value);
1023
- this.size += data.size == size ? 0 : 1;
1024
- return this;
1025
- }
1026
-
1027
- // Add methods to `MapCache`.
1028
- MapCache.prototype.clear = mapCacheClear;
1029
- MapCache.prototype['delete'] = mapCacheDelete;
1030
- MapCache.prototype.get = mapCacheGet;
1031
- MapCache.prototype.has = mapCacheHas;
1032
- MapCache.prototype.set = mapCacheSet;
1033
-
1034
- /**
1035
- *
1036
- * Creates an array cache object to store unique values.
1037
- *
1038
- * @private
1039
- * @constructor
1040
- * @param {Array} [values] The values to cache.
1041
- */
1042
- function SetCache(values) {
1043
- var index = -1,
1044
- length = values == null ? 0 : values.length;
1045
-
1046
- this.__data__ = new MapCache;
1047
- while (++index < length) {
1048
- this.add(values[index]);
1049
- }
1050
- }
1051
-
1052
- /**
1053
- * Adds `value` to the array cache.
1054
- *
1055
- * @private
1056
- * @name add
1057
- * @memberOf SetCache
1058
- * @alias push
1059
- * @param {*} value The value to cache.
1060
- * @returns {Object} Returns the cache instance.
1061
- */
1062
- function setCacheAdd(value) {
1063
- this.__data__.set(value, HASH_UNDEFINED);
1064
- return this;
1065
- }
1066
-
1067
- /**
1068
- * Checks if `value` is in the array cache.
1069
- *
1070
- * @private
1071
- * @name has
1072
- * @memberOf SetCache
1073
- * @param {*} value The value to search for.
1074
- * @returns {number} Returns `true` if `value` is found, else `false`.
1075
- */
1076
- function setCacheHas(value) {
1077
- return this.__data__.has(value);
1078
- }
1079
-
1080
- // Add methods to `SetCache`.
1081
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
1082
- SetCache.prototype.has = setCacheHas;
1083
-
1084
- /**
1085
- * Creates a stack cache object to store key-value pairs.
1086
- *
1087
- * @private
1088
- * @constructor
1089
- * @param {Array} [entries] The key-value pairs to cache.
1090
- */
1091
- function Stack(entries) {
1092
- var data = this.__data__ = new ListCache(entries);
1093
- this.size = data.size;
1094
- }
1095
-
1096
- /**
1097
- * Removes all key-value entries from the stack.
1098
- *
1099
- * @private
1100
- * @name clear
1101
- * @memberOf Stack
1102
- */
1103
- function stackClear() {
1104
- this.__data__ = new ListCache;
1105
- this.size = 0;
1106
- }
1107
-
1108
- /**
1109
- * Removes `key` and its value from the stack.
1110
- *
1111
- * @private
1112
- * @name delete
1113
- * @memberOf Stack
1114
- * @param {string} key The key of the value to remove.
1115
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1116
- */
1117
- function stackDelete(key) {
1118
- var data = this.__data__,
1119
- result = data['delete'](key);
1120
-
1121
- this.size = data.size;
1122
- return result;
1123
- }
1124
-
1125
- /**
1126
- * Gets the stack value for `key`.
1127
- *
1128
- * @private
1129
- * @name get
1130
- * @memberOf Stack
1131
- * @param {string} key The key of the value to get.
1132
- * @returns {*} Returns the entry value.
1133
- */
1134
- function stackGet(key) {
1135
- return this.__data__.get(key);
1136
- }
1137
-
1138
- /**
1139
- * Checks if a stack value for `key` exists.
1140
- *
1141
- * @private
1142
- * @name has
1143
- * @memberOf Stack
1144
- * @param {string} key The key of the entry to check.
1145
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1146
- */
1147
- function stackHas(key) {
1148
- return this.__data__.has(key);
1149
- }
1150
-
1151
- /**
1152
- * Sets the stack `key` to `value`.
1153
- *
1154
- * @private
1155
- * @name set
1156
- * @memberOf Stack
1157
- * @param {string} key The key of the value to set.
1158
- * @param {*} value The value to set.
1159
- * @returns {Object} Returns the stack cache instance.
1160
- */
1161
- function stackSet(key, value) {
1162
- var data = this.__data__;
1163
- if (data instanceof ListCache) {
1164
- var pairs = data.__data__;
1165
- if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
1166
- pairs.push([key, value]);
1167
- this.size = ++data.size;
1168
- return this;
1169
- }
1170
- data = this.__data__ = new MapCache(pairs);
1171
- }
1172
- data.set(key, value);
1173
- this.size = data.size;
1174
- return this;
1175
- }
1176
-
1177
- // Add methods to `Stack`.
1178
- Stack.prototype.clear = stackClear;
1179
- Stack.prototype['delete'] = stackDelete;
1180
- Stack.prototype.get = stackGet;
1181
- Stack.prototype.has = stackHas;
1182
- Stack.prototype.set = stackSet;
1183
-
1184
- /**
1185
- * Creates an array of the enumerable property names of the array-like `value`.
1186
- *
1187
- * @private
1188
- * @param {*} value The value to query.
1189
- * @param {boolean} inherited Specify returning inherited property names.
1190
- * @returns {Array} Returns the array of property names.
1191
- */
1192
- function arrayLikeKeys(value, inherited) {
1193
- var isArr = isArray(value),
1194
- isArg = !isArr && isArguments(value),
1195
- isBuff = !isArr && !isArg && isBuffer(value),
1196
- isType = !isArr && !isArg && !isBuff && isTypedArray(value),
1197
- skipIndexes = isArr || isArg || isBuff || isType,
1198
- result = skipIndexes ? baseTimes(value.length, String) : [],
1199
- length = result.length;
1200
-
1201
- for (var key in value) {
1202
- if ((inherited || hasOwnProperty.call(value, key)) &&
1203
- !(skipIndexes && (
1204
- // Safari 9 has enumerable `arguments.length` in strict mode.
1205
- key == 'length' ||
1206
- // Node.js 0.10 has enumerable non-index properties on buffers.
1207
- (isBuff && (key == 'offset' || key == 'parent')) ||
1208
- // PhantomJS 2 has enumerable non-index properties on typed arrays.
1209
- (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
1210
- // Skip index properties.
1211
- isIndex(key, length)
1212
- ))) {
1213
- result.push(key);
1214
- }
1215
- }
1216
- return result;
1217
- }
1218
-
1219
- /**
1220
- * Gets the index at which the `key` is found in `array` of key-value pairs.
1221
- *
1222
- * @private
1223
- * @param {Array} array The array to inspect.
1224
- * @param {*} key The key to search for.
1225
- * @returns {number} Returns the index of the matched value, else `-1`.
1226
- */
1227
- function assocIndexOf(array, key) {
1228
- var length = array.length;
1229
- while (length--) {
1230
- if (eq(array[length][0], key)) {
1231
- return length;
1232
- }
1233
- }
1234
- return -1;
1235
- }
1236
-
1237
- /**
1238
- * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
1239
- * `keysFunc` and `symbolsFunc` to get the enumerable property names and
1240
- * symbols of `object`.
1241
- *
1242
- * @private
1243
- * @param {Object} object The object to query.
1244
- * @param {Function} keysFunc The function to get the keys of `object`.
1245
- * @param {Function} symbolsFunc The function to get the symbols of `object`.
1246
- * @returns {Array} Returns the array of property names and symbols.
1247
- */
1248
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
1249
- var result = keysFunc(object);
1250
- return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
1251
- }
1252
-
1253
- /**
1254
- * The base implementation of `getTag` without fallbacks for buggy environments.
1255
- *
1256
- * @private
1257
- * @param {*} value The value to query.
1258
- * @returns {string} Returns the `toStringTag`.
1259
- */
1260
- function baseGetTag(value) {
1261
- if (value == null) {
1262
- return value === undefined ? undefinedTag : nullTag;
1263
- }
1264
- return (symToStringTag && symToStringTag in Object(value))
1265
- ? getRawTag(value)
1266
- : objectToString(value);
1267
- }
1268
-
1269
- /**
1270
- * The base implementation of `_.isArguments`.
1271
- *
1272
- * @private
1273
- * @param {*} value The value to check.
1274
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1275
- */
1276
- function baseIsArguments(value) {
1277
- return isObjectLike(value) && baseGetTag(value) == argsTag;
1278
- }
1279
-
1280
- /**
1281
- * The base implementation of `_.isEqual` which supports partial comparisons
1282
- * and tracks traversed objects.
1283
- *
1284
- * @private
1285
- * @param {*} value The value to compare.
1286
- * @param {*} other The other value to compare.
1287
- * @param {boolean} bitmask The bitmask flags.
1288
- * 1 - Unordered comparison
1289
- * 2 - Partial comparison
1290
- * @param {Function} [customizer] The function to customize comparisons.
1291
- * @param {Object} [stack] Tracks traversed `value` and `other` objects.
1292
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1293
- */
1294
- function baseIsEqual(value, other, bitmask, customizer, stack) {
1295
- if (value === other) {
1296
- return true;
1297
- }
1298
- if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
1299
- return value !== value && other !== other;
1300
- }
1301
- return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
1302
- }
1303
-
1304
- /**
1305
- * A specialized version of `baseIsEqual` for arrays and objects which performs
1306
- * deep comparisons and tracks traversed objects enabling objects with circular
1307
- * references to be compared.
1308
- *
1309
- * @private
1310
- * @param {Object} object The object to compare.
1311
- * @param {Object} other The other object to compare.
1312
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1313
- * @param {Function} customizer The function to customize comparisons.
1314
- * @param {Function} equalFunc The function to determine equivalents of values.
1315
- * @param {Object} [stack] Tracks traversed `object` and `other` objects.
1316
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1317
- */
1318
- function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
1319
- var objIsArr = isArray(object),
1320
- othIsArr = isArray(other),
1321
- objTag = objIsArr ? arrayTag : getTag(object),
1322
- othTag = othIsArr ? arrayTag : getTag(other);
1323
-
1324
- objTag = objTag == argsTag ? objectTag : objTag;
1325
- othTag = othTag == argsTag ? objectTag : othTag;
1326
-
1327
- var objIsObj = objTag == objectTag,
1328
- othIsObj = othTag == objectTag,
1329
- isSameTag = objTag == othTag;
1330
-
1331
- if (isSameTag && isBuffer(object)) {
1332
- if (!isBuffer(other)) {
1333
- return false;
1334
- }
1335
- objIsArr = true;
1336
- objIsObj = false;
1337
- }
1338
- if (isSameTag && !objIsObj) {
1339
- stack || (stack = new Stack);
1340
- return (objIsArr || isTypedArray(object))
1341
- ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
1342
- : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
1343
- }
1344
- if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
1345
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
1346
- othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
1347
-
1348
- if (objIsWrapped || othIsWrapped) {
1349
- var objUnwrapped = objIsWrapped ? object.value() : object,
1350
- othUnwrapped = othIsWrapped ? other.value() : other;
1351
-
1352
- stack || (stack = new Stack);
1353
- return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
1354
- }
1355
- }
1356
- if (!isSameTag) {
1357
- return false;
1358
- }
1359
- stack || (stack = new Stack);
1360
- return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
1361
- }
1362
-
1363
- /**
1364
- * The base implementation of `_.isNative` without bad shim checks.
1365
- *
1366
- * @private
1367
- * @param {*} value The value to check.
1368
- * @returns {boolean} Returns `true` if `value` is a native function,
1369
- * else `false`.
1370
- */
1371
- function baseIsNative(value) {
1372
- if (!isObject(value) || isMasked(value)) {
1373
- return false;
1374
- }
1375
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
1376
- return pattern.test(toSource(value));
1377
- }
1378
-
1379
- /**
1380
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
1381
- *
1382
- * @private
1383
- * @param {*} value The value to check.
1384
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1385
- */
1386
- function baseIsTypedArray(value) {
1387
- return isObjectLike(value) &&
1388
- isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
1389
- }
1390
-
1391
- /**
1392
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
1393
- *
1394
- * @private
1395
- * @param {Object} object The object to query.
1396
- * @returns {Array} Returns the array of property names.
1397
- */
1398
- function baseKeys(object) {
1399
- if (!isPrototype(object)) {
1400
- return nativeKeys(object);
1401
- }
1402
- var result = [];
1403
- for (var key in Object(object)) {
1404
- if (hasOwnProperty.call(object, key) && key != 'constructor') {
1405
- result.push(key);
1406
- }
1407
- }
1408
- return result;
1409
- }
1410
-
1411
- /**
1412
- * A specialized version of `baseIsEqualDeep` for arrays with support for
1413
- * partial deep comparisons.
1414
- *
1415
- * @private
1416
- * @param {Array} array The array to compare.
1417
- * @param {Array} other The other array to compare.
1418
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1419
- * @param {Function} customizer The function to customize comparisons.
1420
- * @param {Function} equalFunc The function to determine equivalents of values.
1421
- * @param {Object} stack Tracks traversed `array` and `other` objects.
1422
- * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
1423
- */
1424
- function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
1425
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
1426
- arrLength = array.length,
1427
- othLength = other.length;
1428
-
1429
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
1430
- return false;
1431
- }
1432
- // Assume cyclic values are equal.
1433
- var stacked = stack.get(array);
1434
- if (stacked && stack.get(other)) {
1435
- return stacked == other;
1436
- }
1437
- var index = -1,
1438
- result = true,
1439
- seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
1440
-
1441
- stack.set(array, other);
1442
- stack.set(other, array);
1443
-
1444
- // Ignore non-index properties.
1445
- while (++index < arrLength) {
1446
- var arrValue = array[index],
1447
- othValue = other[index];
1448
-
1449
- if (customizer) {
1450
- var compared = isPartial
1451
- ? customizer(othValue, arrValue, index, other, array, stack)
1452
- : customizer(arrValue, othValue, index, array, other, stack);
1453
- }
1454
- if (compared !== undefined) {
1455
- if (compared) {
1456
- continue;
1457
- }
1458
- result = false;
1459
- break;
1460
- }
1461
- // Recursively compare arrays (susceptible to call stack limits).
1462
- if (seen) {
1463
- if (!arraySome(other, function(othValue, othIndex) {
1464
- if (!cacheHas(seen, othIndex) &&
1465
- (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
1466
- return seen.push(othIndex);
1467
- }
1468
- })) {
1469
- result = false;
1470
- break;
1471
- }
1472
- } else if (!(
1473
- arrValue === othValue ||
1474
- equalFunc(arrValue, othValue, bitmask, customizer, stack)
1475
- )) {
1476
- result = false;
1477
- break;
1478
- }
1479
- }
1480
- stack['delete'](array);
1481
- stack['delete'](other);
1482
- return result;
1483
- }
1484
-
1485
- /**
1486
- * A specialized version of `baseIsEqualDeep` for comparing objects of
1487
- * the same `toStringTag`.
1488
- *
1489
- * **Note:** This function only supports comparing values with tags of
1490
- * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
1491
- *
1492
- * @private
1493
- * @param {Object} object The object to compare.
1494
- * @param {Object} other The other object to compare.
1495
- * @param {string} tag The `toStringTag` of the objects to compare.
1496
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1497
- * @param {Function} customizer The function to customize comparisons.
1498
- * @param {Function} equalFunc The function to determine equivalents of values.
1499
- * @param {Object} stack Tracks traversed `object` and `other` objects.
1500
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1501
- */
1502
- function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
1503
- switch (tag) {
1504
- case dataViewTag:
1505
- if ((object.byteLength != other.byteLength) ||
1506
- (object.byteOffset != other.byteOffset)) {
1507
- return false;
1508
- }
1509
- object = object.buffer;
1510
- other = other.buffer;
1511
-
1512
- case arrayBufferTag:
1513
- if ((object.byteLength != other.byteLength) ||
1514
- !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
1515
- return false;
1516
- }
1517
- return true;
1518
-
1519
- case boolTag:
1520
- case dateTag:
1521
- case numberTag:
1522
- // Coerce booleans to `1` or `0` and dates to milliseconds.
1523
- // Invalid dates are coerced to `NaN`.
1524
- return eq(+object, +other);
1525
-
1526
- case errorTag:
1527
- return object.name == other.name && object.message == other.message;
1528
-
1529
- case regexpTag:
1530
- case stringTag:
1531
- // Coerce regexes to strings and treat strings, primitives and objects,
1532
- // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
1533
- // for more details.
1534
- return object == (other + '');
1535
-
1536
- case mapTag:
1537
- var convert = mapToArray;
1538
-
1539
- case setTag:
1540
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
1541
- convert || (convert = setToArray);
1542
-
1543
- if (object.size != other.size && !isPartial) {
1544
- return false;
1545
- }
1546
- // Assume cyclic values are equal.
1547
- var stacked = stack.get(object);
1548
- if (stacked) {
1549
- return stacked == other;
1550
- }
1551
- bitmask |= COMPARE_UNORDERED_FLAG;
1552
-
1553
- // Recursively compare objects (susceptible to call stack limits).
1554
- stack.set(object, other);
1555
- var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
1556
- stack['delete'](object);
1557
- return result;
1558
-
1559
- case symbolTag:
1560
- if (symbolValueOf) {
1561
- return symbolValueOf.call(object) == symbolValueOf.call(other);
1562
- }
1563
- }
1564
- return false;
1565
- }
1566
-
1567
- /**
1568
- * A specialized version of `baseIsEqualDeep` for objects with support for
1569
- * partial deep comparisons.
1570
- *
1571
- * @private
1572
- * @param {Object} object The object to compare.
1573
- * @param {Object} other The other object to compare.
1574
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1575
- * @param {Function} customizer The function to customize comparisons.
1576
- * @param {Function} equalFunc The function to determine equivalents of values.
1577
- * @param {Object} stack Tracks traversed `object` and `other` objects.
1578
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1579
- */
1580
- function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
1581
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
1582
- objProps = getAllKeys(object),
1583
- objLength = objProps.length,
1584
- othProps = getAllKeys(other),
1585
- othLength = othProps.length;
1586
-
1587
- if (objLength != othLength && !isPartial) {
1588
- return false;
1589
- }
1590
- var index = objLength;
1591
- while (index--) {
1592
- var key = objProps[index];
1593
- if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
1594
- return false;
1595
- }
1596
- }
1597
- // Assume cyclic values are equal.
1598
- var stacked = stack.get(object);
1599
- if (stacked && stack.get(other)) {
1600
- return stacked == other;
1601
- }
1602
- var result = true;
1603
- stack.set(object, other);
1604
- stack.set(other, object);
1605
-
1606
- var skipCtor = isPartial;
1607
- while (++index < objLength) {
1608
- key = objProps[index];
1609
- var objValue = object[key],
1610
- othValue = other[key];
1611
-
1612
- if (customizer) {
1613
- var compared = isPartial
1614
- ? customizer(othValue, objValue, key, other, object, stack)
1615
- : customizer(objValue, othValue, key, object, other, stack);
1616
- }
1617
- // Recursively compare objects (susceptible to call stack limits).
1618
- if (!(compared === undefined
1619
- ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
1620
- : compared
1621
- )) {
1622
- result = false;
1623
- break;
1624
- }
1625
- skipCtor || (skipCtor = key == 'constructor');
1626
- }
1627
- if (result && !skipCtor) {
1628
- var objCtor = object.constructor,
1629
- othCtor = other.constructor;
1630
-
1631
- // Non `Object` object instances with different constructors are not equal.
1632
- if (objCtor != othCtor &&
1633
- ('constructor' in object && 'constructor' in other) &&
1634
- !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
1635
- typeof othCtor == 'function' && othCtor instanceof othCtor)) {
1636
- result = false;
1637
- }
1638
- }
1639
- stack['delete'](object);
1640
- stack['delete'](other);
1641
- return result;
1642
- }
1643
-
1644
- /**
1645
- * Creates an array of own enumerable property names and symbols of `object`.
1646
- *
1647
- * @private
1648
- * @param {Object} object The object to query.
1649
- * @returns {Array} Returns the array of property names and symbols.
1650
- */
1651
- function getAllKeys(object) {
1652
- return baseGetAllKeys(object, keys, getSymbols);
1653
- }
1654
-
1655
- /**
1656
- * Gets the data for `map`.
1657
- *
1658
- * @private
1659
- * @param {Object} map The map to query.
1660
- * @param {string} key The reference key.
1661
- * @returns {*} Returns the map data.
1662
- */
1663
- function getMapData(map, key) {
1664
- var data = map.__data__;
1665
- return isKeyable(key)
1666
- ? data[typeof key == 'string' ? 'string' : 'hash']
1667
- : data.map;
1668
- }
1669
-
1670
- /**
1671
- * Gets the native function at `key` of `object`.
1672
- *
1673
- * @private
1674
- * @param {Object} object The object to query.
1675
- * @param {string} key The key of the method to get.
1676
- * @returns {*} Returns the function if it's native, else `undefined`.
1677
- */
1678
- function getNative(object, key) {
1679
- var value = getValue(object, key);
1680
- return baseIsNative(value) ? value : undefined;
1681
- }
1682
-
1683
- /**
1684
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
1685
- *
1686
- * @private
1687
- * @param {*} value The value to query.
1688
- * @returns {string} Returns the raw `toStringTag`.
1689
- */
1690
- function getRawTag(value) {
1691
- var isOwn = hasOwnProperty.call(value, symToStringTag),
1692
- tag = value[symToStringTag];
1693
-
1694
- try {
1695
- value[symToStringTag] = undefined;
1696
- var unmasked = true;
1697
- } catch (e) {}
1698
-
1699
- var result = nativeObjectToString.call(value);
1700
- if (unmasked) {
1701
- if (isOwn) {
1702
- value[symToStringTag] = tag;
1703
- } else {
1704
- delete value[symToStringTag];
1705
- }
1706
- }
1707
- return result;
1708
- }
1709
-
1710
- /**
1711
- * Creates an array of the own enumerable symbols of `object`.
1712
- *
1713
- * @private
1714
- * @param {Object} object The object to query.
1715
- * @returns {Array} Returns the array of symbols.
1716
- */
1717
- var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
1718
- if (object == null) {
1719
- return [];
1720
- }
1721
- object = Object(object);
1722
- return arrayFilter(nativeGetSymbols(object), function(symbol) {
1723
- return propertyIsEnumerable.call(object, symbol);
1724
- });
1725
- };
1726
-
1727
- /**
1728
- * Gets the `toStringTag` of `value`.
1729
- *
1730
- * @private
1731
- * @param {*} value The value to query.
1732
- * @returns {string} Returns the `toStringTag`.
1733
- */
1734
- var getTag = baseGetTag;
1735
-
1736
- // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
1737
- if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
1738
- (Map && getTag(new Map) != mapTag) ||
1739
- (Promise && getTag(Promise.resolve()) != promiseTag) ||
1740
- (Set && getTag(new Set) != setTag) ||
1741
- (WeakMap && getTag(new WeakMap) != weakMapTag)) {
1742
- getTag = function(value) {
1743
- var result = baseGetTag(value),
1744
- Ctor = result == objectTag ? value.constructor : undefined,
1745
- ctorString = Ctor ? toSource(Ctor) : '';
1746
-
1747
- if (ctorString) {
1748
- switch (ctorString) {
1749
- case dataViewCtorString: return dataViewTag;
1750
- case mapCtorString: return mapTag;
1751
- case promiseCtorString: return promiseTag;
1752
- case setCtorString: return setTag;
1753
- case weakMapCtorString: return weakMapTag;
1754
- }
1755
- }
1756
- return result;
1757
- };
1758
- }
1759
-
1760
- /**
1761
- * Checks if `value` is a valid array-like index.
1762
- *
1763
- * @private
1764
- * @param {*} value The value to check.
1765
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1766
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1767
- */
1768
- function isIndex(value, length) {
1769
- length = length == null ? MAX_SAFE_INTEGER : length;
1770
- return !!length &&
1771
- (typeof value == 'number' || reIsUint.test(value)) &&
1772
- (value > -1 && value % 1 == 0 && value < length);
1773
- }
1774
-
1775
- /**
1776
- * Checks if `value` is suitable for use as unique object key.
1777
- *
1778
- * @private
1779
- * @param {*} value The value to check.
1780
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1781
- */
1782
- function isKeyable(value) {
1783
- var type = typeof value;
1784
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
1785
- ? (value !== '__proto__')
1786
- : (value === null);
1787
- }
1788
-
1789
- /**
1790
- * Checks if `func` has its source masked.
1791
- *
1792
- * @private
1793
- * @param {Function} func The function to check.
1794
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
1795
- */
1796
- function isMasked(func) {
1797
- return !!maskSrcKey && (maskSrcKey in func);
1798
- }
1799
-
1800
- /**
1801
- * Checks if `value` is likely a prototype object.
1802
- *
1803
- * @private
1804
- * @param {*} value The value to check.
1805
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1806
- */
1807
- function isPrototype(value) {
1808
- var Ctor = value && value.constructor,
1809
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
1810
-
1811
- return value === proto;
1812
- }
1813
-
1814
- /**
1815
- * Converts `value` to a string using `Object.prototype.toString`.
1816
- *
1817
- * @private
1818
- * @param {*} value The value to convert.
1819
- * @returns {string} Returns the converted string.
1820
- */
1821
- function objectToString(value) {
1822
- return nativeObjectToString.call(value);
1823
- }
1824
-
1825
- /**
1826
- * Converts `func` to its source code.
1827
- *
1828
- * @private
1829
- * @param {Function} func The function to convert.
1830
- * @returns {string} Returns the source code.
1831
- */
1832
- function toSource(func) {
1833
- if (func != null) {
1834
- try {
1835
- return funcToString.call(func);
1836
- } catch (e) {}
1837
- try {
1838
- return (func + '');
1839
- } catch (e) {}
1840
- }
1841
- return '';
1842
- }
1843
-
1844
- /**
1845
- * Performs a
1846
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1847
- * comparison between two values to determine if they are equivalent.
1848
- *
1849
- * @static
1850
- * @memberOf _
1851
- * @since 4.0.0
1852
- * @category Lang
1853
- * @param {*} value The value to compare.
1854
- * @param {*} other The other value to compare.
1855
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1856
- * @example
1857
- *
1858
- * var object = { 'a': 1 };
1859
- * var other = { 'a': 1 };
1860
- *
1861
- * _.eq(object, object);
1862
- * // => true
1863
- *
1864
- * _.eq(object, other);
1865
- * // => false
1866
- *
1867
- * _.eq('a', 'a');
1868
- * // => true
1869
- *
1870
- * _.eq('a', Object('a'));
1871
- * // => false
1872
- *
1873
- * _.eq(NaN, NaN);
1874
- * // => true
1875
- */
1876
- function eq(value, other) {
1877
- return value === other || (value !== value && other !== other);
1878
- }
1879
-
1880
- /**
1881
- * Checks if `value` is likely an `arguments` object.
1882
- *
1883
- * @static
1884
- * @memberOf _
1885
- * @since 0.1.0
1886
- * @category Lang
1887
- * @param {*} value The value to check.
1888
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1889
- * else `false`.
1890
- * @example
1891
- *
1892
- * _.isArguments(function() { return arguments; }());
1893
- * // => true
1894
- *
1895
- * _.isArguments([1, 2, 3]);
1896
- * // => false
1897
- */
1898
- var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
1899
- return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
1900
- !propertyIsEnumerable.call(value, 'callee');
1901
- };
1902
-
1903
- /**
1904
- * Checks if `value` is classified as an `Array` object.
1905
- *
1906
- * @static
1907
- * @memberOf _
1908
- * @since 0.1.0
1909
- * @category Lang
1910
- * @param {*} value The value to check.
1911
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1912
- * @example
1913
- *
1914
- * _.isArray([1, 2, 3]);
1915
- * // => true
1916
- *
1917
- * _.isArray(document.body.children);
1918
- * // => false
1919
- *
1920
- * _.isArray('abc');
1921
- * // => false
1922
- *
1923
- * _.isArray(_.noop);
1924
- * // => false
1925
- */
1926
- var isArray = Array.isArray;
1927
-
1928
- /**
1929
- * Checks if `value` is array-like. A value is considered array-like if it's
1930
- * not a function and has a `value.length` that's an integer greater than or
1931
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
1932
- *
1933
- * @static
1934
- * @memberOf _
1935
- * @since 4.0.0
1936
- * @category Lang
1937
- * @param {*} value The value to check.
1938
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
1939
- * @example
1940
- *
1941
- * _.isArrayLike([1, 2, 3]);
1942
- * // => true
1943
- *
1944
- * _.isArrayLike(document.body.children);
1945
- * // => true
1946
- *
1947
- * _.isArrayLike('abc');
1948
- * // => true
1949
- *
1950
- * _.isArrayLike(_.noop);
1951
- * // => false
1952
- */
1953
- function isArrayLike(value) {
1954
- return value != null && isLength(value.length) && !isFunction(value);
1955
- }
1956
-
1957
- /**
1958
- * Checks if `value` is a buffer.
1959
- *
1960
- * @static
1961
- * @memberOf _
1962
- * @since 4.3.0
1963
- * @category Lang
1964
- * @param {*} value The value to check.
1965
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1966
- * @example
1967
- *
1968
- * _.isBuffer(new Buffer(2));
1969
- * // => true
1970
- *
1971
- * _.isBuffer(new Uint8Array(2));
1972
- * // => false
1973
- */
1974
- var isBuffer = nativeIsBuffer || stubFalse;
1975
-
1976
- /**
1977
- * Performs a deep comparison between two values to determine if they are
1978
- * equivalent.
1979
- *
1980
- * **Note:** This method supports comparing arrays, array buffers, booleans,
1981
- * date objects, error objects, maps, numbers, `Object` objects, regexes,
1982
- * sets, strings, symbols, and typed arrays. `Object` objects are compared
1983
- * by their own, not inherited, enumerable properties. Functions and DOM
1984
- * nodes are compared by strict equality, i.e. `===`.
1985
- *
1986
- * @static
1987
- * @memberOf _
1988
- * @since 0.1.0
1989
- * @category Lang
1990
- * @param {*} value The value to compare.
1991
- * @param {*} other The other value to compare.
1992
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1993
- * @example
1994
- *
1995
- * var object = { 'a': 1 };
1996
- * var other = { 'a': 1 };
1997
- *
1998
- * _.isEqual(object, other);
1999
- * // => true
2000
- *
2001
- * object === other;
2002
- * // => false
2003
- */
2004
- function isEqual(value, other) {
2005
- return baseIsEqual(value, other);
2006
- }
2007
-
2008
- /**
2009
- * Checks if `value` is classified as a `Function` object.
2010
- *
2011
- * @static
2012
- * @memberOf _
2013
- * @since 0.1.0
2014
- * @category Lang
2015
- * @param {*} value The value to check.
2016
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
2017
- * @example
2018
- *
2019
- * _.isFunction(_);
2020
- * // => true
2021
- *
2022
- * _.isFunction(/abc/);
2023
- * // => false
2024
- */
2025
- function isFunction(value) {
2026
- if (!isObject(value)) {
2027
- return false;
2028
- }
2029
- // The use of `Object#toString` avoids issues with the `typeof` operator
2030
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
2031
- var tag = baseGetTag(value);
2032
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
2033
- }
2034
-
2035
- /**
2036
- * Checks if `value` is a valid array-like length.
2037
- *
2038
- * **Note:** This method is loosely based on
2039
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
2040
- *
2041
- * @static
2042
- * @memberOf _
2043
- * @since 4.0.0
2044
- * @category Lang
2045
- * @param {*} value The value to check.
2046
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
2047
- * @example
2048
- *
2049
- * _.isLength(3);
2050
- * // => true
2051
- *
2052
- * _.isLength(Number.MIN_VALUE);
2053
- * // => false
2054
- *
2055
- * _.isLength(Infinity);
2056
- * // => false
2057
- *
2058
- * _.isLength('3');
2059
- * // => false
2060
- */
2061
- function isLength(value) {
2062
- return typeof value == 'number' &&
2063
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
2064
- }
2065
-
2066
- /**
2067
- * Checks if `value` is the
2068
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
2069
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
2070
- *
2071
- * @static
2072
- * @memberOf _
2073
- * @since 0.1.0
2074
- * @category Lang
2075
- * @param {*} value The value to check.
2076
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
2077
- * @example
2078
- *
2079
- * _.isObject({});
2080
- * // => true
2081
- *
2082
- * _.isObject([1, 2, 3]);
2083
- * // => true
2084
- *
2085
- * _.isObject(_.noop);
2086
- * // => true
2087
- *
2088
- * _.isObject(null);
2089
- * // => false
2090
- */
2091
- function isObject(value) {
2092
- var type = typeof value;
2093
- return value != null && (type == 'object' || type == 'function');
2094
- }
2095
-
2096
- /**
2097
- * Checks if `value` is object-like. A value is object-like if it's not `null`
2098
- * and has a `typeof` result of "object".
2099
- *
2100
- * @static
2101
- * @memberOf _
2102
- * @since 4.0.0
2103
- * @category Lang
2104
- * @param {*} value The value to check.
2105
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
2106
- * @example
2107
- *
2108
- * _.isObjectLike({});
2109
- * // => true
2110
- *
2111
- * _.isObjectLike([1, 2, 3]);
2112
- * // => true
2113
- *
2114
- * _.isObjectLike(_.noop);
2115
- * // => false
2116
- *
2117
- * _.isObjectLike(null);
2118
- * // => false
2119
- */
2120
- function isObjectLike(value) {
2121
- return value != null && typeof value == 'object';
2122
- }
2123
-
2124
- /**
2125
- * Checks if `value` is classified as a typed array.
2126
- *
2127
- * @static
2128
- * @memberOf _
2129
- * @since 3.0.0
2130
- * @category Lang
2131
- * @param {*} value The value to check.
2132
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
2133
- * @example
2134
- *
2135
- * _.isTypedArray(new Uint8Array);
2136
- * // => true
2137
- *
2138
- * _.isTypedArray([]);
2139
- * // => false
2140
- */
2141
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
2142
-
2143
- /**
2144
- * Creates an array of the own enumerable property names of `object`.
2145
- *
2146
- * **Note:** Non-object values are coerced to objects. See the
2147
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
2148
- * for more details.
2149
- *
2150
- * @static
2151
- * @since 0.1.0
2152
- * @memberOf _
2153
- * @category Object
2154
- * @param {Object} object The object to query.
2155
- * @returns {Array} Returns the array of property names.
2156
- * @example
2157
- *
2158
- * function Foo() {
2159
- * this.a = 1;
2160
- * this.b = 2;
2161
- * }
2162
- *
2163
- * Foo.prototype.c = 3;
2164
- *
2165
- * _.keys(new Foo);
2166
- * // => ['a', 'b'] (iteration order is not guaranteed)
2167
- *
2168
- * _.keys('hi');
2169
- * // => ['0', '1']
2170
- */
2171
- function keys(object) {
2172
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
2173
- }
2174
-
2175
- /**
2176
- * This method returns a new empty array.
2177
- *
2178
- * @static
2179
- * @memberOf _
2180
- * @since 4.13.0
2181
- * @category Util
2182
- * @returns {Array} Returns the new empty array.
2183
- * @example
2184
- *
2185
- * var arrays = _.times(2, _.stubArray);
2186
- *
2187
- * console.log(arrays);
2188
- * // => [[], []]
2189
- *
2190
- * console.log(arrays[0] === arrays[1]);
2191
- * // => false
2192
- */
2193
- function stubArray() {
2194
- return [];
2195
- }
2196
-
2197
- /**
2198
- * This method returns `false`.
2199
- *
2200
- * @static
2201
- * @memberOf _
2202
- * @since 4.13.0
2203
- * @category Util
2204
- * @returns {boolean} Returns `false`.
2205
- * @example
2206
- *
2207
- * _.times(2, _.stubFalse);
2208
- * // => [false, false]
2209
- */
2210
- function stubFalse() {
2211
- return false;
2212
- }
2213
-
2214
- module.exports = isEqual;
2215
- });
2216
-
2217
- /**
2218
- * lodash (Custom Build) <https://lodash.com/>
2219
- * Build: `lodash modularize exports="npm" -o ./`
2220
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
2221
- * Released under MIT license <https://lodash.com/license>
2222
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
2223
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
2224
- */
2225
-
2226
- /** Used as references for various `Number` constants. */
2227
- var INFINITY = 1 / 0,
2228
- MAX_SAFE_INTEGER = 9007199254740991;
2229
-
2230
- /** `Object#toString` result references. */
2231
- var argsTag = '[object Arguments]',
2232
- funcTag = '[object Function]',
2233
- genTag = '[object GeneratorFunction]',
2234
- symbolTag = '[object Symbol]';
2235
-
2236
- /** Detect free variable `global` from Node.js. */
2237
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
2238
-
2239
- /** Detect free variable `self`. */
2240
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
2241
-
2242
- /** Used as a reference to the global object. */
2243
- var root = freeGlobal || freeSelf || Function('return this')();
2244
-
2245
- /**
2246
- * A faster alternative to `Function#apply`, this function invokes `func`
2247
- * with the `this` binding of `thisArg` and the arguments of `args`.
2248
- *
2249
- * @private
2250
- * @param {Function} func The function to invoke.
2251
- * @param {*} thisArg The `this` binding of `func`.
2252
- * @param {Array} args The arguments to invoke `func` with.
2253
- * @returns {*} Returns the result of `func`.
2254
- */
2255
- function apply(func, thisArg, args) {
2256
- switch (args.length) {
2257
- case 0: return func.call(thisArg);
2258
- case 1: return func.call(thisArg, args[0]);
2259
- case 2: return func.call(thisArg, args[0], args[1]);
2260
- case 3: return func.call(thisArg, args[0], args[1], args[2]);
2261
- }
2262
- return func.apply(thisArg, args);
2263
- }
2264
-
2265
- /**
2266
- * A specialized version of `_.map` for arrays without support for iteratee
2267
- * shorthands.
2268
- *
2269
- * @private
2270
- * @param {Array} [array] The array to iterate over.
2271
- * @param {Function} iteratee The function invoked per iteration.
2272
- * @returns {Array} Returns the new mapped array.
2273
- */
2274
- function arrayMap(array, iteratee) {
2275
- var index = -1,
2276
- length = array ? array.length : 0,
2277
- result = Array(length);
2278
-
2279
- while (++index < length) {
2280
- result[index] = iteratee(array[index], index, array);
2281
- }
2282
- return result;
2283
- }
2284
-
2285
- /**
2286
- * Appends the elements of `values` to `array`.
2287
- *
2288
- * @private
2289
- * @param {Array} array The array to modify.
2290
- * @param {Array} values The values to append.
2291
- * @returns {Array} Returns `array`.
2292
- */
2293
- function arrayPush(array, values) {
2294
- var index = -1,
2295
- length = values.length,
2296
- offset = array.length;
2297
-
2298
- while (++index < length) {
2299
- array[offset + index] = values[index];
2300
- }
2301
- return array;
2302
- }
2303
-
2304
- /** Used for built-in method references. */
2305
- var objectProto = Object.prototype;
2306
-
2307
- /** Used to check objects for own properties. */
2308
- var hasOwnProperty = objectProto.hasOwnProperty;
2309
-
2310
- /**
2311
- * Used to resolve the
2312
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
2313
- * of values.
2314
- */
2315
- var objectToString = objectProto.toString;
2316
-
2317
- /** Built-in value references. */
2318
- var Symbol = root.Symbol,
2319
- propertyIsEnumerable = objectProto.propertyIsEnumerable,
2320
- spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
2321
-
2322
- /* Built-in method references for those with the same name as other `lodash` methods. */
2323
- var nativeMax = Math.max;
2324
-
2325
- /**
2326
- * The base implementation of `_.flatten` with support for restricting flattening.
2327
- *
2328
- * @private
2329
- * @param {Array} array The array to flatten.
2330
- * @param {number} depth The maximum recursion depth.
2331
- * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
2332
- * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
2333
- * @param {Array} [result=[]] The initial result value.
2334
- * @returns {Array} Returns the new flattened array.
2335
- */
2336
- function baseFlatten(array, depth, predicate, isStrict, result) {
2337
- var index = -1,
2338
- length = array.length;
2339
-
2340
- predicate || (predicate = isFlattenable);
2341
- result || (result = []);
2342
-
2343
- while (++index < length) {
2344
- var value = array[index];
2345
- if (depth > 0 && predicate(value)) {
2346
- if (depth > 1) {
2347
- // Recursively flatten arrays (susceptible to call stack limits).
2348
- baseFlatten(value, depth - 1, predicate, isStrict, result);
2349
- } else {
2350
- arrayPush(result, value);
2351
- }
2352
- } else if (!isStrict) {
2353
- result[result.length] = value;
2354
- }
2355
- }
2356
- return result;
2357
- }
2358
-
2359
- /**
2360
- * The base implementation of `_.pick` without support for individual
2361
- * property identifiers.
2362
- *
2363
- * @private
2364
- * @param {Object} object The source object.
2365
- * @param {string[]} props The property identifiers to pick.
2366
- * @returns {Object} Returns the new object.
2367
- */
2368
- function basePick(object, props) {
2369
- object = Object(object);
2370
- return basePickBy(object, props, function(value, key) {
2371
- return key in object;
2372
- });
2373
- }
2374
-
2375
- /**
2376
- * The base implementation of `_.pickBy` without support for iteratee shorthands.
2377
- *
2378
- * @private
2379
- * @param {Object} object The source object.
2380
- * @param {string[]} props The property identifiers to pick from.
2381
- * @param {Function} predicate The function invoked per property.
2382
- * @returns {Object} Returns the new object.
2383
- */
2384
- function basePickBy(object, props, predicate) {
2385
- var index = -1,
2386
- length = props.length,
2387
- result = {};
2388
-
2389
- while (++index < length) {
2390
- var key = props[index],
2391
- value = object[key];
2392
-
2393
- if (predicate(value, key)) {
2394
- result[key] = value;
2395
- }
2396
- }
2397
- return result;
2398
- }
2399
-
2400
- /**
2401
- * The base implementation of `_.rest` which doesn't validate or coerce arguments.
2402
- *
2403
- * @private
2404
- * @param {Function} func The function to apply a rest parameter to.
2405
- * @param {number} [start=func.length-1] The start position of the rest parameter.
2406
- * @returns {Function} Returns the new function.
2407
- */
2408
- function baseRest(func, start) {
2409
- start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
2410
- return function() {
2411
- var args = arguments,
2412
- index = -1,
2413
- length = nativeMax(args.length - start, 0),
2414
- array = Array(length);
2415
-
2416
- while (++index < length) {
2417
- array[index] = args[start + index];
2418
- }
2419
- index = -1;
2420
- var otherArgs = Array(start + 1);
2421
- while (++index < start) {
2422
- otherArgs[index] = args[index];
2423
- }
2424
- otherArgs[start] = array;
2425
- return apply(func, this, otherArgs);
2426
- };
2427
- }
2428
-
2429
- /**
2430
- * Checks if `value` is a flattenable `arguments` object or array.
2431
- *
2432
- * @private
2433
- * @param {*} value The value to check.
2434
- * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
2435
- */
2436
- function isFlattenable(value) {
2437
- return isArray(value) || isArguments(value) ||
2438
- !!(spreadableSymbol && value && value[spreadableSymbol]);
2439
- }
2440
-
2441
- /**
2442
- * Converts `value` to a string key if it's not a string or symbol.
2443
- *
2444
- * @private
2445
- * @param {*} value The value to inspect.
2446
- * @returns {string|symbol} Returns the key.
2447
- */
2448
- function toKey(value) {
2449
- if (typeof value == 'string' || isSymbol(value)) {
2450
- return value;
2451
- }
2452
- var result = (value + '');
2453
- return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
2454
- }
2455
-
2456
- /**
2457
- * Checks if `value` is likely an `arguments` object.
2458
- *
2459
- * @static
2460
- * @memberOf _
2461
- * @since 0.1.0
2462
- * @category Lang
2463
- * @param {*} value The value to check.
2464
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
2465
- * else `false`.
2466
- * @example
2467
- *
2468
- * _.isArguments(function() { return arguments; }());
2469
- * // => true
2470
- *
2471
- * _.isArguments([1, 2, 3]);
2472
- * // => false
2473
- */
2474
- function isArguments(value) {
2475
- // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
2476
- return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
2477
- (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
2478
- }
2479
-
2480
- /**
2481
- * Checks if `value` is classified as an `Array` object.
2482
- *
2483
- * @static
2484
- * @memberOf _
2485
- * @since 0.1.0
2486
- * @category Lang
2487
- * @param {*} value The value to check.
2488
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
2489
- * @example
2490
- *
2491
- * _.isArray([1, 2, 3]);
2492
- * // => true
2493
- *
2494
- * _.isArray(document.body.children);
2495
- * // => false
2496
- *
2497
- * _.isArray('abc');
2498
- * // => false
2499
- *
2500
- * _.isArray(_.noop);
2501
- * // => false
2502
- */
2503
- var isArray = Array.isArray;
2504
-
2505
- /**
2506
- * Checks if `value` is array-like. A value is considered array-like if it's
2507
- * not a function and has a `value.length` that's an integer greater than or
2508
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
2509
- *
2510
- * @static
2511
- * @memberOf _
2512
- * @since 4.0.0
2513
- * @category Lang
2514
- * @param {*} value The value to check.
2515
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
2516
- * @example
2517
- *
2518
- * _.isArrayLike([1, 2, 3]);
2519
- * // => true
2520
- *
2521
- * _.isArrayLike(document.body.children);
2522
- * // => true
2523
- *
2524
- * _.isArrayLike('abc');
2525
- * // => true
2526
- *
2527
- * _.isArrayLike(_.noop);
2528
- * // => false
2529
- */
2530
- function isArrayLike(value) {
2531
- return value != null && isLength(value.length) && !isFunction(value);
2532
- }
2533
-
2534
- /**
2535
- * This method is like `_.isArrayLike` except that it also checks if `value`
2536
- * is an object.
2537
- *
2538
- * @static
2539
- * @memberOf _
2540
- * @since 4.0.0
2541
- * @category Lang
2542
- * @param {*} value The value to check.
2543
- * @returns {boolean} Returns `true` if `value` is an array-like object,
2544
- * else `false`.
2545
- * @example
2546
- *
2547
- * _.isArrayLikeObject([1, 2, 3]);
2548
- * // => true
2549
- *
2550
- * _.isArrayLikeObject(document.body.children);
2551
- * // => true
2552
- *
2553
- * _.isArrayLikeObject('abc');
2554
- * // => false
2555
- *
2556
- * _.isArrayLikeObject(_.noop);
2557
- * // => false
2558
- */
2559
- function isArrayLikeObject(value) {
2560
- return isObjectLike(value) && isArrayLike(value);
2561
- }
2562
-
2563
- /**
2564
- * Checks if `value` is classified as a `Function` object.
2565
- *
2566
- * @static
2567
- * @memberOf _
2568
- * @since 0.1.0
2569
- * @category Lang
2570
- * @param {*} value The value to check.
2571
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
2572
- * @example
2573
- *
2574
- * _.isFunction(_);
2575
- * // => true
2576
- *
2577
- * _.isFunction(/abc/);
2578
- * // => false
2579
- */
2580
- function isFunction(value) {
2581
- // The use of `Object#toString` avoids issues with the `typeof` operator
2582
- // in Safari 8-9 which returns 'object' for typed array and other constructors.
2583
- var tag = isObject(value) ? objectToString.call(value) : '';
2584
- return tag == funcTag || tag == genTag;
2585
- }
2586
-
2587
- /**
2588
- * Checks if `value` is a valid array-like length.
2589
- *
2590
- * **Note:** This method is loosely based on
2591
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
2592
- *
2593
- * @static
2594
- * @memberOf _
2595
- * @since 4.0.0
2596
- * @category Lang
2597
- * @param {*} value The value to check.
2598
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
2599
- * @example
2600
- *
2601
- * _.isLength(3);
2602
- * // => true
2603
- *
2604
- * _.isLength(Number.MIN_VALUE);
2605
- * // => false
2606
- *
2607
- * _.isLength(Infinity);
2608
- * // => false
2609
- *
2610
- * _.isLength('3');
2611
- * // => false
2612
- */
2613
- function isLength(value) {
2614
- return typeof value == 'number' &&
2615
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
2616
- }
2617
-
2618
- /**
2619
- * Checks if `value` is the
2620
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
2621
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
2622
- *
2623
- * @static
2624
- * @memberOf _
2625
- * @since 0.1.0
2626
- * @category Lang
2627
- * @param {*} value The value to check.
2628
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
2629
- * @example
2630
- *
2631
- * _.isObject({});
2632
- * // => true
2633
- *
2634
- * _.isObject([1, 2, 3]);
2635
- * // => true
2636
- *
2637
- * _.isObject(_.noop);
2638
- * // => true
2639
- *
2640
- * _.isObject(null);
2641
- * // => false
2642
- */
2643
- function isObject(value) {
2644
- var type = typeof value;
2645
- return !!value && (type == 'object' || type == 'function');
2646
- }
2647
-
2648
- /**
2649
- * Checks if `value` is object-like. A value is object-like if it's not `null`
2650
- * and has a `typeof` result of "object".
2651
- *
2652
- * @static
2653
- * @memberOf _
2654
- * @since 4.0.0
2655
- * @category Lang
2656
- * @param {*} value The value to check.
2657
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
2658
- * @example
2659
- *
2660
- * _.isObjectLike({});
2661
- * // => true
2662
- *
2663
- * _.isObjectLike([1, 2, 3]);
2664
- * // => true
2665
- *
2666
- * _.isObjectLike(_.noop);
2667
- * // => false
2668
- *
2669
- * _.isObjectLike(null);
2670
- * // => false
2671
- */
2672
- function isObjectLike(value) {
2673
- return !!value && typeof value == 'object';
2674
- }
2675
-
2676
- /**
2677
- * Checks if `value` is classified as a `Symbol` primitive or object.
2678
- *
2679
- * @static
2680
- * @memberOf _
2681
- * @since 4.0.0
2682
- * @category Lang
2683
- * @param {*} value The value to check.
2684
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
2685
- * @example
2686
- *
2687
- * _.isSymbol(Symbol.iterator);
2688
- * // => true
2689
- *
2690
- * _.isSymbol('abc');
2691
- * // => false
2692
- */
2693
- function isSymbol(value) {
2694
- return typeof value == 'symbol' ||
2695
- (isObjectLike(value) && objectToString.call(value) == symbolTag);
2696
- }
2697
-
2698
- /**
2699
- * Creates an object composed of the picked `object` properties.
2700
- *
2701
- * @static
2702
- * @since 0.1.0
2703
- * @memberOf _
2704
- * @category Object
2705
- * @param {Object} object The source object.
2706
- * @param {...(string|string[])} [props] The property identifiers to pick.
2707
- * @returns {Object} Returns the new object.
2708
- * @example
2709
- *
2710
- * var object = { 'a': 1, 'b': '2', 'c': 3 };
2711
- *
2712
- * _.pick(object, ['a', 'c']);
2713
- * // => { 'a': 1, 'c': 3 }
2714
- */
2715
- var pick = baseRest(function(object, props) {
2716
- return object == null ? {} : basePick(object, arrayMap(baseFlatten(props, 1), toKey));
2717
- });
2718
-
2719
- var lodash_pick = pick;
2720
-
2721
- function useFetchZones(params) {
2722
- const [fetchZones, resource] = adminServices.useResource({
2723
- fetchResource: getZones,
2724
- initialValue: [],
2725
- context: params.context,
2726
- resourceName: 'Banner zones',
2727
- });
2728
- compositionApi.onMounted(() => {
2729
- fetchZones();
2730
- });
2731
- return resource;
2732
- }
2733
-
2734
- var Status;
2735
- (function (Status) {
2736
- Status["Waiting"] = "WAITING";
2737
- Status["Archived"] = "ARCHIVED";
2738
- Status["Active"] = "ACTIVE";
2739
- Status["Disabled"] = "DISABLED";
2740
- })(Status || (Status = {}));
2741
-
2742
- function getStatus(type, t) {
2743
- switch (type) {
2744
- case Status.Waiting:
2745
- return t('banners:statuses.waiting');
2746
- case Status.Archived:
2747
- return t('banners:statuses.archived');
2748
- case Status.Active:
2749
- return t('banners:statuses.active');
2750
- case Status.Disabled:
2751
- return t('banners:statuses.disabled');
2752
- default:
2753
- return '';
2754
- }
2755
- }
2756
- function getColumnDefs$1(zoneList, t) {
2757
- return [
2758
- {
2759
- id: 0,
2760
- name: '#',
2761
- field: 'id',
2762
- format: ({ rowIndex }) => String(rowIndex + 1),
2763
- style: { width: '50px', textAlign: 'center' },
2764
- headStyle: { width: '50px', textAlign: 'center' },
2765
- },
2766
- {
2767
- id: 1,
2768
- name: t('banners:zone'),
2769
- field: 'bannerZone',
2770
- format: ({ row }) => {
2771
- const foundBannerZone = zoneList.find((zone) => zone.id === row.bannerZone);
2772
- return foundBannerZone
2773
- ? foundBannerZone.name
2774
- : t('banners:bannerZoneIsDeleted');
2775
- },
2776
- },
2777
- {
2778
- id: 2,
2779
- name: t('banners:status'),
2780
- field: 'status',
2781
- format: ({ row }) => getStatus(row.status, t),
2782
- style: { width: '120px' },
2783
- headStyle: { width: '120px' },
2784
- },
2785
- {
2786
- id: 3,
2787
- name: t('banners:priority'),
2788
- field: 'priority',
2789
- style: { width: '100px', textAlign: 'center' },
2790
- headStyle: { width: '100px', textAlign: 'center' },
2791
- },
2792
- {
2793
- id: 4,
2794
- name: t('banners:period'),
2795
- field: 'dateStart',
2796
- format: ({ row }) => `${row.dateStart ? `${t('banners:from')} ${row.dateStart}` : ''} ${row.dateEnd ? `${t('banners:to')} ${row.dateEnd}` : ''}`,
2797
- },
2798
- {
2799
- id: 5,
2800
- name: t('banners:image'),
2801
- field: 'image',
2802
- type: 'image',
2803
- },
2804
- {
2805
- id: 6,
2806
- name: t('banners:link'),
2807
- field: 'link',
2808
- type: 'name',
2809
- format: ({ row }) => {
2810
- var _a, _b;
2811
- return ({
2812
- adminLink: {
2813
- url: (_a = row.link) !== null && _a !== void 0 ? _a : '',
2814
- text: (_b = row.link) !== null && _b !== void 0 ? _b : '',
2815
- },
2816
- paramList: [
2817
- {
2818
- name: t('banners:newTab'),
2819
- value: row.openNewTab ? t('banners:yes') : t('banners:no'),
2820
- },
2821
- ],
2822
- });
2823
- },
2824
- options: {
2825
- shouldOpenNewTab: true,
2826
- },
2827
- },
2828
- {
2829
- id: 7,
2830
- name: t('banners:comment'),
2831
- field: 'comment',
2832
- },
2833
- {
2834
- id: 8,
2835
- name: t('banners:actions'),
2836
- field: 'actions',
2837
- style: { whiteSpace: 'nowrap', width: '100px' },
2838
- headStyle: { whiteSpace: 'nowrap', width: '100px' },
2839
- },
2840
- ];
2841
- }
2842
-
2843
- var FilterTypes;
2844
- (function (FilterTypes) {
2845
- FilterTypes["Zone"] = "zone";
2846
- FilterTypes["Date"] = "date";
2847
- FilterTypes["Status"] = "status";
2848
- })(FilterTypes || (FilterTypes = {}));
2849
- function useAdvancedSearch({ context, t, zoneList }) {
2850
- /** Zone **/
2851
- const zonesOptionList = compositionApi.computed(() => zoneList.value.map(({ id, name }) => ({
2852
- value: id,
2853
- label: name,
2854
- })));
2855
- const initialZoneFilter = compositionApi.computed(() => {
2856
- const queryValue = adminUi.getFilterParamAsStringArray(context.root.$route.query, FilterTypes.Zone);
2857
- return zonesOptionList.value.filter(({ value }) => queryValue.some((selected) => selected === value));
2858
- });
2859
- const zoneFilter = compositionApi.ref(initialZoneFilter.value);
2860
- compositionApi.watch(initialZoneFilter, () => {
2861
- zoneFilter.value = initialZoneFilter.value;
2862
- });
2863
- /** Date **/
2864
- const initialDateFilter = compositionApi.computed(() => { var _a; return (_a = adminUi.getFilterParamAsString(context.root.$route.query, FilterTypes.Date)) !== null && _a !== void 0 ? _a : ''; });
2865
- const dateFilter = compositionApi.ref(initialDateFilter.value);
2866
- compositionApi.watch(initialDateFilter, () => {
2867
- dateFilter.value = initialDateFilter.value;
2868
- });
2869
- /** Status **/
2870
- const statusesOptionList = compositionApi.computed(() => Object.entries(Status).map(([_, value]) => ({
2871
- value: value,
2872
- label: getStatus(value, t),
2873
- })));
2874
- const initialStatusFilter = compositionApi.computed(() => {
2875
- const queryValue = adminUi.getFilterParamAsStringArray(context.root.$route.query, FilterTypes.Status);
2876
- return statusesOptionList.value.filter(({ value }) => queryValue.some((selected) => selected === value));
2877
- });
2878
- const statusFilter = compositionApi.ref(initialStatusFilter.value);
2879
- compositionApi.watch(initialStatusFilter, () => {
2880
- statusFilter.value = initialStatusFilter.value;
2881
- });
2882
- /** Params **/
2883
- const filterParams = compositionApi.computed(() => adminUi.getFilterParams({
2884
- [FilterTypes.Zone]: zoneFilter.value.map(({ value }) => value),
2885
- [FilterTypes.Date]: dateFilter.value || [],
2886
- [FilterTypes.Status]: statusFilter.value.map(({ value }) => value),
2887
- }));
2888
- /** Tag removal handler **/
2889
- const tagRemovalHandler = (event) => {
2890
- if (event.name === FilterTypes.Zone) {
2891
- zoneFilter.value = zoneFilter.value.filter(({ value }) => value !== event.value);
2892
- }
2893
- if (event.name === FilterTypes.Date) {
2894
- dateFilter.value = '';
2895
- }
2896
- if (event.name === FilterTypes.Status) {
2897
- statusFilter.value = statusFilter.value.filter(({ value }) => value !== event.value);
2898
- }
2899
- };
2900
- /** Tags **/
2901
- const tags = compositionApi.computed(() => []);
2902
- return {
2903
- zoneFilter,
2904
- zonesOptionList,
2905
- dateFilter,
2906
- statusFilter,
2907
- statusesOptionList,
2908
- filterParams,
2909
- tags,
2910
- tagRemovalHandler,
2911
- };
2912
- }
2913
-
2914
- var script$1 = compositionApi.defineComponent({
2915
- name: 'BannerList',
2916
- setup(props, context) {
2917
- const { t } = adminUi.useTranslation(context);
2918
- const { loading: isZonesLoading, data: zoneList } = useFetchZones({
2919
- context,
2920
- });
2921
- const { zoneFilter, zonesOptionList, dateFilter, statusFilter, statusesOptionList, filterParams, tags, tagRemovalHandler, } = useAdvancedSearch({
2922
- context,
2923
- t,
2924
- zoneList,
2925
- });
2926
- const { fetchEntityList: fetchBanners, isLoading: isBannersLoading, rowData, errorMessage, handleChange, searchQuery, pageNumber, pageCount, pageSize, } = adminUi.useDataTable({
2927
- fetchEntityList: (params) => getBanners(Object.assign({ query: params.searchQuery, pageNumber: params.pageNumber, pageSize: params.pageSize }, filterParams.value)),
2928
- initialValue: [],
2929
- context,
2930
- resourceName: 'Banners',
2931
- });
2932
- compositionApi.watch(filterParams, () => {
2933
- if (isZonesLoading.value) {
2934
- return;
2935
- }
2936
- const newQuery = Object.assign(Object.assign({}, lodash_pick(context.root.$route.query, ['query', 'pageNumber'])), filterParams.value);
2937
- if (!lodash_isequal(context.root.$route.query, newQuery)) {
2938
- context.root.$router.replace({ query: newQuery });
2939
- fetchBanners();
2940
- }
2941
- });
2942
- const { isDeleting, handleResourceDelete } = adminServices.useResourceDelete({
2943
- deleteResource: deleteBanner,
2944
- resourceName: 'Banner',
2945
- onSuccess: fetchBanners,
2946
- context,
2947
- });
2948
- const isBusy = (bannerId) => {
2949
- return isDeleting(bannerId) || isBannersLoading.value;
2950
- };
2951
- const columnDefs = compositionApi.computed(() => getColumnDefs$1(zoneList.value, context.root.$t));
2952
- const isRowDataLoading = compositionApi.computed(() => isBannersLoading.value || isZonesLoading.value);
2953
- return {
2954
- columnDefs,
2955
- isRowDataLoading,
2956
- rowData,
2957
- errorMessage,
2958
- handleChange,
2959
- getBannersBannerFormUrl,
2960
- searchQuery,
2961
- pageNumber,
2962
- pageCount,
2963
- pageSize,
2964
- isBusy,
2965
- handleResourceDelete,
2966
- // Advanced search
2967
- zoneFilter,
2968
- zonesOptionList,
2969
- dateFilter,
2970
- statusFilter,
2971
- statusesOptionList,
2972
- tags,
2973
- tagRemovalHandler,
2974
- };
2975
- },
2976
- });
2977
-
2978
- const isOldIE = typeof navigator !== 'undefined' &&
2979
- /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
2980
- function createInjector(context) {
2981
- return (id, style) => addStyle(id, style);
2982
- }
2983
- let HEAD;
2984
- const styles = {};
2985
- function addStyle(id, css) {
2986
- const group = isOldIE ? css.media || 'default' : id;
2987
- const style = styles[group] || (styles[group] = { ids: new Set(), styles: [] });
2988
- if (!style.ids.has(id)) {
2989
- style.ids.add(id);
2990
- let code = css.source;
2991
- if (css.map) {
2992
- // https://developer.chrome.com/devtools/docs/javascript-debugging
2993
- // this makes source maps inside style tags work properly in Chrome
2994
- code += '\n/*# sourceURL=' + css.map.sources[0] + ' */';
2995
- // http://stackoverflow.com/a/26603875
2996
- code +=
2997
- '\n/*# sourceMappingURL=data:application/json;base64,' +
2998
- btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) +
2999
- ' */';
3000
- }
3001
- if (!style.element) {
3002
- style.element = document.createElement('style');
3003
- style.element.type = 'text/css';
3004
- if (css.media)
3005
- style.element.setAttribute('media', css.media);
3006
- if (HEAD === undefined) {
3007
- HEAD = document.head || document.getElementsByTagName('head')[0];
3008
- }
3009
- HEAD.appendChild(style.element);
3010
- }
3011
- if ('styleSheet' in style.element) {
3012
- style.styles.push(code);
3013
- style.element.styleSheet.cssText = style.styles
3014
- .filter(Boolean)
3015
- .join('\n');
3016
- }
3017
- else {
3018
- const index = style.ids.size - 1;
3019
- const textNode = document.createTextNode(code);
3020
- const nodes = style.element.childNodes;
3021
- if (nodes[index])
3022
- style.element.removeChild(nodes[index]);
3023
- if (nodes.length)
3024
- style.element.insertBefore(textNode, nodes[index]);
3025
- else
3026
- style.element.appendChild(textNode);
3027
- }
3028
- }
3029
- }
3030
-
3031
- /* script */
3032
- const __vue_script__$1 = script$1;
3033
-
3034
- /* template */
3035
- var __vue_render__$1 = function () {
3036
- var _vm = this;
3037
- var _h = _vm.$createElement;
3038
- var _c = _vm._self._c || _h;
3039
- return _c("page", {
3040
- attrs: {
3041
- title: _vm.$t("banners:banners"),
3042
- "header-buttons": [
3043
- {
3044
- text: _vm.$t("banners:createBanner"),
3045
- href: _vm.getBannersBannerFormUrl({ bannerId: "create" }),
3046
- },
3047
- ],
3048
- },
3049
- scopedSlots: _vm._u([
3050
- {
3051
- key: "content",
3052
- fn: function () {
3053
- return [
3054
- _c("data-table", {
3055
- attrs: {
3056
- "column-defs": _vm.columnDefs,
3057
- "row-data": _vm.rowData,
3058
- loading: _vm.isRowDataLoading,
3059
- "error-message": _vm.errorMessage,
3060
- "data-table": "banners",
3061
- "use-search": true,
3062
- "use-pagination": true,
3063
- "search-query": _vm.searchQuery,
3064
- pagination: {
3065
- pageNumber: _vm.pageNumber,
3066
- pageCount: _vm.pageCount,
3067
- pageSize: _vm.pageSize,
3068
- disabled: _vm.isRowDataLoading,
3069
- },
3070
- },
3071
- on: { change: _vm.handleChange },
3072
- scopedSlots: _vm._u([
3073
- {
3074
- key: "filters",
3075
- fn: function () {
3076
- return [
3077
- _c(
3078
- "advanced-search",
3079
- {
3080
- attrs: { tags: _vm.tags },
3081
- on: { "click:tag": _vm.tagRemovalHandler },
3082
- },
3083
- [
3084
- _c(
3085
- "div",
3086
- { staticClass: "filters" },
3087
- [
3088
- _c("form-field-multi-select", {
3089
- staticClass: "filter",
3090
- attrs: {
3091
- options: _vm.zonesOptionList,
3092
- name: "zoneFilter",
3093
- searchable: true,
3094
- label: _vm.$t("banners:zone"),
3095
- },
3096
- model: {
3097
- value: _vm.zoneFilter,
3098
- callback: function ($$v) {
3099
- _vm.zoneFilter = $$v;
3100
- },
3101
- expression: "zoneFilter",
3102
- },
3103
- }),
3104
- _vm._v(" "),
3105
- _c("form-field", {
3106
- staticClass: "filter",
3107
- attrs: {
3108
- label: _vm.$t("banners:date"),
3109
- name: "dateFilter",
3110
- type: "date",
3111
- },
3112
- model: {
3113
- value: _vm.dateFilter,
3114
- callback: function ($$v) {
3115
- _vm.dateFilter = $$v;
3116
- },
3117
- expression: "dateFilter",
3118
- },
3119
- }),
3120
- _vm._v(" "),
3121
- _c("form-field-multi-select", {
3122
- staticClass: "filter",
3123
- attrs: {
3124
- options: _vm.statusesOptionList,
3125
- name: "statusFilter",
3126
- searchable: true,
3127
- label: _vm.$t("banners:status"),
3128
- },
3129
- model: {
3130
- value: _vm.statusFilter,
3131
- callback: function ($$v) {
3132
- _vm.statusFilter = $$v;
3133
- },
3134
- expression: "statusFilter",
3135
- },
3136
- }),
3137
- ],
3138
- 1
3139
- ),
3140
- ]
3141
- ),
3142
- ]
3143
- },
3144
- proxy: true,
3145
- },
3146
- {
3147
- key: "cell(actions)",
3148
- fn: function (ref) {
3149
- var row = ref.row;
3150
- return [
3151
- _c(
3152
- "base-button",
3153
- {
3154
- attrs: {
3155
- variant: "icon",
3156
- title: _vm.$t("banners:edit"),
3157
- disabled: _vm.isBusy(row.id),
3158
- href: _vm.getBannersBannerFormUrl({
3159
- bannerId: row.id,
3160
- }),
3161
- },
3162
- },
3163
- [_c("svg-icon", { attrs: { name: "edit" } })],
3164
- 1
3165
- ),
3166
- _vm._v(" "),
3167
- _c(
3168
- "base-button",
3169
- {
3170
- attrs: {
3171
- variant: "icon",
3172
- title: _vm.$t("banners:remove"),
3173
- disabled: _vm.isBusy(row.id),
3174
- },
3175
- on: {
3176
- click: function ($event) {
3177
- return _vm.handleResourceDelete(row.id)
3178
- },
3179
- },
3180
- },
3181
- [_c("svg-icon", { attrs: { name: "delete" } })],
3182
- 1
3183
- ),
3184
- ]
3185
- },
3186
- },
3187
- ]),
3188
- }),
3189
- ]
3190
- },
3191
- proxy: true,
3192
- },
3193
- ]),
3194
- })
3195
- };
3196
- var __vue_staticRenderFns__$1 = [];
3197
- __vue_render__$1._withStripped = true;
3198
-
3199
- /* style */
3200
- const __vue_inject_styles__$1 = function (inject) {
3201
- if (!inject) return
3202
- inject("data-v-23927d9c_0", { source: ".filters {\n display: flex;\n margin: 0 -10px;\n}\n.filters:not(:first-child) {\n margin-top: 10px;\n}\n.filters .filter {\n padding: 10px 10px 0;\n width: 50%;\n margin: 0;\n}\n\n/*# sourceMappingURL=BannerList.vue.map */", map: {"version":3,"sources":["/home/runner/work/tager-admin-banners/tager-admin-banners/src/views/Banners/BannerList/BannerList.vue","BannerList.vue"],"names":[],"mappings":"AA0NA;EACA,aAAA;EACA,eAAA;ACzNA;AD2NA;EACA,gBAAA;ACzNA;AD4NA;EACA,oBAAA;EACA,UAAA;EACA,SAAA;AC1NA;;AAEA,yCAAyC","file":"BannerList.vue","sourcesContent":["<template>\n <page\n :title=\"$t('banners:banners')\"\n :header-buttons=\"[\n {\n text: $t('banners:createBanner'),\n href: getBannersBannerFormUrl({ bannerId: 'create' }),\n },\n ]\"\n >\n <template v-slot:content>\n <data-table\n :column-defs=\"columnDefs\"\n :row-data=\"rowData\"\n :loading=\"isRowDataLoading\"\n :error-message=\"errorMessage\"\n data-table=\"banners\"\n :use-search=\"true\"\n :use-pagination=\"true\"\n :search-query=\"searchQuery\"\n :pagination=\"{\n pageNumber,\n pageCount,\n pageSize,\n disabled: isRowDataLoading,\n }\"\n @change=\"handleChange\"\n >\n <template v-slot:filters>\n <advanced-search :tags=\"tags\" @click:tag=\"tagRemovalHandler\">\n <div class=\"filters\">\n <form-field-multi-select\n v-model=\"zoneFilter\"\n :options=\"zonesOptionList\"\n name=\"zoneFilter\"\n :searchable=\"true\"\n :label=\"$t('banners:zone')\"\n class=\"filter\"\n />\n\n <form-field\n v-model=\"dateFilter\"\n :label=\"$t('banners:date')\"\n name=\"dateFilter\"\n type=\"date\"\n class=\"filter\"\n />\n\n <form-field-multi-select\n v-model=\"statusFilter\"\n :options=\"statusesOptionList\"\n name=\"statusFilter\"\n :searchable=\"true\"\n :label=\"$t('banners:status')\"\n class=\"filter\"\n />\n </div>\n </advanced-search>\n </template>\n\n <template v-slot:cell(actions)=\"{ row }\">\n <base-button\n variant=\"icon\"\n :title=\"$t('banners:edit')\"\n :disabled=\"isBusy(row.id)\"\n :href=\"getBannersBannerFormUrl({ bannerId: row.id })\"\n >\n <svg-icon name=\"edit\" />\n </base-button>\n\n <base-button\n variant=\"icon\"\n :title=\"$t('banners:remove')\"\n :disabled=\"isBusy(row.id)\"\n @click=\"handleResourceDelete(row.id)\"\n >\n <svg-icon name=\"delete\" />\n </base-button>\n </template>\n </data-table>\n </template>\n </page>\n</template>\n\n<script lang=\"ts\">\nimport {\n computed,\n defineComponent,\n SetupContext,\n watch,\n} from '@vue/composition-api';\nimport isEqual from 'lodash.isequal';\nimport pick from 'lodash.pick';\n\nimport {\n ColumnDefinition,\n useDataTable,\n useTranslation,\n} from '@tager/admin-ui';\nimport { useResourceDelete } from '@tager/admin-services';\n\nimport { deleteBanner, getBanners } from '../../../services/requests';\nimport { Banner } from '../../../typings/banners';\nimport { getBannersBannerFormUrl } from '../../../constants/paths';\nimport { useFetchZones } from '../../../hooks';\n\nimport { getColumnDefs } from './BannerList.helpers';\nimport { useAdvancedSearch } from './hooks';\n\nexport default defineComponent({\n name: 'BannerList',\n setup(props, context: SetupContext) {\n const { t } = useTranslation(context);\n const { loading: isZonesLoading, data: zoneList } = useFetchZones({\n context,\n });\n\n const {\n zoneFilter,\n zonesOptionList,\n dateFilter,\n statusFilter,\n statusesOptionList,\n filterParams,\n tags,\n tagRemovalHandler,\n } = useAdvancedSearch({\n context,\n t,\n zoneList,\n });\n\n const {\n fetchEntityList: fetchBanners,\n isLoading: isBannersLoading,\n rowData,\n errorMessage,\n handleChange,\n searchQuery,\n pageNumber,\n pageCount,\n pageSize,\n } = useDataTable<Banner>({\n fetchEntityList: (params) =>\n getBanners({\n query: params.searchQuery,\n pageNumber: params.pageNumber,\n pageSize: params.pageSize,\n ...filterParams.value,\n }),\n initialValue: [],\n context,\n resourceName: 'Banners',\n });\n\n watch(filterParams, () => {\n if (isZonesLoading.value) {\n return;\n }\n\n const newQuery = {\n ...pick(context.root.$route.query, ['query', 'pageNumber']),\n ...filterParams.value,\n };\n\n if (!isEqual(context.root.$route.query, newQuery)) {\n context.root.$router.replace({ query: newQuery });\n fetchBanners();\n }\n });\n\n const { isDeleting, handleResourceDelete } = useResourceDelete({\n deleteResource: deleteBanner,\n resourceName: 'Banner',\n onSuccess: fetchBanners,\n context,\n });\n\n const isBusy = (bannerId: number): boolean => {\n return isDeleting(bannerId) || isBannersLoading.value;\n };\n\n const columnDefs = computed<ColumnDefinition<Banner>[]>(() =>\n getColumnDefs(zoneList.value, context.root.$t)\n );\n\n const isRowDataLoading = computed<boolean>(\n () => isBannersLoading.value || isZonesLoading.value\n );\n\n return {\n columnDefs,\n isRowDataLoading,\n rowData,\n errorMessage,\n handleChange,\n getBannersBannerFormUrl,\n searchQuery,\n pageNumber,\n pageCount,\n pageSize,\n isBusy,\n handleResourceDelete,\n\n // Advanced search\n zoneFilter,\n zonesOptionList,\n dateFilter,\n statusFilter,\n statusesOptionList,\n tags,\n tagRemovalHandler,\n };\n },\n});\n</script>\n\n<style lang=\"scss\">\n.filters {\n display: flex;\n margin: 0 -10px;\n\n &:not(:first-child) {\n margin-top: 10px;\n }\n\n .filter {\n padding: 10px 10px 0;\n width: 50%;\n margin: 0;\n }\n}\n</style>\n",".filters {\n display: flex;\n margin: 0 -10px;\n}\n.filters:not(:first-child) {\n margin-top: 10px;\n}\n.filters .filter {\n padding: 10px 10px 0;\n width: 50%;\n margin: 0;\n}\n\n/*# sourceMappingURL=BannerList.vue.map */"]}, media: undefined });
3203
-
3204
- };
3205
- /* scoped */
3206
- const __vue_scope_id__$1 = undefined;
3207
- /* module identifier */
3208
- const __vue_module_identifier__$1 = undefined;
3209
- /* functional template */
3210
- const __vue_is_functional_template__$1 = false;
3211
- /* style inject SSR */
3212
-
3213
- /* style inject shadow dom */
3214
-
3215
-
3216
-
3217
- const __vue_component__$1 = /*#__PURE__*/normalizeComponent(
3218
- { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 },
3219
- __vue_inject_styles__$1,
3220
- __vue_script__$1,
3221
- __vue_scope_id__$1,
3222
- __vue_is_functional_template__$1,
3223
- __vue_module_identifier__$1,
3224
- false,
3225
- createInjector,
3226
- undefined,
3227
- undefined
3228
- );
3229
-
3230
- function useFetchBanner({ context, bannerId, isCreation, }) {
3231
- const [fetchBanner, resource] = adminServices.useResource({
3232
- fetchResource: () => getBanner(bannerId.value),
3233
- initialValue: null,
3234
- context,
3235
- resourceName: 'Banner',
3236
- });
3237
- compositionApi.onMounted(() => {
3238
- if (isCreation.value) {
3239
- return;
3240
- }
3241
- fetchBanner();
3242
- });
3243
- compositionApi.watch(bannerId, () => {
3244
- if (isCreation.value) {
3245
- return;
3246
- }
3247
- fetchBanner();
3248
- });
3249
- return resource;
3250
- }
3251
-
3252
- function convertBannerToFormValues(banner, zonesOptionList) {
3253
- var _a, _b, _c, _d, _e, _f, _g;
3254
- const foundZone = zonesOptionList.find(({ value }) => value === (banner === null || banner === void 0 ? void 0 : banner.bannerZone));
3255
- return {
3256
- priority: (_a = banner === null || banner === void 0 ? void 0 : banner.priority) !== null && _a !== void 0 ? _a : 1,
3257
- link: (_b = banner === null || banner === void 0 ? void 0 : banner.link) !== null && _b !== void 0 ? _b : '',
3258
- image: (banner === null || banner === void 0 ? void 0 : banner.image) ? { id: adminServices.createId(), file: banner.image } : null,
3259
- bannerZone: foundZone !== null && foundZone !== void 0 ? foundZone : null,
3260
- openNewTab: (_c = banner === null || banner === void 0 ? void 0 : banner.openNewTab) !== null && _c !== void 0 ? _c : false,
3261
- dateStart: (_d = banner === null || banner === void 0 ? void 0 : banner.dateStart) !== null && _d !== void 0 ? _d : '',
3262
- dateEnd: (_e = banner === null || banner === void 0 ? void 0 : banner.dateEnd) !== null && _e !== void 0 ? _e : '',
3263
- disabled: (_f = banner === null || banner === void 0 ? void 0 : banner.disabled) !== null && _f !== void 0 ? _f : false,
3264
- comment: (_g = banner === null || banner === void 0 ? void 0 : banner.comment) !== null && _g !== void 0 ? _g : '',
3265
- };
3266
- }
3267
- function convertBannerFormValuesToPayload(values) {
3268
- var _a, _b, _c, _d;
3269
- return Object.assign(Object.assign({}, values), { priority: values.priority ? Number(values.priority) : 1, dateStart: values.dateStart ? values.dateStart : null, dateEnd: values.dateEnd ? values.dateEnd : null, image: (_b = (_a = values.image) === null || _a === void 0 ? void 0 : _a.file.id) !== null && _b !== void 0 ? _b : null, bannerZone: (_d = (_c = values.bannerZone) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : '' });
3270
- }
3271
-
3272
- var script$2 = compositionApi.defineComponent({
3273
- name: 'BannerForm',
3274
- components: { FormFooter: adminUi.FormFooter },
3275
- setup(props, context) {
3276
- const bannerId = compositionApi.computed(() => context.root.$route.params.bannerId);
3277
- const isCreation = compositionApi.computed(() => bannerId.value === 'create');
3278
- /** Zones **/
3279
- const { data: zones, loading: isZonesLoading } = useFetchZones({ context });
3280
- const zonesOptionList = compositionApi.computed(() => zones.value.map((zone) => ({
3281
- value: zone.id,
3282
- label: zone.name,
3283
- })));
3284
- /** Banner **/
3285
- const { data: banner, loading: isBannerLoading } = useFetchBanner({
3286
- context,
3287
- bannerId,
3288
- isCreation,
3289
- });
3290
- /** Form State **/
3291
- const isSubmitting = compositionApi.ref(false);
3292
- const values = compositionApi.ref(convertBannerToFormValues(banner.value, zonesOptionList.value));
3293
- const errors = compositionApi.ref({});
3294
- compositionApi.watch([banner, zones], () => {
3295
- values.value = convertBannerToFormValues(banner.value, zonesOptionList.value);
3296
- });
3297
- const submitForm = (event) => {
3298
- isSubmitting.value = true;
3299
- const body = convertBannerFormValuesToPayload(values.value);
3300
- const requestPromise = isCreation.value
3301
- ? createBanner(body)
3302
- : updateBanner(bannerId.value, body);
3303
- requestPromise
3304
- .then(({ data }) => {
3305
- errors.value = {};
3306
- if (event.type === 'create') {
3307
- context.root.$router.push(getBannersBannerFormUrl({ bannerId: String(data.id) }));
3308
- }
3309
- if (event.type === 'create_exit' || event.type === 'save_exit') {
3310
- context.root.$router.push(getBannersBannerListUrl());
3311
- }
3312
- if (event.type === 'create_create-another') {
3313
- values.value = convertBannerToFormValues(null, zonesOptionList.value);
3314
- }
3315
- context.root.$toast({
3316
- variant: 'success',
3317
- title: context.root.$t('banners:success'),
3318
- body: isCreation.value
3319
- ? context.root.$t('banners:bannerWasSuccessfullyCreated')
3320
- : context.root.$t('banners:bannerWasSuccessfullyUpdated'),
3321
- });
3322
- })
3323
- .catch((error) => {
3324
- console.error(error);
3325
- errors.value = adminServices.convertRequestErrorToMap(error);
3326
- context.root.$toast({
3327
- variant: 'danger',
3328
- title: context.root.$t('banners:error'),
3329
- body: isCreation.value
3330
- ? context.root.$t('banners:bannerCreationWasFailed')
3331
- : context.root.$t('banners:bannerUpdateWasFailed'),
3332
- });
3333
- })
3334
- .finally(() => {
3335
- isSubmitting.value = false;
3336
- });
3337
- };
3338
- const isContentLoading = compositionApi.computed(() => isBannerLoading.value || isZonesLoading.value);
3339
- return {
3340
- isCreation,
3341
- isContentLoading,
3342
- isSubmitting,
3343
- values,
3344
- errors,
3345
- submitForm,
3346
- bannerListUrl: getBannersBannerListUrl(),
3347
- zonesOptionList,
3348
- };
3349
- },
3350
- });
3351
-
3352
- /* script */
3353
- const __vue_script__$2 = script$2;
3354
-
3355
- /* template */
3356
- var __vue_render__$2 = function () {
3357
- var _vm = this;
3358
- var _h = _vm.$createElement;
3359
- var _c = _vm._self._c || _h;
3360
- return _c("page", {
3361
- attrs: {
3362
- title: _vm.isCreation
3363
- ? _vm.$t("banners:createBanner")
3364
- : _vm.$t("banners:updateBanner"),
3365
- "is-content-loading": _vm.isContentLoading,
3366
- },
3367
- scopedSlots: _vm._u([
3368
- {
3369
- key: "content",
3370
- fn: function () {
3371
- return [
3372
- _c(
3373
- "form",
3374
- {
3375
- attrs: { novalidate: "" },
3376
- on: {
3377
- submit: function ($event) {
3378
- $event.preventDefault();
3379
- return _vm.submitForm($event)
3380
- },
3381
- },
3382
- },
3383
- [
3384
- _c(
3385
- "div",
3386
- { staticClass: "zone" },
3387
- [
3388
- _c("form-field-select", {
3389
- attrs: {
3390
- name: "bannerZone",
3391
- label: _vm.$t("banners:zone"),
3392
- options: _vm.zonesOptionList,
3393
- error: _vm.errors.bannerZone,
3394
- },
3395
- model: {
3396
- value: _vm.values.bannerZone,
3397
- callback: function ($$v) {
3398
- _vm.$set(_vm.values, "bannerZone", $$v);
3399
- },
3400
- expression: "values.bannerZone",
3401
- },
3402
- }),
3403
- _vm._v(" "),
3404
- _c("form-field", {
3405
- attrs: {
3406
- name: "priority",
3407
- label: _vm.$t("banners:priority"),
3408
- error: _vm.errors.priority,
3409
- },
3410
- model: {
3411
- value: _vm.values.priority,
3412
- callback: function ($$v) {
3413
- _vm.$set(_vm.values, "priority", $$v);
3414
- },
3415
- expression: "values.priority",
3416
- },
3417
- }),
3418
- ],
3419
- 1
3420
- ),
3421
- _vm._v(" "),
3422
- _c("input-label", [_vm._v(_vm._s(_vm.$t("banners:period")))]),
3423
- _vm._v(" "),
3424
- _c(
3425
- "div",
3426
- { staticClass: "date" },
3427
- [
3428
- _c("form-field", {
3429
- attrs: {
3430
- label: _vm.$t("banners:from"),
3431
- name: "dateStart",
3432
- type: "date",
3433
- max: _vm.values.dateEnd,
3434
- },
3435
- model: {
3436
- value: _vm.values.dateStart,
3437
- callback: function ($$v) {
3438
- _vm.$set(_vm.values, "dateStart", $$v);
3439
- },
3440
- expression: "values.dateStart",
3441
- },
3442
- }),
3443
- _vm._v(" "),
3444
- _c("form-field", {
3445
- attrs: {
3446
- label: _vm.$t("banners:to"),
3447
- name: "dateEnd",
3448
- type: "date",
3449
- min: _vm.values.dateStart,
3450
- },
3451
- model: {
3452
- value: _vm.values.dateEnd,
3453
- callback: function ($$v) {
3454
- _vm.$set(_vm.values, "dateEnd", $$v);
3455
- },
3456
- expression: "values.dateEnd",
3457
- },
3458
- }),
3459
- ],
3460
- 1
3461
- ),
3462
- _vm._v(" "),
3463
- _c("form-field-checkbox", {
3464
- attrs: {
3465
- name: "disabled",
3466
- label: _vm.$t("banners:disabled"),
3467
- error: _vm.errors.disabled,
3468
- },
3469
- model: {
3470
- value: _vm.values.disabled,
3471
- callback: function ($$v) {
3472
- _vm.$set(_vm.values, "disabled", $$v);
3473
- },
3474
- expression: "values.disabled",
3475
- },
3476
- }),
3477
- _vm._v(" "),
3478
- _c(
3479
- "div",
3480
- { staticClass: "link" },
3481
- [
3482
- _c("form-field", {
3483
- attrs: {
3484
- name: "link",
3485
- label: _vm.$t("banners:link"),
3486
- error: _vm.errors.name,
3487
- },
3488
- model: {
3489
- value: _vm.values.link,
3490
- callback: function ($$v) {
3491
- _vm.$set(_vm.values, "link", $$v);
3492
- },
3493
- expression: "values.link",
3494
- },
3495
- }),
3496
- _vm._v(" "),
3497
- _c("form-field-checkbox", {
3498
- attrs: {
3499
- name: "openNewTab",
3500
- label: _vm.$t("banners:openNewTab"),
3501
- error: _vm.errors.openNewTab,
3502
- },
3503
- model: {
3504
- value: _vm.values.openNewTab,
3505
- callback: function ($$v) {
3506
- _vm.$set(_vm.values, "openNewTab", $$v);
3507
- },
3508
- expression: "values.openNewTab",
3509
- },
3510
- }),
3511
- ],
3512
- 1
3513
- ),
3514
- _vm._v(" "),
3515
- _c("form-field-file-input", {
3516
- attrs: {
3517
- name: "image",
3518
- "file-type": "image",
3519
- label: _vm.$t("banners:image"),
3520
- error: _vm.errors.file,
3521
- },
3522
- model: {
3523
- value: _vm.values.image,
3524
- callback: function ($$v) {
3525
- _vm.$set(_vm.values, "image", $$v);
3526
- },
3527
- expression: "values.image",
3528
- },
3529
- }),
3530
- _vm._v(" "),
3531
- _c("form-field", {
3532
- attrs: {
3533
- name: "comment",
3534
- type: "textarea",
3535
- label: _vm.$t("banners:comment"),
3536
- error: _vm.errors.comment,
3537
- },
3538
- model: {
3539
- value: _vm.values.comment,
3540
- callback: function ($$v) {
3541
- _vm.$set(_vm.values, "comment", $$v);
3542
- },
3543
- expression: "values.comment",
3544
- },
3545
- }),
3546
- ],
3547
- 1
3548
- ),
3549
- ]
3550
- },
3551
- proxy: true,
3552
- },
3553
- {
3554
- key: "footer",
3555
- fn: function () {
3556
- return [
3557
- _c("FormFooter", {
3558
- attrs: {
3559
- "back-href": _vm.bannerListUrl,
3560
- "on-submit": _vm.submitForm,
3561
- "is-submitting": _vm.isSubmitting,
3562
- "is-creation": _vm.isCreation,
3563
- "can-create-another": _vm.isCreation,
3564
- },
3565
- }),
3566
- ]
3567
- },
3568
- proxy: true,
3569
- },
3570
- ]),
3571
- })
3572
- };
3573
- var __vue_staticRenderFns__$2 = [];
3574
- __vue_render__$2._withStripped = true;
3575
-
3576
- /* style */
3577
- const __vue_inject_styles__$2 = function (inject) {
3578
- if (!inject) return
3579
- inject("data-v-6400fd96_0", { source: ".date {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 10px;\n}\n.zone {\n display: flex;\n}\n.zone > *:first-child {\n flex: 1 1 1px;\n}\n.zone > *:last-child {\n flex-basis: 30%;\n margin-left: 20px;\n}\n.link {\n display: flex;\n align-items: flex-end;\n}\n.link > *:first-child {\n flex: 1 1 1px;\n}\n.link > *:last-child {\n flex-basis: 30%;\n margin-left: 20px;\n padding-bottom: 8px;\n}\n\n/*# sourceMappingURL=BannerForm.vue.map */", map: {"version":3,"sources":["/home/runner/work/tager-admin-banners/tager-admin-banners/src/views/Banners/BannerForm/BannerForm.vue","BannerForm.vue"],"names":[],"mappings":"AAiPA;EACA,aAAA;EACA,qCAAA;EACA,gBAAA;AChPA;ADmPA;EACA,aAAA;AChPA;ADkPA;EACA,aAAA;AChPA;ADmPA;EACA,eAAA;EACA,iBAAA;ACjPA;ADqPA;EACA,aAAA;EACA,qBAAA;AClPA;ADoPA;EACA,aAAA;AClPA;ADqPA;EACA,eAAA;EACA,iBAAA;EACA,mBAAA;ACnPA;;AAEA,yCAAyC","file":"BannerForm.vue","sourcesContent":["<template>\n <page\n :title=\"\n isCreation ? $t('banners:createBanner') : $t('banners:updateBanner')\n \"\n :is-content-loading=\"isContentLoading\"\n >\n <template v-slot:content>\n <form novalidate @submit.prevent=\"submitForm\">\n <div class=\"zone\">\n <form-field-select\n v-model=\"values.bannerZone\"\n name=\"bannerZone\"\n :label=\"$t('banners:zone')\"\n :options=\"zonesOptionList\"\n :error=\"errors.bannerZone\"\n />\n\n <form-field\n v-model=\"values.priority\"\n name=\"priority\"\n :label=\"$t('banners:priority')\"\n :error=\"errors.priority\"\n />\n </div>\n\n <input-label>{{ $t('banners:period') }}</input-label>\n\n <div class=\"date\">\n <form-field\n v-model=\"values.dateStart\"\n :label=\"$t('banners:from')\"\n name=\"dateStart\"\n type=\"date\"\n :max=\"values.dateEnd\"\n />\n\n <form-field\n v-model=\"values.dateEnd\"\n :label=\"$t('banners:to')\"\n name=\"dateEnd\"\n type=\"date\"\n :min=\"values.dateStart\"\n />\n </div>\n\n <form-field-checkbox\n v-model=\"values.disabled\"\n name=\"disabled\"\n :label=\"$t('banners:disabled')\"\n :error=\"errors.disabled\"\n />\n\n <div class=\"link\">\n <form-field\n v-model=\"values.link\"\n name=\"link\"\n :label=\"$t('banners:link')\"\n :error=\"errors.name\"\n />\n\n <form-field-checkbox\n v-model=\"values.openNewTab\"\n name=\"openNewTab\"\n :label=\"$t('banners:openNewTab')\"\n :error=\"errors.openNewTab\"\n />\n </div>\n\n <form-field-file-input\n v-model=\"values.image\"\n name=\"image\"\n file-type=\"image\"\n :label=\"$t('banners:image')\"\n :error=\"errors.file\"\n />\n\n <form-field\n v-model=\"values.comment\"\n name=\"comment\"\n type=\"textarea\"\n :label=\"$t('banners:comment')\"\n :error=\"errors.comment\"\n />\n </form>\n </template>\n\n <template v-slot:footer>\n <FormFooter\n :back-href=\"bannerListUrl\"\n :on-submit=\"submitForm\"\n :is-submitting=\"isSubmitting\"\n :is-creation=\"isCreation\"\n :can-create-another=\"isCreation\"\n />\n </template>\n </page>\n</template>\n\n<script lang=\"ts\">\nimport {\n computed,\n defineComponent,\n ref,\n SetupContext,\n watch,\n} from '@vue/composition-api';\n\nimport {FormFooter, OptionType, TagerFormSubmitEvent} from '@tager/admin-ui';\nimport {convertRequestErrorToMap} from '@tager/admin-services';\n\nimport {useFetchZones} from '../../../hooks';\nimport {BannerFormValues} from '../../../typings/banners';\nimport {useFetchBanner} from '../../../hooks/useFetchBanner';\nimport {\n getBannersBannerFormUrl,\n getBannersBannerListUrl,\n} from '../../../constants/paths';\nimport {createBanner, updateBanner} from '../../../services/requests';\n\nimport {\n convertBannerFormValuesToPayload,\n convertBannerToFormValues,\n} from './BannerForm.helpers';\n\nexport default defineComponent({\n name: 'BannerForm',\n components: {FormFooter},\n setup(props, context: SetupContext) {\n const bannerId = computed<string>(\n () => context.root.$route.params.bannerId\n );\n const isCreation = computed<boolean>(() => bannerId.value === 'create');\n\n /** Zones **/\n\n const {data: zones, loading: isZonesLoading} = useFetchZones({context});\n\n const zonesOptionList = computed<OptionType[]>(() =>\n zones.value.map<OptionType>((zone) => ({\n value: zone.id,\n label: zone.name,\n }))\n );\n\n /** Banner **/\n\n const {data: banner, loading: isBannerLoading} = useFetchBanner({\n context,\n bannerId,\n isCreation,\n });\n\n /** Form State **/\n\n const isSubmitting = ref<boolean>(false);\n const values = ref<BannerFormValues>(\n convertBannerToFormValues(banner.value, zonesOptionList.value)\n );\n const errors = ref<Record<string, string>>({});\n\n watch([banner, zones], () => {\n values.value = convertBannerToFormValues(\n banner.value,\n zonesOptionList.value\n );\n });\n\n const submitForm = (event: TagerFormSubmitEvent) => {\n isSubmitting.value = true;\n\n const body = convertBannerFormValuesToPayload(values.value);\n\n const requestPromise = isCreation.value\n ? createBanner(body)\n : updateBanner(bannerId.value, body);\n\n requestPromise\n .then(({data}) => {\n errors.value = {};\n\n if (event.type === 'create') {\n context.root.$router.push(\n getBannersBannerFormUrl({bannerId: String(data.id)})\n );\n }\n\n if (event.type === 'create_exit' || event.type === 'save_exit') {\n context.root.$router.push(getBannersBannerListUrl());\n }\n\n if (event.type === 'create_create-another') {\n values.value = convertBannerToFormValues(\n null,\n zonesOptionList.value\n );\n }\n\n context.root.$toast({\n variant: 'success',\n title: context.root.$t('banners:success'),\n body: isCreation.value\n ? context.root.$t('banners:bannerWasSuccessfullyCreated')\n : context.root.$t('banners:bannerWasSuccessfullyUpdated'),\n });\n })\n .catch((error) => {\n console.error(error);\n errors.value = convertRequestErrorToMap(error);\n context.root.$toast({\n variant: 'danger',\n title: context.root.$t('banners:error'),\n body: isCreation.value\n ? context.root.$t('banners:bannerCreationWasFailed')\n : context.root.$t('banners:bannerUpdateWasFailed'),\n });\n })\n .finally(() => {\n isSubmitting.value = false;\n });\n };\n\n const isContentLoading = computed<boolean>(\n () => isBannerLoading.value || isZonesLoading.value\n );\n\n return {\n isCreation,\n isContentLoading,\n isSubmitting,\n values,\n errors,\n submitForm,\n bannerListUrl: getBannersBannerListUrl(),\n zonesOptionList,\n };\n },\n});\n</script>\n\n<style lang=\"scss\">\n.date {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 10px;\n}\n\n.zone {\n display: flex;\n\n > *:first-child {\n flex: 1 1 1px;\n }\n\n > *:last-child {\n flex-basis: 30%;\n margin-left: 20px;\n }\n}\n\n.link {\n display: flex;\n align-items: flex-end;\n\n > *:first-child {\n flex: 1 1 1px;\n }\n\n > *:last-child {\n flex-basis: 30%;\n margin-left: 20px;\n padding-bottom: 8px;\n }\n}\n</style>\n",".date {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n column-gap: 10px;\n}\n\n.zone {\n display: flex;\n}\n.zone > *:first-child {\n flex: 1 1 1px;\n}\n.zone > *:last-child {\n flex-basis: 30%;\n margin-left: 20px;\n}\n\n.link {\n display: flex;\n align-items: flex-end;\n}\n.link > *:first-child {\n flex: 1 1 1px;\n}\n.link > *:last-child {\n flex-basis: 30%;\n margin-left: 20px;\n padding-bottom: 8px;\n}\n\n/*# sourceMappingURL=BannerForm.vue.map */"]}, media: undefined });
3580
-
3581
- };
3582
- /* scoped */
3583
- const __vue_scope_id__$2 = undefined;
3584
- /* module identifier */
3585
- const __vue_module_identifier__$2 = undefined;
3586
- /* functional template */
3587
- const __vue_is_functional_template__$2 = false;
3588
- /* style inject SSR */
3589
-
3590
- /* style inject shadow dom */
3591
-
3592
-
3593
-
3594
- const __vue_component__$2 = /*#__PURE__*/normalizeComponent(
3595
- { render: __vue_render__$2, staticRenderFns: __vue_staticRenderFns__$2 },
3596
- __vue_inject_styles__$2,
3597
- __vue_script__$2,
3598
- __vue_scope_id__$2,
3599
- __vue_is_functional_template__$2,
3600
- __vue_module_identifier__$2,
3601
- false,
3602
- createInjector,
3603
- undefined,
3604
- undefined
3605
- );
3606
-
3607
- const BANNERS_ZONE_LIST_ROUTE = {
3608
- path: BANNERS_ROUTE_PATHS.ZONE_LIST,
3609
- component: __vue_component__,
3610
- name: 'Zones',
3611
- meta: {
3612
- getBreadcrumbs: (route, t) => [
3613
- { url: '/', text: t('banners:home') },
3614
- { url: BANNERS_ROUTE_PATHS.ZONE_LIST, text: t('banners:zones') },
3615
- ],
3616
- },
3617
- };
3618
- const BANNERS_BANNER_LIST_ROUTE = {
3619
- path: BANNERS_ROUTE_PATHS.BANNER_LIST,
3620
- component: __vue_component__$1,
3621
- name: 'Banners',
3622
- meta: {
3623
- getBreadcrumbs: (route, t) => [
3624
- { url: '/', text: t('banners:home') },
3625
- { url: BANNERS_ROUTE_PATHS.BANNER_LIST, text: t('banners:banners') },
3626
- ],
3627
- },
3628
- };
3629
- const BANNERS_BANNER_FORM_ROUTE = {
3630
- path: BANNERS_ROUTE_PATHS.BANNER_FORM,
3631
- component: __vue_component__$2,
3632
- name: 'Banner Form',
3633
- meta: {
3634
- getBreadcrumbs: (route, t) => [
3635
- { url: '/', text: t('banners:home') },
3636
- { url: BANNERS_ROUTE_PATHS.BANNER_LIST, text: t('banners:banners') },
3637
- { url: route.path, text: t('banners:bannerForm') },
3638
- ],
3639
- },
3640
- };
3641
-
3642
- function getBannersMenuItem(params) {
3643
- return {
3644
- id: 'banners',
3645
- text: params.t('banners:banners'),
3646
- icon: 'viewList',
3647
- children: [
3648
- { text: params.t('banners:zones'), url: getBannersZoneListUrl() },
3649
- { text: params.t('banners:banners'), url: getBannersBannerListUrl() },
3650
- {
3651
- text: params.t('banners:createBanner'),
3652
- url: getBannersBannerFormUrl({ bannerId: 'create' }),
3653
- },
3654
- ],
3655
- };
3656
- }
3657
-
3658
- adminServices.i18n.addTranslations('en', 'banners', EN);
3659
- adminServices.i18n.addTranslations('ru', 'banners', RU);
3660
-
3661
- exports.BANNERS_BANNER_FORM_ROUTE = BANNERS_BANNER_FORM_ROUTE;
3662
- exports.BANNERS_BANNER_LIST_ROUTE = BANNERS_BANNER_LIST_ROUTE;
3663
- exports.BANNERS_ROUTE_PATHS = BANNERS_ROUTE_PATHS;
3664
- exports.BANNERS_ZONE_LIST_ROUTE = BANNERS_ZONE_LIST_ROUTE;
3665
- exports.createBanner = createBanner;
3666
- exports.deleteBanner = deleteBanner;
3667
- exports.getBanner = getBanner;
3668
- exports.getBannerCount = getBannerCount;
3669
- exports.getBanners = getBanners;
3670
- exports.getBannersBannerFormUrl = getBannersBannerFormUrl;
3671
- exports.getBannersBannerListUrl = getBannersBannerListUrl;
3672
- exports.getBannersMenuItem = getBannersMenuItem;
3673
- exports.getBannersZoneListUrl = getBannersZoneListUrl;
3674
- exports.getZones = getZones;
3675
- exports.updateBanner = updateBanner;
3676
-
3677
- Object.defineProperty(exports, '__esModule', { value: true });
3678
-
3679
- })));