superdesk-ui-framework 3.0.43 → 3.0.45
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-typescript/components/Menu.tsx +1 -1
- package/app-typescript/components/{TreeSelect.tsx → TreeSelect/TreeSelect.tsx} +228 -257
- package/app-typescript/components/TreeSelect/TreeSelectItem.tsx +84 -0
- package/app-typescript/components/TreeSelect/TreeSelectPill.tsx +53 -0
- package/app-typescript/index.ts +1 -1
- package/dist/examples.bundle.js +1026 -913
- package/dist/react/TreeSelect.tsx +1 -1
- package/dist/superdesk-ui.bundle.js +773 -660
- package/dist/vendor.bundle.js +23 -23
- package/examples/pages/react/TreeSelect.tsx +1 -1
- package/package.json +1 -1
- package/react/components/Menu.js +1 -1
- package/react/components/{TreeSelect.d.ts → TreeSelect/TreeSelect.d.ts} +2 -2
- package/react/components/{TreeSelect.js → TreeSelect/TreeSelect.js} +82 -144
- package/react/components/TreeSelect/TreeSelectItem.d.ts +20 -0
- package/react/components/TreeSelect/TreeSelectItem.js +90 -0
- package/react/components/TreeSelect/TreeSelectPill.d.ts +14 -0
- package/react/components/TreeSelect/TreeSelectPill.js +71 -0
- package/react/index.d.ts +1 -1
- package/react/index.js +1 -1
@@ -0,0 +1,90 @@
|
|
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
|
+
})();
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
18
|
+
if (k2 === undefined) k2 = k;
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
22
|
+
}
|
23
|
+
Object.defineProperty(o, k2, desc);
|
24
|
+
}) : (function(o, m, k, k2) {
|
25
|
+
if (k2 === undefined) k2 = k;
|
26
|
+
o[k2] = m[k];
|
27
|
+
}));
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
30
|
+
}) : function(o, v) {
|
31
|
+
o["default"] = v;
|
32
|
+
});
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
34
|
+
if (mod && mod.__esModule) return mod;
|
35
|
+
var result = {};
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
37
|
+
__setModuleDefault(result, mod);
|
38
|
+
return result;
|
39
|
+
};
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
41
|
+
exports.TreeSelectItem = exports.getPrefixedItemId = void 0;
|
42
|
+
var React = __importStar(require("react"));
|
43
|
+
var Icon_1 = require("../Icon");
|
44
|
+
var Label_1 = require("../Label");
|
45
|
+
function getPrefixedItemId(id) {
|
46
|
+
return id + '-focus';
|
47
|
+
}
|
48
|
+
exports.getPrefixedItemId = getPrefixedItemId;
|
49
|
+
var TreeSelectItem = /** @class */ (function (_super) {
|
50
|
+
__extends(TreeSelectItem, _super);
|
51
|
+
function TreeSelectItem() {
|
52
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
53
|
+
}
|
54
|
+
TreeSelectItem.prototype.render = function () {
|
55
|
+
var _this = this;
|
56
|
+
return (React.createElement("li", { className: 'suggestion-item suggestion-item--multi-select', onClick: function (event) {
|
57
|
+
var _a, _b;
|
58
|
+
(_b = (_a = _this.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
|
59
|
+
event.preventDefault();
|
60
|
+
event.stopPropagation();
|
61
|
+
_this.props.handleTree(event, _this.props.option);
|
62
|
+
} },
|
63
|
+
React.createElement("button", {
|
64
|
+
// the className is generated in order to focus the element later
|
65
|
+
className: "suggestion-item--btn ".concat(getPrefixedItemId(this.props.getId(this.props.option.value))), onKeyDown: function (event) {
|
66
|
+
var _a, _b;
|
67
|
+
if (event.key === 'Enter' && _this.props.option.children) {
|
68
|
+
(_b = (_a = _this.props).onKeyDown) === null || _b === void 0 ? void 0 : _b.call(_a);
|
69
|
+
}
|
70
|
+
} },
|
71
|
+
(this.props.getBorderColor && !this.props.allowMultiple)
|
72
|
+
&& React.createElement("div", { className: "item-border", style: {
|
73
|
+
backgroundColor: this.props.getBorderColor(this.props.option.value),
|
74
|
+
} }),
|
75
|
+
React.createElement("span", { className: 'suggestion-item--bgcolor'
|
76
|
+
+ (this.props.selectedItem ? ' suggestion-item--disabled' : ''), style: (this.props.getBackgroundColor && this.props.option.value)
|
77
|
+
? {
|
78
|
+
backgroundColor: this.props.getBackgroundColor(this.props.option.value),
|
79
|
+
color: (0, Label_1.getTextColor)(this.props.getBackgroundColor(this.props.option.value)),
|
80
|
+
}
|
81
|
+
: undefined }, this.props.optionTemplate
|
82
|
+
? this.props.optionTemplate(this.props.option.value)
|
83
|
+
: this.props.getLabel(this.props.option.value)),
|
84
|
+
this.props.option.children
|
85
|
+
&& React.createElement("span", { className: "suggestion-item__icon" },
|
86
|
+
React.createElement(Icon_1.Icon, { name: "chevron-right-thin" })))));
|
87
|
+
};
|
88
|
+
return TreeSelectItem;
|
89
|
+
}(React.Component));
|
90
|
+
exports.TreeSelectItem = TreeSelectItem;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
interface IProps<T> {
|
3
|
+
item: T;
|
4
|
+
readOnly?: boolean;
|
5
|
+
disabled?: boolean;
|
6
|
+
backgroundColor: string | undefined;
|
7
|
+
onRemove(): void;
|
8
|
+
valueTemplate?(item: T, Wrapper: React.ElementType): React.ComponentType<T> | JSX.Element;
|
9
|
+
getBackgroundColor?(item: T): string;
|
10
|
+
}
|
11
|
+
export declare class TreeSelectPill<T> extends React.Component<IProps<T>> {
|
12
|
+
render(): JSX.Element;
|
13
|
+
}
|
14
|
+
export {};
|
@@ -0,0 +1,71 @@
|
|
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
|
+
})();
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
18
|
+
if (k2 === undefined) k2 = k;
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
22
|
+
}
|
23
|
+
Object.defineProperty(o, k2, desc);
|
24
|
+
}) : (function(o, m, k, k2) {
|
25
|
+
if (k2 === undefined) k2 = k;
|
26
|
+
o[k2] = m[k];
|
27
|
+
}));
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
30
|
+
}) : function(o, v) {
|
31
|
+
o["default"] = v;
|
32
|
+
});
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
34
|
+
if (mod && mod.__esModule) return mod;
|
35
|
+
var result = {};
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
37
|
+
__setModuleDefault(result, mod);
|
38
|
+
return result;
|
39
|
+
};
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
41
|
+
exports.TreeSelectPill = void 0;
|
42
|
+
var React = __importStar(require("react"));
|
43
|
+
var Icon_1 = require("../Icon");
|
44
|
+
var Label_1 = require("../Label");
|
45
|
+
var TreeSelectPill = /** @class */ (function (_super) {
|
46
|
+
__extends(TreeSelectPill, _super);
|
47
|
+
function TreeSelectPill() {
|
48
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
49
|
+
}
|
50
|
+
TreeSelectPill.prototype.render = function () {
|
51
|
+
var _this = this;
|
52
|
+
return (React.createElement("li", { className: "tags-input__tag-item tags-input__tag-item--multi-select"
|
53
|
+
+ (this.props.readOnly ? ' tags-input__tag-item--readonly' : ''), onClick: function () { return (!_this.props.readOnly && !_this.props.disabled)
|
54
|
+
&& _this.props.onRemove(); }, style: this.props.valueTemplate
|
55
|
+
? { backgroundColor: this.props.backgroundColor }
|
56
|
+
: this.props.getBackgroundColor
|
57
|
+
&& { backgroundColor: this.props.getBackgroundColor(this.props.item) } },
|
58
|
+
React.createElement("span", { className: "tags-input__helper-box", style: {
|
59
|
+
color: this.props.backgroundColor
|
60
|
+
? (0, Label_1.getTextColor)(this.props.backgroundColor)
|
61
|
+
: this.props.getBackgroundColor
|
62
|
+
&& (0, Label_1.getTextColor)(this.props.getBackgroundColor(this.props.item)),
|
63
|
+
} },
|
64
|
+
this.props.children,
|
65
|
+
!this.props.readOnly
|
66
|
+
&& React.createElement("span", { className: "tags-input__remove-button" },
|
67
|
+
React.createElement(Icon_1.Icon, { name: "close-small" })))));
|
68
|
+
};
|
69
|
+
return TreeSelectPill;
|
70
|
+
}(React.Component));
|
71
|
+
exports.TreeSelectPill = TreeSelectPill;
|
package/react/index.d.ts
CHANGED
@@ -82,7 +82,7 @@ export { Text } from './components/Text/Text';
|
|
82
82
|
export { Time } from './components/Text/Time';
|
83
83
|
export { Heading } from './components/Text/Heading';
|
84
84
|
export { BottomNav } from './components/Navigation/BottomNav';
|
85
|
-
export { TreeSelect } from './components/TreeSelect';
|
85
|
+
export { TreeSelect } from './components/TreeSelect/TreeSelect';
|
86
86
|
export { TableList, TableListItem } from './components/Lists/TableList';
|
87
87
|
export { ContentListItem } from './components/Lists/ContentList';
|
88
88
|
export { MultiSelect } from './components/MultiSelect';
|
package/react/index.js
CHANGED
@@ -201,7 +201,7 @@ var Heading_1 = require("./components/Text/Heading");
|
|
201
201
|
Object.defineProperty(exports, "Heading", { enumerable: true, get: function () { return Heading_1.Heading; } });
|
202
202
|
var BottomNav_1 = require("./components/Navigation/BottomNav");
|
203
203
|
Object.defineProperty(exports, "BottomNav", { enumerable: true, get: function () { return BottomNav_1.BottomNav; } });
|
204
|
-
var TreeSelect_1 = require("./components/TreeSelect");
|
204
|
+
var TreeSelect_1 = require("./components/TreeSelect/TreeSelect");
|
205
205
|
Object.defineProperty(exports, "TreeSelect", { enumerable: true, get: function () { return TreeSelect_1.TreeSelect; } });
|
206
206
|
var TableList_1 = require("./components/Lists/TableList");
|
207
207
|
Object.defineProperty(exports, "TableList", { enumerable: true, get: function () { return TableList_1.TableList; } });
|