UNPKG

code-monkey-ui

Version:

A Component Library for Vue 3

1 lines 4.03 kB
{"version":3,"file":"config.mjs","sources":["../../../../../../packages/components/dsh-cascader-panel/src/config.ts"],"sourcesContent":["import { computed } from 'vue'\nimport { NOOP } from '@vue/shared'\nimport { buildProps, definePropType } from '@code-monkey-ui/utils'\nimport type {\n DshCascaderConfig,\n DshCascaderOption,\n DshCascaderProps,\n DshCascaderValue,\n} from './node'\n\nexport const DSH_CASCADER_ALL_NODE_LABEL = '全选'\nexport const DSH_CASCADER_ALL_NODE_VALUE = 'cascader-all'\n\nexport const DshCommonProps = buildProps({\n /**\n * @description specify which key of node object is used as the node's value\n */\n modelValue: {\n type: definePropType<DshCascaderValue>([Number, String, Array]),\n },\n /**\n * @description data of the options, the key of `value` and `label` can be customize by `DshCascaderProps`.\n */\n options: {\n type: definePropType<DshCascaderOption[]>(Array),\n default: () => [] as DshCascaderOption[],\n },\n /**\n * @description configuration options, see the following `DshCascaderProps` table.\n */\n props: {\n type: definePropType<DshCascaderProps>(Object),\n default: () => ({} as DshCascaderProps),\n },\n} as const)\n\nexport const DshDefaultProps: DshCascaderConfig = {\n /**\n * @description trigger mode of expanding options\n */\n expandTrigger: 'click',\n /**\n * @description whether multiple selection is enabled\n */\n multiple: false,\n /**\n * @description whether checked state of a node not affects its parent and child nodes\n */\n checkStrictly: false, // whether all nodes can be selected\n\n /**\n * @description when checked nodes change, whether to emit an array of node's path, if false, only emit the value of node.\n */\n emitPath: true, // wether to emit an array of all levels value in which node is located\n\n /**\n * @description whether to dynamic load child nodes, use with `lazyload` attribute\n */\n lazy: false,\n /**\n * @description method for loading child nodes data, only works when `lazy` is true\n */\n lazyLoad: NOOP,\n /**\n * @description specify which key of node object is used as the node's value\n */\n value: 'value',\n /**\n * @description specify which key of node object is used as the node's label\n */\n label: 'label',\n /**\n * @description specify which key of node object is used as the node's children\n */\n children: 'children',\n /**\n * @description specify which key of node object is used as the node's leaf\n */\n leaf: 'leaf',\n /**\n * @description specify which key of node object is used as the node's disabled\n */\n disabled: 'disabled',\n /**\n * @description hover threshold of expanding options\n */\n hoverThreshold: 500,\n /**\n * @description maximum number of tags that can be displayed when selected nodes exceed\n */\n maxCollapseTags: 1,\n}\n\nexport const DshUseCascaderConfig = (props: { props: DshCascaderProps }) => {\n return computed(() => ({\n ...DshDefaultProps,\n ...props.props,\n }))\n}\n"],"names":[],"mappings":";;;;;AAGY,MAAC,2BAA2B,GAAG,eAAe;AAC9C,MAAC,2BAA2B,GAAG,eAAe;AAC9C,MAAC,cAAc,GAAG,UAAU,CAAC;AACzC,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACjD,GAAG;AACH,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,EAAE;AACrB,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,OAAO,EAAE,CAAC;AACvB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,eAAe,GAAG;AAC/B,EAAE,aAAa,EAAE,OAAO;AACxB,EAAE,QAAQ,EAAE,KAAK;AACjB,EAAE,aAAa,EAAE,KAAK;AACtB,EAAE,QAAQ,EAAE,IAAI;AAChB,EAAE,IAAI,EAAE,KAAK;AACb,EAAE,QAAQ,EAAE,IAAI;AAChB,EAAE,KAAK,EAAE,OAAO;AAChB,EAAE,KAAK,EAAE,OAAO;AAChB,EAAE,QAAQ,EAAE,UAAU;AACtB,EAAE,IAAI,EAAE,MAAM;AACd,EAAE,QAAQ,EAAE,UAAU;AACtB,EAAE,cAAc,EAAE,GAAG;AACrB,EAAE,eAAe,EAAE,CAAC;AACpB,EAAE;AACU,MAAC,oBAAoB,GAAG,CAAC,KAAK,KAAK;AAC/C,EAAE,OAAO,QAAQ,CAAC,OAAO;AACzB,IAAI,GAAG,eAAe;AACtB,IAAI,GAAG,KAAK,CAAC,KAAK;AAClB,GAAG,CAAC,CAAC,CAAC;AACN;;;;"}