@wener/console
Version:
Base console UI toolkit
54 lines (53 loc) • 1.95 kB
JavaScript
function _object_without_properties(source, excluded) {
if (source == null) return {};
var target = {}, sourceKeys, key, i;
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
sourceKeys = Reflect.ownKeys(source);
for(i = 0; i < sourceKeys.length; i++){
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
return target;
}
target = _object_without_properties_loose(source, excluded);
if (Object.getOwnPropertySymbols) {
sourceKeys = Object.getOwnPropertySymbols(source);
for(i = 0; i < sourceKeys.length; i++){
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _object_without_properties_loose(source, excluded) {
if (source == null) return {};
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
for(i = 0; i < sourceKeys.length; i++){
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
return target;
}
import React, { useMemo } from 'react';
import { formatDuration } from '@wener/common/dayjs';
export var DurationFormat = function(_0) {
var value = _0.value, placeholder = _0.placeholder, props = _object_without_properties(_0, [
"value",
"placeholder"
]);
var display = useMemo(function() {
return formatDuration(value);
}, [
value
]);
if (!display) {
return placeholder;
}
return /*#__PURE__*/ React.createElement("span", props, display);
};