@steroidsjs/core 3.0.0-beta.96 → 3.0.0-beta.98

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.
@@ -4179,33 +4179,206 @@
4179
4179
  }
4180
4180
  ]
4181
4181
  },
4182
- "ICalendarSystemProps": {
4183
- "name": "ICalendarSystemProps",
4182
+ "ICalendarSystemModalViewProps": {
4183
+ "name": "ICalendarSystemModalViewProps",
4184
4184
  "moduleName": "ui/content/CalendarSystem/CalendarSystem",
4185
4185
  "title": "",
4186
4186
  "description": "",
4187
4187
  "tags": {},
4188
4188
  "defaultProps": null,
4189
4189
  "extends": [
4190
- "IUiComponent"
4190
+ "IModalProps"
4191
4191
  ],
4192
4192
  "properties": [
4193
+ {
4194
+ "name": "buttons",
4195
+ "decorators": [],
4196
+ "description": "Коллекция кнопок, которая отобразится в нижней секции Modal",
4197
+ "required": false,
4198
+ "type": "IButtonProps[]",
4199
+ "example": "[{label: __(('Закрыть')), onClick: () => props.onClose()}]"
4200
+ },
4201
+ {
4202
+ "name": "children",
4203
+ "decorators": [],
4204
+ "description": "Вложенные элементы",
4205
+ "required": false,
4206
+ "type": "any",
4207
+ "example": null
4208
+ },
4193
4209
  {
4194
4210
  "name": "className",
4195
4211
  "decorators": [],
4196
- "description": "Дополнительный CSS-класс для элемента отображения",
4212
+ "description": "Кастомный CSS-класс",
4197
4213
  "required": false,
4198
4214
  "type": "string",
4215
+ "example": "'CustomCssClassName'"
4216
+ },
4217
+ {
4218
+ "name": "closeAfterMs",
4219
+ "decorators": [],
4220
+ "description": "Время в миллисекундах, через которое автоматически произойдет закрытие Modal.",
4221
+ "required": false,
4222
+ "type": "number",
4223
+ "example": "1000"
4224
+ },
4225
+ {
4226
+ "name": "closeTimeoutMs",
4227
+ "decorators": [],
4228
+ "description": "Время, в течение которого будет происходить анимация закрытия Modal.\nПереопределяет отрезок времени, заданный в ModalPortal",
4229
+ "required": false,
4230
+ "type": "number",
4231
+ "example": "300"
4232
+ },
4233
+ {
4234
+ "name": "component",
4235
+ "decorators": [],
4236
+ "description": "Компонент, который отрендерится внутри Modal",
4237
+ "required": false,
4238
+ "type": "{}",
4239
+ "example": "() => <InnerModalComponent />"
4240
+ },
4241
+ {
4242
+ "name": "componentProps",
4243
+ "decorators": [],
4244
+ "description": "Свойства для внутреннего компонента",
4245
+ "required": false,
4246
+ "type": "any",
4199
4247
  "example": null
4200
4248
  },
4201
4249
  {
4202
- "name": "createEventModalProps",
4250
+ "name": "eventGroups",
4251
+ "decorators": [],
4252
+ "description": "",
4253
+ "required": true,
4254
+ "type": "IEventGroup[]",
4255
+ "example": null
4256
+ },
4257
+ {
4258
+ "name": "eventInitialValues",
4259
+ "decorators": [],
4260
+ "description": "",
4261
+ "required": false,
4262
+ "type": "any",
4263
+ "example": null
4264
+ },
4265
+ {
4266
+ "name": "group",
4267
+ "decorators": [],
4268
+ "description": "Группа Modal",
4269
+ "required": false,
4270
+ "type": "string",
4271
+ "example": "'modal'"
4272
+ },
4273
+ {
4274
+ "name": "index",
4275
+ "decorators": [],
4276
+ "description": "Порядковый номер Modal",
4277
+ "required": false,
4278
+ "type": "number",
4279
+ "example": "0"
4280
+ },
4281
+ {
4282
+ "name": "isClosing",
4283
+ "decorators": [],
4284
+ "description": "Значение свойства отслеживается для показа/закрытия Modal.\nЕсли для компонента ModalPortal установлено значение задержки (animationDelayMc), то после закрытия\nпользователем Modal, оно исчезнет не сразу, а через указанный в animationDelayMc промежуток времени.\nВ течение этого времени флаг isClosing будет равен true.\nЕсли задержка не установлена, Modal закроется сразу же и флаг isClosing всегда будет равен false.",
4285
+ "required": false,
4286
+ "type": "boolean",
4287
+ "example": "true"
4288
+ },
4289
+ {
4290
+ "name": "isCreate",
4291
+ "decorators": [],
4292
+ "description": "",
4293
+ "required": true,
4294
+ "type": "boolean",
4295
+ "example": null
4296
+ },
4297
+ {
4298
+ "name": "onClose",
4299
+ "decorators": [],
4300
+ "description": "Обработчик срабатывает при закрытии Modal",
4301
+ "required": false,
4302
+ "type": "{}",
4303
+ "example": null
4304
+ },
4305
+ {
4306
+ "name": "onEventSubmit",
4307
+ "decorators": [],
4308
+ "description": "",
4309
+ "required": true,
4310
+ "type": "{}",
4311
+ "example": null
4312
+ },
4313
+ {
4314
+ "name": "shouldCloseOnEsc",
4315
+ "decorators": [],
4316
+ "description": "Закрытие Modal при нажатии на клавишу 'ESC'",
4317
+ "required": false,
4318
+ "type": "boolean",
4319
+ "example": "true"
4320
+ },
4321
+ {
4322
+ "name": "shouldCloseOnOverlayClick",
4323
+ "decorators": [],
4324
+ "description": "Закрытие Modal при клике на компонент overlay внутри Modal (темный фон, отделяющий контент страницы от Modal)",
4325
+ "required": false,
4326
+ "type": "boolean",
4327
+ "example": "true"
4328
+ },
4329
+ {
4330
+ "name": "size",
4331
+ "decorators": [],
4332
+ "description": "Размер Modal",
4333
+ "required": false,
4334
+ "type": "string",
4335
+ "example": "'middle'"
4336
+ },
4337
+ {
4338
+ "name": "title",
4339
+ "decorators": [],
4340
+ "description": "Заголовок Modal",
4341
+ "required": false,
4342
+ "type": "string",
4343
+ "example": "'Заявка отправлена на модерацию'"
4344
+ },
4345
+ {
4346
+ "name": "view",
4347
+ "decorators": [],
4348
+ "description": "Переопределение React-компонента для кастомизации view-отображения",
4349
+ "required": false,
4350
+ "type": "React.ReactNode | {}",
4351
+ "example": "MyCustomView"
4352
+ }
4353
+ ]
4354
+ },
4355
+ "ICalendarSystemProps": {
4356
+ "name": "ICalendarSystemProps",
4357
+ "moduleName": "ui/content/CalendarSystem/CalendarSystem",
4358
+ "title": "",
4359
+ "description": "",
4360
+ "tags": {},
4361
+ "defaultProps": null,
4362
+ "extends": [
4363
+ "IUiComponent"
4364
+ ],
4365
+ "properties": [
4366
+ {
4367
+ "name": "calendarModalProps",
4203
4368
  "decorators": [],
4204
4369
  "description": "",
4205
4370
  "required": false,
4206
4371
  "type": "IModalProps",
4207
4372
  "example": null
4208
4373
  },
4374
+ {
4375
+ "name": "className",
4376
+ "decorators": [],
4377
+ "description": "Дополнительный CSS-класс для элемента отображения",
4378
+ "required": false,
4379
+ "type": "string",
4380
+ "example": null
4381
+ },
4209
4382
  {
4210
4383
  "name": "eventBlock",
4211
4384
  "decorators": [],
@@ -4349,15 +4522,23 @@
4349
4522
  "example": null
4350
4523
  },
4351
4524
  {
4352
- "name": "onClickCreate",
4525
+ "name": "onMonthChange",
4353
4526
  "decorators": [],
4354
4527
  "description": "",
4355
4528
  "required": true,
4356
- "type": "VoidFunction",
4529
+ "type": "{}",
4357
4530
  "example": null
4358
4531
  },
4359
4532
  {
4360
- "name": "onMonthChange",
4533
+ "name": "openCreateModal",
4534
+ "decorators": [],
4535
+ "description": "",
4536
+ "required": true,
4537
+ "type": "{}",
4538
+ "example": null
4539
+ },
4540
+ {
4541
+ "name": "openEditModal",
4361
4542
  "decorators": [],
4362
4543
  "description": "",
4363
4544
  "required": true,
@@ -4458,6 +4639,22 @@
4458
4639
  "type": "Date",
4459
4640
  "example": null
4460
4641
  },
4642
+ {
4643
+ "name": "description",
4644
+ "decorators": [],
4645
+ "description": "",
4646
+ "required": false,
4647
+ "type": "string",
4648
+ "example": null
4649
+ },
4650
+ {
4651
+ "name": "id",
4652
+ "decorators": [],
4653
+ "description": "",
4654
+ "required": true,
4655
+ "type": "number",
4656
+ "example": null
4657
+ },
4461
4658
  {
4462
4659
  "name": "title",
4463
4660
  "decorators": [],
@@ -4490,7 +4687,7 @@
4490
4687
  "decorators": [],
4491
4688
  "description": "",
4492
4689
  "required": true,
4493
- "type": "IEvent[]",
4690
+ "type": "Omit[]",
4494
4691
  "example": null
4495
4692
  },
4496
4693
  {
@@ -4511,6 +4708,67 @@
4511
4708
  }
4512
4709
  ]
4513
4710
  },
4711
+ "IEventInitialValues": {
4712
+ "name": "IEventInitialValues",
4713
+ "moduleName": "ui/content/CalendarSystem/CalendarSystem",
4714
+ "title": "",
4715
+ "description": "",
4716
+ "tags": {},
4717
+ "defaultProps": null,
4718
+ "extends": [
4719
+ "IEvent"
4720
+ ],
4721
+ "properties": [
4722
+ {
4723
+ "name": "color",
4724
+ "decorators": [],
4725
+ "description": "",
4726
+ "required": false,
4727
+ "type": "string",
4728
+ "example": null
4729
+ },
4730
+ {
4731
+ "name": "date",
4732
+ "decorators": [],
4733
+ "description": "",
4734
+ "required": true,
4735
+ "type": "Date",
4736
+ "example": null
4737
+ },
4738
+ {
4739
+ "name": "description",
4740
+ "decorators": [],
4741
+ "description": "",
4742
+ "required": false,
4743
+ "type": "string",
4744
+ "example": null
4745
+ },
4746
+ {
4747
+ "name": "eventGroupId",
4748
+ "decorators": [],
4749
+ "description": "",
4750
+ "required": true,
4751
+ "type": "string",
4752
+ "example": null
4753
+ },
4754
+ {
4755
+ "name": "id",
4756
+ "decorators": [],
4757
+ "description": "",
4758
+ "required": true,
4759
+ "type": "number",
4760
+ "example": null
4761
+ },
4762
+ {
4763
+ "name": "title",
4764
+ "decorators": [],
4765
+ "description": "",
4766
+ "required": true,
4767
+ "type": "string",
4768
+ "example": null
4769
+ }
4770
+ ]
4771
+ },
4514
4772
  "IPresentDateInfo": {
4515
4773
  "name": "IPresentDateInfo",
4516
4774
  "moduleName": "ui/content/CalendarSystem/CalendarSystem",
@@ -4961,6 +5219,220 @@
4961
5219
  }
4962
5220
  ]
