@pisell/materials 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +93 -0
- package/build/lowcode/assets-dev.json +93 -0
- package/build/lowcode/assets-prod.json +93 -0
- package/build/lowcode/designer.html +303 -0
- package/build/lowcode/index.html +305 -0
- package/build/lowcode/index.js +1 -0
- package/build/lowcode/meta.js +9 -0
- package/build/lowcode/preview.css +1 -0
- package/build/lowcode/preview.html +35 -0
- package/build/lowcode/preview.js +304 -0
- package/build/lowcode/render/default/view.js +22 -0
- package/build/lowcode/view.js +22 -0
- package/es/components/auto-complete/index.d.ts +3 -0
- package/es/components/auto-complete/index.js +4 -0
- package/es/components/button/index.d.ts +3 -0
- package/es/components/button/index.js +15 -0
- package/es/components/calendar/index.d.ts +3 -0
- package/es/components/calendar/index.js +4 -0
- package/es/components/cascader/index.d.ts +3 -0
- package/es/components/cascader/index.js +4 -0
- package/es/components/checkbox/index.d.ts +3 -0
- package/es/components/checkbox/index.js +5 -0
- package/es/components/config-provider/index.d.ts +4 -0
- package/es/components/config-provider/index.js +30 -0
- package/es/components/date-picker/index.d.ts +3 -0
- package/es/components/date-picker/index.js +7 -0
- package/es/components/drawer/index.d.ts +2 -0
- package/es/components/drawer/index.js +13 -0
- package/es/components/dropdown/index.d.ts +3 -0
- package/es/components/dropdown/index.js +13 -0
- package/es/components/form/index.d.ts +8 -0
- package/es/components/form/index.js +132 -0
- package/es/components/icon/index.d.ts +12 -0
- package/es/components/icon/index.js +40 -0
- package/es/components/input/index.d.ts +3 -0
- package/es/components/input/index.js +12 -0
- package/es/components/modal/index.d.ts +2 -0
- package/es/components/modal/index.js +18 -0
- package/es/components/radio/index.d.ts +3 -0
- package/es/components/radio/index.js +5 -0
- package/es/components/select/index.d.ts +3 -0
- package/es/components/select/index.js +4 -0
- package/es/components/skeleton/index.d.ts +3 -0
- package/es/components/skeleton/index.js +5 -0
- package/es/components/slider/index.d.ts +3 -0
- package/es/components/slider/index.js +16 -0
- package/es/components/table/index.d.ts +3 -0
- package/es/components/table/index.js +12 -0
- package/es/components/tabs/index.d.ts +11 -0
- package/es/components/tabs/index.js +93 -0
- package/es/components/time-picker/index.d.ts +3 -0
- package/es/components/time-picker/index.js +4 -0
- package/es/components/tree-select/index.d.ts +2 -0
- package/es/components/tree-select/index.js +6 -0
- package/es/components/upload/index.d.ts +3 -0
- package/es/components/upload/index.js +4 -0
- package/es/index.d.ts +63 -0
- package/es/index.js +85 -0
- package/es/utils/hoc.d.ts +17 -0
- package/es/utils/hoc.js +80 -0
- package/es/utils/warning.d.ts +1 -0
- package/es/utils/warning.js +6 -0
- package/lib/components/auto-complete/index.d.ts +3 -0
- package/lib/components/auto-complete/index.js +28 -0
- package/lib/components/button/index.d.ts +3 -0
- package/lib/components/button/index.js +45 -0
- package/lib/components/calendar/index.d.ts +3 -0
- package/lib/components/calendar/index.js +32 -0
- package/lib/components/cascader/index.d.ts +3 -0
- package/lib/components/cascader/index.js +28 -0
- package/lib/components/checkbox/index.d.ts +3 -0
- package/lib/components/checkbox/index.js +29 -0
- package/lib/components/config-provider/index.d.ts +4 -0
- package/lib/components/config-provider/index.js +54 -0
- package/lib/components/date-picker/index.d.ts +3 -0
- package/lib/components/date-picker/index.js +41 -0
- package/lib/components/drawer/index.d.ts +2 -0
- package/lib/components/drawer/index.js +45 -0
- package/lib/components/dropdown/index.d.ts +3 -0
- package/lib/components/dropdown/index.js +45 -0
- package/lib/components/form/index.d.ts +8 -0
- package/lib/components/form/index.js +114 -0
- package/lib/components/icon/index.d.ts +12 -0
- package/lib/components/icon/index.js +52 -0
- package/lib/components/input/index.d.ts +3 -0
- package/lib/components/input/index.js +38 -0
- package/lib/components/modal/index.d.ts +2 -0
- package/lib/components/modal/index.js +50 -0
- package/lib/components/radio/index.d.ts +3 -0
- package/lib/components/radio/index.js +29 -0
- package/lib/components/select/index.d.ts +3 -0
- package/lib/components/select/index.js +28 -0
- package/lib/components/skeleton/index.d.ts +3 -0
- package/lib/components/skeleton/index.js +29 -0
- package/lib/components/slider/index.d.ts +3 -0
- package/lib/components/slider/index.js +47 -0
- package/lib/components/table/index.d.ts +3 -0
- package/lib/components/table/index.js +41 -0
- package/lib/components/tabs/index.d.ts +11 -0
- package/lib/components/tabs/index.js +92 -0
- package/lib/components/time-picker/index.d.ts +3 -0
- package/lib/components/time-picker/index.js +31 -0
- package/lib/components/tree-select/index.d.ts +2 -0
- package/lib/components/tree-select/index.js +40 -0
- package/lib/components/upload/index.d.ts +3 -0
- package/lib/components/upload/index.js +28 -0
- package/lib/index.d.ts +63 -0
- package/lib/index.js +225 -0
- package/lib/utils/hoc.d.ts +17 -0
- package/lib/utils/hoc.js +101 -0
- package/lib/utils/warning.d.ts +1 -0
- package/lib/utils/warning.js +31 -0
- package/lowcode/_setters/antd-icon-setter/index.tsx +285 -0
- package/lowcode/_setters/antd-icon-setter/style.less +69 -0
- package/lowcode/_setters/index.tsx +1 -0
- package/lowcode/_utils/hoc.tsx +93 -0
- package/lowcode/_utils/transform-meta.ts +343 -0
- package/lowcode/_utils/utils.ts +6 -0
- package/lowcode/affix/__screenshots__/affix-1.jpg +0 -0
- package/lowcode/affix/meta.ts +68 -0
- package/lowcode/affix/snippets.ts +20 -0
- package/lowcode/alert/__screenshots__/alert-1.png +0 -0
- package/lowcode/alert/__screenshots__/alert-2.png +0 -0
- package/lowcode/alert/__screenshots__/alert-3.png +0 -0
- package/lowcode/alert/__screenshots__/alert-4.png +0 -0
- package/lowcode/alert/meta.ts +102 -0
- package/lowcode/alert/snippets.ts +54 -0
- package/lowcode/anchor/__screenshots__/anchor-1.png +0 -0
- package/lowcode/anchor/snippets.ts +30 -0
- package/lowcode/anchor.link/meta.ts +29 -0
- package/lowcode/anchor.link/snippets.ts +1 -0
- package/lowcode/auto-complete/__screenshots__/auto-complete-1.png +0 -0
- package/lowcode/auto-complete/meta.ts +453 -0
- package/lowcode/auto-complete/snippets.ts +26 -0
- package/lowcode/avatar/__screenshots__/avatar-1.jpg +0 -0
- package/lowcode/avatar/meta.ts +82 -0
- package/lowcode/avatar/snippets.ts +12 -0
- package/lowcode/badge/__screenshots__/badge-1.png +0 -0
- package/lowcode/badge/meta.ts +94 -0
- package/lowcode/badge/snippets.ts +12 -0
- package/lowcode/breadcrumb/__screenshots__/breadcrumb-1.jpg +0 -0
- package/lowcode/breadcrumb/meta.ts +136 -0
- package/lowcode/breadcrumb/snippets.ts +44 -0
- package/lowcode/button/__screenshots__/button-1.png +0 -0
- package/lowcode/button/__screenshots__/button-2.png +0 -0
- package/lowcode/button/__screenshots__/button-3.png +0 -0
- package/lowcode/button/__screenshots__/button-4.png +0 -0
- package/lowcode/button/__screenshots__/button-5.png +0 -0
- package/lowcode/button/__screenshots__/button-6.png +0 -0
- package/lowcode/button/meta.ts +510 -0
- package/lowcode/button/snippets.ts +68 -0
- package/lowcode/calendar/__screenshots__/calendar-1.jpg +0 -0
- package/lowcode/calendar/meta.ts +133 -0
- package/lowcode/calendar/snippets.ts +10 -0
- package/lowcode/card/__screenshots__/card-1.png +0 -0
- package/lowcode/card/meta.ts +97 -0
- package/lowcode/card/snippets.ts +12 -0
- package/lowcode/carousel/__screenshots__/carousel-1.jpg +0 -0
- package/lowcode/carousel/meta.ts +148 -0
- package/lowcode/carousel/snippets.ts +23 -0
- package/lowcode/cascader/__screenshots__/cascader-1.png +0 -0
- package/lowcode/cascader/meta.ts +175 -0
- package/lowcode/cascader/snippets.ts +46 -0
- package/lowcode/checkbox/__screenshots__/checkbox-1.png +0 -0
- package/lowcode/checkbox/meta.ts +85 -0
- package/lowcode/checkbox/snippets.ts +35 -0
- package/lowcode/checkbox.group/__screenshots__/checkbox-group-1.png +0 -0
- package/lowcode/checkbox.group/meta.ts +150 -0
- package/lowcode/collapse/__screenshots__/collapse-1.png +0 -0
- package/lowcode/collapse/meta.ts +221 -0
- package/lowcode/collapse/snippets.ts +28 -0
- package/lowcode/collapse.pane/meta.ts +84 -0
- package/lowcode/config-provider/__screenshots__/config-provider-1.jpg +0 -0
- package/lowcode/config-provider/meta.ts +140 -0
- package/lowcode/config-provider/snippets.ts +10 -0
- package/lowcode/date-picker/__screenshots__/date-picker-1.png +0 -0
- package/lowcode/date-picker/__screenshots__/date-picker-2.png +0 -0
- package/lowcode/date-picker/__screenshots__/date-picker-3.png +0 -0
- package/lowcode/date-picker/__screenshots__/date-picker-4.png +0 -0
- package/lowcode/date-picker/__screenshots__/date-picker-5.png +0 -0
- package/lowcode/date-picker/meta.ts +281 -0
- package/lowcode/date-picker/snippets.ts +50 -0
- package/lowcode/date-picker.range-picker/__screenshots__/date-picker-range-picker-1.png +0 -0
- package/lowcode/date-picker.range-picker/__screenshots__/date-picker-range-picker-2.png +0 -0
- package/lowcode/date-picker.range-picker/__screenshots__/date-picker-range-picker-3.png +0 -0
- package/lowcode/date-picker.range-picker/__screenshots__/date-picker-range-picker-4.png +0 -0
- package/lowcode/date-picker.range-picker/meta.ts +356 -0
- package/lowcode/date-picker.range-picker/snippets.ts +44 -0
- package/lowcode/descriptions/__screenshots__/descriptions-1.jpg +0 -0
- package/lowcode/descriptions/meta.ts +230 -0
- package/lowcode/descriptions/snippets.ts +18 -0
- package/lowcode/descriptions.item/meta.ts +37 -0
- package/lowcode/directory-tree/meta.ts +2747 -0
- package/lowcode/divider/__screenshots__/divider-1.png +0 -0
- package/lowcode/divider/__screenshots__/divider-2.png +0 -0
- package/lowcode/divider/meta.ts +70 -0
- package/lowcode/divider/snippets.ts +27 -0
- package/lowcode/drawer/__screenshots__/drawer-1.png +0 -0
- package/lowcode/drawer/__screenshots__/drawer-2.png +0 -0
- package/lowcode/drawer/meta.ts +420 -0
- package/lowcode/drawer/snippets.ts +40 -0
- package/lowcode/dropdown/__screenshots__/dropdown-1.png +0 -0
- package/lowcode/dropdown/meta.ts +143 -0
- package/lowcode/dropdown/snippets.ts +73 -0
- package/lowcode/empty/__screenshots__/empty-1.png +0 -0
- package/lowcode/empty/meta.ts +40 -0
- package/lowcode/empty/snippets.ts +10 -0
- package/lowcode/form/__screenshots__/form-1.png +0 -0
- package/lowcode/form/meta.ts +380 -0
- package/lowcode/form/snippets.ts +511 -0
- package/lowcode/form.item/__screenshots__/form-item-1.jpg +0 -0
- package/lowcode/form.item/meta.ts +348 -0
- package/lowcode/form.item/snippets.ts +12 -0
- package/lowcode/form.list/meta.ts +42 -0
- package/lowcode/form.list/snippets.ts +11 -0
- package/lowcode/grid.col/meta.ts +116 -0
- package/lowcode/grid.col/snippets.ts +1 -0
- package/lowcode/grid.row/__screenshots__/1-1-1-1.png +0 -0
- package/lowcode/grid.row/__screenshots__/1-1-1.png +0 -0
- package/lowcode/grid.row/__screenshots__/1-1.png +0 -0
- package/lowcode/grid.row/__screenshots__/1-3.png +0 -0
- package/lowcode/grid.row/meta.ts +118 -0
- package/lowcode/grid.row/snippets.ts +108 -0
- package/lowcode/icon/__screenshots__/icon-1.jpg +0 -0
- package/lowcode/icon/meta.ts +74 -0
- package/lowcode/icon/snippets.ts +13 -0
- package/lowcode/image/__screenshots__/image-1.png +0 -0
- package/lowcode/image/meta.ts +53 -0
- package/lowcode/image/snippets.ts +14 -0
- package/lowcode/input/__screenshots__/input-1.png +0 -0
- package/lowcode/input/meta.ts +190 -0
- package/lowcode/input/snippets.ts +12 -0
- package/lowcode/input-number/__screenshots__/input-number-1.png +0 -0
- package/lowcode/input-number/meta.ts +213 -0
- package/lowcode/input-number/snippets.ts +12 -0
- package/lowcode/input.group/__screenshots__/input-group-1.jpg +0 -0
- package/lowcode/input.group/meta.ts +53 -0
- package/lowcode/input.group/snippets.ts +24 -0
- package/lowcode/input.password/__screenshots__/input-password-1.png +0 -0
- package/lowcode/input.password/meta.ts +192 -0
- package/lowcode/input.password/snippets.ts +12 -0
- package/lowcode/input.search/__screenshots__/input-search-1.png +0 -0
- package/lowcode/input.search/meta.ts +206 -0
- package/lowcode/input.search/snippets.ts +12 -0
- package/lowcode/input.text-area/__screenshots__/input-text-area-1.png +0 -0
- package/lowcode/input.text-area/meta.ts +210 -0
- package/lowcode/input.text-area/snippets.ts +16 -0
- package/lowcode/list/__screenshots__/list-1.png +0 -0
- package/lowcode/list/meta.ts +499 -0
- package/lowcode/list/snippets.ts +201 -0
- package/lowcode/list.item/meta.ts +58 -0
- package/lowcode/list.item.meta/meta.ts +49 -0
- package/lowcode/login/meta.ts +56 -0
- package/lowcode/mentions/__screenshots__/mentions-1.png +0 -0
- package/lowcode/mentions/meta.ts +159 -0
- package/lowcode/mentions/snippets.ts +10 -0
- package/lowcode/menu/__screenshots__/menu-1.jpg +0 -0
- package/lowcode/menu/meta.ts +248 -0
- package/lowcode/menu/snippets.ts +22 -0
- package/lowcode/menu/utils.ts +97 -0
- package/lowcode/menu.item/meta.ts +63 -0
- package/lowcode/menu.item/snippets.ts +1 -0
- package/lowcode/menu.item-group/__screenshots__/menu-item-group-1.png +0 -0
- package/lowcode/menu.item-group/meta.ts +110 -0
- package/lowcode/menu.item-group/snippets.ts +1 -0
- package/lowcode/menu.sub-menu/meta.ts +131 -0
- package/lowcode/menu.sub-menu/snippets.ts +1 -0
- package/lowcode/modal/__screenshots__/modal-1.png +0 -0
- package/lowcode/modal/__screenshots__/modal-2.png +0 -0
- package/lowcode/modal/meta.ts +270 -0
- package/lowcode/modal/snippets.ts +33 -0
- package/lowcode/page-header/__screenshots__/page-header-1.jpg +0 -0
- package/lowcode/page-header/meta.ts +157 -0
- package/lowcode/page-header/snippets.ts +13 -0
- package/lowcode/pagination/__screenshots__/pagination-1.jpg +0 -0
- package/lowcode/pagination/meta.ts +231 -0
- package/lowcode/pagination/snippets.ts +14 -0
- package/lowcode/popconfirm/__screenshots__/popconfirm-1.jpg +0 -0
- package/lowcode/popconfirm/meta.ts +121 -0
- package/lowcode/popconfirm/snippets.ts +21 -0
- package/lowcode/popover/__screenshots__/popover-1.jpg +0 -0
- package/lowcode/popover/meta.ts +332 -0
- package/lowcode/popover/snippets.ts +10 -0
- package/lowcode/progress/__screenshots__/progress-1.png +0 -0
- package/lowcode/progress/__screenshots__/progress-2.png +0 -0
- package/lowcode/progress/meta.ts +142 -0
- package/lowcode/progress/snippets.ts +24 -0
- package/lowcode/radio/__screenshots__/radio-1.png +0 -0
- package/lowcode/radio/meta.ts +69 -0
- package/lowcode/radio/snippets.ts +35 -0
- package/lowcode/radio.group/__screenshots__/radio-group-1.png +0 -0
- package/lowcode/radio.group/meta.ts +213 -0
- package/lowcode/rate/__screenshots__/rate-1.png +0 -0
- package/lowcode/rate/meta.ts +132 -0
- package/lowcode/rate/snippets.ts +12 -0
- package/lowcode/result/__screenshots__/result-1.png +0 -0
- package/lowcode/result/meta.ts +53 -0
- package/lowcode/result/snippets.ts +14 -0
- package/lowcode/select/__screenshots__/select-1.png +0 -0
- package/lowcode/select/meta.ts +427 -0
- package/lowcode/select/snippets.ts +28 -0
- package/lowcode/skeleton/__screenshots__/skeleton-1.png +0 -0
- package/lowcode/skeleton/meta.ts +63 -0
- package/lowcode/skeleton/snippets.ts +13 -0
- package/lowcode/slider/__screenshots__/slider-1.png +0 -0
- package/lowcode/slider/meta.ts +218 -0
- package/lowcode/slider/snippets.ts +12 -0
- package/lowcode/slot/meta.ts +61 -0
- package/lowcode/slot/view.tsx +58 -0
- package/lowcode/space/__screenshots__/space-1.png +0 -0
- package/lowcode/space/meta.ts +65 -0
- package/lowcode/space/snippets.ts +24 -0
- package/lowcode/spin/__screenshots__/spin-1.png +0 -0
- package/lowcode/spin/meta.ts +60 -0
- package/lowcode/spin/snippets.ts +13 -0
- package/lowcode/statistic/__screenshots__/statistic-1.png +0 -0
- package/lowcode/statistic/meta.ts +67 -0
- package/lowcode/statistic/snippets.ts +13 -0
- package/lowcode/steps/__screenshots__/steps-1.png +0 -0
- package/lowcode/steps/meta.ts +281 -0
- package/lowcode/steps/snippets.ts +36 -0
- package/lowcode/steps.step/meta.ts +54 -0
- package/lowcode/steps.step/snippets.ts +1 -0
- package/lowcode/switch/__screenshots__/switch-1.png +0 -0
- package/lowcode/switch/meta.ts +122 -0
- package/lowcode/switch/snippets.ts +12 -0
- package/lowcode/table/__screenshots__/table-1.png +0 -0
- package/lowcode/table/meta.ts +847 -0
- package/lowcode/table/snippets.ts +43 -0
- package/lowcode/tabs/__screenshots__/tabs-1.jpg +0 -0
- package/lowcode/tabs/__screenshots__/tabs-2.jpg +0 -0
- package/lowcode/tabs/__screenshots__/tabs-3.jpg +0 -0
- package/lowcode/tabs/meta.ts +415 -0
- package/lowcode/tabs/snippets.ts +86 -0
- package/lowcode/tabs.tab-pane/meta.ts +78 -0
- package/lowcode/tag/__screenshots__/tag-1.png +0 -0
- package/lowcode/tag/meta.ts +69 -0
- package/lowcode/tag/snippets.ts +13 -0
- package/lowcode/time-picker/__screenshots__/time-picker-1.png +0 -0
- package/lowcode/time-picker/meta.ts +224 -0
- package/lowcode/time-picker/snippets.ts +10 -0
- package/lowcode/timeline/__screenshots__/timeline-1.jpg +0 -0
- package/lowcode/timeline/meta.ts +189 -0
- package/lowcode/timeline/snippets.ts +21 -0
- package/lowcode/timeline.item/__screenshots__/timeline-1.jpg +0 -0
- package/lowcode/timeline.item/meta.ts +53 -0
- package/lowcode/timeline.item/snippets.ts +10 -0
- package/lowcode/tooltip/__screenshots__/tooltip-1.jpg +0 -0
- package/lowcode/tooltip/meta.ts +306 -0
- package/lowcode/tooltip/snippets.ts +12 -0
- package/lowcode/transfer/__screenshots__/transfer-1.png +0 -0
- package/lowcode/transfer/meta.ts +304 -0
- package/lowcode/transfer/snippets.ts +42 -0
- package/lowcode/tree/__screenshots__/tree-1.jpg +0 -0
- package/lowcode/tree/meta.ts +377 -0
- package/lowcode/tree/snippets.ts +30 -0
- package/lowcode/tree-select/__screenshots__/tree-select-1.png +0 -0
- package/lowcode/tree-select/meta.ts +314 -0
- package/lowcode/tree-select/snippets.ts +34 -0
- package/lowcode/typography.link/__screenshots__/typography-link-1.png +0 -0
- package/lowcode/typography.link/meta.ts +44 -0
- package/lowcode/typography.link/snippets.ts +14 -0
- package/lowcode/typography.paragraph/__screenshots__/typography-paragraph-1.png +0 -0
- package/lowcode/typography.paragraph/meta.ts +129 -0
- package/lowcode/typography.paragraph/snippets.ts +14 -0
- package/lowcode/typography.text/__screenshots__/typography-text-1.png +0 -0
- package/lowcode/typography.text/__screenshots__/typography-text-2.png +0 -0
- package/lowcode/typography.text/__screenshots__/typography-text-3.png +0 -0
- package/lowcode/typography.text/meta.ts +200 -0
- package/lowcode/typography.text/snippets.ts +34 -0
- package/lowcode/typography.title/__screenshots__/typography-title-1.png +0 -0
- package/lowcode/typography.title/__screenshots__/typography-title-2.png +0 -0
- package/lowcode/typography.title/__screenshots__/typography-title-3.png +0 -0
- package/lowcode/typography.title/__screenshots__/typography-title-4.png +0 -0
- package/lowcode/typography.title/meta.ts +130 -0
- package/lowcode/typography.title/snippets.ts +46 -0
- package/lowcode/upload/__screenshots__/upload-1.png +0 -0
- package/lowcode/upload/meta.ts +439 -0
- package/lowcode/upload/snippets.ts +16 -0
- package/package.json +37 -3
- package/.fatherrc.ts +0 -7
- package/CHANGELOG.md +0 -7
- package/tsconfig.json +0 -14
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import React, { useState, useEffect, Component } from 'react';
|
|
2
|
+
// setter使用@alifd/next,和编辑器保持一致
|
|
3
|
+
import { Input, Icon as NextIcon, Radio, Balloon, Search } from '@alifd/next';
|
|
4
|
+
import { get } from '../../_utils/utils';
|
|
5
|
+
import './style.less';
|
|
6
|
+
|
|
7
|
+
type IconGroup = 'outlined' | 'filled' | 'two-tone' | 'iconfont';
|
|
8
|
+
const IconGroupNameMap: Record<IconGroup, string> = {
|
|
9
|
+
outlined: '线框风格',
|
|
10
|
+
filled: '实底风格',
|
|
11
|
+
'two-tone': '双色风格',
|
|
12
|
+
iconfont: 'Iconfont',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
function getIconfontIconList() {
|
|
16
|
+
const iframe = document.querySelector<HTMLIFrameElement>(
|
|
17
|
+
'iframe.lc-simulator-content-frame',
|
|
18
|
+
)!;
|
|
19
|
+
|
|
20
|
+
const antdIcons = get(iframe, 'contentWindow.icons', {}) as Record<
|
|
21
|
+
string,
|
|
22
|
+
any
|
|
23
|
+
>;
|
|
24
|
+
|
|
25
|
+
console.log(antdIcons,'antdIcons');
|
|
26
|
+
|
|
27
|
+
// iconfont的js会在页面中添加svg元素
|
|
28
|
+
const symbols = Array.prototype.slice.call(
|
|
29
|
+
iframe.contentDocument!.querySelectorAll(
|
|
30
|
+
'svg[style="position: absolute; width: 0px; height: 0px; overflow: hidden;"][aria-hidden="true"] > symbol',
|
|
31
|
+
),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const Icon = antdIcons.createFromIconfontCN?.();
|
|
35
|
+
|
|
36
|
+
return symbols.map(symbol => {
|
|
37
|
+
const { id } = symbol;
|
|
38
|
+
return {
|
|
39
|
+
name: id,
|
|
40
|
+
group: 'iconfont',
|
|
41
|
+
icon: (props: any) => (
|
|
42
|
+
<span role="img" className="anticon">
|
|
43
|
+
<svg
|
|
44
|
+
viewBox="64 64 896 896"
|
|
45
|
+
width="1em"
|
|
46
|
+
height="1em"
|
|
47
|
+
fill="currentColor"
|
|
48
|
+
dangerouslySetInnerHTML={{ __html: symbol.innerHTML }}
|
|
49
|
+
/>
|
|
50
|
+
</span>
|
|
51
|
+
),
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function getAntdIconList() {
|
|
57
|
+
const iframe = document.querySelector<HTMLIFrameElement>(
|
|
58
|
+
'iframe.lc-simulator-content-frame',
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const icons: Record<string, any> = {};
|
|
62
|
+
|
|
63
|
+
// document.querySelectorAll('svg[style="position: absolute; width: 0px; height: 0px; overflow: hidden;"][aria-hidden="true"]')
|
|
64
|
+
const antdIcons = get(iframe, 'contentWindow.icons', {}) as Record<
|
|
65
|
+
string,
|
|
66
|
+
any
|
|
67
|
+
>;
|
|
68
|
+
|
|
69
|
+
return Object.keys(antdIcons)
|
|
70
|
+
.map(key => {
|
|
71
|
+
const item = (antdIcons as any)[key];
|
|
72
|
+
|
|
73
|
+
if (typeof item !== 'object') {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const name = item?.displayName ?? item?.render?.displayName ?? key;
|
|
78
|
+
let group: IconGroup = 'outlined';
|
|
79
|
+
|
|
80
|
+
const lowercaseName = name.toLowerCase();
|
|
81
|
+
|
|
82
|
+
if (/outlined$/.test(lowercaseName)) {
|
|
83
|
+
group = 'outlined';
|
|
84
|
+
} else if (/filled$/.test(lowercaseName)) {
|
|
85
|
+
group = 'filled';
|
|
86
|
+
} else if (/twotone$/.test(lowercaseName)) {
|
|
87
|
+
group = 'two-tone';
|
|
88
|
+
} else {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
name,
|
|
94
|
+
group,
|
|
95
|
+
icon: item,
|
|
96
|
+
};
|
|
97
|
+
})
|
|
98
|
+
.filter(Boolean);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function getIconList() {
|
|
102
|
+
const iconfontIconList = getIconfontIconList();
|
|
103
|
+
const antdIconList = getAntdIconList();
|
|
104
|
+
|
|
105
|
+
return [...antdIconList, ...iconfontIconList];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const Icon = (props: any) => {
|
|
109
|
+
const { type, icons = {}, ...rest } = props;
|
|
110
|
+
const Comp = icons[type];
|
|
111
|
+
if (!Comp) return null;
|
|
112
|
+
return <Comp {...rest} />;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
interface AntdIconSetterProps {
|
|
116
|
+
value: string;
|
|
117
|
+
type: string;
|
|
118
|
+
defaultValue: string;
|
|
119
|
+
placeholder: string;
|
|
120
|
+
hasClear: boolean;
|
|
121
|
+
onChange: (icon: string | object) => undefined;
|
|
122
|
+
icons: string[];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const AntdIconSetter = (props: AntdIconSetterProps) => {
|
|
126
|
+
const [search, setSearch] = useState('');
|
|
127
|
+
const [icons, setIcons] = useState<Record<string, any>>({});
|
|
128
|
+
const [groups, setGroups] = useState<{ group: IconGroup; list: any[] }[]>([]);
|
|
129
|
+
const [selectedGroup, setSelectedGroup] = useState<IconGroup>('outlined');
|
|
130
|
+
const [firstLoad, setFirstLoad] = useState(true);
|
|
131
|
+
const [list, setList] = useState<any[]>([]);
|
|
132
|
+
|
|
133
|
+
const { value, defaultValue, type, onChange, placeholder, hasClear } = props;
|
|
134
|
+
|
|
135
|
+
const _value =
|
|
136
|
+
typeof value === 'object' ? (value as any)?.props?.type : value;
|
|
137
|
+
if (firstLoad && defaultValue && typeof value === 'undefined') {
|
|
138
|
+
onChange(defaultValue);
|
|
139
|
+
setFirstLoad(false);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const handleChange = (icon: string) => {
|
|
143
|
+
if (type === 'string') {
|
|
144
|
+
onChange(icon);
|
|
145
|
+
} else if (type === 'node') {
|
|
146
|
+
onChange({
|
|
147
|
+
componentName: 'Icon',
|
|
148
|
+
props: {
|
|
149
|
+
type: icon,
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
const iconList = getIconList();
|
|
157
|
+
|
|
158
|
+
const groups: { group: IconGroup; list: any[] }[] = [];
|
|
159
|
+
const icons: any = {};
|
|
160
|
+
|
|
161
|
+
iconList.forEach(item => {
|
|
162
|
+
const { group, name, icon } = item!;
|
|
163
|
+
if (groups.every(item => item.group !== group)) {
|
|
164
|
+
groups.push({ group: group as IconGroup, list: [] });
|
|
165
|
+
}
|
|
166
|
+
const target = groups.find(item => item.group === group)!;
|
|
167
|
+
target.list.push(item);
|
|
168
|
+
icons[item!.name] = item?.icon;
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
setIcons(icons);
|
|
172
|
+
setGroups(groups);
|
|
173
|
+
setSelectedGroup(groups[0]?.group);
|
|
174
|
+
}, []);
|
|
175
|
+
|
|
176
|
+
useEffect(() => {
|
|
177
|
+
const currentGroup = groups.find(item => item.group === selectedGroup);
|
|
178
|
+
setList(
|
|
179
|
+
(currentGroup?.list ?? []).filter(item => {
|
|
180
|
+
return search
|
|
181
|
+
? item.name.toLowerCase().indexOf(search.toLowerCase()) > -1
|
|
182
|
+
: true;
|
|
183
|
+
}),
|
|
184
|
+
);
|
|
185
|
+
}, [selectedGroup, search, groups]);
|
|
186
|
+
|
|
187
|
+
const currentIcon = (
|
|
188
|
+
<Icon type={_value} icons={icons} style={{ fontSize: 16 }} />
|
|
189
|
+
);
|
|
190
|
+
const clearIcon = hasClear && (
|
|
191
|
+
<NextIcon
|
|
192
|
+
size="xs"
|
|
193
|
+
id="icon-clear"
|
|
194
|
+
type="delete-filling"
|
|
195
|
+
onClick={e => {
|
|
196
|
+
e.preventDefault();
|
|
197
|
+
e.stopPropagation();
|
|
198
|
+
handleChange('');
|
|
199
|
+
}}
|
|
200
|
+
/>
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
const triggerNode = (
|
|
204
|
+
<div>
|
|
205
|
+
<Input
|
|
206
|
+
placeholder={placeholder}
|
|
207
|
+
addonTextBefore={currentIcon}
|
|
208
|
+
onChange={handleChange}
|
|
209
|
+
value={_value}
|
|
210
|
+
defaultValue={defaultValue}
|
|
211
|
+
readOnly
|
|
212
|
+
addonTextAfter={clearIcon}
|
|
213
|
+
/>
|
|
214
|
+
</div>
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
return (
|
|
218
|
+
<div className="lc-antd-icon-setter">
|
|
219
|
+
<Balloon
|
|
220
|
+
className="lc-antd-icon-setter-balloon"
|
|
221
|
+
trigger={triggerNode}
|
|
222
|
+
needAdjust
|
|
223
|
+
triggerType="click"
|
|
224
|
+
closable={false}
|
|
225
|
+
alignEdge
|
|
226
|
+
align="lt"
|
|
227
|
+
style={{ width: 300 }}
|
|
228
|
+
>
|
|
229
|
+
<div className="lc-antd-icon-setter-header">
|
|
230
|
+
<Radio.Group
|
|
231
|
+
className="lc-antd-icon-setter-header-style"
|
|
232
|
+
shape="button"
|
|
233
|
+
value={selectedGroup}
|
|
234
|
+
onChange={value => setSelectedGroup(value as any)}
|
|
235
|
+
>
|
|
236
|
+
{groups.map(item => (
|
|
237
|
+
<Radio key={item.group} value={item.group}>
|
|
238
|
+
{IconGroupNameMap[item.group]}
|
|
239
|
+
</Radio>
|
|
240
|
+
))}
|
|
241
|
+
</Radio.Group>
|
|
242
|
+
<Search
|
|
243
|
+
className="lc-antd-icon-setter-header-search"
|
|
244
|
+
size="medium"
|
|
245
|
+
shape="simple"
|
|
246
|
+
onChange={setSearch}
|
|
247
|
+
/>
|
|
248
|
+
</div>
|
|
249
|
+
<div className="lc-antd-icon-setter-content">
|
|
250
|
+
<ul className="lc-antd-icon-setter-list">
|
|
251
|
+
{list.map(item => (
|
|
252
|
+
<li
|
|
253
|
+
key={item.name}
|
|
254
|
+
className="lc-antd-icon-setter-list-item"
|
|
255
|
+
onClick={() => handleChange(item.name)}
|
|
256
|
+
>
|
|
257
|
+
<Icon type={item.name} icons={icons} />
|
|
258
|
+
<div className="lc-antd-icon-setter-list-item-name">
|
|
259
|
+
{item.name}
|
|
260
|
+
</div>
|
|
261
|
+
</li>
|
|
262
|
+
))}
|
|
263
|
+
</ul>
|
|
264
|
+
</div>
|
|
265
|
+
</Balloon>
|
|
266
|
+
</div>
|
|
267
|
+
);
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
AntdIconSetter.defaultProps = {
|
|
271
|
+
value: undefined,
|
|
272
|
+
type: 'string',
|
|
273
|
+
defaultValue: '',
|
|
274
|
+
hasClear: false,
|
|
275
|
+
placeholder: '请点击选择 Icon',
|
|
276
|
+
onChange: () => undefined,
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
// 因为下面这个问题,setter必须使用class组件
|
|
280
|
+
// http://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/issues/109046
|
|
281
|
+
export default class extends Component<AntdIconSetterProps> {
|
|
282
|
+
render() {
|
|
283
|
+
return <AntdIconSetter {...this.props} />;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
.lc-antd-icon-setter {
|
|
2
|
+
&-header {
|
|
3
|
+
&-style {
|
|
4
|
+
width: 100%;
|
|
5
|
+
margin-bottom: 12px;
|
|
6
|
+
display: flex;
|
|
7
|
+
|
|
8
|
+
> label {
|
|
9
|
+
flex: 1;
|
|
10
|
+
text-align: center;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&-search {
|
|
15
|
+
width: 100%;
|
|
16
|
+
margin-bottom: 12px;
|
|
17
|
+
padding-bottom: 12px;
|
|
18
|
+
border-bottom: 1px solid #ddd;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&-list {
|
|
23
|
+
display: block;
|
|
24
|
+
max-height: 400px;
|
|
25
|
+
overflow-y: auto;
|
|
26
|
+
overflow-x: hidden;
|
|
27
|
+
|
|
28
|
+
&-item {
|
|
29
|
+
display: inline-block;
|
|
30
|
+
position: relative;
|
|
31
|
+
width: 36px;
|
|
32
|
+
height: 36px;
|
|
33
|
+
line-height: 36px;
|
|
34
|
+
text-align: center;
|
|
35
|
+
font-size: 24px;
|
|
36
|
+
border-radius: 4px;
|
|
37
|
+
transition: background-color 0.2s;
|
|
38
|
+
|
|
39
|
+
&-name {
|
|
40
|
+
display: none;
|
|
41
|
+
font-size: 14px;
|
|
42
|
+
position: absolute;
|
|
43
|
+
height: 30px;
|
|
44
|
+
word-break: keep-all;
|
|
45
|
+
white-space: nowrap;
|
|
46
|
+
bottom: -24px;
|
|
47
|
+
left: 50%;
|
|
48
|
+
z-index: 100;
|
|
49
|
+
height: 24px;
|
|
50
|
+
line-height: 24px;
|
|
51
|
+
padding: 0 5px;
|
|
52
|
+
border-radius: 4px;
|
|
53
|
+
background-color: #fff;
|
|
54
|
+
pointer-events: none;
|
|
55
|
+
transform: translateX(-50%);
|
|
56
|
+
box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
57
|
+
0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&:hover {
|
|
61
|
+
background-color: #f1f2f3;
|
|
62
|
+
|
|
63
|
+
.lc-antd-icon-setter-list-item-name {
|
|
64
|
+
display: block;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as AntdIconSetter } from './antd-icon-setter';
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React, { ComponentType, ReactNode, useState } from 'react';
|
|
2
|
+
import moment from 'moment';
|
|
3
|
+
import { get, set, has } from './utils';
|
|
4
|
+
|
|
5
|
+
function convertProps(
|
|
6
|
+
props: Record<string, any>,
|
|
7
|
+
list: string[],
|
|
8
|
+
mapper: (v: any, key: string) => any,
|
|
9
|
+
) {
|
|
10
|
+
const out: Record<string, any> = {};
|
|
11
|
+
list.forEach(key => {
|
|
12
|
+
if (has(props, key)) {
|
|
13
|
+
set(out, key, mapper(get(props, key), key));
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
return out;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 简单包装,不做任何处理
|
|
21
|
+
* 部分组件ref比较特殊,包一层会解决这个问题
|
|
22
|
+
*/
|
|
23
|
+
export function withWrap(Comp: ComponentType<any>) {
|
|
24
|
+
return (props: any) => {
|
|
25
|
+
return <Comp {...props} />;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 某些组件会用React.Children.only检查子节点
|
|
31
|
+
* 需要做处理避免报错
|
|
32
|
+
*/
|
|
33
|
+
export function withSingleChild(
|
|
34
|
+
Comp: ComponentType<any>,
|
|
35
|
+
needsConvert = ['children'],
|
|
36
|
+
) {
|
|
37
|
+
return (props: any) => {
|
|
38
|
+
const convertedProps = convertProps(props, needsConvert, prop => {
|
|
39
|
+
let node = React.Children.toArray(prop)[0];
|
|
40
|
+
if (node === null || typeof node !== 'object') {
|
|
41
|
+
node = <div>{node}</div>;
|
|
42
|
+
}
|
|
43
|
+
return node;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return <Comp {...(props as any)} {...(convertedProps as any)} />;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function withSingleFunctionChild(Comp: ComponentType<any>) {
|
|
51
|
+
return (props: any) => {
|
|
52
|
+
const { children } = props;
|
|
53
|
+
|
|
54
|
+
let node;
|
|
55
|
+
if (typeof children === 'function') {
|
|
56
|
+
node = children;
|
|
57
|
+
}
|
|
58
|
+
if (
|
|
59
|
+
Array.isArray(children) &&
|
|
60
|
+
children.length === 1 &&
|
|
61
|
+
typeof children[0] === 'function'
|
|
62
|
+
) {
|
|
63
|
+
node = children[0];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (node) {
|
|
67
|
+
return <Comp {...(props as any)}>{node}</Comp>;
|
|
68
|
+
}
|
|
69
|
+
return <div>{children}</div>;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* moment对象在序列化后会被转为字符串
|
|
75
|
+
* 需要让日期类组件支持接受字符串值
|
|
76
|
+
*/
|
|
77
|
+
export function withMomentProps(
|
|
78
|
+
Comp: ComponentType<any>,
|
|
79
|
+
needsConvert = ['value', 'defaultValue'],
|
|
80
|
+
) {
|
|
81
|
+
return (props: any) => {
|
|
82
|
+
const convertedProps = convertProps(props, needsConvert, prop => {
|
|
83
|
+
if (prop) {
|
|
84
|
+
if (Array.isArray(prop)) {
|
|
85
|
+
return prop.map(v => (moment.isMoment(v) ? v : moment(v)));
|
|
86
|
+
}
|
|
87
|
+
return moment.isMoment(prop) ? prop : moment(prop);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
return <Comp {...(props as any)} {...(convertedProps as any)} />;
|
|
92
|
+
};
|
|
93
|
+
}
|