@wavemaker/custom-widgets-m3 12.0.0-next.141130
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.
- custom-widgets-m3/custom-widgets-bundle.cjs.js +390 -0
- custom-widgets-m3/index.d.ts +11 -0
- custom-widgets-m3/index.js +11 -0
- custom-widgets-m3/package.json +36 -0
- custom-widgets-m3/scripts/build.d.ts +1 -0
- custom-widgets-m3/scripts/build.js +133 -0
- custom-widgets-m3/scripts/update-version.d.ts +1 -0
- custom-widgets-m3/scripts/update-version.js +19 -0
- custom-widgets-m3/src/checkbox_set/checkbox_set.d.ts +10 -0
- custom-widgets-m3/src/checkbox_set/checkbox_set.js +52 -0
- custom-widgets-m3/src/checkbox_set/page.min.d.ts +7 -0
- custom-widgets-m3/src/checkbox_set/page.min.js +7 -0
- custom-widgets-m3/src/discrete_slider/discrete_slider.d.ts +25 -0
- custom-widgets-m3/src/discrete_slider/discrete_slider.js +218 -0
- custom-widgets-m3/src/discrete_slider/page.min.d.ts +7 -0
- custom-widgets-m3/src/discrete_slider/page.min.js +7 -0
- custom-widgets-m3/src/divider/divider.d.ts +4 -0
- custom-widgets-m3/src/divider/divider.js +42 -0
- custom-widgets-m3/src/divider/page.min.d.ts +7 -0
- custom-widgets-m3/src/divider/page.min.js +7 -0
- custom-widgets-m3/src/icon_button/icon_button.d.ts +0 -0
- custom-widgets-m3/src/icon_button/icon_button.js +16 -0
- custom-widgets-m3/src/icon_button/page.min.d.ts +7 -0
- custom-widgets-m3/src/icon_button/page.min.js +7 -0
- custom-widgets-m3/src/input_chip/input_chip.d.ts +1 -0
- custom-widgets-m3/src/input_chip/input_chip.js +29 -0
- custom-widgets-m3/src/input_chip/page.min.d.ts +7 -0
- custom-widgets-m3/src/input_chip/page.min.js +7 -0
- custom-widgets-m3/src/progressbar/page.min.d.ts +7 -0
- custom-widgets-m3/src/progressbar/page.min.js +7 -0
- custom-widgets-m3/src/progressbar/progressbar.d.ts +2 -0
- custom-widgets-m3/src/progressbar/progressbar.js +48 -0
- custom-widgets-m3/src/radio_set/page.min.d.ts +7 -0
- custom-widgets-m3/src/radio_set/page.min.js +7 -0
- custom-widgets-m3/src/radio_set/radio_set.d.ts +9 -0
- custom-widgets-m3/src/radio_set/radio_set.js +45 -0
- custom-widgets-m3/src/slider/page.min.d.ts +7 -0
- custom-widgets-m3/src/slider/page.min.js +7 -0
- custom-widgets-m3/src/slider/slider.d.ts +16 -0
- custom-widgets-m3/src/slider/slider.js +127 -0
- custom-widgets-m3/src/switch_button/page.min.d.ts +7 -0
- custom-widgets-m3/src/switch_button/page.min.js +7 -0
- custom-widgets-m3/src/switch_button/switch_button.d.ts +8 -0
- custom-widgets-m3/src/switch_button/switch_button.js +108 -0
- custom-widgets-m3/src/textfield/page.min.d.ts +7 -0
- custom-widgets-m3/src/textfield/page.min.js +7 -0
- custom-widgets-m3/src/textfield/textfield.d.ts +4 -0
- custom-widgets-m3/src/textfield/textfield.js +65 -0
- custom-widgets-m3/src/widget-registry.d.ts +6 -0
- custom-widgets-m3/src/widget-registry.js +62 -0
- custom-widgets-m3/webpack.config.cjs.d.ts +31 -0
- custom-widgets-m3/webpack.config.cjs.js +40 -0
- custom-widgets-m3/webpack.config.d.ts +32 -0
- custom-widgets-m3/webpack.config.js +41 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './src/textfield/page.min';
|
|
2
|
+
export * from './src/checkbox_set/page.min';
|
|
3
|
+
export * from './src/divider/page.min';
|
|
4
|
+
export * from './src/icon_button/page.min';
|
|
5
|
+
export * from './src/input_chip/page.min';
|
|
6
|
+
export * from './src/radio_set/page.min';
|
|
7
|
+
export * from './src/switch_button/page.min';
|
|
8
|
+
export * from './src/slider/page.min';
|
|
9
|
+
export * from './src/progressbar/page.min';
|
|
10
|
+
export * from './src/discrete_slider/page.min';
|
|
11
|
+
export * from './src/widget-registry';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './src/textfield/page.min';
|
|
2
|
+
export * from './src/checkbox_set/page.min';
|
|
3
|
+
export * from './src/divider/page.min';
|
|
4
|
+
export * from './src/icon_button/page.min';
|
|
5
|
+
export * from './src/input_chip/page.min';
|
|
6
|
+
export * from './src/radio_set/page.min';
|
|
7
|
+
export * from './src/switch_button/page.min';
|
|
8
|
+
export * from './src/slider/page.min';
|
|
9
|
+
export * from './src/progressbar/page.min';
|
|
10
|
+
export * from './src/discrete_slider/page.min';
|
|
11
|
+
export * from './src/widget-registry';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wavemaker/custom-widgets-m3",
|
|
3
|
+
"version": "12.0.0-next.141130",
|
|
4
|
+
"description": "A collection of custom widgets",
|
|
5
|
+
"module": "index",
|
|
6
|
+
"main": "index",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build:cjs": "webpack --config webpack.config.cjs.js --mode development",
|
|
9
|
+
"build:esm": "webpack --config webpack.config.js --mode development",
|
|
10
|
+
"build": "tsc && npm run build:cjs && npm run build:esm && node ./scripts/build.js post-build",
|
|
11
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"widgets",
|
|
15
|
+
"custom-widgets"
|
|
16
|
+
],
|
|
17
|
+
"author": "",
|
|
18
|
+
"license": "ISC",
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"css-loader": "^7.1.2",
|
|
21
|
+
"execa": "^5.0.0",
|
|
22
|
+
"fs-extra": "^11.2.0",
|
|
23
|
+
"html-loader": "^5.1.0",
|
|
24
|
+
"style-loader": "^4.0.0",
|
|
25
|
+
"ts-loader": "^9.5.1",
|
|
26
|
+
"typescript": "^5.5.4",
|
|
27
|
+
"webpack": "^5.94.0",
|
|
28
|
+
"webpack-cli": "^5.1.4",
|
|
29
|
+
"yargs": "^16.2.0",
|
|
30
|
+
"tar": "^6.1.0"
|
|
31
|
+
},
|
|
32
|
+
"exports": {
|
|
33
|
+
"import": "./index",
|
|
34
|
+
"require": "./dist/custom-widgets-bundle.cjs.js"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var fs = require('fs-extra');
|
|
38
|
+
var path = require('path');
|
|
39
|
+
var projectDir = '.';
|
|
40
|
+
var execa = require('execa');
|
|
41
|
+
var yargs = require('yargs');
|
|
42
|
+
var hideBin = require('yargs/helpers').hideBin;
|
|
43
|
+
var tar = require('tar');
|
|
44
|
+
function updatePackageVersion(packagePath, key, version) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
46
|
+
var content;
|
|
47
|
+
return __generator(this, function (_a) {
|
|
48
|
+
content = fs.readFileSync(packagePath, 'utf8');
|
|
49
|
+
content = content.replace(new RegExp("\"".concat(key, "\"\\s*:\\s*\"[^\"]*\"")), "\"".concat(key, "\": \"").concat(version, "\""));
|
|
50
|
+
fs.writeFileSync(packagePath, content);
|
|
51
|
+
return [2 /*return*/];
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function postBuild(runtimeVersion) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
+
var packageData;
|
|
58
|
+
return __generator(this, function (_a) {
|
|
59
|
+
switch (_a.label) {
|
|
60
|
+
case 0:
|
|
61
|
+
fs.copySync("".concat(projectDir, "/package.json"), "".concat(projectDir, "/dist/es2015/package.json"));
|
|
62
|
+
packageData = fs.readJSONSync("".concat(projectDir, "/package.json"), {
|
|
63
|
+
encoding: "utf8"
|
|
64
|
+
});
|
|
65
|
+
packageData.main = 'index';
|
|
66
|
+
packageData.module = 'index';
|
|
67
|
+
packageData.exports = {
|
|
68
|
+
"import": "./index",
|
|
69
|
+
"require": "./dist/custom-widgets-bundle.cjs.js"
|
|
70
|
+
};
|
|
71
|
+
delete packageData['files'];
|
|
72
|
+
fs.writeFileSync("".concat(projectDir, "/dist/es2015/package.json"), JSON.stringify(packageData, null, 2));
|
|
73
|
+
return [4 /*yield*/, updatePackageVersion("".concat(projectDir, "/dist/es2015/package.json"), 'version', runtimeVersion)];
|
|
74
|
+
case 1:
|
|
75
|
+
_a.sent();
|
|
76
|
+
console.log('Post Build successful!!!');
|
|
77
|
+
return [2 /*return*/];
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function prepareNpmPackages() {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
84
|
+
return __generator(this, function (_a) {
|
|
85
|
+
switch (_a.label) {
|
|
86
|
+
case 0:
|
|
87
|
+
fs.copySync("".concat(projectDir, "/dist/es2015"), "".concat(projectDir, "/dist/npm-packages/custom-widgets-m3"), {
|
|
88
|
+
filter: function (p) { return !p.startsWith('/node_modules/'); }
|
|
89
|
+
});
|
|
90
|
+
return [4 /*yield*/, execa('tar', ['-czf', 'dist/npm-packages/custom-widgets-m3.tar.gz', '-C', 'dist/npm-packages', 'custom-widgets-m3'])];
|
|
91
|
+
case 1:
|
|
92
|
+
_a.sent();
|
|
93
|
+
return [2 /*return*/];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function pushToLocalRepo() {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
100
|
+
return __generator(this, function (_a) {
|
|
101
|
+
switch (_a.label) {
|
|
102
|
+
case 0:
|
|
103
|
+
fs.writeFileSync("".concat(projectDir, "/dist/new-build"), '' + Date.now);
|
|
104
|
+
return [4 /*yield*/, execa('yalc', ['publish', '--no-sig', '--push'], {
|
|
105
|
+
'cwd': "".concat(projectDir, "/dist/es2015")
|
|
106
|
+
})];
|
|
107
|
+
case 1:
|
|
108
|
+
_a.sent();
|
|
109
|
+
return [2 /*return*/];
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
yargs(hideBin(process.argv)).command('post-build', 'to run post processing after project build', function (yargs) {
|
|
115
|
+
yargs.option('runtimeVersion', {
|
|
116
|
+
describe: 'version number',
|
|
117
|
+
type: 'string',
|
|
118
|
+
default: '1.0.0-dev'
|
|
119
|
+
}).option('production', {
|
|
120
|
+
describe: 'to perform a production build',
|
|
121
|
+
type: 'boolean',
|
|
122
|
+
default: false
|
|
123
|
+
});
|
|
124
|
+
}, function (argv) {
|
|
125
|
+
postBuild(argv.runtimeVersion).then(function () {
|
|
126
|
+
if (argv.production) {
|
|
127
|
+
return prepareNpmPackages();
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
return pushToLocalRepo();
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}).showHelpOnFail().argv;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var fs = require('fs');
|
|
3
|
+
var yargs = require('yargs');
|
|
4
|
+
var argv = yargs(process.argv).argv;
|
|
5
|
+
var updateCustomeWidgetsPackage = function (path) {
|
|
6
|
+
if (fs.existsSync(path)) {
|
|
7
|
+
var packageJSON = require('../' + path);
|
|
8
|
+
packageJSON['dependencies']['@wavemaker/custom-widgets-m3'] = argv["publish-version"];
|
|
9
|
+
fs.writeFileSync(path, JSON.stringify(packageJSON, null, 4));
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
console.log('package.json not found at ' + path);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var init = function () {
|
|
16
|
+
updateCustomeWidgetsPackage('../wavemaker-ng-runtime/package.json');
|
|
17
|
+
updateCustomeWidgetsPackage('../wavemaker-ng-studio/package.json');
|
|
18
|
+
};
|
|
19
|
+
init();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare function handleLabelPlacementChange(widgetMap: any, label_placement: any): void;
|
|
2
|
+
declare function handleLabelPlacementChange(widgetMap: any, label_placement: any): void;
|
|
3
|
+
declare function updateClasses(element: any, classMap: any): void;
|
|
4
|
+
declare function updateClasses(element: any, classMap: any): void;
|
|
5
|
+
declare function handleIntermediateChange(widgetMap: any, show_intermediate: any): void;
|
|
6
|
+
declare function handleLayoutChange(widgetMap: any, layout: any): void;
|
|
7
|
+
declare function handleLayoutChange(widgetMap: any, layout: any): void;
|
|
8
|
+
declare function handleRequiredChange(widgetMap: any, required: any): void;
|
|
9
|
+
declare function handleRequiredChange(widgetMap: any, required: any): void;
|
|
10
|
+
declare function handleRequiredChange(required: any, widgetMap: any): void;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Use App.getDependency for Dependency Injection
|
|
3
|
+
* eg: var DialogService = App.getDependency('DialogService');
|
|
4
|
+
*/
|
|
5
|
+
Widget.onPropertyChange = function (propName, newValue, oldValue) {
|
|
6
|
+
var _a = Widget.props, show_intermediate = _a.show_intermediate, required = _a.required, layout = _a.layout, label_placement = _a.label_placement;
|
|
7
|
+
var widgetMap = Widget.Widgets;
|
|
8
|
+
var propertyHandlers = {
|
|
9
|
+
'prop-required': function () { return handleRequiredChange(widgetMap, required); },
|
|
10
|
+
'prop-layout': function () { return handleLayoutChange(widgetMap, layout); },
|
|
11
|
+
'prop-show_intermediate': function () { return handleIntermediateChange(widgetMap, show_intermediate); },
|
|
12
|
+
'prop-label_placement': function () { return handleLabelPlacementChange(widgetMap, label_placement); }
|
|
13
|
+
};
|
|
14
|
+
if (propertyHandlers[propName]) {
|
|
15
|
+
propertyHandlers[propName]();
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
Widget.onReady = function () {
|
|
19
|
+
var _a = Widget.props, show_intermediate = _a.show_intermediate, required = _a.required, layout = _a.layout, label_placement = _a.label_placement;
|
|
20
|
+
var widgetMap = Widget.Widgets;
|
|
21
|
+
handleLayoutChange(widgetMap, layout);
|
|
22
|
+
handleLabelPlacementChange(widgetMap, label_placement);
|
|
23
|
+
handleIntermediateChange(widgetMap, show_intermediate);
|
|
24
|
+
handleRequiredChange(widgetMap, required);
|
|
25
|
+
};
|
|
26
|
+
function handleLabelPlacementChange(widgetMap, label_placement) {
|
|
27
|
+
updateClasses(widgetMap.checkboxset.nativeElement, {
|
|
28
|
+
'top-placement': label_placement === "top",
|
|
29
|
+
'bottom-placement': label_placement === "bottom",
|
|
30
|
+
'start-placement': label_placement === "start"
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
// Utility function to manage class additions and removals
|
|
34
|
+
function updateClasses(element, classMap) {
|
|
35
|
+
Object.keys(classMap).forEach(function (className) {
|
|
36
|
+
element.classList.toggle(className, classMap[className]);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function handleIntermediateChange(widgetMap, show_intermediate) {
|
|
40
|
+
updateClasses(widgetMap.checkboxset.nativeElement, {
|
|
41
|
+
'intermediate-checkbox': show_intermediate.toString().toLowerCase() === 'true'
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function handleLayoutChange(widgetMap, layout) {
|
|
45
|
+
updateClasses(widgetMap.checkboxset.nativeElement, {
|
|
46
|
+
'horizontal': layout === "horizontal",
|
|
47
|
+
'vertical': layout === "vertical"
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function handleRequiredChange(widgetMap, required) {
|
|
51
|
+
widgetMap.composite1.required = required;
|
|
52
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var checkbox_set = {
|
|
2
|
+
"markup": "%3Cwm-custom-widget-container+name%3D%22partial1%22%3E%0A++++%3Cwm-composite+name%3D%22composite1%22+captionposition%3D%22top%22+required%3D%22false%22%3E%0A++++++++%3Cwm-label+class%3D%22+control-label%22+notag%3D%22true%22+name%3D%22label1%22+caption%3D%22bind%3Aprops.label_text%22%3E%3C%2Fwm-label%3E%0A++++++++%3Cwm-container+name%3D%22container1%22%3E%0A++++++++++++%3Cwm-checkboxset+height%3D%22auto%22+name%3D%22checkboxset%22+dataset%3D%22bind%3Aprops.data_set%22+datafield%3D%22All+Fields%22+disabled%3D%22bind%3Aprops.state%3D%3D%26quot%3BDisabled%26quot%3B%22+required%3D%22bind%3Aprops.required%22+datavalue%3D%22bind%3Aprops.default_value%22%3E%3C%2Fwm-checkboxset%3E%0A++++++++%3C%2Fwm-container%3E%0A++++%3C%2Fwm-composite%3E%0A%3C%2Fwm-custom-widget-container%3E",
|
|
3
|
+
"script": "%2F*%0A+*+Use+App.getDependency+for+Dependency+Injection%0A+*+eg%3A+var+DialogService+%3D+App.getDependency%28%27DialogService%27%29%3B%0A+*%2F%0A%0AWidget.onPropertyChange+%3D+function%28propName%2C+newValue%2C+oldValue%29+%7B%0A++++const+%7B%0A++++++++show_intermediate%2C%0A++++++++required%2C%0A++++++++layout%2C%0A++++++++label_placement%0A++++%7D+%3D+Widget.props%3B%0A++++const+widgetMap+%3D+Widget.Widgets%3B%0A%0A++++const+propertyHandlers+%3D+%7B%0A++++++++%27prop-required%27%3A+%28%29+%3D%3E+handleRequiredChange%28widgetMap%2C+required%29%2C%0A++++++++%27prop-layout%27%3A+%28%29+%3D%3E+handleLayoutChange%28widgetMap%2C+layout%29%2C%0A++++++++%27prop-show_intermediate%27%3A+%28%29+%3D%3E+handleIntermediateChange%28widgetMap%2C+show_intermediate%29%2C%0A++++++++%27prop-label_placement%27%3A+%28%29+%3D%3E+handleLabelPlacementChange%28widgetMap%2C+label_placement%29%0A++++%7D%3B%0A%0A++++if+%28propertyHandlers%5BpropName%5D%29+%7B%0A++++++++propertyHandlers%5BpropName%5D%28%29%3B%0A++++%7D%0A%7D%3B%0A%0AWidget.onReady+%3D+function%28%29+%7B%0A++++const+%7B%0A++++++++show_intermediate%2C%0A++++++++required%2C%0A++++++++layout%2C%0A++++++++label_placement%0A++++%7D+%3D+Widget.props%3B%0A++++const+widgetMap+%3D+Widget.Widgets%3B%0A%0A++++handleLayoutChange%28widgetMap%2C+layout%29%3B%0A++++handleLabelPlacementChange%28widgetMap%2C+label_placement%29%0A++++handleIntermediateChange%28widgetMap%2C+show_intermediate%29%3B%0A++++handleRequiredChange%28widgetMap%2C+required%29%3B%0A%7D%3B%0A%0Afunction+handleLabelPlacementChange%28widgetMap%2C+label_placement%29+%7B%0A++++updateClasses%28widgetMap.checkboxset.nativeElement%2C+%7B%0A++++++++%27top-placement%27%3A+label_placement+%3D%3D%3D+%22top%22%2C%0A++++++++%27bottom-placement%27%3A+label_placement+%3D%3D%3D+%22bottom%22%2C%0A++++++++%27start-placement%27%3A+label_placement+%3D%3D%3D+%22start%22%0A++++%7D%29%3B%0A%7D%0A%0A%2F%2F+Utility+function+to+manage+class+additions+and+removals%0Afunction+updateClasses%28element%2C+classMap%29+%7B%0A++++Object.keys%28classMap%29.forEach%28%28className%29+%3D%3E+%7B%0A++++++++element.classList.toggle%28className%2C+classMap%5BclassName%5D%29%3B%0A++++%7D%29%3B%0A%7D%0A%0Afunction+handleIntermediateChange%28widgetMap%2C+show_intermediate%29+%7B%0A++++updateClasses%28widgetMap.checkboxset.nativeElement%2C+%7B%0A++++++++%27intermediate-checkbox%27%3A+show_intermediate.toString%28%29.toLowerCase%28%29+%3D%3D%3D+%27true%27%0A++++%7D%29%3B%0A%7D%0A%0A%0Afunction+handleLayoutChange%28widgetMap%2C+layout%29+%7B%0A++++updateClasses%28widgetMap.checkboxset.nativeElement%2C+%7B%0A++++++++%27horizontal%27%3A+layout+%3D%3D%3D+%22horizontal%22%2C%0A++++++++%27vertical%27%3A+layout+%3D%3D%3D+%22vertical%22%0A++++%7D%29%3B%0A%7D%0A%0Afunction+handleRequiredChange%28widgetMap%2C+required%29+%7B%0A++++widgetMap.composite1.required+%3D+required%3B%0A%7D",
|
|
4
|
+
"styles": ".app-checkboxset.list-group.inline%2C%0A.app-checkboxset.list-group+%7B%0A++++flex-direction%3A+column%3B%0A++++display%3A+inline-flex%3B%0A%7D%0A%0A.app-checkboxset.list-group.inline.horizontal%2C%0A.app-checkboxset.list-group.horizontal+%7B%0A++++flex-direction%3A+row%3B%0A++++display%3A+inline-flex%3B%0A%7D%0A%0A.app-checkboxset+.checkbox%3Elabel+.caption%3Aafter+%7B%0A++++box-sizing%3A+unset%3B%0A%7D%0A%0A%0A%2F*+start+label+placement+styles++*%2F%0A%0A.app-checkboxset.horizontal.start-placement+.app-checkboxset-label%3E.caption%2C%0A.app-checkboxset.vertical.start-placement+.app-checkboxset-label%3E.caption+%7B%0A++++padding-left%3A+unset%3B%0A++++padding-right%3A+calc%28var%28--wm-checkbox-state-layer-size%29+%2B+var%28--wm-checkbox-gap%29%29%3B%0A%7D%0A%0A.app-checkboxset.horizontal.start-placement+.checkbox%3Elabel+.caption%3Abefore%2C%0A.app-checkboxset.vertical.start-placement+.checkbox%3Elabel+.caption%3Abefore+%7B%0A++++left%3A+unset%3B%0A++++right%3A+calc%28%28var%28--wm-checkbox-state-layer-size%29+-+var%28--wm-checkbox-size%29%29+%2F+2%29%3B%0A%7D%0A%0A.app-checkboxset.horizontal.start-placement+.checkbox%3Elabel+.caption%3Aafter%2C%0A.app-checkboxset.vertical.start-placement+.checkbox%3Elabel+.caption%3Aafter+%7B%0A++++left%3A+unset%3B%0A++++right%3A+calc%28calc%28%28var%28--wm-checkbox-state-layer-size%29+-+var%28--wm-checkbox-size%29%29+%2F+2%29+%2B+6px%29%3B%0A%7D%0A%0A.app-checkboxset.horizontal.start-placement+.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D%2C%0A.app-checkboxset.vertical.start-placement+.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D+%7B%0A++++left%3A+unset%3B%0A++++right%3A+0px%3B%0A%7D%0A%0A%0A%2F*+top+label+placement+styles++*%2F%0A%0A.app-checkboxset.top-placement+.app-checkboxset-label%3E.caption+%7B%0A++++padding-left%3A+unset%3B%0A++++padding-bottom%3A+calc%28var%28--wm-checkbox-state-layer-size%29+%2B+var%28--wm-checkbox-gap%29%29%3B%0A++++min-width%3A+20px%3B%0A++++padding-top%3A+unset%3B%0A%7D%0A%0A.app-checkboxset.top-placement+.app-checkboxset-label%3E.caption%3A%3Abefore+%7B%0A++++top%3A+calc%28calc%28var%28--wm-checkbox-caption-line-height%29+%2B+var%28--wm-checkbox-gap%29%29+%2B+calc%28%28var%28--wm-checkbox-state-layer-size%29+-+var%28--wm-checkbox-size%29%29+%2F+2%29%29%3B%0A++++left%3A+50%25%3B%0A++++transform%3A+translateX%28-50%25%29%3B%0A%7D%0A%0A.app-checkboxset.top-placement+.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D+%7B%0A++++top%3A+calc%28calc%28var%28--wm-checkbox-caption-line-height%29+%2B+var%28--wm-checkbox-gap%29%29%29%3B%0A++++left%3A+50%25%3B%0A++++transform%3A+translateX%28-50%25%29%3B%0A%7D%0A%0A.wm-app+.app-checkboxset.top-placement%3E.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D%3Achecked%2B.caption%3Aafter+%7B%0A++++top%3A+calc%28calc%28var%28--wm-checkbox-caption-line-height%29+%2B+var%28--wm-checkbox-gap%29%29+%2B+calc%28%28var%28--wm-checkbox-state-layer-size%29+-+var%28--wm-checkbox-size%29%29+%2F+2%29%29%3B%0A++++left%3A+50%25%3B%0A++++transform%3A+translate%28-6px%2C+4px%29+rotate%28-45deg%29+scale%281%29%3B%0A%7D%0A%0A%0A%2F*+bottom+label+placement+style++*%2F%0A%0A.app-checkboxset.bottom-placement+.app-checkboxset-label%3E.caption+%7B%0A++++padding-left%3A+unset%3B%0A++++padding-bottom%3A+unset%3B%0A++++padding-top%3A+calc%28var%28--wm-checkbox-state-layer-size%29+%2B+var%28--wm-checkbox-gap%29%29%3B%0A%7D%0A%0A.app-checkboxset.bottom-placement+%7B%0A++++display%3A+inline-flex%3B%0A++++min-width%3A+40px%3B%0A++++max-width%3A+max-content%3B%0A++++align-items%3A+center%3B%0A%7D%0A%0A.app-checkboxset.bottom-placement+.app-checkboxset-label%3E.caption%3A%3Abefore+%7B%0A++++left%3A+50%25%3B%0A++++transform%3A+translateX%28-50%25%29%3B%0A%7D%0A%0A.app-checkboxset.bottom-placement+.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D+%7B%0A++++left%3A+50%25%3B%0A++++transform%3A+translateX%28-50%25%29%3B%0A%7D%0A%0A.wm-app+.app-checkboxset.bottom-placement%3E.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D%3Achecked%2B.caption%3Aafter+%7B%0A++++left%3A+50%25%3B%0A++++transform%3A+translate%28-6px%2C+4px%29+rotate%28-45deg%29+scale%281%29%3B%0A%7D%0A%0A.app-checkboxset.horizontal.bottom-placement+.app-checkboxset-label%3E.caption+%7B%0A++++padding-left%3A+unset%3B%0A++++padding-top%3A+calc%28var%28--wm-checkbox-state-layer-size%29+%2B+var%28--wm-checkbox-gap%29%29%3B%0A++++min-width%3A+20px%3B%0A++++justify-content%3A+center%3B%0A++++display%3A+inline-flex%3B%0A++++margin-top%3A+unset%3B%0A%7D%0A%0A.app-checkboxset.horizontal.bottom-placement+.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D%3Achecked%2B.caption%3Aafter+%7B%0A++++top%3A+calc%28%28var%28--wm-checkbox-state-layer-size%29+-+var%28--wm-checkbox-size%29%29+%2F+2%29%3B%0A%7D%0A%0A.app-checkboxset.horizontal.bottom-placement+.app-checkboxset-label%3E.caption%3A%3Abefore+%7B%0A++++top%3A+calc%28%28var%28--wm-checkbox-state-layer-size%29+-+var%28--wm-checkbox-size%29%29+%2F+2%29%3B%0A%7D%0A%0A.app-checkboxset.horizontal.bottom-placement+.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D+%7B%0A++++top%3A+0px%3B%0A%7D%0A%0A.app-checkboxset+.app-checkboxset-label.disabled%3Einput%5Btype%3D%22checkbox%22%5D%3Achecked%2B.caption%3A%3Abefore%2C%0A.app-checkboxset.intermediate-checkbox+.app-checkboxset-label.disabled%3Einput%5Btype%3D%22checkbox%22%5D%2B.caption%3A%3Abefore%2C%0A.app-checkboxset+.app-checkboxset-label.disabled%3Einput%5Btype%3D%22checkbox%22%5D%3Achecked%2B.caption%3A%3Abefore%2C%0A.app-checkboxset.intermediate-checkbox+.app-checkboxset-label.disabled%3Einput%5Btype%3D%22checkbox%22%5D%2B.caption%3A%3Abefore+%7B%0A++++border-color%3A+var%28--wm-checkbox-border-color%29%3B%0A++++background-color%3A+var%28--wm-checkbox-border-color%29%3B%0A%7D%0A%0A.app-checkboxset.intermediate-checkbox%3E.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D%3Anot%28%3Achecked%29%2B.caption%3Aafter%2C%0A.app-checkboxset.top-placement.intermediate-checkbox%3E.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D%3Anot%28%3Achecked%29%2B.caption%3Aafter%2C%0A.app-checkboxset.bottom-placement.intermediate-checkbox%3E.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D%3Anot%28%3Achecked%29%2B.caption%3Aafter%2C%0A.app-checkboxset.start-placement.intermediate-checkbox%3E.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D%3Anot%28%3Achecked%29%2B.caption%3Aafter+%7B%0A++++border%3A+0px%3B%0A%7D%0A%0A.app-checkboxset.horizontal.intermediate-checkbox%3E.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D%2B.caption%3Aafter%2C%0A.app-checkboxset.vertical.intermediate-checkbox%3E.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D%2B.caption%3Aafter+%7B%0A++++top%3A+calc%28calc%28var%28--wm-checkbox-state-layer-size%29%2F2%29+-+1px%29%3B%0A++++height%3A+0px%3B%0A++++transform%3A+translate%283px%2C+0px%29+rotate%280deg%29+scale%281%29%3B%0A%7D%0A%0A.app-checkboxset.top-placement.horizontal.intermediate-checkbox%3E.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D%2B.caption%3Aafter%2C%0A.app-checkboxset.top-placement.vertical.intermediate-checkbox%3E.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D%2B.caption%3Aafter+%7B%0A++++top%3A+calc%28calc%28var%28--wm-checkbox-caption-line-height%29+%2B+var%28--wm-checkbox-gap%29%29+%2B+calc%28var%28--wm-checkbox-state-layer-size%29%2F2%29+-+1px%29%3B%0A++++height%3A+0px%3B%0A++++transform%3A+translate%28-6px%2C+0px%29+rotate%280deg%29+scale%281%29%3B%0A++++left%3A+50%25%3B%0A%7D%0A%0A.app-checkboxset.horizontal.bottom-placement.intermediate-checkbox%3E.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D%2B.caption%3Aafter%2C%0A.app-checkboxset.vertical.bottom-placement.intermediate-checkbox%3E.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D%2B.caption%3Aafter+%7B%0A++++top%3A+calc%28calc%28var%28--wm-checkbox-caption-line-height%29+%2B+var%28--wm-checkbox-gap%29%29+-+calc%28var%28--wm-checkbox-state-layer-size%29%2F2%29+%2B+7px%29%3B%0A++++height%3A+0px%3B%0A++++transform%3A+translate%28-6px%2C+4px%29+rotate%280deg%29+scale%281%29%3B%0A++++left%3A+50%25%3B%0A%7D%0A%0A.app-checkboxset.start-placement.horizontal.intermediate-checkbox%3E.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D%2B.caption%3Aafter%2C%0A.app-checkboxset.start-placement.vertical.intermediate-checkbox%3E.app-checkbox.checkbox%3Elabel%3Einput%5Btype%3D%22checkbox%22%5D%2B.caption%3Aafter+%7B%0A++++top%3A+calc%28calc%28var%28--wm-checkbox-caption-line-height%29+%2B+var%28--wm-checkbox-gap%29%29+-+calc%28var%28--wm-checkbox-state-layer-size%29%2F2%29%29%3B%0A++++height%3A+0px%3B%0A++++left%3A+unset%3B%0A++++transform%3A+translate%283px%2C+11px%29+rotate%280deg%29+scale%281%29%3B%0A%7D",
|
|
5
|
+
"variables": "%7B+%7D",
|
|
6
|
+
"config": "%7B%0A%09%22widgetType%22%20%3A%20%22wm-custom-widget%22%2C%0A%09%22properties%22%20%3A%20%7B%0A%09%20%20%22layout%22%20%3A%20%7B%0A%09%09%22type%22%20%3A%20%22list%22%2C%0A%09%09%22displayName%22%20%3A%20%22Layout%22%2C%0A%09%09%22description%22%20%3A%20%22Defines%20the%20orientation%20of%20the%20element.%20%27horizontal%27%20indicates%20that%20the%20element%27s%20layout%20or%20behavior%20is%20aligned%20along%20the%20horizontal%20axis%20(left%20to%20right)%2C%20while%20%27vertical%27%20means%20the%20element%20is%20aligned%20along%20the%20vertical%20axis%20(top%20to%20bottom)%22%2C%0A%09%09%22options%22%20%3A%20%5B%20%22horizontal%22%2C%20%22vertical%22%20%5D%2C%0A%09%09%22value%22%20%3A%20%22horizontal%22%0A%09%20%20%7D%2C%0A%09%20%20%22show_intermediate%22%20%3A%20%7B%0A%09%09%22type%22%20%3A%20%22boolean%22%2C%0A%09%09%22displayName%22%20%3A%20%22Intermediate%20checkbox%22%2C%0A%09%09%22description%22%20%3A%20%22Controls%20whether%20the%20checkbox%20shows%20an%20indeterminate%20state.%20True%20displays%20the%20intermediate%20state%22%2C%0A%09%09%22value%22%20%3A%20false%0A%09%20%20%7D%2C%0A%09%20%20%22state%22%20%3A%20%7B%0A%09%09%22type%22%20%3A%20%22list%22%2C%0A%09%09%22displayName%22%20%3A%20%22State%22%2C%0A%09%09%22description%22%20%3A%20%22Specifies%20whether%20the%20component%20is%20active%20or%20inactive.%20%27enabled%27%20means%20the%20component%20is%20interactive%20and%20functional%2C%20while%20%27disabled%27%20means%20it%20is%20non-interactive%20and%20inactive%22%2C%0A%09%09%22options%22%20%3A%20%5B%20%22Enabled%22%2C%20%22Disabled%22%20%5D%2C%0A%09%09%22value%22%20%3A%20%22Enabled%22%0A%09%20%20%7D%2C%0A%09%20%20%22label_placement%22%20%3A%20%7B%0A%09%09%22type%22%20%3A%20%22list%22%2C%0A%09%09%22displayName%22%20%3A%20%22Label%20placement%22%2C%0A%09%09%22description%22%20%3A%20%22Specifies%20the%20label%27s%20position%20relative%20to%20the%20component%2C%20with%20options%3A%20%27top%27%20(Label%20appears%20above%20the%20component)%2C%20%27bottom%27%20(Label%20appears%20below%20the%20component)%2C%20%27start%27%20(Label%20appears%20left%20of%20the%20component)%22%2C%0A%09%09%22options%22%20%3A%20%5B%20%22top%22%2C%20%22bottom%22%2C%20%22start%22%2C%20%22end%22%20%5D%2C%0A%09%09%22value%22%20%3A%20%22end%22%0A%09%20%20%7D%2C%0A%09%20%20%22label_text%22%20%3A%20%7B%0A%09%09%22type%22%20%3A%20%22string%22%2C%0A%09%09%22displayName%22%20%3A%20%22Label%20text%22%2C%0A%09%09%22description%22%20%3A%20%22Label%20text%20informs%20users%20about%20what%20information%20is%20requested%20for%20a%20checkboxSet%22%2C%0A%09%09%22value%22%20%3A%20%22Label%20Text%22%0A%09%20%20%7D%2C%0A%09%20%20%22data_set%22%20%3A%20%7B%0A%09%09%22type%22%20%3A%20%22string%22%2C%0A%09%09%22displayName%22%20%3A%20%22Data%20Set%20values%22%2C%0A%09%09%22description%22%20%3A%20%22Defines%20the%20available%20options%20for%20the%20data%20set%2C%20typically%20a%20list%20of%20labels%20such%20as%20%27Option1%27%2C%20%27Option2%27%2C%20%27Option3%27%22%2C%0A%09%09%22value%22%20%3A%20%22Option1%2COption2%2COption3%22%0A%09%20%20%7D%2C%0A%09%20%20%22default_value%22%20%3A%20%7B%0A%09%09%22type%22%20%3A%20%22string%22%2C%0A%09%09%22displayName%22%20%3A%20%22Default%20Value%22%2C%0A%09%09%22description%22%20%3A%20%22Specifies%20the%20default%20value%20for%20the%20checked%20attribute.%20Default%20is%20%27Option1%27%22%2C%0A%09%09%22value%22%20%3A%20%22%22%0A%09%20%20%7D%2C%0A%09%20%20%22required%22%20%3A%20%7B%0A%09%09%22type%22%20%3A%20%22boolean%22%2C%0A%09%09%22displayName%22%20%3A%20%22Required%22%2C%0A%09%09%22description%22%20%3A%20%22Indicates%20whether%20the%20checkboxSet%20is%20mandatory.%20True%20makes%20it%20required%3B%20false%20means%20it%20is%20optional%22%2C%0A%09%09%22value%22%20%3A%20false%0A%09%20%20%7D%0A%09%7D%2C%0A%09%22events%22%20%3A%20%7B%20%7D%0A%20%20%7D%0A%20%20"
|
|
7
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare function initializeSlider(widgetMap: any, value: any, minValue: any, maxValue: any, stepValue: any, required: any): void;
|
|
2
|
+
declare function updateSlider(widgetMap: any, value: any, minValue: any, maxValue: any, stepValue: any): void;
|
|
3
|
+
declare function updateSliderStep(widgetMap: any, value: any, minValue: any, maxValue: any, stepValue: any): void;
|
|
4
|
+
declare function setRequired(widgetMap: any, required: any): void;
|
|
5
|
+
declare function appendSliderIndicator(slider: any): void;
|
|
6
|
+
declare function configureSliderAndSetStyles(widgetMap: any, value: any, minValue: any, maxValue: any, stepValue: any): void;
|
|
7
|
+
declare function updateSliderStyles(slider: any, value: any, minValue: any, maxValue: any): void;
|
|
8
|
+
declare function setupStepsAndLabels(widgetMap: any): void;
|
|
9
|
+
declare function createStepLabel(labelValue: any, minValue: any, maxValue: any): HTMLParagraphElement;
|
|
10
|
+
declare function updateLabelVisibility(widgetMap: any): void;
|
|
11
|
+
declare function getSliderPercentage(value: any, minValue: any, maxValue: any): number;
|
|
12
|
+
declare function getSliderPercentage(value: any): number;
|
|
13
|
+
declare function clamp(value: any, minValue: any, maxValue: any): number;
|
|
14
|
+
declare function toggleLabelVisibilty(showLabelsBool: any, widgetMap: any): void;
|
|
15
|
+
declare function toggleLabelVisibilty(widgetMap: any, showLabelsBool: any): void;
|
|
16
|
+
declare function toggleIconsVisibility(widgetMap: any, showIconsBool: any, iconActionsBool: any): void;
|
|
17
|
+
declare function toggleIconsVisibility(widgetMap: any, showIconsBool: any, startIcon: any, endIcon: any, iconActionsBool: any): void;
|
|
18
|
+
declare function updateStartIconVisibility(widgetMap: any, iconActionsBool: any, showIconsBool: any): void;
|
|
19
|
+
declare function updateStartIconVisibility(widgetMap: any, iconActionsBool: any, showIconsBool: any): void;
|
|
20
|
+
declare function updateEndIconVisibility(widgetMap: any, iconActionsBool: any, showIconsBool: any): void;
|
|
21
|
+
declare function updateEndIconVisibility(widgetMap: any, iconActionsBool: any, showIconsBool: any): void;
|
|
22
|
+
declare function moveSlider(direction: any, widgetMap: any): void;
|
|
23
|
+
declare function moveSlider(widgetMap: any, direction: any): void;
|
|
24
|
+
declare function convertToBoolean(value: any): boolean;
|
|
25
|
+
declare function convertToBoolean(value: any): boolean;
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
Widget.onPropertyChange = function (propName, newValue, oldValue) {
|
|
2
|
+
var _a = Widget.props, value = _a.value, step_value = _a.step_value, required = _a.required, min_value = _a.min_value, max_value = _a.max_value, show_labels = _a.show_labels, show_icons = _a.show_icons, icon_actions = _a.icon_actions;
|
|
3
|
+
var widgetMap = Widget.Widgets;
|
|
4
|
+
var showIconsBool = convertToBoolean(show_icons);
|
|
5
|
+
var showLabelsBool = convertToBoolean(show_labels);
|
|
6
|
+
var iconActionsBool = convertToBoolean(icon_actions);
|
|
7
|
+
switch (propName) {
|
|
8
|
+
case 'prop-value':
|
|
9
|
+
case 'prop-min_value':
|
|
10
|
+
case 'prop-max_value':
|
|
11
|
+
updateSlider(widgetMap, value, min_value, max_value, step_value);
|
|
12
|
+
break;
|
|
13
|
+
case 'prop-step_value':
|
|
14
|
+
updateSliderStep(widgetMap, value, min_value, max_value, step_value);
|
|
15
|
+
break;
|
|
16
|
+
case 'prop-required':
|
|
17
|
+
setRequired(widgetMap, required);
|
|
18
|
+
break;
|
|
19
|
+
case "prop-show_labels":
|
|
20
|
+
toggleLabelVisibilty(showLabelsBool, widgetMap);
|
|
21
|
+
break;
|
|
22
|
+
case "prop-show_icons":
|
|
23
|
+
toggleIconsVisibility(widgetMap, showIconsBool, iconActionsBool);
|
|
24
|
+
break;
|
|
25
|
+
case "prop-start_icon":
|
|
26
|
+
updateStartIconVisibility(widgetMap, iconActionsBool, showIconsBool);
|
|
27
|
+
break;
|
|
28
|
+
case "prop-end_icon":
|
|
29
|
+
updateEndIconVisibility(widgetMap, iconActionsBool, showIconsBool);
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
Widget.onReady = function () {
|
|
34
|
+
var _a = Widget.props, value = _a.value, step_value = _a.step_value, required = _a.required, min_value = _a.min_value, max_value = _a.max_value, show_labels = _a.show_labels, show_icons = _a.show_icons, icon_actions = _a.icon_actions;
|
|
35
|
+
var widgetMap = Widget.Widgets;
|
|
36
|
+
var showIconsBool = convertToBoolean(show_icons);
|
|
37
|
+
var showLabelsBool = convertToBoolean(show_labels);
|
|
38
|
+
var iconActionsBool = convertToBoolean(icon_actions);
|
|
39
|
+
widgetMap.sliderContainer.nativeElement.classList.add('filled-slider', 'discrete-slider');
|
|
40
|
+
initializeSlider(widgetMap, value, min_value, max_value, step_value, required);
|
|
41
|
+
toggleLabelVisibilty(showLabelsBool, widgetMap);
|
|
42
|
+
toggleIconsVisibility(widgetMap, showIconsBool, iconActionsBool);
|
|
43
|
+
};
|
|
44
|
+
function initializeSlider(widgetMap, value, minValue, maxValue, stepValue, required) {
|
|
45
|
+
updateSlider(widgetMap, value, minValue, maxValue, stepValue);
|
|
46
|
+
setRequired(widgetMap, required);
|
|
47
|
+
appendSliderIndicator(widgetMap.slider);
|
|
48
|
+
}
|
|
49
|
+
function updateSlider(widgetMap, value, minValue, maxValue, stepValue) {
|
|
50
|
+
if (value !== undefined) {
|
|
51
|
+
widgetMap.slider.datavalue = Number(value);
|
|
52
|
+
}
|
|
53
|
+
configureSliderAndSetStyles(widgetMap, value, minValue, maxValue, stepValue);
|
|
54
|
+
setupStepsAndLabels(widgetMap);
|
|
55
|
+
}
|
|
56
|
+
function updateSliderStep(widgetMap, value, minValue, maxValue, stepValue) {
|
|
57
|
+
updateSlider(widgetMap, value, minValue, maxValue, stepValue);
|
|
58
|
+
}
|
|
59
|
+
function setRequired(widgetMap, required) {
|
|
60
|
+
widgetMap.composite.required = required;
|
|
61
|
+
}
|
|
62
|
+
function appendSliderIndicator(slider) {
|
|
63
|
+
var sliderElement = slider.nativeElement;
|
|
64
|
+
if (sliderElement) {
|
|
65
|
+
var indicator = document.createElement('p');
|
|
66
|
+
var labelContainer = document.createElement('div');
|
|
67
|
+
labelContainer.className = 'stop-indicator';
|
|
68
|
+
indicator.className = 'active-slider';
|
|
69
|
+
sliderElement.appendChild(indicator);
|
|
70
|
+
sliderElement.appendChild(labelContainer);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function configureSliderAndSetStyles(widgetMap, value, minValue, maxValue, stepValue) {
|
|
74
|
+
var slider = widgetMap.slider;
|
|
75
|
+
minValue = parseInt(minValue, 10);
|
|
76
|
+
maxValue = parseInt(maxValue, 10);
|
|
77
|
+
stepValue = parseInt(stepValue, 10);
|
|
78
|
+
if (isNaN(minValue) || isNaN(maxValue) || isNaN(stepValue) || stepValue <= 0) {
|
|
79
|
+
console.error("Invalid min, max, or step values");
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
slider.min = minValue;
|
|
83
|
+
slider.max = maxValue;
|
|
84
|
+
slider.step = stepValue;
|
|
85
|
+
slider.datavalue = clamp(slider.datavalue, minValue, maxValue);
|
|
86
|
+
updateSliderStyles(slider, slider.datavalue, minValue, maxValue);
|
|
87
|
+
}
|
|
88
|
+
function updateSliderStyles(slider, value, minValue, maxValue) {
|
|
89
|
+
var percentage = getSliderPercentage(value, minValue, maxValue);
|
|
90
|
+
slider.nativeElement.style.setProperty("--end", "".concat(100 - percentage, "%"));
|
|
91
|
+
}
|
|
92
|
+
function setupStepsAndLabels(widgetMap) {
|
|
93
|
+
var slider = widgetMap.slider;
|
|
94
|
+
var labelContainer = widgetMap.labelsContainer;
|
|
95
|
+
var minValue = parseInt(slider.min, 10);
|
|
96
|
+
var maxValue = parseInt(slider.max, 10);
|
|
97
|
+
var stepValue = parseInt(slider.step, 10);
|
|
98
|
+
if (!labelContainer)
|
|
99
|
+
return;
|
|
100
|
+
var numSteps = Math.ceil((maxValue - minValue) / stepValue);
|
|
101
|
+
labelContainer.$element[0].innerHTML = ''; // Clear existing labels
|
|
102
|
+
for (var i = 0; i <= numSteps; i++) {
|
|
103
|
+
var labelValue = minValue + i * stepValue;
|
|
104
|
+
if (labelValue > maxValue)
|
|
105
|
+
break;
|
|
106
|
+
var stepLabel = createStepLabel(labelValue, minValue, maxValue);
|
|
107
|
+
labelContainer.$element[0].appendChild(stepLabel);
|
|
108
|
+
}
|
|
109
|
+
slider.$element[0].addEventListener('input', function () { return updateLabelVisibility(widgetMap); });
|
|
110
|
+
updateLabelVisibility(widgetMap);
|
|
111
|
+
}
|
|
112
|
+
function createStepLabel(labelValue, minValue, maxValue) {
|
|
113
|
+
var stepLabel = document.createElement('p');
|
|
114
|
+
stepLabel.className = 'step-label';
|
|
115
|
+
stepLabel.textContent = labelValue;
|
|
116
|
+
var position = ((labelValue - minValue) / (maxValue - minValue)) * 100;
|
|
117
|
+
stepLabel.style.setProperty('--position', "".concat(position - 1, "%"));
|
|
118
|
+
stepLabel.setAttribute('data-position', position);
|
|
119
|
+
return stepLabel;
|
|
120
|
+
}
|
|
121
|
+
function updateLabelVisibility(widgetMap) {
|
|
122
|
+
var slider = widgetMap.slider;
|
|
123
|
+
var labels = widgetMap.labelsContainer.nativeElement.getElementsByClassName('step-label');
|
|
124
|
+
var sliderValue = slider.datavalue;
|
|
125
|
+
var minValue = slider.min;
|
|
126
|
+
var maxValue = slider.max;
|
|
127
|
+
var stepValue = slider.step;
|
|
128
|
+
var validValues = Array.from({
|
|
129
|
+
length: Math.ceil((maxValue - minValue) / stepValue) + 1
|
|
130
|
+
}, function (_, i) { return minValue + i * stepValue; })
|
|
131
|
+
.filter(function (value) { return value <= maxValue; });
|
|
132
|
+
for (var _i = 0, labels_1 = labels; _i < labels_1.length; _i++) {
|
|
133
|
+
var label = labels_1[_i];
|
|
134
|
+
var labelValue = parseInt(label.textContent, 10);
|
|
135
|
+
label.classList.remove('hidden', 'inactive', 'active');
|
|
136
|
+
if (validValues.includes(labelValue)) {
|
|
137
|
+
if (labelValue === sliderValue) {
|
|
138
|
+
label.classList.add('hidden');
|
|
139
|
+
}
|
|
140
|
+
else if (labelValue < sliderValue) {
|
|
141
|
+
label.classList.add('inactive');
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
label.classList.add('active');
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
label.style.display = 'block';
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function getSliderPercentage(value, minValue, maxValue) {
|
|
151
|
+
return ((value - minValue) / (maxValue - minValue)) * 100;
|
|
152
|
+
}
|
|
153
|
+
function clamp(value, minValue, maxValue) {
|
|
154
|
+
return Math.min(Math.max(value, minValue), maxValue);
|
|
155
|
+
}
|
|
156
|
+
function toggleLabelVisibilty(showLabelsBool, widgetMap) {
|
|
157
|
+
if (showLabelsBool) {
|
|
158
|
+
widgetMap.slider.nativeElement.classList.remove("hide-labels");
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
widgetMap.slider.nativeElement.classList.add("hide-labels");
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function toggleIconsVisibility(widgetMap, showIconsBool, iconActionsBool) {
|
|
165
|
+
var decrementButton = widgetMap.decrementButton, incrementButton = widgetMap.incrementButton;
|
|
166
|
+
if (showIconsBool) {
|
|
167
|
+
updateStartIconVisibility(widgetMap, iconActionsBool, showIconsBool);
|
|
168
|
+
updateEndIconVisibility(widgetMap, iconActionsBool, showIconsBool);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
decrementButton.show = false;
|
|
172
|
+
incrementButton.show = false;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function updateStartIconVisibility(widgetMap, iconActionsBool, showIconsBool) {
|
|
176
|
+
var decrementButton = widgetMap.decrementButton;
|
|
177
|
+
if (showIconsBool) {
|
|
178
|
+
decrementButton.show = true;
|
|
179
|
+
decrementButton.nativeElement.style.pointerEvents = iconActionsBool ?
|
|
180
|
+
"auto" :
|
|
181
|
+
"none";
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
decrementButton.show = false;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function updateEndIconVisibility(widgetMap, iconActionsBool, showIconsBool) {
|
|
188
|
+
var incrementButton = widgetMap.incrementButton;
|
|
189
|
+
if (showIconsBool) {
|
|
190
|
+
incrementButton.show = true;
|
|
191
|
+
incrementButton.nativeElement.style.pointerEvents = iconActionsBool ?
|
|
192
|
+
"auto" :
|
|
193
|
+
"none";
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
incrementButton.show = false;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function moveSlider(direction, widgetMap) {
|
|
200
|
+
var slider = widgetMap.slider;
|
|
201
|
+
var newValue = Number(slider.datavalue) + (direction * slider.step);
|
|
202
|
+
newValue = Math.max(Math.min(newValue, slider.maxvalue), slider.minvalue);
|
|
203
|
+
slider.datavalue = newValue;
|
|
204
|
+
Widget.sliderChange(null, slider, newValue);
|
|
205
|
+
}
|
|
206
|
+
function convertToBoolean(value) {
|
|
207
|
+
return value === true || value === "true";
|
|
208
|
+
}
|
|
209
|
+
Widget.sliderChange = function ($event, widget, newVal) {
|
|
210
|
+
updateSliderStyles(widget, newVal, widget.min, widget.max);
|
|
211
|
+
updateLabelVisibility(Widget.Widgets);
|
|
212
|
+
};
|
|
213
|
+
Widget.decrementButtonClick = function ($event, widget) {
|
|
214
|
+
moveSlider(-1, Widget.Widgets);
|
|
215
|
+
};
|
|
216
|
+
Widget.incrementButtonClick = function ($event, widget) {
|
|
217
|
+
moveSlider(1, Widget.Widgets);
|
|
218
|
+
};
|