@silver-formily/element-plus 4.0.1 → 4.0.3
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/esm/__builtins__/shared/utils.mjs +4 -1
- package/esm/__builtins__/shared/utils.mjs.map +1 -1
- package/esm/checkbox/index.d.ts +90 -90
- package/esm/color-picker/index.d.ts +14 -14
- package/esm/color-picker-panel/index.d.ts +12 -12
- package/esm/form-dialog/dialog-content.mjs +10 -12
- package/esm/form-dialog/dialog-content.mjs.map +1 -1
- package/esm/form-dialog/index.mjs +22 -26
- package/esm/form-dialog/index.mjs.map +1 -1
- package/esm/form-dialog/types.d.ts +0 -1
- package/esm/form-drawer/drawer-content.mjs +10 -12
- package/esm/form-drawer/drawer-content.mjs.map +1 -1
- package/esm/form-drawer/index.mjs +22 -26
- package/esm/form-drawer/index.mjs.map +1 -1
- package/esm/form-drawer/types.d.ts +0 -1
- package/esm/form-grid/form-grid-column.mjs +6 -4
- package/esm/form-grid/form-grid-column.mjs.map +1 -1
- package/esm/form-layout/form-layout.vue.d.ts +1 -1
- package/esm/input-number/index.d.ts +24 -24
- package/esm/preview-text/select.mjs +8 -3
- package/esm/preview-text/select.mjs.map +1 -1
- package/esm/query-form/query-form-light.mjs +13 -6
- package/esm/query-form/query-form-light.mjs.map +1 -1
- package/esm/query-form/query-form.mjs +13 -6
- package/esm/query-form/query-form.mjs.map +1 -1
- package/esm/query-form/types.d.ts +8 -1
- package/esm/radio/index.d.ts +45 -45
- package/esm/radio/radio-group.mjs +4 -2
- package/esm/radio/radio-group.mjs.map +1 -1
- package/esm/select/index.d.ts +7 -7
- package/esm/select-table/index.d.ts +1 -1
- package/esm/select-table/select-table.mjs +63 -29
- package/esm/select-table/select-table.mjs.map +1 -1
- package/esm/select-table/types.d.ts +1 -1
- package/esm/time-select/index.d.ts +16 -16
- package/esm/transfer/index.d.ts +12 -12
- package/package.json +4 -4
- package/esm/shared/url-change-listener.mjs +0 -50
- package/esm/shared/url-change-listener.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-table.mjs","names":[],"sources":["../../src/select-table/select-table.vue"],"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 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 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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBA,MAAM,QAAQ;EAYd,MAAM,OAAO;EAEb,MAAM,eAAe,UAAS;EAC9B,MAAM,QAAQ,UAAS;EAEvB,SAAS,qBAAqB,KAAa;AACzC,UAAO,GAAG,SAAS,QAAQ,GAAG,EAAE,OAAO,KAAK,GAAG,EAAE,OAAO,KAAI;;EAG9D,MAAM,aAAa,KAAmB;EACtC,MAAM,SAAS,MAAM;EACrB,SAAS,yBAAyB;AAChC,OAAI,MAAM,SAAS,WACjB,QAAO,MAAM,YAAY,KAAK,SAAS;AACrC,QAAI,CAAC,MAAM,cACT,QAAO,GACJ,SAAS,MACZ;AAEF,WAAO;KACP,IAAI,EAAC;OAGP,QAAO,MAAM,gBAAgB,CAAC,MAAM,WAAW,GAAG,CAAC,GAAG,SAAS,MAAM,YAAY,CAAA;;EAIrF,MAAM,yBAAyB,IADH,wBAAuB,CACG;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AA,SAAA,QAAoB;;6BAMjD,CALV,YAKU,MAAA,QAAA,EALV,WACU,qBAAqB,IAAI,MAAA,OAAM,EAAA,EAAA,EACtC,gBAAc,aAAa,IAAG,EAAA,CAAA,EAAA;8BAGjC,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAFC,UAED,GAAA,CAAA,EAAA,CAAA;;;;;;SAIU,MAAM,QAAQ,WAAM,IAClC,WAAQ,KAAA,QAAA,WAAA,EAAA,KAAA,GAAA,CAAA,IAAA,UAAA,KAAA,EAGR,mBAIE,UAAA,EAAA,KAAA,GAAA,EAAA,WAHkB,MAAM,UAAjB,YAAO;yBADhB,YAIE,MAAA,cAAA,EAJF,WAIE,EAAA,SAAA,MAAA,EAFQ,SAAO,EACd,KAAK,QAAQ,QAAQ,QAAQ,MAAA,CAAA,EAAA,MAAA,GAAA;;;;;;;;2BArCvB,MAAM,QAAO,CAAA,CAAA,CAAA,EAAA,EAAA"}
|
|
1
|
+
{"version":3,"file":"select-table.mjs","names":[],"sources":["../../src/select-table/select-table.vue"],"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()\nconst elTableRef = ref<TableInstance>()\nconst radioSelectedKey = ref()\n\nfunction requireRowKey() {\n if (!props.rowKey) {\n throw new Error('rowKey is required')\n }\n return props.rowKey\n}\n\nfunction getRowValue(item?: Record<string, any> | null) {\n if (!props.rowKey || !item) {\n return undefined\n }\n return item[props.rowKey]\n}\n\nfunction getSingleSelectedKey(value: any) {\n if (!isValid(value)) {\n return null\n }\n return props.optionAsValue ? getRowValue(value) ?? null : value\n}\n\nfunction getMultipleSelectedKeys(value: any) {\n if (!Array.isArray(value)) {\n return []\n }\n return value\n .map(item => props.optionAsValue ? getRowValue(item) : item)\n .filter(isValid)\n}\n\nfunction syncRadioSelection(item?: Record<string, any> | null) {\n radioSelectedKey.value = getRowValue(item) ?? null\n elTableRef.value?.setCurrentRow(item)\n}\n\nfunction compatibleRadioValue(key: string) {\n return lt(version, '2.6.0') ? { label: key } : { value: key }\n}\n\nfunction getInitialSelectedList() {\n if (!isValid(props.modelValue)) {\n return []\n }\n\n if (props.mode === 'multiple') {\n if (!Array.isArray(props.modelValue)) {\n return []\n }\n\n return props.modelValue.map((item) => {\n if (!props.optionAsValue) {\n if (!props.rowKey) {\n return null\n }\n return {\n [props.rowKey]: item,\n }\n }\n return item\n }).filter(isValid)\n }\n else {\n if (props.optionAsValue) {\n return [props.modelValue]\n }\n if (!props.rowKey) {\n return []\n }\n return [{ [props.rowKey]: props.modelValue }]\n }\n}\nconst initialSelectedList = getInitialSelectedList()\nconst selectedFlatDataSource = ref(initialSelectedList)\n// 为了获取移除的项而缓存的当前页面的前一次选择。由于element-plus没有获取移除项的方法,需要通过这种方式移除field中移除的项\nlet prevSelection = []\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 => getRowValue(item)).filter(isValid),\n )\n await nextTick()\n for (const item of props.dataSource) {\n const itemKey = getRowValue(item)\n if (isValid(itemKey) && selectedKeys.includes(itemKey)) {\n if (props.mode === 'multiple') {\n elTableRef.value?.toggleRowSelection(item, true, props.ignoreSelectable)\n }\n else {\n syncRadioSelection(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 const selectedKey = getSingleSelectedKey(value)\n radioSelectedKey.value = selectedKey\n const selectedItem = props.dataSource.find(item => getRowValue(item) === selectedKey)\n elTableRef.value?.setCurrentRow(selectedItem)\n }\n else {\n await nextTick()\n const currentDisplayDataKeys = elTableRef.value\n ?.getSelectionRows()\n .map(item => getRowValue(item))\n .filter(isValid) ?? []\n const valueKeys = getMultipleSelectedKeys(value)\n selectedFlatDataSource.value = selectedFlatDataSource.value.filter(\n item => valueKeys.includes(getRowValue(item)),\n )\n if (isEqual(valueKeys, currentDisplayDataKeys)) {\n return\n }\n const diffItems = xor(valueKeys, currentDisplayDataKeys)\n for (const tableItem of props.dataSource) {\n const itemKey = getRowValue(tableItem)\n if (isValid(itemKey) && diffItems.includes(itemKey)) {\n const shouldSelect = valueKeys.includes(itemKey)\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 const rowKey = requireRowKey()\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 const rowKey = requireRowKey()\n syncRadioSelection(item)\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 syncRadioSelection(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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBA,MAAM,QAAQ;EAYd,MAAM,OAAO;EAEb,MAAM,eAAe,UAAS;EAC9B,MAAM,QAAQ,UAAS;EACvB,MAAM,aAAa,KAAmB;EACtC,MAAM,mBAAmB,KAAI;EAE7B,SAAS,gBAAgB;AACvB,OAAI,CAAC,MAAM,OACT,OAAM,IAAI,MAAM,qBAAoB;AAEtC,UAAO,MAAM;;EAGf,SAAS,YAAY,MAAmC;AACtD,OAAI,CAAC,MAAM,UAAU,CAAC,KACpB;AAEF,UAAO,KAAK,MAAM;;EAGpB,SAAS,qBAAqB,OAAY;AACxC,OAAI,CAAC,QAAQ,MAAM,CACjB,QAAO;AAET,UAAO,MAAM,gBAAgB,YAAY,MAAM,IAAI,OAAO;;EAG5D,SAAS,wBAAwB,OAAY;AAC3C,OAAI,CAAC,MAAM,QAAQ,MAAM,CACvB,QAAO,EAAC;AAEV,UAAO,MACJ,KAAI,SAAQ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AA,WAAA,EAAA,KAAA,GAAA,CAAA,IAAA,UAAA,KAAA,EAGR,mBAIE,UAAA,EAAA,KAAA,GAAA,EAAA,WAHkB,MAAM,UAAjB,YAAO;yBADhB,YAIE,MAAA,cAAA,EAJF,WAIE,EAAA,SAAA,MAAA,EAFQ,SAAO,EACd,KAAK,QAAQ,QAAQ,QAAQ,MAAA,CAAA,EAAA,MAAA,GAAA;;;;;;;;2BArCvB,MAAM,QAAO,CAAA,CAAA,CAAA,EAAA,EAAA"}
|
|
@@ -14,6 +14,14 @@ declare const TimeSelect: _$element_plus_es_utils_index_mjs0.SFCWithInstall<_$vu
|
|
|
14
14
|
type: _$vue.PropType<boolean>;
|
|
15
15
|
default: undefined;
|
|
16
16
|
};
|
|
17
|
+
popperClass: {
|
|
18
|
+
type: _$vue.PropType<string>;
|
|
19
|
+
default: string;
|
|
20
|
+
};
|
|
21
|
+
popperStyle: {
|
|
22
|
+
type: _$vue.PropType<string | _$vue.CSSProperties>;
|
|
23
|
+
default: undefined;
|
|
24
|
+
};
|
|
17
25
|
size: {
|
|
18
26
|
type: _$vue.PropType<"" | "default" | "small" | "large">;
|
|
19
27
|
};
|
|
@@ -24,14 +32,6 @@ declare const TimeSelect: _$element_plus_es_utils_index_mjs0.SFCWithInstall<_$vu
|
|
|
24
32
|
placeholder: {
|
|
25
33
|
type: _$vue.PropType<string>;
|
|
26
34
|
};
|
|
27
|
-
popperClass: {
|
|
28
|
-
type: _$vue.PropType<string>;
|
|
29
|
-
default: string;
|
|
30
|
-
};
|
|
31
|
-
popperStyle: {
|
|
32
|
-
type: _$vue.PropType<string | _$vue.CSSProperties>;
|
|
33
|
-
default: undefined;
|
|
34
|
-
};
|
|
35
35
|
clearable: {
|
|
36
36
|
type: _$vue.PropType<boolean>;
|
|
37
37
|
default: boolean;
|
|
@@ -100,6 +100,14 @@ declare const TimeSelect: _$element_plus_es_utils_index_mjs0.SFCWithInstall<_$vu
|
|
|
100
100
|
type: _$vue.PropType<boolean>;
|
|
101
101
|
default: undefined;
|
|
102
102
|
};
|
|
103
|
+
popperClass: {
|
|
104
|
+
type: _$vue.PropType<string>;
|
|
105
|
+
default: string;
|
|
106
|
+
};
|
|
107
|
+
popperStyle: {
|
|
108
|
+
type: _$vue.PropType<string | _$vue.CSSProperties>;
|
|
109
|
+
default: undefined;
|
|
110
|
+
};
|
|
103
111
|
size: {
|
|
104
112
|
type: _$vue.PropType<"" | "default" | "small" | "large">;
|
|
105
113
|
};
|
|
@@ -110,14 +118,6 @@ declare const TimeSelect: _$element_plus_es_utils_index_mjs0.SFCWithInstall<_$vu
|
|
|
110
118
|
placeholder: {
|
|
111
119
|
type: _$vue.PropType<string>;
|
|
112
120
|
};
|
|
113
|
-
popperClass: {
|
|
114
|
-
type: _$vue.PropType<string>;
|
|
115
|
-
default: string;
|
|
116
|
-
};
|
|
117
|
-
popperStyle: {
|
|
118
|
-
type: _$vue.PropType<string | _$vue.CSSProperties>;
|
|
119
|
-
default: undefined;
|
|
120
|
-
};
|
|
121
121
|
clearable: {
|
|
122
122
|
type: _$vue.PropType<boolean>;
|
|
123
123
|
default: boolean;
|
package/esm/transfer/index.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ import * as _$element_plus_es_components_transfer_src_transfer_panel_mjs0 from "
|
|
|
8
8
|
type TransferProps = typeof ElTransfer;
|
|
9
9
|
declare const Transfer: _$element_plus_es_utils_index_mjs0.SFCWithInstall<{
|
|
10
10
|
new (...args: any[]): _$vue.CreateComponentPublicInstanceWithMixins<Readonly<_$vue.ExtractPropTypes<{
|
|
11
|
+
modelValue: {
|
|
12
|
+
type: _$vue.PropType<_$element_plus0.TransferKey[]>;
|
|
13
|
+
default: () => never[];
|
|
14
|
+
};
|
|
11
15
|
props: {
|
|
12
16
|
type: _$vue.PropType<_$element_plus0.TransferPropsAlias>;
|
|
13
17
|
default: () => {
|
|
@@ -16,10 +20,6 @@ declare const Transfer: _$element_plus_es_utils_index_mjs0.SFCWithInstall<{
|
|
|
16
20
|
disabled: string;
|
|
17
21
|
};
|
|
18
22
|
};
|
|
19
|
-
modelValue: {
|
|
20
|
-
type: _$vue.PropType<_$element_plus0.TransferKey[]>;
|
|
21
|
-
default: () => never[];
|
|
22
|
-
};
|
|
23
23
|
data: {
|
|
24
24
|
type: _$vue.PropType<_$element_plus0.TransferDataItem[]>;
|
|
25
25
|
default: () => never[];
|
|
@@ -97,6 +97,10 @@ declare const Transfer: _$element_plus_es_utils_index_mjs0.SFCWithInstall<{
|
|
|
97
97
|
M: {};
|
|
98
98
|
Defaults: {};
|
|
99
99
|
}, Readonly<_$vue.ExtractPropTypes<{
|
|
100
|
+
modelValue: {
|
|
101
|
+
type: _$vue.PropType<_$element_plus0.TransferKey[]>;
|
|
102
|
+
default: () => never[];
|
|
103
|
+
};
|
|
100
104
|
props: {
|
|
101
105
|
type: _$vue.PropType<_$element_plus0.TransferPropsAlias>;
|
|
102
106
|
default: () => {
|
|
@@ -105,10 +109,6 @@ declare const Transfer: _$element_plus_es_utils_index_mjs0.SFCWithInstall<{
|
|
|
105
109
|
disabled: string;
|
|
106
110
|
};
|
|
107
111
|
};
|
|
108
|
-
modelValue: {
|
|
109
|
-
type: _$vue.PropType<_$element_plus0.TransferKey[]>;
|
|
110
|
-
default: () => never[];
|
|
111
|
-
};
|
|
112
112
|
data: {
|
|
113
113
|
type: _$vue.PropType<_$element_plus0.TransferDataItem[]>;
|
|
114
114
|
default: () => never[];
|
|
@@ -178,6 +178,10 @@ declare const Transfer: _$element_plus_es_utils_index_mjs0.SFCWithInstall<{
|
|
|
178
178
|
__isTeleport?: never;
|
|
179
179
|
__isSuspense?: never;
|
|
180
180
|
} & _$vue.ComponentOptionsBase<Readonly<_$vue.ExtractPropTypes<{
|
|
181
|
+
modelValue: {
|
|
182
|
+
type: _$vue.PropType<_$element_plus0.TransferKey[]>;
|
|
183
|
+
default: () => never[];
|
|
184
|
+
};
|
|
181
185
|
props: {
|
|
182
186
|
type: _$vue.PropType<_$element_plus0.TransferPropsAlias>;
|
|
183
187
|
default: () => {
|
|
@@ -186,10 +190,6 @@ declare const Transfer: _$element_plus_es_utils_index_mjs0.SFCWithInstall<{
|
|
|
186
190
|
disabled: string;
|
|
187
191
|
};
|
|
188
192
|
};
|
|
189
|
-
modelValue: {
|
|
190
|
-
type: _$vue.PropType<_$element_plus0.TransferKey[]>;
|
|
191
|
-
default: () => never[];
|
|
192
|
-
};
|
|
193
193
|
data: {
|
|
194
194
|
type: _$vue.PropType<_$element_plus0.TransferDataItem[]>;
|
|
195
195
|
default: () => never[];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silver-formily/element-plus",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.3",
|
|
5
5
|
"description": "Formily 的 Element Plus 封装",
|
|
6
6
|
"author": "hezhengxu",
|
|
7
7
|
"license": "MIT",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@element-plus/icons-vue": "^2.3.2",
|
|
52
52
|
"lodash-es": "^4.17.23",
|
|
53
|
-
"vue-draggable-plus": "^0.5.
|
|
53
|
+
"vue-draggable-plus": "^0.5.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@tsdown/css": "^0.21.8",
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
"vue": "^3.5.27",
|
|
73
73
|
"vue-tsc": "^3.2.6",
|
|
74
74
|
"@silver-formily/grid": "1.0.2",
|
|
75
|
+
"@silver-formily/reactive-vue": "1.1.1",
|
|
75
76
|
"@silver-formily/typescript-config": "0.0.0",
|
|
76
|
-
"@silver-formily/vue": "2.3.4"
|
|
77
|
-
"@silver-formily/reactive-vue": "1.1.1"
|
|
77
|
+
"@silver-formily/vue": "2.3.4"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
80
|
"build": "tsdown --tsconfig tsconfig.build.json",
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
//#region src/shared/url-change-listener.ts
|
|
2
|
-
const URL_CHANGE_EVENT = "silver-formily:url-change";
|
|
3
|
-
let subscriberCount = 0;
|
|
4
|
-
let teardownGlobalListener;
|
|
5
|
-
function dispatchUrlChange() {
|
|
6
|
-
window.dispatchEvent(new Event(URL_CHANGE_EVENT));
|
|
7
|
-
}
|
|
8
|
-
function patchHistoryMethod(methodName) {
|
|
9
|
-
const originalMethod = window.history[methodName];
|
|
10
|
-
window.history[methodName] = function(...args) {
|
|
11
|
-
const result = originalMethod.apply(this, args);
|
|
12
|
-
dispatchUrlChange();
|
|
13
|
-
return result;
|
|
14
|
-
};
|
|
15
|
-
return () => {
|
|
16
|
-
window.history[methodName] = originalMethod;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function ensureUrlChangeEmitter() {
|
|
20
|
-
if (teardownGlobalListener || typeof window === "undefined") return;
|
|
21
|
-
const onNativeUrlChange = () => {
|
|
22
|
-
dispatchUrlChange();
|
|
23
|
-
};
|
|
24
|
-
const restorePushState = patchHistoryMethod("pushState");
|
|
25
|
-
const restoreReplaceState = patchHistoryMethod("replaceState");
|
|
26
|
-
window.addEventListener("popstate", onNativeUrlChange);
|
|
27
|
-
window.addEventListener("hashchange", onNativeUrlChange);
|
|
28
|
-
teardownGlobalListener = () => {
|
|
29
|
-
restorePushState();
|
|
30
|
-
restoreReplaceState();
|
|
31
|
-
window.removeEventListener("popstate", onNativeUrlChange);
|
|
32
|
-
window.removeEventListener("hashchange", onNativeUrlChange);
|
|
33
|
-
teardownGlobalListener = void 0;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function onUrlChange(listener) {
|
|
37
|
-
if (typeof window === "undefined") return () => {};
|
|
38
|
-
ensureUrlChangeEmitter();
|
|
39
|
-
subscriberCount += 1;
|
|
40
|
-
window.addEventListener(URL_CHANGE_EVENT, listener);
|
|
41
|
-
return () => {
|
|
42
|
-
if (subscriberCount > 0) subscriberCount -= 1;
|
|
43
|
-
window.removeEventListener(URL_CHANGE_EVENT, listener);
|
|
44
|
-
if (subscriberCount === 0) teardownGlobalListener?.();
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
//#endregion
|
|
48
|
-
export { onUrlChange };
|
|
49
|
-
|
|
50
|
-
//# sourceMappingURL=url-change-listener.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"url-change-listener.mjs","names":[],"sources":["../../src/shared/url-change-listener.ts"],"sourcesContent":["const URL_CHANGE_EVENT = 'silver-formily:url-change'\n\ntype UrlChangeListener = () => void\ntype HistoryMethodName = 'pushState' | 'replaceState'\n\nlet subscriberCount = 0\nlet teardownGlobalListener: (() => void) | undefined\n\nfunction dispatchUrlChange() {\n window.dispatchEvent(new Event(URL_CHANGE_EVENT))\n}\n\nfunction patchHistoryMethod(methodName: HistoryMethodName) {\n const originalMethod = window.history[methodName]\n\n window.history[methodName] = function (...args) {\n const result = originalMethod.apply(this, args)\n dispatchUrlChange()\n return result\n }\n\n return () => {\n window.history[methodName] = originalMethod\n }\n}\n\nfunction ensureUrlChangeEmitter() {\n if (teardownGlobalListener || typeof window === 'undefined')\n return\n\n const onNativeUrlChange = () => {\n dispatchUrlChange()\n }\n const restorePushState = patchHistoryMethod('pushState')\n const restoreReplaceState = patchHistoryMethod('replaceState')\n\n window.addEventListener('popstate', onNativeUrlChange)\n window.addEventListener('hashchange', onNativeUrlChange)\n\n teardownGlobalListener = () => {\n restorePushState()\n restoreReplaceState()\n window.removeEventListener('popstate', onNativeUrlChange)\n window.removeEventListener('hashchange', onNativeUrlChange)\n teardownGlobalListener = undefined\n }\n}\n\nexport function onUrlChange(listener: UrlChangeListener) {\n if (typeof window === 'undefined') {\n return () => {}\n }\n\n ensureUrlChangeEmitter()\n subscriberCount += 1\n window.addEventListener(URL_CHANGE_EVENT, listener)\n\n return () => {\n if (subscriberCount > 0)\n subscriberCount -= 1\n\n window.removeEventListener(URL_CHANGE_EVENT, listener)\n if (subscriberCount === 0)\n teardownGlobalListener?.()\n }\n}\n"],"mappings":";AAAA,MAAM,mBAAmB;AAKzB,IAAI,kBAAkB;AACtB,IAAI;AAEJ,SAAS,oBAAoB;AAC3B,QAAO,cAAc,IAAI,MAAM,iBAAiB,CAAC;;AAGnD,SAAS,mBAAmB,YAA+B;CACzD,MAAM,iBAAiB,OAAO,QAAQ;AAEtC,QAAO,QAAQ,cAAc,SAAU,GAAG,MAAM;EAC9C,MAAM,SAAS,eAAe,MAAM,MAAM,KAAK;AAC/C,qBAAmB;AACnB,SAAO;;AAGT,cAAa;AACX,SAAO,QAAQ,cAAc;;;AAIjC,SAAS,yBAAyB;AAChC,KAAI,0BAA0B,OAAO,WAAW,YAC9C;CAEF,MAAM,0BAA0B;AAC9B,qBAAmB;;CAErB,MAAM,mBAAmB,mBAAmB,YAAY;CACxD,MAAM,sBAAsB,mBAAmB,eAAe;AAE9D,QAAO,iBAAiB,YAAY,kBAAkB;AACtD,QAAO,iBAAiB,cAAc,kBAAkB;AAExD,gCAA+B;AAC7B,oBAAkB;AAClB,uBAAqB;AACrB,SAAO,oBAAoB,YAAY,kBAAkB;AACzD,SAAO,oBAAoB,cAAc,kBAAkB;AAC3D,2BAAyB,KAAA;;;AAI7B,SAAgB,YAAY,UAA6B;AACvD,KAAI,OAAO,WAAW,YACpB,cAAa;AAGf,yBAAwB;AACxB,oBAAmB;AACnB,QAAO,iBAAiB,kBAAkB,SAAS;AAEnD,cAAa;AACX,MAAI,kBAAkB,EACpB,oBAAmB;AAErB,SAAO,oBAAoB,kBAAkB,SAAS;AACtD,MAAI,oBAAoB,EACtB,2BAA0B"}
|