@hw-component/form 0.0.2 → 0.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/es/Select/components/AllSelect.d.ts +1 -0
- package/es/Select/components/AllSelect.js +3 -2
- package/es/config.d.ts +1 -0
- package/es/config.js +2 -1
- package/es/hooks/useClassName.d.ts +1 -0
- package/es/hooks/useClassName.js +14 -0
- package/es/index.css +1 -1
- package/lib/Select/components/AllSelect.d.ts +1 -0
- package/lib/Select/components/AllSelect.js +3 -2
- package/lib/config.d.ts +1 -0
- package/lib/config.js +2 -1
- package/lib/hooks/useClassName.d.ts +1 -0
- package/lib/hooks/useClassName.js +15 -0
- package/lib/index.css +1 -1
- package/package.json +2 -2
- package/scripts/rollup.config.js +1 -4
- package/src/components/Select/components/AllSelect.tsx +4 -2
- package/src/components/Select/index.less +2 -1
- package/src/components/config.less +1 -0
- package/src/components/config.ts +1 -0
- package/src/components/hooks/useClassName.ts +8 -0
- package/es/Select/index.less.js +0 -5
- package/lib/Select/index.less.js +0 -8
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// welcome to ww-building-blocks-tmp
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Space, Checkbox } from 'antd';
|
|
4
|
-
import styles from '../index.less.js';
|
|
5
4
|
import { itemOpProvider } from '../utils.js';
|
|
5
|
+
import { useClassName } from '../../hooks/useClassName.js';
|
|
6
6
|
|
|
7
7
|
var AllSelect = (function (_ref) {
|
|
8
8
|
var allSelect = _ref.allSelect,
|
|
@@ -17,6 +17,7 @@ var AllSelect = (function (_ref) {
|
|
|
17
17
|
}
|
|
18
18
|
var opLen = (options === null || options === void 0 ? void 0 : options.length) || 0;
|
|
19
19
|
var checked = (value === null || value === void 0 ? void 0 : value.length) >= opLen;
|
|
20
|
+
var optionsClassName = useClassName("option");
|
|
20
21
|
var change = function change() {
|
|
21
22
|
if (!checked) {
|
|
22
23
|
var subItemOps = itemOpProvider(options, fieldNames);
|
|
@@ -26,7 +27,7 @@ var AllSelect = (function (_ref) {
|
|
|
26
27
|
onChange === null || onChange === void 0 ? void 0 : onChange([], []);
|
|
27
28
|
};
|
|
28
29
|
return /*#__PURE__*/React.createElement("div", {
|
|
29
|
-
className: "ant-select-item ant-select-item-option ".concat(
|
|
30
|
+
className: "ant-select-item ant-select-item-option ".concat(optionsClassName),
|
|
30
31
|
onClick: change
|
|
31
32
|
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Checkbox, {
|
|
32
33
|
checked: checked
|
package/es/config.d.ts
CHANGED
package/es/config.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useClassName: (className: string) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// welcome to ww-building-blocks-tmp
|
|
2
|
+
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js/instance/concat';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { baseConfig } from '../config.js';
|
|
5
|
+
|
|
6
|
+
var useClassName = function useClassName(className) {
|
|
7
|
+
return useMemo(function () {
|
|
8
|
+
var _context;
|
|
9
|
+
return _concatInstanceProperty(_context = "".concat(baseConfig.prefixCls, "-")).call(_context, className);
|
|
10
|
+
}, [className]);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { useClassName };
|
|
14
|
+
// powered by ww
|
package/es/index.css
CHANGED
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var antd = require('antd');
|
|
7
|
-
var index = require('../index.less.js');
|
|
8
7
|
var utils = require('../utils.js');
|
|
8
|
+
var useClassName = require('../../hooks/useClassName.js');
|
|
9
9
|
|
|
10
10
|
var AllSelect = (function (_ref) {
|
|
11
11
|
var allSelect = _ref.allSelect,
|
|
@@ -20,6 +20,7 @@ var AllSelect = (function (_ref) {
|
|
|
20
20
|
}
|
|
21
21
|
var opLen = (options === null || options === void 0 ? void 0 : options.length) || 0;
|
|
22
22
|
var checked = (value === null || value === void 0 ? void 0 : value.length) >= opLen;
|
|
23
|
+
var optionsClassName = useClassName.useClassName("option");
|
|
23
24
|
var change = function change() {
|
|
24
25
|
if (!checked) {
|
|
25
26
|
var subItemOps = utils.itemOpProvider(options, fieldNames);
|
|
@@ -29,7 +30,7 @@ var AllSelect = (function (_ref) {
|
|
|
29
30
|
onChange === null || onChange === void 0 ? void 0 : onChange([], []);
|
|
30
31
|
};
|
|
31
32
|
return /*#__PURE__*/React.createElement("div", {
|
|
32
|
-
className: "ant-select-item ant-select-item-option ".concat(
|
|
33
|
+
className: "ant-select-item ant-select-item-option ".concat(optionsClassName),
|
|
33
34
|
onClick: change
|
|
34
35
|
}, /*#__PURE__*/React.createElement(antd.Space, null, /*#__PURE__*/React.createElement(antd.Checkbox, {
|
|
35
36
|
checked: checked
|
package/lib/config.d.ts
CHANGED
package/lib/config.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useClassName: (className: string) => string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/concat');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var config = require('../config.js');
|
|
6
|
+
|
|
7
|
+
var useClassName = function useClassName(className) {
|
|
8
|
+
return React.useMemo(function () {
|
|
9
|
+
var _context;
|
|
10
|
+
return _concatInstanceProperty(_context = "".concat(config.baseConfig.prefixCls, "-")).call(_context, className);
|
|
11
|
+
}, [className]);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.useClassName = useClassName;
|
|
15
|
+
// powered by h
|
package/lib/index.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hw-component/form",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "基于antd二次开发",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"postcss-less": "^6.0.0",
|
|
67
67
|
"rollup": "^3.23.0",
|
|
68
68
|
"rollup-plugin-clear": "^2.0.7",
|
|
69
|
-
"rollup-plugin-postcss": "
|
|
69
|
+
"rollup-plugin-postcss": "4.0.0",
|
|
70
70
|
"rollup-plugin-typescript2": "^0.34.1",
|
|
71
71
|
"style-loader": "^3.3.3",
|
|
72
72
|
"stylelint": "13.13.1",
|
package/scripts/rollup.config.js
CHANGED
|
@@ -4,11 +4,11 @@ const { nodeResolve } = require("@rollup/plugin-node-resolve");
|
|
|
4
4
|
const { babel } = require("@rollup/plugin-babel");
|
|
5
5
|
const commonjs = require("@rollup/plugin-commonjs");
|
|
6
6
|
const typescript = require("rollup-plugin-typescript2");
|
|
7
|
-
const postcss = require("rollup-plugin-postcss");
|
|
8
7
|
const autoprefixer = require("autoprefixer");
|
|
9
8
|
const inject = require("@rollup/plugin-inject");
|
|
10
9
|
const url = require("@rollup/plugin-url");
|
|
11
10
|
const pkg = require("../package.json");
|
|
11
|
+
const postcss=require("rollup-plugin-postcss");
|
|
12
12
|
const prefix = pkg.cssPrefix;
|
|
13
13
|
const input = path.resolve(__dirname, "../src/components/index.tsx");
|
|
14
14
|
const outDir = path.resolve(__dirname, "../lib");
|
|
@@ -43,9 +43,6 @@ module.exports = {
|
|
|
43
43
|
}),
|
|
44
44
|
postcss({
|
|
45
45
|
extract: "index.css",
|
|
46
|
-
modules: {
|
|
47
|
-
generateScopedName: `${prefix}_[local]`,
|
|
48
|
-
},
|
|
49
46
|
plugins: [
|
|
50
47
|
autoprefixer({
|
|
51
48
|
overrideBrowserslist: [
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { HSelectProps } from "@/components/Select/modal";
|
|
2
2
|
import { Checkbox, Space } from "antd";
|
|
3
|
-
import
|
|
3
|
+
import "../index.less"
|
|
4
4
|
import { itemOpProvider } from "../utils";
|
|
5
|
+
import {useClassName} from "@/components/hooks/useClassName";
|
|
5
6
|
interface IProps extends HSelectProps {
|
|
6
7
|
checked?: boolean;
|
|
7
8
|
}
|
|
@@ -19,6 +20,7 @@ export default ({
|
|
|
19
20
|
}
|
|
20
21
|
const opLen = options?.length || 0;
|
|
21
22
|
const checked = (value as any[])?.length >= opLen;
|
|
23
|
+
const optionsClassName=useClassName("option");
|
|
22
24
|
const change = () => {
|
|
23
25
|
if (!checked) {
|
|
24
26
|
const subItemOps = itemOpProvider(options, fieldNames);
|
|
@@ -29,7 +31,7 @@ export default ({
|
|
|
29
31
|
};
|
|
30
32
|
return (
|
|
31
33
|
<div
|
|
32
|
-
className={`ant-select-item ant-select-item-option ${
|
|
34
|
+
className={`ant-select-item ant-select-item-option ${optionsClassName}`}
|
|
33
35
|
onClick={change}
|
|
34
36
|
>
|
|
35
37
|
<Space>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@hw-prefix: hw;
|
package/src/components/config.ts
CHANGED
package/es/Select/index.less.js
DELETED