@silver-formily/element-plus 2.0.0 → 2.1.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.
Files changed (165) hide show
  1. package/README.en-US.md +32 -0
  2. package/README.md +18 -21
  3. package/esm/__builtins__/index.mjs +15 -16
  4. package/esm/__builtins__/shared/index.mjs +11 -12
  5. package/esm/__builtins__/shared/transform-component.d.ts +2 -7
  6. package/esm/__builtins__/shared/transform-component.mjs +16 -33
  7. package/esm/__builtins__/shared/transform-component.mjs.map +1 -1
  8. package/esm/__builtins__/shared/utils.mjs +11 -11
  9. package/esm/__builtins__/shared/utils.mjs.map +1 -1
  10. package/esm/array-base/index.mjs +62 -62
  11. package/esm/array-base/index.mjs.map +1 -1
  12. package/esm/array-base/utils.mjs +2 -2
  13. package/esm/array-cards/array-cards.d.ts +1 -1
  14. package/esm/array-cards/index.d.ts +3 -3
  15. package/esm/array-cards/index.mjs +49 -49
  16. package/esm/array-cards/index.mjs.map +1 -1
  17. package/esm/array-collapse/array-collapse.d.ts +2 -2
  18. package/esm/array-collapse/index.d.ts +3 -3
  19. package/esm/array-collapse/index.mjs +85 -84
  20. package/esm/array-collapse/index.mjs.map +1 -1
  21. package/esm/array-collapse/utils.mjs +2 -2
  22. package/esm/array-items/index.mjs +43 -40
  23. package/esm/array-items/index.mjs.map +1 -1
  24. package/esm/array-list-tabs/array-list-tabs.d.ts +3 -3
  25. package/esm/array-list-tabs/index.d.ts +6 -6
  26. package/esm/array-list-tabs/index.mjs +93 -89
  27. package/esm/array-list-tabs/index.mjs.map +1 -1
  28. package/esm/array-list-tabs/utils.mjs +2 -2
  29. package/esm/array-table/array-table.d.ts +29 -1
  30. package/esm/array-table/index.d.ts +31 -3
  31. package/esm/array-table/index.mjs +126 -125
  32. package/esm/array-table/index.mjs.map +1 -1
  33. package/esm/array-table/types.d.ts +2 -1
  34. package/esm/array-table/utils.mjs +2 -2
  35. package/esm/array-tabs/index.mjs +17 -17
  36. package/esm/array-tabs/index.mjs.map +1 -1
  37. package/esm/cascader/cascader.d.ts +1 -6
  38. package/esm/cascader/index.d.ts +3 -16
  39. package/esm/cascader/index.mjs +29 -33
  40. package/esm/cascader/index.mjs.map +1 -1
  41. package/esm/checkbox/checkbox-group.d.ts +3 -19
  42. package/esm/checkbox/index.d.ts +445 -407
  43. package/esm/checkbox/index.mjs +27 -36
  44. package/esm/checkbox/index.mjs.map +1 -1
  45. package/esm/date-picker/index.d.ts +442 -1
  46. package/esm/date-picker/index.mjs +12 -19
  47. package/esm/date-picker/index.mjs.map +1 -1
  48. package/esm/editable/editable.d.ts +16 -12
  49. package/esm/editable/index.d.ts +8 -6
  50. package/esm/editable/index.mjs +108 -110
  51. package/esm/editable/index.mjs.map +1 -1
  52. package/esm/form/form.mjs +1 -1
  53. package/esm/form/form.mjs.map +1 -1
  54. package/esm/form-button-group/index.mjs +31 -30
  55. package/esm/form-button-group/index.mjs.map +1 -1
  56. package/esm/form-button-group/utils.mjs +2 -2
  57. package/esm/form-collapse/index.mjs +40 -40
  58. package/esm/form-collapse/index.mjs.map +1 -1
  59. package/esm/form-dialog/index.d.ts +1 -1
  60. package/esm/form-dialog/index.mjs +5 -5
  61. package/esm/form-dialog/index.mjs.map +1 -1
  62. package/esm/form-dialog/types.d.ts +6 -6
  63. package/esm/form-drawer/index.d.ts +1 -1
  64. package/esm/form-drawer/index.mjs +5 -5
  65. package/esm/form-drawer/index.mjs.map +1 -1
  66. package/esm/form-drawer/types.d.ts +6 -6
  67. package/esm/form-grid/index.d.ts +1 -183
  68. package/esm/form-grid/index.mjs +2 -2
  69. package/esm/form-grid/index.mjs.map +1 -1
  70. package/esm/form-item/form-item.d.ts +2 -1
  71. package/esm/form-item/index.d.ts +12 -6
  72. package/esm/form-item/index.mjs +156 -152
  73. package/esm/form-item/index.mjs.map +1 -1
  74. package/esm/form-item/types.d.ts +0 -1
  75. package/esm/form-layout/form-layout.d.ts +0 -1
  76. package/esm/form-layout/form-layout.mjs +55 -53
  77. package/esm/form-layout/form-layout.mjs.map +1 -1
  78. package/esm/form-layout/types.d.ts +0 -2
  79. package/esm/form-layout/utils.d.ts +3 -3
  80. package/esm/form-layout/utils.mjs +47 -42
  81. package/esm/form-layout/utils.mjs.map +1 -1
  82. package/esm/form-step/index.mjs +26 -24
  83. package/esm/form-step/index.mjs.map +1 -1
  84. package/esm/form-tab/form-tab.d.ts +2 -2
  85. package/esm/form-tab/hooks.mjs +1 -1
  86. package/esm/form-tab/hooks.mjs.map +1 -1
  87. package/esm/form-tab/index.d.ts +1 -26
  88. package/esm/form-tab/index.mjs +31 -31
  89. package/esm/form-tab/index.mjs.map +1 -1
  90. package/esm/form-tab/types.d.ts +1 -1
  91. package/esm/input/index.d.ts +6 -38
  92. package/esm/input/index.mjs +38 -47
  93. package/esm/input/index.mjs.map +1 -1
  94. package/esm/input/input.d.ts +1 -8
  95. package/esm/input-number/index.d.ts +326 -1
  96. package/esm/input-number/index.mjs +10 -17
  97. package/esm/input-number/index.mjs.map +1 -1
  98. package/esm/pagination/pagination.mjs +110 -111
  99. package/esm/pagination/pagination.mjs.map +1 -1
  100. package/esm/password/index.d.ts +6 -38
  101. package/esm/password/index.mjs +1 -1
  102. package/esm/password/index.mjs.map +1 -1
  103. package/esm/preview-text/cascader.d.ts +1 -1
  104. package/esm/preview-text/date-picker.d.ts +1 -1
  105. package/esm/preview-text/index.d.ts +13 -13
  106. package/esm/preview-text/index.mjs +121 -121
  107. package/esm/preview-text/index.mjs.map +1 -1
  108. package/esm/preview-text/input.d.ts +1 -1
  109. package/esm/preview-text/select.d.ts +1 -1
  110. package/esm/preview-text/time-picker.d.ts +1 -1
  111. package/esm/preview-text/tree.d.ts +1 -1
  112. package/esm/radio/index.d.ts +347 -219
  113. package/esm/radio/index.mjs +37 -44
  114. package/esm/radio/index.mjs.map +1 -1
  115. package/esm/radio/radio-group.d.ts +2 -13
  116. package/esm/reset/index.d.ts +1 -62
  117. package/esm/reset/index.mjs +2 -2
  118. package/esm/reset/index.mjs.map +1 -1
  119. package/esm/select/index.d.ts +3 -16
  120. package/esm/select/index.mjs +65 -70
  121. package/esm/select/index.mjs.map +1 -1
  122. package/esm/select/select.d.ts +1 -6
  123. package/esm/select-table/index.d.ts +33 -5
  124. package/esm/select-table/index.mjs +90 -89
  125. package/esm/select-table/index.mjs.map +1 -1
  126. package/esm/select-table/select-table.d.ts +58 -2
  127. package/esm/select-table/types.d.ts +1 -1
  128. package/esm/submit/index.d.ts +1 -47
  129. package/esm/submit/index.mjs +2 -2
  130. package/esm/submit/index.mjs.map +1 -1
  131. package/esm/switch/index.d.ts +296 -1
  132. package/esm/switch/index.mjs +5 -11
  133. package/esm/switch/index.mjs.map +1 -1
  134. package/esm/time-picker/index.d.ts +442 -1
  135. package/esm/time-picker/index.mjs +9 -14
  136. package/esm/time-picker/index.mjs.map +1 -1
  137. package/esm/time-select/index.d.ts +184 -1
  138. package/esm/time-select/index.mjs +8 -13
  139. package/esm/time-select/index.mjs.map +1 -1
  140. package/esm/transfer/index.d.ts +196 -115
  141. package/esm/transfer/index.mjs +5 -5
  142. package/esm/transfer/index.mjs.map +1 -1
  143. package/esm/tree/index.d.ts +5 -5
  144. package/esm/tree/index.mjs +34 -34
  145. package/esm/tree/index.mjs.map +1 -1
  146. package/esm/tree/tree.d.ts +2 -2
  147. package/esm/tree/types.d.ts +1 -1
  148. package/esm/tree-select/index.d.ts +3 -19
  149. package/esm/tree-select/index.mjs +23 -30
  150. package/esm/tree-select/index.mjs.map +1 -1
  151. package/esm/tree-select/tree-select.d.ts +1 -8
  152. package/esm/upload/index.d.ts +409 -404
  153. package/esm/upload/index.mjs +9 -9
  154. package/esm/upload/index.mjs.map +1 -1
  155. package/esm/upload/upload.d.ts +802 -792
  156. package/esm/vendor/icon.mjs.map +1 -1
  157. package/esm/vendor/lodash.mjs +12 -20
  158. package/esm/vendor/lodash.mjs.map +1 -1
  159. package/esm/vendor/runtime.mjs +29 -24
  160. package/esm/vendor/runtime.mjs.map +1 -1
  161. package/esm/vendor/shared.esm-bundler.mjs +2 -2
  162. package/esm/vendor/sizes.mjs.map +1 -1
  163. package/esm/vendor/types.mjs +5 -5
  164. package/esm/vendor/types.mjs.map +1 -1
  165. package/package.json +8 -11
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/array-collapse/array-collapse-item.vue","../../src/array-collapse/array-collapse.vue","../../src/array-collapse/index.ts"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ArrayField } from '@formily/core'\nimport type { ISchema } from '@formily/vue'\nimport { observable } from '@formily/reactive'\nimport { RecursionField, useField, useFieldSchema } from '@formily/vue'\nimport { ElBadge, ElCollapseItem } from 'element-plus'\nimport { useCleanAttrs } from '../__builtins__'\nimport { isIndexComponent, isOperationComponent, useIndex } from '../array-base/utils'\nimport { prefixCls } from './utils'\n\ndefineOptions({\n name: 'FArrayCollapseItem',\n inheritAttrs: false,\n})\n\nconst fieldRef = useField<ArrayField>()\nconst field = fieldRef.value\nconst schemaRef = useFieldSchema()\nconst schema = schemaRef.value.parent\nconst index = useIndex()\nconst errorCount = observable.computed(() => {\n const path = field.address.concat()\n return field.form.queryFeedbacks({\n type: 'error',\n address: `${path}.**`,\n }).length\n})\n\nconst { props: collapseItemProps } = useCleanAttrs()\n</script>\n\n<template>\n <ElCollapseItem :name=\"index\" v-bind=\"collapseItemProps\">\n <template #title>\n <div style=\"flex: 1;display: flex;align-items: center;\">\n <RecursionField\n :schema=\"schema.items\"\n :name=\"index\"\n :filter-properties=\"(schema: ISchema) => isIndexComponent(schema)\"\n :only-render-properties=\"true\"\n />\n <slot name=\"title\">\n <ElBadge\n :class=\"[`${prefixCls}-errors-badge`]\"\n :value=\"errorCount.value\"\n :offset=\"[5, -2]\"\n :hidden=\"errorCount.value === 0\"\n >\n {{ schema.items?.['x-component-props']?.title }}\n </ElBadge>\n </slot>\n </div>\n <div>\n <RecursionField\n :schema=\"Array.isArray(schema.items) ? schema.items[index] || schema.items[0] : schema.items\"\n :name=\"index\"\n :filter-properties=\"(schema: ISchema) => isOperationComponent(schema)\"\n :only-render-properties=\"true\"\n />\n </div>\n </template>\n <slot />\n </ElCollapseItem>\n</template>\n","<script lang=\"ts\" setup>\nimport type { ArrayField } from '@formily/core'\nimport type { ISchema } from '@formily/json-schema'\nimport { autorun } from '@formily/reactive'\nimport { isArr } from '@formily/shared'\nimport { RecursionField, useField, useFieldSchema } from '@formily/vue'\nimport {\n ElCard,\n ElCollapse,\n ElEmpty,\n} from 'element-plus'\nimport { ref, watchEffect } from 'vue'\nimport { useCleanAttrs } from '../__builtins__'\nimport { ArrayBase } from '../array-base'\nimport { getArrayItemSchema, isAdditionComponent, isIndexComponent, isOperationComponent } from '../array-base/utils'\nimport { prefixCls } from './utils'\n\ndefineOptions({\n name: 'FArrayCollapse',\n inheritAttrs: false,\n})\n\nconst props = defineProps({\n value: {},\n defaultOpenPanelCount: {\n type: Number,\n default: 5,\n },\n})\n\nconst fieldRef = useField<ArrayField>()\nconst schemaRef = useFieldSchema()\nconst field = fieldRef.value\nconst schema = schemaRef.value\n\nconst { props: collapseProps } = useCleanAttrs()\nconst activeKeys = ref<number[] | number>([])\n\nconst { getKey, keyMap } = ArrayBase.useKey(schemaRef.value)\n\nconst dataSource = ref(field.value)\n\nautorun(() => {\n isArr(field.value) && (dataSource.value = [...field.value])\n})\n\nfunction range(count: number) {\n return Array.from({ length: count }).map((_, i) => i)\n}\n\nfunction takeDefaultActiveKeys(dataSourceLength: number, defaultOpenPanelCount: number, accordion = false) {\n if (accordion) {\n return 0\n }\n if (dataSourceLength < defaultOpenPanelCount)\n return range(dataSourceLength)\n\n return range(defaultOpenPanelCount)\n}\n\nfunction insertActiveKeys(activeKeys: number[] | number, index: number, accordion = false) {\n if (accordion)\n return index\n /* istanbul ignore if -- @preserve */\n if (!isArr(activeKeys))\n return index\n if (activeKeys.length <= index)\n return (activeKeys).concat(index)\n return (activeKeys).reduce((buf, key) => {\n if (key === index)\n return [...buf, key, key + 1]\n return buf.concat(key + 1)\n }, [])\n}\n\nwatchEffect(() => {\n if (!field.modified && dataSource.value.length > 0) {\n activeKeys.value = takeDefaultActiveKeys(\n dataSource.value.length,\n props.defaultOpenPanelCount,\n collapseProps.value.accordion as boolean,\n )\n }\n})\n\nfunction handleCollapseChange(keys: number[] | number) {\n activeKeys.value = keys\n}\n</script>\n\n<template>\n <div :class=\"prefixCls\">\n <ArrayBase\n :key=\"dataSource.length\"\n :key-map=\"keyMap\"\n :add=\"(index: number) => {\n activeKeys = insertActiveKeys(\n activeKeys,\n index,\n collapseProps.accordion as boolean,\n )\n }\"\n >\n <template v-if=\"!Array.isArray(props.value) || props.value.length === 0\">\n <ElCard :class=\"[`${prefixCls}-item`]\" shadow=\"never\" v-bind=\"collapseProps\" :header=\"collapseProps.title || field.title\">\n <ElEmpty />\n </ElCard>\n </template>\n <template v-else>\n <ElCollapse\n :model-value=\"activeKeys\"\n :class=\"`${prefixCls}-item`\"\n v-bind=\"collapseProps\"\n @change=\"handleCollapseChange\"\n >\n <ArrayBase.Item v-for=\"(item, index) of dataSource\" :key=\"getKey(item, index)\" :index=\"index\" :record=\"item\">\n <RecursionField\n :schema=\"getArrayItemSchema(schema, index)\"\n :name=\"index\"\n :filter-properties=\"(schema: ISchema) => !isIndexComponent(schema) && !isOperationComponent(schema)\"\n />\n </ArrayBase.Item>\n </ElCollapse>\n </template>\n <template v-for=\"(itemSchema, key) in schema.properties\" :key=\"key\">\n <RecursionField v-if=\"isAdditionComponent(itemSchema)\" :schema=\"itemSchema\" name=\"addition\" />\n </template>\n </ArrayBase>\n </div>\n</template>\n","import { composeExport } from '../__builtins__/shared'\nimport { ArrayBase } from '../array-base'\nimport ArrayCollapseItem from './array-collapse-item.vue'\nimport ArrayCollapseInner from './array-collapse.vue'\nimport './style.scss'\n\nexport const ArrayCollapse = composeExport(ArrayCollapseInner, {\n Item: ArrayCollapseItem,\n Index: ArrayBase.Index,\n SortHandle: ArrayBase.SortHandle,\n Addition: ArrayBase.Addition,\n Remove: ArrayBase.Remove,\n MoveDown: ArrayBase.MoveDown,\n MoveUp: ArrayBase.MoveUp,\n useArray: ArrayBase.useArray,\n useIndex: ArrayBase.useIndex,\n useRecord: ArrayBase.useRecord,\n})\n\nexport default ArrayCollapse\n"],"names":["field","useField","schema","useFieldSchema","index","useIndex","errorCount","observable","path","collapseItemProps","useCleanAttrs","_openBlock","_createBlock","_unref","_mergeProps","_createElementVNode","_hoisted_1","_createVNode","RecursionField","isIndexComponent","_renderSlot","_ctx","ElBadge","prefixCls","isOperationComponent","props","__props","fieldRef","schemaRef","collapseProps","activeKeys","ref","getKey","keyMap","ArrayBase","dataSource","autorun","isArr","range","count","_","i","takeDefaultActiveKeys","dataSourceLength","defaultOpenPanelCount","accordion","insertActiveKeys","buf","key","watchEffect","handleCollapseChange","keys","_createElementBlock","ElEmpty","_Fragment","_renderList","item","getArrayItemSchema","itemSchema","isAdditionComponent","ArrayCollapse","composeExport","ArrayCollapseInner","ArrayCollapseItem"],"mappings":";;;;;;;;;;;;;;;;AAgBA,UAAMA,IADWC,EAAA,EACM,OAEjBC,IADYC,EAAA,EACO,MAAM,QACzBC,IAAQC,GAAA,GACRC,IAAaC,EAAW,SAAS,MAAM;AAC3C,YAAMC,IAAOR,EAAM,QAAQ,OAAA;AAC3B,aAAOA,EAAM,KAAK,eAAe;AAAA,QAC/B,MAAM;AAAA,QACN,SAAS,GAAGQ,CAAI;AAAA,MAAA,CACjB,EAAE;AAAA,IACL,CAAC,GAEK,EAAE,OAAOC,EAAA,IAAsBC,EAAA;sBAInCC,KAAAC,EA8BiBC,MA9BjBC,EA8BiB,EA9BA,MAAMD,EAAAT,CAAA,EAAA,GAAeS,EAAAJ,CAAA,CAAiB,GAAA;AAAA,MAC1C,SACT,MAiBM;AAAA,QAjBNM,EAiBM,OAjBNC,IAiBM;AAAA,UAhBJC,EAKEJ,EAAAK,CAAA,GAAA;AAAA,YAJC,QAAQL,EAAAX,CAAA,EAAO;AAAA,YACf,MAAMW,EAA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,6BAAoC;AAAA,YAC1CnC,EAAA8C,EAAA,EAAoBD,CAAU,UAApD9C,EAA8FC,EAAAK,CAAA,GAAA;AAAA;cAAtC,QAAQwC;AAAA,cAAY,MAAK;AAAA,YAAA;;;;;;;ICvH5EE,KAAgBC,GAAcC,IAAoB;AAAA,EAC7D,MAAMC;AAAAA,EACN,OAAO7B,EAAU;AAAA,EACjB,YAAYA,EAAU;AAAA,EACtB,UAAUA,EAAU;AAAA,EACpB,QAAQA,EAAU;AAAA,EAClB,UAAUA,EAAU;AAAA,EACpB,QAAQA,EAAU;AAAA,EAClB,UAAUA,EAAU;AAAA,EACpB,UAAUA,EAAU;AAAA,EACpB,WAAWA,EAAU;AACvB,CAAC;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/array-collapse/array-collapse-item.vue","../../src/array-collapse/array-collapse.vue","../../src/array-collapse/index.ts"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ArrayField } from '@formily/core'\nimport type { ISchema } from '@formily/json-schema'\nimport { isArr } from '@formily/shared'\nimport { formilyComputed } from '@silver-formily/reactive-vue'\nimport { RecursionField, useField, useFieldSchema } from '@silver-formily/vue'\nimport { ElBadge, ElCollapseItem } from 'element-plus'\nimport { useCleanAttrs } from '../__builtins__'\nimport { isIndexComponent, isOperationComponent, useIndex } from '../array-base/utils'\nimport { prefixCls } from './utils'\n\ndefineOptions({\n name: 'FArrayCollapseItem',\n inheritAttrs: false,\n})\n\nconst fieldRef = useField<ArrayField>()\nconst field = fieldRef.value\nconst schemaRef = useFieldSchema()\nconst schema = schemaRef.value.parent\nconst index = useIndex()\nconst errorCount = formilyComputed(() => {\n const path = field.address.concat()\n return field.form.queryFeedbacks({\n type: 'error',\n address: `${path}.**`,\n }).length\n})\n\nconst { props: collapseItemProps } = useCleanAttrs()\n</script>\n\n<template>\n <ElCollapseItem :name=\"index\" v-bind=\"collapseItemProps\">\n <template #title>\n <div style=\"flex: 1;display: flex;align-items: center;\">\n <RecursionField\n v-if=\"!isArr(schema.items)\"\n :schema=\"schema.items\"\n :name=\"index\"\n :filter-properties=\"(schema: ISchema) => isIndexComponent(schema)\"\n :only-render-properties=\"true\"\n />\n <slot name=\"title\">\n <ElBadge\n :class=\"[`${prefixCls}-errors-badge`]\"\n :value=\"errorCount\"\n :offset=\"[5, -2]\"\n :hidden=\"errorCount === 0\"\n >\n {{ schema.items?.['x-component-props']?.title }}\n </ElBadge>\n </slot>\n </div>\n <div>\n <RecursionField\n :schema=\"Array.isArray(schema.items) ? schema.items[index] || schema.items[0] : schema.items\"\n :name=\"index\"\n :filter-properties=\"(schema: ISchema) => isOperationComponent(schema)\"\n :only-render-properties=\"true\"\n />\n </div>\n </template>\n <slot />\n </ElCollapseItem>\n</template>\n","<script lang=\"ts\" setup>\nimport type { ArrayField } from '@formily/core'\nimport type { ISchema } from '@formily/json-schema'\nimport { autorun } from '@formily/reactive'\nimport { isArr } from '@formily/shared'\nimport { RecursionField, useField, useFieldSchema } from '@silver-formily/vue'\nimport {\n ElCard,\n ElCollapse,\n ElEmpty,\n} from 'element-plus'\nimport { ref, watchEffect } from 'vue'\nimport { useCleanAttrs } from '../__builtins__'\nimport { ArrayBase } from '../array-base'\nimport { getArrayItemSchema, isAdditionComponent, isIndexComponent, isOperationComponent } from '../array-base/utils'\nimport { prefixCls } from './utils'\n\ndefineOptions({\n name: 'FArrayCollapse',\n inheritAttrs: false,\n})\n\nconst props = defineProps({\n modelValue: {},\n defaultOpenPanelCount: {\n type: Number,\n default: 5,\n },\n})\n\nconst fieldRef = useField<ArrayField>()\nconst schemaRef = useFieldSchema()\nconst field = fieldRef.value\nconst schema = schemaRef.value\n\nconst { props: collapseProps } = useCleanAttrs(['modelValue', 'onUpdate:modelValue'])\nconst activeKeys = ref<number[] | number>([])\n\nconst { getKey, keyMap } = ArrayBase.useKey(schemaRef.value)\n\nconst dataSource = ref(isArr(field.value) ? field.value : [])\n\nautorun(() => {\n dataSource.value = isArr(field.value) ? [...field.value] : []\n})\n\nfunction range(count: number) {\n return Array.from({ length: count }).map((_, i) => i)\n}\n\nfunction takeDefaultActiveKeys(dataSourceLength: number, defaultOpenPanelCount: number, accordion = false) {\n if (accordion) {\n return 0\n }\n if (dataSourceLength < defaultOpenPanelCount)\n return range(dataSourceLength)\n\n return range(defaultOpenPanelCount)\n}\n\nfunction insertActiveKeys(activeKeys: number[] | number, index: number, accordion = false) {\n if (accordion)\n return index\n /* istanbul ignore if -- @preserve */\n if (!isArr(activeKeys))\n return index\n if (activeKeys.length <= index)\n return (activeKeys).concat(index)\n return (activeKeys).reduce((buf, key) => {\n if (key === index)\n return [...buf, key, key + 1]\n return buf.concat(key + 1)\n }, [])\n}\n\nwatchEffect(() => {\n if (!field.modified && dataSource.value.length > 0) {\n activeKeys.value = takeDefaultActiveKeys(\n dataSource.value.length,\n props.defaultOpenPanelCount,\n collapseProps.value.accordion as boolean,\n )\n }\n})\n\nfunction handleCollapseChange(keys: number[] | number) {\n activeKeys.value = keys\n}\n</script>\n\n<template>\n <div :class=\"prefixCls\">\n <ArrayBase\n :key=\"dataSource.length\"\n :key-map=\"keyMap\"\n :add=\"(index: number) => {\n activeKeys = insertActiveKeys(\n activeKeys,\n index,\n collapseProps.accordion as boolean,\n )\n }\"\n >\n <template v-if=\"!Array.isArray(props.modelValue) || props.modelValue.length === 0\">\n <ElCard :class=\"[`${prefixCls}-item`]\" shadow=\"never\" v-bind=\"collapseProps\" :header=\"collapseProps.title || field.title\">\n <ElEmpty />\n </ElCard>\n </template>\n <template v-else>\n <ElCollapse\n :model-value=\"activeKeys\"\n :class=\"`${prefixCls}-item`\"\n v-bind=\"collapseProps\"\n @change=\"handleCollapseChange\"\n >\n <ArrayBase.Item v-for=\"(item, index) of dataSource\" :key=\"getKey(item, index)\" :index=\"index\" :record=\"item\">\n <RecursionField\n :schema=\"getArrayItemSchema(schema, index)\"\n :name=\"index\"\n :filter-properties=\"(schema: ISchema) => !isIndexComponent(schema) && !isOperationComponent(schema)\"\n />\n </ArrayBase.Item>\n </ElCollapse>\n </template>\n <template v-for=\"(itemSchema, key) in schema.properties\" :key=\"key\">\n <RecursionField v-if=\"isAdditionComponent(itemSchema)\" :schema=\"itemSchema\" name=\"addition\" />\n </template>\n </ArrayBase>\n </div>\n</template>\n","import { composeExport } from '../__builtins__/shared'\nimport { ArrayBase } from '../array-base'\nimport ArrayCollapseItem from './array-collapse-item.vue'\nimport ArrayCollapseInner from './array-collapse.vue'\nimport './style.scss'\n\nexport const ArrayCollapse = composeExport(ArrayCollapseInner, {\n Item: ArrayCollapseItem,\n Index: ArrayBase.Index,\n SortHandle: ArrayBase.SortHandle,\n Addition: ArrayBase.Addition,\n Remove: ArrayBase.Remove,\n MoveDown: ArrayBase.MoveDown,\n MoveUp: ArrayBase.MoveUp,\n useArray: ArrayBase.useArray,\n useIndex: ArrayBase.useIndex,\n useRecord: ArrayBase.useRecord,\n})\n\nexport default ArrayCollapse\n"],"names":["field","useField","schema","useFieldSchema","index","useIndex","errorCount","formilyComputed","path","collapseItemProps","useCleanAttrs","_openBlock","_createBlock","_unref","_mergeProps","_createElementVNode","_hoisted_1","isArr","RecursionField","isIndexComponent","_renderSlot","_ctx","_createVNode","ElBadge","prefixCls","isOperationComponent","props","__props","fieldRef","schemaRef","collapseProps","activeKeys","ref","getKey","keyMap","ArrayBase","dataSource","autorun","range","count","_","i","takeDefaultActiveKeys","dataSourceLength","defaultOpenPanelCount","accordion","insertActiveKeys","buf","key","watchEffect","handleCollapseChange","keys","_createElementBlock","ElEmpty","_Fragment","_renderList","item","getArrayItemSchema","itemSchema","isAdditionComponent","ArrayCollapse","composeExport","ArrayCollapseInner","ArrayCollapseItem"],"mappings":";;;;;;;;;;;;;;;;AAiBA,UAAMA,IADWC,EAAA,EACM,OAEjBC,IADYC,EAAA,EACO,MAAM,QACzBC,IAAQC,GAAA,GACRC,IAAaC,EAAgB,MAAM;AACvC,YAAMC,IAAOR,EAAM,QAAQ,OAAA;AAC3B,aAAOA,EAAM,KAAK,eAAe;AAAA,QAC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AsB,CAAA,EAAA,MAAA;AAAA,gBANoC,KAAKtB,EAAAoB,CAAA,EAAOuB,GAAMpD,CAAK;AAAA,gBAAI,OAAAA;AAAA,gBAAe,QAAQoD;AAAA,cAAA;2BACrG,MAIE;AAAA,kBAJFlC,EAIET,EAAAK,CAAA,GAAA;AAAA,oBAHC,QAAQL,EAAA4C,EAAA,EAAmB5C,EAAAX,CAAA,GAAQE,CAAK;AAAA,oBACxC,MAAMA;AAAA,oBACN,qBAAiB,CAAGF,MAAe,CAAMW,EAAAM,CAAA,EAAiBjB,CAAM,KAAA,CAAMW,EAAAY,CAAA,EAAqBvB,CAAM;AAAA,kBAAA;;;;;;;WAK1GS,EAAA,EAAA,GAAAyC,EAEWE,WAF2BzC,EAAAX,CAAA,EAAO,YAAU,CAArCwD,GAAYV,6BAAoC;AAAA,YAC1CnC,EAAA8C,EAAA,EAAoBD,CAAU,UAApD9C,EAA8FC,EAAAK,CAAA,GAAA;AAAA;cAAtC,QAAQwC;AAAA,cAAY,MAAK;AAAA,YAAA;;;;;;;ICvH5EE,KAAgBC,GAAcC,IAAoB;AAAA,EAC7D,MAAMC;AAAAA,EACN,OAAO5B,EAAU;AAAA,EACjB,YAAYA,EAAU;AAAA,EACtB,UAAUA,EAAU;AAAA,EACpB,QAAQA,EAAU;AAAA,EAClB,UAAUA,EAAU;AAAA,EACpB,QAAQA,EAAU;AAAA,EAClB,UAAUA,EAAU;AAAA,EACpB,UAAUA,EAAU;AAAA,EACpB,WAAWA,EAAU;AACvB,CAAC;"}
@@ -3,8 +3,8 @@ import "vue";
3
3
  import "element-plus";
