@3t-transform/threeteeui 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index-eb8fc323.js +1620 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/toolbar-656be6e6.js +34259 -0
- package/dist/cjs/tttx-page.cjs.entry.js +927 -0
- package/dist/cjs/tttx-worksheet.cjs.entry.js +47 -0
- package/dist/cjs/tttx.cjs.js +19 -0
- package/dist/collection/collection-manifest.json +13 -0
- package/dist/collection/components/patterns/tttx-page/tttx-page.css +162 -0
- package/dist/collection/components/patterns/tttx-page/tttx-page.js +213 -0
- package/dist/collection/components/patterns/tttx-page/tttx-page.stories.js +80 -0
- package/dist/collection/components/patterns/tttx-worksheet/tttx-worksheet.css +134 -0
- package/dist/collection/components/patterns/tttx-worksheet/tttx-worksheet.js +70 -0
- package/dist/collection/components/patterns/tttx-worksheet/tttx-worksheet.stories.js +44 -0
- package/dist/collection/docs/gettingstarted-developer.stories.js +9 -0
- package/dist/collection/docs/template.stories.js +10 -0
- package/dist/collection/index.js +1 -0
- package/dist/components/index.d.ts +23 -0
- package/dist/components/index.js +3 -0
- package/dist/components/tttx-page.d.ts +11 -0
- package/dist/components/tttx-page.js +953 -0
- package/dist/components/tttx-worksheet.d.ts +11 -0
- package/dist/components/tttx-worksheet.js +6 -0
- package/dist/components/tttx-worksheet2.js +34288 -0
- package/dist/esm/index-4c11a593.js +1594 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/toolbar-cede4385.js +34231 -0
- package/dist/esm/tttx-page.entry.js +923 -0
- package/dist/esm/tttx-worksheet.entry.js +43 -0
- package/dist/esm/tttx.js +17 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/tttx/index.esm.js +0 -0
- package/dist/tttx/p-2681b874.js +2 -0
- package/dist/tttx/p-d038fe18.js +1 -0
- package/dist/tttx/p-d5c31f03.entry.js +1 -0
- package/dist/tttx/p-e40966f3.entry.js +1 -0
- package/dist/tttx/tttx.css +1 -0
- package/dist/tttx/tttx.esm.js +1 -0
- package/dist/types/components/patterns/tttx-page/tttx-page.d.ts +21 -0
- package/dist/types/components/patterns/tttx-page/tttx-page.stories.d.ts +48 -0
- package/dist/types/components/patterns/tttx-worksheet/tttx-worksheet.d.ts +9 -0
- package/dist/types/components/patterns/tttx-worksheet/tttx-worksheet.stories.d.ts +23 -0
- package/dist/types/components.d.ts +66 -0
- package/dist/types/docs/gettingstarted-developer.stories.d.ts +5 -0
- package/dist/types/docs/template.stories.d.ts +5 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1581 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +11 -0
- package/package.json +60 -0
- package/readme.md +90 -0
|
@@ -0,0 +1,927 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-eb8fc323.js');
|
|
6
|
+
const toolbar = require('./toolbar-656be6e6.js');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* DevExtreme (esm/ui/button_group.js)
|
|
10
|
+
* Version: 22.1.6
|
|
11
|
+
* Build date: Tue Oct 18 2022
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
|
|
14
|
+
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
|
|
15
|
+
*/
|
|
16
|
+
var BUTTON_GROUP_CLASS = "dx-buttongroup";
|
|
17
|
+
var BUTTON_GROUP_WRAPPER_CLASS = BUTTON_GROUP_CLASS + "-wrapper";
|
|
18
|
+
var BUTTON_GROUP_ITEM_CLASS = BUTTON_GROUP_CLASS + "-item";
|
|
19
|
+
var BUTTON_GROUP_FIRST_ITEM_CLASS = BUTTON_GROUP_CLASS + "-first-item";
|
|
20
|
+
var BUTTON_GROUP_LAST_ITEM_CLASS = BUTTON_GROUP_CLASS + "-last-item";
|
|
21
|
+
var BUTTON_GROUP_ITEM_HAS_WIDTH = BUTTON_GROUP_ITEM_CLASS + "-has-width";
|
|
22
|
+
var SHAPE_STANDARD_CLASS = "dx-shape-standard";
|
|
23
|
+
var ButtonCollection = toolbar.CollectionWidget.inherit({
|
|
24
|
+
_initTemplates() {
|
|
25
|
+
this.callBase();
|
|
26
|
+
this._templateManager.addDefaultTemplates({
|
|
27
|
+
item: new toolbar.BindableTemplate(($container, data, model) => {
|
|
28
|
+
this._prepareItemStyles($container);
|
|
29
|
+
var template = this.option("buttonTemplate");
|
|
30
|
+
this._createComponent($container, toolbar.Button, toolbar.extend({}, model, data, this._getBasicButtonOptions(), {
|
|
31
|
+
_templateData: this._hasCustomTemplate(template) ? model : {},
|
|
32
|
+
template: model.template || template
|
|
33
|
+
}));
|
|
34
|
+
}, ["text", "type", "icon", "disabled", "visible", "hint"], this.option("integrationOptions.watchMethod"))
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
_getBasicButtonOptions() {
|
|
38
|
+
return {
|
|
39
|
+
focusStateEnabled: false,
|
|
40
|
+
onClick: null,
|
|
41
|
+
hoverStateEnabled: this.option("hoverStateEnabled"),
|
|
42
|
+
activeStateEnabled: this.option("activeStateEnabled"),
|
|
43
|
+
stylingMode: this.option("stylingMode")
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
_getDefaultOptions: function() {
|
|
47
|
+
return toolbar.extend(this.callBase(), {
|
|
48
|
+
itemTemplateProperty: null
|
|
49
|
+
})
|
|
50
|
+
},
|
|
51
|
+
_hasCustomTemplate(template) {
|
|
52
|
+
return toolbar.isFunction(template) || this.option("integrationOptions.templates")[template]
|
|
53
|
+
},
|
|
54
|
+
_prepareItemStyles($item) {
|
|
55
|
+
var itemIndex = $item.data("dxItemIndex");
|
|
56
|
+
0 === itemIndex && $item.addClass(BUTTON_GROUP_FIRST_ITEM_CLASS);
|
|
57
|
+
var items = this.option("items");
|
|
58
|
+
items && itemIndex === items.length - 1 && $item.addClass(BUTTON_GROUP_LAST_ITEM_CLASS);
|
|
59
|
+
$item.addClass(SHAPE_STANDARD_CLASS);
|
|
60
|
+
},
|
|
61
|
+
_renderItemContent(args) {
|
|
62
|
+
args.container = toolbar.$(args.container).parent();
|
|
63
|
+
return this.callBase(args)
|
|
64
|
+
},
|
|
65
|
+
_renderItemContentByNode: function(args, $node) {
|
|
66
|
+
args.container = toolbar.$(args.container.children().first());
|
|
67
|
+
return this.callBase(args, $node)
|
|
68
|
+
},
|
|
69
|
+
_focusTarget() {
|
|
70
|
+
return this.$element().parent()
|
|
71
|
+
},
|
|
72
|
+
_keyboardEventBindingTarget() {
|
|
73
|
+
return this._focusTarget()
|
|
74
|
+
},
|
|
75
|
+
_refreshContent() {
|
|
76
|
+
this._prepareContent();
|
|
77
|
+
this._renderContent();
|
|
78
|
+
},
|
|
79
|
+
_itemClass: () => BUTTON_GROUP_ITEM_CLASS,
|
|
80
|
+
_itemSelectHandler: function(e) {
|
|
81
|
+
if ("single" === this.option("selectionMode") && this.isItemSelected(e.currentTarget)) {
|
|
82
|
+
return
|
|
83
|
+
}
|
|
84
|
+
this.callBase(e);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
var ButtonGroup = toolbar.Widget.inherit({
|
|
88
|
+
_getDefaultOptions() {
|
|
89
|
+
return toolbar.extend(this.callBase(), {
|
|
90
|
+
hoverStateEnabled: true,
|
|
91
|
+
focusStateEnabled: true,
|
|
92
|
+
selectionMode: "single",
|
|
93
|
+
selectedItems: [],
|
|
94
|
+
selectedItemKeys: [],
|
|
95
|
+
stylingMode: "contained",
|
|
96
|
+
keyExpr: "text",
|
|
97
|
+
items: [],
|
|
98
|
+
buttonTemplate: "content",
|
|
99
|
+
onSelectionChanged: null,
|
|
100
|
+
onItemClick: null
|
|
101
|
+
})
|
|
102
|
+
},
|
|
103
|
+
_init() {
|
|
104
|
+
this.callBase();
|
|
105
|
+
this._createItemClickAction();
|
|
106
|
+
},
|
|
107
|
+
_createItemClickAction() {
|
|
108
|
+
this._itemClickAction = this._createActionByOption("onItemClick");
|
|
109
|
+
},
|
|
110
|
+
_initMarkup() {
|
|
111
|
+
this.setAria("role", "group");
|
|
112
|
+
this.$element().addClass(BUTTON_GROUP_CLASS);
|
|
113
|
+
this._renderButtons();
|
|
114
|
+
this._syncSelectionOptions();
|
|
115
|
+
this.callBase();
|
|
116
|
+
},
|
|
117
|
+
_fireSelectionChangeEvent: function(addedItems, removedItems) {
|
|
118
|
+
this._createActionByOption("onSelectionChanged", {
|
|
119
|
+
excludeValidators: ["disabled", "readOnly"]
|
|
120
|
+
})({
|
|
121
|
+
addedItems: addedItems,
|
|
122
|
+
removedItems: removedItems
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
_renderButtons() {
|
|
126
|
+
var $buttons = toolbar.$("<div>").addClass(BUTTON_GROUP_WRAPPER_CLASS).appendTo(this.$element());
|
|
127
|
+
var selectedItems = this.option("selectedItems");
|
|
128
|
+
var options = {
|
|
129
|
+
selectionMode: this.option("selectionMode"),
|
|
130
|
+
items: this.option("items"),
|
|
131
|
+
keyExpr: this.option("keyExpr"),
|
|
132
|
+
buttonTemplate: this.option("buttonTemplate"),
|
|
133
|
+
scrollingEnabled: false,
|
|
134
|
+
selectedItemKeys: this.option("selectedItemKeys"),
|
|
135
|
+
focusStateEnabled: this.option("focusStateEnabled"),
|
|
136
|
+
hoverStateEnabled: this.option("hoverStateEnabled"),
|
|
137
|
+
activeStateEnabled: this.option("activeStateEnabled"),
|
|
138
|
+
stylingMode: this.option("stylingMode"),
|
|
139
|
+
accessKey: this.option("accessKey"),
|
|
140
|
+
tabIndex: this.option("tabIndex"),
|
|
141
|
+
noDataText: "",
|
|
142
|
+
selectionRequired: false,
|
|
143
|
+
onItemRendered: e => {
|
|
144
|
+
var width = this.option("width");
|
|
145
|
+
toolbar.isDefined(width) && toolbar.$(e.itemElement).addClass(BUTTON_GROUP_ITEM_HAS_WIDTH);
|
|
146
|
+
},
|
|
147
|
+
onSelectionChanged: e => {
|
|
148
|
+
this._syncSelectionOptions();
|
|
149
|
+
this._fireSelectionChangeEvent(e.addedItems, e.removedItems);
|
|
150
|
+
},
|
|
151
|
+
onItemClick: e => {
|
|
152
|
+
this._itemClickAction(e);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
if (toolbar.isDefined(selectedItems) && selectedItems.length) {
|
|
156
|
+
options.selectedItems = selectedItems;
|
|
157
|
+
}
|
|
158
|
+
this._buttonsCollection = this._createComponent($buttons, ButtonCollection, options);
|
|
159
|
+
},
|
|
160
|
+
_syncSelectionOptions() {
|
|
161
|
+
this._setOptionWithoutOptionChange("selectedItems", this._buttonsCollection.option("selectedItems"));
|
|
162
|
+
this._setOptionWithoutOptionChange("selectedItemKeys", this._buttonsCollection.option("selectedItemKeys"));
|
|
163
|
+
},
|
|
164
|
+
_optionChanged(args) {
|
|
165
|
+
switch (args.name) {
|
|
166
|
+
case "stylingMode":
|
|
167
|
+
case "selectionMode":
|
|
168
|
+
case "keyExpr":
|
|
169
|
+
case "buttonTemplate":
|
|
170
|
+
case "items":
|
|
171
|
+
case "activeStateEnabled":
|
|
172
|
+
case "focusStateEnabled":
|
|
173
|
+
case "hoverStateEnabled":
|
|
174
|
+
case "tabIndex":
|
|
175
|
+
this._invalidate();
|
|
176
|
+
break;
|
|
177
|
+
case "selectedItemKeys":
|
|
178
|
+
case "selectedItems":
|
|
179
|
+
this._buttonsCollection.option(args.name, args.value);
|
|
180
|
+
break;
|
|
181
|
+
case "onItemClick":
|
|
182
|
+
this._createItemClickAction();
|
|
183
|
+
break;
|
|
184
|
+
case "onSelectionChanged":
|
|
185
|
+
break;
|
|
186
|
+
case "width":
|
|
187
|
+
this.callBase(args);
|
|
188
|
+
this._buttonsCollection.itemElements().toggleClass(BUTTON_GROUP_ITEM_HAS_WIDTH, !!args.value);
|
|
189
|
+
break;
|
|
190
|
+
default:
|
|
191
|
+
this.callBase(args);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
toolbar.registerComponent("dxButtonGroup", ButtonGroup);
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* DevExtreme (esm/ui/drop_down_editor/utils.js)
|
|
199
|
+
* Version: 22.1.6
|
|
200
|
+
* Build date: Tue Oct 18 2022
|
|
201
|
+
*
|
|
202
|
+
* Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
|
|
203
|
+
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
|
|
204
|
+
*/
|
|
205
|
+
var getElementWidth = function($element) {
|
|
206
|
+
if (toolbar.hasWindow()) {
|
|
207
|
+
return toolbar.getOuterWidth($element)
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
var getSizeValue = function(size) {
|
|
211
|
+
if (null === size) {
|
|
212
|
+
size = void 0;
|
|
213
|
+
}
|
|
214
|
+
if ("function" === typeof size) {
|
|
215
|
+
size = size();
|
|
216
|
+
}
|
|
217
|
+
return size
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* DevExtreme (esm/ui/drop_down_button.js)
|
|
222
|
+
* Version: 22.1.6
|
|
223
|
+
* Build date: Tue Oct 18 2022
|
|
224
|
+
*
|
|
225
|
+
* Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
|
|
226
|
+
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
|
|
227
|
+
*/
|
|
228
|
+
var DROP_DOWN_BUTTON_CLASS = "dx-dropdownbutton";
|
|
229
|
+
var DROP_DOWN_BUTTON_CONTENT = "dx-dropdownbutton-content";
|
|
230
|
+
var DROP_DOWN_BUTTON_ACTION_CLASS = "dx-dropdownbutton-action";
|
|
231
|
+
var DROP_DOWN_BUTTON_TOGGLE_CLASS = "dx-dropdownbutton-toggle";
|
|
232
|
+
var DROP_DOWN_BUTTON_HAS_ARROW_CLASS = "dx-dropdownbutton-has-arrow";
|
|
233
|
+
var DROP_DOWN_BUTTON_POPUP_WRAPPER_CLASS = "dx-dropdownbutton-popup-wrapper";
|
|
234
|
+
var DROP_DOWN_EDITOR_OVERLAY_CLASS = "dx-dropdowneditor-overlay";
|
|
235
|
+
var DX_BUTTON_TEXT_CLASS = "dx-button-text";
|
|
236
|
+
var DX_ICON_RIGHT_CLASS = "dx-icon-right";
|
|
237
|
+
var DropDownButton = toolbar.Widget.inherit({
|
|
238
|
+
_getDefaultOptions() {
|
|
239
|
+
return toolbar.extend(this.callBase(), {
|
|
240
|
+
itemTemplate: "item",
|
|
241
|
+
keyExpr: "this",
|
|
242
|
+
displayExpr: void 0,
|
|
243
|
+
selectedItem: null,
|
|
244
|
+
selectedItemKey: null,
|
|
245
|
+
stylingMode: "outlined",
|
|
246
|
+
deferRendering: true,
|
|
247
|
+
noDataText: toolbar.messageLocalization.format("dxCollectionWidget-noDataText"),
|
|
248
|
+
useSelectMode: false,
|
|
249
|
+
splitButton: false,
|
|
250
|
+
showArrowIcon: true,
|
|
251
|
+
text: "",
|
|
252
|
+
icon: void 0,
|
|
253
|
+
onButtonClick: null,
|
|
254
|
+
onSelectionChanged: null,
|
|
255
|
+
onItemClick: null,
|
|
256
|
+
opened: false,
|
|
257
|
+
items: null,
|
|
258
|
+
dataSource: null,
|
|
259
|
+
focusStateEnabled: true,
|
|
260
|
+
hoverStateEnabled: true,
|
|
261
|
+
dropDownOptions: {},
|
|
262
|
+
dropDownContentTemplate: "content",
|
|
263
|
+
wrapItemText: false,
|
|
264
|
+
useItemTextAsTitle: true,
|
|
265
|
+
grouped: false,
|
|
266
|
+
groupTemplate: "group",
|
|
267
|
+
buttonGroupOptions: {}
|
|
268
|
+
})
|
|
269
|
+
},
|
|
270
|
+
_setOptionsByReference() {
|
|
271
|
+
this.callBase();
|
|
272
|
+
toolbar.extend(this._optionsByReference, {
|
|
273
|
+
selectedItem: true
|
|
274
|
+
});
|
|
275
|
+
},
|
|
276
|
+
_init() {
|
|
277
|
+
this.callBase();
|
|
278
|
+
this._createItemClickAction();
|
|
279
|
+
this._createActionClickAction();
|
|
280
|
+
this._createSelectionChangedAction();
|
|
281
|
+
this._initDataSource();
|
|
282
|
+
this._compileKeyGetter();
|
|
283
|
+
this._compileDisplayGetter();
|
|
284
|
+
this._itemsToDataSource(this.option("items"));
|
|
285
|
+
this._options.cache("buttonGroupOptions", this.option("buttonGroupOptions"));
|
|
286
|
+
this._options.cache("dropDownOptions", this.option("dropDownOptions"));
|
|
287
|
+
},
|
|
288
|
+
_initTemplates() {
|
|
289
|
+
this._templateManager.addDefaultTemplates({
|
|
290
|
+
content: new toolbar.FunctionTemplate(options => {
|
|
291
|
+
var $popupContent = toolbar.$(options.container);
|
|
292
|
+
var $listContainer = toolbar.$("<div>").appendTo($popupContent);
|
|
293
|
+
this._list = this._createComponent($listContainer, toolbar.ListSearch, this._listOptions());
|
|
294
|
+
this._list.registerKeyHandler("escape", this._escHandler.bind(this));
|
|
295
|
+
this._list.registerKeyHandler("tab", this._escHandler.bind(this));
|
|
296
|
+
this._list.registerKeyHandler("leftArrow", this._escHandler.bind(this));
|
|
297
|
+
this._list.registerKeyHandler("rightArrow", this._escHandler.bind(this));
|
|
298
|
+
})
|
|
299
|
+
});
|
|
300
|
+
this.callBase();
|
|
301
|
+
},
|
|
302
|
+
_itemsToDataSource: function(value) {
|
|
303
|
+
if (!this._dataSource) {
|
|
304
|
+
this._dataSource = new toolbar.DataSource({
|
|
305
|
+
store: new toolbar.ArrayStore({
|
|
306
|
+
key: this._getKey(),
|
|
307
|
+
data: value
|
|
308
|
+
}),
|
|
309
|
+
pageSize: 0
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
_getKey: function() {
|
|
314
|
+
var _this$_dataSource;
|
|
315
|
+
var keyExpr = this.option("keyExpr");
|
|
316
|
+
var storeKey = null === (_this$_dataSource = this._dataSource) || void 0 === _this$_dataSource ? void 0 : _this$_dataSource.key();
|
|
317
|
+
return toolbar.isDefined(storeKey) && (!toolbar.isDefined(keyExpr) || "this" === keyExpr) ? storeKey : keyExpr
|
|
318
|
+
},
|
|
319
|
+
_compileKeyGetter() {
|
|
320
|
+
this._keyGetter = toolbar.compileGetter(this._getKey());
|
|
321
|
+
},
|
|
322
|
+
_compileDisplayGetter() {
|
|
323
|
+
this._displayGetter = toolbar.compileGetter(this.option("displayExpr"));
|
|
324
|
+
},
|
|
325
|
+
_initMarkup() {
|
|
326
|
+
this.callBase();
|
|
327
|
+
this.$element().addClass(DROP_DOWN_BUTTON_CLASS);
|
|
328
|
+
this._renderButtonGroup();
|
|
329
|
+
this._updateArrowClass();
|
|
330
|
+
if (toolbar.isDefined(this.option("selectedItemKey"))) {
|
|
331
|
+
this._loadSelectedItem().done(this._updateActionButton.bind(this));
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
_renderFocusTarget: toolbar.noop,
|
|
335
|
+
_render() {
|
|
336
|
+
if (!this.option("deferRendering") || this.option("opened")) {
|
|
337
|
+
this._renderPopup();
|
|
338
|
+
}
|
|
339
|
+
this.callBase();
|
|
340
|
+
},
|
|
341
|
+
_renderContentImpl() {
|
|
342
|
+
if (this._popup) {
|
|
343
|
+
this._renderPopupContent();
|
|
344
|
+
}
|
|
345
|
+
return this.callBase()
|
|
346
|
+
},
|
|
347
|
+
_loadSelectedItem() {
|
|
348
|
+
var _this$_loadSingleDefe;
|
|
349
|
+
null === (_this$_loadSingleDefe = this._loadSingleDeferred) || void 0 === _this$_loadSingleDefe ? void 0 : _this$_loadSingleDefe.reject();
|
|
350
|
+
var d = new toolbar.Deferred;
|
|
351
|
+
if (this._list && void 0 !== this._lastSelectedItemData) {
|
|
352
|
+
var cachedResult = this.option("useSelectMode") ? this._list.option("selectedItem") : this._lastSelectedItemData;
|
|
353
|
+
return d.resolve(cachedResult)
|
|
354
|
+
}
|
|
355
|
+
this._lastSelectedItemData = void 0;
|
|
356
|
+
var selectedItemKey = this.option("selectedItemKey");
|
|
357
|
+
this._loadSingle(this._getKey(), selectedItemKey).done(d.resolve).fail(() => {
|
|
358
|
+
d.resolve(null);
|
|
359
|
+
});
|
|
360
|
+
this._loadSingleDeferred = d;
|
|
361
|
+
return d.promise()
|
|
362
|
+
},
|
|
363
|
+
_createActionClickAction() {
|
|
364
|
+
this._actionClickAction = this._createActionByOption("onButtonClick");
|
|
365
|
+
},
|
|
366
|
+
_createSelectionChangedAction() {
|
|
367
|
+
this._selectionChangedAction = this._createActionByOption("onSelectionChanged");
|
|
368
|
+
},
|
|
369
|
+
_createItemClickAction() {
|
|
370
|
+
this._itemClickAction = this._createActionByOption("onItemClick");
|
|
371
|
+
},
|
|
372
|
+
_fireSelectionChangedAction(_ref) {
|
|
373
|
+
var {
|
|
374
|
+
previousValue: previousValue,
|
|
375
|
+
value: value
|
|
376
|
+
} = _ref;
|
|
377
|
+
this._selectionChangedAction({
|
|
378
|
+
item: value,
|
|
379
|
+
previousItem: previousValue
|
|
380
|
+
});
|
|
381
|
+
},
|
|
382
|
+
_fireItemClickAction(_ref2) {
|
|
383
|
+
var {
|
|
384
|
+
event: event,
|
|
385
|
+
itemElement: itemElement,
|
|
386
|
+
itemData: itemData
|
|
387
|
+
} = _ref2;
|
|
388
|
+
return this._itemClickAction({
|
|
389
|
+
event: event,
|
|
390
|
+
itemElement: itemElement,
|
|
391
|
+
itemData: this._actionItem || itemData
|
|
392
|
+
})
|
|
393
|
+
},
|
|
394
|
+
_actionButtonConfig() {
|
|
395
|
+
return {
|
|
396
|
+
text: this.option("text"),
|
|
397
|
+
icon: this.option("icon"),
|
|
398
|
+
elementAttr: {
|
|
399
|
+
class: DROP_DOWN_BUTTON_ACTION_CLASS
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
_getButtonGroupItems() {
|
|
404
|
+
var items = [];
|
|
405
|
+
items.push(this._actionButtonConfig());
|
|
406
|
+
if (this.option("splitButton")) {
|
|
407
|
+
items.push({
|
|
408
|
+
icon: "spindown",
|
|
409
|
+
elementAttr: {
|
|
410
|
+
class: DROP_DOWN_BUTTON_TOGGLE_CLASS
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
return items
|
|
415
|
+
},
|
|
416
|
+
_buttonGroupItemClick(_ref3) {
|
|
417
|
+
var {
|
|
418
|
+
event: event,
|
|
419
|
+
itemData: itemData
|
|
420
|
+
} = _ref3;
|
|
421
|
+
var isActionButton = itemData.elementAttr.class === DROP_DOWN_BUTTON_ACTION_CLASS;
|
|
422
|
+
var isToggleButton = itemData.elementAttr.class === DROP_DOWN_BUTTON_TOGGLE_CLASS;
|
|
423
|
+
if (isToggleButton) {
|
|
424
|
+
this.toggle();
|
|
425
|
+
} else if (isActionButton) {
|
|
426
|
+
this._actionClickAction({
|
|
427
|
+
event: event,
|
|
428
|
+
selectedItem: this.option("selectedItem")
|
|
429
|
+
});
|
|
430
|
+
if (!this.option("splitButton")) {
|
|
431
|
+
this.toggle();
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
_buttonGroupOptions() {
|
|
436
|
+
var {
|
|
437
|
+
splitButton: splitButton,
|
|
438
|
+
showArrowIcon: showArrowIcon,
|
|
439
|
+
focusStateEnabled: focusStateEnabled,
|
|
440
|
+
hoverStateEnabled: hoverStateEnabled,
|
|
441
|
+
stylingMode: stylingMode,
|
|
442
|
+
accessKey: accessKey,
|
|
443
|
+
tabIndex: tabIndex
|
|
444
|
+
} = this.option();
|
|
445
|
+
var buttonTemplate = splitButton || !showArrowIcon ? "content" : (_ref4, buttonContent) => {
|
|
446
|
+
var {
|
|
447
|
+
text: text,
|
|
448
|
+
icon: icon
|
|
449
|
+
} = _ref4;
|
|
450
|
+
var $firstIcon = toolbar.getImageContainer(icon);
|
|
451
|
+
var $textContainer = text ? toolbar.$("<span>").text(text).addClass(DX_BUTTON_TEXT_CLASS) : void 0;
|
|
452
|
+
var $secondIcon = toolbar.getImageContainer("spindown").addClass(DX_ICON_RIGHT_CLASS);
|
|
453
|
+
toolbar.$(buttonContent).append($firstIcon, $textContainer, $secondIcon);
|
|
454
|
+
};
|
|
455
|
+
return toolbar.extend({
|
|
456
|
+
items: this._getButtonGroupItems(),
|
|
457
|
+
onItemClick: this._buttonGroupItemClick.bind(this),
|
|
458
|
+
width: "100%",
|
|
459
|
+
height: "100%",
|
|
460
|
+
selectionMode: "none",
|
|
461
|
+
onKeyboardHandled: e => this._keyboardHandler(e),
|
|
462
|
+
buttonTemplate: buttonTemplate,
|
|
463
|
+
focusStateEnabled: focusStateEnabled,
|
|
464
|
+
hoverStateEnabled: hoverStateEnabled,
|
|
465
|
+
stylingMode: stylingMode,
|
|
466
|
+
accessKey: accessKey,
|
|
467
|
+
tabIndex: tabIndex
|
|
468
|
+
}, this._options.cache("buttonGroupOptions"))
|
|
469
|
+
},
|
|
470
|
+
_renderPopupContent() {
|
|
471
|
+
var $content = this._popup.$content();
|
|
472
|
+
var template = this._getTemplateByOption("dropDownContentTemplate");
|
|
473
|
+
$content.empty();
|
|
474
|
+
this._popupContentId = "dx-" + new toolbar.Guid;
|
|
475
|
+
this.setAria("id", this._popupContentId, $content);
|
|
476
|
+
return template.render({
|
|
477
|
+
container: toolbar.getPublicElement($content),
|
|
478
|
+
model: this.option("items") || this._dataSource
|
|
479
|
+
})
|
|
480
|
+
},
|
|
481
|
+
_popupOptions() {
|
|
482
|
+
var horizontalAlignment = this.option("rtlEnabled") ? "right" : "left";
|
|
483
|
+
return toolbar.extend({
|
|
484
|
+
dragEnabled: false,
|
|
485
|
+
focusStateEnabled: false,
|
|
486
|
+
deferRendering: this.option("deferRendering"),
|
|
487
|
+
hideOnOutsideClick: e => {
|
|
488
|
+
var $element = this.$element();
|
|
489
|
+
var $buttonClicked = toolbar.$(e.target).closest(".".concat(DROP_DOWN_BUTTON_CLASS));
|
|
490
|
+
return !$buttonClicked.is($element)
|
|
491
|
+
},
|
|
492
|
+
showTitle: false,
|
|
493
|
+
animation: {
|
|
494
|
+
show: {
|
|
495
|
+
type: "fade",
|
|
496
|
+
duration: 0,
|
|
497
|
+
from: 0,
|
|
498
|
+
to: 1
|
|
499
|
+
},
|
|
500
|
+
hide: {
|
|
501
|
+
type: "fade",
|
|
502
|
+
duration: 400,
|
|
503
|
+
from: 1,
|
|
504
|
+
to: 0
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
_ignoreFunctionValueDeprecation: true,
|
|
508
|
+
width: () => getElementWidth(this.$element()),
|
|
509
|
+
height: "auto",
|
|
510
|
+
shading: false,
|
|
511
|
+
position: {
|
|
512
|
+
of: this.$element(),
|
|
513
|
+
collision: "flipfit",
|
|
514
|
+
my: horizontalAlignment + " top",
|
|
515
|
+
at: horizontalAlignment + " bottom"
|
|
516
|
+
},
|
|
517
|
+
wrapperAttr: {
|
|
518
|
+
class: DROP_DOWN_EDITOR_OVERLAY_CLASS
|
|
519
|
+
}
|
|
520
|
+
}, this._options.cache("dropDownOptions"), {
|
|
521
|
+
visible: this.option("opened")
|
|
522
|
+
})
|
|
523
|
+
},
|
|
524
|
+
_listOptions() {
|
|
525
|
+
var selectedItemKey = this.option("selectedItemKey");
|
|
526
|
+
var useSelectMode = this.option("useSelectMode");
|
|
527
|
+
return {
|
|
528
|
+
selectionMode: useSelectMode ? "single" : "none",
|
|
529
|
+
wrapItemText: this.option("wrapItemText"),
|
|
530
|
+
focusStateEnabled: this.option("focusStateEnabled"),
|
|
531
|
+
hoverStateEnabled: this.option("hoverStateEnabled"),
|
|
532
|
+
useItemTextAsTitle: this.option("useItemTextAsTitle"),
|
|
533
|
+
onContentReady: () => this._fireContentReadyAction(),
|
|
534
|
+
selectedItemKeys: toolbar.isDefined(selectedItemKey) && useSelectMode ? [selectedItemKey] : [],
|
|
535
|
+
grouped: this.option("grouped"),
|
|
536
|
+
groupTemplate: this.option("groupTemplate"),
|
|
537
|
+
keyExpr: this._getKey(),
|
|
538
|
+
noDataText: this.option("noDataText"),
|
|
539
|
+
displayExpr: this.option("displayExpr"),
|
|
540
|
+
itemTemplate: this.option("itemTemplate"),
|
|
541
|
+
items: this.option("items"),
|
|
542
|
+
dataSource: this._dataSource,
|
|
543
|
+
onItemClick: e => {
|
|
544
|
+
if (!this.option("useSelectMode")) {
|
|
545
|
+
this._lastSelectedItemData = e.itemData;
|
|
546
|
+
}
|
|
547
|
+
this.option("selectedItemKey", this._keyGetter(e.itemData));
|
|
548
|
+
var actionResult = this._fireItemClickAction(e);
|
|
549
|
+
if (false !== actionResult) {
|
|
550
|
+
this.toggle(false);
|
|
551
|
+
this._buttonGroup.focus();
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
_upDownKeyHandler() {
|
|
557
|
+
if (this._popup && this._popup.option("visible") && this._list) {
|
|
558
|
+
this._list.focus();
|
|
559
|
+
} else {
|
|
560
|
+
this.open();
|
|
561
|
+
}
|
|
562
|
+
return true
|
|
563
|
+
},
|
|
564
|
+
_escHandler() {
|
|
565
|
+
this.close();
|
|
566
|
+
this._buttonGroup.focus();
|
|
567
|
+
return true
|
|
568
|
+
},
|
|
569
|
+
_tabHandler() {
|
|
570
|
+
this.close();
|
|
571
|
+
return true
|
|
572
|
+
},
|
|
573
|
+
_renderPopup() {
|
|
574
|
+
var $popup = toolbar.$("<div>");
|
|
575
|
+
this.$element().append($popup);
|
|
576
|
+
this._popup = this._createComponent($popup, toolbar.Popup, this._popupOptions());
|
|
577
|
+
this._popup.$content().addClass(DROP_DOWN_BUTTON_CONTENT);
|
|
578
|
+
this._popup.$wrapper().addClass(DROP_DOWN_BUTTON_POPUP_WRAPPER_CLASS);
|
|
579
|
+
this._popup.on("hiding", this._popupHidingHandler.bind(this));
|
|
580
|
+
this._popup.on("showing", this._popupShowingHandler.bind(this));
|
|
581
|
+
this._bindInnerWidgetOptions(this._popup, "dropDownOptions");
|
|
582
|
+
},
|
|
583
|
+
_popupHidingHandler() {
|
|
584
|
+
this.option("opened", false);
|
|
585
|
+
this._setAriaExpanded(false);
|
|
586
|
+
},
|
|
587
|
+
_popupOptionChanged: function(args) {
|
|
588
|
+
var options = toolbar.Widget.getOptionsFromContainer(args);
|
|
589
|
+
this._setPopupOption(options);
|
|
590
|
+
var optionsKeys = Object.keys(options);
|
|
591
|
+
if (-1 !== optionsKeys.indexOf("width") || -1 !== optionsKeys.indexOf("height")) {
|
|
592
|
+
this._dimensionChanged();
|
|
593
|
+
}
|
|
594
|
+
},
|
|
595
|
+
_dimensionChanged: function() {
|
|
596
|
+
var popupWidth = getSizeValue(this.option("dropDownOptions.width"));
|
|
597
|
+
if (void 0 === popupWidth) {
|
|
598
|
+
this._setPopupOption("width", () => getElementWidth(this.$element()));
|
|
599
|
+
}
|
|
600
|
+
},
|
|
601
|
+
_setPopupOption: function(optionName, value) {
|
|
602
|
+
this._setWidgetOption("_popup", arguments);
|
|
603
|
+
},
|
|
604
|
+
_popupShowingHandler() {
|
|
605
|
+
this.option("opened", true);
|
|
606
|
+
this._setAriaExpanded(true);
|
|
607
|
+
},
|
|
608
|
+
_setAriaExpanded(value) {
|
|
609
|
+
this._ariaExpandedElements.forEach(ariaElement => {
|
|
610
|
+
this.setAria({
|
|
611
|
+
expanded: value,
|
|
612
|
+
owns: value ? this._popupContentId : void 0
|
|
613
|
+
}, toolbar.$(ariaElement));
|
|
614
|
+
});
|
|
615
|
+
},
|
|
616
|
+
_renderButtonGroup() {
|
|
617
|
+
var $buttonGroup = this._buttonGroup && this._buttonGroup.$element() || toolbar.$("<div>");
|
|
618
|
+
if (!this._buttonGroup) {
|
|
619
|
+
this.$element().append($buttonGroup);
|
|
620
|
+
}
|
|
621
|
+
this._buttonGroup = this._createComponent($buttonGroup, ButtonGroup, this._buttonGroupOptions());
|
|
622
|
+
var buttonElements = this._buttonGroup.$element().find(".dx-button").toArray();
|
|
623
|
+
this._ariaExpandedElements = [...buttonElements, this.$element()];
|
|
624
|
+
this._buttonGroup.registerKeyHandler("downArrow", this._upDownKeyHandler.bind(this));
|
|
625
|
+
this._buttonGroup.registerKeyHandler("tab", this._tabHandler.bind(this));
|
|
626
|
+
this._buttonGroup.registerKeyHandler("upArrow", this._upDownKeyHandler.bind(this));
|
|
627
|
+
this._buttonGroup.registerKeyHandler("escape", this._escHandler.bind(this));
|
|
628
|
+
this._bindInnerWidgetOptions(this._buttonGroup, "buttonGroupOptions");
|
|
629
|
+
this._setAriaExpanded(this.option("opened"));
|
|
630
|
+
},
|
|
631
|
+
_updateArrowClass() {
|
|
632
|
+
var hasArrow = this.option("splitButton") || this.option("showArrowIcon");
|
|
633
|
+
this.$element().toggleClass(DROP_DOWN_BUTTON_HAS_ARROW_CLASS, hasArrow);
|
|
634
|
+
},
|
|
635
|
+
toggle(visible) {
|
|
636
|
+
if (!this._popup) {
|
|
637
|
+
this._renderPopup();
|
|
638
|
+
this._renderContent();
|
|
639
|
+
}
|
|
640
|
+
return this._popup.toggle(visible)
|
|
641
|
+
},
|
|
642
|
+
open() {
|
|
643
|
+
return this.toggle(true)
|
|
644
|
+
},
|
|
645
|
+
close() {
|
|
646
|
+
return this.toggle(false)
|
|
647
|
+
},
|
|
648
|
+
_setListOption(name, value) {
|
|
649
|
+
this._list && this._list.option(name, value);
|
|
650
|
+
},
|
|
651
|
+
_getDisplayValue(item) {
|
|
652
|
+
var isPrimitiveItem = !toolbar.isPlainObject(item);
|
|
653
|
+
var displayValue = isPrimitiveItem ? item : this._displayGetter(item);
|
|
654
|
+
return !toolbar.isPlainObject(displayValue) ? String(toolbar.ensureDefined(displayValue, "")) : ""
|
|
655
|
+
},
|
|
656
|
+
_updateActionButton(selectedItem) {
|
|
657
|
+
if (this.option("useSelectMode")) {
|
|
658
|
+
this.option({
|
|
659
|
+
text: this._getDisplayValue(selectedItem),
|
|
660
|
+
icon: toolbar.isPlainObject(selectedItem) ? selectedItem.icon : void 0
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
this._setOptionWithoutOptionChange("selectedItem", selectedItem);
|
|
664
|
+
this._setOptionWithoutOptionChange("selectedItemKey", this._keyGetter(selectedItem));
|
|
665
|
+
},
|
|
666
|
+
_clean() {
|
|
667
|
+
this._list && this._list.$element().remove();
|
|
668
|
+
this._popup && this._popup.$element().remove();
|
|
669
|
+
},
|
|
670
|
+
_selectedItemKeyChanged(value) {
|
|
671
|
+
this._setListOption("selectedItemKeys", this.option("useSelectMode") && toolbar.isDefined(value) ? [value] : []);
|
|
672
|
+
var previousItem = this.option("selectedItem");
|
|
673
|
+
this._loadSelectedItem().done(selectedItem => {
|
|
674
|
+
this._updateActionButton(selectedItem);
|
|
675
|
+
if (this._displayGetter(previousItem) !== this._displayGetter(selectedItem)) {
|
|
676
|
+
this._fireSelectionChangedAction({
|
|
677
|
+
previousValue: previousItem,
|
|
678
|
+
value: selectedItem
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
});
|
|
682
|
+
},
|
|
683
|
+
_actionButtonOptionChanged(_ref5) {
|
|
684
|
+
var {
|
|
685
|
+
name: name,
|
|
686
|
+
value: value
|
|
687
|
+
} = _ref5;
|
|
688
|
+
var newConfig = {};
|
|
689
|
+
newConfig[name] = value;
|
|
690
|
+
this._buttonGroup.option("items[0]", toolbar.extend({}, this._actionButtonConfig(), newConfig));
|
|
691
|
+
this._popup && this._popup.repaint();
|
|
692
|
+
},
|
|
693
|
+
_selectModeChanged(value) {
|
|
694
|
+
if (value) {
|
|
695
|
+
this._setListOption("selectionMode", "single");
|
|
696
|
+
var selectedItemKey = this.option("selectedItemKey");
|
|
697
|
+
this._setListOption("selectedItemKeys", toolbar.isDefined(selectedItemKey) ? [selectedItemKey] : []);
|
|
698
|
+
this._selectedItemKeyChanged(this.option("selectedItemKey"));
|
|
699
|
+
} else {
|
|
700
|
+
this._setListOption("selectionMode", "none");
|
|
701
|
+
this.option({
|
|
702
|
+
selectedItemKey: void 0,
|
|
703
|
+
selectedItem: void 0
|
|
704
|
+
});
|
|
705
|
+
this._actionButtonOptionChanged({
|
|
706
|
+
text: this.option("text")
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
},
|
|
710
|
+
_updateItemCollection(optionName) {
|
|
711
|
+
var selectedItemKey = this.option("selectedItemKey");
|
|
712
|
+
this._setListOption("selectedItem", null);
|
|
713
|
+
this._setWidgetOption("_list", [optionName]);
|
|
714
|
+
if (toolbar.isDefined(selectedItemKey)) {
|
|
715
|
+
this._loadSelectedItem().done(selectedItem => {
|
|
716
|
+
this._setListOption("selectedItemKeys", [selectedItemKey]);
|
|
717
|
+
this._setListOption("selectedItem", selectedItem);
|
|
718
|
+
}).fail(error => {
|
|
719
|
+
this._setListOption("selectedItemKeys", []);
|
|
720
|
+
}).always(this._updateActionButton.bind(this));
|
|
721
|
+
}
|
|
722
|
+
},
|
|
723
|
+
_updateDataSource: function() {
|
|
724
|
+
var items = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this._dataSource.items();
|
|
725
|
+
this._dataSource = void 0;
|
|
726
|
+
this._itemsToDataSource(items);
|
|
727
|
+
this._updateKeyExpr();
|
|
728
|
+
},
|
|
729
|
+
_updateKeyExpr: function() {
|
|
730
|
+
this._compileKeyGetter();
|
|
731
|
+
this._setListOption("keyExpr", this._getKey());
|
|
732
|
+
},
|
|
733
|
+
focus: function() {
|
|
734
|
+
this._buttonGroup.focus();
|
|
735
|
+
},
|
|
736
|
+
_optionChanged(args) {
|
|
737
|
+
var _this$_popup;
|
|
738
|
+
var {
|
|
739
|
+
name: name,
|
|
740
|
+
value: value
|
|
741
|
+
} = args;
|
|
742
|
+
switch (name) {
|
|
743
|
+
case "useSelectMode":
|
|
744
|
+
this._selectModeChanged(value);
|
|
745
|
+
break;
|
|
746
|
+
case "splitButton":
|
|
747
|
+
this._updateArrowClass();
|
|
748
|
+
this._renderButtonGroup();
|
|
749
|
+
break;
|
|
750
|
+
case "displayExpr":
|
|
751
|
+
this._compileDisplayGetter();
|
|
752
|
+
this._setListOption(name, value);
|
|
753
|
+
this._updateActionButton(this.option("selectedItem"));
|
|
754
|
+
break;
|
|
755
|
+
case "keyExpr":
|
|
756
|
+
this._updateDataSource();
|
|
757
|
+
break;
|
|
758
|
+
case "buttonGroupOptions":
|
|
759
|
+
this._innerWidgetOptionChanged(this._buttonGroup, args);
|
|
760
|
+
break;
|
|
761
|
+
case "dropDownOptions":
|
|
762
|
+
if ("dropDownOptions.visible" === args.fullName) {
|
|
763
|
+
break
|
|
764
|
+
}
|
|
765
|
+
if (void 0 !== args.value.visible) {
|
|
766
|
+
delete args.value.visible;
|
|
767
|
+
}
|
|
768
|
+
this._popupOptionChanged(args);
|
|
769
|
+
this._innerWidgetOptionChanged(this._popup, args);
|
|
770
|
+
break;
|
|
771
|
+
case "opened":
|
|
772
|
+
this.toggle(value);
|
|
773
|
+
break;
|
|
774
|
+
case "focusStateEnabled":
|
|
775
|
+
case "hoverStateEnabled":
|
|
776
|
+
this._setListOption(name, value);
|
|
777
|
+
this._buttonGroup.option(name, value);
|
|
778
|
+
this.callBase(args);
|
|
779
|
+
break;
|
|
780
|
+
case "items":
|
|
781
|
+
this._updateDataSource(this.option("items"));
|
|
782
|
+
this._updateItemCollection(name);
|
|
783
|
+
break;
|
|
784
|
+
case "dataSource":
|
|
785
|
+
if (Array.isArray(value)) {
|
|
786
|
+
this._updateDataSource(this.option("dataSource"));
|
|
787
|
+
} else {
|
|
788
|
+
this._initDataSource();
|
|
789
|
+
this._updateKeyExpr();
|
|
790
|
+
}
|
|
791
|
+
this._updateItemCollection(name);
|
|
792
|
+
break;
|
|
793
|
+
case "icon":
|
|
794
|
+
case "text":
|
|
795
|
+
this._actionButtonOptionChanged(args);
|
|
796
|
+
break;
|
|
797
|
+
case "showArrowIcon":
|
|
798
|
+
this._updateArrowClass();
|
|
799
|
+
this._renderButtonGroup();
|
|
800
|
+
this._popup && this._popup.repaint();
|
|
801
|
+
break;
|
|
802
|
+
case "width":
|
|
803
|
+
case "height":
|
|
804
|
+
this.callBase(args);
|
|
805
|
+
null === (_this$_popup = this._popup) || void 0 === _this$_popup ? void 0 : _this$_popup.repaint();
|
|
806
|
+
break;
|
|
807
|
+
case "stylingMode":
|
|
808
|
+
this._buttonGroup.option(name, value);
|
|
809
|
+
break;
|
|
810
|
+
case "itemTemplate":
|
|
811
|
+
case "grouped":
|
|
812
|
+
case "noDataText":
|
|
813
|
+
case "groupTemplate":
|
|
814
|
+
case "wrapItemText":
|
|
815
|
+
case "useItemTextAsTitle":
|
|
816
|
+
this._setListOption(name, value);
|
|
817
|
+
break;
|
|
818
|
+
case "dropDownContentTemplate":
|
|
819
|
+
this._renderContent();
|
|
820
|
+
break;
|
|
821
|
+
case "selectedItemKey":
|
|
822
|
+
this._selectedItemKeyChanged(value);
|
|
823
|
+
break;
|
|
824
|
+
case "selectedItem":
|
|
825
|
+
break;
|
|
826
|
+
case "onItemClick":
|
|
827
|
+
this._createItemClickAction();
|
|
828
|
+
break;
|
|
829
|
+
case "onButtonClick":
|
|
830
|
+
this._createActionClickAction();
|
|
831
|
+
break;
|
|
832
|
+
case "onSelectionChanged":
|
|
833
|
+
this._createSelectionChangedAction();
|
|
834
|
+
break;
|
|
835
|
+
case "deferRendering":
|
|
836
|
+
this.toggle(this.option("opened"));
|
|
837
|
+
break;
|
|
838
|
+
case "tabIndex":
|
|
839
|
+
this._buttonGroup.option(name, value);
|
|
840
|
+
break;
|
|
841
|
+
default:
|
|
842
|
+
this.callBase(args);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
}).include(toolbar.DataHelperMixin);
|
|
846
|
+
toolbar.registerComponent("dxDropDownButton", DropDownButton);
|
|
847
|
+
|
|
848
|
+
const tttxPageCss = "@import url(\"https://fonts.googleapis.com/css?family=Roboto&display=swap\");*{box-sizing:border-box}.flex-start{justify-content:start}.flex-end{justify-content:end}.flex-centre{justify-content:center}[class^=col-]{display:flex;padding-left:8px !important;padding-right:8px !important}h1,h2,h3,h4,h5,h6,p,label,small{margin:0;padding:0}h1,h2,h3,h4,h5,h6,p,label{display:block}*{font-family:\"Roboto\", sans-serif}html,body{font-weight:normal;font-size:16px}h1{font-weight:700;font-size:24px}h2{font-weight:700;font-size:20px}h3{font-weight:700;font-size:18px}h4{font-weight:normal;font-size:14px;text-transform:uppercase}button{font-weight:500;font-size:14px;text-transform:uppercase}small{font-weight:normal;font-size:14px}label{font-weight:700;font-size:16px}:host{display:block}.page{background-color:#F0F0F0;width:100%;height:100%}.page__platform-bar.dx-toolbar{position:fixed;top:0px;left:0px;right:0px;background-color:#142748;color:#ffffff;font-size:24px;padding:0 8px}.page__title-bar__container,.page__title-bar__container--large,.page__title-bar__container--medium,.page__title-bar__container--small{position:fixed;top:52px;left:0px;right:0px}.page__title-bar__container .dx-toolbar,.page__title-bar__container--large .dx-toolbar,.page__title-bar__container--medium .dx-toolbar,.page__title-bar__container--small .dx-toolbar{color:#212121;background-color:#F0F0F0;font-size:24px}.page__title-bar__container,.page__title-bar__container--medium,.page__title-bar__container--small{margin:0px auto}.page__title-bar__container--large{margin:0px 16px}.page__title-bar__container--medium{width:900px}.page__title-bar__container--small{width:600px}.page__title-bar__after-container__label{font-size:14px;color:#757575;font-weight:300}.page__title-bar__after-container__value{font-size:14px;color:#111111;font-weight:400;margin:0 10px 0 0}.page__platform-bar__button .dx-button-mode-text .dx-icon{color:white}.page__platform-bar__button__dropdown-options .dx-dropdownbutton-content .dx-list .dx-list-item:last-of-type::before{width:90%;margin:auto 5%;height:1px;content:\"\";position:absolute;background:grey}";
|
|
849
|
+
|
|
850
|
+
const TttxPage = class {
|
|
851
|
+
constructor(hostRef) {
|
|
852
|
+
index.registerInstance(this, hostRef);
|
|
853
|
+
this.appName = undefined;
|
|
854
|
+
this.pageTitle = undefined;
|
|
855
|
+
this.lastUpdated = undefined;
|
|
856
|
+
this.manageAccountsUrl = undefined;
|
|
857
|
+
this.logoutUrl = undefined;
|
|
858
|
+
this.pageSize = 'large';
|
|
859
|
+
this.helpUrl = undefined;
|
|
860
|
+
}
|
|
861
|
+
componentDidLoad() {
|
|
862
|
+
new toolbar.Toolbar(this.platformBar, {
|
|
863
|
+
items: [
|
|
864
|
+
{
|
|
865
|
+
location: 'before',
|
|
866
|
+
locateInMenu: 'never',
|
|
867
|
+
text: this.appName
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
location: 'after',
|
|
871
|
+
widget: DropDownButton,
|
|
872
|
+
cssClass: 'page__platform-bar__button',
|
|
873
|
+
options: {
|
|
874
|
+
icon: 'overflow',
|
|
875
|
+
keyExpr: 'id',
|
|
876
|
+
displayExpr: 'text',
|
|
877
|
+
stylingMode: 'text',
|
|
878
|
+
showArrowIcon: false,
|
|
879
|
+
dropDownOptions: { width: '200', wrapperAttr: { class: 'page__platform-bar__button__dropdown-options' } },
|
|
880
|
+
items: this.platformBarButtonItems()
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
]
|
|
884
|
+
});
|
|
885
|
+
new toolbar.Toolbar(this.pageTitleBar, {
|
|
886
|
+
items: [
|
|
887
|
+
{
|
|
888
|
+
location: 'before',
|
|
889
|
+
text: this.pageTitle
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
location: 'after',
|
|
893
|
+
html: `<span class='page__title-bar__after-container__label'>Last updated</span> <span class='page__title-bar__after-container__value'>${this.lastUpdated}</span>`
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
location: 'after',
|
|
897
|
+
widget: toolbar.Button,
|
|
898
|
+
options: {
|
|
899
|
+
text: 'help',
|
|
900
|
+
icon: 'help',
|
|
901
|
+
stylingMode: 'outlined',
|
|
902
|
+
onClick: () => { window.open(this.helpUrl, '_blank'); }
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
]
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
platformBarButtonItems() {
|
|
909
|
+
return [
|
|
910
|
+
{ id: 1, text: 'Manage Accounts', icon: "user", onClick: () => { window.open(this.manageAccountsUrl, '_blank'); } },
|
|
911
|
+
{ id: 2, text: 'Logout', icon: "runner", onClick: () => { window.location.href = this.logoutUrl; } }
|
|
912
|
+
];
|
|
913
|
+
}
|
|
914
|
+
pageSizeIsNumeric() {
|
|
915
|
+
return /^\d+$/.test(this.pageSize);
|
|
916
|
+
}
|
|
917
|
+
pageSizeClasses(baseClassName) {
|
|
918
|
+
return this.pageSizeIsNumeric() ? baseClassName : `${baseClassName}--${this.pageSize}`;
|
|
919
|
+
}
|
|
920
|
+
render() {
|
|
921
|
+
const customPageWidth = this.pageSizeIsNumeric ? { width: `${this.pageSize}px` } : {};
|
|
922
|
+
return (index.h(index.Host, { style: { margin: '0px', overflow: 'hidden' } }, index.h("div", { class: "page" }, index.h("div", { class: 'page__platform-bar', ref: el => (this.platformBar = el) }), index.h("div", { class: this.pageSizeClasses('page__title-bar__container'), style: Object.assign({}, customPageWidth) }, index.h("div", { ref: el => (this.pageTitleBar = el) })), index.h("tttx-worksheet", { pageSize: this.pageSize }))));
|
|
923
|
+
}
|
|
924
|
+
};
|
|
925
|
+
TttxPage.style = tttxPageCss;
|
|
926
|
+
|
|
927
|
+
exports.tttx_page = TttxPage;
|