@react-querybuilder/antd 8.12.0 → 8.13.0
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/dist/cjs/react-querybuilder_antd.cjs.development.d.ts +96 -95
- package/dist/cjs/react-querybuilder_antd.cjs.development.js +19 -17
- package/dist/cjs/react-querybuilder_antd.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_antd.cjs.production.d.ts +96 -95
- package/dist/cjs/react-querybuilder_antd.cjs.production.js +1 -1
- package/dist/cjs/react-querybuilder_antd.cjs.production.js.map +1 -1
- package/dist/react-querybuilder_antd.d.mts +96 -95
- package/dist/react-querybuilder_antd.legacy-esm.d.ts +96 -95
- package/dist/react-querybuilder_antd.legacy-esm.js +11 -33
- package/dist/react-querybuilder_antd.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_antd.mjs +9 -31
- package/dist/react-querybuilder_antd.mjs.map +1 -1
- package/dist/react-querybuilder_antd.production.d.mts +96 -95
- package/dist/react-querybuilder_antd.production.mjs +1 -1
- package/dist/react-querybuilder_antd.production.mjs.map +1 -1
- package/package.json +8 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-querybuilder_antd.cjs.production.js","names":["Button","AntDDragHandle: React.ForwardRefExoticComponent<\n Omit<AntDDragHandleProps, 'ref'> & React.RefAttributes<HTMLSpanElement>\n>","HolderOutlined","Switch","Button","noteOnce","preMessage","customParseFormat","advancedFormat","weekday","localeData","weekOfYear","weekYear","localeMap: IlocaleMapObject","generateConfig: GenerateConfig<Dayjs>","dayjsGenerateConfig","InputNumber","Input","ValueEditor","Switch","Checkbox","Radio","React","Select","antdControlElements: ControlElementsProp<FullField, string>","antdTranslations: Partial<Translations>","CloseOutlined","CopyOutlined","UnlockOutlined","LockOutlined","UpOutlined","DownOutlined","QueryBuilderAntD: QueryBuilderContextProvider"],"sources":["../../src/AntDActionElement.tsx","../../src/AntDDragHandle.tsx","../../src/AntDNotToggle.tsx","../../src/AntDShiftActions.tsx","../../../../node_modules/rc-util/lib/warning.js","../../src/dayjs.ts","../../src/AntDValueEditor.tsx","../../src/AntDValueSelector.tsx","../../src/index.tsx"],"sourcesContent":["import { Button } from 'antd';\nimport type { ComponentPropsWithoutRef } from 'react';\nimport * as React from 'react';\nimport type { ActionProps } from 'react-querybuilder';\n\n// TODO: This may be unnecessary. Find out if there's a way to allow\n// `data-${string}` index keys without breaking other type contraints.\ntype RemoveDataIndexKeys<T> = {\n [K in keyof T as `data-${string}` extends K ? never : K]: T[K];\n};\n\n/**\n * @group Props\n */\nexport interface AntDActionProps\n extends ActionProps,\n RemoveDataIndexKeys<ComponentPropsWithoutRef<typeof Button>> {}\n\n/**\n * @group Components\n */\nexport const AntDActionElement = ({\n className,\n handleOnClick,\n label,\n title,\n disabled,\n disabledTranslation,\n // Props that should not be in extraProps\n testID: _testID,\n level: _level,\n path: _path,\n context: _context,\n validation: _validation,\n ruleOrGroup: _ruleOrGroup,\n schema: _schema,\n ...extraProps\n}: AntDActionProps): React.JSX.Element => (\n <Button\n type=\"primary\"\n className={className}\n title={disabledTranslation && disabled ? disabledTranslation.title : title}\n onClick={e => handleOnClick(e)}\n disabled={disabled && !disabledTranslation}\n {...extraProps}>\n {disabledTranslation && disabled ? disabledTranslation.label : label}\n </Button>\n);\n","import { HolderOutlined } from '@ant-design/icons';\nimport type { ComponentPropsWithRef } from 'react';\nimport * as React from 'react';\nimport { forwardRef } from 'react';\nimport type { DragHandleProps } from 'react-querybuilder';\n\n/**\n * @group Props\n */\n// oxlint-disable-next-line typescript/no-explicit-any\nexport type AntDDragHandleProps = DragHandleProps & { label?: any } & ComponentPropsWithRef<\n typeof HolderOutlined\n >;\n\n/**\n * @group Components\n */\nexport const AntDDragHandle: React.ForwardRefExoticComponent<\n Omit<AntDDragHandleProps, 'ref'> & React.RefAttributes<HTMLSpanElement>\n> = forwardRef<HTMLSpanElement, AntDDragHandleProps>(\n (\n {\n className,\n title,\n // Props that should not be in extraProps\n testID: _testID,\n level: _level,\n path: _path,\n label: _label,\n disabled: _disabled,\n context: _context,\n validation: _validation,\n schema: _schema,\n ruleOrGroup: _ruleOrGroup,\n ...extraProps\n },\n dragRef\n ) => <HolderOutlined className={className} title={title} {...extraProps} ref={dragRef} />\n);\n","import { Switch } from 'antd';\nimport type { ComponentPropsWithoutRef } from 'react';\nimport * as React from 'react';\nimport type { NotToggleProps } from 'react-querybuilder';\n\n/**\n * @group Props\n */\nexport interface AntDNotToggleProps\n extends NotToggleProps,\n ComponentPropsWithoutRef<typeof Switch> {}\n\n/**\n * @group Components\n */\nexport const AntDNotToggle = ({\n className,\n handleOnChange,\n label,\n checked,\n title,\n disabled,\n // Props that should not be in extraProps\n path: _path,\n context: _context,\n validation: _validation,\n testID: _testID,\n schema: _schema,\n ruleGroup: _ruleGroup,\n ...extraProps\n}: AntDNotToggleProps): React.JSX.Element => (\n <Switch\n title={title}\n className={className}\n onChange={v => handleOnChange(v)}\n checked={!!checked}\n disabled={disabled}\n checkedChildren={label}\n unCheckedChildren=\"=\"\n {...extraProps}\n />\n);\n","import { Button } from 'antd';\nimport * as React from 'react';\nimport type { ShiftActionsProps } from 'react-querybuilder';\n\n/**\n * @group Components\n */\nexport const AntDShiftActions = ({\n shiftUp,\n shiftDown,\n shiftUpDisabled,\n shiftDownDisabled,\n disabled,\n className,\n labels,\n titles,\n testID,\n}: ShiftActionsProps): React.JSX.Element => (\n <div data-testid={testID} className={className}>\n <Button\n type=\"primary\"\n size=\"small\"\n title={titles?.shiftUp}\n onClick={shiftUp}\n disabled={disabled || shiftUpDisabled}>\n {labels?.shiftUp}\n </Button>\n <Button\n type=\"primary\"\n size=\"small\"\n title={titles?.shiftDown}\n onClick={shiftDown}\n disabled={disabled || shiftDownDisabled}>\n {labels?.shiftDown}\n </Button>\n </div>\n);\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.call = call;\nexports.default = void 0;\nexports.note = note;\nexports.noteOnce = noteOnce;\nexports.preMessage = void 0;\nexports.resetWarned = resetWarned;\nexports.warning = warning;\nexports.warningOnce = warningOnce;\n/* eslint-disable no-console */\nvar warned = {};\nvar preWarningFns = [];\n\n/**\n * Pre warning enable you to parse content before console.error.\n * Modify to null will prevent warning.\n */\nvar preMessage = exports.preMessage = function preMessage(fn) {\n preWarningFns.push(fn);\n};\n\n/**\n * Warning if condition not match.\n * @param valid Condition\n * @param message Warning message\n * @example\n * ```js\n * warning(false, 'some error'); // print some error\n * warning(true, 'some error'); // print nothing\n * warning(1 === 2, 'some error'); // print some error\n * ```\n */\nfunction warning(valid, message) {\n if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {\n var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {\n return preMessageFn(msg !== null && msg !== void 0 ? msg : '', 'warning');\n }, message);\n if (finalMessage) {\n console.error(\"Warning: \".concat(finalMessage));\n }\n }\n}\n\n/** @see Similar to {@link warning} */\nfunction note(valid, message) {\n if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {\n var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {\n return preMessageFn(msg !== null && msg !== void 0 ? msg : '', 'note');\n }, message);\n if (finalMessage) {\n console.warn(\"Note: \".concat(finalMessage));\n }\n }\n}\nfunction resetWarned() {\n warned = {};\n}\nfunction call(method, valid, message) {\n if (!valid && !warned[message]) {\n method(false, message);\n warned[message] = true;\n }\n}\n\n/** @see Same as {@link warning}, but only warn once for the same message */\nfunction warningOnce(valid, message) {\n call(warning, valid, message);\n}\n\n/** @see Same as {@link warning}, but only warn once for the same message */\nfunction noteOnce(valid, message) {\n call(note, valid, message);\n}\nwarningOnce.preMessage = preMessage;\nwarningOnce.resetWarned = resetWarned;\nwarningOnce.noteOnce = noteOnce;\nvar _default = exports.default = warningOnce;","/**\n * This file is adapted from the following sources:\n * - https://github.com/react-component/picker/blob/d526bd551778070be3295060f1b5841786cb9500/src/generate/dayjs.ts\n * - https://github.com/react-component/picker/blob/d526bd551778070be3295060f1b5841786cb9500/src/generate/index.ts\n */\n\nimport type { Dayjs } from 'dayjs';\nimport dayjs from 'dayjs';\nimport advancedFormat from 'dayjs/plugin/advancedFormat.js';\nimport customParseFormat from 'dayjs/plugin/customParseFormat.js';\nimport localeData from 'dayjs/plugin/localeData.js';\nimport weekOfYear from 'dayjs/plugin/weekOfYear.js';\nimport weekYear from 'dayjs/plugin/weekYear.js';\nimport weekday from 'dayjs/plugin/weekday.js';\nimport { noteOnce } from 'rc-util/lib/warning';\n\ntype GenerateConfig<DateType> = {\n // Get\n getWeekDay: (value: DateType) => number;\n getMillisecond: (value: DateType) => number;\n getSecond: (value: DateType) => number;\n getMinute: (value: DateType) => number;\n getHour: (value: DateType) => number;\n getDate: (value: DateType) => number;\n getMonth: (value: DateType) => number;\n getYear: (value: DateType) => number;\n getNow: () => DateType;\n getFixedDate: (fixed: string) => DateType;\n getEndDate: (value: DateType) => DateType;\n\n // Set\n addYear: (value: DateType, diff: number) => DateType;\n addMonth: (value: DateType, diff: number) => DateType;\n addDate: (value: DateType, diff: number) => DateType;\n setYear: (value: DateType, year: number) => DateType;\n setMonth: (value: DateType, month: number) => DateType;\n setDate: (value: DateType, date: number) => DateType;\n setHour: (value: DateType, hour: number) => DateType;\n setMinute: (value: DateType, minute: number) => DateType;\n setSecond: (value: DateType, second: number) => DateType;\n setMillisecond: (value: DateType, millisecond: number) => DateType;\n\n // Compare\n isAfter: (date1: DateType, date2: DateType) => boolean;\n isValidate: (date: DateType) => boolean;\n\n locale: {\n getWeekFirstDay: (locale: string) => number;\n getWeekFirstDate: (locale: string, value: DateType) => DateType;\n getWeek: (locale: string, value: DateType) => number;\n\n format: (locale: string, date: DateType, format: string) => string;\n\n /** Should only return validate date instance */\n parse: (locale: string, text: string, formats: string[]) => DateType | null;\n\n /** A proxy for getting locale with moment or other locale library */\n getShortWeekDays?: (locale: string) => string[];\n /** A proxy for getting locale with moment or other locale library */\n getShortMonths?: (locale: string) => string[];\n };\n};\n\ndayjs.extend(customParseFormat);\ndayjs.extend(advancedFormat);\ndayjs.extend(weekday);\ndayjs.extend(localeData);\ndayjs.extend(weekOfYear);\ndayjs.extend(weekYear);\n\ndayjs.extend((o, c) => {\n // todo support Wo (ISO week)\n const proto = c.prototype;\n const oldFormat = proto.format;\n proto.format = function f(formatStr: string) {\n const str = (formatStr || '').replace('Wo', 'wo');\n return oldFormat.bind(this)(str);\n };\n});\n\ntype IlocaleMapObject = Record<string, string>;\nconst localeMap: IlocaleMapObject = {\n // ar_EG:\n // az_AZ:\n // bg_BG:\n bn_BD: 'bn-bd',\n by_BY: 'be',\n // ca_ES:\n // cs_CZ:\n // da_DK:\n // de_DE:\n // el_GR:\n en_GB: 'en-gb',\n en_US: 'en',\n // es_ES:\n // et_EE:\n // fa_IR:\n // fi_FI:\n fr_BE: 'fr', // todo: dayjs has no fr_BE locale, use fr at present\n fr_CA: 'fr-ca',\n // fr_FR:\n // ga_IE:\n // gl_ES:\n // he_IL:\n // hi_IN:\n // hr_HR:\n // hu_HU:\n hy_AM: 'hy-am',\n // id_ID:\n // is_IS:\n // it_IT:\n // ja_JP:\n // ka_GE:\n // kk_KZ:\n // km_KH:\n kmr_IQ: 'ku',\n // kn_IN:\n // ko_KR:\n // ku_IQ: // previous ku in antd\n // lt_LT:\n // lv_LV:\n // mk_MK:\n // ml_IN:\n // mn_MN:\n // ms_MY:\n // nb_NO:\n // ne_NP:\n nl_BE: 'nl-be',\n // nl_NL:\n // pl_PL:\n pt_BR: 'pt-br',\n // pt_PT:\n // ro_RO:\n // ru_RU:\n // sk_SK:\n // sl_SI:\n // sr_RS:\n // sv_SE:\n // ta_IN:\n // th_TH:\n // tr_TR:\n // uk_UA:\n // ur_PK:\n // vi_VN:\n zh_CN: 'zh-cn',\n zh_HK: 'zh-hk',\n zh_TW: 'zh-tw',\n};\n\nconst parseLocale = (locale: string) => {\n const mapLocale = localeMap[locale];\n return mapLocale || locale.split('_')[0];\n};\n\nconst parseNoMatchNotice = () => {\n /* istanbul ignore next */\n noteOnce(false, 'Not match any format. Please help to fire a issue about this.');\n};\n\nconst generateConfig: GenerateConfig<Dayjs> = {\n // get\n getNow: () => dayjs(),\n getFixedDate: string => dayjs(string, ['YYYY-M-DD', 'YYYY-MM-DD']),\n getEndDate: date => date.endOf('month'),\n getWeekDay: date => {\n const clone = date.locale('en');\n return clone.weekday() + clone.localeData().firstDayOfWeek();\n },\n getYear: date => date.year(),\n getMonth: date => date.month(),\n getDate: date => date.date(),\n getHour: date => date.hour(),\n getMinute: date => date.minute(),\n getSecond: date => date.second(),\n getMillisecond: date => date.millisecond(),\n\n // set\n addYear: (date, diff) => date.add(diff, 'year'),\n addMonth: (date, diff) => date.add(diff, 'month'),\n addDate: (date, diff) => date.add(diff, 'day'),\n setYear: (date, year) => date.year(year),\n setMonth: (date, month) => date.month(month),\n setDate: (date, num) => date.date(num),\n setHour: (date, hour) => date.hour(hour),\n setMinute: (date, minute) => date.minute(minute),\n setSecond: (date, second) => date.second(second),\n setMillisecond: (date, milliseconds) => date.millisecond(milliseconds),\n\n // Compare\n isAfter: (date1, date2) => date1.isAfter(date2),\n isValidate: date => date.isValid(),\n\n locale: {\n getWeekFirstDay: locale => dayjs().locale(parseLocale(locale)).localeData().firstDayOfWeek(),\n getWeekFirstDate: (locale, date) => date.locale(parseLocale(locale)).weekday(0),\n getWeek: (locale, date) => date.locale(parseLocale(locale)).week(),\n getShortWeekDays: locale => dayjs().locale(parseLocale(locale)).localeData().weekdaysMin(),\n getShortMonths: locale => dayjs().locale(parseLocale(locale)).localeData().monthsShort(),\n format: (locale, date, format) => date.locale(parseLocale(locale)).format(format),\n parse: (locale, text, formats) => {\n const localeStr = parseLocale(locale);\n for (const format of formats) {\n const formatText = text;\n if (format.includes('wo') || format.includes('Wo')) {\n // parse Wo\n const year = formatText.split('-')[0];\n const weekStr = formatText.split('-')[1];\n const firstWeek = dayjs(year, 'YYYY').startOf('year').locale(localeStr);\n for (let j = 0; j <= 52; j += 1) {\n const nextWeek = firstWeek.add(j, 'week');\n if (nextWeek.format('Wo') === weekStr) {\n return nextWeek;\n }\n }\n parseNoMatchNotice();\n return null;\n }\n const date = dayjs(formatText, format, true).locale(localeStr);\n if (date.isValid()) {\n return date;\n }\n }\n\n if (text) {\n parseNoMatchNotice();\n }\n return null;\n },\n },\n};\n\nexport default generateConfig;\n","import { Checkbox, Input, InputNumber, Radio, Switch } from 'antd';\nimport generatePicker from 'antd/es/date-picker/generatePicker/index.js';\nimport type { Dayjs } from 'dayjs';\nimport dayjs from 'dayjs';\nimport * as React from 'react';\nimport type { ValueEditorProps } from 'react-querybuilder';\nimport { joinWith, useValueEditor, ValueEditor } from 'react-querybuilder';\nimport dayjsGenerateConfig from './dayjs';\n\n/**\n * @group Props\n */\nexport interface AntDValueEditorProps extends ValueEditorProps {\n extraProps?: Record<string, unknown>;\n}\n\nconst DatePicker = generatePicker(dayjsGenerateConfig);\n\n/**\n * @group Components\n */\nexport const AntDValueEditor = (allProps: AntDValueEditorProps): React.JSX.Element | null => {\n const {\n fieldData,\n operator,\n value,\n handleOnChange,\n title,\n className,\n type,\n inputType,\n values = [],\n listsAsArrays,\n separator,\n valueSource: _vs,\n disabled,\n testID,\n selectorComponent: SelectorComponent = allProps.schema.controls.valueSelector,\n extraProps,\n parseNumbers: _parseNumbers,\n ...propsForValueSelector\n } = allProps;\n\n const {\n valueAsArray,\n multiValueHandler,\n bigIntValueHandler,\n valueListItemClassName,\n inputTypeCoerced,\n } = useValueEditor(allProps);\n\n if (operator === 'null' || operator === 'notNull') {\n return null;\n }\n\n const placeHolderText = fieldData?.placeholder ?? '';\n\n if (\n (operator === 'between' || operator === 'notBetween') &&\n (type === 'select' || type === 'text') &&\n // Date ranges are handled differently in AntD--see below\n inputTypeCoerced !== 'date' &&\n inputTypeCoerced !== 'datetime-local'\n ) {\n if (type === 'text') {\n const editors = ['from', 'to'].map((key, i) => {\n if (inputTypeCoerced === 'time') {\n return (\n <DatePicker.TimePicker\n key={key}\n value={valueAsArray[i] ? dayjs(valueAsArray[i], 'HH:mm:ss') : null}\n className={valueListItemClassName}\n disabled={disabled}\n placeholder={placeHolderText}\n onChange={d => multiValueHandler(d?.format('HH:mm:ss') ?? '', i)}\n {...extraProps}\n />\n );\n } else if (inputTypeCoerced === 'number') {\n return (\n <InputNumber\n key={key}\n type={inputTypeCoerced}\n value={valueAsArray[i] ?? ''}\n className={valueListItemClassName}\n disabled={disabled}\n placeholder={placeHolderText}\n onChange={v => multiValueHandler(v, i)}\n {...extraProps}\n />\n );\n }\n return (\n <Input\n key={key}\n type={inputTypeCoerced}\n value={valueAsArray[i] ?? ''}\n className={valueListItemClassName}\n disabled={disabled}\n placeholder={placeHolderText}\n onChange={e => multiValueHandler(e.target.value, i)}\n {...extraProps}\n />\n );\n });\n return (\n <span data-testid={testID} className={className} title={title}>\n {editors[0]}\n {separator}\n {editors[1]}\n </span>\n );\n }\n\n return <ValueEditor {...allProps} skipHook />;\n }\n\n switch (type) {\n case 'select':\n case 'multiselect':\n return (\n <SelectorComponent\n {...propsForValueSelector}\n className={className}\n title={title}\n value={value}\n disabled={disabled}\n listsAsArrays={listsAsArrays}\n multiple={type === 'multiselect'}\n handleOnChange={handleOnChange}\n options={values}\n {...extraProps}\n />\n );\n\n case 'textarea':\n return (\n <Input.TextArea\n value={value}\n title={title}\n className={className}\n disabled={disabled}\n placeholder={placeHolderText}\n onChange={e => handleOnChange(e.target.value)}\n {...extraProps}\n />\n );\n\n case 'switch':\n return (\n <Switch\n checked={!!value}\n title={title}\n className={className}\n disabled={disabled}\n onChange={v => handleOnChange(v)}\n {...extraProps}\n />\n );\n\n case 'checkbox':\n return (\n <span title={title} className={className}>\n <Checkbox\n type=\"checkbox\"\n disabled={disabled}\n onChange={e => handleOnChange(e.target.checked)}\n checked={!!value}\n {...extraProps}\n />\n </span>\n );\n\n case 'radio':\n return (\n <span className={className} title={title}>\n {values.map(v => (\n <Radio\n key={v.name}\n value={v.name}\n checked={value === v.name}\n disabled={disabled}\n onChange={e => handleOnChange(e.target.value)}\n {...extraProps}>\n {v.label}\n </Radio>\n ))}\n </span>\n );\n }\n\n switch (inputTypeCoerced) {\n case 'date':\n case 'datetime-local': {\n if (operator === 'between' || operator === 'notBetween') {\n // oxlint-disable-next-line typescript/no-explicit-any\n const dayjsArray = valueAsArray.slice(0, 2).map((v: any) => dayjs(v)) as [Dayjs, Dayjs];\n return (\n <DatePicker.RangePicker\n value={dayjsArray.every(d => d.isValid()) ? dayjsArray : undefined}\n showTime={inputTypeCoerced === 'datetime-local'}\n className={className}\n disabled={disabled}\n placeholder={[placeHolderText, placeHolderText]}\n // TODO: the function below is currently untested (see the\n // \"renders a date range picker\" test in ./AntD.test.tsx)\n onChange={\n // istanbul ignore next\n dates => {\n const timeFormat = inputTypeCoerced === 'datetime-local' ? 'THH:mm:ss' : '';\n const format = `YYYY-MM-DD${timeFormat}`;\n const dateArray = dates?.map(d => (d?.isValid() ? d.format(format) : undefined));\n handleOnChange(\n dateArray ? (listsAsArrays ? dateArray : joinWith(dateArray, ',')) : dates\n );\n }\n }\n {...extraProps}\n />\n );\n }\n\n const dateValue = dayjs(value);\n return (\n <DatePicker\n value={dateValue.isValid() ? dateValue : undefined}\n showTime={inputTypeCoerced === 'datetime-local'}\n className={className}\n disabled={disabled}\n placeholder={placeHolderText}\n onChange={(_d, dateString) => handleOnChange(dateString)}\n {...extraProps}\n />\n );\n }\n\n case 'time': {\n const dateValue = dayjs(value, 'HH:mm:ss');\n return (\n <DatePicker.TimePicker\n value={dateValue.isValid() ? dateValue : undefined}\n className={className}\n disabled={disabled}\n placeholder={placeHolderText}\n onChange={d => handleOnChange(d?.format('HH:mm:ss') ?? '')}\n {...extraProps}\n />\n );\n }\n\n case 'number': {\n return (\n <InputNumber\n type={inputTypeCoerced}\n value={value}\n title={title}\n className={className}\n disabled={disabled}\n placeholder={placeHolderText}\n onChange={handleOnChange}\n {...extraProps}\n />\n );\n }\n }\n\n if (inputType === 'bigint') {\n return (\n <Input\n data-testid={testID}\n type={inputTypeCoerced}\n placeholder={placeHolderText}\n value={`${value}`}\n title={title}\n className={className}\n disabled={disabled}\n onChange={e => bigIntValueHandler(e.target.value)}\n {...extraProps}\n />\n );\n }\n\n return (\n <Input\n type={inputTypeCoerced}\n value={value}\n title={title}\n className={className}\n disabled={disabled}\n placeholder={placeHolderText}\n onChange={e => handleOnChange(e.target.value)}\n {...extraProps}\n />\n );\n};\n","import { Select } from 'antd';\nimport type { ComponentPropsWithoutRef } from 'react';\nimport * as React from 'react';\nimport type { VersatileSelectorProps } from 'react-querybuilder';\nimport { joinWith, useValueSelector } from 'react-querybuilder';\n\n/**\n * @group Props\n */\nexport type AntDValueSelectorProps = VersatileSelectorProps &\n Omit<ComponentPropsWithoutRef<typeof Select>, 'onChange' | 'defaultValue'>;\n\n/**\n * @group Components\n */\nexport const AntDValueSelector = ({\n className,\n handleOnChange,\n options,\n value,\n title,\n disabled,\n multiple,\n listsAsArrays,\n // Props that should not be in extraProps\n testID: _testID,\n rule: _rule,\n ruleGroup: _ruleGroup,\n rules: _rules,\n level: _level,\n path: _path,\n context: _context,\n validation: _validation,\n operator: _operator,\n field: _field,\n fieldData: _fieldData,\n schema: _schema,\n ...extraProps\n}: AntDValueSelectorProps): React.JSX.Element => {\n // Alternate onChange handler that doesn't use arrays even when `multiple` is true\n const { onChange: onChangeNoArrays } = useValueSelector({\n handleOnChange,\n listsAsArrays: false,\n multiple: false,\n value,\n });\n const { onChange: onChangeNormal, val } = useValueSelector({\n handleOnChange,\n // This forces `val` to be an array if `multiple` is true,\n // even if `listsAsArrays` is false\n listsAsArrays: multiple || listsAsArrays,\n multiple,\n value,\n });\n\n const onChange = React.useCallback(\n (v: string | string[]) => {\n if (multiple && !listsAsArrays && Array.isArray(v)) {\n // `multiple: true` means `v` is probably an array, but we don't want\n // to send an array to `handleOnChange` when `listsAsArrays` is false\n onChangeNoArrays(joinWith(v));\n } else {\n onChangeNormal(v);\n }\n },\n [listsAsArrays, multiple, onChangeNoArrays, onChangeNormal]\n );\n\n return (\n <Select\n {...(multiple ? { mode: 'multiple', allowClear: true } : {})}\n title={title}\n className={className}\n popupMatchSelectWidth={false}\n disabled={disabled}\n value={val}\n onChange={onChange}\n optionFilterProp=\"label\"\n options={options}\n {...extraProps}\n />\n );\n};\n","import {\n CloseOutlined,\n CopyOutlined,\n DownOutlined,\n LockOutlined,\n UnlockOutlined,\n UpOutlined,\n} from '@ant-design/icons';\nimport * as React from 'react';\nimport type {\n ControlElementsProp,\n FullField,\n QueryBuilderContextProvider,\n Translations,\n} from 'react-querybuilder';\nimport { getCompatContextProvider } from 'react-querybuilder';\nimport { AntDActionElement } from './AntDActionElement';\nimport { AntDDragHandle } from './AntDDragHandle';\nimport { AntDNotToggle } from './AntDNotToggle';\nimport { AntDShiftActions } from './AntDShiftActions';\nimport { AntDValueEditor } from './AntDValueEditor';\nimport { AntDValueSelector } from './AntDValueSelector';\n\nexport * from './AntDActionElement';\nexport * from './AntDDragHandle';\nexport * from './AntDNotToggle';\nexport * from './AntDShiftActions';\nexport * from './AntDValueEditor';\nexport * from './AntDValueSelector';\n\n/**\n * @group Props\n */\nexport const antdControlElements: ControlElementsProp<FullField, string> = {\n actionElement: AntDActionElement,\n dragHandle: AntDDragHandle,\n notToggle: AntDNotToggle,\n shiftActions: AntDShiftActions,\n valueEditor: AntDValueEditor,\n valueSelector: AntDValueSelector,\n};\n\n/**\n * @group Props\n */\nexport const antdTranslations: Partial<Translations> = {\n removeGroup: { label: <CloseOutlined /> },\n removeRule: { label: <CloseOutlined /> },\n cloneRule: { label: <CopyOutlined /> },\n cloneRuleGroup: { label: <CopyOutlined /> },\n lockGroup: { label: <UnlockOutlined /> },\n lockRule: { label: <UnlockOutlined /> },\n lockGroupDisabled: { label: <LockOutlined /> },\n lockRuleDisabled: { label: <LockOutlined /> },\n shiftActionUp: { label: <UpOutlined /> },\n shiftActionDown: { label: <DownOutlined /> },\n};\n\n/**\n * @group Components\n */\nexport const QueryBuilderAntD: QueryBuilderContextProvider = getCompatContextProvider({\n controlElements: antdControlElements,\n translations: antdTranslations,\n});\n"],"x_google_ignoreList":[4],"mappings":"iiCAqBA,MAAa,GAAqB,CAChC,YACA,gBACA,QACA,QACA,WACA,sBAEA,OAAQ,EACR,MAAO,EACP,KAAM,EACN,QAAS,EACT,WAAY,EACZ,YAAa,EACb,OAAQ,EACR,GAAG,KAEH,EAAA,cAACA,EAAAA,OAAAA,CACC,KAAK,UACM,YACX,MAAO,GAAuB,EAAW,EAAoB,MAAQ,EACrE,QAAS,GAAK,EAAc,EAAE,CAC9B,SAAU,GAAY,CAAC,EACvB,GAAI,GACH,GAAuB,EAAW,EAAoB,MAAQ,EACxD,CC7BEC,GAAAA,EAAAA,EAAAA,aAIT,CACE,YACA,QAEA,OAAQ,EACR,MAAO,EACP,KAAM,EACN,MAAO,EACP,SAAU,EACV,QAAS,EACT,WAAY,EACZ,OAAQ,EACR,YAAa,EACb,GAAG,GAEL,IACG,EAAA,cAACC,EAAAA,eAAAA,CAA0B,YAAkB,QAAO,GAAI,EAAY,IAAK,GAAW,CAC1F,CCvBY,GAAiB,CAC5B,YACA,iBACA,QACA,UACA,QACA,WAEA,KAAM,EACN,QAAS,EACT,WAAY,EACZ,OAAQ,EACR,OAAQ,EACR,UAAW,EACX,GAAG,KAEH,EAAA,cAACC,EAAAA,OAAAA,CACQ,QACI,YACX,SAAU,GAAK,EAAe,EAAE,CAChC,QAAS,CAAC,CAAC,EACD,WACV,gBAAiB,EACjB,kBAAkB,IAClB,GAAI,GACJ,CCjCS,GAAoB,CAC/B,UACA,YACA,kBACA,oBACA,WACA,YACA,SACA,SACA,YAEA,EAAA,cAAC,MAAA,CAAI,cAAa,EAAmB,aACnC,EAAA,cAACC,EAAAA,OAAAA,CACC,KAAK,UACL,KAAK,QACL,MAAO,GAAQ,QACf,QAAS,EACT,SAAU,GAAY,GACrB,GAAQ,QACF,CACT,EAAA,cAACA,EAAAA,OAAAA,CACC,KAAK,UACL,KAAK,QACL,MAAO,GAAQ,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cAACA,EAAAA,cAAAA,KAAgB,CAAE,CACxC,UAAW,CAAE,MAAO,EAAA,cAACC,EAAAA,aAAAA,KAAe,CAAE,CACtC,eAAgB,CAAE,MAAO,EAAA,cAACA,EAAAA,aAAAA,KAAe,CAAE,CAC3C,UAAW,CAAE,MAAO,EAAA,cAACC,EAAAA,eAAAA,KAAiB,CAAE,CACxC,SAAU,CAAE,MAAO,EAAA,cAACA,EAAAA,eAAAA,KAAiB,CAAE,CACvC,kBAAmB,CAAE,MAAO,EAAA,cAACC,EAAAA,aAAAA,KAAe,CAAE,CAC9C,iBAAkB,CAAE,MAAO,EAAA,cAACA,EAAAA,aAAAA,KAAe,CAAE,CAC7C,cAAe,CAAE,MAAO,EAAA,cAACC,EAAAA,WAAAA,KAAa,CAAE,CACxC,gBAAiB,CAAE,MAAO,EAAA,cAACC,EAAAA,aAAAA,KAAe,CAAE,CAC7C,CAKYC,GAAAA,EAAAA,EAAAA,0BAAyE,CACpF,gBAAiB,EACjB,aAAc,EACf,CAAC"}
|
|
1
|
+
{"version":3,"file":"react-querybuilder_antd.cjs.production.js","names":["Button","AntDDragHandle: React.ForwardRefExoticComponent<\n Omit<AntDDragHandleProps, 'ref'> & React.RefAttributes<HTMLSpanElement>\n>","HolderOutlined","Switch","Button","noteOnce","preMessage","customParseFormat","advancedFormat","weekday","localeData","weekOfYear","weekYear","localeMap: IlocaleMapObject","generateConfig: GenerateConfig<Dayjs>","dayjsGenerateConfig","InputNumber","Input","ValueEditor","Switch","Checkbox","Radio","React","Select","antdControlElements: ControlElementsProp<FullField, string>","antdTranslations: Partial<Translations>","CloseOutlined","CopyOutlined","UnlockOutlined","LockOutlined","UpOutlined","DownOutlined","QueryBuilderAntD: QueryBuilderContextProvider"],"sources":["../../src/AntDActionElement.tsx","../../src/AntDDragHandle.tsx","../../src/AntDNotToggle.tsx","../../src/AntDShiftActions.tsx","../../../../node_modules/rc-util/lib/warning.js","../../src/dayjs.ts","../../src/AntDValueEditor.tsx","../../src/AntDValueSelector.tsx","../../src/index.tsx"],"sourcesContent":["import { Button } from 'antd';\nimport type { ComponentPropsWithoutRef } from 'react';\nimport * as React from 'react';\nimport type { ActionProps } from 'react-querybuilder';\n\n// TODO: This may be unnecessary. Find out if there's a way to allow\n// `data-${string}` index keys without breaking other type contraints.\ntype RemoveDataIndexKeys<T> = {\n [K in keyof T as `data-${string}` extends K ? never : K]: T[K];\n};\n\n/**\n * @group Props\n */\nexport interface AntDActionProps\n extends ActionProps, RemoveDataIndexKeys<ComponentPropsWithoutRef<typeof Button>> {}\n\n/**\n * @group Components\n */\nexport const AntDActionElement = ({\n className,\n handleOnClick,\n label,\n title,\n disabled,\n disabledTranslation,\n // Props that should not be in extraProps\n testID: _testID,\n level: _level,\n path: _path,\n context: _context,\n validation: _validation,\n ruleOrGroup: _ruleOrGroup,\n schema: _schema,\n ...extraProps\n}: AntDActionProps): React.JSX.Element => (\n <Button\n type=\"primary\"\n className={className}\n title={disabledTranslation && disabled ? disabledTranslation.title : title}\n onClick={e => handleOnClick(e)}\n disabled={disabled && !disabledTranslation}\n {...extraProps}>\n {disabledTranslation && disabled ? disabledTranslation.label : label}\n </Button>\n);\n","import { HolderOutlined } from '@ant-design/icons';\nimport type { ComponentPropsWithRef } from 'react';\nimport * as React from 'react';\nimport { forwardRef } from 'react';\nimport type { DragHandleProps } from 'react-querybuilder';\n\n/**\n * @group Props\n */\n// oxlint-disable-next-line typescript/no-explicit-any\nexport type AntDDragHandleProps = DragHandleProps & { label?: any } & ComponentPropsWithRef<\n typeof HolderOutlined\n >;\n\n/**\n * @group Components\n */\nexport const AntDDragHandle: React.ForwardRefExoticComponent<\n Omit<AntDDragHandleProps, 'ref'> & React.RefAttributes<HTMLSpanElement>\n> = forwardRef<HTMLSpanElement, AntDDragHandleProps>(\n (\n {\n className,\n title,\n // Props that should not be in extraProps\n testID: _testID,\n level: _level,\n path: _path,\n label: _label,\n disabled: _disabled,\n context: _context,\n validation: _validation,\n schema: _schema,\n ruleOrGroup: _ruleOrGroup,\n ...extraProps\n },\n dragRef\n ) => <HolderOutlined className={className} title={title} {...extraProps} ref={dragRef} />\n);\n","import { Switch } from 'antd';\nimport type { ComponentPropsWithoutRef } from 'react';\nimport * as React from 'react';\nimport type { NotToggleProps } from 'react-querybuilder';\n\n/**\n * @group Props\n */\nexport interface AntDNotToggleProps\n extends NotToggleProps, ComponentPropsWithoutRef<typeof Switch> {}\n\n/**\n * @group Components\n */\nexport const AntDNotToggle = ({\n className,\n handleOnChange,\n label,\n checked,\n title,\n disabled,\n // Props that should not be in extraProps\n path: _path,\n context: _context,\n validation: _validation,\n testID: _testID,\n schema: _schema,\n ruleGroup: _ruleGroup,\n ...extraProps\n}: AntDNotToggleProps): React.JSX.Element => (\n <Switch\n title={title}\n className={className}\n onChange={v => handleOnChange(v)}\n checked={!!checked}\n disabled={disabled}\n checkedChildren={label}\n unCheckedChildren=\"=\"\n {...extraProps}\n />\n);\n","import { Button } from 'antd';\nimport * as React from 'react';\nimport type { ShiftActionsProps } from 'react-querybuilder';\n\n/**\n * @group Components\n */\nexport const AntDShiftActions = ({\n shiftUp,\n shiftDown,\n shiftUpDisabled,\n shiftDownDisabled,\n disabled,\n className,\n labels,\n titles,\n testID,\n}: ShiftActionsProps): React.JSX.Element => (\n <div data-testid={testID} className={className}>\n <Button\n type=\"primary\"\n size=\"small\"\n title={titles?.shiftUp}\n onClick={shiftUp}\n disabled={disabled || shiftUpDisabled}>\n {labels?.shiftUp}\n </Button>\n <Button\n type=\"primary\"\n size=\"small\"\n title={titles?.shiftDown}\n onClick={shiftDown}\n disabled={disabled || shiftDownDisabled}>\n {labels?.shiftDown}\n </Button>\n </div>\n);\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.call = call;\nexports.default = void 0;\nexports.note = note;\nexports.noteOnce = noteOnce;\nexports.preMessage = void 0;\nexports.resetWarned = resetWarned;\nexports.warning = warning;\nexports.warningOnce = warningOnce;\n/* eslint-disable no-console */\nvar warned = {};\nvar preWarningFns = [];\n\n/**\n * Pre warning enable you to parse content before console.error.\n * Modify to null will prevent warning.\n */\nvar preMessage = exports.preMessage = function preMessage(fn) {\n preWarningFns.push(fn);\n};\n\n/**\n * Warning if condition not match.\n * @param valid Condition\n * @param message Warning message\n * @example\n * ```js\n * warning(false, 'some error'); // print some error\n * warning(true, 'some error'); // print nothing\n * warning(1 === 2, 'some error'); // print some error\n * ```\n */\nfunction warning(valid, message) {\n if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {\n var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {\n return preMessageFn(msg !== null && msg !== void 0 ? msg : '', 'warning');\n }, message);\n if (finalMessage) {\n console.error(\"Warning: \".concat(finalMessage));\n }\n }\n}\n\n/** @see Similar to {@link warning} */\nfunction note(valid, message) {\n if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {\n var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {\n return preMessageFn(msg !== null && msg !== void 0 ? msg : '', 'note');\n }, message);\n if (finalMessage) {\n console.warn(\"Note: \".concat(finalMessage));\n }\n }\n}\nfunction resetWarned() {\n warned = {};\n}\nfunction call(method, valid, message) {\n if (!valid && !warned[message]) {\n method(false, message);\n warned[message] = true;\n }\n}\n\n/** @see Same as {@link warning}, but only warn once for the same message */\nfunction warningOnce(valid, message) {\n call(warning, valid, message);\n}\n\n/** @see Same as {@link warning}, but only warn once for the same message */\nfunction noteOnce(valid, message) {\n call(note, valid, message);\n}\nwarningOnce.preMessage = preMessage;\nwarningOnce.resetWarned = resetWarned;\nwarningOnce.noteOnce = noteOnce;\nvar _default = exports.default = warningOnce;","/**\n * This file is adapted from the following sources:\n * - https://github.com/react-component/picker/blob/d526bd551778070be3295060f1b5841786cb9500/src/generate/dayjs.ts\n * - https://github.com/react-component/picker/blob/d526bd551778070be3295060f1b5841786cb9500/src/generate/index.ts\n */\n\nimport type { Dayjs } from 'dayjs';\nimport dayjs from 'dayjs';\nimport advancedFormat from 'dayjs/plugin/advancedFormat.js';\nimport customParseFormat from 'dayjs/plugin/customParseFormat.js';\nimport localeData from 'dayjs/plugin/localeData.js';\nimport weekOfYear from 'dayjs/plugin/weekOfYear.js';\nimport weekYear from 'dayjs/plugin/weekYear.js';\nimport weekday from 'dayjs/plugin/weekday.js';\nimport { noteOnce } from 'rc-util/lib/warning';\n\ntype GenerateConfig<DateType> = {\n // Get\n getWeekDay: (value: DateType) => number;\n getMillisecond: (value: DateType) => number;\n getSecond: (value: DateType) => number;\n getMinute: (value: DateType) => number;\n getHour: (value: DateType) => number;\n getDate: (value: DateType) => number;\n getMonth: (value: DateType) => number;\n getYear: (value: DateType) => number;\n getNow: () => DateType;\n getFixedDate: (fixed: string) => DateType;\n getEndDate: (value: DateType) => DateType;\n\n // Set\n addYear: (value: DateType, diff: number) => DateType;\n addMonth: (value: DateType, diff: number) => DateType;\n addDate: (value: DateType, diff: number) => DateType;\n setYear: (value: DateType, year: number) => DateType;\n setMonth: (value: DateType, month: number) => DateType;\n setDate: (value: DateType, date: number) => DateType;\n setHour: (value: DateType, hour: number) => DateType;\n setMinute: (value: DateType, minute: number) => DateType;\n setSecond: (value: DateType, second: number) => DateType;\n setMillisecond: (value: DateType, millisecond: number) => DateType;\n\n // Compare\n isAfter: (date1: DateType, date2: DateType) => boolean;\n isValidate: (date: DateType) => boolean;\n\n locale: {\n getWeekFirstDay: (locale: string) => number;\n getWeekFirstDate: (locale: string, value: DateType) => DateType;\n getWeek: (locale: string, value: DateType) => number;\n\n format: (locale: string, date: DateType, format: string) => string;\n\n /** Should only return validate date instance */\n parse: (locale: string, text: string, formats: string[]) => DateType | null;\n\n /** A proxy for getting locale with moment or other locale library */\n getShortWeekDays?: (locale: string) => string[];\n /** A proxy for getting locale with moment or other locale library */\n getShortMonths?: (locale: string) => string[];\n };\n};\n\ndayjs.extend(customParseFormat);\ndayjs.extend(advancedFormat);\ndayjs.extend(weekday);\ndayjs.extend(localeData);\ndayjs.extend(weekOfYear);\ndayjs.extend(weekYear);\n\ndayjs.extend((o, c) => {\n // todo support Wo (ISO week)\n const proto = c.prototype;\n const oldFormat = proto.format;\n proto.format = function f(formatStr: string) {\n const str = (formatStr || '').replace('Wo', 'wo');\n return oldFormat.bind(this)(str);\n };\n});\n\ntype IlocaleMapObject = Record<string, string>;\nconst localeMap: IlocaleMapObject = {\n // ar_EG:\n // az_AZ:\n // bg_BG:\n bn_BD: 'bn-bd',\n by_BY: 'be',\n // ca_ES:\n // cs_CZ:\n // da_DK:\n // de_DE:\n // el_GR:\n en_GB: 'en-gb',\n en_US: 'en',\n // es_ES:\n // et_EE:\n // fa_IR:\n // fi_FI:\n fr_BE: 'fr', // todo: dayjs has no fr_BE locale, use fr at present\n fr_CA: 'fr-ca',\n // fr_FR:\n // ga_IE:\n // gl_ES:\n // he_IL:\n // hi_IN:\n // hr_HR:\n // hu_HU:\n hy_AM: 'hy-am',\n // id_ID:\n // is_IS:\n // it_IT:\n // ja_JP:\n // ka_GE:\n // kk_KZ:\n // km_KH:\n kmr_IQ: 'ku',\n // kn_IN:\n // ko_KR:\n // ku_IQ: // previous ku in antd\n // lt_LT:\n // lv_LV:\n // mk_MK:\n // ml_IN:\n // mn_MN:\n // ms_MY:\n // nb_NO:\n // ne_NP:\n nl_BE: 'nl-be',\n // nl_NL:\n // pl_PL:\n pt_BR: 'pt-br',\n // pt_PT:\n // ro_RO:\n // ru_RU:\n // sk_SK:\n // sl_SI:\n // sr_RS:\n // sv_SE:\n // ta_IN:\n // th_TH:\n // tr_TR:\n // uk_UA:\n // ur_PK:\n // vi_VN:\n zh_CN: 'zh-cn',\n zh_HK: 'zh-hk',\n zh_TW: 'zh-tw',\n};\n\nconst parseLocale = (locale: string) => {\n const mapLocale = localeMap[locale];\n return mapLocale || locale.split('_')[0];\n};\n\nconst parseNoMatchNotice = () => {\n /* istanbul ignore next */\n noteOnce(false, 'Not match any format. Please help to fire a issue about this.');\n};\n\nconst generateConfig: GenerateConfig<Dayjs> = {\n // get\n getNow: () => dayjs(),\n getFixedDate: string => dayjs(string, ['YYYY-M-DD', 'YYYY-MM-DD']),\n getEndDate: date => date.endOf('month'),\n getWeekDay: date => {\n const clone = date.locale('en');\n return clone.weekday() + clone.localeData().firstDayOfWeek();\n },\n getYear: date => date.year(),\n getMonth: date => date.month(),\n getDate: date => date.date(),\n getHour: date => date.hour(),\n getMinute: date => date.minute(),\n getSecond: date => date.second(),\n getMillisecond: date => date.millisecond(),\n\n // set\n addYear: (date, diff) => date.add(diff, 'year'),\n addMonth: (date, diff) => date.add(diff, 'month'),\n addDate: (date, diff) => date.add(diff, 'day'),\n setYear: (date, year) => date.year(year),\n setMonth: (date, month) => date.month(month),\n setDate: (date, num) => date.date(num),\n setHour: (date, hour) => date.hour(hour),\n setMinute: (date, minute) => date.minute(minute),\n setSecond: (date, second) => date.second(second),\n setMillisecond: (date, milliseconds) => date.millisecond(milliseconds),\n\n // Compare\n isAfter: (date1, date2) => date1.isAfter(date2),\n isValidate: date => date.isValid(),\n\n locale: {\n getWeekFirstDay: locale => dayjs().locale(parseLocale(locale)).localeData().firstDayOfWeek(),\n getWeekFirstDate: (locale, date) => date.locale(parseLocale(locale)).weekday(0),\n getWeek: (locale, date) => date.locale(parseLocale(locale)).week(),\n getShortWeekDays: locale => dayjs().locale(parseLocale(locale)).localeData().weekdaysMin(),\n getShortMonths: locale => dayjs().locale(parseLocale(locale)).localeData().monthsShort(),\n format: (locale, date, format) => date.locale(parseLocale(locale)).format(format),\n parse: (locale, text, formats) => {\n const localeStr = parseLocale(locale);\n for (const format of formats) {\n const formatText = text;\n if (format.includes('wo') || format.includes('Wo')) {\n // parse Wo\n const year = formatText.split('-')[0];\n const weekStr = formatText.split('-')[1];\n const firstWeek = dayjs(year, 'YYYY').startOf('year').locale(localeStr);\n for (let j = 0; j <= 52; j += 1) {\n const nextWeek = firstWeek.add(j, 'week');\n if (nextWeek.format('Wo') === weekStr) {\n return nextWeek;\n }\n }\n parseNoMatchNotice();\n return null;\n }\n const date = dayjs(formatText, format, true).locale(localeStr);\n if (date.isValid()) {\n return date;\n }\n }\n\n if (text) {\n parseNoMatchNotice();\n }\n return null;\n },\n },\n};\n\nexport default generateConfig;\n","import { Checkbox, Input, InputNumber, Radio, Switch } from 'antd';\nimport generatePicker from 'antd/es/date-picker/generatePicker/index.js';\nimport type { Dayjs } from 'dayjs';\nimport dayjs from 'dayjs';\nimport * as React from 'react';\nimport type { ValueEditorProps } from 'react-querybuilder';\nimport { joinWith, useValueEditor, ValueEditor } from 'react-querybuilder';\nimport dayjsGenerateConfig from './dayjs';\n\n/**\n * @group Props\n */\nexport interface AntDValueEditorProps extends ValueEditorProps {\n extraProps?: Record<string, unknown>;\n}\n\nconst DatePicker = generatePicker(dayjsGenerateConfig);\n\n/**\n * @group Components\n */\nexport const AntDValueEditor = (allProps: AntDValueEditorProps): React.JSX.Element | null => {\n const {\n fieldData,\n operator,\n value,\n handleOnChange,\n title,\n className,\n type,\n inputType,\n values = [],\n listsAsArrays,\n separator,\n valueSource: _vs,\n disabled,\n testID,\n selectorComponent: SelectorComponent = allProps.schema.controls.valueSelector,\n extraProps,\n parseNumbers: _parseNumbers,\n ...propsForValueSelector\n } = allProps;\n\n const {\n valueAsArray,\n multiValueHandler,\n bigIntValueHandler,\n valueListItemClassName,\n inputTypeCoerced,\n } = useValueEditor(allProps);\n\n if (operator === 'null' || operator === 'notNull') {\n return null;\n }\n\n const placeHolderText = fieldData?.placeholder ?? '';\n\n if (\n (operator === 'between' || operator === 'notBetween') &&\n (type === 'select' || type === 'text') &&\n // Date ranges are handled differently in AntD--see below\n inputTypeCoerced !== 'date' &&\n inputTypeCoerced !== 'datetime-local'\n ) {\n if (type === 'text') {\n const editors = ['from', 'to'].map((key, i) => {\n if (inputTypeCoerced === 'time') {\n return (\n <DatePicker.TimePicker\n key={key}\n value={valueAsArray[i] ? dayjs(valueAsArray[i], 'HH:mm:ss') : null}\n className={valueListItemClassName}\n disabled={disabled}\n placeholder={placeHolderText}\n onChange={d => multiValueHandler(d?.format('HH:mm:ss') ?? '', i)}\n {...extraProps}\n />\n );\n } else if (inputTypeCoerced === 'number') {\n return (\n <InputNumber\n key={key}\n type={inputTypeCoerced}\n value={valueAsArray[i] ?? ''}\n className={valueListItemClassName}\n disabled={disabled}\n placeholder={placeHolderText}\n onChange={v => multiValueHandler(v, i)}\n {...extraProps}\n />\n );\n }\n return (\n <Input\n key={key}\n type={inputTypeCoerced}\n value={valueAsArray[i] ?? ''}\n className={valueListItemClassName}\n disabled={disabled}\n placeholder={placeHolderText}\n onChange={e => multiValueHandler(e.target.value, i)}\n {...extraProps}\n />\n );\n });\n return (\n <span data-testid={testID} className={className} title={title}>\n {editors[0]}\n {separator}\n {editors[1]}\n </span>\n );\n }\n\n return <ValueEditor {...allProps} skipHook />;\n }\n\n switch (type) {\n case 'select':\n case 'multiselect':\n return (\n <SelectorComponent\n {...propsForValueSelector}\n className={className}\n title={title}\n value={value}\n disabled={disabled}\n listsAsArrays={listsAsArrays}\n multiple={type === 'multiselect'}\n handleOnChange={handleOnChange}\n options={values}\n {...extraProps}\n />\n );\n\n case 'textarea':\n return (\n <Input.TextArea\n value={value}\n title={title}\n className={className}\n disabled={disabled}\n placeholder={placeHolderText}\n onChange={e => handleOnChange(e.target.value)}\n {...extraProps}\n />\n );\n\n case 'switch':\n return (\n <Switch\n checked={!!value}\n title={title}\n className={className}\n disabled={disabled}\n onChange={v => handleOnChange(v)}\n {...extraProps}\n />\n );\n\n case 'checkbox':\n return (\n <span title={title} className={className}>\n <Checkbox\n type=\"checkbox\"\n disabled={disabled}\n onChange={e => handleOnChange(e.target.checked)}\n checked={!!value}\n {...extraProps}\n />\n </span>\n );\n\n case 'radio':\n return (\n <span className={className} title={title}>\n {values.map(v => (\n <Radio\n key={v.name}\n value={v.name}\n checked={value === v.name}\n disabled={disabled}\n onChange={e => handleOnChange(e.target.value)}\n {...extraProps}>\n {v.label}\n </Radio>\n ))}\n </span>\n );\n }\n\n switch (inputTypeCoerced) {\n case 'date':\n case 'datetime-local': {\n if (operator === 'between' || operator === 'notBetween') {\n // oxlint-disable-next-line typescript/no-explicit-any\n const dayjsArray = valueAsArray.slice(0, 2).map((v: any) => dayjs(v)) as [Dayjs, Dayjs];\n return (\n <DatePicker.RangePicker\n value={dayjsArray.every(d => d.isValid()) ? dayjsArray : undefined}\n showTime={inputTypeCoerced === 'datetime-local'}\n className={className}\n disabled={disabled}\n placeholder={[placeHolderText, placeHolderText]}\n // TODO: the function below is currently untested (see the\n // \"renders a date range picker\" test in ./AntD.test.tsx)\n onChange={\n // istanbul ignore next\n dates => {\n const timeFormat = inputTypeCoerced === 'datetime-local' ? 'THH:mm:ss' : '';\n const format = `YYYY-MM-DD${timeFormat}`;\n const dateArray = dates?.map(d => (d?.isValid() ? d.format(format) : undefined));\n handleOnChange(\n dateArray ? (listsAsArrays ? dateArray : joinWith(dateArray, ',')) : dates\n );\n }\n }\n {...extraProps}\n />\n );\n }\n\n const dateValue = dayjs(value);\n return (\n <DatePicker\n value={dateValue.isValid() ? dateValue : undefined}\n showTime={inputTypeCoerced === 'datetime-local'}\n className={className}\n disabled={disabled}\n placeholder={placeHolderText}\n onChange={(_d, dateString) => handleOnChange(dateString)}\n {...extraProps}\n />\n );\n }\n\n case 'time': {\n const dateValue = dayjs(value, 'HH:mm:ss');\n return (\n <DatePicker.TimePicker\n value={dateValue.isValid() ? dateValue : undefined}\n className={className}\n disabled={disabled}\n placeholder={placeHolderText}\n onChange={d => handleOnChange(d?.format('HH:mm:ss') ?? '')}\n {...extraProps}\n />\n );\n }\n\n case 'number': {\n return (\n <InputNumber\n type={inputTypeCoerced}\n value={value}\n title={title}\n className={className}\n disabled={disabled}\n placeholder={placeHolderText}\n onChange={handleOnChange}\n {...extraProps}\n />\n );\n }\n }\n\n if (inputType === 'bigint') {\n return (\n <Input\n data-testid={testID}\n type={inputTypeCoerced}\n placeholder={placeHolderText}\n value={`${value}`}\n title={title}\n className={className}\n disabled={disabled}\n onChange={e => bigIntValueHandler(e.target.value)}\n {...extraProps}\n />\n );\n }\n\n return (\n <Input\n type={inputTypeCoerced}\n value={value}\n title={title}\n className={className}\n disabled={disabled}\n placeholder={placeHolderText}\n onChange={e => handleOnChange(e.target.value)}\n {...extraProps}\n />\n );\n};\n","import { Select } from 'antd';\nimport type { ComponentPropsWithoutRef } from 'react';\nimport * as React from 'react';\nimport type { VersatileSelectorProps } from 'react-querybuilder';\nimport { joinWith, useValueSelector } from 'react-querybuilder';\n\n/**\n * @group Props\n */\nexport type AntDValueSelectorProps = VersatileSelectorProps &\n Omit<ComponentPropsWithoutRef<typeof Select>, 'onChange' | 'defaultValue'>;\n\n/**\n * @group Components\n */\nexport const AntDValueSelector = ({\n className,\n handleOnChange,\n options,\n value,\n title,\n disabled,\n multiple,\n listsAsArrays,\n // Props that should not be in extraProps\n testID: _testID,\n rule: _rule,\n ruleGroup: _ruleGroup,\n rules: _rules,\n level: _level,\n path: _path,\n context: _context,\n validation: _validation,\n operator: _operator,\n field: _field,\n fieldData: _fieldData,\n schema: _schema,\n ...extraProps\n}: AntDValueSelectorProps): React.JSX.Element => {\n // Alternate onChange handler that doesn't use arrays even when `multiple` is true\n const { onChange: onChangeNoArrays } = useValueSelector({\n handleOnChange,\n listsAsArrays: false,\n multiple: false,\n value,\n });\n const { onChange: onChangeNormal, val } = useValueSelector({\n handleOnChange,\n // This forces `val` to be an array if `multiple` is true,\n // even if `listsAsArrays` is false\n listsAsArrays: multiple || listsAsArrays,\n multiple,\n value,\n });\n\n const onChange = React.useCallback(\n (v: string | string[]) => {\n if (multiple && !listsAsArrays && Array.isArray(v)) {\n // `multiple: true` means `v` is probably an array, but we don't want\n // to send an array to `handleOnChange` when `listsAsArrays` is false\n onChangeNoArrays(joinWith(v));\n } else {\n onChangeNormal(v);\n }\n },\n [listsAsArrays, multiple, onChangeNoArrays, onChangeNormal]\n );\n\n return (\n <Select\n {...(multiple ? { mode: 'multiple', allowClear: true } : {})}\n title={title}\n className={className}\n popupMatchSelectWidth={false}\n disabled={disabled}\n value={val}\n onChange={onChange}\n optionFilterProp=\"label\"\n options={options}\n {...extraProps}\n />\n );\n};\n","import {\n CloseOutlined,\n CopyOutlined,\n DownOutlined,\n LockOutlined,\n UnlockOutlined,\n UpOutlined,\n} from '@ant-design/icons';\nimport * as React from 'react';\nimport type {\n ControlElementsProp,\n FullField,\n QueryBuilderContextProvider,\n Translations,\n} from 'react-querybuilder';\nimport { getCompatContextProvider } from 'react-querybuilder';\nimport { AntDActionElement } from './AntDActionElement';\nimport { AntDDragHandle } from './AntDDragHandle';\nimport { AntDNotToggle } from './AntDNotToggle';\nimport { AntDShiftActions } from './AntDShiftActions';\nimport { AntDValueEditor } from './AntDValueEditor';\nimport { AntDValueSelector } from './AntDValueSelector';\n\nexport * from './AntDActionElement';\nexport * from './AntDDragHandle';\nexport * from './AntDNotToggle';\nexport * from './AntDShiftActions';\nexport * from './AntDValueEditor';\nexport * from './AntDValueSelector';\n\n/**\n * @group Props\n */\nexport const antdControlElements: ControlElementsProp<FullField, string> = {\n actionElement: AntDActionElement,\n dragHandle: AntDDragHandle,\n notToggle: AntDNotToggle,\n shiftActions: AntDShiftActions,\n valueEditor: AntDValueEditor,\n valueSelector: AntDValueSelector,\n};\n\n/**\n * @group Props\n */\nexport const antdTranslations: Partial<Translations> = {\n removeGroup: { label: <CloseOutlined /> },\n removeRule: { label: <CloseOutlined /> },\n cloneRule: { label: <CopyOutlined /> },\n cloneRuleGroup: { label: <CopyOutlined /> },\n lockGroup: { label: <UnlockOutlined /> },\n lockRule: { label: <UnlockOutlined /> },\n lockGroupDisabled: { label: <LockOutlined /> },\n lockRuleDisabled: { label: <LockOutlined /> },\n shiftActionUp: { label: <UpOutlined /> },\n shiftActionDown: { label: <DownOutlined /> },\n};\n\n/**\n * @group Components\n */\nexport const QueryBuilderAntD: QueryBuilderContextProvider = getCompatContextProvider({\n controlElements: antdControlElements,\n translations: antdTranslations,\n});\n"],"x_google_ignoreList":[4],"mappings":"iiCAoBA,MAAa,GAAqB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tC,eAAgB,CAAE,MAAO,EAAA,cAACA,EAAAA,aAAAA,KAAe,CAAE,CAC3C,UAAW,CAAE,MAAO,EAAA,cAACC,EAAAA,eAAAA,KAAiB,CAAE,CACxC,SAAU,CAAE,MAAO,EAAA,cAACA,EAAAA,eAAAA,KAAiB,CAAE,CACvC,kBAAmB,CAAE,MAAO,EAAA,cAACC,EAAAA,aAAAA,KAAe,CAAE,CAC9C,iBAAkB,CAAE,MAAO,EAAA,cAACA,EAAAA,aAAAA,KAAe,CAAE,CAC7C,cAAe,CAAE,MAAO,EAAA,cAACC,EAAAA,WAAAA,KAAa,CAAE,CACxC,gBAAiB,CAAE,MAAO,EAAA,cAACC,EAAAA,aAAAA,KAAe,CAAE,CAC7C,CAKYC,GAAAA,EAAAA,EAAAA,0BAAyE,CACpF,gBAAiB,EACjB,aAAc,EACf,CAAC"}
|
|
@@ -20,34 +20,6 @@ type Intersection = UnionToIntersection<Union>;
|
|
|
20
20
|
//=> {the(): void; great(arg: string): void; escape: boolean};
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
A more applicable example which could make its way into your library code follows.
|
|
24
|
-
|
|
25
|
-
@example
|
|
26
|
-
```
|
|
27
|
-
import type {UnionToIntersection} from 'type-fest';
|
|
28
|
-
|
|
29
|
-
class CommandOne {
|
|
30
|
-
commands: {
|
|
31
|
-
a1: () => undefined,
|
|
32
|
-
b1: () => undefined,
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
class CommandTwo {
|
|
37
|
-
commands: {
|
|
38
|
-
a2: (argA: string) => undefined,
|
|
39
|
-
b2: (argB: string) => undefined,
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const union = [new CommandOne(), new CommandTwo()].map(instance => instance.commands);
|
|
44
|
-
type Union = typeof union;
|
|
45
|
-
//=> {a1(): void; b1(): void} | {a2(argA: string): void; b2(argB: string): void}
|
|
46
|
-
|
|
47
|
-
type Intersection = UnionToIntersection<Union>;
|
|
48
|
-
//=> {a1(): void; b1(): void; a2(argA: string): void; b2(argB: string): void}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
23
|
@category Type
|
|
52
24
|
*/
|
|
53
25
|
type UnionToIntersection<Union> = (
|
|
@@ -123,8 +95,8 @@ import type {IsAny} from 'type-fest';
|
|
|
123
95
|
const typedObject = {a: 1, b: 2} as const;
|
|
124
96
|
const anyObject: any = {a: 1, b: 2};
|
|
125
97
|
|
|
126
|
-
function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(
|
|
127
|
-
return
|
|
98
|
+
function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(object: O, key: K) {
|
|
99
|
+
return object[key];
|
|
128
100
|
}
|
|
129
101
|
|
|
130
102
|
const typedA = get(typedObject, 'a');
|
|
@@ -149,17 +121,17 @@ This is useful when writing utility types or schema validators that need to diff
|
|
|
149
121
|
```
|
|
150
122
|
import type {IsOptionalKeyOf} from 'type-fest';
|
|
151
123
|
|
|
152
|
-
|
|
124
|
+
type User = {
|
|
153
125
|
name: string;
|
|
154
126
|
surname: string;
|
|
155
127
|
|
|
156
128
|
luckyNumber?: number;
|
|
157
|
-
}
|
|
129
|
+
};
|
|
158
130
|
|
|
159
|
-
|
|
131
|
+
type Admin = {
|
|
160
132
|
name: string;
|
|
161
133
|
surname?: string;
|
|
162
|
-
}
|
|
134
|
+
};
|
|
163
135
|
|
|
164
136
|
type T1 = IsOptionalKeyOf<User, 'luckyNumber'>;
|
|
165
137
|
//=> true
|
|
@@ -192,12 +164,12 @@ This is useful when you want to create a new type that contains different type v
|
|
|
192
164
|
```
|
|
193
165
|
import type {OptionalKeysOf, Except} from 'type-fest';
|
|
194
166
|
|
|
195
|
-
|
|
167
|
+
type User = {
|
|
196
168
|
name: string;
|
|
197
169
|
surname: string;
|
|
198
170
|
|
|
199
171
|
luckyNumber?: number;
|
|
200
|
-
}
|
|
172
|
+
};
|
|
201
173
|
|
|
202
174
|
const REMOVE_FIELD = Symbol('remove field symbol');
|
|
203
175
|
type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
|
|
@@ -205,12 +177,12 @@ type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKe
|
|
|
205
177
|
};
|
|
206
178
|
|
|
207
179
|
const update1: UpdateOperation<User> = {
|
|
208
|
-
name: 'Alice'
|
|
180
|
+
name: 'Alice',
|
|
209
181
|
};
|
|
210
182
|
|
|
211
183
|
const update2: UpdateOperation<User> = {
|
|
212
184
|
name: 'Bob',
|
|
213
|
-
luckyNumber: REMOVE_FIELD
|
|
185
|
+
luckyNumber: REMOVE_FIELD,
|
|
214
186
|
};
|
|
215
187
|
```
|
|
216
188
|
|
|
@@ -230,17 +202,23 @@ This is useful when you want to create a new type that contains different type v
|
|
|
230
202
|
```
|
|
231
203
|
import type {RequiredKeysOf} from 'type-fest';
|
|
232
204
|
|
|
233
|
-
declare function createValidation<
|
|
205
|
+
declare function createValidation<
|
|
206
|
+
Entity extends object,
|
|
207
|
+
Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>,
|
|
208
|
+
>(field: Key, validator: (value: Entity[Key]) => boolean): (entity: Entity) => boolean;
|
|
234
209
|
|
|
235
|
-
|
|
210
|
+
type User = {
|
|
236
211
|
name: string;
|
|
237
212
|
surname: string;
|
|
238
|
-
|
|
239
213
|
luckyNumber?: number;
|
|
240
|
-
}
|
|
214
|
+
};
|
|
241
215
|
|
|
242
216
|
const validator1 = createValidation<User>('name', value => value.length < 25);
|
|
243
217
|
const validator2 = createValidation<User>('surname', value => value.length < 25);
|
|
218
|
+
|
|
219
|
+
// @ts-expect-error
|
|
220
|
+
const validator3 = createValidation<User>('luckyNumber', value => value > 0);
|
|
221
|
+
// Error: Argument of type '"luckyNumber"' is not assignable to parameter of type '"name" | "surname"'.
|
|
244
222
|
```
|
|
245
223
|
|
|
246
224
|
@category Utilities
|
|
@@ -262,29 +240,41 @@ Useful in type utilities, such as checking if something does not occur.
|
|
|
262
240
|
```
|
|
263
241
|
import type {IsNever, And} from 'type-fest';
|
|
264
242
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
And<
|
|
268
|
-
IsNever<Exclude<A, B>> extends true ? true : false,
|
|
269
|
-
IsNever<Exclude<B, A>> extends true ? true : false
|
|
270
|
-
>;
|
|
271
|
-
|
|
272
|
-
type EndIfEqual<I extends string, O extends string> =
|
|
273
|
-
AreStringsEqual<I, O> extends true
|
|
274
|
-
? never
|
|
275
|
-
: void;
|
|
276
|
-
|
|
277
|
-
function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
|
|
278
|
-
if (input === output) {
|
|
279
|
-
process.exit(0);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
243
|
+
type A = IsNever<never>;
|
|
244
|
+
//=> true
|
|
282
245
|
|
|
283
|
-
|
|
284
|
-
//=>
|
|
246
|
+
type B = IsNever<any>;
|
|
247
|
+
//=> false
|
|
248
|
+
|
|
249
|
+
type C = IsNever<unknown>;
|
|
250
|
+
//=> false
|
|
251
|
+
|
|
252
|
+
type D = IsNever<never[]>;
|
|
253
|
+
//=> false
|
|
254
|
+
|
|
255
|
+
type E = IsNever<object>;
|
|
256
|
+
//=> false
|
|
257
|
+
|
|
258
|
+
type F = IsNever<string>;
|
|
259
|
+
//=> false
|
|
260
|
+
```
|
|
285
261
|
|
|
286
|
-
|
|
287
|
-
|
|
262
|
+
@example
|
|
263
|
+
```
|
|
264
|
+
import type {IsNever} from 'type-fest';
|
|
265
|
+
|
|
266
|
+
type IsTrue<T> = T extends true ? true : false;
|
|
267
|
+
|
|
268
|
+
// When a distributive conditional is instantiated with `never`, the entire conditional results in `never`.
|
|
269
|
+
type A = IsTrue<never>;
|
|
270
|
+
// ^? type A = never
|
|
271
|
+
|
|
272
|
+
// If you don't want that behaviour, you can explicitly add an `IsNever` check before the distributive conditional.
|
|
273
|
+
type IsTrueFixed<T> =
|
|
274
|
+
IsNever<T> extends true ? false : T extends true ? true : false;
|
|
275
|
+
|
|
276
|
+
type B = IsTrueFixed<never>;
|
|
277
|
+
// ^? type B = false
|
|
288
278
|
```
|
|
289
279
|
|
|
290
280
|
@category Type Guard
|
|
@@ -305,7 +295,7 @@ Note:
|
|
|
305
295
|
|
|
306
296
|
@example
|
|
307
297
|
```
|
|
308
|
-
import {If} from 'type-fest';
|
|
298
|
+
import type {If} from 'type-fest';
|
|
309
299
|
|
|
310
300
|
type A = If<true, 'yes', 'no'>;
|
|
311
301
|
//=> 'yes'
|
|
@@ -325,7 +315,7 @@ type E = If<never, 'yes', 'no'>;
|
|
|
325
315
|
|
|
326
316
|
@example
|
|
327
317
|
```
|
|
328
|
-
import {If, IsAny, IsNever} from 'type-fest';
|
|
318
|
+
import type {If, IsAny, IsNever} from 'type-fest';
|
|
329
319
|
|
|
330
320
|
type A = If<IsAny<unknown>, 'is any', 'not any'>;
|
|
331
321
|
//=> 'not any'
|
|
@@ -336,7 +326,7 @@ type B = If<IsNever<never>, 'is never', 'not never'>;
|
|
|
336
326
|
|
|
337
327
|
@example
|
|
338
328
|
```
|
|
339
|
-
import {If, IsEqual} from 'type-fest';
|
|
329
|
+
import type {If, IsEqual} from 'type-fest';
|
|
340
330
|
|
|
341
331
|
type IfEqual<T, U, IfBranch, ElseBranch> = If<IsEqual<T, U>, IfBranch, ElseBranch>;
|
|
342
332
|
|
|
@@ -466,10 +456,11 @@ const literal = {foo: 123, bar: 'hello', baz: 456};
|
|
|
466
456
|
const someType: SomeType = literal;
|
|
467
457
|
const someInterface: SomeInterface = literal;
|
|
468
458
|
|
|
469
|
-
function fn(object: Record<string, unknown>): void
|
|
459
|
+
declare function fn(object: Record<string, unknown>): void;
|
|
470
460
|
|
|
471
461
|
fn(literal); // Good: literal object type is sealed
|
|
472
462
|
fn(someType); // Good: type is sealed
|
|
463
|
+
// @ts-expect-error
|
|
473
464
|
fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
|
|
474
465
|
fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
|
|
475
466
|
```
|
|
@@ -507,7 +498,7 @@ type Includes<Value extends readonly any[], Item> =
|
|
|
507
498
|
@category Type Guard
|
|
508
499
|
@category Utilities
|
|
509
500
|
*/
|
|
510
|
-
type IsEqual<A, B> = [A
|
|
501
|
+
type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false : false;
|
|
511
502
|
// This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
|
|
512
503
|
type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
|
|
513
504
|
//#endregion
|
|
@@ -529,6 +520,7 @@ It relies on the fact that an empty object (`{}`) is assignable to an object wit
|
|
|
529
520
|
```
|
|
530
521
|
const indexed: Record<string, unknown> = {}; // Allowed
|
|
531
522
|
|
|
523
|
+
// @ts-expect-error
|
|
532
524
|
const keyed: Record<'foo', unknown> = {}; // Error
|
|
533
525
|
// => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
|
|
534
526
|
```
|
|
@@ -542,16 +534,14 @@ type Indexed = {} extends Record<string, unknown>
|
|
|
542
534
|
// => '✅ `{}` is assignable to `Record<string, unknown>`'
|
|
543
535
|
|
|
544
536
|
type Keyed = {} extends Record<'foo' | 'bar', unknown>
|
|
545
|
-
?
|
|
546
|
-
:
|
|
537
|
+
? '✅ `{}` is assignable to `Record<\'foo\' | \'bar\', unknown>`'
|
|
538
|
+
: '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`';
|
|
547
539
|
// => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"
|
|
548
540
|
```
|
|
549
541
|
|
|
550
542
|
Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
|
|
551
543
|
|
|
552
544
|
```
|
|
553
|
-
import type {OmitIndexSignature} from 'type-fest';
|
|
554
|
-
|
|
555
545
|
type OmitIndexSignature<ObjectType> = {
|
|
556
546
|
[KeyType in keyof ObjectType // Map each key of `ObjectType`...
|
|
557
547
|
]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
|
|
@@ -561,14 +551,12 @@ type OmitIndexSignature<ObjectType> = {
|
|
|
561
551
|
...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
|
|
562
552
|
|
|
563
553
|
```
|
|
564
|
-
import type {OmitIndexSignature} from 'type-fest';
|
|
565
|
-
|
|
566
554
|
type OmitIndexSignature<ObjectType> = {
|
|
567
555
|
[KeyType in keyof ObjectType
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
556
|
+
// Is `{}` assignable to `Record<KeyType, unknown>`?
|
|
557
|
+
as {} extends Record<KeyType, unknown>
|
|
558
|
+
? never // ✅ `{}` is assignable to `Record<KeyType, unknown>`
|
|
559
|
+
: KeyType // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
|
|
572
560
|
]: ObjectType[KeyType];
|
|
573
561
|
};
|
|
574
562
|
```
|
|
@@ -579,21 +567,21 @@ If `{}` is assignable, it means that `KeyType` is an index signature and we want
|
|
|
579
567
|
```
|
|
580
568
|
import type {OmitIndexSignature} from 'type-fest';
|
|
581
569
|
|
|
582
|
-
|
|
570
|
+
type Example = {
|
|
583
571
|
// These index signatures will be removed.
|
|
584
|
-
[x: string]: any
|
|
585
|
-
[x: number]: any
|
|
586
|
-
[x: symbol]: any
|
|
587
|
-
[x: `head-${string}`]: string
|
|
588
|
-
[x: `${string}-tail`]: string
|
|
589
|
-
[x: `head-${string}-tail`]: string
|
|
590
|
-
[x: `${bigint}`]: string
|
|
591
|
-
[x: `embedded-${number}`]: string
|
|
572
|
+
[x: string]: any;
|
|
573
|
+
[x: number]: any;
|
|
574
|
+
[x: symbol]: any;
|
|
575
|
+
[x: `head-${string}`]: string;
|
|
576
|
+
[x: `${string}-tail`]: string;
|
|
577
|
+
[x: `head-${string}-tail`]: string;
|
|
578
|
+
[x: `${bigint}`]: string;
|
|
579
|
+
[x: `embedded-${number}`]: string;
|
|
592
580
|
|
|
593
581
|
// These explicitly defined keys will remain.
|
|
594
582
|
foo: 'bar';
|
|
595
583
|
qux?: 'baz';
|
|
596
|
-
}
|
|
584
|
+
};
|
|
597
585
|
|
|
598
586
|
type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
599
587
|
// => { foo: 'bar'; qux?: 'baz' | undefined; }
|
|
@@ -663,12 +651,12 @@ Merge two types into a new type. Keys of the second type overrides keys of the f
|
|
|
663
651
|
```
|
|
664
652
|
import type {Merge} from 'type-fest';
|
|
665
653
|
|
|
666
|
-
|
|
654
|
+
type Foo = {
|
|
667
655
|
[x: string]: unknown;
|
|
668
656
|
[x: number]: unknown;
|
|
669
657
|
foo: string;
|
|
670
658
|
bar: symbol;
|
|
671
|
-
}
|
|
659
|
+
};
|
|
672
660
|
|
|
673
661
|
type Bar = {
|
|
674
662
|
[x: number]: number;
|
|
@@ -847,12 +835,14 @@ type Foo = {
|
|
|
847
835
|
type FooWithoutA = Except<Foo, 'a'>;
|
|
848
836
|
//=> {b: string}
|
|
849
837
|
|
|
838
|
+
// @ts-expect-error
|
|
850
839
|
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
851
840
|
//=> errors: 'a' does not exist in type '{ b: string; }'
|
|
852
841
|
|
|
853
842
|
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
854
843
|
//=> {a: number} & Partial<Record<"b", never>>
|
|
855
844
|
|
|
845
|
+
// @ts-expect-error
|
|
856
846
|
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
857
847
|
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
858
848
|
|
|
@@ -869,12 +859,12 @@ type UserData = {
|
|
|
869
859
|
|
|
870
860
|
// `Omit` clearly doesn't behave as expected in this case:
|
|
871
861
|
type PostPayload = Omit<UserData, 'email'>;
|
|
872
|
-
//=>
|
|
862
|
+
//=> { [x: string]: string; [x: number]: string; }
|
|
873
863
|
|
|
874
864
|
// In situations like this, `Except` works better.
|
|
875
865
|
// It simply removes the `email` key while preserving all the other keys.
|
|
876
|
-
type
|
|
877
|
-
//=>
|
|
866
|
+
type PostPayloadFixed = Except<UserData, 'email'>;
|
|
867
|
+
//=> { [x: string]: string; name: string; role: 'admin' | 'user'; }
|
|
878
868
|
```
|
|
879
869
|
|
|
880
870
|
@category Object
|
|
@@ -896,7 +886,7 @@ type Foo = {
|
|
|
896
886
|
a?: number;
|
|
897
887
|
b: string;
|
|
898
888
|
c?: boolean;
|
|
899
|
-
}
|
|
889
|
+
};
|
|
900
890
|
|
|
901
891
|
type SomeRequired = SetRequired<Foo, 'b' | 'c'>;
|
|
902
892
|
// type SomeRequired = {
|
|
@@ -950,7 +940,7 @@ type Foo = {
|
|
|
950
940
|
a: number | null;
|
|
951
941
|
b: string | undefined;
|
|
952
942
|
c?: boolean | null;
|
|
953
|
-
}
|
|
943
|
+
};
|
|
954
944
|
|
|
955
945
|
type SomeNonNullable = SetNonNullable<Foo, 'b' | 'c'>;
|
|
956
946
|
// type SomeNonNullable = {
|
|
@@ -2744,6 +2734,17 @@ type QueryBuilderProps<RG extends RuleGroupTypeAny, F extends FullField, O exten
|
|
|
2744
2734
|
context?: any;
|
|
2745
2735
|
} : never;
|
|
2746
2736
|
//#endregion
|
|
2737
|
+
//#region ../react-querybuilder/src/redux/getRqbStore.d.ts
|
|
2738
|
+
declare global {
|
|
2739
|
+
var __RQB_DEVTOOLS__: boolean | undefined;
|
|
2740
|
+
}
|
|
2741
|
+
/**
|
|
2742
|
+
* Gets the singleton React Query Builder store instance.
|
|
2743
|
+
* DevTools are enabled if either:
|
|
2744
|
+
* - globalThis.__RQB_DEVTOOLS__ is truthy
|
|
2745
|
+
* - window.__RQB_DEVTOOLS__ is truthy
|
|
2746
|
+
*/
|
|
2747
|
+
//#endregion
|
|
2747
2748
|
//#region src/AntDActionElement.d.ts
|
|
2748
2749
|
type RemoveDataIndexKeys<T$1> = { [K in keyof T$1 as `data-${string}` extends K ? never : K]: T$1[K] };
|
|
2749
2750
|
/**
|