@3t-transform/threeteeui 0.0.4 → 0.0.5

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 (53) hide show
  1. package/dist/cjs/{index-eb8fc323.js → index-8a7479e4.js} +22 -2
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/qualifications-list.cjs.entry.js +7149 -0
  4. package/dist/cjs/toolbar-02115550.js +864 -0
  5. package/dist/cjs/tttx-icon.cjs.entry.js +21 -0
  6. package/dist/cjs/tttx-page.cjs.entry.js +59 -58
  7. package/dist/cjs/tttx-worksheet.cjs.entry.js +4 -3
  8. package/dist/cjs/tttx.cjs.js +2 -2
  9. package/dist/cjs/{toolbar-656be6e6.js → ui.popover-27780a1d.js} +9546 -10229
  10. package/dist/collection/collection-manifest.json +2 -0
  11. package/dist/collection/components/components/tttx-icon/tttx-icon.css +89 -0
  12. package/dist/collection/components/components/tttx-icon/tttx-icon.js +59 -0
  13. package/dist/collection/components/components/tttx-icon/tttx-icon.stories.js +40 -0
  14. package/dist/collection/components/patterns/qualifications-list/qualifications-list.js +32 -0
  15. package/dist/collection/components/patterns/qualifications-list/qualifications-list.stories.js +7 -0
  16. package/dist/components/index.d.ts +2 -0
  17. package/dist/components/index.js +2 -0
  18. package/dist/components/qualifications-list.d.ts +11 -0
  19. package/dist/components/qualifications-list.js +7162 -0
  20. package/dist/components/tttx-icon.d.ts +11 -0
  21. package/dist/components/tttx-icon.js +37 -0
  22. package/dist/components/tttx-page.js +2 -1
  23. package/dist/components/tttx-worksheet.js +1 -1
  24. package/dist/components/tttx-worksheet2.js +61 -33431
  25. package/dist/{esm/toolbar-cede4385.js → components/ui.popover.js} +9447 -10229
  26. package/dist/esm/{index-4c11a593.js → index-854ff56f.js} +22 -2
  27. package/dist/esm/loader.js +2 -2
  28. package/dist/esm/qualifications-list.entry.js +7145 -0
  29. package/dist/esm/toolbar-b147a3aa.js +862 -0
  30. package/dist/esm/tttx-icon.entry.js +17 -0
  31. package/dist/esm/tttx-page.entry.js +3 -2
  32. package/dist/esm/tttx-worksheet.entry.js +3 -2
  33. package/dist/esm/tttx.js +2 -2
  34. package/dist/esm/ui.popover-0c8f8d79.js +33449 -0
  35. package/dist/tttx/p-4f4963aa.entry.js +1 -0
  36. package/dist/tttx/p-69ca02f6.entry.js +1 -0
  37. package/dist/tttx/p-7244abd4.entry.js +1 -0
  38. package/dist/tttx/p-7eb8146c.entry.js +1 -0
  39. package/dist/tttx/p-81cad444.js +1 -0
  40. package/dist/tttx/p-955d89ac.js +1 -0
  41. package/dist/tttx/p-ddfeb0ba.js +2 -0
  42. package/dist/tttx/tttx.css +1 -1
  43. package/dist/tttx/tttx.esm.js +1 -1
  44. package/dist/types/components/components/tttx-icon/tttx-icon.d.ts +5 -0
  45. package/dist/types/components/components/tttx-icon/tttx-icon.stories.d.ts +24 -0
  46. package/dist/types/components/patterns/qualifications-list/qualifications-list.d.ts +6 -0
  47. package/dist/types/components/patterns/qualifications-list/qualifications-list.stories.d.ts +5 -0
  48. package/dist/types/components.d.ts +30 -0
  49. package/package.json +1 -1
  50. package/dist/tttx/p-2681b874.js +0 -2
  51. package/dist/tttx/p-285977b3.entry.js +0 -1
  52. package/dist/tttx/p-997a8339.entry.js +0 -1
  53. package/dist/tttx/p-d038fe18.js +0 -1
