pixuireactcomponents 1.3.32 → 1.3.34

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/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { Carousel } from "./src/components/react/app/carousel/Carousel";
2
2
  export { Button } from "./src/components/react/app/button/Button";
3
+ export { CheckBox } from "./src/components/react/app/checkBox/CheckBox";
3
4
  export { Dropdown } from "./src/components/react/app/dropdown/Dropdown";
4
5
  export { ImageViewer } from "./src/components/react/app/imageViewer/imageViewer";
5
6
  export { ToggleGroup } from "./src/components/react/app/togglegroup/ToggleGroup";
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // Description: This file is the entry point for the library. It exports all the components.
2
2
  export { Carousel } from './src/components/react/app/carousel/Carousel';
3
3
  export { Button } from './src/components/react/app/button/Button';
4
- export { Checkbox } from './src/components/react/app/checkBox/CheckBox';
4
+ export { CheckBox } from './src/components/react/app/checkBox/CheckBox';
5
5
  export { Dropdown } from './src/components/react/app/dropdown/Dropdown';
6
6
  export { ImageViewer } from './src/components/react/app/imageViewer/imageViewer';
7
7
  export { Slider } from './src/components/react/app/slider/Slider';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixuireactcomponents",
3
- "version": "1.3.32",
3
+ "version": "1.3.34",
4
4
  "description": "pixui react components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,2 +1 @@
1
- #!/usr/bin/env node
2
1
  export function makeImages(_inputPath: any, _outputPath: any): void;
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env node
2
1
  'use strict';
3
2
  // 自动生成图集, 生成一个Images.ts文件,引用目标目录下的所有图片, 方便直接使用
4
3
  /*
@@ -6,11 +5,24 @@
6
5
  create imgDirectoryPath
7
6
  update imgDirectoryPath
8
7
  */
9
- var fs = require('fs');
10
8
  var path = require('path');
11
9
  var inputPath = '';
12
10
  var outputPath = '';
13
- module.exports.makeImages = function (_inputPath, _outputPath) {
11
+ var getfs = function () {
12
+ return require('fs');
13
+ };
14
+ export var makeImages = function (_inputPath, _outputPath) {
15
+ if (!getfs()) {
16
+ return; //不在node环境中
17
+ }
18
+ if (!isDirectoryExist(_inputPath)) {
19
+ console.warn('inputPath is not a directory!');
20
+ return;
21
+ }
22
+ if (!isDirectoryExist(_outputPath)) {
23
+ console.warn('outputPath is not a directory!');
24
+ return;
25
+ }
14
26
  var imgUrls = [];
15
27
  inputPath = _inputPath;
16
28
  outputPath = _outputPath;
@@ -21,7 +33,7 @@ module.exports.makeImages = function (_inputPath, _outputPath) {
21
33
  function isDirectoryExist(directory) {
22
34
  var stat;
23
35
  try {
24
- stat = fs.lstatSync(directory);
36
+ stat = getfs.lstatSync(directory);
25
37
  }
26
38
  catch (e) {
27
39
  return false;
@@ -29,7 +41,7 @@ function isDirectoryExist(directory) {
29
41
  return stat.isDirectory();
30
42
  }
31
43
  function collectImageUrls(inputPath, imgUrls, isFirst) {
32
- var files = fs.readdirSync(inputPath);
44
+ var files = getfs.readdirSync(inputPath);
33
45
  for (var i = 0; i < files.length; i++) {
34
46
  var current = path.join(inputPath, files[i]).replaceAll('\\', '/');
35
47
  if (isDirectoryExist(current)) {
@@ -45,7 +57,7 @@ function collectImageUrls(inputPath, imgUrls, isFirst) {
45
57
  }
46
58
  function generateImage(inputPath, imgUrls, keyMap) {
47
59
  var out = path.resolve(outputPath, 'Images.ts');
48
- fs.writeFileSync(out, '');
60
+ getfs.writeFileSync(out, '');
49
61
  // write import
50
62
  for (var i = 0; i < imgUrls.length; i++) {
51
63
  var current = imgUrls[i];
@@ -53,18 +65,18 @@ function generateImage(inputPath, imgUrls, keyMap) {
53
65
  if (current.startsWith('../'))
54
66
  current = './' + current;
55
67
  // console.warn(inputPath, current, imgKey)
56
- fs.writeFileSync(out, 'import '.concat(imgKey, ' from "').concat(current, '";\n'), { flag: 'a+' });
68
+ getfs.writeFileSync(out, 'import '.concat(imgKey, ' from "').concat(current, '";\n'), { flag: 'a+' });
57
69
  }
58
- fs.writeFileSync(out, '\n\n', { flag: 'a+' });
70
+ getfs.writeFileSync(out, '\n\n', { flag: 'a+' });
59
71
  //write export
60
- fs.writeFileSync(out, '\nexport const Images = {\n', { flag: 'a+' });
72
+ getfs.writeFileSync(out, '\nexport const Images = {\n', { flag: 'a+' });
61
73
  for (var i = 0; i < imgUrls.length; i++) {
62
74
  var current = imgUrls[i];
63
75
  var imgKey = generateImgKey(inputPath, current);
64
76
  var imgNewname = keyMap == null || keyMap.get(imgKey) == undefined ? imgKey : keyMap.get(imgKey);
65
- fs.writeFileSync(out, ' '.concat(imgNewname, ': ').concat(imgKey, ',\n'), { flag: 'a+' });
77
+ getfs.writeFileSync(out, ' '.concat(imgNewname, ': ').concat(imgKey, ',\n'), { flag: 'a+' });
66
78
  }
67
- fs.writeFileSync(out, '}\n\n', { flag: 'a+' });
79
+ getfs.writeFileSync(out, '}\n\n', { flag: 'a+' });
68
80
  console.log(keyMap == null ? 'generate' : 'update', ' Images.ts successfully!');
69
81
  }
70
82
  function generateImgKey(inputPath, imgUrl) {