4
4
  import "@formily/reactive";
5
5
  import "@formily/core";
6
- import "@formily/reactive-vue";
7
- import "@formily/vue";
6
+ import "@silver-formily/reactive-vue";
7
+ import "@silver-formily/vue";
8
8
  const s = `${r}-array-collapse`;
9
9
  export {
10
10
  s as prefixCls
@@ -1,16 +1,16 @@
1
- import { defineComponent as R, createElementBlock as s, openBlock as o, normalizeClass as _, renderSlot as M, ref as x, mergeProps as B, unref as e, createVNode as f, withCtx as y, Fragment as v, renderList as k, createBlock as $, createCommentVNode as D } from "vue";
1
+ import { defineComponent as S, createElementBlock as n, openBlock as a, normalizeClass as h, renderSlot as V, ref as $, mergeProps as B, unref as e, createBlock as f, withCtx as y, createVNode as C, Fragment as v, renderList as R, createCommentVNode as D } from "vue";
2
2
  import "element-plus";
3
3
  import { autorun as E } from "@formily/reactive";
4
4
  import "@formily/core";
5
- import "@formily/reactive-vue";
6
- import { useField as K, useFieldSchema as P, RecursionField as C } from "@formily/vue";
7
- import { useCleanAttrs as U, composeExport as V } from "../__builtins__/shared/utils.mjs";
5
+ import "@silver-formily/reactive-vue";
6
+ import { useField as U, useFieldSchema as K, RecursionField as F } from "@silver-formily/vue";
7
+ import { useCleanAttrs as P, composeExport as b } from "../__builtins__/shared/utils.mjs";
8
8
  import { ArrayBase as r } from "../array-base/index.mjs";
9
- import { stylePrefix as h } from "../__builtins__/configs/index.mjs";
10
- import { isArr as b } from "@formily/shared";
9
+ import { stylePrefix as I } from "../__builtins__/configs/index.mjs";
10
+ import { isArr as _ } from "@formily/shared";
11
11
  import { VueDraggable as H } from "vue-draggable-plus";
12
12
  import { useKey as N, getArrayItemSchema as z, isAdditionComponent as L } from "../array-base/utils.mjs";
13
- import '../styles/array-items/index.css';const j = /* @__PURE__ */ R({
13
+ import '../styles/array-items/index.css';const j = /* @__PURE__ */ S({
14
14
  name: "FArrayItemsItem",
15
15
  __name: "array-items-item",
16
16
  props: {
@@ -19,53 +19,56 @@ import '../styles/array-items/index.css';const j = /* @__PURE__ */ R({
19
19
  default: "card"
20
20
  }
21
21
  },
22
- setup(I) {
23
- const i = I, m = `${h}-array-items`;
24
- return (n, c) => (o(), s("div", {
25
- class: _(`${m}-${i.type}`)
22
+ setup(A) {
23
+ const i = A, l = `${I}-array-items`;
24
+ return (s, u) => (a(), n("div", {
25
+ class: h(`${l}-${i.type}`)
26
26
  }, [
27
- M(n.$slots, "default")
27
+ V(s.$slots, "default")
28
28
  ], 2));
29
29
  }
30
- }), q = ["index"], G = /* @__PURE__ */ R({
30
+ }), q = ["index"], G = /* @__PURE__ */ S({
31
31
  name: "FArrayItems",
32
32
  inheritAttrs: !1,
33
33
  __name: "array-items",
34
- setup(I) {
35
- const i = K(), m = P(), n = i.value, c = m.value, u = `${h}-array-items`, { getKey: A, keyMap: l } = N(m.value), d = x(n.value), F = x(0);
34
+ setup(A) {
35
+ const i = U(), l = K(), s = i.value, u = l.value, c = `${I}-array-items`, { getKey: g, keyMap: m } = N(l.value), d = $(_(s.value) ? s.value : []), k = $(0);
36
36
  E(() => {
37
- d.value = [...n.value];
37
+ d.value = _(s.value) ? [...s.value] : [];
38
38
  });
39
- async function S(g) {
40
- const { oldIndex: p, newIndex: t } = g;
41
- b(l) && l.splice(t, 0, l.splice(p, 1)[0]), await n.move(p, t), F.value++;
39
+ async function w(x) {
40
+ const { oldIndex: p, newIndex: t } = x;
41
+ _(m) && m.splice(t, 0, m.splice(p, 1)[0]), await s.move(p, t), k.value++;
42
42
  }
43
- const { props: w } = U(["value"]);
44
- return (g, p) => (o(), s("div", B({ class: u }, e(w)), [
45
- f(e(r), { "key-map": e(l) }, {
43
+ const { props: M } = P(["value", "modelValue", "onUpdate:modelValue"]);
44
+ return (x, p) => (a(), n("div", B({ class: c }, e(M)), [
45
+ (a(), f(e(r), {
46
+ key: k.value,
47
+ "key-map": e(m)
48
+ }, {
46
49
  default: y(() => [
47
- f(e(H), {
48
- class: _(`${u}-list`),
50
+ C(e(H), {
51
+ class: h(`${c}-list`),
49
52
  "model-value": d.value,
50
- handle: `.${e(h)}-array-base-sort-handle`,
53
+ handle: `.${e(I)}-array-base-sort-handle`,
51
54
  animation: 150,
52
- onEnd: S
55
+ onEnd: w
53
56
  }, {
54
57
  default: y(() => [
55
- (o(!0), s(v, null, k(d.value, (t, a) => (o(), $(e(r).Item, {
56
- key: e(A)(t, a),
57
- index: a,
58
+ (a(!0), n(v, null, R(d.value, (t, o) => (a(), f(e(r).Item, {
59
+ key: e(g)(t, o),
60
+ index: o,
58
61
  record: t
59
62
  }, {
60
63
  default: y(() => [
61
- (o(), s("div", {
62
- key: e(A)(t, a),
63
- class: _([`${u}-item-inner`]),
64
- index: a
64
+ (a(), n("div", {
65
+ key: e(g)(t, o),
66
+ class: h([`${c}-item-inner`]),
67
+ index: o
65
68
  }, [
66
- f(e(C), {
67
- schema: e(z)(e(c), a),
68
- name: a
69
+ C(e(F), {
70
+ schema: e(z)(e(u), o),
71
+ name: o
69
72
  }, null, 8, ["schema", "name"])
70
73
  ], 10, q))
71
74
  ]),
@@ -74,8 +77,8 @@ import '../styles/array-items/index.css';const j = /* @__PURE__ */ R({
74
77
  ]),
75
78
  _: 1
76
79
  }, 8, ["class", "model-value", "handle"]),
77
- (o(!0), s(v, null, k(e(c).properties, (t, a) => (o(), s(v, { key: a }, [
78
- e(L)(t) ? (o(), $(e(C), {
80
+ (a(!0), n(v, null, R(e(u).properties, (t, o) => (a(), n(v, { key: o }, [
81
+ e(L)(t) ? (a(), f(e(F), {
79
82
  key: 0,
80
83
  schema: t,
81
84
  name: "addition"
@@ -83,10 +86,10 @@ import '../styles/array-items/index.css';const j = /* @__PURE__ */ R({
83
86
  ], 64))), 128))
84
87
  ]),
85
88
  _: 1
86
- }, 8, ["key-map"])
89
+ }, 8, ["key-map"]))
87
90
  ], 16));
88
91
  }
89
- }), oe = V(G, {
92
+ }), oe = b(G, {
90
93
  Item: j,
91
94
  Index: r.Index,
92
95
  SortHandle: r.SortHandle,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/array-items/array-items-item.vue","../../src/array-items/array-items.vue","../../src/array-items/index.ts"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { PropType } from 'vue'\nimport { stylePrefix } from '../__builtins__/configs'\n\ndefineOptions({\n name: 'FArrayItemsItem',\n})\n\nconst props = defineProps({\n type: {\n type: String as PropType<'card' | 'divide'>,\n default: 'card',\n },\n})\n\nconst prefixCls = `${stylePrefix}-array-items`\n</script>\n\n<template>\n <div\n :class=\"`${prefixCls}-${props.type}`\"\n >\n <slot />\n </div>\n</template>\n","<script lang=\"ts\" setup>\nimport type { ArrayField } from '@formily/core'\nimport { autorun } from '@formily/reactive'\nimport { isArr } from '@formily/shared'\nimport { RecursionField, useField, useFieldSchema } from '@formily/vue'\nimport { ref } from 'vue'\nimport { VueDraggable } from 'vue-draggable-plus'\nimport { useCleanAttrs } from '../__builtins__'\nimport { stylePrefix } from '../__builtins__/configs'\nimport { ArrayBase } from '../array-base'\nimport { getArrayItemSchema, isAdditionComponent, useKey } from '../array-base/utils'\n\ndefineOptions({\n name: 'FArrayItems',\n inheritAttrs: false,\n})\n\nconst fieldRef = useField<ArrayField>()\nconst schemaRef = useFieldSchema()\nconst field = fieldRef.value\nconst schema = schemaRef.value\n\nconst prefixCls = `${stylePrefix}-array-items`\nconst { getKey, keyMap } = useKey(schemaRef.value)\nconst dataSource = ref(field.value)\nconst triggerUpdateKey = ref(0)\n\nautorun(() => {\n dataSource.value = [...field.value]\n})\n\nasync function handleDragEnd(evt: { oldIndex: number, newIndex: number }) {\n const { oldIndex, newIndex } = evt\n if (isArr(keyMap)) {\n keyMap.splice(newIndex, 0, keyMap.splice(oldIndex, 1)[0])\n }\n await field.move(oldIndex, newIndex)\n triggerUpdateKey.value++\n}\nconst { props: arrayItemsProps } = useCleanAttrs(['value'])\n</script>\n\n<template>\n <div :class=\"prefixCls\" v-bind=\"arrayItemsProps\">\n <ArrayBase :key-map=\"keyMap\">\n <VueDraggable\n :class=\"`${prefixCls}-list`\"\n :model-value=\"dataSource\"\n :handle=\"`.${stylePrefix}-array-base-sort-handle`\"\n :animation=\"150\"\n @end=\"handleDragEnd\"\n >\n <ArrayBase.Item\n v-for=\"(element, index) of dataSource\"\n :key=\"getKey(element, index)\"\n :index=\"index\"\n :record=\"element\"\n >\n <div :key=\"getKey(element, index)\" :class=\"[`${prefixCls}-item-inner`]\" :index=\"index\">\n <RecursionField :schema=\"getArrayItemSchema(schema, index)\" :name=\"index\" />\n </div>\n </ArrayBase.Item>\n </VueDraggable>\n\n <template v-for=\"(itemSchema, key) of schema.properties\" :key=\"key\">\n <RecursionField v-if=\"isAdditionComponent(itemSchema)\" :schema=\"itemSchema\" name=\"addition\" />\n </template>\n </ArrayBase>\n </div>\n</template>\n","import { composeExport } from '../__builtins__/shared'\nimport { ArrayBase } from '../array-base'\nimport ArrayItemsItem from './array-items-item.vue'\nimport ArrayItemsInner from './array-items.vue'\nimport './style.scss'\n\nexport const ArrayItems = composeExport(ArrayItemsInner, {\n Item: ArrayItemsItem,\n Index: ArrayBase.Index,\n SortHandle: ArrayBase.SortHandle,\n Addition: ArrayBase.Addition,\n Remove: ArrayBase.Remove,\n MoveDown: ArrayBase.MoveDown,\n MoveUp: ArrayBase.MoveUp,\n useArray: ArrayBase.useArray,\n useIndex: ArrayBase.useIndex,\n useRecord: ArrayBase.useRecord,\n})\n\nexport default ArrayItems\n"],"names":["props","__props","prefixCls","stylePrefix","_createElementBlock","_normalizeClass","_renderSlot","_ctx","fieldRef","useField","schemaRef","useFieldSchema","field","schema","getKey","keyMap","useKey","dataSource","ref","triggerUpdateKey","autorun","handleDragEnd","evt","oldIndex","newIndex","isArr","arrayItemsProps","useCleanAttrs","_openBlock","_mergeProps","_unref","_createVNode","ArrayBase","VueDraggable","_Fragment","_renderList","element","index","_createBlock","RecursionField","getArrayItemSchema","itemSchema","key","isAdditionComponent","ArrayItems","composeExport","ArrayItemsInner","ArrayItemsItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAQA,UAAMA,IAAQC,GAORC,IAAY,GAAGC,CAAW;2BAI9BC,EAIM,OAAA;AAAA,MAHH,OAAKC,EAAA,GAAKH,CAAS,IAAIF,EAAM,IAAI,EAAA;AAAA,IAAA;MAElCM,EAAQC,EAAA,QAAA,SAAA;AAAA,IAAA;;;;;;;ACLZ,UAAMC,IAAWC,EAAA,GACXC,IAAYC,EAAA,GACZC,IAAQJ,EA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,cAAA;2BAET,MAEM;AAAA,wBAFNhC,EAEM,OAAA;AAAA,oBAFA,KAAK0B,EAAAhB,CAAA,EAAOsB,GAASC,CAAK;AAAA,oBAAI,aAAWnC,CAAS,aAAA,CAAA;AAAA,oBAAiB,OAAAmC;AAAA,kBAAA;oBACvEN,EAA4ED,EAAAS,CAAA,GAAA;AAAA,sBAA3D,QAAQT,EAAAU,CAAA,EAAmBV,EAAAjB,CAAA,GAAQwB,CAAK;AAAA,sBAAI,MAAMA;AAAA,oBAAA;;;;;;;;WAKzET,EAAA,EAAA,GAAAxB,EAEW8B,WAF2BJ,EAAAjB,CAAA,EAAO,YAAU,CAArC4B,GAAYC,6BAAoC;AAAA,YAC1CZ,EAAAa,CAAA,EAAoBF,CAAU,UAApDH,EAA8FR,EAAAS,CAAA,GAAA;AAAA;cAAtC,QAAQE;AAAA,cAAY,MAAK;AAAA,YAAA;;;;;;;IC3D5EG,KAAaC,EAAcC,GAAiB;AAAA,EACvD,MAAMC;AAAAA,EACN,OAAOf,EAAU;AAAA,EACjB,YAAYA,EAAU;AAAA,EACtB,UAAUA,EAAU;AAAA,EACpB,QAAQA,EAAU;AAAA,EAClB,UAAUA,EAAU;AAAA,EACpB,QAAQA,EAAU;AAAA,EAClB,UAAUA,EAAU;AAAA,EACpB,UAAUA,EAAU;AAAA,EACpB,WAAWA,EAAU;AACvB,CAAC;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/array-items/array-items-item.vue","../../src/array-items/array-items.vue","../../src/array-items/index.ts"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { PropType } from 'vue'\nimport { stylePrefix } from '../__builtins__/configs'\n\ndefineOptions({\n name: 'FArrayItemsItem',\n})\n\nconst props = defineProps({\n type: {\n type: String as PropType<'card' | 'divide'>,\n default: 'card',\n },\n})\n\nconst prefixCls = `${stylePrefix}-array-items`\n</script>\n\n<template>\n <div\n :class=\"`${prefixCls}-${props.type}`\"\n >\n <slot />\n </div>\n</template>\n","<script lang=\"ts\" setup>\nimport type { ArrayField } from '@formily/core'\nimport { autorun } from '@formily/reactive'\nimport { isArr } from '@formily/shared'\nimport { RecursionField, useField, useFieldSchema } from '@silver-formily/vue'\nimport { ref } from 'vue'\nimport { VueDraggable } from 'vue-draggable-plus'\nimport { useCleanAttrs } from '../__builtins__'\nimport { stylePrefix } from '../__builtins__/configs'\nimport { ArrayBase } from '../array-base'\nimport { getArrayItemSchema, isAdditionComponent, useKey } from '../array-base/utils'\n\ndefineOptions({\n name: 'FArrayItems',\n inheritAttrs: false,\n})\n\nconst fieldRef = useField<ArrayField>()\nconst schemaRef = useFieldSchema()\nconst field = fieldRef.value\nconst schema = schemaRef.value\n\nconst prefixCls = `${stylePrefix}-array-items`\nconst { getKey, keyMap } = useKey(schemaRef.value)\nconst dataSource = ref(isArr(field.value) ? field.value : [])\nconst triggerUpdateKey = ref(0)\n\nautorun(() => {\n dataSource.value = isArr(field.value) ? [...field.value] : []\n})\n\nasync function handleDragEnd(evt: { oldIndex: number, newIndex: number }) {\n const { oldIndex, newIndex } = evt\n if (isArr(keyMap)) {\n keyMap.splice(newIndex, 0, keyMap.splice(oldIndex, 1)[0])\n }\n await field.move(oldIndex, newIndex)\n triggerUpdateKey.value++\n}\nconst { props: arrayItemsProps } = useCleanAttrs(['value', 'modelValue', 'onUpdate:modelValue'])\n</script>\n\n<template>\n <div :class=\"prefixCls\" v-bind=\"arrayItemsProps\">\n <ArrayBase :key=\"triggerUpdateKey\" :key-map=\"keyMap\">\n <VueDraggable\n :class=\"`${prefixCls}-list`\"\n :model-value=\"dataSource\"\n :handle=\"`.${stylePrefix}-array-base-sort-handle`\"\n :animation=\"150\"\n @end=\"handleDragEnd\"\n >\n <ArrayBase.Item\n v-for=\"(element, index) of dataSource\"\n :key=\"getKey(element, index)\"\n :index=\"index\"\n :record=\"element\"\n >\n <div :key=\"getKey(element, index)\" :class=\"[`${prefixCls}-item-inner`]\" :index=\"index\">\n <RecursionField :schema=\"getArrayItemSchema(schema, index)\" :name=\"index\" />\n </div>\n </ArrayBase.Item>\n </VueDraggable>\n\n <template v-for=\"(itemSchema, key) of schema.properties\" :key=\"key\">\n <RecursionField v-if=\"isAdditionComponent(itemSchema)\" :schema=\"itemSchema\" name=\"addition\" />\n </template>\n </ArrayBase>\n </div>\n</template>\n","import { composeExport } from '../__builtins__/shared'\nimport { ArrayBase } from '../array-base'\nimport ArrayItemsItem from './array-items-item.vue'\nimport ArrayItemsInner from './array-items.vue'\nimport './style.scss'\n\nexport const ArrayItems = composeExport(ArrayItemsInner, {\n Item: ArrayItemsItem,\n Index: ArrayBase.Index,\n SortHandle: ArrayBase.SortHandle,\n Addition: ArrayBase.Addition,\n Remove: ArrayBase.Remove,\n MoveDown: ArrayBase.MoveDown,\n MoveUp: ArrayBase.MoveUp,\n useArray: ArrayBase.useArray,\n useIndex: ArrayBase.useIndex,\n useRecord: ArrayBase.useRecord,\n})\n\nexport default ArrayItems\n"],"names":["props","__props","prefixCls","stylePrefix","_createElementBlock","_normalizeClass","_renderSlot","_ctx","fieldRef","useField","schemaRef","useFieldSchema","field","schema","getKey","keyMap","useKey","dataSource","ref","isArr","triggerUpdateKey","autorun","handleDragEnd","evt","oldIndex","newIndex","arrayItemsProps","useCleanAttrs","_openBlock","_mergeProps","_unref","_createBlock","ArrayBase","_createVNode","VueDraggable","_Fragment","_renderList","element","index","RecursionField","getArrayItemSchema","itemSchema","key","isAdditionComponent","ArrayItems","composeExport","ArrayItemsInner","ArrayItemsItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAQA,UAAMA,IAAQC,GAORC,IAAY,GAAGC,CAAW;2BAI9BC,EAIM,OAAA;AAAA,MAHH,OAAKC,EAAA,GAAKH,CAAS,IAAIF,EAAM,IAAI,EAAA;AAAA,IAAA;MAElCM,EAAQC,EAAA,QAAA,SAAA;AAAA,IAAA;;;;;;;ACLZ,UAAMC,IAAWC,EAAA,GACXC,IAAYC,EAAA,GACZC,IAAQJ,EAAS,OACjBK,IAASH,EAAU,OAE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APd,KAAKF,EAAAhB,CAAA,EAAOuB,GAASC,CAAK;AAAA,gBAC1B,OAAAA;AAAA,gBACA,QAAQD;AAAA,cAAA;2BAET,MAEM;AAAA,wBAFNjC,EAEM,OAAA;AAAA,oBAFA,KAAK0B,EAAAhB,CAAA,EAAOuB,GAASC,CAAK;AAAA,oBAAI,aAAWpC,CAAS,aAAA,CAAA;AAAA,oBAAiB,OAAAoC;AAAA,kBAAA;oBACvEL,EAA4EH,EAAAS,CAAA,GAAA;AAAA,sBAA3D,QAAQT,EAAAU,CAAA,EAAmBV,EAAAjB,CAAA,GAAQyB,CAAK;AAAA,sBAAI,MAAMA;AAAA,oBAAA;;;;;;;;WAKzEV,EAAA,EAAA,GAAAxB,EAEW+B,WAF2BL,EAAAjB,CAAA,EAAO,YAAU,CAArC4B,GAAYC,6BAAoC;AAAA,YAC1CZ,EAAAa,CAAA,EAAoBF,CAAU,UAApDV,EAA8FD,EAAAS,CAAA,GAAA;AAAA;cAAtC,QAAQE;AAAA,cAAY,MAAK;AAAA,YAAA;;;;;;;IC3D5EG,KAAaC,EAAcC,GAAiB;AAAA,EACvD,MAAMC;AAAAA,EACN,OAAOf,EAAU;AAAA,EACjB,YAAYA,EAAU;AAAA,EACtB,UAAUA,EAAU;AAAA,EACpB,QAAQA,EAAU;AAAA,EAClB,UAAUA,EAAU;AAAA,EACpB,QAAQA,EAAU;AAAA,EAClB,UAAUA,EAAU;AAAA,EACpB,UAAUA,EAAU;AAAA,EACpB,WAAWA,EAAU;AACvB,CAAC;"}
@@ -7,7 +7,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
7
7
  type: BooleanConstructor;
8
8
  default: boolean;
9
9
  };
10
- value: {
10
+ modelValue: {
11
11
  type: ArrayConstructor;
12
12
  default: () => any[];
13
13
  };
@@ -20,12 +20,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
20
20
  type: BooleanConstructor;
21
21
  default: boolean;
22
22
  };
23
- value: {
23
+ modelValue: {
24
24
  type: ArrayConstructor;
25
25
  default: () => any[];
26
26
  };
27
27
  }>> & Readonly<{}>, {
28
- value: unknown[];
28
+ modelValue: unknown[];
29
29
  showTitleFieldInTab: boolean;
30
30
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
31
31
  export default _default;
@@ -8,12 +8,12 @@ export declare const ArrayListTabs: {
8
8
  type: BooleanConstructor;
9
9
  default: boolean;
10
10
  };
11
- value: {
11
+ modelValue: {
12
12
  type: ArrayConstructor;
13
13
  default: () => any[];
14
14
  };
15
15
  }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
16
- value: unknown[];
16
+ modelValue: unknown[];
17
17
  showTitleFieldInTab: boolean;
18
18
  }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLDivElement, import('vue').ComponentProvideOptions, {
19
19
  P: {};
@@ -31,12 +31,12 @@ export declare const ArrayListTabs: {
31
31
  type: BooleanConstructor;
32
32
  default: boolean;
33
33
  };
34
- value: {
34
+ modelValue: {
35
35
  type: ArrayConstructor;
36
36
  default: () => any[];
37
37
  };
38
38
  }>> & Readonly<{}>, {}, {}, {}, {}, {
39
- value: unknown[];
39
+ modelValue: unknown[];
40
40
  showTitleFieldInTab: boolean;
41
41
  }>;
42
42
  __isFragment?: never;
@@ -51,12 +51,12 @@ export declare const ArrayListTabs: {
51
51
  type: BooleanConstructor;
52
52
  default: boolean;
53
53
  };
54
- value: {
54
+ modelValue: {
55
55
  type: ArrayConstructor;
56
56
  default: () => any[];
57
57
  };
58
58
  }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
59
- value: unknown[];
59
+ modelValue: unknown[];
60
60
  showTitleFieldInTab: boolean;
61
61
  }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & {
62
62
  Addition: import('vue').DefineComponent<import('../array-base/types').IArrayBaseAdditionProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('../array-base/types').IArrayBaseAdditionProps> & Readonly<{}>, {
@@ -1,14 +1,15 @@
1
- import { defineComponent as P, ref as C, createElementBlock as s, openBlock as l, normalizeClass as i, unref as e, createBlock as y, withCtx as f, createElementVNode as I, createCommentVNode as A, createVNode as v, Fragment as k, renderList as $, toDisplayString as q, normalizeStyle as z } from "vue";
2
- import { ElScrollbar as K, ElBadge as N, ElEmpty as V } from "element-plus";
3
- import { observable as D, autorun as w } from "@formily/reactive";
1
+ import { defineComponent as P, ref as A, createElementBlock as s, openBlock as a, normalizeClass as i, unref as e, createBlock as d, withCtx as h, createElementVNode as I, createCommentVNode as k, createVNode as T, Fragment as b, renderList as F, toDisplayString as q, normalizeStyle as z } from "vue";
2
+ import { ElScrollbar as K, ElBadge as N, ElEmpty as D } from "element-plus";
3
+ import { autorun as V } from "@formily/reactive";
4
4
  import "@formily/core";
5
- import "@formily/reactive-vue";
6
- import { useField as M, useFieldSchema as G, RecursionField as T } from "@formily/vue";
7
- import { composeExport as H } from "../__builtins__/shared/utils.mjs";
8
- import { ArrayBase as c } from "../array-base/index.mjs";
9
- import { isRemoveComponent as B, isAdditionComponent as J, getArrayItemSchema as O } from "../array-base/utils.mjs";
5
+ import { formilyComputed as M } from "@silver-formily/reactive-vue";
6
+ import { useField as G, useFieldSchema as H, RecursionField as _ } from "@silver-formily/vue";
7
+ import { composeExport as J } from "../__builtins__/shared/utils.mjs";
8
+ import { ArrayBase as y } from "../array-base/index.mjs";
9
+ import { isArr as w } from "@formily/shared";
10
+ import { isRemoveComponent as B, isAdditionComponent as O, getArrayItemSchema as Q } from "../array-base/utils.mjs";
10
11
  import { prefixCls as n, isTabTitleComponent as E } from "./utils.mjs";
11
- import '../styles/array-list-tabs/index.css';const Q = ["id", "aria-controls", "onClick"], U = ["id", "aria-labelledby"], W = /* @__PURE__ */ P({
12
+ import '../styles/array-list-tabs/index.css';const U = ["id", "aria-controls", "onClick"], W = ["id", "aria-labelledby"], X = /* @__PURE__ */ P({
12
13
  name: "FArrayListTabs",
13
14
  __name: "array-list-tabs",
14
15
  props: {
@@ -20,150 +21,153 @@ import '../styles/array-list-tabs/index.css';const Q = ["id", "aria-controls", "
20
21
  type: Boolean,
21
22
  default: !1
22
23
  },
23
- value: {
24
+ modelValue: {
24
25
  type: Array,
25
26
  default: () => []
26
27
  }
27
28
  },
28
29
  setup(R) {
29
- const o = R, S = M(), F = G(), r = S.value, h = F.value, d = C(0), { getKey: g, keyMap: j } = c.useKey(F.value), b = D.computed(() => o.showTitleFieldInTab ? r.value.map((u, p) => {
30
- const a = r.path.concat(p);
31
- return r.form.queryFeedbacks({
30
+ const o = R, S = G(), g = H(), l = S.value, u = g.value, f = A(0), { getKey: C, keyMap: j } = y.useKey(g.value), v = M(() => o.showTitleFieldInTab ? l.value.map((m, p) => {
31
+ const r = l.path.concat(p);
32
+ return l.form.queryFeedbacks({
32
33
  type: "error",
33
- path: `${a}.*(!${o.tabTitleField})`
34
+ path: `${r}.*(!${o.tabTitleField})`
34
35
  }).length;
35
- }) : r.value.map((u, p) => {
36
- const a = r.path.concat(p);
37
- return r.form.queryFeedbacks({
36
+ }) : l.value.map((m, p) => {
37
+ const r = l.path.concat(p);
38
+ return l.form.queryFeedbacks({
38
39
  type: "error",
39
- path: `${a}.**`
40
+ path: `${r}.**`
40
41
  }).length;
41
- })), _ = C();
42
- w(() => {
42
+ })), $ = A();
43
+ V(() => {
43
44
  if (o.showTitleFieldInTab) {
44
- const u = r.value.map((p, a) => [
45
- a,
46
- b.value[a]
45
+ const m = l.value.map((p, r) => [
46
+ r,
47
+ v.value[r]
47
48
  ].join("|")).join(",");
48
- _.value = u;
49
+ $.value = m;
49
50
  } else {
50
- const u = r.value.map((p, a) => [
51
- a,
51
+ const m = l.value.map((p, r) => [
52
+ r,
52
53
  p?.[o.tabTitleField],
53
- b.value[a]
54
+ v.value[r]
54
55
  ].join("|")).join(",");
55
- _.value = u;
56
+ $.value = m;
56
57
  }
57
- }), w(() => {
58
- r.value.length > 0 && d.value >= r.value.length && (d.value = r.value.length - 1);
58
+ }), V(() => {
59
+ l.value.length > 0 && f.value >= l.value.length && (f.value = l.value.length - 1);
59
60
  });
60
- function L(u) {
61
- return `${u?.[o.tabTitleField] || "未命名条目"}`;
61
+ function L(m) {
62
+ return `${m?.[o.tabTitleField] || "未命名条目"}`;
62
63
  }
63
- return (u, p) => (l(), s("div", {
64
+ return (m, p) => (a(), s("div", {
64
65
  class: i(e(n))
65
66
  }, [
66
- (l(), y(e(c), {
67
- key: o.value.length,
67
+ (a(), d(e(y), {
68
+ key: o.modelValue.length,
68
69
  "key-map": e(j)
69
70
  }, {
70
- default: f(() => [
71
+ default: h(() => [
71
72
  I("ul", {
72
73
  class: i(`${e(n)}_list`)
73
74
  }, [
74
- v(e(K), {
75
+ T(e(K), {
75
76
  class: i(`${e(n)}_list--scroll-wrapper`)
76
77
  }, {
77
- default: f(() => [
78
- (l(!0), s(k, null, $(o.value, (a, t) => (l(), y(e(c).Item, {
78
+ default: h(() => [
79
+ (a(!0), s(b, null, F(o.modelValue, (r, t) => (a(), d(e(y).Item, {
79
80
  key: t,
80
81
  index: t,
81
- record: a
82
+ record: r
82
83
  }, {
83
- default: f(() => [
84
- (l(), s("li", {
85
- id: `${e(r).props.name}-tab-${t}`,
86
- key: _.value,
84
+ default: h(() => [
85
+ (a(), s("li", {
86
+ id: `${e(l).props.name}-tab-${t}`,
87
+ key: $.value,
87
88
  class: i([
88
89
  `${e(n)}_list-item`,
89
- d.value === t && "is-active"
90
+ f.value === t && "is-active"
90
91
  ]),
91
92
  role: "tab",
92
- "aria-controls": `${e(r).props.name}-tab-panel-${t}`,
93
- onClick: () => d.value = t
93
+ "aria-controls": `${e(l).props.name}-tab-panel-${t}`,
94
+ onClick: () => f.value = t
94
95
  }, [
95
96
  I("div", {
96
97
  class: i(`${e(n)}_list-item--content`)
97
98
  }, [
98
- v(e(N), {
99
+ T(e(N), {
99
100
  class: i([`${e(n)}-errors-badge`]),
100
- value: e(b).value[t],
101
+ value: e(v)[t],
101
102
  offset: [5, 0],
102
- hidden: e(b).value[t] === 0
103
+ hidden: e(v)[t] === 0
103
104
  }, {
104
- default: f(() => [
105
- o.showTitleFieldInTab ? (l(), y(e(T), {
106
- key: 1,
107
- schema: e(h).items,
108
- name: t,
109
- "filter-properties": (m) => e(E)(m, o.tabTitleField),
110
- "only-render-properties": ""
111
- }, null, 8, ["schema", "name", "filter-properties"])) : (l(), s("span", {
105
+ default: h(() => [
106
+ o.showTitleFieldInTab ? (a(), s(b, { key: 1 }, [
107
+ e(w)(e(u).items) ? k("", !0) : (a(), d(e(_), {
108
+ key: 0,
109
+ schema: e(u).items,
110
+ name: t,
111
+ "filter-properties": (c) => e(E)(c, o.tabTitleField),
112
+ "only-render-properties": ""
113
+ }, null, 8, ["schema", "name", "filter-properties"]))
114
+ ], 64)) : (a(), s("span", {
112
115
  key: 0,
113
116
  class: i(`${e(n)}_list-item--title`)
114
- }, q(L(a)), 3))
117
+ }, q(L(r)), 3))
115
118
  ]),
116
119
  _: 2
117
120
  }, 1032, ["class", "value", "hidden"])
118
121
  ], 2),
119
- v(e(T), {
120
- schema: e(h).items,
122
+ e(w)(e(u).items) ? k("", !0) : (a(), d(e(_), {
123
+ key: 0,
124
+ schema: e(u).items,
121
125
  name: t,
122
- "filter-properties": (m) => e(B)(m),
126
+ "filter-properties": (c) => e(B)(c),
123
127
  "only-render-properties": ""
124
- }, null, 8, ["schema", "name", "filter-properties"])
125
- ], 10, Q))
128
+ }, null, 8, ["schema", "name", "filter-properties"]))
129
+ ], 10, U))
126
130
  ]),
127
131
  _: 2
128
132
  }, 1032, ["index", "record"]))), 128))
129
133
  ]),
130
134
  _: 1
131
135
  }, 8, ["class"]),
132
- (l(!0), s(k, null, $(e(h).properties, (a, t) => (l(), s(k, { key: t }, [
133
- e(J)(a) ? (l(), y(e(T), {
136
+ (a(!0), s(b, null, F(e(u).properties, (r, t) => (a(), s(b, { key: t }, [
137
+ e(O)(r) ? (a(), d(e(_), {
134
138
  key: 0,
135
- schema: a,
139
+ schema: r,
136
140
  name: "addition"
137
- }, null, 8, ["schema"])) : A("", !0)
141
+ }, null, 8, ["schema"])) : k("", !0)
138
142
  ], 64))), 128))
139
143
  ], 2),
140
- o.value.length === 0 ? (l(), s("div", {
144
+ o.modelValue.length === 0 ? (a(), s("div", {
141
145
  key: 0,
142
146
  class: i(`${e(n)}-tabpane`)
143
147
  }, [
144
- v(e(V), { "image-size": 100 })
145
- ], 2)) : A("", !0),
146
- (l(!0), s(k, null, $(o.value, (a, t) => (l(), y(e(c).Item, {
147
- key: e(g)(a, t),
148
+ T(e(D), { "image-size": 100 })
149
+ ], 2)) : k("", !0),
150
+ (a(!0), s(b, null, F(o.modelValue, (r, t) => (a(), d(e(y).Item, {
151
+ key: e(C)(r, t),
148
152
  index: t,
149
- record: a
153
+ record: r
150
154
  }, {
151
- default: f(() => [
152
- (l(), s("div", {
153
- id: `${e(r).props.name}-tab-panel-${t}`,
154
- key: e(g)(a, t),
155
+ default: h(() => [
156
+ (a(), s("div", {
157
+ id: `${e(l).props.name}-tab-panel-${t}`,
158
+ key: e(C)(r, t),
155
159
  class: i(`${e(n)}-tabpane`),
156
- style: z({ display: d.value === t ? void 0 : "none" }),
160
+ style: z({ display: f.value === t ? void 0 : "none" }),
157
161
  role: "tabpanel",
158
- "aria-labelledby": `${e(r).props.name}-tab-${t}`
162
+ "aria-labelledby": `${e(l).props.name}-tab-${t}`
159
163
  }, [
160
- v(e(T), {
161
- schema: e(O)(e(h), t),
164
+ T(e(_), {
165
+ schema: e(Q)(e(u), t),
162
166
  name: t,
163
- "filter-properties": (m) => e(B)(m) ? !1 : o.showTitleFieldInTab ? !e(E)(m, o.tabTitleField) : !0,
167
+ "filter-properties": (c) => e(B)(c) ? !1 : o.showTitleFieldInTab ? !e(E)(c, o.tabTitleField) : !0,
164
168
  "only-render-properties": ""
165
169
  }, null, 8, ["schema", "name", "filter-properties"])
166
- ], 14, U))
170
+ ], 14, W))
167
171
  ]),
168
172
  _: 2
169
173
  }, 1032, ["index", "record"]))), 128))
@@ -172,12 +176,12 @@ import '../styles/array-list-tabs/index.css';const Q = ["id", "aria-controls", "
172
176
  }, 8, ["key-map"]))
173
177
  ], 2));
174
178
  }
175
- }), se = H(W, {
176
- Addition: c.Addition,
177
- Remove: c.Remove
179
+ }), ne = J(X, {
180
+ Addition: y.Addition,
181
+ Remove: y.Remove
178
182
  });
179
183
  export {
180
- se as ArrayListTabs,
181
- se as default
184
+ ne as ArrayListTabs,
185
+ ne as default
182
186
  };
183
187
  //# sourceMappingURL=index.mjs.map