4963
5221
  },
5222
+ "IDashboardItem": {
5223
+ "name": "IDashboardItem",
5224
+ "moduleName": "ui/content/Dashboard/Dashboard",
5225
+ "title": "",
5226
+ "description": "",
5227
+ "tags": {},
5228
+ "defaultProps": null,
5229
+ "extends": [
5230
+ "IFlexGridItem"
5231
+ ],
5232
+ "properties": [
5233
+ {
5234
+ "name": "col",
5235
+ "decorators": [],
5236
+ "description": "Количество колонок, которое занимает элемент, максимум 12",
5237
+ "required": false,
5238
+ "type": "number",
5239
+ "example": null
5240
+ },
5241
+ {
5242
+ "name": "content",
5243
+ "decorators": [],
5244
+ "description": "Содержимое элемента FlexGrid",
5245
+ "required": true,
5246
+ "type": "any",
5247
+ "example": null
5248
+ },
5249
+ {
5250
+ "name": "lg",
5251
+ "decorators": [],
5252
+ "description": "Количество колонок, которое занимает элемент на экранах размером lg, максимум 12",
5253
+ "required": false,
5254
+ "type": "number",
5255
+ "example": null
5256
+ },
5257
+ {
5258
+ "name": "md",
5259
+ "decorators": [],
5260
+ "description": "Количество колонок, которое занимает элемент на экранах размером md, максимум 12",
5261
+ "required": false,
5262
+ "type": "number",
5263
+ "example": null
5264
+ },
5265
+ {
5266
+ "name": "offset",
5267
+ "decorators": [],
5268
+ "description": "Количество колонок для смещения столбца слева",
5269
+ "required": false,
5270
+ "type": "number",
5271
+ "example": null
5272
+ },
5273
+ {
5274
+ "name": "order",
5275
+ "decorators": [],
5276
+ "description": "Порядок элемента в FlexGrid",
5277
+ "required": false,
5278
+ "type": "number",
5279
+ "example": null
5280
+ },
5281
+ {
5282
+ "name": "sm",
5283
+ "decorators": [],
5284
+ "description": "Количество колонок, которое занимает элемент на экранах размером sm, максимум 12",
5285
+ "required": false,
5286
+ "type": "number",
5287
+ "example": null
5288
+ },
5289
+ {
5290
+ "name": "title",
5291
+ "decorators": [],
5292
+ "description": "Заголовок для элемента",
5293
+ "required": false,
5294
+ "type": "string",
5295
+ "example": null
5296
+ }
5297
+ ]
5298
+ },
5299
+ "IDashboardItemViewProps": {
5300
+ "name": "IDashboardItemViewProps",
5301
+ "moduleName": "ui/content/Dashboard/Dashboard",
5302
+ "title": "",
5303
+ "description": "",
5304
+ "tags": {},
5305
+ "defaultProps": null,
5306
+ "extends": [],
5307
+ "properties": [
5308
+ {
5309
+ "name": "children",
5310
+ "decorators": [],
5311
+ "description": "",
5312
+ "required": true,
5313
+ "type": "ReactNode",
5314
+ "example": null
5315
+ },
5316
+ {
5317
+ "name": "title",
5318
+ "decorators": [],
5319
+ "description": "",
5320
+ "required": false,
5321
+ "type": "string",
5322
+ "example": null
5323
+ }
5324
+ ]
5325
+ },
5326
+ "IDashboardProps": {
5327
+ "name": "IDashboardProps",
5328
+ "moduleName": "ui/content/Dashboard/Dashboard",
5329
+ "title": "Dashboard",
5330
+ "description": "\nКомпонент в котором можно расположить различные элементы, например графики, таблицы на доске\n",
5331
+ "tags": {},
5332
+ "defaultProps": null,
5333
+ "extends": [
5334
+ "IUiComponent",
5335
+ "IFlexGridProps"
5336
+ ],
5337
+ "properties": [
5338
+ {
5339
+ "name": "align",
5340
+ "decorators": [],
5341
+ "description": "Значение для css-свойства align-items",
5342
+ "required": false,
5343
+ "type": "\"center\" | \"end\" | \"start\" | \"stretch\" | \"flex-start\" | \"flex-end\"",
5344
+ "example": null
5345
+ },
5346
+ {
5347
+ "name": "children",
5348
+ "decorators": [],
5349
+ "description": "Вложенные элементы",
5350
+ "required": false,
5351
+ "type": "ReactNode",
5352
+ "example": null
5353
+ },
5354
+ {
5355
+ "name": "className",
5356
+ "decorators": [],
5357
+ "description": "Дополнительный CSS-класс для элемента отображения",
5358
+ "required": false,
5359
+ "type": "string",
5360
+ "example": null
5361
+ },
5362
+ {
5363
+ "name": "direction",
5364
+ "decorators": [],
5365
+ "description": "Значение для css-свойства flex-direction",
5366
+ "required": false,
5367
+ "type": "\"column-reverse\" | \"column\" | \"row-reverse\" | \"row\"",
5368
+ "example": null
5369
+ },
5370
+ {
5371
+ "name": "gap",
5372
+ "decorators": [],
5373
+ "description": "Расстояние между элементами в px.\nЕсли передано число, то установится расстояние между строками и между колонками.\nЕсли передан массив, то первый элемент - расстояние между колонками, второй - между строками.",
5374
+ "required": false,
5375
+ "type": "number | number[]",
5376
+ "example": null
5377
+ },
5378
+ {
5379
+ "name": "itemClassName",
5380
+ "decorators": [],
5381
+ "description": "Дополнительный CSS-класс для элементов FlexGrid",
5382
+ "required": false,
5383
+ "type": "string",
5384
+ "example": null
5385
+ },
5386
+ {
5387
+ "name": "itemView",
5388
+ "decorators": [],
5389
+ "description": "Кастомная вьюшка для элемента",
5390
+ "required": false,
5391
+ "type": "React.ReactNode | {}",
5392
+ "example": null
5393
+ },
5394
+ {
5395
+ "name": "items",
5396
+ "decorators": [],
5397
+ "description": "Элементы дашборда",
5398
+ "required": true,
5399
+ "type": "IDashboardItem[]",
5400
+ "example": null
5401
+ },
5402
+ {
5403
+ "name": "justify",
5404
+ "decorators": [],
5405
+ "description": "Значение для css-свойства justify-content",
5406
+ "required": false,
5407
+ "type": "\"center\" | \"end\" | \"start\" | \"stretch\" | \"flex-start\" | \"flex-end\" | \"left\" | \"right\" | \"space-between\" | \"space-around\" | \"space-evenly\"",
5408
+ "example": null
5409
+ },
5410
+ {
5411
+ "name": "style",
5412
+ "decorators": [],
5413
+ "description": "Объект CSS стилей",
5414
+ "required": false,
5415
+ "type": "CSSProperties",
5416
+ "example": "{width: '45%'}"
5417
+ },
5418
+ {
5419
+ "name": "view",
5420
+ "decorators": [],
5421
+ "description": "Переопределение view React компонента для кастомизации отображения",
5422
+ "required": false,
5423
+ "type": "React.ReactNode | {}",
5424
+ "example": "MyCustomView"
5425
+ },
5426
+ {
5427
+ "name": "wrap",
5428
+ "decorators": [],
5429
+ "description": "Автоматический перенос на новую строку",
5430
+ "required": false,
5431
+ "type": "boolean",
5432
+ "example": null
5433
+ }
5434
+ ]
5435
+ },
4964
5436
  "IDetailItemOutputProps": {
4965
5437
  "name": "IDetailItemOutputProps",
4966
5438
  "moduleName": "ui/content/Detail/Detail",
@@ -6602,7 +7074,7 @@
6602
7074
  "name": "firstName",
6603
7075
  "decorators": [],
6604
7076
  "description": "",
6605
- "required": true,
7077
+ "required": false,
6606
7078
  "type": "string",
6607
7079
  "example": null
6608
7080
  },
