@pnp/spfx-controls-react 3.6.0-beta.1817343 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.JSON +4 -1
  2. package/CHANGELOG.md +8 -1
  3. package/lib/AdaptiveCardHost.d.ts +2 -0
  4. package/lib/AdaptiveCardHost.d.ts.map +1 -0
  5. package/lib/AdaptiveCardHost.js +2 -0
  6. package/lib/AdaptiveCardHost.js.map +1 -0
  7. package/lib/common/telemetry/version.d.ts.map +1 -1
  8. package/lib/common/telemetry/version.js +1 -1
  9. package/lib/common/telemetry/version.js.map +1 -1
  10. package/lib/controls/adaptiveCardHost/AdaptiveCardHost.css +142 -0
  11. package/lib/controls/adaptiveCardHost/AdaptiveCardHost.d.ts +4 -0
  12. package/lib/controls/adaptiveCardHost/AdaptiveCardHost.d.ts.map +1 -0
  13. package/lib/controls/adaptiveCardHost/AdaptiveCardHost.js +198 -0
  14. package/lib/controls/adaptiveCardHost/AdaptiveCardHost.js.map +1 -0
  15. package/lib/controls/adaptiveCardHost/AdaptiveCardHostHelpers.d.ts +10 -0
  16. package/lib/controls/adaptiveCardHost/AdaptiveCardHostHelpers.d.ts.map +1 -0
  17. package/lib/controls/adaptiveCardHost/AdaptiveCardHostHelpers.js +1005 -0
  18. package/lib/controls/adaptiveCardHost/AdaptiveCardHostHelpers.js.map +1 -0
  19. package/lib/controls/adaptiveCardHost/IAdaptiveCardHostProps.d.ts +96 -0
  20. package/lib/controls/adaptiveCardHost/IAdaptiveCardHostProps.d.ts.map +1 -0
  21. package/lib/controls/adaptiveCardHost/IAdaptiveCardHostProps.js +8 -0
  22. package/lib/controls/adaptiveCardHost/IAdaptiveCardHostProps.js.map +1 -0
  23. package/lib/controls/adaptiveCardHost/fluentUI/Actions.d.ts +27 -0
  24. package/lib/controls/adaptiveCardHost/fluentUI/Actions.d.ts.map +1 -0
  25. package/lib/controls/adaptiveCardHost/fluentUI/Actions.js +172 -0
  26. package/lib/controls/adaptiveCardHost/fluentUI/Actions.js.map +1 -0
  27. package/lib/controls/adaptiveCardHost/fluentUI/Elements.d.ts +145 -0
  28. package/lib/controls/adaptiveCardHost/fluentUI/Elements.d.ts.map +1 -0
  29. package/lib/controls/adaptiveCardHost/fluentUI/Elements.js +706 -0
  30. package/lib/controls/adaptiveCardHost/fluentUI/Elements.js.map +1 -0
  31. package/lib/controls/adaptiveCardHost/fluentUI/FluentUI.d.ts +11 -0
  32. package/lib/controls/adaptiveCardHost/fluentUI/FluentUI.d.ts.map +1 -0
  33. package/lib/controls/adaptiveCardHost/fluentUI/FluentUI.js +75 -0
  34. package/lib/controls/adaptiveCardHost/fluentUI/FluentUI.js.map +1 -0
  35. package/lib/controls/adaptiveCardHost/fluentUI/Shared.d.ts +3 -0
  36. package/lib/controls/adaptiveCardHost/fluentUI/Shared.d.ts.map +1 -0
  37. package/lib/controls/adaptiveCardHost/fluentUI/Shared.js +8 -0
  38. package/lib/controls/adaptiveCardHost/fluentUI/Shared.js.map +1 -0
  39. package/lib/controls/adaptiveCardHost/fluentUI/index.d.ts +5 -0
  40. package/lib/controls/adaptiveCardHost/fluentUI/index.d.ts.map +1 -0
  41. package/lib/controls/adaptiveCardHost/fluentUI/index.js +5 -0
  42. package/lib/controls/adaptiveCardHost/fluentUI/index.js.map +1 -0
  43. package/lib/controls/adaptiveCardHost/index.d.ts +5 -0
  44. package/lib/controls/adaptiveCardHost/index.d.ts.map +1 -0
  45. package/lib/controls/adaptiveCardHost/index.js +5 -0
  46. package/lib/controls/adaptiveCardHost/index.js.map +1 -0
  47. package/lib/controls/adaptiveCardHost/themes/redPalette.json +24 -0
  48. package/lib/controls/adaptiveCardHost/themes/teamsDarkPalette.json +24 -0
  49. package/lib/controls/adaptiveCardHost/themes/teamsDefaultPalette.json +24 -0
  50. package/lib/controls/adaptiveCardHost/themes/teamsHighContrastPalette.json +24 -0
  51. package/lib/controls/modernTaxonomyPicker/ModernTaxonomyPicker.d.ts.map +1 -1
  52. package/lib/controls/modernTaxonomyPicker/ModernTaxonomyPicker.js +3 -1
  53. package/lib/controls/modernTaxonomyPicker/ModernTaxonomyPicker.js.map +1 -1
  54. package/package.json +8 -2
  55. package/release/webpack-stats/sp-dev-fx-controls-react.stats.json +109913 -25404
