@ahoo-wang/fetcher-viewer 2.9.5 → 2.9.8

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.
@@ -1,8 +1,50 @@
1
1
  import { ConditionFilterComponent } from './types';
2
+ /**
3
+ * Registry for managing condition filter components.
4
+ *
5
+ * Provides a centralized way to register, unregister, and retrieve
6
+ * condition filter components by their type identifiers.
7
+ */
2
8
  export declare class ConditionFilterRegistry {
3
9
  private readonly filters;
10
+ /**
11
+ * Registers a condition filter component for a specific type.
12
+ *
13
+ * @param type - The unique identifier for the filter type
14
+ * @param filter - The condition filter component to register
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const registry = new ConditionFilterRegistry();
19
+ * registry.register('text', TextConditionFilter);
20
+ * ```
21
+ */
4
22
  register(type: string, filter: ConditionFilterComponent): void;
23
+ /**
24
+ * Unregisters a condition filter component for a specific type.
25
+ *
26
+ * @param type - The unique identifier for the filter type to remove
27
+ * @returns true if the filter was successfully removed, false otherwise
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const registry = new ConditionFilterRegistry();
32
+ * const wasRemoved = registry.unregister('text');
33
+ * ```
34
+ */
5
35
  unregister(type: string): boolean;
36
+ /**
37
+ * Retrieves a condition filter component for a specific type.
38
+ *
39
+ * @param type - The unique identifier for the filter type
40
+ * @returns The condition filter component, or undefined if not found
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * const registry = new ConditionFilterRegistry();
45
+ * const TextFilter = registry.get('text');
46
+ * ```
47
+ */
6
48
  get(type: string): ConditionFilterComponent | undefined;
7
49
  }
8
50
  export declare const conditionFilterRegistry: ConditionFilterRegistry;
