@nokecy/qc-ui 1.1.96 → 1.1.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/cjs/ag-grid-plus/utils/columnProcessors.js +5 -4
  2. package/dist/cjs/array-table/readOnlyFormatters.js +21 -16
  3. package/dist/cjs/array-table/utils.js +36 -13
  4. package/dist/cjs/dateCellEditor/DateCellEditor.d.ts +48 -0
  5. package/dist/cjs/dateCellEditor/DateCellEditor.js +118 -0
  6. package/dist/cjs/index.d.ts +2 -0
  7. package/dist/cjs/index.js +22 -0
  8. package/dist/cjs/readPretty/controls.js +18 -2
  9. package/dist/cjs/readPretty/decimal.d.ts +4 -1
  10. package/dist/cjs/readPretty/decimal.js +12 -2
  11. package/dist/cjs/readPretty/formily.js +13 -5
  12. package/dist/cjs/readPretty/selectValue.d.ts +11 -0
  13. package/dist/cjs/readPretty/selectValue.js +24 -0
  14. package/dist/cjs/readPretty/values.js +5 -4
  15. package/dist/cjs/toolBar/index.js +47 -3
  16. package/dist/cjs/utils/optionValue.d.ts +9 -0
  17. package/dist/cjs/utils/optionValue.js +28 -0
  18. package/dist/esm/ag-grid-plus/utils/columnProcessors.js +5 -4
  19. package/dist/esm/array-table/readOnlyFormatters.js +21 -16
  20. package/dist/esm/array-table/utils.js +36 -13
  21. package/dist/esm/dateCellEditor/DateCellEditor.d.ts +48 -0
  22. package/dist/esm/dateCellEditor/DateCellEditor.js +110 -0
  23. package/dist/esm/index.d.ts +2 -0
  24. package/dist/esm/index.js +1 -0
  25. package/dist/esm/readPretty/controls.js +18 -2
  26. package/dist/esm/readPretty/decimal.d.ts +4 -1
  27. package/dist/esm/readPretty/decimal.js +12 -2
  28. package/dist/esm/readPretty/formily.js +13 -5
  29. package/dist/esm/readPretty/selectValue.d.ts +11 -0
  30. package/dist/esm/readPretty/selectValue.js +23 -0
  31. package/dist/esm/readPretty/values.js +5 -4
  32. package/dist/esm/toolBar/index.js +49 -4
  33. package/dist/esm/utils/optionValue.d.ts +9 -0
  34. package/dist/esm/utils/optionValue.js +22 -0
  35. package/dist/umd/qc-ui.min.js +1 -1
  36. package/package.json +1 -1
@@ -1,4 +1,7 @@
1
1
  import React from 'react';
2
2
  /** 精确业务数值录入和阅读展示,零值与原始十进制字符串始终保留。@author nokecy */
3
3
  export declare const DecimalInput: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<any>>;
4
- export declare const DecimalPicker: React.ForwardRefExoticComponent<Omit<Partial<Omit<any, "ref"> & React.RefAttributes<any>>, "ref"> & React.RefAttributes<unknown>>;
4
+ /** 精确数值的静默态沿用自身阅读规则,允许表格按已知显示契约懒挂载。@author nokecy */
5
+ export declare const DecimalPicker: React.ForwardRefExoticComponent<Omit<Partial<Omit<any, "ref"> & React.RefAttributes<any>>, "ref"> & React.RefAttributes<unknown>> & {
6
+ readOnlyFormatter: import("../array-table/readOnlyFormatters").ReadOnlyFormatter;
7
+ };
@@ -3,6 +3,7 @@ import { connect, mapReadPretty } from '@formily/react';
3
3
  import React from 'react';
4
4
  import { InputNumber } from "./controls";
5
5
  import { decimalText } from "../utils/businessDecimal";
6
+ import { withReadOnlyFormatter } from "../array-table/readOnlyFormatters";
6
7
 
7
8
  /** 精确业务数值录入和阅读展示,零值与原始十进制字符串始终保留。@author nokecy */
8
9
  export var DecimalInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
