@tager/admin-banners 0.3.7 → 1.0.0

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