ls-pro-common 3.0.37 → 3.0.38

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.
@@ -0,0 +1,15 @@
1
+ import { CSSProperties } from 'react';
2
+ declare const TagCheck: (props: {
3
+ value?: string | number | string[] | number[] | undefined;
4
+ onChange?: ((checkedValues: any, currentItem: any, checked: boolean) => void) | undefined;
5
+ className?: string | undefined;
6
+ tagClassName?: string | undefined;
7
+ style?: CSSProperties | undefined;
8
+ tagStyle?: CSSProperties | undefined;
9
+ options: {
10
+ value: number | string;
11
+ label: string;
12
+ }[];
13
+ multiple?: boolean | undefined;
14
+ }) => JSX.Element;
15
+ export default TagCheck;
@@ -0,0 +1,61 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import "antd/es/tag/style";
3
+ import _Tag from "antd/es/tag";
4
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
+ import React from "react";
6
+ import { useState, useEffect } from 'react';
7
+ import classNames from 'classnames';
8
+ var TagCheck = function TagCheck(props) {
9
+ var _onChange = props.onChange,
10
+ className = props.className,
11
+ style = props.style,
12
+ tagClassName = props.tagClassName,
13
+ tagStyle = props.tagStyle,
14
+ options = props.options,
15
+ _props$multiple = props.multiple,
16
+ multiple = _props$multiple === void 0 ? true : _props$multiple;
17
+ var _useState = useState(props.value === undefined ? [] : Array.isArray(props.value) ? props.value : [props.value]),
18
+ _useState2 = _slicedToArray(_useState, 2),
19
+ innerValue = _useState2[0],
20
+ setInnerValue = _useState2[1];
21
+ useEffect(function () {
22
+ if (!('value' in props)) return;
23
+ setInnerValue(props.value === undefined ? [] : Array.isArray(props.value) ? props.value : [props.value]);
24
+ console.log('value', props.value);
25
+ }, [props.value]);
26
+ return /*#__PURE__*/React.createElement("div", {
27
+ style: style,
28
+ className: classNames('tag-check', className)
29
+ }, multiple && options.length > 0 && /*#__PURE__*/React.createElement(_Tag.CheckableTag, {
30
+ checked: innerValue.length === options.length,
31
+ onChange: function onChange(checked) {
32
+ var val = checked ? options.map(function (o) {
33
+ return o.value;
34
+ }) : [];
35
+ setInnerValue(val);
36
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(val.length ? val : undefined, 'all', checked);
37
+ }
38
+ }, "\u5168\u90E8"), options && options.map(function (item) {
39
+ return /*#__PURE__*/React.createElement(_Tag.CheckableTag, {
40
+ className: tagClassName,
41
+ style: tagStyle,
42
+ key: item.value,
43
+ checked: innerValue.filter(function (o) {
44
+ return item.value == o;
45
+ }).length > 0,
46
+ onChange: function onChange(checked) {
47
+ var val = [];
48
+ if (checked) {
49
+ val = multiple ? [].concat(_toConsumableArray(innerValue), [item.value]) : [item.value];
50
+ } else {
51
+ val = innerValue.filter(function (o) {
52
+ return o != item.value;
53
+ });
54
+ }
55
+ setInnerValue(val);
56
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(val.length ? multiple ? val : val[0] : undefined, item, checked);
57
+ }
58
+ }, item.label);
59
+ }));
60
+ };
61
+ export default TagCheck;
@@ -371,6 +371,39 @@ a:hover {
371
371
  }
372
372
  }
373
373
 