@@ -1 +1 @@
1
- {"version":3,"file":"conditionFilterRegistry.d.ts","sourceRoot":"","sources":["../../src/filter/conditionFilterRegistry.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD,qBAAa,uBAAuB;IAElC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsF;IAE9G,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,wBAAwB;IAIvD,UAAU,CAAC,IAAI,EAAE,MAAM;IAIvB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,wBAAwB,GAAG,SAAS;CAIxD;AAED,eAAO,MAAM,uBAAuB,yBAAgC,CAAC"}
1
+ {"version":3,"file":"conditionFilterRegistry.d.ts","sourceRoot":"","sources":["../../src/filter/conditionFilterRegistry.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD;;;;;GAKG;AACH,qBAAa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAGpB;IAEJ;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,wBAAwB;IAIvD;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM;IAIvB;;;;;;;;;;;OAWG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,wBAAwB,GAAG,SAAS;CAGxD;AAED,eAAO,MAAM,uBAAuB,yBAAgC,CAAC"}
package/dist/index.es.js CHANGED
@@ -9,12 +9,48 @@ const F = class F {
9
9
  constructor() {
10
10
  this.filters = /* @__PURE__ */ new Map();
11
11
  }
12
+ /**
13
+ * Registers a condition filter component for a specific type.
14
+ *
15
+ * @param type - The unique identifier for the filter type
16
+ * @param filter - The condition filter component to register
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * const registry = new ConditionFilterRegistry();
21
+ * registry.register('text', TextConditionFilter);
22
+ * ```
23
+ */
12
24
  register(e, n) {
13
25
  this.filters.set(e, n);
14
26
  }
27
+ /**
28
+ * Unregisters a condition filter component for a specific type.
29
+ *
30
+ * @param type - The unique identifier for the filter type to remove
31
+ * @returns true if the filter was successfully removed, false otherwise
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * const registry = new ConditionFilterRegistry();
36
+ * const wasRemoved = registry.unregister('text');
37
+ * ```
38
+ */
15
39
  unregister(e) {
16
40
  return this.filters.delete(e);
17
41
  }
42
+ /**
43
+ * Retrieves a condition filter component for a specific type.
44
+ *
45
+ * @param type - The unique identifier for the filter type
46
+ * @returns The condition filter component, or undefined if not found
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * const registry = new ConditionFilterRegistry();
51
+ * const TextFilter = registry.get('text');
52
+ * ```
53
+ */
18
54
  get(e) {
19
55
  return this.filters.get(e);
20
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../src/filter/conditionFilterRegistry.ts","../src/filter/FallbackConditionFilter.tsx","../src/filter/ConditionFilter.tsx","../src/components/TagInput.tsx","../src/filter/locale/operator.zh_CN.ts","../src/filter/friendlyCondition.ts","../src/filter/IdConditionFilter.tsx"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ConditionFilterComponent } from './types';\n\nexport class ConditionFilterRegistry {\n\n private readonly filters: Map<string, ConditionFilterComponent> = new Map<string, ConditionFilterComponent>();\n\n register(type: string, filter: ConditionFilterComponent) {\n this.filters.set(type, filter);\n }\n\n unregister(type: string) {\n return this.filters.delete(type);\n }\n\n get(type: string): ConditionFilterComponent | undefined {\n return this.filters.get(type);\n }\n\n}\n\nexport const conditionFilterRegistry = new ConditionFilterRegistry();","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Alert } from 'antd';\nimport React from 'react';\n\nexport interface FallbackConditionFilterProps {\n type: string;\n}\n\nexport function FallbackConditionFilter(props: FallbackConditionFilterProps) {\n return <Alert message={`Unsupported filter type:[${props.type}]`} type=\"warning\" showIcon />;\n}\n\nFallbackConditionFilter.displayName = 'FallbackConditionFilter';","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { ConditionFilterProps } from './types';\nimport { conditionFilterRegistry } from './conditionFilterRegistry';\nimport { FallbackConditionFilter } from './FallbackConditionFilter';\n\nexport interface TypedConditionFilterProps\n extends ConditionFilterProps {\n type: string;\n}\n\nexport const ConditionFilter = React.memo(\n (props: TypedConditionFilterProps) => {\n const FilterComponent = conditionFilterRegistry.get(props.type);\n if (!FilterComponent) {\n return <FallbackConditionFilter type={props.type} />;\n }\n return <FilterComponent {...props} />;\n },\n);\n\nConditionFilter.displayName = 'ConditionFilter';","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Select, SelectProps } from 'antd';\n\n/**\n * Props for the TagInput component.\n * Extends SelectProps from Antd, excluding 'mode', 'open', and 'suffixIcon' as they are fixed.\n */\nexport interface TagInputProps\n extends Omit<SelectProps, 'mode' | 'open' | 'suffixIcon'> {}\n\n/**\n * Default token separators for splitting input into tags.\n * Includes common separators like comma, semicolon, and space.\n */\nconst DEFAULT_TOKEN_SEPARATORS = [',', ',', ';', ';', ' '];\n\n/**\n * A tag input component based on Antd's Select in tags mode.\n * Allows users to input multiple tags separated by specified token separators.\n * @param props - The props for the TagInput component.\n * @returns The rendered TagInput component.\n */\nexport function TagInput(props: TagInputProps) {\n const {\n tokenSeparators = DEFAULT_TOKEN_SEPARATORS,\n allowClear = true,\n ...restProps\n } = props;\n return (\n <Select\n {...restProps}\n mode={'tags'}\n open={false}\n suffixIcon={null}\n allowClear={allowClear}\n tokenSeparators={tokenSeparators}\n />\n );\n}\n\nTagInput.displayName = 'TagInput';\n","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\nimport { OperatorLocale } from '@ahoo-wang/fetcher-wow';\n\nexport const OPERATOR_zh_CN: OperatorLocale = {\n AND: '与',\n OR: '或',\n NOR: '非或',\n ID: '等于',\n IDS: '包含',\n AGGREGATE_ID: '等于',\n AGGREGATE_IDS: '包含',\n TENANT_ID: '等于',\n OWNER_ID: '等于',\n DELETED: '已删除',\n ALL: '全部',\n EQ: '等于',\n NE: '不等于',\n GT: '大于',\n LT: '小于',\n GTE: '大于等于',\n LTE: '小于等于',\n CONTAINS: '包含',\n IN: '包含',\n NOT_IN: '不包含',\n BETWEEN: '在范围内',\n ALL_IN: '全部包含',\n STARTS_WITH: '以...开头',\n ENDS_WITH: '以...结尾',\n ELEM_MATCH: '元素匹配',\n NULL: '为空',\n NOT_NULL: '不为空',\n TRUE: '为真',\n FALSE: '为假',\n EXISTS: '存在',\n TODAY: '今天',\n BEFORE_TODAY: '今天之前',\n TOMORROW: '明天',\n THIS_WEEK: '本周',\n NEXT_WEEK: '下周',\n LAST_WEEK: '上周',\n THIS_MONTH: '本月',\n LAST_MONTH: '上月',\n RECENT_DAYS: '最近几天',\n EARLIER_DAYS: '几天前',\n RAW: '原始查询',\n};","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Condition, OperatorLocale } from '@ahoo-wang/fetcher-wow';\n\nexport function friendlyCondition(label: string, operatorLocale: OperatorLocale, condition: Condition) {\n const friendlyParts = [];\n friendlyParts.push(label);\n friendlyParts.push(operatorLocale[condition.operator!]);\n const value = condition.value;\n if (Array.isArray(condition.value)) {\n friendlyParts.push(value.join(', '));\n } else {\n friendlyParts.push(value);\n }\n return friendlyParts.join(' ');\n}","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ConditionFilterProps, ConditionFilterValue } from './types';\nimport { conditionFilterRegistry } from './conditionFilterRegistry';\nimport { Button, Input, Select, Space } from 'antd';\nimport { Operator, Condition } from '@ahoo-wang/fetcher-wow';\nimport { useState } from 'react';\nimport { TagInput } from '../components';\nimport { OPERATOR_zh_CN } from './locale';\nimport { friendlyCondition } from './friendlyCondition';\n\nexport const ID_CONDITION_FILTER = 'id';\n\nexport function IdConditionFilter(props: ConditionFilterProps) {\n const defaultOperator = props.operator.defaultValue || Operator.ID;\n const [operator, setOperator] = useState<Operator>(defaultOperator);\n const [value, setValue] = useState(props.value.defaultValue);\n\n const operatorLocale = props.operator.locale ?? OPERATOR_zh_CN;\n\n const buildConditionFilterValue = (): ConditionFilterValue | undefined => {\n if (!operator || !value || (Array.isArray(value) && value.length === 0)) {\n return undefined;\n }\n const condition: Condition = {\n operator,\n value,\n };\n const friendly = friendlyCondition(props.field.label, operatorLocale, condition);\n return { condition, friendly };\n };\n\n const handleOperatorChange = (newOperator: Operator) => {\n setOperator(newOperator);\n props.onChange?.(buildConditionFilterValue());\n };\n\n const handleValueChange = (newValue: any) => {\n setValue(newValue);\n props.onChange?.(buildConditionFilterValue());\n };\n const valueInput =\n operator === Operator.ID ? (\n <Input\n value={value}\n onChange={e => handleValueChange(e.target.value)}\n allowClear\n {...props.value}\n />\n ) : (\n <TagInput value={value} onChange={handleValueChange} {...props.value} />\n );\n return (\n <Space.Compact>\n <Button {...props.label}>{props.field.label}</Button>\n <Select\n defaultValue={Operator.ID}\n value={operator}\n onChange={handleOperatorChange}\n {...props.operator}\n >\n <Select.Option value={Operator.ID}>\n {operatorLocale[Operator.ID]}\n </Select.Option>\n <Select.Option value={Operator.IDS}>\n {operatorLocale[Operator.IDS]}\n </Select.Option>\n </Select>\n {valueInput}\n </Space.Compact>\n );\n}\n\nIdConditionFilter.displayName = 'IdConditionFilter';\n\nconditionFilterRegistry.register(ID_CONDITION_FILTER, IdConditionFilter);\n"],"names":["ConditionFilterRegistry","filters","Map","register","type","filter","set","unregister","delete","get","__name","_ConditionFilterRegistry","conditionFilterRegistry","FallbackConditionFilter","props","$","_c","t0","t1","Alert","displayName","ConditionFilter","React","memo","FilterComponent","jsx","DEFAULT_TOKEN_SEPARATORS","TagInput","restProps","tokenSeparators","allowClear","undefined","t2","Select","OPERATOR_zh_CN","AND","OR","NOR","ID","IDS","AGGREGATE_ID","AGGREGATE_IDS","TENANT_ID","OWNER_ID","DELETED","ALL","EQ","NE","GT","LT","GTE","LTE","CONTAINS","IN","NOT_IN","BETWEEN","ALL_IN","STARTS_WITH","ENDS_WITH","ELEM_MATCH","NULL","NOT_NULL","TRUE","FALSE","EXISTS","TODAY","BEFORE_TODAY","TOMORROW","THIS_WEEK","NEXT_WEEK","LAST_WEEK","THIS_MONTH","LAST_MONTH","RECENT_DAYS","EARLIER_DAYS","RAW","friendlyCondition","label","operatorLocale","condition","friendlyParts","push","operator","value","Array","isArray","join","ID_CONDITION_FILTER","IdConditionFilter","defaultOperator","defaultValue","Operator","setOperator","useState","setValue","locale","field","length","friendly","buildConditionFilterValue","newOperator","onChange","handleOperatorChange","newValue","handleValueChange","t3","Input","e","target","valueInput","t4","Button","t5","t6","t7","t8","t9","jsxs","t10","Space"],"mappings":";;;;;;;AAeO,MAAMA,IAAN,MAAMA,EAAwB;AAAA,EAA9B,cAAA;AAEL,SAAiBC,8BAAqDC,IAAAA;AAAAA,EAAsC;AAAA,EAE5GC,SAASC,GAAcC,GAAkC;AACvD,SAAKJ,QAAQK,IAAIF,GAAMC,CAAM;AAAA,EAC/B;AAAA,EAEAE,WAAWH,GAAc;AACvB,WAAO,KAAKH,QAAQO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AAAnE,EAAA,EAAA,MAAAkG,KAAAlG,UAAAoG,KAXlBC,IAAA,gBAAAC,EAACpF,GAAA,EACe,cAAA0D,EAAQrD,IACf4C,UACGoB,UAAAA,GAAoB,GAC1BxF,EAAKoE,UAET+B,UAAAA;AAAAA,IAAAA;AAAAA,IAGAE;AAAAA,EAAAA,GAGF,GAASpG,QAAAuF,GAAAvF,QAAAmE,GAAAnE,EAAA,EAAA,IAAAD,EAAAoE,UAAAnE,QAAAkG,GAAAlG,QAAAoG,GAAApG,QAAAqG,KAAAA,IAAArG,EAAA,EAAA;AAAA,MAAAuG;AAAA,SAAAvG,EAAA,EAAA,MAAA+F,KAAA/F,UAAAqG,KAAArG,EAAA,EAAA,MAAA8F,KAdXS,IAAA,gBAAAD,EAAAE,EAAA,SAAA,EACET,UAAAA;AAAAA,IAAAA;AAAAA,IACAM;AAAAA,IAaCP;AAAAA,EAAAA,GACH,GAAgB9F,QAAA+F,GAAA/F,QAAAqG,GAAArG,QAAA8F,GAAA9F,QAAAuG,KAAAA,IAAAvG,EAAA,EAAA,GAhBhBuG;AAgBgB;AAxDb9B,EAAAA,GAAAA;AA4DPA,EAAkBpE,cAAc;AAEhCR,EAAwBT,SAASoF,GAAqBC,CAAiB;"}
1
+ {"version":3,"file":"index.es.js","sources":["../src/filter/conditionFilterRegistry.ts","../src/filter/FallbackConditionFilter.tsx","../src/filter/ConditionFilter.tsx","../src/components/TagInput.tsx","../src/filter/locale/operator.zh_CN.ts","../src/filter/friendlyCondition.ts","../src/filter/IdConditionFilter.tsx"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ConditionFilterComponent } from './types';\n\n/**\n * Registry for managing condition filter components.\n *\n * Provides a centralized way to register, unregister, and retrieve\n * condition filter components by their type identifiers.\n */\nexport class ConditionFilterRegistry {\n private readonly filters: Map<string, ConditionFilterComponent> = new Map<\n string,\n ConditionFilterComponent\n >();\n\n /**\n * Registers a condition filter component for a specific type.\n *\n * @param type - The unique identifier for the filter type\n * @param filter - The condition filter component to register\n *\n * @example\n * ```typescript\n * const registry = new ConditionFilterRegistry();\n * registry.register('text', TextConditionFilter);\n * ```\n */\n register(type: string, filter: ConditionFilterComponent) {\n this.filters.set(type, filter);\n }\n\n /**\n * Unregisters a condition filter component for a specific type.\n *\n * @param type - The unique identifier for the filter type to remove\n * @returns true if the filter was successfully removed, false otherwise\n *\n * @example\n * ```typescript\n * const registry = new ConditionFilterRegistry();\n * const wasRemoved = registry.unregister('text');\n * ```\n */\n unregister(type: string) {\n return this.filters.delete(type);\n }\n\n /**\n * Retrieves a condition filter component for a specific type.\n *\n * @param type - The unique identifier for the filter type\n * @returns The condition filter component, or undefined if not found\n *\n * @example\n * ```typescript\n * const registry = new ConditionFilterRegistry();\n * const TextFilter = registry.get('text');\n * ```\n */\n get(type: string): ConditionFilterComponent | undefined {\n return this.filters.get(type);\n }\n}\n\nexport const conditionFilterRegistry = new ConditionFilterRegistry();\n","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Alert } from 'antd';\nimport React from 'react';\n\nexport interface FallbackConditionFilterProps {\n type: string;\n}\n\nexport function FallbackConditionFilter(props: FallbackConditionFilterProps) {\n return <Alert message={`Unsupported filter type:[${props.type}]`} type=\"warning\" showIcon />;\n}\n\nFallbackConditionFilter.displayName = 'FallbackConditionFilter';","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { ConditionFilterProps } from './types';\nimport { conditionFilterRegistry } from './conditionFilterRegistry';\nimport { FallbackConditionFilter } from './FallbackConditionFilter';\n\nexport interface TypedConditionFilterProps\n extends ConditionFilterProps {\n type: string;\n}\n\nexport const ConditionFilter = React.memo(\n (props: TypedConditionFilterProps) => {\n const FilterComponent = conditionFilterRegistry.get(props.type);\n if (!FilterComponent) {\n return <FallbackConditionFilter type={props.type} />;\n }\n return <FilterComponent {...props} />;\n },\n);\n\nConditionFilter.displayName = 'ConditionFilter';","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Select, SelectProps } from 'antd';\n\n/**\n * Props for the TagInput component.\n * Extends SelectProps from Antd, excluding 'mode', 'open', and 'suffixIcon' as they are fixed.\n */\nexport interface TagInputProps\n extends Omit<SelectProps, 'mode' | 'open' | 'suffixIcon'> {}\n\n/**\n * Default token separators for splitting input into tags.\n * Includes common separators like comma, semicolon, and space.\n */\nconst DEFAULT_TOKEN_SEPARATORS = [',', ',', ';', ';', ' '];\n\n/**\n * A tag input component based on Antd's Select in tags mode.\n * Allows users to input multiple tags separated by specified token separators.\n * @param props - The props for the TagInput component.\n * @returns The rendered TagInput component.\n */\nexport function TagInput(props: TagInputProps) {\n const {\n tokenSeparators = DEFAULT_TOKEN_SEPARATORS,\n allowClear = true,\n ...restProps\n } = props;\n return (\n <Select\n {...restProps}\n mode={'tags'}\n open={false}\n suffixIcon={null}\n allowClear={allowClear}\n tokenSeparators={tokenSeparators}\n />\n );\n}\n\nTagInput.displayName = 'TagInput';\n","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\nimport { OperatorLocale } from '@ahoo-wang/fetcher-wow';\n\nexport const OPERATOR_zh_CN: OperatorLocale = {\n AND: '与',\n OR: '或',\n NOR: '非或',\n ID: '等于',\n IDS: '包含',\n AGGREGATE_ID: '等于',\n AGGREGATE_IDS: '包含',\n TENANT_ID: '等于',\n OWNER_ID: '等于',\n DELETED: '已删除',\n ALL: '全部',\n EQ: '等于',\n NE: '不等于',\n GT: '大于',\n LT: '小于',\n GTE: '大于等于',\n LTE: '小于等于',\n CONTAINS: '包含',\n IN: '包含',\n NOT_IN: '不包含',\n BETWEEN: '在范围内',\n ALL_IN: '全部包含',\n STARTS_WITH: '以...开头',\n ENDS_WITH: '以...结尾',\n ELEM_MATCH: '元素匹配',\n NULL: '为空',\n NOT_NULL: '不为空',\n TRUE: '为真',\n FALSE: '为假',\n EXISTS: '存在',\n TODAY: '今天',\n BEFORE_TODAY: '今天之前',\n TOMORROW: '明天',\n THIS_WEEK: '本周',\n NEXT_WEEK: '下周',\n LAST_WEEK: '上周',\n THIS_MONTH: '本月',\n LAST_MONTH: '上月',\n RECENT_DAYS: '最近几天',\n EARLIER_DAYS: '几天前',\n RAW: '原始查询',\n};","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Condition, OperatorLocale } from '@ahoo-wang/fetcher-wow';\n\nexport function friendlyCondition(label: string, operatorLocale: OperatorLocale, condition: Condition) {\n const friendlyParts = [];\n friendlyParts.push(label);\n friendlyParts.push(operatorLocale[condition.operator!]);\n const value = condition.value;\n if (Array.isArray(condition.value)) {\n friendlyParts.push(value.join(', '));\n } else {\n friendlyParts.push(value);\n }\n return friendlyParts.join(' ');\n}","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ConditionFilterProps, ConditionFilterValue } from './types';\nimport { conditionFilterRegistry } from './conditionFilterRegistry';\nimport { Button, Input, Select, Space } from 'antd';\nimport { Operator, Condition } from '@ahoo-wang/fetcher-wow';\nimport { useState } from 'react';\nimport { TagInput } from '../components';\nimport { OPERATOR_zh_CN } from './locale';\nimport { friendlyCondition } from './friendlyCondition';\n\nexport const ID_CONDITION_FILTER = 'id';\n\nexport function IdConditionFilter(props: ConditionFilterProps) {\n const defaultOperator = props.operator.defaultValue || Operator.ID;\n const [operator, setOperator] = useState<Operator>(defaultOperator);\n const [value, setValue] = useState(props.value.defaultValue);\n\n const operatorLocale = props.operator.locale ?? OPERATOR_zh_CN;\n\n const buildConditionFilterValue = (): ConditionFilterValue | undefined => {\n if (!operator || !value || (Array.isArray(value) && value.length === 0)) {\n return undefined;\n }\n const condition: Condition = {\n operator,\n value,\n };\n const friendly = friendlyCondition(props.field.label, operatorLocale, condition);\n return { condition, friendly };\n };\n\n const handleOperatorChange = (newOperator: Operator) => {\n setOperator(newOperator);\n props.onChange?.(buildConditionFilterValue());\n };\n\n const handleValueChange = (newValue: any) => {\n setValue(newValue);\n props.onChange?.(buildConditionFilterValue());\n };\n const valueInput =\n operator === Operator.ID ? (\n <Input\n value={value}\n onChange={e => handleValueChange(e.target.value)}\n allowClear\n {...props.value}\n />\n ) : (\n <TagInput value={value} onChange={handleValueChange} {...props.value} />\n );\n return (\n <Space.Compact>\n <Button {...props.label}>{props.field.label}</Button>\n <Select\n defaultValue={Operator.ID}\n value={operator}\n onChange={handleOperatorChange}\n {...props.operator}\n >\n <Select.Option value={Operator.ID}>\n {operatorLocale[Operator.ID]}\n </Select.Option>\n <Select.Option value={Operator.IDS}>\n {operatorLocale[Operator.IDS]}\n </Select.Option>\n </Select>\n {valueInput}\n </Space.Compact>\n );\n}\n\nIdConditionFilter.displayName = 'IdConditionFilter';\n\nconditionFilterRegistry.register(ID_CONDITION_FILTER, IdConditionFilter);\n"],"names":["ConditionFilterRegistry","filters","Map","register","type","filter","set","unregister","delete","get","__name","_ConditionFilterRegistry","conditionFilterRegistry","FallbackConditionFilter","props","$","_c","t0","t1","Alert","displayName","ConditionFilter","React","memo","FilterComponent","jsx","DEFAULT_TOKEN_SEPARATORS","TagInput","restProps","tokenSeparators","allowClear","undefined","t2","Select","OPERATOR_zh_CN","AND","OR","NOR","ID","IDS","AGGREGATE_ID","AGGREGATE_IDS","TENANT_ID","OWNER_ID","DELETED","ALL","EQ","NE","GT","LT","GTE","LTE","CONTAINS","IN","NOT_IN","BETWEEN","ALL_IN","STARTS_WITH","ENDS_WITH","ELEM_MATCH","NULL","NOT_NULL","TRUE","FALSE","EXISTS","TODAY","BEFORE_TODAY","TOMORROW","THIS_WEEK","NEXT_WEEK","LAST_WEEK","THIS_MONTH","LAST_MONTH","RECENT_DAYS","EARLIER_DAYS","RAW","friendlyCondition","label","operatorLocale","condition","friendlyParts","push","operator","value","Array","isArray","join","ID_CONDITION_FILTER","IdConditionFilter","defaultOperator","defaultValue","Operator","setOperator","useState","setValue","locale","field","length","friendly","buildConditionFilterValue","newOperator","onChange","handleOperatorChange","newValue","handleValueChange","t3","Input","e","target","valueInput","t4","Button","t5","t6","t7","t8","t9","jsxs","t10","Space"],"mappings":";;;;;;;AAqBO,MAAMA,IAAN,MAAMA,EAAwB;AAAA,EAA9B,cAAA;AACL,SAAiBC,8BAAqDC,IAAAA;AAAAA,EAGpE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcFC,SAASC,GAAcC,GAAkC;AACvD,SAAKJ,QAAQK,IAAIF,GAAMC,CAAM;AAAA,EAC/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcAE,WAAWH,GAAc;AACvB,WAAO,KAAKH,QAAQO,OAAOJ,CAAI;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcAK,IAAIL,GAAoD;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A,gBAAAC,EAACpF,GAAA,EACe,cAAA0D,EAAQrD,IACf4C,UACGoB,UAAAA,GAAoB,GAC1BxF,EAAKoE,UAET+B,UAAAA;AAAAA,IAAAA;AAAAA,IAGAE;AAAAA,EAAAA,GAGF,GAASpG,QAAAuF,GAAAvF,QAAAmE,GAAAnE,EAAA,EAAA,IAAAD,EAAAoE,UAAAnE,QAAAkG,GAAAlG,QAAAoG,GAAApG,QAAAqG,KAAAA,IAAArG,EAAA,EAAA;AAAA,MAAAuG;AAAA,SAAAvG,EAAA,EAAA,MAAA+F,KAAA/F,UAAAqG,KAAArG,EAAA,EAAA,MAAA8F,KAdXS,IAAA,gBAAAD,EAAAE,EAAA,SAAA,EACET,UAAAA;AAAAA,IAAAA;AAAAA,IACAM;AAAAA,IAaCP;AAAAA,EAAAA,GACH,GAAgB9F,QAAA+F,GAAA/F,QAAAqG,GAAArG,QAAA8F,GAAA9F,QAAAuG,KAAAA,IAAAvG,EAAA,EAAA,GAhBhBuG;AAgBgB;AAxDb9B,EAAAA,GAAAA;AA4DPA,EAAkBpE,cAAc;AAEhCR,EAAwBT,SAASoF,GAAqBC,CAAiB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../src/filter/conditionFilterRegistry.ts","../src/filter/FallbackConditionFilter.tsx","../src/filter/ConditionFilter.tsx","../src/components/TagInput.tsx","../src/filter/locale/operator.zh_CN.ts","../src/filter/friendlyCondition.ts","../src/filter/IdConditionFilter.tsx"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ConditionFilterComponent } from './types';\n\nexport class ConditionFilterRegistry {\n\n private readonly filters: Map<string, ConditionFilterComponent> = new Map<string, ConditionFilterComponent>();\n\n register(type: string, filter: ConditionFilterComponent) {\n this.filters.set(type, filter);\n }\n\n unregister(type: string) {\n return this.filters.delete(type);\n }\n\n get(type: string): ConditionFilterComponent | undefined {\n return this.filters.get(type);\n }\n\n}\n\nexport const conditionFilterRegistry = new ConditionFilterRegistry();","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Alert } from 'antd';\nimport React from 'react';\n\nexport interface FallbackConditionFilterProps {\n type: string;\n}\n\nexport function FallbackConditionFilter(props: FallbackConditionFilterProps) {\n return <Alert message={`Unsupported filter type:[${props.type}]`} type=\"warning\" showIcon />;\n}\n\nFallbackConditionFilter.displayName = 'FallbackConditionFilter';","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { ConditionFilterProps } from './types';\nimport { conditionFilterRegistry } from './conditionFilterRegistry';\nimport { FallbackConditionFilter } from './FallbackConditionFilter';\n\nexport interface TypedConditionFilterProps\n extends ConditionFilterProps {\n type: string;\n}\n\nexport const ConditionFilter = React.memo(\n (props: TypedConditionFilterProps) => {\n const FilterComponent = conditionFilterRegistry.get(props.type);\n if (!FilterComponent) {\n return <FallbackConditionFilter type={props.type} />;\n }\n return <FilterComponent {...props} />;\n },\n);\n\nConditionFilter.displayName = 'ConditionFilter';","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Select, SelectProps } from 'antd';\n\n/**\n * Props for the TagInput component.\n * Extends SelectProps from Antd, excluding 'mode', 'open', and 'suffixIcon' as they are fixed.\n */\nexport interface TagInputProps\n extends Omit<SelectProps, 'mode' | 'open' | 'suffixIcon'> {}\n\n/**\n * Default token separators for splitting input into tags.\n * Includes common separators like comma, semicolon, and space.\n */\nconst DEFAULT_TOKEN_SEPARATORS = [',', ',', ';', ';', ' '];\n\n/**\n * A tag input component based on Antd's Select in tags mode.\n * Allows users to input multiple tags separated by specified token separators.\n * @param props - The props for the TagInput component.\n * @returns The rendered TagInput component.\n */\nexport function TagInput(props: TagInputProps) {\n const {\n tokenSeparators = DEFAULT_TOKEN_SEPARATORS,\n allowClear = true,\n ...restProps\n } = props;\n return (\n <Select\n {...restProps}\n mode={'tags'}\n open={false}\n suffixIcon={null}\n allowClear={allowClear}\n tokenSeparators={tokenSeparators}\n />\n );\n}\n\nTagInput.displayName = 'TagInput';\n","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\nimport { OperatorLocale } from '@ahoo-wang/fetcher-wow';\n\nexport const OPERATOR_zh_CN: OperatorLocale = {\n AND: '与',\n OR: '或',\n NOR: '非或',\n ID: '等于',\n IDS: '包含',\n AGGREGATE_ID: '等于',\n AGGREGATE_IDS: '包含',\n TENANT_ID: '等于',\n OWNER_ID: '等于',\n DELETED: '已删除',\n ALL: '全部',\n EQ: '等于',\n NE: '不等于',\n GT: '大于',\n LT: '小于',\n GTE: '大于等于',\n LTE: '小于等于',\n CONTAINS: '包含',\n IN: '包含',\n NOT_IN: '不包含',\n BETWEEN: '在范围内',\n ALL_IN: '全部包含',\n STARTS_WITH: '以...开头',\n ENDS_WITH: '以...结尾',\n ELEM_MATCH: '元素匹配',\n NULL: '为空',\n NOT_NULL: '不为空',\n TRUE: '为真',\n FALSE: '为假',\n EXISTS: '存在',\n TODAY: '今天',\n BEFORE_TODAY: '今天之前',\n TOMORROW: '明天',\n THIS_WEEK: '本周',\n NEXT_WEEK: '下周',\n LAST_WEEK: '上周',\n THIS_MONTH: '本月',\n LAST_MONTH: '上月',\n RECENT_DAYS: '最近几天',\n EARLIER_DAYS: '几天前',\n RAW: '原始查询',\n};","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Condition, OperatorLocale } from '@ahoo-wang/fetcher-wow';\n\nexport function friendlyCondition(label: string, operatorLocale: OperatorLocale, condition: Condition) {\n const friendlyParts = [];\n friendlyParts.push(label);\n friendlyParts.push(operatorLocale[condition.operator!]);\n const value = condition.value;\n if (Array.isArray(condition.value)) {\n friendlyParts.push(value.join(', '));\n } else {\n friendlyParts.push(value);\n }\n return friendlyParts.join(' ');\n}","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ConditionFilterProps, ConditionFilterValue } from './types';\nimport { conditionFilterRegistry } from './conditionFilterRegistry';\nimport { Button, Input, Select, Space } from 'antd';\nimport { Operator, Condition } from '@ahoo-wang/fetcher-wow';\nimport { useState } from 'react';\nimport { TagInput } from '../components';\nimport { OPERATOR_zh_CN } from './locale';\nimport { friendlyCondition } from './friendlyCondition';\n\nexport const ID_CONDITION_FILTER = 'id';\n\nexport function IdConditionFilter(props: ConditionFilterProps) {\n const defaultOperator = props.operator.defaultValue || Operator.ID;\n const [operator, setOperator] = useState<Operator>(defaultOperator);\n const [value, setValue] = useState(props.value.defaultValue);\n\n const operatorLocale = props.operator.locale ?? OPERATOR_zh_CN;\n\n const buildConditionFilterValue = (): ConditionFilterValue | undefined => {\n if (!operator || !value || (Array.isArray(value) && value.length === 0)) {\n return undefined;\n }\n const condition: Condition = {\n operator,\n value,\n };\n const friendly = friendlyCondition(props.field.label, operatorLocale, condition);\n return { condition, friendly };\n };\n\n const handleOperatorChange = (newOperator: Operator) => {\n setOperator(newOperator);\n props.onChange?.(buildConditionFilterValue());\n };\n\n const handleValueChange = (newValue: any) => {\n setValue(newValue);\n props.onChange?.(buildConditionFilterValue());\n };\n const valueInput =\n operator === Operator.ID ? (\n <Input\n value={value}\n onChange={e => handleValueChange(e.target.value)}\n allowClear\n {...props.value}\n />\n ) : (\n <TagInput value={value} onChange={handleValueChange} {...props.value} />\n );\n return (\n <Space.Compact>\n <Button {...props.label}>{props.field.label}</Button>\n <Select\n defaultValue={Operator.ID}\n value={operator}\n onChange={handleOperatorChange}\n {...props.operator}\n >\n <Select.Option value={Operator.ID}>\n {operatorLocale[Operator.ID]}\n </Select.Option>\n <Select.Option value={Operator.IDS}>\n {operatorLocale[Operator.IDS]}\n </Select.Option>\n </Select>\n {valueInput}\n </Space.Compact>\n );\n}\n\nIdConditionFilter.displayName = 'IdConditionFilter';\n\nconditionFilterRegistry.register(ID_CONDITION_FILTER, IdConditionFilter);\n"],"names":["ConditionFilterRegistry","filters","Map","register","type","filter","set","unregister","delete","get","__name","_ConditionFilterRegistry","conditionFilterRegistry","FallbackConditionFilter","props","$","_c","t0","t1","Alert","displayName","ConditionFilter","React","memo","FilterComponent","jsx","DEFAULT_TOKEN_SEPARATORS","TagInput","restProps","tokenSeparators","allowClear","undefined","t2","Select","OPERATOR_zh_CN","AND","OR","NOR","ID","IDS","AGGREGATE_ID","AGGREGATE_IDS","TENANT_ID","OWNER_ID","DELETED","ALL","EQ","NE","GT","LT","GTE","LTE","CONTAINS","IN","NOT_IN","BETWEEN","ALL_IN","STARTS_WITH","ENDS_WITH","ELEM_MATCH","NULL","NOT_NULL","TRUE","FALSE","EXISTS","TODAY","BEFORE_TODAY","TOMORROW","THIS_WEEK","NEXT_WEEK","LAST_WEEK","THIS_MONTH","LAST_MONTH","RECENT_DAYS","EARLIER_DAYS","RAW","friendlyCondition","label","operatorLocale","condition","friendlyParts","push","operator","value","Array","isArray","join","ID_CONDITION_FILTER","IdConditionFilter","defaultOperator","defaultValue","Operator","setOperator","useState","setValue","locale","field","length","friendly","buildConditionFilterValue","newOperator","onChange","handleOperatorChange","newValue","handleValueChange","t3","Input","e","target","valueInput","t4","Button","t5","t6","t7","t8","t9","jsxs","t10","Space"],"mappings":"0lBAeO,MAAMA,EAAN,MAAMA,CAAwB,CAA9B,aAAA,CAEL,KAAiBC,YAAqDC,GAAsC,CAE5GC,SAASC,EAAcC,EAAkC,CACvD,KAAKJ,QAAQK,IAAIF,EAAMC,CAAM,CAC/B,CAEAE,WAAWH,EAAc,CACvB,OAAO,KAAKH,QAAQO,OAAOJ,CAAI,CACjC,CAEAK,IAAIL,EAAoD,CACtD,OAAO,KAAKH,QAAQQ,IAAIL,CAAI,CAC9B,CAEF,EAhBqCM,EAAAC,EAAA,2BAA9B,IAAMX,EAANW,EAkBA,MAAMC,EAA0B,IAAIZ,ECbpC,SAAAa,EAAAC,EAAA,CAAA,MAAAC,EAAAC,EAAAA,EAAA,CAAA,EACkBC,EAAA,4BAA4BH,EAAKV,IAAK,IAAG,IAAAc,EAAA,OAAAH,OAAAE,GAAzDC,QAACC,EAAAA,MAAA,CAAe,QAAAF,EAAgD,KAAA,UAAU,SAAA,GAAQ,EAAGF,KAAAE,EAAAF,KAAAG,GAAAA,EAAAH,EAAA,CAAA,EAArFG,CAAqF,CADvFL,EAAAA,EAAAA,2BAIPA,EAAwBO,YAAc,0BCD/B,MAAMC,EAAkBC,EAAMC,KACnCT,GAAA,CAAA,MAAAC,EAAAC,EAAAA,EAAA,CAAA,EAAA,IAAAC,EAAAF,EAAA,CAAA,IAAAD,EAAAV,MAC0Ba,EAAAL,EAAuBH,IAAKK,EAAKV,IAAK,EAACW,EAAA,CAAA,EAAAD,EAAAV,KAAAW,KAAAE,GAAAA,EAAAF,EAAA,CAAA,EAA/D,MAAAS,EAAwBP,EACxB,GAAI,CAACO,EAAe,CAAA,IAAAN,EAAA,OAAAH,EAAA,CAAA,IAAAD,EAAAV,MACXc,EAAAO,EAAAA,IAACZ,EAAA,CAA8B,KAAAC,EAAK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AC,EAAAA,KAACpF,EAAAA,OAAA,CACe,aAAA0D,EAAAA,SAAQrD,GACf4C,QACGoB,SAAAA,EAAoB,GAC1BxF,EAAKoE,SAET+B,SAAAA,CAAAA,EAGAE,CAAAA,EAGF,EAASpG,MAAAuF,EAAAvF,MAAAmE,EAAAnE,EAAA,EAAA,EAAAD,EAAAoE,SAAAnE,MAAAkG,EAAAlG,MAAAoG,EAAApG,MAAAqG,GAAAA,EAAArG,EAAA,EAAA,EAAA,IAAAuG,EAAA,OAAAvG,EAAA,EAAA,IAAA+F,GAAA/F,QAAAqG,GAAArG,EAAA,EAAA,IAAA8F,GAdXS,EAAAD,EAAAA,KAAAE,EAAAA,MAAA,QAAA,CACET,SAAAA,CAAAA,EACAM,EAaCP,CAAAA,EACH,EAAgB9F,MAAA+F,EAAA/F,MAAAqG,EAAArG,MAAA8F,EAAA9F,MAAAuG,GAAAA,EAAAvG,EAAA,EAAA,EAhBhBuG,CAgBgB,CAxDb9B,EAAAA,EAAAA,qBA4DPA,EAAkBpE,YAAc,oBAEhCR,EAAwBT,SAASoF,EAAqBC,CAAiB"}
1
+ {"version":3,"file":"index.umd.js","sources":["../src/filter/conditionFilterRegistry.ts","../src/filter/FallbackConditionFilter.tsx","../src/filter/ConditionFilter.tsx","../src/components/TagInput.tsx","../src/filter/locale/operator.zh_CN.ts","../src/filter/friendlyCondition.ts","../src/filter/IdConditionFilter.tsx"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ConditionFilterComponent } from './types';\n\n/**\n * Registry for managing condition filter components.\n *\n * Provides a centralized way to register, unregister, and retrieve\n * condition filter components by their type identifiers.\n */\nexport class ConditionFilterRegistry {\n private readonly filters: Map<string, ConditionFilterComponent> = new Map<\n string,\n ConditionFilterComponent\n >();\n\n /**\n * Registers a condition filter component for a specific type.\n *\n * @param type - The unique identifier for the filter type\n * @param filter - The condition filter component to register\n *\n * @example\n * ```typescript\n * const registry = new ConditionFilterRegistry();\n * registry.register('text', TextConditionFilter);\n * ```\n */\n register(type: string, filter: ConditionFilterComponent) {\n this.filters.set(type, filter);\n }\n\n /**\n * Unregisters a condition filter component for a specific type.\n *\n * @param type - The unique identifier for the filter type to remove\n * @returns true if the filter was successfully removed, false otherwise\n *\n * @example\n * ```typescript\n * const registry = new ConditionFilterRegistry();\n * const wasRemoved = registry.unregister('text');\n * ```\n */\n unregister(type: string) {\n return this.filters.delete(type);\n }\n\n /**\n * Retrieves a condition filter component for a specific type.\n *\n * @param type - The unique identifier for the filter type\n * @returns The condition filter component, or undefined if not found\n *\n * @example\n * ```typescript\n * const registry = new ConditionFilterRegistry();\n * const TextFilter = registry.get('text');\n * ```\n */\n get(type: string): ConditionFilterComponent | undefined {\n return this.filters.get(type);\n }\n}\n\nexport const conditionFilterRegistry = new ConditionFilterRegistry();\n","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Alert } from 'antd';\nimport React from 'react';\n\nexport interface FallbackConditionFilterProps {\n type: string;\n}\n\nexport function FallbackConditionFilter(props: FallbackConditionFilterProps) {\n return <Alert message={`Unsupported filter type:[${props.type}]`} type=\"warning\" showIcon />;\n}\n\nFallbackConditionFilter.displayName = 'FallbackConditionFilter';","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { ConditionFilterProps } from './types';\nimport { conditionFilterRegistry } from './conditionFilterRegistry';\nimport { FallbackConditionFilter } from './FallbackConditionFilter';\n\nexport interface TypedConditionFilterProps\n extends ConditionFilterProps {\n type: string;\n}\n\nexport const ConditionFilter = React.memo(\n (props: TypedConditionFilterProps) => {\n const FilterComponent = conditionFilterRegistry.get(props.type);\n if (!FilterComponent) {\n return <FallbackConditionFilter type={props.type} />;\n }\n return <FilterComponent {...props} />;\n },\n);\n\nConditionFilter.displayName = 'ConditionFilter';","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Select, SelectProps } from 'antd';\n\n/**\n * Props for the TagInput component.\n * Extends SelectProps from Antd, excluding 'mode', 'open', and 'suffixIcon' as they are fixed.\n */\nexport interface TagInputProps\n extends Omit<SelectProps, 'mode' | 'open' | 'suffixIcon'> {}\n\n/**\n * Default token separators for splitting input into tags.\n * Includes common separators like comma, semicolon, and space.\n */\nconst DEFAULT_TOKEN_SEPARATORS = [',', ',', ';', ';', ' '];\n\n/**\n * A tag input component based on Antd's Select in tags mode.\n * Allows users to input multiple tags separated by specified token separators.\n * @param props - The props for the TagInput component.\n * @returns The rendered TagInput component.\n */\nexport function TagInput(props: TagInputProps) {\n const {\n tokenSeparators = DEFAULT_TOKEN_SEPARATORS,\n allowClear = true,\n ...restProps\n } = props;\n return (\n <Select\n {...restProps}\n mode={'tags'}\n open={false}\n suffixIcon={null}\n allowClear={allowClear}\n tokenSeparators={tokenSeparators}\n />\n );\n}\n\nTagInput.displayName = 'TagInput';\n","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\nimport { OperatorLocale } from '@ahoo-wang/fetcher-wow';\n\nexport const OPERATOR_zh_CN: OperatorLocale = {\n AND: '与',\n OR: '或',\n NOR: '非或',\n ID: '等于',\n IDS: '包含',\n AGGREGATE_ID: '等于',\n AGGREGATE_IDS: '包含',\n TENANT_ID: '等于',\n OWNER_ID: '等于',\n DELETED: '已删除',\n ALL: '全部',\n EQ: '等于',\n NE: '不等于',\n GT: '大于',\n LT: '小于',\n GTE: '大于等于',\n LTE: '小于等于',\n CONTAINS: '包含',\n IN: '包含',\n NOT_IN: '不包含',\n BETWEEN: '在范围内',\n ALL_IN: '全部包含',\n STARTS_WITH: '以...开头',\n ENDS_WITH: '以...结尾',\n ELEM_MATCH: '元素匹配',\n NULL: '为空',\n NOT_NULL: '不为空',\n TRUE: '为真',\n FALSE: '为假',\n EXISTS: '存在',\n TODAY: '今天',\n BEFORE_TODAY: '今天之前',\n TOMORROW: '明天',\n THIS_WEEK: '本周',\n NEXT_WEEK: '下周',\n LAST_WEEK: '上周',\n THIS_MONTH: '本月',\n LAST_MONTH: '上月',\n RECENT_DAYS: '最近几天',\n EARLIER_DAYS: '几天前',\n RAW: '原始查询',\n};","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Condition, OperatorLocale } from '@ahoo-wang/fetcher-wow';\n\nexport function friendlyCondition(label: string, operatorLocale: OperatorLocale, condition: Condition) {\n const friendlyParts = [];\n friendlyParts.push(label);\n friendlyParts.push(operatorLocale[condition.operator!]);\n const value = condition.value;\n if (Array.isArray(condition.value)) {\n friendlyParts.push(value.join(', '));\n } else {\n friendlyParts.push(value);\n }\n return friendlyParts.join(' ');\n}","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ConditionFilterProps, ConditionFilterValue } from './types';\nimport { conditionFilterRegistry } from './conditionFilterRegistry';\nimport { Button, Input, Select, Space } from 'antd';\nimport { Operator, Condition } from '@ahoo-wang/fetcher-wow';\nimport { useState } from 'react';\nimport { TagInput } from '../components';\nimport { OPERATOR_zh_CN } from './locale';\nimport { friendlyCondition } from './friendlyCondition';\n\nexport const ID_CONDITION_FILTER = 'id';\n\nexport function IdConditionFilter(props: ConditionFilterProps) {\n const defaultOperator = props.operator.defaultValue || Operator.ID;\n const [operator, setOperator] = useState<Operator>(defaultOperator);\n const [value, setValue] = useState(props.value.defaultValue);\n\n const operatorLocale = props.operator.locale ?? OPERATOR_zh_CN;\n\n const buildConditionFilterValue = (): ConditionFilterValue | undefined => {\n if (!operator || !value || (Array.isArray(value) && value.length === 0)) {\n return undefined;\n }\n const condition: Condition = {\n operator,\n value,\n };\n const friendly = friendlyCondition(props.field.label, operatorLocale, condition);\n return { condition, friendly };\n };\n\n const handleOperatorChange = (newOperator: Operator) => {\n setOperator(newOperator);\n props.onChange?.(buildConditionFilterValue());\n };\n\n const handleValueChange = (newValue: any) => {\n setValue(newValue);\n props.onChange?.(buildConditionFilterValue());\n };\n const valueInput =\n operator === Operator.ID ? (\n <Input\n value={value}\n onChange={e => handleValueChange(e.target.value)}\n allowClear\n {...props.value}\n />\n ) : (\n <TagInput value={value} onChange={handleValueChange} {...props.value} />\n );\n return (\n <Space.Compact>\n <Button {...props.label}>{props.field.label}</Button>\n <Select\n defaultValue={Operator.ID}\n value={operator}\n onChange={handleOperatorChange}\n {...props.operator}\n >\n <Select.Option value={Operator.ID}>\n {operatorLocale[Operator.ID]}\n </Select.Option>\n <Select.Option value={Operator.IDS}>\n {operatorLocale[Operator.IDS]}\n </Select.Option>\n </Select>\n {valueInput}\n </Space.Compact>\n );\n}\n\nIdConditionFilter.displayName = 'IdConditionFilter';\n\nconditionFilterRegistry.register(ID_CONDITION_FILTER, IdConditionFilter);\n"],"names":["ConditionFilterRegistry","filters","Map","register","type","filter","set","unregister","delete","get","__name","_ConditionFilterRegistry","conditionFilterRegistry","FallbackConditionFilter","props","$","_c","t0","t1","Alert","displayName","ConditionFilter","React","memo","FilterComponent","jsx","DEFAULT_TOKEN_SEPARATORS","TagInput","restProps","tokenSeparators","allowClear","undefined","t2","Select","OPERATOR_zh_CN","AND","OR","NOR","ID","IDS","AGGREGATE_ID","AGGREGATE_IDS","TENANT_ID","OWNER_ID","DELETED","ALL","EQ","NE","GT","LT","GTE","LTE","CONTAINS","IN","NOT_IN","BETWEEN","ALL_IN","STARTS_WITH","ENDS_WITH","ELEM_MATCH","NULL","NOT_NULL","TRUE","FALSE","EXISTS","TODAY","BEFORE_TODAY","TOMORROW","THIS_WEEK","NEXT_WEEK","LAST_WEEK","THIS_MONTH","LAST_MONTH","RECENT_DAYS","EARLIER_DAYS","RAW","friendlyCondition","label","operatorLocale","condition","friendlyParts","push","operator","value","Array","isArray","join","ID_CONDITION_FILTER","IdConditionFilter","defaultOperator","defaultValue","Operator","setOperator","useState","setValue","locale","field","length","friendly","buildConditionFilterValue","newOperator","onChange","handleOperatorChange","newValue","handleValueChange","t3","Input","e","target","valueInput","t4","Button","t5","t6","t7","t8","t9","jsxs","t10","Space"],"mappings":"0lBAqBO,MAAMA,EAAN,MAAMA,CAAwB,CAA9B,aAAA,CACL,KAAiBC,YAAqDC,GAGpE,CAcFC,SAASC,EAAcC,EAAkC,CACvD,KAAKJ,QAAQK,IAAIF,EAAMC,CAAM,CAC/B,CAcAE,WAAWH,EAAc,CACvB,OAAO,KAAKH,QAAQO,OAAOJ,CAAI,CACjC,CAcAK,IAAIL,EAAoD,CACtD,OAAO,KAAKH,QAAQQ,IAAIL,CAAI,CAC9B,CACF,EArDqCM,EAAAC,EAAA,2BAA9B,IAAMX,EAANW,EAuDA,MAAMC,EAA0B,IAAIZ,ECxDpC,SAAAa,EAAAC,EAAA,CAAA,MAAAC,EAAAC,EAAAA,EAAA,CAAA,EACkBC,EAAA,4BAA4BH,EAAKV,IAAK,IAAG,IAAAc,EAAA,OAAAH,OAAAE,GAAzDC,QAACC,EAAAA,MAAA,CAAe,QAAAF,EAAgD,KAAA,UAAU,SAAA,GAAQ,EAAGF,KAAAE,EAA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