@@ -0,0 +1,706 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
15
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
17
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
18
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
19
+ };
20
+ import { ThemeProvider } from "@fluentui/react-theme-provider";
21
+ import { ActionProperty, BoolProperty, Choice, EnumProperty, Input, InputTextStyle, NumProperty, property, SerializableObjectCollectionProperty, StringProperty, Strings, TimeProperty, ValidationEvent, ValueSetProperty, Versions } from "adaptivecards";
22
+ import { DefaultButton, IconButton } from "office-ui-fabric-react/lib/Button";
23
+ import { Checkbox } from "office-ui-fabric-react/lib/Checkbox";
24
+ import { ChoiceGroup } from "office-ui-fabric-react/lib/ChoiceGroup";
25
+ import { ComboBox } from "office-ui-fabric-react/lib/ComboBox";
26
+ import { DatePicker } from "office-ui-fabric-react/lib/DatePicker";
27
+ import { SpinButton } from "office-ui-fabric-react/lib/SpinButton";
28
+ import { Stack } from "office-ui-fabric-react/lib/Stack";
29
+ import { TextField } from "office-ui-fabric-react/lib/TextField";
30
+ import { Toggle } from "office-ui-fabric-react/lib/Toggle";
31
+ import * as React from "react";
32
+ import { getFluentUIThemeFromHostCapability, hostCapabilitiesFluentUIThemeKey } from "./FluentUI";
33
+ import { internalRender } from "./Shared";
34
+ var inlineButtonRootStyle = {
35
+ marginLeft: 8,
36
+ };
37
+ var FluentUIChoiceSetInput = /** @class */ (function (_super) {
38
+ __extends(FluentUIChoiceSetInput, _super);
39
+ function FluentUIChoiceSetInput() {
40
+ var _this = _super !== null && _super.apply(this, arguments) || this;
41
+ _this.isMultiSelect = false;
42
+ _this.wrap = false;
43
+ _this.choices = [];
44
+ _this.selectedValues = [];
45
+ _this.defaultSelectedValues = [];
46
+ _this.updateSelectedValues = function (key, isMultiSelect, selected) {
47
+ if (isMultiSelect) {
48
+ selected ? _this.selectedValues.push(key) : _this.removeItemFromArray(_this.selectedValues, key);
49
+ }
50
+ else {
51
+ _this.selectedValues = [];
52
+ _this.selectedValues.push(key);
53
+ }
54
+ };
55
+ _this.removeItemFromArray = function (arr, item) {
56
+ var index = arr.indexOf(item);
57
+ arr.splice(index, 1);
58
+ };
59
+ return _this;
60
+ }
61
+ Object.defineProperty(FluentUIChoiceSetInput.prototype, "isCompact", {
62
+ get: function () {
63
+ return !this.style || this.style === "compact";
64
+ },
65
+ set: function (value) {
66
+ this.style = value ? undefined : "expanded";
67
+ },
68
+ enumerable: false,
69
+ configurable: true
70
+ });
71
+ FluentUIChoiceSetInput.prototype.internalRender = function () {
72
+ var _this = this;
73
+ var theme = getFluentUIThemeFromHostCapability(this.hostConfig);
74
+ if (this.defaultValue) {
75
+ this.defaultSelectedValues = this.defaultValue.split(this.hostConfig.choiceSetInputValueSeparator);
76
+ this.selectedValues = this.defaultSelectedValues;
77
+ }
78
+ var optionsChoiceGroup = (this.choices) ?
79
+ this.choices.map(function (x, index) {
80
+ return {
81
+ key: x.value, text: x.title,
82
+ styles: { root: { marginTop: index > 0 ? _this.hostConfig.spacing.default : 0 } }
83
+ };
84
+ })
85
+ : [];
86
+ var options = (this.choices) ?
87
+ this.choices.map(function (x) { return { key: x.value, text: x.title }; })
88
+ : [];
89
+ var control = function () {
90
+ return React.createElement(React.Fragment, null,
91
+ _this.isMultiSelect == false && _this.style === "expanded" &&
92
+ React.createElement(ThemeProvider, { theme: theme, style: { backgroundColor: "transparent" } },
93
+ React.createElement(ChoiceGroup, { defaultSelectedKey: _this.defaultValue, options: optionsChoiceGroup, onChange: function (ev, option) {
94
+ _this.updateSelectedValues(option.key, _this.isMultiSelect, true);
95
+ _this.valueChanged();
96
+ }, componentRef: function (input) { return _this.refControl = input; } })),
97
+ _this.isMultiSelect == true && _this.style === "expanded" &&
98
+ React.createElement(Stack, { tokens: { childrenGap: _this.hostConfig.spacing.default } }, _this.choices.map(function (x, index) {
99
+ var defaultChecked = _this.defaultSelectedValues.indexOf(x.value) > -1;
100
+ return React.createElement(ThemeProvider, { theme: theme, style: { backgroundColor: "transparent" } },
101
+ React.createElement(Checkbox, { title: x.title, key: x.value, defaultChecked: defaultChecked, label: x.title, onChange: function (ev, checked) {
102
+ _this.updateSelectedValues(x.value, _this.isMultiSelect, checked);
103
+ _this.valueChanged();
104
+ }, componentRef: function (input) {
105
+ if (index == 0)
106
+ _this.refControl = input;
107
+ } }));
108
+ })),
109
+ (_this.style === "compact" || _this.style === "filtered") &&
110
+ React.createElement(ThemeProvider, { theme: theme, style: { backgroundColor: "transparent" } },
111
+ React.createElement(ComboBox, { placeholder: _this.placeholder, multiSelect: _this.isMultiSelect, defaultSelectedKey: _this.defaultSelectedValues, allowFreeform: false, autoComplete: (_this.style === "filtered") ? "on" : "off", options: options, onChange: function (ev, option, index, value) {
112
+ _this.updateSelectedValues(option.key, _this.isMultiSelect, (_this.isMultiSelect) ? option.selected : true);
113
+ _this.valueChanged();
114
+ }, componentRef: function (input) { return _this.refControl = input; } })));
115
+ };
116
+ this.element = internalRender(control);
117
+ this.element.style.width = "100%";
118
+ return this.element;
119
+ };
120
+ FluentUIChoiceSetInput.prototype.getJsonTypeName = function () {
121
+ return "Input.ChoiceSet";
122
+ };
123
+ FluentUIChoiceSetInput.prototype.focus = function () {
124
+ if (this.refControl)
125
+ this.refControl.focus();
126
+ };
127
+ FluentUIChoiceSetInput.prototype.internalValidateProperties = function (context) {
128
+ _super.prototype.internalValidateProperties.call(this, context);
129
+ if (this.choices.length === 0) {
130
+ context.addFailure(this, ValidationEvent.CollectionCantBeEmpty, Strings.errors.choiceSetMustHaveAtLeastOneChoice());
131
+ }
132
+ for (var _i = 0, _a = this.choices; _i < _a.length; _i++) {
133
+ var choice = _a[_i];
134
+ if (!choice.title || !choice.value) {
135
+ context.addFailure(this, ValidationEvent.PropertyCantBeNull, Strings.errors.choiceSetChoicesMustHaveTitleAndValue());
136
+ }
137
+ }
138
+ };
139
+ FluentUIChoiceSetInput.prototype.isSet = function () {
140
+ return this.value ? true : false;
141
+ };
142
+ FluentUIChoiceSetInput.prototype.isValid = function () {
143
+ if (!this.value) {
144
+ return !this.isRequired;
145
+ }
146
+ return true;
147
+ };
148
+ Object.defineProperty(FluentUIChoiceSetInput.prototype, "value", {
149
+ get: function () {
150
+ var _this = this;
151
+ if (this.selectedValues) {
152
+ var result_1 = "";
153
+ this.selectedValues.map(function (x) {
154
+ if (result_1 !== "") {
155
+ result_1 += _this.hostConfig.choiceSetInputValueSeparator;
156
+ }
157
+ result_1 += x;
158
+ });
159
+ return result_1;
160
+ }
161
+ else {
162
+ return undefined;
163
+ }
164
+ },
165
+ enumerable: false,
166
+ configurable: true
167
+ });
168
+ FluentUIChoiceSetInput.valueProperty = new StringProperty(Versions.v1_0, "value");
169
+ FluentUIChoiceSetInput.choicesProperty = new SerializableObjectCollectionProperty(Versions.v1_0, "choices", Choice);
170
+ FluentUIChoiceSetInput.styleProperty = new ValueSetProperty(Versions.v1_0, "style", [
171
+ { value: "compact" },
172
+ { value: "expanded" },
173
+ { value: "filtered", targetVersion: Versions.v1_5 }
174
+ ], "compact");
175
+ FluentUIChoiceSetInput.isMultiSelectProperty = new BoolProperty(Versions.v1_0, "isMultiSelect", false);
176
+ FluentUIChoiceSetInput.placeholderProperty = new StringProperty(Versions.v1_0, "placeholder");
177
+ FluentUIChoiceSetInput.wrapProperty = new BoolProperty(Versions.v1_2, "wrap", false);
178
+ __decorate([
179
+ property(FluentUIChoiceSetInput.valueProperty)
180
+ ], FluentUIChoiceSetInput.prototype, "defaultValue", void 0);
181
+ __decorate([
182
+ property(FluentUIChoiceSetInput.styleProperty)
183
+ ], FluentUIChoiceSetInput.prototype, "style", void 0);
184
+ __decorate([
185
+ property(FluentUIChoiceSetInput.isMultiSelectProperty)
186
+ ], FluentUIChoiceSetInput.prototype, "isMultiSelect", void 0);
187
+ __decorate([
188
+ property(FluentUIChoiceSetInput.placeholderProperty)
189
+ ], FluentUIChoiceSetInput.prototype, "placeholder", void 0);
190
+ __decorate([
191
+ property(FluentUIChoiceSetInput.wrapProperty)
192
+ ], FluentUIChoiceSetInput.prototype, "wrap", void 0);
193
+ __decorate([
194
+ property(FluentUIChoiceSetInput.choicesProperty)
195
+ ], FluentUIChoiceSetInput.prototype, "choices", void 0);
196
+ return FluentUIChoiceSetInput;
197
+ }(Input));
198
+ export { FluentUIChoiceSetInput };
199
+ var FluentUIDateInput = /** @class */ (function (_super) {
200
+ __extends(FluentUIDateInput, _super);
201
+ function FluentUIDateInput() {
202
+ return _super !== null && _super.apply(this, arguments) || this;
203
+ }
204
+ FluentUIDateInput.prototype.internalRender = function () {
205
+ var _this = this;
206
+ var theme = getFluentUIThemeFromHostCapability(this.hostConfig);
207
+ var control = function () {
208
+ return React.createElement(ThemeProvider, { theme: theme },
209
+ React.createElement(DatePicker, { id: _this.id, placeholder: _this.placeholder, minDate: _this.convertStringToDate(_this.min), maxDate: _this.convertStringToDate(_this.max), onSelectDate: function (date) {
210
+ _this._value = date;
211
+ _this.valueChanged();
212
+ }, theme: theme, componentRef: function (input) { return _this.refControl = input; } }));
213
+ };
214
+ this.element = internalRender(control);
215
+ this.element.style.width = "100%";
216
+ return this.element;
217
+ };
218
+ FluentUIDateInput.prototype.convertStringToDate = function (value) {
219
+ if (value) {
220
+ try {
221
+ return new Date(value);
222
+ }
223
+ catch (_a) {
224
+ return null;
225
+ }
226
+ }
227
+ else {
228
+ return null;
229
+ }
230
+ };
231
+ FluentUIDateInput.prototype.getJsonTypeName = function () {
232
+ return "Input.Date";
233
+ };
234
+ FluentUIDateInput.prototype.focus = function () {
235
+ if (this.refControl)
236
+ this.refControl.focus();
237
+ };
238
+ FluentUIDateInput.prototype.updateInputControlAriaLabelledBy = function () {
239
+ if (this.element) {
240
+ var joinedLabelIds = this.getAllLabelIds().join(" ");
241
+ if (joinedLabelIds) {
242
+ this.element.setAttribute("aria-labelledby", joinedLabelIds);
243
+ }
244
+ else {
245
+ this.element.removeAttribute("aria-labelledby");
246
+ }
247
+ }
248
+ };
249
+ FluentUIDateInput.prototype.isSet = function () {
250
+ return this.value ? true : false;
251
+ };
252
+ FluentUIDateInput.prototype.isValid = function () {
253
+ if (!this.value) {
254
+ return !this.isRequired;
255
+ }
256
+ var valueAsDate = new Date(this.value);
257
+ var result = true;
258
+ if (this.min) {
259
+ var minDate = new Date(this.min);
260
+ result = result && valueAsDate >= minDate;
261
+ }
262
+ if (this.max) {
263
+ var maxDate = new Date(this.max);
264
+ result = result && valueAsDate <= maxDate;
265
+ }
266
+ return result;
267
+ };
268
+ Object.defineProperty(FluentUIDateInput.prototype, "value", {
269
+ get: function () {
270
+ if (this._value) {
271
+ var offset = this._value.getTimezoneOffset();
272
+ var value = new Date(this._value.getTime() - (offset * 60 * 1000));
273
+ return value.toISOString().split('T')[0];
274
+ }
275
+ else {
276
+ return undefined;
277
+ }
278
+ },
279
+ enumerable: false,
280
+ configurable: true
281
+ });
282
+ FluentUIDateInput.valueProperty = new StringProperty(Versions.v1_0, "value");
283
+ FluentUIDateInput.placeholderProperty = new StringProperty(Versions.v1_0, "placeholder");
284
+ FluentUIDateInput.minProperty = new StringProperty(Versions.v1_0, "min");
285
+ FluentUIDateInput.maxProperty = new StringProperty(Versions.v1_0, "max");
286
+ __decorate([
287
+ property(FluentUIDateInput.valueProperty)
288
+ ], FluentUIDateInput.prototype, "defaultValue", void 0);
289
+ __decorate([
290
+ property(FluentUIDateInput.minProperty)
291
+ ], FluentUIDateInput.prototype, "min", void 0);
292
+ __decorate([
293
+ property(FluentUIDateInput.maxProperty)
294
+ ], FluentUIDateInput.prototype, "max", void 0);
295
+ __decorate([
296
+ property(FluentUIDateInput.placeholderProperty)
297
+ ], FluentUIDateInput.prototype, "placeholder", void 0);
298
+ return FluentUIDateInput;
299
+ }(Input));
300
+ export { FluentUIDateInput };
301
+ var FluentUINumberInput = /** @class */ (function (_super) {
302
+ __extends(FluentUINumberInput, _super);
303
+ function FluentUINumberInput() {
304
+ return _super !== null && _super.apply(this, arguments) || this;
305
+ }
306
+ FluentUINumberInput.prototype.internalRender = function () {
307
+ var _this = this;
308
+ var theme = getFluentUIThemeFromHostCapability(this.hostConfig);
309
+ var control = function () {
310
+ return React.createElement(SpinButton, { id: _this.id, defaultValue: "" + _this.defaultValue, placeholder: _this.placeholder, min: _this.min, max: _this.max, onChange: function () { return _this.valueChanged(); }, theme: theme, componentRef: function (input) { return _this.refControl = input; } });
311
+ };
312
+ this.element = internalRender(control);
313
+ this.element.style.width = "100%";
314
+ return this.element;
315
+ };
316
+ FluentUINumberInput.prototype.getJsonTypeName = function () {
317
+ return "Input.Number";
318
+ };
319
+ FluentUINumberInput.prototype.focus = function () {
320
+ if (this.refControl)
321
+ this.refControl.focus();
322
+ };
323
+ FluentUINumberInput.prototype.updateInputControlAriaLabelledBy = function () {
324
+ if (this.element) {
325
+ var joinedLabelIds = this.getAllLabelIds().join(" ");
326
+ if (joinedLabelIds) {
327
+ this.element.setAttribute("aria-labelledby", joinedLabelIds);
328
+ }
329
+ else {
330
+ this.element.removeAttribute("aria-labelledby");
331
+ }
332
+ }
333
+ };
334
+ FluentUINumberInput.prototype.isSet = function () {
335
+ return this.value !== undefined && !isNaN(this.value);
336
+ };
337
+ FluentUINumberInput.prototype.isValid = function () {
338
+ if (!this.value) {
339
+ return !this.isRequired;
340
+ }
341
+ var result = true;
342
+ if (this.min !== undefined) {
343
+ result = result && this.value >= this.min;
344
+ }
345
+ if (this.max !== undefined) {
346
+ result = result && this.value <= this.max;
347
+ }
348
+ return result;
349
+ };
350
+ Object.defineProperty(FluentUINumberInput.prototype, "value", {
351
+ get: function () {
352
+ if (this.refControl) {
353
+ return Number(this.refControl.value);
354
+ }
355
+ else {
356
+ return undefined;
357
+ }
358
+ },
359
+ enumerable: false,
360
+ configurable: true
361
+ });
362
+ FluentUINumberInput.valueProperty = new NumProperty(Versions.v1_0, "value");
363
+ FluentUINumberInput.placeholderProperty = new StringProperty(Versions.v1_0, "placeholder");
364
+ FluentUINumberInput.minProperty = new NumProperty(Versions.v1_0, "min");
365
+ FluentUINumberInput.maxProperty = new NumProperty(Versions.v1_0, "max");
366
+ __decorate([
367
+ property(FluentUINumberInput.valueProperty)
368
+ ], FluentUINumberInput.prototype, "defaultValue", void 0);
369
+ __decorate([
370
+ property(FluentUINumberInput.minProperty)
371
+ ], FluentUINumberInput.prototype, "min", void 0);
372
+ __decorate([
373
+ property(FluentUINumberInput.maxProperty)
374
+ ], FluentUINumberInput.prototype, "max", void 0);
375
+ __decorate([
376
+ property(FluentUINumberInput.placeholderProperty)
377
+ ], FluentUINumberInput.prototype, "placeholder", void 0);
378
+ return FluentUINumberInput;
379
+ }(Input));
380
+ export { FluentUINumberInput };
381
+ var FluentUITextInput = /** @class */ (function (_super) {
382
+ __extends(FluentUITextInput, _super);
383
+ function FluentUITextInput() {
384
+ var _this = _super !== null && _super.apply(this, arguments) || this;
385
+ _this.isMultiline = false;
386
+ _this.style = InputTextStyle.Text;
387
+ _this.handleKeyDown = function (e) {
388
+ // Enter pressed
389
+ if (e.key === 'Enter' && _this.inlineAction) {
390
+ _this.inlineAction.execute();
391
+ }
392
+ };
393
+ _this.buildInlineActionButton = function () {
394
+ return internalRender((_this.inlineAction.iconUrl) ?
395
+ _this.inlineIconActionButton :
396
+ _this.buildTextOnlyInlineActionActionButton);
397
+ };
398
+ _this.inlineActionClickHandler = function (e) {
399
+ e.stopPropagation();
400
+ e.preventDefault();
401
+ _this.inlineAction.execute();
402
+ };
403
+ _this.inlineIconActionButton = function () {
404
+ var theme = _this.hostConfig.hostCapabilities.getCustomProperty(hostCapabilitiesFluentUIThemeKey);
405
+ return React.createElement(IconButton, { default: true, text: _this.inlineAction.title, ariaDescription: _this.inlineAction.title, className: _this.hostConfig.makeCssClassName("ac-inlineActionButton", "iconOnly"), theme: theme, styles: {
406
+ icon: {
407
+ height: "100%",
408
+ },
409
+ root: inlineButtonRootStyle,
410
+ }, iconProps: {
411
+ imageProps: {
412
+ height: "100%",
413
+ src: _this.inlineAction.iconUrl,
414
+ },
415
+ }, onClick: _this.inlineActionClickHandler });
416
+ };
417
+ _this.buildTextOnlyInlineActionActionButton = function () {
418
+ var theme = _this.hostConfig.hostCapabilities.getCustomProperty(hostCapabilitiesFluentUIThemeKey);
419
+ return React.createElement(DefaultButton, { className: _this.hostConfig.makeCssClassName("ac-inlineActionButton", "textOnly"), text: _this.inlineAction.title, ariaDescription: _this.inlineAction.title, onClick: _this.inlineActionClickHandler, styles: {
420
+ root: inlineButtonRootStyle,
421
+ }, theme: theme });
422
+ };
423
+ return _this;
424
+ }
425
+ FluentUITextInput.prototype.internalRender = function () {
426
+ var _this = this;
427
+ var theme = getFluentUIThemeFromHostCapability(this.hostConfig);
428
+ var control = function () {
429
+ return React.createElement(TextField, { id: _this.id, type: InputTextStyle[_this.style].toLowerCase(), defaultValue: _this.defaultValue, multiline: _this.isMultiline, maxLength: _this.maxLength, placeholder: _this.placeholder, pattern: _this.regex, onChange: function () { return _this.valueChanged(); }, onKeyDown: _this.handleKeyDown, theme: theme, componentRef: function (input) { return _this.refControl = input; } });
430
+ };
431
+ this.element = internalRender(control);
432
+ this.element.style.width = "100%";
433
+ return this.element;
434
+ };
435
+ FluentUITextInput.prototype.overrideInternalRender = function () {
436
+ var inputControl = _super.prototype.overrideInternalRender.call(this);
437
+ if (this.inlineAction) {
438
+ this.inputControlContainerElement.appendChild(this.buildInlineActionButton());
439
+ }
440
+ return inputControl;
441
+ };
442
+ FluentUITextInput.prototype.getJsonTypeName = function () {
443
+ return "Input.Text";
444
+ };
445
+ FluentUITextInput.prototype.focus = function () {
446
+ if (this.refControl)
447
+ this.refControl.focus();
448
+ };
449
+ FluentUITextInput.prototype.updateInputControlAriaLabelledBy = function () {
450
+ if (this.element) {
451
+ var joinedLabelIds = this.getAllLabelIds().join(" ");
452
+ if (joinedLabelIds) {
453
+ this.element.setAttribute("aria-labelledby", joinedLabelIds);
454
+ }
455
+ else {
456
+ this.element.removeAttribute("aria-labelledby");
457
+ }
458
+ }
459
+ };
460
+ FluentUITextInput.prototype.getActionById = function (id) {
461
+ var result = _super.prototype.getActionById.call(this, id);
462
+ if (!result && this.inlineAction) {
463
+ result = this.inlineAction.getActionById(id);
464
+ }
465
+ return result;
466
+ };
467
+ FluentUITextInput.prototype.isSet = function () {
468
+ return this.value ? true : false;
469
+ };
470
+ FluentUITextInput.prototype.isValid = function () {
471
+ if (!this.value) {
472
+ return !this.isRequired;
473
+ }
474
+ if (this.regex) {
475
+ return new RegExp(this.regex, "g").test(this.value);
476
+ }
477
+ return true;
478
+ };
479
+ Object.defineProperty(FluentUITextInput.prototype, "value", {
480
+ get: function () {
481
+ if (this.renderedInputControlElement) {
482
+ return this.refControl.value;
483
+ }
484
+ else {
485
+ return undefined;
486
+ }
487
+ },
488
+ enumerable: false,
489
+ configurable: true
490
+ });
491
+ FluentUITextInput.valueProperty = new StringProperty(Versions.v1_0, "value");
492
+ FluentUITextInput.maxLengthProperty = new NumProperty(Versions.v1_0, "maxLength");
493
+ FluentUITextInput.isMultilineProperty = new BoolProperty(Versions.v1_0, "isMultiline", false);
494
+ FluentUITextInput.placeholderProperty = new StringProperty(Versions.v1_0, "placeholder");
495
+ FluentUITextInput.styleProperty = new EnumProperty(Versions.v1_0, "style", InputTextStyle, InputTextStyle.Text);
496
+ FluentUITextInput.inlineActionProperty = new ActionProperty(Versions.v1_0, "inlineAction", ["Action.ShowCard"]);
497
+ FluentUITextInput.regexProperty = new StringProperty(Versions.v1_3, "regex", true);
498
+ __decorate([
499
+ property(FluentUITextInput.valueProperty)
500
+ ], FluentUITextInput.prototype, "defaultValue", void 0);
501
+ __decorate([
502
+ property(FluentUITextInput.maxLengthProperty)
503
+ ], FluentUITextInput.prototype, "maxLength", void 0);
504
+ __decorate([
505
+ property(FluentUITextInput.isMultilineProperty)
506
+ ], FluentUITextInput.prototype, "isMultiline", void 0);
507
+ __decorate([
508
+ property(FluentUITextInput.placeholderProperty)
509
+ ], FluentUITextInput.prototype, "placeholder", void 0);
510
+ __decorate([
511
+ property(FluentUITextInput.styleProperty)
512
+ ], FluentUITextInput.prototype, "style", void 0);
513
+ __decorate([
514
+ property(FluentUITextInput.inlineActionProperty)
515
+ ], FluentUITextInput.prototype, "inlineAction", void 0);
516
+ __decorate([
517
+ property(FluentUITextInput.regexProperty)
518
+ ], FluentUITextInput.prototype, "regex", void 0);
519
+ return FluentUITextInput;
520
+ }(Input));
521
+ export { FluentUITextInput };
522
+ var FluentUITimeInput = /** @class */ (function (_super) {
523
+ __extends(FluentUITimeInput, _super);
524
+ function FluentUITimeInput() {
525
+ return _super !== null && _super.apply(this, arguments) || this;
526
+ }
527
+ FluentUITimeInput.convertTimeStringToDate = function (timeString) {
528
+ return new Date("1973-09-04T" + timeString + ":00Z");
529
+ };
530
+ FluentUITimeInput.prototype.internalRender = function () {
531
+ var _this = this;
532
+ var theme = getFluentUIThemeFromHostCapability(this.hostConfig);
533
+ var control = function () {
534
+ return React.createElement(TextField, { id: _this.id, type: "time", defaultValue: _this.defaultValue, min: _this.min, max: _this.max, placeholder: _this.placeholder, onChange: function () { return _this.valueChanged(); }, theme: theme, componentRef: function (input) { return _this.refControl = input; } });
535
+ };
536
+ this.element = internalRender(control);
537
+ this.element.style.width = "100%";
538
+ return this.element;
539
+ };
540
+ FluentUITimeInput.prototype.getJsonTypeName = function () {
541
+ return "Input.Time";
542
+ };
543
+ FluentUITimeInput.prototype.focus = function () {
544
+ if (this.refControl)
545
+ this.refControl.focus();
546
+ };
547
+ FluentUITimeInput.prototype.updateInputControlAriaLabelledBy = function () {
548
+ if (this.element) {
549
+ var joinedLabelIds = this.getAllLabelIds().join(" ");
550
+ if (joinedLabelIds) {
551
+ this.element.setAttribute("aria-labelledby", joinedLabelIds);
552
+ }
553
+ else {
554
+ this.element.removeAttribute("aria-labelledby");
555
+ }
556
+ }
557
+ };
558
+ FluentUITimeInput.prototype.isSet = function () {
559
+ return this.value ? true : false;
560
+ };
561
+ FluentUITimeInput.prototype.isValid = function () {
562
+ if (!this.value) {
563
+ return !this.isRequired;
564
+ }
565
+ var valueAsDate = FluentUITimeInput.convertTimeStringToDate(this.value);
566
+ var result = true;
567
+ if (this.min) {
568
+ var minDate = FluentUITimeInput.convertTimeStringToDate(this.min);
569
+ result = result && valueAsDate >= minDate;
570
+ }
571
+ if (this.max) {
572
+ var maxDate = FluentUITimeInput.convertTimeStringToDate(this.max);
573
+ result = result && valueAsDate <= maxDate;
574
+ }
575
+ return result;
576
+ };
577
+ Object.defineProperty(FluentUITimeInput.prototype, "value", {
578
+ get: function () {
579
+ if (this.renderedInputControlElement) {
580
+ return this.refControl.value;
581
+ }
582
+ else {
583
+ return undefined;
584
+ }
585
+ },
586
+ enumerable: false,
587
+ configurable: true
588
+ });
589
+ FluentUITimeInput.valueProperty = new TimeProperty(Versions.v1_0, "value");
590
+ FluentUITimeInput.placeholderProperty = new StringProperty(Versions.v1_0, "placeholder");
591
+ FluentUITimeInput.minProperty = new TimeProperty(Versions.v1_0, "min");
592
+ FluentUITimeInput.maxProperty = new TimeProperty(Versions.v1_0, "max");
593
+ __decorate([
594
+ property(FluentUITimeInput.valueProperty)
595
+ ], FluentUITimeInput.prototype, "defaultValue", void 0);
596
+ __decorate([
597
+ property(FluentUITimeInput.minProperty)
598
+ ], FluentUITimeInput.prototype, "min", void 0);
599
+ __decorate([
600
+ property(FluentUITimeInput.maxProperty)
601
+ ], FluentUITimeInput.prototype, "max", void 0);
602
+ __decorate([
603
+ property(FluentUITimeInput.placeholderProperty)
604
+ ], FluentUITimeInput.prototype, "placeholder", void 0);
605
+ return FluentUITimeInput;
606
+ }(Input));
607
+ export { FluentUITimeInput };
608
+ var FluentUIToggleInput = /** @class */ (function (_super) {
609
+ __extends(FluentUIToggleInput, _super);
610
+ function FluentUIToggleInput() {
611
+ var _this = _super !== null && _super.apply(this, arguments) || this;
612
+ _this.valueOn = "true";
613
+ _this.valueOff = "false";
614
+ _this.wrap = false;
615
+ return _this;
616
+ }
617
+ FluentUIToggleInput.prototype.internalRender = function () {
618
+ var _this = this;
619
+ var theme = getFluentUIThemeFromHostCapability(this.hostConfig);
620
+ var control = function () {
621
+ return React.createElement(ThemeProvider, { theme: theme, style: { backgroundColor: "transparent" } },
622
+ React.createElement(Toggle, { id: _this.id, inlineLabel: true, onText: _this.title, offText: _this.title, onChange: function (event, checked) {
623
+ _this._value = checked;
624
+ _this.valueChanged();
625
+ }, defaultChecked: _this.defaultValue === _this.valueOn, styles: { root: { marginBottom: 0, marginTop: 0 } }, componentRef: function (input) { return _this.refControl = input; } }));
626
+ };
627
+ this.element = internalRender(control);
628
+ this.element.style.width = "100%";
629
+ return this.element;
630
+ };
631
+ Object.defineProperty(FluentUIToggleInput.prototype, "isNullable", {
632
+ get: function () {
633
+ return false;
634
+ },
635
+ enumerable: false,
636
+ configurable: true
637
+ });
638
+ FluentUIToggleInput.prototype.getJsonTypeName = function () {
639
+ return "Input.Toggle";
640
+ };
641
+ FluentUIToggleInput.prototype.focus = function () {
642
+ if (this.refControl)
643
+ this.refControl.focus();
644
+ };
645
+ FluentUIToggleInput.prototype.updateInputControlAriaLabelledBy = function () {
646
+ if (this.element) {
647
+ var joinedLabelIds = this.getAllLabelIds().join(" ");
648
+ if (joinedLabelIds) {
649
+ this.element.setAttribute("aria-labelledby", joinedLabelIds);
650
+ }
651
+ else {
652
+ this.element.removeAttribute("aria-labelledby");
653
+ }
654
+ }
655
+ };
656
+ FluentUIToggleInput.prototype.isSet = function () {
657
+ if (this.isRequired) {
658
+ return this.value === this.valueOn;
659
+ }
660
+ return this.value ? true : false;
661
+ };
662
+ Object.defineProperty(FluentUIToggleInput.prototype, "value", {
663
+ get: function () {
664
+ if (this._value != null && this._value != undefined) {
665
+ return this._value ? this.valueOn : this.valueOff;
666
+ }
667
+ else {
668
+ if (this.isRequired) {
669
+ return undefined;
670
+ }
671
+ else {
672
+ return this.valueOff;
673
+ }
674
+ }
675
+ },
676
+ enumerable: false,
677
+ configurable: true
678
+ });
679
+ FluentUIToggleInput.valueProperty = new StringProperty(Versions.v1_0, "value");
680
+ FluentUIToggleInput.titleProperty = new StringProperty(Versions.v1_0, "title");
681
+ FluentUIToggleInput.valueOnProperty = new StringProperty(Versions.v1_0, "valueOn", true, undefined, "true", function (_sender) {
682
+ return "true";
683
+ });
684
+ FluentUIToggleInput.valueOffProperty = new StringProperty(Versions.v1_0, "valueOff", true, undefined, "false", function (_sender) {
685
+ return "false";
686
+ });
687
+ FluentUIToggleInput.wrapProperty = new BoolProperty(Versions.v1_2, "wrap", false);
688
+ __decorate([
689
+ property(FluentUIToggleInput.valueProperty)
690
+ ], FluentUIToggleInput.prototype, "defaultValue", void 0);
691
+ __decorate([
692
+ property(FluentUIToggleInput.titleProperty)
693
+ ], FluentUIToggleInput.prototype, "title", void 0);
694
+ __decorate([
695
+ property(FluentUIToggleInput.valueOnProperty)
696
+ ], FluentUIToggleInput.prototype, "valueOn", void 0);
697
+ __decorate([
698
+ property(FluentUIToggleInput.valueOffProperty)
699
+ ], FluentUIToggleInput.prototype, "valueOff", void 0);
700
+ __decorate([
701
+ property(FluentUIToggleInput.wrapProperty)
702
+ ], FluentUIToggleInput.prototype, "wrap", void 0);
703
+ return FluentUIToggleInput;
704
+ }(Input));
705
+ export { FluentUIToggleInput };
706
+ //# sourceMappingURL=Elements.js.map