374
+ .tag-check {
375
+ display: flex;
376
+ flex-wrap: wrap;
377
+ gap: 5px;
378
+
379
+ .ant-tag-checkable {
380
+ background-color: #efefef;
381
+ border-color: #efefef;
382
+ margin-right: 0px;
383
+ position: relative;
384
+ }
385
+
386
+ .ant-tag-checkable-checked {
387
+ border-color: var(--ant-primary-color);
388
+ color: var(--ant-primary-color);
389
+ background-color: var(--ant-primary-1);
390
+
391
+ &::after {
392
+ content: '';
393
+ position: absolute;
394
+ width: 0;
395
+ height: 0;
396
+ right: 0;
397
+ bottom: 0;
398
+ border-width: 4px;
399
+ border-style: solid;
400
+ border-color: transparent;
401
+ border-right-color: var(--ant-primary-color);
402
+ border-bottom-color: var(--ant-primary-color);
403
+ }
404
+ }
405
+ }
406
+
374
407
  .ant-pro-table-list-toolbar-title {
375
408
  .ls-group-tip {
376
409
  padding-bottom: 0;
package/es/http/index.js CHANGED
@@ -42,7 +42,7 @@ request.interceptors.request.use(function (url, options) {
42
42
  }
43
43
  url = url.replace('&noToken=1', '').replace('noToken=1', '');
44
44
  var param = {
45
- resCode: getUrlQuery('resCode') || getUrlQuery('resourceId') || getResourceProps('resourceId'),
45
+ resCode: getUrlQuery('resCode', url) || getUrlQuery('resCode') || getUrlQuery('resourceId') || getResourceProps('resourceId'),
46
46
  _t1: Date.now()
47
47
  };
48
48
  if (!param.resCode) {
package/es/index.d.ts CHANGED
@@ -15,6 +15,7 @@ import IconText from './components/IconText';
15
15
  import IconQuestion from './components/IconQuestion';
16
16
  import IconBell from './components/IconBell';
17
17
  import IconSearch from './components/IconSearch';
18
+ import TagCheck from './components/TagCheck';
18
19
  import BaseService from './service/BaseService';
19
20
  import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
20
21
  import * as utils from './utils';
@@ -29,4 +30,4 @@ import type { DtlLyaoutProps } from './components/DtlLayout';
29
30
  import type { DescritionCardProps } from './components/DescritionCard';
30
31
  import type { PermissionProps } from './components/Permission';
31
32
  export type { ApiResponse, TableToolbar, BaseApiType, MethodType, DtlLyaoutProps, DescritionCardProps, PermissionProps };
32
- export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, IconBack, IconText, IconBell, IconQuestion, IconSearch, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState };
33
+ export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, IconBack, IconText, IconBell, IconQuestion, IconSearch, TagCheck, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState };
package/es/index.js CHANGED
@@ -15,6 +15,7 @@ import IconText from './components/IconText';
15
15
  import IconQuestion from './components/IconQuestion';
16
16
  import IconBell from './components/IconBell';
17
17
  import IconSearch from './components/IconSearch';
18
+ import TagCheck from './components/TagCheck';
18
19
  import BaseService from './service/BaseService';
19
20
  import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
20
21
  import * as utils from './utils';
@@ -23,4 +24,4 @@ import useSingle from './hooks/useSingle';
23
24
  import useDtl from './hooks/useDtl';
24
25
  import usePermission from './hooks/usePermission';
25
26
  import useGetState from './hooks/useGetState';
26
- export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, IconBack, IconText, IconBell, IconQuestion, IconSearch, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState };
27
+ export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, IconBack, IconText, IconBell, IconQuestion, IconSearch, TagCheck, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState };
@@ -0,0 +1,15 @@
1
+ import { CSSProperties } from 'react';
2
+ declare const TagCheck: (props: {
3
+ value?: string | number | string[] | number[] | undefined;
4
+ onChange?: ((checkedValues: any, currentItem: any, checked: boolean) => void) | undefined;
5
+ className?: string | undefined;
6
+ tagClassName?: string | undefined;
7
+ style?: CSSProperties | undefined;
8
+ tagStyle?: CSSProperties | undefined;
9
+ options: {
10
+ value: number | string;
11
+ label: string;
12
+ }[];
13
+ multiple?: boolean | undefined;
14
+ }) => JSX.Element;
15
+ export default TagCheck;
@@ -0,0 +1,61 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import "antd/es/tag/style";
3
+ import _Tag from "antd/es/tag";
4
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
+ import React from "react";
6
+ import { useState, useEffect } from 'react';
7
+ import classNames from 'classnames';
8
+ var TagCheck = function TagCheck(props) {
9
+ var _onChange = props.onChange,
10
+ className = props.className,
11
+ style = props.style,
12
+ tagClassName = props.tagClassName,
13
+ tagStyle = props.tagStyle,
14
+ options = props.options,
15
+ _props$multiple = props.multiple,
16
+ multiple = _props$multiple === void 0 ? true : _props$multiple;
17
+ var _useState = useState(props.value === undefined ? [] : Array.isArray(props.value) ? props.value : [props.value]),
18
+ _useState2 = _slicedToArray(_useState, 2),
19
+ innerValue = _useState2[0],
20
+ setInnerValue = _useState2[1];
21
+ useEffect(function () {
22
+ if (!('value' in props)) return;
23
+ setInnerValue(props.value === undefined ? [] : Array.isArray(props.value) ? props.value : [props.value]);
24
+ console.log('value', props.value);
25
+ }, [props.value]);
26
+ return /*#__PURE__*/React.createElement("div", {
27
+ style: style,
28
+ className: classNames('tag-check', className)
29
+ }, multiple && options.length > 0 && /*#__PURE__*/React.createElement(_Tag.CheckableTag, {
30
+ checked: innerValue.length === options.length,
31
+ onChange: function onChange(checked) {
32
+ var val = checked ? options.map(function (o) {
33
+ return o.value;
34
+ }) : [];
35
+ setInnerValue(val);
36
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(val.length ? val : undefined, 'all', checked);
37
+ }
38
+ }, "\u5168\u90E8"), options && options.map(function (item) {
39
+ return /*#__PURE__*/React.createElement(_Tag.CheckableTag, {
40
+ className: tagClassName,
41
+ style: tagStyle,
42
+ key: item.value,
43
+ checked: innerValue.filter(function (o) {
44
+ return item.value == o;
45
+ }).length > 0,
46
+ onChange: function onChange(checked) {
47
+ var val = [];
48
+ if (checked) {
49
+ val = multiple ? [].concat(_toConsumableArray(innerValue), [item.value]) : [item.value];
50
+ } else {
51
+ val = innerValue.filter(function (o) {
52
+ return o != item.value;
53
+ });
54
+ }
55
+ setInnerValue(val);
56
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(val.length ? multiple ? val : val[0] : undefined, item, checked);
57
+ }
58
+ }, item.label);
59
+ }));
60
+ };
61
+ export default TagCheck;
@@ -371,6 +371,39 @@ a:hover {
371
371
  }