@@ -6618,7 +7090,7 @@
6618
7090
  "name": "lastName",
6619
7091
  "decorators": [],
6620
7092
  "description": "",
6621
- "required": true,
7093
+ "required": false,
6622
7094
  "type": "string",
6623
7095
  "example": null
6624
7096
  }
@@ -25212,7 +25684,7 @@
25212
25684
  "decorators": [],
25213
25685
  "description": "Содержимое элемента FlexGrid",
25214
25686
  "required": true,
25215
- "type": "ReactNode",
25687
+ "type": "any",
25216
25688
  "example": null
25217
25689
  },
25218
25690
  {
@@ -30358,12 +30830,12 @@
30358
30830
  "type": "AvatarGroupProps",
30359
30831
  "example": null
30360
30832
  },
30361
- "ICalendarSystemModalViewProps": {
30362
- "name": "ICalendarSystemModalViewProps",
30833
+ "CalendarSystemModalFields": {
30834
+ "name": "CalendarSystemModalFields",
30363
30835
  "decorators": [],
30364
30836
  "description": "",
30365
30837
  "required": true,
30366
- "type": "IModalProps",
30838
+ "type": "\"title\" | \"eventGroupId\" | \"date\" | \"description\"",
30367
30839
  "example": null
30368
30840
  },
30369
30841
  "ICardViewProps": {
@@ -32767,6 +33239,13 @@
32767
33239
  "description": "",
32768
33240
  "tags": {}
32769
33241
  },
33242
+ "ui/content/Dashboard/Dashboard": {
33243
+ "name": "default",
33244
+ "moduleName": "ui/content/Dashboard/Dashboard",
33245
+ "title": "",
33246
+ "description": "",
33247
+ "tags": {}
33248
+ },
32770
33249
  "ui/content/Detail/Detail": {
32771
33250
  "name": "default",
32772
33251
  "moduleName": "ui/content/Detail/Detail",
package/en.json CHANGED
@@ -902,5 +902,9 @@
902
902
  "Обработчик события создания карточки": "",
903
903
  "Обработчик события окончания перетаскивания карточки или колонки\nВ result передается объект с информацией о событии": "",
904
904
  "Обработчик события редактирования карточки": "",
905
- "Массив тегов для задач": ""
905
+ "Массив тегов для задач": "",
906
+ "\nКомпонент в котором можно расположить различные элементы, например графики, таблицы на доске\n": "",
907
+ "Заголовок для элемента": "",
908
+ "Кастомная вьюшка для элемента": "",
909
+ "Элементы дашборда": ""
906
910
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/core",
3
- "version": "3.0.0-beta.96",
3
+ "version": "3.0.0-beta.98",
4
4
  "description": "",
5
5
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
6
6
  "repository": {
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { IModalProps } from '../../../ui/modal/Modal/Modal';
3
3
  import CalendarEnum from './enums/CalendarType';
4
4
  export type CalendarSystemModalFields = 'title' | 'eventGroupId' | 'date' | 'description';
5
+ export type CalendarSystemEventGroupModalFields = 'label' | 'color';
5
6
  export interface IEventInitialValues extends IEvent {
6
7
  eventGroupId: string;
7
8
  }
@@ -54,6 +55,7 @@ export interface ICalendarSystemViewProps extends Omit<ICalendarSystemProps, 'ca
54
55
  onMonthChange: (newDate: Date) => void;
55
56
  applyControl: (event: React.MouseEvent<HTMLElement>) => void;
56
57
  openCreateModal: (eventInitialDay?: IDay) => void;
58
+ openCreateEventGroupModal: VoidFunction;
57
59
  openEditModal: (event: IEvent) => void;
58
60
  getEventsFromDate: (dateFromDay: Date, isMonth: boolean) => IEvent[];
59
61
  onChangeEventGroupsIds: (selectedIds: number[]) => void;
@@ -65,4 +67,8 @@ export interface ICalendarSystemModalViewProps extends IModalProps {
65
67
  isCreate: boolean;
66
68
  eventInitialValues?: any;
67
69
  }
70
+ export interface CalendarSystemEventGroupModalViewProps extends IModalProps {
71
+ isCreate: boolean;
72
+ onEventGroupSubmit: (fields: Record<CalendarSystemEventGroupModalFields, string>) => void;
73
+ }
68
74
  export default function CalendarSystem(props: ICalendarSystemProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
@@ -31,6 +31,7 @@ var hooks_1 = require("../../../hooks");
31
31
  var addEventIfMatchDate_1 = require("./helpers/addEventIfMatchDate");
32
32
  var CalendarType_1 = __importDefault(require("./enums/CalendarType"));
33
33
  var useCalendarSystemModals_1 = __importDefault(require("./hooks/useCalendarSystemModals"));
34
+ var useCalendarSystemEventGroupModals_1 = require("./hooks/useCalendarSystemEventGroupModals");
34
35
  dayjs_1["default"].extend(localeData_1["default"]);
35
36
  function CalendarSystem(props) {
36
37
  var components = (0, hooks_1.useComponents)();
@@ -42,6 +43,7 @@ function CalendarSystem(props) {
42
43
  var _f = (0, hooks_1.useWeekCalendar)(currentMonthDate), currentWeekDays = _f.currentWeek, weekControls = _f.weekControls, forceUpdateWeekOnMonthChange = _f.forceUpdateWeekOnMonthChange;
43
44
  var applyControl = (0, useCalendarControls_1["default"])(calendarType, weekControls);
44
45
  var _g = (0, useCalendarSystemModals_1["default"])(props.calendarModalProps, innerEventGroups, setInnerEventGroups), openCreateModal = _g.openCreateModal, openEditModal = _g.openEditModal;
46
+ var openCreateEventGroupModal = (0, useCalendarSystemEventGroupModals_1.useCalendarSystemEventGroupModals)(innerEventGroups, setInnerEventGroups).openCreateEventGroupModal;
45
47
  var onChangeCalendarType = react_1["default"].useCallback(function (newType) {
46
48
  setCalendarType(newType);
47
49
  if (props.onChangeCalendarType) {
@@ -96,6 +98,6 @@ function CalendarSystem(props) {
96
98
  }
97
99
  return hoursArray;
98
100
  }, []);
99
- return components.ui.renderView(props.view || 'content.CalendarSystemView', __assign(__assign({}, props), { dateToDisplay: dateToDisplay, monthCalendarDays: monthCalendarDays, calendarType: calendarType, currentWeekDays: currentWeekDays, eventGroups: innerEventGroups, eventGroupsTitle: props.eventBlock.title, allHours: allHours, selectedEventGroupsIds: selectedEventGroupsIds, onChangeCalendarType: onChangeCalendarType, onMonthChange: onMonthChange, applyControl: applyControl, openCreateModal: openCreateModal, getEventsFromDate: getEventsFromDate, onChangeEventGroupsIds: function (newSelectedEventGroupsIds) { return setSelectedEventGroupsIds(newSelectedEventGroupsIds); }, openEditModal: openEditModal, weekDays: weekDays }));
101
+ return components.ui.renderView(props.view || 'content.CalendarSystemView', __assign(__assign({}, props), { dateToDisplay: dateToDisplay, monthCalendarDays: monthCalendarDays, calendarType: calendarType, currentWeekDays: currentWeekDays, eventGroups: innerEventGroups, eventGroupsTitle: props.eventBlock.title, allHours: allHours, selectedEventGroupsIds: selectedEventGroupsIds, onChangeCalendarType: onChangeCalendarType, onMonthChange: onMonthChange, applyControl: applyControl, openCreateModal: openCreateModal, getEventsFromDate: getEventsFromDate, onChangeEventGroupsIds: function (newSelectedEventGroupsIds) { return setSelectedEventGroupsIds(newSelectedEventGroupsIds); }, openCreateEventGroupModal: openCreateEventGroupModal, openEditModal: openEditModal, weekDays: weekDays }));
100
102
  }
101
103
  exports["default"] = CalendarSystem;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { IEventGroup } from '../CalendarSystem';
3
+ export declare const useCalendarSystemEventGroupModals: (innerEventGroups: IEventGroup[], setInnerEventGroups: React.Dispatch<React.SetStateAction<IEventGroup[]>>) => {
4
+ openCreateEventGroupModal: () => void;
5
+ };
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ exports.__esModule = true;
15
+ exports.useCalendarSystemEventGroupModals = void 0;
16
+ var react_redux_1 = require("react-redux");
17
+ var maxBy_1 = __importDefault(require("lodash-es/maxBy"));
18
+ var react_1 = __importDefault(require("react"));
19
+ var modal_1 = require("../../../../actions/modal");
20
+ var useComponents_1 = __importDefault(require("../../../../hooks/useComponents"));
21
+ var DEFAULT_ID = 1;
22
+ var useCalendarSystemEventGroupModals = function (innerEventGroups, setInnerEventGroups) {
23
+ var dispatch = (0, react_redux_1.useDispatch)();
24
+ var components = (0, useComponents_1["default"])();
25
+ var calendarModalView = components.ui.getView('content.CalendarSystemEventGroupModalView');
26
+ var onEventGroupSubmit = react_1["default"].useCallback(function (fields) {
27
+ var _a;
28
+ var newEventGroup = {
29
+ id: (((_a = (0, maxBy_1["default"])(innerEventGroups, function (eventsGroup) { return eventsGroup.id; })) === null || _a === void 0 ? void 0 : _a.id) || DEFAULT_ID) + 1,
30
+ label: fields.label,
31
+ color: fields.color,
32
+ events: []
33
+ };
34
+ setInnerEventGroups(function (prev) { return __spreadArray(__spreadArray([], prev, true), [newEventGroup], false); });
35
+ }, [innerEventGroups, setInnerEventGroups]);
36
+ var openCreateEventGroupModal = react_1["default"].useCallback(function () {
37
+ dispatch((0, modal_1.openModal)(calendarModalView, {
38
+ isCreate: true,
39
+ onEventGroupSubmit: onEventGroupSubmit
40
+ }));
41
+ }, [calendarModalView, dispatch, onEventGroupSubmit]);
42
+ return {
43
+ openCreateEventGroupModal: openCreateEventGroupModal
44
+ };
45
+ };
46
+ exports.useCalendarSystemEventGroupModals = useCalendarSystemEventGroupModals;
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { IFlexGridItem, IFlexGridProps } from '../../../ui/list/FlexGrid/FlexGrid';
3
+ export interface IDashboardItem extends IFlexGridItem {
4
+ /**
5
+ * Заголовок для элемента
6
+ */
7
+ title?: string;
8
+ }
9
+ /**
10
+ * Dashboard
11
+ *
12
+ * Компонент в котором можно расположить различные элементы, например графики, таблицы на доске
13
+ */
14
+ export interface IDashboardProps extends IUiComponent, IFlexGridProps {
15
+ /**
16
+ * Элементы дашборда
17
+ */
18
+ items: IDashboardItem[];
19
+ /**
20
+ * Кастомная вьюшка для элемента
21
+ */
22
+ itemView?: CustomView;
23
+ }
24
+ export interface IDashboardItemViewProps {
25
+ children: React.ReactNode;
26
+ title?: string;
27
+ }
28
+ declare function Dashboard(props: IDashboardProps): JSX.Element;
29
+ export default Dashboard;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ exports.__esModule = true;
17
+ var react_1 = __importDefault(require("react"));
18
+ var FlexGrid_1 = __importDefault(require("../../../ui/list/FlexGrid/FlexGrid"));
19
+ var hooks_1 = require("../../../hooks");
20
+ function Dashboard(props) {
21
+ var components = (0, hooks_1.useComponents)();
22
+ var DashboardItemView = props.itemView || components.ui.getView('content.DashboardItemView');
23
+ var flexGridItems = react_1["default"].useMemo(function () { return props.items.map(function (item) { return (__assign(__assign({}, item), { content: (react_1["default"].createElement(DashboardItemView, { title: item.title }, item.content)) })); }); }, [DashboardItemView, props.items]);
24
+ return (react_1["default"].createElement(FlexGrid_1["default"], __assign({}, props, { items: flexGridItems })));
25
+ }
26
+ exports["default"] = Dashboard;
@@ -0,0 +1,2 @@
1
+ import Dashboard from './Dashboard';
2
+ export default Dashboard;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ exports.__esModule = true;
6
+ var Dashboard_1 = __importDefault(require("./Dashboard"));
7
+ exports["default"] = Dashboard_1["default"];
@@ -1,9 +1,9 @@
1
- import { ReactNode } from 'react';
1
+ /// <reference types="react" />
2
2
  export interface IFlexGridItem {
3
3
  /**
4
4
  * Содержимое элемента FlexGrid
5
5
  */
6
- content: ReactNode;
6
+ content: any;
7
7
  /**
8
8
  * Порядок элемента в FlexGrid
9
9
  */