@thienvu18/designable-react-settings-form 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/esm/SchemaField.d.ts +5115 -1578
  2. package/esm/SchemaField.js +76 -41
  3. package/esm/SettingsForm.d.ts +4 -4
  4. package/esm/SettingsForm.js +99 -49
  5. package/esm/components/BackgroundStyleSetter/index.d.ts +4 -4
  6. package/esm/components/BackgroundStyleSetter/index.js +95 -42
  7. package/esm/components/BorderRadiusStyleSetter/index.d.ts +4 -4
  8. package/esm/components/BorderRadiusStyleSetter/index.js +13 -10
  9. package/esm/components/BorderStyleSetter/index.d.ts +5 -5
  10. package/esm/components/BorderStyleSetter/index.js +121 -68
  11. package/esm/components/BoxShadowStyleSetter/index.d.ts +6 -6
  12. package/esm/components/BoxShadowStyleSetter/index.js +72 -24
  13. package/esm/components/BoxStyleSetter/index.d.ts +7 -7
  14. package/esm/components/BoxStyleSetter/index.js +98 -46
  15. package/esm/components/CollapseItem/index.d.ts +6 -6
  16. package/esm/components/CollapseItem/index.js +35 -15
  17. package/esm/components/ColorInput/index.d.ts +5 -5
  18. package/esm/components/ColorInput/index.js +35 -17
  19. package/esm/components/ColorInput/styles.less +0 -5
  20. package/esm/components/CornerInput/index.d.ts +7 -7
  21. package/esm/components/CornerInput/index.js +50 -21
  22. package/esm/components/DisplayStyleSetter/index.d.ts +7 -7
  23. package/esm/components/DisplayStyleSetter/index.js +62 -33
  24. package/esm/components/DrawerSetter/index.d.ts +6 -6
  25. package/esm/components/DrawerSetter/index.js +82 -42
  26. package/esm/components/DrawerSetter/styles.less +2 -2
  27. package/esm/components/FlexStyleSetter/index.d.ts +5 -5
  28. package/esm/components/FlexStyleSetter/index.js +160 -110
  29. package/esm/components/FoldItem/index.d.ts +9 -7
  30. package/esm/components/FoldItem/index.js +80 -46
  31. package/esm/components/FontStyleSetter/index.d.ts +4 -4
  32. package/esm/components/FontStyleSetter/index.js +169 -85
  33. package/esm/components/ImageInput/index.d.ts +7 -7
  34. package/esm/components/ImageInput/index.js +59 -39
  35. package/esm/components/InputItems/index.d.ts +19 -17
  36. package/esm/components/InputItems/index.js +42 -16
  37. package/esm/components/MonacoInput/config.d.ts +1 -1
  38. package/esm/components/MonacoInput/config.js +40 -38
  39. package/esm/components/MonacoInput/format.d.ts +4 -1
  40. package/esm/components/MonacoInput/format.js +33 -29
  41. package/esm/components/MonacoInput/index.d.ts +13 -13
  42. package/esm/components/MonacoInput/index.js +298 -212
  43. package/esm/components/MonacoInput/themes/chrome.d.ts +44 -38
  44. package/esm/components/MonacoInput/themes/chrome.js +105 -105
  45. package/esm/components/MonacoInput/themes/monokai.d.ts +34 -30
  46. package/esm/components/MonacoInput/themes/monokai.js +139 -139
  47. package/esm/components/PolyInput/index.d.ts +17 -17
  48. package/esm/components/PolyInput/index.js +96 -66
  49. package/esm/components/PositionInput/index.d.ts +7 -7
  50. package/esm/components/PositionInput/index.js +48 -21
  51. package/esm/components/PositionInput/styles.less +0 -1
  52. package/esm/components/SizeInput/index.d.ts +6 -2
  53. package/esm/components/SizeInput/index.js +44 -46
  54. package/esm/components/SizeInput/styles.less +0 -1
  55. package/esm/components/ValueInput/index.d.ts +2 -2
  56. package/esm/components/ValueInput/index.js +89 -72
  57. package/esm/components/index.d.ts +20 -20
  58. package/esm/components/index.js +20 -20
  59. package/esm/effects/index.d.ts +2 -2
  60. package/esm/effects/index.js +2 -2
  61. package/esm/effects/useLocales.d.ts +2 -2
  62. package/esm/effects/useLocales.js +57 -59
  63. package/esm/effects/useSnapshot.d.ts +2 -2
  64. package/esm/effects/useSnapshot.js +9 -9
  65. package/esm/index.d.ts +5 -5
  66. package/esm/index.js +5 -5
  67. package/esm/locales/en-US.d.ts +12 -12
  68. package/esm/locales/en-US.js +10 -10
  69. package/esm/locales/index.d.ts +1 -1
  70. package/esm/locales/index.js +5 -5
  71. package/esm/locales/ko-KR.d.ts +12 -12
  72. package/esm/locales/ko-KR.js +10 -10
  73. package/esm/locales/zh-CN.d.ts +12 -12
  74. package/esm/locales/zh-CN.js +10 -10
  75. package/esm/registry.d.ts +2 -2
  76. package/esm/registry.js +11 -11
  77. package/esm/shared/context.d.ts +2 -2
  78. package/esm/shared/context.js +2 -2
  79. package/esm/shared/loadScript.d.ts +5 -5
  80. package/esm/shared/loadScript.js +27 -28
  81. package/esm/styles.less +5 -4
  82. package/esm/types.d.ts +8 -8
  83. package/esm/types.js +1 -1
  84. package/lib/SchemaField.d.ts +5115 -1578
  85. package/lib/SchemaField.js +44 -44
  86. package/lib/SettingsForm.d.ts +4 -4
  87. package/lib/SettingsForm.js +108 -55
  88. package/lib/components/BackgroundStyleSetter/index.d.ts +4 -4
  89. package/lib/components/BackgroundStyleSetter/index.js +106 -48
  90. package/lib/components/BorderRadiusStyleSetter/index.d.ts +4 -4
  91. package/lib/components/BorderRadiusStyleSetter/index.js +33 -14
  92. package/lib/components/BorderStyleSetter/index.d.ts +5 -5
  93. package/lib/components/BorderStyleSetter/index.js +138 -74
  94. package/lib/components/BoxShadowStyleSetter/index.d.ts +6 -6
  95. package/lib/components/BoxShadowStyleSetter/index.js +82 -30
  96. package/lib/components/BoxStyleSetter/index.d.ts +7 -7
  97. package/lib/components/BoxStyleSetter/index.js +122 -52
  98. package/lib/components/CollapseItem/index.d.ts +6 -6
  99. package/lib/components/CollapseItem/index.js +49 -21
  100. package/lib/components/ColorInput/index.d.ts +5 -5
  101. package/lib/components/ColorInput/index.js +39 -21
  102. package/lib/components/ColorInput/styles.less +0 -5
  103. package/lib/components/CornerInput/index.d.ts +7 -7
  104. package/lib/components/CornerInput/index.js +70 -28
  105. package/lib/components/DisplayStyleSetter/index.d.ts +7 -7
  106. package/lib/components/DisplayStyleSetter/index.js +75 -39
  107. package/lib/components/DrawerSetter/index.d.ts +6 -6
  108. package/lib/components/DrawerSetter/index.js +99 -48
  109. package/lib/components/DrawerSetter/styles.less +2 -2
  110. package/lib/components/FlexStyleSetter/index.d.ts +5 -5
  111. package/lib/components/FlexStyleSetter/index.js +208 -116
  112. package/lib/components/FoldItem/index.d.ts +9 -7
  113. package/lib/components/FoldItem/index.js +140 -72
  114. package/lib/components/FontStyleSetter/index.d.ts +4 -4
  115. package/lib/components/FontStyleSetter/index.js +216 -91
  116. package/lib/components/ImageInput/index.d.ts +7 -7
  117. package/lib/components/ImageInput/index.js +69 -47
  118. package/lib/components/InputItems/index.d.ts +19 -17
  119. package/lib/components/InputItems/index.js +101 -46
  120. package/lib/components/MonacoInput/config.d.ts +1 -1
  121. package/lib/components/MonacoInput/config.js +49 -45
  122. package/lib/components/MonacoInput/format.d.ts +4 -1
  123. package/lib/components/MonacoInput/format.js +38 -33
  124. package/lib/components/MonacoInput/index.d.ts +13 -13
  125. package/lib/components/MonacoInput/index.js +347 -241
  126. package/lib/components/MonacoInput/themes/chrome.d.ts +44 -38
  127. package/lib/components/MonacoInput/themes/chrome.js +107 -107
  128. package/lib/components/MonacoInput/themes/monokai.d.ts +34 -30
  129. package/lib/components/MonacoInput/themes/monokai.js +141 -141
  130. package/lib/components/PolyInput/index.d.ts +17 -17
  131. package/lib/components/PolyInput/index.js +151 -96
  132. package/lib/components/PositionInput/index.d.ts +7 -7
  133. package/lib/components/PositionInput/index.js +68 -28
  134. package/lib/components/PositionInput/styles.less +0 -1
  135. package/lib/components/SizeInput/index.d.ts +6 -2
  136. package/lib/components/SizeInput/index.js +47 -49
  137. package/lib/components/SizeInput/styles.less +0 -1
  138. package/lib/components/ValueInput/index.d.ts +2 -2
  139. package/lib/components/ValueInput/index.js +92 -75
  140. package/lib/components/index.d.ts +20 -20
  141. package/lib/components/index.js +52 -36
  142. package/lib/effects/index.d.ts +2 -2
  143. package/lib/effects/index.js +34 -18
  144. package/lib/effects/useLocales.d.ts +2 -2
  145. package/lib/effects/useLocales.js +67 -63
  146. package/lib/effects/useSnapshot.d.ts +2 -2
  147. package/lib/effects/useSnapshot.js +13 -13
  148. package/lib/index.d.ts +5 -5
  149. package/lib/index.js +37 -21
  150. package/lib/locales/en-US.d.ts +12 -12
  151. package/lib/locales/en-US.js +12 -12
  152. package/lib/locales/index.d.ts +1 -1
  153. package/lib/locales/index.js +16 -10
  154. package/lib/locales/ko-KR.d.ts +12 -12
  155. package/lib/locales/ko-KR.js +12 -12
  156. package/lib/locales/zh-CN.d.ts +12 -12
  157. package/lib/locales/zh-CN.js +12 -12
  158. package/lib/registry.d.ts +2 -2
  159. package/lib/registry.js +21 -19
  160. package/lib/shared/context.d.ts +2 -2
  161. package/lib/shared/context.js +5 -5
  162. package/lib/shared/loadScript.d.ts +5 -5
  163. package/lib/shared/loadScript.js +32 -32
  164. package/lib/styles.less +5 -4
  165. package/lib/types.d.ts +8 -8
  166. package/lib/types.js +2 -2
  167. package/package.json +4 -4