@@ -14,9 +15,18 @@ export var DecimalInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
14
15
  var DecimalPreview = function DecimalPreview(_ref) {
15
16
  var value = _ref.value,
16
17
  formatter = _ref.formatter;
17
- return /*#__PURE__*/React.createElement("span", null, value == null || value === '' ? '—' : formatter ? formatter(value, {
18
+ return /*#__PURE__*/React.createElement("span", null, value == null || value === '' ? '—' : typeof formatter === 'function' ? formatter(value, {
18
19
  userTyping: false,
19
20
  input: String(value)
20
21
  }) : decimalText(value));
21
22
  };
22
- export var DecimalPicker = connect(DecimalInput, mapReadPretty(DecimalPreview));
23
+ /** 精确数值的静默态沿用自身阅读规则,允许表格按已知显示契约懒挂载。@author nokecy */
24
+ export var DecimalPicker = withReadOnlyFormatter(connect(DecimalInput, mapReadPretty(DecimalPreview)), function (value, ctx) {
25
+ var _ctx$fieldSchema;
26
+ if (value == null || value === '') return '';
27
+ var formatter = (_ctx$fieldSchema = ctx.fieldSchema) === null || _ctx$fieldSchema === void 0 || (_ctx$fieldSchema = _ctx$fieldSchema['x-component-props']) === null || _ctx$fieldSchema === void 0 ? void 0 : _ctx$fieldSchema.formatter;
28
+ return typeof formatter === 'function' ? String(formatter(value, {
29
+ userTyping: false,
30
+ input: String(value)
31
+ })) : decimalText(value);
32
+ });
@@ -14,6 +14,8 @@ import { hoistStatics } from "./hoistStatics";
14
14
  import * as Reading from "./controls";
15
15
  import { selectNumberInputTextOnClick } from "./selectNumberInputTextOnClick";
16
16
  import { withReadingArrayTable } from "./arrayTable";
17
+ import { flattenOptions } from "./values";
18
+ import { matchSelectDisplayValue } from "./selectValue";
17
19
  export { withReactiveSchemaScope } from "./schemaScope";
18
20
 
19
21
  /** 动态表单统一阅读展示;数值控件关闭方向键步进,保留表格导航与字段值。@author nokecy */
@@ -25,18 +27,24 @@ export function withReadingFields(components) {
25
27
  });
26
28
  var wrap = function wrap(Control, Preview) {
27
29
  var numericInput = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
30
+ var choiceInput = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
28
31
  var Component = observer(function (props) {
32
+ var _field$dataSource;
29
33
  var field = useField();
30
- if (props.disabled || props.readOnly || field !== null && field !== void 0 && field.disabled || field !== null && field !== void 0 && field.readOnly) {
31
- var _field$value, _field$value2, _field$dataSource;
34
+ var options = field !== null && field !== void 0 && (_field$dataSource = field.dataSource) !== null && _field$dataSource !== void 0 && _field$dataSource.length ? field.dataSource : props.options;
35
+ var displayProps = choiceInput ? _objectSpread(_objectSpread({}, props), {}, {
36
+ value: matchSelectDisplayValue(props.value, flattenOptions(options, props.fieldNames), props.labelInValue)
37
+ }) : props;
38
+ if (props.disabled || props.readOnly || field !== null && field !== void 0 && field.disabled || field !== null && field !== void 0 && field.readOnly || choiceInput && (field === null || field === void 0 ? void 0 : field.pattern) === 'readPretty') {
39
+ var _field$value, _field$value2, _field$dataSource2;
32
40
  return /*#__PURE__*/React.createElement(Preview, _extends({}, props, {
33
41
  value: (_field$value = field === null || field === void 0 ? void 0 : field.value) !== null && _field$value !== void 0 ? _field$value : props.value,
34
42
  checked: (_field$value2 = field === null || field === void 0 ? void 0 : field.value) !== null && _field$value2 !== void 0 ? _field$value2 : props.checked,
35
- options: field !== null && field !== void 0 && (_field$dataSource = field.dataSource) !== null && _field$dataSource !== void 0 && _field$dataSource.length ? field.dataSource : props.options,
43
+ options: field !== null && field !== void 0 && (_field$dataSource2 = field.dataSource) !== null && _field$dataSource2 !== void 0 && _field$dataSource2.length ? field.dataSource : props.options,
36
44
  disabled: true
37
45
  }));
38
46
  }
39
- return /*#__PURE__*/React.createElement(Control, _extends({}, props, numericInput ? {
47
+ return /*#__PURE__*/React.createElement(Control, _extends({}, displayProps, numericInput ? {
40
48
  keyboard: false,
41
49
  onClick: selectNumberInputTextOnClick(props.onClick)
42
50
  } : {}));
@@ -56,7 +64,7 @@ export function withReadingFields(components) {
56
64
  try {
57
65
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
58
66
  var name = _step.value;
59
- result[name] = wrap(components[name], previews[name], name === 'NumberPicker' || name === 'InputNumber');
67
+ result[name] = wrap(components[name], previews[name], name === 'NumberPicker' || name === 'InputNumber', name === 'Select');
60
68
  }
61
69
  // ArrayTable 阅读态保留动态列的标题和显隐状态。@author nokecy
62
70
  } catch (err) {
@@ -1,4 +1,15 @@
1
1
  import { type ReactNode } from 'react';
2
+ /**
3
+ * 仅为控件回显匹配候选中的原生值,不回写表单,不触发变更事件。
4
+ * @param value 原始单选或多选值。
5
+ * @param options 已展开的选项。
6
+ * @param labelInValue 是否使用名称编码对象。
7
+ * @returns 命中选项的控件值;未知值原样保留。
8
+ * @author nokecy
9
+ */
10
+ export declare function matchSelectDisplayValue(value: any, options: readonly {
11
+ value?: unknown;
12
+ }[], labelInValue?: boolean): any;
2
13
  /** 提取选择项的标量编码,兼容嵌套 labelInValue;保留编码 0 和显式空字符串选项。@author nokecy */
3
14
  export declare function selectCode(value: unknown, depth?: number): string | number | undefined;
4
15
  /** 标签只输出可渲染内容;选择项对象取名称后再回落编码,避免 React 对象子节点异常。@author nokecy */
@@ -5,6 +5,29 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
5
5
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
6
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
7
7
  import { isValidElement } from 'react';
8
+ import { findOptionByValue } from "../utils/optionValue";
9
+
10
+ /**
11
+ * 仅为控件回显匹配候选中的原生值,不回写表单,不触发变更事件。
12
+ * @param value 原始单选或多选值。
13
+ * @param options 已展开的选项。
14
+ * @param labelInValue 是否使用名称编码对象。
15
+ * @returns 命中选项的控件值;未知值原样保留。
16
+ * @author nokecy
17
+ */
18
+ export function matchSelectDisplayValue(value, options, labelInValue) {
19
+ if (Array.isArray(value)) return value.map(function (item) {
20
+ return matchSelectDisplayValue(item, options, labelInValue);
21
+ });
22
+ var raw = labelInValue && value && _typeof(value) === 'object' ? value.value : value;
23
+ var matched = findOptionByValue(options, raw, function (option) {
24
+ return option.value;
25
+ });
26
+ if (!matched) return value;
27
+ return labelInValue && value && _typeof(value) === 'object' ? _objectSpread(_objectSpread({}, value), {}, {
28
+ value: matched.value
29
+ }) : matched.value;
30
+ }
8
31
 
9
32
  /** 提取选择项的标量编码,兼容嵌套 labelInValue;保留编码 0 和显式空字符串选项。@author nokecy */
10
33
  export function selectCode(value) {
@@ -1,5 +1,6 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
2
  import { normalizeSelectValue, selectLabel } from "./selectValue";
3
+ import { findOptionByValue } from "../utils/optionValue";
3
4
 
4
5
  /** 阅读态选择项展开,保留分组内选项及自定义字段名。@author nokecy */
5
6
  export function flattenOptions() {
@@ -30,11 +31,11 @@ export function selectedLabels(value, options, labelInValue) {
30
31
  var values = Array.isArray(normalized) ? normalized : normalized == null ? [] : [normalized];
31
32
  if (!values.length) return '—';
32
33
  var labels = values.map(function (item) {
33
- var _ref2, _selectLabel, _options$find, _item$label;
34
+ var _ref2, _selectLabel, _findOptionByValue, _item$label;
34
35
  var raw = labelInValue ? item.value : item;
35
- return (_ref2 = (_selectLabel = selectLabel((_options$find = options.find(function (option) {
36
- return option.value === raw;
37
- })) === null || _options$find === void 0 ? void 0 : _options$find.label)) !== null && _selectLabel !== void 0 ? _selectLabel : selectLabel(labelInValue ? (_item$label = item.label) !== null && _item$label !== void 0 ? _item$label : raw : raw)) !== null && _ref2 !== void 0 ? _ref2 : '—';
36
+ return (_ref2 = (_selectLabel = selectLabel((_findOptionByValue = findOptionByValue(options, raw, function (option) {
37
+ return option.value;
38
+ })) === null || _findOptionByValue === void 0 ? void 0 : _findOptionByValue.label)) !== null && _selectLabel !== void 0 ? _selectLabel : selectLabel(labelInValue ? (_item$label = item.label) !== null && _item$label !== void 0 ? _item$label : raw : raw)) !== null && _ref2 !== void 0 ? _ref2 : '—';
38
39
  });
39
40
  // 选项标签可以是React节点,交由调用组件按顺序渲染。
40
41
  return labels.flatMap(function (label, index) {
@@ -1,7 +1,19 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
1
2
  var _excluded = ["children", "className", "extra", "identity", "banner", "style", "renderContent", "getTargetContainer"];
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
12
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
2
14
  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; }
3
15
  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; }
4
- import React, { useCallback, useRef } from 'react';
16
+ import React, { useCallback, useLayoutEffect, useRef, useState } from 'react';
5
17
  import { Affix, theme } from 'antd';
6
18
  import "./index.less";
7
19
 
@@ -19,10 +31,41 @@ var ToolBar = function ToolBar(props) {
19
31
  var _theme$useToken = theme.useToken(),
20
32
  token = _theme$useToken.token; // 单据操作栏跟随宿主主题。@author nokecy
21
33
  var barRef = useRef(null);
34
+ var _useState = useState(),
35
+ _useState2 = _slicedToArray(_useState, 2),
36
+ barHeight = _useState2[0],
37
+ setBarHeight = _useState2[1];
38
+ /** 吸顶后 Affix 的占位会固定高度,动态提示及按钮换行仍须按内容重新占位。@author nokecy */
39
+ var measureHeight = useCallback(function () {
40
+ var _barRef$current;
41
+ var height = (_barRef$current = barRef.current) === null || _barRef$current === void 0 ? void 0 : _barRef$current.getBoundingClientRect().height;
42
+ // KeepAlive 隐藏页的零高度不能冲掉有效占位。@author nokecy
43
+ if (height && height > 0) setBarHeight(function (previous) {
44
+ return previous === Math.ceil(height) ? previous : Math.ceil(height);
45
+ });
46
+ }, []);
47
+ useLayoutEffect(function () {
48
+ measureHeight();
49
+ });
50
+ useLayoutEffect(function () {
51
+ var bar = barRef.current;
52
+ if (!bar) return;
53
+ if (typeof ResizeObserver !== 'undefined') {
54
+ var observer = new ResizeObserver(measureHeight);
55
+ observer.observe(bar);
56
+ return function () {
57
+ return observer.disconnect();
58
+ };
59
+ }
60
+ window.addEventListener('resize', measureHeight);
61
+ return function () {
62
+ return window.removeEventListener('resize', measureHeight);
63
+ };
64
+ }, [measureHeight]);
22
65
  // @author nokecy:KeepAlive 内容区独立滚动,吸顶应相对其视口,避免定位到应用顶栏下面。
23
66
  var defaultTarget = useCallback(function () {
24
- var _barRef$current$paren, _barRef$current;
25
- var parent = (_barRef$current$paren = (_barRef$current = barRef.current) === null || _barRef$current === void 0 ? void 0 : _barRef$current.parentElement) !== null && _barRef$current$paren !== void 0 ? _barRef$current$paren : null;
67
+ var _barRef$current$paren, _barRef$current2;
68
+ var parent = (_barRef$current$paren = (_barRef$current2 = barRef.current) === null || _barRef$current2 === void 0 ? void 0 : _barRef$current2.parentElement) !== null && _barRef$current$paren !== void 0 ? _barRef$current$paren : null;
26
69
  while (parent) {
27
70
  if (/auto|scroll/.test(getComputedStyle(parent).overflowY)) return parent;
28
71
  parent = parent.parentElement;
@@ -31,7 +74,9 @@ var ToolBar = function ToolBar(props) {
31
74
  }, []);
32
75
  return /*#__PURE__*/React.createElement(Affix, {
33
76
  offsetTop: 2,
34
- style: style,
77
+ style: _objectSpread(_objectSpread({}, style), barHeight === undefined ? {} : {
78
+ height: barHeight
79
+ }),
35
80
  offsetBottom: 2,
36
81
  target: getTargetContainer || defaultTarget
37
82
  }, /*#__PURE__*/React.createElement("div", {
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 精确匹配优先,再按去除首尾空格的标量码匹配选项;保留前导零、大小写及未知值。
3
+ * @param options 可选项。
4
+ * @param value 待显示的原始值。
5
+ * @param getValue 读取选项编码。
6
+ * @returns 命中的选项;未命中返回 undefined,不改写原始数据。
7
+ * @author nokecy
8
+ */
9
+ export declare function findOptionByValue<T>(options: readonly T[], value: unknown, getValue: (option: T) => unknown): T | undefined;
@@ -0,0 +1,22 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ /**
3
+ * 精确匹配优先,再按去除首尾空格的标量码匹配选项;保留前导零、大小写及未知值。
4
+ * @param options 可选项。
5
+ * @param value 待显示的原始值。
6
+ * @param getValue 读取选项编码。
7
+ * @returns 命中的选项;未命中返回 undefined,不改写原始数据。
8
+ * @author nokecy
9
+ */
10
+ export function findOptionByValue(options, value, getValue) {
11
+ var exact = options.find(function (option) {
12
+ return getValue(option) === value;
13
+ });
14
+ if (exact !== undefined) return exact;
15
+ var code = function code(item) {
16
+ return ['string', 'number', 'boolean'].includes(_typeof(item)) ? String(item).trim() : undefined;
17
+ };
18
+ var target = code(value);
19
+ return target === undefined ? undefined : options.find(function (option) {
20
+ return code(getValue(option)) === target;
21
+ });
22
+ }