superdesk-ui-framework 3.0.2 → 3.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.
- package/app/styles/app.scss +2 -1
- package/app/styles/editor/_editor-themes.scss +6 -1
- package/app/styles/form-elements/_inputs.scss +8 -8
- package/app/styles/layout/_editor.scss +5 -2
- package/app/styles/primereact/_pr-tag-input.scss +61 -0
- package/app-typescript/components/Layouts/AuthoringInnerBody.tsx +8 -1
- package/app-typescript/components/Layouts/AuthoringMain.tsx +2 -1
- package/app-typescript/components/MultiSelect.tsx +2 -0
- package/app-typescript/components/Navigation/SideBarTabs.tsx +34 -36
- package/app-typescript/components/TagInput.tsx +49 -233
- package/app-typescript/index.ts +1 -2
- package/dist/examples.bundle.js +2388 -2099
- package/dist/playgrounds/react-playgrounds/EditorTest.tsx +21 -18
- package/dist/playgrounds/react-playgrounds/Multiedit.tsx +29 -21
- package/dist/react/Index.tsx +3 -3
- package/dist/react/MultiSelect.tsx +4 -3
- package/dist/react/TagInputDocs.tsx +82 -0
- package/dist/superdesk-ui.bundle.css +73 -2
- package/dist/superdesk-ui.bundle.js +2049 -1737
- package/dist/vendor.bundle.js +20 -20
- package/examples/pages/playgrounds/react-playgrounds/EditorTest.tsx +21 -18
- package/examples/pages/playgrounds/react-playgrounds/Multiedit.tsx +29 -21
- package/examples/pages/react/Index.tsx +3 -3
- package/examples/pages/react/MultiSelect.tsx +4 -3
- package/examples/pages/react/TagInputDocs.tsx +82 -0
- package/package.json +2 -2
- package/react/components/Layouts/AuthoringInnerBody.d.ts +1 -0
- package/react/components/Layouts/AuthoringInnerBody.js +5 -1
- package/react/components/Layouts/AuthoringMain.d.ts +1 -0
- package/react/components/Layouts/AuthoringMain.js +1 -1
- package/react/components/MultiSelect.d.ts +1 -0
- package/react/components/MultiSelect.js +1 -1
- package/react/components/Navigation/SideBarTabs.d.ts +7 -8
- package/react/components/Navigation/SideBarTabs.js +21 -22
- package/react/components/TagInput.d.ts +19 -5
- package/react/components/TagInput.js +32 -173
- package/react/index.d.ts +1 -2
- package/react/index.js +3 -6
- package/app-typescript/components/TagInputTest.tsx +0 -76
- package/dist/react/TagInputs.tsx +0 -92
- package/examples/pages/react/TagInputs.tsx +0 -92
- package/react/components/TagInputTest.d.ts +0 -18
- package/react/components/TagInputTest.js +0 -91
@@ -33,34 +33,37 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
33
33
|
__setModuleDefault(result, mod);
|
34
34
|
return result;
|
35
35
|
};
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
38
|
+
};
|
36
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
37
40
|
exports.SideBarTabs = void 0;
|
38
41
|
var React = __importStar(require("react"));
|
39
42
|
var Icon_1 = require("../Icon");
|
40
43
|
var Badge_1 = require("../Badge");
|
44
|
+
var classnames_1 = __importDefault(require("classnames"));
|
41
45
|
var SideBarTabs = /** @class */ (function (_super) {
|
42
46
|
__extends(SideBarTabs, _super);
|
43
47
|
function SideBarTabs(props) {
|
44
48
|
var _this = _super.call(this, props) || this;
|
45
|
-
_this.state = {
|
46
|
-
index: -1,
|
47
|
-
closeIndex: -1,
|
48
|
-
};
|
49
49
|
_this.handleClick = _this.handleClick.bind(_this);
|
50
50
|
return _this;
|
51
51
|
}
|
52
|
-
SideBarTabs.prototype.
|
53
|
-
this
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
52
|
+
SideBarTabs.prototype.componentDidMount = function () {
|
53
|
+
var _this = this;
|
54
|
+
var activeItem = this.props.items.find(function (item) { return item !== 'divider' && item.id === _this.props.activeTab; });
|
55
|
+
if (activeItem != null && activeItem !== 'divider') {
|
56
|
+
this.props.onActiveTabChange(activeItem.id);
|
57
|
+
}
|
58
|
+
};
|
59
|
+
SideBarTabs.prototype.handleClick = function (item, event) {
|
60
|
+
if (this.props.activeTab === item.id) {
|
61
|
+
this.props.onActiveTabChange(null);
|
62
|
+
}
|
63
|
+
else {
|
64
|
+
this.props.onActiveTabChange(item.id);
|
65
|
+
item.onClick(event);
|
61
66
|
}
|
62
|
-
item.active = !item.active;
|
63
|
-
item.onClick(event);
|
64
67
|
};
|
65
68
|
SideBarTabs.prototype.render = function () {
|
66
69
|
var _this = this;
|
@@ -70,13 +73,9 @@ var SideBarTabs = /** @class */ (function (_super) {
|
|
70
73
|
return (React.createElement("li", { key: index, className: 'sd-sidetab-menu__spacer' }));
|
71
74
|
}
|
72
75
|
else {
|
73
|
-
return (React.createElement("li", { key: index, "data-sd-tooltip": item
|
74
|
-
React.createElement("a", { role: 'button', "aria-label": item
|
75
|
-
|
76
|
-
(index === _this.state.index ? ' sd-sidetab-menu__btn--active' : '')), onClick: function () { return _this.handleClick(item, index, event); } },
|
77
|
-
item['badgeValue'] != null
|
78
|
-
? (React.createElement(Badge_1.Badge, { text: item['badgeValue'], type: 'primary' }))
|
79
|
-
: null,
|
76
|
+
return (React.createElement("li", { key: index, "data-sd-tooltip": item.tooltip, "data-flow": 'left' },
|
77
|
+
React.createElement("a", { role: 'button', "aria-label": item.tooltip, className: (0, classnames_1.default)('sd-sidetab-menu__btn', { 'sd-sidetab-menu__btn--active': item.id === _this.props.activeTab }), onClick: function (event) { return _this.handleClick(item, event); } },
|
78
|
+
item.badgeValue != null && (React.createElement(Badge_1.Badge, { text: item['badgeValue'], type: 'primary' })),
|
80
79
|
React.createElement("span", { className: 'sd-sidetab-menu__main-icon ' },
|
81
80
|
React.createElement(Icon_1.Icon, { size: item['size'], name: item['icon'] })),
|
82
81
|
React.createElement("i", { className: 'sd-sidetab-menu__helper-icon icon-close-small' }))));
|
@@ -1,7 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
import * as React from 'react';
|
2
|
+
interface IProps {
|
3
|
+
value: Array<string>;
|
4
|
+
onChange(value: Array<string>): void;
|
5
|
+
placeholder: string;
|
6
|
+
invalid?: boolean;
|
7
|
+
inlineLabel?: boolean;
|
8
|
+
labelHidden?: boolean;
|
9
|
+
tabindex?: number;
|
10
|
+
fullWidth?: boolean;
|
11
|
+
info?: string;
|
12
|
+
error?: string;
|
13
|
+
required?: boolean;
|
14
|
+
label?: string;
|
15
|
+
disabled?: boolean;
|
16
|
+
}
|
17
|
+
export declare class TagInput extends React.Component<IProps> {
|
18
|
+
private htmlId;
|
19
|
+
render(): JSX.Element;
|
5
20
|
}
|
6
|
-
export declare const TagInput: ({ items, label, freetype }: ITagInput) => JSX.Element;
|
7
21
|
export {};
|
@@ -1,4 +1,19 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
3
|
+
var extendStatics = function (d, b) {
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
+
return extendStatics(d, b);
|
8
|
+
};
|
9
|
+
return function (d, b) {
|
10
|
+
if (typeof b !== "function" && b !== null)
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
+
extendStatics(d, b);
|
13
|
+
function __() { this.constructor = d; }
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
+
};
|
16
|
+
})();
|
2
17
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
18
|
if (k2 === undefined) k2 = k;
|
4
19
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
@@ -24,177 +39,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
24
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
25
40
|
exports.TagInput = void 0;
|
26
41
|
var React = __importStar(require("react"));
|
27
|
-
var
|
28
|
-
var
|
29
|
-
var
|
30
|
-
var TagInput = function (
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
var _g = React.useState(false), invalid = _g[0], setInvalid = _g[1];
|
45
|
-
React.useEffect(function () {
|
46
|
-
var menuRef = refSuggestions.current;
|
47
|
-
var toggleRef = refTagInput.current;
|
48
|
-
if (toggleRef && menuRef) {
|
49
|
-
(0, core_1.createPopper)(toggleRef, menuRef, {
|
50
|
-
placement: 'bottom-start',
|
51
|
-
});
|
52
|
-
}
|
53
|
-
}, [suggestions]);
|
54
|
-
function inputKeyDown(e) {
|
55
|
-
var val = e.target.value;
|
56
|
-
if (val.length > 1) {
|
57
|
-
setInvalid(false);
|
58
|
-
}
|
59
|
-
if (e.key === 'Enter' && val) {
|
60
|
-
if (val.length > 2 && freetype) {
|
61
|
-
setInvalid(false);
|
62
|
-
if (checkTag(val) === 0) {
|
63
|
-
setTags(function (tag) { return tag.concat(val); });
|
64
|
-
var inputRefVariable = inputRef.current;
|
65
|
-
if (inputRefVariable) {
|
66
|
-
inputRefVariable.value = null;
|
67
|
-
}
|
68
|
-
}
|
69
|
-
}
|
70
|
-
else {
|
71
|
-
setInvalid(true);
|
72
|
-
}
|
73
|
-
}
|
74
|
-
else if (e.key === 'Backspace' && !val) {
|
75
|
-
setSelectNumber(tags.length - 1);
|
76
|
-
if (selectNumber !== -1) {
|
77
|
-
removeTag(selectNumber);
|
78
|
-
setSelectNumber(-1);
|
79
|
-
}
|
80
|
-
}
|
81
|
-
else if (e.key === 'ArrowLeft' && !val) {
|
82
|
-
if (selectNumber > 0) {
|
83
|
-
setSelectNumber(selectNumber - 1);
|
84
|
-
}
|
85
|
-
else {
|
86
|
-
setSelectNumber(tags.length - 1);
|
87
|
-
}
|
88
|
-
}
|
89
|
-
else if (e.key === 'ArrowRight' && !val) {
|
90
|
-
if (selectNumber !== -1 && selectNumber < tags.length - 1) {
|
91
|
-
setSelectNumber(selectNumber + 1);
|
92
|
-
}
|
93
|
-
else {
|
94
|
-
setSelectNumber(0);
|
95
|
-
}
|
96
|
-
}
|
97
|
-
}
|
98
|
-
function checkTag(newTag) {
|
99
|
-
var count = 0;
|
100
|
-
tags.forEach(function (tag) {
|
101
|
-
if (tag === newTag) {
|
102
|
-
count = 1;
|
103
|
-
}
|
104
|
-
});
|
105
|
-
return count;
|
106
|
-
}
|
107
|
-
function removeTag(i) {
|
108
|
-
var newTags = (0, lodash_1.clone)(tags);
|
109
|
-
newTags.splice(i, 1);
|
110
|
-
setTags(newTags);
|
111
|
-
}
|
112
|
-
function onTextChanged(e) {
|
113
|
-
if (items) {
|
114
|
-
var value = e.target.value;
|
115
|
-
var newSuggestions = [];
|
116
|
-
if (value.length > 1) {
|
117
|
-
var regex_1 = new RegExp("^".concat(value), 'i');
|
118
|
-
newSuggestions = items.sort().filter(function (v) { return regex_1.test(v); });
|
119
|
-
}
|
120
|
-
setSuggestions(newSuggestions);
|
121
|
-
}
|
122
|
-
}
|
123
|
-
function addTag(item) {
|
124
|
-
if (checkTag(item) === 0) {
|
125
|
-
setTags(function (tag) { return tag.concat(item); });
|
126
|
-
var inputRefVariable = inputRef.current;
|
127
|
-
if (inputRefVariable) {
|
128
|
-
inputRefVariable.value = null;
|
129
|
-
}
|
130
|
-
}
|
131
|
-
setSuggestions([]);
|
132
|
-
}
|
133
|
-
function toggleSuggestions() {
|
134
|
-
if (!openSuggestion) {
|
135
|
-
setOpenSuggestion(true);
|
136
|
-
document.addEventListener('click', closeSuggestions);
|
137
|
-
}
|
138
|
-
else {
|
139
|
-
setOpenSuggestion(false);
|
140
|
-
}
|
141
|
-
}
|
142
|
-
function closeSuggestions() {
|
143
|
-
document.removeEventListener('click', closeSuggestions);
|
144
|
-
setOpenSuggestion(false);
|
145
|
-
}
|
146
|
-
function toggleFocus() {
|
147
|
-
if (!focus) {
|
148
|
-
setFocus(true);
|
149
|
-
document.addEventListener('click', removeFocus);
|
150
|
-
}
|
151
|
-
else {
|
152
|
-
setFocus(false);
|
153
|
-
}
|
154
|
-
}
|
155
|
-
function removeFocus() {
|
156
|
-
document.removeEventListener('click', removeFocus);
|
157
|
-
setFocus(false);
|
158
|
-
}
|
159
|
-
function renderSuggestions() {
|
160
|
-
if (openSuggestion) {
|
161
|
-
return (React.createElement("div", { className: 'autocomplete', ref: refSuggestions },
|
162
|
-
React.createElement("ul", { className: 'suggestion-list' }, suggestions.length !== 0 ? (suggestions.map(function (item, index) {
|
163
|
-
return React.createElement("li", { className: 'suggestion-item', onClick: function () { return addTag(item); }, key: index }, item);
|
164
|
-
})) : (items === null || items === void 0 ? void 0 : items.map(function (item, index) {
|
165
|
-
return React.createElement("li", { className: 'suggestion-item', onClick: function () { return addTag(item); }, key: index }, item);
|
166
|
-
})))));
|
167
|
-
}
|
168
|
-
else if (suggestions.length === 0) {
|
169
|
-
return null;
|
170
|
-
}
|
171
|
-
else {
|
172
|
-
return (React.createElement("div", { className: 'autocomplete', ref: refSuggestions },
|
173
|
-
React.createElement("ul", { className: 'suggestion-list' }, suggestions.map(function (item, index) {
|
174
|
-
return React.createElement("li", { className: 'suggestion-item', onClick: function () { return addTag(item); }, key: index }, item);
|
175
|
-
}))));
|
176
|
-
}
|
177
|
-
}
|
178
|
-
var classes = (0, classnames_1.default)('tags-input__tags', {
|
179
|
-
'focused': focus,
|
180
|
-
'tag-input__invalid-tag': invalid,
|
181
|
-
});
|
182
|
-
return (React.createElement("div", { className: 'sd-tag-input', "data-label": label },
|
183
|
-
React.createElement("label", { className: 'tags-input__label' }, label),
|
184
|
-
React.createElement("div", { className: 'tags-input', ref: refTagInput },
|
185
|
-
React.createElement("div", { className: classes },
|
186
|
-
items ?
|
187
|
-
React.createElement("button", { className: "tags-input__add-button", onClick: toggleSuggestions },
|
188
|
-
React.createElement("i", { className: "icon-plus-large" })) : null,
|
189
|
-
React.createElement("ul", { className: 'tags-input__tag-list' },
|
190
|
-
tags.map(function (tag, i) {
|
191
|
-
return (React.createElement("li", { className: 'tags-input__tag-item' + (selectNumber === i ? ' selected' : ''), key: i },
|
192
|
-
tag,
|
193
|
-
React.createElement("a", { type: 'button', className: 'tags-input__remove-button', onClick: function () { return removeTag(i); } },
|
194
|
-
React.createElement("i", { className: 'icon-close-small' }))));
|
195
|
-
}),
|
196
|
-
React.createElement("li", { className: 'input-tag__tags__input' },
|
197
|
-
React.createElement("input", { type: 'text', className: 'tags-input__input' + (invalid ? ' invalid-tag' : ''), onChange: onTextChanged, ref: inputRef, onKeyDown: inputKeyDown, onClick: toggleFocus })))),
|
198
|
-
items ? renderSuggestions() : null)));
|
199
|
-
};
|
42
|
+
var chips_1 = require("@superdesk/primereact/chips");
|
43
|
+
var Form_1 = require("./Form");
|
44
|
+
var react_id_generator_1 = __importDefault(require("react-id-generator"));
|
45
|
+
var TagInput = /** @class */ (function (_super) {
|
46
|
+
__extends(TagInput, _super);
|
47
|
+
function TagInput() {
|
48
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
49
|
+
_this.htmlId = (0, react_id_generator_1.default)();
|
50
|
+
return _this;
|
51
|
+
}
|
52
|
+
TagInput.prototype.render = function () {
|
53
|
+
var _a = this.props, onChange = _a.onChange, value = _a.value, placeholder = _a.placeholder;
|
54
|
+
return (React.createElement(Form_1.InputWrapper, { label: this.props.label, error: this.props.error, required: this.props.required, disabled: this.props.disabled, invalid: this.props.invalid, info: this.props.info, inlineLabel: this.props.inlineLabel, labelHidden: this.props.labelHidden, fullWidth: this.props.fullWidth, htmlId: this.htmlId, tabindex: this.props.tabindex },
|
55
|
+
React.createElement(chips_1.Chips, { className: "tags-input--multi-select sd-input__input ".concat(this.props.disabled ? ' tags-input__padding-disabled' : ''), allowDuplicate: false, separator: ",", onChange: function (event) { return onChange(event.value); }, value: value, placeholder: placeholder, disabled: this.props.disabled })));
|
56
|
+
};
|
57
|
+
return TagInput;
|
58
|
+
}(React.Component));
|
200
59
|
exports.TagInput = TagInput;
|
package/react/index.d.ts
CHANGED
@@ -48,14 +48,13 @@ export { DropdownLabel } from './components/DropdownFirst';
|
|
48
48
|
export { DropdownDivider } from './components/DropdownFirst';
|
49
49
|
export { Dropdown } from './components/Dropdown';
|
50
50
|
export { Tag } from './components/Tag';
|
51
|
+
export { TagInput } from './components/TagInput';
|
51
52
|
export { TabLabel, TabPanel, TabContent, Tabs } from './components/TabCustom';
|
52
53
|
export { EmptyState } from './components/EmptyState';
|
53
54
|
export { Autocomplete } from './components/Autocomplete';
|
54
55
|
export { DonutChart } from './components/DonutChart';
|
55
56
|
export { Carousel } from './components/Carousel';
|
56
57
|
export { Modal } from './components/Modal';
|
57
|
-
export { TagInput } from './components/TagInput';
|
58
|
-
export { TagInputTest } from './components/TagInputTest';
|
59
58
|
export { GridList } from './components/GridList';
|
60
59
|
export { GridItem, GridItemContent, GridItemMedia, GridItemFooter, GridItemContentBlock, GridItemTime, GridItemTitle, GridItemText, GridItemSlug, GridItemFooterBlock, GridItemFooterActions, GridItemTopActions, GridItemCheckWrapper } from './components/GridItem';
|
61
60
|
export { toasted } from './components/Toast';
|
package/react/index.js
CHANGED
@@ -13,8 +13,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
13
13
|
};
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
exports.DropdownLabel = exports.DropdownItem = exports.DropdownFirst = exports.HeadingText = exports.ContentDivider = exports.Divider = exports.Icon = exports.Prop = exports.PropsList = exports.StrechBar = exports.SlidingToolbar = exports.SubNavDivider = exports.SubNav = exports.LeftMenu = exports.TabList = exports.Tab = exports.NavButton = exports.CheckButtonGroup = exports.CheckGroup = exports.CheckboxButton = exports.RadioButtonGroup = exports.Checkbox = exports.RadioGroup = exports.Loader = exports.ButtonGroup = exports.SwitchGroup = exports.Switch = exports.FormLabel = exports.TimePicker = exports.DatePickerISO = exports.DatePicker = exports.getDurationString = exports.DurationInput = exports.Tooltip = exports.IconLabel = exports.IconButton = exports.AvatarGroup = exports.AvatarContentImage = exports.AvatarContentText = exports.AvatarWrapper = exports.Alert = exports.Badge = exports.Label = exports.Popover = exports.SelectWithTemplate = exports.Option = exports.Select = exports.Input = exports.Button = exports.HelloWorld = void 0;
|
16
|
-
exports.ContentListItem = exports.TableListItem = exports.TableList = exports.TreeSelect = exports.BottomNav = exports.Heading = exports.Time = exports.Text = exports.LoadingOverlay = exports.Spinner = exports.ListItemLoader = exports.Skeleton = exports.WithSizeObserver = exports.SearchBar = exports.CreateButton = exports.DropZone = exports.ThemeSelector = exports.IconPicker = exports.SelectGrid = exports.ToggleBox = exports.Menu = exports.toasted = exports.GridItemCheckWrapper = exports.GridItemTopActions = exports.GridItemFooterActions = exports.GridItemFooterBlock = exports.GridItemSlug = exports.GridItemText = exports.GridItemTitle = exports.GridItemTime = exports.GridItemContentBlock = exports.GridItemFooter = exports.GridItemMedia = exports.GridItemContent = exports.GridItem = exports.GridList = exports.
|
17
|
-
exports.MultiSelect = void 0;
|
16
|
+
exports.MultiSelect = exports.ContentListItem = exports.TableListItem = exports.TableList = exports.TreeSelect = exports.BottomNav = exports.Heading = exports.Time = exports.Text = exports.LoadingOverlay = exports.Spinner = exports.ListItemLoader = exports.Skeleton = exports.WithSizeObserver = exports.SearchBar = exports.CreateButton = exports.DropZone = exports.ThemeSelector = exports.IconPicker = exports.SelectGrid = exports.ToggleBox = exports.Menu = exports.toasted = exports.GridItemCheckWrapper = exports.GridItemTopActions = exports.GridItemFooterActions = exports.GridItemFooterBlock = exports.GridItemSlug = exports.GridItemText = exports.GridItemTitle = exports.GridItemTime = exports.GridItemContentBlock = exports.GridItemFooter = exports.GridItemMedia = exports.GridItemContent = exports.GridItem = exports.GridList = exports.Modal = exports.Carousel = exports.DonutChart = exports.Autocomplete = exports.EmptyState = exports.Tabs = exports.TabContent = exports.TabPanel = exports.TabLabel = exports.TagInput = exports.Tag = exports.Dropdown = exports.DropdownDivider = void 0;
|
18
17
|
var HelloWorld_1 = require("./components/HelloWorld");
|
19
18
|
Object.defineProperty(exports, "HelloWorld", { enumerable: true, get: function () { return HelloWorld_1.HelloWorld; } });
|
20
19
|
var Button_1 = require("./components/Button");
|
@@ -117,6 +116,8 @@ var Dropdown_1 = require("./components/Dropdown");
|
|
117
116
|
Object.defineProperty(exports, "Dropdown", { enumerable: true, get: function () { return Dropdown_1.Dropdown; } });
|
118
117
|
var Tag_1 = require("./components/Tag");
|
119
118
|
Object.defineProperty(exports, "Tag", { enumerable: true, get: function () { return Tag_1.Tag; } });
|
119
|
+
var TagInput_1 = require("./components/TagInput");
|
120
|
+
Object.defineProperty(exports, "TagInput", { enumerable: true, get: function () { return TagInput_1.TagInput; } });
|
120
121
|
var TabCustom_1 = require("./components/TabCustom");
|
121
122
|
Object.defineProperty(exports, "TabLabel", { enumerable: true, get: function () { return TabCustom_1.TabLabel; } });
|
122
123
|
Object.defineProperty(exports, "TabPanel", { enumerable: true, get: function () { return TabCustom_1.TabPanel; } });
|
@@ -132,10 +133,6 @@ var Carousel_1 = require("./components/Carousel");
|
|
132
133
|
Object.defineProperty(exports, "Carousel", { enumerable: true, get: function () { return Carousel_1.Carousel; } });
|
133
134
|
var Modal_1 = require("./components/Modal");
|
134
135
|
Object.defineProperty(exports, "Modal", { enumerable: true, get: function () { return Modal_1.Modal; } });
|
135
|
-
var TagInput_1 = require("./components/TagInput");
|
136
|
-
Object.defineProperty(exports, "TagInput", { enumerable: true, get: function () { return TagInput_1.TagInput; } });
|
137
|
-
var TagInputTest_1 = require("./components/TagInputTest");
|
138
|
-
Object.defineProperty(exports, "TagInputTest", { enumerable: true, get: function () { return TagInputTest_1.TagInputTest; } });
|
139
136
|
var GridList_1 = require("./components/GridList");
|
140
137
|
Object.defineProperty(exports, "GridList", { enumerable: true, get: function () { return GridList_1.GridList; } });
|
141
138
|
var GridItem_1 = require("./components/GridItem");
|
@@ -1,76 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import { AutoComplete } from '@superdesk/primereact/autocomplete';
|
3
|
-
|
4
|
-
// work in progress used Autocomplete from primereact miss:
|
5
|
-
// 1. style for component
|
6
|
-
// 2. category select
|
7
|
-
// 3. freetype text
|
8
|
-
|
9
|
-
interface IProps {
|
10
|
-
items: Array<any>;
|
11
|
-
keyValue: string; // Field of a suggested object to resolve and display
|
12
|
-
minLength?: number;
|
13
|
-
}
|
14
|
-
|
15
|
-
interface IState {
|
16
|
-
selectedItem: any;
|
17
|
-
filteredItems: any;
|
18
|
-
}
|
19
|
-
|
20
|
-
export class TagInputTest extends React.Component<IProps, IState> {
|
21
|
-
constructor(props: IProps) {
|
22
|
-
super(props);
|
23
|
-
this.state = {
|
24
|
-
selectedItem: null,
|
25
|
-
filteredItems: null,
|
26
|
-
};
|
27
|
-
|
28
|
-
this.searchItem = this.searchItem.bind(this);
|
29
|
-
this.itemTemplate = this.itemTemplate.bind(this);
|
30
|
-
this.handleItem = this.handleItem.bind(this);
|
31
|
-
}
|
32
|
-
|
33
|
-
searchItem(event: any) {
|
34
|
-
setTimeout(() => {
|
35
|
-
let filteredItems;
|
36
|
-
if (!event.query.trim().length) {
|
37
|
-
filteredItems = [...this.props.items];
|
38
|
-
} else {
|
39
|
-
filteredItems = this.props.items.filter((item) => {
|
40
|
-
return item[this.props.keyValue].toLowerCase().startsWith(event.query.toLowerCase());
|
41
|
-
});
|
42
|
-
}
|
43
|
-
|
44
|
-
this.setState({ filteredItems });
|
45
|
-
}, 250);
|
46
|
-
}
|
47
|
-
|
48
|
-
itemTemplate(item: any) {
|
49
|
-
return (
|
50
|
-
<div>
|
51
|
-
<div>{item[this.props.keyValue]}</div>
|
52
|
-
</div>
|
53
|
-
);
|
54
|
-
}
|
55
|
-
|
56
|
-
handleItem(e: any) {
|
57
|
-
this.setState({ selectedItem: e.value });
|
58
|
-
}
|
59
|
-
|
60
|
-
render() {
|
61
|
-
return (
|
62
|
-
<div>
|
63
|
-
<AutoComplete
|
64
|
-
value={this.state.selectedItem}
|
65
|
-
suggestions={this.state.filteredItems}
|
66
|
-
completeMethod={this.searchItem}
|
67
|
-
field={this.props.keyValue}
|
68
|
-
multiple
|
69
|
-
dropdown={true}
|
70
|
-
minLength={this.props.minLength ? this.props.minLength : 1}
|
71
|
-
onChange={(e) => this.handleItem(e)} />
|
72
|
-
|
73
|
-
</div>
|
74
|
-
);
|
75
|
-
}
|
76
|
-
}
|
package/dist/react/TagInputs.tsx
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import * as Markup from '../../js/react';
|
3
|
-
import { TagInput, TagInputTest } from '../../../app-typescript';
|
4
|
-
|
5
|
-
export default class TagInputDoc extends React.Component {
|
6
|
-
render() {
|
7
|
-
return (
|
8
|
-
<React.Fragment>
|
9
|
-
<section className="docs-page__container">
|
10
|
-
<h2 className="docs-page__h2">Tag Input IN PROGRESS</h2>
|
11
|
-
<p className="docs-page__paragraph">
|
12
|
-
A tag input is an input box that automatically creates tags – also called tokens – out of typed text every time a certain key is pressed. It's useful for tagging and highlighting information right on the input box.
|
13
|
-
</p>
|
14
|
-
<Markup.ReactMarkupCodePreview>{`
|
15
|
-
|
16
|
-
`}
|
17
|
-
</Markup.ReactMarkupCodePreview>
|
18
|
-
<p className='docs-page__paragraph'>PRIME REACT TEST</p>
|
19
|
-
<Markup.ReactMarkup>
|
20
|
-
<Markup.ReactMarkupPreview>
|
21
|
-
<p className="docs-page__paragraph">Test Tag Input</p>
|
22
|
-
<div className='form__row'>
|
23
|
-
<TagInputTest
|
24
|
-
items={[
|
25
|
-
{ name: 'Afghanistan', code: 'AF' },
|
26
|
-
{ name: 'Åland Islands', code: 'AX' },
|
27
|
-
{ name: 'Albania', code: 'AL' },
|
28
|
-
{ name: 'Algeria', code: 'DZ' },
|
29
|
-
{ name: 'American Samoa', code: 'AS' },
|
30
|
-
{ name: 'AndorrA', code: 'AD' },
|
31
|
-
{ name: 'Angola', code: 'AO' },
|
32
|
-
{ name: 'Anguilla', code: 'AI' },
|
33
|
-
{ name: 'Antarctica', code: 'AQ' },
|
34
|
-
{ name: 'Antigua and Barbuda', code: 'AG' },
|
35
|
-
{ name: 'Argentina', code: 'AR' },
|
36
|
-
{ name: 'Armenia', code: 'AM' },
|
37
|
-
{ name: 'Aruba', code: 'AW' },
|
38
|
-
{ name: 'Australia', code: 'AU' },
|
39
|
-
{ name: 'Austria', code: 'AT' },
|
40
|
-
{ name: 'Azerbaijan', code: 'AZ' },
|
41
|
-
{ name: 'Bahamas', code: 'BS' },
|
42
|
-
{ name: 'Bahrain', code: 'BH' },
|
43
|
-
{ name: 'Bangladesh', code: 'BD' },
|
44
|
-
{ name: 'Barbados', code: 'BB' },
|
45
|
-
{ name: 'Belarus', code: 'BY' },
|
46
|
-
{ name: 'Belgium', code: 'BE' },
|
47
|
-
{ name: 'Belize', code: 'BZ' },
|
48
|
-
{ name: 'Benin', code: 'BJ' },
|
49
|
-
{ name: 'Bermuda', code: 'BM' },
|
50
|
-
{ name: 'Bhutan', code: 'BT' },
|
51
|
-
{ name: 'Bolivia', code: 'BO' },
|
52
|
-
{ name: 'Bosnia and Herzegovina', code: 'BA' },
|
53
|
-
{ name: 'Botswana', code: 'BW' },
|
54
|
-
{ name: 'Bouvet Island', code: 'BV' }]}
|
55
|
-
keyValue='name'
|
56
|
-
/>
|
57
|
-
</div>
|
58
|
-
</Markup.ReactMarkupPreview>
|
59
|
-
<Markup.ReactMarkupCode>{`
|
60
|
-
|
61
|
-
`}
|
62
|
-
</Markup.ReactMarkupCode>
|
63
|
-
</Markup.ReactMarkup>
|
64
|
-
|
65
|
-
<p className='docs-page__paragraph'>TAG INPUT FROM SCRATCH TEST</p>
|
66
|
-
<Markup.ReactMarkup>
|
67
|
-
<Markup.ReactMarkupPreview>
|
68
|
-
<p className="docs-page__paragraph">// Tag input with button for picking items from list</p>
|
69
|
-
<div className='form__row'>
|
70
|
-
<TagInput label='Cars' items={['Audi', 'BMW', 'Hyundai', 'Opel', 'Audi2', 'BMW2', 'Hyundai2', 'Opel2', 'Audi3', 'BMW3', 'Hyundai3', 'Opel3', 'Audi4', 'BMW4', 'Hyundai4', 'Opel4', 'Audi5', 'BMW5', 'Hyundai5', 'Opel5', 'Audi6', 'BMW6', 'Hyundai6', 'Opel6']} />
|
71
|
-
</div>
|
72
|
-
|
73
|
-
<p className="docs-page__paragraph">// Tag input with suggestions + freetype text</p>
|
74
|
-
<div className='form__row'>
|
75
|
-
<TagInput label='Cars' freetype={true} items={['Audi', 'BMW', 'Hyundai', 'Opel', 'Audi2', 'BMW2', 'Hyundai2', 'Opel2', 'Audi3', 'BMW3', 'Hyundai3', 'Opel3', 'Audi4', 'BMW4', 'Hyundai4', 'Opel4', 'Audi5', 'BMW5', 'Hyundai5', 'Opel5', 'Audi6', 'BMW6', 'Hyundai6', 'Opel6']} />
|
76
|
-
</div>
|
77
|
-
|
78
|
-
<p className="docs-page__paragraph">// Only freetype text</p>
|
79
|
-
<div className='form__row'>
|
80
|
-
<TagInput label='Cars' freetype={true} />
|
81
|
-
</div>
|
82
|
-
</Markup.ReactMarkupPreview>
|
83
|
-
<Markup.ReactMarkupCode>{`
|
84
|
-
|
85
|
-
`}
|
86
|
-
</Markup.ReactMarkupCode>
|
87
|
-
</Markup.ReactMarkup>
|
88
|
-
</section>
|
89
|
-
</React.Fragment>
|
90
|
-
)
|
91
|
-
}
|
92
|
-
}
|
@@ -1,92 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import * as Markup from '../../js/react';
|
3
|
-
import { TagInput, TagInputTest } from '../../../app-typescript';
|
4
|
-
|
5
|
-
export default class TagInputDoc extends React.Component {
|
6
|
-
render() {
|
7
|
-
return (
|
8
|
-
<React.Fragment>
|
9
|
-
<section className="docs-page__container">
|
10
|
-
<h2 className="docs-page__h2">Tag Input IN PROGRESS</h2>
|
11
|
-
<p className="docs-page__paragraph">
|
12
|
-
A tag input is an input box that automatically creates tags – also called tokens – out of typed text every time a certain key is pressed. It's useful for tagging and highlighting information right on the input box.
|
13
|
-
</p>
|
14
|
-
<Markup.ReactMarkupCodePreview>{`
|
15
|
-
|
16
|
-
`}
|
17
|
-
</Markup.ReactMarkupCodePreview>
|
18
|
-
<p className='docs-page__paragraph'>PRIME REACT TEST</p>
|
19
|
-
<Markup.ReactMarkup>
|
20
|
-
<Markup.ReactMarkupPreview>
|
21
|
-
<p className="docs-page__paragraph">Test Tag Input</p>
|
22
|
-
<div className='form__row'>
|
23
|
-
<TagInputTest
|
24
|
-
items={[
|
25
|
-
{ name: 'Afghanistan', code: 'AF' },
|
26
|
-
{ name: 'Åland Islands', code: 'AX' },
|
27
|
-
{ name: 'Albania', code: 'AL' },
|
28
|
-
{ name: 'Algeria', code: 'DZ' },
|
29
|
-
{ name: 'American Samoa', code: 'AS' },
|
30
|
-
{ name: 'AndorrA', code: 'AD' },
|
31
|
-
{ name: 'Angola', code: 'AO' },
|
32
|
-
{ name: 'Anguilla', code: 'AI' },
|
33
|
-
{ name: 'Antarctica', code: 'AQ' },
|
34
|
-
{ name: 'Antigua and Barbuda', code: 'AG' },
|
35
|
-
{ name: 'Argentina', code: 'AR' },
|
36
|
-
{ name: 'Armenia', code: 'AM' },
|
37
|
-
{ name: 'Aruba', code: 'AW' },
|
38
|
-
{ name: 'Australia', code: 'AU' },
|
39
|
-
{ name: 'Austria', code: 'AT' },
|
40
|
-
{ name: 'Azerbaijan', code: 'AZ' },
|
41
|
-
{ name: 'Bahamas', code: 'BS' },
|
42
|
-
{ name: 'Bahrain', code: 'BH' },
|
43
|
-
{ name: 'Bangladesh', code: 'BD' },
|
44
|
-
{ name: 'Barbados', code: 'BB' },
|
45
|
-
{ name: 'Belarus', code: 'BY' },
|
46
|
-
{ name: 'Belgium', code: 'BE' },
|
47
|
-
{ name: 'Belize', code: 'BZ' },
|
48
|
-
{ name: 'Benin', code: 'BJ' },
|
49
|
-
{ name: 'Bermuda', code: 'BM' },
|
50
|
-
{ name: 'Bhutan', code: 'BT' },
|
51
|
-
{ name: 'Bolivia', code: 'BO' },
|
52
|
-
{ name: 'Bosnia and Herzegovina', code: 'BA' },
|
53
|
-
{ name: 'Botswana', code: 'BW' },
|
54
|
-
{ name: 'Bouvet Island', code: 'BV' }]}
|
55
|
-
keyValue='name'
|
56
|
-
/>
|
57
|
-
</div>
|
58
|
-
</Markup.ReactMarkupPreview>
|
59
|
-
<Markup.ReactMarkupCode>{`
|
60
|
-
|
61
|
-
`}
|
62
|
-
</Markup.ReactMarkupCode>
|
63
|
-
</Markup.ReactMarkup>
|
64
|
-
|
65
|
-
<p className='docs-page__paragraph'>TAG INPUT FROM SCRATCH TEST</p>
|
66
|
-
<Markup.ReactMarkup>
|
67
|
-
<Markup.ReactMarkupPreview>
|
68
|
-
<p className="docs-page__paragraph">// Tag input with button for picking items from list</p>
|
69
|
-
<div className='form__row'>
|
70
|
-
<TagInput label='Cars' items={['Audi', 'BMW', 'Hyundai', 'Opel', 'Audi2', 'BMW2', 'Hyundai2', 'Opel2', 'Audi3', 'BMW3', 'Hyundai3', 'Opel3', 'Audi4', 'BMW4', 'Hyundai4', 'Opel4', 'Audi5', 'BMW5', 'Hyundai5', 'Opel5', 'Audi6', 'BMW6', 'Hyundai6', 'Opel6']} />
|
71
|
-
</div>
|
72
|
-
|
73
|
-
<p className="docs-page__paragraph">// Tag input with suggestions + freetype text</p>
|
74
|
-
<div className='form__row'>
|
75
|
-
<TagInput label='Cars' freetype={true} items={['Audi', 'BMW', 'Hyundai', 'Opel', 'Audi2', 'BMW2', 'Hyundai2', 'Opel2', 'Audi3', 'BMW3', 'Hyundai3', 'Opel3', 'Audi4', 'BMW4', 'Hyundai4', 'Opel4', 'Audi5', 'BMW5', 'Hyundai5', 'Opel5', 'Audi6', 'BMW6', 'Hyundai6', 'Opel6']} />
|
76
|
-
</div>
|
77
|
-
|
78
|
-
<p className="docs-page__paragraph">// Only freetype text</p>
|
79
|
-
<div className='form__row'>
|
80
|
-
<TagInput label='Cars' freetype={true} />
|
81
|
-
</div>
|
82
|
-
</Markup.ReactMarkupPreview>
|
83
|
-
<Markup.ReactMarkupCode>{`
|
84
|
-
|
85
|
-
`}
|
86
|
-
</Markup.ReactMarkupCode>
|
87
|
-
</Markup.ReactMarkup>
|
88
|
-
</section>
|
89
|
-
</React.Fragment>
|
90
|
-
)
|
91
|
-
}
|
92
|
-
}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
interface IProps {
|
3
|
-
items: Array<any>;
|
4
|
-
keyValue: string;
|
5
|
-
minLength?: number;
|
6
|
-
}
|
7
|
-
interface IState {
|
8
|
-
selectedItem: any;
|
9
|
-
filteredItems: any;
|
10
|
-
}
|
11
|
-
export declare class TagInputTest extends React.Component<IProps, IState> {
|
12
|
-
constructor(props: IProps);
|
13
|
-
searchItem(event: any): void;
|
14
|
-
itemTemplate(item: any): JSX.Element;
|
15
|
-
handleItem(e: any): void;
|
16
|
-
render(): JSX.Element;
|
17
|
-
}
|
18
|
-
export {};
|