@@ -1,7 +1,7 @@
1
- import React from 'react';
2
- import './styles.less';
1
+ import React from 'react'
2
+ import './styles.less'
3
3
  export interface IColorInputProps {
4
- value?: string;
5
- onChange?: (color: string) => void;
4
+ value?: string
5
+ onChange?: (color: string) => void
6
6
  }
7
- export declare const ColorInput: React.FC<IColorInputProps>;
7
+ export declare const ColorInput: React.FC<IColorInputProps>
@@ -1,22 +1,40 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ColorInput = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const antd_1 = require("antd");
7
- const designable_react_1 = require("@thienvu18/designable-react");
8
- const react_color_1 = require("react-color");
9
- require("./styles.less");
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', { value: true })
3
+ exports.ColorInput = void 0
4
+ const jsx_runtime_1 = require('react/jsx-runtime')
5
+ const react_1 = require('react')
6
+ const antd_1 = require('antd')
7
+ const designable_react_1 = require('@thienvu18/designable-react')
8
+ require('./styles.less')
10
9
  const ColorInput = (props) => {
11
- const container = (0, react_1.useRef)(null);
12
- const prefix = (0, designable_react_1.usePrefix)('color-input');
13
- const color = props.value;
14
- return ((0, jsx_runtime_1.jsx)("div", { ref: container, className: prefix, children: (0, jsx_runtime_1.jsx)(antd_1.Input, { value: props.value, onChange: (e) => {
15
- props.onChange?.(e.target.value);
16
- }, placeholder: "Color", prefix: (0, jsx_runtime_1.jsx)(antd_1.Popover, { autoAdjustOverflow: true, trigger: "click", styles: { content: { padding: 0 } }, getPopupContainer: () => container.current || document.body, content: (0, jsx_runtime_1.jsx)(react_color_1.SketchPicker, { color: color, onChange: ({ rgb }) => {
17
- props.onChange?.(`rgba(${rgb.r},${rgb.g},${rgb.b},${rgb.a})`);
18
- } }), children: (0, jsx_runtime_1.jsx)("div", { className: prefix + '-color-tips', style: {
19
- backgroundColor: color,
20
- } }) }) }) }));
21
- };
22
- exports.ColorInput = ColorInput;
10
+ const container = (0, react_1.useRef)(null)
11
+ const prefix = (0, designable_react_1.usePrefix)('color-input')
12
+ const color = props.value
13
+ return (0, jsx_runtime_1.jsx)('div', {
14
+ ref: container,
15
+ className: prefix,
16
+ children: (0, jsx_runtime_1.jsx)(antd_1.Input, {
17
+ value: props.value,
18
+ onChange: (e) => {
19
+ props.onChange?.(e.target.value)
20
+ },
21
+ placeholder: 'Color',
22
+ prefix: (0, jsx_runtime_1.jsx)(antd_1.ColorPicker, {
23
+ value: color,
24
+ autoAdjustOverflow: true,
25
+ getPopupContainer: () => container.current || document.body,
26
+ onChange: (nextColor) => {
27
+ const { r, g, b, a } = nextColor.toRgb()
28
+ props.onChange?.(`rgba(${r},${g},${b},${a})`)
29
+ },
30
+ children: (0, jsx_runtime_1.jsx)('div', {
31
+ className: prefix + '-color-tips',
32
+ style: {
33
+ backgroundColor: color,
34
+ },
35
+ }),
36
+ }),
37
+ }),
38
+ })
39
+ }
40
+ exports.ColorInput = ColorInput
@@ -2,11 +2,6 @@
2
2
  .dn-color-input {
3
3
  width: 100%;
4
4
 
5
- .@{ant-prefix}-popover-inner-content {
6
- padding: 0 !important;
7
- user-select: none;
8
- }
9
-
10
5
  &-color-tips {
11
6
  width: 20px;
12
7
  height: 20px;
@@ -1,9 +1,9 @@
1
- import React from 'react';
2
- import './styles.less';
1
+ import React from 'react'
2
+ import './styles.less'
3
3
  export interface ICornerInputProps {
4
- className?: string;
5
- style?: React.CSSProperties;
6
- value?: string;
7
- onChange?: (value: string) => void;
4
+ className?: string
5
+ style?: React.CSSProperties
6
+ value?: string
7
+ onChange?: (value: string) => void
8
8
  }
9
- export declare const CornerInput: React.FC<ICornerInputProps>;
9
+ export declare const CornerInput: React.FC<ICornerInputProps>
@@ -1,29 +1,71 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CornerInput = void 0;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
- const react_1 = require("react");
9
- const designable_react_1 = require("@thienvu18/designable-react");
10
- const classnames_1 = __importDefault(require("classnames"));
11
- require("./styles.less");
1
+ 'use strict'
2
+ var __importDefault =
3
+ (this && this.__importDefault) ||
4
+ function (mod) {
5
+ return mod && mod.__esModule ? mod : { default: mod }
6
+ }
7
+ Object.defineProperty(exports, '__esModule', { value: true })
8
+ exports.CornerInput = void 0
9
+ const jsx_runtime_1 = require('react/jsx-runtime')
10
+ const react_1 = require('react')
11
+ const designable_react_1 = require('@thienvu18/designable-react')
12
+ const classnames_1 = __importDefault(require('classnames'))
13
+ require('./styles.less')
12
14
  const CornerInput = (props) => {
13
- const prefix = (0, designable_react_1.usePrefix)('corner-input');
14
- const [current, setCurrent] = (0, react_1.useState)(props.value);
15
- (0, react_1.useEffect)(() => {
16
- if (!props.value) {
17
- setCurrent('all');
18
- }
19
- }, [props.value]);
20
- const createCellProps = (type) => ({
21
- className: (0, classnames_1.default)(prefix + '-cell', { active: current === type }),
22
- onClick() {
23
- setCurrent(type);
24
- props.onChange?.(type);
25
- },
26
- });
27
- return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(prefix, props.className), style: props.style, children: [(0, jsx_runtime_1.jsxs)("div", { className: prefix + '-column', children: [(0, jsx_runtime_1.jsx)("div", { ...createCellProps('topLeft'), children: "\u250F" }), (0, jsx_runtime_1.jsx)("div", { ...createCellProps('bottomLeft'), children: "\u2517" })] }), (0, jsx_runtime_1.jsx)("div", { className: prefix + '-column', children: (0, jsx_runtime_1.jsx)("div", { ...createCellProps('all'), children: "\u254B" }) }), (0, jsx_runtime_1.jsxs)("div", { className: prefix + '-column', children: [(0, jsx_runtime_1.jsx)("div", { ...createCellProps('topRight'), children: "\u2513" }), (0, jsx_runtime_1.jsx)("div", { ...createCellProps('bottomRight'), children: "\u251B" })] })] }));
28
- };
29
- exports.CornerInput = CornerInput;
15
+ const prefix = (0, designable_react_1.usePrefix)('corner-input')
16
+ const [current, setCurrent] = (0, react_1.useState)(props.value)
17
+ ;(0, react_1.useEffect)(() => {
18
+ if (!props.value) {
19
+ setCurrent('all')
20
+ }
21
+ }, [props.value])
22
+ const createCellProps = (type) => ({
23
+ className: (0, classnames_1.default)(prefix + '-cell', {
24
+ active: current === type,
25
+ }),
26
+ onClick() {
27
+ setCurrent(type)
28
+ props.onChange?.(type)
29
+ },
30
+ })
31
+ return (0, jsx_runtime_1.jsxs)('div', {
32
+ className: (0, classnames_1.default)(prefix, props.className),
33
+ style: props.style,
34
+ children: [
35
+ (0, jsx_runtime_1.jsxs)('div', {
36
+ className: prefix + '-column',
37
+ children: [
38
+ (0, jsx_runtime_1.jsx)('div', {
39
+ ...createCellProps('topLeft'),
40
+ children: '\u250F',
41
+ }),
42
+ (0, jsx_runtime_1.jsx)('div', {
43
+ ...createCellProps('bottomLeft'),
44
+ children: '\u2517',
45
+ }),
46
+ ],
47
+ }),
48
+ (0, jsx_runtime_1.jsx)('div', {
49
+ className: prefix + '-column',
50
+ children: (0, jsx_runtime_1.jsx)('div', {
51
+ ...createCellProps('all'),
52
+ children: '\u254B',
53
+ }),
54
+ }),
55
+ (0, jsx_runtime_1.jsxs)('div', {
56
+ className: prefix + '-column',
57
+ children: [
58
+ (0, jsx_runtime_1.jsx)('div', {
59
+ ...createCellProps('topRight'),
60
+ children: '\u2513',
61
+ }),
62
+ (0, jsx_runtime_1.jsx)('div', {
63
+ ...createCellProps('bottomRight'),
64
+ children: '\u251B',
65
+ }),
66
+ ],
67
+ }),
68
+ ],
69
+ })
70
+ }
71
+ exports.CornerInput = CornerInput
@@ -1,9 +1,9 @@
1
- import React from 'react';
2
- import './styles.less';
1
+ import React from 'react'
2
+ import './styles.less'
3
3
  export interface IDisplayStyleSetterProps {
4
- className?: string;
5
- style?: React.CSSProperties;
6
- value?: string;
7
- onChange?: (value: string) => void;
4
+ className?: string
5
+ style?: React.CSSProperties
6
+ value?: string
7
+ onChange?: (value: string) => void
8
8
  }
