d2coreui 23.0.59 → 23.0.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/README.md +1 -1
- package/components/date/dateTimeInput.d.ts +4 -9
- package/components/date/dateTimeInput.js +19 -34
- package/components/date/dateTimeInput.js.map +1 -1
- package/components/date/durationInput.js +6 -6
- package/components/date/durationInput.js.map +1 -1
- package/components/grid/dataGrid.d.ts +34 -1
- package/components/grid/dataGrid.js +93 -59
- package/components/grid/dataGrid.js.map +1 -1
- package/components/grid/export/contextMenu.d.ts +13 -3
- package/components/grid/export/contextMenu.js +69 -31
- package/components/grid/export/contextMenu.js.map +1 -1
- package/components/grid/export/worker/csvExport.js +3 -1
- package/components/grid/export/worker/csvExport.js.map +1 -1
- package/components/grid/extendedDataGrid.d.ts +21 -4
- package/components/grid/extendedDataGrid.js +21 -3
- package/components/grid/extendedDataGrid.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"durationInput.js","sourceRoot":"","sources":["../../../../components/date/durationInput.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAkC,MAAM,OAAO,CAAC;AACvD,OAAO,WAAW,MAAM,uCAAuC,CAAC;AAChE,OAAO,KAAK,EAAE,EAAC,UAAU,EAAiB,MAAM,OAAO,CAAC;AAExD,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAClC,OAAO,aAAa,MAAM,wBAAwB,CAAC;AAEnD,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,EAAC,KAAK,EAAE,GAAG,EAAC,EAAE,EAAE;IAC5C,OAAO;QACH,UAAU,EAAE,GAAG,CAAA;;;;;0BAKG,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AO,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC7C,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBAEzB,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;oBACX,KAAK,CAAC,MAAM,EAAE,CAAC;gBACnB,CAAC;qBAAM,CAAC;oBACJ,MAAM;gBACV,CAAC;YACL,CAAC;YAED,OAAO,KAAK,CAAC;QACjB,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC","sourcesContent":["import React, {HTMLAttributes, RefObject} from \"react\";\r\nimport MaskedInput from \"d2coreui/components/input/maskedInput\";\r\nimport dayjs, {isDuration, ManipulateType} from \"dayjs\";\r\nimport {Duration} from \"d2core/dayjs/duration\";\r\nimport {LocaleHolder} from \"d2core/i18n/localeHolder\";\r\nimport {AutoComplete} from \"antd\";\r\nimport DropdownArrow from \"../icons/dropdownArrow\";\r\nimport {SizeType} from \"antd/lib/config-provider/SizeContext\";\r\nimport WithCss from \"../style/withCss\";\r\nimport {createStyles} from \"antd-style\";\r\n\r\nconst useStyles = createStyles(({token, css}) => {\r\n return {\r\n baseLayout: css`\r\n &.input-number {\r\n display: inline-block;\r\n position: relative;\r\n width: 100%;\r\n height: ${token.controlHeight}px;\r\n padding: 0;\r\n color: ${token.colorText};\r\n font-size: ${token.fontSize}px;\r\n line-height: ${token.lineHeight};\r\n background-color: ${token.colorBgContainer};\r\n border: 1px solid ${token.colorBorder};\r\n border-radius: ${token.borderRadius}px;\r\n transition: all ${token.motionDurationMid};\r\n\r\n &:hover {\r\n border-color: ${token.colorPrimaryHover};\r\n }\r\n\r\n &.disabled {\r\n color: ${token.colorTextDisabled};\r\n background-color: ${token.colorBgContainerDisabled};\r\n border-color: ${token.colorBorder};\r\n cursor: not-allowed;\r\n\r\n &:hover {\r\n border-color: ${token.colorBorder};\r\n }\r\n }\r\n\r\n .handler-wrap {\r\n position: absolute;\r\n top: 0;\r\n right: 0;\r\n width: 22px;\r\n height: 100%;\r\n background: ${token.colorBgContainer};\r\n border-inline-start: ${token.lineWidth}px ${token.lineType} ${token.colorBorder};\r\n border-radius: 0 ${token.borderRadius}px ${token.borderRadius}px 0;\r\n display: flex;\r\n flex-direction: column;\r\n opacity: 0;\r\n transition: opacity ${token.motionDurationMid};\r\n\r\n .number-handler {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n flex: 1;\r\n width: 100%;\r\n height: 50%;\r\n overflow: hidden;\r\n color: ${token.colorTextDescription};\r\n line-height: 1;\r\n user-select: none;\r\n transition: all ${token.motionDurationMid};\r\n cursor: pointer;\r\n border-inline-start: ${token.lineWidth}px ${token.lineType} transparent;\r\n\r\n &:hover:not(&-up-disabled):not(&-down-disabled) {\r\n flex: 1.5; /* This button grows */\r\n color: ${token.colorPrimary};\r\n background: ${token.colorFillAlter};\r\n }\r\n \r\n &:hover {\r\n color: ${token.colorPrimary};\r\n }\r\n\r\n &:active {\r\n background: ${token.colorFillAlter};\r\n }\r\n\r\n .anticon {\r\n display: inline-block;\r\n font-size: 7px;\r\n }\r\n }\r\n\r\n .number-handler-up {\r\n border-top-right-radius: ${token.borderRadius}px;\r\n }\r\n\r\n .number-handler-down {\r\n border-top: ${token.lineWidth}px ${token.lineType} ${token.colorBorder};\r\n border-bottom-right-radius: ${token.borderRadius}px;\r\n }\r\n\r\n .number-handler-up-disabled,\r\n .number-handler-down-disabled {\r\n cursor: not-allowed;\r\n color: ${token.colorTextDisabled};\r\n\r\n &:hover {\r\n color: ${token.colorTextDisabled};\r\n }\r\n }\r\n }\r\n\r\n &:hover .handler-wrap {\r\n opacity: 1;\r\n }\r\n }\r\n `,\r\n\r\n // Specific to the UP handler\r\n handlerUp: css`\r\n border-top-right-radius: ${token.borderRadius}px;\r\n \r\n /* The line between UP and DOWN */\r\n border-bottom: ${token.lineWidth}px ${token.lineType} ${token.colorBorder};\r\n `,\r\n\r\n // Specific to the DOWN handler\r\n handlerDown: css`\r\n border-bottom-right-radius: ${token.borderRadius}px;\r\n `,\r\n\r\n // Icon container\r\n handlerIcon: css`\r\n display: inline-block;\r\n font-style: normal;\r\n line-height: 0;\r\n text-transform: none;\r\n `\r\n }\r\n})\r\n\r\n/** Props of {@link DurationInput}. Remaining HTML attributes are applied to the root `div`. */\r\ninterface DurationInputProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\"> {\r\n /**\r\n * Duration format, typically from `LocaleHolder.getDurationFormat()` (e.g. `\"DDDDD HH:mm:ss\"`). Fields:\r\n * `D` days, `H` hours, `m` minutes, `s` seconds, `SSS` milliseconds; the number of repeated letters is\r\n * the field width. Other characters are literals.\r\n */\r\n mask: string\r\n /** Current value (controlled); `null` shows an empty input. */\r\n value: Duration | null\r\n /**\r\n * Called on every edit with the parsed duration, or `null` when the text does not match the mask or exceeds\r\n * {@link MAX_VALID_DURATION}; also called after ArrowUp/ArrowDown or the spin buttons step the field under the\r\n * cursor, and when a predefined value is picked.\r\n */\r\n onChange?: (time: Duration | null) => void\r\n /**\r\n * Values offered in a dropdown (opened by the arrow suffix); `key` is the label, `value` the duration in\r\n * milliseconds as a string. When set, the spin buttons are not shown.\r\n */\r\n predefinedValues?: { key: string, value: string }[]\r\n /** Disables the input, the dropdown and the spin buttons. */\r\n disabled?: boolean\r\n /** Style of the inner text input element. */\r\n inputStyle?: React.CSSProperties\r\n /** Focuses the input on mount. */\r\n autoFocus?: boolean\r\n /** antd size of the inner input. */\r\n size?: SizeType;\r\n}\r\n\r\ninterface DurationInputState {\r\n valid: boolean\r\n selectionStart: number | null\r\n selectionEnd: number | null\r\n currentInfo: MaskResult\r\n opened: boolean\r\n value: string\r\n}\r\n\r\ninterface MaskResult {\r\n time?: Duration\r\n info?: InfoEntry\r\n infoFromMask?: EntryValue[]\r\n length: number\r\n}\r\n\r\ninterface InfoEntry {\r\n key: string\r\n min: number\r\n max: number\r\n minLen: number\r\n maxLen: number\r\n mult: number\r\n unit: ManipulateType\r\n}\r\n\r\ninterface EntryValue {\r\n length: number\r\n infoEntry: InfoEntry\r\n value: number\r\n}\r\n\r\nconst DURATION_DATA_MAP: InfoEntry[] = [\r\n {key: \"SSS\", min: 0, max: 999, minLen: 3, maxLen: 3, mult: 1, unit: \"ms\"},\r\n {key: \"s\", min: 0, max: 59, minLen: 1, maxLen: 2, mult: 1000, unit: \"s\"},\r\n {key: \"m\", min: 0, max: 59, minLen: 1, maxLen: 2, mult: 60 * 1000, unit: \"m\"},\r\n {key: \"H\", min: 0, max: 23, minLen: 1, maxLen: 2, mult: 60 * 60 * 1000, unit: \"h\"},\r\n {key: \"D\", min: 0, max: 24854, minLen: 1, maxLen: 5, mult: 24 * 60 * 60 * 1000, unit: \"d\"},\r\n];\r\n\r\n/** Longest duration {@link DurationInput} and {@link parseDuration} accept, in milliseconds (24854 days 23:59:59.499). */\r\nexport const MAX_VALID_DURATION = 24854 * 24 * 60 * 60 * 1000 + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000 + 499;\r\n\r\n/**\r\n * Parses text formatted with a duration mask (see {@link DurationInputProps.mask}). Each numeric field must have\r\n * exactly the width given in the mask; values are summed, so a field is not range-checked on its own.\r\n * @param cursorPos optional caret position; with `maskResult`, the field at this position is recorded\r\n * @param maskResult optional object filled with parse details used by {@link DurationInput}; cleared on failure\r\n * @returns the duration, or `null` when the text does not match the mask or exceeds {@link MAX_VALID_DURATION}\r\n */\r\nexport function parseDuration(value: string, mask: string, cursorPos?: number, maskResult?: MaskResult): Duration | null {\r\n let result: Duration = dayjs.duration(0);\r\n const clearMaskResult = () => {\r\n if (maskResult) {\r\n maskResult.info = undefined;\r\n maskResult.length = 0;\r\n maskResult.infoFromMask = undefined;\r\n maskResult.time = undefined;\r\n }\r\n }\r\n let maskPos: number = 0;\r\n let valPos: number;\r\n\r\n for (valPos = 0; valPos < value.length; valPos++) {\r\n const c: string = value.charAt(valPos);\r\n\r\n if (['D', 'H', 'm', 's', 'S'].includes(mask.charAt(maskPos))) { // je to maska\r\n if (/\\d/.test(c)) {\r\n const entry: EntryValue | undefined = getInfoFromMask(mask, maskPos);\r\n\r\n if (entry) {\r\n let str = c;\r\n\r\n while (/\\d/.test(value.charAt(valPos + 1))) {\r\n valPos++;\r\n str += value.charAt(valPos);\r\n }\r\n\r\n if (str.length !== entry.length) {\r\n clearMaskResult();\r\n return null;\r\n }\r\n\r\n const time: number = parseInt(str);\r\n\r\n result = result.add(dayjs.duration(time, entry.infoEntry.unit));\r\n if (maskResult) {\r\n const item: EntryValue = {\r\n value: time,\r\n length: str.length,\r\n infoEntry: entry.infoEntry,\r\n }\r\n\r\n if (maskResult.infoFromMask) {\r\n maskResult.infoFromMask.push(item);\r\n } else {\r\n maskResult.infoFromMask = [item];\r\n }\r\n }\r\n maskPos += entry.length;\r\n\r\n if (cursorPos !== undefined && maskResult !== undefined && cursorPos >= valPos - str.length + 1 && cursorPos <= valPos + 1) {\r\n maskResult.info = entry.infoEntry;\r\n maskResult.length = str.length;\r\n }\r\n } else {\r\n clearMaskResult();\r\n return null;\r\n }\r\n } else {\r\n // non-numeric character when value expected\r\n clearMaskResult();\r\n return null;\r\n }\r\n } else {\r\n if (c === mask.charAt(maskPos)) {\r\n // skip special characters\r\n maskPos++;\r\n }\r\n }\r\n }\r\n\r\n if (maskPos === mask.length && valPos === value.length && result.asMilliseconds() <= MAX_VALID_DURATION) {\r\n if (maskResult !== undefined) {\r\n maskResult.time = result;\r\n }\r\n return result;\r\n }\r\n\r\n clearMaskResult();\r\n return null;\r\n}\r\n\r\n/**\r\n * Masked input for a dayjs `Duration`, with spin buttons or, alternatively, a dropdown of predefined values.\r\n * ArrowUp/ArrowDown and the spin buttons step the field under the cursor by one unit.\r\n */\r\nexport default class DurationInput extends React.Component<DurationInputProps, DurationInputState> {\r\n private inputRef: RefObject<MaskedInput> = React.createRef();\r\n\r\n constructor(props: Readonly<DurationInputProps>) {\r\n super(props);\r\n this.state = {\r\n valid: isDuration(props.value),\r\n selectionStart: null,\r\n selectionEnd: null,\r\n currentInfo: {\r\n info: undefined,\r\n infoFromMask: undefined,\r\n time: undefined,\r\n length: 0\r\n },\r\n opened: false,\r\n value: formatDuration(props.value, props.mask),\r\n };\r\n\r\n this.recalc = this.recalc.bind(this);\r\n this.increment = this.increment.bind(this);\r\n this.decrement = this.decrement.bind(this);\r\n }\r\n\r\n componentDidUpdate(prevProps: Readonly<DurationInputProps>, _prevState: Readonly<DurationInputState>): void {\r\n if (this.inputRef.current !== null) {\r\n this.inputRef.current.input.selectionStart = this.state.selectionStart;\r\n this.inputRef.current.input.selectionEnd = this.state.selectionEnd;\r\n }\r\n\r\n if (prevProps.value?.asMilliseconds() !== this.props.value?.asMilliseconds()) {\r\n const value: string = formatDuration(this.props.value, this.props.mask);\r\n\r\n if (this.state.value !== value) {\r\n this.setState({\r\n value: value,\r\n valid: isDuration(this.props.value),\r\n });\r\n }\r\n }\r\n }\r\n\r\n /** Re-reads the cursor position and the mask field under it; called internally on key up and mouse up. */\r\n recalc(): void {\r\n if (this.inputRef.current !== null) {\r\n const value: MaskResult = {length: 0};\r\n parseDuration(this.inputRef.current.input.value, this.props.mask, this.inputRef.current.input.selectionStart ?? undefined, value);\r\n this.setState({\r\n currentInfo: value,\r\n selectionStart: this.inputRef.current.input.selectionStart,\r\n selectionEnd: this.inputRef.current.input.selectionEnd,\r\n });\r\n }\r\n }\r\n\r\n /** Adds one unit of the field under the cursor, if the result stays within what the mask can show, and refocuses the input. */\r\n increment(): void {\r\n if (this.state.currentInfo.info !== undefined && checkValue(this.state.currentInfo, this.props.value, 1)) {\r\n const duration = this.props.value?.add(1, this.state.currentInfo.info.unit) ?? null;\r\n\r\n this.props.onChange?.(duration);\r\n const value: string = formatDuration(duration, this.props.mask);\r\n\r\n this.setState({\r\n value: value,\r\n selectionStart: this.inputRef.current?.input.selectionStart ?? null,\r\n selectionEnd: this.inputRef.current?.input.selectionEnd ?? null\r\n });\r\n }\r\n\r\n this.inputRef.current?.focus();\r\n }\r\n\r\n /** Subtracts one unit of the field under the cursor, if the result stays non-negative and within what the mask can show, and refocuses the input. */\r\n decrement(): void {\r\n if (this.state.currentInfo.info !== undefined && checkValue(this.state.currentInfo, this.props.value, -1)) {\r\n const duration = this.props.value?.subtract(1, this.state.currentInfo.info.unit) ?? null;\r\n\r\n this.props.onChange?.(duration);\r\n const value: string = formatDuration(duration, this.props.mask);\r\n\r\n this.setState({\r\n value: value,\r\n selectionStart: this.inputRef.current?.input.selectionStart ?? null,\r\n selectionEnd: this.inputRef.current?.input.selectionEnd ?? null\r\n });\r\n }\r\n\r\n this.inputRef.current?.focus();\r\n }\r\n\r\n /** The underlying `<input>` element, `undefined` before mount. */\r\n get input() {\r\n return this.inputRef.current?.input;\r\n }\r\n\r\n /** Moves the keyboard focus to the text input. */\r\n focus() {\r\n this.inputRef.current?.focus();\r\n }\r\n\r\n render() {\r\n const {mask, value, onChange, style, disabled, predefinedValues, autoFocus, size, className, ...props} = this.props;\r\n const incrementButtonDisabled = this.state.currentInfo.info === undefined || !checkValue(this.state.currentInfo, this.props.value, 1);\r\n const decrementButtonDisabled = this.state.currentInfo.info === undefined || !checkValue(this.state.currentInfo, this.props.value, -1);\r\n\r\n return (\r\n <WithCss useStyles={useStyles}>\r\n {(context) =>\r\n <div style={style} {...props}\r\n className={(className ? className + \" \" : \"\") + (!predefinedValues ? \"input-number\" : \"\") + \" \" + context.styles.baseLayout + \" \" + (disabled ? \"disabled\" : \"\")}\r\n onKeyDown={(event) => {\r\n if (event.code === \"ArrowUp\") { // up\r\n this.increment();\r\n event.preventDefault();\r\n event.stopPropagation();\r\n } else if (event.code === \"ArrowDown\") { // down\r\n this.decrement();\r\n event.preventDefault();\r\n event.stopPropagation();\r\n }\r\n }}\r\n >\r\n <AutoComplete\r\n className={this.state.valid ? \"\" : \"invalid\"}\r\n options={this.state.opened ? predefinedValues?.map(v => {\r\n return {value: v.value, label: v.key}\r\n }) : []}\r\n defaultOpen={false}\r\n defaultActiveFirstOption={false}\r\n defaultValue={undefined}\r\n disabled={disabled}\r\n autoFocus={autoFocus}\r\n style={{width: \"100%\", height: \"inherit\"}}\r\n value={this.state.valid ? this.state.value : \"\"}\r\n onSelect={(e) => {\r\n const val: Duration = dayjs.duration(Number(e));\r\n this.setState({\r\n opened: false,\r\n valid: isDuration(val),\r\n value: formatDuration(val, this.props.mask),\r\n });\r\n onChange?.(val === undefined ? null : val);\r\n }}\r\n onBlur={() => {\r\n this.setState({opened: false});\r\n }}>\r\n <MaskedInput mask={this.props.mask.replace(/[a-zA-Z]/g, '1')}\r\n ref={this.inputRef}\r\n style={{\r\n border: predefinedValues ? undefined : \"none\",\r\n ...this.props.inputStyle\r\n }}\r\n size={size}\r\n placeholder={this.props.mask.replace(/[a-zA-Z]/g, '_')}\r\n autoFocus={autoFocus}\r\n onFocus={(event => {\r\n event.target.selectionStart = event.target.selectionEnd = this.state.selectionStart;\r\n })}\r\n suffix={\r\n this.props.predefinedValues !== undefined && this.props.predefinedValues.length > 0 &&\r\n <DropdownArrow opened={this.state.opened}\r\n onClick={() => {\r\n if (!this.props.disabled) {\r\n this.setState({opened: !this.state.opened});\r\n }\r\n }}/>\r\n }\r\n onMouseUp={this.recalc}\r\n onKeyUp={this.recalc}\r\n onChange={(event) => {\r\n const value: MaskResult = {length: 0};\r\n parseDuration(event.target.value, this.props.mask, event.target.selectionStart ?? undefined, value);\r\n onChange?.(value.time === undefined ? null : value.time);\r\n this.setState({\r\n valid: isDuration(value.time),\r\n currentInfo: value,\r\n value: event.target.value,\r\n selectionStart: event.target.selectionStart,\r\n selectionEnd: event.target.selectionEnd\r\n });\r\n }}\r\n />\r\n </AutoComplete>\r\n {!predefinedValues && !disabled &&\r\n <div className=\"handler-wrap\">\r\n <span onClick={this.increment}\r\n className={`number-handler number-handler-up ${incrementButtonDisabled ? \"number-handler-up-disabled\" : \"\"}`}>\r\n <span className=\"anticon anticon-up number-handler-up-inner\">\r\n <svg viewBox=\"64 64 896 896\" focusable=\"false\" data-icon=\"up\" width=\"1em\" height=\"1em\" fill=\"currentColor\" aria-hidden=\"true\">\r\n <path\r\n d=\"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z\"></path>\r\n </svg>\r\n </span>\r\n </span>\r\n <span onClick={this.decrement}\r\n className={`number-handler number-handler-down ${decrementButtonDisabled ? \"number-handler-down-disabled\" : \"\"}`}>\r\n <span className=\"anticon anticon-down number-handler-down-inner\">\r\n <svg viewBox=\"64 64 896 896\" focusable=\"false\" data-icon=\"down\" width=\"1em\" height=\"1em\" fill=\"currentColor\" aria-hidden=\"true\">\r\n <path\r\n d=\"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z\"></path>\r\n </svg>\r\n </span>\r\n </span>\r\n </div>\r\n }\r\n </div>\r\n }\r\n </WithCss>\r\n );\r\n }\r\n}\r\n\r\nfunction checkValue(info: MaskResult, value: Duration | null, offset = 0): boolean {\r\n const currentMillis = value ? value.add(offset, info.info?.unit).asMilliseconds() : 0;\r\n const maxValues = info?.infoFromMask ? info.infoFromMask.map((i) => (i.length !== i.infoEntry.maxLen ? (Math.pow(10, i.length) - 1) : i.infoEntry.max) * i.infoEntry.mult) : [];\r\n const maxMaskedValue = info?.infoFromMask ? maxValues.reduce((p, n) => p + n, 0) : 0;\r\n return !!value && currentMillis >= 0 && currentMillis <= MAX_VALID_DURATION && currentMillis <= maxMaskedValue;\r\n}\r\n\r\nfunction formatDuration(value: Duration | null, mask: string): string {\r\n //@ts-ignore\r\n return (isDuration(value) ? value : dayjs.duration(0)).locale(\"locale.d2000\").format(mask, {\r\n trim: false,\r\n decimalSeparator: LocaleHolder.decimalSeparator,\r\n useGrouping: false,\r\n groupingSeparator: \"\",\r\n userLocale: LocaleHolder.formattingLocale\r\n })\r\n}\r\n\r\nfunction getInfoFromMask(mask: string, fromPos: number): EntryValue | undefined {\r\n if (fromPos < mask.length) {\r\n const ch = mask.charAt(fromPos);\r\n const info = DURATION_DATA_MAP.find((d) => d.key.includes(ch));\r\n\r\n if (info) {\r\n const entry: EntryValue = {\r\n length: 1,\r\n value: 0,\r\n infoEntry: info,\r\n }\r\n\r\n for (let i = fromPos + 1; i < mask.length; i++) {\r\n const c = mask.charAt(i);\r\n\r\n if (c === ch) {\r\n entry.length++;\r\n } else {\r\n break;\r\n }\r\n }\r\n\r\n return entry;\r\n }\r\n }\r\n\r\n return undefined;\r\n}"]}
|
|
1
|
+
{"version":3,"file":"durationInput.js","sourceRoot":"","sources":["../../../../components/date/durationInput.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAkC,MAAM,OAAO,CAAC;AACvD,OAAO,WAAW,MAAM,uCAAuC,CAAC;AAChE,OAAO,KAAuB,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAClC,OAAO,aAAa,MAAM,wBAAwB,CAAC;AAEnD,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,EAAC,KAAK,EAAE,GAAG,EAAC,EAAE,EAAE;IAC5C,OAAO;QACH,UAAU,EAAE,GAAG,CAAA;;;;;0BAKG,KAAK,CAAC,aAAa;;yBAEpB,KAAK,CAAC,SAAS;6BACX,KAAK,CAAC,QAAQ;+BACZ,KAAK,CAAC,UAAU;oCACX,KAAK,CAAC,gBAAgB;oCACtB,KAAK,CAA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AC;gBAC7C,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBAEzB,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;oBACX,KAAK,CAAC,MAAM,EAAE,CAAC;gBACnB,CAAC;qBAAM,CAAC;oBACJ,MAAM;gBACV,CAAC;YACL,CAAC;YAED,OAAO,KAAK,CAAC;QACjB,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC","sourcesContent":["import React, {HTMLAttributes, RefObject} from \"react\";\r\nimport MaskedInput from \"d2coreui/components/input/maskedInput\";\r\nimport dayjs, {ManipulateType} from \"dayjs\";\r\nimport {Duration} from \"d2core/dayjs/duration\";\r\nimport {LocaleHolder} from \"d2core/i18n/localeHolder\";\r\nimport {AutoComplete} from \"antd\";\r\nimport DropdownArrow from \"../icons/dropdownArrow\";\r\nimport {SizeType} from \"antd/lib/config-provider/SizeContext\";\r\nimport WithCss from \"../style/withCss\";\r\nimport {createStyles} from \"antd-style\";\r\n\r\nconst useStyles = createStyles(({token, css}) => {\r\n return {\r\n baseLayout: css`\r\n &.input-number {\r\n display: inline-block;\r\n position: relative;\r\n width: 100%;\r\n height: ${token.controlHeight}px;\r\n padding: 0;\r\n color: ${token.colorText};\r\n font-size: ${token.fontSize}px;\r\n line-height: ${token.lineHeight};\r\n background-color: ${token.colorBgContainer};\r\n border: 1px solid ${token.colorBorder};\r\n border-radius: ${token.borderRadius}px;\r\n transition: all ${token.motionDurationMid};\r\n\r\n &:hover {\r\n border-color: ${token.colorPrimaryHover};\r\n }\r\n\r\n &.disabled {\r\n color: ${token.colorTextDisabled};\r\n background-color: ${token.colorBgContainerDisabled};\r\n border-color: ${token.colorBorder};\r\n cursor: not-allowed;\r\n\r\n &:hover {\r\n border-color: ${token.colorBorder};\r\n }\r\n }\r\n\r\n .handler-wrap {\r\n position: absolute;\r\n top: 0;\r\n right: 0;\r\n width: 22px;\r\n height: 100%;\r\n background: ${token.colorBgContainer};\r\n border-inline-start: ${token.lineWidth}px ${token.lineType} ${token.colorBorder};\r\n border-radius: 0 ${token.borderRadius}px ${token.borderRadius}px 0;\r\n display: flex;\r\n flex-direction: column;\r\n opacity: 0;\r\n transition: opacity ${token.motionDurationMid};\r\n\r\n .number-handler {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n flex: 1;\r\n width: 100%;\r\n height: 50%;\r\n overflow: hidden;\r\n color: ${token.colorTextDescription};\r\n line-height: 1;\r\n user-select: none;\r\n transition: all ${token.motionDurationMid};\r\n cursor: pointer;\r\n border-inline-start: ${token.lineWidth}px ${token.lineType} transparent;\r\n\r\n &:hover:not(&-up-disabled):not(&-down-disabled) {\r\n flex: 1.5; /* This button grows */\r\n color: ${token.colorPrimary};\r\n background: ${token.colorFillAlter};\r\n }\r\n \r\n &:hover {\r\n color: ${token.colorPrimary};\r\n }\r\n\r\n &:active {\r\n background: ${token.colorFillAlter};\r\n }\r\n\r\n .anticon {\r\n display: inline-block;\r\n font-size: 7px;\r\n }\r\n }\r\n\r\n .number-handler-up {\r\n border-top-right-radius: ${token.borderRadius}px;\r\n }\r\n\r\n .number-handler-down {\r\n border-top: ${token.lineWidth}px ${token.lineType} ${token.colorBorder};\r\n border-bottom-right-radius: ${token.borderRadius}px;\r\n }\r\n\r\n .number-handler-up-disabled,\r\n .number-handler-down-disabled {\r\n cursor: not-allowed;\r\n color: ${token.colorTextDisabled};\r\n\r\n &:hover {\r\n color: ${token.colorTextDisabled};\r\n }\r\n }\r\n }\r\n\r\n &:hover .handler-wrap {\r\n opacity: 1;\r\n }\r\n }\r\n `,\r\n\r\n // Specific to the UP handler\r\n handlerUp: css`\r\n border-top-right-radius: ${token.borderRadius}px;\r\n \r\n /* The line between UP and DOWN */\r\n border-bottom: ${token.lineWidth}px ${token.lineType} ${token.colorBorder};\r\n `,\r\n\r\n // Specific to the DOWN handler\r\n handlerDown: css`\r\n border-bottom-right-radius: ${token.borderRadius}px;\r\n `,\r\n\r\n // Icon container\r\n handlerIcon: css`\r\n display: inline-block;\r\n font-style: normal;\r\n line-height: 0;\r\n text-transform: none;\r\n `\r\n }\r\n})\r\n\r\n/** Props of {@link DurationInput}. Remaining HTML attributes are applied to the root `div`. */\r\ninterface DurationInputProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\"> {\r\n /**\r\n * Duration format, typically from `LocaleHolder.getDurationFormat()` (e.g. `\"DDDDD HH:mm:ss\"`). Fields:\r\n * `D` days, `H` hours, `m` minutes, `s` seconds, `SSS` milliseconds; the number of repeated letters is\r\n * the field width. Other characters are literals.\r\n */\r\n mask: string\r\n /** Current value (controlled); `null` shows an empty input. */\r\n value: Duration | null\r\n /**\r\n * Called on every edit with the parsed duration, or `null` when the text does not match the mask or exceeds\r\n * {@link MAX_VALID_DURATION}; also called after ArrowUp/ArrowDown or the spin buttons step the field under the\r\n * cursor, and when a predefined value is picked.\r\n */\r\n onChange?: (time: Duration | null) => void\r\n /**\r\n * Values offered in a dropdown (opened by the arrow suffix); `key` is the label, `value` the duration in\r\n * milliseconds as a string. When set, the spin buttons are not shown.\r\n */\r\n predefinedValues?: { key: string, value: string }[]\r\n /** Disables the input, the dropdown and the spin buttons. */\r\n disabled?: boolean\r\n /** Style of the inner text input element. */\r\n inputStyle?: React.CSSProperties\r\n /** Focuses the input on mount. */\r\n autoFocus?: boolean\r\n /** antd size of the inner input. */\r\n size?: SizeType;\r\n}\r\n\r\ninterface DurationInputState {\r\n valid: boolean\r\n selectionStart: number | null\r\n selectionEnd: number | null\r\n currentInfo: MaskResult\r\n opened: boolean\r\n value: string\r\n}\r\n\r\ninterface MaskResult {\r\n time?: Duration\r\n info?: InfoEntry\r\n infoFromMask?: EntryValue[]\r\n length: number\r\n}\r\n\r\ninterface InfoEntry {\r\n key: string\r\n min: number\r\n max: number\r\n minLen: number\r\n maxLen: number\r\n mult: number\r\n unit: ManipulateType\r\n}\r\n\r\ninterface EntryValue {\r\n length: number\r\n infoEntry: InfoEntry\r\n value: number\r\n}\r\n\r\nconst DURATION_DATA_MAP: InfoEntry[] = [\r\n {key: \"SSS\", min: 0, max: 999, minLen: 3, maxLen: 3, mult: 1, unit: \"ms\"},\r\n {key: \"s\", min: 0, max: 59, minLen: 1, maxLen: 2, mult: 1000, unit: \"s\"},\r\n {key: \"m\", min: 0, max: 59, minLen: 1, maxLen: 2, mult: 60 * 1000, unit: \"m\"},\r\n {key: \"H\", min: 0, max: 23, minLen: 1, maxLen: 2, mult: 60 * 60 * 1000, unit: \"h\"},\r\n {key: \"D\", min: 0, max: 24854, minLen: 1, maxLen: 5, mult: 24 * 60 * 60 * 1000, unit: \"d\"},\r\n];\r\n\r\n/** Longest duration {@link DurationInput} and {@link parseDuration} accept, in milliseconds (24854 days 23:59:59.499). */\r\nexport const MAX_VALID_DURATION = 24854 * 24 * 60 * 60 * 1000 + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000 + 499;\r\n\r\n/**\r\n * Parses text formatted with a duration mask (see {@link DurationInputProps.mask}). Each numeric field must have\r\n * exactly the width given in the mask; values are summed, so a field is not range-checked on its own.\r\n * @param cursorPos optional caret position; with `maskResult`, the field at this position is recorded\r\n * @param maskResult optional object filled with parse details used by {@link DurationInput}; cleared on failure\r\n * @returns the duration, or `null` when the text does not match the mask or exceeds {@link MAX_VALID_DURATION}\r\n */\r\nexport function parseDuration(value: string, mask: string, cursorPos?: number, maskResult?: MaskResult): Duration | null {\r\n let result: Duration = dayjs.duration(0);\r\n const clearMaskResult = () => {\r\n if (maskResult) {\r\n maskResult.info = undefined;\r\n maskResult.length = 0;\r\n maskResult.infoFromMask = undefined;\r\n maskResult.time = undefined;\r\n }\r\n }\r\n let maskPos: number = 0;\r\n let valPos: number;\r\n\r\n for (valPos = 0; valPos < value.length; valPos++) {\r\n const c: string = value.charAt(valPos);\r\n\r\n if (['D', 'H', 'm', 's', 'S'].includes(mask.charAt(maskPos))) { // je to maska\r\n if (/\\d/.test(c)) {\r\n const entry: EntryValue | undefined = getInfoFromMask(mask, maskPos);\r\n\r\n if (entry) {\r\n let str = c;\r\n\r\n while (/\\d/.test(value.charAt(valPos + 1))) {\r\n valPos++;\r\n str += value.charAt(valPos);\r\n }\r\n\r\n if (str.length !== entry.length) {\r\n clearMaskResult();\r\n return null;\r\n }\r\n\r\n const time: number = parseInt(str);\r\n\r\n result = result.add(dayjs.duration(time, entry.infoEntry.unit));\r\n if (maskResult) {\r\n const item: EntryValue = {\r\n value: time,\r\n length: str.length,\r\n infoEntry: entry.infoEntry,\r\n }\r\n\r\n if (maskResult.infoFromMask) {\r\n maskResult.infoFromMask.push(item);\r\n } else {\r\n maskResult.infoFromMask = [item];\r\n }\r\n }\r\n maskPos += entry.length;\r\n\r\n if (cursorPos !== undefined && maskResult !== undefined && cursorPos >= valPos - str.length + 1 && cursorPos <= valPos + 1) {\r\n maskResult.info = entry.infoEntry;\r\n maskResult.length = str.length;\r\n }\r\n } else {\r\n clearMaskResult();\r\n return null;\r\n }\r\n } else {\r\n // non-numeric character when value expected\r\n clearMaskResult();\r\n return null;\r\n }\r\n } else {\r\n if (c === mask.charAt(maskPos)) {\r\n // skip special characters\r\n maskPos++;\r\n }\r\n }\r\n }\r\n\r\n if (maskPos === mask.length && valPos === value.length && result.asMilliseconds() <= MAX_VALID_DURATION) {\r\n if (maskResult !== undefined) {\r\n maskResult.time = result;\r\n }\r\n return result;\r\n }\r\n\r\n clearMaskResult();\r\n return null;\r\n}\r\n\r\n/**\r\n * Masked input for a dayjs `Duration`, with spin buttons or, alternatively, a dropdown of predefined values.\r\n * ArrowUp/ArrowDown and the spin buttons step the field under the cursor by one unit.\r\n */\r\nexport default class DurationInput extends React.Component<DurationInputProps, DurationInputState> {\r\n private inputRef: RefObject<MaskedInput> = React.createRef();\r\n\r\n constructor(props: Readonly<DurationInputProps>) {\r\n super(props);\r\n this.state = {\r\n valid: dayjs.isDuration(props.value),\r\n selectionStart: null,\r\n selectionEnd: null,\r\n currentInfo: {\r\n info: undefined,\r\n infoFromMask: undefined,\r\n time: undefined,\r\n length: 0\r\n },\r\n opened: false,\r\n value: formatDuration(props.value, props.mask),\r\n };\r\n\r\n this.recalc = this.recalc.bind(this);\r\n this.increment = this.increment.bind(this);\r\n this.decrement = this.decrement.bind(this);\r\n }\r\n\r\n componentDidUpdate(prevProps: Readonly<DurationInputProps>, _prevState: Readonly<DurationInputState>): void {\r\n if (this.inputRef.current !== null) {\r\n this.inputRef.current.input.selectionStart = this.state.selectionStart;\r\n this.inputRef.current.input.selectionEnd = this.state.selectionEnd;\r\n }\r\n\r\n if (prevProps.value?.asMilliseconds() !== this.props.value?.asMilliseconds()) {\r\n const value: string = formatDuration(this.props.value, this.props.mask);\r\n\r\n if (this.state.value !== value) {\r\n this.setState({\r\n value: value,\r\n valid: dayjs.isDuration(this.props.value),\r\n });\r\n }\r\n }\r\n }\r\n\r\n /** Re-reads the cursor position and the mask field under it; called internally on key up and mouse up. */\r\n recalc(): void {\r\n if (this.inputRef.current !== null) {\r\n const value: MaskResult = {length: 0};\r\n parseDuration(this.inputRef.current.input.value, this.props.mask, this.inputRef.current.input.selectionStart ?? undefined, value);\r\n this.setState({\r\n currentInfo: value,\r\n selectionStart: this.inputRef.current.input.selectionStart,\r\n selectionEnd: this.inputRef.current.input.selectionEnd,\r\n });\r\n }\r\n }\r\n\r\n /** Adds one unit of the field under the cursor, if the result stays within what the mask can show, and refocuses the input. */\r\n increment(): void {\r\n if (this.state.currentInfo.info !== undefined && checkValue(this.state.currentInfo, this.props.value, 1)) {\r\n const duration = this.props.value?.add(1, this.state.currentInfo.info.unit) ?? null;\r\n\r\n this.props.onChange?.(duration);\r\n const value: string = formatDuration(duration, this.props.mask);\r\n\r\n this.setState({\r\n value: value,\r\n selectionStart: this.inputRef.current?.input.selectionStart ?? null,\r\n selectionEnd: this.inputRef.current?.input.selectionEnd ?? null\r\n });\r\n }\r\n\r\n this.inputRef.current?.focus();\r\n }\r\n\r\n /** Subtracts one unit of the field under the cursor, if the result stays non-negative and within what the mask can show, and refocuses the input. */\r\n decrement(): void {\r\n if (this.state.currentInfo.info !== undefined && checkValue(this.state.currentInfo, this.props.value, -1)) {\r\n const duration = this.props.value?.subtract(1, this.state.currentInfo.info.unit) ?? null;\r\n\r\n this.props.onChange?.(duration);\r\n const value: string = formatDuration(duration, this.props.mask);\r\n\r\n this.setState({\r\n value: value,\r\n selectionStart: this.inputRef.current?.input.selectionStart ?? null,\r\n selectionEnd: this.inputRef.current?.input.selectionEnd ?? null\r\n });\r\n }\r\n\r\n this.inputRef.current?.focus();\r\n }\r\n\r\n /** The underlying `<input>` element, `undefined` before mount. */\r\n get input() {\r\n return this.inputRef.current?.input;\r\n }\r\n\r\n /** Moves the keyboard focus to the text input. */\r\n focus() {\r\n this.inputRef.current?.focus();\r\n }\r\n\r\n render() {\r\n const {mask, value, onChange, style, disabled, predefinedValues, autoFocus, size, className, ...props} = this.props;\r\n const incrementButtonDisabled = this.state.currentInfo.info === undefined || !checkValue(this.state.currentInfo, this.props.value, 1);\r\n const decrementButtonDisabled = this.state.currentInfo.info === undefined || !checkValue(this.state.currentInfo, this.props.value, -1);\r\n\r\n return (\r\n <WithCss useStyles={useStyles}>\r\n {(context) =>\r\n <div style={style} {...props}\r\n className={(className ? className + \" \" : \"\") + (!predefinedValues ? \"input-number\" : \"\") + \" \" + context.styles.baseLayout + \" \" + (disabled ? \"disabled\" : \"\")}\r\n onKeyDown={(event) => {\r\n if (event.code === \"ArrowUp\") { // up\r\n this.increment();\r\n event.preventDefault();\r\n event.stopPropagation();\r\n } else if (event.code === \"ArrowDown\") { // down\r\n this.decrement();\r\n event.preventDefault();\r\n event.stopPropagation();\r\n }\r\n }}\r\n >\r\n <AutoComplete\r\n className={this.state.valid ? \"\" : \"invalid\"}\r\n options={this.state.opened ? predefinedValues?.map(v => {\r\n return {value: v.value, label: v.key}\r\n }) : []}\r\n defaultOpen={false}\r\n defaultActiveFirstOption={false}\r\n defaultValue={undefined}\r\n disabled={disabled}\r\n autoFocus={autoFocus}\r\n style={{width: \"100%\", height: \"inherit\"}}\r\n value={this.state.valid ? this.state.value : \"\"}\r\n onSelect={(e) => {\r\n const val: Duration = dayjs.duration(Number(e));\r\n this.setState({\r\n opened: false,\r\n valid: dayjs.isDuration(val),\r\n value: formatDuration(val, this.props.mask),\r\n });\r\n onChange?.(val === undefined ? null : val);\r\n }}\r\n onBlur={() => {\r\n this.setState({opened: false});\r\n }}>\r\n <MaskedInput mask={this.props.mask.replace(/[a-zA-Z]/g, '1')}\r\n ref={this.inputRef}\r\n style={{\r\n border: predefinedValues ? undefined : \"none\",\r\n ...this.props.inputStyle\r\n }}\r\n size={size}\r\n placeholder={this.props.mask.replace(/[a-zA-Z]/g, '_')}\r\n autoFocus={autoFocus}\r\n onFocus={(event => {\r\n event.target.selectionStart = event.target.selectionEnd = this.state.selectionStart;\r\n })}\r\n suffix={\r\n this.props.predefinedValues !== undefined && this.props.predefinedValues.length > 0 &&\r\n <DropdownArrow opened={this.state.opened}\r\n onClick={() => {\r\n if (!this.props.disabled) {\r\n this.setState({opened: !this.state.opened});\r\n }\r\n }}/>\r\n }\r\n onMouseUp={this.recalc}\r\n onKeyUp={this.recalc}\r\n onChange={(event) => {\r\n const value: MaskResult = {length: 0};\r\n parseDuration(event.target.value, this.props.mask, event.target.selectionStart ?? undefined, value);\r\n onChange?.(value.time === undefined ? null : value.time);\r\n this.setState({\r\n valid: dayjs.isDuration(value.time),\r\n currentInfo: value,\r\n value: event.target.value,\r\n selectionStart: event.target.selectionStart,\r\n selectionEnd: event.target.selectionEnd\r\n });\r\n }}\r\n />\r\n </AutoComplete>\r\n {!predefinedValues && !disabled &&\r\n <div className=\"handler-wrap\">\r\n <span onClick={this.increment}\r\n className={`number-handler number-handler-up ${incrementButtonDisabled ? \"number-handler-up-disabled\" : \"\"}`}>\r\n <span className=\"anticon anticon-up number-handler-up-inner\">\r\n <svg viewBox=\"64 64 896 896\" focusable=\"false\" data-icon=\"up\" width=\"1em\" height=\"1em\" fill=\"currentColor\" aria-hidden=\"true\">\r\n <path\r\n d=\"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z\"></path>\r\n </svg>\r\n </span>\r\n </span>\r\n <span onClick={this.decrement}\r\n className={`number-handler number-handler-down ${decrementButtonDisabled ? \"number-handler-down-disabled\" : \"\"}`}>\r\n <span className=\"anticon anticon-down number-handler-down-inner\">\r\n <svg viewBox=\"64 64 896 896\" focusable=\"false\" data-icon=\"down\" width=\"1em\" height=\"1em\" fill=\"currentColor\" aria-hidden=\"true\">\r\n <path\r\n d=\"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z\"></path>\r\n </svg>\r\n </span>\r\n </span>\r\n </div>\r\n }\r\n </div>\r\n }\r\n </WithCss>\r\n );\r\n }\r\n}\r\n\r\nfunction checkValue(info: MaskResult, value: Duration | null, offset = 0): boolean {\r\n const currentMillis = value ? value.add(offset, info.info?.unit).asMilliseconds() : 0;\r\n const maxValues = info?.infoFromMask ? info.infoFromMask.map((i) => (i.length !== i.infoEntry.maxLen ? (Math.pow(10, i.length) - 1) : i.infoEntry.max) * i.infoEntry.mult) : [];\r\n const maxMaskedValue = info?.infoFromMask ? maxValues.reduce((p, n) => p + n, 0) : 0;\r\n return !!value && currentMillis >= 0 && currentMillis <= MAX_VALID_DURATION && currentMillis <= maxMaskedValue;\r\n}\r\n\r\nfunction formatDuration(value: Duration | null, mask: string): string {\r\n //@ts-ignore\r\n return (dayjs.isDuration(value) ? value : dayjs.duration(0)).locale(\"locale.d2000\").format(mask, {\r\n trim: false,\r\n decimalSeparator: LocaleHolder.decimalSeparator,\r\n useGrouping: false,\r\n groupingSeparator: \"\",\r\n userLocale: LocaleHolder.formattingLocale\r\n })\r\n}\r\n\r\nfunction getInfoFromMask(mask: string, fromPos: number): EntryValue | undefined {\r\n if (fromPos < mask.length) {\r\n const ch = mask.charAt(fromPos);\r\n const info = DURATION_DATA_MAP.find((d) => d.key.includes(ch));\r\n\r\n if (info) {\r\n const entry: EntryValue = {\r\n length: 1,\r\n value: 0,\r\n infoEntry: info,\r\n }\r\n\r\n for (let i = fromPos + 1; i < mask.length; i++) {\r\n const c = mask.charAt(i);\r\n\r\n if (c === ch) {\r\n entry.length++;\r\n } else {\r\n break;\r\n }\r\n }\r\n\r\n return entry;\r\n }\r\n }\r\n\r\n return undefined;\r\n}"]}
|
|
@@ -2,7 +2,7 @@ import React, { ReactElement } from "react";
|
|
|
2
2
|
import { MenuProps } from "antd";
|
|
3
3
|
import { AgGridReact } from "ag-grid-react";
|
|
4
4
|
import 'd2coreui/style/ag-grid/aggrid-adaptations.css';
|
|
5
|
-
import { ContextMenuProps, PageOrientation } from "d2coreui/components/grid/export/contextMenu";
|
|
5
|
+
import { ContextMenuProps, ExportType, PageOrientation } from "d2coreui/components/grid/export/contextMenu";
|
|
6
6
|
import { CellClassParams, CellFocusedEvent, CellMouseDownEvent, CellMouseOverEvent, ColDef, ColTypeDef, ColGroupDef, Column, ColumnEvent, NewColumnsLoadedEvent, ColumnState, FilterChangedEvent, FilterModifiedEvent, GridApi, GridOptions, GridReadyEvent, IRowNode, PaginationChangedEvent, RowClassParams, RowPinnedType, RowStyle, ViewportChangedEvent } from "ag-grid-community";
|
|
7
7
|
import { UtcOffsetMode } from "d2core/i18n/localeHolder";
|
|
8
8
|
import { GridRowStyle, RowStyleRule } from "d2coreui/components/grid/cell/tableDefaultRowStyleRules";
|
|
@@ -255,6 +255,11 @@ export interface DataGridProps<TData = any> extends Omit<GridOptions<TData>, "co
|
|
|
255
255
|
toolbarButtons?: ReactElement;
|
|
256
256
|
/** Hides the "first-last of total" record range shown when paging is disabled (`pageSize` -1). */
|
|
257
257
|
hideRecordCount?: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Hides the export menu button, e.g. when the export is started by a custom button through
|
|
260
|
+
* {@link DataGrid.exportData}. The row context menu keeps its export items.
|
|
261
|
+
*/
|
|
262
|
+
hideExportButton?: boolean;
|
|
258
263
|
/** Extra content rendered at the end of the toolbar, after the pager or record count. */
|
|
259
264
|
extraContent?: React.ReactNode;
|
|
260
265
|
/**
|
|
@@ -442,6 +447,11 @@ export default class DataGrid<TData extends {
|
|
|
442
447
|
lastNavigationEvent?: NavigationEventEnum;
|
|
443
448
|
/** Pagination event received before the grid API was available, replayed once the grid is ready. */
|
|
444
449
|
lastPaginationEvent?: PaginationChangedEvent | null;
|
|
450
|
+
/**
|
|
451
|
+
* Whether an export is running; unlike `state.exporting` it is set synchronously, so two {@link exportData}
|
|
452
|
+
* calls in one tick do not both start an export.
|
|
453
|
+
*/
|
|
454
|
+
private exportRunning;
|
|
445
455
|
/**
|
|
446
456
|
* Object passed to ag-grid as `context`; the grid's overlays, header and filter components read the overlay
|
|
447
457
|
* renderers, `onFilterConfirmed`, `fontSize` and `lineHeight` from it.
|
|
@@ -449,6 +459,7 @@ export default class DataGrid<TData extends {
|
|
|
449
459
|
table_context: any;
|
|
450
460
|
private readonly getTheme;
|
|
451
461
|
constructor(props: Readonly<DataGridProps<TData>>);
|
|
462
|
+
private static getTimeCellValue;
|
|
452
463
|
private static getCellValue;
|
|
453
464
|
/**
|
|
454
465
|
* Case-insensitive `textCustomComparator` used by the grid's text filters; `contains` supports `*` and `?` wildcards.
|
|
@@ -597,6 +608,28 @@ export default class DataGrid<TData extends {
|
|
|
597
608
|
private getCustomComponents;
|
|
598
609
|
private onPageOrientationChange;
|
|
599
610
|
private onExport;
|
|
611
|
+
/**
|
|
612
|
+
* Properties of an export menu or of {@link runExport}: the date-time format of the grid, its export content and
|
|
613
|
+
* export state, with `overrides` applied.
|
|
614
|
+
*/
|
|
615
|
+
private getExportProps;
|
|
616
|
+
/**
|
|
617
|
+
* Exports the grid the same way as the toolbar export menu, for an export started from a custom button (hide the
|
|
618
|
+
* built-in one with `toolbar.hideExportButton`). Rows are exported with the displayed columns, filter and sort, and
|
|
619
|
+
* the date-time format of the grid; `exportMenu.onExported` is called after a successful export.
|
|
620
|
+
*
|
|
621
|
+
* Nothing is exported before the grid is ready, while it is loading or while another export is running.
|
|
622
|
+
*
|
|
623
|
+
* @param exportType file type, or `"clipboard"` to copy the rows to the clipboard
|
|
624
|
+
* @param options.onlySelectedRows export only the selected rows, as the row context menu does
|
|
625
|
+
* @param options.pageOrientation page orientation of the PDF export; defaults to the one last chosen in the export menu
|
|
626
|
+
* @returns resolved once the content is saved or copied, rejected when the export fails (an error notification is
|
|
627
|
+
* shown as well)
|
|
628
|
+
*/
|
|
629
|
+
exportData(exportType: ExportType, options?: {
|
|
630
|
+
onlySelectedRows?: boolean;
|
|
631
|
+
pageOrientation?: PageOrientation;
|
|
632
|
+
}): Promise<void>;
|
|
600
633
|
/** Renders the toolbar row: toolbar with search, pager (or record range when paging is disabled) and `toolbar.extraContent`. */
|
|
601
634
|
renderNavigationPanel(): ReactElement;
|
|
602
635
|
/**
|
|
@@ -21,7 +21,7 @@ import DataGridEditor from "d2coreui/components/grid/config/dataGridEditor";
|
|
|
21
21
|
import i18n from "d2core/i18n/i18n";
|
|
22
22
|
import AutoCompleteInput from "d2coreui/components/input/autoCompleteInput";
|
|
23
23
|
import isEqual from "lodash/isEqual";
|
|
24
|
-
import getContextMenu from "d2coreui/components/grid/export/contextMenu";
|
|
24
|
+
import getContextMenu, { runExport } from "d2coreui/components/grid/export/contextMenu";
|
|
25
25
|
import LoadingOverlay from "d2coreui/components/grid/panel/loadingOverlay";
|
|
26
26
|
import NoRecordsOverlay from "d2coreui/components/grid/panel/noRecordsOverlay";
|
|
27
27
|
import at from "lodash/at";
|
|
@@ -153,6 +153,11 @@ class DataGrid extends React.Component {
|
|
|
153
153
|
this.firstLoadDone = false;
|
|
154
154
|
/** Pagination event received before the grid API was available, replayed once the grid is ready. */
|
|
155
155
|
this.lastPaginationEvent = null;
|
|
156
|
+
/**
|
|
157
|
+
* Whether an export is running; unlike `state.exporting` it is set synchronously, so two {@link exportData}
|
|
158
|
+
* calls in one tick do not both start an export.
|
|
159
|
+
*/
|
|
160
|
+
this.exportRunning = false;
|
|
156
161
|
this.state = {
|
|
157
162
|
pageIndex: 0,
|
|
158
163
|
pageSize: null,
|
|
@@ -294,38 +299,35 @@ class DataGrid extends React.Component {
|
|
|
294
299
|
},
|
|
295
300
|
"dateColumn": {
|
|
296
301
|
cellRenderer: (params) => {
|
|
297
|
-
const value = DataGrid.
|
|
302
|
+
const value = DataGrid.getTimeCellValue(params);
|
|
298
303
|
if (value !== undefined) {
|
|
299
|
-
if (value === D2000UnixTimeNullValue) {
|
|
300
|
-
return "---";
|
|
301
|
-
}
|
|
302
304
|
let tooltipValue;
|
|
303
305
|
tooltipValue = unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(true, true, true, true));
|
|
304
306
|
return React.createElement("span", { title: tooltipValue }, unixTimeToMoment(value).format(LocaleHolder.getDateFormat(!this.props.hideYear)));
|
|
305
307
|
}
|
|
306
308
|
else {
|
|
307
|
-
return "
|
|
309
|
+
return "";
|
|
308
310
|
}
|
|
309
311
|
},
|
|
310
312
|
valueFormatter: (params) => {
|
|
311
|
-
const value = DataGrid.
|
|
313
|
+
const value = DataGrid.getTimeCellValue(params);
|
|
312
314
|
if (value !== undefined) {
|
|
313
315
|
return unixTimeToMoment(value).format(LocaleHolder.getDateFormat(!this.props.hideYear));
|
|
314
316
|
}
|
|
315
|
-
return "
|
|
317
|
+
return "";
|
|
316
318
|
},
|
|
317
319
|
filterParams: {
|
|
318
320
|
textCustomComparator: this.textCustomComparator
|
|
319
321
|
},
|
|
320
322
|
filterValueGetter: (params) => {
|
|
321
|
-
const value = DataGrid.
|
|
323
|
+
const value = DataGrid.getTimeCellValue(params);
|
|
322
324
|
if (value !== undefined) {
|
|
323
325
|
return unixTimeToMoment(value).format(LocaleHolder.getDateFormat(!this.props.hideYear));
|
|
324
326
|
}
|
|
325
327
|
return null;
|
|
326
328
|
},
|
|
327
329
|
getQuickFilterText: (params) => {
|
|
328
|
-
const value = DataGrid.
|
|
330
|
+
const value = DataGrid.getTimeCellValue(params);
|
|
329
331
|
if (value !== undefined) {
|
|
330
332
|
return unixTimeToMoment(value).format(LocaleHolder.getDateFormat(!this.props.hideYear));
|
|
331
333
|
}
|
|
@@ -334,38 +336,35 @@ class DataGrid extends React.Component {
|
|
|
334
336
|
},
|
|
335
337
|
"dateTimeColumn": {
|
|
336
338
|
cellRenderer: (params) => {
|
|
337
|
-
const value = DataGrid.
|
|
338
|
-
if (value) {
|
|
339
|
-
if (value === D2000UnixTimeNullValue) {
|
|
340
|
-
return "Null Time";
|
|
341
|
-
}
|
|
339
|
+
const value = DataGrid.getTimeCellValue(params);
|
|
340
|
+
if (value !== undefined) {
|
|
342
341
|
let tooltipValue;
|
|
343
342
|
tooltipValue = unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(true, true, true, true));
|
|
344
343
|
return React.createElement("span", { title: tooltipValue }, unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds, this.props.showUtcOffset)));
|
|
345
344
|
}
|
|
346
345
|
else {
|
|
347
|
-
return "
|
|
346
|
+
return "";
|
|
348
347
|
}
|
|
349
348
|
},
|
|
350
349
|
valueFormatter: (params) => {
|
|
351
|
-
const value = DataGrid.
|
|
350
|
+
const value = DataGrid.getTimeCellValue(params);
|
|
352
351
|
if (value !== undefined) {
|
|
353
352
|
return unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds, this.props.showUtcOffset));
|
|
354
353
|
}
|
|
355
|
-
return "
|
|
354
|
+
return "";
|
|
356
355
|
},
|
|
357
356
|
filterParams: {
|
|
358
357
|
textCustomComparator: this.textCustomComparator
|
|
359
358
|
},
|
|
360
359
|
filterValueGetter: (params) => {
|
|
361
|
-
const value = DataGrid.
|
|
360
|
+
const value = DataGrid.getTimeCellValue(params);
|
|
362
361
|
if (value !== undefined) {
|
|
363
362
|
return unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds, this.props.showUtcOffset));
|
|
364
363
|
}
|
|
365
364
|
return null;
|
|
366
365
|
},
|
|
367
366
|
getQuickFilterText: (params) => {
|
|
368
|
-
const value = DataGrid.
|
|
367
|
+
const value = DataGrid.getTimeCellValue(params);
|
|
369
368
|
if (value !== undefined) {
|
|
370
369
|
return unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds, this.props.showUtcOffset));
|
|
371
370
|
}
|
|
@@ -374,35 +373,35 @@ class DataGrid extends React.Component {
|
|
|
374
373
|
},
|
|
375
374
|
"fromNowDateTimeColumn": {
|
|
376
375
|
cellRenderer: (params) => {
|
|
377
|
-
const value = DataGrid.
|
|
376
|
+
const value = DataGrid.getTimeCellValue(params);
|
|
378
377
|
if (value !== undefined) {
|
|
379
378
|
let tooltipValue;
|
|
380
379
|
tooltipValue = unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(true, true, true, true));
|
|
381
380
|
return React.createElement("span", { title: tooltipValue }, unixTimeToMoment(value).fromNow());
|
|
382
381
|
}
|
|
383
382
|
else {
|
|
384
|
-
return "
|
|
383
|
+
return "";
|
|
385
384
|
}
|
|
386
385
|
},
|
|
387
386
|
valueFormatter: (params) => {
|
|
388
|
-
const value = DataGrid.
|
|
387
|
+
const value = DataGrid.getTimeCellValue(params);
|
|
389
388
|
if (value !== undefined) {
|
|
390
389
|
return unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds, this.props.showUtcOffset));
|
|
391
390
|
}
|
|
392
|
-
return "
|
|
391
|
+
return "";
|
|
393
392
|
},
|
|
394
393
|
filterParams: {
|
|
395
394
|
textCustomComparator: this.textCustomComparator
|
|
396
395
|
},
|
|
397
396
|
filterValueGetter: (params) => {
|
|
398
|
-
const value = DataGrid.
|
|
397
|
+
const value = DataGrid.getTimeCellValue(params);
|
|
399
398
|
if (value !== undefined) {
|
|
400
399
|
return unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds, this.props.showUtcOffset));
|
|
401
400
|
}
|
|
402
401
|
return null;
|
|
403
402
|
},
|
|
404
403
|
getQuickFilterText: (params) => {
|
|
405
|
-
const value = DataGrid.
|
|
404
|
+
const value = DataGrid.getTimeCellValue(params);
|
|
406
405
|
if (value !== undefined) {
|
|
407
406
|
return unixTimeToMoment(value).format(LocaleHolder.getDateTimeFormat(!this.props.hideYear, true, this.props.showMilliseconds, this.props.showUtcOffset));
|
|
408
407
|
}
|
|
@@ -463,6 +462,10 @@ class DataGrid extends React.Component {
|
|
|
463
462
|
"alignRight": {}
|
|
464
463
|
};
|
|
465
464
|
}
|
|
465
|
+
static getTimeCellValue(props) {
|
|
466
|
+
const value = DataGrid.getCellValue(props);
|
|
467
|
+
return value === undefined || value === null || value === D2000UnixTimeNullValue ? undefined : value;
|
|
468
|
+
}
|
|
466
469
|
static getCellValue(props) {
|
|
467
470
|
if (props) {
|
|
468
471
|
if (props.colDef.field && typeof props.getValue === "function") {
|
|
@@ -1052,10 +1055,22 @@ class DataGrid extends React.Component {
|
|
|
1052
1055
|
return suggestedNextCell !== null && suggestedNextCell !== void 0 ? suggestedNextCell : params.previousCellPosition;
|
|
1053
1056
|
}
|
|
1054
1057
|
suppressKeyboardEvent(params) {
|
|
1055
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1058
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1056
1059
|
if (!this.gridApi || params.event.type === "keypress") {
|
|
1057
1060
|
return false;
|
|
1058
1061
|
}
|
|
1062
|
+
if (params.editing && params.event.key === Key.Enter && (params.event.ctrlKey || params.event.metaKey)) {
|
|
1063
|
+
// ag-grid's Ctrl+Enter bulk edit writes the value into every cell of the cell ranges and RangeSelector ranges always
|
|
1064
|
+
// span whole rows, so the key is replayed as a plain Enter
|
|
1065
|
+
(_a = params.event.target) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new KeyboardEvent("keydown", {
|
|
1066
|
+
key: Key.Enter,
|
|
1067
|
+
code: params.event.code,
|
|
1068
|
+
shiftKey: params.event.shiftKey,
|
|
1069
|
+
bubbles: true,
|
|
1070
|
+
cancelable: true
|
|
1071
|
+
}));
|
|
1072
|
+
return true;
|
|
1073
|
+
}
|
|
1059
1074
|
const pageIndex = this.gridApi.paginationGetCurrentPage();
|
|
1060
1075
|
const totalPages = this.gridApi.paginationGetTotalPages();
|
|
1061
1076
|
switch (params.event.code) {
|
|
@@ -1184,7 +1199,7 @@ class DataGrid extends React.Component {
|
|
|
1184
1199
|
this.gridApi.deselectAll();
|
|
1185
1200
|
if (this.props.rowModelType === "infinite") {
|
|
1186
1201
|
for (let i = firstRow; i <= lastRow; i++) {
|
|
1187
|
-
(
|
|
1202
|
+
(_b = this.gridApi.getDisplayedRowAtIndex(i)) === null || _b === void 0 ? void 0 : _b.setSelected(true);
|
|
1188
1203
|
}
|
|
1189
1204
|
}
|
|
1190
1205
|
else {
|
|
@@ -1199,7 +1214,7 @@ class DataGrid extends React.Component {
|
|
|
1199
1214
|
case "KeyI":
|
|
1200
1215
|
if (params.event.ctrlKey) {
|
|
1201
1216
|
const focusedCell = this.gridApi.getFocusedCell();
|
|
1202
|
-
const column = (
|
|
1217
|
+
const column = (_d = (_c = this.gridApi) === null || _c === void 0 ? void 0 : _c.getColumn("objectId")) !== null && _d !== void 0 ? _d : (_e = this.gridApi) === null || _e === void 0 ? void 0 : _e.getColumn("id");
|
|
1203
1218
|
if (focusedCell && column) {
|
|
1204
1219
|
const displayedRowAtIndex = this.gridApi.getDisplayedRowAtIndex(focusedCell.rowIndex);
|
|
1205
1220
|
if (displayedRowAtIndex) {
|
|
@@ -1212,7 +1227,7 @@ class DataGrid extends React.Component {
|
|
|
1212
1227
|
case "KeyB":
|
|
1213
1228
|
if (params.event.ctrlKey) {
|
|
1214
1229
|
const focusedCell = this.gridApi.getFocusedCell();
|
|
1215
|
-
const column = (
|
|
1230
|
+
const column = (_g = (_f = this.gridApi) === null || _f === void 0 ? void 0 : _f.getColumn("objectName")) !== null && _g !== void 0 ? _g : (_h = this.gridApi) === null || _h === void 0 ? void 0 : _h.getColumn("name");
|
|
1216
1231
|
if (focusedCell && column) {
|
|
1217
1232
|
const displayedRowAtIndex1 = this.gridApi.getDisplayedRowAtIndex(focusedCell.rowIndex);
|
|
1218
1233
|
if (displayedRowAtIndex1) {
|
|
@@ -1270,10 +1285,10 @@ class DataGrid extends React.Component {
|
|
|
1270
1285
|
}
|
|
1271
1286
|
break;
|
|
1272
1287
|
case Key.Enter:
|
|
1273
|
-
(
|
|
1288
|
+
(_k = (_j = this.props).onEnter) === null || _k === void 0 ? void 0 : _k.call(_j);
|
|
1274
1289
|
break;
|
|
1275
1290
|
}
|
|
1276
|
-
(
|
|
1291
|
+
(_m = (_l = this.props).onKeyPressed) === null || _m === void 0 ? void 0 : _m.call(_l, params.event, params.editing);
|
|
1277
1292
|
return false;
|
|
1278
1293
|
}
|
|
1279
1294
|
/**
|
|
@@ -1677,8 +1692,40 @@ class DataGrid extends React.Component {
|
|
|
1677
1692
|
this.setState({ pageOrientation: pageOrientation });
|
|
1678
1693
|
}
|
|
1679
1694
|
onExport(start) {
|
|
1695
|
+
this.exportRunning = start;
|
|
1680
1696
|
this.setState({ exporting: start });
|
|
1681
1697
|
}
|
|
1698
|
+
/**
|
|
1699
|
+
* Properties of an export menu or of {@link runExport}: the date-time format of the grid, its export content and
|
|
1700
|
+
* export state, with `overrides` applied.
|
|
1701
|
+
*/
|
|
1702
|
+
getExportProps(overrides) {
|
|
1703
|
+
return Object.assign({ showMilliseconds: !!this.props.showMilliseconds, showYear: !this.props.hideYear, showUtcOffset: LocaleHolder.resolveUtcOffsetMode(this.props.showUtcOffset), getExportContent: this.getExportContent, pageOrientation: this.state.pageOrientation, exporting: this.state.exporting, onPageOrientationChange: this.onPageOrientationChange, onExport: this.onExport }, overrides);
|
|
1704
|
+
}
|
|
1705
|
+
/**
|
|
1706
|
+
* Exports the grid the same way as the toolbar export menu, for an export started from a custom button (hide the
|
|
1707
|
+
* built-in one with `toolbar.hideExportButton`). Rows are exported with the displayed columns, filter and sort, and
|
|
1708
|
+
* the date-time format of the grid; `exportMenu.onExported` is called after a successful export.
|
|
1709
|
+
*
|
|
1710
|
+
* Nothing is exported before the grid is ready, while it is loading or while another export is running.
|
|
1711
|
+
*
|
|
1712
|
+
* @param exportType file type, or `"clipboard"` to copy the rows to the clipboard
|
|
1713
|
+
* @param options.onlySelectedRows export only the selected rows, as the row context menu does
|
|
1714
|
+
* @param options.pageOrientation page orientation of the PDF export; defaults to the one last chosen in the export menu
|
|
1715
|
+
* @returns resolved once the content is saved or copied, rejected when the export fails (an error notification is
|
|
1716
|
+
* shown as well)
|
|
1717
|
+
*/
|
|
1718
|
+
async exportData(exportType, options) {
|
|
1719
|
+
var _a, _b;
|
|
1720
|
+
if (!this.isActive() || this.state.loading || this.exportRunning) {
|
|
1721
|
+
return;
|
|
1722
|
+
}
|
|
1723
|
+
await runExport(exportType, this.getExportProps({
|
|
1724
|
+
onlySelectedNodes: options === null || options === void 0 ? void 0 : options.onlySelectedRows,
|
|
1725
|
+
onExported: (_a = this.props.exportMenu) === null || _a === void 0 ? void 0 : _a.onExported,
|
|
1726
|
+
pageOrientation: (_b = options === null || options === void 0 ? void 0 : options.pageOrientation) !== null && _b !== void 0 ? _b : this.state.pageOrientation,
|
|
1727
|
+
}));
|
|
1728
|
+
}
|
|
1682
1729
|
/** Renders the toolbar row: toolbar with search, pager (or record range when paging is disabled) and `toolbar.extraContent`. */
|
|
1683
1730
|
renderNavigationPanel() {
|
|
1684
1731
|
var _a, _b, _c, _d;
|
|
@@ -1703,16 +1750,16 @@ class DataGrid extends React.Component {
|
|
|
1703
1750
|
* With `toolbar.compact` the export and settings buttons move into a popover opened by one button.
|
|
1704
1751
|
*/
|
|
1705
1752
|
renderToolBarWithSearch() {
|
|
1706
|
-
var _a, _b, _c, _d;
|
|
1753
|
+
var _a, _b, _c, _d, _e;
|
|
1707
1754
|
const compact = (_a = this.props.toolbar) === null || _a === void 0 ? void 0 : _a.compact;
|
|
1708
1755
|
const search = this.props.search;
|
|
1709
1756
|
return (React.createElement(Space.Compact, { key: "filter-panel", className: "datagrid-autocomplete-input-group", style: { whiteSpace: "nowrap", flexGrow: 1, display: "flex" } }, (_b = this.props.toolbar) === null || _b === void 0 ? void 0 :
|
|
1710
1757
|
_b.toolbarButtons,
|
|
1711
1758
|
compact ? this.renderCompactMenu() : React.createElement(React.Fragment, null,
|
|
1712
|
-
this.renderExportButton(),
|
|
1759
|
+
!((_c = this.props.toolbar) === null || _c === void 0 ? void 0 : _c.hideExportButton) && this.renderExportButton(),
|
|
1713
1760
|
this.renderSettingsButton()),
|
|
1714
|
-
!(search === null || search === void 0 ? void 0 : search.hidden) && !(search === null || search === void 0 ? void 0 : search.searchRenderer) && React.createElement(AutoCompleteInput, { style: { minWidth: 100, flexGrow: 1 }, placeholder: search === null || search === void 0 ? void 0 : search.placeholder, stringFormatter: search === null || search === void 0 ? void 0 : search.stringFormatter, value: search === null || search === void 0 ? void 0 : search.searchString, options: search === null || search === void 0 ? void 0 : search.searchHistory, onChange: search === null || search === void 0 ? void 0 : search.onChange, onSearch: search === null || search === void 0 ? void 0 : search.onSearch, disabled: this.state.loading || ((
|
|
1715
|
-
|
|
1761
|
+
!(search === null || search === void 0 ? void 0 : search.hidden) && !(search === null || search === void 0 ? void 0 : search.searchRenderer) && React.createElement(AutoCompleteInput, { style: { minWidth: 100, flexGrow: 1 }, placeholder: search === null || search === void 0 ? void 0 : search.placeholder, stringFormatter: search === null || search === void 0 ? void 0 : search.stringFormatter, value: search === null || search === void 0 ? void 0 : search.searchString, options: search === null || search === void 0 ? void 0 : search.searchHistory, onChange: search === null || search === void 0 ? void 0 : search.onChange, onSearch: search === null || search === void 0 ? void 0 : search.onSearch, disabled: this.state.loading || ((_d = this.props.filter) === null || _d === void 0 ? void 0 : _d.columnSearchVisible) }), (_e = search === null || search === void 0 ? void 0 : search.searchRenderer) === null || _e === void 0 ? void 0 :
|
|
1762
|
+
_e.call(search),
|
|
1716
1763
|
!(search === null || search === void 0 ? void 0 : search.searchButtonHidden) && this.renderSearchButton()));
|
|
1717
1764
|
}
|
|
1718
1765
|
/**
|
|
@@ -1723,27 +1770,22 @@ class DataGrid extends React.Component {
|
|
|
1723
1770
|
const close = () => this.setState({ compactMenuOpen: false });
|
|
1724
1771
|
return (React.createElement(Popover, { open: this.state.compactMenuOpen, onOpenChange: open => this.setState({ compactMenuOpen: open }), trigger: "click", placement: "bottomLeft",
|
|
1725
1772
|
// the menus are built only while the popover is open - the grid renders often, e.g. while scrolling
|
|
1726
|
-
destroyOnHidden: true, content: React.createElement(RenderLater, null, () =>
|
|
1727
|
-
|
|
1728
|
-
|
|
1773
|
+
destroyOnHidden: true, content: React.createElement(RenderLater, null, () => {
|
|
1774
|
+
var _a;
|
|
1775
|
+
return React.createElement(Space.Compact, null,
|
|
1776
|
+
!((_a = this.props.toolbar) === null || _a === void 0 ? void 0 : _a.hideExportButton) && this.renderExportButton(close),
|
|
1777
|
+
this.renderSettingsButton(close));
|
|
1778
|
+
}) },
|
|
1729
1779
|
React.createElement(Button, { title: i18n("Extended table features") }, this.state.loading ? React.createElement(LoadingOutlined, null) : React.createElement(EllipsisOutlined, null))));
|
|
1730
1780
|
}
|
|
1731
1781
|
/** Export button with the export menu; `onUsed` is called after a menu item is clicked. */
|
|
1732
1782
|
renderExportButton(onUsed) {
|
|
1733
1783
|
var _a, _b, _c;
|
|
1734
|
-
const exportMenu = getContextMenu({
|
|
1735
|
-
showMilliseconds: !!this.props.showMilliseconds,
|
|
1736
|
-
showYear: !this.props.hideYear,
|
|
1737
|
-
showUtcOffset: LocaleHolder.resolveUtcOffsetMode(this.props.showUtcOffset),
|
|
1784
|
+
const exportMenu = getContextMenu(this.getExportProps({
|
|
1738
1785
|
renderer: (_a = this.props.exportMenu) === null || _a === void 0 ? void 0 : _a.renderer,
|
|
1739
1786
|
onClick: (_b = this.props.exportMenu) === null || _b === void 0 ? void 0 : _b.onClick,
|
|
1740
1787
|
onExported: (_c = this.props.exportMenu) === null || _c === void 0 ? void 0 : _c.onExported,
|
|
1741
|
-
|
|
1742
|
-
pageOrientation: this.state.pageOrientation,
|
|
1743
|
-
exporting: this.state.exporting,
|
|
1744
|
-
onPageOrientationChange: this.onPageOrientationChange,
|
|
1745
|
-
onExport: this.onExport
|
|
1746
|
-
});
|
|
1788
|
+
}));
|
|
1747
1789
|
return (React.createElement(Dropdown, { trigger: ["click"], menu: withOnUsed(exportMenu, onUsed), disabled: this.state.loading },
|
|
1748
1790
|
React.createElement(Button, { title: i18n("Export") },
|
|
1749
1791
|
React.createElement(DownloadOutlined, null))));
|
|
@@ -1935,20 +1977,12 @@ class DataGrid extends React.Component {
|
|
|
1935
1977
|
// very nasty trick how remove error of ResizeObservers infinite cycling - because popover (with dynamic size) is placed in in resizable panel
|
|
1936
1978
|
const parentNode = ((_a = triggerNode === null || triggerNode === void 0 ? void 0 : triggerNode.parentNode) !== null && _a !== void 0 ? _a : document.body);
|
|
1937
1979
|
return parentNode;
|
|
1938
|
-
}, menu: getContextMenu({
|
|
1980
|
+
}, menu: getContextMenu(this.getExportProps({
|
|
1939
1981
|
onlySelectedNodes: true,
|
|
1940
|
-
showMilliseconds: !!this.props.showMilliseconds,
|
|
1941
|
-
showYear: !this.props.hideYear,
|
|
1942
|
-
showUtcOffset: LocaleHolder.resolveUtcOffsetMode(this.props.showUtcOffset),
|
|
1943
1982
|
renderer: (_a = this.props.contextMenu) === null || _a === void 0 ? void 0 : _a.renderer,
|
|
1944
1983
|
onClick: (_b = this.props.contextMenu) === null || _b === void 0 ? void 0 : _b.onClick,
|
|
1945
|
-
getExportContent: this.getExportContent,
|
|
1946
1984
|
hideNotificationOnClipboardCopy: true,
|
|
1947
|
-
|
|
1948
|
-
exporting: this.state.exporting,
|
|
1949
|
-
onPageOrientationChange: this.onPageOrientationChange,
|
|
1950
|
-
onExport: this.onExport
|
|
1951
|
-
}), open: this.state.contextMenuVisible, onOpenChange: (visible) => {
|
|
1985
|
+
})), open: this.state.contextMenuVisible, onOpenChange: (visible) => {
|
|
1952
1986
|
if (!visible) {
|
|
1953
1987
|
this.setState({ contextMenuVisible: false });
|
|
1954
1988
|
}
|