You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3832 lines
136 KiB
3832 lines
136 KiB
(self["webpackChunk"] = self["webpackChunk"] || []).push([[20158,37825,56047],{
|
|
|
|
/***/ 47104:
|
|
/*!*************************************************************************************************************!*\
|
|
!*** ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/CloseCircleOutlined.js + 1 modules ***!
|
|
\*************************************************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ icons_CloseCircleOutlined; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.5@@babel/runtime/helpers/esm/extends.js
|
|
var esm_extends = __webpack_require__(61796);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons-svg@4.3.1@@ant-design/icons-svg/es/asn/CloseCircleOutlined.js
|
|
// This icon file is generated automatically.
|
|
var CloseCircleOutlined = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z" } }] }, "name": "close-circle", "theme": "outlined" };
|
|
/* harmony default export */ var asn_CloseCircleOutlined = (CloseCircleOutlined);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/components/AntdIcon.js + 3 modules
|
|
var AntdIcon = __webpack_require__(91851);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/CloseCircleOutlined.js
|
|
|
|
// GENERATE BY ./scripts/generate.ts
|
|
// DON NOT EDIT IT MANUALLY
|
|
|
|
|
|
|
|
|
|
var CloseCircleOutlined_CloseCircleOutlined = function CloseCircleOutlined(props, ref) {
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
|
|
ref: ref,
|
|
icon: asn_CloseCircleOutlined
|
|
}));
|
|
};
|
|
if (false) {}
|
|
/* harmony default export */ var icons_CloseCircleOutlined = (/*#__PURE__*/_react_17_0_2_react.forwardRef(CloseCircleOutlined_CloseCircleOutlined));
|
|
|
|
/***/ }),
|
|
|
|
/***/ 87306:
|
|
/*!*************************************************************************************************************!*\
|
|
!*** ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/MinusCircleOutlined.js + 1 modules ***!
|
|
\*************************************************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ icons_MinusCircleOutlined; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.5@@babel/runtime/helpers/esm/extends.js
|
|
var esm_extends = __webpack_require__(61796);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons-svg@4.3.1@@ant-design/icons-svg/es/asn/MinusCircleOutlined.js
|
|
// This icon file is generated automatically.
|
|
var MinusCircleOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z" } }, { "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }] }, "name": "minus-circle", "theme": "outlined" };
|
|
/* harmony default export */ var asn_MinusCircleOutlined = (MinusCircleOutlined);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/components/AntdIcon.js + 3 modules
|
|
var AntdIcon = __webpack_require__(91851);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/MinusCircleOutlined.js
|
|
|
|
// GENERATE BY ./scripts/generate.ts
|
|
// DON NOT EDIT IT MANUALLY
|
|
|
|
|
|
|
|
|
|
var MinusCircleOutlined_MinusCircleOutlined = function MinusCircleOutlined(props, ref) {
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
|
|
ref: ref,
|
|
icon: asn_MinusCircleOutlined
|
|
}));
|
|
};
|
|
if (false) {}
|
|
/* harmony default export */ var icons_MinusCircleOutlined = (/*#__PURE__*/_react_17_0_2_react.forwardRef(MinusCircleOutlined_MinusCircleOutlined));
|
|
|
|
/***/ }),
|
|
|
|
/***/ 71029:
|
|
/*!************************************************************************************************************!*\
|
|
!*** ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/PlusCircleOutlined.js + 1 modules ***!
|
|
\************************************************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ icons_PlusCircleOutlined; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.5@@babel/runtime/helpers/esm/extends.js
|
|
var esm_extends = __webpack_require__(61796);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons-svg@4.3.1@@ant-design/icons-svg/es/asn/PlusCircleOutlined.js
|
|
// This icon file is generated automatically.
|
|
var PlusCircleOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z" } }, { "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }] }, "name": "plus-circle", "theme": "outlined" };
|
|
/* harmony default export */ var asn_PlusCircleOutlined = (PlusCircleOutlined);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/components/AntdIcon.js + 3 modules
|
|
var AntdIcon = __webpack_require__(91851);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/PlusCircleOutlined.js
|
|
|
|
// GENERATE BY ./scripts/generate.ts
|
|
// DON NOT EDIT IT MANUALLY
|
|
|
|
|
|
|
|
|
|
var PlusCircleOutlined_PlusCircleOutlined = function PlusCircleOutlined(props, ref) {
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
|
|
ref: ref,
|
|
icon: asn_PlusCircleOutlined
|
|
}));
|
|
};
|
|
if (false) {}
|
|
/* harmony default export */ var icons_PlusCircleOutlined = (/*#__PURE__*/_react_17_0_2_react.forwardRef(PlusCircleOutlined_PlusCircleOutlined));
|
|
|
|
/***/ }),
|
|
|
|
/***/ 88522:
|
|
/*!*****************************************************************!*\
|
|
!*** ./node_modules/_antd@5.9.0@antd/es/auto-complete/index.js ***!
|
|
\*****************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! classnames */ 12124);
|
|
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_0__);
|
|
/* harmony import */ var rc_util_es_Children_toArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rc-util/es/Children/toArray */ 45659);
|
|
/* harmony import */ var rc_util_es_omit__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! rc-util/es/omit */ 99468);
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ 59301);
|
|
/* harmony import */ var _util_PurePanel__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../_util/PurePanel */ 53487);
|
|
/* harmony import */ var _util_reactNode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../_util/reactNode */ 92343);
|
|
/* harmony import */ var _config_provider__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../config-provider */ 36355);
|
|
/* harmony import */ var _select__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../select */ 57809);
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const {
|
|
Option
|
|
} = _select__WEBPACK_IMPORTED_MODULE_3__["default"];
|
|
function isSelectOptionOrSelectOptGroup(child) {
|
|
return child && child.type && (child.type.isSelectOption || child.type.isSelectOptGroup);
|
|
}
|
|
const AutoComplete = (props, ref) => {
|
|
const {
|
|
prefixCls: customizePrefixCls,
|
|
className,
|
|
popupClassName,
|
|
dropdownClassName,
|
|
children,
|
|
dataSource
|
|
} = props;
|
|
const childNodes = (0,rc_util_es_Children_toArray__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(children);
|
|
// ============================= Input =============================
|
|
let customizeInput;
|
|
if (childNodes.length === 1 && (0,_util_reactNode__WEBPACK_IMPORTED_MODULE_4__/* .isValidElement */ .l$)(childNodes[0]) && !isSelectOptionOrSelectOptGroup(childNodes[0])) {
|
|
[customizeInput] = childNodes;
|
|
}
|
|
const getInputElement = customizeInput ? () => customizeInput : undefined;
|
|
// ============================ Options ============================
|
|
let optionChildren;
|
|
// [Legacy] convert `children` or `dataSource` into option children
|
|
if (childNodes.length && isSelectOptionOrSelectOptGroup(childNodes[0])) {
|
|
optionChildren = children;
|
|
} else {
|
|
optionChildren = dataSource ? dataSource.map(item => {
|
|
if ((0,_util_reactNode__WEBPACK_IMPORTED_MODULE_4__/* .isValidElement */ .l$)(item)) {
|
|
return item;
|
|
}
|
|
switch (typeof item) {
|
|
case 'string':
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2__.createElement(Option, {
|
|
key: item,
|
|
value: item
|
|
}, item);
|
|
case 'object':
|
|
{
|
|
const {
|
|
value: optionValue
|
|
} = item;
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2__.createElement(Option, {
|
|
key: optionValue,
|
|
value: optionValue
|
|
}, item.text);
|
|
}
|
|
default:
|
|
false ? 0 : void 0;
|
|
return undefined;
|
|
}
|
|
}) : [];
|
|
}
|
|
if (false) {}
|
|
const {
|
|
getPrefixCls
|
|
} = react__WEBPACK_IMPORTED_MODULE_2__.useContext(_config_provider__WEBPACK_IMPORTED_MODULE_5__/* .ConfigContext */ .E_);
|
|
const prefixCls = getPrefixCls('select', customizePrefixCls);
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2__.createElement(_select__WEBPACK_IMPORTED_MODULE_3__["default"], Object.assign({
|
|
ref: ref,
|
|
suffixIcon: null
|
|
}, (0,rc_util_es_omit__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z)(props, ['dataSource', 'dropdownClassName']), {
|
|
prefixCls: prefixCls,
|
|
popupClassName: popupClassName || dropdownClassName,
|
|
className: classnames__WEBPACK_IMPORTED_MODULE_0___default()(`${prefixCls}-auto-complete`, className),
|
|
mode: _select__WEBPACK_IMPORTED_MODULE_3__["default"].SECRET_COMBOBOX_MODE_DO_NOT_USE
|
|
}, {
|
|
// Internal api
|
|
getInputElement
|
|
}), optionChildren);
|
|
};
|
|
const RefAutoComplete = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2__.forwardRef(AutoComplete);
|
|
// We don't care debug panel
|
|
/* istanbul ignore next */
|
|
const PurePanel = (0,_util_PurePanel__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z)(RefAutoComplete);
|
|
RefAutoComplete.Option = Option;
|
|
RefAutoComplete._InternalPanelDoNotUseOrYouWillBeFired = PurePanel;
|
|
if (false) {}
|
|
/* harmony default export */ __webpack_exports__.Z = (RefAutoComplete);
|
|
|
|
/***/ }),
|
|
|
|
/***/ 19479:
|
|
/*!********************************************************************!*\
|
|
!*** ./node_modules/_antd@5.9.0@antd/es/rate/index.js + 8 modules ***!
|
|
\********************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ rate; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.5@@babel/runtime/helpers/esm/extends.js
|
|
var esm_extends = __webpack_require__(61796);
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons-svg@4.3.1@@ant-design/icons-svg/es/asn/StarFilled.js
|
|
// This icon file is generated automatically.
|
|
var StarFilled = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z" } }] }, "name": "star", "theme": "filled" };
|
|
/* harmony default export */ var asn_StarFilled = (StarFilled);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/components/AntdIcon.js + 3 modules
|
|
var AntdIcon = __webpack_require__(91851);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/StarFilled.js
|
|
|
|
// GENERATE BY ./scripts/generate.ts
|
|
// DON NOT EDIT IT MANUALLY
|
|
|
|
|
|
|
|
|
|
var StarFilled_StarFilled = function StarFilled(props, ref) {
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
|
|
ref: ref,
|
|
icon: asn_StarFilled
|
|
}));
|
|
};
|
|
if (false) {}
|
|
/* harmony default export */ var icons_StarFilled = (/*#__PURE__*/_react_17_0_2_react.forwardRef(StarFilled_StarFilled));
|
|
// EXTERNAL MODULE: ./node_modules/_classnames@2.3.2@classnames/index.js
|
|
var _classnames_2_3_2_classnames = __webpack_require__(12124);
|
|
var _classnames_2_3_2_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_3_2_classnames);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.5@@babel/runtime/helpers/esm/defineProperty.js
|
|
var defineProperty = __webpack_require__(35005);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.5@@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
|
|
var slicedToArray = __webpack_require__(61860);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.5@@babel/runtime/helpers/esm/objectWithoutProperties.js
|
|
var objectWithoutProperties = __webpack_require__(20968);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.38.1@rc-util/es/hooks/useMergedState.js
|
|
var useMergedState = __webpack_require__(84381);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.38.1@rc-util/es/KeyCode.js
|
|
var KeyCode = __webpack_require__(84821);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.38.1@rc-util/es/pickAttrs.js
|
|
var pickAttrs = __webpack_require__(3286);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-rate@2.12.0@rc-rate/es/Star.js
|
|
|
|
|
|
|
|
function Star(props, ref) {
|
|
var disabled = props.disabled,
|
|
prefixCls = props.prefixCls,
|
|
character = props.character,
|
|
characterRender = props.characterRender,
|
|
index = props.index,
|
|
count = props.count,
|
|
value = props.value,
|
|
allowHalf = props.allowHalf,
|
|
focused = props.focused,
|
|
onHover = props.onHover,
|
|
onClick = props.onClick;
|
|
// =========================== Events ===========================
|
|
var onInternalHover = function onInternalHover(e) {
|
|
onHover(e, index);
|
|
};
|
|
var onInternalClick = function onInternalClick(e) {
|
|
onClick(e, index);
|
|
};
|
|
var onInternalKeyDown = function onInternalKeyDown(e) {
|
|
if (e.keyCode === KeyCode/* default */.Z.ENTER) {
|
|
onClick(e, index);
|
|
}
|
|
};
|
|
// =========================== Render ===========================
|
|
// >>>>> ClassName
|
|
var starValue = index + 1;
|
|
var classNameList = new Set([prefixCls]);
|
|
// TODO: Current we just refactor from CC to FC. This logic seems can be optimized.
|
|
if (value === 0 && index === 0 && focused) {
|
|
classNameList.add("".concat(prefixCls, "-focused"));
|
|
} else if (allowHalf && value + 0.5 >= starValue && value < starValue) {
|
|
classNameList.add("".concat(prefixCls, "-half"));
|
|
classNameList.add("".concat(prefixCls, "-active"));
|
|
if (focused) {
|
|
classNameList.add("".concat(prefixCls, "-focused"));
|
|
}
|
|
} else {
|
|
if (starValue <= value) {
|
|
classNameList.add("".concat(prefixCls, "-full"));
|
|
} else {
|
|
classNameList.add("".concat(prefixCls, "-zero"));
|
|
}
|
|
if (starValue === value && focused) {
|
|
classNameList.add("".concat(prefixCls, "-focused"));
|
|
}
|
|
}
|
|
// >>>>> Node
|
|
var characterNode = typeof character === 'function' ? character(props) : character;
|
|
var start = /*#__PURE__*/_react_17_0_2_react.createElement("li", {
|
|
className: _classnames_2_3_2_classnames_default()(Array.from(classNameList)),
|
|
ref: ref
|
|
}, /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
onClick: disabled ? null : onInternalClick,
|
|
onKeyDown: disabled ? null : onInternalKeyDown,
|
|
onMouseMove: disabled ? null : onInternalHover,
|
|
role: "radio",
|
|
"aria-checked": value > index ? 'true' : 'false',
|
|
"aria-posinset": index + 1,
|
|
"aria-setsize": count,
|
|
tabIndex: disabled ? -1 : 0
|
|
}, /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: "".concat(prefixCls, "-first")
|
|
}, characterNode), /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: "".concat(prefixCls, "-second")
|
|
}, characterNode)));
|
|
if (characterRender) {
|
|
start = characterRender(start, props);
|
|
}
|
|
return start;
|
|
}
|
|
/* harmony default export */ var es_Star = (/*#__PURE__*/_react_17_0_2_react.forwardRef(Star));
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-rate@2.12.0@rc-rate/es/useRefs.js
|
|
|
|
function useRefs() {
|
|
var nodeRef = _react_17_0_2_react.useRef({});
|
|
function getRef(index) {
|
|
return nodeRef.current[index];
|
|
}
|
|
function setRef(index) {
|
|
return function (node) {
|
|
nodeRef.current[index] = node;
|
|
};
|
|
}
|
|
return [getRef, setRef];
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-rate@2.12.0@rc-rate/es/util.js
|
|
function getScroll(w) {
|
|
var ret = w.pageXOffset;
|
|
var method = 'scrollLeft';
|
|
if (typeof ret !== 'number') {
|
|
var d = w.document;
|
|
// ie6,7,8 standard mode
|
|
ret = d.documentElement[method];
|
|
if (typeof ret !== 'number') {
|
|
// quirks mode
|
|
ret = d.body[method];
|
|
}
|
|
}
|
|
return ret;
|
|
}
|
|
function getClientPosition(elem) {
|
|
var x;
|
|
var y;
|
|
var doc = elem.ownerDocument;
|
|
var body = doc.body;
|
|
var docElem = doc && doc.documentElement;
|
|
var box = elem.getBoundingClientRect();
|
|
x = box.left;
|
|
y = box.top;
|
|
x -= docElem.clientLeft || body.clientLeft || 0;
|
|
y -= docElem.clientTop || body.clientTop || 0;
|
|
return {
|
|
left: x,
|
|
top: y
|
|
};
|
|
}
|
|
function getOffsetLeft(el) {
|
|
var pos = getClientPosition(el);
|
|
var doc = el.ownerDocument;
|
|
// Only IE use `parentWindow`
|
|
var w = doc.defaultView || doc.parentWindow;
|
|
pos.left += getScroll(w);
|
|
return pos.left;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-rate@2.12.0@rc-rate/es/Rate.js
|
|
|
|
|
|
|
|
|
|
var _excluded = ["prefixCls", "className", "defaultValue", "value", "count", "allowHalf", "allowClear", "character", "characterRender", "disabled", "direction", "tabIndex", "autoFocus", "onHoverChange", "onChange", "onFocus", "onBlur", "onKeyDown", "onMouseLeave"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Rate(props, ref) {
|
|
var _classNames;
|
|
var _props$prefixCls = props.prefixCls,
|
|
prefixCls = _props$prefixCls === void 0 ? 'rc-rate' : _props$prefixCls,
|
|
className = props.className,
|
|
defaultValue = props.defaultValue,
|
|
propValue = props.value,
|
|
_props$count = props.count,
|
|
count = _props$count === void 0 ? 5 : _props$count,
|
|
_props$allowHalf = props.allowHalf,
|
|
allowHalf = _props$allowHalf === void 0 ? false : _props$allowHalf,
|
|
_props$allowClear = props.allowClear,
|
|
allowClear = _props$allowClear === void 0 ? true : _props$allowClear,
|
|
_props$character = props.character,
|
|
character = _props$character === void 0 ? '★' : _props$character,
|
|
characterRender = props.characterRender,
|
|
disabled = props.disabled,
|
|
_props$direction = props.direction,
|
|
direction = _props$direction === void 0 ? 'ltr' : _props$direction,
|
|
_props$tabIndex = props.tabIndex,
|
|
tabIndex = _props$tabIndex === void 0 ? 0 : _props$tabIndex,
|
|
autoFocus = props.autoFocus,
|
|
onHoverChange = props.onHoverChange,
|
|
onChange = props.onChange,
|
|
onFocus = props.onFocus,
|
|
onBlur = props.onBlur,
|
|
onKeyDown = props.onKeyDown,
|
|
onMouseLeave = props.onMouseLeave,
|
|
restProps = (0,objectWithoutProperties/* default */.Z)(props, _excluded);
|
|
var _useRefs = useRefs(),
|
|
_useRefs2 = (0,slicedToArray/* default */.Z)(_useRefs, 2),
|
|
getStarRef = _useRefs2[0],
|
|
setStarRef = _useRefs2[1];
|
|
var rateRef = _react_17_0_2_react.useRef(null);
|
|
// ============================ Ref =============================
|
|
var triggerFocus = function triggerFocus() {
|
|
if (!disabled) {
|
|
var _rateRef$current;
|
|
(_rateRef$current = rateRef.current) === null || _rateRef$current === void 0 ? void 0 : _rateRef$current.focus();
|
|
}
|
|
};
|
|
_react_17_0_2_react.useImperativeHandle(ref, function () {
|
|
return {
|
|
focus: triggerFocus,
|
|
blur: function blur() {
|
|
if (!disabled) {
|
|
var _rateRef$current2;
|
|
(_rateRef$current2 = rateRef.current) === null || _rateRef$current2 === void 0 ? void 0 : _rateRef$current2.blur();
|
|
}
|
|
}
|
|
};
|
|
});
|
|
// =========================== Value ============================
|
|
var _useMergedState = (0,useMergedState/* default */.Z)(defaultValue || 0, {
|
|
value: propValue
|
|
}),
|
|
_useMergedState2 = (0,slicedToArray/* default */.Z)(_useMergedState, 2),
|
|
value = _useMergedState2[0],
|
|
setValue = _useMergedState2[1];
|
|
var _useMergedState3 = (0,useMergedState/* default */.Z)(null),
|
|
_useMergedState4 = (0,slicedToArray/* default */.Z)(_useMergedState3, 2),
|
|
cleanedValue = _useMergedState4[0],
|
|
setCleanedValue = _useMergedState4[1];
|
|
var getStarValue = function getStarValue(index, x) {
|
|
var reverse = direction === 'rtl';
|
|
var starValue = index + 1;
|
|
if (allowHalf) {
|
|
var starEle = getStarRef(index);
|
|
var leftDis = getOffsetLeft(starEle);
|
|
var width = starEle.clientWidth;
|
|
if (reverse && x - leftDis > width / 2) {
|
|
starValue -= 0.5;
|
|
} else if (!reverse && x - leftDis < width / 2) {
|
|
starValue -= 0.5;
|
|
}
|
|
}
|
|
return starValue;
|
|
};
|
|
// >>>>> Change
|
|
var changeValue = function changeValue(nextValue) {
|
|
setValue(nextValue);
|
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextValue);
|
|
};
|
|
// =========================== Focus ============================
|
|
var _React$useState = _react_17_0_2_react.useState(false),
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 2),
|
|
focused = _React$useState2[0],
|
|
setFocused = _React$useState2[1];
|
|
var onInternalFocus = function onInternalFocus() {
|
|
setFocused(true);
|
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
};
|
|
var onInternalBlur = function onInternalBlur() {
|
|
setFocused(false);
|
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
};
|
|
// =========================== Hover ============================
|
|
var _React$useState3 = _react_17_0_2_react.useState(null),
|
|
_React$useState4 = (0,slicedToArray/* default */.Z)(_React$useState3, 2),
|
|
hoverValue = _React$useState4[0],
|
|
setHoverValue = _React$useState4[1];
|
|
var onHover = function onHover(event, index) {
|
|
var nextHoverValue = getStarValue(index, event.pageX);
|
|
if (nextHoverValue !== cleanedValue) {
|
|
setHoverValue(nextHoverValue);
|
|
setCleanedValue(null);
|
|
}
|
|
onHoverChange === null || onHoverChange === void 0 ? void 0 : onHoverChange(nextHoverValue);
|
|
};
|
|
var onMouseLeaveCallback = function onMouseLeaveCallback(event) {
|
|
if (!disabled) {
|
|
setHoverValue(null);
|
|
setCleanedValue(null);
|
|
onHoverChange === null || onHoverChange === void 0 ? void 0 : onHoverChange(undefined);
|
|
}
|
|
if (event) {
|
|
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave(event);
|
|
}
|
|
};
|
|
// =========================== Click ============================
|
|
var onClick = function onClick(event, index) {
|
|
var newValue = getStarValue(index, event.pageX);
|
|
var isReset = false;
|
|
if (allowClear) {
|
|
isReset = newValue === value;
|
|
}
|
|
onMouseLeaveCallback();
|
|
changeValue(isReset ? 0 : newValue);
|
|
setCleanedValue(isReset ? newValue : null);
|
|
};
|
|
var onInternalKeyDown = function onInternalKeyDown(event) {
|
|
var keyCode = event.keyCode;
|
|
var reverse = direction === 'rtl';
|
|
var nextValue = value;
|
|
if (keyCode === KeyCode/* default */.Z.RIGHT && nextValue < count && !reverse) {
|
|
if (allowHalf) {
|
|
nextValue += 0.5;
|
|
} else {
|
|
nextValue += 1;
|
|
}
|
|
changeValue(nextValue);
|
|
event.preventDefault();
|
|
} else if (keyCode === KeyCode/* default */.Z.LEFT && nextValue > 0 && !reverse) {
|
|
if (allowHalf) {
|
|
nextValue -= 0.5;
|
|
} else {
|
|
nextValue -= 1;
|
|
}
|
|
changeValue(nextValue);
|
|
event.preventDefault();
|
|
} else if (keyCode === KeyCode/* default */.Z.RIGHT && nextValue > 0 && reverse) {
|
|
if (allowHalf) {
|
|
nextValue -= 0.5;
|
|
} else {
|
|
nextValue -= 1;
|
|
}
|
|
changeValue(nextValue);
|
|
event.preventDefault();
|
|
} else if (keyCode === KeyCode/* default */.Z.LEFT && nextValue < count && reverse) {
|
|
if (allowHalf) {
|
|
nextValue += 0.5;
|
|
} else {
|
|
nextValue += 1;
|
|
}
|
|
changeValue(nextValue);
|
|
event.preventDefault();
|
|
}
|
|
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
};
|
|
// =========================== Effect ===========================
|
|
_react_17_0_2_react.useEffect(function () {
|
|
if (autoFocus && !disabled) {
|
|
triggerFocus();
|
|
}
|
|
}, []);
|
|
// =========================== Render ===========================
|
|
// >>> Star
|
|
var starNodes = new Array(count).fill(0).map(function (item, index) {
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(es_Star, {
|
|
ref: setStarRef(index),
|
|
index: index,
|
|
count: count,
|
|
disabled: disabled,
|
|
prefixCls: "".concat(prefixCls, "-star"),
|
|
allowHalf: allowHalf,
|
|
value: hoverValue === null ? value : hoverValue,
|
|
onClick: onClick,
|
|
onHover: onHover,
|
|
key: item || index,
|
|
character: character,
|
|
characterRender: characterRender,
|
|
focused: focused
|
|
});
|
|
});
|
|
var classString = _classnames_2_3_2_classnames_default()(prefixCls, className, (_classNames = {}, (0,defineProperty/* default */.Z)(_classNames, "".concat(prefixCls, "-disabled"), disabled), (0,defineProperty/* default */.Z)(_classNames, "".concat(prefixCls, "-rtl"), direction === 'rtl'), _classNames));
|
|
// >>> Node
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement("ul", (0,esm_extends/* default */.Z)({
|
|
className: classString,
|
|
onMouseLeave: onMouseLeaveCallback,
|
|
tabIndex: disabled ? -1 : tabIndex,
|
|
onFocus: disabled ? null : onInternalFocus,
|
|
onBlur: disabled ? null : onInternalBlur,
|
|
onKeyDown: disabled ? null : onInternalKeyDown,
|
|
ref: rateRef,
|
|
role: "radiogroup"
|
|
}, (0,pickAttrs/* default */.Z)(restProps, {
|
|
aria: true,
|
|
data: true,
|
|
attr: true
|
|
})), starNodes);
|
|
}
|
|
/* harmony default export */ var es_Rate = (/*#__PURE__*/_react_17_0_2_react.forwardRef(Rate));
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-rate@2.12.0@rc-rate/es/index.js
|
|
|
|
/* harmony default export */ var es = (es_Rate);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/config-provider/context.js
|
|
var context = __webpack_require__(36355);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/tooltip/index.js + 3 modules
|
|
var tooltip = __webpack_require__(6848);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/style/index.js
|
|
var style = __webpack_require__(17313);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/genComponentStyleHook.js
|
|
var genComponentStyleHook = __webpack_require__(83116);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/statistic.js
|
|
var statistic = __webpack_require__(37613);
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/rate/style/index.js
|
|
"use client";
|
|
|
|
|
|
|
|
const genRateStarStyle = token => {
|
|
const {
|
|
componentCls
|
|
} = token;
|
|
return {
|
|
[`${componentCls}-star`]: {
|
|
position: 'relative',
|
|
display: 'inline-block',
|
|
color: 'inherit',
|
|
cursor: 'pointer',
|
|
'&:not(:last-child)': {
|
|
marginInlineEnd: token.marginXS
|
|
},
|
|
'> div': {
|
|
transition: `all ${token.motionDurationMid}, outline 0s`,
|
|
'&:hover': {
|
|
transform: token.starHoverScale
|
|
},
|
|
'&:focus': {
|
|
outline: 0
|
|
},
|
|
'&:focus-visible': {
|
|
outline: `${token.lineWidth}px dashed ${token.starColor}`,
|
|
transform: token.starHoverScale
|
|
}
|
|
},
|
|
'&-first, &-second': {
|
|
color: token.starBg,
|
|
transition: `all ${token.motionDurationMid}`,
|
|
userSelect: 'none',
|
|
[token.iconCls]: {
|
|
verticalAlign: 'middle'
|
|
}
|
|
},
|
|
'&-first': {
|
|
position: 'absolute',
|
|
top: 0,
|
|
insetInlineStart: 0,
|
|
width: '50%',
|
|
height: '100%',
|
|
overflow: 'hidden',
|
|
opacity: 0
|
|
},
|
|
[`&-half ${componentCls}-star-first, &-half ${componentCls}-star-second`]: {
|
|
opacity: 1
|
|
},
|
|
[`&-half ${componentCls}-star-first, &-full ${componentCls}-star-second`]: {
|
|
color: 'inherit'
|
|
}
|
|
}
|
|
};
|
|
};
|
|
const genRateRtlStyle = token => ({
|
|
[`&-rtl${token.componentCls}`]: {
|
|
direction: 'rtl'
|
|
}
|
|
});
|
|
const genRateStyle = token => {
|
|
const {
|
|
componentCls
|
|
} = token;
|
|
return {
|
|
[componentCls]: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (0,style/* resetComponent */.Wf)(token)), {
|
|
display: 'inline-block',
|
|
margin: 0,
|
|
padding: 0,
|
|
color: token.starColor,
|
|
fontSize: token.starSize,
|
|
lineHeight: 'unset',
|
|
listStyle: 'none',
|
|
outline: 'none',
|
|
// disable styles
|
|
[`&-disabled${componentCls} ${componentCls}-star`]: {
|
|
cursor: 'default',
|
|
'> div:hover': {
|
|
transform: 'scale(1)'
|
|
}
|
|
}
|
|
}), genRateStarStyle(token)), {
|
|
// text styles
|
|
[`+ ${componentCls}-text`]: {
|
|
display: 'inline-block',
|
|
marginInlineStart: token.marginXS,
|
|
fontSize: token.fontSize
|
|
}
|
|
}), genRateRtlStyle(token))
|
|
};
|
|
};
|
|
// ============================== Export ==============================
|
|
/* harmony default export */ var rate_style = ((0,genComponentStyleHook/* default */.Z)('Rate', token => {
|
|
const rateToken = (0,statistic/* merge */.TS)(token, {});
|
|
return [genRateStyle(rateToken)];
|
|
}, token => ({
|
|
starColor: token.yellow6,
|
|
starSize: token.controlHeightLG * 0.5,
|
|
starHoverScale: 'scale(1.1)',
|
|
starBg: token.colorFillContent
|
|
})));
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/rate/index.js
|
|
"use client";
|
|
|
|
var __rest = undefined && undefined.__rest || function (s, e) {
|
|
var t = {};
|
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
}
|
|
return t;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const rate_Rate = /*#__PURE__*/_react_17_0_2_react.forwardRef((props, ref) => {
|
|
const {
|
|
prefixCls,
|
|
className,
|
|
rootClassName,
|
|
style,
|
|
tooltips,
|
|
character = /*#__PURE__*/_react_17_0_2_react.createElement(icons_StarFilled, null)
|
|
} = props,
|
|
rest = __rest(props, ["prefixCls", "className", "rootClassName", "style", "tooltips", "character"]);
|
|
const characterRender = (node, _ref) => {
|
|
let {
|
|
index
|
|
} = _ref;
|
|
if (!tooltips) {
|
|
return node;
|
|
}
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(tooltip/* default */.Z, {
|
|
title: tooltips[index]
|
|
}, node);
|
|
};
|
|
const {
|
|
getPrefixCls,
|
|
direction,
|
|
rate
|
|
} = _react_17_0_2_react.useContext(context/* ConfigContext */.E_);
|
|
const ratePrefixCls = getPrefixCls('rate', prefixCls);
|
|
// Style
|
|
const [wrapSSR, hashId] = rate_style(ratePrefixCls);
|
|
const mergedStyle = Object.assign(Object.assign({}, rate === null || rate === void 0 ? void 0 : rate.style), style);
|
|
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement(es, Object.assign({
|
|
ref: ref,
|
|
character: character,
|
|
characterRender: characterRender
|
|
}, rest, {
|
|
className: _classnames_2_3_2_classnames_default()(className, rootClassName, hashId, rate === null || rate === void 0 ? void 0 : rate.className),
|
|
style: mergedStyle,
|
|
prefixCls: ratePrefixCls,
|
|
direction: direction
|
|
})));
|
|
});
|
|
if (false) {}
|
|
/* harmony default export */ var rate = (rate_Rate);
|
|
|
|
/***/ }),
|
|
|
|
/***/ 31797:
|
|
/*!*************************************************************************!*\
|
|
!*** ./node_modules/_antd@5.9.0@antd/es/statistic/index.js + 5 modules ***!
|
|
\*************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ es_statistic; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/_util/hooks/useForceUpdate.js
|
|
var useForceUpdate = __webpack_require__(56762);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/_util/reactNode.js
|
|
var reactNode = __webpack_require__(92343);
|
|
// EXTERNAL MODULE: ./node_modules/_classnames@2.3.2@classnames/index.js
|
|
var _classnames_2_3_2_classnames = __webpack_require__(12124);
|
|
var _classnames_2_3_2_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_3_2_classnames);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/config-provider/context.js
|
|
var context = __webpack_require__(36355);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/skeleton/index.js + 12 modules
|
|
var skeleton = __webpack_require__(59981);
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/statistic/Number.js
|
|
"use client";
|
|
|
|
|
|
const StatisticNumber = props => {
|
|
const {
|
|
value,
|
|
formatter,
|
|
precision,
|
|
decimalSeparator,
|
|
groupSeparator = '',
|
|
prefixCls
|
|
} = props;
|
|
let valueNode;
|
|
if (typeof formatter === 'function') {
|
|
// Customize formatter
|
|
valueNode = formatter(value);
|
|
} else {
|
|
// Internal formatter
|
|
const val = String(value);
|
|
const cells = val.match(/^(-?)(\d*)(\.(\d+))?$/);
|
|
// Process if illegal number
|
|
if (!cells || val === '-') {
|
|
valueNode = val;
|
|
} else {
|
|
const negative = cells[1];
|
|
let int = cells[2] || '0';
|
|
let decimal = cells[4] || '';
|
|
int = int.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
|
|
if (typeof precision === 'number') {
|
|
decimal = decimal.padEnd(precision, '0').slice(0, precision > 0 ? precision : 0);
|
|
}
|
|
if (decimal) {
|
|
decimal = `${decimalSeparator}${decimal}`;
|
|
}
|
|
valueNode = [/*#__PURE__*/_react_17_0_2_react.createElement("span", {
|
|
key: "int",
|
|
className: `${prefixCls}-content-value-int`
|
|
}, negative, int), decimal && /*#__PURE__*/_react_17_0_2_react.createElement("span", {
|
|
key: "decimal",
|
|
className: `${prefixCls}-content-value-decimal`
|
|
}, decimal)];
|
|
}
|
|
}
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement("span", {
|
|
className: `${prefixCls}-content-value`
|
|
}, valueNode);
|
|
};
|
|
/* harmony default export */ var statistic_Number = (StatisticNumber);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/style/index.js
|
|
var style = __webpack_require__(17313);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/genComponentStyleHook.js
|
|
var genComponentStyleHook = __webpack_require__(83116);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/statistic.js
|
|
var statistic = __webpack_require__(37613);
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/statistic/style/index.js
|
|
"use client";
|
|
|
|
|
|
|
|
const genStatisticStyle = token => {
|
|
const {
|
|
componentCls,
|
|
marginXXS,
|
|
padding,
|
|
colorTextDescription,
|
|
titleFontSize,
|
|
colorTextHeading,
|
|
contentFontSize,
|
|
fontFamily
|
|
} = token;
|
|
return {
|
|
[`${componentCls}`]: Object.assign(Object.assign({}, (0,style/* resetComponent */.Wf)(token)), {
|
|
[`${componentCls}-title`]: {
|
|
marginBottom: marginXXS,
|
|
color: colorTextDescription,
|
|
fontSize: titleFontSize
|
|
},
|
|
[`${componentCls}-skeleton`]: {
|
|
paddingTop: padding
|
|
},
|
|
[`${componentCls}-content`]: {
|
|
color: colorTextHeading,
|
|
fontSize: contentFontSize,
|
|
fontFamily,
|
|
[`${componentCls}-content-value`]: {
|
|
display: 'inline-block',
|
|
direction: 'ltr'
|
|
},
|
|
[`${componentCls}-content-prefix, ${componentCls}-content-suffix`]: {
|
|
display: 'inline-block'
|
|
},
|
|
[`${componentCls}-content-prefix`]: {
|
|
marginInlineEnd: marginXXS
|
|
},
|
|
[`${componentCls}-content-suffix`]: {
|
|
marginInlineStart: marginXXS
|
|
}
|
|
}
|
|
})
|
|
};
|
|
};
|
|
// ============================== Export ==============================
|
|
/* harmony default export */ var statistic_style = ((0,genComponentStyleHook/* default */.Z)('Statistic', token => {
|
|
const statisticToken = (0,statistic/* merge */.TS)(token, {});
|
|
return [genStatisticStyle(statisticToken)];
|
|
}, token => {
|
|
const {
|
|
fontSizeHeading3,
|
|
fontSize
|
|
} = token;
|
|
return {
|
|
titleFontSize: fontSize,
|
|
contentFontSize: fontSizeHeading3
|
|
};
|
|
}));
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/statistic/Statistic.js
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Statistic = props => {
|
|
const {
|
|
prefixCls: customizePrefixCls,
|
|
className,
|
|
rootClassName,
|
|
style,
|
|
valueStyle,
|
|
value = 0,
|
|
title,
|
|
valueRender,
|
|
prefix,
|
|
suffix,
|
|
loading = false,
|
|
onMouseEnter,
|
|
onMouseLeave,
|
|
decimalSeparator = '.',
|
|
groupSeparator = ','
|
|
} = props;
|
|
const {
|
|
getPrefixCls,
|
|
direction,
|
|
statistic
|
|
} = _react_17_0_2_react.useContext(context/* ConfigContext */.E_);
|
|
const prefixCls = getPrefixCls('statistic', customizePrefixCls);
|
|
const [wrapSSR, hashId] = statistic_style(prefixCls);
|
|
const valueNode = /*#__PURE__*/_react_17_0_2_react.createElement(statistic_Number, Object.assign({
|
|
decimalSeparator: decimalSeparator,
|
|
groupSeparator: groupSeparator,
|
|
prefixCls: prefixCls
|
|
}, props, {
|
|
value: value
|
|
}));
|
|
const cls = _classnames_2_3_2_classnames_default()(prefixCls, {
|
|
[`${prefixCls}-rtl`]: direction === 'rtl'
|
|
}, statistic === null || statistic === void 0 ? void 0 : statistic.className, className, rootClassName, hashId);
|
|
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: cls,
|
|
style: Object.assign(Object.assign({}, statistic === null || statistic === void 0 ? void 0 : statistic.style), style),
|
|
onMouseEnter: onMouseEnter,
|
|
onMouseLeave: onMouseLeave
|
|
}, title && /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: `${prefixCls}-title`
|
|
}, title), /*#__PURE__*/_react_17_0_2_react.createElement(skeleton/* default */.Z, {
|
|
paragraph: false,
|
|
loading: loading,
|
|
className: `${prefixCls}-skeleton`
|
|
}, /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
style: valueStyle,
|
|
className: `${prefixCls}-content`
|
|
}, prefix && /*#__PURE__*/_react_17_0_2_react.createElement("span", {
|
|
className: `${prefixCls}-content-prefix`
|
|
}, prefix), valueRender ? valueRender(valueNode) : valueNode, suffix && /*#__PURE__*/_react_17_0_2_react.createElement("span", {
|
|
className: `${prefixCls}-content-suffix`
|
|
}, suffix)))));
|
|
};
|
|
if (false) {}
|
|
/* harmony default export */ var statistic_Statistic = (Statistic);
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/statistic/utils.js
|
|
// Countdown
|
|
const timeUnits = [['Y', 1000 * 60 * 60 * 24 * 365], ['M', 1000 * 60 * 60 * 24 * 30], ['D', 1000 * 60 * 60 * 24], ['H', 1000 * 60 * 60], ['m', 1000 * 60], ['s', 1000], ['S', 1] // million seconds
|
|
];
|
|
|
|
function formatTimeStr(duration, format) {
|
|
let leftDuration = duration;
|
|
const escapeRegex = /\[[^\]]*]/g;
|
|
const keepList = (format.match(escapeRegex) || []).map(str => str.slice(1, -1));
|
|
const templateText = format.replace(escapeRegex, '[]');
|
|
const replacedText = timeUnits.reduce((current, _ref) => {
|
|
let [name, unit] = _ref;
|
|
if (current.includes(name)) {
|
|
const value = Math.floor(leftDuration / unit);
|
|
leftDuration -= value * unit;
|
|
return current.replace(new RegExp(`${name}+`, 'g'), match => {
|
|
const len = match.length;
|
|
return value.toString().padStart(len, '0');
|
|
});
|
|
}
|
|
return current;
|
|
}, templateText);
|
|
let index = 0;
|
|
return replacedText.replace(escapeRegex, () => {
|
|
const match = keepList[index];
|
|
index += 1;
|
|
return match;
|
|
});
|
|
}
|
|
function formatCountdown(value, config) {
|
|
const {
|
|
format = ''
|
|
} = config;
|
|
const target = new Date(value).getTime();
|
|
const current = Date.now();
|
|
const diff = Math.max(target - current, 0);
|
|
return formatTimeStr(diff, format);
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/statistic/Countdown.js
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const REFRESH_INTERVAL = 1000 / 30;
|
|
function getTime(value) {
|
|
return new Date(value).getTime();
|
|
}
|
|
const Countdown = props => {
|
|
const {
|
|
value,
|
|
format = 'HH:mm:ss',
|
|
onChange,
|
|
onFinish
|
|
} = props;
|
|
const forceUpdate = (0,useForceUpdate/* default */.Z)();
|
|
const countdown = _react_17_0_2_react.useRef(null);
|
|
const stopTimer = () => {
|
|
onFinish === null || onFinish === void 0 ? void 0 : onFinish();
|
|
if (countdown.current) {
|
|
clearInterval(countdown.current);
|
|
countdown.current = null;
|
|
}
|
|
};
|
|
const syncTimer = () => {
|
|
const timestamp = getTime(value);
|
|
if (timestamp >= Date.now()) {
|
|
countdown.current = setInterval(() => {
|
|
forceUpdate();
|
|
onChange === null || onChange === void 0 ? void 0 : onChange(timestamp - Date.now());
|
|
if (timestamp < Date.now()) {
|
|
stopTimer();
|
|
}
|
|
}, REFRESH_INTERVAL);
|
|
}
|
|
};
|
|
_react_17_0_2_react.useEffect(() => {
|
|
syncTimer();
|
|
return () => {
|
|
if (countdown.current) {
|
|
clearInterval(countdown.current);
|
|
countdown.current = null;
|
|
}
|
|
};
|
|
}, [value]);
|
|
const formatter = (formatValue, config) => formatCountdown(formatValue, Object.assign(Object.assign({}, config), {
|
|
format
|
|
}));
|
|
const valueRender = node => (0,reactNode/* cloneElement */.Tm)(node, {
|
|
title: undefined
|
|
});
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(statistic_Statistic, Object.assign({}, props, {
|
|
valueRender: valueRender,
|
|
formatter: formatter
|
|
}));
|
|
};
|
|
/* harmony default export */ var statistic_Countdown = (/*#__PURE__*/_react_17_0_2_react.memo(Countdown));
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/statistic/index.js
|
|
"use client";
|
|
|
|
|
|
|
|
statistic_Statistic.Countdown = statistic_Countdown;
|
|
/* harmony default export */ var es_statistic = (statistic_Statistic);
|
|
|
|
/***/ }),
|
|
|
|
/***/ 25769:
|
|
/*!**************************************************************************!*\
|
|
!*** ./node_modules/_copy-to-clipboard@3.3.3@copy-to-clipboard/index.js ***!
|
|
\**************************************************************************/
|
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
var deselectCurrent = __webpack_require__(/*! toggle-selection */ 98040);
|
|
|
|
var clipboardToIE11Formatting = {
|
|
"text/plain": "Text",
|
|
"text/html": "Url",
|
|
"default": "Text"
|
|
}
|
|
|
|
var defaultMessage = "Copy to clipboard: #{key}, Enter";
|
|
|
|
function format(message) {
|
|
var copyKey = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C";
|
|
return message.replace(/#{\s*key\s*}/g, copyKey);
|
|
}
|
|
|
|
function copy(text, options) {
|
|
var debug,
|
|
message,
|
|
reselectPrevious,
|
|
range,
|
|
selection,
|
|
mark,
|
|
success = false;
|
|
if (!options) {
|
|
options = {};
|
|
}
|
|
debug = options.debug || false;
|
|
try {
|
|
reselectPrevious = deselectCurrent();
|
|
|
|
range = document.createRange();
|
|
selection = document.getSelection();
|
|
|
|
mark = document.createElement("span");
|
|
mark.textContent = text;
|
|
// avoid screen readers from reading out loud the text
|
|
mark.ariaHidden = "true"
|
|
// reset user styles for span element
|
|
mark.style.all = "unset";
|
|
// prevents scrolling to the end of the page
|
|
mark.style.position = "fixed";
|
|
mark.style.top = 0;
|
|
mark.style.clip = "rect(0, 0, 0, 0)";
|
|
// used to preserve spaces and line breaks
|
|
mark.style.whiteSpace = "pre";
|
|
// do not inherit user-select (it may be `none`)
|
|
mark.style.webkitUserSelect = "text";
|
|
mark.style.MozUserSelect = "text";
|
|
mark.style.msUserSelect = "text";
|
|
mark.style.userSelect = "text";
|
|
mark.addEventListener("copy", function(e) {
|
|
e.stopPropagation();
|
|
if (options.format) {
|
|
e.preventDefault();
|
|
if (typeof e.clipboardData === "undefined") { // IE 11
|
|
debug && console.warn("unable to use e.clipboardData");
|
|
debug && console.warn("trying IE specific stuff");
|
|
window.clipboardData.clearData();
|
|
var format = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting["default"]
|
|
window.clipboardData.setData(format, text);
|
|
} else { // all other browsers
|
|
e.clipboardData.clearData();
|
|
e.clipboardData.setData(options.format, text);
|
|
}
|
|
}
|
|
if (options.onCopy) {
|
|
e.preventDefault();
|
|
options.onCopy(e.clipboardData);
|
|
}
|
|
});
|
|
|
|
document.body.appendChild(mark);
|
|
|
|
range.selectNodeContents(mark);
|
|
selection.addRange(range);
|
|
|
|
var successful = document.execCommand("copy");
|
|
if (!successful) {
|
|
throw new Error("copy command was unsuccessful");
|
|
}
|
|
success = true;
|
|
} catch (err) {
|
|
debug && console.error("unable to copy using execCommand: ", err);
|
|
debug && console.warn("trying IE specific stuff");
|
|
try {
|
|
window.clipboardData.setData(options.format || "text", text);
|
|
options.onCopy && options.onCopy(window.clipboardData);
|
|
success = true;
|
|
} catch (err) {
|
|
debug && console.error("unable to copy using clipboardData: ", err);
|
|
debug && console.error("falling back to prompt");
|
|
message = format("message" in options ? options.message : defaultMessage);
|
|
window.prompt(message, text);
|
|
}
|
|
} finally {
|
|
if (selection) {
|
|
if (typeof selection.removeRange == "function") {
|
|
selection.removeRange(range);
|
|
} else {
|
|
selection.removeAllRanges();
|
|
}
|
|
}
|
|
|
|
if (mark) {
|
|
document.body.removeChild(mark);
|
|
}
|
|
reselectPrevious();
|
|
}
|
|
|
|
return success;
|
|
}
|
|
|
|
module.exports = copy;
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 56047:
|
|
/*!**************************************************************************!*\
|
|
!*** ./node_modules/_echarts-wordcloud@1.1.3@echarts-wordcloud/index.js ***!
|
|
\**************************************************************************/
|
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
|
|
/* unused reexport */ __webpack_require__(/*! ./src/wordCloud */ 16896);
|
|
|
|
/***/ }),
|
|
|
|
/***/ 66607:
|
|
/*!****************************************************************************************!*\
|
|
!*** ./node_modules/_echarts-wordcloud@1.1.3@echarts-wordcloud/src/WordCloudSeries.js ***!
|
|
\****************************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
|
|
|
var completeDimensions = __webpack_require__(/*! echarts/lib/data/helper/completeDimensions */ 58347);
|
|
var echarts = __webpack_require__(/*! echarts/lib/echarts */ 3096);
|
|
|
|
echarts.extendSeriesModel({
|
|
|
|
type: 'series.wordCloud',
|
|
|
|
visualColorAccessPath: 'textStyle.normal.color',
|
|
|
|
optionUpdated: function () {
|
|
var option = this.option;
|
|
option.gridSize = Math.max(Math.floor(option.gridSize), 4);
|
|
},
|
|
|
|
getInitialData: function (option, ecModel) {
|
|
var dimensions = completeDimensions(['value'], option.data);
|
|
var list = new echarts.List(dimensions, this);
|
|
list.initData(option.data);
|
|
return list;
|
|
},
|
|
|
|
// Most of options are from https://github.com/timdream/wordcloud2.js/blob/gh-pages/API.md
|
|
defaultOption: {
|
|
|
|
maskImage: null,
|
|
|
|
// Shape can be 'circle', 'cardioid', 'diamond', 'triangle-forward', 'triangle', 'pentagon', 'star'
|
|
shape: 'circle',
|
|
|
|
left: 'center',
|
|
|
|
top: 'center',
|
|
|
|
width: '70%',
|
|
|
|
height: '80%',
|
|
|
|
sizeRange: [12, 60],
|
|
|
|
rotationRange: [-90, 90],
|
|
|
|
rotationStep: 45,
|
|
|
|
gridSize: 8,
|
|
|
|
drawOutOfBound: false,
|
|
|
|
textStyle: {
|
|
normal: {
|
|
fontWeight: 'normal'
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 31041:
|
|
/*!**************************************************************************************!*\
|
|
!*** ./node_modules/_echarts-wordcloud@1.1.3@echarts-wordcloud/src/WordCloudView.js ***!
|
|
\**************************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
|
|
|
var echarts = __webpack_require__(/*! echarts/lib/echarts */ 3096);
|
|
|
|
function getShallow(model, path) {
|
|
return model && model.getShallow(path);
|
|
}
|
|
|
|
echarts.extendChartView({
|
|
|
|
type: 'wordCloud',
|
|
|
|
render: function (seriesModel, ecModel, api) {
|
|
var group = this.group;
|
|
group.removeAll();
|
|
|
|
var data = seriesModel.getData();
|
|
|
|
var gridSize = seriesModel.get('gridSize');
|
|
|
|
seriesModel.layoutInstance.ondraw = function (text, size, dataIdx, drawn) {
|
|
var itemModel = data.getItemModel(dataIdx);
|
|
var textStyleModel = itemModel.getModel('textStyle.normal');
|
|
var emphasisTextStyleModel = itemModel.getModel('textStyle.emphasis');
|
|
|
|
var textEl = new echarts.graphic.Text({
|
|
style: echarts.graphic.setTextStyle({}, textStyleModel, {
|
|
x: drawn.info.fillTextOffsetX,
|
|
y: drawn.info.fillTextOffsetY + size * 0.5,
|
|
text: text,
|
|
textBaseline: 'middle',
|
|
textFill: data.getItemVisual(dataIdx, 'color'),
|
|
fontSize: size
|
|
}),
|
|
scale: [1 / drawn.info.mu, 1 / drawn.info.mu],
|
|
position: [
|
|
(drawn.gx + drawn.info.gw / 2) * gridSize,
|
|
(drawn.gy + drawn.info.gh / 2) * gridSize
|
|
],
|
|
rotation: drawn.rot
|
|
});
|
|
|
|
group.add(textEl);
|
|
|
|
data.setItemGraphicEl(dataIdx, textEl);
|
|
|
|
echarts.graphic.setHoverStyle(
|
|
textEl,
|
|
echarts.graphic.setTextStyle({}, emphasisTextStyleModel, null, {forMerge: true}, true)
|
|
);
|
|
};
|
|
|
|
this._model = seriesModel;
|
|
},
|
|
|
|
remove: function () {
|
|
this.group.removeAll();
|
|
|
|
this._model.layoutInstance.dispose();
|
|
},
|
|
|
|
dispose: function () {
|
|
this._model.layoutInstance.dispose();
|
|
}
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 19131:
|
|
/*!*******************************************************************************!*\
|
|
!*** ./node_modules/_echarts-wordcloud@1.1.3@echarts-wordcloud/src/layout.js ***!
|
|
\*******************************************************************************/
|
|
/***/ (function(module, exports) {
|
|
|
|
"use strict";
|
|
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
|
* wordcloud2.js
|
|
* http://timdream.org/wordcloud2.js/
|
|
*
|
|
* Copyright 2011 - 2013 Tim Chien
|
|
* Released under the MIT license
|
|
*/
|
|
|
|
|
|
|
|
// setImmediate
|
|
if (!window.setImmediate) {
|
|
window.setImmediate = (function setupSetImmediate() {
|
|
return window.msSetImmediate ||
|
|
window.webkitSetImmediate ||
|
|
window.mozSetImmediate ||
|
|
window.oSetImmediate ||
|
|
(function setupSetZeroTimeout() {
|
|
if (!window.postMessage || !window.addEventListener) {
|
|
return null;
|
|
}
|
|
|
|
var callbacks = [undefined];
|
|
var message = 'zero-timeout-message';
|
|
|
|
// Like setTimeout, but only takes a function argument. There's
|
|
// no time argument (always zero) and no arguments (you have to
|
|
// use a closure).
|
|
var setZeroTimeout = function setZeroTimeout(callback) {
|
|
var id = callbacks.length;
|
|
callbacks.push(callback);
|
|
window.postMessage(message + id.toString(36), '*');
|
|
|
|
return id;
|
|
};
|
|
|
|
window.addEventListener('message', function setZeroTimeoutMessage(evt) {
|
|
// Skipping checking event source, retarded IE confused this window
|
|
// object with another in the presence of iframe
|
|
if (typeof evt.data !== 'string' ||
|
|
evt.data.substr(0, message.length) !== message/* ||
|
|
evt.source !== window */) {
|
|
return;
|
|
}
|
|
|
|
evt.stopImmediatePropagation();
|
|
|
|
var id = parseInt(evt.data.substr(message.length), 36);
|
|
if (!callbacks[id]) {
|
|
return;
|
|
}
|
|
|
|
callbacks[id]();
|
|
callbacks[id] = undefined;
|
|
}, true);
|
|
|
|
/* specify clearImmediate() here since we need the scope */
|
|
window.clearImmediate = function clearZeroTimeout(id) {
|
|
if (!callbacks[id]) {
|
|
return;
|
|
}
|
|
|
|
callbacks[id] = undefined;
|
|
};
|
|
|
|
return setZeroTimeout;
|
|
})() ||
|
|
// fallback
|
|
function setImmediateFallback(fn) {
|
|
window.setTimeout(fn, 0);
|
|
};
|
|
})();
|
|
}
|
|
|
|
if (!window.clearImmediate) {
|
|
window.clearImmediate = (function setupClearImmediate() {
|
|
return window.msClearImmediate ||
|
|
window.webkitClearImmediate ||
|
|
window.mozClearImmediate ||
|
|
window.oClearImmediate ||
|
|
// "clearZeroTimeout" is implement on the previous block ||
|
|
// fallback
|
|
function clearImmediateFallback(timer) {
|
|
window.clearTimeout(timer);
|
|
};
|
|
})();
|
|
}
|
|
|
|
(function(global) {
|
|
|
|
// Check if WordCloud can run on this browser
|
|
var isSupported = (function isSupported() {
|
|
var canvas = document.createElement('canvas');
|
|
if (!canvas || !canvas.getContext) {
|
|
return false;
|
|
}
|
|
|
|
var ctx = canvas.getContext('2d');
|
|
if (!ctx.getImageData) {
|
|
return false;
|
|
}
|
|
if (!ctx.fillText) {
|
|
return false;
|
|
}
|
|
|
|
if (!Array.prototype.some) {
|
|
return false;
|
|
}
|
|
if (!Array.prototype.push) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}());
|
|
|
|
// Find out if the browser impose minium font size by
|
|
// drawing small texts on a canvas and measure it's width.
|
|
var minFontSize = (function getMinFontSize() {
|
|
if (!isSupported) {
|
|
return;
|
|
}
|
|
|
|
var ctx = document.createElement('canvas').getContext('2d');
|
|
|
|
// start from 20
|
|
var size = 20;
|
|
|
|
// two sizes to measure
|
|
var hanWidth, mWidth;
|
|
|
|
while (size) {
|
|
ctx.font = size.toString(10) + 'px sans-serif';
|
|
if ((ctx.measureText('\uFF37').width === hanWidth) &&
|
|
(ctx.measureText('m').width) === mWidth) {
|
|
return (size + 1);
|
|
}
|
|
|
|
hanWidth = ctx.measureText('\uFF37').width;
|
|
mWidth = ctx.measureText('m').width;
|
|
|
|
size--;
|
|
}
|
|
|
|
return 0;
|
|
})();
|
|
|
|
// Based on http://jsfromhell.com/array/shuffle
|
|
var shuffleArray = function shuffleArray(arr) {
|
|
for (var j, x, i = arr.length; i;
|
|
j = Math.floor(Math.random() * i),
|
|
x = arr[--i], arr[i] = arr[j],
|
|
arr[j] = x) {}
|
|
return arr;
|
|
};
|
|
|
|
var WordCloud = function WordCloud(elements, options) {
|
|
if (!isSupported) {
|
|
return;
|
|
}
|
|
|
|
if (!Array.isArray(elements)) {
|
|
elements = [elements];
|
|
}
|
|
|
|
elements.forEach(function(el, i) {
|
|
if (typeof el === 'string') {
|
|
elements[i] = document.getElementById(el);
|
|
if (!elements[i]) {
|
|
throw 'The element id specified is not found.';
|
|
}
|
|
} else if (!el.tagName && !el.appendChild) {
|
|
throw 'You must pass valid HTML elements, or ID of the element.';
|
|
}
|
|
});
|
|
|
|
/* Default values to be overwritten by options object */
|
|
var settings = {
|
|
list: [],
|
|
fontFamily: '"Trebuchet MS", "Heiti TC", "微軟正黑體", ' +
|
|
'"Arial Unicode MS", "Droid Fallback Sans", sans-serif',
|
|
fontWeight: 'normal',
|
|
color: 'random-dark',
|
|
minSize: 0, // 0 to disable
|
|
weightFactor: 1,
|
|
clearCanvas: true,
|
|
backgroundColor: '#fff', // opaque white = rgba(255, 255, 255, 1)
|
|
|
|
gridSize: 8,
|
|
drawOutOfBound: false,
|
|
origin: null,
|
|
|
|
drawMask: false,
|
|
maskColor: 'rgba(255,0,0,0.3)',
|
|
maskGapWidth: 0.3,
|
|
|
|
wait: 0,
|
|
abortThreshold: 0, // disabled
|
|
abort: function noop() {},
|
|
|
|
minRotation: - Math.PI / 2,
|
|
maxRotation: Math.PI / 2,
|
|
rotationStep: 0.1,
|
|
|
|
shuffle: true,
|
|
rotateRatio: 0.1,
|
|
|
|
shape: 'circle',
|
|
ellipticity: 0.65,
|
|
|
|
classes: null,
|
|
|
|
hover: null,
|
|
click: null
|
|
};
|
|
|
|
if (options) {
|
|
for (var key in options) {
|
|
if (key in settings) {
|
|
settings[key] = options[key];
|
|
}
|
|
}
|
|
}
|
|
|
|
/* Convert weightFactor into a function */
|
|
if (typeof settings.weightFactor !== 'function') {
|
|
var factor = settings.weightFactor;
|
|
settings.weightFactor = function weightFactor(pt) {
|
|
return pt * factor; //in px
|
|
};
|
|
}
|
|
|
|
/* Convert shape into a function */
|
|
if (typeof settings.shape !== 'function') {
|
|
switch (settings.shape) {
|
|
case 'circle':
|
|
/* falls through */
|
|
default:
|
|
// 'circle' is the default and a shortcut in the code loop.
|
|
settings.shape = 'circle';
|
|
break;
|
|
|
|
case 'cardioid':
|
|
settings.shape = function shapeCardioid(theta) {
|
|
return 1 - Math.sin(theta);
|
|
};
|
|
break;
|
|
|
|
/*
|
|
To work out an X-gon, one has to calculate "m",
|
|
where 1/(cos(2*PI/X)+m*sin(2*PI/X)) = 1/(cos(0)+m*sin(0))
|
|
http://www.wolframalpha.com/input/?i=1%2F%28cos%282*PI%2FX%29%2Bm*sin%28
|
|
2*PI%2FX%29%29+%3D+1%2F%28cos%280%29%2Bm*sin%280%29%29
|
|
Copy the solution into polar equation r = 1/(cos(t') + m*sin(t'))
|
|
where t' equals to mod(t, 2PI/X);
|
|
*/
|
|
|
|
case 'diamond':
|
|
case 'square':
|
|
// http://www.wolframalpha.com/input/?i=plot+r+%3D+1%2F%28cos%28mod+
|
|
// %28t%2C+PI%2F2%29%29%2Bsin%28mod+%28t%2C+PI%2F2%29%29%29%2C+t+%3D
|
|
// +0+..+2*PI
|
|
settings.shape = function shapeSquare(theta) {
|
|
var thetaPrime = theta % (2 * Math.PI / 4);
|
|
return 1 / (Math.cos(thetaPrime) + Math.sin(thetaPrime));
|
|
};
|
|
break;
|
|
|
|
case 'triangle-forward':
|
|
// http://www.wolframalpha.com/input/?i=plot+r+%3D+1%2F%28cos%28mod+
|
|
// %28t%2C+2*PI%2F3%29%29%2Bsqrt%283%29sin%28mod+%28t%2C+2*PI%2F3%29
|
|
// %29%29%2C+t+%3D+0+..+2*PI
|
|
settings.shape = function shapeTriangle(theta) {
|
|
var thetaPrime = theta % (2 * Math.PI / 3);
|
|
return 1 / (Math.cos(thetaPrime) +
|
|
Math.sqrt(3) * Math.sin(thetaPrime));
|
|
};
|
|
break;
|
|
|
|
case 'triangle':
|
|
case 'triangle-upright':
|
|
settings.shape = function shapeTriangle(theta) {
|
|
var thetaPrime = (theta + Math.PI * 3 / 2) % (2 * Math.PI / 3);
|
|
return 1 / (Math.cos(thetaPrime) +
|
|
Math.sqrt(3) * Math.sin(thetaPrime));
|
|
};
|
|
break;
|
|
|
|
case 'pentagon':
|
|
settings.shape = function shapePentagon(theta) {
|
|
var thetaPrime = (theta + 0.955) % (2 * Math.PI / 5);
|
|
return 1 / (Math.cos(thetaPrime) +
|
|
0.726543 * Math.sin(thetaPrime));
|
|
};
|
|
break;
|
|
|
|
case 'star':
|
|
settings.shape = function shapeStar(theta) {
|
|
var thetaPrime = (theta + 0.955) % (2 * Math.PI / 10);
|
|
if ((theta + 0.955) % (2 * Math.PI / 5) - (2 * Math.PI / 10) >= 0) {
|
|
return 1 / (Math.cos((2 * Math.PI / 10) - thetaPrime) +
|
|
3.07768 * Math.sin((2 * Math.PI / 10) - thetaPrime));
|
|
} else {
|
|
return 1 / (Math.cos(thetaPrime) +
|
|
3.07768 * Math.sin(thetaPrime));
|
|
}
|
|
};
|
|
break;
|
|
}
|
|
}
|
|
|
|
/* Make sure gridSize is a whole number and is not smaller than 4px */
|
|
settings.gridSize = Math.max(Math.floor(settings.gridSize), 4);
|
|
|
|
/* shorthand */
|
|
var g = settings.gridSize;
|
|
var maskRectWidth = g - settings.maskGapWidth;
|
|
|
|
/* normalize rotation settings */
|
|
var rotationRange = Math.abs(settings.maxRotation - settings.minRotation);
|
|
var minRotation = Math.min(settings.maxRotation, settings.minRotation);
|
|
var rotationStep = settings.rotationStep;
|
|
|
|
/* information/object available to all functions, set when start() */
|
|
var grid, // 2d array containing filling information
|
|
ngx, ngy, // width and height of the grid
|
|
center, // position of the center of the cloud
|
|
maxRadius;
|
|
|
|
/* timestamp for measuring each putWord() action */
|
|
var escapeTime;
|
|
|
|
/* function for getting the color of the text */
|
|
var getTextColor;
|
|
function random_hsl_color(min, max) {
|
|
return 'hsl(' +
|
|
(Math.random() * 360).toFixed() + ',' +
|
|
(Math.random() * 30 + 70).toFixed() + '%,' +
|
|
(Math.random() * (max - min) + min).toFixed() + '%)';
|
|
}
|
|
switch (settings.color) {
|
|
case 'random-dark':
|
|
getTextColor = function getRandomDarkColor() {
|
|
return random_hsl_color(10, 50);
|
|
};
|
|
break;
|
|
|
|
case 'random-light':
|
|
getTextColor = function getRandomLightColor() {
|
|
return random_hsl_color(50, 90);
|
|
};
|
|
break;
|
|
|
|
default:
|
|
if (typeof settings.color === 'function') {
|
|
getTextColor = settings.color;
|
|
}
|
|
break;
|
|
}
|
|
|
|
/* function for getting the classes of the text */
|
|
var getTextClasses = null;
|
|
if (typeof settings.classes === 'function') {
|
|
getTextClasses = settings.classes;
|
|
}
|
|
|
|
/* Interactive */
|
|
var interactive = false;
|
|
var infoGrid = [];
|
|
var hovered;
|
|
|
|
var getInfoGridFromMouseTouchEvent =
|
|
function getInfoGridFromMouseTouchEvent(evt) {
|
|
var canvas = evt.currentTarget;
|
|
var rect = canvas.getBoundingClientRect();
|
|
var clientX;
|
|
var clientY;
|
|
/** Detect if touches are available */
|
|
if (evt.touches) {
|
|
clientX = evt.touches[0].clientX;
|
|
clientY = evt.touches[0].clientY;
|
|
} else {
|
|
clientX = evt.clientX;
|
|
clientY = evt.clientY;
|
|
}
|
|
var eventX = clientX - rect.left;
|
|
var eventY = clientY - rect.top;
|
|
|
|
var x = Math.floor(eventX * ((canvas.width / rect.width) || 1) / g);
|
|
var y = Math.floor(eventY * ((canvas.height / rect.height) || 1) / g);
|
|
|
|
return infoGrid[x][y];
|
|
};
|
|
|
|
var wordcloudhover = function wordcloudhover(evt) {
|
|
var info = getInfoGridFromMouseTouchEvent(evt);
|
|
|
|
if (hovered === info) {
|
|
return;
|
|
}
|
|
|
|
hovered = info;
|
|
if (!info) {
|
|
settings.hover(undefined, undefined, evt);
|
|
|
|
return;
|
|
}
|
|
|
|
settings.hover(info.item, info.dimension, evt);
|
|
|
|
};
|
|
|
|
var wordcloudclick = function wordcloudclick(evt) {
|
|
var info = getInfoGridFromMouseTouchEvent(evt);
|
|
if (!info) {
|
|
return;
|
|
}
|
|
|
|
settings.click(info.item, info.dimension, evt);
|
|
evt.preventDefault();
|
|
};
|
|
|
|
/* Get points on the grid for a given radius away from the center */
|
|
var pointsAtRadius = [];
|
|
var getPointsAtRadius = function getPointsAtRadius(radius) {
|
|
if (pointsAtRadius[radius]) {
|
|
return pointsAtRadius[radius];
|
|
}
|
|
|
|
// Look for these number of points on each radius
|
|
var T = radius * 8;
|
|
|
|
// Getting all the points at this radius
|
|
var t = T;
|
|
var points = [];
|
|
|
|
if (radius === 0) {
|
|
points.push([center[0], center[1], 0]);
|
|
}
|
|
|
|
while (t--) {
|
|
// distort the radius to put the cloud in shape
|
|
var rx = 1;
|
|
if (settings.shape !== 'circle') {
|
|
rx = settings.shape(t / T * 2 * Math.PI); // 0 to 1
|
|
}
|
|
|
|
// Push [x, y, t]; t is used solely for getTextColor()
|
|
points.push([
|
|
center[0] + radius * rx * Math.cos(-t / T * 2 * Math.PI),
|
|
center[1] + radius * rx * Math.sin(-t / T * 2 * Math.PI) *
|
|
settings.ellipticity,
|
|
t / T * 2 * Math.PI]);
|
|
}
|
|
|
|
pointsAtRadius[radius] = points;
|
|
return points;
|
|
};
|
|
|
|
/* Return true if we had spent too much time */
|
|
var exceedTime = function exceedTime() {
|
|
return ((settings.abortThreshold > 0) &&
|
|
((new Date()).getTime() - escapeTime > settings.abortThreshold));
|
|
};
|
|
|
|
/* Get the deg of rotation according to settings, and luck. */
|
|
var getRotateDeg = function getRotateDeg() {
|
|
if (settings.rotateRatio === 0) {
|
|
return 0;
|
|
}
|
|
|
|
if (Math.random() > settings.rotateRatio) {
|
|
return 0;
|
|
}
|
|
|
|
if (rotationRange === 0) {
|
|
return minRotation;
|
|
}
|
|
|
|
return minRotation + Math.round(Math.random() * rotationRange / rotationStep) * rotationStep;
|
|
};
|
|
|
|
var getTextInfo = function getTextInfo(word, weight, rotateDeg) {
|
|
// calculate the acutal font size
|
|
// fontSize === 0 means weightFactor function wants the text skipped,
|
|
// and size < minSize means we cannot draw the text.
|
|
var debug = false;
|
|
var fontSize = settings.weightFactor(weight);
|
|
if (fontSize <= settings.minSize) {
|
|
return false;
|
|
}
|
|
|
|
// Scale factor here is to make sure fillText is not limited by
|
|
// the minium font size set by browser.
|
|
// It will always be 1 or 2n.
|
|
var mu = 1;
|
|
if (fontSize < minFontSize) {
|
|
mu = (function calculateScaleFactor() {
|
|
var mu = 2;
|
|
while (mu * fontSize < minFontSize) {
|
|
mu += 2;
|
|
}
|
|
return mu;
|
|
})();
|
|
}
|
|
|
|
var fcanvas = document.createElement('canvas');
|
|
var fctx = fcanvas.getContext('2d', { willReadFrequently: true });
|
|
|
|
fctx.font = settings.fontWeight + ' ' +
|
|
(fontSize * mu).toString(10) + 'px ' + settings.fontFamily;
|
|
|
|
// Estimate the dimension of the text with measureText().
|
|
var fw = fctx.measureText(word).width / mu;
|
|
var fh = Math.max(fontSize * mu,
|
|
fctx.measureText('m').width,
|
|
fctx.measureText('\uFF37').width) / mu;
|
|
|
|
// Create a boundary box that is larger than our estimates,
|
|
// so text don't get cut of (it sill might)
|
|
var boxWidth = fw + fh * 2;
|
|
var boxHeight = fh * 3;
|
|
var fgw = Math.ceil(boxWidth / g);
|
|
var fgh = Math.ceil(boxHeight / g);
|
|
boxWidth = fgw * g;
|
|
boxHeight = fgh * g;
|
|
|
|
// Calculate the proper offsets to make the text centered at
|
|
// the preferred position.
|
|
|
|
// This is simply half of the width.
|
|
var fillTextOffsetX = - fw / 2;
|
|
// Instead of moving the box to the exact middle of the preferred
|
|
// position, for Y-offset we move 0.4 instead, so Latin alphabets look
|
|
// vertical centered.
|
|
var fillTextOffsetY = - fh * 0.4;
|
|
|
|
// Calculate the actual dimension of the canvas, considering the rotation.
|
|
var cgh = Math.ceil((boxWidth * Math.abs(Math.sin(rotateDeg)) +
|
|
boxHeight * Math.abs(Math.cos(rotateDeg))) / g);
|
|
var cgw = Math.ceil((boxWidth * Math.abs(Math.cos(rotateDeg)) +
|
|
boxHeight * Math.abs(Math.sin(rotateDeg))) / g);
|
|
var width = cgw * g;
|
|
var height = cgh * g;
|
|
|
|
fcanvas.setAttribute('width', width);
|
|
fcanvas.setAttribute('height', height);
|
|
|
|
if (debug) {
|
|
// Attach fcanvas to the DOM
|
|
document.body.appendChild(fcanvas);
|
|
// Save it's state so that we could restore and draw the grid correctly.
|
|
fctx.save();
|
|
}
|
|
|
|
// Scale the canvas with |mu|.
|
|
fctx.scale(1 / mu, 1 / mu);
|
|
fctx.translate(width * mu / 2, height * mu / 2);
|
|
fctx.rotate(- rotateDeg);
|
|
|
|
// Once the width/height is set, ctx info will be reset.
|
|
// Set it again here.
|
|
fctx.font = settings.fontWeight + ' ' +
|
|
(fontSize * mu).toString(10) + 'px ' + settings.fontFamily;
|
|
|
|
// Fill the text into the fcanvas.
|
|
// XXX: We cannot because textBaseline = 'top' here because
|
|
// Firefox and Chrome uses different default line-height for canvas.
|
|
// Please read https://bugzil.la/737852#c6.
|
|
// Here, we use textBaseline = 'middle' and draw the text at exactly
|
|
// 0.5 * fontSize lower.
|
|
fctx.fillStyle = '#000';
|
|
fctx.textBaseline = 'middle';
|
|
fctx.fillText(word, fillTextOffsetX * mu,
|
|
(fillTextOffsetY + fontSize * 0.5) * mu);
|
|
|
|
// Get the pixels of the text
|
|
var imageData = fctx.getImageData(0, 0, width, height).data;
|
|
|
|
if (exceedTime()) {
|
|
return false;
|
|
}
|
|
|
|
if (debug) {
|
|
// Draw the box of the original estimation
|
|
fctx.strokeRect(fillTextOffsetX * mu,
|
|
fillTextOffsetY, fw * mu, fh * mu);
|
|
fctx.restore();
|
|
}
|
|
|
|
// Read the pixels and save the information to the occupied array
|
|
var occupied = [];
|
|
var gx = cgw, gy, x, y;
|
|
var bounds = [cgh / 2, cgw / 2, cgh / 2, cgw / 2];
|
|
while (gx--) {
|
|
gy = cgh;
|
|
while (gy--) {
|
|
y = g;
|
|
singleGridLoop: {
|
|
while (y--) {
|
|
x = g;
|
|
while (x--) {
|
|
if (imageData[((gy * g + y) * width +
|
|
(gx * g + x)) * 4 + 3]) {
|
|
occupied.push([gx, gy]);
|
|
|
|
if (gx < bounds[3]) {
|
|
bounds[3] = gx;
|
|
}
|
|
if (gx > bounds[1]) {
|
|
bounds[1] = gx;
|
|
}
|
|
if (gy < bounds[0]) {
|
|
bounds[0] = gy;
|
|
}
|
|
if (gy > bounds[2]) {
|
|
bounds[2] = gy;
|
|
}
|
|
|
|
if (debug) {
|
|
fctx.fillStyle = 'rgba(255, 0, 0, 0.5)';
|
|
fctx.fillRect(gx * g, gy * g, g - 0.5, g - 0.5);
|
|
}
|
|
break singleGridLoop;
|
|
}
|
|
}
|
|
}
|
|
if (debug) {
|
|
fctx.fillStyle = 'rgba(0, 0, 255, 0.5)';
|
|
fctx.fillRect(gx * g, gy * g, g - 0.5, g - 0.5);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (debug) {
|
|
fctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
|
|
fctx.fillRect(bounds[3] * g,
|
|
bounds[0] * g,
|
|
(bounds[1] - bounds[3] + 1) * g,
|
|
(bounds[2] - bounds[0] + 1) * g);
|
|
}
|
|
|
|
// Return information needed to create the text on the real canvas
|
|
return {
|
|
mu: mu,
|
|
occupied: occupied,
|
|
bounds: bounds,
|
|
gw: cgw,
|
|
gh: cgh,
|
|
fillTextOffsetX: fillTextOffsetX,
|
|
fillTextOffsetY: fillTextOffsetY,
|
|
fillTextWidth: fw,
|
|
fillTextHeight: fh,
|
|
fontSize: fontSize
|
|
};
|
|
};
|
|
|
|
/* Determine if there is room available in the given dimension */
|
|
var canFitText = function canFitText(gx, gy, gw, gh, occupied) {
|
|
// Go through the occupied points,
|
|
// return false if the space is not available.
|
|
var i = occupied.length;
|
|
while (i--) {
|
|
var px = gx + occupied[i][0];
|
|
var py = gy + occupied[i][1];
|
|
|
|
if (px >= ngx || py >= ngy || px < 0 || py < 0) {
|
|
if (!settings.drawOutOfBound) {
|
|
return false;
|
|
}
|
|
continue;
|
|
}
|
|
|
|
if (!grid[px][py]) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
};
|
|
|
|
/* Actually draw the text on the grid */
|
|
var drawText = function drawText(gx, gy, info, word, weight,
|
|
distance, theta, rotateDeg, attributes) {
|
|
|
|
var fontSize = info.fontSize;
|
|
var color;
|
|
if (getTextColor) {
|
|
color = getTextColor(word, weight, fontSize, distance, theta);
|
|
} else {
|
|
color = settings.color;
|
|
}
|
|
|
|
var classes;
|
|
if (getTextClasses) {
|
|
classes = getTextClasses(word, weight, fontSize, distance, theta);
|
|
} else {
|
|
classes = settings.classes;
|
|
}
|
|
|
|
var dimension;
|
|
var bounds = info.bounds;
|
|
dimension = {
|
|
x: (gx + bounds[3]) * g,
|
|
y: (gy + bounds[0]) * g,
|
|
w: (bounds[1] - bounds[3] + 1) * g,
|
|
h: (bounds[2] - bounds[0] + 1) * g
|
|
};
|
|
|
|
elements.forEach(function(el) {
|
|
if (el.getContext) {
|
|
var ctx = el.getContext('2d');
|
|
var mu = info.mu;
|
|
|
|
// Save the current state before messing it
|
|
ctx.save();
|
|
ctx.scale(1 / mu, 1 / mu);
|
|
|
|
ctx.font = settings.fontWeight + ' ' +
|
|
(fontSize * mu).toString(10) + 'px ' + settings.fontFamily;
|
|
ctx.fillStyle = color;
|
|
|
|
// Translate the canvas position to the origin coordinate of where
|
|
// the text should be put.
|
|
ctx.translate((gx + info.gw / 2) * g * mu,
|
|
(gy + info.gh / 2) * g * mu);
|
|
|
|
if (rotateDeg !== 0) {
|
|
ctx.rotate(- rotateDeg);
|
|
}
|
|
|
|
// Finally, fill the text.
|
|
|
|
// XXX: We cannot because textBaseline = 'top' here because
|
|
// Firefox and Chrome uses different default line-height for canvas.
|
|
// Please read https://bugzil.la/737852#c6.
|
|
// Here, we use textBaseline = 'middle' and draw the text at exactly
|
|
// 0.5 * fontSize lower.
|
|
ctx.textBaseline = 'middle';
|
|
ctx.fillText(word, info.fillTextOffsetX * mu,
|
|
(info.fillTextOffsetY + fontSize * 0.5) * mu);
|
|
|
|
// The below box is always matches how <span>s are positioned
|
|
/* ctx.strokeRect(info.fillTextOffsetX, info.fillTextOffsetY,
|
|
info.fillTextWidth, info.fillTextHeight); */
|
|
|
|
// Restore the state.
|
|
ctx.restore();
|
|
} else {
|
|
// drawText on DIV element
|
|
var span = document.createElement('span');
|
|
var transformRule = '';
|
|
transformRule = 'rotate(' + (- rotateDeg / Math.PI * 180) + 'deg) ';
|
|
if (info.mu !== 1) {
|
|
transformRule +=
|
|
'translateX(-' + (info.fillTextWidth / 4) + 'px) ' +
|
|
'scale(' + (1 / info.mu) + ')';
|
|
}
|
|
var styleRules = {
|
|
'position': 'absolute',
|
|
'display': 'block',
|
|
'font': settings.fontWeight + ' ' +
|
|
(fontSize * info.mu) + 'px ' + settings.fontFamily,
|
|
'left': ((gx + info.gw / 2) * g + info.fillTextOffsetX) + 'px',
|
|
'top': ((gy + info.gh / 2) * g + info.fillTextOffsetY) + 'px',
|
|
'width': info.fillTextWidth + 'px',
|
|
'height': info.fillTextHeight + 'px',
|
|
'lineHeight': fontSize + 'px',
|
|
'whiteSpace': 'nowrap',
|
|
'transform': transformRule,
|
|
'webkitTransform': transformRule,
|
|
'msTransform': transformRule,
|
|
'transformOrigin': '50% 40%',
|
|
'webkitTransformOrigin': '50% 40%',
|
|
'msTransformOrigin': '50% 40%'
|
|
};
|
|
if (color) {
|
|
styleRules.color = color;
|
|
}
|
|
span.textContent = word;
|
|
for (var cssProp in styleRules) {
|
|
span.style[cssProp] = styleRules[cssProp];
|
|
}
|
|
if (attributes) {
|
|
for (var attribute in attributes) {
|
|
span.setAttribute(attribute, attributes[attribute]);
|
|
}
|
|
}
|
|
if (classes) {
|
|
span.className += classes;
|
|
}
|
|
el.appendChild(span);
|
|
}
|
|
});
|
|
};
|
|
|
|
/* Help function to updateGrid */
|
|
var fillGridAt = function fillGridAt(x, y, drawMask, dimension, item) {
|
|
if (x >= ngx || y >= ngy || x < 0 || y < 0) {
|
|
return;
|
|
}
|
|
|
|
grid[x][y] = false;
|
|
|
|
if (drawMask) {
|
|
var ctx = elements[0].getContext('2d');
|
|
ctx.fillRect(x * g, y * g, maskRectWidth, maskRectWidth);
|
|
}
|
|
|
|
if (interactive) {
|
|
infoGrid[x][y] = { item: item, dimension: dimension };
|
|
}
|
|
};
|
|
|
|
/* Update the filling information of the given space with occupied points.
|
|
Draw the mask on the canvas if necessary. */
|
|
var updateGrid = function updateGrid(gx, gy, gw, gh, info, item) {
|
|
var occupied = info.occupied;
|
|
var drawMask = settings.drawMask;
|
|
var ctx;
|
|
if (drawMask) {
|
|
ctx = elements[0].getContext('2d');
|
|
ctx.save();
|
|
ctx.fillStyle = settings.maskColor;
|
|
}
|
|
|
|
var dimension;
|
|
if (interactive) {
|
|
var bounds = info.bounds;
|
|
dimension = {
|
|
x: (gx + bounds[3]) * g,
|
|
y: (gy + bounds[0]) * g,
|
|
w: (bounds[1] - bounds[3] + 1) * g,
|
|
h: (bounds[2] - bounds[0] + 1) * g
|
|
};
|
|
}
|
|
|
|
var i = occupied.length;
|
|
while (i--) {
|
|
var px = gx + occupied[i][0];
|
|
var py = gy + occupied[i][1];
|
|
|
|
if (px >= ngx || py >= ngy || px < 0 || py < 0) {
|
|
continue;
|
|
}
|
|
|
|
fillGridAt(px, py, drawMask, dimension, item);
|
|
}
|
|
|
|
if (drawMask) {
|
|
ctx.restore();
|
|
}
|
|
};
|
|
|
|
/* putWord() processes each item on the list,
|
|
calculate it's size and determine it's position, and actually
|
|
put it on the canvas. */
|
|
var putWord = function putWord(item) {
|
|
var word, weight, attributes;
|
|
if (Array.isArray(item)) {
|
|
word = item[0];
|
|
weight = item[1];
|
|
} else {
|
|
word = item.word;
|
|
weight = item.weight;
|
|
attributes = item.attributes;
|
|
}
|
|
var rotateDeg = getRotateDeg();
|
|
|
|
// get info needed to put the text onto the canvas
|
|
var info = getTextInfo(word, weight, rotateDeg);
|
|
|
|
// not getting the info means we shouldn't be drawing this one.
|
|
if (!info) {
|
|
return false;
|
|
}
|
|
|
|
if (exceedTime()) {
|
|
return false;
|
|
}
|
|
|
|
// If drawOutOfBound is set to false,
|
|
// skip the loop if we have already know the bounding box of
|
|
// word is larger than the canvas.
|
|
if (!settings.drawOutOfBound) {
|
|
var bounds = info.bounds;
|
|
if ((bounds[1] - bounds[3] + 1) > ngx ||
|
|
(bounds[2] - bounds[0] + 1) > ngy) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
// Determine the position to put the text by
|
|
// start looking for the nearest points
|
|
var r = maxRadius + 1;
|
|
|
|
var tryToPutWordAtPoint = function(gxy) {
|
|
var gx = Math.floor(gxy[0] - info.gw / 2);
|
|
var gy = Math.floor(gxy[1] - info.gh / 2);
|
|
var gw = info.gw;
|
|
var gh = info.gh;
|
|
|
|
// If we cannot fit the text at this position, return false
|
|
// and go to the next position.
|
|
if (!canFitText(gx, gy, gw, gh, info.occupied)) {
|
|
return false;
|
|
}
|
|
|
|
// Actually put the text on the canvas
|
|
drawText(gx, gy, info, word, weight,
|
|
(maxRadius - r), gxy[2], rotateDeg, attributes);
|
|
|
|
// Mark the spaces on the grid as filled
|
|
updateGrid(gx, gy, gw, gh, info, item);
|
|
|
|
return {
|
|
gx: gx,
|
|
gy: gy,
|
|
rot: rotateDeg,
|
|
info: info
|
|
};
|
|
};
|
|
|
|
while (r--) {
|
|
var points = getPointsAtRadius(maxRadius - r);
|
|
|
|
if (settings.shuffle) {
|
|
points = [].concat(points);
|
|
shuffleArray(points);
|
|
}
|
|
|
|
// Try to fit the words by looking at each point.
|
|
// array.some() will stop and return true
|
|
// when putWordAtPoint() returns true.
|
|
for (var i = 0; i < points.length; i++) {
|
|
var res = tryToPutWordAtPoint(points[i]);
|
|
if (res) {
|
|
return res;
|
|
}
|
|
}
|
|
|
|
// var drawn = points.some(tryToPutWordAtPoint);
|
|
// if (drawn) {
|
|
// // leave putWord() and return true
|
|
// return true;
|
|
// }
|
|
}
|
|
// we tried all distances but text won't fit, return null
|
|
return null;
|
|
};
|
|
|
|
/* Send DOM event to all elements. Will stop sending event and return
|
|
if the previous one is canceled (for cancelable events). */
|
|
var sendEvent = function sendEvent(type, cancelable, detail) {
|
|
if (cancelable) {
|
|
return !elements.some(function(el) {
|
|
var evt = document.createEvent('CustomEvent');
|
|
evt.initCustomEvent(type, true, cancelable, detail || {});
|
|
return !el.dispatchEvent(evt);
|
|
}, this);
|
|
} else {
|
|
elements.forEach(function(el) {
|
|
var evt = document.createEvent('CustomEvent');
|
|
evt.initCustomEvent(type, true, cancelable, detail || {});
|
|
el.dispatchEvent(evt);
|
|
}, this);
|
|
}
|
|
};
|
|
|
|
/* Start drawing on a canvas */
|
|
var start = function start() {
|
|
// For dimensions, clearCanvas etc.,
|
|
// we only care about the first element.
|
|
var canvas = elements[0];
|
|
|
|
if (canvas.getContext) {
|
|
ngx = Math.ceil(canvas.width / g);
|
|
ngy = Math.ceil(canvas.height / g);
|
|
} else {
|
|
var rect = canvas.getBoundingClientRect();
|
|
ngx = Math.ceil(rect.width / g);
|
|
ngy = Math.ceil(rect.height / g);
|
|
}
|
|
|
|
// Sending a wordcloudstart event which cause the previous loop to stop.
|
|
// Do nothing if the event is canceled.
|
|
if (!sendEvent('wordcloudstart', true)) {
|
|
return;
|
|
}
|
|
|
|
// Determine the center of the word cloud
|
|
center = (settings.origin) ?
|
|
[settings.origin[0]/g, settings.origin[1]/g] :
|
|
[ngx / 2, ngy / 2];
|
|
|
|
// Maxium radius to look for space
|
|
maxRadius = Math.floor(Math.sqrt(ngx * ngx + ngy * ngy));
|
|
|
|
/* Clear the canvas only if the clearCanvas is set,
|
|
if not, update the grid to the current canvas state */
|
|
grid = [];
|
|
|
|
var gx, gy, i;
|
|
if (!canvas.getContext || settings.clearCanvas) {
|
|
elements.forEach(function(el) {
|
|
if (el.getContext) {
|
|
var ctx = el.getContext('2d');
|
|
ctx.fillStyle = settings.backgroundColor;
|
|
ctx.clearRect(0, 0, ngx * (g + 1), ngy * (g + 1));
|
|
ctx.fillRect(0, 0, ngx * (g + 1), ngy * (g + 1));
|
|
} else {
|
|
el.textContent = '';
|
|
el.style.backgroundColor = settings.backgroundColor;
|
|
el.style.position = 'relative';
|
|
}
|
|
});
|
|
|
|
/* fill the grid with empty state */
|
|
gx = ngx;
|
|
while (gx--) {
|
|
grid[gx] = [];
|
|
gy = ngy;
|
|
while (gy--) {
|
|
grid[gx][gy] = true;
|
|
}
|
|
}
|
|
} else {
|
|
/* Determine bgPixel by creating
|
|
another canvas and fill the specified background color. */
|
|
var bctx = document.createElement('canvas').getContext('2d');
|
|
|
|
bctx.fillStyle = settings.backgroundColor;
|
|
bctx.fillRect(0, 0, 1, 1);
|
|
var bgPixel = bctx.getImageData(0, 0, 1, 1).data;
|
|
|
|
/* Read back the pixels of the canvas we got to tell which part of the
|
|
canvas is empty.
|
|
(no clearCanvas only works with a canvas, not divs) */
|
|
var imageData =
|
|
canvas.getContext('2d').getImageData(0, 0, ngx * g, ngy * g).data;
|
|
|
|
gx = ngx;
|
|
var x, y;
|
|
while (gx--) {
|
|
grid[gx] = [];
|
|
gy = ngy;
|
|
while (gy--) {
|
|
y = g;
|
|
singleGridLoop: while (y--) {
|
|
x = g;
|
|
while (x--) {
|
|
i = 4;
|
|
while (i--) {
|
|
if (imageData[((gy * g + y) * ngx * g +
|
|
(gx * g + x)) * 4 + i] !== bgPixel[i]) {
|
|
grid[gx][gy] = false;
|
|
break singleGridLoop;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (grid[gx][gy] !== false) {
|
|
grid[gx][gy] = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
imageData = bctx = bgPixel = undefined;
|
|
}
|
|
|
|
// fill the infoGrid with empty state if we need it
|
|
if (settings.hover || settings.click) {
|
|
|
|
interactive = true;
|
|
|
|
/* fill the grid with empty state */
|
|
gx = ngx + 1;
|
|
while (gx--) {
|
|
infoGrid[gx] = [];
|
|
}
|
|
|
|
if (settings.hover) {
|
|
canvas.addEventListener('mousemove', wordcloudhover);
|
|
}
|
|
|
|
if (settings.click) {
|
|
canvas.addEventListener('click', wordcloudclick);
|
|
canvas.addEventListener('touchstart', wordcloudclick);
|
|
canvas.addEventListener('touchend', function (e) {
|
|
e.preventDefault();
|
|
});
|
|
canvas.style.webkitTapHighlightColor = 'rgba(0, 0, 0, 0)';
|
|
}
|
|
|
|
canvas.addEventListener('wordcloudstart', function stopInteraction() {
|
|
canvas.removeEventListener('wordcloudstart', stopInteraction);
|
|
|
|
canvas.removeEventListener('mousemove', wordcloudhover);
|
|
canvas.removeEventListener('click', wordcloudclick);
|
|
hovered = undefined;
|
|
});
|
|
}
|
|
|
|
i = 0;
|
|
var loopingFunction, stoppingFunction;
|
|
if (settings.wait !== 0) {
|
|
loopingFunction = window.setTimeout;
|
|
stoppingFunction = window.clearTimeout;
|
|
} else {
|
|
loopingFunction = window.setImmediate;
|
|
stoppingFunction = window.clearImmediate;
|
|
}
|
|
|
|
var addEventListener = function addEventListener(type, listener) {
|
|
elements.forEach(function(el) {
|
|
el.addEventListener(type, listener);
|
|
}, this);
|
|
};
|
|
|
|
var removeEventListener = function removeEventListener(type, listener) {
|
|
elements.forEach(function(el) {
|
|
el.removeEventListener(type, listener);
|
|
}, this);
|
|
};
|
|
|
|
var anotherWordCloudStart = function anotherWordCloudStart() {
|
|
removeEventListener('wordcloudstart', anotherWordCloudStart);
|
|
stoppingFunction(timer);
|
|
};
|
|
|
|
addEventListener('wordcloudstart', anotherWordCloudStart);
|
|
|
|
var timer = loopingFunction(function loop() {
|
|
if (i >= settings.list.length) {
|
|
stoppingFunction(timer);
|
|
sendEvent('wordcloudstop', false);
|
|
removeEventListener('wordcloudstart', anotherWordCloudStart);
|
|
|
|
return;
|
|
}
|
|
escapeTime = (new Date()).getTime();
|
|
var drawn = putWord(settings.list[i]);
|
|
var canceled = !sendEvent('wordclouddrawn', true, {
|
|
item: settings.list[i], drawn: drawn });
|
|
if (exceedTime() || canceled) {
|
|
stoppingFunction(timer);
|
|
settings.abort();
|
|
sendEvent('wordcloudabort', false);
|
|
sendEvent('wordcloudstop', false);
|
|
removeEventListener('wordcloudstart', anotherWordCloudStart);
|
|
return;
|
|
}
|
|
i++;
|
|
timer = loopingFunction(loop, settings.wait);
|
|
}, settings.wait);
|
|
};
|
|
|
|
// All set, start the drawing
|
|
start();
|
|
};
|
|
|
|
WordCloud.isSupported = isSupported;
|
|
WordCloud.minFontSize = minFontSize;
|
|
|
|
// Expose the library as an AMD module
|
|
if (true) {
|
|
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { return WordCloud; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
|
|
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
} else {}
|
|
|
|
})(this); //jshint ignore:line
|
|
|
|
/***/ }),
|
|
|
|
/***/ 16896:
|
|
/*!**********************************************************************************!*\
|
|
!*** ./node_modules/_echarts-wordcloud@1.1.3@echarts-wordcloud/src/wordCloud.js ***!
|
|
\**********************************************************************************/
|
|
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
|
|
|
var echarts = __webpack_require__(/*! echarts/lib/echarts */ 3096);
|
|
var layoutUtil = __webpack_require__(/*! echarts/lib/util/layout */ 7357);
|
|
|
|
__webpack_require__(/*! ./WordCloudSeries */ 66607);
|
|
__webpack_require__(/*! ./WordCloudView */ 31041);
|
|
|
|
var wordCloudLayoutHelper = __webpack_require__(/*! ./layout */ 19131);
|
|
|
|
if (!wordCloudLayoutHelper.isSupported) {
|
|
throw new Error('Sorry your browser not support wordCloud');
|
|
}
|
|
|
|
// https://github.com/timdream/wordcloud2.js/blob/c236bee60436e048949f9becc4f0f67bd832dc5c/index.js#L233
|
|
function updateCanvasMask(maskCanvas) {
|
|
var ctx = maskCanvas.getContext('2d');
|
|
var imageData = ctx.getImageData(
|
|
0, 0, maskCanvas.width, maskCanvas.height);
|
|
var newImageData = ctx.createImageData(imageData);
|
|
|
|
var toneSum = 0;
|
|
var toneCnt = 0;
|
|
for (var i = 0; i < imageData.data.length; i += 4) {
|
|
var alpha = imageData.data[i + 3];
|
|
if (alpha > 128) {
|
|
var tone = imageData.data[i]
|
|
+ imageData.data[i + 1]
|
|
+ imageData.data[i + 2];
|
|
toneSum += tone;
|
|
++toneCnt;
|
|
}
|
|
}
|
|
var threshold = toneSum / toneCnt;
|
|
|
|
for (var i = 0; i < imageData.data.length; i += 4) {
|
|
var tone = imageData.data[i]
|
|
+ imageData.data[i + 1]
|
|
+ imageData.data[i + 2];
|
|
var alpha = imageData.data[i + 3];
|
|
|
|
if (alpha < 128 || tone > threshold) {
|
|
// Area not to draw
|
|
newImageData.data[i] = 0;
|
|
newImageData.data[i + 1] = 0;
|
|
newImageData.data[i + 2] = 0;
|
|
newImageData.data[i + 3] = 0;
|
|
}
|
|
else {
|
|
// Area to draw
|
|
// The color must be same with backgroundColor
|
|
newImageData.data[i] = 255;
|
|
newImageData.data[i + 1] = 255;
|
|
newImageData.data[i + 2] = 255;
|
|
newImageData.data[i + 3] = 255;
|
|
}
|
|
}
|
|
|
|
ctx.putImageData(newImageData, 0, 0);
|
|
}
|
|
|
|
echarts.registerLayout(function (ecModel, api) {
|
|
ecModel.eachSeriesByType('wordCloud', function (seriesModel) {
|
|
var gridRect = layoutUtil.getLayoutRect(
|
|
seriesModel.getBoxLayoutParams(), {
|
|
width: api.getWidth(),
|
|
height: api.getHeight()
|
|
}
|
|
);
|
|
var data = seriesModel.getData();
|
|
|
|
var canvas = document.createElement('canvas');
|
|
canvas.width = gridRect.width;
|
|
canvas.height = gridRect.height;
|
|
|
|
var ctx = canvas.getContext('2d');
|
|
var maskImage = seriesModel.get('maskImage');
|
|
if (maskImage) {
|
|
try {
|
|
ctx.drawImage(maskImage, 0, 0, canvas.width, canvas.height);
|
|
updateCanvasMask(canvas);
|
|
}
|
|
catch (e) {
|
|
console.error('Invalid mask image');
|
|
console.error(e.toString());
|
|
}
|
|
}
|
|
|
|
var sizeRange = seriesModel.get('sizeRange');
|
|
var rotationRange = seriesModel.get('rotationRange');
|
|
var valueExtent = data.getDataExtent('value');
|
|
|
|
var DEGREE_TO_RAD = Math.PI / 180;
|
|
var gridSize = seriesModel.get('gridSize');
|
|
wordCloudLayoutHelper(canvas, {
|
|
list: data.mapArray('value', function (value, idx) {
|
|
var itemModel = data.getItemModel(idx);
|
|
return [
|
|
data.getName(idx),
|
|
itemModel.get('textStyle.normal.textSize', true)
|
|
|| echarts.number.linearMap(value, valueExtent, sizeRange),
|
|
idx
|
|
];
|
|
}).sort(function (a, b) {
|
|
// Sort from large to small in case there is no more room for more words
|
|
return b[1] - a[1];
|
|
}),
|
|
fontFamily: seriesModel.get('textStyle.normal.fontFamily')
|
|
|| seriesModel.get('textStyle.emphasis.fontFamily')
|
|
|| ecModel.get('textStyle.fontFamily'),
|
|
fontWeight: seriesModel.get('textStyle.normal.fontWeight')
|
|
|| seriesModel.get('textStyle.emphasis.fontWeight')
|
|
|| ecModel.get('textStyle.fontWeight'),
|
|
gridSize: gridSize,
|
|
|
|
ellipticity: gridRect.height / gridRect.width,
|
|
|
|
minRotation: rotationRange[0] * DEGREE_TO_RAD,
|
|
maxRotation: rotationRange[1] * DEGREE_TO_RAD,
|
|
|
|
clearCanvas: !maskImage,
|
|
|
|
rotateRatio: 1,
|
|
|
|
rotationStep: seriesModel.get('rotationStep') * DEGREE_TO_RAD,
|
|
|
|
drawOutOfBound: seriesModel.get('drawOutOfBound'),
|
|
|
|
shuffle: false,
|
|
|
|
shape: seriesModel.get('shape')
|
|
});
|
|
|
|
function onWordCloudDrawn(e) {
|
|
var item = e.detail.item;
|
|
if (e.detail.drawn && seriesModel.layoutInstance.ondraw) {
|
|
e.detail.drawn.gx += gridRect.x / gridSize;
|
|
e.detail.drawn.gy += gridRect.y / gridSize;
|
|
seriesModel.layoutInstance.ondraw(
|
|
item[0], item[1], item[2], e.detail.drawn
|
|
);
|
|
}
|
|
}
|
|
|
|
canvas.addEventListener('wordclouddrawn', onWordCloudDrawn);
|
|
|
|
if (seriesModel.layoutInstance) {
|
|
// Dispose previous
|
|
seriesModel.layoutInstance.dispose();
|
|
}
|
|
|
|
seriesModel.layoutInstance = {
|
|
ondraw: null,
|
|
|
|
dispose: function () {
|
|
canvas.removeEventListener('wordclouddrawn', onWordCloudDrawn);
|
|
// Abort
|
|
canvas.addEventListener('wordclouddrawn', function (e) {
|
|
// Prevent default to cancle the event and stop the loop
|
|
e.preventDefault();
|
|
});
|
|
}
|
|
};
|
|
});
|
|
});
|
|
|
|
echarts.registerPreprocessor(function (option) {
|
|
var series = (option || {}).series;
|
|
!echarts.util.isArray(series) && (series = series ? [series] : []);
|
|
|
|
var compats = ['shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY'];
|
|
|
|
echarts.util.each(series, function (seriesItem) {
|
|
if (seriesItem && seriesItem.type === 'wordCloud') {
|
|
var textStyle = seriesItem.textStyle || {};
|
|
|
|
compatTextStyle(textStyle.normal);
|
|
compatTextStyle(textStyle.emphasis);
|
|
}
|
|
});
|
|
|
|
function compatTextStyle(textStyle) {
|
|
textStyle && echarts.util.each(compats, function (key) {
|
|
if (textStyle.hasOwnProperty(key)) {
|
|
textStyle['text' + echarts.format.capitalFirst(key)] = textStyle[key];
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 24334:
|
|
/*!***********************************************************!*\
|
|
!*** ./node_modules/_js-base64@2.6.4@js-base64/base64.js ***!
|
|
\***********************************************************/
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
|
|
* base64.js
|
|
*
|
|
* Licensed under the BSD 3-Clause License.
|
|
* http://opensource.org/licenses/BSD-3-Clause
|
|
*
|
|
* References:
|
|
* http://en.wikipedia.org/wiki/Base64
|
|
*/
|
|
;(function (global, factory) {
|
|
true
|
|
? module.exports = factory(global)
|
|
: 0
|
|
}((
|
|
typeof self !== 'undefined' ? self
|
|
: typeof window !== 'undefined' ? window
|
|
: typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g
|
|
: this
|
|
), function(global) {
|
|
'use strict';
|
|
// existing version for noConflict()
|
|
global = global || {};
|
|
var _Base64 = global.Base64;
|
|
var version = "2.6.4";
|
|
// constants
|
|
var b64chars
|
|
= 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
var b64tab = function(bin) {
|
|
var t = {};
|
|
for (var i = 0, l = bin.length; i < l; i++) t[bin.charAt(i)] = i;
|
|
return t;
|
|
}(b64chars);
|
|
var fromCharCode = String.fromCharCode;
|
|
// encoder stuff
|
|
var cb_utob = function(c) {
|
|
if (c.length < 2) {
|
|
var cc = c.charCodeAt(0);
|
|
return cc < 0x80 ? c
|
|
: cc < 0x800 ? (fromCharCode(0xc0 | (cc >>> 6))
|
|
+ fromCharCode(0x80 | (cc & 0x3f)))
|
|
: (fromCharCode(0xe0 | ((cc >>> 12) & 0x0f))
|
|
+ fromCharCode(0x80 | ((cc >>> 6) & 0x3f))
|
|
+ fromCharCode(0x80 | ( cc & 0x3f)));
|
|
} else {
|
|
var cc = 0x10000
|
|
+ (c.charCodeAt(0) - 0xD800) * 0x400
|
|
+ (c.charCodeAt(1) - 0xDC00);
|
|
return (fromCharCode(0xf0 | ((cc >>> 18) & 0x07))
|
|
+ fromCharCode(0x80 | ((cc >>> 12) & 0x3f))
|
|
+ fromCharCode(0x80 | ((cc >>> 6) & 0x3f))
|
|
+ fromCharCode(0x80 | ( cc & 0x3f)));
|
|
}
|
|
};
|
|
var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
|
|
var utob = function(u) {
|
|
return u.replace(re_utob, cb_utob);
|
|
};
|
|
var cb_encode = function(ccc) {
|
|
var padlen = [0, 2, 1][ccc.length % 3],
|
|
ord = ccc.charCodeAt(0) << 16
|
|
| ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8)
|
|
| ((ccc.length > 2 ? ccc.charCodeAt(2) : 0)),
|
|
chars = [
|
|
b64chars.charAt( ord >>> 18),
|
|
b64chars.charAt((ord >>> 12) & 63),
|
|
padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
|
|
padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
|
|
];
|
|
return chars.join('');
|
|
};
|
|
var btoa = global.btoa && typeof global.btoa == 'function'
|
|
? function(b){ return global.btoa(b) } : function(b) {
|
|
if (b.match(/[^\x00-\xFF]/)) throw new RangeError(
|
|
'The string contains invalid characters.'
|
|
);
|
|
return b.replace(/[\s\S]{1,3}/g, cb_encode);
|
|
};
|
|
var _encode = function(u) {
|
|
return btoa(utob(String(u)));
|
|
};
|
|
var mkUriSafe = function (b64) {
|
|
return b64.replace(/[+\/]/g, function(m0) {
|
|
return m0 == '+' ? '-' : '_';
|
|
}).replace(/=/g, '');
|
|
};
|
|
var encode = function(u, urisafe) {
|
|
return urisafe ? mkUriSafe(_encode(u)) : _encode(u);
|
|
};
|
|
var encodeURI = function(u) { return encode(u, true) };
|
|
var fromUint8Array;
|
|
if (global.Uint8Array) fromUint8Array = function(a, urisafe) {
|
|
// return btoa(fromCharCode.apply(null, a));
|
|
var b64 = '';
|
|
for (var i = 0, l = a.length; i < l; i += 3) {
|
|
var a0 = a[i], a1 = a[i+1], a2 = a[i+2];
|
|
var ord = a0 << 16 | a1 << 8 | a2;
|
|
b64 += b64chars.charAt( ord >>> 18)
|
|
+ b64chars.charAt((ord >>> 12) & 63)
|
|
+ ( typeof a1 != 'undefined'
|
|
? b64chars.charAt((ord >>> 6) & 63) : '=')
|
|
+ ( typeof a2 != 'undefined'
|
|
? b64chars.charAt( ord & 63) : '=');
|
|
}
|
|
return urisafe ? mkUriSafe(b64) : b64;
|
|
};
|
|
// decoder stuff
|
|
var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
|
|
var cb_btou = function(cccc) {
|
|
switch(cccc.length) {
|
|
case 4:
|
|
var cp = ((0x07 & cccc.charCodeAt(0)) << 18)
|
|
| ((0x3f & cccc.charCodeAt(1)) << 12)
|
|
| ((0x3f & cccc.charCodeAt(2)) << 6)
|
|
| (0x3f & cccc.charCodeAt(3)),
|
|
offset = cp - 0x10000;
|
|
return (fromCharCode((offset >>> 10) + 0xD800)
|
|
+ fromCharCode((offset & 0x3FF) + 0xDC00));
|
|
case 3:
|
|
return fromCharCode(
|
|
((0x0f & cccc.charCodeAt(0)) << 12)
|
|
| ((0x3f & cccc.charCodeAt(1)) << 6)
|
|
| (0x3f & cccc.charCodeAt(2))
|
|
);
|
|
default:
|
|
return fromCharCode(
|
|
((0x1f & cccc.charCodeAt(0)) << 6)
|
|
| (0x3f & cccc.charCodeAt(1))
|
|
);
|
|
}
|
|
};
|
|
var btou = function(b) {
|
|
return b.replace(re_btou, cb_btou);
|
|
};
|
|
var cb_decode = function(cccc) {
|
|
var len = cccc.length,
|
|
padlen = len % 4,
|
|
n = (len > 0 ? b64tab[cccc.charAt(0)] << 18 : 0)
|
|
| (len > 1 ? b64tab[cccc.charAt(1)] << 12 : 0)
|
|
| (len > 2 ? b64tab[cccc.charAt(2)] << 6 : 0)
|
|
| (len > 3 ? b64tab[cccc.charAt(3)] : 0),
|
|
chars = [
|
|
fromCharCode( n >>> 16),
|
|
fromCharCode((n >>> 8) & 0xff),
|
|
fromCharCode( n & 0xff)
|
|
];
|
|
chars.length -= [0, 0, 2, 1][padlen];
|
|
return chars.join('');
|
|
};
|
|
var _atob = global.atob && typeof global.atob == 'function'
|
|
? function(a){ return global.atob(a) } : function(a){
|
|
return a.replace(/\S{1,4}/g, cb_decode);
|
|
};
|
|
var atob = function(a) {
|
|
return _atob(String(a).replace(/[^A-Za-z0-9\+\/]/g, ''));
|
|
};
|
|
var _decode = function(a) { return btou(_atob(a)) };
|
|
var _fromURI = function(a) {
|
|
return String(a).replace(/[-_]/g, function(m0) {
|
|
return m0 == '-' ? '+' : '/'
|
|
}).replace(/[^A-Za-z0-9\+\/]/g, '');
|
|
};
|
|
var decode = function(a){
|
|
return _decode(_fromURI(a));
|
|
};
|
|
var toUint8Array;
|
|
if (global.Uint8Array) toUint8Array = function(a) {
|
|
return Uint8Array.from(atob(_fromURI(a)), function(c) {
|
|
return c.charCodeAt(0);
|
|
});
|
|
};
|
|
var noConflict = function() {
|
|
var Base64 = global.Base64;
|
|
global.Base64 = _Base64;
|
|
return Base64;
|
|
};
|
|
// export Base64
|
|
global.Base64 = {
|
|
VERSION: version,
|
|
atob: atob,
|
|
btoa: btoa,
|
|
fromBase64: decode,
|
|
toBase64: encode,
|
|
utob: utob,
|
|
encode: encode,
|
|
encodeURI: encodeURI,
|
|
btou: btou,
|
|
decode: decode,
|
|
noConflict: noConflict,
|
|
fromUint8Array: fromUint8Array,
|
|
toUint8Array: toUint8Array
|
|
};
|
|
// if ES5 is available, make Base64.extendString() available
|
|
if (typeof Object.defineProperty === 'function') {
|
|
var noEnum = function(v){
|
|
return {value:v,enumerable:false,writable:true,configurable:true};
|
|
};
|
|
global.Base64.extendString = function () {
|
|
Object.defineProperty(
|
|
String.prototype, 'fromBase64', noEnum(function () {
|
|
return decode(this)
|
|
}));
|
|
Object.defineProperty(
|
|
String.prototype, 'toBase64', noEnum(function (urisafe) {
|
|
return encode(this, urisafe)
|
|
}));
|
|
Object.defineProperty(
|
|
String.prototype, 'toBase64URI', noEnum(function () {
|
|
return encode(this, true)
|
|
}));
|
|
};
|
|
}
|
|
//
|
|
// export Base64 to the namespace
|
|
//
|
|
if (global['Meteor']) { // Meteor.js
|
|
Base64 = global.Base64;
|
|
}
|
|
// module.exports and AMD are mutually exclusive.
|
|
// module.exports has precedence.
|
|
if ( true && module.exports) {
|
|
module.exports.Base64 = global.Base64;
|
|
}
|
|
else if (true) {
|
|
// AMD. Register as an anonymous module.
|
|
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function(){ return global.Base64 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
|
|
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
}
|
|
// that's it!
|
|
return {Base64: global.Base64}
|
|
}));
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 83145:
|
|
/*!**********************************************************************************************!*\
|
|
!*** ./node_modules/_react-copy-to-clipboard@5.0.2@react-copy-to-clipboard/lib/Component.js ***!
|
|
\**********************************************************************************************/
|
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({
|
|
value: true
|
|
}));
|
|
exports.CopyToClipboard = void 0;
|
|
|
|
var _react = _interopRequireDefault(__webpack_require__(/*! react */ 59301));
|
|
|
|
var _copyToClipboard = _interopRequireDefault(__webpack_require__(/*! copy-to-clipboard */ 25769));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
|
|
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
|
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
|
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
|
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
|
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
|
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
|
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
|
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
|
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
|
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
|
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
|
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
|
|
var CopyToClipboard =
|
|
/*#__PURE__*/
|
|
function (_React$PureComponent) {
|
|
_inherits(CopyToClipboard, _React$PureComponent);
|
|
|
|
function CopyToClipboard() {
|
|
var _getPrototypeOf2;
|
|
|
|
var _this;
|
|
|
|
_classCallCheck(this, CopyToClipboard);
|
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
|
|
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(CopyToClipboard)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
|
|
|
_defineProperty(_assertThisInitialized(_this), "onClick", function (event) {
|
|
var _this$props = _this.props,
|
|
text = _this$props.text,
|
|
onCopy = _this$props.onCopy,
|
|
children = _this$props.children,
|
|
options = _this$props.options;
|
|
|
|
var elem = _react["default"].Children.only(children);
|
|
|
|
var result = (0, _copyToClipboard["default"])(text, options);
|
|
|
|
if (onCopy) {
|
|
onCopy(text, result);
|
|
} // Bypass onClick if it was present
|
|
|
|
|
|
if (elem && elem.props && typeof elem.props.onClick === 'function') {
|
|
elem.props.onClick(event);
|
|
}
|
|
});
|
|
|
|
return _this;
|
|
}
|
|
|
|
_createClass(CopyToClipboard, [{
|
|
key: "render",
|
|
value: function render() {
|
|
var _this$props2 = this.props,
|
|
_text = _this$props2.text,
|
|
_onCopy = _this$props2.onCopy,
|
|
_options = _this$props2.options,
|
|
children = _this$props2.children,
|
|
props = _objectWithoutProperties(_this$props2, ["text", "onCopy", "options", "children"]);
|
|
|
|
var elem = _react["default"].Children.only(children);
|
|
|
|
return _react["default"].cloneElement(elem, _objectSpread({}, props, {
|
|
onClick: this.onClick
|
|
}));
|
|
}
|
|
}]);
|
|
|
|
return CopyToClipboard;
|
|
}(_react["default"].PureComponent);
|
|
|
|
exports.CopyToClipboard = CopyToClipboard;
|
|
|
|
_defineProperty(CopyToClipboard, "defaultProps", {
|
|
onCopy: undefined,
|
|
options: undefined
|
|
});
|
|
|
|
/***/ }),
|
|
|
|
/***/ 56102:
|
|
/*!******************************************************************************************!*\
|
|
!*** ./node_modules/_react-copy-to-clipboard@5.0.2@react-copy-to-clipboard/lib/index.js ***!
|
|
\******************************************************************************************/
|
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
var _require = __webpack_require__(/*! ./Component */ 83145),
|
|
CopyToClipboard = _require.CopyToClipboard;
|
|
|
|
CopyToClipboard.CopyToClipboard = CopyToClipboard;
|
|
module.exports = CopyToClipboard;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 80010:
|
|
/*!*********************************************************************************!*\
|
|
!*** ./node_modules/_react-resizable@1.11.0@react-resizable/build/Resizable.js ***!
|
|
\*********************************************************************************/
|
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
exports.__esModule = true;
|
|
exports["default"] = void 0;
|
|
|
|
var _react = _interopRequireDefault(__webpack_require__(/*! react */ 59301));
|
|
|
|
var _reactDraggable = __webpack_require__(/*! react-draggable */ 12911);
|
|
|
|
var _utils = __webpack_require__(/*! ./utils */ 73638);
|
|
|
|
var _propTypes = __webpack_require__(/*! ./propTypes */ 6217);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
|
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
|
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
|
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
|
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
|
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
|
|
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
|
|
var Resizable = /*#__PURE__*/function (_React$Component) {
|
|
_inheritsLoose(Resizable, _React$Component);
|
|
|
|
function Resizable() {
|
|
var _this;
|
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
|
|
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
|
|
_defineProperty(_assertThisInitialized(_this), "state", undefined);
|
|
|
|
_defineProperty(_assertThisInitialized(_this), "lastHandleRect", null);
|
|
|
|
_defineProperty(_assertThisInitialized(_this), "slack", null);
|
|
|
|
return _this;
|
|
}
|
|
|
|
var _proto = Resizable.prototype;
|
|
|
|
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
this.resetData();
|
|
};
|
|
|
|
_proto.lockAspectRatio = function lockAspectRatio(width, height, aspectRatio) {
|
|
height = width / aspectRatio;
|
|
width = height * aspectRatio;
|
|
return [width, height];
|
|
};
|
|
|
|
_proto.resetData = function resetData() {
|
|
this.lastHandleRect = this.slack = null;
|
|
} // Clamp width and height within provided constraints
|
|
;
|
|
|
|
_proto.runConstraints = function runConstraints(width, height) {
|
|
var _ref = [this.props.minConstraints, this.props.maxConstraints],
|
|
min = _ref[0],
|
|
max = _ref[1];
|
|
if (!min && !max) return [width, height]; // If constraining to min and max, we need to also fit width and height to aspect ratio.
|
|
|
|
if (this.props.lockAspectRatio) {
|
|
var resizingHorizontally = height === this.props.height;
|
|
|
|
if (resizingHorizontally) {
|
|
var ratio = this.props.width / this.props.height;
|
|
height = width / ratio;
|
|
width = height * ratio;
|
|
} else {
|
|
// Take into account vertical resize with N/S handles on locked aspect
|
|
// ratio. Calculate the change height-first, instead of width-first
|
|
var _ratio = this.props.height / this.props.width;
|
|
|
|
width = height / _ratio;
|
|
height = width * _ratio;
|
|
}
|
|
}
|
|
|
|
var oldW = width,
|
|
oldH = height; // Add slack to the values used to calculate bound position. This will ensure that if
|
|
// we start removing slack, the element won't react to it right away until it's been
|
|
// completely removed.
|
|
|
|
var _ref2 = this.slack || [0, 0],
|
|
slackW = _ref2[0],
|
|
slackH = _ref2[1];
|
|
|
|
width += slackW;
|
|
height += slackH;
|
|
|
|
if (min) {
|
|
width = Math.max(min[0], width);
|
|
height = Math.max(min[1], height);
|
|
}
|
|
|
|
if (max) {
|
|
width = Math.min(max[0], width);
|
|
height = Math.min(max[1], height);
|
|
} // If the width or height changed, we must have introduced some slack. Record it for the next iteration.
|
|
|
|
|
|
this.slack = [slackW + (oldW - width), slackH + (oldH - height)];
|
|
return [width, height];
|
|
}
|
|
/**
|
|
* Wrapper around drag events to provide more useful data.
|
|
*
|
|
* @param {String} handlerName Handler name to wrap.
|
|
* @return {Function} Handler function.
|
|
*/
|
|
;
|
|
|
|
_proto.resizeHandler = function resizeHandler(handlerName, axis) {
|
|
var _this2 = this;
|
|
|
|
return function (e, _ref3) {
|
|
var node = _ref3.node,
|
|
deltaX = _ref3.deltaX,
|
|
deltaY = _ref3.deltaY;
|
|
// Reset data in case it was left over somehow (should not be possible)
|
|
if (handlerName === 'onResizeStart') _this2.resetData(); // Axis restrictions
|
|
|
|
var canDragX = (_this2.props.axis === 'both' || _this2.props.axis === 'x') && axis !== 'n' && axis !== 's';
|
|
var canDragY = (_this2.props.axis === 'both' || _this2.props.axis === 'y') && axis !== 'e' && axis !== 'w'; // No dragging possible.
|
|
|
|
if (!canDragX && !canDragY) return; // Decompose axis for later use
|
|
|
|
var axisV = axis[0];
|
|
var axisH = axis[axis.length - 1]; // intentionally not axis[1], so that this catches axis === 'w' for example
|
|
// Track the element being dragged to account for changes in position.
|
|
// If a handle's position is changed between callbacks, we need to factor this in to the next callback.
|
|
// Failure to do so will cause the element to "skip" when resized upwards or leftwards.
|
|
|
|
var handleRect = node.getBoundingClientRect();
|
|
|
|
if (_this2.lastHandleRect != null) {
|
|
// If the handle has repositioned on either axis since last render,
|
|
// we need to increase our callback values by this much.
|
|
// Only checking 'n', 'w' since resizing by 's', 'w' won't affect the overall position on page,
|
|
if (axisH === 'w') {
|
|
var deltaLeftSinceLast = handleRect.left - _this2.lastHandleRect.left;
|
|
deltaX += deltaLeftSinceLast;
|
|
}
|
|
|
|
if (axisV === 'n') {
|
|
var deltaTopSinceLast = handleRect.top - _this2.lastHandleRect.top;
|
|
deltaY += deltaTopSinceLast;
|
|
}
|
|
} // Storage of last rect so we know how much it has really moved.
|
|
|
|
|
|
_this2.lastHandleRect = handleRect; // Reverse delta if using top or left drag handles.
|
|
|
|
if (axisH === 'w') deltaX = -deltaX;
|
|
if (axisV === 'n') deltaY = -deltaY; // Update w/h by the deltas. Also factor in transformScale.
|
|
|
|
var width = _this2.props.width + (canDragX ? deltaX / _this2.props.transformScale : 0);
|
|
var height = _this2.props.height + (canDragY ? deltaY / _this2.props.transformScale : 0); // Run user-provided constraints.
|
|
|
|
var _this2$runConstraints = _this2.runConstraints(width, height);
|
|
|
|
width = _this2$runConstraints[0];
|
|
height = _this2$runConstraints[1];
|
|
var dimensionsChanged = width !== _this2.props.width || height !== _this2.props.height; // Call user-supplied callback if present.
|
|
|
|
var cb = typeof _this2.props[handlerName] === 'function' ? _this2.props[handlerName] : null; // Don't call 'onResize' if dimensions haven't changed.
|
|
|
|
var shouldSkipCb = handlerName === 'onResize' && !dimensionsChanged;
|
|
|
|
if (cb && !shouldSkipCb) {
|
|
if (typeof e.persist === 'function') e.persist();
|
|
cb(e, {
|
|
node: node,
|
|
size: {
|
|
width: width,
|
|
height: height
|
|
},
|
|
handle: axis
|
|
});
|
|
} // Reset internal data
|
|
|
|
|
|
if (handlerName === 'onResizeStop') _this2.resetData();
|
|
};
|
|
};
|
|
|
|
_proto.renderResizeHandle = function renderResizeHandle(resizeHandleAxis) {
|
|
var handle = this.props.handle;
|
|
|
|
if (handle) {
|
|
if (typeof handle === 'function') {
|
|
return handle(resizeHandleAxis);
|
|
}
|
|
|
|
return handle;
|
|
}
|
|
|
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
className: "react-resizable-handle react-resizable-handle-" + resizeHandleAxis
|
|
});
|
|
};
|
|
|
|
_proto.render = function render() {
|
|
var _this3 = this;
|
|
|
|
// Pass along only props not meant for the `<Resizable>`.`
|
|
// eslint-disable-next-line no-unused-vars
|
|
var _this$props = this.props,
|
|
children = _this$props.children,
|
|
className = _this$props.className,
|
|
draggableOpts = _this$props.draggableOpts,
|
|
width = _this$props.width,
|
|
height = _this$props.height,
|
|
handle = _this$props.handle,
|
|
handleSize = _this$props.handleSize,
|
|
lockAspectRatio = _this$props.lockAspectRatio,
|
|
axis = _this$props.axis,
|
|
minConstraints = _this$props.minConstraints,
|
|
maxConstraints = _this$props.maxConstraints,
|
|
onResize = _this$props.onResize,
|
|
onResizeStop = _this$props.onResizeStop,
|
|
onResizeStart = _this$props.onResizeStart,
|
|
resizeHandles = _this$props.resizeHandles,
|
|
transformScale = _this$props.transformScale,
|
|
p = _objectWithoutPropertiesLoose(_this$props, ["children", "className", "draggableOpts", "width", "height", "handle", "handleSize", "lockAspectRatio", "axis", "minConstraints", "maxConstraints", "onResize", "onResizeStop", "onResizeStart", "resizeHandles", "transformScale"]); // What we're doing here is getting the child of this element, and cloning it with this element's props.
|
|
// We are then defining its children as:
|
|
// Its original children (resizable's child's children), and
|
|
// One or more draggable handles.
|
|
|
|
|
|
return (0, _utils.cloneElement)(children, _objectSpread(_objectSpread({}, p), {}, {
|
|
className: (className ? className + " " : '') + "react-resizable",
|
|
children: [].concat(children.props.children, resizeHandles.map(function (handleAxis) {
|
|
return /*#__PURE__*/_react.default.createElement(_reactDraggable.DraggableCore, _extends({}, draggableOpts, {
|
|
key: "resizableHandle-" + handleAxis,
|
|
onStop: _this3.resizeHandler('onResizeStop', handleAxis),
|
|
onStart: _this3.resizeHandler('onResizeStart', handleAxis),
|
|
onDrag: _this3.resizeHandler('onResize', handleAxis)
|
|
}), _this3.renderResizeHandle(handleAxis));
|
|
}))
|
|
}));
|
|
};
|
|
|
|
return Resizable;
|
|
}(_react.default.Component);
|
|
|
|
exports["default"] = Resizable;
|
|
|
|
_defineProperty(Resizable, "propTypes", _propTypes.resizableProps);
|
|
|
|
_defineProperty(Resizable, "defaultProps", {
|
|
handleSize: [20, 20],
|
|
lockAspectRatio: false,
|
|
axis: 'both',
|
|
minConstraints: [20, 20],
|
|
maxConstraints: [Infinity, Infinity],
|
|
resizeHandles: ['se'],
|
|
transformScale: 1
|
|
});
|
|
|
|
/***/ }),
|
|
|
|
/***/ 60842:
|
|
/*!************************************************************************************!*\
|
|
!*** ./node_modules/_react-resizable@1.11.0@react-resizable/build/ResizableBox.js ***!
|
|
\************************************************************************************/
|
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
var __webpack_unused_export__;
|
|
|
|
|
|
__webpack_unused_export__ = true;
|
|
exports["default"] = void 0;
|
|
|
|
var React = _interopRequireWildcard(__webpack_require__(/*! react */ 59301));
|
|
|
|
var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ 12708));
|
|
|
|
var _Resizable = _interopRequireDefault(__webpack_require__(/*! ./Resizable */ 80010));
|
|
|
|
var _propTypes2 = __webpack_require__(/*! ./propTypes */ 6217);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
|
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
|
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
|
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
|
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
|
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
|
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
|
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
|
|
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
|
|
var ResizableBox = /*#__PURE__*/function (_React$Component) {
|
|
_inheritsLoose(ResizableBox, _React$Component);
|
|
|
|
function ResizableBox() {
|
|
var _this;
|
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
|
|
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
|
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
width: _this.props.width,
|
|
height: _this.props.height,
|
|
propsWidth: _this.props.width,
|
|
propsHeight: _this.props.height
|
|
});
|
|
|
|
_defineProperty(_assertThisInitialized(_this), "onResize", function (e, data) {
|
|
var size = data.size;
|
|
|
|
if (_this.props.onResize) {
|
|
e.persist && e.persist();
|
|
|
|
_this.setState(size, function () {
|
|
return _this.props.onResize && _this.props.onResize(e, data);
|
|
});
|
|
} else {
|
|
_this.setState(size);
|
|
}
|
|
});
|
|
|
|
return _this;
|
|
}
|
|
|
|
ResizableBox.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
|
|
// If parent changes height/width, set that in our state.
|
|
if (state.propsWidth !== props.width || state.propsHeight !== props.height) {
|
|
return {
|
|
width: props.width,
|
|
height: props.height,
|
|
propsWidth: props.width,
|
|
propsHeight: props.height
|
|
};
|
|
}
|
|
|
|
return null;
|
|
};
|
|
|
|
var _proto = ResizableBox.prototype;
|
|
|
|
_proto.render = function render() {
|
|
// Basic wrapper around a Resizable instance.
|
|
// If you use Resizable directly, you are responsible for updating the child component
|
|
// with a new width and height.
|
|
var _this$props = this.props,
|
|
handle = _this$props.handle,
|
|
handleSize = _this$props.handleSize,
|
|
onResize = _this$props.onResize,
|
|
onResizeStart = _this$props.onResizeStart,
|
|
onResizeStop = _this$props.onResizeStop,
|
|
draggableOpts = _this$props.draggableOpts,
|
|
minConstraints = _this$props.minConstraints,
|
|
maxConstraints = _this$props.maxConstraints,
|
|
lockAspectRatio = _this$props.lockAspectRatio,
|
|
axis = _this$props.axis,
|
|
width = _this$props.width,
|
|
height = _this$props.height,
|
|
resizeHandles = _this$props.resizeHandles,
|
|
style = _this$props.style,
|
|
transformScale = _this$props.transformScale,
|
|
props = _objectWithoutPropertiesLoose(_this$props, ["handle", "handleSize", "onResize", "onResizeStart", "onResizeStop", "draggableOpts", "minConstraints", "maxConstraints", "lockAspectRatio", "axis", "width", "height", "resizeHandles", "style", "transformScale"]);
|
|
|
|
return /*#__PURE__*/React.createElement(_Resizable.default, {
|
|
axis: axis,
|
|
draggableOpts: draggableOpts,
|
|
handle: handle,
|
|
handleSize: handleSize,
|
|
height: this.state.height,
|
|
lockAspectRatio: lockAspectRatio,
|
|
maxConstraints: maxConstraints,
|
|
minConstraints: minConstraints,
|
|
onResizeStart: onResizeStart,
|
|
onResize: this.onResize,
|
|
onResizeStop: onResizeStop,
|
|
resizeHandles: resizeHandles,
|
|
transformScale: transformScale,
|
|
width: this.state.width
|
|
}, /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
width: this.state.width + 'px',
|
|
height: this.state.height + 'px'
|
|
})
|
|
})));
|
|
};
|
|
|
|
return ResizableBox;
|
|
}(React.Component);
|
|
|
|
exports["default"] = ResizableBox;
|
|
|
|
_defineProperty(ResizableBox, "propTypes", _objectSpread(_objectSpread({}, _propTypes2.resizableProps), {}, {
|
|
children: _propTypes.default.element
|
|
}));
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6217:
|
|
/*!*********************************************************************************!*\
|
|
!*** ./node_modules/_react-resizable@1.11.0@react-resizable/build/propTypes.js ***!
|
|
\*********************************************************************************/
|
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
exports.__esModule = true;
|
|
exports.resizableProps = void 0;
|
|
|
|
var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ 12708));
|
|
|
|
var _reactDraggable = __webpack_require__(/*! react-draggable */ 12911);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
var resizableProps = {
|
|
/*
|
|
* Restricts resizing to a particular axis (default: 'both')
|
|
* 'both' - allows resizing by width or height
|
|
* 'x' - only allows the width to be changed
|
|
* 'y' - only allows the height to be changed
|
|
* 'none' - disables resizing altogether
|
|
* */
|
|
axis: _propTypes.default.oneOf(['both', 'x', 'y', 'none']),
|
|
className: _propTypes.default.string,
|
|
|
|
/*
|
|
* Require that one and only one child be present.
|
|
* */
|
|
children: _propTypes.default.element.isRequired,
|
|
|
|
/*
|
|
* These will be passed wholesale to react-draggable's DraggableCore
|
|
* */
|
|
draggableOpts: _propTypes.default.shape({
|
|
allowAnyClick: _propTypes.default.bool,
|
|
cancel: _propTypes.default.string,
|
|
children: _propTypes.default.node,
|
|
disabled: _propTypes.default.bool,
|
|
enableUserSelectHack: _propTypes.default.bool,
|
|
offsetParent: _propTypes.default.node,
|
|
grid: _propTypes.default.arrayOf(_propTypes.default.number),
|
|
handle: _propTypes.default.string,
|
|
nodeRef: _propTypes.default.object,
|
|
onStart: _propTypes.default.func,
|
|
onDrag: _propTypes.default.func,
|
|
onStop: _propTypes.default.func,
|
|
onMouseDown: _propTypes.default.func,
|
|
scale: _propTypes.default.number
|
|
}),
|
|
|
|
/*
|
|
* Initial height
|
|
* */
|
|
height: _propTypes.default.number.isRequired,
|
|
|
|
/*
|
|
* Customize cursor resize handle
|
|
* */
|
|
handle: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
|
|
/*
|
|
* If you change this, be sure to update your css
|
|
* */
|
|
handleSize: _propTypes.default.arrayOf(_propTypes.default.number),
|
|
lockAspectRatio: _propTypes.default.bool,
|
|
|
|
/*
|
|
* Max X & Y measure
|
|
* */
|
|
maxConstraints: _propTypes.default.arrayOf(_propTypes.default.number),
|
|
|
|
/*
|
|
* Min X & Y measure
|
|
* */
|
|
minConstraints: _propTypes.default.arrayOf(_propTypes.default.number),
|
|
|
|
/*
|
|
* Called on stop resize event
|
|
* */
|
|
onResizeStop: _propTypes.default.func,
|
|
|
|
/*
|
|
* Called on start resize event
|
|
* */
|
|
onResizeStart: _propTypes.default.func,
|
|
|
|
/*
|
|
* Called on resize event
|
|
* */
|
|
onResize: _propTypes.default.func,
|
|
|
|
/*
|
|
* Defines which resize handles should be rendered (default: 'se')
|
|
* 's' - South handle (bottom-center)
|
|
* 'w' - West handle (left-center)
|
|
* 'e' - East handle (right-center)
|
|
* 'n' - North handle (top-center)
|
|
* 'sw' - Southwest handle (bottom-left)
|
|
* 'nw' - Northwest handle (top-left)
|
|
* 'se' - Southeast handle (bottom-right)
|
|
* 'ne' - Northeast handle (top-center)
|
|
* */
|
|
resizeHandles: _propTypes.default.arrayOf(_propTypes.default.oneOf(['s', 'w', 'e', 'n', 'sw', 'nw', 'se', 'ne'])),
|
|
|
|
/*
|
|
* If `transform: scale(n)` is set on the parent, this should be set to `n`.
|
|
* */
|
|
transformScale: _propTypes.default.number,
|
|
|
|
/*
|
|
* Initial width
|
|
*/
|
|
width: _propTypes.default.number.isRequired
|
|
};
|
|
exports.resizableProps = resizableProps;
|
|
|
|
/***/ }),
|
|
|
|
/***/ 73638:
|
|
/*!*****************************************************************************!*\
|
|
!*** ./node_modules/_react-resizable@1.11.0@react-resizable/build/utils.js ***!
|
|
\*****************************************************************************/
|
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
exports.__esModule = true;
|
|
exports.cloneElement = cloneElement;
|
|
|
|
var _react = _interopRequireDefault(__webpack_require__(/*! react */ 59301));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
|
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
|
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
|
|
// React.addons.cloneWithProps look-alike that merges style & className.
|
|
function cloneElement(element, props) {
|
|
if (props.style && element.props.style) {
|
|
props.style = _objectSpread(_objectSpread({}, element.props.style), props.style);
|
|
}
|
|
|
|
if (props.className && element.props.className) {
|
|
props.className = element.props.className + " " + props.className;
|
|
}
|
|
|
|
return /*#__PURE__*/_react.default.cloneElement(element, props);
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9221:
|
|
/*!***********************************************************************!*\
|
|
!*** ./node_modules/_react-resizable@1.11.0@react-resizable/index.js ***!
|
|
\***********************************************************************/
|
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
module.exports = function() {
|
|
throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable");
|
|
};
|
|
|
|
module.exports.Resizable = __webpack_require__(/*! ./build/Resizable */ 80010)["default"];
|
|
module.exports.ResizableBox = __webpack_require__(/*! ./build/ResizableBox */ 60842)["default"];
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 98040:
|
|
/*!************************************************************************!*\
|
|
!*** ./node_modules/_toggle-selection@1.0.6@toggle-selection/index.js ***!
|
|
\************************************************************************/
|
|
/***/ (function(module) {
|
|
|
|
|
|
module.exports = function () {
|
|
var selection = document.getSelection();
|
|
if (!selection.rangeCount) {
|
|
return function () {};
|
|
}
|
|
var active = document.activeElement;
|
|
|
|
var ranges = [];
|
|
for (var i = 0; i < selection.rangeCount; i++) {
|
|
ranges.push(selection.getRangeAt(i));
|
|
}
|
|
|
|
switch (active.tagName.toUpperCase()) { // .toUpperCase handles XHTML
|
|
case 'INPUT':
|
|
case 'TEXTAREA':
|
|
active.blur();
|
|
break;
|
|
|
|
default:
|
|
active = null;
|
|
break;
|
|
}
|
|
|
|
selection.removeAllRanges();
|
|
return function () {
|
|
selection.type === 'Caret' &&
|
|
selection.removeAllRanges();
|
|
|
|
if (!selection.rangeCount) {
|
|
ranges.forEach(function(range) {
|
|
selection.addRange(range);
|
|
});
|
|
}
|
|
|
|
active &&
|
|
active.focus();
|
|
};
|
|
};
|
|
|
|
|
|
/***/ })
|
|
|
|
}]); |