9
- export declare const DisplayStyleSetter: React.FC<IDisplayStyleSetterProps>;
9
+ export declare const DisplayStyleSetter: React.FC<IDisplayStyleSetterProps>
@@ -1,40 +1,76 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DisplayStyleSetter = void 0;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
- const react_1 = require("@formily/react");
9
- const formily_antd_v6_1 = require("@thienvu18/formily-antd-v6");
10
- const antd_1 = require("antd");
11
- const designable_react_1 = require("@thienvu18/designable-react");
12
- const FlexStyleSetter_1 = require("../FlexStyleSetter");
13
- const classnames_1 = __importDefault(require("classnames"));
14
- require("./styles.less");
1
+ 'use strict'
2
+ var __importDefault =
3
+ (this && this.__importDefault) ||
4
+ function (mod) {
5
+ return mod && mod.__esModule ? mod : { default: mod }
6
+ }
7
+ Object.defineProperty(exports, '__esModule', { value: true })
8
+ exports.DisplayStyleSetter = void 0
9
+ const jsx_runtime_1 = require('react/jsx-runtime')
10
+ const react_1 = require('@formily/react')
11
+ const formily_antd_v6_1 = require('@thienvu18/formily-antd-v6')
12
+ const antd_1 = require('antd')
13
+ const designable_react_1 = require('@thienvu18/designable-react')
14
+ const FlexStyleSetter_1 = require('../FlexStyleSetter')
15
+ const classnames_1 = __importDefault(require('classnames'))
16
+ require('./styles.less')
15
17
  exports.DisplayStyleSetter = (0, react_1.observer)((props) => {
16
- const field = (0, react_1.useField)();
17
- const prefix = (0, designable_react_1.usePrefix)('display-style-setter');
18
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(formily_antd_v6_1.FormItem.BaseItem, { label: field.title, className: (0, classnames_1.default)(prefix, props.className), style: props.style, children: (0, jsx_runtime_1.jsx)(antd_1.Radio.Group, { className: prefix + '-radio', options: [
19
- {
20
- label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, { infer: "DisplayBlock", size: 16 }),
21
- value: 'block',
22
- },
23
- {
24
- label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, { infer: "DisplayInlineBlock", size: 16 }),
25
- value: 'inline-block',
26
- },
27
- {
28
- label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, { infer: "DisplayInline", size: 16 }),
29
- value: 'inline',
30
- },
31
- {
32
- label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, { infer: "DisplayFlex", size: 16 }),
33
- value: 'flex',
34
- },
35
- ], value: props.value, onChange: (e) => {
36
- props.onChange?.(e.target.value);
37
- }, optionType: "button" }) }), (0, jsx_runtime_1.jsx)(react_1.Field, { name: "flex", basePath: field.address.parent(), visible: false, reactions: (flexField) => {
38
- flexField.visible = field.value === 'flex';
39
- }, component: [FlexStyleSetter_1.FlexStyleSetter] })] }));
40
- });
18
+ const field = (0, react_1.useField)()
19
+ const prefix = (0, designable_react_1.usePrefix)('display-style-setter')
20
+ return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, {
21
+ children: [
22
+ (0, jsx_runtime_1.jsx)(formily_antd_v6_1.FormItem.BaseItem, {
23
+ label: field.title,
24
+ className: (0, classnames_1.default)(prefix, props.className),
25
+ style: props.style,
26
+ children: (0, jsx_runtime_1.jsx)(antd_1.Radio.Group, {
27
+ className: prefix + '-radio',
28
+ options: [
29
+ {
30
+ label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
31
+ infer: 'DisplayBlock',
32
+ size: 16,
33
+ }),
34
+ value: 'block',
35
+ },
36
+ {
37
+ label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
38
+ infer: 'DisplayInlineBlock',
39
+ size: 16,
40
+ }),
41
+ value: 'inline-block',
42
+ },
43
+ {
44
+ label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
45
+ infer: 'DisplayInline',
46
+ size: 16,
47
+ }),
48
+ value: 'inline',
49
+ },
50
+ {
51
+ label: (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
52
+ infer: 'DisplayFlex',
53
+ size: 16,
54
+ }),
55
+ value: 'flex',
56
+ },
57
+ ],
58
+ value: props.value,
59
+ onChange: (e) => {
60
+ props.onChange?.(e.target.value)
61
+ },
62
+ optionType: 'button',
63
+ }),
64
+ }),
65
+ (0, jsx_runtime_1.jsx)(react_1.Field, {
66
+ name: 'flex',
67
+ basePath: field.address.parent(),
68
+ visible: false,
69
+ reactions: (flexField) => {
70
+ flexField.visible = field.value === 'flex'
71
+ },
72
+ component: [FlexStyleSetter_1.FlexStyleSetter],
73
+ }),
74
+ ],
75
+ })
76
+ })
@@ -1,8 +1,8 @@
1
- import React from 'react';
2
- import { ButtonProps } from 'antd';
3
- import './styles.less';
1
+ import { ButtonProps } from 'antd'
2
+ import React from 'react'
3
+ import './styles.less'
4
4
  export interface IDrawerSetterProps {
5
- text: React.ReactNode;
6
- triggerProps: ButtonProps;
5
+ text: React.ReactNode
6
+ triggerProps: ButtonProps
7
7
  }