@@ -0,0 +1,864 @@
1
+ 'use strict';
2
+
3
+ const ui_popover = require('./ui.popover-27780a1d.js');
4
+
5
+ /**
6
+ * DevExtreme (esm/ui/toolbar/ui.toolbar.menu.js)
7
+ * Version: 22.1.6
8
+ * Build date: Tue Oct 18 2022
9
+ *
10
+ * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
11
+ * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
12
+ */
13
+ var TOOLBAR_MENU_ACTION_CLASS = "dx-toolbar-menu-action";
14
+ var TOOLBAR_HIDDEN_BUTTON_CLASS = "dx-toolbar-hidden-button";
15
+ var TOOLBAR_HIDDEN_BUTTON_GROUP_CLASS = "dx-toolbar-hidden-button-group";
16
+ var TOOLBAR_MENU_SECTION_CLASS = "dx-toolbar-menu-section";
17
+ var TOOLBAR_MENU_LAST_SECTION_CLASS = "dx-toolbar-menu-last-section";
18
+ var ToolbarMenu = ui_popover.ListBase.inherit({
19
+ _activeStateUnit: "." + TOOLBAR_MENU_ACTION_CLASS,
20
+ _initMarkup: function() {
21
+ this._renderSections();
22
+ this.callBase();
23
+ },
24
+ _getSections: function() {
25
+ return this._itemContainer().children()
26
+ },
27
+ _itemElements: function() {
28
+ return this._getSections().children(this._itemSelector())
29
+ },
30
+ _renderSections: function() {
31
+ var that = this;
32
+ var $container = this._itemContainer();
33
+ ui_popover.each(["before", "center", "after", "menu"], (function() {
34
+ var sectionName = "_$" + this + "Section";
35
+ var $section = that[sectionName];
36
+ if (!$section) {
37
+ that[sectionName] = $section = ui_popover.$("<div>").addClass(TOOLBAR_MENU_SECTION_CLASS);
38
+ }
39
+ $section.appendTo($container);
40
+ }));
41
+ },
42
+ _renderItems: function() {
43
+ this.callBase.apply(this, arguments);
44
+ this._updateSections();
45
+ },
46
+ _updateSections: function() {
47
+ var $sections = this.$element().find("." + TOOLBAR_MENU_SECTION_CLASS);
48
+ $sections.removeClass(TOOLBAR_MENU_LAST_SECTION_CLASS);
49
+ $sections.not(":empty").eq(-1).addClass(TOOLBAR_MENU_LAST_SECTION_CLASS);
50
+ },
51
+ _renderItem: function(index, item, itemContainer, $after) {
52
+ var location = item.location || "menu";
53
+ var $container = this["_$" + location + "Section"];
54
+ var itemElement = this.callBase(index, item, $container, $after);
55
+ if (this._getItemTemplateName({
56
+ itemData: item
57
+ })) {
58
+ itemElement.addClass("dx-toolbar-menu-custom");
59
+ }
60
+ if ("menu" === location || "dxButton" === item.widget || "dxButtonGroup" === item.widget || item.isAction) {
61
+ itemElement.addClass(TOOLBAR_MENU_ACTION_CLASS);
62
+ }
63
+ if ("dxButton" === item.widget) {
64
+ itemElement.addClass(TOOLBAR_HIDDEN_BUTTON_CLASS);
65
+ }
66
+ if ("dxButtonGroup" === item.widget) {
67
+ itemElement.addClass(TOOLBAR_HIDDEN_BUTTON_GROUP_CLASS);
68
+ }
69
+ itemElement.addClass(item.cssClass);
70
+ return itemElement
71
+ },
72
+ _getItemTemplateName: function(args) {
73
+ var template = this.callBase(args);
74
+ var data = args.itemData;
75
+ var menuTemplate = data && data.menuItemTemplate;
76
+ return menuTemplate || template
77
+ },
78
+ _itemClickHandler: function(e, args, config) {
79
+ if (ui_popover.$(e.target).closest("." + TOOLBAR_MENU_ACTION_CLASS).length) {
80
+ this.callBase(e, args, config);
81
+ }
82
+ },
83
+ _clean: function() {
84
+ this._getSections().empty();
85
+ this.callBase();
86
+ }
87
+ });
88
+ ui_popover.registerComponent("dxToolbarMenu", ToolbarMenu);
89
+
90
+ /**
91
+ * DevExtreme (esm/ui/toolbar/ui.toolbar.utils.js)
92
+ * Version: 22.1.6
93
+ * Build date: Tue Oct 18 2022
94
+ *
95
+ * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
96
+ * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
97
+ */
98
+ var BUTTON_GROUP_CLASS = "dx-buttongroup";
99
+ var TOOLBAR_ITEMS = ["dxAutocomplete", "dxButton", "dxCheckBox", "dxDateBox", "dxMenu", "dxSelectBox", "dxTabs", "dxTextBox", "dxButtonGroup", "dxDropDownButton"];
100
+ var getItemInstance = function($element) {
101
+ var itemData = $element.data && $element.data();
102
+ var dxComponents = itemData && itemData.dxComponents;
103
+ var widgetName = dxComponents && dxComponents[0];
104
+ return widgetName && itemData[widgetName]
105
+ };
106
+ function toggleItemFocusableElementTabIndex(context, item) {
107
+ var _itemData$options;
108
+ if (!context) {
109
+ return
110
+ }
111
+ var $item = context._findItemElementByItem(item);
112
+ if (!$item.length) {
113
+ return
114
+ }
115
+ var itemData = context._getItemData($item);
116
+ var isItemNotFocusable = !!(null !== (_itemData$options = itemData.options) && void 0 !== _itemData$options && _itemData$options.disabled || itemData.disabled || context.option("disabled"));
117
+ var {
118
+ widget: widget
119
+ } = itemData;
120
+ if (widget && -1 !== TOOLBAR_ITEMS.indexOf(widget)) {
121
+ var $widget = $item.find(widget.toLowerCase().replace("dx", ".dx-"));
122
+ if ($widget.length) {
123
+ var _itemInstance$_focusT, _itemData$options2;
124
+ var itemInstance = getItemInstance($widget);
125
+ var $focusTarget = "dxDropDownButton" === widget ? itemInstance._focusTarget().find(".".concat(BUTTON_GROUP_CLASS)) : (null === itemInstance || void 0 === itemInstance ? void 0 : null === (_itemInstance$_focusT = itemInstance._focusTarget) || void 0 === _itemInstance$_focusT ? void 0 : _itemInstance$_focusT.call(itemInstance)) || ui_popover.$(itemInstance.element());
126
+ var tabIndex = null === (_itemData$options2 = itemData.options) || void 0 === _itemData$options2 ? void 0 : _itemData$options2.tabIndex;
127
+ if (isItemNotFocusable) {
128
+ $focusTarget.attr("tabIndex", -1);
129
+ } else {
130
+ $focusTarget.attr("tabIndex", tabIndex ? tabIndex : 0);
131
+ }
132
+ }
133
+ }
134
+ }
135
+
136
+ /**
137
+ * DevExtreme (esm/ui/drop_down_menu.js)
138
+ * Version: 22.1.6
139
+ * Build date: Tue Oct 18 2022
140
+ *
141
+ * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
142
+ * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
143
+ */
144
+ var window = ui_popover.getWindow();
145
+ var DROP_DOWN_MENU_CLASS = "dx-dropdownmenu";
146
+ var DROP_DOWN_MENU_POPUP_CLASS = "dx-dropdownmenu-popup";
147
+ var DROP_DOWN_MENU_POPUP_WRAPPER_CLASS = "dx-dropdownmenu-popup-wrapper";
148
+ var DROP_DOWN_MENU_LIST_CLASS = "dx-dropdownmenu-list";
149
+ var DROP_DOWN_MENU_BUTTON_CLASS = "dx-dropdownmenu-button";
150
+ var POPUP_OPTION_MAP = {
151
+ popupWidth: "width",
152
+ popupHeight: "height",
153
+ popupMaxHeight: "maxHeight",
154
+ popupAutoResizeEnabled: "autoResizeEnabled"
155
+ };
156
+ var BUTTON_OPTION_MAP = {
157
+ buttonIcon: "icon",
158
+ buttonText: "text",
159
+ buttonWidth: "width",
160
+ buttonHeight: "height",
161
+ buttonTemplate: "template"
162
+ };
163
+ var DropDownMenu = ui_popover.Widget.inherit({
164
+ _supportedKeys: function() {
165
+ var extension = {};
166
+ if (!this.option("opened") || !this._list.option("focusedElement")) {
167
+ extension = this._button._supportedKeys();
168
+ }
169
+ return ui_popover.extend(this.callBase(), extension, {
170
+ tab: function() {
171
+ this._popup && this._popup.hide();
172
+ }
173
+ })
174
+ },
175
+ _getDefaultOptions: function() {
176
+ return ui_popover.extend(this.callBase(), {
177
+ items: [],
178
+ onItemClick: null,
179
+ dataSource: null,
180
+ itemTemplate: "item",
181
+ buttonText: "",
182
+ buttonIcon: "overflow",
183
+ buttonWidth: void 0,
184
+ buttonHeight: void 0,
185
+ buttonTemplate: "content",
186
+ onButtonClick: null,
187
+ usePopover: false,
188
+ popupWidth: "auto",
189
+ popupHeight: "auto",
190
+ activeStateEnabled: true,
191
+ hoverStateEnabled: true,
192
+ opened: false,
193
+ selectionMode: "none",
194
+ selectedItemKeys: [],
195
+ deferRendering: false,
196
+ popupPosition: {
197
+ my: "top center",
198
+ at: "bottom center",
199
+ collision: "fit flip",
200
+ offset: {
201
+ v: 1
202
+ }
203
+ },
204
+ popupAnimation: void 0,
205
+ onItemRendered: null,
206
+ menuWidget: ui_popover.ListSearch,
207
+ popupMaxHeight: void 0,
208
+ closeOnClick: true,
209
+ useInkRipple: false,
210
+ container: void 0,
211
+ popupAutoResizeEnabled: false
212
+ })
213
+ },
214
+ _defaultOptionsRules: function() {
215
+ return this.callBase().concat([{
216
+ device: {
217
+ platform: "ios"
218
+ },
219
+ options: {
220
+ usePopover: true
221
+ }
222
+ }, {
223
+ device: {
224
+ platform: "generic"
225
+ },
226
+ options: {
227
+ popupPosition: {
228
+ offset: {
229
+ v: 4
230
+ }
231
+ }
232
+ }
233
+ }, {
234
+ device: function() {
235
+ return "desktop" === ui_popover.devices.real().deviceType && !ui_popover.devices.isSimulator()
236
+ },
237
+ options: {
238
+ focusStateEnabled: true
239
+ }
240
+ }, {
241
+ device: {
242
+ platform: "android"
243
+ },
244
+ options: {
245
+ popupPosition: {
246
+ my: "top " + (this.option("rtlEnabled") ? "left" : "right"),
247
+ at: "top " + (this.option("rtlEnabled") ? "left" : "right"),
248
+ collision: "flipfit"
249
+ },
250
+ popupAnimation: {
251
+ show: {
252
+ type: "pop",
253
+ duration: 200,
254
+ from: {
255
+ scale: 0
256
+ },
257
+ to: {
258
+ scale: 1
259
+ }
260
+ },
261
+ hide: {
262
+ type: "pop",
263
+ duration: 200,
264
+ from: {
265
+ scale: 1
266
+ },
267
+ to: {
268
+ scale: 0
269
+ }
270
+ }
271
+ }
272
+ }
273
+ }, {
274
+ device: function() {
275
+ return ui_popover.isMaterial()
276
+ },
277
+ options: {
278
+ useInkRipple: true
279
+ }
280
+ }])
281
+ },
282
+ _initOptions: function(options) {
283
+ if ("android" === ui_popover.devices.current().platform) {
284
+ if (!options.popupPosition) {
285
+ options.popupPosition = {
286
+ at: (options.usePopover ? "bottom " : "top ") + (options.rtlEnabled ? "left" : "right")
287
+ };
288
+ }
289
+ }
290
+ this.callBase(options);
291
+ },
292
+ _dataSourceOptions: function() {
293
+ return {
294
+ paginate: false
295
+ }
296
+ },
297
+ _init: function() {
298
+ this.callBase();
299
+ this.$element().addClass(DROP_DOWN_MENU_CLASS);
300
+ this._initDataSource();
301
+ this._initItemClickAction();
302
+ this._initButtonClickAction();
303
+ },
304
+ _initItemClickAction: function() {
305
+ this._itemClickAction = this._createActionByOption("onItemClick");
306
+ },
307
+ _initButtonClickAction: function() {
308
+ this._buttonClickAction = this._createActionByOption("onButtonClick");
309
+ },
310
+ _initTemplates: function() {
311
+ this._templateManager.addDefaultTemplates({
312
+ content: new ui_popover.ChildDefaultTemplate("content")
313
+ });
314
+ this.callBase();
315
+ },
316
+ _initMarkup: function() {
317
+ this._renderButton();
318
+ this.callBase();
319
+ },
320
+ _render: function() {
321
+ this.callBase();
322
+ this.setAria({
323
+ role: "menubar",
324
+ haspopup: true,
325
+ expanded: this.option("opened")
326
+ });
327
+ },
328
+ _renderContentImpl: function() {
329
+ if (this.option("opened")) {
330
+ this._renderPopup();
331
+ }
332
+ },
333
+ _clean: function() {
334
+ this._cleanFocusState();
335
+ if (this._popup) {
336
+ this._popup.$element().remove();
337
+ delete this._$popup;
338
+ }
339
+ },
340
+ _renderButton: function() {
341
+ var $button = this.$element().addClass(DROP_DOWN_MENU_BUTTON_CLASS);
342
+ var config = this._buttonOptions();
343
+ this._button = this._createComponent($button, ui_popover.Button, config);
344
+ },
345
+ _toggleActiveState: function($element, value, e) {
346
+ this._button._toggleActiveState($element, value, e);
347
+ },
348
+ _buttonOptions: function() {
349
+ return {
350
+ text: this.option("buttonText"),
351
+ icon: this.option("buttonIcon"),
352
+ width: this.option("buttonWidth"),
353
+ height: this.option("buttonHeight"),
354
+ useInkRipple: this.option("useInkRipple"),
355
+ template: this.option("buttonTemplate"),
356
+ hoverStateEnabled: false,
357
+ focusStateEnabled: false,
358
+ onClick: function(e) {
359
+ this.option("opened", !this.option("opened"));
360
+ this._buttonClickAction(e);
361
+ }.bind(this)
362
+ }
363
+ },
364
+ _toggleMenuVisibility: function(opened) {
365
+ var state = void 0 === opened ? !this._popup.option("visible") : opened;
366
+ if (opened) {
367
+ this._renderPopup();
368
+ }
369
+ this._popup.toggle(state);
370
+ this.setAria("expanded", state);
371
+ },
372
+ _renderPopup: function() {
373
+ if (this._$popup) {
374
+ return
375
+ }
376
+ var $popup = this._$popup = ui_popover.$("<div>").appendTo(this.$element());
377
+ var config = this._popupOptions();
378
+ this._popup = this._createComponent($popup, ui_popover.Popover, config);
379
+ },
380
+ _popupOptions: function() {
381
+ var usePopup = !this.option("usePopover");
382
+ return {
383
+ onInitialized: function(args) {
384
+ args.component.$wrapper().addClass(DROP_DOWN_MENU_POPUP_WRAPPER_CLASS).toggleClass(DROP_DOWN_MENU_POPUP_CLASS, usePopup);
385
+ },
386
+ deferRendering: false,
387
+ contentTemplate: function(contentElement) {
388
+ this._renderList(contentElement);
389
+ }.bind(this),
390
+ position: this.option("popupPosition"),
391
+ animation: this.option("popupAnimation"),
392
+ onOptionChanged: function(args) {
393
+ if ("visible" === args.name) {
394
+ this.option("opened", args.value);
395
+ }
396
+ }.bind(this),
397
+ target: this.$element(),
398
+ height: this.option("popupHeight"),
399
+ width: this.option("popupWidth"),
400
+ maxHeight: this.option("popupMaxHeight"),
401
+ container: this.option("container"),
402
+ autoResizeEnabled: this.option("popupAutoResizeEnabled")
403
+ }
404
+ },
405
+ _renderList: function(contentElement) {
406
+ var $content = ui_popover.$(contentElement);
407
+ var listConfig = this._listOptions();
408
+ $content.addClass(DROP_DOWN_MENU_LIST_CLASS);
409
+ this._list = this._createComponent($content, this.option("menuWidget"), listConfig);
410
+ this._list._getAriaTarget = function() {
411
+ return this.$element()
412
+ }.bind(this);
413
+ this._setListDataSource();
414
+ var listMaxHeight = .5 * ui_popover.getHeight(window);
415
+ if (ui_popover.getHeight($content) > listMaxHeight) {
416
+ ui_popover.setHeight($content, listMaxHeight);
417
+ }
418
+ },
419
+ _itemOptionChanged: function(item, property, value) {
420
+ var _this$_list;
421
+ null === (_this$_list = this._list) || void 0 === _this$_list ? void 0 : _this$_list._itemOptionChanged(item, property, value);
422
+ toggleItemFocusableElementTabIndex(this._list, item);
423
+ },
424
+ _listOptions: function() {
425
+ return {
426
+ pageLoadMode: "scrollBottom",
427
+ indicateLoading: false,
428
+ noDataText: "",
429
+ selectionMode: this.option("selectionMode"),
430
+ selectedItemKeys: this.option("selectedItemKeys"),
431
+ itemTemplate: this.option("itemTemplate"),
432
+ onItemClick: function(e) {
433
+ if (this.option("closeOnClick")) {
434
+ this.option("opened", false);
435
+ }
436
+ this._itemClickAction(e);
437
+ }.bind(this),
438
+ tabIndex: -1,
439
+ focusStateEnabled: this.option("focusStateEnabled"),
440
+ activeStateEnabled: this.option("activeStateEnabled"),
441
+ onItemRendered: this.option("onItemRendered"),
442
+ _itemAttributes: {
443
+ role: "menuitem"
444
+ }
445
+ }
446
+ },
447
+ _setListDataSource: function() {
448
+ if (this._list) {
449
+ this._list.option("dataSource", this._dataSource || this.option("items"));
450
+ }
451
+ delete this._deferRendering;
452
+ },
453
+ _getKeyboardListeners() {
454
+ return this.callBase().concat([this._list])
455
+ },
456
+ _toggleVisibility: function(visible) {
457
+ this.callBase(visible);
458
+ this._button.option("visible", visible);
459
+ },
460
+ _optionChanged: function(args) {
461
+ var name = args.name;
462
+ var value = args.value;
463
+ switch (name) {
464
+ case "items":
465
+ case "dataSource":
466
+ if (this.option("deferRendering") && !this.option("opened")) {
467
+ this._deferRendering = true;
468
+ } else {
469
+ this._refreshDataSource();
470
+ this._setListDataSource();
471
+ }
472
+ break;
473
+ case "itemTemplate":
474
+ if (this._list) {
475
+ this._list.option(name, this._getTemplate(value));
476
+ }
477
+ break;
478
+ case "onItemClick":
479
+ this._initItemClickAction();
480
+ break;
481
+ case "onButtonClick":
482
+ this._buttonClickAction();
483
+ break;
484
+ case "buttonIcon":
485
+ case "buttonText":
486
+ case "buttonWidth":
487
+ case "buttonHeight":
488
+ case "buttonTemplate":
489
+ this._button.option(BUTTON_OPTION_MAP[name], value);
490
+ this._renderPopup();
491
+ break;
492
+ case "popupWidth":
493
+ case "popupHeight":
494
+ case "popupMaxHeight":
495
+ case "popupAutoResizeEnabled":
496
+ this._popup.option(POPUP_OPTION_MAP[name], value);
497
+ break;
498
+ case "usePopover":
499
+ case "menuWidget":
500
+ case "useInkRipple":
501
+ this._invalidate();
502
+ break;
503
+ case "focusStateEnabled":
504
+ case "activeStateEnabled":
505
+ if (this._list) {
506
+ this._list.option(name, value);
507
+ }
508
+ this.callBase(args);
509
+ break;
510
+ case "selectionMode":
511
+ case "selectedItemKeys":
512
+ case "onItemRendered":
513
+ if (this._list) {
514
+ this._list.option(name, value);
515
+ }
516
+ break;
517
+ case "opened":
518
+ if (this._deferRendering) {
519
+ this._refreshDataSource();
520
+ this._setListDataSource();
521
+ }
522
+ this._toggleMenuVisibility(value);
523
+ this._updateFocusableItemsTabIndex();
524
+ break;
525
+ case "deferRendering":
526
+ case "popupPosition":
527
+ case "closeOnClick":
528
+ break;
529
+ case "container":
530
+ this._popup && this._popup.option(args.name, args.value);
531
+ break;
532
+ case "disabled":
533
+ if (this._list) {
534
+ this._updateFocusableItemsTabIndex();
535
+ }
536
+ break;
537
+ default:
538
+ this.callBase(args);
539
+ }
540
+ },
541
+ _updateFocusableItemsTabIndex() {
542
+ this.option("items").forEach(item => toggleItemFocusableElementTabIndex(this._list, item));
543
+ },
544
+ open: function() {
545
+ this.option("opened", true);
546
+ },
547
+ close: function() {
548
+ this.option("opened", false);
549
+ }
550
+ }).include(ui_popover.DataHelperMixin);
551
+ ui_popover.registerComponent("dxDropDownMenu", DropDownMenu);
552
+
553
+ /**
554
+ * DevExtreme (esm/ui/toolbar/ui.toolbar.drop_down_menu.js)
555
+ * Version: 22.1.6
556
+ * Build date: Tue Oct 18 2022
557
+ *
558
+ * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
559
+ * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
560
+ */
561
+ var MENU_INVISIBLE_CLASS = "dx-state-invisible";
562
+ var TOOLBAR_DROP_DOWN_MENU_CONTAINER_CLASS = "dx-toolbar-menu-container";
563
+ var POPOVER_BOUNDARY_OFFSET = 10;
564
+ class ToolbarDropDownMenu {
565
+ constructor(toolbar) {
566
+ this._toolbar = toolbar;
567
+ }
568
+ render() {
569
+ if (!this._hasVisibleMenuItems()) {
570
+ return
571
+ }
572
+ this._renderMenuButtonContainer();
573
+ var $menu = ui_popover.$("<div>").appendTo(this._dropDownMenuContainer());
574
+ this._dropDownMenu = this._toolbar._createComponent($menu, DropDownMenu, this._dropDownMenuOptions());
575
+ this.renderMenuItems();
576
+ }
577
+ renderMenuItems() {
578
+ if (!this._dropDownMenu) {
579
+ this.render();
580
+ }
581
+ this._dropDownMenu && this._dropDownMenu.option("items", this._getMenuItems());
582
+ if (this._dropDownMenu && !this._dropDownMenu.option("items").length) {
583
+ this._dropDownMenu.close();
584
+ }
585
+ }
586
+ _renderMenuButtonContainer() {
587
+ var $afterSection = this._toolbar._$afterSection;
588
+ this._$menuButtonContainer = ui_popover.$("<div>").appendTo($afterSection).addClass(this._toolbar._buttonClass()).addClass(TOOLBAR_DROP_DOWN_MENU_CONTAINER_CLASS);
589
+ }
590
+ _getMenuItemTemplate() {
591
+ return this._toolbar._getTemplateByOption("menuItemTemplate")
592
+ }
593
+ _dropDownMenuOptions() {
594
+ var itemClickAction = this._toolbar._createActionByOption("onItemClick");
595
+ var topAndBottomOffset = 2 * POPOVER_BOUNDARY_OFFSET;
596
+ return {
597
+ disabled: this._toolbar.option("disabled"),
598
+ itemTemplate: this._getMenuItemTemplate.bind(this),
599
+ onItemClick: function(e) {
600
+ itemClickAction(e);
601
+ }.bind(this),
602
+ deferRendering: true,
603
+ container: this._toolbar.option("menuContainer"),
604
+ popupMaxHeight: "android" === ui_popover.devices.current().platform ? ui_popover.domAdapter.getDocumentElement().clientHeight - topAndBottomOffset : void 0,
605
+ menuWidget: ToolbarMenu,
606
+ onOptionChanged: _ref => {
607
+ var {
608
+ name: name,
609
+ value: value
610
+ } = _ref;
611
+ if ("opened" === name) {
612
+ this._toolbar.option("overflowMenuVisible", value);
613
+ }
614
+ if ("items" === name) {
615
+ this._updateMenuVisibility(value);
616
+ }
617
+ },
618
+ popupPosition: {
619
+ at: "bottom right",
620
+ my: "top right"
621
+ }
622
+ }
623
+ }
624
+ _updateMenuVisibility(menuItems) {
625
+ var items = menuItems || this._getMenuItems();
626
+ var isMenuVisible = items.length && this._hasVisibleMenuItems(items);
627
+ this._toggleMenuVisibility(isMenuVisible);
628
+ }
629
+ _getMenuItems() {
630
+ return this._toolbar._getMenuItems()
631
+ }
632
+ _hasVisibleMenuItems(items) {
633
+ var menuItems = items || this._toolbar.option("items");
634
+ var result = false;
635
+ var optionGetter = ui_popover.compileGetter("visible");
636
+ var overflowGetter = ui_popover.compileGetter("locateInMenu");
637
+ ui_popover.each(menuItems, (function(index, item) {
638
+ var itemVisible = optionGetter(item, {
639
+ functionsAsIs: true
640
+ });
641
+ var itemOverflow = overflowGetter(item, {
642
+ functionsAsIs: true
643
+ });
644
+ if (false !== itemVisible && ("auto" === itemOverflow || "always" === itemOverflow) || "menu" === item.location) {
645
+ result = true;
646
+ }
647
+ }));
648
+ return result
649
+ }
650
+ _toggleMenuVisibility(value) {
651
+ if (!this._dropDownMenuContainer()) {
652
+ return
653
+ }
654
+ this._dropDownMenuContainer().toggleClass(MENU_INVISIBLE_CLASS, !value);
655
+ }
656
+ _dropDownMenuContainer() {
657
+ return this._$menuButtonContainer
658
+ }
659
+ widgetOption(name, value) {
660
+ this._dropDownMenu && this._dropDownMenu.option(name, value);
661
+ }
662
+ itemOption(item, property, value) {
663
+ if ("disabled" === property || "options.disabled" === property) {
664
+ var _this$_dropDownMenu;
665
+ null === (_this$_dropDownMenu = this._dropDownMenu) || void 0 === _this$_dropDownMenu ? void 0 : _this$_dropDownMenu._itemOptionChanged(item, property, value);
666
+ } else {
667
+ this.renderMenuItems();
668
+ }
669
+ }
670
+ }
671
+
672
+ /**
673
+ * DevExtreme (esm/ui/toolbar.js)
674
+ * Version: 22.1.6
675
+ * Build date: Tue Oct 18 2022
676
+ *
677
+ * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
678
+ * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
679
+ */
680
+ var TOOLBAR_AUTO_HIDE_ITEM_CLASS = "dx-toolbar-item-auto-hide";
681
+ var TOOLBAR_AUTO_HIDE_TEXT_CLASS = "dx-toolbar-text-auto-hide";
682
+ var TOOLBAR_HIDDEN_ITEM = "dx-toolbar-item-invisible";
683
+ var Toolbar = ui_popover.ToolbarBase.inherit({
684
+ _getDefaultOptions: function() {
685
+ return ui_popover.extend(this.callBase(), {
686
+ menuItemTemplate: "menuItem",
687
+ menuContainer: void 0,
688
+ overflowMenuVisible: false
689
+ })
690
+ },
691
+ updateDimensions: function() {
692
+ this._dimensionChanged();
693
+ },
694
+ _dimensionChanged: function(dimension) {
695
+ if ("height" === dimension) {
696
+ return
697
+ }
698
+ this.callBase();
699
+ this._menu.renderMenuItems();
700
+ },
701
+ _initTemplates: function() {
702
+ this.callBase();
703
+ this._templateManager.addDefaultTemplates({
704
+ actionSheetItem: new ui_popover.ChildDefaultTemplate("item")
705
+ });
706
+ },
707
+ _initMarkup: function() {
708
+ this.callBase();
709
+ this._updateFocusableItemsTabIndex();
710
+ this._renderMenu();
711
+ },
712
+ _postProcessRenderItems: function() {
713
+ this._hideOverflowItems();
714
+ this._menu._updateMenuVisibility();
715
+ this.callBase();
716
+ ui_popover.deferRender(() => {
717
+ this._menu.renderMenuItems();
718
+ });
719
+ },
720
+ _renderItem: function(index, item, itemContainer, $after) {
721
+ var itemElement = this.callBase(index, item, itemContainer, $after);
722
+ if ("auto" === item.locateInMenu) {
723
+ itemElement.addClass(TOOLBAR_AUTO_HIDE_ITEM_CLASS);
724
+ }
725
+ if ("dxButton" === item.widget && "inMenu" === item.showText) {
726
+ itemElement.toggleClass(TOOLBAR_AUTO_HIDE_TEXT_CLASS);
727
+ }
728
+ return itemElement
729
+ },
730
+ _getItemsWidth: function() {
731
+ return this._getSummaryItemsWidth([this._$beforeSection, this._$centerSection, this._$afterSection])
732
+ },
733
+ _hideOverflowItems: function(elementWidth) {
734
+ var overflowItems = this.$element().find("." + TOOLBAR_AUTO_HIDE_ITEM_CLASS);
735
+ if (!overflowItems.length) {
736
+ return
737
+ }
738
+ elementWidth = elementWidth || ui_popover.getWidth(this.$element());
739
+ ui_popover.$(overflowItems).removeClass(TOOLBAR_HIDDEN_ITEM);
740
+ var itemsWidth = this._getItemsWidth();
741
+ while (overflowItems.length && elementWidth < itemsWidth) {
742
+ var $item = overflowItems.eq(-1);
743
+ itemsWidth -= ui_popover.getOuterWidth($item);
744
+ $item.addClass(TOOLBAR_HIDDEN_ITEM);
745
+ overflowItems.splice(-1, 1);
746
+ }
747
+ },
748
+ _getMenuItems: function() {
749
+ var that = this;
750
+ var menuItems = ui_popover.grep(this.option("items") || [], (function(item) {
751
+ return that._isMenuItem(item)
752
+ }));
753
+ var $hiddenItems = this._itemContainer().children("." + TOOLBAR_AUTO_HIDE_ITEM_CLASS + "." + TOOLBAR_HIDDEN_ITEM).not(".dx-state-invisible");
754
+ this._restoreItems = this._restoreItems || [];
755
+ var overflowItems = [].slice.call($hiddenItems).map(item => {
756
+ var itemData = that._getItemData(item);
757
+ var $itemContainer = ui_popover.$(item);
758
+ var $itemMarkup = $itemContainer.children();
759
+ return ui_popover.extend({
760
+ menuItemTemplate: function() {
761
+ that._restoreItems.push({
762
+ container: $itemContainer,
763
+ item: $itemMarkup
764
+ });
765
+ var $container = ui_popover.$("<div>").addClass(TOOLBAR_AUTO_HIDE_ITEM_CLASS);
766
+ return $container.append($itemMarkup)
767
+ }
768
+ }, itemData)
769
+ });
770
+ return [...overflowItems, ...menuItems]
771
+ },
772
+ _getToolbarItems: function() {
773
+ var that = this;
774
+ return ui_popover.grep(this.option("items") || [], (function(item) {
775
+ return !that._isMenuItem(item)
776
+ }))
777
+ },
778
+ _renderMenu: function() {
779
+ this._renderMenuStrategy();
780
+ ui_popover.deferRender(() => {
781
+ this._menu.render();
782
+ });
783
+ },
784
+ _renderMenuStrategy: function() {
785
+ if (!this._menu) {
786
+ this._menu = new ToolbarDropDownMenu(this);
787
+ }
788
+ },
789
+ _arrangeItems: function() {
790
+ if (this.$element().is(":hidden")) {
791
+ return
792
+ }
793
+ this._$centerSection.css({
794
+ margin: "0 auto",
795
+ float: "none"
796
+ });
797
+ ui_popover.each(this._restoreItems || [], (function(_, obj) {
798
+ ui_popover.$(obj.container).append(obj.item);
799
+ }));
800
+ this._restoreItems = [];
801
+ var elementWidth = ui_popover.getWidth(this.$element());
802
+ this._hideOverflowItems(elementWidth);
803
+ this.callBase(elementWidth);
804
+ },
805
+ _itemOptionChanged: function(item, property, value) {
806
+ if (this._isMenuItem(item)) {
807
+ this._menu.itemOption(item, property, value);
808
+ } else if (this._isToolbarItem(item)) {
809
+ this.callBase(item, property, value);
810
+ } else {
811
+ this.callBase(item, property, value);
812
+ this._menu.renderMenuItems();
813
+ }
814
+ if ("disabled" === property || "options.disabled" === property) {
815
+ toggleItemFocusableElementTabIndex(this, item);
816
+ }
817
+ if ("location" === property) {
818
+ this.repaint();
819
+ }
820
+ },
821
+ _updateFocusableItemsTabIndex() {
822
+ this._getToolbarItems().forEach(item => toggleItemFocusableElementTabIndex(this, item));
823
+ },
824
+ _isMenuItem: function(itemData) {
825
+ return "menu" === itemData.location || "always" === itemData.locateInMenu
826
+ },
827
+ _isToolbarItem: function(itemData) {
828
+ return void 0 === itemData.location || "never" === itemData.locateInMenu
829
+ },
830
+ _optionChanged: function(args) {
831
+ var {
832
+ name: name,
833
+ value: value
834
+ } = args;
835
+ switch (name) {
836
+ case "menuItemTemplate":
837
+ this._changeMenuOption("itemTemplate", this._getTemplate(value));
838
+ break;
839
+ case "onItemClick":
840
+ this._changeMenuOption(name, value);
841
+ this.callBase.apply(this, arguments);
842
+ break;
843
+ case "menuContainer":
844
+ this._changeMenuOption("container", value);
845
+ break;
846
+ case "overflowMenuVisible":
847
+ this._changeMenuOption("opened", value);
848
+ break;
849
+ case "disabled":
850
+ this._changeMenuOption("disabled", value);
851
+ this.callBase.apply(this, arguments);
852
+ this._updateFocusableItemsTabIndex();
853
+ break;
854
+ default:
855
+ this.callBase.apply(this, arguments);
856
+ }
857
+ },
858
+ _changeMenuOption: function(name, value) {
859
+ this._menu.widgetOption(name, value);
860
+ }
861
+ });
862
+ ui_popover.registerComponent("dxToolbar", Toolbar);
863
+
864
+ exports.Toolbar = Toolbar;