@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.
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { HSelectProps } from "@/components/Select/modal";
3
+ import "../index.less";
3
4
  interface IProps extends HSelectProps {
4
5
  checked?: boolean;
5
6
  }
@@ -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(styles.option),
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
@@ -11,4 +11,5 @@ export declare const baseConfig: {
11
11
  checked: boolean;
12
12
  noChecked: boolean;
13
13
  };
14
+ prefixCls: string;
14
15
  };
package/es/config.js CHANGED
@@ -11,7 +11,8 @@ var baseConfig = {
11
11
  defaultValueSwitchMap: {
12
12
  checked: true,
13
13
  noChecked: false
14
- }
14
+ },
15
+ prefixCls: "hw"
15
16
  };
16
17
 
17
18
  export { baseConfig };
@@ -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
@@ -1,3 +1,3 @@
1
- .option:hover {
1
+ .hw-option:hover {
2
2
  background-color: #f5f5f5;
3
3
  }
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { HSelectProps } from "@/components/Select/modal";
3
+ import "../index.less";
3
4
  interface IProps extends HSelectProps {
4
5
  checked?: boolean;
5
6
  }
@@ -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(index.default.option),
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
@@ -11,4 +11,5 @@ export declare const baseConfig: {
11
11
  checked: boolean;
12
12
  noChecked: boolean;
13
13
  };
14
+ prefixCls: string;
14
15
  };
package/lib/config.js CHANGED
@@ -12,7 +12,8 @@ var baseConfig = {
12
12
  defaultValueSwitchMap: {
13
13
  checked: true,
14
14
  noChecked: false
15
- }
15
+ },
16
+ prefixCls: "hw"
16
17
  };
17
18
 
18
19
  exports.baseConfig = baseConfig;
@@ -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
@@ -1,3 +1,3 @@
1
- .option:hover {
1
+ .hw-option:hover {
2
2
  background-color: #f5f5f5;
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "0.0.2",
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": "^4.0.2",
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",
@@ -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 styles from "../index.less";
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 ${styles.option}`}
34
+ className={`ant-select-item ant-select-item-option ${optionsClassName}`}
33
35
  onClick={change}
34
36
  >
35
37
  <Space>
@@ -1,4 +1,5 @@
1
- .option {
1
+ @import url("../config.less");
2
+ .@{hw-prefix}-option {
2
3
  &:hover {
3
4
  background-color: #f5f5f5;
4
5
  }
@@ -0,0 +1 @@
1
+ @hw-prefix: hw;
@@ -11,4 +11,5 @@ export const baseConfig = {
11
11
  checked: true,
12
12
  noChecked: false,
13
13
  },
14
+ prefixCls:"hw"
14
15
  };
@@ -0,0 +1,8 @@
1
+ import {useMemo} from "react";
2
+ import {baseConfig} from "@/components/config";
3
+
4
+ export const useClassName=(className:string)=>{
5
+ return useMemo(()=>{
6
+ return `${baseConfig.prefixCls}-${className}`
7
+ },[className])
8
+ }
@@ -1,5 +0,0 @@
1
- // welcome to ww-building-blocks-tmp
2
- var styles = undefined;
3
-
4
- export { styles as default };
5
- // powered by ww
@@ -1,8 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var styles = undefined;
6
-
7
- exports.default = styles;
8
- // powered by h