8
- export declare const DrawerSetter: React.FC<IDrawerSetterProps>;
8
+ export declare const DrawerSetter: React.FC<IDrawerSetterProps>
@@ -1,49 +1,100 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DrawerSetter = void 0;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
- const react_1 = require("react");
9
- const react_dom_1 = require("react-dom");
10
- const react_2 = require("@formily/react");
11
- const formily_antd_v6_1 = require("@thienvu18/formily-antd-v6");
12
- const designable_react_1 = require("@thienvu18/designable-react");
13
- const antd_1 = require("antd");
14
- const classnames_1 = __importDefault(require("classnames"));
15
- require("./styles.less");
1
+ 'use strict'
2
+ var __importDefault =
3
+ (this && this.__importDefault) ||
4
+ function (mod) {
5
+ return mod && mod.__esModule ? mod : { default: mod }
6
+ }
7
+ Object.defineProperty(exports, '__esModule', { value: true })
8
+ exports.DrawerSetter = void 0
9
+ const jsx_runtime_1 = require('react/jsx-runtime')
10
+ const react_1 = require('react')
11
+ const react_dom_1 = require('react-dom')
12
+ const react_2 = require('@formily/react')
13
+ const formily_antd_v6_1 = require('@thienvu18/formily-antd-v6')
14
+ const designable_react_1 = require('@thienvu18/designable-react')
15
+ const antd_1 = require('antd')
16
+ const classnames_1 = __importDefault(require('classnames'))
17
+ require('./styles.less')
16
18
  exports.DrawerSetter = (0, react_2.observer)((props) => {
17
- const node = (0, designable_react_1.useTreeNode)();
18
- const field = (0, react_2.useField)();
19
- const [visible, setVisible] = (0, react_1.useState)(false);
20
- const [remove, setRemove] = (0, react_1.useState)(false);
21
- const [root, setRoot] = (0, react_1.useState)();
22
- const prefix = (0, designable_react_1.usePrefix)('drawer-setter');
23
- const formWrapperCls = (0, designable_react_1.usePrefix)('settings-form-wrapper');
24
- (0, react_1.useLayoutEffect)(() => {
25
- const wrapper = document.querySelector('.' + formWrapperCls);
26
- if (wrapper) {
27
- setRoot(wrapper);
28
- }
29
- }, [node]);
30
- const renderDrawer = () => {
31
- if (root && visible) {
32
- return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(prefix, 'animate__animated animate__slideInRight', {
33
- animate__slideOutRight: remove,
34
- }), children: [(0, jsx_runtime_1.jsxs)("div", { className: prefix + '-header', onClick: handleClose, children: [(0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, { infer: "Return", size: 18 }), (0, jsx_runtime_1.jsx)("span", { className: prefix + '-header-text', children: props.text || field.title })] }), (0, jsx_runtime_1.jsx)("div", { className: prefix + '-body', children: (0, jsx_runtime_1.jsx)(formily_antd_v6_1.FormLayout, { colon: false, labelWidth: 120, labelAlign: "left", wrapperAlign: "right", feedbackLayout: "none", tooltipLayout: "text", children: props.children }) })] }), root);
35
- }
36
- return null;
37
- };
38
- const handleOpen = () => {
39
- setVisible(true);
40
- };
41
- const handleClose = () => {
42
- setRemove(true);
43
- setTimeout(() => {
44
- setVisible(false);
45
- setRemove(false);
46
- }, 150);
47
- };
48
- return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, { block: true, onClick: handleOpen, ...props.triggerProps, children: props.text || field.title }), renderDrawer()] }));
49
- });
19
+ const node = (0, designable_react_1.useTreeNode)()
20
+ const field = (0, react_2.useField)()
21
+ const [visible, setVisible] = (0, react_1.useState)(false)
22
+ const [remove, setRemove] = (0, react_1.useState)(false)
23
+ const [root, setRoot] = (0, react_1.useState)()
24
+ const prefix = (0, designable_react_1.usePrefix)('drawer-setter')
25
+ const formWrapperCls = (0, designable_react_1.usePrefix)(
26
+ 'settings-form-wrapper'
27
+ )
28
+ ;(0, react_1.useLayoutEffect)(() => {
29
+ const wrapper = document.querySelector('.' + formWrapperCls)
30
+ if (wrapper) {
31
+ setRoot(wrapper)
32
+ }
33
+ }, [node])
34
+ const renderDrawer = () => {
35
+ if (root && visible) {
36
+ return (0, react_dom_1.createPortal)(
37
+ (0, jsx_runtime_1.jsxs)('div', {
38
+ className: (0, classnames_1.default)(
39
+ prefix,
40
+ 'animate__animated animate__slideInRight',
41
+ {
42
+ animate__slideOutRight: remove,
43
+ }
44
+ ),
45
+ children: [
46
+ (0, jsx_runtime_1.jsxs)('div', {
47
+ className: prefix + '-header',
48
+ onClick: handleClose,
49
+ children: [
50
+ (0, jsx_runtime_1.jsx)(designable_react_1.IconWidget, {
51
+ infer: 'Return',
52
+ size: 18,
53
+ }),
54
+ (0, jsx_runtime_1.jsx)('span', {
55
+ className: prefix + '-header-text',
56
+ children: props.text || field.title,
57
+ }),
58
+ ],
59
+ }),
60
+ (0, jsx_runtime_1.jsx)('div', {
61
+ className: prefix + '-body',
62
+ children: (0, jsx_runtime_1.jsx)(formily_antd_v6_1.FormLayout, {
63
+ colon: false,
64
+ labelWidth: 120,
65
+ labelAlign: 'left',
66
+ wrapperAlign: 'right',
67
+ feedbackLayout: 'none',
68
+ tooltipLayout: 'text',
69
+ children: props.children,
70
+ }),
71
+ }),
72
+ ],
73
+ }),
74
+ root
75
+ )
76
+ }
77
+ return null
78
+ }
79
+ const handleOpen = () => {
80
+ setVisible(true)
81
+ }
82
+ const handleClose = () => {
83
+ setRemove(true)
84
+ setTimeout(() => {
85
+ setVisible(false)
86
+ setRemove(false)
87
+ }, 150)
88
+ }
89
+ return (0, jsx_runtime_1.jsxs)(react_1.Fragment, {
90
+ children: [
91
+ (0, jsx_runtime_1.jsx)(antd_1.Button, {
92
+ block: true,
93
+ onClick: handleOpen,
94
+ ...props.triggerProps,
95
+ children: props.text || field.title,
96
+ }),
97
+ renderDrawer(),
98
+ ],
99
+ })
100
+ })
@@ -1,4 +1,3 @@
1
-
2
1
  .dn-drawer-setter {
3
2
  position: absolute;
4
3
  top: 0;
@@ -17,7 +16,8 @@
17
16
  flex-grow: 0;
18
17
  padding: 5px 10px;
19
18
  color: var(--dn-color-text, rgba(0, 0, 0, 0.88));
20
- border-bottom: 1px solid var(--dn-color-border-secondary, rgba(5, 5, 5, 0.06));
19
+ border-bottom: 1px solid
20
+ var(--dn-color-border-secondary, rgba(5, 5, 5, 0.06));
21
21
  cursor: pointer;
22
22
  }
23
23
 
@@ -1,7 +1,7 @@
1
- import React from 'react';
2
- import './styles.less';
1
+ import React from 'react'
2
+ import './styles.less'
3
3
  export interface IFlexStyleSetterProps {
4
- className?: string;
5
- style?: React.CSSProperties;
4
+ className?: string
5
+ style?: React.CSSProperties
6
6
  }
7
- export declare const FlexStyleSetter: React.FC<IFlexStyleSetterProps>;
7
+ export declare const FlexStyleSetter: React.FC<IFlexStyleSetterProps>