372
372
  }
373
373
 
374
+ .tag-check {
375
+ display: flex;
376
+ flex-wrap: wrap;
377
+ gap: 5px;
378
+
379
+ .ant-tag-checkable {
380
+ background-color: #efefef;
381
+ border-color: #efefef;
382
+ margin-right: 0px;
383
+ position: relative;
384
+ }
385
+
386
+ .ant-tag-checkable-checked {
387
+ border-color: var(--ant-primary-color);
388
+ color: var(--ant-primary-color);
389
+ background-color: var(--ant-primary-1);
390
+
391
+ &::after {
392
+ content: '';
393
+ position: absolute;
394
+ width: 0;
395
+ height: 0;
396
+ right: 0;
397
+ bottom: 0;
398
+ border-width: 4px;
399
+ border-style: solid;
400
+ border-color: transparent;
401
+ border-right-color: var(--ant-primary-color);
402
+ border-bottom-color: var(--ant-primary-color);
403
+ }
404
+ }
405
+ }
406
+
374
407
  .ant-pro-table-list-toolbar-title {
375
408
  .ls-group-tip {
376
409
  padding-bottom: 0;
package/lib/http/index.js CHANGED
@@ -42,7 +42,7 @@ request.interceptors.request.use(function (url, options) {
42
42
  }
43
43
  url = url.replace('&noToken=1', '').replace('noToken=1', '');
44
44
  var param = {
45
- resCode: getUrlQuery('resCode') || getUrlQuery('resourceId') || getResourceProps('resourceId'),
45
+ resCode: getUrlQuery('resCode', url) || getUrlQuery('resCode') || getUrlQuery('resourceId') || getResourceProps('resourceId'),
46
46
  _t1: Date.now()
47
47
  };
48
48
  if (!param.resCode) {
package/lib/index.d.ts CHANGED
@@ -15,6 +15,7 @@ import IconText from './components/IconText';
15
15
  import IconQuestion from './components/IconQuestion';
16
16
  import IconBell from './components/IconBell';
17
17
  import IconSearch from './components/IconSearch';
18
+ import TagCheck from './components/TagCheck';
18
19
  import BaseService from './service/BaseService';
19
20
  import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
20
21
  import * as utils from './utils';
@@ -29,4 +30,4 @@ import type { DtlLyaoutProps } from './components/DtlLayout';
29
30
  import type { DescritionCardProps } from './components/DescritionCard';
30
31
  import type { PermissionProps } from './components/Permission';
31
32
  export type { ApiResponse, TableToolbar, BaseApiType, MethodType, DtlLyaoutProps, DescritionCardProps, PermissionProps };
32
- export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, IconBack, IconText, IconBell, IconQuestion, IconSearch, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState };
33
+ export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, IconBack, IconText, IconBell, IconQuestion, IconSearch, TagCheck, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState };
package/lib/index.js CHANGED
@@ -15,6 +15,7 @@ import IconText from './components/IconText';
15
15
  import IconQuestion from './components/IconQuestion';
16
16
  import IconBell from './components/IconBell';
17
17
  import IconSearch from './components/IconSearch';
18
+ import TagCheck from './components/TagCheck';
18
19
  import BaseService from './service/BaseService';
19
20
  import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
20
21
  import * as utils from './utils';
@@ -23,4 +24,4 @@ import useSingle from './hooks/useSingle';
23
24
  import useDtl from './hooks/useDtl';
24
25
  import usePermission from './hooks/usePermission';
25
26
  import useGetState from './hooks/useGetState';
26
- export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, IconBack, IconText, IconBell, IconQuestion, IconSearch, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState };
27
+ export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, IconBack, IconText, IconBell, IconQuestion, IconSearch, TagCheck, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "3.0.37",
3
+ "version": "3.0.38",
4
4
  "description": "ls-pro-common",
5
5
  "license": "MIT",
6
6
  "sideEffects": [