@formily-design/formily-antd 1.0.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/.umirc.js +44 -0
- package/LICENSE.md +20 -0
- package/README.md +106 -0
- package/copy.ts +6 -0
- package/esm/common/Container/index.d.ts +6 -0
- package/esm/common/Container/index.js +13 -0
- package/esm/common/Container/styles.less +5 -0
- package/esm/common/FormItemSwitcher/index.d.ts +6 -0
- package/esm/common/FormItemSwitcher/index.js +7 -0
- package/esm/common/LoadTemplate/index.d.ts +13 -0
- package/esm/common/LoadTemplate/index.js +8 -0
- package/esm/components/ArrayBase/index.d.ts +1 -0
- package/esm/components/ArrayBase/index.js +71 -0
- package/esm/components/ArrayCards/index.d.ts +1 -0
- package/esm/components/ArrayCards/index.js +1 -0
- package/esm/components/ArrayCards/preview.d.ts +4 -0
- package/esm/components/ArrayCards/preview.js +206 -0
- package/esm/components/ArrayCards/styles.less +2 -0
- package/esm/components/ArrayTable/index.d.ts +1 -0
- package/esm/components/ArrayTable/index.js +1 -0
- package/esm/components/ArrayTable/preview.d.ts +4 -0
- package/esm/components/ArrayTable/preview.js +384 -0
- package/esm/components/ArrayTable/styles.less +2 -0
- package/esm/components/Card/index.d.ts +1 -0
- package/esm/components/Card/index.js +1 -0
- package/esm/components/Card/preview.d.ts +4 -0
- package/esm/components/Card/preview.js +34 -0
- package/esm/components/Cascader/index.d.ts +1 -0
- package/esm/components/Cascader/index.js +1 -0
- package/esm/components/Cascader/preview.d.ts +4 -0
- package/esm/components/Cascader/preview.js +28 -0
- package/esm/components/Checkbox/index.d.ts +1 -0
- package/esm/components/Checkbox/index.js +1 -0
- package/esm/components/Checkbox/preview.d.ts +4 -0
- package/esm/components/Checkbox/preview.js +33 -0
- package/esm/components/DatePicker/index.d.ts +1 -0
- package/esm/components/DatePicker/index.js +1 -0
- package/esm/components/DatePicker/preview.d.ts +4 -0
- package/esm/components/DatePicker/preview.js +50 -0
- package/esm/components/Field/index.d.ts +2 -0
- package/esm/components/Field/index.js +2 -0
- package/esm/components/Field/preview.d.ts +3 -0
- package/esm/components/Field/preview.js +127 -0
- package/esm/components/Field/shared.d.ts +649 -0
- package/esm/components/Field/shared.js +242 -0
- package/esm/components/Form/index.d.ts +1 -0
- package/esm/components/Form/index.js +1 -0
- package/esm/components/Form/preview.d.ts +5 -0
- package/esm/components/Form/preview.js +81 -0
- package/esm/components/Form/styles.less +32 -0
- package/esm/components/FormCollapse/index.d.ts +1 -0
- package/esm/components/FormCollapse/index.js +1 -0
- package/esm/components/FormCollapse/preview.d.ts +6 -0
- package/esm/components/FormCollapse/preview.js +116 -0
- package/esm/components/FormGrid/index.d.ts +1 -0
- package/esm/components/FormGrid/index.js +1 -0
- package/esm/components/FormGrid/preview.d.ts +9 -0
- package/esm/components/FormGrid/preview.js +131 -0
- package/esm/components/FormGrid/styles.less +5 -0
- package/esm/components/FormLayout/index.d.ts +1 -0
- package/esm/components/FormLayout/index.js +1 -0
- package/esm/components/FormLayout/preview.d.ts +4 -0
- package/esm/components/FormLayout/preview.js +29 -0
- package/esm/components/FormTab/index.d.ts +1 -0
- package/esm/components/FormTab/index.js +1 -0
- package/esm/components/FormTab/preview.d.ts +6 -0
- package/esm/components/FormTab/preview.js +123 -0
- package/esm/components/Input/index.d.ts +1 -0
- package/esm/components/Input/index.js +1 -0
- package/esm/components/Input/preview.d.ts +4 -0
- package/esm/components/Input/preview.js +50 -0
- package/esm/components/NumberPicker/index.d.ts +1 -0
- package/esm/components/NumberPicker/index.js +1 -0
- package/esm/components/NumberPicker/preview.d.ts +4 -0
- package/esm/components/NumberPicker/preview.js +29 -0
- package/esm/components/Object/index.d.ts +1 -0
- package/esm/components/Object/index.js +1 -0
- package/esm/components/Object/preview.d.ts +4 -0
- package/esm/components/Object/preview.js +26 -0
- package/esm/components/Password/index.d.ts +1 -0
- package/esm/components/Password/index.js +1 -0
- package/esm/components/Password/preview.d.ts +4 -0
- package/esm/components/Password/preview.js +28 -0
- package/esm/components/Radio/index.d.ts +1 -0
- package/esm/components/Radio/index.js +1 -0
- package/esm/components/Radio/preview.d.ts +4 -0
- package/esm/components/Radio/preview.js +33 -0
- package/esm/components/Rate/index.d.ts +1 -0
- package/esm/components/Rate/index.js +1 -0
- package/esm/components/Rate/preview.d.ts +4 -0
- package/esm/components/Rate/preview.js +29 -0
- package/esm/components/Select/index.d.ts +1 -0
- package/esm/components/Select/index.js +1 -0
- package/esm/components/Select/preview.d.ts +4 -0
- package/esm/components/Select/preview.js +28 -0
- package/esm/components/Slider/index.d.ts +1 -0
- package/esm/components/Slider/index.js +1 -0
- package/esm/components/Slider/preview.d.ts +4 -0
- package/esm/components/Slider/preview.js +29 -0
- package/esm/components/Space/index.d.ts +1 -0
- package/esm/components/Space/index.js +1 -0
- package/esm/components/Space/preview.d.ts +4 -0
- package/esm/components/Space/preview.js +30 -0
- package/esm/components/Switch/index.d.ts +1 -0
- package/esm/components/Switch/index.js +1 -0
- package/esm/components/Switch/preview.d.ts +4 -0
- package/esm/components/Switch/preview.js +29 -0
- package/esm/components/Text/index.d.ts +1 -0
- package/esm/components/Text/index.js +1 -0
- package/esm/components/Text/preview.d.ts +11 -0
- package/esm/components/Text/preview.js +32 -0
- package/esm/components/Text/styles.less +10 -0
- package/esm/components/TimePicker/index.d.ts +1 -0
- package/esm/components/TimePicker/index.js +1 -0
- package/esm/components/TimePicker/preview.d.ts +4 -0
- package/esm/components/TimePicker/preview.js +50 -0
- package/esm/components/Transfer/index.d.ts +1 -0
- package/esm/components/Transfer/index.js +1 -0
- package/esm/components/Transfer/preview.d.ts +4 -0
- package/esm/components/Transfer/preview.js +28 -0
- package/esm/components/TreeSelect/index.d.ts +1 -0
- package/esm/components/TreeSelect/index.js +1 -0
- package/esm/components/TreeSelect/preview.d.ts +4 -0
- package/esm/components/TreeSelect/preview.js +28 -0
- package/esm/components/Upload/index.d.ts +1 -0
- package/esm/components/Upload/index.js +1 -0
- package/esm/components/Upload/preview.d.ts +4 -0
- package/esm/components/Upload/preview.js +56 -0
- package/esm/components/index.d.ts +27 -0
- package/esm/components/index.js +27 -0
- package/esm/hooks/index.d.ts +1 -0
- package/esm/hooks/index.js +1 -0
- package/esm/hooks/useDropTemplate.d.ts +2 -0
- package/esm/hooks/useDropTemplate.js +20 -0
- package/esm/index.d.ts +3 -0
- package/esm/index.js +3 -0
- package/esm/locales/ArrayBase.d.ts +77 -0
- package/esm/locales/ArrayBase.js +91 -0
- package/esm/locales/ArrayCards.d.ts +1 -0
- package/esm/locales/ArrayCards.js +19 -0
- package/esm/locales/ArrayTable.d.ts +138 -0
- package/esm/locales/ArrayTable.js +129 -0
- package/esm/locales/Card.d.ts +44 -0
- package/esm/locales/Card.js +44 -0
- package/esm/locales/Cascader.d.ts +59 -0
- package/esm/locales/Cascader.js +59 -0
- package/esm/locales/Checkbox.d.ts +11 -0
- package/esm/locales/Checkbox.js +11 -0
- package/esm/locales/Component.d.ts +53 -0
- package/esm/locales/Component.js +53 -0
- package/esm/locales/DatePicker.d.ts +75 -0
- package/esm/locales/DatePicker.js +86 -0
- package/esm/locales/Field.d.ts +341 -0
- package/esm/locales/Field.js +338 -0
- package/esm/locales/Form.d.ts +1 -0
- package/esm/locales/Form.js +133 -0
- package/esm/locales/FormCollapse.d.ts +88 -0
- package/esm/locales/FormCollapse.js +82 -0
- package/esm/locales/FormGrid.d.ts +76 -0
- package/esm/locales/FormGrid.js +76 -0
- package/esm/locales/FormLayout.d.ts +128 -0
- package/esm/locales/FormLayout.js +122 -0
- package/esm/locales/FormTab.d.ts +82 -0
- package/esm/locales/FormTab.js +82 -0
- package/esm/locales/Input.d.ts +50 -0
- package/esm/locales/Input.js +50 -0
- package/esm/locales/NumberPicker.d.ts +77 -0
- package/esm/locales/NumberPicker.js +77 -0
- package/esm/locales/Object.d.ts +11 -0
- package/esm/locales/Object.js +11 -0
- package/esm/locales/Password.d.ts +1 -0
- package/esm/locales/Password.js +13 -0
- package/esm/locales/Radio.d.ts +47 -0
- package/esm/locales/Radio.js +29 -0
- package/esm/locales/Rate.d.ts +41 -0
- package/esm/locales/Rate.js +32 -0
- package/esm/locales/Select.d.ts +125 -0
- package/esm/locales/Select.js +125 -0
- package/esm/locales/Slider.d.ts +71 -0
- package/esm/locales/Slider.js +71 -0
- package/esm/locales/Space.d.ts +53 -0
- package/esm/locales/Space.js +50 -0
- package/esm/locales/Switch.d.ts +11 -0
- package/esm/locales/Switch.js +11 -0
- package/esm/locales/Text.d.ts +38 -0
- package/esm/locales/Text.js +38 -0
- package/esm/locales/TextArea.d.ts +35 -0
- package/esm/locales/TextArea.js +35 -0
- package/esm/locales/TimePicker.d.ts +2 -0
- package/esm/locales/TimePicker.js +72 -0
- package/esm/locales/Transfer.d.ts +56 -0
- package/esm/locales/Transfer.js +38 -0
- package/esm/locales/TreeSelect.d.ts +181 -0
- package/esm/locales/TreeSelect.js +178 -0
- package/esm/locales/Upload.d.ts +78 -0
- package/esm/locales/Upload.js +92 -0
- package/esm/locales/Void.d.ts +11 -0
- package/esm/locales/Void.js +11 -0
- package/esm/locales/all.d.ts +31 -0
- package/esm/locales/all.js +31 -0
- package/esm/locales/index.d.ts +2 -0
- package/esm/locales/index.js +2 -0
- package/esm/schemas/ArrayCards.d.ts +59 -0
- package/esm/schemas/ArrayCards.js +4 -0
- package/esm/schemas/ArrayTable.d.ts +5 -0
- package/esm/schemas/ArrayTable.js +111 -0
- package/esm/schemas/CSSStyle.d.ts +2 -0
- package/esm/schemas/CSSStyle.js +49 -0
- package/esm/schemas/Card.d.ts +4 -0
- package/esm/schemas/Card.js +45 -0
- package/esm/schemas/Cascader.d.ts +2 -0
- package/esm/schemas/Cascader.js +74 -0
- package/esm/schemas/Checkbox.d.ts +4 -0
- package/esm/schemas/Checkbox.js +10 -0
- package/esm/schemas/DatePicker.d.ts +4 -0
- package/esm/schemas/DatePicker.js +104 -0
- package/esm/schemas/Form.d.ts +2 -0
- package/esm/schemas/Form.js +6 -0
- package/esm/schemas/FormCollapse.d.ts +4 -0
- package/esm/schemas/FormCollapse.js +58 -0
- package/esm/schemas/FormGrid.d.ts +4 -0
- package/esm/schemas/FormGrid.js +76 -0
- package/esm/schemas/FormItem.d.ts +2 -0
- package/esm/schemas/FormItem.js +138 -0
- package/esm/schemas/FormLayout.d.ts +2 -0
- package/esm/schemas/FormLayout.js +121 -0
- package/esm/schemas/FormTab.d.ts +4 -0
- package/esm/schemas/FormTab.js +43 -0
- package/esm/schemas/Input.d.ts +4 -0
- package/esm/schemas/Input.js +89 -0
- package/esm/schemas/NumberPicker.d.ts +2 -0
- package/esm/schemas/NumberPicker.js +79 -0
- package/esm/schemas/Password.d.ts +2 -0
- package/esm/schemas/Password.js +9 -0
- package/esm/schemas/Radio.d.ts +4 -0
- package/esm/schemas/Radio.js +35 -0
- package/esm/schemas/Rate.d.ts +2 -0
- package/esm/schemas/Rate.js +38 -0
- package/esm/schemas/Select.d.ts +2 -0
- package/esm/schemas/Select.js +159 -0
- package/esm/schemas/Slider.d.ts +2 -0
- package/esm/schemas/Slider.js +77 -0
- package/esm/schemas/Space.d.ts +2 -0
- package/esm/schemas/Space.js +39 -0
- package/esm/schemas/Switch.d.ts +2 -0
- package/esm/schemas/Switch.js +19 -0
- package/esm/schemas/Text.d.ts +2 -0
- package/esm/schemas/Text.js +19 -0
- package/esm/schemas/TimePicker.d.ts +116 -0
- package/esm/schemas/TimePicker.js +120 -0
- package/esm/schemas/Transfer.d.ts +2 -0
- package/esm/schemas/Transfer.js +44 -0
- package/esm/schemas/TreeSelect.d.ts +2 -0
- package/esm/schemas/TreeSelect.js +137 -0
- package/esm/schemas/Upload.d.ts +4 -0
- package/esm/schemas/Upload.js +99 -0
- package/esm/schemas/all.d.ts +27 -0
- package/esm/schemas/all.js +27 -0
- package/esm/schemas/index.d.ts +2 -0
- package/esm/schemas/index.js +2 -0
- package/esm/shared.d.ts +13 -0
- package/esm/shared.js +86 -0
- package/lib/common/Container/index.d.ts +6 -0
- package/lib/common/Container/index.js +20 -0
- package/lib/common/Container/styles.less +5 -0
- package/lib/common/FormItemSwitcher/index.d.ts +6 -0
- package/lib/common/FormItemSwitcher/index.js +14 -0
- package/lib/common/LoadTemplate/index.d.ts +13 -0
- package/lib/common/LoadTemplate/index.js +15 -0
- package/lib/components/ArrayBase/index.d.ts +1 -0
- package/lib/components/ArrayBase/index.js +75 -0
- package/lib/components/ArrayCards/index.d.ts +1 -0
- package/lib/components/ArrayCards/index.js +17 -0
- package/lib/components/ArrayCards/preview.d.ts +4 -0
- package/lib/components/ArrayCards/preview.js +245 -0
- package/lib/components/ArrayCards/styles.less +2 -0
- package/lib/components/ArrayTable/index.d.ts +1 -0
- package/lib/components/ArrayTable/index.js +17 -0
- package/lib/components/ArrayTable/preview.d.ts +4 -0
- package/lib/components/ArrayTable/preview.js +390 -0
- package/lib/components/ArrayTable/styles.less +2 -0
- package/lib/components/Card/index.d.ts +1 -0
- package/lib/components/Card/index.js +17 -0
- package/lib/components/Card/preview.d.ts +4 -0
- package/lib/components/Card/preview.js +41 -0
- package/lib/components/Cascader/index.d.ts +1 -0
- package/lib/components/Cascader/index.js +17 -0
- package/lib/components/Cascader/preview.d.ts +4 -0
- package/lib/components/Cascader/preview.js +31 -0
- package/lib/components/Checkbox/index.d.ts +1 -0
- package/lib/components/Checkbox/index.js +17 -0
- package/lib/components/Checkbox/preview.d.ts +4 -0
- package/lib/components/Checkbox/preview.js +36 -0
- package/lib/components/DatePicker/index.d.ts +1 -0
- package/lib/components/DatePicker/index.js +17 -0
- package/lib/components/DatePicker/preview.d.ts +4 -0
- package/lib/components/DatePicker/preview.js +53 -0
- package/lib/components/Field/index.d.ts +2 -0
- package/lib/components/Field/index.js +18 -0
- package/lib/components/Field/preview.d.ts +3 -0
- package/lib/components/Field/preview.js +133 -0
- package/lib/components/Field/shared.d.ts +649 -0
- package/lib/components/Field/shared.js +248 -0
- package/lib/components/Form/index.d.ts +1 -0
- package/lib/components/Form/index.js +17 -0
- package/lib/components/Form/preview.d.ts +5 -0
- package/lib/components/Form/preview.js +117 -0
- package/lib/components/Form/styles.less +32 -0
- package/lib/components/FormCollapse/index.d.ts +1 -0
- package/lib/components/FormCollapse/index.js +17 -0
- package/lib/components/FormCollapse/preview.d.ts +6 -0
- package/lib/components/FormCollapse/preview.js +152 -0
- package/lib/components/FormGrid/index.d.ts +1 -0
- package/lib/components/FormGrid/index.js +17 -0
- package/lib/components/FormGrid/preview.d.ts +9 -0
- package/lib/components/FormGrid/preview.js +137 -0
- package/lib/components/FormGrid/styles.less +5 -0
- package/lib/components/FormLayout/index.d.ts +1 -0
- package/lib/components/FormLayout/index.js +17 -0
- package/lib/components/FormLayout/preview.d.ts +4 -0
- package/lib/components/FormLayout/preview.js +32 -0
- package/lib/components/FormTab/index.d.ts +1 -0
- package/lib/components/FormTab/index.js +17 -0
- package/lib/components/FormTab/preview.d.ts +6 -0
- package/lib/components/FormTab/preview.js +159 -0
- package/lib/components/Input/index.d.ts +1 -0
- package/lib/components/Input/index.js +17 -0
- package/lib/components/Input/preview.d.ts +4 -0
- package/lib/components/Input/preview.js +53 -0
- package/lib/components/NumberPicker/index.d.ts +1 -0
- package/lib/components/NumberPicker/index.js +17 -0
- package/lib/components/NumberPicker/preview.d.ts +4 -0
- package/lib/components/NumberPicker/preview.js +32 -0
- package/lib/components/Object/index.d.ts +1 -0
- package/lib/components/Object/index.js +17 -0
- package/lib/components/Object/preview.d.ts +4 -0
- package/lib/components/Object/preview.js +29 -0
- package/lib/components/Password/index.d.ts +1 -0
- package/lib/components/Password/index.js +17 -0
- package/lib/components/Password/preview.d.ts +4 -0
- package/lib/components/Password/preview.js +31 -0
- package/lib/components/Radio/index.d.ts +1 -0
- package/lib/components/Radio/index.js +17 -0
- package/lib/components/Radio/preview.d.ts +4 -0
- package/lib/components/Radio/preview.js +36 -0
- package/lib/components/Rate/index.d.ts +1 -0
- package/lib/components/Rate/index.js +17 -0
- package/lib/components/Rate/preview.d.ts +4 -0
- package/lib/components/Rate/preview.js +32 -0
- package/lib/components/Select/index.d.ts +1 -0
- package/lib/components/Select/index.js +17 -0
- package/lib/components/Select/preview.d.ts +4 -0
- package/lib/components/Select/preview.js +31 -0
- package/lib/components/Slider/index.d.ts +1 -0
- package/lib/components/Slider/index.js +17 -0
- package/lib/components/Slider/preview.d.ts +4 -0
- package/lib/components/Slider/preview.js +32 -0
- package/lib/components/Space/index.d.ts +1 -0
- package/lib/components/Space/index.js +17 -0
- package/lib/components/Space/preview.d.ts +4 -0
- package/lib/components/Space/preview.js +33 -0
- package/lib/components/Switch/index.d.ts +1 -0
- package/lib/components/Switch/index.js +17 -0
- package/lib/components/Switch/preview.d.ts +4 -0
- package/lib/components/Switch/preview.js +32 -0
- package/lib/components/Text/index.d.ts +1 -0
- package/lib/components/Text/index.js +17 -0
- package/lib/components/Text/preview.d.ts +11 -0
- package/lib/components/Text/preview.js +39 -0
- package/lib/components/Text/styles.less +10 -0
- package/lib/components/TimePicker/index.d.ts +1 -0
- package/lib/components/TimePicker/index.js +17 -0
- package/lib/components/TimePicker/preview.d.ts +4 -0
- package/lib/components/TimePicker/preview.js +53 -0
- package/lib/components/Transfer/index.d.ts +1 -0
- package/lib/components/Transfer/index.js +17 -0
- package/lib/components/Transfer/preview.d.ts +4 -0
- package/lib/components/Transfer/preview.js +31 -0
- package/lib/components/TreeSelect/index.d.ts +1 -0
- package/lib/components/TreeSelect/index.js +17 -0
- package/lib/components/TreeSelect/preview.d.ts +4 -0
- package/lib/components/TreeSelect/preview.js +31 -0
- package/lib/components/Upload/index.d.ts +1 -0
- package/lib/components/Upload/index.js +17 -0
- package/lib/components/Upload/preview.d.ts +4 -0
- package/lib/components/Upload/preview.js +59 -0
- package/lib/components/index.d.ts +27 -0
- package/lib/components/index.js +43 -0
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +17 -0
- package/lib/hooks/useDropTemplate.d.ts +2 -0
- package/lib/hooks/useDropTemplate.js +24 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +19 -0
- package/lib/locales/ArrayBase.d.ts +77 -0
- package/lib/locales/ArrayBase.js +94 -0
- package/lib/locales/ArrayCards.d.ts +1 -0
- package/lib/locales/ArrayCards.js +22 -0
- package/lib/locales/ArrayTable.d.ts +138 -0
- package/lib/locales/ArrayTable.js +132 -0
- package/lib/locales/Card.d.ts +44 -0
- package/lib/locales/Card.js +47 -0
- package/lib/locales/Cascader.d.ts +59 -0
- package/lib/locales/Cascader.js +62 -0
- package/lib/locales/Checkbox.d.ts +11 -0
- package/lib/locales/Checkbox.js +14 -0
- package/lib/locales/Component.d.ts +53 -0
- package/lib/locales/Component.js +56 -0
- package/lib/locales/DatePicker.d.ts +75 -0
- package/lib/locales/DatePicker.js +89 -0
- package/lib/locales/Field.d.ts +341 -0
- package/lib/locales/Field.js +341 -0
- package/lib/locales/Form.d.ts +1 -0
- package/lib/locales/Form.js +136 -0
- package/lib/locales/FormCollapse.d.ts +88 -0
- package/lib/locales/FormCollapse.js +85 -0
- package/lib/locales/FormGrid.d.ts +76 -0
- package/lib/locales/FormGrid.js +79 -0
- package/lib/locales/FormLayout.d.ts +128 -0
- package/lib/locales/FormLayout.js +125 -0
- package/lib/locales/FormTab.d.ts +82 -0
- package/lib/locales/FormTab.js +85 -0
- package/lib/locales/Input.d.ts +50 -0
- package/lib/locales/Input.js +53 -0
- package/lib/locales/NumberPicker.d.ts +77 -0
- package/lib/locales/NumberPicker.js +80 -0
- package/lib/locales/Object.d.ts +11 -0
- package/lib/locales/Object.js +14 -0
- package/lib/locales/Password.d.ts +1 -0
- package/lib/locales/Password.js +16 -0
- package/lib/locales/Radio.d.ts +47 -0
- package/lib/locales/Radio.js +32 -0
- package/lib/locales/Rate.d.ts +41 -0
- package/lib/locales/Rate.js +35 -0
- package/lib/locales/Select.d.ts +125 -0
- package/lib/locales/Select.js +128 -0
- package/lib/locales/Slider.d.ts +71 -0
- package/lib/locales/Slider.js +74 -0
- package/lib/locales/Space.d.ts +53 -0
- package/lib/locales/Space.js +53 -0
- package/lib/locales/Switch.d.ts +11 -0
- package/lib/locales/Switch.js +14 -0
- package/lib/locales/Text.d.ts +38 -0
- package/lib/locales/Text.js +41 -0
- package/lib/locales/TextArea.d.ts +35 -0
- package/lib/locales/TextArea.js +38 -0
- package/lib/locales/TimePicker.d.ts +2 -0
- package/lib/locales/TimePicker.js +75 -0
- package/lib/locales/Transfer.d.ts +56 -0
- package/lib/locales/Transfer.js +41 -0
- package/lib/locales/TreeSelect.d.ts +181 -0
- package/lib/locales/TreeSelect.js +181 -0
- package/lib/locales/Upload.d.ts +78 -0
- package/lib/locales/Upload.js +95 -0
- package/lib/locales/Void.d.ts +11 -0
- package/lib/locales/Void.js +14 -0
- package/lib/locales/all.d.ts +31 -0
- package/lib/locales/all.js +47 -0
- package/lib/locales/index.d.ts +2 -0
- package/lib/locales/index.js +38 -0
- package/lib/schemas/ArrayCards.d.ts +59 -0
- package/lib/schemas/ArrayCards.js +7 -0
- package/lib/schemas/ArrayTable.d.ts +5 -0
- package/lib/schemas/ArrayTable.js +114 -0
- package/lib/schemas/CSSStyle.d.ts +2 -0
- package/lib/schemas/CSSStyle.js +52 -0
- package/lib/schemas/Card.d.ts +4 -0
- package/lib/schemas/Card.js +48 -0
- package/lib/schemas/Cascader.d.ts +2 -0
- package/lib/schemas/Cascader.js +77 -0
- package/lib/schemas/Checkbox.d.ts +4 -0
- package/lib/schemas/Checkbox.js +13 -0
- package/lib/schemas/DatePicker.d.ts +4 -0
- package/lib/schemas/DatePicker.js +107 -0
- package/lib/schemas/Form.d.ts +2 -0
- package/lib/schemas/Form.js +9 -0
- package/lib/schemas/FormCollapse.d.ts +4 -0
- package/lib/schemas/FormCollapse.js +61 -0
- package/lib/schemas/FormGrid.d.ts +4 -0
- package/lib/schemas/FormGrid.js +79 -0
- package/lib/schemas/FormItem.d.ts +2 -0
- package/lib/schemas/FormItem.js +141 -0
- package/lib/schemas/FormLayout.d.ts +2 -0
- package/lib/schemas/FormLayout.js +124 -0
- package/lib/schemas/FormTab.d.ts +4 -0
- package/lib/schemas/FormTab.js +46 -0
- package/lib/schemas/Input.d.ts +4 -0
- package/lib/schemas/Input.js +92 -0
- package/lib/schemas/NumberPicker.d.ts +2 -0
- package/lib/schemas/NumberPicker.js +82 -0
- package/lib/schemas/Password.d.ts +2 -0
- package/lib/schemas/Password.js +12 -0
- package/lib/schemas/Radio.d.ts +4 -0
- package/lib/schemas/Radio.js +38 -0
- package/lib/schemas/Rate.d.ts +2 -0
- package/lib/schemas/Rate.js +41 -0
- package/lib/schemas/Select.d.ts +2 -0
- package/lib/schemas/Select.js +162 -0
- package/lib/schemas/Slider.d.ts +2 -0
- package/lib/schemas/Slider.js +80 -0
- package/lib/schemas/Space.d.ts +2 -0
- package/lib/schemas/Space.js +42 -0
- package/lib/schemas/Switch.d.ts +2 -0
- package/lib/schemas/Switch.js +22 -0
- package/lib/schemas/Text.d.ts +2 -0
- package/lib/schemas/Text.js +22 -0
- package/lib/schemas/TimePicker.d.ts +116 -0
- package/lib/schemas/TimePicker.js +123 -0
- package/lib/schemas/Transfer.d.ts +2 -0
- package/lib/schemas/Transfer.js +47 -0
- package/lib/schemas/TreeSelect.d.ts +2 -0
- package/lib/schemas/TreeSelect.js +140 -0
- package/lib/schemas/Upload.d.ts +4 -0
- package/lib/schemas/Upload.js +102 -0
- package/lib/schemas/all.d.ts +27 -0
- package/lib/schemas/all.js +43 -0
- package/lib/schemas/index.d.ts +2 -0
- package/lib/schemas/index.js +38 -0
- package/lib/shared.d.ts +13 -0
- package/lib/shared.js +98 -0
- package/package.json +75 -0
- package/playground/components/AsyncSelect/AsyncSelect.tsx +38 -0
- package/playground/components/AsyncSelect/index.tsx +1 -0
- package/playground/components/AsyncSelect/preview.tsx +36 -0
- package/playground/components/ClickEventSetter/ActionConfigModal.tsx +173 -0
- package/playground/components/ClickEventSetter/ActionList.tsx +67 -0
- package/playground/components/ClickEventSetter/DownloadPanel.tsx +24 -0
- package/playground/components/ClickEventSetter/NavigationPanel.tsx +42 -0
- package/playground/components/ClickEventSetter/RequestPanel.tsx +190 -0
- package/playground/components/ClickEventSetter/index.tsx +90 -0
- package/playground/components/ClickEventSetter/styles.less +89 -0
- package/playground/components/ClickEventSetter/types.ts +43 -0
- package/playground/components/FormButton/FormButton.tsx +189 -0
- package/playground/components/FormButton/hooks/useEventActionExecutor.ts +65 -0
- package/playground/components/FormButton/index.ts +1 -0
- package/playground/components/FormButton/preview.tsx +60 -0
- package/playground/components/FormButton/utils/actionExecutors.ts +96 -0
- package/playground/components/FormButtonGroup/FormButtonGroup.tsx +21 -0
- package/playground/components/FormButtonGroup/index.ts +1 -0
- package/playground/components/FormButtonGroup/preview.tsx +66 -0
- package/playground/components/FormList/FormList.tsx +164 -0
- package/playground/components/FormList/index.tsx +1 -0
- package/playground/components/FormList/preview.tsx +429 -0
- package/playground/components/LocationPicker/LocationModal.tsx +328 -0
- package/playground/components/LocationPicker/LocationPicker.tsx +163 -0
- package/playground/components/LocationPicker/SearchBox.tsx +122 -0
- package/playground/components/LocationPicker/api.ts +77 -0
- package/playground/components/LocationPicker/constants.ts +2 -0
- package/playground/components/LocationPicker/index.tsx +44 -0
- package/playground/components/LocationPicker/types.ts +160 -0
- package/playground/components/LocationPicker/utils.ts +46 -0
- package/playground/components/ResourceIcon/index.module.less +10 -0
- package/playground/components/ResourceIcon/index.tsx +10 -0
- package/playground/designerLocales/en-US.ts +38 -0
- package/playground/designerLocales/index.ts +6 -0
- package/playground/designerLocales/ko-KR.ts +10 -0
- package/playground/designerLocales/zh-CN.ts +38 -0
- package/playground/locales/FormButton.ts +38 -0
- package/playground/locales/FormButtonGroup.ts +29 -0
- package/playground/locales/LocationPicker.ts +30 -0
- package/playground/locales/all.ts +3 -0
- package/playground/locales/index.ts +3 -0
- package/playground/main.tsx +222 -0
- package/playground/react-app-env.d.ts +4 -0
- package/playground/request.ts +123 -0
- package/playground/schemas/FormButton.ts +42 -0
- package/playground/schemas/FormButtonGroup.ts +24 -0
- package/playground/schemas/LocationPicker.ts +14 -0
- package/playground/schemas/all.ts +3 -0
- package/playground/schemas/index.ts +3 -0
- package/playground/service/index.ts +1 -0
- package/playground/service/schema.ts +22 -0
- package/playground/template.ejs +20 -0
- package/playground/utils.ts +744 -0
- package/playground/webpack.base.ts +123 -0
- package/playground/webpack.dev.ts +64 -0
- package/playground/webpack.prod.ts +46 -0
- package/playground/widgets/ActionsWidget.tsx +58 -0
- package/playground/widgets/LogoWidget.tsx +20 -0
- package/playground/widgets/MarkupSchemaWidget.tsx +164 -0
- package/playground/widgets/PreviewWidget.tsx +188 -0
- package/playground/widgets/SchemaEditorWidget.tsx +27 -0
- package/playground/widgets/index.ts +5 -0
- package/tsconfig.build.json +12 -0
package/lib/shared.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TreeNode, Engine } from '@formily-design/core';
|
|
2
|
+
export type ComponentNameMatcher = string | string[] | ((name: string, node: TreeNode, context?: any) => boolean);
|
|
3
|
+
export declare const matchComponent: (node: TreeNode, name: ComponentNameMatcher, context?: any) => boolean;
|
|
4
|
+
export declare const matchChildComponent: (node: TreeNode, name: ComponentNameMatcher, context?: any) => boolean;
|
|
5
|
+
export declare const includesComponent: (node: TreeNode, names: ComponentNameMatcher[], target?: TreeNode) => boolean;
|
|
6
|
+
export declare const queryNodesByComponentPath: (node: TreeNode, path: ComponentNameMatcher[]) => TreeNode[];
|
|
7
|
+
export declare const findNodeByComponentPath: (node: TreeNode, path: ComponentNameMatcher[]) => TreeNode;
|
|
8
|
+
export declare const hasNodeByComponentPath: (node: TreeNode, path: ComponentNameMatcher[]) => boolean;
|
|
9
|
+
export declare const matchArrayItemsNode: (node: TreeNode) => boolean;
|
|
10
|
+
export declare const createNodeId: (designer: Engine, id: string) => {
|
|
11
|
+
[x: string]: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const createEnsureTypeItemsNode: (type: string) => (node: TreeNode) => TreeNode;
|
package/lib/shared.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createEnsureTypeItemsNode = exports.createNodeId = exports.matchArrayItemsNode = exports.hasNodeByComponentPath = exports.findNodeByComponentPath = exports.queryNodesByComponentPath = exports.includesComponent = exports.matchChildComponent = exports.matchComponent = void 0;
|
|
4
|
+
const core_1 = require("@formily-design/core");
|
|
5
|
+
const matchComponent = (node, name, context) => {
|
|
6
|
+
var _a;
|
|
7
|
+
if (name === '*')
|
|
8
|
+
return true;
|
|
9
|
+
const componentName = (_a = node === null || node === void 0 ? void 0 : node.props) === null || _a === void 0 ? void 0 : _a['x-component'];
|
|
10
|
+
if (typeof name === 'function')
|
|
11
|
+
return name(componentName || '', node, context);
|
|
12
|
+
if (Array.isArray(name))
|
|
13
|
+
return name.includes(componentName);
|
|
14
|
+
return componentName === name;
|
|
15
|
+
};
|
|
16
|
+
exports.matchComponent = matchComponent;
|
|
17
|
+
const matchChildComponent = (node, name, context) => {
|
|
18
|
+
var _a;
|
|
19
|
+
if (name === '*')
|
|
20
|
+
return true;
|
|
21
|
+
const componentName = (_a = node === null || node === void 0 ? void 0 : node.props) === null || _a === void 0 ? void 0 : _a['x-component'];
|
|
22
|
+
if (!componentName)
|
|
23
|
+
return false;
|
|
24
|
+
if (typeof name === 'function')
|
|
25
|
+
return name(componentName || '', node, context);
|
|
26
|
+
if (Array.isArray(name))
|
|
27
|
+
return name.includes(componentName);
|
|
28
|
+
return componentName.indexOf(`${name}.`) > -1;
|
|
29
|
+
};
|
|
30
|
+
exports.matchChildComponent = matchChildComponent;
|
|
31
|
+
const includesComponent = (node, names, target) => {
|
|
32
|
+
return names.some((name) => (0, exports.matchComponent)(node, name, target));
|
|
33
|
+
};
|
|
34
|
+
exports.includesComponent = includesComponent;
|
|
35
|
+
const queryNodesByComponentPath = (node, path) => {
|
|
36
|
+
if ((path === null || path === void 0 ? void 0 : path.length) === 0)
|
|
37
|
+
return [];
|
|
38
|
+
if ((path === null || path === void 0 ? void 0 : path.length) === 1) {
|
|
39
|
+
if ((0, exports.matchComponent)(node, path[0])) {
|
|
40
|
+
return [node];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return (0, exports.matchComponent)(node, path[0])
|
|
44
|
+
? node.children.reduce((buf, child) => {
|
|
45
|
+
return buf.concat((0, exports.queryNodesByComponentPath)(child, path.slice(1)));
|
|
46
|
+
}, [])
|
|
47
|
+
: [];
|
|
48
|
+
};
|
|
49
|
+
exports.queryNodesByComponentPath = queryNodesByComponentPath;
|
|
50
|
+
const findNodeByComponentPath = (node, path) => {
|
|
51
|
+
if ((path === null || path === void 0 ? void 0 : path.length) === 0)
|
|
52
|
+
return;
|
|
53
|
+
if ((path === null || path === void 0 ? void 0 : path.length) === 1) {
|
|
54
|
+
if ((0, exports.matchComponent)(node, path[0])) {
|
|
55
|
+
return node;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if ((0, exports.matchComponent)(node, path[0])) {
|
|
59
|
+
for (let i = 0; i < node.children.length; i++) {
|
|
60
|
+
const next = (0, exports.findNodeByComponentPath)(node.children[i], path.slice(1));
|
|
61
|
+
if (next) {
|
|
62
|
+
return next;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
exports.findNodeByComponentPath = findNodeByComponentPath;
|
|
68
|
+
const hasNodeByComponentPath = (node, path) => !!(0, exports.findNodeByComponentPath)(node, path);
|
|
69
|
+
exports.hasNodeByComponentPath = hasNodeByComponentPath;
|
|
70
|
+
const matchArrayItemsNode = (node) => {
|
|
71
|
+
var _a, _b, _c, _d;
|
|
72
|
+
return (((_b = (_a = node === null || node === void 0 ? void 0 : node.parent) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.type) === 'array' &&
|
|
73
|
+
((_d = (_c = node === null || node === void 0 ? void 0 : node.parent) === null || _c === void 0 ? void 0 : _c.children) === null || _d === void 0 ? void 0 : _d[0]) === node);
|
|
74
|
+
};
|
|
75
|
+
exports.matchArrayItemsNode = matchArrayItemsNode;
|
|
76
|
+
const createNodeId = (designer, id) => {
|
|
77
|
+
return {
|
|
78
|
+
[designer.props.nodeIdAttrName]: id,
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
exports.createNodeId = createNodeId;
|
|
82
|
+
const createEnsureTypeItemsNode = (type) => (node) => {
|
|
83
|
+
const objectNode = node.children.find((child) => child.props['type'] === type);
|
|
84
|
+
if (objectNode) {
|
|
85
|
+
return objectNode;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const newObjectNode = new core_1.TreeNode({
|
|
89
|
+
componentName: 'Field',
|
|
90
|
+
props: {
|
|
91
|
+
type,
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
node.prepend(newObjectNode);
|
|
95
|
+
return newObjectNode;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
exports.createEnsureTypeItemsNode = createEnsureTypeItemsNode;
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@formily-design/formily-antd",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"main": "lib",
|
|
6
|
+
"module": "esm",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/alibaba/designable.git"
|
|
10
|
+
},
|
|
11
|
+
"types": "esm/index.d.ts",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/alibaba/designable/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/alibaba/designable#readme",
|
|
16
|
+
"engines": {
|
|
17
|
+
"npm": ">=3.0.0"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "rimraf -rf lib esm dist && npm run build:cjs && npm run build:esm && ts-node copy",
|
|
21
|
+
"build:cjs": "tsc --project tsconfig.build.json",
|
|
22
|
+
"build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir esm",
|
|
23
|
+
"build:playground": "webpack-cli --config playground/webpack.prod.ts",
|
|
24
|
+
"start": "webpack-dev-server --config playground/webpack.dev.ts"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@formily-design/react-settings-form": "1.0.0",
|
|
28
|
+
"@formily/antd-v5": "^1.2.4",
|
|
29
|
+
"@formily/core": "^2.0.2",
|
|
30
|
+
"@formily/react": "^2.0.2",
|
|
31
|
+
"@formily/reactive": "^2.0.2",
|
|
32
|
+
"@formily/shared": "^2.0.2",
|
|
33
|
+
"autoprefixer": "^9.0",
|
|
34
|
+
"file-loader": "^5.0.2",
|
|
35
|
+
"fs-extra": "^8.1.0",
|
|
36
|
+
"html-webpack-plugin": "^3.2.0",
|
|
37
|
+
"jsonp": "^0.2.1",
|
|
38
|
+
"mini-css-extract-plugin": "^1.6.0",
|
|
39
|
+
"monaco-editor-webpack-plugin": "^4.0.0",
|
|
40
|
+
"raw-loader": "^4.0.0",
|
|
41
|
+
"react-monaco-editor": "^0.43.0",
|
|
42
|
+
"style-loader": "^1.1.3",
|
|
43
|
+
"tlbs-map-react": "^1.1.1",
|
|
44
|
+
"ts-loader": "^7.0.4",
|
|
45
|
+
"typescript": "^5.3.2",
|
|
46
|
+
"webpack": "^4.41.5",
|
|
47
|
+
"webpack-bundle-analyzer": "^3.9.0",
|
|
48
|
+
"webpack-cli": "^3.3.10",
|
|
49
|
+
"webpack-dev-server": "^3.10.1"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"@formily/antd-v5": "^1.2.4",
|
|
53
|
+
"@formily/core": "^2.0.2",
|
|
54
|
+
"@formily/react": "^2.0.2",
|
|
55
|
+
"@formily/reactive": "^2.0.2",
|
|
56
|
+
"@formily/shared": "^2.0.2",
|
|
57
|
+
"@types/react": ">=16.8.0 || >=17.0.0",
|
|
58
|
+
"@types/react-dom": ">=16.8.0 || >=17.0.0",
|
|
59
|
+
"antd": "^5.29.3",
|
|
60
|
+
"react": ">=16.8.0 || >=17.0.0",
|
|
61
|
+
"react-dom": ">=16.8.0",
|
|
62
|
+
"react-is": ">=16.8.0 || >=17.0.0"
|
|
63
|
+
},
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"@formily-design/core": "1.0.0",
|
|
66
|
+
"@formily-design/formily-setters": "1.0.0",
|
|
67
|
+
"@formily-design/formily-transformer": "1.0.0",
|
|
68
|
+
"@formily-design/react": "1.0.0",
|
|
69
|
+
"@formily-design/shared": "1.0.0"
|
|
70
|
+
},
|
|
71
|
+
"publishConfig": {
|
|
72
|
+
"access": "public"
|
|
73
|
+
},
|
|
74
|
+
"gitHead": "f3496a519e4be3f14900ddbe44744ae482247047"
|
|
75
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { LoadingOutlined } from '@ant-design/icons'
|
|
2
|
+
import { PreviewText } from '@formily/antd-v5'
|
|
3
|
+
import { isField } from '@formily/core'
|
|
4
|
+
import { connect, mapProps, mapReadPretty, useField } from '@formily/react'
|
|
5
|
+
import { Select, SelectProps } from 'antd'
|
|
6
|
+
import React from 'react'
|
|
7
|
+
|
|
8
|
+
export type AsyncSelectProps = SelectProps
|
|
9
|
+
function AsyncSelectComponent(props: AsyncSelectProps) {
|
|
10
|
+
const field = useField()
|
|
11
|
+
console.info('AsyncSelectComponent', props, field)
|
|
12
|
+
return <Select {...props} />
|
|
13
|
+
}
|
|
14
|
+
export const AsyncSelect: React.FC<AsyncSelectProps> = connect(
|
|
15
|
+
AsyncSelectComponent,
|
|
16
|
+
mapProps(
|
|
17
|
+
{
|
|
18
|
+
dataSource: 'options',
|
|
19
|
+
data: true,
|
|
20
|
+
loading: true,
|
|
21
|
+
},
|
|
22
|
+
(props, field) => {
|
|
23
|
+
if (isField(field)) {
|
|
24
|
+
return {
|
|
25
|
+
...props,
|
|
26
|
+
suffixIcon:
|
|
27
|
+
field?.loading || field?.validating ? (
|
|
28
|
+
<LoadingOutlined />
|
|
29
|
+
) : (
|
|
30
|
+
props.suffixIcon
|
|
31
|
+
),
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return props
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
mapReadPretty(PreviewText.Select)
|
|
38
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './preview'
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { createBehavior, createResource } from '@formily-design/core'
|
|
3
|
+
import { DnFC } from '@formily-design/react'
|
|
4
|
+
import { AsyncSelect as SelectComponent } from './AsyncSelect'
|
|
5
|
+
import {
|
|
6
|
+
AllLocales,
|
|
7
|
+
AllSchemas,
|
|
8
|
+
createFieldSchema,
|
|
9
|
+
} from '@formily-design/formily-antd'
|
|
10
|
+
|
|
11
|
+
export const AsyncSelect: DnFC<React.ComponentProps<typeof SelectComponent>> =
|
|
12
|
+
SelectComponent
|
|
13
|
+
|
|
14
|
+
AsyncSelect.Behavior = createBehavior({
|
|
15
|
+
name: 'AsyncSelect',
|
|
16
|
+
extends: ['Field'],
|
|
17
|
+
selector: (node) => node.props?.['x-component'] === 'AsyncSelect',
|
|
18
|
+
designerProps: {
|
|
19
|
+
propsSchema: createFieldSchema(AllSchemas.Select),
|
|
20
|
+
},
|
|
21
|
+
designerLocales: AllLocales.Select,
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
AsyncSelect.Resource = createResource({
|
|
25
|
+
icon: 'SelectSource',
|
|
26
|
+
elements: [
|
|
27
|
+
{
|
|
28
|
+
componentName: 'Field',
|
|
29
|
+
props: {
|
|
30
|
+
title: 'AsyncSelect',
|
|
31
|
+
'x-decorator': 'FormItem',
|
|
32
|
+
'x-component': 'AsyncSelect',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
})
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react'
|
|
2
|
+
import { Form, Tabs, Button, Input, Select } from 'antd'
|
|
3
|
+
import { TextWidget } from '@formily-design/react'
|
|
4
|
+
import { IEventAction, EventActionType, IRequestAction } from './types'
|
|
5
|
+
import { RequestPanel } from './RequestPanel'
|
|
6
|
+
import { NavigationPanel } from './NavigationPanel'
|
|
7
|
+
import { DownloadPanel } from './DownloadPanel'
|
|
8
|
+
import './styles.less'
|
|
9
|
+
|
|
10
|
+
export interface IActionConfigModalProps {
|
|
11
|
+
editingAction: IEventAction | null
|
|
12
|
+
onSave: (action: IEventAction) => void
|
|
13
|
+
onCancel: () => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type IActionConfigFormValues =
|
|
17
|
+
| Exclude<IEventAction, IRequestAction>
|
|
18
|
+
| (Omit<IRequestAction, 'headers' | 'params'> & {
|
|
19
|
+
headers: { key: string; value: string }[]
|
|
20
|
+
params: { key: string; value: string }[]
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
/** 转换配置数据为表单数据 */
|
|
24
|
+
function toFormValues(action: IEventAction): IActionConfigFormValues {
|
|
25
|
+
if (action.type === 'request') {
|
|
26
|
+
const { headers, params } = action
|
|
27
|
+
let headersValue: { key: string; value: string }[] = []
|
|
28
|
+
let paramsValue: { key: string; value: string }[] = []
|
|
29
|
+
if (headers) {
|
|
30
|
+
headersValue = Object.entries(headers).map(([key, value]) => ({
|
|
31
|
+
key,
|
|
32
|
+
value,
|
|
33
|
+
}))
|
|
34
|
+
}
|
|
35
|
+
if (params) {
|
|
36
|
+
paramsValue = Object.entries(params).map(([key, value]) => ({
|
|
37
|
+
key,
|
|
38
|
+
value,
|
|
39
|
+
}))
|
|
40
|
+
}
|
|
41
|
+
return { ...action, headers: headersValue, params: paramsValue }
|
|
42
|
+
}
|
|
43
|
+
return action
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** 转换表单数据为配置数据 */
|
|
47
|
+
function toActionData(values: IActionConfigFormValues): IEventAction {
|
|
48
|
+
if (values.type === 'request') {
|
|
49
|
+
const { headers, params } = values
|
|
50
|
+
let headersValue: Record<string, string> = {}
|
|
51
|
+
let paramsValue: Record<string, string> = {}
|
|
52
|
+
// 转换为对象
|
|
53
|
+
if (headers) {
|
|
54
|
+
headersValue = headers.reduce((pre, cur) => {
|
|
55
|
+
pre[cur.key] = cur.value
|
|
56
|
+
return pre
|
|
57
|
+
}, {} as Record<string, string>)
|
|
58
|
+
}
|
|
59
|
+
// 转换为对象
|
|
60
|
+
if (params) {
|
|
61
|
+
paramsValue = params.reduce((pre, cur) => {
|
|
62
|
+
pre[cur.key] = cur.value
|
|
63
|
+
return pre
|
|
64
|
+
}, {} as Record<string, string>)
|
|
65
|
+
}
|
|
66
|
+
return { ...values, headers: headersValue, params: paramsValue }
|
|
67
|
+
}
|
|
68
|
+
return values
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const ActionConfigModal: React.FC<IActionConfigModalProps> = (props) => {
|
|
72
|
+
const { editingAction, onSave, onCancel } = props
|
|
73
|
+
const [form] = Form.useForm()
|
|
74
|
+
const [actionType, setActionType] = useState<EventActionType>('request')
|
|
75
|
+
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (editingAction) {
|
|
78
|
+
setActionType(editingAction.type)
|
|
79
|
+
form.setFieldsValue(toFormValues(editingAction))
|
|
80
|
+
} else {
|
|
81
|
+
setActionType('request')
|
|
82
|
+
form.resetFields()
|
|
83
|
+
}
|
|
84
|
+
}, [editingAction])
|
|
85
|
+
|
|
86
|
+
const handleActionTypeChange = (value: EventActionType) => {
|
|
87
|
+
setActionType(value)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const handleSubmit = () => {
|
|
91
|
+
const values = toActionData(form.getFieldsValue())
|
|
92
|
+
onSave({
|
|
93
|
+
...values,
|
|
94
|
+
id: editingAction?.id || `action-${Date.now()}`,
|
|
95
|
+
type: actionType,
|
|
96
|
+
} as IEventAction)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const tabsItems = [
|
|
100
|
+
{
|
|
101
|
+
key: 'basic',
|
|
102
|
+
label: (
|
|
103
|
+
<TextWidget token="SettingComponents.ClickEventSetter.basicConfig" />
|
|
104
|
+
),
|
|
105
|
+
children: (
|
|
106
|
+
<div className="action-config-basic">
|
|
107
|
+
<Form.Item
|
|
108
|
+
label={
|
|
109
|
+
<TextWidget token="SettingComponents.ClickEventSetter.actionType" />
|
|
110
|
+
}
|
|
111
|
+
name="type"
|
|
112
|
+
initialValue="request"
|
|
113
|
+
>
|
|
114
|
+
<Select
|
|
115
|
+
options={[
|
|
116
|
+
{
|
|
117
|
+
label: '服务请求',
|
|
118
|
+
value: 'request',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
label: '页面跳转',
|
|
122
|
+
value: 'navigation',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
label: '下载文件',
|
|
126
|
+
value: 'download',
|
|
127
|
+
},
|
|
128
|
+
]}
|
|
129
|
+
onChange={handleActionTypeChange}
|
|
130
|
+
/>
|
|
131
|
+
</Form.Item>
|
|
132
|
+
<Form.Item
|
|
133
|
+
label={
|
|
134
|
+
<TextWidget token="SettingComponents.ClickEventSetter.description" />
|
|
135
|
+
}
|
|
136
|
+
name="description"
|
|
137
|
+
>
|
|
138
|
+
<Input placeholder="请输入动作描述(可选)" />
|
|
139
|
+
</Form.Item>
|
|
140
|
+
</div>
|
|
141
|
+
),
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
key: 'action',
|
|
145
|
+
label: (
|
|
146
|
+
<TextWidget token="SettingComponents.ClickEventSetter.actionConfig" />
|
|
147
|
+
),
|
|
148
|
+
children: (
|
|
149
|
+
<div className="action-config-panel">
|
|
150
|
+
{actionType === 'request' && <RequestPanel />}
|
|
151
|
+
{actionType === 'navigation' && <NavigationPanel />}
|
|
152
|
+
{actionType === 'download' && <DownloadPanel />}
|
|
153
|
+
</div>
|
|
154
|
+
),
|
|
155
|
+
},
|
|
156
|
+
]
|
|
157
|
+
|
|
158
|
+
return (
|
|
159
|
+
<div className="action-config-modal">
|
|
160
|
+
<Form form={form} layout="vertical" onFinish={handleSubmit}>
|
|
161
|
+
<Tabs items={tabsItems} defaultActiveKey="basic" size="small" />
|
|
162
|
+
<div className="action-config-footer">
|
|
163
|
+
<Button onClick={onCancel}>
|
|
164
|
+
<TextWidget token="SettingComponents.ClickEventSetter.cancel" />
|
|
165
|
+
</Button>
|
|
166
|
+
<Button type="primary" htmlType="submit">
|
|
167
|
+
<TextWidget token="SettingComponents.ClickEventSetter.confirm" />
|
|
168
|
+
</Button>
|
|
169
|
+
</div>
|
|
170
|
+
</Form>
|
|
171
|
+
</div>
|
|
172
|
+
)
|
|
173
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { List, Button, Tag } from 'antd'
|
|
3
|
+
import { TextWidget } from '@formily-design/react'
|
|
4
|
+
import { IEventAction } from './types'
|
|
5
|
+
import './styles.less'
|
|
6
|
+
|
|
7
|
+
export interface IActionListProps {
|
|
8
|
+
actions: IEventAction[]
|
|
9
|
+
onEdit: (action: IEventAction, index: number) => void
|
|
10
|
+
onDelete: (index: number) => void
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const actionTypeLabels: Record<string, { label: string; color: string }> = {
|
|
14
|
+
navigation: { label: '页面跳转', color: 'blue' },
|
|
15
|
+
request: { label: '服务请求', color: 'green' },
|
|
16
|
+
download: { label: '下载文件', color: 'orange' },
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const ActionList: React.FC<IActionListProps> = (props) => {
|
|
20
|
+
const { actions, onEdit, onDelete } = props
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<List
|
|
24
|
+
className="click-event-action-list"
|
|
25
|
+
dataSource={actions}
|
|
26
|
+
renderItem={(action, index) => {
|
|
27
|
+
const typeInfo = actionTypeLabels[action.type] || {
|
|
28
|
+
label: action.type,
|
|
29
|
+
color: 'default',
|
|
30
|
+
}
|
|
31
|
+
return (
|
|
32
|
+
<List.Item
|
|
33
|
+
className="click-event-action-item"
|
|
34
|
+
actions={[
|
|
35
|
+
<Button
|
|
36
|
+
type="text"
|
|
37
|
+
onClick={() => onEdit(action, index)}
|
|
38
|
+
key="edit"
|
|
39
|
+
size="small"
|
|
40
|
+
>
|
|
41
|
+
<TextWidget token="SettingComponents.ClickEventSetter.edit" />
|
|
42
|
+
</Button>,
|
|
43
|
+
<Button
|
|
44
|
+
type="text"
|
|
45
|
+
danger
|
|
46
|
+
onClick={() => onDelete(index)}
|
|
47
|
+
key="delete"
|
|
48
|
+
size="small"
|
|
49
|
+
>
|
|
50
|
+
<TextWidget token="SettingComponents.ClickEventSetter.delete" />
|
|
51
|
+
</Button>,
|
|
52
|
+
]}
|
|
53
|
+
>
|
|
54
|
+
<List.Item.Meta
|
|
55
|
+
title={
|
|
56
|
+
<div className="click-event-action-title">
|
|
57
|
+
<Tag color={typeInfo.color}>{typeInfo.label}</Tag>
|
|
58
|
+
</div>
|
|
59
|
+
}
|
|
60
|
+
description={action.description || ''}
|
|
61
|
+
/>
|
|
62
|
+
</List.Item>
|
|
63
|
+
)
|
|
64
|
+
}}
|
|
65
|
+
/>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Form, Input } from 'antd'
|
|
3
|
+
import { TextWidget } from '@formily-design/react'
|
|
4
|
+
import './styles.less'
|
|
5
|
+
|
|
6
|
+
export interface IDownloadPanelProps {
|
|
7
|
+
form?: any
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const DownloadPanel: React.FC<IDownloadPanelProps> = () => {
|
|
11
|
+
return (
|
|
12
|
+
<div className="download-panel">
|
|
13
|
+
<Form.Item
|
|
14
|
+
label={
|
|
15
|
+
<TextWidget token="SettingComponents.ClickEventSetter.downloadUrl" />
|
|
16
|
+
}
|
|
17
|
+
name="url"
|
|
18
|
+
rules={[{ required: true, message: '请输入下载文件地址' }]}
|
|
19
|
+
>
|
|
20
|
+
<Input placeholder="https://example.com/file/download" />
|
|
21
|
+
</Form.Item>
|
|
22
|
+
</div>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Form, Input, Select } from 'antd'
|
|
3
|
+
import { TextWidget } from '@formily-design/react'
|
|
4
|
+
import './styles.less'
|
|
5
|
+
|
|
6
|
+
export interface INavigationPanelProps {
|
|
7
|
+
form?: any
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const NavigationPanel: React.FC<INavigationPanelProps> = () => {
|
|
11
|
+
return (
|
|
12
|
+
<div className="navigation-panel">
|
|
13
|
+
<Form.Item
|
|
14
|
+
label={<TextWidget token="SettingComponents.ClickEventSetter.url" />}
|
|
15
|
+
name="url"
|
|
16
|
+
rules={[{ required: true, message: '请输入跳转地址' }]}
|
|
17
|
+
>
|
|
18
|
+
<Input placeholder="https://example.com/page" />
|
|
19
|
+
</Form.Item>
|
|
20
|
+
<Form.Item
|
|
21
|
+
label={
|
|
22
|
+
<TextWidget token="SettingComponents.ClickEventSetter.openMode" />
|
|
23
|
+
}
|
|
24
|
+
name="target"
|
|
25
|
+
initialValue="_self"
|
|
26
|
+
>
|
|
27
|
+
<Select
|
|
28
|
+
options={[
|
|
29
|
+
{
|
|
30
|
+
label: '当前窗口',
|
|
31
|
+
value: '_self',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
label: '新窗口',
|
|
35
|
+
value: '_blank',
|
|
36
|
+
},
|
|
37
|
+
]}
|
|
38
|
+
/>
|
|
39
|
+
</Form.Item>
|
|
40
|
+
</div>
|
|
41
|
+
)
|
|
42
|
+
}
|