@mikezimm/npmfunctions
Version:
Functions used in my SPFx webparts
133 lines • 4.83 kB
JavaScript
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MySpan = exports.MyIcon = exports.ProjectTitleElement = exports.defProjectIconStyle = exports.ColoredLine = void 0;
var React = __importStar(require("react"));
var Icon_1 = require("office-ui-fabric-react/lib/Icon");
var ColoredLine = function (_a) {
var color = _a.color, height = _a.height;
return (React.createElement("hr", { style: { color: color, backgroundColor: color, height: height } }));
};
exports.ColoredLine = ColoredLine;
exports.defProjectIconStyle = {
name: null,
color: null,
size: null,
weight: null,
};
function ProjectTitleElement(item) {
var icon = MyIcon(item.projOptions.icon, exports.defProjectIconStyle);
//const element: any = MySpan(item['projOptions']);
var fullElement = React.createElement("div", null,
" ",
icon,
" ",
null,
" ");
return fullElement;
}
exports.ProjectTitleElement = ProjectTitleElement;
//This is presumably from TrackMyTime
function MyIcon(item, defIcon) {
var iconName = defIcon.name;
var iconColor = defIcon.color;
var iconSize = defIcon.size;
var iconWeight = defIcon.weight;
if (item != null) {
if (item.name) {
iconName = item.name;
}
if (item.color) {
iconColor = item.color;
}
if (item.size) {
iconSize = item.size;
}
if (item.weight) {
iconWeight = item.weight;
}
}
iconSize = iconSize == null ? 'large' : iconSize;
var iconStyles = { root: {
fontSize: iconSize,
fontWeight: iconWeight,
color: iconColor,
paddingRight: '10px',
} };
var icon = iconName && iconName.length > 0 ? React.createElement(Icon_1.Icon, { iconName: iconName, styles: iconStyles }) : null;
return icon;
}
exports.MyIcon = MyIcon;
var MySpan = function (item) { return ({
render: function (item) {
var thisStyle = {
color: '#333333',
background: 'transparent',
verticalAlign: 'top',
// fontWeight: 'normal',
// fontStyle: 'normal',
// fontWeight: 'normal',
};
var fColor = item['font.color'];
var fSize = item['font.size'];
var fWeight = item['font.weight'];
var fStyle = item['font.style'];
var bgColor = item['bgColor'];
if (fColor && fColor.length > 0) {
thisStyle['color'] = fColor;
}
if (fSize && fSize.length > 0) {
thisStyle['font-size'] = fSize;
}
if (fWeight && fWeight.length > 0) {
thisStyle['font-weight'] = fWeight;
}
if (fStyle && fStyle.length > 0) {
thisStyle['font-style'] = fStyle;
}
if (bgColor && bgColor.length > 0) {
thisStyle['background'] = bgColor;
}
var iconName = item['projOptions.icon.name'];
var iconSize = item['projOptions.icon.size'];
var lineHeight = iconSize == null ? 'large' : iconSize;
if (lineHeight === 'x-large') {
lineHeight = '20px';
}
if (lineHeight === 'xx-large') {
lineHeight = '20px';
}
if (lineHeight === 'large') {
lineHeight = '18px';
}
if (iconName && iconName.length) {
thisStyle['line-height'] = lineHeight;
}
var element = React.createElement("span", { style: thisStyle }, item.titleProject);
return element;
}
}); };
exports.MySpan = MySpan;
//# sourceMappingURL=draw.js.map
;