@lowdefy/blocks-antd 4.3.0 → 4.3.1

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.
@@ -12,7 +12,7 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ import React from 'react';
15
+ */ import React, { useState } from 'react';
16
16
  import { DatePicker } from 'antd';
17
17
  import moment from 'moment';
18
18
  import { blockDefaultProps } from '@lowdefy/block-utils';
@@ -26,6 +26,7 @@ const rangeValue = (value, format)=>{
26
26
  return null;
27
27
  };
28
28
  const DateRangeSelector = ({ blockId, components: { Icon }, events, loading, methods, properties, required, validation, value })=>{
29
+ const [elementId] = useState((0 | Math.random() * 9e2) + 1e2);
29
30
  return /*#__PURE__*/ React.createElement(Label, {
30
31
  blockId: blockId,
31
32
  components: {
@@ -45,7 +46,7 @@ const DateRangeSelector = ({ blockId, components: { Icon }, events, loading, met
45
46
  width: '100%'
46
47
  })
47
48
  }, /*#__PURE__*/ React.createElement("div", {
48
- id: `${blockId}_popup`
49
+ id: `${blockId}_${elementId}_popup`
49
50
  }), /*#__PURE__*/ React.createElement(RangePicker, {
50
51
  id: `${blockId}_input`,
51
52
  allowClear: properties.allowClear !== false,
@@ -60,7 +61,7 @@ const DateRangeSelector = ({ blockId, components: { Icon }, events, loading, met
60
61
  disabled: properties.disabled || loading,
61
62
  disabledDate: disabledDate(properties.disabledDates),
62
63
  format: properties.format ?? 'YYYY-MM-DD',
63
- getPopupContainer: ()=>document.getElementById(`${blockId}_popup`),
64
+ getPopupContainer: ()=>document.getElementById(`${blockId}_${elementId}_popup`),
64
65
  separator: properties.separator ?? '~',
65
66
  size: properties.size,
66
67
  status: validation.status,
@@ -12,7 +12,7 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ import React from 'react';
15
+ */ import React, { useState } from 'react';
16
16
  import moment from 'moment';
17
17
  import { type } from '@lowdefy/helpers';
18
18
  import { blockDefaultProps } from '@lowdefy/block-utils';
@@ -20,6 +20,7 @@ import { DatePicker } from 'antd';
20
20
  import Label from '../Label/Label.js';
21
21
  import disabledDate from '../../disabledDate.js';
22
22
  const DateSelector = ({ blockId, components: { Icon }, events, loading, methods, properties, required, validation, value })=>{
23
+ const [elementId] = useState((0 | Math.random() * 9e2) + 1e2);
23
24
  return /*#__PURE__*/ React.createElement(Label, {
24
25
  blockId: blockId,
25
26
  components: {
@@ -39,7 +40,7 @@ const DateSelector = ({ blockId, components: { Icon }, events, loading, methods,
39
40
  width: '100%'
40
41
  })
41
42
  }, /*#__PURE__*/ React.createElement("div", {
42
- id: `${blockId}_popup`
43
+ id: `${blockId}_${elementId}_popup`
43
44
  }), /*#__PURE__*/ React.createElement(DatePicker, {
44
45
  id: `${blockId}_input`,
45
46
  allowClear: properties.allowClear !== false,
@@ -53,7 +54,7 @@ const DateSelector = ({ blockId, components: { Icon }, events, loading, methods,
53
54
  ]),
54
55
  disabled: properties.disabled || loading,
55
56
  format: properties.format ?? 'YYYY-MM-DD',
56
- getPopupContainer: ()=>document.getElementById(`${blockId}_popup`),
57
+ getPopupContainer: ()=>document.getElementById(`${blockId}_${elementId}_popup`),
57
58
  placeholder: properties.placeholder ?? 'Select Date',
58
59
  showToday: properties.showToday,
59
60
  size: properties.size,
@@ -12,7 +12,7 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ import React from 'react';
15
+ */ import React, { useState } from 'react';
16
16
  import { DatePicker } from 'antd';
17
17
  import moment from 'moment';
18
18
  import { type } from '@lowdefy/helpers';
@@ -20,6 +20,7 @@ import { blockDefaultProps } from '@lowdefy/block-utils';
20
20
  import Label from '../Label/Label.js';
21
21
  import disabledDate from '../../disabledDate.js';
22
22
  const DateTimeSelector = ({ blockId, components: { Icon }, events, loading, methods, properties, required, validation, value })=>{
23
+ const [elementId] = useState((0 | Math.random() * 9e2) + 1e2);
23
24
  const timeUnit = !type.isString(properties.timeFormat) ? 'minute' : properties.timeFormat === 'HH:mm:ss' ? 'second' : properties.timeFormat === 'HH' ? 'hour' : 'minute';
24
25
  const onChange = (newVal)=>{
25
26
  methods.setValue(!newVal ? null : moment.utc(newVal.add(properties.selectUTC ? newVal.utcOffset() : 0, 'minutes')).startOf(timeUnit).toDate());
@@ -46,7 +47,7 @@ const DateTimeSelector = ({ blockId, components: { Icon }, events, loading, meth
46
47
  width: '100%'
47
48
  })
48
49
  }, /*#__PURE__*/ React.createElement("div", {
49
- id: `${blockId}_popup`
50
+ id: `${blockId}_${elementId}_popup`
50
51
  }), /*#__PURE__*/ React.createElement(DatePicker, {
51
52
  id: `${blockId}_input`,
52
53
  allowClear: properties.allowClear !== false,
@@ -61,7 +62,7 @@ const DateTimeSelector = ({ blockId, components: { Icon }, events, loading, meth
61
62
  disabled: properties.disabled || loading,
62
63
  disabledDate: disabledDate(properties.disabledDates),
63
64
  format: properties.format ?? 'YYYY-MM-DD HH:mm',
64
- getPopupContainer: ()=>document.getElementById(`${blockId}_popup`),
65
+ getPopupContainer: ()=>document.getElementById(`${blockId}_${elementId}_popup`),
65
66
  placeholder: properties.placeholder ?? 'Select Date & Time',
66
67
  showNow: properties.showNow,
67
68
  showToday: properties.showToday,
@@ -12,7 +12,7 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ import React from 'react';
15
+ */ import React, { useState } from 'react';
16
16
  import { DatePicker } from 'antd';
17
17
  import moment from 'moment';
18
18
  import { blockDefaultProps } from '@lowdefy/block-utils';
@@ -21,6 +21,7 @@ import Label from '../Label/Label.js';
21
21
  import disabledDate from '../../disabledDate.js';
22
22
  const MonthPicker = DatePicker.MonthPicker;
23
23
  const MonthSelector = ({ blockId, components: { Icon }, events, loading, methods, properties, required, validation, value })=>{
24
+ const [elementId] = useState((0 | Math.random() * 9e2) + 1e2);
24
25
  return /*#__PURE__*/ React.createElement(Label, {
25
26
  blockId: blockId,
26
27
  components: {
@@ -40,7 +41,7 @@ const MonthSelector = ({ blockId, components: { Icon }, events, loading, methods
40
41
  width: '100%'
41
42
  })
42
43
  }, /*#__PURE__*/ React.createElement("div", {
43
- id: `${blockId}_popup`
44
+ id: `${blockId}_${elementId}_popup`
44
45
  }), /*#__PURE__*/ React.createElement(MonthPicker, {
45
46
  id: `${blockId}_input`,
46
47
  allowClear: properties.allowClear !== false,
@@ -55,7 +56,7 @@ const MonthSelector = ({ blockId, components: { Icon }, events, loading, methods
55
56
  disabled: properties.disabled || loading,
56
57
  disabledDate: disabledDate(properties.disabledDates),
57
58
  format: properties.format ?? 'YYYY-MM',
58
- getPopupContainer: ()=>document.getElementById(`${blockId}_popup`),
59
+ getPopupContainer: ()=>document.getElementById(`${blockId}_${elementId}_popup`),
59
60
  placeholder: properties.placeholder ?? 'Select Month',
60
61
  size: properties.size,
61
62
  status: validation.status,
@@ -40,6 +40,7 @@ const tagRender = (props, option, methods, components)=>{
40
40
  };
41
41
  const MultipleSelector = ({ blockId, components: { Icon }, events, loading, methods, properties, required, validation, value })=>{
42
42
  const [fetchState, setFetch] = useState(false);
43
+ const [elementId] = useState((0 | Math.random() * 9e2) + 1e2);
43
44
  const uniqueValueOptions = getUniqueValues(properties.options ?? []);
44
45
  return /*#__PURE__*/ React.createElement(Label, {
45
46
  blockId: blockId,
@@ -72,7 +73,7 @@ const MultipleSelector = ({ blockId, components: { Icon }, events, loading, meth
72
73
  properties.inputStyle
73
74
  ]),
74
75
  disabled: properties.disabled || loading,
75
- getPopupContainer: ()=>document.getElementById(`${blockId}_popup`),
76
+ getPopupContainer: ()=>document.getElementById(`${blockId}_${elementId}_popup`),
76
77
  mode: "multiple",
77
78
  tagRender: properties.renderTags && ((props)=>tagRender(props, uniqueValueOptions[props.value], methods, {
78
79
  Icon
@@ -12,10 +12,11 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ import React from 'react';
15
+ */ import React, { useState } from 'react';
16
16
  import { blockDefaultProps } from '@lowdefy/block-utils';
17
17
  import { Popover } from 'antd';
18
18
  const PopoverBlock = ({ blockId, content, methods, properties })=>{
19
+ const [elementId] = useState((0 | Math.random() * 9e2) + 1e2);
19
20
  return /*#__PURE__*/ React.createElement(Popover, {
20
21
  id: blockId,
21
22
  ...properties,
@@ -23,9 +24,9 @@ const PopoverBlock = ({ blockId, content, methods, properties })=>{
23
24
  onOpenChange: ()=>methods.triggerEvent({
24
25
  name: 'onOpenChange'
25
26
  }),
26
- getPopupContainer: ()=>document.getElementById(`${blockId}_popup`)
27
+ getPopupContainer: ()=>document.getElementById(`${blockId}_${elementId}_popup`)
27
28
  }, content.content && content.content(), /*#__PURE__*/ React.createElement("div", {
28
- id: `${blockId}_popup`
29
+ id: `${blockId}_${elementId}_popup`
29
30
  }));
30
31
  };
31
32
  PopoverBlock.defaultProps = blockDefaultProps;
@@ -22,6 +22,7 @@ import getUniqueValues from '../../getUniqueValues.js';
22
22
  const Option = Select.Option;
23
23
  const Selector = ({ blockId, components: { Icon, Link }, events, loading, methods, properties, required, validation, value })=>{
24
24
  const [fetchState, setFetch] = useState(false);
25
+ const [elementId] = useState((0 | Math.random() * 9e2) + 1e2);
25
26
  const uniqueValueOptions = getUniqueValues(properties.options || []);
26
27
  return /*#__PURE__*/ React.createElement(Label, {
27
28
  blockId: blockId,
@@ -43,7 +44,7 @@ const Selector = ({ blockId, components: { Icon, Link }, events, loading, method
43
44
  width: '100%'
44
45
  })
45
46
  }, /*#__PURE__*/ React.createElement("div", {
46
- id: `${blockId}_popup`
47
+ id: `${blockId}_${elementId}_popup`
47
48
  }), /*#__PURE__*/ React.createElement(Select, {
48
49
  id: `${blockId}_input`,
49
50
  bordered: properties.bordered,
@@ -55,7 +56,7 @@ const Selector = ({ blockId, components: { Icon, Link }, events, loading, method
55
56
  ]),
56
57
  mode: "single",
57
58
  autoFocus: properties.autoFocus,
58
- getPopupContainer: ()=>document.getElementById(`${blockId}_popup`),
59
+ getPopupContainer: ()=>document.getElementById(`${blockId}_${elementId}_popup`),
59
60
  disabled: properties.disabled || loading,
60
61
  placeholder: get(properties, 'placeholder', {
61
62
  default: 'Select item'
@@ -12,7 +12,7 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ import React from 'react';
15
+ */ import React, { useState } from 'react';
16
16
  import { blockDefaultProps } from '@lowdefy/block-utils';
17
17
  import { DatePicker } from 'antd';
18
18
  import { type } from '@lowdefy/helpers';
@@ -21,6 +21,7 @@ import disabledDate from '../../disabledDate.js';
21
21
  import Label from '../Label/Label.js';
22
22
  const WeekPicker = DatePicker.WeekPicker;
23
23
  const WeekSelector = ({ blockId, components: { Icon, Link }, events, loading, methods, properties, required, validation, value })=>{
24
+ const [elementId] = useState((0 | Math.random() * 9e2) + 1e2);
24
25
  return /*#__PURE__*/ React.createElement(Label, {
25
26
  blockId: blockId,
26
27
  components: {
@@ -41,7 +42,7 @@ const WeekSelector = ({ blockId, components: { Icon, Link }, events, loading, me
41
42
  width: '100%'
42
43
  })
43
44
  }, /*#__PURE__*/ React.createElement("div", {
44
- id: `${blockId}_popup`
45
+ id: `${blockId}_${elementId}_popup`
45
46
  }), /*#__PURE__*/ React.createElement(WeekPicker, {
46
47
  id: `${blockId}_input`,
47
48
  allowClear: properties.allowClear !== false,
@@ -56,7 +57,7 @@ const WeekSelector = ({ blockId, components: { Icon, Link }, events, loading, me
56
57
  disabled: properties.disabled || loading,
57
58
  disabledDate: disabledDate(properties.disabledDates),
58
59
  format: properties.format ?? 'YYYY-wo',
59
- getPopupContainer: ()=>document.getElementById(`${blockId}_popup`),
60
+ getPopupContainer: ()=>document.getElementById(`${blockId}_${elementId}_popup`),
60
61
  placeholder: properties.placeholder ?? 'Select Week',
61
62
  size: properties.size,
62
63
  status: validation.status,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/blocks-antd",
3
- "version": "4.3.0",
3
+ "version": "4.3.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Lowdefy Ant Design Blocks",
6
6
  "homepage": "https://lowdefy.com",
@@ -43,8 +43,8 @@
43
43
  ],
44
44
  "dependencies": {
45
45
  "@ant-design/icons": "4.8.0",
46
- "@lowdefy/block-utils": "4.3.0",
47
- "@lowdefy/helpers": "4.3.0",
46
+ "@lowdefy/block-utils": "4.3.1",
47
+ "@lowdefy/helpers": "4.3.1",
48
48
  "antd": "4.24.14",
49
49
  "classnames": "2.3.2",
50
50
  "moment": "2.29.4",
@@ -55,9 +55,9 @@
55
55
  },
56
56
  "devDependencies": {
57
57
  "@emotion/jest": "11.10.5",
58
- "@lowdefy/block-dev": "4.3.0",
59
- "@lowdefy/jest-yaml-transform": "4.3.0",
60
- "@lowdefy/node-utils": "4.3.0",
58
+ "@lowdefy/block-dev": "4.3.1",
59
+ "@lowdefy/jest-yaml-transform": "4.3.1",
60
+ "@lowdefy/node-utils": "4.3.1",
61
61
  "@swc/cli": "0.1.63",
62
62
  "@swc/core": "1.3.99",
63
63
  "@swc/jest": "0.2.29",