tntd 2.8.0-beta.3 → 3.0.0-beta
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/es/alert/alert.js +70 -0
- package/es/alert/alert.js.map +1 -0
- package/es/alert/alert.less +128 -0
- package/es/alert/index.js +1 -1
- package/es/alert/index.js.map +1 -1
- package/es/alert/style/index.less +1 -0
- package/es/button/button.js +30 -3
- package/es/button/button.js.map +1 -1
- package/es/button/button.less +72 -0
- package/es/button/index.js +1 -0
- package/es/button/index.js.map +1 -1
- package/es/checkbox/check.png +0 -0
- package/es/checkbox/checkbox.js +48 -0
- package/es/checkbox/checkbox.js.map +1 -0
- package/es/checkbox/checkbox.less +69 -0
- package/es/checkbox/index.js +3 -7
- package/es/checkbox/index.js.map +1 -1
- package/es/color-picker/index.less +4 -1
- package/es/date-picker/DatePicker.js +101 -0
- package/es/date-picker/DatePicker.js.map +1 -0
- package/es/date-picker/index.js +6 -12
- package/es/date-picker/index.js.map +1 -1
- package/es/date-picker/index.less +294 -0
- package/es/date-picker/style/RangePicker.less +3 -3
- package/es/descriptions/descriptions.js +64 -21
- package/es/descriptions/descriptions.js.map +1 -1
- package/es/descriptions/descriptions.less +57 -60
- package/es/descriptions/index.js +2 -2
- package/es/descriptions/index.js.map +1 -1
- package/es/drawer/drawer.js +98 -13
- package/es/drawer/drawer.js.map +1 -1
- package/es/drawer/index.js +1 -1
- package/es/drawer/index.js.map +1 -1
- package/es/drawer/index.less +154 -0
- package/es/drawer/style/drawer.less +18 -3
- package/es/drawer/style/index.js +2 -1
- package/es/drawer/style/index.js.map +1 -1
- package/es/form/form.js +3 -0
- package/es/form/form.js.map +1 -1
- package/es/form/form.less +36 -0
- package/es/icon/index.js +2 -0
- package/es/icon/index.js.map +1 -1
- package/es/icon/style/style.less +4 -0
- package/es/input/index.js +1 -1
- package/es/input/index.js.map +1 -1
- package/es/input/input.js +21 -30
- package/es/input/input.js.map +1 -1
- package/es/input/input.less +123 -20
- package/es/input-number/index.js +4 -5
- package/es/input-number/index.js.map +1 -1
- package/es/input-number/inputNumber.js +29 -0
- package/es/input-number/inputNumber.js.map +1 -0
- package/es/input-number/inputNumber.less +12 -0
- package/es/locale/en_US.js +12 -1
- package/es/locale/en_US.js.map +1 -1
- package/es/locale/zh_CN.js +12 -1
- package/es/locale/zh_CN.js.map +1 -1
- package/es/message/message.less +2 -1
- package/es/modal/index.js +2 -3
- package/es/modal/index.js.map +1 -1
- package/es/modal/index.less +36 -0
- package/es/modal/modal.js +104 -17
- package/es/modal/modal.js.map +1 -1
- package/es/modal/style/index.js +2 -1
- package/es/modal/style/index.js.map +1 -1
- package/es/notification/assets/index.js +2 -0
- package/es/notification/assets/index.js.map +1 -0
- package/es/notification/assets/svg-error-tip.js +145 -0
- package/es/notification/assets/svg-error-tip.js.map +1 -0
- package/es/notification/assets/svg-success-tip.js +162 -0
- package/es/notification/assets/svg-success-tip.js.map +1 -0
- package/es/notification/index.js +1 -1
- package/es/notification/index.js.map +1 -1
- package/es/notification/notification.js +80 -0
- package/es/notification/notification.js.map +1 -0
- package/es/notification/notification.less +59 -0
- package/es/notification/style/index.less +2 -0
- package/es/popconfirm/index.js +2 -2
- package/es/popconfirm/index.js.map +1 -1
- package/es/popconfirm/index.less +26 -0
- package/es/popconfirm/popconfirm.js +40 -0
- package/es/popconfirm/popconfirm.js.map +1 -0
- package/es/popconfirm/style/index.js +2 -1
- package/es/popconfirm/style/index.js.map +1 -1
- package/es/popover/index.js +2 -2
- package/es/popover/index.js.map +1 -1
- package/es/popover/index.less +51 -0
- package/es/popover/popover.js +33 -0
- package/es/popover/popover.js.map +1 -0
- package/es/popover/style/index.js +1 -0
- package/es/popover/style/index.js.map +1 -1
- package/es/preview-text/index.js.map +1 -1
- package/es/progress/index.js +2 -2
- package/es/progress/index.js.map +1 -1
- package/es/progress/progress.js +132 -0
- package/es/progress/progress.js.map +1 -0
- package/es/progress/progress.less +82 -0
- package/es/query-form/Field/Composition/FieldPopover.js +284 -0
- package/es/query-form/Field/Composition/FieldPopover.js.map +1 -0
- package/es/query-form/Field/Composition/FieldPopover.less +35 -0
- package/es/query-form/Field/Composition/Select.js +108 -0
- package/es/query-form/Field/Composition/Select.js.map +1 -0
- package/es/query-form/Field/Composition/index.js +282 -0
- package/es/query-form/Field/Composition/index.js.map +1 -0
- package/es/query-form/Field/Composition/index.less +106 -0
- package/es/query-form/Field/Composition/utils.js +19 -0
- package/es/query-form/Field/Composition/utils.js.map +1 -0
- package/es/query-form/index.js +109 -125
- package/es/query-form/index.js.map +1 -1
- package/es/query-form/index.less +12 -9
- package/es/query-list-scene/index.less +4 -4
- package/es/radio/index.js +3 -5
- package/es/radio/index.js.map +1 -1
- package/es/radio/radio.js +57 -0
- package/es/radio/radio.js.map +1 -0
- package/es/radio/radio.less +43 -0
- package/es/segmented/index.less +126 -112
- package/es/select/index.js +1 -1
- package/es/select/index.js.map +1 -1
- package/es/select/select.js +5 -6
- package/es/select/select.js.map +1 -1
- package/es/select/select.less +83 -9
- package/es/steps/assets/background_left.svg +12 -0
- package/es/steps/assets/background_right.svg +12 -0
- package/es/steps/assets/horizontal_line.svg +3 -0
- package/es/steps/assets/vertical_line.svg +3 -0
- package/es/steps/index.js +9 -2
- package/es/steps/index.js.map +1 -1
- package/es/steps/stepStyle/icon.less +51 -0
- package/es/steps/stepStyle/index.less +173 -8
- package/es/steps/stepStyle/nav.less +51 -259
- package/es/steps/stepStyle/progress-dot.less +10 -0
- package/es/steps/stepStyle/variables.less +8 -0
- package/es/steps/stepStyle/vertical.less +41 -0
- package/es/steps/steps.js +53 -27
- package/es/steps/steps.js.map +1 -1
- package/es/steps/style/index.js +8 -0
- package/es/steps/style/index.js.map +1 -1
- package/es/style/themes/default.less +3 -2
- package/es/switch/index.less +46 -0
- package/es/switch/style/index.js +2 -1
- package/es/switch/style/index.js.map +1 -1
- package/es/switch/switch.js +40 -2
- package/es/switch/switch.js.map +1 -1
- package/es/table/style/index.less +51 -7
- package/es/table/style/size.less +5 -5
- package/es/table/table.js +37 -6
- package/es/table/table.js.map +1 -1
- package/es/table/table.less +33 -5
- package/es/tabs/index.js +1 -0
- package/es/tabs/index.js.map +1 -1
- package/es/tabs/style/index.js.map +1 -1
- package/es/tabs/style/index.less +1 -0
- package/es/tabs/tabs.js +22 -4
- package/es/tabs/tabs.js.map +1 -1
- package/es/tabs/tabs.less +114 -0
- package/es/tag/color.less +43 -0
- package/es/tag/index.js +11 -2
- package/es/tag/index.js.map +1 -1
- package/es/tag/tag.js +171 -0
- package/es/tag/tag.js.map +1 -0
- package/es/tag/tag.less +192 -0
- package/es/time-picker/TimePicker.js +36 -0
- package/es/time-picker/TimePicker.js.map +1 -0
- package/es/time-picker/index.js +2 -2
- package/es/time-picker/index.js.map +1 -1
- package/es/time-picker/index.less +38 -0
- package/es/tntd-action/Action.js +66 -0
- package/es/tntd-action/Action.js.map +1 -0
- package/es/tntd-action/index.js +64 -6
- package/es/tntd-action/index.js.map +1 -1
- package/es/tntd-action/index.less +36 -0
- package/es/tntd-cascader/AntdCascader/index.less +28 -27
- package/es/tooltip/index.js +2 -2
- package/es/tooltip/index.js.map +1 -1
- package/es/tooltip/index.less +24 -0
- package/es/tooltip/style/index.js +2 -1
- package/es/tooltip/style/index.js.map +1 -1
- package/es/tooltip/tooltip.js +32 -0
- package/es/tooltip/tooltip.js.map +1 -0
- package/es/utils/lang.js +8 -2
- package/es/utils/lang.js.map +1 -1
- package/lib/alert/alert.d.ts +12 -0
- package/lib/alert/alert.d.ts.map +1 -0
- package/lib/alert/alert.js +92 -0
- package/lib/alert/alert.js.map +1 -0
- package/lib/alert/alert.less +128 -0
- package/lib/alert/index.d.ts +1 -1
- package/lib/alert/index.d.ts.map +1 -1
- package/lib/alert/index.js +7 -8
- package/lib/alert/index.js.map +1 -1
- package/lib/alert/style/index.less +1 -0
- package/lib/button/button.d.ts +9 -4
- package/lib/button/button.d.ts.map +1 -1
- package/lib/button/button.js +27 -3
- package/lib/button/button.js.map +1 -1
- package/lib/button/button.less +72 -0
- package/lib/button/index.d.ts +1 -0
- package/lib/button/index.d.ts.map +1 -1
- package/lib/button/index.js +6 -5
- package/lib/button/index.js.map +1 -1
- package/lib/checkbox/check.png +0 -0
- package/lib/checkbox/checkbox.d.ts +16 -0
- package/lib/checkbox/checkbox.d.ts.map +1 -0
- package/lib/checkbox/checkbox.js +65 -0
- package/lib/checkbox/checkbox.js.map +1 -0
- package/lib/checkbox/checkbox.less +69 -0
- package/lib/checkbox/index.d.ts +3 -3
- package/lib/checkbox/index.d.ts.map +1 -1
- package/lib/checkbox/index.js +2 -17
- package/lib/checkbox/index.js.map +1 -1
- package/lib/color-picker/index.less +4 -1
- package/lib/date-picker/DatePicker.d.ts +21 -0
- package/lib/date-picker/DatePicker.d.ts.map +1 -0
- package/lib/date-picker/DatePicker.js +128 -0
- package/lib/date-picker/DatePicker.js.map +1 -0
- package/lib/date-picker/index.d.ts +2 -6
- package/lib/date-picker/index.d.ts.map +1 -1
- package/lib/date-picker/index.js +6 -37
- package/lib/date-picker/index.js.map +1 -1
- package/lib/date-picker/index.less +294 -0
- package/lib/date-picker/style/RangePicker.less +3 -3
- package/lib/descriptions/descriptions.d.ts +11 -6
- package/lib/descriptions/descriptions.d.ts.map +1 -1
- package/lib/descriptions/descriptions.js +68 -26
- package/lib/descriptions/descriptions.js.map +1 -1
- package/lib/descriptions/descriptions.less +57 -60
- package/lib/descriptions/index.d.ts +1 -1
- package/lib/descriptions/index.d.ts.map +1 -1
- package/lib/descriptions/index.js +7 -7
- package/lib/descriptions/index.js.map +1 -1
- package/lib/drawer/drawer.d.ts +22 -2
- package/lib/drawer/drawer.d.ts.map +1 -1
- package/lib/drawer/drawer.js +104 -13
- package/lib/drawer/drawer.js.map +1 -1
- package/lib/drawer/index.d.ts +1 -1
- package/lib/drawer/index.d.ts.map +1 -1
- package/lib/drawer/index.js +5 -5
- package/lib/drawer/index.js.map +1 -1
- package/lib/drawer/index.less +154 -0
- package/lib/drawer/style/drawer.less +18 -3
- package/lib/drawer/style/index.d.ts +1 -0
- package/lib/drawer/style/index.d.ts.map +1 -1
- package/lib/drawer/style/index.js +2 -1
- package/lib/drawer/style/index.js.map +1 -1
- package/lib/form/form.d.ts +1 -0
- package/lib/form/form.d.ts.map +1 -1
- package/lib/form/form.js +4 -0
- package/lib/form/form.js.map +1 -1
- package/lib/form/form.less +36 -0
- package/lib/icon/index.d.ts +1 -0
- package/lib/icon/index.d.ts.map +1 -1
- package/lib/icon/index.js +2 -1
- package/lib/icon/index.js.map +1 -1
- package/lib/icon/style/style.less +4 -0
- package/lib/input/index.d.ts +1 -1
- package/lib/input/index.d.ts.map +1 -1
- package/lib/input/index.js +7 -7
- package/lib/input/index.js.map +1 -1
- package/lib/input/input.d.ts +5 -5
- package/lib/input/input.d.ts.map +1 -1
- package/lib/input/input.js +11 -20
- package/lib/input/input.js.map +1 -1
- package/lib/input/input.less +123 -20
- package/lib/input-number/index.d.ts +4 -8
- package/lib/input-number/index.d.ts.map +1 -1
- package/lib/input-number/index.js +3 -5
- package/lib/input-number/index.js.map +1 -1
- package/lib/input-number/inputNumber.d.ts +10 -0
- package/lib/input-number/inputNumber.d.ts.map +1 -0
- package/lib/input-number/inputNumber.js +48 -0
- package/lib/input-number/inputNumber.js.map +1 -0
- package/lib/input-number/inputNumber.less +12 -0
- package/lib/locale/default.d.ts +11 -0
- package/lib/locale/default.d.ts.map +1 -1
- package/lib/locale/en_US.d.ts +11 -0
- package/lib/locale/en_US.d.ts.map +1 -1
- package/lib/locale/en_US.js +12 -1
- package/lib/locale/en_US.js.map +1 -1
- package/lib/locale/zh_CN.d.ts +11 -0
- package/lib/locale/zh_CN.d.ts.map +1 -1
- package/lib/locale/zh_CN.js +12 -1
- package/lib/locale/zh_CN.js.map +1 -1
- package/lib/message/message.less +2 -1
- package/lib/modal/index.d.ts +0 -1
- package/lib/modal/index.d.ts.map +1 -1
- package/lib/modal/index.js +2 -3
- package/lib/modal/index.js.map +1 -1
- package/lib/modal/index.less +36 -0
- package/lib/modal/modal.d.ts.map +1 -1
- package/lib/modal/modal.js +91 -16
- package/lib/modal/modal.js.map +1 -1
- package/lib/modal/style/index.d.ts +1 -0
- package/lib/modal/style/index.d.ts.map +1 -1
- package/lib/modal/style/index.js +2 -1
- package/lib/modal/style/index.js.map +1 -1
- package/lib/notification/assets/index.d.ts +3 -0
- package/lib/notification/assets/index.d.ts.map +1 -0
- package/lib/notification/assets/index.js +20 -0
- package/lib/notification/assets/index.js.map +1 -0
- package/lib/notification/assets/svg-error-tip.d.ts +4 -0
- package/lib/notification/assets/svg-error-tip.d.ts.map +1 -0
- package/lib/notification/assets/svg-error-tip.js +154 -0
- package/lib/notification/assets/svg-error-tip.js.map +1 -0
- package/lib/notification/assets/svg-success-tip.d.ts +4 -0
- package/lib/notification/assets/svg-success-tip.d.ts.map +1 -0
- package/lib/notification/assets/svg-success-tip.js +171 -0
- package/lib/notification/assets/svg-success-tip.js.map +1 -0
- package/lib/notification/index.d.ts +1 -1
- package/lib/notification/index.d.ts.map +1 -1
- package/lib/notification/index.js +7 -8
- package/lib/notification/index.js.map +1 -1
- package/lib/notification/notification.d.ts +9 -0
- package/lib/notification/notification.d.ts.map +1 -0
- package/lib/notification/notification.js +105 -0
- package/lib/notification/notification.js.map +1 -0
- package/lib/notification/notification.less +59 -0
- package/lib/notification/style/index.less +2 -0
- package/lib/popconfirm/index.d.ts +2 -2
- package/lib/popconfirm/index.d.ts.map +1 -1
- package/lib/popconfirm/index.js +1 -1
- package/lib/popconfirm/index.js.map +1 -1
- package/lib/popconfirm/index.less +26 -0
- package/lib/popconfirm/popconfirm.d.ts +6 -0
- package/lib/popconfirm/popconfirm.d.ts.map +1 -0
- package/lib/popconfirm/popconfirm.js +58 -0
- package/lib/popconfirm/popconfirm.js.map +1 -0
- package/lib/popconfirm/style/index.d.ts +1 -0
- package/lib/popconfirm/style/index.d.ts.map +1 -1
- package/lib/popconfirm/style/index.js +2 -1
- package/lib/popconfirm/style/index.js.map +1 -1
- package/lib/popover/index.d.ts +2 -2
- package/lib/popover/index.d.ts.map +1 -1
- package/lib/popover/index.js +2 -2
- package/lib/popover/index.js.map +1 -1
- package/lib/popover/index.less +51 -0
- package/lib/popover/popover.d.ts +13 -0
- package/lib/popover/popover.d.ts.map +1 -0
- package/lib/popover/popover.js +53 -0
- package/lib/popover/popover.js.map +1 -0
- package/lib/popover/style/index.d.ts +1 -0
- package/lib/popover/style/index.d.ts.map +1 -1
- package/lib/popover/style/index.js +2 -1
- package/lib/popover/style/index.js.map +1 -1
- package/lib/preview-text/index.d.ts +1 -1
- package/lib/preview-text/index.d.ts.map +1 -1
- package/lib/preview-text/index.js.map +1 -1
- package/lib/progress/index.d.ts +2 -2
- package/lib/progress/index.d.ts.map +1 -1
- package/lib/progress/index.js +1 -1
- package/lib/progress/index.js.map +1 -1
- package/lib/progress/progress.d.ts +12 -0
- package/lib/progress/progress.d.ts.map +1 -0
- package/lib/progress/progress.js +148 -0
- package/lib/progress/progress.js.map +1 -0
- package/lib/progress/progress.less +82 -0
- package/lib/query-form/Field/Composition/FieldPopover.d.ts +17 -0
- package/lib/query-form/Field/Composition/FieldPopover.d.ts.map +1 -0
- package/lib/query-form/Field/Composition/FieldPopover.js +319 -0
- package/lib/query-form/Field/Composition/FieldPopover.js.map +1 -0
- package/lib/query-form/Field/Composition/FieldPopover.less +35 -0
- package/lib/query-form/Field/Composition/Select.d.ts +4 -0
- package/lib/query-form/Field/Composition/Select.d.ts.map +1 -0
- package/lib/query-form/Field/Composition/Select.js +132 -0
- package/lib/query-form/Field/Composition/Select.js.map +1 -0
- package/lib/query-form/Field/Composition/index.d.ts +14 -0
- package/lib/query-form/Field/Composition/index.d.ts.map +1 -0
- package/lib/query-form/Field/Composition/index.js +337 -0
- package/lib/query-form/Field/Composition/index.js.map +1 -0
- package/lib/query-form/Field/Composition/index.less +106 -0
- package/lib/query-form/Field/Composition/utils.d.ts +6 -0
- package/lib/query-form/Field/Composition/utils.d.ts.map +1 -0
- package/lib/query-form/Field/Composition/utils.js +27 -0
- package/lib/query-form/Field/Composition/utils.js.map +1 -0
- package/lib/query-form/index.d.ts +4 -7
- package/lib/query-form/index.d.ts.map +1 -1
- package/lib/query-form/index.js +137 -149
- package/lib/query-form/index.js.map +1 -1
- package/lib/query-form/index.less +12 -9
- package/lib/query-list-scene/index.less +4 -4
- package/lib/radio/index.d.ts +3 -2
- package/lib/radio/index.d.ts.map +1 -1
- package/lib/radio/index.js +2 -5
- package/lib/radio/index.js.map +1 -1
- package/lib/radio/radio.d.ts +17 -0
- package/lib/radio/radio.d.ts.map +1 -0
- package/lib/radio/radio.js +75 -0
- package/lib/radio/radio.js.map +1 -0
- package/lib/radio/radio.less +43 -0
- package/lib/segmented/index.d.ts +1 -1
- package/lib/segmented/index.less +126 -112
- package/lib/select/index.d.ts +1 -1
- package/lib/select/index.d.ts.map +1 -1
- package/lib/select/index.js +6 -6
- package/lib/select/index.js.map +1 -1
- package/lib/select/select.d.ts +1 -1
- package/lib/select/select.d.ts.map +1 -1
- package/lib/select/select.js +3 -4
- package/lib/select/select.js.map +1 -1
- package/lib/select/select.less +83 -9
- package/lib/steps/assets/background_left.svg +12 -0
- package/lib/steps/assets/background_right.svg +12 -0
- package/lib/steps/assets/horizontal_line.svg +3 -0
- package/lib/steps/assets/vertical_line.svg +3 -0
- package/lib/steps/index.d.ts +1 -2
- package/lib/steps/index.d.ts.map +1 -1
- package/lib/steps/index.js +9 -2
- package/lib/steps/index.js.map +1 -1
- package/lib/steps/stepStyle/icon.less +51 -0
- package/lib/steps/stepStyle/index.less +173 -8
- package/lib/steps/stepStyle/nav.less +51 -259
- package/lib/steps/stepStyle/progress-dot.less +10 -0
- package/lib/steps/stepStyle/variables.less +8 -0
- package/lib/steps/stepStyle/vertical.less +41 -0
- package/lib/steps/steps.d.ts +10 -2
- package/lib/steps/steps.d.ts.map +1 -1
- package/lib/steps/steps.js +50 -22
- package/lib/steps/steps.js.map +1 -1
- package/lib/steps/style/index.d.ts.map +1 -1
- package/lib/steps/style/index.js.map +1 -1
- package/lib/style/themes/default.less +3 -2
- package/lib/svg-components/illustration-403.d.ts +1 -1
- package/lib/svg-components/illustration-404.d.ts +1 -1
- package/lib/svg-components/illustration-500.d.ts +1 -1
- package/lib/svg-components/illustration-empty.d.ts +1 -1
- package/lib/svg-components/illustration-failure.d.ts +1 -1
- package/lib/svg-components/illustration-no-access.d.ts +1 -1
- package/lib/svg-components/illustration-no-chart.d.ts +1 -1
- package/lib/svg-components/illustration-no-result.d.ts +1 -1
- package/lib/svg-components/illustration-offline.d.ts +1 -1
- package/lib/svg-components/illustration-success.d.ts +1 -1
- package/lib/switch/index.less +46 -0
- package/lib/switch/style/index.d.ts +1 -0
- package/lib/switch/style/index.d.ts.map +1 -1
- package/lib/switch/style/index.js +2 -1
- package/lib/switch/style/index.js.map +1 -1
- package/lib/switch/switch.d.ts +8 -0
- package/lib/switch/switch.d.ts.map +1 -1
- package/lib/switch/switch.js +40 -5
- package/lib/switch/switch.js.map +1 -1
- package/lib/table/assets/image-loading-background.d.ts +1 -1
- package/lib/table/assets/image-loading.d.ts +1 -1
- package/lib/table/style/index.less +51 -7
- package/lib/table/style/size.less +5 -5
- package/lib/table/table.d.ts +2 -1
- package/lib/table/table.d.ts.map +1 -1
- package/lib/table/table.js +35 -4
- package/lib/table/table.js.map +1 -1
- package/lib/table/table.less +33 -5
- package/lib/tabs/index.d.ts +1 -0
- package/lib/tabs/index.d.ts.map +1 -1
- package/lib/tabs/index.js +6 -5
- package/lib/tabs/index.js.map +1 -1
- package/lib/tabs/style/index.js.map +1 -1
- package/lib/tabs/style/index.less +1 -0
- package/lib/tabs/tabs.d.ts +3 -2
- package/lib/tabs/tabs.d.ts.map +1 -1
- package/lib/tabs/tabs.js +24 -3
- package/lib/tabs/tabs.js.map +1 -1
- package/lib/tabs/tabs.less +114 -0
- package/lib/tag/color.less +43 -0
- package/lib/tag/index.d.ts +3 -2
- package/lib/tag/index.d.ts.map +1 -1
- package/lib/tag/index.js +15 -9
- package/lib/tag/index.js.map +1 -1
- package/lib/tag/tag.d.ts +41 -0
- package/lib/tag/tag.d.ts.map +1 -0
- package/lib/tag/tag.js +183 -0
- package/lib/tag/tag.js.map +1 -0
- package/lib/tag/tag.less +192 -0
- package/lib/time-picker/TimePicker.d.ts +9 -0
- package/lib/time-picker/TimePicker.d.ts.map +1 -0
- package/lib/time-picker/TimePicker.js +55 -0
- package/lib/time-picker/TimePicker.js.map +1 -0
- package/lib/time-picker/index.d.ts +7 -6
- package/lib/time-picker/index.d.ts.map +1 -1
- package/lib/time-picker/index.js +4 -17
- package/lib/time-picker/index.js.map +1 -1
- package/lib/time-picker/index.less +38 -0
- package/lib/tntd-action/Action.d.ts +6 -0
- package/lib/tntd-action/Action.d.ts.map +1 -0
- package/lib/tntd-action/Action.js +86 -0
- package/lib/tntd-action/Action.js.map +1 -0
- package/lib/tntd-action/index.d.ts +4 -2
- package/lib/tntd-action/index.d.ts.map +1 -1
- package/lib/tntd-action/index.js +76 -5
- package/lib/tntd-action/index.js.map +1 -1
- package/lib/tntd-action/index.less +36 -0
- package/lib/tntd-cascader/AntdCascader/config/utils.d.ts +1 -1
- package/lib/tntd-cascader/AntdCascader/index.less +28 -27
- package/lib/tntd-rc-select/_util/PurePanel.d.ts +1 -1
- package/lib/tooltip/index.d.ts +2 -2
- package/lib/tooltip/index.d.ts.map +1 -1
- package/lib/tooltip/index.js +2 -2
- package/lib/tooltip/index.js.map +1 -1
- package/lib/tooltip/index.less +24 -0
- package/lib/tooltip/style/index.d.ts +1 -0
- package/lib/tooltip/style/index.d.ts.map +1 -1
- package/lib/tooltip/style/index.js +2 -1
- package/lib/tooltip/style/index.js.map +1 -1
- package/lib/tooltip/tooltip.d.ts +8 -0
- package/lib/tooltip/tooltip.d.ts.map +1 -0
- package/lib/tooltip/tooltip.js +51 -0
- package/lib/tooltip/tooltip.js.map +1 -0
- package/lib/utils/lang.d.ts.map +1 -1
- package/lib/utils/lang.js +8 -2
- package/lib/utils/lang.js.map +1 -1
- package/package.json +3 -2
- package/themes/common/index.less +29 -27
- package/themes/default/colors.less +1 -1
- package/themes/default/lessVars2.x.less +2 -1
- package/themes/default/lessVars3.x.less +1 -0
- package/themes/default/variables.less +60 -36
- package/es/checkbox/checkbox-group.js +0 -5
- package/es/checkbox/checkbox-group.js.map +0 -1
- package/es/drawer/drawer.less +0 -20
- package/es/modal/modal.less +0 -18
- package/es/radio/radio-group.js +0 -5
- package/es/radio/radio-group.js.map +0 -1
- package/es/steps/stepStyle/small.less +0 -5
- package/lib/checkbox/checkbox-group.d.ts +0 -8
- package/lib/checkbox/checkbox-group.d.ts.map +0 -1
- package/lib/checkbox/checkbox-group.js +0 -12
- package/lib/checkbox/checkbox-group.js.map +0 -1
- package/lib/drawer/drawer.less +0 -20
- package/lib/modal/modal.less +0 -18
- package/lib/radio/radio-group.d.ts +0 -8
- package/lib/radio/radio-group.d.ts.map +0 -1
- package/lib/radio/radio-group.js +0 -12
- package/lib/radio/radio-group.js.map +0 -1
- package/lib/steps/stepStyle/small.less +0 -5
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.tnt-queryform-field-popover {
|
|
2
|
+
min-width: 280px;
|
|
3
|
+
.ant-popover-inner-content {
|
|
4
|
+
padding: @padding-sm 0;
|
|
5
|
+
}
|
|
6
|
+
.ant-calendar-picker {
|
|
7
|
+
margin: @margin-xxs 0;
|
|
8
|
+
}
|
|
9
|
+
label {
|
|
10
|
+
color: tint(@text-color, 50%);
|
|
11
|
+
margin-bottom: @margin-xs;
|
|
12
|
+
display: block;
|
|
13
|
+
padding: 0 @padding-sm;
|
|
14
|
+
}
|
|
15
|
+
.ant-select-dropdown-menu {
|
|
16
|
+
&-item {
|
|
17
|
+
padding: @padding-xxs @padding-sm;
|
|
18
|
+
&:hover {
|
|
19
|
+
background-color: @bg-color-quaternary;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
&-content {
|
|
24
|
+
padding: @padding-xxs @padding-sm;
|
|
25
|
+
}
|
|
26
|
+
.ant-select-selected-icon {
|
|
27
|
+
position: absolute;
|
|
28
|
+
right: @margin-base;
|
|
29
|
+
top: @margin-xs;
|
|
30
|
+
color: @blue-6;
|
|
31
|
+
}
|
|
32
|
+
.tnt-highlight {
|
|
33
|
+
color: @blue-6;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/Select.js"],"names":[],"mappings":"AAMe,yDAoGd"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _icon = _interopRequireDefault(require("../../../icon"));
|
|
11
|
+
var _utils = require("./utils");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
15
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
17
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
20
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
22
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
23
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
25
|
+
var t = {};
|
|
26
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
27
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
28
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
29
|
+
}
|
|
30
|
+
return t;
|
|
31
|
+
};
|
|
32
|
+
var _default = exports["default"] = function _default(props) {
|
|
33
|
+
var options = props.options,
|
|
34
|
+
params = props.params,
|
|
35
|
+
_props$queryKey = props.queryKey,
|
|
36
|
+
queryKey = _props$queryKey === void 0 ? 'name' : _props$queryKey,
|
|
37
|
+
_props$fieldNames = props.fieldNames,
|
|
38
|
+
fieldNames = _props$fieldNames === void 0 ? {
|
|
39
|
+
label: 'label',
|
|
40
|
+
value: 'value'
|
|
41
|
+
} : _props$fieldNames,
|
|
42
|
+
loadData = props.loadData,
|
|
43
|
+
onChange = props.onChange,
|
|
44
|
+
_value = props.value,
|
|
45
|
+
mode = props.mode,
|
|
46
|
+
searchText = props.searchText,
|
|
47
|
+
dataItem = props.dataItem,
|
|
48
|
+
rest = __rest(props, ["options", "params", "queryKey", "fieldNames", "loadData", "onChange", "value", "mode", "searchText", "dataItem"]);
|
|
49
|
+
var _useState = (0, _react.useState)(options || []),
|
|
50
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
+
items = _useState2[0],
|
|
52
|
+
setItems = _useState2[1];
|
|
53
|
+
(0, _react.useEffect)(function () {
|
|
54
|
+
if (loadData) {
|
|
55
|
+
loadData(Object.assign(_defineProperty({}, queryKey, searchText), params || {})).then(function (items) {
|
|
56
|
+
setItems(items);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}, [params, searchText]);
|
|
60
|
+
(0, _react.useEffect)(function () {
|
|
61
|
+
setItems(options || []);
|
|
62
|
+
}, [options]);
|
|
63
|
+
var onValueChange = function onValueChange(item) {
|
|
64
|
+
onChange(item, mode === 'multiple' || mode === 'tags');
|
|
65
|
+
};
|
|
66
|
+
return _react["default"].createElement("ul", {
|
|
67
|
+
className: "ant-select-dropdown-menu"
|
|
68
|
+
}, items.map(function (item) {
|
|
69
|
+
var labelKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) || 'label';
|
|
70
|
+
var valueKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value) || 'value';
|
|
71
|
+
var value = item instanceof Object ? item[valueKey] : item;
|
|
72
|
+
var label = item instanceof Object ? item[labelKey] : item;
|
|
73
|
+
var optionProps = item instanceof Object ? item : {};
|
|
74
|
+
console.log('value1', value);
|
|
75
|
+
console.log('value2', _value);
|
|
76
|
+
var isSelected = !_value ? false : typeof _value === 'string' ? value === _value : (_value === null || _value === void 0 ? void 0 : _value.indexOf(value)) > -1;
|
|
77
|
+
if (searchText) {
|
|
78
|
+
if ((label === null || label === void 0 ? void 0 : label.indexOf(searchText)) > -1) {
|
|
79
|
+
return _react["default"].createElement("li", {
|
|
80
|
+
className: (0, _classnames["default"])({
|
|
81
|
+
'ant-select-dropdown-menu-item': true,
|
|
82
|
+
// 'ant-select-dropdown-menu-item-active': value === _value,
|
|
83
|
+
'ant-select-dropdown-menu-item-selected': isSelected
|
|
84
|
+
}),
|
|
85
|
+
key: value,
|
|
86
|
+
value: value,
|
|
87
|
+
onMouseDown: function onMouseDown(e) {
|
|
88
|
+
return e.preventDefault();
|
|
89
|
+
},
|
|
90
|
+
onClick: function onClick() {
|
|
91
|
+
onValueChange({
|
|
92
|
+
value: value,
|
|
93
|
+
label: label,
|
|
94
|
+
optionProps: optionProps,
|
|
95
|
+
dataItem: dataItem
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}, _react["default"].createElement("span", null, (dataItem === null || dataItem === void 0 ? void 0 : dataItem.propsTitle) || (dataItem === null || dataItem === void 0 ? void 0 : dataItem.name), ": "), _react["default"].createElement("span", {
|
|
99
|
+
dangerouslySetInnerHTML: {
|
|
100
|
+
__html: (0, _utils.highlightSubstring)(label, searchText)
|
|
101
|
+
}
|
|
102
|
+
}), isSelected && _react["default"].createElement(_icon["default"], {
|
|
103
|
+
type: "check",
|
|
104
|
+
className: "ant-select-selected-icon"
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
return '';
|
|
108
|
+
}
|
|
109
|
+
return _react["default"].createElement("li", {
|
|
110
|
+
className: (0, _classnames["default"])({
|
|
111
|
+
'ant-select-dropdown-menu-item': true,
|
|
112
|
+
// 'ant-select-dropdown-menu-item-active': value === _value,
|
|
113
|
+
'ant-select-dropdown-menu-item-selected': isSelected
|
|
114
|
+
}),
|
|
115
|
+
key: value,
|
|
116
|
+
value: value,
|
|
117
|
+
onMouseDown: function onMouseDown(e) {
|
|
118
|
+
return e.preventDefault();
|
|
119
|
+
},
|
|
120
|
+
onClick: function onClick() {
|
|
121
|
+
onValueChange({
|
|
122
|
+
value: value,
|
|
123
|
+
label: label,
|
|
124
|
+
optionProps: optionProps
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}, label, isSelected && _react["default"].createElement(_icon["default"], {
|
|
128
|
+
type: "check",
|
|
129
|
+
className: "ant-select-selected-icon"
|
|
130
|
+
}));
|
|
131
|
+
}));
|
|
132
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/Select.js"],"names":[],"mapp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CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,EACtC,OAAO,EAAE,GAAG,EAAE;wBACZ,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,GAAI,CAAC,CAAA;oBAC1D,CAAC;oBAED;wBAAO,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,UAAU,MAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,CAAA;6BAAU;oBACrD,wCACE,uBAAuB,EAAE;4BACvB,MAAM,EAAE,IAAA,0BAAkB,EAAC,KAAK,EAAE,UAAU,CAAC;yBAC9C,GACK;oBACP,UAAU,IAAI,8BAAC,cAAI,IAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,0BAA0B,GAAG,CACtE,CACN,CAAA;aACF;YACD,OAAO,EAAE,CAAA;SACV;QACD,OAAO,CACL,sCACE,SAAS,EAAE,IAAA,oBAAU,EAAC;gBACpB,+BAA+B,EAAE,IAAI;gBACrC,4DAA4D;gBAC5D,wCAAwC,EAAE,UAAU;aACrD,CAAC,EACF,GAAG,EAAE,KAAK,EACV,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,EACtC,OAAO,EAAE,GAAG,EAAE;gBACZ,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAA;YAC9C,CAAC;YAEA,KAAK;YACL,UAAU,IAAI,8BAAC,cAAI,IAAC,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,0BAA0B,GAAG,CACtE,CACN,CAAA;IACH,CAAC,CAAC,CACC,CACN,CAAA;AACH,CAAC,CAAA","sourcesContent":["import React, { useState, useEffect } from 'react'\n\nimport classNames from 'classnames'\nimport Icon from '../../../icon'\nimport { highlightSubstring } from './utils'\n\nexport default (props) => {\n const {\n options,\n params,\n queryKey = 'name',\n fieldNames = {\n label: 'label',\n value: 'value',\n },\n loadData,\n onChange,\n value: _value,\n mode,\n searchText,\n dataItem,\n ...rest\n } = props\n const [items, setItems] = useState(options || [])\n\n useEffect(() => {\n if (loadData) {\n loadData({\n [queryKey]: searchText,\n ...(params || {}),\n }).then((items) => {\n setItems(items)\n })\n }\n }, [params, searchText])\n\n useEffect(() => {\n setItems(options || [])\n }, [options])\n\n const onValueChange = (item) => {\n onChange(item, mode === 'multiple' || mode === 'tags')\n }\n \n return (\n <ul className=\"ant-select-dropdown-menu\">\n {items.map((item) => {\n const labelKey = fieldNames?.label || 'label'\n const valueKey = fieldNames?.value || 'value'\n const value = item instanceof Object ? item[valueKey] : item\n const label = item instanceof Object ? item[labelKey] : item\n const optionProps = item instanceof Object ? item : {}\n console.log('value1', value)\n console.log('value2', _value)\n\n const isSelected = !_value ? false :\n (typeof _value === 'string' ? value === _value : _value?.indexOf(value) > -1)\n if (searchText) {\n if (label?.indexOf(searchText) > -1) {\n return (\n <li\n className={classNames({\n 'ant-select-dropdown-menu-item': true,\n // 'ant-select-dropdown-menu-item-active': value === _value,\n 'ant-select-dropdown-menu-item-selected': isSelected,\n })}\n key={value}\n value={value}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n onValueChange({ value, label, optionProps, dataItem, })\n }}\n >\n <span>{dataItem?.propsTitle||dataItem?.name}: </span>\n <span\n dangerouslySetInnerHTML={{\n __html: highlightSubstring(label, searchText),\n }}\n ></span>\n {isSelected && <Icon type=\"check\" className=\"ant-select-selected-icon\" />}\n </li>\n )\n }\n return ''\n }\n return (\n <li\n className={classNames({\n 'ant-select-dropdown-menu-item': true,\n // 'ant-select-dropdown-menu-item-active': value === _value,\n 'ant-select-dropdown-menu-item-selected': isSelected,\n })}\n key={value}\n value={value}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n onValueChange({ value, label, optionProps })\n }}\n >\n {label}\n {isSelected && <Icon type=\"check\" className=\"ant-select-selected-icon\" />}\n </li>\n )\n })}\n </ul>\n )\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare var _default: React.ForwardRefExoticComponent<{
|
|
2
|
+
value: any;
|
|
3
|
+
data: any;
|
|
4
|
+
initialValues: any;
|
|
5
|
+
onChange: any;
|
|
6
|
+
placeholder: any;
|
|
7
|
+
disabled: any;
|
|
8
|
+
form: any;
|
|
9
|
+
style: any;
|
|
10
|
+
clsPrefix: any;
|
|
11
|
+
} & React.RefAttributes<any>>;
|
|
12
|
+
export default _default;
|
|
13
|
+
import React from "react";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _LocaleReceiver = _interopRequireDefault(require("antd/lib/locale-provider/LocaleReceiver"));
|
|
10
|
+
var _icon = _interopRequireDefault(require("../../../icon"));
|
|
11
|
+
var _tag = _interopRequireDefault(require("../../../tag"));
|
|
12
|
+
var _input = _interopRequireDefault(require("../../../input"));
|
|
13
|
+
var _FieldPopover = _interopRequireDefault(require("./FieldPopover"));
|
|
14
|
+
require("./index.less");
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
18
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
19
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
20
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
21
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
22
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
23
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
24
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
25
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
26
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
27
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
|
+
var parseObjectToArray = function parseObjectToArray(value, data) {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
return (_b = (_a = Object.keys(value)) === null || _a === void 0 ? void 0 : _a.map(function (key) {
|
|
31
|
+
var _a, _b, _c;
|
|
32
|
+
var target = data === null || data === void 0 ? void 0 : data.find(function (item) {
|
|
33
|
+
var _a;
|
|
34
|
+
return ((_a = item.props) === null || _a === void 0 ? void 0 : _a.name) === key;
|
|
35
|
+
});
|
|
36
|
+
if (!target) return null;
|
|
37
|
+
var dataItem = (target === null || target === void 0 ? void 0 : target.props) || {};
|
|
38
|
+
var _ref = dataItem || {},
|
|
39
|
+
type = _ref.type,
|
|
40
|
+
component = _ref.component,
|
|
41
|
+
setLabel = _ref.setLabel,
|
|
42
|
+
fieldProps = _ref.props,
|
|
43
|
+
propsTitle = _ref.propsTitle,
|
|
44
|
+
title = _ref.title,
|
|
45
|
+
name = _ref.name;
|
|
46
|
+
var _propsTitle = propsTitle || title || name;
|
|
47
|
+
var _ref2 = fieldProps || {},
|
|
48
|
+
options = _ref2.options;
|
|
49
|
+
var fieldNames = ((_a = dataItem === null || dataItem === void 0 ? void 0 : dataItem.props) === null || _a === void 0 ? void 0 : _a.fieldNames) || {
|
|
50
|
+
label: 'label',
|
|
51
|
+
value: 'value'
|
|
52
|
+
};
|
|
53
|
+
var labelValue = value[key];
|
|
54
|
+
if (!type && component) {
|
|
55
|
+
if (!setLabel) {
|
|
56
|
+
console.error('自定义组件需要传入setLabel()方法');
|
|
57
|
+
}
|
|
58
|
+
} else if (options) {
|
|
59
|
+
if (type === 'selectInput') {
|
|
60
|
+
var selectKey = (_b = Object.keys(labelValue)) === null || _b === void 0 ? void 0 : _b[0];
|
|
61
|
+
var inputValue = labelValue[selectKey];
|
|
62
|
+
var selectLabel = (_c = options === null || options === void 0 ? void 0 : options.find(function (v) {
|
|
63
|
+
return v.value === selectKey;
|
|
64
|
+
})) === null || _c === void 0 ? void 0 : _c.label;
|
|
65
|
+
return {
|
|
66
|
+
key: key,
|
|
67
|
+
value: value[key],
|
|
68
|
+
label: selectLabel + ':' + inputValue
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
var _target = options === null || options === void 0 ? void 0 : options.find(function (item) {
|
|
72
|
+
var valueKey = fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value;
|
|
73
|
+
var itemValue = item instanceof Object ? item[valueKey] : item;
|
|
74
|
+
return itemValue === value[key];
|
|
75
|
+
});
|
|
76
|
+
labelValue = _target instanceof Object ? _target === null || _target === void 0 ? void 0 : _target[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label] : _target;
|
|
77
|
+
}
|
|
78
|
+
// setLabel: 对于自定义组件,无法控制label的显示,可以通过setLabel方法控制
|
|
79
|
+
return {
|
|
80
|
+
key: key,
|
|
81
|
+
value: value[key],
|
|
82
|
+
label: setLabel ? setLabel(labelValue) : _propsTitle + ':' + labelValue
|
|
83
|
+
};
|
|
84
|
+
})) === null || _b === void 0 ? void 0 : _b.filter(function (item) {
|
|
85
|
+
return !!item;
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
var parseArrayToObject = function parseArrayToObject(value) {
|
|
89
|
+
return value === null || value === void 0 ? void 0 : value.reduce(function (acc, v) {
|
|
90
|
+
acc[v.key] = v.value;
|
|
91
|
+
return acc;
|
|
92
|
+
}, {});
|
|
93
|
+
};
|
|
94
|
+
// import './index.less';
|
|
95
|
+
/**
|
|
96
|
+
*
|
|
97
|
+
* @param value: [{
|
|
98
|
+
key: 'key1',
|
|
99
|
+
value: 'value1',
|
|
100
|
+
label: 'key1:value1'
|
|
101
|
+
}, {
|
|
102
|
+
key: 'key2',
|
|
103
|
+
value: ['value2', 'value3'],
|
|
104
|
+
label: 'key1:value2|value3'
|
|
105
|
+
}]
|
|
106
|
+
* @param {*} ref
|
|
107
|
+
* @returns
|
|
108
|
+
*/
|
|
109
|
+
var CompositionInput = function CompositionInput(_ref3, ref) {
|
|
110
|
+
var _value = _ref3.value,
|
|
111
|
+
data = _ref3.data,
|
|
112
|
+
initialValues = _ref3.initialValues,
|
|
113
|
+
onChange = _ref3.onChange,
|
|
114
|
+
placeholder = _ref3.placeholder,
|
|
115
|
+
disabled = _ref3.disabled,
|
|
116
|
+
form = _ref3.form,
|
|
117
|
+
style = _ref3.style,
|
|
118
|
+
clsPrefix = _ref3.clsPrefix;
|
|
119
|
+
var prefix = "".concat(clsPrefix, "-composition-input");
|
|
120
|
+
var _useState = (0, _react.useState)([]),
|
|
121
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
122
|
+
value = _useState2[0],
|
|
123
|
+
setValue = _useState2[1];
|
|
124
|
+
var _useState3 = (0, _react.useState)(),
|
|
125
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
126
|
+
tempItem = _useState4[0],
|
|
127
|
+
setTempItem = _useState4[1];
|
|
128
|
+
var _useState5 = (0, _react.useState)(''),
|
|
129
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
130
|
+
searchText = _useState6[0],
|
|
131
|
+
setSearchText = _useState6[1];
|
|
132
|
+
var _useState7 = (0, _react.useState)(false),
|
|
133
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
134
|
+
visible = _useState8[0],
|
|
135
|
+
setVisible = _useState8[1];
|
|
136
|
+
var _useState9 = (0, _react.useState)(null),
|
|
137
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
138
|
+
searchTarget = _useState10[0],
|
|
139
|
+
setSearchTarget = _useState10[1];
|
|
140
|
+
var inputRef = (0, _react.useRef)(null);
|
|
141
|
+
var widthRef = (0, _react.useRef)(null);
|
|
142
|
+
var handleFocus = function handleFocus(e) {
|
|
143
|
+
var _a;
|
|
144
|
+
e.preventDefault();
|
|
145
|
+
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
146
|
+
if (!visible) {
|
|
147
|
+
setVisible(true);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
|
151
|
+
return {
|
|
152
|
+
changeVal: function changeVal() {
|
|
153
|
+
return value;
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
});
|
|
157
|
+
(0, _react.useEffect)(function () {
|
|
158
|
+
form.on('setValue', updateValue);
|
|
159
|
+
form.on('setValues', onFormChange);
|
|
160
|
+
return function () {
|
|
161
|
+
form.off('setValue', updateValue);
|
|
162
|
+
form.off('setValues', onFormChange);
|
|
163
|
+
};
|
|
164
|
+
}, []);
|
|
165
|
+
(0, _react.useEffect)(function () {
|
|
166
|
+
if (initialValues) {
|
|
167
|
+
setValue(parseObjectToArray(initialValues, data));
|
|
168
|
+
}
|
|
169
|
+
}, [initialValues, data]);
|
|
170
|
+
(0, _react.useEffect)(function () {
|
|
171
|
+
if (!visible) {
|
|
172
|
+
var newValues = value === null || value === void 0 ? void 0 : value.filter(function (v) {
|
|
173
|
+
return !!(v === null || v === void 0 ? void 0 : v.value);
|
|
174
|
+
});
|
|
175
|
+
if (newValues.length !== (value === null || value === void 0 ? void 0 : value.length)) {
|
|
176
|
+
setValue(newValues);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}, [visible, value]);
|
|
180
|
+
(0, _react.useLayoutEffect)(function () {
|
|
181
|
+
var target = document.querySelector(".".concat(prefix, " .inputClass"));
|
|
182
|
+
if (!target) return;
|
|
183
|
+
if (searchText && widthRef.current.clientWidth > 50) {
|
|
184
|
+
target.style.width = widthRef.current.clientWidth + 10 + 'px';
|
|
185
|
+
} else if (!(value === null || value === void 0 ? void 0 : value.length)) {
|
|
186
|
+
target.style.width = '300px';
|
|
187
|
+
} else {
|
|
188
|
+
target.style.width = '100px';
|
|
189
|
+
}
|
|
190
|
+
}, [searchText, value]);
|
|
191
|
+
var updateValue = function updateValue(name, value) {
|
|
192
|
+
// if (name === this.props.name) {
|
|
193
|
+
// this.setState({ value })
|
|
194
|
+
// this.props.onChange(name, value)
|
|
195
|
+
// }
|
|
196
|
+
};
|
|
197
|
+
var onFormChange = function onFormChange(formData) {
|
|
198
|
+
setValue(parseObjectToArray(formData, data));
|
|
199
|
+
};
|
|
200
|
+
var onClear = function onClear(e) {
|
|
201
|
+
e.stopPropagation();
|
|
202
|
+
var deleteKeys = value === null || value === void 0 ? void 0 : value.map(function (_ref4) {
|
|
203
|
+
var key = _ref4.key;
|
|
204
|
+
return key;
|
|
205
|
+
});
|
|
206
|
+
setValue([]);
|
|
207
|
+
onChange([], deleteKeys);
|
|
208
|
+
};
|
|
209
|
+
var onDelete = function onDelete(key, e) {
|
|
210
|
+
e.preventDefault();
|
|
211
|
+
if (value.length > 0) {
|
|
212
|
+
var newValue = value.filter(function (v) {
|
|
213
|
+
return v.key !== key;
|
|
214
|
+
});
|
|
215
|
+
setValue(newValue);
|
|
216
|
+
var deleteKeys = [key];
|
|
217
|
+
onChange(parseArrayToObject(newValue), deleteKeys);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
var handleFieldChange = function handleFieldChange(value, isInput, hasValue) {
|
|
221
|
+
if (isInput) {
|
|
222
|
+
setSearchText(value === null || value === void 0 ? void 0 : value.label);
|
|
223
|
+
setTempItem(value);
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
setValue(value);
|
|
227
|
+
setSearchText('');
|
|
228
|
+
setTempItem();
|
|
229
|
+
console.log('*****value****', value);
|
|
230
|
+
if (hasValue) onChange(parseArrayToObject(value));
|
|
231
|
+
};
|
|
232
|
+
var onInputChange = function onInputChange(value) {
|
|
233
|
+
if (tempItem) {
|
|
234
|
+
var regex = /^.+:.*$/;
|
|
235
|
+
if (regex.test(value)) {
|
|
236
|
+
// 有输入值
|
|
237
|
+
setSearchText(value);
|
|
238
|
+
} else {
|
|
239
|
+
// 没有输入值, 清空选择的属性类型重新显示属性列表
|
|
240
|
+
setSearchText('');
|
|
241
|
+
setTempItem();
|
|
242
|
+
setVisible(true);
|
|
243
|
+
}
|
|
244
|
+
} else {
|
|
245
|
+
setSearchText(value);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
var onPressEnter = function onPressEnter(e) {
|
|
249
|
+
var _a;
|
|
250
|
+
var inputValue = ((_a = searchText === null || searchText === void 0 ? void 0 : searchText.match(/[^:]+:(.*)/)) === null || _a === void 0 ? void 0 : _a[1]) || null;
|
|
251
|
+
if (tempItem && inputValue) {
|
|
252
|
+
setVisible(false);
|
|
253
|
+
tempItem.label = searchText;
|
|
254
|
+
tempItem.value = inputValue; // 得到输入值
|
|
255
|
+
if (!(value === null || value === void 0 ? void 0 : value.find(function (v) {
|
|
256
|
+
return v.key === tempItem.key;
|
|
257
|
+
}))) {
|
|
258
|
+
var newValue = [].concat(_toConsumableArray(value), [tempItem]);
|
|
259
|
+
setValue(newValue);
|
|
260
|
+
onChange(parseArrayToObject(newValue));
|
|
261
|
+
} else {
|
|
262
|
+
var _newValue = value.map(function (v) {
|
|
263
|
+
return v.key === tempItem.key ? tempItem : v;
|
|
264
|
+
});
|
|
265
|
+
setValue(_newValue);
|
|
266
|
+
onChange(parseArrayToObject(_newValue));
|
|
267
|
+
}
|
|
268
|
+
setTempItem();
|
|
269
|
+
setSearchText('');
|
|
270
|
+
}
|
|
271
|
+
if (searchText && !searchTarget) {
|
|
272
|
+
setSearchText('');
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
return _react["default"].createElement(_LocaleReceiver["default"], {
|
|
276
|
+
componentName: "QueryForm"
|
|
277
|
+
}, function (locale) {
|
|
278
|
+
return _react["default"].createElement("div", {
|
|
279
|
+
className: prefix,
|
|
280
|
+
style: style,
|
|
281
|
+
onClick: handleFocus
|
|
282
|
+
}, _react["default"].createElement("span", {
|
|
283
|
+
className: "".concat(prefix, "-width"),
|
|
284
|
+
ref: widthRef
|
|
285
|
+
}, searchText), _react["default"].createElement("ul", {
|
|
286
|
+
className: "".concat(prefix, "-items")
|
|
287
|
+
}, value && value.map(function (item, index) {
|
|
288
|
+
return _react["default"].createElement("li", {
|
|
289
|
+
key: index,
|
|
290
|
+
className: "".concat(prefix, "-items-item")
|
|
291
|
+
}, _react["default"].createElement(_tag["default"], {
|
|
292
|
+
closable: !disabled,
|
|
293
|
+
onClose: function onClose(e) {
|
|
294
|
+
return onDelete(item.key, e);
|
|
295
|
+
}
|
|
296
|
+
}, item === null || item === void 0 ? void 0 : item.label));
|
|
297
|
+
}), _react["default"].createElement("li", {
|
|
298
|
+
className: "".concat(prefix, "-items-input")
|
|
299
|
+
}, _react["default"].createElement(_FieldPopover["default"], {
|
|
300
|
+
onChange: handleFieldChange,
|
|
301
|
+
clsPrefix: clsPrefix,
|
|
302
|
+
options: data,
|
|
303
|
+
trigger: "click",
|
|
304
|
+
visible: visible,
|
|
305
|
+
value: value,
|
|
306
|
+
setVisible: setVisible,
|
|
307
|
+
searchText: !tempItem && searchText ? searchText : null,
|
|
308
|
+
locale: locale,
|
|
309
|
+
searchTarget: searchTarget,
|
|
310
|
+
setSearchTarget: setSearchTarget
|
|
311
|
+
}, _react["default"].createElement(_input["default"]
|
|
312
|
+
// onKeyDown={keyDown}
|
|
313
|
+
, {
|
|
314
|
+
// onKeyDown={keyDown}
|
|
315
|
+
ref: inputRef,
|
|
316
|
+
value: searchText,
|
|
317
|
+
className: "inputClass",
|
|
318
|
+
onPressEnter: onPressEnter,
|
|
319
|
+
onChange: function onChange(e) {
|
|
320
|
+
return onInputChange(e.target.value);
|
|
321
|
+
},
|
|
322
|
+
placeholder: !(value === null || value === void 0 ? void 0 : value.length) ? placeholder || locale.placeholder : undefined,
|
|
323
|
+
disabled: disabled
|
|
324
|
+
})))), _react["default"].createElement("div", {
|
|
325
|
+
className: "".concat(prefix, "-prefix")
|
|
326
|
+
}, _react["default"].createElement(_icon["default"], {
|
|
327
|
+
type: "filter"
|
|
328
|
+
})), _react["default"].createElement("div", {
|
|
329
|
+
className: "".concat(prefix, "-clear")
|
|
330
|
+
}, _react["default"].createElement(_icon["default"], {
|
|
331
|
+
onClick: onClear,
|
|
332
|
+
type: "close-circle",
|
|
333
|
+
theme: "filled"
|
|
334
|
+
})));
|
|
335
|
+
});
|
|
336
|
+
};
|
|
337
|
+
var _default = exports["default"] = (0, _react.forwardRef)(CompositionInput);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAOc;AACd,4FAAmE;AACnE,yDAAgC;AAEhC,uDAA8B;AAC9B,2DAAkC;AAClC,kEAAyC;AACzC,wBAAqB;AAErB,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;;IACzC,OAAO,MAAA,MAAA,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,0CACrB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;;QACZ,MAAM,MAAM,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,WAAC,OAAA,CAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,IAAI,MAAK,GAAG,CAAA,EAAA,CAAC,CAAA;QAC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AAQ,GAClB,CACW,CACZ,CACF;YACL,uCAAK,SAAS,EAAE,GAAG,MAAM,SAAS;gBAChC,8BAAC,cAAI,IAAC,IAAI,EAAC,QAAQ,GAAG,CAClB;YACN,uCAAK,SAAS,EAAE,GAAG,MAAM,QAAQ;gBAC/B,8BAAC,cAAI,IACH,OAAO,EAAE,OAAO,EAChB,IAAI,EAAC,cAAc,EACnB,KAAK,EAAC,QAAQ,GACd,CACE,CACF,CACP,CAAA;IACH,CAAC,CACc,CAClB,CAAA;AACH,CAAC,CAAA;AACD,kBAAe,IAAA,kBAAU,EAAC,gBAAgB,CAAC,CAAA","sourcesContent":["import React, {\n useEffect,\n useLayoutEffect,\n useState,\n useRef,\n useImperativeHandle,\n forwardRef,\n} from 'react'\nimport LocaleReceiver from 'antd/lib/locale-provider/LocaleReceiver'\nimport Icon from '../../../icon'\n\nimport Tag from '../../../tag'\nimport Input from '../../../input'\nimport FieldPopover from './FieldPopover'\nimport './index.less'\n\nconst parseObjectToArray = (value, data) => {\n return Object.keys(value)\n ?.map((key) => {\n const target = data?.find((item) => item.props?.name === key)\n if (!target) return null\n const dataItem = target?.props || {}\n const {\n type,\n component,\n setLabel,\n props: fieldProps,\n propsTitle,\n title,\n name,\n } = dataItem || {}\n const _propsTitle = propsTitle || title || name\n const { options } = fieldProps || {}\n const fieldNames = dataItem?.props?.fieldNames || {\n label: 'label',\n value: 'value',\n }\n let labelValue = value[key]\n if (!type && component) {\n if (!setLabel) {\n console.error('自定义组件需要传入setLabel()方法')\n }\n } else if (options) {\n if (type === 'selectInput') {\n const selectKey = Object.keys(labelValue)?.[0]\n const inputValue = labelValue[selectKey]\n const selectLabel = options?.find((v) => v.value === selectKey)?.label\n return {\n key,\n value: value[key],\n label: selectLabel + ':' + inputValue,\n }\n }\n const target = options?.find((item) => {\n const valueKey = fieldNames?.value\n const itemValue = item instanceof Object ? item[valueKey] : item\n return itemValue === value[key]\n })\n labelValue = target instanceof Object ? target?.[fieldNames?.label] : target\n }\n // setLabel: 对于自定义组件,无法控制label的显示,可以通过setLabel方法控制\n return {\n key,\n value: value[key],\n label: setLabel ? setLabel(labelValue) : _propsTitle + ':' + labelValue,\n }\n })\n ?.filter((item) => !!item)\n}\n\nconst parseArrayToObject = (value) =>\n value?.reduce((acc, v) => {\n acc[v.key] = v.value\n return acc\n }, {})\n\n// import './index.less';\n/**\n * \n * @param value: [{\n key: 'key1',\n value: 'value1',\n label: 'key1:value1'\n }, {\n key: 'key2',\n value: ['value2', 'value3'],\n label: 'key1:value2|value3'\n }]\n * @param {*} ref \n * @returns \n */\nconst CompositionInput = (\n { value: _value, data, initialValues, onChange, placeholder, disabled, form, style, clsPrefix },\n ref\n) => {\n const prefix = `${clsPrefix}-composition-input`;\n const [value, setValue] = useState([])\n const [tempItem, setTempItem] = useState()\n const [searchText, setSearchText] = useState('')\n const [visible, setVisible] = useState(false)\n const [searchTarget, setSearchTarget] = useState(null)\n const inputRef = useRef(null)\n const widthRef = useRef(null)\n\n const handleFocus = (e) => {\n e.preventDefault()\n inputRef?.current?.focus()\n if (!visible) {\n setVisible(true)\n }\n }\n useImperativeHandle(ref, () => ({\n changeVal: () => {\n return value\n },\n }))\n\n useEffect(() => {\n form.on('setValue', updateValue)\n form.on('setValues', onFormChange)\n return () => {\n form.off('setValue', updateValue)\n form.off('setValues', onFormChange)\n }\n }, [])\n useEffect(() => {\n if (initialValues) {\n setValue(parseObjectToArray(initialValues, data))\n }\n }, [initialValues, data])\n\n useEffect(() => {\n if (!visible) {\n const newValues = value?.filter((v) => !!v?.value)\n if (newValues.length !== value?.length) {\n setValue(newValues)\n }\n }\n }, [visible, value])\n\n useLayoutEffect(() => {\n const target = document.querySelector(`.${prefix} .inputClass`)\n\n if (!target) return\n if (searchText && widthRef.current.clientWidth > 50) {\n target.style.width = widthRef.current.clientWidth + 10 + 'px'\n } else if (!value?.length) {\n target.style.width = '300px'\n } else {\n target.style.width = '100px'\n }\n }, [searchText, value])\n\n const updateValue = (name, value) => {\n // if (name === this.props.name) {\n // this.setState({ value })\n // this.props.onChange(name, value)\n // }\n }\n\n const onFormChange = (formData) => {\n setValue(parseObjectToArray(formData, data))\n }\n\n const onClear = (e) => {\n e.stopPropagation()\n const deleteKeys = value?.map(({ key }) => key)\n setValue([])\n onChange([], deleteKeys)\n }\n const onDelete = (key, e) => {\n e.preventDefault()\n if (value.length > 0) {\n const newValue = value.filter((v) => v.key !== key)\n setValue(newValue)\n const deleteKeys = [key]\n onChange(parseArrayToObject(newValue), deleteKeys)\n }\n }\n const handleFieldChange = (value, isInput, hasValue) => {\n if (isInput) {\n setSearchText(value?.label)\n setTempItem(value)\n return\n }\n setValue(value)\n setSearchText('')\n setTempItem()\n console.log('*****value****', value)\n if (hasValue) onChange(parseArrayToObject(value))\n }\n const onInputChange = (value) => {\n if (tempItem) {\n const regex = /^.+:.*$/\n if (regex.test(value)) {\n // 有输入值\n setSearchText(value)\n } else {\n // 没有输入值, 清空选择的属性类型重新显示属性列表\n setSearchText('')\n setTempItem()\n setVisible(true)\n }\n } else {\n setSearchText(value)\n }\n }\n\n const onPressEnter = (e) => {\n const inputValue = searchText?.match(/[^:]+:(.*)/)?.[1] || null\n if (tempItem && inputValue) {\n setVisible(false)\n tempItem.label = searchText\n tempItem.value = inputValue // 得到输入值\n if (!value?.find((v) => v.key === tempItem.key)) {\n const newValue = [...value, tempItem]\n setValue(newValue)\n onChange(parseArrayToObject(newValue))\n } else {\n const newValue = value.map((v) => (v.key === tempItem.key ? tempItem : v))\n setValue(newValue)\n onChange(parseArrayToObject(newValue))\n }\n setTempItem()\n setSearchText('')\n }\n if (searchText && !searchTarget) {\n setSearchText('')\n }\n }\n return (\n <LocaleReceiver componentName=\"QueryForm\">\n {(locale) => {\n return (\n <div className={prefix} style={style} onClick={handleFocus}>\n <span className={`${prefix}-width`} ref={widthRef}>\n {searchText}\n </span>\n <ul className={`${prefix}-items`}>\n {value &&\n value.map((item, index) => (\n <li key={index} className={`${prefix}-items-item`}>\n <Tag closable={!disabled} onClose={(e) => onDelete(item.key, e)}>\n {item?.label}\n </Tag>\n </li>\n ))}\n <li className={`${prefix}-items-input`}>\n <FieldPopover\n onChange={handleFieldChange}\n clsPrefix={clsPrefix}\n options={data}\n trigger=\"click\"\n visible={visible}\n value={value}\n setVisible={setVisible}\n searchText={!tempItem && searchText ? searchText : null}\n locale={locale}\n searchTarget={searchTarget}\n setSearchTarget={setSearchTarget}\n >\n <Input\n // onKeyDown={keyDown}\n ref={inputRef}\n value={searchText}\n className=\"inputClass\"\n onPressEnter={onPressEnter}\n onChange={(e) => onInputChange(e.target.value)}\n placeholder={!value?.length ? placeholder || locale.placeholder : undefined}\n disabled={disabled}\n />\n </FieldPopover>\n </li>\n </ul>\n <div className={`${prefix}-prefix`}>\n <Icon type=\"filter\" />\n </div>\n <div className={`${prefix}-clear`}>\n <Icon\n onClick={onClear}\n type=\"close-circle\"\n theme=\"filled\"\n />\n </div>\n </div>\n )\n }}\n </LocaleReceiver>\n )\n}\nexport default forwardRef(CompositionInput)\n"]}
|