@silver-formily/element-plus 2.1.0 → 2.2.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/LICENSE +21 -21
- package/esm/__builtins__/configs/index.mjs.map +1 -1
- package/esm/__builtins__/shared/hooks.mjs.map +1 -1
- package/esm/__builtins__/shared/loading.mjs.map +1 -1
- package/esm/__builtins__/shared/simple-version-compare.mjs.map +1 -1
- package/esm/__builtins__/shared/transform-component.mjs.map +1 -1
- package/esm/__builtins__/shared/utils.mjs.map +1 -1
- package/esm/array-base/index.mjs +18 -21
- package/esm/array-base/index.mjs.map +1 -1
- package/esm/array-base/symbols.mjs.map +1 -1
- package/esm/array-base/utils.mjs +29 -33
- package/esm/array-base/utils.mjs.map +1 -1
- package/esm/array-cards/index.mjs +29 -31
- package/esm/array-cards/index.mjs.map +1 -1
- package/esm/array-collapse/index.mjs +35 -36
- package/esm/array-collapse/index.mjs.map +1 -1
- package/esm/array-collapse/utils.mjs +2 -8
- package/esm/array-collapse/utils.mjs.map +1 -1
- package/esm/array-items/index.mjs +30 -33
- package/esm/array-items/index.mjs.map +1 -1
- package/esm/array-list-tabs/index.mjs +27 -28
- package/esm/array-list-tabs/index.mjs.map +1 -1
- package/esm/array-list-tabs/utils.mjs +5 -11
- package/esm/array-list-tabs/utils.mjs.map +1 -1
- package/esm/array-table/index.mjs +52 -53
- package/esm/array-table/index.mjs.map +1 -1
- package/esm/array-table/utils.mjs +12 -18
- package/esm/array-table/utils.mjs.map +1 -1
- package/esm/array-tabs/index.mjs +17 -19
- package/esm/array-tabs/index.mjs.map +1 -1
- package/esm/cascader/index.mjs +17 -20
- package/esm/cascader/index.mjs.map +1 -1
- package/esm/checkbox/index.mjs +16 -19
- package/esm/checkbox/index.mjs.map +1 -1
- package/esm/date-picker/index.mjs +12 -14
- package/esm/date-picker/index.mjs.map +1 -1
- package/esm/editable/index.mjs +48 -50
- package/esm/editable/index.mjs.map +1 -1
- package/esm/form/form.mjs +6 -6
- package/esm/form/form.mjs.map +1 -1
- package/esm/form-button-group/index.mjs +23 -26
- package/esm/form-button-group/index.mjs.map +1 -1
- package/esm/form-button-group/utils.mjs +2 -8
- package/esm/form-button-group/utils.mjs.map +1 -1
- package/esm/form-collapse/index.mjs +18 -20
- package/esm/form-collapse/index.mjs.map +1 -1
- package/esm/form-collapse/utils.mjs.map +1 -1
- package/esm/form-dialog/index.mjs +18 -18
- package/esm/form-dialog/index.mjs.map +1 -1
- package/esm/form-drawer/index.mjs +17 -17
- package/esm/form-drawer/index.mjs.map +1 -1
- package/esm/form-grid/hooks.mjs.map +1 -1
- package/esm/form-grid/index.mjs +20 -23
- package/esm/form-grid/index.mjs.map +1 -1
- package/esm/form-item/index.mjs +59 -57
- package/esm/form-item/index.mjs.map +1 -1
- package/esm/form-item/utils.mjs.map +1 -1
- package/esm/form-layout/form-layout.mjs +12 -16
- package/esm/form-layout/form-layout.mjs.map +1 -1
- package/esm/form-layout/utils.mjs +18 -23
- package/esm/form-layout/utils.mjs.map +1 -1
- package/esm/form-step/index.mjs +24 -26
- package/esm/form-step/index.mjs.map +1 -1
- package/esm/form-step/utils.mjs.map +1 -1
- package/esm/form-tab/hooks.mjs.map +1 -1
- package/esm/form-tab/index.mjs +19 -20
- package/esm/form-tab/index.mjs.map +1 -1
- package/esm/form-tab/utils.mjs.map +1 -1
- package/esm/index.d.ts +3 -0
- package/esm/index.mjs +46 -40
- package/esm/index.mjs.map +1 -1
- package/esm/input/index.mjs +20 -23
- package/esm/input/index.mjs.map +1 -1
- package/esm/input-number/index.mjs +7 -9
- package/esm/input-number/index.mjs.map +1 -1
- package/esm/pagination/components/jumper.mjs.map +1 -1
- package/esm/pagination/components/next.mjs.map +1 -1
- package/esm/pagination/components/pager.mjs.map +1 -1
- package/esm/pagination/components/prev.mjs.map +1 -1
- package/esm/pagination/components/total.mjs.map +1 -1
- package/esm/pagination/pagination.mjs.map +1 -1
- package/esm/password/index.mjs.map +1 -1
- package/esm/preview-text/index.d.ts +5 -0
- package/esm/preview-text/index.mjs +149 -128
- package/esm/preview-text/index.mjs.map +1 -1
- package/esm/preview-text/rate.d.ts +5 -0
- package/esm/preview-text/utils.d.ts +5 -5
- package/esm/preview-text/utils.mjs.map +1 -1
- package/esm/radio/index.mjs +25 -28
- package/esm/radio/index.mjs.map +1 -1
- package/esm/rate/index.d.ts +187 -0
- package/esm/rate/index.mjs +14 -0
- package/esm/rate/index.mjs.map +1 -0
- package/esm/reset/index.mjs.map +1 -1
- package/esm/segmented/index.d.ts +26 -0
- package/esm/segmented/index.mjs +37 -0
- package/esm/segmented/index.mjs.map +1 -0
- package/esm/segmented/segmented.d.ts +25 -0
- package/esm/select/index.mjs +16 -19
- package/esm/select/index.mjs.map +1 -1
- package/esm/select-table/index.mjs +12 -15
- package/esm/select-table/index.mjs.map +1 -1
- package/esm/slider/index.d.ts +177 -0
- package/esm/slider/index.mjs +14 -0
- package/esm/slider/index.mjs.map +1 -0
- package/esm/submit/index.mjs.map +1 -1
- package/esm/switch/index.mjs.map +1 -1
- package/esm/time-picker/index.mjs +6 -8
- package/esm/time-picker/index.mjs.map +1 -1
- package/esm/time-select/index.mjs +6 -8
- package/esm/time-select/index.mjs.map +1 -1
- package/esm/transfer/index.mjs.map +1 -1
- package/esm/tree/index.mjs +28 -31
- package/esm/tree/index.mjs.map +1 -1
- package/esm/tree/utils.mjs.map +1 -1
- package/esm/tree-select/index.mjs +17 -20
- package/esm/tree-select/index.mjs.map +1 -1
- package/esm/upload/index.mjs +7 -9
- package/esm/upload/index.mjs.map +1 -1
- package/esm/vendor/sizes.mjs.map +1 -1
- package/package.json +113 -113
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/select-table/select-table.vue","../../src/select-table/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { TableInstance } from 'element-plus'\nimport type { ISelectTableProps } from './types'\nimport { isEqual, isFn, isValid } from '@formily/shared'\nimport { useField } from '@silver-formily/vue'\nimport {\n ElLink,\n ElRadio,\n ElRadioGroup,\n ElTable,\n ElTableColumn,\n useAttrs,\n version,\n vLoading,\n} from 'element-plus'\nimport { differenceWith, remove, uniq, uniqWith, xor } from 'lodash-es'\nimport { computed, nextTick, ref, watch } from 'vue'\nimport { lt, stylePrefix } from '../__builtins__'\n\ndefineOptions({\n name: 'FSelectTable',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<ISelectTableProps>(), {\n columns: () => [],\n mode: 'multiple',\n dataSource: () => [],\n optionAsValue: false,\n valueType: 'all',\n loading: false,\n clickRowToSelect: true,\n showAlertToolbar: true,\n ignoreSelectable: true,\n})\n\nconst emit = defineEmits(['update:modelValue'])\n\nconst elTableProps = useAttrs()\nconst field = useField()\n\nfunction compatibleRadioValue(key: string) {\n return lt(version, '2.6.0') ? { label: key } : { value: key }\n}\n\nconst elTableRef = ref<TableInstance>()\nconst rowKey = props.rowKey\nfunction getInitialSelectedList() {\n if (props.mode === 'multiple') {\n return props.modelValue?.map((item) => {\n if (!props.optionAsValue) {\n return {\n [rowKey]: item,\n }\n }\n return item\n }) ?? []\n }\n else {\n return props.optionAsValue ? [props.modelValue] : [{ [rowKey]: props.modelValue }]\n }\n}\nconst initialSelectedList = getInitialSelectedList()\nconst selectedFlatDataSource = ref(initialSelectedList)\n// 为了获取移除的项而缓存的当前页面的前一次选择。由于element-plus没有获取移除项的方法,需要通过这种方式移除field中移除的项\nlet prevSelection = []\n\nconst radioSelectedKey = ref()\n\nconst currentSelectLength = computed(() => {\n if (props.mode === 'multiple') {\n return Array.isArray(props.modelValue) ? props.modelValue.length : 0\n }\n else {\n return isValid(radioSelectedKey.value) ? 1 : 0\n }\n})\n\nwatch(\n () => props.dataSource,\n async () => {\n const selectedKeys = uniq(\n selectedFlatDataSource.value.map(item => item[rowKey]),\n )\n await nextTick()\n if (!elTableRef.value) {\n return\n }\n for (const item of props.dataSource) {\n if (selectedKeys.includes(item[rowKey])) {\n if (props.mode === 'multiple') {\n elTableRef.value?.toggleRowSelection(item, true, props.ignoreSelectable)\n }\n else {\n elTableRef.value?.setCurrentRow(item)\n onRadioClick(item)\n }\n }\n await nextTick()\n prevSelection = elTableRef.value?.getSelectionRows()\n }\n },\n { immediate: true },\n)\n\nwatch(\n () => [props.modelValue, props.loading],\n async ([value, loading]) => {\n if (loading) {\n return\n }\n if (props.mode === 'single') {\n radioSelectedKey.value = props.optionAsValue ? value[rowKey] : value\n }\n else {\n await nextTick()\n if (!elTableRef.value) {\n return\n }\n const currentDisplayDataKeys = elTableRef.value\n ?.getSelectionRows()\n .map(item => item[rowKey])\n const valueKeys = props.optionAsValue\n ? value?.map(item => item[rowKey])\n : value ?? []\n selectedFlatDataSource.value = selectedFlatDataSource.value.filter(\n item => valueKeys.includes(item[rowKey]),\n )\n if (isEqual(valueKeys, currentDisplayDataKeys)) {\n return\n }\n const diffItems = xor(valueKeys, currentDisplayDataKeys)\n for (const tableItem of props.dataSource) {\n if (diffItems.includes(tableItem[rowKey])) {\n const shouldSelect = valueKeys.includes(tableItem[rowKey])\n elTableRef.value.toggleRowSelection(tableItem, shouldSelect, props.ignoreSelectable)\n }\n }\n }\n },\n {\n immediate: true,\n },\n)\n\nfunction onSelect(newSelection: Record<string, any>[]) {\n /* istanbul ignore if -- @preserve */\n if (!rowKey) {\n throw new Error('rowKey is required')\n }\n\n const removedItemList\n = prevSelection.length > newSelection.length\n ? differenceWith(\n prevSelection,\n newSelection,\n (itemPrev, itemNext) => {\n return itemPrev[rowKey] === itemNext[rowKey]\n },\n )\n : []\n prevSelection = [...newSelection]\n selectedFlatDataSource.value = uniqWith(\n [...selectedFlatDataSource.value, ...newSelection],\n (itemPrev, itemNext) => {\n return itemPrev[rowKey] === itemNext[rowKey]\n },\n )\n if (removedItemList.length > 0) {\n const removedKeys = uniq(removedItemList.map(item => item[rowKey]))\n remove(selectedFlatDataSource.value, item =>\n removedKeys.includes(item[rowKey]))\n }\n\n if (props.optionAsValue) {\n emit('update:modelValue', selectedFlatDataSource.value)\n }\n else {\n const selectedKeys = selectedFlatDataSource.value.map(\n item => item[rowKey],\n )\n emit('update:modelValue', selectedKeys)\n }\n}\n\nfunction onRadioClick(item) {\n radioSelectedKey.value = item[rowKey]\n if (props.optionAsValue) {\n emit('update:modelValue', item)\n }\n else {\n emit('update:modelValue', item[rowKey])\n }\n}\n\nfunction onRowClick(row: Record<string, any>, _, event: Event) {\n if (!props.clickRowToSelect)\n return\n\n if (props.mode === 'multiple') {\n const checkboxDOM = (event.target as Element)\n .closest('tr')\n .querySelector('input[type=\"checkbox\"]')\n if (checkboxDOM instanceof HTMLElement) {\n checkboxDOM.click()\n }\n }\n else {\n const radioDOM = (event.target as Element)\n .closest('tr')\n .querySelector('input[type=\"radio\"]')\n if (radioDOM instanceof HTMLElement) {\n radioDOM.click()\n }\n }\n}\n\nfunction onClearSelectionClick() {\n if (props.mode === 'multiple') {\n emit('update:modelValue', [])\n selectedFlatDataSource.value = []\n }\n else {\n radioSelectedKey.value = null\n emit('update:modelValue', null)\n }\n}\n\nfunction selectable(row: Record<string, any>, index: number) {\n if (props.selectable && isFn(props.selectable)) {\n return props.selectable(row, index, field.value)\n }\n return true\n}\n</script>\n\n<template>\n <div :class=\"`${stylePrefix}-select-table`\">\n <div\n v-if=\"currentSelectLength > 0 && props.showAlertToolbar\"\n :class=\"`${stylePrefix}-select-table-alert-container`\"\n >\n <span>已选择 {{ currentSelectLength }} 项</span>\n <ElLink\n type=\"primary\"\n :underline=\"lt(version, '2.9.9') ? false : 'never'\"\n style=\"margin-left: 8px;\"\n @click=\"onClearSelectionClick\"\n >\n 取消选择\n </ElLink>\n </div>\n <ElTable\n ref=\"elTableRef\"\n v-loading=\"props.loading\"\n v-bind=\"elTableProps\"\n :row-key=\"rowKey\"\n :row-class-name=\"props.clickRowToSelect ? `--click-row-select` : ''\"\n :data=\"props.dataSource\"\n :highlight-current-row=\"props.mode === 'single'\"\n @select=\"onSelect\"\n @select-all=\"onSelect\"\n @row-click=\"onRowClick\"\n >\n <ElTableColumn\n v-if=\"props.mode === 'multiple'\"\n type=\"selection\"\n :selectable=\"selectable\"\n />\n <ElTableColumn\n v-else\n width=\"46\"\n >\n <template #default=\"{ row }\">\n <ElRadioGroup v-model=\"radioSelectedKey\" style=\"width: 100%;\">\n <ElRadio\n v-bind=\"compatibleRadioValue(row[rowKey])\"\n @change=\"() => onRadioClick(row)\"\n >\n \n </ElRadio>\n </ElRadioGroup>\n </template>\n </ElTableColumn>\n <template v-if=\"props.columns.length === 0\">\n <slot />\n </template>\n <template v-else>\n <ElTableColumn\n v-for=\"colItem of props.columns\"\n v-bind=\"colItem\"\n :key=\"colItem.prop || colItem.type\"\n />\n </template>\n </ElTable>\n </div>\n</template>\n","import { connect, mapProps } from '@silver-formily/vue'\r\nimport InnerSelectTable from './select-table.vue'\r\nimport './style.scss'\r\n\r\nconst SelectTable = connect<typeof InnerSelectTable>(\n InnerSelectTable,\n mapProps({ dataSource: 'dataSource', loading: 'loading' }),\r\n)\r\n\r\nexport { SelectTable }\r\n\r\nexport default SelectTable\r\n"],"names":["props","__props","emit","__emit","elTableProps","useAttrs","field","useField","compatibleRadioValue","key","lt","version","elTableRef","ref","rowKey","getInitialSelectedList","item","initialSelectedList","selectedFlatDataSource","prevSelection","radioSelectedKey","currentSelectLength","computed","isValid","watch","selectedKeys","uniq","nextTick","onRadioClick","value","loading","currentDisplayDataKeys","valueKeys","isEqual","diffItems","xor","tableItem","shouldSelect","onSelect","newSelection","removedItemList","differenceWith","itemPrev","itemNext","uniqWith","removedKeys","remove","onRowClick","row","_","event","checkboxDOM","radioDOM","onClearSelectionClick","selectable","index","isFn","_createElementBlock","_unref","stylePrefix","_createElementVNode","_toDisplayString","_createVNode","ElLink","_cache","_withDirectives","_openBlock","_createBlock","_mergeProps","ElTableColumn","_withCtx","ElRadioGroup","$event","_renderSlot","_ctx","_Fragment","_renderList","colItem","vLoading","SelectTable","connect","InnerSelectTable","mapProps"],"mappings":";;;;;;;;;;;;;;;;;;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EAAM,SAAI,mBADlBmE,EAIET,EAAAW,CAAA,GAAA;AAAA;YAFA,MAAK;AAAA,YACJ,YAAAf;AAAA,UAAA,YAEHa,EAcgBT,EAAAW,CAAA,GAAA;AAAA;YAZd,OAAM;AAAA,UAAA;YAEK,SAAOC,EAChB,CAOe,EARK,KAAAtB,QAAG;AAAA,cACvBc,EAOeJ,EAAAa,EAAA,GAAA;AAAA,4BAPQnD,EAAA;AAAA,8DAAAA,EAAgB,QAAAoD;AAAA,gBAAE,OAAA,EAAA,OAAA,OAAA;AAAA,cAAA;2BACvC,MAKU;AAAA,kBALVV,EAKUJ,OALVU,EAKU5D,EAJqBwC,EAAIU,EAAA5C,CAAA,CAAM,CAAA,GAAA;AAAA,oBACtC,UAAM,MAAQc,EAAaoB,CAAG;AAAA,kBAAA;+BAChC,MAED,CAAA,GAAAgB,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA;AAAA,wBAFC,OAED,EAAA;AAAA,oBAAA;;;;;;;;;UAIUhE,EAAM,QAAQ,WAAM,IAClCyE,EAAQC,EAAA,QAAA,WAAA,EAAA,KAAA,EAAA,CAAA,KAGRR,EAAA,EAAA,GAAAT,EAIEkB,IAAA,EAAA,KAAA,EAAA,GAAAC,GAHkB5E,EAAM,UAAjB6E,YADTV,EAIET,EAAAW,CAAA,GAJFD,EAIE,EAAA,SAAA,GAAA,GAFQS,GAAO;AAAA,YACd,KAAKA,EAAQ,QAAQA,EAAQ;AAAA,UAAA;;;;QArCvB,CAAAnB,EAAAoB,EAAA,GAAA9E,EAAM,OAAO;AAAA,MAAA;;;IC1PxB+E,KAAcC;AAAA,EAClBC;AAAAA,EACAC,EAAS,EAAE,YAAY,cAAc,SAAS,WAAW;AAC3D;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/select-table/select-table.vue","../../src/select-table/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport type { TableInstance } from 'element-plus'\r\nimport type { ISelectTableProps } from './types'\r\nimport { isEqual, isFn, isValid } from '@formily/shared'\r\nimport { useField } from '@silver-formily/vue'\r\nimport {\r\n ElLink,\r\n ElRadio,\r\n ElRadioGroup,\r\n ElTable,\r\n ElTableColumn,\r\n useAttrs,\r\n version,\r\n vLoading,\r\n} from 'element-plus'\r\nimport { differenceWith, remove, uniq, uniqWith, xor } from 'lodash-es'\r\nimport { computed, nextTick, ref, watch } from 'vue'\r\nimport { lt, stylePrefix } from '../__builtins__'\r\n\r\ndefineOptions({\r\n name: 'FSelectTable',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = withDefaults(defineProps<ISelectTableProps>(), {\r\n columns: () => [],\r\n mode: 'multiple',\r\n dataSource: () => [],\r\n optionAsValue: false,\r\n valueType: 'all',\r\n loading: false,\r\n clickRowToSelect: true,\r\n showAlertToolbar: true,\r\n ignoreSelectable: true,\r\n})\r\n\r\nconst emit = defineEmits(['update:modelValue'])\r\n\r\nconst elTableProps = useAttrs()\r\nconst field = useField()\r\n\r\nfunction compatibleRadioValue(key: string) {\r\n return lt(version, '2.6.0') ? { label: key } : { value: key }\r\n}\r\n\r\nconst elTableRef = ref<TableInstance>()\r\nconst rowKey = props.rowKey\r\nfunction getInitialSelectedList() {\r\n if (props.mode === 'multiple') {\r\n return props.modelValue?.map((item) => {\r\n if (!props.optionAsValue) {\r\n return {\r\n [rowKey]: item,\r\n }\r\n }\r\n return item\r\n }) ?? []\r\n }\r\n else {\r\n return props.optionAsValue ? [props.modelValue] : [{ [rowKey]: props.modelValue }]\r\n }\r\n}\r\nconst initialSelectedList = getInitialSelectedList()\r\nconst selectedFlatDataSource = ref(initialSelectedList)\r\n// 为了获取移除的项而缓存的当前页面的前一次选择。由于element-plus没有获取移除项的方法,需要通过这种方式移除field中移除的项\r\nlet prevSelection = []\r\n\r\nconst radioSelectedKey = ref()\r\n\r\nconst currentSelectLength = computed(() => {\r\n if (props.mode === 'multiple') {\r\n return Array.isArray(props.modelValue) ? props.modelValue.length : 0\r\n }\r\n else {\r\n return isValid(radioSelectedKey.value) ? 1 : 0\r\n }\r\n})\r\n\r\nwatch(\r\n () => props.dataSource,\r\n async () => {\n const selectedKeys = uniq(\n selectedFlatDataSource.value.map(item => item[rowKey]),\n )\n await nextTick()\n if (!elTableRef.value) {\n return\n }\n for (const item of props.dataSource) {\n if (selectedKeys.includes(item[rowKey])) {\n if (props.mode === 'multiple') {\n elTableRef.value?.toggleRowSelection(item, true, props.ignoreSelectable)\n }\n else {\n elTableRef.value?.setCurrentRow(item)\n onRadioClick(item)\n }\n }\n await nextTick()\n prevSelection = elTableRef.value?.getSelectionRows()\n }\n },\n { immediate: true },\n)\n\r\nwatch(\r\n () => [props.modelValue, props.loading],\r\n async ([value, loading]) => {\r\n if (loading) {\r\n return\r\n }\r\n if (props.mode === 'single') {\n radioSelectedKey.value = props.optionAsValue ? value[rowKey] : value\n }\n else {\n await nextTick()\n if (!elTableRef.value) {\n return\n }\n const currentDisplayDataKeys = elTableRef.value\n ?.getSelectionRows()\n .map(item => item[rowKey])\n const valueKeys = props.optionAsValue\r\n ? value?.map(item => item[rowKey])\r\n : value ?? []\r\n selectedFlatDataSource.value = selectedFlatDataSource.value.filter(\r\n item => valueKeys.includes(item[rowKey]),\r\n )\r\n if (isEqual(valueKeys, currentDisplayDataKeys)) {\r\n return\r\n }\r\n const diffItems = xor(valueKeys, currentDisplayDataKeys)\r\n for (const tableItem of props.dataSource) {\r\n if (diffItems.includes(tableItem[rowKey])) {\r\n const shouldSelect = valueKeys.includes(tableItem[rowKey])\r\n elTableRef.value.toggleRowSelection(tableItem, shouldSelect, props.ignoreSelectable)\r\n }\r\n }\r\n }\r\n },\r\n {\r\n immediate: true,\r\n },\r\n)\r\n\r\nfunction onSelect(newSelection: Record<string, any>[]) {\r\n /* istanbul ignore if -- @preserve */\r\n if (!rowKey) {\r\n throw new Error('rowKey is required')\r\n }\r\n\r\n const removedItemList\r\n = prevSelection.length > newSelection.length\r\n ? differenceWith(\r\n prevSelection,\r\n newSelection,\r\n (itemPrev, itemNext) => {\r\n return itemPrev[rowKey] === itemNext[rowKey]\r\n },\r\n )\r\n : []\r\n prevSelection = [...newSelection]\r\n selectedFlatDataSource.value = uniqWith(\r\n [...selectedFlatDataSource.value, ...newSelection],\r\n (itemPrev, itemNext) => {\r\n return itemPrev[rowKey] === itemNext[rowKey]\r\n },\r\n )\r\n if (removedItemList.length > 0) {\r\n const removedKeys = uniq(removedItemList.map(item => item[rowKey]))\r\n remove(selectedFlatDataSource.value, item =>\r\n removedKeys.includes(item[rowKey]))\r\n }\r\n\r\n if (props.optionAsValue) {\r\n emit('update:modelValue', selectedFlatDataSource.value)\r\n }\r\n else {\r\n const selectedKeys = selectedFlatDataSource.value.map(\r\n item => item[rowKey],\r\n )\r\n emit('update:modelValue', selectedKeys)\r\n }\r\n}\r\n\r\nfunction onRadioClick(item) {\r\n radioSelectedKey.value = item[rowKey]\r\n if (props.optionAsValue) {\r\n emit('update:modelValue', item)\r\n }\r\n else {\r\n emit('update:modelValue', item[rowKey])\r\n }\r\n}\r\n\r\nfunction onRowClick(row: Record<string, any>, _, event: Event) {\r\n if (!props.clickRowToSelect)\r\n return\r\n\r\n if (props.mode === 'multiple') {\r\n const checkboxDOM = (event.target as Element)\r\n .closest('tr')\r\n .querySelector('input[type=\"checkbox\"]')\r\n if (checkboxDOM instanceof HTMLElement) {\r\n checkboxDOM.click()\r\n }\r\n }\r\n else {\r\n const radioDOM = (event.target as Element)\r\n .closest('tr')\r\n .querySelector('input[type=\"radio\"]')\r\n if (radioDOM instanceof HTMLElement) {\r\n radioDOM.click()\r\n }\r\n }\r\n}\r\n\r\nfunction onClearSelectionClick() {\r\n if (props.mode === 'multiple') {\r\n emit('update:modelValue', [])\r\n selectedFlatDataSource.value = []\r\n }\r\n else {\r\n radioSelectedKey.value = null\r\n emit('update:modelValue', null)\r\n }\r\n}\r\n\r\nfunction selectable(row: Record<string, any>, index: number) {\r\n if (props.selectable && isFn(props.selectable)) {\r\n return props.selectable(row, index, field.value)\r\n }\r\n return true\r\n}\r\n</script>\r\n\r\n<template>\r\n <div :class=\"`${stylePrefix}-select-table`\">\r\n <div\r\n v-if=\"currentSelectLength > 0 && props.showAlertToolbar\"\r\n :class=\"`${stylePrefix}-select-table-alert-container`\"\r\n >\r\n <span>已选择 {{ currentSelectLength }} 项</span>\r\n <ElLink\r\n type=\"primary\"\r\n :underline=\"lt(version, '2.9.9') ? false : 'never'\"\r\n style=\"margin-left: 8px;\"\r\n @click=\"onClearSelectionClick\"\r\n >\r\n 取消选择\r\n </ElLink>\r\n </div>\r\n <ElTable\r\n ref=\"elTableRef\"\r\n v-loading=\"props.loading\"\r\n v-bind=\"elTableProps\"\r\n :row-key=\"rowKey\"\r\n :row-class-name=\"props.clickRowToSelect ? `--click-row-select` : ''\"\r\n :data=\"props.dataSource\"\r\n :highlight-current-row=\"props.mode === 'single'\"\r\n @select=\"onSelect\"\r\n @select-all=\"onSelect\"\r\n @row-click=\"onRowClick\"\r\n >\r\n <ElTableColumn\r\n v-if=\"props.mode === 'multiple'\"\r\n type=\"selection\"\r\n :selectable=\"selectable\"\r\n />\r\n <ElTableColumn\r\n v-else\r\n width=\"46\"\r\n >\r\n <template #default=\"{ row }\">\r\n <ElRadioGroup v-model=\"radioSelectedKey\" style=\"width: 100%;\">\r\n <ElRadio\r\n v-bind=\"compatibleRadioValue(row[rowKey])\"\r\n @change=\"() => onRadioClick(row)\"\r\n >\r\n \r\n </ElRadio>\r\n </ElRadioGroup>\r\n </template>\r\n </ElTableColumn>\r\n <template v-if=\"props.columns.length === 0\">\r\n <slot />\r\n </template>\r\n <template v-else>\r\n <ElTableColumn\r\n v-for=\"colItem of props.columns\"\r\n v-bind=\"colItem\"\r\n :key=\"colItem.prop || colItem.type\"\r\n />\r\n </template>\r\n </ElTable>\r\n </div>\r\n</template>\r\n","import { connect, mapProps } from '@silver-formily/vue'\r\nimport InnerSelectTable from './select-table.vue'\r\nimport './style.scss'\r\n\r\nconst SelectTable = connect<typeof InnerSelectTable>(\n InnerSelectTable,\n mapProps({ dataSource: 'dataSource', loading: 'loading' }),\r\n)\r\n\r\nexport { SelectTable }\r\n\r\nexport default SelectTable\r\n"],"names":["props","__props","emit","__emit","elTableProps","useAttrs","field","useField","compatibleRadioValue","key","lt","version","elTableRef","ref","rowKey","getInitialSelectedList","item","initialSelectedList","selectedFlatDataSource","prevSelection","radioSelectedKey","currentSelectLength","computed","isValid","watch","selectedKeys","uniq","nextTick","onRadioClick","value","loading","currentDisplayDataKeys","valueKeys","isEqual","diffItems","xor","tableItem","shouldSelect","onSelect","newSelection","removedItemList","differenceWith","itemPrev","itemNext","uniqWith","removedKeys","remove","onRowClick","row","_","event","checkboxDOM","radioDOM","onClearSelectionClick","selectable","index","isFn","_createElementBlock","_unref","stylePrefix","_createElementVNode","_toDisplayString","_createVNode","ElLink","_cache","_withDirectives","_openBlock","_createBlock","_mergeProps","ElTableColumn","_withCtx","ElRadioGroup","$event","_renderSlot","_ctx","_Fragment","_renderList","colItem","vLoading","SelectTable","connect","InnerSelectTable","mapProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,UAAMA,IAAQC,GAYRC,IAAOC,GAEPC,IAAeC,GAAA,GACfC,IAAQC,EAAA;AAEd,aAASC,EAAqBC,GAAa;AACzC,aAAOC,EAAGC,GAAS,OAAO,IAAI,EAAE,OAAOF,EAAA,IAAQ,EAAE,OAAOA,EAAA;AAAA,IAC1D;AAEA,UAAMG,IAAaC,EAAA,GACbC,IAASd,EAAM;AACrB,aAASe,IAAyB;AAChC,aAAIf,EAAM,SAAS,aACVA,EAAM,YAAY,IAAI,CAACgB,MACvBhB,EAAM,gBAKJgB,IAJE;AAAA,QACL,CAACF,CAAM,GAAGE;AAAA,MAAA,CAIf,KAAK,CAAA,IAGChB,EAAM,gBAAgB,CAACA,EAAM,UAAU,IAAI,CAAC,EAAE,CAACc,CAAM,GAAGd,EAAM,YAAY;AAAA,IAErF;AACA,UAAMiB,IAAsBF,EAAA,GACtBG,IAAyBL,EA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AFC,OAED,EAAA;AAAA,oBAAA;;;;;;;;;UAIUhE,EAAM,QAAQ,WAAM,IAClCyE,EAAQC,EAAA,QAAA,WAAA,EAAA,KAAA,EAAA,CAAA,KAGRR,EAAA,EAAA,GAAAT,EAIEkB,IAAA,EAAA,KAAA,EAAA,GAAAC,GAHkB5E,EAAM,UAAjB6E,YADTV,EAIET,EAAAW,CAAA,GAJFD,EAIE,EAAA,SAAA,GAAA,GAFQS,GAAO;AAAA,YACd,KAAKA,EAAQ,QAAQA,EAAQ;AAAA,UAAA;;;;QArCvB,CAAAnB,EAAAoB,EAAA,GAAA9E,EAAM,OAAO;AAAA,MAAA;;;IC1PxB+E,KAAcC;AAAA,EAClBC;AAAAA,EACAC,EAAS,EAAE,YAAY,cAAc,SAAS,WAAW;AAC3D;"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { ElSlider } from 'element-plus';
|
|
2
|
+
export type SliderProps = typeof ElSlider;
|
|
3
|
+
export declare const Slider: import('element-plus/es/utils/index.mjs').SFCWithInstall<import('vue').DefineComponent<{
|
|
4
|
+
readonly ariaLabel: StringConstructor;
|
|
5
|
+
readonly modelValue: import('element-plus/es/utils/index.mjs').EpPropFinalized<(new (...args: any[]) => number | number[]) | (() => import('element-plus/es/utils/typescript.mjs').Arrayable<number>) | ((new (...args: any[]) => number | number[]) | (() => import('element-plus/es/utils/typescript.mjs').Arrayable<number>))[], unknown, unknown, 0, boolean>;
|
|
6
|
+
readonly id: import('element-plus/es/utils/index.mjs').EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
|
|
7
|
+
readonly min: import('element-plus/es/utils/index.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
|
|
8
|
+
readonly max: import('element-plus/es/utils/index.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 100, boolean>;
|
|
9
|
+
readonly step: import('element-plus/es/utils/index.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
|
|
10
|
+
readonly showInput: BooleanConstructor;
|
|
11
|
+
readonly showInputControls: import('element-plus/es/utils/index.mjs').EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
12
|
+
readonly size: {
|
|
13
|
+
readonly type: import('vue').PropType<import('element-plus/es/utils/index.mjs').EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
|
|
14
|
+
readonly required: false;
|
|
15
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
16
|
+
__epPropKey: true;
|
|
17
|
+
};
|
|
18
|
+
readonly inputSize: {
|
|
19
|
+
readonly type: import('vue').PropType<import('element-plus/es/utils/index.mjs').EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
|
|
20
|
+
readonly required: false;
|
|
21
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
22
|
+
__epPropKey: true;
|
|
23
|
+
};
|
|
24
|
+
readonly showStops: BooleanConstructor;
|
|
25
|
+
readonly showTooltip: import('element-plus/es/utils/index.mjs').EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
26
|
+
readonly formatTooltip: import('element-plus/es/utils/index.mjs').EpPropFinalized<(new (...args: any[]) => (val: number) => number | string) | (() => (val: number) => number | string) | {
|
|
27
|
+
(): (val: number) => number | string;
|
|
28
|
+
new (): any;
|
|
29
|
+
readonly prototype: any;
|
|
30
|
+
} | ((new (...args: any[]) => (val: number) => number | string) | (() => (val: number) => number | string) | {
|
|
31
|
+
(): (val: number) => number | string;
|
|
32
|
+
new (): any;
|
|
33
|
+
readonly prototype: any;
|
|
34
|
+
})[], unknown, unknown, undefined, boolean>;
|
|
35
|
+
readonly disabled: import('element-plus/es/utils/index.mjs').EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
36
|
+
readonly range: BooleanConstructor;
|
|
37
|
+
readonly vertical: BooleanConstructor;
|
|
38
|
+
readonly height: StringConstructor;
|
|
39
|
+
readonly rangeStartLabel: import('element-plus/es/utils/index.mjs').EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
|
|
40
|
+
readonly rangeEndLabel: import('element-plus/es/utils/index.mjs').EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
|
|
41
|
+
readonly formatValueText: import('element-plus/es/utils/index.mjs').EpPropFinalized<(new (...args: any[]) => (val: number) => string) | (() => (val: number) => string) | {
|
|
42
|
+
(): (val: number) => string;
|
|
43
|
+
new (): any;
|
|
44
|
+
readonly prototype: any;
|
|
45
|
+
} | ((new (...args: any[]) => (val: number) => string) | (() => (val: number) => string) | {
|
|
46
|
+
(): (val: number) => string;
|
|
47
|
+
new (): any;
|
|
48
|
+
readonly prototype: any;
|
|
49
|
+
})[], unknown, unknown, undefined, boolean>;
|
|
50
|
+
readonly tooltipClass: import('element-plus/es/utils/index.mjs').EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
|
|
51
|
+
readonly placement: import('element-plus/es/utils/index.mjs').EpPropFinalized<StringConstructor, import('element-plus').Placement, unknown, "top", boolean>;
|
|
52
|
+
readonly marks: {
|
|
53
|
+
readonly type: import('vue').PropType<{
|
|
54
|
+
[x: number]: import('element-plus/es/utils/index.mjs').EpPropMergeType<(new (...args: any[]) => string | {
|
|
55
|
+
style: import('vue').CSSProperties;
|
|
56
|
+
label: any;
|
|
57
|
+
}) | (() => string | {
|
|
58
|
+
style: import('vue').CSSProperties;
|
|
59
|
+
label: any;
|
|
60
|
+
}) | ((new (...args: any[]) => string | {
|
|
61
|
+
style: import('vue').CSSProperties;
|
|
62
|
+
label: any;
|
|
63
|
+
}) | (() => string | {
|
|
64
|
+
style: import('vue').CSSProperties;
|
|
65
|
+
label: any;
|
|
66
|
+
}))[], unknown, unknown> | undefined;
|
|
67
|
+
}>;
|
|
68
|
+
readonly required: false;
|
|
69
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
70
|
+
__epPropKey: true;
|
|
71
|
+
};
|
|
72
|
+
readonly validateEvent: import('element-plus/es/utils/index.mjs').EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
73
|
+
readonly persistent: import('element-plus/es/utils/index.mjs').EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
74
|
+
}, {
|
|
75
|
+
onSliderClick: (event: MouseEvent | TouchEvent) => void;
|
|
76
|
+
}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
77
|
+
"update:modelValue": (value: import('element-plus/es/utils/typescript.mjs').Arrayable<number>) => void;
|
|
78
|
+
change: (value: import('element-plus/es/utils/typescript.mjs').Arrayable<number>) => void;
|
|
79
|
+
input: (value: import('element-plus/es/utils/typescript.mjs').Arrayable<number>) => void;
|
|
80
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
81
|
+
readonly ariaLabel: StringConstructor;
|
|
82
|
+
readonly modelValue: import('element-plus/es/utils/index.mjs').EpPropFinalized<(new (...args: any[]) => number | number[]) | (() => import('element-plus/es/utils/typescript.mjs').Arrayable<number>) | ((new (...args: any[]) => number | number[]) | (() => import('element-plus/es/utils/typescript.mjs').Arrayable<number>))[], unknown, unknown, 0, boolean>;
|
|
83
|
+
readonly id: import('element-plus/es/utils/index.mjs').EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
|
|
84
|
+
readonly min: import('element-plus/es/utils/index.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
|
|
85
|
+
readonly max: import('element-plus/es/utils/index.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 100, boolean>;
|
|
86
|
+
readonly step: import('element-plus/es/utils/index.mjs').EpPropFinalized<NumberConstructor, unknown, unknown, 1, boolean>;
|
|
87
|
+
readonly showInput: BooleanConstructor;
|
|
88
|
+
readonly showInputControls: import('element-plus/es/utils/index.mjs').EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
89
|
+
readonly size: {
|
|
90
|
+
readonly type: import('vue').PropType<import('element-plus/es/utils/index.mjs').EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
|
|
91
|
+
readonly required: false;
|
|
92
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
93
|
+
__epPropKey: true;
|
|
94
|
+
};
|
|
95
|
+
readonly inputSize: {
|
|
96
|
+
readonly type: import('vue').PropType<import('element-plus/es/utils/index.mjs').EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
|
|
97
|
+
readonly required: false;
|
|
98
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
99
|
+
__epPropKey: true;
|
|
100
|
+
};
|
|
101
|
+
readonly showStops: BooleanConstructor;
|
|
102
|
+
readonly showTooltip: import('element-plus/es/utils/index.mjs').EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
103
|
+
readonly formatTooltip: import('element-plus/es/utils/index.mjs').EpPropFinalized<(new (...args: any[]) => (val: number) => number | string) | (() => (val: number) => number | string) | {
|
|
104
|
+
(): (val: number) => number | string;
|
|
105
|
+
new (): any;
|
|
106
|
+
readonly prototype: any;
|
|
107
|
+
} | ((new (...args: any[]) => (val: number) => number | string) | (() => (val: number) => number | string) | {
|
|
108
|
+
(): (val: number) => number | string;
|
|
109
|
+
new (): any;
|
|
110
|
+
readonly prototype: any;
|
|
111
|
+
})[], unknown, unknown, undefined, boolean>;
|
|
112
|
+
readonly disabled: import('element-plus/es/utils/index.mjs').EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
113
|
+
readonly range: BooleanConstructor;
|
|
114
|
+
readonly vertical: BooleanConstructor;
|
|
115
|
+
readonly height: StringConstructor;
|
|
116
|
+
readonly rangeStartLabel: import('element-plus/es/utils/index.mjs').EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
|
|
117
|
+
readonly rangeEndLabel: import('element-plus/es/utils/index.mjs').EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
|
|
118
|
+
readonly formatValueText: import('element-plus/es/utils/index.mjs').EpPropFinalized<(new (...args: any[]) => (val: number) => string) | (() => (val: number) => string) | {
|
|
119
|
+
(): (val: number) => string;
|
|
120
|
+
new (): any;
|
|
121
|
+
readonly prototype: any;
|
|
122
|
+
} | ((new (...args: any[]) => (val: number) => string) | (() => (val: number) => string) | {
|
|
123
|
+
(): (val: number) => string;
|
|
124
|
+
new (): any;
|
|
125
|
+
readonly prototype: any;
|
|
126
|
+
})[], unknown, unknown, undefined, boolean>;
|
|
127
|
+
readonly tooltipClass: import('element-plus/es/utils/index.mjs').EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
|
|
128
|
+
readonly placement: import('element-plus/es/utils/index.mjs').EpPropFinalized<StringConstructor, import('element-plus').Placement, unknown, "top", boolean>;
|
|
129
|
+
readonly marks: {
|
|
130
|
+
readonly type: import('vue').PropType<{
|
|
131
|
+
[x: number]: import('element-plus/es/utils/index.mjs').EpPropMergeType<(new (...args: any[]) => string | {
|
|
132
|
+
style: import('vue').CSSProperties;
|
|
133
|
+
label: any;
|
|
134
|
+
}) | (() => string | {
|
|
135
|
+
style: import('vue').CSSProperties;
|
|
136
|
+
label: any;
|
|
137
|
+
}) | ((new (...args: any[]) => string | {
|
|
138
|
+
style: import('vue').CSSProperties;
|
|
139
|
+
label: any;
|
|
140
|
+
}) | (() => string | {
|
|
141
|
+
style: import('vue').CSSProperties;
|
|
142
|
+
label: any;
|
|
143
|
+
}))[], unknown, unknown> | undefined;
|
|
144
|
+
}>;
|
|
145
|
+
readonly required: false;
|
|
146
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
147
|
+
__epPropKey: true;
|
|
148
|
+
};
|
|
149
|
+
readonly validateEvent: import('element-plus/es/utils/index.mjs').EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
150
|
+
readonly persistent: import('element-plus/es/utils/index.mjs').EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
151
|
+
}>> & {
|
|
152
|
+
"onUpdate:modelValue"?: ((value: import('element-plus/es/utils/typescript.mjs').Arrayable<number>) => any) | undefined;
|
|
153
|
+
onInput?: ((value: import('element-plus/es/utils/typescript.mjs').Arrayable<number>) => any) | undefined;
|
|
154
|
+
onChange?: ((value: import('element-plus/es/utils/typescript.mjs').Arrayable<number>) => any) | undefined;
|
|
155
|
+
}, {
|
|
156
|
+
readonly disabled: import('element-plus/es/utils/index.mjs').EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
157
|
+
readonly vertical: boolean;
|
|
158
|
+
readonly range: boolean;
|
|
159
|
+
readonly id: string;
|
|
160
|
+
readonly modelValue: import('element-plus/es/utils/index.mjs').EpPropMergeType<(new (...args: any[]) => number | number[]) | (() => import('element-plus/es/utils/typescript.mjs').Arrayable<number>) | ((new (...args: any[]) => number | number[]) | (() => import('element-plus/es/utils/typescript.mjs').Arrayable<number>))[], unknown, unknown>;
|
|
161
|
+
readonly placement: import('element-plus/es/utils/index.mjs').EpPropMergeType<StringConstructor, import('element-plus').Placement, unknown>;
|
|
162
|
+
readonly min: number;
|
|
163
|
+
readonly max: number;
|
|
164
|
+
readonly validateEvent: import('element-plus/es/utils/index.mjs').EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
165
|
+
readonly persistent: import('element-plus/es/utils/index.mjs').EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
166
|
+
readonly step: number;
|
|
167
|
+
readonly showInputControls: import('element-plus/es/utils/index.mjs').EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
168
|
+
readonly showTooltip: import('element-plus/es/utils/index.mjs').EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
169
|
+
readonly formatTooltip: (val: number) => number | string;
|
|
170
|
+
readonly rangeStartLabel: string;
|
|
171
|
+
readonly rangeEndLabel: string;
|
|
172
|
+
readonly formatValueText: (val: number) => string;
|
|
173
|
+
readonly tooltipClass: string;
|
|
174
|
+
readonly showInput: boolean;
|
|
175
|
+
readonly showStops: boolean;
|
|
176
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>>;
|
|
177
|
+
export default Slider;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { connect as r, mapProps as e } from "@silver-formily/vue";
|
|
2
|
+
import { ElSlider as o } from "element-plus";
|
|
3
|
+
import { PreviewText as t } from "../preview-text/index.mjs";
|
|
4
|
+
import { mapReadPretty as m } from "../__builtins__/shared/transform-component.mjs";
|
|
5
|
+
const l = r(
|
|
6
|
+
o,
|
|
7
|
+
e({ readOnly: "readonly", disabled: !0 }),
|
|
8
|
+
m(t.Input)
|
|
9
|
+
);
|
|
10
|
+
export {
|
|
11
|
+
l as Slider,
|
|
12
|
+
l as default
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/slider/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\nimport { ElSlider } from 'element-plus'\nimport { mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\n\nexport type SliderProps = typeof ElSlider\n\nexport const Slider = connect<typeof ElSlider>(\n ElSlider,\n mapProps({ readOnly: 'readonly', disabled: true }),\n mapReadPretty(PreviewText.Input),\n)\n\nexport default Slider\n"],"names":["Slider","connect","ElSlider","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;AAOO,MAAMA,IAASC;AAAA,EACpBC;AAAA,EACAC,EAAS,EAAE,UAAU,YAAY,UAAU,IAAM;AAAA,EACjDC,EAAcC,EAAY,KAAK;AACjC;"}
|
package/esm/submit/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/submit/submit.vue","../../src/submit/index.ts"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { IFormFeedback } from '@formily/core'\nimport type { PropType } from 'vue'\nimport { useParentForm } from '@silver-formily/vue'\nimport { ElButton } from 'element-plus'\n\ndefineOptions({\n name: 'FSubmit',\n inheritAttrs: false,\n})\n\nconst props = defineProps({\n onClick: Function as PropType<(e: MouseEvent) => any>,\n onSubmit: Function as PropType<(values: any) => Promise<any>>,\n onSubmitSuccess: Function as PropType<(payload: any) => void>,\n onSubmitFailed: Function as PropType<(feedbacks: IFormFeedback[]) => void>,\n submit: Boolean,\n loading: Boolean,\n})\n\nconst formRef = useParentForm()\n\nfunction handleClick(e: MouseEvent) {\n if (props.onClick?.(e) === false)\n return\n if (props.onSubmit) {\n const form = formRef?.value\n form?.submit(props.onSubmit)\n .then(props.onSubmitSuccess)\n .catch(props.onSubmitFailed ?? console.log)\n }\n}\n</script>\n\n<template>\n <ElButton\n :native-type=\"props.submit ? 'button' : 'submit'\"\n type=\"primary\"\n v-bind=\"$attrs\"\n :loading=\"formRef?.submitting ?? props.loading\"\n @click=\"handleClick\"\n >\n <template #default>\n <slot />\n </template>\n </ElButton>\n</template>\n","import { observer } from '@silver-formily/reactive-vue'\nimport FSubmit from './submit.vue'\n\nexport const Submit = observer(FSubmit)\n\nexport default Submit\n"],"names":["props","__props","formRef","useParentForm","handleClick","e","_openBlock","_createBlock","_unref","_mergeProps","$attrs","_renderSlot","_ctx","Submit","observer","FSubmit"],"mappings":";;;;;;;;;;;;;;;;;AAWA,UAAMA,IAAQC,GASRC,IAAUC,EAAA;AAEhB,aAASC,EAAYC,GAAe;AAClC,MAAIL,EAAM,UAAUK,CAAC,MAAM,MAEvBL,EAAM,YACKE,GAAS,OAChB,OAAOF,EAAM,QAAQ,EACxB,KAAKA,EAAM,eAAe,EAC1B,MAAMA,EAAM,kBAAkB,QAAQ,GAAG;AAAA,IAEhD;sBAIEM,KAAAC,EAUWC,MAVXC,EAUW;AAAA,MATR,eAAaT,EAAM,SAAM,WAAA;AAAA,MAC1B,MAAK;AAAA,IAAA,GACGU,EAAAA,QAAM;AAAA,MACb,SAASF,EAAAN,CAAA,GAAS,cAAcF,EAAM;AAAA,MACtC,SAAOI;AAAA,IAAA;MAEG,WACT,MAAQ;AAAA,QAARO,EAAQC,EAAA,QAAA,SAAA;AAAA,MAAA;;;;ICxCDC,IAASC,EAASC,CAAO;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/submit/submit.vue","../../src/submit/index.ts"],"sourcesContent":["<script lang=\"ts\" setup>\r\nimport type { IFormFeedback } from '@formily/core'\r\nimport type { PropType } from 'vue'\r\nimport { useParentForm } from '@silver-formily/vue'\r\nimport { ElButton } from 'element-plus'\r\n\r\ndefineOptions({\r\n name: 'FSubmit',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = defineProps({\r\n onClick: Function as PropType<(e: MouseEvent) => any>,\r\n onSubmit: Function as PropType<(values: any) => Promise<any>>,\r\n onSubmitSuccess: Function as PropType<(payload: any) => void>,\r\n onSubmitFailed: Function as PropType<(feedbacks: IFormFeedback[]) => void>,\r\n submit: Boolean,\r\n loading: Boolean,\r\n})\r\n\r\nconst formRef = useParentForm()\r\n\r\nfunction handleClick(e: MouseEvent) {\r\n if (props.onClick?.(e) === false)\r\n return\r\n if (props.onSubmit) {\r\n const form = formRef?.value\r\n form?.submit(props.onSubmit)\r\n .then(props.onSubmitSuccess)\r\n .catch(props.onSubmitFailed ?? console.log)\r\n }\r\n}\r\n</script>\r\n\r\n<template>\r\n <ElButton\r\n :native-type=\"props.submit ? 'button' : 'submit'\"\r\n type=\"primary\"\r\n v-bind=\"$attrs\"\r\n :loading=\"formRef?.submitting ?? props.loading\"\r\n @click=\"handleClick\"\r\n >\r\n <template #default>\r\n <slot />\r\n </template>\r\n </ElButton>\r\n</template>\r\n","import { observer } from '@silver-formily/reactive-vue'\r\nimport FSubmit from './submit.vue'\r\n\r\nexport const Submit = observer(FSubmit)\r\n\r\nexport default Submit\r\n"],"names":["props","__props","formRef","useParentForm","handleClick","e","_openBlock","_createBlock","_unref","_mergeProps","$attrs","_renderSlot","_ctx","Submit","observer","FSubmit"],"mappings":";;;;;;;;;;;;;;;;;AAWA,UAAMA,IAAQC,GASRC,IAAUC,EAAA;AAEhB,aAASC,EAAYC,GAAe;AAClC,MAAIL,EAAM,UAAUK,CAAC,MAAM,MAEvBL,EAAM,YACKE,GAAS,OAChB,OAAOF,EAAM,QAAQ,EACxB,KAAKA,EAAM,eAAe,EAC1B,MAAMA,EAAM,kBAAkB,QAAQ,GAAG;AAAA,IAEhD;sBAIEM,KAAAC,EAUWC,MAVXC,EAUW;AAAA,MATR,eAAaT,EAAM,SAAM,WAAA;AAAA,MAC1B,MAAK;AAAA,IAAA,GACGU,EAAAA,QAAM;AAAA,MACb,SAASF,EAAAN,CAAA,GAAS,cAAcF,EAAM;AAAA,MACtC,SAAOI;AAAA,IAAA;MAEG,WACT,MAAQ;AAAA,QAARO,EAAQC,EAAA,QAAA,SAAA;AAAA,MAAA;;;;ICxCDC,IAASC,EAASC,CAAO;"}
|
package/esm/switch/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/switch/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\nimport { ElSwitch } from 'element-plus'\n\nexport type SwitchProps = typeof ElSwitch\n\nexport const Switch = connect<typeof ElSwitch>(\n ElSwitch,\n mapProps({\n readOnly: 'readonly',\n }),\n)\n\nexport default Switch\n"],"names":["Switch","connect","ElSwitch","mapProps"],"mappings":";;AAKO,MAAMA,IAASC;AAAA,EACpBC;AAAA,EACAC,EAAS;AAAA,IACP,UAAU;AAAA,EAAA,CACX;AACH;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/switch/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElSwitch } from 'element-plus'\r\n\r\nexport type SwitchProps = typeof ElSwitch\r\n\r\nexport const Switch = connect<typeof ElSwitch>(\r\n ElSwitch,\r\n mapProps({\r\n readOnly: 'readonly',\r\n }),\r\n)\r\n\r\nexport default Switch\r\n"],"names":["Switch","connect","ElSwitch","mapProps"],"mappings":";;AAKO,MAAMA,IAASC;AAAA,EACpBC;AAAA,EACAC,EAAS;AAAA,IACP,UAAU;AAAA,EAAA,CACX;AACH;"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { connect as r, mapProps as e } from "@silver-formily/vue";
|
|
2
2
|
import { ElTimePicker as m } from "element-plus";
|
|
3
|
-
import "
|
|
4
|
-
import "
|
|
5
|
-
|
|
6
|
-
import { PreviewText as i } from "../preview-text/index.mjs";
|
|
7
|
-
const n = r(
|
|
3
|
+
import { PreviewText as o } from "../preview-text/index.mjs";
|
|
4
|
+
import { mapReadPretty as i } from "../__builtins__/shared/transform-component.mjs";
|
|
5
|
+
const P = r(
|
|
8
6
|
m,
|
|
9
7
|
e({ readOnly: "readonly" }),
|
|
10
|
-
o
|
|
8
|
+
i(o.TimePicker)
|
|
11
9
|
);
|
|
12
10
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
P as TimePicker,
|
|
12
|
+
P as default
|
|
15
13
|
};
|
|
16
14
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/time-picker/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\nimport { ElTimePicker } from 'element-plus'\nimport { mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\n\nexport type TimePickerProps = typeof ElTimePicker\n\nexport const TimePicker = connect<typeof ElTimePicker>(\n ElTimePicker,\n mapProps({ readOnly: 'readonly' }),\n mapReadPretty(PreviewText.TimePicker),\n)\n\nexport default TimePicker\n"],"names":["TimePicker","connect","ElTimePicker","mapProps","mapReadPretty","PreviewText"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/time-picker/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElTimePicker } from 'element-plus'\r\nimport { mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\n\r\nexport type TimePickerProps = typeof ElTimePicker\r\n\r\nexport const TimePicker = connect<typeof ElTimePicker>(\r\n ElTimePicker,\r\n mapProps({ readOnly: 'readonly' }),\r\n mapReadPretty(PreviewText.TimePicker),\r\n)\r\n\r\nexport default TimePicker\r\n"],"names":["TimePicker","connect","ElTimePicker","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;AAOO,MAAMA,IAAaC;AAAA,EACxBC;AAAA,EACAC,EAAS,EAAE,UAAU,YAAY;AAAA,EACjCC,EAAcC,EAAY,UAAU;AACtC;"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { connect as e, mapProps as t } from "@silver-formily/vue";
|
|
2
2
|
import { ElTimeSelect as m } from "element-plus";
|
|
3
|
-
import "
|
|
4
|
-
import "
|
|
5
|
-
|
|
6
|
-
import { PreviewText as r } from "../preview-text/index.mjs";
|
|
7
|
-
const f = e(
|
|
3
|
+
import { PreviewText as o } from "../preview-text/index.mjs";
|
|
4
|
+
import { mapReadPretty as r } from "../__builtins__/shared/transform-component.mjs";
|
|
5
|
+
const l = e(
|
|
8
6
|
m,
|
|
9
7
|
t({ disabled: "disabled", editable: "editable" }),
|
|
10
|
-
o
|
|
8
|
+
r(o.Input)
|
|
11
9
|
);
|
|
12
10
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
l as TimeSelect,
|
|
12
|
+
l as default
|
|
15
13
|
};
|
|
16
14
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/time-select/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElTimeSelect } from 'element-plus'\r\nimport { mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\n\r\nexport const TimeSelect = connect<typeof ElTimeSelect>(\n ElTimeSelect,\n mapProps({ disabled: 'disabled', editable: 'editable' }),\r\n mapReadPretty(PreviewText.Input),\r\n)\r\n\r\nexport default TimeSelect\r\n"],"names":["TimeSelect","connect","ElTimeSelect","mapProps","mapReadPretty","PreviewText"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/time-select/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElTimeSelect } from 'element-plus'\r\nimport { mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\n\r\nexport const TimeSelect = connect<typeof ElTimeSelect>(\n ElTimeSelect,\n mapProps({ disabled: 'disabled', editable: 'editable' }),\r\n mapReadPretty(PreviewText.Input),\r\n)\r\n\r\nexport default TimeSelect\r\n"],"names":["TimeSelect","connect","ElTimeSelect","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;AAKO,MAAMA,IAAaC;AAAA,EACxBC;AAAA,EACAC,EAAS,EAAE,UAAU,YAAY,UAAU,YAAY;AAAA,EACvDC,EAAcC,EAAY,KAAK;AACjC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/transfer/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\nimport { ElTransfer } from 'element-plus'\n\nexport type TransferProps = typeof ElTransfer\n\nexport const Transfer = connect<typeof ElTransfer>(\n ElTransfer,\n mapProps({ dataSource: 'data' }),\n)\n\nexport default Transfer\n"],"names":["Transfer","connect","ElTransfer","mapProps"],"mappings":";;AAKO,MAAMA,IAAWC;AAAA,EACtBC;AAAA,EACAC,EAAS,EAAE,YAAY,OAAA,CAAQ;AACjC;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/transfer/index.ts"],"sourcesContent":["import { connect, mapProps } from '@silver-formily/vue'\r\nimport { ElTransfer } from 'element-plus'\r\n\r\nexport type TransferProps = typeof ElTransfer\r\n\r\nexport const Transfer = connect<typeof ElTransfer>(\r\n ElTransfer,\r\n mapProps({ dataSource: 'data' }),\r\n)\r\n\r\nexport default Transfer\r\n"],"names":["Transfer","connect","ElTransfer","mapProps"],"mappings":";;AAKO,MAAMA,IAAWC;AAAA,EACtBC;AAAA,EACAC,EAAS,EAAE,YAAY,OAAA,CAAQ;AACjC;"}
|
package/esm/tree/index.mjs
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { useField as _, connect as A, mapProps as D } from "@silver-formily/vue";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "@formily/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import "
|
|
9
|
-
|
|
10
|
-
import { useCleanAttrs as G } from "../__builtins__/shared/utils.mjs";
|
|
11
|
-
import { addDisabledToNodes as J, flattenTree as M, getInputKeys as Q, getOutputData as U } from "./utils.mjs";
|
|
12
|
-
const W = /* @__PURE__ */ H({
|
|
2
|
+
import { PreviewText as H } from "../preview-text/index.mjs";
|
|
3
|
+
import { defineComponent as P, useSlots as R, ref as h, computed as y, watch as v, nextTick as k, createBlock as g, openBlock as C, unref as a, withCtx as T, withDirectives as w, mergeProps as F, createSlots as B, renderList as E, renderSlot as L, normalizeProps as j, guardReactiveProps as z } from "vue";
|
|
4
|
+
import { isFn as I } from "@formily/shared";
|
|
5
|
+
import { ElScrollbar as N, ElTree as O, vLoading as $ } from "element-plus";
|
|
6
|
+
import { addDisabledToNodes as q, flattenTree as G, getInputKeys as J, getOutputData as M } from "./utils.mjs";
|
|
7
|
+
import { useCleanAttrs as Q } from "../__builtins__/shared/utils.mjs";
|
|
8
|
+
import { mapReadPretty as U } from "../__builtins__/shared/transform-component.mjs";
|
|
9
|
+
const W = /* @__PURE__ */ P({
|
|
13
10
|
name: "Tree",
|
|
14
11
|
inheritAttrs: !1,
|
|
15
12
|
__name: "tree",
|
|
@@ -31,13 +28,13 @@ const W = /* @__PURE__ */ H({
|
|
|
31
28
|
},
|
|
32
29
|
emits: ["update:modelValue"],
|
|
33
30
|
setup(K, { emit: V }) {
|
|
34
|
-
const e = K, s = V, b =
|
|
35
|
-
async function
|
|
31
|
+
const e = K, s = V, b = R(), { props: l } = Q(), o = h(), d = h([]), n = y(() => q(e.data ?? [], l.value.disabled, e.props)), c = y(() => G(n.value ?? [], [], e.props.children));
|
|
32
|
+
async function u() {
|
|
36
33
|
await k();
|
|
37
34
|
const t = o.value.getCheckedKeys(), f = o.value.getHalfCheckedKeys() || [];
|
|
38
35
|
d.value = t;
|
|
39
|
-
const { value: m, nodes: r } =
|
|
40
|
-
flatData:
|
|
36
|
+
const { value: m, nodes: r } = M(t, f, {
|
|
37
|
+
flatData: c.value,
|
|
41
38
|
nodeKey: e.nodeKey,
|
|
42
39
|
propsConfig: e.props,
|
|
43
40
|
data: e.data ?? [],
|
|
@@ -45,13 +42,13 @@ const W = /* @__PURE__ */ H({
|
|
|
45
42
|
includeHalfChecked: e.includeHalfChecked,
|
|
46
43
|
checkStrictly: l.value.checkStrictly
|
|
47
44
|
});
|
|
48
|
-
e.optionAsValue ?
|
|
45
|
+
e.optionAsValue ? I(e.optionFormatter) ? s("update:modelValue", r.map((i, x, S) => e.optionFormatter(i, x, S))) : s("update:modelValue", r) : s("update:modelValue", m);
|
|
49
46
|
}
|
|
50
47
|
v(() => e.modelValue, (t) => {
|
|
51
|
-
t !== void 0 && (d.value =
|
|
48
|
+
t !== void 0 && (d.value = J(t, {
|
|
52
49
|
optionAsValue: e.optionAsValue,
|
|
53
50
|
nodeKey: e.nodeKey,
|
|
54
|
-
flatData:
|
|
51
|
+
flatData: c.value,
|
|
55
52
|
propsConfig: e.props,
|
|
56
53
|
data: e.data ?? [],
|
|
57
54
|
valueType: e.valueType,
|
|
@@ -60,17 +57,17 @@ const W = /* @__PURE__ */ H({
|
|
|
60
57
|
o.value && o.value.setCheckedKeys(d.value);
|
|
61
58
|
}));
|
|
62
59
|
}, { immediate: !0 }), v(() => [e.valueType, e.optionAsValue, e.includeHalfChecked], () => {
|
|
63
|
-
|
|
60
|
+
u();
|
|
64
61
|
}, { immediate: !1 });
|
|
65
|
-
const
|
|
66
|
-
return
|
|
62
|
+
const p = _();
|
|
63
|
+
return p.value?.inject({
|
|
67
64
|
getTreeRef: () => o
|
|
68
|
-
}), (t, f) => (C(), g(a(
|
|
65
|
+
}), (t, f) => (C(), g(a(N), {
|
|
69
66
|
height: e.height,
|
|
70
67
|
"max-height": e.maxHeight
|
|
71
68
|
}, {
|
|
72
69
|
default: T(() => [
|
|
73
|
-
|
|
70
|
+
w((C(), g(a(O), F({
|
|
74
71
|
ref_key: "treeRef",
|
|
75
72
|
ref: o,
|
|
76
73
|
data: n.value,
|
|
@@ -78,27 +75,27 @@ const W = /* @__PURE__ */ H({
|
|
|
78
75
|
"node-key": e.nodeKey,
|
|
79
76
|
"default-checked-keys": d.value,
|
|
80
77
|
"show-checkbox": !0
|
|
81
|
-
}, a(l), { onCheck:
|
|
82
|
-
|
|
78
|
+
}, a(l), { onCheck: u }), B({ _: 2 }, [
|
|
79
|
+
E(a(b), (m, r) => ({
|
|
83
80
|
name: r,
|
|
84
81
|
fn: T((i) => [
|
|
85
|
-
|
|
82
|
+
L(t.$slots, r, j(z({ field: a(p), ...i })))
|
|
86
83
|
])
|
|
87
84
|
}))
|
|
88
85
|
]), 1040, ["data", "props", "node-key", "default-checked-keys"])), [
|
|
89
|
-
[a(
|
|
86
|
+
[a($), a(l).loading]
|
|
90
87
|
])
|
|
91
88
|
]),
|
|
92
89
|
_: 3
|
|
93
90
|
}, 8, ["height", "max-height"]));
|
|
94
91
|
}
|
|
95
|
-
}),
|
|
92
|
+
}), re = A(
|
|
96
93
|
W,
|
|
97
94
|
D({ dataSource: "data", loading: "loading", disabled: !0 }),
|
|
98
|
-
|
|
95
|
+
U(H.Tree)
|
|
99
96
|
);
|
|
100
97
|
export {
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
re as Tree,
|
|
99
|
+
re as default
|
|
103
100
|
};
|
|
104
101
|
//# sourceMappingURL=index.mjs.map
|
package/esm/tree/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/tree/tree.vue","../../src/tree/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Field } from '@formily/core'\nimport type { TreeValueTypeProps } from './types'\nimport { isFn } from '@formily/shared'\nimport { useField } from '@silver-formily/vue'\nimport { ElScrollbar, ElTree, vLoading } from 'element-plus'\nimport { computed, nextTick, ref, useSlots, watch } from 'vue'\nimport { useCleanAttrs } from '../__builtins__'\nimport { addDisabledToNodes, flattenTree, getInputKeys, getOutputData } from './utils'\n\ndefineOptions({\n name: 'Tree',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<TreeValueTypeProps>(), {\n valueType: 'all',\n optionAsValue: false,\n includeHalfChecked: false,\n props: {\n children: 'children',\n label: 'label',\n disabled: 'disabled',\n },\n})\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: any]\n}>()\n\nconst slots = useSlots()\n\nconst { props: attrs } = useCleanAttrs()\nconst treeRef = ref<InstanceType<typeof ElTree>>()\nconst checkedKeys = ref<any[]>([])\n\nconst processedData = computed(() => {\n return addDisabledToNodes(props.data ?? [], attrs.value.disabled, props.props)\n})\n\nconst flatData = computed(() => flattenTree(processedData.value ?? [], [], props.props.children))\n\nasync function handleCheck() {\n await nextTick()\n const keys = treeRef.value.getCheckedKeys()\n const halfCheckedKeys = treeRef.value.getHalfCheckedKeys() || []\n checkedKeys.value = keys\n\n const { value, nodes } = getOutputData(keys, halfCheckedKeys, {\n flatData: flatData.value,\n nodeKey: props.nodeKey,\n propsConfig: props.props,\n data: props.data ?? [],\n valueType: props.valueType,\n includeHalfChecked: props.includeHalfChecked,\n checkStrictly: attrs.value.checkStrictly,\n })\n\n if (props.optionAsValue) {\n isFn(props.optionFormatter)\n ? emit('update:modelValue', nodes.map((element, index, array) => {\n return props.optionFormatter(element, index, array)\n }))\n : emit('update:modelValue', nodes)\n }\n else {\n emit('update:modelValue', value)\n }\n}\n\nwatch(() => props.modelValue, (newValue) => {\n if (newValue !== undefined) {\n checkedKeys.value = getInputKeys(newValue, {\n optionAsValue: props.optionAsValue,\n nodeKey: props.nodeKey,\n flatData: flatData.value,\n propsConfig: props.props,\n data: props.data ?? [],\n valueType: props.valueType,\n checkStrictly: attrs.value.checkStrictly,\n })\n nextTick(() => {\n if (treeRef.value) {\n treeRef.value.setCheckedKeys(checkedKeys.value)\n }\n })\n }\n}, { immediate: true })\n\nwatch(() => [props.valueType, props.optionAsValue, props.includeHalfChecked], () => {\n handleCheck()\n}, { immediate: false })\n\nconst fieldRef = useField<Field>()\nfieldRef.value?.inject({\n getTreeRef: () => {\n return treeRef\n },\n})\n</script>\n\n<template>\n <ElScrollbar :height=\"props.height\" :max-height=\"props.maxHeight\">\n <ElTree\n ref=\"treeRef\"\n v-loading=\"attrs.loading\"\n :data=\"processedData\"\n :props=\"props.props\"\n :node-key=\"props.nodeKey\"\n :default-checked-keys=\"checkedKeys\"\n :show-checkbox=\"true\"\n v-bind=\"attrs\"\n @check=\"handleCheck\"\n >\n <template v-for=\"(_, name) of slots\" #[name]=\"slotData\">\n <slot :name=\"name\" v-bind=\"{ field: fieldRef, ...slotData }\" />\n </template>\n </ElTree>\n </ElScrollbar>\n</template>\n","import { connect, mapProps } from '@silver-formily/vue'\nimport { mapReadPretty } from '../__builtins__'\nimport { PreviewText } from '../preview-text'\nimport InnerTree from './tree.vue'\n\nconst Tree = connect<typeof InnerTree>(\n InnerTree,\n mapProps({ dataSource: 'data', loading: 'loading', disabled: true }),\n mapReadPretty(PreviewText.Tree),\n)\n\nexport { Tree }\n\nexport default Tree\n"],"names":["props","__props","emit","__emit","slots","useSlots","attrs","useCleanAttrs","treeRef","ref","checkedKeys","processedData","computed","addDisabledToNodes","flatData","flattenTree","handleCheck","nextTick","keys","halfCheckedKeys","value","nodes","getOutputData","isFn","element","index","array","watch","newValue","getInputKeys","fieldRef","useField","_createBlock","_unref","ElScrollbar","_withDirectives","_openBlock","_mergeProps","_createSlots","_","name","_withCtx","slotData","_renderSlot","_ctx","_normalizeProps","_guardReactiveProps","vLoading","Tree","connect","InnerTree","mapProps","mapReadPretty","PreviewText"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/tree/tree.vue","../../src/tree/index.ts"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport type { Field } from '@formily/core'\r\nimport type { TreeValueTypeProps } from './types'\r\nimport { isFn } from '@formily/shared'\r\nimport { useField } from '@silver-formily/vue'\r\nimport { ElScrollbar, ElTree, vLoading } from 'element-plus'\r\nimport { computed, nextTick, ref, useSlots, watch } from 'vue'\r\nimport { useCleanAttrs } from '../__builtins__'\r\nimport { addDisabledToNodes, flattenTree, getInputKeys, getOutputData } from './utils'\r\n\r\ndefineOptions({\r\n name: 'Tree',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = withDefaults(defineProps<TreeValueTypeProps>(), {\r\n valueType: 'all',\r\n optionAsValue: false,\r\n includeHalfChecked: false,\r\n props: {\r\n children: 'children',\r\n label: 'label',\r\n disabled: 'disabled',\r\n },\r\n})\r\n\r\nconst emit = defineEmits<{\r\n 'update:modelValue': [value: any]\r\n}>()\r\n\r\nconst slots = useSlots()\r\n\r\nconst { props: attrs } = useCleanAttrs()\r\nconst treeRef = ref<InstanceType<typeof ElTree>>()\r\nconst checkedKeys = ref<any[]>([])\r\n\r\nconst processedData = computed(() => {\r\n return addDisabledToNodes(props.data ?? [], attrs.value.disabled, props.props)\r\n})\r\n\r\nconst flatData = computed(() => flattenTree(processedData.value ?? [], [], props.props.children))\r\n\r\nasync function handleCheck() {\r\n await nextTick()\r\n const keys = treeRef.value.getCheckedKeys()\r\n const halfCheckedKeys = treeRef.value.getHalfCheckedKeys() || []\r\n checkedKeys.value = keys\r\n\r\n const { value, nodes } = getOutputData(keys, halfCheckedKeys, {\r\n flatData: flatData.value,\r\n nodeKey: props.nodeKey,\r\n propsConfig: props.props,\r\n data: props.data ?? [],\r\n valueType: props.valueType,\r\n includeHalfChecked: props.includeHalfChecked,\r\n checkStrictly: attrs.value.checkStrictly,\r\n })\r\n\r\n if (props.optionAsValue) {\r\n isFn(props.optionFormatter)\r\n ? emit('update:modelValue', nodes.map((element, index, array) => {\r\n return props.optionFormatter(element, index, array)\r\n }))\r\n : emit('update:modelValue', nodes)\r\n }\r\n else {\r\n emit('update:modelValue', value)\r\n }\r\n}\r\n\r\nwatch(() => props.modelValue, (newValue) => {\r\n if (newValue !== undefined) {\r\n checkedKeys.value = getInputKeys(newValue, {\r\n optionAsValue: props.optionAsValue,\r\n nodeKey: props.nodeKey,\r\n flatData: flatData.value,\r\n propsConfig: props.props,\r\n data: props.data ?? [],\r\n valueType: props.valueType,\r\n checkStrictly: attrs.value.checkStrictly,\r\n })\r\n nextTick(() => {\r\n if (treeRef.value) {\r\n treeRef.value.setCheckedKeys(checkedKeys.value)\r\n }\r\n })\r\n }\r\n}, { immediate: true })\r\n\r\nwatch(() => [props.valueType, props.optionAsValue, props.includeHalfChecked], () => {\r\n handleCheck()\r\n}, { immediate: false })\r\n\r\nconst fieldRef = useField<Field>()\r\nfieldRef.value?.inject({\r\n getTreeRef: () => {\r\n return treeRef\r\n },\r\n})\r\n</script>\r\n\r\n<template>\r\n <ElScrollbar :height=\"props.height\" :max-height=\"props.maxHeight\">\r\n <ElTree\r\n ref=\"treeRef\"\r\n v-loading=\"attrs.loading\"\r\n :data=\"processedData\"\r\n :props=\"props.props\"\r\n :node-key=\"props.nodeKey\"\r\n :default-checked-keys=\"checkedKeys\"\r\n :show-checkbox=\"true\"\r\n v-bind=\"attrs\"\r\n @check=\"handleCheck\"\r\n >\r\n <template v-for=\"(_, name) of slots\" #[name]=\"slotData\">\r\n <slot :name=\"name\" v-bind=\"{ field: fieldRef, ...slotData }\" />\r\n </template>\r\n </ElTree>\r\n </ElScrollbar>\r\n</template>\r\n","import { connect, mapProps } from '@silver-formily/vue'\r\nimport { mapReadPretty } from '../__builtins__'\r\nimport { PreviewText } from '../preview-text'\r\nimport InnerTree from './tree.vue'\r\n\r\nconst Tree = connect<typeof InnerTree>(\r\n InnerTree,\r\n mapProps({ dataSource: 'data', loading: 'loading', disabled: true }),\r\n mapReadPretty(PreviewText.Tree),\r\n)\r\n\r\nexport { Tree }\r\n\r\nexport default Tree\r\n"],"names":["props","__props","emit","__emit","slots","useSlots","attrs","useCleanAttrs","treeRef","ref","checkedKeys","processedData","computed","addDisabledToNodes","flatData","flattenTree","handleCheck","nextTick","keys","halfCheckedKeys","value","nodes","getOutputData","isFn","element","index","array","watch","newValue","getInputKeys","fieldRef","useField","_createBlock","_unref","ElScrollbar","_withDirectives","_openBlock","_mergeProps","_createSlots","_","name","_withCtx","slotData","_renderSlot","_ctx","_normalizeProps","_guardReactiveProps","vLoading","Tree","connect","InnerTree","mapProps","mapReadPretty","PreviewText"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,UAAMA,IAAQC,GAWRC,IAAOC,GAIPC,IAAQC,EAAA,GAER,EAAE,OAAOC,EAAA,IAAUC,EAAA,GACnBC,IAAUC,EAAA,GACVC,IAAcD,EAAW,EAAE,GAE3BE,IAAgBC,EAAS,MACtBC,EAAmBb,EAAM,QAAQ,CAAA,GAAIM,EAAM,MAAM,UAAUN,EAAM,KAAK,CAC9E,GAEKc,IAAWF,EAAS,MAAMG,EAAYJ,EAAc,SAAS,CAAA,GAAI,IAAIX,EAAM,MAAM,QAAQ,CAAC;AAEhG,mBAAegB,IAAc;AAC3B,YAAMC,EAAA;AACN,YAAMC,IAAOV,EAAQ,MAAM,eAAA,GACrBW,IAAkBX,EAAQ,MAAM,mBAAA,KAAwB,CAAA;AAC9D,MAAAE,EAAY,QAAQQ;AAEpB,YAAM,EAAE,OAAAE,GAAO,OAAAC,EAAA,IAAUC,EAAcJ,GAAMC,GAAiB;AAAA,QAC5D,UAAUL,EAAS;AAAA,QACnB,SAASd,EAAM;AAAA,QACf,aAAaA,EAAM;AAAA,QACnB,MAAMA,EAAM,QAAQ,CAAA;AAAA,QACpB,WAAWA,EAAM;AAAA,QACjB,oBAAoBA,EAAM;AAAA,QAC1B,eAAeM,EAAM,MAAM;AAAA,MAA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BU,EAAA;AAAA,UACtB,iBAAe;AAAA,QAAA,GACRuB,EAAA3B,CAAA,GAAK,EACZ,SAAOU,GAAW,GAAAsB,EAAA,EAAA,GAAA,KAAA;AAAA,YAEWL,EAAA7B,CAAA,GAAK,CAAjBmC,GAAGC;;YACnB,IAAAC,EAAA,CAD4CC,MAAQ;AAAA,cACpDC,EAA+DC,EAAA,QAAlDJ,GAAIK,EAAAC,EAAA,EAAA,OAAmBb,EAAAH,CAAA,MAAaY,EAAA,CAAQ,CAAA,CAAA;AAAA,YAAA;;;UAVhD,CAAAT,EAAAc,CAAA,GAAAd,EAAA3B,CAAA,EAAM,OAAO;AAAA,QAAA;;;;;ICpGxB0C,KAAOC;AAAA,EACXC;AAAAA,EACAC,EAAS,EAAE,YAAY,QAAQ,SAAS,WAAW,UAAU,IAAM;AAAA,EACnEC,EAAcC,EAAY,IAAI;AAChC;"}
|
package/esm/tree/utils.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","sources":["../../src/tree/utils.ts"],"sourcesContent":["import type { TreeNodeData } from 'element-plus'\n\nexport function flattenTree(nodes: TreeNodeData[], result: TreeNodeData[] = [], childrenKey = 'children'): TreeNodeData[] {\n for (const node of nodes) {\n result.push(node)\n if (node[childrenKey] && node[childrenKey].length > 0) {\n flattenTree(node[childrenKey], result, childrenKey)\n }\n }\n return result\n}\n\nexport function addDisabledToNodes(nodes: TreeNodeData[], disabled: boolean, propsConfig: any): TreeNodeData[] {\n if (!disabled) {\n return nodes\n }\n\n return nodes.map((node) => {\n const newNode = { ...node }\n newNode[propsConfig.disabled!] = true\n\n if (node[propsConfig.children!] && node[propsConfig.children!].length > 0) {\n newNode[propsConfig.children!] = addDisabledToNodes(node[propsConfig.children!], disabled, propsConfig)\n }\n\n return newNode\n })\n}\n\nexport function traverseTree(\n nodes: TreeNodeData[],\n callback: (node: TreeNodeData) => void,\n options: {\n leafOnly?: boolean\n childrenKey?: string\n } = {},\n) {\n const { leafOnly = false, childrenKey = 'children' } = options\n\n for (const node of nodes) {\n const children = node[childrenKey] || []\n const isLeaf = children.length === 0\n\n if (!leafOnly || isLeaf) {\n callback(node)\n }\n if (children.length > 0) {\n traverseTree(children, callback, options)\n }\n }\n}\n\nexport function getChildrenKeys(node: TreeNodeData, nodeKey: string, propsConfig: any): any[] {\n const children = node[propsConfig.children!] || []\n if (children.length === 0)\n return []\n\n const keys: any[] = []\n traverseTree(children, (child) => {\n keys.push(child[nodeKey])\n }, { childrenKey: propsConfig.children })\n\n return keys\n}\n\nexport function extractKeysFromPath(pathNodes: TreeNodeData[], nodeKey: string, propsConfig: any): any[] {\n const keys: any[] = []\n traverseTree(pathNodes, (node) => {\n keys.push(node[nodeKey])\n }, { leafOnly: true, childrenKey: propsConfig.children })\n\n return keys\n}\n\nexport function getSelectedPath(nodes: TreeNodeData[], selectedKeys: any[], nodeKey: string, propsConfig: any): TreeNodeData[] {\n const result: TreeNodeData[] = []\n\n for (const node of nodes) {\n const children = node[propsConfig.children!] || []\n const hasSelectedChild = children.length > 0\n ? getSelectedPath(children, selectedKeys, nodeKey, propsConfig).length > 0\n : false\n\n if (selectedKeys.includes(node[nodeKey]) || hasSelectedChild) {\n const newNode = { ...node }\n if (hasSelectedChild && children.length > 0) {\n newNode[propsConfig.children!] = getSelectedPath(children, selectedKeys, nodeKey, propsConfig)\n }\n result.push(newNode)\n }\n }\n\n return result\n}\n\n/**\n * 查找节点的所有父节点路径\n */\nexport function findParents(nodes: TreeNodeData[], targetKey: any, nodeKey: string, propsConfig: any, parents: any[] = []): any[] {\n for (const node of nodes) {\n const currentPath = [...parents, node[nodeKey]]\n\n if (node[nodeKey] === targetKey) {\n return currentPath\n }\n\n const children = node[propsConfig.children!] || []\n if (children.length > 0) {\n const found = findParents(children, targetKey, nodeKey, propsConfig, currentPath)\n if (found.length > 0) {\n return found\n }\n }\n }\n /* istanbul ignore next -- @preserve */\n return []\n}\n\n/**\n * 过滤叶子节点\n */\nexport function filterLeafNodes(keys: any[], flatData: TreeNodeData[], nodeKey: string, propsConfig: any): any[] {\n return keys.filter((key) => {\n const node = flatData.find(n => n[nodeKey] === key)\n if (!node)\n return false\n const children = node[propsConfig.children!] || []\n return children.length === 0\n })\n}\n\n/**\n * 获取输出数据\n */\nexport function getOutputData(\n keys: any[],\n halfCheckedKeys: any[] = [],\n options: {\n flatData: TreeNodeData[]\n nodeKey: string\n propsConfig: any\n data: TreeNodeData[]\n valueType: string\n includeHalfChecked: boolean\n checkStrictly: boolean\n },\n) {\n const { flatData, nodeKey, propsConfig, data, valueType, includeHalfChecked, checkStrictly } = options\n\n const selectedNodes = flatData.filter(node =>\n keys.includes(node[nodeKey]),\n )\n\n let outputKeys = [...keys]\n let outputNodes = [...selectedNodes]\n\n if (checkStrictly) {\n return {\n value: outputKeys,\n nodes: outputNodes,\n }\n }\n\n switch (valueType) {\n case 'parent': {\n const allChildKeys: any[] = []\n for (const node of selectedNodes) {\n allChildKeys.push(...getChildrenKeys(node, nodeKey, propsConfig))\n }\n outputKeys = keys.filter(key => !allChildKeys.includes(key))\n outputNodes = selectedNodes.filter(node =>\n outputKeys.includes(node[nodeKey]),\n )\n break\n }\n\n case 'child': {\n for (const node of selectedNodes) {\n const childKeys = getChildrenKeys(node, nodeKey, propsConfig)\n const hasSelectedChild = childKeys.some(key => keys.includes(key))\n if (hasSelectedChild) {\n outputKeys = outputKeys.filter(key => key !== node[nodeKey])\n outputNodes = outputNodes.filter(n =>\n n[nodeKey] !== node[nodeKey],\n )\n }\n }\n break\n }\n\n case 'path': {\n const selectedPath = getSelectedPath(data, keys, nodeKey, propsConfig)\n return {\n value: selectedPath,\n nodes: selectedPath,\n }\n }\n\n default: { // 'all'\n if (includeHalfChecked && halfCheckedKeys.length > 0) {\n const halfCheckedNodes = flatData.filter(node =>\n halfCheckedKeys.includes(node[nodeKey]),\n )\n outputKeys = [...outputKeys, ...halfCheckedKeys]\n outputNodes = [...outputNodes, ...halfCheckedNodes]\n }\n break\n }\n }\n\n return {\n value: outputKeys,\n nodes: outputNodes,\n }\n}\n\n/**\n * 根据valueType将输入值转换为checkedKeys\n */\nexport function getInputKeys(\n inputValue: any,\n options: {\n optionAsValue: boolean\n nodeKey: string\n flatData: TreeNodeData[]\n propsConfig: any\n data: TreeNodeData[]\n valueType: string\n checkStrictly: boolean\n },\n): any[] {\n const { optionAsValue, nodeKey, flatData, propsConfig, data, valueType, checkStrictly } = options\n\n /* istanbul ignore if -- @preserve */\n if (!inputValue || !Array.isArray(inputValue))\n return []\n\n const valueArray = optionAsValue ? inputValue.map((item: any) => item[nodeKey]) : inputValue\n\n if (checkStrictly) {\n return valueArray\n }\n\n switch (valueType) {\n case 'parent': {\n const allKeys = [...valueArray]\n\n for (const key of valueArray) {\n const node = flatData.find(n => n[nodeKey] === key)\n if (node) {\n const childKeys = getChildrenKeys(node, nodeKey, propsConfig)\n allKeys.push(...childKeys)\n }\n }\n return filterLeafNodes(allKeys, flatData, nodeKey, propsConfig)\n }\n\n case 'child': {\n const allKeys = [...valueArray]\n for (const key of valueArray) {\n const parentPath = findParents(data, key, nodeKey, propsConfig)\n allKeys.push(...parentPath)\n }\n return filterLeafNodes(allKeys, flatData, nodeKey, propsConfig)\n }\n\n case 'path': {\n return extractKeysFromPath(valueArray, nodeKey, propsConfig)\n }\n\n default: { // 'all'\n return filterLeafNodes(valueArray, flatData, nodeKey, propsConfig)\n }\n }\n}\n"],"names":["flattenTree","nodes","result","childrenKey","node","addDisabledToNodes","disabled","propsConfig","newNode","traverseTree","callback","options","leafOnly","children","isLeaf","getChildrenKeys","nodeKey","keys","child","extractKeysFromPath","pathNodes","getSelectedPath","selectedKeys","hasSelectedChild","findParents","targetKey","parents","currentPath","found","filterLeafNodes","flatData","key","n","getOutputData","halfCheckedKeys","data","valueType","includeHalfChecked","checkStrictly","selectedNodes","outputKeys","outputNodes","allChildKeys","selectedPath","halfCheckedNodes","getInputKeys","inputValue","optionAsValue","valueArray","item","allKeys","childKeys","parentPath"],"mappings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AS;AAAA,QAC3B;AAAA,MACF;AACA,aAAOtB,EAAgBqB,GAASpB,GAAUd,GAAST,CAAW;AAAA,IAChE;AAAA,IAEA,KAAK,SAAS;AACZ,YAAM2C,IAAU,CAAC,GAAGF,CAAU;AAC9B,iBAAWjB,KAAOiB,GAAY;AAC5B,cAAMI,IAAa5B,EAAYW,GAAMJ,GAAKf,GAAST,CAAW;AAC9D,QAAA2C,EAAQ,KAAK,GAAGE,CAAU;AAAA,MAC5B;AACA,aAAOvB,EAAgBqB,GAASpB,GAAUd,GAAST,CAAW;AAAA,IAChE;AAAA,IAEA,KAAK;AACH,aAAOY,EAAoB6B,GAAYhC,GAAST,CAAW;AAAA,IAG7D;AACE,aAAOsB,EAAgBmB,GAAYlB,GAAUd,GAAST,CAAW;AAAA,EACnE;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../src/tree/utils.ts"],"sourcesContent":["import type { TreeNodeData } from 'element-plus'\r\n\r\nexport function flattenTree(nodes: TreeNodeData[], result: TreeNodeData[] = [], childrenKey = 'children'): TreeNodeData[] {\r\n for (const node of nodes) {\r\n result.push(node)\r\n if (node[childrenKey] && node[childrenKey].length > 0) {\r\n flattenTree(node[childrenKey], result, childrenKey)\r\n }\r\n }\r\n return result\r\n}\r\n\r\nexport function addDisabledToNodes(nodes: TreeNodeData[], disabled: boolean, propsConfig: any): TreeNodeData[] {\r\n if (!disabled) {\r\n return nodes\r\n }\r\n\r\n return nodes.map((node) => {\r\n const newNode = { ...node }\r\n newNode[propsConfig.disabled!] = true\r\n\r\n if (node[propsConfig.children!] && node[propsConfig.children!].length > 0) {\r\n newNode[propsConfig.children!] = addDisabledToNodes(node[propsConfig.children!], disabled, propsConfig)\r\n }\r\n\r\n return newNode\r\n })\r\n}\r\n\r\nexport function traverseTree(\r\n nodes: TreeNodeData[],\r\n callback: (node: TreeNodeData) => void,\r\n options: {\r\n leafOnly?: boolean\r\n childrenKey?: string\r\n } = {},\r\n) {\r\n const { leafOnly = false, childrenKey = 'children' } = options\r\n\r\n for (const node of nodes) {\r\n const children = node[childrenKey] || []\r\n const isLeaf = children.length === 0\r\n\r\n if (!leafOnly || isLeaf) {\r\n callback(node)\r\n }\r\n if (children.length > 0) {\r\n traverseTree(children, callback, options)\r\n }\r\n }\r\n}\r\n\r\nexport function getChildrenKeys(node: TreeNodeData, nodeKey: string, propsConfig: any): any[] {\r\n const children = node[propsConfig.children!] || []\r\n if (children.length === 0)\r\n return []\r\n\r\n const keys: any[] = []\r\n traverseTree(children, (child) => {\r\n keys.push(child[nodeKey])\r\n }, { childrenKey: propsConfig.children })\r\n\r\n return keys\r\n}\r\n\r\nexport function extractKeysFromPath(pathNodes: TreeNodeData[], nodeKey: string, propsConfig: any): any[] {\r\n const keys: any[] = []\r\n traverseTree(pathNodes, (node) => {\r\n keys.push(node[nodeKey])\r\n }, { leafOnly: true, childrenKey: propsConfig.children })\r\n\r\n return keys\r\n}\r\n\r\nexport function getSelectedPath(nodes: TreeNodeData[], selectedKeys: any[], nodeKey: string, propsConfig: any): TreeNodeData[] {\r\n const result: TreeNodeData[] = []\r\n\r\n for (const node of nodes) {\r\n const children = node[propsConfig.children!] || []\r\n const hasSelectedChild = children.length > 0\r\n ? getSelectedPath(children, selectedKeys, nodeKey, propsConfig).length > 0\r\n : false\r\n\r\n if (selectedKeys.includes(node[nodeKey]) || hasSelectedChild) {\r\n const newNode = { ...node }\r\n if (hasSelectedChild && children.length > 0) {\r\n newNode[propsConfig.children!] = getSelectedPath(children, selectedKeys, nodeKey, propsConfig)\r\n }\r\n result.push(newNode)\r\n }\r\n }\r\n\r\n return result\r\n}\r\n\r\n/**\r\n * 查找节点的所有父节点路径\r\n */\r\nexport function findParents(nodes: TreeNodeData[], targetKey: any, nodeKey: string, propsConfig: any, parents: any[] = []): any[] {\r\n for (const node of nodes) {\r\n const currentPath = [...parents, node[nodeKey]]\r\n\r\n if (node[nodeKey] === targetKey) {\r\n return currentPath\r\n }\r\n\r\n const children = node[propsConfig.children!] || []\r\n if (children.length > 0) {\r\n const found = findParents(children, targetKey, nodeKey, propsConfig, currentPath)\r\n if (found.length > 0) {\r\n return found\r\n }\r\n }\r\n }\r\n /* istanbul ignore next -- @preserve */\r\n return []\r\n}\r\n\r\n/**\r\n * 过滤叶子节点\r\n */\r\nexport function filterLeafNodes(keys: any[], flatData: TreeNodeData[], nodeKey: string, propsConfig: any): any[] {\r\n return keys.filter((key) => {\r\n const node = flatData.find(n => n[nodeKey] === key)\r\n if (!node)\r\n return false\r\n const children = node[propsConfig.children!] || []\r\n return children.length === 0\r\n })\r\n}\r\n\r\n/**\r\n * 获取输出数据\r\n */\r\nexport function getOutputData(\r\n keys: any[],\r\n halfCheckedKeys: any[] = [],\r\n options: {\r\n flatData: TreeNodeData[]\r\n nodeKey: string\r\n propsConfig: any\r\n data: TreeNodeData[]\r\n valueType: string\r\n includeHalfChecked: boolean\r\n checkStrictly: boolean\r\n },\r\n) {\r\n const { flatData, nodeKey, propsConfig, data, valueType, includeHalfChecked, checkStrictly } = options\r\n\r\n const selectedNodes = flatData.filter(node =>\r\n keys.includes(node[nodeKey]),\r\n )\r\n\r\n let outputKeys = [...keys]\r\n let outputNodes = [...selectedNodes]\r\n\r\n if (checkStrictly) {\r\n return {\r\n value: outputKeys,\r\n nodes: outputNodes,\r\n }\r\n }\r\n\r\n switch (valueType) {\r\n case 'parent': {\r\n const allChildKeys: any[] = []\r\n for (const node of selectedNodes) {\r\n allChildKeys.push(...getChildrenKeys(node, nodeKey, propsConfig))\r\n }\r\n outputKeys = keys.filter(key => !allChildKeys.includes(key))\r\n outputNodes = selectedNodes.filter(node =>\r\n outputKeys.includes(node[nodeKey]),\r\n )\r\n break\r\n }\r\n\r\n case 'child': {\r\n for (const node of selectedNodes) {\r\n const childKeys = getChildrenKeys(node, nodeKey, propsConfig)\r\n const hasSelectedChild = childKeys.some(key => keys.includes(key))\r\n if (hasSelectedChild) {\r\n outputKeys = outputKeys.filter(key => key !== node[nodeKey])\r\n outputNodes = outputNodes.filter(n =>\r\n n[nodeKey] !== node[nodeKey],\r\n )\r\n }\r\n }\r\n break\r\n }\r\n\r\n case 'path': {\r\n const selectedPath = getSelectedPath(data, keys, nodeKey, propsConfig)\r\n return {\r\n value: selectedPath,\r\n nodes: selectedPath,\r\n }\r\n }\r\n\r\n default: { // 'all'\r\n if (includeHalfChecked && halfCheckedKeys.length > 0) {\r\n const halfCheckedNodes = flatData.filter(node =>\r\n halfCheckedKeys.includes(node[nodeKey]),\r\n )\r\n outputKeys = [...outputKeys, ...halfCheckedKeys]\r\n outputNodes = [...outputNodes, ...halfCheckedNodes]\r\n }\r\n break\r\n }\r\n }\r\n\r\n return {\r\n value: outputKeys,\r\n nodes: outputNodes,\r\n }\r\n}\r\n\r\n/**\r\n * 根据valueType将输入值转换为checkedKeys\r\n */\r\nexport function getInputKeys(\r\n inputValue: any,\r\n options: {\r\n optionAsValue: boolean\r\n nodeKey: string\r\n flatData: TreeNodeData[]\r\n propsConfig: any\r\n data: TreeNodeData[]\r\n valueType: string\r\n checkStrictly: boolean\r\n },\r\n): any[] {\r\n const { optionAsValue, nodeKey, flatData, propsConfig, data, valueType, checkStrictly } = options\r\n\r\n /* istanbul ignore if -- @preserve */\r\n if (!inputValue || !Array.isArray(inputValue))\r\n return []\r\n\r\n const valueArray = optionAsValue ? inputValue.map((item: any) => item[nodeKey]) : inputValue\r\n\r\n if (checkStrictly) {\r\n return valueArray\r\n }\r\n\r\n switch (valueType) {\r\n case 'parent': {\r\n const allKeys = [...valueArray]\r\n\r\n for (const key of valueArray) {\r\n const node = flatData.find(n => n[nodeKey] === key)\r\n if (node) {\r\n const childKeys = getChildrenKeys(node, nodeKey, propsConfig)\r\n allKeys.push(...childKeys)\r\n }\r\n }\r\n return filterLeafNodes(allKeys, flatData, nodeKey, propsConfig)\r\n }\r\n\r\n case 'child': {\r\n const allKeys = [...valueArray]\r\n for (const key of valueArray) {\r\n const parentPath = findParents(data, key, nodeKey, propsConfig)\r\n allKeys.push(...parentPath)\r\n }\r\n return filterLeafNodes(allKeys, flatData, nodeKey, propsConfig)\r\n }\r\n\r\n case 'path': {\r\n return extractKeysFromPath(valueArray, nodeKey, propsConfig)\r\n }\r\n\r\n default: { // 'all'\r\n return filterLeafNodes(valueArray, flatData, nodeKey, propsConfig)\r\n }\r\n }\r\n}\r\n"],"names":["flattenTree","nodes","result","childrenKey","node","addDisabledToNodes","disabled","propsConfig","newNode","traverseTree","callback","options","leafOnly","children","isLeaf","getChildrenKeys","nodeKey","keys","child","extractKeysFromPath","pathNodes","getSelectedPath","selectedKeys","hasSelectedChild","findParents","targetKey","parents","currentPath","found","filterLeafNodes","flatData","key","n","getOutputData","halfCheckedKeys","data","valueType","includeHalfChecked","checkStrictly","selectedNodes","outputKeys","outputNodes","allChildKeys","selectedPath","halfCheckedNodes","getInputKeys","inputValue","optionAsValue","valueArray","item","allKeys","childKeys","parentPath"],"mappings":"AAEO,SAASA,EAAYC,GAAuBC,IAAyB,CAAA,GAAIC,IAAc,YAA4B;AACxH,aAAWC,KAAQH;AACjB,IAAAC,EAAO,KAAKE,CAAI,GACZA,EAAKD,CAAW,KAAKC,EAAKD,CAAW,EAAE,SAAS,KAClDH,EAAYI,EAAKD,CAAW,GAAGD,GAAQC,CAAW;AAGtD,SAAOD;AACT;AAEO,SAASG,EAAmBJ,GAAuBK,GAAmBC,GAAkC;AAC7G,SAAKD,IAIEL,EAAM,IAAI,CAACG,MAAS;AACzB,UAAMI,IAAU,EAAE,GAAGJ,EAAA;AACrB,WAAAI,EAAQD,EAAY,QAAS,IAAI,IAE7BH,EAAKG,EAAY,QAAS,KAAKH,EAAKG,EAAY,QAAS,EAAE,SAAS,MACtEC,EAAQD,EAAY,QAAS,IAAIF,EAAmBD,EAAKG,EAAY,QAAS,GAAGD,GAAUC,CAAW,IAGjGC;AAAA,EACT,CAAC,IAZQP;AAaX;AAEO,SAASQ,EACdR,GACAS,GACAC,IAGI,CAAA,GACJ;AACA,QAAM,EAAE,UAAAC,I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